Skip to content

Commit 16568d9

Browse files
feat(opencode): migrate provider to native v2
1 parent 5a61f50 commit 16568d9

18 files changed

Lines changed: 4080 additions & 7874 deletions

‎apps/server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@effect/platform-node": "catalog:",
2828
"@effect/platform-node-shared": "catalog:",
2929
"@ff-labs/fff-node": "0.9.4",
30-
"@opencode-ai/sdk": "^1.3.15",
30+
"@opencode/client": "2.0.12",
3131
"diff": "8.0.3",
3232
"effect": "catalog:",
3333
"node-pty": "^1.1.0",

‎apps/server/src/provider/Drivers/OpenCodeDriver.ts‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,19 +168,14 @@ export const OpenCodeDriver: ProviderDriver<OpenCodeSettings, OpenCodeDriverEnv>
168168
Effect.provideService(OpenCodeServerOwner.OpenCodeServerOwner, serverOwner),
169169
Effect.provideService(OpenCodeRuntime, openCodeRuntime),
170170
);
171-
// NOTE: the local branch intentionally uses the shared SDK server
172-
// instead of `opencode debug skill` (loadSkillsFromCli). The CLI writes
173-
// its full JSON inventory to stdout, but the Bun-compiled binary does
174-
// not flush more than one 64KB pipe buffer to a non-TTY stdout, so the
175-
// piped output arrives truncated and unparseable — which degrades to an
176-
// empty skill list and poisons the workspace snapshot the `$` picker
177-
// reads. The SDK `app.skills` endpoint honors the per-request directory
178-
// and returns complete results regardless of size.
179-
const loadWorkspaceInventory = (client: Parameters<typeof loadOpenCodeCommands>[0]) =>
171+
const loadWorkspaceInventory = (
172+
client: Parameters<typeof loadOpenCodeCommands>[0],
173+
directory: string,
174+
) =>
180175
Effect.all(
181176
{
182-
skills: openCodeRuntime.loadOpenCodeSkills(client),
183-
commands: loadOpenCodeCommands(client).pipe(
177+
skills: openCodeRuntime.loadOpenCodeSkills(client, directory),
178+
commands: loadOpenCodeCommands(client, directory).pipe(
184179
Effect.timeout("10 seconds"),
185180
Effect.orElseSucceed(() => []),
186181
),
@@ -202,23 +197,22 @@ export const OpenCodeDriver: ProviderDriver<OpenCodeSettings, OpenCodeDriverEnv>
202197
});
203198
const client = openCodeRuntime.createOpenCodeSdkClient({
204199
baseUrl: server.url,
205-
directory: cwd,
206200
...(effectiveConfig.serverPassword
207201
? { serverPassword: effectiveConfig.serverPassword }
208202
: {}),
209203
});
210-
return yield* loadWorkspaceInventory(client);
204+
return yield* loadWorkspaceInventory(client, cwd);
211205
}),
212206
)
213207
: serverOwner.withServer((server) =>
214208
loadWorkspaceInventory(
215209
openCodeRuntime.createOpenCodeSdkClient({
216210
baseUrl: server.url,
217-
directory: cwd,
218211
...(server.serverPassword !== undefined
219212
? { serverPassword: server.serverPassword }
220213
: {}),
221214
}),
215+
cwd,
222216
),
223217
);
224218

0 commit comments

Comments
 (0)