Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/opencode-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"typecheck": "tsc -p tsconfig.json"
},
"dependencies": {
"@opencode/client": "2.0.22"
"@opencode/client": "2.0.23"
},
"devDependencies": {
"@opencode2-mobile/test-fixtures": "workspace:*",
Expand Down
36 changes: 33 additions & 3 deletions packages/opencode-adapter/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1662,17 +1662,47 @@ it("classifies a malformed fake API event frame", async () => {
expect(classifyOpenCodeError(error)).toBe("MALFORMED_RESPONSE");
});

it("classifies a missing required V2 endpoint as incompatible", async () => {
it.each([404, 405])(
"classifies a missing required V2 endpoint HTTP %s as incompatible",
async (status) => {
// Project-list 404 is a declared API error in 2.0.23. Server info still
// treats missing routes as unexpected statuses, including its legacy fallback.
const api = createFakeOpenCodeApi({
failures: {
"/api/info": { body: {}, status },
"/api/status": { body: {}, status },
},
});
const client = createOpenCodeClient({
baseUrl: "https://fake.invalid",
fetch: api.fetch,
});

const error = await client.server.status().catch((caught: unknown) => caught);
expect(classifyOpenCodeError(error)).toBe("INCOMPATIBLE");
},
);

it("classifies a declared project-list 404 as not found", async () => {
const api = createFakeOpenCodeApi({
failures: { "/api/project": { body: {}, status: 404 } },
failures: {
"/api/project": {
body: {
_tag: "ProjectNotFoundError",
projectID: "missing-project",
message: "Project not found",
},
status: 404,
},
},
});
const client = createOpenCodeClient({
baseUrl: "https://fake.invalid",
fetch: api.fetch,
});

const error = await client.project.list().catch((caught: unknown) => caught);
expect(classifyOpenCodeError(error)).toBe("INCOMPATIBLE");
expect(classifyOpenCodeError(error)).toBe("NOT_FOUND");
});

it("receives events on runtimes without Promise.withResolvers", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode-adapter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {

import { ensurePromiseWithResolvers } from "./promise-with-resolvers";

export const openCodeClientContractVersion = "2.0.22";
export const openCodeClientContractVersion = "2.0.23";

export type OpenCodeClientOptions = {
authorization?: string;
Expand Down
28 changes: 14 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading