Skip to main content

tom_vscode_scripting_api 5.0.0 copy "tom_vscode_scripting_api: ^5.0.0" to clipboard
tom_vscode_scripting_api: ^5.0.0 copied to clipboard

Dart abstractions for VS Code extension APIs, providing a bridge-agnostic interface for VS Code scripting.

5.0.0 #

  • Requires tom_todo_model ^3.0.0: todo groups. A todo with the group status and a comprised_of member list is read into the model (a 2.x model refused it, with the rest of its file readable); TomTodo.isGroup and TomTodo.comprisedOf come with it. A session todo has no groups: a group is written as pending.
  • Breaking: the exported model types are tom_todo_model 3.x's (an exhaustive switch over TomTodoStatus needs a case for group).

4.0.0 #

  • Requires tom_todo_model ^2.0.0: repeated todos. A todo with the waiting-for-repeat status, a repeat rule, next_repeat and repeat_count is read into the model (a 1.x model refused it); the API exports TomTodoRepeat and TomTodoRepeatRule beside the other model types. A session todo has no repeat: waiting-for-repeat is written as pending.
  • Breaking: the exported model types are tom_todo_model 2.x's (an exhaustive switch over TomTodoStatus needs a case for waitingForRepeat).

3.0.0 #

The Local LLM and AI Conversation APIs are removed: the panels they drove are gone from the extension, which answered every call with an error.

  • Breaking: AiPromptApi (localLlm.*Vce) and AiConversationApi (botConversation.*Vce) are removed, with their models — AiPromptResult, AiTokenStats, AiPromptProfile, AiModelConfig, AiModelsResult, ConversationResult, ConversationStatus, ConversationProfile, ConversationConfig, ConversationExchange, ConversationLog, ConversationActionResult, SingleTurnResult, CopilotResponse — and the enums ConversationMode and HistoryMode. A local model is reached through an Anthropic profile on a Local LLM configuration in the extension.

2.0.3 #

  • Requires tom_todo_model ^1.2.0. Todo files now carry blocking (1.2.0) and user_action (1.1.0); an older model resolved alongside this package read them as unknown keys.

2.0.2 #

The language-model calls return what the model answered.

  • LanguageModelChat.sendRequest, LanguageModelChat.countTokens and VSCodeLanguageModel.invokeTool read the script's value from the bridge's answer, {success, result}. They read their fields from that outer answer, so a reply the window had received came back empty (sendRequest), countTokens failed with a type error, and invokeTool returned no content.
  • A failed script ({success: false, error}, e.g. no such model) now throws LanguageModelCallException, naming the call and the window's error, instead of an empty result.

2.0.1 #

The language-model calls work through a bridge adapter.

  • VSCodeBridgeAdapter and LazyVSCodeBridgeAdapter pass the call's timeout on. They dropped it, so every call waited the client's requestTimeout (30 s by default) whatever it asked for: LanguageModelChat.sendRequest asks for 300 s and was cut at 30 s, before a model reply or VS Code's first-use consent prompt could arrive. VSCodeBridgeClient.sendRequest takes an optional timeout for this; a subclass overriding it adds the parameter.
  • LanguageModelChat.sendRequest hands VS Code LanguageModelChatMessage instances (it sent plain {role, content} objects) and reads the reply from response.text. It read a text field off the stream's parts, which a LanguageModelTextPart does not have, so an answered request came back empty.

2.0.0 #

Breaking. The todo API speaks the workspace's shared todo model.

  • TomTodoApi reads and writes TomTodo from tom_todo_model — the model Worktracker and Webwork use for every *.todo.yaml — instead of its own TodoItem. The package re-exports TomTodo, TomTodoStatus, TomTodoPriority, TomTodoScope, TomTodoReference and TomTodoDecision. TodoItem, TodoStatus, TodoPriority, TodoScope and TodoReference are gone. A todo now carries every field of the workspace schema (due, estimate, decisions, blocked_until, author, archived, deleted, the six orchestration fields) and the decision-needed status; TodoItem had dropped them, and an unknown status had silently become not-started.
  • Reads answer TodoEntry: the TomTodo with its sourceFile, its level (quest / workspace / session) and the unknownFields the model has no field for. getQuestTodo, getWorkspaceTodo and getSessionTodo answer null for a todo that does not exist (they used to fail on the null).
  • TodoListResult has entries, todos and invalid: a todo the model cannot read (an unknown status, say) is reported with the reason instead of failing the whole list.
  • TodoWire maps the extension's answers onto the model: fields the extension's reader keeps under _extra join the todo, a timestamp in a date field gives its date, a todo without a title takes its id, and a session todo's details, pending / done and createdAt / updatedAt become description, not-started / completed and created / updated. Writing a session todo sends details and pending / done.
  • First runtime dependency: tom_todo_model ^1.0.1.

1.3.0 #

  • findBridgePortsForWorkspace (plural) returns every bridge port whose window has the named workspace open, ascending, and an empty list when none does. findBridgePortForWorkspace stops at the first match, so a second VS Code window on the same workspace was invisible to every consumer that pinned a workspace by name; it keeps that behaviour — deliberately, a helper that refused on a benign ambiguity would break the single-window case — and its documentation now says so and points at the plural. One scanBridgePorts pass, matched with normalizeWorkspaceName exactly as the singular matches.

1.2.2 #

Documentation and samples only; no code change.

  • The Agent SDK guide (doc/vscode_api_anthropic_agent_sdk_guide.md) documents streaming input (streamQuery, SdkUserInput, AgentSdkInputTransport), and its env row is corrected: env replaces the agent's environment, and envOverlay adds to it.
  • example/vscode_agent_sdk_sample gains a sixth concept, streaming_input (a two-message conversation over streamQuery). Its live concepts are fixed: streaming_query names a small model and gives the agent no tools, so it completes in its one turn, and the out-of-date "chunk relay is incomplete" notes are gone.

1.2.1 #

  • VSCodeBridgeAgentSdkTransport now fails when the extension refuses a request. VSCodeBridgeClient.sendRequest returns {success: false, error} rather than throwing, and the transport ignored that. A refused sendInput was dropped silently, and a refused start left the query waiting for chunks that never came. startQuery, sendInput and endInput now throw an AgentSdkQueryException carrying the extension's message, so the query's stream fails with it; for example, against an extension that predates streaming input: Unknown method: agentSdk.inputVce.

1.2.0 #

  • AgentSdkClient.streamQuery mirrors the SDK's streaming-input mode, query({prompt: AsyncIterable<SDKUserMessage>}). The caller owns the input: each SdkUserInput (.text or .blocks, with an optional uuid) on the prompt stream is sent to the running query, and closing the stream ends the input. It needs a transport that implements the new, opt-in AgentSdkInputTransport (sendInput, endInput). VSCodeBridgeAgentSdkTransport does, over the new agentSdk.inputVce and agentSdk.endInputVce bridge methods; any other transport fails the query with an UnsupportedError. AgentSdkTransport is unchanged, so existing implementers need no change.
  • query with Dart tools or canUseTool now keeps working after the first result. The extension (a Tom extension build that has it) keeps the Claude Code process's input open until it is idle after answering the prompt. Before, a tool call or approval request made after the first result, for example in a background task's follow-up turn, failed at once with "interrupted before a result was received". No API change.

1.1.4 #

  • Options.envOverlay adds variables to the Claude Code subprocess's environment while keeping everything it would otherwise inherit. env replaces that environment, as it does in the SDK, and a Dart caller cannot read the extension host's environment to spread it the way a TypeScript caller writes env: {...process.env, FOO: 'x'}. The extension's bridge lays envOverlay over env when env is set, otherwise over the extension host's own environment, and passes the result as env. Dart-only, not an SDK option; it needs a Tom extension build that resolves it (with an older one it has no effect). Unset, the wire is unchanged.

1.1.3 #

  • McpSdkServerConfig gains alwaysLoad. Since Agent SDK 0.3.142, MCP servers connect in the background and their tools are deferred behind tool search, so a Dart-defined in-process server's tools could be missing on the first turn with no way to ask otherwise. Set alwaysLoad: true and the extension passes it to createSdkMcpServer when it rebuilds the server (requires a Tom extension build that forwards it). Unset, the wire is unchanged.
  • The Agent SDK mirror is audited against SDK 0.3.282, the version the extension resolves: every key Options.toJson writes exists there, and the message model already represents every 0.3.282 message type. File headers and docs now say so instead of naming ^0.2.110.
  • Options.env documents what it does: it REPLACES the Claude Code subprocess's environment rather than adding to it, and the extension host's environment cannot be read from Dart — so leave it null unless you supply the whole environment.

1.1.2 #

  • Fixed an uncaught SocketException from bridge discovery. A port that accepts a connection and then resets it — a busy service, or anything that is not a VS Code bridge — made scanBridgePorts / fetchBridgeWorkspaceName (and any VSCodeBridgeClient whose peer went away) raise an error nobody could catch: the reset ran the read side's onDone, which dropped the socket reference, so disconnect() never closed it and the socket's done future failed unobserved. The client now observes done from the moment it connects, disconnect() tolerates a peer that already went, and isAvailable destroys its probe socket the same way. Such a port now reads as "no bridge here". Regression tests in test/bridge_reset_peer_test.dart.
  • Removed the unused version stamp from lib/.

1.1.1 #

  • Fixed TextEditor.fromJson crashing (RangeError) on an empty visibleRanges array. It previously indexed visibleRanges[0] whenever the field was non-null, but the bridge reports visibleRanges: [] for a freshly revealed editor (e.g. the showTextDocument path), so the whole editor snapshot failed to parse. An empty, absent, or non-list visibleRanges now deserializes to null. Added a regression test suite (test/vscode_types_test.dart).

1.1.0 #

  • Added an Agent SDK type surface mirroring @anthropic-ai/claude-agent-sdk: raw-preserving messages/blocks (agent_sdk_messages.dart), the Options object with sealed config types, and permission/MCP value types (agent_sdk_permissions.dart, agent_sdk_mcp.dart, agent_sdk_options.dart).
  • Added the streaming query() core (agent_sdk_query.dart): a typed message stream with a pluggable transport seam and a bridge-backed transport.
  • Added a bidirectional RPC primitive (bridge_request_dispatcher.dart) that routes incoming server→client requests to registered handlers and replies over the socket.
  • Added Dart-defined tools (agent_sdk_tool_registry.dart): dispatch incoming agentSdk.toolCall requests to a query's in-process tool() handlers.
  • Added the canUseTool permission callback dispatch (agent_sdk_permission_dispatch.dart), turning an incoming agentSdk.canUseTool request into a CanUseTool invocation.
  • Added bridge/workspace discovery (bridge_discovery.dart): scanBridgePorts builds a port→workspace table across the CLI bridge port range, findBridgePortForWorkspace resolves a window by workspace name, and connectToWorkspace targets a specific window by name.
  • Added listAllowedToolNames() pre-validation helper and exposed the LLM tool registry through the scripting API.
  • Added AI APIs for local LLM prompt processing and bot conversation (ai_prompt_api.dart, ai_conversation_api.dart).
  • Added Tom workflow APIs: todos, queue, timed requests, documents, workspace, tools, and chat (tom_todo_api.dart, tom_queue_api.dart, tom_timed_api.dart, tom_document_api.dart, tom_workspace_api.dart, tom_tools_api.dart, tom_chat_api.dart).
  • Updated repository/homepage metadata to the tom_vscode group repo.

1.0.1 #

  • Changed license from MIT to BSD-3-Clause.

1.0.0 #

  • Initial public release.
  • Bridge-agnostic Dart abstractions for the VS Code extension API.
  • Core API namespaces: VSCodeWindow, VSCodeWorkspace, VSCodeCommands, VSCodeExtensions.
  • Language model API (VSCodeLanguageModel) for accessing models like GitHub Copilot.
  • Chat participant API (VSCodeChat) for building chat extensions.
  • Socket-based bridge client (VSCodeBridgeClient) with JSON-RPC 2.0 communication.
  • Convenience script globals (vscode, window, workspace, commands, extensions, lm, chat).
  • Helper utilities (VsCodeHelper) for common VS Code scripting tasks.
0
likes
160
points
1.45k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart abstractions for VS Code extension APIs, providing a bridge-agnostic interface for VS Code scripting.

Homepage
Repository (GitHub)
View/report issues

Topics

#vscode #scripting #dart #ide

License

BSD-3-Clause (license)

Dependencies

tom_todo_model

More

Packages that depend on tom_vscode_scripting_api