tom_vscode_scripting_api 2.0.0
tom_vscode_scripting_api: ^2.0.0 copied to clipboard
Dart abstractions for VS Code extension APIs, providing a bridge-agnostic interface for VS Code scripting.
2.0.0 #
Breaking. The todo API speaks the workspace's shared todo model.
TomTodoApireads and writesTomTodofromtom_todo_model— the model Worktracker and Webwork use for every*.todo.yaml— instead of its ownTodoItem. The package re-exportsTomTodo,TomTodoStatus,TomTodoPriority,TomTodoScope,TomTodoReferenceandTomTodoDecision.TodoItem,TodoStatus,TodoPriority,TodoScopeandTodoReferenceare gone. A todo now carries every field of the workspace schema (due,estimate,decisions,blocked_until,author,archived,deleted, the six orchestration fields) and thedecision-neededstatus;TodoItemhad dropped them, and an unknown status had silently becomenot-started.- Reads answer
TodoEntry: theTomTodowith itssourceFile, itslevel(quest/workspace/session) and theunknownFieldsthe model has no field for.getQuestTodo,getWorkspaceTodoandgetSessionTodoanswernullfor a todo that does not exist (they used to fail on the null). TodoListResulthasentries,todosandinvalid: a todo the model cannot read (an unknown status, say) is reported with the reason instead of failing the whole list.TodoWiremaps the extension's answers onto the model: fields the extension's reader keeps under_extrajoin the todo, a timestamp in a date field gives its date, a todo without a title takes its id, and a session todo'sdetails,pending/doneandcreatedAt/updatedAtbecomedescription,not-started/completedandcreated/updated. Writing a session todo sendsdetailsandpending/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.findBridgePortForWorkspacestops 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. OnescanBridgePortspass, matched withnormalizeWorkspaceNameexactly 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 itsenvrow is corrected:envreplaces the agent's environment, andenvOverlayadds to it. example/vscode_agent_sdk_samplegains a sixth concept,streaming_input(a two-message conversation overstreamQuery). Its live concepts are fixed:streaming_querynames 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 #
VSCodeBridgeAgentSdkTransportnow fails when the extension refuses a request.VSCodeBridgeClient.sendRequestreturns{success: false, error}rather than throwing, and the transport ignored that. A refusedsendInputwas dropped silently, and a refused start left the query waiting for chunks that never came.startQuery,sendInputandendInputnow throw anAgentSdkQueryExceptioncarrying 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.streamQuerymirrors the SDK's streaming-input mode,query({prompt: AsyncIterable<SDKUserMessage>}). The caller owns the input: eachSdkUserInput(.textor.blocks, with an optionaluuid) on thepromptstream is sent to the running query, and closing the stream ends the input. It needs a transport that implements the new, opt-inAgentSdkInputTransport(sendInput,endInput).VSCodeBridgeAgentSdkTransportdoes, over the newagentSdk.inputVceandagentSdk.endInputVcebridge methods; any other transport fails the query with anUnsupportedError.AgentSdkTransportis unchanged, so existing implementers need no change.querywith Dart tools orcanUseToolnow 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.envOverlayadds variables to the Claude Code subprocess's environment while keeping everything it would otherwise inherit.envreplaces 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 writesenv: {...process.env, FOO: 'x'}. The extension's bridge laysenvOverlayoverenvwhenenvis set, otherwise over the extension host's own environment, and passes the result asenv. 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 #
McpSdkServerConfiggainsalwaysLoad. 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. SetalwaysLoad: trueand the extension passes it tocreateSdkMcpServerwhen 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.toJsonwrites 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.envdocuments 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
SocketExceptionfrom bridge discovery. A port that accepts a connection and then resets it — a busy service, or anything that is not a VS Code bridge — madescanBridgePorts/fetchBridgeWorkspaceName(and anyVSCodeBridgeClientwhose peer went away) raise an error nobody could catch: the reset ran the read side'sonDone, which dropped the socket reference, sodisconnect()never closed it and the socket'sdonefuture failed unobserved. The client now observesdonefrom the moment it connects,disconnect()tolerates a peer that already went, andisAvailabledestroys its probe socket the same way. Such a port now reads as "no bridge here". Regression tests intest/bridge_reset_peer_test.dart. - Removed the unused version stamp from
lib/.
1.1.1 #
- Fixed
TextEditor.fromJsoncrashing (RangeError) on an emptyvisibleRangesarray. It previously indexedvisibleRanges[0]whenever the field was non-null, but the bridge reportsvisibleRanges: []for a freshly revealed editor (e.g. theshowTextDocumentpath), so the whole editor snapshot failed to parse. An empty, absent, or non-listvisibleRangesnow deserializes tonull. 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), theOptionsobject 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 incomingagentSdk.toolCallrequests to a query's in-processtool()handlers. - Added the
canUseToolpermission callback dispatch (agent_sdk_permission_dispatch.dart), turning an incomingagentSdk.canUseToolrequest into aCanUseToolinvocation. - Added bridge/workspace discovery (
bridge_discovery.dart):scanBridgePortsbuilds a port→workspace table across the CLI bridge port range,findBridgePortForWorkspaceresolves a window by workspace name, andconnectToWorkspacetargets 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/homepagemetadata to thetom_vscodegroup 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.