companion: add --variant and repeatable --file flags (mirroring opencode run) - #10
Open
stevenpollack wants to merge 2 commits into
Open
companion: add --variant and repeatable --file flags (mirroring opencode run)#10stevenpollack wants to merge 2 commits into
stevenpollack wants to merge 2 commits into
Conversation
task, task-worker, review, and adversarial-review now accept
--variant <name> (provider-specific reasoning effort, e.g. high,
max, minimal) and pass it through to the OpenCode HTTP API's
prompt body. For background tasks it is recorded in job state,
logged on dispatch, and forwarded to the worker.
Also fix --model, which was parsed and recorded but never sent
with the prompt: buildPromptBody now converts a provider/model
string to the {providerID, modelID} object the API's ModelRef
schema requires, instead of sending a raw string that would be
rejected.
Update rescue command/agent/skill docs and README, and add unit
tests for buildPromptBody.
task and task-worker now accept --file <path> (repeatable) and attach each path to the OpenCode prompt as a file part. Mirroring the CLI's local-run behavior, parts carry a file:// URL with text/plain (or application/x-directory) mime, and the server inlines content via its Read tool -- no base64 encoding or size bloat. Paths resolve against the workspace root, are validated before a session is created or a worker is spawned, and are recorded in job state and the dispatch log. parseArgs grows an arrayOptions schema for repeatable value flags, and buildPromptBody places attachments before the text part to match the CLI's parts ordering. Docs and tests updated accordingly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The companion
task/task-worker/review/adversarial-reviewcommands now accept the same runtime-selection flags you'd pass toopencode run:--variant <name>(7ee4044) — provider-specific reasoning effort (e.g.high,max,minimal). Passed through to the HTTP API's prompt body, exactly whereopencode run --variantsends it. Recorded in job state, logged on dispatch, and forwarded to background workers.--file <path>(62d8a80) — repeatable file/directory attachments, likeopencode run -f. Each path becomes afile://file part withtext/plain(orapplication/x-directory) mime, mirroring the CLI's local-run behavior: the server inlines content via its Read tool, so there's no base64 encoding or size bloat. Paths resolve against the workspace root and are validated before a session is created or a worker is spawned.Also fixes
--model, which was previously parsed and recorded but never actually sent with the prompt — and would have been rejected as a raw string.buildPromptBodynow convertsprovider/modelinto the{providerID, modelID}object the API'sModelRefschema requires.Docs (
rescuecommand/agent/skill, README) and unit tests are updated. Dispatch docs instruct the subagent to pass these flags through only when the user explicitly supplies them.Testing
npm test: 55/55 pass (new suites forbuildFilePart, attachments ordering, repeatablearrayOptionsparsing,--variant/--modelbody handling)task --variant high→ server-returned message records"variant": "high"with reasoning tokens engagedtask --agent plan --variant high --file <canary>→ model returned the exact canary file content through the server's Read-tool pipeline