anomalyco / anomalyco/opencode
[FEATURE]: V2 session.command invocation identity and result correlation
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Please expose a stable invocation identity and result correlation for V2 session.command, or document an existing supported way to obtain them.
While adding V2 support to an MCP bridge, I found that @opencode/client@2.0.6 accepts sessionID, name, text, attachments and delivery, but no caller-assigned ID. Its result is void; the HTTP endpoint returns 204. The current V2 branch still has this contract:
This makes it difficult for an external client to associate a command with inputs it admits and their eventual output/error. For example, if a command enqueues a prompt while another client submits work to the same session, selecting the latest message or waiting for session inactivity cannot reliably identify the command's result. A lost HTTP response also leaves the caller without an invocation handle to inspect.
The desired contract would provide:
- A caller-assigned invocation ID, or another recoverable identity.
- A receipt linking the invocation to any admitted input IDs, plus documented status/log correlation.
- Explicit semantics for callback completion versus completion of admitted agent work, including commands that admit no input.
session.prompt already accepts an ID and returns an inbox receipt. An equivalent correlation path for commands would let bridges observe results without guessing or replaying uncertain mutations.
This is a contract inspection and integration requirement, not a claim that command execution itself is broken or that a live concurrency race was reproduced. Related: the completed implementation in #34429 / #34849; this request concerns its externally observable invocation/result identity.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the V2 client types in packages/client/src/effect/api/api.ts with the HTTP endpoint in packages/protocol/src/groups/session.ts, then review how session.prompt provides an ID and inbox receipt. Define and document a recoverable command invocation identity, admitted-input receipt, status/log correlation, and callback-versus-agent-work completion semantics, including commands with no admitted input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100