AiConversationApi class
AI Conversation API — bot conversation orchestration.
Provides type-safe Dart access to the DartScript Bot Conversation feature, which orchestrates multi-turn conversations between a local Ollama model and GitHub Copilot, or between two local model personas (self-talk mode).
All methods are static and require VSCode.initialize to have been called first.
Examples
// Start a conversation with defaults
final result = await AiConversationApi.start(
goal: 'Add comprehensive error handling to the auth module',
);
// Start with a specific profile and limited turns
final result2 = await AiConversationApi.start(
goal: 'Debug the login timeout issue',
profile: 'debug',
maxTurns: 5,
);
// Self-talk mode (two model personas)
final result3 = await AiConversationApi.start(
goal: 'Design a caching strategy for the API layer',
conversationMode: ConversationMode.ollamaOllama,
);
// Check status during a conversation
final status = await AiConversationApi.status();
if (status.active) {
print('Turn ${status.turnsCompleted}/${status.maxTurns}');
}
// Halt, add info, then continue
await AiConversationApi.halt();
await AiConversationApi.addInfo('Also consider rate limiting');
await AiConversationApi.continueConversation();
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
addInfo(
String text, {int timeoutSeconds = 30}) → Future< ConversationActionResult> - Add additional user input to the next prompt.
-
continueConversation(
{int timeoutSeconds = 30}) → Future< ConversationActionResult> - Continue a halted conversation.
-
getConfig(
{int timeoutSeconds = 30}) → Future< ConversationConfig> - Get the resolved bot conversation configuration.
-
getLog(
String conversationId, {int timeoutSeconds = 30}) → Future< ConversationLog> - Retrieve a conversation log by ID.
-
getProfiles(
{int timeoutSeconds = 30}) → Future< List< ConversationProfile> > - List available conversation profiles.
-
halt(
{String? reason, int timeoutSeconds = 30}) → Future< ConversationActionResult> - Halt (pause) the active conversation between turns.
-
singleTurn(
{required String prompt, String? systemPrompt, String? modelConfig, double? temperature, bool sendToCopilot = true, String? copilotSuffix, int timeoutSeconds = 300}) → Future< SingleTurnResult> - Run a single Ollama→Copilot round-trip without managing conversation state.
-
start(
{required String goal, String? description, String? profile, int? maxTurns, double? temperature, String? modelConfig, HistoryMode? historyMode, List< String> ? includeFileContext, bool? pauseBetweenTurns, ConversationMode? conversationMode, int timeoutSeconds = 1800}) → Future<ConversationResult> - Start a bot conversation.
-
status(
{int timeoutSeconds = 30}) → Future< ConversationStatus> - Get the status of the active conversation.
-
stop(
{String? reason, int timeoutSeconds = 30}) → Future< ConversationActionResult> - Stop the active conversation.