Skip to content

fix: restore controlled tools on v2 - #53

Merged
kitlangton merged 1 commit into
mainfrom
control-write
Aug 9, 2026
Merged

fix: restore controlled tools on v2#53
kitlangton merged 1 commit into
mainfrom
control-write

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Restore controlled tools when Drive runs against the current OpenCode V2 plugin API, and add typed control for write calls.

Before / After

Before: Drive's injected plugin used the old three-argument tools.add API and context.callID. Current V2 rejected the registration with tool.name undefined, so controlled tools never loaded. Scripts also could not declare write as a typed controlled tool.

After: The plugin registers complete V2 tool definitions, reads context.id, and returns canonical tool results. Scripts can declare tools: ["write"], claim the typed call, and settle it with an output string.

How

  • Update the injected plugin adapter to the current V2 tool definition and result shapes.
  • Add WriteInput, WriteResult, handler, and runtime-control types.
  • Add write registration and controlled-call routing to the tool controller.
  • Update plugin adapter tests and cover typed write routing.
  • Add a patch changeset for opencode-drive.

Scope

This does not update the pinned generated OpenCode client or alter arbitrary provider-backed dynamic tool control.

Testing

  • bun run check in packages/drive
  • bun run test:effect in packages/drive (205 passed)

@kitlangton
kitlangton merged commit 99561ad into main Aug 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant