tom_dcli_exec 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. - AgentSdkInputTransport
- A transport that can also carry caller-owned streaming input (AgentSdkClient.streamQuery).
- AgentSdkToolRegistry
-
Indexes the Dart ToolHandlers a query exposes and dispatches incoming
agentSdk.toolCallrequests to them. - AgentSdkTransport
- Transport seam for streaming Agent SDK queries.
- 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. - ChatContext
- Context for a chat request including conversation history
- ChatErrorDetails
- Error details for a failed chat request
- ChatParticipant
- A chat participant
- ChatPromptReference
- A reference in a chat prompt
- ChatRequest
- A chat request from the user
- ChatResponseStream
- A stream for sending responses back to the chat
- ChatResult
- Result of handling a chat request
- ChatVariable
- Chat variable value.
- ChatVariableListResult
- Result of listing chat variables.
- CliReplIntegration
- Integrates the CLI API with the existing REPL infrastructure.
- Console
- Console wrapper that exposes the scrollback buffer for pre-population
- ContentBlock
- A content block inside an assistant or user message.
- 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).
- D4rtReplBase
- Base class for D4rt REPL tools.
- DcliRepl
- DCLI REPL implementation.
- DocumentContent
- Content of a document.
- DocumentInfo
- Metadata about a document file.
- DocumentListResult
- Result of listing documents.
- Extension
- Represents a VS Code extension
- FileBatch
- File batch processor
- FileSystemWatcherOptions
- File system watcher options
- FollowUpInput
- Input for adding a follow-up prompt to a queue item.
- GuidelineInfo
- Guideline document info.
- GuidelineListResult
- Result of listing guidelines.
- HelperLogging
- Logging control for VsCodeHelper
- InputBoxOptions
- Input box options
- InvalidTodo
- A todo in a list answer that could not be read as a TomItem.
- 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.
- 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. - MessageOptions
- Message options
- Options
-
Options for an Agent SDK query. Mirrors the SDK's
Optionstype. - OutputFormat
-
Structured output configuration. Mirrors
{ type:'json_schema', schema }. - PermissionAllow
-
Allow result (
behavior: 'allow'). - PermissionDeny
-
Deny result (
behavior: 'deny'). - 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. - Position
- Position in a text document
- ProgressBar
- A facility for drawing a progress bar in the terminal.
- ProjectListResult
- Result of listing projects.
- 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
- 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. - SdkUserInput
-
One user message for AgentSdkClient.streamQuery — the SDK's
SDKUserMessageinput shape. - SdkUserMessage
-
Mirrors
SDKUserMessage(type: 'user', incl. the replay variant). - SearchFilter
- 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). - 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 }. - 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.
- TodoEntry
- A todo as the extension answered it: the shared TomItem plus what the bridge says about it and what the model has no field for.
- TodoFileListResult
- Result of listing todo files.
- TodoListResult
- Result of listing todos.
- TodoWire
- Maps the extension bridge's todo JSON onto the shared todo model and back.
- TomChatApi
- Scripting access to the Tom extension's "Send to Chat" transport.
- TomD4rtDcliBridge
- Combined bridge registration for tom_dcli_exec.
- TomDocumentApi
- API for accessing workspace documents.
- TomItem
- One item: the record of D1 §3.1.
- 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.
- TomTodoDecision
-
One open or answered question on a todo (workspace schema
decisions). - TomTodoReference
-
A document or resource a todo points at (workspace schema
references): a workspace file, a URL, or a note — at least one of the three. - TomTodoRepeat
-
The day of a month a
monthlyoryearlyrule names — exactly one of: day (1–31; a month without that day takes its last), lastDay, the nth weekday (1–5, or -1 for the last), or the first / last working day (workingDay, Monday to Friday). - TomTodoScope
-
Where a todo applies (workspace schema
scope). - 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
- 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
- ConsoleColor
- ControlCharacter
- Non-printable characters that can be entered from the keyboard.
- DiagnosticSeverity
- Diagnostic severity
- DocumentFolder
- Type of document folder.
- EffortLevel
-
Reasoning-effort level. Mirrors
EffortLevel. - FontStyle
- 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.
- TodoLevel
-
Where a todo lives, as
todo.listAllVcetags it (_scope). - TomTodoPriority
- Todo priority, ordered low → critical.
- TomTodoRepeatRule
- The kinds of rule.
- TomTodoStatus
-
An item's status. Wire names match the workspace
todo.schema.jsonenum exactly, in both directions: the nine values here are the nine the schema lists, which_bin/check_todo_model.pyin the workspace holds.
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. -
findBridgePortsForWorkspace(
String name, {String host = '127.0.0.1', int minPort = defaultVSCodeBridgePort, int maxPort = maxVSCodeBridgePort, BridgePortProbe probe = _defaultProbe, BridgeIdentityFetcher fetchIdentity = fetchBridgeWorkspaceName}) → Future< List< int> > -
Scans the CLI bridge port range and returns every port whose window
has the workspace
nameopen, ascending; empty when none does. -
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.
-
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.
-
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.
-
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
-
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
- LanguageModelCallException
-
A language-model call whose script failed in the window (the bridge
answered
{success: false, error}): a missing model, a refused consent, a network error inside VS Code.