Skip to content

fix(drive): support current OpenCode V2 - #48

Merged
kitlangton merged 3 commits into
anomalyco:mainfrom
kitlangton:update-opencode-drive
Jul 30, 2026
Merged

fix(drive): support current OpenCode V2#48
kitlangton merged 3 commits into
anomalyco:mainfrom
kitlangton:update-opencode-drive

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Restore Drive compatibility with current OpenCode V2 checkouts and make standalone automation scripts use the exact Drive toolchain that launched them. This supersedes #47 with the complete V2 launch and packaged-script solution.

Before / After

Before: current V2 development checkouts still depended on Drive's removed preload/integration bridge and legacy provider shape. Scripted services reused incompatible command forms and could collide on the default service port. Standalone scripts also relied on temporary package installs or links beside the script, which could load a second Effect installation and fail from packed or global Drive layouts.

After: Drive uses OpenCode V2's native simulation frontend/backend and current provider configuration. Detached, scripted-service, and scripted-TUI commands are derived separately, and each launched service receives a free port. User scripts and local helpers are compiled into Drive-owned artifacts while opencode-drive and effect resolve from the launching installation, so check, run, and start --script work without modifying the source directory or invoking a package manager.

How

  • src/instance/dev.ts and src/instance/runtime.ts use V2's source entrypoint, Solid preload, standalone capability, native simulation environment, and launch-local service ports.
  • src/instance/default-config.jsonc uses the current simulated provider shape.
  • src/script/tooling.ts owns type checking and script-only Bun compilation from an artifact-local toolchain root.
  • src/cli/run.ts executes fully provided Effect programs in an isolated child process; src/cli/start.ts uses the same prepared script module.
  • src/index.ts exports Drive's Effect module so generated scripts can use one dependency graph.
  • Obsolete Drive-owned V2 integration/preload code and tests are removed.

Scope

  • OpenCode's headless Kitty keyboard propagation is handled separately in fix(simulation): mirror kitty keyboard protocol opencode#39741.
  • This does not bundle Drive itself or install dependencies per invocation.
  • Existing visible, detached, restart, recording, and interruption lifecycles remain unchanged outside the V2 command split.

Testing

  • bun run check
  • bun run test (204 Effect/Vitest tests, 57 CLI integration tests, 28 catalog tests)
  • bun run --cwd packages/drive release:validate
  • Packed tarball installed with Bun's isolated linker in a clean consumer
  • Packed check and run verified with a local helper and no source-adjacent node_modules
  • Globally installed packed Drive completed a current-V2 scripted run against OpenCode 188c642d8c7b4dae1570e03459bdce5ecf1224df

Flow

sequenceDiagram
    participant Script as User script
    participant Drive as Drive CLI
    participant Toolchain as Drive toolchain root
    participant Host as Isolated Bun host
    participant OpenCode as OpenCode V2

    Drive->>Toolchain: link exact Drive, Effect, and type toolchain
    Drive->>Script: type-check public contract
    Drive->>Toolchain: bundle script and local helpers only
    alt opencode-drive run
        Drive->>Host: execute prepared Effect program
    else start --script
        Drive->>OpenCode: launch private service and TUI commands
        Drive->>Host: load prepared script lifecycle
    end
Loading

@kitlangton
kitlangton merged commit d71356f into anomalyco:main Jul 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant