anomalyco / anomalyco/opencode

refactor(simulation): canonicalize the Drive wire protocol

Open
#42,136 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.