From 2cb697b72050c1f7a9661be59c2d610e6ae81d89 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" Date: Tue, 12 May 2026 21:24:39 +0000 Subject: [PATCH] chore: generate --- packages/opencode/src/plugin/digitalocean.ts | 8 +++++-- .../test/provider/digitalocean.test.ts | 20 ++++-------------- packages/opencode/test/tool/registry.test.ts | 21 ++++++++----------- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/packages/opencode/src/plugin/digitalocean.ts b/packages/opencode/src/plugin/digitalocean.ts index 31656656f1..fa4adf6331 100644 --- a/packages/opencode/src/plugin/digitalocean.ts +++ b/packages/opencode/src/plugin/digitalocean.ts @@ -246,7 +246,9 @@ async function createModelAccessKey(bearer: string): Promise { return data.api_key_info } -async function listRouters(bearer: string): Promise<{ ok: true; routers: RouterEntry[] } | { ok: false; status: number }> { +async function listRouters( + bearer: string, +): Promise<{ ok: true; routers: RouterEntry[] } | { ok: false; status: number }> { const res = await fetch(`${DO_API_BASE}/v2/gen-ai/models/routers`, { headers: { Authorization: `Bearer ${bearer}`, @@ -293,7 +295,9 @@ function parseRoutersJSON(raw: string | undefined): RouterEntry[] { try { const parsed = JSON.parse(raw) if (!Array.isArray(parsed)) return [] - return parsed.flatMap((r) => (r && typeof r.name === "string" ? [{ name: r.name, uuid: r.uuid, description: r.description }] : [])) + return parsed.flatMap((r) => + r && typeof r.name === "string" ? [{ name: r.name, uuid: r.uuid, description: r.description }] : [], + ) } catch { return [] } diff --git a/packages/opencode/test/provider/digitalocean.test.ts b/packages/opencode/test/provider/digitalocean.test.ts index 6515ea9701..6fc49a6eff 100644 --- a/packages/opencode/test/provider/digitalocean.test.ts +++ b/packages/opencode/test/provider/digitalocean.test.ts @@ -43,10 +43,7 @@ function injectAuth(metadata: Record | undefined) { test("digitalocean provider autoloads from DIGITALOCEAN_ACCESS_TOKEN", async () => { await using tmp = await tmpdir({ init: async (dir) => { - await Bun.write( - path.join(dir, "opencode.json"), - JSON.stringify({ $schema: "https://opencode.ai/config.json" }), - ) + await Bun.write(path.join(dir, "opencode.json"), JSON.stringify({ $schema: "https://opencode.ai/config.json" })) }, }) await WithInstance.provide({ @@ -68,10 +65,7 @@ test("digitalocean provider autoloads from DIGITALOCEAN_ACCESS_TOKEN", async () test("digitalocean provider.models surfaces cached routers from auth metadata", async () => { await using tmp = await tmpdir({ init: async (dir) => { - await Bun.write( - path.join(dir, "opencode.json"), - JSON.stringify({ $schema: "https://opencode.ai/config.json" }), - ) + await Bun.write(path.join(dir, "opencode.json"), JSON.stringify({ $schema: "https://opencode.ai/config.json" })) }, }) injectAuth({ @@ -100,10 +94,7 @@ test("digitalocean provider.models surfaces cached routers from auth metadata", test("digitalocean provider.models skips refresh when oauth bearer is expired", async () => { await using tmp = await tmpdir({ init: async (dir) => { - await Bun.write( - path.join(dir, "opencode.json"), - JSON.stringify({ $schema: "https://opencode.ai/config.json" }), - ) + await Bun.write(path.join(dir, "opencode.json"), JSON.stringify({ $schema: "https://opencode.ai/config.json" })) }, }) injectAuth({ @@ -125,10 +116,7 @@ test("digitalocean provider.models skips refresh when oauth bearer is expired", test("digitalocean provider.models passes through base models when no auth metadata", async () => { await using tmp = await tmpdir({ init: async (dir) => { - await Bun.write( - path.join(dir, "opencode.json"), - JSON.stringify({ $schema: "https://opencode.ai/config.json" }), - ) + await Bun.write(path.join(dir, "opencode.json"), JSON.stringify({ $schema: "https://opencode.ai/config.json" })) }, }) await WithInstance.provide({ diff --git a/packages/opencode/test/tool/registry.test.ts b/packages/opencode/test/tool/registry.test.ts index 595fcd8082..b2beda70ca 100644 --- a/packages/opencode/test/tool/registry.test.ts +++ b/packages/opencode/test/tool/registry.test.ts @@ -223,18 +223,15 @@ describe("tool.registry", () => { const loaded = (yield* registry.all()).find((tool) => tool.id === "image") if (!loaded) throw new Error("custom image tool was not loaded") const agents = yield* Agent.Service - const result = yield* loaded.execute( - {}, - { - sessionID: SessionID.make("ses_test"), - messageID: MessageID.make("msg_test"), - agent: (yield* agents.defaultInfo()).name, - abort: new AbortController().signal, - messages: [], - metadata: () => Effect.void, - ask: () => Effect.void, - } satisfies Tool.Context, - ) + const result = yield* loaded.execute({}, { + sessionID: SessionID.make("ses_test"), + messageID: MessageID.make("msg_test"), + agent: (yield* agents.defaultInfo()).name, + abort: new AbortController().signal, + messages: [], + metadata: () => Effect.void, + ask: () => Effect.void, + } satisfies Tool.Context) expect(result.output).toBe("here is an image") expect(result.attachments).toEqual([