tom_d4rt_dcli library
DCLI - D4rt Command Line Interface with dcli bridges
This is the base D4rt REPL tool with only dcli package bridges. For the full D4rt tool with Tom Framework bridges, use tom_dartscript_bridges.
Classes
- AgentDefinition
-
A programmatic sub-agent definition. Mirrors
AgentDefinition. - AgentQuery
-
A live Agent SDK query: a
Stream<SdkMessage>plus control methods. - AgentSdkClient
-
Entry point mirroring the SDK's
query()free function, bound to a AgentSdkTransport. - AgentSdkToolRegistry
-
Indexes the Dart ToolHandlers a query exposes and dispatches incoming
agentSdk.toolCallrequests to them. - AgentSdkTransport
- Transport seam for streaming Agent SDK queries.
- AiConversationApi
- AI Conversation API — bot conversation orchestration.
- AiModelConfig
- An Ollama model configuration.
- AiModelsResult
- Result of listing available models, including the effective default.
- AiPromptApi
- AI Prompt API — local LLM prompt expansion.
- AiPromptProfile
- A prompt expander profile.
- AiPromptResult
- Result of a prompt expansion via AiPromptApi.process.
- AiTokenStats
- Token usage statistics from a local Ollama model call.
- BotConfig
- Configuration for a single bot.
- BotInstance
- Single bot instance connected to Telegram.
- BotModeConfig
- Main configuration for bot mode.
- BoxGlyphSet
- BridgeRequestDispatcher
- Routes incoming server→client requests to registered handlers and writes their replies through an injected sink.
- Calendar
- CallToolResult
-
The result a ToolHandler returns. Mirrors MCP
CallToolResult. - CanUseToolContext
-
Context passed to a CanUseTool callback. Mirrors the SDK's
{ suggestions?, signal }argument; the payload is kept opaque (raw) until the reverse-RPC wiring (todos #4–#6) gives it structure. - ChatApi
- Abstract base class for chat platform integrations.
- ChatAttachment
- Represents an attachment in a message.
- ChatConfig
- Base class for chat platform configuration.
- ChatContext
- Context for a chat request including conversation history
- ChatErrorDetails
- Error details for a failed chat request
- ChatMessage
- A message sent or received through the chat API.
- ChatMessageFilter
- Filter for selecting specific message types.
- ChatParticipant
- A chat participant
- ChatPromptReference
- A reference in a chat prompt
- ChatReceiver
- Identifies a recipient for sending messages.
- ChatReceiverInfo
- Additional information about a receiver.
- ChatRequest
- A chat request from the user
- ChatResponse
-
Encapsulates the response from
ChatAPI.getMessages. - ChatResponseStream
- A stream for sending responses back to the chat
- ChatResult
- Result of handling a chat request
- ChatSender
- Represents the sender of a message.
- ChatSettings
- Settings for connecting to chat platforms.
- ChatVariable
- Chat variable value.
- ChatVariableListResult
- Result of listing chat variables.
- CliReplIntegration
- Integrates the CLI API with the existing REPL infrastructure.
- CommandsConfig
- Command restriction configuration.
- Console
- Console wrapper that exposes the scrollback buffer for pre-population
- ContentBlock
- A content block inside an assistant or user message.
- ConversationActionResult
- Result of a stop/halt/continue/addInfo operation.
- ConversationConfig
- Bot conversation configuration (resolved from send_to_chat.json).
- ConversationExchange
- A single exchange in the conversation trail.
- ConversationLog
- Conversation log retrieved from disk.
- ConversationProfile
- A named bot conversation profile.
- ConversationResult
- Result of starting a bot conversation via AiConversationApi.start.
- ConversationStatus
- Current status of a bot conversation.
- ConversationTrailManager
- Manages the conversation trail for a bot session.
- Coordinate
- A screen position, measured in rows and columns from the top-left origin of the screen. Coordinates are zero-based, and converted as necessary for the underlying system representation (e.g. one-based for VT-style displays).
- CopilotChatResponse
- Structured response from Copilot Chat.
- CopilotResponse
- Response from Copilot in a bot conversation exchange.
- D4rtReplBase
- Base class for D4rt REPL tools.
- DcliRepl
- DCLI REPL implementation.
- DirectoriesConfig
- Directory restriction configuration.
- DocumentContent
- Content of a document.
- DocumentInfo
- Metadata about a document file.
- DocumentListResult
- Result of listing documents.
- ExecutionResult
- Execution result from REPL.
- Extension
- Represents a VS Code extension
- FileBatch
- File batch processor
- FileSystemWatcherOptions
- File system watcher options
- FileTransferConfig
- File transfer configuration.
- FollowUpInput
- Input for adding a follow-up prompt to a queue item.
- FormattedOutput
- Formatted output ready for Telegram.
- GuidelineInfo
- Guideline document info.
- GuidelineListResult
- Result of listing guidelines.
- HelperLogging
- Logging control for VsCodeHelper
- InputBoxOptions
- Input box options
- Key
- A representation of a keystroke.
- LanguageModelChat
- Represents a language model for chat requests
- LanguageModelChatMessage
- A message in a chat conversation
- LanguageModelChatResponse
- Response from a language model chat request
- LanguageModelToolInformation
- Information about a registered tool
- LanguageModelToolResult
- Tool result from language model
- LazyVSCodeBridgeAdapter
- A lazy-connecting adapter that auto-connects on first use.
- LimitsConfig
- Execution limits configuration.
- McpHttpServerConfig
-
An HTTP MCP server. Mirrors
McpHttpServerConfig. - McpSdkServerConfig
-
An in-process ("sdk") MCP server. Mirrors
McpSdkServerConfigWithInstance, but carries a serializable descriptor instead of a liveMcpServer(proposal §7.0.4): the extension reconstructs the real instance. - McpServerConfig
-
An MCP server configuration referenced from
Options.mcpServers. MirrorsMcpServerConfig(stdio / sse / http / sdk variants). - McpServerToolPolicy
-
Per-tool permission policy for a remote MCP server. Mirrors
McpServerToolPolicy(permission_policyis snake_case on the wire). - McpSSEServerConfig
-
An SSE MCP server. Mirrors
McpSSEServerConfig. - McpStdioServerConfig
-
A stdio MCP server. Mirrors
McpStdioServerConfig. - MessageExecutionResult
- Result of message execution (before formatting).
- MessageOptions
- Message options
- Options
-
Options for an Agent SDK query. Mirrors the SDK's
Optionstype. - OutputConfig
- Output formatting configuration.
- OutputFormat
-
Structured output configuration. Mirrors
{ type:'json_schema', schema }. - OutputFormatter
- Formats REPL output for Telegram display.
- PermissionAllow
-
Allow result (
behavior: 'allow'). - PermissionDeny
-
Deny result (
behavior: 'deny'). - PermissionResult
- Result of a permission check.
- PermissionRuleValue
-
A single tool-permission rule. Mirrors
PermissionRuleValue. - PermissionUpdate
-
A permission-rule mutation. Mirrors
PermissionUpdate(six variants). - PermissionUpdateDirectories
-
addDirectories/removeDirectoriesupdates. - PermissionUpdateRules
-
addRules/replaceRules/removeRulesupdates. - PermissionUpdateSetMode
-
setModeupdate. - PluginConfig
-
A local plugin configuration. Mirrors
SdkPluginConfig. - PollingConfig
- Polling configuration.
- Position
- Position in a text document
- PreprocessedMessage
- Preprocessed message data extracted from incoming Telegram message.
- ProgressBar
- A facility for drawing a progress bar in the terminal.
- ProjectListResult
- Result of listing projects.
- PromptEntry
- Prompt entry in the conversation trail.
- QuestInfo
- Information about a quest.
- QuestListResult
- Result of listing quests.
- QueuedFollowUp
- A follow-up prompt attached to a queue item.
- QueuedPrompt
- A queued prompt item.
- QueueItemInput
- Input for creating a new queue item.
- QueueListResult
- Result of listing queue items.
- QuickPickItem
- Quick pick item
- Range
- Range in a text document
- ReplState
- Session state for the REPL
- ReplyEntry
- Reply entry in the conversation trail.
- ScheduledTime
- A scheduled time slot.
- ScrollbackBuffer
- Scrollback buffer for command history - copied from dart_console but made public so we can pre-populate it
- SdkAssistantMessage
-
Mirrors
SDKAssistantMessage(type: 'assistant'). - SdkMcpTool
-
An in-process tool definition. Mirrors
SdkMcpToolDefinition/ the object built bytool(). - SdkMessage
- A single message yielded by an Agent SDK query stream.
- SdkPartialAssistantMessage
-
Mirrors
SDKPartialAssistantMessage(type: 'stream_event'), emitted only whenincludePartialMessagesis set. - SdkResultMessage
-
Mirrors
SDKResultMessage(type: 'result', success or error subtype). - SdkSystemEvent
-
Carrier for the long tail of
type: 'system'events that are notinit(e.g.compact_boundary,status,task_progress,rate_limit, …). - SdkSystemMessage
-
Mirrors
SDKSystemMessage(type: 'system',subtype: 'init'). - SdkUnknownMessage
-
Forward-compatible fallback for any top-level
typethis mirror does not model. Preserves the full payload in raw. - SdkUserMessage
-
Mirrors
SDKUserMessage(type: 'user', incl. the replay variant). - SearchFilter
- SecurityConfig
- Security configuration.
- SecurityManager
- Security manager that validates commands and paths.
- Selection
- Selection in a text editor
- SendToChatResult
- The outcome of a TomChatApi.sendToChat call.
- SettingsInline
- Inline settings.
- SettingsPath
- A path to a settings file.
- SettingsRef
-
A settings reference. Mirrors
string | Settings(a path or an inline map). - SingleTurnResult
- Result of a single-turn Ollama→Copilot round-trip.
- Skills
-
The skills selection. Mirrors
string[] | 'all'. - SkillsAll
-
Enable all skills (
'all'). - SkillsList
- An explicit list of skill names.
- SystemPrompt
-
The system prompt. Mirrors
string | string[] | { type:'preset', … }. - SystemPromptList
- A multi-section system prompt (string array).
- SystemPromptPreset
- The Claude Code preset system prompt, optionally appended/trimmed.
- SystemPromptText
- A plain-string system prompt.
- Table
- An experimental class for drawing tables. The API is not final yet.
- TaskBudget
-
A task budget. Mirrors
{ total }. - TelegramBotServer
- Telegram Bot Mode Server.
- TelegramChatConfig
- Configuration for connecting to Telegram via Bot API.
- TelegramPreparedMessage
- Result of preparing text for Telegram.
- TerminalOptions
- Terminal options
- TextBlock
-
Mirrors a
textcontent block. - TextDocument
- Text document representation
- TextEditor
- Text editor representation
- ThinkingAdaptive
-
Adaptive thinking — the model decides (
type: 'adaptive'). - ThinkingBlock
-
Mirrors a
thinkingcontent block. - ThinkingConfig
-
Extended-thinking configuration. Mirrors
ThinkingConfig. - ThinkingDisabled
-
No extended thinking (
type: 'disabled'). - ThinkingEnabled
-
Fixed thinking budget (
type: 'enabled'). - TimedRequest
- A timed request entry.
- TimedRequestInput
- Input for creating a new timed request.
- TimedRequestListResult
- Result of listing timed requests.
- TodoFileListResult
- Result of listing todo files.
- TodoItem
- A single TODO item.
- TodoListResult
- Result of listing todos.
- TodoReference
- Reference within a todo item.
- TodoScope
- Scope within a todo item.
- TomChatApi
- Scripting access to the Tom extension's "Send to Chat" transport.
- TomD4rtDcliBridge
- Combined bridge registration for tom_d4rt_dcli.
- TomDocumentApi
- API for accessing workspace documents.
- TomQueueApi
- API for managing the prompt queue.
- TomTimedApi
- API for managing timed/scheduled requests.
- TomTodoApi
- API for managing TODO items across quest, workspace, and session scopes.
- TomToolsApi
- Scripting access to the Tom extension's LLM tool registry.
- TomWorkspaceApi
- API for accessing workspace structure and configuration.
- ToolDefinitionJson
-
An Anthropic-shaped tool definition:
{name, description, input_schema}. - ToolResultBlock
-
Mirrors a
tool_resultcontent block. - ToolsClaudeCodePreset
- The Claude Code default tool preset.
- ToolsConfig
-
The tool selection. Mirrors
string[] | { type:'preset', preset:'claude_code' }. - ToolsList
- An explicit list of tool names.
- ToolUseBlock
-
Mirrors a
tool_usecontent block. - TrailEntry
- Trail entry (prompt/answer pair).
- TrailListResult
- Result of listing trail entries.
- UnknownBlock
-
Forward-compatible fallback for any content block type this mirror does not
model (
redacted_thinking,server_tool_use, image, …). - VSCode
- Main VS Code API wrapper class Provides unified access to all VS Code APIs through Dart
- VSCodeAdapter
- Abstract interface for sending requests to VS Code
- VSCodeBridgeAdapter
- Implementation of VSCodeAdapter using VSCodeBridgeClient.
- VSCodeBridgeAgentSdkTransport
- Production AgentSdkTransport backed by a VSCodeBridgeClient.
- VSCodeBridgeClient
- Client for communicating with VS Code VS Code Bridge.
- VSCodeBridgeResult
- Result of a VS Code bridge command execution.
- VSCodeChat
- Chat API - Create and manage chat participants
- VSCodeCommands
- Wrapper for vscode.commands API Provides access to VS Code command system
- VSCodeCommonCommands
- Common VS Code commands
- VSCodeConfig
- VS Code connection configuration.
- VSCodeExtensions
- Wrapper for vscode.extensions API Provides access to VS Code extensions management
- VsCodeHelper
- Helper class for VS Code API operations in scripts
- VSCodeLanguageModel
- Language Model API - Access to GitHub Copilot and other language models
- VSCodeUri
- Represents a URI in VS Code
- VSCodeWindow
- Wrapper for vscode.window API Provides access to window-related functionality (UI, messages, editors, etc.)
- VSCodeWorkspace
- Wrapper for vscode.workspace API Provides access to workspace-related functionality
- VsProgress
- Progress indicator helper
- WorkspaceFolder
- Represents a workspace folder
Enums
- BorderStyle
- BorderType
- ChatAttachmentType
- Types of attachments.
- ChatMessageType
- Types of chat messages.
- ChatReceiverType
- Types of receiver identifiers.
- ChatResponseStatus
- Status codes for chat responses.
- ConsoleColor
- ControlCharacter
- Non-printable characters that can be entered from the keyboard.
- ConversationMode
- Conversation mode — who talks to whom.
- DiagnosticSeverity
- Diagnostic severity
- DocumentFolder
- Type of document folder.
- EffortLevel
-
Reasoning-effort level. Mirrors
EffortLevel. - FontStyle
- HistoryMode
- History mode — how much conversation history is passed to the local model.
- MessageType
- Type of message determined during preprocessing.
- MultilineMode
- Multiline mode types
- PermissionBehavior
-
Behaviour applied by a permission rule. Mirrors
PermissionBehavior. - PermissionDecisionClassification
-
Classification of a permission decision. Mirrors
PermissionDecisionClassification(snake_case wire values). - PermissionMode
-
Controls how tool executions are handled. Mirrors
PermissionMode(six values;defaultis spelled PermissionMode.default_ in Dart). - PermissionUpdateDestination
-
Where a permission update is persisted. Mirrors
PermissionUpdateDestination. - ProjectType
- Type of project detected in the workspace.
- QueuedPromptStatus
- Status of a queued prompt.
- QueuedPromptType
- Type of a queued prompt.
- ScheduleMode
- Schedule mode for timed requests.
- SearchMatchMode
- SettingSource
-
Where the agent loads filesystem settings from. Mirrors
SettingSource. - TextAlignment
- Text alignments for line output.
- TimedRequestStatus
- Status of a timed request entry.
- TodoPriority
- Priority of a todo item.
- TodoStatus
- Status of a todo item.
Mixins
- VSCodeIntegrationMixin
- Mixin providing VS Code integration for D4rt REPL tools.
Extensions
Constants
- defaultVSCodeBridgePort → const int
- Default (and lowest) port for the VS Code CLI Integration Server.
- maxHistoryLines → const int
- Maximum number of lines to keep in persistent history
- maxVSCodeBridgePort → const int
- Highest port in the VS Code CLI Integration Server range.
Properties
- chat → VSCodeChat
-
VS Code chat API.
no setter
- commands → VSCodeCommands
-
VS Code commands API.
no setter
- dataDirectory → String
-
Get the current data directory
no setter
- definesFilePath → String
-
Get the path to the defines file
no setter
- extensions → VSCodeExtensions
-
VS Code extensions API.
no setter
- historyFilePath → String
-
Get the path to the history file
no setter
- lm → VSCodeLanguageModel
-
VS Code language model API.
no setter
- vscode → VSCode
-
Main VS Code API entry point.
no setter
- window → VSCodeWindow
-
VS Code window API.
no setter
- workspace → VSCodeWorkspace
-
VS Code workspace API.
no setter
Functions
-
appendToHistory(
String line) → void - Save a line to persistent history
-
connectToWorkspace(
String name, {String host = '127.0.0.1', int minPort = defaultVSCodeBridgePort, int maxPort = maxVSCodeBridgePort, BridgePortProbe probe = _defaultProbe, BridgeIdentityFetcher fetchIdentity = fetchBridgeWorkspaceName, bool initializeVSCode = false, BridgeAdapterFactory adapterFactory = _defaultAdapterFactory}) → Future< LazyVSCodeBridgeAdapter> -
Resolves the bridge port for the workspace named
name(via findBridgePortForWorkspace) and returns a connected adapter bound to it. -
dispatchCanUseTool(
CanUseTool callback, Map< String, dynamic> params) → Future<Map< String, dynamic> > -
Invokes
callbackfor an incomingagentSdk.canUseToolrequest and returns itsPermissionResultas wire JSON. -
expandDefine(
String template, String restOfLine) → String - Expand a define template with arguments Placeholders: $$ - entire rest of line (unmodified) $1, $2, $3, etc. - individual arguments
-
fetchBridgeWorkspaceName(
String host, int port) → Future< String?> -
Default BridgeIdentityFetcher — connects to the bridge on
host:port, issues aworkspace.getInfoVcewindow-identity handshake, and derives the workspace name from the result. Returnsnullif the bridge cannot be reached or yields no identifiable workspace. -
findBridgePortForWorkspace(
String name, {String host = '127.0.0.1', int minPort = defaultVSCodeBridgePort, int maxPort = maxVSCodeBridgePort, BridgePortProbe probe = _defaultProbe, BridgeIdentityFetcher fetchIdentity = fetchBridgeWorkspaceName}) → Future< int> -
Scans the CLI bridge port range for the window whose workspace matches
nameand returns its port. -
formatResult(
dynamic result) → String - Formats a result for display in the REPL.
-
getCommonCommandsHelp(
) → String - Returns the common commands section shown at startup and in --help.
-
getCopilotPromptsHelp(
) → String - Returns the Copilot prompts section (for help command).
-
getD4rtSyntaxHelp(
) → String - Returns the D4rt syntax section (for help command).
-
getDefines(
) → Map< String, String> - Get all current defines
-
getDefinesHelp(
) → String - Returns the defines section.
-
getDirectoryCommandsHelp(
String dataPath, {String replayPatterns = '*.replay.txt, *.dcli'}) → String - Returns the directory commands section.
-
getFileCommandsHelp(
) → String - Returns the file commands section.
-
getFileConventionsHelp(
String toolName, String dataPath) → String - Returns the file conventions section (for --help).
-
getInitSourceHelp(
String toolName, String dataPath) → String - Returns the init source section (for --help).
-
getKeyboardShortcutsHelp(
) → String - Returns the keyboard shortcuts section (for help command).
-
getMultilineHelp(
) → String - Returns the multiline input section.
-
getPrintCommandsHelp(
) → String - Returns the print commands section.
-
getSessionsInfoHelp(
String dataPath) → String - Returns the sessions info section (for --help).
-
getStdlibImports(
) → String - Returns the stdlib import statements to prepend to scripts.
-
getStdlibNote(
) → String - Returns the standard library note for bridges help.
-
getTrailCommandsHelp(
) → String - Returns the bot mode trail commands section (for help command).
-
loadDefines(
) → Map< String, String> - Load defines from file into memory
-
loadDefinesFromFile(
String path) → int - Load defines from a file (without saving to persistent storage). Returns the number of defines loaded, or -1 if file not found. Default extension is .define.txt if no extension provided.
-
loadHistory(
) → List< String> - Load persistent history from file
-
normalizeWorkspaceName(
String value) → String -
Normalises a workspace name for comparison: trims whitespace, drops a
trailing
.code-workspaceextension, and strips VS Code's" (Workspace)"multi-root suffix. -
parseDefineArgs(
String input) → List< String> - Parse arguments from a string, respecting quotes Returns a list of arguments where quoted strings are kept together
-
parseSearchFilter(
String query) → bool Function(String)? - Parses a search query for case-sensitivity and wildcard matching. Returns a function that can be used to match names.
-
parseSearchFilterDetails(
String query) → SearchFilter? - Parses a search query for case-sensitivity and wildcard matching.
-
prepareForTelegram(
String text, {int maxChars = 4000}) → TelegramPreparedMessage - Prepare text for sending to Telegram.
-
prepareProgramSource(
String source, {required String importBlock}) → String -
Returns
sourcein a shape thatD4rt.execute(source:)can run. -
printResult(
dynamic result) → void - Prints a formatted result to stdout.
-
removeDefine(
String name) → bool - Remove a define
-
scanBridgePorts(
{String host = '127.0.0.1', int minPort = defaultVSCodeBridgePort, int maxPort = maxVSCodeBridgePort, BridgePortProbe probe = _defaultProbe, BridgeIdentityFetcher fetchIdentity = fetchBridgeWorkspaceName}) → Future< Map< int, String> > -
Scans the CLI bridge port range and returns a
port → workspacetable for every responsive bridge. -
setDataDirectory(
String path) → void - Set the data directory for history and defines storage
-
setDefine(
String name, String template) → void - Add or update a define
-
toTelegramMarkdownV2(
String text) → String - Convert console_markdown text to Telegram MarkdownV2.
-
truncateHistoryIfNeeded(
) → void - Truncate history file to max lines (called at startup)
-
tryExpandDefine(
String line) → String? - Check if a line starts with a define invocation (@name) Returns the expanded code if it matches, null otherwise
Typedefs
- BridgeAdapterFactory = LazyVSCodeBridgeAdapter Function(String host, int port)
- Creates a port-bound LazyVSCodeBridgeAdapter for a resolved bridge.
-
BridgeIdentityFetcher
= Future<
String?> Function(String host, int port) -
Fetches the workspace identity name reported by the bridge on
host:port, ornullif the bridge does not answer / has no identifiable workspace. -
BridgePortProbe
= Future<
bool> Function(String host, int port) -
Probes whether a bridge is listening on
host:port. -
BridgeRequestHandler
= FutureOr<
Object?> Function(Map<String, dynamic> params) -
A handler for an incoming server→client request
method. Receives the requestparamsand returns the JSON-encodable result (sync or async). -
CanUseTool
= Future<
PermissionResult> Function(String toolName, Map<String, dynamic> input, CanUseToolContext context) -
Tool-approval callback. Mirrors
CanUseTool. -
ChatRequestHandler
= Future<
ChatResult?> Function(ChatRequest request, ChatContext context, ChatResponseStream stream) - Chat request handler callback
-
ToolHandler
= Future<
CallToolResult> Function(Map<String, dynamic> args) -
A tool callback that runs in Dart. Mirrors the handler passed to
tool().
Exceptions / Errors
- AgentSdkQueryException
-
Thrown into an AgentQuery's stream when the extension reports a query
failure via an
errorchunk. - BridgeWorkspaceNotFoundException
- Thrown by findBridgePortForWorkspace when no responsive bridge in the scanned range has the requested workspace open.
- InterruptedException
- Exception thrown when an await operation is interrupted by CTRL-C