anomalyco / anomalyco/opencode
refactor(simulation): canonicalize the Drive wire protocol
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Problem
packages/drive/src/simulation/protocol.ts duplicates the simulation wire contract in packages/simulation/src/protocol/index.ts. Server and TUI consume @opencode-ai/simulation, while Drive currently maintains a copied public schema.
The copies have already drifted, including dynamic-tool progress shape and invocation context naming (callID versus canonical id). Keeping both makes protocol changes a manual synchronization task and can cause Drive decoding failures.
Direction
Move the Core-independent simulation contract to a canonical Protocol/Schema-owned module that Server, TUI, Simulation, and Drive can all consume without violating runtime dependency direction. Keep Drive-specific transport/controller behavior in Drive.
Acceptance
- One authoritative simulation wire schema.
- Drive no longer copies the protocol source.
- Existing Drive public protocol exports remain compatible or receive an explicit migration plan.
- Server/TUI/Drive protocol tests exercise the same schemas.
- Dynamic tool lifecycle fields and progress payloads are reconciled against actual V2 behavior.
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 packages/drive/src/simulation/protocol.ts with packages/simulation/src/protocol/index.ts, then trace how Server, TUI, Simulation, and Drive consume them. Reconcile the dynamic-tool lifecycle, progress payloads, and invocation context against V2 behavior. Done means one authoritative schema, compatible Drive exports or a migration plan, and protocol tests covering the shared schemas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100