test(core): align tool contract expectations (#39172)

This commit is contained in:
Kit Langton 2026-07-27 20:48:29 -04:00 committed by GitHub
commit 470e360942
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 333 additions and 116 deletions

View file

@ -5,7 +5,7 @@ import { readDisplayText } from "@opencode-ai/tui/mini/tool"
export type ToolInput = Record<string, unknown>
export type ToolContent = ReadonlyArray<
| { readonly type: "text"; readonly text: string }
| { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string }
| { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string | null }
>
export function toToolKind(toolName: string): ToolKind {

View file

@ -1,11 +1,11 @@
import type {
EventSubscribeOutput,
JsonValue,
LLMToolContent,
LocationRef,
OpenCodeClient,
SessionMessageAssistantTool,
SessionMessageInfo,
ToolContent,
} from "@opencode-ai/client/promise"
import { SessionMessage } from "@opencode-ai/schema/session-message"
import { EOL } from "node:os"
@ -56,7 +56,7 @@ type ToolState = StartedPart & {
provider?: unknown
providerState?: SessionMessageAssistantTool["providerState"]
metadata: Record<string, JsonValue>
content: LLMToolContent[]
content: ToolContent[]
}
type V2Event = EventSubscribeOutput