feat(opencode): add optional runtime overlay#3761
feat(opencode): add optional runtime overlay#3761Danigm-dev wants to merge 32 commits intosimstudioai:stagingfrom
Conversation
PR SummaryMedium Risk Overview Introduces new authenticated API routes for listing OpenCode repositories/providers/models/agents (session or internal auth + workspace access checks) plus internal tool endpoints for prompting and retrieving thread messages, with session reuse/retry logic backed by stored workspace memory. Provides OpenCode runtime deployment overlays ( Written by Cursor Bugbot for commit 13f4b56. This will update automatically on new commits. Configure here. |
|
@Danigm-dev is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
...Id]/components/panel/components/editor/components/sub-block/components/dropdown/dropdown.tsx
Outdated
Show resolved
Hide resolved
Greptile SummaryThis PR introduces an optional OpenCode workflow block and its supporting runtime (API routes, service layer, Docker Compose overlays, and a container image) without touching the default Sim deployment path. The feature is correctly gated behind Key findings from the review:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as OpenCode Block (UI)
participant API as /api/opencode/* (Next.js)
participant Svc as lib/opencode/service
participant OC as OpenCode Server
participant DB as Sim DB (memory table)
UI->>API: GET /api/opencode/repos?workspaceId=…
API->>Svc: listOpenCodeRepositories()
Svc->>OC: client.project.list()
OC-->>Svc: Project[]
Svc-->>API: OpenCodeRepositoryOption[]
API-->>UI: { data: [...] }
UI->>API: GET /api/opencode/providers?workspaceId=…&repository=…
API->>Svc: listOpenCodeProviders(repository)
Svc->>OC: client.config.providers({ directory })
OC-->>Svc: Provider[]
Svc-->>API: OpenCodeProviderOption[]
API-->>UI: { data: [...] }
Note over UI,DB: Workflow execution (tool call)
UI->>API: POST /api/tools/opencode/prompt
API->>Svc: resolveOpenCodeRepositoryOption(repo)
API->>DB: getStoredOpenCodeSession(wsId, memKey)
DB-->>API: null (no stored session)
API->>OC: createOpenCodeSession(repo, title)
OC-->>API: { id: sessionId }
API->>OC: promptOpenCodeSession(…)
OC-->>API: { content, threadId, cost }
API->>DB: storeOpenCodeSession(wsId, memKey, session)
API-->>UI: { success: true, output: { content, threadId, cost } }
|
...Id]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx
Outdated
Show resolved
Hide resolved
|
Addressed the actionable Greptile findings in the latest branch state.
Validation run after these changes:
Latest fix commit: |
...Id]/components/panel/components/editor/components/sub-block/components/dropdown/dropdown.tsx
Outdated
Show resolved
Hide resolved
...Id]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx
Outdated
Show resolved
Hide resolved
...Id]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx
Outdated
Show resolved
Hide resolved
...Id]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx
Outdated
Show resolved
Hide resolved
...Id]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx
Outdated
Show resolved
Hide resolved
...Id]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx
Show resolved
Hide resolved
...Id]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx
Show resolved
Hide resolved
...Id]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx
Show resolved
Hide resolved
...Id]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Summary
Adds OpenCode as an optional Sim capability without changing the default Sim deployment path or base UX.
This PR introduces:
OPENCODE_REPOSITORY_ROOTcontract so Sim can also target compatible external OpenCode deploymentsThe default Sim experience remains unchanged:
docker-compose.local.ymlis unchangeddocker-compose.prod.ymlis unchangedNEXT_PUBLIC_OPENCODE_ENABLED=trueType of Change
Testing
timeout 90s bunx vitest run blocks/blocks.test.tsfromapps/simbunx vitest run lib/opencode/service.test.ts app/api/opencode/repos/route.test.ts app/api/tools/opencode/prompt/route.test.tsfromapps/simdocker compose -f docker-compose.local.yml -f docker-compose.opencode.local.yml configenv OPENCODE_SERVER_PASSWORD=change-me docker compose -f docker-compose.prod.yml -f docker-compose.opencode.yml configReviewer focus:
OPENCODE_REPOSITORY_ROOThandling for external deploymentsChecklist
Screenshots/Videos
Not included. The OpenCode block is hidden by default and only appears when
NEXT_PUBLIC_OPENCODE_ENABLED=true. Manual validation covered both states and a successful prompt execution flow.