Skip to content

[perf] agent: expose structured project tools in OpenCode - #426

Draft
FayeSpica wants to merge 7 commits into
ThinkFlowLab:mainfrom
FayeSpica:feat/agent-image-intent
Draft

FayeSpica wants to merge 7 commits into
ThinkFlowLab:mainfrom
FayeSpica:feat/agent-image-intent

Conversation

@FayeSpica

@FayeSpica FayeSpica commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Give bundled OpenCode turn-scoped structured access to the existing project tool gateway. The model can load the project, model choices, and several complete command contracts in one call, with model-specific options when requested. The CLI keeps its existing help.
  • Compose shared generation and canvas operations for text, image, video, and audio. Validate model parameters and references before publishing a node intended for immediate generation. Submission performs its own checks and retains the original node receipt on later failure.
  • Derive top-level generation settings from the four shared media contracts. Keep bundled dependencies out of the media worktree and exclude host Claude prompt files from model requests.
  • Keep the shared startup, model connection reuse, and CLI help improvements. Images are the live browser acceptance workload for the common Agent path.

Linked issue

  • No linked GitHub issue

Labels

  • type:feat, area:agent, area:performance

Test plan

  • Local: 189 focused Python tests passed for the shared changes. On the final head, the 15 readiness checks and four actual bundled OpenCode cases with a model double passed. Contract generation, whole-PR pre-commit, browser manifest and locale checks, and i18n passed.
  • Live: five fixed 2048×2048 PNG requests, plus one ordinary request in each English and Chinese canvas scenario. All used the existing browser benchmark.
  • Left to CI: the full Release checks matrix.

Evidence that it works

Both durations start at Send. A valid result requires one real node, one job from the same turn and node, and matching stored and rendered preview bytes. The fixed case keeps its exact prompt and output settings. Ordinary requests without dimensions validate the decoded, saved, and technical-check dimensions against each other.

Fixed request on a fresh canvas Valid samples Send → node, median (range) Send → decoded image, median (range) Model requests before node Within 8 s Within 3 s
Previous CLI path, one observation 1/1 39.35 s 54.89 s 11 0/1 0/1
Current draft 5/5 5.95 s (5.05 s–7.55 s) 14.44 s (14.13 s–15.44 s) 2 5/5 0/5

The CLI trace spent rounds 1–3 reading the project, models, and commands, rounds 4–9 expanding arguments, and round 10 preparing IDs. Round 11 did the first business write. The first ten model responses took 17.94 s in total. The CLI measurement was a single earlier observation, collected separately from the current runs. On the current head, Send to the first model request took 2.22–2.73 s in the fixed case. All nine first model requests omitted host Claude prompt files. The four ordinary cases preserved both prior canvas content and the identity of the new node through job completion.

The 3-second interaction budget remains the product requirement. The 8-second threshold is the current iteration checkpoint.

Ordinary request, one run per case Send → node Send → decoded image Acceptance and model requests before node
English, empty canvas 4.18 s 11.41 s Passed · 1
English, populated canvas 5.75 s 13.56 s Passed · 1
Chinese, empty canvas 6.41 s 16.57 s Passed · 2
Chinese, populated canvas 4.51 s 12.82 s Passed · 1
  • Browser recording pending in this draft.

Fallback and rollback

OpenCode retains the CLI if the per-turn MCP listener cannot bind. Inspect the original node and job receipt after a partial submission before retrying. Keep the draft while the interaction budget or same-node lineage fails. Revert the structured path if it regresses native startup, turn completion, or job lineage. The CLI uses the same project commands and storage format.

Provider verification

  • Live runs used MiniMax-M3.1-Flash and MiniMax-H3-Image-Highspeed on macOS arm64 Chrome. Text job, video setup, and audio parameter checks used local fixtures. Live latency for other media, Windows, and large or panned canvases remains unmeasured.

Bilingual UI

  • Runtime and benchmark guidance is documented in both languages.

Signed-off-by: Weiming Liao <liaowm5@gmail.com>
@FayeSpica FayeSpica added type:feat New capability or behaviour area:agent Agent runtime, assistant chat and tools area:performance Performance and responsiveness / 性能与响应速度 labels Nov 21, 2026
Signed-off-by: Weiming Liao <liaowm5@gmail.com>
@FayeSpica FayeSpica changed the title [perf] agent: route ordinary single-image requests faster [perf] agent: reduce shared startup and tool overhead Nov 21, 2026
Signed-off-by: Weiming Liao <liaowm5@gmail.com>
@FayeSpica FayeSpica changed the title [perf] agent: reduce shared startup and tool overhead [perf] agent: expose structured project tools in OpenCode Nov 21, 2026
Signed-off-by: Weiming Liao <liaowm5@gmail.com>
Signed-off-by: Weiming Liao <liaowm5@gmail.com>
…acts

Signed-off-by: Weiming Liao <liaowm5@gmail.com>
Signed-off-by: Weiming Liao <liaowm5@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent runtime, assistant chat and tools area:performance Performance and responsiveness / 性能与响应速度 type:feat New capability or behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants