Skip to content

Commit 2cb697b

Browse files
chore: generate
1 parent cb511f7 commit 2cb697b

3 files changed

Lines changed: 19 additions & 30 deletions

File tree

packages/opencode/src/plugin/digitalocean.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ async function createModelAccessKey(bearer: string): Promise<ApiKeyInfo> {
246246
return data.api_key_info
247247
}
248248

249-
async function listRouters(bearer: string): Promise<{ ok: true; routers: RouterEntry[] } | { ok: false; status: number }> {
249+
async function listRouters(
250+
bearer: string,
251+
): Promise<{ ok: true; routers: RouterEntry[] } | { ok: false; status: number }> {
250252
const res = await fetch(`${DO_API_BASE}/v2/gen-ai/models/routers`, {
251253
headers: {
252254
Authorization: `Bearer ${bearer}`,
@@ -293,7 +295,9 @@ function parseRoutersJSON(raw: string | undefined): RouterEntry[] {
293295
try {
294296
const parsed = JSON.parse(raw)
295297
if (!Array.isArray(parsed)) return []
296-
return parsed.flatMap((r) => (r && typeof r.name === "string" ? [{ name: r.name, uuid: r.uuid, description: r.description }] : []))
298+
return parsed.flatMap((r) =>
299+
r && typeof r.name === "string" ? [{ name: r.name, uuid: r.uuid, description: r.description }] : [],
300+
)
297301
} catch {
298302
return []
299303
}

packages/opencode/test/provider/digitalocean.test.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ function injectAuth(metadata: Record<string, string> | undefined) {
4343
test("digitalocean provider autoloads from DIGITALOCEAN_ACCESS_TOKEN", async () => {
4444
await using tmp = await tmpdir({
4545
init: async (dir) => {
46-
await Bun.write(
47-
path.join(dir, "opencode.json"),
48-
JSON.stringify({ $schema: "https://opencode.ai/config.json" }),
49-
)
46+
await Bun.write(path.join(dir, "opencode.json"), JSON.stringify({ $schema: "https://opencode.ai/config.json" }))
5047
},
5148
})
5249
await WithInstance.provide({
@@ -68,10 +65,7 @@ test("digitalocean provider autoloads from DIGITALOCEAN_ACCESS_TOKEN", async ()
6865
test("digitalocean provider.models surfaces cached routers from auth metadata", async () => {
6966
await using tmp = await tmpdir({
7067
init: async (dir) => {
71-
await Bun.write(
72-
path.join(dir, "opencode.json"),
73-
JSON.stringify({ $schema: "https://opencode.ai/config.json" }),
74-
)
68+
await Bun.write(path.join(dir, "opencode.json"), JSON.stringify({ $schema: "https://opencode.ai/config.json" }))
7569
},
7670
})
7771
injectAuth({
@@ -100,10 +94,7 @@ test("digitalocean provider.models surfaces cached routers from auth metadata",
10094
test("digitalocean provider.models skips refresh when oauth bearer is expired", async () => {
10195
await using tmp = await tmpdir({
10296
init: async (dir) => {
103-
await Bun.write(
104-
path.join(dir, "opencode.json"),
105-
JSON.stringify({ $schema: "https://opencode.ai/config.json" }),
106-
)
97+
await Bun.write(path.join(dir, "opencode.json"), JSON.stringify({ $schema: "https://opencode.ai/config.json" }))
10798
},
10899
})
109100
injectAuth({
@@ -125,10 +116,7 @@ test("digitalocean provider.models skips refresh when oauth bearer is expired",
125116
test("digitalocean provider.models passes through base models when no auth metadata", async () => {
126117
await using tmp = await tmpdir({
127118
init: async (dir) => {
128-
await Bun.write(
129-
path.join(dir, "opencode.json"),
130-
JSON.stringify({ $schema: "https://opencode.ai/config.json" }),
131-
)
119+
await Bun.write(path.join(dir, "opencode.json"), JSON.stringify({ $schema: "https://opencode.ai/config.json" }))
132120
},
133121
})
134122
await WithInstance.provide({

packages/opencode/test/tool/registry.test.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,18 +223,15 @@ describe("tool.registry", () => {
223223
const loaded = (yield* registry.all()).find((tool) => tool.id === "image")
224224
if (!loaded) throw new Error("custom image tool was not loaded")
225225
const agents = yield* Agent.Service
226-
const result = yield* loaded.execute(
227-
{},
228-
{
229-
sessionID: SessionID.make("ses_test"),
230-
messageID: MessageID.make("msg_test"),
231-
agent: (yield* agents.defaultInfo()).name,
232-
abort: new AbortController().signal,
233-
messages: [],
234-
metadata: () => Effect.void,
235-
ask: () => Effect.void,
236-
} satisfies Tool.Context,
237-
)
226+
const result = yield* loaded.execute({}, {
227+
sessionID: SessionID.make("ses_test"),
228+
messageID: MessageID.make("msg_test"),
229+
agent: (yield* agents.defaultInfo()).name,
230+
abort: new AbortController().signal,
231+
messages: [],
232+
metadata: () => Effect.void,
233+
ask: () => Effect.void,
234+
} satisfies Tool.Context)
238235

239236
expect(result.output).toBe("here is an image")
240237
expect(result.attachments).toEqual([

0 commit comments

Comments
 (0)