refactor(core): validate codemode fetch display args and drop unused catalog schema (#57959)

This commit is contained in:
Aiden Cline
2026-10-21 21:01:24 -05:00
committed by GitHub
Unverified
parent d26b612066
commit 248bfbe111
3 changed files with 13 additions and 21 deletions
+7 -8
View File
@@ -2,14 +2,13 @@ export * as CodeModeCatalog from "./catalog.js"
import { Schema } from "effect"
export const Tool = Schema.Struct({
type: Schema.Literal("tool"),
name: Schema.String,
description: Schema.String,
signature: Schema.String,
pinned: Schema.optionalKey(Schema.Boolean),
})
export type Tool = typeof Tool.Type
export type Tool = {
readonly type: "tool"
readonly name: string
readonly description: string
readonly signature: string
readonly pinned?: boolean
}
export type Namespace = {
readonly type: "namespace"
+4 -2
View File
@@ -1,6 +1,7 @@
export * as CodeModeWeb from "./web.js"
import { Extension } from "@opencode/codemode"
import { isRecord } from "@opencode/ai/utils/record"
const TIMEOUT_MS = 30_000
@@ -43,6 +44,7 @@ export const extension = Extension.make({ name: "web", globals: { fetch } })
/** What to show for a fetch call: its method and URL. */
export const display = (args: ReadonlyArray<unknown>) => {
const [input, init] = args as [string | URL, Init | undefined]
return { method: init?.method?.toUpperCase() ?? "GET", url: String(input) }
const [input, init] = args
const method = isRecord(init) && typeof init.method === "string" ? init.method.toUpperCase() : "GET"
return { method, url: String(input) }
}
+2 -11
View File
@@ -93,19 +93,10 @@ export const Info = Schema.Struct({
setCacheKey: Schema.optional(Schema.Boolean).annotate({
description: "Enable promptCacheKey for this provider (default false)",
}),
timeout: Schema.optional(
Schema.Union([PositiveInt, Schema.Literal(false)]).annotate({
description: "Timeout in milliseconds for full requests to this provider. Set to false to disable timeout.",
}),
).annotate({
timeout: Schema.optional(Schema.Union([PositiveInt, Schema.Literal(false)])).annotate({
description: "Timeout in milliseconds for full requests to this provider. Set to false to disable timeout.",
}),
headerTimeout: Schema.optional(
Schema.Union([PositiveInt, Schema.Literal(false)]).annotate({
description:
"Timeout in milliseconds to wait for response headers. Provider integrations may set defaults. Set to false to disable timeout.",
}),
).annotate({
headerTimeout: Schema.optional(Schema.Union([PositiveInt, Schema.Literal(false)])).annotate({
description:
"Timeout in milliseconds to wait for response headers. Provider integrations may set defaults. Set to false to disable timeout.",
}),