fix(drive): support current OpenCode V2 - #48
Merged
Conversation
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.
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-driveandeffectresolve from the launching installation, socheck,run, andstart --scriptwork without modifying the source directory or invoking a package manager.How
src/instance/dev.tsandsrc/instance/runtime.tsuse V2's source entrypoint, Solid preload, standalone capability, native simulation environment, and launch-local service ports.src/instance/default-config.jsoncuses the current simulated provider shape.src/script/tooling.tsowns type checking and script-only Bun compilation from an artifact-local toolchain root.src/cli/run.tsexecutes fully provided Effect programs in an isolated child process;src/cli/start.tsuses the same prepared script module.src/index.tsexports Drive's Effect module so generated scripts can use one dependency graph.Scope
Testing
bun run checkbun run test(204 Effect/Vitest tests, 57 CLI integration tests, 28 catalog tests)bun run --cwd packages/drive release:validatecheckandrunverified with a local helper and no source-adjacentnode_modules188c642d8c7b4dae1570e03459bdce5ecf1224dfFlow
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