OpenCode 2 Code Mode: when will AFT tools be available (plugin sets codemode: false)?
Question
Will the OpenCode 2 plugin make AFT tools available in OpenCode 2 Code Mode, and when? If yes, what does a Code Mode call do when the permission decision is ask?
Current behaviour
Our test used an OpenCode 2 session with aft-opencode 0.62.0. In that session, the Code Mode execute runtime has no AFT tools. search() in the Code Mode catalog finds no AFT entry, for example read, grep, aft_outline, aft_search or shell. A call to tools.read(...) gives the error "Unknown tool". Thus Code Mode programs can use only MCP and host tools. They cannot read, search or change code through AFT.
The cause is in the plugin. Each V2 tool sets codemode: false, and the type makes this value necessary:
packages/opencode-plugin/src/tools/definitions/v2.ts:94(options: … & { codemode: false })packages/opencode-plugin/src/tools/definitions/v2.ts:383(codemode: falseon all V2 tools)
This option came in cefd1336c ("register V2 tool surface directly"). It is in v0.62.0 and in current main (6e9eeaa7a).
Engine work on main
main has engine work for Code Mode callers. This work is not in a release at this time:
- #758 resolves Code Mode head routes in the run checkout.
- #814 adds a different access class for Code Mode callers.
1308a4372negotiates the Code Mode reply format from the run.
The engine applies the head agent's policy to a Code Mode call. Grants stay on the parent identity (crates/aft/src/subc/access_grants.rs:35-42). At this time, no path sends an ask question to a person. The engine refuses the call with permission_ask_unavailable (crates/aft/src/access_policy.rs:174-182, crates/aft/src/subc/access_grants.rs:296-300).
Questions
- After the engine work is in a release, will the plugin remove
codemode: falsefor some V2 tools or for all V2 tools? If for some, which tools? Examples are the read-only toolsread,grep,glob,aft_outline,aft_zoomandaft_search. - Does
codemode: falsestay until the path foraskquestions is available? If yes, can the plugin first make available the read-only tools that do not useask? - When a Code Mode call gets the decision
ask, ispermission_ask_unavailablethe last behaviour? Or will a subsequent change send the question to the head agent's user? - Is there a release target or an issue that monitors this work?
Duplicate check
I searched issues and pull requests for "code mode", "codemode", "codemode plugin" and "Code Mode tools". No issue or pull request is about the plugin side.
Fixed in v0.65.0, released today: AFT's seven read-only tools now also work inside OpenCode 2's Code Mode as tools.aft.code.*, with the same permissions as the direct tools. Thanks for the report. If you still see it after updating, reply here and we'll reopen.