From e759847f932c0de08261ec98a5fac3bae037120f Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 24 Sep 2026 13:20:28 -0700 Subject: [PATCH 01/58] fix(acp): keep one answer when a running tool reports progress (#13386) Co-authored-by: adeebahmad01 <52380344+adeebahmad01@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) --- apps/server/scripts/acp-mock-agent.ts | 43 +++++++++++++++++ .../provider/acp/AcpJsonRpcConnection.test.ts | 48 +++++++++++++++++++ .../src/provider/acp/AcpSessionRuntime.ts | 27 ++++++++--- 3 files changed, 112 insertions(+), 6 deletions(-) diff --git a/apps/server/scripts/acp-mock-agent.ts b/apps/server/scripts/acp-mock-agent.ts index 9fbdeee03c86..17a464be2f10 100644 --- a/apps/server/scripts/acp-mock-agent.ts +++ b/apps/server/scripts/acp-mock-agent.ts @@ -19,6 +19,8 @@ const emitToolCalls = process.env.T3_ACP_EMIT_TOOL_CALLS === "1"; const emitInterleavedAssistantToolCalls = process.env.T3_ACP_EMIT_INTERLEAVED_ASSISTANT_TOOL_CALLS === "1"; const emitGenericToolPlaceholders = process.env.T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS === "1"; +const emitBackgroundToolDuringAnswer = + process.env.T3_ACP_EMIT_BACKGROUND_TOOL_DURING_ANSWER === "1"; const emitAskQuestion = process.env.T3_ACP_EMIT_ASK_QUESTION === "1"; const emitXAiAskUserQuestion = process.env.T3_ACP_EMIT_XAI_ASK_USER_QUESTION === "1"; const emitXAiExitPlanMode = process.env.T3_ACP_EMIT_XAI_EXIT_PLAN_MODE === "1"; @@ -941,6 +943,47 @@ const program = Effect.gen(function* () { return yield* Effect.never; } + if (emitBackgroundToolDuringAnswer) { + // A command backgrounded earlier reports progress and then finishes + // while the next answer is still streaming. + const toolCallId = "background-1"; + const say = (text: string) => + agent.client.sessionUpdate({ + sessionId: requestedSessionId, + update: { sessionUpdate: "agent_message_chunk", content: { type: "text", text } }, + }); + const progress = (status: "in_progress" | "completed", stdout: string) => + agent.client.sessionUpdate({ + sessionId: requestedSessionId, + update: { + sessionUpdate: "tool_call_update", + toolCallId, + status, + rawOutput: { stdout }, + }, + }); + yield* agent.client.sessionUpdate({ + sessionId: requestedSessionId, + update: { + sessionUpdate: "tool_call", + toolCallId, + title: "Terminal", + kind: "execute", + status: "in_progress", + rawInput: { command: "sleep 3 && echo done" }, + }, + }); + yield* say("| a | b |\n|---|---|\n| 1 "); + yield* progress("in_progress", "."); + yield* say("| x |\n"); + yield* progress("completed", "done"); + yield* say("| 2 | y |\n"); + // Agents can repeat a terminal update after the call finished. + yield* progress("completed", "done"); + yield* say("| 3 | z |"); + return { stopReason: "end_turn" }; + } + if (emitInterleavedAssistantToolCalls) { const toolCallId = "tool-call-1"; diff --git a/apps/server/src/provider/acp/AcpJsonRpcConnection.test.ts b/apps/server/src/provider/acp/AcpJsonRpcConnection.test.ts index 45a5cadb9a31..dde5979c0f56 100644 --- a/apps/server/src/provider/acp/AcpJsonRpcConnection.test.ts +++ b/apps/server/src/provider/acp/AcpJsonRpcConnection.test.ts @@ -824,6 +824,54 @@ describe("AcpSessionRuntime", () => { ), ); + it.effect("keeps one answer when an earlier tool reports progress mid-stream", () => + Effect.gen(function* () { + const runtime = yield* AcpSessionRuntime.AcpSessionRuntime; + yield* runtime.start(); + yield* runtime.prompt({ prompt: [{ type: "text", text: "hi" }] }); + + const notes = Array.from(yield* Stream.runCollect(Stream.take(runtime.getEvents(), 9))); + // The coalesced progress tick emits nothing, and neither the completion + // nor a repeated one splits the markdown table across items. + expect(notes.map((note) => note._tag)).toEqual([ + "ToolCallUpdated", + "AssistantItemStarted", + "ContentDelta", + "ContentDelta", + "ToolCallUpdated", + "ContentDelta", + "ToolCallUpdated", + "ContentDelta", + "AssistantItemCompleted", + ]); + const itemIds = new Set( + notes.flatMap((note) => + note._tag === "ContentDelta" || + note._tag === "AssistantItemStarted" || + note._tag === "AssistantItemCompleted" + ? [note.itemId] + : [], + ), + ); + expect(itemIds.size).toBe(1); + }).pipe( + Effect.provide( + AcpSessionRuntime.layer({ + spawn: { + command: mockAgentCommand, + args: mockAgentArgs, + env: { T3_ACP_EMIT_BACKGROUND_TOOL_DURING_ANSWER: "1" }, + }, + cwd: process.cwd(), + clientInfo: { name: "t3-test", version: "0.0.0" }, + authMethodId: "test", + }), + ), + Effect.scoped, + Effect.provide(NodeServices.layer), + ), + ); + it.effect("emits status-only tool updates through completion", () => Effect.gen(function* () { const runtime = yield* AcpSessionRuntime.AcpSessionRuntime; diff --git a/apps/server/src/provider/acp/AcpSessionRuntime.ts b/apps/server/src/provider/acp/AcpSessionRuntime.ts index 77517c44ea9b..c6b93cf20546 100644 --- a/apps/server/src/provider/acp/AcpSessionRuntime.ts +++ b/apps/server/src/provider/acp/AcpSessionRuntime.ts @@ -40,6 +40,8 @@ import { type AcpToolCallState, } from "./AcpRuntimeModel.ts"; +const MAX_SHOWN_TOOL_CALL_IDS = 256; + interface AcpToolCallTrackedState { readonly state: AcpToolCallState; readonly lastEmittedDetailLength: number | undefined; @@ -334,6 +336,9 @@ export const make = ( const eventQueue = yield* Queue.unbounded(); const modeStateRef = yield* Ref.make(undefined); const toolCallsRef = yield* Ref.make(new Map()); + // Recently shown tool calls. A late update to a finished call is not a new + // boundary in the answer, although its progress state is gone. + const shownToolCallIds = new Set(); const assistantItemRuntimeId = yield* crypto.randomUUIDv4.pipe( Effect.mapError( (cause) => @@ -525,6 +530,7 @@ export const make = ( modeStateRef, configOptionsRef, toolCallsRef, + shownToolCallIds, assistantSegmentRef, assistantItemRuntimeId, params: notification, @@ -1178,6 +1184,7 @@ const handleSessionUpdate = ({ modeStateRef, configOptionsRef, toolCallsRef, + shownToolCallIds, assistantSegmentRef, assistantItemRuntimeId, params, @@ -1186,6 +1193,7 @@ const handleSessionUpdate = ({ readonly modeStateRef: Ref.Ref; readonly configOptionsRef: Ref.Ref>; readonly toolCallsRef: Ref.Ref>; + readonly shownToolCallIds: Set; readonly assistantSegmentRef: Ref.Ref; readonly assistantItemRuntimeId: string; readonly params: EffectAcpSchema.SessionNotification; @@ -1202,11 +1210,7 @@ const handleSessionUpdate = ({ } for (const event of parsed.events) { if (event._tag === "ToolCallUpdated") { - yield* closeActiveAssistantSegment({ - queue, - assistantSegmentRef, - }); - const { merged, decision } = yield* Ref.modify(toolCallsRef, (current) => { + const { merged, decision, active } = yield* Ref.modify(toolCallsRef, (current) => { const tracked = current.get(event.toolCall.toolCallId); const previous = tracked?.state; const nextToolCall = mergeToolCallState(previous, event.toolCall); @@ -1228,11 +1232,22 @@ const handleSessionUpdate = ({ skippedSinceEmit: decision.skippedSinceEmit, }); } - return [{ merged: nextToolCall, decision }, next] as const; + return [{ merged: nextToolCall, decision, active: tracked !== undefined }, next] as const; }); if (!decision.emit) { continue; } + // A new tool call is a boundary in the prose. Progress on a call that + // is already shown, such as a background command finishing, is not. + if (!shownToolCallIds.has(merged.toolCallId)) { + shownToolCallIds.add(merged.toolCallId); + // Only recent calls get late updates; keep a long session bounded. + if (shownToolCallIds.size > MAX_SHOWN_TOOL_CALL_IDS) { + shownToolCallIds.delete(shownToolCallIds.values().next().value!); + } + // A call still running is already on screen, even if it aged out. + if (!active) yield* closeActiveAssistantSegment({ queue, assistantSegmentRef }); + } yield* Queue.offer(queue, { _tag: "ToolCallUpdated", toolCall: merged, From 66129c6fd518aa01d873ebb47060b41c17312d60 Mon Sep 17 00:00:00 2001 From: Bilal Bakr <62337003+Bil0000@users.noreply.github.com> Date: Thu, 24 Sep 2026 23:22:12 +0300 Subject: [PATCH 02/58] feat(web): run shell commands from chat in the thread terminal (#13060) Co-authored-by: Julius Marminge Co-authored-by: Claude Opus 5.5 (1M context) --- apps/web/src/components/ChatMarkdown.test.tsx | 69 +++++++++++++++++++ apps/web/src/components/ChatMarkdown.tsx | 65 ++++++++++++++++- apps/web/src/components/ChatView.tsx | 18 +++++ .../src/components/chat/MessagesTimeline.tsx | 6 ++ 4 files changed, 157 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/ChatMarkdown.test.tsx b/apps/web/src/components/ChatMarkdown.test.tsx index d8a5f651ff83..cb25e6938fa7 100644 --- a/apps/web/src/components/ChatMarkdown.test.tsx +++ b/apps/web/src/components/ChatMarkdown.test.tsx @@ -179,6 +179,75 @@ describe("ChatMarkdown favicon privacy", () => { }); describe("ChatMarkdown streaming", () => { + it("runs only a complete single-line shell block after a click", async () => { + vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true); + const onRunShellCommand = vi.fn(); + let renderer: ReactTestRenderer | undefined; + const message = (text: string, isStreaming = false) => ( + + ); + try { + await act(async () => { + renderer = create(message("```bash\necho hello\n```", true)); + }); + const mounted = renderer!; + expect( + mounted.root + .findAllByType(Button) + .some((button) => button.props["aria-label"] === "Run in terminal"), + ).toBe(false); + + await act(async () => { + mounted.update(message("```bash\necho hello\n```")); + }); + await act(async () => { + codeButton(mounted, "Run in terminal").onClick?.({} as never); + }); + expect(onRunShellCommand).toHaveBeenCalledExactlyOnceWith("echo hello"); + + for (const text of [ + "~~~bash\necho tilde\n~~~", + "> ```bash\n> echo quote\n> ```", + "````bash\necho four\n````", + ]) { + await act(async () => { + mounted.update(message(text)); + }); + expect(codeButton(mounted, "Run in terminal")).toBeDefined(); + } + + for (const text of [ + "```bash\necho one\necho two\n```", + "```typescript\necho hello\n```", + "```bash\n\n```", + "```bash\necho hello\n\n```", + "```bash\necho hello\\\n```", + "```bash\necho safe \u202e#\n```", + "```bash\necho incomplete", + "~~~bash\necho incomplete", + "````bash\necho incomplete\n```", + '
echo html
', + ]) { + await act(async () => { + mounted.update(message(text)); + }); + expect( + mounted.root + .findAllByType(Button) + .some((button) => button.props["aria-label"] === "Run in terminal"), + ).toBe(false); + } + } finally { + await act(async () => renderer?.unmount()); + vi.unstubAllGlobals(); + } + }); + it("does not retokenize completed lines when streaming finishes", async () => { const highlighter = await getSyntaxHighlighterPromise("typescript"); const highlight = vi.spyOn(highlighter, "codeToHast"); diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx index 5b6cdfde49d6..4a1f616aed3b 100644 --- a/apps/web/src/components/ChatMarkdown.tsx +++ b/apps/web/src/components/ChatMarkdown.tsx @@ -20,6 +20,7 @@ import { MessageSquareWarningIcon, Minimize2Icon, OctagonAlertIcon, + PlayIcon, PresentationIcon, SparklesIcon, TriangleAlertIcon, @@ -215,6 +216,7 @@ interface ChatMarkdownProps { parseRawHtml?: boolean; /** Append a prompt that invokes a newly created artifact-template skill. */ onUseArtifactTemplate?: ((template: CodexArtifactTemplate) => void) | undefined; + onRunShellCommand?: ((command: string) => void) | undefined; /** Directory that anchors relative links and images; defaults to `cwd`. Set to the file's own directory when rendering a markdown file. */ imageBaseDir?: string | undefined; @@ -585,6 +587,23 @@ function extractPreCodeMeta(node: unknown): string | undefined { return typeof meta === "string" && meta.trim().length > 0 ? meta.trim() : undefined; } +function isClosedCodeFence(node: ReactMarkdownExtraProps["node"], text: string): boolean { + const start = node?.position?.start.offset; + const end = node?.position?.end.offset; + if (start === undefined || end === undefined) return false; + const source = text.slice(start, end); + const opening = /^(?:`{3,}|~{3,})/.exec(source)?.[0]; + // One class for the blockquote prefix: nested quantifiers here backtrack + // exponentially on code lines that start with many `> ` markers. + const closing = /(?:^|\n)[ \t>]*(`{3,}|~{3,})[ \t\r]*$/.exec(source)?.[1]; + return ( + opening !== undefined && + closing !== undefined && + opening[0] === closing[0] && + closing.length >= opening.length + ); +} + type MarkdownAstNode = { type?: string; meta?: unknown; @@ -920,12 +939,16 @@ function MarkdownCodeBlock({ language, fenceTitle, theme, + onRunShellCommand, + isStreaming, children, }: { code: string; language: string; fenceTitle: string | null; theme: "light" | "dark"; + onRunShellCommand?: ((command: string) => void) | undefined; + isStreaming: boolean; children: ReactNode; }) { const [copied, setCopied] = useState(false); @@ -933,6 +956,17 @@ function MarkdownCodeBlock({ const copiedTimerRef = useRef | null>(null); const wrapLabel = wrapped ? "Disable line wrap" : "Wrap lines"; const copyLabel = copied ? "Copied" : "Copy code"; + const command = code.trim(); + const canRun = + onRunShellCommand !== undefined && + !isStreaming && + /^(?:sh|bash|zsh|fish|shell|powershell|pwsh)$/.test(language) && + code.endsWith("\n") && + command.length > 0 && + !command.endsWith("\\") && + // Control and invisible format characters (bidi overrides, zero-width) can + // make the rendered command differ from what the terminal would receive. + !/[\p{Cc}\p{Cf}]/u.test(code.slice(0, -1)); const handleCopy = useCallback(() => { if (typeof navigator === "undefined" || navigator.clipboard == null) { @@ -1004,6 +1038,24 @@ function MarkdownCodeBlock({ {wrapLabel} + {canRun ? ( + + onRunShellCommand(command)} + aria-label="Run in terminal" + /> + } + > + + + Run in terminal + + ) : null} {children}; }, pre: function MarkdownPre({ node, children, ...props }) { - const { resolvedTheme, diffThemeName, isStreaming } = use(ChatMarkdownRendererContext); + const { resolvedTheme, diffThemeName, isStreaming, onRunShellCommand, text } = use( + ChatMarkdownRendererContext, + ); const codeBlock = extractCodeBlock(children); if (!codeBlock) { return
{children}
; @@ -3225,6 +3282,12 @@ const CHAT_MARKDOWN_COMPONENTS = { language={language} fenceTitle={fenceTitle} theme={resolvedTheme} + onRunShellCommand={ + onRunShellCommand && !isStreaming && isClosedCodeFence(node, text) + ? onRunShellCommand + : undefined + } + isStreaming={isStreaming} > { + runProjectScriptRef.current = runProjectScript; + }, [runProjectScript]); + const runShellCommand = useCallback((command: string) => { + void runProjectScriptRef.current( + { + id: "chat-code-block", + name: "Chat code block", + command, + icon: "play", + runOnWorktreeCreate: false, + }, + { rememberAsLastInvoked: false }, + ); + }, []); + const supportsProjectSettingsOverrides = environmentById.get(environmentId)?.serverConfig?.environment.capabilities .projectSettingsOverrides === true; @@ -9902,6 +9919,7 @@ export default function ChatView(props: ChatViewProps) { agentPanelModel, onOpenAgents: addAgentsSurface, onUseArtifactTemplate: useArtifactTemplate, + ...(activeProject ? { onRunShellCommand: runShellCommand } : {}), } : {})} isWorking={!paintOnlyDisplayedTimeline && isWorking} diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx index 505f64af3640..755657e794ab 100644 --- a/apps/web/src/components/chat/MessagesTimeline.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.tsx @@ -277,6 +277,7 @@ interface TimelineRowSharedState { activeThreadEnvironmentId: EnvironmentId; onRevertToTurnCount: (targetTurnCount: number, messageId: MessageId) => void; onUseArtifactTemplate: (template: CodexArtifactTemplate) => void; + onRunShellCommand: ((command: string) => void) | undefined; onImageExpand: (preview: ExpandedImagePreview) => void; onFileOpen: (attachment: ChatFileAttachment) => void; onFileDownload: (attachment: ChatFileAttachment) => void; @@ -425,6 +426,7 @@ interface MessagesTimelineProps { supportsConversationRollback: boolean; onRevertToTurnCount: (targetTurnCount: number, messageId: MessageId) => void; onUseArtifactTemplate?: (template: CodexArtifactTemplate) => void; + onRunShellCommand?: (command: string) => void; isRevertingCheckpoint: boolean; onImageExpand: (preview: ExpandedImagePreview) => void; onFileOpen?: (attachment: ChatFileAttachment) => void; @@ -494,6 +496,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({ supportsConversationRollback, onRevertToTurnCount, onUseArtifactTemplate = NOOP_USE_ARTIFACT_TEMPLATE, + onRunShellCommand, isRevertingCheckpoint, onImageExpand, onFileOpen = NOOP_OPEN_ATTACHMENT, @@ -1138,6 +1141,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({ activeThreadEnvironmentId, onRevertToTurnCount, onUseArtifactTemplate, + onRunShellCommand, onImageExpand, onFileOpen, onFileDownload, @@ -1173,6 +1177,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({ activeThreadEnvironmentId, onRevertToTurnCount, onUseArtifactTemplate, + onRunShellCommand, onImageExpand, onFileOpen, onFileDownload, @@ -2372,6 +2377,7 @@ function AssistantTimelineRow({ row }: { row: Extract From f3cb2a1fee65a55a4083c4cfe9317ca0d1e7c1d5 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 24 Sep 2026 13:35:02 -0700 Subject: [PATCH 03/58] fix(antigravity): keep Windows runtime unpacking under MAX_PATH (#13389) Co-authored-by: javiergusart <42075376+javiergusart@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) --- .../provider/AntigravityInstallation.test.ts | 2 + .../src/provider/AntigravityInstallation.ts | 3 + .../Drivers/AntigravityDriver.test.ts | 27 +++++---- .../src/provider/Drivers/AntigravityDriver.ts | 33 ++++++++--- .../provider/acp/AntigravitySessionFiles.ts | 8 +-- .../provider/antigravityAuthSupport.test.ts | 57 ++++++++++++++----- .../src/provider/antigravityAuthSupport.ts | 44 +++++++++----- 7 files changed, 123 insertions(+), 51 deletions(-) diff --git a/apps/server/src/provider/AntigravityInstallation.test.ts b/apps/server/src/provider/AntigravityInstallation.test.ts index e2bab831712a..de72ebcc4e23 100644 --- a/apps/server/src/provider/AntigravityInstallation.test.ts +++ b/apps/server/src/provider/AntigravityInstallation.test.ts @@ -342,6 +342,8 @@ it.layer(NodeServices.layer)("Antigravity installation", (it) => { if (!profile) return yield* Effect.die("Expected a disposable validation profile."); profiles.add(profile); const helper = command.args[0] === "-e"; + // The runtime unpacks straight into the disposable profile. + if (!helper) expect(command.options.env?.TMPDIR).toBe(profile); const output = yield* Queue.unbounded(); const exited = yield* Deferred.make(); const terminate = Deferred.succeed(exited, ChildProcessSpawner.ExitCode(0)).pipe( diff --git a/apps/server/src/provider/AntigravityInstallation.ts b/apps/server/src/provider/AntigravityInstallation.ts index 24eb4e3d6df8..75baf453da03 100644 --- a/apps/server/src/provider/AntigravityInstallation.ts +++ b/apps/server/src/provider/AntigravityInstallation.ts @@ -476,6 +476,9 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma profileDirectory, platform, baseEnv: environment, + // The profile is scoped, so it cleans up the unpack; a shallow + // root keeps it under Windows' path limit. + tempDirectory: profileDirectory, }); const runtime = yield* makeAntigravityAcpRuntime({ spawn: buildAntigravityAcpSpawnInput({ diff --git a/apps/server/src/provider/Drivers/AntigravityDriver.test.ts b/apps/server/src/provider/Drivers/AntigravityDriver.test.ts index cc9ccb074b9e..18f7aaffee06 100644 --- a/apps/server/src/provider/Drivers/AntigravityDriver.test.ts +++ b/apps/server/src/provider/Drivers/AntigravityDriver.test.ts @@ -31,8 +31,7 @@ import { } from "../AntigravityInstallation.ts"; import { ANTIGRAVITY_AUTH_STDOUT_PREFIX, - resolveAntigravityProfileDirectory, - resolveAntigravityRuntimeTempDirectory, + resolveAntigravityInstanceDirectories, } from "../antigravityAuthSupport.ts"; import { NoOpProviderEventLoggers, ProviderEventLoggers } from "../Layers/ProviderEventLoggers.ts"; import * as ModelManifest from "../ModelManifest.ts"; @@ -74,7 +73,8 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* ( new URL("../../../scripts/acp-mock-agent.ts", import.meta.url), ); const requestLog = path.join(root, "requests.jsonl"); - const profileDirectory = resolveAntigravityProfileDirectory(config.stateDir, instanceId); + const directories = yield* resolveAntigravityInstanceDirectories(config.stateDir, instanceId); + const profileDirectory = directories.profile; const instancePath = `${path.join(root, "instance-bin")}:${baseEnv.PATH ?? ""}`; const makeExecutable = Effect.fn("AntigravityDriverTest.makeExecutable")(function* ( @@ -233,6 +233,7 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* ( fs, path, profileDirectory, + directories, instancePath, first, second, @@ -475,7 +476,7 @@ it.layer(testLayer)("AntigravityDriver", (it) => { () => Effect.gen(function* () { const h = yield* makeHarness(); - const tempRoot = resolveAntigravityRuntimeTempDirectory(h.profileDirectory); + const tempRoot = h.directories.runtimeTemp; yield* h.refresh(); yield* h.refresh(); const directories = h.launches.flatMap((launch) => @@ -498,12 +499,17 @@ it.layer(testLayer)("AntigravityDriver", (it) => { const path = yield* Path.Path; const config = yield* ServerConfig; const instanceId = ProviderInstanceId.make("antigravity-orphan-sweep"); - const tempRoot = resolveAntigravityRuntimeTempDirectory( - resolveAntigravityProfileDirectory(config.stateDir, instanceId), + const directories = yield* resolveAntigravityInstanceDirectories( + config.stateDir, + instanceId, ); - const orphan = path.join(tempRoot, "run-orphan", "_MEI123", "google3"); - yield* fs.makeDirectory(orphan, { recursive: true }); - yield* fs.writeFileString(path.join(orphan, "payload.bin"), "stale"); + // Older builds unpacked inside the profile. + const legacyRoot = path.join(directories.profile, "antigravity-acp", "tmp"); + for (const root of [directories.runtimeTemp, legacyRoot]) { + const orphan = path.join(root, "run-orphan", "_MEI123", "google3"); + yield* fs.makeDirectory(orphan, { recursive: true }); + yield* fs.writeFileString(path.join(orphan, "payload.bin"), "stale"); + } yield* AntigravityDriver.create({ instanceId, displayName: "Sweep", @@ -519,7 +525,8 @@ it.layer(testLayer)("AntigravityDriver", (it) => { }), ), ); - expect(yield* fs.exists(tempRoot)).toBe(false); + expect(yield* fs.exists(directories.runtimeTemp)).toBe(false); + expect(yield* fs.exists(legacyRoot)).toBe(false); }).pipe(Effect.scoped), ); diff --git a/apps/server/src/provider/Drivers/AntigravityDriver.ts b/apps/server/src/provider/Drivers/AntigravityDriver.ts index 1141ac5856fc..fb9c7041b5fd 100644 --- a/apps/server/src/provider/Drivers/AntigravityDriver.ts +++ b/apps/server/src/provider/Drivers/AntigravityDriver.ts @@ -33,8 +33,7 @@ import { buildAntigravityAcpSpawnInput, isAntigravitySignInRequiredError, prepareAntigravityProfile, - resolveAntigravityProfileDirectory, - resolveAntigravityRuntimeTempDirectory, + resolveAntigravityInstanceDirectories, type AntigravityAuthConfig, } from "../antigravityAuthSupport.ts"; import { @@ -103,15 +102,34 @@ export const AntigravityDriver: ProviderDriver + new ProviderDriverError({ + driver: DRIVER, + instanceId, + detail: "Could not resolve the Antigravity profile directory.", + cause, + }), + ), ); + const profileDirectory = directories.profile; // No process of this instance exists yet, so every runtime temp - // directory left under the profile is an orphan from a killed server. - yield* removeAntigravityRuntimeTempDirs( - resolveAntigravityRuntimeTempDirectory(profileDirectory), - ).pipe(Effect.provideService(FileSystem.FileSystem, fileSystem)); + // directory it owns is an orphan from a killed server. Older builds + // unpacked inside the profile. + for (const directory of [ + directories.runtimeTemp, + path.join(profileDirectory, "antigravity-acp", "tmp"), + ]) { + yield* removeAntigravityRuntimeTempDirs(directory).pipe( + Effect.provideService(FileSystem.FileSystem, fileSystem), + ); + } const continuationIdentity = defaultProviderContinuationIdentity({ driverKind: DRIVER, instanceId, @@ -165,6 +183,7 @@ export const AntigravityDriver: ProviderDriver { } }); - it("keeps accounts separate even when instance IDs differ only by case", () => { - const first = resolveAntigravityProfileDirectory( - "/userdata", - ProviderInstanceId.make("antigravity"), - ); - const second = resolveAntigravityProfileDirectory( - "/userdata", - ProviderInstanceId.make("Antigravity"), - ); - expect(first.toLowerCase()).not.toBe(second.toLowerCase()); - expect( - resolveAntigravityProfileDirectory("/userdata", ProviderInstanceId.make("antigravity")), - ).toBe(first); - }); + it.effect("keeps accounts separate even when instance IDs differ only by case", () => + Effect.gen(function* () { + const first = yield* resolveAntigravityInstanceDirectories( + "/userdata", + ProviderInstanceId.make("antigravity"), + ); + const second = yield* resolveAntigravityInstanceDirectories( + "/userdata", + ProviderInstanceId.make("Antigravity"), + ); + // Existing sign-ins live at this path; it must not move. + expect(first.profile).toBe( + "/userdata/providers/antigravity/ac0a3dfd6dddb20962cecff6ee5fe65e19d3923be20e52c5ab52ff877f7e4c32", + ); + expect(first.profile.toLowerCase()).not.toBe(second.profile.toLowerCase()); + expect(first.runtimeTemp.toLowerCase()).not.toBe(second.runtimeTemp.toLowerCase()); + }).pipe(Effect.provide(Layer.mergeAll(NodeCrypto.layer, NodePath.layerPosix))), + ); + + it.effect("keeps the unpacked Windows runtime under MAX_PATH for long user names", () => + Effect.gen(function* () { + const path = yield* Path.Path; + // Deepest member of the official agy_acp_server_1.1.1 windows-x86_64 bundle. + const deepestMember = + "google3\\cloud\\developer_experience\\antigravity_extensions\\acp_server\\_private__agy_acp_server_bin.lazy_imports_info.json"; + const directories = yield* resolveAntigravityInstanceDirectories( + "C:\\Users\\a-twenty-char-person\\.t3\\userdata", + ProviderInstanceId.make("antigravity"), + ); + const extracted = (tempDirectory: string) => + path.join(tempDirectory, "run-AbC123", "_MEI000012ab2", deepestMember); + // MAX_PATH is 260 including the terminating NUL. + expect(extracted(directories.runtimeTemp).length).toBeLessThan(260); + expect( + extracted(path.join(directories.profile, "antigravity-acp", "tmp")).length, + ).toBeGreaterThanOrEqual(260); + }).pipe(Effect.provide(Layer.mergeAll(NodeCrypto.layer, NodePath.layerWin32))), + ); }); describe("Antigravity authorization URL", () => { diff --git a/apps/server/src/provider/antigravityAuthSupport.ts b/apps/server/src/provider/antigravityAuthSupport.ts index b48368ad2a1d..fc7fcb0854cf 100644 --- a/apps/server/src/provider/antigravityAuthSupport.ts +++ b/apps/server/src/provider/antigravityAuthSupport.ts @@ -1,13 +1,12 @@ -import * as NodeCrypto from "node:crypto"; // @effect-diagnostics-next-line nodeBuiltinImport:off - Effect's symlink has no type argument, and Windows needs a junction to link without elevation. import * as NodeFSP from "node:fs/promises"; -// @effect-diagnostics-next-line nodeBuiltinImport:off - resolveAntigravityProfileDirectory is a pure sync helper, so it cannot use the Path service. -import * as NodePath from "node:path"; import type { AntigravityAuthMethod, ProviderInstanceId } from "@t3tools/contracts"; import { HostProcessPlatform } from "@t3tools/shared/hostProcess"; import { resolveNodeExecutable, nodeRuntimeUnavailableMessage } from "@t3tools/shared/nodeRuntime"; +import * as Crypto from "effect/Crypto"; import * as Effect from "effect/Effect"; +import * as Encoding from "effect/Encoding"; import * as FileSystem from "effect/FileSystem"; import * as Path from "effect/Path"; import type * as PlatformError from "effect/PlatformError"; @@ -185,19 +184,32 @@ export function isAntigravitySignInRequiredError(error: unknown): boolean { ); } -/** Keeps case-sensitive instance IDs separate on case-insensitive filesystems. */ -export function resolveAntigravityProfileDirectory( - stateDir: string, - instanceId: ProviderInstanceId, -): string { - const directoryName = NodeCrypto.createHash("sha256").update(instanceId).digest("hex"); - return NodePath.join(stateDir, "providers", "antigravity", directoryName); +export interface AntigravityInstanceDirectories { + /** GEMINI_HOME for the agent. Holds the instance's Google sign-in. */ + readonly profile: string; + /** + * Parent of the per-process directories the agent unpacks into. It sits + * beside the profile, not inside it: the agent unpacks members up to 120 + * characters deep, and the profile's longer name would push them past + * Windows' 260-character path limit. + */ + readonly runtimeTemp: string; } -/** Parent of the per-process runtime temp directories inside a profile. */ -export function resolveAntigravityRuntimeTempDirectory(profileDirectory: string): string { - return NodePath.join(profileDirectory, "antigravity-acp", "tmp"); -} +/** Hashes the instance ID so case-only differences stay separate on case-insensitive filesystems. */ +export const resolveAntigravityInstanceDirectories = Effect.fn( + "resolveAntigravityInstanceDirectories", +)(function* (stateDir: string, instanceId: ProviderInstanceId) { + const crypto = yield* Crypto.Crypto; + const path = yield* Path.Path; + const key = Encoding.encodeHex( + yield* crypto.digest("SHA-256", new TextEncoder().encode(instanceId)), + ); + return { + profile: path.join(stateDir, "providers", "antigravity", key), + runtimeTemp: path.join(stateDir, "antigravity-tmp", key.slice(0, 12)), + } satisfies AntigravityInstanceDirectories; +}); function quoteBrowserArgument(value: string): string { return `'${value.replaceAll("'", `'"'"'`)}'`; @@ -300,6 +312,8 @@ export const prepareAntigravityProfile = Effect.fn("prepareAntigravityProfile")( readonly auth?: AntigravityAuthConfig; /** Home the agent expands `~` against. Defaults to the launch environment's. */ readonly userHome?: string; + /** Parent of per-process temp directories. Defaults to one inside the profile. */ + readonly tempDirectory?: string; }) { const auth = input.auth ?? ANTIGRAVITY_PERSONAL_AUTH; const fs = yield* FileSystem.FileSystem; @@ -337,7 +351,7 @@ export const prepareAntigravityProfile = Effect.fn("prepareAntigravityProfile")( const geminiHome = path.resolve(input.profileDirectory); const acpDirectory = path.join(geminiHome, "antigravity-acp"); - const tempDirectory = resolveAntigravityRuntimeTempDirectory(geminiHome); + const tempDirectory = input.tempDirectory ?? path.join(acpDirectory, "tmp"); const profile: AntigravityProfile = { platform, geminiHome, From 567783ecdc658c8bf86c4c4980df5df8ebdd9037 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 24 Sep 2026 14:10:02 -0700 Subject: [PATCH 04/58] fix(codex): the protocol generator runs again on Effect rc.115 (#13480) Co-authored-by: Claude Opus 5.5 (1M context) --- .../provider/Layers/CodexSessionRuntime.ts | 4 +- .../scripts/generate.ts | 89 +- .../src/_generated/schema.gen.ts | 39464 ++++++++-------- 3 files changed, 20514 insertions(+), 19043 deletions(-) diff --git a/apps/server/src/provider/Layers/CodexSessionRuntime.ts b/apps/server/src/provider/Layers/CodexSessionRuntime.ts index 674d23327b65..7f0f9765730e 100644 --- a/apps/server/src/provider/Layers/CodexSessionRuntime.ts +++ b/apps/server/src/provider/Layers/CodexSessionRuntime.ts @@ -119,7 +119,7 @@ const McpElicitationFormField = Schema.Struct({ type: Schema.optionalKey(NullableMcpElicitationString), title: Schema.optionalKey(NullableMcpElicitationString), description: Schema.optionalKey(NullableMcpElicitationString), - default: Schema.optionalKey(Schema.Unknown), + default: Schema.optionalKey(Schema.Json), enum: Schema.optionalKey(Schema.NullOr(Schema.Array(Schema.String))), enumNames: Schema.optionalKey(Schema.NullOr(Schema.Array(Schema.String))), oneOf: Schema.optionalKey( @@ -442,7 +442,7 @@ export function toMcpElicitationResponse( ? "always" : undefined; const form = mcpElicitationFormFields(payload); - const content: Record = {}; + const content: Record = {}; for (const [key, field] of Object.entries(form?.properties ?? {})) { const options = mcpElicitationFieldOptions(field); diff --git a/packages/effect-codex-app-server/scripts/generate.ts b/packages/effect-codex-app-server/scripts/generate.ts index 48509db8cc21..d61db6dc2dc8 100644 --- a/packages/effect-codex-app-server/scripts/generate.ts +++ b/packages/effect-codex-app-server/scripts/generate.ts @@ -269,8 +269,13 @@ const ensureGeneratedDir = Effect.fn("ensureGeneratedDir")(function* () { }); const fetchText = Effect.fn("fetchText")(function* (url: string) { + // Unauthenticated GitHub API calls are capped at 60/hour; set GITHUB_TOKEN to lift that. + const token = process.env.GITHUB_TOKEN; return yield* HttpClientRequest.get(url).pipe( HttpClientRequest.setHeader("user-agent", USER_AGENT), + token && url.startsWith("https://api.github.com/") + ? HttpClientRequest.bearerToken(token) + : (request) => request, HttpClient.execute, Effect.flatMap(HttpClientResponse.filterStatusOk), Effect.flatMap((okResponse) => okResponse.text), @@ -387,6 +392,84 @@ function stripNullDefaults(value: Schema.Json): Schema.Json { ) as Schema.Json; } +type JsonSchemaNode = { readonly [key: string]: Schema.Json }; + +function isJsonSchemaNode(value: Schema.Json | undefined): value is JsonSchemaNode { + return value !== null && typeof value === "object" && !Array.isArray(value); +} + +// Adapts Codex's JSON Schema to Effect's importer, visiting only schema +// positions so a field literally named "properties" is left alone: +// - Effect imports an object without additionalProperties as an open record. +// Codex omits it for plain structs, so close objects that list properties. +// - Effect cannot intersect shared object fields with object alternatives, +// which Codex uses for "one of these keys plus shared fields" +// (image_url | file_id). Fold the shared fields into each alternative. +function adaptSchemaForEffect(value: Schema.Json): Schema.Json { + if (!isJsonSchemaNode(value)) { + return value; + } + const node: Record = { ...value }; + for (const key of ["items", "additionalProperties"]) { + const child = node[key]; + if (isJsonSchemaNode(child)) node[key] = adaptSchemaForEffect(child); + } + for (const key of ["anyOf", "oneOf", "allOf"]) { + const child = node[key]; + if (Array.isArray(child)) node[key] = child.map(adaptSchemaForEffect); + } + for (const key of ["properties", "definitions"]) { + const child = node[key]; + if (isJsonSchemaNode(child)) { + node[key] = Object.fromEntries( + Object.entries(child).map(([name, schema]) => [name, adaptSchemaForEffect(schema)]), + ); + } + } + + const { properties } = node; + if ( + isJsonSchemaNode(properties) && + Object.keys(properties).length > 0 && + !("additionalProperties" in node) + ) { + node.additionalProperties = false; + } + + const alternativesKey = "anyOf" in node ? "anyOf" : "oneOf"; + const alternatives = node[alternativesKey]; + if ( + !isJsonSchemaNode(properties) || + !Array.isArray(alternatives) || + !alternatives.every( + (alternative) => isJsonSchemaNode(alternative) && alternative.type === "object", + ) + ) { + return node; + } + const { + properties: _shared, + required, + type: _type, + additionalProperties: _closed, + ...rest + } = node; + const sharedRequired = Array.isArray(required) ? required : []; + return { + ...rest, + [alternativesKey]: alternatives.map((alternative) => { + const branch = alternative as JsonSchemaNode; + const branchProperties = isJsonSchemaNode(branch.properties) ? branch.properties : {}; + const branchRequired = Array.isArray(branch.required) ? branch.required : []; + return { + ...branch, + properties: { ...properties, ...branchProperties }, + required: [...new Set([...sharedRequired, ...branchRequired])], + }; + }), + }; +} + // Codex 0.153 adds async questions to agent messages. Keep older protocol // fields until the next full refresh, including every thread history namespace. function addAsyncQuestionFields(value: Schema.Json): Schema.Json { @@ -649,7 +732,7 @@ function rewriteExternalRefs( const definitionName = child.slice("#/definitions/".length); const localRewrite = localDefinitionNames.get(definitionName); if (localRewrite) { - return [key, `#/definitions/${localRewrite}`]; + return [key, `#/components/schemas/${localRewrite}`]; } const candidates = [ @@ -670,7 +753,7 @@ function rewriteExternalRefs( throw new Error(`Missing rewritten definition for ref: ${child}`); } - return [key, `#/definitions/${rewritten}`]; + return [key, `#/components/schemas/${rewritten}`]; } return [ @@ -761,7 +844,7 @@ const generateFiles = Effect.fn("generateFiles")(function* () { for (const [name, schema] of Object.entries(aggregateSchemas).toSorted(([left], [right]) => left.localeCompare(right), )) { - aggregateSchemas[name] = addAsyncQuestionFields(schema); + aggregateSchemas[name] = adaptSchemaForEffect(addAsyncQuestionFields(schema)); generator.addSchema(name, aggregateSchemas[name] as never); } diff --git a/packages/effect-codex-app-server/src/_generated/schema.gen.ts b/packages/effect-codex-app-server/src/_generated/schema.gen.ts index f4b186147705..1c33e03ed2aa 100644 --- a/packages/effect-codex-app-server/src/_generated/schema.gen.ts +++ b/packages/effect-codex-app-server/src/_generated/schema.gen.ts @@ -3,6 +3,11 @@ import * as Schema from "effect/Schema"; +export type ApplyPatchApprovalParams__ThreadId = string; +export const ApplyPatchApprovalParams__ThreadId = Schema.String.annotate({ + identifier: "ApplyPatchApprovalParams__ThreadId", +}); + export type ApplyPatchApprovalParams__FileChange = | { readonly content: string; readonly type: "add" } | { readonly content: string; readonly type: "delete" } @@ -24,143 +29,80 @@ export const ApplyPatchApprovalParams__FileChange = Schema.Union( }).annotate({ title: "UpdateFileChange" }), ], { mode: "oneOf" }, -); - -export type ApplyPatchApprovalParams__ThreadId = string; -export const ApplyPatchApprovalParams__ThreadId = Schema.String; +).annotate({ identifier: "ApplyPatchApprovalParams__FileChange" }); export type ApplyPatchApprovalResponse__NetworkPolicyRuleAction = "allow" | "deny"; export const ApplyPatchApprovalResponse__NetworkPolicyRuleAction = Schema.Literals([ "allow", "deny", -]); +]).annotate({ identifier: "ApplyPatchApprovalResponse__NetworkPolicyRuleAction" }); export type ChatgptAuthTokensRefreshParams__ChatgptAuthTokensRefreshReason = "unauthorized"; -export const ChatgptAuthTokensRefreshParams__ChatgptAuthTokensRefreshReason = - Schema.Literal("unauthorized"); - -export type ClientRequest__AbsolutePathBuf = string; -export const ClientRequest__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type ClientRequest__AddCreditsNudgeCreditType = "credits" | "usage_limit"; -export const ClientRequest__AddCreditsNudgeCreditType = Schema.Literals(["credits", "usage_limit"]); - -export type ClientRequest__AdditionalContextKind = "untrusted" | "application"; -export const ClientRequest__AdditionalContextKind = Schema.Literals(["untrusted", "application"]); - -export type ClientRequest__AgentMessageInputContent = - | { readonly text: string; readonly type: "input_text" } - | { readonly encrypted_content: string; readonly type: "encrypted_content" }; -export const ClientRequest__AgentMessageInputContent = Schema.Union( +export const ChatgptAuthTokensRefreshParams__ChatgptAuthTokensRefreshReason = Schema.Union( [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("input_text").annotate({ - title: "InputTextAgentMessageInputContentType", - }), - }).annotate({ title: "InputTextAgentMessageInputContent" }), - Schema.Struct({ - encrypted_content: Schema.String, - type: Schema.Literal("encrypted_content").annotate({ - title: "EncryptedContentAgentMessageInputContentType", - }), - }).annotate({ title: "EncryptedContentAgentMessageInputContent" }), + Schema.Literal("unauthorized").annotate({ + description: "Codex attempted a backend request and received `401 Unauthorized`.", + }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ChatgptAuthTokensRefreshParams__ChatgptAuthTokensRefreshReason" }); -export type ClientRequest__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; -export const ClientRequest__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", -}); +export type ClientRequest__RequestId = string | number; +export const ClientRequest__RequestId = Schema.Union([ + Schema.String, + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +]).annotate({ identifier: "ClientRequest__RequestId" }); -export type ClientRequest__AppsInstalledParams = { - readonly forceRefresh?: boolean; - readonly threadId?: string | null; +export type ClientRequest__InitializeCapabilities = { + readonly experimentalApi?: boolean; + readonly mcpServerOpenaiFormElicitation?: boolean; + readonly optOutNotificationMethods?: ReadonlyArray | null; + readonly requestAttestation?: boolean; }; -export const ClientRequest__AppsInstalledParams = Schema.Struct({ - forceRefresh: Schema.optionalKey( +export const ClientRequest__InitializeCapabilities = Schema.Struct({ + experimentalApi: Schema.optionalKey( Schema.Boolean.annotate({ - description: - "When true and Apps are permitted, refresh and publish the hosted connector runtime tool snapshot first.", + description: "Opt into receiving experimental API methods and fields.", + default: false, }), ), - threadId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional loaded thread id used to evaluate effective app configuration.", - }), - Schema.Null, - ]), - ), -}).annotate({ description: "Read the committed installed connector runtime snapshot." }); - -export type ClientRequest__AppsListParams = { - readonly cursor?: string | null; - readonly forceRefetch?: boolean; - readonly limit?: number | null; - readonly threadId?: string | null; -}; -export const ClientRequest__AppsListParams = Schema.Struct({ - cursor: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Opaque pagination cursor returned by a previous call.", - }), - Schema.Null, - ]), - ), - forceRefetch: Schema.optionalKey( + mcpServerOpenaiFormElicitation: Schema.optionalKey( Schema.Boolean.annotate({ - description: "When true, bypass app caches and fetch the latest data from sources.", + description: "Allow downstream MCP servers to request OpenAI extended form elicitations.", }), ), - limit: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Optional page size; defaults to a reasonable server-side value.", - format: "uint32", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - threadId: Schema.optionalKey( + optOutNotificationMethods: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ + Schema.Array(Schema.String).annotate({ description: - "Optional thread id used to evaluate app feature gating from that thread's config.", + "Exact notification method names that should be suppressed for this connection (for example `thread/started`).", }), Schema.Null, ]), ), -}).annotate({ description: "EXPERIMENTAL - list available apps/connectors." }); - -export type ClientRequest__AppsReadParams = { - readonly appIds: ReadonlyArray; - readonly includeTools?: boolean; -}; -export const ClientRequest__AppsReadParams = Schema.Struct({ - appIds: Schema.Array(Schema.String).annotate({ - description: - "App ids to read. The server accepts at most 100 ids and deduplicates repeated ids while preserving their first-request order.", - }), - includeTools: Schema.optionalKey( + requestAttestation: Schema.optionalKey( Schema.Boolean.annotate({ - description: - "When true, include display-only public tool summaries in the returned metadata.", + description: "Opt into `attestation/generate` requests for upstream `x-oai-attestation`.", + default: false, }), ), -}).annotate({ description: "EXPERIMENTAL - read metadata for specific apps/connectors." }); +}).annotate({ + description: "Client-declared capabilities negotiated during initialize.", + identifier: "ClientRequest__InitializeCapabilities", +}); + +export type ClientRequest__ClientInfo = { + readonly name: string; + readonly title?: string | null; + readonly version: string; +}; +export const ClientRequest__ClientInfo = Schema.Struct({ + name: Schema.String, + title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + version: Schema.String, +}).annotate({ identifier: "ClientRequest__ClientInfo" }); export type ClientRequest__AskForApproval = | "untrusted" @@ -189,182 +131,229 @@ export const ClientRequest__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ClientRequest__AskForApproval" }); -export type ClientRequest__CancelLoginAccountParams = { readonly loginId: string }; -export const ClientRequest__CancelLoginAccountParams = Schema.Struct({ loginId: Schema.String }); +export type ClientRequest__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; +export const ClientRequest__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "ClientRequest__ApprovalsReviewer", +}); -export type ClientRequest__ClientInfo = { +export type ClientRequest__Personality = "none" | "friendly" | "pragmatic"; +export const ClientRequest__Personality = Schema.Literals([ + "none", + "friendly", + "pragmatic", +]).annotate({ identifier: "ClientRequest__Personality" }); + +export type ClientRequest__SandboxMode = "read-only" | "workspace-write" | "danger-full-access"; +export const ClientRequest__SandboxMode = Schema.Literals([ + "read-only", + "workspace-write", + "danger-full-access", +]).annotate({ identifier: "ClientRequest__SandboxMode" }); + +export type ClientRequest__ThreadStartSource = "startup" | "clear"; +export const ClientRequest__ThreadStartSource = Schema.Literals(["startup", "clear"]).annotate({ + identifier: "ClientRequest__ThreadStartSource", +}); + +export type ClientRequest__ThreadSource = string; +export const ClientRequest__ThreadSource = Schema.String.annotate({ + identifier: "ClientRequest__ThreadSource", +}); + +export type ClientRequest__ThreadArchiveParams = { readonly threadId: string }; +export const ClientRequest__ThreadArchiveParams = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadArchiveParams" }); + +export type ClientRequest__ThreadDeleteParams = { readonly threadId: string }; +export const ClientRequest__ThreadDeleteParams = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadDeleteParams" }); + +export type ClientRequest__ThreadUnsubscribeParams = { readonly threadId: string }; +export const ClientRequest__ThreadUnsubscribeParams = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadUnsubscribeParams" }); + +export type ClientRequest__ThreadSetNameParams = { readonly name: string; - readonly title?: string | null; - readonly version: string; + readonly threadId: string; }; -export const ClientRequest__ClientInfo = Schema.Struct({ +export const ClientRequest__ThreadSetNameParams = Schema.Struct({ name: Schema.String, - title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - version: Schema.String, -}); + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadSetNameParams" }); -export type ClientRequest__CommandExecResizeParams = { - readonly processId: string; - readonly size: { readonly cols: number; readonly rows: number }; -}; -export const ClientRequest__CommandExecResizeParams = Schema.Struct({ - processId: Schema.String.annotate({ - description: - "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", - }), - size: Schema.Struct({ - cols: Schema.Number.annotate({ - description: "Terminal width in character cells.", - format: "uint16", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - rows: Schema.Number.annotate({ - description: "Terminal height in character cells.", - format: "uint16", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ description: "PTY size in character cells for `command/exec` PTY sessions." }), -}).annotate({ description: "Resize a running PTY-backed `command/exec` session." }); +export type ClientRequest__ThreadGoalStatus = + | "active" + | "paused" + | "blocked" + | "usageLimited" + | "budgetLimited" + | "complete"; +export const ClientRequest__ThreadGoalStatus = Schema.Literals([ + "active", + "paused", + "blocked", + "usageLimited", + "budgetLimited", + "complete", +]).annotate({ identifier: "ClientRequest__ThreadGoalStatus" }); -export type ClientRequest__CommandExecTerminalSize = { - readonly cols: number; - readonly rows: number; -}; -export const ClientRequest__CommandExecTerminalSize = Schema.Struct({ - cols: Schema.Number.annotate({ - description: "Terminal width in character cells.", - format: "uint16", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - rows: Schema.Number.annotate({ - description: "Terminal height in character cells.", - format: "uint16", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}).annotate({ description: "PTY size in character cells for `command/exec` PTY sessions." }); +export type ClientRequest__ThreadGoalGetParams = { readonly threadId: string }; +export const ClientRequest__ThreadGoalGetParams = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadGoalGetParams" }); -export type ClientRequest__CommandExecTerminateParams = { readonly processId: string }; -export const ClientRequest__CommandExecTerminateParams = Schema.Struct({ - processId: Schema.String.annotate({ - description: - "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", - }), -}).annotate({ description: "Terminate a running `command/exec` session." }); +export type ClientRequest__ThreadGoalClearParams = { readonly threadId: string }; +export const ClientRequest__ThreadGoalClearParams = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadGoalClearParams" }); -export type ClientRequest__CommandExecWriteParams = { - readonly closeStdin?: boolean; - readonly deltaBase64?: string | null; - readonly processId: string; +export type ClientRequest__ThreadMetadataGitInfoUpdateParams = { + readonly branch?: string | null; + readonly originUrl?: string | null; + readonly sha?: string | null; }; -export const ClientRequest__CommandExecWriteParams = Schema.Struct({ - closeStdin: Schema.optionalKey( - Schema.Boolean.annotate({ - description: "Close stdin after writing `deltaBase64`, if present.", - }), - ), - deltaBase64: Schema.optionalKey( +export const ClientRequest__ThreadMetadataGitInfoUpdateParams = Schema.Struct({ + branch: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ description: "Optional base64-encoded stdin bytes to write." }), + Schema.String.annotate({ + description: + "Omit to leave the stored branch unchanged, set to `null` to clear it, or provide a non-empty string to replace it.", + }), Schema.Null, ]), ), - processId: Schema.String.annotate({ - description: - "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", - }), -}).annotate({ - description: "Write stdin bytes to a running `command/exec` session, close stdin, or both.", -}); - -export type ClientRequest__CommandMigration = { readonly name: string }; -export const ClientRequest__CommandMigration = Schema.Struct({ name: Schema.String }); - -export type ClientRequest__ConfigReadParams = { - readonly cwd?: string | null; - readonly includeLayers?: boolean; -}; -export const ClientRequest__ConfigReadParams = Schema.Struct({ - cwd: Schema.optionalKey( + originUrl: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: - "Optional working directory to resolve project config layers. If specified, return the effective config as seen from that directory (i.e., including any project layers between `cwd` and the project/repo root).", + "Omit to leave the stored origin URL unchanged, set to `null` to clear it, or provide a non-empty string to replace it.", }), Schema.Null, ]), ), - includeLayers: Schema.optionalKey(Schema.Boolean), -}); - -export type ClientRequest__ConsumeAccountRateLimitResetCreditParams = { - readonly creditId?: string | null; - readonly idempotencyKey: string; -}; -export const ClientRequest__ConsumeAccountRateLimitResetCreditParams = Schema.Struct({ - creditId: Schema.optionalKey( + sha: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: - "Opaque reset-credit identifier to redeem. When omitted, the backend selects the next available credit.", + "Omit to leave the stored commit unchanged, set to `null` to clear it, or provide a non-empty string to replace it.", }), Schema.Null, ]), ), - idempotencyKey: Schema.String.annotate({ +}).annotate({ identifier: "ClientRequest__ThreadMetadataGitInfoUpdateParams" }); + +export type ClientRequest__ThreadUnarchiveParams = { readonly threadId: string }; +export const ClientRequest__ThreadUnarchiveParams = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadUnarchiveParams" }); + +export type ClientRequest__ThreadCompactStartParams = { readonly threadId: string }; +export const ClientRequest__ThreadCompactStartParams = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadCompactStartParams" }); + +export type ClientRequest__ThreadShellCommandParams = { + readonly command: string; + readonly threadId: string; +}; +export const ClientRequest__ThreadShellCommandParams = Schema.Struct({ + command: Schema.String.annotate({ description: - "Identifies one logical reset attempt. A UUID is recommended; reuse the same value when retrying that attempt.", + "Shell command string evaluated by the thread's configured shell. Unlike `command/exec`, this intentionally preserves shell syntax such as pipes, redirects, and quoting. This runs unsandboxed with full access rather than inheriting the thread sandbox policy.", }), -}); - -export type ClientRequest__ConversationTextRole = "user" | "developer" | "assistant"; -export const ClientRequest__ConversationTextRole = Schema.Literals([ - "user", - "developer", - "assistant", -]); + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadShellCommandParams" }); -export type ClientRequest__DynamicToolNamespaceTool = { - readonly deferLoading?: boolean; - readonly description: string; - readonly inputSchema: unknown; - readonly name: string; - readonly type: "function"; +export type ClientRequest__ThreadApproveGuardianDeniedActionParams = { + readonly event: Schema.Json; + readonly threadId: string; }; -export const ClientRequest__DynamicToolNamespaceTool = Schema.Union( - [ - Schema.Struct({ - deferLoading: Schema.optionalKey(Schema.Boolean), - description: Schema.String, - inputSchema: Schema.Unknown, - name: Schema.String, - type: Schema.Literal("function").annotate({ title: "FunctionDynamicToolNamespaceToolType" }), - }).annotate({ title: "FunctionDynamicToolNamespaceTool" }), - ], - { mode: "oneOf" }, -); +export const ClientRequest__ThreadApproveGuardianDeniedActionParams = Schema.Struct({ + event: Schema.Json.annotate({ + expected: "JSON value", + description: "Serialized `codex_protocol::protocol::GuardianAssessmentEvent`.", + }), + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadApproveGuardianDeniedActionParams" }); -export type ClientRequest__ExperimentalFeatureEnablementSetParams = { - readonly enablement: { readonly [x: string]: boolean }; +export type ClientRequest__ThreadRollbackParams = { + readonly numTurns: number; + readonly threadId: string; }; -export const ClientRequest__ExperimentalFeatureEnablementSetParams = Schema.Struct({ - enablement: Schema.Record(Schema.String, Schema.Boolean).annotate({ +export const ClientRequest__ThreadRollbackParams = Schema.Struct({ + numTurns: Schema.Number.annotate({ description: - "Process-wide runtime feature enablement keyed by canonical feature name.\n\nOnly named features are updated. Omitted features are left unchanged. Send an empty map for a no-op.", - }), + "The number of turns to drop from the end of the thread. Must be >= 1.\n\nThis only modifies the thread's history and does not revert local file changes that have been made by the agent. Clients are responsible for reverting these changes.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + threadId: Schema.String, +}).annotate({ + description: "DEPRECATED: `thread/rollback` will be removed soon.", + identifier: "ClientRequest__ThreadRollbackParams", }); -export type ClientRequest__ExperimentalFeatureListParams = { +export type ClientRequest__ThreadListCwdFilter = string | ReadonlyArray; +export const ClientRequest__ThreadListCwdFilter = Schema.Union([ + Schema.String, + Schema.Array(Schema.String), +]).annotate({ identifier: "ClientRequest__ThreadListCwdFilter" }); + +export type ClientRequest__SortDirection = "asc" | "desc"; +export const ClientRequest__SortDirection = Schema.Literals(["asc", "desc"]).annotate({ + identifier: "ClientRequest__SortDirection", +}); + +export type ClientRequest__ThreadSortKey = "created_at" | "updated_at" | "recency_at"; +export const ClientRequest__ThreadSortKey = Schema.Literals([ + "created_at", + "updated_at", + "recency_at", +]).annotate({ identifier: "ClientRequest__ThreadSortKey" }); + +export type ClientRequest__ThreadSourceKind = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "subAgent" + | "subAgentReview" + | "subAgentCompact" + | "subAgentThreadSpawn" + | "subAgentOther" + | "unknown"; +export const ClientRequest__ThreadSourceKind = Schema.Literals([ + "cli", + "vscode", + "exec", + "appServer", + "subAgent", + "subAgentReview", + "subAgentCompact", + "subAgentThreadSpawn", + "subAgentOther", + "unknown", +]).annotate({ identifier: "ClientRequest__ThreadSourceKind" }); + +export type ClientRequest__ThreadLoadedListParams = { readonly cursor?: string | null; readonly limit?: number | null; - readonly threadId?: string | null; }; -export const ClientRequest__ExperimentalFeatureListParams = Schema.Struct({ +export const ClientRequest__ThreadLoadedListParams = Schema.Struct({ cursor: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -376,439 +365,385 @@ export const ClientRequest__ExperimentalFeatureListParams = Schema.Struct({ limit: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ - description: "Optional page size; defaults to a reasonable server-side value.", + description: "Optional page size; defaults to no limit.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - threadId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Optional loaded thread id. Pass this when showing feature state for an existing thread so enablement is computed from that thread's refreshed config, including project-local config for the thread's cwd.", - }), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), -}); +}).annotate({ identifier: "ClientRequest__ThreadLoadedListParams" }); -export type ClientRequest__ExternalAgentConfigDetectParams = { - readonly cwds?: ReadonlyArray | null; - readonly includeHome?: boolean; - readonly migrationSource?: string | null; - readonly source?: string | null; +export type ClientRequest__ThreadReadParams = { + readonly includeTurns?: boolean; + readonly threadId: string; }; -export const ClientRequest__ExternalAgentConfigDetectParams = Schema.Struct({ - cwds: Schema.optionalKey( - Schema.Union([ - Schema.Array(Schema.String).annotate({ - description: "Zero or more working directories to include for repo-scoped detection.", - }), - Schema.Null, - ]), - ), - includeHome: Schema.optionalKey( +export const ClientRequest__ThreadReadParams = Schema.Struct({ + includeTurns: Schema.optionalKey( Schema.Boolean.annotate({ - description: "If true, include detection under the user's home directory.", + description: "When true, include turns and their items from rollout history.", }), ), - migrationSource: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Optional migration-source selector. Missing or unrecognized values use the default source.", - }), - Schema.Null, - ]), - ), - source: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Deprecated field retained for compatibility. This field is ignored; use `migrationSource` to select the migration source.", - }), - Schema.Null, - ]), - ), -}); - -export type ClientRequest__ExternalAgentConfigMigrationItemType = - | "AGENTS_MD" - | "CONFIG" - | "SKILLS" - | "PLUGINS" - | "MCP_SERVER_CONFIG" - | "SUBAGENTS" - | "HOOKS" - | "COMMANDS" - | "MEMORY" - | "SESSIONS"; -export const ClientRequest__ExternalAgentConfigMigrationItemType = Schema.Literals([ - "AGENTS_MD", - "CONFIG", - "SKILLS", - "PLUGINS", - "MCP_SERVER_CONFIG", - "SUBAGENTS", - "HOOKS", - "COMMANDS", - "MEMORY", - "SESSIONS", -]); + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadReadParams" }); -export type ClientRequest__FeedbackUploadParams = { - readonly classification: string; - readonly extraLogFiles?: ReadonlyArray | null; - readonly includeLogs?: boolean; - readonly reason?: string | null; - readonly tags?: { readonly [x: string]: string } | null; - readonly threadId?: string | null; +export type ClientRequest__ThreadInjectItemsParams = { + readonly items: ReadonlyArray; + readonly threadId: string; }; -export const ClientRequest__FeedbackUploadParams = Schema.Struct({ - classification: Schema.String, - extraLogFiles: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - includeLogs: Schema.optionalKey(Schema.Boolean), - reason: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - tags: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.String), Schema.Null]), - ), - threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +export const ClientRequest__ThreadInjectItemsParams = Schema.Struct({ + items: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: "Raw Responses API items to append to the thread's model-visible history.", + }), + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadInjectItemsParams" }); -export type ClientRequest__FsCopyParams = { - readonly destinationPath: string; - readonly recursive?: boolean; - readonly sourcePath: string; +export type ClientRequest__SkillsListParams = { + readonly cwds?: ReadonlyArray; + readonly forceReload?: boolean; }; -export const ClientRequest__FsCopyParams = Schema.Struct({ - destinationPath: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), - recursive: Schema.optionalKey( +export const ClientRequest__SkillsListParams = Schema.Struct({ + cwds: Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + description: "When empty, defaults to the current session working directory.", + }), + ), + forceReload: Schema.optionalKey( Schema.Boolean.annotate({ - description: "Required for directory copies; ignored for file copies.", + description: "When true, bypass the skills cache and re-scan skills from disk.", }), ), - sourcePath: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), -}).annotate({ description: "Copy a file or directory tree on the host filesystem." }); +}).annotate({ identifier: "ClientRequest__SkillsListParams" }); -export type ClientRequest__FsCreateDirectoryParams = { - readonly path: string; - readonly recursive?: boolean | null; -}; -export const ClientRequest__FsCreateDirectoryParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), - recursive: Schema.optionalKey( - Schema.Union([ - Schema.Boolean.annotate({ - description: "Whether parent directories should also be created. Defaults to `true`.", - }), - Schema.Null, - ]), +export type ClientRequest__AbsolutePathBuf = string; +export const ClientRequest__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "ClientRequest__AbsolutePathBuf", +}); + +export type ClientRequest__HooksListParams = { readonly cwds?: ReadonlyArray }; +export const ClientRequest__HooksListParams = Schema.Struct({ + cwds: Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + description: "When empty, defaults to the current session working directory.", + }), ), -}).annotate({ description: "Create a directory on the host filesystem." }); +}).annotate({ identifier: "ClientRequest__HooksListParams" }); -export type ClientRequest__FsGetMetadataParams = { readonly path: string }; -export const ClientRequest__FsGetMetadataParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), -}).annotate({ description: "Request metadata for an absolute path." }); +export type ClientRequest__MarketplaceAddParams = { + readonly refName?: string | null; + readonly source: string; + readonly sparsePaths?: ReadonlyArray | null; +}; +export const ClientRequest__MarketplaceAddParams = Schema.Struct({ + refName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + source: Schema.String, + sparsePaths: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), +}).annotate({ identifier: "ClientRequest__MarketplaceAddParams" }); -export type ClientRequest__FsReadDirectoryParams = { readonly path: string }; -export const ClientRequest__FsReadDirectoryParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), -}).annotate({ description: "List direct child names for a directory." }); +export type ClientRequest__MarketplaceRemoveParams = { readonly marketplaceName: string }; +export const ClientRequest__MarketplaceRemoveParams = Schema.Struct({ + marketplaceName: Schema.String, +}).annotate({ identifier: "ClientRequest__MarketplaceRemoveParams" }); -export type ClientRequest__FsReadFileParams = { readonly path: string }; -export const ClientRequest__FsReadFileParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), -}).annotate({ description: "Read a file from the host filesystem." }); +export type ClientRequest__MarketplaceUpgradeParams = { readonly marketplaceName?: string | null }; +export const ClientRequest__MarketplaceUpgradeParams = Schema.Struct({ + marketplaceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ClientRequest__MarketplaceUpgradeParams" }); -export type ClientRequest__FsRemoveParams = { - readonly force?: boolean | null; - readonly path: string; - readonly recursive?: boolean | null; +export type ClientRequest__PluginListMarketplaceKind = + | "local" + | "vertical" + | "workspace-directory" + | "shared-with-me" + | "created-by-me-remote"; +export const ClientRequest__PluginListMarketplaceKind = Schema.Literals([ + "local", + "vertical", + "workspace-directory", + "shared-with-me", + "created-by-me-remote", +]).annotate({ identifier: "ClientRequest__PluginListMarketplaceKind" }); + +export type ClientRequest__PluginSkillReadParams = { + readonly remoteMarketplaceName: string; + readonly remotePluginId: string; + readonly skillName: string; }; -export const ClientRequest__FsRemoveParams = Schema.Struct({ - force: Schema.optionalKey( - Schema.Union([ - Schema.Boolean.annotate({ - description: "Whether missing paths should be ignored. Defaults to `true`.", - }), - Schema.Null, - ]), - ), - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), - recursive: Schema.optionalKey( - Schema.Union([ - Schema.Boolean.annotate({ - description: "Whether directory removal should recurse. Defaults to `true`.", - }), - Schema.Null, - ]), - ), -}).annotate({ description: "Remove a file or directory tree from the host filesystem." }); +export const ClientRequest__PluginSkillReadParams = Schema.Struct({ + remoteMarketplaceName: Schema.String, + remotePluginId: Schema.String, + skillName: Schema.String, +}).annotate({ identifier: "ClientRequest__PluginSkillReadParams" }); -export type ClientRequest__FsUnwatchParams = { readonly watchId: string }; -export const ClientRequest__FsUnwatchParams = Schema.Struct({ - watchId: Schema.String.annotate({ - description: "Watch identifier previously provided to `fs/watch`.", - }), -}).annotate({ description: "Stop filesystem watch notifications for a prior `fs/watch`." }); +export type ClientRequest__PluginShareDiscoverability = "LISTED" | "UNLISTED" | "PRIVATE"; +export const ClientRequest__PluginShareDiscoverability = Schema.Literals([ + "LISTED", + "UNLISTED", + "PRIVATE", +]).annotate({ identifier: "ClientRequest__PluginShareDiscoverability" }); -export type ClientRequest__FsWatchParams = { readonly path: string; readonly watchId: string }; -export const ClientRequest__FsWatchParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), - watchId: Schema.String.annotate({ - description: "Connection-scoped watch identifier used for `fs/unwatch` and `fs/changed`.", - }), -}).annotate({ description: "Start filesystem watch notifications for an absolute path." }); +export type ClientRequest__PluginSharePrincipalType = "user" | "group" | "workspace"; +export const ClientRequest__PluginSharePrincipalType = Schema.Literals([ + "user", + "group", + "workspace", +]).annotate({ identifier: "ClientRequest__PluginSharePrincipalType" }); -export type ClientRequest__FsWriteFileParams = { - readonly dataBase64: string; - readonly path: string; +export type ClientRequest__PluginShareTargetRole = "reader" | "editor"; +export const ClientRequest__PluginShareTargetRole = Schema.Literals(["reader", "editor"]).annotate({ + identifier: "ClientRequest__PluginShareTargetRole", +}); + +export type ClientRequest__PluginShareUpdateDiscoverability = "UNLISTED" | "PRIVATE" | "LISTED"; +export const ClientRequest__PluginShareUpdateDiscoverability = Schema.Literals([ + "UNLISTED", + "PRIVATE", + "LISTED", +]).annotate({ identifier: "ClientRequest__PluginShareUpdateDiscoverability" }); + +export type ClientRequest__PluginShareListParams = { readonly [x: string]: Schema.Json }; +export const ClientRequest__PluginShareListParams = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ identifier: "ClientRequest__PluginShareListParams" }); + +export type ClientRequest__PluginShareCheckoutParams = { readonly remotePluginId: string }; +export const ClientRequest__PluginShareCheckoutParams = Schema.Struct({ + remotePluginId: Schema.String, +}).annotate({ identifier: "ClientRequest__PluginShareCheckoutParams" }); + +export type ClientRequest__PluginShareDeleteParams = { readonly remotePluginId: string }; +export const ClientRequest__PluginShareDeleteParams = Schema.Struct({ + remotePluginId: Schema.String, +}).annotate({ identifier: "ClientRequest__PluginShareDeleteParams" }); + +export type ClientRequest__AppsReadParams = { + readonly appIds: ReadonlyArray; + readonly includeTools?: boolean; }; -export const ClientRequest__FsWriteFileParams = Schema.Struct({ - dataBase64: Schema.String.annotate({ description: "File contents encoded as base64." }), - path: Schema.String.annotate({ +export const ClientRequest__AppsReadParams = Schema.Struct({ + appIds: Schema.Array(Schema.String).annotate({ description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + "App ids to read. The server accepts at most 100 ids and deduplicates repeated ids while preserving their first-request order.", }), -}).annotate({ description: "Write a file on the host filesystem." }); - -export type ClientRequest__FuzzyFileSearchParams = { - readonly cancellationToken?: string | null; - readonly query: string; - readonly roots: ReadonlyArray; -}; -export const ClientRequest__FuzzyFileSearchParams = Schema.Struct({ - cancellationToken: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.String, - roots: Schema.Array(Schema.String), -}); - -export type ClientRequest__GetAccountParams = { readonly refreshToken?: boolean }; -export const ClientRequest__GetAccountParams = Schema.Struct({ - refreshToken: Schema.optionalKey( + includeTools: Schema.optionalKey( Schema.Boolean.annotate({ description: - "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.", - }), - ), -}); - -export type ClientRequest__HookMigration = { readonly name: string }; -export const ClientRequest__HookMigration = Schema.Struct({ name: Schema.String }); - -export type ClientRequest__HooksListParams = { readonly cwds?: ReadonlyArray }; -export const ClientRequest__HooksListParams = Schema.Struct({ - cwds: Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - description: "When empty, defaults to the current session working directory.", + "When true, include display-only public tool summaries in the returned metadata.", }), ), +}).annotate({ + description: "EXPERIMENTAL - read metadata for specific apps/connectors.", + identifier: "ClientRequest__AppsReadParams", }); -export type ClientRequest__ImageDetail = "auto" | "low" | "high" | "original"; -export const ClientRequest__ImageDetail = Schema.Literals(["auto", "low", "high", "original"]); - -export type ClientRequest__InitializeCapabilities = { - readonly experimentalApi?: boolean; - readonly mcpServerOpenaiFormElicitation?: boolean; - readonly optOutNotificationMethods?: ReadonlyArray | null; - readonly requestAttestation?: boolean; +export type ClientRequest__AppsListParams = { + readonly cursor?: string | null; + readonly forceRefetch?: boolean; + readonly limit?: number | null; + readonly threadId?: string | null; }; -export const ClientRequest__InitializeCapabilities = Schema.Struct({ - experimentalApi: Schema.optionalKey( - Schema.Boolean.annotate({ - description: "Opt into receiving experimental API methods and fields.", - default: false, - }), +export const ClientRequest__AppsListParams = Schema.Struct({ + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque pagination cursor returned by a previous call.", + }), + Schema.Null, + ]), ), - mcpServerOpenaiFormElicitation: Schema.optionalKey( + forceRefetch: Schema.optionalKey( Schema.Boolean.annotate({ - description: "Allow downstream MCP servers to request OpenAI extended form elicitations.", + description: "When true, bypass app caches and fetch the latest data from sources.", }), ), - optOutNotificationMethods: Schema.optionalKey( + limit: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.String).annotate({ + Schema.Number.annotate({ + description: "Optional page size; defaults to a reasonable server-side value.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + threadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: - "Exact notification method names that should be suppressed for this connection (for example `thread/started`).", + "Optional thread id used to evaluate app feature gating from that thread's config.", }), Schema.Null, ]), ), - requestAttestation: Schema.optionalKey( +}).annotate({ + description: "EXPERIMENTAL - list available apps/connectors.", + identifier: "ClientRequest__AppsListParams", +}); + +export type ClientRequest__AppsInstalledParams = { + readonly forceRefresh?: boolean; + readonly threadId?: string | null; +}; +export const ClientRequest__AppsInstalledParams = Schema.Struct({ + forceRefresh: Schema.optionalKey( Schema.Boolean.annotate({ - description: "Opt into `attestation/generate` requests for upstream `x-oai-attestation`.", - default: false, + description: + "When true and Apps are permitted, refresh and publish the hosted connector runtime tool snapshot first.", }), ), -}).annotate({ description: "Client-declared capabilities negotiated during initialize." }); + threadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional loaded thread id used to evaluate effective app configuration.", + }), + Schema.Null, + ]), + ), +}).annotate({ + description: "Read the committed installed connector runtime snapshot.", + identifier: "ClientRequest__AppsInstalledParams", +}); -export type ClientRequest__InternalChatMessageMetadataPassthrough = { - readonly turn_id?: string | null; -}; -export const ClientRequest__InternalChatMessageMetadataPassthrough = Schema.Struct({ - turn_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +export type ClientRequest__FsUnwatchParams = { readonly watchId: string }; +export const ClientRequest__FsUnwatchParams = Schema.Struct({ + watchId: Schema.String.annotate({ + description: "Watch identifier previously provided to `fs/watch`.", + }), }).annotate({ - description: - "Internal Responses API passthrough metadata copied into underlying chat messages.\n\nResponses API strongly types this payload. Do not modify it without first getting API approval and making the corresponding Responses API change.", + description: "Stop filesystem watch notifications for a prior `fs/watch`.", + identifier: "ClientRequest__FsUnwatchParams", }); -export type ClientRequest__LegacyAppPathString = string; -export const ClientRequest__LegacyAppPathString = Schema.String; +export type ClientRequest__PluginUninstallParams = { readonly pluginId: string }; +export const ClientRequest__PluginUninstallParams = Schema.Struct({ + pluginId: Schema.String, +}).annotate({ identifier: "ClientRequest__PluginUninstallParams" }); -export type ClientRequest__LocalShellAction = { - readonly command: ReadonlyArray; - readonly env?: { readonly [x: string]: string } | null; - readonly timeout_ms?: number | null; - readonly type: "exec"; - readonly user?: string | null; - readonly working_directory?: string | null; -}; -export const ClientRequest__LocalShellAction = Schema.Union( - [ - Schema.Struct({ - command: Schema.Array(Schema.String), - env: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.String), Schema.Null]), - ), - timeout_ms: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - type: Schema.Literal("exec").annotate({ title: "ExecLocalShellActionType" }), - user: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - working_directory: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - }).annotate({ title: "ExecLocalShellAction" }), - ], - { mode: "oneOf" }, +export type ClientRequest__ReasoningEffort = string; +export const ClientRequest__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "ClientRequest__ReasoningEffort", + }), ); -export type ClientRequest__LocalShellStatus = "completed" | "in_progress" | "incomplete"; -export const ClientRequest__LocalShellStatus = Schema.Literals([ - "completed", - "in_progress", - "incomplete", -]); - -export type ClientRequest__LoginAppBrand = "codex" | "chatgpt"; -export const ClientRequest__LoginAppBrand = Schema.Literals(["codex", "chatgpt"]); - -export type ClientRequest__MarketplaceAddParams = { - readonly refName?: string | null; - readonly source: string; - readonly sparsePaths?: ReadonlyArray | null; -}; -export const ClientRequest__MarketplaceAddParams = Schema.Struct({ - refName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - source: Schema.String, - sparsePaths: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), -}); - -export type ClientRequest__MarketplaceRemoveParams = { readonly marketplaceName: string }; -export const ClientRequest__MarketplaceRemoveParams = Schema.Struct({ - marketplaceName: Schema.String, -}); +export type ClientRequest__ByteRange = { readonly end: number; readonly start: number }; +export const ClientRequest__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "ClientRequest__ByteRange" }); -export type ClientRequest__MarketplaceUpgradeParams = { readonly marketplaceName?: string | null }; -export const ClientRequest__MarketplaceUpgradeParams = Schema.Struct({ - marketplaceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +export type ClientRequest__ImageDetail = "auto" | "low" | "high" | "original"; +export const ClientRequest__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "ClientRequest__ImageDetail" }); -export type ClientRequest__McpResourceReadParams = { - readonly server: string; - readonly threadId?: string | null; - readonly uri: string; -}; -export const ClientRequest__McpResourceReadParams = Schema.Struct({ - server: Schema.String, - threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - uri: Schema.String, +export type ClientRequest__NetworkAccess = "restricted" | "enabled"; +export const ClientRequest__NetworkAccess = Schema.Literals(["restricted", "enabled"]).annotate({ + identifier: "ClientRequest__NetworkAccess", }); -export type ClientRequest__McpServerMigration = { readonly name: string }; -export const ClientRequest__McpServerMigration = Schema.Struct({ name: Schema.String }); - -export type ClientRequest__McpServerOauthLoginParams = { - readonly name: string; - readonly scopes?: ReadonlyArray | null; - readonly threadId?: string | null; - readonly timeoutSecs?: number | null; -}; -export const ClientRequest__McpServerOauthLoginParams = Schema.Struct({ - name: Schema.String, - scopes: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - timeoutSecs: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), +export type ClientRequest__ReasoningSummary = "auto" | "concise" | "detailed" | "none"; +export const ClientRequest__ReasoningSummary = Schema.Union( + [ + Schema.Literals(["auto", "concise", "detailed"]), + Schema.Literal("none").annotate({ description: "Option to disable reasoning summaries." }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries", + identifier: "ClientRequest__ReasoningSummary", }); -export type ClientRequest__McpServerStatusDetail = "full" | "toolsAndAuthOnly"; -export const ClientRequest__McpServerStatusDetail = Schema.Literals(["full", "toolsAndAuthOnly"]); - -export type ClientRequest__McpServerToolCallParams = { - readonly _meta?: unknown; - readonly arguments?: unknown; - readonly server: string; +export type ClientRequest__TurnInterruptParams = { readonly threadId: string; - readonly tool: string; + readonly turnId: string; }; -export const ClientRequest__McpServerToolCallParams = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - arguments: Schema.optionalKey(Schema.Unknown), - server: Schema.String, +export const ClientRequest__TurnInterruptParams = Schema.Struct({ threadId: Schema.String, - tool: Schema.String, -}); - -export type ClientRequest__MergeStrategy = "replace" | "upsert"; -export const ClientRequest__MergeStrategy = Schema.Literals(["replace", "upsert"]); - -export type ClientRequest__MessagePhase = "commentary" | "final_answer"; -export const ClientRequest__MessagePhase = Schema.Literals(["commentary", "final_answer"]).annotate( - { - description: - 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', - }, -); + turnId: Schema.String, +}).annotate({ identifier: "ClientRequest__TurnInterruptParams" }); -export type ClientRequest__ModeKind = "plan" | "default"; -export const ClientRequest__ModeKind = Schema.Literals(["plan", "default"]).annotate({ - description: "Initial collaboration mode to use when the TUI starts.", +export type ClientRequest__ReviewDelivery = "inline" | "detached"; +export const ClientRequest__ReviewDelivery = Schema.Literals(["inline", "detached"]).annotate({ + identifier: "ClientRequest__ReviewDelivery", }); +export type ClientRequest__ReviewTarget = + | { readonly type: "uncommittedChanges" } + | { readonly branch: string; readonly type: "baseBranch" } + | { readonly sha: string; readonly title?: string | null; readonly type: "commit" } + | { readonly instructions: string; readonly type: "custom" }; +export const ClientRequest__ReviewTarget = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("uncommittedChanges").annotate({ + title: "UncommittedChangesReviewTargetType", + }), + }).annotate({ + title: "UncommittedChangesReviewTarget", + description: "Review the working tree: staged, unstaged, and untracked files.", + }), + Schema.Struct({ + branch: Schema.String, + type: Schema.Literal("baseBranch").annotate({ title: "BaseBranchReviewTargetType" }), + }).annotate({ + title: "BaseBranchReviewTarget", + description: "Review changes between the current branch and the given base branch.", + }), + Schema.Struct({ + sha: Schema.String, + title: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable label (e.g., commit subject) for UIs.", + }), + Schema.Null, + ]), + ), + type: Schema.Literal("commit").annotate({ title: "CommitReviewTargetType" }), + }).annotate({ + title: "CommitReviewTarget", + description: "Review the changes introduced by a specific commit.", + }), + Schema.Struct({ + instructions: Schema.String, + type: Schema.Literal("custom").annotate({ title: "CustomReviewTargetType" }), + }).annotate({ + title: "CustomReviewTarget", + description: "Arbitrary instructions, equivalent to the old free-form prompt.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ClientRequest__ReviewTarget" }); + export type ClientRequest__ModelListParams = { readonly cursor?: string | null; readonly includeHidden?: boolean | null; @@ -837,15 +772,64 @@ export const ClientRequest__ModelListParams = Schema.Struct({ description: "Optional page size; defaults to a reasonable server-side value.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), -}); +}).annotate({ identifier: "ClientRequest__ModelListParams" }); + +export type ClientRequest__ModelProviderCapabilitiesReadParams = { + readonly [x: string]: Schema.Json; +}; +export const ClientRequest__ModelProviderCapabilitiesReadParams = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ identifier: "ClientRequest__ModelProviderCapabilitiesReadParams" }); -export type ClientRequest__ModelProviderCapabilitiesReadParams = {}; -export const ClientRequest__ModelProviderCapabilitiesReadParams = Schema.Struct({}); +export type ClientRequest__ExperimentalFeatureListParams = { + readonly cursor?: string | null; + readonly limit?: number | null; + readonly threadId?: string | null; +}; +export const ClientRequest__ExperimentalFeatureListParams = Schema.Struct({ + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque pagination cursor returned by a previous call.", + }), + Schema.Null, + ]), + ), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Optional page size; defaults to a reasonable server-side value.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + threadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional loaded thread id. Pass this when showing feature state for an existing thread so enablement is computed from that thread's refreshed config, including project-local config for the thread's cwd.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__ExperimentalFeatureListParams" }); export type ClientRequest__PermissionProfileListParams = { readonly cursor?: string | null; @@ -875,80 +859,274 @@ export const ClientRequest__PermissionProfileListParams = Schema.Struct({ description: "Optional page size; defaults to the full result set.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), -}); +}).annotate({ identifier: "ClientRequest__PermissionProfileListParams" }); -export type ClientRequest__Personality = "none" | "friendly" | "pragmatic"; -export const ClientRequest__Personality = Schema.Literals(["none", "friendly", "pragmatic"]); +export type ClientRequest__ExperimentalFeatureEnablementSetParams = { + readonly enablement: { readonly [x: string]: boolean }; +}; +export const ClientRequest__ExperimentalFeatureEnablementSetParams = Schema.Struct({ + enablement: Schema.Record(Schema.String, Schema.Boolean).annotate({ + description: + "Process-wide runtime feature enablement keyed by canonical feature name.\n\nOnly named features are updated. Omitted features are left unchanged. Send an empty map for a no-op.", + }), +}).annotate({ identifier: "ClientRequest__ExperimentalFeatureEnablementSetParams" }); -export type ClientRequest__PluginListMarketplaceKind = - | "local" - | "vertical" - | "workspace-directory" - | "shared-with-me" - | "created-by-me-remote"; -export const ClientRequest__PluginListMarketplaceKind = Schema.Literals([ - "local", - "vertical", - "workspace-directory", - "shared-with-me", - "created-by-me-remote", -]); +export type ClientRequest__McpServerOauthLoginParams = { + readonly name: string; + readonly scopes?: ReadonlyArray | null; + readonly threadId?: string | null; + readonly timeoutSecs?: number | null; +}; +export const ClientRequest__McpServerOauthLoginParams = Schema.Struct({ + name: Schema.String, + scopes: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + timeoutSecs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__McpServerOauthLoginParams" }); -export type ClientRequest__PluginShareCheckoutParams = { readonly remotePluginId: string }; -export const ClientRequest__PluginShareCheckoutParams = Schema.Struct({ - remotePluginId: Schema.String, -}); +export type ClientRequest__McpServerStatusDetail = "full" | "toolsAndAuthOnly"; +export const ClientRequest__McpServerStatusDetail = Schema.Literals([ + "full", + "toolsAndAuthOnly", +]).annotate({ identifier: "ClientRequest__McpServerStatusDetail" }); -export type ClientRequest__PluginShareDeleteParams = { readonly remotePluginId: string }; -export const ClientRequest__PluginShareDeleteParams = Schema.Struct({ - remotePluginId: Schema.String, +export type ClientRequest__McpResourceReadParams = { + readonly server: string; + readonly threadId?: string | null; + readonly uri: string; +}; +export const ClientRequest__McpResourceReadParams = Schema.Struct({ + server: Schema.String, + threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + uri: Schema.String, +}).annotate({ identifier: "ClientRequest__McpResourceReadParams" }); + +export type ClientRequest__McpServerToolCallParams = { + readonly _meta?: Schema.Json; + readonly arguments?: Schema.Json; + readonly server: string; + readonly threadId: string; + readonly tool: string; +}; +export const ClientRequest__McpServerToolCallParams = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + arguments: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + server: Schema.String, + threadId: Schema.String, + tool: Schema.String, +}).annotate({ identifier: "ClientRequest__McpServerToolCallParams" }); + +export type ClientRequest__WindowsSandboxSetupMode = "elevated" | "unelevated"; +export const ClientRequest__WindowsSandboxSetupMode = Schema.Literals([ + "elevated", + "unelevated", +]).annotate({ identifier: "ClientRequest__WindowsSandboxSetupMode" }); + +export type ClientRequest__LoginAppBrand = "codex" | "chatgpt"; +export const ClientRequest__LoginAppBrand = Schema.Literals(["codex", "chatgpt"]).annotate({ + identifier: "ClientRequest__LoginAppBrand", }); -export type ClientRequest__PluginShareDiscoverability = "LISTED" | "UNLISTED" | "PRIVATE"; -export const ClientRequest__PluginShareDiscoverability = Schema.Literals([ - "LISTED", - "UNLISTED", - "PRIVATE", -]); +export type ClientRequest__CancelLoginAccountParams = { readonly loginId: string }; +export const ClientRequest__CancelLoginAccountParams = Schema.Struct({ + loginId: Schema.String, +}).annotate({ identifier: "ClientRequest__CancelLoginAccountParams" }); -export type ClientRequest__PluginShareListParams = {}; -export const ClientRequest__PluginShareListParams = Schema.Struct({}); +export type ClientRequest__ConsumeAccountRateLimitResetCreditParams = { + readonly creditId?: string | null; + readonly idempotencyKey: string; +}; +export const ClientRequest__ConsumeAccountRateLimitResetCreditParams = Schema.Struct({ + creditId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Opaque reset-credit identifier to redeem. When omitted, the backend selects the next available credit.", + }), + Schema.Null, + ]), + ), + idempotencyKey: Schema.String.annotate({ + description: + "Identifies one logical reset attempt. A UUID is recommended; reuse the same value when retrying that attempt.", + }), +}).annotate({ identifier: "ClientRequest__ConsumeAccountRateLimitResetCreditParams" }); -export type ClientRequest__PluginSharePrincipalType = "user" | "group" | "workspace"; -export const ClientRequest__PluginSharePrincipalType = Schema.Literals([ - "user", - "group", - "workspace", -]); +export type ClientRequest__AddCreditsNudgeCreditType = "credits" | "usage_limit"; +export const ClientRequest__AddCreditsNudgeCreditType = Schema.Literals([ + "credits", + "usage_limit", +]).annotate({ identifier: "ClientRequest__AddCreditsNudgeCreditType" }); -export type ClientRequest__PluginShareTargetRole = "reader" | "editor"; -export const ClientRequest__PluginShareTargetRole = Schema.Literals(["reader", "editor"]); +export type ClientRequest__FeedbackUploadParams = { + readonly classification: string; + readonly extraLogFiles?: ReadonlyArray | null; + readonly includeLogs?: boolean; + readonly reason?: string | null; + readonly tags?: { readonly [x: string]: string } | null; + readonly threadId?: string | null; +}; +export const ClientRequest__FeedbackUploadParams = Schema.Struct({ + classification: Schema.String, + extraLogFiles: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + includeLogs: Schema.optionalKey(Schema.Boolean), + reason: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + tags: Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.String), Schema.Null]), + ), + threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ClientRequest__FeedbackUploadParams" }); -export type ClientRequest__PluginShareUpdateDiscoverability = "UNLISTED" | "PRIVATE" | "LISTED"; -export const ClientRequest__PluginShareUpdateDiscoverability = Schema.Literals([ - "UNLISTED", - "PRIVATE", - "LISTED", -]); +export type ClientRequest__CommandExecTerminalSize = { + readonly cols: number; + readonly rows: number; +}; +export const ClientRequest__CommandExecTerminalSize = Schema.Struct({ + cols: Schema.Number.annotate({ + description: "Terminal width in character cells.", + format: "uint16", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + rows: Schema.Number.annotate({ + description: "Terminal height in character cells.", + format: "uint16", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ + description: "PTY size in character cells for `command/exec` PTY sessions.", + identifier: "ClientRequest__CommandExecTerminalSize", +}); -export type ClientRequest__PluginSkillReadParams = { - readonly remoteMarketplaceName: string; - readonly remotePluginId: string; - readonly skillName: string; +export type ClientRequest__CommandExecWriteParams = { + readonly closeStdin?: boolean; + readonly deltaBase64?: string | null; + readonly processId: string; }; -export const ClientRequest__PluginSkillReadParams = Schema.Struct({ - remoteMarketplaceName: Schema.String, - remotePluginId: Schema.String, - skillName: Schema.String, +export const ClientRequest__CommandExecWriteParams = Schema.Struct({ + closeStdin: Schema.optionalKey( + Schema.Boolean.annotate({ + description: "Close stdin after writing `deltaBase64`, if present.", + }), + ), + deltaBase64: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Optional base64-encoded stdin bytes to write." }), + Schema.Null, + ]), + ), + processId: Schema.String.annotate({ + description: + "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", + }), +}).annotate({ + description: "Write stdin bytes to a running `command/exec` session, close stdin, or both.", + identifier: "ClientRequest__CommandExecWriteParams", }); -export type ClientRequest__PluginUninstallParams = { readonly pluginId: string }; -export const ClientRequest__PluginUninstallParams = Schema.Struct({ pluginId: Schema.String }); +export type ClientRequest__CommandExecTerminateParams = { readonly processId: string }; +export const ClientRequest__CommandExecTerminateParams = Schema.Struct({ + processId: Schema.String.annotate({ + description: + "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", + }), +}).annotate({ + description: "Terminate a running `command/exec` session.", + identifier: "ClientRequest__CommandExecTerminateParams", +}); + +export type ClientRequest__ConfigReadParams = { + readonly cwd?: string | null; + readonly includeLayers?: boolean; +}; +export const ClientRequest__ConfigReadParams = Schema.Struct({ + cwd: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional working directory to resolve project config layers. If specified, return the effective config as seen from that directory (i.e., including any project layers between `cwd` and the project/repo root).", + }), + Schema.Null, + ]), + ), + includeLayers: Schema.optionalKey(Schema.Boolean), +}).annotate({ identifier: "ClientRequest__ConfigReadParams" }); + +export type ClientRequest__ExternalAgentConfigDetectParams = { + readonly cwds?: ReadonlyArray | null; + readonly includeHome?: boolean; + readonly migrationSource?: string | null; + readonly source?: string | null; +}; +export const ClientRequest__ExternalAgentConfigDetectParams = Schema.Struct({ + cwds: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: "Zero or more working directories to include for repo-scoped detection.", + }), + Schema.Null, + ]), + ), + includeHome: Schema.optionalKey( + Schema.Boolean.annotate({ + description: "If true, include detection under the user's home directory.", + }), + ), + migrationSource: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional migration-source selector. Missing or unrecognized values use the default source.", + }), + Schema.Null, + ]), + ), + source: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Deprecated field retained for compatibility. This field is ignored; use `migrationSource` to select the migration source.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__ExternalAgentConfigDetectParams" }); + +export type ClientRequest__CommandMigration = { readonly name: string }; +export const ClientRequest__CommandMigration = Schema.Struct({ name: Schema.String }).annotate({ + identifier: "ClientRequest__CommandMigration", +}); + +export type ClientRequest__HookMigration = { readonly name: string }; +export const ClientRequest__HookMigration = Schema.Struct({ name: Schema.String }).annotate({ + identifier: "ClientRequest__HookMigration", +}); + +export type ClientRequest__McpServerMigration = { readonly name: string }; +export const ClientRequest__McpServerMigration = Schema.Struct({ name: Schema.String }).annotate({ + identifier: "ClientRequest__McpServerMigration", +}); export type ClientRequest__PluginsMigration = { readonly marketplaceName: string; @@ -957,12 +1135,160 @@ export type ClientRequest__PluginsMigration = { export const ClientRequest__PluginsMigration = Schema.Struct({ marketplaceName: Schema.String, pluginNames: Schema.Array(Schema.String), +}).annotate({ identifier: "ClientRequest__PluginsMigration" }); + +export type ClientRequest__SessionMigration = { + readonly cwd: string; + readonly path: string; + readonly title?: string | null; +}; +export const ClientRequest__SessionMigration = Schema.Struct({ + cwd: Schema.String, + path: Schema.String, + title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ClientRequest__SessionMigration" }); + +export type ClientRequest__SkillMigration = { readonly name: string }; +export const ClientRequest__SkillMigration = Schema.Struct({ name: Schema.String }).annotate({ + identifier: "ClientRequest__SkillMigration", }); -export type ClientRequest__ReasoningEffort = string; -export const ClientRequest__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +export type ClientRequest__SubagentMigration = { readonly name: string }; +export const ClientRequest__SubagentMigration = Schema.Struct({ name: Schema.String }).annotate({ + identifier: "ClientRequest__SubagentMigration", +}); + +export type ClientRequest__ExternalAgentConfigMigrationItemType = + | "AGENTS_MD" + | "CONFIG" + | "SKILLS" + | "PLUGINS" + | "MCP_SERVER_CONFIG" + | "SUBAGENTS" + | "HOOKS" + | "COMMANDS" + | "MEMORY" + | "SESSIONS"; +export const ClientRequest__ExternalAgentConfigMigrationItemType = Schema.Literals([ + "AGENTS_MD", + "CONFIG", + "SKILLS", + "PLUGINS", + "MCP_SERVER_CONFIG", + "SUBAGENTS", + "HOOKS", + "COMMANDS", + "MEMORY", + "SESSIONS", +]).annotate({ identifier: "ClientRequest__ExternalAgentConfigMigrationItemType" }); + +export type ClientRequest__MergeStrategy = "replace" | "upsert"; +export const ClientRequest__MergeStrategy = Schema.Literals(["replace", "upsert"]).annotate({ + identifier: "ClientRequest__MergeStrategy", +}); + +export type ClientRequest__GetAccountParams = { readonly refreshToken?: boolean }; +export const ClientRequest__GetAccountParams = Schema.Struct({ + refreshToken: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.", + }), + ), +}).annotate({ identifier: "ClientRequest__GetAccountParams" }); + +export type ClientRequest__FuzzyFileSearchParams = { + readonly cancellationToken?: string | null; + readonly query: string; + readonly roots: ReadonlyArray; +}; +export const ClientRequest__FuzzyFileSearchParams = Schema.Struct({ + cancellationToken: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.String, + roots: Schema.Array(Schema.String), +}).annotate({ identifier: "ClientRequest__FuzzyFileSearchParams" }); + +export type ClientRequest__AdditionalContextKind = "untrusted" | "application"; +export const ClientRequest__AdditionalContextKind = Schema.Literals([ + "untrusted", + "application", +]).annotate({ identifier: "ClientRequest__AdditionalContextKind" }); + +export type ClientRequest__ModeKind = "plan" | "default"; +export const ClientRequest__ModeKind = Schema.Literals(["plan", "default"]).annotate({ + description: "Initial collaboration mode to use when the TUI starts.", + identifier: "ClientRequest__ModeKind", +}); + +export type ClientRequest__DynamicToolNamespaceTool = { + readonly deferLoading?: boolean; + readonly description: string; + readonly inputSchema: Schema.Json; + readonly name: string; + readonly type: "function"; +}; +export const ClientRequest__DynamicToolNamespaceTool = Schema.Union( + [ + Schema.Struct({ + deferLoading: Schema.optionalKey(Schema.Boolean), + description: Schema.String, + inputSchema: Schema.Json.annotate({ expected: "JSON value" }), + name: Schema.String, + type: Schema.Literal("function").annotate({ title: "FunctionDynamicToolNamespaceToolType" }), + }).annotate({ title: "FunctionDynamicToolNamespaceTool" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ClientRequest__DynamicToolNamespaceTool" }); + +export type ClientRequest__InternalChatMessageMetadataPassthrough = { + readonly turn_id?: string | null; +}; +export const ClientRequest__InternalChatMessageMetadataPassthrough = Schema.Struct({ + turn_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: + "Internal Responses API passthrough metadata copied into underlying chat messages.\n\nResponses API strongly types this payload. Do not modify it without first getting API approval and making the corresponding Responses API change.", + identifier: "ClientRequest__InternalChatMessageMetadataPassthrough", +}); + +export type ClientRequest__MessagePhase = "commentary" | "final_answer"; +export const ClientRequest__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "ClientRequest__MessagePhase", +}); + +export type ClientRequest__AgentMessageInputContent = + | { readonly text: string; readonly type: "input_text" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const ClientRequest__AgentMessageInputContent = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextAgentMessageInputContentType", + }), + }).annotate({ title: "InputTextAgentMessageInputContent" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentAgentMessageInputContentType", + }), + }).annotate({ title: "EncryptedContentAgentMessageInputContent" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ClientRequest__AgentMessageInputContent" }); export type ClientRequest__ReasoningItemContent = | { readonly text: string; readonly type: "reasoning_text" } @@ -981,7 +1307,7 @@ export const ClientRequest__ReasoningItemContent = Schema.Union( }).annotate({ title: "TextReasoningItemContent" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ClientRequest__ReasoningItemContent" }); export type ClientRequest__ReasoningItemReasoningSummary = { readonly text: string; @@ -997,25 +1323,49 @@ export const ClientRequest__ReasoningItemReasoningSummary = Schema.Union( }).annotate({ title: "SummaryTextReasoningItemReasoningSummary" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ClientRequest__ReasoningItemReasoningSummary" }); -export type ClientRequest__ReasoningSummary = "auto" | "concise" | "detailed" | "none"; -export const ClientRequest__ReasoningSummary = Schema.Union( +export type ClientRequest__LocalShellAction = { + readonly command: ReadonlyArray; + readonly env?: { readonly [x: string]: string } | null; + readonly timeout_ms?: number | null; + readonly type: "exec"; + readonly user?: string | null; + readonly working_directory?: string | null; +}; +export const ClientRequest__LocalShellAction = Schema.Union( [ - Schema.Literals(["auto", "concise", "detailed"]), - Schema.Literal("none").annotate({ description: "Option to disable reasoning summaries." }), + Schema.Struct({ + command: Schema.Array(Schema.String), + env: Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.String), Schema.Null]), + ), + timeout_ms: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("exec").annotate({ title: "ExecLocalShellActionType" }), + user: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + working_directory: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "ExecLocalShellAction" }), ], { mode: "oneOf" }, -).annotate({ - description: - "A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries", -}); +).annotate({ identifier: "ClientRequest__LocalShellAction" }); -export type ClientRequest__RequestId = string | number; -export const ClientRequest__RequestId = Schema.Union([ - Schema.String, - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -]); +export type ClientRequest__LocalShellStatus = "completed" | "in_progress" | "incomplete"; +export const ClientRequest__LocalShellStatus = Schema.Literals([ + "completed", + "in_progress", + "incomplete", +]).annotate({ identifier: "ClientRequest__LocalShellStatus" }); export type ClientRequest__ResponsesApiWebSearchAction = | { @@ -1055,377 +1405,74 @@ export const ClientRequest__ResponsesApiWebSearchAction = Schema.Union( }).annotate({ title: "OtherResponsesApiWebSearchAction" }), ], { mode: "oneOf" }, -); - -export type ClientRequest__ReviewDelivery = "inline" | "detached"; -export const ClientRequest__ReviewDelivery = Schema.Literals(["inline", "detached"]); +).annotate({ identifier: "ClientRequest__ResponsesApiWebSearchAction" }); -export type ClientRequest__ReviewTarget = - | { readonly type: "uncommittedChanges" } - | { readonly branch: string; readonly type: "baseBranch" } - | { readonly sha: string; readonly title?: string | null; readonly type: "commit" } - | { readonly instructions: string; readonly type: "custom" }; -export const ClientRequest__ReviewTarget = Schema.Union( +export type ClientRequest__CapabilityRootLocation = { + readonly environmentId: string; + readonly path: string; + readonly type: "environment"; +}; +export const ClientRequest__CapabilityRootLocation = Schema.Union( [ Schema.Struct({ - type: Schema.Literal("uncommittedChanges").annotate({ - title: "UncommittedChangesReviewTargetType", + environmentId: Schema.String, + path: Schema.String.annotate({ + description: "Absolute path for the root in the selected environment.", + }), + type: Schema.Literal("environment").annotate({ + title: "EnvironmentCapabilityRootLocationType", }), }).annotate({ - title: "UncommittedChangesReviewTarget", - description: "Review the working tree: staged, unstaged, and untracked files.", + title: "EnvironmentCapabilityRootLocation", + description: "A path owned by an execution environment.", }), - Schema.Struct({ - branch: Schema.String, - type: Schema.Literal("baseBranch").annotate({ title: "BaseBranchReviewTargetType" }), - }).annotate({ - title: "BaseBranchReviewTarget", - description: "Review changes between the current branch and the given base branch.", + ], + { mode: "oneOf" }, +).annotate({ + description: "Location used to resolve a selected capability root.", + identifier: "ClientRequest__CapabilityRootLocation", +}); + +export type ClientRequest__ConversationTextRole = "user" | "developer" | "assistant"; +export const ClientRequest__ConversationTextRole = Schema.Literals([ + "user", + "developer", + "assistant", +]).annotate({ identifier: "ClientRequest__ConversationTextRole" }); + +export type ClientRequest__TurnItemsView = "notLoaded" | "summary" | "full"; +export const ClientRequest__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", }), - Schema.Struct({ - sha: Schema.String, - title: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable label (e.g., commit subject) for UIs.", - }), - Schema.Null, - ]), - ), - type: Schema.Literal("commit").annotate({ title: "CommitReviewTargetType" }), - }).annotate({ - title: "CommitReviewTarget", - description: "Review the changes introduced by a specific commit.", + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", }), - Schema.Struct({ - instructions: Schema.String, - type: Schema.Literal("custom").annotate({ title: "CustomReviewTargetType" }), - }).annotate({ - title: "CustomReviewTarget", - description: "Arbitrary instructions, equivalent to the old free-form prompt.", + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", }), ], { mode: "oneOf" }, -); - -export type ClientRequest__SandboxMode = "read-only" | "workspace-write" | "danger-full-access"; -export const ClientRequest__SandboxMode = Schema.Literals([ - "read-only", - "workspace-write", - "danger-full-access", -]); +).annotate({ identifier: "ClientRequest__TurnItemsView" }); -export type ClientRequest__SessionMigration = { - readonly cwd: string; - readonly path: string; - readonly title?: string | null; -}; -export const ClientRequest__SessionMigration = Schema.Struct({ - cwd: Schema.String, - path: Schema.String, - title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +export type ClientRequest__LegacyAppPathString = string; +export const ClientRequest__LegacyAppPathString = Schema.String.annotate({ + identifier: "ClientRequest__LegacyAppPathString", }); -export type ClientRequest__SkillMigration = { readonly name: string }; -export const ClientRequest__SkillMigration = Schema.Struct({ name: Schema.String }); - -export type ClientRequest__SkillsListParams = { - readonly cwds?: ReadonlyArray; - readonly forceReload?: boolean; -}; -export const ClientRequest__SkillsListParams = Schema.Struct({ - cwds: Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - description: "When empty, defaults to the current session working directory.", - }), - ), - forceReload: Schema.optionalKey( - Schema.Boolean.annotate({ - description: "When true, bypass the skills cache and re-scan skills from disk.", - }), - ), +export type CommandExecutionRequestApprovalParams__AbsolutePathBuf = string; +export const CommandExecutionRequestApprovalParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "CommandExecutionRequestApprovalParams__AbsolutePathBuf", }); -export type ClientRequest__SortDirection = "asc" | "desc"; -export const ClientRequest__SortDirection = Schema.Literals(["asc", "desc"]); - -export type ClientRequest__SubagentMigration = { readonly name: string }; -export const ClientRequest__SubagentMigration = Schema.Struct({ name: Schema.String }); - -export type ClientRequest__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const ClientRequest__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type ClientRequest__ThreadApproveGuardianDeniedActionParams = { - readonly event: unknown; - readonly threadId: string; -}; -export const ClientRequest__ThreadApproveGuardianDeniedActionParams = Schema.Struct({ - event: Schema.Unknown.annotate({ - description: "Serialized `codex_protocol::protocol::GuardianAssessmentEvent`.", - }), - threadId: Schema.String, -}); - -export type ClientRequest__ThreadArchiveParams = { readonly threadId: string }; -export const ClientRequest__ThreadArchiveParams = Schema.Struct({ threadId: Schema.String }); - -export type ClientRequest__ThreadCompactStartParams = { readonly threadId: string }; -export const ClientRequest__ThreadCompactStartParams = Schema.Struct({ threadId: Schema.String }); - -export type ClientRequest__ThreadDeleteParams = { readonly threadId: string }; -export const ClientRequest__ThreadDeleteParams = Schema.Struct({ threadId: Schema.String }); - -export type ClientRequest__ThreadGoalClearParams = { readonly threadId: string }; -export const ClientRequest__ThreadGoalClearParams = Schema.Struct({ threadId: Schema.String }); - -export type ClientRequest__ThreadGoalGetParams = { readonly threadId: string }; -export const ClientRequest__ThreadGoalGetParams = Schema.Struct({ threadId: Schema.String }); - -export type ClientRequest__ThreadGoalStatus = - | "active" - | "paused" - | "blocked" - | "usageLimited" - | "budgetLimited" - | "complete"; -export const ClientRequest__ThreadGoalStatus = Schema.Literals([ - "active", - "paused", - "blocked", - "usageLimited", - "budgetLimited", - "complete", -]); - -export type ClientRequest__ThreadInjectItemsParams = { - readonly items: ReadonlyArray; - readonly threadId: string; -}; -export const ClientRequest__ThreadInjectItemsParams = Schema.Struct({ - items: Schema.Array(Schema.Unknown).annotate({ - description: "Raw Responses API items to append to the thread's model-visible history.", - }), - threadId: Schema.String, -}); - -export type ClientRequest__ThreadListCwdFilter = string | ReadonlyArray; -export const ClientRequest__ThreadListCwdFilter = Schema.Union([ - Schema.String, - Schema.Array(Schema.String), -]); - -export type ClientRequest__ThreadLoadedListParams = { - readonly cursor?: string | null; - readonly limit?: number | null; -}; -export const ClientRequest__ThreadLoadedListParams = Schema.Struct({ - cursor: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Opaque pagination cursor returned by a previous call.", - }), - Schema.Null, - ]), - ), - limit: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Optional page size; defaults to no limit.", - format: "uint32", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), -}); - -export type ClientRequest__ThreadMetadataGitInfoUpdateParams = { - readonly branch?: string | null; - readonly originUrl?: string | null; - readonly sha?: string | null; -}; -export const ClientRequest__ThreadMetadataGitInfoUpdateParams = Schema.Struct({ - branch: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Omit to leave the stored branch unchanged, set to `null` to clear it, or provide a non-empty string to replace it.", - }), - Schema.Null, - ]), - ), - originUrl: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Omit to leave the stored origin URL unchanged, set to `null` to clear it, or provide a non-empty string to replace it.", - }), - Schema.Null, - ]), - ), - sha: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Omit to leave the stored commit unchanged, set to `null` to clear it, or provide a non-empty string to replace it.", - }), - Schema.Null, - ]), - ), -}); - -export type ClientRequest__ThreadReadParams = { - readonly includeTurns?: boolean; - readonly threadId: string; -}; -export const ClientRequest__ThreadReadParams = Schema.Struct({ - includeTurns: Schema.optionalKey( - Schema.Boolean.annotate({ - description: "When true, include turns and their items from rollout history.", - }), - ), - threadId: Schema.String, -}); - -export type ClientRequest__ThreadRollbackParams = { - readonly numTurns: number; - readonly threadId: string; -}; -export const ClientRequest__ThreadRollbackParams = Schema.Struct({ - numTurns: Schema.Number.annotate({ - description: - "The number of turns to drop from the end of the thread. Must be >= 1.\n\nThis only modifies the thread's history and does not revert local file changes that have been made by the agent. Clients are responsible for reverting these changes.", - format: "uint32", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - threadId: Schema.String, -}).annotate({ description: "DEPRECATED: `thread/rollback` will be removed soon." }); - -export type ClientRequest__ThreadSetNameParams = { - readonly name: string; - readonly threadId: string; -}; -export const ClientRequest__ThreadSetNameParams = Schema.Struct({ - name: Schema.String, - threadId: Schema.String, -}); - -export type ClientRequest__ThreadShellCommandParams = { - readonly command: string; - readonly threadId: string; -}; -export const ClientRequest__ThreadShellCommandParams = Schema.Struct({ - command: Schema.String.annotate({ - description: - "Shell command string evaluated by the thread's configured shell. Unlike `command/exec`, this intentionally preserves shell syntax such as pipes, redirects, and quoting. This runs unsandboxed with full access rather than inheriting the thread sandbox policy.", - }), - threadId: Schema.String, -}); - -export type ClientRequest__ThreadSortKey = "created_at" | "updated_at" | "recency_at"; -export const ClientRequest__ThreadSortKey = Schema.Literals([ - "created_at", - "updated_at", - "recency_at", -]); - -export type ClientRequest__ThreadSource = string; -export const ClientRequest__ThreadSource = Schema.String; - -export type ClientRequest__ThreadSourceKind = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "subAgent" - | "subAgentReview" - | "subAgentCompact" - | "subAgentThreadSpawn" - | "subAgentOther" - | "unknown"; -export const ClientRequest__ThreadSourceKind = Schema.Literals([ - "cli", - "vscode", - "exec", - "appServer", - "subAgent", - "subAgentReview", - "subAgentCompact", - "subAgentThreadSpawn", - "subAgentOther", - "unknown", -]); - -export type ClientRequest__ThreadStartSource = "startup" | "clear"; -export const ClientRequest__ThreadStartSource = Schema.Literals(["startup", "clear"]); - -export type ClientRequest__ThreadUnarchiveParams = { readonly threadId: string }; -export const ClientRequest__ThreadUnarchiveParams = Schema.Struct({ threadId: Schema.String }); - -export type ClientRequest__ThreadUnsubscribeParams = { readonly threadId: string }; -export const ClientRequest__ThreadUnsubscribeParams = Schema.Struct({ threadId: Schema.String }); - -export type ClientRequest__TurnInterruptParams = { - readonly threadId: string; - readonly turnId: string; -}; -export const ClientRequest__TurnInterruptParams = Schema.Struct({ - threadId: Schema.String, - turnId: Schema.String, -}); - -export type ClientRequest__TurnItemsView = "notLoaded" | "summary" | "full"; -export const ClientRequest__TurnItemsView = Schema.Literals(["notLoaded", "summary", "full"]); - -export type ClientRequest__WindowsSandboxSetupMode = "elevated" | "unelevated"; -export const ClientRequest__WindowsSandboxSetupMode = Schema.Literals(["elevated", "unelevated"]); - -export type CommandExecutionRequestApprovalParams__AbsolutePathBuf = string; -export const CommandExecutionRequestApprovalParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type CommandExecutionRequestApprovalParams__AdditionalNetworkPermissions = { - readonly enabled?: boolean | null; -}; -export const CommandExecutionRequestApprovalParams__AdditionalNetworkPermissions = Schema.Struct({ - enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), -}); - -export type CommandExecutionRequestApprovalParams__FileSystemAccessMode = "read" | "write" | "deny"; -export const CommandExecutionRequestApprovalParams__FileSystemAccessMode = Schema.Literals([ - "read", - "write", - "deny", -]); - export type CommandExecutionRequestApprovalParams__LegacyAppPathString = string; -export const CommandExecutionRequestApprovalParams__LegacyAppPathString = Schema.String; +export const CommandExecutionRequestApprovalParams__LegacyAppPathString = Schema.String.annotate({ + identifier: "CommandExecutionRequestApprovalParams__LegacyAppPathString", +}); export type CommandExecutionRequestApprovalParams__NetworkApprovalProtocol = | "http" @@ -1437,19 +1484,33 @@ export const CommandExecutionRequestApprovalParams__NetworkApprovalProtocol = Sc "https", "socks5Tcp", "socks5Udp", -]); +]).annotate({ identifier: "CommandExecutionRequestApprovalParams__NetworkApprovalProtocol" }); export type CommandExecutionRequestApprovalParams__NetworkPolicyRuleAction = "allow" | "deny"; export const CommandExecutionRequestApprovalParams__NetworkPolicyRuleAction = Schema.Literals([ "allow", "deny", -]); +]).annotate({ identifier: "CommandExecutionRequestApprovalParams__NetworkPolicyRuleAction" }); + +export type CommandExecutionRequestApprovalParams__FileSystemAccessMode = "read" | "write" | "deny"; +export const CommandExecutionRequestApprovalParams__FileSystemAccessMode = Schema.Literals([ + "read", + "write", + "deny", +]).annotate({ identifier: "CommandExecutionRequestApprovalParams__FileSystemAccessMode" }); + +export type CommandExecutionRequestApprovalParams__AdditionalNetworkPermissions = { + readonly enabled?: boolean | null; +}; +export const CommandExecutionRequestApprovalParams__AdditionalNetworkPermissions = Schema.Struct({ + enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), +}).annotate({ identifier: "CommandExecutionRequestApprovalParams__AdditionalNetworkPermissions" }); export type CommandExecutionRequestApprovalResponse__NetworkPolicyRuleAction = "allow" | "deny"; export const CommandExecutionRequestApprovalResponse__NetworkPolicyRuleAction = Schema.Literals([ "allow", "deny", -]); +]).annotate({ identifier: "CommandExecutionRequestApprovalResponse__NetworkPolicyRuleAction" }); export type DynamicToolCallResponse__DynamicToolCallOutputContentItem = | { readonly text: string; readonly type: "inputText" } @@ -1477,7 +1538,12 @@ export const DynamicToolCallResponse__DynamicToolCallOutputContentItem = Schema. }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "DynamicToolCallResponse__DynamicToolCallOutputContentItem" }); + +export type ExecCommandApprovalParams__ThreadId = string; +export const ExecCommandApprovalParams__ThreadId = Schema.String.annotate({ + identifier: "ExecCommandApprovalParams__ThreadId", +}); export type ExecCommandApprovalParams__ParsedCommand = | { readonly cmd: string; readonly name: string; readonly path: string; readonly type: "read" } @@ -1517,34 +1583,41 @@ export const ExecCommandApprovalParams__ParsedCommand = Schema.Union( }).annotate({ title: "UnknownParsedCommand" }), ], { mode: "oneOf" }, -); - -export type ExecCommandApprovalParams__ThreadId = string; -export const ExecCommandApprovalParams__ThreadId = Schema.String; +).annotate({ identifier: "ExecCommandApprovalParams__ParsedCommand" }); export type ExecCommandApprovalResponse__NetworkPolicyRuleAction = "allow" | "deny"; export const ExecCommandApprovalResponse__NetworkPolicyRuleAction = Schema.Literals([ "allow", "deny", -]); +]).annotate({ identifier: "ExecCommandApprovalResponse__NetworkPolicyRuleAction" }); export type FileChangeRequestApprovalResponse__FileChangeApprovalDecision = | "accept" | "acceptForSession" | "decline" | "cancel"; -export const FileChangeRequestApprovalResponse__FileChangeApprovalDecision = Schema.Literals([ - "accept", - "acceptForSession", - "decline", - "cancel", -]); +export const FileChangeRequestApprovalResponse__FileChangeApprovalDecision = Schema.Union( + [ + Schema.Literal("accept").annotate({ description: "User approved the file changes." }), + Schema.Literal("acceptForSession").annotate({ + description: + "User approved the file changes and future changes to the same files should run without prompting.", + }), + Schema.Literal("decline").annotate({ + description: "User denied the file changes. The agent will continue the turn.", + }), + Schema.Literal("cancel").annotate({ + description: "User denied the file changes. The turn will also be immediately interrupted.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "FileChangeRequestApprovalResponse__FileChangeApprovalDecision" }); export type FuzzyFileSearchResponse__FuzzyFileSearchMatchType = "file" | "directory"; export const FuzzyFileSearchResponse__FuzzyFileSearchMatchType = Schema.Literals([ "file", "directory", -]); +]).annotate({ identifier: "FuzzyFileSearchResponse__FuzzyFileSearchMatchType" }); export type FuzzyFileSearchSessionUpdatedNotification__FuzzyFileSearchMatchType = | "file" @@ -1552,50 +1625,36 @@ export type FuzzyFileSearchSessionUpdatedNotification__FuzzyFileSearchMatchType export const FuzzyFileSearchSessionUpdatedNotification__FuzzyFileSearchMatchType = Schema.Literals([ "file", "directory", -]); +]).annotate({ identifier: "FuzzyFileSearchSessionUpdatedNotification__FuzzyFileSearchMatchType" }); export type JSONRPCError__JSONRPCErrorError = { readonly code: number; - readonly data?: unknown; + readonly data?: Schema.Json; readonly message: string; }; export const JSONRPCError__JSONRPCErrorError = Schema.Struct({ - code: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - data: Schema.optionalKey(Schema.Unknown), + code: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + data: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), message: Schema.String, -}); +}).annotate({ identifier: "JSONRPCError__JSONRPCErrorError" }); export type JSONRPCError__RequestId = string | number; export const JSONRPCError__RequestId = Schema.Union([ Schema.String, - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -]); - -export type JSONRPCMessage__JSONRPCErrorError = { - readonly code: number; - readonly data?: unknown; - readonly message: string; -}; -export const JSONRPCMessage__JSONRPCErrorError = Schema.Struct({ - code: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - data: Schema.optionalKey(Schema.Unknown), - message: Schema.String, -}); - -export type JSONRPCMessage__JSONRPCNotification = { - readonly method: string; - readonly params?: unknown; -}; -export const JSONRPCMessage__JSONRPCNotification = Schema.Struct({ - method: Schema.String, - params: Schema.optionalKey(Schema.Unknown), -}).annotate({ description: "A notification which does not expect a response." }); + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +]).annotate({ identifier: "JSONRPCError__RequestId" }); export type JSONRPCMessage__RequestId = string | number; export const JSONRPCMessage__RequestId = Schema.Union([ Schema.String, - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -]); + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +]).annotate({ identifier: "JSONRPCMessage__RequestId" }); export type JSONRPCMessage__W3cTraceContext = { readonly traceparent?: string | null; @@ -1604,13 +1663,40 @@ export type JSONRPCMessage__W3cTraceContext = { export const JSONRPCMessage__W3cTraceContext = Schema.Struct({ traceparent: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), tracestate: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "JSONRPCMessage__W3cTraceContext" }); + +export type JSONRPCMessage__JSONRPCNotification = { + readonly method: string; + readonly params?: Schema.Json; +}; +export const JSONRPCMessage__JSONRPCNotification = Schema.Struct({ + method: Schema.String, + params: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ + description: "A notification which does not expect a response.", + identifier: "JSONRPCMessage__JSONRPCNotification", }); +export type JSONRPCMessage__JSONRPCErrorError = { + readonly code: number; + readonly data?: Schema.Json; + readonly message: string; +}; +export const JSONRPCMessage__JSONRPCErrorError = Schema.Struct({ + code: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + data: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + message: Schema.String, +}).annotate({ identifier: "JSONRPCMessage__JSONRPCErrorError" }); + export type JSONRPCRequest__RequestId = string | number; export const JSONRPCRequest__RequestId = Schema.Union([ Schema.String, - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -]); + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +]).annotate({ identifier: "JSONRPCRequest__RequestId" }); export type JSONRPCRequest__W3cTraceContext = { readonly traceparent?: string | null; @@ -1619,20 +1705,20 @@ export type JSONRPCRequest__W3cTraceContext = { export const JSONRPCRequest__W3cTraceContext = Schema.Struct({ traceparent: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), tracestate: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "JSONRPCRequest__W3cTraceContext" }); export type JSONRPCResponse__RequestId = string | number; export const JSONRPCResponse__RequestId = Schema.Union([ Schema.String, - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -]); - -export type McpServerElicitationRequestParams__McpElicitationArrayType = "array"; -export const McpServerElicitationRequestParams__McpElicitationArrayType = Schema.Literal("array"); + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +]).annotate({ identifier: "JSONRPCResponse__RequestId" }); -export type McpServerElicitationRequestParams__McpElicitationBooleanType = "boolean"; -export const McpServerElicitationRequestParams__McpElicitationBooleanType = - Schema.Literal("boolean"); +export type McpServerElicitationRequestParams__McpElicitationStringType = "string"; +export const McpServerElicitationRequestParams__McpElicitationStringType = Schema.Literal( + "string", +).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationStringType" }); export type McpServerElicitationRequestParams__McpElicitationConstOption = { readonly const: string; @@ -1641,16 +1727,12 @@ export type McpServerElicitationRequestParams__McpElicitationConstOption = { export const McpServerElicitationRequestParams__McpElicitationConstOption = Schema.Struct({ const: Schema.String, title: Schema.String, -}); - -export type McpServerElicitationRequestParams__McpElicitationNumberType = "number" | "integer"; -export const McpServerElicitationRequestParams__McpElicitationNumberType = Schema.Literals([ - "number", - "integer", -]); +}).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationConstOption" }); -export type McpServerElicitationRequestParams__McpElicitationObjectType = "object"; -export const McpServerElicitationRequestParams__McpElicitationObjectType = Schema.Literal("object"); +export type McpServerElicitationRequestParams__McpElicitationArrayType = "array"; +export const McpServerElicitationRequestParams__McpElicitationArrayType = Schema.Literal( + "array", +).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationArrayType" }); export type McpServerElicitationRequestParams__McpElicitationStringFormat = | "email" @@ -1662,10 +1744,23 @@ export const McpServerElicitationRequestParams__McpElicitationStringFormat = Sch "uri", "date", "date-time", -]); +]).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationStringFormat" }); -export type McpServerElicitationRequestParams__McpElicitationStringType = "string"; -export const McpServerElicitationRequestParams__McpElicitationStringType = Schema.Literal("string"); +export type McpServerElicitationRequestParams__McpElicitationNumberType = "number" | "integer"; +export const McpServerElicitationRequestParams__McpElicitationNumberType = Schema.Literals([ + "number", + "integer", +]).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationNumberType" }); + +export type McpServerElicitationRequestParams__McpElicitationBooleanType = "boolean"; +export const McpServerElicitationRequestParams__McpElicitationBooleanType = Schema.Literal( + "boolean", +).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationBooleanType" }); + +export type McpServerElicitationRequestParams__McpElicitationObjectType = "object"; +export const McpServerElicitationRequestParams__McpElicitationObjectType = Schema.Literal( + "object", +).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationObjectType" }); export type McpServerElicitationRequestResponse__McpServerElicitationAction = | "accept" @@ -1675,19 +1770,13 @@ export const McpServerElicitationRequestResponse__McpServerElicitationAction = S "accept", "decline", "cancel", -]); +]).annotate({ identifier: "McpServerElicitationRequestResponse__McpServerElicitationAction" }); export type PermissionsRequestApprovalParams__AbsolutePathBuf = string; export const PermissionsRequestApprovalParams__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type PermissionsRequestApprovalParams__AdditionalNetworkPermissions = { - readonly enabled?: boolean | null; -}; -export const PermissionsRequestApprovalParams__AdditionalNetworkPermissions = Schema.Struct({ - enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + identifier: "PermissionsRequestApprovalParams__AbsolutePathBuf", }); export type PermissionsRequestApprovalParams__FileSystemAccessMode = "read" | "write" | "deny"; @@ -1695,283 +1784,258 @@ export const PermissionsRequestApprovalParams__FileSystemAccessMode = Schema.Lit "read", "write", "deny", -]); +]).annotate({ identifier: "PermissionsRequestApprovalParams__FileSystemAccessMode" }); export type PermissionsRequestApprovalParams__LegacyAppPathString = string; -export const PermissionsRequestApprovalParams__LegacyAppPathString = Schema.String; +export const PermissionsRequestApprovalParams__LegacyAppPathString = Schema.String.annotate({ + identifier: "PermissionsRequestApprovalParams__LegacyAppPathString", +}); -export type PermissionsRequestApprovalResponse__AdditionalNetworkPermissions = { +export type PermissionsRequestApprovalParams__AdditionalNetworkPermissions = { readonly enabled?: boolean | null; }; -export const PermissionsRequestApprovalResponse__AdditionalNetworkPermissions = Schema.Struct({ +export const PermissionsRequestApprovalParams__AdditionalNetworkPermissions = Schema.Struct({ enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), -}); +}).annotate({ identifier: "PermissionsRequestApprovalParams__AdditionalNetworkPermissions" }); export type PermissionsRequestApprovalResponse__FileSystemAccessMode = "read" | "write" | "deny"; export const PermissionsRequestApprovalResponse__FileSystemAccessMode = Schema.Literals([ "read", "write", "deny", -]); +]).annotate({ identifier: "PermissionsRequestApprovalResponse__FileSystemAccessMode" }); export type PermissionsRequestApprovalResponse__LegacyAppPathString = string; -export const PermissionsRequestApprovalResponse__LegacyAppPathString = Schema.String; +export const PermissionsRequestApprovalResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "PermissionsRequestApprovalResponse__LegacyAppPathString", +}); + +export type PermissionsRequestApprovalResponse__AdditionalNetworkPermissions = { + readonly enabled?: boolean | null; +}; +export const PermissionsRequestApprovalResponse__AdditionalNetworkPermissions = Schema.Struct({ + enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), +}).annotate({ identifier: "PermissionsRequestApprovalResponse__AdditionalNetworkPermissions" }); + +export type PermissionsRequestApprovalResponse__PermissionGrantScope = "turn" | "session"; +export const PermissionsRequestApprovalResponse__PermissionGrantScope = Schema.Literals([ + "turn", + "session", +]).annotate({ identifier: "PermissionsRequestApprovalResponse__PermissionGrantScope" }); + +export type ServerNotification__NonSteerableTurnKind = "review" | "compact"; +export const ServerNotification__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "ServerNotification__NonSteerableTurnKind" }); export type ServerNotification__AbsolutePathBuf = string; export const ServerNotification__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "ServerNotification__AbsolutePathBuf", }); -export type ServerNotification__AccountLoginCompletedNotification = { - readonly error?: string | null; - readonly loginId?: string | null; - readonly success: boolean; +export type ServerNotification__GitInfo = { + readonly branch?: string | null; + readonly originUrl?: string | null; + readonly sha?: string | null; }; -export const ServerNotification__AccountLoginCompletedNotification = Schema.Struct({ - error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - loginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - success: Schema.Boolean, -}); +export const ServerNotification__GitInfo = Schema.Struct({ + branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__GitInfo" }); -export type ServerNotification__ActivePermissionProfile = { - readonly extends?: string | null; - readonly id: string; -}; -export const ServerNotification__ActivePermissionProfile = Schema.Struct({ - extends: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Parent profile identifier from the selected permissions profile's `extends` setting, when present.", - }), - Schema.Null, - ]), - ), - id: Schema.String.annotate({ - description: - "Identifier from `default_permissions` or the implicit built-in default, such as `:workspace` or a user-defined `[permissions.]` profile.", - }), +export type ServerNotification__AgentPath = string; +export const ServerNotification__AgentPath = Schema.String.annotate({ + identifier: "ServerNotification__AgentPath", }); -export type ServerNotification__AdditionalNetworkPermissions = { - readonly enabled?: boolean | null; -}; -export const ServerNotification__AdditionalNetworkPermissions = Schema.Struct({ - enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), +export type ServerNotification__ThreadId = string; +export const ServerNotification__ThreadId = Schema.String.annotate({ + identifier: "ServerNotification__ThreadId", }); -export type ServerNotification__AgentMessageDeltaNotification = { - readonly delta: string; - readonly itemId: string; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerNotification__AgentMessageDeltaNotification = Schema.Struct({ - delta: Schema.String, - itemId: Schema.String, - threadId: Schema.String, - turnId: Schema.String, +export type ServerNotification__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; +export const ServerNotification__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "ServerNotification__ThreadActiveFlag" }); + +export type ServerNotification__ThreadSource = string; +export const ServerNotification__ThreadSource = Schema.String.annotate({ + identifier: "ServerNotification__ThreadSource", }); -export type ServerNotification__AgentPath = string; -export const ServerNotification__AgentPath = Schema.String; +export type ServerNotification__ByteRange = { readonly end: number; readonly start: number }; +export const ServerNotification__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "ServerNotification__ByteRange" }); -export type ServerNotification__AppBranding = { - readonly category?: string | null; - readonly developer?: string | null; - readonly isDiscoverableApp: boolean; - readonly privacyPolicy?: string | null; - readonly termsOfService?: string | null; - readonly website?: string | null; -}; -export const ServerNotification__AppBranding = Schema.Struct({ - category: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - developer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - isDiscoverableApp: Schema.Boolean, - privacyPolicy: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - termsOfService: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - website: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ description: "EXPERIMENTAL - app metadata returned by app-list APIs." }); +export type ServerNotification__ImageDetail = "auto" | "low" | "high" | "original"; +export const ServerNotification__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "ServerNotification__ImageDetail" }); -export type ServerNotification__AppReview = { readonly status: string }; -export const ServerNotification__AppReview = Schema.Struct({ status: Schema.String }); +export type ServerNotification__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; +}; +export const ServerNotification__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "ServerNotification__HookPromptFragment" }); -export type ServerNotification__AppScreenshot = { - readonly fileId?: string | null; - readonly url?: string | null; - readonly userPrompt: string; +export type ServerNotification__MemoryCitationEntry = { + readonly lineEnd: number; + readonly lineStart: number; + readonly note: string; + readonly path: string; }; -export const ServerNotification__AppScreenshot = Schema.Struct({ - fileId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - userPrompt: Schema.String, -}); +export const ServerNotification__MemoryCitationEntry = Schema.Struct({ + lineEnd: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + lineStart: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + note: Schema.String, + path: Schema.String, +}).annotate({ identifier: "ServerNotification__MemoryCitationEntry" }); -export type ServerNotification__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; -export const ServerNotification__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ +export type ServerNotification__MessagePhase = "commentary" | "final_answer"; +export const ServerNotification__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "ServerNotification__MessagePhase", }); -export type ServerNotification__AskForApproval = - | "untrusted" - | "on-request" - | "never" - | { - readonly granular: { - readonly mcp_elicitations: boolean; - readonly request_permissions?: boolean; - readonly rules: boolean; - readonly sandbox_approval: boolean; - readonly skill_approval?: boolean; - }; - }; -export const ServerNotification__AskForApproval = Schema.Union( - [ - Schema.Literals(["untrusted", "on-request", "never"]), - Schema.Struct({ - granular: Schema.Struct({ - mcp_elicitations: Schema.Boolean, - request_permissions: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - rules: Schema.Boolean, - sandbox_approval: Schema.Boolean, - skill_approval: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - }), - }).annotate({ title: "GranularAskForApproval" }), - ], - { mode: "oneOf" }, -); - -export type ServerNotification__AuthMode = - | "apikey" - | "chatgpt" - | "chatgptAuthTokens" - | "headers" - | "agentIdentity" - | "personalAccessToken" - | "bedrockApiKey"; -export const ServerNotification__AuthMode = Schema.Literals([ - "apikey", - "chatgpt", - "chatgptAuthTokens", - "headers", - "agentIdentity", - "personalAccessToken", - "bedrockApiKey", -]).annotate({ description: "Authentication mode for OpenAI-backed providers." }); - -export type ServerNotification__AutoReviewDecisionSource = "agent"; -export const ServerNotification__AutoReviewDecisionSource = Schema.Literal("agent").annotate({ - description: "[UNSTABLE] Source that produced a terminal approval auto-review decision.", +export type ServerNotification__LegacyAppPathString = string; +export const ServerNotification__LegacyAppPathString = Schema.String.annotate({ + identifier: "ServerNotification__LegacyAppPathString", }); -export type ServerNotification__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" +export type ServerNotification__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const ServerNotification__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "ServerNotification__CommandExecutionSource" }); + +export type ServerNotification__CommandExecutionStatus = + | "inProgress" | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const ServerNotification__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", + | "failed" + | "declined"; +export const ServerNotification__CommandExecutionStatus = Schema.Literals([ + "inProgress", "completed", - "errored", - "shutdown", - "notFound", -]); - -export type ServerNotification__CommandExecOutputDeltaNotification = { - readonly capReached: boolean; - readonly deltaBase64: string; - readonly processId: string; - readonly stream: "stdout" | "stderr"; -}; -export const ServerNotification__CommandExecOutputDeltaNotification = Schema.Struct({ - capReached: Schema.Boolean.annotate({ - description: - "`true` on the final streamed chunk for a stream when `outputBytesCap` truncated later output on that stream.", - }), - deltaBase64: Schema.String.annotate({ description: "Base64-encoded output bytes." }), - processId: Schema.String.annotate({ - description: - "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", - }), - stream: Schema.Literals(["stdout", "stderr"]).annotate({ - description: "Stream label for `command/exec/outputDelta` notifications.", - }), -}).annotate({ - description: - "Base64-encoded output chunk emitted for a streaming `command/exec` request.\n\nThese notifications are connection-scoped. If the originating connection closes, the server terminates the process.", -}); + "failed", + "declined", +]).annotate({ identifier: "ServerNotification__CommandExecutionStatus" }); -export type ServerNotification__CommandExecutionOutputDeltaNotification = { - readonly delta: string; - readonly itemId: string; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerNotification__CommandExecutionOutputDeltaNotification = Schema.Struct({ - delta: Schema.String, - itemId: Schema.String, - threadId: Schema.String, - turnId: Schema.String, -}); +export type ServerNotification__PatchChangeKind = + | { readonly type: "add" } + | { readonly type: "delete" } + | { readonly move_path?: string | null; readonly type: "update" }; +export const ServerNotification__PatchChangeKind = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), + }).annotate({ title: "AddPatchChangeKind" }), + Schema.Struct({ + type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), + }).annotate({ title: "DeletePatchChangeKind" }), + Schema.Struct({ + move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), + }).annotate({ title: "UpdatePatchChangeKind" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__PatchChangeKind" }); -export type ServerNotification__CommandExecutionStatus = +export type ServerNotification__PatchApplyStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const ServerNotification__CommandExecutionStatus = Schema.Literals([ +export const ServerNotification__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "ServerNotification__PatchApplyStatus" }); -export type ServerNotification__ContextCompactedNotification = { - readonly threadId: string; - readonly turnId: string; +export type ServerNotification__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; }; -export const ServerNotification__ContextCompactedNotification = Schema.Struct({ - threadId: Schema.String, - turnId: Schema.String, -}).annotate({ description: "Deprecated: Use `ContextCompaction` item type instead." }); +export const ServerNotification__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__McpToolCallAppContext" }); -export type ServerNotification__CreditsSnapshot = { - readonly balance?: string | null; - readonly hasCredits: boolean; - readonly unlimited: boolean; -}; -export const ServerNotification__CreditsSnapshot = Schema.Struct({ - balance: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - hasCredits: Schema.Boolean, - unlimited: Schema.Boolean, -}); +export type ServerNotification__McpToolCallError = { readonly message: string }; +export const ServerNotification__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "ServerNotification__McpToolCallError" }); -export type ServerNotification__DeprecationNoticeNotification = { - readonly details?: string | null; - readonly summary: string; +export type ServerNotification__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; }; -export const ServerNotification__DeprecationNoticeNotification = Schema.Struct({ - details: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional extra guidance, such as migration steps or rationale.", - }), - Schema.Null, - ]), - ), - summary: Schema.String.annotate({ description: "Concise summary of what is deprecated." }), -}); +export const ServerNotification__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "ServerNotification__McpToolCallResult" }); + +export type ServerNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const ServerNotification__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "ServerNotification__McpToolCallStatus" }); export type ServerNotification__DynamicToolCallOutputContentItem = | { readonly text: string; readonly type: "inputText" } @@ -1999,344 +2063,462 @@ export const ServerNotification__DynamicToolCallOutputContentItem = Schema.Union }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ServerNotification__DynamicToolCallOutputContentItem" }); export type ServerNotification__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; export const ServerNotification__DynamicToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); +]).annotate({ identifier: "ServerNotification__DynamicToolCallStatus" }); -export type ServerNotification__EnvironmentConnectionNotification = { - readonly environmentId: string; - readonly threadId: string; -}; -export const ServerNotification__EnvironmentConnectionNotification = Schema.Struct({ - environmentId: Schema.String, - threadId: Schema.String, -}); +export type ServerNotification__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const ServerNotification__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "ServerNotification__CollabAgentStatus" }); -export type ServerNotification__ExternalAgentConfigMigrationItemType = - | "AGENTS_MD" - | "CONFIG" - | "SKILLS" - | "PLUGINS" - | "MCP_SERVER_CONFIG" - | "SUBAGENTS" - | "HOOKS" - | "COMMANDS" - | "MEMORY" - | "SESSIONS"; -export const ServerNotification__ExternalAgentConfigMigrationItemType = Schema.Literals([ - "AGENTS_MD", - "CONFIG", - "SKILLS", - "PLUGINS", - "MCP_SERVER_CONFIG", - "SUBAGENTS", - "HOOKS", - "COMMANDS", - "MEMORY", - "SESSIONS", -]); +export type ServerNotification__ReasoningEffort = string; +export const ServerNotification__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "ServerNotification__ReasoningEffort", + }), +); -export type ServerNotification__FileChangeOutputDeltaNotification = { - readonly delta: string; - readonly itemId: string; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerNotification__FileChangeOutputDeltaNotification = Schema.Struct({ - delta: Schema.String, - itemId: Schema.String, - threadId: Schema.String, - turnId: Schema.String, -}).annotate({ - description: - "Deprecated legacy notification for `apply_patch` textual output.\n\nThe server no longer emits this notification.", -}); +export type ServerNotification__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const ServerNotification__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "ServerNotification__CollabAgentToolCallStatus" }); -export type ServerNotification__FileSystemAccessMode = "read" | "write" | "deny"; -export const ServerNotification__FileSystemAccessMode = Schema.Literals(["read", "write", "deny"]); +export type ServerNotification__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const ServerNotification__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "ServerNotification__CollabAgentTool" }); -export type ServerNotification__FuzzyFileSearchMatchType = "file" | "directory"; -export const ServerNotification__FuzzyFileSearchMatchType = Schema.Literals(["file", "directory"]); +export type ServerNotification__SubAgentActivityKind = + | "started" + | "interacted" + | "interrupted" + | "completed"; +export const ServerNotification__SubAgentActivityKind = Schema.Literals([ + "started", + "interacted", + "interrupted", + "completed", +]).annotate({ identifier: "ServerNotification__SubAgentActivityKind" }); -export type ServerNotification__FuzzyFileSearchSessionCompletedNotification = { - readonly sessionId: string; -}; -export const ServerNotification__FuzzyFileSearchSessionCompletedNotification = Schema.Struct({ - sessionId: Schema.String, -}); +export type ServerNotification__WebSearchAction = + | { + readonly queries?: ReadonlyArray | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly type: "openPage"; readonly url?: string | null } + | { readonly pattern?: string | null; readonly type: "findInPage"; readonly url?: string | null } + | { readonly type: "other" }; +export const ServerNotification__WebSearchAction = Schema.Union( + [ + Schema.Struct({ + queries: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchWebSearchActionType" }), + }).annotate({ title: "SearchWebSearchAction" }), + Schema.Struct({ + type: Schema.Literal("openPage").annotate({ title: "OpenPageWebSearchActionType" }), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "OpenPageWebSearchAction" }), + Schema.Struct({ + pattern: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("findInPage").annotate({ title: "FindInPageWebSearchActionType" }), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "FindInPageWebSearchAction" }), + Schema.Struct({ + type: Schema.Literal("other").annotate({ title: "OtherWebSearchActionType" }), + }).annotate({ title: "OtherWebSearchAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__WebSearchAction" }); -export type ServerNotification__GitInfo = { - readonly branch?: string | null; - readonly originUrl?: string | null; - readonly sha?: string | null; -}; -export const ServerNotification__GitInfo = Schema.Struct({ - branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +export type ServerNotification__TurnItemsView = "notLoaded" | "summary" | "full"; +export const ServerNotification__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__TurnItemsView" }); -export type ServerNotification__GuardianApprovalReviewStatus = - | "inProgress" - | "approved" - | "denied" - | "timedOut" - | "aborted"; -export const ServerNotification__GuardianApprovalReviewStatus = Schema.Literals([ +export type ServerNotification__TurnStatus = "completed" | "interrupted" | "failed" | "inProgress"; +export const ServerNotification__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", "inProgress", - "approved", - "denied", - "timedOut", - "aborted", -]).annotate({ description: "[UNSTABLE] Lifecycle state for an approval auto-review." }); - -export type ServerNotification__GuardianCommandSource = "shell" | "unifiedExec"; -export const ServerNotification__GuardianCommandSource = Schema.Literals(["shell", "unifiedExec"]); - -export type ServerNotification__GuardianRiskLevel = "low" | "medium" | "high" | "critical"; -export const ServerNotification__GuardianRiskLevel = Schema.Literals([ - "low", - "medium", - "high", - "critical", -]).annotate({ description: "[UNSTABLE] Risk level assigned by approval auto-review." }); +]).annotate({ identifier: "ServerNotification__TurnStatus" }); -export type ServerNotification__GuardianUserAuthorization = "unknown" | "low" | "medium" | "high"; -export const ServerNotification__GuardianUserAuthorization = Schema.Literals([ - "unknown", - "low", - "medium", - "high", -]).annotate({ description: "[UNSTABLE] Authorization level assigned by approval auto-review." }); - -export type ServerNotification__GuardianWarningNotification = { - readonly message: string; - readonly threadId: string; -}; -export const ServerNotification__GuardianWarningNotification = Schema.Struct({ - message: Schema.String.annotate({ - description: "Concise guardian warning message for the user.", - }), - threadId: Schema.String.annotate({ description: "Thread target for the guardian warning." }), -}); +export type ServerNotification__ThreadArchivedNotification = { readonly threadId: string }; +export const ServerNotification__ThreadArchivedNotification = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadArchivedNotification" }); -export type ServerNotification__HookEventName = - | "preToolUse" - | "permissionRequest" - | "postToolUse" - | "preCompact" - | "postCompact" - | "sessionStart" - | "sessionEnd" - | "userPromptSubmit" - | "subagentStart" - | "subagentStop" - | "stop"; -export const ServerNotification__HookEventName = Schema.Literals([ - "preToolUse", - "permissionRequest", - "postToolUse", - "preCompact", - "postCompact", - "sessionStart", - "sessionEnd", - "userPromptSubmit", - "subagentStart", - "subagentStop", - "stop", -]); +export type ServerNotification__ThreadDeletedNotification = { readonly threadId: string }; +export const ServerNotification__ThreadDeletedNotification = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadDeletedNotification" }); -export type ServerNotification__HookExecutionMode = "sync" | "async"; -export const ServerNotification__HookExecutionMode = Schema.Literals(["sync", "async"]); +export type ServerNotification__ThreadUnarchivedNotification = { readonly threadId: string }; +export const ServerNotification__ThreadUnarchivedNotification = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadUnarchivedNotification" }); -export type ServerNotification__HookHandlerType = "command" | "prompt" | "agent"; -export const ServerNotification__HookHandlerType = Schema.Literals(["command", "prompt", "agent"]); +export type ServerNotification__ThreadClosedNotification = { readonly threadId: string }; +export const ServerNotification__ThreadClosedNotification = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadClosedNotification" }); -export type ServerNotification__HookOutputEntryKind = - | "warning" - | "stop" - | "feedback" - | "context" - | "error"; -export const ServerNotification__HookOutputEntryKind = Schema.Literals([ - "warning", - "stop", - "feedback", - "context", - "error", -]); +export type ServerNotification__SkillsChangedNotification = { readonly [x: string]: Schema.Json }; +export const ServerNotification__SkillsChangedNotification = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ + description: + "Notification emitted when watched local skill files change.\n\nTreat this as an invalidation signal and re-run `skills/list` with the client's current parameters when refreshed skill metadata is needed.", + identifier: "ServerNotification__SkillsChangedNotification", +}); -export type ServerNotification__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; +export type ServerNotification__ThreadNameUpdatedNotification = { + readonly threadId: string; + readonly threadName?: string | null; }; -export const ServerNotification__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, -}); +export const ServerNotification__ThreadNameUpdatedNotification = Schema.Struct({ + threadId: Schema.String, + threadName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__ThreadNameUpdatedNotification" }); -export type ServerNotification__HookRunStatus = - | "running" - | "completed" - | "failed" +export type ServerNotification__ThreadGoalStatus = + | "active" + | "paused" | "blocked" - | "stopped"; -export const ServerNotification__HookRunStatus = Schema.Literals([ - "running", - "completed", - "failed", + | "usageLimited" + | "budgetLimited" + | "complete"; +export const ServerNotification__ThreadGoalStatus = Schema.Literals([ + "active", + "paused", "blocked", - "stopped", -]); - -export type ServerNotification__HookScope = "thread" | "turn"; -export const ServerNotification__HookScope = Schema.Literals(["thread", "turn"]); - -export type ServerNotification__ImageDetail = "auto" | "low" | "high" | "original"; -export const ServerNotification__ImageDetail = Schema.Literals(["auto", "low", "high", "original"]); + "usageLimited", + "budgetLimited", + "complete", +]).annotate({ identifier: "ServerNotification__ThreadGoalStatus" }); -export type ServerNotification__LegacyAppPathString = string; -export const ServerNotification__LegacyAppPathString = Schema.String; +export type ServerNotification__ThreadGoalClearedNotification = { readonly threadId: string }; +export const ServerNotification__ThreadGoalClearedNotification = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadGoalClearedNotification" }); -export type ServerNotification__McpServerOauthLoginCompletedNotification = { - readonly error?: string | null; - readonly name: string; - readonly success: boolean; - readonly threadId?: string | null; +export type ServerNotification__EnvironmentConnectionNotification = { + readonly environmentId: string; + readonly threadId: string; }; -export const ServerNotification__McpServerOauthLoginCompletedNotification = Schema.Struct({ - error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - name: Schema.String, - success: Schema.Boolean, - threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +export const ServerNotification__EnvironmentConnectionNotification = Schema.Struct({ + environmentId: Schema.String, + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__EnvironmentConnectionNotification" }); -export type ServerNotification__McpServerStartupFailureReason = "reauthenticationRequired"; -export const ServerNotification__McpServerStartupFailureReason = Schema.Literal( - "reauthenticationRequired", -); +export type ServerNotification__ActivePermissionProfile = { + readonly extends?: string | null; + readonly id: string; +}; +export const ServerNotification__ActivePermissionProfile = Schema.Struct({ + extends: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Parent profile identifier from the selected permissions profile's `extends` setting, when present.", + }), + Schema.Null, + ]), + ), + id: Schema.String.annotate({ + description: + "Identifier from `default_permissions` or the implicit built-in default, such as `:workspace` or a user-defined `[permissions.]` profile.", + }), +}).annotate({ identifier: "ServerNotification__ActivePermissionProfile" }); -export type ServerNotification__McpServerStartupState = - | "starting" - | "ready" - | "failed" - | "cancelled"; -export const ServerNotification__McpServerStartupState = Schema.Literals([ - "starting", - "ready", - "failed", - "cancelled", -]); +export type ServerNotification__AskForApproval = + | "untrusted" + | "on-request" + | "never" + | { + readonly granular: { + readonly mcp_elicitations: boolean; + readonly request_permissions?: boolean; + readonly rules: boolean; + readonly sandbox_approval: boolean; + readonly skill_approval?: boolean; + }; + }; +export const ServerNotification__AskForApproval = Schema.Union( + [ + Schema.Literals(["untrusted", "on-request", "never"]), + Schema.Struct({ + granular: Schema.Struct({ + mcp_elicitations: Schema.Boolean, + request_permissions: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + rules: Schema.Boolean, + sandbox_approval: Schema.Boolean, + skill_approval: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + }), + }).annotate({ title: "GranularAskForApproval" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__AskForApproval" }); -export type ServerNotification__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const ServerNotification__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +export type ServerNotification__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; +export const ServerNotification__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "ServerNotification__ApprovalsReviewer", }); -export type ServerNotification__McpToolCallError = { readonly message: string }; -export const ServerNotification__McpToolCallError = Schema.Struct({ message: Schema.String }); +export type ServerNotification__ModeKind = "plan" | "default"; +export const ServerNotification__ModeKind = Schema.Literals(["plan", "default"]).annotate({ + description: "Initial collaboration mode to use when the TUI starts.", + identifier: "ServerNotification__ModeKind", +}); -export type ServerNotification__McpToolCallProgressNotification = { - readonly itemId: string; - readonly message: string; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerNotification__McpToolCallProgressNotification = Schema.Struct({ - itemId: Schema.String, - message: Schema.String, - threadId: Schema.String, - turnId: Schema.String, +export type ServerNotification__Personality = "none" | "friendly" | "pragmatic"; +export const ServerNotification__Personality = Schema.Literals([ + "none", + "friendly", + "pragmatic", +]).annotate({ identifier: "ServerNotification__Personality" }); + +export type ServerNotification__NetworkAccess = "restricted" | "enabled"; +export const ServerNotification__NetworkAccess = Schema.Literals([ + "restricted", + "enabled", +]).annotate({ identifier: "ServerNotification__NetworkAccess" }); + +export type ServerNotification__ReasoningSummary = "auto" | "concise" | "detailed" | "none"; +export const ServerNotification__ReasoningSummary = Schema.Union( + [ + Schema.Literals(["auto", "concise", "detailed"]), + Schema.Literal("none").annotate({ description: "Option to disable reasoning summaries." }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries", + identifier: "ServerNotification__ReasoningSummary", }); -export type ServerNotification__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; +export type ServerNotification__TokenUsageBreakdown = { + readonly cacheWriteInputTokens?: number; + readonly cachedInputTokens: number; + readonly inputTokens: number; + readonly outputTokens: number; + readonly reasoningOutputTokens: number; + readonly totalTokens: number; }; -export const ServerNotification__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); +export const ServerNotification__TokenUsageBreakdown = Schema.Struct({ + cacheWriteInputTokens: Schema.optionalKey( + Schema.Number.annotate({ default: 0, format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + ), + cachedInputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + inputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + outputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + reasoningOutputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + totalTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +}).annotate({ identifier: "ServerNotification__TokenUsageBreakdown" }); -export type ServerNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const ServerNotification__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export type ServerNotification__HookOutputEntryKind = + | "warning" + | "stop" + | "feedback" + | "context" + | "error"; +export const ServerNotification__HookOutputEntryKind = Schema.Literals([ + "warning", + "stop", + "feedback", + "context", + "error", +]).annotate({ identifier: "ServerNotification__HookOutputEntryKind" }); -export type ServerNotification__MemoryCitationEntry = { - readonly lineEnd: number; - readonly lineStart: number; - readonly note: string; - readonly path: string; -}; -export const ServerNotification__MemoryCitationEntry = Schema.Struct({ - lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - note: Schema.String, - path: Schema.String, -}); +export type ServerNotification__HookEventName = + | "preToolUse" + | "permissionRequest" + | "postToolUse" + | "preCompact" + | "postCompact" + | "sessionStart" + | "sessionEnd" + | "userPromptSubmit" + | "subagentStart" + | "subagentStop" + | "stop"; +export const ServerNotification__HookEventName = Schema.Literals([ + "preToolUse", + "permissionRequest", + "postToolUse", + "preCompact", + "postCompact", + "sessionStart", + "sessionEnd", + "userPromptSubmit", + "subagentStart", + "subagentStop", + "stop", +]).annotate({ identifier: "ServerNotification__HookEventName" }); -export type ServerNotification__MessagePhase = "commentary" | "final_answer"; -export const ServerNotification__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ - description: - 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', +export type ServerNotification__HookExecutionMode = "sync" | "async"; +export const ServerNotification__HookExecutionMode = Schema.Literals(["sync", "async"]).annotate({ + identifier: "ServerNotification__HookExecutionMode", }); -export type ServerNotification__ModeKind = "plan" | "default"; -export const ServerNotification__ModeKind = Schema.Literals(["plan", "default"]).annotate({ - description: "Initial collaboration mode to use when the TUI starts.", +export type ServerNotification__HookHandlerType = "command" | "prompt" | "agent"; +export const ServerNotification__HookHandlerType = Schema.Literals([ + "command", + "prompt", + "agent", +]).annotate({ identifier: "ServerNotification__HookHandlerType" }); + +export type ServerNotification__HookScope = "thread" | "turn"; +export const ServerNotification__HookScope = Schema.Literals(["thread", "turn"]).annotate({ + identifier: "ServerNotification__HookScope", }); -export type ServerNotification__ModelRerouteReason = "highRiskCyberActivity"; -export const ServerNotification__ModelRerouteReason = Schema.Literal("highRiskCyberActivity"); +export type ServerNotification__HookSource = + | "system" + | "user" + | "project" + | "mdm" + | "sessionFlags" + | "plugin" + | "cloudRequirements" + | "cloudManagedConfig" + | "legacyManagedConfigFile" + | "legacyManagedConfigMdm" + | "unknown"; +export const ServerNotification__HookSource = Schema.Literals([ + "system", + "user", + "project", + "mdm", + "sessionFlags", + "plugin", + "cloudRequirements", + "cloudManagedConfig", + "legacyManagedConfigFile", + "legacyManagedConfigMdm", + "unknown", +]).annotate({ identifier: "ServerNotification__HookSource" }); -export type ServerNotification__ModelSafetyBufferingUpdatedNotification = { - readonly fasterModel?: string | null; - readonly model: string; - readonly reasons: ReadonlyArray; - readonly showBufferingUi: boolean; +export type ServerNotification__HookRunStatus = + | "running" + | "completed" + | "failed" + | "blocked" + | "stopped"; +export const ServerNotification__HookRunStatus = Schema.Literals([ + "running", + "completed", + "failed", + "blocked", + "stopped", +]).annotate({ identifier: "ServerNotification__HookRunStatus" }); + +export type ServerNotification__TurnDiffUpdatedNotification = { + readonly diff: string; readonly threadId: string; readonly turnId: string; - readonly useCases: ReadonlyArray; }; -export const ServerNotification__ModelSafetyBufferingUpdatedNotification = Schema.Struct({ - fasterModel: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.String, - reasons: Schema.Array(Schema.String), - showBufferingUi: Schema.Boolean, +export const ServerNotification__TurnDiffUpdatedNotification = Schema.Struct({ + diff: Schema.String, threadId: Schema.String, turnId: Schema.String, - useCases: Schema.Array(Schema.String), +}).annotate({ + description: + "Notification that the turn-level unified diff has changed. Contains the latest aggregated diff across all file changes in the turn.", + identifier: "ServerNotification__TurnDiffUpdatedNotification", }); -export type ServerNotification__ModelVerification = "trustedAccessForCyber"; -export const ServerNotification__ModelVerification = Schema.Literal("trustedAccessForCyber"); +export type ServerNotification__TurnPlanStepStatus = "pending" | "inProgress" | "completed"; +export const ServerNotification__TurnPlanStepStatus = Schema.Literals([ + "pending", + "inProgress", + "completed", +]).annotate({ identifier: "ServerNotification__TurnPlanStepStatus" }); + +export type ServerNotification__GuardianCommandSource = "shell" | "unifiedExec"; +export const ServerNotification__GuardianCommandSource = Schema.Literals([ + "shell", + "unifiedExec", +]).annotate({ identifier: "ServerNotification__GuardianCommandSource" }); export type ServerNotification__NetworkApprovalProtocol = | "http" @@ -2348,45 +2530,79 @@ export const ServerNotification__NetworkApprovalProtocol = Schema.Literals([ "https", "socks5Tcp", "socks5Udp", -]); +]).annotate({ identifier: "ServerNotification__NetworkApprovalProtocol" }); -export type ServerNotification__NonSteerableTurnKind = "review" | "compact"; -export const ServerNotification__NonSteerableTurnKind = Schema.Literals(["review", "compact"]); +export type ServerNotification__FileSystemAccessMode = "read" | "write" | "deny"; +export const ServerNotification__FileSystemAccessMode = Schema.Literals([ + "read", + "write", + "deny", +]).annotate({ identifier: "ServerNotification__FileSystemAccessMode" }); -export type ServerNotification__PatchApplyStatus = +export type ServerNotification__AdditionalNetworkPermissions = { + readonly enabled?: boolean | null; +}; +export const ServerNotification__AdditionalNetworkPermissions = Schema.Struct({ + enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), +}).annotate({ identifier: "ServerNotification__AdditionalNetworkPermissions" }); + +export type ServerNotification__GuardianRiskLevel = "low" | "medium" | "high" | "critical"; +export const ServerNotification__GuardianRiskLevel = Schema.Literals([ + "low", + "medium", + "high", + "critical", +]).annotate({ + description: "[UNSTABLE] Risk level assigned by approval auto-review.", + identifier: "ServerNotification__GuardianRiskLevel", +}); + +export type ServerNotification__GuardianApprovalReviewStatus = | "inProgress" - | "completed" - | "failed" - | "declined"; -export const ServerNotification__PatchApplyStatus = Schema.Literals([ + | "approved" + | "denied" + | "timedOut" + | "aborted"; +export const ServerNotification__GuardianApprovalReviewStatus = Schema.Literals([ "inProgress", - "completed", - "failed", - "declined", -]); + "approved", + "denied", + "timedOut", + "aborted", +]).annotate({ + description: "[UNSTABLE] Lifecycle state for an approval auto-review.", + identifier: "ServerNotification__GuardianApprovalReviewStatus", +}); -export type ServerNotification__PatchChangeKind = - | { readonly type: "add" } - | { readonly type: "delete" } - | { readonly move_path?: string | null; readonly type: "update" }; -export const ServerNotification__PatchChangeKind = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), - }).annotate({ title: "AddPatchChangeKind" }), - Schema.Struct({ - type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), - }).annotate({ title: "DeletePatchChangeKind" }), - Schema.Struct({ - move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), - }).annotate({ title: "UpdatePatchChangeKind" }), - ], - { mode: "oneOf" }, -); +export type ServerNotification__GuardianUserAuthorization = "unknown" | "low" | "medium" | "high"; +export const ServerNotification__GuardianUserAuthorization = Schema.Literals([ + "unknown", + "low", + "medium", + "high", +]).annotate({ + description: "[UNSTABLE] Authorization level assigned by approval auto-review.", + identifier: "ServerNotification__GuardianUserAuthorization", +}); -export type ServerNotification__Personality = "none" | "friendly" | "pragmatic"; -export const ServerNotification__Personality = Schema.Literals(["none", "friendly", "pragmatic"]); +export type ServerNotification__AutoReviewDecisionSource = "agent"; +export const ServerNotification__AutoReviewDecisionSource = Schema.Literal("agent").annotate({ + description: "[UNSTABLE] Source that produced a terminal approval auto-review decision.", + identifier: "ServerNotification__AutoReviewDecisionSource", +}); + +export type ServerNotification__AgentMessageDeltaNotification = { + readonly delta: string; + readonly itemId: string; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__AgentMessageDeltaNotification = Schema.Struct({ + delta: Schema.String, + itemId: Schema.String, + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__AgentMessageDeltaNotification" }); export type ServerNotification__PlanDeltaNotification = { readonly delta: string; @@ -2402,45 +2618,36 @@ export const ServerNotification__PlanDeltaNotification = Schema.Struct({ }).annotate({ description: "EXPERIMENTAL - proposed plan streaming deltas for plan items. Clients should not assume concatenated deltas match the completed plan item content.", + identifier: "ServerNotification__PlanDeltaNotification", }); -export type ServerNotification__PlanType = - | "free" - | "go" - | "plus" - | "pro" - | "prolite" - | "team" - | "self_serve_business_prolite" - | "self_serve_business_usage_based" - | "business" - | "ent26" - | "enterprise_cbp_automation" - | "enterprise_cbp_usage_based" - | "enterprise" - | "edu" - | "edu_plus" - | "edu_pro" - | "unknown"; -export const ServerNotification__PlanType = Schema.Literals([ - "free", - "go", - "plus", - "pro", - "prolite", - "team", - "self_serve_business_prolite", - "self_serve_business_usage_based", - "business", - "ent26", - "enterprise_cbp_automation", - "enterprise_cbp_usage_based", - "enterprise", - "edu", - "edu_plus", - "edu_pro", - "unknown", -]); +export type ServerNotification__CommandExecOutputStream = "stdout" | "stderr"; +export const ServerNotification__CommandExecOutputStream = Schema.Union( + [ + Schema.Literal("stdout").annotate({ + description: "stdout stream. PTY mode multiplexes terminal output here.", + }), + Schema.Literal("stderr").annotate({ description: "stderr stream." }), + ], + { mode: "oneOf" }, +).annotate({ + description: "Stream label for `command/exec/outputDelta` notifications.", + identifier: "ServerNotification__CommandExecOutputStream", +}); + +export type ServerNotification__ProcessOutputStream = "stdout" | "stderr"; +export const ServerNotification__ProcessOutputStream = Schema.Union( + [ + Schema.Literal("stdout").annotate({ + description: "stdout stream. PTY mode multiplexes terminal output here.", + }), + Schema.Literal("stderr").annotate({ description: "stderr stream." }), + ], + { mode: "oneOf" }, +).annotate({ + description: "Stream label for `process/outputDelta` notifications.", + identifier: "ServerNotification__ProcessOutputStream", +}); export type ServerNotification__ProcessExitedNotification = { readonly exitCode: number; @@ -2452,7 +2659,7 @@ export type ServerNotification__ProcessExitedNotification = { }; export const ServerNotification__ProcessExitedNotification = Schema.Struct({ exitCode: Schema.Number.annotate({ description: "Process exit code.", format: "int32" }).check( - Schema.isInt(), + Schema.isInt().annotate({ expected: "an integer" }), ), processHandle: Schema.String.annotate({ description: "Client-supplied, connection-scoped `processHandle` from `process/spawn`.", @@ -2473,146 +2680,195 @@ export const ServerNotification__ProcessExitedNotification = Schema.Struct({ description: "Whether stdout reached `outputBytesCap`.\n\nIn streaming mode, stdout is empty and cap state is also reported on the final stdout `process/outputDelta` notification.", }), -}).annotate({ description: "Final process exit notification for `process/spawn`." }); - -export type ServerNotification__ProcessOutputDeltaNotification = { - readonly capReached: boolean; - readonly deltaBase64: string; - readonly processHandle: string; - readonly stream: "stdout" | "stderr"; -}; -export const ServerNotification__ProcessOutputDeltaNotification = Schema.Struct({ - capReached: Schema.Boolean.annotate({ - description: - "True on the final streamed chunk for this stream when output was truncated by `outputBytesCap`.", - }), - deltaBase64: Schema.String.annotate({ description: "Base64-encoded output bytes." }), - processHandle: Schema.String.annotate({ - description: "Client-supplied, connection-scoped `processHandle` from `process/spawn`.", - }), - stream: Schema.Literals(["stdout", "stderr"]).annotate({ - description: "Stream label for `process/outputDelta` notifications.", - }), }).annotate({ - description: "Base64-encoded output chunk emitted for a streaming `process/spawn` request.", -}); - -export type ServerNotification__RateLimitReachedType = - | "rate_limit_reached" - | "workspace_owner_credits_depleted" - | "workspace_member_credits_depleted" - | "workspace_owner_usage_limit_reached" - | "workspace_member_usage_limit_reached"; -export const ServerNotification__RateLimitReachedType = Schema.Literals([ - "rate_limit_reached", - "workspace_owner_credits_depleted", - "workspace_member_credits_depleted", - "workspace_owner_usage_limit_reached", - "workspace_member_usage_limit_reached", -]); - -export type ServerNotification__RateLimitWindow = { - readonly resetsAt?: number | null; - readonly usedPercent: number; - readonly windowDurationMins?: number | null; -}; -export const ServerNotification__RateLimitWindow = Schema.Struct({ - resetsAt: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), - usedPercent: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - windowDurationMins: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), -}); - -export type ServerNotification__RealtimeConversationVersion = "v1" | "v2" | "v3"; -export const ServerNotification__RealtimeConversationVersion = Schema.Literals(["v1", "v2", "v3"]); - -export type ServerNotification__ReasoningEffort = string; -export const ServerNotification__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); - -export type ServerNotification__ReasoningSummary = "auto" | "concise" | "detailed" | "none"; -export const ServerNotification__ReasoningSummary = Schema.Union( - [ - Schema.Literals(["auto", "concise", "detailed"]), - Schema.Literal("none").annotate({ description: "Option to disable reasoning summaries." }), - ], - { mode: "oneOf" }, -).annotate({ - description: - "A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries", + description: "Final process exit notification for `process/spawn`.", + identifier: "ServerNotification__ProcessExitedNotification", }); -export type ServerNotification__ReasoningSummaryPartAddedNotification = { +export type ServerNotification__CommandExecutionOutputDeltaNotification = { + readonly delta: string; readonly itemId: string; - readonly summaryIndex: number; readonly threadId: string; readonly turnId: string; }; -export const ServerNotification__ReasoningSummaryPartAddedNotification = Schema.Struct({ +export const ServerNotification__CommandExecutionOutputDeltaNotification = Schema.Struct({ + delta: Schema.String, itemId: Schema.String, - summaryIndex: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), threadId: Schema.String, turnId: Schema.String, -}); +}).annotate({ identifier: "ServerNotification__CommandExecutionOutputDeltaNotification" }); -export type ServerNotification__ReasoningSummaryTextDeltaNotification = { - readonly delta: string; +export type ServerNotification__TerminalInteractionNotification = { readonly itemId: string; - readonly summaryIndex: number; + readonly processId: string; + readonly stdin: string; readonly threadId: string; readonly turnId: string; }; -export const ServerNotification__ReasoningSummaryTextDeltaNotification = Schema.Struct({ - delta: Schema.String, +export const ServerNotification__TerminalInteractionNotification = Schema.Struct({ itemId: Schema.String, - summaryIndex: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + processId: Schema.String, + stdin: Schema.String, threadId: Schema.String, turnId: Schema.String, -}); +}).annotate({ identifier: "ServerNotification__TerminalInteractionNotification" }); -export type ServerNotification__ReasoningTextDeltaNotification = { - readonly contentIndex: number; +export type ServerNotification__FileChangeOutputDeltaNotification = { readonly delta: string; readonly itemId: string; readonly threadId: string; readonly turnId: string; }; -export const ServerNotification__ReasoningTextDeltaNotification = Schema.Struct({ - contentIndex: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), +export const ServerNotification__FileChangeOutputDeltaNotification = Schema.Struct({ delta: Schema.String, itemId: Schema.String, threadId: Schema.String, turnId: Schema.String, +}).annotate({ + description: + "Deprecated legacy notification for `apply_patch` textual output.\n\nThe server no longer emits this notification.", + identifier: "ServerNotification__FileChangeOutputDeltaNotification", }); -export type ServerNotification__RemoteControlConnectionStatus = - | "disabled" - | "connecting" - | "connected" - | "errored"; -export const ServerNotification__RemoteControlConnectionStatus = Schema.Literals([ - "disabled", - "connecting", - "connected", - "errored", -]); - export type ServerNotification__RequestId = string | number; export const ServerNotification__RequestId = Schema.Union([ Schema.String, - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -]); + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +]).annotate({ identifier: "ServerNotification__RequestId" }); -export type ServerNotification__SkillsChangedNotification = {}; -export const ServerNotification__SkillsChangedNotification = Schema.Struct({}).annotate({ - description: - "Notification emitted when watched local skill files change.\n\nTreat this as an invalidation signal and re-run `skills/list` with the client's current parameters when refreshed skill metadata is needed.", +export type ServerNotification__McpToolCallProgressNotification = { + readonly itemId: string; + readonly message: string; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__McpToolCallProgressNotification = Schema.Struct({ + itemId: Schema.String, + message: Schema.String, + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__McpToolCallProgressNotification" }); + +export type ServerNotification__McpServerOauthLoginCompletedNotification = { + readonly error?: string | null; + readonly name: string; + readonly success: boolean; + readonly threadId?: string | null; +}; +export const ServerNotification__McpServerOauthLoginCompletedNotification = Schema.Struct({ + error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + name: Schema.String, + success: Schema.Boolean, + threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__McpServerOauthLoginCompletedNotification" }); + +export type ServerNotification__McpServerStartupFailureReason = "reauthenticationRequired"; +export const ServerNotification__McpServerStartupFailureReason = Schema.Literal( + "reauthenticationRequired", +).annotate({ identifier: "ServerNotification__McpServerStartupFailureReason" }); + +export type ServerNotification__McpServerStartupState = + | "starting" + | "ready" + | "failed" + | "cancelled"; +export const ServerNotification__McpServerStartupState = Schema.Literals([ + "starting", + "ready", + "failed", + "cancelled", +]).annotate({ identifier: "ServerNotification__McpServerStartupState" }); + +export type ServerNotification__AuthMode = + | "apikey" + | "chatgpt" + | "chatgptAuthTokens" + | "headers" + | "agentIdentity" + | "personalAccessToken" + | "bedrockApiKey"; +export const ServerNotification__AuthMode = Schema.Union( + [ + Schema.Literal("apikey").annotate({ + description: "OpenAI API key provided by the caller and stored by Codex.", + }), + Schema.Literal("chatgpt").annotate({ + description: "ChatGPT OAuth managed by Codex (tokens persisted and refreshed by Codex).", + }), + Schema.Literal("chatgptAuthTokens").annotate({ + description: + "[UNSTABLE] FOR OPENAI INTERNAL USE ONLY - DO NOT USE.\n\nChatGPT auth tokens are supplied by an external host app and are only stored in memory. Token refresh must be handled by the external host app.", + }), + Schema.Literal("headers").annotate({ + description: "Backend auth supplied as request headers.", + }), + Schema.Literal("agentIdentity").annotate({ + description: "Programmatic Codex auth backed by a registered Agent Identity.", + }), + Schema.Literal("personalAccessToken").annotate({ + description: "Programmatic Codex auth backed by a personal access token.", + }), + Schema.Literal("bedrockApiKey").annotate({ + description: "Amazon Bedrock bearer token managed by Codex.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: "Authentication mode for OpenAI-backed providers.", + identifier: "ServerNotification__AuthMode", }); +export type ServerNotification__PlanType = + | "free" + | "go" + | "plus" + | "pro" + | "prolite" + | "team" + | "self_serve_business_prolite" + | "self_serve_business_usage_based" + | "business" + | "ent26" + | "enterprise_cbp_automation" + | "enterprise_cbp_usage_based" + | "enterprise" + | "edu" + | "edu_plus" + | "edu_pro" + | "unknown"; +export const ServerNotification__PlanType = Schema.Literals([ + "free", + "go", + "plus", + "pro", + "prolite", + "team", + "self_serve_business_prolite", + "self_serve_business_usage_based", + "business", + "ent26", + "enterprise_cbp_automation", + "enterprise_cbp_usage_based", + "enterprise", + "edu", + "edu_plus", + "edu_pro", + "unknown", +]).annotate({ identifier: "ServerNotification__PlanType" }); + +export type ServerNotification__CreditsSnapshot = { + readonly balance?: string | null; + readonly hasCredits: boolean; + readonly unlimited: boolean; +}; +export const ServerNotification__CreditsSnapshot = Schema.Struct({ + balance: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + hasCredits: Schema.Boolean, + unlimited: Schema.Boolean, +}).annotate({ identifier: "ServerNotification__CreditsSnapshot" }); + export type ServerNotification__SpendControlLimitSnapshot = { readonly limit: string; readonly remainingPercent: number; @@ -2621,62 +2877,271 @@ export type ServerNotification__SpendControlLimitSnapshot = { }; export const ServerNotification__SpendControlLimitSnapshot = Schema.Struct({ limit: Schema.String, - remainingPercent: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - resetsAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + remainingPercent: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + resetsAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), used: Schema.String, +}).annotate({ identifier: "ServerNotification__SpendControlLimitSnapshot" }); + +export type ServerNotification__RateLimitWindow = { + readonly resetsAt?: number | null; + readonly usedPercent: number; + readonly windowDurationMins?: number | null; +}; +export const ServerNotification__RateLimitWindow = Schema.Struct({ + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + usedPercent: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + windowDurationMins: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ServerNotification__RateLimitWindow" }); + +export type ServerNotification__RateLimitReachedType = + | "rate_limit_reached" + | "workspace_owner_credits_depleted" + | "workspace_member_credits_depleted" + | "workspace_owner_usage_limit_reached" + | "workspace_member_usage_limit_reached"; +export const ServerNotification__RateLimitReachedType = Schema.Literals([ + "rate_limit_reached", + "workspace_owner_credits_depleted", + "workspace_member_credits_depleted", + "workspace_owner_usage_limit_reached", + "workspace_member_usage_limit_reached", +]).annotate({ identifier: "ServerNotification__RateLimitReachedType" }); + +export type ServerNotification__AppReview = { readonly status: string }; +export const ServerNotification__AppReview = Schema.Struct({ status: Schema.String }).annotate({ + identifier: "ServerNotification__AppReview", }); -export type ServerNotification__SubAgentActivityKind = - | "started" - | "interacted" - | "interrupted" - | "completed"; -export const ServerNotification__SubAgentActivityKind = Schema.Literals([ - "started", - "interacted", - "interrupted", - "completed", -]); +export type ServerNotification__AppScreenshot = { + readonly fileId?: string | null; + readonly url?: string | null; + readonly userPrompt: string; +}; +export const ServerNotification__AppScreenshot = Schema.Struct({ + fileId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + userPrompt: Schema.String, +}).annotate({ identifier: "ServerNotification__AppScreenshot" }); -export type ServerNotification__TerminalInteractionNotification = { +export type ServerNotification__AppBranding = { + readonly category?: string | null; + readonly developer?: string | null; + readonly isDiscoverableApp: boolean; + readonly privacyPolicy?: string | null; + readonly termsOfService?: string | null; + readonly website?: string | null; +}; +export const ServerNotification__AppBranding = Schema.Struct({ + category: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + developer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + isDiscoverableApp: Schema.Boolean, + privacyPolicy: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + termsOfService: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + website: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "EXPERIMENTAL - app metadata returned by app-list APIs.", + identifier: "ServerNotification__AppBranding", +}); + +export type ServerNotification__RemoteControlConnectionStatus = + | "disabled" + | "connecting" + | "connected" + | "errored"; +export const ServerNotification__RemoteControlConnectionStatus = Schema.Literals([ + "disabled", + "connecting", + "connected", + "errored", +]).annotate({ identifier: "ServerNotification__RemoteControlConnectionStatus" }); + +export type ServerNotification__ExternalAgentConfigMigrationItemType = + | "AGENTS_MD" + | "CONFIG" + | "SKILLS" + | "PLUGINS" + | "MCP_SERVER_CONFIG" + | "SUBAGENTS" + | "HOOKS" + | "COMMANDS" + | "MEMORY" + | "SESSIONS"; +export const ServerNotification__ExternalAgentConfigMigrationItemType = Schema.Literals([ + "AGENTS_MD", + "CONFIG", + "SKILLS", + "PLUGINS", + "MCP_SERVER_CONFIG", + "SUBAGENTS", + "HOOKS", + "COMMANDS", + "MEMORY", + "SESSIONS", +]).annotate({ identifier: "ServerNotification__ExternalAgentConfigMigrationItemType" }); + +export type ServerNotification__ReasoningSummaryTextDeltaNotification = { + readonly delta: string; readonly itemId: string; - readonly processId: string; - readonly stdin: string; + readonly summaryIndex: number; readonly threadId: string; readonly turnId: string; }; -export const ServerNotification__TerminalInteractionNotification = Schema.Struct({ +export const ServerNotification__ReasoningSummaryTextDeltaNotification = Schema.Struct({ + delta: Schema.String, itemId: Schema.String, - processId: Schema.String, - stdin: Schema.String, + summaryIndex: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__ReasoningSummaryTextDeltaNotification" }); + +export type ServerNotification__ReasoningSummaryPartAddedNotification = { + readonly itemId: string; + readonly summaryIndex: number; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__ReasoningSummaryPartAddedNotification = Schema.Struct({ + itemId: Schema.String, + summaryIndex: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__ReasoningSummaryPartAddedNotification" }); + +export type ServerNotification__ReasoningTextDeltaNotification = { + readonly contentIndex: number; + readonly delta: string; + readonly itemId: string; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__ReasoningTextDeltaNotification = Schema.Struct({ + contentIndex: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + delta: Schema.String, + itemId: Schema.String, + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__ReasoningTextDeltaNotification" }); + +export type ServerNotification__ContextCompactedNotification = { + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__ContextCompactedNotification = Schema.Struct({ threadId: Schema.String, turnId: Schema.String, +}).annotate({ + description: "Deprecated: Use `ContextCompaction` item type instead.", + identifier: "ServerNotification__ContextCompactedNotification", }); -export type ServerNotification__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; +export type ServerNotification__ModelRerouteReason = "highRiskCyberActivity"; +export const ServerNotification__ModelRerouteReason = Schema.Literal( + "highRiskCyberActivity", +).annotate({ identifier: "ServerNotification__ModelRerouteReason" }); + +export type ServerNotification__ModelVerification = "trustedAccessForCyber"; +export const ServerNotification__ModelVerification = Schema.Literal( + "trustedAccessForCyber", +).annotate({ identifier: "ServerNotification__ModelVerification" }); + +export type ServerNotification__TurnModerationMetadataNotification = { + readonly metadata: Schema.Json; + readonly threadId: string; + readonly turnId: string; }; -export const ServerNotification__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", +export const ServerNotification__TurnModerationMetadataNotification = Schema.Struct({ + metadata: Schema.Json.annotate({ expected: "JSON value" }), + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__TurnModerationMetadataNotification" }); + +export type ServerNotification__ModelSafetyBufferingUpdatedNotification = { + readonly fasterModel?: string | null; + readonly model: string; + readonly reasons: ReadonlyArray; + readonly showBufferingUi: boolean; + readonly threadId: string; + readonly turnId: string; + readonly useCases: ReadonlyArray; +}; +export const ServerNotification__ModelSafetyBufferingUpdatedNotification = Schema.Struct({ + fasterModel: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.String, + reasons: Schema.Array(Schema.String), + showBufferingUi: Schema.Boolean, + threadId: Schema.String, + turnId: Schema.String, + useCases: Schema.Array(Schema.String), +}).annotate({ identifier: "ServerNotification__ModelSafetyBufferingUpdatedNotification" }); + +export type ServerNotification__WarningNotification = { + readonly message: string; + readonly threadId?: string | null; +}; +export const ServerNotification__WarningNotification = Schema.Struct({ + message: Schema.String.annotate({ description: "Concise warning message for the user." }), + threadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional thread target when the warning applies to a specific thread.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ServerNotification__WarningNotification" }); + +export type ServerNotification__GuardianWarningNotification = { + readonly message: string; + readonly threadId: string; +}; +export const ServerNotification__GuardianWarningNotification = Schema.Struct({ + message: Schema.String.annotate({ + description: "Concise guardian warning message for the user.", }), - placeholder: Schema.optionalKey( + threadId: Schema.String.annotate({ description: "Thread target for the guardian warning." }), +}).annotate({ identifier: "ServerNotification__GuardianWarningNotification" }); + +export type ServerNotification__DeprecationNoticeNotification = { + readonly details?: string | null; + readonly summary: string; +}; +export const ServerNotification__DeprecationNoticeNotification = Schema.Struct({ + details: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", + description: "Optional extra guidance, such as migration steps or rationale.", }), Schema.Null, ]), ), -}); + summary: Schema.String.annotate({ description: "Concise summary of what is deprecated." }), +}).annotate({ identifier: "ServerNotification__DeprecationNoticeNotification" }); export type ServerNotification__TextPosition = { readonly column: number; readonly line: number }; export const ServerNotification__TextPosition = Schema.Struct({ @@ -2684,65 +3149,77 @@ export const ServerNotification__TextPosition = Schema.Struct({ description: "1-based column number (in Unicode scalar values).", format: "uint", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), line: Schema.Number.annotate({ description: "1-based line number.", format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "ServerNotification__TextPosition" }); -export type ServerNotification__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; -export const ServerNotification__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); +export type ServerNotification__FuzzyFileSearchMatchType = "file" | "directory"; +export const ServerNotification__FuzzyFileSearchMatchType = Schema.Literals([ + "file", + "directory", +]).annotate({ identifier: "ServerNotification__FuzzyFileSearchMatchType" }); -export type ServerNotification__ThreadArchivedNotification = { readonly threadId: string }; -export const ServerNotification__ThreadArchivedNotification = Schema.Struct({ - threadId: Schema.String, -}); +export type ServerNotification__FuzzyFileSearchSessionCompletedNotification = { + readonly sessionId: string; +}; +export const ServerNotification__FuzzyFileSearchSessionCompletedNotification = Schema.Struct({ + sessionId: Schema.String, +}).annotate({ identifier: "ServerNotification__FuzzyFileSearchSessionCompletedNotification" }); -export type ServerNotification__ThreadClosedNotification = { readonly threadId: string }; -export const ServerNotification__ThreadClosedNotification = Schema.Struct({ - threadId: Schema.String, -}); +export type ServerNotification__RealtimeConversationVersion = "v1" | "v2" | "v3"; +export const ServerNotification__RealtimeConversationVersion = Schema.Literals([ + "v1", + "v2", + "v3", +]).annotate({ identifier: "ServerNotification__RealtimeConversationVersion" }); -export type ServerNotification__ThreadDeletedNotification = { readonly threadId: string }; -export const ServerNotification__ThreadDeletedNotification = Schema.Struct({ +export type ServerNotification__ThreadRealtimeItemAddedNotification = { + readonly item: Schema.Json; + readonly threadId: string; +}; +export const ServerNotification__ThreadRealtimeItemAddedNotification = Schema.Struct({ + item: Schema.Json.annotate({ expected: "JSON value" }), threadId: Schema.String, +}).annotate({ + description: "EXPERIMENTAL - raw non-audio thread realtime item emitted by the backend.", + identifier: "ServerNotification__ThreadRealtimeItemAddedNotification", }); -export type ServerNotification__ThreadGoalClearedNotification = { readonly threadId: string }; -export const ServerNotification__ThreadGoalClearedNotification = Schema.Struct({ +export type ServerNotification__ThreadRealtimeTranscriptDeltaNotification = { + readonly delta: string; + readonly role: string; + readonly threadId: string; +}; +export const ServerNotification__ThreadRealtimeTranscriptDeltaNotification = Schema.Struct({ + delta: Schema.String.annotate({ description: "Live transcript delta from the realtime event." }), + role: Schema.String, threadId: Schema.String, +}).annotate({ + description: + "EXPERIMENTAL - flat transcript delta emitted whenever realtime transcript text changes.", + identifier: "ServerNotification__ThreadRealtimeTranscriptDeltaNotification", }); -export type ServerNotification__ThreadGoalStatus = - | "active" - | "paused" - | "blocked" - | "usageLimited" - | "budgetLimited" - | "complete"; -export const ServerNotification__ThreadGoalStatus = Schema.Literals([ - "active", - "paused", - "blocked", - "usageLimited", - "budgetLimited", - "complete", -]); - -export type ServerNotification__ThreadId = string; -export const ServerNotification__ThreadId = Schema.String; - -export type ServerNotification__ThreadNameUpdatedNotification = { +export type ServerNotification__ThreadRealtimeTranscriptDoneNotification = { + readonly role: string; + readonly text: string; readonly threadId: string; - readonly threadName?: string | null; }; -export const ServerNotification__ThreadNameUpdatedNotification = Schema.Struct({ +export const ServerNotification__ThreadRealtimeTranscriptDoneNotification = Schema.Struct({ + role: Schema.String, + text: Schema.String.annotate({ description: "Final complete text for the transcript part." }), threadId: Schema.String, - threadName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: + "EXPERIMENTAL - final transcript text emitted when realtime completes a transcript part.", + identifier: "ServerNotification__ThreadRealtimeTranscriptDoneNotification", }); export type ServerNotification__ThreadRealtimeAudioChunk = { @@ -2756,48 +3233,30 @@ export const ServerNotification__ThreadRealtimeAudioChunk = Schema.Struct({ data: Schema.String, itemId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), numChannels: Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), sampleRate: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), samplesPerChannel: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), -}).annotate({ description: "EXPERIMENTAL - thread realtime audio chunk." }); - -export type ServerNotification__ThreadRealtimeClosedNotification = { - readonly reason?: string | null; - readonly threadId: string; -}; -export const ServerNotification__ThreadRealtimeClosedNotification = Schema.Struct({ - reason: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - threadId: Schema.String, -}).annotate({ description: "EXPERIMENTAL - emitted when thread realtime transport closes." }); - -export type ServerNotification__ThreadRealtimeErrorNotification = { - readonly message: string; - readonly threadId: string; -}; -export const ServerNotification__ThreadRealtimeErrorNotification = Schema.Struct({ - message: Schema.String, - threadId: Schema.String, -}).annotate({ description: "EXPERIMENTAL - emitted when thread realtime encounters an error." }); - -export type ServerNotification__ThreadRealtimeItemAddedNotification = { - readonly item: unknown; - readonly threadId: string; -}; -export const ServerNotification__ThreadRealtimeItemAddedNotification = Schema.Struct({ - item: Schema.Unknown, - threadId: Schema.String, }).annotate({ - description: "EXPERIMENTAL - raw non-audio thread realtime item emitted by the backend.", + description: "EXPERIMENTAL - thread realtime audio chunk.", + identifier: "ServerNotification__ThreadRealtimeAudioChunk", }); export type ServerNotification__ThreadRealtimeSdpNotification = { @@ -2809,189 +3268,202 @@ export const ServerNotification__ThreadRealtimeSdpNotification = Schema.Struct({ threadId: Schema.String, }).annotate({ description: "EXPERIMENTAL - emitted with the remote SDP for a WebRTC realtime session.", + identifier: "ServerNotification__ThreadRealtimeSdpNotification", }); -export type ServerNotification__ThreadRealtimeTranscriptDeltaNotification = { - readonly delta: string; - readonly role: string; +export type ServerNotification__ThreadRealtimeErrorNotification = { + readonly message: string; readonly threadId: string; }; -export const ServerNotification__ThreadRealtimeTranscriptDeltaNotification = Schema.Struct({ - delta: Schema.String.annotate({ description: "Live transcript delta from the realtime event." }), - role: Schema.String, +export const ServerNotification__ThreadRealtimeErrorNotification = Schema.Struct({ + message: Schema.String, threadId: Schema.String, }).annotate({ - description: - "EXPERIMENTAL - flat transcript delta emitted whenever realtime transcript text changes.", + description: "EXPERIMENTAL - emitted when thread realtime encounters an error.", + identifier: "ServerNotification__ThreadRealtimeErrorNotification", }); -export type ServerNotification__ThreadRealtimeTranscriptDoneNotification = { - readonly role: string; - readonly text: string; +export type ServerNotification__ThreadRealtimeClosedNotification = { + readonly reason?: string | null; readonly threadId: string; }; -export const ServerNotification__ThreadRealtimeTranscriptDoneNotification = Schema.Struct({ - role: Schema.String, - text: Schema.String.annotate({ description: "Final complete text for the transcript part." }), +export const ServerNotification__ThreadRealtimeClosedNotification = Schema.Struct({ + reason: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), threadId: Schema.String, }).annotate({ - description: - "EXPERIMENTAL - final transcript text emitted when realtime completes a transcript part.", + description: "EXPERIMENTAL - emitted when thread realtime transport closes.", + identifier: "ServerNotification__ThreadRealtimeClosedNotification", }); -export type ServerNotification__ThreadSource = string; -export const ServerNotification__ThreadSource = Schema.String; +export type ServerNotification__WindowsWorldWritableWarningNotification = { + readonly extraCount: number; + readonly failedScan: boolean; + readonly samplePaths: ReadonlyArray; +}; +export const ServerNotification__WindowsWorldWritableWarningNotification = Schema.Struct({ + extraCount: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + failedScan: Schema.Boolean, + samplePaths: Schema.Array(Schema.String), +}).annotate({ identifier: "ServerNotification__WindowsWorldWritableWarningNotification" }); -export type ServerNotification__ThreadUnarchivedNotification = { readonly threadId: string }; -export const ServerNotification__ThreadUnarchivedNotification = Schema.Struct({ - threadId: Schema.String, -}); +export type ServerNotification__WindowsSandboxSetupMode = "elevated" | "unelevated"; +export const ServerNotification__WindowsSandboxSetupMode = Schema.Literals([ + "elevated", + "unelevated", +]).annotate({ identifier: "ServerNotification__WindowsSandboxSetupMode" }); -export type ServerNotification__TokenUsageBreakdown = { - readonly cacheWriteInputTokens?: number; - readonly cachedInputTokens: number; - readonly inputTokens: number; - readonly outputTokens: number; - readonly reasoningOutputTokens: number; - readonly totalTokens: number; +export type ServerNotification__AccountLoginCompletedNotification = { + readonly error?: string | null; + readonly loginId?: string | null; + readonly success: boolean; }; -export const ServerNotification__TokenUsageBreakdown = Schema.Struct({ - cacheWriteInputTokens: Schema.optionalKey( - Schema.Number.annotate({ default: 0, format: "int64" }).check(Schema.isInt()), +export const ServerNotification__AccountLoginCompletedNotification = Schema.Struct({ + error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + loginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + success: Schema.Boolean, +}).annotate({ identifier: "ServerNotification__AccountLoginCompletedNotification" }); + +export type ServerRequest__RequestId = string | number; +export const ServerRequest__RequestId = Schema.Union([ + Schema.String, + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), ), - cachedInputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - inputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - outputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - reasoningOutputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - totalTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), +]).annotate({ identifier: "ServerRequest__RequestId" }); + +export type ServerRequest__AbsolutePathBuf = string; +export const ServerRequest__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "ServerRequest__AbsolutePathBuf", }); -export type ServerNotification__TurnDiffUpdatedNotification = { - readonly diff: string; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerNotification__TurnDiffUpdatedNotification = Schema.Struct({ - diff: Schema.String, - threadId: Schema.String, - turnId: Schema.String, -}).annotate({ - description: - "Notification that the turn-level unified diff has changed. Contains the latest aggregated diff across all file changes in the turn.", -}); - -export type ServerNotification__TurnModerationMetadataNotification = { - readonly metadata: unknown; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerNotification__TurnModerationMetadataNotification = Schema.Struct({ - metadata: Schema.Unknown, - threadId: Schema.String, - turnId: Schema.String, +export type ServerRequest__LegacyAppPathString = string; +export const ServerRequest__LegacyAppPathString = Schema.String.annotate({ + identifier: "ServerRequest__LegacyAppPathString", }); -export type ServerNotification__TurnPlanStepStatus = "pending" | "inProgress" | "completed"; -export const ServerNotification__TurnPlanStepStatus = Schema.Literals([ - "pending", - "inProgress", - "completed", -]); +export type ServerRequest__NetworkApprovalProtocol = "http" | "https" | "socks5Tcp" | "socks5Udp"; +export const ServerRequest__NetworkApprovalProtocol = Schema.Literals([ + "http", + "https", + "socks5Tcp", + "socks5Udp", +]).annotate({ identifier: "ServerRequest__NetworkApprovalProtocol" }); -export type ServerNotification__TurnStatus = "completed" | "interrupted" | "failed" | "inProgress"; -export const ServerNotification__TurnStatus = Schema.Literals([ - "completed", - "interrupted", - "failed", - "inProgress", -]); +export type ServerRequest__NetworkPolicyRuleAction = "allow" | "deny"; +export const ServerRequest__NetworkPolicyRuleAction = Schema.Literals(["allow", "deny"]).annotate({ + identifier: "ServerRequest__NetworkPolicyRuleAction", +}); -export type ServerNotification__WarningNotification = { - readonly message: string; - readonly threadId?: string | null; +export type ServerRequest__FileChangeRequestApprovalParams = { + readonly grantRoot?: string | null; + readonly itemId: string; + readonly reason?: string | null; + readonly startedAtMs: number; + readonly threadId: string; + readonly turnId: string; }; -export const ServerNotification__WarningNotification = Schema.Struct({ - message: Schema.String.annotate({ description: "Concise warning message for the user." }), - threadId: Schema.optionalKey( +export const ServerRequest__FileChangeRequestApprovalParams = Schema.Struct({ + grantRoot: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Optional thread target when the warning applies to a specific thread.", + description: + "[UNSTABLE] When set, the agent is asking the user to allow writes under this root for the remainder of the session (unclear if this is honored today).", }), Schema.Null, ]), ), -}); + itemId: Schema.String, + reason: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional explanatory reason (e.g. request for extra write access).", + }), + Schema.Null, + ]), + ), + startedAtMs: Schema.Number.annotate({ + description: "Unix timestamp (in milliseconds) when this approval request started.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerRequest__FileChangeRequestApprovalParams" }); -export type ServerNotification__WebSearchAction = - | { - readonly queries?: ReadonlyArray | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly type: "openPage"; readonly url?: string | null } - | { readonly pattern?: string | null; readonly type: "findInPage"; readonly url?: string | null } - | { readonly type: "other" }; -export const ServerNotification__WebSearchAction = Schema.Union( - [ - Schema.Struct({ - queries: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchWebSearchActionType" }), - }).annotate({ title: "SearchWebSearchAction" }), - Schema.Struct({ - type: Schema.Literal("openPage").annotate({ title: "OpenPageWebSearchActionType" }), - url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - }).annotate({ title: "OpenPageWebSearchAction" }), - Schema.Struct({ - pattern: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("findInPage").annotate({ title: "FindInPageWebSearchActionType" }), - url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - }).annotate({ title: "FindInPageWebSearchAction" }), - Schema.Struct({ - type: Schema.Literal("other").annotate({ title: "OtherWebSearchActionType" }), - }).annotate({ title: "OtherWebSearchAction" }), - ], - { mode: "oneOf" }, -); +export type ServerRequest__ToolRequestUserInputOption = { + readonly description: string; + readonly label: string; +}; +export const ServerRequest__ToolRequestUserInputOption = Schema.Struct({ + description: Schema.String, + label: Schema.String, +}).annotate({ + description: "EXPERIMENTAL. Defines a single selectable option for request_user_input.", + identifier: "ServerRequest__ToolRequestUserInputOption", +}); -export type ServerNotification__WindowsSandboxSetupMode = "elevated" | "unelevated"; -export const ServerNotification__WindowsSandboxSetupMode = Schema.Literals([ - "elevated", - "unelevated", -]); +export type ServerRequest__McpElicitationStringType = "string"; +export const ServerRequest__McpElicitationStringType = Schema.Literal("string").annotate({ + identifier: "ServerRequest__McpElicitationStringType", +}); -export type ServerNotification__WindowsWorldWritableWarningNotification = { - readonly extraCount: number; - readonly failedScan: boolean; - readonly samplePaths: ReadonlyArray; +export type ServerRequest__McpElicitationConstOption = { + readonly const: string; + readonly title: string; }; -export const ServerNotification__WindowsWorldWritableWarningNotification = Schema.Struct({ - extraCount: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - failedScan: Schema.Boolean, - samplePaths: Schema.Array(Schema.String), +export const ServerRequest__McpElicitationConstOption = Schema.Struct({ + const: Schema.String, + title: Schema.String, +}).annotate({ identifier: "ServerRequest__McpElicitationConstOption" }); + +export type ServerRequest__McpElicitationArrayType = "array"; +export const ServerRequest__McpElicitationArrayType = Schema.Literal("array").annotate({ + identifier: "ServerRequest__McpElicitationArrayType", }); -export type ServerRequest__AbsolutePathBuf = string; -export const ServerRequest__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", +export type ServerRequest__McpElicitationStringFormat = "email" | "uri" | "date" | "date-time"; +export const ServerRequest__McpElicitationStringFormat = Schema.Literals([ + "email", + "uri", + "date", + "date-time", +]).annotate({ identifier: "ServerRequest__McpElicitationStringFormat" }); + +export type ServerRequest__McpElicitationNumberType = "number" | "integer"; +export const ServerRequest__McpElicitationNumberType = Schema.Literals([ + "number", + "integer", +]).annotate({ identifier: "ServerRequest__McpElicitationNumberType" }); + +export type ServerRequest__McpElicitationBooleanType = "boolean"; +export const ServerRequest__McpElicitationBooleanType = Schema.Literal("boolean").annotate({ + identifier: "ServerRequest__McpElicitationBooleanType", }); -export type ServerRequest__AdditionalNetworkPermissions = { readonly enabled?: boolean | null }; -export const ServerRequest__AdditionalNetworkPermissions = Schema.Struct({ - enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), +export type ServerRequest__McpElicitationObjectType = "object"; +export const ServerRequest__McpElicitationObjectType = Schema.Literal("object").annotate({ + identifier: "ServerRequest__McpElicitationObjectType", }); -export type ServerRequest__AttestationGenerateParams = {}; -export const ServerRequest__AttestationGenerateParams = Schema.Struct({}); +export type ServerRequest__FileSystemAccessMode = "read" | "write" | "deny"; +export const ServerRequest__FileSystemAccessMode = Schema.Literals([ + "read", + "write", + "deny", +]).annotate({ identifier: "ServerRequest__FileSystemAccessMode" }); -export type ServerRequest__ChatgptAuthTokensRefreshReason = "unauthorized"; -export const ServerRequest__ChatgptAuthTokensRefreshReason = Schema.Literal("unauthorized"); +export type ServerRequest__AdditionalNetworkPermissions = { readonly enabled?: boolean | null }; +export const ServerRequest__AdditionalNetworkPermissions = Schema.Struct({ + enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), +}).annotate({ identifier: "ServerRequest__AdditionalNetworkPermissions" }); export type ServerRequest__DynamicToolCallParams = { - readonly arguments: unknown; + readonly arguments: Schema.Json; readonly callId: string; readonly namespace?: string | null; readonly threadId: string; @@ -2999,12 +3471,33 @@ export type ServerRequest__DynamicToolCallParams = { readonly turnId: string; }; export const ServerRequest__DynamicToolCallParams = Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), callId: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), threadId: Schema.String, tool: Schema.String, turnId: Schema.String, +}).annotate({ identifier: "ServerRequest__DynamicToolCallParams" }); + +export type ServerRequest__ChatgptAuthTokensRefreshReason = "unauthorized"; +export const ServerRequest__ChatgptAuthTokensRefreshReason = Schema.Union( + [ + Schema.Literal("unauthorized").annotate({ + description: "Codex attempted a backend request and received `401 Unauthorized`.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerRequest__ChatgptAuthTokensRefreshReason" }); + +export type ServerRequest__AttestationGenerateParams = { readonly [x: string]: Schema.Json }; +export const ServerRequest__AttestationGenerateParams = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ identifier: "ServerRequest__AttestationGenerateParams" }); + +export type ServerRequest__ThreadId = string; +export const ServerRequest__ThreadId = Schema.String.annotate({ + identifier: "ServerRequest__ThreadId", }); export type ServerRequest__FileChange = @@ -3028,91 +3521,7 @@ export const ServerRequest__FileChange = Schema.Union( }).annotate({ title: "UpdateFileChange" }), ], { mode: "oneOf" }, -); - -export type ServerRequest__FileChangeRequestApprovalParams = { - readonly grantRoot?: string | null; - readonly itemId: string; - readonly reason?: string | null; - readonly startedAtMs: number; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerRequest__FileChangeRequestApprovalParams = Schema.Struct({ - grantRoot: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "[UNSTABLE] When set, the agent is asking the user to allow writes under this root for the remainder of the session (unclear if this is honored today).", - }), - Schema.Null, - ]), - ), - itemId: Schema.String, - reason: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional explanatory reason (e.g. request for extra write access).", - }), - Schema.Null, - ]), - ), - startedAtMs: Schema.Number.annotate({ - description: "Unix timestamp (in milliseconds) when this approval request started.", - format: "int64", - }).check(Schema.isInt()), - threadId: Schema.String, - turnId: Schema.String, -}); - -export type ServerRequest__FileSystemAccessMode = "read" | "write" | "deny"; -export const ServerRequest__FileSystemAccessMode = Schema.Literals(["read", "write", "deny"]); - -export type ServerRequest__LegacyAppPathString = string; -export const ServerRequest__LegacyAppPathString = Schema.String; - -export type ServerRequest__McpElicitationArrayType = "array"; -export const ServerRequest__McpElicitationArrayType = Schema.Literal("array"); - -export type ServerRequest__McpElicitationBooleanType = "boolean"; -export const ServerRequest__McpElicitationBooleanType = Schema.Literal("boolean"); - -export type ServerRequest__McpElicitationConstOption = { - readonly const: string; - readonly title: string; -}; -export const ServerRequest__McpElicitationConstOption = Schema.Struct({ - const: Schema.String, - title: Schema.String, -}); - -export type ServerRequest__McpElicitationNumberType = "number" | "integer"; -export const ServerRequest__McpElicitationNumberType = Schema.Literals(["number", "integer"]); - -export type ServerRequest__McpElicitationObjectType = "object"; -export const ServerRequest__McpElicitationObjectType = Schema.Literal("object"); - -export type ServerRequest__McpElicitationStringFormat = "email" | "uri" | "date" | "date-time"; -export const ServerRequest__McpElicitationStringFormat = Schema.Literals([ - "email", - "uri", - "date", - "date-time", -]); - -export type ServerRequest__McpElicitationStringType = "string"; -export const ServerRequest__McpElicitationStringType = Schema.Literal("string"); - -export type ServerRequest__NetworkApprovalProtocol = "http" | "https" | "socks5Tcp" | "socks5Udp"; -export const ServerRequest__NetworkApprovalProtocol = Schema.Literals([ - "http", - "https", - "socks5Tcp", - "socks5Udp", -]); - -export type ServerRequest__NetworkPolicyRuleAction = "allow" | "deny"; -export const ServerRequest__NetworkPolicyRuleAction = Schema.Literals(["allow", "deny"]); +).annotate({ identifier: "ServerRequest__FileChange" }); export type ServerRequest__ParsedCommand = | { readonly cmd: string; readonly name: string; readonly path: string; readonly type: "read" } @@ -3152,27 +3561,7 @@ export const ServerRequest__ParsedCommand = Schema.Union( }).annotate({ title: "UnknownParsedCommand" }), ], { mode: "oneOf" }, -); - -export type ServerRequest__RequestId = string | number; -export const ServerRequest__RequestId = Schema.Union([ - Schema.String, - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -]); - -export type ServerRequest__ThreadId = string; -export const ServerRequest__ThreadId = Schema.String; - -export type ServerRequest__ToolRequestUserInputOption = { - readonly description: string; - readonly label: string; -}; -export const ServerRequest__ToolRequestUserInputOption = Schema.Struct({ - description: Schema.String, - label: Schema.String, -}).annotate({ - description: "EXPERIMENTAL. Defines a single selectable option for request_user_input.", -}); +).annotate({ identifier: "ServerRequest__ParsedCommand" }); export type ToolRequestUserInputParams__ToolRequestUserInputOption = { readonly description: string; @@ -3183,6 +3572,7 @@ export const ToolRequestUserInputParams__ToolRequestUserInputOption = Schema.Str label: Schema.String, }).annotate({ description: "EXPERIMENTAL. Defines a single selectable option for request_user_input.", + identifier: "ToolRequestUserInputParams__ToolRequestUserInputOption", }); export type ToolRequestUserInputResponse__ToolRequestUserInputAnswer = { @@ -3192,17 +3582,7 @@ export const ToolRequestUserInputResponse__ToolRequestUserInputAnswer = Schema.S answers: Schema.Array(Schema.String), }).annotate({ description: "EXPERIMENTAL. Captures a user's answer to a request_user_input question.", -}); - -export type V1InitializeParams__ClientInfo = { - readonly name: string; - readonly title?: string | null; - readonly version: string; -}; -export const V1InitializeParams__ClientInfo = Schema.Struct({ - name: Schema.String, - title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - version: Schema.String, + identifier: "ToolRequestUserInputResponse__ToolRequestUserInputAnswer", }); export type V1InitializeParams__InitializeCapabilities = { @@ -3238,7 +3618,28 @@ export const V1InitializeParams__InitializeCapabilities = Schema.Struct({ default: false, }), ), -}).annotate({ description: "Client-declared capabilities negotiated during initialize." }); +}).annotate({ + description: "Client-declared capabilities negotiated during initialize.", + identifier: "V1InitializeParams__InitializeCapabilities", +}); + +export type V1InitializeParams__ClientInfo = { + readonly name: string; + readonly title?: string | null; + readonly version: string; +}; +export const V1InitializeParams__ClientInfo = Schema.Struct({ + name: Schema.String, + title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + version: Schema.String, +}).annotate({ identifier: "V1InitializeParams__ClientInfo" }); + +export type V1InitializeResponse__AbsolutePathBuf = string; +export const V1InitializeResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V1InitializeResponse__AbsolutePathBuf", +}); export type V2AccountRateLimitsUpdatedNotification__CreditsSnapshot = { readonly balance?: string | null; @@ -3249,7 +3650,24 @@ export const V2AccountRateLimitsUpdatedNotification__CreditsSnapshot = Schema.St balance: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), hasCredits: Schema.Boolean, unlimited: Schema.Boolean, -}); +}).annotate({ identifier: "V2AccountRateLimitsUpdatedNotification__CreditsSnapshot" }); + +export type V2AccountRateLimitsUpdatedNotification__SpendControlLimitSnapshot = { + readonly limit: string; + readonly remainingPercent: number; + readonly resetsAt: number; + readonly used: string; +}; +export const V2AccountRateLimitsUpdatedNotification__SpendControlLimitSnapshot = Schema.Struct({ + limit: Schema.String, + remainingPercent: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + resetsAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + used: Schema.String, +}).annotate({ identifier: "V2AccountRateLimitsUpdatedNotification__SpendControlLimitSnapshot" }); export type V2AccountRateLimitsUpdatedNotification__PlanType = | "free" @@ -3287,7 +3705,34 @@ export const V2AccountRateLimitsUpdatedNotification__PlanType = Schema.Literals( "edu_plus", "edu_pro", "unknown", -]); +]).annotate({ identifier: "V2AccountRateLimitsUpdatedNotification__PlanType" }); + +export type V2AccountRateLimitsUpdatedNotification__RateLimitWindow = { + readonly resetsAt?: number | null; + readonly usedPercent: number; + readonly windowDurationMins?: number | null; +}; +export const V2AccountRateLimitsUpdatedNotification__RateLimitWindow = Schema.Struct({ + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + usedPercent: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + windowDurationMins: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2AccountRateLimitsUpdatedNotification__RateLimitWindow" }); export type V2AccountRateLimitsUpdatedNotification__RateLimitReachedType = | "rate_limit_reached" @@ -3301,35 +3746,7 @@ export const V2AccountRateLimitsUpdatedNotification__RateLimitReachedType = Sche "workspace_member_credits_depleted", "workspace_owner_usage_limit_reached", "workspace_member_usage_limit_reached", -]); - -export type V2AccountRateLimitsUpdatedNotification__RateLimitWindow = { - readonly resetsAt?: number | null; - readonly usedPercent: number; - readonly windowDurationMins?: number | null; -}; -export const V2AccountRateLimitsUpdatedNotification__RateLimitWindow = Schema.Struct({ - resetsAt: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), - usedPercent: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - windowDurationMins: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), -}); - -export type V2AccountRateLimitsUpdatedNotification__SpendControlLimitSnapshot = { - readonly limit: string; - readonly remainingPercent: number; - readonly resetsAt: number; - readonly used: string; -}; -export const V2AccountRateLimitsUpdatedNotification__SpendControlLimitSnapshot = Schema.Struct({ - limit: Schema.String, - remainingPercent: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - resetsAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - used: Schema.String, -}); +]).annotate({ identifier: "V2AccountRateLimitsUpdatedNotification__RateLimitReachedType" }); export type V2AccountUpdatedNotification__AuthMode = | "apikey" @@ -3339,15 +3756,36 @@ export type V2AccountUpdatedNotification__AuthMode = | "agentIdentity" | "personalAccessToken" | "bedrockApiKey"; -export const V2AccountUpdatedNotification__AuthMode = Schema.Literals([ - "apikey", - "chatgpt", - "chatgptAuthTokens", - "headers", - "agentIdentity", - "personalAccessToken", - "bedrockApiKey", -]).annotate({ description: "Authentication mode for OpenAI-backed providers." }); +export const V2AccountUpdatedNotification__AuthMode = Schema.Union( + [ + Schema.Literal("apikey").annotate({ + description: "OpenAI API key provided by the caller and stored by Codex.", + }), + Schema.Literal("chatgpt").annotate({ + description: "ChatGPT OAuth managed by Codex (tokens persisted and refreshed by Codex).", + }), + Schema.Literal("chatgptAuthTokens").annotate({ + description: + "[UNSTABLE] FOR OPENAI INTERNAL USE ONLY - DO NOT USE.\n\nChatGPT auth tokens are supplied by an external host app and are only stored in memory. Token refresh must be handled by the external host app.", + }), + Schema.Literal("headers").annotate({ + description: "Backend auth supplied as request headers.", + }), + Schema.Literal("agentIdentity").annotate({ + description: "Programmatic Codex auth backed by a registered Agent Identity.", + }), + Schema.Literal("personalAccessToken").annotate({ + description: "Programmatic Codex auth backed by a personal access token.", + }), + Schema.Literal("bedrockApiKey").annotate({ + description: "Amazon Bedrock bearer token managed by Codex.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: "Authentication mode for OpenAI-backed providers.", + identifier: "V2AccountUpdatedNotification__AuthMode", +}); export type V2AccountUpdatedNotification__PlanType = | "free" @@ -3385,7 +3823,23 @@ export const V2AccountUpdatedNotification__PlanType = Schema.Literals([ "edu_plus", "edu_pro", "unknown", -]); +]).annotate({ identifier: "V2AccountUpdatedNotification__PlanType" }); + +export type V2AppListUpdatedNotification__AppReview = { readonly status: string }; +export const V2AppListUpdatedNotification__AppReview = Schema.Struct({ + status: Schema.String, +}).annotate({ identifier: "V2AppListUpdatedNotification__AppReview" }); + +export type V2AppListUpdatedNotification__AppScreenshot = { + readonly fileId?: string | null; + readonly url?: string | null; + readonly userPrompt: string; +}; +export const V2AppListUpdatedNotification__AppScreenshot = Schema.Struct({ + fileId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + userPrompt: Schema.String, +}).annotate({ identifier: "V2AppListUpdatedNotification__AppScreenshot" }); export type V2AppListUpdatedNotification__AppBranding = { readonly category?: string | null; @@ -3402,20 +3856,9 @@ export const V2AppListUpdatedNotification__AppBranding = Schema.Struct({ privacyPolicy: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), termsOfService: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), website: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ description: "EXPERIMENTAL - app metadata returned by app-list APIs." }); - -export type V2AppListUpdatedNotification__AppReview = { readonly status: string }; -export const V2AppListUpdatedNotification__AppReview = Schema.Struct({ status: Schema.String }); - -export type V2AppListUpdatedNotification__AppScreenshot = { - readonly fileId?: string | null; - readonly url?: string | null; - readonly userPrompt: string; -}; -export const V2AppListUpdatedNotification__AppScreenshot = Schema.Struct({ - fileId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - userPrompt: Schema.String, +}).annotate({ + description: "EXPERIMENTAL - app metadata returned by app-list APIs.", + identifier: "V2AppListUpdatedNotification__AppBranding", }); export type V2AppsInstalledResponse__InstalledApp = { @@ -3443,7 +3886,26 @@ export const V2AppsInstalledResponse__InstalledApp = Schema.Struct({ Schema.Null, ]), ), -}).annotate({ description: "Installed connector runtime state." }); +}).annotate({ + description: "Installed connector runtime state.", + identifier: "V2AppsInstalledResponse__InstalledApp", +}); + +export type V2AppsListResponse__AppReview = { readonly status: string }; +export const V2AppsListResponse__AppReview = Schema.Struct({ status: Schema.String }).annotate({ + identifier: "V2AppsListResponse__AppReview", +}); + +export type V2AppsListResponse__AppScreenshot = { + readonly fileId?: string | null; + readonly url?: string | null; + readonly userPrompt: string; +}; +export const V2AppsListResponse__AppScreenshot = Schema.Struct({ + fileId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + userPrompt: Schema.String, +}).annotate({ identifier: "V2AppsListResponse__AppScreenshot" }); export type V2AppsListResponse__AppBranding = { readonly category?: string | null; @@ -3460,20 +3922,9 @@ export const V2AppsListResponse__AppBranding = Schema.Struct({ privacyPolicy: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), termsOfService: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), website: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ description: "EXPERIMENTAL - app metadata returned by app-list APIs." }); - -export type V2AppsListResponse__AppReview = { readonly status: string }; -export const V2AppsListResponse__AppReview = Schema.Struct({ status: Schema.String }); - -export type V2AppsListResponse__AppScreenshot = { - readonly fileId?: string | null; - readonly url?: string | null; - readonly userPrompt: string; -}; -export const V2AppsListResponse__AppScreenshot = Schema.Struct({ - fileId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - userPrompt: Schema.String, +}).annotate({ + description: "EXPERIMENTAL - app metadata returned by app-list APIs.", + identifier: "V2AppsListResponse__AppBranding", }); export type V2AppsReadResponse__AppToolSummary = { @@ -3485,18 +3936,42 @@ export const V2AppsReadResponse__AppToolSummary = Schema.Struct({ description: Schema.String, name: Schema.String, title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ description: "EXPERIMENTAL - metadata returned by app/read." }); +}).annotate({ + description: "EXPERIMENTAL - metadata returned by app/read.", + identifier: "V2AppsReadResponse__AppToolSummary", +}); export type V2CancelLoginAccountResponse__CancelLoginAccountStatus = "canceled" | "notFound"; export const V2CancelLoginAccountResponse__CancelLoginAccountStatus = Schema.Literals([ "canceled", "notFound", -]); +]).annotate({ identifier: "V2CancelLoginAccountResponse__CancelLoginAccountStatus" }); + +export type V2CommandExecOutputDeltaNotification__CommandExecOutputStream = "stdout" | "stderr"; +export const V2CommandExecOutputDeltaNotification__CommandExecOutputStream = Schema.Union( + [ + Schema.Literal("stdout").annotate({ + description: "stdout stream. PTY mode multiplexes terminal output here.", + }), + Schema.Literal("stderr").annotate({ description: "stderr stream." }), + ], + { mode: "oneOf" }, +).annotate({ + description: "Stream label for `command/exec/outputDelta` notifications.", + identifier: "V2CommandExecOutputDeltaNotification__CommandExecOutputStream", +}); + +export type V2CommandExecParams__NetworkAccess = "restricted" | "enabled"; +export const V2CommandExecParams__NetworkAccess = Schema.Literals([ + "restricted", + "enabled", +]).annotate({ identifier: "V2CommandExecParams__NetworkAccess" }); export type V2CommandExecParams__AbsolutePathBuf = string; export const V2CommandExecParams__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2CommandExecParams__AbsolutePathBuf", }); export type V2CommandExecParams__CommandExecTerminalSize = { @@ -3508,54 +3983,62 @@ export const V2CommandExecParams__CommandExecTerminalSize = Schema.Struct({ description: "Terminal width in character cells.", format: "uint16", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), rows: Schema.Number.annotate({ description: "Terminal height in character cells.", format: "uint16", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}).annotate({ description: "PTY size in character cells for `command/exec` PTY sessions." }); - -export type V2ConfigBatchWriteParams__MergeStrategy = "replace" | "upsert"; -export const V2ConfigBatchWriteParams__MergeStrategy = Schema.Literals(["replace", "upsert"]); + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ + description: "PTY size in character cells for `command/exec` PTY sessions.", + identifier: "V2CommandExecParams__CommandExecTerminalSize", +}); -export type V2ConfigReadResponse__AbsolutePathBuf = string; -export const V2ConfigReadResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", +export type V2CommandExecResizeParams__CommandExecTerminalSize = { + readonly cols: number; + readonly rows: number; +}; +export const V2CommandExecResizeParams__CommandExecTerminalSize = Schema.Struct({ + cols: Schema.Number.annotate({ + description: "Terminal width in character cells.", + format: "uint16", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + rows: Schema.Number.annotate({ + description: "Terminal height in character cells.", + format: "uint16", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ + description: "PTY size in character cells for `command/exec` PTY sessions.", + identifier: "V2CommandExecResizeParams__CommandExecTerminalSize", }); -export type V2ConfigReadResponse__AnalyticsConfig = { - readonly enabled?: boolean | null; - readonly [x: string]: unknown; +export type V2ConfigBatchWriteParams__MergeStrategy = "replace" | "upsert"; +export const V2ConfigBatchWriteParams__MergeStrategy = Schema.Literals([ + "replace", + "upsert", +]).annotate({ identifier: "V2ConfigBatchWriteParams__MergeStrategy" }); + +export type V2ConfigReadResponse__AnalyticsConfig = { readonly enabled?: boolean | null } & { + readonly [x: string]: Schema.Json; }; export const V2ConfigReadResponse__AnalyticsConfig = Schema.StructWithRest( Schema.Struct({ enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])) }), - [Schema.Record(Schema.String, Schema.Unknown)], -); - -export type V2ConfigReadResponse__AppToolApproval = "auto" | "prompt" | "writes" | "approve"; -export const V2ConfigReadResponse__AppToolApproval = Schema.Literals([ - "auto", - "prompt", - "writes", - "approve", -]); - -export type V2ConfigReadResponse__AppToolsConfig = {}; -export const V2ConfigReadResponse__AppToolsConfig = Schema.Struct({}); - -export type V2ConfigReadResponse__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; -export const V2ConfigReadResponse__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", -}); + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], +).annotate({ identifier: "V2ConfigReadResponse__AnalyticsConfig" }); export type V2ConfigReadResponse__AskForApproval = | "untrusted" @@ -3584,15 +4067,17 @@ export const V2ConfigReadResponse__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ConfigReadResponse__AskForApproval" }); -export type V2ConfigReadResponse__AutoCompactTokenLimitScope = "total" | "body_after_prefix"; -export const V2ConfigReadResponse__AutoCompactTokenLimitScope = Schema.Literals([ - "total", - "body_after_prefix", +export type V2ConfigReadResponse__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; +export const V2ConfigReadResponse__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", ]).annotate({ description: - "Selects which part of the active context is charged against `model_auto_compact_token_limit`.", + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "V2ConfigReadResponse__ApprovalsReviewer", }); export type V2ConfigReadResponse__ForcedChatgptWorkspaceIds = string | ReadonlyArray; @@ -3601,15 +4086,40 @@ export const V2ConfigReadResponse__ForcedChatgptWorkspaceIds = Schema.Union([ Schema.Array(Schema.String), ]).annotate({ description: "Backward-compatible API shape for ChatGPT workspace login restrictions.", + identifier: "V2ConfigReadResponse__ForcedChatgptWorkspaceIds", }); export type V2ConfigReadResponse__ForcedLoginMethod = "chatgpt" | "api"; -export const V2ConfigReadResponse__ForcedLoginMethod = Schema.Literals(["chatgpt", "api"]); +export const V2ConfigReadResponse__ForcedLoginMethod = Schema.Literals(["chatgpt", "api"]).annotate( + { identifier: "V2ConfigReadResponse__ForcedLoginMethod" }, +); + +export type V2ConfigReadResponse__AutoCompactTokenLimitScope = "total" | "body_after_prefix"; +export const V2ConfigReadResponse__AutoCompactTokenLimitScope = Schema.Union( + [ + Schema.Literal("total").annotate({ + description: "Count the full active context against the limit.", + }), + Schema.Literal("body_after_prefix").annotate({ + description: "Count sampled output and later growth after the carried window prefix.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Selects which part of the active context is charged against `model_auto_compact_token_limit`.", + identifier: "V2ConfigReadResponse__AutoCompactTokenLimitScope", +}); export type V2ConfigReadResponse__ReasoningEffort = string; export const V2ConfigReadResponse__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ConfigReadResponse__ReasoningEffort", + }), +); export type V2ConfigReadResponse__ReasoningSummary = "auto" | "concise" | "detailed" | "none"; export const V2ConfigReadResponse__ReasoningSummary = Schema.Union( @@ -3621,6 +4131,14 @@ export const V2ConfigReadResponse__ReasoningSummary = Schema.Union( ).annotate({ description: "A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries", + identifier: "V2ConfigReadResponse__ReasoningSummary", +}); + +export type V2ConfigReadResponse__Verbosity = "low" | "medium" | "high"; +export const V2ConfigReadResponse__Verbosity = Schema.Literals(["low", "medium", "high"]).annotate({ + description: + "Controls output length/detail on GPT-5 models via the Responses API. Serialized with lowercase values to match the OpenAI API.", + identifier: "V2ConfigReadResponse__Verbosity", }); export type V2ConfigReadResponse__SandboxMode = @@ -3631,7 +4149,7 @@ export const V2ConfigReadResponse__SandboxMode = Schema.Literals([ "read-only", "workspace-write", "danger-full-access", -]); +]).annotate({ identifier: "V2ConfigReadResponse__SandboxMode" }); export type V2ConfigReadResponse__SandboxWorkspaceWrite = { readonly exclude_slash_tmp?: boolean; @@ -3644,20 +4162,14 @@ export const V2ConfigReadResponse__SandboxWorkspaceWrite = Schema.Struct({ exclude_tmpdir_env_var: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), network_access: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), writable_roots: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), -}); - -export type V2ConfigReadResponse__Verbosity = "low" | "medium" | "high"; -export const V2ConfigReadResponse__Verbosity = Schema.Literals(["low", "medium", "high"]).annotate({ - description: - "Controls output length/detail on GPT-5 models via the Responses API. Serialized with lowercase values to match the OpenAI API.", -}); +}).annotate({ identifier: "V2ConfigReadResponse__SandboxWorkspaceWrite" }); export type V2ConfigReadResponse__WebSearchContextSize = "low" | "medium" | "high"; export const V2ConfigReadResponse__WebSearchContextSize = Schema.Literals([ "low", "medium", "high", -]); +]).annotate({ identifier: "V2ConfigReadResponse__WebSearchContextSize" }); export type V2ConfigReadResponse__WebSearchLocation = { readonly city?: string | null; @@ -3670,7 +4182,7 @@ export const V2ConfigReadResponse__WebSearchLocation = Schema.Struct({ country: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), region: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), timezone: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2ConfigReadResponse__WebSearchLocation" }); export type V2ConfigReadResponse__WebSearchMode = "disabled" | "cached" | "indexed" | "live"; export const V2ConfigReadResponse__WebSearchMode = Schema.Literals([ @@ -3678,7 +4190,28 @@ export const V2ConfigReadResponse__WebSearchMode = Schema.Literals([ "cached", "indexed", "live", -]); +]).annotate({ identifier: "V2ConfigReadResponse__WebSearchMode" }); + +export type V2ConfigReadResponse__AbsolutePathBuf = string; +export const V2ConfigReadResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ConfigReadResponse__AbsolutePathBuf", +}); + +export type V2ConfigReadResponse__AppToolApproval = "auto" | "prompt" | "writes" | "approve"; +export const V2ConfigReadResponse__AppToolApproval = Schema.Literals([ + "auto", + "prompt", + "writes", + "approve", +]).annotate({ identifier: "V2ConfigReadResponse__AppToolApproval" }); + +export type V2ConfigReadResponse__AppToolsConfig = { readonly [x: string]: Schema.Json }; +export const V2ConfigReadResponse__AppToolsConfig = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ identifier: "V2ConfigReadResponse__AppToolsConfig" }); export type V2ConfigRequirementsReadResponse__AskForApproval = | "untrusted" @@ -3707,14 +4240,57 @@ export const V2ConfigRequirementsReadResponse__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ConfigRequirementsReadResponse__AskForApproval" }); + +export type V2ConfigRequirementsReadResponse__SandboxMode = + | "read-only" + | "workspace-write" + | "danger-full-access"; +export const V2ConfigRequirementsReadResponse__SandboxMode = Schema.Literals([ + "read-only", + "workspace-write", + "danger-full-access", +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__SandboxMode" }); + +export type V2ConfigRequirementsReadResponse__WebSearchMode = + | "disabled" + | "cached" + | "indexed" + | "live"; +export const V2ConfigRequirementsReadResponse__WebSearchMode = Schema.Literals([ + "disabled", + "cached", + "indexed", + "live", +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__WebSearchMode" }); + +export type V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode = "elevated" | "unelevated"; +export const V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode = Schema.Literals([ + "elevated", + "unelevated", +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode" }); export type V2ConfigRequirementsReadResponse__ComputerUseRequirements = { readonly allowLockedComputerUse?: boolean | null; }; export const V2ConfigRequirementsReadResponse__ComputerUseRequirements = Schema.Struct({ allowLockedComputerUse: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), -}); +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ComputerUseRequirements" }); + +export type V2ConfigRequirementsReadResponse__ResidencyRequirement = "us"; +export const V2ConfigRequirementsReadResponse__ResidencyRequirement = Schema.Literal("us").annotate( + { identifier: "V2ConfigRequirementsReadResponse__ResidencyRequirement" }, +); + +export type V2ConfigRequirementsReadResponse__ReasoningEffort = string; +export const V2ConfigRequirementsReadResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ConfigRequirementsReadResponse__ReasoningEffort", + }), +); export type V2ConfigRequirementsReadResponse__ConfiguredHookHandler = | { @@ -3737,8 +4313,12 @@ export const V2ConfigRequirementsReadResponse__ConfiguredHookHandler = Schema.Un timeoutSec: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -3752,58 +4332,25 @@ export const V2ConfigRequirementsReadResponse__ConfiguredHookHandler = Schema.Un }).annotate({ title: "AgentConfiguredHookHandler" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ConfigRequirementsReadResponse__ConfiguredHookHandler" }); export type V2ConfigRequirementsReadResponse__NetworkDomainPermission = "allow" | "deny"; export const V2ConfigRequirementsReadResponse__NetworkDomainPermission = Schema.Literals([ "allow", "deny", -]); +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__NetworkDomainPermission" }); export type V2ConfigRequirementsReadResponse__NetworkUnixSocketPermission = "allow" | "deny"; export const V2ConfigRequirementsReadResponse__NetworkUnixSocketPermission = Schema.Literals([ "allow", "deny", -]); - -export type V2ConfigRequirementsReadResponse__ReasoningEffort = string; -export const V2ConfigRequirementsReadResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); - -export type V2ConfigRequirementsReadResponse__ResidencyRequirement = "us"; -export const V2ConfigRequirementsReadResponse__ResidencyRequirement = Schema.Literal("us"); - -export type V2ConfigRequirementsReadResponse__SandboxMode = - | "read-only" - | "workspace-write" - | "danger-full-access"; -export const V2ConfigRequirementsReadResponse__SandboxMode = Schema.Literals([ - "read-only", - "workspace-write", - "danger-full-access", -]); - -export type V2ConfigRequirementsReadResponse__WebSearchMode = - | "disabled" - | "cached" - | "indexed" - | "live"; -export const V2ConfigRequirementsReadResponse__WebSearchMode = Schema.Literals([ - "disabled", - "cached", - "indexed", - "live", -]); - -export type V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode = "elevated" | "unelevated"; -export const V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode = Schema.Literals([ - "elevated", - "unelevated", -]); +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__NetworkUnixSocketPermission" }); export type V2ConfigValueWriteParams__MergeStrategy = "replace" | "upsert"; -export const V2ConfigValueWriteParams__MergeStrategy = Schema.Literals(["replace", "upsert"]); +export const V2ConfigValueWriteParams__MergeStrategy = Schema.Literals([ + "replace", + "upsert", +]).annotate({ identifier: "V2ConfigValueWriteParams__MergeStrategy" }); export type V2ConfigWarningNotification__TextPosition = { readonly column: number; @@ -3814,21 +4361,28 @@ export const V2ConfigWarningNotification__TextPosition = Schema.Struct({ description: "1-based column number (in Unicode scalar values).", format: "uint", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), line: Schema.Number.annotate({ description: "1-based line number.", format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ConfigWarningNotification__TextPosition" }); export type V2ConfigWriteResponse__AbsolutePathBuf = string; export const V2ConfigWriteResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ConfigWriteResponse__AbsolutePathBuf", }); export type V2ConfigWriteResponse__WriteStatus = "ok" | "okOverridden"; -export const V2ConfigWriteResponse__WriteStatus = Schema.Literals(["ok", "okOverridden"]); +export const V2ConfigWriteResponse__WriteStatus = Schema.Literals(["ok", "okOverridden"]).annotate({ + identifier: "V2ConfigWriteResponse__WriteStatus", +}); export type V2ConsumeAccountRateLimitResetCreditResponse__ConsumeAccountRateLimitResetCreditOutcome = | "reset" @@ -3836,101 +4390,72 @@ export type V2ConsumeAccountRateLimitResetCreditResponse__ConsumeAccountRateLimi | "noCredit" | "alreadyRedeemed"; export const V2ConsumeAccountRateLimitResetCreditResponse__ConsumeAccountRateLimitResetCreditOutcome = - Schema.Literals(["reset", "nothingToReset", "noCredit", "alreadyRedeemed"]); - -export type V2ErrorNotification__NonSteerableTurnKind = "review" | "compact"; -export const V2ErrorNotification__NonSteerableTurnKind = Schema.Literals(["review", "compact"]); - -export type V2ExperimentalFeatureListResponse__ExperimentalFeature = { - readonly announcement?: string | null; - readonly defaultEnabled: boolean; - readonly description?: string | null; - readonly displayName?: string | null; - readonly enabled: boolean; - readonly name: string; - readonly stage: "beta" | "underDevelopment" | "stable" | "deprecated" | "removed"; -}; -export const V2ExperimentalFeatureListResponse__ExperimentalFeature = Schema.Struct({ - announcement: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Announcement copy shown to users when the feature is introduced. Null when this feature is not in beta.", + Schema.Union( + [ + Schema.Literal("reset").annotate({ + description: "A reset credit was consumed and the eligible rate-limit windows were reset.", }), - Schema.Null, - ]), - ), - defaultEnabled: Schema.Boolean.annotate({ - description: "Whether this feature is enabled by default.", - }), - description: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Short summary describing what the feature does. Null when this feature is not in beta.", + Schema.Literal("nothingToReset").annotate({ + description: "No current rate-limit window is eligible for a reset.", }), - Schema.Null, - ]), - ), - displayName: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "User-facing display name shown in the experimental features UI. Null when this feature is not in beta.", + Schema.Literal("noCredit").annotate({ + description: "The account has no earned reset credits available.", }), - Schema.Null, - ]), - ), - enabled: Schema.Boolean.annotate({ - description: "Whether this feature is currently enabled in the loaded config.", - }), - name: Schema.String.annotate({ - description: "Stable key used in config.toml and CLI flag toggles.", - }), - stage: Schema.Literals(["beta", "underDevelopment", "stable", "deprecated", "removed"]).annotate({ - description: "Lifecycle stage of this feature flag.", - }), -}); + Schema.Literal("alreadyRedeemed").annotate({ + description: "The same idempotency key already completed a reset successfully.", + }), + ], + { mode: "oneOf" }, + ).annotate({ + identifier: + "V2ConsumeAccountRateLimitResetCreditResponse__ConsumeAccountRateLimitResetCreditOutcome", + }); + +export type V2ErrorNotification__NonSteerableTurnKind = "review" | "compact"; +export const V2ErrorNotification__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ErrorNotification__NonSteerableTurnKind" }); + +export type V2ExperimentalFeatureListResponse__ExperimentalFeatureStage = + | "beta" + | "underDevelopment" + | "stable" + | "deprecated" + | "removed"; +export const V2ExperimentalFeatureListResponse__ExperimentalFeatureStage = Schema.Union( + [ + Schema.Literal("beta").annotate({ + description: "Feature is available for user testing and feedback.", + }), + Schema.Literal("underDevelopment").annotate({ + description: "Feature is still being built and not ready for broad use.", + }), + Schema.Literal("stable").annotate({ description: "Feature is production-ready." }), + Schema.Literal("deprecated").annotate({ + description: "Feature is deprecated and should be avoided.", + }), + Schema.Literal("removed").annotate({ + description: "Feature flag is retained only for backwards compatibility.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ExperimentalFeatureListResponse__ExperimentalFeatureStage" }); export type V2ExternalAgentConfigDetectResponse__CommandMigration = { readonly name: string }; export const V2ExternalAgentConfigDetectResponse__CommandMigration = Schema.Struct({ name: Schema.String, -}); - -export type V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItemType = - | "AGENTS_MD" - | "CONFIG" - | "SKILLS" - | "PLUGINS" - | "MCP_SERVER_CONFIG" - | "SUBAGENTS" - | "HOOKS" - | "COMMANDS" - | "MEMORY" - | "SESSIONS"; -export const V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItemType = - Schema.Literals([ - "AGENTS_MD", - "CONFIG", - "SKILLS", - "PLUGINS", - "MCP_SERVER_CONFIG", - "SUBAGENTS", - "HOOKS", - "COMMANDS", - "MEMORY", - "SESSIONS", - ]); +}).annotate({ identifier: "V2ExternalAgentConfigDetectResponse__CommandMigration" }); export type V2ExternalAgentConfigDetectResponse__HookMigration = { readonly name: string }; export const V2ExternalAgentConfigDetectResponse__HookMigration = Schema.Struct({ name: Schema.String, -}); +}).annotate({ identifier: "V2ExternalAgentConfigDetectResponse__HookMigration" }); export type V2ExternalAgentConfigDetectResponse__McpServerMigration = { readonly name: string }; export const V2ExternalAgentConfigDetectResponse__McpServerMigration = Schema.Struct({ name: Schema.String, -}); +}).annotate({ identifier: "V2ExternalAgentConfigDetectResponse__McpServerMigration" }); export type V2ExternalAgentConfigDetectResponse__PluginsMigration = { readonly marketplaceName: string; @@ -3939,7 +4464,7 @@ export type V2ExternalAgentConfigDetectResponse__PluginsMigration = { export const V2ExternalAgentConfigDetectResponse__PluginsMigration = Schema.Struct({ marketplaceName: Schema.String, pluginNames: Schema.Array(Schema.String), -}); +}).annotate({ identifier: "V2ExternalAgentConfigDetectResponse__PluginsMigration" }); export type V2ExternalAgentConfigDetectResponse__SessionMigration = { readonly cwd: string; @@ -3950,19 +4475,19 @@ export const V2ExternalAgentConfigDetectResponse__SessionMigration = Schema.Stru cwd: Schema.String, path: Schema.String, title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2ExternalAgentConfigDetectResponse__SessionMigration" }); export type V2ExternalAgentConfigDetectResponse__SkillMigration = { readonly name: string }; export const V2ExternalAgentConfigDetectResponse__SkillMigration = Schema.Struct({ name: Schema.String, -}); +}).annotate({ identifier: "V2ExternalAgentConfigDetectResponse__SkillMigration" }); export type V2ExternalAgentConfigDetectResponse__SubagentMigration = { readonly name: string }; export const V2ExternalAgentConfigDetectResponse__SubagentMigration = Schema.Struct({ name: Schema.String, -}); +}).annotate({ identifier: "V2ExternalAgentConfigDetectResponse__SubagentMigration" }); -export type V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType = +export type V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItemType = | "AGENTS_MD" | "CONFIG" | "SKILLS" @@ -3973,7 +4498,7 @@ export type V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfi | "COMMANDS" | "MEMORY" | "SESSIONS"; -export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType = +export const V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItemType = Schema.Literals([ "AGENTS_MD", "CONFIG", @@ -3985,9 +4510,11 @@ export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConf "COMMANDS", "MEMORY", "SESSIONS", - ]); + ]).annotate({ + identifier: "V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItemType", + }); -export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType = +export type V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType = | "AGENTS_MD" | "CONFIG" | "SKILLS" @@ -3998,7 +4525,7 @@ export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfi | "COMMANDS" | "MEMORY" | "SESSIONS"; -export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType = +export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType = Schema.Literals([ "AGENTS_MD", "CONFIG", @@ -4010,19 +4537,20 @@ export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConf "COMMANDS", "MEMORY", "SESSIONS", - ]); + ]).annotate({ + identifier: + "V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType", + }); export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorSource = "remoteMcpServersConfig"; export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorSource = - Schema.Literal("remoteMcpServersConfig"); - -export type V2ExternalAgentConfigImportParams__CommandMigration = { readonly name: string }; -export const V2ExternalAgentConfigImportParams__CommandMigration = Schema.Struct({ - name: Schema.String, -}); + Schema.Literal("remoteMcpServersConfig").annotate({ + identifier: + "V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorSource", + }); -export type V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItemType = +export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType = | "AGENTS_MD" | "CONFIG" | "SKILLS" @@ -4033,7 +4561,7 @@ export type V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItemT | "COMMANDS" | "MEMORY" | "SESSIONS"; -export const V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItemType = +export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType = Schema.Literals([ "AGENTS_MD", "CONFIG", @@ -4045,17 +4573,25 @@ export const V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItem "COMMANDS", "MEMORY", "SESSIONS", - ]); + ]).annotate({ + identifier: + "V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType", + }); + +export type V2ExternalAgentConfigImportParams__CommandMigration = { readonly name: string }; +export const V2ExternalAgentConfigImportParams__CommandMigration = Schema.Struct({ + name: Schema.String, +}).annotate({ identifier: "V2ExternalAgentConfigImportParams__CommandMigration" }); export type V2ExternalAgentConfigImportParams__HookMigration = { readonly name: string }; export const V2ExternalAgentConfigImportParams__HookMigration = Schema.Struct({ name: Schema.String, -}); +}).annotate({ identifier: "V2ExternalAgentConfigImportParams__HookMigration" }); export type V2ExternalAgentConfigImportParams__McpServerMigration = { readonly name: string }; export const V2ExternalAgentConfigImportParams__McpServerMigration = Schema.Struct({ name: Schema.String, -}); +}).annotate({ identifier: "V2ExternalAgentConfigImportParams__McpServerMigration" }); export type V2ExternalAgentConfigImportParams__PluginsMigration = { readonly marketplaceName: string; @@ -4064,7 +4600,7 @@ export type V2ExternalAgentConfigImportParams__PluginsMigration = { export const V2ExternalAgentConfigImportParams__PluginsMigration = Schema.Struct({ marketplaceName: Schema.String, pluginNames: Schema.Array(Schema.String), -}); +}).annotate({ identifier: "V2ExternalAgentConfigImportParams__PluginsMigration" }); export type V2ExternalAgentConfigImportParams__SessionMigration = { readonly cwd: string; @@ -4075,17 +4611,44 @@ export const V2ExternalAgentConfigImportParams__SessionMigration = Schema.Struct cwd: Schema.String, path: Schema.String, title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2ExternalAgentConfigImportParams__SessionMigration" }); export type V2ExternalAgentConfigImportParams__SkillMigration = { readonly name: string }; export const V2ExternalAgentConfigImportParams__SkillMigration = Schema.Struct({ name: Schema.String, -}); +}).annotate({ identifier: "V2ExternalAgentConfigImportParams__SkillMigration" }); export type V2ExternalAgentConfigImportParams__SubagentMigration = { readonly name: string }; export const V2ExternalAgentConfigImportParams__SubagentMigration = Schema.Struct({ name: Schema.String, -}); +}).annotate({ identifier: "V2ExternalAgentConfigImportParams__SubagentMigration" }); + +export type V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItemType = + | "AGENTS_MD" + | "CONFIG" + | "SKILLS" + | "PLUGINS" + | "MCP_SERVER_CONFIG" + | "SUBAGENTS" + | "HOOKS" + | "COMMANDS" + | "MEMORY" + | "SESSIONS"; +export const V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItemType = + Schema.Literals([ + "AGENTS_MD", + "CONFIG", + "SKILLS", + "PLUGINS", + "MCP_SERVER_CONFIG", + "SUBAGENTS", + "HOOKS", + "COMMANDS", + "MEMORY", + "SESSIONS", + ]).annotate({ + identifier: "V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItemType", + }); export type V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigMigrationItemType = | "AGENTS_MD" @@ -4110,7 +4673,10 @@ export const V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfi "COMMANDS", "MEMORY", "SESSIONS", - ]); + ]).annotate({ + identifier: + "V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigMigrationItemType", + }); export type V2FileChangePatchUpdatedNotification__PatchChangeKind = | { readonly type: "add" } @@ -4130,12 +4696,41 @@ export const V2FileChangePatchUpdatedNotification__PatchChangeKind = Schema.Unio }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2FileChangePatchUpdatedNotification__PatchChangeKind" }); export type V2FsChangedNotification__AbsolutePathBuf = string; export const V2FsChangedNotification__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsChangedNotification__AbsolutePathBuf", +}); + +export type V2FsCopyParams__AbsolutePathBuf = string; +export const V2FsCopyParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsCopyParams__AbsolutePathBuf", +}); + +export type V2FsCreateDirectoryParams__AbsolutePathBuf = string; +export const V2FsCreateDirectoryParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsCreateDirectoryParams__AbsolutePathBuf", +}); + +export type V2FsGetMetadataParams__AbsolutePathBuf = string; +export const V2FsGetMetadataParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsGetMetadataParams__AbsolutePathBuf", +}); + +export type V2FsReadDirectoryParams__AbsolutePathBuf = string; +export const V2FsReadDirectoryParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsReadDirectoryParams__AbsolutePathBuf", }); export type V2FsReadDirectoryResponse__FsReadDirectoryEntry = { @@ -4153,7 +4748,63 @@ export const V2FsReadDirectoryResponse__FsReadDirectoryEntry = Schema.Struct({ isFile: Schema.Boolean.annotate({ description: "Whether this entry resolves to a regular file.", }), -}).annotate({ description: "A directory entry returned by `fs/readDirectory`." }); +}).annotate({ + description: "A directory entry returned by `fs/readDirectory`.", + identifier: "V2FsReadDirectoryResponse__FsReadDirectoryEntry", +}); + +export type V2FsReadFileParams__AbsolutePathBuf = string; +export const V2FsReadFileParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsReadFileParams__AbsolutePathBuf", +}); + +export type V2FsRemoveParams__AbsolutePathBuf = string; +export const V2FsRemoveParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsRemoveParams__AbsolutePathBuf", +}); + +export type V2FsWatchParams__AbsolutePathBuf = string; +export const V2FsWatchParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsWatchParams__AbsolutePathBuf", +}); + +export type V2FsWatchResponse__AbsolutePathBuf = string; +export const V2FsWatchResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsWatchResponse__AbsolutePathBuf", +}); + +export type V2FsWriteFileParams__AbsolutePathBuf = string; +export const V2FsWriteFileParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2FsWriteFileParams__AbsolutePathBuf", +}); + +export type V2GetAccountRateLimitsResponse__RateLimitResetType = "codexRateLimits" | "unknown"; +export const V2GetAccountRateLimitsResponse__RateLimitResetType = Schema.Literals([ + "codexRateLimits", + "unknown", +]).annotate({ identifier: "V2GetAccountRateLimitsResponse__RateLimitResetType" }); + +export type V2GetAccountRateLimitsResponse__RateLimitResetCreditStatus = + | "available" + | "redeeming" + | "redeemed" + | "unknown"; +export const V2GetAccountRateLimitsResponse__RateLimitResetCreditStatus = Schema.Literals([ + "available", + "redeeming", + "redeemed", + "unknown", +]).annotate({ identifier: "V2GetAccountRateLimitsResponse__RateLimitResetCreditStatus" }); export type V2GetAccountRateLimitsResponse__CreditsSnapshot = { readonly balance?: string | null; @@ -4164,7 +4815,24 @@ export const V2GetAccountRateLimitsResponse__CreditsSnapshot = Schema.Struct({ balance: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), hasCredits: Schema.Boolean, unlimited: Schema.Boolean, -}); +}).annotate({ identifier: "V2GetAccountRateLimitsResponse__CreditsSnapshot" }); + +export type V2GetAccountRateLimitsResponse__SpendControlLimitSnapshot = { + readonly limit: string; + readonly remainingPercent: number; + readonly resetsAt: number; + readonly used: string; +}; +export const V2GetAccountRateLimitsResponse__SpendControlLimitSnapshot = Schema.Struct({ + limit: Schema.String, + remainingPercent: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + resetsAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + used: Schema.String, +}).annotate({ identifier: "V2GetAccountRateLimitsResponse__SpendControlLimitSnapshot" }); export type V2GetAccountRateLimitsResponse__PlanType = | "free" @@ -4202,7 +4870,34 @@ export const V2GetAccountRateLimitsResponse__PlanType = Schema.Literals([ "edu_plus", "edu_pro", "unknown", -]); +]).annotate({ identifier: "V2GetAccountRateLimitsResponse__PlanType" }); + +export type V2GetAccountRateLimitsResponse__RateLimitWindow = { + readonly resetsAt?: number | null; + readonly usedPercent: number; + readonly windowDurationMins?: number | null; +}; +export const V2GetAccountRateLimitsResponse__RateLimitWindow = Schema.Struct({ + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + usedPercent: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + windowDurationMins: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2GetAccountRateLimitsResponse__RateLimitWindow" }); export type V2GetAccountRateLimitsResponse__RateLimitReachedType = | "rate_limit_reached" @@ -4216,53 +4911,7 @@ export const V2GetAccountRateLimitsResponse__RateLimitReachedType = Schema.Liter "workspace_member_credits_depleted", "workspace_owner_usage_limit_reached", "workspace_member_usage_limit_reached", -]); - -export type V2GetAccountRateLimitsResponse__RateLimitResetCreditStatus = - | "available" - | "redeeming" - | "redeemed" - | "unknown"; -export const V2GetAccountRateLimitsResponse__RateLimitResetCreditStatus = Schema.Literals([ - "available", - "redeeming", - "redeemed", - "unknown", -]); - -export type V2GetAccountRateLimitsResponse__RateLimitResetType = "codexRateLimits" | "unknown"; -export const V2GetAccountRateLimitsResponse__RateLimitResetType = Schema.Literals([ - "codexRateLimits", - "unknown", -]); - -export type V2GetAccountRateLimitsResponse__RateLimitWindow = { - readonly resetsAt?: number | null; - readonly usedPercent: number; - readonly windowDurationMins?: number | null; -}; -export const V2GetAccountRateLimitsResponse__RateLimitWindow = Schema.Struct({ - resetsAt: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), - usedPercent: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - windowDurationMins: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), -}); - -export type V2GetAccountRateLimitsResponse__SpendControlLimitSnapshot = { - readonly limit: string; - readonly remainingPercent: number; - readonly resetsAt: number; - readonly used: string; -}; -export const V2GetAccountRateLimitsResponse__SpendControlLimitSnapshot = Schema.Struct({ - limit: Schema.String, - remainingPercent: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - resetsAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - used: Schema.String, -}); +]).annotate({ identifier: "V2GetAccountRateLimitsResponse__RateLimitReachedType" }); export type V2GetAccountResponse__PlanType = | "free" @@ -4300,7 +4949,7 @@ export const V2GetAccountResponse__PlanType = Schema.Literals([ "edu_plus", "edu_pro", "unknown", -]); +]).annotate({ identifier: "V2GetAccountResponse__PlanType" }); export type V2GetAccountTokenUsageResponse__AccountTokenUsageDailyBucket = { readonly startDate: string; @@ -4308,8 +4957,10 @@ export type V2GetAccountTokenUsageResponse__AccountTokenUsageDailyBucket = { }; export const V2GetAccountTokenUsageResponse__AccountTokenUsageDailyBucket = Schema.Struct({ startDate: Schema.String, - tokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -}); + tokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +}).annotate({ identifier: "V2GetAccountTokenUsageResponse__AccountTokenUsageDailyBucket" }); export type V2GetAccountTokenUsageResponse__AccountTokenUsageSummary = { readonly currentStreakDays?: number | null; @@ -4320,21 +4971,46 @@ export type V2GetAccountTokenUsageResponse__AccountTokenUsageSummary = { }; export const V2GetAccountTokenUsageResponse__AccountTokenUsageSummary = Schema.Struct({ currentStreakDays: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), lifetimeTokens: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), longestRunningTurnSec: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), longestStreakDays: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), peakDailyTokens: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), -}); +}).annotate({ identifier: "V2GetAccountTokenUsageResponse__AccountTokenUsageSummary" }); export type V2GetWorkspaceMessagesResponse__WorkspaceMessageType = | "headline" @@ -4344,13 +5020,21 @@ export const V2GetWorkspaceMessagesResponse__WorkspaceMessageType = Schema.Liter "headline", "announcement", "unknown", -]); +]).annotate({ identifier: "V2GetWorkspaceMessagesResponse__WorkspaceMessageType" }); -export type V2HookCompletedNotification__AbsolutePathBuf = string; -export const V2HookCompletedNotification__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); +export type V2HookCompletedNotification__HookOutputEntryKind = + | "warning" + | "stop" + | "feedback" + | "context" + | "error"; +export const V2HookCompletedNotification__HookOutputEntryKind = Schema.Literals([ + "warning", + "stop", + "feedback", + "context", + "error", +]).annotate({ identifier: "V2HookCompletedNotification__HookOutputEntryKind" }); export type V2HookCompletedNotification__HookEventName = | "preToolUse" @@ -4376,31 +5060,58 @@ export const V2HookCompletedNotification__HookEventName = Schema.Literals([ "subagentStart", "subagentStop", "stop", -]); +]).annotate({ identifier: "V2HookCompletedNotification__HookEventName" }); export type V2HookCompletedNotification__HookExecutionMode = "sync" | "async"; -export const V2HookCompletedNotification__HookExecutionMode = Schema.Literals(["sync", "async"]); +export const V2HookCompletedNotification__HookExecutionMode = Schema.Literals([ + "sync", + "async", +]).annotate({ identifier: "V2HookCompletedNotification__HookExecutionMode" }); export type V2HookCompletedNotification__HookHandlerType = "command" | "prompt" | "agent"; export const V2HookCompletedNotification__HookHandlerType = Schema.Literals([ "command", "prompt", "agent", -]); +]).annotate({ identifier: "V2HookCompletedNotification__HookHandlerType" }); -export type V2HookCompletedNotification__HookOutputEntryKind = - | "warning" - | "stop" - | "feedback" - | "context" - | "error"; -export const V2HookCompletedNotification__HookOutputEntryKind = Schema.Literals([ - "warning", - "stop", - "feedback", - "context", - "error", -]); +export type V2HookCompletedNotification__HookScope = "thread" | "turn"; +export const V2HookCompletedNotification__HookScope = Schema.Literals(["thread", "turn"]).annotate({ + identifier: "V2HookCompletedNotification__HookScope", +}); + +export type V2HookCompletedNotification__HookSource = + | "system" + | "user" + | "project" + | "mdm" + | "sessionFlags" + | "plugin" + | "cloudRequirements" + | "cloudManagedConfig" + | "legacyManagedConfigFile" + | "legacyManagedConfigMdm" + | "unknown"; +export const V2HookCompletedNotification__HookSource = Schema.Literals([ + "system", + "user", + "project", + "mdm", + "sessionFlags", + "plugin", + "cloudRequirements", + "cloudManagedConfig", + "legacyManagedConfigFile", + "legacyManagedConfigMdm", + "unknown", +]).annotate({ identifier: "V2HookCompletedNotification__HookSource" }); + +export type V2HookCompletedNotification__AbsolutePathBuf = string; +export const V2HookCompletedNotification__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2HookCompletedNotification__AbsolutePathBuf", +}); export type V2HookCompletedNotification__HookRunStatus = | "running" @@ -4414,16 +5125,7 @@ export const V2HookCompletedNotification__HookRunStatus = Schema.Literals([ "failed", "blocked", "stopped", -]); - -export type V2HookCompletedNotification__HookScope = "thread" | "turn"; -export const V2HookCompletedNotification__HookScope = Schema.Literals(["thread", "turn"]); - -export type V2HooksListResponse__AbsolutePathBuf = string; -export const V2HooksListResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); +]).annotate({ identifier: "V2HookCompletedNotification__HookRunStatus" }); export type V2HooksListResponse__HookErrorInfo = { readonly message: string; @@ -4432,7 +5134,7 @@ export type V2HooksListResponse__HookErrorInfo = { export const V2HooksListResponse__HookErrorInfo = Schema.Struct({ message: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2HooksListResponse__HookErrorInfo" }); export type V2HooksListResponse__HookEventName = | "preToolUse" @@ -4458,10 +5160,14 @@ export const V2HooksListResponse__HookEventName = Schema.Literals([ "subagentStart", "subagentStop", "stop", -]); +]).annotate({ identifier: "V2HooksListResponse__HookEventName" }); export type V2HooksListResponse__HookHandlerType = "command" | "prompt" | "agent"; -export const V2HooksListResponse__HookHandlerType = Schema.Literals(["command", "prompt", "agent"]); +export const V2HooksListResponse__HookHandlerType = Schema.Literals([ + "command", + "prompt", + "agent", +]).annotate({ identifier: "V2HooksListResponse__HookHandlerType" }); export type V2HooksListResponse__HookSource = | "system" @@ -4487,7 +5193,14 @@ export const V2HooksListResponse__HookSource = Schema.Literals([ "legacyManagedConfigFile", "legacyManagedConfigMdm", "unknown", -]); +]).annotate({ identifier: "V2HooksListResponse__HookSource" }); + +export type V2HooksListResponse__AbsolutePathBuf = string; +export const V2HooksListResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2HooksListResponse__AbsolutePathBuf", +}); export type V2HooksListResponse__HookTrustStatus = "managed" | "untrusted" | "trusted" | "modified"; export const V2HooksListResponse__HookTrustStatus = Schema.Literals([ @@ -4495,13 +5208,21 @@ export const V2HooksListResponse__HookTrustStatus = Schema.Literals([ "untrusted", "trusted", "modified", -]); +]).annotate({ identifier: "V2HooksListResponse__HookTrustStatus" }); -export type V2HookStartedNotification__AbsolutePathBuf = string; -export const V2HookStartedNotification__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); +export type V2HookStartedNotification__HookOutputEntryKind = + | "warning" + | "stop" + | "feedback" + | "context" + | "error"; +export const V2HookStartedNotification__HookOutputEntryKind = Schema.Literals([ + "warning", + "stop", + "feedback", + "context", + "error", +]).annotate({ identifier: "V2HookStartedNotification__HookOutputEntryKind" }); export type V2HookStartedNotification__HookEventName = | "preToolUse" @@ -4527,31 +5248,58 @@ export const V2HookStartedNotification__HookEventName = Schema.Literals([ "subagentStart", "subagentStop", "stop", -]); +]).annotate({ identifier: "V2HookStartedNotification__HookEventName" }); export type V2HookStartedNotification__HookExecutionMode = "sync" | "async"; -export const V2HookStartedNotification__HookExecutionMode = Schema.Literals(["sync", "async"]); +export const V2HookStartedNotification__HookExecutionMode = Schema.Literals([ + "sync", + "async", +]).annotate({ identifier: "V2HookStartedNotification__HookExecutionMode" }); export type V2HookStartedNotification__HookHandlerType = "command" | "prompt" | "agent"; export const V2HookStartedNotification__HookHandlerType = Schema.Literals([ "command", "prompt", "agent", -]); +]).annotate({ identifier: "V2HookStartedNotification__HookHandlerType" }); -export type V2HookStartedNotification__HookOutputEntryKind = - | "warning" - | "stop" - | "feedback" - | "context" - | "error"; -export const V2HookStartedNotification__HookOutputEntryKind = Schema.Literals([ - "warning", - "stop", - "feedback", - "context", - "error", -]); +export type V2HookStartedNotification__HookScope = "thread" | "turn"; +export const V2HookStartedNotification__HookScope = Schema.Literals(["thread", "turn"]).annotate({ + identifier: "V2HookStartedNotification__HookScope", +}); + +export type V2HookStartedNotification__HookSource = + | "system" + | "user" + | "project" + | "mdm" + | "sessionFlags" + | "plugin" + | "cloudRequirements" + | "cloudManagedConfig" + | "legacyManagedConfigFile" + | "legacyManagedConfigMdm" + | "unknown"; +export const V2HookStartedNotification__HookSource = Schema.Literals([ + "system", + "user", + "project", + "mdm", + "sessionFlags", + "plugin", + "cloudRequirements", + "cloudManagedConfig", + "legacyManagedConfigFile", + "legacyManagedConfigMdm", + "unknown", +]).annotate({ identifier: "V2HookStartedNotification__HookSource" }); + +export type V2HookStartedNotification__AbsolutePathBuf = string; +export const V2HookStartedNotification__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2HookStartedNotification__AbsolutePathBuf", +}); export type V2HookStartedNotification__HookRunStatus = | "running" @@ -4565,34 +5313,104 @@ export const V2HookStartedNotification__HookRunStatus = Schema.Literals([ "failed", "blocked", "stopped", -]); +]).annotate({ identifier: "V2HookStartedNotification__HookRunStatus" }); -export type V2HookStartedNotification__HookScope = "thread" | "turn"; -export const V2HookStartedNotification__HookScope = Schema.Literals(["thread", "turn"]); +export type V2ItemCompletedNotification__ByteRange = { + readonly end: number; + readonly start: number; +}; +export const V2ItemCompletedNotification__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ItemCompletedNotification__ByteRange" }); + +export type V2ItemCompletedNotification__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2ItemCompletedNotification__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2ItemCompletedNotification__ImageDetail" }); + +export type V2ItemCompletedNotification__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; +}; +export const V2ItemCompletedNotification__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ItemCompletedNotification__HookPromptFragment" }); + +export type V2ItemCompletedNotification__MemoryCitationEntry = { + readonly lineEnd: number; + readonly lineStart: number; + readonly note: string; + readonly path: string; +}; +export const V2ItemCompletedNotification__MemoryCitationEntry = Schema.Struct({ + lineEnd: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + lineStart: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + note: Schema.String, + path: Schema.String, +}).annotate({ identifier: "V2ItemCompletedNotification__MemoryCitationEntry" }); + +export type V2ItemCompletedNotification__MessagePhase = "commentary" | "final_answer"; +export const V2ItemCompletedNotification__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ItemCompletedNotification__MessagePhase", +}); export type V2ItemCompletedNotification__AbsolutePathBuf = string; export const V2ItemCompletedNotification__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ItemCompletedNotification__AbsolutePathBuf", }); -export type V2ItemCompletedNotification__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ItemCompletedNotification__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2ItemCompletedNotification__LegacyAppPathString = string; +export const V2ItemCompletedNotification__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ItemCompletedNotification__LegacyAppPathString", +}); + +export type V2ItemCompletedNotification__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ItemCompletedNotification__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ItemCompletedNotification__CommandExecutionSource" }); export type V2ItemCompletedNotification__CommandExecutionStatus = | "inProgress" @@ -4604,65 +5422,39 @@ export const V2ItemCompletedNotification__CommandExecutionStatus = Schema.Litera "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ItemCompletedNotification__CommandExecutionStatus" }); -export type V2ItemCompletedNotification__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ItemCompletedNotification__DynamicToolCallOutputContentItem = Schema.Union( +export type V2ItemCompletedNotification__PatchChangeKind = + | { readonly type: "add" } + | { readonly type: "delete" } + | { readonly move_path?: string | null; readonly type: "update" }; +export const V2ItemCompletedNotification__PatchChangeKind = Schema.Union( [ Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), + }).annotate({ title: "AddPatchChangeKind" }), Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), + }).annotate({ title: "DeletePatchChangeKind" }), Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), + }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ItemCompletedNotification__PatchChangeKind" }); -export type V2ItemCompletedNotification__DynamicToolCallStatus = +export type V2ItemCompletedNotification__PatchApplyStatus = | "inProgress" | "completed" - | "failed"; -export const V2ItemCompletedNotification__DynamicToolCallStatus = Schema.Literals([ + | "failed" + | "declined"; +export const V2ItemCompletedNotification__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2ItemCompletedNotification__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ItemCompletedNotification__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, -}); - -export type V2ItemCompletedNotification__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2ItemCompletedNotification__ImageDetail = Schema.Literals([ - "auto", - "low", - "high", - "original", -]); - -export type V2ItemCompletedNotification__LegacyAppPathString = string; -export const V2ItemCompletedNotification__LegacyAppPathString = Schema.String; + "declined", +]).annotate({ identifier: "V2ItemCompletedNotification__PatchApplyStatus" }); export type V2ItemCompletedNotification__McpToolCallAppContext = { readonly actionName?: string | null; @@ -4677,93 +5469,130 @@ export const V2ItemCompletedNotification__McpToolCallAppContext = Schema.Struct( connectorId: Schema.String, linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2ItemCompletedNotification__McpToolCallAppContext" }); export type V2ItemCompletedNotification__McpToolCallError = { readonly message: string }; export const V2ItemCompletedNotification__McpToolCallError = Schema.Struct({ message: Schema.String, -}); +}).annotate({ identifier: "V2ItemCompletedNotification__McpToolCallError" }); export type V2ItemCompletedNotification__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; }; export const V2ItemCompletedNotification__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ItemCompletedNotification__McpToolCallResult" }); export type V2ItemCompletedNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; export const V2ItemCompletedNotification__McpToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2ItemCompletedNotification__MemoryCitationEntry = { - readonly lineEnd: number; - readonly lineStart: number; - readonly note: string; - readonly path: string; -}; -export const V2ItemCompletedNotification__MemoryCitationEntry = Schema.Struct({ - lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - note: Schema.String, - path: Schema.String, -}); +]).annotate({ identifier: "V2ItemCompletedNotification__McpToolCallStatus" }); -export type V2ItemCompletedNotification__MessagePhase = "commentary" | "final_answer"; -export const V2ItemCompletedNotification__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ - description: - 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', -}); +export type V2ItemCompletedNotification__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ItemCompletedNotification__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ItemCompletedNotification__DynamicToolCallOutputContentItem" }); -export type V2ItemCompletedNotification__PatchApplyStatus = +export type V2ItemCompletedNotification__DynamicToolCallStatus = | "inProgress" | "completed" - | "failed" - | "declined"; -export const V2ItemCompletedNotification__PatchApplyStatus = Schema.Literals([ + | "failed"; +export const V2ItemCompletedNotification__DynamicToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", - "declined", -]); +]).annotate({ identifier: "V2ItemCompletedNotification__DynamicToolCallStatus" }); -export type V2ItemCompletedNotification__PatchChangeKind = - | { readonly type: "add" } - | { readonly type: "delete" } - | { readonly move_path?: string | null; readonly type: "update" }; -export const V2ItemCompletedNotification__PatchChangeKind = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), - }).annotate({ title: "AddPatchChangeKind" }), - Schema.Struct({ - type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), - }).annotate({ title: "DeletePatchChangeKind" }), - Schema.Struct({ - move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), - }).annotate({ title: "UpdatePatchChangeKind" }), - ], - { mode: "oneOf" }, -); +export type V2ItemCompletedNotification__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ItemCompletedNotification__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ItemCompletedNotification__CollabAgentStatus" }); export type V2ItemCompletedNotification__ReasoningEffort = string; export const V2ItemCompletedNotification__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ItemCompletedNotification__ReasoningEffort", + }), +); + +export type V2ItemCompletedNotification__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2ItemCompletedNotification__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2ItemCompletedNotification__CollabAgentToolCallStatus" }); + +export type V2ItemCompletedNotification__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ItemCompletedNotification__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ItemCompletedNotification__CollabAgentTool" }); export type V2ItemCompletedNotification__SubAgentActivityKind = | "started" @@ -4775,32 +5604,7 @@ export const V2ItemCompletedNotification__SubAgentActivityKind = Schema.Literals "interacted", "interrupted", "completed", -]); - -export type V2ItemCompletedNotification__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2ItemCompletedNotification__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); +]).annotate({ identifier: "V2ItemCompletedNotification__SubAgentActivityKind" }); export type V2ItemCompletedNotification__WebSearchAction = | { @@ -4832,33 +5636,77 @@ export const V2ItemCompletedNotification__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ItemCompletedNotification__WebSearchAction" }); export type V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf = string; export const V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf", + }); + +export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandSource = + | "shell" + | "unifiedExec"; +export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandSource = + Schema.Literals(["shell", "unifiedExec"]).annotate({ + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandSource", + }); + +export type V2ItemGuardianApprovalReviewCompletedNotification__NetworkApprovalProtocol = + | "http" + | "https" + | "socks5Tcp" + | "socks5Udp"; +export const V2ItemGuardianApprovalReviewCompletedNotification__NetworkApprovalProtocol = + Schema.Literals(["http", "https", "socks5Tcp", "socks5Udp"]).annotate({ + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__NetworkApprovalProtocol", + }); + +export type V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode = + | "read" + | "write" + | "deny"; +export const V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode = + Schema.Literals(["read", "write", "deny"]).annotate({ + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode", + }); + +export type V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString = string; +export const V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString = + Schema.String.annotate({ + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString", }); export type V2ItemGuardianApprovalReviewCompletedNotification__AdditionalNetworkPermissions = { readonly enabled?: boolean | null; }; export const V2ItemGuardianApprovalReviewCompletedNotification__AdditionalNetworkPermissions = - Schema.Struct({ enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])) }); + Schema.Struct({ + enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + }).annotate({ + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__AdditionalNetworkPermissions", + }); export type V2ItemGuardianApprovalReviewCompletedNotification__AutoReviewDecisionSource = "agent"; export const V2ItemGuardianApprovalReviewCompletedNotification__AutoReviewDecisionSource = Schema.Literal("agent").annotate({ description: "[UNSTABLE] Source that produced a terminal approval auto-review decision.", + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__AutoReviewDecisionSource", }); -export type V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode = - | "read" - | "write" - | "deny"; -export const V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode = - Schema.Literals(["read", "write", "deny"]); +export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianRiskLevel = + | "low" + | "medium" + | "high" + | "critical"; +export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianRiskLevel = Schema.Literals( + ["low", "medium", "high", "critical"], +).annotate({ + description: "[UNSTABLE] Risk level assigned by approval auto-review.", + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__GuardianRiskLevel", +}); export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewStatus = | "inProgress" @@ -4869,23 +5717,9 @@ export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalR export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewStatus = Schema.Literals(["inProgress", "approved", "denied", "timedOut", "aborted"]).annotate({ description: "[UNSTABLE] Lifecycle state for an approval auto-review.", + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewStatus", }); -export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandSource = - | "shell" - | "unifiedExec"; -export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandSource = - Schema.Literals(["shell", "unifiedExec"]); - -export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianRiskLevel = - | "low" - | "medium" - | "high" - | "critical"; -export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianRiskLevel = Schema.Literals( - ["low", "medium", "high", "critical"], -).annotate({ description: "[UNSTABLE] Risk level assigned by approval auto-review." }); - export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAuthorization = | "unknown" | "low" @@ -4894,55 +5728,59 @@ export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAutho export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAuthorization = Schema.Literals(["unknown", "low", "medium", "high"]).annotate({ description: "[UNSTABLE] Authorization level assigned by approval auto-review.", + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAuthorization", }); -export type V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString = string; -export const V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString = Schema.String; - -export type V2ItemGuardianApprovalReviewCompletedNotification__NetworkApprovalProtocol = - | "http" - | "https" - | "socks5Tcp" - | "socks5Udp"; -export const V2ItemGuardianApprovalReviewCompletedNotification__NetworkApprovalProtocol = - Schema.Literals(["http", "https", "socks5Tcp", "socks5Udp"]); - export type V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf = string; export const V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf", }); -export type V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions = { - readonly enabled?: boolean | null; -}; -export const V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions = - Schema.Struct({ enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])) }); +export type V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSource = + | "shell" + | "unifiedExec"; +export const V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSource = + Schema.Literals(["shell", "unifiedExec"]).annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSource", + }); + +export type V2ItemGuardianApprovalReviewStartedNotification__NetworkApprovalProtocol = + | "http" + | "https" + | "socks5Tcp" + | "socks5Udp"; +export const V2ItemGuardianApprovalReviewStartedNotification__NetworkApprovalProtocol = + Schema.Literals(["http", "https", "socks5Tcp", "socks5Udp"]).annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__NetworkApprovalProtocol", + }); export type V2ItemGuardianApprovalReviewStartedNotification__FileSystemAccessMode = | "read" | "write" | "deny"; export const V2ItemGuardianApprovalReviewStartedNotification__FileSystemAccessMode = - Schema.Literals(["read", "write", "deny"]); + Schema.Literals(["read", "write", "deny"]).annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__FileSystemAccessMode", + }); -export type V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewStatus = - | "inProgress" - | "approved" - | "denied" - | "timedOut" - | "aborted"; -export const V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewStatus = - Schema.Literals(["inProgress", "approved", "denied", "timedOut", "aborted"]).annotate({ - description: "[UNSTABLE] Lifecycle state for an approval auto-review.", +export type V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString = string; +export const V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString = + Schema.String.annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString", }); -export type V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSource = - | "shell" - | "unifiedExec"; -export const V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSource = - Schema.Literals(["shell", "unifiedExec"]); +export type V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions = { + readonly enabled?: boolean | null; +}; +export const V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions = + Schema.Struct({ + enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + }).annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions", + }); export type V2ItemGuardianApprovalReviewStartedNotification__GuardianRiskLevel = | "low" @@ -4954,7 +5792,22 @@ export const V2ItemGuardianApprovalReviewStartedNotification__GuardianRiskLevel "medium", "high", "critical", -]).annotate({ description: "[UNSTABLE] Risk level assigned by approval auto-review." }); +]).annotate({ + description: "[UNSTABLE] Risk level assigned by approval auto-review.", + identifier: "V2ItemGuardianApprovalReviewStartedNotification__GuardianRiskLevel", +}); + +export type V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewStatus = + | "inProgress" + | "approved" + | "denied" + | "timedOut" + | "aborted"; +export const V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewStatus = + Schema.Literals(["inProgress", "approved", "denied", "timedOut", "aborted"]).annotate({ + description: "[UNSTABLE] Lifecycle state for an approval auto-review.", + identifier: "V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewStatus", + }); export type V2ItemGuardianApprovalReviewStartedNotification__GuardianUserAuthorization = | "unknown" @@ -4964,42 +5817,102 @@ export type V2ItemGuardianApprovalReviewStartedNotification__GuardianUserAuthori export const V2ItemGuardianApprovalReviewStartedNotification__GuardianUserAuthorization = Schema.Literals(["unknown", "low", "medium", "high"]).annotate({ description: "[UNSTABLE] Authorization level assigned by approval auto-review.", + identifier: "V2ItemGuardianApprovalReviewStartedNotification__GuardianUserAuthorization", }); -export type V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString = string; -export const V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString = Schema.String; +export type V2ItemStartedNotification__ByteRange = { readonly end: number; readonly start: number }; +export const V2ItemStartedNotification__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ItemStartedNotification__ByteRange" }); -export type V2ItemGuardianApprovalReviewStartedNotification__NetworkApprovalProtocol = - | "http" - | "https" - | "socks5Tcp" - | "socks5Udp"; -export const V2ItemGuardianApprovalReviewStartedNotification__NetworkApprovalProtocol = - Schema.Literals(["http", "https", "socks5Tcp", "socks5Udp"]); +export type V2ItemStartedNotification__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2ItemStartedNotification__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2ItemStartedNotification__ImageDetail" }); -export type V2ItemStartedNotification__AbsolutePathBuf = string; -export const V2ItemStartedNotification__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", +export type V2ItemStartedNotification__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; +}; +export const V2ItemStartedNotification__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ItemStartedNotification__HookPromptFragment" }); + +export type V2ItemStartedNotification__MemoryCitationEntry = { + readonly lineEnd: number; + readonly lineStart: number; + readonly note: string; + readonly path: string; +}; +export const V2ItemStartedNotification__MemoryCitationEntry = Schema.Struct({ + lineEnd: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + lineStart: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + note: Schema.String, + path: Schema.String, +}).annotate({ identifier: "V2ItemStartedNotification__MemoryCitationEntry" }); + +export type V2ItemStartedNotification__MessagePhase = "commentary" | "final_answer"; +export const V2ItemStartedNotification__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ItemStartedNotification__MessagePhase", }); -export type V2ItemStartedNotification__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ItemStartedNotification__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2ItemStartedNotification__AbsolutePathBuf = string; +export const V2ItemStartedNotification__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ItemStartedNotification__AbsolutePathBuf", +}); + +export type V2ItemStartedNotification__LegacyAppPathString = string; +export const V2ItemStartedNotification__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ItemStartedNotification__LegacyAppPathString", +}); + +export type V2ItemStartedNotification__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ItemStartedNotification__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ItemStartedNotification__CommandExecutionSource" }); export type V2ItemStartedNotification__CommandExecutionStatus = | "inProgress" @@ -5011,65 +5924,39 @@ export const V2ItemStartedNotification__CommandExecutionStatus = Schema.Literals "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ItemStartedNotification__CommandExecutionStatus" }); -export type V2ItemStartedNotification__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ItemStartedNotification__DynamicToolCallOutputContentItem = Schema.Union( +export type V2ItemStartedNotification__PatchChangeKind = + | { readonly type: "add" } + | { readonly type: "delete" } + | { readonly move_path?: string | null; readonly type: "update" }; +export const V2ItemStartedNotification__PatchChangeKind = Schema.Union( [ Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), + }).annotate({ title: "AddPatchChangeKind" }), Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), + }).annotate({ title: "DeletePatchChangeKind" }), Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), + }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ItemStartedNotification__PatchChangeKind" }); -export type V2ItemStartedNotification__DynamicToolCallStatus = +export type V2ItemStartedNotification__PatchApplyStatus = | "inProgress" | "completed" - | "failed"; -export const V2ItemStartedNotification__DynamicToolCallStatus = Schema.Literals([ + | "failed" + | "declined"; +export const V2ItemStartedNotification__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2ItemStartedNotification__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ItemStartedNotification__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, -}); - -export type V2ItemStartedNotification__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2ItemStartedNotification__ImageDetail = Schema.Literals([ - "auto", - "low", - "high", - "original", -]); - -export type V2ItemStartedNotification__LegacyAppPathString = string; -export const V2ItemStartedNotification__LegacyAppPathString = Schema.String; + "declined", +]).annotate({ identifier: "V2ItemStartedNotification__PatchApplyStatus" }); export type V2ItemStartedNotification__McpToolCallAppContext = { readonly actionName?: string | null; @@ -5084,93 +5971,130 @@ export const V2ItemStartedNotification__McpToolCallAppContext = Schema.Struct({ connectorId: Schema.String, linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2ItemStartedNotification__McpToolCallAppContext" }); export type V2ItemStartedNotification__McpToolCallError = { readonly message: string }; export const V2ItemStartedNotification__McpToolCallError = Schema.Struct({ message: Schema.String, -}); +}).annotate({ identifier: "V2ItemStartedNotification__McpToolCallError" }); export type V2ItemStartedNotification__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; }; export const V2ItemStartedNotification__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ItemStartedNotification__McpToolCallResult" }); export type V2ItemStartedNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; export const V2ItemStartedNotification__McpToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2ItemStartedNotification__MemoryCitationEntry = { - readonly lineEnd: number; - readonly lineStart: number; - readonly note: string; - readonly path: string; -}; -export const V2ItemStartedNotification__MemoryCitationEntry = Schema.Struct({ - lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - note: Schema.String, - path: Schema.String, -}); +]).annotate({ identifier: "V2ItemStartedNotification__McpToolCallStatus" }); -export type V2ItemStartedNotification__MessagePhase = "commentary" | "final_answer"; -export const V2ItemStartedNotification__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ - description: - 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', -}); +export type V2ItemStartedNotification__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ItemStartedNotification__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ItemStartedNotification__DynamicToolCallOutputContentItem" }); -export type V2ItemStartedNotification__PatchApplyStatus = +export type V2ItemStartedNotification__DynamicToolCallStatus = | "inProgress" | "completed" - | "failed" - | "declined"; -export const V2ItemStartedNotification__PatchApplyStatus = Schema.Literals([ + | "failed"; +export const V2ItemStartedNotification__DynamicToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", - "declined", -]); +]).annotate({ identifier: "V2ItemStartedNotification__DynamicToolCallStatus" }); -export type V2ItemStartedNotification__PatchChangeKind = - | { readonly type: "add" } - | { readonly type: "delete" } - | { readonly move_path?: string | null; readonly type: "update" }; -export const V2ItemStartedNotification__PatchChangeKind = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), - }).annotate({ title: "AddPatchChangeKind" }), - Schema.Struct({ - type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), - }).annotate({ title: "DeletePatchChangeKind" }), - Schema.Struct({ - move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), - }).annotate({ title: "UpdatePatchChangeKind" }), - ], - { mode: "oneOf" }, -); +export type V2ItemStartedNotification__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ItemStartedNotification__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ItemStartedNotification__CollabAgentStatus" }); export type V2ItemStartedNotification__ReasoningEffort = string; export const V2ItemStartedNotification__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ItemStartedNotification__ReasoningEffort", + }), +); + +export type V2ItemStartedNotification__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2ItemStartedNotification__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2ItemStartedNotification__CollabAgentToolCallStatus" }); + +export type V2ItemStartedNotification__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ItemStartedNotification__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ItemStartedNotification__CollabAgentTool" }); export type V2ItemStartedNotification__SubAgentActivityKind = | "started" @@ -5182,32 +6106,7 @@ export const V2ItemStartedNotification__SubAgentActivityKind = Schema.Literals([ "interacted", "interrupted", "completed", -]); - -export type V2ItemStartedNotification__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2ItemStartedNotification__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); +]).annotate({ identifier: "V2ItemStartedNotification__SubAgentActivityKind" }); export type V2ItemStartedNotification__WebSearchAction = | { @@ -5239,13 +6138,13 @@ export const V2ItemStartedNotification__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ItemStartedNotification__WebSearchAction" }); export type V2ListMcpServerStatusParams__McpServerStatusDetail = "full" | "toolsAndAuthOnly"; export const V2ListMcpServerStatusParams__McpServerStatusDetail = Schema.Literals([ "full", "toolsAndAuthOnly", -]); +]).annotate({ identifier: "V2ListMcpServerStatusParams__McpServerStatusDetail" }); export type V2ListMcpServerStatusResponse__McpAuthStatus = | "unsupported" @@ -5257,30 +6156,33 @@ export const V2ListMcpServerStatusResponse__McpAuthStatus = Schema.Literals([ "notLoggedIn", "bearerToken", "oAuth", -]); +]).annotate({ identifier: "V2ListMcpServerStatusResponse__McpAuthStatus" }); -export type V2ListMcpServerStatusResponse__McpServerInfo = { +export type V2ListMcpServerStatusResponse__ResourceTemplate = { + readonly annotations?: Schema.Json; readonly description?: string | null; - readonly icons?: ReadonlyArray | null; + readonly mimeType?: string | null; readonly name: string; readonly title?: string | null; - readonly version: string; - readonly websiteUrl?: string | null; + readonly uriTemplate: string; }; -export const V2ListMcpServerStatusResponse__McpServerInfo = Schema.Struct({ +export const V2ListMcpServerStatusResponse__ResourceTemplate = Schema.Struct({ + annotations: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - icons: Schema.optionalKey(Schema.Union([Schema.Array(Schema.Unknown), Schema.Null])), + mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - version: Schema.String, - websiteUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ description: "Presentation metadata advertised by an initialized MCP server." }); + uriTemplate: Schema.String, +}).annotate({ + description: "A template description for resources available on the server.", + identifier: "V2ListMcpServerStatusResponse__ResourceTemplate", +}); export type V2ListMcpServerStatusResponse__Resource = { - readonly _meta?: unknown; - readonly annotations?: unknown; + readonly _meta?: Schema.Json; + readonly annotations?: Schema.Json; readonly description?: string | null; - readonly icons?: ReadonlyArray | null; + readonly icons?: ReadonlyArray | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; @@ -5288,76 +6190,94 @@ export type V2ListMcpServerStatusResponse__Resource = { readonly uri: string; }; export const V2ListMcpServerStatusResponse__Resource = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - annotations: Schema.optionalKey(Schema.Unknown), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + annotations: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - icons: Schema.optionalKey(Schema.Union([Schema.Array(Schema.Unknown), Schema.Null])), + icons: Schema.optionalKey( + Schema.Union([Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), Schema.Null]), + ), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, -}).annotate({ description: "A known resource that the server is capable of reading." }); +}).annotate({ + description: "A known resource that the server is capable of reading.", + identifier: "V2ListMcpServerStatusResponse__Resource", +}); -export type V2ListMcpServerStatusResponse__ResourceTemplate = { - readonly annotations?: unknown; +export type V2ListMcpServerStatusResponse__McpServerInfo = { readonly description?: string | null; - readonly mimeType?: string | null; + readonly icons?: ReadonlyArray | null; readonly name: string; readonly title?: string | null; - readonly uriTemplate: string; + readonly version: string; + readonly websiteUrl?: string | null; }; -export const V2ListMcpServerStatusResponse__ResourceTemplate = Schema.Struct({ - annotations: Schema.optionalKey(Schema.Unknown), +export const V2ListMcpServerStatusResponse__McpServerInfo = Schema.Struct({ description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icons: Schema.optionalKey( + Schema.Union([Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), Schema.Null]), + ), name: Schema.String, title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - uriTemplate: Schema.String, -}).annotate({ description: "A template description for resources available on the server." }); + version: Schema.String, + websiteUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Presentation metadata advertised by an initialized MCP server.", + identifier: "V2ListMcpServerStatusResponse__McpServerInfo", +}); export type V2ListMcpServerStatusResponse__Tool = { - readonly _meta?: unknown; - readonly annotations?: unknown; + readonly _meta?: Schema.Json; + readonly annotations?: Schema.Json; readonly description?: string | null; - readonly icons?: ReadonlyArray | null; - readonly inputSchema: unknown; + readonly icons?: ReadonlyArray | null; + readonly inputSchema: Schema.Json; readonly name: string; - readonly outputSchema?: unknown; + readonly outputSchema?: Schema.Json; readonly title?: string | null; }; export const V2ListMcpServerStatusResponse__Tool = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - annotations: Schema.optionalKey(Schema.Unknown), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + annotations: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - icons: Schema.optionalKey(Schema.Union([Schema.Array(Schema.Unknown), Schema.Null])), - inputSchema: Schema.Unknown, + icons: Schema.optionalKey( + Schema.Union([Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), Schema.Null]), + ), + inputSchema: Schema.Json.annotate({ expected: "JSON value" }), name: Schema.String, - outputSchema: Schema.optionalKey(Schema.Unknown), + outputSchema: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ description: "Definition for a tool the client can call." }); +}).annotate({ + description: "Definition for a tool the client can call.", + identifier: "V2ListMcpServerStatusResponse__Tool", +}); export type V2LoginAccountParams__LoginAppBrand = "codex" | "chatgpt"; -export const V2LoginAccountParams__LoginAppBrand = Schema.Literals(["codex", "chatgpt"]); +export const V2LoginAccountParams__LoginAppBrand = Schema.Literals(["codex", "chatgpt"]).annotate({ + identifier: "V2LoginAccountParams__LoginAppBrand", +}); export type V2MarketplaceAddResponse__AbsolutePathBuf = string; export const V2MarketplaceAddResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2MarketplaceAddResponse__AbsolutePathBuf", }); export type V2MarketplaceRemoveResponse__AbsolutePathBuf = string; export const V2MarketplaceRemoveResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type V2MarketplaceUpgradeResponse__AbsolutePathBuf = string; -export const V2MarketplaceUpgradeResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2MarketplaceRemoveResponse__AbsolutePathBuf", }); export type V2MarketplaceUpgradeResponse__MarketplaceUpgradeErrorInfo = { @@ -5367,41 +6287,51 @@ export type V2MarketplaceUpgradeResponse__MarketplaceUpgradeErrorInfo = { export const V2MarketplaceUpgradeResponse__MarketplaceUpgradeErrorInfo = Schema.Struct({ marketplaceName: Schema.String, message: Schema.String, +}).annotate({ identifier: "V2MarketplaceUpgradeResponse__MarketplaceUpgradeErrorInfo" }); + +export type V2MarketplaceUpgradeResponse__AbsolutePathBuf = string; +export const V2MarketplaceUpgradeResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2MarketplaceUpgradeResponse__AbsolutePathBuf", }); export type V2McpResourceReadResponse__ResourceContent = | { - readonly _meta?: unknown; + readonly _meta?: Schema.Json; readonly mimeType?: string | null; readonly text: string; readonly uri: string; } | { - readonly _meta?: unknown; + readonly _meta?: Schema.Json; readonly blob: string; readonly mimeType?: string | null; readonly uri: string; }; export const V2McpResourceReadResponse__ResourceContent = Schema.Union([ Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), text: Schema.String, uri: Schema.String.annotate({ description: "The URI of this resource." }), }), Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), blob: Schema.String, mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String.annotate({ description: "The URI of this resource." }), }), -]).annotate({ description: "Contents returned when reading a resource from an MCP server." }); +]).annotate({ + description: "Contents returned when reading a resource from an MCP server.", + identifier: "V2McpResourceReadResponse__ResourceContent", +}); export type V2McpServerStatusUpdatedNotification__McpServerStartupFailureReason = "reauthenticationRequired"; export const V2McpServerStatusUpdatedNotification__McpServerStartupFailureReason = Schema.Literal( "reauthenticationRequired", -); +).annotate({ identifier: "V2McpServerStatusUpdatedNotification__McpServerStartupFailureReason" }); export type V2McpServerStatusUpdatedNotification__McpServerStartupState = | "starting" @@ -5413,17 +6343,35 @@ export const V2McpServerStatusUpdatedNotification__McpServerStartupState = Schem "ready", "failed", "cancelled", -]); - -export type V2ModelListResponse__InputModality = "text" | "image" | "audio"; -export const V2ModelListResponse__InputModality = Schema.Literals([ - "text", - "image", - "audio", -]).annotate({ description: "Canonical user-input modality tags advertised by a model." }); +]).annotate({ identifier: "V2McpServerStatusUpdatedNotification__McpServerStartupState" }); export type V2ModelListResponse__ModelAvailabilityNux = { readonly message: string }; -export const V2ModelListResponse__ModelAvailabilityNux = Schema.Struct({ message: Schema.String }); +export const V2ModelListResponse__ModelAvailabilityNux = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ModelListResponse__ModelAvailabilityNux" }); + +export type V2ModelListResponse__ReasoningEffort = string; +export const V2ModelListResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ModelListResponse__ReasoningEffort", + }), +); + +export type V2ModelListResponse__InputModality = "text" | "image" | "audio"; +export const V2ModelListResponse__InputModality = Schema.Union( + [ + Schema.Literal("text").annotate({ description: "Plain text turns and tool payloads." }), + Schema.Literal("image").annotate({ description: "Image attachments included in user turns." }), + Schema.Literal("audio").annotate({ description: "Audio attachments included in user turns." }), + ], + { mode: "oneOf" }, +).annotate({ + description: "Canonical user-input modality tags advertised by a model.", + identifier: "V2ModelListResponse__InputModality", +}); export type V2ModelListResponse__ModelServiceTier = { readonly description: string; @@ -5434,7 +6382,7 @@ export const V2ModelListResponse__ModelServiceTier = Schema.Struct({ description: Schema.String, id: Schema.String, name: Schema.String, -}); +}).annotate({ identifier: "V2ModelListResponse__ModelServiceTier" }); export type V2ModelListResponse__ModelUpgradeInfo = { readonly migrationMarkdown?: string | null; @@ -5447,20 +6395,17 @@ export const V2ModelListResponse__ModelUpgradeInfo = Schema.Struct({ model: Schema.String, modelLink: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), upgradeCopy: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2ModelListResponse__ReasoningEffort = string; -export const V2ModelListResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).annotate({ identifier: "V2ModelListResponse__ModelUpgradeInfo" }); export type V2ModelReroutedNotification__ModelRerouteReason = "highRiskCyberActivity"; -export const V2ModelReroutedNotification__ModelRerouteReason = - Schema.Literal("highRiskCyberActivity"); +export const V2ModelReroutedNotification__ModelRerouteReason = Schema.Literal( + "highRiskCyberActivity", +).annotate({ identifier: "V2ModelReroutedNotification__ModelRerouteReason" }); export type V2ModelVerificationNotification__ModelVerification = "trustedAccessForCyber"; -export const V2ModelVerificationNotification__ModelVerification = - Schema.Literal("trustedAccessForCyber"); +export const V2ModelVerificationNotification__ModelVerification = Schema.Literal( + "trustedAccessForCyber", +).annotate({ identifier: "V2ModelVerificationNotification__ModelVerification" }); export type V2PermissionProfileListResponse__PermissionProfileSummary = { readonly allowed: boolean; @@ -5480,18 +6425,20 @@ export const V2PermissionProfileListResponse__PermissionProfileSummary = Schema. ]), ), id: Schema.String.annotate({ description: "Available permission profile identifier." }), -}); +}).annotate({ identifier: "V2PermissionProfileListResponse__PermissionProfileSummary" }); export type V2PluginInstalledParams__AbsolutePathBuf = string; export const V2PluginInstalledParams__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginInstalledParams__AbsolutePathBuf", }); export type V2PluginInstalledResponse__AbsolutePathBuf = string; export const V2PluginInstalledResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginInstalledResponse__AbsolutePathBuf", }); export type V2PluginInstalledResponse__MarketplaceInterface = { @@ -5499,13 +6446,25 @@ export type V2PluginInstalledResponse__MarketplaceInterface = { }; export const V2PluginInstalledResponse__MarketplaceInterface = Schema.Struct({ displayName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2PluginInstalledResponse__MarketplaceInterface" }); export type V2PluginInstalledResponse__PluginAuthPolicy = "ON_INSTALL" | "ON_USE"; export const V2PluginInstalledResponse__PluginAuthPolicy = Schema.Literals([ "ON_INSTALL", "ON_USE", -]); +]).annotate({ identifier: "V2PluginInstalledResponse__PluginAuthPolicy" }); + +export type V2PluginInstalledResponse__PluginAvailability = "DISABLED_BY_ADMIN" | "AVAILABLE"; +export const V2PluginInstalledResponse__PluginAvailability = Schema.Union( + [ + Schema.Literal("DISABLED_BY_ADMIN"), + Schema.Literal("AVAILABLE").annotate({ + description: + 'Plugin-service currently sends `"ENABLED"` for available remote plugins. Codex app-server exposes `"AVAILABLE"` in its API; the alias keeps decoding compatible with that upstream response.', + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2PluginInstalledResponse__PluginAvailability" }); export type V2PluginInstalledResponse__PluginInstallPolicy = | "NOT_AVAILABLE" @@ -5515,7 +6474,7 @@ export const V2PluginInstalledResponse__PluginInstallPolicy = Schema.Literals([ "NOT_AVAILABLE", "AVAILABLE", "INSTALLED_BY_DEFAULT", -]); +]).annotate({ identifier: "V2PluginInstalledResponse__PluginInstallPolicy" }); export type V2PluginInstalledResponse__PluginInstallPolicySource = | "WORKSPACE_SETTING" @@ -5523,7 +6482,7 @@ export type V2PluginInstalledResponse__PluginInstallPolicySource = export const V2PluginInstalledResponse__PluginInstallPolicySource = Schema.Literals([ "WORKSPACE_SETTING", "IMPLICIT_CANONICAL_APP", -]); +]).annotate({ identifier: "V2PluginInstalledResponse__PluginInstallPolicySource" }); export type V2PluginInstalledResponse__PluginShareDiscoverability = | "LISTED" @@ -5533,26 +6492,27 @@ export const V2PluginInstalledResponse__PluginShareDiscoverability = Schema.Lite "LISTED", "UNLISTED", "PRIVATE", -]); - -export type V2PluginInstalledResponse__PluginSharePrincipalRole = "reader" | "editor" | "owner"; -export const V2PluginInstalledResponse__PluginSharePrincipalRole = Schema.Literals([ - "reader", - "editor", - "owner", -]); +]).annotate({ identifier: "V2PluginInstalledResponse__PluginShareDiscoverability" }); export type V2PluginInstalledResponse__PluginSharePrincipalType = "user" | "group" | "workspace"; export const V2PluginInstalledResponse__PluginSharePrincipalType = Schema.Literals([ "user", "group", "workspace", -]); +]).annotate({ identifier: "V2PluginInstalledResponse__PluginSharePrincipalType" }); + +export type V2PluginInstalledResponse__PluginSharePrincipalRole = "reader" | "editor" | "owner"; +export const V2PluginInstalledResponse__PluginSharePrincipalRole = Schema.Literals([ + "reader", + "editor", + "owner", +]).annotate({ identifier: "V2PluginInstalledResponse__PluginSharePrincipalRole" }); export type V2PluginInstallParams__AbsolutePathBuf = string; export const V2PluginInstallParams__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginInstallParams__AbsolutePathBuf", }); export type V2PluginInstallResponse__AppSummary = { @@ -5568,15 +6528,22 @@ export const V2PluginInstallResponse__AppSummary = Schema.Struct({ id: Schema.String, installUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, -}).annotate({ description: "EXPERIMENTAL - app metadata summary for plugin responses." }); +}).annotate({ + description: "EXPERIMENTAL - app metadata summary for plugin responses.", + identifier: "V2PluginInstallResponse__AppSummary", +}); export type V2PluginInstallResponse__PluginAuthPolicy = "ON_INSTALL" | "ON_USE"; -export const V2PluginInstallResponse__PluginAuthPolicy = Schema.Literals(["ON_INSTALL", "ON_USE"]); +export const V2PluginInstallResponse__PluginAuthPolicy = Schema.Literals([ + "ON_INSTALL", + "ON_USE", +]).annotate({ identifier: "V2PluginInstallResponse__PluginAuthPolicy" }); export type V2PluginListParams__AbsolutePathBuf = string; export const V2PluginListParams__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginListParams__AbsolutePathBuf", }); export type V2PluginListParams__PluginListMarketplaceKind = @@ -5591,21 +6558,37 @@ export const V2PluginListParams__PluginListMarketplaceKind = Schema.Literals([ "workspace-directory", "shared-with-me", "created-by-me-remote", -]); +]).annotate({ identifier: "V2PluginListParams__PluginListMarketplaceKind" }); export type V2PluginListResponse__AbsolutePathBuf = string; export const V2PluginListResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginListResponse__AbsolutePathBuf", }); export type V2PluginListResponse__MarketplaceInterface = { readonly displayName?: string | null }; export const V2PluginListResponse__MarketplaceInterface = Schema.Struct({ displayName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2PluginListResponse__MarketplaceInterface" }); export type V2PluginListResponse__PluginAuthPolicy = "ON_INSTALL" | "ON_USE"; -export const V2PluginListResponse__PluginAuthPolicy = Schema.Literals(["ON_INSTALL", "ON_USE"]); +export const V2PluginListResponse__PluginAuthPolicy = Schema.Literals([ + "ON_INSTALL", + "ON_USE", +]).annotate({ identifier: "V2PluginListResponse__PluginAuthPolicy" }); + +export type V2PluginListResponse__PluginAvailability = "DISABLED_BY_ADMIN" | "AVAILABLE"; +export const V2PluginListResponse__PluginAvailability = Schema.Union( + [ + Schema.Literal("DISABLED_BY_ADMIN"), + Schema.Literal("AVAILABLE").annotate({ + description: + 'Plugin-service currently sends `"ENABLED"` for available remote plugins. Codex app-server exposes `"AVAILABLE"` in its API; the alias keeps decoding compatible with that upstream response.', + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2PluginListResponse__PluginAvailability" }); export type V2PluginListResponse__PluginInstallPolicy = | "NOT_AVAILABLE" @@ -5615,7 +6598,7 @@ export const V2PluginListResponse__PluginInstallPolicy = Schema.Literals([ "NOT_AVAILABLE", "AVAILABLE", "INSTALLED_BY_DEFAULT", -]); +]).annotate({ identifier: "V2PluginListResponse__PluginInstallPolicy" }); export type V2PluginListResponse__PluginInstallPolicySource = | "WORKSPACE_SETTING" @@ -5623,40 +6606,43 @@ export type V2PluginListResponse__PluginInstallPolicySource = export const V2PluginListResponse__PluginInstallPolicySource = Schema.Literals([ "WORKSPACE_SETTING", "IMPLICIT_CANONICAL_APP", -]); +]).annotate({ identifier: "V2PluginListResponse__PluginInstallPolicySource" }); export type V2PluginListResponse__PluginShareDiscoverability = "LISTED" | "UNLISTED" | "PRIVATE"; export const V2PluginListResponse__PluginShareDiscoverability = Schema.Literals([ "LISTED", "UNLISTED", "PRIVATE", -]); - -export type V2PluginListResponse__PluginSharePrincipalRole = "reader" | "editor" | "owner"; -export const V2PluginListResponse__PluginSharePrincipalRole = Schema.Literals([ - "reader", - "editor", - "owner", -]); +]).annotate({ identifier: "V2PluginListResponse__PluginShareDiscoverability" }); export type V2PluginListResponse__PluginSharePrincipalType = "user" | "group" | "workspace"; export const V2PluginListResponse__PluginSharePrincipalType = Schema.Literals([ "user", "group", "workspace", -]); +]).annotate({ identifier: "V2PluginListResponse__PluginSharePrincipalType" }); + +export type V2PluginListResponse__PluginSharePrincipalRole = "reader" | "editor" | "owner"; +export const V2PluginListResponse__PluginSharePrincipalRole = Schema.Literals([ + "reader", + "editor", + "owner", +]).annotate({ identifier: "V2PluginListResponse__PluginSharePrincipalRole" }); export type V2PluginReadParams__AbsolutePathBuf = string; export const V2PluginReadParams__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginReadParams__AbsolutePathBuf", }); -export type V2PluginReadResponse__AbsolutePathBuf = string; -export const V2PluginReadResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); +export type V2PluginReadResponse__AppTemplateUnavailableReason = + | "NOT_CONFIGURED_FOR_WORKSPACE" + | "NO_ACTIVE_WORKSPACE"; +export const V2PluginReadResponse__AppTemplateUnavailableReason = Schema.Literals([ + "NOT_CONFIGURED_FOR_WORKSPACE", + "NO_ACTIVE_WORKSPACE", +]).annotate({ identifier: "V2PluginReadResponse__AppTemplateUnavailableReason" }); export type V2PluginReadResponse__AppSummary = { readonly category?: string | null; @@ -5671,15 +6657,10 @@ export const V2PluginReadResponse__AppSummary = Schema.Struct({ id: Schema.String, installUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, -}).annotate({ description: "EXPERIMENTAL - app metadata summary for plugin responses." }); - -export type V2PluginReadResponse__AppTemplateUnavailableReason = - | "NOT_CONFIGURED_FOR_WORKSPACE" - | "NO_ACTIVE_WORKSPACE"; -export const V2PluginReadResponse__AppTemplateUnavailableReason = Schema.Literals([ - "NOT_CONFIGURED_FOR_WORKSPACE", - "NO_ACTIVE_WORKSPACE", -]); +}).annotate({ + description: "EXPERIMENTAL - app metadata summary for plugin responses.", + identifier: "V2PluginReadResponse__AppSummary", +}); export type V2PluginReadResponse__HookEventName = | "preToolUse" @@ -5705,10 +6686,50 @@ export const V2PluginReadResponse__HookEventName = Schema.Literals([ "subagentStart", "subagentStop", "stop", -]); +]).annotate({ identifier: "V2PluginReadResponse__HookEventName" }); + +export type V2PluginReadResponse__AbsolutePathBuf = string; +export const V2PluginReadResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginReadResponse__AbsolutePathBuf", +}); + +export type V2PluginReadResponse__ScheduledTaskWeekday = + | "MO" + | "TU" + | "WE" + | "TH" + | "FR" + | "SA" + | "SU"; +export const V2PluginReadResponse__ScheduledTaskWeekday = Schema.Literals([ + "MO", + "TU", + "WE", + "TH", + "FR", + "SA", + "SU", +]).annotate({ identifier: "V2PluginReadResponse__ScheduledTaskWeekday" }); export type V2PluginReadResponse__PluginAuthPolicy = "ON_INSTALL" | "ON_USE"; -export const V2PluginReadResponse__PluginAuthPolicy = Schema.Literals(["ON_INSTALL", "ON_USE"]); +export const V2PluginReadResponse__PluginAuthPolicy = Schema.Literals([ + "ON_INSTALL", + "ON_USE", +]).annotate({ identifier: "V2PluginReadResponse__PluginAuthPolicy" }); + +export type V2PluginReadResponse__PluginAvailability = "DISABLED_BY_ADMIN" | "AVAILABLE"; +export const V2PluginReadResponse__PluginAvailability = Schema.Union( + [ + Schema.Literal("DISABLED_BY_ADMIN"), + Schema.Literal("AVAILABLE").annotate({ + description: + 'Plugin-service currently sends `"ENABLED"` for available remote plugins. Codex app-server exposes `"AVAILABLE"` in its API; the alias keeps decoding compatible with that upstream response.', + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2PluginReadResponse__PluginAvailability" }); export type V2PluginReadResponse__PluginInstallPolicy = | "NOT_AVAILABLE" @@ -5718,7 +6739,7 @@ export const V2PluginReadResponse__PluginInstallPolicy = Schema.Literals([ "NOT_AVAILABLE", "AVAILABLE", "INSTALLED_BY_DEFAULT", -]); +]).annotate({ identifier: "V2PluginReadResponse__PluginInstallPolicy" }); export type V2PluginReadResponse__PluginInstallPolicySource = | "WORKSPACE_SETTING" @@ -5726,64 +6747,60 @@ export type V2PluginReadResponse__PluginInstallPolicySource = export const V2PluginReadResponse__PluginInstallPolicySource = Schema.Literals([ "WORKSPACE_SETTING", "IMPLICIT_CANONICAL_APP", -]); +]).annotate({ identifier: "V2PluginReadResponse__PluginInstallPolicySource" }); export type V2PluginReadResponse__PluginShareDiscoverability = "LISTED" | "UNLISTED" | "PRIVATE"; export const V2PluginReadResponse__PluginShareDiscoverability = Schema.Literals([ "LISTED", "UNLISTED", "PRIVATE", -]); - -export type V2PluginReadResponse__PluginSharePrincipalRole = "reader" | "editor" | "owner"; -export const V2PluginReadResponse__PluginSharePrincipalRole = Schema.Literals([ - "reader", - "editor", - "owner", -]); +]).annotate({ identifier: "V2PluginReadResponse__PluginShareDiscoverability" }); export type V2PluginReadResponse__PluginSharePrincipalType = "user" | "group" | "workspace"; export const V2PluginReadResponse__PluginSharePrincipalType = Schema.Literals([ "user", "group", "workspace", -]); +]).annotate({ identifier: "V2PluginReadResponse__PluginSharePrincipalType" }); -export type V2PluginReadResponse__ScheduledTaskWeekday = - | "MO" - | "TU" - | "WE" - | "TH" - | "FR" - | "SA" - | "SU"; -export const V2PluginReadResponse__ScheduledTaskWeekday = Schema.Literals([ - "MO", - "TU", - "WE", - "TH", - "FR", - "SA", - "SU", -]); +export type V2PluginReadResponse__PluginSharePrincipalRole = "reader" | "editor" | "owner"; +export const V2PluginReadResponse__PluginSharePrincipalRole = Schema.Literals([ + "reader", + "editor", + "owner", +]).annotate({ identifier: "V2PluginReadResponse__PluginSharePrincipalRole" }); export type V2PluginShareCheckoutResponse__AbsolutePathBuf = string; export const V2PluginShareCheckoutResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginShareCheckoutResponse__AbsolutePathBuf", }); export type V2PluginShareListResponse__AbsolutePathBuf = string; export const V2PluginShareListResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginShareListResponse__AbsolutePathBuf", }); export type V2PluginShareListResponse__PluginAuthPolicy = "ON_INSTALL" | "ON_USE"; export const V2PluginShareListResponse__PluginAuthPolicy = Schema.Literals([ "ON_INSTALL", "ON_USE", -]); +]).annotate({ identifier: "V2PluginShareListResponse__PluginAuthPolicy" }); + +export type V2PluginShareListResponse__PluginAvailability = "DISABLED_BY_ADMIN" | "AVAILABLE"; +export const V2PluginShareListResponse__PluginAvailability = Schema.Union( + [ + Schema.Literal("DISABLED_BY_ADMIN"), + Schema.Literal("AVAILABLE").annotate({ + description: + 'Plugin-service currently sends `"ENABLED"` for available remote plugins. Codex app-server exposes `"AVAILABLE"` in its API; the alias keeps decoding compatible with that upstream response.', + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2PluginShareListResponse__PluginAvailability" }); export type V2PluginShareListResponse__PluginInstallPolicy = | "NOT_AVAILABLE" @@ -5793,7 +6810,7 @@ export const V2PluginShareListResponse__PluginInstallPolicy = Schema.Literals([ "NOT_AVAILABLE", "AVAILABLE", "INSTALLED_BY_DEFAULT", -]); +]).annotate({ identifier: "V2PluginShareListResponse__PluginInstallPolicy" }); export type V2PluginShareListResponse__PluginInstallPolicySource = | "WORKSPACE_SETTING" @@ -5801,7 +6818,7 @@ export type V2PluginShareListResponse__PluginInstallPolicySource = export const V2PluginShareListResponse__PluginInstallPolicySource = Schema.Literals([ "WORKSPACE_SETTING", "IMPLICIT_CANONICAL_APP", -]); +]).annotate({ identifier: "V2PluginShareListResponse__PluginInstallPolicySource" }); export type V2PluginShareListResponse__PluginShareDiscoverability = | "LISTED" @@ -5811,44 +6828,58 @@ export const V2PluginShareListResponse__PluginShareDiscoverability = Schema.Lite "LISTED", "UNLISTED", "PRIVATE", -]); - -export type V2PluginShareListResponse__PluginSharePrincipalRole = "reader" | "editor" | "owner"; -export const V2PluginShareListResponse__PluginSharePrincipalRole = Schema.Literals([ - "reader", - "editor", - "owner", -]); +]).annotate({ identifier: "V2PluginShareListResponse__PluginShareDiscoverability" }); export type V2PluginShareListResponse__PluginSharePrincipalType = "user" | "group" | "workspace"; export const V2PluginShareListResponse__PluginSharePrincipalType = Schema.Literals([ "user", "group", "workspace", -]); +]).annotate({ identifier: "V2PluginShareListResponse__PluginSharePrincipalType" }); -export type V2PluginShareSaveParams__AbsolutePathBuf = string; -export const V2PluginShareSaveParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); +export type V2PluginShareListResponse__PluginSharePrincipalRole = "reader" | "editor" | "owner"; +export const V2PluginShareListResponse__PluginSharePrincipalRole = Schema.Literals([ + "reader", + "editor", + "owner", +]).annotate({ identifier: "V2PluginShareListResponse__PluginSharePrincipalRole" }); export type V2PluginShareSaveParams__PluginShareDiscoverability = "LISTED" | "UNLISTED" | "PRIVATE"; export const V2PluginShareSaveParams__PluginShareDiscoverability = Schema.Literals([ "LISTED", "UNLISTED", "PRIVATE", -]); +]).annotate({ identifier: "V2PluginShareSaveParams__PluginShareDiscoverability" }); + +export type V2PluginShareSaveParams__AbsolutePathBuf = string; +export const V2PluginShareSaveParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2PluginShareSaveParams__AbsolutePathBuf", +}); export type V2PluginShareSaveParams__PluginSharePrincipalType = "user" | "group" | "workspace"; export const V2PluginShareSaveParams__PluginSharePrincipalType = Schema.Literals([ "user", "group", "workspace", -]); +]).annotate({ identifier: "V2PluginShareSaveParams__PluginSharePrincipalType" }); export type V2PluginShareSaveParams__PluginShareTargetRole = "reader" | "editor"; -export const V2PluginShareSaveParams__PluginShareTargetRole = Schema.Literals(["reader", "editor"]); +export const V2PluginShareSaveParams__PluginShareTargetRole = Schema.Literals([ + "reader", + "editor", +]).annotate({ identifier: "V2PluginShareSaveParams__PluginShareTargetRole" }); + +export type V2PluginShareUpdateTargetsParams__PluginShareUpdateDiscoverability = + | "UNLISTED" + | "PRIVATE" + | "LISTED"; +export const V2PluginShareUpdateTargetsParams__PluginShareUpdateDiscoverability = Schema.Literals([ + "UNLISTED", + "PRIVATE", + "LISTED", +]).annotate({ identifier: "V2PluginShareUpdateTargetsParams__PluginShareUpdateDiscoverability" }); export type V2PluginShareUpdateTargetsParams__PluginSharePrincipalType = | "user" @@ -5858,23 +6889,13 @@ export const V2PluginShareUpdateTargetsParams__PluginSharePrincipalType = Schema "user", "group", "workspace", -]); +]).annotate({ identifier: "V2PluginShareUpdateTargetsParams__PluginSharePrincipalType" }); export type V2PluginShareUpdateTargetsParams__PluginShareTargetRole = "reader" | "editor"; export const V2PluginShareUpdateTargetsParams__PluginShareTargetRole = Schema.Literals([ "reader", "editor", -]); - -export type V2PluginShareUpdateTargetsParams__PluginShareUpdateDiscoverability = - | "UNLISTED" - | "PRIVATE" - | "LISTED"; -export const V2PluginShareUpdateTargetsParams__PluginShareUpdateDiscoverability = Schema.Literals([ - "UNLISTED", - "PRIVATE", - "LISTED", -]); +]).annotate({ identifier: "V2PluginShareUpdateTargetsParams__PluginShareTargetRole" }); export type V2PluginShareUpdateTargetsResponse__PluginShareDiscoverability = | "LISTED" @@ -5884,7 +6905,17 @@ export const V2PluginShareUpdateTargetsResponse__PluginShareDiscoverability = Sc "LISTED", "UNLISTED", "PRIVATE", -]); +]).annotate({ identifier: "V2PluginShareUpdateTargetsResponse__PluginShareDiscoverability" }); + +export type V2PluginShareUpdateTargetsResponse__PluginSharePrincipalType = + | "user" + | "group" + | "workspace"; +export const V2PluginShareUpdateTargetsResponse__PluginSharePrincipalType = Schema.Literals([ + "user", + "group", + "workspace", +]).annotate({ identifier: "V2PluginShareUpdateTargetsResponse__PluginSharePrincipalType" }); export type V2PluginShareUpdateTargetsResponse__PluginSharePrincipalRole = | "reader" @@ -5894,17 +6925,21 @@ export const V2PluginShareUpdateTargetsResponse__PluginSharePrincipalRole = Sche "reader", "editor", "owner", -]); +]).annotate({ identifier: "V2PluginShareUpdateTargetsResponse__PluginSharePrincipalRole" }); -export type V2PluginShareUpdateTargetsResponse__PluginSharePrincipalType = - | "user" - | "group" - | "workspace"; -export const V2PluginShareUpdateTargetsResponse__PluginSharePrincipalType = Schema.Literals([ - "user", - "group", - "workspace", -]); +export type V2ProcessOutputDeltaNotification__ProcessOutputStream = "stdout" | "stderr"; +export const V2ProcessOutputDeltaNotification__ProcessOutputStream = Schema.Union( + [ + Schema.Literal("stdout").annotate({ + description: "stdout stream. PTY mode multiplexes terminal output here.", + }), + Schema.Literal("stderr").annotate({ description: "stderr stream." }), + ], + { mode: "oneOf" }, +).annotate({ + description: "Stream label for `process/outputDelta` notifications.", + identifier: "V2ProcessOutputDeltaNotification__ProcessOutputStream", +}); export type V2RawResponseCompletedNotification__TokenUsageBreakdown = { readonly cacheWriteInputTokens?: number; @@ -5916,35 +6951,26 @@ export type V2RawResponseCompletedNotification__TokenUsageBreakdown = { }; export const V2RawResponseCompletedNotification__TokenUsageBreakdown = Schema.Struct({ cacheWriteInputTokens: Schema.optionalKey( - Schema.Number.annotate({ default: 0, format: "int64" }).check(Schema.isInt()), + Schema.Number.annotate({ default: 0, format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), ), - cachedInputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - inputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - outputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - reasoningOutputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - totalTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -}); - -export type V2RawResponseItemCompletedNotification__AgentMessageInputContent = - | { readonly text: string; readonly type: "input_text" } - | { readonly encrypted_content: string; readonly type: "encrypted_content" }; -export const V2RawResponseItemCompletedNotification__AgentMessageInputContent = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("input_text").annotate({ - title: "InputTextAgentMessageInputContentType", - }), - }).annotate({ title: "InputTextAgentMessageInputContent" }), - Schema.Struct({ - encrypted_content: Schema.String, - type: Schema.Literal("encrypted_content").annotate({ - title: "EncryptedContentAgentMessageInputContentType", - }), - }).annotate({ title: "EncryptedContentAgentMessageInputContent" }), - ], - { mode: "oneOf" }, -); + cachedInputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + inputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + outputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + reasoningOutputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + totalTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +}).annotate({ identifier: "V2RawResponseCompletedNotification__TokenUsageBreakdown" }); export type V2RawResponseItemCompletedNotification__ImageDetail = | "auto" @@ -5956,7 +6982,7 @@ export const V2RawResponseItemCompletedNotification__ImageDetail = Schema.Litera "low", "high", "original", -]); +]).annotate({ identifier: "V2RawResponseItemCompletedNotification__ImageDetail" }); export type V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough = { readonly turn_id?: string | null; @@ -5967,58 +6993,48 @@ export const V2RawResponseItemCompletedNotification__InternalChatMessageMetadata }).annotate({ description: "Internal Responses API passthrough metadata copied into underlying chat messages.\n\nResponses API strongly types this payload. Do not modify it without first getting API approval and making the corresponding Responses API change.", + identifier: "V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough", }); -export type V2RawResponseItemCompletedNotification__LocalShellAction = { - readonly command: ReadonlyArray; - readonly env?: { readonly [x: string]: string } | null; - readonly timeout_ms?: number | null; - readonly type: "exec"; - readonly user?: string | null; - readonly working_directory?: string | null; -}; -export const V2RawResponseItemCompletedNotification__LocalShellAction = Schema.Union( +export type V2RawResponseItemCompletedNotification__MessagePhase = "commentary" | "final_answer"; +export const V2RawResponseItemCompletedNotification__MessagePhase = Schema.Union( [ - Schema.Struct({ - command: Schema.Array(Schema.String), - env: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.String), Schema.Null]), - ), - timeout_ms: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - type: Schema.Literal("exec").annotate({ title: "ExecLocalShellActionType" }), - user: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - working_directory: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - }).annotate({ title: "ExecLocalShellAction" }), + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), ], { mode: "oneOf" }, -); - -export type V2RawResponseItemCompletedNotification__LocalShellStatus = - | "completed" - | "in_progress" - | "incomplete"; -export const V2RawResponseItemCompletedNotification__LocalShellStatus = Schema.Literals([ - "completed", - "in_progress", - "incomplete", -]); - -export type V2RawResponseItemCompletedNotification__MessagePhase = "commentary" | "final_answer"; -export const V2RawResponseItemCompletedNotification__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2RawResponseItemCompletedNotification__MessagePhase", }); +export type V2RawResponseItemCompletedNotification__AgentMessageInputContent = + | { readonly text: string; readonly type: "input_text" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2RawResponseItemCompletedNotification__AgentMessageInputContent = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextAgentMessageInputContentType", + }), + }).annotate({ title: "InputTextAgentMessageInputContent" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentAgentMessageInputContentType", + }), + }).annotate({ title: "EncryptedContentAgentMessageInputContent" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2RawResponseItemCompletedNotification__AgentMessageInputContent" }); + export type V2RawResponseItemCompletedNotification__ReasoningItemContent = | { readonly text: string; readonly type: "reasoning_text" } | { readonly text: string; readonly type: "text" }; @@ -6036,7 +7052,7 @@ export const V2RawResponseItemCompletedNotification__ReasoningItemContent = Sche }).annotate({ title: "TextReasoningItemContent" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2RawResponseItemCompletedNotification__ReasoningItemContent" }); export type V2RawResponseItemCompletedNotification__ReasoningItemReasoningSummary = { readonly text: string; @@ -6052,7 +7068,52 @@ export const V2RawResponseItemCompletedNotification__ReasoningItemReasoningSumma }).annotate({ title: "SummaryTextReasoningItemReasoningSummary" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2RawResponseItemCompletedNotification__ReasoningItemReasoningSummary" }); + +export type V2RawResponseItemCompletedNotification__LocalShellAction = { + readonly command: ReadonlyArray; + readonly env?: { readonly [x: string]: string } | null; + readonly timeout_ms?: number | null; + readonly type: "exec"; + readonly user?: string | null; + readonly working_directory?: string | null; +}; +export const V2RawResponseItemCompletedNotification__LocalShellAction = Schema.Union( + [ + Schema.Struct({ + command: Schema.Array(Schema.String), + env: Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.String), Schema.Null]), + ), + timeout_ms: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("exec").annotate({ title: "ExecLocalShellActionType" }), + user: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + working_directory: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "ExecLocalShellAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2RawResponseItemCompletedNotification__LocalShellAction" }); + +export type V2RawResponseItemCompletedNotification__LocalShellStatus = + | "completed" + | "in_progress" + | "incomplete"; +export const V2RawResponseItemCompletedNotification__LocalShellStatus = Schema.Literals([ + "completed", + "in_progress", + "incomplete", +]).annotate({ identifier: "V2RawResponseItemCompletedNotification__LocalShellStatus" }); export type V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction = | { @@ -6092,7 +7153,7 @@ export const V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction }).annotate({ title: "OtherResponsesApiWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction" }); export type V2RemoteControlStatusChangedNotification__RemoteControlConnectionStatus = | "disabled" @@ -6100,10 +7161,14 @@ export type V2RemoteControlStatusChangedNotification__RemoteControlConnectionSta | "connected" | "errored"; export const V2RemoteControlStatusChangedNotification__RemoteControlConnectionStatus = - Schema.Literals(["disabled", "connecting", "connected", "errored"]); + Schema.Literals(["disabled", "connecting", "connected", "errored"]).annotate({ + identifier: "V2RemoteControlStatusChangedNotification__RemoteControlConnectionStatus", + }); export type V2ReviewStartParams__ReviewDelivery = "inline" | "detached"; -export const V2ReviewStartParams__ReviewDelivery = Schema.Literals(["inline", "detached"]); +export const V2ReviewStartParams__ReviewDelivery = Schema.Literals(["inline", "detached"]).annotate( + { identifier: "V2ReviewStartParams__ReviewDelivery" }, +); export type V2ReviewStartParams__ReviewTarget = | { readonly type: "uncommittedChanges" } @@ -6151,31 +7216,107 @@ export const V2ReviewStartParams__ReviewTarget = Schema.Union( }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ReviewStartParams__ReviewTarget" }); + +export type V2ReviewStartResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ReviewStartResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ReviewStartResponse__NonSteerableTurnKind" }); + +export type V2ReviewStartResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ReviewStartResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ReviewStartResponse__ByteRange" }); + +export type V2ReviewStartResponse__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2ReviewStartResponse__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2ReviewStartResponse__ImageDetail" }); + +export type V2ReviewStartResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; +}; +export const V2ReviewStartResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ReviewStartResponse__HookPromptFragment" }); + +export type V2ReviewStartResponse__MemoryCitationEntry = { + readonly lineEnd: number; + readonly lineStart: number; + readonly note: string; + readonly path: string; +}; +export const V2ReviewStartResponse__MemoryCitationEntry = Schema.Struct({ + lineEnd: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + lineStart: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + note: Schema.String, + path: Schema.String, +}).annotate({ identifier: "V2ReviewStartResponse__MemoryCitationEntry" }); + +export type V2ReviewStartResponse__MessagePhase = "commentary" | "final_answer"; +export const V2ReviewStartResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ReviewStartResponse__MessagePhase", +}); export type V2ReviewStartResponse__AbsolutePathBuf = string; export const V2ReviewStartResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ReviewStartResponse__AbsolutePathBuf", }); -export type V2ReviewStartResponse__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ReviewStartResponse__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2ReviewStartResponse__LegacyAppPathString = string; +export const V2ReviewStartResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ReviewStartResponse__LegacyAppPathString", +}); + +export type V2ReviewStartResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ReviewStartResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ReviewStartResponse__CommandExecutionSource" }); export type V2ReviewStartResponse__CommandExecutionStatus = | "inProgress" @@ -6187,62 +7328,39 @@ export const V2ReviewStartResponse__CommandExecutionStatus = Schema.Literals([ "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ReviewStartResponse__CommandExecutionStatus" }); -export type V2ReviewStartResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ReviewStartResponse__DynamicToolCallOutputContentItem = Schema.Union( +export type V2ReviewStartResponse__PatchChangeKind = + | { readonly type: "add" } + | { readonly type: "delete" } + | { readonly move_path?: string | null; readonly type: "update" }; +export const V2ReviewStartResponse__PatchChangeKind = Schema.Union( [ Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), + }).annotate({ title: "AddPatchChangeKind" }), Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), + }).annotate({ title: "DeletePatchChangeKind" }), Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), + }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ReviewStartResponse__PatchChangeKind" }); -export type V2ReviewStartResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ReviewStartResponse__DynamicToolCallStatus = Schema.Literals([ +export type V2ReviewStartResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ReviewStartResponse__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2ReviewStartResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ReviewStartResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, -}); - -export type V2ReviewStartResponse__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2ReviewStartResponse__ImageDetail = Schema.Literals([ - "auto", - "low", - "high", - "original", -]); - -export type V2ReviewStartResponse__LegacyAppPathString = string; -export const V2ReviewStartResponse__LegacyAppPathString = Schema.String; + "declined", +]).annotate({ identifier: "V2ReviewStartResponse__PatchApplyStatus" }); export type V2ReviewStartResponse__McpToolCallAppContext = { readonly actionName?: string | null; @@ -6257,94 +7375,127 @@ export const V2ReviewStartResponse__McpToolCallAppContext = Schema.Struct({ connectorId: Schema.String, linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2ReviewStartResponse__McpToolCallAppContext" }); export type V2ReviewStartResponse__McpToolCallError = { readonly message: string }; -export const V2ReviewStartResponse__McpToolCallError = Schema.Struct({ message: Schema.String }); +export const V2ReviewStartResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ReviewStartResponse__McpToolCallError" }); export type V2ReviewStartResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; }; export const V2ReviewStartResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ReviewStartResponse__McpToolCallResult" }); export type V2ReviewStartResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; export const V2ReviewStartResponse__McpToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2ReviewStartResponse__MemoryCitationEntry = { - readonly lineEnd: number; - readonly lineStart: number; - readonly note: string; - readonly path: string; -}; -export const V2ReviewStartResponse__MemoryCitationEntry = Schema.Struct({ - lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - note: Schema.String, - path: Schema.String, -}); - -export type V2ReviewStartResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ReviewStartResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ - description: - 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', -}); - -export type V2ReviewStartResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ReviewStartResponse__NonSteerableTurnKind = Schema.Literals(["review", "compact"]); - -export type V2ReviewStartResponse__PatchApplyStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2ReviewStartResponse__PatchApplyStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); +]).annotate({ identifier: "V2ReviewStartResponse__McpToolCallStatus" }); -export type V2ReviewStartResponse__PatchChangeKind = - | { readonly type: "add" } - | { readonly type: "delete" } - | { readonly move_path?: string | null; readonly type: "update" }; -export const V2ReviewStartResponse__PatchChangeKind = Schema.Union( +export type V2ReviewStartResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ReviewStartResponse__DynamicToolCallOutputContentItem = Schema.Union( [ Schema.Struct({ - type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), - }).annotate({ title: "AddPatchChangeKind" }), + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), Schema.Struct({ - type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), - }).annotate({ title: "DeletePatchChangeKind" }), + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), Schema.Struct({ - move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), - }).annotate({ title: "UpdatePatchChangeKind" }), + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ReviewStartResponse__DynamicToolCallOutputContentItem" }); + +export type V2ReviewStartResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ReviewStartResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ReviewStartResponse__DynamicToolCallStatus" }); + +export type V2ReviewStartResponse__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ReviewStartResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ReviewStartResponse__CollabAgentStatus" }); export type V2ReviewStartResponse__ReasoningEffort = string; export const V2ReviewStartResponse__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ReviewStartResponse__ReasoningEffort", + }), +); + +export type V2ReviewStartResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2ReviewStartResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2ReviewStartResponse__CollabAgentToolCallStatus" }); + +export type V2ReviewStartResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ReviewStartResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ReviewStartResponse__CollabAgentTool" }); export type V2ReviewStartResponse__SubAgentActivityKind = | "started" @@ -6356,44 +7507,7 @@ export const V2ReviewStartResponse__SubAgentActivityKind = Schema.Literals([ "interacted", "interrupted", "completed", -]); - -export type V2ReviewStartResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2ReviewStartResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type V2ReviewStartResponse__TurnStatus = - | "completed" - | "interrupted" - | "failed" - | "inProgress"; -export const V2ReviewStartResponse__TurnStatus = Schema.Literals([ - "completed", - "interrupted", - "failed", - "inProgress", -]); +]).annotate({ identifier: "V2ReviewStartResponse__SubAgentActivityKind" }); export type V2ReviewStartResponse__WebSearchAction = | { @@ -6425,13 +7539,42 @@ export const V2ReviewStartResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ReviewStartResponse__WebSearchAction" }); + +export type V2ReviewStartResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ReviewStartResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ReviewStartResponse__TurnItemsView" }); + +export type V2ReviewStartResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ReviewStartResponse__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2ReviewStartResponse__TurnStatus" }); export type V2SendAddCreditsNudgeEmailParams__AddCreditsNudgeCreditType = "credits" | "usage_limit"; export const V2SendAddCreditsNudgeEmailParams__AddCreditsNudgeCreditType = Schema.Literals([ "credits", "usage_limit", -]); +]).annotate({ identifier: "V2SendAddCreditsNudgeEmailParams__AddCreditsNudgeCreditType" }); export type V2SendAddCreditsNudgeEmailResponse__AddCreditsNudgeEmailStatus = | "sent" @@ -6439,30 +7582,28 @@ export type V2SendAddCreditsNudgeEmailResponse__AddCreditsNudgeEmailStatus = export const V2SendAddCreditsNudgeEmailResponse__AddCreditsNudgeEmailStatus = Schema.Literals([ "sent", "cooldown_active", -]); +]).annotate({ identifier: "V2SendAddCreditsNudgeEmailResponse__AddCreditsNudgeEmailStatus" }); export type V2ServerRequestResolvedNotification__RequestId = string | number; export const V2ServerRequestResolvedNotification__RequestId = Schema.Union([ Schema.String, - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -]); + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +]).annotate({ identifier: "V2ServerRequestResolvedNotification__RequestId" }); export type V2SkillsConfigWriteParams__AbsolutePathBuf = string; export const V2SkillsConfigWriteParams__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2SkillsConfigWriteParams__AbsolutePathBuf", }); export type V2SkillsExtraRootsSetParams__AbsolutePathBuf = string; export const V2SkillsExtraRootsSetParams__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type V2SkillsListResponse__AbsolutePathBuf = string; -export const V2SkillsListResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2SkillsExtraRootsSetParams__AbsolutePathBuf", }); export type V2SkillsListResponse__SkillErrorInfo = { @@ -6472,15 +7613,7 @@ export type V2SkillsListResponse__SkillErrorInfo = { export const V2SkillsListResponse__SkillErrorInfo = Schema.Struct({ message: Schema.String, path: Schema.String, -}); - -export type V2SkillsListResponse__SkillScope = "user" | "repo" | "system" | "admin"; -export const V2SkillsListResponse__SkillScope = Schema.Literals([ - "user", - "repo", - "system", - "admin", -]); +}).annotate({ identifier: "V2SkillsListResponse__SkillErrorInfo" }); export type V2SkillsListResponse__SkillToolDependency = { readonly command?: string | null; @@ -6497,18 +7630,23 @@ export const V2SkillsListResponse__SkillToolDependency = Schema.Struct({ type: Schema.String, url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), value: Schema.String, -}); +}).annotate({ identifier: "V2SkillsListResponse__SkillToolDependency" }); -export type V2ThreadForkParams__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; -export const V2ThreadForkParams__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ +export type V2SkillsListResponse__AbsolutePathBuf = string; +export const V2SkillsListResponse__AbsolutePathBuf = Schema.String.annotate({ description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2SkillsListResponse__AbsolutePathBuf", }); +export type V2SkillsListResponse__SkillScope = "user" | "repo" | "system" | "admin"; +export const V2SkillsListResponse__SkillScope = Schema.Literals([ + "user", + "repo", + "system", + "admin", +]).annotate({ identifier: "V2SkillsListResponse__SkillScope" }); + export type V2ThreadForkParams__AskForApproval = | "untrusted" | "on-request" @@ -6536,7 +7674,18 @@ export const V2ThreadForkParams__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadForkParams__AskForApproval" }); + +export type V2ThreadForkParams__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; +export const V2ThreadForkParams__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "V2ThreadForkParams__ApprovalsReviewer", +}); export type V2ThreadForkParams__SandboxMode = | "read-only" @@ -6546,20 +7695,13 @@ export const V2ThreadForkParams__SandboxMode = Schema.Literals([ "read-only", "workspace-write", "danger-full-access", -]); +]).annotate({ identifier: "V2ThreadForkParams__SandboxMode" }); export type V2ThreadForkParams__ThreadSource = string; -export const V2ThreadForkParams__ThreadSource = Schema.String; - -export type V2ThreadForkResponse__AbsolutePathBuf = string; -export const V2ThreadForkResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", +export const V2ThreadForkParams__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadForkParams__ThreadSource", }); -export type V2ThreadForkResponse__AgentPath = string; -export const V2ThreadForkResponse__AgentPath = Schema.String; - export type V2ThreadForkResponse__AskForApproval = | "untrusted" | "on-request" @@ -6587,72 +7729,46 @@ export const V2ThreadForkResponse__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadForkResponse__AskForApproval" }); -export type V2ThreadForkResponse__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ThreadForkResponse__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2ThreadForkResponse__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; +export const V2ThreadForkResponse__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "V2ThreadForkResponse__ApprovalsReviewer", +}); -export type V2ThreadForkResponse__CommandExecutionStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2ThreadForkResponse__CommandExecutionStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); +export type V2ThreadForkResponse__AbsolutePathBuf = string; +export const V2ThreadForkResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadForkResponse__AbsolutePathBuf", +}); -export type V2ThreadForkResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadForkResponse__DynamicToolCallOutputContentItem = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), - Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), - Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), - ], - { mode: "oneOf" }, +export type V2ThreadForkResponse__LegacyAppPathString = string; +export const V2ThreadForkResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadForkResponse__LegacyAppPathString", +}); + +export type V2ThreadForkResponse__ReasoningEffort = string; +export const V2ThreadForkResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadForkResponse__ReasoningEffort", + }), ); -export type V2ThreadForkResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadForkResponse__DynamicToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export type V2ThreadForkResponse__NetworkAccess = "restricted" | "enabled"; +export const V2ThreadForkResponse__NetworkAccess = Schema.Literals([ + "restricted", + "enabled", +]).annotate({ identifier: "V2ThreadForkResponse__NetworkAccess" }); export type V2ThreadForkResponse__GitInfo = { readonly branch?: string | null; @@ -6663,63 +7779,65 @@ export const V2ThreadForkResponse__GitInfo = Schema.Struct({ branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadForkResponse__GitInfo" }); + +export type V2ThreadForkResponse__AgentPath = string; +export const V2ThreadForkResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadForkResponse__AgentPath", }); -export type V2ThreadForkResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ThreadForkResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, +export type V2ThreadForkResponse__ThreadId = string; +export const V2ThreadForkResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadForkResponse__ThreadId", +}); + +export type V2ThreadForkResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; +export const V2ThreadForkResponse__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadForkResponse__ThreadActiveFlag" }); + +export type V2ThreadForkResponse__ThreadSource = string; +export const V2ThreadForkResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadForkResponse__ThreadSource", }); +export type V2ThreadForkResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadForkResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ThreadForkResponse__NonSteerableTurnKind" }); + +export type V2ThreadForkResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadForkResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadForkResponse__ByteRange" }); + export type V2ThreadForkResponse__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadForkResponse__ImageDetail = Schema.Literals([ "auto", "low", "high", "original", -]); - -export type V2ThreadForkResponse__LegacyAppPathString = string; -export const V2ThreadForkResponse__LegacyAppPathString = Schema.String; - -export type V2ThreadForkResponse__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const V2ThreadForkResponse__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2ThreadForkResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadForkResponse__McpToolCallError = Schema.Struct({ message: Schema.String }); +]).annotate({ identifier: "V2ThreadForkResponse__ImageDetail" }); -export type V2ThreadForkResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; +export type V2ThreadForkResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; }; -export const V2ThreadForkResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); - -export type V2ThreadForkResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadForkResponse__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export const V2ThreadForkResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadForkResponse__HookPromptFragment" }); export type V2ThreadForkResponse__MemoryCitationEntry = { readonly lineEnd: number; @@ -6729,38 +7847,60 @@ export type V2ThreadForkResponse__MemoryCitationEntry = { }; export const V2ThreadForkResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), note: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadForkResponse__MemoryCitationEntry" }); export type V2ThreadForkResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadForkResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +export const V2ThreadForkResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadForkResponse__MessagePhase", }); -export type V2ThreadForkResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadForkResponse__NonSteerableTurnKind = Schema.Literals(["review", "compact"]); +export type V2ThreadForkResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadForkResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadForkResponse__CommandExecutionSource" }); -export type V2ThreadForkResponse__PatchApplyStatus = +export type V2ThreadForkResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadForkResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadForkResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ThreadForkResponse__CommandExecutionStatus" }); export type V2ThreadForkResponse__PatchChangeKind = | { readonly type: "add" } @@ -6780,73 +7920,156 @@ export const V2ThreadForkResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); - -export type V2ThreadForkResponse__ReasoningEffort = string; -export const V2ThreadForkResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +).annotate({ identifier: "V2ThreadForkResponse__PatchChangeKind" }); -export type V2ThreadForkResponse__SubAgentActivityKind = - | "started" - | "interacted" - | "interrupted" - | "completed"; -export const V2ThreadForkResponse__SubAgentActivityKind = Schema.Literals([ - "started", - "interacted", - "interrupted", +export type V2ThreadForkResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadForkResponse__PatchApplyStatus = Schema.Literals([ + "inProgress", "completed", -]); + "failed", + "declined", +]).annotate({ identifier: "V2ThreadForkResponse__PatchApplyStatus" }); -export type V2ThreadForkResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; +export type V2ThreadForkResponse__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; }; -export const V2ThreadForkResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); +export const V2ThreadForkResponse__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadForkResponse__McpToolCallAppContext" }); -export type V2ThreadForkResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; -export const V2ThreadForkResponse__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); +export type V2ThreadForkResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadForkResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadForkResponse__McpToolCallError" }); -export type V2ThreadForkResponse__ThreadId = string; -export const V2ThreadForkResponse__ThreadId = Schema.String; +export type V2ThreadForkResponse__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadForkResponse__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadForkResponse__McpToolCallResult" }); -export type V2ThreadForkResponse__ThreadSource = string; -export const V2ThreadForkResponse__ThreadSource = Schema.String; +export type V2ThreadForkResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadForkResponse__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadForkResponse__McpToolCallStatus" }); -export type V2ThreadForkResponse__TurnStatus = - | "completed" +export type V2ThreadForkResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadForkResponse__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadForkResponse__DynamicToolCallOutputContentItem" }); + +export type V2ThreadForkResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadForkResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadForkResponse__DynamicToolCallStatus" }); + +export type V2ThreadForkResponse__CollabAgentStatus = + | "pendingInit" + | "running" | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadForkResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadForkResponse__CollabAgentStatus" }); + +export type V2ThreadForkResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" | "failed" - | "inProgress"; -export const V2ThreadForkResponse__TurnStatus = Schema.Literals([ + | "interrupted"; +export const V2ThreadForkResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", "completed", - "interrupted", "failed", - "inProgress", -]); + "interrupted", +]).annotate({ identifier: "V2ThreadForkResponse__CollabAgentToolCallStatus" }); + +export type V2ThreadForkResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadForkResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadForkResponse__CollabAgentTool" }); + +export type V2ThreadForkResponse__SubAgentActivityKind = + | "started" + | "interacted" + | "interrupted" + | "completed"; +export const V2ThreadForkResponse__SubAgentActivityKind = Schema.Literals([ + "started", + "interacted", + "interrupted", + "completed", +]).annotate({ identifier: "V2ThreadForkResponse__SubAgentActivityKind" }); export type V2ThreadForkResponse__WebSearchAction = | { @@ -6878,7 +8101,36 @@ export const V2ThreadForkResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadForkResponse__WebSearchAction" }); + +export type V2ThreadForkResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadForkResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadForkResponse__TurnItemsView" }); + +export type V2ThreadForkResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadForkResponse__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2ThreadForkResponse__TurnStatus" }); export type V2ThreadGoalGetResponse__ThreadGoalStatus = | "active" @@ -6894,7 +8146,7 @@ export const V2ThreadGoalGetResponse__ThreadGoalStatus = Schema.Literals([ "usageLimited", "budgetLimited", "complete", -]); +]).annotate({ identifier: "V2ThreadGoalGetResponse__ThreadGoalStatus" }); export type V2ThreadGoalSetParams__ThreadGoalStatus = | "active" @@ -6910,7 +8162,7 @@ export const V2ThreadGoalSetParams__ThreadGoalStatus = Schema.Literals([ "usageLimited", "budgetLimited", "complete", -]); +]).annotate({ identifier: "V2ThreadGoalSetParams__ThreadGoalStatus" }); export type V2ThreadGoalSetResponse__ThreadGoalStatus = | "active" @@ -6926,7 +8178,7 @@ export const V2ThreadGoalSetResponse__ThreadGoalStatus = Schema.Literals([ "usageLimited", "budgetLimited", "complete", -]); +]).annotate({ identifier: "V2ThreadGoalSetResponse__ThreadGoalStatus" }); export type V2ThreadGoalUpdatedNotification__ThreadGoalStatus = | "active" @@ -6942,23 +8194,25 @@ export const V2ThreadGoalUpdatedNotification__ThreadGoalStatus = Schema.Literals "usageLimited", "budgetLimited", "complete", -]); - -export type V2ThreadListParams__SortDirection = "asc" | "desc"; -export const V2ThreadListParams__SortDirection = Schema.Literals(["asc", "desc"]); +]).annotate({ identifier: "V2ThreadGoalUpdatedNotification__ThreadGoalStatus" }); export type V2ThreadListParams__ThreadListCwdFilter = string | ReadonlyArray; export const V2ThreadListParams__ThreadListCwdFilter = Schema.Union([ Schema.String, Schema.Array(Schema.String), -]); +]).annotate({ identifier: "V2ThreadListParams__ThreadListCwdFilter" }); + +export type V2ThreadListParams__SortDirection = "asc" | "desc"; +export const V2ThreadListParams__SortDirection = Schema.Literals(["asc", "desc"]).annotate({ + identifier: "V2ThreadListParams__SortDirection", +}); export type V2ThreadListParams__ThreadSortKey = "created_at" | "updated_at" | "recency_at"; export const V2ThreadListParams__ThreadSortKey = Schema.Literals([ "created_at", "updated_at", "recency_at", -]); +]).annotate({ identifier: "V2ThreadListParams__ThreadSortKey" }); export type V2ThreadListParams__ThreadSourceKind = | "cli" @@ -6982,101 +8236,66 @@ export const V2ThreadListParams__ThreadSourceKind = Schema.Literals([ "subAgentThreadSpawn", "subAgentOther", "unknown", -]); +]).annotate({ identifier: "V2ThreadListParams__ThreadSourceKind" }); export type V2ThreadListResponse__AbsolutePathBuf = string; export const V2ThreadListResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadListResponse__AbsolutePathBuf", }); +export type V2ThreadListResponse__GitInfo = { + readonly branch?: string | null; + readonly originUrl?: string | null; + readonly sha?: string | null; +}; +export const V2ThreadListResponse__GitInfo = Schema.Struct({ + branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadListResponse__GitInfo" }); + export type V2ThreadListResponse__AgentPath = string; -export const V2ThreadListResponse__AgentPath = Schema.String; +export const V2ThreadListResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadListResponse__AgentPath", +}); -export type V2ThreadListResponse__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ThreadListResponse__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2ThreadListResponse__ThreadId = string; +export const V2ThreadListResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadListResponse__ThreadId", +}); -export type V2ThreadListResponse__CommandExecutionStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2ThreadListResponse__CommandExecutionStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); +export type V2ThreadListResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; +export const V2ThreadListResponse__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadListResponse__ThreadActiveFlag" }); -export type V2ThreadListResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadListResponse__DynamicToolCallOutputContentItem = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), - Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), - Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadListResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadListResponse__DynamicToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); - -export type V2ThreadListResponse__GitInfo = { - readonly branch?: string | null; - readonly originUrl?: string | null; - readonly sha?: string | null; -}; -export const V2ThreadListResponse__GitInfo = Schema.Struct({ - branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +export type V2ThreadListResponse__ThreadSource = string; +export const V2ThreadListResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadListResponse__ThreadSource", }); -export type V2ThreadListResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ThreadListResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, -}); +export type V2ThreadListResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadListResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ThreadListResponse__NonSteerableTurnKind" }); + +export type V2ThreadListResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadListResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadListResponse__ByteRange" }); export type V2ThreadListResponse__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadListResponse__ImageDetail = Schema.Literals([ @@ -7084,46 +8303,16 @@ export const V2ThreadListResponse__ImageDetail = Schema.Literals([ "low", "high", "original", -]); - -export type V2ThreadListResponse__LegacyAppPathString = string; -export const V2ThreadListResponse__LegacyAppPathString = Schema.String; - -export type V2ThreadListResponse__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const V2ThreadListResponse__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2ThreadListResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadListResponse__McpToolCallError = Schema.Struct({ message: Schema.String }); +]).annotate({ identifier: "V2ThreadListResponse__ImageDetail" }); -export type V2ThreadListResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; +export type V2ThreadListResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; }; -export const V2ThreadListResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); - -export type V2ThreadListResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadListResponse__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export const V2ThreadListResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadListResponse__HookPromptFragment" }); export type V2ThreadListResponse__MemoryCitationEntry = { readonly lineEnd: number; @@ -7133,38 +8322,65 @@ export type V2ThreadListResponse__MemoryCitationEntry = { }; export const V2ThreadListResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), note: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadListResponse__MemoryCitationEntry" }); export type V2ThreadListResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadListResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +export const V2ThreadListResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadListResponse__MessagePhase", }); -export type V2ThreadListResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadListResponse__NonSteerableTurnKind = Schema.Literals(["review", "compact"]); +export type V2ThreadListResponse__LegacyAppPathString = string; +export const V2ThreadListResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadListResponse__LegacyAppPathString", +}); -export type V2ThreadListResponse__PatchApplyStatus = +export type V2ThreadListResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadListResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadListResponse__CommandExecutionSource" }); + +export type V2ThreadListResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadListResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadListResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ThreadListResponse__CommandExecutionStatus" }); export type V2ThreadListResponse__PatchChangeKind = | { readonly type: "add" } @@ -7184,12 +8400,154 @@ export const V2ThreadListResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadListResponse__PatchChangeKind" }); + +export type V2ThreadListResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadListResponse__PatchApplyStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "declined", +]).annotate({ identifier: "V2ThreadListResponse__PatchApplyStatus" }); + +export type V2ThreadListResponse__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; +}; +export const V2ThreadListResponse__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadListResponse__McpToolCallAppContext" }); + +export type V2ThreadListResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadListResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadListResponse__McpToolCallError" }); + +export type V2ThreadListResponse__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadListResponse__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadListResponse__McpToolCallResult" }); + +export type V2ThreadListResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadListResponse__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadListResponse__McpToolCallStatus" }); + +export type V2ThreadListResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadListResponse__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadListResponse__DynamicToolCallOutputContentItem" }); + +export type V2ThreadListResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadListResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadListResponse__DynamicToolCallStatus" }); + +export type V2ThreadListResponse__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadListResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadListResponse__CollabAgentStatus" }); export type V2ThreadListResponse__ReasoningEffort = string; export const V2ThreadListResponse__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadListResponse__ReasoningEffort", + }), +); + +export type V2ThreadListResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2ThreadListResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2ThreadListResponse__CollabAgentToolCallStatus" }); + +export type V2ThreadListResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadListResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadListResponse__CollabAgentTool" }); export type V2ThreadListResponse__SubAgentActivityKind = | "started" @@ -7201,56 +8559,7 @@ export const V2ThreadListResponse__SubAgentActivityKind = Schema.Literals([ "interacted", "interrupted", "completed", -]); - -export type V2ThreadListResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2ThreadListResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type V2ThreadListResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; -export const V2ThreadListResponse__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); - -export type V2ThreadListResponse__ThreadId = string; -export const V2ThreadListResponse__ThreadId = Schema.String; - -export type V2ThreadListResponse__ThreadSource = string; -export const V2ThreadListResponse__ThreadSource = Schema.String; - -export type V2ThreadListResponse__TurnStatus = - | "completed" - | "interrupted" - | "failed" - | "inProgress"; -export const V2ThreadListResponse__TurnStatus = Schema.Literals([ - "completed", - "interrupted", - "failed", - "inProgress", -]); +]).annotate({ identifier: "V2ThreadListResponse__SubAgentActivityKind" }); export type V2ThreadListResponse__WebSearchAction = | { @@ -7282,7 +8591,36 @@ export const V2ThreadListResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadListResponse__WebSearchAction" }); + +export type V2ThreadListResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadListResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadListResponse__TurnItemsView" }); + +export type V2ThreadListResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadListResponse__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2ThreadListResponse__TurnStatus" }); export type V2ThreadMetadataUpdateParams__ThreadMetadataGitInfoUpdateParams = { readonly branch?: string | null; @@ -7317,85 +8655,15 @@ export const V2ThreadMetadataUpdateParams__ThreadMetadataGitInfoUpdateParams = S Schema.Null, ]), ), -}); +}).annotate({ identifier: "V2ThreadMetadataUpdateParams__ThreadMetadataGitInfoUpdateParams" }); export type V2ThreadMetadataUpdateResponse__AbsolutePathBuf = string; export const V2ThreadMetadataUpdateResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadMetadataUpdateResponse__AbsolutePathBuf", }); -export type V2ThreadMetadataUpdateResponse__AgentPath = string; -export const V2ThreadMetadataUpdateResponse__AgentPath = Schema.String; - -export type V2ThreadMetadataUpdateResponse__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ThreadMetadataUpdateResponse__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); - -export type V2ThreadMetadataUpdateResponse__CommandExecutionStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2ThreadMetadataUpdateResponse__CommandExecutionStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); - -export type V2ThreadMetadataUpdateResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadMetadataUpdateResponse__DynamicToolCallOutputContentItem = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), - Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), - Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadMetadataUpdateResponse__DynamicToolCallStatus = - | "inProgress" - | "completed" - | "failed"; -export const V2ThreadMetadataUpdateResponse__DynamicToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); - export type V2ThreadMetadataUpdateResponse__GitInfo = { readonly branch?: string | null; readonly originUrl?: string | null; @@ -7405,68 +8673,70 @@ export const V2ThreadMetadataUpdateResponse__GitInfo = Schema.Struct({ branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__GitInfo" }); + +export type V2ThreadMetadataUpdateResponse__AgentPath = string; +export const V2ThreadMetadataUpdateResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadMetadataUpdateResponse__AgentPath", }); -export type V2ThreadMetadataUpdateResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ThreadMetadataUpdateResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, +export type V2ThreadMetadataUpdateResponse__ThreadId = string; +export const V2ThreadMetadataUpdateResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadMetadataUpdateResponse__ThreadId", +}); + +export type V2ThreadMetadataUpdateResponse__ThreadActiveFlag = + | "waitingOnApproval" + | "waitingOnUserInput"; +export const V2ThreadMetadataUpdateResponse__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ThreadActiveFlag" }); + +export type V2ThreadMetadataUpdateResponse__ThreadSource = string; +export const V2ThreadMetadataUpdateResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadMetadataUpdateResponse__ThreadSource", }); +export type V2ThreadMetadataUpdateResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadMetadataUpdateResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__NonSteerableTurnKind" }); + +export type V2ThreadMetadataUpdateResponse__ByteRange = { + readonly end: number; + readonly start: number; +}; +export const V2ThreadMetadataUpdateResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ByteRange" }); + export type V2ThreadMetadataUpdateResponse__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadMetadataUpdateResponse__ImageDetail = Schema.Literals([ "auto", "low", "high", "original", -]); - -export type V2ThreadMetadataUpdateResponse__LegacyAppPathString = string; -export const V2ThreadMetadataUpdateResponse__LegacyAppPathString = Schema.String; - -export type V2ThreadMetadataUpdateResponse__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const V2ThreadMetadataUpdateResponse__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2ThreadMetadataUpdateResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadMetadataUpdateResponse__McpToolCallError = Schema.Struct({ - message: Schema.String, -}); +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ImageDetail" }); -export type V2ThreadMetadataUpdateResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; +export type V2ThreadMetadataUpdateResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; }; -export const V2ThreadMetadataUpdateResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); - -export type V2ThreadMetadataUpdateResponse__McpToolCallStatus = - | "inProgress" - | "completed" - | "failed"; -export const V2ThreadMetadataUpdateResponse__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export const V2ThreadMetadataUpdateResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__HookPromptFragment" }); export type V2ThreadMetadataUpdateResponse__MemoryCitationEntry = { readonly lineEnd: number; @@ -7476,41 +8746,65 @@ export type V2ThreadMetadataUpdateResponse__MemoryCitationEntry = { }; export const V2ThreadMetadataUpdateResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), note: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__MemoryCitationEntry" }); export type V2ThreadMetadataUpdateResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadMetadataUpdateResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +export const V2ThreadMetadataUpdateResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadMetadataUpdateResponse__MessagePhase", }); -export type V2ThreadMetadataUpdateResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadMetadataUpdateResponse__NonSteerableTurnKind = Schema.Literals([ - "review", - "compact", -]); +export type V2ThreadMetadataUpdateResponse__LegacyAppPathString = string; +export const V2ThreadMetadataUpdateResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadMetadataUpdateResponse__LegacyAppPathString", +}); -export type V2ThreadMetadataUpdateResponse__PatchApplyStatus = +export type V2ThreadMetadataUpdateResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadMetadataUpdateResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CommandExecutionSource" }); + +export type V2ThreadMetadataUpdateResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadMetadataUpdateResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadMetadataUpdateResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CommandExecutionStatus" }); export type V2ThreadMetadataUpdateResponse__PatchChangeKind = | { readonly type: "add" } @@ -7530,75 +8824,172 @@ export const V2ThreadMetadataUpdateResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); - -export type V2ThreadMetadataUpdateResponse__ReasoningEffort = string; -export const V2ThreadMetadataUpdateResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__PatchChangeKind" }); -export type V2ThreadMetadataUpdateResponse__SubAgentActivityKind = - | "started" - | "interacted" - | "interrupted" - | "completed"; -export const V2ThreadMetadataUpdateResponse__SubAgentActivityKind = Schema.Literals([ - "started", - "interacted", - "interrupted", +export type V2ThreadMetadataUpdateResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadMetadataUpdateResponse__PatchApplyStatus = Schema.Literals([ + "inProgress", "completed", -]); + "failed", + "declined", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__PatchApplyStatus" }); -export type V2ThreadMetadataUpdateResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; +export type V2ThreadMetadataUpdateResponse__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; }; -export const V2ThreadMetadataUpdateResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); +export const V2ThreadMetadataUpdateResponse__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__McpToolCallAppContext" }); -export type V2ThreadMetadataUpdateResponse__ThreadActiveFlag = - | "waitingOnApproval" - | "waitingOnUserInput"; -export const V2ThreadMetadataUpdateResponse__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); +export type V2ThreadMetadataUpdateResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadMetadataUpdateResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__McpToolCallError" }); -export type V2ThreadMetadataUpdateResponse__ThreadId = string; -export const V2ThreadMetadataUpdateResponse__ThreadId = Schema.String; +export type V2ThreadMetadataUpdateResponse__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadMetadataUpdateResponse__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__McpToolCallResult" }); -export type V2ThreadMetadataUpdateResponse__ThreadSource = string; -export const V2ThreadMetadataUpdateResponse__ThreadSource = Schema.String; +export type V2ThreadMetadataUpdateResponse__McpToolCallStatus = + | "inProgress" + | "completed" + | "failed"; +export const V2ThreadMetadataUpdateResponse__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__McpToolCallStatus" }); -export type V2ThreadMetadataUpdateResponse__TurnStatus = +export type V2ThreadMetadataUpdateResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadMetadataUpdateResponse__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__DynamicToolCallOutputContentItem" }); + +export type V2ThreadMetadataUpdateResponse__DynamicToolCallStatus = + | "inProgress" | "completed" + | "failed"; +export const V2ThreadMetadataUpdateResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__DynamicToolCallStatus" }); + +export type V2ThreadMetadataUpdateResponse__CollabAgentStatus = + | "pendingInit" + | "running" | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadMetadataUpdateResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CollabAgentStatus" }); + +export type V2ThreadMetadataUpdateResponse__ReasoningEffort = string; +export const V2ThreadMetadataUpdateResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadMetadataUpdateResponse__ReasoningEffort", + }), +); + +export type V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" | "failed" - | "inProgress"; -export const V2ThreadMetadataUpdateResponse__TurnStatus = Schema.Literals([ + | "interrupted"; +export const V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", "completed", - "interrupted", "failed", - "inProgress", -]); + "interrupted", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus" }); + +export type V2ThreadMetadataUpdateResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadMetadataUpdateResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CollabAgentTool" }); + +export type V2ThreadMetadataUpdateResponse__SubAgentActivityKind = + | "started" + | "interacted" + | "interrupted" + | "completed"; +export const V2ThreadMetadataUpdateResponse__SubAgentActivityKind = Schema.Literals([ + "started", + "interacted", + "interrupted", + "completed", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__SubAgentActivityKind" }); export type V2ThreadMetadataUpdateResponse__WebSearchAction = | { @@ -7630,81 +9021,43 @@ export const V2ThreadMetadataUpdateResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); - -export type V2ThreadReadResponse__AbsolutePathBuf = string; -export const V2ThreadReadResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type V2ThreadReadResponse__AgentPath = string; -export const V2ThreadReadResponse__AgentPath = Schema.String; - -export type V2ThreadReadResponse__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ThreadReadResponse__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); - -export type V2ThreadReadResponse__CommandExecutionStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2ThreadReadResponse__CommandExecutionStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__WebSearchAction" }); -export type V2ThreadReadResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadReadResponse__DynamicToolCallOutputContentItem = Schema.Union( +export type V2ThreadMetadataUpdateResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadMetadataUpdateResponse__TurnItemsView = Schema.Union( [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), - Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), - Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__TurnItemsView" }); -export type V2ThreadReadResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadReadResponse__DynamicToolCallStatus = Schema.Literals([ - "inProgress", +export type V2ThreadMetadataUpdateResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadMetadataUpdateResponse__TurnStatus = Schema.Literals([ "completed", + "interrupted", "failed", -]); + "inProgress", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__TurnStatus" }); + +export type V2ThreadReadResponse__AbsolutePathBuf = string; +export const V2ThreadReadResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadReadResponse__AbsolutePathBuf", +}); export type V2ThreadReadResponse__GitInfo = { readonly branch?: string | null; @@ -7715,63 +9068,65 @@ export const V2ThreadReadResponse__GitInfo = Schema.Struct({ branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadReadResponse__GitInfo" }); + +export type V2ThreadReadResponse__AgentPath = string; +export const V2ThreadReadResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadReadResponse__AgentPath", }); -export type V2ThreadReadResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ThreadReadResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, +export type V2ThreadReadResponse__ThreadId = string; +export const V2ThreadReadResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadReadResponse__ThreadId", +}); + +export type V2ThreadReadResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; +export const V2ThreadReadResponse__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadReadResponse__ThreadActiveFlag" }); + +export type V2ThreadReadResponse__ThreadSource = string; +export const V2ThreadReadResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadReadResponse__ThreadSource", }); +export type V2ThreadReadResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadReadResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ThreadReadResponse__NonSteerableTurnKind" }); + +export type V2ThreadReadResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadReadResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadReadResponse__ByteRange" }); + export type V2ThreadReadResponse__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadReadResponse__ImageDetail = Schema.Literals([ "auto", "low", "high", "original", -]); - -export type V2ThreadReadResponse__LegacyAppPathString = string; -export const V2ThreadReadResponse__LegacyAppPathString = Schema.String; - -export type V2ThreadReadResponse__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const V2ThreadReadResponse__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +]).annotate({ identifier: "V2ThreadReadResponse__ImageDetail" }); -export type V2ThreadReadResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadReadResponse__McpToolCallError = Schema.Struct({ message: Schema.String }); - -export type V2ThreadReadResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; +export type V2ThreadReadResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; }; -export const V2ThreadReadResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); - -export type V2ThreadReadResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadReadResponse__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export const V2ThreadReadResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadReadResponse__HookPromptFragment" }); export type V2ThreadReadResponse__MemoryCitationEntry = { readonly lineEnd: number; @@ -7781,38 +9136,65 @@ export type V2ThreadReadResponse__MemoryCitationEntry = { }; export const V2ThreadReadResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), note: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadReadResponse__MemoryCitationEntry" }); export type V2ThreadReadResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadReadResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +export const V2ThreadReadResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadReadResponse__MessagePhase", }); -export type V2ThreadReadResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadReadResponse__NonSteerableTurnKind = Schema.Literals(["review", "compact"]); +export type V2ThreadReadResponse__LegacyAppPathString = string; +export const V2ThreadReadResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadReadResponse__LegacyAppPathString", +}); -export type V2ThreadReadResponse__PatchApplyStatus = +export type V2ThreadReadResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadReadResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadReadResponse__CommandExecutionSource" }); + +export type V2ThreadReadResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadReadResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadReadResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ThreadReadResponse__CommandExecutionStatus" }); export type V2ThreadReadResponse__PatchChangeKind = | { readonly type: "add" } @@ -7832,12 +9214,154 @@ export const V2ThreadReadResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadReadResponse__PatchChangeKind" }); + +export type V2ThreadReadResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadReadResponse__PatchApplyStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "declined", +]).annotate({ identifier: "V2ThreadReadResponse__PatchApplyStatus" }); + +export type V2ThreadReadResponse__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; +}; +export const V2ThreadReadResponse__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadReadResponse__McpToolCallAppContext" }); + +export type V2ThreadReadResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadReadResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadReadResponse__McpToolCallError" }); + +export type V2ThreadReadResponse__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadReadResponse__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadReadResponse__McpToolCallResult" }); + +export type V2ThreadReadResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadReadResponse__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadReadResponse__McpToolCallStatus" }); + +export type V2ThreadReadResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadReadResponse__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadReadResponse__DynamicToolCallOutputContentItem" }); + +export type V2ThreadReadResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadReadResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadReadResponse__DynamicToolCallStatus" }); + +export type V2ThreadReadResponse__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadReadResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadReadResponse__CollabAgentStatus" }); export type V2ThreadReadResponse__ReasoningEffort = string; export const V2ThreadReadResponse__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadReadResponse__ReasoningEffort", + }), +); + +export type V2ThreadReadResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2ThreadReadResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2ThreadReadResponse__CollabAgentToolCallStatus" }); + +export type V2ThreadReadResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadReadResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadReadResponse__CollabAgentTool" }); export type V2ThreadReadResponse__SubAgentActivityKind = | "started" @@ -7849,56 +9373,7 @@ export const V2ThreadReadResponse__SubAgentActivityKind = Schema.Literals([ "interacted", "interrupted", "completed", -]); - -export type V2ThreadReadResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2ThreadReadResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type V2ThreadReadResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; -export const V2ThreadReadResponse__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); - -export type V2ThreadReadResponse__ThreadId = string; -export const V2ThreadReadResponse__ThreadId = Schema.String; - -export type V2ThreadReadResponse__ThreadSource = string; -export const V2ThreadReadResponse__ThreadSource = Schema.String; - -export type V2ThreadReadResponse__TurnStatus = - | "completed" - | "interrupted" - | "failed" - | "inProgress"; -export const V2ThreadReadResponse__TurnStatus = Schema.Literals([ - "completed", - "interrupted", - "failed", - "inProgress", -]); +]).annotate({ identifier: "V2ThreadReadResponse__SubAgentActivityKind" }); export type V2ThreadReadResponse__WebSearchAction = | { @@ -7930,7 +9405,36 @@ export const V2ThreadReadResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadReadResponse__WebSearchAction" }); + +export type V2ThreadReadResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadReadResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadReadResponse__TurnItemsView" }); + +export type V2ThreadReadResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadReadResponse__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2ThreadReadResponse__TurnStatus" }); export type V2ThreadRealtimeOutputAudioDeltaNotification__ThreadRealtimeAudioChunk = { readonly data: string; @@ -7944,59 +9448,43 @@ export const V2ThreadRealtimeOutputAudioDeltaNotification__ThreadRealtimeAudioCh data: Schema.String, itemId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), numChannels: Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), sampleRate: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), samplesPerChannel: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), }, -).annotate({ description: "EXPERIMENTAL - thread realtime audio chunk." }); +).annotate({ + description: "EXPERIMENTAL - thread realtime audio chunk.", + identifier: "V2ThreadRealtimeOutputAudioDeltaNotification__ThreadRealtimeAudioChunk", +}); export type V2ThreadRealtimeStartedNotification__RealtimeConversationVersion = "v1" | "v2" | "v3"; export const V2ThreadRealtimeStartedNotification__RealtimeConversationVersion = Schema.Literals([ "v1", "v2", "v3", -]); - -export type V2ThreadResumeParams__AgentMessageInputContent = - | { readonly text: string; readonly type: "input_text" } - | { readonly encrypted_content: string; readonly type: "encrypted_content" }; -export const V2ThreadResumeParams__AgentMessageInputContent = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("input_text").annotate({ - title: "InputTextAgentMessageInputContentType", - }), - }).annotate({ title: "InputTextAgentMessageInputContent" }), - Schema.Struct({ - encrypted_content: Schema.String, - type: Schema.Literal("encrypted_content").annotate({ - title: "EncryptedContentAgentMessageInputContentType", - }), - }).annotate({ title: "EncryptedContentAgentMessageInputContent" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadResumeParams__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; -export const V2ThreadResumeParams__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", -}); +]).annotate({ identifier: "V2ThreadRealtimeStartedNotification__RealtimeConversationVersion" }); export type V2ThreadResumeParams__AskForApproval = | "untrusted" @@ -8025,7 +9513,35 @@ export const V2ThreadResumeParams__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadResumeParams__AskForApproval" }); + +export type V2ThreadResumeParams__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; +export const V2ThreadResumeParams__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "V2ThreadResumeParams__ApprovalsReviewer", +}); + +export type V2ThreadResumeParams__Personality = "none" | "friendly" | "pragmatic"; +export const V2ThreadResumeParams__Personality = Schema.Literals([ + "none", + "friendly", + "pragmatic", +]).annotate({ identifier: "V2ThreadResumeParams__Personality" }); + +export type V2ThreadResumeParams__SandboxMode = + | "read-only" + | "workspace-write" + | "danger-full-access"; +export const V2ThreadResumeParams__SandboxMode = Schema.Literals([ + "read-only", + "workspace-write", + "danger-full-access", +]).annotate({ identifier: "V2ThreadResumeParams__SandboxMode" }); export type V2ThreadResumeParams__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadResumeParams__ImageDetail = Schema.Literals([ @@ -8033,7 +9549,7 @@ export const V2ThreadResumeParams__ImageDetail = Schema.Literals([ "low", "high", "original", -]); +]).annotate({ identifier: "V2ThreadResumeParams__ImageDetail" }); export type V2ThreadResumeParams__InternalChatMessageMetadataPassthrough = { readonly turn_id?: string | null; @@ -8043,57 +9559,47 @@ export const V2ThreadResumeParams__InternalChatMessageMetadataPassthrough = Sche }).annotate({ description: "Internal Responses API passthrough metadata copied into underlying chat messages.\n\nResponses API strongly types this payload. Do not modify it without first getting API approval and making the corresponding Responses API change.", + identifier: "V2ThreadResumeParams__InternalChatMessageMetadataPassthrough", }); -export type V2ThreadResumeParams__LocalShellAction = { - readonly command: ReadonlyArray; - readonly env?: { readonly [x: string]: string } | null; - readonly timeout_ms?: number | null; - readonly type: "exec"; - readonly user?: string | null; - readonly working_directory?: string | null; -}; -export const V2ThreadResumeParams__LocalShellAction = Schema.Union( +export type V2ThreadResumeParams__MessagePhase = "commentary" | "final_answer"; +export const V2ThreadResumeParams__MessagePhase = Schema.Union( [ - Schema.Struct({ - command: Schema.Array(Schema.String), - env: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.String), Schema.Null]), - ), - timeout_ms: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - type: Schema.Literal("exec").annotate({ title: "ExecLocalShellActionType" }), - user: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - working_directory: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - }).annotate({ title: "ExecLocalShellAction" }), + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), ], { mode: "oneOf" }, -); - -export type V2ThreadResumeParams__LocalShellStatus = "completed" | "in_progress" | "incomplete"; -export const V2ThreadResumeParams__LocalShellStatus = Schema.Literals([ - "completed", - "in_progress", - "incomplete", -]); - -export type V2ThreadResumeParams__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadResumeParams__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadResumeParams__MessagePhase", }); -export type V2ThreadResumeParams__Personality = "none" | "friendly" | "pragmatic"; -export const V2ThreadResumeParams__Personality = Schema.Literals(["none", "friendly", "pragmatic"]); +export type V2ThreadResumeParams__AgentMessageInputContent = + | { readonly text: string; readonly type: "input_text" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadResumeParams__AgentMessageInputContent = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextAgentMessageInputContentType", + }), + }).annotate({ title: "InputTextAgentMessageInputContent" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentAgentMessageInputContentType", + }), + }).annotate({ title: "EncryptedContentAgentMessageInputContent" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeParams__AgentMessageInputContent" }); export type V2ThreadResumeParams__ReasoningItemContent = | { readonly text: string; readonly type: "reasoning_text" } @@ -8112,7 +9618,7 @@ export const V2ThreadResumeParams__ReasoningItemContent = Schema.Union( }).annotate({ title: "TextReasoningItemContent" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadResumeParams__ReasoningItemContent" }); export type V2ThreadResumeParams__ReasoningItemReasoningSummary = { readonly text: string; @@ -8128,7 +9634,49 @@ export const V2ThreadResumeParams__ReasoningItemReasoningSummary = Schema.Union( }).annotate({ title: "SummaryTextReasoningItemReasoningSummary" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadResumeParams__ReasoningItemReasoningSummary" }); + +export type V2ThreadResumeParams__LocalShellAction = { + readonly command: ReadonlyArray; + readonly env?: { readonly [x: string]: string } | null; + readonly timeout_ms?: number | null; + readonly type: "exec"; + readonly user?: string | null; + readonly working_directory?: string | null; +}; +export const V2ThreadResumeParams__LocalShellAction = Schema.Union( + [ + Schema.Struct({ + command: Schema.Array(Schema.String), + env: Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.String), Schema.Null]), + ), + timeout_ms: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("exec").annotate({ title: "ExecLocalShellActionType" }), + user: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + working_directory: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "ExecLocalShellAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeParams__LocalShellAction" }); + +export type V2ThreadResumeParams__LocalShellStatus = "completed" | "in_progress" | "incomplete"; +export const V2ThreadResumeParams__LocalShellStatus = Schema.Literals([ + "completed", + "in_progress", + "incomplete", +]).annotate({ identifier: "V2ThreadResumeParams__LocalShellStatus" }); export type V2ThreadResumeParams__ResponsesApiWebSearchAction = | { @@ -8168,37 +9716,30 @@ export const V2ThreadResumeParams__ResponsesApiWebSearchAction = Schema.Union( }).annotate({ title: "OtherResponsesApiWebSearchAction" }), ], { mode: "oneOf" }, -); - -export type V2ThreadResumeParams__SandboxMode = - | "read-only" - | "workspace-write" - | "danger-full-access"; -export const V2ThreadResumeParams__SandboxMode = Schema.Literals([ - "read-only", - "workspace-write", - "danger-full-access", -]); - -export type V2ThreadResumeParams__SortDirection = "asc" | "desc"; -export const V2ThreadResumeParams__SortDirection = Schema.Literals(["asc", "desc"]); +).annotate({ identifier: "V2ThreadResumeParams__ResponsesApiWebSearchAction" }); export type V2ThreadResumeParams__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadResumeParams__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); +export const V2ThreadResumeParams__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeParams__TurnItemsView" }); -export type V2ThreadResumeResponse__AbsolutePathBuf = string; -export const V2ThreadResumeResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", +export type V2ThreadResumeParams__SortDirection = "asc" | "desc"; +export const V2ThreadResumeParams__SortDirection = Schema.Literals(["asc", "desc"]).annotate({ + identifier: "V2ThreadResumeParams__SortDirection", }); -export type V2ThreadResumeResponse__AgentPath = string; -export const V2ThreadResumeResponse__AgentPath = Schema.String; - export type V2ThreadResumeResponse__AskForApproval = | "untrusted" | "on-request" @@ -8226,72 +9767,49 @@ export const V2ThreadResumeResponse__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadResumeResponse__AskForApproval" }); -export type V2ThreadResumeResponse__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ThreadResumeResponse__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2ThreadResumeResponse__ApprovalsReviewer = + | "user" + | "auto_review" + | "guardian_subagent"; +export const V2ThreadResumeResponse__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "V2ThreadResumeResponse__ApprovalsReviewer", +}); -export type V2ThreadResumeResponse__CommandExecutionStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2ThreadResumeResponse__CommandExecutionStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); +export type V2ThreadResumeResponse__AbsolutePathBuf = string; +export const V2ThreadResumeResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadResumeResponse__AbsolutePathBuf", +}); -export type V2ThreadResumeResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadResumeResponse__DynamicToolCallOutputContentItem = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), - Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), - Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), - ], - { mode: "oneOf" }, +export type V2ThreadResumeResponse__LegacyAppPathString = string; +export const V2ThreadResumeResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadResumeResponse__LegacyAppPathString", +}); + +export type V2ThreadResumeResponse__ReasoningEffort = string; +export const V2ThreadResumeResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadResumeResponse__ReasoningEffort", + }), ); -export type V2ThreadResumeResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadResumeResponse__DynamicToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export type V2ThreadResumeResponse__NetworkAccess = "restricted" | "enabled"; +export const V2ThreadResumeResponse__NetworkAccess = Schema.Literals([ + "restricted", + "enabled", +]).annotate({ identifier: "V2ThreadResumeResponse__NetworkAccess" }); export type V2ThreadResumeResponse__GitInfo = { readonly branch?: string | null; @@ -8302,63 +9820,65 @@ export const V2ThreadResumeResponse__GitInfo = Schema.Struct({ branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadResumeResponse__GitInfo" }); + +export type V2ThreadResumeResponse__AgentPath = string; +export const V2ThreadResumeResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadResumeResponse__AgentPath", }); -export type V2ThreadResumeResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ThreadResumeResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, +export type V2ThreadResumeResponse__ThreadId = string; +export const V2ThreadResumeResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadResumeResponse__ThreadId", +}); + +export type V2ThreadResumeResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; +export const V2ThreadResumeResponse__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadResumeResponse__ThreadActiveFlag" }); + +export type V2ThreadResumeResponse__ThreadSource = string; +export const V2ThreadResumeResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadResumeResponse__ThreadSource", }); +export type V2ThreadResumeResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadResumeResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ThreadResumeResponse__NonSteerableTurnKind" }); + +export type V2ThreadResumeResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadResumeResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadResumeResponse__ByteRange" }); + export type V2ThreadResumeResponse__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadResumeResponse__ImageDetail = Schema.Literals([ "auto", "low", "high", "original", -]); - -export type V2ThreadResumeResponse__LegacyAppPathString = string; -export const V2ThreadResumeResponse__LegacyAppPathString = Schema.String; - -export type V2ThreadResumeResponse__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const V2ThreadResumeResponse__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +]).annotate({ identifier: "V2ThreadResumeResponse__ImageDetail" }); -export type V2ThreadResumeResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadResumeResponse__McpToolCallError = Schema.Struct({ message: Schema.String }); - -export type V2ThreadResumeResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; +export type V2ThreadResumeResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; }; -export const V2ThreadResumeResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); - -export type V2ThreadResumeResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadResumeResponse__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export const V2ThreadResumeResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadResumeResponse__HookPromptFragment" }); export type V2ThreadResumeResponse__MemoryCitationEntry = { readonly lineEnd: number; @@ -8368,38 +9888,60 @@ export type V2ThreadResumeResponse__MemoryCitationEntry = { }; export const V2ThreadResumeResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), note: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadResumeResponse__MemoryCitationEntry" }); export type V2ThreadResumeResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadResumeResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +export const V2ThreadResumeResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadResumeResponse__MessagePhase", }); -export type V2ThreadResumeResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadResumeResponse__NonSteerableTurnKind = Schema.Literals(["review", "compact"]); +export type V2ThreadResumeResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadResumeResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadResumeResponse__CommandExecutionSource" }); -export type V2ThreadResumeResponse__PatchApplyStatus = +export type V2ThreadResumeResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadResumeResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadResumeResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ThreadResumeResponse__CommandExecutionStatus" }); export type V2ThreadResumeResponse__PatchChangeKind = | { readonly type: "add" } @@ -8419,116 +9961,94 @@ export const V2ThreadResumeResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); - -export type V2ThreadResumeResponse__ReasoningEffort = string; -export const V2ThreadResumeResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +).annotate({ identifier: "V2ThreadResumeResponse__PatchChangeKind" }); -export type V2ThreadResumeResponse__SubAgentActivityKind = - | "started" - | "interacted" - | "interrupted" - | "completed"; -export const V2ThreadResumeResponse__SubAgentActivityKind = Schema.Literals([ - "started", - "interacted", - "interrupted", +export type V2ThreadResumeResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadResumeResponse__PatchApplyStatus = Schema.Literals([ + "inProgress", "completed", -]); + "failed", + "declined", +]).annotate({ identifier: "V2ThreadResumeResponse__PatchApplyStatus" }); -export type V2ThreadResumeResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; +export type V2ThreadResumeResponse__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; }; -export const V2ThreadResumeResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type V2ThreadResumeResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; -export const V2ThreadResumeResponse__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); +export const V2ThreadResumeResponse__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadResumeResponse__McpToolCallAppContext" }); -export type V2ThreadResumeResponse__ThreadId = string; -export const V2ThreadResumeResponse__ThreadId = Schema.String; +export type V2ThreadResumeResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadResumeResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadResumeResponse__McpToolCallError" }); -export type V2ThreadResumeResponse__ThreadSource = string; -export const V2ThreadResumeResponse__ThreadSource = Schema.String; +export type V2ThreadResumeResponse__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadResumeResponse__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadResumeResponse__McpToolCallResult" }); -export type V2ThreadResumeResponse__TurnStatus = - | "completed" - | "interrupted" - | "failed" - | "inProgress"; -export const V2ThreadResumeResponse__TurnStatus = Schema.Literals([ +export type V2ThreadResumeResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadResumeResponse__McpToolCallStatus = Schema.Literals([ + "inProgress", "completed", - "interrupted", "failed", - "inProgress", -]); +]).annotate({ identifier: "V2ThreadResumeResponse__McpToolCallStatus" }); -export type V2ThreadResumeResponse__WebSearchAction = - | { - readonly queries?: ReadonlyArray | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly type: "openPage"; readonly url?: string | null } - | { readonly pattern?: string | null; readonly type: "findInPage"; readonly url?: string | null } - | { readonly type: "other" }; -export const V2ThreadResumeResponse__WebSearchAction = Schema.Union( +export type V2ThreadResumeResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadResumeResponse__DynamicToolCallOutputContentItem = Schema.Union( [ Schema.Struct({ - queries: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchWebSearchActionType" }), - }).annotate({ title: "SearchWebSearchAction" }), - Schema.Struct({ - type: Schema.Literal("openPage").annotate({ title: "OpenPageWebSearchActionType" }), - url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - }).annotate({ title: "OpenPageWebSearchAction" }), + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), Schema.Struct({ - pattern: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("findInPage").annotate({ title: "FindInPageWebSearchActionType" }), - url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - }).annotate({ title: "FindInPageWebSearchAction" }), + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), Schema.Struct({ - type: Schema.Literal("other").annotate({ title: "OtherWebSearchActionType" }), - }).annotate({ title: "OtherWebSearchAction" }), + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), ], { mode: "oneOf" }, -); - -export type V2ThreadRollbackResponse__AbsolutePathBuf = string; -export const V2ThreadRollbackResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); +).annotate({ identifier: "V2ThreadResumeResponse__DynamicToolCallOutputContentItem" }); -export type V2ThreadRollbackResponse__AgentPath = string; -export const V2ThreadRollbackResponse__AgentPath = Schema.String; +export type V2ThreadResumeResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadResumeResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadResumeResponse__DynamicToolCallStatus" }); -export type V2ThreadRollbackResponse__CollabAgentStatus = +export type V2ThreadResumeResponse__CollabAgentStatus = | "pendingInit" | "running" | "interrupted" @@ -8536,7 +10056,7 @@ export type V2ThreadRollbackResponse__CollabAgentStatus = | "errored" | "shutdown" | "notFound"; -export const V2ThreadRollbackResponse__CollabAgentStatus = Schema.Literals([ +export const V2ThreadResumeResponse__CollabAgentStatus = Schema.Literals([ "pendingInit", "running", "interrupted", @@ -8544,54 +10064,121 @@ export const V2ThreadRollbackResponse__CollabAgentStatus = Schema.Literals([ "errored", "shutdown", "notFound", -]); +]).annotate({ identifier: "V2ThreadResumeResponse__CollabAgentStatus" }); -export type V2ThreadRollbackResponse__CommandExecutionStatus = +export type V2ThreadResumeResponse__CollabAgentToolCallStatus = | "inProgress" | "completed" | "failed" - | "declined"; -export const V2ThreadRollbackResponse__CommandExecutionStatus = Schema.Literals([ - "inProgress", + | "interrupted"; +export const V2ThreadResumeResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", "completed", "failed", - "declined", -]); + "interrupted", +]).annotate({ identifier: "V2ThreadResumeResponse__CollabAgentToolCallStatus" }); -export type V2ThreadRollbackResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadRollbackResponse__DynamicToolCallOutputContentItem = Schema.Union( +export type V2ThreadResumeResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadResumeResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadResumeResponse__CollabAgentTool" }); + +export type V2ThreadResumeResponse__SubAgentActivityKind = + | "started" + | "interacted" + | "interrupted" + | "completed"; +export const V2ThreadResumeResponse__SubAgentActivityKind = Schema.Literals([ + "started", + "interacted", + "interrupted", + "completed", +]).annotate({ identifier: "V2ThreadResumeResponse__SubAgentActivityKind" }); + +export type V2ThreadResumeResponse__WebSearchAction = + | { + readonly queries?: ReadonlyArray | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly type: "openPage"; readonly url?: string | null } + | { readonly pattern?: string | null; readonly type: "findInPage"; readonly url?: string | null } + | { readonly type: "other" }; +export const V2ThreadResumeResponse__WebSearchAction = Schema.Union( [ Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + queries: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchWebSearchActionType" }), + }).annotate({ title: "SearchWebSearchAction" }), Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + type: Schema.Literal("openPage").annotate({ title: "OpenPageWebSearchActionType" }), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "OpenPageWebSearchAction" }), Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + pattern: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("findInPage").annotate({ title: "FindInPageWebSearchActionType" }), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "FindInPageWebSearchAction" }), + Schema.Struct({ + type: Schema.Literal("other").annotate({ title: "OtherWebSearchActionType" }), + }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadResumeResponse__WebSearchAction" }); -export type V2ThreadRollbackResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadRollbackResponse__DynamicToolCallStatus = Schema.Literals([ - "inProgress", +export type V2ThreadResumeResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadResumeResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeResponse__TurnItemsView" }); + +export type V2ThreadResumeResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadResumeResponse__TurnStatus = Schema.Literals([ "completed", + "interrupted", "failed", -]); + "inProgress", +]).annotate({ identifier: "V2ThreadResumeResponse__TurnStatus" }); + +export type V2ThreadRollbackResponse__AbsolutePathBuf = string; +export const V2ThreadRollbackResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadRollbackResponse__AbsolutePathBuf", +}); export type V2ThreadRollbackResponse__GitInfo = { readonly branch?: string | null; @@ -8602,63 +10189,65 @@ export const V2ThreadRollbackResponse__GitInfo = Schema.Struct({ branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadRollbackResponse__GitInfo" }); + +export type V2ThreadRollbackResponse__AgentPath = string; +export const V2ThreadRollbackResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadRollbackResponse__AgentPath", }); -export type V2ThreadRollbackResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ThreadRollbackResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, +export type V2ThreadRollbackResponse__ThreadId = string; +export const V2ThreadRollbackResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadRollbackResponse__ThreadId", +}); + +export type V2ThreadRollbackResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; +export const V2ThreadRollbackResponse__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadRollbackResponse__ThreadActiveFlag" }); + +export type V2ThreadRollbackResponse__ThreadSource = string; +export const V2ThreadRollbackResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadRollbackResponse__ThreadSource", }); +export type V2ThreadRollbackResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadRollbackResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ThreadRollbackResponse__NonSteerableTurnKind" }); + +export type V2ThreadRollbackResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadRollbackResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadRollbackResponse__ByteRange" }); + export type V2ThreadRollbackResponse__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadRollbackResponse__ImageDetail = Schema.Literals([ "auto", "low", "high", "original", -]); - -export type V2ThreadRollbackResponse__LegacyAppPathString = string; -export const V2ThreadRollbackResponse__LegacyAppPathString = Schema.String; - -export type V2ThreadRollbackResponse__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const V2ThreadRollbackResponse__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2ThreadRollbackResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadRollbackResponse__McpToolCallError = Schema.Struct({ message: Schema.String }); +]).annotate({ identifier: "V2ThreadRollbackResponse__ImageDetail" }); -export type V2ThreadRollbackResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; +export type V2ThreadRollbackResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; }; -export const V2ThreadRollbackResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); - -export type V2ThreadRollbackResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadRollbackResponse__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export const V2ThreadRollbackResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadRollbackResponse__HookPromptFragment" }); export type V2ThreadRollbackResponse__MemoryCitationEntry = { readonly lineEnd: number; @@ -8668,41 +10257,65 @@ export type V2ThreadRollbackResponse__MemoryCitationEntry = { }; export const V2ThreadRollbackResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), note: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadRollbackResponse__MemoryCitationEntry" }); export type V2ThreadRollbackResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadRollbackResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +export const V2ThreadRollbackResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadRollbackResponse__MessagePhase", }); -export type V2ThreadRollbackResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadRollbackResponse__NonSteerableTurnKind = Schema.Literals([ - "review", - "compact", -]); +export type V2ThreadRollbackResponse__LegacyAppPathString = string; +export const V2ThreadRollbackResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadRollbackResponse__LegacyAppPathString", +}); -export type V2ThreadRollbackResponse__PatchApplyStatus = +export type V2ThreadRollbackResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadRollbackResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadRollbackResponse__CommandExecutionSource" }); + +export type V2ThreadRollbackResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadRollbackResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadRollbackResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ThreadRollbackResponse__CommandExecutionStatus" }); export type V2ThreadRollbackResponse__PatchChangeKind = | { readonly type: "add" } @@ -8722,12 +10335,154 @@ export const V2ThreadRollbackResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadRollbackResponse__PatchChangeKind" }); + +export type V2ThreadRollbackResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadRollbackResponse__PatchApplyStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "declined", +]).annotate({ identifier: "V2ThreadRollbackResponse__PatchApplyStatus" }); + +export type V2ThreadRollbackResponse__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; +}; +export const V2ThreadRollbackResponse__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadRollbackResponse__McpToolCallAppContext" }); + +export type V2ThreadRollbackResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadRollbackResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadRollbackResponse__McpToolCallError" }); + +export type V2ThreadRollbackResponse__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadRollbackResponse__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadRollbackResponse__McpToolCallResult" }); + +export type V2ThreadRollbackResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadRollbackResponse__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadRollbackResponse__McpToolCallStatus" }); + +export type V2ThreadRollbackResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadRollbackResponse__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadRollbackResponse__DynamicToolCallOutputContentItem" }); + +export type V2ThreadRollbackResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadRollbackResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadRollbackResponse__DynamicToolCallStatus" }); + +export type V2ThreadRollbackResponse__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadRollbackResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadRollbackResponse__CollabAgentStatus" }); export type V2ThreadRollbackResponse__ReasoningEffort = string; export const V2ThreadRollbackResponse__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadRollbackResponse__ReasoningEffort", + }), +); + +export type V2ThreadRollbackResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2ThreadRollbackResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2ThreadRollbackResponse__CollabAgentToolCallStatus" }); + +export type V2ThreadRollbackResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadRollbackResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadRollbackResponse__CollabAgentTool" }); export type V2ThreadRollbackResponse__SubAgentActivityKind = | "started" @@ -8739,56 +10494,7 @@ export const V2ThreadRollbackResponse__SubAgentActivityKind = Schema.Literals([ "interacted", "interrupted", "completed", -]); - -export type V2ThreadRollbackResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2ThreadRollbackResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type V2ThreadRollbackResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; -export const V2ThreadRollbackResponse__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); - -export type V2ThreadRollbackResponse__ThreadId = string; -export const V2ThreadRollbackResponse__ThreadId = Schema.String; - -export type V2ThreadRollbackResponse__ThreadSource = string; -export const V2ThreadRollbackResponse__ThreadSource = Schema.String; - -export type V2ThreadRollbackResponse__TurnStatus = - | "completed" - | "interrupted" - | "failed" - | "inProgress"; -export const V2ThreadRollbackResponse__TurnStatus = Schema.Literals([ - "completed", - "interrupted", - "failed", - "inProgress", -]); +]).annotate({ identifier: "V2ThreadRollbackResponse__SubAgentActivityKind" }); export type V2ThreadRollbackResponse__WebSearchAction = | { @@ -8820,13 +10526,36 @@ export const V2ThreadRollbackResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadRollbackResponse__WebSearchAction" }); -export type V2ThreadSettingsUpdatedNotification__AbsolutePathBuf = string; -export const V2ThreadSettingsUpdatedNotification__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); +export type V2ThreadRollbackResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadRollbackResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadRollbackResponse__TurnItemsView" }); + +export type V2ThreadRollbackResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadRollbackResponse__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2ThreadRollbackResponse__TurnStatus" }); export type V2ThreadSettingsUpdatedNotification__ActivePermissionProfile = { readonly extends?: string | null; @@ -8846,20 +10575,7 @@ export const V2ThreadSettingsUpdatedNotification__ActivePermissionProfile = Sche description: "Identifier from `default_permissions` or the implicit built-in default, such as `:workspace` or a user-defined `[permissions.]` profile.", }), -}); - -export type V2ThreadSettingsUpdatedNotification__ApprovalsReviewer = - | "user" - | "auto_review" - | "guardian_subagent"; -export const V2ThreadSettingsUpdatedNotification__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", -}); +}).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__ActivePermissionProfile" }); export type V2ThreadSettingsUpdatedNotification__AskForApproval = | "untrusted" @@ -8888,25 +10604,60 @@ export const V2ThreadSettingsUpdatedNotification__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__AskForApproval" }); + +export type V2ThreadSettingsUpdatedNotification__ApprovalsReviewer = + | "user" + | "auto_review" + | "guardian_subagent"; +export const V2ThreadSettingsUpdatedNotification__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "V2ThreadSettingsUpdatedNotification__ApprovalsReviewer", +}); export type V2ThreadSettingsUpdatedNotification__ModeKind = "plan" | "default"; export const V2ThreadSettingsUpdatedNotification__ModeKind = Schema.Literals([ "plan", "default", -]).annotate({ description: "Initial collaboration mode to use when the TUI starts." }); +]).annotate({ + description: "Initial collaboration mode to use when the TUI starts.", + identifier: "V2ThreadSettingsUpdatedNotification__ModeKind", +}); + +export type V2ThreadSettingsUpdatedNotification__ReasoningEffort = string; +export const V2ThreadSettingsUpdatedNotification__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadSettingsUpdatedNotification__ReasoningEffort", + }), +); + +export type V2ThreadSettingsUpdatedNotification__AbsolutePathBuf = string; +export const V2ThreadSettingsUpdatedNotification__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadSettingsUpdatedNotification__AbsolutePathBuf", +}); export type V2ThreadSettingsUpdatedNotification__Personality = "none" | "friendly" | "pragmatic"; export const V2ThreadSettingsUpdatedNotification__Personality = Schema.Literals([ "none", "friendly", "pragmatic", -]); +]).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__Personality" }); -export type V2ThreadSettingsUpdatedNotification__ReasoningEffort = string; -export const V2ThreadSettingsUpdatedNotification__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +export type V2ThreadSettingsUpdatedNotification__NetworkAccess = "restricted" | "enabled"; +export const V2ThreadSettingsUpdatedNotification__NetworkAccess = Schema.Literals([ + "restricted", + "enabled", +]).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__NetworkAccess" }); export type V2ThreadSettingsUpdatedNotification__ReasoningSummary = | "auto" @@ -8922,104 +10673,72 @@ export const V2ThreadSettingsUpdatedNotification__ReasoningSummary = Schema.Unio ).annotate({ description: "A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries", + identifier: "V2ThreadSettingsUpdatedNotification__ReasoningSummary", }); export type V2ThreadStartedNotification__AbsolutePathBuf = string; export const V2ThreadStartedNotification__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadStartedNotification__AbsolutePathBuf", }); +export type V2ThreadStartedNotification__GitInfo = { + readonly branch?: string | null; + readonly originUrl?: string | null; + readonly sha?: string | null; +}; +export const V2ThreadStartedNotification__GitInfo = Schema.Struct({ + branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadStartedNotification__GitInfo" }); + export type V2ThreadStartedNotification__AgentPath = string; -export const V2ThreadStartedNotification__AgentPath = Schema.String; +export const V2ThreadStartedNotification__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadStartedNotification__AgentPath", +}); -export type V2ThreadStartedNotification__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ThreadStartedNotification__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2ThreadStartedNotification__ThreadId = string; +export const V2ThreadStartedNotification__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadStartedNotification__ThreadId", +}); -export type V2ThreadStartedNotification__CommandExecutionStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2ThreadStartedNotification__CommandExecutionStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); +export type V2ThreadStartedNotification__ThreadActiveFlag = + | "waitingOnApproval" + | "waitingOnUserInput"; +export const V2ThreadStartedNotification__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadStartedNotification__ThreadActiveFlag" }); -export type V2ThreadStartedNotification__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadStartedNotification__DynamicToolCallOutputContentItem = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), - Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), - Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadStartedNotification__DynamicToolCallStatus = - | "inProgress" - | "completed" - | "failed"; -export const V2ThreadStartedNotification__DynamicToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); - -export type V2ThreadStartedNotification__GitInfo = { - readonly branch?: string | null; - readonly originUrl?: string | null; - readonly sha?: string | null; -}; -export const V2ThreadStartedNotification__GitInfo = Schema.Struct({ - branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +export type V2ThreadStartedNotification__ThreadSource = string; +export const V2ThreadStartedNotification__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadStartedNotification__ThreadSource", }); -export type V2ThreadStartedNotification__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; +export type V2ThreadStartedNotification__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadStartedNotification__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ThreadStartedNotification__NonSteerableTurnKind" }); + +export type V2ThreadStartedNotification__ByteRange = { + readonly end: number; + readonly start: number; }; -export const V2ThreadStartedNotification__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, -}); +export const V2ThreadStartedNotification__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadStartedNotification__ByteRange" }); export type V2ThreadStartedNotification__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadStartedNotification__ImageDetail = Schema.Literals([ @@ -9027,48 +10746,16 @@ export const V2ThreadStartedNotification__ImageDetail = Schema.Literals([ "low", "high", "original", -]); - -export type V2ThreadStartedNotification__LegacyAppPathString = string; -export const V2ThreadStartedNotification__LegacyAppPathString = Schema.String; - -export type V2ThreadStartedNotification__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const V2ThreadStartedNotification__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2ThreadStartedNotification__McpToolCallError = { readonly message: string }; -export const V2ThreadStartedNotification__McpToolCallError = Schema.Struct({ - message: Schema.String, -}); +]).annotate({ identifier: "V2ThreadStartedNotification__ImageDetail" }); -export type V2ThreadStartedNotification__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; +export type V2ThreadStartedNotification__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; }; -export const V2ThreadStartedNotification__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); - -export type V2ThreadStartedNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadStartedNotification__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export const V2ThreadStartedNotification__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadStartedNotification__HookPromptFragment" }); export type V2ThreadStartedNotification__MemoryCitationEntry = { readonly lineEnd: number; @@ -9078,41 +10765,65 @@ export type V2ThreadStartedNotification__MemoryCitationEntry = { }; export const V2ThreadStartedNotification__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), note: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadStartedNotification__MemoryCitationEntry" }); export type V2ThreadStartedNotification__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadStartedNotification__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +export const V2ThreadStartedNotification__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadStartedNotification__MessagePhase", }); -export type V2ThreadStartedNotification__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadStartedNotification__NonSteerableTurnKind = Schema.Literals([ - "review", - "compact", -]); +export type V2ThreadStartedNotification__LegacyAppPathString = string; +export const V2ThreadStartedNotification__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadStartedNotification__LegacyAppPathString", +}); -export type V2ThreadStartedNotification__PatchApplyStatus = +export type V2ThreadStartedNotification__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadStartedNotification__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadStartedNotification__CommandExecutionSource" }); + +export type V2ThreadStartedNotification__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadStartedNotification__PatchApplyStatus = Schema.Literals([ +export const V2ThreadStartedNotification__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ThreadStartedNotification__CommandExecutionStatus" }); export type V2ThreadStartedNotification__PatchChangeKind = | { readonly type: "add" } @@ -9132,12 +10843,157 @@ export const V2ThreadStartedNotification__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadStartedNotification__PatchChangeKind" }); + +export type V2ThreadStartedNotification__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadStartedNotification__PatchApplyStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "declined", +]).annotate({ identifier: "V2ThreadStartedNotification__PatchApplyStatus" }); + +export type V2ThreadStartedNotification__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; +}; +export const V2ThreadStartedNotification__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadStartedNotification__McpToolCallAppContext" }); + +export type V2ThreadStartedNotification__McpToolCallError = { readonly message: string }; +export const V2ThreadStartedNotification__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadStartedNotification__McpToolCallError" }); + +export type V2ThreadStartedNotification__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadStartedNotification__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadStartedNotification__McpToolCallResult" }); + +export type V2ThreadStartedNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadStartedNotification__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadStartedNotification__McpToolCallStatus" }); + +export type V2ThreadStartedNotification__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadStartedNotification__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartedNotification__DynamicToolCallOutputContentItem" }); + +export type V2ThreadStartedNotification__DynamicToolCallStatus = + | "inProgress" + | "completed" + | "failed"; +export const V2ThreadStartedNotification__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadStartedNotification__DynamicToolCallStatus" }); + +export type V2ThreadStartedNotification__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadStartedNotification__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadStartedNotification__CollabAgentStatus" }); export type V2ThreadStartedNotification__ReasoningEffort = string; export const V2ThreadStartedNotification__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadStartedNotification__ReasoningEffort", + }), +); + +export type V2ThreadStartedNotification__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2ThreadStartedNotification__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2ThreadStartedNotification__CollabAgentToolCallStatus" }); + +export type V2ThreadStartedNotification__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadStartedNotification__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadStartedNotification__CollabAgentTool" }); export type V2ThreadStartedNotification__SubAgentActivityKind = | "started" @@ -9149,58 +11005,7 @@ export const V2ThreadStartedNotification__SubAgentActivityKind = Schema.Literals "interacted", "interrupted", "completed", -]); - -export type V2ThreadStartedNotification__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2ThreadStartedNotification__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type V2ThreadStartedNotification__ThreadActiveFlag = - | "waitingOnApproval" - | "waitingOnUserInput"; -export const V2ThreadStartedNotification__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); - -export type V2ThreadStartedNotification__ThreadId = string; -export const V2ThreadStartedNotification__ThreadId = Schema.String; - -export type V2ThreadStartedNotification__ThreadSource = string; -export const V2ThreadStartedNotification__ThreadSource = Schema.String; - -export type V2ThreadStartedNotification__TurnStatus = - | "completed" - | "interrupted" - | "failed" - | "inProgress"; -export const V2ThreadStartedNotification__TurnStatus = Schema.Literals([ - "completed", - "interrupted", - "failed", - "inProgress", -]); +]).annotate({ identifier: "V2ThreadStartedNotification__SubAgentActivityKind" }); export type V2ThreadStartedNotification__WebSearchAction = | { @@ -9232,17 +11037,36 @@ export const V2ThreadStartedNotification__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadStartedNotification__WebSearchAction" }); -export type V2ThreadStartParams__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; -export const V2ThreadStartParams__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", -}); +export type V2ThreadStartedNotification__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadStartedNotification__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartedNotification__TurnItemsView" }); + +export type V2ThreadStartedNotification__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadStartedNotification__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2ThreadStartedNotification__TurnStatus" }); export type V2ThreadStartParams__AskForApproval = | "untrusted" @@ -9271,12 +11095,51 @@ export const V2ThreadStartParams__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadStartParams__AskForApproval" }); + +export type V2ThreadStartParams__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; +export const V2ThreadStartParams__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "V2ThreadStartParams__ApprovalsReviewer", +}); + +export type V2ThreadStartParams__Personality = "none" | "friendly" | "pragmatic"; +export const V2ThreadStartParams__Personality = Schema.Literals([ + "none", + "friendly", + "pragmatic", +]).annotate({ identifier: "V2ThreadStartParams__Personality" }); + +export type V2ThreadStartParams__SandboxMode = + | "read-only" + | "workspace-write" + | "danger-full-access"; +export const V2ThreadStartParams__SandboxMode = Schema.Literals([ + "read-only", + "workspace-write", + "danger-full-access", +]).annotate({ identifier: "V2ThreadStartParams__SandboxMode" }); + +export type V2ThreadStartParams__ThreadStartSource = "startup" | "clear"; +export const V2ThreadStartParams__ThreadStartSource = Schema.Literals([ + "startup", + "clear", +]).annotate({ identifier: "V2ThreadStartParams__ThreadStartSource" }); + +export type V2ThreadStartParams__ThreadSource = string; +export const V2ThreadStartParams__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadStartParams__ThreadSource", +}); export type V2ThreadStartParams__DynamicToolNamespaceTool = { readonly deferLoading?: boolean; readonly description: string; - readonly inputSchema: unknown; + readonly inputSchema: Schema.Json; readonly name: string; readonly type: "function"; }; @@ -9285,44 +11148,44 @@ export const V2ThreadStartParams__DynamicToolNamespaceTool = Schema.Union( Schema.Struct({ deferLoading: Schema.optionalKey(Schema.Boolean), description: Schema.String, - inputSchema: Schema.Unknown, + inputSchema: Schema.Json.annotate({ expected: "JSON value" }), name: Schema.String, type: Schema.Literal("function").annotate({ title: "FunctionDynamicToolNamespaceToolType" }), }).annotate({ title: "FunctionDynamicToolNamespaceTool" }), ], { mode: "oneOf" }, -); - -export type V2ThreadStartParams__LegacyAppPathString = string; -export const V2ThreadStartParams__LegacyAppPathString = Schema.String; - -export type V2ThreadStartParams__Personality = "none" | "friendly" | "pragmatic"; -export const V2ThreadStartParams__Personality = Schema.Literals(["none", "friendly", "pragmatic"]); - -export type V2ThreadStartParams__SandboxMode = - | "read-only" - | "workspace-write" - | "danger-full-access"; -export const V2ThreadStartParams__SandboxMode = Schema.Literals([ - "read-only", - "workspace-write", - "danger-full-access", -]); +).annotate({ identifier: "V2ThreadStartParams__DynamicToolNamespaceTool" }); -export type V2ThreadStartParams__ThreadSource = string; -export const V2ThreadStartParams__ThreadSource = Schema.String; - -export type V2ThreadStartParams__ThreadStartSource = "startup" | "clear"; -export const V2ThreadStartParams__ThreadStartSource = Schema.Literals(["startup", "clear"]); - -export type V2ThreadStartResponse__AbsolutePathBuf = string; -export const V2ThreadStartResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", +export type V2ThreadStartParams__CapabilityRootLocation = { + readonly environmentId: string; + readonly path: string; + readonly type: "environment"; +}; +export const V2ThreadStartParams__CapabilityRootLocation = Schema.Union( + [ + Schema.Struct({ + environmentId: Schema.String, + path: Schema.String.annotate({ + description: "Absolute path for the root in the selected environment.", + }), + type: Schema.Literal("environment").annotate({ + title: "EnvironmentCapabilityRootLocationType", + }), + }).annotate({ + title: "EnvironmentCapabilityRootLocation", + description: "A path owned by an execution environment.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: "Location used to resolve a selected capability root.", + identifier: "V2ThreadStartParams__CapabilityRootLocation", }); -export type V2ThreadStartResponse__AgentPath = string; -export const V2ThreadStartResponse__AgentPath = Schema.String; +export type V2ThreadStartParams__LegacyAppPathString = string; +export const V2ThreadStartParams__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadStartParams__LegacyAppPathString", +}); export type V2ThreadStartResponse__AskForApproval = | "untrusted" @@ -9351,72 +11214,46 @@ export const V2ThreadStartResponse__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadStartResponse__AskForApproval" }); -export type V2ThreadStartResponse__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ThreadStartResponse__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2ThreadStartResponse__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; +export const V2ThreadStartResponse__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "V2ThreadStartResponse__ApprovalsReviewer", +}); -export type V2ThreadStartResponse__CommandExecutionStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2ThreadStartResponse__CommandExecutionStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); +export type V2ThreadStartResponse__AbsolutePathBuf = string; +export const V2ThreadStartResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadStartResponse__AbsolutePathBuf", +}); -export type V2ThreadStartResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadStartResponse__DynamicToolCallOutputContentItem = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), - Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), - Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), - ], - { mode: "oneOf" }, +export type V2ThreadStartResponse__LegacyAppPathString = string; +export const V2ThreadStartResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadStartResponse__LegacyAppPathString", +}); + +export type V2ThreadStartResponse__ReasoningEffort = string; +export const V2ThreadStartResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadStartResponse__ReasoningEffort", + }), ); -export type V2ThreadStartResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadStartResponse__DynamicToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export type V2ThreadStartResponse__NetworkAccess = "restricted" | "enabled"; +export const V2ThreadStartResponse__NetworkAccess = Schema.Literals([ + "restricted", + "enabled", +]).annotate({ identifier: "V2ThreadStartResponse__NetworkAccess" }); export type V2ThreadStartResponse__GitInfo = { readonly branch?: string | null; @@ -9427,63 +11264,65 @@ export const V2ThreadStartResponse__GitInfo = Schema.Struct({ branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadStartResponse__GitInfo" }); + +export type V2ThreadStartResponse__AgentPath = string; +export const V2ThreadStartResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadStartResponse__AgentPath", }); -export type V2ThreadStartResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ThreadStartResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, +export type V2ThreadStartResponse__ThreadId = string; +export const V2ThreadStartResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadStartResponse__ThreadId", }); -export type V2ThreadStartResponse__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2ThreadStartResponse__ImageDetail = Schema.Literals([ - "auto", - "low", - "high", - "original", -]); +export type V2ThreadStartResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; +export const V2ThreadStartResponse__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadStartResponse__ThreadActiveFlag" }); -export type V2ThreadStartResponse__LegacyAppPathString = string; -export const V2ThreadStartResponse__LegacyAppPathString = Schema.String; +export type V2ThreadStartResponse__ThreadSource = string; +export const V2ThreadStartResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadStartResponse__ThreadSource", +}); -export type V2ThreadStartResponse__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const V2ThreadStartResponse__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +export type V2ThreadStartResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadStartResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ThreadStartResponse__NonSteerableTurnKind" }); -export type V2ThreadStartResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadStartResponse__McpToolCallError = Schema.Struct({ message: Schema.String }); +export type V2ThreadStartResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadStartResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadStartResponse__ByteRange" }); -export type V2ThreadStartResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; -}; -export const V2ThreadStartResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); +export type V2ThreadStartResponse__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2ThreadStartResponse__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2ThreadStartResponse__ImageDetail" }); -export type V2ThreadStartResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadStartResponse__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export type V2ThreadStartResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; +}; +export const V2ThreadStartResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadStartResponse__HookPromptFragment" }); export type V2ThreadStartResponse__MemoryCitationEntry = { readonly lineEnd: number; @@ -9493,38 +11332,60 @@ export type V2ThreadStartResponse__MemoryCitationEntry = { }; export const V2ThreadStartResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), note: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadStartResponse__MemoryCitationEntry" }); export type V2ThreadStartResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadStartResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +export const V2ThreadStartResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadStartResponse__MessagePhase", }); -export type V2ThreadStartResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadStartResponse__NonSteerableTurnKind = Schema.Literals(["review", "compact"]); +export type V2ThreadStartResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadStartResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadStartResponse__CommandExecutionSource" }); -export type V2ThreadStartResponse__PatchApplyStatus = +export type V2ThreadStartResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadStartResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadStartResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ThreadStartResponse__CommandExecutionStatus" }); export type V2ThreadStartResponse__PatchChangeKind = | { readonly type: "add" } @@ -9544,73 +11405,156 @@ export const V2ThreadStartResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); - -export type V2ThreadStartResponse__ReasoningEffort = string; -export const V2ThreadStartResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +).annotate({ identifier: "V2ThreadStartResponse__PatchChangeKind" }); -export type V2ThreadStartResponse__SubAgentActivityKind = - | "started" - | "interacted" - | "interrupted" - | "completed"; -export const V2ThreadStartResponse__SubAgentActivityKind = Schema.Literals([ - "started", - "interacted", - "interrupted", +export type V2ThreadStartResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadStartResponse__PatchApplyStatus = Schema.Literals([ + "inProgress", "completed", -]); + "failed", + "declined", +]).annotate({ identifier: "V2ThreadStartResponse__PatchApplyStatus" }); -export type V2ThreadStartResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; +export type V2ThreadStartResponse__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; }; -export const V2ThreadStartResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); +export const V2ThreadStartResponse__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadStartResponse__McpToolCallAppContext" }); -export type V2ThreadStartResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; -export const V2ThreadStartResponse__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); +export type V2ThreadStartResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadStartResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadStartResponse__McpToolCallError" }); -export type V2ThreadStartResponse__ThreadId = string; -export const V2ThreadStartResponse__ThreadId = Schema.String; +export type V2ThreadStartResponse__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadStartResponse__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadStartResponse__McpToolCallResult" }); -export type V2ThreadStartResponse__ThreadSource = string; -export const V2ThreadStartResponse__ThreadSource = Schema.String; +export type V2ThreadStartResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadStartResponse__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadStartResponse__McpToolCallStatus" }); -export type V2ThreadStartResponse__TurnStatus = - | "completed" +export type V2ThreadStartResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadStartResponse__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartResponse__DynamicToolCallOutputContentItem" }); + +export type V2ThreadStartResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadStartResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadStartResponse__DynamicToolCallStatus" }); + +export type V2ThreadStartResponse__CollabAgentStatus = + | "pendingInit" + | "running" | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadStartResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadStartResponse__CollabAgentStatus" }); + +export type V2ThreadStartResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" | "failed" - | "inProgress"; -export const V2ThreadStartResponse__TurnStatus = Schema.Literals([ + | "interrupted"; +export const V2ThreadStartResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", "completed", - "interrupted", "failed", - "inProgress", -]); + "interrupted", +]).annotate({ identifier: "V2ThreadStartResponse__CollabAgentToolCallStatus" }); + +export type V2ThreadStartResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadStartResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadStartResponse__CollabAgentTool" }); + +export type V2ThreadStartResponse__SubAgentActivityKind = + | "started" + | "interacted" + | "interrupted" + | "completed"; +export const V2ThreadStartResponse__SubAgentActivityKind = Schema.Literals([ + "started", + "interacted", + "interrupted", + "completed", +]).annotate({ identifier: "V2ThreadStartResponse__SubAgentActivityKind" }); export type V2ThreadStartResponse__WebSearchAction = | { @@ -9642,7 +11586,36 @@ export const V2ThreadStartResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadStartResponse__WebSearchAction" }); + +export type V2ThreadStartResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadStartResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartResponse__TurnItemsView" }); + +export type V2ThreadStartResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadStartResponse__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2ThreadStartResponse__TurnStatus" }); export type V2ThreadStatusChangedNotification__ThreadActiveFlag = | "waitingOnApproval" @@ -9650,7 +11623,7 @@ export type V2ThreadStatusChangedNotification__ThreadActiveFlag = export const V2ThreadStatusChangedNotification__ThreadActiveFlag = Schema.Literals([ "waitingOnApproval", "waitingOnUserInput", -]); +]).annotate({ identifier: "V2ThreadStatusChangedNotification__ThreadActiveFlag" }); export type V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown = { readonly cacheWriteInputTokens?: number; @@ -9662,92 +11635,34 @@ export type V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown = { }; export const V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown = Schema.Struct({ cacheWriteInputTokens: Schema.optionalKey( - Schema.Number.annotate({ default: 0, format: "int64" }).check(Schema.isInt()), + Schema.Number.annotate({ default: 0, format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), ), - cachedInputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - inputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - outputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - reasoningOutputTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - totalTokens: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -}); + cachedInputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + inputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + outputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + reasoningOutputTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + totalTokens: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +}).annotate({ identifier: "V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown" }); export type V2ThreadUnarchiveResponse__AbsolutePathBuf = string; export const V2ThreadUnarchiveResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadUnarchiveResponse__AbsolutePathBuf", }); -export type V2ThreadUnarchiveResponse__AgentPath = string; -export const V2ThreadUnarchiveResponse__AgentPath = Schema.String; - -export type V2ThreadUnarchiveResponse__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2ThreadUnarchiveResponse__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); - -export type V2ThreadUnarchiveResponse__CommandExecutionStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2ThreadUnarchiveResponse__CommandExecutionStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); - -export type V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), - Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), - Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadUnarchiveResponse__DynamicToolCallStatus = - | "inProgress" - | "completed" - | "failed"; -export const V2ThreadUnarchiveResponse__DynamicToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); - export type V2ThreadUnarchiveResponse__GitInfo = { readonly branch?: string | null; readonly originUrl?: string | null; @@ -9757,65 +11672,67 @@ export const V2ThreadUnarchiveResponse__GitInfo = Schema.Struct({ branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadUnarchiveResponse__GitInfo" }); + +export type V2ThreadUnarchiveResponse__AgentPath = string; +export const V2ThreadUnarchiveResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadUnarchiveResponse__AgentPath", }); -export type V2ThreadUnarchiveResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2ThreadUnarchiveResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, +export type V2ThreadUnarchiveResponse__ThreadId = string; +export const V2ThreadUnarchiveResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadUnarchiveResponse__ThreadId", +}); + +export type V2ThreadUnarchiveResponse__ThreadActiveFlag = + | "waitingOnApproval" + | "waitingOnUserInput"; +export const V2ThreadUnarchiveResponse__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__ThreadActiveFlag" }); + +export type V2ThreadUnarchiveResponse__ThreadSource = string; +export const V2ThreadUnarchiveResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadUnarchiveResponse__ThreadSource", }); +export type V2ThreadUnarchiveResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadUnarchiveResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__NonSteerableTurnKind" }); + +export type V2ThreadUnarchiveResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadUnarchiveResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadUnarchiveResponse__ByteRange" }); + export type V2ThreadUnarchiveResponse__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadUnarchiveResponse__ImageDetail = Schema.Literals([ "auto", "low", "high", "original", -]); - -export type V2ThreadUnarchiveResponse__LegacyAppPathString = string; -export const V2ThreadUnarchiveResponse__LegacyAppPathString = Schema.String; - -export type V2ThreadUnarchiveResponse__McpToolCallAppContext = { - readonly actionName?: string | null; - readonly appName?: string | null; - readonly connectorId: string; - readonly linkId?: string | null; - readonly resourceUri?: string | null; -}; -export const V2ThreadUnarchiveResponse__McpToolCallAppContext = Schema.Struct({ - actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - connectorId: Schema.String, - linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +]).annotate({ identifier: "V2ThreadUnarchiveResponse__ImageDetail" }); -export type V2ThreadUnarchiveResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadUnarchiveResponse__McpToolCallError = Schema.Struct({ - message: Schema.String, -}); - -export type V2ThreadUnarchiveResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; +export type V2ThreadUnarchiveResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; }; -export const V2ThreadUnarchiveResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); - -export type V2ThreadUnarchiveResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadUnarchiveResponse__McpToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", -]); +export const V2ThreadUnarchiveResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadUnarchiveResponse__HookPromptFragment" }); export type V2ThreadUnarchiveResponse__MemoryCitationEntry = { readonly lineEnd: number; @@ -9825,41 +11742,65 @@ export type V2ThreadUnarchiveResponse__MemoryCitationEntry = { }; export const V2ThreadUnarchiveResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), note: Schema.String, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__MemoryCitationEntry" }); export type V2ThreadUnarchiveResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadUnarchiveResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ +export const V2ThreadUnarchiveResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadUnarchiveResponse__MessagePhase", }); -export type V2ThreadUnarchiveResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadUnarchiveResponse__NonSteerableTurnKind = Schema.Literals([ - "review", - "compact", -]); +export type V2ThreadUnarchiveResponse__LegacyAppPathString = string; +export const V2ThreadUnarchiveResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadUnarchiveResponse__LegacyAppPathString", +}); -export type V2ThreadUnarchiveResponse__PatchApplyStatus = +export type V2ThreadUnarchiveResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadUnarchiveResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CommandExecutionSource" }); + +export type V2ThreadUnarchiveResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadUnarchiveResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadUnarchiveResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CommandExecutionStatus" }); export type V2ThreadUnarchiveResponse__PatchChangeKind = | { readonly type: "add" } @@ -9879,75 +11820,169 @@ export const V2ThreadUnarchiveResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); - -export type V2ThreadUnarchiveResponse__ReasoningEffort = string; -export const V2ThreadUnarchiveResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +).annotate({ identifier: "V2ThreadUnarchiveResponse__PatchChangeKind" }); -export type V2ThreadUnarchiveResponse__SubAgentActivityKind = - | "started" - | "interacted" - | "interrupted" - | "completed"; -export const V2ThreadUnarchiveResponse__SubAgentActivityKind = Schema.Literals([ - "started", - "interacted", - "interrupted", +export type V2ThreadUnarchiveResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadUnarchiveResponse__PatchApplyStatus = Schema.Literals([ + "inProgress", "completed", -]); + "failed", + "declined", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__PatchApplyStatus" }); -export type V2ThreadUnarchiveResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; +export type V2ThreadUnarchiveResponse__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; }; -export const V2ThreadUnarchiveResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); +export const V2ThreadUnarchiveResponse__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallAppContext" }); -export type V2ThreadUnarchiveResponse__ThreadActiveFlag = - | "waitingOnApproval" - | "waitingOnUserInput"; -export const V2ThreadUnarchiveResponse__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]); +export type V2ThreadUnarchiveResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadUnarchiveResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallError" }); -export type V2ThreadUnarchiveResponse__ThreadId = string; -export const V2ThreadUnarchiveResponse__ThreadId = Schema.String; +export type V2ThreadUnarchiveResponse__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadUnarchiveResponse__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallResult" }); -export type V2ThreadUnarchiveResponse__ThreadSource = string; -export const V2ThreadUnarchiveResponse__ThreadSource = Schema.String; +export type V2ThreadUnarchiveResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadUnarchiveResponse__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallStatus" }); -export type V2ThreadUnarchiveResponse__TurnStatus = - | "completed" +export type V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem" }); + +export type V2ThreadUnarchiveResponse__DynamicToolCallStatus = + | "inProgress" + | "completed" + | "failed"; +export const V2ThreadUnarchiveResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__DynamicToolCallStatus" }); + +export type V2ThreadUnarchiveResponse__CollabAgentStatus = + | "pendingInit" + | "running" | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadUnarchiveResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentStatus" }); + +export type V2ThreadUnarchiveResponse__ReasoningEffort = string; +export const V2ThreadUnarchiveResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadUnarchiveResponse__ReasoningEffort", + }), +); + +export type V2ThreadUnarchiveResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" | "failed" - | "inProgress"; -export const V2ThreadUnarchiveResponse__TurnStatus = Schema.Literals([ + | "interrupted"; +export const V2ThreadUnarchiveResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", "completed", - "interrupted", "failed", - "inProgress", -]); + "interrupted", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentToolCallStatus" }); + +export type V2ThreadUnarchiveResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadUnarchiveResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentTool" }); + +export type V2ThreadUnarchiveResponse__SubAgentActivityKind = + | "started" + | "interacted" + | "interrupted" + | "completed"; +export const V2ThreadUnarchiveResponse__SubAgentActivityKind = Schema.Literals([ + "started", + "interacted", + "interrupted", + "completed", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__SubAgentActivityKind" }); export type V2ThreadUnarchiveResponse__WebSearchAction = | { @@ -9979,7 +12014,36 @@ export const V2ThreadUnarchiveResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadUnarchiveResponse__WebSearchAction" }); + +export type V2ThreadUnarchiveResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadUnarchiveResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__TurnItemsView" }); + +export type V2ThreadUnarchiveResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadUnarchiveResponse__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__TurnStatus" }); export type V2ThreadUnsubscribeResponse__ThreadUnsubscribeStatus = | "notLoaded" @@ -9989,31 +12053,110 @@ export const V2ThreadUnsubscribeResponse__ThreadUnsubscribeStatus = Schema.Liter "notLoaded", "notSubscribed", "unsubscribed", -]); +]).annotate({ identifier: "V2ThreadUnsubscribeResponse__ThreadUnsubscribeStatus" }); + +export type V2TurnCompletedNotification__NonSteerableTurnKind = "review" | "compact"; +export const V2TurnCompletedNotification__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2TurnCompletedNotification__NonSteerableTurnKind" }); + +export type V2TurnCompletedNotification__ByteRange = { + readonly end: number; + readonly start: number; +}; +export const V2TurnCompletedNotification__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2TurnCompletedNotification__ByteRange" }); + +export type V2TurnCompletedNotification__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2TurnCompletedNotification__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2TurnCompletedNotification__ImageDetail" }); + +export type V2TurnCompletedNotification__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; +}; +export const V2TurnCompletedNotification__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2TurnCompletedNotification__HookPromptFragment" }); + +export type V2TurnCompletedNotification__MemoryCitationEntry = { + readonly lineEnd: number; + readonly lineStart: number; + readonly note: string; + readonly path: string; +}; +export const V2TurnCompletedNotification__MemoryCitationEntry = Schema.Struct({ + lineEnd: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + lineStart: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + note: Schema.String, + path: Schema.String, +}).annotate({ identifier: "V2TurnCompletedNotification__MemoryCitationEntry" }); + +export type V2TurnCompletedNotification__MessagePhase = "commentary" | "final_answer"; +export const V2TurnCompletedNotification__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2TurnCompletedNotification__MessagePhase", +}); export type V2TurnCompletedNotification__AbsolutePathBuf = string; export const V2TurnCompletedNotification__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2TurnCompletedNotification__AbsolutePathBuf", }); -export type V2TurnCompletedNotification__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2TurnCompletedNotification__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2TurnCompletedNotification__LegacyAppPathString = string; +export const V2TurnCompletedNotification__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2TurnCompletedNotification__LegacyAppPathString", +}); + +export type V2TurnCompletedNotification__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2TurnCompletedNotification__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2TurnCompletedNotification__CommandExecutionSource" }); export type V2TurnCompletedNotification__CommandExecutionStatus = | "inProgress" @@ -10025,65 +12168,39 @@ export const V2TurnCompletedNotification__CommandExecutionStatus = Schema.Litera "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2TurnCompletedNotification__CommandExecutionStatus" }); -export type V2TurnCompletedNotification__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2TurnCompletedNotification__DynamicToolCallOutputContentItem = Schema.Union( +export type V2TurnCompletedNotification__PatchChangeKind = + | { readonly type: "add" } + | { readonly type: "delete" } + | { readonly move_path?: string | null; readonly type: "update" }; +export const V2TurnCompletedNotification__PatchChangeKind = Schema.Union( [ Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), + }).annotate({ title: "AddPatchChangeKind" }), Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), + }).annotate({ title: "DeletePatchChangeKind" }), Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), + }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2TurnCompletedNotification__PatchChangeKind" }); -export type V2TurnCompletedNotification__DynamicToolCallStatus = +export type V2TurnCompletedNotification__PatchApplyStatus = | "inProgress" | "completed" - | "failed"; -export const V2TurnCompletedNotification__DynamicToolCallStatus = Schema.Literals([ + | "failed" + | "declined"; +export const V2TurnCompletedNotification__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2TurnCompletedNotification__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2TurnCompletedNotification__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, -}); - -export type V2TurnCompletedNotification__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2TurnCompletedNotification__ImageDetail = Schema.Literals([ - "auto", - "low", - "high", - "original", -]); - -export type V2TurnCompletedNotification__LegacyAppPathString = string; -export const V2TurnCompletedNotification__LegacyAppPathString = Schema.String; + "declined", +]).annotate({ identifier: "V2TurnCompletedNotification__PatchApplyStatus" }); export type V2TurnCompletedNotification__McpToolCallAppContext = { readonly actionName?: string | null; @@ -10098,99 +12215,130 @@ export const V2TurnCompletedNotification__McpToolCallAppContext = Schema.Struct( connectorId: Schema.String, linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallAppContext" }); export type V2TurnCompletedNotification__McpToolCallError = { readonly message: string }; export const V2TurnCompletedNotification__McpToolCallError = Schema.Struct({ message: Schema.String, -}); +}).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallError" }); export type V2TurnCompletedNotification__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; }; export const V2TurnCompletedNotification__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallResult" }); export type V2TurnCompletedNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; export const V2TurnCompletedNotification__McpToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2TurnCompletedNotification__MemoryCitationEntry = { - readonly lineEnd: number; - readonly lineStart: number; - readonly note: string; - readonly path: string; -}; -export const V2TurnCompletedNotification__MemoryCitationEntry = Schema.Struct({ - lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - note: Schema.String, - path: Schema.String, -}); - -export type V2TurnCompletedNotification__MessagePhase = "commentary" | "final_answer"; -export const V2TurnCompletedNotification__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ - description: - 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', -}); +]).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallStatus" }); -export type V2TurnCompletedNotification__NonSteerableTurnKind = "review" | "compact"; -export const V2TurnCompletedNotification__NonSteerableTurnKind = Schema.Literals([ - "review", - "compact", -]); +export type V2TurnCompletedNotification__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2TurnCompletedNotification__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnCompletedNotification__DynamicToolCallOutputContentItem" }); -export type V2TurnCompletedNotification__PatchApplyStatus = +export type V2TurnCompletedNotification__DynamicToolCallStatus = | "inProgress" | "completed" - | "failed" - | "declined"; -export const V2TurnCompletedNotification__PatchApplyStatus = Schema.Literals([ + | "failed"; +export const V2TurnCompletedNotification__DynamicToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", - "declined", -]); +]).annotate({ identifier: "V2TurnCompletedNotification__DynamicToolCallStatus" }); -export type V2TurnCompletedNotification__PatchChangeKind = - | { readonly type: "add" } - | { readonly type: "delete" } - | { readonly move_path?: string | null; readonly type: "update" }; -export const V2TurnCompletedNotification__PatchChangeKind = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), - }).annotate({ title: "AddPatchChangeKind" }), - Schema.Struct({ - type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), - }).annotate({ title: "DeletePatchChangeKind" }), - Schema.Struct({ - move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), - }).annotate({ title: "UpdatePatchChangeKind" }), - ], - { mode: "oneOf" }, -); +export type V2TurnCompletedNotification__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2TurnCompletedNotification__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2TurnCompletedNotification__CollabAgentStatus" }); export type V2TurnCompletedNotification__ReasoningEffort = string; export const V2TurnCompletedNotification__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2TurnCompletedNotification__ReasoningEffort", + }), +); + +export type V2TurnCompletedNotification__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2TurnCompletedNotification__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2TurnCompletedNotification__CollabAgentToolCallStatus" }); + +export type V2TurnCompletedNotification__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2TurnCompletedNotification__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2TurnCompletedNotification__CollabAgentTool" }); export type V2TurnCompletedNotification__SubAgentActivityKind = | "started" @@ -10202,44 +12350,7 @@ export const V2TurnCompletedNotification__SubAgentActivityKind = Schema.Literals "interacted", "interrupted", "completed", -]); - -export type V2TurnCompletedNotification__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2TurnCompletedNotification__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type V2TurnCompletedNotification__TurnStatus = - | "completed" - | "interrupted" - | "failed" - | "inProgress"; -export const V2TurnCompletedNotification__TurnStatus = Schema.Literals([ - "completed", - "interrupted", - "failed", - "inProgress", -]); +]).annotate({ identifier: "V2TurnCompletedNotification__SubAgentActivityKind" }); export type V2TurnCompletedNotification__WebSearchAction = | { @@ -10271,7 +12382,36 @@ export const V2TurnCompletedNotification__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2TurnCompletedNotification__WebSearchAction" }); + +export type V2TurnCompletedNotification__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2TurnCompletedNotification__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnCompletedNotification__TurnItemsView" }); + +export type V2TurnCompletedNotification__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2TurnCompletedNotification__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2TurnCompletedNotification__TurnStatus" }); export type V2TurnPlanUpdatedNotification__TurnPlanStepStatus = | "pending" @@ -10281,31 +12421,107 @@ export const V2TurnPlanUpdatedNotification__TurnPlanStepStatus = Schema.Literals "pending", "inProgress", "completed", -]); +]).annotate({ identifier: "V2TurnPlanUpdatedNotification__TurnPlanStepStatus" }); + +export type V2TurnStartedNotification__NonSteerableTurnKind = "review" | "compact"; +export const V2TurnStartedNotification__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2TurnStartedNotification__NonSteerableTurnKind" }); + +export type V2TurnStartedNotification__ByteRange = { readonly end: number; readonly start: number }; +export const V2TurnStartedNotification__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2TurnStartedNotification__ByteRange" }); + +export type V2TurnStartedNotification__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2TurnStartedNotification__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2TurnStartedNotification__ImageDetail" }); + +export type V2TurnStartedNotification__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; +}; +export const V2TurnStartedNotification__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2TurnStartedNotification__HookPromptFragment" }); + +export type V2TurnStartedNotification__MemoryCitationEntry = { + readonly lineEnd: number; + readonly lineStart: number; + readonly note: string; + readonly path: string; +}; +export const V2TurnStartedNotification__MemoryCitationEntry = Schema.Struct({ + lineEnd: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + lineStart: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + note: Schema.String, + path: Schema.String, +}).annotate({ identifier: "V2TurnStartedNotification__MemoryCitationEntry" }); + +export type V2TurnStartedNotification__MessagePhase = "commentary" | "final_answer"; +export const V2TurnStartedNotification__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2TurnStartedNotification__MessagePhase", +}); export type V2TurnStartedNotification__AbsolutePathBuf = string; export const V2TurnStartedNotification__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2TurnStartedNotification__AbsolutePathBuf", }); -export type V2TurnStartedNotification__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2TurnStartedNotification__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2TurnStartedNotification__LegacyAppPathString = string; +export const V2TurnStartedNotification__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2TurnStartedNotification__LegacyAppPathString", +}); + +export type V2TurnStartedNotification__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2TurnStartedNotification__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2TurnStartedNotification__CommandExecutionSource" }); export type V2TurnStartedNotification__CommandExecutionStatus = | "inProgress" @@ -10317,65 +12533,39 @@ export const V2TurnStartedNotification__CommandExecutionStatus = Schema.Literals "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2TurnStartedNotification__CommandExecutionStatus" }); -export type V2TurnStartedNotification__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2TurnStartedNotification__DynamicToolCallOutputContentItem = Schema.Union( +export type V2TurnStartedNotification__PatchChangeKind = + | { readonly type: "add" } + | { readonly type: "delete" } + | { readonly move_path?: string | null; readonly type: "update" }; +export const V2TurnStartedNotification__PatchChangeKind = Schema.Union( [ Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), + }).annotate({ title: "AddPatchChangeKind" }), Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), + }).annotate({ title: "DeletePatchChangeKind" }), Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), + }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2TurnStartedNotification__PatchChangeKind" }); -export type V2TurnStartedNotification__DynamicToolCallStatus = +export type V2TurnStartedNotification__PatchApplyStatus = | "inProgress" | "completed" - | "failed"; -export const V2TurnStartedNotification__DynamicToolCallStatus = Schema.Literals([ + | "failed" + | "declined"; +export const V2TurnStartedNotification__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2TurnStartedNotification__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2TurnStartedNotification__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, -}); - -export type V2TurnStartedNotification__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2TurnStartedNotification__ImageDetail = Schema.Literals([ - "auto", - "low", - "high", - "original", -]); - -export type V2TurnStartedNotification__LegacyAppPathString = string; -export const V2TurnStartedNotification__LegacyAppPathString = Schema.String; + "declined", +]).annotate({ identifier: "V2TurnStartedNotification__PatchApplyStatus" }); export type V2TurnStartedNotification__McpToolCallAppContext = { readonly actionName?: string | null; @@ -10390,99 +12580,130 @@ export const V2TurnStartedNotification__McpToolCallAppContext = Schema.Struct({ connectorId: Schema.String, linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2TurnStartedNotification__McpToolCallAppContext" }); export type V2TurnStartedNotification__McpToolCallError = { readonly message: string }; export const V2TurnStartedNotification__McpToolCallError = Schema.Struct({ message: Schema.String, -}); +}).annotate({ identifier: "V2TurnStartedNotification__McpToolCallError" }); export type V2TurnStartedNotification__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; }; export const V2TurnStartedNotification__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2TurnStartedNotification__McpToolCallResult" }); export type V2TurnStartedNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; export const V2TurnStartedNotification__McpToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2TurnStartedNotification__MemoryCitationEntry = { - readonly lineEnd: number; - readonly lineStart: number; - readonly note: string; - readonly path: string; -}; -export const V2TurnStartedNotification__MemoryCitationEntry = Schema.Struct({ - lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - note: Schema.String, - path: Schema.String, -}); - -export type V2TurnStartedNotification__MessagePhase = "commentary" | "final_answer"; -export const V2TurnStartedNotification__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ - description: - 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', -}); +]).annotate({ identifier: "V2TurnStartedNotification__McpToolCallStatus" }); -export type V2TurnStartedNotification__NonSteerableTurnKind = "review" | "compact"; -export const V2TurnStartedNotification__NonSteerableTurnKind = Schema.Literals([ - "review", - "compact", -]); +export type V2TurnStartedNotification__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2TurnStartedNotification__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartedNotification__DynamicToolCallOutputContentItem" }); -export type V2TurnStartedNotification__PatchApplyStatus = +export type V2TurnStartedNotification__DynamicToolCallStatus = | "inProgress" | "completed" - | "failed" - | "declined"; -export const V2TurnStartedNotification__PatchApplyStatus = Schema.Literals([ + | "failed"; +export const V2TurnStartedNotification__DynamicToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", - "declined", -]); +]).annotate({ identifier: "V2TurnStartedNotification__DynamicToolCallStatus" }); -export type V2TurnStartedNotification__PatchChangeKind = - | { readonly type: "add" } - | { readonly type: "delete" } - | { readonly move_path?: string | null; readonly type: "update" }; -export const V2TurnStartedNotification__PatchChangeKind = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), - }).annotate({ title: "AddPatchChangeKind" }), - Schema.Struct({ - type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), - }).annotate({ title: "DeletePatchChangeKind" }), - Schema.Struct({ - move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), - }).annotate({ title: "UpdatePatchChangeKind" }), - ], - { mode: "oneOf" }, -); +export type V2TurnStartedNotification__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2TurnStartedNotification__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2TurnStartedNotification__CollabAgentStatus" }); export type V2TurnStartedNotification__ReasoningEffort = string; export const V2TurnStartedNotification__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2TurnStartedNotification__ReasoningEffort", + }), +); + +export type V2TurnStartedNotification__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2TurnStartedNotification__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2TurnStartedNotification__CollabAgentToolCallStatus" }); + +export type V2TurnStartedNotification__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2TurnStartedNotification__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2TurnStartedNotification__CollabAgentTool" }); export type V2TurnStartedNotification__SubAgentActivityKind = | "started" @@ -10494,44 +12715,7 @@ export const V2TurnStartedNotification__SubAgentActivityKind = Schema.Literals([ "interacted", "interrupted", "completed", -]); - -export type V2TurnStartedNotification__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2TurnStartedNotification__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type V2TurnStartedNotification__TurnStatus = - | "completed" - | "interrupted" - | "failed" - | "inProgress"; -export const V2TurnStartedNotification__TurnStatus = Schema.Literals([ - "completed", - "interrupted", - "failed", - "inProgress", -]); +]).annotate({ identifier: "V2TurnStartedNotification__SubAgentActivityKind" }); export type V2TurnStartedNotification__WebSearchAction = | { @@ -10563,29 +12747,36 @@ export const V2TurnStartedNotification__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); - -export type V2TurnStartParams__AbsolutePathBuf = string; -export const V2TurnStartParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); +).annotate({ identifier: "V2TurnStartedNotification__WebSearchAction" }); -export type V2TurnStartParams__AdditionalContextKind = "untrusted" | "application"; -export const V2TurnStartParams__AdditionalContextKind = Schema.Literals([ - "untrusted", - "application", -]); +export type V2TurnStartedNotification__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2TurnStartedNotification__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartedNotification__TurnItemsView" }); -export type V2TurnStartParams__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; -export const V2TurnStartParams__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", -}); +export type V2TurnStartedNotification__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2TurnStartedNotification__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2TurnStartedNotification__TurnStatus" }); export type V2TurnStartParams__AskForApproval = | "untrusted" @@ -10614,26 +12805,69 @@ export const V2TurnStartParams__AskForApproval = Schema.Union( }).annotate({ title: "GranularAskForApproval" }), ], { mode: "oneOf" }, -); - -export type V2TurnStartParams__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2TurnStartParams__ImageDetail = Schema.Literals(["auto", "low", "high", "original"]); - -export type V2TurnStartParams__LegacyAppPathString = string; -export const V2TurnStartParams__LegacyAppPathString = Schema.String; +).annotate({ identifier: "V2TurnStartParams__AskForApproval" }); -export type V2TurnStartParams__ModeKind = "plan" | "default"; -export const V2TurnStartParams__ModeKind = Schema.Literals(["plan", "default"]).annotate({ - description: "Initial collaboration mode to use when the TUI starts.", +export type V2TurnStartParams__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; +export const V2TurnStartParams__ApprovalsReviewer = Schema.Literals([ + "user", + "auto_review", + "guardian_subagent", +]).annotate({ + description: + "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + identifier: "V2TurnStartParams__ApprovalsReviewer", }); -export type V2TurnStartParams__Personality = "none" | "friendly" | "pragmatic"; -export const V2TurnStartParams__Personality = Schema.Literals(["none", "friendly", "pragmatic"]); - export type V2TurnStartParams__ReasoningEffort = string; export const V2TurnStartParams__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2TurnStartParams__ReasoningEffort", + }), +); + +export type V2TurnStartParams__ByteRange = { readonly end: number; readonly start: number }; +export const V2TurnStartParams__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2TurnStartParams__ByteRange" }); + +export type V2TurnStartParams__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2TurnStartParams__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2TurnStartParams__ImageDetail" }); + +export type V2TurnStartParams__Personality = "none" | "friendly" | "pragmatic"; +export const V2TurnStartParams__Personality = Schema.Literals([ + "none", + "friendly", + "pragmatic", +]).annotate({ identifier: "V2TurnStartParams__Personality" }); + +export type V2TurnStartParams__NetworkAccess = "restricted" | "enabled"; +export const V2TurnStartParams__NetworkAccess = Schema.Literals(["restricted", "enabled"]).annotate( + { identifier: "V2TurnStartParams__NetworkAccess" }, +); + +export type V2TurnStartParams__AbsolutePathBuf = string; +export const V2TurnStartParams__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2TurnStartParams__AbsolutePathBuf", +}); export type V2TurnStartParams__ReasoningSummary = "auto" | "concise" | "detailed" | "none"; export const V2TurnStartParams__ReasoningSummary = Schema.Union( @@ -10645,56 +12879,125 @@ export const V2TurnStartParams__ReasoningSummary = Schema.Union( ).annotate({ description: "A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries", + identifier: "V2TurnStartParams__ReasoningSummary", }); -export type V2TurnStartParams__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; +export type V2TurnStartParams__AdditionalContextKind = "untrusted" | "application"; +export const V2TurnStartParams__AdditionalContextKind = Schema.Literals([ + "untrusted", + "application", +]).annotate({ identifier: "V2TurnStartParams__AdditionalContextKind" }); + +export type V2TurnStartParams__ModeKind = "plan" | "default"; +export const V2TurnStartParams__ModeKind = Schema.Literals(["plan", "default"]).annotate({ + description: "Initial collaboration mode to use when the TUI starts.", + identifier: "V2TurnStartParams__ModeKind", +}); + +export type V2TurnStartParams__LegacyAppPathString = string; +export const V2TurnStartParams__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2TurnStartParams__LegacyAppPathString", +}); + +export type V2TurnStartResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2TurnStartResponse__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2TurnStartResponse__NonSteerableTurnKind" }); + +export type V2TurnStartResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2TurnStartResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2TurnStartResponse__ByteRange" }); + +export type V2TurnStartResponse__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2TurnStartResponse__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2TurnStartResponse__ImageDetail" }); + +export type V2TurnStartResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; }; -export const V2TurnStartParams__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), +export const V2TurnStartResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2TurnStartResponse__HookPromptFragment" }); + +export type V2TurnStartResponse__MemoryCitationEntry = { + readonly lineEnd: number; + readonly lineStart: number; + readonly note: string; + readonly path: string; +}; +export const V2TurnStartResponse__MemoryCitationEntry = Schema.Struct({ + lineEnd: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + lineStart: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + note: Schema.String, + path: Schema.String, +}).annotate({ identifier: "V2TurnStartResponse__MemoryCitationEntry" }); + +export type V2TurnStartResponse__MessagePhase = "commentary" | "final_answer"; +export const V2TurnStartResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2TurnStartResponse__MessagePhase", }); export type V2TurnStartResponse__AbsolutePathBuf = string; export const V2TurnStartResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2TurnStartResponse__AbsolutePathBuf", }); -export type V2TurnStartResponse__CollabAgentStatus = - | "pendingInit" - | "running" - | "interrupted" - | "completed" - | "errored" - | "shutdown" - | "notFound"; -export const V2TurnStartResponse__CollabAgentStatus = Schema.Literals([ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound", -]); +export type V2TurnStartResponse__LegacyAppPathString = string; +export const V2TurnStartResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2TurnStartResponse__LegacyAppPathString", +}); + +export type V2TurnStartResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2TurnStartResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2TurnStartResponse__CommandExecutionSource" }); export type V2TurnStartResponse__CommandExecutionStatus = | "inProgress" @@ -10706,62 +13009,39 @@ export const V2TurnStartResponse__CommandExecutionStatus = Schema.Literals([ "completed", "failed", "declined", -]); +]).annotate({ identifier: "V2TurnStartResponse__CommandExecutionStatus" }); -export type V2TurnStartResponse__DynamicToolCallOutputContentItem = - | { readonly text: string; readonly type: "inputText" } - | { readonly imageUrl: string; readonly type: "inputImage" } - | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2TurnStartResponse__DynamicToolCallOutputContentItem = Schema.Union( +export type V2TurnStartResponse__PatchChangeKind = + | { readonly type: "add" } + | { readonly type: "delete" } + | { readonly move_path?: string | null; readonly type: "update" }; +export const V2TurnStartResponse__PatchChangeKind = Schema.Union( [ Schema.Struct({ - text: Schema.String, - type: Schema.Literal("inputText").annotate({ - title: "InputTextDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), + }).annotate({ title: "AddPatchChangeKind" }), Schema.Struct({ - imageUrl: Schema.String, - type: Schema.Literal("inputImage").annotate({ - title: "InputImageDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), + }).annotate({ title: "DeletePatchChangeKind" }), Schema.Struct({ - audioUrl: Schema.String, - type: Schema.Literal("inputAudio").annotate({ - title: "InputAudioDynamicToolCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), + }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2TurnStartResponse__PatchChangeKind" }); -export type V2TurnStartResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2TurnStartResponse__DynamicToolCallStatus = Schema.Literals([ +export type V2TurnStartResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2TurnStartResponse__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); - -export type V2TurnStartResponse__HookPromptFragment = { - readonly hookRunId: string; - readonly text: string; -}; -export const V2TurnStartResponse__HookPromptFragment = Schema.Struct({ - hookRunId: Schema.String, - text: Schema.String, -}); - -export type V2TurnStartResponse__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2TurnStartResponse__ImageDetail = Schema.Literals([ - "auto", - "low", - "high", - "original", -]); - -export type V2TurnStartResponse__LegacyAppPathString = string; -export const V2TurnStartResponse__LegacyAppPathString = Schema.String; + "declined", +]).annotate({ identifier: "V2TurnStartResponse__PatchApplyStatus" }); export type V2TurnStartResponse__McpToolCallAppContext = { readonly actionName?: string | null; @@ -10776,94 +13056,127 @@ export const V2TurnStartResponse__McpToolCallAppContext = Schema.Struct({ connectorId: Schema.String, linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2TurnStartResponse__McpToolCallAppContext" }); export type V2TurnStartResponse__McpToolCallError = { readonly message: string }; -export const V2TurnStartResponse__McpToolCallError = Schema.Struct({ message: Schema.String }); +export const V2TurnStartResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2TurnStartResponse__McpToolCallError" }); export type V2TurnStartResponse__McpToolCallResult = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; - readonly structuredContent?: unknown; + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; }; export const V2TurnStartResponse__McpToolCallResult = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), - structuredContent: Schema.optionalKey(Schema.Unknown), -}); + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2TurnStartResponse__McpToolCallResult" }); export type V2TurnStartResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; export const V2TurnStartResponse__McpToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]); +]).annotate({ identifier: "V2TurnStartResponse__McpToolCallStatus" }); -export type V2TurnStartResponse__MemoryCitationEntry = { - readonly lineEnd: number; - readonly lineStart: number; - readonly note: string; - readonly path: string; -}; -export const V2TurnStartResponse__MemoryCitationEntry = Schema.Struct({ - lineEnd: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - lineStart: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - note: Schema.String, - path: Schema.String, -}); - -export type V2TurnStartResponse__MessagePhase = "commentary" | "final_answer"; -export const V2TurnStartResponse__MessagePhase = Schema.Literals([ - "commentary", - "final_answer", -]).annotate({ - description: - 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', -}); - -export type V2TurnStartResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2TurnStartResponse__NonSteerableTurnKind = Schema.Literals(["review", "compact"]); - -export type V2TurnStartResponse__PatchApplyStatus = - | "inProgress" - | "completed" - | "failed" - | "declined"; -export const V2TurnStartResponse__PatchApplyStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "declined", -]); - -export type V2TurnStartResponse__PatchChangeKind = - | { readonly type: "add" } - | { readonly type: "delete" } - | { readonly move_path?: string | null; readonly type: "update" }; -export const V2TurnStartResponse__PatchChangeKind = Schema.Union( +export type V2TurnStartResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2TurnStartResponse__DynamicToolCallOutputContentItem = Schema.Union( [ Schema.Struct({ - type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), - }).annotate({ title: "AddPatchChangeKind" }), + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), Schema.Struct({ - type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), - }).annotate({ title: "DeletePatchChangeKind" }), + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), Schema.Struct({ - move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), - }).annotate({ title: "UpdatePatchChangeKind" }), + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2TurnStartResponse__DynamicToolCallOutputContentItem" }); + +export type V2TurnStartResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2TurnStartResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2TurnStartResponse__DynamicToolCallStatus" }); + +export type V2TurnStartResponse__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2TurnStartResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2TurnStartResponse__CollabAgentStatus" }); export type V2TurnStartResponse__ReasoningEffort = string; export const V2TurnStartResponse__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", -}).check(Schema.isMinLength(1)); +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2TurnStartResponse__ReasoningEffort", + }), +); + +export type V2TurnStartResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2TurnStartResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2TurnStartResponse__CollabAgentToolCallStatus" }); + +export type V2TurnStartResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2TurnStartResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2TurnStartResponse__CollabAgentTool" }); export type V2TurnStartResponse__SubAgentActivityKind = | "started" @@ -10875,40 +13188,7 @@ export const V2TurnStartResponse__SubAgentActivityKind = Schema.Literals([ "interacted", "interrupted", "completed", -]); - -export type V2TurnStartResponse__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2TurnStartResponse__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); - -export type V2TurnStartResponse__TurnStatus = "completed" | "interrupted" | "failed" | "inProgress"; -export const V2TurnStartResponse__TurnStatus = Schema.Literals([ - "completed", - "interrupted", - "failed", - "inProgress", -]); +]).annotate({ identifier: "V2TurnStartResponse__SubAgentActivityKind" }); export type V2TurnStartResponse__WebSearchAction = | { @@ -10940,41 +13220,60 @@ export const V2TurnStartResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2TurnStartResponse__WebSearchAction" }); + +export type V2TurnStartResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2TurnStartResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartResponse__TurnItemsView" }); + +export type V2TurnStartResponse__TurnStatus = "completed" | "interrupted" | "failed" | "inProgress"; +export const V2TurnStartResponse__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2TurnStartResponse__TurnStatus" }); + +export type V2TurnSteerParams__ByteRange = { readonly end: number; readonly start: number }; +export const V2TurnSteerParams__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2TurnSteerParams__ByteRange" }); + +export type V2TurnSteerParams__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2TurnSteerParams__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2TurnSteerParams__ImageDetail" }); export type V2TurnSteerParams__AdditionalContextKind = "untrusted" | "application"; export const V2TurnSteerParams__AdditionalContextKind = Schema.Literals([ "untrusted", "application", -]); - -export type V2TurnSteerParams__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2TurnSteerParams__ImageDetail = Schema.Literals(["auto", "low", "high", "original"]); - -export type V2TurnSteerParams__TextElement = { - readonly byteRange: { readonly end: number; readonly start: number }; - readonly placeholder?: string | null; -}; -export const V2TurnSteerParams__TextElement = Schema.Struct({ - byteRange: Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ - description: "Byte range in the parent `text` buffer that this element occupies.", - }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}); +]).annotate({ identifier: "V2TurnSteerParams__AdditionalContextKind" }); export type V2WindowsSandboxReadinessResponse__WindowsSandboxReadiness = | "ready" @@ -10984,7 +13283,7 @@ export const V2WindowsSandboxReadinessResponse__WindowsSandboxReadiness = Schema "ready", "notConfigured", "updateRequired", -]); +]).annotate({ identifier: "V2WindowsSandboxReadinessResponse__WindowsSandboxReadiness" }); export type V2WindowsSandboxSetupCompletedNotification__WindowsSandboxSetupMode = | "elevated" @@ -10992,19 +13291,20 @@ export type V2WindowsSandboxSetupCompletedNotification__WindowsSandboxSetupMode export const V2WindowsSandboxSetupCompletedNotification__WindowsSandboxSetupMode = Schema.Literals([ "elevated", "unelevated", -]); +]).annotate({ identifier: "V2WindowsSandboxSetupCompletedNotification__WindowsSandboxSetupMode" }); export type V2WindowsSandboxSetupStartParams__AbsolutePathBuf = string; export const V2WindowsSandboxSetupStartParams__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2WindowsSandboxSetupStartParams__AbsolutePathBuf", }); export type V2WindowsSandboxSetupStartParams__WindowsSandboxSetupMode = "elevated" | "unelevated"; export const V2WindowsSandboxSetupStartParams__WindowsSandboxSetupMode = Schema.Literals([ "elevated", "unelevated", -]); +]).annotate({ identifier: "V2WindowsSandboxSetupStartParams__WindowsSandboxSetupMode" }); export type ApplyPatchApprovalResponse__NetworkPolicyAmendment = { readonly action: ApplyPatchApprovalResponse__NetworkPolicyRuleAction; @@ -11013,19 +13313,323 @@ export type ApplyPatchApprovalResponse__NetworkPolicyAmendment = { export const ApplyPatchApprovalResponse__NetworkPolicyAmendment = Schema.Struct({ action: ApplyPatchApprovalResponse__NetworkPolicyRuleAction, host: Schema.String, +}).annotate({ identifier: "ApplyPatchApprovalResponse__NetworkPolicyAmendment" }); + +export type ClientRequest__InitializeParams = { + readonly capabilities?: ClientRequest__InitializeCapabilities | null; + readonly clientInfo: ClientRequest__ClientInfo; +}; +export const ClientRequest__InitializeParams = Schema.Struct({ + capabilities: Schema.optionalKey( + Schema.Union([ClientRequest__InitializeCapabilities, Schema.Null]), + ), + clientInfo: ClientRequest__ClientInfo, +}).annotate({ identifier: "ClientRequest__InitializeParams" }); + +export type ClientRequest__ThreadResumeParams = { + readonly approvalPolicy?: ClientRequest__AskForApproval | null; + readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; + readonly baseInstructions?: string | null; + readonly config?: { readonly [x: string]: Schema.Json } | null; + readonly cwd?: string | null; + readonly developerInstructions?: string | null; + readonly model?: string | null; + readonly modelProvider?: string | null; + readonly personality?: ClientRequest__Personality | null; + readonly sandbox?: ClientRequest__SandboxMode | null; + readonly serviceTier?: string | null; + readonly threadId: string; +}; +export const ClientRequest__ThreadResumeParams = Schema.Struct({ + approvalPolicy: Schema.optionalKey(Schema.Union([ClientRequest__AskForApproval, Schema.Null])), + approvalsReviewer: Schema.optionalKey( + Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ + description: + "Override where approval requests are routed for review on this thread and subsequent turns.", + }), + ), + baseInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + config: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), + Schema.Null, + ]), + ), + cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Configuration overrides for the resumed thread, if any.", + }), + Schema.Null, + ]), + ), + modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + personality: Schema.optionalKey(Schema.Union([ClientRequest__Personality, Schema.Null])), + sandbox: Schema.optionalKey(Schema.Union([ClientRequest__SandboxMode, Schema.Null])), + serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + threadId: Schema.String, +}).annotate({ + description: + "There are three ways to resume a thread: 1. By thread_id: load the thread from disk by thread_id and resume it. 2. By history: instantiate the thread from memory and resume it. 3. By path: load the thread from disk by path and resume it.\n\nFor non-running threads, the precedence is: history > non-empty path > thread_id. If using history or a non-empty path for a non-running thread, the thread_id param will be ignored.\n\nIf thread_id identifies a running thread, app-server rejoins that thread and treats a non-empty path as a consistency check against the active rollout path. Empty string path values are treated as absent.\n\nPrefer using thread_id whenever possible.", + identifier: "ClientRequest__ThreadResumeParams", }); -export type ClientRequest__PluginInstallParams = { - readonly marketplacePath?: ClientRequest__AbsolutePathBuf | null; - readonly pluginName: string; - readonly remoteMarketplaceName?: string | null; +export type ClientRequest__ThreadStartParams = { + readonly approvalPolicy?: ClientRequest__AskForApproval | null; + readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; + readonly baseInstructions?: string | null; + readonly config?: { readonly [x: string]: Schema.Json } | null; + readonly cwd?: string | null; + readonly developerInstructions?: string | null; + readonly ephemeral?: boolean | null; + readonly model?: string | null; + readonly modelProvider?: string | null; + readonly personality?: ClientRequest__Personality | null; + readonly sandbox?: ClientRequest__SandboxMode | null; + readonly serviceName?: string | null; + readonly serviceTier?: string | null; + readonly sessionStartSource?: ClientRequest__ThreadStartSource | null; + readonly threadSource?: ClientRequest__ThreadSource | null; }; -export const ClientRequest__PluginInstallParams = Schema.Struct({ - marketplacePath: Schema.optionalKey(Schema.Union([ClientRequest__AbsolutePathBuf, Schema.Null])), - pluginName: Schema.String, - remoteMarketplaceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +export const ClientRequest__ThreadStartParams = Schema.Struct({ + approvalPolicy: Schema.optionalKey(Schema.Union([ClientRequest__AskForApproval, Schema.Null])), + approvalsReviewer: Schema.optionalKey( + Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ + description: + "Override where approval requests are routed for review on this thread and subsequent turns.", + }), + ), + baseInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + config: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), + Schema.Null, + ]), + ), + cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + ephemeral: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + personality: Schema.optionalKey(Schema.Union([ClientRequest__Personality, Schema.Null])), + sandbox: Schema.optionalKey(Schema.Union([ClientRequest__SandboxMode, Schema.Null])), + serviceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + sessionStartSource: Schema.optionalKey( + Schema.Union([ClientRequest__ThreadStartSource, Schema.Null]), + ), + threadSource: Schema.optionalKey( + Schema.Union([ClientRequest__ThreadSource, Schema.Null]).annotate({ + description: "Optional client-supplied analytics source classification for this thread.", + }), + ), +}).annotate({ identifier: "ClientRequest__ThreadStartParams" }); + +export type ClientRequest__ThreadForkParams = { + readonly approvalPolicy?: ClientRequest__AskForApproval | null; + readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; + readonly baseInstructions?: string | null; + readonly config?: { readonly [x: string]: Schema.Json } | null; + readonly cwd?: string | null; + readonly developerInstructions?: string | null; + readonly ephemeral?: boolean; + readonly lastTurnId?: string | null; + readonly model?: string | null; + readonly modelProvider?: string | null; + readonly sandbox?: ClientRequest__SandboxMode | null; + readonly serviceTier?: string | null; + readonly threadId: string; + readonly threadSource?: ClientRequest__ThreadSource | null; +}; +export const ClientRequest__ThreadForkParams = Schema.Struct({ + approvalPolicy: Schema.optionalKey(Schema.Union([ClientRequest__AskForApproval, Schema.Null])), + approvalsReviewer: Schema.optionalKey( + Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ + description: + "Override where approval requests are routed for review on this thread and subsequent turns.", + }), + ), + baseInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + config: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), + Schema.Null, + ]), + ), + cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + ephemeral: Schema.optionalKey(Schema.Boolean), + lastTurnId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional last turn id to fork through, inclusive.\n\nWhen specified, turns after `last_turn_id` are omitted from the fork. The referenced turn cannot be in progress.", + }), + Schema.Null, + ]), + ), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Configuration overrides for the forked thread, if any.", + }), + Schema.Null, + ]), + ), + modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + sandbox: Schema.optionalKey(Schema.Union([ClientRequest__SandboxMode, Schema.Null])), + serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + threadId: Schema.String, + threadSource: Schema.optionalKey( + Schema.Union([ClientRequest__ThreadSource, Schema.Null]).annotate({ + description: + "Optional client-supplied analytics source classification for this forked thread.", + }), + ), +}).annotate({ + description: + "There are two ways to fork a thread: 1. By thread_id: load the thread from disk by thread_id and fork it into a new thread. 2. By path: load the thread from disk by path and fork it into a new thread.\n\nIf using a non-empty path, the thread_id param will be ignored. Empty string path values are treated as absent.\n\nPrefer using thread_id whenever possible.", + identifier: "ClientRequest__ThreadForkParams", }); +export type ClientRequest__ThreadGoalSetParams = { + readonly objective?: string | null; + readonly status?: ClientRequest__ThreadGoalStatus | null; + readonly threadId: string; + readonly tokenBudget?: number | null; +}; +export const ClientRequest__ThreadGoalSetParams = Schema.Struct({ + objective: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: Schema.optionalKey(Schema.Union([ClientRequest__ThreadGoalStatus, Schema.Null])), + threadId: Schema.String, + tokenBudget: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__ThreadGoalSetParams" }); + +export type ClientRequest__ThreadMetadataUpdateParams = { + readonly gitInfo?: ClientRequest__ThreadMetadataGitInfoUpdateParams | null; + readonly threadId: string; +}; +export const ClientRequest__ThreadMetadataUpdateParams = Schema.Struct({ + gitInfo: Schema.optionalKey( + Schema.Union([ClientRequest__ThreadMetadataGitInfoUpdateParams, Schema.Null]).annotate({ + description: + "Patch the stored Git metadata for this thread. Omit a field to leave it unchanged, set it to `null` to clear it, or provide a string to replace the stored value.", + }), + ), + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadMetadataUpdateParams" }); + +export type ClientRequest__ThreadListParams = { + readonly archived?: boolean | null; + readonly cursor?: string | null; + readonly cwd?: ClientRequest__ThreadListCwdFilter | null; + readonly limit?: number | null; + readonly modelProviders?: ReadonlyArray | null; + readonly searchTerm?: string | null; + readonly sortDirection?: ClientRequest__SortDirection | null; + readonly sortKey?: ClientRequest__ThreadSortKey | null; + readonly sourceKinds?: ReadonlyArray | null; + readonly useStateDbOnly?: boolean; +}; +export const ClientRequest__ThreadListParams = Schema.Struct({ + archived: Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ + description: + "Optional archived filter; when set to true, only archived threads are returned. If false or null, only non-archived threads are returned.", + }), + Schema.Null, + ]), + ), + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque pagination cursor returned by a previous call.", + }), + Schema.Null, + ]), + ), + cwd: Schema.optionalKey( + Schema.Union([ClientRequest__ThreadListCwdFilter, Schema.Null]).annotate({ + description: + "Optional cwd filter or filters; when set, only threads whose session cwd exactly matches one of these paths are returned.", + }), + ), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Optional page size; defaults to a reasonable server-side value.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + modelProviders: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: + "Optional provider filter; when set, only sessions recorded under these providers are returned. When present but empty, includes all providers.", + }), + Schema.Null, + ]), + ), + searchTerm: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional substring filter for the extracted thread title.", + }), + Schema.Null, + ]), + ), + sortDirection: Schema.optionalKey( + Schema.Union([ClientRequest__SortDirection, Schema.Null]).annotate({ + description: "Optional sort direction; defaults to descending (newest first).", + }), + ), + sortKey: Schema.optionalKey( + Schema.Union([ClientRequest__ThreadSortKey, Schema.Null]).annotate({ + description: "Optional sort key; defaults to created_at.", + }), + ), + sourceKinds: Schema.optionalKey( + Schema.Union([ + Schema.Array(ClientRequest__ThreadSourceKind).annotate({ + description: + "Optional source filter; when set, only sessions from these source kinds are returned. When omitted or empty, defaults to interactive sources.", + }), + Schema.Null, + ]), + ), + useStateDbOnly: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "If true, return from the state DB without scanning JSONL rollouts to repair thread metadata. Omitted or false preserves scan-and-repair behavior.", + }), + ), +}).annotate({ identifier: "ClientRequest__ThreadListParams" }); + +export type ClientRequest__SkillsExtraRootsSetParams = { + readonly extraRoots: ReadonlyArray; +}; +export const ClientRequest__SkillsExtraRootsSetParams = Schema.Struct({ + extraRoots: Schema.Array(ClientRequest__AbsolutePathBuf), +}).annotate({ identifier: "ClientRequest__SkillsExtraRootsSetParams" }); + export type ClientRequest__PluginInstalledParams = { readonly cwds?: ReadonlyArray | null; readonly installSuggestionPluginNames?: ReadonlyArray | null; @@ -11048,7 +13652,7 @@ export const ClientRequest__PluginInstalledParams = Schema.Struct({ Schema.Null, ]), ), -}); +}).annotate({ identifier: "ClientRequest__PluginInstalledParams" }); export type ClientRequest__PluginReadParams = { readonly marketplacePath?: ClientRequest__AbsolutePathBuf | null; @@ -11059,50 +13663,142 @@ export const ClientRequest__PluginReadParams = Schema.Struct({ marketplacePath: Schema.optionalKey(Schema.Union([ClientRequest__AbsolutePathBuf, Schema.Null])), pluginName: Schema.String, remoteMarketplaceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ClientRequest__PluginReadParams" }); + +export type ClientRequest__FsReadFileParams = { readonly path: ClientRequest__AbsolutePathBuf }; +export const ClientRequest__FsReadFileParams = Schema.Struct({ + path: Schema.suspend( + (): Schema.Codec => ClientRequest__AbsolutePathBuf, + ).annotate({ description: "Absolute path to read." }), +}).annotate({ + description: "Read a file from the host filesystem.", + identifier: "ClientRequest__FsReadFileParams", }); -export type ClientRequest__SandboxPolicy = - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } - | { - readonly excludeSlashTmp?: boolean; - readonly excludeTmpdirEnvVar?: boolean; - readonly networkAccess?: boolean; - readonly type: "workspaceWrite"; - readonly writableRoots?: ReadonlyArray; - }; -export const ClientRequest__SandboxPolicy = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("dangerFullAccess").annotate({ - title: "DangerFullAccessSandboxPolicyType", +export type ClientRequest__FsWriteFileParams = { + readonly dataBase64: string; + readonly path: ClientRequest__AbsolutePathBuf; +}; +export const ClientRequest__FsWriteFileParams = Schema.Struct({ + dataBase64: Schema.String.annotate({ description: "File contents encoded as base64." }), + path: Schema.suspend( + (): Schema.Codec => ClientRequest__AbsolutePathBuf, + ).annotate({ description: "Absolute path to write." }), +}).annotate({ + description: "Write a file on the host filesystem.", + identifier: "ClientRequest__FsWriteFileParams", +}); + +export type ClientRequest__FsCreateDirectoryParams = { + readonly path: ClientRequest__AbsolutePathBuf; + readonly recursive?: boolean | null; +}; +export const ClientRequest__FsCreateDirectoryParams = Schema.Struct({ + path: Schema.suspend( + (): Schema.Codec => ClientRequest__AbsolutePathBuf, + ).annotate({ description: "Absolute directory path to create." }), + recursive: Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ + description: "Whether parent directories should also be created. Defaults to `true`.", }), - }).annotate({ title: "DangerFullAccessSandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), - }).annotate({ title: "ReadOnlySandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), - ), - type: Schema.Literal("externalSandbox").annotate({ - title: "ExternalSandboxSandboxPolicyType", + Schema.Null, + ]), + ), +}).annotate({ + description: "Create a directory on the host filesystem.", + identifier: "ClientRequest__FsCreateDirectoryParams", +}); + +export type ClientRequest__FsGetMetadataParams = { readonly path: ClientRequest__AbsolutePathBuf }; +export const ClientRequest__FsGetMetadataParams = Schema.Struct({ + path: Schema.suspend( + (): Schema.Codec => ClientRequest__AbsolutePathBuf, + ).annotate({ description: "Absolute path to inspect." }), +}).annotate({ + description: "Request metadata for an absolute path.", + identifier: "ClientRequest__FsGetMetadataParams", +}); + +export type ClientRequest__FsReadDirectoryParams = { + readonly path: ClientRequest__AbsolutePathBuf; +}; +export const ClientRequest__FsReadDirectoryParams = Schema.Struct({ + path: Schema.suspend( + (): Schema.Codec => ClientRequest__AbsolutePathBuf, + ).annotate({ description: "Absolute directory path to read." }), +}).annotate({ + description: "List direct child names for a directory.", + identifier: "ClientRequest__FsReadDirectoryParams", +}); + +export type ClientRequest__FsRemoveParams = { + readonly force?: boolean | null; + readonly path: ClientRequest__AbsolutePathBuf; + readonly recursive?: boolean | null; +}; +export const ClientRequest__FsRemoveParams = Schema.Struct({ + force: Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ + description: "Whether missing paths should be ignored. Defaults to `true`.", }), - }).annotate({ title: "ExternalSandboxSandboxPolicy" }), - Schema.Struct({ - excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), - writableRoots: Schema.optionalKey( - Schema.Array(ClientRequest__AbsolutePathBuf).annotate({ default: [] }), - ), - }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), - ], - { mode: "oneOf" }, -); + Schema.Null, + ]), + ), + path: Schema.suspend( + (): Schema.Codec => ClientRequest__AbsolutePathBuf, + ).annotate({ description: "Absolute path to remove." }), + recursive: Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ + description: "Whether directory removal should recurse. Defaults to `true`.", + }), + Schema.Null, + ]), + ), +}).annotate({ + description: "Remove a file or directory tree from the host filesystem.", + identifier: "ClientRequest__FsRemoveParams", +}); + +export type ClientRequest__FsCopyParams = { + readonly destinationPath: ClientRequest__AbsolutePathBuf; + readonly recursive?: boolean; + readonly sourcePath: ClientRequest__AbsolutePathBuf; +}; +export const ClientRequest__FsCopyParams = Schema.Struct({ + destinationPath: Schema.suspend( + (): Schema.Codec => ClientRequest__AbsolutePathBuf, + ).annotate({ description: "Absolute destination path." }), + recursive: Schema.optionalKey( + Schema.Boolean.annotate({ + description: "Required for directory copies; ignored for file copies.", + }), + ), + sourcePath: Schema.suspend( + (): Schema.Codec => ClientRequest__AbsolutePathBuf, + ).annotate({ description: "Absolute source path." }), +}).annotate({ + description: "Copy a file or directory tree on the host filesystem.", + identifier: "ClientRequest__FsCopyParams", +}); + +export type ClientRequest__FsWatchParams = { + readonly path: ClientRequest__AbsolutePathBuf; + readonly watchId: string; +}; +export const ClientRequest__FsWatchParams = Schema.Struct({ + path: Schema.suspend( + (): Schema.Codec => ClientRequest__AbsolutePathBuf, + ).annotate({ description: "Absolute file or directory path to watch." }), + watchId: Schema.String.annotate({ + description: "Connection-scoped watch identifier used for `fs/unwatch` and `fs/changed`.", + }), +}).annotate({ + description: "Start filesystem watch notifications for an absolute path.", + identifier: "ClientRequest__FsWatchParams", +}); export type ClientRequest__SkillsConfigWriteParams = { readonly enabled: boolean; @@ -11119,53 +13815,86 @@ export const ClientRequest__SkillsConfigWriteParams = Schema.Struct({ description: "Path-based selector.", }), ), -}); +}).annotate({ identifier: "ClientRequest__SkillsConfigWriteParams" }); -export type ClientRequest__SkillsExtraRootsSetParams = { - readonly extraRoots: ReadonlyArray; +export type ClientRequest__PluginInstallParams = { + readonly marketplacePath?: ClientRequest__AbsolutePathBuf | null; + readonly pluginName: string; + readonly remoteMarketplaceName?: string | null; }; -export const ClientRequest__SkillsExtraRootsSetParams = Schema.Struct({ - extraRoots: Schema.Array(ClientRequest__AbsolutePathBuf), -}); +export const ClientRequest__PluginInstallParams = Schema.Struct({ + marketplacePath: Schema.optionalKey(Schema.Union([ClientRequest__AbsolutePathBuf, Schema.Null])), + pluginName: Schema.String, + remoteMarketplaceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ClientRequest__PluginInstallParams" }); -export type ClientRequest__SendAddCreditsNudgeEmailParams = { - readonly creditType: ClientRequest__AddCreditsNudgeCreditType; +export type ClientRequest__PluginListParams = { + readonly cwds?: ReadonlyArray | null; + readonly marketplaceKinds?: ReadonlyArray | null; }; -export const ClientRequest__SendAddCreditsNudgeEmailParams = Schema.Struct({ - creditType: ClientRequest__AddCreditsNudgeCreditType, +export const ClientRequest__PluginListParams = Schema.Struct({ + cwds: Schema.optionalKey( + Schema.Union([ + Schema.Array(ClientRequest__AbsolutePathBuf).annotate({ + description: + "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered.", + }), + Schema.Null, + ]), + ), + marketplaceKinds: Schema.optionalKey( + Schema.Union([ + Schema.Array(ClientRequest__PluginListMarketplaceKind).annotate({ + description: + "Optional marketplace kind filter. When omitted, only local marketplaces are queried, plus the default remote catalog when enabled by feature flag.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__PluginListParams" }); + +export type ClientRequest__PluginShareTarget = { + readonly principalId: string; + readonly principalType: ClientRequest__PluginSharePrincipalType; + readonly role: ClientRequest__PluginShareTargetRole; +}; +export const ClientRequest__PluginShareTarget = Schema.Struct({ + principalId: Schema.String, + principalType: ClientRequest__PluginSharePrincipalType, + role: ClientRequest__PluginShareTargetRole, +}).annotate({ identifier: "ClientRequest__PluginShareTarget" }); + +export type ClientRequest__Settings = { + readonly developer_instructions?: string | null; + readonly model: string; + readonly reasoning_effort?: ClientRequest__ReasoningEffort | null; +}; +export const ClientRequest__Settings = Schema.Struct({ + developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.String, + reasoning_effort: Schema.optionalKey(Schema.Union([ClientRequest__ReasoningEffort, Schema.Null])), +}).annotate({ + description: "Settings for a collaboration mode.", + identifier: "ClientRequest__Settings", }); -export type ClientRequest__ContentItem = - | { readonly text: string; readonly type: "input_text" } - | { - readonly detail?: ClientRequest__ImageDetail | null; - readonly image_url: string; - readonly type: "input_image"; - } - | { readonly audio_url: string; readonly type: "input_audio" } - | { readonly text: string; readonly type: "output_text" }; -export const ClientRequest__ContentItem = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("input_text").annotate({ title: "InputTextContentItemType" }), - }).annotate({ title: "InputTextContentItem" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), - image_url: Schema.String, - type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), - }).annotate({ title: "InputImageContentItem" }), - Schema.Struct({ - audio_url: Schema.String, - type: Schema.Literal("input_audio").annotate({ title: "InputAudioContentItemType" }), - }).annotate({ title: "InputAudioContentItem" }), - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("output_text").annotate({ title: "OutputTextContentItemType" }), - }).annotate({ title: "OutputTextContentItem" }), - ], - { mode: "oneOf" }, -); +export type ClientRequest__TextElement = { + readonly byteRange: ClientRequest__ByteRange; + readonly placeholder?: string | null; +}; +export const ClientRequest__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => ClientRequest__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__TextElement" }); export type ClientRequest__FunctionCallOutputContentItem = | { readonly text: string; readonly type: "input_text" } @@ -11208,18 +13937,149 @@ export const ClientRequest__FunctionCallOutputContentItem = Schema.Union( ).annotate({ description: "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "ClientRequest__FunctionCallOutputContentItem", }); -export type ClientRequest__InitializeParams = { - readonly capabilities?: ClientRequest__InitializeCapabilities | null; - readonly clientInfo: ClientRequest__ClientInfo; +export type ClientRequest__ContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: ClientRequest__ImageDetail | null; + readonly image_url: string; + readonly type: "input_image"; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly text: string; readonly type: "output_text" }; +export const ClientRequest__ContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ title: "InputTextContentItemType" }), + }).annotate({ title: "InputTextContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), + image_url: Schema.String, + type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), + }).annotate({ title: "InputImageContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ title: "InputAudioContentItemType" }), + }).annotate({ title: "InputAudioContentItem" }), + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("output_text").annotate({ title: "OutputTextContentItemType" }), + }).annotate({ title: "OutputTextContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ClientRequest__ContentItem" }); + +export type ClientRequest__SandboxPolicy = + | { readonly type: "dangerFullAccess" } + | { readonly networkAccess?: boolean; readonly type: "readOnly" } + | { readonly networkAccess?: ClientRequest__NetworkAccess; readonly type: "externalSandbox" } + | { + readonly excludeSlashTmp?: boolean; + readonly excludeTmpdirEnvVar?: boolean; + readonly networkAccess?: boolean; + readonly type: "workspaceWrite"; + readonly writableRoots?: ReadonlyArray; + }; +export const ClientRequest__SandboxPolicy = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("dangerFullAccess").annotate({ + title: "DangerFullAccessSandboxPolicyType", + }), + }).annotate({ title: "DangerFullAccessSandboxPolicy" }), + Schema.Struct({ + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), + }).annotate({ title: "ReadOnlySandboxPolicy" }), + Schema.Struct({ + networkAccess: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => ClientRequest__NetworkAccess, + ).annotate({ default: "restricted" }), + ), + type: Schema.Literal("externalSandbox").annotate({ + title: "ExternalSandboxSandboxPolicyType", + }), + }).annotate({ title: "ExternalSandboxSandboxPolicy" }), + Schema.Struct({ + excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), + writableRoots: Schema.optionalKey( + Schema.Array(ClientRequest__AbsolutePathBuf).annotate({ default: [] }), + ), + }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ClientRequest__SandboxPolicy" }); + +export type ClientRequest__ReviewStartParams = { + readonly delivery?: ClientRequest__ReviewDelivery | null; + readonly target: ClientRequest__ReviewTarget; + readonly threadId: string; }; -export const ClientRequest__InitializeParams = Schema.Struct({ - capabilities: Schema.optionalKey( - Schema.Union([ClientRequest__InitializeCapabilities, Schema.Null]), +export const ClientRequest__ReviewStartParams = Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([ClientRequest__ReviewDelivery, Schema.Null]).annotate({ + description: + "Where to run the review: inline (default) on the current thread or detached on a new thread (returned in `reviewThreadId`).", + }), ), - clientInfo: ClientRequest__ClientInfo, -}); + target: ClientRequest__ReviewTarget, + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ReviewStartParams" }); + +export type ClientRequest__ListMcpServerStatusParams = { + readonly cursor?: string | null; + readonly detail?: ClientRequest__McpServerStatusDetail | null; + readonly limit?: number | null; + readonly threadId?: string | null; +}; +export const ClientRequest__ListMcpServerStatusParams = Schema.Struct({ + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque pagination cursor returned by a previous call.", + }), + Schema.Null, + ]), + ), + detail: Schema.optionalKey( + Schema.Union([ClientRequest__McpServerStatusDetail, Schema.Null]).annotate({ + description: + "Controls how much MCP inventory data to fetch for each server. Defaults to `Full` when omitted.", + }), + ), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Optional page size; defaults to a server-defined value.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ClientRequest__ListMcpServerStatusParams" }); + +export type ClientRequest__WindowsSandboxSetupStartParams = { + readonly cwd?: ClientRequest__AbsolutePathBuf | null; + readonly mode: ClientRequest__WindowsSandboxSetupMode; +}; +export const ClientRequest__WindowsSandboxSetupStartParams = Schema.Struct({ + cwd: Schema.optionalKey(Schema.Union([ClientRequest__AbsolutePathBuf, Schema.Null])), + mode: ClientRequest__WindowsSandboxSetupMode, +}).annotate({ identifier: "ClientRequest__WindowsSandboxSetupStartParams" }); export type ClientRequest__LoginAccountParams = | { readonly apiKey: string; readonly type: "apiKey" } @@ -11291,60 +14151,70 @@ export const ClientRequest__LoginAccountParams = Schema.Union( }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ClientRequest__LoginAccountParams" }); -export type ClientRequest__ListMcpServerStatusParams = { - readonly cursor?: string | null; - readonly detail?: ClientRequest__McpServerStatusDetail | null; - readonly limit?: number | null; - readonly threadId?: string | null; +export type ClientRequest__SendAddCreditsNudgeEmailParams = { + readonly creditType: ClientRequest__AddCreditsNudgeCreditType; }; -export const ClientRequest__ListMcpServerStatusParams = Schema.Struct({ - cursor: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Opaque pagination cursor returned by a previous call.", - }), - Schema.Null, - ]), - ), - detail: Schema.optionalKey( - Schema.Union([ClientRequest__McpServerStatusDetail, Schema.Null]).annotate({ - description: - "Controls how much MCP inventory data to fetch for each server. Defaults to `Full` when omitted.", - }), - ), - limit: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Optional page size; defaults to a server-defined value.", - format: "uint32", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +export const ClientRequest__SendAddCreditsNudgeEmailParams = Schema.Struct({ + creditType: ClientRequest__AddCreditsNudgeCreditType, +}).annotate({ identifier: "ClientRequest__SendAddCreditsNudgeEmailParams" }); -export type ClientRequest__ConfigEdit = { - readonly keyPath: string; - readonly mergeStrategy: ClientRequest__MergeStrategy; - readonly value: unknown; +export type ClientRequest__CommandExecResizeParams = { + readonly processId: string; + readonly size: ClientRequest__CommandExecTerminalSize; }; -export const ClientRequest__ConfigEdit = Schema.Struct({ - keyPath: Schema.String, - mergeStrategy: ClientRequest__MergeStrategy, - value: Schema.Unknown, +export const ClientRequest__CommandExecResizeParams = Schema.Struct({ + processId: Schema.String.annotate({ + description: + "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", + }), + size: Schema.suspend( + (): Schema.Codec => + ClientRequest__CommandExecTerminalSize, + ).annotate({ description: "New PTY size in character cells." }), +}).annotate({ + description: "Resize a running PTY-backed `command/exec` session.", + identifier: "ClientRequest__CommandExecResizeParams", }); +export type ClientRequest__MigrationDetails = { + readonly commands?: ReadonlyArray; + readonly hooks?: ReadonlyArray; + readonly mcpServers?: ReadonlyArray; + readonly memory?: ReadonlyArray; + readonly plugins?: ReadonlyArray; + readonly sessions?: ReadonlyArray; + readonly skills?: ReadonlyArray; + readonly subagents?: ReadonlyArray; +}; +export const ClientRequest__MigrationDetails = Schema.Struct({ + commands: Schema.optionalKey( + Schema.Array(ClientRequest__CommandMigration).annotate({ default: [] }), + ), + hooks: Schema.optionalKey(Schema.Array(ClientRequest__HookMigration).annotate({ default: [] })), + mcpServers: Schema.optionalKey( + Schema.Array(ClientRequest__McpServerMigration).annotate({ default: [] }), + ), + memory: Schema.optionalKey(Schema.Array(Schema.String)), + plugins: Schema.optionalKey( + Schema.Array(ClientRequest__PluginsMigration).annotate({ default: [] }), + ), + sessions: Schema.optionalKey( + Schema.Array(ClientRequest__SessionMigration).annotate({ default: [] }), + ), + skills: Schema.optionalKey(Schema.Array(ClientRequest__SkillMigration).annotate({ default: [] })), + subagents: Schema.optionalKey( + Schema.Array(ClientRequest__SubagentMigration).annotate({ default: [] }), + ), +}).annotate({ identifier: "ClientRequest__MigrationDetails" }); + export type ClientRequest__ConfigValueWriteParams = { readonly expectedVersion?: string | null; readonly filePath?: string | null; readonly keyPath: string; readonly mergeStrategy: ClientRequest__MergeStrategy; - readonly value: unknown; + readonly value: Schema.Json; }; export const ClientRequest__ConfigValueWriteParams = Schema.Struct({ expectedVersion: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -11359,494 +14229,61 @@ export const ClientRequest__ConfigValueWriteParams = Schema.Struct({ ), keyPath: Schema.String, mergeStrategy: ClientRequest__MergeStrategy, - value: Schema.Unknown, -}); + value: Schema.Json.annotate({ expected: "JSON value" }), +}).annotate({ identifier: "ClientRequest__ConfigValueWriteParams" }); -export type ClientRequest__PluginListParams = { - readonly cwds?: ReadonlyArray | null; - readonly marketplaceKinds?: ReadonlyArray | null; +export type ClientRequest__ConfigEdit = { + readonly keyPath: string; + readonly mergeStrategy: ClientRequest__MergeStrategy; + readonly value: Schema.Json; }; -export const ClientRequest__PluginListParams = Schema.Struct({ - cwds: Schema.optionalKey( - Schema.Union([ - Schema.Array(ClientRequest__AbsolutePathBuf).annotate({ - description: - "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered.", - }), - Schema.Null, - ]), - ), - marketplaceKinds: Schema.optionalKey( - Schema.Union([ - Schema.Array(ClientRequest__PluginListMarketplaceKind).annotate({ - description: - "Optional marketplace kind filter. When omitted, only local marketplaces are queried, plus the default remote catalog when enabled by feature flag.", - }), - Schema.Null, - ]), - ), -}); +export const ClientRequest__ConfigEdit = Schema.Struct({ + keyPath: Schema.String, + mergeStrategy: ClientRequest__MergeStrategy, + value: Schema.Json.annotate({ expected: "JSON value" }), +}).annotate({ identifier: "ClientRequest__ConfigEdit" }); -export type ClientRequest__PluginShareTarget = { - readonly principalId: string; - readonly principalType: ClientRequest__PluginSharePrincipalType; - readonly role: ClientRequest__PluginShareTargetRole; -}; -export const ClientRequest__PluginShareTarget = Schema.Struct({ - principalId: Schema.String, - principalType: ClientRequest__PluginSharePrincipalType, - role: ClientRequest__PluginShareTargetRole, -}); - -export type ClientRequest__Settings = { - readonly developer_instructions?: string | null; - readonly model: string; - readonly reasoning_effort?: ClientRequest__ReasoningEffort | null; -}; -export const ClientRequest__Settings = Schema.Struct({ - developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.String, - reasoning_effort: Schema.optionalKey(Schema.Union([ClientRequest__ReasoningEffort, Schema.Null])), -}).annotate({ description: "Settings for a collaboration mode." }); - -export type ClientRequest__ReviewStartParams = { - readonly delivery?: ClientRequest__ReviewDelivery | null; - readonly target: ClientRequest__ReviewTarget; - readonly threadId: string; -}; -export const ClientRequest__ReviewStartParams = Schema.Struct({ - delivery: Schema.optionalKey( - Schema.Union([ClientRequest__ReviewDelivery, Schema.Null]).annotate({ - description: - "Where to run the review: inline (default) on the current thread or detached on a new thread (returned in `reviewThreadId`).", - }), - ), - target: ClientRequest__ReviewTarget, - threadId: Schema.String, -}); - -export type ClientRequest__ThreadResumeParams = { - readonly approvalPolicy?: ClientRequest__AskForApproval | null; - readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; - readonly baseInstructions?: string | null; - readonly config?: { readonly [x: string]: unknown } | null; - readonly cwd?: string | null; - readonly developerInstructions?: string | null; - readonly model?: string | null; - readonly modelProvider?: string | null; - readonly personality?: ClientRequest__Personality | null; - readonly sandbox?: ClientRequest__SandboxMode | null; - readonly serviceTier?: string | null; - readonly threadId: string; -}; -export const ClientRequest__ThreadResumeParams = Schema.Struct({ - approvalPolicy: Schema.optionalKey(Schema.Union([ClientRequest__AskForApproval, Schema.Null])), - approvalsReviewer: Schema.optionalKey( - Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ - description: - "Override where approval requests are routed for review on this thread and subsequent turns.", - }), - ), - baseInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - config: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null]), - ), - cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Configuration overrides for the resumed thread, if any.", - }), - Schema.Null, - ]), - ), - modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - personality: Schema.optionalKey(Schema.Union([ClientRequest__Personality, Schema.Null])), - sandbox: Schema.optionalKey(Schema.Union([ClientRequest__SandboxMode, Schema.Null])), - serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - threadId: Schema.String, -}).annotate({ - description: - "There are three ways to resume a thread: 1. By thread_id: load the thread from disk by thread_id and resume it. 2. By history: instantiate the thread from memory and resume it. 3. By path: load the thread from disk by path and resume it.\n\nFor non-running threads, the precedence is: history > non-empty path > thread_id. If using history or a non-empty path for a non-running thread, the thread_id param will be ignored.\n\nIf thread_id identifies a running thread, app-server rejoins that thread and treats a non-empty path as a consistency check against the active rollout path. Empty string path values are treated as absent.\n\nPrefer using thread_id whenever possible.", -}); - -export type ClientRequest__MigrationDetails = { - readonly commands?: ReadonlyArray; - readonly hooks?: ReadonlyArray; - readonly mcpServers?: ReadonlyArray; - readonly memory?: ReadonlyArray; - readonly plugins?: ReadonlyArray; - readonly sessions?: ReadonlyArray; - readonly skills?: ReadonlyArray; - readonly subagents?: ReadonlyArray; -}; -export const ClientRequest__MigrationDetails = Schema.Struct({ - commands: Schema.optionalKey( - Schema.Array(ClientRequest__CommandMigration).annotate({ default: [] }), - ), - hooks: Schema.optionalKey(Schema.Array(ClientRequest__HookMigration).annotate({ default: [] })), - mcpServers: Schema.optionalKey( - Schema.Array(ClientRequest__McpServerMigration).annotate({ default: [] }), - ), - memory: Schema.optionalKey(Schema.Array(Schema.String)), - plugins: Schema.optionalKey( - Schema.Array(ClientRequest__PluginsMigration).annotate({ default: [] }), - ), - sessions: Schema.optionalKey( - Schema.Array(ClientRequest__SessionMigration).annotate({ default: [] }), - ), - skills: Schema.optionalKey(Schema.Array(ClientRequest__SkillMigration).annotate({ default: [] })), - subagents: Schema.optionalKey( - Schema.Array(ClientRequest__SubagentMigration).annotate({ default: [] }), - ), -}); - -export type ClientRequest__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: ClientRequest__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: ClientRequest__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const ClientRequest__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(ClientRequest__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); - -export type ClientRequest__ThreadGoalSetParams = { - readonly objective?: string | null; - readonly status?: ClientRequest__ThreadGoalStatus | null; - readonly threadId: string; - readonly tokenBudget?: number | null; -}; -export const ClientRequest__ThreadGoalSetParams = Schema.Struct({ - objective: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: Schema.optionalKey(Schema.Union([ClientRequest__ThreadGoalStatus, Schema.Null])), - threadId: Schema.String, - tokenBudget: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), -}); - -export type ClientRequest__ThreadMetadataUpdateParams = { - readonly gitInfo?: ClientRequest__ThreadMetadataGitInfoUpdateParams | null; - readonly threadId: string; -}; -export const ClientRequest__ThreadMetadataUpdateParams = Schema.Struct({ - gitInfo: Schema.optionalKey( - Schema.Union([ClientRequest__ThreadMetadataGitInfoUpdateParams, Schema.Null]).annotate({ - description: - "Patch the stored Git metadata for this thread. Omit a field to leave it unchanged, set it to `null` to clear it, or provide a string to replace the stored value.", - }), - ), - threadId: Schema.String, -}); - -export type ClientRequest__ThreadForkParams = { - readonly approvalPolicy?: ClientRequest__AskForApproval | null; - readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; - readonly baseInstructions?: string | null; - readonly config?: { readonly [x: string]: unknown } | null; - readonly cwd?: string | null; - readonly developerInstructions?: string | null; - readonly ephemeral?: boolean; - readonly lastTurnId?: string | null; - readonly model?: string | null; - readonly modelProvider?: string | null; - readonly sandbox?: ClientRequest__SandboxMode | null; - readonly serviceTier?: string | null; - readonly threadId: string; - readonly threadSource?: ClientRequest__ThreadSource | null; -}; -export const ClientRequest__ThreadForkParams = Schema.Struct({ - approvalPolicy: Schema.optionalKey(Schema.Union([ClientRequest__AskForApproval, Schema.Null])), - approvalsReviewer: Schema.optionalKey( - Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ - description: - "Override where approval requests are routed for review on this thread and subsequent turns.", - }), - ), - baseInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - config: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null]), - ), - cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - ephemeral: Schema.optionalKey(Schema.Boolean), - lastTurnId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Optional last turn id to fork through, inclusive.\n\nWhen specified, turns after `last_turn_id` are omitted from the fork. The referenced turn cannot be in progress.", - }), - Schema.Null, - ]), - ), - model: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Configuration overrides for the forked thread, if any.", - }), - Schema.Null, - ]), - ), - modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - sandbox: Schema.optionalKey(Schema.Union([ClientRequest__SandboxMode, Schema.Null])), - serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - threadId: Schema.String, - threadSource: Schema.optionalKey( - Schema.Union([ClientRequest__ThreadSource, Schema.Null]).annotate({ - description: - "Optional client-supplied analytics source classification for this forked thread.", - }), - ), -}).annotate({ - description: - "There are two ways to fork a thread: 1. By thread_id: load the thread from disk by thread_id and fork it into a new thread. 2. By path: load the thread from disk by path and fork it into a new thread.\n\nIf using a non-empty path, the thread_id param will be ignored. Empty string path values are treated as absent.\n\nPrefer using thread_id whenever possible.", -}); - -export type ClientRequest__ThreadListParams = { - readonly archived?: boolean | null; - readonly cursor?: string | null; - readonly cwd?: ClientRequest__ThreadListCwdFilter | null; - readonly limit?: number | null; - readonly modelProviders?: ReadonlyArray | null; - readonly searchTerm?: string | null; - readonly sortDirection?: ClientRequest__SortDirection | null; - readonly sortKey?: ClientRequest__ThreadSortKey | null; - readonly sourceKinds?: ReadonlyArray | null; - readonly useStateDbOnly?: boolean; -}; -export const ClientRequest__ThreadListParams = Schema.Struct({ - archived: Schema.optionalKey( - Schema.Union([ - Schema.Boolean.annotate({ - description: - "Optional archived filter; when set to true, only archived threads are returned. If false or null, only non-archived threads are returned.", - }), - Schema.Null, - ]), - ), - cursor: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Opaque pagination cursor returned by a previous call.", - }), - Schema.Null, - ]), - ), - cwd: Schema.optionalKey( - Schema.Union([ClientRequest__ThreadListCwdFilter, Schema.Null]).annotate({ - description: - "Optional cwd filter or filters; when set, only threads whose session cwd exactly matches one of these paths are returned.", - }), - ), - limit: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Optional page size; defaults to a reasonable server-side value.", - format: "uint32", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - modelProviders: Schema.optionalKey( - Schema.Union([ - Schema.Array(Schema.String).annotate({ - description: - "Optional provider filter; when set, only sessions recorded under these providers are returned. When present but empty, includes all providers.", - }), - Schema.Null, - ]), - ), - searchTerm: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional substring filter for the extracted thread title.", - }), - Schema.Null, - ]), - ), - sortDirection: Schema.optionalKey( - Schema.Union([ClientRequest__SortDirection, Schema.Null]).annotate({ - description: "Optional sort direction; defaults to descending (newest first).", - }), - ), - sortKey: Schema.optionalKey( - Schema.Union([ClientRequest__ThreadSortKey, Schema.Null]).annotate({ - description: "Optional sort key; defaults to created_at.", - }), - ), - sourceKinds: Schema.optionalKey( - Schema.Union([ - Schema.Array(ClientRequest__ThreadSourceKind).annotate({ - description: - "Optional source filter; when set, only sessions from these source kinds are returned. When omitted or empty, defaults to interactive sources.", - }), - Schema.Null, - ]), - ), - useStateDbOnly: Schema.optionalKey( - Schema.Boolean.annotate({ - description: - "If true, return from the state DB without scanning JSONL rollouts to repair thread metadata. Omitted or false preserves scan-and-repair behavior.", - }), - ), -}); - -export type ClientRequest__ThreadStartParams = { - readonly approvalPolicy?: ClientRequest__AskForApproval | null; - readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; - readonly baseInstructions?: string | null; - readonly config?: { readonly [x: string]: unknown } | null; - readonly cwd?: string | null; - readonly developerInstructions?: string | null; - readonly ephemeral?: boolean | null; - readonly model?: string | null; - readonly modelProvider?: string | null; - readonly personality?: ClientRequest__Personality | null; - readonly sandbox?: ClientRequest__SandboxMode | null; - readonly serviceName?: string | null; - readonly serviceTier?: string | null; - readonly sessionStartSource?: ClientRequest__ThreadStartSource | null; - readonly threadSource?: ClientRequest__ThreadSource | null; -}; -export const ClientRequest__ThreadStartParams = Schema.Struct({ - approvalPolicy: Schema.optionalKey(Schema.Union([ClientRequest__AskForApproval, Schema.Null])), - approvalsReviewer: Schema.optionalKey( - Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ - description: - "Override where approval requests are routed for review on this thread and subsequent turns.", - }), - ), - baseInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - config: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null]), - ), - cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - ephemeral: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - personality: Schema.optionalKey(Schema.Union([ClientRequest__Personality, Schema.Null])), - sandbox: Schema.optionalKey(Schema.Union([ClientRequest__SandboxMode, Schema.Null])), - serviceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - sessionStartSource: Schema.optionalKey( - Schema.Union([ClientRequest__ThreadStartSource, Schema.Null]), - ), - threadSource: Schema.optionalKey( - Schema.Union([ClientRequest__ThreadSource, Schema.Null]).annotate({ - description: "Optional client-supplied analytics source classification for this thread.", - }), - ), -}); - -export type ClientRequest__WindowsSandboxSetupStartParams = { - readonly cwd?: ClientRequest__AbsolutePathBuf | null; - readonly mode: ClientRequest__WindowsSandboxSetupMode; -}; -export const ClientRequest__WindowsSandboxSetupStartParams = Schema.Struct({ - cwd: Schema.optionalKey(Schema.Union([ClientRequest__AbsolutePathBuf, Schema.Null])), - mode: ClientRequest__WindowsSandboxSetupMode, -}); - -export type CommandExecutionRequestApprovalParams__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: CommandExecutionRequestApprovalParams__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } - | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const CommandExecutionRequestApprovalParams__CommandAction = Schema.Union( - [ - Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: CommandExecutionRequestApprovalParams__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), - Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), - ], - { mode: "oneOf" }, -); +export type CommandExecutionRequestApprovalParams__CommandAction = + | { + readonly command: string; + readonly name: string; + readonly path: CommandExecutionRequestApprovalParams__AbsolutePathBuf; + readonly type: "read"; + } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } + | { + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly command: string; readonly type: "unknown" }; +export const CommandExecutionRequestApprovalParams__CommandAction = Schema.Union( + [ + Schema.Struct({ + command: Schema.String, + name: Schema.String, + path: CommandExecutionRequestApprovalParams__AbsolutePathBuf, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), + Schema.Struct({ + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "CommandExecutionRequestApprovalParams__CommandAction" }); export type CommandExecutionRequestApprovalParams__FileSystemSpecialPath = | { readonly kind: "root" } @@ -11891,7 +14328,7 @@ export const CommandExecutionRequestApprovalParams__FileSystemSpecialPath = Sche }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "CommandExecutionRequestApprovalParams__FileSystemSpecialPath" }); export type CommandExecutionRequestApprovalParams__NetworkApprovalContext = { readonly host: string; @@ -11900,7 +14337,7 @@ export type CommandExecutionRequestApprovalParams__NetworkApprovalContext = { export const CommandExecutionRequestApprovalParams__NetworkApprovalContext = Schema.Struct({ host: Schema.String, protocol: CommandExecutionRequestApprovalParams__NetworkApprovalProtocol, -}); +}).annotate({ identifier: "CommandExecutionRequestApprovalParams__NetworkApprovalContext" }); export type CommandExecutionRequestApprovalParams__NetworkPolicyAmendment = { readonly action: CommandExecutionRequestApprovalParams__NetworkPolicyRuleAction; @@ -11909,7 +14346,7 @@ export type CommandExecutionRequestApprovalParams__NetworkPolicyAmendment = { export const CommandExecutionRequestApprovalParams__NetworkPolicyAmendment = Schema.Struct({ action: CommandExecutionRequestApprovalParams__NetworkPolicyRuleAction, host: Schema.String, -}); +}).annotate({ identifier: "CommandExecutionRequestApprovalParams__NetworkPolicyAmendment" }); export type CommandExecutionRequestApprovalResponse__NetworkPolicyAmendment = { readonly action: CommandExecutionRequestApprovalResponse__NetworkPolicyRuleAction; @@ -11918,7 +14355,7 @@ export type CommandExecutionRequestApprovalResponse__NetworkPolicyAmendment = { export const CommandExecutionRequestApprovalResponse__NetworkPolicyAmendment = Schema.Struct({ action: CommandExecutionRequestApprovalResponse__NetworkPolicyRuleAction, host: Schema.String, -}); +}).annotate({ identifier: "CommandExecutionRequestApprovalResponse__NetworkPolicyAmendment" }); export type ExecCommandApprovalResponse__NetworkPolicyAmendment = { readonly action: ExecCommandApprovalResponse__NetworkPolicyRuleAction; @@ -11927,7 +14364,7 @@ export type ExecCommandApprovalResponse__NetworkPolicyAmendment = { export const ExecCommandApprovalResponse__NetworkPolicyAmendment = Schema.Struct({ action: ExecCommandApprovalResponse__NetworkPolicyRuleAction, host: Schema.String, -}); +}).annotate({ identifier: "ExecCommandApprovalResponse__NetworkPolicyAmendment" }); export type FuzzyFileSearchResponse__FuzzyFileSearchResult = { readonly file_name: string; @@ -11943,8 +14380,12 @@ export const FuzzyFileSearchResponse__FuzzyFileSearchResult = Schema.Struct({ Schema.Union([ Schema.Array( Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), ), Schema.Null, ]), @@ -11953,9 +14394,14 @@ export const FuzzyFileSearchResponse__FuzzyFileSearchResult = Schema.Struct({ path: Schema.String, root: Schema.String, score: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}).annotate({ description: "Superset of [`codex_file_search::FileMatch`]" }); + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ + description: "Superset of [`codex_file_search::FileMatch`]", + identifier: "FuzzyFileSearchResponse__FuzzyFileSearchResult", +}); export type FuzzyFileSearchSessionUpdatedNotification__FuzzyFileSearchResult = { readonly file_name: string; @@ -11971,8 +14417,12 @@ export const FuzzyFileSearchSessionUpdatedNotification__FuzzyFileSearchResult = Schema.Union([ Schema.Array( Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), ), Schema.Null, ]), @@ -11981,96 +14431,85 @@ export const FuzzyFileSearchSessionUpdatedNotification__FuzzyFileSearchResult = path: Schema.String, root: Schema.String, score: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}).annotate({ description: "Superset of [`codex_file_search::FileMatch`]" }); - -export type JSONRPCMessage__JSONRPCError = { - readonly error: JSONRPCMessage__JSONRPCErrorError; - readonly id: JSONRPCMessage__RequestId; -}; -export const JSONRPCMessage__JSONRPCError = Schema.Struct({ - error: JSONRPCMessage__JSONRPCErrorError, - id: JSONRPCMessage__RequestId, -}).annotate({ description: "A response to a request that indicates an error occurred." }); + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ + description: "Superset of [`codex_file_search::FileMatch`]", + identifier: "FuzzyFileSearchSessionUpdatedNotification__FuzzyFileSearchResult", +}); export type JSONRPCMessage__JSONRPCResponse = { readonly id: JSONRPCMessage__RequestId; - readonly result: unknown; + readonly result: Schema.Json; }; export const JSONRPCMessage__JSONRPCResponse = Schema.Struct({ id: JSONRPCMessage__RequestId, - result: Schema.Unknown, -}).annotate({ description: "A successful (non-error) response to a request." }); + result: Schema.Json.annotate({ expected: "JSON value" }), +}).annotate({ + description: "A successful (non-error) response to a request.", + identifier: "JSONRPCMessage__JSONRPCResponse", +}); export type JSONRPCMessage__JSONRPCRequest = { readonly id: JSONRPCMessage__RequestId; readonly method: string; - readonly params?: unknown; + readonly params?: Schema.Json; readonly trace?: JSONRPCMessage__W3cTraceContext | null; }; export const JSONRPCMessage__JSONRPCRequest = Schema.Struct({ id: JSONRPCMessage__RequestId, method: Schema.String, - params: Schema.optionalKey(Schema.Unknown), + params: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), trace: Schema.optionalKey( Schema.Union([JSONRPCMessage__W3cTraceContext, Schema.Null]).annotate({ description: "Optional W3C Trace Context for distributed tracing.", }), ), -}).annotate({ description: "A request that expects a response." }); - -export type McpServerElicitationRequestParams__McpElicitationBooleanSchema = { - readonly default?: boolean | null; - readonly description?: string | null; - readonly title?: string | null; - readonly type: McpServerElicitationRequestParams__McpElicitationBooleanType; -}; -export const McpServerElicitationRequestParams__McpElicitationBooleanSchema = Schema.Struct({ - default: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: McpServerElicitationRequestParams__McpElicitationBooleanType, +}).annotate({ + description: "A request that expects a response.", + identifier: "JSONRPCMessage__JSONRPCRequest", }); -export type McpServerElicitationRequestParams__McpElicitationTitledEnumItems = { - readonly anyOf: ReadonlyArray; +export type JSONRPCMessage__JSONRPCError = { + readonly error: JSONRPCMessage__JSONRPCErrorError; + readonly id: JSONRPCMessage__RequestId; }; -export const McpServerElicitationRequestParams__McpElicitationTitledEnumItems = Schema.Struct({ - anyOf: Schema.Array(McpServerElicitationRequestParams__McpElicitationConstOption), +export const JSONRPCMessage__JSONRPCError = Schema.Struct({ + error: JSONRPCMessage__JSONRPCErrorError, + id: JSONRPCMessage__RequestId, +}).annotate({ + description: "A response to a request that indicates an error occurred.", + identifier: "JSONRPCMessage__JSONRPCError", }); -export type McpServerElicitationRequestParams__McpElicitationNumberSchema = { - readonly default?: number | null; +export type McpServerElicitationRequestParams__McpElicitationUntitledSingleSelectEnumSchema = { + readonly default?: string | null; readonly description?: string | null; - readonly maximum?: number | null; - readonly minimum?: number | null; + readonly enum: ReadonlyArray; readonly title?: string | null; - readonly type: McpServerElicitationRequestParams__McpElicitationNumberType; + readonly type: McpServerElicitationRequestParams__McpElicitationStringType; }; -export const McpServerElicitationRequestParams__McpElicitationNumberSchema = Schema.Struct({ - default: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "double" }).check(Schema.isFinite()), - Schema.Null, - ]), - ), - description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - maximum: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "double" }).check(Schema.isFinite()), - Schema.Null, - ]), - ), - minimum: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "double" }).check(Schema.isFinite()), - Schema.Null, - ]), - ), - title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: McpServerElicitationRequestParams__McpElicitationNumberType, -}); +export const McpServerElicitationRequestParams__McpElicitationUntitledSingleSelectEnumSchema = + Schema.Struct({ + default: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + enum: Schema.Array(Schema.String), + title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: McpServerElicitationRequestParams__McpElicitationStringType, + }).annotate({ + identifier: "McpServerElicitationRequestParams__McpElicitationUntitledSingleSelectEnumSchema", + }); + +export type McpServerElicitationRequestParams__McpElicitationUntitledEnumItems = { + readonly enum: ReadonlyArray; + readonly type: McpServerElicitationRequestParams__McpElicitationStringType; +}; +export const McpServerElicitationRequestParams__McpElicitationUntitledEnumItems = Schema.Struct({ + enum: Schema.Array(Schema.String), + type: McpServerElicitationRequestParams__McpElicitationStringType, +}).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationUntitledEnumItems" }); export type McpServerElicitationRequestParams__McpElicitationLegacyTitledEnumSchema = { readonly default?: string | null; @@ -12088,8 +14527,35 @@ export const McpServerElicitationRequestParams__McpElicitationLegacyTitledEnumSc enumNames: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), type: McpServerElicitationRequestParams__McpElicitationStringType, + }).annotate({ + identifier: "McpServerElicitationRequestParams__McpElicitationLegacyTitledEnumSchema", + }); + +export type McpServerElicitationRequestParams__McpElicitationTitledSingleSelectEnumSchema = { + readonly default?: string | null; + readonly description?: string | null; + readonly oneOf: ReadonlyArray; + readonly title?: string | null; + readonly type: McpServerElicitationRequestParams__McpElicitationStringType; +}; +export const McpServerElicitationRequestParams__McpElicitationTitledSingleSelectEnumSchema = + Schema.Struct({ + default: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + oneOf: Schema.Array(McpServerElicitationRequestParams__McpElicitationConstOption), + title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: McpServerElicitationRequestParams__McpElicitationStringType, + }).annotate({ + identifier: "McpServerElicitationRequestParams__McpElicitationTitledSingleSelectEnumSchema", }); +export type McpServerElicitationRequestParams__McpElicitationTitledEnumItems = { + readonly anyOf: ReadonlyArray; +}; +export const McpServerElicitationRequestParams__McpElicitationTitledEnumItems = Schema.Struct({ + anyOf: Schema.Array(McpServerElicitationRequestParams__McpElicitationConstOption), +}).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationTitledEnumItems" }); + export type McpServerElicitationRequestParams__McpElicitationStringSchema = { readonly default?: string | null; readonly description?: string | null; @@ -12108,63 +14574,81 @@ export const McpServerElicitationRequestParams__McpElicitationStringSchema = Sch maxLength: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), minLength: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), type: McpServerElicitationRequestParams__McpElicitationStringType, -}); +}).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationStringSchema" }); -export type McpServerElicitationRequestParams__McpElicitationTitledSingleSelectEnumSchema = { - readonly default?: string | null; +export type McpServerElicitationRequestParams__McpElicitationNumberSchema = { + readonly default?: number | null; readonly description?: string | null; - readonly oneOf: ReadonlyArray; + readonly maximum?: number | null; + readonly minimum?: number | null; readonly title?: string | null; - readonly type: McpServerElicitationRequestParams__McpElicitationStringType; -}; -export const McpServerElicitationRequestParams__McpElicitationTitledSingleSelectEnumSchema = - Schema.Struct({ - default: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - oneOf: Schema.Array(McpServerElicitationRequestParams__McpElicitationConstOption), - title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: McpServerElicitationRequestParams__McpElicitationStringType, - }); - -export type McpServerElicitationRequestParams__McpElicitationUntitledEnumItems = { - readonly enum: ReadonlyArray; - readonly type: McpServerElicitationRequestParams__McpElicitationStringType; + readonly type: McpServerElicitationRequestParams__McpElicitationNumberType; }; -export const McpServerElicitationRequestParams__McpElicitationUntitledEnumItems = Schema.Struct({ - enum: Schema.Array(Schema.String), - type: McpServerElicitationRequestParams__McpElicitationStringType, -}); +export const McpServerElicitationRequestParams__McpElicitationNumberSchema = Schema.Struct({ + default: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "double" }).check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + Schema.Null, + ]), + ), + description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + maximum: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "double" }).check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + Schema.Null, + ]), + ), + minimum: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "double" }).check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + Schema.Null, + ]), + ), + title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: McpServerElicitationRequestParams__McpElicitationNumberType, +}).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationNumberSchema" }); -export type McpServerElicitationRequestParams__McpElicitationUntitledSingleSelectEnumSchema = { - readonly default?: string | null; +export type McpServerElicitationRequestParams__McpElicitationBooleanSchema = { + readonly default?: boolean | null; readonly description?: string | null; - readonly enum: ReadonlyArray; readonly title?: string | null; - readonly type: McpServerElicitationRequestParams__McpElicitationStringType; + readonly type: McpServerElicitationRequestParams__McpElicitationBooleanType; }; -export const McpServerElicitationRequestParams__McpElicitationUntitledSingleSelectEnumSchema = - Schema.Struct({ - default: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - enum: Schema.Array(Schema.String), - title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: McpServerElicitationRequestParams__McpElicitationStringType, - }); +export const McpServerElicitationRequestParams__McpElicitationBooleanSchema = Schema.Struct({ + default: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: McpServerElicitationRequestParams__McpElicitationBooleanType, +}).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationBooleanSchema" }); export type PermissionsRequestApprovalParams__FileSystemSpecialPath = | { readonly kind: "root" } @@ -12209,7 +14693,7 @@ export const PermissionsRequestApprovalParams__FileSystemSpecialPath = Schema.Un }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "PermissionsRequestApprovalParams__FileSystemSpecialPath" }); export type PermissionsRequestApprovalResponse__FileSystemSpecialPath = | { readonly kind: "root" } @@ -12254,7 +14738,132 @@ export const PermissionsRequestApprovalResponse__FileSystemSpecialPath = Schema. }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "PermissionsRequestApprovalResponse__FileSystemSpecialPath" }); + +export type ServerNotification__CodexErrorInfo = + | "contextWindowExceeded" + | "sessionBudgetExceeded" + | "usageLimitExceeded" + | "serverOverloaded" + | "cyberPolicy" + | "internalServerError" + | "unauthorized" + | "badRequest" + | "threadRollbackFailed" + | "sandboxError" + | "other" + | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } + | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } + | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } } + | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } + | { + readonly activeTurnNotSteerable: { + readonly turnKind: ServerNotification__NonSteerableTurnKind; + }; + }; +export const ServerNotification__CodexErrorInfo = Schema.Union( + [ + Schema.Literals([ + "contextWindowExceeded", + "sessionBudgetExceeded", + "usageLimitExceeded", + "serverOverloaded", + "cyberPolicy", + "internalServerError", + "unauthorized", + "badRequest", + "threadRollbackFailed", + "sandboxError", + "other", + ]), + Schema.Struct({ + httpConnectionFailed: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ title: "HttpConnectionFailedCodexErrorInfo" }), + Schema.Struct({ + responseStreamConnectionFailed: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ + title: "ResponseStreamConnectionFailedCodexErrorInfo", + description: "Failed to connect to the response SSE stream.", + }), + Schema.Struct({ + responseStreamDisconnected: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ + title: "ResponseStreamDisconnectedCodexErrorInfo", + description: + "The response SSE stream disconnected in the middle of a turn before completion.", + }), + Schema.Struct({ + responseTooManyFailedAttempts: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ + title: "ResponseTooManyFailedAttemptsCodexErrorInfo", + description: "Reached the retry limit for responses.", + }), + Schema.Struct({ + activeTurnNotSteerable: Schema.Struct({ turnKind: ServerNotification__NonSteerableTurnKind }), + }).annotate({ + title: "ActiveTurnNotSteerableCodexErrorInfo", + description: + "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "ServerNotification__CodexErrorInfo", +}); export type ServerNotification__CommandAction = | { @@ -12296,7 +14905,7 @@ export const ServerNotification__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ServerNotification__CommandAction" }); export type ServerNotification__FsChangedNotification = { readonly changedPaths: ReadonlyArray; @@ -12309,177 +14918,97 @@ export const ServerNotification__FsChangedNotification = Schema.Struct({ watchId: Schema.String.annotate({ description: "Watch identifier previously provided to `fs/watch`.", }), -}).annotate({ description: "Filesystem watch notification emitted for `fs/watch` subscribers." }); +}).annotate({ + description: "Filesystem watch notification emitted for `fs/watch` subscribers.", + identifier: "ServerNotification__FsChangedNotification", +}); -export type ServerNotification__SandboxPolicy = - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } +export type ServerNotification__SubAgentSource = + | "review" + | "compact" + | "memory_consolidation" | { - readonly excludeSlashTmp?: boolean; - readonly excludeTmpdirEnvVar?: boolean; - readonly networkAccess?: boolean; - readonly type: "workspaceWrite"; - readonly writableRoots?: ReadonlyArray; - }; -export const ServerNotification__SandboxPolicy = Schema.Union( + readonly thread_spawn: { + readonly agent_nickname?: string | null; + readonly agent_path?: ServerNotification__AgentPath | null; + readonly agent_role?: string | null; + readonly depth: number; + readonly parent_thread_id: ServerNotification__ThreadId; + }; + } + | { readonly other: string }; +export const ServerNotification__SubAgentSource = Schema.Union( [ + Schema.Literals(["review", "compact", "memory_consolidation"]), Schema.Struct({ - type: Schema.Literal("dangerFullAccess").annotate({ - title: "DangerFullAccessSandboxPolicyType", + thread_spawn: Schema.Struct({ + agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + agent_path: Schema.optionalKey(Schema.Union([ServerNotification__AgentPath, Schema.Null])), + agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: ServerNotification__ThreadId, }), - }).annotate({ title: "DangerFullAccessSandboxPolicy" }), + }).annotate({ title: "ThreadSpawnSubAgentSource" }), + Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__SubAgentSource" }); + +export type ServerNotification__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } + | { + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const ServerNotification__ThreadStatus = Schema.Union( + [ Schema.Struct({ - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), - }).annotate({ title: "ReadOnlySandboxPolicy" }), + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), Schema.Struct({ - networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), - ), - type: Schema.Literal("externalSandbox").annotate({ - title: "ExternalSandboxSandboxPolicyType", - }), - }).annotate({ title: "ExternalSandboxSandboxPolicy" }), + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), Schema.Struct({ - excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), - writableRoots: Schema.optionalKey( - Schema.Array(ServerNotification__AbsolutePathBuf).annotate({ default: [] }), - ), - }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), + Schema.Struct({ + activeFlags: Schema.Array(ServerNotification__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), ], { mode: "oneOf" }, -); - -export type ServerNotification__AppMetadata = { - readonly categories?: ReadonlyArray | null; - readonly developer?: string | null; - readonly firstPartyRequiresInstall?: boolean | null; - readonly firstPartyType?: string | null; - readonly review?: ServerNotification__AppReview | null; - readonly screenshots?: ReadonlyArray | null; - readonly seoDescription?: string | null; - readonly showInComposerWhenUnlinked?: boolean | null; - readonly subCategories?: ReadonlyArray | null; - readonly version?: string | null; - readonly versionId?: string | null; - readonly versionNotes?: string | null; -}; -export const ServerNotification__AppMetadata = Schema.Struct({ - categories: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - developer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - firstPartyRequiresInstall: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - firstPartyType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - review: Schema.optionalKey(Schema.Union([ServerNotification__AppReview, Schema.Null])), - screenshots: Schema.optionalKey( - Schema.Union([Schema.Array(ServerNotification__AppScreenshot), Schema.Null]), - ), - seoDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - showInComposerWhenUnlinked: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - subCategories: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - version: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - versionId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - versionNotes: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type ServerNotification__CollabAgentState = { - readonly message?: string | null; - readonly status: ServerNotification__CollabAgentStatus; -}; -export const ServerNotification__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: ServerNotification__CollabAgentStatus, -}); - -export type ServerNotification__ExternalAgentConfigImportItemTypeFailure = { - readonly cwd?: string | null; - readonly errorType?: string | null; - readonly failureStage: string; - readonly itemType: ServerNotification__ExternalAgentConfigMigrationItemType; - readonly message: string; - readonly source?: string | null; - readonly subErrorType?: string | null; -}; -export const ServerNotification__ExternalAgentConfigImportItemTypeFailure = Schema.Struct({ - cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - errorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - failureStage: Schema.String, - itemType: ServerNotification__ExternalAgentConfigMigrationItemType, - message: Schema.String, - source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - subErrorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type ServerNotification__ExternalAgentConfigImportItemTypeSuccess = { - readonly cwd?: string | null; - readonly itemType: ServerNotification__ExternalAgentConfigMigrationItemType; - readonly source?: string | null; - readonly target?: string | null; -}; -export const ServerNotification__ExternalAgentConfigImportItemTypeSuccess = Schema.Struct({ - cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - itemType: ServerNotification__ExternalAgentConfigMigrationItemType, - source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +).annotate({ identifier: "ServerNotification__ThreadStatus" }); -export type ServerNotification__FuzzyFileSearchResult = { - readonly file_name: string; - readonly indices?: ReadonlyArray | null; - readonly match_type: ServerNotification__FuzzyFileSearchMatchType; - readonly path: string; - readonly root: string; - readonly score: number; +export type ServerNotification__TextElement = { + readonly byteRange: ServerNotification__ByteRange; + readonly placeholder?: string | null; }; -export const ServerNotification__FuzzyFileSearchResult = Schema.Struct({ - file_name: Schema.String, - indices: Schema.optionalKey( +export const ServerNotification__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => ServerNotification__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - ), + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), Schema.Null, ]), ), - match_type: ServerNotification__FuzzyFileSearchMatchType, - path: Schema.String, - root: Schema.String, - score: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}).annotate({ description: "Superset of [`codex_file_search::FileMatch`]" }); - -export type ServerNotification__GuardianApprovalReview = { - readonly rationale?: string | null; - readonly riskLevel?: ServerNotification__GuardianRiskLevel | null; - readonly status: ServerNotification__GuardianApprovalReviewStatus; - readonly userAuthorization?: ServerNotification__GuardianUserAuthorization | null; -}; -export const ServerNotification__GuardianApprovalReview = Schema.Struct({ - rationale: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - riskLevel: Schema.optionalKey(Schema.Union([ServerNotification__GuardianRiskLevel, Schema.Null])), - status: ServerNotification__GuardianApprovalReviewStatus, - userAuthorization: Schema.optionalKey( - Schema.Union([ServerNotification__GuardianUserAuthorization, Schema.Null]), - ), -}).annotate({ - description: - "[UNSTABLE] Temporary approval auto-review payload used by `item/autoApprovalReview/*` notifications. This shape is expected to change soon.", -}); +}).annotate({ identifier: "ServerNotification__TextElement" }); -export type ServerNotification__HookOutputEntry = { - readonly kind: ServerNotification__HookOutputEntryKind; - readonly text: string; +export type ServerNotification__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; }; -export const ServerNotification__HookOutputEntry = Schema.Struct({ - kind: ServerNotification__HookOutputEntryKind, - text: Schema.String, -}); +export const ServerNotification__MemoryCitation = Schema.Struct({ + entries: Schema.Array(ServerNotification__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "ServerNotification__MemoryCitation" }); export type ServerNotification__FileSystemSpecialPath = | { readonly kind: "root" } @@ -12524,225 +15053,228 @@ export const ServerNotification__FileSystemSpecialPath = Schema.Union( }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ServerNotification__FileSystemSpecialPath" }); -export type ServerNotification__McpServerStatusUpdatedNotification = { - readonly error?: string | null; - readonly failureReason?: ServerNotification__McpServerStartupFailureReason | null; - readonly name: string; - readonly status: ServerNotification__McpServerStartupState; - readonly threadId?: string | null; +export type ServerNotification__FileUpdateChange = { + readonly diff: string; + readonly kind: ServerNotification__PatchChangeKind; + readonly path: string; }; -export const ServerNotification__McpServerStatusUpdatedNotification = Schema.Struct({ - error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - failureReason: Schema.optionalKey( - Schema.Union([ServerNotification__McpServerStartupFailureReason, Schema.Null]), - ), - name: Schema.String, - status: ServerNotification__McpServerStartupState, - threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +export const ServerNotification__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: ServerNotification__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "ServerNotification__FileUpdateChange" }); -export type ServerNotification__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; +export type ServerNotification__CollabAgentState = { + readonly message?: string | null; + readonly status: ServerNotification__CollabAgentStatus; }; -export const ServerNotification__MemoryCitation = Schema.Struct({ - entries: Schema.Array(ServerNotification__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +export const ServerNotification__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: ServerNotification__CollabAgentStatus, +}).annotate({ identifier: "ServerNotification__CollabAgentState" }); -export type ServerNotification__ModelReroutedNotification = { - readonly fromModel: string; - readonly reason: ServerNotification__ModelRerouteReason; - readonly threadId: string; - readonly toModel: string; - readonly turnId: string; +export type ServerNotification__Settings = { + readonly developer_instructions?: string | null; + readonly model: string; + readonly reasoning_effort?: ServerNotification__ReasoningEffort | null; }; -export const ServerNotification__ModelReroutedNotification = Schema.Struct({ - fromModel: Schema.String, - reason: ServerNotification__ModelRerouteReason, - threadId: Schema.String, - toModel: Schema.String, - turnId: Schema.String, +export const ServerNotification__Settings = Schema.Struct({ + developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.String, + reasoning_effort: Schema.optionalKey( + Schema.Union([ServerNotification__ReasoningEffort, Schema.Null]), + ), +}).annotate({ + description: "Settings for a collaboration mode.", + identifier: "ServerNotification__Settings", }); -export type ServerNotification__ModelVerificationNotification = { +export type ServerNotification__ThreadGoal = { + readonly createdAt: number; + readonly objective: string; + readonly status: ServerNotification__ThreadGoalStatus; readonly threadId: string; - readonly turnId: string; - readonly verifications: ReadonlyArray; + readonly timeUsedSeconds: number; + readonly tokenBudget?: number | null; + readonly tokensUsed: number; + readonly updatedAt: number; }; -export const ServerNotification__ModelVerificationNotification = Schema.Struct({ +export const ServerNotification__ThreadGoal = Schema.Struct({ + createdAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + objective: Schema.String, + status: ServerNotification__ThreadGoalStatus, threadId: Schema.String, - turnId: Schema.String, - verifications: Schema.Array(ServerNotification__ModelVerification), -}); - -export type ServerNotification__CodexErrorInfo = - | "contextWindowExceeded" - | "sessionBudgetExceeded" - | "usageLimitExceeded" - | "serverOverloaded" - | "cyberPolicy" - | "internalServerError" - | "unauthorized" - | "badRequest" - | "threadRollbackFailed" - | "sandboxError" - | "other" - | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } - | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } - | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } } - | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } + timeUsedSeconds: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + tokenBudget: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + tokensUsed: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + updatedAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +}).annotate({ identifier: "ServerNotification__ThreadGoal" }); + +export type ServerNotification__SandboxPolicy = + | { readonly type: "dangerFullAccess" } + | { readonly networkAccess?: boolean; readonly type: "readOnly" } + | { readonly networkAccess?: ServerNotification__NetworkAccess; readonly type: "externalSandbox" } | { - readonly activeTurnNotSteerable: { - readonly turnKind: ServerNotification__NonSteerableTurnKind; - }; + readonly excludeSlashTmp?: boolean; + readonly excludeTmpdirEnvVar?: boolean; + readonly networkAccess?: boolean; + readonly type: "workspaceWrite"; + readonly writableRoots?: ReadonlyArray; }; -export const ServerNotification__CodexErrorInfo = Schema.Union( +export const ServerNotification__SandboxPolicy = Schema.Union( [ - Schema.Literals([ - "contextWindowExceeded", - "sessionBudgetExceeded", - "usageLimitExceeded", - "serverOverloaded", - "cyberPolicy", - "internalServerError", - "unauthorized", - "badRequest", - "threadRollbackFailed", - "sandboxError", - "other", - ]), - Schema.Struct({ - httpConnectionFailed: Schema.Struct({ - httpStatusCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - }), - }).annotate({ title: "HttpConnectionFailedCodexErrorInfo" }), Schema.Struct({ - responseStreamConnectionFailed: Schema.Struct({ - httpStatusCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), + type: Schema.Literal("dangerFullAccess").annotate({ + title: "DangerFullAccessSandboxPolicyType", }), - }).annotate({ - title: "ResponseStreamConnectionFailedCodexErrorInfo", - description: "Failed to connect to the response SSE stream.", - }), + }).annotate({ title: "DangerFullAccessSandboxPolicy" }), Schema.Struct({ - responseStreamDisconnected: Schema.Struct({ - httpStatusCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - }), - }).annotate({ - title: "ResponseStreamDisconnectedCodexErrorInfo", - description: - "The response SSE stream disconnected in the middle of a turn before completion.", - }), + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), + }).annotate({ title: "ReadOnlySandboxPolicy" }), Schema.Struct({ - responseTooManyFailedAttempts: Schema.Struct({ - httpStatusCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), + networkAccess: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => ServerNotification__NetworkAccess, + ).annotate({ default: "restricted" }), + ), + type: Schema.Literal("externalSandbox").annotate({ + title: "ExternalSandboxSandboxPolicyType", }), - }).annotate({ - title: "ResponseTooManyFailedAttemptsCodexErrorInfo", - description: "Reached the retry limit for responses.", - }), + }).annotate({ title: "ExternalSandboxSandboxPolicy" }), Schema.Struct({ - activeTurnNotSteerable: Schema.Struct({ turnKind: ServerNotification__NonSteerableTurnKind }), - }).annotate({ - title: "ActiveTurnNotSteerableCodexErrorInfo", - description: - "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", - }), + excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), + writableRoots: Schema.optionalKey( + Schema.Array(ServerNotification__AbsolutePathBuf).annotate({ default: [] }), + ), + }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), ], { mode: "oneOf" }, -).annotate({ - description: - "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", -}); +).annotate({ identifier: "ServerNotification__SandboxPolicy" }); -export type ServerNotification__FileUpdateChange = { - readonly diff: string; - readonly kind: ServerNotification__PatchChangeKind; - readonly path: string; +export type ServerNotification__ThreadTokenUsage = { + readonly last: ServerNotification__TokenUsageBreakdown; + readonly modelContextWindow?: number | null; + readonly total: ServerNotification__TokenUsageBreakdown; }; -export const ServerNotification__FileUpdateChange = Schema.Struct({ - diff: Schema.String, - kind: ServerNotification__PatchChangeKind, - path: Schema.String, -}); +export const ServerNotification__ThreadTokenUsage = Schema.Struct({ + last: ServerNotification__TokenUsageBreakdown, + modelContextWindow: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + total: ServerNotification__TokenUsageBreakdown, +}).annotate({ identifier: "ServerNotification__ThreadTokenUsage" }); -export type ServerNotification__AccountUpdatedNotification = { - readonly authMode?: ServerNotification__AuthMode | null; - readonly planType?: ServerNotification__PlanType | null; +export type ServerNotification__HookOutputEntry = { + readonly kind: ServerNotification__HookOutputEntryKind; + readonly text: string; }; -export const ServerNotification__AccountUpdatedNotification = Schema.Struct({ - authMode: Schema.optionalKey(Schema.Union([ServerNotification__AuthMode, Schema.Null])), - planType: Schema.optionalKey(Schema.Union([ServerNotification__PlanType, Schema.Null])), -}); +export const ServerNotification__HookOutputEntry = Schema.Struct({ + kind: ServerNotification__HookOutputEntryKind, + text: Schema.String, +}).annotate({ identifier: "ServerNotification__HookOutputEntry" }); -export type ServerNotification__ThreadRealtimeStartedNotification = { - readonly realtimeSessionId?: string | null; - readonly threadId: string; - readonly version: ServerNotification__RealtimeConversationVersion; +export type ServerNotification__TurnPlanStep = { + readonly status: ServerNotification__TurnPlanStepStatus; + readonly step: string; }; -export const ServerNotification__ThreadRealtimeStartedNotification = Schema.Struct({ - realtimeSessionId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - threadId: Schema.String, - version: ServerNotification__RealtimeConversationVersion, -}).annotate({ description: "EXPERIMENTAL - emitted when thread realtime startup is accepted." }); +export const ServerNotification__TurnPlanStep = Schema.Struct({ + status: ServerNotification__TurnPlanStepStatus, + step: Schema.String, +}).annotate({ identifier: "ServerNotification__TurnPlanStep" }); -export type ServerNotification__Settings = { - readonly developer_instructions?: string | null; - readonly model: string; - readonly reasoning_effort?: ServerNotification__ReasoningEffort | null; +export type ServerNotification__GuardianApprovalReview = { + readonly rationale?: string | null; + readonly riskLevel?: ServerNotification__GuardianRiskLevel | null; + readonly status: ServerNotification__GuardianApprovalReviewStatus; + readonly userAuthorization?: ServerNotification__GuardianUserAuthorization | null; }; -export const ServerNotification__Settings = Schema.Struct({ - developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.String, - reasoning_effort: Schema.optionalKey( - Schema.Union([ServerNotification__ReasoningEffort, Schema.Null]), +export const ServerNotification__GuardianApprovalReview = Schema.Struct({ + rationale: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + riskLevel: Schema.optionalKey(Schema.Union([ServerNotification__GuardianRiskLevel, Schema.Null])), + status: ServerNotification__GuardianApprovalReviewStatus, + userAuthorization: Schema.optionalKey( + Schema.Union([ServerNotification__GuardianUserAuthorization, Schema.Null]), ), -}).annotate({ description: "Settings for a collaboration mode." }); +}).annotate({ + description: + "[UNSTABLE] Temporary approval auto-review payload used by `item/autoApprovalReview/*` notifications. This shape is expected to change soon.", + identifier: "ServerNotification__GuardianApprovalReview", +}); -export type ServerNotification__RemoteControlStatusChangedNotification = { - readonly environmentId?: string | null; - readonly installationId: string; - readonly serverName: string; - readonly status: ServerNotification__RemoteControlConnectionStatus; +export type ServerNotification__CommandExecOutputDeltaNotification = { + readonly capReached: boolean; + readonly deltaBase64: string; + readonly processId: string; + readonly stream: ServerNotification__CommandExecOutputStream; }; -export const ServerNotification__RemoteControlStatusChangedNotification = Schema.Struct({ - environmentId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - installationId: Schema.String, - serverName: Schema.String, - status: ServerNotification__RemoteControlConnectionStatus, +export const ServerNotification__CommandExecOutputDeltaNotification = Schema.Struct({ + capReached: Schema.Boolean.annotate({ + description: + "`true` on the final streamed chunk for a stream when `outputBytesCap` truncated later output on that stream.", + }), + deltaBase64: Schema.String.annotate({ description: "Base64-encoded output bytes." }), + processId: Schema.String.annotate({ + description: + "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", + }), + stream: Schema.suspend( + (): Schema.Codec => + ServerNotification__CommandExecOutputStream, + ).annotate({ description: "Output stream for this chunk." }), }).annotate({ - description: "Current remote-control connection status and remote identity exposed to clients.", + description: + "Base64-encoded output chunk emitted for a streaming `command/exec` request.\n\nThese notifications are connection-scoped. If the originating connection closes, the server terminates the process.", + identifier: "ServerNotification__CommandExecOutputDeltaNotification", +}); + +export type ServerNotification__ProcessOutputDeltaNotification = { + readonly capReached: boolean; + readonly deltaBase64: string; + readonly processHandle: string; + readonly stream: ServerNotification__ProcessOutputStream; +}; +export const ServerNotification__ProcessOutputDeltaNotification = Schema.Struct({ + capReached: Schema.Boolean.annotate({ + description: + "True on the final streamed chunk for this stream when output was truncated by `outputBytesCap`.", + }), + deltaBase64: Schema.String.annotate({ description: "Base64-encoded output bytes." }), + processHandle: Schema.String.annotate({ + description: "Client-supplied, connection-scoped `processHandle` from `process/spawn`.", + }), + stream: Schema.suspend( + (): Schema.Codec => + ServerNotification__ProcessOutputStream, + ).annotate({ description: "Output stream this chunk belongs to." }), +}).annotate({ + description: "Base64-encoded output chunk emitted for a streaming `process/spawn` request.", + identifier: "ServerNotification__ProcessOutputDeltaNotification", }); export type ServerNotification__ServerRequestResolvedNotification = { @@ -12752,7 +15284,33 @@ export type ServerNotification__ServerRequestResolvedNotification = { export const ServerNotification__ServerRequestResolvedNotification = Schema.Struct({ requestId: ServerNotification__RequestId, threadId: Schema.String, -}); +}).annotate({ identifier: "ServerNotification__ServerRequestResolvedNotification" }); + +export type ServerNotification__McpServerStatusUpdatedNotification = { + readonly error?: string | null; + readonly failureReason?: ServerNotification__McpServerStartupFailureReason | null; + readonly name: string; + readonly status: ServerNotification__McpServerStartupState; + readonly threadId?: string | null; +}; +export const ServerNotification__McpServerStatusUpdatedNotification = Schema.Struct({ + error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + failureReason: Schema.optionalKey( + Schema.Union([ServerNotification__McpServerStartupFailureReason, Schema.Null]), + ), + name: Schema.String, + status: ServerNotification__McpServerStartupState, + threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__McpServerStatusUpdatedNotification" }); + +export type ServerNotification__AccountUpdatedNotification = { + readonly authMode?: ServerNotification__AuthMode | null; + readonly planType?: ServerNotification__PlanType | null; +}; +export const ServerNotification__AccountUpdatedNotification = Schema.Struct({ + authMode: Schema.optionalKey(Schema.Union([ServerNotification__AuthMode, Schema.Null])), + planType: Schema.optionalKey(Schema.Union([ServerNotification__PlanType, Schema.Null])), +}).annotate({ identifier: "ServerNotification__AccountUpdatedNotification" }); export type ServerNotification__RateLimitSnapshot = { readonly credits?: ServerNotification__CreditsSnapshot | null; @@ -12787,71 +15345,112 @@ export const ServerNotification__RateLimitSnapshot = Schema.Struct({ Schema.Null, ]), ), +}).annotate({ identifier: "ServerNotification__RateLimitSnapshot" }); + +export type ServerNotification__AppMetadata = { + readonly categories?: ReadonlyArray | null; + readonly developer?: string | null; + readonly firstPartyRequiresInstall?: boolean | null; + readonly firstPartyType?: string | null; + readonly review?: ServerNotification__AppReview | null; + readonly screenshots?: ReadonlyArray | null; + readonly seoDescription?: string | null; + readonly showInComposerWhenUnlinked?: boolean | null; + readonly subCategories?: ReadonlyArray | null; + readonly version?: string | null; + readonly versionId?: string | null; + readonly versionNotes?: string | null; +}; +export const ServerNotification__AppMetadata = Schema.Struct({ + categories: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + developer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + firstPartyRequiresInstall: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + firstPartyType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + review: Schema.optionalKey(Schema.Union([ServerNotification__AppReview, Schema.Null])), + screenshots: Schema.optionalKey( + Schema.Union([Schema.Array(ServerNotification__AppScreenshot), Schema.Null]), + ), + seoDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + showInComposerWhenUnlinked: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + subCategories: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + version: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + versionId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + versionNotes: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__AppMetadata" }); + +export type ServerNotification__RemoteControlStatusChangedNotification = { + readonly environmentId?: string | null; + readonly installationId: string; + readonly serverName: string; + readonly status: ServerNotification__RemoteControlConnectionStatus; +}; +export const ServerNotification__RemoteControlStatusChangedNotification = Schema.Struct({ + environmentId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + installationId: Schema.String, + serverName: Schema.String, + status: ServerNotification__RemoteControlConnectionStatus, +}).annotate({ + description: "Current remote-control connection status and remote identity exposed to clients.", + identifier: "ServerNotification__RemoteControlStatusChangedNotification", }); -export type ServerNotification__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: ServerNotification__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: ServerNotification__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const ServerNotification__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(ServerNotification__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); +export type ServerNotification__ExternalAgentConfigImportItemTypeFailure = { + readonly cwd?: string | null; + readonly errorType?: string | null; + readonly failureStage: string; + readonly itemType: ServerNotification__ExternalAgentConfigMigrationItemType; + readonly message: string; + readonly source?: string | null; + readonly subErrorType?: string | null; +}; +export const ServerNotification__ExternalAgentConfigImportItemTypeFailure = Schema.Struct({ + cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + errorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + failureStage: Schema.String, + itemType: ServerNotification__ExternalAgentConfigMigrationItemType, + message: Schema.String, + source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + subErrorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__ExternalAgentConfigImportItemTypeFailure" }); + +export type ServerNotification__ExternalAgentConfigImportItemTypeSuccess = { + readonly cwd?: string | null; + readonly itemType: ServerNotification__ExternalAgentConfigMigrationItemType; + readonly source?: string | null; + readonly target?: string | null; +}; +export const ServerNotification__ExternalAgentConfigImportItemTypeSuccess = Schema.Struct({ + cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + itemType: ServerNotification__ExternalAgentConfigMigrationItemType, + source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__ExternalAgentConfigImportItemTypeSuccess" }); + +export type ServerNotification__ModelReroutedNotification = { + readonly fromModel: string; + readonly reason: ServerNotification__ModelRerouteReason; + readonly threadId: string; + readonly toModel: string; + readonly turnId: string; +}; +export const ServerNotification__ModelReroutedNotification = Schema.Struct({ + fromModel: Schema.String, + reason: ServerNotification__ModelRerouteReason, + threadId: Schema.String, + toModel: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__ModelReroutedNotification" }); + +export type ServerNotification__ModelVerificationNotification = { + readonly threadId: string; + readonly turnId: string; + readonly verifications: ReadonlyArray; +}; +export const ServerNotification__ModelVerificationNotification = Schema.Struct({ + threadId: Schema.String, + turnId: Schema.String, + verifications: Schema.Array(ServerNotification__ModelVerification), +}).annotate({ identifier: "ServerNotification__ModelVerificationNotification" }); export type ServerNotification__TextRange = { readonly end: ServerNotification__TextPosition; @@ -12860,118 +15459,69 @@ export type ServerNotification__TextRange = { export const ServerNotification__TextRange = Schema.Struct({ end: ServerNotification__TextPosition, start: ServerNotification__TextPosition, +}).annotate({ identifier: "ServerNotification__TextRange" }); + +export type ServerNotification__FuzzyFileSearchResult = { + readonly file_name: string; + readonly indices?: ReadonlyArray | null; + readonly match_type: ServerNotification__FuzzyFileSearchMatchType; + readonly path: string; + readonly root: string; + readonly score: number; +}; +export const ServerNotification__FuzzyFileSearchResult = Schema.Struct({ + file_name: Schema.String, + indices: Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + ), + Schema.Null, + ]), + ), + match_type: ServerNotification__FuzzyFileSearchMatchType, + path: Schema.String, + root: Schema.String, + score: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ + description: "Superset of [`codex_file_search::FileMatch`]", + identifier: "ServerNotification__FuzzyFileSearchResult", }); -export type ServerNotification__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const ServerNotification__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(ServerNotification__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); +export type ServerNotification__ThreadRealtimeStartedNotification = { + readonly realtimeSessionId?: string | null; + readonly threadId: string; + readonly version: ServerNotification__RealtimeConversationVersion; +}; +export const ServerNotification__ThreadRealtimeStartedNotification = Schema.Struct({ + realtimeSessionId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + threadId: Schema.String, + version: ServerNotification__RealtimeConversationVersion, +}).annotate({ + description: "EXPERIMENTAL - emitted when thread realtime startup is accepted.", + identifier: "ServerNotification__ThreadRealtimeStartedNotification", +}); -export type ServerNotification__ThreadGoal = { - readonly createdAt: number; - readonly objective: string; - readonly status: ServerNotification__ThreadGoalStatus; +export type ServerNotification__ThreadRealtimeOutputAudioDeltaNotification = { + readonly audio: ServerNotification__ThreadRealtimeAudioChunk; readonly threadId: string; - readonly timeUsedSeconds: number; - readonly tokenBudget?: number | null; - readonly tokensUsed: number; - readonly updatedAt: number; }; -export const ServerNotification__ThreadGoal = Schema.Struct({ - createdAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - objective: Schema.String, - status: ServerNotification__ThreadGoalStatus, +export const ServerNotification__ThreadRealtimeOutputAudioDeltaNotification = Schema.Struct({ + audio: ServerNotification__ThreadRealtimeAudioChunk, threadId: Schema.String, - timeUsedSeconds: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - tokenBudget: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), - tokensUsed: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - updatedAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -}); - -export type ServerNotification__SubAgentSource = - | "review" - | "compact" - | "memory_consolidation" - | { - readonly thread_spawn: { - readonly agent_nickname?: string | null; - readonly agent_path?: ServerNotification__AgentPath | null; - readonly agent_role?: string | null; - readonly depth: number; - readonly parent_thread_id: ServerNotification__ThreadId; - }; - } - | { readonly other: string }; -export const ServerNotification__SubAgentSource = Schema.Union( - [ - Schema.Literals(["review", "compact", "memory_consolidation"]), - Schema.Struct({ - thread_spawn: Schema.Struct({ - agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - agent_path: Schema.optionalKey(Schema.Union([ServerNotification__AgentPath, Schema.Null])), - agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: ServerNotification__ThreadId, - }), - }).annotate({ title: "ThreadSpawnSubAgentSource" }), - Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), - ], - { mode: "oneOf" }, -); - -export type ServerNotification__ThreadRealtimeOutputAudioDeltaNotification = { - readonly audio: ServerNotification__ThreadRealtimeAudioChunk; - readonly threadId: string; -}; -export const ServerNotification__ThreadRealtimeOutputAudioDeltaNotification = Schema.Struct({ - audio: ServerNotification__ThreadRealtimeAudioChunk, - threadId: Schema.String, -}).annotate({ description: "EXPERIMENTAL - streamed output audio emitted by thread realtime." }); - -export type ServerNotification__ThreadTokenUsage = { - readonly last: ServerNotification__TokenUsageBreakdown; - readonly modelContextWindow?: number | null; - readonly total: ServerNotification__TokenUsageBreakdown; -}; -export const ServerNotification__ThreadTokenUsage = Schema.Struct({ - last: ServerNotification__TokenUsageBreakdown, - modelContextWindow: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), - total: ServerNotification__TokenUsageBreakdown, -}); - -export type ServerNotification__TurnPlanStep = { - readonly status: ServerNotification__TurnPlanStepStatus; - readonly step: string; -}; -export const ServerNotification__TurnPlanStep = Schema.Struct({ - status: ServerNotification__TurnPlanStepStatus, - step: Schema.String, +}).annotate({ + description: "EXPERIMENTAL - streamed output audio emitted by thread realtime.", + identifier: "ServerNotification__ThreadRealtimeOutputAudioDeltaNotification", }); export type ServerNotification__WindowsSandboxSetupCompletedNotification = { @@ -12983,7 +15533,7 @@ export const ServerNotification__WindowsSandboxSetupCompletedNotification = Sche error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mode: ServerNotification__WindowsSandboxSetupMode, success: Schema.Boolean, -}); +}).annotate({ identifier: "ServerNotification__WindowsSandboxSetupCompletedNotification" }); export type ServerRequest__CommandAction = | { @@ -13025,24 +15575,7 @@ export const ServerRequest__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); - -export type ServerRequest__ChatgptAuthTokensRefreshParams = { - readonly previousAccountId?: string | null; - readonly reason: ServerRequest__ChatgptAuthTokensRefreshReason; -}; -export const ServerRequest__ChatgptAuthTokensRefreshParams = Schema.Struct({ - previousAccountId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Workspace/account identifier that Codex was previously using.\n\nClients that manage multiple accounts/workspaces can use this as a hint to refresh the token for the correct workspace.\n\nThis may be `null` when the prior auth state did not include a workspace identifier (`chatgpt_account_id`).", - }), - Schema.Null, - ]), - ), - reason: ServerRequest__ChatgptAuthTokensRefreshReason, -}); +).annotate({ identifier: "ServerRequest__CommandAction" }); export type ServerRequest__FileSystemSpecialPath = | { readonly kind: "root" } @@ -13080,59 +15613,71 @@ export const ServerRequest__FileSystemSpecialPath = Schema.Union( }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ServerRequest__FileSystemSpecialPath" }); -export type ServerRequest__McpElicitationBooleanSchema = { - readonly default?: boolean | null; - readonly description?: string | null; - readonly title?: string | null; - readonly type: ServerRequest__McpElicitationBooleanType; +export type ServerRequest__NetworkApprovalContext = { + readonly host: string; + readonly protocol: ServerRequest__NetworkApprovalProtocol; }; -export const ServerRequest__McpElicitationBooleanSchema = Schema.Struct({ - default: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: ServerRequest__McpElicitationBooleanType, -}); +export const ServerRequest__NetworkApprovalContext = Schema.Struct({ + host: Schema.String, + protocol: ServerRequest__NetworkApprovalProtocol, +}).annotate({ identifier: "ServerRequest__NetworkApprovalContext" }); -export type ServerRequest__McpElicitationTitledEnumItems = { - readonly anyOf: ReadonlyArray; +export type ServerRequest__NetworkPolicyAmendment = { + readonly action: ServerRequest__NetworkPolicyRuleAction; + readonly host: string; }; -export const ServerRequest__McpElicitationTitledEnumItems = Schema.Struct({ - anyOf: Schema.Array(ServerRequest__McpElicitationConstOption), +export const ServerRequest__NetworkPolicyAmendment = Schema.Struct({ + action: ServerRequest__NetworkPolicyRuleAction, + host: Schema.String, +}).annotate({ identifier: "ServerRequest__NetworkPolicyAmendment" }); + +export type ServerRequest__ToolRequestUserInputQuestion = { + readonly header: string; + readonly id: string; + readonly isOther?: boolean; + readonly isSecret?: boolean; + readonly options?: ReadonlyArray | null; + readonly question: string; +}; +export const ServerRequest__ToolRequestUserInputQuestion = Schema.Struct({ + header: Schema.String, + id: Schema.String, + isOther: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + isSecret: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + options: Schema.optionalKey( + Schema.Union([Schema.Array(ServerRequest__ToolRequestUserInputOption), Schema.Null]), + ), + question: Schema.String, +}).annotate({ + description: "EXPERIMENTAL. Represents one request_user_input question and its required options.", + identifier: "ServerRequest__ToolRequestUserInputQuestion", }); -export type ServerRequest__McpElicitationNumberSchema = { - readonly default?: number | null; +export type ServerRequest__McpElicitationUntitledSingleSelectEnumSchema = { + readonly default?: string | null; readonly description?: string | null; - readonly maximum?: number | null; - readonly minimum?: number | null; + readonly enum: ReadonlyArray; readonly title?: string | null; - readonly type: ServerRequest__McpElicitationNumberType; + readonly type: ServerRequest__McpElicitationStringType; }; -export const ServerRequest__McpElicitationNumberSchema = Schema.Struct({ - default: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "double" }).check(Schema.isFinite()), - Schema.Null, - ]), - ), +export const ServerRequest__McpElicitationUntitledSingleSelectEnumSchema = Schema.Struct({ + default: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - maximum: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "double" }).check(Schema.isFinite()), - Schema.Null, - ]), - ), - minimum: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "double" }).check(Schema.isFinite()), - Schema.Null, - ]), - ), + enum: Schema.Array(Schema.String), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: ServerRequest__McpElicitationNumberType, -}); + type: ServerRequest__McpElicitationStringType, +}).annotate({ identifier: "ServerRequest__McpElicitationUntitledSingleSelectEnumSchema" }); + +export type ServerRequest__McpElicitationUntitledEnumItems = { + readonly enum: ReadonlyArray; + readonly type: ServerRequest__McpElicitationStringType; +}; +export const ServerRequest__McpElicitationUntitledEnumItems = Schema.Struct({ + enum: Schema.Array(Schema.String), + type: ServerRequest__McpElicitationStringType, +}).annotate({ identifier: "ServerRequest__McpElicitationUntitledEnumItems" }); export type ServerRequest__McpElicitationLegacyTitledEnumSchema = { readonly default?: string | null; @@ -13149,7 +15694,29 @@ export const ServerRequest__McpElicitationLegacyTitledEnumSchema = Schema.Struct enumNames: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), type: ServerRequest__McpElicitationStringType, -}); +}).annotate({ identifier: "ServerRequest__McpElicitationLegacyTitledEnumSchema" }); + +export type ServerRequest__McpElicitationTitledSingleSelectEnumSchema = { + readonly default?: string | null; + readonly description?: string | null; + readonly oneOf: ReadonlyArray; + readonly title?: string | null; + readonly type: ServerRequest__McpElicitationStringType; +}; +export const ServerRequest__McpElicitationTitledSingleSelectEnumSchema = Schema.Struct({ + default: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + oneOf: Schema.Array(ServerRequest__McpElicitationConstOption), + title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: ServerRequest__McpElicitationStringType, +}).annotate({ identifier: "ServerRequest__McpElicitationTitledSingleSelectEnumSchema" }); + +export type ServerRequest__McpElicitationTitledEnumItems = { + readonly anyOf: ReadonlyArray; +}; +export const ServerRequest__McpElicitationTitledEnumItems = Schema.Struct({ + anyOf: Schema.Array(ServerRequest__McpElicitationConstOption), +}).annotate({ identifier: "ServerRequest__McpElicitationTitledEnumItems" }); export type ServerRequest__McpElicitationStringSchema = { readonly default?: string | null; @@ -13169,79 +15736,98 @@ export const ServerRequest__McpElicitationStringSchema = Schema.Struct({ maxLength: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), minLength: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), type: ServerRequest__McpElicitationStringType, -}); +}).annotate({ identifier: "ServerRequest__McpElicitationStringSchema" }); -export type ServerRequest__McpElicitationTitledSingleSelectEnumSchema = { - readonly default?: string | null; +export type ServerRequest__McpElicitationNumberSchema = { + readonly default?: number | null; readonly description?: string | null; - readonly oneOf: ReadonlyArray; + readonly maximum?: number | null; + readonly minimum?: number | null; readonly title?: string | null; - readonly type: ServerRequest__McpElicitationStringType; + readonly type: ServerRequest__McpElicitationNumberType; }; -export const ServerRequest__McpElicitationTitledSingleSelectEnumSchema = Schema.Struct({ - default: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +export const ServerRequest__McpElicitationNumberSchema = Schema.Struct({ + default: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "double" }).check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + Schema.Null, + ]), + ), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - oneOf: Schema.Array(ServerRequest__McpElicitationConstOption), + maximum: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "double" }).check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + Schema.Null, + ]), + ), + minimum: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "double" }).check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + Schema.Null, + ]), + ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: ServerRequest__McpElicitationStringType, -}); - -export type ServerRequest__McpElicitationUntitledEnumItems = { - readonly enum: ReadonlyArray; - readonly type: ServerRequest__McpElicitationStringType; -}; -export const ServerRequest__McpElicitationUntitledEnumItems = Schema.Struct({ - enum: Schema.Array(Schema.String), - type: ServerRequest__McpElicitationStringType, -}); + type: ServerRequest__McpElicitationNumberType, +}).annotate({ identifier: "ServerRequest__McpElicitationNumberSchema" }); -export type ServerRequest__McpElicitationUntitledSingleSelectEnumSchema = { - readonly default?: string | null; +export type ServerRequest__McpElicitationBooleanSchema = { + readonly default?: boolean | null; readonly description?: string | null; - readonly enum: ReadonlyArray; readonly title?: string | null; - readonly type: ServerRequest__McpElicitationStringType; + readonly type: ServerRequest__McpElicitationBooleanType; }; -export const ServerRequest__McpElicitationUntitledSingleSelectEnumSchema = Schema.Struct({ - default: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +export const ServerRequest__McpElicitationBooleanSchema = Schema.Struct({ + default: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - enum: Schema.Array(Schema.String), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: ServerRequest__McpElicitationStringType, -}); - -export type ServerRequest__NetworkApprovalContext = { - readonly host: string; - readonly protocol: ServerRequest__NetworkApprovalProtocol; -}; -export const ServerRequest__NetworkApprovalContext = Schema.Struct({ - host: Schema.String, - protocol: ServerRequest__NetworkApprovalProtocol, -}); + type: ServerRequest__McpElicitationBooleanType, +}).annotate({ identifier: "ServerRequest__McpElicitationBooleanSchema" }); -export type ServerRequest__NetworkPolicyAmendment = { - readonly action: ServerRequest__NetworkPolicyRuleAction; - readonly host: string; +export type ServerRequest__ChatgptAuthTokensRefreshParams = { + readonly previousAccountId?: string | null; + readonly reason: ServerRequest__ChatgptAuthTokensRefreshReason; }; -export const ServerRequest__NetworkPolicyAmendment = Schema.Struct({ - action: ServerRequest__NetworkPolicyRuleAction, - host: Schema.String, -}); +export const ServerRequest__ChatgptAuthTokensRefreshParams = Schema.Struct({ + previousAccountId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Workspace/account identifier that Codex was previously using.\n\nClients that manage multiple accounts/workspaces can use this as a hint to refresh the token for the correct workspace.\n\nThis may be `null` when the prior auth state did not include a workspace identifier (`chatgpt_account_id`).", + }), + Schema.Null, + ]), + ), + reason: ServerRequest__ChatgptAuthTokensRefreshReason, +}).annotate({ identifier: "ServerRequest__ChatgptAuthTokensRefreshParams" }); export type ServerRequest__ApplyPatchApprovalParams = { readonly callId: string; @@ -13274,7 +15860,7 @@ export const ServerRequest__ApplyPatchApprovalParams = Schema.Struct({ Schema.Null, ]), ), -}); +}).annotate({ identifier: "ServerRequest__ApplyPatchApprovalParams" }); export type ServerRequest__ExecCommandApprovalParams = { readonly approvalId?: string | null; @@ -13301,28 +15887,7 @@ export const ServerRequest__ExecCommandApprovalParams = Schema.Struct({ cwd: Schema.String, parsedCmd: Schema.Array(ServerRequest__ParsedCommand), reason: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type ServerRequest__ToolRequestUserInputQuestion = { - readonly header: string; - readonly id: string; - readonly isOther?: boolean; - readonly isSecret?: boolean; - readonly options?: ReadonlyArray | null; - readonly question: string; -}; -export const ServerRequest__ToolRequestUserInputQuestion = Schema.Struct({ - header: Schema.String, - id: Schema.String, - isOther: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - isSecret: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - options: Schema.optionalKey( - Schema.Union([Schema.Array(ServerRequest__ToolRequestUserInputOption), Schema.Null]), - ), - question: Schema.String, -}).annotate({ - description: "EXPERIMENTAL. Represents one request_user_input question and its required options.", -}); +}).annotate({ identifier: "ServerRequest__ExecCommandApprovalParams" }); export type ToolRequestUserInputParams__ToolRequestUserInputQuestion = { readonly header: string; @@ -13346,6 +15911,7 @@ export const ToolRequestUserInputParams__ToolRequestUserInputQuestion = Schema.S question: Schema.String, }).annotate({ description: "EXPERIMENTAL. Represents one request_user_input question and its required options.", + identifier: "ToolRequestUserInputParams__ToolRequestUserInputQuestion", }); export type V2AccountRateLimitsUpdatedNotification__RateLimitSnapshot = { @@ -13389,7 +15955,7 @@ export const V2AccountRateLimitsUpdatedNotification__RateLimitSnapshot = Schema. Schema.Null, ]), ), -}); +}).annotate({ identifier: "V2AccountRateLimitsUpdatedNotification__RateLimitSnapshot" }); export type V2AppListUpdatedNotification__AppMetadata = { readonly categories?: ReadonlyArray | null; @@ -13420,7 +15986,7 @@ export const V2AppListUpdatedNotification__AppMetadata = Schema.Struct({ version: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), versionId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), versionNotes: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2AppListUpdatedNotification__AppMetadata" }); export type V2AppsListResponse__AppMetadata = { readonly categories?: ReadonlyArray | null; @@ -13451,7 +16017,7 @@ export const V2AppsListResponse__AppMetadata = Schema.Struct({ version: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), versionId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), versionNotes: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2AppsListResponse__AppMetadata" }); export type V2AppsReadResponse__ConnectorMetadata = { readonly description?: string | null; @@ -13468,12 +16034,18 @@ export const V2AppsReadResponse__ConnectorMetadata = Schema.Struct({ toolSummaries: Schema.optionalKey( Schema.Union([Schema.Array(V2AppsReadResponse__AppToolSummary), Schema.Null]), ), -}).annotate({ description: "EXPERIMENTAL - metadata returned by app/read." }); +}).annotate({ + description: "EXPERIMENTAL - metadata returned by app/read.", + identifier: "V2AppsReadResponse__ConnectorMetadata", +}); export type V2CommandExecParams__SandboxPolicy = | { readonly type: "dangerFullAccess" } | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } + | { + readonly networkAccess?: V2CommandExecParams__NetworkAccess; + readonly type: "externalSandbox"; + } | { readonly excludeSlashTmp?: boolean; readonly excludeTmpdirEnvVar?: boolean; @@ -13494,7 +16066,10 @@ export const V2CommandExecParams__SandboxPolicy = Schema.Union( }).annotate({ title: "ReadOnlySandboxPolicy" }), Schema.Struct({ networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), + Schema.suspend( + (): Schema.Codec => + V2CommandExecParams__NetworkAccess, + ).annotate({ default: "restricted" }), ), type: Schema.Literal("externalSandbox").annotate({ title: "ExternalSandboxSandboxPolicyType", @@ -13511,24 +16086,43 @@ export const V2CommandExecParams__SandboxPolicy = Schema.Union( }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2CommandExecParams__SandboxPolicy" }); export type V2ConfigBatchWriteParams__ConfigEdit = { readonly keyPath: string; readonly mergeStrategy: V2ConfigBatchWriteParams__MergeStrategy; - readonly value: unknown; + readonly value: Schema.Json; }; export const V2ConfigBatchWriteParams__ConfigEdit = Schema.Struct({ keyPath: Schema.String, mergeStrategy: V2ConfigBatchWriteParams__MergeStrategy, - value: Schema.Unknown, -}); + value: Schema.Json.annotate({ expected: "JSON value" }), +}).annotate({ identifier: "V2ConfigBatchWriteParams__ConfigEdit" }); + +export type V2ConfigReadResponse__WebSearchToolConfig = { + readonly allowed_domains?: ReadonlyArray | null; + readonly context_size?: V2ConfigReadResponse__WebSearchContextSize | null; + readonly location?: V2ConfigReadResponse__WebSearchLocation | null; +}; +export const V2ConfigReadResponse__WebSearchToolConfig = Schema.Struct({ + allowed_domains: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + context_size: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__WebSearchContextSize, Schema.Null]), + ), + location: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__WebSearchLocation, Schema.Null]), + ), +}).annotate({ identifier: "V2ConfigReadResponse__WebSearchToolConfig" }); export type V2ConfigReadResponse__ConfigLayerSource = | { readonly domain: string; readonly key: string; readonly type: "mdm" } - | { readonly file: string; readonly type: "system" } + | { readonly file: V2ConfigReadResponse__AbsolutePathBuf; readonly type: "system" } | { readonly id: string; readonly name: string; readonly type: "enterpriseManaged" } - | { readonly file: string; readonly profile?: string | null; readonly type: "user" } + | { + readonly file: V2ConfigReadResponse__AbsolutePathBuf; + readonly profile?: string | null; + readonly type: "user"; + } | { readonly dotCodexFolder: V2ConfigReadResponse__AbsolutePathBuf; readonly type: "project" } | { readonly type: "sessionFlags" } | { @@ -13547,9 +16141,12 @@ export const V2ConfigReadResponse__ConfigLayerSource = Schema.Union( description: "Managed preferences layer delivered by MDM (macOS only).", }), Schema.Struct({ - file: Schema.String.annotate({ + file: Schema.suspend( + (): Schema.Codec => + V2ConfigReadResponse__AbsolutePathBuf, + ).annotate({ description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + "This is the path to the system config.toml file, though it is not guaranteed to exist.", }), type: Schema.Literal("system").annotate({ title: "SystemConfigLayerSourceType" }), }).annotate({ @@ -13570,9 +16167,12 @@ export const V2ConfigReadResponse__ConfigLayerSource = Schema.Union( description: "Enterprise-managed config layer delivered by the cloud config bundle.", }), Schema.Struct({ - file: Schema.String.annotate({ + file: Schema.suspend( + (): Schema.Codec => + V2ConfigReadResponse__AbsolutePathBuf, + ).annotate({ description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + "This is the path to the user's config.toml file, though it is not guaranteed to exist.", }), profile: Schema.optionalKey( Schema.Union([ @@ -13620,7 +16220,7 @@ export const V2ConfigReadResponse__ConfigLayerSource = Schema.Union( }).annotate({ title: "LegacyManagedConfigTomlFromMdmConfigLayerSource" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ConfigReadResponse__ConfigLayerSource" }); export type V2ConfigReadResponse__AppsDefaultConfig = { readonly approvals_reviewer?: V2ConfigReadResponse__ApprovalsReviewer | null; @@ -13639,31 +16239,7 @@ export const V2ConfigReadResponse__AppsDefaultConfig = Schema.Struct({ destructive_enabled: Schema.optionalKey(Schema.Boolean.annotate({ default: true })), enabled: Schema.optionalKey(Schema.Boolean.annotate({ default: true })), open_world_enabled: Schema.optionalKey(Schema.Boolean.annotate({ default: true })), -}); - -export type V2ConfigReadResponse__WebSearchToolConfig = { - readonly allowed_domains?: ReadonlyArray | null; - readonly context_size?: V2ConfigReadResponse__WebSearchContextSize | null; - readonly location?: V2ConfigReadResponse__WebSearchLocation | null; -}; -export const V2ConfigReadResponse__WebSearchToolConfig = Schema.Struct({ - allowed_domains: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - context_size: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__WebSearchContextSize, Schema.Null]), - ), - location: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__WebSearchLocation, Schema.Null]), - ), -}); - -export type V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup = { - readonly hooks: ReadonlyArray; - readonly matcher?: string | null; -}; -export const V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup = Schema.Struct({ - hooks: Schema.Array(V2ConfigRequirementsReadResponse__ConfiguredHookHandler), - matcher: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2ConfigReadResponse__AppsDefaultConfig" }); export type V2ConfigRequirementsReadResponse__NewThreadModelDefaults = { readonly model?: string | null; @@ -13676,7 +16252,16 @@ export const V2ConfigRequirementsReadResponse__NewThreadModelDefaults = Schema.S Schema.Union([V2ConfigRequirementsReadResponse__ReasoningEffort, Schema.Null]), ), serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__NewThreadModelDefaults" }); + +export type V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup = { + readonly hooks: ReadonlyArray; + readonly matcher?: string | null; +}; +export const V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup = Schema.Struct({ + hooks: Schema.Array(V2ConfigRequirementsReadResponse__ConfiguredHookHandler), + matcher: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup" }); export type V2ConfigWarningNotification__TextRange = { readonly end: V2ConfigWarningNotification__TextPosition; @@ -13685,13 +16270,17 @@ export type V2ConfigWarningNotification__TextRange = { export const V2ConfigWarningNotification__TextRange = Schema.Struct({ end: V2ConfigWarningNotification__TextPosition, start: V2ConfigWarningNotification__TextPosition, -}); +}).annotate({ identifier: "V2ConfigWarningNotification__TextRange" }); export type V2ConfigWriteResponse__ConfigLayerSource = | { readonly domain: string; readonly key: string; readonly type: "mdm" } - | { readonly file: string; readonly type: "system" } + | { readonly file: V2ConfigWriteResponse__AbsolutePathBuf; readonly type: "system" } | { readonly id: string; readonly name: string; readonly type: "enterpriseManaged" } - | { readonly file: string; readonly profile?: string | null; readonly type: "user" } + | { + readonly file: V2ConfigWriteResponse__AbsolutePathBuf; + readonly profile?: string | null; + readonly type: "user"; + } | { readonly dotCodexFolder: V2ConfigWriteResponse__AbsolutePathBuf; readonly type: "project" } | { readonly type: "sessionFlags" } | { @@ -13710,9 +16299,12 @@ export const V2ConfigWriteResponse__ConfigLayerSource = Schema.Union( description: "Managed preferences layer delivered by MDM (macOS only).", }), Schema.Struct({ - file: Schema.String.annotate({ + file: Schema.suspend( + (): Schema.Codec => + V2ConfigWriteResponse__AbsolutePathBuf, + ).annotate({ description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + "This is the path to the system config.toml file, though it is not guaranteed to exist.", }), type: Schema.Literal("system").annotate({ title: "SystemConfigLayerSourceType" }), }).annotate({ @@ -13733,9 +16325,12 @@ export const V2ConfigWriteResponse__ConfigLayerSource = Schema.Union( description: "Enterprise-managed config layer delivered by the cloud config bundle.", }), Schema.Struct({ - file: Schema.String.annotate({ + file: Schema.suspend( + (): Schema.Codec => + V2ConfigWriteResponse__AbsolutePathBuf, + ).annotate({ description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + "This is the path to the user's config.toml file, though it is not guaranteed to exist.", }), profile: Schema.optionalKey( Schema.Union([ @@ -13783,7 +16378,7 @@ export const V2ConfigWriteResponse__ConfigLayerSource = Schema.Union( }).annotate({ title: "LegacyManagedConfigTomlFromMdmConfigLayerSource" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ConfigWriteResponse__ConfigLayerSource" }); export type V2ErrorNotification__CodexErrorInfo = | "contextWindowExceeded" @@ -13826,8 +16421,12 @@ export const V2ErrorNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -13838,8 +16437,12 @@ export const V2ErrorNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -13853,8 +16456,12 @@ export const V2ErrorNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -13869,8 +16476,12 @@ export const V2ErrorNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -13893,8 +16504,61 @@ export const V2ErrorNotification__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ErrorNotification__CodexErrorInfo", }); +export type V2ExperimentalFeatureListResponse__ExperimentalFeature = { + readonly announcement?: string | null; + readonly defaultEnabled: boolean; + readonly description?: string | null; + readonly displayName?: string | null; + readonly enabled: boolean; + readonly name: string; + readonly stage: V2ExperimentalFeatureListResponse__ExperimentalFeatureStage; +}; +export const V2ExperimentalFeatureListResponse__ExperimentalFeature = Schema.Struct({ + announcement: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Announcement copy shown to users when the feature is introduced. Null when this feature is not in beta.", + }), + Schema.Null, + ]), + ), + defaultEnabled: Schema.Boolean.annotate({ + description: "Whether this feature is enabled by default.", + }), + description: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Short summary describing what the feature does. Null when this feature is not in beta.", + }), + Schema.Null, + ]), + ), + displayName: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "User-facing display name shown in the experimental features UI. Null when this feature is not in beta.", + }), + Schema.Null, + ]), + ), + enabled: Schema.Boolean.annotate({ + description: "Whether this feature is currently enabled in the loaded config.", + }), + name: Schema.String.annotate({ + description: "Stable key used in config.toml and CLI flag toggles.", + }), + stage: Schema.suspend( + (): Schema.Codec => + V2ExperimentalFeatureListResponse__ExperimentalFeatureStage, + ).annotate({ description: "Lifecycle stage of this feature flag." }), +}).annotate({ identifier: "V2ExperimentalFeatureListResponse__ExperimentalFeature" }); + export type V2ExternalAgentConfigDetectResponse__MigrationDetails = { readonly commands?: ReadonlyArray; readonly hooks?: ReadonlyArray; @@ -13928,7 +16592,7 @@ export const V2ExternalAgentConfigDetectResponse__MigrationDetails = Schema.Stru subagents: Schema.optionalKey( Schema.Array(V2ExternalAgentConfigDetectResponse__SubagentMigration).annotate({ default: [] }), ), -}); +}).annotate({ identifier: "V2ExternalAgentConfigDetectResponse__MigrationDetails" }); export type V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigImportItemTypeFailure = { @@ -13950,6 +16614,9 @@ export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConf message: Schema.String, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), subErrorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigImportItemTypeFailure", }); export type V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigImportItemTypeSuccess = @@ -13966,6 +16633,31 @@ export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConf V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigImportItemTypeSuccess", + }); + +export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorCandidate = + { + readonly name: string; + readonly sessionCount: number; + readonly source: V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorSource; + }; +export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorCandidate = + Schema.Struct({ + name: Schema.String, + sessionCount: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + source: V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorSource, + }).annotate({ + identifier: + "V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorCandidate", }); export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeFailure = @@ -13988,6 +16680,9 @@ export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConf message: Schema.String, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), subErrorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeFailure", }); export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeSuccess = @@ -14004,21 +16699,9 @@ export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConf V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - }); - -export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorCandidate = - { - readonly name: string; - readonly sessionCount: number; - readonly source: V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorSource; - }; -export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorCandidate = - Schema.Struct({ - name: Schema.String, - sessionCount: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - source: V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentImportedConnectorSource, + }).annotate({ + identifier: + "V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeSuccess", }); export type V2ExternalAgentConfigImportParams__MigrationDetails = { @@ -14054,7 +16737,7 @@ export const V2ExternalAgentConfigImportParams__MigrationDetails = Schema.Struct subagents: Schema.optionalKey( Schema.Array(V2ExternalAgentConfigImportParams__SubagentMigration).annotate({ default: [] }), ), -}); +}).annotate({ identifier: "V2ExternalAgentConfigImportParams__MigrationDetails" }); export type V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigImportItemTypeFailure = { @@ -14075,6 +16758,9 @@ export const V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfi message: Schema.String, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), subErrorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigImportItemTypeFailure", }); export type V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigImportItemTypeSuccess = @@ -14090,6 +16776,9 @@ export const V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfi itemType: V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigMigrationItemType, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigImportItemTypeSuccess", }); export type V2FileChangePatchUpdatedNotification__FileUpdateChange = { @@ -14101,7 +16790,7 @@ export const V2FileChangePatchUpdatedNotification__FileUpdateChange = Schema.Str diff: Schema.String, kind: V2FileChangePatchUpdatedNotification__PatchChangeKind, path: Schema.String, -}); +}).annotate({ identifier: "V2FileChangePatchUpdatedNotification__FileUpdateChange" }); export type V2GetAccountRateLimitsResponse__RateLimitResetCredit = { readonly description?: string | null; @@ -14128,14 +16817,14 @@ export const V2GetAccountRateLimitsResponse__RateLimitResetCredit = Schema.Struc description: "Unix timestamp in seconds when the credit expires, or `null` if it does not expire.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), grantedAt: Schema.Number.annotate({ description: "Unix timestamp in seconds when the credit was granted.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), id: Schema.String.annotate({ description: "Opaque backend identifier for this reset credit." }), resetType: V2GetAccountRateLimitsResponse__RateLimitResetType, status: V2GetAccountRateLimitsResponse__RateLimitResetCreditStatus, @@ -14147,7 +16836,7 @@ export const V2GetAccountRateLimitsResponse__RateLimitResetCredit = Schema.Struc Schema.Null, ]), ), -}); +}).annotate({ identifier: "V2GetAccountRateLimitsResponse__RateLimitResetCredit" }); export type V2GetAccountRateLimitsResponse__RateLimitSnapshot = { readonly credits?: V2GetAccountRateLimitsResponse__CreditsSnapshot | null; @@ -14190,7 +16879,7 @@ export const V2GetAccountRateLimitsResponse__RateLimitSnapshot = Schema.Struct({ Schema.Null, ]), ), -}); +}).annotate({ identifier: "V2GetAccountRateLimitsResponse__RateLimitSnapshot" }); export type V2GetAccountResponse__Account = | { readonly type: "apiKey" } @@ -14216,7 +16905,7 @@ export const V2GetAccountResponse__Account = Schema.Union( }).annotate({ title: "AmazonBedrockAccount" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2GetAccountResponse__Account" }); export type V2GetWorkspaceMessagesResponse__WorkspaceMessage = { readonly archivedAt?: number | null; @@ -14231,7 +16920,7 @@ export const V2GetWorkspaceMessagesResponse__WorkspaceMessage = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the message was archived.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -14240,14 +16929,14 @@ export const V2GetWorkspaceMessagesResponse__WorkspaceMessage = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the message was created.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), messageBody: Schema.String, messageId: Schema.String, messageType: V2GetWorkspaceMessagesResponse__WorkspaceMessageType, -}); +}).annotate({ identifier: "V2GetWorkspaceMessagesResponse__WorkspaceMessage" }); export type V2HookCompletedNotification__HookOutputEntry = { readonly kind: V2HookCompletedNotification__HookOutputEntryKind; @@ -14256,7 +16945,7 @@ export type V2HookCompletedNotification__HookOutputEntry = { export const V2HookCompletedNotification__HookOutputEntry = Schema.Struct({ kind: V2HookCompletedNotification__HookOutputEntryKind, text: Schema.String, -}); +}).annotate({ identifier: "V2HookCompletedNotification__HookOutputEntry" }); export type V2HooksListResponse__HookMetadata = { readonly command?: string | null; @@ -14278,7 +16967,9 @@ export type V2HooksListResponse__HookMetadata = { export const V2HooksListResponse__HookMetadata = Schema.Struct({ command: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), currentHash: Schema.String, - displayOrder: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + displayOrder: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), enabled: Schema.Boolean, eventName: V2HooksListResponse__HookEventName, handlerType: V2HooksListResponse__HookHandlerType, @@ -14290,10 +16981,12 @@ export const V2HooksListResponse__HookMetadata = Schema.Struct({ sourcePath: V2HooksListResponse__AbsolutePathBuf, statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), timeoutSec: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), trustStatus: V2HooksListResponse__HookTrustStatus, -}); +}).annotate({ identifier: "V2HooksListResponse__HookMetadata" }); export type V2HookStartedNotification__HookOutputEntry = { readonly kind: V2HookStartedNotification__HookOutputEntryKind; @@ -14302,7 +16995,35 @@ export type V2HookStartedNotification__HookOutputEntry = { export const V2HookStartedNotification__HookOutputEntry = Schema.Struct({ kind: V2HookStartedNotification__HookOutputEntryKind, text: Schema.String, -}); +}).annotate({ identifier: "V2HookStartedNotification__HookOutputEntry" }); + +export type V2ItemCompletedNotification__TextElement = { + readonly byteRange: V2ItemCompletedNotification__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ItemCompletedNotification__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => + V2ItemCompletedNotification__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ItemCompletedNotification__TextElement" }); + +export type V2ItemCompletedNotification__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ItemCompletedNotification__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ItemCompletedNotification__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ItemCompletedNotification__MemoryCitation" }); export type V2ItemCompletedNotification__CommandAction = | { @@ -14344,25 +17065,7 @@ export const V2ItemCompletedNotification__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); - -export type V2ItemCompletedNotification__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ItemCompletedNotification__CollabAgentStatus; -}; -export const V2ItemCompletedNotification__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ItemCompletedNotification__CollabAgentStatus, -}); - -export type V2ItemCompletedNotification__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ItemCompletedNotification__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ItemCompletedNotification__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +).annotate({ identifier: "V2ItemCompletedNotification__CommandAction" }); export type V2ItemCompletedNotification__FileUpdateChange = { readonly diff: string; @@ -14373,102 +17076,16 @@ export const V2ItemCompletedNotification__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ItemCompletedNotification__PatchChangeKind, path: Schema.String, -}); - -export type V2ItemCompletedNotification__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2ItemCompletedNotification__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2ItemCompletedNotification__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ItemCompletedNotification__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ItemCompletedNotification__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), - ), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); +}).annotate({ identifier: "V2ItemCompletedNotification__FileUpdateChange" }); -export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReview = { - readonly rationale?: string | null; - readonly riskLevel?: V2ItemGuardianApprovalReviewCompletedNotification__GuardianRiskLevel | null; - readonly status: V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewStatus; - readonly userAuthorization?: V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAuthorization | null; +export type V2ItemCompletedNotification__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ItemCompletedNotification__CollabAgentStatus; }; -export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReview = - Schema.Struct({ - rationale: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - riskLevel: Schema.optionalKey( - Schema.Union([ - V2ItemGuardianApprovalReviewCompletedNotification__GuardianRiskLevel, - Schema.Null, - ]), - ), - status: V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewStatus, - userAuthorization: Schema.optionalKey( - Schema.Union([ - V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAuthorization, - Schema.Null, - ]), - ), - }).annotate({ - description: - "[UNSTABLE] Temporary approval auto-review payload used by `item/autoApprovalReview/*` notifications. This shape is expected to change soon.", - }); +export const V2ItemCompletedNotification__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ItemCompletedNotification__CollabAgentStatus, +}).annotate({ identifier: "V2ItemCompletedNotification__CollabAgentState" }); export type V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSpecialPath = | { readonly kind: "root" } @@ -14520,33 +17137,36 @@ export const V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSpecia }), ], { mode: "oneOf" }, - ); + ).annotate({ + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSpecialPath", + }); -export type V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReview = { +export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReview = { readonly rationale?: string | null; - readonly riskLevel?: V2ItemGuardianApprovalReviewStartedNotification__GuardianRiskLevel | null; - readonly status: V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewStatus; - readonly userAuthorization?: V2ItemGuardianApprovalReviewStartedNotification__GuardianUserAuthorization | null; + readonly riskLevel?: V2ItemGuardianApprovalReviewCompletedNotification__GuardianRiskLevel | null; + readonly status: V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewStatus; + readonly userAuthorization?: V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAuthorization | null; }; -export const V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReview = +export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReview = Schema.Struct({ rationale: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), riskLevel: Schema.optionalKey( Schema.Union([ - V2ItemGuardianApprovalReviewStartedNotification__GuardianRiskLevel, + V2ItemGuardianApprovalReviewCompletedNotification__GuardianRiskLevel, Schema.Null, ]), ), - status: V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewStatus, + status: V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewStatus, userAuthorization: Schema.optionalKey( Schema.Union([ - V2ItemGuardianApprovalReviewStartedNotification__GuardianUserAuthorization, + V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAuthorization, Schema.Null, ]), ), }).annotate({ description: "[UNSTABLE] Temporary approval auto-review payload used by `item/autoApprovalReview/*` notifications. This shape is expected to change soon.", + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReview", }); export type V2ItemGuardianApprovalReviewStartedNotification__FileSystemSpecialPath = @@ -14598,7 +17218,64 @@ export const V2ItemGuardianApprovalReviewStartedNotification__FileSystemSpecialP }), ], { mode: "oneOf" }, -); +).annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__FileSystemSpecialPath", +}); + +export type V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReview = { + readonly rationale?: string | null; + readonly riskLevel?: V2ItemGuardianApprovalReviewStartedNotification__GuardianRiskLevel | null; + readonly status: V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewStatus; + readonly userAuthorization?: V2ItemGuardianApprovalReviewStartedNotification__GuardianUserAuthorization | null; +}; +export const V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReview = + Schema.Struct({ + rationale: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + riskLevel: Schema.optionalKey( + Schema.Union([ + V2ItemGuardianApprovalReviewStartedNotification__GuardianRiskLevel, + Schema.Null, + ]), + ), + status: V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewStatus, + userAuthorization: Schema.optionalKey( + Schema.Union([ + V2ItemGuardianApprovalReviewStartedNotification__GuardianUserAuthorization, + Schema.Null, + ]), + ), + }).annotate({ + description: + "[UNSTABLE] Temporary approval auto-review payload used by `item/autoApprovalReview/*` notifications. This shape is expected to change soon.", + identifier: "V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReview", + }); + +export type V2ItemStartedNotification__TextElement = { + readonly byteRange: V2ItemStartedNotification__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ItemStartedNotification__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ItemStartedNotification__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ItemStartedNotification__TextElement" }); + +export type V2ItemStartedNotification__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ItemStartedNotification__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ItemStartedNotification__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ItemStartedNotification__MemoryCitation" }); export type V2ItemStartedNotification__CommandAction = | { @@ -14640,25 +17317,7 @@ export const V2ItemStartedNotification__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); - -export type V2ItemStartedNotification__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ItemStartedNotification__CollabAgentStatus; -}; -export const V2ItemStartedNotification__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ItemStartedNotification__CollabAgentStatus, -}); - -export type V2ItemStartedNotification__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ItemStartedNotification__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ItemStartedNotification__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +).annotate({ identifier: "V2ItemStartedNotification__CommandAction" }); export type V2ItemStartedNotification__FileUpdateChange = { readonly diff: string; @@ -14669,75 +17328,16 @@ export const V2ItemStartedNotification__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ItemStartedNotification__PatchChangeKind, path: Schema.String, -}); +}).annotate({ identifier: "V2ItemStartedNotification__FileUpdateChange" }); -export type V2ItemStartedNotification__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2ItemStartedNotification__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2ItemStartedNotification__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ItemStartedNotification__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ItemStartedNotification__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), - ), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); +export type V2ItemStartedNotification__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ItemStartedNotification__CollabAgentStatus; +}; +export const V2ItemStartedNotification__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ItemStartedNotification__CollabAgentStatus, +}).annotate({ identifier: "V2ItemStartedNotification__CollabAgentState" }); export type V2ListMcpServerStatusResponse__McpServerStatus = { readonly authStatus: V2ListMcpServerStatusResponse__McpAuthStatus; @@ -14756,7 +17356,7 @@ export const V2ListMcpServerStatusResponse__McpServerStatus = Schema.Struct({ Schema.Union([V2ListMcpServerStatusResponse__McpServerInfo, Schema.Null]), ), tools: Schema.Record(Schema.String, V2ListMcpServerStatusResponse__Tool), -}); +}).annotate({ identifier: "V2ListMcpServerStatusResponse__McpServerStatus" }); export type V2ModelListResponse__ReasoningEffortOption = { readonly description: string; @@ -14765,7 +17365,7 @@ export type V2ModelListResponse__ReasoningEffortOption = { export const V2ModelListResponse__ReasoningEffortOption = Schema.Struct({ description: Schema.String, reasoningEffort: V2ModelListResponse__ReasoningEffort, -}); +}).annotate({ identifier: "V2ModelListResponse__ReasoningEffortOption" }); export type V2PluginInstalledResponse__MarketplaceLoadErrorInfo = { readonly marketplacePath: V2PluginInstalledResponse__AbsolutePathBuf; @@ -14774,7 +17374,7 @@ export type V2PluginInstalledResponse__MarketplaceLoadErrorInfo = { export const V2PluginInstalledResponse__MarketplaceLoadErrorInfo = Schema.Struct({ marketplacePath: V2PluginInstalledResponse__AbsolutePathBuf, message: Schema.String, -}); +}).annotate({ identifier: "V2PluginInstalledResponse__MarketplaceLoadErrorInfo" }); export type V2PluginInstalledResponse__PluginInterface = { readonly brandColor?: string | null; @@ -14856,7 +17456,7 @@ export const V2PluginInstalledResponse__PluginInterface = Schema.Struct({ shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), termsOfServiceUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), websiteUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2PluginInstalledResponse__PluginInterface" }); export type V2PluginInstalledResponse__PluginSource = | { readonly path: V2PluginInstalledResponse__AbsolutePathBuf; readonly type: "local" } @@ -14915,7 +17515,7 @@ export const V2PluginInstalledResponse__PluginSource = Schema.Union( }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2PluginInstalledResponse__PluginSource" }); export type V2PluginInstalledResponse__PluginSharePrincipal = { readonly name: string; @@ -14928,7 +17528,7 @@ export const V2PluginInstalledResponse__PluginSharePrincipal = Schema.Struct({ principalId: Schema.String, principalType: V2PluginInstalledResponse__PluginSharePrincipalType, role: V2PluginInstalledResponse__PluginSharePrincipalRole, -}); +}).annotate({ identifier: "V2PluginInstalledResponse__PluginSharePrincipal" }); export type V2PluginListResponse__MarketplaceLoadErrorInfo = { readonly marketplacePath: V2PluginListResponse__AbsolutePathBuf; @@ -14937,7 +17537,7 @@ export type V2PluginListResponse__MarketplaceLoadErrorInfo = { export const V2PluginListResponse__MarketplaceLoadErrorInfo = Schema.Struct({ marketplacePath: V2PluginListResponse__AbsolutePathBuf, message: Schema.String, -}); +}).annotate({ identifier: "V2PluginListResponse__MarketplaceLoadErrorInfo" }); export type V2PluginListResponse__PluginInterface = { readonly brandColor?: string | null; @@ -15019,7 +17619,7 @@ export const V2PluginListResponse__PluginInterface = Schema.Struct({ shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), termsOfServiceUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), websiteUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2PluginListResponse__PluginInterface" }); export type V2PluginListResponse__PluginSource = | { readonly path: V2PluginListResponse__AbsolutePathBuf; readonly type: "local" } @@ -15078,7 +17678,7 @@ export const V2PluginListResponse__PluginSource = Schema.Union( }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2PluginListResponse__PluginSource" }); export type V2PluginListResponse__PluginSharePrincipal = { readonly name: string; @@ -15091,7 +17691,58 @@ export const V2PluginListResponse__PluginSharePrincipal = Schema.Struct({ principalId: Schema.String, principalType: V2PluginListResponse__PluginSharePrincipalType, role: V2PluginListResponse__PluginSharePrincipalRole, -}); +}).annotate({ identifier: "V2PluginListResponse__PluginSharePrincipal" }); + +export type V2PluginReadResponse__AppTemplateSummary = { + readonly canonicalConnectorId?: string | null; + readonly category?: string | null; + readonly description?: string | null; + readonly logoUrl?: string | null; + readonly logoUrlDark?: string | null; + readonly materializedAppIds: ReadonlyArray; + readonly name: string; + readonly reason?: V2PluginReadResponse__AppTemplateUnavailableReason | null; + readonly templateId: string; +}; +export const V2PluginReadResponse__AppTemplateSummary = Schema.Struct({ + canonicalConnectorId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + category: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + logoUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + logoUrlDark: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + materializedAppIds: Schema.Array(Schema.String), + name: Schema.String, + reason: Schema.optionalKey( + Schema.Union([V2PluginReadResponse__AppTemplateUnavailableReason, Schema.Null]), + ), + templateId: Schema.String, +}).annotate({ identifier: "V2PluginReadResponse__AppTemplateSummary" }); + +export type V2PluginReadResponse__PluginHookSummary = { + readonly eventName: V2PluginReadResponse__HookEventName; + readonly key: string; +}; +export const V2PluginReadResponse__PluginHookSummary = Schema.Struct({ + eventName: V2PluginReadResponse__HookEventName, + key: Schema.String, +}).annotate({ identifier: "V2PluginReadResponse__PluginHookSummary" }); + +export type V2PluginReadResponse__SkillInterface = { + readonly brandColor?: string | null; + readonly defaultPrompt?: string | null; + readonly displayName?: string | null; + readonly iconLarge?: V2PluginReadResponse__AbsolutePathBuf | null; + readonly iconSmall?: V2PluginReadResponse__AbsolutePathBuf | null; + readonly shortDescription?: string | null; +}; +export const V2PluginReadResponse__SkillInterface = Schema.Struct({ + brandColor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + defaultPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + displayName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + iconLarge: Schema.optionalKey(Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null])), + iconSmall: Schema.optionalKey(Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null])), + shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2PluginReadResponse__SkillInterface" }); export type V2PluginReadResponse__PluginInterface = { readonly brandColor?: string | null; @@ -15173,7 +17824,7 @@ export const V2PluginReadResponse__PluginInterface = Schema.Struct({ shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), termsOfServiceUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), websiteUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2PluginReadResponse__PluginInterface" }); export type V2PluginReadResponse__PluginSource = | { readonly path: V2PluginReadResponse__AbsolutePathBuf; readonly type: "local" } @@ -15232,71 +17883,7 @@ export const V2PluginReadResponse__PluginSource = Schema.Union( }), ], { mode: "oneOf" }, -); - -export type V2PluginReadResponse__SkillInterface = { - readonly brandColor?: string | null; - readonly defaultPrompt?: string | null; - readonly displayName?: string | null; - readonly iconLarge?: V2PluginReadResponse__AbsolutePathBuf | null; - readonly iconSmall?: V2PluginReadResponse__AbsolutePathBuf | null; - readonly shortDescription?: string | null; -}; -export const V2PluginReadResponse__SkillInterface = Schema.Struct({ - brandColor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - defaultPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - displayName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - iconLarge: Schema.optionalKey(Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null])), - iconSmall: Schema.optionalKey(Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null])), - shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2PluginReadResponse__AppTemplateSummary = { - readonly canonicalConnectorId?: string | null; - readonly category?: string | null; - readonly description?: string | null; - readonly logoUrl?: string | null; - readonly logoUrlDark?: string | null; - readonly materializedAppIds: ReadonlyArray; - readonly name: string; - readonly reason?: V2PluginReadResponse__AppTemplateUnavailableReason | null; - readonly templateId: string; -}; -export const V2PluginReadResponse__AppTemplateSummary = Schema.Struct({ - canonicalConnectorId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - category: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - logoUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - logoUrlDark: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - materializedAppIds: Schema.Array(Schema.String), - name: Schema.String, - reason: Schema.optionalKey( - Schema.Union([V2PluginReadResponse__AppTemplateUnavailableReason, Schema.Null]), - ), - templateId: Schema.String, -}); - -export type V2PluginReadResponse__PluginHookSummary = { - readonly eventName: V2PluginReadResponse__HookEventName; - readonly key: string; -}; -export const V2PluginReadResponse__PluginHookSummary = Schema.Struct({ - eventName: V2PluginReadResponse__HookEventName, - key: Schema.String, -}); - -export type V2PluginReadResponse__PluginSharePrincipal = { - readonly name: string; - readonly principalId: string; - readonly principalType: V2PluginReadResponse__PluginSharePrincipalType; - readonly role: V2PluginReadResponse__PluginSharePrincipalRole; -}; -export const V2PluginReadResponse__PluginSharePrincipal = Schema.Struct({ - name: Schema.String, - principalId: Schema.String, - principalType: V2PluginReadResponse__PluginSharePrincipalType, - role: V2PluginReadResponse__PluginSharePrincipalRole, -}); +).annotate({ identifier: "V2PluginReadResponse__PluginSource" }); export type V2PluginReadResponse__ScheduledTaskSchedule = | { @@ -15318,8 +17905,12 @@ export const V2PluginReadResponse__ScheduledTaskSchedule = Schema.Union( Schema.Union([Schema.Array(V2PluginReadResponse__ScheduledTaskWeekday), Schema.Null]), ), intervalHours: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), type: Schema.Literal("hourly").annotate({ title: "HourlyScheduledTaskScheduleType" }), }).annotate({ title: "HourlyScheduledTaskSchedule" }), Schema.Struct({ @@ -15337,7 +17928,20 @@ export const V2PluginReadResponse__ScheduledTaskSchedule = Schema.Union( }).annotate({ title: "WeeklyScheduledTaskSchedule" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2PluginReadResponse__ScheduledTaskSchedule" }); + +export type V2PluginReadResponse__PluginSharePrincipal = { + readonly name: string; + readonly principalId: string; + readonly principalType: V2PluginReadResponse__PluginSharePrincipalType; + readonly role: V2PluginReadResponse__PluginSharePrincipalRole; +}; +export const V2PluginReadResponse__PluginSharePrincipal = Schema.Struct({ + name: Schema.String, + principalId: Schema.String, + principalType: V2PluginReadResponse__PluginSharePrincipalType, + role: V2PluginReadResponse__PluginSharePrincipalRole, +}).annotate({ identifier: "V2PluginReadResponse__PluginSharePrincipal" }); export type V2PluginShareListResponse__PluginInterface = { readonly brandColor?: string | null; @@ -15419,7 +18023,7 @@ export const V2PluginShareListResponse__PluginInterface = Schema.Struct({ shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), termsOfServiceUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), websiteUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2PluginShareListResponse__PluginInterface" }); export type V2PluginShareListResponse__PluginSource = | { readonly path: V2PluginShareListResponse__AbsolutePathBuf; readonly type: "local" } @@ -15478,7 +18082,7 @@ export const V2PluginShareListResponse__PluginSource = Schema.Union( }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2PluginShareListResponse__PluginSource" }); export type V2PluginShareListResponse__PluginSharePrincipal = { readonly name: string; @@ -15491,7 +18095,7 @@ export const V2PluginShareListResponse__PluginSharePrincipal = Schema.Struct({ principalId: Schema.String, principalType: V2PluginShareListResponse__PluginSharePrincipalType, role: V2PluginShareListResponse__PluginSharePrincipalRole, -}); +}).annotate({ identifier: "V2PluginShareListResponse__PluginSharePrincipal" }); export type V2PluginShareSaveParams__PluginShareTarget = { readonly principalId: string; @@ -15502,7 +18106,7 @@ export const V2PluginShareSaveParams__PluginShareTarget = Schema.Struct({ principalId: Schema.String, principalType: V2PluginShareSaveParams__PluginSharePrincipalType, role: V2PluginShareSaveParams__PluginShareTargetRole, -}); +}).annotate({ identifier: "V2PluginShareSaveParams__PluginShareTarget" }); export type V2PluginShareUpdateTargetsParams__PluginShareTarget = { readonly principalId: string; @@ -15513,7 +18117,7 @@ export const V2PluginShareUpdateTargetsParams__PluginShareTarget = Schema.Struct principalId: Schema.String, principalType: V2PluginShareUpdateTargetsParams__PluginSharePrincipalType, role: V2PluginShareUpdateTargetsParams__PluginShareTargetRole, -}); +}).annotate({ identifier: "V2PluginShareUpdateTargetsParams__PluginShareTarget" }); export type V2PluginShareUpdateTargetsResponse__PluginSharePrincipal = { readonly name: string; @@ -15526,7 +18130,7 @@ export const V2PluginShareUpdateTargetsResponse__PluginSharePrincipal = Schema.S principalId: Schema.String, principalType: V2PluginShareUpdateTargetsResponse__PluginSharePrincipalType, role: V2PluginShareUpdateTargetsResponse__PluginSharePrincipalRole, -}); +}).annotate({ identifier: "V2PluginShareUpdateTargetsResponse__PluginSharePrincipal" }); export type V2RawResponseItemCompletedNotification__ContentItem = | { readonly text: string; readonly type: "input_text" } @@ -15560,7 +18164,7 @@ export const V2RawResponseItemCompletedNotification__ContentItem = Schema.Union( }).annotate({ title: "OutputTextContentItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2RawResponseItemCompletedNotification__ContentItem" }); export type V2RawResponseItemCompletedNotification__FunctionCallOutputContentItem = | { readonly text: string; readonly type: "input_text" } @@ -15605,66 +18209,7 @@ export const V2RawResponseItemCompletedNotification__FunctionCallOutputContentIt ).annotate({ description: "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", -}); - -export type V2ReviewStartResponse__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: V2ReviewStartResponse__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } - | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const V2ReviewStartResponse__CommandAction = Schema.Union( - [ - Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: V2ReviewStartResponse__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), - Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), - ], - { mode: "oneOf" }, -); - -export type V2ReviewStartResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ReviewStartResponse__CollabAgentStatus; -}; -export const V2ReviewStartResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ReviewStartResponse__CollabAgentStatus, -}); - -export type V2ReviewStartResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ReviewStartResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ReviewStartResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), + identifier: "V2RawResponseItemCompletedNotification__FunctionCallOutputContentItem", }); export type V2ReviewStartResponse__CodexErrorInfo = @@ -15708,8 +18253,12 @@ export const V2ReviewStartResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -15720,8 +18269,12 @@ export const V2ReviewStartResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -15735,8 +18288,12 @@ export const V2ReviewStartResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -15751,8 +18308,12 @@ export const V2ReviewStartResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -15775,82 +18336,104 @@ export const V2ReviewStartResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ReviewStartResponse__CodexErrorInfo", }); -export type V2ReviewStartResponse__FileUpdateChange = { - readonly diff: string; - readonly kind: V2ReviewStartResponse__PatchChangeKind; - readonly path: string; +export type V2ReviewStartResponse__TextElement = { + readonly byteRange: V2ReviewStartResponse__ByteRange; + readonly placeholder?: string | null; }; -export const V2ReviewStartResponse__FileUpdateChange = Schema.Struct({ - diff: Schema.String, - kind: V2ReviewStartResponse__PatchChangeKind, - path: Schema.String, -}); +export const V2ReviewStartResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ReviewStartResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ReviewStartResponse__TextElement" }); -export type V2ReviewStartResponse__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } +export type V2ReviewStartResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ReviewStartResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ReviewStartResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ReviewStartResponse__MemoryCitation" }); + +export type V2ReviewStartResponse__CommandAction = | { - readonly detail?: V2ReviewStartResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; + readonly command: string; + readonly name: string; + readonly path: V2ReviewStartResponse__AbsolutePathBuf; + readonly type: "read"; } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } | { - readonly detail?: V2ReviewStartResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ReviewStartResponse__UserInput = Schema.Union( + | { readonly command: string; readonly type: "unknown" }; +export const V2ReviewStartResponse__CommandAction = Schema.Union( [ Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ReviewStartResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), + command: Schema.String, + name: Schema.String, + path: V2ReviewStartResponse__AbsolutePathBuf, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ReviewStartResponse__CommandAction" }); + +export type V2ReviewStartResponse__FileUpdateChange = { + readonly diff: string; + readonly kind: V2ReviewStartResponse__PatchChangeKind; + readonly path: string; +}; +export const V2ReviewStartResponse__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: V2ReviewStartResponse__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "V2ReviewStartResponse__FileUpdateChange" }); + +export type V2ReviewStartResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ReviewStartResponse__CollabAgentStatus; +}; +export const V2ReviewStartResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ReviewStartResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ReviewStartResponse__CollabAgentState" }); + +export type V2SkillsListResponse__SkillDependencies = { + readonly tools: ReadonlyArray; +}; +export const V2SkillsListResponse__SkillDependencies = Schema.Struct({ + tools: Schema.Array(V2SkillsListResponse__SkillToolDependency), +}).annotate({ identifier: "V2SkillsListResponse__SkillDependencies" }); export type V2SkillsListResponse__SkillInterface = { readonly brandColor?: string | null; @@ -15867,14 +18450,7 @@ export const V2SkillsListResponse__SkillInterface = Schema.Struct({ iconLarge: Schema.optionalKey(Schema.Union([V2SkillsListResponse__AbsolutePathBuf, Schema.Null])), iconSmall: Schema.optionalKey(Schema.Union([V2SkillsListResponse__AbsolutePathBuf, Schema.Null])), shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2SkillsListResponse__SkillDependencies = { - readonly tools: ReadonlyArray; -}; -export const V2SkillsListResponse__SkillDependencies = Schema.Struct({ - tools: Schema.Array(V2SkillsListResponse__SkillToolDependency), -}); +}).annotate({ identifier: "V2SkillsListResponse__SkillInterface" }); export type V2ThreadForkResponse__CommandAction = | { @@ -15916,25 +18492,118 @@ export const V2ThreadForkResponse__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadForkResponse__CommandAction" }); -export type V2ThreadForkResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadForkResponse__CollabAgentStatus; -}; -export const V2ThreadForkResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadForkResponse__CollabAgentStatus, -}); +export type V2ThreadForkResponse__SandboxPolicy = + | { readonly type: "dangerFullAccess" } + | { readonly networkAccess?: boolean; readonly type: "readOnly" } + | { + readonly networkAccess?: V2ThreadForkResponse__NetworkAccess; + readonly type: "externalSandbox"; + } + | { + readonly excludeSlashTmp?: boolean; + readonly excludeTmpdirEnvVar?: boolean; + readonly networkAccess?: boolean; + readonly type: "workspaceWrite"; + readonly writableRoots?: ReadonlyArray; + }; +export const V2ThreadForkResponse__SandboxPolicy = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("dangerFullAccess").annotate({ + title: "DangerFullAccessSandboxPolicyType", + }), + }).annotate({ title: "DangerFullAccessSandboxPolicy" }), + Schema.Struct({ + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), + }).annotate({ title: "ReadOnlySandboxPolicy" }), + Schema.Struct({ + networkAccess: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__NetworkAccess, + ).annotate({ default: "restricted" }), + ), + type: Schema.Literal("externalSandbox").annotate({ + title: "ExternalSandboxSandboxPolicyType", + }), + }).annotate({ title: "ExternalSandboxSandboxPolicy" }), + Schema.Struct({ + excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), + writableRoots: Schema.optionalKey( + Schema.Array(V2ThreadForkResponse__AbsolutePathBuf).annotate({ default: [] }), + ), + }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadForkResponse__SandboxPolicy" }); -export type V2ThreadForkResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ThreadForkResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadForkResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +export type V2ThreadForkResponse__SubAgentSource = + | "review" + | "compact" + | "memory_consolidation" + | { + readonly thread_spawn: { + readonly agent_nickname?: string | null; + readonly agent_path?: V2ThreadForkResponse__AgentPath | null; + readonly agent_role?: string | null; + readonly depth: number; + readonly parent_thread_id: V2ThreadForkResponse__ThreadId; + }; + } + | { readonly other: string }; +export const V2ThreadForkResponse__SubAgentSource = Schema.Union( + [ + Schema.Literals(["review", "compact", "memory_consolidation"]), + Schema.Struct({ + thread_spawn: Schema.Struct({ + agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + agent_path: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__AgentPath, Schema.Null]), + ), + agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadForkResponse__ThreadId, + }), + }).annotate({ title: "ThreadSpawnSubAgentSource" }), + Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadForkResponse__SubAgentSource" }); + +export type V2ThreadForkResponse__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } + | { + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadForkResponse__ThreadStatus = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), + Schema.Struct({ + activeFlags: Schema.Array(V2ThreadForkResponse__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadForkResponse__ThreadStatus" }); export type V2ThreadForkResponse__CodexErrorInfo = | "contextWindowExceeded" @@ -15981,8 +18650,12 @@ export const V2ThreadForkResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -15993,8 +18666,12 @@ export const V2ThreadForkResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16008,8 +18685,12 @@ export const V2ThreadForkResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16024,8 +18705,12 @@ export const V2ThreadForkResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16048,8 +18733,36 @@ export const V2ThreadForkResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ThreadForkResponse__CodexErrorInfo", }); +export type V2ThreadForkResponse__TextElement = { + readonly byteRange: V2ThreadForkResponse__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ThreadForkResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ThreadForkResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadForkResponse__TextElement" }); + +export type V2ThreadForkResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadForkResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadForkResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadForkResponse__MemoryCitation" }); + export type V2ThreadForkResponse__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadForkResponse__PatchChangeKind; @@ -16059,104 +18772,16 @@ export const V2ThreadForkResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ThreadForkResponse__PatchChangeKind, path: Schema.String, -}); - -export type V2ThreadForkResponse__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2ThreadForkResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2ThreadForkResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadForkResponse__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ThreadForkResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); +}).annotate({ identifier: "V2ThreadForkResponse__FileUpdateChange" }); -export type V2ThreadForkResponse__SubAgentSource = - | "review" - | "compact" - | "memory_consolidation" - | { - readonly thread_spawn: { - readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadForkResponse__AgentPath | null; - readonly agent_role?: string | null; - readonly depth: number; - readonly parent_thread_id: V2ThreadForkResponse__ThreadId; - }; - } - | { readonly other: string }; -export const V2ThreadForkResponse__SubAgentSource = Schema.Union( - [ - Schema.Literals(["review", "compact", "memory_consolidation"]), - Schema.Struct({ - thread_spawn: Schema.Struct({ - agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - agent_path: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__AgentPath, Schema.Null]), - ), - agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: V2ThreadForkResponse__ThreadId, - }), - }).annotate({ title: "ThreadSpawnSubAgentSource" }), - Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), - ], - { mode: "oneOf" }, -); +export type V2ThreadForkResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadForkResponse__CollabAgentStatus; +}; +export const V2ThreadForkResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadForkResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadForkResponse__CollabAgentState" }); export type V2ThreadGoalGetResponse__ThreadGoal = { readonly createdAt: number; @@ -16169,17 +18794,30 @@ export type V2ThreadGoalGetResponse__ThreadGoal = { readonly updatedAt: number; }; export const V2ThreadGoalGetResponse__ThreadGoal = Schema.Struct({ - createdAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + createdAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), objective: Schema.String, status: V2ThreadGoalGetResponse__ThreadGoalStatus, threadId: Schema.String, - timeUsedSeconds: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + timeUsedSeconds: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), tokenBudget: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), - tokensUsed: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - updatedAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -}); + tokensUsed: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + updatedAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +}).annotate({ identifier: "V2ThreadGoalGetResponse__ThreadGoal" }); export type V2ThreadGoalSetResponse__ThreadGoal = { readonly createdAt: number; @@ -16192,17 +18830,30 @@ export type V2ThreadGoalSetResponse__ThreadGoal = { readonly updatedAt: number; }; export const V2ThreadGoalSetResponse__ThreadGoal = Schema.Struct({ - createdAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + createdAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), objective: Schema.String, status: V2ThreadGoalSetResponse__ThreadGoalStatus, threadId: Schema.String, - timeUsedSeconds: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + timeUsedSeconds: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), tokenBudget: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), - tokensUsed: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - updatedAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -}); + tokensUsed: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + updatedAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +}).annotate({ identifier: "V2ThreadGoalSetResponse__ThreadGoal" }); export type V2ThreadGoalUpdatedNotification__ThreadGoal = { readonly createdAt: number; @@ -16215,17 +18866,30 @@ export type V2ThreadGoalUpdatedNotification__ThreadGoal = { readonly updatedAt: number; }; export const V2ThreadGoalUpdatedNotification__ThreadGoal = Schema.Struct({ - createdAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + createdAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), objective: Schema.String, status: V2ThreadGoalUpdatedNotification__ThreadGoalStatus, threadId: Schema.String, - timeUsedSeconds: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + timeUsedSeconds: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), tokenBudget: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), - tokensUsed: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - updatedAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), -}); + tokensUsed: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + updatedAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), +}).annotate({ identifier: "V2ThreadGoalUpdatedNotification__ThreadGoal" }); export type V2ThreadListResponse__CommandAction = | { @@ -16267,25 +18931,69 @@ export const V2ThreadListResponse__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadListResponse__CommandAction" }); -export type V2ThreadListResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadListResponse__CollabAgentStatus; -}; -export const V2ThreadListResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadListResponse__CollabAgentStatus, -}); +export type V2ThreadListResponse__SubAgentSource = + | "review" + | "compact" + | "memory_consolidation" + | { + readonly thread_spawn: { + readonly agent_nickname?: string | null; + readonly agent_path?: V2ThreadListResponse__AgentPath | null; + readonly agent_role?: string | null; + readonly depth: number; + readonly parent_thread_id: V2ThreadListResponse__ThreadId; + }; + } + | { readonly other: string }; +export const V2ThreadListResponse__SubAgentSource = Schema.Union( + [ + Schema.Literals(["review", "compact", "memory_consolidation"]), + Schema.Struct({ + thread_spawn: Schema.Struct({ + agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + agent_path: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__AgentPath, Schema.Null]), + ), + agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadListResponse__ThreadId, + }), + }).annotate({ title: "ThreadSpawnSubAgentSource" }), + Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadListResponse__SubAgentSource" }); -export type V2ThreadListResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ThreadListResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadListResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +export type V2ThreadListResponse__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } + | { + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadListResponse__ThreadStatus = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), + Schema.Struct({ + activeFlags: Schema.Array(V2ThreadListResponse__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadListResponse__ThreadStatus" }); export type V2ThreadListResponse__CodexErrorInfo = | "contextWindowExceeded" @@ -16328,8 +19036,12 @@ export const V2ThreadListResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16340,8 +19052,12 @@ export const V2ThreadListResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16355,8 +19071,12 @@ export const V2ThreadListResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16371,8 +19091,12 @@ export const V2ThreadListResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16395,8 +19119,36 @@ export const V2ThreadListResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ThreadListResponse__CodexErrorInfo", }); +export type V2ThreadListResponse__TextElement = { + readonly byteRange: V2ThreadListResponse__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ThreadListResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ThreadListResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadListResponse__TextElement" }); + +export type V2ThreadListResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadListResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadListResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadListResponse__MemoryCitation" }); + export type V2ThreadListResponse__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadListResponse__PatchChangeKind; @@ -16406,164 +19158,120 @@ export const V2ThreadListResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ThreadListResponse__PatchChangeKind, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadListResponse__FileUpdateChange" }); -export type V2ThreadListResponse__UserInput = +export type V2ThreadListResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadListResponse__CollabAgentStatus; +}; +export const V2ThreadListResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadListResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadListResponse__CollabAgentState" }); + +export type V2ThreadMetadataUpdateResponse__CommandAction = | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2ThreadListResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; + readonly command: string; + readonly name: string; + readonly path: V2ThreadMetadataUpdateResponse__AbsolutePathBuf; + readonly type: "read"; } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } | { - readonly detail?: V2ThreadListResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadListResponse__UserInput = Schema.Union( + | { readonly command: string; readonly type: "unknown" }; +export const V2ThreadMetadataUpdateResponse__CommandAction = Schema.Union( [ Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ThreadListResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), + command: Schema.String, + name: Schema.String, + path: V2ThreadMetadataUpdateResponse__AbsolutePathBuf, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CommandAction" }); -export type V2ThreadListResponse__SubAgentSource = +export type V2ThreadMetadataUpdateResponse__SubAgentSource = | "review" | "compact" | "memory_consolidation" | { readonly thread_spawn: { readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadListResponse__AgentPath | null; + readonly agent_path?: V2ThreadMetadataUpdateResponse__AgentPath | null; readonly agent_role?: string | null; readonly depth: number; - readonly parent_thread_id: V2ThreadListResponse__ThreadId; + readonly parent_thread_id: V2ThreadMetadataUpdateResponse__ThreadId; }; } | { readonly other: string }; -export const V2ThreadListResponse__SubAgentSource = Schema.Union( +export const V2ThreadMetadataUpdateResponse__SubAgentSource = Schema.Union( [ Schema.Literals(["review", "compact", "memory_consolidation"]), Schema.Struct({ thread_spawn: Schema.Struct({ agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), agent_path: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__AgentPath, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__AgentPath, Schema.Null]), ), agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: V2ThreadListResponse__ThreadId, + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadMetadataUpdateResponse__ThreadId, }), }).annotate({ title: "ThreadSpawnSubAgentSource" }), Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__SubAgentSource" }); -export type V2ThreadMetadataUpdateResponse__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: V2ThreadMetadataUpdateResponse__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } +export type V2ThreadMetadataUpdateResponse__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadMetadataUpdateResponse__CommandAction = Schema.Union( + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadMetadataUpdateResponse__ThreadStatus = Schema.Union( [ Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: V2ThreadMetadataUpdateResponse__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), + activeFlags: Schema.Array(V2ThreadMetadataUpdateResponse__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), ], { mode: "oneOf" }, -); - -export type V2ThreadMetadataUpdateResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadMetadataUpdateResponse__CollabAgentStatus; -}; -export const V2ThreadMetadataUpdateResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadMetadataUpdateResponse__CollabAgentStatus, -}); - -export type V2ThreadMetadataUpdateResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ThreadMetadataUpdateResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadMetadataUpdateResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ThreadStatus" }); export type V2ThreadMetadataUpdateResponse__CodexErrorInfo = | "contextWindowExceeded" @@ -16606,8 +19314,12 @@ export const V2ThreadMetadataUpdateResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16618,8 +19330,12 @@ export const V2ThreadMetadataUpdateResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16633,8 +19349,12 @@ export const V2ThreadMetadataUpdateResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16649,8 +19369,12 @@ export const V2ThreadMetadataUpdateResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16673,8 +19397,37 @@ export const V2ThreadMetadataUpdateResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ThreadMetadataUpdateResponse__CodexErrorInfo", }); +export type V2ThreadMetadataUpdateResponse__TextElement = { + readonly byteRange: V2ThreadMetadataUpdateResponse__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ThreadMetadataUpdateResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__TextElement" }); + +export type V2ThreadMetadataUpdateResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadMetadataUpdateResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadMetadataUpdateResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__MemoryCitation" }); + export type V2ThreadMetadataUpdateResponse__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadMetadataUpdateResponse__PatchChangeKind; @@ -16684,168 +19437,120 @@ export const V2ThreadMetadataUpdateResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ThreadMetadataUpdateResponse__PatchChangeKind, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__FileUpdateChange" }); -export type V2ThreadMetadataUpdateResponse__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } +export type V2ThreadMetadataUpdateResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadMetadataUpdateResponse__CollabAgentStatus; +}; +export const V2ThreadMetadataUpdateResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadMetadataUpdateResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CollabAgentState" }); + +export type V2ThreadReadResponse__CommandAction = | { - readonly detail?: V2ThreadMetadataUpdateResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; + readonly command: string; + readonly name: string; + readonly path: V2ThreadReadResponse__AbsolutePathBuf; + readonly type: "read"; } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } | { - readonly detail?: V2ThreadMetadataUpdateResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadMetadataUpdateResponse__UserInput = Schema.Union( + | { readonly command: string; readonly type: "unknown" }; +export const V2ThreadReadResponse__CommandAction = Schema.Union( [ Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ThreadMetadataUpdateResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), - ), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), + command: Schema.String, + name: Schema.String, + path: V2ThreadReadResponse__AbsolutePathBuf, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadReadResponse__CommandAction" }); -export type V2ThreadMetadataUpdateResponse__SubAgentSource = +export type V2ThreadReadResponse__SubAgentSource = | "review" | "compact" | "memory_consolidation" | { readonly thread_spawn: { readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadMetadataUpdateResponse__AgentPath | null; + readonly agent_path?: V2ThreadReadResponse__AgentPath | null; readonly agent_role?: string | null; readonly depth: number; - readonly parent_thread_id: V2ThreadMetadataUpdateResponse__ThreadId; + readonly parent_thread_id: V2ThreadReadResponse__ThreadId; }; } | { readonly other: string }; -export const V2ThreadMetadataUpdateResponse__SubAgentSource = Schema.Union( +export const V2ThreadReadResponse__SubAgentSource = Schema.Union( [ Schema.Literals(["review", "compact", "memory_consolidation"]), Schema.Struct({ thread_spawn: Schema.Struct({ agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), agent_path: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__AgentPath, Schema.Null]), + Schema.Union([V2ThreadReadResponse__AgentPath, Schema.Null]), ), agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: V2ThreadMetadataUpdateResponse__ThreadId, + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadReadResponse__ThreadId, }), }).annotate({ title: "ThreadSpawnSubAgentSource" }), Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadReadResponse__SubAgentSource" }); -export type V2ThreadReadResponse__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: V2ThreadReadResponse__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } +export type V2ThreadReadResponse__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadReadResponse__CommandAction = Schema.Union( + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadReadResponse__ThreadStatus = Schema.Union( [ Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: V2ThreadReadResponse__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), + activeFlags: Schema.Array(V2ThreadReadResponse__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), ], { mode: "oneOf" }, -); - -export type V2ThreadReadResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadReadResponse__CollabAgentStatus; -}; -export const V2ThreadReadResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadReadResponse__CollabAgentStatus, -}); - -export type V2ThreadReadResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ThreadReadResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadReadResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +).annotate({ identifier: "V2ThreadReadResponse__ThreadStatus" }); export type V2ThreadReadResponse__CodexErrorInfo = | "contextWindowExceeded" @@ -16892,8 +19597,12 @@ export const V2ThreadReadResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16904,8 +19613,12 @@ export const V2ThreadReadResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16919,8 +19632,12 @@ export const V2ThreadReadResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16935,8 +19652,12 @@ export const V2ThreadReadResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -16959,8 +19680,36 @@ export const V2ThreadReadResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ThreadReadResponse__CodexErrorInfo", }); +export type V2ThreadReadResponse__TextElement = { + readonly byteRange: V2ThreadReadResponse__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ThreadReadResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ThreadReadResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadReadResponse__TextElement" }); + +export type V2ThreadReadResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadReadResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadReadResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadReadResponse__MemoryCitation" }); + export type V2ThreadReadResponse__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadReadResponse__PatchChangeKind; @@ -16970,104 +19719,60 @@ export const V2ThreadReadResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ThreadReadResponse__PatchChangeKind, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadReadResponse__FileUpdateChange" }); -export type V2ThreadReadResponse__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2ThreadReadResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } +export type V2ThreadReadResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadReadResponse__CollabAgentStatus; +}; +export const V2ThreadReadResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadReadResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadReadResponse__CollabAgentState" }); + +export type V2ThreadResumeParams__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } | { - readonly detail?: V2ThreadReadResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; + readonly detail?: V2ThreadResumeParams__ImageDetail | null; + readonly image_url: string; + readonly type: "input_image"; } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadReadResponse__UserInput = Schema.Union( + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadResumeParams__FunctionCallOutputContentItem = Schema.Union( [ Schema.Struct({ text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ThreadReadResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), + detail: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__ImageDetail, Schema.Null])), + image_url: Schema.String, + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputImageFunctionCallOutputContentItem" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadReadResponse__SubAgentSource = - | "review" - | "compact" - | "memory_consolidation" - | { - readonly thread_spawn: { - readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadReadResponse__AgentPath | null; - readonly agent_role?: string | null; - readonly depth: number; - readonly parent_thread_id: V2ThreadReadResponse__ThreadId; - }; - } - | { readonly other: string }; -export const V2ThreadReadResponse__SubAgentSource = Schema.Union( - [ - Schema.Literals(["review", "compact", "memory_consolidation"]), + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), Schema.Struct({ - thread_spawn: Schema.Struct({ - agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - agent_path: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__AgentPath, Schema.Null]), - ), - agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: V2ThreadReadResponse__ThreadId, + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", }), - }).annotate({ title: "ThreadSpawnSubAgentSource" }), - Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), ], { mode: "oneOf" }, -); +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadResumeParams__FunctionCallOutputContentItem", +}); export type V2ThreadResumeParams__ContentItem = | { readonly text: string; readonly type: "input_text" } @@ -17099,52 +19804,9 @@ export const V2ThreadResumeParams__ContentItem = Schema.Union( }).annotate({ title: "OutputTextContentItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadResumeParams__ContentItem" }); -export type V2ThreadResumeParams__FunctionCallOutputContentItem = - | { readonly text: string; readonly type: "input_text" } - | { - readonly detail?: V2ThreadResumeParams__ImageDetail | null; - readonly image_url: string; - readonly type: "input_image"; - } - | { readonly audio_url: string; readonly type: "input_audio" } - | { readonly encrypted_content: string; readonly type: "encrypted_content" }; -export const V2ThreadResumeParams__FunctionCallOutputContentItem = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - type: Schema.Literal("input_text").annotate({ - title: "InputTextFunctionCallOutputContentItemType", - }), - }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__ImageDetail, Schema.Null])), - image_url: Schema.String, - type: Schema.Literal("input_image").annotate({ - title: "InputImageFunctionCallOutputContentItemType", - }), - }).annotate({ title: "InputImageFunctionCallOutputContentItem" }), - Schema.Struct({ - audio_url: Schema.String, - type: Schema.Literal("input_audio").annotate({ - title: "InputAudioFunctionCallOutputContentItemType", - }), - }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), - Schema.Struct({ - encrypted_content: Schema.String, - type: Schema.Literal("encrypted_content").annotate({ - title: "EncryptedContentFunctionCallOutputContentItemType", - }), - }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), - ], - { mode: "oneOf" }, -).annotate({ - description: - "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", -}); - -export type V2ThreadResumeResponse__CommandAction = +export type V2ThreadResumeResponse__CommandAction = | { readonly command: string; readonly name: string; @@ -17184,25 +19846,118 @@ export const V2ThreadResumeResponse__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadResumeResponse__CommandAction" }); -export type V2ThreadResumeResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadResumeResponse__CollabAgentStatus; -}; -export const V2ThreadResumeResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadResumeResponse__CollabAgentStatus, -}); +export type V2ThreadResumeResponse__SandboxPolicy = + | { readonly type: "dangerFullAccess" } + | { readonly networkAccess?: boolean; readonly type: "readOnly" } + | { + readonly networkAccess?: V2ThreadResumeResponse__NetworkAccess; + readonly type: "externalSandbox"; + } + | { + readonly excludeSlashTmp?: boolean; + readonly excludeTmpdirEnvVar?: boolean; + readonly networkAccess?: boolean; + readonly type: "workspaceWrite"; + readonly writableRoots?: ReadonlyArray; + }; +export const V2ThreadResumeResponse__SandboxPolicy = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("dangerFullAccess").annotate({ + title: "DangerFullAccessSandboxPolicyType", + }), + }).annotate({ title: "DangerFullAccessSandboxPolicy" }), + Schema.Struct({ + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), + }).annotate({ title: "ReadOnlySandboxPolicy" }), + Schema.Struct({ + networkAccess: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__NetworkAccess, + ).annotate({ default: "restricted" }), + ), + type: Schema.Literal("externalSandbox").annotate({ + title: "ExternalSandboxSandboxPolicyType", + }), + }).annotate({ title: "ExternalSandboxSandboxPolicy" }), + Schema.Struct({ + excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), + writableRoots: Schema.optionalKey( + Schema.Array(V2ThreadResumeResponse__AbsolutePathBuf).annotate({ default: [] }), + ), + }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeResponse__SandboxPolicy" }); -export type V2ThreadResumeResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ThreadResumeResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadResumeResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +export type V2ThreadResumeResponse__SubAgentSource = + | "review" + | "compact" + | "memory_consolidation" + | { + readonly thread_spawn: { + readonly agent_nickname?: string | null; + readonly agent_path?: V2ThreadResumeResponse__AgentPath | null; + readonly agent_role?: string | null; + readonly depth: number; + readonly parent_thread_id: V2ThreadResumeResponse__ThreadId; + }; + } + | { readonly other: string }; +export const V2ThreadResumeResponse__SubAgentSource = Schema.Union( + [ + Schema.Literals(["review", "compact", "memory_consolidation"]), + Schema.Struct({ + thread_spawn: Schema.Struct({ + agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + agent_path: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__AgentPath, Schema.Null]), + ), + agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadResumeResponse__ThreadId, + }), + }).annotate({ title: "ThreadSpawnSubAgentSource" }), + Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeResponse__SubAgentSource" }); + +export type V2ThreadResumeResponse__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } + | { + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadResumeResponse__ThreadStatus = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), + Schema.Struct({ + activeFlags: Schema.Array(V2ThreadResumeResponse__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeResponse__ThreadStatus" }); export type V2ThreadResumeResponse__CodexErrorInfo = | "contextWindowExceeded" @@ -17249,8 +20004,12 @@ export const V2ThreadResumeResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17261,8 +20020,12 @@ export const V2ThreadResumeResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17276,8 +20039,12 @@ export const V2ThreadResumeResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17292,8 +20059,12 @@ export const V2ThreadResumeResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17316,8 +20087,36 @@ export const V2ThreadResumeResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ThreadResumeResponse__CodexErrorInfo", }); +export type V2ThreadResumeResponse__TextElement = { + readonly byteRange: V2ThreadResumeResponse__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ThreadResumeResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ThreadResumeResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadResumeResponse__TextElement" }); + +export type V2ThreadResumeResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadResumeResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadResumeResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadResumeResponse__MemoryCitation" }); + export type V2ThreadResumeResponse__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadResumeResponse__PatchChangeKind; @@ -17327,164 +20126,120 @@ export const V2ThreadResumeResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ThreadResumeResponse__PatchChangeKind, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadResumeResponse__FileUpdateChange" }); -export type V2ThreadResumeResponse__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } +export type V2ThreadResumeResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadResumeResponse__CollabAgentStatus; +}; +export const V2ThreadResumeResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadResumeResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadResumeResponse__CollabAgentState" }); + +export type V2ThreadRollbackResponse__CommandAction = | { - readonly detail?: V2ThreadResumeResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; + readonly command: string; + readonly name: string; + readonly path: V2ThreadRollbackResponse__AbsolutePathBuf; + readonly type: "read"; } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } | { - readonly detail?: V2ThreadResumeResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadResumeResponse__UserInput = Schema.Union( + | { readonly command: string; readonly type: "unknown" }; +export const V2ThreadRollbackResponse__CommandAction = Schema.Union( [ Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ThreadResumeResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), + command: Schema.String, + name: Schema.String, + path: V2ThreadRollbackResponse__AbsolutePathBuf, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadRollbackResponse__CommandAction" }); -export type V2ThreadResumeResponse__SubAgentSource = +export type V2ThreadRollbackResponse__SubAgentSource = | "review" | "compact" | "memory_consolidation" | { readonly thread_spawn: { readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadResumeResponse__AgentPath | null; + readonly agent_path?: V2ThreadRollbackResponse__AgentPath | null; readonly agent_role?: string | null; readonly depth: number; - readonly parent_thread_id: V2ThreadResumeResponse__ThreadId; + readonly parent_thread_id: V2ThreadRollbackResponse__ThreadId; }; } | { readonly other: string }; -export const V2ThreadResumeResponse__SubAgentSource = Schema.Union( +export const V2ThreadRollbackResponse__SubAgentSource = Schema.Union( [ Schema.Literals(["review", "compact", "memory_consolidation"]), Schema.Struct({ thread_spawn: Schema.Struct({ agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), agent_path: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__AgentPath, Schema.Null]), + Schema.Union([V2ThreadRollbackResponse__AgentPath, Schema.Null]), ), agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: V2ThreadResumeResponse__ThreadId, + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadRollbackResponse__ThreadId, }), }).annotate({ title: "ThreadSpawnSubAgentSource" }), Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadRollbackResponse__SubAgentSource" }); -export type V2ThreadRollbackResponse__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: V2ThreadRollbackResponse__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } +export type V2ThreadRollbackResponse__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadRollbackResponse__CommandAction = Schema.Union( + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadRollbackResponse__ThreadStatus = Schema.Union( [ Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: V2ThreadRollbackResponse__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), + activeFlags: Schema.Array(V2ThreadRollbackResponse__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), ], { mode: "oneOf" }, -); - -export type V2ThreadRollbackResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadRollbackResponse__CollabAgentStatus; -}; -export const V2ThreadRollbackResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadRollbackResponse__CollabAgentStatus, -}); - -export type V2ThreadRollbackResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ThreadRollbackResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadRollbackResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +).annotate({ identifier: "V2ThreadRollbackResponse__ThreadStatus" }); export type V2ThreadRollbackResponse__CodexErrorInfo = | "contextWindowExceeded" @@ -17531,8 +20286,12 @@ export const V2ThreadRollbackResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17543,8 +20302,12 @@ export const V2ThreadRollbackResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17558,8 +20321,12 @@ export const V2ThreadRollbackResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17574,8 +20341,12 @@ export const V2ThreadRollbackResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17598,8 +20369,36 @@ export const V2ThreadRollbackResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ThreadRollbackResponse__CodexErrorInfo", }); +export type V2ThreadRollbackResponse__TextElement = { + readonly byteRange: V2ThreadRollbackResponse__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ThreadRollbackResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ThreadRollbackResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadRollbackResponse__TextElement" }); + +export type V2ThreadRollbackResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadRollbackResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadRollbackResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadRollbackResponse__MemoryCitation" }); + export type V2ThreadRollbackResponse__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadRollbackResponse__PatchChangeKind; @@ -17609,113 +20408,40 @@ export const V2ThreadRollbackResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ThreadRollbackResponse__PatchChangeKind, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadRollbackResponse__FileUpdateChange" }); -export type V2ThreadRollbackResponse__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2ThreadRollbackResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2ThreadRollbackResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadRollbackResponse__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ThreadRollbackResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__ImageDetail, Schema.Null]), - ), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); +export type V2ThreadRollbackResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadRollbackResponse__CollabAgentStatus; +}; +export const V2ThreadRollbackResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadRollbackResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadRollbackResponse__CollabAgentState" }); -export type V2ThreadRollbackResponse__SubAgentSource = - | "review" - | "compact" - | "memory_consolidation" - | { - readonly thread_spawn: { - readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadRollbackResponse__AgentPath | null; - readonly agent_role?: string | null; - readonly depth: number; - readonly parent_thread_id: V2ThreadRollbackResponse__ThreadId; - }; - } - | { readonly other: string }; -export const V2ThreadRollbackResponse__SubAgentSource = Schema.Union( - [ - Schema.Literals(["review", "compact", "memory_consolidation"]), - Schema.Struct({ - thread_spawn: Schema.Struct({ - agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - agent_path: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__AgentPath, Schema.Null]), - ), - agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: V2ThreadRollbackResponse__ThreadId, - }), - }).annotate({ title: "ThreadSpawnSubAgentSource" }), - Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), - ], - { mode: "oneOf" }, -); +export type V2ThreadSettingsUpdatedNotification__Settings = { + readonly developer_instructions?: string | null; + readonly model: string; + readonly reasoning_effort?: V2ThreadSettingsUpdatedNotification__ReasoningEffort | null; +}; +export const V2ThreadSettingsUpdatedNotification__Settings = Schema.Struct({ + developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.String, + reasoning_effort: Schema.optionalKey( + Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningEffort, Schema.Null]), + ), +}).annotate({ + description: "Settings for a collaboration mode.", + identifier: "V2ThreadSettingsUpdatedNotification__Settings", +}); export type V2ThreadSettingsUpdatedNotification__SandboxPolicy = | { readonly type: "dangerFullAccess" } | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } + | { + readonly networkAccess?: V2ThreadSettingsUpdatedNotification__NetworkAccess; + readonly type: "externalSandbox"; + } | { readonly excludeSlashTmp?: boolean; readonly excludeTmpdirEnvVar?: boolean; @@ -17736,7 +20462,10 @@ export const V2ThreadSettingsUpdatedNotification__SandboxPolicy = Schema.Union( }).annotate({ title: "ReadOnlySandboxPolicy" }), Schema.Struct({ networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), + Schema.suspend( + (): Schema.Codec => + V2ThreadSettingsUpdatedNotification__NetworkAccess, + ).annotate({ default: "restricted" }), ), type: Schema.Literal("externalSandbox").annotate({ title: "ExternalSandboxSandboxPolicyType", @@ -17755,20 +20484,7 @@ export const V2ThreadSettingsUpdatedNotification__SandboxPolicy = Schema.Union( }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), ], { mode: "oneOf" }, -); - -export type V2ThreadSettingsUpdatedNotification__Settings = { - readonly developer_instructions?: string | null; - readonly model: string; - readonly reasoning_effort?: V2ThreadSettingsUpdatedNotification__ReasoningEffort | null; -}; -export const V2ThreadSettingsUpdatedNotification__Settings = Schema.Struct({ - developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.String, - reasoning_effort: Schema.optionalKey( - Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningEffort, Schema.Null]), - ), -}).annotate({ description: "Settings for a collaboration mode." }); +).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__SandboxPolicy" }); export type V2ThreadStartedNotification__CommandAction = | { @@ -17810,25 +20526,69 @@ export const V2ThreadStartedNotification__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); - -export type V2ThreadStartedNotification__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadStartedNotification__CollabAgentStatus; -}; -export const V2ThreadStartedNotification__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadStartedNotification__CollabAgentStatus, -}); +).annotate({ identifier: "V2ThreadStartedNotification__CommandAction" }); -export type V2ThreadStartedNotification__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ThreadStartedNotification__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadStartedNotification__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +export type V2ThreadStartedNotification__SubAgentSource = + | "review" + | "compact" + | "memory_consolidation" + | { + readonly thread_spawn: { + readonly agent_nickname?: string | null; + readonly agent_path?: V2ThreadStartedNotification__AgentPath | null; + readonly agent_role?: string | null; + readonly depth: number; + readonly parent_thread_id: V2ThreadStartedNotification__ThreadId; + }; + } + | { readonly other: string }; +export const V2ThreadStartedNotification__SubAgentSource = Schema.Union( + [ + Schema.Literals(["review", "compact", "memory_consolidation"]), + Schema.Struct({ + thread_spawn: Schema.Struct({ + agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + agent_path: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__AgentPath, Schema.Null]), + ), + agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadStartedNotification__ThreadId, + }), + }).annotate({ title: "ThreadSpawnSubAgentSource" }), + Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartedNotification__SubAgentSource" }); + +export type V2ThreadStartedNotification__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } + | { + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadStartedNotification__ThreadStatus = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), + Schema.Struct({ + activeFlags: Schema.Array(V2ThreadStartedNotification__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartedNotification__ThreadStatus" }); export type V2ThreadStartedNotification__CodexErrorInfo = | "contextWindowExceeded" @@ -17871,8 +20631,12 @@ export const V2ThreadStartedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17883,8 +20647,12 @@ export const V2ThreadStartedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17898,8 +20666,12 @@ export const V2ThreadStartedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17914,8 +20686,12 @@ export const V2ThreadStartedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -17938,8 +20714,37 @@ export const V2ThreadStartedNotification__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ThreadStartedNotification__CodexErrorInfo", }); +export type V2ThreadStartedNotification__TextElement = { + readonly byteRange: V2ThreadStartedNotification__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ThreadStartedNotification__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadStartedNotification__TextElement" }); + +export type V2ThreadStartedNotification__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadStartedNotification__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadStartedNotification__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadStartedNotification__MemoryCitation" }); + export type V2ThreadStartedNotification__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadStartedNotification__PatchChangeKind; @@ -17949,168 +20754,169 @@ export const V2ThreadStartedNotification__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ThreadStartedNotification__PatchChangeKind, path: Schema.String, -}); +}).annotate({ identifier: "V2ThreadStartedNotification__FileUpdateChange" }); -export type V2ThreadStartedNotification__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } +export type V2ThreadStartedNotification__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadStartedNotification__CollabAgentStatus; +}; +export const V2ThreadStartedNotification__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadStartedNotification__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadStartedNotification__CollabAgentState" }); + +export type V2ThreadStartResponse__CommandAction = | { - readonly detail?: V2ThreadStartedNotification__ImageDetail | null; - readonly type: "image"; - readonly url: string; + readonly command: string; + readonly name: string; + readonly path: V2ThreadStartResponse__AbsolutePathBuf; + readonly type: "read"; } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } | { - readonly detail?: V2ThreadStartedNotification__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadStartedNotification__UserInput = Schema.Union( + | { readonly command: string; readonly type: "unknown" }; +export const V2ThreadStartResponse__CommandAction = Schema.Union( [ Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ThreadStartedNotification__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), + command: Schema.String, + name: Schema.String, + path: V2ThreadStartResponse__AbsolutePathBuf, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), - ), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartResponse__CommandAction" }); + +export type V2ThreadStartResponse__SandboxPolicy = + | { readonly type: "dangerFullAccess" } + | { readonly networkAccess?: boolean; readonly type: "readOnly" } + | { + readonly networkAccess?: V2ThreadStartResponse__NetworkAccess; + readonly type: "externalSandbox"; + } + | { + readonly excludeSlashTmp?: boolean; + readonly excludeTmpdirEnvVar?: boolean; + readonly networkAccess?: boolean; + readonly type: "workspaceWrite"; + readonly writableRoots?: ReadonlyArray; + }; +export const V2ThreadStartResponse__SandboxPolicy = Schema.Union( + [ Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), + type: Schema.Literal("dangerFullAccess").annotate({ + title: "DangerFullAccessSandboxPolicyType", + }), + }).annotate({ title: "DangerFullAccessSandboxPolicy" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), + }).annotate({ title: "ReadOnlySandboxPolicy" }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), + networkAccess: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadStartResponse__NetworkAccess, + ).annotate({ default: "restricted" }), + ), + type: Schema.Literal("externalSandbox").annotate({ + title: "ExternalSandboxSandboxPolicyType", + }), + }).annotate({ title: "ExternalSandboxSandboxPolicy" }), + Schema.Struct({ + excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), + writableRoots: Schema.optionalKey( + Schema.Array(V2ThreadStartResponse__AbsolutePathBuf).annotate({ default: [] }), + ), + }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadStartResponse__SandboxPolicy" }); -export type V2ThreadStartedNotification__SubAgentSource = +export type V2ThreadStartResponse__SubAgentSource = | "review" | "compact" | "memory_consolidation" | { readonly thread_spawn: { readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadStartedNotification__AgentPath | null; + readonly agent_path?: V2ThreadStartResponse__AgentPath | null; readonly agent_role?: string | null; readonly depth: number; - readonly parent_thread_id: V2ThreadStartedNotification__ThreadId; + readonly parent_thread_id: V2ThreadStartResponse__ThreadId; }; } | { readonly other: string }; -export const V2ThreadStartedNotification__SubAgentSource = Schema.Union( +export const V2ThreadStartResponse__SubAgentSource = Schema.Union( [ Schema.Literals(["review", "compact", "memory_consolidation"]), Schema.Struct({ thread_spawn: Schema.Struct({ agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), agent_path: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__AgentPath, Schema.Null]), + Schema.Union([V2ThreadStartResponse__AgentPath, Schema.Null]), ), agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: V2ThreadStartedNotification__ThreadId, + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadStartResponse__ThreadId, }), }).annotate({ title: "ThreadSpawnSubAgentSource" }), Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadStartResponse__SubAgentSource" }); -export type V2ThreadStartResponse__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: V2ThreadStartResponse__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } +export type V2ThreadStartResponse__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadStartResponse__CommandAction = Schema.Union( + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadStartResponse__ThreadStatus = Schema.Union( [ Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: V2ThreadStartResponse__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), + activeFlags: Schema.Array(V2ThreadStartResponse__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), ], { mode: "oneOf" }, -); - -export type V2ThreadStartResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadStartResponse__CollabAgentStatus; -}; -export const V2ThreadStartResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadStartResponse__CollabAgentStatus, -}); - -export type V2ThreadStartResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ThreadStartResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadStartResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +).annotate({ identifier: "V2ThreadStartResponse__ThreadStatus" }); export type V2ThreadStartResponse__CodexErrorInfo = | "contextWindowExceeded" @@ -18153,8 +20959,12 @@ export const V2ThreadStartResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18165,8 +20975,12 @@ export const V2ThreadStartResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18180,8 +20994,12 @@ export const V2ThreadStartResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18196,8 +21014,12 @@ export const V2ThreadStartResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18220,8 +21042,36 @@ export const V2ThreadStartResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ThreadStartResponse__CodexErrorInfo", }); +export type V2ThreadStartResponse__TextElement = { + readonly byteRange: V2ThreadStartResponse__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ThreadStartResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ThreadStartResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadStartResponse__TextElement" }); + +export type V2ThreadStartResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadStartResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadStartResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadStartResponse__MemoryCitation" }); + export type V2ThreadStartResponse__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadStartResponse__PatchChangeKind; @@ -18231,104 +21081,16 @@ export const V2ThreadStartResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, kind: V2ThreadStartResponse__PatchChangeKind, path: Schema.String, -}); - -export type V2ThreadStartResponse__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2ThreadStartResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2ThreadStartResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadStartResponse__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ThreadStartResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); +}).annotate({ identifier: "V2ThreadStartResponse__FileUpdateChange" }); -export type V2ThreadStartResponse__SubAgentSource = - | "review" - | "compact" - | "memory_consolidation" - | { - readonly thread_spawn: { - readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadStartResponse__AgentPath | null; - readonly agent_role?: string | null; - readonly depth: number; - readonly parent_thread_id: V2ThreadStartResponse__ThreadId; - }; - } - | { readonly other: string }; -export const V2ThreadStartResponse__SubAgentSource = Schema.Union( - [ - Schema.Literals(["review", "compact", "memory_consolidation"]), - Schema.Struct({ - thread_spawn: Schema.Struct({ - agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - agent_path: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__AgentPath, Schema.Null]), - ), - agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: V2ThreadStartResponse__ThreadId, - }), - }).annotate({ title: "ThreadSpawnSubAgentSource" }), - Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), - ], - { mode: "oneOf" }, -); +export type V2ThreadStartResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadStartResponse__CollabAgentStatus; +}; +export const V2ThreadStartResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadStartResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadStartResponse__CollabAgentState" }); export type V2ThreadStatusChangedNotification__ThreadStatus = | { readonly type: "notLoaded" } @@ -18355,7 +21117,7 @@ export const V2ThreadStatusChangedNotification__ThreadStatus = Schema.Union( }).annotate({ title: "ActiveThreadStatus" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadStatusChangedNotification__ThreadStatus" }); export type V2ThreadTokenUsageUpdatedNotification__ThreadTokenUsage = { readonly last: V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown; @@ -18365,10 +21127,15 @@ export type V2ThreadTokenUsageUpdatedNotification__ThreadTokenUsage = { export const V2ThreadTokenUsageUpdatedNotification__ThreadTokenUsage = Schema.Struct({ last: V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown, modelContextWindow: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), total: V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown, -}); +}).annotate({ identifier: "V2ThreadTokenUsageUpdatedNotification__ThreadTokenUsage" }); export type V2ThreadUnarchiveResponse__CommandAction = | { @@ -18410,25 +21177,69 @@ export const V2ThreadUnarchiveResponse__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadUnarchiveResponse__CommandAction" }); -export type V2ThreadUnarchiveResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadUnarchiveResponse__CollabAgentStatus; -}; -export const V2ThreadUnarchiveResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadUnarchiveResponse__CollabAgentStatus, -}); +export type V2ThreadUnarchiveResponse__SubAgentSource = + | "review" + | "compact" + | "memory_consolidation" + | { + readonly thread_spawn: { + readonly agent_nickname?: string | null; + readonly agent_path?: V2ThreadUnarchiveResponse__AgentPath | null; + readonly agent_role?: string | null; + readonly depth: number; + readonly parent_thread_id: V2ThreadUnarchiveResponse__ThreadId; + }; + } + | { readonly other: string }; +export const V2ThreadUnarchiveResponse__SubAgentSource = Schema.Union( + [ + Schema.Literals(["review", "compact", "memory_consolidation"]), + Schema.Struct({ + thread_spawn: Schema.Struct({ + agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + agent_path: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__AgentPath, Schema.Null]), + ), + agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadUnarchiveResponse__ThreadId, + }), + }).annotate({ title: "ThreadSpawnSubAgentSource" }), + Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__SubAgentSource" }); -export type V2ThreadUnarchiveResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; -}; -export const V2ThreadUnarchiveResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadUnarchiveResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +export type V2ThreadUnarchiveResponse__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } + | { + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadUnarchiveResponse__ThreadStatus = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), + Schema.Struct({ + activeFlags: Schema.Array(V2ThreadUnarchiveResponse__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__ThreadStatus" }); export type V2ThreadUnarchiveResponse__CodexErrorInfo = | "contextWindowExceeded" @@ -18471,8 +21282,12 @@ export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18483,8 +21298,12 @@ export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18498,8 +21317,12 @@ export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18514,8 +21337,12 @@ export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18538,119 +21365,214 @@ export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2ThreadUnarchiveResponse__CodexErrorInfo", }); -export type V2ThreadUnarchiveResponse__FileUpdateChange = { - readonly diff: string; - readonly kind: V2ThreadUnarchiveResponse__PatchChangeKind; - readonly path: string; +export type V2ThreadUnarchiveResponse__TextElement = { + readonly byteRange: V2ThreadUnarchiveResponse__ByteRange; + readonly placeholder?: string | null; }; -export const V2ThreadUnarchiveResponse__FileUpdateChange = Schema.Struct({ - diff: Schema.String, - kind: V2ThreadUnarchiveResponse__PatchChangeKind, - path: Schema.String, -}); - -export type V2ThreadUnarchiveResponse__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2ThreadUnarchiveResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } +export const V2ThreadUnarchiveResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ThreadUnarchiveResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadUnarchiveResponse__TextElement" }); + +export type V2ThreadUnarchiveResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadUnarchiveResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadUnarchiveResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadUnarchiveResponse__MemoryCitation" }); + +export type V2ThreadUnarchiveResponse__FileUpdateChange = { + readonly diff: string; + readonly kind: V2ThreadUnarchiveResponse__PatchChangeKind; + readonly path: string; +}; +export const V2ThreadUnarchiveResponse__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: V2ThreadUnarchiveResponse__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "V2ThreadUnarchiveResponse__FileUpdateChange" }); + +export type V2ThreadUnarchiveResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadUnarchiveResponse__CollabAgentStatus; +}; +export const V2ThreadUnarchiveResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadUnarchiveResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentState" }); + +export type V2TurnCompletedNotification__CodexErrorInfo = + | "contextWindowExceeded" + | "sessionBudgetExceeded" + | "usageLimitExceeded" + | "serverOverloaded" + | "cyberPolicy" + | "internalServerError" + | "unauthorized" + | "badRequest" + | "threadRollbackFailed" + | "sandboxError" + | "rateLimitExceeded" + | "misalignmentPolicyViolation" + | "other" + | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } + | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } + | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } } + | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } | { - readonly detail?: V2ThreadUnarchiveResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadUnarchiveResponse__UserInput = Schema.Union( + readonly activeTurnNotSteerable: { + readonly turnKind: V2TurnCompletedNotification__NonSteerableTurnKind; + }; + }; +export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( [ + Schema.Literals([ + "contextWindowExceeded", + "sessionBudgetExceeded", + "usageLimitExceeded", + "serverOverloaded", + "cyberPolicy", + "internalServerError", + "unauthorized", + "badRequest", + "threadRollbackFailed", + "sandboxError", + "rateLimitExceeded", + "misalignmentPolicyViolation", + "other", + ]), Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2ThreadUnarchiveResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), - ), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), + httpConnectionFailed: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ title: "HttpConnectionFailedCodexErrorInfo" }), Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), + responseStreamConnectionFailed: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ + title: "ResponseStreamConnectionFailedCodexErrorInfo", + description: "Failed to connect to the response SSE stream.", + }), Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), + responseStreamDisconnected: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ + title: "ResponseStreamDisconnectedCodexErrorInfo", + description: + "The response SSE stream disconnected in the middle of a turn before completion.", + }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), + responseTooManyFailedAttempts: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ + title: "ResponseTooManyFailedAttemptsCodexErrorInfo", + description: "Reached the retry limit for responses.", + }), Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), + activeTurnNotSteerable: Schema.Struct({ + turnKind: V2TurnCompletedNotification__NonSteerableTurnKind, + }), + }).annotate({ + title: "ActiveTurnNotSteerableCodexErrorInfo", + description: + "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", + }), ], { mode: "oneOf" }, -); +).annotate({ + description: + "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2TurnCompletedNotification__CodexErrorInfo", +}); -export type V2ThreadUnarchiveResponse__SubAgentSource = - | "review" - | "compact" - | "memory_consolidation" - | { - readonly thread_spawn: { - readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadUnarchiveResponse__AgentPath | null; - readonly agent_role?: string | null; - readonly depth: number; - readonly parent_thread_id: V2ThreadUnarchiveResponse__ThreadId; - }; - } - | { readonly other: string }; -export const V2ThreadUnarchiveResponse__SubAgentSource = Schema.Union( - [ - Schema.Literals(["review", "compact", "memory_consolidation"]), - Schema.Struct({ - thread_spawn: Schema.Struct({ - agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - agent_path: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__AgentPath, Schema.Null]), - ), - agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check(Schema.isInt()), - parent_thread_id: V2ThreadUnarchiveResponse__ThreadId, +export type V2TurnCompletedNotification__TextElement = { + readonly byteRange: V2TurnCompletedNotification__ByteRange; + readonly placeholder?: string | null; +}; +export const V2TurnCompletedNotification__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => + V2TurnCompletedNotification__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", }), - }).annotate({ title: "ThreadSpawnSubAgentSource" }), - Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), - ], - { mode: "oneOf" }, -); + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2TurnCompletedNotification__TextElement" }); + +export type V2TurnCompletedNotification__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2TurnCompletedNotification__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2TurnCompletedNotification__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2TurnCompletedNotification__MemoryCitation" }); export type V2TurnCompletedNotification__CommandAction = | { @@ -18692,7 +21614,18 @@ export const V2TurnCompletedNotification__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2TurnCompletedNotification__CommandAction" }); + +export type V2TurnCompletedNotification__FileUpdateChange = { + readonly diff: string; + readonly kind: V2TurnCompletedNotification__PatchChangeKind; + readonly path: string; +}; +export const V2TurnCompletedNotification__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: V2TurnCompletedNotification__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "V2TurnCompletedNotification__FileUpdateChange" }); export type V2TurnCompletedNotification__CollabAgentState = { readonly message?: string | null; @@ -18701,18 +21634,18 @@ export type V2TurnCompletedNotification__CollabAgentState = { export const V2TurnCompletedNotification__CollabAgentState = Schema.Struct({ message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), status: V2TurnCompletedNotification__CollabAgentStatus, -}); +}).annotate({ identifier: "V2TurnCompletedNotification__CollabAgentState" }); -export type V2TurnCompletedNotification__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; +export type V2TurnPlanUpdatedNotification__TurnPlanStep = { + readonly status: V2TurnPlanUpdatedNotification__TurnPlanStepStatus; + readonly step: string; }; -export const V2TurnCompletedNotification__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2TurnCompletedNotification__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +export const V2TurnPlanUpdatedNotification__TurnPlanStep = Schema.Struct({ + status: V2TurnPlanUpdatedNotification__TurnPlanStepStatus, + step: Schema.String, +}).annotate({ identifier: "V2TurnPlanUpdatedNotification__TurnPlanStep" }); -export type V2TurnCompletedNotification__CodexErrorInfo = +export type V2TurnStartedNotification__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" @@ -18723,8 +21656,6 @@ export type V2TurnCompletedNotification__CodexErrorInfo = | "badRequest" | "threadRollbackFailed" | "sandboxError" - | "rateLimitExceeded" - | "misalignmentPolicyViolation" | "other" | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } @@ -18732,10 +21663,10 @@ export type V2TurnCompletedNotification__CodexErrorInfo = | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } | { readonly activeTurnNotSteerable: { - readonly turnKind: V2TurnCompletedNotification__NonSteerableTurnKind; + readonly turnKind: V2TurnStartedNotification__NonSteerableTurnKind; }; }; -export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( +export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( [ Schema.Literals([ "contextWindowExceeded", @@ -18748,8 +21679,6 @@ export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( "badRequest", "threadRollbackFailed", "sandboxError", - "rateLimitExceeded", - "misalignmentPolicyViolation", "other", ]), Schema.Struct({ @@ -18757,8 +21686,12 @@ export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18769,8 +21702,12 @@ export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18784,8 +21721,12 @@ export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18800,8 +21741,12 @@ export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -18812,7 +21757,7 @@ export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( }), Schema.Struct({ activeTurnNotSteerable: Schema.Struct({ - turnKind: V2TurnCompletedNotification__NonSteerableTurnKind, + turnKind: V2TurnStartedNotification__NonSteerableTurnKind, }), }).annotate({ title: "ActiveTurnNotSteerableCodexErrorInfo", @@ -18824,95 +21769,35 @@ export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2TurnStartedNotification__CodexErrorInfo", }); -export type V2TurnCompletedNotification__FileUpdateChange = { - readonly diff: string; - readonly kind: V2TurnCompletedNotification__PatchChangeKind; - readonly path: string; +export type V2TurnStartedNotification__TextElement = { + readonly byteRange: V2TurnStartedNotification__ByteRange; + readonly placeholder?: string | null; }; -export const V2TurnCompletedNotification__FileUpdateChange = Schema.Struct({ - diff: Schema.String, - kind: V2TurnCompletedNotification__PatchChangeKind, - path: Schema.String, -}); - -export type V2TurnCompletedNotification__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2TurnCompletedNotification__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2TurnCompletedNotification__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2TurnCompletedNotification__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2TurnCompletedNotification__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), - ), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); +export const V2TurnStartedNotification__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2TurnStartedNotification__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2TurnStartedNotification__TextElement" }); -export type V2TurnPlanUpdatedNotification__TurnPlanStep = { - readonly status: V2TurnPlanUpdatedNotification__TurnPlanStepStatus; - readonly step: string; +export type V2TurnStartedNotification__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; }; -export const V2TurnPlanUpdatedNotification__TurnPlanStep = Schema.Struct({ - status: V2TurnPlanUpdatedNotification__TurnPlanStepStatus, - step: Schema.String, -}); +export const V2TurnStartedNotification__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2TurnStartedNotification__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2TurnStartedNotification__MemoryCitation" }); export type V2TurnStartedNotification__CommandAction = | { @@ -18954,7 +21839,18 @@ export const V2TurnStartedNotification__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2TurnStartedNotification__CommandAction" }); + +export type V2TurnStartedNotification__FileUpdateChange = { + readonly diff: string; + readonly kind: V2TurnStartedNotification__PatchChangeKind; + readonly path: string; +}; +export const V2TurnStartedNotification__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: V2TurnStartedNotification__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "V2TurnStartedNotification__FileUpdateChange" }); export type V2TurnStartedNotification__CollabAgentState = { readonly message?: string | null; @@ -18963,18 +21859,88 @@ export type V2TurnStartedNotification__CollabAgentState = { export const V2TurnStartedNotification__CollabAgentState = Schema.Struct({ message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), status: V2TurnStartedNotification__CollabAgentStatus, -}); +}).annotate({ identifier: "V2TurnStartedNotification__CollabAgentState" }); -export type V2TurnStartedNotification__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; +export type V2TurnStartParams__Settings = { + readonly developer_instructions?: string | null; + readonly model: string; + readonly reasoning_effort?: V2TurnStartParams__ReasoningEffort | null; }; -export const V2TurnStartedNotification__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2TurnStartedNotification__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), +export const V2TurnStartParams__Settings = Schema.Struct({ + developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.String, + reasoning_effort: Schema.optionalKey( + Schema.Union([V2TurnStartParams__ReasoningEffort, Schema.Null]), + ), +}).annotate({ + description: "Settings for a collaboration mode.", + identifier: "V2TurnStartParams__Settings", }); -export type V2TurnStartedNotification__CodexErrorInfo = +export type V2TurnStartParams__TextElement = { + readonly byteRange: V2TurnStartParams__ByteRange; + readonly placeholder?: string | null; +}; +export const V2TurnStartParams__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2TurnStartParams__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2TurnStartParams__TextElement" }); + +export type V2TurnStartParams__SandboxPolicy = + | { readonly type: "dangerFullAccess" } + | { readonly networkAccess?: boolean; readonly type: "readOnly" } + | { readonly networkAccess?: V2TurnStartParams__NetworkAccess; readonly type: "externalSandbox" } + | { + readonly excludeSlashTmp?: boolean; + readonly excludeTmpdirEnvVar?: boolean; + readonly networkAccess?: boolean; + readonly type: "workspaceWrite"; + readonly writableRoots?: ReadonlyArray; + }; +export const V2TurnStartParams__SandboxPolicy = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("dangerFullAccess").annotate({ + title: "DangerFullAccessSandboxPolicyType", + }), + }).annotate({ title: "DangerFullAccessSandboxPolicy" }), + Schema.Struct({ + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), + }).annotate({ title: "ReadOnlySandboxPolicy" }), + Schema.Struct({ + networkAccess: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => V2TurnStartParams__NetworkAccess, + ).annotate({ default: "restricted" }), + ), + type: Schema.Literal("externalSandbox").annotate({ + title: "ExternalSandboxSandboxPolicyType", + }), + }).annotate({ title: "ExternalSandboxSandboxPolicy" }), + Schema.Struct({ + excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), + writableRoots: Schema.optionalKey( + Schema.Array(V2TurnStartParams__AbsolutePathBuf).annotate({ default: [] }), + ), + }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartParams__SandboxPolicy" }); + +export type V2TurnStartResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" @@ -18992,10 +21958,10 @@ export type V2TurnStartedNotification__CodexErrorInfo = | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } | { readonly activeTurnNotSteerable: { - readonly turnKind: V2TurnStartedNotification__NonSteerableTurnKind; + readonly turnKind: V2TurnStartResponse__NonSteerableTurnKind; }; }; -export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( +export const V2TurnStartResponse__CodexErrorInfo = Schema.Union( [ Schema.Literals([ "contextWindowExceeded", @@ -19015,8 +21981,12 @@ export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -19027,8 +21997,12 @@ export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -19042,8 +22016,12 @@ export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -19058,8 +22036,12 @@ export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( httpStatusCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -19070,7 +22052,7 @@ export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( }), Schema.Struct({ activeTurnNotSteerable: Schema.Struct({ - turnKind: V2TurnStartedNotification__NonSteerableTurnKind, + turnKind: V2TurnStartResponse__NonSteerableTurnKind, }), }).annotate({ title: "ActiveTurnNotSteerableCodexErrorInfo", @@ -19082,220 +22064,49 @@ export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2TurnStartResponse__CodexErrorInfo", }); -export type V2TurnStartedNotification__FileUpdateChange = { - readonly diff: string; - readonly kind: V2TurnStartedNotification__PatchChangeKind; - readonly path: string; +export type V2TurnStartResponse__TextElement = { + readonly byteRange: V2TurnStartResponse__ByteRange; + readonly placeholder?: string | null; }; -export const V2TurnStartedNotification__FileUpdateChange = Schema.Struct({ - diff: Schema.String, - kind: V2TurnStartedNotification__PatchChangeKind, - path: Schema.String, -}); +export const V2TurnStartResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2TurnStartResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2TurnStartResponse__TextElement" }); -export type V2TurnStartedNotification__UserInput = +export type V2TurnStartResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2TurnStartResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2TurnStartResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2TurnStartResponse__MemoryCitation" }); + +export type V2TurnStartResponse__CommandAction = | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; + readonly command: string; + readonly name: string; + readonly path: V2TurnStartResponse__AbsolutePathBuf; + readonly type: "read"; } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } | { - readonly detail?: V2TurnStartedNotification__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2TurnStartedNotification__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2TurnStartedNotification__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2TurnStartedNotification__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), - ), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); - -export type V2TurnStartParams__SandboxPolicy = - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } - | { - readonly excludeSlashTmp?: boolean; - readonly excludeTmpdirEnvVar?: boolean; - readonly networkAccess?: boolean; - readonly type: "workspaceWrite"; - readonly writableRoots?: ReadonlyArray; - }; -export const V2TurnStartParams__SandboxPolicy = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("dangerFullAccess").annotate({ - title: "DangerFullAccessSandboxPolicyType", - }), - }).annotate({ title: "DangerFullAccessSandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), - }).annotate({ title: "ReadOnlySandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), - ), - type: Schema.Literal("externalSandbox").annotate({ - title: "ExternalSandboxSandboxPolicyType", - }), - }).annotate({ title: "ExternalSandboxSandboxPolicy" }), - Schema.Struct({ - excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), - writableRoots: Schema.optionalKey( - Schema.Array(V2TurnStartParams__AbsolutePathBuf).annotate({ default: [] }), - ), - }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), - ], - { mode: "oneOf" }, -); - -export type V2TurnStartParams__Settings = { - readonly developer_instructions?: string | null; - readonly model: string; - readonly reasoning_effort?: V2TurnStartParams__ReasoningEffort | null; -}; -export const V2TurnStartParams__Settings = Schema.Struct({ - developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.String, - reasoning_effort: Schema.optionalKey( - Schema.Union([V2TurnStartParams__ReasoningEffort, Schema.Null]), - ), -}).annotate({ description: "Settings for a collaboration mode." }); - -export type V2TurnStartParams__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2TurnStartParams__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2TurnStartParams__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2TurnStartParams__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2TurnStartParams__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); - -export type V2TurnStartResponse__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: V2TurnStartResponse__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } - | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; } | { readonly command: string; readonly type: "unknown" }; export const V2TurnStartResponse__CommandAction = Schema.Union( @@ -19323,7 +22134,18 @@ export const V2TurnStartResponse__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2TurnStartResponse__CommandAction" }); + +export type V2TurnStartResponse__FileUpdateChange = { + readonly diff: string; + readonly kind: V2TurnStartResponse__PatchChangeKind; + readonly path: string; +}; +export const V2TurnStartResponse__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: V2TurnStartResponse__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "V2TurnStartResponse__FileUpdateChange" }); export type V2TurnStartResponse__CollabAgentState = { readonly message?: string | null; @@ -19332,215 +22154,128 @@ export type V2TurnStartResponse__CollabAgentState = { export const V2TurnStartResponse__CollabAgentState = Schema.Struct({ message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), status: V2TurnStartResponse__CollabAgentStatus, -}); +}).annotate({ identifier: "V2TurnStartResponse__CollabAgentState" }); -export type V2TurnStartResponse__MemoryCitation = { - readonly entries: ReadonlyArray; - readonly threadIds: ReadonlyArray; +export type V2TurnSteerParams__TextElement = { + readonly byteRange: V2TurnSteerParams__ByteRange; + readonly placeholder?: string | null; }; -export const V2TurnStartResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2TurnStartResponse__MemoryCitationEntry), - threadIds: Schema.Array(Schema.String), -}); +export const V2TurnSteerParams__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2TurnSteerParams__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2TurnSteerParams__TextElement" }); -export type V2TurnStartResponse__CodexErrorInfo = - | "contextWindowExceeded" - | "sessionBudgetExceeded" - | "usageLimitExceeded" - | "serverOverloaded" - | "cyberPolicy" - | "internalServerError" - | "unauthorized" - | "badRequest" - | "threadRollbackFailed" - | "sandboxError" - | "other" - | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } - | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } - | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } } - | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } +export type ApplyPatchApprovalResponse__ReviewDecision = + | "approved" | { - readonly activeTurnNotSteerable: { - readonly turnKind: V2TurnStartResponse__NonSteerableTurnKind; + readonly approved_execpolicy_amendment: { + readonly proposed_execpolicy_amendment: ReadonlyArray; }; - }; -export const V2TurnStartResponse__CodexErrorInfo = Schema.Union( + } + | "approved_for_session" + | { + readonly network_policy_amendment: { + readonly network_policy_amendment: ApplyPatchApprovalResponse__NetworkPolicyAmendment; + }; + } + | "denied" + | "timed_out" + | "abort"; +export const ApplyPatchApprovalResponse__ReviewDecision = Schema.Union( [ - Schema.Literals([ - "contextWindowExceeded", - "sessionBudgetExceeded", - "usageLimitExceeded", - "serverOverloaded", - "cyberPolicy", - "internalServerError", - "unauthorized", - "badRequest", - "threadRollbackFailed", - "sandboxError", - "other", - ]), - Schema.Struct({ - httpConnectionFailed: Schema.Struct({ - httpStatusCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - }), - }).annotate({ title: "HttpConnectionFailedCodexErrorInfo" }), - Schema.Struct({ - responseStreamConnectionFailed: Schema.Struct({ - httpStatusCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - }), - }).annotate({ - title: "ResponseStreamConnectionFailedCodexErrorInfo", - description: "Failed to connect to the response SSE stream.", + Schema.Literal("approved").annotate({ + description: "User has approved this command and the agent should execute it.", }), Schema.Struct({ - responseStreamDisconnected: Schema.Struct({ - httpStatusCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), + approved_execpolicy_amendment: Schema.Struct({ + proposed_execpolicy_amendment: Schema.Array(Schema.String), }), }).annotate({ - title: "ResponseStreamDisconnectedCodexErrorInfo", + title: "ApprovedExecpolicyAmendmentReviewDecision", description: - "The response SSE stream disconnected in the middle of a turn before completion.", + "User has approved this command and wants to apply the proposed execpolicy amendment so future matching commands are permitted.", }), - Schema.Struct({ - responseTooManyFailedAttempts: Schema.Struct({ - httpStatusCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - }), - }).annotate({ - title: "ResponseTooManyFailedAttemptsCodexErrorInfo", - description: "Reached the retry limit for responses.", + Schema.Literal("approved_for_session").annotate({ + description: + "User has approved this request and wants future prompts in the same session-scoped approval cache to be automatically approved for the remainder of the session.", }), Schema.Struct({ - activeTurnNotSteerable: Schema.Struct({ - turnKind: V2TurnStartResponse__NonSteerableTurnKind, + network_policy_amendment: Schema.Struct({ + network_policy_amendment: ApplyPatchApprovalResponse__NetworkPolicyAmendment, }), }).annotate({ - title: "ActiveTurnNotSteerableCodexErrorInfo", + title: "NetworkPolicyAmendmentReviewDecision", description: - "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", + "User chose to persist a network policy rule (allow/deny) for future requests to the same host.", + }), + Schema.Literal("denied").annotate({ + description: + "User has denied this command and the agent should not execute it, but it should continue the session and try something else.", + }), + Schema.Literal("timed_out").annotate({ + description: "Automatic approval review timed out before reaching a decision.", + }), + Schema.Literal("abort").annotate({ + description: + "User has denied this command and the agent should not do anything until the user's next command.", }), ], { mode: "oneOf" }, ).annotate({ - description: - "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + description: "User's decision in response to an ExecApprovalRequest.", + identifier: "ApplyPatchApprovalResponse__ReviewDecision", }); -export type V2TurnStartResponse__FileUpdateChange = { - readonly diff: string; - readonly kind: V2TurnStartResponse__PatchChangeKind; - readonly path: string; +export type ClientRequest__PluginShareSaveParams = { + readonly discoverability?: ClientRequest__PluginShareDiscoverability | null; + readonly pluginPath: ClientRequest__AbsolutePathBuf; + readonly remotePluginId?: string | null; + readonly shareTargets?: ReadonlyArray | null; }; -export const V2TurnStartResponse__FileUpdateChange = Schema.Struct({ - diff: Schema.String, - kind: V2TurnStartResponse__PatchChangeKind, - path: Schema.String, -}); +export const ClientRequest__PluginShareSaveParams = Schema.Struct({ + discoverability: Schema.optionalKey( + Schema.Union([ClientRequest__PluginShareDiscoverability, Schema.Null]), + ), + pluginPath: ClientRequest__AbsolutePathBuf, + remotePluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + shareTargets: Schema.optionalKey( + Schema.Union([Schema.Array(ClientRequest__PluginShareTarget), Schema.Null]), + ), +}).annotate({ identifier: "ClientRequest__PluginShareSaveParams" }); -export type V2TurnStartResponse__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2TurnStartResponse__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2TurnStartResponse__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2TurnStartResponse__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2TurnStartResponse__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -); +export type ClientRequest__PluginShareUpdateTargetsParams = { + readonly discoverability: ClientRequest__PluginShareUpdateDiscoverability; + readonly remotePluginId: string; + readonly shareTargets: ReadonlyArray; +}; +export const ClientRequest__PluginShareUpdateTargetsParams = Schema.Struct({ + discoverability: ClientRequest__PluginShareUpdateDiscoverability, + remotePluginId: Schema.String, + shareTargets: Schema.Array(ClientRequest__PluginShareTarget), +}).annotate({ identifier: "ClientRequest__PluginShareUpdateTargetsParams" }); -export type V2TurnSteerParams__UserInput = +export type ClientRequest__UserInput = | { readonly text: string; - readonly text_elements?: ReadonlyArray; + readonly text_elements?: ReadonlyArray; readonly type: "text"; } | { - readonly detail?: V2TurnSteerParams__ImageDetail | null; + readonly detail?: ClientRequest__ImageDetail | null; readonly type: "image"; readonly url: string; } | { - readonly detail?: V2TurnSteerParams__ImageDetail | null; + readonly detail?: ClientRequest__ImageDetail | null; readonly path: string; readonly type: "localImage"; } @@ -19548,12 +22283,12 @@ export type V2TurnSteerParams__UserInput = | { readonly path: string; readonly type: "localAudio" } | { readonly name: string; readonly path: string; readonly type: "skill" } | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2TurnSteerParams__UserInput = Schema.Union( +export const ClientRequest__UserInput = Schema.Union( [ Schema.Struct({ text: Schema.String, text_elements: Schema.optionalKey( - Schema.Array(V2TurnSteerParams__TextElement).annotate({ + Schema.Array(ClientRequest__TextElement).annotate({ description: "UI-defined spans within `text` used to render or persist special elements.", default: [], }), @@ -19561,12 +22296,12 @@ export const V2TurnSteerParams__UserInput = Schema.Union( type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2TurnSteerParams__ImageDetail, Schema.Null])), + detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), url: Schema.String, }).annotate({ title: "ImageUserInput" }), Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2TurnSteerParams__ImageDetail, Schema.Null])), + detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), path: Schema.String, type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), }).annotate({ title: "LocalImageUserInput" }), @@ -19590,65 +22325,15 @@ export const V2TurnSteerParams__UserInput = Schema.Union( }).annotate({ title: "MentionUserInput" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ClientRequest__UserInput" }); -export type ApplyPatchApprovalResponse__ReviewDecision = - | "approved" - | { - readonly approved_execpolicy_amendment: { - readonly proposed_execpolicy_amendment: ReadonlyArray; - }; - } - | "approved_for_session" - | { - readonly network_policy_amendment: { - readonly network_policy_amendment: ApplyPatchApprovalResponse__NetworkPolicyAmendment; - }; - } - | "denied" - | "timed_out" - | "abort"; -export const ApplyPatchApprovalResponse__ReviewDecision = Schema.Union( - [ - Schema.Literal("approved").annotate({ - description: "User has approved this command and the agent should execute it.", - }), - Schema.Struct({ - approved_execpolicy_amendment: Schema.Struct({ - proposed_execpolicy_amendment: Schema.Array(Schema.String), - }), - }).annotate({ - title: "ApprovedExecpolicyAmendmentReviewDecision", - description: - "User has approved this command and wants to apply the proposed execpolicy amendment so future matching commands are permitted.", - }), - Schema.Literal("approved_for_session").annotate({ - description: - "User has approved this request and wants future prompts in the same session-scoped approval cache to be automatically approved for the remainder of the session.", - }), - Schema.Struct({ - network_policy_amendment: Schema.Struct({ - network_policy_amendment: ApplyPatchApprovalResponse__NetworkPolicyAmendment, - }), - }).annotate({ - title: "NetworkPolicyAmendmentReviewDecision", - description: - "User chose to persist a network policy rule (allow/deny) for future requests to the same host.", - }), - Schema.Literal("denied").annotate({ - description: - "User has denied this command and the agent should not execute it, but it should continue the session and try something else.", - }), - Schema.Literal("timed_out").annotate({ - description: "Automatic approval review timed out before reaching a decision.", - }), - Schema.Literal("abort").annotate({ - description: - "User has denied this command and the agent should not do anything until the user's next command.", - }), - ], - { mode: "oneOf" }, -).annotate({ description: "User's decision in response to an ExecApprovalRequest." }); +export type ClientRequest__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const ClientRequest__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(ClientRequest__FunctionCallOutputContentItem), +]).annotate({ identifier: "ClientRequest__FunctionCallOutputBody" }); export type ClientRequest__CommandExecParams = { readonly command: ReadonlyArray; @@ -19705,8 +22390,12 @@ export const ClientRequest__CommandExecParams = Schema.Struct({ "Optional per-stream stdout/stderr capture cap in bytes.\n\nWhen omitted, the server default applies. Cannot be combined with `disableOutputCap`.", format: "uint", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -19748,7 +22437,7 @@ export const ClientRequest__CommandExecParams = Schema.Struct({ description: "Optional timeout in milliseconds.\n\nWhen omitted, the server default applies. Cannot be combined with `disableTimeout`.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -19760,68 +22449,7 @@ export const ClientRequest__CommandExecParams = Schema.Struct({ }).annotate({ description: "Run a standalone command (argv vector) in the server sandbox without creating a thread or turn.\n\nThe final `command/exec` response is deferred until the process exits and is sent only after all `command/exec/outputDelta` notifications for that connection have been emitted.", -}); - -export type ClientRequest__FunctionCallOutputBody = - | string - | ReadonlyArray; -export const ClientRequest__FunctionCallOutputBody = Schema.Union([ - Schema.String, - Schema.Array(ClientRequest__FunctionCallOutputContentItem), -]); - -export type ClientRequest__ConfigBatchWriteParams = { - readonly edits: ReadonlyArray; - readonly expectedVersion?: string | null; - readonly filePath?: string | null; - readonly reloadUserConfig?: boolean; -}; -export const ClientRequest__ConfigBatchWriteParams = Schema.Struct({ - edits: Schema.Array(ClientRequest__ConfigEdit), - expectedVersion: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - filePath: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Path to the config file to write; defaults to the user's `config.toml` when omitted.", - }), - Schema.Null, - ]), - ), - reloadUserConfig: Schema.optionalKey( - Schema.Boolean.annotate({ - description: - "When true, hot-reload the updated user config into all loaded threads after writing.", - }), - ), -}); - -export type ClientRequest__PluginShareSaveParams = { - readonly discoverability?: ClientRequest__PluginShareDiscoverability | null; - readonly pluginPath: ClientRequest__AbsolutePathBuf; - readonly remotePluginId?: string | null; - readonly shareTargets?: ReadonlyArray | null; -}; -export const ClientRequest__PluginShareSaveParams = Schema.Struct({ - discoverability: Schema.optionalKey( - Schema.Union([ClientRequest__PluginShareDiscoverability, Schema.Null]), - ), - pluginPath: ClientRequest__AbsolutePathBuf, - remotePluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - shareTargets: Schema.optionalKey( - Schema.Union([Schema.Array(ClientRequest__PluginShareTarget), Schema.Null]), - ), -}); - -export type ClientRequest__PluginShareUpdateTargetsParams = { - readonly discoverability: ClientRequest__PluginShareUpdateDiscoverability; - readonly remotePluginId: string; - readonly shareTargets: ReadonlyArray; -}; -export const ClientRequest__PluginShareUpdateTargetsParams = Schema.Struct({ - discoverability: ClientRequest__PluginShareUpdateDiscoverability, - remotePluginId: Schema.String, - shareTargets: Schema.Array(ClientRequest__PluginShareTarget), + identifier: "ClientRequest__CommandExecParams", }); export type ClientRequest__ExternalAgentConfigMigrationItem = { @@ -19843,105 +22471,33 @@ export const ClientRequest__ExternalAgentConfigMigrationItem = Schema.Struct({ description: Schema.String, details: Schema.optionalKey(Schema.Union([ClientRequest__MigrationDetails, Schema.Null])), itemType: ClientRequest__ExternalAgentConfigMigrationItemType, -}); +}).annotate({ identifier: "ClientRequest__ExternalAgentConfigMigrationItem" }); -export type ClientRequest__TurnStartParams = { - readonly approvalPolicy?: ClientRequest__AskForApproval | null; - readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; - readonly clientUserMessageId?: string | null; - readonly cwd?: string | null; - readonly effort?: ClientRequest__ReasoningEffort | null; - readonly input: ReadonlyArray; - readonly model?: string | null; - readonly outputSchema?: unknown; - readonly personality?: ClientRequest__Personality | null; - readonly sandboxPolicy?: ClientRequest__SandboxPolicy | null; - readonly serviceTier?: string | null; - readonly summary?: ClientRequest__ReasoningSummary | null; - readonly threadId: string; +export type ClientRequest__ConfigBatchWriteParams = { + readonly edits: ReadonlyArray; + readonly expectedVersion?: string | null; + readonly filePath?: string | null; + readonly reloadUserConfig?: boolean; }; -export const ClientRequest__TurnStartParams = Schema.Struct({ - approvalPolicy: Schema.optionalKey( - Schema.Union([ClientRequest__AskForApproval, Schema.Null]).annotate({ - description: "Override the approval policy for this turn and subsequent turns.", - }), - ), - approvalsReviewer: Schema.optionalKey( - Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ - description: - "Override where approval requests are routed for review on this turn and subsequent turns.", - }), - ), - clientUserMessageId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - cwd: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Override the working directory for this turn and subsequent turns.", - }), - Schema.Null, - ]), - ), - effort: Schema.optionalKey( - Schema.Union([ClientRequest__ReasoningEffort, Schema.Null]).annotate({ - description: "Override the reasoning effort for this turn and subsequent turns.", - }), - ), - input: Schema.Array(ClientRequest__UserInput), - model: Schema.optionalKey( +export const ClientRequest__ConfigBatchWriteParams = Schema.Struct({ + edits: Schema.Array(ClientRequest__ConfigEdit), + expectedVersion: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + filePath: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Override the model for this turn and subsequent turns.", + description: + "Path to the config file to write; defaults to the user's `config.toml` when omitted.", }), Schema.Null, ]), ), - outputSchema: Schema.optionalKey( - Schema.Unknown.annotate({ + reloadUserConfig: Schema.optionalKey( + Schema.Boolean.annotate({ description: - "Optional JSON Schema used to constrain the final assistant message for this turn.", - }), - ), - personality: Schema.optionalKey( - Schema.Union([ClientRequest__Personality, Schema.Null]).annotate({ - description: "Override the personality for this turn and subsequent turns.", - }), - ), - sandboxPolicy: Schema.optionalKey( - Schema.Union([ClientRequest__SandboxPolicy, Schema.Null]).annotate({ - description: "Override the sandbox policy for this turn and subsequent turns.", - }), - ), - serviceTier: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Override the service tier for this turn and subsequent turns.", - }), - Schema.Null, - ]), - ), - summary: Schema.optionalKey( - Schema.Union([ClientRequest__ReasoningSummary, Schema.Null]).annotate({ - description: "Override the reasoning summary for this turn and subsequent turns.", + "When true, hot-reload the updated user config into all loaded threads after writing.", }), ), - threadId: Schema.String, -}); - -export type ClientRequest__TurnSteerParams = { - readonly clientUserMessageId?: string | null; - readonly expectedTurnId: string; - readonly input: ReadonlyArray; - readonly threadId: string; -}; -export const ClientRequest__TurnSteerParams = Schema.Struct({ - clientUserMessageId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - expectedTurnId: Schema.String.annotate({ - description: - "Required active turn id precondition. The request fails when it does not match the currently active turn.", - }), - input: Schema.Array(ClientRequest__UserInput), - threadId: Schema.String, -}); +}).annotate({ identifier: "ClientRequest__ConfigBatchWriteParams" }); export type CommandExecutionRequestApprovalParams__FileSystemPath = | { @@ -19969,7 +22525,7 @@ export const CommandExecutionRequestApprovalParams__FileSystemPath = Schema.Unio }).annotate({ title: "SpecialFileSystemPath" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "CommandExecutionRequestApprovalParams__FileSystemPath" }); export type CommandExecutionRequestApprovalResponse__CommandExecutionApprovalDecision = | "accept" @@ -20019,7 +22575,9 @@ export const CommandExecutionRequestApprovalResponse__CommandExecutionApprovalDe }), ], { mode: "oneOf" }, - ); + ).annotate({ + identifier: "CommandExecutionRequestApprovalResponse__CommandExecutionApprovalDecision", + }); export type ExecCommandApprovalResponse__ReviewDecision = | "approved" @@ -20077,86 +22635,111 @@ export const ExecCommandApprovalResponse__ReviewDecision = Schema.Union( }), ], { mode: "oneOf" }, -).annotate({ description: "User's decision in response to an ExecApprovalRequest." }); +).annotate({ + description: "User's decision in response to an ExecApprovalRequest.", + identifier: "ExecCommandApprovalResponse__ReviewDecision", +}); -export type McpServerElicitationRequestParams__McpElicitationTitledMultiSelectEnumSchema = { +export type McpServerElicitationRequestParams__McpElicitationUntitledMultiSelectEnumSchema = { readonly default?: ReadonlyArray | null; readonly description?: string | null; - readonly items: McpServerElicitationRequestParams__McpElicitationTitledEnumItems; + readonly items: McpServerElicitationRequestParams__McpElicitationUntitledEnumItems; readonly maxItems?: number | null; readonly minItems?: number | null; readonly title?: string | null; readonly type: McpServerElicitationRequestParams__McpElicitationArrayType; }; -export const McpServerElicitationRequestParams__McpElicitationTitledMultiSelectEnumSchema = +export const McpServerElicitationRequestParams__McpElicitationUntitledMultiSelectEnumSchema = Schema.Struct({ default: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - items: McpServerElicitationRequestParams__McpElicitationTitledEnumItems, + items: McpServerElicitationRequestParams__McpElicitationUntitledEnumItems, maxItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), minItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), type: McpServerElicitationRequestParams__McpElicitationArrayType, + }).annotate({ + identifier: "McpServerElicitationRequestParams__McpElicitationUntitledMultiSelectEnumSchema", }); -export type McpServerElicitationRequestParams__McpElicitationUntitledMultiSelectEnumSchema = { +export type McpServerElicitationRequestParams__McpElicitationSingleSelectEnumSchema = + | McpServerElicitationRequestParams__McpElicitationUntitledSingleSelectEnumSchema + | McpServerElicitationRequestParams__McpElicitationTitledSingleSelectEnumSchema; +export const McpServerElicitationRequestParams__McpElicitationSingleSelectEnumSchema = Schema.Union( + [ + McpServerElicitationRequestParams__McpElicitationUntitledSingleSelectEnumSchema, + McpServerElicitationRequestParams__McpElicitationTitledSingleSelectEnumSchema, + ], +).annotate({ + identifier: "McpServerElicitationRequestParams__McpElicitationSingleSelectEnumSchema", +}); + +export type McpServerElicitationRequestParams__McpElicitationTitledMultiSelectEnumSchema = { readonly default?: ReadonlyArray | null; readonly description?: string | null; - readonly items: McpServerElicitationRequestParams__McpElicitationUntitledEnumItems; + readonly items: McpServerElicitationRequestParams__McpElicitationTitledEnumItems; readonly maxItems?: number | null; readonly minItems?: number | null; readonly title?: string | null; readonly type: McpServerElicitationRequestParams__McpElicitationArrayType; }; -export const McpServerElicitationRequestParams__McpElicitationUntitledMultiSelectEnumSchema = +export const McpServerElicitationRequestParams__McpElicitationTitledMultiSelectEnumSchema = Schema.Struct({ default: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - items: McpServerElicitationRequestParams__McpElicitationUntitledEnumItems, + items: McpServerElicitationRequestParams__McpElicitationTitledEnumItems, maxItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), minItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), type: McpServerElicitationRequestParams__McpElicitationArrayType, + }).annotate({ + identifier: "McpServerElicitationRequestParams__McpElicitationTitledMultiSelectEnumSchema", }); -export type McpServerElicitationRequestParams__McpElicitationSingleSelectEnumSchema = - | McpServerElicitationRequestParams__McpElicitationUntitledSingleSelectEnumSchema - | McpServerElicitationRequestParams__McpElicitationTitledSingleSelectEnumSchema; -export const McpServerElicitationRequestParams__McpElicitationSingleSelectEnumSchema = Schema.Union( - [ - McpServerElicitationRequestParams__McpElicitationUntitledSingleSelectEnumSchema, - McpServerElicitationRequestParams__McpElicitationTitledSingleSelectEnumSchema, - ], -); - export type PermissionsRequestApprovalParams__FileSystemPath = | { readonly path: PermissionsRequestApprovalParams__LegacyAppPathString; readonly type: "path" } | { readonly pattern: string; readonly type: "glob_pattern" } @@ -20180,7 +22763,7 @@ export const PermissionsRequestApprovalParams__FileSystemPath = Schema.Union( }).annotate({ title: "SpecialFileSystemPath" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "PermissionsRequestApprovalParams__FileSystemPath" }); export type PermissionsRequestApprovalResponse__FileSystemPath = | { @@ -20208,7 +22791,260 @@ export const PermissionsRequestApprovalResponse__FileSystemPath = Schema.Union( }).annotate({ title: "SpecialFileSystemPath" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "PermissionsRequestApprovalResponse__FileSystemPath" }); + +export type ServerNotification__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: ServerNotification__CodexErrorInfo | null; + readonly message: string; +}; +export const ServerNotification__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([ServerNotification__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "ServerNotification__TurnError" }); + +export type ServerNotification__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: ServerNotification__SubAgentSource }; +export const ServerNotification__SessionSource = Schema.Union( + [ + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: ServerNotification__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__SessionSource" }); + +export type ServerNotification__ThreadStatusChangedNotification = { + readonly status: ServerNotification__ThreadStatus; + readonly threadId: string; +}; +export const ServerNotification__ThreadStatusChangedNotification = Schema.Struct({ + status: ServerNotification__ThreadStatus, + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadStatusChangedNotification" }); + +export type ServerNotification__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: ServerNotification__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: ServerNotification__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const ServerNotification__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(ServerNotification__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__UserInput" }); + +export type ServerNotification__FileSystemPath = + | { readonly path: ServerNotification__LegacyAppPathString; readonly type: "path" } + | { readonly pattern: string; readonly type: "glob_pattern" } + | { readonly type: "special"; readonly value: ServerNotification__FileSystemSpecialPath }; +export const ServerNotification__FileSystemPath = Schema.Union( + [ + Schema.Struct({ + path: ServerNotification__LegacyAppPathString, + type: Schema.Literal("path").annotate({ title: "PathFileSystemPathType" }), + }).annotate({ title: "PathFileSystemPath" }), + Schema.Struct({ + pattern: Schema.String, + type: Schema.Literal("glob_pattern").annotate({ title: "GlobPatternFileSystemPathType" }), + }).annotate({ title: "GlobPatternFileSystemPath" }), + Schema.Struct({ + type: Schema.Literal("special").annotate({ title: "SpecialFileSystemPathType" }), + value: ServerNotification__FileSystemSpecialPath, + }).annotate({ title: "SpecialFileSystemPath" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__FileSystemPath" }); + +export type ServerNotification__FileChangePatchUpdatedNotification = { + readonly changes: ReadonlyArray; + readonly itemId: string; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__FileChangePatchUpdatedNotification = Schema.Struct({ + changes: Schema.Array(ServerNotification__FileUpdateChange), + itemId: Schema.String, + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__FileChangePatchUpdatedNotification" }); + +export type ServerNotification__CollaborationMode = { + readonly mode: ServerNotification__ModeKind; + readonly settings: ServerNotification__Settings; +}; +export const ServerNotification__CollaborationMode = Schema.Struct({ + mode: ServerNotification__ModeKind, + settings: ServerNotification__Settings, +}).annotate({ + description: "Collaboration mode for a Codex session.", + identifier: "ServerNotification__CollaborationMode", +}); + +export type ServerNotification__ThreadGoalUpdatedNotification = { + readonly goal: ServerNotification__ThreadGoal; + readonly threadId: string; + readonly turnId?: string | null; +}; +export const ServerNotification__ThreadGoalUpdatedNotification = Schema.Struct({ + goal: ServerNotification__ThreadGoal, + threadId: Schema.String, + turnId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__ThreadGoalUpdatedNotification" }); + +export type ServerNotification__ThreadTokenUsageUpdatedNotification = { + readonly threadId: string; + readonly tokenUsage: ServerNotification__ThreadTokenUsage; + readonly turnId: string; +}; +export const ServerNotification__ThreadTokenUsageUpdatedNotification = Schema.Struct({ + threadId: Schema.String, + tokenUsage: ServerNotification__ThreadTokenUsage, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadTokenUsageUpdatedNotification" }); + +export type ServerNotification__HookRunSummary = { + readonly completedAt?: number | null; + readonly displayOrder: number; + readonly durationMs?: number | null; + readonly entries: ReadonlyArray; + readonly eventName: ServerNotification__HookEventName; + readonly executionMode: ServerNotification__HookExecutionMode; + readonly handlerType: ServerNotification__HookHandlerType; + readonly id: string; + readonly scope: ServerNotification__HookScope; + readonly source?: ServerNotification__HookSource; + readonly sourcePath: ServerNotification__AbsolutePathBuf; + readonly startedAt: number; + readonly status: ServerNotification__HookRunStatus; + readonly statusMessage?: string | null; +}; +export const ServerNotification__HookRunSummary = Schema.Struct({ + completedAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + displayOrder: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + entries: Schema.Array(ServerNotification__HookOutputEntry), + eventName: ServerNotification__HookEventName, + executionMode: ServerNotification__HookExecutionMode, + handlerType: ServerNotification__HookHandlerType, + id: Schema.String, + scope: ServerNotification__HookScope, + source: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => ServerNotification__HookSource, + ).annotate({ default: "unknown" }), + ), + sourcePath: ServerNotification__AbsolutePathBuf, + startedAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + status: ServerNotification__HookRunStatus, + statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__HookRunSummary" }); + +export type ServerNotification__TurnPlanUpdatedNotification = { + readonly explanation?: string | null; + readonly plan: ReadonlyArray; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__TurnPlanUpdatedNotification = Schema.Struct({ + explanation: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + plan: Schema.Array(ServerNotification__TurnPlanStep), + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__TurnPlanUpdatedNotification" }); + +export type ServerNotification__AccountRateLimitsUpdatedNotification = { + readonly rateLimits: ServerNotification__RateLimitSnapshot; +}; +export const ServerNotification__AccountRateLimitsUpdatedNotification = Schema.Struct({ + rateLimits: ServerNotification__RateLimitSnapshot, +}).annotate({ + description: + "Sparse rolling rate-limit update.\n\nClients should merge available values into the most recent `account/rateLimits/read` response or refetch that snapshot. Nullable account metadata may be unavailable in a rolling update and does not clear a previously observed value.", + identifier: "ServerNotification__AccountRateLimitsUpdatedNotification", +}); export type ServerNotification__AppInfo = { readonly appMetadata?: ServerNotification__AppMetadata | null; @@ -20255,7 +23091,10 @@ export const ServerNotification__AppInfo = Schema.Struct({ logoUrlDark: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, pluginDisplayNames: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), -}).annotate({ description: "EXPERIMENTAL - app metadata returned by app-list APIs." }); +}).annotate({ + description: "EXPERIMENTAL - app metadata returned by app-list APIs.", + identifier: "ServerNotification__AppInfo", +}); export type ServerNotification__ExternalAgentConfigImportTypeResult = { readonly failures: ReadonlyArray; @@ -20266,7 +23105,36 @@ export const ServerNotification__ExternalAgentConfigImportTypeResult = Schema.St failures: Schema.Array(ServerNotification__ExternalAgentConfigImportItemTypeFailure), itemType: ServerNotification__ExternalAgentConfigMigrationItemType, successes: Schema.Array(ServerNotification__ExternalAgentConfigImportItemTypeSuccess), -}); +}).annotate({ identifier: "ServerNotification__ExternalAgentConfigImportTypeResult" }); + +export type ServerNotification__ConfigWarningNotification = { + readonly details?: string | null; + readonly path?: string | null; + readonly range?: ServerNotification__TextRange | null; + readonly summary: string; +}; +export const ServerNotification__ConfigWarningNotification = Schema.Struct({ + details: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Optional extra guidance or error details." }), + Schema.Null, + ]), + ), + path: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional path to the config file that triggered the warning.", + }), + Schema.Null, + ]), + ), + range: Schema.optionalKey( + Schema.Union([ServerNotification__TextRange, Schema.Null]).annotate({ + description: "Optional range for the error location inside the config file.", + }), + ), + summary: Schema.String.annotate({ description: "Concise summary of the warning." }), +}).annotate({ identifier: "ServerNotification__ConfigWarningNotification" }); export type ServerNotification__FuzzyFileSearchSessionUpdatedNotification = { readonly files: ReadonlyArray; @@ -20277,78 +23145,16 @@ export const ServerNotification__FuzzyFileSearchSessionUpdatedNotification = Sch files: Schema.Array(ServerNotification__FuzzyFileSearchResult), query: Schema.String, sessionId: Schema.String, -}); - -export type ServerNotification__HookRunSummary = { - readonly completedAt?: number | null; - readonly displayOrder: number; - readonly durationMs?: number | null; - readonly entries: ReadonlyArray; - readonly eventName: ServerNotification__HookEventName; - readonly executionMode: ServerNotification__HookExecutionMode; - readonly handlerType: ServerNotification__HookHandlerType; - readonly id: string; - readonly scope: ServerNotification__HookScope; - readonly source?: - | "system" - | "user" - | "project" - | "mdm" - | "sessionFlags" - | "plugin" - | "cloudRequirements" - | "cloudManagedConfig" - | "legacyManagedConfigFile" - | "legacyManagedConfigMdm" - | "unknown"; - readonly sourcePath: ServerNotification__AbsolutePathBuf; - readonly startedAt: number; - readonly status: ServerNotification__HookRunStatus; - readonly statusMessage?: string | null; -}; -export const ServerNotification__HookRunSummary = Schema.Struct({ - completedAt: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), - displayOrder: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - durationMs: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), - ), - entries: Schema.Array(ServerNotification__HookOutputEntry), - eventName: ServerNotification__HookEventName, - executionMode: ServerNotification__HookExecutionMode, - handlerType: ServerNotification__HookHandlerType, - id: Schema.String, - scope: ServerNotification__HookScope, - source: Schema.optionalKey( - Schema.Literals([ - "system", - "user", - "project", - "mdm", - "sessionFlags", - "plugin", - "cloudRequirements", - "cloudManagedConfig", - "legacyManagedConfigFile", - "legacyManagedConfigMdm", - "unknown", - ]).annotate({ default: "unknown" }), - ), - sourcePath: ServerNotification__AbsolutePathBuf, - startedAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - status: ServerNotification__HookRunStatus, - statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "ServerNotification__FuzzyFileSearchSessionUpdatedNotification" }); -export type ServerNotification__FileSystemPath = - | { readonly path: ServerNotification__LegacyAppPathString; readonly type: "path" } +export type ServerRequest__FileSystemPath = + | { readonly path: ServerRequest__LegacyAppPathString; readonly type: "path" } | { readonly pattern: string; readonly type: "glob_pattern" } - | { readonly type: "special"; readonly value: ServerNotification__FileSystemSpecialPath }; -export const ServerNotification__FileSystemPath = Schema.Union( + | { readonly type: "special"; readonly value: ServerRequest__FileSystemSpecialPath }; +export const ServerRequest__FileSystemPath = Schema.Union( [ Schema.Struct({ - path: ServerNotification__LegacyAppPathString, + path: ServerRequest__LegacyAppPathString, type: Schema.Literal("path").annotate({ title: "PathFileSystemPathType" }), }).annotate({ title: "PathFileSystemPath" }), Schema.Struct({ @@ -20357,601 +23163,129 @@ export const ServerNotification__FileSystemPath = Schema.Union( }).annotate({ title: "GlobPatternFileSystemPath" }), Schema.Struct({ type: Schema.Literal("special").annotate({ title: "SpecialFileSystemPathType" }), - value: ServerNotification__FileSystemSpecialPath, + value: ServerRequest__FileSystemSpecialPath, }).annotate({ title: "SpecialFileSystemPath" }), ], { mode: "oneOf" }, -); - -export type ServerNotification__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: ServerNotification__CodexErrorInfo | null; - readonly message: string; -}; -export const ServerNotification__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([ServerNotification__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); +).annotate({ identifier: "ServerRequest__FileSystemPath" }); -export type ServerNotification__FileChangePatchUpdatedNotification = { - readonly changes: ReadonlyArray; +export type ServerRequest__CommandExecutionRequestApprovalParams = { + readonly approvalId?: string | null; + readonly command?: string | null; + readonly commandActions?: ReadonlyArray | null; + readonly cwd?: ServerRequest__LegacyAppPathString | null; + readonly environmentId?: string | null; readonly itemId: string; + readonly networkApprovalContext?: ServerRequest__NetworkApprovalContext | null; + readonly proposedExecpolicyAmendment?: ReadonlyArray | null; + readonly proposedNetworkPolicyAmendments?: ReadonlyArray | null; + readonly reason?: string | null; + readonly startedAtMs: number; readonly threadId: string; readonly turnId: string; }; -export const ServerNotification__FileChangePatchUpdatedNotification = Schema.Struct({ - changes: Schema.Array(ServerNotification__FileUpdateChange), - itemId: Schema.String, - threadId: Schema.String, - turnId: Schema.String, -}); - -export type ServerNotification__CollaborationMode = { - readonly mode: ServerNotification__ModeKind; - readonly settings: ServerNotification__Settings; -}; -export const ServerNotification__CollaborationMode = Schema.Struct({ - mode: ServerNotification__ModeKind, - settings: ServerNotification__Settings, -}).annotate({ description: "Collaboration mode for a Codex session." }); - -export type ServerNotification__AccountRateLimitsUpdatedNotification = { - readonly rateLimits: ServerNotification__RateLimitSnapshot; -}; -export const ServerNotification__AccountRateLimitsUpdatedNotification = Schema.Struct({ - rateLimits: ServerNotification__RateLimitSnapshot, -}).annotate({ - description: - "Sparse rolling rate-limit update.\n\nClients should merge available values into the most recent `account/rateLimits/read` response or refetch that snapshot. Nullable account metadata may be unavailable in a rolling update and does not clear a previously observed value.", -}); - -export type ServerNotification__ThreadItem = - | { - readonly clientId?: string | null; - readonly content: ReadonlyArray; - readonly id: string; - readonly type: "userMessage"; - } - | { - readonly fragments: ReadonlyArray; - readonly id: string; - readonly type: "hookPrompt"; - } - | { - readonly id: string; - readonly memoryCitation?: ServerNotification__MemoryCitation | null; - readonly phase?: ServerNotification__MessagePhase | null; - readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; - readonly type: "agentMessage"; - } - | { readonly id: string; readonly text: string; readonly type: "plan" } - | { - readonly content?: ReadonlyArray; - readonly id: string; - readonly summary?: ReadonlyArray; - readonly type: "reasoning"; - } - | { - readonly aggregatedOutput?: string | null; - readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; - readonly durationMs?: number | null; - readonly exitCode?: number | null; - readonly id: string; - readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: ServerNotification__CommandExecutionStatus; - readonly type: "commandExecution"; - } - | { - readonly changes: ReadonlyArray; - readonly id: string; - readonly status: ServerNotification__PatchApplyStatus; - readonly type: "fileChange"; - } - | { - readonly appContext?: ServerNotification__McpToolCallAppContext | null; - readonly arguments: unknown; - readonly durationMs?: number | null; - readonly error?: ServerNotification__McpToolCallError | null; - readonly id: string; - readonly mcpAppResourceUri?: string | null; - readonly pluginId?: string | null; - readonly result?: ServerNotification__McpToolCallResult | null; - readonly server: string; - readonly status: ServerNotification__McpToolCallStatus; - readonly tool: string; - readonly type: "mcpToolCall"; - } - | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; - readonly durationMs?: number | null; - readonly id: string; - readonly namespace?: string | null; - readonly status: ServerNotification__DynamicToolCallStatus; - readonly success?: boolean | null; - readonly tool: string; - readonly type: "dynamicToolCall"; - } - | { - readonly agentsStates: { readonly [x: string]: ServerNotification__CollabAgentState }; - readonly id: string; - readonly model?: string | null; - readonly prompt?: string | null; - readonly reasoningEffort?: ServerNotification__ReasoningEffort | null; - readonly receiverThreadIds: ReadonlyArray; - readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; - readonly type: "collabAgentToolCall"; - } - | { - readonly agentPath: string; - readonly agentThreadId: string; - readonly id: string; - readonly kind: ServerNotification__SubAgentActivityKind; - readonly type: "subAgentActivity"; - } - | { - readonly action?: ServerNotification__WebSearchAction | null; - readonly id: string; - readonly query: string; - readonly results?: ReadonlyArray | null; - readonly type: "webSearch"; - } - | { - readonly id: string; - readonly path: ServerNotification__LegacyAppPathString; - readonly type: "imageView"; - } - | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } - | { - readonly id: string; - readonly result: string; - readonly revisedPrompt?: string | null; - readonly savedPath?: ServerNotification__AbsolutePathBuf | null; - readonly status: string; - readonly type: "imageGeneration"; - } - | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } - | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } - | { readonly id: string; readonly type: "contextCompaction" }; -export const ServerNotification__ThreadItem = Schema.Union( - [ - Schema.Struct({ - clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(ServerNotification__UserInput), - id: Schema.String, - type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), - }).annotate({ title: "UserMessageThreadItem" }), - Schema.Struct({ - fragments: Schema.Array(ServerNotification__HookPromptFragment), - id: Schema.String, - type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), - }).annotate({ title: "HookPromptThreadItem" }), - Schema.Struct({ - id: Schema.String, - memoryCitation: Schema.optionalKey( - Schema.Union([ServerNotification__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey(Schema.Union([ServerNotification__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), - questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), - ), - type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), - }).annotate({ title: "AgentMessageThreadItem" }), - Schema.Struct({ - id: Schema.String, - text: Schema.String, - type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), - }).annotate({ - title: "PlanThreadItem", - description: - "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", - }), - Schema.Struct({ - content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - id: Schema.String, - summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), - }).annotate({ title: "ReasoningThreadItem" }), - Schema.Struct({ - aggregatedOutput: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "The command's output, aggregated from stdout and stderr.", - }), - Schema.Null, - ]), - ), - command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(ServerNotification__CommandAction).annotate({ - description: - "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", - }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the command execution in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - exitCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The command's exit code.", - format: "int32", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - id: Schema.String, - processId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Identifier for the underlying PTY process (when available).", - }), - Schema.Null, - ]), - ), - source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), - ), - status: ServerNotification__CommandExecutionStatus, - type: Schema.Literal("commandExecution").annotate({ - title: "CommandExecutionThreadItemType", - }), - }).annotate({ title: "CommandExecutionThreadItem" }), - Schema.Struct({ - changes: Schema.Array(ServerNotification__FileUpdateChange), - id: Schema.String, - status: ServerNotification__PatchApplyStatus, - type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), - }).annotate({ title: "FileChangeThreadItem" }), - Schema.Struct({ - appContext: Schema.optionalKey( - Schema.Union([ServerNotification__McpToolCallAppContext, Schema.Null]), - ), - arguments: Schema.Unknown, - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the MCP tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - error: Schema.optionalKey(Schema.Union([ServerNotification__McpToolCallError, Schema.Null])), - id: Schema.String, - mcpAppResourceUri: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", - }), - Schema.Null, - ]), - ), - pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - result: Schema.optionalKey( - Schema.Union([ServerNotification__McpToolCallResult, Schema.Null]), - ), - server: Schema.String, - status: ServerNotification__McpToolCallStatus, - tool: Schema.String, - type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), - }).annotate({ title: "McpToolCallThreadItem" }), - Schema.Struct({ - arguments: Schema.Unknown, - contentItems: Schema.optionalKey( - Schema.Union([ - Schema.Array(ServerNotification__DynamicToolCallOutputContentItem), - Schema.Null, - ]), - ), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the dynamic tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - id: Schema.String, - namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: ServerNotification__DynamicToolCallStatus, - success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - tool: Schema.String, - type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), - }).annotate({ title: "DynamicToolCallThreadItem" }), - Schema.Struct({ - agentsStates: Schema.Record(Schema.String, ServerNotification__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", - }), - id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), - model: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Model requested for the spawned agent, when applicable.", - }), - Schema.Null, - ]), - ), - prompt: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Prompt text sent as part of the collab tool call, when available.", - }), - Schema.Null, - ]), - ), - reasoningEffort: Schema.optionalKey( - Schema.Union([ServerNotification__ReasoningEffort, Schema.Null]).annotate({ - description: "Reasoning effort requested for the spawned agent, when applicable.", - }), - ), - receiverThreadIds: Schema.Array(Schema.String).annotate({ +export const ServerRequest__CommandExecutionRequestApprovalParams = Schema.Struct({ + approvalId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: - "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", - }), - senderThreadId: Schema.String.annotate({ - description: "Thread ID of the agent issuing the collab request.", - }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), - type: Schema.Literal("collabAgentToolCall").annotate({ - title: "CollabAgentToolCallThreadItemType", + "Unique identifier for this specific approval callback.\n\nFor regular shell/unified_exec approvals, this is null.\n\nFor zsh-exec-bridge subcommand approvals, multiple callbacks can belong to one parent `itemId`, so `approvalId` is a distinct opaque callback id (a UUID) used to disambiguate routing.", }), - }).annotate({ title: "CollabAgentToolCallThreadItem" }), - Schema.Struct({ - agentPath: Schema.String, - agentThreadId: Schema.String, - id: Schema.String, - kind: ServerNotification__SubAgentActivityKind, - type: Schema.Literal("subAgentActivity").annotate({ - title: "SubAgentActivityThreadItemType", + Schema.Null, + ]), + ), + command: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "The command to be executed." }), + Schema.Null, + ]), + ), + commandActions: Schema.optionalKey( + Schema.Union([ + Schema.Array(ServerRequest__CommandAction).annotate({ + description: "Best-effort parsed command actions for friendly display.", }), - }).annotate({ title: "SubAgentActivityThreadItem" }), - Schema.Struct({ - action: Schema.optionalKey(Schema.Union([ServerNotification__WebSearchAction, Schema.Null])), - id: Schema.String, - query: Schema.String, - results: Schema.optionalKey( - Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ - description: - "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", - }), - Schema.Null, - ]), - ), - type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), - }).annotate({ title: "WebSearchThreadItem" }), - Schema.Struct({ - id: Schema.String, - path: ServerNotification__LegacyAppPathString, - type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), - }).annotate({ title: "ImageViewThreadItem" }), - Schema.Struct({ - durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - id: Schema.String, - type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), - }).annotate({ - title: "SleepThreadItem", - description: "Display item emitted by the interruptible `clock.sleep` tool.", + Schema.Null, + ]), + ), + cwd: Schema.optionalKey( + Schema.Union([ServerRequest__LegacyAppPathString, Schema.Null]).annotate({ + description: "The command's working directory.", }), - Schema.Struct({ - id: Schema.String, - result: Schema.String, - revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - savedPath: Schema.optionalKey( - Schema.Union([ServerNotification__AbsolutePathBuf, Schema.Null]), - ), - status: Schema.String, - type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), - }).annotate({ title: "ImageGenerationThreadItem" }), - Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("enteredReviewMode").annotate({ - title: "EnteredReviewModeThreadItemType", - }), - }).annotate({ title: "EnteredReviewModeThreadItem" }), - Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("exitedReviewMode").annotate({ - title: "ExitedReviewModeThreadItemType", - }), - }).annotate({ title: "ExitedReviewModeThreadItem" }), - Schema.Struct({ - id: Schema.String, - type: Schema.Literal("contextCompaction").annotate({ - title: "ContextCompactionThreadItemType", + ), + environmentId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Environment in which the command will run." }), + Schema.Null, + ]), + ), + itemId: Schema.String, + networkApprovalContext: Schema.optionalKey( + Schema.Union([ServerRequest__NetworkApprovalContext, Schema.Null]).annotate({ + description: "Optional context for a managed-network approval prompt.", + }), + ), + proposedExecpolicyAmendment: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: + "Optional proposed execpolicy amendment to allow similar commands without prompting.", }), - }).annotate({ title: "ContextCompactionThreadItem" }), - ], - { mode: "oneOf" }, -); - -export type ServerNotification__ConfigWarningNotification = { - readonly details?: string | null; - readonly path?: string | null; - readonly range?: ServerNotification__TextRange | null; - readonly summary: string; -}; -export const ServerNotification__ConfigWarningNotification = Schema.Struct({ - details: Schema.optionalKey( + Schema.Null, + ]), + ), + proposedNetworkPolicyAmendments: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ description: "Optional extra guidance or error details." }), + Schema.Array(ServerRequest__NetworkPolicyAmendment).annotate({ + description: + "Optional proposed network policy amendments (allow/deny host) for future requests.", + }), Schema.Null, ]), ), - path: Schema.optionalKey( + reason: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Optional path to the config file that triggered the warning.", + description: "Optional explanatory reason (e.g. request for network access).", }), Schema.Null, ]), ), - range: Schema.optionalKey( - Schema.Union([ServerNotification__TextRange, Schema.Null]).annotate({ - description: "Optional range for the error location inside the config file.", - }), - ), - summary: Schema.String.annotate({ description: "Concise summary of the warning." }), -}); - -export type ServerNotification__ThreadStatusChangedNotification = { - readonly status: ServerNotification__ThreadStatus; - readonly threadId: string; -}; -export const ServerNotification__ThreadStatusChangedNotification = Schema.Struct({ - status: ServerNotification__ThreadStatus, + startedAtMs: Schema.Number.annotate({ + description: "Unix timestamp (in milliseconds) when this approval request started.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), threadId: Schema.String, -}); - -export type ServerNotification__ThreadGoalUpdatedNotification = { - readonly goal: ServerNotification__ThreadGoal; - readonly threadId: string; - readonly turnId?: string | null; -}; -export const ServerNotification__ThreadGoalUpdatedNotification = Schema.Struct({ - goal: ServerNotification__ThreadGoal, - threadId: Schema.String, - turnId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type ServerNotification__ThreadTokenUsageUpdatedNotification = { - readonly threadId: string; - readonly tokenUsage: ServerNotification__ThreadTokenUsage; - readonly turnId: string; -}; -export const ServerNotification__ThreadTokenUsageUpdatedNotification = Schema.Struct({ - threadId: Schema.String, - tokenUsage: ServerNotification__ThreadTokenUsage, turnId: Schema.String, -}); +}).annotate({ identifier: "ServerRequest__CommandExecutionRequestApprovalParams" }); -export type ServerNotification__TurnPlanUpdatedNotification = { - readonly explanation?: string | null; - readonly plan: ReadonlyArray; +export type ServerRequest__ToolRequestUserInputParams = { + readonly autoResolutionMs?: number | null; + readonly itemId: string; + readonly questions: ReadonlyArray; readonly threadId: string; readonly turnId: string; }; -export const ServerNotification__TurnPlanUpdatedNotification = Schema.Struct({ - explanation: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - plan: Schema.Array(ServerNotification__TurnPlanStep), - threadId: Schema.String, - turnId: Schema.String, -}); - -export type ServerRequest__FileSystemPath = - | { readonly path: ServerRequest__LegacyAppPathString; readonly type: "path" } - | { readonly pattern: string; readonly type: "glob_pattern" } - | { readonly type: "special"; readonly value: ServerRequest__FileSystemSpecialPath }; -export const ServerRequest__FileSystemPath = Schema.Union( - [ - Schema.Struct({ - path: ServerRequest__LegacyAppPathString, - type: Schema.Literal("path").annotate({ title: "PathFileSystemPathType" }), - }).annotate({ title: "PathFileSystemPath" }), - Schema.Struct({ - pattern: Schema.String, - type: Schema.Literal("glob_pattern").annotate({ title: "GlobPatternFileSystemPathType" }), - }).annotate({ title: "GlobPatternFileSystemPath" }), - Schema.Struct({ - type: Schema.Literal("special").annotate({ title: "SpecialFileSystemPathType" }), - value: ServerRequest__FileSystemSpecialPath, - }).annotate({ title: "SpecialFileSystemPath" }), - ], - { mode: "oneOf" }, -); - -export type ServerRequest__McpElicitationTitledMultiSelectEnumSchema = { - readonly default?: ReadonlyArray | null; - readonly description?: string | null; - readonly items: ServerRequest__McpElicitationTitledEnumItems; - readonly maxItems?: number | null; - readonly minItems?: number | null; - readonly title?: string | null; - readonly type: ServerRequest__McpElicitationArrayType; -}; -export const ServerRequest__McpElicitationTitledMultiSelectEnumSchema = Schema.Struct({ - default: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - items: ServerRequest__McpElicitationTitledEnumItems, - maxItems: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null, - ]), - ), - minItems: Schema.optionalKey( +export const ServerRequest__ToolRequestUserInputParams = Schema.Struct({ + autoResolutionMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), - title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: ServerRequest__McpElicitationArrayType, + itemId: Schema.String, + questions: Schema.Array(ServerRequest__ToolRequestUserInputQuestion), + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ + description: "EXPERIMENTAL. Params sent with a request_user_input event.", + identifier: "ServerRequest__ToolRequestUserInputParams", }); export type ServerRequest__McpElicitationUntitledMultiSelectEnumSchema = { @@ -20970,22 +23304,30 @@ export const ServerRequest__McpElicitationUntitledMultiSelectEnumSchema = Schema maxItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), minItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), type: ServerRequest__McpElicitationArrayType, -}); +}).annotate({ identifier: "ServerRequest__McpElicitationUntitledMultiSelectEnumSchema" }); export type ServerRequest__McpElicitationSingleSelectEnumSchema = | ServerRequest__McpElicitationUntitledSingleSelectEnumSchema @@ -20993,119 +23335,48 @@ export type ServerRequest__McpElicitationSingleSelectEnumSchema = export const ServerRequest__McpElicitationSingleSelectEnumSchema = Schema.Union([ ServerRequest__McpElicitationUntitledSingleSelectEnumSchema, ServerRequest__McpElicitationTitledSingleSelectEnumSchema, -]); +]).annotate({ identifier: "ServerRequest__McpElicitationSingleSelectEnumSchema" }); -export type ServerRequest__CommandExecutionRequestApprovalParams = { - readonly approvalId?: string | null; - readonly command?: string | null; - readonly commandActions?: ReadonlyArray | null; - readonly cwd?: ServerRequest__LegacyAppPathString | null; - readonly environmentId?: string | null; - readonly itemId: string; - readonly networkApprovalContext?: ServerRequest__NetworkApprovalContext | null; - readonly proposedExecpolicyAmendment?: ReadonlyArray | null; - readonly proposedNetworkPolicyAmendments?: ReadonlyArray | null; - readonly reason?: string | null; - readonly startedAtMs: number; - readonly threadId: string; - readonly turnId: string; +export type ServerRequest__McpElicitationTitledMultiSelectEnumSchema = { + readonly default?: ReadonlyArray | null; + readonly description?: string | null; + readonly items: ServerRequest__McpElicitationTitledEnumItems; + readonly maxItems?: number | null; + readonly minItems?: number | null; + readonly title?: string | null; + readonly type: ServerRequest__McpElicitationArrayType; }; -export const ServerRequest__CommandExecutionRequestApprovalParams = Schema.Struct({ - approvalId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Unique identifier for this specific approval callback.\n\nFor regular shell/unified_exec approvals, this is null.\n\nFor zsh-exec-bridge subcommand approvals, multiple callbacks can belong to one parent `itemId`, so `approvalId` is a distinct opaque callback id (a UUID) used to disambiguate routing.", - }), - Schema.Null, - ]), - ), - command: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "The command to be executed." }), - Schema.Null, - ]), - ), - commandActions: Schema.optionalKey( - Schema.Union([ - Schema.Array(ServerRequest__CommandAction).annotate({ - description: "Best-effort parsed command actions for friendly display.", - }), - Schema.Null, - ]), - ), - cwd: Schema.optionalKey( - Schema.Union([ServerRequest__LegacyAppPathString, Schema.Null]).annotate({ - description: "The command's working directory.", - }), - ), - environmentId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "Environment in which the command will run." }), - Schema.Null, - ]), - ), - itemId: Schema.String, - networkApprovalContext: Schema.optionalKey( - Schema.Union([ServerRequest__NetworkApprovalContext, Schema.Null]).annotate({ - description: "Optional context for a managed-network approval prompt.", - }), - ), - proposedExecpolicyAmendment: Schema.optionalKey( - Schema.Union([ - Schema.Array(Schema.String).annotate({ - description: - "Optional proposed execpolicy amendment to allow similar commands without prompting.", - }), - Schema.Null, - ]), - ), - proposedNetworkPolicyAmendments: Schema.optionalKey( - Schema.Union([ - Schema.Array(ServerRequest__NetworkPolicyAmendment).annotate({ - description: - "Optional proposed network policy amendments (allow/deny host) for future requests.", - }), - Schema.Null, - ]), - ), - reason: Schema.optionalKey( +export const ServerRequest__McpElicitationTitledMultiSelectEnumSchema = Schema.Struct({ + default: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + items: ServerRequest__McpElicitationTitledEnumItems, + maxItems: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ - description: "Optional explanatory reason (e.g. request for network access).", - }), + Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), - startedAtMs: Schema.Number.annotate({ - description: "Unix timestamp (in milliseconds) when this approval request started.", - format: "int64", - }).check(Schema.isInt()), - threadId: Schema.String, - turnId: Schema.String, -}); - -export type ServerRequest__ToolRequestUserInputParams = { - readonly autoResolutionMs?: number | null; - readonly itemId: string; - readonly questions: ReadonlyArray; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerRequest__ToolRequestUserInputParams = Schema.Struct({ - autoResolutionMs: Schema.optionalKey( + minItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), - itemId: Schema.String, - questions: Schema.Array(ServerRequest__ToolRequestUserInputQuestion), - threadId: Schema.String, - turnId: Schema.String, -}).annotate({ description: "EXPERIMENTAL. Params sent with a request_user_input event." }); + title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: ServerRequest__McpElicitationArrayType, +}).annotate({ identifier: "ServerRequest__McpElicitationTitledMultiSelectEnumSchema" }); export type V2AppListUpdatedNotification__AppInfo = { readonly appMetadata?: V2AppListUpdatedNotification__AppMetadata | null; @@ -21156,7 +23427,10 @@ export const V2AppListUpdatedNotification__AppInfo = Schema.Struct({ logoUrlDark: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, pluginDisplayNames: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), -}).annotate({ description: "EXPERIMENTAL - app metadata returned by app-list APIs." }); +}).annotate({ + description: "EXPERIMENTAL - app metadata returned by app-list APIs.", + identifier: "V2AppListUpdatedNotification__AppInfo", +}); export type V2AppsListResponse__AppInfo = { readonly appMetadata?: V2AppsListResponse__AppMetadata | null; @@ -21203,20 +23477,32 @@ export const V2AppsListResponse__AppInfo = Schema.Struct({ logoUrlDark: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, pluginDisplayNames: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), -}).annotate({ description: "EXPERIMENTAL - app metadata returned by app-list APIs." }); +}).annotate({ + description: "EXPERIMENTAL - app metadata returned by app-list APIs.", + identifier: "V2AppsListResponse__AppInfo", +}); + +export type V2ConfigReadResponse__ToolsV2 = { + readonly web_search?: V2ConfigReadResponse__WebSearchToolConfig | null; +}; +export const V2ConfigReadResponse__ToolsV2 = Schema.Struct({ + web_search: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__WebSearchToolConfig, Schema.Null]), + ), +}).annotate({ identifier: "V2ConfigReadResponse__ToolsV2" }); export type V2ConfigReadResponse__ConfigLayer = { - readonly config: unknown; + readonly config: Schema.Json; readonly disabledReason?: string | null; readonly name: V2ConfigReadResponse__ConfigLayerSource; readonly version: string; }; export const V2ConfigReadResponse__ConfigLayer = Schema.Struct({ - config: Schema.Unknown, + config: Schema.Json.annotate({ expected: "JSON value" }), disabledReason: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: V2ConfigReadResponse__ConfigLayerSource, version: Schema.String, -}); +}).annotate({ identifier: "V2ConfigReadResponse__ConfigLayer" }); export type V2ConfigReadResponse__ConfigLayerMetadata = { readonly name: V2ConfigReadResponse__ConfigLayerSource; @@ -21225,16 +23511,7 @@ export type V2ConfigReadResponse__ConfigLayerMetadata = { export const V2ConfigReadResponse__ConfigLayerMetadata = Schema.Struct({ name: V2ConfigReadResponse__ConfigLayerSource, version: Schema.String, -}); - -export type V2ConfigReadResponse__ToolsV2 = { - readonly web_search?: V2ConfigReadResponse__WebSearchToolConfig | null; -}; -export const V2ConfigReadResponse__ToolsV2 = Schema.Struct({ - web_search: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__WebSearchToolConfig, Schema.Null]), - ), -}); +}).annotate({ identifier: "V2ConfigReadResponse__ConfigLayerMetadata" }); export type V2ConfigRequirementsReadResponse__ModelsRequirements = { readonly newThread?: V2ConfigRequirementsReadResponse__NewThreadModelDefaults | null; @@ -21243,7 +23520,7 @@ export const V2ConfigRequirementsReadResponse__ModelsRequirements = Schema.Struc newThread: Schema.optionalKey( Schema.Union([V2ConfigRequirementsReadResponse__NewThreadModelDefaults, Schema.Null]), ), -}); +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ModelsRequirements" }); export type V2ConfigWriteResponse__ConfigLayerMetadata = { readonly name: V2ConfigWriteResponse__ConfigLayerSource; @@ -21252,7 +23529,7 @@ export type V2ConfigWriteResponse__ConfigLayerMetadata = { export const V2ConfigWriteResponse__ConfigLayerMetadata = Schema.Struct({ name: V2ConfigWriteResponse__ConfigLayerSource, version: Schema.String, -}); +}).annotate({ identifier: "V2ConfigWriteResponse__ConfigLayerMetadata" }); export type V2ErrorNotification__TurnError = { readonly additionalDetails?: string | null; @@ -21265,7 +23542,7 @@ export const V2ErrorNotification__TurnError = Schema.Struct({ Schema.Union([V2ErrorNotification__CodexErrorInfo, Schema.Null]), ), message: Schema.String, -}); +}).annotate({ identifier: "V2ErrorNotification__TurnError" }); export type V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItem = { readonly cwd?: string | null; @@ -21288,6 +23565,8 @@ export const V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationIt Schema.Union([V2ExternalAgentConfigDetectResponse__MigrationDetails, Schema.Null]), ), itemType: V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItemType, +}).annotate({ + identifier: "V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItem", }); export type V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigImportTypeResult = @@ -21306,6 +23585,9 @@ export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConf successes: Schema.Array( V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigImportItemTypeSuccess, ), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigImportTypeResult", }); export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportHistory = { @@ -21316,7 +23598,9 @@ export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfi }; export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportHistory = Schema.Struct({ - completedAtMs: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + completedAtMs: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), failures: Schema.Array( V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeFailure, ), @@ -21324,6 +23608,9 @@ export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConf successes: Schema.Array( V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeSuccess, ), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportHistory", }); export type V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItem = { @@ -21347,7 +23634,7 @@ export const V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItem Schema.Union([V2ExternalAgentConfigImportParams__MigrationDetails, Schema.Null]), ), itemType: V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItemType, -}); +}).annotate({ identifier: "V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItem" }); export type V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigImportTypeResult = { readonly failures: ReadonlyArray; @@ -21363,6 +23650,9 @@ export const V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfi successes: Schema.Array( V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigImportItemTypeSuccess, ), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigImportTypeResult", }); export type V2GetAccountRateLimitsResponse__RateLimitResetCreditsSummary = { @@ -21370,7 +23660,9 @@ export type V2GetAccountRateLimitsResponse__RateLimitResetCreditsSummary = { readonly credits?: ReadonlyArray | null; }; export const V2GetAccountRateLimitsResponse__RateLimitResetCreditsSummary = Schema.Struct({ - availableCount: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + availableCount: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), credits: Schema.optionalKey( Schema.Union([ Schema.Array(V2GetAccountRateLimitsResponse__RateLimitResetCredit).annotate({ @@ -21380,7 +23672,7 @@ export const V2GetAccountRateLimitsResponse__RateLimitResetCreditsSummary = Sche Schema.Null, ]), ), -}); +}).annotate({ identifier: "V2GetAccountRateLimitsResponse__RateLimitResetCreditsSummary" }); export type V2HookCompletedNotification__HookRunSummary = { readonly completedAt?: number | null; @@ -21392,18 +23684,7 @@ export type V2HookCompletedNotification__HookRunSummary = { readonly handlerType: V2HookCompletedNotification__HookHandlerType; readonly id: string; readonly scope: V2HookCompletedNotification__HookScope; - readonly source?: - | "system" - | "user" - | "project" - | "mdm" - | "sessionFlags" - | "plugin" - | "cloudRequirements" - | "cloudManagedConfig" - | "legacyManagedConfigFile" - | "legacyManagedConfigMdm" - | "unknown"; + readonly source?: V2HookCompletedNotification__HookSource; readonly sourcePath: V2HookCompletedNotification__AbsolutePathBuf; readonly startedAt: number; readonly status: V2HookCompletedNotification__HookRunStatus; @@ -21411,11 +23692,23 @@ export type V2HookCompletedNotification__HookRunSummary = { }; export const V2HookCompletedNotification__HookRunSummary = Schema.Struct({ completedAt: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + displayOrder: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), ), - displayOrder: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), durationMs: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), entries: Schema.Array(V2HookCompletedNotification__HookOutputEntry), eventName: V2HookCompletedNotification__HookEventName, @@ -21424,25 +23717,18 @@ export const V2HookCompletedNotification__HookRunSummary = Schema.Struct({ id: Schema.String, scope: V2HookCompletedNotification__HookScope, source: Schema.optionalKey( - Schema.Literals([ - "system", - "user", - "project", - "mdm", - "sessionFlags", - "plugin", - "cloudRequirements", - "cloudManagedConfig", - "legacyManagedConfigFile", - "legacyManagedConfigMdm", - "unknown", - ]).annotate({ default: "unknown" }), + Schema.suspend( + (): Schema.Codec => + V2HookCompletedNotification__HookSource, + ).annotate({ default: "unknown" }), ), sourcePath: V2HookCompletedNotification__AbsolutePathBuf, - startedAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + startedAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), status: V2HookCompletedNotification__HookRunStatus, statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2HookCompletedNotification__HookRunSummary" }); export type V2HooksListResponse__HooksListEntry = { readonly cwd: string; @@ -21455,7 +23741,7 @@ export const V2HooksListResponse__HooksListEntry = Schema.Struct({ errors: Schema.Array(V2HooksListResponse__HookErrorInfo), hooks: Schema.Array(V2HooksListResponse__HookMetadata), warnings: Schema.Array(Schema.String), -}); +}).annotate({ identifier: "V2HooksListResponse__HooksListEntry" }); export type V2HookStartedNotification__HookRunSummary = { readonly completedAt?: number | null; @@ -21467,18 +23753,7 @@ export type V2HookStartedNotification__HookRunSummary = { readonly handlerType: V2HookStartedNotification__HookHandlerType; readonly id: string; readonly scope: V2HookStartedNotification__HookScope; - readonly source?: - | "system" - | "user" - | "project" - | "mdm" - | "sessionFlags" - | "plugin" - | "cloudRequirements" - | "cloudManagedConfig" - | "legacyManagedConfigFile" - | "legacyManagedConfigMdm" - | "unknown"; + readonly source?: V2HookStartedNotification__HookSource; readonly sourcePath: V2HookStartedNotification__AbsolutePathBuf; readonly startedAt: number; readonly status: V2HookStartedNotification__HookRunStatus; @@ -21486,11 +23761,23 @@ export type V2HookStartedNotification__HookRunSummary = { }; export const V2HookStartedNotification__HookRunSummary = Schema.Struct({ completedAt: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + displayOrder: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), ), - displayOrder: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), durationMs: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), entries: Schema.Array(V2HookStartedNotification__HookOutputEntry), eventName: V2HookStartedNotification__HookEventName, @@ -21499,1775 +23786,2114 @@ export const V2HookStartedNotification__HookRunSummary = Schema.Struct({ id: Schema.String, scope: V2HookStartedNotification__HookScope, source: Schema.optionalKey( - Schema.Literals([ - "system", - "user", - "project", - "mdm", - "sessionFlags", - "plugin", - "cloudRequirements", - "cloudManagedConfig", - "legacyManagedConfigFile", - "legacyManagedConfigMdm", - "unknown", - ]).annotate({ default: "unknown" }), + Schema.suspend( + (): Schema.Codec => + V2HookStartedNotification__HookSource, + ).annotate({ default: "unknown" }), ), sourcePath: V2HookStartedNotification__AbsolutePathBuf, - startedAt: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + startedAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), status: V2HookStartedNotification__HookRunStatus, statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +}).annotate({ identifier: "V2HookStartedNotification__HookRunSummary" }); -export type V2ItemCompletedNotification__ThreadItem = - | { - readonly clientId?: string | null; - readonly content: ReadonlyArray; - readonly id: string; - readonly type: "userMessage"; - } - | { - readonly fragments: ReadonlyArray; - readonly id: string; - readonly type: "hookPrompt"; - } +export type V2ItemCompletedNotification__UserInput = | { - readonly id: string; - readonly memoryCitation?: V2ItemCompletedNotification__MemoryCitation | null; - readonly phase?: V2ItemCompletedNotification__MessagePhase | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; - readonly type: "agentMessage"; - } - | { readonly id: string; readonly text: string; readonly type: "plan" } - | { - readonly content?: ReadonlyArray; - readonly id: string; - readonly summary?: ReadonlyArray; - readonly type: "reasoning"; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } | { - readonly aggregatedOutput?: string | null; - readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; - readonly durationMs?: number | null; - readonly exitCode?: number | null; - readonly id: string; - readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ItemCompletedNotification__CommandExecutionStatus; - readonly type: "commandExecution"; + readonly detail?: V2ItemCompletedNotification__ImageDetail | null; + readonly type: "image"; + readonly url: string; } | { - readonly changes: ReadonlyArray; - readonly id: string; - readonly status: V2ItemCompletedNotification__PatchApplyStatus; - readonly type: "fileChange"; + readonly detail?: V2ItemCompletedNotification__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ItemCompletedNotification__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ItemCompletedNotification__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), + ), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ItemCompletedNotification__UserInput" }); + +export type V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath = | { - readonly appContext?: V2ItemCompletedNotification__McpToolCallAppContext | null; - readonly arguments: unknown; - readonly durationMs?: number | null; - readonly error?: V2ItemCompletedNotification__McpToolCallError | null; - readonly id: string; - readonly mcpAppResourceUri?: string | null; - readonly pluginId?: string | null; - readonly result?: V2ItemCompletedNotification__McpToolCallResult | null; - readonly server: string; - readonly status: V2ItemCompletedNotification__McpToolCallStatus; - readonly tool: string; - readonly type: "mcpToolCall"; + readonly path: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString; + readonly type: "path"; } + | { readonly pattern: string; readonly type: "glob_pattern" } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; - readonly durationMs?: number | null; - readonly id: string; - readonly namespace?: string | null; - readonly status: V2ItemCompletedNotification__DynamicToolCallStatus; - readonly success?: boolean | null; - readonly tool: string; - readonly type: "dynamicToolCall"; - } + readonly type: "special"; + readonly value: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSpecialPath; + }; +export const V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath = Schema.Union( + [ + Schema.Struct({ + path: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString, + type: Schema.Literal("path").annotate({ title: "PathFileSystemPathType" }), + }).annotate({ title: "PathFileSystemPath" }), + Schema.Struct({ + pattern: Schema.String, + type: Schema.Literal("glob_pattern").annotate({ title: "GlobPatternFileSystemPathType" }), + }).annotate({ title: "GlobPatternFileSystemPath" }), + Schema.Struct({ + type: Schema.Literal("special").annotate({ title: "SpecialFileSystemPathType" }), + value: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSpecialPath, + }).annotate({ title: "SpecialFileSystemPath" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath" }); + +export type V2ItemGuardianApprovalReviewStartedNotification__FileSystemPath = | { - readonly agentsStates: { - readonly [x: string]: V2ItemCompletedNotification__CollabAgentState; - }; - readonly id: string; - readonly model?: string | null; - readonly prompt?: string | null; - readonly reasoningEffort?: V2ItemCompletedNotification__ReasoningEffort | null; - readonly receiverThreadIds: ReadonlyArray; - readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; - readonly type: "collabAgentToolCall"; + readonly path: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString; + readonly type: "path"; } + | { readonly pattern: string; readonly type: "glob_pattern" } | { - readonly agentPath: string; - readonly agentThreadId: string; - readonly id: string; - readonly kind: V2ItemCompletedNotification__SubAgentActivityKind; - readonly type: "subAgentActivity"; - } + readonly type: "special"; + readonly value: V2ItemGuardianApprovalReviewStartedNotification__FileSystemSpecialPath; + }; +export const V2ItemGuardianApprovalReviewStartedNotification__FileSystemPath = Schema.Union( + [ + Schema.Struct({ + path: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString, + type: Schema.Literal("path").annotate({ title: "PathFileSystemPathType" }), + }).annotate({ title: "PathFileSystemPath" }), + Schema.Struct({ + pattern: Schema.String, + type: Schema.Literal("glob_pattern").annotate({ title: "GlobPatternFileSystemPathType" }), + }).annotate({ title: "GlobPatternFileSystemPath" }), + Schema.Struct({ + type: Schema.Literal("special").annotate({ title: "SpecialFileSystemPathType" }), + value: V2ItemGuardianApprovalReviewStartedNotification__FileSystemSpecialPath, + }).annotate({ title: "SpecialFileSystemPath" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ItemGuardianApprovalReviewStartedNotification__FileSystemPath" }); + +export type V2ItemStartedNotification__UserInput = | { - readonly action?: V2ItemCompletedNotification__WebSearchAction | null; - readonly id: string; - readonly query: string; - readonly results?: ReadonlyArray | null; - readonly type: "webSearch"; + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } | { - readonly id: string; - readonly path: V2ItemCompletedNotification__LegacyAppPathString; - readonly type: "imageView"; + readonly detail?: V2ItemStartedNotification__ImageDetail | null; + readonly type: "image"; + readonly url: string; } - | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { - readonly id: string; - readonly result: string; - readonly revisedPrompt?: string | null; - readonly savedPath?: V2ItemCompletedNotification__AbsolutePathBuf | null; - readonly status: string; - readonly type: "imageGeneration"; + readonly detail?: V2ItemStartedNotification__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; } - | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } - | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } - | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ItemCompletedNotification__ThreadItem = Schema.Union( + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ItemStartedNotification__UserInput = Schema.Union( [ Schema.Struct({ - clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ItemCompletedNotification__UserInput), - id: Schema.String, - type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), - }).annotate({ title: "UserMessageThreadItem" }), - Schema.Struct({ - fragments: Schema.Array(V2ItemCompletedNotification__HookPromptFragment), - id: Schema.String, - type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), - }).annotate({ title: "HookPromptThreadItem" }), - Schema.Struct({ - id: Schema.String, - memoryCitation: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__MessagePhase, Schema.Null]), - ), text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), - questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + text_elements: Schema.optionalKey( + Schema.Array(V2ItemStartedNotification__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), ), - type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), - }).annotate({ title: "AgentMessageThreadItem" }), - Schema.Struct({ - id: Schema.String, - text: Schema.String, - type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), - }).annotate({ - title: "PlanThreadItem", - description: - "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", - }), - Schema.Struct({ - content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - id: Schema.String, - summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), - }).annotate({ title: "ReasoningThreadItem" }), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), Schema.Struct({ - aggregatedOutput: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "The command's output, aggregated from stdout and stderr.", - }), - Schema.Null, - ]), - ), - command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ItemCompletedNotification__CommandAction).annotate({ - description: - "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", - }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the command execution in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - exitCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The command's exit code.", - format: "int32", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - id: Schema.String, - processId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Identifier for the underlying PTY process (when available).", - }), - Schema.Null, - ]), + detail: Schema.optionalKey( + Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), ), - source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), ), - status: V2ItemCompletedNotification__CommandExecutionStatus, - type: Schema.Literal("commandExecution").annotate({ - title: "CommandExecutionThreadItemType", - }), - }).annotate({ title: "CommandExecutionThreadItem" }), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), Schema.Struct({ - changes: Schema.Array(V2ItemCompletedNotification__FileUpdateChange), - id: Schema.String, - status: V2ItemCompletedNotification__PatchApplyStatus, - type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), - }).annotate({ title: "FileChangeThreadItem" }), + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), Schema.Struct({ - appContext: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__McpToolCallAppContext, Schema.Null]), - ), - arguments: Schema.Unknown, - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the MCP tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - error: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__McpToolCallError, Schema.Null]), - ), - id: Schema.String, - mcpAppResourceUri: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", - }), - Schema.Null, - ]), - ), - pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - result: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__McpToolCallResult, Schema.Null]), - ), - server: Schema.String, - status: V2ItemCompletedNotification__McpToolCallStatus, - tool: Schema.String, - type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), - }).annotate({ title: "McpToolCallThreadItem" }), + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), Schema.Struct({ - arguments: Schema.Unknown, - contentItems: Schema.optionalKey( - Schema.Union([ - Schema.Array(V2ItemCompletedNotification__DynamicToolCallOutputContentItem), - Schema.Null, - ]), - ), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the dynamic tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - id: Schema.String, - namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ItemCompletedNotification__DynamicToolCallStatus, - success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - tool: Schema.String, - type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), - }).annotate({ title: "DynamicToolCallThreadItem" }), + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), Schema.Struct({ - agentsStates: Schema.Record( - Schema.String, - V2ItemCompletedNotification__CollabAgentState, - ).annotate({ description: "Last known status of the target agents, when available." }), - id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), - model: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Model requested for the spawned agent, when applicable.", - }), - Schema.Null, - ]), - ), - prompt: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Prompt text sent as part of the collab tool call, when available.", - }), - Schema.Null, - ]), - ), - reasoningEffort: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__ReasoningEffort, Schema.Null]).annotate({ - description: "Reasoning effort requested for the spawned agent, when applicable.", - }), - ), - receiverThreadIds: Schema.Array(Schema.String).annotate({ - description: - "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ItemStartedNotification__UserInput" }); + +export type V2ModelListResponse__Model = { + readonly additionalSpeedTiers?: ReadonlyArray; + readonly availabilityNux?: V2ModelListResponse__ModelAvailabilityNux | null; + readonly defaultReasoningEffort: V2ModelListResponse__ReasoningEffort; + readonly defaultServiceTier?: string | null; + readonly description: string; + readonly displayName: string; + readonly hidden: boolean; + readonly id: string; + readonly inputModalities?: ReadonlyArray; + readonly isDefault: boolean; + readonly model: string; + readonly serviceTiers?: ReadonlyArray; + readonly supportedReasoningEfforts: ReadonlyArray; + readonly supportsPersonality?: boolean; + readonly upgrade?: string | null; + readonly upgradeInfo?: V2ModelListResponse__ModelUpgradeInfo | null; +}; +export const V2ModelListResponse__Model = Schema.Struct({ + additionalSpeedTiers: Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + description: "Deprecated: use `serviceTiers` instead.", + default: [], + }), + ), + availabilityNux: Schema.optionalKey( + Schema.Union([V2ModelListResponse__ModelAvailabilityNux, Schema.Null]), + ), + defaultReasoningEffort: V2ModelListResponse__ReasoningEffort, + defaultServiceTier: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Catalog default service tier id for this model, when one is configured.", }), - senderThreadId: Schema.String.annotate({ - description: "Thread ID of the agent issuing the collab request.", + Schema.Null, + ]), + ), + description: Schema.String, + displayName: Schema.String, + hidden: Schema.Boolean, + id: Schema.String, + inputModalities: Schema.optionalKey( + Schema.Array(V2ModelListResponse__InputModality).annotate({ default: ["text", "image"] }), + ), + isDefault: Schema.Boolean, + model: Schema.String, + serviceTiers: Schema.optionalKey( + Schema.Array(V2ModelListResponse__ModelServiceTier).annotate({ default: [] }), + ), + supportedReasoningEfforts: Schema.Array(V2ModelListResponse__ReasoningEffortOption), + supportsPersonality: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + upgrade: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + upgradeInfo: Schema.optionalKey( + Schema.Union([V2ModelListResponse__ModelUpgradeInfo, Schema.Null]), + ), +}).annotate({ identifier: "V2ModelListResponse__Model" }); + +export type V2PluginInstalledResponse__PluginShareContext = { + readonly creatorAccountUserId?: string | null; + readonly creatorName?: string | null; + readonly discoverability?: V2PluginInstalledResponse__PluginShareDiscoverability | null; + readonly remotePluginId: string; + readonly remoteVersion?: string | null; + readonly sharePrincipals?: ReadonlyArray | null; + readonly shareUrl?: string | null; +}; +export const V2PluginInstalledResponse__PluginShareContext = Schema.Struct({ + creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + discoverability: Schema.optionalKey( + Schema.Union([V2PluginInstalledResponse__PluginShareDiscoverability, Schema.Null]), + ), + remotePluginId: Schema.String, + remoteVersion: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version of the remote shared plugin release when available.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), - type: Schema.Literal("collabAgentToolCall").annotate({ - title: "CollabAgentToolCallThreadItemType", + Schema.Null, + ]), + ), + sharePrincipals: Schema.optionalKey( + Schema.Union([Schema.Array(V2PluginInstalledResponse__PluginSharePrincipal), Schema.Null]), + ), + shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2PluginInstalledResponse__PluginShareContext" }); + +export type V2PluginListResponse__PluginShareContext = { + readonly creatorAccountUserId?: string | null; + readonly creatorName?: string | null; + readonly discoverability?: V2PluginListResponse__PluginShareDiscoverability | null; + readonly remotePluginId: string; + readonly remoteVersion?: string | null; + readonly sharePrincipals?: ReadonlyArray | null; + readonly shareUrl?: string | null; +}; +export const V2PluginListResponse__PluginShareContext = Schema.Struct({ + creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + discoverability: Schema.optionalKey( + Schema.Union([V2PluginListResponse__PluginShareDiscoverability, Schema.Null]), + ), + remotePluginId: Schema.String, + remoteVersion: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version of the remote shared plugin release when available.", }), - }).annotate({ title: "CollabAgentToolCallThreadItem" }), - Schema.Struct({ - agentPath: Schema.String, - agentThreadId: Schema.String, - id: Schema.String, - kind: V2ItemCompletedNotification__SubAgentActivityKind, - type: Schema.Literal("subAgentActivity").annotate({ - title: "SubAgentActivityThreadItemType", + Schema.Null, + ]), + ), + sharePrincipals: Schema.optionalKey( + Schema.Union([Schema.Array(V2PluginListResponse__PluginSharePrincipal), Schema.Null]), + ), + shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2PluginListResponse__PluginShareContext" }); + +export type V2PluginReadResponse__SkillSummary = { + readonly description: string; + readonly enabled: boolean; + readonly interface?: V2PluginReadResponse__SkillInterface | null; + readonly name: string; + readonly path?: V2PluginReadResponse__AbsolutePathBuf | null; + readonly shortDescription?: string | null; +}; +export const V2PluginReadResponse__SkillSummary = Schema.Struct({ + description: Schema.String, + enabled: Schema.Boolean, + interface: Schema.optionalKey(Schema.Union([V2PluginReadResponse__SkillInterface, Schema.Null])), + name: Schema.String, + path: Schema.optionalKey(Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null])), + shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2PluginReadResponse__SkillSummary" }); + +export type V2PluginReadResponse__ScheduledTaskSummary = { + readonly key: string; + readonly name: string; + readonly prompt: string; + readonly schedule: V2PluginReadResponse__ScheduledTaskSchedule; +}; +export const V2PluginReadResponse__ScheduledTaskSummary = Schema.Struct({ + key: Schema.String, + name: Schema.String, + prompt: Schema.String, + schedule: V2PluginReadResponse__ScheduledTaskSchedule, +}).annotate({ identifier: "V2PluginReadResponse__ScheduledTaskSummary" }); + +export type V2PluginReadResponse__PluginShareContext = { + readonly creatorAccountUserId?: string | null; + readonly creatorName?: string | null; + readonly discoverability?: V2PluginReadResponse__PluginShareDiscoverability | null; + readonly remotePluginId: string; + readonly remoteVersion?: string | null; + readonly sharePrincipals?: ReadonlyArray | null; + readonly shareUrl?: string | null; +}; +export const V2PluginReadResponse__PluginShareContext = Schema.Struct({ + creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + discoverability: Schema.optionalKey( + Schema.Union([V2PluginReadResponse__PluginShareDiscoverability, Schema.Null]), + ), + remotePluginId: Schema.String, + remoteVersion: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version of the remote shared plugin release when available.", }), - }).annotate({ title: "SubAgentActivityThreadItem" }), + Schema.Null, + ]), + ), + sharePrincipals: Schema.optionalKey( + Schema.Union([Schema.Array(V2PluginReadResponse__PluginSharePrincipal), Schema.Null]), + ), + shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2PluginReadResponse__PluginShareContext" }); + +export type V2PluginShareListResponse__PluginShareContext = { + readonly creatorAccountUserId?: string | null; + readonly creatorName?: string | null; + readonly discoverability?: V2PluginShareListResponse__PluginShareDiscoverability | null; + readonly remotePluginId: string; + readonly remoteVersion?: string | null; + readonly sharePrincipals?: ReadonlyArray | null; + readonly shareUrl?: string | null; +}; +export const V2PluginShareListResponse__PluginShareContext = Schema.Struct({ + creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + discoverability: Schema.optionalKey( + Schema.Union([V2PluginShareListResponse__PluginShareDiscoverability, Schema.Null]), + ), + remotePluginId: Schema.String, + remoteVersion: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version of the remote shared plugin release when available.", + }), + Schema.Null, + ]), + ), + sharePrincipals: Schema.optionalKey( + Schema.Union([Schema.Array(V2PluginShareListResponse__PluginSharePrincipal), Schema.Null]), + ), + shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2PluginShareListResponse__PluginShareContext" }); + +export type V2RawResponseItemCompletedNotification__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2RawResponseItemCompletedNotification__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2RawResponseItemCompletedNotification__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2RawResponseItemCompletedNotification__FunctionCallOutputBody" }); + +export type V2ReviewStartResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ReviewStartResponse__CodexErrorInfo | null; + readonly message: string; +}; +export const V2ReviewStartResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2ReviewStartResponse__TurnError" }); + +export type V2ReviewStartResponse__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2ReviewStartResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2ReviewStartResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ReviewStartResponse__UserInput = Schema.Union( + [ Schema.Struct({ - action: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__WebSearchAction, Schema.Null]), - ), - id: Schema.String, - query: Schema.String, - results: Schema.optionalKey( - Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ - description: - "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", - }), - Schema.Null, - ]), + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ReviewStartResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), ), - type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), - }).annotate({ title: "WebSearchThreadItem" }), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), Schema.Struct({ - id: Schema.String, - path: V2ItemCompletedNotification__LegacyAppPathString, - type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), - }).annotate({ title: "ImageViewThreadItem" }), + detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), Schema.Struct({ - durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - id: Schema.String, - type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), - }).annotate({ - title: "SleepThreadItem", - description: "Display item emitted by the interruptible `clock.sleep` tool.", - }), + detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), Schema.Struct({ - id: Schema.String, - result: Schema.String, - revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - savedPath: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__AbsolutePathBuf, Schema.Null]), - ), - status: Schema.String, - type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), - }).annotate({ title: "ImageGenerationThreadItem" }), + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("enteredReviewMode").annotate({ - title: "EnteredReviewModeThreadItemType", - }), - }).annotate({ title: "EnteredReviewModeThreadItem" }), + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("exitedReviewMode").annotate({ - title: "ExitedReviewModeThreadItemType", - }), - }).annotate({ title: "ExitedReviewModeThreadItem" }), + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), Schema.Struct({ - id: Schema.String, - type: Schema.Literal("contextCompaction").annotate({ - title: "ContextCompactionThreadItemType", + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ReviewStartResponse__UserInput" }); + +export type V2SkillsListResponse__SkillMetadata = { + readonly dependencies?: V2SkillsListResponse__SkillDependencies | null; + readonly description: string; + readonly enabled: boolean; + readonly interface?: V2SkillsListResponse__SkillInterface | null; + readonly name: string; + readonly path: V2SkillsListResponse__AbsolutePathBuf; + readonly scope: V2SkillsListResponse__SkillScope; + readonly shortDescription?: string | null; +}; +export const V2SkillsListResponse__SkillMetadata = Schema.Struct({ + dependencies: Schema.optionalKey( + Schema.Union([V2SkillsListResponse__SkillDependencies, Schema.Null]), + ), + description: Schema.String, + enabled: Schema.Boolean, + interface: Schema.optionalKey(Schema.Union([V2SkillsListResponse__SkillInterface, Schema.Null])), + name: Schema.String, + path: V2SkillsListResponse__AbsolutePathBuf, + scope: V2SkillsListResponse__SkillScope, + shortDescription: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Legacy short_description from SKILL.md. Prefer SKILL.json interface.short_description.", }), - }).annotate({ title: "ContextCompactionThreadItem" }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2SkillsListResponse__SkillMetadata" }); + +export type V2ThreadForkResponse__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: V2ThreadForkResponse__SubAgentSource }; +export const V2ThreadForkResponse__SessionSource = Schema.Union( + [ + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: V2ThreadForkResponse__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", + }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadForkResponse__SessionSource" }); -export type V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath = +export type V2ThreadForkResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ThreadForkResponse__CodexErrorInfo | null; + readonly message: string; +}; +export const V2ThreadForkResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2ThreadForkResponse__TurnError" }); + +export type V2ThreadForkResponse__UserInput = | { - readonly path: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString; - readonly type: "path"; + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } - | { readonly pattern: string; readonly type: "glob_pattern" } | { - readonly type: "special"; - readonly value: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSpecialPath; - }; -export const V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath = Schema.Union( + readonly detail?: V2ThreadForkResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2ThreadForkResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadForkResponse__UserInput = Schema.Union( [ Schema.Struct({ - path: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString, - type: Schema.Literal("path").annotate({ title: "PathFileSystemPathType" }), - }).annotate({ title: "PathFileSystemPath" }), + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadForkResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), Schema.Struct({ - pattern: Schema.String, - type: Schema.Literal("glob_pattern").annotate({ title: "GlobPatternFileSystemPathType" }), - }).annotate({ title: "GlobPatternFileSystemPath" }), + detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), Schema.Struct({ - type: Schema.Literal("special").annotate({ title: "SpecialFileSystemPathType" }), - value: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSpecialPath, - }).annotate({ title: "SpecialFileSystemPath" }), + detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadForkResponse__UserInput" }); -export type V2ItemGuardianApprovalReviewStartedNotification__FileSystemPath = - | { - readonly path: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString; - readonly type: "path"; - } - | { readonly pattern: string; readonly type: "glob_pattern" } - | { - readonly type: "special"; - readonly value: V2ItemGuardianApprovalReviewStartedNotification__FileSystemSpecialPath; - }; -export const V2ItemGuardianApprovalReviewStartedNotification__FileSystemPath = Schema.Union( +export type V2ThreadListResponse__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: V2ThreadListResponse__SubAgentSource }; +export const V2ThreadListResponse__SessionSource = Schema.Union( [ - Schema.Struct({ - path: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString, - type: Schema.Literal("path").annotate({ title: "PathFileSystemPathType" }), - }).annotate({ title: "PathFileSystemPath" }), - Schema.Struct({ - pattern: Schema.String, - type: Schema.Literal("glob_pattern").annotate({ title: "GlobPatternFileSystemPathType" }), - }).annotate({ title: "GlobPatternFileSystemPath" }), - Schema.Struct({ - type: Schema.Literal("special").annotate({ title: "SpecialFileSystemPathType" }), - value: V2ItemGuardianApprovalReviewStartedNotification__FileSystemSpecialPath, - }).annotate({ title: "SpecialFileSystemPath" }), + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: V2ThreadListResponse__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", + }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadListResponse__SessionSource" }); -export type V2ItemStartedNotification__ThreadItem = - | { - readonly clientId?: string | null; - readonly content: ReadonlyArray; - readonly id: string; - readonly type: "userMessage"; - } - | { - readonly fragments: ReadonlyArray; - readonly id: string; - readonly type: "hookPrompt"; - } +export type V2ThreadListResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ThreadListResponse__CodexErrorInfo | null; + readonly message: string; +}; +export const V2ThreadListResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2ThreadListResponse__TurnError" }); + +export type V2ThreadListResponse__UserInput = | { - readonly id: string; - readonly memoryCitation?: V2ItemStartedNotification__MemoryCitation | null; - readonly phase?: V2ItemStartedNotification__MessagePhase | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; - readonly type: "agentMessage"; - } - | { readonly id: string; readonly text: string; readonly type: "plan" } - | { - readonly content?: ReadonlyArray; - readonly id: string; - readonly summary?: ReadonlyArray; - readonly type: "reasoning"; - } - | { - readonly aggregatedOutput?: string | null; - readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; - readonly durationMs?: number | null; - readonly exitCode?: number | null; - readonly id: string; - readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ItemStartedNotification__CommandExecutionStatus; - readonly type: "commandExecution"; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } | { - readonly changes: ReadonlyArray; - readonly id: string; - readonly status: V2ItemStartedNotification__PatchApplyStatus; - readonly type: "fileChange"; + readonly detail?: V2ThreadListResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; } | { - readonly appContext?: V2ItemStartedNotification__McpToolCallAppContext | null; - readonly arguments: unknown; - readonly durationMs?: number | null; - readonly error?: V2ItemStartedNotification__McpToolCallError | null; - readonly id: string; - readonly mcpAppResourceUri?: string | null; - readonly pluginId?: string | null; - readonly result?: V2ItemStartedNotification__McpToolCallResult | null; - readonly server: string; - readonly status: V2ItemStartedNotification__McpToolCallStatus; - readonly tool: string; - readonly type: "mcpToolCall"; + readonly detail?: V2ThreadListResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadListResponse__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadListResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadListResponse__UserInput" }); + +export type V2ThreadMetadataUpdateResponse__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: V2ThreadMetadataUpdateResponse__SubAgentSource }; +export const V2ThreadMetadataUpdateResponse__SessionSource = Schema.Union( + [ + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: V2ThreadMetadataUpdateResponse__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__SessionSource" }); + +export type V2ThreadMetadataUpdateResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ThreadMetadataUpdateResponse__CodexErrorInfo | null; + readonly message: string; +}; +export const V2ThreadMetadataUpdateResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__TurnError" }); + +export type V2ThreadMetadataUpdateResponse__UserInput = | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; - readonly durationMs?: number | null; - readonly id: string; - readonly namespace?: string | null; - readonly status: V2ItemStartedNotification__DynamicToolCallStatus; - readonly success?: boolean | null; - readonly tool: string; - readonly type: "dynamicToolCall"; + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } | { - readonly agentsStates: { readonly [x: string]: V2ItemStartedNotification__CollabAgentState }; - readonly id: string; - readonly model?: string | null; - readonly prompt?: string | null; - readonly reasoningEffort?: V2ItemStartedNotification__ReasoningEffort | null; - readonly receiverThreadIds: ReadonlyArray; - readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; - readonly type: "collabAgentToolCall"; + readonly detail?: V2ThreadMetadataUpdateResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; } | { - readonly agentPath: string; - readonly agentThreadId: string; - readonly id: string; - readonly kind: V2ItemStartedNotification__SubAgentActivityKind; - readonly type: "subAgentActivity"; + readonly detail?: V2ThreadMetadataUpdateResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadMetadataUpdateResponse__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadMetadataUpdateResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), + ), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__UserInput" }); + +export type V2ThreadReadResponse__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: V2ThreadReadResponse__SubAgentSource }; +export const V2ThreadReadResponse__SessionSource = Schema.Union( + [ + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: V2ThreadReadResponse__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadReadResponse__SessionSource" }); + +export type V2ThreadReadResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ThreadReadResponse__CodexErrorInfo | null; + readonly message: string; +}; +export const V2ThreadReadResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2ThreadReadResponse__TurnError" }); + +export type V2ThreadReadResponse__UserInput = | { - readonly action?: V2ItemStartedNotification__WebSearchAction | null; - readonly id: string; - readonly query: string; - readonly results?: ReadonlyArray | null; - readonly type: "webSearch"; + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } | { - readonly id: string; - readonly path: V2ItemStartedNotification__LegacyAppPathString; - readonly type: "imageView"; + readonly detail?: V2ThreadReadResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; } - | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { - readonly id: string; - readonly result: string; - readonly revisedPrompt?: string | null; - readonly savedPath?: V2ItemStartedNotification__AbsolutePathBuf | null; - readonly status: string; - readonly type: "imageGeneration"; + readonly detail?: V2ThreadReadResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; } - | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } - | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } - | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ItemStartedNotification__ThreadItem = Schema.Union( + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadReadResponse__UserInput = Schema.Union( [ Schema.Struct({ - clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ItemStartedNotification__UserInput), - id: Schema.String, - type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), - }).annotate({ title: "UserMessageThreadItem" }), - Schema.Struct({ - fragments: Schema.Array(V2ItemStartedNotification__HookPromptFragment), - id: Schema.String, - type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), - }).annotate({ title: "HookPromptThreadItem" }), - Schema.Struct({ - id: Schema.String, - memoryCitation: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__MessagePhase, Schema.Null]), - ), text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), - questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadReadResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), ), - type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), - }).annotate({ title: "AgentMessageThreadItem" }), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), Schema.Struct({ - id: Schema.String, - text: Schema.String, - type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), - }).annotate({ - title: "PlanThreadItem", - description: - "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", - }), + detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), Schema.Struct({ - content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - id: Schema.String, - summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), - }).annotate({ title: "ReasoningThreadItem" }), + detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), Schema.Struct({ - aggregatedOutput: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "The command's output, aggregated from stdout and stderr.", - }), - Schema.Null, - ]), - ), - command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ItemStartedNotification__CommandAction).annotate({ - description: - "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", - }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the command execution in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - exitCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The command's exit code.", - format: "int32", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - id: Schema.String, - processId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Identifier for the underlying PTY process (when available).", - }), - Schema.Null, - ]), - ), - source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), - ), - status: V2ItemStartedNotification__CommandExecutionStatus, - type: Schema.Literal("commandExecution").annotate({ - title: "CommandExecutionThreadItemType", - }), - }).annotate({ title: "CommandExecutionThreadItem" }), + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), Schema.Struct({ - changes: Schema.Array(V2ItemStartedNotification__FileUpdateChange), - id: Schema.String, - status: V2ItemStartedNotification__PatchApplyStatus, - type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), - }).annotate({ title: "FileChangeThreadItem" }), + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), Schema.Struct({ - appContext: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__McpToolCallAppContext, Schema.Null]), - ), - arguments: Schema.Unknown, - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the MCP tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - error: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__McpToolCallError, Schema.Null]), - ), - id: Schema.String, - mcpAppResourceUri: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", - }), - Schema.Null, - ]), - ), - pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - result: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__McpToolCallResult, Schema.Null]), - ), - server: Schema.String, - status: V2ItemStartedNotification__McpToolCallStatus, - tool: Schema.String, - type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), - }).annotate({ title: "McpToolCallThreadItem" }), + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), Schema.Struct({ - arguments: Schema.Unknown, - contentItems: Schema.optionalKey( - Schema.Union([ - Schema.Array(V2ItemStartedNotification__DynamicToolCallOutputContentItem), - Schema.Null, - ]), - ), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the dynamic tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - id: Schema.String, - namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ItemStartedNotification__DynamicToolCallStatus, - success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - tool: Schema.String, - type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), - }).annotate({ title: "DynamicToolCallThreadItem" }), + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadReadResponse__UserInput" }); + +export type V2ThreadResumeParams__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadResumeParams__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadResumeParams__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadResumeParams__FunctionCallOutputBody" }); + +export type V2ThreadResumeResponse__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: V2ThreadResumeResponse__SubAgentSource }; +export const V2ThreadResumeResponse__SessionSource = Schema.Union( + [ + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: V2ThreadResumeResponse__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeResponse__SessionSource" }); + +export type V2ThreadResumeResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ThreadResumeResponse__CodexErrorInfo | null; + readonly message: string; +}; +export const V2ThreadResumeResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2ThreadResumeResponse__TurnError" }); + +export type V2ThreadResumeResponse__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2ThreadResumeResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2ThreadResumeResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadResumeResponse__UserInput = Schema.Union( + [ Schema.Struct({ - agentsStates: Schema.Record( - Schema.String, - V2ItemStartedNotification__CollabAgentState, - ).annotate({ description: "Last known status of the target agents, when available." }), - id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), - model: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Model requested for the spawned agent, when applicable.", - }), - Schema.Null, - ]), - ), - prompt: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Prompt text sent as part of the collab tool call, when available.", - }), - Schema.Null, - ]), - ), - reasoningEffort: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__ReasoningEffort, Schema.Null]).annotate({ - description: "Reasoning effort requested for the spawned agent, when applicable.", + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadResumeResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], }), ), - receiverThreadIds: Schema.Array(Schema.String).annotate({ - description: - "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", - }), - senderThreadId: Schema.String.annotate({ - description: "Thread ID of the agent issuing the collab request.", - }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), - type: Schema.Literal("collabAgentToolCall").annotate({ - title: "CollabAgentToolCallThreadItemType", - }), - }).annotate({ title: "CollabAgentToolCallThreadItem" }), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), Schema.Struct({ - agentPath: Schema.String, - agentThreadId: Schema.String, - id: Schema.String, - kind: V2ItemStartedNotification__SubAgentActivityKind, - type: Schema.Literal("subAgentActivity").annotate({ - title: "SubAgentActivityThreadItemType", - }), - }).annotate({ title: "SubAgentActivityThreadItem" }), + detail: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), Schema.Struct({ - action: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__WebSearchAction, Schema.Null]), - ), - id: Schema.String, - query: Schema.String, - results: Schema.optionalKey( - Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ - description: - "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", - }), - Schema.Null, - ]), - ), - type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), - }).annotate({ title: "WebSearchThreadItem" }), + detail: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), Schema.Struct({ - id: Schema.String, - path: V2ItemStartedNotification__LegacyAppPathString, - type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), - }).annotate({ title: "ImageViewThreadItem" }), + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), Schema.Struct({ - durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - id: Schema.String, - type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), - }).annotate({ - title: "SleepThreadItem", - description: "Display item emitted by the interruptible `clock.sleep` tool.", + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeResponse__UserInput" }); + +export type V2ThreadRollbackResponse__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: V2ThreadRollbackResponse__SubAgentSource }; +export const V2ThreadRollbackResponse__SessionSource = Schema.Union( + [ + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: V2ThreadRollbackResponse__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadRollbackResponse__SessionSource" }); + +export type V2ThreadRollbackResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ThreadRollbackResponse__CodexErrorInfo | null; + readonly message: string; +}; +export const V2ThreadRollbackResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ThreadRollbackResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2ThreadRollbackResponse__TurnError" }); + +export type V2ThreadRollbackResponse__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2ThreadRollbackResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2ThreadRollbackResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadRollbackResponse__UserInput = Schema.Union( + [ Schema.Struct({ - id: Schema.String, - result: Schema.String, - revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - savedPath: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__AbsolutePathBuf, Schema.Null]), + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadRollbackResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), ), - status: Schema.String, - type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), - }).annotate({ title: "ImageGenerationThreadItem" }), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("enteredReviewMode").annotate({ - title: "EnteredReviewModeThreadItemType", - }), - }).annotate({ title: "EnteredReviewModeThreadItem" }), + detail: Schema.optionalKey( + Schema.Union([V2ThreadRollbackResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("exitedReviewMode").annotate({ - title: "ExitedReviewModeThreadItemType", - }), - }).annotate({ title: "ExitedReviewModeThreadItem" }), + detail: Schema.optionalKey( + Schema.Union([V2ThreadRollbackResponse__ImageDetail, Schema.Null]), + ), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), Schema.Struct({ - id: Schema.String, - type: Schema.Literal("contextCompaction").annotate({ - title: "ContextCompactionThreadItemType", - }), - }).annotate({ title: "ContextCompactionThreadItem" }), + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadRollbackResponse__UserInput" }); -export type V2ModelListResponse__Model = { - readonly additionalSpeedTiers?: ReadonlyArray; - readonly availabilityNux?: V2ModelListResponse__ModelAvailabilityNux | null; - readonly defaultReasoningEffort: V2ModelListResponse__ReasoningEffort; - readonly defaultServiceTier?: string | null; - readonly description: string; - readonly displayName: string; - readonly hidden: boolean; - readonly id: string; - readonly inputModalities?: ReadonlyArray; - readonly isDefault: boolean; - readonly model: string; - readonly serviceTiers?: ReadonlyArray; - readonly supportedReasoningEfforts: ReadonlyArray; - readonly supportsPersonality?: boolean; - readonly upgrade?: string | null; - readonly upgradeInfo?: V2ModelListResponse__ModelUpgradeInfo | null; +export type V2ThreadSettingsUpdatedNotification__CollaborationMode = { + readonly mode: V2ThreadSettingsUpdatedNotification__ModeKind; + readonly settings: V2ThreadSettingsUpdatedNotification__Settings; }; -export const V2ModelListResponse__Model = Schema.Struct({ - additionalSpeedTiers: Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - description: "Deprecated: use `serviceTiers` instead.", - default: [], - }), - ), - availabilityNux: Schema.optionalKey( - Schema.Union([V2ModelListResponse__ModelAvailabilityNux, Schema.Null]), - ), - defaultReasoningEffort: V2ModelListResponse__ReasoningEffort, - defaultServiceTier: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Catalog default service tier id for this model, when one is configured.", - }), - Schema.Null, - ]), - ), - description: Schema.String, - displayName: Schema.String, - hidden: Schema.Boolean, - id: Schema.String, - inputModalities: Schema.optionalKey( - Schema.Array(V2ModelListResponse__InputModality).annotate({ default: ["text", "image"] }), - ), - isDefault: Schema.Boolean, - model: Schema.String, - serviceTiers: Schema.optionalKey( - Schema.Array(V2ModelListResponse__ModelServiceTier).annotate({ default: [] }), - ), - supportedReasoningEfforts: Schema.Array(V2ModelListResponse__ReasoningEffortOption), - supportsPersonality: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - upgrade: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - upgradeInfo: Schema.optionalKey( - Schema.Union([V2ModelListResponse__ModelUpgradeInfo, Schema.Null]), - ), +export const V2ThreadSettingsUpdatedNotification__CollaborationMode = Schema.Struct({ + mode: V2ThreadSettingsUpdatedNotification__ModeKind, + settings: V2ThreadSettingsUpdatedNotification__Settings, +}).annotate({ + description: "Collaboration mode for a Codex session.", + identifier: "V2ThreadSettingsUpdatedNotification__CollaborationMode", }); -export type V2PluginInstalledResponse__PluginShareContext = { - readonly creatorAccountUserId?: string | null; - readonly creatorName?: string | null; - readonly discoverability?: V2PluginInstalledResponse__PluginShareDiscoverability | null; - readonly remotePluginId: string; - readonly remoteVersion?: string | null; - readonly sharePrincipals?: ReadonlyArray | null; - readonly shareUrl?: string | null; +export type V2ThreadStartedNotification__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: V2ThreadStartedNotification__SubAgentSource }; +export const V2ThreadStartedNotification__SessionSource = Schema.Union( + [ + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: V2ThreadStartedNotification__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartedNotification__SessionSource" }); + +export type V2ThreadStartedNotification__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ThreadStartedNotification__CodexErrorInfo | null; + readonly message: string; }; -export const V2PluginInstalledResponse__PluginShareContext = Schema.Struct({ - creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - discoverability: Schema.optionalKey( - Schema.Union([V2PluginInstalledResponse__PluginShareDiscoverability, Schema.Null]), - ), - remotePluginId: Schema.String, - remoteVersion: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version of the remote shared plugin release when available.", - }), - Schema.Null, - ]), - ), - sharePrincipals: Schema.optionalKey( - Schema.Union([Schema.Array(V2PluginInstalledResponse__PluginSharePrincipal), Schema.Null]), - ), - shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2PluginListResponse__PluginShareContext = { - readonly creatorAccountUserId?: string | null; - readonly creatorName?: string | null; - readonly discoverability?: V2PluginListResponse__PluginShareDiscoverability | null; - readonly remotePluginId: string; - readonly remoteVersion?: string | null; - readonly sharePrincipals?: ReadonlyArray | null; - readonly shareUrl?: string | null; -}; -export const V2PluginListResponse__PluginShareContext = Schema.Struct({ - creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - discoverability: Schema.optionalKey( - Schema.Union([V2PluginListResponse__PluginShareDiscoverability, Schema.Null]), - ), - remotePluginId: Schema.String, - remoteVersion: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version of the remote shared plugin release when available.", - }), - Schema.Null, - ]), - ), - sharePrincipals: Schema.optionalKey( - Schema.Union([Schema.Array(V2PluginListResponse__PluginSharePrincipal), Schema.Null]), - ), - shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2PluginReadResponse__SkillSummary = { - readonly description: string; - readonly enabled: boolean; - readonly interface?: V2PluginReadResponse__SkillInterface | null; - readonly name: string; - readonly path?: V2PluginReadResponse__AbsolutePathBuf | null; - readonly shortDescription?: string | null; -}; -export const V2PluginReadResponse__SkillSummary = Schema.Struct({ - description: Schema.String, - enabled: Schema.Boolean, - interface: Schema.optionalKey(Schema.Union([V2PluginReadResponse__SkillInterface, Schema.Null])), - name: Schema.String, - path: Schema.optionalKey(Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null])), - shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2PluginReadResponse__PluginShareContext = { - readonly creatorAccountUserId?: string | null; - readonly creatorName?: string | null; - readonly discoverability?: V2PluginReadResponse__PluginShareDiscoverability | null; - readonly remotePluginId: string; - readonly remoteVersion?: string | null; - readonly sharePrincipals?: ReadonlyArray | null; - readonly shareUrl?: string | null; -}; -export const V2PluginReadResponse__PluginShareContext = Schema.Struct({ - creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - discoverability: Schema.optionalKey( - Schema.Union([V2PluginReadResponse__PluginShareDiscoverability, Schema.Null]), - ), - remotePluginId: Schema.String, - remoteVersion: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version of the remote shared plugin release when available.", - }), - Schema.Null, - ]), - ), - sharePrincipals: Schema.optionalKey( - Schema.Union([Schema.Array(V2PluginReadResponse__PluginSharePrincipal), Schema.Null]), +export const V2ThreadStartedNotification__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__CodexErrorInfo, Schema.Null]), ), - shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type V2PluginReadResponse__ScheduledTaskSummary = { - readonly key: string; - readonly name: string; - readonly prompt: string; - readonly schedule: V2PluginReadResponse__ScheduledTaskSchedule; -}; -export const V2PluginReadResponse__ScheduledTaskSummary = Schema.Struct({ - key: Schema.String, - name: Schema.String, - prompt: Schema.String, - schedule: V2PluginReadResponse__ScheduledTaskSchedule, -}); + message: Schema.String, +}).annotate({ identifier: "V2ThreadStartedNotification__TurnError" }); -export type V2PluginShareListResponse__PluginShareContext = { - readonly creatorAccountUserId?: string | null; - readonly creatorName?: string | null; - readonly discoverability?: V2PluginShareListResponse__PluginShareDiscoverability | null; - readonly remotePluginId: string; - readonly remoteVersion?: string | null; - readonly sharePrincipals?: ReadonlyArray | null; - readonly shareUrl?: string | null; -}; -export const V2PluginShareListResponse__PluginShareContext = Schema.Struct({ - creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - discoverability: Schema.optionalKey( - Schema.Union([V2PluginShareListResponse__PluginShareDiscoverability, Schema.Null]), - ), - remotePluginId: Schema.String, - remoteVersion: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version of the remote shared plugin release when available.", - }), - Schema.Null, - ]), - ), - sharePrincipals: Schema.optionalKey( - Schema.Union([Schema.Array(V2PluginShareListResponse__PluginSharePrincipal), Schema.Null]), - ), - shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); +export type V2ThreadStartedNotification__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2ThreadStartedNotification__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2ThreadStartedNotification__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadStartedNotification__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadStartedNotification__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), + ), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartedNotification__UserInput" }); -export type V2RawResponseItemCompletedNotification__FunctionCallOutputBody = - | string - | ReadonlyArray; -export const V2RawResponseItemCompletedNotification__FunctionCallOutputBody = Schema.Union([ - Schema.String, - Schema.Array(V2RawResponseItemCompletedNotification__FunctionCallOutputContentItem), -]); +export type V2ThreadStartResponse__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: V2ThreadStartResponse__SubAgentSource }; +export const V2ThreadStartResponse__SessionSource = Schema.Union( + [ + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: V2ThreadStartResponse__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartResponse__SessionSource" }); -export type V2ReviewStartResponse__TurnError = { +export type V2ThreadStartResponse__TurnError = { readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ReviewStartResponse__CodexErrorInfo | null; + readonly codexErrorInfo?: V2ThreadStartResponse__CodexErrorInfo | null; readonly message: string; }; -export const V2ReviewStartResponse__TurnError = Schema.Struct({ +export const V2ThreadStartResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__CodexErrorInfo, Schema.Null]), + Schema.Union([V2ThreadStartResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, -}); +}).annotate({ identifier: "V2ThreadStartResponse__TurnError" }); -export type V2ReviewStartResponse__ThreadItem = - | { - readonly clientId?: string | null; - readonly content: ReadonlyArray; - readonly id: string; - readonly type: "userMessage"; - } - | { - readonly fragments: ReadonlyArray; - readonly id: string; - readonly type: "hookPrompt"; - } +export type V2ThreadStartResponse__UserInput = | { - readonly id: string; - readonly memoryCitation?: V2ReviewStartResponse__MemoryCitation | null; - readonly phase?: V2ReviewStartResponse__MessagePhase | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; - readonly type: "agentMessage"; - } - | { readonly id: string; readonly text: string; readonly type: "plan" } - | { - readonly content?: ReadonlyArray; - readonly id: string; - readonly summary?: ReadonlyArray; - readonly type: "reasoning"; - } - | { - readonly aggregatedOutput?: string | null; - readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; - readonly durationMs?: number | null; - readonly exitCode?: number | null; - readonly id: string; - readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ReviewStartResponse__CommandExecutionStatus; - readonly type: "commandExecution"; - } - | { - readonly changes: ReadonlyArray; - readonly id: string; - readonly status: V2ReviewStartResponse__PatchApplyStatus; - readonly type: "fileChange"; - } - | { - readonly appContext?: V2ReviewStartResponse__McpToolCallAppContext | null; - readonly arguments: unknown; - readonly durationMs?: number | null; - readonly error?: V2ReviewStartResponse__McpToolCallError | null; - readonly id: string; - readonly mcpAppResourceUri?: string | null; - readonly pluginId?: string | null; - readonly result?: V2ReviewStartResponse__McpToolCallResult | null; - readonly server: string; - readonly status: V2ReviewStartResponse__McpToolCallStatus; - readonly tool: string; - readonly type: "mcpToolCall"; - } - | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; - readonly durationMs?: number | null; - readonly id: string; - readonly namespace?: string | null; - readonly status: V2ReviewStartResponse__DynamicToolCallStatus; - readonly success?: boolean | null; - readonly tool: string; - readonly type: "dynamicToolCall"; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } | { - readonly agentsStates: { readonly [x: string]: V2ReviewStartResponse__CollabAgentState }; - readonly id: string; - readonly model?: string | null; - readonly prompt?: string | null; - readonly reasoningEffort?: V2ReviewStartResponse__ReasoningEffort | null; - readonly receiverThreadIds: ReadonlyArray; - readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; - readonly type: "collabAgentToolCall"; + readonly detail?: V2ThreadStartResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; } | { - readonly agentPath: string; - readonly agentThreadId: string; - readonly id: string; - readonly kind: V2ReviewStartResponse__SubAgentActivityKind; - readonly type: "subAgentActivity"; + readonly detail?: V2ThreadStartResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadStartResponse__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadStartResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartResponse__UserInput" }); + +export type V2ThreadUnarchiveResponse__SessionSource = + | "cli" + | "vscode" + | "exec" + | "appServer" + | "unknown" + | { readonly custom: string } + | { readonly subAgent: V2ThreadUnarchiveResponse__SubAgentSource }; +export const V2ThreadUnarchiveResponse__SessionSource = Schema.Union( + [ + Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), + Schema.Struct({ subAgent: V2ThreadUnarchiveResponse__SubAgentSource }).annotate({ + title: "SubAgentSessionSource", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__SessionSource" }); + +export type V2ThreadUnarchiveResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ThreadUnarchiveResponse__CodexErrorInfo | null; + readonly message: string; +}; +export const V2ThreadUnarchiveResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2ThreadUnarchiveResponse__TurnError" }); + +export type V2ThreadUnarchiveResponse__UserInput = | { - readonly action?: V2ReviewStartResponse__WebSearchAction | null; - readonly id: string; - readonly query: string; - readonly results?: ReadonlyArray | null; - readonly type: "webSearch"; + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } | { - readonly id: string; - readonly path: V2ReviewStartResponse__LegacyAppPathString; - readonly type: "imageView"; + readonly detail?: V2ThreadUnarchiveResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; } - | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { - readonly id: string; - readonly result: string; - readonly revisedPrompt?: string | null; - readonly savedPath?: V2ReviewStartResponse__AbsolutePathBuf | null; - readonly status: string; - readonly type: "imageGeneration"; + readonly detail?: V2ThreadUnarchiveResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; } - | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } - | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } - | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ReviewStartResponse__ThreadItem = Schema.Union( + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadUnarchiveResponse__UserInput = Schema.Union( [ Schema.Struct({ - clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ReviewStartResponse__UserInput), - id: Schema.String, - type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), - }).annotate({ title: "UserMessageThreadItem" }), - Schema.Struct({ - fragments: Schema.Array(V2ReviewStartResponse__HookPromptFragment), - id: Schema.String, - type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), - }).annotate({ title: "HookPromptThreadItem" }), + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadUnarchiveResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), Schema.Struct({ - id: Schema.String, - memoryCitation: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__MemoryCitation, Schema.Null]), + detail: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), - questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), ), - type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), - }).annotate({ title: "AgentMessageThreadItem" }), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), Schema.Struct({ - id: Schema.String, - text: Schema.String, - type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), - }).annotate({ - title: "PlanThreadItem", - description: - "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", - }), + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), Schema.Struct({ - content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - id: Schema.String, - summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), - }).annotate({ title: "ReasoningThreadItem" }), + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), Schema.Struct({ - aggregatedOutput: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "The command's output, aggregated from stdout and stderr.", - }), - Schema.Null, - ]), - ), - command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ReviewStartResponse__CommandAction).annotate({ - description: - "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", - }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the command execution in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - exitCode: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The command's exit code.", - format: "int32", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - id: Schema.String, - processId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Identifier for the underlying PTY process (when available).", - }), - Schema.Null, - ]), - ), - source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), - ), - status: V2ReviewStartResponse__CommandExecutionStatus, - type: Schema.Literal("commandExecution").annotate({ - title: "CommandExecutionThreadItemType", - }), - }).annotate({ title: "CommandExecutionThreadItem" }), - Schema.Struct({ - changes: Schema.Array(V2ReviewStartResponse__FileUpdateChange), - id: Schema.String, - status: V2ReviewStartResponse__PatchApplyStatus, - type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), - }).annotate({ title: "FileChangeThreadItem" }), - Schema.Struct({ - appContext: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__McpToolCallAppContext, Schema.Null]), - ), - arguments: Schema.Unknown, - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the MCP tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - error: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__McpToolCallError, Schema.Null]), - ), - id: Schema.String, - mcpAppResourceUri: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", - }), - Schema.Null, - ]), - ), - pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - result: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__McpToolCallResult, Schema.Null]), - ), - server: Schema.String, - status: V2ReviewStartResponse__McpToolCallStatus, - tool: Schema.String, - type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), - }).annotate({ title: "McpToolCallThreadItem" }), + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), Schema.Struct({ - arguments: Schema.Unknown, - contentItems: Schema.optionalKey( - Schema.Union([ - Schema.Array(V2ReviewStartResponse__DynamicToolCallOutputContentItem), - Schema.Null, - ]), - ), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the dynamic tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - id: Schema.String, - namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ReviewStartResponse__DynamicToolCallStatus, - success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - tool: Schema.String, - type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), - }).annotate({ title: "DynamicToolCallThreadItem" }), + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__UserInput" }); + +export type V2TurnCompletedNotification__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2TurnCompletedNotification__CodexErrorInfo | null; + readonly message: string; +}; +export const V2TurnCompletedNotification__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2TurnCompletedNotification__TurnError" }); + +export type V2TurnCompletedNotification__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2TurnCompletedNotification__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2TurnCompletedNotification__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2TurnCompletedNotification__UserInput = Schema.Union( + [ Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ReviewStartResponse__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", - }), - id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), - model: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Model requested for the spawned agent, when applicable.", - }), - Schema.Null, - ]), - ), - prompt: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Prompt text sent as part of the collab tool call, when available.", - }), - Schema.Null, - ]), - ), - reasoningEffort: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__ReasoningEffort, Schema.Null]).annotate({ - description: "Reasoning effort requested for the spawned agent, when applicable.", + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2TurnCompletedNotification__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], }), ), - receiverThreadIds: Schema.Array(Schema.String).annotate({ - description: - "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", - }), - senderThreadId: Schema.String.annotate({ - description: "Thread ID of the agent issuing the collab request.", - }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), - type: Schema.Literal("collabAgentToolCall").annotate({ - title: "CollabAgentToolCallThreadItemType", - }), - }).annotate({ title: "CollabAgentToolCallThreadItem" }), - Schema.Struct({ - agentPath: Schema.String, - agentThreadId: Schema.String, - id: Schema.String, - kind: V2ReviewStartResponse__SubAgentActivityKind, - type: Schema.Literal("subAgentActivity").annotate({ - title: "SubAgentActivityThreadItemType", - }), - }).annotate({ title: "SubAgentActivityThreadItem" }), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), Schema.Struct({ - action: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__WebSearchAction, Schema.Null]), - ), - id: Schema.String, - query: Schema.String, - results: Schema.optionalKey( - Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ - description: - "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", - }), - Schema.Null, - ]), + detail: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), ), - type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), - }).annotate({ title: "WebSearchThreadItem" }), - Schema.Struct({ - id: Schema.String, - path: V2ReviewStartResponse__LegacyAppPathString, - type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), - }).annotate({ title: "ImageViewThreadItem" }), - Schema.Struct({ - durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - id: Schema.String, - type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), - }).annotate({ - title: "SleepThreadItem", - description: "Display item emitted by the interruptible `clock.sleep` tool.", - }), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), Schema.Struct({ - id: Schema.String, - result: Schema.String, - revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - savedPath: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__AbsolutePathBuf, Schema.Null]), + detail: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), ), - status: Schema.String, - type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), - }).annotate({ title: "ImageGenerationThreadItem" }), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("enteredReviewMode").annotate({ - title: "EnteredReviewModeThreadItemType", - }), - }).annotate({ title: "EnteredReviewModeThreadItem" }), + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("exitedReviewMode").annotate({ - title: "ExitedReviewModeThreadItemType", - }), - }).annotate({ title: "ExitedReviewModeThreadItem" }), + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), Schema.Struct({ - id: Schema.String, - type: Schema.Literal("contextCompaction").annotate({ - title: "ContextCompactionThreadItemType", - }), - }).annotate({ title: "ContextCompactionThreadItem" }), + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), ], { mode: "oneOf" }, -); - -export type V2SkillsListResponse__SkillMetadata = { - readonly dependencies?: V2SkillsListResponse__SkillDependencies | null; - readonly description: string; - readonly enabled: boolean; - readonly interface?: V2SkillsListResponse__SkillInterface | null; - readonly name: string; - readonly path: V2SkillsListResponse__AbsolutePathBuf; - readonly scope: V2SkillsListResponse__SkillScope; - readonly shortDescription?: string | null; -}; -export const V2SkillsListResponse__SkillMetadata = Schema.Struct({ - dependencies: Schema.optionalKey( - Schema.Union([V2SkillsListResponse__SkillDependencies, Schema.Null]), - ), - description: Schema.String, - enabled: Schema.Boolean, - interface: Schema.optionalKey(Schema.Union([V2SkillsListResponse__SkillInterface, Schema.Null])), - name: Schema.String, - path: V2SkillsListResponse__AbsolutePathBuf, - scope: V2SkillsListResponse__SkillScope, - shortDescription: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Legacy short_description from SKILL.md. Prefer SKILL.json interface.short_description.", - }), - Schema.Null, - ]), - ), -}); +).annotate({ identifier: "V2TurnCompletedNotification__UserInput" }); -export type V2ThreadForkResponse__TurnError = { +export type V2TurnStartedNotification__TurnError = { readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadForkResponse__CodexErrorInfo | null; + readonly codexErrorInfo?: V2TurnStartedNotification__CodexErrorInfo | null; readonly message: string; }; -export const V2ThreadForkResponse__TurnError = Schema.Struct({ +export const V2TurnStartedNotification__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__CodexErrorInfo, Schema.Null]), + Schema.Union([V2TurnStartedNotification__CodexErrorInfo, Schema.Null]), ), message: Schema.String, -}); +}).annotate({ identifier: "V2TurnStartedNotification__TurnError" }); -export type V2ThreadForkResponse__ThreadItem = - | { - readonly clientId?: string | null; - readonly content: ReadonlyArray; - readonly id: string; - readonly type: "userMessage"; - } - | { - readonly fragments: ReadonlyArray; - readonly id: string; - readonly type: "hookPrompt"; - } +export type V2TurnStartedNotification__UserInput = | { - readonly id: string; - readonly memoryCitation?: V2ThreadForkResponse__MemoryCitation | null; - readonly phase?: V2ThreadForkResponse__MessagePhase | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; - readonly type: "agentMessage"; - } - | { readonly id: string; readonly text: string; readonly type: "plan" } - | { - readonly content?: ReadonlyArray; - readonly id: string; - readonly summary?: ReadonlyArray; - readonly type: "reasoning"; - } - | { - readonly aggregatedOutput?: string | null; - readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; - readonly durationMs?: number | null; - readonly exitCode?: number | null; - readonly id: string; - readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ThreadForkResponse__CommandExecutionStatus; - readonly type: "commandExecution"; - } - | { - readonly changes: ReadonlyArray; - readonly id: string; - readonly status: V2ThreadForkResponse__PatchApplyStatus; - readonly type: "fileChange"; - } - | { - readonly appContext?: V2ThreadForkResponse__McpToolCallAppContext | null; - readonly arguments: unknown; - readonly durationMs?: number | null; - readonly error?: V2ThreadForkResponse__McpToolCallError | null; - readonly id: string; - readonly mcpAppResourceUri?: string | null; - readonly pluginId?: string | null; - readonly result?: V2ThreadForkResponse__McpToolCallResult | null; - readonly server: string; - readonly status: V2ThreadForkResponse__McpToolCallStatus; - readonly tool: string; - readonly type: "mcpToolCall"; - } - | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; - readonly durationMs?: number | null; - readonly id: string; - readonly namespace?: string | null; - readonly status: V2ThreadForkResponse__DynamicToolCallStatus; - readonly success?: boolean | null; - readonly tool: string; - readonly type: "dynamicToolCall"; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadForkResponse__CollabAgentState }; - readonly id: string; - readonly model?: string | null; - readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadForkResponse__ReasoningEffort | null; - readonly receiverThreadIds: ReadonlyArray; - readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; - readonly type: "collabAgentToolCall"; + readonly detail?: V2TurnStartedNotification__ImageDetail | null; + readonly type: "image"; + readonly url: string; } | { - readonly agentPath: string; - readonly agentThreadId: string; - readonly id: string; - readonly kind: V2ThreadForkResponse__SubAgentActivityKind; - readonly type: "subAgentActivity"; + readonly detail?: V2TurnStartedNotification__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2TurnStartedNotification__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2TurnStartedNotification__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), + ), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartedNotification__UserInput" }); + +export type V2TurnStartParams__UserInput = | { - readonly action?: V2ThreadForkResponse__WebSearchAction | null; - readonly id: string; - readonly query: string; - readonly results?: ReadonlyArray | null; - readonly type: "webSearch"; + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; } | { - readonly id: string; - readonly path: V2ThreadForkResponse__LegacyAppPathString; - readonly type: "imageView"; + readonly detail?: V2TurnStartParams__ImageDetail | null; + readonly type: "image"; + readonly url: string; } - | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { - readonly id: string; - readonly result: string; - readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadForkResponse__AbsolutePathBuf | null; - readonly status: string; - readonly type: "imageGeneration"; + readonly detail?: V2TurnStartParams__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; } - | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } - | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } - | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadForkResponse__ThreadItem = Schema.Union( + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2TurnStartParams__UserInput = Schema.Union( [ Schema.Struct({ - clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadForkResponse__UserInput), - id: Schema.String, - type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), - }).annotate({ title: "UserMessageThreadItem" }), + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2TurnStartParams__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadForkResponse__HookPromptFragment), - id: Schema.String, - type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), - }).annotate({ title: "HookPromptThreadItem" }), + detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), Schema.Struct({ - id: Schema.String, - memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__MessagePhase, Schema.Null])), - text: Schema.String, + detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartParams__UserInput" }); + +export type V2TurnStartResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2TurnStartResponse__CodexErrorInfo | null; + readonly message: string; +}; +export const V2TurnStartResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, +}).annotate({ identifier: "V2TurnStartResponse__TurnError" }); + +export type V2TurnStartResponse__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2TurnStartResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2TurnStartResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2TurnStartResponse__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2TurnStartResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartResponse__UserInput" }); + +export type V2TurnSteerParams__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2TurnSteerParams__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2TurnSteerParams__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2TurnSteerParams__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2TurnSteerParams__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnSteerParams__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnSteerParams__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), + url: Schema.String, + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnSteerParams__UserInput" }); + +export type ClientRequest__TurnStartParams = { + readonly approvalPolicy?: ClientRequest__AskForApproval | null; + readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; + readonly clientUserMessageId?: string | null; + readonly cwd?: string | null; + readonly effort?: ClientRequest__ReasoningEffort | null; + readonly input: ReadonlyArray; + readonly model?: string | null; + readonly outputSchema?: Schema.Json; + readonly personality?: ClientRequest__Personality | null; + readonly sandboxPolicy?: ClientRequest__SandboxPolicy | null; + readonly serviceTier?: string | null; + readonly summary?: ClientRequest__ReasoningSummary | null; + readonly threadId: string; +}; +export const ClientRequest__TurnStartParams = Schema.Struct({ + approvalPolicy: Schema.optionalKey( + Schema.Union([ClientRequest__AskForApproval, Schema.Null]).annotate({ + description: "Override the approval policy for this turn and subsequent turns.", + }), + ), + approvalsReviewer: Schema.optionalKey( + Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ + description: + "Override where approval requests are routed for review on this turn and subsequent turns.", + }), + ), + clientUserMessageId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + cwd: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Override the working directory for this turn and subsequent turns.", + }), + Schema.Null, + ]), + ), + effort: Schema.optionalKey( + Schema.Union([ClientRequest__ReasoningEffort, Schema.Null]).annotate({ + description: "Override the reasoning effort for this turn and subsequent turns.", + }), + ), + input: Schema.Array(ClientRequest__UserInput), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Override the model for this turn and subsequent turns.", + }), + Schema.Null, + ]), + ), + outputSchema: Schema.optionalKey( + Schema.Json.annotate({ + expected: "JSON value", + description: + "Optional JSON Schema used to constrain the final assistant message for this turn.", + }), + ), + personality: Schema.optionalKey( + Schema.Union([ClientRequest__Personality, Schema.Null]).annotate({ + description: "Override the personality for this turn and subsequent turns.", + }), + ), + sandboxPolicy: Schema.optionalKey( + Schema.Union([ClientRequest__SandboxPolicy, Schema.Null]).annotate({ + description: "Override the sandbox policy for this turn and subsequent turns.", + }), + ), + serviceTier: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Override the service tier for this turn and subsequent turns.", + }), + Schema.Null, + ]), + ), + summary: Schema.optionalKey( + Schema.Union([ClientRequest__ReasoningSummary, Schema.Null]).annotate({ + description: "Override the reasoning summary for this turn and subsequent turns.", + }), + ), + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__TurnStartParams" }); + +export type ClientRequest__TurnSteerParams = { + readonly clientUserMessageId?: string | null; + readonly expectedTurnId: string; + readonly input: ReadonlyArray; + readonly threadId: string; +}; +export const ClientRequest__TurnSteerParams = Schema.Struct({ + clientUserMessageId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + expectedTurnId: Schema.String.annotate({ + description: + "Required active turn id precondition. The request fails when it does not match the currently active turn.", + }), + input: Schema.Array(ClientRequest__UserInput), + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__TurnSteerParams" }); + +export type ClientRequest__ExternalAgentConfigImportParams = { + readonly migrationItems: ReadonlyArray; + readonly migrationSource?: string | null; + readonly source?: string | null; +}; +export const ClientRequest__ExternalAgentConfigImportParams = Schema.Struct({ + migrationItems: Schema.Array(ClientRequest__ExternalAgentConfigMigrationItem), + migrationSource: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Migration-source selector used to produce the migration items. Pass the same value to detection and import; missing or unrecognized values use the default source.", + }), + Schema.Null, + ]), + ), + source: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional identifier for the product that initiated the import.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__ExternalAgentConfigImportParams" }); + +export type CommandExecutionRequestApprovalParams__FileSystemSandboxEntry = { + readonly access: CommandExecutionRequestApprovalParams__FileSystemAccessMode; + readonly path: CommandExecutionRequestApprovalParams__FileSystemPath; +}; +export const CommandExecutionRequestApprovalParams__FileSystemSandboxEntry = Schema.Struct({ + access: CommandExecutionRequestApprovalParams__FileSystemAccessMode, + path: CommandExecutionRequestApprovalParams__FileSystemPath, +}).annotate({ identifier: "CommandExecutionRequestApprovalParams__FileSystemSandboxEntry" }); + +export type McpServerElicitationRequestParams__McpElicitationMultiSelectEnumSchema = + | McpServerElicitationRequestParams__McpElicitationUntitledMultiSelectEnumSchema + | McpServerElicitationRequestParams__McpElicitationTitledMultiSelectEnumSchema; +export const McpServerElicitationRequestParams__McpElicitationMultiSelectEnumSchema = Schema.Union([ + McpServerElicitationRequestParams__McpElicitationUntitledMultiSelectEnumSchema, + McpServerElicitationRequestParams__McpElicitationTitledMultiSelectEnumSchema, +]).annotate({ + identifier: "McpServerElicitationRequestParams__McpElicitationMultiSelectEnumSchema", +}); + +export type PermissionsRequestApprovalParams__FileSystemSandboxEntry = { + readonly access: PermissionsRequestApprovalParams__FileSystemAccessMode; + readonly path: PermissionsRequestApprovalParams__FileSystemPath; +}; +export const PermissionsRequestApprovalParams__FileSystemSandboxEntry = Schema.Struct({ + access: PermissionsRequestApprovalParams__FileSystemAccessMode, + path: PermissionsRequestApprovalParams__FileSystemPath, +}).annotate({ identifier: "PermissionsRequestApprovalParams__FileSystemSandboxEntry" }); + +export type PermissionsRequestApprovalResponse__FileSystemSandboxEntry = { + readonly access: PermissionsRequestApprovalResponse__FileSystemAccessMode; + readonly path: PermissionsRequestApprovalResponse__FileSystemPath; +}; +export const PermissionsRequestApprovalResponse__FileSystemSandboxEntry = Schema.Struct({ + access: PermissionsRequestApprovalResponse__FileSystemAccessMode, + path: PermissionsRequestApprovalResponse__FileSystemPath, +}).annotate({ identifier: "PermissionsRequestApprovalResponse__FileSystemSandboxEntry" }); + +export type ServerNotification__ErrorNotification = { + readonly error: ServerNotification__TurnError; + readonly threadId: string; + readonly turnId: string; + readonly willRetry: boolean; +}; +export const ServerNotification__ErrorNotification = Schema.Struct({ + error: ServerNotification__TurnError, + threadId: Schema.String, + turnId: Schema.String, + willRetry: Schema.Boolean, +}).annotate({ identifier: "ServerNotification__ErrorNotification" }); + +export type ServerNotification__ThreadItem = + | { + readonly clientId?: string | null; + readonly content: ReadonlyArray; + readonly id: string; + readonly type: "userMessage"; + } + | { + readonly fragments: ReadonlyArray; + readonly id: string; + readonly type: "hookPrompt"; + } + | { + readonly id: string; + readonly memoryCitation?: ServerNotification__MemoryCitation | null; + readonly phase?: ServerNotification__MessagePhase | null; + readonly text: string; + readonly delivery?: "async" | null; + readonly questions?: ReadonlyArray<{ + readonly title: string; + readonly options?: ReadonlyArray | null; + }> | null; + readonly type: "agentMessage"; + } + | { readonly id: string; readonly text: string; readonly type: "plan" } + | { + readonly content?: ReadonlyArray; + readonly id: string; + readonly summary?: ReadonlyArray; + readonly type: "reasoning"; + } + | { + readonly aggregatedOutput?: string | null; + readonly command: string; + readonly commandActions: ReadonlyArray; + readonly cwd: ServerNotification__LegacyAppPathString; + readonly durationMs?: number | null; + readonly exitCode?: number | null; + readonly id: string; + readonly processId?: string | null; + readonly source?: ServerNotification__CommandExecutionSource; + readonly status: ServerNotification__CommandExecutionStatus; + readonly type: "commandExecution"; + } + | { + readonly changes: ReadonlyArray; + readonly id: string; + readonly status: ServerNotification__PatchApplyStatus; + readonly type: "fileChange"; + } + | { + readonly appContext?: ServerNotification__McpToolCallAppContext | null; + readonly arguments: Schema.Json; + readonly durationMs?: number | null; + readonly error?: ServerNotification__McpToolCallError | null; + readonly id: string; + readonly mcpAppResourceUri?: string | null; + readonly pluginId?: string | null; + readonly result?: ServerNotification__McpToolCallResult | null; + readonly server: string; + readonly status: ServerNotification__McpToolCallStatus; + readonly tool: string; + readonly type: "mcpToolCall"; + } + | { + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; + readonly durationMs?: number | null; + readonly id: string; + readonly namespace?: string | null; + readonly status: ServerNotification__DynamicToolCallStatus; + readonly success?: boolean | null; + readonly tool: string; + readonly type: "dynamicToolCall"; + } + | { + readonly agentsStates: { readonly [x: string]: ServerNotification__CollabAgentState }; + readonly id: string; + readonly model?: string | null; + readonly prompt?: string | null; + readonly reasoningEffort?: ServerNotification__ReasoningEffort | null; + readonly receiverThreadIds: ReadonlyArray; + readonly senderThreadId: string; + readonly status: ServerNotification__CollabAgentToolCallStatus; + readonly tool: ServerNotification__CollabAgentTool; + readonly type: "collabAgentToolCall"; + } + | { + readonly agentPath: string; + readonly agentThreadId: string; + readonly id: string; + readonly kind: ServerNotification__SubAgentActivityKind; + readonly type: "subAgentActivity"; + } + | { + readonly action?: ServerNotification__WebSearchAction | null; + readonly id: string; + readonly query: string; + readonly results?: ReadonlyArray | null; + readonly type: "webSearch"; + } + | { + readonly id: string; + readonly path: ServerNotification__LegacyAppPathString; + readonly type: "imageView"; + } + | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } + | { + readonly id: string; + readonly result: string; + readonly revisedPrompt?: string | null; + readonly savedPath?: ServerNotification__AbsolutePathBuf | null; + readonly status: string; + readonly type: "imageGeneration"; + } + | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } + | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } + | { readonly id: string; readonly type: "contextCompaction" }; +export const ServerNotification__ThreadItem = Schema.Union( + [ + Schema.Struct({ + clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + content: Schema.Array(ServerNotification__UserInput), + id: Schema.String, + type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), + }).annotate({ title: "UserMessageThreadItem" }), + Schema.Struct({ + fragments: Schema.Array(ServerNotification__HookPromptFragment), + id: Schema.String, + type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), + }).annotate({ title: "HookPromptThreadItem" }), + Schema.Struct({ + id: Schema.String, + memoryCitation: Schema.optionalKey( + Schema.Union([ServerNotification__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey(Schema.Union([ServerNotification__MessagePhase, Schema.Null])), + text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ @@ -23307,17 +25933,20 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadForkResponse__CommandAction).annotate({ + commandActions: Schema.Array(ServerNotification__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + ServerNotification__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -23326,7 +25955,7 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -23340,41 +25969,37 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + ServerNotification__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2ThreadForkResponse__CommandExecutionStatus, + status: ServerNotification__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadForkResponse__FileUpdateChange), + changes: Schema.Array(ServerNotification__FileUpdateChange), id: Schema.String, - status: V2ThreadForkResponse__PatchApplyStatus, + status: ServerNotification__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([ServerNotification__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - error: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__McpToolCallError, Schema.Null]), - ), + error: Schema.optionalKey(Schema.Union([ServerNotification__McpToolCallError, Schema.Null])), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ @@ -23386,18 +26011,18 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__McpToolCallResult, Schema.Null]), + Schema.Union([ServerNotification__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadForkResponse__McpToolCallStatus, + status: ServerNotification__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadForkResponse__DynamicToolCallOutputContentItem), + Schema.Array(ServerNotification__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -23406,19 +26031,19 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadForkResponse__DynamicToolCallStatus, + status: ServerNotification__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadForkResponse__CollabAgentState).annotate({ + agentsStates: Schema.Record(Schema.String, ServerNotification__CollabAgentState).annotate({ description: "Last known status of the target agents, when available.", }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), @@ -23439,7 +26064,7 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([ServerNotification__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -23450,20 +26075,14 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + ServerNotification__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + ServerNotification__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -23472,20 +26091,18 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadForkResponse__SubAgentActivityKind, + kind: ServerNotification__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ - action: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__WebSearchAction, Schema.Null]), - ), + action: Schema.optionalKey(Schema.Union([ServerNotification__WebSearchAction, Schema.Null])), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -23496,13 +26113,17 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadForkResponse__LegacyAppPathString, + path: ServerNotification__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -23514,7 +26135,7 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([ServerNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -23541,37 +26162,294 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ServerNotification__ThreadItem" }); -export type V2ThreadListResponse__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadListResponse__CodexErrorInfo | null; - readonly message: string; +export type ServerNotification__FileSystemSandboxEntry = { + readonly access: ServerNotification__FileSystemAccessMode; + readonly path: ServerNotification__FileSystemPath; }; -export const V2ThreadListResponse__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); - -export type V2ThreadListResponse__ThreadItem = +export const ServerNotification__FileSystemSandboxEntry = Schema.Struct({ + access: ServerNotification__FileSystemAccessMode, + path: ServerNotification__FileSystemPath, +}).annotate({ identifier: "ServerNotification__FileSystemSandboxEntry" }); + +export type ServerNotification__ThreadSettings = { + readonly activePermissionProfile?: ServerNotification__ActivePermissionProfile | null; + readonly approvalPolicy: ServerNotification__AskForApproval; + readonly approvalsReviewer: ServerNotification__ApprovalsReviewer; + readonly collaborationMode: ServerNotification__CollaborationMode; + readonly cwd: ServerNotification__AbsolutePathBuf; + readonly effort?: ServerNotification__ReasoningEffort | null; + readonly model: string; + readonly modelProvider: string; + readonly personality?: ServerNotification__Personality | null; + readonly sandboxPolicy: ServerNotification__SandboxPolicy; + readonly serviceTier?: string | null; + readonly summary?: ServerNotification__ReasoningSummary | null; +}; +export const ServerNotification__ThreadSettings = Schema.Struct({ + activePermissionProfile: Schema.optionalKey( + Schema.Union([ServerNotification__ActivePermissionProfile, Schema.Null]), + ), + approvalPolicy: ServerNotification__AskForApproval, + approvalsReviewer: ServerNotification__ApprovalsReviewer, + collaborationMode: ServerNotification__CollaborationMode, + cwd: ServerNotification__AbsolutePathBuf, + effort: Schema.optionalKey(Schema.Union([ServerNotification__ReasoningEffort, Schema.Null])), + model: Schema.String, + modelProvider: Schema.String, + personality: Schema.optionalKey(Schema.Union([ServerNotification__Personality, Schema.Null])), + sandboxPolicy: ServerNotification__SandboxPolicy, + serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + summary: Schema.optionalKey(Schema.Union([ServerNotification__ReasoningSummary, Schema.Null])), +}).annotate({ identifier: "ServerNotification__ThreadSettings" }); + +export type ServerNotification__HookStartedNotification = { + readonly run: ServerNotification__HookRunSummary; + readonly threadId: string; + readonly turnId?: string | null; +}; +export const ServerNotification__HookStartedNotification = Schema.Struct({ + run: ServerNotification__HookRunSummary, + threadId: Schema.String, + turnId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__HookStartedNotification" }); + +export type ServerNotification__HookCompletedNotification = { + readonly run: ServerNotification__HookRunSummary; + readonly threadId: string; + readonly turnId?: string | null; +}; +export const ServerNotification__HookCompletedNotification = Schema.Struct({ + run: ServerNotification__HookRunSummary, + threadId: Schema.String, + turnId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ServerNotification__HookCompletedNotification" }); + +export type ServerNotification__AppListUpdatedNotification = { + readonly data: ReadonlyArray; +}; +export const ServerNotification__AppListUpdatedNotification = Schema.Struct({ + data: Schema.Array(ServerNotification__AppInfo), +}).annotate({ + description: "EXPERIMENTAL - notification emitted when the app list changes.", + identifier: "ServerNotification__AppListUpdatedNotification", +}); + +export type ServerNotification__ExternalAgentConfigImportProgressNotification = { + readonly importId: string; + readonly itemTypeResults: ReadonlyArray; +}; +export const ServerNotification__ExternalAgentConfigImportProgressNotification = Schema.Struct({ + importId: Schema.String, + itemTypeResults: Schema.Array(ServerNotification__ExternalAgentConfigImportTypeResult), +}).annotate({ identifier: "ServerNotification__ExternalAgentConfigImportProgressNotification" }); + +export type ServerNotification__ExternalAgentConfigImportCompletedNotification = { + readonly importId: string; + readonly itemTypeResults: ReadonlyArray; +}; +export const ServerNotification__ExternalAgentConfigImportCompletedNotification = Schema.Struct({ + importId: Schema.String, + itemTypeResults: Schema.Array(ServerNotification__ExternalAgentConfigImportTypeResult), +}).annotate({ identifier: "ServerNotification__ExternalAgentConfigImportCompletedNotification" }); + +export type ServerRequest__FileSystemSandboxEntry = { + readonly access: ServerRequest__FileSystemAccessMode; + readonly path: ServerRequest__FileSystemPath; +}; +export const ServerRequest__FileSystemSandboxEntry = Schema.Struct({ + access: ServerRequest__FileSystemAccessMode, + path: ServerRequest__FileSystemPath, +}).annotate({ identifier: "ServerRequest__FileSystemSandboxEntry" }); + +export type ServerRequest__McpElicitationMultiSelectEnumSchema = + | ServerRequest__McpElicitationUntitledMultiSelectEnumSchema + | ServerRequest__McpElicitationTitledMultiSelectEnumSchema; +export const ServerRequest__McpElicitationMultiSelectEnumSchema = Schema.Union([ + ServerRequest__McpElicitationUntitledMultiSelectEnumSchema, + ServerRequest__McpElicitationTitledMultiSelectEnumSchema, +]).annotate({ identifier: "ServerRequest__McpElicitationMultiSelectEnumSchema" }); + +export type V2ConfigReadResponse__Config = { + readonly analytics?: V2ConfigReadResponse__AnalyticsConfig | null; + readonly approval_policy?: V2ConfigReadResponse__AskForApproval | null; + readonly approvals_reviewer?: V2ConfigReadResponse__ApprovalsReviewer | null; + readonly compact_prompt?: string | null; + readonly desktop?: { readonly [x: string]: Schema.Json } | null; + readonly developer_instructions?: string | null; + readonly forced_chatgpt_workspace_id?: V2ConfigReadResponse__ForcedChatgptWorkspaceIds | null; + readonly forced_login_method?: V2ConfigReadResponse__ForcedLoginMethod | null; + readonly instructions?: string | null; + readonly model?: string | null; + readonly model_auto_compact_token_limit?: number | null; + readonly model_auto_compact_token_limit_scope?: V2ConfigReadResponse__AutoCompactTokenLimitScope | null; + readonly model_context_window?: number | null; + readonly model_provider?: string | null; + readonly model_reasoning_effort?: V2ConfigReadResponse__ReasoningEffort | null; + readonly model_reasoning_summary?: V2ConfigReadResponse__ReasoningSummary | null; + readonly model_verbosity?: V2ConfigReadResponse__Verbosity | null; + readonly review_model?: string | null; + readonly sandbox_mode?: V2ConfigReadResponse__SandboxMode | null; + readonly sandbox_workspace_write?: V2ConfigReadResponse__SandboxWorkspaceWrite | null; + readonly service_tier?: string | null; + readonly tools?: V2ConfigReadResponse__ToolsV2 | null; + readonly web_search?: V2ConfigReadResponse__WebSearchMode | null; +} & { readonly [x: string]: Schema.Json }; +export const V2ConfigReadResponse__Config = Schema.StructWithRest( + Schema.Struct({ + analytics: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AnalyticsConfig, Schema.Null]), + ), + approval_policy: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AskForApproval, Schema.Null]), + ), + approvals_reviewer: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ApprovalsReviewer, Schema.Null]).annotate({ + description: + "[UNSTABLE] Optional default for where approval requests are routed for review.", + }), + ), + compact_prompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + desktop: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), + Schema.Null, + ]), + ), + developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + forced_chatgpt_workspace_id: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ForcedChatgptWorkspaceIds, Schema.Null]), + ), + forced_login_method: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ForcedLoginMethod, Schema.Null]), + ), + instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model_auto_compact_token_limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + model_auto_compact_token_limit_scope: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AutoCompactTokenLimitScope, Schema.Null]), + ), + model_context_window: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + model_provider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model_reasoning_effort: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ReasoningEffort, Schema.Null]), + ), + model_reasoning_summary: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ReasoningSummary, Schema.Null]), + ), + model_verbosity: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__Verbosity, Schema.Null]), + ), + review_model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + sandbox_mode: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__SandboxMode, Schema.Null]), + ), + sandbox_workspace_write: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__SandboxWorkspaceWrite, Schema.Null]), + ), + service_tier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + tools: Schema.optionalKey(Schema.Union([V2ConfigReadResponse__ToolsV2, Schema.Null])), + web_search: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__WebSearchMode, Schema.Null]), + ), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], +).annotate({ identifier: "V2ConfigReadResponse__Config" }); + +export type V2ConfigRequirementsReadResponse__ConfigRequirements = { + readonly allowAppshots?: boolean | null; + readonly allowManagedHooksOnly?: boolean | null; + readonly allowRemoteControl?: boolean | null; + readonly allowedApprovalPolicies?: ReadonlyArray | null; + readonly allowedPermissionProfiles?: { readonly [x: string]: boolean } | null; + readonly allowedSandboxModes?: ReadonlyArray | null; + readonly allowedWebSearchModes?: ReadonlyArray | null; + readonly allowedWindowsSandboxImplementations?: ReadonlyArray | null; + readonly computerUse?: V2ConfigRequirementsReadResponse__ComputerUseRequirements | null; + readonly defaultPermissions?: string | null; + readonly enforceResidency?: V2ConfigRequirementsReadResponse__ResidencyRequirement | null; + readonly featureRequirements?: { readonly [x: string]: boolean } | null; + readonly models?: V2ConfigRequirementsReadResponse__ModelsRequirements | null; +}; +export const V2ConfigRequirementsReadResponse__ConfigRequirements = Schema.Struct({ + allowAppshots: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowManagedHooksOnly: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowRemoteControl: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowedApprovalPolicies: Schema.optionalKey( + Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__AskForApproval), Schema.Null]), + ), + allowedPermissionProfiles: Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.Boolean), Schema.Null]), + ), + allowedSandboxModes: Schema.optionalKey( + Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__SandboxMode), Schema.Null]), + ), + allowedWebSearchModes: Schema.optionalKey( + Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__WebSearchMode), Schema.Null]), + ), + allowedWindowsSandboxImplementations: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode), + Schema.Null, + ]), + ), + computerUse: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__ComputerUseRequirements, Schema.Null]), + ), + defaultPermissions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + enforceResidency: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__ResidencyRequirement, Schema.Null]), + ), + featureRequirements: Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.Boolean), Schema.Null]), + ), + models: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__ModelsRequirements, Schema.Null]), + ), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ConfigRequirements" }); + +export type V2ConfigWriteResponse__OverriddenMetadata = { + readonly effectiveValue: Schema.Json; + readonly message: string; + readonly overridingLayer: V2ConfigWriteResponse__ConfigLayerMetadata; +}; +export const V2ConfigWriteResponse__OverriddenMetadata = Schema.Struct({ + effectiveValue: Schema.Json.annotate({ expected: "JSON value" }), + message: Schema.String, + overridingLayer: V2ConfigWriteResponse__ConfigLayerMetadata, +}).annotate({ identifier: "V2ConfigWriteResponse__OverriddenMetadata" }); + +export type V2ItemCompletedNotification__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2ThreadListResponse__MemoryCitation | null; - readonly phase?: V2ThreadListResponse__MessagePhase | null; + readonly memoryCitation?: V2ItemCompletedNotification__MemoryCitation | null; + readonly phase?: V2ItemCompletedNotification__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -23590,85 +26468,78 @@ export type V2ThreadListResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ItemCompletedNotification__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ThreadListResponse__CommandExecutionStatus; + readonly source?: V2ItemCompletedNotification__CommandExecutionSource; + readonly status: V2ItemCompletedNotification__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadListResponse__PatchApplyStatus; + readonly status: V2ItemCompletedNotification__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadListResponse__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ItemCompletedNotification__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadListResponse__McpToolCallError | null; + readonly error?: V2ItemCompletedNotification__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2ThreadListResponse__McpToolCallResult | null; + readonly result?: V2ItemCompletedNotification__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadListResponse__McpToolCallStatus; + readonly status: V2ItemCompletedNotification__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadListResponse__DynamicToolCallStatus; + readonly status: V2ItemCompletedNotification__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadListResponse__CollabAgentState }; + readonly agentsStates: { + readonly [x: string]: V2ItemCompletedNotification__CollabAgentState; + }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadListResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ItemCompletedNotification__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ItemCompletedNotification__CollabAgentToolCallStatus; + readonly tool: V2ItemCompletedNotification__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadListResponse__SubAgentActivityKind; + readonly kind: V2ItemCompletedNotification__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadListResponse__WebSearchAction | null; + readonly action?: V2ItemCompletedNotification__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2ThreadListResponse__LegacyAppPathString; + readonly path: V2ItemCompletedNotification__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -23676,32 +26547,34 @@ export type V2ThreadListResponse__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadListResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ItemCompletedNotification__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadListResponse__ThreadItem = Schema.Union( +export const V2ItemCompletedNotification__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadListResponse__UserInput), + content: Schema.Array(V2ItemCompletedNotification__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadListResponse__HookPromptFragment), + fragments: Schema.Array(V2ItemCompletedNotification__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ItemCompletedNotification__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__MessagePhase, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ThreadListResponse__MessagePhase, Schema.Null])), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( @@ -23742,17 +26615,20 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadListResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ItemCompletedNotification__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ItemCompletedNotification__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -23761,7 +26637,7 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -23775,40 +26651,38 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ItemCompletedNotification__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2ThreadListResponse__CommandExecutionStatus, + status: V2ItemCompletedNotification__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadListResponse__FileUpdateChange), + changes: Schema.Array(V2ItemCompletedNotification__FileUpdateChange), id: Schema.String, - status: V2ThreadListResponse__PatchApplyStatus, + status: V2ItemCompletedNotification__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ItemCompletedNotification__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ItemCompletedNotification__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( @@ -23821,18 +26695,18 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ItemCompletedNotification__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadListResponse__McpToolCallStatus, + status: V2ItemCompletedNotification__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadListResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ItemCompletedNotification__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -23841,21 +26715,22 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadListResponse__DynamicToolCallStatus, + status: V2ItemCompletedNotification__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadListResponse__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", - }), + agentsStates: Schema.Record( + Schema.String, + V2ItemCompletedNotification__CollabAgentState, + ).annotate({ description: "Last known status of the target agents, when available." }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -23874,7 +26749,7 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ItemCompletedNotification__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -23885,20 +26760,14 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ItemCompletedNotification__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ItemCompletedNotification__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -23907,20 +26776,20 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadListResponse__SubAgentActivityKind, + kind: V2ItemCompletedNotification__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ItemCompletedNotification__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -23931,13 +26800,17 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadListResponse__LegacyAppPathString, + path: V2ItemCompletedNotification__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -23949,7 +26822,7 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ItemCompletedNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -23976,37 +26849,48 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ItemCompletedNotification__ThreadItem" }); -export type V2ThreadMetadataUpdateResponse__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadMetadataUpdateResponse__CodexErrorInfo | null; - readonly message: string; +export type V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSandboxEntry = { + readonly access: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode; + readonly path: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath; }; -export const V2ThreadMetadataUpdateResponse__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); +export const V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSandboxEntry = + Schema.Struct({ + access: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode, + path: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath, + }).annotate({ + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSandboxEntry", + }); -export type V2ThreadMetadataUpdateResponse__ThreadItem = +export type V2ItemGuardianApprovalReviewStartedNotification__FileSystemSandboxEntry = { + readonly access: V2ItemGuardianApprovalReviewStartedNotification__FileSystemAccessMode; + readonly path: V2ItemGuardianApprovalReviewStartedNotification__FileSystemPath; +}; +export const V2ItemGuardianApprovalReviewStartedNotification__FileSystemSandboxEntry = + Schema.Struct({ + access: V2ItemGuardianApprovalReviewStartedNotification__FileSystemAccessMode, + path: V2ItemGuardianApprovalReviewStartedNotification__FileSystemPath, + }).annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__FileSystemSandboxEntry", + }); + +export type V2ItemStartedNotification__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2ThreadMetadataUpdateResponse__MemoryCitation | null; - readonly phase?: V2ThreadMetadataUpdateResponse__MessagePhase | null; + readonly memoryCitation?: V2ItemStartedNotification__MemoryCitation | null; + readonly phase?: V2ItemStartedNotification__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -24025,87 +26909,76 @@ export type V2ThreadMetadataUpdateResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ItemStartedNotification__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ThreadMetadataUpdateResponse__CommandExecutionStatus; + readonly source?: V2ItemStartedNotification__CommandExecutionSource; + readonly status: V2ItemStartedNotification__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadMetadataUpdateResponse__PatchApplyStatus; + readonly status: V2ItemStartedNotification__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadMetadataUpdateResponse__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ItemStartedNotification__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadMetadataUpdateResponse__McpToolCallError | null; + readonly error?: V2ItemStartedNotification__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2ThreadMetadataUpdateResponse__McpToolCallResult | null; + readonly result?: V2ItemStartedNotification__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadMetadataUpdateResponse__McpToolCallStatus; + readonly status: V2ItemStartedNotification__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadMetadataUpdateResponse__DynamicToolCallStatus; + readonly status: V2ItemStartedNotification__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { - readonly [x: string]: V2ThreadMetadataUpdateResponse__CollabAgentState; - }; + readonly agentsStates: { readonly [x: string]: V2ItemStartedNotification__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadMetadataUpdateResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ItemStartedNotification__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ItemStartedNotification__CollabAgentToolCallStatus; + readonly tool: V2ItemStartedNotification__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadMetadataUpdateResponse__SubAgentActivityKind; + readonly kind: V2ItemStartedNotification__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadMetadataUpdateResponse__WebSearchAction | null; + readonly action?: V2ItemStartedNotification__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2ThreadMetadataUpdateResponse__LegacyAppPathString; + readonly path: V2ItemStartedNotification__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -24113,33 +26986,33 @@ export type V2ThreadMetadataUpdateResponse__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadMetadataUpdateResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ItemStartedNotification__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( +export const V2ItemStartedNotification__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadMetadataUpdateResponse__UserInput), + content: Schema.Array(V2ItemStartedNotification__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadMetadataUpdateResponse__HookPromptFragment), + fragments: Schema.Array(V2ItemStartedNotification__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ItemStartedNotification__MemoryCitation, Schema.Null]), ), phase: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__MessagePhase, Schema.Null]), + Schema.Union([V2ItemStartedNotification__MessagePhase, Schema.Null]), ), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), @@ -24181,17 +27054,20 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadMetadataUpdateResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ItemStartedNotification__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ItemStartedNotification__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -24200,7 +27076,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -24214,40 +27090,38 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ItemStartedNotification__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2ThreadMetadataUpdateResponse__CommandExecutionStatus, + status: V2ItemStartedNotification__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadMetadataUpdateResponse__FileUpdateChange), + changes: Schema.Array(V2ItemStartedNotification__FileUpdateChange), id: Schema.String, - status: V2ThreadMetadataUpdateResponse__PatchApplyStatus, + status: V2ItemStartedNotification__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ItemStartedNotification__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ItemStartedNotification__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( @@ -24260,18 +27134,18 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ItemStartedNotification__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadMetadataUpdateResponse__McpToolCallStatus, + status: V2ItemStartedNotification__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadMetadataUpdateResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ItemStartedNotification__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -24280,13 +27154,13 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadMetadataUpdateResponse__DynamicToolCallStatus, + status: V2ItemStartedNotification__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), @@ -24294,7 +27168,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( Schema.Struct({ agentsStates: Schema.Record( Schema.String, - V2ThreadMetadataUpdateResponse__CollabAgentState, + V2ItemStartedNotification__CollabAgentState, ).annotate({ description: "Last known status of the target agents, when available." }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( @@ -24314,7 +27188,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ItemStartedNotification__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -24325,20 +27199,14 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ItemStartedNotification__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ItemStartedNotification__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -24347,20 +27215,20 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadMetadataUpdateResponse__SubAgentActivityKind, + kind: V2ItemStartedNotification__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ItemStartedNotification__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -24371,13 +27239,17 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadMetadataUpdateResponse__LegacyAppPathString, + path: V2ItemStartedNotification__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -24389,7 +27261,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ItemStartedNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -24416,480 +27288,657 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ItemStartedNotification__ThreadItem" }); -export type V2ThreadReadResponse__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadReadResponse__CodexErrorInfo | null; - readonly message: string; +export type V2PluginInstalledResponse__PluginSummary = { + readonly authPolicy: V2PluginInstalledResponse__PluginAuthPolicy; + readonly availability?: V2PluginInstalledResponse__PluginAvailability; + readonly enabled: boolean; + readonly id: string; + readonly installPolicy: V2PluginInstalledResponse__PluginInstallPolicy; + readonly installPolicySource?: V2PluginInstalledResponse__PluginInstallPolicySource | null; + readonly installed: boolean; + readonly interface?: V2PluginInstalledResponse__PluginInterface | null; + readonly keywords?: ReadonlyArray; + readonly localVersion?: string | null; + readonly mustShowInstallationInterstitial?: boolean | null; + readonly name: string; + readonly remotePluginId?: string | null; + readonly shareContext?: V2PluginInstalledResponse__PluginShareContext | null; + readonly source: V2PluginInstalledResponse__PluginSource; + readonly version?: string | null; }; -export const V2ThreadReadResponse__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__CodexErrorInfo, Schema.Null]), +export const V2PluginInstalledResponse__PluginSummary = Schema.Struct({ + authPolicy: V2PluginInstalledResponse__PluginAuthPolicy, + availability: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2PluginInstalledResponse__PluginAvailability, + ).annotate({ + description: "Availability state for installing and using the plugin.", + default: "AVAILABLE", + }), ), - message: Schema.String, -}); - -export type V2ThreadReadResponse__ThreadItem = - | { - readonly clientId?: string | null; - readonly content: ReadonlyArray; - readonly id: string; - readonly type: "userMessage"; - } - | { - readonly fragments: ReadonlyArray; - readonly id: string; - readonly type: "hookPrompt"; - } - | { - readonly id: string; - readonly memoryCitation?: V2ThreadReadResponse__MemoryCitation | null; - readonly phase?: V2ThreadReadResponse__MessagePhase | null; - readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; - readonly type: "agentMessage"; + enabled: Schema.Boolean, + id: Schema.String, + installPolicy: V2PluginInstalledResponse__PluginInstallPolicy, + installPolicySource: Schema.optionalKey( + Schema.Union([V2PluginInstalledResponse__PluginInstallPolicySource, Schema.Null]), + ), + installed: Schema.Boolean, + interface: Schema.optionalKey( + Schema.Union([V2PluginInstalledResponse__PluginInterface, Schema.Null]), + ), + keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + localVersion: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version of the locally materialized plugin package when available.", + }), + Schema.Null, + ]), + ), + mustShowInstallationInterstitial: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + name: Schema.String, + remotePluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Backend remote plugin identifier when available." }), + Schema.Null, + ]), + ), + shareContext: Schema.optionalKey( + Schema.Union([V2PluginInstalledResponse__PluginShareContext, Schema.Null]).annotate({ + description: "Remote sharing context associated with this plugin when available.", + }), + ), + source: V2PluginInstalledResponse__PluginSource, + version: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version advertised by the remote marketplace backend when available.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2PluginInstalledResponse__PluginSummary" }); + +export type V2PluginListResponse__PluginSummary = { + readonly authPolicy: V2PluginListResponse__PluginAuthPolicy; + readonly availability?: V2PluginListResponse__PluginAvailability; + readonly enabled: boolean; + readonly id: string; + readonly installPolicy: V2PluginListResponse__PluginInstallPolicy; + readonly installPolicySource?: V2PluginListResponse__PluginInstallPolicySource | null; + readonly installed: boolean; + readonly interface?: V2PluginListResponse__PluginInterface | null; + readonly keywords?: ReadonlyArray; + readonly localVersion?: string | null; + readonly mustShowInstallationInterstitial?: boolean | null; + readonly name: string; + readonly remotePluginId?: string | null; + readonly shareContext?: V2PluginListResponse__PluginShareContext | null; + readonly source: V2PluginListResponse__PluginSource; + readonly version?: string | null; +}; +export const V2PluginListResponse__PluginSummary = Schema.Struct({ + authPolicy: V2PluginListResponse__PluginAuthPolicy, + availability: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2PluginListResponse__PluginAvailability, + ).annotate({ + description: "Availability state for installing and using the plugin.", + default: "AVAILABLE", + }), + ), + enabled: Schema.Boolean, + id: Schema.String, + installPolicy: V2PluginListResponse__PluginInstallPolicy, + installPolicySource: Schema.optionalKey( + Schema.Union([V2PluginListResponse__PluginInstallPolicySource, Schema.Null]), + ), + installed: Schema.Boolean, + interface: Schema.optionalKey(Schema.Union([V2PluginListResponse__PluginInterface, Schema.Null])), + keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + localVersion: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version of the locally materialized plugin package when available.", + }), + Schema.Null, + ]), + ), + mustShowInstallationInterstitial: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + name: Schema.String, + remotePluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Backend remote plugin identifier when available." }), + Schema.Null, + ]), + ), + shareContext: Schema.optionalKey( + Schema.Union([V2PluginListResponse__PluginShareContext, Schema.Null]).annotate({ + description: "Remote sharing context associated with this plugin when available.", + }), + ), + source: V2PluginListResponse__PluginSource, + version: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version advertised by the remote marketplace backend when available.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2PluginListResponse__PluginSummary" }); + +export type V2PluginReadResponse__PluginSummary = { + readonly authPolicy: V2PluginReadResponse__PluginAuthPolicy; + readonly availability?: V2PluginReadResponse__PluginAvailability; + readonly enabled: boolean; + readonly id: string; + readonly installPolicy: V2PluginReadResponse__PluginInstallPolicy; + readonly installPolicySource?: V2PluginReadResponse__PluginInstallPolicySource | null; + readonly installed: boolean; + readonly interface?: V2PluginReadResponse__PluginInterface | null; + readonly keywords?: ReadonlyArray; + readonly localVersion?: string | null; + readonly mustShowInstallationInterstitial?: boolean | null; + readonly name: string; + readonly remotePluginId?: string | null; + readonly shareContext?: V2PluginReadResponse__PluginShareContext | null; + readonly source: V2PluginReadResponse__PluginSource; + readonly version?: string | null; +}; +export const V2PluginReadResponse__PluginSummary = Schema.Struct({ + authPolicy: V2PluginReadResponse__PluginAuthPolicy, + availability: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2PluginReadResponse__PluginAvailability, + ).annotate({ + description: "Availability state for installing and using the plugin.", + default: "AVAILABLE", + }), + ), + enabled: Schema.Boolean, + id: Schema.String, + installPolicy: V2PluginReadResponse__PluginInstallPolicy, + installPolicySource: Schema.optionalKey( + Schema.Union([V2PluginReadResponse__PluginInstallPolicySource, Schema.Null]), + ), + installed: Schema.Boolean, + interface: Schema.optionalKey(Schema.Union([V2PluginReadResponse__PluginInterface, Schema.Null])), + keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + localVersion: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version of the locally materialized plugin package when available.", + }), + Schema.Null, + ]), + ), + mustShowInstallationInterstitial: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + name: Schema.String, + remotePluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Backend remote plugin identifier when available." }), + Schema.Null, + ]), + ), + shareContext: Schema.optionalKey( + Schema.Union([V2PluginReadResponse__PluginShareContext, Schema.Null]).annotate({ + description: "Remote sharing context associated with this plugin when available.", + }), + ), + source: V2PluginReadResponse__PluginSource, + version: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version advertised by the remote marketplace backend when available.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2PluginReadResponse__PluginSummary" }); + +export type V2PluginShareListResponse__PluginSummary = { + readonly authPolicy: V2PluginShareListResponse__PluginAuthPolicy; + readonly availability?: V2PluginShareListResponse__PluginAvailability; + readonly enabled: boolean; + readonly id: string; + readonly installPolicy: V2PluginShareListResponse__PluginInstallPolicy; + readonly installPolicySource?: V2PluginShareListResponse__PluginInstallPolicySource | null; + readonly installed: boolean; + readonly interface?: V2PluginShareListResponse__PluginInterface | null; + readonly keywords?: ReadonlyArray; + readonly localVersion?: string | null; + readonly mustShowInstallationInterstitial?: boolean | null; + readonly name: string; + readonly remotePluginId?: string | null; + readonly shareContext?: V2PluginShareListResponse__PluginShareContext | null; + readonly source: V2PluginShareListResponse__PluginSource; + readonly version?: string | null; +}; +export const V2PluginShareListResponse__PluginSummary = Schema.Struct({ + authPolicy: V2PluginShareListResponse__PluginAuthPolicy, + availability: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2PluginShareListResponse__PluginAvailability, + ).annotate({ + description: "Availability state for installing and using the plugin.", + default: "AVAILABLE", + }), + ), + enabled: Schema.Boolean, + id: Schema.String, + installPolicy: V2PluginShareListResponse__PluginInstallPolicy, + installPolicySource: Schema.optionalKey( + Schema.Union([V2PluginShareListResponse__PluginInstallPolicySource, Schema.Null]), + ), + installed: Schema.Boolean, + interface: Schema.optionalKey( + Schema.Union([V2PluginShareListResponse__PluginInterface, Schema.Null]), + ), + keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + localVersion: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version of the locally materialized plugin package when available.", + }), + Schema.Null, + ]), + ), + mustShowInstallationInterstitial: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + name: Schema.String, + remotePluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Backend remote plugin identifier when available." }), + Schema.Null, + ]), + ), + shareContext: Schema.optionalKey( + Schema.Union([V2PluginShareListResponse__PluginShareContext, Schema.Null]).annotate({ + description: "Remote sharing context associated with this plugin when available.", + }), + ), + source: V2PluginShareListResponse__PluginSource, + version: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Version advertised by the remote marketplace backend when available.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2PluginShareListResponse__PluginSummary" }); + +export type V2RawResponseItemCompletedNotification__ResponseItem = + | { + readonly content: ReadonlyArray; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly phase?: V2RawResponseItemCompletedNotification__MessagePhase | null; + readonly role: string; + readonly type: "message"; } - | { readonly id: string; readonly text: string; readonly type: "plan" } | { - readonly content?: ReadonlyArray; - readonly id: string; - readonly summary?: ReadonlyArray; + readonly author: string; + readonly content: ReadonlyArray; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly recipient: string; + readonly type: "agent_message"; + } + | { + readonly content?: ReadonlyArray | null; + readonly encrypted_content?: string | null; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly summary: ReadonlyArray; readonly type: "reasoning"; } | { - readonly aggregatedOutput?: string | null; - readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; - readonly durationMs?: number | null; - readonly exitCode?: number | null; - readonly id: string; - readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ThreadReadResponse__CommandExecutionStatus; - readonly type: "commandExecution"; + readonly action: V2RawResponseItemCompletedNotification__LocalShellAction; + readonly call_id?: string | null; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly status: V2RawResponseItemCompletedNotification__LocalShellStatus; + readonly type: "local_shell_call"; } | { - readonly changes: ReadonlyArray; - readonly id: string; - readonly status: V2ThreadReadResponse__PatchApplyStatus; - readonly type: "fileChange"; + readonly arguments: string; + readonly call_id: string; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly name: string; + readonly namespace?: string | null; + readonly type: "function_call"; } | { - readonly appContext?: V2ThreadReadResponse__McpToolCallAppContext | null; - readonly arguments: unknown; - readonly durationMs?: number | null; - readonly error?: V2ThreadReadResponse__McpToolCallError | null; - readonly id: string; - readonly mcpAppResourceUri?: string | null; - readonly pluginId?: string | null; - readonly result?: V2ThreadReadResponse__McpToolCallResult | null; - readonly server: string; - readonly status: V2ThreadReadResponse__McpToolCallStatus; - readonly tool: string; - readonly type: "mcpToolCall"; + readonly arguments: Schema.Json; + readonly call_id?: string | null; + readonly execution: string; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly status?: string | null; + readonly type: "tool_search_call"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; - readonly durationMs?: number | null; - readonly id: string; - readonly namespace?: string | null; - readonly status: V2ThreadReadResponse__DynamicToolCallStatus; - readonly success?: boolean | null; - readonly tool: string; - readonly type: "dynamicToolCall"; + readonly call_id: string; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody; + readonly type: "function_call_output"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadReadResponse__CollabAgentState }; - readonly id: string; - readonly model?: string | null; - readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadReadResponse__ReasoningEffort | null; - readonly receiverThreadIds: ReadonlyArray; - readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; - readonly type: "collabAgentToolCall"; + readonly call_id: string; + readonly id?: string | null; + readonly input: string; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly name: string; + readonly namespace?: string | null; + readonly status?: string | null; + readonly type: "custom_tool_call"; } | { - readonly agentPath: string; - readonly agentThreadId: string; - readonly id: string; - readonly kind: V2ThreadReadResponse__SubAgentActivityKind; - readonly type: "subAgentActivity"; + readonly call_id: string; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly name?: string | null; + readonly output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody; + readonly type: "custom_tool_call_output"; } | { - readonly action?: V2ThreadReadResponse__WebSearchAction | null; - readonly id: string; - readonly query: string; - readonly results?: ReadonlyArray | null; - readonly type: "webSearch"; + readonly call_id?: string | null; + readonly execution: string; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly status: string; + readonly tools: ReadonlyArray; + readonly type: "tool_search_output"; } | { - readonly id: string; - readonly path: V2ThreadReadResponse__LegacyAppPathString; - readonly type: "imageView"; + readonly action?: V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction | null; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly status?: string | null; + readonly type: "web_search_call"; } - | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { - readonly id: string; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; readonly result: string; - readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadReadResponse__AbsolutePathBuf | null; + readonly revised_prompt?: string | null; readonly status: string; - readonly type: "imageGeneration"; + readonly type: "image_generation_call"; } - | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } - | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } - | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadReadResponse__ThreadItem = Schema.Union( + | { + readonly encrypted_content: string; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly type: "compaction"; + } + | { readonly type: "compaction_trigger" } + | { + readonly encrypted_content?: string | null; + readonly id?: string | null; + readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly type: "context_compaction"; + } + | { readonly type: "other" }; +export const V2RawResponseItemCompletedNotification__ResponseItem = Schema.Union( [ Schema.Struct({ - clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadReadResponse__UserInput), - id: Schema.String, - type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), - }).annotate({ title: "UserMessageThreadItem" }), - Schema.Struct({ - fragments: Schema.Array(V2ThreadReadResponse__HookPromptFragment), - id: Schema.String, - type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), - }).annotate({ title: "HookPromptThreadItem" }), - Schema.Struct({ - id: Schema.String, - memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), - questions: Schema.optionalKey( + content: Schema.Array(V2RawResponseItemCompletedNotification__ContentItem), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, Schema.Null, ]), ), - type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), - }).annotate({ title: "AgentMessageThreadItem" }), - Schema.Struct({ - id: Schema.String, - text: Schema.String, - type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), - }).annotate({ - title: "PlanThreadItem", - description: - "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", - }), + phase: Schema.optionalKey( + Schema.Union([V2RawResponseItemCompletedNotification__MessagePhase, Schema.Null]), + ), + role: Schema.String, + type: Schema.Literal("message").annotate({ title: "MessageResponseItemType" }), + }).annotate({ title: "MessageResponseItem" }), Schema.Struct({ - content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - id: Schema.String, - summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), - }).annotate({ title: "ReasoningThreadItem" }), + author: Schema.String, + content: Schema.Array(V2RawResponseItemCompletedNotification__AgentMessageInputContent), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + recipient: Schema.String, + type: Schema.Literal("agent_message").annotate({ title: "AgentMessageResponseItemType" }), + }).annotate({ title: "AgentMessageResponseItem" }), Schema.Struct({ - aggregatedOutput: Schema.optionalKey( + content: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ - description: "The command's output, aggregated from stdout and stderr.", - }), + Schema.Array(V2RawResponseItemCompletedNotification__ReasoningItemContent), Schema.Null, ]), ), - command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadReadResponse__CommandAction).annotate({ - description: - "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", - }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), - durationMs: Schema.optionalKey( + encrypted_content: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the command execution in milliseconds.", - format: "int64", - }).check(Schema.isInt()), + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, Schema.Null, ]), ), - exitCode: Schema.optionalKey( + summary: Schema.Array(V2RawResponseItemCompletedNotification__ReasoningItemReasoningSummary), + type: Schema.Literal("reasoning").annotate({ title: "ReasoningResponseItemType" }), + }).annotate({ title: "ReasoningResponseItem" }), + Schema.Struct({ + action: V2RawResponseItemCompletedNotification__LocalShellAction, + call_id: Schema.optionalKey( Schema.Union([ - Schema.Number.annotate({ - description: "The command's exit code.", - format: "int32", - }).check(Schema.isInt()), + Schema.String.annotate({ description: "Set when using the Responses API." }), Schema.Null, ]), ), - id: Schema.String, - processId: Schema.optionalKey( + id: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Identifier for the underlying PTY process (when available).", + description: "Legacy id field retained for compatibility with older payloads.", }), Schema.Null, ]), ), - source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), ), - status: V2ThreadReadResponse__CommandExecutionStatus, - type: Schema.Literal("commandExecution").annotate({ - title: "CommandExecutionThreadItemType", + status: V2RawResponseItemCompletedNotification__LocalShellStatus, + type: Schema.Literal("local_shell_call").annotate({ + title: "LocalShellCallResponseItemType", }), - }).annotate({ title: "CommandExecutionThreadItem" }), + }).annotate({ title: "LocalShellCallResponseItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadReadResponse__FileUpdateChange), - id: Schema.String, - status: V2ThreadReadResponse__PatchApplyStatus, - type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), - }).annotate({ title: "FileChangeThreadItem" }), - Schema.Struct({ - appContext: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__McpToolCallAppContext, Schema.Null]), - ), - arguments: Schema.Unknown, - durationMs: Schema.optionalKey( + arguments: Schema.String, + call_id: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the MCP tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, Schema.Null, ]), ), - error: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__McpToolCallError, Schema.Null]), - ), - id: Schema.String, - mcpAppResourceUri: Schema.optionalKey( + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("function_call").annotate({ title: "FunctionCallResponseItemType" }), + }).annotate({ title: "FunctionCallResponseItem" }), + Schema.Struct({ + arguments: Schema.Json.annotate({ expected: "JSON value" }), + call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + execution: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", - }), + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, Schema.Null, ]), ), - pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - result: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__McpToolCallResult, Schema.Null]), - ), - server: Schema.String, - status: V2ThreadReadResponse__McpToolCallStatus, - tool: Schema.String, - type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), - }).annotate({ title: "McpToolCallThreadItem" }), + status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("tool_search_call").annotate({ + title: "ToolSearchCallResponseItemType", + }), + }).annotate({ title: "ToolSearchCallResponseItem" }), Schema.Struct({ - arguments: Schema.Unknown, - contentItems: Schema.optionalKey( + call_id: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadReadResponse__DynamicToolCallOutputContentItem), + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, Schema.Null, ]), ), - durationMs: Schema.optionalKey( + output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody, + type: Schema.Literal("function_call_output").annotate({ + title: "FunctionCallOutputResponseItemType", + }), + }).annotate({ title: "FunctionCallOutputResponseItem" }), + Schema.Struct({ + call_id: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + input: Schema.String, + internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - Schema.Number.annotate({ - description: "The duration of the dynamic tool call in milliseconds.", - format: "int64", - }).check(Schema.isInt()), + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, Schema.Null, ]), ), - id: Schema.String, + name: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadReadResponse__DynamicToolCallStatus, - success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - tool: Schema.String, - type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), - }).annotate({ title: "DynamicToolCallThreadItem" }), - Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadReadResponse__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", + status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("custom_tool_call").annotate({ + title: "CustomToolCallResponseItemType", }), - id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), - model: Schema.optionalKey( + }).annotate({ title: "CustomToolCallResponseItem" }), + Schema.Struct({ + call_id: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ - description: "Model requested for the spawned agent, when applicable.", - }), + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, Schema.Null, ]), ), - prompt: Schema.optionalKey( + name: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody, + type: Schema.Literal("custom_tool_call_output").annotate({ + title: "CustomToolCallOutputResponseItemType", + }), + }).annotate({ title: "CustomToolCallOutputResponseItem" }), + Schema.Struct({ + call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + execution: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ - description: "Prompt text sent as part of the collab tool call, when available.", - }), + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, Schema.Null, ]), ), - reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__ReasoningEffort, Schema.Null]).annotate({ - description: "Reasoning effort requested for the spawned agent, when applicable.", - }), - ), - receiverThreadIds: Schema.Array(Schema.String).annotate({ - description: - "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", - }), - senderThreadId: Schema.String.annotate({ - description: "Thread ID of the agent issuing the collab request.", - }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), - type: Schema.Literal("collabAgentToolCall").annotate({ - title: "CollabAgentToolCallThreadItemType", - }), - }).annotate({ title: "CollabAgentToolCallThreadItem" }), - Schema.Struct({ - agentPath: Schema.String, - agentThreadId: Schema.String, - id: Schema.String, - kind: V2ThreadReadResponse__SubAgentActivityKind, - type: Schema.Literal("subAgentActivity").annotate({ - title: "SubAgentActivityThreadItemType", + status: Schema.String, + tools: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + type: Schema.Literal("tool_search_output").annotate({ + title: "ToolSearchOutputResponseItemType", }), - }).annotate({ title: "SubAgentActivityThreadItem" }), + }).annotate({ title: "ToolSearchOutputResponseItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__WebSearchAction, Schema.Null]), + Schema.Union([ + V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction, + Schema.Null, + ]), ), - id: Schema.String, - query: Schema.String, - results: Schema.optionalKey( + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ - description: - "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", - }), + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, Schema.Null, ]), ), - type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), - }).annotate({ title: "WebSearchThreadItem" }), - Schema.Struct({ - id: Schema.String, - path: V2ThreadReadResponse__LegacyAppPathString, - type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), - }).annotate({ title: "ImageViewThreadItem" }), - Schema.Struct({ - durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - id: Schema.String, - type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), - }).annotate({ - title: "SleepThreadItem", - description: "Display item emitted by the interruptible `clock.sleep` tool.", - }), + status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("web_search_call").annotate({ title: "WebSearchCallResponseItemType" }), + }).annotate({ title: "WebSearchCallResponseItem" }), Schema.Struct({ - id: Schema.String, - result: Schema.String, - revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - savedPath: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__AbsolutePathBuf, Schema.Null]), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), ), + result: Schema.String, + revised_prompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), status: Schema.String, - type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), - }).annotate({ title: "ImageGenerationThreadItem" }), - Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("enteredReviewMode").annotate({ - title: "EnteredReviewModeThreadItemType", + type: Schema.Literal("image_generation_call").annotate({ + title: "ImageGenerationCallResponseItemType", }), - }).annotate({ title: "EnteredReviewModeThreadItem" }), + }).annotate({ title: "ImageGenerationCallResponseItem" }), Schema.Struct({ - id: Schema.String, - review: Schema.String, - type: Schema.Literal("exitedReviewMode").annotate({ - title: "ExitedReviewModeThreadItemType", + encrypted_content: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + type: Schema.Literal("compaction").annotate({ title: "CompactionResponseItemType" }), + }).annotate({ title: "CompactionResponseItem" }), + Schema.Struct({ + type: Schema.Literal("compaction_trigger").annotate({ + title: "CompactionTriggerResponseItemType", }), - }).annotate({ title: "ExitedReviewModeThreadItem" }), + }).annotate({ title: "CompactionTriggerResponseItem" }), Schema.Struct({ - id: Schema.String, - type: Schema.Literal("contextCompaction").annotate({ - title: "ContextCompactionThreadItemType", + encrypted_content: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + type: Schema.Literal("context_compaction").annotate({ + title: "ContextCompactionResponseItemType", }), - }).annotate({ title: "ContextCompactionThreadItem" }), + }).annotate({ title: "ContextCompactionResponseItem" }), + Schema.Struct({ + type: Schema.Literal("other").annotate({ title: "OtherResponseItemType" }), + }).annotate({ title: "OtherResponseItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2RawResponseItemCompletedNotification__ResponseItem" }); -export type V2ThreadResumeParams__FunctionCallOutputBody = - | string - | ReadonlyArray; -export const V2ThreadResumeParams__FunctionCallOutputBody = Schema.Union([ - Schema.String, - Schema.Array(V2ThreadResumeParams__FunctionCallOutputContentItem), -]); - -export type V2ThreadResumeResponse__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadResumeResponse__CodexErrorInfo | null; - readonly message: string; -}; -export const V2ThreadResumeResponse__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); - -export type V2ThreadResumeResponse__ThreadItem = +export type V2ReviewStartResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2ThreadResumeResponse__MemoryCitation | null; - readonly phase?: V2ThreadResumeResponse__MessagePhase | null; + readonly memoryCitation?: V2ReviewStartResponse__MemoryCitation | null; + readonly phase?: V2ReviewStartResponse__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -24908,85 +27957,76 @@ export type V2ThreadResumeResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ReviewStartResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ThreadResumeResponse__CommandExecutionStatus; + readonly source?: V2ReviewStartResponse__CommandExecutionSource; + readonly status: V2ReviewStartResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadResumeResponse__PatchApplyStatus; + readonly status: V2ReviewStartResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadResumeResponse__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ReviewStartResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadResumeResponse__McpToolCallError | null; + readonly error?: V2ReviewStartResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2ThreadResumeResponse__McpToolCallResult | null; + readonly result?: V2ReviewStartResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadResumeResponse__McpToolCallStatus; + readonly status: V2ReviewStartResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadResumeResponse__DynamicToolCallStatus; + readonly status: V2ReviewStartResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadResumeResponse__CollabAgentState }; + readonly agentsStates: { readonly [x: string]: V2ReviewStartResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadResumeResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ReviewStartResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ReviewStartResponse__CollabAgentToolCallStatus; + readonly tool: V2ReviewStartResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadResumeResponse__SubAgentActivityKind; + readonly kind: V2ReviewStartResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadResumeResponse__WebSearchAction | null; + readonly action?: V2ReviewStartResponse__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2ThreadResumeResponse__LegacyAppPathString; + readonly path: V2ReviewStartResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -24994,32 +28034,32 @@ export type V2ThreadResumeResponse__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadResumeResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ReviewStartResponse__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadResumeResponse__ThreadItem = Schema.Union( +export const V2ReviewStartResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadResumeResponse__UserInput), + content: Schema.Array(V2ReviewStartResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadResumeResponse__HookPromptFragment), + fragments: Schema.Array(V2ReviewStartResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ReviewStartResponse__MemoryCitation, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__MessagePhase, Schema.Null])), + phase: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__MessagePhase, Schema.Null])), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( @@ -25060,17 +28100,20 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadResumeResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ReviewStartResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ReviewStartResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -25079,7 +28122,7 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -25093,40 +28136,38 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ReviewStartResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2ThreadResumeResponse__CommandExecutionStatus, + status: V2ReviewStartResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadResumeResponse__FileUpdateChange), + changes: Schema.Array(V2ReviewStartResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadResumeResponse__PatchApplyStatus, + status: V2ReviewStartResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ReviewStartResponse__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ReviewStartResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( @@ -25139,18 +28180,18 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ReviewStartResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadResumeResponse__McpToolCallStatus, + status: V2ReviewStartResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadResumeResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ReviewStartResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -25159,21 +28200,21 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadResumeResponse__DynamicToolCallStatus, + status: V2ReviewStartResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadResumeResponse__CollabAgentState).annotate( - { description: "Last known status of the target agents, when available." }, - ), + agentsStates: Schema.Record(Schema.String, V2ReviewStartResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -25192,7 +28233,7 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ReviewStartResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -25203,20 +28244,14 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ReviewStartResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ReviewStartResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -25225,20 +28260,20 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadResumeResponse__SubAgentActivityKind, + kind: V2ReviewStartResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ReviewStartResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -25249,13 +28284,17 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadResumeResponse__LegacyAppPathString, + path: V2ReviewStartResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -25267,7 +28306,7 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ReviewStartResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -25294,37 +28333,35 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ReviewStartResponse__ThreadItem" }); -export type V2ThreadRollbackResponse__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadRollbackResponse__CodexErrorInfo | null; - readonly message: string; +export type V2SkillsListResponse__SkillsListEntry = { + readonly cwd: string; + readonly errors: ReadonlyArray; + readonly skills: ReadonlyArray; }; -export const V2ThreadRollbackResponse__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); +export const V2SkillsListResponse__SkillsListEntry = Schema.Struct({ + cwd: Schema.String, + errors: Schema.Array(V2SkillsListResponse__SkillErrorInfo), + skills: Schema.Array(V2SkillsListResponse__SkillMetadata), +}).annotate({ identifier: "V2SkillsListResponse__SkillsListEntry" }); -export type V2ThreadRollbackResponse__ThreadItem = +export type V2ThreadForkResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2ThreadRollbackResponse__MemoryCitation | null; - readonly phase?: V2ThreadRollbackResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadForkResponse__MemoryCitation | null; + readonly phase?: V2ThreadForkResponse__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -25343,85 +28380,76 @@ export type V2ThreadRollbackResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadForkResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ThreadRollbackResponse__CommandExecutionStatus; + readonly source?: V2ThreadForkResponse__CommandExecutionSource; + readonly status: V2ThreadForkResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadRollbackResponse__PatchApplyStatus; + readonly status: V2ThreadForkResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadRollbackResponse__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ThreadForkResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadRollbackResponse__McpToolCallError | null; + readonly error?: V2ThreadForkResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2ThreadRollbackResponse__McpToolCallResult | null; + readonly result?: V2ThreadForkResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadRollbackResponse__McpToolCallStatus; + readonly status: V2ThreadForkResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadRollbackResponse__DynamicToolCallStatus; + readonly status: V2ThreadForkResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadRollbackResponse__CollabAgentState }; + readonly agentsStates: { readonly [x: string]: V2ThreadForkResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadRollbackResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadForkResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ThreadForkResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadForkResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadRollbackResponse__SubAgentActivityKind; + readonly kind: V2ThreadForkResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadRollbackResponse__WebSearchAction | null; + readonly action?: V2ThreadForkResponse__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2ThreadRollbackResponse__LegacyAppPathString; + readonly path: V2ThreadForkResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -25429,34 +28457,32 @@ export type V2ThreadRollbackResponse__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadRollbackResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadForkResponse__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( +export const V2ThreadForkResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadRollbackResponse__UserInput), + content: Schema.Array(V2ThreadForkResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadRollbackResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadForkResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__MessagePhase, Schema.Null]), + Schema.Union([V2ThreadForkResponse__MemoryCitation, Schema.Null]), ), + phase: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__MessagePhase, Schema.Null])), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( @@ -25497,17 +28523,20 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadRollbackResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadForkResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -25516,7 +28545,7 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -25530,40 +28559,38 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2ThreadRollbackResponse__CommandExecutionStatus, + status: V2ThreadForkResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadRollbackResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadForkResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadRollbackResponse__PatchApplyStatus, + status: V2ThreadForkResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadForkResponse__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadForkResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( @@ -25576,18 +28603,18 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadForkResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadRollbackResponse__McpToolCallStatus, + status: V2ThreadForkResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadRollbackResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadForkResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -25596,22 +28623,21 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadRollbackResponse__DynamicToolCallStatus, + status: V2ThreadForkResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record( - Schema.String, - V2ThreadRollbackResponse__CollabAgentState, - ).annotate({ description: "Last known status of the target agents, when available." }), + agentsStates: Schema.Record(Schema.String, V2ThreadForkResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -25630,7 +28656,7 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadForkResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -25641,20 +28667,14 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -25663,20 +28683,20 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadRollbackResponse__SubAgentActivityKind, + kind: V2ThreadForkResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadForkResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -25687,13 +28707,17 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadRollbackResponse__LegacyAppPathString, + path: V2ThreadForkResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -25705,7 +28729,7 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadForkResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -25732,46 +28756,24 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); - -export type V2ThreadSettingsUpdatedNotification__CollaborationMode = { - readonly mode: V2ThreadSettingsUpdatedNotification__ModeKind; - readonly settings: V2ThreadSettingsUpdatedNotification__Settings; -}; -export const V2ThreadSettingsUpdatedNotification__CollaborationMode = Schema.Struct({ - mode: V2ThreadSettingsUpdatedNotification__ModeKind, - settings: V2ThreadSettingsUpdatedNotification__Settings, -}).annotate({ description: "Collaboration mode for a Codex session." }); +).annotate({ identifier: "V2ThreadForkResponse__ThreadItem" }); -export type V2ThreadStartedNotification__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadStartedNotification__CodexErrorInfo | null; - readonly message: string; -}; -export const V2ThreadStartedNotification__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); - -export type V2ThreadStartedNotification__ThreadItem = +export type V2ThreadListResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2ThreadStartedNotification__MemoryCitation | null; - readonly phase?: V2ThreadStartedNotification__MessagePhase | null; + readonly memoryCitation?: V2ThreadListResponse__MemoryCitation | null; + readonly phase?: V2ThreadListResponse__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -25790,87 +28792,76 @@ export type V2ThreadStartedNotification__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadListResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ThreadStartedNotification__CommandExecutionStatus; + readonly source?: V2ThreadListResponse__CommandExecutionSource; + readonly status: V2ThreadListResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadStartedNotification__PatchApplyStatus; + readonly status: V2ThreadListResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadStartedNotification__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ThreadListResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadStartedNotification__McpToolCallError | null; + readonly error?: V2ThreadListResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2ThreadStartedNotification__McpToolCallResult | null; + readonly result?: V2ThreadListResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadStartedNotification__McpToolCallStatus; + readonly status: V2ThreadListResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadStartedNotification__DynamicToolCallStatus; + readonly status: V2ThreadListResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { - readonly [x: string]: V2ThreadStartedNotification__CollabAgentState; - }; + readonly agentsStates: { readonly [x: string]: V2ThreadListResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadStartedNotification__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadListResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ThreadListResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadListResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadStartedNotification__SubAgentActivityKind; + readonly kind: V2ThreadListResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadStartedNotification__WebSearchAction | null; + readonly action?: V2ThreadListResponse__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2ThreadStartedNotification__LegacyAppPathString; + readonly path: V2ThreadListResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -25878,34 +28869,32 @@ export type V2ThreadStartedNotification__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadStartedNotification__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadListResponse__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadStartedNotification__ThreadItem = Schema.Union( +export const V2ThreadListResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadStartedNotification__UserInput), + content: Schema.Array(V2ThreadListResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadStartedNotification__HookPromptFragment), + fragments: Schema.Array(V2ThreadListResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__MessagePhase, Schema.Null]), + Schema.Union([V2ThreadListResponse__MemoryCitation, Schema.Null]), ), + phase: Schema.optionalKey(Schema.Union([V2ThreadListResponse__MessagePhase, Schema.Null])), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( @@ -25946,17 +28935,20 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadStartedNotification__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadListResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadListResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -25965,7 +28957,7 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -25979,40 +28971,38 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ThreadListResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2ThreadStartedNotification__CommandExecutionStatus, + status: V2ThreadListResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadStartedNotification__FileUpdateChange), + changes: Schema.Array(V2ThreadListResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadStartedNotification__PatchApplyStatus, + status: V2ThreadListResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadListResponse__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadListResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( @@ -26025,18 +29015,18 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadListResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadStartedNotification__McpToolCallStatus, + status: V2ThreadListResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadStartedNotification__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadListResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -26045,22 +29035,21 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadStartedNotification__DynamicToolCallStatus, + status: V2ThreadListResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record( - Schema.String, - V2ThreadStartedNotification__CollabAgentState, - ).annotate({ description: "Last known status of the target agents, when available." }), + agentsStates: Schema.Record(Schema.String, V2ThreadListResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -26079,7 +29068,7 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadListResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -26090,20 +29079,14 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadListResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadListResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -26112,20 +29095,20 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadStartedNotification__SubAgentActivityKind, + kind: V2ThreadListResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadListResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -26136,13 +29119,17 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadStartedNotification__LegacyAppPathString, + path: V2ThreadListResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -26154,7 +29141,7 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadListResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -26181,37 +29168,24 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadListResponse__ThreadItem" }); -export type V2ThreadStartResponse__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadStartResponse__CodexErrorInfo | null; - readonly message: string; -}; -export const V2ThreadStartResponse__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); - -export type V2ThreadStartResponse__ThreadItem = +export type V2ThreadMetadataUpdateResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2ThreadStartResponse__MemoryCitation | null; - readonly phase?: V2ThreadStartResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadMetadataUpdateResponse__MemoryCitation | null; + readonly phase?: V2ThreadMetadataUpdateResponse__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -26230,85 +29204,78 @@ export type V2ThreadStartResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadMetadataUpdateResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ThreadStartResponse__CommandExecutionStatus; + readonly source?: V2ThreadMetadataUpdateResponse__CommandExecutionSource; + readonly status: V2ThreadMetadataUpdateResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadStartResponse__PatchApplyStatus; + readonly status: V2ThreadMetadataUpdateResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadStartResponse__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ThreadMetadataUpdateResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadStartResponse__McpToolCallError | null; + readonly error?: V2ThreadMetadataUpdateResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2ThreadStartResponse__McpToolCallResult | null; + readonly result?: V2ThreadMetadataUpdateResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadStartResponse__McpToolCallStatus; + readonly status: V2ThreadMetadataUpdateResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadStartResponse__DynamicToolCallStatus; + readonly status: V2ThreadMetadataUpdateResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadStartResponse__CollabAgentState }; + readonly agentsStates: { + readonly [x: string]: V2ThreadMetadataUpdateResponse__CollabAgentState; + }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadStartResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadMetadataUpdateResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadMetadataUpdateResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadStartResponse__SubAgentActivityKind; + readonly kind: V2ThreadMetadataUpdateResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadStartResponse__WebSearchAction | null; + readonly action?: V2ThreadMetadataUpdateResponse__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2ThreadStartResponse__LegacyAppPathString; + readonly path: V2ThreadMetadataUpdateResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -26316,32 +29283,34 @@ export type V2ThreadStartResponse__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadStartResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadMetadataUpdateResponse__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadStartResponse__ThreadItem = Schema.Union( +export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadStartResponse__UserInput), + content: Schema.Array(V2ThreadMetadataUpdateResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadStartResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadMetadataUpdateResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__MessagePhase, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__MessagePhase, Schema.Null])), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( @@ -26382,17 +29351,20 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadStartResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadMetadataUpdateResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -26401,7 +29373,7 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -26415,40 +29387,38 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2ThreadStartResponse__CommandExecutionStatus, + status: V2ThreadMetadataUpdateResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadStartResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadMetadataUpdateResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadStartResponse__PatchApplyStatus, + status: V2ThreadMetadataUpdateResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( @@ -26461,18 +29431,18 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadStartResponse__McpToolCallStatus, + status: V2ThreadMetadataUpdateResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadStartResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadMetadataUpdateResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -26481,21 +29451,22 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadStartResponse__DynamicToolCallStatus, + status: V2ThreadMetadataUpdateResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadStartResponse__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", - }), + agentsStates: Schema.Record( + Schema.String, + V2ThreadMetadataUpdateResponse__CollabAgentState, + ).annotate({ description: "Last known status of the target agents, when available." }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -26514,7 +29485,7 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadMetadataUpdateResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -26525,20 +29496,14 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -26547,20 +29512,20 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadStartResponse__SubAgentActivityKind, + kind: V2ThreadMetadataUpdateResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -26571,13 +29536,17 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadStartResponse__LegacyAppPathString, + path: V2ThreadMetadataUpdateResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -26589,7 +29558,7 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -26616,37 +29585,24 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); - -export type V2ThreadUnarchiveResponse__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadUnarchiveResponse__CodexErrorInfo | null; - readonly message: string; -}; -export const V2ThreadUnarchiveResponse__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ThreadItem" }); -export type V2ThreadUnarchiveResponse__ThreadItem = +export type V2ThreadReadResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2ThreadUnarchiveResponse__MemoryCitation | null; - readonly phase?: V2ThreadUnarchiveResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadReadResponse__MemoryCitation | null; + readonly phase?: V2ThreadReadResponse__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -26665,85 +29621,76 @@ export type V2ThreadUnarchiveResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadReadResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2ThreadUnarchiveResponse__CommandExecutionStatus; + readonly source?: V2ThreadReadResponse__CommandExecutionSource; + readonly status: V2ThreadReadResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadUnarchiveResponse__PatchApplyStatus; + readonly status: V2ThreadReadResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadUnarchiveResponse__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ThreadReadResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadUnarchiveResponse__McpToolCallError | null; + readonly error?: V2ThreadReadResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2ThreadUnarchiveResponse__McpToolCallResult | null; + readonly result?: V2ThreadReadResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadUnarchiveResponse__McpToolCallStatus; + readonly status: V2ThreadReadResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadUnarchiveResponse__DynamicToolCallStatus; + readonly status: V2ThreadReadResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadUnarchiveResponse__CollabAgentState }; + readonly agentsStates: { readonly [x: string]: V2ThreadReadResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadUnarchiveResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadReadResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ThreadReadResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadReadResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadUnarchiveResponse__SubAgentActivityKind; + readonly kind: V2ThreadReadResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadUnarchiveResponse__WebSearchAction | null; + readonly action?: V2ThreadReadResponse__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2ThreadUnarchiveResponse__LegacyAppPathString; + readonly path: V2ThreadReadResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -26751,34 +29698,32 @@ export type V2ThreadUnarchiveResponse__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadUnarchiveResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadReadResponse__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( +export const V2ThreadReadResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadUnarchiveResponse__UserInput), + content: Schema.Array(V2ThreadReadResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadUnarchiveResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadReadResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__MessagePhase, Schema.Null]), + Schema.Union([V2ThreadReadResponse__MemoryCitation, Schema.Null]), ), + phase: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__MessagePhase, Schema.Null])), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( @@ -26819,17 +29764,20 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadUnarchiveResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadReadResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadReadResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -26838,7 +29786,7 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -26852,40 +29800,38 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ThreadReadResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2ThreadUnarchiveResponse__CommandExecutionStatus, + status: V2ThreadReadResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadUnarchiveResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadReadResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadUnarchiveResponse__PatchApplyStatus, + status: V2ThreadReadResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadReadResponse__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadReadResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( @@ -26898,18 +29844,18 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadReadResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadUnarchiveResponse__McpToolCallStatus, + status: V2ThreadReadResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadReadResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -26918,22 +29864,21 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadUnarchiveResponse__DynamicToolCallStatus, + status: V2ThreadReadResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record( - Schema.String, - V2ThreadUnarchiveResponse__CollabAgentState, - ).annotate({ description: "Last known status of the target agents, when available." }), + agentsStates: Schema.Record(Schema.String, V2ThreadReadResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -26952,7 +29897,7 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadReadResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -26963,20 +29908,14 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadReadResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadReadResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -26985,20 +29924,20 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadUnarchiveResponse__SubAgentActivityKind, + kind: V2ThreadReadResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadReadResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -27009,13 +29948,17 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadUnarchiveResponse__LegacyAppPathString, + path: V2ThreadReadResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -27027,7 +29970,7 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadReadResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -27054,37 +29997,24 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadReadResponse__ThreadItem" }); -export type V2TurnCompletedNotification__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2TurnCompletedNotification__CodexErrorInfo | null; - readonly message: string; -}; -export const V2TurnCompletedNotification__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); - -export type V2TurnCompletedNotification__ThreadItem = +export type V2ThreadResumeResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2TurnCompletedNotification__MemoryCitation | null; - readonly phase?: V2TurnCompletedNotification__MessagePhase | null; + readonly memoryCitation?: V2ThreadResumeResponse__MemoryCitation | null; + readonly phase?: V2ThreadResumeResponse__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -27103,87 +30033,76 @@ export type V2TurnCompletedNotification__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadResumeResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2TurnCompletedNotification__CommandExecutionStatus; + readonly source?: V2ThreadResumeResponse__CommandExecutionSource; + readonly status: V2ThreadResumeResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2TurnCompletedNotification__PatchApplyStatus; + readonly status: V2ThreadResumeResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2TurnCompletedNotification__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ThreadResumeResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2TurnCompletedNotification__McpToolCallError | null; + readonly error?: V2ThreadResumeResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2TurnCompletedNotification__McpToolCallResult | null; + readonly result?: V2ThreadResumeResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2TurnCompletedNotification__McpToolCallStatus; + readonly status: V2ThreadResumeResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2TurnCompletedNotification__DynamicToolCallStatus; + readonly status: V2ThreadResumeResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { - readonly [x: string]: V2TurnCompletedNotification__CollabAgentState; - }; + readonly agentsStates: { readonly [x: string]: V2ThreadResumeResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2TurnCompletedNotification__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadResumeResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ThreadResumeResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadResumeResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2TurnCompletedNotification__SubAgentActivityKind; + readonly kind: V2ThreadResumeResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2TurnCompletedNotification__WebSearchAction | null; + readonly action?: V2ThreadResumeResponse__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2TurnCompletedNotification__LegacyAppPathString; + readonly path: V2ThreadResumeResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -27191,34 +30110,32 @@ export type V2TurnCompletedNotification__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2TurnCompletedNotification__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadResumeResponse__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2TurnCompletedNotification__ThreadItem = Schema.Union( +export const V2ThreadResumeResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2TurnCompletedNotification__UserInput), + content: Schema.Array(V2ThreadResumeResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2TurnCompletedNotification__HookPromptFragment), + fragments: Schema.Array(V2ThreadResumeResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__MessagePhase, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__MemoryCitation, Schema.Null]), ), + phase: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__MessagePhase, Schema.Null])), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( @@ -27259,17 +30176,20 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2TurnCompletedNotification__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadResumeResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -27278,7 +30198,7 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -27292,40 +30212,38 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2TurnCompletedNotification__CommandExecutionStatus, + status: V2ThreadResumeResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2TurnCompletedNotification__FileUpdateChange), + changes: Schema.Array(V2ThreadResumeResponse__FileUpdateChange), id: Schema.String, - status: V2TurnCompletedNotification__PatchApplyStatus, + status: V2ThreadResumeResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), error: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( @@ -27338,18 +30256,18 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2TurnCompletedNotification__McpToolCallStatus, + status: V2ThreadResumeResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2TurnCompletedNotification__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadResumeResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -27358,22 +30276,21 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2TurnCompletedNotification__DynamicToolCallStatus, + status: V2ThreadResumeResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record( - Schema.String, - V2TurnCompletedNotification__CollabAgentState, - ).annotate({ description: "Last known status of the target agents, when available." }), + agentsStates: Schema.Record(Schema.String, V2ThreadResumeResponse__CollabAgentState).annotate( + { description: "Last known status of the target agents, when available." }, + ), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -27392,7 +30309,7 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadResumeResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -27403,20 +30320,14 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -27425,20 +30336,20 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2TurnCompletedNotification__SubAgentActivityKind, + kind: V2ThreadResumeResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -27449,13 +30360,17 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2TurnCompletedNotification__LegacyAppPathString, + path: V2ThreadResumeResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -27467,7 +30382,7 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -27494,37 +30409,24 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadResumeResponse__ThreadItem" }); -export type V2TurnStartedNotification__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2TurnStartedNotification__CodexErrorInfo | null; - readonly message: string; -}; -export const V2TurnStartedNotification__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}); - -export type V2TurnStartedNotification__ThreadItem = +export type V2ThreadRollbackResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2TurnStartedNotification__MemoryCitation | null; - readonly phase?: V2TurnStartedNotification__MessagePhase | null; + readonly memoryCitation?: V2ThreadRollbackResponse__MemoryCitation | null; + readonly phase?: V2ThreadRollbackResponse__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -27543,85 +30445,76 @@ export type V2TurnStartedNotification__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadRollbackResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2TurnStartedNotification__CommandExecutionStatus; + readonly source?: V2ThreadRollbackResponse__CommandExecutionSource; + readonly status: V2ThreadRollbackResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2TurnStartedNotification__PatchApplyStatus; + readonly status: V2ThreadRollbackResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2TurnStartedNotification__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ThreadRollbackResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2TurnStartedNotification__McpToolCallError | null; + readonly error?: V2ThreadRollbackResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2TurnStartedNotification__McpToolCallResult | null; + readonly result?: V2ThreadRollbackResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2TurnStartedNotification__McpToolCallStatus; + readonly status: V2ThreadRollbackResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2TurnStartedNotification__DynamicToolCallStatus; + readonly status: V2ThreadRollbackResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2TurnStartedNotification__CollabAgentState }; + readonly agentsStates: { readonly [x: string]: V2ThreadRollbackResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2TurnStartedNotification__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadRollbackResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ThreadRollbackResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadRollbackResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2TurnStartedNotification__SubAgentActivityKind; + readonly kind: V2ThreadRollbackResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2TurnStartedNotification__WebSearchAction | null; + readonly action?: V2ThreadRollbackResponse__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2TurnStartedNotification__LegacyAppPathString; + readonly path: V2ThreadRollbackResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -27629,33 +30522,33 @@ export type V2TurnStartedNotification__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2TurnStartedNotification__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadRollbackResponse__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2TurnStartedNotification__ThreadItem = Schema.Union( +export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2TurnStartedNotification__UserInput), + content: Schema.Array(V2ThreadRollbackResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2TurnStartedNotification__HookPromptFragment), + fragments: Schema.Array(V2ThreadRollbackResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadRollbackResponse__MemoryCitation, Schema.Null]), ), phase: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__MessagePhase, Schema.Null]), + Schema.Union([V2ThreadRollbackResponse__MessagePhase, Schema.Null]), ), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), @@ -27697,17 +30590,20 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2TurnStartedNotification__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadRollbackResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadRollbackResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -27716,7 +30612,7 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -27730,40 +30626,38 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ThreadRollbackResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2TurnStartedNotification__CommandExecutionStatus, + status: V2ThreadRollbackResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2TurnStartedNotification__FileUpdateChange), + changes: Schema.Array(V2ThreadRollbackResponse__FileUpdateChange), id: Schema.String, - status: V2TurnStartedNotification__PatchApplyStatus, + status: V2ThreadRollbackResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadRollbackResponse__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), error: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadRollbackResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( @@ -27776,18 +30670,18 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadRollbackResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2TurnStartedNotification__McpToolCallStatus, + status: V2ThreadRollbackResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2TurnStartedNotification__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadRollbackResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -27796,13 +30690,13 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2TurnStartedNotification__DynamicToolCallStatus, + status: V2ThreadRollbackResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), @@ -27810,7 +30704,7 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( Schema.Struct({ agentsStates: Schema.Record( Schema.String, - V2TurnStartedNotification__CollabAgentState, + V2ThreadRollbackResponse__CollabAgentState, ).annotate({ description: "Last known status of the target agents, when available." }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( @@ -27830,7 +30724,7 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadRollbackResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -27841,20 +30735,14 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadRollbackResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadRollbackResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -27863,20 +30751,20 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2TurnStartedNotification__SubAgentActivityKind, + kind: V2ThreadRollbackResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadRollbackResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -27887,13 +30775,17 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2TurnStartedNotification__LegacyAppPathString, + path: V2ThreadRollbackResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -27905,7 +30797,7 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadRollbackResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -27932,37 +30824,61 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadRollbackResponse__ThreadItem" }); -export type V2TurnStartResponse__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2TurnStartResponse__CodexErrorInfo | null; - readonly message: string; +export type V2ThreadSettingsUpdatedNotification__ThreadSettings = { + readonly activePermissionProfile?: V2ThreadSettingsUpdatedNotification__ActivePermissionProfile | null; + readonly approvalPolicy: V2ThreadSettingsUpdatedNotification__AskForApproval; + readonly approvalsReviewer: V2ThreadSettingsUpdatedNotification__ApprovalsReviewer; + readonly collaborationMode: V2ThreadSettingsUpdatedNotification__CollaborationMode; + readonly cwd: V2ThreadSettingsUpdatedNotification__AbsolutePathBuf; + readonly effort?: V2ThreadSettingsUpdatedNotification__ReasoningEffort | null; + readonly model: string; + readonly modelProvider: string; + readonly personality?: V2ThreadSettingsUpdatedNotification__Personality | null; + readonly sandboxPolicy: V2ThreadSettingsUpdatedNotification__SandboxPolicy; + readonly serviceTier?: string | null; + readonly summary?: V2ThreadSettingsUpdatedNotification__ReasoningSummary | null; }; -export const V2TurnStartResponse__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2TurnStartResponse__CodexErrorInfo, Schema.Null]), +export const V2ThreadSettingsUpdatedNotification__ThreadSettings = Schema.Struct({ + activePermissionProfile: Schema.optionalKey( + Schema.Union([V2ThreadSettingsUpdatedNotification__ActivePermissionProfile, Schema.Null]), ), - message: Schema.String, -}); + approvalPolicy: V2ThreadSettingsUpdatedNotification__AskForApproval, + approvalsReviewer: V2ThreadSettingsUpdatedNotification__ApprovalsReviewer, + collaborationMode: V2ThreadSettingsUpdatedNotification__CollaborationMode, + cwd: V2ThreadSettingsUpdatedNotification__AbsolutePathBuf, + effort: Schema.optionalKey( + Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningEffort, Schema.Null]), + ), + model: Schema.String, + modelProvider: Schema.String, + personality: Schema.optionalKey( + Schema.Union([V2ThreadSettingsUpdatedNotification__Personality, Schema.Null]), + ), + sandboxPolicy: V2ThreadSettingsUpdatedNotification__SandboxPolicy, + serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + summary: Schema.optionalKey( + Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningSummary, Schema.Null]), + ), +}).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__ThreadSettings" }); -export type V2TurnStartResponse__ThreadItem = +export type V2ThreadStartedNotification__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { readonly id: string; - readonly memoryCitation?: V2TurnStartResponse__MemoryCitation | null; - readonly phase?: V2TurnStartResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadStartedNotification__MemoryCitation | null; + readonly phase?: V2ThreadStartedNotification__MessagePhase | null; readonly text: string; readonly delivery?: "async" | null; readonly questions?: ReadonlyArray<{ @@ -27981,85 +30897,78 @@ export type V2TurnStartResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadStartedNotification__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; readonly processId?: string | null; - readonly source?: "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; - readonly status: V2TurnStartResponse__CommandExecutionStatus; + readonly source?: V2ThreadStartedNotification__CommandExecutionSource; + readonly status: V2ThreadStartedNotification__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2TurnStartResponse__PatchApplyStatus; + readonly status: V2ThreadStartedNotification__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2TurnStartResponse__McpToolCallAppContext | null; - readonly arguments: unknown; + readonly appContext?: V2ThreadStartedNotification__McpToolCallAppContext | null; + readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2TurnStartResponse__McpToolCallError | null; + readonly error?: V2ThreadStartedNotification__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; readonly pluginId?: string | null; - readonly result?: V2TurnStartResponse__McpToolCallResult | null; + readonly result?: V2ThreadStartedNotification__McpToolCallResult | null; readonly server: string; - readonly status: V2TurnStartResponse__McpToolCallStatus; + readonly status: V2ThreadStartedNotification__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { - readonly arguments: unknown; - readonly contentItems?: ReadonlyArray | null; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2TurnStartResponse__DynamicToolCallStatus; + readonly status: V2ThreadStartedNotification__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2TurnStartResponse__CollabAgentState }; + readonly agentsStates: { + readonly [x: string]: V2ThreadStartedNotification__CollabAgentState; + }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2TurnStartResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadStartedNotification__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: "inProgress" | "completed" | "failed" | "interrupted"; - readonly tool: - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; + readonly status: V2ThreadStartedNotification__CollabAgentToolCallStatus; + readonly tool: V2ThreadStartedNotification__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2TurnStartResponse__SubAgentActivityKind; + readonly kind: V2ThreadStartedNotification__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2TurnStartResponse__WebSearchAction | null; + readonly action?: V2ThreadStartedNotification__WebSearchAction | null; readonly id: string; readonly query: string; - readonly results?: ReadonlyArray | null; + readonly results?: ReadonlyArray | null; readonly type: "webSearch"; } | { readonly id: string; - readonly path: V2TurnStartResponse__LegacyAppPathString; + readonly path: V2ThreadStartedNotification__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } @@ -28067,32 +30976,34 @@ export type V2TurnStartResponse__ThreadItem = readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2TurnStartResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadStartedNotification__AbsolutePathBuf | null; readonly status: string; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2TurnStartResponse__ThreadItem = Schema.Union( +export const V2ThreadStartedNotification__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2TurnStartResponse__UserInput), + content: Schema.Array(V2ThreadStartedNotification__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2TurnStartResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadStartedNotification__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2TurnStartResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__MessagePhase, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2TurnStartResponse__MessagePhase, Schema.Null])), text: Schema.String, delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( @@ -28133,17 +31044,20 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2TurnStartResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadStartedNotification__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - cwd: Schema.String.annotate({ description: "The command's working directory." }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the command execution in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -28152,7 +31066,7 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The command's exit code.", format: "int32", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -28166,39 +31080,39 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( ]), ), source: Schema.optionalKey( - Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", - ]).annotate({ default: "agent" }), + Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2TurnStartResponse__CommandExecutionStatus, + status: V2ThreadStartedNotification__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2TurnStartResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadStartedNotification__FileUpdateChange), id: Schema.String, - status: V2TurnStartResponse__PatchApplyStatus, + status: V2ThreadStartedNotification__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2TurnStartResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__McpToolCallAppContext, Schema.Null]), ), - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The duration of the MCP tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - error: Schema.optionalKey(Schema.Union([V2TurnStartResponse__McpToolCallError, Schema.Null])), + error: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__McpToolCallError, Schema.Null]), + ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ @@ -28210,18 +31124,18 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2TurnStartResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2TurnStartResponse__McpToolCallStatus, + status: V2ThreadStartedNotification__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2TurnStartResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadStartedNotification__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -28230,21 +31144,22 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( Schema.Number.annotate({ description: "The duration of the dynamic tool call in milliseconds.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2TurnStartResponse__DynamicToolCallStatus, + status: V2ThreadStartedNotification__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2TurnStartResponse__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", - }), + agentsStates: Schema.Record( + Schema.String, + V2ThreadStartedNotification__CollabAgentState, + ).annotate({ description: "Last known status of the target agents, when available." }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -28263,7 +31178,7 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2TurnStartResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadStartedNotification__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -28274,20 +31189,14 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( senderThreadId: Schema.String.annotate({ description: "Thread ID of the agent issuing the collab request.", }), - status: Schema.Literals(["inProgress", "completed", "failed", "interrupted"]).annotate({ - description: "Current status of the collab tool call.", - }), - tool: Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ]).annotate({ description: "Name of the collab tool that was invoked." }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", }), @@ -28296,18 +31205,20 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2TurnStartResponse__SubAgentActivityKind, + kind: V2ThreadStartedNotification__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ - action: Schema.optionalKey(Schema.Union([V2TurnStartResponse__WebSearchAction, Schema.Null])), + action: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__WebSearchAction, Schema.Null]), + ), id: Schema.String, query: Schema.String, results: Schema.optionalKey( Schema.Union([ - Schema.Array(Schema.Unknown).annotate({ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", }), @@ -28318,13 +31229,17 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2TurnStartResponse__LegacyAppPathString, + path: V2ThreadStartedNotification__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ durationMs: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), id: Schema.String, type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), }).annotate({ @@ -28336,7 +31251,7 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2TurnStartResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), @@ -28363,1073 +31278,2583 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "V2ThreadStartedNotification__ThreadItem" }); -export type ClientRequest__ExternalAgentConfigImportParams = { - readonly migrationItems: ReadonlyArray; - readonly migrationSource?: string | null; - readonly source?: string | null; -}; -export const ClientRequest__ExternalAgentConfigImportParams = Schema.Struct({ - migrationItems: Schema.Array(ClientRequest__ExternalAgentConfigMigrationItem), - migrationSource: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ +export type V2ThreadStartResponse__ThreadItem = + | { + readonly clientId?: string | null; + readonly content: ReadonlyArray; + readonly id: string; + readonly type: "userMessage"; + } + | { + readonly fragments: ReadonlyArray; + readonly id: string; + readonly type: "hookPrompt"; + } + | { + readonly id: string; + readonly memoryCitation?: V2ThreadStartResponse__MemoryCitation | null; + readonly phase?: V2ThreadStartResponse__MessagePhase | null; + readonly text: string; + readonly delivery?: "async" | null; + readonly questions?: ReadonlyArray<{ + readonly title: string; + readonly options?: ReadonlyArray | null; + }> | null; + readonly type: "agentMessage"; + } + | { readonly id: string; readonly text: string; readonly type: "plan" } + | { + readonly content?: ReadonlyArray; + readonly id: string; + readonly summary?: ReadonlyArray; + readonly type: "reasoning"; + } + | { + readonly aggregatedOutput?: string | null; + readonly command: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadStartResponse__LegacyAppPathString; + readonly durationMs?: number | null; + readonly exitCode?: number | null; + readonly id: string; + readonly processId?: string | null; + readonly source?: V2ThreadStartResponse__CommandExecutionSource; + readonly status: V2ThreadStartResponse__CommandExecutionStatus; + readonly type: "commandExecution"; + } + | { + readonly changes: ReadonlyArray; + readonly id: string; + readonly status: V2ThreadStartResponse__PatchApplyStatus; + readonly type: "fileChange"; + } + | { + readonly appContext?: V2ThreadStartResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; + readonly durationMs?: number | null; + readonly error?: V2ThreadStartResponse__McpToolCallError | null; + readonly id: string; + readonly mcpAppResourceUri?: string | null; + readonly pluginId?: string | null; + readonly result?: V2ThreadStartResponse__McpToolCallResult | null; + readonly server: string; + readonly status: V2ThreadStartResponse__McpToolCallStatus; + readonly tool: string; + readonly type: "mcpToolCall"; + } + | { + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; + readonly durationMs?: number | null; + readonly id: string; + readonly namespace?: string | null; + readonly status: V2ThreadStartResponse__DynamicToolCallStatus; + readonly success?: boolean | null; + readonly tool: string; + readonly type: "dynamicToolCall"; + } + | { + readonly agentsStates: { readonly [x: string]: V2ThreadStartResponse__CollabAgentState }; + readonly id: string; + readonly model?: string | null; + readonly prompt?: string | null; + readonly reasoningEffort?: V2ThreadStartResponse__ReasoningEffort | null; + readonly receiverThreadIds: ReadonlyArray; + readonly senderThreadId: string; + readonly status: V2ThreadStartResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadStartResponse__CollabAgentTool; + readonly type: "collabAgentToolCall"; + } + | { + readonly agentPath: string; + readonly agentThreadId: string; + readonly id: string; + readonly kind: V2ThreadStartResponse__SubAgentActivityKind; + readonly type: "subAgentActivity"; + } + | { + readonly action?: V2ThreadStartResponse__WebSearchAction | null; + readonly id: string; + readonly query: string; + readonly results?: ReadonlyArray | null; + readonly type: "webSearch"; + } + | { + readonly id: string; + readonly path: V2ThreadStartResponse__LegacyAppPathString; + readonly type: "imageView"; + } + | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } + | { + readonly id: string; + readonly result: string; + readonly revisedPrompt?: string | null; + readonly savedPath?: V2ThreadStartResponse__AbsolutePathBuf | null; + readonly status: string; + readonly type: "imageGeneration"; + } + | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } + | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } + | { readonly id: string; readonly type: "contextCompaction" }; +export const V2ThreadStartResponse__ThreadItem = Schema.Union( + [ + Schema.Struct({ + clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + content: Schema.Array(V2ThreadStartResponse__UserInput), + id: Schema.String, + type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), + }).annotate({ title: "UserMessageThreadItem" }), + Schema.Struct({ + fragments: Schema.Array(V2ThreadStartResponse__HookPromptFragment), + id: Schema.String, + type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), + }).annotate({ title: "HookPromptThreadItem" }), + Schema.Struct({ + id: Schema.String, + memoryCitation: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__MessagePhase, Schema.Null])), + text: Schema.String, + delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + questions: Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Struct({ + title: Schema.String, + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), + }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + text: Schema.String, + type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), + }).annotate({ + title: "PlanThreadItem", + description: + "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", + }), + Schema.Struct({ + content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + id: Schema.String, + summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), + }).annotate({ title: "ReasoningThreadItem" }), + Schema.Struct({ + aggregatedOutput: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "The command's output, aggregated from stdout and stderr.", + }), + Schema.Null, + ]), + ), + command: Schema.String.annotate({ description: "The command to be executed." }), + commandActions: Schema.Array(V2ThreadStartResponse__CommandAction).annotate({ description: - "Migration-source selector used to produce the migration items. Pass the same value to detection and import; missing or unrecognized values use the default source.", + "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), - Schema.Null, - ]), - ), - source: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional identifier for the product that initiated the import.", + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadStartResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the command execution in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + exitCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The command's exit code.", + format: "int32", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + processId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Identifier for the underlying PTY process (when available).", + }), + Schema.Null, + ]), + ), + source: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadStartResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), + ), + status: V2ThreadStartResponse__CommandExecutionStatus, + type: Schema.Literal("commandExecution").annotate({ + title: "CommandExecutionThreadItemType", }), - Schema.Null, - ]), - ), -}); - -export type CommandExecutionRequestApprovalParams__FileSystemSandboxEntry = { - readonly access: CommandExecutionRequestApprovalParams__FileSystemAccessMode; - readonly path: CommandExecutionRequestApprovalParams__FileSystemPath; -}; -export const CommandExecutionRequestApprovalParams__FileSystemSandboxEntry = Schema.Struct({ - access: CommandExecutionRequestApprovalParams__FileSystemAccessMode, - path: CommandExecutionRequestApprovalParams__FileSystemPath, -}); - -export type McpServerElicitationRequestParams__McpElicitationMultiSelectEnumSchema = - | McpServerElicitationRequestParams__McpElicitationUntitledMultiSelectEnumSchema - | McpServerElicitationRequestParams__McpElicitationTitledMultiSelectEnumSchema; -export const McpServerElicitationRequestParams__McpElicitationMultiSelectEnumSchema = Schema.Union([ - McpServerElicitationRequestParams__McpElicitationUntitledMultiSelectEnumSchema, - McpServerElicitationRequestParams__McpElicitationTitledMultiSelectEnumSchema, -]); - -export type PermissionsRequestApprovalParams__FileSystemSandboxEntry = { - readonly access: PermissionsRequestApprovalParams__FileSystemAccessMode; - readonly path: PermissionsRequestApprovalParams__FileSystemPath; -}; -export const PermissionsRequestApprovalParams__FileSystemSandboxEntry = Schema.Struct({ - access: PermissionsRequestApprovalParams__FileSystemAccessMode, - path: PermissionsRequestApprovalParams__FileSystemPath, -}); - -export type PermissionsRequestApprovalResponse__FileSystemSandboxEntry = { - readonly access: PermissionsRequestApprovalResponse__FileSystemAccessMode; - readonly path: PermissionsRequestApprovalResponse__FileSystemPath; -}; -export const PermissionsRequestApprovalResponse__FileSystemSandboxEntry = Schema.Struct({ - access: PermissionsRequestApprovalResponse__FileSystemAccessMode, - path: PermissionsRequestApprovalResponse__FileSystemPath, -}); - -export type ServerNotification__AppListUpdatedNotification = { - readonly data: ReadonlyArray; -}; -export const ServerNotification__AppListUpdatedNotification = Schema.Struct({ - data: Schema.Array(ServerNotification__AppInfo), -}).annotate({ description: "EXPERIMENTAL - notification emitted when the app list changes." }); - -export type ServerNotification__ExternalAgentConfigImportCompletedNotification = { - readonly importId: string; - readonly itemTypeResults: ReadonlyArray; -}; -export const ServerNotification__ExternalAgentConfigImportCompletedNotification = Schema.Struct({ - importId: Schema.String, - itemTypeResults: Schema.Array(ServerNotification__ExternalAgentConfigImportTypeResult), -}); - -export type ServerNotification__ExternalAgentConfigImportProgressNotification = { - readonly importId: string; - readonly itemTypeResults: ReadonlyArray; -}; -export const ServerNotification__ExternalAgentConfigImportProgressNotification = Schema.Struct({ - importId: Schema.String, - itemTypeResults: Schema.Array(ServerNotification__ExternalAgentConfigImportTypeResult), -}); - -export type ServerNotification__HookCompletedNotification = { - readonly run: ServerNotification__HookRunSummary; - readonly threadId: string; - readonly turnId?: string | null; -}; -export const ServerNotification__HookCompletedNotification = Schema.Struct({ - run: ServerNotification__HookRunSummary, - threadId: Schema.String, - turnId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); + }).annotate({ title: "CommandExecutionThreadItem" }), + Schema.Struct({ + changes: Schema.Array(V2ThreadStartResponse__FileUpdateChange), + id: Schema.String, + status: V2ThreadStartResponse__PatchApplyStatus, + type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), + }).annotate({ title: "FileChangeThreadItem" }), + Schema.Struct({ + appContext: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__McpToolCallAppContext, Schema.Null]), + ), + arguments: Schema.Json.annotate({ expected: "JSON value" }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the MCP tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + error: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__McpToolCallError, Schema.Null]), + ), + id: Schema.String, + mcpAppResourceUri: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Deprecated: use `appContext.resourceUri` instead.", + }), + Schema.Null, + ]), + ), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + result: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__McpToolCallResult, Schema.Null]), + ), + server: Schema.String, + status: V2ThreadStartResponse__McpToolCallStatus, + tool: Schema.String, + type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), + }).annotate({ title: "McpToolCallThreadItem" }), + Schema.Struct({ + arguments: Schema.Json.annotate({ expected: "JSON value" }), + contentItems: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ThreadStartResponse__DynamicToolCallOutputContentItem), + Schema.Null, + ]), + ), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the dynamic tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadStartResponse__DynamicToolCallStatus, + success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + tool: Schema.String, + type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), + }).annotate({ title: "DynamicToolCallThreadItem" }), + Schema.Struct({ + agentsStates: Schema.Record(Schema.String, V2ThreadStartResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), + id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Model requested for the spawned agent, when applicable.", + }), + Schema.Null, + ]), + ), + prompt: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Prompt text sent as part of the collab tool call, when available.", + }), + Schema.Null, + ]), + ), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__ReasoningEffort, Schema.Null]).annotate({ + description: "Reasoning effort requested for the spawned agent, when applicable.", + }), + ), + receiverThreadIds: Schema.Array(Schema.String).annotate({ + description: + "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", + }), + senderThreadId: Schema.String.annotate({ + description: "Thread ID of the agent issuing the collab request.", + }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadStartResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadStartResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), + type: Schema.Literal("collabAgentToolCall").annotate({ + title: "CollabAgentToolCallThreadItemType", + }), + }).annotate({ title: "CollabAgentToolCallThreadItem" }), + Schema.Struct({ + agentPath: Schema.String, + agentThreadId: Schema.String, + id: Schema.String, + kind: V2ThreadStartResponse__SubAgentActivityKind, + type: Schema.Literal("subAgentActivity").annotate({ + title: "SubAgentActivityThreadItemType", + }), + }).annotate({ title: "SubAgentActivityThreadItem" }), + Schema.Struct({ + action: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__WebSearchAction, Schema.Null]), + ), + id: Schema.String, + query: Schema.String, + results: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: + "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", + }), + Schema.Null, + ]), + ), + type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), + }).annotate({ title: "WebSearchThreadItem" }), + Schema.Struct({ + id: Schema.String, + path: V2ThreadStartResponse__LegacyAppPathString, + type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), + }).annotate({ title: "ImageViewThreadItem" }), + Schema.Struct({ + durationMs: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + id: Schema.String, + type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), + }).annotate({ + title: "SleepThreadItem", + description: "Display item emitted by the interruptible `clock.sleep` tool.", + }), + Schema.Struct({ + id: Schema.String, + result: Schema.String, + revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + savedPath: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__AbsolutePathBuf, Schema.Null]), + ), + status: Schema.String, + type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), + }).annotate({ title: "ImageGenerationThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("enteredReviewMode").annotate({ + title: "EnteredReviewModeThreadItemType", + }), + }).annotate({ title: "EnteredReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("exitedReviewMode").annotate({ + title: "ExitedReviewModeThreadItemType", + }), + }).annotate({ title: "ExitedReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + type: Schema.Literal("contextCompaction").annotate({ + title: "ContextCompactionThreadItemType", + }), + }).annotate({ title: "ContextCompactionThreadItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartResponse__ThreadItem" }); -export type ServerNotification__HookStartedNotification = { - readonly run: ServerNotification__HookRunSummary; - readonly threadId: string; - readonly turnId?: string | null; -}; -export const ServerNotification__HookStartedNotification = Schema.Struct({ - run: ServerNotification__HookRunSummary, - threadId: Schema.String, - turnId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}); - -export type ServerNotification__FileSystemSandboxEntry = { - readonly access: ServerNotification__FileSystemAccessMode; - readonly path: ServerNotification__FileSystemPath; -}; -export const ServerNotification__FileSystemSandboxEntry = Schema.Struct({ - access: ServerNotification__FileSystemAccessMode, - path: ServerNotification__FileSystemPath, -}); - -export type ServerNotification__ErrorNotification = { - readonly error: ServerNotification__TurnError; - readonly threadId: string; - readonly turnId: string; - readonly willRetry: boolean; -}; -export const ServerNotification__ErrorNotification = Schema.Struct({ - error: ServerNotification__TurnError, - threadId: Schema.String, - turnId: Schema.String, - willRetry: Schema.Boolean, -}); - -export type ServerNotification__ThreadSettings = { - readonly activePermissionProfile?: ServerNotification__ActivePermissionProfile | null; - readonly approvalPolicy: ServerNotification__AskForApproval; - readonly approvalsReviewer: ServerNotification__ApprovalsReviewer; - readonly collaborationMode: ServerNotification__CollaborationMode; - readonly cwd: ServerNotification__AbsolutePathBuf; - readonly effort?: ServerNotification__ReasoningEffort | null; - readonly model: string; - readonly modelProvider: string; - readonly personality?: ServerNotification__Personality | null; - readonly sandboxPolicy: ServerNotification__SandboxPolicy; - readonly serviceTier?: string | null; - readonly summary?: ServerNotification__ReasoningSummary | null; -}; -export const ServerNotification__ThreadSettings = Schema.Struct({ - activePermissionProfile: Schema.optionalKey( - Schema.Union([ServerNotification__ActivePermissionProfile, Schema.Null]), - ), - approvalPolicy: ServerNotification__AskForApproval, - approvalsReviewer: ServerNotification__ApprovalsReviewer, - collaborationMode: ServerNotification__CollaborationMode, - cwd: ServerNotification__AbsolutePathBuf, - effort: Schema.optionalKey(Schema.Union([ServerNotification__ReasoningEffort, Schema.Null])), - model: Schema.String, - modelProvider: Schema.String, - personality: Schema.optionalKey(Schema.Union([ServerNotification__Personality, Schema.Null])), - sandboxPolicy: ServerNotification__SandboxPolicy, - serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - summary: Schema.optionalKey(Schema.Union([ServerNotification__ReasoningSummary, Schema.Null])), -}); - -export type ServerNotification__ItemCompletedNotification = { - readonly completedAtMs: number; - readonly item: ServerNotification__ThreadItem; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerNotification__ItemCompletedNotification = Schema.Struct({ - completedAtMs: Schema.Number.annotate({ - description: "Unix timestamp (in milliseconds) when this item lifecycle completed.", - format: "int64", - }).check(Schema.isInt()), - item: ServerNotification__ThreadItem, - threadId: Schema.String, - turnId: Schema.String, -}); - -export type ServerNotification__ItemStartedNotification = { - readonly item: ServerNotification__ThreadItem; - readonly startedAtMs: number; - readonly threadId: string; - readonly turnId: string; -}; -export const ServerNotification__ItemStartedNotification = Schema.Struct({ - item: ServerNotification__ThreadItem, - startedAtMs: Schema.Number.annotate({ - description: "Unix timestamp (in milliseconds) when this item lifecycle started.", - format: "int64", - }).check(Schema.isInt()), - threadId: Schema.String, - turnId: Schema.String, -}); - -export type ServerNotification__Turn = { - readonly completedAt?: number | null; - readonly durationMs?: number | null; - readonly error?: ServerNotification__TurnError | null; - readonly id: string; - readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; - readonly startedAt?: number | null; - readonly status: ServerNotification__TurnStatus; -}; -export const ServerNotification__Turn = Schema.Struct({ - completedAt: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the turn completed.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Duration between turn start and completion in milliseconds, if known.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - error: Schema.optionalKey( - Schema.Union([ServerNotification__TurnError, Schema.Null]).annotate({ - description: "Only populated when the Turn's status is failed.", +export type V2ThreadUnarchiveResponse__ThreadItem = + | { + readonly clientId?: string | null; + readonly content: ReadonlyArray; + readonly id: string; + readonly type: "userMessage"; + } + | { + readonly fragments: ReadonlyArray; + readonly id: string; + readonly type: "hookPrompt"; + } + | { + readonly id: string; + readonly memoryCitation?: V2ThreadUnarchiveResponse__MemoryCitation | null; + readonly phase?: V2ThreadUnarchiveResponse__MessagePhase | null; + readonly text: string; + readonly delivery?: "async" | null; + readonly questions?: ReadonlyArray<{ + readonly title: string; + readonly options?: ReadonlyArray | null; + }> | null; + readonly type: "agentMessage"; + } + | { readonly id: string; readonly text: string; readonly type: "plan" } + | { + readonly content?: ReadonlyArray; + readonly id: string; + readonly summary?: ReadonlyArray; + readonly type: "reasoning"; + } + | { + readonly aggregatedOutput?: string | null; + readonly command: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadUnarchiveResponse__LegacyAppPathString; + readonly durationMs?: number | null; + readonly exitCode?: number | null; + readonly id: string; + readonly processId?: string | null; + readonly source?: V2ThreadUnarchiveResponse__CommandExecutionSource; + readonly status: V2ThreadUnarchiveResponse__CommandExecutionStatus; + readonly type: "commandExecution"; + } + | { + readonly changes: ReadonlyArray; + readonly id: string; + readonly status: V2ThreadUnarchiveResponse__PatchApplyStatus; + readonly type: "fileChange"; + } + | { + readonly appContext?: V2ThreadUnarchiveResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; + readonly durationMs?: number | null; + readonly error?: V2ThreadUnarchiveResponse__McpToolCallError | null; + readonly id: string; + readonly mcpAppResourceUri?: string | null; + readonly pluginId?: string | null; + readonly result?: V2ThreadUnarchiveResponse__McpToolCallResult | null; + readonly server: string; + readonly status: V2ThreadUnarchiveResponse__McpToolCallStatus; + readonly tool: string; + readonly type: "mcpToolCall"; + } + | { + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; + readonly durationMs?: number | null; + readonly id: string; + readonly namespace?: string | null; + readonly status: V2ThreadUnarchiveResponse__DynamicToolCallStatus; + readonly success?: boolean | null; + readonly tool: string; + readonly type: "dynamicToolCall"; + } + | { + readonly agentsStates: { readonly [x: string]: V2ThreadUnarchiveResponse__CollabAgentState }; + readonly id: string; + readonly model?: string | null; + readonly prompt?: string | null; + readonly reasoningEffort?: V2ThreadUnarchiveResponse__ReasoningEffort | null; + readonly receiverThreadIds: ReadonlyArray; + readonly senderThreadId: string; + readonly status: V2ThreadUnarchiveResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadUnarchiveResponse__CollabAgentTool; + readonly type: "collabAgentToolCall"; + } + | { + readonly agentPath: string; + readonly agentThreadId: string; + readonly id: string; + readonly kind: V2ThreadUnarchiveResponse__SubAgentActivityKind; + readonly type: "subAgentActivity"; + } + | { + readonly action?: V2ThreadUnarchiveResponse__WebSearchAction | null; + readonly id: string; + readonly query: string; + readonly results?: ReadonlyArray | null; + readonly type: "webSearch"; + } + | { + readonly id: string; + readonly path: V2ThreadUnarchiveResponse__LegacyAppPathString; + readonly type: "imageView"; + } + | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } + | { + readonly id: string; + readonly result: string; + readonly revisedPrompt?: string | null; + readonly savedPath?: V2ThreadUnarchiveResponse__AbsolutePathBuf | null; + readonly status: string; + readonly type: "imageGeneration"; + } + | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } + | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } + | { readonly id: string; readonly type: "contextCompaction" }; +export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( + [ + Schema.Struct({ + clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + content: Schema.Array(V2ThreadUnarchiveResponse__UserInput), + id: Schema.String, + type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), + }).annotate({ title: "UserMessageThreadItem" }), + Schema.Struct({ + fragments: Schema.Array(V2ThreadUnarchiveResponse__HookPromptFragment), + id: Schema.String, + type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), + }).annotate({ title: "HookPromptThreadItem" }), + Schema.Struct({ + id: Schema.String, + memoryCitation: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__MessagePhase, Schema.Null]), + ), + text: Schema.String, + delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + questions: Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Struct({ + title: Schema.String, + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), + }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + text: Schema.String, + type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), + }).annotate({ + title: "PlanThreadItem", + description: + "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", }), - ), - id: Schema.String.annotate({ - description: "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", - }), - items: Schema.Array(ServerNotification__ThreadItem).annotate({ - description: "Thread items currently included in this turn payload.", - }), - itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ - description: "Describes how much of `items` has been loaded for this turn.", - default: "full", + Schema.Struct({ + content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + id: Schema.String, + summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), + }).annotate({ title: "ReasoningThreadItem" }), + Schema.Struct({ + aggregatedOutput: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "The command's output, aggregated from stdout and stderr.", + }), + Schema.Null, + ]), + ), + command: Schema.String.annotate({ description: "The command to be executed." }), + commandActions: Schema.Array(V2ThreadUnarchiveResponse__CommandAction).annotate({ + description: + "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", + }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadUnarchiveResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the command execution in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + exitCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The command's exit code.", + format: "int32", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + processId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Identifier for the underlying PTY process (when available).", + }), + Schema.Null, + ]), + ), + source: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadUnarchiveResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), + ), + status: V2ThreadUnarchiveResponse__CommandExecutionStatus, + type: Schema.Literal("commandExecution").annotate({ + title: "CommandExecutionThreadItemType", + }), + }).annotate({ title: "CommandExecutionThreadItem" }), + Schema.Struct({ + changes: Schema.Array(V2ThreadUnarchiveResponse__FileUpdateChange), + id: Schema.String, + status: V2ThreadUnarchiveResponse__PatchApplyStatus, + type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), + }).annotate({ title: "FileChangeThreadItem" }), + Schema.Struct({ + appContext: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__McpToolCallAppContext, Schema.Null]), + ), + arguments: Schema.Json.annotate({ expected: "JSON value" }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the MCP tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + error: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__McpToolCallError, Schema.Null]), + ), + id: Schema.String, + mcpAppResourceUri: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Deprecated: use `appContext.resourceUri` instead.", + }), + Schema.Null, + ]), + ), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + result: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__McpToolCallResult, Schema.Null]), + ), + server: Schema.String, + status: V2ThreadUnarchiveResponse__McpToolCallStatus, + tool: Schema.String, + type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), + }).annotate({ title: "McpToolCallThreadItem" }), + Schema.Struct({ + arguments: Schema.Json.annotate({ expected: "JSON value" }), + contentItems: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem), + Schema.Null, + ]), + ), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the dynamic tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadUnarchiveResponse__DynamicToolCallStatus, + success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + tool: Schema.String, + type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), + }).annotate({ title: "DynamicToolCallThreadItem" }), + Schema.Struct({ + agentsStates: Schema.Record( + Schema.String, + V2ThreadUnarchiveResponse__CollabAgentState, + ).annotate({ description: "Last known status of the target agents, when available." }), + id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Model requested for the spawned agent, when applicable.", + }), + Schema.Null, + ]), + ), + prompt: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Prompt text sent as part of the collab tool call, when available.", + }), + Schema.Null, + ]), + ), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ReasoningEffort, Schema.Null]).annotate({ + description: "Reasoning effort requested for the spawned agent, when applicable.", + }), + ), + receiverThreadIds: Schema.Array(Schema.String).annotate({ + description: + "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", + }), + senderThreadId: Schema.String.annotate({ + description: "Thread ID of the agent issuing the collab request.", + }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadUnarchiveResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadUnarchiveResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), + type: Schema.Literal("collabAgentToolCall").annotate({ + title: "CollabAgentToolCallThreadItemType", + }), + }).annotate({ title: "CollabAgentToolCallThreadItem" }), + Schema.Struct({ + agentPath: Schema.String, + agentThreadId: Schema.String, + id: Schema.String, + kind: V2ThreadUnarchiveResponse__SubAgentActivityKind, + type: Schema.Literal("subAgentActivity").annotate({ + title: "SubAgentActivityThreadItemType", + }), + }).annotate({ title: "SubAgentActivityThreadItem" }), + Schema.Struct({ + action: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__WebSearchAction, Schema.Null]), + ), + id: Schema.String, + query: Schema.String, + results: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: + "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", + }), + Schema.Null, + ]), + ), + type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), + }).annotate({ title: "WebSearchThreadItem" }), + Schema.Struct({ + id: Schema.String, + path: V2ThreadUnarchiveResponse__LegacyAppPathString, + type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), + }).annotate({ title: "ImageViewThreadItem" }), + Schema.Struct({ + durationMs: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + id: Schema.String, + type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), + }).annotate({ + title: "SleepThreadItem", + description: "Display item emitted by the interruptible `clock.sleep` tool.", }), - ), - startedAt: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the turn started.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - status: ServerNotification__TurnStatus, -}); - -export type ServerRequest__FileSystemSandboxEntry = { - readonly access: ServerRequest__FileSystemAccessMode; - readonly path: ServerRequest__FileSystemPath; -}; -export const ServerRequest__FileSystemSandboxEntry = Schema.Struct({ - access: ServerRequest__FileSystemAccessMode, - path: ServerRequest__FileSystemPath, -}); - -export type ServerRequest__McpElicitationMultiSelectEnumSchema = - | ServerRequest__McpElicitationUntitledMultiSelectEnumSchema - | ServerRequest__McpElicitationTitledMultiSelectEnumSchema; -export const ServerRequest__McpElicitationMultiSelectEnumSchema = Schema.Union([ - ServerRequest__McpElicitationUntitledMultiSelectEnumSchema, - ServerRequest__McpElicitationTitledMultiSelectEnumSchema, -]); + Schema.Struct({ + id: Schema.String, + result: Schema.String, + revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + savedPath: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__AbsolutePathBuf, Schema.Null]), + ), + status: Schema.String, + type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), + }).annotate({ title: "ImageGenerationThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("enteredReviewMode").annotate({ + title: "EnteredReviewModeThreadItemType", + }), + }).annotate({ title: "EnteredReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("exitedReviewMode").annotate({ + title: "ExitedReviewModeThreadItemType", + }), + }).annotate({ title: "ExitedReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + type: Schema.Literal("contextCompaction").annotate({ + title: "ContextCompactionThreadItemType", + }), + }).annotate({ title: "ContextCompactionThreadItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__ThreadItem" }); -export type V2ConfigReadResponse__Config = { - readonly analytics?: V2ConfigReadResponse__AnalyticsConfig | null; - readonly approval_policy?: V2ConfigReadResponse__AskForApproval | null; - readonly approvals_reviewer?: V2ConfigReadResponse__ApprovalsReviewer | null; - readonly compact_prompt?: string | null; - readonly desktop?: { readonly [x: string]: unknown } | null; - readonly developer_instructions?: string | null; - readonly forced_chatgpt_workspace_id?: V2ConfigReadResponse__ForcedChatgptWorkspaceIds | null; - readonly forced_login_method?: V2ConfigReadResponse__ForcedLoginMethod | null; - readonly instructions?: string | null; - readonly model?: string | null; - readonly model_auto_compact_token_limit?: number | null; - readonly model_auto_compact_token_limit_scope?: V2ConfigReadResponse__AutoCompactTokenLimitScope | null; - readonly model_context_window?: number | null; - readonly model_provider?: string | null; - readonly model_reasoning_effort?: V2ConfigReadResponse__ReasoningEffort | null; - readonly model_reasoning_summary?: V2ConfigReadResponse__ReasoningSummary | null; - readonly model_verbosity?: V2ConfigReadResponse__Verbosity | null; - readonly review_model?: string | null; - readonly sandbox_mode?: V2ConfigReadResponse__SandboxMode | null; - readonly sandbox_workspace_write?: V2ConfigReadResponse__SandboxWorkspaceWrite | null; - readonly service_tier?: string | null; - readonly tools?: V2ConfigReadResponse__ToolsV2 | null; - readonly web_search?: V2ConfigReadResponse__WebSearchMode | null; - readonly [x: string]: unknown; -}; -export const V2ConfigReadResponse__Config = Schema.StructWithRest( - Schema.Struct({ - analytics: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__AnalyticsConfig, Schema.Null]), - ), - approval_policy: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__AskForApproval, Schema.Null]), - ), - approvals_reviewer: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ApprovalsReviewer, Schema.Null]).annotate({ +export type V2TurnCompletedNotification__ThreadItem = + | { + readonly clientId?: string | null; + readonly content: ReadonlyArray; + readonly id: string; + readonly type: "userMessage"; + } + | { + readonly fragments: ReadonlyArray; + readonly id: string; + readonly type: "hookPrompt"; + } + | { + readonly id: string; + readonly memoryCitation?: V2TurnCompletedNotification__MemoryCitation | null; + readonly phase?: V2TurnCompletedNotification__MessagePhase | null; + readonly text: string; + readonly delivery?: "async" | null; + readonly questions?: ReadonlyArray<{ + readonly title: string; + readonly options?: ReadonlyArray | null; + }> | null; + readonly type: "agentMessage"; + } + | { readonly id: string; readonly text: string; readonly type: "plan" } + | { + readonly content?: ReadonlyArray; + readonly id: string; + readonly summary?: ReadonlyArray; + readonly type: "reasoning"; + } + | { + readonly aggregatedOutput?: string | null; + readonly command: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2TurnCompletedNotification__LegacyAppPathString; + readonly durationMs?: number | null; + readonly exitCode?: number | null; + readonly id: string; + readonly processId?: string | null; + readonly source?: V2TurnCompletedNotification__CommandExecutionSource; + readonly status: V2TurnCompletedNotification__CommandExecutionStatus; + readonly type: "commandExecution"; + } + | { + readonly changes: ReadonlyArray; + readonly id: string; + readonly status: V2TurnCompletedNotification__PatchApplyStatus; + readonly type: "fileChange"; + } + | { + readonly appContext?: V2TurnCompletedNotification__McpToolCallAppContext | null; + readonly arguments: Schema.Json; + readonly durationMs?: number | null; + readonly error?: V2TurnCompletedNotification__McpToolCallError | null; + readonly id: string; + readonly mcpAppResourceUri?: string | null; + readonly pluginId?: string | null; + readonly result?: V2TurnCompletedNotification__McpToolCallResult | null; + readonly server: string; + readonly status: V2TurnCompletedNotification__McpToolCallStatus; + readonly tool: string; + readonly type: "mcpToolCall"; + } + | { + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; + readonly durationMs?: number | null; + readonly id: string; + readonly namespace?: string | null; + readonly status: V2TurnCompletedNotification__DynamicToolCallStatus; + readonly success?: boolean | null; + readonly tool: string; + readonly type: "dynamicToolCall"; + } + | { + readonly agentsStates: { + readonly [x: string]: V2TurnCompletedNotification__CollabAgentState; + }; + readonly id: string; + readonly model?: string | null; + readonly prompt?: string | null; + readonly reasoningEffort?: V2TurnCompletedNotification__ReasoningEffort | null; + readonly receiverThreadIds: ReadonlyArray; + readonly senderThreadId: string; + readonly status: V2TurnCompletedNotification__CollabAgentToolCallStatus; + readonly tool: V2TurnCompletedNotification__CollabAgentTool; + readonly type: "collabAgentToolCall"; + } + | { + readonly agentPath: string; + readonly agentThreadId: string; + readonly id: string; + readonly kind: V2TurnCompletedNotification__SubAgentActivityKind; + readonly type: "subAgentActivity"; + } + | { + readonly action?: V2TurnCompletedNotification__WebSearchAction | null; + readonly id: string; + readonly query: string; + readonly results?: ReadonlyArray | null; + readonly type: "webSearch"; + } + | { + readonly id: string; + readonly path: V2TurnCompletedNotification__LegacyAppPathString; + readonly type: "imageView"; + } + | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } + | { + readonly id: string; + readonly result: string; + readonly revisedPrompt?: string | null; + readonly savedPath?: V2TurnCompletedNotification__AbsolutePathBuf | null; + readonly status: string; + readonly type: "imageGeneration"; + } + | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } + | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } + | { readonly id: string; readonly type: "contextCompaction" }; +export const V2TurnCompletedNotification__ThreadItem = Schema.Union( + [ + Schema.Struct({ + clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + content: Schema.Array(V2TurnCompletedNotification__UserInput), + id: Schema.String, + type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), + }).annotate({ title: "UserMessageThreadItem" }), + Schema.Struct({ + fragments: Schema.Array(V2TurnCompletedNotification__HookPromptFragment), + id: Schema.String, + type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), + }).annotate({ title: "HookPromptThreadItem" }), + Schema.Struct({ + id: Schema.String, + memoryCitation: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__MessagePhase, Schema.Null]), + ), + text: Schema.String, + delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + questions: Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Struct({ + title: Schema.String, + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), + }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + text: Schema.String, + type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), + }).annotate({ + title: "PlanThreadItem", + description: + "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", + }), + Schema.Struct({ + content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + id: Schema.String, + summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), + }).annotate({ title: "ReasoningThreadItem" }), + Schema.Struct({ + aggregatedOutput: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "The command's output, aggregated from stdout and stderr.", + }), + Schema.Null, + ]), + ), + command: Schema.String.annotate({ description: "The command to be executed." }), + commandActions: Schema.Array(V2TurnCompletedNotification__CommandAction).annotate({ + description: + "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", + }), + cwd: Schema.suspend( + (): Schema.Codec => + V2TurnCompletedNotification__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the command execution in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + exitCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The command's exit code.", + format: "int32", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + processId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Identifier for the underlying PTY process (when available).", + }), + Schema.Null, + ]), + ), + source: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2TurnCompletedNotification__CommandExecutionSource, + ).annotate({ default: "agent" }), + ), + status: V2TurnCompletedNotification__CommandExecutionStatus, + type: Schema.Literal("commandExecution").annotate({ + title: "CommandExecutionThreadItemType", + }), + }).annotate({ title: "CommandExecutionThreadItem" }), + Schema.Struct({ + changes: Schema.Array(V2TurnCompletedNotification__FileUpdateChange), + id: Schema.String, + status: V2TurnCompletedNotification__PatchApplyStatus, + type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), + }).annotate({ title: "FileChangeThreadItem" }), + Schema.Struct({ + appContext: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__McpToolCallAppContext, Schema.Null]), + ), + arguments: Schema.Json.annotate({ expected: "JSON value" }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the MCP tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + error: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__McpToolCallError, Schema.Null]), + ), + id: Schema.String, + mcpAppResourceUri: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Deprecated: use `appContext.resourceUri` instead.", + }), + Schema.Null, + ]), + ), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + result: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__McpToolCallResult, Schema.Null]), + ), + server: Schema.String, + status: V2TurnCompletedNotification__McpToolCallStatus, + tool: Schema.String, + type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), + }).annotate({ title: "McpToolCallThreadItem" }), + Schema.Struct({ + arguments: Schema.Json.annotate({ expected: "JSON value" }), + contentItems: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2TurnCompletedNotification__DynamicToolCallOutputContentItem), + Schema.Null, + ]), + ), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the dynamic tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2TurnCompletedNotification__DynamicToolCallStatus, + success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + tool: Schema.String, + type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), + }).annotate({ title: "DynamicToolCallThreadItem" }), + Schema.Struct({ + agentsStates: Schema.Record( + Schema.String, + V2TurnCompletedNotification__CollabAgentState, + ).annotate({ description: "Last known status of the target agents, when available." }), + id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Model requested for the spawned agent, when applicable.", + }), + Schema.Null, + ]), + ), + prompt: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Prompt text sent as part of the collab tool call, when available.", + }), + Schema.Null, + ]), + ), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__ReasoningEffort, Schema.Null]).annotate({ + description: "Reasoning effort requested for the spawned agent, when applicable.", + }), + ), + receiverThreadIds: Schema.Array(Schema.String).annotate({ description: - "[UNSTABLE] Optional default for where approval requests are routed for review.", + "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", }), - ), - compact_prompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - desktop: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null]), - ), - developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - forced_chatgpt_workspace_id: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ForcedChatgptWorkspaceIds, Schema.Null]), - ), - forced_login_method: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ForcedLoginMethod, Schema.Null]), - ), - instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model_auto_compact_token_limit: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - Schema.Null, - ]), - ), - model_auto_compact_token_limit_scope: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__AutoCompactTokenLimitScope, Schema.Null]), - ), - model_context_window: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - Schema.Null, - ]), - ), - model_provider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model_reasoning_effort: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ReasoningEffort, Schema.Null]), - ), - model_reasoning_summary: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ReasoningSummary, Schema.Null]), - ), - model_verbosity: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__Verbosity, Schema.Null]), - ), - review_model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - sandbox_mode: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__SandboxMode, Schema.Null]), - ), - sandbox_workspace_write: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__SandboxWorkspaceWrite, Schema.Null]), - ), - service_tier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - tools: Schema.optionalKey(Schema.Union([V2ConfigReadResponse__ToolsV2, Schema.Null])), - web_search: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__WebSearchMode, Schema.Null]), - ), - }), - [Schema.Record(Schema.String, Schema.Unknown)], -); - -export type V2ConfigRequirementsReadResponse__ConfigRequirements = { - readonly allowAppshots?: boolean | null; - readonly allowManagedHooksOnly?: boolean | null; - readonly allowRemoteControl?: boolean | null; - readonly allowedApprovalPolicies?: ReadonlyArray | null; - readonly allowedPermissionProfiles?: { readonly [x: string]: boolean } | null; - readonly allowedSandboxModes?: ReadonlyArray | null; - readonly allowedWebSearchModes?: ReadonlyArray | null; - readonly allowedWindowsSandboxImplementations?: ReadonlyArray | null; - readonly computerUse?: V2ConfigRequirementsReadResponse__ComputerUseRequirements | null; - readonly defaultPermissions?: string | null; - readonly enforceResidency?: V2ConfigRequirementsReadResponse__ResidencyRequirement | null; - readonly featureRequirements?: { readonly [x: string]: boolean } | null; - readonly models?: V2ConfigRequirementsReadResponse__ModelsRequirements | null; -}; -export const V2ConfigRequirementsReadResponse__ConfigRequirements = Schema.Struct({ - allowAppshots: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - allowManagedHooksOnly: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - allowRemoteControl: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - allowedApprovalPolicies: Schema.optionalKey( - Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__AskForApproval), Schema.Null]), - ), - allowedPermissionProfiles: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Boolean), Schema.Null]), - ), - allowedSandboxModes: Schema.optionalKey( - Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__SandboxMode), Schema.Null]), - ), - allowedWebSearchModes: Schema.optionalKey( - Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__WebSearchMode), Schema.Null]), - ), - allowedWindowsSandboxImplementations: Schema.optionalKey( - Schema.Union([ - Schema.Array(V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode), - Schema.Null, - ]), - ), - computerUse: Schema.optionalKey( - Schema.Union([V2ConfigRequirementsReadResponse__ComputerUseRequirements, Schema.Null]), - ), - defaultPermissions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - enforceResidency: Schema.optionalKey( - Schema.Union([V2ConfigRequirementsReadResponse__ResidencyRequirement, Schema.Null]), - ), - featureRequirements: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Boolean), Schema.Null]), - ), - models: Schema.optionalKey( - Schema.Union([V2ConfigRequirementsReadResponse__ModelsRequirements, Schema.Null]), - ), -}); - -export type V2ConfigWriteResponse__OverriddenMetadata = { - readonly effectiveValue: unknown; - readonly message: string; - readonly overridingLayer: V2ConfigWriteResponse__ConfigLayerMetadata; -}; -export const V2ConfigWriteResponse__OverriddenMetadata = Schema.Struct({ - effectiveValue: Schema.Unknown, - message: Schema.String, - overridingLayer: V2ConfigWriteResponse__ConfigLayerMetadata, -}); - -export type V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSandboxEntry = { - readonly access: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode; - readonly path: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath; -}; -export const V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSandboxEntry = - Schema.Struct({ - access: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode, - path: V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath, - }); - -export type V2ItemGuardianApprovalReviewStartedNotification__FileSystemSandboxEntry = { - readonly access: V2ItemGuardianApprovalReviewStartedNotification__FileSystemAccessMode; - readonly path: V2ItemGuardianApprovalReviewStartedNotification__FileSystemPath; -}; -export const V2ItemGuardianApprovalReviewStartedNotification__FileSystemSandboxEntry = - Schema.Struct({ - access: V2ItemGuardianApprovalReviewStartedNotification__FileSystemAccessMode, - path: V2ItemGuardianApprovalReviewStartedNotification__FileSystemPath, - }); - -export type V2PluginInstalledResponse__PluginSummary = { - readonly authPolicy: V2PluginInstalledResponse__PluginAuthPolicy; - readonly availability?: "DISABLED_BY_ADMIN" | "AVAILABLE"; - readonly enabled: boolean; - readonly id: string; - readonly installPolicy: V2PluginInstalledResponse__PluginInstallPolicy; - readonly installPolicySource?: V2PluginInstalledResponse__PluginInstallPolicySource | null; - readonly installed: boolean; - readonly interface?: V2PluginInstalledResponse__PluginInterface | null; - readonly keywords?: ReadonlyArray; - readonly localVersion?: string | null; - readonly mustShowInstallationInterstitial?: boolean | null; - readonly name: string; - readonly remotePluginId?: string | null; - readonly shareContext?: V2PluginInstalledResponse__PluginShareContext | null; - readonly source: V2PluginInstalledResponse__PluginSource; - readonly version?: string | null; -}; -export const V2PluginInstalledResponse__PluginSummary = Schema.Struct({ - authPolicy: V2PluginInstalledResponse__PluginAuthPolicy, - availability: Schema.optionalKey( - Schema.Literals(["DISABLED_BY_ADMIN", "AVAILABLE"]).annotate({ - description: "Availability state for installing and using the plugin.", - default: "AVAILABLE", + senderThreadId: Schema.String.annotate({ + description: "Thread ID of the agent issuing the collab request.", + }), + status: Schema.suspend( + (): Schema.Codec => + V2TurnCompletedNotification__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2TurnCompletedNotification__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), + type: Schema.Literal("collabAgentToolCall").annotate({ + title: "CollabAgentToolCallThreadItemType", + }), + }).annotate({ title: "CollabAgentToolCallThreadItem" }), + Schema.Struct({ + agentPath: Schema.String, + agentThreadId: Schema.String, + id: Schema.String, + kind: V2TurnCompletedNotification__SubAgentActivityKind, + type: Schema.Literal("subAgentActivity").annotate({ + title: "SubAgentActivityThreadItemType", + }), + }).annotate({ title: "SubAgentActivityThreadItem" }), + Schema.Struct({ + action: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__WebSearchAction, Schema.Null]), + ), + id: Schema.String, + query: Schema.String, + results: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: + "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", + }), + Schema.Null, + ]), + ), + type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), + }).annotate({ title: "WebSearchThreadItem" }), + Schema.Struct({ + id: Schema.String, + path: V2TurnCompletedNotification__LegacyAppPathString, + type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), + }).annotate({ title: "ImageViewThreadItem" }), + Schema.Struct({ + durationMs: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + id: Schema.String, + type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), + }).annotate({ + title: "SleepThreadItem", + description: "Display item emitted by the interruptible `clock.sleep` tool.", }), - ), - enabled: Schema.Boolean, - id: Schema.String, - installPolicy: V2PluginInstalledResponse__PluginInstallPolicy, - installPolicySource: Schema.optionalKey( - Schema.Union([V2PluginInstalledResponse__PluginInstallPolicySource, Schema.Null]), - ), - installed: Schema.Boolean, - interface: Schema.optionalKey( - Schema.Union([V2PluginInstalledResponse__PluginInterface, Schema.Null]), - ), - keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - localVersion: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version of the locally materialized plugin package when available.", + Schema.Struct({ + id: Schema.String, + result: Schema.String, + revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + savedPath: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__AbsolutePathBuf, Schema.Null]), + ), + status: Schema.String, + type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), + }).annotate({ title: "ImageGenerationThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("enteredReviewMode").annotate({ + title: "EnteredReviewModeThreadItemType", }), - Schema.Null, - ]), - ), - mustShowInstallationInterstitial: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - name: Schema.String, - remotePluginId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "Backend remote plugin identifier when available." }), - Schema.Null, - ]), - ), - shareContext: Schema.optionalKey( - Schema.Union([V2PluginInstalledResponse__PluginShareContext, Schema.Null]).annotate({ - description: "Remote sharing context associated with this plugin when available.", + }).annotate({ title: "EnteredReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("exitedReviewMode").annotate({ + title: "ExitedReviewModeThreadItemType", + }), + }).annotate({ title: "ExitedReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + type: Schema.Literal("contextCompaction").annotate({ + title: "ContextCompactionThreadItemType", + }), + }).annotate({ title: "ContextCompactionThreadItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnCompletedNotification__ThreadItem" }); + +export type V2TurnStartedNotification__ThreadItem = + | { + readonly clientId?: string | null; + readonly content: ReadonlyArray; + readonly id: string; + readonly type: "userMessage"; + } + | { + readonly fragments: ReadonlyArray; + readonly id: string; + readonly type: "hookPrompt"; + } + | { + readonly id: string; + readonly memoryCitation?: V2TurnStartedNotification__MemoryCitation | null; + readonly phase?: V2TurnStartedNotification__MessagePhase | null; + readonly text: string; + readonly delivery?: "async" | null; + readonly questions?: ReadonlyArray<{ + readonly title: string; + readonly options?: ReadonlyArray | null; + }> | null; + readonly type: "agentMessage"; + } + | { readonly id: string; readonly text: string; readonly type: "plan" } + | { + readonly content?: ReadonlyArray; + readonly id: string; + readonly summary?: ReadonlyArray; + readonly type: "reasoning"; + } + | { + readonly aggregatedOutput?: string | null; + readonly command: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2TurnStartedNotification__LegacyAppPathString; + readonly durationMs?: number | null; + readonly exitCode?: number | null; + readonly id: string; + readonly processId?: string | null; + readonly source?: V2TurnStartedNotification__CommandExecutionSource; + readonly status: V2TurnStartedNotification__CommandExecutionStatus; + readonly type: "commandExecution"; + } + | { + readonly changes: ReadonlyArray; + readonly id: string; + readonly status: V2TurnStartedNotification__PatchApplyStatus; + readonly type: "fileChange"; + } + | { + readonly appContext?: V2TurnStartedNotification__McpToolCallAppContext | null; + readonly arguments: Schema.Json; + readonly durationMs?: number | null; + readonly error?: V2TurnStartedNotification__McpToolCallError | null; + readonly id: string; + readonly mcpAppResourceUri?: string | null; + readonly pluginId?: string | null; + readonly result?: V2TurnStartedNotification__McpToolCallResult | null; + readonly server: string; + readonly status: V2TurnStartedNotification__McpToolCallStatus; + readonly tool: string; + readonly type: "mcpToolCall"; + } + | { + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; + readonly durationMs?: number | null; + readonly id: string; + readonly namespace?: string | null; + readonly status: V2TurnStartedNotification__DynamicToolCallStatus; + readonly success?: boolean | null; + readonly tool: string; + readonly type: "dynamicToolCall"; + } + | { + readonly agentsStates: { readonly [x: string]: V2TurnStartedNotification__CollabAgentState }; + readonly id: string; + readonly model?: string | null; + readonly prompt?: string | null; + readonly reasoningEffort?: V2TurnStartedNotification__ReasoningEffort | null; + readonly receiverThreadIds: ReadonlyArray; + readonly senderThreadId: string; + readonly status: V2TurnStartedNotification__CollabAgentToolCallStatus; + readonly tool: V2TurnStartedNotification__CollabAgentTool; + readonly type: "collabAgentToolCall"; + } + | { + readonly agentPath: string; + readonly agentThreadId: string; + readonly id: string; + readonly kind: V2TurnStartedNotification__SubAgentActivityKind; + readonly type: "subAgentActivity"; + } + | { + readonly action?: V2TurnStartedNotification__WebSearchAction | null; + readonly id: string; + readonly query: string; + readonly results?: ReadonlyArray | null; + readonly type: "webSearch"; + } + | { + readonly id: string; + readonly path: V2TurnStartedNotification__LegacyAppPathString; + readonly type: "imageView"; + } + | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } + | { + readonly id: string; + readonly result: string; + readonly revisedPrompt?: string | null; + readonly savedPath?: V2TurnStartedNotification__AbsolutePathBuf | null; + readonly status: string; + readonly type: "imageGeneration"; + } + | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } + | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } + | { readonly id: string; readonly type: "contextCompaction" }; +export const V2TurnStartedNotification__ThreadItem = Schema.Union( + [ + Schema.Struct({ + clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + content: Schema.Array(V2TurnStartedNotification__UserInput), + id: Schema.String, + type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), + }).annotate({ title: "UserMessageThreadItem" }), + Schema.Struct({ + fragments: Schema.Array(V2TurnStartedNotification__HookPromptFragment), + id: Schema.String, + type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), + }).annotate({ title: "HookPromptThreadItem" }), + Schema.Struct({ + id: Schema.String, + memoryCitation: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__MessagePhase, Schema.Null]), + ), + text: Schema.String, + delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + questions: Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Struct({ + title: Schema.String, + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), + }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + text: Schema.String, + type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), + }).annotate({ + title: "PlanThreadItem", + description: + "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", }), - ), - source: V2PluginInstalledResponse__PluginSource, - version: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version advertised by the remote marketplace backend when available.", + Schema.Struct({ + content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + id: Schema.String, + summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), + }).annotate({ title: "ReasoningThreadItem" }), + Schema.Struct({ + aggregatedOutput: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "The command's output, aggregated from stdout and stderr.", + }), + Schema.Null, + ]), + ), + command: Schema.String.annotate({ description: "The command to be executed." }), + commandActions: Schema.Array(V2TurnStartedNotification__CommandAction).annotate({ + description: + "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", + }), + cwd: Schema.suspend( + (): Schema.Codec => + V2TurnStartedNotification__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the command execution in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + exitCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The command's exit code.", + format: "int32", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + processId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Identifier for the underlying PTY process (when available).", + }), + Schema.Null, + ]), + ), + source: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2TurnStartedNotification__CommandExecutionSource, + ).annotate({ default: "agent" }), + ), + status: V2TurnStartedNotification__CommandExecutionStatus, + type: Schema.Literal("commandExecution").annotate({ + title: "CommandExecutionThreadItemType", + }), + }).annotate({ title: "CommandExecutionThreadItem" }), + Schema.Struct({ + changes: Schema.Array(V2TurnStartedNotification__FileUpdateChange), + id: Schema.String, + status: V2TurnStartedNotification__PatchApplyStatus, + type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), + }).annotate({ title: "FileChangeThreadItem" }), + Schema.Struct({ + appContext: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__McpToolCallAppContext, Schema.Null]), + ), + arguments: Schema.Json.annotate({ expected: "JSON value" }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the MCP tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + error: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__McpToolCallError, Schema.Null]), + ), + id: Schema.String, + mcpAppResourceUri: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Deprecated: use `appContext.resourceUri` instead.", + }), + Schema.Null, + ]), + ), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + result: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__McpToolCallResult, Schema.Null]), + ), + server: Schema.String, + status: V2TurnStartedNotification__McpToolCallStatus, + tool: Schema.String, + type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), + }).annotate({ title: "McpToolCallThreadItem" }), + Schema.Struct({ + arguments: Schema.Json.annotate({ expected: "JSON value" }), + contentItems: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2TurnStartedNotification__DynamicToolCallOutputContentItem), + Schema.Null, + ]), + ), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the dynamic tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2TurnStartedNotification__DynamicToolCallStatus, + success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + tool: Schema.String, + type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), + }).annotate({ title: "DynamicToolCallThreadItem" }), + Schema.Struct({ + agentsStates: Schema.Record( + Schema.String, + V2TurnStartedNotification__CollabAgentState, + ).annotate({ description: "Last known status of the target agents, when available." }), + id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Model requested for the spawned agent, when applicable.", + }), + Schema.Null, + ]), + ), + prompt: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Prompt text sent as part of the collab tool call, when available.", + }), + Schema.Null, + ]), + ), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__ReasoningEffort, Schema.Null]).annotate({ + description: "Reasoning effort requested for the spawned agent, when applicable.", + }), + ), + receiverThreadIds: Schema.Array(Schema.String).annotate({ + description: + "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", }), - Schema.Null, - ]), - ), -}); - -export type V2PluginListResponse__PluginSummary = { - readonly authPolicy: V2PluginListResponse__PluginAuthPolicy; - readonly availability?: "DISABLED_BY_ADMIN" | "AVAILABLE"; - readonly enabled: boolean; - readonly id: string; - readonly installPolicy: V2PluginListResponse__PluginInstallPolicy; - readonly installPolicySource?: V2PluginListResponse__PluginInstallPolicySource | null; - readonly installed: boolean; - readonly interface?: V2PluginListResponse__PluginInterface | null; - readonly keywords?: ReadonlyArray; - readonly localVersion?: string | null; - readonly mustShowInstallationInterstitial?: boolean | null; - readonly name: string; - readonly remotePluginId?: string | null; - readonly shareContext?: V2PluginListResponse__PluginShareContext | null; - readonly source: V2PluginListResponse__PluginSource; - readonly version?: string | null; -}; -export const V2PluginListResponse__PluginSummary = Schema.Struct({ - authPolicy: V2PluginListResponse__PluginAuthPolicy, - availability: Schema.optionalKey( - Schema.Literals(["DISABLED_BY_ADMIN", "AVAILABLE"]).annotate({ - description: "Availability state for installing and using the plugin.", - default: "AVAILABLE", - }), - ), - enabled: Schema.Boolean, - id: Schema.String, - installPolicy: V2PluginListResponse__PluginInstallPolicy, - installPolicySource: Schema.optionalKey( - Schema.Union([V2PluginListResponse__PluginInstallPolicySource, Schema.Null]), - ), - installed: Schema.Boolean, - interface: Schema.optionalKey(Schema.Union([V2PluginListResponse__PluginInterface, Schema.Null])), - keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - localVersion: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version of the locally materialized plugin package when available.", + senderThreadId: Schema.String.annotate({ + description: "Thread ID of the agent issuing the collab request.", }), - Schema.Null, - ]), - ), - mustShowInstallationInterstitial: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - name: Schema.String, - remotePluginId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "Backend remote plugin identifier when available." }), - Schema.Null, - ]), - ), - shareContext: Schema.optionalKey( - Schema.Union([V2PluginListResponse__PluginShareContext, Schema.Null]).annotate({ - description: "Remote sharing context associated with this plugin when available.", - }), - ), - source: V2PluginListResponse__PluginSource, - version: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version advertised by the remote marketplace backend when available.", + status: Schema.suspend( + (): Schema.Codec => + V2TurnStartedNotification__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2TurnStartedNotification__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), + type: Schema.Literal("collabAgentToolCall").annotate({ + title: "CollabAgentToolCallThreadItemType", }), - Schema.Null, - ]), - ), -}); - -export type V2PluginReadResponse__PluginSummary = { - readonly authPolicy: V2PluginReadResponse__PluginAuthPolicy; - readonly availability?: "DISABLED_BY_ADMIN" | "AVAILABLE"; - readonly enabled: boolean; - readonly id: string; - readonly installPolicy: V2PluginReadResponse__PluginInstallPolicy; - readonly installPolicySource?: V2PluginReadResponse__PluginInstallPolicySource | null; - readonly installed: boolean; - readonly interface?: V2PluginReadResponse__PluginInterface | null; - readonly keywords?: ReadonlyArray; - readonly localVersion?: string | null; - readonly mustShowInstallationInterstitial?: boolean | null; - readonly name: string; - readonly remotePluginId?: string | null; - readonly shareContext?: V2PluginReadResponse__PluginShareContext | null; - readonly source: V2PluginReadResponse__PluginSource; - readonly version?: string | null; -}; -export const V2PluginReadResponse__PluginSummary = Schema.Struct({ - authPolicy: V2PluginReadResponse__PluginAuthPolicy, - availability: Schema.optionalKey( - Schema.Literals(["DISABLED_BY_ADMIN", "AVAILABLE"]).annotate({ - description: "Availability state for installing and using the plugin.", - default: "AVAILABLE", - }), - ), - enabled: Schema.Boolean, - id: Schema.String, - installPolicy: V2PluginReadResponse__PluginInstallPolicy, - installPolicySource: Schema.optionalKey( - Schema.Union([V2PluginReadResponse__PluginInstallPolicySource, Schema.Null]), - ), - installed: Schema.Boolean, - interface: Schema.optionalKey(Schema.Union([V2PluginReadResponse__PluginInterface, Schema.Null])), - keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - localVersion: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version of the locally materialized plugin package when available.", + }).annotate({ title: "CollabAgentToolCallThreadItem" }), + Schema.Struct({ + agentPath: Schema.String, + agentThreadId: Schema.String, + id: Schema.String, + kind: V2TurnStartedNotification__SubAgentActivityKind, + type: Schema.Literal("subAgentActivity").annotate({ + title: "SubAgentActivityThreadItemType", }), - Schema.Null, - ]), - ), - mustShowInstallationInterstitial: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - name: Schema.String, - remotePluginId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "Backend remote plugin identifier when available." }), - Schema.Null, - ]), - ), - shareContext: Schema.optionalKey( - Schema.Union([V2PluginReadResponse__PluginShareContext, Schema.Null]).annotate({ - description: "Remote sharing context associated with this plugin when available.", + }).annotate({ title: "SubAgentActivityThreadItem" }), + Schema.Struct({ + action: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__WebSearchAction, Schema.Null]), + ), + id: Schema.String, + query: Schema.String, + results: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: + "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", + }), + Schema.Null, + ]), + ), + type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), + }).annotate({ title: "WebSearchThreadItem" }), + Schema.Struct({ + id: Schema.String, + path: V2TurnStartedNotification__LegacyAppPathString, + type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), + }).annotate({ title: "ImageViewThreadItem" }), + Schema.Struct({ + durationMs: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + id: Schema.String, + type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), + }).annotate({ + title: "SleepThreadItem", + description: "Display item emitted by the interruptible `clock.sleep` tool.", }), - ), - source: V2PluginReadResponse__PluginSource, - version: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version advertised by the remote marketplace backend when available.", + Schema.Struct({ + id: Schema.String, + result: Schema.String, + revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + savedPath: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__AbsolutePathBuf, Schema.Null]), + ), + status: Schema.String, + type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), + }).annotate({ title: "ImageGenerationThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("enteredReviewMode").annotate({ + title: "EnteredReviewModeThreadItemType", }), - Schema.Null, - ]), - ), -}); - -export type V2PluginShareListResponse__PluginSummary = { - readonly authPolicy: V2PluginShareListResponse__PluginAuthPolicy; - readonly availability?: "DISABLED_BY_ADMIN" | "AVAILABLE"; - readonly enabled: boolean; - readonly id: string; - readonly installPolicy: V2PluginShareListResponse__PluginInstallPolicy; - readonly installPolicySource?: V2PluginShareListResponse__PluginInstallPolicySource | null; - readonly installed: boolean; - readonly interface?: V2PluginShareListResponse__PluginInterface | null; - readonly keywords?: ReadonlyArray; - readonly localVersion?: string | null; - readonly mustShowInstallationInterstitial?: boolean | null; - readonly name: string; - readonly remotePluginId?: string | null; - readonly shareContext?: V2PluginShareListResponse__PluginShareContext | null; - readonly source: V2PluginShareListResponse__PluginSource; - readonly version?: string | null; -}; -export const V2PluginShareListResponse__PluginSummary = Schema.Struct({ - authPolicy: V2PluginShareListResponse__PluginAuthPolicy, - availability: Schema.optionalKey( - Schema.Literals(["DISABLED_BY_ADMIN", "AVAILABLE"]).annotate({ - description: "Availability state for installing and using the plugin.", - default: "AVAILABLE", - }), - ), - enabled: Schema.Boolean, - id: Schema.String, - installPolicy: V2PluginShareListResponse__PluginInstallPolicy, - installPolicySource: Schema.optionalKey( - Schema.Union([V2PluginShareListResponse__PluginInstallPolicySource, Schema.Null]), - ), - installed: Schema.Boolean, - interface: Schema.optionalKey( - Schema.Union([V2PluginShareListResponse__PluginInterface, Schema.Null]), - ), - keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), - localVersion: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version of the locally materialized plugin package when available.", + }).annotate({ title: "EnteredReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("exitedReviewMode").annotate({ + title: "ExitedReviewModeThreadItemType", }), - Schema.Null, - ]), - ), - mustShowInstallationInterstitial: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - name: Schema.String, - remotePluginId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "Backend remote plugin identifier when available." }), - Schema.Null, - ]), - ), - shareContext: Schema.optionalKey( - Schema.Union([V2PluginShareListResponse__PluginShareContext, Schema.Null]).annotate({ - description: "Remote sharing context associated with this plugin when available.", - }), - ), - source: V2PluginShareListResponse__PluginSource, - version: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Version advertised by the remote marketplace backend when available.", + }).annotate({ title: "ExitedReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + type: Schema.Literal("contextCompaction").annotate({ + title: "ContextCompactionThreadItemType", }), - Schema.Null, - ]), - ), -}); + }).annotate({ title: "ContextCompactionThreadItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartedNotification__ThreadItem" }); -export type V2RawResponseItemCompletedNotification__ResponseItem = +export type V2TurnStartResponse__ThreadItem = | { - readonly content: ReadonlyArray; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly phase?: V2RawResponseItemCompletedNotification__MessagePhase | null; - readonly role: string; - readonly type: "message"; + readonly clientId?: string | null; + readonly content: ReadonlyArray; + readonly id: string; + readonly type: "userMessage"; } | { - readonly author: string; - readonly content: ReadonlyArray; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly recipient: string; - readonly type: "agent_message"; + readonly fragments: ReadonlyArray; + readonly id: string; + readonly type: "hookPrompt"; } | { - readonly content?: ReadonlyArray | null; - readonly encrypted_content?: string | null; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly summary: ReadonlyArray; - readonly type: "reasoning"; + readonly id: string; + readonly memoryCitation?: V2TurnStartResponse__MemoryCitation | null; + readonly phase?: V2TurnStartResponse__MessagePhase | null; + readonly text: string; + readonly delivery?: "async" | null; + readonly questions?: ReadonlyArray<{ + readonly title: string; + readonly options?: ReadonlyArray | null; + }> | null; + readonly type: "agentMessage"; } + | { readonly id: string; readonly text: string; readonly type: "plan" } | { - readonly action: V2RawResponseItemCompletedNotification__LocalShellAction; - readonly call_id?: string | null; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly status: V2RawResponseItemCompletedNotification__LocalShellStatus; - readonly type: "local_shell_call"; + readonly content?: ReadonlyArray; + readonly id: string; + readonly summary?: ReadonlyArray; + readonly type: "reasoning"; } | { - readonly arguments: string; - readonly call_id: string; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly name: string; - readonly namespace?: string | null; - readonly type: "function_call"; + readonly aggregatedOutput?: string | null; + readonly command: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2TurnStartResponse__LegacyAppPathString; + readonly durationMs?: number | null; + readonly exitCode?: number | null; + readonly id: string; + readonly processId?: string | null; + readonly source?: V2TurnStartResponse__CommandExecutionSource; + readonly status: V2TurnStartResponse__CommandExecutionStatus; + readonly type: "commandExecution"; } | { - readonly arguments: unknown; - readonly call_id?: string | null; - readonly execution: string; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly status?: string | null; - readonly type: "tool_search_call"; + readonly changes: ReadonlyArray; + readonly id: string; + readonly status: V2TurnStartResponse__PatchApplyStatus; + readonly type: "fileChange"; } | { - readonly call_id: string; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody; - readonly type: "function_call_output"; + readonly appContext?: V2TurnStartResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; + readonly durationMs?: number | null; + readonly error?: V2TurnStartResponse__McpToolCallError | null; + readonly id: string; + readonly mcpAppResourceUri?: string | null; + readonly pluginId?: string | null; + readonly result?: V2TurnStartResponse__McpToolCallResult | null; + readonly server: string; + readonly status: V2TurnStartResponse__McpToolCallStatus; + readonly tool: string; + readonly type: "mcpToolCall"; } | { - readonly call_id: string; - readonly id?: string | null; - readonly input: string; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly name: string; + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; + readonly durationMs?: number | null; + readonly id: string; readonly namespace?: string | null; - readonly status?: string | null; - readonly type: "custom_tool_call"; - } - | { - readonly call_id: string; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly name?: string | null; - readonly output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody; - readonly type: "custom_tool_call_output"; + readonly status: V2TurnStartResponse__DynamicToolCallStatus; + readonly success?: boolean | null; + readonly tool: string; + readonly type: "dynamicToolCall"; } | { - readonly call_id?: string | null; - readonly execution: string; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly status: string; - readonly tools: ReadonlyArray; - readonly type: "tool_search_output"; + readonly agentsStates: { readonly [x: string]: V2TurnStartResponse__CollabAgentState }; + readonly id: string; + readonly model?: string | null; + readonly prompt?: string | null; + readonly reasoningEffort?: V2TurnStartResponse__ReasoningEffort | null; + readonly receiverThreadIds: ReadonlyArray; + readonly senderThreadId: string; + readonly status: V2TurnStartResponse__CollabAgentToolCallStatus; + readonly tool: V2TurnStartResponse__CollabAgentTool; + readonly type: "collabAgentToolCall"; } | { - readonly action?: V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction | null; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly status?: string | null; - readonly type: "web_search_call"; + readonly agentPath: string; + readonly agentThreadId: string; + readonly id: string; + readonly kind: V2TurnStartResponse__SubAgentActivityKind; + readonly type: "subAgentActivity"; } | { - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly result: string; - readonly revised_prompt?: string | null; - readonly status: string; - readonly type: "image_generation_call"; + readonly action?: V2TurnStartResponse__WebSearchAction | null; + readonly id: string; + readonly query: string; + readonly results?: ReadonlyArray | null; + readonly type: "webSearch"; } | { - readonly encrypted_content: string; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly type: "compaction"; + readonly id: string; + readonly path: V2TurnStartResponse__LegacyAppPathString; + readonly type: "imageView"; } - | { readonly type: "compaction_trigger" } + | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { - readonly encrypted_content?: string | null; - readonly id?: string | null; - readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; - readonly type: "context_compaction"; + readonly id: string; + readonly result: string; + readonly revisedPrompt?: string | null; + readonly savedPath?: V2TurnStartResponse__AbsolutePathBuf | null; + readonly status: string; + readonly type: "imageGeneration"; } - | { readonly type: "other" }; -export const V2RawResponseItemCompletedNotification__ResponseItem = Schema.Union( + | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } + | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } + | { readonly id: string; readonly type: "contextCompaction" }; +export const V2TurnStartResponse__ThreadItem = Schema.Union( [ Schema.Struct({ - content: Schema.Array(V2RawResponseItemCompletedNotification__ContentItem), - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, - Schema.Null, - ]), - ), - phase: Schema.optionalKey( - Schema.Union([V2RawResponseItemCompletedNotification__MessagePhase, Schema.Null]), - ), - role: Schema.String, - type: Schema.Literal("message").annotate({ title: "MessageResponseItemType" }), - }).annotate({ title: "MessageResponseItem" }), + clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + content: Schema.Array(V2TurnStartResponse__UserInput), + id: Schema.String, + type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), + }).annotate({ title: "UserMessageThreadItem" }), + Schema.Struct({ + fragments: Schema.Array(V2TurnStartResponse__HookPromptFragment), + id: Schema.String, + type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), + }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ - author: Schema.String, - content: Schema.Array(V2RawResponseItemCompletedNotification__AgentMessageInputContent), - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + id: Schema.String, + memoryCitation: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey(Schema.Union([V2TurnStartResponse__MessagePhase, Schema.Null])), + text: Schema.String, + delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + questions: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Array( + Schema.Struct({ + title: Schema.String, + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + }), + ), Schema.Null, ]), ), - recipient: Schema.String, - type: Schema.Literal("agent_message").annotate({ title: "AgentMessageResponseItemType" }), - }).annotate({ title: "AgentMessageResponseItem" }), + type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), + }).annotate({ title: "AgentMessageThreadItem" }), Schema.Struct({ - content: Schema.optionalKey( + id: Schema.String, + text: Schema.String, + type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), + }).annotate({ + title: "PlanThreadItem", + description: + "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", + }), + Schema.Struct({ + content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + id: Schema.String, + summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), + }).annotate({ title: "ReasoningThreadItem" }), + Schema.Struct({ + aggregatedOutput: Schema.optionalKey( Schema.Union([ - Schema.Array(V2RawResponseItemCompletedNotification__ReasoningItemContent), + Schema.String.annotate({ + description: "The command's output, aggregated from stdout and stderr.", + }), Schema.Null, ]), ), - encrypted_content: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + command: Schema.String.annotate({ description: "The command to be executed." }), + commandActions: Schema.Array(V2TurnStartResponse__CommandAction).annotate({ + description: + "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", + }), + cwd: Schema.suspend( + (): Schema.Codec => + V2TurnStartResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), + durationMs: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Number.annotate({ + description: "The duration of the command execution in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - summary: Schema.Array(V2RawResponseItemCompletedNotification__ReasoningItemReasoningSummary), - type: Schema.Literal("reasoning").annotate({ title: "ReasoningResponseItemType" }), - }).annotate({ title: "ReasoningResponseItem" }), - Schema.Struct({ - action: V2RawResponseItemCompletedNotification__LocalShellAction, - call_id: Schema.optionalKey( + exitCode: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ description: "Set when using the Responses API." }), + Schema.Number.annotate({ + description: "The command's exit code.", + format: "int32", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - id: Schema.optionalKey( + id: Schema.String, + processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Legacy id field retained for compatibility with older payloads.", + description: "Identifier for the underlying PTY process (when available).", }), Schema.Null, ]), ), - internal_chat_message_metadata_passthrough: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, - Schema.Null, - ]), + source: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2TurnStartResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), ), - status: V2RawResponseItemCompletedNotification__LocalShellStatus, - type: Schema.Literal("local_shell_call").annotate({ - title: "LocalShellCallResponseItemType", + status: V2TurnStartResponse__CommandExecutionStatus, + type: Schema.Literal("commandExecution").annotate({ + title: "CommandExecutionThreadItemType", }), - }).annotate({ title: "LocalShellCallResponseItem" }), + }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - arguments: Schema.String, - call_id: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + changes: Schema.Array(V2TurnStartResponse__FileUpdateChange), + id: Schema.String, + status: V2TurnStartResponse__PatchApplyStatus, + type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), + }).annotate({ title: "FileChangeThreadItem" }), + Schema.Struct({ + appContext: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__McpToolCallAppContext, Schema.Null]), + ), + arguments: Schema.Json.annotate({ expected: "JSON value" }), + durationMs: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Number.annotate({ + description: "The duration of the MCP tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - name: Schema.String, - namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("function_call").annotate({ title: "FunctionCallResponseItemType" }), - }).annotate({ title: "FunctionCallResponseItem" }), - Schema.Struct({ - arguments: Schema.Unknown, - call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - execution: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + error: Schema.optionalKey(Schema.Union([V2TurnStartResponse__McpToolCallError, Schema.Null])), + id: Schema.String, + mcpAppResourceUri: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.String.annotate({ + description: "Deprecated: use `appContext.resourceUri` instead.", + }), Schema.Null, ]), ), - status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("tool_search_call").annotate({ - title: "ToolSearchCallResponseItemType", - }), - }).annotate({ title: "ToolSearchCallResponseItem" }), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + result: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__McpToolCallResult, Schema.Null]), + ), + server: Schema.String, + status: V2TurnStartResponse__McpToolCallStatus, + tool: Schema.String, + type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), + }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - call_id: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + arguments: Schema.Json.annotate({ expected: "JSON value" }), + contentItems: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Array(V2TurnStartResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), - output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody, - type: Schema.Literal("function_call_output").annotate({ - title: "FunctionCallOutputResponseItemType", - }), - }).annotate({ title: "FunctionCallOutputResponseItem" }), - Schema.Struct({ - call_id: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - input: Schema.String, - internal_chat_message_metadata_passthrough: Schema.optionalKey( + durationMs: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Number.annotate({ + description: "The duration of the dynamic tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - name: Schema.String, + id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("custom_tool_call").annotate({ - title: "CustomToolCallResponseItemType", - }), - }).annotate({ title: "CustomToolCallResponseItem" }), + status: V2TurnStartResponse__DynamicToolCallStatus, + success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + tool: Schema.String, + type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), + }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - call_id: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + agentsStates: Schema.Record(Schema.String, V2TurnStartResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), + id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), + model: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.String.annotate({ + description: "Model requested for the spawned agent, when applicable.", + }), Schema.Null, ]), ), - name: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody, - type: Schema.Literal("custom_tool_call_output").annotate({ - title: "CustomToolCallOutputResponseItemType", + prompt: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Prompt text sent as part of the collab tool call, when available.", + }), + Schema.Null, + ]), + ), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__ReasoningEffort, Schema.Null]).annotate({ + description: "Reasoning effort requested for the spawned agent, when applicable.", + }), + ), + receiverThreadIds: Schema.Array(Schema.String).annotate({ + description: + "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", }), - }).annotate({ title: "CustomToolCallOutputResponseItem" }), + senderThreadId: Schema.String.annotate({ + description: "Thread ID of the agent issuing the collab request.", + }), + status: Schema.suspend( + (): Schema.Codec => + V2TurnStartResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2TurnStartResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), + type: Schema.Literal("collabAgentToolCall").annotate({ + title: "CollabAgentToolCallThreadItemType", + }), + }).annotate({ title: "CollabAgentToolCallThreadItem" }), Schema.Struct({ - call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - execution: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + agentPath: Schema.String, + agentThreadId: Schema.String, + id: Schema.String, + kind: V2TurnStartResponse__SubAgentActivityKind, + type: Schema.Literal("subAgentActivity").annotate({ + title: "SubAgentActivityThreadItemType", + }), + }).annotate({ title: "SubAgentActivityThreadItem" }), + Schema.Struct({ + action: Schema.optionalKey(Schema.Union([V2TurnStartResponse__WebSearchAction, Schema.Null])), + id: Schema.String, + query: Schema.String, + results: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: + "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", + }), Schema.Null, ]), ), + type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), + }).annotate({ title: "WebSearchThreadItem" }), + Schema.Struct({ + id: Schema.String, + path: V2TurnStartResponse__LegacyAppPathString, + type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), + }).annotate({ title: "ImageViewThreadItem" }), + Schema.Struct({ + durationMs: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + id: Schema.String, + type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), + }).annotate({ + title: "SleepThreadItem", + description: "Display item emitted by the interruptible `clock.sleep` tool.", + }), + Schema.Struct({ + id: Schema.String, + result: Schema.String, + revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + savedPath: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__AbsolutePathBuf, Schema.Null]), + ), status: Schema.String, - tools: Schema.Array(Schema.Unknown), - type: Schema.Literal("tool_search_output").annotate({ - title: "ToolSearchOutputResponseItemType", + type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), + }).annotate({ title: "ImageGenerationThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("enteredReviewMode").annotate({ + title: "EnteredReviewModeThreadItemType", + }), + }).annotate({ title: "EnteredReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("exitedReviewMode").annotate({ + title: "ExitedReviewModeThreadItemType", + }), + }).annotate({ title: "ExitedReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + type: Schema.Literal("contextCompaction").annotate({ + title: "ContextCompactionThreadItemType", + }), + }).annotate({ title: "ContextCompactionThreadItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartResponse__ThreadItem" }); + +export type CommandExecutionRequestApprovalParams__AdditionalFileSystemPermissions = { + readonly entries?: ReadonlyArray | null; + readonly globScanMaxDepth?: number | null; + readonly read?: ReadonlyArray | null; + readonly write?: ReadonlyArray | null; +}; +export const CommandExecutionRequestApprovalParams__AdditionalFileSystemPermissions = Schema.Struct( + { + entries: Schema.optionalKey( + Schema.Union([ + Schema.Array(CommandExecutionRequestApprovalParams__FileSystemSandboxEntry), + Schema.Null, + ]), + ), + globScanMaxDepth: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(1).annotate({ + expected: "a value greater than or equal to 1", + }), + ), + Schema.Null, + ]), + ), + read: Schema.optionalKey( + Schema.Union([ + Schema.Array(CommandExecutionRequestApprovalParams__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", + }), + Schema.Null, + ]), + ), + write: Schema.optionalKey( + Schema.Union([ + Schema.Array(CommandExecutionRequestApprovalParams__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", + }), + Schema.Null, + ]), + ), + }, +).annotate({ + identifier: "CommandExecutionRequestApprovalParams__AdditionalFileSystemPermissions", +}); + +export type McpServerElicitationRequestParams__McpElicitationEnumSchema = + | McpServerElicitationRequestParams__McpElicitationSingleSelectEnumSchema + | McpServerElicitationRequestParams__McpElicitationMultiSelectEnumSchema + | McpServerElicitationRequestParams__McpElicitationLegacyTitledEnumSchema; +export const McpServerElicitationRequestParams__McpElicitationEnumSchema = Schema.Union([ + McpServerElicitationRequestParams__McpElicitationSingleSelectEnumSchema, + McpServerElicitationRequestParams__McpElicitationMultiSelectEnumSchema, + McpServerElicitationRequestParams__McpElicitationLegacyTitledEnumSchema, +]).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationEnumSchema" }); + +export type PermissionsRequestApprovalParams__AdditionalFileSystemPermissions = { + readonly entries?: ReadonlyArray | null; + readonly globScanMaxDepth?: number | null; + readonly read?: ReadonlyArray | null; + readonly write?: ReadonlyArray | null; +}; +export const PermissionsRequestApprovalParams__AdditionalFileSystemPermissions = Schema.Struct({ + entries: Schema.optionalKey( + Schema.Union([ + Schema.Array(PermissionsRequestApprovalParams__FileSystemSandboxEntry), + Schema.Null, + ]), + ), + globScanMaxDepth: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(1).annotate({ + expected: "a value greater than or equal to 1", + }), + ), + Schema.Null, + ]), + ), + read: Schema.optionalKey( + Schema.Union([ + Schema.Array(PermissionsRequestApprovalParams__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", + }), + Schema.Null, + ]), + ), + write: Schema.optionalKey( + Schema.Union([ + Schema.Array(PermissionsRequestApprovalParams__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "PermissionsRequestApprovalParams__AdditionalFileSystemPermissions" }); + +export type PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions = { + readonly entries?: ReadonlyArray | null; + readonly globScanMaxDepth?: number | null; + readonly read?: ReadonlyArray | null; + readonly write?: ReadonlyArray | null; +}; +export const PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions = Schema.Struct({ + entries: Schema.optionalKey( + Schema.Union([ + Schema.Array(PermissionsRequestApprovalResponse__FileSystemSandboxEntry), + Schema.Null, + ]), + ), + globScanMaxDepth: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(1).annotate({ + expected: "a value greater than or equal to 1", + }), + ), + Schema.Null, + ]), + ), + read: Schema.optionalKey( + Schema.Union([ + Schema.Array(PermissionsRequestApprovalResponse__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", + }), + Schema.Null, + ]), + ), + write: Schema.optionalKey( + Schema.Union([ + Schema.Array(PermissionsRequestApprovalResponse__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions" }); + +export type ServerNotification__Turn = { + readonly completedAt?: number | null; + readonly durationMs?: number | null; + readonly error?: ServerNotification__TurnError | null; + readonly id: string; + readonly items: ReadonlyArray; + readonly itemsView?: ServerNotification__TurnItemsView; + readonly startedAt?: number | null; + readonly status: ServerNotification__TurnStatus; +}; +export const ServerNotification__Turn = Schema.Struct({ + completedAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the turn completed.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Duration between turn start and completion in milliseconds, if known.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + error: Schema.optionalKey( + Schema.Union([ServerNotification__TurnError, Schema.Null]).annotate({ + description: "Only populated when the Turn's status is failed.", + }), + ), + id: Schema.String.annotate({ + description: "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", + }), + items: Schema.Array(ServerNotification__ThreadItem).annotate({ + description: "Thread items currently included in this turn payload.", + }), + itemsView: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => ServerNotification__TurnItemsView, + ).annotate({ + description: "Describes how much of `items` has been loaded for this turn.", + default: "full", + }), + ), + startedAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the turn started.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + status: ServerNotification__TurnStatus, +}).annotate({ identifier: "ServerNotification__Turn" }); + +export type ServerNotification__ItemStartedNotification = { + readonly item: ServerNotification__ThreadItem; + readonly startedAtMs: number; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__ItemStartedNotification = Schema.Struct({ + item: ServerNotification__ThreadItem, + startedAtMs: Schema.Number.annotate({ + description: "Unix timestamp (in milliseconds) when this item lifecycle started.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__ItemStartedNotification" }); + +export type ServerNotification__ItemCompletedNotification = { + readonly completedAtMs: number; + readonly item: ServerNotification__ThreadItem; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__ItemCompletedNotification = Schema.Struct({ + completedAtMs: Schema.Number.annotate({ + description: "Unix timestamp (in milliseconds) when this item lifecycle completed.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + item: ServerNotification__ThreadItem, + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__ItemCompletedNotification" }); + +export type ServerNotification__AdditionalFileSystemPermissions = { + readonly entries?: ReadonlyArray | null; + readonly globScanMaxDepth?: number | null; + readonly read?: ReadonlyArray | null; + readonly write?: ReadonlyArray | null; +}; +export const ServerNotification__AdditionalFileSystemPermissions = Schema.Struct({ + entries: Schema.optionalKey( + Schema.Union([Schema.Array(ServerNotification__FileSystemSandboxEntry), Schema.Null]), + ), + globScanMaxDepth: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(1).annotate({ + expected: "a value greater than or equal to 1", + }), + ), + Schema.Null, + ]), + ), + read: Schema.optionalKey( + Schema.Union([ + Schema.Array(ServerNotification__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", }), - }).annotate({ title: "ToolSearchOutputResponseItem" }), - Schema.Struct({ - action: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction, - Schema.Null, - ]), - ), - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, - Schema.Null, - ]), - ), - status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("web_search_call").annotate({ title: "WebSearchCallResponseItemType" }), - }).annotate({ title: "WebSearchCallResponseItem" }), - Schema.Struct({ - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, - Schema.Null, - ]), - ), - result: Schema.String, - revised_prompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: Schema.String, - type: Schema.Literal("image_generation_call").annotate({ - title: "ImageGenerationCallResponseItemType", + Schema.Null, + ]), + ), + write: Schema.optionalKey( + Schema.Union([ + Schema.Array(ServerNotification__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", }), - }).annotate({ title: "ImageGenerationCallResponseItem" }), - Schema.Struct({ - encrypted_content: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, - Schema.Null, - ]), - ), - type: Schema.Literal("compaction").annotate({ title: "CompactionResponseItemType" }), - }).annotate({ title: "CompactionResponseItem" }), - Schema.Struct({ - type: Schema.Literal("compaction_trigger").annotate({ - title: "CompactionTriggerResponseItemType", + Schema.Null, + ]), + ), +}).annotate({ identifier: "ServerNotification__AdditionalFileSystemPermissions" }); + +export type ServerNotification__ThreadSettingsUpdatedNotification = { + readonly threadId: string; + readonly threadSettings: ServerNotification__ThreadSettings; +}; +export const ServerNotification__ThreadSettingsUpdatedNotification = Schema.Struct({ + threadId: Schema.String, + threadSettings: ServerNotification__ThreadSettings, +}).annotate({ identifier: "ServerNotification__ThreadSettingsUpdatedNotification" }); + +export type ServerRequest__AdditionalFileSystemPermissions = { + readonly entries?: ReadonlyArray | null; + readonly globScanMaxDepth?: number | null; + readonly read?: ReadonlyArray | null; + readonly write?: ReadonlyArray | null; +}; +export const ServerRequest__AdditionalFileSystemPermissions = Schema.Struct({ + entries: Schema.optionalKey( + Schema.Union([Schema.Array(ServerRequest__FileSystemSandboxEntry), Schema.Null]), + ), + globScanMaxDepth: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(1).annotate({ + expected: "a value greater than or equal to 1", + }), + ), + Schema.Null, + ]), + ), + read: Schema.optionalKey( + Schema.Union([ + Schema.Array(ServerRequest__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", }), - }).annotate({ title: "CompactionTriggerResponseItem" }), - Schema.Struct({ - encrypted_content: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, - Schema.Null, - ]), - ), - type: Schema.Literal("context_compaction").annotate({ - title: "ContextCompactionResponseItemType", + Schema.Null, + ]), + ), + write: Schema.optionalKey( + Schema.Union([ + Schema.Array(ServerRequest__LegacyAppPathString).annotate({ + description: "This will be removed in favor of `entries`.", }), - }).annotate({ title: "ContextCompactionResponseItem" }), - Schema.Struct({ - type: Schema.Literal("other").annotate({ title: "OtherResponseItemType" }), - }).annotate({ title: "OtherResponseItem" }), - ], - { mode: "oneOf" }, -); + Schema.Null, + ]), + ), +}).annotate({ identifier: "ServerRequest__AdditionalFileSystemPermissions" }); + +export type ServerRequest__McpElicitationEnumSchema = + | ServerRequest__McpElicitationSingleSelectEnumSchema + | ServerRequest__McpElicitationMultiSelectEnumSchema + | ServerRequest__McpElicitationLegacyTitledEnumSchema; +export const ServerRequest__McpElicitationEnumSchema = Schema.Union([ + ServerRequest__McpElicitationSingleSelectEnumSchema, + ServerRequest__McpElicitationMultiSelectEnumSchema, + ServerRequest__McpElicitationLegacyTitledEnumSchema, +]).annotate({ identifier: "ServerRequest__McpElicitationEnumSchema" }); + +export type V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions = { + readonly entries?: ReadonlyArray | null; + readonly globScanMaxDepth?: number | null; + readonly read?: ReadonlyArray | null; + readonly write?: ReadonlyArray | null; +}; +export const V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions = + Schema.Struct({ + entries: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSandboxEntry), + Schema.Null, + ]), + ), + globScanMaxDepth: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(1).annotate({ + expected: "a value greater than or equal to 1", + }), + ), + Schema.Null, + ]), + ), + read: Schema.optionalKey( + Schema.Union([ + Schema.Array( + V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString, + ).annotate({ description: "This will be removed in favor of `entries`." }), + Schema.Null, + ]), + ), + write: Schema.optionalKey( + Schema.Union([ + Schema.Array( + V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString, + ).annotate({ description: "This will be removed in favor of `entries`." }), + Schema.Null, + ]), + ), + }).annotate({ + identifier: + "V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions", + }); + +export type V2ItemGuardianApprovalReviewStartedNotification__AdditionalFileSystemPermissions = { + readonly entries?: ReadonlyArray | null; + readonly globScanMaxDepth?: number | null; + readonly read?: ReadonlyArray | null; + readonly write?: ReadonlyArray | null; +}; +export const V2ItemGuardianApprovalReviewStartedNotification__AdditionalFileSystemPermissions = + Schema.Struct({ + entries: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ItemGuardianApprovalReviewStartedNotification__FileSystemSandboxEntry), + Schema.Null, + ]), + ), + globScanMaxDepth: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(1).annotate({ + expected: "a value greater than or equal to 1", + }), + ), + Schema.Null, + ]), + ), + read: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString).annotate( + { description: "This will be removed in favor of `entries`." }, + ), + Schema.Null, + ]), + ), + write: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString).annotate( + { description: "This will be removed in favor of `entries`." }, + ), + Schema.Null, + ]), + ), + }).annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__AdditionalFileSystemPermissions", + }); + +export type V2PluginInstalledResponse__PluginMarketplaceEntry = { + readonly interface?: V2PluginInstalledResponse__MarketplaceInterface | null; + readonly name: string; + readonly path?: V2PluginInstalledResponse__AbsolutePathBuf | null; + readonly plugins: ReadonlyArray; +}; +export const V2PluginInstalledResponse__PluginMarketplaceEntry = Schema.Struct({ + interface: Schema.optionalKey( + Schema.Union([V2PluginInstalledResponse__MarketplaceInterface, Schema.Null]), + ), + name: Schema.String, + path: Schema.optionalKey( + Schema.Union([V2PluginInstalledResponse__AbsolutePathBuf, Schema.Null]).annotate({ + description: + "Local marketplace file path when the marketplace is backed by a local file. Remote-only catalog marketplaces do not have a local path.", + }), + ), + plugins: Schema.Array(V2PluginInstalledResponse__PluginSummary), +}).annotate({ identifier: "V2PluginInstalledResponse__PluginMarketplaceEntry" }); + +export type V2PluginListResponse__PluginMarketplaceEntry = { + readonly interface?: V2PluginListResponse__MarketplaceInterface | null; + readonly name: string; + readonly path?: V2PluginListResponse__AbsolutePathBuf | null; + readonly plugins: ReadonlyArray; +}; +export const V2PluginListResponse__PluginMarketplaceEntry = Schema.Struct({ + interface: Schema.optionalKey( + Schema.Union([V2PluginListResponse__MarketplaceInterface, Schema.Null]), + ), + name: Schema.String, + path: Schema.optionalKey( + Schema.Union([V2PluginListResponse__AbsolutePathBuf, Schema.Null]).annotate({ + description: + "Local marketplace file path when the marketplace is backed by a local file. Remote-only catalog marketplaces do not have a local path.", + }), + ), + plugins: Schema.Array(V2PluginListResponse__PluginSummary), +}).annotate({ identifier: "V2PluginListResponse__PluginMarketplaceEntry" }); + +export type V2PluginReadResponse__PluginDetail = { + readonly appTemplates: ReadonlyArray; + readonly apps: ReadonlyArray; + readonly description?: string | null; + readonly hooks: ReadonlyArray; + readonly marketplaceName: string; + readonly marketplacePath?: V2PluginReadResponse__AbsolutePathBuf | null; + readonly mcpServers: ReadonlyArray; + readonly scheduledTasks?: ReadonlyArray | null; + readonly shareUrl?: string | null; + readonly skills: ReadonlyArray; + readonly summary: V2PluginReadResponse__PluginSummary; +}; +export const V2PluginReadResponse__PluginDetail = Schema.Struct({ + appTemplates: Schema.Array(V2PluginReadResponse__AppTemplateSummary), + apps: Schema.Array(V2PluginReadResponse__AppSummary), + description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + hooks: Schema.Array(V2PluginReadResponse__PluginHookSummary), + marketplaceName: Schema.String, + marketplacePath: Schema.optionalKey( + Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null]), + ), + mcpServers: Schema.Array(Schema.String), + scheduledTasks: Schema.optionalKey( + Schema.Union([Schema.Array(V2PluginReadResponse__ScheduledTaskSummary), Schema.Null]), + ), + shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + skills: Schema.Array(V2PluginReadResponse__SkillSummary), + summary: V2PluginReadResponse__PluginSummary, +}).annotate({ identifier: "V2PluginReadResponse__PluginDetail" }); + +export type V2PluginShareListResponse__PluginShareListItem = { + readonly localPluginPath?: V2PluginShareListResponse__AbsolutePathBuf | null; + readonly plugin: V2PluginShareListResponse__PluginSummary; +}; +export const V2PluginShareListResponse__PluginShareListItem = Schema.Struct({ + localPluginPath: Schema.optionalKey( + Schema.Union([V2PluginShareListResponse__AbsolutePathBuf, Schema.Null]), + ), + plugin: V2PluginShareListResponse__PluginSummary, +}).annotate({ identifier: "V2PluginShareListResponse__PluginShareListItem" }); export type V2ReviewStartResponse__Turn = { readonly completedAt?: number | null; @@ -29437,7 +33862,7 @@ export type V2ReviewStartResponse__Turn = { readonly error?: V2ReviewStartResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ReviewStartResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ReviewStartResponse__TurnStatus; }; @@ -29447,7 +33872,7 @@ export const V2ReviewStartResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29456,7 +33881,7 @@ export const V2ReviewStartResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29472,7 +33897,10 @@ export const V2ReviewStartResponse__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => + V2ReviewStartResponse__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -29482,23 +33910,12 @@ export const V2ReviewStartResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ReviewStartResponse__TurnStatus, -}); - -export type V2SkillsListResponse__SkillsListEntry = { - readonly cwd: string; - readonly errors: ReadonlyArray; - readonly skills: ReadonlyArray; -}; -export const V2SkillsListResponse__SkillsListEntry = Schema.Struct({ - cwd: Schema.String, - errors: Schema.Array(V2SkillsListResponse__SkillErrorInfo), - skills: Schema.Array(V2SkillsListResponse__SkillMetadata), -}); +}).annotate({ identifier: "V2ReviewStartResponse__Turn" }); export type V2ThreadForkResponse__Turn = { readonly completedAt?: number | null; @@ -29506,7 +33923,7 @@ export type V2ThreadForkResponse__Turn = { readonly error?: V2ThreadForkResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ThreadForkResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ThreadForkResponse__TurnStatus; }; @@ -29516,7 +33933,7 @@ export const V2ThreadForkResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29525,7 +33942,7 @@ export const V2ThreadForkResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29541,7 +33958,9 @@ export const V2ThreadForkResponse__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => V2ThreadForkResponse__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -29551,12 +33970,12 @@ export const V2ThreadForkResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ThreadForkResponse__TurnStatus, -}); +}).annotate({ identifier: "V2ThreadForkResponse__Turn" }); export type V2ThreadListResponse__Turn = { readonly completedAt?: number | null; @@ -29564,7 +33983,7 @@ export type V2ThreadListResponse__Turn = { readonly error?: V2ThreadListResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ThreadListResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ThreadListResponse__TurnStatus; }; @@ -29574,7 +33993,7 @@ export const V2ThreadListResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29583,7 +34002,7 @@ export const V2ThreadListResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29599,7 +34018,9 @@ export const V2ThreadListResponse__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => V2ThreadListResponse__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -29609,12 +34030,12 @@ export const V2ThreadListResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ThreadListResponse__TurnStatus, -}); +}).annotate({ identifier: "V2ThreadListResponse__Turn" }); export type V2ThreadMetadataUpdateResponse__Turn = { readonly completedAt?: number | null; @@ -29622,7 +34043,7 @@ export type V2ThreadMetadataUpdateResponse__Turn = { readonly error?: V2ThreadMetadataUpdateResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ThreadMetadataUpdateResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ThreadMetadataUpdateResponse__TurnStatus; }; @@ -29632,7 +34053,7 @@ export const V2ThreadMetadataUpdateResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29641,7 +34062,7 @@ export const V2ThreadMetadataUpdateResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29657,7 +34078,10 @@ export const V2ThreadMetadataUpdateResponse__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -29667,12 +34091,12 @@ export const V2ThreadMetadataUpdateResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ThreadMetadataUpdateResponse__TurnStatus, -}); +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__Turn" }); export type V2ThreadReadResponse__Turn = { readonly completedAt?: number | null; @@ -29680,7 +34104,7 @@ export type V2ThreadReadResponse__Turn = { readonly error?: V2ThreadReadResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ThreadReadResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ThreadReadResponse__TurnStatus; }; @@ -29690,7 +34114,7 @@ export const V2ThreadReadResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29699,7 +34123,7 @@ export const V2ThreadReadResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29715,7 +34139,9 @@ export const V2ThreadReadResponse__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => V2ThreadReadResponse__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -29725,12 +34151,12 @@ export const V2ThreadReadResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ThreadReadResponse__TurnStatus, -}); +}).annotate({ identifier: "V2ThreadReadResponse__Turn" }); export type V2ThreadResumeResponse__Turn = { readonly completedAt?: number | null; @@ -29738,7 +34164,7 @@ export type V2ThreadResumeResponse__Turn = { readonly error?: V2ThreadResumeResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ThreadResumeResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ThreadResumeResponse__TurnStatus; }; @@ -29748,7 +34174,7 @@ export const V2ThreadResumeResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29757,7 +34183,7 @@ export const V2ThreadResumeResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29773,7 +34199,10 @@ export const V2ThreadResumeResponse__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -29783,12 +34212,12 @@ export const V2ThreadResumeResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ThreadResumeResponse__TurnStatus, -}); +}).annotate({ identifier: "V2ThreadResumeResponse__Turn" }); export type V2ThreadRollbackResponse__Turn = { readonly completedAt?: number | null; @@ -29796,7 +34225,7 @@ export type V2ThreadRollbackResponse__Turn = { readonly error?: V2ThreadRollbackResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ThreadRollbackResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ThreadRollbackResponse__TurnStatus; }; @@ -29806,7 +34235,7 @@ export const V2ThreadRollbackResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29815,7 +34244,7 @@ export const V2ThreadRollbackResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29831,7 +34260,10 @@ export const V2ThreadRollbackResponse__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => + V2ThreadRollbackResponse__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -29841,49 +34273,12 @@ export const V2ThreadRollbackResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ThreadRollbackResponse__TurnStatus, -}); - -export type V2ThreadSettingsUpdatedNotification__ThreadSettings = { - readonly activePermissionProfile?: V2ThreadSettingsUpdatedNotification__ActivePermissionProfile | null; - readonly approvalPolicy: V2ThreadSettingsUpdatedNotification__AskForApproval; - readonly approvalsReviewer: V2ThreadSettingsUpdatedNotification__ApprovalsReviewer; - readonly collaborationMode: V2ThreadSettingsUpdatedNotification__CollaborationMode; - readonly cwd: V2ThreadSettingsUpdatedNotification__AbsolutePathBuf; - readonly effort?: V2ThreadSettingsUpdatedNotification__ReasoningEffort | null; - readonly model: string; - readonly modelProvider: string; - readonly personality?: V2ThreadSettingsUpdatedNotification__Personality | null; - readonly sandboxPolicy: V2ThreadSettingsUpdatedNotification__SandboxPolicy; - readonly serviceTier?: string | null; - readonly summary?: V2ThreadSettingsUpdatedNotification__ReasoningSummary | null; -}; -export const V2ThreadSettingsUpdatedNotification__ThreadSettings = Schema.Struct({ - activePermissionProfile: Schema.optionalKey( - Schema.Union([V2ThreadSettingsUpdatedNotification__ActivePermissionProfile, Schema.Null]), - ), - approvalPolicy: V2ThreadSettingsUpdatedNotification__AskForApproval, - approvalsReviewer: V2ThreadSettingsUpdatedNotification__ApprovalsReviewer, - collaborationMode: V2ThreadSettingsUpdatedNotification__CollaborationMode, - cwd: V2ThreadSettingsUpdatedNotification__AbsolutePathBuf, - effort: Schema.optionalKey( - Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningEffort, Schema.Null]), - ), - model: Schema.String, - modelProvider: Schema.String, - personality: Schema.optionalKey( - Schema.Union([V2ThreadSettingsUpdatedNotification__Personality, Schema.Null]), - ), - sandboxPolicy: V2ThreadSettingsUpdatedNotification__SandboxPolicy, - serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - summary: Schema.optionalKey( - Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningSummary, Schema.Null]), - ), -}); +}).annotate({ identifier: "V2ThreadRollbackResponse__Turn" }); export type V2ThreadStartedNotification__Turn = { readonly completedAt?: number | null; @@ -29891,7 +34286,7 @@ export type V2ThreadStartedNotification__Turn = { readonly error?: V2ThreadStartedNotification__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ThreadStartedNotification__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ThreadStartedNotification__TurnStatus; }; @@ -29901,7 +34296,7 @@ export const V2ThreadStartedNotification__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29910,7 +34305,7 @@ export const V2ThreadStartedNotification__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29926,7 +34321,10 @@ export const V2ThreadStartedNotification__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -29936,12 +34334,12 @@ export const V2ThreadStartedNotification__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ThreadStartedNotification__TurnStatus, -}); +}).annotate({ identifier: "V2ThreadStartedNotification__Turn" }); export type V2ThreadStartResponse__Turn = { readonly completedAt?: number | null; @@ -29949,7 +34347,7 @@ export type V2ThreadStartResponse__Turn = { readonly error?: V2ThreadStartResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ThreadStartResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ThreadStartResponse__TurnStatus; }; @@ -29959,7 +34357,7 @@ export const V2ThreadStartResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29968,7 +34366,7 @@ export const V2ThreadStartResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -29984,7 +34382,10 @@ export const V2ThreadStartResponse__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => + V2ThreadStartResponse__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -29994,12 +34395,12 @@ export const V2ThreadStartResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ThreadStartResponse__TurnStatus, -}); +}).annotate({ identifier: "V2ThreadStartResponse__Turn" }); export type V2ThreadUnarchiveResponse__Turn = { readonly completedAt?: number | null; @@ -30007,7 +34408,7 @@ export type V2ThreadUnarchiveResponse__Turn = { readonly error?: V2ThreadUnarchiveResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2ThreadUnarchiveResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2ThreadUnarchiveResponse__TurnStatus; }; @@ -30017,7 +34418,7 @@ export const V2ThreadUnarchiveResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -30026,7 +34427,7 @@ export const V2ThreadUnarchiveResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -30042,7 +34443,10 @@ export const V2ThreadUnarchiveResponse__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => + V2ThreadUnarchiveResponse__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -30052,12 +34456,12 @@ export const V2ThreadUnarchiveResponse__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2ThreadUnarchiveResponse__TurnStatus, -}); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__Turn" }); export type V2TurnCompletedNotification__Turn = { readonly completedAt?: number | null; @@ -30065,7 +34469,7 @@ export type V2TurnCompletedNotification__Turn = { readonly error?: V2TurnCompletedNotification__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2TurnCompletedNotification__TurnItemsView; readonly startedAt?: number | null; readonly status: V2TurnCompletedNotification__TurnStatus; }; @@ -30075,7 +34479,7 @@ export const V2TurnCompletedNotification__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -30084,7 +34488,7 @@ export const V2TurnCompletedNotification__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -30100,7 +34504,10 @@ export const V2TurnCompletedNotification__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => + V2TurnCompletedNotification__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -30110,12 +34517,12 @@ export const V2TurnCompletedNotification__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2TurnCompletedNotification__TurnStatus, -}); +}).annotate({ identifier: "V2TurnCompletedNotification__Turn" }); export type V2TurnStartedNotification__Turn = { readonly completedAt?: number | null; @@ -30123,7 +34530,7 @@ export type V2TurnStartedNotification__Turn = { readonly error?: V2TurnStartedNotification__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2TurnStartedNotification__TurnItemsView; readonly startedAt?: number | null; readonly status: V2TurnStartedNotification__TurnStatus; }; @@ -30133,7 +34540,7 @@ export const V2TurnStartedNotification__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -30142,7 +34549,7 @@ export const V2TurnStartedNotification__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Duration between turn start and completion in milliseconds, if known.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -30158,7 +34565,10 @@ export const V2TurnStartedNotification__Turn = Schema.Struct({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ + Schema.suspend( + (): Schema.Codec => + V2TurnStartedNotification__TurnItemsView, + ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", }), @@ -30168,12 +34578,12 @@ export const V2TurnStartedNotification__Turn = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the turn started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), status: V2TurnStartedNotification__TurnStatus, -}); +}).annotate({ identifier: "V2TurnStartedNotification__Turn" }); export type V2TurnStartResponse__Turn = { readonly completedAt?: number | null; @@ -30181,238 +34591,107 @@ export type V2TurnStartResponse__Turn = { readonly error?: V2TurnStartResponse__TurnError | null; readonly id: string; readonly items: ReadonlyArray; - readonly itemsView?: "notLoaded" | "summary" | "full"; + readonly itemsView?: V2TurnStartResponse__TurnItemsView; readonly startedAt?: number | null; readonly status: V2TurnStartResponse__TurnStatus; }; -export const V2TurnStartResponse__Turn = Schema.Struct({ - completedAt: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the turn completed.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - durationMs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Duration between turn start and completion in milliseconds, if known.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - error: Schema.optionalKey( - Schema.Union([V2TurnStartResponse__TurnError, Schema.Null]).annotate({ - description: "Only populated when the Turn's status is failed.", - }), - ), - id: Schema.String.annotate({ - description: "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", - }), - items: Schema.Array(V2TurnStartResponse__ThreadItem).annotate({ - description: "Thread items currently included in this turn payload.", - }), - itemsView: Schema.optionalKey( - Schema.Literals(["notLoaded", "summary", "full"]).annotate({ - description: "Describes how much of `items` has been loaded for this turn.", - default: "full", - }), - ), - startedAt: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the turn started.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - status: V2TurnStartResponse__TurnStatus, -}); - -export type CommandExecutionRequestApprovalParams__AdditionalFileSystemPermissions = { - readonly entries?: ReadonlyArray | null; - readonly globScanMaxDepth?: number | null; - readonly read?: ReadonlyArray | null; - readonly write?: ReadonlyArray | null; -}; -export const CommandExecutionRequestApprovalParams__AdditionalFileSystemPermissions = Schema.Struct( - { - entries: Schema.optionalKey( - Schema.Union([ - Schema.Array(CommandExecutionRequestApprovalParams__FileSystemSandboxEntry), - Schema.Null, - ]), - ), - globScanMaxDepth: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(1)), - Schema.Null, - ]), - ), - read: Schema.optionalKey( - Schema.Union([ - Schema.Array(CommandExecutionRequestApprovalParams__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), - Schema.Null, - ]), - ), - write: Schema.optionalKey( - Schema.Union([ - Schema.Array(CommandExecutionRequestApprovalParams__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), - Schema.Null, - ]), - ), - }, -); - -export type McpServerElicitationRequestParams__McpElicitationEnumSchema = - | McpServerElicitationRequestParams__McpElicitationSingleSelectEnumSchema - | McpServerElicitationRequestParams__McpElicitationMultiSelectEnumSchema - | McpServerElicitationRequestParams__McpElicitationLegacyTitledEnumSchema; -export const McpServerElicitationRequestParams__McpElicitationEnumSchema = Schema.Union([ - McpServerElicitationRequestParams__McpElicitationSingleSelectEnumSchema, - McpServerElicitationRequestParams__McpElicitationMultiSelectEnumSchema, - McpServerElicitationRequestParams__McpElicitationLegacyTitledEnumSchema, -]); - -export type PermissionsRequestApprovalParams__AdditionalFileSystemPermissions = { - readonly entries?: ReadonlyArray | null; - readonly globScanMaxDepth?: number | null; - readonly read?: ReadonlyArray | null; - readonly write?: ReadonlyArray | null; -}; -export const PermissionsRequestApprovalParams__AdditionalFileSystemPermissions = Schema.Struct({ - entries: Schema.optionalKey( - Schema.Union([ - Schema.Array(PermissionsRequestApprovalParams__FileSystemSandboxEntry), - Schema.Null, - ]), - ), - globScanMaxDepth: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(1)), - Schema.Null, - ]), - ), - read: Schema.optionalKey( - Schema.Union([ - Schema.Array(PermissionsRequestApprovalParams__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), - Schema.Null, - ]), - ), - write: Schema.optionalKey( - Schema.Union([ - Schema.Array(PermissionsRequestApprovalParams__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), - Schema.Null, - ]), - ), -}); - -export type PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions = { - readonly entries?: ReadonlyArray | null; - readonly globScanMaxDepth?: number | null; - readonly read?: ReadonlyArray | null; - readonly write?: ReadonlyArray | null; -}; -export const PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions = Schema.Struct({ - entries: Schema.optionalKey( +export const V2TurnStartResponse__Turn = Schema.Struct({ + completedAt: Schema.optionalKey( Schema.Union([ - Schema.Array(PermissionsRequestApprovalResponse__FileSystemSandboxEntry), + Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the turn completed.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - globScanMaxDepth: Schema.optionalKey( + durationMs: Schema.optionalKey( Schema.Union([ - Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(1)), + Schema.Number.annotate({ + description: "Duration between turn start and completion in milliseconds, if known.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - read: Schema.optionalKey( - Schema.Union([ - Schema.Array(PermissionsRequestApprovalResponse__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), - Schema.Null, - ]), + error: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__TurnError, Schema.Null]).annotate({ + description: "Only populated when the Turn's status is failed.", + }), ), - write: Schema.optionalKey( + id: Schema.String.annotate({ + description: "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", + }), + items: Schema.Array(V2TurnStartResponse__ThreadItem).annotate({ + description: "Thread items currently included in this turn payload.", + }), + itemsView: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => V2TurnStartResponse__TurnItemsView, + ).annotate({ + description: "Describes how much of `items` has been loaded for this turn.", + default: "full", + }), + ), + startedAt: Schema.optionalKey( Schema.Union([ - Schema.Array(PermissionsRequestApprovalResponse__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), + Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the turn started.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), -}); + status: V2TurnStartResponse__TurnStatus, +}).annotate({ identifier: "V2TurnStartResponse__Turn" }); -export type ServerNotification__AdditionalFileSystemPermissions = { - readonly entries?: ReadonlyArray | null; - readonly globScanMaxDepth?: number | null; - readonly read?: ReadonlyArray | null; - readonly write?: ReadonlyArray | null; +export type McpServerElicitationRequestParams__McpElicitationPrimitiveSchema = + | McpServerElicitationRequestParams__McpElicitationEnumSchema + | McpServerElicitationRequestParams__McpElicitationStringSchema + | McpServerElicitationRequestParams__McpElicitationNumberSchema + | McpServerElicitationRequestParams__McpElicitationBooleanSchema; +export const McpServerElicitationRequestParams__McpElicitationPrimitiveSchema = Schema.Union([ + McpServerElicitationRequestParams__McpElicitationEnumSchema, + McpServerElicitationRequestParams__McpElicitationStringSchema, + McpServerElicitationRequestParams__McpElicitationNumberSchema, + McpServerElicitationRequestParams__McpElicitationBooleanSchema, +]).annotate({ identifier: "McpServerElicitationRequestParams__McpElicitationPrimitiveSchema" }); + +export type PermissionsRequestApprovalParams__RequestPermissionProfile = { + readonly fileSystem?: PermissionsRequestApprovalParams__AdditionalFileSystemPermissions | null; + readonly network?: PermissionsRequestApprovalParams__AdditionalNetworkPermissions | null; }; -export const ServerNotification__AdditionalFileSystemPermissions = Schema.Struct({ - entries: Schema.optionalKey( - Schema.Union([Schema.Array(ServerNotification__FileSystemSandboxEntry), Schema.Null]), +export const PermissionsRequestApprovalParams__RequestPermissionProfile = Schema.Struct({ + fileSystem: Schema.optionalKey( + Schema.Union([PermissionsRequestApprovalParams__AdditionalFileSystemPermissions, Schema.Null]), ), - globScanMaxDepth: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(1)), - Schema.Null, - ]), + network: Schema.optionalKey( + Schema.Union([PermissionsRequestApprovalParams__AdditionalNetworkPermissions, Schema.Null]), ), - read: Schema.optionalKey( +}).annotate({ identifier: "PermissionsRequestApprovalParams__RequestPermissionProfile" }); + +export type PermissionsRequestApprovalResponse__GrantedPermissionProfile = { + readonly fileSystem?: PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions | null; + readonly network?: PermissionsRequestApprovalResponse__AdditionalNetworkPermissions | null; +}; +export const PermissionsRequestApprovalResponse__GrantedPermissionProfile = Schema.Struct({ + fileSystem: Schema.optionalKey( Schema.Union([ - Schema.Array(ServerNotification__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), + PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions, Schema.Null, ]), ), - write: Schema.optionalKey( - Schema.Union([ - Schema.Array(ServerNotification__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), - Schema.Null, - ]), + network: Schema.optionalKey( + Schema.Union([PermissionsRequestApprovalResponse__AdditionalNetworkPermissions, Schema.Null]), ), -}); - -export type ServerNotification__ThreadSettingsUpdatedNotification = { - readonly threadId: string; - readonly threadSettings: ServerNotification__ThreadSettings; -}; -export const ServerNotification__ThreadSettingsUpdatedNotification = Schema.Struct({ - threadId: Schema.String, - threadSettings: ServerNotification__ThreadSettings, -}); +}).annotate({ identifier: "PermissionsRequestApprovalResponse__GrantedPermissionProfile" }); export type ServerNotification__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: string; + readonly cwd: ServerNotification__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: ServerNotification__GitInfo | null; @@ -30424,22 +34703,8 @@ export type ServerNotification__Thread = { readonly preview: string; readonly recencyAt?: number | null; readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: ServerNotification__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; + readonly source: ServerNotification__SessionSource; + readonly status: ServerNotification__ThreadStatus; readonly threadSource?: ServerNotification__ThreadSource | null; readonly turns: ReadonlyArray; readonly updatedAt: number; @@ -30468,11 +34733,10 @@ export const ServerNotification__Thread = Schema.Struct({ createdAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was created.", format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => ServerNotification__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", }), @@ -30524,42 +34788,20 @@ export const ServerNotification__Thread = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) used for thread recency ordering.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: ServerNotification__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, + source: Schema.suspend( + (): Schema.Codec => ServerNotification__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(ServerNotification__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, + status: Schema.suspend( + (): Schema.Codec => ServerNotification__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( Schema.Union([ServerNotification__ThreadSource, Schema.Null]).annotate({ @@ -30573,241 +34815,115 @@ export const ServerNotification__Thread = Schema.Struct({ updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", - }).check(Schema.isInt()), -}); + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "ServerNotification__Thread" }); -export type ServerNotification__TurnCompletedNotification = { +export type ServerNotification__TurnStartedNotification = { readonly threadId: string; readonly turn: ServerNotification__Turn; }; -export const ServerNotification__TurnCompletedNotification = Schema.Struct({ +export const ServerNotification__TurnStartedNotification = Schema.Struct({ threadId: Schema.String, turn: ServerNotification__Turn, -}); +}).annotate({ identifier: "ServerNotification__TurnStartedNotification" }); -export type ServerNotification__TurnStartedNotification = { +export type ServerNotification__TurnCompletedNotification = { readonly threadId: string; readonly turn: ServerNotification__Turn; }; -export const ServerNotification__TurnStartedNotification = Schema.Struct({ +export const ServerNotification__TurnCompletedNotification = Schema.Struct({ threadId: Schema.String, turn: ServerNotification__Turn, -}); +}).annotate({ identifier: "ServerNotification__TurnCompletedNotification" }); -export type ServerRequest__AdditionalFileSystemPermissions = { - readonly entries?: ReadonlyArray | null; - readonly globScanMaxDepth?: number | null; - readonly read?: ReadonlyArray | null; - readonly write?: ReadonlyArray | null; +export type ServerNotification__RequestPermissionProfile = { + readonly fileSystem?: ServerNotification__AdditionalFileSystemPermissions | null; + readonly network?: ServerNotification__AdditionalNetworkPermissions | null; }; -export const ServerRequest__AdditionalFileSystemPermissions = Schema.Struct({ - entries: Schema.optionalKey( - Schema.Union([Schema.Array(ServerRequest__FileSystemSandboxEntry), Schema.Null]), +export const ServerNotification__RequestPermissionProfile = Schema.Struct({ + fileSystem: Schema.optionalKey( + Schema.Union([ServerNotification__AdditionalFileSystemPermissions, Schema.Null]), ), - globScanMaxDepth: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(1)), - Schema.Null, - ]), + network: Schema.optionalKey( + Schema.Union([ServerNotification__AdditionalNetworkPermissions, Schema.Null]), ), - read: Schema.optionalKey( - Schema.Union([ - Schema.Array(ServerRequest__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), - Schema.Null, - ]), +}).annotate({ identifier: "ServerNotification__RequestPermissionProfile" }); + +export type ServerRequest__RequestPermissionProfile = { + readonly fileSystem?: ServerRequest__AdditionalFileSystemPermissions | null; + readonly network?: ServerRequest__AdditionalNetworkPermissions | null; +}; +export const ServerRequest__RequestPermissionProfile = Schema.Struct({ + fileSystem: Schema.optionalKey( + Schema.Union([ServerRequest__AdditionalFileSystemPermissions, Schema.Null]), ), - write: Schema.optionalKey( - Schema.Union([ - Schema.Array(ServerRequest__LegacyAppPathString).annotate({ - description: "This will be removed in favor of `entries`.", - }), - Schema.Null, - ]), + network: Schema.optionalKey( + Schema.Union([ServerRequest__AdditionalNetworkPermissions, Schema.Null]), ), -}); +}).annotate({ identifier: "ServerRequest__RequestPermissionProfile" }); -export type ServerRequest__McpElicitationEnumSchema = - | ServerRequest__McpElicitationSingleSelectEnumSchema - | ServerRequest__McpElicitationMultiSelectEnumSchema - | ServerRequest__McpElicitationLegacyTitledEnumSchema; -export const ServerRequest__McpElicitationEnumSchema = Schema.Union([ - ServerRequest__McpElicitationSingleSelectEnumSchema, - ServerRequest__McpElicitationMultiSelectEnumSchema, - ServerRequest__McpElicitationLegacyTitledEnumSchema, -]); +export type ServerRequest__McpElicitationPrimitiveSchema = + | ServerRequest__McpElicitationEnumSchema + | ServerRequest__McpElicitationStringSchema + | ServerRequest__McpElicitationNumberSchema + | ServerRequest__McpElicitationBooleanSchema; +export const ServerRequest__McpElicitationPrimitiveSchema = Schema.Union([ + ServerRequest__McpElicitationEnumSchema, + ServerRequest__McpElicitationStringSchema, + ServerRequest__McpElicitationNumberSchema, + ServerRequest__McpElicitationBooleanSchema, +]).annotate({ identifier: "ServerRequest__McpElicitationPrimitiveSchema" }); -export type V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions = { - readonly entries?: ReadonlyArray | null; - readonly globScanMaxDepth?: number | null; - readonly read?: ReadonlyArray | null; - readonly write?: ReadonlyArray | null; +export type V2ItemGuardianApprovalReviewCompletedNotification__RequestPermissionProfile = { + readonly fileSystem?: V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions | null; + readonly network?: V2ItemGuardianApprovalReviewCompletedNotification__AdditionalNetworkPermissions | null; }; -export const V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions = +export const V2ItemGuardianApprovalReviewCompletedNotification__RequestPermissionProfile = Schema.Struct({ - entries: Schema.optionalKey( - Schema.Union([ - Schema.Array(V2ItemGuardianApprovalReviewCompletedNotification__FileSystemSandboxEntry), - Schema.Null, - ]), - ), - globScanMaxDepth: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(1)), - Schema.Null, - ]), - ), - read: Schema.optionalKey( + fileSystem: Schema.optionalKey( Schema.Union([ - Schema.Array( - V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString, - ).annotate({ description: "This will be removed in favor of `entries`." }), + V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions, Schema.Null, ]), ), - write: Schema.optionalKey( + network: Schema.optionalKey( Schema.Union([ - Schema.Array( - V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString, - ).annotate({ description: "This will be removed in favor of `entries`." }), + V2ItemGuardianApprovalReviewCompletedNotification__AdditionalNetworkPermissions, Schema.Null, ]), ), + }).annotate({ + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__RequestPermissionProfile", }); -export type V2ItemGuardianApprovalReviewStartedNotification__AdditionalFileSystemPermissions = { - readonly entries?: ReadonlyArray | null; - readonly globScanMaxDepth?: number | null; - readonly read?: ReadonlyArray | null; - readonly write?: ReadonlyArray | null; +export type V2ItemGuardianApprovalReviewStartedNotification__RequestPermissionProfile = { + readonly fileSystem?: V2ItemGuardianApprovalReviewStartedNotification__AdditionalFileSystemPermissions | null; + readonly network?: V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions | null; }; -export const V2ItemGuardianApprovalReviewStartedNotification__AdditionalFileSystemPermissions = +export const V2ItemGuardianApprovalReviewStartedNotification__RequestPermissionProfile = Schema.Struct({ - entries: Schema.optionalKey( - Schema.Union([ - Schema.Array(V2ItemGuardianApprovalReviewStartedNotification__FileSystemSandboxEntry), - Schema.Null, - ]), - ), - globScanMaxDepth: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(1)), - Schema.Null, - ]), - ), - read: Schema.optionalKey( + fileSystem: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString).annotate( - { description: "This will be removed in favor of `entries`." }, - ), + V2ItemGuardianApprovalReviewStartedNotification__AdditionalFileSystemPermissions, Schema.Null, ]), ), - write: Schema.optionalKey( + network: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString).annotate( - { description: "This will be removed in favor of `entries`." }, - ), + V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions, Schema.Null, ]), ), + }).annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__RequestPermissionProfile", }); -export type V2PluginInstalledResponse__PluginMarketplaceEntry = { - readonly interface?: V2PluginInstalledResponse__MarketplaceInterface | null; - readonly name: string; - readonly path?: V2PluginInstalledResponse__AbsolutePathBuf | null; - readonly plugins: ReadonlyArray; -}; -export const V2PluginInstalledResponse__PluginMarketplaceEntry = Schema.Struct({ - interface: Schema.optionalKey( - Schema.Union([V2PluginInstalledResponse__MarketplaceInterface, Schema.Null]), - ), - name: Schema.String, - path: Schema.optionalKey( - Schema.Union([V2PluginInstalledResponse__AbsolutePathBuf, Schema.Null]).annotate({ - description: - "Local marketplace file path when the marketplace is backed by a local file. Remote-only catalog marketplaces do not have a local path.", - }), - ), - plugins: Schema.Array(V2PluginInstalledResponse__PluginSummary), -}); - -export type V2PluginListResponse__PluginMarketplaceEntry = { - readonly interface?: V2PluginListResponse__MarketplaceInterface | null; - readonly name: string; - readonly path?: V2PluginListResponse__AbsolutePathBuf | null; - readonly plugins: ReadonlyArray; -}; -export const V2PluginListResponse__PluginMarketplaceEntry = Schema.Struct({ - interface: Schema.optionalKey( - Schema.Union([V2PluginListResponse__MarketplaceInterface, Schema.Null]), - ), - name: Schema.String, - path: Schema.optionalKey( - Schema.Union([V2PluginListResponse__AbsolutePathBuf, Schema.Null]).annotate({ - description: - "Local marketplace file path when the marketplace is backed by a local file. Remote-only catalog marketplaces do not have a local path.", - }), - ), - plugins: Schema.Array(V2PluginListResponse__PluginSummary), -}); - -export type V2PluginReadResponse__PluginDetail = { - readonly appTemplates: ReadonlyArray; - readonly apps: ReadonlyArray; - readonly description?: string | null; - readonly hooks: ReadonlyArray; - readonly marketplaceName: string; - readonly marketplacePath?: V2PluginReadResponse__AbsolutePathBuf | null; - readonly mcpServers: ReadonlyArray; - readonly scheduledTasks?: ReadonlyArray | null; - readonly shareUrl?: string | null; - readonly skills: ReadonlyArray; - readonly summary: V2PluginReadResponse__PluginSummary; -}; -export const V2PluginReadResponse__PluginDetail = Schema.Struct({ - appTemplates: Schema.Array(V2PluginReadResponse__AppTemplateSummary), - apps: Schema.Array(V2PluginReadResponse__AppSummary), - description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - hooks: Schema.Array(V2PluginReadResponse__PluginHookSummary), - marketplaceName: Schema.String, - marketplacePath: Schema.optionalKey( - Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null]), - ), - mcpServers: Schema.Array(Schema.String), - scheduledTasks: Schema.optionalKey( - Schema.Union([Schema.Array(V2PluginReadResponse__ScheduledTaskSummary), Schema.Null]), - ), - shareUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - skills: Schema.Array(V2PluginReadResponse__SkillSummary), - summary: V2PluginReadResponse__PluginSummary, -}); - -export type V2PluginShareListResponse__PluginShareListItem = { - readonly localPluginPath?: V2PluginShareListResponse__AbsolutePathBuf | null; - readonly plugin: V2PluginShareListResponse__PluginSummary; -}; -export const V2PluginShareListResponse__PluginShareListItem = Schema.Struct({ - localPluginPath: Schema.optionalKey( - Schema.Union([V2PluginShareListResponse__AbsolutePathBuf, Schema.Null]), - ), - plugin: V2PluginShareListResponse__PluginSummary, -}); - export type V2ThreadForkResponse__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: string; + readonly cwd: V2ThreadForkResponse__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadForkResponse__GitInfo | null; @@ -30819,22 +34935,8 @@ export type V2ThreadForkResponse__Thread = { readonly preview: string; readonly recencyAt?: number | null; readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadForkResponse__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; + readonly source: V2ThreadForkResponse__SessionSource; + readonly status: V2ThreadForkResponse__ThreadStatus; readonly threadSource?: V2ThreadForkResponse__ThreadSource | null; readonly turns: ReadonlyArray; readonly updatedAt: number; @@ -30863,11 +34965,11 @@ export const V2ThreadForkResponse__Thread = Schema.Struct({ createdAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was created.", format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", }), @@ -30919,42 +35021,20 @@ export const V2ThreadForkResponse__Thread = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) used for thread recency ordering.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadForkResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, + source: Schema.suspend( + (): Schema.Codec => V2ThreadForkResponse__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadForkResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, + status: Schema.suspend( + (): Schema.Codec => V2ThreadForkResponse__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( Schema.Union([V2ThreadForkResponse__ThreadSource, Schema.Null]).annotate({ @@ -30968,15 +35048,15 @@ export const V2ThreadForkResponse__Thread = Schema.Struct({ updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", - }).check(Schema.isInt()), -}); + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadForkResponse__Thread" }); export type V2ThreadListResponse__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: string; + readonly cwd: V2ThreadListResponse__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadListResponse__GitInfo | null; @@ -30988,22 +35068,8 @@ export type V2ThreadListResponse__Thread = { readonly preview: string; readonly recencyAt?: number | null; readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadListResponse__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; + readonly source: V2ThreadListResponse__SessionSource; + readonly status: V2ThreadListResponse__ThreadStatus; readonly threadSource?: V2ThreadListResponse__ThreadSource | null; readonly turns: ReadonlyArray; readonly updatedAt: number; @@ -31032,11 +35098,11 @@ export const V2ThreadListResponse__Thread = Schema.Struct({ createdAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was created.", format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadListResponse__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", }), @@ -31088,42 +35154,20 @@ export const V2ThreadListResponse__Thread = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) used for thread recency ordering.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadListResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, + source: Schema.suspend( + (): Schema.Codec => V2ThreadListResponse__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadListResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, + status: Schema.suspend( + (): Schema.Codec => V2ThreadListResponse__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( Schema.Union([V2ThreadListResponse__ThreadSource, Schema.Null]).annotate({ @@ -31137,15 +35181,15 @@ export const V2ThreadListResponse__Thread = Schema.Struct({ updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", - }).check(Schema.isInt()), -}); + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadListResponse__Thread" }); export type V2ThreadMetadataUpdateResponse__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: string; + readonly cwd: V2ThreadMetadataUpdateResponse__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadMetadataUpdateResponse__GitInfo | null; @@ -31157,22 +35201,8 @@ export type V2ThreadMetadataUpdateResponse__Thread = { readonly preview: string; readonly recencyAt?: number | null; readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadMetadataUpdateResponse__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; + readonly source: V2ThreadMetadataUpdateResponse__SessionSource; + readonly status: V2ThreadMetadataUpdateResponse__ThreadStatus; readonly threadSource?: V2ThreadMetadataUpdateResponse__ThreadSource | null; readonly turns: ReadonlyArray; readonly updatedAt: number; @@ -31201,11 +35231,146 @@ export const V2ThreadMetadataUpdateResponse__Thread = Schema.Struct({ createdAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was created.", format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), + ephemeral: Schema.Boolean.annotate({ + description: "Whether the thread is ephemeral and should not be materialized on disk.", + }), + forkedFromId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Source thread id when this thread was created by forking another thread.", + }), + Schema.Null, + ]), + ), + gitInfo: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__GitInfo, Schema.Null]).annotate({ + description: "Optional Git metadata captured when the thread was created.", + }), + ), + id: Schema.String.annotate({ + description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", + }), + modelProvider: Schema.String.annotate({ + description: "Model provider used for this thread (for example, 'openai').", + }), + name: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Optional user-facing thread title." }), + Schema.Null, + ]), + ), + parentThreadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "The ID of the parent thread. This will only be set if this thread is a subagent.", + }), + Schema.Null, + ]), + ), + path: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "[UNSTABLE] Path to the thread on disk." }), + Schema.Null, + ]), + ), + preview: Schema.String.annotate({ + description: "Usually the first user message in the thread, if available.", + }), + recencyAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp (in seconds) used for thread recency ordering.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + sessionId: Schema.String.annotate({ + description: "Session id shared by threads that belong to the same session tree.", + }), + source: Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__SessionSource, + ).annotate({ + description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", + }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__ThreadStatus, + ).annotate({ description: "Current runtime status for the thread." }), + threadSource: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ThreadSource, Schema.Null]).annotate({ + description: "Optional analytics source classification for this thread.", + }), + ), + turns: Schema.Array(V2ThreadMetadataUpdateResponse__Turn).annotate({ description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + }), + updatedAt: Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the thread was last updated.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__Thread" }); + +export type V2ThreadReadResponse__Thread = { + readonly agentNickname?: string | null; + readonly agentRole?: string | null; + readonly cliVersion: string; + readonly createdAt: number; + readonly cwd: V2ThreadReadResponse__AbsolutePathBuf; + readonly ephemeral: boolean; + readonly forkedFromId?: string | null; + readonly gitInfo?: V2ThreadReadResponse__GitInfo | null; + readonly id: string; + readonly modelProvider: string; + readonly name?: string | null; + readonly parentThreadId?: string | null; + readonly path?: string | null; + readonly preview: string; + readonly recencyAt?: number | null; + readonly sessionId: string; + readonly source: V2ThreadReadResponse__SessionSource; + readonly status: V2ThreadReadResponse__ThreadStatus; + readonly threadSource?: V2ThreadReadResponse__ThreadSource | null; + readonly turns: ReadonlyArray; + readonly updatedAt: number; +}; +export const V2ThreadReadResponse__Thread = Schema.Struct({ + agentNickname: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional random unique nickname assigned to an AgentControl-spawned sub-agent.", + }), + Schema.Null, + ]), + ), + agentRole: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.", + }), + Schema.Null, + ]), + ), + cliVersion: Schema.String.annotate({ + description: "Version of the CLI that created the thread.", }), + createdAt: Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the thread was created.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadReadResponse__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", }), @@ -31218,7 +35383,7 @@ export const V2ThreadMetadataUpdateResponse__Thread = Schema.Struct({ ]), ), gitInfo: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__GitInfo, Schema.Null]).annotate({ + Schema.Union([V2ThreadReadResponse__GitInfo, Schema.Null]).annotate({ description: "Optional Git metadata captured when the thread was created.", }), ), @@ -31257,67 +35422,45 @@ export const V2ThreadMetadataUpdateResponse__Thread = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) used for thread recency ordering.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadMetadataUpdateResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, + source: Schema.suspend( + (): Schema.Codec => V2ThreadReadResponse__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadMetadataUpdateResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, + status: Schema.suspend( + (): Schema.Codec => V2ThreadReadResponse__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__ThreadSource, Schema.Null]).annotate({ + Schema.Union([V2ThreadReadResponse__ThreadSource, Schema.Null]).annotate({ description: "Optional analytics source classification for this thread.", }), ), - turns: Schema.Array(V2ThreadMetadataUpdateResponse__Turn).annotate({ + turns: Schema.Array(V2ThreadReadResponse__Turn).annotate({ description: "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", - }).check(Schema.isInt()), -}); + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadReadResponse__Thread" }); -export type V2ThreadReadResponse__Thread = { +export type V2ThreadResumeResponse__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: string; + readonly cwd: V2ThreadResumeResponse__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; - readonly gitInfo?: V2ThreadReadResponse__GitInfo | null; + readonly gitInfo?: V2ThreadResumeResponse__GitInfo | null; readonly id: string; readonly modelProvider: string; readonly name?: string | null; @@ -31326,27 +35469,13 @@ export type V2ThreadReadResponse__Thread = { readonly preview: string; readonly recencyAt?: number | null; readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadReadResponse__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; - readonly threadSource?: V2ThreadReadResponse__ThreadSource | null; - readonly turns: ReadonlyArray; + readonly source: V2ThreadResumeResponse__SessionSource; + readonly status: V2ThreadResumeResponse__ThreadStatus; + readonly threadSource?: V2ThreadResumeResponse__ThreadSource | null; + readonly turns: ReadonlyArray; readonly updatedAt: number; }; -export const V2ThreadReadResponse__Thread = Schema.Struct({ +export const V2ThreadResumeResponse__Thread = Schema.Struct({ agentNickname: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -31370,11 +35499,11 @@ export const V2ThreadReadResponse__Thread = Schema.Struct({ createdAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was created.", format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", }), @@ -31387,7 +35516,7 @@ export const V2ThreadReadResponse__Thread = Schema.Struct({ ]), ), gitInfo: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__GitInfo, Schema.Null]).annotate({ + Schema.Union([V2ThreadResumeResponse__GitInfo, Schema.Null]).annotate({ description: "Optional Git metadata captured when the thread was created.", }), ), @@ -31426,67 +35555,46 @@ export const V2ThreadReadResponse__Thread = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) used for thread recency ordering.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadReadResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, + source: Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadReadResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, + status: Schema.suspend( + (): Schema.Codec => V2ThreadResumeResponse__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__ThreadSource, Schema.Null]).annotate({ + Schema.Union([V2ThreadResumeResponse__ThreadSource, Schema.Null]).annotate({ description: "Optional analytics source classification for this thread.", }), ), - turns: Schema.Array(V2ThreadReadResponse__Turn).annotate({ + turns: Schema.Array(V2ThreadResumeResponse__Turn).annotate({ description: "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", - }).check(Schema.isInt()), -}); + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadResumeResponse__Thread" }); -export type V2ThreadResumeResponse__Thread = { +export type V2ThreadRollbackResponse__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: string; + readonly cwd: V2ThreadRollbackResponse__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; - readonly gitInfo?: V2ThreadResumeResponse__GitInfo | null; + readonly gitInfo?: V2ThreadRollbackResponse__GitInfo | null; readonly id: string; readonly modelProvider: string; readonly name?: string | null; @@ -31495,27 +35603,13 @@ export type V2ThreadResumeResponse__Thread = { readonly preview: string; readonly recencyAt?: number | null; readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadResumeResponse__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; - readonly threadSource?: V2ThreadResumeResponse__ThreadSource | null; - readonly turns: ReadonlyArray; + readonly source: V2ThreadRollbackResponse__SessionSource; + readonly status: V2ThreadRollbackResponse__ThreadStatus; + readonly threadSource?: V2ThreadRollbackResponse__ThreadSource | null; + readonly turns: ReadonlyArray; readonly updatedAt: number; }; -export const V2ThreadResumeResponse__Thread = Schema.Struct({ +export const V2ThreadRollbackResponse__Thread = Schema.Struct({ agentNickname: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -31539,11 +35633,11 @@ export const V2ThreadResumeResponse__Thread = Schema.Struct({ createdAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was created.", format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadRollbackResponse__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", }), @@ -31556,7 +35650,7 @@ export const V2ThreadResumeResponse__Thread = Schema.Struct({ ]), ), gitInfo: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__GitInfo, Schema.Null]).annotate({ + Schema.Union([V2ThreadRollbackResponse__GitInfo, Schema.Null]).annotate({ description: "Optional Git metadata captured when the thread was created.", }), ), @@ -31595,64 +35689,44 @@ export const V2ThreadResumeResponse__Thread = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) used for thread recency ordering.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadResumeResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, + source: Schema.suspend( + (): Schema.Codec => + V2ThreadRollbackResponse__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadResumeResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, + status: Schema.suspend( + (): Schema.Codec => + V2ThreadRollbackResponse__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__ThreadSource, Schema.Null]).annotate({ + Schema.Union([V2ThreadRollbackResponse__ThreadSource, Schema.Null]).annotate({ description: "Optional analytics source classification for this thread.", }), ), - turns: Schema.Array(V2ThreadResumeResponse__Turn).annotate({ + turns: Schema.Array(V2ThreadRollbackResponse__Turn).annotate({ description: "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", - }).check(Schema.isInt()), -}); + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadRollbackResponse__Thread" }); export type V2ThreadStartedNotification__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: string; + readonly cwd: V2ThreadStartedNotification__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadStartedNotification__GitInfo | null; @@ -31664,22 +35738,8 @@ export type V2ThreadStartedNotification__Thread = { readonly preview: string; readonly recencyAt?: number | null; readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadStartedNotification__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; + readonly source: V2ThreadStartedNotification__SessionSource; + readonly status: V2ThreadStartedNotification__ThreadStatus; readonly threadSource?: V2ThreadStartedNotification__ThreadSource | null; readonly turns: ReadonlyArray; readonly updatedAt: number; @@ -31708,11 +35768,11 @@ export const V2ThreadStartedNotification__Thread = Schema.Struct({ createdAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was created.", format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", }), @@ -31764,42 +35824,22 @@ export const V2ThreadStartedNotification__Thread = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) used for thread recency ordering.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadStartedNotification__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, + source: Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadStartedNotification__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, + status: Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( Schema.Union([V2ThreadStartedNotification__ThreadSource, Schema.Null]).annotate({ @@ -31813,15 +35853,15 @@ export const V2ThreadStartedNotification__Thread = Schema.Struct({ updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", - }).check(Schema.isInt()), -}); + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadStartedNotification__Thread" }); export type V2ThreadStartResponse__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: string; + readonly cwd: V2ThreadStartResponse__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadStartResponse__GitInfo | null; @@ -31833,22 +35873,8 @@ export type V2ThreadStartResponse__Thread = { readonly preview: string; readonly recencyAt?: number | null; readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadStartResponse__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; + readonly source: V2ThreadStartResponse__SessionSource; + readonly status: V2ThreadStartResponse__ThreadStatus; readonly threadSource?: V2ThreadStartResponse__ThreadSource | null; readonly turns: ReadonlyArray; readonly updatedAt: number; @@ -31877,11 +35903,11 @@ export const V2ThreadStartResponse__Thread = Schema.Struct({ createdAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was created.", format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadStartResponse__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", }), @@ -31933,42 +35959,20 @@ export const V2ThreadStartResponse__Thread = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) used for thread recency ordering.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadStartResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, + source: Schema.suspend( + (): Schema.Codec => V2ThreadStartResponse__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadStartResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, + status: Schema.suspend( + (): Schema.Codec => V2ThreadStartResponse__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( Schema.Union([V2ThreadStartResponse__ThreadSource, Schema.Null]).annotate({ @@ -31982,15 +35986,15 @@ export const V2ThreadStartResponse__Thread = Schema.Struct({ updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", - }).check(Schema.isInt()), -}); + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadStartResponse__Thread" }); export type V2ThreadUnarchiveResponse__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: string; + readonly cwd: V2ThreadUnarchiveResponse__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadUnarchiveResponse__GitInfo | null; @@ -32002,22 +36006,8 @@ export type V2ThreadUnarchiveResponse__Thread = { readonly preview: string; readonly recencyAt?: number | null; readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadUnarchiveResponse__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; + readonly source: V2ThreadUnarchiveResponse__SessionSource; + readonly status: V2ThreadUnarchiveResponse__ThreadStatus; readonly threadSource?: V2ThreadUnarchiveResponse__ThreadSource | null; readonly turns: ReadonlyArray; readonly updatedAt: number; @@ -32046,11 +36036,11 @@ export const V2ThreadUnarchiveResponse__Thread = Schema.Struct({ createdAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was created.", format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadUnarchiveResponse__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", }), @@ -32102,42 +36092,22 @@ export const V2ThreadUnarchiveResponse__Thread = Schema.Struct({ Schema.Number.annotate({ description: "Unix timestamp (in seconds) used for thread recency ordering.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadUnarchiveResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, + source: Schema.suspend( + (): Schema.Codec => + V2ThreadUnarchiveResponse__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadUnarchiveResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, + status: Schema.suspend( + (): Schema.Codec => + V2ThreadUnarchiveResponse__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( Schema.Union([V2ThreadUnarchiveResponse__ThreadSource, Schema.Null]).annotate({ @@ -32151,134 +36121,8 @@ export const V2ThreadUnarchiveResponse__Thread = Schema.Struct({ updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", - }).check(Schema.isInt()), -}); - -export type McpServerElicitationRequestParams__McpElicitationPrimitiveSchema = - | McpServerElicitationRequestParams__McpElicitationEnumSchema - | McpServerElicitationRequestParams__McpElicitationStringSchema - | McpServerElicitationRequestParams__McpElicitationNumberSchema - | McpServerElicitationRequestParams__McpElicitationBooleanSchema; -export const McpServerElicitationRequestParams__McpElicitationPrimitiveSchema = Schema.Union([ - McpServerElicitationRequestParams__McpElicitationEnumSchema, - McpServerElicitationRequestParams__McpElicitationStringSchema, - McpServerElicitationRequestParams__McpElicitationNumberSchema, - McpServerElicitationRequestParams__McpElicitationBooleanSchema, -]); - -export type PermissionsRequestApprovalParams__RequestPermissionProfile = { - readonly fileSystem?: PermissionsRequestApprovalParams__AdditionalFileSystemPermissions | null; - readonly network?: PermissionsRequestApprovalParams__AdditionalNetworkPermissions | null; -}; -export const PermissionsRequestApprovalParams__RequestPermissionProfile = Schema.Struct({ - fileSystem: Schema.optionalKey( - Schema.Union([PermissionsRequestApprovalParams__AdditionalFileSystemPermissions, Schema.Null]), - ), - network: Schema.optionalKey( - Schema.Union([PermissionsRequestApprovalParams__AdditionalNetworkPermissions, Schema.Null]), - ), -}); - -export type PermissionsRequestApprovalResponse__GrantedPermissionProfile = { - readonly fileSystem?: PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions | null; - readonly network?: PermissionsRequestApprovalResponse__AdditionalNetworkPermissions | null; -}; -export const PermissionsRequestApprovalResponse__GrantedPermissionProfile = Schema.Struct({ - fileSystem: Schema.optionalKey( - Schema.Union([ - PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions, - Schema.Null, - ]), - ), - network: Schema.optionalKey( - Schema.Union([PermissionsRequestApprovalResponse__AdditionalNetworkPermissions, Schema.Null]), - ), -}); - -export type ServerNotification__RequestPermissionProfile = { - readonly fileSystem?: ServerNotification__AdditionalFileSystemPermissions | null; - readonly network?: ServerNotification__AdditionalNetworkPermissions | null; -}; -export const ServerNotification__RequestPermissionProfile = Schema.Struct({ - fileSystem: Schema.optionalKey( - Schema.Union([ServerNotification__AdditionalFileSystemPermissions, Schema.Null]), - ), - network: Schema.optionalKey( - Schema.Union([ServerNotification__AdditionalNetworkPermissions, Schema.Null]), - ), -}); - -export type ServerNotification__ThreadStartedNotification = { - readonly thread: ServerNotification__Thread; -}; -export const ServerNotification__ThreadStartedNotification = Schema.Struct({ - thread: ServerNotification__Thread, -}); - -export type ServerRequest__RequestPermissionProfile = { - readonly fileSystem?: ServerRequest__AdditionalFileSystemPermissions | null; - readonly network?: ServerRequest__AdditionalNetworkPermissions | null; -}; -export const ServerRequest__RequestPermissionProfile = Schema.Struct({ - fileSystem: Schema.optionalKey( - Schema.Union([ServerRequest__AdditionalFileSystemPermissions, Schema.Null]), - ), - network: Schema.optionalKey( - Schema.Union([ServerRequest__AdditionalNetworkPermissions, Schema.Null]), - ), -}); - -export type ServerRequest__McpElicitationPrimitiveSchema = - | ServerRequest__McpElicitationEnumSchema - | ServerRequest__McpElicitationStringSchema - | ServerRequest__McpElicitationNumberSchema - | ServerRequest__McpElicitationBooleanSchema; -export const ServerRequest__McpElicitationPrimitiveSchema = Schema.Union([ - ServerRequest__McpElicitationEnumSchema, - ServerRequest__McpElicitationStringSchema, - ServerRequest__McpElicitationNumberSchema, - ServerRequest__McpElicitationBooleanSchema, -]); - -export type V2ItemGuardianApprovalReviewCompletedNotification__RequestPermissionProfile = { - readonly fileSystem?: V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions | null; - readonly network?: V2ItemGuardianApprovalReviewCompletedNotification__AdditionalNetworkPermissions | null; -}; -export const V2ItemGuardianApprovalReviewCompletedNotification__RequestPermissionProfile = - Schema.Struct({ - fileSystem: Schema.optionalKey( - Schema.Union([ - V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions, - Schema.Null, - ]), - ), - network: Schema.optionalKey( - Schema.Union([ - V2ItemGuardianApprovalReviewCompletedNotification__AdditionalNetworkPermissions, - Schema.Null, - ]), - ), - }); - -export type V2ItemGuardianApprovalReviewStartedNotification__RequestPermissionProfile = { - readonly fileSystem?: V2ItemGuardianApprovalReviewStartedNotification__AdditionalFileSystemPermissions | null; - readonly network?: V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions | null; -}; -export const V2ItemGuardianApprovalReviewStartedNotification__RequestPermissionProfile = - Schema.Struct({ - fileSystem: Schema.optionalKey( - Schema.Union([ - V2ItemGuardianApprovalReviewStartedNotification__AdditionalFileSystemPermissions, - Schema.Null, - ]), - ), - network: Schema.optionalKey( - Schema.Union([ - V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions, - Schema.Null, - ]), - ), - }); + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadUnarchiveResponse__Thread" }); export type McpServerElicitationRequestParams__McpElicitationSchema = { readonly $schema?: string | null; @@ -32299,8 +36143,16 @@ export const McpServerElicitationRequestParams__McpElicitationSchema = Schema.St }).annotate({ description: "Typed form schema for MCP `elicitation/create` requests.\n\nThis matches the `requestedSchema` shape from the MCP 2025-11-25 `ElicitRequestFormParams` schema.", + identifier: "McpServerElicitationRequestParams__McpElicitationSchema", }); +export type ServerNotification__ThreadStartedNotification = { + readonly thread: ServerNotification__Thread; +}; +export const ServerNotification__ThreadStartedNotification = Schema.Struct({ + thread: ServerNotification__Thread, +}).annotate({ identifier: "ServerNotification__ThreadStartedNotification" }); + export type ServerNotification__GuardianApprovalReviewAction = | { readonly command: string; @@ -32367,8 +36219,12 @@ export const ServerNotification__GuardianApprovalReviewAction = Schema.Union( Schema.Struct({ host: Schema.String, port: Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), protocol: ServerNotification__NetworkApprovalProtocol, target: Schema.String, type: Schema.Literal("networkAccess").annotate({ @@ -32394,7 +36250,7 @@ export const ServerNotification__GuardianApprovalReviewAction = Schema.Union( }).annotate({ title: "RequestPermissionsGuardianApprovalReviewAction" }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ServerNotification__GuardianApprovalReviewAction" }); export type ServerRequest__PermissionsRequestApprovalParams = { readonly cwd: ServerRequest__AbsolutePathBuf; @@ -32415,10 +36271,10 @@ export const ServerRequest__PermissionsRequestApprovalParams = Schema.Struct({ startedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this approval request started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), threadId: Schema.String, turnId: Schema.String, -}); +}).annotate({ identifier: "ServerRequest__PermissionsRequestApprovalParams" }); export type ServerRequest__McpElicitationSchema = { readonly $schema?: string | null; @@ -32434,6 +36290,7 @@ export const ServerRequest__McpElicitationSchema = Schema.Struct({ }).annotate({ description: "Typed form schema for MCP `elicitation/create` requests.\n\nThis matches the `requestedSchema` shape from the MCP 2025-11-25 `ElicitRequestFormParams` schema.", + identifier: "ServerRequest__McpElicitationSchema", }); export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewAction = @@ -32505,8 +36362,12 @@ export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianApproval Schema.Struct({ host: Schema.String, port: Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), protocol: V2ItemGuardianApprovalReviewCompletedNotification__NetworkApprovalProtocol, target: Schema.String, type: Schema.Literal("networkAccess").annotate({ @@ -32532,7 +36393,9 @@ export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianApproval }).annotate({ title: "RequestPermissionsGuardianApprovalReviewAction" }), ], { mode: "oneOf" }, - ); + ).annotate({ + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewAction", + }); export type V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewAction = | { @@ -32603,8 +36466,12 @@ export const V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalRe Schema.Struct({ host: Schema.String, port: Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), protocol: V2ItemGuardianApprovalReviewStartedNotification__NetworkApprovalProtocol, target: Schema.String, type: Schema.Literal("networkAccess").annotate({ @@ -32630,12 +36497,12 @@ export const V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalRe }).annotate({ title: "RequestPermissionsGuardianApprovalReviewAction" }), ], { mode: "oneOf" }, - ); + ).annotate({ + identifier: "V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewAction", + }); -export type ServerNotification__ItemGuardianApprovalReviewCompletedNotification = { +export type ServerNotification__ItemGuardianApprovalReviewStartedNotification = { readonly action: ServerNotification__GuardianApprovalReviewAction; - readonly completedAtMs: number; - readonly decisionSource: ServerNotification__AutoReviewDecisionSource; readonly review: ServerNotification__GuardianApprovalReview; readonly reviewId: string; readonly startedAtMs: number; @@ -32643,19 +36510,14 @@ export type ServerNotification__ItemGuardianApprovalReviewCompletedNotification readonly threadId: string; readonly turnId: string; }; -export const ServerNotification__ItemGuardianApprovalReviewCompletedNotification = Schema.Struct({ +export const ServerNotification__ItemGuardianApprovalReviewStartedNotification = Schema.Struct({ action: ServerNotification__GuardianApprovalReviewAction, - completedAtMs: Schema.Number.annotate({ - description: "Unix timestamp (in milliseconds) when this review completed.", - format: "int64", - }).check(Schema.isInt()), - decisionSource: ServerNotification__AutoReviewDecisionSource, review: ServerNotification__GuardianApprovalReview, reviewId: Schema.String.annotate({ description: "Stable identifier for this review." }), startedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this review started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), targetItemId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -32670,10 +36532,13 @@ export const ServerNotification__ItemGuardianApprovalReviewCompletedNotification }).annotate({ description: "[UNSTABLE] Temporary notification payload for approval auto-review. This shape is expected to change soon.", + identifier: "ServerNotification__ItemGuardianApprovalReviewStartedNotification", }); -export type ServerNotification__ItemGuardianApprovalReviewStartedNotification = { +export type ServerNotification__ItemGuardianApprovalReviewCompletedNotification = { readonly action: ServerNotification__GuardianApprovalReviewAction; + readonly completedAtMs: number; + readonly decisionSource: ServerNotification__AutoReviewDecisionSource; readonly review: ServerNotification__GuardianApprovalReview; readonly reviewId: string; readonly startedAtMs: number; @@ -32681,14 +36546,19 @@ export type ServerNotification__ItemGuardianApprovalReviewStartedNotification = readonly threadId: string; readonly turnId: string; }; -export const ServerNotification__ItemGuardianApprovalReviewStartedNotification = Schema.Struct({ +export const ServerNotification__ItemGuardianApprovalReviewCompletedNotification = Schema.Struct({ action: ServerNotification__GuardianApprovalReviewAction, + completedAtMs: Schema.Number.annotate({ + description: "Unix timestamp (in milliseconds) when this review completed.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + decisionSource: ServerNotification__AutoReviewDecisionSource, review: ServerNotification__GuardianApprovalReview, reviewId: Schema.String.annotate({ description: "Stable identifier for this review." }), startedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this review started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), targetItemId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -32703,44 +36573,41 @@ export const ServerNotification__ItemGuardianApprovalReviewStartedNotification = }).annotate({ description: "[UNSTABLE] Temporary notification payload for approval auto-review. This shape is expected to change soon.", + identifier: "ServerNotification__ItemGuardianApprovalReviewCompletedNotification", }); export type ServerRequest__McpServerElicitationRequestParams = | { - readonly _meta?: unknown; + readonly serverName: string; + readonly threadId: string; + readonly turnId?: string | null; + readonly _meta?: Schema.Json; readonly message: string; readonly mode: "form"; readonly requestedSchema: ServerRequest__McpElicitationSchema; + } + | { readonly serverName: string; readonly threadId: string; readonly turnId?: string | null; - } - | { - readonly _meta?: unknown; + readonly _meta?: Schema.Json; readonly message: string; readonly mode: "openai/form"; - readonly requestedSchema: unknown; + readonly requestedSchema: Schema.Json; + } + | { readonly serverName: string; readonly threadId: string; readonly turnId?: string | null; - } - | { - readonly _meta?: unknown; + readonly _meta?: Schema.Json; readonly elicitationId: string; readonly message: string; readonly mode: "url"; readonly url: string; - readonly serverName: string; - readonly threadId: string; - readonly turnId?: string | null; }; export const ServerRequest__McpServerElicitationRequestParams = Schema.Union( [ Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - message: Schema.String, - mode: Schema.Literal("form"), - requestedSchema: ServerRequest__McpElicitationSchema, serverName: Schema.String, threadId: Schema.String, turnId: Schema.optionalKey( @@ -32752,12 +36619,12 @@ export const ServerRequest__McpServerElicitationRequestParams = Schema.Union( Schema.Null, ]), ), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + message: Schema.String, + mode: Schema.Literal("form"), + requestedSchema: ServerRequest__McpElicitationSchema, }), Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - message: Schema.String, - mode: Schema.Literal("openai/form"), - requestedSchema: Schema.Unknown, serverName: Schema.String, threadId: Schema.String, turnId: Schema.optionalKey( @@ -32769,13 +36636,12 @@ export const ServerRequest__McpServerElicitationRequestParams = Schema.Union( Schema.Null, ]), ), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + message: Schema.String, + mode: Schema.Literal("openai/form"), + requestedSchema: Schema.Json.annotate({ expected: "JSON value" }), }), Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - elicitationId: Schema.String, - message: Schema.String, - mode: Schema.Literal("url"), - url: Schema.String, serverName: Schema.String, threadId: Schema.String, turnId: Schema.optionalKey( @@ -32787,10 +36653,15 @@ export const ServerRequest__McpServerElicitationRequestParams = Schema.Union( Schema.Null, ]), ), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + elicitationId: Schema.String, + message: Schema.String, + mode: Schema.Literal("url"), + url: Schema.String, }), ], { mode: "oneOf" }, -); +).annotate({ identifier: "ServerRequest__McpServerElicitationRequestParams" }); export type ApplyPatchApprovalParams = { readonly callId: string; @@ -32832,10 +36703,11 @@ export const ApplyPatchApprovalResponse = Schema.Struct({ decision: ApplyPatchApprovalResponse__ReviewDecision, }).annotate({ title: "ApplyPatchApprovalResponse" }); -export type AttestationGenerateParams = {}; -export const AttestationGenerateParams = Schema.Struct({}).annotate({ - title: "AttestationGenerateParams", -}); +export type AttestationGenerateParams = { readonly [x: string]: Schema.Json }; +export const AttestationGenerateParams = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "AttestationGenerateParams" }); export type AttestationGenerateResponse = { readonly token: string }; export const AttestationGenerateResponse = Schema.Struct({ @@ -33903,39 +37775,6 @@ export const ClientRequest__AdditionalContextEntry = Schema.Struct({ value: Schema.String, }); -export type ClientRequest__ByteRange = { readonly end: number; readonly start: number }; -export const ClientRequest__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type ClientRequest__CapabilityRootLocation = { - readonly environmentId: string; - readonly path: string; - readonly type: "environment"; -}; -export const ClientRequest__CapabilityRootLocation = Schema.Union( - [ - Schema.Struct({ - environmentId: Schema.String, - path: Schema.String.annotate({ - description: "Absolute path for the root in the selected environment.", - }), - type: Schema.Literal("environment").annotate({ - title: "EnvironmentCapabilityRootLocationType", - }), - }).annotate({ - title: "EnvironmentCapabilityRootLocation", - description: "A path owned by an execution environment.", - }), - ], - { mode: "oneOf" }, -).annotate({ description: "Location used to resolve a selected capability root." }); - export type ClientRequest__CodexResponseHandoffMode = "thinking" | "commentary" | "bemTags"; export const ClientRequest__CodexResponseHandoffMode = Schema.Literals([ "thinking", @@ -33956,7 +37795,7 @@ export type ClientRequest__DynamicToolSpec = | { readonly deferLoading?: boolean; readonly description: string; - readonly inputSchema: unknown; + readonly inputSchema: Schema.Json; readonly name: string; readonly type: "function"; } @@ -33971,7 +37810,7 @@ export const ClientRequest__DynamicToolSpec = Schema.Union( Schema.Struct({ deferLoading: Schema.optionalKey(Schema.Boolean), description: Schema.String, - inputSchema: Schema.Unknown, + inputSchema: Schema.Json.annotate({ expected: "JSON value" }), name: Schema.String, type: Schema.Literal("function").annotate({ title: "FunctionDynamicToolSpecType" }), }).annotate({ title: "FunctionDynamicToolSpec" }), @@ -34000,23 +37839,24 @@ export const ClientRequest__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); -export type ClientRequest__NetworkAccess = "restricted" | "enabled"; -export const ClientRequest__NetworkAccess = Schema.Literals(["restricted", "enabled"]); - export type ClientRequest__ProcessTerminalSize = { readonly cols: number; readonly rows: number }; export const ClientRequest__ProcessTerminalSize = Schema.Struct({ cols: Schema.Number.annotate({ description: "Terminal width in character cells.", format: "uint16", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), rows: Schema.Number.annotate({ description: "Terminal height in character cells.", format: "uint16", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), }).annotate({ description: "PTY size in character cells for `process/spawn` PTY sessions." }); export type ClientRequest__RealtimeConversationVersion = "v1" | "v2" | "v3"; @@ -34120,7 +37960,7 @@ export type ClientRequest__ResponseItem = readonly type: "function_call"; } | { - readonly arguments: unknown; + readonly arguments: Schema.Json; readonly call_id?: string | null; readonly execution: string; readonly id?: string | null; @@ -34159,7 +37999,7 @@ export type ClientRequest__ResponseItem = readonly id?: string | null; readonly internal_chat_message_metadata_passthrough?: ClientRequest__InternalChatMessageMetadataPassthrough | null; readonly status: string; - readonly tools: ReadonlyArray; + readonly tools: ReadonlyArray; readonly type: "tool_search_output"; } | { @@ -34261,7 +38101,7 @@ export const ClientRequest__ResponseItem = Schema.Union( type: Schema.Literal("function_call").annotate({ title: "FunctionCallResponseItemType" }), }).annotate({ title: "FunctionCallResponseItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), execution: Schema.String, id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -34318,7 +38158,7 @@ export const ClientRequest__ResponseItem = Schema.Union( Schema.Union([ClientRequest__InternalChatMessageMetadataPassthrough, Schema.Null]), ), status: Schema.String, - tools: Schema.Array(Schema.Unknown), + tools: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), type: Schema.Literal("tool_search_output").annotate({ title: "ToolSearchOutputResponseItemType", }), @@ -34378,33 +38218,16 @@ export const ClientRequest__ResponseItem = Schema.Union( export type ClientRequest__SelectedCapabilityRoot = { readonly id: string; - readonly location: { - readonly environmentId: string; - readonly path: string; - readonly type: "environment"; - }; + readonly location: ClientRequest__CapabilityRootLocation; }; export const ClientRequest__SelectedCapabilityRoot = Schema.Struct({ id: Schema.String.annotate({ description: "Stable identifier supplied by the capability selection platform.", }), - location: Schema.Union( - [ - Schema.Struct({ - environmentId: Schema.String, - path: Schema.String.annotate({ - description: "Absolute path for the root in the selected environment.", - }), - type: Schema.Literal("environment").annotate({ - title: "EnvironmentCapabilityRootLocationType", - }), - }).annotate({ - title: "EnvironmentCapabilityRootLocation", - description: "A path owned by an execution environment.", - }), - ], - { mode: "oneOf" }, - ).annotate({ description: "Location used to resolve a selected capability root." }), + location: Schema.suspend( + (): Schema.Codec => + ClientRequest__CapabilityRootLocation, + ).annotate({ description: "Where the selected root can be resolved." }), }).annotate({ description: "A user-selected root that can expose one or more runtime capabilities.", }); @@ -34426,16 +38249,24 @@ export const ClientRequest__ThreadRealtimeAudioChunk = Schema.Struct({ data: Schema.String, itemId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), numChannels: Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), sampleRate: Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), samplesPerChannel: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -34487,8 +38318,12 @@ export const ClientRequest__ThreadResumeInitialTurnsPageParams = Schema.Struct({ limit: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Optional turn page size.", format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -34604,7 +38439,7 @@ export const CommandExecutionRequestApprovalParams = Schema.Struct({ startedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this approval request started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), threadId: Schema.String, turnId: Schema.String, }).annotate({ title: "CommandExecutionRequestApprovalParams" }); @@ -34685,7 +38520,7 @@ export const CommandExecutionRequestApprovalResponse = Schema.Struct({ }).annotate({ title: "CommandExecutionRequestApprovalResponse" }); export type DynamicToolCallParams = { - readonly arguments: unknown; + readonly arguments: Schema.Json; readonly callId: string; readonly namespace?: string | null; readonly threadId: string; @@ -34693,7 +38528,7 @@ export type DynamicToolCallParams = { readonly turnId: string; }; export const DynamicToolCallParams = Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), callId: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), threadId: Schema.String, @@ -34774,7 +38609,7 @@ export const FileChangeRequestApprovalParams = Schema.Struct({ startedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this approval request started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), threadId: Schema.String, turnId: Schema.String, }).annotate({ title: "FileChangeRequestApprovalParams" }); @@ -34830,12 +38665,12 @@ export const GetAuthStatusParams = Schema.Struct({ }).annotate({ title: "GetAuthStatusParams" }); export type GetAuthStatusResponse = { - readonly authMethod: unknown | null; + readonly authMethod: Schema.Json | null; readonly authToken: string | null; readonly requiresOpenaiAuth: boolean | null; }; export const GetAuthStatusResponse = Schema.Struct({ - authMethod: Schema.Union([Schema.Unknown, Schema.Null]), + authMethod: Schema.Union([Schema.Json.annotate({ expected: "JSON value" }), Schema.Null]), authToken: Schema.Union([Schema.String, Schema.Null]), requiresOpenaiAuth: Schema.Union([Schema.Boolean, Schema.Null]), }).annotate({ title: "GetAuthStatusResponse" }); @@ -34848,10 +38683,10 @@ export const GetConversationSummaryParams = Schema.Union( { mode: "oneOf" }, ).annotate({ title: "GetConversationSummaryParams" }); -export type GetConversationSummaryResponse = { readonly summary: unknown }; -export const GetConversationSummaryResponse = Schema.Struct({ summary: Schema.Unknown }).annotate({ - title: "GetConversationSummaryResponse", -}); +export type GetConversationSummaryResponse = { readonly summary: Schema.Json }; +export const GetConversationSummaryResponse = Schema.Struct({ + summary: Schema.Json.annotate({ expected: "JSON value" }), +}).annotate({ title: "GetConversationSummaryResponse" }); export type GitDiffToRemoteParams = { readonly cwd: string }; export const GitDiffToRemoteParams = Schema.Struct({ cwd: Schema.String }).annotate({ @@ -34878,12 +38713,14 @@ export const JSONRPCError = Schema.Struct({ export type JSONRPCErrorError = { readonly code: number; - readonly data?: unknown; + readonly data?: Schema.Json; readonly message: string; }; export const JSONRPCErrorError = Schema.Struct({ - code: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), - data: Schema.optionalKey(Schema.Unknown), + code: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + data: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), message: Schema.String, }).annotate({ title: "JSONRPCErrorError" }); @@ -34903,10 +38740,10 @@ export const JSONRPCMessage = Schema.Union([ "Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.", }); -export type JSONRPCNotification = { readonly method: string; readonly params?: unknown }; +export type JSONRPCNotification = { readonly method: string; readonly params?: Schema.Json }; export const JSONRPCNotification = Schema.Struct({ method: Schema.String, - params: Schema.optionalKey(Schema.Unknown), + params: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), }).annotate({ title: "JSONRPCNotification", description: "A notification which does not expect a response.", @@ -34915,13 +38752,13 @@ export const JSONRPCNotification = Schema.Struct({ export type JSONRPCRequest = { readonly id: JSONRPCRequest__RequestId; readonly method: string; - readonly params?: unknown; + readonly params?: Schema.Json; readonly trace?: JSONRPCRequest__W3cTraceContext | null; }; export const JSONRPCRequest = Schema.Struct({ id: JSONRPCRequest__RequestId, method: Schema.String, - params: Schema.optionalKey(Schema.Unknown), + params: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), trace: Schema.optionalKey( Schema.Union([JSONRPCRequest__W3cTraceContext, Schema.Null]).annotate({ description: "Optional W3C Trace Context for distributed tracing.", @@ -34929,10 +38766,13 @@ export const JSONRPCRequest = Schema.Struct({ ), }).annotate({ title: "JSONRPCRequest", description: "A request that expects a response." }); -export type JSONRPCResponse = { readonly id: JSONRPCResponse__RequestId; readonly result: unknown }; +export type JSONRPCResponse = { + readonly id: JSONRPCResponse__RequestId; + readonly result: Schema.Json; +}; export const JSONRPCResponse = Schema.Struct({ id: JSONRPCResponse__RequestId, - result: Schema.Unknown, + result: Schema.Json.annotate({ expected: "JSON value" }), }).annotate({ title: "JSONRPCResponse", description: "A successful (non-error) response to a request.", @@ -34940,40 +38780,36 @@ export const JSONRPCResponse = Schema.Struct({ export type McpServerElicitationRequestParams = | { - readonly _meta?: unknown; + readonly serverName: string; + readonly threadId: string; + readonly turnId?: string | null; + readonly _meta?: Schema.Json; readonly message: string; readonly mode: "form"; readonly requestedSchema: McpServerElicitationRequestParams__McpElicitationSchema; + } + | { readonly serverName: string; readonly threadId: string; readonly turnId?: string | null; - } - | { - readonly _meta?: unknown; + readonly _meta?: Schema.Json; readonly message: string; readonly mode: "openai/form"; - readonly requestedSchema: unknown; + readonly requestedSchema: Schema.Json; + } + | { readonly serverName: string; readonly threadId: string; readonly turnId?: string | null; - } - | { - readonly _meta?: unknown; + readonly _meta?: Schema.Json; readonly elicitationId: string; readonly message: string; readonly mode: "url"; readonly url: string; - readonly serverName: string; - readonly threadId: string; - readonly turnId?: string | null; }; export const McpServerElicitationRequestParams = Schema.Union( [ Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - message: Schema.String, - mode: Schema.Literal("form"), - requestedSchema: McpServerElicitationRequestParams__McpElicitationSchema, serverName: Schema.String, threadId: Schema.String, turnId: Schema.optionalKey( @@ -34985,12 +38821,12 @@ export const McpServerElicitationRequestParams = Schema.Union( Schema.Null, ]), ), - }).annotate({ title: "McpServerElicitationRequestParams" }), - Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), message: Schema.String, - mode: Schema.Literal("openai/form"), - requestedSchema: Schema.Unknown, + mode: Schema.Literal("form"), + requestedSchema: McpServerElicitationRequestParams__McpElicitationSchema, + }), + Schema.Struct({ serverName: Schema.String, threadId: Schema.String, turnId: Schema.optionalKey( @@ -35002,13 +38838,12 @@ export const McpServerElicitationRequestParams = Schema.Union( Schema.Null, ]), ), - }).annotate({ title: "McpServerElicitationRequestParams" }), - Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - elicitationId: Schema.String, + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), message: Schema.String, - mode: Schema.Literal("url"), - url: Schema.String, + mode: Schema.Literal("openai/form"), + requestedSchema: Schema.Json.annotate({ expected: "JSON value" }), + }), + Schema.Struct({ serverName: Schema.String, threadId: Schema.String, turnId: Schema.optionalKey( @@ -35020,25 +38855,32 @@ export const McpServerElicitationRequestParams = Schema.Union( Schema.Null, ]), ), - }).annotate({ title: "McpServerElicitationRequestParams" }), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + elicitationId: Schema.String, + message: Schema.String, + mode: Schema.Literal("url"), + url: Schema.String, + }), ], { mode: "oneOf" }, -); +).annotate({ title: "McpServerElicitationRequestParams" }); export type McpServerElicitationRequestResponse = { - readonly _meta?: unknown; + readonly _meta?: Schema.Json; readonly action: McpServerElicitationRequestResponse__McpServerElicitationAction; - readonly content?: unknown; + readonly content?: Schema.Json; }; export const McpServerElicitationRequestResponse = Schema.Struct({ _meta: Schema.optionalKey( - Schema.Unknown.annotate({ + Schema.Json.annotate({ + expected: "JSON value", description: "Optional client metadata for form-mode action handling.", }), ), action: McpServerElicitationRequestResponse__McpServerElicitationAction, content: Schema.optionalKey( - Schema.Unknown.annotate({ + Schema.Json.annotate({ + expected: "JSON value", description: "Structured user input for accepted elicitations, mirroring RMCP `CreateElicitationResult`.\n\nThis is nullable because decline/cancel responses have no content.", }), @@ -35064,19 +38906,24 @@ export const PermissionsRequestApprovalParams = Schema.Struct({ startedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this approval request started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), threadId: Schema.String, turnId: Schema.String, }).annotate({ title: "PermissionsRequestApprovalParams" }); export type PermissionsRequestApprovalResponse = { readonly permissions: PermissionsRequestApprovalResponse__GrantedPermissionProfile; - readonly scope?: "turn" | "session"; + readonly scope?: PermissionsRequestApprovalResponse__PermissionGrantScope; readonly strictAutoReview?: boolean | null; }; export const PermissionsRequestApprovalResponse = Schema.Struct({ permissions: PermissionsRequestApprovalResponse__GrantedPermissionProfile, - scope: Schema.optionalKey(Schema.Literals(["turn", "session"]).annotate({ default: "turn" })), + scope: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + PermissionsRequestApprovalResponse__PermissionGrantScope, + ).annotate({ default: "turn" }), + ), strictAutoReview: Schema.optionalKey( Schema.Union([ Schema.Boolean.annotate({ @@ -35088,1571 +38935,1296 @@ export const PermissionsRequestApprovalResponse = Schema.Struct({ ), }).annotate({ title: "PermissionsRequestApprovalResponse" }); -export type PermissionsRequestApprovalResponse__PermissionGrantScope = "turn" | "session"; -export const PermissionsRequestApprovalResponse__PermissionGrantScope = Schema.Literals([ - "turn", - "session", -]); - export type RequestId = string | number; export const RequestId = Schema.Union([ Schema.String, - Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), ]).annotate({ title: "RequestId" }); export type ServerNotification = | { + readonly emittedAtMs?: number; readonly method: "error"; readonly params: ServerNotification__ErrorNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/started"; readonly params: ServerNotification__ThreadStartedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/status/changed"; readonly params: ServerNotification__ThreadStatusChangedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/archived"; readonly params: ServerNotification__ThreadArchivedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/deleted"; readonly params: ServerNotification__ThreadDeletedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/unarchived"; readonly params: ServerNotification__ThreadUnarchivedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/closed"; readonly params: ServerNotification__ThreadClosedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "skills/changed"; readonly params: ServerNotification__SkillsChangedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/name/updated"; readonly params: ServerNotification__ThreadNameUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/goal/updated"; readonly params: ServerNotification__ThreadGoalUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/goal/cleared"; readonly params: ServerNotification__ThreadGoalClearedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/environment/connected"; readonly params: ServerNotification__EnvironmentConnectionNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/environment/disconnected"; readonly params: ServerNotification__EnvironmentConnectionNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/settings/updated"; readonly params: ServerNotification__ThreadSettingsUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/tokenUsage/updated"; readonly params: ServerNotification__ThreadTokenUsageUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "turn/started"; readonly params: ServerNotification__TurnStartedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "hook/started"; readonly params: ServerNotification__HookStartedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "turn/completed"; readonly params: ServerNotification__TurnCompletedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "hook/completed"; readonly params: ServerNotification__HookCompletedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "turn/diff/updated"; readonly params: ServerNotification__TurnDiffUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "turn/plan/updated"; readonly params: ServerNotification__TurnPlanUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/started"; readonly params: ServerNotification__ItemStartedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/autoApprovalReview/started"; readonly params: ServerNotification__ItemGuardianApprovalReviewStartedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/autoApprovalReview/completed"; readonly params: ServerNotification__ItemGuardianApprovalReviewCompletedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/completed"; readonly params: ServerNotification__ItemCompletedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/agentMessage/delta"; readonly params: ServerNotification__AgentMessageDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/plan/delta"; readonly params: ServerNotification__PlanDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "command/exec/outputDelta"; readonly params: ServerNotification__CommandExecOutputDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "process/outputDelta"; readonly params: ServerNotification__ProcessOutputDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "process/exited"; readonly params: ServerNotification__ProcessExitedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/commandExecution/outputDelta"; readonly params: ServerNotification__CommandExecutionOutputDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/commandExecution/terminalInteraction"; readonly params: ServerNotification__TerminalInteractionNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/fileChange/outputDelta"; readonly params: ServerNotification__FileChangeOutputDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/fileChange/patchUpdated"; readonly params: ServerNotification__FileChangePatchUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "serverRequest/resolved"; readonly params: ServerNotification__ServerRequestResolvedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/mcpToolCall/progress"; readonly params: ServerNotification__McpToolCallProgressNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "mcpServer/oauthLogin/completed"; readonly params: ServerNotification__McpServerOauthLoginCompletedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "mcpServer/startupStatus/updated"; readonly params: ServerNotification__McpServerStatusUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "account/updated"; readonly params: ServerNotification__AccountUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "account/rateLimits/updated"; readonly params: ServerNotification__AccountRateLimitsUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "app/list/updated"; readonly params: ServerNotification__AppListUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "remoteControl/status/changed"; readonly params: ServerNotification__RemoteControlStatusChangedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "externalAgentConfig/import/progress"; readonly params: ServerNotification__ExternalAgentConfigImportProgressNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "externalAgentConfig/import/completed"; readonly params: ServerNotification__ExternalAgentConfigImportCompletedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "fs/changed"; readonly params: ServerNotification__FsChangedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/reasoning/summaryTextDelta"; readonly params: ServerNotification__ReasoningSummaryTextDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/reasoning/summaryPartAdded"; readonly params: ServerNotification__ReasoningSummaryPartAddedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "item/reasoning/textDelta"; readonly params: ServerNotification__ReasoningTextDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/compacted"; readonly params: ServerNotification__ContextCompactedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "model/rerouted"; readonly params: ServerNotification__ModelReroutedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "model/verification"; readonly params: ServerNotification__ModelVerificationNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "turn/moderationMetadata"; readonly params: ServerNotification__TurnModerationMetadataNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "model/safetyBuffering/updated"; readonly params: ServerNotification__ModelSafetyBufferingUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "warning"; readonly params: ServerNotification__WarningNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "guardianWarning"; readonly params: ServerNotification__GuardianWarningNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "deprecationNotice"; readonly params: ServerNotification__DeprecationNoticeNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "configWarning"; readonly params: ServerNotification__ConfigWarningNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "fuzzyFileSearch/sessionUpdated"; readonly params: ServerNotification__FuzzyFileSearchSessionUpdatedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "fuzzyFileSearch/sessionCompleted"; readonly params: ServerNotification__FuzzyFileSearchSessionCompletedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/realtime/started"; readonly params: ServerNotification__ThreadRealtimeStartedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/realtime/itemAdded"; readonly params: ServerNotification__ThreadRealtimeItemAddedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/realtime/transcript/delta"; readonly params: ServerNotification__ThreadRealtimeTranscriptDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/realtime/transcript/done"; readonly params: ServerNotification__ThreadRealtimeTranscriptDoneNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/realtime/outputAudio/delta"; readonly params: ServerNotification__ThreadRealtimeOutputAudioDeltaNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/realtime/sdp"; readonly params: ServerNotification__ThreadRealtimeSdpNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/realtime/error"; readonly params: ServerNotification__ThreadRealtimeErrorNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "thread/realtime/closed"; readonly params: ServerNotification__ThreadRealtimeClosedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "windows/worldWritableWarning"; readonly params: ServerNotification__WindowsWorldWritableWarningNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "windowsSandbox/setupCompleted"; readonly params: ServerNotification__WindowsSandboxSetupCompletedNotification; - readonly emittedAtMs?: number; } | { + readonly emittedAtMs?: number; readonly method: "account/login/completed"; readonly params: ServerNotification__AccountLoginCompletedNotification; - readonly emittedAtMs?: number; }; export const ServerNotification = Schema.Union( [ Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), method: Schema.Literal("error").annotate({ title: "ErrorNotificationMethod" }), params: ServerNotification__ErrorNotification, + }).annotate({ title: "ErrorNotification", description: "NEW NOTIFICATIONS" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/started").annotate({ title: "Thread/startedNotificationMethod", }), params: ServerNotification__ThreadStartedNotification, + }).annotate({ title: "Thread/startedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/status/changed").annotate({ title: "Thread/status/changedNotificationMethod", }), params: ServerNotification__ThreadStatusChangedNotification, + }).annotate({ title: "Thread/status/changedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/archived").annotate({ title: "Thread/archivedNotificationMethod", }), params: ServerNotification__ThreadArchivedNotification, + }).annotate({ title: "Thread/archivedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/deleted").annotate({ title: "Thread/deletedNotificationMethod", }), params: ServerNotification__ThreadDeletedNotification, + }).annotate({ title: "Thread/deletedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/unarchived").annotate({ title: "Thread/unarchivedNotificationMethod", }), params: ServerNotification__ThreadUnarchivedNotification, + }).annotate({ title: "Thread/unarchivedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/closed").annotate({ title: "Thread/closedNotificationMethod", }), params: ServerNotification__ThreadClosedNotification, + }).annotate({ title: "Thread/closedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("skills/changed").annotate({ title: "Skills/changedNotificationMethod", }), params: ServerNotification__SkillsChangedNotification, + }).annotate({ title: "Skills/changedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/name/updated").annotate({ title: "Thread/name/updatedNotificationMethod", }), params: ServerNotification__ThreadNameUpdatedNotification, + }).annotate({ title: "Thread/name/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/goal/updated").annotate({ title: "Thread/goal/updatedNotificationMethod", }), params: ServerNotification__ThreadGoalUpdatedNotification, + }).annotate({ title: "Thread/goal/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/goal/cleared").annotate({ title: "Thread/goal/clearedNotificationMethod", }), params: ServerNotification__ThreadGoalClearedNotification, + }).annotate({ title: "Thread/goal/clearedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/environment/connected").annotate({ title: "Thread/environment/connectedNotificationMethod", }), params: ServerNotification__EnvironmentConnectionNotification, + }).annotate({ title: "Thread/environment/connectedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/environment/disconnected").annotate({ title: "Thread/environment/disconnectedNotificationMethod", }), params: ServerNotification__EnvironmentConnectionNotification, + }).annotate({ title: "Thread/environment/disconnectedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/settings/updated").annotate({ title: "Thread/settings/updatedNotificationMethod", }), params: ServerNotification__ThreadSettingsUpdatedNotification, + }).annotate({ title: "Thread/settings/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/tokenUsage/updated").annotate({ title: "Thread/tokenUsage/updatedNotificationMethod", }), params: ServerNotification__ThreadTokenUsageUpdatedNotification, + }).annotate({ title: "Thread/tokenUsage/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("turn/started").annotate({ title: "Turn/startedNotificationMethod" }), params: ServerNotification__TurnStartedNotification, + }).annotate({ title: "Turn/startedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("hook/started").annotate({ title: "Hook/startedNotificationMethod" }), params: ServerNotification__HookStartedNotification, + }).annotate({ title: "Hook/startedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("turn/completed").annotate({ title: "Turn/completedNotificationMethod", }), params: ServerNotification__TurnCompletedNotification, + }).annotate({ title: "Turn/completedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("hook/completed").annotate({ title: "Hook/completedNotificationMethod", }), params: ServerNotification__HookCompletedNotification, + }).annotate({ title: "Hook/completedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("turn/diff/updated").annotate({ title: "Turn/diff/updatedNotificationMethod", }), params: ServerNotification__TurnDiffUpdatedNotification, + }).annotate({ title: "Turn/diff/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("turn/plan/updated").annotate({ title: "Turn/plan/updatedNotificationMethod", }), params: ServerNotification__TurnPlanUpdatedNotification, + }).annotate({ title: "Turn/plan/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/started").annotate({ title: "Item/startedNotificationMethod" }), params: ServerNotification__ItemStartedNotification, + }).annotate({ title: "Item/startedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/autoApprovalReview/started").annotate({ title: "Item/autoApprovalReview/startedNotificationMethod", }), params: ServerNotification__ItemGuardianApprovalReviewStartedNotification, + }).annotate({ title: "Item/autoApprovalReview/startedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/autoApprovalReview/completed").annotate({ title: "Item/autoApprovalReview/completedNotificationMethod", }), params: ServerNotification__ItemGuardianApprovalReviewCompletedNotification, + }).annotate({ title: "Item/autoApprovalReview/completedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/completed").annotate({ title: "Item/completedNotificationMethod", }), params: ServerNotification__ItemCompletedNotification, + }).annotate({ title: "Item/completedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/agentMessage/delta").annotate({ title: "Item/agentMessage/deltaNotificationMethod", }), params: ServerNotification__AgentMessageDeltaNotification, + }).annotate({ title: "Item/agentMessage/deltaNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/plan/delta").annotate({ title: "Item/plan/deltaNotificationMethod", }), params: ServerNotification__PlanDeltaNotification, + }).annotate({ + title: "Item/plan/deltaNotification", + description: "EXPERIMENTAL - proposed plan streaming deltas for plan items.", + }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("command/exec/outputDelta").annotate({ title: "Command/exec/outputDeltaNotificationMethod", }), params: ServerNotification__CommandExecOutputDeltaNotification, + }).annotate({ + title: "Command/exec/outputDeltaNotification", + description: + "Stream base64-encoded stdout/stderr chunks for a running `command/exec` session.", + }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("process/outputDelta").annotate({ title: "Process/outputDeltaNotificationMethod", }), params: ServerNotification__ProcessOutputDeltaNotification, + }).annotate({ + title: "Process/outputDeltaNotification", + description: + "Stream base64-encoded stdout/stderr chunks for a running `process/spawn` session.", + }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("process/exited").annotate({ title: "Process/exitedNotificationMethod", }), params: ServerNotification__ProcessExitedNotification, + }).annotate({ + title: "Process/exitedNotification", + description: "Final exit notification for a `process/spawn` session.", + }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/commandExecution/outputDelta").annotate({ title: "Item/commandExecution/outputDeltaNotificationMethod", }), params: ServerNotification__CommandExecutionOutputDeltaNotification, + }).annotate({ title: "Item/commandExecution/outputDeltaNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/commandExecution/terminalInteraction").annotate({ title: "Item/commandExecution/terminalInteractionNotificationMethod", }), params: ServerNotification__TerminalInteractionNotification, + }).annotate({ title: "Item/commandExecution/terminalInteractionNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/fileChange/outputDelta").annotate({ title: "Item/fileChange/outputDeltaNotificationMethod", }), params: ServerNotification__FileChangeOutputDeltaNotification, + }).annotate({ + title: "Item/fileChange/outputDeltaNotification", + description: "Deprecated legacy apply_patch output stream notification.", + }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/fileChange/patchUpdated").annotate({ title: "Item/fileChange/patchUpdatedNotificationMethod", }), params: ServerNotification__FileChangePatchUpdatedNotification, + }).annotate({ title: "Item/fileChange/patchUpdatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("serverRequest/resolved").annotate({ title: "ServerRequest/resolvedNotificationMethod", }), params: ServerNotification__ServerRequestResolvedNotification, + }).annotate({ title: "ServerRequest/resolvedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/mcpToolCall/progress").annotate({ title: "Item/mcpToolCall/progressNotificationMethod", }), params: ServerNotification__McpToolCallProgressNotification, + }).annotate({ title: "Item/mcpToolCall/progressNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("mcpServer/oauthLogin/completed").annotate({ title: "McpServer/oauthLogin/completedNotificationMethod", }), params: ServerNotification__McpServerOauthLoginCompletedNotification, + }).annotate({ title: "McpServer/oauthLogin/completedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("mcpServer/startupStatus/updated").annotate({ title: "McpServer/startupStatus/updatedNotificationMethod", }), params: ServerNotification__McpServerStatusUpdatedNotification, + }).annotate({ title: "McpServer/startupStatus/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("account/updated").annotate({ title: "Account/updatedNotificationMethod", }), params: ServerNotification__AccountUpdatedNotification, + }).annotate({ title: "Account/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("account/rateLimits/updated").annotate({ title: "Account/rateLimits/updatedNotificationMethod", }), params: ServerNotification__AccountRateLimitsUpdatedNotification, + }).annotate({ title: "Account/rateLimits/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("app/list/updated").annotate({ title: "App/list/updatedNotificationMethod", }), params: ServerNotification__AppListUpdatedNotification, + }).annotate({ title: "App/list/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("remoteControl/status/changed").annotate({ title: "RemoteControl/status/changedNotificationMethod", }), params: ServerNotification__RemoteControlStatusChangedNotification, + }).annotate({ title: "RemoteControl/status/changedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("externalAgentConfig/import/progress").annotate({ title: "ExternalAgentConfig/import/progressNotificationMethod", }), params: ServerNotification__ExternalAgentConfigImportProgressNotification, + }).annotate({ title: "ExternalAgentConfig/import/progressNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("externalAgentConfig/import/completed").annotate({ title: "ExternalAgentConfig/import/completedNotificationMethod", }), params: ServerNotification__ExternalAgentConfigImportCompletedNotification, + }).annotate({ title: "ExternalAgentConfig/import/completedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("fs/changed").annotate({ title: "Fs/changedNotificationMethod" }), params: ServerNotification__FsChangedNotification, + }).annotate({ title: "Fs/changedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/reasoning/summaryTextDelta").annotate({ title: "Item/reasoning/summaryTextDeltaNotificationMethod", }), params: ServerNotification__ReasoningSummaryTextDeltaNotification, + }).annotate({ title: "Item/reasoning/summaryTextDeltaNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/reasoning/summaryPartAdded").annotate({ title: "Item/reasoning/summaryPartAddedNotificationMethod", }), params: ServerNotification__ReasoningSummaryPartAddedNotification, + }).annotate({ title: "Item/reasoning/summaryPartAddedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("item/reasoning/textDelta").annotate({ title: "Item/reasoning/textDeltaNotificationMethod", }), params: ServerNotification__ReasoningTextDeltaNotification, + }).annotate({ title: "Item/reasoning/textDeltaNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/compacted").annotate({ title: "Thread/compactedNotificationMethod", }), params: ServerNotification__ContextCompactedNotification, + }).annotate({ + title: "Thread/compactedNotification", + description: "Deprecated: Use `ContextCompaction` item type instead.", + }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("model/rerouted").annotate({ title: "Model/reroutedNotificationMethod", }), params: ServerNotification__ModelReroutedNotification, + }).annotate({ title: "Model/reroutedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("model/verification").annotate({ title: "Model/verificationNotificationMethod", }), params: ServerNotification__ModelVerificationNotification, + }).annotate({ title: "Model/verificationNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("turn/moderationMetadata").annotate({ title: "Turn/moderationMetadataNotificationMethod", }), params: ServerNotification__TurnModerationMetadataNotification, + }).annotate({ title: "Turn/moderationMetadataNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("model/safetyBuffering/updated").annotate({ title: "Model/safetyBuffering/updatedNotificationMethod", }), params: ServerNotification__ModelSafetyBufferingUpdatedNotification, + }).annotate({ title: "Model/safetyBuffering/updatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("warning").annotate({ title: "WarningNotificationMethod" }), params: ServerNotification__WarningNotification, + }).annotate({ title: "WarningNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("guardianWarning").annotate({ title: "GuardianWarningNotificationMethod", }), params: ServerNotification__GuardianWarningNotification, + }).annotate({ title: "GuardianWarningNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("deprecationNotice").annotate({ title: "DeprecationNoticeNotificationMethod", }), params: ServerNotification__DeprecationNoticeNotification, + }).annotate({ title: "DeprecationNoticeNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("configWarning").annotate({ title: "ConfigWarningNotificationMethod", }), params: ServerNotification__ConfigWarningNotification, + }).annotate({ title: "ConfigWarningNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("fuzzyFileSearch/sessionUpdated").annotate({ title: "FuzzyFileSearch/sessionUpdatedNotificationMethod", }), params: ServerNotification__FuzzyFileSearchSessionUpdatedNotification, + }).annotate({ title: "FuzzyFileSearch/sessionUpdatedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("fuzzyFileSearch/sessionCompleted").annotate({ title: "FuzzyFileSearch/sessionCompletedNotificationMethod", }), params: ServerNotification__FuzzyFileSearchSessionCompletedNotification, + }).annotate({ title: "FuzzyFileSearch/sessionCompletedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/realtime/started").annotate({ title: "Thread/realtime/startedNotificationMethod", }), params: ServerNotification__ThreadRealtimeStartedNotification, + }).annotate({ title: "Thread/realtime/startedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/realtime/itemAdded").annotate({ title: "Thread/realtime/itemAddedNotificationMethod", }), params: ServerNotification__ThreadRealtimeItemAddedNotification, + }).annotate({ title: "Thread/realtime/itemAddedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/realtime/transcript/delta").annotate({ title: "Thread/realtime/transcript/deltaNotificationMethod", }), params: ServerNotification__ThreadRealtimeTranscriptDeltaNotification, + }).annotate({ title: "Thread/realtime/transcript/deltaNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/realtime/transcript/done").annotate({ title: "Thread/realtime/transcript/doneNotificationMethod", }), params: ServerNotification__ThreadRealtimeTranscriptDoneNotification, + }).annotate({ title: "Thread/realtime/transcript/doneNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/realtime/outputAudio/delta").annotate({ title: "Thread/realtime/outputAudio/deltaNotificationMethod", }), params: ServerNotification__ThreadRealtimeOutputAudioDeltaNotification, + }).annotate({ title: "Thread/realtime/outputAudio/deltaNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/realtime/sdp").annotate({ title: "Thread/realtime/sdpNotificationMethod", }), params: ServerNotification__ThreadRealtimeSdpNotification, + }).annotate({ title: "Thread/realtime/sdpNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/realtime/error").annotate({ title: "Thread/realtime/errorNotificationMethod", }), params: ServerNotification__ThreadRealtimeErrorNotification, + }).annotate({ title: "Thread/realtime/errorNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("thread/realtime/closed").annotate({ title: "Thread/realtime/closedNotificationMethod", }), params: ServerNotification__ThreadRealtimeClosedNotification, + }).annotate({ title: "Thread/realtime/closedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("windows/worldWritableWarning").annotate({ title: "Windows/worldWritableWarningNotificationMethod", }), params: ServerNotification__WindowsWorldWritableWarningNotification, + }).annotate({ + title: "Windows/worldWritableWarningNotification", + description: + "Notifies the user of world-writable directories on Windows, which cannot be protected by the sandbox.", + }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("windowsSandbox/setupCompleted").annotate({ title: "WindowsSandbox/setupCompletedNotificationMethod", }), params: ServerNotification__WindowsSandboxSetupCompletedNotification, + }).annotate({ title: "WindowsSandbox/setupCompletedNotification" }), + Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when app-server emitted this notification.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), - Schema.Struct({ method: Schema.Literal("account/login/completed").annotate({ title: "Account/login/completedNotificationMethod", }), params: ServerNotification__AccountLoginCompletedNotification, - emittedAtMs: Schema.optionalKey( - Schema.Number.annotate({ - description: - "Unix timestamp (in milliseconds) when app-server emitted this notification.", - format: "int64", - }).check(Schema.isInt()), - ), - }).annotate({ - title: "ServerNotification", - description: "Notification sent from the server to the client.", - }), + }).annotate({ title: "Account/login/completedNotification" }), ], { mode: "oneOf" }, -); - -export type ServerNotification__ByteRange = { readonly end: number; readonly start: number }; -export const ServerNotification__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), +).annotate({ + title: "ServerNotification", + description: "Notification sent from the server to the client.", }); -export type ServerNotification__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const ServerNotification__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type ServerNotification__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const ServerNotification__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type ServerNotification__CommandExecOutputStream = "stdout" | "stderr"; -export const ServerNotification__CommandExecOutputStream = Schema.Literals([ - "stdout", - "stderr", -]).annotate({ description: "Stream label for `command/exec/outputDelta` notifications." }); - -export type ServerNotification__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const ServerNotification__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type ServerNotification__HookSource = - | "system" - | "user" - | "project" - | "mdm" - | "sessionFlags" - | "plugin" - | "cloudRequirements" - | "cloudManagedConfig" - | "legacyManagedConfigFile" - | "legacyManagedConfigMdm" - | "unknown"; -export const ServerNotification__HookSource = Schema.Literals([ - "system", - "user", - "project", - "mdm", - "sessionFlags", - "plugin", - "cloudRequirements", - "cloudManagedConfig", - "legacyManagedConfigFile", - "legacyManagedConfigMdm", - "unknown", -]); - export type ServerNotification__MultiAgentMode = | "explicitRequestOnly" | "proactive" @@ -36668,45 +40240,15 @@ export const ServerNotification__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); -export type ServerNotification__NetworkAccess = "restricted" | "enabled"; -export const ServerNotification__NetworkAccess = Schema.Literals(["restricted", "enabled"]); - -export type ServerNotification__ProcessOutputStream = "stdout" | "stderr"; -export const ServerNotification__ProcessOutputStream = Schema.Literals([ - "stdout", - "stderr", -]).annotate({ description: "Stream label for `process/outputDelta` notifications." }); - -export type ServerNotification__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: ServerNotification__SubAgentSource }; -export const ServerNotification__SessionSource = Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: ServerNotification__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, -); - -export type ServerNotification__ThreadExtra = {}; -export const ServerNotification__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", -}); +export type ServerNotification__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const ServerNotification__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); export type ServerNotification__ThreadHistoryMode = "legacy" | "paginated"; export const ServerNotification__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); -export type ServerNotification__TurnItemsView = "notLoaded" | "summary" | "full"; -export const ServerNotification__TurnItemsView = Schema.Literals(["notLoaded", "summary", "full"]); - export type ServerRequest = | { readonly id: ServerRequest__RequestId; @@ -36941,8 +40483,12 @@ export const ToolRequestUserInputParams = Schema.Struct({ autoResolutionMs: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -36979,16 +40525,16 @@ export const V1InitializeParams = Schema.Struct({ }).annotate({ title: "InitializeParams" }); export type V1InitializeResponse = { - readonly codexHome: string; + readonly codexHome: V1InitializeResponse__AbsolutePathBuf; readonly platformFamily: string; readonly platformOs: string; readonly userAgent: string; }; export const V1InitializeResponse = Schema.Struct({ - codexHome: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + codexHome: Schema.suspend( + (): Schema.Codec => + V1InitializeResponse__AbsolutePathBuf, + ).annotate({ description: "Absolute path to the server's $CODEX_HOME directory." }), platformFamily: Schema.String.annotate({ description: 'Platform family for the running app-server target, for example `"unix"` or `"windows"`.', @@ -37000,12 +40546,6 @@ export const V1InitializeResponse = Schema.Struct({ userAgent: Schema.String, }).annotate({ title: "InitializeResponse" }); -export type V1InitializeResponse__AbsolutePathBuf = string; -export const V1InitializeResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - export type V2AccountLoginCompletedNotification = { readonly error?: string | null; readonly loginId?: string | null; @@ -37120,8 +40660,12 @@ export const V2AppsListParams = Schema.Struct({ description: "Optional page size; defaults to a reasonable server-side value.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -37201,7 +40745,7 @@ export type V2CommandExecOutputDeltaNotification = { readonly capReached: boolean; readonly deltaBase64: string; readonly processId: string; - readonly stream: "stdout" | "stderr"; + readonly stream: V2CommandExecOutputDeltaNotification__CommandExecOutputStream; }; export const V2CommandExecOutputDeltaNotification = Schema.Struct({ capReached: Schema.Boolean.annotate({ @@ -37213,21 +40757,16 @@ export const V2CommandExecOutputDeltaNotification = Schema.Struct({ description: "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", }), - stream: Schema.Literals(["stdout", "stderr"]).annotate({ - description: "Stream label for `command/exec/outputDelta` notifications.", - }), + stream: Schema.suspend( + (): Schema.Codec => + V2CommandExecOutputDeltaNotification__CommandExecOutputStream, + ).annotate({ description: "Output stream for this chunk." }), }).annotate({ title: "CommandExecOutputDeltaNotification", description: "Base64-encoded output chunk emitted for a streaming `command/exec` request.\n\nThese notifications are connection-scoped. If the originating connection closes, the server terminates the process.", }); -export type V2CommandExecOutputDeltaNotification__CommandExecOutputStream = "stdout" | "stderr"; -export const V2CommandExecOutputDeltaNotification__CommandExecOutputStream = Schema.Literals([ - "stdout", - "stderr", -]).annotate({ description: "Stream label for `command/exec/outputDelta` notifications." }); - export type V2CommandExecParams = { readonly command: ReadonlyArray; readonly cwd?: string | null; @@ -37283,8 +40822,12 @@ export const V2CommandExecParams = Schema.Struct({ "Optional per-stream stdout/stderr capture cap in bytes.\n\nWhen omitted, the server default applies. Cannot be combined with `disableOutputCap`.", format: "uint", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -37326,7 +40869,7 @@ export const V2CommandExecParams = Schema.Struct({ description: "Optional timeout in milliseconds.\n\nWhen omitted, the server default applies. Cannot be combined with `disableTimeout`.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), @@ -37341,58 +40884,29 @@ export const V2CommandExecParams = Schema.Struct({ "Run a standalone command (argv vector) in the server sandbox without creating a thread or turn.\n\nThe final `command/exec` response is deferred until the process exits and is sent only after all `command/exec/outputDelta` notifications for that connection have been emitted.", }); -export type V2CommandExecParams__NetworkAccess = "restricted" | "enabled"; -export const V2CommandExecParams__NetworkAccess = Schema.Literals(["restricted", "enabled"]); - export type V2CommandExecResizeParams = { readonly processId: string; - readonly size: { readonly cols: number; readonly rows: number }; + readonly size: V2CommandExecResizeParams__CommandExecTerminalSize; }; export const V2CommandExecResizeParams = Schema.Struct({ processId: Schema.String.annotate({ description: "Client-supplied, connection-scoped `processId` from the original `command/exec` request.", }), - size: Schema.Struct({ - cols: Schema.Number.annotate({ - description: "Terminal width in character cells.", - format: "uint16", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - rows: Schema.Number.annotate({ - description: "Terminal height in character cells.", - format: "uint16", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - }).annotate({ description: "PTY size in character cells for `command/exec` PTY sessions." }), + size: Schema.suspend( + (): Schema.Codec => + V2CommandExecResizeParams__CommandExecTerminalSize, + ).annotate({ description: "New PTY size in character cells." }), }).annotate({ title: "CommandExecResizeParams", description: "Resize a running PTY-backed `command/exec` session.", }); -export type V2CommandExecResizeParams__CommandExecTerminalSize = { - readonly cols: number; - readonly rows: number; -}; -export const V2CommandExecResizeParams__CommandExecTerminalSize = Schema.Struct({ - cols: Schema.Number.annotate({ - description: "Terminal width in character cells.", - format: "uint16", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - rows: Schema.Number.annotate({ - description: "Terminal height in character cells.", - format: "uint16", - }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}).annotate({ description: "PTY size in character cells for `command/exec` PTY sessions." }); - -export type V2CommandExecResizeResponse = {}; -export const V2CommandExecResizeResponse = Schema.Struct({}).annotate({ +export type V2CommandExecResizeResponse = { readonly [x: string]: Schema.Json }; +export const V2CommandExecResizeResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "CommandExecResizeResponse", description: "Empty success response for `command/exec/resize`.", }); @@ -37404,7 +40918,7 @@ export type V2CommandExecResponse = { }; export const V2CommandExecResponse = Schema.Struct({ exitCode: Schema.Number.annotate({ description: "Process exit code.", format: "int32" }).check( - Schema.isInt(), + Schema.isInt().annotate({ expected: "an integer" }), ), stderr: Schema.String.annotate({ description: @@ -37430,8 +40944,11 @@ export const V2CommandExecTerminateParams = Schema.Struct({ description: "Terminate a running `command/exec` session.", }); -export type V2CommandExecTerminateResponse = {}; -export const V2CommandExecTerminateResponse = Schema.Struct({}).annotate({ +export type V2CommandExecTerminateResponse = { readonly [x: string]: Schema.Json }; +export const V2CommandExecTerminateResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "CommandExecTerminateResponse", description: "Empty success response for `command/exec/terminate`.", }); @@ -37475,8 +40992,11 @@ export const V2CommandExecWriteParams = Schema.Struct({ description: "Write stdin bytes to a running `command/exec` session, close stdin, or both.", }); -export type V2CommandExecWriteResponse = {}; -export const V2CommandExecWriteResponse = Schema.Struct({}).annotate({ +export type V2CommandExecWriteResponse = { readonly [x: string]: Schema.Json }; +export const V2CommandExecWriteResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "CommandExecWriteResponse", description: "Empty success response for `command/exec/write`.", }); @@ -37698,8 +41218,12 @@ export const V2ConfigRequirementsReadResponse__NetworkRequirements = Schema.Stru httpPort: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -37715,8 +41239,12 @@ export const V2ConfigRequirementsReadResponse__NetworkRequirements = Schema.Stru socksPort: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "uint16" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -37738,7 +41266,7 @@ export type V2ConfigValueWriteParams = { readonly filePath?: string | null; readonly keyPath: string; readonly mergeStrategy: V2ConfigValueWriteParams__MergeStrategy; - readonly value: unknown; + readonly value: Schema.Json; }; export const V2ConfigValueWriteParams = Schema.Struct({ expectedVersion: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -37753,7 +41281,7 @@ export const V2ConfigValueWriteParams = Schema.Struct({ ), keyPath: Schema.String, mergeStrategy: V2ConfigValueWriteParams__MergeStrategy, - value: Schema.Unknown, + value: Schema.Json.annotate({ expected: "JSON value" }), }).annotate({ title: "ConfigValueWriteParams" }); export type V2ConfigWarningNotification = { @@ -37786,16 +41314,16 @@ export const V2ConfigWarningNotification = Schema.Struct({ }).annotate({ title: "ConfigWarningNotification" }); export type V2ConfigWriteResponse = { - readonly filePath: string; + readonly filePath: V2ConfigWriteResponse__AbsolutePathBuf; readonly overriddenMetadata?: V2ConfigWriteResponse__OverriddenMetadata | null; readonly status: V2ConfigWriteResponse__WriteStatus; readonly version: string; }; export const V2ConfigWriteResponse = Schema.Struct({ - filePath: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + filePath: Schema.suspend( + (): Schema.Codec => + V2ConfigWriteResponse__AbsolutePathBuf, + ).annotate({ description: "Canonical path to the config file that was written." }), overriddenMetadata: Schema.optionalKey( Schema.Union([V2ConfigWriteResponse__OverriddenMetadata, Schema.Null]), ), @@ -37916,8 +41444,12 @@ export const V2ExperimentalFeatureListParams = Schema.Struct({ description: "Optional page size; defaults to a reasonable server-side value.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -37949,20 +41481,6 @@ export const V2ExperimentalFeatureListResponse = Schema.Struct({ ), }).annotate({ title: "ExperimentalFeatureListResponse" }); -export type V2ExperimentalFeatureListResponse__ExperimentalFeatureStage = - | "beta" - | "underDevelopment" - | "stable" - | "deprecated" - | "removed"; -export const V2ExperimentalFeatureListResponse__ExperimentalFeatureStage = Schema.Literals([ - "beta", - "underDevelopment", - "stable", - "deprecated", - "removed", -]); - export type V2ExternalAgentConfigDetectParams = { readonly cwds?: ReadonlyArray | null; readonly includeHome?: boolean; @@ -38147,50 +41665,42 @@ export const V2FsChangedNotification = Schema.Struct({ }); export type V2FsCopyParams = { - readonly destinationPath: string; + readonly destinationPath: V2FsCopyParams__AbsolutePathBuf; readonly recursive?: boolean; - readonly sourcePath: string; + readonly sourcePath: V2FsCopyParams__AbsolutePathBuf; }; export const V2FsCopyParams = Schema.Struct({ - destinationPath: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + destinationPath: Schema.suspend( + (): Schema.Codec => V2FsCopyParams__AbsolutePathBuf, + ).annotate({ description: "Absolute destination path." }), recursive: Schema.optionalKey( Schema.Boolean.annotate({ description: "Required for directory copies; ignored for file copies.", }), ), - sourcePath: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + sourcePath: Schema.suspend( + (): Schema.Codec => V2FsCopyParams__AbsolutePathBuf, + ).annotate({ description: "Absolute source path." }), }).annotate({ title: "FsCopyParams", description: "Copy a file or directory tree on the host filesystem.", }); -export type V2FsCopyParams__AbsolutePathBuf = string; -export const V2FsCopyParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type V2FsCopyResponse = {}; -export const V2FsCopyResponse = Schema.Struct({}).annotate({ - title: "FsCopyResponse", - description: "Successful response for `fs/copy`.", -}); +export type V2FsCopyResponse = { readonly [x: string]: Schema.Json }; +export const V2FsCopyResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "FsCopyResponse", description: "Successful response for `fs/copy`." }); export type V2FsCreateDirectoryParams = { - readonly path: string; + readonly path: V2FsCreateDirectoryParams__AbsolutePathBuf; readonly recursive?: boolean | null; }; export const V2FsCreateDirectoryParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + path: Schema.suspend( + (): Schema.Codec => + V2FsCreateDirectoryParams__AbsolutePathBuf, + ).annotate({ description: "Absolute directory path to create." }), recursive: Schema.optionalKey( Schema.Union([ Schema.Boolean.annotate({ @@ -38204,35 +41714,26 @@ export const V2FsCreateDirectoryParams = Schema.Struct({ description: "Create a directory on the host filesystem.", }); -export type V2FsCreateDirectoryParams__AbsolutePathBuf = string; -export const V2FsCreateDirectoryParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type V2FsCreateDirectoryResponse = {}; -export const V2FsCreateDirectoryResponse = Schema.Struct({}).annotate({ +export type V2FsCreateDirectoryResponse = { readonly [x: string]: Schema.Json }; +export const V2FsCreateDirectoryResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "FsCreateDirectoryResponse", description: "Successful response for `fs/createDirectory`.", }); -export type V2FsGetMetadataParams = { readonly path: string }; +export type V2FsGetMetadataParams = { readonly path: V2FsGetMetadataParams__AbsolutePathBuf }; export const V2FsGetMetadataParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + path: Schema.suspend( + (): Schema.Codec => + V2FsGetMetadataParams__AbsolutePathBuf, + ).annotate({ description: "Absolute path to inspect." }), }).annotate({ title: "FsGetMetadataParams", description: "Request metadata for an absolute path.", }); -export type V2FsGetMetadataParams__AbsolutePathBuf = string; -export const V2FsGetMetadataParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - export type V2FsGetMetadataResponse = { readonly createdAtMs: number; readonly isDirectory: boolean; @@ -38244,7 +41745,7 @@ export const V2FsGetMetadataResponse = Schema.Struct({ createdAtMs: Schema.Number.annotate({ description: "File creation time in Unix milliseconds when available, otherwise `0`.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), isDirectory: Schema.Boolean.annotate({ description: "Whether the path resolves to a directory.", }), @@ -38255,29 +41756,23 @@ export const V2FsGetMetadataResponse = Schema.Struct({ modifiedAtMs: Schema.Number.annotate({ description: "File modification time in Unix milliseconds when available, otherwise `0`.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), }).annotate({ title: "FsGetMetadataResponse", description: "Metadata returned by `fs/getMetadata`.", }); -export type V2FsReadDirectoryParams = { readonly path: string }; +export type V2FsReadDirectoryParams = { readonly path: V2FsReadDirectoryParams__AbsolutePathBuf }; export const V2FsReadDirectoryParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + path: Schema.suspend( + (): Schema.Codec => + V2FsReadDirectoryParams__AbsolutePathBuf, + ).annotate({ description: "Absolute directory path to read." }), }).annotate({ title: "FsReadDirectoryParams", description: "List direct child names for a directory.", }); -export type V2FsReadDirectoryParams__AbsolutePathBuf = string; -export const V2FsReadDirectoryParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - export type V2FsReadDirectoryResponse = { readonly entries: ReadonlyArray; }; @@ -38290,20 +41785,13 @@ export const V2FsReadDirectoryResponse = Schema.Struct({ description: "Directory entries returned by `fs/readDirectory`.", }); -export type V2FsReadFileParams = { readonly path: string }; +export type V2FsReadFileParams = { readonly path: V2FsReadFileParams__AbsolutePathBuf }; export const V2FsReadFileParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + path: Schema.suspend( + (): Schema.Codec => V2FsReadFileParams__AbsolutePathBuf, + ).annotate({ description: "Absolute path to read." }), }).annotate({ title: "FsReadFileParams", description: "Read a file from the host filesystem." }); -export type V2FsReadFileParams__AbsolutePathBuf = string; -export const V2FsReadFileParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - export type V2FsReadFileResponse = { readonly dataBase64: string }; export const V2FsReadFileResponse = Schema.Struct({ dataBase64: Schema.String.annotate({ description: "File contents encoded as base64." }), @@ -38314,7 +41802,7 @@ export const V2FsReadFileResponse = Schema.Struct({ export type V2FsRemoveParams = { readonly force?: boolean | null; - readonly path: string; + readonly path: V2FsRemoveParams__AbsolutePathBuf; readonly recursive?: boolean | null; }; export const V2FsRemoveParams = Schema.Struct({ @@ -38326,10 +41814,9 @@ export const V2FsRemoveParams = Schema.Struct({ Schema.Null, ]), ), - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + path: Schema.suspend( + (): Schema.Codec => V2FsRemoveParams__AbsolutePathBuf, + ).annotate({ description: "Absolute path to remove." }), recursive: Schema.optionalKey( Schema.Union([ Schema.Boolean.annotate({ @@ -38343,17 +41830,11 @@ export const V2FsRemoveParams = Schema.Struct({ description: "Remove a file or directory tree from the host filesystem.", }); -export type V2FsRemoveParams__AbsolutePathBuf = string; -export const V2FsRemoveParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type V2FsRemoveResponse = {}; -export const V2FsRemoveResponse = Schema.Struct({}).annotate({ - title: "FsRemoveResponse", - description: "Successful response for `fs/remove`.", -}); +export type V2FsRemoveResponse = { readonly [x: string]: Schema.Json }; +export const V2FsRemoveResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "FsRemoveResponse", description: "Successful response for `fs/remove`." }); export type V2FsUnwatchParams = { readonly watchId: string }; export const V2FsUnwatchParams = Schema.Struct({ @@ -38365,18 +41846,20 @@ export const V2FsUnwatchParams = Schema.Struct({ description: "Stop filesystem watch notifications for a prior `fs/watch`.", }); -export type V2FsUnwatchResponse = {}; -export const V2FsUnwatchResponse = Schema.Struct({}).annotate({ - title: "FsUnwatchResponse", - description: "Successful response for `fs/unwatch`.", -}); +export type V2FsUnwatchResponse = { readonly [x: string]: Schema.Json }; +export const V2FsUnwatchResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "FsUnwatchResponse", description: "Successful response for `fs/unwatch`." }); -export type V2FsWatchParams = { readonly path: string; readonly watchId: string }; +export type V2FsWatchParams = { + readonly path: V2FsWatchParams__AbsolutePathBuf; + readonly watchId: string; +}; export const V2FsWatchParams = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + path: Schema.suspend( + (): Schema.Codec => V2FsWatchParams__AbsolutePathBuf, + ).annotate({ description: "Absolute file or directory path to watch." }), watchId: Schema.String.annotate({ description: "Connection-scoped watch identifier used for `fs/unwatch` and `fs/changed`.", }), @@ -38385,43 +41868,29 @@ export const V2FsWatchParams = Schema.Struct({ description: "Start filesystem watch notifications for an absolute path.", }); -export type V2FsWatchParams__AbsolutePathBuf = string; -export const V2FsWatchParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type V2FsWatchResponse = { readonly path: string }; +export type V2FsWatchResponse = { readonly path: V2FsWatchResponse__AbsolutePathBuf }; export const V2FsWatchResponse = Schema.Struct({ - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + path: Schema.suspend( + (): Schema.Codec => V2FsWatchResponse__AbsolutePathBuf, + ).annotate({ description: "Canonicalized path associated with the watch." }), }).annotate({ title: "FsWatchResponse", description: "Successful response for `fs/watch`." }); -export type V2FsWatchResponse__AbsolutePathBuf = string; -export const V2FsWatchResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type V2FsWriteFileParams = { readonly dataBase64: string; readonly path: string }; +export type V2FsWriteFileParams = { + readonly dataBase64: string; + readonly path: V2FsWriteFileParams__AbsolutePathBuf; +}; export const V2FsWriteFileParams = Schema.Struct({ dataBase64: Schema.String.annotate({ description: "File contents encoded as base64." }), - path: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), + path: Schema.suspend( + (): Schema.Codec => V2FsWriteFileParams__AbsolutePathBuf, + ).annotate({ description: "Absolute path to write." }), }).annotate({ title: "FsWriteFileParams", description: "Write a file on the host filesystem." }); -export type V2FsWriteFileParams__AbsolutePathBuf = string; -export const V2FsWriteFileParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", -}); - -export type V2FsWriteFileResponse = {}; -export const V2FsWriteFileResponse = Schema.Struct({}).annotate({ +export type V2FsWriteFileResponse = { readonly [x: string]: Schema.Json }; +export const V2FsWriteFileResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "FsWriteFileResponse", description: "Successful response for `fs/writeFile`.", }); @@ -38438,17 +41907,7 @@ export const V2GetAccountParams = Schema.Struct({ export type V2GetAccountRateLimitsResponse = { readonly rateLimitResetCredits?: V2GetAccountRateLimitsResponse__RateLimitResetCreditsSummary | null; - readonly rateLimits: { - readonly credits?: V2GetAccountRateLimitsResponse__CreditsSnapshot | null; - readonly individualLimit?: V2GetAccountRateLimitsResponse__SpendControlLimitSnapshot | null; - readonly limitId?: string | null; - readonly limitName?: string | null; - readonly planType?: V2GetAccountRateLimitsResponse__PlanType | null; - readonly primary?: V2GetAccountRateLimitsResponse__RateLimitWindow | null; - readonly rateLimitReachedType?: V2GetAccountRateLimitsResponse__RateLimitReachedType | null; - readonly secondary?: V2GetAccountRateLimitsResponse__RateLimitWindow | null; - readonly spendControlReached?: boolean | null; - }; + readonly rateLimits: V2GetAccountRateLimitsResponse__RateLimitSnapshot; readonly rateLimitsByLimitId?: { readonly [x: string]: V2GetAccountRateLimitsResponse__RateLimitSnapshot; } | null; @@ -38457,37 +41916,10 @@ export const V2GetAccountRateLimitsResponse = Schema.Struct({ rateLimitResetCredits: Schema.optionalKey( Schema.Union([V2GetAccountRateLimitsResponse__RateLimitResetCreditsSummary, Schema.Null]), ), - rateLimits: Schema.Struct({ - credits: Schema.optionalKey( - Schema.Union([V2GetAccountRateLimitsResponse__CreditsSnapshot, Schema.Null]), - ), - individualLimit: Schema.optionalKey( - Schema.Union([V2GetAccountRateLimitsResponse__SpendControlLimitSnapshot, Schema.Null]), - ), - limitId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - limitName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - planType: Schema.optionalKey( - Schema.Union([V2GetAccountRateLimitsResponse__PlanType, Schema.Null]), - ), - primary: Schema.optionalKey( - Schema.Union([V2GetAccountRateLimitsResponse__RateLimitWindow, Schema.Null]), - ), - rateLimitReachedType: Schema.optionalKey( - Schema.Union([V2GetAccountRateLimitsResponse__RateLimitReachedType, Schema.Null]), - ), - secondary: Schema.optionalKey( - Schema.Union([V2GetAccountRateLimitsResponse__RateLimitWindow, Schema.Null]), - ), - spendControlReached: Schema.optionalKey( - Schema.Union([ - Schema.Boolean.annotate({ - description: - "Backend-reported spend-control state. `None` is unavailable, not a sparse-update recovery.", - }), - Schema.Null, - ]), - ), - }).annotate({ + rateLimits: Schema.suspend( + (): Schema.Codec => + V2GetAccountRateLimitsResponse__RateLimitSnapshot, + ).annotate({ description: "Backward-compatible single-bucket view; mirrors the historical payload.", }), rateLimitsByLimitId: Schema.optionalKey( @@ -38555,32 +41987,6 @@ export const V2HookCompletedNotification = Schema.Struct({ turnId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ title: "HookCompletedNotification" }); -export type V2HookCompletedNotification__HookSource = - | "system" - | "user" - | "project" - | "mdm" - | "sessionFlags" - | "plugin" - | "cloudRequirements" - | "cloudManagedConfig" - | "legacyManagedConfigFile" - | "legacyManagedConfigMdm" - | "unknown"; -export const V2HookCompletedNotification__HookSource = Schema.Literals([ - "system", - "user", - "project", - "mdm", - "sessionFlags", - "plugin", - "cloudRequirements", - "cloudManagedConfig", - "legacyManagedConfigFile", - "legacyManagedConfigMdm", - "unknown", -]); - export type V2HooksListParams = { readonly cwds?: ReadonlyArray }; export const V2HooksListParams = Schema.Struct({ cwds: Schema.optionalKey( @@ -38608,32 +42014,6 @@ export const V2HookStartedNotification = Schema.Struct({ turnId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ title: "HookStartedNotification" }); -export type V2HookStartedNotification__HookSource = - | "system" - | "user" - | "project" - | "mdm" - | "sessionFlags" - | "plugin" - | "cloudRequirements" - | "cloudManagedConfig" - | "legacyManagedConfigFile" - | "legacyManagedConfigMdm" - | "unknown"; -export const V2HookStartedNotification__HookSource = Schema.Literals([ - "system", - "user", - "project", - "mdm", - "sessionFlags", - "plugin", - "cloudRequirements", - "cloudManagedConfig", - "legacyManagedConfigFile", - "legacyManagedConfigMdm", - "unknown", -]); - export type V2ItemCompletedNotification = { readonly completedAtMs: number; readonly item: V2ItemCompletedNotification__ThreadItem; @@ -38644,71 +42024,12 @@ export const V2ItemCompletedNotification = Schema.Struct({ completedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this item lifecycle completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), item: V2ItemCompletedNotification__ThreadItem, threadId: Schema.String, turnId: Schema.String, }).annotate({ title: "ItemCompletedNotification" }); -export type V2ItemCompletedNotification__ByteRange = { - readonly end: number; - readonly start: number; -}; -export const V2ItemCompletedNotification__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ItemCompletedNotification__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ItemCompletedNotification__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ItemCompletedNotification__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ItemCompletedNotification__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ItemCompletedNotification__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ItemCompletedNotification__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - export type V2ItemGuardianApprovalReviewCompletedNotification = { readonly action: V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewAction; readonly completedAtMs: number; @@ -38725,14 +42046,14 @@ export const V2ItemGuardianApprovalReviewCompletedNotification = Schema.Struct({ completedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this review completed.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), decisionSource: V2ItemGuardianApprovalReviewCompletedNotification__AutoReviewDecisionSource, review: V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReview, reviewId: Schema.String.annotate({ description: "Stable identifier for this review." }), startedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this review started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), targetItemId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -38766,7 +42087,7 @@ export const V2ItemGuardianApprovalReviewStartedNotification = Schema.Struct({ startedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this review started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), targetItemId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -38795,67 +42116,11 @@ export const V2ItemStartedNotification = Schema.Struct({ startedAtMs: Schema.Number.annotate({ description: "Unix timestamp (in milliseconds) when this item lifecycle started.", format: "int64", - }).check(Schema.isInt()), + }).check(Schema.isInt().annotate({ expected: "an integer" })), threadId: Schema.String, turnId: Schema.String, }).annotate({ title: "ItemStartedNotification" }); -export type V2ItemStartedNotification__ByteRange = { readonly end: number; readonly start: number }; -export const V2ItemStartedNotification__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ItemStartedNotification__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ItemStartedNotification__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ItemStartedNotification__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ItemStartedNotification__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ItemStartedNotification__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ItemStartedNotification__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - export type V2ListMcpServerStatusParams = { readonly cursor?: string | null; readonly detail?: V2ListMcpServerStatusParams__McpServerStatusDetail | null; @@ -38883,8 +42148,12 @@ export const V2ListMcpServerStatusParams = Schema.Struct({ description: "Optional page size; defaults to a server-defined value.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -39032,10 +42301,11 @@ export const V2LoginAccountResponse = Schema.Union( { mode: "oneOf" }, ).annotate({ title: "LoginAccountResponse" }); -export type V2LogoutAccountResponse = {}; -export const V2LogoutAccountResponse = Schema.Struct({}).annotate({ - title: "LogoutAccountResponse", -}); +export type V2LogoutAccountResponse = { readonly [x: string]: Schema.Json }; +export const V2LogoutAccountResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "LogoutAccountResponse" }); export type V2MarketplaceAddParams = { readonly refName?: string | null; @@ -39133,7 +42403,12 @@ export const V2McpServerOauthLoginParams = Schema.Struct({ scopes: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), timeoutSecs: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), }).annotate({ title: "McpServerOauthLoginParams" }); @@ -39142,10 +42417,11 @@ export const V2McpServerOauthLoginResponse = Schema.Struct({ authorizationUrl: Schema.String, }).annotate({ title: "McpServerOauthLoginResponse" }); -export type V2McpServerRefreshResponse = {}; -export const V2McpServerRefreshResponse = Schema.Struct({}).annotate({ - title: "McpServerRefreshResponse", -}); +export type V2McpServerRefreshResponse = { readonly [x: string]: Schema.Json }; +export const V2McpServerRefreshResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "McpServerRefreshResponse" }); export type V2McpServerStatusUpdatedNotification = { readonly error?: string | null; @@ -39168,31 +42444,31 @@ export const V2McpServerStatusUpdatedNotification = Schema.Struct({ }).annotate({ title: "McpServerStatusUpdatedNotification" }); export type V2McpServerToolCallParams = { - readonly _meta?: unknown; - readonly arguments?: unknown; + readonly _meta?: Schema.Json; + readonly arguments?: Schema.Json; readonly server: string; readonly threadId: string; readonly tool: string; }; export const V2McpServerToolCallParams = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - arguments: Schema.optionalKey(Schema.Unknown), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + arguments: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), server: Schema.String, threadId: Schema.String, tool: Schema.String, }).annotate({ title: "McpServerToolCallParams" }); export type V2McpServerToolCallResponse = { - readonly _meta?: unknown; - readonly content: ReadonlyArray; + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; readonly isError?: boolean | null; - readonly structuredContent?: unknown; + readonly structuredContent?: Schema.Json; }; export const V2McpServerToolCallResponse = Schema.Struct({ - _meta: Schema.optionalKey(Schema.Unknown), - content: Schema.Array(Schema.Unknown), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), isError: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - structuredContent: Schema.optionalKey(Schema.Unknown), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), }).annotate({ title: "McpServerToolCallResponse" }); export type V2McpToolCallProgressNotification = { @@ -39236,8 +42512,12 @@ export const V2ModelListParams = Schema.Struct({ description: "Optional page size; defaults to a reasonable server-side value.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -39260,10 +42540,11 @@ export const V2ModelListResponse = Schema.Struct({ ), }).annotate({ title: "ModelListResponse" }); -export type V2ModelProviderCapabilitiesReadParams = {}; -export const V2ModelProviderCapabilitiesReadParams = Schema.Struct({}).annotate({ - title: "ModelProviderCapabilitiesReadParams", -}); +export type V2ModelProviderCapabilitiesReadParams = { readonly [x: string]: Schema.Json }; +export const V2ModelProviderCapabilitiesReadParams = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "ModelProviderCapabilitiesReadParams" }); export type V2ModelProviderCapabilitiesReadResponse = { readonly imageGeneration: boolean; @@ -39349,8 +42630,12 @@ export const V2PermissionProfileListParams = Schema.Struct({ description: "Optional page size; defaults to the full result set.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -39425,12 +42710,6 @@ export const V2PluginInstalledResponse = Schema.Struct({ marketplaces: Schema.Array(V2PluginInstalledResponse__PluginMarketplaceEntry), }).annotate({ title: "PluginInstalledResponse" }); -export type V2PluginInstalledResponse__PluginAvailability = "DISABLED_BY_ADMIN" | "AVAILABLE"; -export const V2PluginInstalledResponse__PluginAvailability = Schema.Literals([ - "DISABLED_BY_ADMIN", - "AVAILABLE", -]); - export type V2PluginInstallParams = { readonly marketplacePath?: V2PluginInstallParams__AbsolutePathBuf | null; readonly pluginName: string; @@ -39491,12 +42770,6 @@ export const V2PluginListResponse = Schema.Struct({ marketplaces: Schema.Array(V2PluginListResponse__PluginMarketplaceEntry), }).annotate({ title: "PluginListResponse" }); -export type V2PluginListResponse__PluginAvailability = "DISABLED_BY_ADMIN" | "AVAILABLE"; -export const V2PluginListResponse__PluginAvailability = Schema.Literals([ - "DISABLED_BY_ADMIN", - "AVAILABLE", -]); - export type V2PluginReadParams = { readonly marketplacePath?: V2PluginReadParams__AbsolutePathBuf | null; readonly pluginName: string; @@ -39515,12 +42788,6 @@ export const V2PluginReadResponse = Schema.Struct({ plugin: V2PluginReadResponse__PluginDetail, }).annotate({ title: "PluginReadResponse" }); -export type V2PluginReadResponse__PluginAvailability = "DISABLED_BY_ADMIN" | "AVAILABLE"; -export const V2PluginReadResponse__PluginAvailability = Schema.Literals([ - "DISABLED_BY_ADMIN", - "AVAILABLE", -]); - export type V2PluginShareCheckoutParams = { readonly remotePluginId: string }; export const V2PluginShareCheckoutParams = Schema.Struct({ remotePluginId: Schema.String, @@ -39550,15 +42817,17 @@ export const V2PluginShareDeleteParams = Schema.Struct({ remotePluginId: Schema. title: "PluginShareDeleteParams", }); -export type V2PluginShareDeleteResponse = {}; -export const V2PluginShareDeleteResponse = Schema.Struct({}).annotate({ - title: "PluginShareDeleteResponse", -}); +export type V2PluginShareDeleteResponse = { readonly [x: string]: Schema.Json }; +export const V2PluginShareDeleteResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "PluginShareDeleteResponse" }); -export type V2PluginShareListParams = {}; -export const V2PluginShareListParams = Schema.Struct({}).annotate({ - title: "PluginShareListParams", -}); +export type V2PluginShareListParams = { readonly [x: string]: Schema.Json }; +export const V2PluginShareListParams = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "PluginShareListParams" }); export type V2PluginShareListResponse = { readonly data: ReadonlyArray; @@ -39567,12 +42836,6 @@ export const V2PluginShareListResponse = Schema.Struct({ data: Schema.Array(V2PluginShareListResponse__PluginShareListItem), }).annotate({ title: "PluginShareListResponse" }); -export type V2PluginShareListResponse__PluginAvailability = "DISABLED_BY_ADMIN" | "AVAILABLE"; -export const V2PluginShareListResponse__PluginAvailability = Schema.Literals([ - "DISABLED_BY_ADMIN", - "AVAILABLE", -]); - export type V2PluginShareSaveParams = { readonly discoverability?: V2PluginShareSaveParams__PluginShareDiscoverability | null; readonly pluginPath: V2PluginShareSaveParams__AbsolutePathBuf; @@ -39640,10 +42903,11 @@ export const V2PluginUninstallParams = Schema.Struct({ pluginId: Schema.String } title: "PluginUninstallParams", }); -export type V2PluginUninstallResponse = {}; -export const V2PluginUninstallResponse = Schema.Struct({}).annotate({ - title: "PluginUninstallResponse", -}); +export type V2PluginUninstallResponse = { readonly [x: string]: Schema.Json }; +export const V2PluginUninstallResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "PluginUninstallResponse" }); export type V2ProcessExitedNotification = { readonly exitCode: number; @@ -39655,7 +42919,7 @@ export type V2ProcessExitedNotification = { }; export const V2ProcessExitedNotification = Schema.Struct({ exitCode: Schema.Number.annotate({ description: "Process exit code.", format: "int32" }).check( - Schema.isInt(), + Schema.isInt().annotate({ expected: "an integer" }), ), processHandle: Schema.String.annotate({ description: "Client-supplied, connection-scoped `processHandle` from `process/spawn`.", @@ -39685,7 +42949,7 @@ export type V2ProcessOutputDeltaNotification = { readonly capReached: boolean; readonly deltaBase64: string; readonly processHandle: string; - readonly stream: "stdout" | "stderr"; + readonly stream: V2ProcessOutputDeltaNotification__ProcessOutputStream; }; export const V2ProcessOutputDeltaNotification = Schema.Struct({ capReached: Schema.Boolean.annotate({ @@ -39696,20 +42960,15 @@ export const V2ProcessOutputDeltaNotification = Schema.Struct({ processHandle: Schema.String.annotate({ description: "Client-supplied, connection-scoped `processHandle` from `process/spawn`.", }), - stream: Schema.Literals(["stdout", "stderr"]).annotate({ - description: "Stream label for `process/outputDelta` notifications.", - }), + stream: Schema.suspend( + (): Schema.Codec => + V2ProcessOutputDeltaNotification__ProcessOutputStream, + ).annotate({ description: "Output stream this chunk belongs to." }), }).annotate({ title: "ProcessOutputDeltaNotification", description: "Base64-encoded output chunk emitted for a streaming `process/spawn` request.", }); -export type V2ProcessOutputDeltaNotification__ProcessOutputStream = "stdout" | "stderr"; -export const V2ProcessOutputDeltaNotification__ProcessOutputStream = Schema.Literals([ - "stdout", - "stderr", -]).annotate({ description: "Stream label for `process/outputDelta` notifications." }); - export type V2RawResponseCompletedNotification = { readonly responseId: string; readonly threadId: string; @@ -39748,7 +43007,9 @@ export type V2ReasoningSummaryPartAddedNotification = { }; export const V2ReasoningSummaryPartAddedNotification = Schema.Struct({ itemId: Schema.String, - summaryIndex: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + summaryIndex: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), threadId: Schema.String, turnId: Schema.String, }).annotate({ title: "ReasoningSummaryPartAddedNotification" }); @@ -39763,7 +43024,9 @@ export type V2ReasoningSummaryTextDeltaNotification = { export const V2ReasoningSummaryTextDeltaNotification = Schema.Struct({ delta: Schema.String, itemId: Schema.String, - summaryIndex: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + summaryIndex: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), threadId: Schema.String, turnId: Schema.String, }).annotate({ title: "ReasoningSummaryTextDeltaNotification" }); @@ -39776,7 +43039,9 @@ export type V2ReasoningTextDeltaNotification = { readonly turnId: string; }; export const V2ReasoningTextDeltaNotification = Schema.Struct({ - contentIndex: Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), + contentIndex: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), delta: Schema.String, itemId: Schema.String, threadId: Schema.String, @@ -39827,69 +43092,6 @@ export const V2ReviewStartResponse = Schema.Struct({ turn: V2ReviewStartResponse__Turn, }).annotate({ title: "ReviewStartResponse" }); -export type V2ReviewStartResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ReviewStartResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ReviewStartResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ReviewStartResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ReviewStartResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ReviewStartResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ReviewStartResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ReviewStartResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2ReviewStartResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ReviewStartResponse__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2SendAddCreditsNudgeEmailParams = { readonly creditType: V2SendAddCreditsNudgeEmailParams__AddCreditsNudgeCreditType; }; @@ -39913,8 +43115,11 @@ export const V2ServerRequestResolvedNotification = Schema.Struct({ threadId: Schema.String, }).annotate({ title: "ServerRequestResolvedNotification" }); -export type V2SkillsChangedNotification = {}; -export const V2SkillsChangedNotification = Schema.Struct({}).annotate({ +export type V2SkillsChangedNotification = { readonly [x: string]: Schema.Json }; +export const V2SkillsChangedNotification = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "SkillsChangedNotification", description: "Notification emitted when watched local skill files change.\n\nTreat this as an invalidation signal and re-run `skills/list` with the client's current parameters when refreshed skill metadata is needed.", @@ -39949,10 +43154,11 @@ export const V2SkillsExtraRootsSetParams = Schema.Struct({ extraRoots: Schema.Array(V2SkillsExtraRootsSetParams__AbsolutePathBuf), }).annotate({ title: "SkillsExtraRootsSetParams" }); -export type V2SkillsExtraRootsSetResponse = {}; -export const V2SkillsExtraRootsSetResponse = Schema.Struct({}).annotate({ - title: "SkillsExtraRootsSetResponse", -}); +export type V2SkillsExtraRootsSetResponse = { readonly [x: string]: Schema.Json }; +export const V2SkillsExtraRootsSetResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "SkillsExtraRootsSetResponse" }); export type V2SkillsListParams = { readonly cwds?: ReadonlyArray; @@ -39994,20 +43200,22 @@ export const V2TerminalInteractionNotification = Schema.Struct({ }).annotate({ title: "TerminalInteractionNotification" }); export type V2ThreadApproveGuardianDeniedActionParams = { - readonly event: unknown; + readonly event: Schema.Json; readonly threadId: string; }; export const V2ThreadApproveGuardianDeniedActionParams = Schema.Struct({ - event: Schema.Unknown.annotate({ + event: Schema.Json.annotate({ + expected: "JSON value", description: "Serialized `codex_protocol::protocol::GuardianAssessmentEvent`.", }), threadId: Schema.String, }).annotate({ title: "ThreadApproveGuardianDeniedActionParams" }); -export type V2ThreadApproveGuardianDeniedActionResponse = {}; -export const V2ThreadApproveGuardianDeniedActionResponse = Schema.Struct({}).annotate({ - title: "ThreadApproveGuardianDeniedActionResponse", -}); +export type V2ThreadApproveGuardianDeniedActionResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadApproveGuardianDeniedActionResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "ThreadApproveGuardianDeniedActionResponse" }); export type V2ThreadArchivedNotification = { readonly threadId: string }; export const V2ThreadArchivedNotification = Schema.Struct({ threadId: Schema.String }).annotate({ @@ -40019,10 +43227,11 @@ export const V2ThreadArchiveParams = Schema.Struct({ threadId: Schema.String }). title: "ThreadArchiveParams", }); -export type V2ThreadArchiveResponse = {}; -export const V2ThreadArchiveResponse = Schema.Struct({}).annotate({ - title: "ThreadArchiveResponse", -}); +export type V2ThreadArchiveResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadArchiveResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "ThreadArchiveResponse" }); export type V2ThreadClosedNotification = { readonly threadId: string }; export const V2ThreadClosedNotification = Schema.Struct({ threadId: Schema.String }).annotate({ @@ -40034,10 +43243,11 @@ export const V2ThreadCompactStartParams = Schema.Struct({ threadId: Schema.Strin title: "ThreadCompactStartParams", }); -export type V2ThreadCompactStartResponse = {}; -export const V2ThreadCompactStartResponse = Schema.Struct({}).annotate({ - title: "ThreadCompactStartResponse", -}); +export type V2ThreadCompactStartResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadCompactStartResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "ThreadCompactStartResponse" }); export type V2ThreadDeletedNotification = { readonly threadId: string }; export const V2ThreadDeletedNotification = Schema.Struct({ threadId: Schema.String }).annotate({ @@ -40049,14 +43259,17 @@ export const V2ThreadDeleteParams = Schema.Struct({ threadId: Schema.String }).a title: "ThreadDeleteParams", }); -export type V2ThreadDeleteResponse = {}; -export const V2ThreadDeleteResponse = Schema.Struct({}).annotate({ title: "ThreadDeleteResponse" }); +export type V2ThreadDeleteResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadDeleteResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "ThreadDeleteResponse" }); export type V2ThreadForkParams = { readonly approvalPolicy?: V2ThreadForkParams__AskForApproval | null; readonly approvalsReviewer?: V2ThreadForkParams__ApprovalsReviewer | null; readonly baseInstructions?: string | null; - readonly config?: { readonly [x: string]: unknown } | null; + readonly config?: { readonly [x: string]: Schema.Json } | null; readonly cwd?: string | null; readonly developerInstructions?: string | null; readonly ephemeral?: boolean; @@ -40080,7 +43293,10 @@ export const V2ThreadForkParams = Schema.Struct({ ), baseInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), config: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null]), + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), + Schema.Null, + ]), ), cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -40126,32 +43342,22 @@ export const V2ThreadForkParams__AbsolutePathBuf = Schema.String.annotate({ export type V2ThreadForkResponse = { readonly approvalPolicy: V2ThreadForkResponse__AskForApproval; - readonly approvalsReviewer: "user" | "auto_review" | "guardian_subagent"; + readonly approvalsReviewer: V2ThreadForkResponse__ApprovalsReviewer; readonly cwd: V2ThreadForkResponse__AbsolutePathBuf; readonly instructionSources?: ReadonlyArray; readonly model: string; readonly modelProvider: string; readonly reasoningEffort?: V2ThreadForkResponse__ReasoningEffort | null; - readonly sandbox: - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } - | { - readonly excludeSlashTmp?: boolean; - readonly excludeTmpdirEnvVar?: boolean; - readonly networkAccess?: boolean; - readonly type: "workspaceWrite"; - readonly writableRoots?: ReadonlyArray; - }; + readonly sandbox: V2ThreadForkResponse__SandboxPolicy; readonly serviceTier?: string | null; readonly thread: V2ThreadForkResponse__Thread; }; export const V2ThreadForkResponse = Schema.Struct({ approvalPolicy: V2ThreadForkResponse__AskForApproval, - approvalsReviewer: Schema.Literals(["user", "auto_review", "guardian_subagent"]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", - }), + approvalsReviewer: Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__ApprovalsReviewer, + ).annotate({ description: "Reviewer currently used for approval requests on this thread." }), cwd: V2ThreadForkResponse__AbsolutePathBuf, instructionSources: Schema.optionalKey( Schema.Array(V2ThreadForkResponse__LegacyAppPathString).annotate({ @@ -40165,38 +43371,8 @@ export const V2ThreadForkResponse = Schema.Struct({ reasoningEffort: Schema.optionalKey( Schema.Union([V2ThreadForkResponse__ReasoningEffort, Schema.Null]), ), - sandbox: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("dangerFullAccess").annotate({ - title: "DangerFullAccessSandboxPolicyType", - }), - }).annotate({ title: "DangerFullAccessSandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), - }).annotate({ title: "ReadOnlySandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), - ), - type: Schema.Literal("externalSandbox").annotate({ - title: "ExternalSandboxSandboxPolicyType", - }), - }).annotate({ title: "ExternalSandboxSandboxPolicy" }), - Schema.Struct({ - excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("workspaceWrite").annotate({ - title: "WorkspaceWriteSandboxPolicyType", - }), - writableRoots: Schema.optionalKey( - Schema.Array(V2ThreadForkResponse__AbsolutePathBuf).annotate({ default: [] }), - ), - }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), - ], - { mode: "oneOf" }, + sandbox: Schema.suspend( + (): Schema.Codec => V2ThreadForkResponse__SandboxPolicy, ).annotate({ description: "Legacy sandbox policy retained for compatibility. Experimental clients should prefer `activePermissionProfile` for profile provenance.", @@ -40225,72 +43401,6 @@ export const V2ThreadForkResponse__ActivePermissionProfile = Schema.Struct({ }), }); -export type V2ThreadForkResponse__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; -export const V2ThreadForkResponse__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", -}); - -export type V2ThreadForkResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ThreadForkResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ThreadForkResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ThreadForkResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ThreadForkResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ThreadForkResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ThreadForkResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ThreadForkResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - export type V2ThreadForkResponse__MultiAgentMode = | "explicitRequestOnly" | "proactive" @@ -40306,113 +43416,15 @@ export const V2ThreadForkResponse__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); -export type V2ThreadForkResponse__NetworkAccess = "restricted" | "enabled"; -export const V2ThreadForkResponse__NetworkAccess = Schema.Literals(["restricted", "enabled"]); - -export type V2ThreadForkResponse__SandboxPolicy = - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } - | { - readonly excludeSlashTmp?: boolean; - readonly excludeTmpdirEnvVar?: boolean; - readonly networkAccess?: boolean; - readonly type: "workspaceWrite"; - readonly writableRoots?: ReadonlyArray; - }; -export const V2ThreadForkResponse__SandboxPolicy = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("dangerFullAccess").annotate({ - title: "DangerFullAccessSandboxPolicyType", - }), - }).annotate({ title: "DangerFullAccessSandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), - }).annotate({ title: "ReadOnlySandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), - ), - type: Schema.Literal("externalSandbox").annotate({ - title: "ExternalSandboxSandboxPolicyType", - }), - }).annotate({ title: "ExternalSandboxSandboxPolicy" }), - Schema.Struct({ - excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), - writableRoots: Schema.optionalKey( - Schema.Array(V2ThreadForkResponse__AbsolutePathBuf).annotate({ default: [] }), - ), - }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadForkResponse__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadForkResponse__SubAgentSource }; -export const V2ThreadForkResponse__SessionSource = Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadForkResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadForkResponse__ThreadExtra = {}; -export const V2ThreadForkResponse__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", -}); +export type V2ThreadForkResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadForkResponse__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); export type V2ThreadForkResponse__ThreadHistoryMode = "legacy" | "paginated"; export const V2ThreadForkResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); -export type V2ThreadForkResponse__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadForkResponse__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadForkResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadForkResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadForkResponse__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2ThreadGoalClearedNotification = { readonly threadId: string }; export const V2ThreadGoalClearedNotification = Schema.Struct({ threadId: Schema.String }).annotate({ title: "ThreadGoalClearedNotification", @@ -40451,7 +43463,12 @@ export const V2ThreadGoalSetParams = Schema.Struct({ status: Schema.optionalKey(Schema.Union([V2ThreadGoalSetParams__ThreadGoalStatus, Schema.Null])), threadId: Schema.String, tokenBudget: Schema.optionalKey( - Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), ), }).annotate({ title: "ThreadGoalSetParams" }); @@ -40472,20 +43489,21 @@ export const V2ThreadGoalUpdatedNotification = Schema.Struct({ }).annotate({ title: "ThreadGoalUpdatedNotification" }); export type V2ThreadInjectItemsParams = { - readonly items: ReadonlyArray; + readonly items: ReadonlyArray; readonly threadId: string; }; export const V2ThreadInjectItemsParams = Schema.Struct({ - items: Schema.Array(Schema.Unknown).annotate({ + items: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ description: "Raw Responses API items to append to the thread's model-visible history.", }), threadId: Schema.String, }).annotate({ title: "ThreadInjectItemsParams" }); -export type V2ThreadInjectItemsResponse = {}; -export const V2ThreadInjectItemsResponse = Schema.Struct({}).annotate({ - title: "ThreadInjectItemsResponse", -}); +export type V2ThreadInjectItemsResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadInjectItemsResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "ThreadInjectItemsResponse" }); export type V2ThreadListParams = { readonly archived?: boolean | null; @@ -40529,8 +43547,12 @@ export const V2ThreadListParams = Schema.Struct({ description: "Optional page size; defaults to a reasonable server-side value.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -40605,123 +43627,15 @@ export const V2ThreadListResponse = Schema.Struct({ ), }).annotate({ title: "ThreadListResponse" }); -export type V2ThreadListResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ThreadListResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ThreadListResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ThreadListResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ThreadListResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ThreadListResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ThreadListResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ThreadListResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2ThreadListResponse__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadListResponse__SubAgentSource }; -export const V2ThreadListResponse__SessionSource = Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadListResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadListResponse__ThreadExtra = {}; -export const V2ThreadListResponse__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", -}); +export type V2ThreadListResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadListResponse__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); export type V2ThreadListResponse__ThreadHistoryMode = "legacy" | "paginated"; export const V2ThreadListResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); -export type V2ThreadListResponse__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadListResponse__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadListResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadListResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadListResponse__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2ThreadLoadedListParams = { readonly cursor?: string | null; readonly limit?: number | null; @@ -40741,8 +43655,12 @@ export const V2ThreadLoadedListParams = Schema.Struct({ description: "Optional page size; defaults to no limit.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -40791,88 +43709,11 @@ export const V2ThreadMetadataUpdateResponse = Schema.Struct({ thread: V2ThreadMetadataUpdateResponse__Thread, }).annotate({ title: "ThreadMetadataUpdateResponse" }); -export type V2ThreadMetadataUpdateResponse__ByteRange = { - readonly end: number; - readonly start: number; -}; -export const V2ThreadMetadataUpdateResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ThreadMetadataUpdateResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ThreadMetadataUpdateResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ThreadMetadataUpdateResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ThreadMetadataUpdateResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2ThreadMetadataUpdateResponse__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadMetadataUpdateResponse__SubAgentSource }; -export const V2ThreadMetadataUpdateResponse__SessionSource = Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadMetadataUpdateResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadMetadataUpdateResponse__ThreadExtra = {}; -export const V2ThreadMetadataUpdateResponse__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", -}); +export type V2ThreadMetadataUpdateResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadMetadataUpdateResponse__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); export type V2ThreadMetadataUpdateResponse__ThreadHistoryMode = "legacy" | "paginated"; export const V2ThreadMetadataUpdateResponse__ThreadHistoryMode = Schema.Literals([ @@ -40880,40 +43721,6 @@ export const V2ThreadMetadataUpdateResponse__ThreadHistoryMode = Schema.Literals "paginated", ]); -export type V2ThreadMetadataUpdateResponse__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadMetadataUpdateResponse__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadMetadataUpdateResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadMetadataUpdateResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadMetadataUpdateResponse__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2ThreadNameUpdatedNotification = { readonly threadId: string; readonly threadName?: string | null; @@ -40938,123 +43745,15 @@ export const V2ThreadReadResponse = Schema.Struct({ thread: V2ThreadReadResponse__Thread, }).annotate({ title: "ThreadReadResponse" }); -export type V2ThreadReadResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ThreadReadResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ThreadReadResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ThreadReadResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ThreadReadResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ThreadReadResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ThreadReadResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ThreadReadResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2ThreadReadResponse__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadReadResponse__SubAgentSource }; -export const V2ThreadReadResponse__SessionSource = Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadReadResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadReadResponse__ThreadExtra = {}; -export const V2ThreadReadResponse__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", -}); +export type V2ThreadReadResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadReadResponse__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); export type V2ThreadReadResponse__ThreadHistoryMode = "legacy" | "paginated"; export const V2ThreadReadResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); -export type V2ThreadReadResponse__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadReadResponse__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadReadResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadReadResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadReadResponse__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2ThreadRealtimeClosedNotification = { readonly reason?: string | null; readonly threadId: string; @@ -41080,11 +43779,11 @@ export const V2ThreadRealtimeErrorNotification = Schema.Struct({ }); export type V2ThreadRealtimeItemAddedNotification = { - readonly item: unknown; + readonly item: Schema.Json; readonly threadId: string; }; export const V2ThreadRealtimeItemAddedNotification = Schema.Struct({ - item: Schema.Unknown, + item: Schema.Json.annotate({ expected: "JSON value" }), threadId: Schema.String, }).annotate({ title: "ThreadRealtimeItemAddedNotification", @@ -41160,7 +43859,7 @@ export type V2ThreadResumeParams = { readonly approvalPolicy?: V2ThreadResumeParams__AskForApproval | null; readonly approvalsReviewer?: V2ThreadResumeParams__ApprovalsReviewer | null; readonly baseInstructions?: string | null; - readonly config?: { readonly [x: string]: unknown } | null; + readonly config?: { readonly [x: string]: Schema.Json } | null; readonly cwd?: string | null; readonly developerInstructions?: string | null; readonly model?: string | null; @@ -41182,7 +43881,10 @@ export const V2ThreadResumeParams = Schema.Struct({ ), baseInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), config: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null]), + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), + Schema.Null, + ]), ), cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -41254,7 +43956,7 @@ export type V2ThreadResumeParams__ResponseItem = readonly type: "function_call"; } | { - readonly arguments: unknown; + readonly arguments: Schema.Json; readonly call_id?: string | null; readonly execution: string; readonly id?: string | null; @@ -41293,7 +43995,7 @@ export type V2ThreadResumeParams__ResponseItem = readonly id?: string | null; readonly internal_chat_message_metadata_passthrough?: V2ThreadResumeParams__InternalChatMessageMetadataPassthrough | null; readonly status: string; - readonly tools: ReadonlyArray; + readonly tools: ReadonlyArray; readonly type: "tool_search_output"; } | { @@ -41395,7 +44097,7 @@ export const V2ThreadResumeParams__ResponseItem = Schema.Union( type: Schema.Literal("function_call").annotate({ title: "FunctionCallResponseItemType" }), }).annotate({ title: "FunctionCallResponseItem" }), Schema.Struct({ - arguments: Schema.Unknown, + arguments: Schema.Json.annotate({ expected: "JSON value" }), call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), execution: Schema.String, id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -41452,7 +44154,7 @@ export const V2ThreadResumeParams__ResponseItem = Schema.Union( Schema.Union([V2ThreadResumeParams__InternalChatMessageMetadataPassthrough, Schema.Null]), ), status: Schema.String, - tools: Schema.Array(Schema.Unknown), + tools: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), type: Schema.Literal("tool_search_output").annotate({ title: "ToolSearchOutputResponseItemType", }), @@ -41524,8 +44226,12 @@ export const V2ThreadResumeParams__ThreadResumeInitialTurnsPageParams = Schema.S limit: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Optional turn page size.", format: "uint32" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), Schema.Null, ]), ), @@ -41538,32 +44244,22 @@ export const V2ThreadResumeParams__ThreadResumeInitialTurnsPageParams = Schema.S export type V2ThreadResumeResponse = { readonly approvalPolicy: V2ThreadResumeResponse__AskForApproval; - readonly approvalsReviewer: "user" | "auto_review" | "guardian_subagent"; + readonly approvalsReviewer: V2ThreadResumeResponse__ApprovalsReviewer; readonly cwd: V2ThreadResumeResponse__AbsolutePathBuf; readonly instructionSources?: ReadonlyArray; readonly model: string; readonly modelProvider: string; readonly reasoningEffort?: V2ThreadResumeResponse__ReasoningEffort | null; - readonly sandbox: - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } - | { - readonly excludeSlashTmp?: boolean; - readonly excludeTmpdirEnvVar?: boolean; - readonly networkAccess?: boolean; - readonly type: "workspaceWrite"; - readonly writableRoots?: ReadonlyArray; - }; + readonly sandbox: V2ThreadResumeResponse__SandboxPolicy; readonly serviceTier?: string | null; readonly thread: V2ThreadResumeResponse__Thread; }; export const V2ThreadResumeResponse = Schema.Struct({ approvalPolicy: V2ThreadResumeResponse__AskForApproval, - approvalsReviewer: Schema.Literals(["user", "auto_review", "guardian_subagent"]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", - }), + approvalsReviewer: Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__ApprovalsReviewer, + ).annotate({ description: "Reviewer currently used for approval requests on this thread." }), cwd: V2ThreadResumeResponse__AbsolutePathBuf, instructionSources: Schema.optionalKey( Schema.Array(V2ThreadResumeResponse__LegacyAppPathString).annotate({ @@ -41577,257 +44273,61 @@ export const V2ThreadResumeResponse = Schema.Struct({ reasoningEffort: Schema.optionalKey( Schema.Union([V2ThreadResumeResponse__ReasoningEffort, Schema.Null]), ), - sandbox: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("dangerFullAccess").annotate({ - title: "DangerFullAccessSandboxPolicyType", - }), - }).annotate({ title: "DangerFullAccessSandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), - }).annotate({ title: "ReadOnlySandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), - ), - type: Schema.Literal("externalSandbox").annotate({ - title: "ExternalSandboxSandboxPolicyType", - }), - }).annotate({ title: "ExternalSandboxSandboxPolicy" }), - Schema.Struct({ - excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("workspaceWrite").annotate({ - title: "WorkspaceWriteSandboxPolicyType", - }), - writableRoots: Schema.optionalKey( - Schema.Array(V2ThreadResumeResponse__AbsolutePathBuf).annotate({ default: [] }), - ), - }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), - ], - { mode: "oneOf" }, + sandbox: Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__SandboxPolicy, ).annotate({ description: "Legacy sandbox policy retained for compatibility. Experimental clients should prefer `activePermissionProfile` for profile provenance.", }), - serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - thread: V2ThreadResumeResponse__Thread, -}).annotate({ title: "ThreadResumeResponse" }); - -export type V2ThreadResumeResponse__ActivePermissionProfile = { - readonly extends?: string | null; - readonly id: string; -}; -export const V2ThreadResumeResponse__ActivePermissionProfile = Schema.Struct({ - extends: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Parent profile identifier from the selected permissions profile's `extends` setting, when present.", - }), - Schema.Null, - ]), - ), - id: Schema.String.annotate({ - description: - "Identifier from `default_permissions` or the implicit built-in default, such as `:workspace` or a user-defined `[permissions.]` profile.", - }), -}); - -export type V2ThreadResumeResponse__ApprovalsReviewer = - | "user" - | "auto_review" - | "guardian_subagent"; -export const V2ThreadResumeResponse__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", -}); - -export type V2ThreadResumeResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ThreadResumeResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ThreadResumeResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ThreadResumeResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ThreadResumeResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ThreadResumeResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ThreadResumeResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ThreadResumeResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2ThreadResumeResponse__MultiAgentMode = - | "explicitRequestOnly" - | "proactive" - | { readonly custom: string }; -export const V2ThreadResumeResponse__MultiAgentMode = Schema.Union( - [ - Schema.Literals(["explicitRequestOnly", "proactive"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomMultiAgentMode" }), - ], - { mode: "oneOf" }, -).annotate({ - description: - "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", -}); - -export type V2ThreadResumeResponse__NetworkAccess = "restricted" | "enabled"; -export const V2ThreadResumeResponse__NetworkAccess = Schema.Literals(["restricted", "enabled"]); - -export type V2ThreadResumeResponse__SandboxPolicy = - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } - | { - readonly excludeSlashTmp?: boolean; - readonly excludeTmpdirEnvVar?: boolean; - readonly networkAccess?: boolean; - readonly type: "workspaceWrite"; - readonly writableRoots?: ReadonlyArray; - }; -export const V2ThreadResumeResponse__SandboxPolicy = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("dangerFullAccess").annotate({ - title: "DangerFullAccessSandboxPolicyType", - }), - }).annotate({ title: "DangerFullAccessSandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), - }).annotate({ title: "ReadOnlySandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), - ), - type: Schema.Literal("externalSandbox").annotate({ - title: "ExternalSandboxSandboxPolicyType", + serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + thread: V2ThreadResumeResponse__Thread, +}).annotate({ title: "ThreadResumeResponse" }); + +export type V2ThreadResumeResponse__ActivePermissionProfile = { + readonly extends?: string | null; + readonly id: string; +}; +export const V2ThreadResumeResponse__ActivePermissionProfile = Schema.Struct({ + extends: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Parent profile identifier from the selected permissions profile's `extends` setting, when present.", }), - }).annotate({ title: "ExternalSandboxSandboxPolicy" }), - Schema.Struct({ - excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), - writableRoots: Schema.optionalKey( - Schema.Array(V2ThreadResumeResponse__AbsolutePathBuf).annotate({ default: [] }), - ), - }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), - ], - { mode: "oneOf" }, -); + Schema.Null, + ]), + ), + id: Schema.String.annotate({ + description: + "Identifier from `default_permissions` or the implicit built-in default, such as `:workspace` or a user-defined `[permissions.]` profile.", + }), +}); -export type V2ThreadResumeResponse__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadResumeResponse__SubAgentSource }; -export const V2ThreadResumeResponse__SessionSource = Schema.Union( +export type V2ThreadResumeResponse__MultiAgentMode = + | "explicitRequestOnly" + | "proactive" + | { readonly custom: string }; +export const V2ThreadResumeResponse__MultiAgentMode = Schema.Union( [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadResumeResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), + Schema.Literals(["explicitRequestOnly", "proactive"]), + Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomMultiAgentMode" }), ], { mode: "oneOf" }, -); - -export type V2ThreadResumeResponse__ThreadExtra = {}; -export const V2ThreadResumeResponse__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", +).annotate({ + description: + "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); +export type V2ThreadResumeResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadResumeResponse__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); + export type V2ThreadResumeResponse__ThreadHistoryMode = "legacy" | "paginated"; export const V2ThreadResumeResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); -export type V2ThreadResumeResponse__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadResumeResponse__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadResumeResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadResumeResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadResumeResponse__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2ThreadResumeResponse__TurnsPage = { readonly backwardsCursor?: string | null; readonly data: ReadonlyArray; @@ -41846,486 +44346,46 @@ export const V2ThreadRollbackParams = Schema.Struct({ "The number of turns to drop from the end of the thread. Must be >= 1.\n\nThis only modifies the thread's history and does not revert local file changes that have been made by the agent. Clients are responsible for reverting these changes.", format: "uint32", }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), threadId: Schema.String, }).annotate({ title: "ThreadRollbackParams", description: "DEPRECATED: `thread/rollback` will be removed soon.", }); -export type V2ThreadRollbackResponse = { - readonly thread: { - readonly agentNickname?: string | null; - readonly agentRole?: string | null; - readonly cliVersion: string; - readonly createdAt: number; - readonly cwd: string; - readonly ephemeral: boolean; - readonly forkedFromId?: string | null; - readonly gitInfo?: V2ThreadRollbackResponse__GitInfo | null; - readonly id: string; - readonly modelProvider: string; - readonly name?: string | null; - readonly parentThreadId?: string | null; - readonly path?: string | null; - readonly preview: string; - readonly recencyAt?: number | null; - readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadRollbackResponse__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; - readonly threadSource?: V2ThreadRollbackResponse__ThreadSource | null; - readonly turns: ReadonlyArray; - readonly updatedAt: number; - }; -}; +export type V2ThreadRollbackResponse = { readonly thread: V2ThreadRollbackResponse__Thread }; export const V2ThreadRollbackResponse = Schema.Struct({ - thread: Schema.Struct({ - agentNickname: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Optional random unique nickname assigned to an AgentControl-spawned sub-agent.", - }), - Schema.Null, - ]), - ), - agentRole: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.", - }), - Schema.Null, - ]), - ), - cliVersion: Schema.String.annotate({ - description: "Version of the CLI that created the thread.", - }), - createdAt: Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the thread was created.", - format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), - ephemeral: Schema.Boolean.annotate({ - description: "Whether the thread is ephemeral and should not be materialized on disk.", - }), - forkedFromId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Source thread id when this thread was created by forking another thread.", - }), - Schema.Null, - ]), - ), - gitInfo: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__GitInfo, Schema.Null]).annotate({ - description: "Optional Git metadata captured when the thread was created.", - }), - ), - id: Schema.String.annotate({ - description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", - }), - modelProvider: Schema.String.annotate({ - description: "Model provider used for this thread (for example, 'openai').", - }), - name: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "Optional user-facing thread title." }), - Schema.Null, - ]), - ), - parentThreadId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "The ID of the parent thread. This will only be set if this thread is a subagent.", - }), - Schema.Null, - ]), - ), - path: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "[UNSTABLE] Path to the thread on disk." }), - Schema.Null, - ]), - ), - preview: Schema.String.annotate({ - description: "Usually the first user message in the thread, if available.", - }), - recencyAt: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Unix timestamp (in seconds) used for thread recency ordering.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - sessionId: Schema.String.annotate({ - description: "Session id shared by threads that belong to the same session tree.", - }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadRollbackResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, - ).annotate({ - description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", - }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadRollbackResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, - ).annotate({ description: "Current runtime status for the thread." }), - threadSource: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__ThreadSource, Schema.Null]).annotate({ - description: "Optional analytics source classification for this thread.", - }), - ), - turns: Schema.Array(V2ThreadRollbackResponse__Turn).annotate({ - description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", - }), - updatedAt: Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the thread was last updated.", - format: "int64", - }).check(Schema.isInt()), - }).annotate({ + thread: Schema.suspend( + (): Schema.Codec => V2ThreadRollbackResponse__Thread, + ).annotate({ description: "The updated thread after applying the rollback, with `turns` populated.\n\nThe ThreadItems stored in each Turn are lossy since we explicitly do not persist all agent interactions, such as command executions. This is the same behavior as `thread/resume`.", }), }).annotate({ title: "ThreadRollbackResponse" }); -export type V2ThreadRollbackResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ThreadRollbackResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ThreadRollbackResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ThreadRollbackResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ThreadRollbackResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ThreadRollbackResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ThreadRollbackResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ThreadRollbackResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2ThreadRollbackResponse__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadRollbackResponse__SubAgentSource }; -export const V2ThreadRollbackResponse__SessionSource = Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadRollbackResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadRollbackResponse__Thread = { - readonly agentNickname?: string | null; - readonly agentRole?: string | null; - readonly cliVersion: string; - readonly createdAt: number; - readonly cwd: string; - readonly ephemeral: boolean; - readonly forkedFromId?: string | null; - readonly gitInfo?: V2ThreadRollbackResponse__GitInfo | null; - readonly id: string; - readonly modelProvider: string; - readonly name?: string | null; - readonly parentThreadId?: string | null; - readonly path?: string | null; - readonly preview: string; - readonly recencyAt?: number | null; - readonly sessionId: string; - readonly source: - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadRollbackResponse__SubAgentSource }; - readonly status: - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; - readonly threadSource?: V2ThreadRollbackResponse__ThreadSource | null; - readonly turns: ReadonlyArray; - readonly updatedAt: number; -}; -export const V2ThreadRollbackResponse__Thread = Schema.Struct({ - agentNickname: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Optional random unique nickname assigned to an AgentControl-spawned sub-agent.", - }), - Schema.Null, - ]), - ), - agentRole: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.", - }), - Schema.Null, - ]), - ), - cliVersion: Schema.String.annotate({ - description: "Version of the CLI that created the thread.", - }), - createdAt: Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the thread was created.", - format: "int64", - }).check(Schema.isInt()), - cwd: Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - }), - ephemeral: Schema.Boolean.annotate({ - description: "Whether the thread is ephemeral and should not be materialized on disk.", - }), - forkedFromId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Source thread id when this thread was created by forking another thread.", - }), - Schema.Null, - ]), - ), - gitInfo: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__GitInfo, Schema.Null]).annotate({ - description: "Optional Git metadata captured when the thread was created.", - }), - ), - id: Schema.String.annotate({ - description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", - }), - modelProvider: Schema.String.annotate({ - description: "Model provider used for this thread (for example, 'openai').", - }), - name: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "Optional user-facing thread title." }), - Schema.Null, - ]), - ), - parentThreadId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "The ID of the parent thread. This will only be set if this thread is a subagent.", - }), - Schema.Null, - ]), - ), - path: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "[UNSTABLE] Path to the thread on disk." }), - Schema.Null, - ]), - ), - preview: Schema.String.annotate({ - description: "Usually the first user message in the thread, if available.", - }), - recencyAt: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - description: "Unix timestamp (in seconds) used for thread recency ordering.", - format: "int64", - }).check(Schema.isInt()), - Schema.Null, - ]), - ), - sessionId: Schema.String.annotate({ - description: "Session id shared by threads that belong to the same session tree.", - }), - source: Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadRollbackResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, - ).annotate({ - description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", - }), - status: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadRollbackResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, - ).annotate({ description: "Current runtime status for the thread." }), - threadSource: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__ThreadSource, Schema.Null]).annotate({ - description: "Optional analytics source classification for this thread.", - }), - ), - turns: Schema.Array(V2ThreadRollbackResponse__Turn).annotate({ - description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", - }), - updatedAt: Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the thread was last updated.", - format: "int64", - }).check(Schema.isInt()), -}); - -export type V2ThreadRollbackResponse__ThreadExtra = {}; -export const V2ThreadRollbackResponse__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", -}); +export type V2ThreadRollbackResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadRollbackResponse__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); export type V2ThreadRollbackResponse__ThreadHistoryMode = "legacy" | "paginated"; export const V2ThreadRollbackResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); -export type V2ThreadRollbackResponse__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadRollbackResponse__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadRollbackResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadRollbackResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadRollbackResponse__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2ThreadSetNameParams = { readonly name: string; readonly threadId: string }; export const V2ThreadSetNameParams = Schema.Struct({ name: Schema.String, threadId: Schema.String, }).annotate({ title: "ThreadSetNameParams" }); -export type V2ThreadSetNameResponse = {}; -export const V2ThreadSetNameResponse = Schema.Struct({}).annotate({ - title: "ThreadSetNameResponse", -}); +export type V2ThreadSetNameResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadSetNameResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "ThreadSetNameResponse" }); export type V2ThreadSettingsUpdatedNotification = { readonly threadId: string; @@ -42351,12 +44411,6 @@ export const V2ThreadSettingsUpdatedNotification__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); -export type V2ThreadSettingsUpdatedNotification__NetworkAccess = "restricted" | "enabled"; -export const V2ThreadSettingsUpdatedNotification__NetworkAccess = Schema.Literals([ - "restricted", - "enabled", -]); - export type V2ThreadShellCommandParams = { readonly command: string; readonly threadId: string }; export const V2ThreadShellCommandParams = Schema.Struct({ command: Schema.String.annotate({ @@ -42366,144 +44420,34 @@ export const V2ThreadShellCommandParams = Schema.Struct({ threadId: Schema.String, }).annotate({ title: "ThreadShellCommandParams" }); -export type V2ThreadShellCommandResponse = {}; -export const V2ThreadShellCommandResponse = Schema.Struct({}).annotate({ - title: "ThreadShellCommandResponse", -}); +export type V2ThreadShellCommandResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadShellCommandResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "ThreadShellCommandResponse" }); export type V2ThreadStartedNotification = { readonly thread: V2ThreadStartedNotification__Thread }; -export const V2ThreadStartedNotification = Schema.Struct({ - thread: V2ThreadStartedNotification__Thread, -}).annotate({ title: "ThreadStartedNotification" }); - -export type V2ThreadStartedNotification__ByteRange = { - readonly end: number; - readonly start: number; -}; -export const V2ThreadStartedNotification__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ThreadStartedNotification__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ThreadStartedNotification__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ThreadStartedNotification__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ThreadStartedNotification__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ThreadStartedNotification__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ThreadStartedNotification__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2ThreadStartedNotification__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadStartedNotification__SubAgentSource }; -export const V2ThreadStartedNotification__SessionSource = Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadStartedNotification__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadStartedNotification__ThreadExtra = {}; -export const V2ThreadStartedNotification__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", -}); - -export type V2ThreadStartedNotification__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadStartedNotification__ThreadHistoryMode = Schema.Literals([ - "legacy", - "paginated", -]); - -export type V2ThreadStartedNotification__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadStartedNotification__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadStartedNotification__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); +export const V2ThreadStartedNotification = Schema.Struct({ + thread: V2ThreadStartedNotification__Thread, +}).annotate({ title: "ThreadStartedNotification" }); -export type V2ThreadStartedNotification__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadStartedNotification__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", +export type V2ThreadStartedNotification__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadStartedNotification__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); + +export type V2ThreadStartedNotification__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadStartedNotification__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", ]); export type V2ThreadStartParams = { readonly approvalPolicy?: V2ThreadStartParams__AskForApproval | null; readonly approvalsReviewer?: V2ThreadStartParams__ApprovalsReviewer | null; readonly baseInstructions?: string | null; - readonly config?: { readonly [x: string]: unknown } | null; + readonly config?: { readonly [x: string]: Schema.Json } | null; readonly cwd?: string | null; readonly developerInstructions?: string | null; readonly ephemeral?: boolean | null; @@ -42528,7 +44472,10 @@ export const V2ThreadStartParams = Schema.Struct({ ), baseInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), config: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null]), + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), + Schema.Null, + ]), ), cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -42555,34 +44502,11 @@ export const V2ThreadStartParams__AbsolutePathBuf = Schema.String.annotate({ "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", }); -export type V2ThreadStartParams__CapabilityRootLocation = { - readonly environmentId: string; - readonly path: string; - readonly type: "environment"; -}; -export const V2ThreadStartParams__CapabilityRootLocation = Schema.Union( - [ - Schema.Struct({ - environmentId: Schema.String, - path: Schema.String.annotate({ - description: "Absolute path for the root in the selected environment.", - }), - type: Schema.Literal("environment").annotate({ - title: "EnvironmentCapabilityRootLocationType", - }), - }).annotate({ - title: "EnvironmentCapabilityRootLocation", - description: "A path owned by an execution environment.", - }), - ], - { mode: "oneOf" }, -).annotate({ description: "Location used to resolve a selected capability root." }); - export type V2ThreadStartParams__DynamicToolSpec = | { readonly deferLoading?: boolean; readonly description: string; - readonly inputSchema: unknown; + readonly inputSchema: Schema.Json; readonly name: string; readonly type: "function"; } @@ -42597,7 +44521,7 @@ export const V2ThreadStartParams__DynamicToolSpec = Schema.Union( Schema.Struct({ deferLoading: Schema.optionalKey(Schema.Boolean), description: Schema.String, - inputSchema: Schema.Unknown, + inputSchema: Schema.Json.annotate({ expected: "JSON value" }), name: Schema.String, type: Schema.Literal("function").annotate({ title: "FunctionDynamicToolSpecType" }), }).annotate({ title: "FunctionDynamicToolSpec" }), @@ -42628,33 +44552,16 @@ export const V2ThreadStartParams__MultiAgentMode = Schema.Union( export type V2ThreadStartParams__SelectedCapabilityRoot = { readonly id: string; - readonly location: { - readonly environmentId: string; - readonly path: string; - readonly type: "environment"; - }; + readonly location: V2ThreadStartParams__CapabilityRootLocation; }; export const V2ThreadStartParams__SelectedCapabilityRoot = Schema.Struct({ id: Schema.String.annotate({ description: "Stable identifier supplied by the capability selection platform.", }), - location: Schema.Union( - [ - Schema.Struct({ - environmentId: Schema.String, - path: Schema.String.annotate({ - description: "Absolute path for the root in the selected environment.", - }), - type: Schema.Literal("environment").annotate({ - title: "EnvironmentCapabilityRootLocationType", - }), - }).annotate({ - title: "EnvironmentCapabilityRootLocation", - description: "A path owned by an execution environment.", - }), - ], - { mode: "oneOf" }, - ).annotate({ description: "Location used to resolve a selected capability root." }), + location: Schema.suspend( + (): Schema.Codec => + V2ThreadStartParams__CapabilityRootLocation, + ).annotate({ description: "Where the selected root can be resolved." }), }).annotate({ description: "A user-selected root that can expose one or more runtime capabilities.", }); @@ -42682,32 +44589,22 @@ export const V2ThreadStartParams__TurnEnvironmentParams = Schema.Struct({ export type V2ThreadStartResponse = { readonly approvalPolicy: V2ThreadStartResponse__AskForApproval; - readonly approvalsReviewer: "user" | "auto_review" | "guardian_subagent"; + readonly approvalsReviewer: V2ThreadStartResponse__ApprovalsReviewer; readonly cwd: V2ThreadStartResponse__AbsolutePathBuf; readonly instructionSources?: ReadonlyArray; readonly model: string; readonly modelProvider: string; readonly reasoningEffort?: V2ThreadStartResponse__ReasoningEffort | null; - readonly sandbox: - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } - | { - readonly excludeSlashTmp?: boolean; - readonly excludeTmpdirEnvVar?: boolean; - readonly networkAccess?: boolean; - readonly type: "workspaceWrite"; - readonly writableRoots?: ReadonlyArray; - }; + readonly sandbox: V2ThreadStartResponse__SandboxPolicy; readonly serviceTier?: string | null; readonly thread: V2ThreadStartResponse__Thread; }; export const V2ThreadStartResponse = Schema.Struct({ approvalPolicy: V2ThreadStartResponse__AskForApproval, - approvalsReviewer: Schema.Literals(["user", "auto_review", "guardian_subagent"]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", - }), + approvalsReviewer: Schema.suspend( + (): Schema.Codec => + V2ThreadStartResponse__ApprovalsReviewer, + ).annotate({ description: "Reviewer currently used for approval requests on this thread." }), cwd: V2ThreadStartResponse__AbsolutePathBuf, instructionSources: Schema.optionalKey( Schema.Array(V2ThreadStartResponse__LegacyAppPathString).annotate({ @@ -42721,38 +44618,8 @@ export const V2ThreadStartResponse = Schema.Struct({ reasoningEffort: Schema.optionalKey( Schema.Union([V2ThreadStartResponse__ReasoningEffort, Schema.Null]), ), - sandbox: Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("dangerFullAccess").annotate({ - title: "DangerFullAccessSandboxPolicyType", - }), - }).annotate({ title: "DangerFullAccessSandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), - }).annotate({ title: "ReadOnlySandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), - ), - type: Schema.Literal("externalSandbox").annotate({ - title: "ExternalSandboxSandboxPolicyType", - }), - }).annotate({ title: "ExternalSandboxSandboxPolicy" }), - Schema.Struct({ - excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("workspaceWrite").annotate({ - title: "WorkspaceWriteSandboxPolicyType", - }), - writableRoots: Schema.optionalKey( - Schema.Array(V2ThreadStartResponse__AbsolutePathBuf).annotate({ default: [] }), - ), - }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), - ], - { mode: "oneOf" }, + sandbox: Schema.suspend( + (): Schema.Codec => V2ThreadStartResponse__SandboxPolicy, ).annotate({ description: "Legacy sandbox policy retained for compatibility. Experimental clients should prefer `activePermissionProfile` for profile provenance.", @@ -42781,72 +44648,6 @@ export const V2ThreadStartResponse__ActivePermissionProfile = Schema.Struct({ }), }); -export type V2ThreadStartResponse__ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent"; -export const V2ThreadStartResponse__ApprovalsReviewer = Schema.Literals([ - "user", - "auto_review", - "guardian_subagent", -]).annotate({ - description: - "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", -}); - -export type V2ThreadStartResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ThreadStartResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ThreadStartResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ThreadStartResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ThreadStartResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ThreadStartResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ThreadStartResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ThreadStartResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - export type V2ThreadStartResponse__MultiAgentMode = | "explicitRequestOnly" | "proactive" @@ -42862,113 +44663,15 @@ export const V2ThreadStartResponse__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); -export type V2ThreadStartResponse__NetworkAccess = "restricted" | "enabled"; -export const V2ThreadStartResponse__NetworkAccess = Schema.Literals(["restricted", "enabled"]); - -export type V2ThreadStartResponse__SandboxPolicy = - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: "restricted" | "enabled"; readonly type: "externalSandbox" } - | { - readonly excludeSlashTmp?: boolean; - readonly excludeTmpdirEnvVar?: boolean; - readonly networkAccess?: boolean; - readonly type: "workspaceWrite"; - readonly writableRoots?: ReadonlyArray; - }; -export const V2ThreadStartResponse__SandboxPolicy = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("dangerFullAccess").annotate({ - title: "DangerFullAccessSandboxPolicyType", - }), - }).annotate({ title: "DangerFullAccessSandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("readOnly").annotate({ title: "ReadOnlySandboxPolicyType" }), - }).annotate({ title: "ReadOnlySandboxPolicy" }), - Schema.Struct({ - networkAccess: Schema.optionalKey( - Schema.Literals(["restricted", "enabled"]).annotate({ default: "restricted" }), - ), - type: Schema.Literal("externalSandbox").annotate({ - title: "ExternalSandboxSandboxPolicyType", - }), - }).annotate({ title: "ExternalSandboxSandboxPolicy" }), - Schema.Struct({ - excludeSlashTmp: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - excludeTmpdirEnvVar: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - networkAccess: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), - type: Schema.Literal("workspaceWrite").annotate({ title: "WorkspaceWriteSandboxPolicyType" }), - writableRoots: Schema.optionalKey( - Schema.Array(V2ThreadStartResponse__AbsolutePathBuf).annotate({ default: [] }), - ), - }).annotate({ title: "WorkspaceWriteSandboxPolicy" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadStartResponse__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadStartResponse__SubAgentSource }; -export const V2ThreadStartResponse__SessionSource = Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadStartResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadStartResponse__ThreadExtra = {}; -export const V2ThreadStartResponse__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", -}); +export type V2ThreadStartResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadStartResponse__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); export type V2ThreadStartResponse__ThreadHistoryMode = "legacy" | "paginated"; export const V2ThreadStartResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); -export type V2ThreadStartResponse__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadStartResponse__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadStartResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadStartResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadStartResponse__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2ThreadStatusChangedNotification = { readonly status: V2ThreadStatusChangedNotification__ThreadStatus; readonly threadId: string; @@ -43004,85 +44707,11 @@ export const V2ThreadUnarchiveResponse = Schema.Struct({ thread: V2ThreadUnarchiveResponse__Thread, }).annotate({ title: "ThreadUnarchiveResponse" }); -export type V2ThreadUnarchiveResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ThreadUnarchiveResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2ThreadUnarchiveResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2ThreadUnarchiveResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2ThreadUnarchiveResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2ThreadUnarchiveResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2ThreadUnarchiveResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2ThreadUnarchiveResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2ThreadUnarchiveResponse__SessionSource = - | "cli" - | "vscode" - | "exec" - | "appServer" - | "unknown" - | { readonly custom: string } - | { readonly subAgent: V2ThreadUnarchiveResponse__SubAgentSource }; -export const V2ThreadUnarchiveResponse__SessionSource = Schema.Union( - [ - Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), - Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadUnarchiveResponse__SubAgentSource }).annotate({ - title: "SubAgentSessionSource", - }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadUnarchiveResponse__ThreadExtra = {}; -export const V2ThreadUnarchiveResponse__ThreadExtra = Schema.Struct({}).annotate({ - description: "Extra app-server data for a thread.", -}); +export type V2ThreadUnarchiveResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadUnarchiveResponse__ThreadExtra = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ description: "Extra app-server data for a thread." }); export type V2ThreadUnarchiveResponse__ThreadHistoryMode = "legacy" | "paginated"; export const V2ThreadUnarchiveResponse__ThreadHistoryMode = Schema.Literals([ @@ -43090,40 +44719,6 @@ export const V2ThreadUnarchiveResponse__ThreadHistoryMode = Schema.Literals([ "paginated", ]); -export type V2ThreadUnarchiveResponse__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadUnarchiveResponse__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadUnarchiveResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -); - -export type V2ThreadUnarchiveResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadUnarchiveResponse__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2ThreadUnsubscribeParams = { readonly threadId: string }; export const V2ThreadUnsubscribeParams = Schema.Struct({ threadId: Schema.String }).annotate({ title: "ThreadUnsubscribeParams", @@ -43145,72 +44740,6 @@ export const V2TurnCompletedNotification = Schema.Struct({ turn: V2TurnCompletedNotification__Turn, }).annotate({ title: "TurnCompletedNotification" }); -export type V2TurnCompletedNotification__ByteRange = { - readonly end: number; - readonly start: number; -}; -export const V2TurnCompletedNotification__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2TurnCompletedNotification__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2TurnCompletedNotification__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2TurnCompletedNotification__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2TurnCompletedNotification__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2TurnCompletedNotification__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2TurnCompletedNotification__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2TurnCompletedNotification__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2TurnCompletedNotification__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2TurnDiffUpdatedNotification = { readonly diff: string; readonly threadId: string; @@ -43232,18 +44761,19 @@ export const V2TurnInterruptParams = Schema.Struct({ turnId: Schema.String, }).annotate({ title: "TurnInterruptParams" }); -export type V2TurnInterruptResponse = {}; -export const V2TurnInterruptResponse = Schema.Struct({}).annotate({ - title: "TurnInterruptResponse", -}); +export type V2TurnInterruptResponse = { readonly [x: string]: Schema.Json }; +export const V2TurnInterruptResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "TurnInterruptResponse" }); export type V2TurnModerationMetadataNotification = { - readonly metadata: unknown; + readonly metadata: Schema.Json; readonly threadId: string; readonly turnId: string; }; export const V2TurnModerationMetadataNotification = Schema.Struct({ - metadata: Schema.Unknown, + metadata: Schema.Json.annotate({ expected: "JSON value" }), threadId: Schema.String, turnId: Schema.String, }).annotate({ title: "TurnModerationMetadataNotification" }); @@ -43270,69 +44800,6 @@ export const V2TurnStartedNotification = Schema.Struct({ turn: V2TurnStartedNotification__Turn, }).annotate({ title: "TurnStartedNotification" }); -export type V2TurnStartedNotification__ByteRange = { readonly end: number; readonly start: number }; -export const V2TurnStartedNotification__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2TurnStartedNotification__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2TurnStartedNotification__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2TurnStartedNotification__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2TurnStartedNotification__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2TurnStartedNotification__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2TurnStartedNotification__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2TurnStartedNotification__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2TurnStartedNotification__TurnItemsView = Schema.Literals([ - "notLoaded", - "summary", - "full", -]); - export type V2TurnStartParams = { readonly approvalPolicy?: V2TurnStartParams__AskForApproval | null; readonly approvalsReviewer?: V2TurnStartParams__ApprovalsReviewer | null; @@ -43341,7 +44808,7 @@ export type V2TurnStartParams = { readonly effort?: V2TurnStartParams__ReasoningEffort | null; readonly input: ReadonlyArray; readonly model?: string | null; - readonly outputSchema?: unknown; + readonly outputSchema?: Schema.Json; readonly personality?: V2TurnStartParams__Personality | null; readonly sandboxPolicy?: V2TurnStartParams__SandboxPolicy | null; readonly serviceTier?: string | null; @@ -43384,7 +44851,8 @@ export const V2TurnStartParams = Schema.Struct({ ]), ), outputSchema: Schema.optionalKey( - Schema.Unknown.annotate({ + Schema.Json.annotate({ + expected: "JSON value", description: "Optional JSON Schema used to constrain the final assistant message for this turn.", }), @@ -43424,16 +44892,6 @@ export const V2TurnStartParams__AdditionalContextEntry = Schema.Struct({ value: Schema.String, }); -export type V2TurnStartParams__ByteRange = { readonly end: number; readonly start: number }; -export const V2TurnStartParams__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - export type V2TurnStartParams__CollaborationMode = { readonly mode: V2TurnStartParams__ModeKind; readonly settings: V2TurnStartParams__Settings; @@ -43458,9 +44916,6 @@ export const V2TurnStartParams__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); -export type V2TurnStartParams__NetworkAccess = "restricted" | "enabled"; -export const V2TurnStartParams__NetworkAccess = Schema.Literals(["restricted", "enabled"]); - export type V2TurnStartParams__TurnEnvironmentParams = { readonly cwd: V2TurnStartParams__LegacyAppPathString; readonly environmentId: string; @@ -43484,65 +44939,6 @@ export const V2TurnStartResponse = Schema.Struct({ turn: V2TurnStartResponse__Tu title: "TurnStartResponse", }); -export type V2TurnStartResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2TurnStartResponse__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - -export type V2TurnStartResponse__CollabAgentTool = - | "spawnAgent" - | "sendInput" - | "resumeAgent" - | "wait" - | "closeAgent" - | "sendMessage" - | "followupTask" - | "interruptAgent" - | "listAgents"; -export const V2TurnStartResponse__CollabAgentTool = Schema.Literals([ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", -]); - -export type V2TurnStartResponse__CollabAgentToolCallStatus = - | "inProgress" - | "completed" - | "failed" - | "interrupted"; -export const V2TurnStartResponse__CollabAgentToolCallStatus = Schema.Literals([ - "inProgress", - "completed", - "failed", - "interrupted", -]); - -export type V2TurnStartResponse__CommandExecutionSource = - | "agent" - | "userShell" - | "unifiedExecStartup" - | "unifiedExecInteraction"; -export const V2TurnStartResponse__CommandExecutionSource = Schema.Literals([ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction", -]); - -export type V2TurnStartResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2TurnStartResponse__TurnItemsView = Schema.Literals(["notLoaded", "summary", "full"]); - export type V2TurnSteerParams = { readonly clientUserMessageId?: string | null; readonly expectedTurnId: string; @@ -43568,16 +44964,6 @@ export const V2TurnSteerParams__AdditionalContextEntry = Schema.Struct({ value: Schema.String, }); -export type V2TurnSteerParams__ByteRange = { readonly end: number; readonly start: number }; -export const V2TurnSteerParams__ByteRange = Schema.Struct({ - end: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), - start: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), -}); - export type V2TurnSteerResponse = { readonly turnId: string }; export const V2TurnSteerResponse = Schema.Struct({ turnId: Schema.String }).annotate({ title: "TurnSteerResponse", @@ -43637,8 +45023,10 @@ export type V2WindowsWorldWritableWarningNotification = { }; export const V2WindowsWorldWritableWarningNotification = Schema.Struct({ extraCount: Schema.Number.annotate({ format: "uint" }) - .check(Schema.isInt()) - .check(Schema.isGreaterThanOrEqualTo(0)), + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), failedScan: Schema.Boolean, samplePaths: Schema.Array(Schema.String), }).annotate({ title: "WindowsWorldWritableWarningNotification" }); From d5d48742c9ab00dff82fe8bcbc8da0ba68748959 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 24 Sep 2026 14:10:04 -0700 Subject: [PATCH 05/58] feat(codex): require Codex 0.156 and regenerate its protocol (#13481) Co-authored-by: Claude Opus 5.5 (1M context) --- .../src/provider/Layers/CodexAdapter.test.ts | 1 + .../src/provider/Layers/CodexProvider.ts | 2 +- .../Layers/CodexSessionRuntime.test.ts | 30 +- .../provider/Layers/CodexSessionRuntime.ts | 12 +- apps/server/src/provider/model-manifest.json | 9 +- .../provider/providerCompatibility.test.ts | 18 + .../testFixtures/codexMultiAgentWire.json | 2 + .../scripts/generate.ts | 175 +- .../src/_generated/meta.gen.ts | 119 +- .../src/_generated/namespaces.gen.ts | 46 +- .../src/_generated/schema.gen.ts | 17450 +++++++++++++--- .../src/client.test.ts | 1 + .../src/schema.test.ts | 6 +- .../fixtures/codex-app-server-mock-peer.ts | 1 + 14 files changed, 14830 insertions(+), 3042 deletions(-) diff --git a/apps/server/src/provider/Layers/CodexAdapter.test.ts b/apps/server/src/provider/Layers/CodexAdapter.test.ts index 9f464bdaa177..fc2e365f6e9c 100644 --- a/apps/server/src/provider/Layers/CodexAdapter.test.ts +++ b/apps/server/src/provider/Layers/CodexAdapter.test.ts @@ -2383,6 +2383,7 @@ lifecycleLayer("CodexAdapterLive lifecycle", (it) => { method: "item/tool/requestUserInput", requestId: ApprovalRequestId.make("req-user-input-1"), payload: { + isBlocking: true, itemId: "item-user-input-1", threadId: "thread-1", turnId: "turn-1", diff --git a/apps/server/src/provider/Layers/CodexProvider.ts b/apps/server/src/provider/Layers/CodexProvider.ts index cdf40f73b1bd..d99b97150c5c 100644 --- a/apps/server/src/provider/Layers/CodexProvider.ts +++ b/apps/server/src/provider/Layers/CodexProvider.ts @@ -441,7 +441,7 @@ const probeCodexAppServerProvider = Effect.fn("probeCodexAppServerProvider")(fun requestAllCodexModels(client), // Usage is an enrichment: a failure or a slow answer degrades to "no // usage this probe" rather than costing the account and models. - client.request("account/rateLimits/read", undefined).pipe( + client.request("account/rateLimits/read", null).pipe( Effect.map((response): CodexRateLimitsProbe => ({ snapshot: response.rateLimits, rateLimitsByLimitId: response.rateLimitsByLimitId, diff --git a/apps/server/src/provider/Layers/CodexSessionRuntime.test.ts b/apps/server/src/provider/Layers/CodexSessionRuntime.test.ts index ec113ab7c521..588c24dd1176 100644 --- a/apps/server/src/provider/Layers/CodexSessionRuntime.test.ts +++ b/apps/server/src/provider/Layers/CodexSessionRuntime.test.ts @@ -90,25 +90,28 @@ describe("Codex thread history", () => { ); } - it.effect("keeps the count-based rollback API for older threads", () => + it.effect("surfaces Codex rejecting a revert of a legacy thread", () => Effect.gen(function* () { + const rejection = CodexErrors.CodexAppServerRequestError.invalidRequest( + "thread/revert only supports paginated threads", + ); const client: Parameters[0] = { - raw: { request: () => Effect.succeed({ thread: {} }) }, - request: ( - method: M, - params: CodexRpc.ClientRequestParamsByMethod[M], - ) => { - NodeAssert.equal(method, "thread/rollback"); - NodeAssert.deepEqual(params, { threadId: "legacy-thread", numTurns: 2 }); + raw: { + request: (method) => { + if (method === "thread/read") return Effect.succeed({ thread: {} }); + if (method === "thread/revert") return Effect.fail(rejection); + return Effect.die(`Unexpected raw request: ${method}`); + }, + }, + request: (method: M) => { + NodeAssert.equal(method, "thread/read"); return Effect.succeed({ - thread: { id: "legacy-thread", turns: [] }, + thread: { id: "legacy-thread", turns: [{ id: "turn-1", items: [] }] }, } as unknown as CodexRpc.ClientRequestResponsesByMethod[M]); }, }; - NodeAssert.deepEqual(yield* rollbackCodexThread(client, "legacy-thread", 2), { - threadId: "legacy-thread", - turns: [], - }); + const error = yield* Effect.flip(rollbackCodexThread(client, "legacy-thread", 1)); + NodeAssert.strictEqual(error, rejection); }), ); }); @@ -680,6 +683,7 @@ function makeThreadStartedNotification( id: threadId, modelProvider: "openai", preview: "", + projectId: null, sessionId: threadId, source, status: { type: "idle" as const }, diff --git a/apps/server/src/provider/Layers/CodexSessionRuntime.ts b/apps/server/src/provider/Layers/CodexSessionRuntime.ts index 7f0f9765730e..ba78589bfdb1 100644 --- a/apps/server/src/provider/Layers/CodexSessionRuntime.ts +++ b/apps/server/src/provider/Layers/CodexSessionRuntime.ts @@ -163,8 +163,7 @@ export type CodexTurnStartParamsWithCollaborationMode = export type CodexResumeCursor = typeof CodexResumeCursorSchema.Type; type CodexServiceTier = NonNullable; type CodexThreadItem = - | EffectCodexSchema.V2ThreadReadResponse["thread"]["turns"][number]["items"][number] - | EffectCodexSchema.V2ThreadRollbackResponse["thread"]["turns"][number]["items"][number]; + EffectCodexSchema.V2ThreadReadResponse["thread"]["turns"][number]["items"][number]; export interface CodexSessionRuntimeOptions { readonly threadId: ThreadId; @@ -1185,7 +1184,7 @@ function updateSession( } function parseThreadSnapshot( - response: EffectCodexSchema.V2ThreadReadResponse | EffectCodexSchema.V2ThreadRollbackResponse, + response: EffectCodexSchema.V2ThreadReadResponse, ): CodexThreadSnapshot { return { threadId: response.thread.id, @@ -1273,11 +1272,8 @@ export const rollbackCodexThread = Effect.fn("rollbackCodexThread")(function* ( threadId: string, numTurns: number, ): Effect.fn.Return { - if ((yield* readCodexHistoryMode(client, threadId)) !== "paginated") { - return parseThreadSnapshot(yield* client.request("thread/rollback", { threadId, numTurns })); - } - // Paginated threads replace history at a turn boundary instead of supporting - // the legacy count-based rollback endpoint. + // Codex replaces history at a turn boundary. It rejects threads that still + // use legacy history, which have no rollback API since Codex 0.156. const snapshot = yield* readCodexThread(client, threadId); const retainedCount = Math.max(0, snapshot.turns.length - numTurns); const firstRemoved = snapshot.turns[retainedCount]; diff --git a/apps/server/src/provider/model-manifest.json b/apps/server/src/provider/model-manifest.json index 69e51bcb019a..b7531c21c981 100644 --- a/apps/server/src/provider/model-manifest.json +++ b/apps/server/src/provider/model-manifest.json @@ -1,14 +1,15 @@ { "version": 1, - "updatedAt": "2026-09-24T00:11:29Z", + "updatedAt": "2026-09-24T18:40:00Z", "compatibility": [ { "driver": "codex", "t3CodeRange": ">=0.0.42", - "recommendedRange": ">=0.129.0", + "recommendedRange": ">=0.156.0", "ranges": [ - { "range": ">=0.129.0", "status": "supported" }, - { "range": "<0.129.0", "status": "broken" } + { "range": ">=0.156.0", "status": "supported" }, + { "range": ">=0.149.0 <0.156.0", "status": "unsupported" }, + { "range": "<0.149.0", "status": "broken" } ] }, { diff --git a/apps/server/src/provider/providerCompatibility.test.ts b/apps/server/src/provider/providerCompatibility.test.ts index 3a43356d2caf..4d438a77b54e 100644 --- a/apps/server/src/provider/providerCompatibility.test.ts +++ b/apps/server/src/provider/providerCompatibility.test.ts @@ -65,6 +65,24 @@ describe("provider compatibility", () => { } }); + it("supports Codex 0.156 and marks Codex without Thread.projectId broken", () => { + const bundled = ModelManifest.BUNDLED_MODEL_MANIFEST.compatibility; + for (const [t3CodeVersion, codexVersion, expected] of [ + ["0.0.42", "0.148.0", "broken"], + ["0.0.42", "0.149.0", "unsupported"], + ["0.0.42", "0.155.0", "unsupported"], + ["0.0.42", "0.156.0", "supported"], + ["0.0.43-nightly.20260924.2200", "0.153.3", "unsupported"], + ["0.0.43-nightly.20260924.2200", "0.156.1", "supported"], + ] as const) { + assert.strictEqual( + resolveProviderCompatibility(bundled, driver, codexVersion, t3CodeVersion)?.status, + expected, + `T3 Code ${t3CodeVersion} with Codex ${codexVersion}`, + ); + } + }); + it("compares Cursor build dates without treating semver prereleases as stable", () => { const cursor = ProviderDriverKind.make("cursor"); const cursorPolicy: ProviderCompatibilityPolicy = { diff --git a/apps/server/src/provider/testFixtures/codexMultiAgentWire.json b/apps/server/src/provider/testFixtures/codexMultiAgentWire.json index 08316d3b6334..0f183635b17e 100644 --- a/apps/server/src/provider/testFixtures/codexMultiAgentWire.json +++ b/apps/server/src/provider/testFixtures/codexMultiAgentWire.json @@ -20,6 +20,7 @@ "forkedFromId": null, "parentThreadId": null, "preview": "", + "projectId": null, "ephemeral": false, "historyMode": "legacy", "modelProvider": "openai", @@ -389,6 +390,7 @@ "forkedFromId": null, "parentThreadId": null, "preview": "", + "projectId": null, "ephemeral": false, "historyMode": "legacy", "modelProvider": "openai", diff --git a/packages/effect-codex-app-server/scripts/generate.ts b/packages/effect-codex-app-server/scripts/generate.ts index d61db6dc2dc8..b2696097ef8c 100644 --- a/packages/effect-codex-app-server/scripts/generate.ts +++ b/packages/effect-codex-app-server/scripts/generate.ts @@ -17,7 +17,7 @@ import { } from "effect/unstable/http"; import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"; -const UPSTREAM_REF = "678157acaa819d5510adfe359abb5d0392cfe461"; +const UPSTREAM_REF = "fe74a774532af67b5a4a3dec03ce9469e17f89af"; const USER_AGENT = "effect-codex-app-server-generator"; const GITHUB_API_BASE = "https://api.github.com/repos/openai/codex/contents/codex-rs/app-server-protocol"; @@ -145,112 +145,6 @@ const ManualSchemas: Record = { }, }; -// Codex 0.150 added these multi-agent values before our next full protocol -// refresh. Keep every generated response namespace compatible with them. -const Codex0150DefinitionSchemas: Record = { - CollabAgentTool: { - type: "string", - enum: [ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent", - "sendMessage", - "followupTask", - "interruptAgent", - "listAgents", - ], - }, - CollabAgentToolCallStatus: { - type: "string", - enum: ["inProgress", "completed", "failed", "interrupted"], - }, - PlanType: { - type: "string", - enum: [ - "free", - "go", - "plus", - "pro", - "prolite", - "team", - "self_serve_business_prolite", - "self_serve_business_usage_based", - "business", - "ent26", - "enterprise_cbp_automation", - "enterprise_cbp_usage_based", - "enterprise", - "edu", - "edu_plus", - "edu_pro", - "unknown", - ], - }, - SubAgentActivityKind: { - type: "string", - enum: ["started", "interacted", "interrupted", "completed"], - }, -}; - -// Pinned protocol JSON omits later CodexErrorInfo variants. Keep historical -// thread payloads decodable; do not fold unknown values into "other". -const CodexErrorInfoCompatibilityValues = [ - "rateLimitExceeded", - "misalignmentPolicyViolation", -] as const; - -const CodexErrorInfoCompatibilityExports = new Set([ - "V2ThreadReadResponse", - "V2ThreadResumeResponse", - "V2ThreadRollbackResponse", - "V2ThreadForkResponse", - "V2TurnCompletedNotification", -]); - -function applyCodex0151DefinitionCompatibility( - exportName: string, - definitionName: string, - definitionSchema: Schema.Json, -): Schema.Json { - if ( - !CodexErrorInfoCompatibilityExports.has(exportName) || - definitionName !== "CodexErrorInfo" || - typeof definitionSchema !== "object" - ) { - return definitionSchema; - } - - const schema = definitionSchema as { - readonly oneOf?: ReadonlyArray<{ readonly enum?: ReadonlyArray }>; - }; - const [firstVariant, ...remainingVariants] = schema.oneOf ?? []; - const currentEnum = firstVariant?.enum; - if (!currentEnum) { - return definitionSchema; - } - - const missingValues = CodexErrorInfoCompatibilityValues.filter( - (value) => !currentEnum.includes(value), - ); - if (missingValues.length === 0) { - return definitionSchema; - } - - const enumValues = [...currentEnum]; - const otherIndex = enumValues.indexOf("other"); - const nextEnum = - otherIndex === -1 - ? [...enumValues, ...missingValues] - : [...enumValues.slice(0, otherIndex), ...missingValues, ...enumValues.slice(otherIndex)]; - - return { - ...definitionSchema, - oneOf: [{ ...firstVariant, enum: nextEnum }, ...remainingVariants], - }; -} - const getGeneratedPaths = Effect.fn("getGeneratedPaths")(function* () { const path = yield* Path.Path; const generatedDir = path.join(import.meta.dirname, "..", "src", "_generated"); @@ -470,61 +364,6 @@ function adaptSchemaForEffect(value: Schema.Json): Schema.Json { }; } -// Codex 0.153 adds async questions to agent messages. Keep older protocol -// fields until the next full refresh, including every thread history namespace. -function addAsyncQuestionFields(value: Schema.Json): Schema.Json { - if (Array.isArray(value)) { - return value.map(addAsyncQuestionFields); - } - if (value === null || typeof value !== "object") { - return value; - } - const properties = "properties" in value ? value.properties : undefined; - const itemType = - properties && typeof properties === "object" && "type" in properties - ? properties.type - : undefined; - if ( - properties && - typeof properties === "object" && - itemType && - typeof itemType === "object" && - "enum" in itemType && - Array.isArray(itemType.enum) && - itemType.enum.includes("agentMessage") - ) { - return { - ...value, - properties: { - ...Object.fromEntries(Object.entries(properties).filter(([key]) => key !== "type")), - delivery: { anyOf: [{ type: "string", enum: ["async"] }, { type: "null" }] }, - questions: { - anyOf: [ - { - type: "array", - items: { - type: "object", - properties: { - title: { type: "string" }, - options: { - anyOf: [{ type: "array", items: { type: "string" } }, { type: "null" }], - }, - }, - required: ["title"], - }, - }, - { type: "null" }, - ], - }, - type: itemType, - }, - }; - } - return Object.fromEntries( - Object.entries(value).map(([key, child]) => [key, addAsyncQuestionFields(child)]), - ); -} - function toPascalCaseMethod(method: string) { return method .split("/") @@ -536,13 +375,14 @@ function toPascalCaseMethod(method: string) { } function parseRequestEntries(fileContents: string): ReadonlyArray { - const entryPattern = /\{\s*"method":\s*"([^"]+)",\s*id:\s*RequestId,\s*params:\s*([^,}]+)/g; + // Optional params render as `params?: Foo | undefined`; their JSON schema is `NullableFoo`. + const entryPattern = /\{\s*"method":\s*"([^"]+)",\s*id:\s*RequestId,\s*params(\??):\s*([^,}|]+)/g; const entries: Array = []; let match: RegExpExecArray | null; while ((match = entryPattern.exec(fileContents)) !== null) { entries.push({ method: match[1]!, - paramsType: match[2]!.trim(), + paramsType: `${match[2] ? "Nullable" : ""}${match[3]!.trim()}`, }); } return entries; @@ -800,13 +640,10 @@ const generateFiles = Effect.fn("generateFiles")(function* () { ); for (const [definitionName, definitionSchema] of Object.entries(parsed.definitions ?? {})) { - const compatibleDefinitionSchema = - Codex0150DefinitionSchemas[definitionName] ?? - applyCodex0151DefinitionCompatibility(file.exportName, definitionName, definitionSchema); aggregateSchemas[localDefinitionNames.get(definitionName)!] = stripNullDefaults( normalizeNullableTypes( rewriteExternalRefs( - compatibleDefinitionSchema, + definitionSchema, localDefinitionNames, file.namespace, exportNameByQualifiedName, @@ -844,7 +681,7 @@ const generateFiles = Effect.fn("generateFiles")(function* () { for (const [name, schema] of Object.entries(aggregateSchemas).toSorted(([left], [right]) => left.localeCompare(right), )) { - aggregateSchemas[name] = adaptSchemaForEffect(addAsyncQuestionFields(schema)); + aggregateSchemas[name] = adaptSchemaForEffect(schema); generator.addSchema(name, aggregateSchemas[name] as never); } diff --git a/packages/effect-codex-app-server/src/_generated/meta.gen.ts b/packages/effect-codex-app-server/src/_generated/meta.gen.ts index 24452e881f66..88ffb842ac9b 100644 --- a/packages/effect-codex-app-server/src/_generated/meta.gen.ts +++ b/packages/effect-codex-app-server/src/_generated/meta.gen.ts @@ -1,5 +1,5 @@ // This file is generated by the effect-codex-app-server package. Do not edit manually. -// Upstream protocol ref: 678157acaa819d5510adfe359abb5d0392cfe461 +// Upstream protocol ref: fe74a774532af67b5a4a3dec03ce9469e17f89af import * as CodexSchema from "./schema.gen.ts"; @@ -16,14 +16,24 @@ export const CLIENT_REQUEST_METHODS = { "thread/goal/get": "thread/goal/get", "thread/goal/clear": "thread/goal/clear", "thread/metadata/update": "thread/metadata/update", + "thread/attachment/add": "thread/attachment/add", + "thread/attachment/list": "thread/attachment/list", + "thread/attachment/remove": "thread/attachment/remove", + "thread/section/move": "thread/section/move", "thread/unarchive": "thread/unarchive", "thread/compact/start": "thread/compact/start", "thread/shellCommand": "thread/shellCommand", "thread/approveGuardianDeniedAction": "thread/approveGuardianDeniedAction", - "thread/rollback": "thread/rollback", + "thread/revert": "thread/revert", "thread/list": "thread/list", + "threadSection/list": "threadSection/list", + "threadSection/create": "threadSection/create", + "threadSection/update": "threadSection/update", + "threadSection/delete": "threadSection/delete", "thread/loaded/list": "thread/loaded/list", "thread/read": "thread/read", + "thread/turns/list": "thread/turns/list", + "thread/items/list": "thread/items/list", "thread/inject_items": "thread/inject_items", "skills/list": "skills/list", "skills/extraRoots/set": "skills/extraRoots/set", @@ -33,6 +43,7 @@ export const CLIENT_REQUEST_METHODS = { "marketplace/upgrade": "marketplace/upgrade", "plugin/list": "plugin/list", "plugin/installed": "plugin/installed", + "plugin/reconcile": "plugin/reconcile", "plugin/read": "plugin/read", "plugin/skill/read": "plugin/skill/read", "plugin/share/save": "plugin/share/save", @@ -87,6 +98,7 @@ export const CLIENT_REQUEST_METHODS = { "config/read": "config/read", "externalAgentConfig/detect": "externalAgentConfig/detect", "externalAgentConfig/import": "externalAgentConfig/import", + "externalAgentConfig/import/recordHistory": "externalAgentConfig/import/recordHistory", "externalAgentConfig/import/readHistories": "externalAgentConfig/import/readHistories", "config/value/write": "config/value/write", "config/batchWrite": "config/batchWrite", @@ -123,10 +135,15 @@ export const SERVER_NOTIFICATION_METHODS = { "thread/deleted": "thread/deleted", "thread/unarchived": "thread/unarchived", "thread/closed": "thread/closed", + "thread/reverted": "thread/reverted", "skills/changed": "skills/changed", "thread/name/updated": "thread/name/updated", + "thread/attachment/updated": "thread/attachment/updated", "thread/goal/updated": "thread/goal/updated", "thread/goal/cleared": "thread/goal/cleared", + "thread/queue/changed": "thread/queue/changed", + "project/changed": "project/changed", + "thread/project/updated": "thread/project/updated", "thread/environment/connected": "thread/environment/connected", "thread/environment/disconnected": "thread/environment/disconnected", "thread/settings/updated": "thread/settings/updated", @@ -140,6 +157,7 @@ export const SERVER_NOTIFICATION_METHODS = { "item/started": "item/started", "item/autoApprovalReview/started": "item/autoApprovalReview/started", "item/autoApprovalReview/completed": "item/autoApprovalReview/completed", + "autoApprovalReview/strictReviewRequired": "autoApprovalReview/strictReviewRequired", "item/completed": "item/completed", "rawResponseItem/completed": "rawResponseItem/completed", "rawResponse/completed": "rawResponse/completed", @@ -156,6 +174,7 @@ export const SERVER_NOTIFICATION_METHODS = { "item/mcpToolCall/progress": "item/mcpToolCall/progress", "mcpServer/oauthLogin/completed": "mcpServer/oauthLogin/completed", "mcpServer/startupStatus/updated": "mcpServer/startupStatus/updated", + "mcpServer/event/stream/notification": "mcpServer/event/stream/notification", "account/updated": "account/updated", "account/rateLimits/updated": "account/rateLimits/updated", "app/list/updated": "app/list/updated", @@ -169,6 +188,8 @@ export const SERVER_NOTIFICATION_METHODS = { "thread/compacted": "thread/compacted", "model/rerouted": "model/rerouted", "model/verification": "model/verification", + "modelProvider/authRecoveryStarted": "modelProvider/authRecoveryStarted", + "modelProvider/authRecoveryCompleted": "modelProvider/authRecoveryCompleted", "turn/moderationMetadata": "turn/moderationMetadata", "model/safetyBuffering/updated": "model/safetyBuffering/updated", warning: "warning", @@ -179,6 +200,9 @@ export const SERVER_NOTIFICATION_METHODS = { "fuzzyFileSearch/sessionCompleted": "fuzzyFileSearch/sessionCompleted", "thread/realtime/started": "thread/realtime/started", "thread/realtime/itemAdded": "thread/realtime/itemAdded", + "thread/realtime/item/started": "thread/realtime/item/started", + "thread/realtime/item/transcript/delta": "thread/realtime/item/transcript/delta", + "thread/realtime/item/completed": "thread/realtime/item/completed", "thread/realtime/transcript/delta": "thread/realtime/transcript/delta", "thread/realtime/transcript/done": "thread/realtime/transcript/done", "thread/realtime/outputAudio/delta": "thread/realtime/outputAudio/delta", @@ -208,14 +232,24 @@ export interface ClientRequestParamsByMethod { readonly "thread/goal/get": CodexSchema.V2ThreadGoalGetParams; readonly "thread/goal/clear": CodexSchema.V2ThreadGoalClearParams; readonly "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateParams; + readonly "thread/attachment/add": CodexSchema.V2ThreadAttachmentAddParams; + readonly "thread/attachment/list": CodexSchema.V2ThreadAttachmentListParams; + readonly "thread/attachment/remove": CodexSchema.V2ThreadAttachmentRemoveParams; + readonly "thread/section/move": CodexSchema.V2ThreadSectionMoveParams; readonly "thread/unarchive": CodexSchema.V2ThreadUnarchiveParams; readonly "thread/compact/start": CodexSchema.V2ThreadCompactStartParams; readonly "thread/shellCommand": CodexSchema.V2ThreadShellCommandParams; readonly "thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionParams; - readonly "thread/rollback": CodexSchema.V2ThreadRollbackParams; + readonly "thread/revert": CodexSchema.V2ThreadRevertParams; readonly "thread/list": CodexSchema.V2ThreadListParams; + readonly "threadSection/list": CodexSchema.V2ThreadSectionListParams; + readonly "threadSection/create": CodexSchema.V2ThreadSectionCreateParams; + readonly "threadSection/update": CodexSchema.V2ThreadSectionUpdateParams; + readonly "threadSection/delete": CodexSchema.V2ThreadSectionDeleteParams; readonly "thread/loaded/list": CodexSchema.V2ThreadLoadedListParams; readonly "thread/read": CodexSchema.V2ThreadReadParams; + readonly "thread/turns/list": CodexSchema.V2ThreadTurnsListParams; + readonly "thread/items/list": CodexSchema.V2ThreadItemsListParams; readonly "thread/inject_items": CodexSchema.V2ThreadInjectItemsParams; readonly "skills/list": CodexSchema.V2SkillsListParams; readonly "skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetParams; @@ -225,6 +259,7 @@ export interface ClientRequestParamsByMethod { readonly "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeParams; readonly "plugin/list": CodexSchema.V2PluginListParams; readonly "plugin/installed": CodexSchema.V2PluginInstalledParams; + readonly "plugin/reconcile": CodexSchema.V2PluginReconcileParams; readonly "plugin/read": CodexSchema.V2PluginReadParams; readonly "plugin/skill/read": CodexSchema.V2PluginSkillReadParams; readonly "plugin/share/save": CodexSchema.V2PluginShareSaveParams; @@ -266,9 +301,9 @@ export interface ClientRequestParamsByMethod { readonly "account/login/start": CodexSchema.V2LoginAccountParams; readonly "account/login/cancel": CodexSchema.V2CancelLoginAccountParams; readonly "account/logout": undefined; - readonly "account/rateLimits/read": undefined; + readonly "account/rateLimits/read": CodexSchema.V2NullableGetAccountRateLimitsParams; readonly "account/rateLimitResetCredit/consume": CodexSchema.V2ConsumeAccountRateLimitResetCreditParams; - readonly "account/usage/read": undefined; + readonly "account/usage/read": CodexSchema.V2NullableGetAccountTokenUsageParams; readonly "account/workspaceMessages/read": undefined; readonly "account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailParams; readonly "feedback/upload": CodexSchema.V2FeedbackUploadParams; @@ -279,6 +314,7 @@ export interface ClientRequestParamsByMethod { readonly "config/read": CodexSchema.V2ConfigReadParams; readonly "externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectParams; readonly "externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportParams; + readonly "externalAgentConfig/import/recordHistory": CodexSchema.V2ExternalAgentConfigImportHistoryRecordParams; readonly "externalAgentConfig/import/readHistories": undefined; readonly "config/value/write": CodexSchema.V2ConfigValueWriteParams; readonly "config/batchWrite": CodexSchema.V2ConfigBatchWriteParams; @@ -303,14 +339,24 @@ export interface ClientRequestResponsesByMethod { readonly "thread/goal/get": CodexSchema.V2ThreadGoalGetResponse; readonly "thread/goal/clear": CodexSchema.V2ThreadGoalClearResponse; readonly "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateResponse; + readonly "thread/attachment/add": CodexSchema.V2ThreadAttachmentAddResponse; + readonly "thread/attachment/list": CodexSchema.V2ThreadAttachmentListResponse; + readonly "thread/attachment/remove": CodexSchema.V2ThreadAttachmentRemoveResponse; + readonly "thread/section/move": CodexSchema.V2ThreadSectionMoveResponse; readonly "thread/unarchive": CodexSchema.V2ThreadUnarchiveResponse; readonly "thread/compact/start": CodexSchema.V2ThreadCompactStartResponse; readonly "thread/shellCommand": CodexSchema.V2ThreadShellCommandResponse; readonly "thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionResponse; - readonly "thread/rollback": CodexSchema.V2ThreadRollbackResponse; + readonly "thread/revert": CodexSchema.V2ThreadRevertResponse; readonly "thread/list": CodexSchema.V2ThreadListResponse; + readonly "threadSection/list": CodexSchema.V2ThreadSectionListResponse; + readonly "threadSection/create": CodexSchema.V2ThreadSectionCreateResponse; + readonly "threadSection/update": CodexSchema.V2ThreadSectionUpdateResponse; + readonly "threadSection/delete": CodexSchema.V2ThreadSectionDeleteResponse; readonly "thread/loaded/list": CodexSchema.V2ThreadLoadedListResponse; readonly "thread/read": CodexSchema.V2ThreadReadResponse; + readonly "thread/turns/list": CodexSchema.V2ThreadTurnsListResponse; + readonly "thread/items/list": CodexSchema.V2ThreadItemsListResponse; readonly "thread/inject_items": CodexSchema.V2ThreadInjectItemsResponse; readonly "skills/list": CodexSchema.V2SkillsListResponse; readonly "skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetResponse; @@ -320,6 +366,7 @@ export interface ClientRequestResponsesByMethod { readonly "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeResponse; readonly "plugin/list": CodexSchema.V2PluginListResponse; readonly "plugin/installed": CodexSchema.V2PluginInstalledResponse; + readonly "plugin/reconcile": CodexSchema.V2PluginReconcileResponse; readonly "plugin/read": CodexSchema.V2PluginReadResponse; readonly "plugin/skill/read": CodexSchema.V2PluginSkillReadResponse; readonly "plugin/share/save": CodexSchema.V2PluginShareSaveResponse; @@ -374,6 +421,7 @@ export interface ClientRequestResponsesByMethod { readonly "config/read": CodexSchema.V2ConfigReadResponse; readonly "externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectResponse; readonly "externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportResponse; + readonly "externalAgentConfig/import/recordHistory": CodexSchema.V2ExternalAgentConfigImportHistoryRecordResponse; readonly "externalAgentConfig/import/readHistories": CodexSchema.V2ExternalAgentConfigImportHistoriesReadResponse; readonly "config/value/write": CodexSchema.V2ConfigWriteResponse; readonly "config/batchWrite": CodexSchema.V2ConfigWriteResponse; @@ -423,10 +471,15 @@ export interface ServerNotificationParamsByMethod { readonly "thread/deleted": CodexSchema.V2ThreadDeletedNotification; readonly "thread/unarchived": CodexSchema.V2ThreadUnarchivedNotification; readonly "thread/closed": CodexSchema.V2ThreadClosedNotification; + readonly "thread/reverted": CodexSchema.V2ThreadRevertedNotification; readonly "skills/changed": CodexSchema.V2SkillsChangedNotification; readonly "thread/name/updated": CodexSchema.V2ThreadNameUpdatedNotification; + readonly "thread/attachment/updated": CodexSchema.V2ThreadAttachmentUpdatedNotification; readonly "thread/goal/updated": CodexSchema.V2ThreadGoalUpdatedNotification; readonly "thread/goal/cleared": CodexSchema.V2ThreadGoalClearedNotification; + readonly "thread/queue/changed": CodexSchema.V2ThreadQueueChangedNotification; + readonly "project/changed": CodexSchema.V2ProjectChangedNotification; + readonly "thread/project/updated": CodexSchema.V2ThreadProjectUpdatedNotification; readonly "thread/environment/connected": CodexSchema.V2EnvironmentConnectionNotification; readonly "thread/environment/disconnected": CodexSchema.V2EnvironmentConnectionNotification; readonly "thread/settings/updated": CodexSchema.V2ThreadSettingsUpdatedNotification; @@ -440,6 +493,7 @@ export interface ServerNotificationParamsByMethod { readonly "item/started": CodexSchema.V2ItemStartedNotification; readonly "item/autoApprovalReview/started": CodexSchema.V2ItemGuardianApprovalReviewStartedNotification; readonly "item/autoApprovalReview/completed": CodexSchema.V2ItemGuardianApprovalReviewCompletedNotification; + readonly "autoApprovalReview/strictReviewRequired": CodexSchema.V2StrictReviewRequiredNotification; readonly "item/completed": CodexSchema.V2ItemCompletedNotification; readonly "rawResponseItem/completed": CodexSchema.V2RawResponseItemCompletedNotification; readonly "rawResponse/completed": CodexSchema.V2RawResponseCompletedNotification; @@ -456,6 +510,7 @@ export interface ServerNotificationParamsByMethod { readonly "item/mcpToolCall/progress": CodexSchema.V2McpToolCallProgressNotification; readonly "mcpServer/oauthLogin/completed": CodexSchema.V2McpServerOauthLoginCompletedNotification; readonly "mcpServer/startupStatus/updated": CodexSchema.V2McpServerStatusUpdatedNotification; + readonly "mcpServer/event/stream/notification": CodexSchema.V2McpServerEventStreamNotification; readonly "account/updated": CodexSchema.V2AccountUpdatedNotification; readonly "account/rateLimits/updated": CodexSchema.V2AccountRateLimitsUpdatedNotification; readonly "app/list/updated": CodexSchema.V2AppListUpdatedNotification; @@ -469,6 +524,8 @@ export interface ServerNotificationParamsByMethod { readonly "thread/compacted": CodexSchema.V2ContextCompactedNotification; readonly "model/rerouted": CodexSchema.V2ModelReroutedNotification; readonly "model/verification": CodexSchema.V2ModelVerificationNotification; + readonly "modelProvider/authRecoveryStarted": CodexSchema.V2AuthRecoveryNotification; + readonly "modelProvider/authRecoveryCompleted": CodexSchema.V2AuthRecoveryNotification; readonly "turn/moderationMetadata": CodexSchema.V2TurnModerationMetadataNotification; readonly "model/safetyBuffering/updated": CodexSchema.V2ModelSafetyBufferingUpdatedNotification; readonly warning: CodexSchema.V2WarningNotification; @@ -479,6 +536,9 @@ export interface ServerNotificationParamsByMethod { readonly "fuzzyFileSearch/sessionCompleted": CodexSchema.FuzzyFileSearchSessionCompletedNotification; readonly "thread/realtime/started": CodexSchema.V2ThreadRealtimeStartedNotification; readonly "thread/realtime/itemAdded": CodexSchema.V2ThreadRealtimeItemAddedNotification; + readonly "thread/realtime/item/started": CodexSchema.V2ThreadRealtimeItemStartedNotification; + readonly "thread/realtime/item/transcript/delta": CodexSchema.V2ThreadRealtimeItemTranscriptDeltaNotification; + readonly "thread/realtime/item/completed": CodexSchema.V2ThreadRealtimeItemCompletedNotification; readonly "thread/realtime/transcript/delta": CodexSchema.V2ThreadRealtimeTranscriptDeltaNotification; readonly "thread/realtime/transcript/done": CodexSchema.V2ThreadRealtimeTranscriptDoneNotification; readonly "thread/realtime/outputAudio/delta": CodexSchema.V2ThreadRealtimeOutputAudioDeltaNotification; @@ -503,14 +563,24 @@ export const CLIENT_REQUEST_PARAMS = { "thread/goal/get": CodexSchema.V2ThreadGoalGetParams, "thread/goal/clear": CodexSchema.V2ThreadGoalClearParams, "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateParams, + "thread/attachment/add": CodexSchema.V2ThreadAttachmentAddParams, + "thread/attachment/list": CodexSchema.V2ThreadAttachmentListParams, + "thread/attachment/remove": CodexSchema.V2ThreadAttachmentRemoveParams, + "thread/section/move": CodexSchema.V2ThreadSectionMoveParams, "thread/unarchive": CodexSchema.V2ThreadUnarchiveParams, "thread/compact/start": CodexSchema.V2ThreadCompactStartParams, "thread/shellCommand": CodexSchema.V2ThreadShellCommandParams, "thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionParams, - "thread/rollback": CodexSchema.V2ThreadRollbackParams, + "thread/revert": CodexSchema.V2ThreadRevertParams, "thread/list": CodexSchema.V2ThreadListParams, + "threadSection/list": CodexSchema.V2ThreadSectionListParams, + "threadSection/create": CodexSchema.V2ThreadSectionCreateParams, + "threadSection/update": CodexSchema.V2ThreadSectionUpdateParams, + "threadSection/delete": CodexSchema.V2ThreadSectionDeleteParams, "thread/loaded/list": CodexSchema.V2ThreadLoadedListParams, "thread/read": CodexSchema.V2ThreadReadParams, + "thread/turns/list": CodexSchema.V2ThreadTurnsListParams, + "thread/items/list": CodexSchema.V2ThreadItemsListParams, "thread/inject_items": CodexSchema.V2ThreadInjectItemsParams, "skills/list": CodexSchema.V2SkillsListParams, "skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetParams, @@ -520,6 +590,7 @@ export const CLIENT_REQUEST_PARAMS = { "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeParams, "plugin/list": CodexSchema.V2PluginListParams, "plugin/installed": CodexSchema.V2PluginInstalledParams, + "plugin/reconcile": CodexSchema.V2PluginReconcileParams, "plugin/read": CodexSchema.V2PluginReadParams, "plugin/skill/read": CodexSchema.V2PluginSkillReadParams, "plugin/share/save": CodexSchema.V2PluginShareSaveParams, @@ -561,9 +632,9 @@ export const CLIENT_REQUEST_PARAMS = { "account/login/start": CodexSchema.V2LoginAccountParams, "account/login/cancel": CodexSchema.V2CancelLoginAccountParams, "account/logout": undefined, - "account/rateLimits/read": undefined, + "account/rateLimits/read": CodexSchema.V2NullableGetAccountRateLimitsParams, "account/rateLimitResetCredit/consume": CodexSchema.V2ConsumeAccountRateLimitResetCreditParams, - "account/usage/read": undefined, + "account/usage/read": CodexSchema.V2NullableGetAccountTokenUsageParams, "account/workspaceMessages/read": undefined, "account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailParams, "feedback/upload": CodexSchema.V2FeedbackUploadParams, @@ -574,6 +645,8 @@ export const CLIENT_REQUEST_PARAMS = { "config/read": CodexSchema.V2ConfigReadParams, "externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectParams, "externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportParams, + "externalAgentConfig/import/recordHistory": + CodexSchema.V2ExternalAgentConfigImportHistoryRecordParams, "externalAgentConfig/import/readHistories": undefined, "config/value/write": CodexSchema.V2ConfigValueWriteParams, "config/batchWrite": CodexSchema.V2ConfigBatchWriteParams, @@ -598,14 +671,24 @@ export const CLIENT_REQUEST_RESPONSES = { "thread/goal/get": CodexSchema.V2ThreadGoalGetResponse, "thread/goal/clear": CodexSchema.V2ThreadGoalClearResponse, "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateResponse, + "thread/attachment/add": CodexSchema.V2ThreadAttachmentAddResponse, + "thread/attachment/list": CodexSchema.V2ThreadAttachmentListResponse, + "thread/attachment/remove": CodexSchema.V2ThreadAttachmentRemoveResponse, + "thread/section/move": CodexSchema.V2ThreadSectionMoveResponse, "thread/unarchive": CodexSchema.V2ThreadUnarchiveResponse, "thread/compact/start": CodexSchema.V2ThreadCompactStartResponse, "thread/shellCommand": CodexSchema.V2ThreadShellCommandResponse, "thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionResponse, - "thread/rollback": CodexSchema.V2ThreadRollbackResponse, + "thread/revert": CodexSchema.V2ThreadRevertResponse, "thread/list": CodexSchema.V2ThreadListResponse, + "threadSection/list": CodexSchema.V2ThreadSectionListResponse, + "threadSection/create": CodexSchema.V2ThreadSectionCreateResponse, + "threadSection/update": CodexSchema.V2ThreadSectionUpdateResponse, + "threadSection/delete": CodexSchema.V2ThreadSectionDeleteResponse, "thread/loaded/list": CodexSchema.V2ThreadLoadedListResponse, "thread/read": CodexSchema.V2ThreadReadResponse, + "thread/turns/list": CodexSchema.V2ThreadTurnsListResponse, + "thread/items/list": CodexSchema.V2ThreadItemsListResponse, "thread/inject_items": CodexSchema.V2ThreadInjectItemsResponse, "skills/list": CodexSchema.V2SkillsListResponse, "skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetResponse, @@ -615,6 +698,7 @@ export const CLIENT_REQUEST_RESPONSES = { "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeResponse, "plugin/list": CodexSchema.V2PluginListResponse, "plugin/installed": CodexSchema.V2PluginInstalledResponse, + "plugin/reconcile": CodexSchema.V2PluginReconcileResponse, "plugin/read": CodexSchema.V2PluginReadResponse, "plugin/skill/read": CodexSchema.V2PluginSkillReadResponse, "plugin/share/save": CodexSchema.V2PluginShareSaveResponse, @@ -669,6 +753,8 @@ export const CLIENT_REQUEST_RESPONSES = { "config/read": CodexSchema.V2ConfigReadResponse, "externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectResponse, "externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportResponse, + "externalAgentConfig/import/recordHistory": + CodexSchema.V2ExternalAgentConfigImportHistoryRecordResponse, "externalAgentConfig/import/readHistories": CodexSchema.V2ExternalAgentConfigImportHistoriesReadResponse, "config/value/write": CodexSchema.V2ConfigWriteResponse, @@ -719,10 +805,15 @@ export const SERVER_NOTIFICATION_PARAMS = { "thread/deleted": CodexSchema.V2ThreadDeletedNotification, "thread/unarchived": CodexSchema.V2ThreadUnarchivedNotification, "thread/closed": CodexSchema.V2ThreadClosedNotification, + "thread/reverted": CodexSchema.V2ThreadRevertedNotification, "skills/changed": CodexSchema.V2SkillsChangedNotification, "thread/name/updated": CodexSchema.V2ThreadNameUpdatedNotification, + "thread/attachment/updated": CodexSchema.V2ThreadAttachmentUpdatedNotification, "thread/goal/updated": CodexSchema.V2ThreadGoalUpdatedNotification, "thread/goal/cleared": CodexSchema.V2ThreadGoalClearedNotification, + "thread/queue/changed": CodexSchema.V2ThreadQueueChangedNotification, + "project/changed": CodexSchema.V2ProjectChangedNotification, + "thread/project/updated": CodexSchema.V2ThreadProjectUpdatedNotification, "thread/environment/connected": CodexSchema.V2EnvironmentConnectionNotification, "thread/environment/disconnected": CodexSchema.V2EnvironmentConnectionNotification, "thread/settings/updated": CodexSchema.V2ThreadSettingsUpdatedNotification, @@ -737,6 +828,7 @@ export const SERVER_NOTIFICATION_PARAMS = { "item/autoApprovalReview/started": CodexSchema.V2ItemGuardianApprovalReviewStartedNotification, "item/autoApprovalReview/completed": CodexSchema.V2ItemGuardianApprovalReviewCompletedNotification, + "autoApprovalReview/strictReviewRequired": CodexSchema.V2StrictReviewRequiredNotification, "item/completed": CodexSchema.V2ItemCompletedNotification, "rawResponseItem/completed": CodexSchema.V2RawResponseItemCompletedNotification, "rawResponse/completed": CodexSchema.V2RawResponseCompletedNotification, @@ -753,6 +845,7 @@ export const SERVER_NOTIFICATION_PARAMS = { "item/mcpToolCall/progress": CodexSchema.V2McpToolCallProgressNotification, "mcpServer/oauthLogin/completed": CodexSchema.V2McpServerOauthLoginCompletedNotification, "mcpServer/startupStatus/updated": CodexSchema.V2McpServerStatusUpdatedNotification, + "mcpServer/event/stream/notification": CodexSchema.V2McpServerEventStreamNotification, "account/updated": CodexSchema.V2AccountUpdatedNotification, "account/rateLimits/updated": CodexSchema.V2AccountRateLimitsUpdatedNotification, "app/list/updated": CodexSchema.V2AppListUpdatedNotification, @@ -768,6 +861,8 @@ export const SERVER_NOTIFICATION_PARAMS = { "thread/compacted": CodexSchema.V2ContextCompactedNotification, "model/rerouted": CodexSchema.V2ModelReroutedNotification, "model/verification": CodexSchema.V2ModelVerificationNotification, + "modelProvider/authRecoveryStarted": CodexSchema.V2AuthRecoveryNotification, + "modelProvider/authRecoveryCompleted": CodexSchema.V2AuthRecoveryNotification, "turn/moderationMetadata": CodexSchema.V2TurnModerationMetadataNotification, "model/safetyBuffering/updated": CodexSchema.V2ModelSafetyBufferingUpdatedNotification, warning: CodexSchema.V2WarningNotification, @@ -778,6 +873,10 @@ export const SERVER_NOTIFICATION_PARAMS = { "fuzzyFileSearch/sessionCompleted": CodexSchema.FuzzyFileSearchSessionCompletedNotification, "thread/realtime/started": CodexSchema.V2ThreadRealtimeStartedNotification, "thread/realtime/itemAdded": CodexSchema.V2ThreadRealtimeItemAddedNotification, + "thread/realtime/item/started": CodexSchema.V2ThreadRealtimeItemStartedNotification, + "thread/realtime/item/transcript/delta": + CodexSchema.V2ThreadRealtimeItemTranscriptDeltaNotification, + "thread/realtime/item/completed": CodexSchema.V2ThreadRealtimeItemCompletedNotification, "thread/realtime/transcript/delta": CodexSchema.V2ThreadRealtimeTranscriptDeltaNotification, "thread/realtime/transcript/done": CodexSchema.V2ThreadRealtimeTranscriptDoneNotification, "thread/realtime/outputAudio/delta": CodexSchema.V2ThreadRealtimeOutputAudioDeltaNotification, diff --git a/packages/effect-codex-app-server/src/_generated/namespaces.gen.ts b/packages/effect-codex-app-server/src/_generated/namespaces.gen.ts index 8665ad6f436d..3428ce049ed7 100644 --- a/packages/effect-codex-app-server/src/_generated/namespaces.gen.ts +++ b/packages/effect-codex-app-server/src/_generated/namespaces.gen.ts @@ -1,5 +1,5 @@ // This file is generated by the effect-codex-app-server package. Do not edit manually. -// Upstream protocol ref: 678157acaa819d5510adfe359abb5d0392cfe461 +// Upstream protocol ref: fe74a774532af67b5a4a3dec03ce9469e17f89af import * as CodexSchema from "./schema.gen.ts"; @@ -20,6 +20,7 @@ export const v2 = { AppsListResponse: CodexSchema.V2AppsListResponse, AppsReadParams: CodexSchema.V2AppsReadParams, AppsReadResponse: CodexSchema.V2AppsReadResponse, + AuthRecoveryNotification: CodexSchema.V2AuthRecoveryNotification, CancelLoginAccountParams: CodexSchema.V2CancelLoginAccountParams, CancelLoginAccountResponse: CodexSchema.V2CancelLoginAccountResponse, CommandExecOutputDeltaNotification: CodexSchema.V2CommandExecOutputDeltaNotification, @@ -56,6 +57,10 @@ export const v2 = { CodexSchema.V2ExternalAgentConfigImportCompletedNotification, ExternalAgentConfigImportHistoriesReadResponse: CodexSchema.V2ExternalAgentConfigImportHistoriesReadResponse, + ExternalAgentConfigImportHistoryRecordParams: + CodexSchema.V2ExternalAgentConfigImportHistoryRecordParams, + ExternalAgentConfigImportHistoryRecordResponse: + CodexSchema.V2ExternalAgentConfigImportHistoryRecordResponse, ExternalAgentConfigImportParams: CodexSchema.V2ExternalAgentConfigImportParams, ExternalAgentConfigImportProgressNotification: CodexSchema.V2ExternalAgentConfigImportProgressNotification, @@ -112,6 +117,7 @@ export const v2 = { MarketplaceUpgradeResponse: CodexSchema.V2MarketplaceUpgradeResponse, McpResourceReadParams: CodexSchema.V2McpResourceReadParams, McpResourceReadResponse: CodexSchema.V2McpResourceReadResponse, + McpServerEventStreamNotification: CodexSchema.V2McpServerEventStreamNotification, McpServerOauthLoginCompletedNotification: CodexSchema.V2McpServerOauthLoginCompletedNotification, McpServerOauthLoginParams: CodexSchema.V2McpServerOauthLoginParams, McpServerOauthLoginResponse: CodexSchema.V2McpServerOauthLoginResponse, @@ -127,6 +133,8 @@ export const v2 = { ModelReroutedNotification: CodexSchema.V2ModelReroutedNotification, ModelSafetyBufferingUpdatedNotification: CodexSchema.V2ModelSafetyBufferingUpdatedNotification, ModelVerificationNotification: CodexSchema.V2ModelVerificationNotification, + NullableGetAccountRateLimitsParams: CodexSchema.V2NullableGetAccountRateLimitsParams, + NullableGetAccountTokenUsageParams: CodexSchema.V2NullableGetAccountTokenUsageParams, PermissionProfileListParams: CodexSchema.V2PermissionProfileListParams, PermissionProfileListResponse: CodexSchema.V2PermissionProfileListResponse, PlanDeltaNotification: CodexSchema.V2PlanDeltaNotification, @@ -138,6 +146,8 @@ export const v2 = { PluginListResponse: CodexSchema.V2PluginListResponse, PluginReadParams: CodexSchema.V2PluginReadParams, PluginReadResponse: CodexSchema.V2PluginReadResponse, + PluginReconcileParams: CodexSchema.V2PluginReconcileParams, + PluginReconcileResponse: CodexSchema.V2PluginReconcileResponse, PluginShareCheckoutParams: CodexSchema.V2PluginShareCheckoutParams, PluginShareCheckoutResponse: CodexSchema.V2PluginShareCheckoutResponse, PluginShareDeleteParams: CodexSchema.V2PluginShareDeleteParams, @@ -154,6 +164,7 @@ export const v2 = { PluginUninstallResponse: CodexSchema.V2PluginUninstallResponse, ProcessExitedNotification: CodexSchema.V2ProcessExitedNotification, ProcessOutputDeltaNotification: CodexSchema.V2ProcessOutputDeltaNotification, + ProjectChangedNotification: CodexSchema.V2ProjectChangedNotification, RawResponseCompletedNotification: CodexSchema.V2RawResponseCompletedNotification, RawResponseItemCompletedNotification: CodexSchema.V2RawResponseItemCompletedNotification, ReasoningSummaryPartAddedNotification: CodexSchema.V2ReasoningSummaryPartAddedNotification, @@ -172,6 +183,7 @@ export const v2 = { SkillsExtraRootsSetResponse: CodexSchema.V2SkillsExtraRootsSetResponse, SkillsListParams: CodexSchema.V2SkillsListParams, SkillsListResponse: CodexSchema.V2SkillsListResponse, + StrictReviewRequiredNotification: CodexSchema.V2StrictReviewRequiredNotification, TerminalInteractionNotification: CodexSchema.V2TerminalInteractionNotification, ThreadApproveGuardianDeniedActionParams: CodexSchema.V2ThreadApproveGuardianDeniedActionParams, ThreadApproveGuardianDeniedActionResponse: @@ -179,6 +191,13 @@ export const v2 = { ThreadArchivedNotification: CodexSchema.V2ThreadArchivedNotification, ThreadArchiveParams: CodexSchema.V2ThreadArchiveParams, ThreadArchiveResponse: CodexSchema.V2ThreadArchiveResponse, + ThreadAttachmentAddParams: CodexSchema.V2ThreadAttachmentAddParams, + ThreadAttachmentAddResponse: CodexSchema.V2ThreadAttachmentAddResponse, + ThreadAttachmentListParams: CodexSchema.V2ThreadAttachmentListParams, + ThreadAttachmentListResponse: CodexSchema.V2ThreadAttachmentListResponse, + ThreadAttachmentRemoveParams: CodexSchema.V2ThreadAttachmentRemoveParams, + ThreadAttachmentRemoveResponse: CodexSchema.V2ThreadAttachmentRemoveResponse, + ThreadAttachmentUpdatedNotification: CodexSchema.V2ThreadAttachmentUpdatedNotification, ThreadClosedNotification: CodexSchema.V2ThreadClosedNotification, ThreadCompactStartParams: CodexSchema.V2ThreadCompactStartParams, ThreadCompactStartResponse: CodexSchema.V2ThreadCompactStartResponse, @@ -197,6 +216,8 @@ export const v2 = { ThreadGoalUpdatedNotification: CodexSchema.V2ThreadGoalUpdatedNotification, ThreadInjectItemsParams: CodexSchema.V2ThreadInjectItemsParams, ThreadInjectItemsResponse: CodexSchema.V2ThreadInjectItemsResponse, + ThreadItemsListParams: CodexSchema.V2ThreadItemsListParams, + ThreadItemsListResponse: CodexSchema.V2ThreadItemsListResponse, ThreadListParams: CodexSchema.V2ThreadListParams, ThreadListResponse: CodexSchema.V2ThreadListResponse, ThreadLoadedListParams: CodexSchema.V2ThreadLoadedListParams, @@ -204,11 +225,17 @@ export const v2 = { ThreadMetadataUpdateParams: CodexSchema.V2ThreadMetadataUpdateParams, ThreadMetadataUpdateResponse: CodexSchema.V2ThreadMetadataUpdateResponse, ThreadNameUpdatedNotification: CodexSchema.V2ThreadNameUpdatedNotification, + ThreadProjectUpdatedNotification: CodexSchema.V2ThreadProjectUpdatedNotification, + ThreadQueueChangedNotification: CodexSchema.V2ThreadQueueChangedNotification, ThreadReadParams: CodexSchema.V2ThreadReadParams, ThreadReadResponse: CodexSchema.V2ThreadReadResponse, ThreadRealtimeClosedNotification: CodexSchema.V2ThreadRealtimeClosedNotification, ThreadRealtimeErrorNotification: CodexSchema.V2ThreadRealtimeErrorNotification, ThreadRealtimeItemAddedNotification: CodexSchema.V2ThreadRealtimeItemAddedNotification, + ThreadRealtimeItemCompletedNotification: CodexSchema.V2ThreadRealtimeItemCompletedNotification, + ThreadRealtimeItemStartedNotification: CodexSchema.V2ThreadRealtimeItemStartedNotification, + ThreadRealtimeItemTranscriptDeltaNotification: + CodexSchema.V2ThreadRealtimeItemTranscriptDeltaNotification, ThreadRealtimeOutputAudioDeltaNotification: CodexSchema.V2ThreadRealtimeOutputAudioDeltaNotification, ThreadRealtimeSdpNotification: CodexSchema.V2ThreadRealtimeSdpNotification, @@ -218,8 +245,19 @@ export const v2 = { ThreadRealtimeTranscriptDoneNotification: CodexSchema.V2ThreadRealtimeTranscriptDoneNotification, ThreadResumeParams: CodexSchema.V2ThreadResumeParams, ThreadResumeResponse: CodexSchema.V2ThreadResumeResponse, - ThreadRollbackParams: CodexSchema.V2ThreadRollbackParams, - ThreadRollbackResponse: CodexSchema.V2ThreadRollbackResponse, + ThreadRevertedNotification: CodexSchema.V2ThreadRevertedNotification, + ThreadRevertParams: CodexSchema.V2ThreadRevertParams, + ThreadRevertResponse: CodexSchema.V2ThreadRevertResponse, + ThreadSectionCreateParams: CodexSchema.V2ThreadSectionCreateParams, + ThreadSectionCreateResponse: CodexSchema.V2ThreadSectionCreateResponse, + ThreadSectionDeleteParams: CodexSchema.V2ThreadSectionDeleteParams, + ThreadSectionDeleteResponse: CodexSchema.V2ThreadSectionDeleteResponse, + ThreadSectionListParams: CodexSchema.V2ThreadSectionListParams, + ThreadSectionListResponse: CodexSchema.V2ThreadSectionListResponse, + ThreadSectionMoveParams: CodexSchema.V2ThreadSectionMoveParams, + ThreadSectionMoveResponse: CodexSchema.V2ThreadSectionMoveResponse, + ThreadSectionUpdateParams: CodexSchema.V2ThreadSectionUpdateParams, + ThreadSectionUpdateResponse: CodexSchema.V2ThreadSectionUpdateResponse, ThreadSetNameParams: CodexSchema.V2ThreadSetNameParams, ThreadSetNameResponse: CodexSchema.V2ThreadSetNameResponse, ThreadSettingsUpdatedNotification: CodexSchema.V2ThreadSettingsUpdatedNotification, @@ -230,6 +268,8 @@ export const v2 = { ThreadStartResponse: CodexSchema.V2ThreadStartResponse, ThreadStatusChangedNotification: CodexSchema.V2ThreadStatusChangedNotification, ThreadTokenUsageUpdatedNotification: CodexSchema.V2ThreadTokenUsageUpdatedNotification, + ThreadTurnsListParams: CodexSchema.V2ThreadTurnsListParams, + ThreadTurnsListResponse: CodexSchema.V2ThreadTurnsListResponse, ThreadUnarchivedNotification: CodexSchema.V2ThreadUnarchivedNotification, ThreadUnarchiveParams: CodexSchema.V2ThreadUnarchiveParams, ThreadUnarchiveResponse: CodexSchema.V2ThreadUnarchiveResponse, diff --git a/packages/effect-codex-app-server/src/_generated/schema.gen.ts b/packages/effect-codex-app-server/src/_generated/schema.gen.ts index 1c33e03ed2aa..9bc7b1ec1e9e 100644 --- a/packages/effect-codex-app-server/src/_generated/schema.gen.ts +++ b/packages/effect-codex-app-server/src/_generated/schema.gen.ts @@ -1,5 +1,5 @@ // This file is generated by the effect-codex-app-server package. Do not edit manually. -// Upstream protocol ref: 678157acaa819d5510adfe359abb5d0392cfe461 +// Upstream protocol ref: fe74a774532af67b5a4a3dec03ce9469e17f89af import * as Schema from "effect/Schema"; @@ -57,6 +57,7 @@ export const ClientRequest__RequestId = Schema.Union([ export type ClientRequest__InitializeCapabilities = { readonly experimentalApi?: boolean; + readonly extensions?: { readonly [x: string]: Schema.Json } | null; readonly mcpServerOpenaiFormElicitation?: boolean; readonly optOutNotificationMethods?: ReadonlyArray | null; readonly requestAttestation?: boolean; @@ -68,9 +69,18 @@ export const ClientRequest__InitializeCapabilities = Schema.Struct({ default: false, }), ), + extensions: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: "MCP extension settings declared by the app-server client.", + }), + Schema.Null, + ]), + ), mcpServerOpenaiFormElicitation: Schema.optionalKey( Schema.Boolean.annotate({ - description: "Allow downstream MCP servers to request OpenAI extended form elicitations.", + description: + "Legacy opt-in for the `openai/form` MCP extension.\n\nNew clients should declare `openai/form` in [`Self::extensions`].", }), ), optOutNotificationMethods: Schema.optionalKey( @@ -149,7 +159,10 @@ export const ClientRequest__Personality = Schema.Literals([ "none", "friendly", "pragmatic", -]).annotate({ identifier: "ClientRequest__Personality" }); +]).annotate({ + description: "Deprecated: `friendly` and `pragmatic` no longer select a style.", + identifier: "ClientRequest__Personality", +}); export type ClientRequest__SandboxMode = "read-only" | "workspace-write" | "danger-full-access"; export const ClientRequest__SandboxMode = Schema.Literals([ @@ -253,6 +266,89 @@ export const ClientRequest__ThreadMetadataGitInfoUpdateParams = Schema.Struct({ ), }).annotate({ identifier: "ClientRequest__ThreadMetadataGitInfoUpdateParams" }); +export type ClientRequest__ThreadAttachmentAddParams = { + readonly attachmentType: string; + readonly identityKey: string; + readonly payload: Schema.Json; + readonly threadId: string; +}; +export const ClientRequest__ThreadAttachmentAddParams = Schema.Struct({ + attachmentType: Schema.String, + identityKey: Schema.String, + payload: Schema.Json.annotate({ expected: "JSON value" }), + threadId: Schema.String, +}).annotate({ + description: "Parameters for creating or locating an attachment on its owning thread.", + identifier: "ClientRequest__ThreadAttachmentAddParams", +}); + +export type ClientRequest__ThreadAttachmentListParams = { + readonly cursor?: string | null; + readonly limit?: number | null; + readonly threadId: string; +}; +export const ClientRequest__ThreadAttachmentListParams = Schema.Struct({ + cursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + threadId: Schema.String, +}).annotate({ + description: "Parameters for listing attachments from one thread.", + identifier: "ClientRequest__ThreadAttachmentListParams", +}); + +export type ClientRequest__ThreadAttachmentRemoveParams = { + readonly attachmentType: string; + readonly identityKey: string; + readonly threadId: string; +}; +export const ClientRequest__ThreadAttachmentRemoveParams = Schema.Struct({ + attachmentType: Schema.String, + identityKey: Schema.String, + threadId: Schema.String, +}).annotate({ + description: "Parameters for deleting an attachment by its stable thread-local identity.", + identifier: "ClientRequest__ThreadAttachmentRemoveParams", +}); + +export type ClientRequest__ThreadSectionMoveParams = { + readonly beforeThreadId?: string | null; + readonly sectionId: string | null; + readonly threadId: string; +}; +export const ClientRequest__ThreadSectionMoveParams = Schema.Struct({ + beforeThreadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Existing thread to insert before; omission or null appends to the section.", + }), + Schema.Null, + ]), + ), + sectionId: Schema.Union([ + Schema.String.annotate({ + description: "Destination section, or `null` to remove the thread from its section.", + }), + Schema.Null, + ]), + threadId: Schema.String.annotate({ + description: "Thread to move into, within, or out of a section.", + }), +}).annotate({ + description: "Parameters for moving a thread within a server-owned section ordering.", + identifier: "ClientRequest__ThreadSectionMoveParams", +}); + export type ClientRequest__ThreadUnarchiveParams = { readonly threadId: string }; export const ClientRequest__ThreadUnarchiveParams = Schema.Struct({ threadId: Schema.String, @@ -266,6 +362,7 @@ export const ClientRequest__ThreadCompactStartParams = Schema.Struct({ export type ClientRequest__ThreadShellCommandParams = { readonly command: string; readonly threadId: string; + readonly timeoutMs?: number | null; }; export const ClientRequest__ThreadShellCommandParams = Schema.Struct({ command: Schema.String.annotate({ @@ -273,6 +370,16 @@ export const ClientRequest__ThreadShellCommandParams = Schema.Struct({ "Shell command string evaluated by the thread's configured shell. Unlike `command/exec`, this intentionally preserves shell syntax such as pipes, redirects, and quoting. This runs unsandboxed with full access rather than inheriting the thread sandbox policy.", }), threadId: Schema.String, + timeoutMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Maximum execution time in milliseconds. Defaults to one hour when omitted or null. Must be non-negative; zero requests an immediate timeout, not unlimited execution. Does not affect the immediate RPC acknowledgement.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), }).annotate({ identifier: "ClientRequest__ThreadShellCommandParams" }); export type ClientRequest__ThreadApproveGuardianDeniedActionParams = { @@ -287,24 +394,19 @@ export const ClientRequest__ThreadApproveGuardianDeniedActionParams = Schema.Str threadId: Schema.String, }).annotate({ identifier: "ClientRequest__ThreadApproveGuardianDeniedActionParams" }); -export type ClientRequest__ThreadRollbackParams = { - readonly numTurns: number; +export type ClientRequest__ThreadRevertParams = { + readonly beforeTurnId: string; readonly threadId: string; }; -export const ClientRequest__ThreadRollbackParams = Schema.Struct({ - numTurns: Schema.Number.annotate({ - description: - "The number of turns to drop from the end of the thread. Must be >= 1.\n\nThis only modifies the thread's history and does not revert local file changes that have been made by the agent. Clients are responsible for reverting these changes.", - format: "uint32", - }) - .check(Schema.isInt().annotate({ expected: "an integer" })) - .check( - Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), - ), +export const ClientRequest__ThreadRevertParams = Schema.Struct({ + beforeTurnId: Schema.String.annotate({ + description: "Turn excluded from the replacement history, together with every later turn.", + }), threadId: Schema.String, }).annotate({ - description: "DEPRECATED: `thread/rollback` will be removed soon.", - identifier: "ClientRequest__ThreadRollbackParams", + description: + "Replace a paginated thread's durable history with the prefix before one turn.\n\nThis only changes persisted conversation history. It does not revert local file changes.", + identifier: "ClientRequest__ThreadRevertParams", }); export type ClientRequest__ThreadListCwdFilter = string | ReadonlyArray; @@ -318,11 +420,16 @@ export const ClientRequest__SortDirection = Schema.Literals(["asc", "desc"]).ann identifier: "ClientRequest__SortDirection", }); -export type ClientRequest__ThreadSortKey = "created_at" | "updated_at" | "recency_at"; +export type ClientRequest__ThreadSortKey = + | "created_at" + | "updated_at" + | "recency_at" + | "section_position"; export const ClientRequest__ThreadSortKey = Schema.Literals([ "created_at", "updated_at", "recency_at", + "section_position", ]).annotate({ identifier: "ClientRequest__ThreadSortKey" }); export type ClientRequest__ThreadSourceKind = @@ -349,6 +456,61 @@ export const ClientRequest__ThreadSourceKind = Schema.Literals([ "unknown", ]).annotate({ identifier: "ClientRequest__ThreadSourceKind" }); +export type ClientRequest__ThreadSectionListParams = { + readonly cursor?: string | null; + readonly limit?: number | null; +}; +export const ClientRequest__ThreadSectionListParams = Schema.Struct({ + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque pagination cursor returned by a previous call.", + }), + Schema.Null, + ]), + ), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Maximum number of sections to return.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), +}).annotate({ + description: "Parameters for listing independently persisted thread sections.", + identifier: "ClientRequest__ThreadSectionListParams", +}); + +export type ClientRequest__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const ClientRequest__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "ClientRequest__ThreadSectionAppearance", +}); + +export type ClientRequest__ThreadSectionDeleteParams = { readonly sectionId: string }; +export const ClientRequest__ThreadSectionDeleteParams = Schema.Struct({ + sectionId: Schema.String.annotate({ + description: "The stable, server-generated identity of the section to delete.", + }), +}).annotate({ + description: "Parameters for deleting an independently persisted thread section.", + identifier: "ClientRequest__ThreadSectionDeleteParams", +}); + export type ClientRequest__ThreadLoadedListParams = { readonly cursor?: string | null; readonly limit?: number | null; @@ -386,12 +548,30 @@ export type ClientRequest__ThreadReadParams = { export const ClientRequest__ThreadReadParams = Schema.Struct({ includeTurns: Schema.optionalKey( Schema.Boolean.annotate({ - description: "When true, include turns and their items from rollout history.", + description: + "When true, include turns and their items from rollout history. Full-history hydration is deprecated for paginated threads; prefer a metadata-only read and page with `thread/turns/list` and `thread/items/list`.", }), ), threadId: Schema.String, }).annotate({ identifier: "ClientRequest__ThreadReadParams" }); +export type ClientRequest__TurnItemsView = "notLoaded" | "summary" | "full"; +export const ClientRequest__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ClientRequest__TurnItemsView" }); + export type ClientRequest__ThreadInjectItemsParams = { readonly items: ReadonlyArray; readonly threadId: string; @@ -471,6 +651,18 @@ export const ClientRequest__PluginListMarketplaceKind = Schema.Literals([ "created-by-me-remote", ]).annotate({ identifier: "ClientRequest__PluginListMarketplaceKind" }); +export type ClientRequest__PluginReconcileParams = { readonly reason?: string | null }; +export const ClientRequest__PluginReconcileParams = Schema.Struct({ + reason: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional client-provided reason recorded with the reconciliation attempt.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__PluginReconcileParams" }); + export type ClientRequest__PluginSkillReadParams = { readonly remoteMarketplaceName: string; readonly remotePluginId: string; @@ -527,6 +719,7 @@ export const ClientRequest__PluginShareDeleteParams = Schema.Struct({ export type ClientRequest__AppsReadParams = { readonly appIds: ReadonlyArray; readonly includeTools?: boolean; + readonly threadId?: string | null; }; export const ClientRequest__AppsReadParams = Schema.Struct({ appIds: Schema.Array(Schema.String).annotate({ @@ -539,6 +732,14 @@ export const ClientRequest__AppsReadParams = Schema.Struct({ "When true, include display-only public tool summaries in the returned metadata.", }), ), + threadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional loaded thread id used to evaluate effective app configuration.", + }), + Schema.Null, + ]), + ), }).annotate({ description: "EXPERIMENTAL - read metadata for specific apps/connectors.", identifier: "ClientRequest__AppsReadParams", @@ -880,25 +1081,12 @@ export const ClientRequest__ExperimentalFeatureEnablementSetParams = Schema.Stru }), }).annotate({ identifier: "ClientRequest__ExperimentalFeatureEnablementSetParams" }); -export type ClientRequest__McpServerOauthLoginParams = { - readonly name: string; - readonly scopes?: ReadonlyArray | null; - readonly threadId?: string | null; - readonly timeoutSecs?: number | null; -}; -export const ClientRequest__McpServerOauthLoginParams = Schema.Struct({ - name: Schema.String, - scopes: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - timeoutSecs: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "int64" }).check( - Schema.isInt().annotate({ expected: "an integer" }), - ), - Schema.Null, - ]), - ), -}).annotate({ identifier: "ClientRequest__McpServerOauthLoginParams" }); +export type ClientRequest__McpServerOauthClientRegistration = "auto" | "cimd" | "dcr"; +export const ClientRequest__McpServerOauthClientRegistration = Schema.Literals([ + "auto", + "cimd", + "dcr", +]).annotate({ identifier: "ClientRequest__McpServerOauthClientRegistration" }); export type ClientRequest__McpServerStatusDetail = "full" | "toolsAndAuthOnly"; export const ClientRequest__McpServerStatusDetail = Schema.Literals([ @@ -907,11 +1095,22 @@ export const ClientRequest__McpServerStatusDetail = Schema.Literals([ ]).annotate({ identifier: "ClientRequest__McpServerStatusDetail" }); export type ClientRequest__McpResourceReadParams = { + readonly connectorId?: string | null; + readonly originCallId?: string | null; readonly server: string; readonly threadId?: string | null; readonly uri: string; }; export const ClientRequest__McpResourceReadParams = Schema.Struct({ + connectorId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + originCallId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Originating MCP tool call used to select the resource's app.", + }), + Schema.Null, + ]), + ), server: Schema.String, threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, @@ -948,6 +1147,29 @@ export const ClientRequest__CancelLoginAccountParams = Schema.Struct({ loginId: Schema.String, }).annotate({ identifier: "ClientRequest__CancelLoginAccountParams" }); +export type ClientRequest__GetAccountRateLimitsParams = { + readonly excludeResetCreditDetails?: boolean; + readonly supportsLunaReserve?: boolean; +}; +export const ClientRequest__GetAccountRateLimitsParams = Schema.Struct({ + excludeResetCreditDetails: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "Skip the separate reset-credit detail lookup for background usage polls. The usage response still includes the available count; omitted/false preserves detailed reads.", + }), + ), + supportsLunaReserve: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "The client supports automatic Luna Reserve fallback. For eligible ChatGPT CLI users, allow the backend to record experiment exposure after ordinary usage is blocked.", + }), + ), +}).annotate({ + description: + "Usage-read capabilities of the requesting client, never inferred from its experiment arm.", + identifier: "ClientRequest__GetAccountRateLimitsParams", +}); + export type ClientRequest__ConsumeAccountRateLimitResetCreditParams = { readonly creditId?: string | null; readonly idempotencyKey: string; @@ -968,6 +1190,19 @@ export const ClientRequest__ConsumeAccountRateLimitResetCreditParams = Schema.St }), }).annotate({ identifier: "ClientRequest__ConsumeAccountRateLimitResetCreditParams" }); +export type ClientRequest__GetAccountTokenUsageParams = { readonly threadId?: string | null }; +export const ClientRequest__GetAccountTokenUsageParams = Schema.Struct({ + threadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "When present, read estimated usage for this thread instead of account-wide token activity.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__GetAccountTokenUsageParams" }); + export type ClientRequest__AddCreditsNudgeCreditType = "credits" | "usage_limit"; export const ClientRequest__AddCreditsNudgeCreditType = Schema.Literals([ "credits", @@ -1076,6 +1311,8 @@ export const ClientRequest__ConfigReadParams = Schema.Struct({ export type ClientRequest__ExternalAgentConfigDetectParams = { readonly cwds?: ReadonlyArray | null; readonly includeHome?: boolean; + readonly maxSessionAgeDays?: number | null; + readonly maxSessions?: number | null; readonly migrationSource?: string | null; readonly source?: string | null; }; @@ -1093,6 +1330,37 @@ export const ClientRequest__ExternalAgentConfigDetectParams = Schema.Struct({ description: "If true, include detection under the user's home directory.", }), ), + maxSessionAgeDays: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Maximum age in days for detected sessions. Missing values use the default limit.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + maxSessions: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Maximum number of sessions to detect. Missing values use the default limit.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), migrationSource: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -1440,40 +1708,27 @@ export const ClientRequest__ConversationTextRole = Schema.Literals([ "assistant", ]).annotate({ identifier: "ClientRequest__ConversationTextRole" }); -export type ClientRequest__TurnItemsView = "notLoaded" | "summary" | "full"; -export const ClientRequest__TurnItemsView = Schema.Union( - [ - Schema.Literal("notLoaded").annotate({ - description: "`items` was not loaded for this turn. The field is intentionally empty.", - }), - Schema.Literal("summary").annotate({ - description: "`items` contains only a display summary for this turn.", - }), - Schema.Literal("full").annotate({ - description: - "`items` contains every ThreadItem available from persisted app-server history for this turn.", - }), - ], - { mode: "oneOf" }, -).annotate({ identifier: "ClientRequest__TurnItemsView" }); - export type ClientRequest__LegacyAppPathString = string; export const ClientRequest__LegacyAppPathString = Schema.String.annotate({ identifier: "ClientRequest__LegacyAppPathString", }); -export type CommandExecutionRequestApprovalParams__AbsolutePathBuf = string; -export const CommandExecutionRequestApprovalParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "CommandExecutionRequestApprovalParams__AbsolutePathBuf", -}); - export type CommandExecutionRequestApprovalParams__LegacyAppPathString = string; export const CommandExecutionRequestApprovalParams__LegacyAppPathString = Schema.String.annotate({ identifier: "CommandExecutionRequestApprovalParams__LegacyAppPathString", }); +export type CommandExecutionRequestApprovalParams__CommandExecutionApprovalKind = + | "command" + | "writeStdin"; +export const CommandExecutionRequestApprovalParams__CommandExecutionApprovalKind = Schema.Literals([ + "command", + "writeStdin", +]).annotate({ + description: "Distinguishes a command approval from input sent to an existing terminal.", + identifier: "CommandExecutionRequestApprovalParams__CommandExecutionApprovalKind", +}); + export type CommandExecutionRequestApprovalParams__NetworkApprovalProtocol = | "http" | "https" @@ -1772,11 +2027,9 @@ export const McpServerElicitationRequestResponse__McpServerElicitationAction = S "cancel", ]).annotate({ identifier: "McpServerElicitationRequestResponse__McpServerElicitationAction" }); -export type PermissionsRequestApprovalParams__AbsolutePathBuf = string; -export const PermissionsRequestApprovalParams__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "PermissionsRequestApprovalParams__AbsolutePathBuf", +export type PermissionsRequestApprovalParams__LegacyAppPathString = string; +export const PermissionsRequestApprovalParams__LegacyAppPathString = Schema.String.annotate({ + identifier: "PermissionsRequestApprovalParams__LegacyAppPathString", }); export type PermissionsRequestApprovalParams__FileSystemAccessMode = "read" | "write" | "deny"; @@ -1786,11 +2039,6 @@ export const PermissionsRequestApprovalParams__FileSystemAccessMode = Schema.Lit "deny", ]).annotate({ identifier: "PermissionsRequestApprovalParams__FileSystemAccessMode" }); -export type PermissionsRequestApprovalParams__LegacyAppPathString = string; -export const PermissionsRequestApprovalParams__LegacyAppPathString = Schema.String.annotate({ - identifier: "PermissionsRequestApprovalParams__LegacyAppPathString", -}); - export type PermissionsRequestApprovalParams__AdditionalNetworkPermissions = { readonly enabled?: boolean | null; }; @@ -1829,6 +2077,11 @@ export const ServerNotification__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "ServerNotification__NonSteerableTurnKind" }); +export type ServerNotification__MisalignmentSteer = { readonly message: string }; +export const ServerNotification__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "ServerNotification__MisalignmentSteer" }); + export type ServerNotification__AbsolutePathBuf = string; export const ServerNotification__AbsolutePathBuf = Schema.String.annotate({ description: @@ -1847,6 +2100,34 @@ export const ServerNotification__GitInfo = Schema.Struct({ sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "ServerNotification__GitInfo" }); +export type ServerNotification__ThreadHistoryMode = "legacy" | "paginated"; +export const ServerNotification__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "ServerNotification__ThreadHistoryMode" }); + +export type ServerNotification__ReasoningEffort = string; +export const ServerNotification__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "ServerNotification__ReasoningEffort", + }), +); + +export type ServerNotification__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const ServerNotification__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "ServerNotification__ThreadSectionAppearance", +}); + export type ServerNotification__AgentPath = string; export const ServerNotification__AgentPath = Schema.String.annotate({ identifier: "ServerNotification__AgentPath", @@ -1899,6 +2180,11 @@ export const ServerNotification__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "ServerNotification__HookPromptFragment" }); +export type ServerNotification__AgentMessageDelivery = "async"; +export const ServerNotification__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "ServerNotification__AgentMessageDelivery", +}); + export type ServerNotification__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -1938,6 +2224,15 @@ export const ServerNotification__MessagePhase = Schema.Union( identifier: "ServerNotification__MessagePhase", }); +export type ServerNotification__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const ServerNotification__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "ServerNotification__AsyncUserInputQuestion" }); + export type ServerNotification__LegacyAppPathString = string; export const ServerNotification__LegacyAppPathString = Schema.String.annotate({ identifier: "ServerNotification__LegacyAppPathString", @@ -2019,6 +2314,12 @@ export const ServerNotification__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "ServerNotification__McpToolCallError" }); +export type ServerNotification__McpAppDisplayMode = "inline" | "fullscreen"; +export const ServerNotification__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "ServerNotification__McpAppDisplayMode" }); + export type ServerNotification__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -2090,16 +2391,6 @@ export const ServerNotification__CollabAgentStatus = Schema.Literals([ "notFound", ]).annotate({ identifier: "ServerNotification__CollabAgentStatus" }); -export type ServerNotification__ReasoningEffort = string; -export const ServerNotification__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check( - Schema.isMinLength(1).annotate({ - expected: "a value with a length of at least 1", - identifier: "ServerNotification__ReasoningEffort", - }), -); - export type ServerNotification__CollabAgentToolCallStatus = | "inProgress" | "completed" @@ -2178,6 +2469,31 @@ export const ServerNotification__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "ServerNotification__WebSearchAction" }); +export type ServerNotification__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const ServerNotification__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__ImageGenerationFailure" }); + export type ServerNotification__TurnItemsView = "notLoaded" | "summary" | "full"; export const ServerNotification__TurnItemsView = Schema.Union( [ @@ -2223,6 +2539,11 @@ export const ServerNotification__ThreadClosedNotification = Schema.Struct({ threadId: Schema.String, }).annotate({ identifier: "ServerNotification__ThreadClosedNotification" }); +export type ServerNotification__ThreadRevertedNotification = { readonly threadId: string }; +export const ServerNotification__ThreadRevertedNotification = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadRevertedNotification" }); + export type ServerNotification__SkillsChangedNotification = { readonly [x: string]: Schema.Json }; export const ServerNotification__SkillsChangedNotification = Schema.Record( Schema.String, @@ -2242,6 +2563,15 @@ export const ServerNotification__ThreadNameUpdatedNotification = Schema.Struct({ threadName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "ServerNotification__ThreadNameUpdatedNotification" }); +export type ServerNotification__ThreadAttachmentOperation = "created" | "deleted"; +export const ServerNotification__ThreadAttachmentOperation = Schema.Literals([ + "created", + "deleted", +]).annotate({ + description: "The persisted attachment change represented by a notification.", + identifier: "ServerNotification__ThreadAttachmentOperation", +}); + export type ServerNotification__ThreadGoalStatus = | "active" | "paused" @@ -2263,6 +2593,27 @@ export const ServerNotification__ThreadGoalClearedNotification = Schema.Struct({ threadId: Schema.String, }).annotate({ identifier: "ServerNotification__ThreadGoalClearedNotification" }); +export type ServerNotification__ThreadQueueChangedNotification = { readonly threadId: string }; +export const ServerNotification__ThreadQueueChangedNotification = Schema.Struct({ + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadQueueChangedNotification" }); + +export type ServerNotification__ProjectChangeType = "created" | "updated" | "deleted"; +export const ServerNotification__ProjectChangeType = Schema.Literals([ + "created", + "updated", + "deleted", +]).annotate({ identifier: "ServerNotification__ProjectChangeType" }); + +export type ServerNotification__ThreadProjectUpdatedNotification = { + readonly projectId: string | null; + readonly threadId: string; +}; +export const ServerNotification__ThreadProjectUpdatedNotification = Schema.Struct({ + projectId: Schema.Union([Schema.String, Schema.Null]), + threadId: Schema.String, +}).annotate({ identifier: "ServerNotification__ThreadProjectUpdatedNotification" }); + export type ServerNotification__EnvironmentConnectionNotification = { readonly environmentId: string; readonly threadId: string; @@ -2343,7 +2694,10 @@ export const ServerNotification__Personality = Schema.Literals([ "none", "friendly", "pragmatic", -]).annotate({ identifier: "ServerNotification__Personality" }); +]).annotate({ + description: "Deprecated: `friendly` and `pragmatic` no longer select a style.", + identifier: "ServerNotification__Personality", +}); export type ServerNotification__NetworkAccess = "restricted" | "enabled"; export const ServerNotification__NetworkAccess = Schema.Literals([ @@ -2420,7 +2774,8 @@ export type ServerNotification__HookEventName = | "userPromptSubmit" | "subagentStart" | "subagentStop" - | "stop"; + | "stop" + | "interrupt"; export const ServerNotification__HookEventName = Schema.Literals([ "preToolUse", "permissionRequest", @@ -2433,6 +2788,7 @@ export const ServerNotification__HookEventName = Schema.Literals([ "subagentStart", "subagentStop", "stop", + "interrupt", ]).annotate({ identifier: "ServerNotification__HookEventName" }); export type ServerNotification__HookExecutionMode = "sync" | "async"; @@ -2440,9 +2796,10 @@ export const ServerNotification__HookExecutionMode = Schema.Literals(["sync", "a identifier: "ServerNotification__HookExecutionMode", }); -export type ServerNotification__HookHandlerType = "command" | "prompt" | "agent"; +export type ServerNotification__HookHandlerType = "command" | "mcpTool" | "prompt" | "agent"; export const ServerNotification__HookHandlerType = Schema.Literals([ "command", + "mcpTool", "prompt", "agent", ]).annotate({ identifier: "ServerNotification__HookHandlerType" }); @@ -2591,6 +2948,20 @@ export const ServerNotification__AutoReviewDecisionSource = Schema.Literal("agen identifier: "ServerNotification__AutoReviewDecisionSource", }); +export type ServerNotification__StrictReviewRequiredNotification = { + readonly startedAtMs: number; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__StrictReviewRequiredNotification = Schema.Struct({ + startedAtMs: Schema.Number.annotate({ + description: "Unix timestamp (in milliseconds) when this review started.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__StrictReviewRequiredNotification" }); + export type ServerNotification__AgentMessageDeltaNotification = { readonly delta: string; readonly itemId: string; @@ -2781,6 +3152,15 @@ export const ServerNotification__McpServerStartupState = Schema.Literals([ "cancelled", ]).annotate({ identifier: "ServerNotification__McpServerStartupState" }); +export type ServerNotification__McpServerEventNotification = { + readonly method: string; + readonly params: Schema.Json; +}; +export const ServerNotification__McpServerEventNotification = Schema.Struct({ + method: Schema.String, + params: Schema.Json.annotate({ expected: "JSON value" }), +}).annotate({ identifier: "ServerNotification__McpServerEventNotification" }); + export type ServerNotification__AuthMode = | "apikey" | "chatgpt" @@ -2788,7 +3168,8 @@ export type ServerNotification__AuthMode = | "headers" | "agentIdentity" | "personalAccessToken" - | "bedrockApiKey"; + | "bedrockApiKey" + | "bedrockAccessKeys"; export const ServerNotification__AuthMode = Schema.Union( [ Schema.Literal("apikey").annotate({ @@ -2813,6 +3194,9 @@ export const ServerNotification__AuthMode = Schema.Union( Schema.Literal("bedrockApiKey").annotate({ description: "Amazon Bedrock bearer token managed by Codex.", }), + Schema.Literal("bedrockAccessKeys").annotate({ + description: "Amazon Bedrock AWS access keys managed by Codex.", + }), ], { mode: "oneOf" }, ).annotate({ @@ -3070,6 +3454,19 @@ export const ServerNotification__ModelVerification = Schema.Literal( "trustedAccessForCyber", ).annotate({ identifier: "ServerNotification__ModelVerification" }); +export type ServerNotification__AuthRecoveryNotification = { + readonly message: string; + readonly provider: string; + readonly threadId: string; + readonly turnId: string; +}; +export const ServerNotification__AuthRecoveryNotification = Schema.Struct({ + message: Schema.String, + provider: Schema.String, + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ identifier: "ServerNotification__AuthRecoveryNotification" }); + export type ServerNotification__TurnModerationMetadataNotification = { readonly metadata: Schema.Json; readonly threadId: string; @@ -3192,6 +3589,67 @@ export const ServerNotification__ThreadRealtimeItemAddedNotification = Schema.St identifier: "ServerNotification__ThreadRealtimeItemAddedNotification", }); +export type ServerNotification__ThreadRealtimeTranscriptRole = "user" | "assistant"; +export const ServerNotification__ThreadRealtimeTranscriptRole = Schema.Literals([ + "user", + "assistant", +]).annotate({ identifier: "ServerNotification__ThreadRealtimeTranscriptRole" }); + +export type ServerNotification__ThreadRealtimeBemItemPresentation = + | { readonly type: "wholeItem" } + | { readonly type: "inlineMarkdown" } + | { readonly index: number; readonly type: "inlineVisualization" }; +export const ServerNotification__ThreadRealtimeBemItemPresentation = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("wholeItem").annotate({ + title: "WholeItemThreadRealtimeBemItemPresentationType", + }), + }).annotate({ title: "WholeItemThreadRealtimeBemItemPresentation" }), + Schema.Struct({ + type: Schema.Literal("inlineMarkdown").annotate({ + title: "InlineMarkdownThreadRealtimeBemItemPresentationType", + }), + }).annotate({ title: "InlineMarkdownThreadRealtimeBemItemPresentation" }), + Schema.Struct({ + index: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + type: Schema.Literal("inlineVisualization").annotate({ + title: "InlineVisualizationThreadRealtimeBemItemPresentationType", + }), + }).annotate({ title: "InlineVisualizationThreadRealtimeBemItemPresentation" }), + ], + { mode: "oneOf" }, +).annotate({ + description: "EXPERIMENTAL - how an existing agent item appears in a realtime conversation.", + identifier: "ServerNotification__ThreadRealtimeBemItemPresentation", +}); + +export type ServerNotification__ThreadRealtimeSessionOutcome = "ended" | "failed"; +export const ServerNotification__ThreadRealtimeSessionOutcome = Schema.Literals([ + "ended", + "failed", +]).annotate({ identifier: "ServerNotification__ThreadRealtimeSessionOutcome" }); + +export type ServerNotification__ThreadRealtimeItemTranscriptDeltaNotification = { + readonly delta: string; + readonly itemId: string; + readonly threadId: string; +}; +export const ServerNotification__ThreadRealtimeItemTranscriptDeltaNotification = Schema.Struct({ + delta: Schema.String, + itemId: Schema.String, + threadId: Schema.String, +}).annotate({ + description: "EXPERIMENTAL - text appended to an active realtime transcript item.", + identifier: "ServerNotification__ThreadRealtimeItemTranscriptDeltaNotification", +}); + export type ServerNotification__ThreadRealtimeTranscriptDeltaNotification = { readonly delta: string; readonly role: string; @@ -3316,16 +3774,10 @@ export const ServerNotification__WindowsSandboxSetupMode = Schema.Literals([ "unelevated", ]).annotate({ identifier: "ServerNotification__WindowsSandboxSetupMode" }); -export type ServerNotification__AccountLoginCompletedNotification = { - readonly error?: string | null; - readonly loginId?: string | null; - readonly success: boolean; -}; -export const ServerNotification__AccountLoginCompletedNotification = Schema.Struct({ - error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - loginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - success: Schema.Boolean, -}).annotate({ identifier: "ServerNotification__AccountLoginCompletedNotification" }); +export type ServerNotification__DesktopOnboardingEntrypoint = "life_sciences"; +export const ServerNotification__DesktopOnboardingEntrypoint = Schema.Literal( + "life_sciences", +).annotate({ identifier: "ServerNotification__DesktopOnboardingEntrypoint" }); export type ServerRequest__RequestId = string | number; export const ServerRequest__RequestId = Schema.Union([ @@ -3335,18 +3787,20 @@ export const ServerRequest__RequestId = Schema.Union([ ), ]).annotate({ identifier: "ServerRequest__RequestId" }); -export type ServerRequest__AbsolutePathBuf = string; -export const ServerRequest__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "ServerRequest__AbsolutePathBuf", -}); - export type ServerRequest__LegacyAppPathString = string; export const ServerRequest__LegacyAppPathString = Schema.String.annotate({ identifier: "ServerRequest__LegacyAppPathString", }); +export type ServerRequest__CommandExecutionApprovalKind = "command" | "writeStdin"; +export const ServerRequest__CommandExecutionApprovalKind = Schema.Literals([ + "command", + "writeStdin", +]).annotate({ + description: "Distinguishes a command approval from input sent to an existing terminal.", + identifier: "ServerRequest__CommandExecutionApprovalKind", +}); + export type ServerRequest__NetworkApprovalProtocol = "http" | "https" | "socks5Tcp" | "socks5Udp"; export const ServerRequest__NetworkApprovalProtocol = Schema.Literals([ "http", @@ -3587,6 +4041,7 @@ export const ToolRequestUserInputResponse__ToolRequestUserInputAnswer = Schema.S export type V1InitializeParams__InitializeCapabilities = { readonly experimentalApi?: boolean; + readonly extensions?: { readonly [x: string]: Schema.Json } | null; readonly mcpServerOpenaiFormElicitation?: boolean; readonly optOutNotificationMethods?: ReadonlyArray | null; readonly requestAttestation?: boolean; @@ -3598,9 +4053,18 @@ export const V1InitializeParams__InitializeCapabilities = Schema.Struct({ default: false, }), ), + extensions: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: "MCP extension settings declared by the app-server client.", + }), + Schema.Null, + ]), + ), mcpServerOpenaiFormElicitation: Schema.optionalKey( Schema.Boolean.annotate({ - description: "Allow downstream MCP servers to request OpenAI extended form elicitations.", + description: + "Legacy opt-in for the `openai/form` MCP extension.\n\nNew clients should declare `openai/form` in [`Self::extensions`].", }), ), optOutNotificationMethods: Schema.optionalKey( @@ -3641,6 +4105,11 @@ export const V1InitializeResponse__AbsolutePathBuf = Schema.String.annotate({ identifier: "V1InitializeResponse__AbsolutePathBuf", }); +export type V2AccountLoginCompletedNotification__DesktopOnboardingEntrypoint = "life_sciences"; +export const V2AccountLoginCompletedNotification__DesktopOnboardingEntrypoint = Schema.Literal( + "life_sciences", +).annotate({ identifier: "V2AccountLoginCompletedNotification__DesktopOnboardingEntrypoint" }); + export type V2AccountRateLimitsUpdatedNotification__CreditsSnapshot = { readonly balance?: string | null; readonly hasCredits: boolean; @@ -3755,7 +4224,8 @@ export type V2AccountUpdatedNotification__AuthMode = | "headers" | "agentIdentity" | "personalAccessToken" - | "bedrockApiKey"; + | "bedrockApiKey" + | "bedrockAccessKeys"; export const V2AccountUpdatedNotification__AuthMode = Schema.Union( [ Schema.Literal("apikey").annotate({ @@ -3780,6 +4250,9 @@ export const V2AccountUpdatedNotification__AuthMode = Schema.Union( Schema.Literal("bedrockApiKey").annotate({ description: "Amazon Bedrock bearer token managed by Codex.", }), + Schema.Literal("bedrockAccessKeys").annotate({ + description: "Amazon Bedrock AWS access keys managed by Codex.", + }), ], { mode: "oneOf" }, ).annotate({ @@ -3929,11 +4402,17 @@ export const V2AppsListResponse__AppBranding = Schema.Struct({ export type V2AppsReadResponse__AppToolSummary = { readonly description: string; + readonly disabledReason?: string | null; + readonly isEnabled?: boolean; + readonly isReadOnly?: boolean; readonly name: string; readonly title?: string | null; }; export const V2AppsReadResponse__AppToolSummary = Schema.Struct({ description: Schema.String, + disabledReason: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + isEnabled: Schema.optionalKey(Schema.Boolean.annotate({ default: true })), + isReadOnly: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), name: Schema.String, title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ @@ -4080,6 +4559,12 @@ export const V2ConfigReadResponse__ApprovalsReviewer = Schema.Literals([ identifier: "V2ConfigReadResponse__ApprovalsReviewer", }); +export type V2ConfigReadResponse__AllowDenyRequirement = "allow" | "deny"; +export const V2ConfigReadResponse__AllowDenyRequirement = Schema.Literals([ + "allow", + "deny", +]).annotate({ identifier: "V2ConfigReadResponse__AllowDenyRequirement" }); + export type V2ConfigReadResponse__ForcedChatgptWorkspaceIds = string | ReadonlyArray; export const V2ConfigReadResponse__ForcedChatgptWorkspaceIds = Schema.Union([ Schema.String, @@ -4207,6 +4692,34 @@ export const V2ConfigReadResponse__AppToolApproval = Schema.Literals([ "approve", ]).annotate({ identifier: "V2ConfigReadResponse__AppToolApproval" }); +export type V2ConfigReadResponse__AppLinksConfig = { readonly [x: string]: Schema.Json }; +export const V2ConfigReadResponse__AppLinksConfig = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ + description: "Account settings for a single app.", + identifier: "V2ConfigReadResponse__AppLinksConfig", +}); + +export type V2ConfigReadResponse__ToolExposureSurface = "code_mode" | "deferred" | "direct"; +export const V2ConfigReadResponse__ToolExposureSurface = Schema.Union( + [ + Schema.Literal("code_mode").annotate({ + description: "Nested tools available to Code Mode scripts.", + }), + Schema.Literal("deferred").annotate({ + description: "Tools discovered later through tool search.", + }), + Schema.Literal("direct").annotate({ + description: "Tools present in the model's initial tool list.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: "A model-facing surface on which a tool can be exposed.", + identifier: "V2ConfigReadResponse__ToolExposureSurface", +}); + export type V2ConfigReadResponse__AppToolsConfig = { readonly [x: string]: Schema.Json }; export const V2ConfigReadResponse__AppToolsConfig = Schema.Record( Schema.String, @@ -4242,6 +4755,12 @@ export const V2ConfigRequirementsReadResponse__AskForApproval = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ConfigRequirementsReadResponse__AskForApproval" }); +export type V2ConfigRequirementsReadResponse__ForcedLoginMethod = "chatgpt" | "api"; +export const V2ConfigRequirementsReadResponse__ForcedLoginMethod = Schema.Literals([ + "chatgpt", + "api", +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__ForcedLoginMethod" }); + export type V2ConfigRequirementsReadResponse__SandboxMode = | "read-only" | "workspace-write" @@ -4264,24 +4783,70 @@ export const V2ConfigRequirementsReadResponse__WebSearchMode = Schema.Literals([ "live", ]).annotate({ identifier: "V2ConfigRequirementsReadResponse__WebSearchMode" }); -export type V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode = "elevated" | "unelevated"; -export const V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode = Schema.Literals([ +export type V2ConfigRequirementsReadResponse__WindowsSandboxImplementation = + | "elevated" + | "unelevated" + | "mxc"; +export const V2ConfigRequirementsReadResponse__WindowsSandboxImplementation = Schema.Literals([ "elevated", "unelevated", -]).annotate({ identifier: "V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode" }); + "mxc", +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__WindowsSandboxImplementation" }); -export type V2ConfigRequirementsReadResponse__ComputerUseRequirements = { - readonly allowLockedComputerUse?: boolean | null; +export type V2ConfigRequirementsReadResponse__AutoReviewRequirements = { + readonly ignoreRules?: ReadonlyArray | null; + readonly requiredOnModels?: ReadonlyArray | null; }; -export const V2ConfigRequirementsReadResponse__ComputerUseRequirements = Schema.Struct({ - allowLockedComputerUse: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), -}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ComputerUseRequirements" }); +export const V2ConfigRequirementsReadResponse__AutoReviewRequirements = Schema.Struct({ + ignoreRules: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + requiredOnModels: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__AutoReviewRequirements" }); + +export type V2ConfigRequirementsReadResponse__AllowDenyRequirement = "allow" | "deny"; +export const V2ConfigRequirementsReadResponse__AllowDenyRequirement = Schema.Literals([ + "allow", + "deny", +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__AllowDenyRequirement" }); + +export type V2ConfigRequirementsReadResponse__BrowserUseAccessApprovalLifetime = "turn" | "thread"; +export const V2ConfigRequirementsReadResponse__BrowserUseAccessApprovalLifetime = Schema.Literals([ + "turn", + "thread", +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__BrowserUseAccessApprovalLifetime" }); + +export type V2ConfigRequirementsReadResponse__CliAuthCredentialsStoreMode = + | "file" + | "keyring" + | "auto" + | "ephemeral"; +export const V2ConfigRequirementsReadResponse__CliAuthCredentialsStoreMode = Schema.Literals([ + "file", + "keyring", + "auto", + "ephemeral", +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__CliAuthCredentialsStoreMode" }); export type V2ConfigRequirementsReadResponse__ResidencyRequirement = "us"; export const V2ConfigRequirementsReadResponse__ResidencyRequirement = Schema.Literal("us").annotate( { identifier: "V2ConfigRequirementsReadResponse__ResidencyRequirement" }, ); +export type V2ConfigRequirementsReadResponse__FeedbackRequirements = { + readonly enabled?: boolean | null; +}; +export const V2ConfigRequirementsReadResponse__FeedbackRequirements = Schema.Struct({ + enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__FeedbackRequirements" }); + +export type V2ConfigRequirementsReadResponse__InAppBrowserRequirements = { + readonly allowExternalBrowserSettingsImport?: boolean | null; +}; +export const V2ConfigRequirementsReadResponse__InAppBrowserRequirements = Schema.Struct({ + allowExternalBrowserSettingsImport: Schema.optionalKey( + Schema.Union([Schema.Boolean, Schema.Null]), + ), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__InAppBrowserRequirements" }); + export type V2ConfigRequirementsReadResponse__ReasoningEffort = string; export const V2ConfigRequirementsReadResponse__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", @@ -4292,8 +4857,15 @@ export const V2ConfigRequirementsReadResponse__ReasoningEffort = Schema.String.a }), ); +export type V2ConfigRequirementsReadResponse__NetworkDomainPermission = "allow" | "deny"; +export const V2ConfigRequirementsReadResponse__NetworkDomainPermission = Schema.Literals([ + "allow", + "deny", +]).annotate({ identifier: "V2ConfigRequirementsReadResponse__NetworkDomainPermission" }); + export type V2ConfigRequirementsReadResponse__ConfiguredHookHandler = | { + readonly additionalContextLimit?: number | null; readonly async: boolean; readonly command: string; readonly commandWindows?: string | null; @@ -4301,11 +4873,35 @@ export type V2ConfigRequirementsReadResponse__ConfiguredHookHandler = readonly timeoutSec?: number | null; readonly type: "command"; } + | { + readonly input: { readonly [x: string]: Schema.Json }; + readonly server: string; + readonly statusMessage?: string | null; + readonly timeoutSec?: number | null; + readonly tool: string; + readonly type: "mcp_tool"; + } | { readonly type: "prompt" } | { readonly type: "agent" }; export const V2ConfigRequirementsReadResponse__ConfiguredHookHandler = Schema.Union( [ Schema.Struct({ + additionalContextLimit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Approximate token threshold for spilling this hook's `additionalContext` to disk. `null` uses 2,500 tokens; `0` disables spilling for this hook. The threshold is evaluated against the original context; a spilled preview also includes recovery metadata.", + format: "uint", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), async: Schema.Boolean, command: Schema.String, commandWindows: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -4324,6 +4920,25 @@ export const V2ConfigRequirementsReadResponse__ConfiguredHookHandler = Schema.Un ), type: Schema.Literal("command").annotate({ title: "CommandConfiguredHookHandlerType" }), }).annotate({ title: "CommandConfiguredHookHandler" }), + Schema.Struct({ + input: Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), + server: Schema.String, + statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + timeoutSec: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + tool: Schema.String, + type: Schema.Literal("mcp_tool").annotate({ title: "McpToolConfiguredHookHandlerType" }), + }).annotate({ title: "McpToolConfiguredHookHandler" }), Schema.Struct({ type: Schema.Literal("prompt").annotate({ title: "PromptConfiguredHookHandlerType" }), }).annotate({ title: "PromptConfiguredHookHandler" }), @@ -4334,12 +4949,6 @@ export const V2ConfigRequirementsReadResponse__ConfiguredHookHandler = Schema.Un { mode: "oneOf" }, ).annotate({ identifier: "V2ConfigRequirementsReadResponse__ConfiguredHookHandler" }); -export type V2ConfigRequirementsReadResponse__NetworkDomainPermission = "allow" | "deny"; -export const V2ConfigRequirementsReadResponse__NetworkDomainPermission = Schema.Literals([ - "allow", - "deny", -]).annotate({ identifier: "V2ConfigRequirementsReadResponse__NetworkDomainPermission" }); - export type V2ConfigRequirementsReadResponse__NetworkUnixSocketPermission = "allow" | "deny"; export const V2ConfigRequirementsReadResponse__NetworkUnixSocketPermission = Schema.Literals([ "allow", @@ -4417,6 +5026,11 @@ export const V2ErrorNotification__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "V2ErrorNotification__NonSteerableTurnKind" }); +export type V2ErrorNotification__MisalignmentSteer = { readonly message: string }; +export const V2ErrorNotification__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ErrorNotification__MisalignmentSteer" }); + export type V2ExperimentalFeatureListResponse__ExperimentalFeatureStage = | "beta" | "underDevelopment" @@ -4442,6 +5056,14 @@ export const V2ExperimentalFeatureListResponse__ExperimentalFeatureStage = Schem { mode: "oneOf" }, ).annotate({ identifier: "V2ExperimentalFeatureListResponse__ExperimentalFeatureStage" }); +export type V2ExternalAgentConfigDetectResponse__ExternalAgentDetectedConnectorSource = + | "remoteMcpServersConfig" + | "sessionToolUse"; +export const V2ExternalAgentConfigDetectResponse__ExternalAgentDetectedConnectorSource = + Schema.Literals(["remoteMcpServersConfig", "sessionToolUse"]).annotate({ + identifier: "V2ExternalAgentConfigDetectResponse__ExternalAgentDetectedConnectorSource", + }); + export type V2ExternalAgentConfigDetectResponse__CommandMigration = { readonly name: string }; export const V2ExternalAgentConfigDetectResponse__CommandMigration = Schema.Struct({ name: Schema.String, @@ -4578,6 +5200,34 @@ export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConf "V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType", }); +export type V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigMigrationItemType = + | "AGENTS_MD" + | "CONFIG" + | "SKILLS" + | "PLUGINS" + | "MCP_SERVER_CONFIG" + | "SUBAGENTS" + | "HOOKS" + | "COMMANDS" + | "MEMORY" + | "SESSIONS"; +export const V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigMigrationItemType = + Schema.Literals([ + "AGENTS_MD", + "CONFIG", + "SKILLS", + "PLUGINS", + "MCP_SERVER_CONFIG", + "SUBAGENTS", + "HOOKS", + "COMMANDS", + "MEMORY", + "SESSIONS", + ]).annotate({ + identifier: + "V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigMigrationItemType", + }); + export type V2ExternalAgentConfigImportParams__CommandMigration = { readonly name: string }; export const V2ExternalAgentConfigImportParams__CommandMigration = Schema.Struct({ name: Schema.String, @@ -4951,6 +5601,16 @@ export const V2GetAccountResponse__PlanType = Schema.Literals([ "unknown", ]).annotate({ identifier: "V2GetAccountResponse__PlanType" }); +export type V2GetAccountResponse__AccountRoutingOverride = "NO_CONSTRAINT" | "us" | "us_cr"; +export const V2GetAccountResponse__AccountRoutingOverride = Schema.Literals([ + "NO_CONSTRAINT", + "us", + "us_cr", +]).annotate({ + description: "Backend routing policy. Wire values match the accounts/check contract.", + identifier: "V2GetAccountResponse__AccountRoutingOverride", +}); + export type V2GetAccountTokenUsageResponse__AccountTokenUsageDailyBucket = { readonly startDate: string; readonly tokens: number; @@ -5012,6 +5672,66 @@ export const V2GetAccountTokenUsageResponse__AccountTokenUsageSummary = Schema.S ), }).annotate({ identifier: "V2GetAccountTokenUsageResponse__AccountTokenUsageSummary" }); +export type V2GetAccountTokenUsageResponse__ThreadUsageBreakdownGroup = { + readonly cachedInputTokens?: number | null; + readonly estimatedUsageCreditsMicros: number; + readonly inputTokens?: number | null; + readonly model?: string | null; + readonly netNewInputTokens?: number | null; + readonly outputTokens?: number | null; + readonly reasoningEffort?: string | null; + readonly speed?: string | null; + readonly totalTokens?: number | null; +}; +export const V2GetAccountTokenUsageResponse__ThreadUsageBreakdownGroup = Schema.Struct({ + cachedInputTokens: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + estimatedUsageCreditsMicros: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + inputTokens: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + netNewInputTokens: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + outputTokens: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + reasoningEffort: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + speed: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + totalTokens: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2GetAccountTokenUsageResponse__ThreadUsageBreakdownGroup" }); + export type V2GetWorkspaceMessagesResponse__WorkspaceMessageType = | "headline" | "announcement" @@ -5047,7 +5767,8 @@ export type V2HookCompletedNotification__HookEventName = | "userPromptSubmit" | "subagentStart" | "subagentStop" - | "stop"; + | "stop" + | "interrupt"; export const V2HookCompletedNotification__HookEventName = Schema.Literals([ "preToolUse", "permissionRequest", @@ -5060,6 +5781,7 @@ export const V2HookCompletedNotification__HookEventName = Schema.Literals([ "subagentStart", "subagentStop", "stop", + "interrupt", ]).annotate({ identifier: "V2HookCompletedNotification__HookEventName" }); export type V2HookCompletedNotification__HookExecutionMode = "sync" | "async"; @@ -5068,9 +5790,14 @@ export const V2HookCompletedNotification__HookExecutionMode = Schema.Literals([ "async", ]).annotate({ identifier: "V2HookCompletedNotification__HookExecutionMode" }); -export type V2HookCompletedNotification__HookHandlerType = "command" | "prompt" | "agent"; +export type V2HookCompletedNotification__HookHandlerType = + | "command" + | "mcpTool" + | "prompt" + | "agent"; export const V2HookCompletedNotification__HookHandlerType = Schema.Literals([ "command", + "mcpTool", "prompt", "agent", ]).annotate({ identifier: "V2HookCompletedNotification__HookHandlerType" }); @@ -5147,7 +5874,8 @@ export type V2HooksListResponse__HookEventName = | "userPromptSubmit" | "subagentStart" | "subagentStop" - | "stop"; + | "stop" + | "interrupt"; export const V2HooksListResponse__HookEventName = Schema.Literals([ "preToolUse", "permissionRequest", @@ -5160,15 +5888,9 @@ export const V2HooksListResponse__HookEventName = Schema.Literals([ "subagentStart", "subagentStop", "stop", + "interrupt", ]).annotate({ identifier: "V2HooksListResponse__HookEventName" }); -export type V2HooksListResponse__HookHandlerType = "command" | "prompt" | "agent"; -export const V2HooksListResponse__HookHandlerType = Schema.Literals([ - "command", - "prompt", - "agent", -]).annotate({ identifier: "V2HooksListResponse__HookHandlerType" }); - export type V2HooksListResponse__HookSource = | "system" | "user" @@ -5235,7 +5957,8 @@ export type V2HookStartedNotification__HookEventName = | "userPromptSubmit" | "subagentStart" | "subagentStop" - | "stop"; + | "stop" + | "interrupt"; export const V2HookStartedNotification__HookEventName = Schema.Literals([ "preToolUse", "permissionRequest", @@ -5248,6 +5971,7 @@ export const V2HookStartedNotification__HookEventName = Schema.Literals([ "subagentStart", "subagentStop", "stop", + "interrupt", ]).annotate({ identifier: "V2HookStartedNotification__HookEventName" }); export type V2HookStartedNotification__HookExecutionMode = "sync" | "async"; @@ -5256,9 +5980,10 @@ export const V2HookStartedNotification__HookExecutionMode = Schema.Literals([ "async", ]).annotate({ identifier: "V2HookStartedNotification__HookExecutionMode" }); -export type V2HookStartedNotification__HookHandlerType = "command" | "prompt" | "agent"; +export type V2HookStartedNotification__HookHandlerType = "command" | "mcpTool" | "prompt" | "agent"; export const V2HookStartedNotification__HookHandlerType = Schema.Literals([ "command", + "mcpTool", "prompt", "agent", ]).annotate({ identifier: "V2HookStartedNotification__HookHandlerType" }); @@ -5349,6 +6074,11 @@ export const V2ItemCompletedNotification__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2ItemCompletedNotification__HookPromptFragment" }); +export type V2ItemCompletedNotification__AgentMessageDelivery = "async"; +export const V2ItemCompletedNotification__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ItemCompletedNotification__AgentMessageDelivery", +}); + export type V2ItemCompletedNotification__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -5388,12 +6118,14 @@ export const V2ItemCompletedNotification__MessagePhase = Schema.Union( identifier: "V2ItemCompletedNotification__MessagePhase", }); -export type V2ItemCompletedNotification__AbsolutePathBuf = string; -export const V2ItemCompletedNotification__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2ItemCompletedNotification__AbsolutePathBuf", -}); +export type V2ItemCompletedNotification__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ItemCompletedNotification__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ItemCompletedNotification__AsyncUserInputQuestion" }); export type V2ItemCompletedNotification__LegacyAppPathString = string; export const V2ItemCompletedNotification__LegacyAppPathString = Schema.String.annotate({ @@ -5476,6 +6208,12 @@ export const V2ItemCompletedNotification__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ItemCompletedNotification__McpToolCallError" }); +export type V2ItemCompletedNotification__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ItemCompletedNotification__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ItemCompletedNotification__McpAppDisplayMode" }); + export type V2ItemCompletedNotification__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -5638,12 +6376,42 @@ export const V2ItemCompletedNotification__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ItemCompletedNotification__WebSearchAction" }); -export type V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf = string; -export const V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf = +export type V2ItemCompletedNotification__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ItemCompletedNotification__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ItemCompletedNotification__ImageGenerationFailure" }); + +export type V2ItemCompletedNotification__AbsolutePathBuf = string; +export const V2ItemCompletedNotification__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ItemCompletedNotification__AbsolutePathBuf", +}); + +export type V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString = string; +export const V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf", + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString", }); export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandSource = @@ -5654,6 +6422,14 @@ export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandS identifier: "V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandSource", }); +export type V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf = string; +export const V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf = + Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf", + }); + export type V2ItemGuardianApprovalReviewCompletedNotification__NetworkApprovalProtocol = | "http" | "https" @@ -5673,12 +6449,6 @@ export const V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccess identifier: "V2ItemGuardianApprovalReviewCompletedNotification__FileSystemAccessMode", }); -export type V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString = string; -export const V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString = - Schema.String.annotate({ - identifier: "V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString", - }); - export type V2ItemGuardianApprovalReviewCompletedNotification__AdditionalNetworkPermissions = { readonly enabled?: boolean | null; }; @@ -5731,12 +6501,10 @@ export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAuth identifier: "V2ItemGuardianApprovalReviewCompletedNotification__GuardianUserAuthorization", }); -export type V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf = string; -export const V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf = +export type V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString = string; +export const V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf", + identifier: "V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString", }); export type V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSource = @@ -5747,6 +6515,14 @@ export const V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSou identifier: "V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSource", }); +export type V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf = string; +export const V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf = + Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf", + }); + export type V2ItemGuardianApprovalReviewStartedNotification__NetworkApprovalProtocol = | "http" | "https" @@ -5766,12 +6542,6 @@ export const V2ItemGuardianApprovalReviewStartedNotification__FileSystemAccessMo identifier: "V2ItemGuardianApprovalReviewStartedNotification__FileSystemAccessMode", }); -export type V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString = string; -export const V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString = - Schema.String.annotate({ - identifier: "V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString", - }); - export type V2ItemGuardianApprovalReviewStartedNotification__AdditionalNetworkPermissions = { readonly enabled?: boolean | null; }; @@ -5851,6 +6621,11 @@ export const V2ItemStartedNotification__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2ItemStartedNotification__HookPromptFragment" }); +export type V2ItemStartedNotification__AgentMessageDelivery = "async"; +export const V2ItemStartedNotification__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ItemStartedNotification__AgentMessageDelivery", +}); + export type V2ItemStartedNotification__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -5890,12 +6665,14 @@ export const V2ItemStartedNotification__MessagePhase = Schema.Union( identifier: "V2ItemStartedNotification__MessagePhase", }); -export type V2ItemStartedNotification__AbsolutePathBuf = string; -export const V2ItemStartedNotification__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2ItemStartedNotification__AbsolutePathBuf", -}); +export type V2ItemStartedNotification__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ItemStartedNotification__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ItemStartedNotification__AsyncUserInputQuestion" }); export type V2ItemStartedNotification__LegacyAppPathString = string; export const V2ItemStartedNotification__LegacyAppPathString = Schema.String.annotate({ @@ -5978,6 +6755,12 @@ export const V2ItemStartedNotification__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ItemStartedNotification__McpToolCallError" }); +export type V2ItemStartedNotification__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ItemStartedNotification__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ItemStartedNotification__McpAppDisplayMode" }); + export type V2ItemStartedNotification__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -6140,6 +6923,38 @@ export const V2ItemStartedNotification__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ItemStartedNotification__WebSearchAction" }); +export type V2ItemStartedNotification__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ItemStartedNotification__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ItemStartedNotification__ImageGenerationFailure" }); + +export type V2ItemStartedNotification__AbsolutePathBuf = string; +export const V2ItemStartedNotification__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ItemStartedNotification__AbsolutePathBuf", +}); + export type V2ListMcpServerStatusParams__McpServerStatusDetail = "full" | "toolsAndAuthOnly"; export const V2ListMcpServerStatusParams__McpServerStatusDetail = Schema.Literals([ "full", @@ -6147,11 +6962,13 @@ export const V2ListMcpServerStatusParams__McpServerStatusDetail = Schema.Literal ]).annotate({ identifier: "V2ListMcpServerStatusParams__McpServerStatusDetail" }); export type V2ListMcpServerStatusResponse__McpAuthStatus = + | "unknown" | "unsupported" | "notLoggedIn" | "bearerToken" | "oAuth"; export const V2ListMcpServerStatusResponse__McpAuthStatus = Schema.Literals([ + "unknown", "unsupported", "notLoggedIn", "bearerToken", @@ -6213,6 +7030,24 @@ export const V2ListMcpServerStatusResponse__Resource = Schema.Struct({ identifier: "V2ListMcpServerStatusResponse__Resource", }); +export type V2ListMcpServerStatusResponse__McpServerConnectionStatus = + | "notStarted" + | "starting" + | "connected" + | "authenticationRequired" + | "failed" + | "cancelled" + | "disabled"; +export const V2ListMcpServerStatusResponse__McpServerConnectionStatus = Schema.Literals([ + "notStarted", + "starting", + "connected", + "authenticationRequired", + "failed", + "cancelled", + "disabled", +]).annotate({ identifier: "V2ListMcpServerStatusResponse__McpServerConnectionStatus" }); + export type V2ListMcpServerStatusResponse__McpServerInfo = { readonly description?: string | null; readonly icons?: ReadonlyArray | null; @@ -6327,6 +7162,22 @@ export const V2McpResourceReadResponse__ResourceContent = Schema.Union([ identifier: "V2McpResourceReadResponse__ResourceContent", }); +export type V2McpServerEventStreamNotification__McpServerEventNotification = { + readonly method: string; + readonly params: Schema.Json; +}; +export const V2McpServerEventStreamNotification__McpServerEventNotification = Schema.Struct({ + method: Schema.String, + params: Schema.Json.annotate({ expected: "JSON value" }), +}).annotate({ identifier: "V2McpServerEventStreamNotification__McpServerEventNotification" }); + +export type V2McpServerOauthLoginParams__McpServerOauthClientRegistration = "auto" | "cimd" | "dcr"; +export const V2McpServerOauthLoginParams__McpServerOauthClientRegistration = Schema.Literals([ + "auto", + "cimd", + "dcr", +]).annotate({ identifier: "V2McpServerOauthLoginParams__McpServerOauthClientRegistration" }); + export type V2McpServerStatusUpdatedNotification__McpServerStartupFailureReason = "reauthenticationRequired"; export const V2McpServerStatusUpdatedNotification__McpServerStartupFailureReason = Schema.Literal( @@ -6350,6 +7201,17 @@ export const V2ModelListResponse__ModelAvailabilityNux = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ModelListResponse__ModelAvailabilityNux" }); +export type V2ModelListResponse__CyberAccessProgram = "standard" | "daybreakBlue" | "daybreakRed"; +export const V2ModelListResponse__CyberAccessProgram = Schema.Literals([ + "standard", + "daybreakBlue", + "daybreakRed", +]).annotate({ + description: + "Requested cyber treatment for a ChatGPT-authenticated Codex turn. Authorization and model-tier restrictions remain server-owned.", + identifier: "V2ModelListResponse__CyberAccessProgram", +}); + export type V2ModelListResponse__ReasoningEffort = string; export const V2ModelListResponse__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", @@ -6373,6 +7235,16 @@ export const V2ModelListResponse__InputModality = Schema.Union( identifier: "V2ModelListResponse__InputModality", }); +export type V2ModelListResponse__MultiAgentVersion = "disabled" | "v1" | "v2"; +export const V2ModelListResponse__MultiAgentVersion = Schema.Literals([ + "disabled", + "v1", + "v2", +]).annotate({ + description: "Multi-agent runtime supported by a model.", + identifier: "V2ModelListResponse__MultiAgentVersion", +}); + export type V2ModelListResponse__ModelServiceTier = { readonly description: string; readonly id: string; @@ -6388,12 +7260,23 @@ export type V2ModelListResponse__ModelUpgradeInfo = { readonly migrationMarkdown?: string | null; readonly model: string; readonly modelLink?: string | null; + readonly retirementAt?: number | null; readonly upgradeCopy?: string | null; }; export const V2ModelListResponse__ModelUpgradeInfo = Schema.Struct({ migrationMarkdown: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), model: Schema.String, modelLink: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + retirementAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Informational Unix timestamp for this upgrade's scheduled retirement, if known.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), upgradeCopy: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2ModelListResponse__ModelUpgradeInfo" }); @@ -6407,6 +7290,44 @@ export const V2ModelVerificationNotification__ModelVerification = Schema.Literal "trustedAccessForCyber", ).annotate({ identifier: "V2ModelVerificationNotification__ModelVerification" }); +export type V2NullableGetAccountRateLimitsParams__GetAccountRateLimitsParams = { + readonly excludeResetCreditDetails?: boolean; + readonly supportsLunaReserve?: boolean; +}; +export const V2NullableGetAccountRateLimitsParams__GetAccountRateLimitsParams = Schema.Struct({ + excludeResetCreditDetails: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "Skip the separate reset-credit detail lookup for background usage polls. The usage response still includes the available count; omitted/false preserves detailed reads.", + }), + ), + supportsLunaReserve: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "The client supports automatic Luna Reserve fallback. For eligible ChatGPT CLI users, allow the backend to record experiment exposure after ordinary usage is blocked.", + }), + ), +}).annotate({ + description: + "Usage-read capabilities of the requesting client, never inferred from its experiment arm.", + identifier: "V2NullableGetAccountRateLimitsParams__GetAccountRateLimitsParams", +}); + +export type V2NullableGetAccountTokenUsageParams__GetAccountTokenUsageParams = { + readonly threadId?: string | null; +}; +export const V2NullableGetAccountTokenUsageParams__GetAccountTokenUsageParams = Schema.Struct({ + threadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "When present, read estimated usage for this thread instead of account-wide token activity.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2NullableGetAccountTokenUsageParams__GetAccountTokenUsageParams" }); + export type V2PermissionProfileListResponse__PermissionProfileSummary = { readonly allowed: boolean; readonly description?: string | null; @@ -6466,6 +7387,18 @@ export const V2PluginInstalledResponse__PluginAvailability = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2PluginInstalledResponse__PluginAvailability" }); +export type V2PluginInstalledResponse__PluginDisabledReason = + | "disabled_by_admin" + | "plan_not_eligible" + | "required_app_unavailable" + | "unknown"; +export const V2PluginInstalledResponse__PluginDisabledReason = Schema.Literals([ + "disabled_by_admin", + "plan_not_eligible", + "required_app_unavailable", + "unknown", +]).annotate({ identifier: "V2PluginInstalledResponse__PluginDisabledReason" }); + export type V2PluginInstalledResponse__PluginInstallPolicy = | "NOT_AVAILABLE" | "AVAILABLE" @@ -6590,6 +7523,18 @@ export const V2PluginListResponse__PluginAvailability = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2PluginListResponse__PluginAvailability" }); +export type V2PluginListResponse__PluginDisabledReason = + | "disabled_by_admin" + | "plan_not_eligible" + | "required_app_unavailable" + | "unknown"; +export const V2PluginListResponse__PluginDisabledReason = Schema.Literals([ + "disabled_by_admin", + "plan_not_eligible", + "required_app_unavailable", + "unknown", +]).annotate({ identifier: "V2PluginListResponse__PluginDisabledReason" }); + export type V2PluginListResponse__PluginInstallPolicy = | "NOT_AVAILABLE" | "AVAILABLE" @@ -6673,7 +7618,8 @@ export type V2PluginReadResponse__HookEventName = | "userPromptSubmit" | "subagentStart" | "subagentStop" - | "stop"; + | "stop" + | "interrupt"; export const V2PluginReadResponse__HookEventName = Schema.Literals([ "preToolUse", "permissionRequest", @@ -6686,6 +7632,7 @@ export const V2PluginReadResponse__HookEventName = Schema.Literals([ "subagentStart", "subagentStop", "stop", + "interrupt", ]).annotate({ identifier: "V2PluginReadResponse__HookEventName" }); export type V2PluginReadResponse__AbsolutePathBuf = string; @@ -6731,6 +7678,18 @@ export const V2PluginReadResponse__PluginAvailability = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2PluginReadResponse__PluginAvailability" }); +export type V2PluginReadResponse__PluginDisabledReason = + | "disabled_by_admin" + | "plan_not_eligible" + | "required_app_unavailable" + | "unknown"; +export const V2PluginReadResponse__PluginDisabledReason = Schema.Literals([ + "disabled_by_admin", + "plan_not_eligible", + "required_app_unavailable", + "unknown", +]).annotate({ identifier: "V2PluginReadResponse__PluginDisabledReason" }); + export type V2PluginReadResponse__PluginInstallPolicy = | "NOT_AVAILABLE" | "AVAILABLE" @@ -6770,6 +7729,30 @@ export const V2PluginReadResponse__PluginSharePrincipalRole = Schema.Literals([ "owner", ]).annotate({ identifier: "V2PluginReadResponse__PluginSharePrincipalRole" }); +export type V2PluginReconcileResponse__PluginReconcileChangedPlugin = { + readonly hasApps: boolean; + readonly hasHooks: boolean; + readonly hasMcps: boolean; + readonly hasSkills: boolean; + readonly id: string; +}; +export const V2PluginReconcileResponse__PluginReconcileChangedPlugin = Schema.Struct({ + hasApps: Schema.Boolean, + hasHooks: Schema.Boolean, + hasMcps: Schema.Boolean, + hasSkills: Schema.Boolean.annotate({ + description: + "Whether either bundle declares skill roots; not a validated inventory of enabled skills.", + }), + id: Schema.String.annotate({ + description: "Local plugin ID (`name@marketplace`), matching `PluginSummary.id`.", + }), +}).annotate({ + description: + "Runtime categories affected by this change, not just capabilities currently present. Flags describe declarations before runtime policy filtering. Updates OR the old and new bundle flags; enablement changes and cached reinstalls use the cached bundle; removals retain the old bundle's flags.", + identifier: "V2PluginReconcileResponse__PluginReconcileChangedPlugin", +}); + export type V2PluginShareCheckoutResponse__AbsolutePathBuf = string; export const V2PluginShareCheckoutResponse__AbsolutePathBuf = Schema.String.annotate({ description: @@ -6802,6 +7785,18 @@ export const V2PluginShareListResponse__PluginAvailability = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2PluginShareListResponse__PluginAvailability" }); +export type V2PluginShareListResponse__PluginDisabledReason = + | "disabled_by_admin" + | "plan_not_eligible" + | "required_app_unavailable" + | "unknown"; +export const V2PluginShareListResponse__PluginDisabledReason = Schema.Literals([ + "disabled_by_admin", + "plan_not_eligible", + "required_app_unavailable", + "unknown", +]).annotate({ identifier: "V2PluginShareListResponse__PluginDisabledReason" }); + export type V2PluginShareListResponse__PluginInstallPolicy = | "NOT_AVAILABLE" | "AVAILABLE" @@ -6941,6 +7936,13 @@ export const V2ProcessOutputDeltaNotification__ProcessOutputStream = Schema.Unio identifier: "V2ProcessOutputDeltaNotification__ProcessOutputStream", }); +export type V2ProjectChangedNotification__ProjectChangeType = "created" | "updated" | "deleted"; +export const V2ProjectChangedNotification__ProjectChangeType = Schema.Literals([ + "created", + "updated", + "deleted", +]).annotate({ identifier: "V2ProjectChangedNotification__ProjectChangeType" }); + export type V2RawResponseCompletedNotification__TokenUsageBreakdown = { readonly cacheWriteInputTokens?: number; readonly cachedInputTokens: number; @@ -6972,6 +7974,18 @@ export const V2RawResponseCompletedNotification__TokenUsageBreakdown = Schema.St ), }).annotate({ identifier: "V2RawResponseCompletedNotification__TokenUsageBreakdown" }); +export type V2RawResponseCompletedNotification__ResponseUsageMetadata = { + readonly amount?: string | null; + readonly metadata?: Schema.Json; +}; +export const V2RawResponseCompletedNotification__ResponseUsageMetadata = Schema.Struct({ + amount: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + metadata: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ + description: "Usage metadata reported for one upstream response.", + identifier: "V2RawResponseCompletedNotification__ResponseUsageMetadata", +}); + export type V2RawResponseItemCompletedNotification__ImageDetail = | "auto" | "low" @@ -7155,6 +8169,16 @@ export const V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction { mode: "oneOf" }, ).annotate({ identifier: "V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction" }); +export type V2RawResponseItemCompletedNotification__ReasoningEffort = string; +export const V2RawResponseItemCompletedNotification__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2RawResponseItemCompletedNotification__ReasoningEffort", + }), +); + export type V2RemoteControlStatusChangedNotification__RemoteControlConnectionStatus = | "disabled" | "connecting" @@ -7224,6 +8248,11 @@ export const V2ReviewStartResponse__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "V2ReviewStartResponse__NonSteerableTurnKind" }); +export type V2ReviewStartResponse__MisalignmentSteer = { readonly message: string }; +export const V2ReviewStartResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ReviewStartResponse__MisalignmentSteer" }); + export type V2ReviewStartResponse__ByteRange = { readonly end: number; readonly start: number }; export const V2ReviewStartResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) @@ -7255,6 +8284,11 @@ export const V2ReviewStartResponse__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2ReviewStartResponse__HookPromptFragment" }); +export type V2ReviewStartResponse__AgentMessageDelivery = "async"; +export const V2ReviewStartResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ReviewStartResponse__AgentMessageDelivery", +}); + export type V2ReviewStartResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -7294,12 +8328,14 @@ export const V2ReviewStartResponse__MessagePhase = Schema.Union( identifier: "V2ReviewStartResponse__MessagePhase", }); -export type V2ReviewStartResponse__AbsolutePathBuf = string; -export const V2ReviewStartResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2ReviewStartResponse__AbsolutePathBuf", -}); +export type V2ReviewStartResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ReviewStartResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ReviewStartResponse__AsyncUserInputQuestion" }); export type V2ReviewStartResponse__LegacyAppPathString = string; export const V2ReviewStartResponse__LegacyAppPathString = Schema.String.annotate({ @@ -7382,6 +8418,12 @@ export const V2ReviewStartResponse__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ReviewStartResponse__McpToolCallError" }); +export type V2ReviewStartResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ReviewStartResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ReviewStartResponse__McpAppDisplayMode" }); + export type V2ReviewStartResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -7541,6 +8583,38 @@ export const V2ReviewStartResponse__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ReviewStartResponse__WebSearchAction" }); +export type V2ReviewStartResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ReviewStartResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ReviewStartResponse__ImageGenerationFailure" }); + +export type V2ReviewStartResponse__AbsolutePathBuf = string; +export const V2ReviewStartResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ReviewStartResponse__AbsolutePathBuf", +}); + export type V2ReviewStartResponse__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2ReviewStartResponse__TurnItemsView = Schema.Union( [ @@ -7647,6 +8721,66 @@ export const V2SkillsListResponse__SkillScope = Schema.Literals([ "admin", ]).annotate({ identifier: "V2SkillsListResponse__SkillScope" }); +export type V2ThreadAttachmentAddResponse__ThreadAttachment = { + readonly attachmentType: string; + readonly createdAt: number; + readonly id: string; + readonly identityKey: string; + readonly payload: Schema.Json; +}; +export const V2ThreadAttachmentAddResponse__ThreadAttachment = Schema.Struct({ + attachmentType: Schema.String, + createdAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + id: Schema.String, + identityKey: Schema.String, + payload: Schema.Json.annotate({ expected: "JSON value" }), +}).annotate({ + description: "An independently persisted attachment associated with a thread.", + identifier: "V2ThreadAttachmentAddResponse__ThreadAttachment", +}); + +export type V2ThreadAttachmentAddResponse__ThreadAttachmentAddOutcome = "created" | "existing"; +export const V2ThreadAttachmentAddResponse__ThreadAttachmentAddOutcome = Schema.Literals([ + "created", + "existing", +]).annotate({ + description: "Result of attempting to associate an attachment with a thread.", + identifier: "V2ThreadAttachmentAddResponse__ThreadAttachmentAddOutcome", +}); + +export type V2ThreadAttachmentListResponse__ThreadAttachment = { + readonly attachmentType: string; + readonly createdAt: number; + readonly id: string; + readonly identityKey: string; + readonly payload: Schema.Json; +}; +export const V2ThreadAttachmentListResponse__ThreadAttachment = Schema.Struct({ + attachmentType: Schema.String, + createdAt: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + id: Schema.String, + identityKey: Schema.String, + payload: Schema.Json.annotate({ expected: "JSON value" }), +}).annotate({ + description: "An independently persisted attachment associated with a thread.", + identifier: "V2ThreadAttachmentListResponse__ThreadAttachment", +}); + +export type V2ThreadAttachmentUpdatedNotification__ThreadAttachmentOperation = + | "created" + | "deleted"; +export const V2ThreadAttachmentUpdatedNotification__ThreadAttachmentOperation = Schema.Literals([ + "created", + "deleted", +]).annotate({ + description: "The persisted attachment change represented by a notification.", + identifier: "V2ThreadAttachmentUpdatedNotification__ThreadAttachmentOperation", +}); + export type V2ThreadForkParams__AskForApproval = | "untrusted" | "on-request" @@ -7781,6 +8915,24 @@ export const V2ThreadForkResponse__GitInfo = Schema.Struct({ sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2ThreadForkResponse__GitInfo" }); +export type V2ThreadForkResponse__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadForkResponse__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "V2ThreadForkResponse__ThreadHistoryMode" }); + +export type V2ThreadForkResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadForkResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadForkResponse__ThreadSectionAppearance", +}); + export type V2ThreadForkResponse__AgentPath = string; export const V2ThreadForkResponse__AgentPath = Schema.String.annotate({ identifier: "V2ThreadForkResponse__AgentPath", @@ -7808,6 +8960,11 @@ export const V2ThreadForkResponse__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "V2ThreadForkResponse__NonSteerableTurnKind" }); +export type V2ThreadForkResponse__MisalignmentSteer = { readonly message: string }; +export const V2ThreadForkResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadForkResponse__MisalignmentSteer" }); + export type V2ThreadForkResponse__ByteRange = { readonly end: number; readonly start: number }; export const V2ThreadForkResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) @@ -7839,6 +8996,11 @@ export const V2ThreadForkResponse__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2ThreadForkResponse__HookPromptFragment" }); +export type V2ThreadForkResponse__AgentMessageDelivery = "async"; +export const V2ThreadForkResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadForkResponse__AgentMessageDelivery", +}); + export type V2ThreadForkResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -7878,6 +9040,15 @@ export const V2ThreadForkResponse__MessagePhase = Schema.Union( identifier: "V2ThreadForkResponse__MessagePhase", }); +export type V2ThreadForkResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadForkResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadForkResponse__AsyncUserInputQuestion" }); + export type V2ThreadForkResponse__CommandExecutionSource = | "agent" | "userShell" @@ -7954,6 +9125,12 @@ export const V2ThreadForkResponse__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ThreadForkResponse__McpToolCallError" }); +export type V2ThreadForkResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadForkResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadForkResponse__McpAppDisplayMode" }); + export type V2ThreadForkResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -8103,6 +9280,31 @@ export const V2ThreadForkResponse__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadForkResponse__WebSearchAction" }); +export type V2ThreadForkResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadForkResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadForkResponse__ImageGenerationFailure" }); + export type V2ThreadForkResponse__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2ThreadForkResponse__TurnItemsView = Schema.Union( [ @@ -8196,6 +9398,376 @@ export const V2ThreadGoalUpdatedNotification__ThreadGoalStatus = Schema.Literals "complete", ]).annotate({ identifier: "V2ThreadGoalUpdatedNotification__ThreadGoalStatus" }); +export type V2ThreadItemsListParams__SortDirection = "asc" | "desc"; +export const V2ThreadItemsListParams__SortDirection = Schema.Literals(["asc", "desc"]).annotate({ + identifier: "V2ThreadItemsListParams__SortDirection", +}); + +export type V2ThreadItemsListResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadItemsListResponse__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2ThreadItemsListResponse__ByteRange" }); + +export type V2ThreadItemsListResponse__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2ThreadItemsListResponse__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2ThreadItemsListResponse__ImageDetail" }); + +export type V2ThreadItemsListResponse__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; +}; +export const V2ThreadItemsListResponse__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2ThreadItemsListResponse__HookPromptFragment" }); + +export type V2ThreadItemsListResponse__AgentMessageDelivery = "async"; +export const V2ThreadItemsListResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadItemsListResponse__AgentMessageDelivery", +}); + +export type V2ThreadItemsListResponse__MemoryCitationEntry = { + readonly lineEnd: number; + readonly lineStart: number; + readonly note: string; + readonly path: string; +}; +export const V2ThreadItemsListResponse__MemoryCitationEntry = Schema.Struct({ + lineEnd: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + lineStart: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + note: Schema.String, + path: Schema.String, +}).annotate({ identifier: "V2ThreadItemsListResponse__MemoryCitationEntry" }); + +export type V2ThreadItemsListResponse__MessagePhase = "commentary" | "final_answer"; +export const V2ThreadItemsListResponse__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2ThreadItemsListResponse__MessagePhase", +}); + +export type V2ThreadItemsListResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadItemsListResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadItemsListResponse__AsyncUserInputQuestion" }); + +export type V2ThreadItemsListResponse__LegacyAppPathString = string; +export const V2ThreadItemsListResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadItemsListResponse__LegacyAppPathString", +}); + +export type V2ThreadItemsListResponse__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2ThreadItemsListResponse__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2ThreadItemsListResponse__CommandExecutionSource" }); + +export type V2ThreadItemsListResponse__CommandExecutionStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadItemsListResponse__CommandExecutionStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "declined", +]).annotate({ identifier: "V2ThreadItemsListResponse__CommandExecutionStatus" }); + +export type V2ThreadItemsListResponse__PatchChangeKind = + | { readonly type: "add" } + | { readonly type: "delete" } + | { readonly move_path?: string | null; readonly type: "update" }; +export const V2ThreadItemsListResponse__PatchChangeKind = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), + }).annotate({ title: "AddPatchChangeKind" }), + Schema.Struct({ + type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), + }).annotate({ title: "DeletePatchChangeKind" }), + Schema.Struct({ + move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), + }).annotate({ title: "UpdatePatchChangeKind" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadItemsListResponse__PatchChangeKind" }); + +export type V2ThreadItemsListResponse__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2ThreadItemsListResponse__PatchApplyStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "declined", +]).annotate({ identifier: "V2ThreadItemsListResponse__PatchApplyStatus" }); + +export type V2ThreadItemsListResponse__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; +}; +export const V2ThreadItemsListResponse__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadItemsListResponse__McpToolCallAppContext" }); + +export type V2ThreadItemsListResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadItemsListResponse__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadItemsListResponse__McpToolCallError" }); + +export type V2ThreadItemsListResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadItemsListResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadItemsListResponse__McpAppDisplayMode" }); + +export type V2ThreadItemsListResponse__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2ThreadItemsListResponse__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2ThreadItemsListResponse__McpToolCallResult" }); + +export type V2ThreadItemsListResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadItemsListResponse__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadItemsListResponse__McpToolCallStatus" }); + +export type V2ThreadItemsListResponse__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2ThreadItemsListResponse__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadItemsListResponse__DynamicToolCallOutputContentItem" }); + +export type V2ThreadItemsListResponse__DynamicToolCallStatus = + | "inProgress" + | "completed" + | "failed"; +export const V2ThreadItemsListResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadItemsListResponse__DynamicToolCallStatus" }); + +export type V2ThreadItemsListResponse__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadItemsListResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadItemsListResponse__CollabAgentStatus" }); + +export type V2ThreadItemsListResponse__ReasoningEffort = string; +export const V2ThreadItemsListResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadItemsListResponse__ReasoningEffort", + }), +); + +export type V2ThreadItemsListResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2ThreadItemsListResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2ThreadItemsListResponse__CollabAgentToolCallStatus" }); + +export type V2ThreadItemsListResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadItemsListResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadItemsListResponse__CollabAgentTool" }); + +export type V2ThreadItemsListResponse__SubAgentActivityKind = + | "started" + | "interacted" + | "interrupted" + | "completed"; +export const V2ThreadItemsListResponse__SubAgentActivityKind = Schema.Literals([ + "started", + "interacted", + "interrupted", + "completed", +]).annotate({ identifier: "V2ThreadItemsListResponse__SubAgentActivityKind" }); + +export type V2ThreadItemsListResponse__WebSearchAction = + | { + readonly queries?: ReadonlyArray | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly type: "openPage"; readonly url?: string | null } + | { readonly pattern?: string | null; readonly type: "findInPage"; readonly url?: string | null } + | { readonly type: "other" }; +export const V2ThreadItemsListResponse__WebSearchAction = Schema.Union( + [ + Schema.Struct({ + queries: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchWebSearchActionType" }), + }).annotate({ title: "SearchWebSearchAction" }), + Schema.Struct({ + type: Schema.Literal("openPage").annotate({ title: "OpenPageWebSearchActionType" }), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "OpenPageWebSearchAction" }), + Schema.Struct({ + pattern: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("findInPage").annotate({ title: "FindInPageWebSearchActionType" }), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "FindInPageWebSearchAction" }), + Schema.Struct({ + type: Schema.Literal("other").annotate({ title: "OtherWebSearchActionType" }), + }).annotate({ title: "OtherWebSearchAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadItemsListResponse__WebSearchAction" }); + +export type V2ThreadItemsListResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadItemsListResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadItemsListResponse__ImageGenerationFailure" }); + +export type V2ThreadItemsListResponse__AbsolutePathBuf = string; +export const V2ThreadItemsListResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadItemsListResponse__AbsolutePathBuf", +}); + export type V2ThreadListParams__ThreadListCwdFilter = string | ReadonlyArray; export const V2ThreadListParams__ThreadListCwdFilter = Schema.Union([ Schema.String, @@ -8207,11 +9779,16 @@ export const V2ThreadListParams__SortDirection = Schema.Literals(["asc", "desc"] identifier: "V2ThreadListParams__SortDirection", }); -export type V2ThreadListParams__ThreadSortKey = "created_at" | "updated_at" | "recency_at"; +export type V2ThreadListParams__ThreadSortKey = + | "created_at" + | "updated_at" + | "recency_at" + | "section_position"; export const V2ThreadListParams__ThreadSortKey = Schema.Literals([ "created_at", "updated_at", "recency_at", + "section_position", ]).annotate({ identifier: "V2ThreadListParams__ThreadSortKey" }); export type V2ThreadListParams__ThreadSourceKind = @@ -8256,6 +9833,34 @@ export const V2ThreadListResponse__GitInfo = Schema.Struct({ sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2ThreadListResponse__GitInfo" }); +export type V2ThreadListResponse__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadListResponse__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "V2ThreadListResponse__ThreadHistoryMode" }); + +export type V2ThreadListResponse__ReasoningEffort = string; +export const V2ThreadListResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadListResponse__ReasoningEffort", + }), +); + +export type V2ThreadListResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadListResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadListResponse__ThreadSectionAppearance", +}); + export type V2ThreadListResponse__AgentPath = string; export const V2ThreadListResponse__AgentPath = Schema.String.annotate({ identifier: "V2ThreadListResponse__AgentPath", @@ -8283,6 +9888,11 @@ export const V2ThreadListResponse__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "V2ThreadListResponse__NonSteerableTurnKind" }); +export type V2ThreadListResponse__MisalignmentSteer = { readonly message: string }; +export const V2ThreadListResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadListResponse__MisalignmentSteer" }); + export type V2ThreadListResponse__ByteRange = { readonly end: number; readonly start: number }; export const V2ThreadListResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) @@ -8314,6 +9924,11 @@ export const V2ThreadListResponse__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2ThreadListResponse__HookPromptFragment" }); +export type V2ThreadListResponse__AgentMessageDelivery = "async"; +export const V2ThreadListResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadListResponse__AgentMessageDelivery", +}); + export type V2ThreadListResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -8353,6 +9968,15 @@ export const V2ThreadListResponse__MessagePhase = Schema.Union( identifier: "V2ThreadListResponse__MessagePhase", }); +export type V2ThreadListResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadListResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadListResponse__AsyncUserInputQuestion" }); + export type V2ThreadListResponse__LegacyAppPathString = string; export const V2ThreadListResponse__LegacyAppPathString = Schema.String.annotate({ identifier: "V2ThreadListResponse__LegacyAppPathString", @@ -8434,6 +10058,12 @@ export const V2ThreadListResponse__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ThreadListResponse__McpToolCallError" }); +export type V2ThreadListResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadListResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadListResponse__McpAppDisplayMode" }); + export type V2ThreadListResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -8505,16 +10135,6 @@ export const V2ThreadListResponse__CollabAgentStatus = Schema.Literals([ "notFound", ]).annotate({ identifier: "V2ThreadListResponse__CollabAgentStatus" }); -export type V2ThreadListResponse__ReasoningEffort = string; -export const V2ThreadListResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check( - Schema.isMinLength(1).annotate({ - expected: "a value with a length of at least 1", - identifier: "V2ThreadListResponse__ReasoningEffort", - }), -); - export type V2ThreadListResponse__CollabAgentToolCallStatus = | "inProgress" | "completed" @@ -8593,6 +10213,31 @@ export const V2ThreadListResponse__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadListResponse__WebSearchAction" }); +export type V2ThreadListResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadListResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadListResponse__ImageGenerationFailure" }); + export type V2ThreadListResponse__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2ThreadListResponse__TurnItemsView = Schema.Union( [ @@ -8675,6 +10320,34 @@ export const V2ThreadMetadataUpdateResponse__GitInfo = Schema.Struct({ sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2ThreadMetadataUpdateResponse__GitInfo" }); +export type V2ThreadMetadataUpdateResponse__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadMetadataUpdateResponse__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ThreadHistoryMode" }); + +export type V2ThreadMetadataUpdateResponse__ReasoningEffort = string; +export const V2ThreadMetadataUpdateResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadMetadataUpdateResponse__ReasoningEffort", + }), +); + +export type V2ThreadMetadataUpdateResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadMetadataUpdateResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadMetadataUpdateResponse__ThreadSectionAppearance", +}); + export type V2ThreadMetadataUpdateResponse__AgentPath = string; export const V2ThreadMetadataUpdateResponse__AgentPath = Schema.String.annotate({ identifier: "V2ThreadMetadataUpdateResponse__AgentPath", @@ -8704,6 +10377,11 @@ export const V2ThreadMetadataUpdateResponse__NonSteerableTurnKind = Schema.Liter "compact", ]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__NonSteerableTurnKind" }); +export type V2ThreadMetadataUpdateResponse__MisalignmentSteer = { readonly message: string }; +export const V2ThreadMetadataUpdateResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__MisalignmentSteer" }); + export type V2ThreadMetadataUpdateResponse__ByteRange = { readonly end: number; readonly start: number; @@ -8738,6 +10416,11 @@ export const V2ThreadMetadataUpdateResponse__HookPromptFragment = Schema.Struct( text: Schema.String, }).annotate({ identifier: "V2ThreadMetadataUpdateResponse__HookPromptFragment" }); +export type V2ThreadMetadataUpdateResponse__AgentMessageDelivery = "async"; +export const V2ThreadMetadataUpdateResponse__AgentMessageDelivery = Schema.Literal( + "async", +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__AgentMessageDelivery" }); + export type V2ThreadMetadataUpdateResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -8777,6 +10460,15 @@ export const V2ThreadMetadataUpdateResponse__MessagePhase = Schema.Union( identifier: "V2ThreadMetadataUpdateResponse__MessagePhase", }); +export type V2ThreadMetadataUpdateResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadMetadataUpdateResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__AsyncUserInputQuestion" }); + export type V2ThreadMetadataUpdateResponse__LegacyAppPathString = string; export const V2ThreadMetadataUpdateResponse__LegacyAppPathString = Schema.String.annotate({ identifier: "V2ThreadMetadataUpdateResponse__LegacyAppPathString", @@ -8858,6 +10550,12 @@ export const V2ThreadMetadataUpdateResponse__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ThreadMetadataUpdateResponse__McpToolCallError" }); +export type V2ThreadMetadataUpdateResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadMetadataUpdateResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__McpAppDisplayMode" }); + export type V2ThreadMetadataUpdateResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -8935,16 +10633,6 @@ export const V2ThreadMetadataUpdateResponse__CollabAgentStatus = Schema.Literals "notFound", ]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CollabAgentStatus" }); -export type V2ThreadMetadataUpdateResponse__ReasoningEffort = string; -export const V2ThreadMetadataUpdateResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check( - Schema.isMinLength(1).annotate({ - expected: "a value with a length of at least 1", - identifier: "V2ThreadMetadataUpdateResponse__ReasoningEffort", - }), -); - export type V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus = | "inProgress" | "completed" @@ -9023,6 +10711,31 @@ export const V2ThreadMetadataUpdateResponse__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadMetadataUpdateResponse__WebSearchAction" }); +export type V2ThreadMetadataUpdateResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadMetadataUpdateResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ImageGenerationFailure" }); + export type V2ThreadMetadataUpdateResponse__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2ThreadMetadataUpdateResponse__TurnItemsView = Schema.Union( [ @@ -9070,6 +10783,34 @@ export const V2ThreadReadResponse__GitInfo = Schema.Struct({ sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2ThreadReadResponse__GitInfo" }); +export type V2ThreadReadResponse__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadReadResponse__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "V2ThreadReadResponse__ThreadHistoryMode" }); + +export type V2ThreadReadResponse__ReasoningEffort = string; +export const V2ThreadReadResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadReadResponse__ReasoningEffort", + }), +); + +export type V2ThreadReadResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadReadResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadReadResponse__ThreadSectionAppearance", +}); + export type V2ThreadReadResponse__AgentPath = string; export const V2ThreadReadResponse__AgentPath = Schema.String.annotate({ identifier: "V2ThreadReadResponse__AgentPath", @@ -9097,6 +10838,11 @@ export const V2ThreadReadResponse__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "V2ThreadReadResponse__NonSteerableTurnKind" }); +export type V2ThreadReadResponse__MisalignmentSteer = { readonly message: string }; +export const V2ThreadReadResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadReadResponse__MisalignmentSteer" }); + export type V2ThreadReadResponse__ByteRange = { readonly end: number; readonly start: number }; export const V2ThreadReadResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) @@ -9128,6 +10874,11 @@ export const V2ThreadReadResponse__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2ThreadReadResponse__HookPromptFragment" }); +export type V2ThreadReadResponse__AgentMessageDelivery = "async"; +export const V2ThreadReadResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadReadResponse__AgentMessageDelivery", +}); + export type V2ThreadReadResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -9167,6 +10918,15 @@ export const V2ThreadReadResponse__MessagePhase = Schema.Union( identifier: "V2ThreadReadResponse__MessagePhase", }); +export type V2ThreadReadResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadReadResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadReadResponse__AsyncUserInputQuestion" }); + export type V2ThreadReadResponse__LegacyAppPathString = string; export const V2ThreadReadResponse__LegacyAppPathString = Schema.String.annotate({ identifier: "V2ThreadReadResponse__LegacyAppPathString", @@ -9248,6 +11008,12 @@ export const V2ThreadReadResponse__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ThreadReadResponse__McpToolCallError" }); +export type V2ThreadReadResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadReadResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadReadResponse__McpAppDisplayMode" }); + export type V2ThreadReadResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -9319,16 +11085,6 @@ export const V2ThreadReadResponse__CollabAgentStatus = Schema.Literals([ "notFound", ]).annotate({ identifier: "V2ThreadReadResponse__CollabAgentStatus" }); -export type V2ThreadReadResponse__ReasoningEffort = string; -export const V2ThreadReadResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check( - Schema.isMinLength(1).annotate({ - expected: "a value with a length of at least 1", - identifier: "V2ThreadReadResponse__ReasoningEffort", - }), -); - export type V2ThreadReadResponse__CollabAgentToolCallStatus = | "inProgress" | "completed" @@ -9407,6 +11163,31 @@ export const V2ThreadReadResponse__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadReadResponse__WebSearchAction" }); +export type V2ThreadReadResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadReadResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadReadResponse__ImageGenerationFailure" }); + export type V2ThreadReadResponse__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2ThreadReadResponse__TurnItemsView = Schema.Union( [ @@ -9436,6 +11217,110 @@ export const V2ThreadReadResponse__TurnStatus = Schema.Literals([ "inProgress", ]).annotate({ identifier: "V2ThreadReadResponse__TurnStatus" }); +export type V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeTranscriptRole = + | "user" + | "assistant"; +export const V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeTranscriptRole = + Schema.Literals(["user", "assistant"]).annotate({ + identifier: "V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeTranscriptRole", + }); + +export type V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeBemItemPresentation = + | { readonly type: "wholeItem" } + | { readonly type: "inlineMarkdown" } + | { readonly index: number; readonly type: "inlineVisualization" }; +export const V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeBemItemPresentation = + Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("wholeItem").annotate({ + title: "WholeItemThreadRealtimeBemItemPresentationType", + }), + }).annotate({ title: "WholeItemThreadRealtimeBemItemPresentation" }), + Schema.Struct({ + type: Schema.Literal("inlineMarkdown").annotate({ + title: "InlineMarkdownThreadRealtimeBemItemPresentationType", + }), + }).annotate({ title: "InlineMarkdownThreadRealtimeBemItemPresentation" }), + Schema.Struct({ + index: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + type: Schema.Literal("inlineVisualization").annotate({ + title: "InlineVisualizationThreadRealtimeBemItemPresentationType", + }), + }).annotate({ title: "InlineVisualizationThreadRealtimeBemItemPresentation" }), + ], + { mode: "oneOf" }, + ).annotate({ + description: "EXPERIMENTAL - how an existing agent item appears in a realtime conversation.", + identifier: "V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeBemItemPresentation", + }); + +export type V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeSessionOutcome = + | "ended" + | "failed"; +export const V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeSessionOutcome = + Schema.Literals(["ended", "failed"]).annotate({ + identifier: "V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeSessionOutcome", + }); + +export type V2ThreadRealtimeItemStartedNotification__ThreadRealtimeTranscriptRole = + | "user" + | "assistant"; +export const V2ThreadRealtimeItemStartedNotification__ThreadRealtimeTranscriptRole = + Schema.Literals(["user", "assistant"]).annotate({ + identifier: "V2ThreadRealtimeItemStartedNotification__ThreadRealtimeTranscriptRole", + }); + +export type V2ThreadRealtimeItemStartedNotification__ThreadRealtimeBemItemPresentation = + | { readonly type: "wholeItem" } + | { readonly type: "inlineMarkdown" } + | { readonly index: number; readonly type: "inlineVisualization" }; +export const V2ThreadRealtimeItemStartedNotification__ThreadRealtimeBemItemPresentation = + Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("wholeItem").annotate({ + title: "WholeItemThreadRealtimeBemItemPresentationType", + }), + }).annotate({ title: "WholeItemThreadRealtimeBemItemPresentation" }), + Schema.Struct({ + type: Schema.Literal("inlineMarkdown").annotate({ + title: "InlineMarkdownThreadRealtimeBemItemPresentationType", + }), + }).annotate({ title: "InlineMarkdownThreadRealtimeBemItemPresentation" }), + Schema.Struct({ + index: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + type: Schema.Literal("inlineVisualization").annotate({ + title: "InlineVisualizationThreadRealtimeBemItemPresentationType", + }), + }).annotate({ title: "InlineVisualizationThreadRealtimeBemItemPresentation" }), + ], + { mode: "oneOf" }, + ).annotate({ + description: "EXPERIMENTAL - how an existing agent item appears in a realtime conversation.", + identifier: "V2ThreadRealtimeItemStartedNotification__ThreadRealtimeBemItemPresentation", + }); + +export type V2ThreadRealtimeItemStartedNotification__ThreadRealtimeSessionOutcome = + | "ended" + | "failed"; +export const V2ThreadRealtimeItemStartedNotification__ThreadRealtimeSessionOutcome = + Schema.Literals(["ended", "failed"]).annotate({ + identifier: "V2ThreadRealtimeItemStartedNotification__ThreadRealtimeSessionOutcome", + }); + export type V2ThreadRealtimeOutputAudioDeltaNotification__ThreadRealtimeAudioChunk = { readonly data: string; readonly itemId?: string | null; @@ -9531,7 +11416,10 @@ export const V2ThreadResumeParams__Personality = Schema.Literals([ "none", "friendly", "pragmatic", -]).annotate({ identifier: "V2ThreadResumeParams__Personality" }); +]).annotate({ + description: "Deprecated: `friendly` and `pragmatic` no longer select a style.", + identifier: "V2ThreadResumeParams__Personality", +}); export type V2ThreadResumeParams__SandboxMode = | "read-only" @@ -9543,6 +11431,16 @@ export const V2ThreadResumeParams__SandboxMode = Schema.Literals([ "danger-full-access", ]).annotate({ identifier: "V2ThreadResumeParams__SandboxMode" }); +export type V2ThreadResumeParams__ReasoningEffort = string; +export const V2ThreadResumeParams__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadResumeParams__ReasoningEffort", + }), +); + export type V2ThreadResumeParams__ImageDetail = "auto" | "low" | "high" | "original"; export const V2ThreadResumeParams__ImageDetail = Schema.Literals([ "auto", @@ -9783,16 +11681,10 @@ export const V2ThreadResumeResponse__ApprovalsReviewer = Schema.Literals([ identifier: "V2ThreadResumeResponse__ApprovalsReviewer", }); -export type V2ThreadResumeResponse__AbsolutePathBuf = string; -export const V2ThreadResumeResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2ThreadResumeResponse__AbsolutePathBuf", -}); - -export type V2ThreadResumeResponse__LegacyAppPathString = string; -export const V2ThreadResumeResponse__LegacyAppPathString = Schema.String.annotate({ - identifier: "V2ThreadResumeResponse__LegacyAppPathString", +export type V2ThreadResumeResponse__ModeKind = "plan" | "default"; +export const V2ThreadResumeResponse__ModeKind = Schema.Literals(["plan", "default"]).annotate({ + description: "Initial collaboration mode to use when the TUI starts.", + identifier: "V2ThreadResumeResponse__ModeKind", }); export type V2ThreadResumeResponse__ReasoningEffort = string; @@ -9805,6 +11697,18 @@ export const V2ThreadResumeResponse__ReasoningEffort = Schema.String.annotate({ }), ); +export type V2ThreadResumeResponse__AbsolutePathBuf = string; +export const V2ThreadResumeResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadResumeResponse__AbsolutePathBuf", +}); + +export type V2ThreadResumeResponse__LegacyAppPathString = string; +export const V2ThreadResumeResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadResumeResponse__LegacyAppPathString", +}); + export type V2ThreadResumeResponse__NetworkAccess = "restricted" | "enabled"; export const V2ThreadResumeResponse__NetworkAccess = Schema.Literals([ "restricted", @@ -9822,6 +11726,24 @@ export const V2ThreadResumeResponse__GitInfo = Schema.Struct({ sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2ThreadResumeResponse__GitInfo" }); +export type V2ThreadResumeResponse__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadResumeResponse__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "V2ThreadResumeResponse__ThreadHistoryMode" }); + +export type V2ThreadResumeResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadResumeResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadResumeResponse__ThreadSectionAppearance", +}); + export type V2ThreadResumeResponse__AgentPath = string; export const V2ThreadResumeResponse__AgentPath = Schema.String.annotate({ identifier: "V2ThreadResumeResponse__AgentPath", @@ -9849,6 +11771,11 @@ export const V2ThreadResumeResponse__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "V2ThreadResumeResponse__NonSteerableTurnKind" }); +export type V2ThreadResumeResponse__MisalignmentSteer = { readonly message: string }; +export const V2ThreadResumeResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadResumeResponse__MisalignmentSteer" }); + export type V2ThreadResumeResponse__ByteRange = { readonly end: number; readonly start: number }; export const V2ThreadResumeResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) @@ -9880,6 +11807,11 @@ export const V2ThreadResumeResponse__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2ThreadResumeResponse__HookPromptFragment" }); +export type V2ThreadResumeResponse__AgentMessageDelivery = "async"; +export const V2ThreadResumeResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadResumeResponse__AgentMessageDelivery", +}); + export type V2ThreadResumeResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -9919,6 +11851,15 @@ export const V2ThreadResumeResponse__MessagePhase = Schema.Union( identifier: "V2ThreadResumeResponse__MessagePhase", }); +export type V2ThreadResumeResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadResumeResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadResumeResponse__AsyncUserInputQuestion" }); + export type V2ThreadResumeResponse__CommandExecutionSource = | "agent" | "userShell" @@ -9995,6 +11936,12 @@ export const V2ThreadResumeResponse__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ThreadResumeResponse__McpToolCallError" }); +export type V2ThreadResumeResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadResumeResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadResumeResponse__McpAppDisplayMode" }); + export type V2ThreadResumeResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -10144,6 +12091,31 @@ export const V2ThreadResumeResponse__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadResumeResponse__WebSearchAction" }); +export type V2ThreadResumeResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadResumeResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadResumeResponse__ImageGenerationFailure" }); + export type V2ThreadResumeResponse__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2ThreadResumeResponse__TurnItemsView = Schema.Union( [ @@ -10173,53 +12145,86 @@ export const V2ThreadResumeResponse__TurnStatus = Schema.Literals([ "inProgress", ]).annotate({ identifier: "V2ThreadResumeResponse__TurnStatus" }); -export type V2ThreadRollbackResponse__AbsolutePathBuf = string; -export const V2ThreadRollbackResponse__AbsolutePathBuf = Schema.String.annotate({ +export type V2ThreadRevertResponse__AbsolutePathBuf = string; +export const V2ThreadRevertResponse__AbsolutePathBuf = Schema.String.annotate({ description: "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2ThreadRollbackResponse__AbsolutePathBuf", + identifier: "V2ThreadRevertResponse__AbsolutePathBuf", }); -export type V2ThreadRollbackResponse__GitInfo = { +export type V2ThreadRevertResponse__GitInfo = { readonly branch?: string | null; readonly originUrl?: string | null; readonly sha?: string | null; }; -export const V2ThreadRollbackResponse__GitInfo = Schema.Struct({ +export const V2ThreadRevertResponse__GitInfo = Schema.Struct({ branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ identifier: "V2ThreadRollbackResponse__GitInfo" }); +}).annotate({ identifier: "V2ThreadRevertResponse__GitInfo" }); + +export type V2ThreadRevertResponse__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadRevertResponse__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "V2ThreadRevertResponse__ThreadHistoryMode" }); + +export type V2ThreadRevertResponse__ReasoningEffort = string; +export const V2ThreadRevertResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadRevertResponse__ReasoningEffort", + }), +); + +export type V2ThreadRevertResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadRevertResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadRevertResponse__ThreadSectionAppearance", +}); -export type V2ThreadRollbackResponse__AgentPath = string; -export const V2ThreadRollbackResponse__AgentPath = Schema.String.annotate({ - identifier: "V2ThreadRollbackResponse__AgentPath", +export type V2ThreadRevertResponse__AgentPath = string; +export const V2ThreadRevertResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadRevertResponse__AgentPath", }); -export type V2ThreadRollbackResponse__ThreadId = string; -export const V2ThreadRollbackResponse__ThreadId = Schema.String.annotate({ - identifier: "V2ThreadRollbackResponse__ThreadId", +export type V2ThreadRevertResponse__ThreadId = string; +export const V2ThreadRevertResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadRevertResponse__ThreadId", }); -export type V2ThreadRollbackResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; -export const V2ThreadRollbackResponse__ThreadActiveFlag = Schema.Literals([ +export type V2ThreadRevertResponse__ThreadActiveFlag = "waitingOnApproval" | "waitingOnUserInput"; +export const V2ThreadRevertResponse__ThreadActiveFlag = Schema.Literals([ "waitingOnApproval", "waitingOnUserInput", -]).annotate({ identifier: "V2ThreadRollbackResponse__ThreadActiveFlag" }); +]).annotate({ identifier: "V2ThreadRevertResponse__ThreadActiveFlag" }); -export type V2ThreadRollbackResponse__ThreadSource = string; -export const V2ThreadRollbackResponse__ThreadSource = Schema.String.annotate({ - identifier: "V2ThreadRollbackResponse__ThreadSource", +export type V2ThreadRevertResponse__ThreadSource = string; +export const V2ThreadRevertResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadRevertResponse__ThreadSource", }); -export type V2ThreadRollbackResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadRollbackResponse__NonSteerableTurnKind = Schema.Literals([ +export type V2ThreadRevertResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadRevertResponse__NonSteerableTurnKind = Schema.Literals([ "review", "compact", -]).annotate({ identifier: "V2ThreadRollbackResponse__NonSteerableTurnKind" }); +]).annotate({ identifier: "V2ThreadRevertResponse__NonSteerableTurnKind" }); -export type V2ThreadRollbackResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ThreadRollbackResponse__ByteRange = Schema.Struct({ +export type V2ThreadRevertResponse__MisalignmentSteer = { readonly message: string }; +export const V2ThreadRevertResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadRevertResponse__MisalignmentSteer" }); + +export type V2ThreadRevertResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadRevertResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) .check(Schema.isInt().annotate({ expected: "an integer" })) .check( @@ -10230,32 +12235,37 @@ export const V2ThreadRollbackResponse__ByteRange = Schema.Struct({ .check( Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), ), -}).annotate({ identifier: "V2ThreadRollbackResponse__ByteRange" }); +}).annotate({ identifier: "V2ThreadRevertResponse__ByteRange" }); -export type V2ThreadRollbackResponse__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2ThreadRollbackResponse__ImageDetail = Schema.Literals([ +export type V2ThreadRevertResponse__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2ThreadRevertResponse__ImageDetail = Schema.Literals([ "auto", "low", "high", "original", -]).annotate({ identifier: "V2ThreadRollbackResponse__ImageDetail" }); +]).annotate({ identifier: "V2ThreadRevertResponse__ImageDetail" }); -export type V2ThreadRollbackResponse__HookPromptFragment = { +export type V2ThreadRevertResponse__HookPromptFragment = { readonly hookRunId: string; readonly text: string; }; -export const V2ThreadRollbackResponse__HookPromptFragment = Schema.Struct({ +export const V2ThreadRevertResponse__HookPromptFragment = Schema.Struct({ hookRunId: Schema.String, text: Schema.String, -}).annotate({ identifier: "V2ThreadRollbackResponse__HookPromptFragment" }); +}).annotate({ identifier: "V2ThreadRevertResponse__HookPromptFragment" }); + +export type V2ThreadRevertResponse__AgentMessageDelivery = "async"; +export const V2ThreadRevertResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadRevertResponse__AgentMessageDelivery", +}); -export type V2ThreadRollbackResponse__MemoryCitationEntry = { +export type V2ThreadRevertResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; readonly note: string; readonly path: string; }; -export const V2ThreadRollbackResponse__MemoryCitationEntry = Schema.Struct({ +export const V2ThreadRevertResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) .check(Schema.isInt().annotate({ expected: "an integer" })) .check( @@ -10268,10 +12278,10 @@ export const V2ThreadRollbackResponse__MemoryCitationEntry = Schema.Struct({ ), note: Schema.String, path: Schema.String, -}).annotate({ identifier: "V2ThreadRollbackResponse__MemoryCitationEntry" }); +}).annotate({ identifier: "V2ThreadRevertResponse__MemoryCitationEntry" }); -export type V2ThreadRollbackResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadRollbackResponse__MessagePhase = Schema.Union( +export type V2ThreadRevertResponse__MessagePhase = "commentary" | "final_answer"; +export const V2ThreadRevertResponse__MessagePhase = Schema.Union( [ Schema.Literal("commentary").annotate({ description: @@ -10285,43 +12295,52 @@ export const V2ThreadRollbackResponse__MessagePhase = Schema.Union( ).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', - identifier: "V2ThreadRollbackResponse__MessagePhase", + identifier: "V2ThreadRevertResponse__MessagePhase", }); -export type V2ThreadRollbackResponse__LegacyAppPathString = string; -export const V2ThreadRollbackResponse__LegacyAppPathString = Schema.String.annotate({ - identifier: "V2ThreadRollbackResponse__LegacyAppPathString", +export type V2ThreadRevertResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadRevertResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadRevertResponse__AsyncUserInputQuestion" }); + +export type V2ThreadRevertResponse__LegacyAppPathString = string; +export const V2ThreadRevertResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadRevertResponse__LegacyAppPathString", }); -export type V2ThreadRollbackResponse__CommandExecutionSource = +export type V2ThreadRevertResponse__CommandExecutionSource = | "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; -export const V2ThreadRollbackResponse__CommandExecutionSource = Schema.Literals([ +export const V2ThreadRevertResponse__CommandExecutionSource = Schema.Literals([ "agent", "userShell", "unifiedExecStartup", "unifiedExecInteraction", -]).annotate({ identifier: "V2ThreadRollbackResponse__CommandExecutionSource" }); +]).annotate({ identifier: "V2ThreadRevertResponse__CommandExecutionSource" }); -export type V2ThreadRollbackResponse__CommandExecutionStatus = +export type V2ThreadRevertResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadRollbackResponse__CommandExecutionStatus = Schema.Literals([ +export const V2ThreadRevertResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]).annotate({ identifier: "V2ThreadRollbackResponse__CommandExecutionStatus" }); +]).annotate({ identifier: "V2ThreadRevertResponse__CommandExecutionStatus" }); -export type V2ThreadRollbackResponse__PatchChangeKind = +export type V2ThreadRevertResponse__PatchChangeKind = | { readonly type: "add" } | { readonly type: "delete" } | { readonly move_path?: string | null; readonly type: "update" }; -export const V2ThreadRollbackResponse__PatchChangeKind = Schema.Union( +export const V2ThreadRevertResponse__PatchChangeKind = Schema.Union( [ Schema.Struct({ type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), @@ -10335,63 +12354,69 @@ export const V2ThreadRollbackResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__PatchChangeKind" }); +).annotate({ identifier: "V2ThreadRevertResponse__PatchChangeKind" }); -export type V2ThreadRollbackResponse__PatchApplyStatus = +export type V2ThreadRevertResponse__PatchApplyStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadRollbackResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadRevertResponse__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]).annotate({ identifier: "V2ThreadRollbackResponse__PatchApplyStatus" }); +]).annotate({ identifier: "V2ThreadRevertResponse__PatchApplyStatus" }); -export type V2ThreadRollbackResponse__McpToolCallAppContext = { +export type V2ThreadRevertResponse__McpToolCallAppContext = { readonly actionName?: string | null; readonly appName?: string | null; readonly connectorId: string; readonly linkId?: string | null; readonly resourceUri?: string | null; }; -export const V2ThreadRollbackResponse__McpToolCallAppContext = Schema.Struct({ +export const V2ThreadRevertResponse__McpToolCallAppContext = Schema.Struct({ actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), connectorId: Schema.String, linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ identifier: "V2ThreadRollbackResponse__McpToolCallAppContext" }); +}).annotate({ identifier: "V2ThreadRevertResponse__McpToolCallAppContext" }); -export type V2ThreadRollbackResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadRollbackResponse__McpToolCallError = Schema.Struct({ +export type V2ThreadRevertResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadRevertResponse__McpToolCallError = Schema.Struct({ message: Schema.String, -}).annotate({ identifier: "V2ThreadRollbackResponse__McpToolCallError" }); +}).annotate({ identifier: "V2ThreadRevertResponse__McpToolCallError" }); -export type V2ThreadRollbackResponse__McpToolCallResult = { +export type V2ThreadRevertResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadRevertResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadRevertResponse__McpAppDisplayMode" }); + +export type V2ThreadRevertResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; readonly structuredContent?: Schema.Json; }; -export const V2ThreadRollbackResponse__McpToolCallResult = Schema.Struct({ +export const V2ThreadRevertResponse__McpToolCallResult = Schema.Struct({ _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), -}).annotate({ identifier: "V2ThreadRollbackResponse__McpToolCallResult" }); +}).annotate({ identifier: "V2ThreadRevertResponse__McpToolCallResult" }); -export type V2ThreadRollbackResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadRollbackResponse__McpToolCallStatus = Schema.Literals([ +export type V2ThreadRevertResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadRevertResponse__McpToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]).annotate({ identifier: "V2ThreadRollbackResponse__McpToolCallStatus" }); +]).annotate({ identifier: "V2ThreadRevertResponse__McpToolCallStatus" }); -export type V2ThreadRollbackResponse__DynamicToolCallOutputContentItem = +export type V2ThreadRevertResponse__DynamicToolCallOutputContentItem = | { readonly text: string; readonly type: "inputText" } | { readonly imageUrl: string; readonly type: "inputImage" } | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadRollbackResponse__DynamicToolCallOutputContentItem = Schema.Union( +export const V2ThreadRevertResponse__DynamicToolCallOutputContentItem = Schema.Union( [ Schema.Struct({ text: Schema.String, @@ -10413,16 +12438,16 @@ export const V2ThreadRollbackResponse__DynamicToolCallOutputContentItem = Schema }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__DynamicToolCallOutputContentItem" }); +).annotate({ identifier: "V2ThreadRevertResponse__DynamicToolCallOutputContentItem" }); -export type V2ThreadRollbackResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadRollbackResponse__DynamicToolCallStatus = Schema.Literals([ +export type V2ThreadRevertResponse__DynamicToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadRevertResponse__DynamicToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]).annotate({ identifier: "V2ThreadRollbackResponse__DynamicToolCallStatus" }); +]).annotate({ identifier: "V2ThreadRevertResponse__DynamicToolCallStatus" }); -export type V2ThreadRollbackResponse__CollabAgentStatus = +export type V2ThreadRevertResponse__CollabAgentStatus = | "pendingInit" | "running" | "interrupted" @@ -10430,7 +12455,7 @@ export type V2ThreadRollbackResponse__CollabAgentStatus = | "errored" | "shutdown" | "notFound"; -export const V2ThreadRollbackResponse__CollabAgentStatus = Schema.Literals([ +export const V2ThreadRevertResponse__CollabAgentStatus = Schema.Literals([ "pendingInit", "running", "interrupted", @@ -10438,31 +12463,21 @@ export const V2ThreadRollbackResponse__CollabAgentStatus = Schema.Literals([ "errored", "shutdown", "notFound", -]).annotate({ identifier: "V2ThreadRollbackResponse__CollabAgentStatus" }); - -export type V2ThreadRollbackResponse__ReasoningEffort = string; -export const V2ThreadRollbackResponse__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check( - Schema.isMinLength(1).annotate({ - expected: "a value with a length of at least 1", - identifier: "V2ThreadRollbackResponse__ReasoningEffort", - }), -); +]).annotate({ identifier: "V2ThreadRevertResponse__CollabAgentStatus" }); -export type V2ThreadRollbackResponse__CollabAgentToolCallStatus = +export type V2ThreadRevertResponse__CollabAgentToolCallStatus = | "inProgress" | "completed" | "failed" | "interrupted"; -export const V2ThreadRollbackResponse__CollabAgentToolCallStatus = Schema.Literals([ +export const V2ThreadRevertResponse__CollabAgentToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", "interrupted", -]).annotate({ identifier: "V2ThreadRollbackResponse__CollabAgentToolCallStatus" }); +]).annotate({ identifier: "V2ThreadRevertResponse__CollabAgentToolCallStatus" }); -export type V2ThreadRollbackResponse__CollabAgentTool = +export type V2ThreadRevertResponse__CollabAgentTool = | "spawnAgent" | "sendInput" | "resumeAgent" @@ -10472,7 +12487,7 @@ export type V2ThreadRollbackResponse__CollabAgentTool = | "followupTask" | "interruptAgent" | "listAgents"; -export const V2ThreadRollbackResponse__CollabAgentTool = Schema.Literals([ +export const V2ThreadRevertResponse__CollabAgentTool = Schema.Literals([ "spawnAgent", "sendInput", "resumeAgent", @@ -10482,21 +12497,21 @@ export const V2ThreadRollbackResponse__CollabAgentTool = Schema.Literals([ "followupTask", "interruptAgent", "listAgents", -]).annotate({ identifier: "V2ThreadRollbackResponse__CollabAgentTool" }); +]).annotate({ identifier: "V2ThreadRevertResponse__CollabAgentTool" }); -export type V2ThreadRollbackResponse__SubAgentActivityKind = +export type V2ThreadRevertResponse__SubAgentActivityKind = | "started" | "interacted" | "interrupted" | "completed"; -export const V2ThreadRollbackResponse__SubAgentActivityKind = Schema.Literals([ +export const V2ThreadRevertResponse__SubAgentActivityKind = Schema.Literals([ "started", "interacted", "interrupted", "completed", -]).annotate({ identifier: "V2ThreadRollbackResponse__SubAgentActivityKind" }); +]).annotate({ identifier: "V2ThreadRevertResponse__SubAgentActivityKind" }); -export type V2ThreadRollbackResponse__WebSearchAction = +export type V2ThreadRevertResponse__WebSearchAction = | { readonly queries?: ReadonlyArray | null; readonly query?: string | null; @@ -10505,7 +12520,7 @@ export type V2ThreadRollbackResponse__WebSearchAction = | { readonly type: "openPage"; readonly url?: string | null } | { readonly pattern?: string | null; readonly type: "findInPage"; readonly url?: string | null } | { readonly type: "other" }; -export const V2ThreadRollbackResponse__WebSearchAction = Schema.Union( +export const V2ThreadRevertResponse__WebSearchAction = Schema.Union( [ Schema.Struct({ queries: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), @@ -10526,10 +12541,35 @@ export const V2ThreadRollbackResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__WebSearchAction" }); +).annotate({ identifier: "V2ThreadRevertResponse__WebSearchAction" }); -export type V2ThreadRollbackResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadRollbackResponse__TurnItemsView = Schema.Union( +export type V2ThreadRevertResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadRevertResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadRevertResponse__ImageGenerationFailure" }); + +export type V2ThreadRevertResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadRevertResponse__TurnItemsView = Schema.Union( [ Schema.Literal("notLoaded").annotate({ description: "`items` was not loaded for this turn. The field is intentionally empty.", @@ -10543,19 +12583,79 @@ export const V2ThreadRollbackResponse__TurnItemsView = Schema.Union( }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__TurnItemsView" }); +).annotate({ identifier: "V2ThreadRevertResponse__TurnItemsView" }); -export type V2ThreadRollbackResponse__TurnStatus = +export type V2ThreadRevertResponse__TurnStatus = | "completed" | "interrupted" | "failed" | "inProgress"; -export const V2ThreadRollbackResponse__TurnStatus = Schema.Literals([ +export const V2ThreadRevertResponse__TurnStatus = Schema.Literals([ "completed", "interrupted", "failed", "inProgress", -]).annotate({ identifier: "V2ThreadRollbackResponse__TurnStatus" }); +]).annotate({ identifier: "V2ThreadRevertResponse__TurnStatus" }); + +export type V2ThreadSectionCreateParams__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadSectionCreateParams__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadSectionCreateParams__ThreadSectionAppearance", +}); + +export type V2ThreadSectionCreateResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadSectionCreateResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadSectionCreateResponse__ThreadSectionAppearance", +}); + +export type V2ThreadSectionListResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadSectionListResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadSectionListResponse__ThreadSectionAppearance", +}); + +export type V2ThreadSectionUpdateParams__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadSectionUpdateParams__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadSectionUpdateParams__ThreadSectionAppearance", +}); + +export type V2ThreadSectionUpdateResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadSectionUpdateResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadSectionUpdateResponse__ThreadSectionAppearance", +}); export type V2ThreadSettingsUpdatedNotification__ActivePermissionProfile = { readonly extends?: string | null; @@ -10651,7 +12751,10 @@ export const V2ThreadSettingsUpdatedNotification__Personality = Schema.Literals( "none", "friendly", "pragmatic", -]).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__Personality" }); +]).annotate({ + description: "Deprecated: `friendly` and `pragmatic` no longer select a style.", + identifier: "V2ThreadSettingsUpdatedNotification__Personality", +}); export type V2ThreadSettingsUpdatedNotification__NetworkAccess = "restricted" | "enabled"; export const V2ThreadSettingsUpdatedNotification__NetworkAccess = Schema.Literals([ @@ -10694,6 +12797,34 @@ export const V2ThreadStartedNotification__GitInfo = Schema.Struct({ sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2ThreadStartedNotification__GitInfo" }); +export type V2ThreadStartedNotification__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadStartedNotification__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "V2ThreadStartedNotification__ThreadHistoryMode" }); + +export type V2ThreadStartedNotification__ReasoningEffort = string; +export const V2ThreadStartedNotification__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadStartedNotification__ReasoningEffort", + }), +); + +export type V2ThreadStartedNotification__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadStartedNotification__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadStartedNotification__ThreadSectionAppearance", +}); + export type V2ThreadStartedNotification__AgentPath = string; export const V2ThreadStartedNotification__AgentPath = Schema.String.annotate({ identifier: "V2ThreadStartedNotification__AgentPath", @@ -10723,6 +12854,11 @@ export const V2ThreadStartedNotification__NonSteerableTurnKind = Schema.Literals "compact", ]).annotate({ identifier: "V2ThreadStartedNotification__NonSteerableTurnKind" }); +export type V2ThreadStartedNotification__MisalignmentSteer = { readonly message: string }; +export const V2ThreadStartedNotification__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadStartedNotification__MisalignmentSteer" }); + export type V2ThreadStartedNotification__ByteRange = { readonly end: number; readonly start: number; @@ -10757,6 +12893,11 @@ export const V2ThreadStartedNotification__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2ThreadStartedNotification__HookPromptFragment" }); +export type V2ThreadStartedNotification__AgentMessageDelivery = "async"; +export const V2ThreadStartedNotification__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadStartedNotification__AgentMessageDelivery", +}); + export type V2ThreadStartedNotification__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -10796,6 +12937,15 @@ export const V2ThreadStartedNotification__MessagePhase = Schema.Union( identifier: "V2ThreadStartedNotification__MessagePhase", }); +export type V2ThreadStartedNotification__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadStartedNotification__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadStartedNotification__AsyncUserInputQuestion" }); + export type V2ThreadStartedNotification__LegacyAppPathString = string; export const V2ThreadStartedNotification__LegacyAppPathString = Schema.String.annotate({ identifier: "V2ThreadStartedNotification__LegacyAppPathString", @@ -10877,6 +13027,12 @@ export const V2ThreadStartedNotification__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ThreadStartedNotification__McpToolCallError" }); +export type V2ThreadStartedNotification__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadStartedNotification__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadStartedNotification__McpAppDisplayMode" }); + export type V2ThreadStartedNotification__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -10951,16 +13107,6 @@ export const V2ThreadStartedNotification__CollabAgentStatus = Schema.Literals([ "notFound", ]).annotate({ identifier: "V2ThreadStartedNotification__CollabAgentStatus" }); -export type V2ThreadStartedNotification__ReasoningEffort = string; -export const V2ThreadStartedNotification__ReasoningEffort = Schema.String.annotate({ - description: "A non-empty reasoning effort value advertised by the model.", -}).check( - Schema.isMinLength(1).annotate({ - expected: "a value with a length of at least 1", - identifier: "V2ThreadStartedNotification__ReasoningEffort", - }), -); - export type V2ThreadStartedNotification__CollabAgentToolCallStatus = | "inProgress" | "completed" @@ -11039,6 +13185,31 @@ export const V2ThreadStartedNotification__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadStartedNotification__WebSearchAction" }); +export type V2ThreadStartedNotification__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadStartedNotification__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartedNotification__ImageGenerationFailure" }); + export type V2ThreadStartedNotification__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2ThreadStartedNotification__TurnItemsView = Schema.Union( [ @@ -11113,7 +13284,10 @@ export const V2ThreadStartParams__Personality = Schema.Literals([ "none", "friendly", "pragmatic", -]).annotate({ identifier: "V2ThreadStartParams__Personality" }); +]).annotate({ + description: "Deprecated: `friendly` and `pragmatic` no longer select a style.", + identifier: "V2ThreadStartParams__Personality", +}); export type V2ThreadStartParams__SandboxMode = | "read-only" @@ -11266,6 +13440,24 @@ export const V2ThreadStartResponse__GitInfo = Schema.Struct({ sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2ThreadStartResponse__GitInfo" }); +export type V2ThreadStartResponse__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadStartResponse__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "V2ThreadStartResponse__ThreadHistoryMode" }); + +export type V2ThreadStartResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadStartResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadStartResponse__ThreadSectionAppearance", +}); + export type V2ThreadStartResponse__AgentPath = string; export const V2ThreadStartResponse__AgentPath = Schema.String.annotate({ identifier: "V2ThreadStartResponse__AgentPath", @@ -11293,6 +13485,11 @@ export const V2ThreadStartResponse__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "V2ThreadStartResponse__NonSteerableTurnKind" }); +export type V2ThreadStartResponse__MisalignmentSteer = { readonly message: string }; +export const V2ThreadStartResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadStartResponse__MisalignmentSteer" }); + export type V2ThreadStartResponse__ByteRange = { readonly end: number; readonly start: number }; export const V2ThreadStartResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) @@ -11324,6 +13521,11 @@ export const V2ThreadStartResponse__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2ThreadStartResponse__HookPromptFragment" }); +export type V2ThreadStartResponse__AgentMessageDelivery = "async"; +export const V2ThreadStartResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadStartResponse__AgentMessageDelivery", +}); + export type V2ThreadStartResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -11363,6 +13565,15 @@ export const V2ThreadStartResponse__MessagePhase = Schema.Union( identifier: "V2ThreadStartResponse__MessagePhase", }); +export type V2ThreadStartResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadStartResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadStartResponse__AsyncUserInputQuestion" }); + export type V2ThreadStartResponse__CommandExecutionSource = | "agent" | "userShell" @@ -11439,6 +13650,12 @@ export const V2ThreadStartResponse__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2ThreadStartResponse__McpToolCallError" }); +export type V2ThreadStartResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadStartResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadStartResponse__McpAppDisplayMode" }); + export type V2ThreadStartResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -11588,6 +13805,31 @@ export const V2ThreadStartResponse__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadStartResponse__WebSearchAction" }); +export type V2ThreadStartResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadStartResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartResponse__ImageGenerationFailure" }); + export type V2ThreadStartResponse__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2ThreadStartResponse__TurnItemsView = Schema.Union( [ @@ -11656,55 +13898,41 @@ export const V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown = Schema ), }).annotate({ identifier: "V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown" }); -export type V2ThreadUnarchiveResponse__AbsolutePathBuf = string; -export const V2ThreadUnarchiveResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2ThreadUnarchiveResponse__AbsolutePathBuf", -}); - -export type V2ThreadUnarchiveResponse__GitInfo = { - readonly branch?: string | null; - readonly originUrl?: string | null; - readonly sha?: string | null; -}; -export const V2ThreadUnarchiveResponse__GitInfo = Schema.Struct({ - branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ identifier: "V2ThreadUnarchiveResponse__GitInfo" }); - -export type V2ThreadUnarchiveResponse__AgentPath = string; -export const V2ThreadUnarchiveResponse__AgentPath = Schema.String.annotate({ - identifier: "V2ThreadUnarchiveResponse__AgentPath", -}); - -export type V2ThreadUnarchiveResponse__ThreadId = string; -export const V2ThreadUnarchiveResponse__ThreadId = Schema.String.annotate({ - identifier: "V2ThreadUnarchiveResponse__ThreadId", -}); - -export type V2ThreadUnarchiveResponse__ThreadActiveFlag = - | "waitingOnApproval" - | "waitingOnUserInput"; -export const V2ThreadUnarchiveResponse__ThreadActiveFlag = Schema.Literals([ - "waitingOnApproval", - "waitingOnUserInput", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__ThreadActiveFlag" }); +export type V2ThreadTurnsListParams__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadTurnsListParams__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadTurnsListParams__TurnItemsView" }); -export type V2ThreadUnarchiveResponse__ThreadSource = string; -export const V2ThreadUnarchiveResponse__ThreadSource = Schema.String.annotate({ - identifier: "V2ThreadUnarchiveResponse__ThreadSource", +export type V2ThreadTurnsListParams__SortDirection = "asc" | "desc"; +export const V2ThreadTurnsListParams__SortDirection = Schema.Literals(["asc", "desc"]).annotate({ + identifier: "V2ThreadTurnsListParams__SortDirection", }); -export type V2ThreadUnarchiveResponse__NonSteerableTurnKind = "review" | "compact"; -export const V2ThreadUnarchiveResponse__NonSteerableTurnKind = Schema.Literals([ +export type V2ThreadTurnsListResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadTurnsListResponse__NonSteerableTurnKind = Schema.Literals([ "review", "compact", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__NonSteerableTurnKind" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__NonSteerableTurnKind" }); -export type V2ThreadUnarchiveResponse__ByteRange = { readonly end: number; readonly start: number }; -export const V2ThreadUnarchiveResponse__ByteRange = Schema.Struct({ +export type V2ThreadTurnsListResponse__MisalignmentSteer = { readonly message: string }; +export const V2ThreadTurnsListResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadTurnsListResponse__MisalignmentSteer" }); + +export type V2ThreadTurnsListResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadTurnsListResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) .check(Schema.isInt().annotate({ expected: "an integer" })) .check( @@ -11715,32 +13943,37 @@ export const V2ThreadUnarchiveResponse__ByteRange = Schema.Struct({ .check( Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), ), -}).annotate({ identifier: "V2ThreadUnarchiveResponse__ByteRange" }); +}).annotate({ identifier: "V2ThreadTurnsListResponse__ByteRange" }); -export type V2ThreadUnarchiveResponse__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2ThreadUnarchiveResponse__ImageDetail = Schema.Literals([ +export type V2ThreadTurnsListResponse__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2ThreadTurnsListResponse__ImageDetail = Schema.Literals([ "auto", "low", "high", "original", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__ImageDetail" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__ImageDetail" }); -export type V2ThreadUnarchiveResponse__HookPromptFragment = { +export type V2ThreadTurnsListResponse__HookPromptFragment = { readonly hookRunId: string; readonly text: string; }; -export const V2ThreadUnarchiveResponse__HookPromptFragment = Schema.Struct({ +export const V2ThreadTurnsListResponse__HookPromptFragment = Schema.Struct({ hookRunId: Schema.String, text: Schema.String, -}).annotate({ identifier: "V2ThreadUnarchiveResponse__HookPromptFragment" }); +}).annotate({ identifier: "V2ThreadTurnsListResponse__HookPromptFragment" }); -export type V2ThreadUnarchiveResponse__MemoryCitationEntry = { +export type V2ThreadTurnsListResponse__AgentMessageDelivery = "async"; +export const V2ThreadTurnsListResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadTurnsListResponse__AgentMessageDelivery", +}); + +export type V2ThreadTurnsListResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; readonly note: string; readonly path: string; }; -export const V2ThreadUnarchiveResponse__MemoryCitationEntry = Schema.Struct({ +export const V2ThreadTurnsListResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) .check(Schema.isInt().annotate({ expected: "an integer" })) .check( @@ -11753,10 +13986,10 @@ export const V2ThreadUnarchiveResponse__MemoryCitationEntry = Schema.Struct({ ), note: Schema.String, path: Schema.String, -}).annotate({ identifier: "V2ThreadUnarchiveResponse__MemoryCitationEntry" }); +}).annotate({ identifier: "V2ThreadTurnsListResponse__MemoryCitationEntry" }); -export type V2ThreadUnarchiveResponse__MessagePhase = "commentary" | "final_answer"; -export const V2ThreadUnarchiveResponse__MessagePhase = Schema.Union( +export type V2ThreadTurnsListResponse__MessagePhase = "commentary" | "final_answer"; +export const V2ThreadTurnsListResponse__MessagePhase = Schema.Union( [ Schema.Literal("commentary").annotate({ description: @@ -11770,43 +14003,52 @@ export const V2ThreadUnarchiveResponse__MessagePhase = Schema.Union( ).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', - identifier: "V2ThreadUnarchiveResponse__MessagePhase", + identifier: "V2ThreadTurnsListResponse__MessagePhase", }); -export type V2ThreadUnarchiveResponse__LegacyAppPathString = string; -export const V2ThreadUnarchiveResponse__LegacyAppPathString = Schema.String.annotate({ - identifier: "V2ThreadUnarchiveResponse__LegacyAppPathString", +export type V2ThreadTurnsListResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadTurnsListResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadTurnsListResponse__AsyncUserInputQuestion" }); + +export type V2ThreadTurnsListResponse__LegacyAppPathString = string; +export const V2ThreadTurnsListResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadTurnsListResponse__LegacyAppPathString", }); -export type V2ThreadUnarchiveResponse__CommandExecutionSource = +export type V2ThreadTurnsListResponse__CommandExecutionSource = | "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; -export const V2ThreadUnarchiveResponse__CommandExecutionSource = Schema.Literals([ +export const V2ThreadTurnsListResponse__CommandExecutionSource = Schema.Literals([ "agent", "userShell", "unifiedExecStartup", "unifiedExecInteraction", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__CommandExecutionSource" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__CommandExecutionSource" }); -export type V2ThreadUnarchiveResponse__CommandExecutionStatus = +export type V2ThreadTurnsListResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadUnarchiveResponse__CommandExecutionStatus = Schema.Literals([ +export const V2ThreadTurnsListResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__CommandExecutionStatus" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__CommandExecutionStatus" }); -export type V2ThreadUnarchiveResponse__PatchChangeKind = +export type V2ThreadTurnsListResponse__PatchChangeKind = | { readonly type: "add" } | { readonly type: "delete" } | { readonly move_path?: string | null; readonly type: "update" }; -export const V2ThreadUnarchiveResponse__PatchChangeKind = Schema.Union( +export const V2ThreadTurnsListResponse__PatchChangeKind = Schema.Union( [ Schema.Struct({ type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), @@ -11820,63 +14062,69 @@ export const V2ThreadUnarchiveResponse__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadUnarchiveResponse__PatchChangeKind" }); +).annotate({ identifier: "V2ThreadTurnsListResponse__PatchChangeKind" }); -export type V2ThreadUnarchiveResponse__PatchApplyStatus = +export type V2ThreadTurnsListResponse__PatchApplyStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2ThreadUnarchiveResponse__PatchApplyStatus = Schema.Literals([ +export const V2ThreadTurnsListResponse__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__PatchApplyStatus" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__PatchApplyStatus" }); -export type V2ThreadUnarchiveResponse__McpToolCallAppContext = { +export type V2ThreadTurnsListResponse__McpToolCallAppContext = { readonly actionName?: string | null; readonly appName?: string | null; readonly connectorId: string; readonly linkId?: string | null; readonly resourceUri?: string | null; }; -export const V2ThreadUnarchiveResponse__McpToolCallAppContext = Schema.Struct({ +export const V2ThreadTurnsListResponse__McpToolCallAppContext = Schema.Struct({ actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), connectorId: Schema.String, linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallAppContext" }); +}).annotate({ identifier: "V2ThreadTurnsListResponse__McpToolCallAppContext" }); -export type V2ThreadUnarchiveResponse__McpToolCallError = { readonly message: string }; -export const V2ThreadUnarchiveResponse__McpToolCallError = Schema.Struct({ +export type V2ThreadTurnsListResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadTurnsListResponse__McpToolCallError = Schema.Struct({ message: Schema.String, -}).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallError" }); +}).annotate({ identifier: "V2ThreadTurnsListResponse__McpToolCallError" }); -export type V2ThreadUnarchiveResponse__McpToolCallResult = { +export type V2ThreadTurnsListResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadTurnsListResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadTurnsListResponse__McpAppDisplayMode" }); + +export type V2ThreadTurnsListResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; readonly structuredContent?: Schema.Json; }; -export const V2ThreadUnarchiveResponse__McpToolCallResult = Schema.Struct({ +export const V2ThreadTurnsListResponse__McpToolCallResult = Schema.Struct({ _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), -}).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallResult" }); +}).annotate({ identifier: "V2ThreadTurnsListResponse__McpToolCallResult" }); -export type V2ThreadUnarchiveResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2ThreadUnarchiveResponse__McpToolCallStatus = Schema.Literals([ +export type V2ThreadTurnsListResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadTurnsListResponse__McpToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallStatus" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__McpToolCallStatus" }); -export type V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem = +export type V2ThreadTurnsListResponse__DynamicToolCallOutputContentItem = | { readonly text: string; readonly type: "inputText" } | { readonly imageUrl: string; readonly type: "inputImage" } | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem = Schema.Union( +export const V2ThreadTurnsListResponse__DynamicToolCallOutputContentItem = Schema.Union( [ Schema.Struct({ text: Schema.String, @@ -11898,19 +14146,19 @@ export const V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem = Schem }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem" }); +).annotate({ identifier: "V2ThreadTurnsListResponse__DynamicToolCallOutputContentItem" }); -export type V2ThreadUnarchiveResponse__DynamicToolCallStatus = +export type V2ThreadTurnsListResponse__DynamicToolCallStatus = | "inProgress" | "completed" | "failed"; -export const V2ThreadUnarchiveResponse__DynamicToolCallStatus = Schema.Literals([ +export const V2ThreadTurnsListResponse__DynamicToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__DynamicToolCallStatus" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__DynamicToolCallStatus" }); -export type V2ThreadUnarchiveResponse__CollabAgentStatus = +export type V2ThreadTurnsListResponse__CollabAgentStatus = | "pendingInit" | "running" | "interrupted" @@ -11918,7 +14166,7 @@ export type V2ThreadUnarchiveResponse__CollabAgentStatus = | "errored" | "shutdown" | "notFound"; -export const V2ThreadUnarchiveResponse__CollabAgentStatus = Schema.Literals([ +export const V2ThreadTurnsListResponse__CollabAgentStatus = Schema.Literals([ "pendingInit", "running", "interrupted", @@ -11926,31 +14174,31 @@ export const V2ThreadUnarchiveResponse__CollabAgentStatus = Schema.Literals([ "errored", "shutdown", "notFound", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentStatus" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__CollabAgentStatus" }); -export type V2ThreadUnarchiveResponse__ReasoningEffort = string; -export const V2ThreadUnarchiveResponse__ReasoningEffort = Schema.String.annotate({ +export type V2ThreadTurnsListResponse__ReasoningEffort = string; +export const V2ThreadTurnsListResponse__ReasoningEffort = Schema.String.annotate({ description: "A non-empty reasoning effort value advertised by the model.", }).check( Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1", - identifier: "V2ThreadUnarchiveResponse__ReasoningEffort", + identifier: "V2ThreadTurnsListResponse__ReasoningEffort", }), ); -export type V2ThreadUnarchiveResponse__CollabAgentToolCallStatus = +export type V2ThreadTurnsListResponse__CollabAgentToolCallStatus = | "inProgress" | "completed" | "failed" | "interrupted"; -export const V2ThreadUnarchiveResponse__CollabAgentToolCallStatus = Schema.Literals([ +export const V2ThreadTurnsListResponse__CollabAgentToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", "interrupted", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentToolCallStatus" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__CollabAgentToolCallStatus" }); -export type V2ThreadUnarchiveResponse__CollabAgentTool = +export type V2ThreadTurnsListResponse__CollabAgentTool = | "spawnAgent" | "sendInput" | "resumeAgent" @@ -11960,7 +14208,7 @@ export type V2ThreadUnarchiveResponse__CollabAgentTool = | "followupTask" | "interruptAgent" | "listAgents"; -export const V2ThreadUnarchiveResponse__CollabAgentTool = Schema.Literals([ +export const V2ThreadTurnsListResponse__CollabAgentTool = Schema.Literals([ "spawnAgent", "sendInput", "resumeAgent", @@ -11970,21 +14218,21 @@ export const V2ThreadUnarchiveResponse__CollabAgentTool = Schema.Literals([ "followupTask", "interruptAgent", "listAgents", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentTool" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__CollabAgentTool" }); -export type V2ThreadUnarchiveResponse__SubAgentActivityKind = +export type V2ThreadTurnsListResponse__SubAgentActivityKind = | "started" | "interacted" | "interrupted" | "completed"; -export const V2ThreadUnarchiveResponse__SubAgentActivityKind = Schema.Literals([ +export const V2ThreadTurnsListResponse__SubAgentActivityKind = Schema.Literals([ "started", "interacted", "interrupted", "completed", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__SubAgentActivityKind" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__SubAgentActivityKind" }); -export type V2ThreadUnarchiveResponse__WebSearchAction = +export type V2ThreadTurnsListResponse__WebSearchAction = | { readonly queries?: ReadonlyArray | null; readonly query?: string | null; @@ -11993,7 +14241,7 @@ export type V2ThreadUnarchiveResponse__WebSearchAction = | { readonly type: "openPage"; readonly url?: string | null } | { readonly pattern?: string | null; readonly type: "findInPage"; readonly url?: string | null } | { readonly type: "other" }; -export const V2ThreadUnarchiveResponse__WebSearchAction = Schema.Union( +export const V2ThreadTurnsListResponse__WebSearchAction = Schema.Union( [ Schema.Struct({ queries: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), @@ -12014,10 +14262,42 @@ export const V2ThreadUnarchiveResponse__WebSearchAction = Schema.Union( }).annotate({ title: "OtherWebSearchAction" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadUnarchiveResponse__WebSearchAction" }); +).annotate({ identifier: "V2ThreadTurnsListResponse__WebSearchAction" }); -export type V2ThreadUnarchiveResponse__TurnItemsView = "notLoaded" | "summary" | "full"; -export const V2ThreadUnarchiveResponse__TurnItemsView = Schema.Union( +export type V2ThreadTurnsListResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadTurnsListResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadTurnsListResponse__ImageGenerationFailure" }); + +export type V2ThreadTurnsListResponse__AbsolutePathBuf = string; +export const V2ThreadTurnsListResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadTurnsListResponse__AbsolutePathBuf", +}); + +export type V2ThreadTurnsListResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadTurnsListResponse__TurnItemsView = Schema.Union( [ Schema.Literal("notLoaded").annotate({ description: "`items` was not loaded for this turn. The field is intentionally empty.", @@ -12031,41 +14311,102 @@ export const V2ThreadUnarchiveResponse__TurnItemsView = Schema.Union( }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadUnarchiveResponse__TurnItemsView" }); +).annotate({ identifier: "V2ThreadTurnsListResponse__TurnItemsView" }); -export type V2ThreadUnarchiveResponse__TurnStatus = +export type V2ThreadTurnsListResponse__TurnStatus = | "completed" | "interrupted" | "failed" | "inProgress"; -export const V2ThreadUnarchiveResponse__TurnStatus = Schema.Literals([ +export const V2ThreadTurnsListResponse__TurnStatus = Schema.Literals([ "completed", "interrupted", "failed", "inProgress", -]).annotate({ identifier: "V2ThreadUnarchiveResponse__TurnStatus" }); +]).annotate({ identifier: "V2ThreadTurnsListResponse__TurnStatus" }); -export type V2ThreadUnsubscribeResponse__ThreadUnsubscribeStatus = - | "notLoaded" - | "notSubscribed" - | "unsubscribed"; -export const V2ThreadUnsubscribeResponse__ThreadUnsubscribeStatus = Schema.Literals([ - "notLoaded", - "notSubscribed", - "unsubscribed", -]).annotate({ identifier: "V2ThreadUnsubscribeResponse__ThreadUnsubscribeStatus" }); +export type V2ThreadUnarchiveResponse__AbsolutePathBuf = string; +export const V2ThreadUnarchiveResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2ThreadUnarchiveResponse__AbsolutePathBuf", +}); -export type V2TurnCompletedNotification__NonSteerableTurnKind = "review" | "compact"; -export const V2TurnCompletedNotification__NonSteerableTurnKind = Schema.Literals([ +export type V2ThreadUnarchiveResponse__GitInfo = { + readonly branch?: string | null; + readonly originUrl?: string | null; + readonly sha?: string | null; +}; +export const V2ThreadUnarchiveResponse__GitInfo = Schema.Struct({ + branch: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + originUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + sha: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ThreadUnarchiveResponse__GitInfo" }); + +export type V2ThreadUnarchiveResponse__ThreadHistoryMode = "legacy" | "paginated"; +export const V2ThreadUnarchiveResponse__ThreadHistoryMode = Schema.Literals([ + "legacy", + "paginated", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__ThreadHistoryMode" }); + +export type V2ThreadUnarchiveResponse__ReasoningEffort = string; +export const V2ThreadUnarchiveResponse__ReasoningEffort = Schema.String.annotate({ + description: "A non-empty reasoning effort value advertised by the model.", +}).check( + Schema.isMinLength(1).annotate({ + expected: "a value with a length of at least 1", + identifier: "V2ThreadUnarchiveResponse__ReasoningEffort", + }), +); + +export type V2ThreadUnarchiveResponse__ThreadSectionAppearance = { + readonly color?: string | null; + readonly icon?: string | null; +}; +export const V2ThreadUnarchiveResponse__ThreadSectionAppearance = Schema.Struct({ + color: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + icon: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + description: "Extensible visual presentation for a custom thread section.", + identifier: "V2ThreadUnarchiveResponse__ThreadSectionAppearance", +}); + +export type V2ThreadUnarchiveResponse__AgentPath = string; +export const V2ThreadUnarchiveResponse__AgentPath = Schema.String.annotate({ + identifier: "V2ThreadUnarchiveResponse__AgentPath", +}); + +export type V2ThreadUnarchiveResponse__ThreadId = string; +export const V2ThreadUnarchiveResponse__ThreadId = Schema.String.annotate({ + identifier: "V2ThreadUnarchiveResponse__ThreadId", +}); + +export type V2ThreadUnarchiveResponse__ThreadActiveFlag = + | "waitingOnApproval" + | "waitingOnUserInput"; +export const V2ThreadUnarchiveResponse__ThreadActiveFlag = Schema.Literals([ + "waitingOnApproval", + "waitingOnUserInput", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__ThreadActiveFlag" }); + +export type V2ThreadUnarchiveResponse__ThreadSource = string; +export const V2ThreadUnarchiveResponse__ThreadSource = Schema.String.annotate({ + identifier: "V2ThreadUnarchiveResponse__ThreadSource", +}); + +export type V2ThreadUnarchiveResponse__NonSteerableTurnKind = "review" | "compact"; +export const V2ThreadUnarchiveResponse__NonSteerableTurnKind = Schema.Literals([ "review", "compact", -]).annotate({ identifier: "V2TurnCompletedNotification__NonSteerableTurnKind" }); +]).annotate({ identifier: "V2ThreadUnarchiveResponse__NonSteerableTurnKind" }); -export type V2TurnCompletedNotification__ByteRange = { - readonly end: number; - readonly start: number; -}; -export const V2TurnCompletedNotification__ByteRange = Schema.Struct({ +export type V2ThreadUnarchiveResponse__MisalignmentSteer = { readonly message: string }; +export const V2ThreadUnarchiveResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2ThreadUnarchiveResponse__MisalignmentSteer" }); + +export type V2ThreadUnarchiveResponse__ByteRange = { readonly end: number; readonly start: number }; +export const V2ThreadUnarchiveResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) .check(Schema.isInt().annotate({ expected: "an integer" })) .check( @@ -12076,32 +14417,37 @@ export const V2TurnCompletedNotification__ByteRange = Schema.Struct({ .check( Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), ), -}).annotate({ identifier: "V2TurnCompletedNotification__ByteRange" }); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__ByteRange" }); -export type V2TurnCompletedNotification__ImageDetail = "auto" | "low" | "high" | "original"; -export const V2TurnCompletedNotification__ImageDetail = Schema.Literals([ +export type V2ThreadUnarchiveResponse__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2ThreadUnarchiveResponse__ImageDetail = Schema.Literals([ "auto", "low", "high", "original", -]).annotate({ identifier: "V2TurnCompletedNotification__ImageDetail" }); +]).annotate({ identifier: "V2ThreadUnarchiveResponse__ImageDetail" }); -export type V2TurnCompletedNotification__HookPromptFragment = { +export type V2ThreadUnarchiveResponse__HookPromptFragment = { readonly hookRunId: string; readonly text: string; }; -export const V2TurnCompletedNotification__HookPromptFragment = Schema.Struct({ +export const V2ThreadUnarchiveResponse__HookPromptFragment = Schema.Struct({ hookRunId: Schema.String, text: Schema.String, -}).annotate({ identifier: "V2TurnCompletedNotification__HookPromptFragment" }); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__HookPromptFragment" }); -export type V2TurnCompletedNotification__MemoryCitationEntry = { +export type V2ThreadUnarchiveResponse__AgentMessageDelivery = "async"; +export const V2ThreadUnarchiveResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2ThreadUnarchiveResponse__AgentMessageDelivery", +}); + +export type V2ThreadUnarchiveResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; readonly note: string; readonly path: string; }; -export const V2TurnCompletedNotification__MemoryCitationEntry = Schema.Struct({ +export const V2ThreadUnarchiveResponse__MemoryCitationEntry = Schema.Struct({ lineEnd: Schema.Number.annotate({ format: "uint32" }) .check(Schema.isInt().annotate({ expected: "an integer" })) .check( @@ -12114,10 +14460,10 @@ export const V2TurnCompletedNotification__MemoryCitationEntry = Schema.Struct({ ), note: Schema.String, path: Schema.String, -}).annotate({ identifier: "V2TurnCompletedNotification__MemoryCitationEntry" }); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__MemoryCitationEntry" }); -export type V2TurnCompletedNotification__MessagePhase = "commentary" | "final_answer"; -export const V2TurnCompletedNotification__MessagePhase = Schema.Union( +export type V2ThreadUnarchiveResponse__MessagePhase = "commentary" | "final_answer"; +export const V2ThreadUnarchiveResponse__MessagePhase = Schema.Union( [ Schema.Literal("commentary").annotate({ description: @@ -12131,50 +14477,52 @@ export const V2TurnCompletedNotification__MessagePhase = Schema.Union( ).annotate({ description: 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', - identifier: "V2TurnCompletedNotification__MessagePhase", + identifier: "V2ThreadUnarchiveResponse__MessagePhase", }); -export type V2TurnCompletedNotification__AbsolutePathBuf = string; -export const V2TurnCompletedNotification__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2TurnCompletedNotification__AbsolutePathBuf", -}); +export type V2ThreadUnarchiveResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2ThreadUnarchiveResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2ThreadUnarchiveResponse__AsyncUserInputQuestion" }); -export type V2TurnCompletedNotification__LegacyAppPathString = string; -export const V2TurnCompletedNotification__LegacyAppPathString = Schema.String.annotate({ - identifier: "V2TurnCompletedNotification__LegacyAppPathString", +export type V2ThreadUnarchiveResponse__LegacyAppPathString = string; +export const V2ThreadUnarchiveResponse__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2ThreadUnarchiveResponse__LegacyAppPathString", }); -export type V2TurnCompletedNotification__CommandExecutionSource = +export type V2ThreadUnarchiveResponse__CommandExecutionSource = | "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction"; -export const V2TurnCompletedNotification__CommandExecutionSource = Schema.Literals([ +export const V2ThreadUnarchiveResponse__CommandExecutionSource = Schema.Literals([ "agent", "userShell", "unifiedExecStartup", "unifiedExecInteraction", -]).annotate({ identifier: "V2TurnCompletedNotification__CommandExecutionSource" }); +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CommandExecutionSource" }); -export type V2TurnCompletedNotification__CommandExecutionStatus = +export type V2ThreadUnarchiveResponse__CommandExecutionStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2TurnCompletedNotification__CommandExecutionStatus = Schema.Literals([ +export const V2ThreadUnarchiveResponse__CommandExecutionStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]).annotate({ identifier: "V2TurnCompletedNotification__CommandExecutionStatus" }); +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CommandExecutionStatus" }); -export type V2TurnCompletedNotification__PatchChangeKind = +export type V2ThreadUnarchiveResponse__PatchChangeKind = | { readonly type: "add" } | { readonly type: "delete" } | { readonly move_path?: string | null; readonly type: "update" }; -export const V2TurnCompletedNotification__PatchChangeKind = Schema.Union( +export const V2ThreadUnarchiveResponse__PatchChangeKind = Schema.Union( [ Schema.Struct({ type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), @@ -12188,63 +14536,470 @@ export const V2TurnCompletedNotification__PatchChangeKind = Schema.Union( }).annotate({ title: "UpdatePatchChangeKind" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2TurnCompletedNotification__PatchChangeKind" }); +).annotate({ identifier: "V2ThreadUnarchiveResponse__PatchChangeKind" }); -export type V2TurnCompletedNotification__PatchApplyStatus = +export type V2ThreadUnarchiveResponse__PatchApplyStatus = | "inProgress" | "completed" | "failed" | "declined"; -export const V2TurnCompletedNotification__PatchApplyStatus = Schema.Literals([ +export const V2ThreadUnarchiveResponse__PatchApplyStatus = Schema.Literals([ "inProgress", "completed", "failed", "declined", -]).annotate({ identifier: "V2TurnCompletedNotification__PatchApplyStatus" }); +]).annotate({ identifier: "V2ThreadUnarchiveResponse__PatchApplyStatus" }); -export type V2TurnCompletedNotification__McpToolCallAppContext = { +export type V2ThreadUnarchiveResponse__McpToolCallAppContext = { readonly actionName?: string | null; readonly appName?: string | null; readonly connectorId: string; readonly linkId?: string | null; readonly resourceUri?: string | null; }; -export const V2TurnCompletedNotification__McpToolCallAppContext = Schema.Struct({ +export const V2ThreadUnarchiveResponse__McpToolCallAppContext = Schema.Struct({ actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), connectorId: Schema.String, linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), -}).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallAppContext" }); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallAppContext" }); -export type V2TurnCompletedNotification__McpToolCallError = { readonly message: string }; -export const V2TurnCompletedNotification__McpToolCallError = Schema.Struct({ +export type V2ThreadUnarchiveResponse__McpToolCallError = { readonly message: string }; +export const V2ThreadUnarchiveResponse__McpToolCallError = Schema.Struct({ message: Schema.String, -}).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallError" }); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallError" }); -export type V2TurnCompletedNotification__McpToolCallResult = { +export type V2ThreadUnarchiveResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2ThreadUnarchiveResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__McpAppDisplayMode" }); + +export type V2ThreadUnarchiveResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; readonly structuredContent?: Schema.Json; }; -export const V2TurnCompletedNotification__McpToolCallResult = Schema.Struct({ +export const V2ThreadUnarchiveResponse__McpToolCallResult = Schema.Struct({ _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), -}).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallResult" }); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallResult" }); -export type V2TurnCompletedNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; -export const V2TurnCompletedNotification__McpToolCallStatus = Schema.Literals([ +export type V2ThreadUnarchiveResponse__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2ThreadUnarchiveResponse__McpToolCallStatus = Schema.Literals([ "inProgress", "completed", "failed", -]).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallStatus" }); +]).annotate({ identifier: "V2ThreadUnarchiveResponse__McpToolCallStatus" }); -export type V2TurnCompletedNotification__DynamicToolCallOutputContentItem = +export type V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem = | { readonly text: string; readonly type: "inputText" } | { readonly imageUrl: string; readonly type: "inputImage" } | { readonly audioUrl: string; readonly type: "inputAudio" }; -export const V2TurnCompletedNotification__DynamicToolCallOutputContentItem = Schema.Union( +export const V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("inputText").annotate({ + title: "InputTextDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputTextDynamicToolCallOutputContentItem" }), + Schema.Struct({ + imageUrl: Schema.String, + type: Schema.Literal("inputImage").annotate({ + title: "InputImageDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputImageDynamicToolCallOutputContentItem" }), + Schema.Struct({ + audioUrl: Schema.String, + type: Schema.Literal("inputAudio").annotate({ + title: "InputAudioDynamicToolCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioDynamicToolCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__DynamicToolCallOutputContentItem" }); + +export type V2ThreadUnarchiveResponse__DynamicToolCallStatus = + | "inProgress" + | "completed" + | "failed"; +export const V2ThreadUnarchiveResponse__DynamicToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__DynamicToolCallStatus" }); + +export type V2ThreadUnarchiveResponse__CollabAgentStatus = + | "pendingInit" + | "running" + | "interrupted" + | "completed" + | "errored" + | "shutdown" + | "notFound"; +export const V2ThreadUnarchiveResponse__CollabAgentStatus = Schema.Literals([ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentStatus" }); + +export type V2ThreadUnarchiveResponse__CollabAgentToolCallStatus = + | "inProgress" + | "completed" + | "failed" + | "interrupted"; +export const V2ThreadUnarchiveResponse__CollabAgentToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "interrupted", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentToolCallStatus" }); + +export type V2ThreadUnarchiveResponse__CollabAgentTool = + | "spawnAgent" + | "sendInput" + | "resumeAgent" + | "wait" + | "closeAgent" + | "sendMessage" + | "followupTask" + | "interruptAgent" + | "listAgents"; +export const V2ThreadUnarchiveResponse__CollabAgentTool = Schema.Literals([ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent", + "sendMessage", + "followupTask", + "interruptAgent", + "listAgents", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentTool" }); + +export type V2ThreadUnarchiveResponse__SubAgentActivityKind = + | "started" + | "interacted" + | "interrupted" + | "completed"; +export const V2ThreadUnarchiveResponse__SubAgentActivityKind = Schema.Literals([ + "started", + "interacted", + "interrupted", + "completed", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__SubAgentActivityKind" }); + +export type V2ThreadUnarchiveResponse__WebSearchAction = + | { + readonly queries?: ReadonlyArray | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly type: "openPage"; readonly url?: string | null } + | { readonly pattern?: string | null; readonly type: "findInPage"; readonly url?: string | null } + | { readonly type: "other" }; +export const V2ThreadUnarchiveResponse__WebSearchAction = Schema.Union( + [ + Schema.Struct({ + queries: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchWebSearchActionType" }), + }).annotate({ title: "SearchWebSearchAction" }), + Schema.Struct({ + type: Schema.Literal("openPage").annotate({ title: "OpenPageWebSearchActionType" }), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "OpenPageWebSearchAction" }), + Schema.Struct({ + pattern: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("findInPage").annotate({ title: "FindInPageWebSearchActionType" }), + url: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ title: "FindInPageWebSearchAction" }), + Schema.Struct({ + type: Schema.Literal("other").annotate({ title: "OtherWebSearchActionType" }), + }).annotate({ title: "OtherWebSearchAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__WebSearchAction" }); + +export type V2ThreadUnarchiveResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2ThreadUnarchiveResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__ImageGenerationFailure" }); + +export type V2ThreadUnarchiveResponse__TurnItemsView = "notLoaded" | "summary" | "full"; +export const V2ThreadUnarchiveResponse__TurnItemsView = Schema.Union( + [ + Schema.Literal("notLoaded").annotate({ + description: "`items` was not loaded for this turn. The field is intentionally empty.", + }), + Schema.Literal("summary").annotate({ + description: "`items` contains only a display summary for this turn.", + }), + Schema.Literal("full").annotate({ + description: + "`items` contains every ThreadItem available from persisted app-server history for this turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__TurnItemsView" }); + +export type V2ThreadUnarchiveResponse__TurnStatus = + | "completed" + | "interrupted" + | "failed" + | "inProgress"; +export const V2ThreadUnarchiveResponse__TurnStatus = Schema.Literals([ + "completed", + "interrupted", + "failed", + "inProgress", +]).annotate({ identifier: "V2ThreadUnarchiveResponse__TurnStatus" }); + +export type V2ThreadUnsubscribeResponse__ThreadUnsubscribeStatus = + | "notLoaded" + | "notSubscribed" + | "unsubscribed"; +export const V2ThreadUnsubscribeResponse__ThreadUnsubscribeStatus = Schema.Literals([ + "notLoaded", + "notSubscribed", + "unsubscribed", +]).annotate({ identifier: "V2ThreadUnsubscribeResponse__ThreadUnsubscribeStatus" }); + +export type V2TurnCompletedNotification__NonSteerableTurnKind = "review" | "compact"; +export const V2TurnCompletedNotification__NonSteerableTurnKind = Schema.Literals([ + "review", + "compact", +]).annotate({ identifier: "V2TurnCompletedNotification__NonSteerableTurnKind" }); + +export type V2TurnCompletedNotification__MisalignmentSteer = { readonly message: string }; +export const V2TurnCompletedNotification__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2TurnCompletedNotification__MisalignmentSteer" }); + +export type V2TurnCompletedNotification__ByteRange = { + readonly end: number; + readonly start: number; +}; +export const V2TurnCompletedNotification__ByteRange = Schema.Struct({ + end: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + start: Schema.Number.annotate({ format: "uint" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), +}).annotate({ identifier: "V2TurnCompletedNotification__ByteRange" }); + +export type V2TurnCompletedNotification__ImageDetail = "auto" | "low" | "high" | "original"; +export const V2TurnCompletedNotification__ImageDetail = Schema.Literals([ + "auto", + "low", + "high", + "original", +]).annotate({ identifier: "V2TurnCompletedNotification__ImageDetail" }); + +export type V2TurnCompletedNotification__HookPromptFragment = { + readonly hookRunId: string; + readonly text: string; +}; +export const V2TurnCompletedNotification__HookPromptFragment = Schema.Struct({ + hookRunId: Schema.String, + text: Schema.String, +}).annotate({ identifier: "V2TurnCompletedNotification__HookPromptFragment" }); + +export type V2TurnCompletedNotification__AgentMessageDelivery = "async"; +export const V2TurnCompletedNotification__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2TurnCompletedNotification__AgentMessageDelivery", +}); + +export type V2TurnCompletedNotification__MemoryCitationEntry = { + readonly lineEnd: number; + readonly lineStart: number; + readonly note: string; + readonly path: string; +}; +export const V2TurnCompletedNotification__MemoryCitationEntry = Schema.Struct({ + lineEnd: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + lineStart: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), + ), + note: Schema.String, + path: Schema.String, +}).annotate({ identifier: "V2TurnCompletedNotification__MemoryCitationEntry" }); + +export type V2TurnCompletedNotification__MessagePhase = "commentary" | "final_answer"; +export const V2TurnCompletedNotification__MessagePhase = Schema.Union( + [ + Schema.Literal("commentary").annotate({ + description: + "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + }), + Schema.Literal("final_answer").annotate({ + description: "The assistant's terminal answer text for the current turn.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.', + identifier: "V2TurnCompletedNotification__MessagePhase", +}); + +export type V2TurnCompletedNotification__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2TurnCompletedNotification__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2TurnCompletedNotification__AsyncUserInputQuestion" }); + +export type V2TurnCompletedNotification__LegacyAppPathString = string; +export const V2TurnCompletedNotification__LegacyAppPathString = Schema.String.annotate({ + identifier: "V2TurnCompletedNotification__LegacyAppPathString", +}); + +export type V2TurnCompletedNotification__CommandExecutionSource = + | "agent" + | "userShell" + | "unifiedExecStartup" + | "unifiedExecInteraction"; +export const V2TurnCompletedNotification__CommandExecutionSource = Schema.Literals([ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction", +]).annotate({ identifier: "V2TurnCompletedNotification__CommandExecutionSource" }); + +export type V2TurnCompletedNotification__CommandExecutionStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2TurnCompletedNotification__CommandExecutionStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "declined", +]).annotate({ identifier: "V2TurnCompletedNotification__CommandExecutionStatus" }); + +export type V2TurnCompletedNotification__PatchChangeKind = + | { readonly type: "add" } + | { readonly type: "delete" } + | { readonly move_path?: string | null; readonly type: "update" }; +export const V2TurnCompletedNotification__PatchChangeKind = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("add").annotate({ title: "AddPatchChangeKindType" }), + }).annotate({ title: "AddPatchChangeKind" }), + Schema.Struct({ + type: Schema.Literal("delete").annotate({ title: "DeletePatchChangeKindType" }), + }).annotate({ title: "DeletePatchChangeKind" }), + Schema.Struct({ + move_path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("update").annotate({ title: "UpdatePatchChangeKindType" }), + }).annotate({ title: "UpdatePatchChangeKind" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnCompletedNotification__PatchChangeKind" }); + +export type V2TurnCompletedNotification__PatchApplyStatus = + | "inProgress" + | "completed" + | "failed" + | "declined"; +export const V2TurnCompletedNotification__PatchApplyStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", + "declined", +]).annotate({ identifier: "V2TurnCompletedNotification__PatchApplyStatus" }); + +export type V2TurnCompletedNotification__McpToolCallAppContext = { + readonly actionName?: string | null; + readonly appName?: string | null; + readonly connectorId: string; + readonly linkId?: string | null; + readonly resourceUri?: string | null; +}; +export const V2TurnCompletedNotification__McpToolCallAppContext = Schema.Struct({ + actionName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + appName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + connectorId: Schema.String, + linkId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + resourceUri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallAppContext" }); + +export type V2TurnCompletedNotification__McpToolCallError = { readonly message: string }; +export const V2TurnCompletedNotification__McpToolCallError = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallError" }); + +export type V2TurnCompletedNotification__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2TurnCompletedNotification__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2TurnCompletedNotification__McpAppDisplayMode" }); + +export type V2TurnCompletedNotification__McpToolCallResult = { + readonly _meta?: Schema.Json; + readonly content: ReadonlyArray; + readonly structuredContent?: Schema.Json; +}; +export const V2TurnCompletedNotification__McpToolCallResult = Schema.Struct({ + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + content: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + structuredContent: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), +}).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallResult" }); + +export type V2TurnCompletedNotification__McpToolCallStatus = "inProgress" | "completed" | "failed"; +export const V2TurnCompletedNotification__McpToolCallStatus = Schema.Literals([ + "inProgress", + "completed", + "failed", +]).annotate({ identifier: "V2TurnCompletedNotification__McpToolCallStatus" }); + +export type V2TurnCompletedNotification__DynamicToolCallOutputContentItem = + | { readonly text: string; readonly type: "inputText" } + | { readonly imageUrl: string; readonly type: "inputImage" } + | { readonly audioUrl: string; readonly type: "inputAudio" }; +export const V2TurnCompletedNotification__DynamicToolCallOutputContentItem = Schema.Union( [ Schema.Struct({ text: Schema.String, @@ -12384,6 +15139,38 @@ export const V2TurnCompletedNotification__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnCompletedNotification__WebSearchAction" }); +export type V2TurnCompletedNotification__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2TurnCompletedNotification__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnCompletedNotification__ImageGenerationFailure" }); + +export type V2TurnCompletedNotification__AbsolutePathBuf = string; +export const V2TurnCompletedNotification__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2TurnCompletedNotification__AbsolutePathBuf", +}); + export type V2TurnCompletedNotification__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2TurnCompletedNotification__TurnItemsView = Schema.Union( [ @@ -12429,6 +15216,11 @@ export const V2TurnStartedNotification__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "V2TurnStartedNotification__NonSteerableTurnKind" }); +export type V2TurnStartedNotification__MisalignmentSteer = { readonly message: string }; +export const V2TurnStartedNotification__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2TurnStartedNotification__MisalignmentSteer" }); + export type V2TurnStartedNotification__ByteRange = { readonly end: number; readonly start: number }; export const V2TurnStartedNotification__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) @@ -12460,6 +15252,11 @@ export const V2TurnStartedNotification__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2TurnStartedNotification__HookPromptFragment" }); +export type V2TurnStartedNotification__AgentMessageDelivery = "async"; +export const V2TurnStartedNotification__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2TurnStartedNotification__AgentMessageDelivery", +}); + export type V2TurnStartedNotification__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -12499,12 +15296,14 @@ export const V2TurnStartedNotification__MessagePhase = Schema.Union( identifier: "V2TurnStartedNotification__MessagePhase", }); -export type V2TurnStartedNotification__AbsolutePathBuf = string; -export const V2TurnStartedNotification__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2TurnStartedNotification__AbsolutePathBuf", -}); +export type V2TurnStartedNotification__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2TurnStartedNotification__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2TurnStartedNotification__AsyncUserInputQuestion" }); export type V2TurnStartedNotification__LegacyAppPathString = string; export const V2TurnStartedNotification__LegacyAppPathString = Schema.String.annotate({ @@ -12587,6 +15386,12 @@ export const V2TurnStartedNotification__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2TurnStartedNotification__McpToolCallError" }); +export type V2TurnStartedNotification__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2TurnStartedNotification__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2TurnStartedNotification__McpAppDisplayMode" }); + export type V2TurnStartedNotification__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -12749,6 +15554,38 @@ export const V2TurnStartedNotification__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnStartedNotification__WebSearchAction" }); +export type V2TurnStartedNotification__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2TurnStartedNotification__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartedNotification__ImageGenerationFailure" }); + +export type V2TurnStartedNotification__AbsolutePathBuf = string; +export const V2TurnStartedNotification__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2TurnStartedNotification__AbsolutePathBuf", +}); + export type V2TurnStartedNotification__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2TurnStartedNotification__TurnItemsView = Schema.Union( [ @@ -12855,7 +15692,10 @@ export const V2TurnStartParams__Personality = Schema.Literals([ "none", "friendly", "pragmatic", -]).annotate({ identifier: "V2TurnStartParams__Personality" }); +]).annotate({ + description: "Deprecated: `friendly` and `pragmatic` no longer select a style.", + identifier: "V2TurnStartParams__Personality", +}); export type V2TurnStartParams__NetworkAccess = "restricted" | "enabled"; export const V2TurnStartParams__NetworkAccess = Schema.Literals(["restricted", "enabled"]).annotate( @@ -12905,6 +15745,11 @@ export const V2TurnStartResponse__NonSteerableTurnKind = Schema.Literals([ "compact", ]).annotate({ identifier: "V2TurnStartResponse__NonSteerableTurnKind" }); +export type V2TurnStartResponse__MisalignmentSteer = { readonly message: string }; +export const V2TurnStartResponse__MisalignmentSteer = Schema.Struct({ + message: Schema.String, +}).annotate({ identifier: "V2TurnStartResponse__MisalignmentSteer" }); + export type V2TurnStartResponse__ByteRange = { readonly end: number; readonly start: number }; export const V2TurnStartResponse__ByteRange = Schema.Struct({ end: Schema.Number.annotate({ format: "uint" }) @@ -12936,6 +15781,11 @@ export const V2TurnStartResponse__HookPromptFragment = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2TurnStartResponse__HookPromptFragment" }); +export type V2TurnStartResponse__AgentMessageDelivery = "async"; +export const V2TurnStartResponse__AgentMessageDelivery = Schema.Literal("async").annotate({ + identifier: "V2TurnStartResponse__AgentMessageDelivery", +}); + export type V2TurnStartResponse__MemoryCitationEntry = { readonly lineEnd: number; readonly lineStart: number; @@ -12975,12 +15825,14 @@ export const V2TurnStartResponse__MessagePhase = Schema.Union( identifier: "V2TurnStartResponse__MessagePhase", }); -export type V2TurnStartResponse__AbsolutePathBuf = string; -export const V2TurnStartResponse__AbsolutePathBuf = Schema.String.annotate({ - description: - "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - identifier: "V2TurnStartResponse__AbsolutePathBuf", -}); +export type V2TurnStartResponse__AsyncUserInputQuestion = { + readonly options?: ReadonlyArray | null; + readonly title: string; +}; +export const V2TurnStartResponse__AsyncUserInputQuestion = Schema.Struct({ + options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + title: Schema.String, +}).annotate({ identifier: "V2TurnStartResponse__AsyncUserInputQuestion" }); export type V2TurnStartResponse__LegacyAppPathString = string; export const V2TurnStartResponse__LegacyAppPathString = Schema.String.annotate({ @@ -13063,6 +15915,12 @@ export const V2TurnStartResponse__McpToolCallError = Schema.Struct({ message: Schema.String, }).annotate({ identifier: "V2TurnStartResponse__McpToolCallError" }); +export type V2TurnStartResponse__McpAppDisplayMode = "inline" | "fullscreen"; +export const V2TurnStartResponse__McpAppDisplayMode = Schema.Literals([ + "inline", + "fullscreen", +]).annotate({ identifier: "V2TurnStartResponse__McpAppDisplayMode" }); + export type V2TurnStartResponse__McpToolCallResult = { readonly _meta?: Schema.Json; readonly content: ReadonlyArray; @@ -13222,6 +16080,38 @@ export const V2TurnStartResponse__WebSearchAction = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnStartResponse__WebSearchAction" }); +export type V2TurnStartResponse__ImageGenerationFailure = { + readonly limitId: string; + readonly resetsAt?: number | null; + readonly type: "usageLimitExceeded"; +}; +export const V2TurnStartResponse__ImageGenerationFailure = Schema.Union( + [ + Schema.Struct({ + limitId: Schema.String, + resetsAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + type: Schema.Literal("usageLimitExceeded").annotate({ + title: "UsageLimitExceededImageGenerationFailureType", + }), + }).annotate({ title: "UsageLimitExceededImageGenerationFailure" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartResponse__ImageGenerationFailure" }); + +export type V2TurnStartResponse__AbsolutePathBuf = string; +export const V2TurnStartResponse__AbsolutePathBuf = Schema.String.annotate({ + description: + "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + identifier: "V2TurnStartResponse__AbsolutePathBuf", +}); + export type V2TurnStartResponse__TurnItemsView = "notLoaded" | "summary" | "full"; export const V2TurnStartResponse__TurnItemsView = Schema.Union( [ @@ -13333,6 +16223,7 @@ export type ClientRequest__ThreadResumeParams = { readonly config?: { readonly [x: string]: Schema.Json } | null; readonly cwd?: string | null; readonly developerInstructions?: string | null; + readonly excludeTurns?: boolean; readonly model?: string | null; readonly modelProvider?: string | null; readonly personality?: ClientRequest__Personality | null; @@ -13357,6 +16248,12 @@ export const ClientRequest__ThreadResumeParams = Schema.Struct({ ), cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + excludeTurns: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "When true, return only thread metadata and live-resume state without populating `thread.turns`. This is useful when the client plans to call `thread/turns/list` immediately after resuming. Full-history hydration is deprecated for paginated threads; use this with `thread/turns/list` and `thread/items/list` instead.", + }), + ), model: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -13366,7 +16263,12 @@ export const ClientRequest__ThreadResumeParams = Schema.Struct({ ]), ), modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - personality: Schema.optionalKey(Schema.Union([ClientRequest__Personality, Schema.Null])), + personality: Schema.optionalKey( + Schema.Union([ClientRequest__Personality, Schema.Null]).annotate({ + description: + "@deprecated `friendly` and `pragmatic` no longer select a style. Changing this does not rewrite the thread's existing instructions.", + }), + ), sandbox: Schema.optionalKey(Schema.Union([ClientRequest__SandboxMode, Schema.Null])), serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), threadId: Schema.String, @@ -13413,7 +16315,11 @@ export const ClientRequest__ThreadStartParams = Schema.Struct({ ephemeral: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - personality: Schema.optionalKey(Schema.Union([ClientRequest__Personality, Schema.Null])), + personality: Schema.optionalKey( + Schema.Union([ClientRequest__Personality, Schema.Null]).annotate({ + description: "@deprecated `friendly` and `pragmatic` no longer select a style.", + }), + ), sandbox: Schema.optionalKey(Schema.Union([ClientRequest__SandboxMode, Schema.Null])), serviceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -13435,6 +16341,7 @@ export type ClientRequest__ThreadForkParams = { readonly cwd?: string | null; readonly developerInstructions?: string | null; readonly ephemeral?: boolean; + readonly excludeTurns?: boolean; readonly lastTurnId?: string | null; readonly model?: string | null; readonly modelProvider?: string | null; @@ -13461,6 +16368,12 @@ export const ClientRequest__ThreadForkParams = Schema.Struct({ cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), ephemeral: Schema.optionalKey(Schema.Boolean), + excludeTurns: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "When true, return only thread metadata and live fork state without populating `thread.turns`. This is useful when the client plans to call `thread/turns/list` immediately after forking. Full-history hydration is deprecated for paginated threads; use this with `thread/turns/list` and `thread/items/list` instead.", + }), + ), lastTurnId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -13528,13 +16441,60 @@ export const ClientRequest__ThreadMetadataUpdateParams = Schema.Struct({ threadId: Schema.String, }).annotate({ identifier: "ClientRequest__ThreadMetadataUpdateParams" }); +export type ClientRequest__ThreadItemsListParams = { + readonly cursor?: string | null; + readonly limit?: number | null; + readonly sortDirection?: ClientRequest__SortDirection | null; + readonly threadId: string; + readonly turnId?: string | null; +}; +export const ClientRequest__ThreadItemsListParams = Schema.Struct({ + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque cursor to pass to the next call to continue after the last item.", + }), + Schema.Null, + ]), + ), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ description: "Optional item page size.", format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + sortDirection: Schema.optionalKey( + Schema.Union([ClientRequest__SortDirection, Schema.Null]).annotate({ + description: "Optional item pagination direction; defaults to ascending.", + }), + ), + threadId: Schema.String, + turnId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional turn id to filter by. When omitted, returns items across the thread.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__ThreadItemsListParams" }); + export type ClientRequest__ThreadListParams = { readonly archived?: boolean | null; readonly cursor?: string | null; readonly cwd?: ClientRequest__ThreadListCwdFilter | null; readonly limit?: number | null; readonly modelProviders?: ReadonlyArray | null; + readonly originators?: ReadonlyArray | null; readonly searchTerm?: string | null; + readonly sectionId?: string | null; readonly sortDirection?: ClientRequest__SortDirection | null; readonly sortKey?: ClientRequest__ThreadSortKey | null; readonly sourceKinds?: ReadonlyArray | null; @@ -13588,6 +16548,15 @@ export const ClientRequest__ThreadListParams = Schema.Struct({ Schema.Null, ]), ), + originators: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: + "Optional originator allowlist, matching any supplied value exactly. Supported by hosted backends only; the local app-server rejects a nonempty list. Omitted or empty lists leave originators unrestricted.", + }), + Schema.Null, + ]), + ), searchTerm: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -13596,6 +16565,15 @@ export const ClientRequest__ThreadListParams = Schema.Struct({ Schema.Null, ]), ), + sectionId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Omit to include every section, set to `null` for unsectioned threads, or provide a section ID to return only threads in that section.", + }), + Schema.Null, + ]), + ), sortDirection: Schema.optionalKey( Schema.Union([ClientRequest__SortDirection, Schema.Null]).annotate({ description: "Optional sort direction; defaults to descending (newest first).", @@ -13623,6 +16601,81 @@ export const ClientRequest__ThreadListParams = Schema.Struct({ ), }).annotate({ identifier: "ClientRequest__ThreadListParams" }); +export type ClientRequest__ThreadSectionCreateParams = { + readonly appearance?: ClientRequest__ThreadSectionAppearance | null; + readonly name: string; +}; +export const ClientRequest__ThreadSectionCreateParams = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([ClientRequest__ThreadSectionAppearance, Schema.Null]), + ), + name: Schema.String.annotate({ description: "The user-visible name of the section." }), +}).annotate({ + description: "Parameters for creating an independently persisted thread section.", + identifier: "ClientRequest__ThreadSectionCreateParams", +}); + +export type ClientRequest__ThreadSectionUpdateParams = { + readonly appearance?: ClientRequest__ThreadSectionAppearance | null; + readonly name: string; + readonly sectionId: string; +}; +export const ClientRequest__ThreadSectionUpdateParams = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([ClientRequest__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Omit to preserve appearance, use `null` to clear it, or provide a replacement.", + }), + ), + name: Schema.String.annotate({ description: "The updated user-visible name of the section." }), + sectionId: Schema.String.annotate({ + description: "The stable, server-generated identity of the section to update.", + }), +}).annotate({ + description: "Parameters for updating an independently persisted thread section.", + identifier: "ClientRequest__ThreadSectionUpdateParams", +}); + +export type ClientRequest__ThreadTurnsListParams = { + readonly cursor?: string | null; + readonly itemsView?: ClientRequest__TurnItemsView | null; + readonly limit?: number | null; + readonly sortDirection?: ClientRequest__SortDirection | null; + readonly threadId: string; +}; +export const ClientRequest__ThreadTurnsListParams = Schema.Struct({ + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque cursor to pass to the next call to continue after the last turn.", + }), + Schema.Null, + ]), + ), + itemsView: Schema.optionalKey( + Schema.Union([ClientRequest__TurnItemsView, Schema.Null]).annotate({ + description: "How much item detail to include for each returned turn; defaults to summary.", + }), + ), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ description: "Optional turn page size.", format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + sortDirection: Schema.optionalKey( + Schema.Union([ClientRequest__SortDirection, Schema.Null]).annotate({ + description: "Optional turn pagination direction; defaults to descending.", + }), + ), + threadId: Schema.String, +}).annotate({ identifier: "ClientRequest__ThreadTurnsListParams" }); + export type ClientRequest__SkillsExtraRootsSetParams = { readonly extraRoots: ReadonlyArray; }; @@ -13818,11 +16871,20 @@ export const ClientRequest__SkillsConfigWriteParams = Schema.Struct({ }).annotate({ identifier: "ClientRequest__SkillsConfigWriteParams" }); export type ClientRequest__PluginInstallParams = { + readonly installAttemptId?: string | null; readonly marketplacePath?: ClientRequest__AbsolutePathBuf | null; readonly pluginName: string; readonly remoteMarketplaceName?: string | null; }; export const ClientRequest__PluginInstallParams = Schema.Struct({ + installAttemptId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Client-generated identifier used to correlate one installation attempt.", + }), + Schema.Null, + ]), + ), marketplacePath: Schema.optionalKey(Schema.Union([ClientRequest__AbsolutePathBuf, Schema.Null])), pluginName: Schema.String, remoteMarketplaceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -13830,6 +16892,7 @@ export const ClientRequest__PluginInstallParams = Schema.Struct({ export type ClientRequest__PluginListParams = { readonly cwds?: ReadonlyArray | null; + readonly forceRefetch?: boolean; readonly marketplaceKinds?: ReadonlyArray | null; }; export const ClientRequest__PluginListParams = Schema.Struct({ @@ -13842,6 +16905,11 @@ export const ClientRequest__PluginListParams = Schema.Struct({ Schema.Null, ]), ), + forceRefetch: Schema.optionalKey( + Schema.Boolean.annotate({ + description: "Whether the client requests a fresh remote plugin catalog fetch.", + }), + ), marketplaceKinds: Schema.optionalKey( Schema.Union([ Schema.Array(ClientRequest__PluginListMarketplaceKind).annotate({ @@ -13878,6 +16946,16 @@ export const ClientRequest__Settings = Schema.Struct({ identifier: "ClientRequest__Settings", }); +export type ClientRequest__ConfigurationReasoning = { + readonly effort: ClientRequest__ReasoningEffort; +}; +export const ClientRequest__ConfigurationReasoning = Schema.Struct({ + effort: ClientRequest__ReasoningEffort, +}).annotate({ + description: "Reasoning settings interpreted by the backend for the routed model.", + identifier: "ClientRequest__ConfigurationReasoning", +}); + export type ClientRequest__TextElement = { readonly byteRange: ClientRequest__ByteRange; readonly placeholder?: string | null; @@ -13900,8 +16978,13 @@ export type ClientRequest__FunctionCallOutputContentItem = | { readonly text: string; readonly type: "input_text" } | { readonly detail?: ClientRequest__ImageDetail | null; + readonly type: "input_image"; readonly image_url: string; + } + | { + readonly detail?: ClientRequest__ImageDetail | null; readonly type: "input_image"; + readonly file_id: string; } | { readonly audio_url: string; readonly type: "input_audio" } | { readonly encrypted_content: string; readonly type: "encrypted_content" }; @@ -13913,13 +16996,22 @@ export const ClientRequest__FunctionCallOutputContentItem = Schema.Union( title: "InputTextFunctionCallOutputContentItemType", }), }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), - image_url: Schema.String, - type: Schema.Literal("input_image").annotate({ - title: "InputImageFunctionCallOutputContentItemType", - }), - }).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), Schema.Struct({ audio_url: Schema.String, type: Schema.Literal("input_audio").annotate({ @@ -13944,8 +17036,13 @@ export type ClientRequest__ContentItem = | { readonly text: string; readonly type: "input_text" } | { readonly detail?: ClientRequest__ImageDetail | null; + readonly type: "input_image"; readonly image_url: string; + } + | { + readonly detail?: ClientRequest__ImageDetail | null; readonly type: "input_image"; + readonly file_id: string; } | { readonly audio_url: string; readonly type: "input_audio" } | { readonly text: string; readonly type: "output_text" }; @@ -13955,11 +17052,18 @@ export const ClientRequest__ContentItem = Schema.Union( text: Schema.String, type: Schema.Literal("input_text").annotate({ title: "InputTextContentItemType" }), }).annotate({ title: "InputTextContentItem" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), - image_url: Schema.String, - type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), - }).annotate({ title: "InputImageContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), + file_id: Schema.String, + }).annotate({ title: "FileIdContentItem" }), + ]).annotate({ title: "InputImageContentItem" }), Schema.Struct({ audio_url: Schema.String, type: Schema.Literal("input_audio").annotate({ title: "InputAudioContentItemType" }), @@ -14026,13 +17130,40 @@ export const ClientRequest__ReviewStartParams = Schema.Struct({ delivery: Schema.optionalKey( Schema.Union([ClientRequest__ReviewDelivery, Schema.Null]).annotate({ description: - "Where to run the review: inline (default) on the current thread or detached on a new thread (returned in `reviewThreadId`).", + "Where to run the review: inline (default) on the current thread or detached on a new thread (returned in `reviewThreadId`). Detached delivery is deprecated and emits `deprecationNotice`. Use `thread/start` followed by an inline review for a separate review thread.", }), ), target: ClientRequest__ReviewTarget, threadId: Schema.String, }).annotate({ identifier: "ClientRequest__ReviewStartParams" }); +export type ClientRequest__McpServerOauthLoginParams = { + readonly clientRegistration?: ClientRequest__McpServerOauthClientRegistration | null; + readonly name: string; + readonly scopes?: ReadonlyArray | null; + readonly threadId?: string | null; + readonly timeoutSecs?: number | null; +}; +export const ClientRequest__McpServerOauthLoginParams = Schema.Struct({ + clientRegistration: Schema.optionalKey( + Schema.Union([ClientRequest__McpServerOauthClientRegistration, Schema.Null]).annotate({ + description: + "Registration strategy for this login only; omission selects automatic discovery.", + }), + ), + name: Schema.String, + scopes: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), + threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + timeoutSecs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__McpServerOauthLoginParams" }); + export type ClientRequest__ListMcpServerStatusParams = { readonly cursor?: string | null; readonly detail?: ClientRequest__McpServerStatusDetail | null; @@ -14096,7 +17227,14 @@ export type ClientRequest__LoginAccountParams = readonly chatgptPlanType?: string | null; readonly type: "chatgptAuthTokens"; } - | { readonly apiKey: string; readonly region: string; readonly type: "amazonBedrock" }; + | { readonly apiKey: string; readonly region: string; readonly type: "amazonBedrock" } + | { + readonly accessKeyId: string; + readonly region: string; + readonly secretAccessKey: string; + readonly sessionToken?: string | null; + readonly type: "amazonBedrockAccessKeys"; + }; export const ClientRequest__LoginAccountParams = Schema.Union( [ Schema.Struct({ @@ -14149,6 +17287,18 @@ export const ClientRequest__LoginAccountParams = Schema.Union( title: "AmazonBedrockLoginAccountParams", description: "[UNSTABLE] Managed Amazon Bedrock login is experimental.", }), + Schema.Struct({ + accessKeyId: Schema.String, + region: Schema.String, + secretAccessKey: Schema.String, + sessionToken: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("amazonBedrockAccessKeys").annotate({ + title: "AmazonBedrockAccessKeysLoginAccountParamsType", + }), + }).annotate({ + title: "AmazonBedrockAccessKeysLoginAccountParams", + description: "[UNSTABLE] Managed Amazon Bedrock AWS access key login is experimental.", + }), ], { mode: "oneOf" }, ).annotate({ identifier: "ClientRequest__LoginAccountParams" }); @@ -14209,6 +17359,47 @@ export const ClientRequest__MigrationDetails = Schema.Struct({ ), }).annotate({ identifier: "ClientRequest__MigrationDetails" }); +export type ClientRequest__ExternalAgentConfigImportItemTypeFailure = { + readonly cwd?: string | null; + readonly errorType?: string | null; + readonly failureStage: string; + readonly itemType: ClientRequest__ExternalAgentConfigMigrationItemType; + readonly message: string; + readonly source?: string | null; + readonly subErrorType?: string | null; +}; +export const ClientRequest__ExternalAgentConfigImportItemTypeFailure = Schema.Struct({ + cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + errorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + failureStage: Schema.String, + itemType: ClientRequest__ExternalAgentConfigMigrationItemType, + message: Schema.String, + source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + subErrorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "ClientRequest__ExternalAgentConfigImportItemTypeFailure" }); + +export type ClientRequest__ExternalAgentConfigImportHistoryRecordSuccessParams = { + readonly cwd?: string | null; + readonly itemType: ClientRequest__ExternalAgentConfigMigrationItemType; + readonly source?: string | null; + readonly target?: string | null; + readonly title?: string | null; +}; +export const ClientRequest__ExternalAgentConfigImportHistoryRecordSuccessParams = Schema.Struct({ + cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + itemType: ClientRequest__ExternalAgentConfigMigrationItemType, + source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + title: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Original title for an imported session, when available.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__ExternalAgentConfigImportHistoryRecordSuccessParams" }); + export type ClientRequest__ConfigValueWriteParams = { readonly expectedVersion?: string | null; readonly filePath?: string | null; @@ -14247,7 +17438,7 @@ export type CommandExecutionRequestApprovalParams__CommandAction = | { readonly command: string; readonly name: string; - readonly path: CommandExecutionRequestApprovalParams__AbsolutePathBuf; + readonly path: CommandExecutionRequestApprovalParams__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -14263,7 +17454,7 @@ export const CommandExecutionRequestApprovalParams__CommandAction = Schema.Union Schema.Struct({ command: Schema.String, name: Schema.String, - path: CommandExecutionRequestApprovalParams__AbsolutePathBuf, + path: CommandExecutionRequestApprovalParams__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -14744,8 +17935,10 @@ export type ServerNotification__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -14767,8 +17960,10 @@ export const ServerNotification__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -14865,47 +18060,37 @@ export const ServerNotification__CodexErrorInfo = Schema.Union( identifier: "ServerNotification__CodexErrorInfo", }); -export type ServerNotification__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: ServerNotification__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } - | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const ServerNotification__CommandAction = Schema.Union( - [ - Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: ServerNotification__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), - Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), - ], - { mode: "oneOf" }, -).annotate({ identifier: "ServerNotification__CommandAction" }); +export type ServerNotification__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: ServerNotification__MisalignmentSteer | null; +}; +export const ServerNotification__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([ServerNotification__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "ServerNotification__MisalignmentErrorDetails" }); export type ServerNotification__FsChangedNotification = { readonly changedPaths: ReadonlyArray; @@ -14923,6 +18108,42 @@ export const ServerNotification__FsChangedNotification = Schema.Struct({ identifier: "ServerNotification__FsChangedNotification", }); +export type ServerNotification__Settings = { + readonly developer_instructions?: string | null; + readonly model: string; + readonly reasoning_effort?: ServerNotification__ReasoningEffort | null; +}; +export const ServerNotification__Settings = Schema.Struct({ + developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.String, + reasoning_effort: Schema.optionalKey( + Schema.Union([ServerNotification__ReasoningEffort, Schema.Null]), + ), +}).annotate({ + description: "Settings for a collaboration mode.", + identifier: "ServerNotification__Settings", +}); + +export type ServerNotification__ThreadSection = { + readonly appearance?: ServerNotification__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const ServerNotification__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([ServerNotification__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "ServerNotification__ThreadSection", +}); + export type ServerNotification__SubAgentSource = | "review" | "compact" @@ -15001,6 +18222,64 @@ export const ServerNotification__TextElement = Schema.Struct({ ), }).annotate({ identifier: "ServerNotification__TextElement" }); +export type ServerNotification__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: ServerNotification__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: ServerNotification__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const ServerNotification__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "ServerNotification__FunctionCallOutputContentItem", +}); + export type ServerNotification__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -15010,6 +18289,48 @@ export const ServerNotification__MemoryCitation = Schema.Struct({ threadIds: Schema.Array(Schema.String), }).annotate({ identifier: "ServerNotification__MemoryCitation" }); +export type ServerNotification__CommandAction = + | { + readonly command: string; + readonly name: string; + readonly path: ServerNotification__LegacyAppPathString; + readonly type: "read"; + } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } + | { + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly command: string; readonly type: "unknown" }; +export const ServerNotification__CommandAction = Schema.Union( + [ + Schema.Struct({ + command: Schema.String, + name: Schema.String, + path: ServerNotification__LegacyAppPathString, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), + Schema.Struct({ + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "ServerNotification__CommandAction" }); + export type ServerNotification__FileSystemSpecialPath = | { readonly kind: "root" } | { readonly kind: "minimal" } @@ -15066,6 +18387,19 @@ export const ServerNotification__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "ServerNotification__FileUpdateChange" }); +export type ServerNotification__McpAppUi = { + readonly preferredModelDisplayMode: ServerNotification__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const ServerNotification__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: ServerNotification__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "ServerNotification__McpAppUi", +}); + export type ServerNotification__CollabAgentState = { readonly message?: string | null; readonly status: ServerNotification__CollabAgentStatus; @@ -15075,20 +18409,22 @@ export const ServerNotification__CollabAgentState = Schema.Struct({ status: ServerNotification__CollabAgentStatus, }).annotate({ identifier: "ServerNotification__CollabAgentState" }); -export type ServerNotification__Settings = { - readonly developer_instructions?: string | null; - readonly model: string; - readonly reasoning_effort?: ServerNotification__ReasoningEffort | null; +export type ServerNotification__ThreadAttachmentUpdatedNotification = { + readonly attachmentId: string; + readonly attachmentType: string; + readonly identityKey: string; + readonly operation: ServerNotification__ThreadAttachmentOperation; + readonly threadId: string; }; -export const ServerNotification__Settings = Schema.Struct({ - developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.String, - reasoning_effort: Schema.optionalKey( - Schema.Union([ServerNotification__ReasoningEffort, Schema.Null]), - ), +export const ServerNotification__ThreadAttachmentUpdatedNotification = Schema.Struct({ + attachmentId: Schema.String, + attachmentType: Schema.String, + identityKey: Schema.String, + operation: ServerNotification__ThreadAttachmentOperation, + threadId: Schema.String, }).annotate({ - description: "Settings for a collaboration mode.", - identifier: "ServerNotification__Settings", + description: "Notification published after a thread attachment is created or deleted.", + identifier: "ServerNotification__ThreadAttachmentUpdatedNotification", }); export type ServerNotification__ThreadGoal = { @@ -15127,6 +18463,15 @@ export const ServerNotification__ThreadGoal = Schema.Struct({ ), }).annotate({ identifier: "ServerNotification__ThreadGoal" }); +export type ServerNotification__ProjectChangedNotification = { + readonly changeType: ServerNotification__ProjectChangeType; + readonly projectId: string; +}; +export const ServerNotification__ProjectChangedNotification = Schema.Struct({ + changeType: ServerNotification__ProjectChangeType, + projectId: Schema.String, +}).annotate({ identifier: "ServerNotification__ProjectChangedNotification" }); + export type ServerNotification__SandboxPolicy = | { readonly type: "dangerFullAccess" } | { readonly networkAccess?: boolean; readonly type: "readOnly" } @@ -15303,6 +18648,15 @@ export const ServerNotification__McpServerStatusUpdatedNotification = Schema.Str threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "ServerNotification__McpServerStatusUpdatedNotification" }); +export type ServerNotification__McpServerEventStreamNotification = { + readonly notification: ServerNotification__McpServerEventNotification; + readonly subscriptionId: string; +}; +export const ServerNotification__McpServerEventStreamNotification = Schema.Struct({ + notification: ServerNotification__McpServerEventNotification, + subscriptionId: Schema.String, +}).annotate({ identifier: "ServerNotification__McpServerEventStreamNotification" }); + export type ServerNotification__AccountUpdatedNotification = { readonly authMode?: ServerNotification__AuthMode | null; readonly planType?: ServerNotification__PlanType | null; @@ -15317,6 +18671,7 @@ export type ServerNotification__RateLimitSnapshot = { readonly individualLimit?: ServerNotification__SpendControlLimitSnapshot | null; readonly limitId?: string | null; readonly limitName?: string | null; + readonly normalModelSlug?: string | null; readonly planType?: ServerNotification__PlanType | null; readonly primary?: ServerNotification__RateLimitWindow | null; readonly rateLimitReachedType?: ServerNotification__RateLimitReachedType | null; @@ -15330,6 +18685,15 @@ export const ServerNotification__RateLimitSnapshot = Schema.Struct({ ), limitId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), limitName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + normalModelSlug: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Normal model whose display name and reasoning options describe this quota alias.", + }), + Schema.Null, + ]), + ), planType: Schema.optionalKey(Schema.Union([ServerNotification__PlanType, Schema.Null])), primary: Schema.optionalKey(Schema.Union([ServerNotification__RateLimitWindow, Schema.Null])), rateLimitReachedType: Schema.optionalKey( @@ -15351,7 +18715,6 @@ export type ServerNotification__AppMetadata = { readonly categories?: ReadonlyArray | null; readonly developer?: string | null; readonly firstPartyRequiresInstall?: boolean | null; - readonly firstPartyType?: string | null; readonly review?: ServerNotification__AppReview | null; readonly screenshots?: ReadonlyArray | null; readonly seoDescription?: string | null; @@ -15365,7 +18728,6 @@ export const ServerNotification__AppMetadata = Schema.Struct({ categories: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), developer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), firstPartyRequiresInstall: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - firstPartyType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), review: Schema.optionalKey(Schema.Union([ServerNotification__AppReview, Schema.Null])), screenshots: Schema.optionalKey( Schema.Union([Schema.Array(ServerNotification__AppScreenshot), Schema.Null]), @@ -15418,12 +18780,21 @@ export type ServerNotification__ExternalAgentConfigImportItemTypeSuccess = { readonly itemType: ServerNotification__ExternalAgentConfigMigrationItemType; readonly source?: string | null; readonly target?: string | null; + readonly title?: string | null; }; export const ServerNotification__ExternalAgentConfigImportItemTypeSuccess = Schema.Struct({ cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), itemType: ServerNotification__ExternalAgentConfigMigrationItemType, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + title: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Original title for an imported session; null for other item types.", + }), + Schema.Null, + ]), + ), }).annotate({ identifier: "ServerNotification__ExternalAgentConfigImportItemTypeSuccess" }); export type ServerNotification__ModelReroutedNotification = { @@ -15512,6 +18883,76 @@ export const ServerNotification__ThreadRealtimeStartedNotification = Schema.Stru identifier: "ServerNotification__ThreadRealtimeStartedNotification", }); +export type ServerNotification__ThreadRealtimeItem = + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly type: "realtimeSessionStarted"; + } + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly role: ServerNotification__ThreadRealtimeTranscriptRole; + readonly text: string; + readonly type: "transcriptSegment"; + } + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly item_id: string; + readonly presentation: ServerNotification__ThreadRealtimeBemItemPresentation; + readonly turn_id: string; + readonly type: "bemItemPromoted"; + } + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly outcome: ServerNotification__ThreadRealtimeSessionOutcome; + readonly type: "realtimeSessionClosed"; + }; +export const ServerNotification__ThreadRealtimeItem = Schema.Union( + [ + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + type: Schema.Literal("realtimeSessionStarted").annotate({ + title: "RealtimeSessionStartedThreadRealtimeItemType", + }), + }).annotate({ title: "RealtimeSessionStartedThreadRealtimeItem" }), + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + role: ServerNotification__ThreadRealtimeTranscriptRole, + text: Schema.String, + type: Schema.Literal("transcriptSegment").annotate({ + title: "TranscriptSegmentThreadRealtimeItemType", + }), + }).annotate({ title: "TranscriptSegmentThreadRealtimeItem" }), + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + item_id: Schema.String, + presentation: ServerNotification__ThreadRealtimeBemItemPresentation, + turn_id: Schema.String, + type: Schema.Literal("bemItemPromoted").annotate({ + title: "BemItemPromotedThreadRealtimeItemType", + }), + }).annotate({ title: "BemItemPromotedThreadRealtimeItem" }), + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + outcome: ServerNotification__ThreadRealtimeSessionOutcome, + type: Schema.Literal("realtimeSessionClosed").annotate({ + title: "RealtimeSessionClosedThreadRealtimeItemType", + }), + }).annotate({ title: "RealtimeSessionClosedThreadRealtimeItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: "EXPERIMENTAL - a thread-scoped realtime item in the canonical timeline.", + identifier: "ServerNotification__ThreadRealtimeItem", +}); + export type ServerNotification__ThreadRealtimeOutputAudioDeltaNotification = { readonly audio: ServerNotification__ThreadRealtimeAudioChunk; readonly threadId: string; @@ -15535,11 +18976,26 @@ export const ServerNotification__WindowsSandboxSetupCompletedNotification = Sche success: Schema.Boolean, }).annotate({ identifier: "ServerNotification__WindowsSandboxSetupCompletedNotification" }); +export type ServerNotification__AccountLoginCompletedNotification = { + readonly error?: string | null; + readonly loginId?: string | null; + readonly onboardingEntrypoint?: ServerNotification__DesktopOnboardingEntrypoint | null; + readonly success: boolean; +}; +export const ServerNotification__AccountLoginCompletedNotification = Schema.Struct({ + error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + loginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + onboardingEntrypoint: Schema.optionalKey( + Schema.Union([ServerNotification__DesktopOnboardingEntrypoint, Schema.Null]), + ), + success: Schema.Boolean, +}).annotate({ identifier: "ServerNotification__AccountLoginCompletedNotification" }); + export type ServerRequest__CommandAction = | { readonly command: string; readonly name: string; - readonly path: ServerRequest__AbsolutePathBuf; + readonly path: ServerRequest__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -15555,7 +19011,7 @@ export const ServerRequest__CommandAction = Schema.Union( Schema.Struct({ command: Schema.String, name: Schema.String, - path: ServerRequest__AbsolutePathBuf, + path: ServerRequest__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -15919,6 +19375,7 @@ export type V2AccountRateLimitsUpdatedNotification__RateLimitSnapshot = { readonly individualLimit?: V2AccountRateLimitsUpdatedNotification__SpendControlLimitSnapshot | null; readonly limitId?: string | null; readonly limitName?: string | null; + readonly normalModelSlug?: string | null; readonly planType?: V2AccountRateLimitsUpdatedNotification__PlanType | null; readonly primary?: V2AccountRateLimitsUpdatedNotification__RateLimitWindow | null; readonly rateLimitReachedType?: V2AccountRateLimitsUpdatedNotification__RateLimitReachedType | null; @@ -15934,6 +19391,15 @@ export const V2AccountRateLimitsUpdatedNotification__RateLimitSnapshot = Schema. ), limitId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), limitName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + normalModelSlug: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Normal model whose display name and reasoning options describe this quota alias.", + }), + Schema.Null, + ]), + ), planType: Schema.optionalKey( Schema.Union([V2AccountRateLimitsUpdatedNotification__PlanType, Schema.Null]), ), @@ -15961,7 +19427,6 @@ export type V2AppListUpdatedNotification__AppMetadata = { readonly categories?: ReadonlyArray | null; readonly developer?: string | null; readonly firstPartyRequiresInstall?: boolean | null; - readonly firstPartyType?: string | null; readonly review?: V2AppListUpdatedNotification__AppReview | null; readonly screenshots?: ReadonlyArray | null; readonly seoDescription?: string | null; @@ -15975,7 +19440,6 @@ export const V2AppListUpdatedNotification__AppMetadata = Schema.Struct({ categories: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), developer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), firstPartyRequiresInstall: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - firstPartyType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), review: Schema.optionalKey(Schema.Union([V2AppListUpdatedNotification__AppReview, Schema.Null])), screenshots: Schema.optionalKey( Schema.Union([Schema.Array(V2AppListUpdatedNotification__AppScreenshot), Schema.Null]), @@ -15992,7 +19456,6 @@ export type V2AppsListResponse__AppMetadata = { readonly categories?: ReadonlyArray | null; readonly developer?: string | null; readonly firstPartyRequiresInstall?: boolean | null; - readonly firstPartyType?: string | null; readonly review?: V2AppsListResponse__AppReview | null; readonly screenshots?: ReadonlyArray | null; readonly seoDescription?: string | null; @@ -16006,7 +19469,6 @@ export const V2AppsListResponse__AppMetadata = Schema.Struct({ categories: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), developer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), firstPartyRequiresInstall: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - firstPartyType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), review: Schema.optionalKey(Schema.Union([V2AppsListResponse__AppReview, Schema.Null])), screenshots: Schema.optionalKey( Schema.Union([Schema.Array(V2AppsListResponse__AppScreenshot), Schema.Null]), @@ -16021,16 +19483,24 @@ export const V2AppsListResponse__AppMetadata = Schema.Struct({ export type V2AppsReadResponse__ConnectorMetadata = { readonly description?: string | null; + readonly distributionChannel?: string | null; readonly iconUrl?: string | null; + readonly iconUrlDark?: string | null; readonly id: string; + readonly installUrl?: string | null; readonly name: string; + readonly pluginDisplayNames?: ReadonlyArray; readonly toolSummaries?: ReadonlyArray | null; }; export const V2AppsReadResponse__ConnectorMetadata = Schema.Struct({ description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + distributionChannel: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), iconUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + iconUrlDark: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), id: Schema.String, + installUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, + pluginDisplayNames: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), toolSummaries: Schema.optionalKey( Schema.Union([Schema.Array(V2AppsReadResponse__AppToolSummary), Schema.Null]), ), @@ -16099,6 +19569,52 @@ export const V2ConfigBatchWriteParams__ConfigEdit = Schema.Struct({ value: Schema.Json.annotate({ expected: "JSON value" }), }).annotate({ identifier: "V2ConfigBatchWriteParams__ConfigEdit" }); +export type V2ConfigReadResponse__BrowserUseOriginPolicyConfig = { + readonly access?: V2ConfigReadResponse__AllowDenyRequirement | null; + readonly downloads?: V2ConfigReadResponse__AllowDenyRequirement | null; + readonly full_cdp_access?: V2ConfigReadResponse__AllowDenyRequirement | null; + readonly uploads?: V2ConfigReadResponse__AllowDenyRequirement | null; +}; +export const V2ConfigReadResponse__BrowserUseOriginPolicyConfig = Schema.Struct({ + access: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AllowDenyRequirement, Schema.Null]), + ), + downloads: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AllowDenyRequirement, Schema.Null]), + ), + full_cdp_access: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AllowDenyRequirement, Schema.Null]), + ), + uploads: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AllowDenyRequirement, Schema.Null]), + ), +}).annotate({ identifier: "V2ConfigReadResponse__BrowserUseOriginPolicyConfig" }); + +export type V2ConfigReadResponse__ComputerUseMacosConfig = { + readonly bundle_ids?: { readonly [x: string]: V2ConfigReadResponse__AllowDenyRequirement } | null; +}; +export const V2ConfigReadResponse__ComputerUseMacosConfig = Schema.Struct({ + bundle_ids: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, V2ConfigReadResponse__AllowDenyRequirement), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ConfigReadResponse__ComputerUseMacosConfig" }); + +export type V2ConfigReadResponse__ComputerUseWindowsExeConfig = { + readonly access: V2ConfigReadResponse__AllowDenyRequirement; + readonly binary_name?: string | null; + readonly product_name: string; + readonly publisher_name: string; +}; +export const V2ConfigReadResponse__ComputerUseWindowsExeConfig = Schema.Struct({ + access: V2ConfigReadResponse__AllowDenyRequirement, + binary_name: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + product_name: Schema.String, + publisher_name: Schema.String, +}).annotate({ identifier: "V2ConfigReadResponse__ComputerUseWindowsExeConfig" }); + export type V2ConfigReadResponse__WebSearchToolConfig = { readonly allowed_domains?: ReadonlyArray | null; readonly context_size?: V2ConfigReadResponse__WebSearchContextSize | null; @@ -16115,6 +19631,7 @@ export const V2ConfigReadResponse__WebSearchToolConfig = Schema.Struct({ }).annotate({ identifier: "V2ConfigReadResponse__WebSearchToolConfig" }); export type V2ConfigReadResponse__ConfigLayerSource = + | { readonly file: V2ConfigReadResponse__AbsolutePathBuf; readonly type: "packagedDefaults" } | { readonly domain: string; readonly key: string; readonly type: "mdm" } | { readonly file: V2ConfigReadResponse__AbsolutePathBuf; readonly type: "system" } | { readonly id: string; readonly name: string; readonly type: "enterpriseManaged" } @@ -16132,6 +19649,18 @@ export type V2ConfigReadResponse__ConfigLayerSource = | { readonly type: "legacyManagedConfigTomlFromMdm" }; export const V2ConfigReadResponse__ConfigLayerSource = Schema.Union( [ + Schema.Struct({ + file: Schema.suspend( + (): Schema.Codec => + V2ConfigReadResponse__AbsolutePathBuf, + ).annotate({ description: "Path to the packaged default configuration file." }), + type: Schema.Literal("packagedDefaults").annotate({ + title: "PackagedDefaultsConfigLayerSourceType", + }), + }).annotate({ + title: "PackagedDefaultsConfigLayerSource", + description: "Default configuration supplied with the installed Codex package.", + }), Schema.Struct({ domain: Schema.String, key: Schema.String, @@ -16241,6 +19770,64 @@ export const V2ConfigReadResponse__AppsDefaultConfig = Schema.Struct({ open_world_enabled: Schema.optionalKey(Schema.Boolean.annotate({ default: true })), }).annotate({ identifier: "V2ConfigReadResponse__AppsDefaultConfig" }); +export type V2ConfigRequirementsReadResponse__ComputerUseMacosRequirements = { + readonly bundleIds?: { + readonly [x: string]: V2ConfigRequirementsReadResponse__AllowDenyRequirement; + } | null; +}; +export const V2ConfigRequirementsReadResponse__ComputerUseMacosRequirements = Schema.Struct({ + bundleIds: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, V2ConfigRequirementsReadResponse__AllowDenyRequirement), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ComputerUseMacosRequirements" }); + +export type V2ConfigRequirementsReadResponse__ComputerUseWindowsExeRequirement = { + readonly access: V2ConfigRequirementsReadResponse__AllowDenyRequirement; + readonly binaryName?: string | null; + readonly productName: string; + readonly publisherName: string; +}; +export const V2ConfigRequirementsReadResponse__ComputerUseWindowsExeRequirement = Schema.Struct({ + access: V2ConfigRequirementsReadResponse__AllowDenyRequirement, + binaryName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + productName: Schema.String, + publisherName: Schema.String, +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ComputerUseWindowsExeRequirement" }); + +export type V2ConfigRequirementsReadResponse__BrowserUseOriginPolicy = { + readonly access?: V2ConfigRequirementsReadResponse__AllowDenyRequirement | null; + readonly accessApprovalLifetime?: V2ConfigRequirementsReadResponse__BrowserUseAccessApprovalLifetime | null; + readonly autoReview?: V2ConfigRequirementsReadResponse__AllowDenyRequirement | null; + readonly downloads?: V2ConfigRequirementsReadResponse__AllowDenyRequirement | null; + readonly fullCdpAccess?: V2ConfigRequirementsReadResponse__AllowDenyRequirement | null; + readonly persistentApproval?: boolean | null; + readonly uploads?: V2ConfigRequirementsReadResponse__AllowDenyRequirement | null; +}; +export const V2ConfigRequirementsReadResponse__BrowserUseOriginPolicy = Schema.Struct({ + access: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__AllowDenyRequirement, Schema.Null]), + ), + accessApprovalLifetime: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__BrowserUseAccessApprovalLifetime, Schema.Null]), + ), + autoReview: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__AllowDenyRequirement, Schema.Null]), + ), + downloads: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__AllowDenyRequirement, Schema.Null]), + ), + fullCdpAccess: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__AllowDenyRequirement, Schema.Null]), + ), + persistentApproval: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + uploads: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__AllowDenyRequirement, Schema.Null]), + ), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__BrowserUseOriginPolicy" }); + export type V2ConfigRequirementsReadResponse__NewThreadModelDefaults = { readonly model?: string | null; readonly modelReasoningEffort?: V2ConfigRequirementsReadResponse__ReasoningEffort | null; @@ -16254,6 +19841,19 @@ export const V2ConfigRequirementsReadResponse__NewThreadModelDefaults = Schema.S serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2ConfigRequirementsReadResponse__NewThreadModelDefaults" }); +export type V2ConfigRequirementsReadResponse__ApplicationNetworkRequirements = { + readonly domains: { + readonly [x: string]: V2ConfigRequirementsReadResponse__NetworkDomainPermission; + }; + readonly enabled: boolean; +}; +export const V2ConfigRequirementsReadResponse__ApplicationNetworkRequirements = Schema.Struct({ + domains: Schema.Record(Schema.String, V2ConfigRequirementsReadResponse__NetworkDomainPermission), + enabled: Schema.Boolean.annotate({ + description: "When enabled, only explicitly allowed exact domains may be contacted.", + }), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ApplicationNetworkRequirements" }); + export type V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup = { readonly hooks: ReadonlyArray; readonly matcher?: string | null; @@ -16273,6 +19873,7 @@ export const V2ConfigWarningNotification__TextRange = Schema.Struct({ }).annotate({ identifier: "V2ConfigWarningNotification__TextRange" }); export type V2ConfigWriteResponse__ConfigLayerSource = + | { readonly file: V2ConfigWriteResponse__AbsolutePathBuf; readonly type: "packagedDefaults" } | { readonly domain: string; readonly key: string; readonly type: "mdm" } | { readonly file: V2ConfigWriteResponse__AbsolutePathBuf; readonly type: "system" } | { readonly id: string; readonly name: string; readonly type: "enterpriseManaged" } @@ -16290,6 +19891,18 @@ export type V2ConfigWriteResponse__ConfigLayerSource = | { readonly type: "legacyManagedConfigTomlFromMdm" }; export const V2ConfigWriteResponse__ConfigLayerSource = Schema.Union( [ + Schema.Struct({ + file: Schema.suspend( + (): Schema.Codec => + V2ConfigWriteResponse__AbsolutePathBuf, + ).annotate({ description: "Path to the packaged default configuration file." }), + type: Schema.Literal("packagedDefaults").annotate({ + title: "PackagedDefaultsConfigLayerSourceType", + }), + }).annotate({ + title: "PackagedDefaultsConfigLayerSource", + description: "Default configuration supplied with the installed Codex package.", + }), Schema.Struct({ domain: Schema.String, key: Schema.String, @@ -16384,8 +19997,10 @@ export type V2ErrorNotification__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -16407,8 +20022,10 @@ export const V2ErrorNotification__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -16507,6 +20124,38 @@ export const V2ErrorNotification__CodexErrorInfo = Schema.Union( identifier: "V2ErrorNotification__CodexErrorInfo", }); +export type V2ErrorNotification__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ErrorNotification__MisalignmentSteer | null; +}; +export const V2ErrorNotification__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ErrorNotification__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ErrorNotification__MisalignmentErrorDetails" }); + export type V2ExperimentalFeatureListResponse__ExperimentalFeature = { readonly announcement?: string | null; readonly defaultEnabled: boolean; @@ -16559,6 +20208,26 @@ export const V2ExperimentalFeatureListResponse__ExperimentalFeature = Schema.Str ).annotate({ description: "Lifecycle stage of this feature flag." }), }).annotate({ identifier: "V2ExperimentalFeatureListResponse__ExperimentalFeature" }); +export type V2ExternalAgentConfigDetectResponse__ExternalAgentDetectedConnectorCandidate = { + readonly name: string; + readonly sessionCount: number; + readonly source: V2ExternalAgentConfigDetectResponse__ExternalAgentDetectedConnectorSource; +}; +export const V2ExternalAgentConfigDetectResponse__ExternalAgentDetectedConnectorCandidate = + Schema.Struct({ + name: Schema.String, + sessionCount: Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + source: V2ExternalAgentConfigDetectResponse__ExternalAgentDetectedConnectorSource, + }).annotate({ + identifier: "V2ExternalAgentConfigDetectResponse__ExternalAgentDetectedConnectorCandidate", + }); + export type V2ExternalAgentConfigDetectResponse__MigrationDetails = { readonly commands?: ReadonlyArray; readonly hooks?: ReadonlyArray; @@ -16625,6 +20294,7 @@ export type V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfi readonly itemType: V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType; readonly source?: string | null; readonly target?: string | null; + readonly title?: string | null; }; export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigImportItemTypeSuccess = Schema.Struct({ @@ -16633,6 +20303,14 @@ export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConf V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + title: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Original title for an imported session; null for other item types.", + }), + Schema.Null, + ]), + ), }).annotate({ identifier: "V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigImportItemTypeSuccess", @@ -16691,6 +20369,7 @@ export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfi readonly itemType: V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType; readonly source?: string | null; readonly target?: string | null; + readonly title?: string | null; }; export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeSuccess = Schema.Struct({ @@ -16699,11 +20378,70 @@ export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConf V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + title: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Original title for an imported session; null for other item types.", + }), + Schema.Null, + ]), + ), }).annotate({ identifier: "V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeSuccess", }); +export type V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportItemTypeFailure = + { + readonly cwd?: string | null; + readonly errorType?: string | null; + readonly failureStage: string; + readonly itemType: V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigMigrationItemType; + readonly message: string; + readonly source?: string | null; + readonly subErrorType?: string | null; + }; +export const V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportItemTypeFailure = + Schema.Struct({ + cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + errorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + failureStage: Schema.String, + itemType: V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigMigrationItemType, + message: Schema.String, + source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + subErrorType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportItemTypeFailure", + }); + +export type V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportHistoryRecordSuccessParams = + { + readonly cwd?: string | null; + readonly itemType: V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigMigrationItemType; + readonly source?: string | null; + readonly target?: string | null; + readonly title?: string | null; + }; +export const V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportHistoryRecordSuccessParams = + Schema.Struct({ + cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + itemType: V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigMigrationItemType, + source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + title: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Original title for an imported session, when available.", + }), + Schema.Null, + ]), + ), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportHistoryRecordSuccessParams", + }); + export type V2ExternalAgentConfigImportParams__MigrationDetails = { readonly commands?: ReadonlyArray; readonly hooks?: ReadonlyArray; @@ -16769,6 +20507,7 @@ export type V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfig readonly itemType: V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigMigrationItemType; readonly source?: string | null; readonly target?: string | null; + readonly title?: string | null; }; export const V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigImportItemTypeSuccess = Schema.Struct({ @@ -16776,6 +20515,14 @@ export const V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfi itemType: V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigMigrationItemType, source: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), target: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + title: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Original title for an imported session; null for other item types.", + }), + Schema.Null, + ]), + ), }).annotate({ identifier: "V2ExternalAgentConfigImportProgressNotification__ExternalAgentConfigImportItemTypeSuccess", @@ -16843,6 +20590,7 @@ export type V2GetAccountRateLimitsResponse__RateLimitSnapshot = { readonly individualLimit?: V2GetAccountRateLimitsResponse__SpendControlLimitSnapshot | null; readonly limitId?: string | null; readonly limitName?: string | null; + readonly normalModelSlug?: string | null; readonly planType?: V2GetAccountRateLimitsResponse__PlanType | null; readonly primary?: V2GetAccountRateLimitsResponse__RateLimitWindow | null; readonly rateLimitReachedType?: V2GetAccountRateLimitsResponse__RateLimitReachedType | null; @@ -16858,6 +20606,15 @@ export const V2GetAccountRateLimitsResponse__RateLimitSnapshot = Schema.Struct({ ), limitId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), limitName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + normalModelSlug: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Normal model whose display name and reasoning options describe this quota alias.", + }), + Schema.Null, + ]), + ), planType: Schema.optionalKey( Schema.Union([V2GetAccountRateLimitsResponse__PlanType, Schema.Null]), ), @@ -16907,6 +20664,28 @@ export const V2GetAccountResponse__Account = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2GetAccountResponse__Account" }); +export type V2GetAccountTokenUsageResponse__ThreadUsage = { + readonly estimatedUsageCreditsMicros: number; + readonly estimatedUsageUsdMicros?: number | null; + readonly groups: ReadonlyArray; + readonly threadId: string; +}; +export const V2GetAccountTokenUsageResponse__ThreadUsage = Schema.Struct({ + estimatedUsageCreditsMicros: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + estimatedUsageUsdMicros: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + groups: Schema.Array(V2GetAccountTokenUsageResponse__ThreadUsageBreakdownGroup), + threadId: Schema.String, +}).annotate({ identifier: "V2GetAccountTokenUsageResponse__ThreadUsage" }); + export type V2GetWorkspaceMessagesResponse__WorkspaceMessage = { readonly archivedAt?: number | null; readonly createdAt?: number | null; @@ -16947,46 +20726,248 @@ export const V2HookCompletedNotification__HookOutputEntry = Schema.Struct({ text: Schema.String, }).annotate({ identifier: "V2HookCompletedNotification__HookOutputEntry" }); -export type V2HooksListResponse__HookMetadata = { - readonly command?: string | null; - readonly currentHash: string; - readonly displayOrder: number; - readonly enabled: boolean; - readonly eventName: V2HooksListResponse__HookEventName; - readonly handlerType: V2HooksListResponse__HookHandlerType; - readonly isManaged: boolean; - readonly key: string; - readonly matcher?: string | null; - readonly pluginId?: string | null; - readonly source: V2HooksListResponse__HookSource; - readonly sourcePath: V2HooksListResponse__AbsolutePathBuf; - readonly statusMessage?: string | null; - readonly timeoutSec: number; - readonly trustStatus: V2HooksListResponse__HookTrustStatus; -}; -export const V2HooksListResponse__HookMetadata = Schema.Struct({ - command: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - currentHash: Schema.String, - displayOrder: Schema.Number.annotate({ format: "int64" }).check( - Schema.isInt().annotate({ expected: "an integer" }), - ), - enabled: Schema.Boolean, - eventName: V2HooksListResponse__HookEventName, - handlerType: V2HooksListResponse__HookHandlerType, - isManaged: Schema.Boolean, - key: Schema.String, - matcher: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - source: V2HooksListResponse__HookSource, - sourcePath: V2HooksListResponse__AbsolutePathBuf, - statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - timeoutSec: Schema.Number.annotate({ format: "uint64" }) - .check(Schema.isInt().annotate({ expected: "an integer" })) - .check( - Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), - ), - trustStatus: V2HooksListResponse__HookTrustStatus, -}).annotate({ identifier: "V2HooksListResponse__HookMetadata" }); +export type V2HooksListResponse__HookMetadata = + | { + readonly additionalContextLimit?: number | null; + readonly currentHash: string; + readonly displayOrder: number; + readonly enabled: boolean; + readonly eventName: V2HooksListResponse__HookEventName; + readonly isManaged: boolean; + readonly key: string; + readonly matcher?: string | null; + readonly pluginId?: string | null; + readonly source: V2HooksListResponse__HookSource; + readonly sourcePath: V2HooksListResponse__AbsolutePathBuf; + readonly statusMessage?: string | null; + readonly timeoutSec: number; + readonly trustStatus: V2HooksListResponse__HookTrustStatus; + readonly async?: boolean; + readonly command: string; + readonly handlerType: "command"; + } + | { + readonly additionalContextLimit?: number | null; + readonly currentHash: string; + readonly displayOrder: number; + readonly enabled: boolean; + readonly eventName: V2HooksListResponse__HookEventName; + readonly isManaged: boolean; + readonly key: string; + readonly matcher?: string | null; + readonly pluginId?: string | null; + readonly source: V2HooksListResponse__HookSource; + readonly sourcePath: V2HooksListResponse__AbsolutePathBuf; + readonly statusMessage?: string | null; + readonly timeoutSec: number; + readonly trustStatus: V2HooksListResponse__HookTrustStatus; + readonly handlerType: "mcpTool"; + readonly server: string; + readonly tool: string; + } + | { + readonly additionalContextLimit?: number | null; + readonly currentHash: string; + readonly displayOrder: number; + readonly enabled: boolean; + readonly eventName: V2HooksListResponse__HookEventName; + readonly isManaged: boolean; + readonly key: string; + readonly matcher?: string | null; + readonly pluginId?: string | null; + readonly source: V2HooksListResponse__HookSource; + readonly sourcePath: V2HooksListResponse__AbsolutePathBuf; + readonly statusMessage?: string | null; + readonly timeoutSec: number; + readonly trustStatus: V2HooksListResponse__HookTrustStatus; + readonly handlerType: "prompt"; + } + | { + readonly additionalContextLimit?: number | null; + readonly currentHash: string; + readonly displayOrder: number; + readonly enabled: boolean; + readonly eventName: V2HooksListResponse__HookEventName; + readonly isManaged: boolean; + readonly key: string; + readonly matcher?: string | null; + readonly pluginId?: string | null; + readonly source: V2HooksListResponse__HookSource; + readonly sourcePath: V2HooksListResponse__AbsolutePathBuf; + readonly statusMessage?: string | null; + readonly timeoutSec: number; + readonly trustStatus: V2HooksListResponse__HookTrustStatus; + readonly handlerType: "agent"; + }; +export const V2HooksListResponse__HookMetadata = Schema.Union( + [ + Schema.Struct({ + additionalContextLimit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Configured `additionalContext` spill threshold. `null` uses 2,500 tokens; `0` disables spilling.", + format: "uint", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + currentHash: Schema.String, + displayOrder: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + enabled: Schema.Boolean, + eventName: V2HooksListResponse__HookEventName, + isManaged: Schema.Boolean, + key: Schema.String, + matcher: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + source: V2HooksListResponse__HookSource, + sourcePath: V2HooksListResponse__AbsolutePathBuf, + statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + timeoutSec: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + trustStatus: V2HooksListResponse__HookTrustStatus, + async: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + command: Schema.String, + handlerType: Schema.Literal("command"), + }), + Schema.Struct({ + additionalContextLimit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Configured `additionalContext` spill threshold. `null` uses 2,500 tokens; `0` disables spilling.", + format: "uint", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + currentHash: Schema.String, + displayOrder: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + enabled: Schema.Boolean, + eventName: V2HooksListResponse__HookEventName, + isManaged: Schema.Boolean, + key: Schema.String, + matcher: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + source: V2HooksListResponse__HookSource, + sourcePath: V2HooksListResponse__AbsolutePathBuf, + statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + timeoutSec: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + trustStatus: V2HooksListResponse__HookTrustStatus, + handlerType: Schema.Literal("mcpTool"), + server: Schema.String, + tool: Schema.String, + }), + Schema.Struct({ + additionalContextLimit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Configured `additionalContext` spill threshold. `null` uses 2,500 tokens; `0` disables spilling.", + format: "uint", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + currentHash: Schema.String, + displayOrder: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + enabled: Schema.Boolean, + eventName: V2HooksListResponse__HookEventName, + isManaged: Schema.Boolean, + key: Schema.String, + matcher: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + source: V2HooksListResponse__HookSource, + sourcePath: V2HooksListResponse__AbsolutePathBuf, + statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + timeoutSec: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + trustStatus: V2HooksListResponse__HookTrustStatus, + handlerType: Schema.Literal("prompt"), + }).annotate({ title: "PromptHookMetadata" }), + Schema.Struct({ + additionalContextLimit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Configured `additionalContext` spill threshold. `null` uses 2,500 tokens; `0` disables spilling.", + format: "uint", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + currentHash: Schema.String, + displayOrder: Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + enabled: Schema.Boolean, + eventName: V2HooksListResponse__HookEventName, + isManaged: Schema.Boolean, + key: Schema.String, + matcher: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + source: V2HooksListResponse__HookSource, + sourcePath: V2HooksListResponse__AbsolutePathBuf, + statusMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + timeoutSec: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + trustStatus: V2HooksListResponse__HookTrustStatus, + handlerType: Schema.Literal("agent"), + }).annotate({ title: "AgentHookMetadata" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2HooksListResponse__HookMetadata" }); export type V2HookStartedNotification__HookOutputEntry = { readonly kind: V2HookStartedNotification__HookOutputEntryKind; @@ -17016,6 +20997,68 @@ export const V2ItemCompletedNotification__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ItemCompletedNotification__TextElement" }); +export type V2ItemCompletedNotification__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ItemCompletedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ItemCompletedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ItemCompletedNotification__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ItemCompletedNotification__FunctionCallOutputContentItem", +}); + export type V2ItemCompletedNotification__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -17029,7 +21072,7 @@ export type V2ItemCompletedNotification__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2ItemCompletedNotification__AbsolutePathBuf; + readonly path: V2ItemCompletedNotification__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -17045,7 +21088,7 @@ export const V2ItemCompletedNotification__CommandAction = Schema.Union( Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2ItemCompletedNotification__AbsolutePathBuf, + path: V2ItemCompletedNotification__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -17078,6 +21121,19 @@ export const V2ItemCompletedNotification__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "V2ItemCompletedNotification__FileUpdateChange" }); +export type V2ItemCompletedNotification__McpAppUi = { + readonly preferredModelDisplayMode: V2ItemCompletedNotification__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ItemCompletedNotification__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ItemCompletedNotification__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ItemCompletedNotification__McpAppUi", +}); + export type V2ItemCompletedNotification__CollabAgentState = { readonly message?: string | null; readonly status: V2ItemCompletedNotification__CollabAgentStatus; @@ -17268,6 +21324,68 @@ export const V2ItemStartedNotification__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ItemStartedNotification__TextElement" }); +export type V2ItemStartedNotification__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ItemStartedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ItemStartedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ItemStartedNotification__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ItemStartedNotification__FunctionCallOutputContentItem", +}); + export type V2ItemStartedNotification__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -17281,7 +21399,7 @@ export type V2ItemStartedNotification__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2ItemStartedNotification__AbsolutePathBuf; + readonly path: V2ItemStartedNotification__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -17297,7 +21415,7 @@ export const V2ItemStartedNotification__CommandAction = Schema.Union( Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2ItemStartedNotification__AbsolutePathBuf, + path: V2ItemStartedNotification__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -17330,6 +21448,19 @@ export const V2ItemStartedNotification__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "V2ItemStartedNotification__FileUpdateChange" }); +export type V2ItemStartedNotification__McpAppUi = { + readonly preferredModelDisplayMode: V2ItemStartedNotification__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ItemStartedNotification__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ItemStartedNotification__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ItemStartedNotification__McpAppUi", +}); + export type V2ItemStartedNotification__CollabAgentState = { readonly message?: string | null; readonly status: V2ItemStartedNotification__CollabAgentStatus; @@ -17342,22 +21473,60 @@ export const V2ItemStartedNotification__CollabAgentState = Schema.Struct({ export type V2ListMcpServerStatusResponse__McpServerStatus = { readonly authStatus: V2ListMcpServerStatusResponse__McpAuthStatus; readonly name: string; + readonly pluginId?: string | null; readonly resourceTemplates: ReadonlyArray; readonly resources: ReadonlyArray; + readonly runtimeStatus?: V2ListMcpServerStatusResponse__McpServerConnectionStatus | null; + readonly serverCapabilities?: Schema.Json; readonly serverInfo?: V2ListMcpServerStatusResponse__McpServerInfo | null; readonly tools: { readonly [x: string]: V2ListMcpServerStatusResponse__Tool }; + readonly toolsError?: string | null; }; export const V2ListMcpServerStatusResponse__McpServerStatus = Schema.Struct({ authStatus: V2ListMcpServerStatusResponse__McpAuthStatus, name: Schema.String, + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), resourceTemplates: Schema.Array(V2ListMcpServerStatusResponse__ResourceTemplate), resources: Schema.Array(V2ListMcpServerStatusResponse__Resource), + runtimeStatus: Schema.optionalKey( + Schema.Union([V2ListMcpServerStatusResponse__McpServerConnectionStatus, Schema.Null]).annotate({ + description: + "Current thread-runtime connection state; null when unavailable or the configuration changed.", + }), + ), + serverCapabilities: Schema.optionalKey( + Schema.Json.annotate({ + expected: "JSON value", + description: "Capabilities advertised by the initialized MCP server; null when unavailable.", + }), + ), serverInfo: Schema.optionalKey( Schema.Union([V2ListMcpServerStatusResponse__McpServerInfo, Schema.Null]), ), tools: Schema.Record(Schema.String, V2ListMcpServerStatusResponse__Tool), + toolsError: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Tool discovery failed and no catalog was returned. Null when a catalog is returned, including cached or empty catalogs.", + }), + Schema.Null, + ]), + ), }).annotate({ identifier: "V2ListMcpServerStatusResponse__McpServerStatus" }); +export type V2ModelListResponse__ModelAccessPrograms = { + readonly cyber: ReadonlyArray; +}; +export const V2ModelListResponse__ModelAccessPrograms = Schema.Struct({ + cyber: Schema.Array(V2ModelListResponse__CyberAccessProgram).annotate({ + description: "Accepted explicit selections.", + }), +}).annotate({ + description: "Caller-specific explicit access programs advertised by model discovery.", + identifier: "V2ModelListResponse__ModelAccessPrograms", +}); + export type V2ModelListResponse__ReasoningEffortOption = { readonly description: string; readonly reasoningEffort: V2ModelListResponse__ReasoningEffort; @@ -17732,7 +21901,9 @@ export type V2PluginReadResponse__SkillInterface = { readonly defaultPrompt?: string | null; readonly displayName?: string | null; readonly iconLarge?: V2PluginReadResponse__AbsolutePathBuf | null; + readonly iconLargeUrl?: string | null; readonly iconSmall?: V2PluginReadResponse__AbsolutePathBuf | null; + readonly iconSmallUrl?: string | null; readonly shortDescription?: string | null; }; export const V2PluginReadResponse__SkillInterface = Schema.Struct({ @@ -17740,7 +21911,19 @@ export const V2PluginReadResponse__SkillInterface = Schema.Struct({ defaultPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), displayName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), iconLarge: Schema.optionalKey(Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null])), + iconLargeUrl: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Remote large icon URL from the plugin catalog." }), + Schema.Null, + ]), + ), iconSmall: Schema.optionalKey(Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null])), + iconSmallUrl: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Remote small icon URL from the plugin catalog." }), + Schema.Null, + ]), + ), shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2PluginReadResponse__SkillInterface" }); @@ -18136,8 +22319,13 @@ export type V2RawResponseItemCompletedNotification__ContentItem = | { readonly text: string; readonly type: "input_text" } | { readonly detail?: V2RawResponseItemCompletedNotification__ImageDetail | null; + readonly type: "input_image"; readonly image_url: string; + } + | { + readonly detail?: V2RawResponseItemCompletedNotification__ImageDetail | null; readonly type: "input_image"; + readonly file_id: string; } | { readonly audio_url: string; readonly type: "input_audio" } | { readonly text: string; readonly type: "output_text" }; @@ -18147,13 +22335,22 @@ export const V2RawResponseItemCompletedNotification__ContentItem = Schema.Union( text: Schema.String, type: Schema.Literal("input_text").annotate({ title: "InputTextContentItemType" }), }).annotate({ title: "InputTextContentItem" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2RawResponseItemCompletedNotification__ImageDetail, Schema.Null]), - ), - image_url: Schema.String, - type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), - }).annotate({ title: "InputImageContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2RawResponseItemCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2RawResponseItemCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), + file_id: Schema.String, + }).annotate({ title: "FileIdContentItem" }), + ]).annotate({ title: "InputImageContentItem" }), Schema.Struct({ audio_url: Schema.String, type: Schema.Literal("input_audio").annotate({ title: "InputAudioContentItemType" }), @@ -18170,8 +22367,13 @@ export type V2RawResponseItemCompletedNotification__FunctionCallOutputContentIte | { readonly text: string; readonly type: "input_text" } | { readonly detail?: V2RawResponseItemCompletedNotification__ImageDetail | null; + readonly type: "input_image"; readonly image_url: string; + } + | { + readonly detail?: V2RawResponseItemCompletedNotification__ImageDetail | null; readonly type: "input_image"; + readonly file_id: string; } | { readonly audio_url: string; readonly type: "input_audio" } | { readonly encrypted_content: string; readonly type: "encrypted_content" }; @@ -18183,15 +22385,26 @@ export const V2RawResponseItemCompletedNotification__FunctionCallOutputContentIt title: "InputTextFunctionCallOutputContentItemType", }), }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2RawResponseItemCompletedNotification__ImageDetail, Schema.Null]), - ), - image_url: Schema.String, - type: Schema.Literal("input_image").annotate({ - title: "InputImageFunctionCallOutputContentItemType", - }), - }).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2RawResponseItemCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2RawResponseItemCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), Schema.Struct({ audio_url: Schema.String, type: Schema.Literal("input_audio").annotate({ @@ -18212,12 +22425,24 @@ export const V2RawResponseItemCompletedNotification__FunctionCallOutputContentIt identifier: "V2RawResponseItemCompletedNotification__FunctionCallOutputContentItem", }); +export type V2RawResponseItemCompletedNotification__ConfigurationReasoning = { + readonly effort: V2RawResponseItemCompletedNotification__ReasoningEffort; +}; +export const V2RawResponseItemCompletedNotification__ConfigurationReasoning = Schema.Struct({ + effort: V2RawResponseItemCompletedNotification__ReasoningEffort, +}).annotate({ + description: "Reasoning settings interpreted by the backend for the routed model.", + identifier: "V2RawResponseItemCompletedNotification__ConfigurationReasoning", +}); + export type V2ReviewStartResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -18239,8 +22464,10 @@ export const V2ReviewStartResponse__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -18339,6 +22566,38 @@ export const V2ReviewStartResponse__CodexErrorInfo = Schema.Union( identifier: "V2ReviewStartResponse__CodexErrorInfo", }); +export type V2ReviewStartResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ReviewStartResponse__MisalignmentSteer | null; +}; +export const V2ReviewStartResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ReviewStartResponse__MisalignmentErrorDetails" }); + export type V2ReviewStartResponse__TextElement = { readonly byteRange: V2ReviewStartResponse__ByteRange; readonly placeholder?: string | null; @@ -18357,6 +22616,64 @@ export const V2ReviewStartResponse__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ReviewStartResponse__TextElement" }); +export type V2ReviewStartResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ReviewStartResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ReviewStartResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ReviewStartResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ReviewStartResponse__FunctionCallOutputContentItem", +}); + export type V2ReviewStartResponse__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -18370,7 +22687,7 @@ export type V2ReviewStartResponse__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2ReviewStartResponse__AbsolutePathBuf; + readonly path: V2ReviewStartResponse__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -18386,7 +22703,7 @@ export const V2ReviewStartResponse__CommandAction = Schema.Union( Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2ReviewStartResponse__AbsolutePathBuf, + path: V2ReviewStartResponse__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -18419,6 +22736,19 @@ export const V2ReviewStartResponse__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "V2ReviewStartResponse__FileUpdateChange" }); +export type V2ReviewStartResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ReviewStartResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ReviewStartResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ReviewStartResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ReviewStartResponse__McpAppUi", +}); + export type V2ReviewStartResponse__CollabAgentState = { readonly message?: string | null; readonly status: V2ReviewStartResponse__CollabAgentStatus; @@ -18440,7 +22770,9 @@ export type V2SkillsListResponse__SkillInterface = { readonly defaultPrompt?: string | null; readonly displayName?: string | null; readonly iconLarge?: V2SkillsListResponse__AbsolutePathBuf | null; + readonly iconLargeUrl?: string | null; readonly iconSmall?: V2SkillsListResponse__AbsolutePathBuf | null; + readonly iconSmallUrl?: string | null; readonly shortDescription?: string | null; }; export const V2SkillsListResponse__SkillInterface = Schema.Struct({ @@ -18448,7 +22780,19 @@ export const V2SkillsListResponse__SkillInterface = Schema.Struct({ defaultPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), displayName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), iconLarge: Schema.optionalKey(Schema.Union([V2SkillsListResponse__AbsolutePathBuf, Schema.Null])), + iconLargeUrl: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Remote large icon URL from the plugin catalog." }), + Schema.Null, + ]), + ), iconSmall: Schema.optionalKey(Schema.Union([V2SkillsListResponse__AbsolutePathBuf, Schema.Null])), + iconSmallUrl: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Remote small icon URL from the plugin catalog." }), + Schema.Null, + ]), + ), shortDescription: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ identifier: "V2SkillsListResponse__SkillInterface" }); @@ -18456,7 +22800,7 @@ export type V2ThreadForkResponse__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2ThreadForkResponse__AbsolutePathBuf; + readonly path: V2ThreadForkResponse__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -18472,7 +22816,7 @@ export const V2ThreadForkResponse__CommandAction = Schema.Union( Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2ThreadForkResponse__AbsolutePathBuf, + path: V2ThreadForkResponse__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -18543,6 +22887,26 @@ export const V2ThreadForkResponse__SandboxPolicy = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadForkResponse__SandboxPolicy" }); +export type V2ThreadForkResponse__ThreadSection = { + readonly appearance?: V2ThreadForkResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadForkResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadForkResponse__ThreadSection", +}); + export type V2ThreadForkResponse__SubAgentSource = | "review" | "compact" @@ -18609,15 +22973,15 @@ export type V2ThreadForkResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" - | "rateLimitExceeded" - | "misalignmentPolicyViolation" | "other" | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } @@ -18634,15 +22998,15 @@ export const V2ThreadForkResponse__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", "threadRollbackFailed", "sandboxError", - "rateLimitExceeded", - "misalignmentPolicyViolation", "other", ]), Schema.Struct({ @@ -18736,6 +23100,38 @@ export const V2ThreadForkResponse__CodexErrorInfo = Schema.Union( identifier: "V2ThreadForkResponse__CodexErrorInfo", }); +export type V2ThreadForkResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadForkResponse__MisalignmentSteer | null; +}; +export const V2ThreadForkResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadForkResponse__MisalignmentErrorDetails" }); + export type V2ThreadForkResponse__TextElement = { readonly byteRange: V2ThreadForkResponse__ByteRange; readonly placeholder?: string | null; @@ -18754,6 +23150,64 @@ export const V2ThreadForkResponse__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ThreadForkResponse__TextElement" }); +export type V2ThreadForkResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadForkResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadForkResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadForkResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadForkResponse__FunctionCallOutputContentItem", +}); + export type V2ThreadForkResponse__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -18774,6 +23228,19 @@ export const V2ThreadForkResponse__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "V2ThreadForkResponse__FileUpdateChange" }); +export type V2ThreadForkResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadForkResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadForkResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadForkResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadForkResponse__McpAppUi", +}); + export type V2ThreadForkResponse__CollabAgentState = { readonly message?: string | null; readonly status: V2ThreadForkResponse__CollabAgentStatus; @@ -18891,11 +23358,100 @@ export const V2ThreadGoalUpdatedNotification__ThreadGoal = Schema.Struct({ ), }).annotate({ identifier: "V2ThreadGoalUpdatedNotification__ThreadGoal" }); -export type V2ThreadListResponse__CommandAction = +export type V2ThreadItemsListResponse__TextElement = { + readonly byteRange: V2ThreadItemsListResponse__ByteRange; + readonly placeholder?: string | null; +}; +export const V2ThreadItemsListResponse__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2ThreadItemsListResponse__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ThreadItemsListResponse__TextElement" }); + +export type V2ThreadItemsListResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadItemsListResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadItemsListResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadItemsListResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadItemsListResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadItemsListResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadItemsListResponse__FunctionCallOutputContentItem", +}); + +export type V2ThreadItemsListResponse__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2ThreadItemsListResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadItemsListResponse__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2ThreadItemsListResponse__MemoryCitation" }); + +export type V2ThreadItemsListResponse__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2ThreadListResponse__AbsolutePathBuf; + readonly path: V2ThreadItemsListResponse__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -18906,12 +23462,12 @@ export type V2ThreadListResponse__CommandAction = readonly type: "search"; } | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadListResponse__CommandAction = Schema.Union( +export const V2ThreadItemsListResponse__CommandAction = Schema.Union( [ Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2ThreadListResponse__AbsolutePathBuf, + path: V2ThreadItemsListResponse__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -18931,7 +23487,60 @@ export const V2ThreadListResponse__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadListResponse__CommandAction" }); +).annotate({ identifier: "V2ThreadItemsListResponse__CommandAction" }); + +export type V2ThreadItemsListResponse__FileUpdateChange = { + readonly diff: string; + readonly kind: V2ThreadItemsListResponse__PatchChangeKind; + readonly path: string; +}; +export const V2ThreadItemsListResponse__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: V2ThreadItemsListResponse__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "V2ThreadItemsListResponse__FileUpdateChange" }); + +export type V2ThreadItemsListResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadItemsListResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadItemsListResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadItemsListResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadItemsListResponse__McpAppUi", +}); + +export type V2ThreadItemsListResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadItemsListResponse__CollabAgentStatus; +}; +export const V2ThreadItemsListResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadItemsListResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadItemsListResponse__CollabAgentState" }); + +export type V2ThreadListResponse__ThreadSection = { + readonly appearance?: V2ThreadListResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadListResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadListResponse__ThreadSection", +}); export type V2ThreadListResponse__SubAgentSource = | "review" @@ -18999,8 +23608,10 @@ export type V2ThreadListResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -19022,8 +23633,10 @@ export const V2ThreadListResponse__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -19122,6 +23735,38 @@ export const V2ThreadListResponse__CodexErrorInfo = Schema.Union( identifier: "V2ThreadListResponse__CodexErrorInfo", }); +export type V2ThreadListResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadListResponse__MisalignmentSteer | null; +}; +export const V2ThreadListResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadListResponse__MisalignmentErrorDetails" }); + export type V2ThreadListResponse__TextElement = { readonly byteRange: V2ThreadListResponse__ByteRange; readonly placeholder?: string | null; @@ -19140,6 +23785,64 @@ export const V2ThreadListResponse__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ThreadListResponse__TextElement" }); +export type V2ThreadListResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadListResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadListResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadListResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadListResponse__FunctionCallOutputContentItem", +}); + export type V2ThreadListResponse__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -19149,31 +23852,11 @@ export const V2ThreadListResponse__MemoryCitation = Schema.Struct({ threadIds: Schema.Array(Schema.String), }).annotate({ identifier: "V2ThreadListResponse__MemoryCitation" }); -export type V2ThreadListResponse__FileUpdateChange = { - readonly diff: string; - readonly kind: V2ThreadListResponse__PatchChangeKind; - readonly path: string; -}; -export const V2ThreadListResponse__FileUpdateChange = Schema.Struct({ - diff: Schema.String, - kind: V2ThreadListResponse__PatchChangeKind, - path: Schema.String, -}).annotate({ identifier: "V2ThreadListResponse__FileUpdateChange" }); - -export type V2ThreadListResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadListResponse__CollabAgentStatus; -}; -export const V2ThreadListResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadListResponse__CollabAgentStatus, -}).annotate({ identifier: "V2ThreadListResponse__CollabAgentState" }); - -export type V2ThreadMetadataUpdateResponse__CommandAction = +export type V2ThreadListResponse__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2ThreadMetadataUpdateResponse__AbsolutePathBuf; + readonly path: V2ThreadListResponse__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -19184,12 +23867,12 @@ export type V2ThreadMetadataUpdateResponse__CommandAction = readonly type: "search"; } | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadMetadataUpdateResponse__CommandAction = Schema.Union( +export const V2ThreadListResponse__CommandAction = Schema.Union( [ Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2ThreadMetadataUpdateResponse__AbsolutePathBuf, + path: V2ThreadListResponse__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -19209,7 +23892,60 @@ export const V2ThreadMetadataUpdateResponse__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CommandAction" }); +).annotate({ identifier: "V2ThreadListResponse__CommandAction" }); + +export type V2ThreadListResponse__FileUpdateChange = { + readonly diff: string; + readonly kind: V2ThreadListResponse__PatchChangeKind; + readonly path: string; +}; +export const V2ThreadListResponse__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: V2ThreadListResponse__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "V2ThreadListResponse__FileUpdateChange" }); + +export type V2ThreadListResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadListResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadListResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadListResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadListResponse__McpAppUi", +}); + +export type V2ThreadListResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadListResponse__CollabAgentStatus; +}; +export const V2ThreadListResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadListResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadListResponse__CollabAgentState" }); + +export type V2ThreadMetadataUpdateResponse__ThreadSection = { + readonly appearance?: V2ThreadMetadataUpdateResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadMetadataUpdateResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadMetadataUpdateResponse__ThreadSection", +}); export type V2ThreadMetadataUpdateResponse__SubAgentSource = | "review" @@ -19277,8 +24013,10 @@ export type V2ThreadMetadataUpdateResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -19300,8 +24038,10 @@ export const V2ThreadMetadataUpdateResponse__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -19400,6 +24140,38 @@ export const V2ThreadMetadataUpdateResponse__CodexErrorInfo = Schema.Union( identifier: "V2ThreadMetadataUpdateResponse__CodexErrorInfo", }); +export type V2ThreadMetadataUpdateResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadMetadataUpdateResponse__MisalignmentSteer | null; +}; +export const V2ThreadMetadataUpdateResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__MisalignmentErrorDetails" }); + export type V2ThreadMetadataUpdateResponse__TextElement = { readonly byteRange: V2ThreadMetadataUpdateResponse__ByteRange; readonly placeholder?: string | null; @@ -19419,6 +24191,68 @@ export const V2ThreadMetadataUpdateResponse__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ThreadMetadataUpdateResponse__TextElement" }); +export type V2ThreadMetadataUpdateResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadMetadataUpdateResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadMetadataUpdateResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadMetadataUpdateResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadMetadataUpdateResponse__FunctionCallOutputContentItem", +}); + export type V2ThreadMetadataUpdateResponse__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -19428,31 +24262,11 @@ export const V2ThreadMetadataUpdateResponse__MemoryCitation = Schema.Struct({ threadIds: Schema.Array(Schema.String), }).annotate({ identifier: "V2ThreadMetadataUpdateResponse__MemoryCitation" }); -export type V2ThreadMetadataUpdateResponse__FileUpdateChange = { - readonly diff: string; - readonly kind: V2ThreadMetadataUpdateResponse__PatchChangeKind; - readonly path: string; -}; -export const V2ThreadMetadataUpdateResponse__FileUpdateChange = Schema.Struct({ - diff: Schema.String, - kind: V2ThreadMetadataUpdateResponse__PatchChangeKind, - path: Schema.String, -}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__FileUpdateChange" }); - -export type V2ThreadMetadataUpdateResponse__CollabAgentState = { - readonly message?: string | null; - readonly status: V2ThreadMetadataUpdateResponse__CollabAgentStatus; -}; -export const V2ThreadMetadataUpdateResponse__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadMetadataUpdateResponse__CollabAgentStatus, -}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CollabAgentState" }); - -export type V2ThreadReadResponse__CommandAction = +export type V2ThreadMetadataUpdateResponse__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2ThreadReadResponse__AbsolutePathBuf; + readonly path: V2ThreadMetadataUpdateResponse__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -19463,12 +24277,12 @@ export type V2ThreadReadResponse__CommandAction = readonly type: "search"; } | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadReadResponse__CommandAction = Schema.Union( +export const V2ThreadMetadataUpdateResponse__CommandAction = Schema.Union( [ Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2ThreadReadResponse__AbsolutePathBuf, + path: V2ThreadMetadataUpdateResponse__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -19488,7 +24302,60 @@ export const V2ThreadReadResponse__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadReadResponse__CommandAction" }); +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CommandAction" }); + +export type V2ThreadMetadataUpdateResponse__FileUpdateChange = { + readonly diff: string; + readonly kind: V2ThreadMetadataUpdateResponse__PatchChangeKind; + readonly path: string; +}; +export const V2ThreadMetadataUpdateResponse__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: V2ThreadMetadataUpdateResponse__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__FileUpdateChange" }); + +export type V2ThreadMetadataUpdateResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadMetadataUpdateResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadMetadataUpdateResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadMetadataUpdateResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadMetadataUpdateResponse__McpAppUi", +}); + +export type V2ThreadMetadataUpdateResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadMetadataUpdateResponse__CollabAgentStatus; +}; +export const V2ThreadMetadataUpdateResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadMetadataUpdateResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__CollabAgentState" }); + +export type V2ThreadReadResponse__ThreadSection = { + readonly appearance?: V2ThreadReadResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadReadResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadReadResponse__ThreadSection", +}); export type V2ThreadReadResponse__SubAgentSource = | "review" @@ -19556,15 +24423,15 @@ export type V2ThreadReadResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" - | "rateLimitExceeded" - | "misalignmentPolicyViolation" | "other" | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } @@ -19581,15 +24448,15 @@ export const V2ThreadReadResponse__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", "threadRollbackFailed", "sandboxError", - "rateLimitExceeded", - "misalignmentPolicyViolation", "other", ]), Schema.Struct({ @@ -19683,6 +24550,38 @@ export const V2ThreadReadResponse__CodexErrorInfo = Schema.Union( identifier: "V2ThreadReadResponse__CodexErrorInfo", }); +export type V2ThreadReadResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadReadResponse__MisalignmentSteer | null; +}; +export const V2ThreadReadResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadReadResponse__MisalignmentErrorDetails" }); + export type V2ThreadReadResponse__TextElement = { readonly byteRange: V2ThreadReadResponse__ByteRange; readonly placeholder?: string | null; @@ -19701,6 +24600,64 @@ export const V2ThreadReadResponse__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ThreadReadResponse__TextElement" }); +export type V2ThreadReadResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadReadResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadReadResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadReadResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadReadResponse__FunctionCallOutputContentItem", +}); + export type V2ThreadReadResponse__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -19710,6 +24667,48 @@ export const V2ThreadReadResponse__MemoryCitation = Schema.Struct({ threadIds: Schema.Array(Schema.String), }).annotate({ identifier: "V2ThreadReadResponse__MemoryCitation" }); +export type V2ThreadReadResponse__CommandAction = + | { + readonly command: string; + readonly name: string; + readonly path: V2ThreadReadResponse__LegacyAppPathString; + readonly type: "read"; + } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } + | { + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly command: string; readonly type: "unknown" }; +export const V2ThreadReadResponse__CommandAction = Schema.Union( + [ + Schema.Struct({ + command: Schema.String, + name: Schema.String, + path: V2ThreadReadResponse__LegacyAppPathString, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), + Schema.Struct({ + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadReadResponse__CommandAction" }); + export type V2ThreadReadResponse__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadReadResponse__PatchChangeKind; @@ -19721,6 +24720,19 @@ export const V2ThreadReadResponse__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "V2ThreadReadResponse__FileUpdateChange" }); +export type V2ThreadReadResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadReadResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadReadResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadReadResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadReadResponse__McpAppUi", +}); + export type V2ThreadReadResponse__CollabAgentState = { readonly message?: string | null; readonly status: V2ThreadReadResponse__CollabAgentStatus; @@ -19730,12 +24742,167 @@ export const V2ThreadReadResponse__CollabAgentState = Schema.Struct({ status: V2ThreadReadResponse__CollabAgentStatus, }).annotate({ identifier: "V2ThreadReadResponse__CollabAgentState" }); +export type V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeItem = + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly type: "realtimeSessionStarted"; + } + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly role: V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeTranscriptRole; + readonly text: string; + readonly type: "transcriptSegment"; + } + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly item_id: string; + readonly presentation: V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeBemItemPresentation; + readonly turn_id: string; + readonly type: "bemItemPromoted"; + } + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly outcome: V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeSessionOutcome; + readonly type: "realtimeSessionClosed"; + }; +export const V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeItem = Schema.Union( + [ + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + type: Schema.Literal("realtimeSessionStarted").annotate({ + title: "RealtimeSessionStartedThreadRealtimeItemType", + }), + }).annotate({ title: "RealtimeSessionStartedThreadRealtimeItem" }), + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + role: V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeTranscriptRole, + text: Schema.String, + type: Schema.Literal("transcriptSegment").annotate({ + title: "TranscriptSegmentThreadRealtimeItemType", + }), + }).annotate({ title: "TranscriptSegmentThreadRealtimeItem" }), + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + item_id: Schema.String, + presentation: V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeBemItemPresentation, + turn_id: Schema.String, + type: Schema.Literal("bemItemPromoted").annotate({ + title: "BemItemPromotedThreadRealtimeItemType", + }), + }).annotate({ title: "BemItemPromotedThreadRealtimeItem" }), + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + outcome: V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeSessionOutcome, + type: Schema.Literal("realtimeSessionClosed").annotate({ + title: "RealtimeSessionClosedThreadRealtimeItemType", + }), + }).annotate({ title: "RealtimeSessionClosedThreadRealtimeItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: "EXPERIMENTAL - a thread-scoped realtime item in the canonical timeline.", + identifier: "V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeItem", +}); + +export type V2ThreadRealtimeItemStartedNotification__ThreadRealtimeItem = + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly type: "realtimeSessionStarted"; + } + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly role: V2ThreadRealtimeItemStartedNotification__ThreadRealtimeTranscriptRole; + readonly text: string; + readonly type: "transcriptSegment"; + } + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly item_id: string; + readonly presentation: V2ThreadRealtimeItemStartedNotification__ThreadRealtimeBemItemPresentation; + readonly turn_id: string; + readonly type: "bemItemPromoted"; + } + | { + readonly id: string; + readonly realtimeSessionId: string; + readonly outcome: V2ThreadRealtimeItemStartedNotification__ThreadRealtimeSessionOutcome; + readonly type: "realtimeSessionClosed"; + }; +export const V2ThreadRealtimeItemStartedNotification__ThreadRealtimeItem = Schema.Union( + [ + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + type: Schema.Literal("realtimeSessionStarted").annotate({ + title: "RealtimeSessionStartedThreadRealtimeItemType", + }), + }).annotate({ title: "RealtimeSessionStartedThreadRealtimeItem" }), + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + role: V2ThreadRealtimeItemStartedNotification__ThreadRealtimeTranscriptRole, + text: Schema.String, + type: Schema.Literal("transcriptSegment").annotate({ + title: "TranscriptSegmentThreadRealtimeItemType", + }), + }).annotate({ title: "TranscriptSegmentThreadRealtimeItem" }), + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + item_id: Schema.String, + presentation: V2ThreadRealtimeItemStartedNotification__ThreadRealtimeBemItemPresentation, + turn_id: Schema.String, + type: Schema.Literal("bemItemPromoted").annotate({ + title: "BemItemPromotedThreadRealtimeItemType", + }), + }).annotate({ title: "BemItemPromotedThreadRealtimeItem" }), + Schema.Struct({ + id: Schema.String, + realtimeSessionId: Schema.String, + outcome: V2ThreadRealtimeItemStartedNotification__ThreadRealtimeSessionOutcome, + type: Schema.Literal("realtimeSessionClosed").annotate({ + title: "RealtimeSessionClosedThreadRealtimeItemType", + }), + }).annotate({ title: "RealtimeSessionClosedThreadRealtimeItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: "EXPERIMENTAL - a thread-scoped realtime item in the canonical timeline.", + identifier: "V2ThreadRealtimeItemStartedNotification__ThreadRealtimeItem", +}); + +export type V2ThreadResumeParams__ConfigurationReasoning = { + readonly effort: V2ThreadResumeParams__ReasoningEffort; +}; +export const V2ThreadResumeParams__ConfigurationReasoning = Schema.Struct({ + effort: V2ThreadResumeParams__ReasoningEffort, +}).annotate({ + description: "Reasoning settings interpreted by the backend for the routed model.", + identifier: "V2ThreadResumeParams__ConfigurationReasoning", +}); + export type V2ThreadResumeParams__FunctionCallOutputContentItem = | { readonly text: string; readonly type: "input_text" } | { readonly detail?: V2ThreadResumeParams__ImageDetail | null; + readonly type: "input_image"; readonly image_url: string; + } + | { + readonly detail?: V2ThreadResumeParams__ImageDetail | null; readonly type: "input_image"; + readonly file_id: string; } | { readonly audio_url: string; readonly type: "input_audio" } | { readonly encrypted_content: string; readonly type: "encrypted_content" }; @@ -19747,13 +24914,22 @@ export const V2ThreadResumeParams__FunctionCallOutputContentItem = Schema.Union( title: "InputTextFunctionCallOutputContentItemType", }), }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__ImageDetail, Schema.Null])), - image_url: Schema.String, - type: Schema.Literal("input_image").annotate({ - title: "InputImageFunctionCallOutputContentItemType", - }), - }).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), Schema.Struct({ audio_url: Schema.String, type: Schema.Literal("input_audio").annotate({ @@ -19778,8 +24954,13 @@ export type V2ThreadResumeParams__ContentItem = | { readonly text: string; readonly type: "input_text" } | { readonly detail?: V2ThreadResumeParams__ImageDetail | null; + readonly type: "input_image"; readonly image_url: string; + } + | { + readonly detail?: V2ThreadResumeParams__ImageDetail | null; readonly type: "input_image"; + readonly file_id: string; } | { readonly audio_url: string; readonly type: "input_audio" } | { readonly text: string; readonly type: "output_text" }; @@ -19789,11 +24970,18 @@ export const V2ThreadResumeParams__ContentItem = Schema.Union( text: Schema.String, type: Schema.Literal("input_text").annotate({ title: "InputTextContentItemType" }), }).annotate({ title: "InputTextContentItem" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__ImageDetail, Schema.Null])), - image_url: Schema.String, - type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), - }).annotate({ title: "InputImageContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ title: "InputImageContentItemType" }), + file_id: Schema.String, + }).annotate({ title: "FileIdContentItem" }), + ]).annotate({ title: "InputImageContentItem" }), Schema.Struct({ audio_url: Schema.String, type: Schema.Literal("input_audio").annotate({ title: "InputAudioContentItemType" }), @@ -19806,11 +24994,27 @@ export const V2ThreadResumeParams__ContentItem = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadResumeParams__ContentItem" }); +export type V2ThreadResumeResponse__Settings = { + readonly developer_instructions?: string | null; + readonly model: string; + readonly reasoning_effort?: V2ThreadResumeResponse__ReasoningEffort | null; +}; +export const V2ThreadResumeResponse__Settings = Schema.Struct({ + developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.String, + reasoning_effort: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__ReasoningEffort, Schema.Null]), + ), +}).annotate({ + description: "Settings for a collaboration mode.", + identifier: "V2ThreadResumeResponse__Settings", +}); + export type V2ThreadResumeResponse__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2ThreadResumeResponse__AbsolutePathBuf; + readonly path: V2ThreadResumeResponse__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -19826,7 +25030,7 @@ export const V2ThreadResumeResponse__CommandAction = Schema.Union( Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2ThreadResumeResponse__AbsolutePathBuf, + path: V2ThreadResumeResponse__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -19897,6 +25101,26 @@ export const V2ThreadResumeResponse__SandboxPolicy = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadResumeResponse__SandboxPolicy" }); +export type V2ThreadResumeResponse__ThreadSection = { + readonly appearance?: V2ThreadResumeResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadResumeResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadResumeResponse__ThreadSection", +}); + export type V2ThreadResumeResponse__SubAgentSource = | "review" | "compact" @@ -19963,15 +25187,15 @@ export type V2ThreadResumeResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" - | "rateLimitExceeded" - | "misalignmentPolicyViolation" | "other" | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } @@ -19988,15 +25212,15 @@ export const V2ThreadResumeResponse__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", "threadRollbackFailed", "sandboxError", - "rateLimitExceeded", - "misalignmentPolicyViolation", "other", ]), Schema.Struct({ @@ -20090,6 +25314,38 @@ export const V2ThreadResumeResponse__CodexErrorInfo = Schema.Union( identifier: "V2ThreadResumeResponse__CodexErrorInfo", }); +export type V2ThreadResumeResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadResumeResponse__MisalignmentSteer | null; +}; +export const V2ThreadResumeResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadResumeResponse__MisalignmentErrorDetails" }); + export type V2ThreadResumeResponse__TextElement = { readonly byteRange: V2ThreadResumeResponse__ByteRange; readonly placeholder?: string | null; @@ -20108,6 +25364,68 @@ export const V2ThreadResumeResponse__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ThreadResumeResponse__TextElement" }); +export type V2ThreadResumeResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadResumeResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadResumeResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadResumeResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadResumeResponse__FunctionCallOutputContentItem", +}); + export type V2ThreadResumeResponse__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -20128,6 +25446,19 @@ export const V2ThreadResumeResponse__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "V2ThreadResumeResponse__FileUpdateChange" }); +export type V2ThreadResumeResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadResumeResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadResumeResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadResumeResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadResumeResponse__McpAppUi", +}); + export type V2ThreadResumeResponse__CollabAgentState = { readonly message?: string | null; readonly status: V2ThreadResumeResponse__CollabAgentStatus; @@ -20137,92 +25468,70 @@ export const V2ThreadResumeResponse__CollabAgentState = Schema.Struct({ status: V2ThreadResumeResponse__CollabAgentStatus, }).annotate({ identifier: "V2ThreadResumeResponse__CollabAgentState" }); -export type V2ThreadRollbackResponse__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: V2ThreadRollbackResponse__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } - | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadRollbackResponse__CommandAction = Schema.Union( - [ - Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: V2ThreadRollbackResponse__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), - Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), - ], - { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__CommandAction" }); +export type V2ThreadRevertResponse__ThreadSection = { + readonly appearance?: V2ThreadRevertResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadRevertResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadRevertResponse__ThreadSection", +}); -export type V2ThreadRollbackResponse__SubAgentSource = +export type V2ThreadRevertResponse__SubAgentSource = | "review" | "compact" | "memory_consolidation" | { readonly thread_spawn: { readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadRollbackResponse__AgentPath | null; + readonly agent_path?: V2ThreadRevertResponse__AgentPath | null; readonly agent_role?: string | null; readonly depth: number; - readonly parent_thread_id: V2ThreadRollbackResponse__ThreadId; + readonly parent_thread_id: V2ThreadRevertResponse__ThreadId; }; } | { readonly other: string }; -export const V2ThreadRollbackResponse__SubAgentSource = Schema.Union( +export const V2ThreadRevertResponse__SubAgentSource = Schema.Union( [ Schema.Literals(["review", "compact", "memory_consolidation"]), Schema.Struct({ thread_spawn: Schema.Struct({ agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), agent_path: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__AgentPath, Schema.Null]), + Schema.Union([V2ThreadRevertResponse__AgentPath, Schema.Null]), ), agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), depth: Schema.Number.annotate({ format: "int32" }).check( Schema.isInt().annotate({ expected: "an integer" }), ), - parent_thread_id: V2ThreadRollbackResponse__ThreadId, + parent_thread_id: V2ThreadRevertResponse__ThreadId, }), }).annotate({ title: "ThreadSpawnSubAgentSource" }), Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__SubAgentSource" }); +).annotate({ identifier: "V2ThreadRevertResponse__SubAgentSource" }); -export type V2ThreadRollbackResponse__ThreadStatus = +export type V2ThreadRevertResponse__ThreadStatus = | { readonly type: "notLoaded" } | { readonly type: "idle" } | { readonly type: "systemError" } | { - readonly activeFlags: ReadonlyArray; + readonly activeFlags: ReadonlyArray; readonly type: "active"; }; -export const V2ThreadRollbackResponse__ThreadStatus = Schema.Union( +export const V2ThreadRevertResponse__ThreadStatus = Schema.Union( [ Schema.Struct({ type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), @@ -20234,26 +25543,26 @@ export const V2ThreadRollbackResponse__ThreadStatus = Schema.Union( type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), }).annotate({ title: "SystemErrorThreadStatus" }), Schema.Struct({ - activeFlags: Schema.Array(V2ThreadRollbackResponse__ThreadActiveFlag), + activeFlags: Schema.Array(V2ThreadRevertResponse__ThreadActiveFlag), type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), }).annotate({ title: "ActiveThreadStatus" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__ThreadStatus" }); +).annotate({ identifier: "V2ThreadRevertResponse__ThreadStatus" }); -export type V2ThreadRollbackResponse__CodexErrorInfo = +export type V2ThreadRevertResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" - | "rateLimitExceeded" - | "misalignmentPolicyViolation" | "other" | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } @@ -20261,24 +25570,24 @@ export type V2ThreadRollbackResponse__CodexErrorInfo = | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } | { readonly activeTurnNotSteerable: { - readonly turnKind: V2ThreadRollbackResponse__NonSteerableTurnKind; + readonly turnKind: V2ThreadRevertResponse__NonSteerableTurnKind; }; }; -export const V2ThreadRollbackResponse__CodexErrorInfo = Schema.Union( +export const V2ThreadRevertResponse__CodexErrorInfo = Schema.Union( [ Schema.Literals([ "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", "threadRollbackFailed", "sandboxError", - "rateLimitExceeded", - "misalignmentPolicyViolation", "other", ]), Schema.Struct({ @@ -20357,7 +25666,7 @@ export const V2ThreadRollbackResponse__CodexErrorInfo = Schema.Union( }), Schema.Struct({ activeTurnNotSteerable: Schema.Struct({ - turnKind: V2ThreadRollbackResponse__NonSteerableTurnKind, + turnKind: V2ThreadRevertResponse__NonSteerableTurnKind, }), }).annotate({ title: "ActiveTurnNotSteerableCodexErrorInfo", @@ -20369,16 +25678,48 @@ export const V2ThreadRollbackResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", - identifier: "V2ThreadRollbackResponse__CodexErrorInfo", + identifier: "V2ThreadRevertResponse__CodexErrorInfo", }); -export type V2ThreadRollbackResponse__TextElement = { - readonly byteRange: V2ThreadRollbackResponse__ByteRange; +export type V2ThreadRevertResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadRevertResponse__MisalignmentSteer | null; +}; +export const V2ThreadRevertResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadRevertResponse__MisalignmentErrorDetails" }); + +export type V2ThreadRevertResponse__TextElement = { + readonly byteRange: V2ThreadRevertResponse__ByteRange; readonly placeholder?: string | null; }; -export const V2ThreadRollbackResponse__TextElement = Schema.Struct({ +export const V2ThreadRevertResponse__TextElement = Schema.Struct({ byteRange: Schema.suspend( - (): Schema.Codec => V2ThreadRollbackResponse__ByteRange, + (): Schema.Codec => V2ThreadRevertResponse__ByteRange, ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), placeholder: Schema.optionalKey( Schema.Union([ @@ -20388,36 +25729,213 @@ export const V2ThreadRollbackResponse__TextElement = Schema.Struct({ Schema.Null, ]), ), -}).annotate({ identifier: "V2ThreadRollbackResponse__TextElement" }); +}).annotate({ identifier: "V2ThreadRevertResponse__TextElement" }); + +export type V2ThreadRevertResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadRevertResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadRevertResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadRevertResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadRevertResponse__FunctionCallOutputContentItem", +}); -export type V2ThreadRollbackResponse__MemoryCitation = { - readonly entries: ReadonlyArray; +export type V2ThreadRevertResponse__MemoryCitation = { + readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; }; -export const V2ThreadRollbackResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadRollbackResponse__MemoryCitationEntry), +export const V2ThreadRevertResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadRevertResponse__MemoryCitationEntry), threadIds: Schema.Array(Schema.String), -}).annotate({ identifier: "V2ThreadRollbackResponse__MemoryCitation" }); +}).annotate({ identifier: "V2ThreadRevertResponse__MemoryCitation" }); + +export type V2ThreadRevertResponse__CommandAction = + | { + readonly command: string; + readonly name: string; + readonly path: V2ThreadRevertResponse__LegacyAppPathString; + readonly type: "read"; + } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } + | { + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly command: string; readonly type: "unknown" }; +export const V2ThreadRevertResponse__CommandAction = Schema.Union( + [ + Schema.Struct({ + command: Schema.String, + name: Schema.String, + path: V2ThreadRevertResponse__LegacyAppPathString, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), + Schema.Struct({ + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadRevertResponse__CommandAction" }); -export type V2ThreadRollbackResponse__FileUpdateChange = { +export type V2ThreadRevertResponse__FileUpdateChange = { readonly diff: string; - readonly kind: V2ThreadRollbackResponse__PatchChangeKind; + readonly kind: V2ThreadRevertResponse__PatchChangeKind; readonly path: string; }; -export const V2ThreadRollbackResponse__FileUpdateChange = Schema.Struct({ +export const V2ThreadRevertResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, - kind: V2ThreadRollbackResponse__PatchChangeKind, + kind: V2ThreadRevertResponse__PatchChangeKind, path: Schema.String, -}).annotate({ identifier: "V2ThreadRollbackResponse__FileUpdateChange" }); +}).annotate({ identifier: "V2ThreadRevertResponse__FileUpdateChange" }); + +export type V2ThreadRevertResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadRevertResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadRevertResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadRevertResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadRevertResponse__McpAppUi", +}); -export type V2ThreadRollbackResponse__CollabAgentState = { +export type V2ThreadRevertResponse__CollabAgentState = { readonly message?: string | null; - readonly status: V2ThreadRollbackResponse__CollabAgentStatus; + readonly status: V2ThreadRevertResponse__CollabAgentStatus; }; -export const V2ThreadRollbackResponse__CollabAgentState = Schema.Struct({ +export const V2ThreadRevertResponse__CollabAgentState = Schema.Struct({ message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadRollbackResponse__CollabAgentStatus, -}).annotate({ identifier: "V2ThreadRollbackResponse__CollabAgentState" }); + status: V2ThreadRevertResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadRevertResponse__CollabAgentState" }); + +export type V2ThreadSectionCreateResponse__ThreadSection = { + readonly appearance?: V2ThreadSectionCreateResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadSectionCreateResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadSectionCreateResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadSectionCreateResponse__ThreadSection", +}); + +export type V2ThreadSectionListResponse__ThreadSection = { + readonly appearance?: V2ThreadSectionListResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadSectionListResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadSectionListResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadSectionListResponse__ThreadSection", +}); + +export type V2ThreadSectionUpdateResponse__ThreadSection = { + readonly appearance?: V2ThreadSectionUpdateResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadSectionUpdateResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadSectionUpdateResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadSectionUpdateResponse__ThreadSection", +}); export type V2ThreadSettingsUpdatedNotification__Settings = { readonly developer_instructions?: string | null; @@ -20486,60 +26004,38 @@ export const V2ThreadSettingsUpdatedNotification__SandboxPolicy = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__SandboxPolicy" }); -export type V2ThreadStartedNotification__CommandAction = +export type V2ThreadStartedNotification__ThreadSection = { + readonly appearance?: V2ThreadStartedNotification__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadStartedNotification__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadStartedNotification__ThreadSection", +}); + +export type V2ThreadStartedNotification__SubAgentSource = + | "review" + | "compact" + | "memory_consolidation" | { - readonly command: string; - readonly name: string; - readonly path: V2ThreadStartedNotification__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } - | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadStartedNotification__CommandAction = Schema.Union( - [ - Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: V2ThreadStartedNotification__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), - Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), - ], - { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadStartedNotification__CommandAction" }); - -export type V2ThreadStartedNotification__SubAgentSource = - | "review" - | "compact" - | "memory_consolidation" - | { - readonly thread_spawn: { - readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadStartedNotification__AgentPath | null; - readonly agent_role?: string | null; - readonly depth: number; - readonly parent_thread_id: V2ThreadStartedNotification__ThreadId; - }; + readonly thread_spawn: { + readonly agent_nickname?: string | null; + readonly agent_path?: V2ThreadStartedNotification__AgentPath | null; + readonly agent_role?: string | null; + readonly depth: number; + readonly parent_thread_id: V2ThreadStartedNotification__ThreadId; + }; } | { readonly other: string }; export const V2ThreadStartedNotification__SubAgentSource = Schema.Union( @@ -20594,8 +26090,10 @@ export type V2ThreadStartedNotification__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -20617,8 +26115,10 @@ export const V2ThreadStartedNotification__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -20717,6 +26217,38 @@ export const V2ThreadStartedNotification__CodexErrorInfo = Schema.Union( identifier: "V2ThreadStartedNotification__CodexErrorInfo", }); +export type V2ThreadStartedNotification__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadStartedNotification__MisalignmentSteer | null; +}; +export const V2ThreadStartedNotification__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadStartedNotification__MisalignmentErrorDetails" }); + export type V2ThreadStartedNotification__TextElement = { readonly byteRange: V2ThreadStartedNotification__ByteRange; readonly placeholder?: string | null; @@ -20736,6 +26268,68 @@ export const V2ThreadStartedNotification__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ThreadStartedNotification__TextElement" }); +export type V2ThreadStartedNotification__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadStartedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadStartedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadStartedNotification__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadStartedNotification__FunctionCallOutputContentItem", +}); + export type V2ThreadStartedNotification__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -20745,6 +26339,48 @@ export const V2ThreadStartedNotification__MemoryCitation = Schema.Struct({ threadIds: Schema.Array(Schema.String), }).annotate({ identifier: "V2ThreadStartedNotification__MemoryCitation" }); +export type V2ThreadStartedNotification__CommandAction = + | { + readonly command: string; + readonly name: string; + readonly path: V2ThreadStartedNotification__LegacyAppPathString; + readonly type: "read"; + } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } + | { + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly command: string; readonly type: "unknown" }; +export const V2ThreadStartedNotification__CommandAction = Schema.Union( + [ + Schema.Struct({ + command: Schema.String, + name: Schema.String, + path: V2ThreadStartedNotification__LegacyAppPathString, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), + Schema.Struct({ + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartedNotification__CommandAction" }); + export type V2ThreadStartedNotification__FileUpdateChange = { readonly diff: string; readonly kind: V2ThreadStartedNotification__PatchChangeKind; @@ -20756,6 +26392,19 @@ export const V2ThreadStartedNotification__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "V2ThreadStartedNotification__FileUpdateChange" }); +export type V2ThreadStartedNotification__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadStartedNotification__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadStartedNotification__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadStartedNotification__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadStartedNotification__McpAppUi", +}); + export type V2ThreadStartedNotification__CollabAgentState = { readonly message?: string | null; readonly status: V2ThreadStartedNotification__CollabAgentStatus; @@ -20769,7 +26418,7 @@ export type V2ThreadStartResponse__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2ThreadStartResponse__AbsolutePathBuf; + readonly path: V2ThreadStartResponse__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -20785,7 +26434,7 @@ export const V2ThreadStartResponse__CommandAction = Schema.Union( Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2ThreadStartResponse__AbsolutePathBuf, + path: V2ThreadStartResponse__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -20856,6 +26505,26 @@ export const V2ThreadStartResponse__SandboxPolicy = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadStartResponse__SandboxPolicy" }); +export type V2ThreadStartResponse__ThreadSection = { + readonly appearance?: V2ThreadStartResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadStartResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadStartResponse__ThreadSection", +}); + export type V2ThreadStartResponse__SubAgentSource = | "review" | "compact" @@ -20922,8 +26591,10 @@ export type V2ThreadStartResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -20945,8 +26616,10 @@ export const V2ThreadStartResponse__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -21045,6 +26718,38 @@ export const V2ThreadStartResponse__CodexErrorInfo = Schema.Union( identifier: "V2ThreadStartResponse__CodexErrorInfo", }); +export type V2ThreadStartResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadStartResponse__MisalignmentSteer | null; +}; +export const V2ThreadStartResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadStartResponse__MisalignmentErrorDetails" }); + export type V2ThreadStartResponse__TextElement = { readonly byteRange: V2ThreadStartResponse__ByteRange; readonly placeholder?: string | null; @@ -21063,6 +26768,64 @@ export const V2ThreadStartResponse__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2ThreadStartResponse__TextElement" }); +export type V2ThreadStartResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadStartResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadStartResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadStartResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadStartResponse__FunctionCallOutputContentItem", +}); + export type V2ThreadStartResponse__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -21083,6 +26846,19 @@ export const V2ThreadStartResponse__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "V2ThreadStartResponse__FileUpdateChange" }); +export type V2ThreadStartResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadStartResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadStartResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadStartResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadStartResponse__McpAppUi", +}); + export type V2ThreadStartResponse__CollabAgentState = { readonly message?: string | null; readonly status: V2ThreadStartResponse__CollabAgentStatus; @@ -21137,116 +26913,14 @@ export const V2ThreadTokenUsageUpdatedNotification__ThreadTokenUsage = Schema.St total: V2ThreadTokenUsageUpdatedNotification__TokenUsageBreakdown, }).annotate({ identifier: "V2ThreadTokenUsageUpdatedNotification__ThreadTokenUsage" }); -export type V2ThreadUnarchiveResponse__CommandAction = - | { - readonly command: string; - readonly name: string; - readonly path: V2ThreadUnarchiveResponse__AbsolutePathBuf; - readonly type: "read"; - } - | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } - | { - readonly command: string; - readonly path?: string | null; - readonly query?: string | null; - readonly type: "search"; - } - | { readonly command: string; readonly type: "unknown" }; -export const V2ThreadUnarchiveResponse__CommandAction = Schema.Union( - [ - Schema.Struct({ - command: Schema.String, - name: Schema.String, - path: V2ThreadUnarchiveResponse__AbsolutePathBuf, - type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), - }).annotate({ title: "ReadCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), - }).annotate({ title: "ListFilesCommandAction" }), - Schema.Struct({ - command: Schema.String, - path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), - }).annotate({ title: "SearchCommandAction" }), - Schema.Struct({ - command: Schema.String, - type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), - }).annotate({ title: "UnknownCommandAction" }), - ], - { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadUnarchiveResponse__CommandAction" }); - -export type V2ThreadUnarchiveResponse__SubAgentSource = - | "review" - | "compact" - | "memory_consolidation" - | { - readonly thread_spawn: { - readonly agent_nickname?: string | null; - readonly agent_path?: V2ThreadUnarchiveResponse__AgentPath | null; - readonly agent_role?: string | null; - readonly depth: number; - readonly parent_thread_id: V2ThreadUnarchiveResponse__ThreadId; - }; - } - | { readonly other: string }; -export const V2ThreadUnarchiveResponse__SubAgentSource = Schema.Union( - [ - Schema.Literals(["review", "compact", "memory_consolidation"]), - Schema.Struct({ - thread_spawn: Schema.Struct({ - agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - agent_path: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__AgentPath, Schema.Null]), - ), - agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - depth: Schema.Number.annotate({ format: "int32" }).check( - Schema.isInt().annotate({ expected: "an integer" }), - ), - parent_thread_id: V2ThreadUnarchiveResponse__ThreadId, - }), - }).annotate({ title: "ThreadSpawnSubAgentSource" }), - Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), - ], - { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadUnarchiveResponse__SubAgentSource" }); - -export type V2ThreadUnarchiveResponse__ThreadStatus = - | { readonly type: "notLoaded" } - | { readonly type: "idle" } - | { readonly type: "systemError" } - | { - readonly activeFlags: ReadonlyArray; - readonly type: "active"; - }; -export const V2ThreadUnarchiveResponse__ThreadStatus = Schema.Union( - [ - Schema.Struct({ - type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), - }).annotate({ title: "NotLoadedThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), - }).annotate({ title: "IdleThreadStatus" }), - Schema.Struct({ - type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), - }).annotate({ title: "SystemErrorThreadStatus" }), - Schema.Struct({ - activeFlags: Schema.Array(V2ThreadUnarchiveResponse__ThreadActiveFlag), - type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), - }).annotate({ title: "ActiveThreadStatus" }), - ], - { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadUnarchiveResponse__ThreadStatus" }); - -export type V2ThreadUnarchiveResponse__CodexErrorInfo = +export type V2ThreadTurnsListResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -21259,17 +26933,19 @@ export type V2ThreadUnarchiveResponse__CodexErrorInfo = | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } | { readonly activeTurnNotSteerable: { - readonly turnKind: V2ThreadUnarchiveResponse__NonSteerableTurnKind; + readonly turnKind: V2ThreadTurnsListResponse__NonSteerableTurnKind; }; }; -export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union( +export const V2ThreadTurnsListResponse__CodexErrorInfo = Schema.Union( [ Schema.Literals([ "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -21353,7 +27029,7 @@ export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union( }), Schema.Struct({ activeTurnNotSteerable: Schema.Struct({ - turnKind: V2ThreadUnarchiveResponse__NonSteerableTurnKind, + turnKind: V2ThreadTurnsListResponse__NonSteerableTurnKind, }), }).annotate({ title: "ActiveTurnNotSteerableCodexErrorInfo", @@ -21365,16 +27041,48 @@ export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", - identifier: "V2ThreadUnarchiveResponse__CodexErrorInfo", + identifier: "V2ThreadTurnsListResponse__CodexErrorInfo", }); -export type V2ThreadUnarchiveResponse__TextElement = { - readonly byteRange: V2ThreadUnarchiveResponse__ByteRange; +export type V2ThreadTurnsListResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadTurnsListResponse__MisalignmentSteer | null; +}; +export const V2ThreadTurnsListResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadTurnsListResponse__MisalignmentErrorDetails" }); + +export type V2ThreadTurnsListResponse__TextElement = { + readonly byteRange: V2ThreadTurnsListResponse__ByteRange; readonly placeholder?: string | null; }; -export const V2ThreadUnarchiveResponse__TextElement = Schema.Struct({ +export const V2ThreadTurnsListResponse__TextElement = Schema.Struct({ byteRange: Schema.suspend( - (): Schema.Codec => V2ThreadUnarchiveResponse__ByteRange, + (): Schema.Codec => V2ThreadTurnsListResponse__ByteRange, ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), placeholder: Schema.optionalKey( Schema.Union([ @@ -21384,50 +27092,249 @@ export const V2ThreadUnarchiveResponse__TextElement = Schema.Struct({ Schema.Null, ]), ), -}).annotate({ identifier: "V2ThreadUnarchiveResponse__TextElement" }); +}).annotate({ identifier: "V2ThreadTurnsListResponse__TextElement" }); -export type V2ThreadUnarchiveResponse__MemoryCitation = { - readonly entries: ReadonlyArray; +export type V2ThreadTurnsListResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadTurnsListResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadTurnsListResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadTurnsListResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadTurnsListResponse__FunctionCallOutputContentItem", +}); + +export type V2ThreadTurnsListResponse__MemoryCitation = { + readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; }; -export const V2ThreadUnarchiveResponse__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2ThreadUnarchiveResponse__MemoryCitationEntry), +export const V2ThreadTurnsListResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadTurnsListResponse__MemoryCitationEntry), threadIds: Schema.Array(Schema.String), -}).annotate({ identifier: "V2ThreadUnarchiveResponse__MemoryCitation" }); +}).annotate({ identifier: "V2ThreadTurnsListResponse__MemoryCitation" }); -export type V2ThreadUnarchiveResponse__FileUpdateChange = { +export type V2ThreadTurnsListResponse__CommandAction = + | { + readonly command: string; + readonly name: string; + readonly path: V2ThreadTurnsListResponse__LegacyAppPathString; + readonly type: "read"; + } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } + | { + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly command: string; readonly type: "unknown" }; +export const V2ThreadTurnsListResponse__CommandAction = Schema.Union( + [ + Schema.Struct({ + command: Schema.String, + name: Schema.String, + path: V2ThreadTurnsListResponse__LegacyAppPathString, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), + Schema.Struct({ + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadTurnsListResponse__CommandAction" }); + +export type V2ThreadTurnsListResponse__FileUpdateChange = { readonly diff: string; - readonly kind: V2ThreadUnarchiveResponse__PatchChangeKind; + readonly kind: V2ThreadTurnsListResponse__PatchChangeKind; readonly path: string; }; -export const V2ThreadUnarchiveResponse__FileUpdateChange = Schema.Struct({ +export const V2ThreadTurnsListResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, - kind: V2ThreadUnarchiveResponse__PatchChangeKind, + kind: V2ThreadTurnsListResponse__PatchChangeKind, path: Schema.String, -}).annotate({ identifier: "V2ThreadUnarchiveResponse__FileUpdateChange" }); +}).annotate({ identifier: "V2ThreadTurnsListResponse__FileUpdateChange" }); -export type V2ThreadUnarchiveResponse__CollabAgentState = { +export type V2ThreadTurnsListResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadTurnsListResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2ThreadTurnsListResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadTurnsListResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadTurnsListResponse__McpAppUi", +}); + +export type V2ThreadTurnsListResponse__CollabAgentState = { readonly message?: string | null; - readonly status: V2ThreadUnarchiveResponse__CollabAgentStatus; + readonly status: V2ThreadTurnsListResponse__CollabAgentStatus; }; -export const V2ThreadUnarchiveResponse__CollabAgentState = Schema.Struct({ +export const V2ThreadTurnsListResponse__CollabAgentState = Schema.Struct({ message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadUnarchiveResponse__CollabAgentStatus, -}).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentState" }); + status: V2ThreadTurnsListResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadTurnsListResponse__CollabAgentState" }); -export type V2TurnCompletedNotification__CodexErrorInfo = +export type V2ThreadUnarchiveResponse__ThreadSection = { + readonly appearance?: V2ThreadUnarchiveResponse__ThreadSectionAppearance | null; + readonly id: string; + readonly name: string; +}; +export const V2ThreadUnarchiveResponse__ThreadSection = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Optional appearance synchronized across clients.", + }), + ), + id: Schema.String.annotate({ + description: "Opaque UUIDv7 identity that remains stable when the section is renamed.", + }), + name: Schema.String.annotate({ description: "The current user-visible section name." }), +}).annotate({ + description: "An independently persisted, user-visible thread section.", + identifier: "V2ThreadUnarchiveResponse__ThreadSection", +}); + +export type V2ThreadUnarchiveResponse__SubAgentSource = + | "review" + | "compact" + | "memory_consolidation" + | { + readonly thread_spawn: { + readonly agent_nickname?: string | null; + readonly agent_path?: V2ThreadUnarchiveResponse__AgentPath | null; + readonly agent_role?: string | null; + readonly depth: number; + readonly parent_thread_id: V2ThreadUnarchiveResponse__ThreadId; + }; + } + | { readonly other: string }; +export const V2ThreadUnarchiveResponse__SubAgentSource = Schema.Union( + [ + Schema.Literals(["review", "compact", "memory_consolidation"]), + Schema.Struct({ + thread_spawn: Schema.Struct({ + agent_nickname: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + agent_path: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__AgentPath, Schema.Null]), + ), + agent_role: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + depth: Schema.Number.annotate({ format: "int32" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + parent_thread_id: V2ThreadUnarchiveResponse__ThreadId, + }), + }).annotate({ title: "ThreadSpawnSubAgentSource" }), + Schema.Struct({ other: Schema.String }).annotate({ title: "OtherSubAgentSource" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__SubAgentSource" }); + +export type V2ThreadUnarchiveResponse__ThreadStatus = + | { readonly type: "notLoaded" } + | { readonly type: "idle" } + | { readonly type: "systemError" } + | { + readonly activeFlags: ReadonlyArray; + readonly type: "active"; + }; +export const V2ThreadUnarchiveResponse__ThreadStatus = Schema.Union( + [ + Schema.Struct({ + type: Schema.Literal("notLoaded").annotate({ title: "NotLoadedThreadStatusType" }), + }).annotate({ title: "NotLoadedThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("idle").annotate({ title: "IdleThreadStatusType" }), + }).annotate({ title: "IdleThreadStatus" }), + Schema.Struct({ + type: Schema.Literal("systemError").annotate({ title: "SystemErrorThreadStatusType" }), + }).annotate({ title: "SystemErrorThreadStatus" }), + Schema.Struct({ + activeFlags: Schema.Array(V2ThreadUnarchiveResponse__ThreadActiveFlag), + type: Schema.Literal("active").annotate({ title: "ActiveThreadStatusType" }), + }).annotate({ title: "ActiveThreadStatus" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__ThreadStatus" }); + +export type V2ThreadUnarchiveResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" - | "rateLimitExceeded" - | "misalignmentPolicyViolation" | "other" | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } @@ -21435,24 +27342,24 @@ export type V2TurnCompletedNotification__CodexErrorInfo = | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } | { readonly activeTurnNotSteerable: { - readonly turnKind: V2TurnCompletedNotification__NonSteerableTurnKind; + readonly turnKind: V2ThreadUnarchiveResponse__NonSteerableTurnKind; }; }; -export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( +export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union( [ Schema.Literals([ "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", "threadRollbackFailed", "sandboxError", - "rateLimitExceeded", - "misalignmentPolicyViolation", "other", ]), Schema.Struct({ @@ -21531,7 +27438,7 @@ export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( }), Schema.Struct({ activeTurnNotSteerable: Schema.Struct({ - turnKind: V2TurnCompletedNotification__NonSteerableTurnKind, + turnKind: V2ThreadUnarchiveResponse__NonSteerableTurnKind, }), }).annotate({ title: "ActiveTurnNotSteerableCodexErrorInfo", @@ -21543,17 +27450,48 @@ export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", - identifier: "V2TurnCompletedNotification__CodexErrorInfo", + identifier: "V2ThreadUnarchiveResponse__CodexErrorInfo", }); -export type V2TurnCompletedNotification__TextElement = { - readonly byteRange: V2TurnCompletedNotification__ByteRange; +export type V2ThreadUnarchiveResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2ThreadUnarchiveResponse__MisalignmentSteer | null; +}; +export const V2ThreadUnarchiveResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2ThreadUnarchiveResponse__MisalignmentErrorDetails" }); + +export type V2ThreadUnarchiveResponse__TextElement = { + readonly byteRange: V2ThreadUnarchiveResponse__ByteRange; readonly placeholder?: string | null; }; -export const V2TurnCompletedNotification__TextElement = Schema.Struct({ +export const V2ThreadUnarchiveResponse__TextElement = Schema.Struct({ byteRange: Schema.suspend( - (): Schema.Codec => - V2TurnCompletedNotification__ByteRange, + (): Schema.Codec => V2ThreadUnarchiveResponse__ByteRange, ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), placeholder: Schema.optionalKey( Schema.Union([ @@ -21563,22 +27501,84 @@ export const V2TurnCompletedNotification__TextElement = Schema.Struct({ Schema.Null, ]), ), -}).annotate({ identifier: "V2TurnCompletedNotification__TextElement" }); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__TextElement" }); -export type V2TurnCompletedNotification__MemoryCitation = { - readonly entries: ReadonlyArray; +export type V2ThreadUnarchiveResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2ThreadUnarchiveResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2ThreadUnarchiveResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2ThreadUnarchiveResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2ThreadUnarchiveResponse__FunctionCallOutputContentItem", +}); + +export type V2ThreadUnarchiveResponse__MemoryCitation = { + readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; }; -export const V2TurnCompletedNotification__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2TurnCompletedNotification__MemoryCitationEntry), +export const V2ThreadUnarchiveResponse__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2ThreadUnarchiveResponse__MemoryCitationEntry), threadIds: Schema.Array(Schema.String), -}).annotate({ identifier: "V2TurnCompletedNotification__MemoryCitation" }); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__MemoryCitation" }); -export type V2TurnCompletedNotification__CommandAction = +export type V2ThreadUnarchiveResponse__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2TurnCompletedNotification__AbsolutePathBuf; + readonly path: V2ThreadUnarchiveResponse__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -21589,12 +27589,12 @@ export type V2TurnCompletedNotification__CommandAction = readonly type: "search"; } | { readonly command: string; readonly type: "unknown" }; -export const V2TurnCompletedNotification__CommandAction = Schema.Union( +export const V2ThreadUnarchiveResponse__CommandAction = Schema.Union( [ Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2TurnCompletedNotification__AbsolutePathBuf, + path: V2ThreadUnarchiveResponse__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -21614,43 +27614,49 @@ export const V2TurnCompletedNotification__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2TurnCompletedNotification__CommandAction" }); +).annotate({ identifier: "V2ThreadUnarchiveResponse__CommandAction" }); -export type V2TurnCompletedNotification__FileUpdateChange = { +export type V2ThreadUnarchiveResponse__FileUpdateChange = { readonly diff: string; - readonly kind: V2TurnCompletedNotification__PatchChangeKind; + readonly kind: V2ThreadUnarchiveResponse__PatchChangeKind; readonly path: string; }; -export const V2TurnCompletedNotification__FileUpdateChange = Schema.Struct({ +export const V2ThreadUnarchiveResponse__FileUpdateChange = Schema.Struct({ diff: Schema.String, - kind: V2TurnCompletedNotification__PatchChangeKind, + kind: V2ThreadUnarchiveResponse__PatchChangeKind, path: Schema.String, -}).annotate({ identifier: "V2TurnCompletedNotification__FileUpdateChange" }); +}).annotate({ identifier: "V2ThreadUnarchiveResponse__FileUpdateChange" }); -export type V2TurnCompletedNotification__CollabAgentState = { - readonly message?: string | null; - readonly status: V2TurnCompletedNotification__CollabAgentStatus; +export type V2ThreadUnarchiveResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2ThreadUnarchiveResponse__McpAppDisplayMode; + readonly resourceUri: string; }; -export const V2TurnCompletedNotification__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2TurnCompletedNotification__CollabAgentStatus, -}).annotate({ identifier: "V2TurnCompletedNotification__CollabAgentState" }); +export const V2ThreadUnarchiveResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2ThreadUnarchiveResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2ThreadUnarchiveResponse__McpAppUi", +}); -export type V2TurnPlanUpdatedNotification__TurnPlanStep = { - readonly status: V2TurnPlanUpdatedNotification__TurnPlanStepStatus; - readonly step: string; +export type V2ThreadUnarchiveResponse__CollabAgentState = { + readonly message?: string | null; + readonly status: V2ThreadUnarchiveResponse__CollabAgentStatus; }; -export const V2TurnPlanUpdatedNotification__TurnPlanStep = Schema.Struct({ - status: V2TurnPlanUpdatedNotification__TurnPlanStepStatus, - step: Schema.String, -}).annotate({ identifier: "V2TurnPlanUpdatedNotification__TurnPlanStep" }); +export const V2ThreadUnarchiveResponse__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ThreadUnarchiveResponse__CollabAgentStatus, +}).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentState" }); -export type V2TurnStartedNotification__CodexErrorInfo = +export type V2TurnCompletedNotification__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -21663,17 +27669,19 @@ export type V2TurnStartedNotification__CodexErrorInfo = | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } | { readonly activeTurnNotSteerable: { - readonly turnKind: V2TurnStartedNotification__NonSteerableTurnKind; + readonly turnKind: V2TurnCompletedNotification__NonSteerableTurnKind; }; }; -export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( +export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union( [ Schema.Literals([ "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -21757,7 +27765,7 @@ export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( }), Schema.Struct({ activeTurnNotSteerable: Schema.Struct({ - turnKind: V2TurnStartedNotification__NonSteerableTurnKind, + turnKind: V2TurnCompletedNotification__NonSteerableTurnKind, }), }).annotate({ title: "ActiveTurnNotSteerableCodexErrorInfo", @@ -21769,16 +27777,49 @@ export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( ).annotate({ description: "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", - identifier: "V2TurnStartedNotification__CodexErrorInfo", + identifier: "V2TurnCompletedNotification__CodexErrorInfo", }); -export type V2TurnStartedNotification__TextElement = { - readonly byteRange: V2TurnStartedNotification__ByteRange; +export type V2TurnCompletedNotification__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2TurnCompletedNotification__MisalignmentSteer | null; +}; +export const V2TurnCompletedNotification__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2TurnCompletedNotification__MisalignmentErrorDetails" }); + +export type V2TurnCompletedNotification__TextElement = { + readonly byteRange: V2TurnCompletedNotification__ByteRange; readonly placeholder?: string | null; }; -export const V2TurnStartedNotification__TextElement = Schema.Struct({ +export const V2TurnCompletedNotification__TextElement = Schema.Struct({ byteRange: Schema.suspend( - (): Schema.Codec => V2TurnStartedNotification__ByteRange, + (): Schema.Codec => + V2TurnCompletedNotification__ByteRange, ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), placeholder: Schema.optionalKey( Schema.Union([ @@ -21788,22 +27829,84 @@ export const V2TurnStartedNotification__TextElement = Schema.Struct({ Schema.Null, ]), ), -}).annotate({ identifier: "V2TurnStartedNotification__TextElement" }); +}).annotate({ identifier: "V2TurnCompletedNotification__TextElement" }); -export type V2TurnStartedNotification__MemoryCitation = { - readonly entries: ReadonlyArray; +export type V2TurnCompletedNotification__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2TurnCompletedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2TurnCompletedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2TurnCompletedNotification__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2TurnCompletedNotification__FunctionCallOutputContentItem", +}); + +export type V2TurnCompletedNotification__MemoryCitation = { + readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; }; -export const V2TurnStartedNotification__MemoryCitation = Schema.Struct({ - entries: Schema.Array(V2TurnStartedNotification__MemoryCitationEntry), +export const V2TurnCompletedNotification__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2TurnCompletedNotification__MemoryCitationEntry), threadIds: Schema.Array(Schema.String), -}).annotate({ identifier: "V2TurnStartedNotification__MemoryCitation" }); +}).annotate({ identifier: "V2TurnCompletedNotification__MemoryCitation" }); -export type V2TurnStartedNotification__CommandAction = +export type V2TurnCompletedNotification__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2TurnStartedNotification__AbsolutePathBuf; + readonly path: V2TurnCompletedNotification__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -21814,12 +27917,12 @@ export type V2TurnStartedNotification__CommandAction = readonly type: "search"; } | { readonly command: string; readonly type: "unknown" }; -export const V2TurnStartedNotification__CommandAction = Schema.Union( +export const V2TurnCompletedNotification__CommandAction = Schema.Union( [ Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2TurnStartedNotification__AbsolutePathBuf, + path: V2TurnCompletedNotification__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -21839,66 +27942,473 @@ export const V2TurnStartedNotification__CommandAction = Schema.Union( }).annotate({ title: "UnknownCommandAction" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2TurnStartedNotification__CommandAction" }); +).annotate({ identifier: "V2TurnCompletedNotification__CommandAction" }); -export type V2TurnStartedNotification__FileUpdateChange = { +export type V2TurnCompletedNotification__FileUpdateChange = { readonly diff: string; - readonly kind: V2TurnStartedNotification__PatchChangeKind; + readonly kind: V2TurnCompletedNotification__PatchChangeKind; readonly path: string; }; -export const V2TurnStartedNotification__FileUpdateChange = Schema.Struct({ +export const V2TurnCompletedNotification__FileUpdateChange = Schema.Struct({ diff: Schema.String, - kind: V2TurnStartedNotification__PatchChangeKind, + kind: V2TurnCompletedNotification__PatchChangeKind, path: Schema.String, -}).annotate({ identifier: "V2TurnStartedNotification__FileUpdateChange" }); - -export type V2TurnStartedNotification__CollabAgentState = { - readonly message?: string | null; - readonly status: V2TurnStartedNotification__CollabAgentStatus; -}; -export const V2TurnStartedNotification__CollabAgentState = Schema.Struct({ - message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2TurnStartedNotification__CollabAgentStatus, -}).annotate({ identifier: "V2TurnStartedNotification__CollabAgentState" }); +}).annotate({ identifier: "V2TurnCompletedNotification__FileUpdateChange" }); -export type V2TurnStartParams__Settings = { - readonly developer_instructions?: string | null; - readonly model: string; - readonly reasoning_effort?: V2TurnStartParams__ReasoningEffort | null; +export type V2TurnCompletedNotification__McpAppUi = { + readonly preferredModelDisplayMode: V2TurnCompletedNotification__McpAppDisplayMode; + readonly resourceUri: string; }; -export const V2TurnStartParams__Settings = Schema.Struct({ - developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.String, - reasoning_effort: Schema.optionalKey( - Schema.Union([V2TurnStartParams__ReasoningEffort, Schema.Null]), - ), +export const V2TurnCompletedNotification__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2TurnCompletedNotification__McpAppDisplayMode, + resourceUri: Schema.String, }).annotate({ - description: "Settings for a collaboration mode.", - identifier: "V2TurnStartParams__Settings", + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2TurnCompletedNotification__McpAppUi", }); -export type V2TurnStartParams__TextElement = { - readonly byteRange: V2TurnStartParams__ByteRange; - readonly placeholder?: string | null; +export type V2TurnCompletedNotification__CollabAgentState = { + readonly message?: string | null; + readonly status: V2TurnCompletedNotification__CollabAgentStatus; }; -export const V2TurnStartParams__TextElement = Schema.Struct({ - byteRange: Schema.suspend( - (): Schema.Codec => V2TurnStartParams__ByteRange, - ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), - placeholder: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional human-readable placeholder for the element, displayed in the UI.", - }), - Schema.Null, - ]), - ), -}).annotate({ identifier: "V2TurnStartParams__TextElement" }); +export const V2TurnCompletedNotification__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2TurnCompletedNotification__CollabAgentStatus, +}).annotate({ identifier: "V2TurnCompletedNotification__CollabAgentState" }); -export type V2TurnStartParams__SandboxPolicy = - | { readonly type: "dangerFullAccess" } - | { readonly networkAccess?: boolean; readonly type: "readOnly" } - | { readonly networkAccess?: V2TurnStartParams__NetworkAccess; readonly type: "externalSandbox" } +export type V2TurnPlanUpdatedNotification__TurnPlanStep = { + readonly status: V2TurnPlanUpdatedNotification__TurnPlanStepStatus; + readonly step: string; +}; +export const V2TurnPlanUpdatedNotification__TurnPlanStep = Schema.Struct({ + status: V2TurnPlanUpdatedNotification__TurnPlanStepStatus, + step: Schema.String, +}).annotate({ identifier: "V2TurnPlanUpdatedNotification__TurnPlanStep" }); + +export type V2TurnStartedNotification__CodexErrorInfo = + | "contextWindowExceeded" + | "sessionBudgetExceeded" + | "usageLimitExceeded" + | "rateLimitExceeded" + | "serverOverloaded" + | "cyberPolicy" + | "misalignmentPolicyViolation" + | "internalServerError" + | "unauthorized" + | "badRequest" + | "threadRollbackFailed" + | "sandboxError" + | "other" + | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } } + | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } } + | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } } + | { readonly responseTooManyFailedAttempts: { readonly httpStatusCode?: number | null } } + | { + readonly activeTurnNotSteerable: { + readonly turnKind: V2TurnStartedNotification__NonSteerableTurnKind; + }; + }; +export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union( + [ + Schema.Literals([ + "contextWindowExceeded", + "sessionBudgetExceeded", + "usageLimitExceeded", + "rateLimitExceeded", + "serverOverloaded", + "cyberPolicy", + "misalignmentPolicyViolation", + "internalServerError", + "unauthorized", + "badRequest", + "threadRollbackFailed", + "sandboxError", + "other", + ]), + Schema.Struct({ + httpConnectionFailed: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ title: "HttpConnectionFailedCodexErrorInfo" }), + Schema.Struct({ + responseStreamConnectionFailed: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ + title: "ResponseStreamConnectionFailedCodexErrorInfo", + description: "Failed to connect to the response SSE stream.", + }), + Schema.Struct({ + responseStreamDisconnected: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ + title: "ResponseStreamDisconnectedCodexErrorInfo", + description: + "The response SSE stream disconnected in the middle of a turn before completion.", + }), + Schema.Struct({ + responseTooManyFailedAttempts: Schema.Struct({ + httpStatusCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint16" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + }), + }).annotate({ + title: "ResponseTooManyFailedAttemptsCodexErrorInfo", + description: "Reached the retry limit for responses.", + }), + Schema.Struct({ + activeTurnNotSteerable: Schema.Struct({ + turnKind: V2TurnStartedNotification__NonSteerableTurnKind, + }), + }).annotate({ + title: "ActiveTurnNotSteerableCodexErrorInfo", + description: + "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", + }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + identifier: "V2TurnStartedNotification__CodexErrorInfo", +}); + +export type V2TurnStartedNotification__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2TurnStartedNotification__MisalignmentSteer | null; +}; +export const V2TurnStartedNotification__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2TurnStartedNotification__MisalignmentErrorDetails" }); + +export type V2TurnStartedNotification__TextElement = { + readonly byteRange: V2TurnStartedNotification__ByteRange; + readonly placeholder?: string | null; +}; +export const V2TurnStartedNotification__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2TurnStartedNotification__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2TurnStartedNotification__TextElement" }); + +export type V2TurnStartedNotification__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2TurnStartedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2TurnStartedNotification__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2TurnStartedNotification__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2TurnStartedNotification__FunctionCallOutputContentItem", +}); + +export type V2TurnStartedNotification__MemoryCitation = { + readonly entries: ReadonlyArray; + readonly threadIds: ReadonlyArray; +}; +export const V2TurnStartedNotification__MemoryCitation = Schema.Struct({ + entries: Schema.Array(V2TurnStartedNotification__MemoryCitationEntry), + threadIds: Schema.Array(Schema.String), +}).annotate({ identifier: "V2TurnStartedNotification__MemoryCitation" }); + +export type V2TurnStartedNotification__CommandAction = + | { + readonly command: string; + readonly name: string; + readonly path: V2TurnStartedNotification__LegacyAppPathString; + readonly type: "read"; + } + | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } + | { + readonly command: string; + readonly path?: string | null; + readonly query?: string | null; + readonly type: "search"; + } + | { readonly command: string; readonly type: "unknown" }; +export const V2TurnStartedNotification__CommandAction = Schema.Union( + [ + Schema.Struct({ + command: Schema.String, + name: Schema.String, + path: V2TurnStartedNotification__LegacyAppPathString, + type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), + }).annotate({ title: "ReadCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("listFiles").annotate({ title: "ListFilesCommandActionType" }), + }).annotate({ title: "ListFilesCommandAction" }), + Schema.Struct({ + command: Schema.String, + path: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + query: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("search").annotate({ title: "SearchCommandActionType" }), + }).annotate({ title: "SearchCommandAction" }), + Schema.Struct({ + command: Schema.String, + type: Schema.Literal("unknown").annotate({ title: "UnknownCommandActionType" }), + }).annotate({ title: "UnknownCommandAction" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2TurnStartedNotification__CommandAction" }); + +export type V2TurnStartedNotification__FileUpdateChange = { + readonly diff: string; + readonly kind: V2TurnStartedNotification__PatchChangeKind; + readonly path: string; +}; +export const V2TurnStartedNotification__FileUpdateChange = Schema.Struct({ + diff: Schema.String, + kind: V2TurnStartedNotification__PatchChangeKind, + path: Schema.String, +}).annotate({ identifier: "V2TurnStartedNotification__FileUpdateChange" }); + +export type V2TurnStartedNotification__McpAppUi = { + readonly preferredModelDisplayMode: V2TurnStartedNotification__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2TurnStartedNotification__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2TurnStartedNotification__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2TurnStartedNotification__McpAppUi", +}); + +export type V2TurnStartedNotification__CollabAgentState = { + readonly message?: string | null; + readonly status: V2TurnStartedNotification__CollabAgentStatus; +}; +export const V2TurnStartedNotification__CollabAgentState = Schema.Struct({ + message: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2TurnStartedNotification__CollabAgentStatus, +}).annotate({ identifier: "V2TurnStartedNotification__CollabAgentState" }); + +export type V2TurnStartParams__Settings = { + readonly developer_instructions?: string | null; + readonly model: string; + readonly reasoning_effort?: V2TurnStartParams__ReasoningEffort | null; +}; +export const V2TurnStartParams__Settings = Schema.Struct({ + developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.String, + reasoning_effort: Schema.optionalKey( + Schema.Union([V2TurnStartParams__ReasoningEffort, Schema.Null]), + ), +}).annotate({ + description: "Settings for a collaboration mode.", + identifier: "V2TurnStartParams__Settings", +}); + +export type V2TurnStartParams__TextElement = { + readonly byteRange: V2TurnStartParams__ByteRange; + readonly placeholder?: string | null; +}; +export const V2TurnStartParams__TextElement = Schema.Struct({ + byteRange: Schema.suspend( + (): Schema.Codec => V2TurnStartParams__ByteRange, + ).annotate({ description: "Byte range in the parent `text` buffer that this element occupies." }), + placeholder: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional human-readable placeholder for the element, displayed in the UI.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2TurnStartParams__TextElement" }); + +export type V2TurnStartParams__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2TurnStartParams__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2TurnStartParams__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2TurnStartParams__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2TurnStartParams__FunctionCallOutputContentItem", +}); + +export type V2TurnStartParams__SandboxPolicy = + | { readonly type: "dangerFullAccess" } + | { readonly networkAccess?: boolean; readonly type: "readOnly" } + | { readonly networkAccess?: V2TurnStartParams__NetworkAccess; readonly type: "externalSandbox" } | { readonly excludeSlashTmp?: boolean; readonly excludeTmpdirEnvVar?: boolean; @@ -21944,8 +28454,10 @@ export type V2TurnStartResponse__CodexErrorInfo = | "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" + | "rateLimitExceeded" | "serverOverloaded" | "cyberPolicy" + | "misalignmentPolicyViolation" | "internalServerError" | "unauthorized" | "badRequest" @@ -21967,8 +28479,10 @@ export const V2TurnStartResponse__CodexErrorInfo = Schema.Union( "contextWindowExceeded", "sessionBudgetExceeded", "usageLimitExceeded", + "rateLimitExceeded", "serverOverloaded", "cyberPolicy", + "misalignmentPolicyViolation", "internalServerError", "unauthorized", "badRequest", @@ -22067,6 +28581,38 @@ export const V2TurnStartResponse__CodexErrorInfo = Schema.Union( identifier: "V2TurnStartResponse__CodexErrorInfo", }); +export type V2TurnStartResponse__MisalignmentErrorDetails = { + readonly detailedExplanation?: string | null; + readonly errorType?: string | null; + readonly steer?: V2TurnStartResponse__MisalignmentSteer | null; +}; +export const V2TurnStartResponse__MisalignmentErrorDetails = Schema.Struct({ + detailedExplanation: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "A substantive localized explanation is required before offering continuation.", + }), + Schema.Null, + ]), + ), + errorType: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Open-ended classification; clients must accept categories added by Responses.", + }), + Schema.Null, + ]), + ), + steer: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__MisalignmentSteer, Schema.Null]).annotate({ + description: + "Instruction to submit as the next turn's user input if continuation is confirmed.", + }), + ), +}).annotate({ identifier: "V2TurnStartResponse__MisalignmentErrorDetails" }); + export type V2TurnStartResponse__TextElement = { readonly byteRange: V2TurnStartResponse__ByteRange; readonly placeholder?: string | null; @@ -22085,6 +28631,64 @@ export const V2TurnStartResponse__TextElement = Schema.Struct({ ), }).annotate({ identifier: "V2TurnStartResponse__TextElement" }); +export type V2TurnStartResponse__FunctionCallOutputContentItem = + | { readonly text: string; readonly type: "input_text" } + | { + readonly detail?: V2TurnStartResponse__ImageDetail | null; + readonly type: "input_image"; + readonly image_url: string; + } + | { + readonly detail?: V2TurnStartResponse__ImageDetail | null; + readonly type: "input_image"; + readonly file_id: string; + } + | { readonly audio_url: string; readonly type: "input_audio" } + | { readonly encrypted_content: string; readonly type: "encrypted_content" }; +export const V2TurnStartResponse__FunctionCallOutputContentItem = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + type: Schema.Literal("input_text").annotate({ + title: "InputTextFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputTextFunctionCallOutputContentItem" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + image_url: Schema.String, + }).annotate({ title: "ImageUrlFunctionCallOutputContentItem" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("input_image").annotate({ + title: "InputImageFunctionCallOutputContentItemType", + }), + file_id: Schema.String, + }).annotate({ title: "FileIdFunctionCallOutputContentItem" }), + ]).annotate({ title: "InputImageFunctionCallOutputContentItem" }), + Schema.Struct({ + audio_url: Schema.String, + type: Schema.Literal("input_audio").annotate({ + title: "InputAudioFunctionCallOutputContentItemType", + }), + }).annotate({ title: "InputAudioFunctionCallOutputContentItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + type: Schema.Literal("encrypted_content").annotate({ + title: "EncryptedContentFunctionCallOutputContentItemType", + }), + }).annotate({ title: "EncryptedContentFunctionCallOutputContentItem" }), + ], + { mode: "oneOf" }, +).annotate({ + description: + "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + identifier: "V2TurnStartResponse__FunctionCallOutputContentItem", +}); + export type V2TurnStartResponse__MemoryCitation = { readonly entries: ReadonlyArray; readonly threadIds: ReadonlyArray; @@ -22098,7 +28702,7 @@ export type V2TurnStartResponse__CommandAction = | { readonly command: string; readonly name: string; - readonly path: V2TurnStartResponse__AbsolutePathBuf; + readonly path: V2TurnStartResponse__LegacyAppPathString; readonly type: "read"; } | { readonly command: string; readonly path?: string | null; readonly type: "listFiles" } @@ -22114,7 +28718,7 @@ export const V2TurnStartResponse__CommandAction = Schema.Union( Schema.Struct({ command: Schema.String, name: Schema.String, - path: V2TurnStartResponse__AbsolutePathBuf, + path: V2TurnStartResponse__LegacyAppPathString, type: Schema.Literal("read").annotate({ title: "ReadCommandActionType" }), }).annotate({ title: "ReadCommandAction" }), Schema.Struct({ @@ -22147,6 +28751,19 @@ export const V2TurnStartResponse__FileUpdateChange = Schema.Struct({ path: Schema.String, }).annotate({ identifier: "V2TurnStartResponse__FileUpdateChange" }); +export type V2TurnStartResponse__McpAppUi = { + readonly preferredModelDisplayMode: V2TurnStartResponse__McpAppDisplayMode; + readonly resourceUri: string; +}; +export const V2TurnStartResponse__McpAppUi = Schema.Struct({ + preferredModelDisplayMode: V2TurnStartResponse__McpAppDisplayMode, + resourceUri: Schema.String, +}).annotate({ + description: + "UI resource and display preference for model invocations, captured from the tool descriptor.", + identifier: "V2TurnStartResponse__McpAppUi", +}); + export type V2TurnStartResponse__CollabAgentState = { readonly message?: string | null; readonly status: V2TurnStartResponse__CollabAgentStatus; @@ -22182,12 +28799,13 @@ export type ApplyPatchApprovalResponse__ReviewDecision = }; } | "approved_for_session" + | "approved_mcp_policy_amendment" | { readonly network_policy_amendment: { readonly network_policy_amendment: ApplyPatchApprovalResponse__NetworkPolicyAmendment; }; } - | "denied" + | { readonly denied: { readonly rejection: string } } | "timed_out" | "abort"; export const ApplyPatchApprovalResponse__ReviewDecision = Schema.Union( @@ -22208,6 +28826,10 @@ export const ApplyPatchApprovalResponse__ReviewDecision = Schema.Union( description: "User has approved this request and wants future prompts in the same session-scoped approval cache to be automatically approved for the remainder of the session.", }), + Schema.Literal("approved_mcp_policy_amendment").annotate({ + description: + "User has approved this MCP tool call and wants to amend its policy so matching future calls are automatically approved across sessions.", + }), Schema.Struct({ network_policy_amendment: Schema.Struct({ network_policy_amendment: ApplyPatchApprovalResponse__NetworkPolicyAmendment, @@ -22217,7 +28839,8 @@ export const ApplyPatchApprovalResponse__ReviewDecision = Schema.Union( description: "User chose to persist a network policy rule (allow/deny) for future requests to the same host.", }), - Schema.Literal("denied").annotate({ + Schema.Struct({ denied: Schema.Struct({ rejection: Schema.String }) }).annotate({ + title: "DeniedReviewDecision", description: "User has denied this command and the agent should not execute it, but it should continue the session and try something else.", }), @@ -22274,6 +28897,11 @@ export type ClientRequest__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: ClientRequest__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: ClientRequest__ImageDetail | null; readonly path: string; @@ -22295,11 +28923,18 @@ export const ClientRequest__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([ClientRequest__ImageDetail, Schema.Null])), path: Schema.String, @@ -22473,6 +29108,19 @@ export const ClientRequest__ExternalAgentConfigMigrationItem = Schema.Struct({ itemType: ClientRequest__ExternalAgentConfigMigrationItemType, }).annotate({ identifier: "ClientRequest__ExternalAgentConfigMigrationItem" }); +export type ClientRequest__ExternalAgentConfigImportHistoryRecordTypeResultParams = { + readonly failures: ReadonlyArray; + readonly itemType: ClientRequest__ExternalAgentConfigMigrationItemType; + readonly successes: ReadonlyArray; +}; +export const ClientRequest__ExternalAgentConfigImportHistoryRecordTypeResultParams = Schema.Struct({ + failures: Schema.Array(ClientRequest__ExternalAgentConfigImportItemTypeFailure), + itemType: ClientRequest__ExternalAgentConfigMigrationItemType, + successes: Schema.Array(ClientRequest__ExternalAgentConfigImportHistoryRecordSuccessParams), +}).annotate({ + identifier: "ClientRequest__ExternalAgentConfigImportHistoryRecordTypeResultParams", +}); + export type ClientRequest__ConfigBatchWriteParams = { readonly edits: ReadonlyArray; readonly expectedVersion?: string | null; @@ -22494,7 +29142,7 @@ export const ClientRequest__ConfigBatchWriteParams = Schema.Struct({ reloadUserConfig: Schema.optionalKey( Schema.Boolean.annotate({ description: - "When true, hot-reload the updated user config into all loaded threads after writing.", + "When true, hot-reload updated runtime settings into loaded threads after writing. Session-static model, reasoning-effort, Plan-mode reasoning-effort, and service-tier defaults are not reloaded. The deprecated personality setting is also not reloaded.", }), ), }).annotate({ identifier: "ClientRequest__ConfigBatchWriteParams" }); @@ -22587,12 +29235,13 @@ export type ExecCommandApprovalResponse__ReviewDecision = }; } | "approved_for_session" + | "approved_mcp_policy_amendment" | { readonly network_policy_amendment: { readonly network_policy_amendment: ExecCommandApprovalResponse__NetworkPolicyAmendment; }; } - | "denied" + | { readonly denied: { readonly rejection: string } } | "timed_out" | "abort"; export const ExecCommandApprovalResponse__ReviewDecision = Schema.Union( @@ -22613,6 +29262,10 @@ export const ExecCommandApprovalResponse__ReviewDecision = Schema.Union( description: "User has approved this request and wants future prompts in the same session-scoped approval cache to be automatically approved for the remainder of the session.", }), + Schema.Literal("approved_mcp_policy_amendment").annotate({ + description: + "User has approved this MCP tool call and wants to amend its policy so matching future calls are automatically approved across sessions.", + }), Schema.Struct({ network_policy_amendment: Schema.Struct({ network_policy_amendment: ExecCommandApprovalResponse__NetworkPolicyAmendment, @@ -22622,7 +29275,8 @@ export const ExecCommandApprovalResponse__ReviewDecision = Schema.Union( description: "User chose to persist a network policy rule (allow/deny) for future requests to the same host.", }), - Schema.Literal("denied").annotate({ + Schema.Struct({ denied: Schema.Struct({ rejection: Schema.String }) }).annotate({ + title: "DeniedReviewDecision", description: "User has denied this command and the agent should not execute it, but it should continue the session and try something else.", }), @@ -22797,6 +29451,7 @@ export type ServerNotification__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: ServerNotification__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: ServerNotification__MisalignmentErrorDetails | null; }; export const ServerNotification__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -22804,8 +29459,26 @@ export const ServerNotification__TurnError = Schema.Struct({ Schema.Union([ServerNotification__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([ServerNotification__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "ServerNotification__TurnError" }); +export type ServerNotification__CollaborationMode = { + readonly mode: ServerNotification__ModeKind; + readonly settings: ServerNotification__Settings; +}; +export const ServerNotification__CollaborationMode = Schema.Struct({ + mode: ServerNotification__ModeKind, + settings: ServerNotification__Settings, +}).annotate({ + description: "Collaboration mode for a Codex session.", + identifier: "ServerNotification__CollaborationMode", +}); + export type ServerNotification__SessionSource = | "cli" | "vscode" @@ -22845,6 +29518,11 @@ export type ServerNotification__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: ServerNotification__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: ServerNotification__ImageDetail | null; readonly path: string; @@ -22866,11 +29544,18 @@ export const ServerNotification__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([ServerNotification__ImageDetail, Schema.Null])), path: Schema.String, @@ -22898,6 +29583,14 @@ export const ServerNotification__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "ServerNotification__UserInput" }); +export type ServerNotification__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const ServerNotification__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(ServerNotification__FunctionCallOutputContentItem), +]).annotate({ identifier: "ServerNotification__FunctionCallOutputBody" }); + export type ServerNotification__FileSystemPath = | { readonly path: ServerNotification__LegacyAppPathString; readonly type: "path" } | { readonly pattern: string; readonly type: "glob_pattern" } @@ -22933,18 +29626,6 @@ export const ServerNotification__FileChangePatchUpdatedNotification = Schema.Str turnId: Schema.String, }).annotate({ identifier: "ServerNotification__FileChangePatchUpdatedNotification" }); -export type ServerNotification__CollaborationMode = { - readonly mode: ServerNotification__ModeKind; - readonly settings: ServerNotification__Settings; -}; -export const ServerNotification__CollaborationMode = Schema.Struct({ - mode: ServerNotification__ModeKind, - settings: ServerNotification__Settings, -}).annotate({ - description: "Collaboration mode for a Codex session.", - identifier: "ServerNotification__CollaborationMode", -}); - export type ServerNotification__ThreadGoalUpdatedNotification = { readonly goal: ServerNotification__ThreadGoal; readonly threadId: string; @@ -23147,6 +29828,30 @@ export const ServerNotification__FuzzyFileSearchSessionUpdatedNotification = Sch sessionId: Schema.String, }).annotate({ identifier: "ServerNotification__FuzzyFileSearchSessionUpdatedNotification" }); +export type ServerNotification__ThreadRealtimeItemStartedNotification = { + readonly item: ServerNotification__ThreadRealtimeItem; + readonly threadId: string; +}; +export const ServerNotification__ThreadRealtimeItemStartedNotification = Schema.Struct({ + item: ServerNotification__ThreadRealtimeItem, + threadId: Schema.String, +}).annotate({ + description: "EXPERIMENTAL - a realtime timeline item started before its content streams.", + identifier: "ServerNotification__ThreadRealtimeItemStartedNotification", +}); + +export type ServerNotification__ThreadRealtimeItemCompletedNotification = { + readonly item: ServerNotification__ThreadRealtimeItem; + readonly threadId: string; +}; +export const ServerNotification__ThreadRealtimeItemCompletedNotification = Schema.Struct({ + item: ServerNotification__ThreadRealtimeItem, + threadId: Schema.String, +}).annotate({ + description: "EXPERIMENTAL - a realtime timeline item published after canonical commit.", + identifier: "ServerNotification__ThreadRealtimeItemCompletedNotification", +}); + export type ServerRequest__FileSystemPath = | { readonly path: ServerRequest__LegacyAppPathString; readonly type: "path" } | { readonly pattern: string; readonly type: "glob_pattern" } @@ -23176,6 +29881,7 @@ export type ServerRequest__CommandExecutionRequestApprovalParams = { readonly cwd?: ServerRequest__LegacyAppPathString | null; readonly environmentId?: string | null; readonly itemId: string; + readonly kind?: ServerRequest__CommandExecutionApprovalKind; readonly networkApprovalContext?: ServerRequest__NetworkApprovalContext | null; readonly proposedExecpolicyAmendment?: ReadonlyArray | null; readonly proposedNetworkPolicyAmendments?: ReadonlyArray | null; @@ -23189,7 +29895,7 @@ export const ServerRequest__CommandExecutionRequestApprovalParams = Schema.Struc Schema.Union([ Schema.String.annotate({ description: - "Unique identifier for this specific approval callback.\n\nFor regular shell/unified_exec approvals, this is null.\n\nFor zsh-exec-bridge subcommand approvals, multiple callbacks can belong to one parent `itemId`, so `approvalId` is a distinct opaque callback id (a UUID) used to disambiguate routing.", + "Unique identifier for this specific approval callback.\n\nFor regular shell/unified_exec approvals, this is null.\n\nFor zsh-exec-bridge subcommand approvals, multiple callbacks can belong to one parent `itemId`, so `approvalId` is a distinct opaque callback id (a UUID) used to disambiguate routing. Stdin approvals also use a distinct callback id; inspect `kind` to distinguish them.", }), Schema.Null, ]), @@ -23220,6 +29926,15 @@ export const ServerRequest__CommandExecutionRequestApprovalParams = Schema.Struc ]), ), itemId: Schema.String, + kind: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + ServerRequest__CommandExecutionApprovalKind, + ).annotate({ + description: "Kind of action under review. Defaults to `command` for older servers.", + default: "command", + }), + ), networkApprovalContext: Schema.optionalKey( Schema.Union([ServerRequest__NetworkApprovalContext, Schema.Null]).annotate({ description: "Optional context for a managed-network approval prompt.", @@ -23261,6 +29976,7 @@ export const ServerRequest__CommandExecutionRequestApprovalParams = Schema.Struc export type ServerRequest__ToolRequestUserInputParams = { readonly autoResolutionMs?: number | null; + readonly isBlocking: boolean; readonly itemId: string; readonly questions: ReadonlyArray; readonly threadId: string; @@ -23269,7 +29985,10 @@ export type ServerRequest__ToolRequestUserInputParams = { export const ServerRequest__ToolRequestUserInputParams = Schema.Struct({ autoResolutionMs: Schema.optionalKey( Schema.Union([ - Schema.Number.annotate({ format: "uint64" }) + Schema.Number.annotate({ + description: "@deprecated Use `isBlocking` to decide whether the request should block.", + format: "uint64", + }) .check(Schema.isInt().annotate({ expected: "an integer" })) .check( Schema.isGreaterThanOrEqualTo(0).annotate({ @@ -23279,6 +29998,7 @@ export const ServerRequest__ToolRequestUserInputParams = Schema.Struct({ Schema.Null, ]), ), + isBlocking: Schema.Boolean, itemId: Schema.String, questions: Schema.Array(ServerRequest__ToolRequestUserInputQuestion), threadId: Schema.String, @@ -23482,6 +30202,42 @@ export const V2AppsListResponse__AppInfo = Schema.Struct({ identifier: "V2AppsListResponse__AppInfo", }); +export type V2ConfigReadResponse__BrowserUseConfig = { + readonly allow_history_access?: boolean | null; + readonly default_origin_policy?: V2ConfigReadResponse__BrowserUseOriginPolicyConfig | null; + readonly origins?: { + readonly [x: string]: V2ConfigReadResponse__BrowserUseOriginPolicyConfig; + } | null; +}; +export const V2ConfigReadResponse__BrowserUseConfig = Schema.Struct({ + allow_history_access: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + default_origin_policy: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__BrowserUseOriginPolicyConfig, Schema.Null]), + ), + origins: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, V2ConfigReadResponse__BrowserUseOriginPolicyConfig), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ConfigReadResponse__BrowserUseConfig" }); + +export type V2ConfigReadResponse__ComputerUseWindowsConfig = { + readonly aumids?: { readonly [x: string]: V2ConfigReadResponse__AllowDenyRequirement } | null; + readonly exes?: ReadonlyArray | null; +}; +export const V2ConfigReadResponse__ComputerUseWindowsConfig = Schema.Struct({ + aumids: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, V2ConfigReadResponse__AllowDenyRequirement), + Schema.Null, + ]), + ), + exes: Schema.optionalKey( + Schema.Union([Schema.Array(V2ConfigReadResponse__ComputerUseWindowsExeConfig), Schema.Null]), + ), +}).annotate({ identifier: "V2ConfigReadResponse__ComputerUseWindowsConfig" }); + export type V2ConfigReadResponse__ToolsV2 = { readonly web_search?: V2ConfigReadResponse__WebSearchToolConfig | null; }; @@ -23513,6 +30269,53 @@ export const V2ConfigReadResponse__ConfigLayerMetadata = Schema.Struct({ version: Schema.String, }).annotate({ identifier: "V2ConfigReadResponse__ConfigLayerMetadata" }); +export type V2ConfigRequirementsReadResponse__ComputerUseWindowsRequirements = { + readonly aumids?: { + readonly [x: string]: V2ConfigRequirementsReadResponse__AllowDenyRequirement; + } | null; + readonly exes?: ReadonlyArray | null; +}; +export const V2ConfigRequirementsReadResponse__ComputerUseWindowsRequirements = Schema.Struct({ + aumids: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, V2ConfigRequirementsReadResponse__AllowDenyRequirement), + Schema.Null, + ]), + ), + exes: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ConfigRequirementsReadResponse__ComputerUseWindowsExeRequirement), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ComputerUseWindowsRequirements" }); + +export type V2ConfigRequirementsReadResponse__BrowserUseRequirements = { + readonly allowGlobalPersistentApproval?: boolean | null; + readonly allowHistoryAccess?: boolean | null; + readonly allowWebmcp?: boolean | null; + readonly defaultOriginPolicy?: V2ConfigRequirementsReadResponse__BrowserUseOriginPolicy | null; + readonly disableAutoReview?: boolean | null; + readonly origins?: { + readonly [x: string]: V2ConfigRequirementsReadResponse__BrowserUseOriginPolicy; + } | null; +}; +export const V2ConfigRequirementsReadResponse__BrowserUseRequirements = Schema.Struct({ + allowGlobalPersistentApproval: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowHistoryAccess: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowWebmcp: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + defaultOriginPolicy: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__BrowserUseOriginPolicy, Schema.Null]), + ), + disableAutoReview: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + origins: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, V2ConfigRequirementsReadResponse__BrowserUseOriginPolicy), + Schema.Null, + ]), + ), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__BrowserUseRequirements" }); + export type V2ConfigRequirementsReadResponse__ModelsRequirements = { readonly newThread?: V2ConfigRequirementsReadResponse__NewThreadModelDefaults | null; }; @@ -23535,6 +30338,7 @@ export type V2ErrorNotification__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ErrorNotification__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ErrorNotification__MisalignmentErrorDetails | null; }; export const V2ErrorNotification__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -23542,6 +30346,12 @@ export const V2ErrorNotification__TurnError = Schema.Struct({ Schema.Union([V2ErrorNotification__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ErrorNotification__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ErrorNotification__TurnError" }); export type V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItem = { @@ -23594,6 +30404,7 @@ export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfi readonly completedAtMs: number; readonly failures: ReadonlyArray; readonly importId: string; + readonly providerId?: string | null; readonly successes: ReadonlyArray; }; export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportHistory = @@ -23605,6 +30416,7 @@ export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConf V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeFailure, ), importId: Schema.String, + providerId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), successes: Schema.Array( V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportItemTypeSuccess, ), @@ -23613,6 +30425,26 @@ export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConf "V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigImportHistory", }); +export type V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportHistoryRecordTypeResultParams = + { + readonly failures: ReadonlyArray; + readonly itemType: V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigMigrationItemType; + readonly successes: ReadonlyArray; + }; +export const V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportHistoryRecordTypeResultParams = + Schema.Struct({ + failures: Schema.Array( + V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportItemTypeFailure, + ), + itemType: V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigMigrationItemType, + successes: Schema.Array( + V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportHistoryRecordSuccessParams, + ), + }).annotate({ + identifier: + "V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportHistoryRecordTypeResultParams", + }); + export type V2ExternalAgentConfigImportParams__ExternalAgentConfigMigrationItem = { readonly cwd?: string | null; readonly description: string; @@ -23810,6 +30642,11 @@ export type V2ItemCompletedNotification__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ItemCompletedNotification__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ItemCompletedNotification__ImageDetail | null; readonly path: string; @@ -23831,13 +30668,22 @@ export const V2ItemCompletedNotification__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey( Schema.Union([V2ItemCompletedNotification__ImageDetail, Schema.Null]), @@ -23867,6 +30713,14 @@ export const V2ItemCompletedNotification__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ItemCompletedNotification__UserInput" }); +export type V2ItemCompletedNotification__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ItemCompletedNotification__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ItemCompletedNotification__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ItemCompletedNotification__FunctionCallOutputBody" }); + export type V2ItemGuardianApprovalReviewCompletedNotification__FileSystemPath = | { readonly path: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString; @@ -23934,6 +30788,11 @@ export type V2ItemStartedNotification__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ItemStartedNotification__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ItemStartedNotification__ImageDetail | null; readonly path: string; @@ -23955,13 +30814,22 @@ export const V2ItemStartedNotification__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey( Schema.Union([V2ItemStartedNotification__ImageDetail, Schema.Null]), @@ -23991,9 +30859,18 @@ export const V2ItemStartedNotification__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ItemStartedNotification__UserInput" }); +export type V2ItemStartedNotification__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ItemStartedNotification__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ItemStartedNotification__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ItemStartedNotification__FunctionCallOutputBody" }); + export type V2ModelListResponse__Model = { readonly additionalSpeedTiers?: ReadonlyArray; readonly availabilityNux?: V2ModelListResponse__ModelAvailabilityNux | null; + readonly availableAccessPrograms?: V2ModelListResponse__ModelAccessPrograms | null; readonly defaultReasoningEffort: V2ModelListResponse__ReasoningEffort; readonly defaultServiceTier?: string | null; readonly description: string; @@ -24003,6 +30880,8 @@ export type V2ModelListResponse__Model = { readonly inputModalities?: ReadonlyArray; readonly isDefault: boolean; readonly model: string; + readonly modelSpecialty?: string | null; + readonly multiAgentVersion?: V2ModelListResponse__MultiAgentVersion | null; readonly serviceTiers?: ReadonlyArray; readonly supportedReasoningEfforts: ReadonlyArray; readonly supportsPersonality?: boolean; @@ -24019,6 +30898,11 @@ export const V2ModelListResponse__Model = Schema.Struct({ availabilityNux: Schema.optionalKey( Schema.Union([V2ModelListResponse__ModelAvailabilityNux, Schema.Null]), ), + availableAccessPrograms: Schema.optionalKey( + Schema.Union([V2ModelListResponse__ModelAccessPrograms, Schema.Null]).annotate({ + description: "Null when the catalog does not provide access-program metadata.", + }), + ), defaultReasoningEffort: V2ModelListResponse__ReasoningEffort, defaultServiceTier: Schema.optionalKey( Schema.Union([ @@ -24037,11 +30921,22 @@ export const V2ModelListResponse__Model = Schema.Struct({ ), isDefault: Schema.Boolean, model: Schema.String, + modelSpecialty: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + multiAgentVersion: Schema.optionalKey( + Schema.Union([V2ModelListResponse__MultiAgentVersion, Schema.Null]).annotate({ + description: "Multi-agent runtime declared by this model, when available.", + }), + ), serviceTiers: Schema.optionalKey( Schema.Array(V2ModelListResponse__ModelServiceTier).annotate({ default: [] }), ), supportedReasoningEfforts: Schema.Array(V2ModelListResponse__ReasoningEffortOption), - supportsPersonality: Schema.optionalKey(Schema.Boolean.annotate({ default: false })), + supportsPersonality: Schema.optionalKey( + Schema.Boolean.annotate({ + description: "@deprecated Always false; models no longer support personality selection.", + default: false, + }), + ), upgrade: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), upgradeInfo: Schema.optionalKey( Schema.Union([V2ModelListResponse__ModelUpgradeInfo, Schema.Null]), @@ -24049,6 +30944,7 @@ export const V2ModelListResponse__Model = Schema.Struct({ }).annotate({ identifier: "V2ModelListResponse__Model" }); export type V2PluginInstalledResponse__PluginShareContext = { + readonly canPublishToWorkspace?: boolean | null; readonly creatorAccountUserId?: string | null; readonly creatorName?: string | null; readonly discoverability?: V2PluginInstalledResponse__PluginShareDiscoverability | null; @@ -24058,6 +30954,7 @@ export type V2PluginInstalledResponse__PluginShareContext = { readonly shareUrl?: string | null; }; export const V2PluginInstalledResponse__PluginShareContext = Schema.Struct({ + canPublishToWorkspace: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), discoverability: Schema.optionalKey( @@ -24079,6 +30976,7 @@ export const V2PluginInstalledResponse__PluginShareContext = Schema.Struct({ }).annotate({ identifier: "V2PluginInstalledResponse__PluginShareContext" }); export type V2PluginListResponse__PluginShareContext = { + readonly canPublishToWorkspace?: boolean | null; readonly creatorAccountUserId?: string | null; readonly creatorName?: string | null; readonly discoverability?: V2PluginListResponse__PluginShareDiscoverability | null; @@ -24088,6 +30986,7 @@ export type V2PluginListResponse__PluginShareContext = { readonly shareUrl?: string | null; }; export const V2PluginListResponse__PluginShareContext = Schema.Struct({ + canPublishToWorkspace: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), discoverability: Schema.optionalKey( @@ -24139,6 +31038,7 @@ export const V2PluginReadResponse__ScheduledTaskSummary = Schema.Struct({ }).annotate({ identifier: "V2PluginReadResponse__ScheduledTaskSummary" }); export type V2PluginReadResponse__PluginShareContext = { + readonly canPublishToWorkspace?: boolean | null; readonly creatorAccountUserId?: string | null; readonly creatorName?: string | null; readonly discoverability?: V2PluginReadResponse__PluginShareDiscoverability | null; @@ -24148,6 +31048,7 @@ export type V2PluginReadResponse__PluginShareContext = { readonly shareUrl?: string | null; }; export const V2PluginReadResponse__PluginShareContext = Schema.Struct({ + canPublishToWorkspace: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), discoverability: Schema.optionalKey( @@ -24169,6 +31070,7 @@ export const V2PluginReadResponse__PluginShareContext = Schema.Struct({ }).annotate({ identifier: "V2PluginReadResponse__PluginShareContext" }); export type V2PluginShareListResponse__PluginShareContext = { + readonly canPublishToWorkspace?: boolean | null; readonly creatorAccountUserId?: string | null; readonly creatorName?: string | null; readonly discoverability?: V2PluginShareListResponse__PluginShareDiscoverability | null; @@ -24178,6 +31080,7 @@ export type V2PluginShareListResponse__PluginShareContext = { readonly shareUrl?: string | null; }; export const V2PluginShareListResponse__PluginShareContext = Schema.Struct({ + canPublishToWorkspace: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), creatorAccountUserId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), creatorName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), discoverability: Schema.optionalKey( @@ -24210,6 +31113,7 @@ export type V2ReviewStartResponse__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ReviewStartResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ReviewStartResponse__MisalignmentErrorDetails | null; }; export const V2ReviewStartResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -24217,6 +31121,12 @@ export const V2ReviewStartResponse__TurnError = Schema.Struct({ Schema.Union([V2ReviewStartResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ReviewStartResponse__TurnError" }); export type V2ReviewStartResponse__UserInput = @@ -24230,6 +31140,11 @@ export type V2ReviewStartResponse__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ReviewStartResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ReviewStartResponse__ImageDetail | null; readonly path: string; @@ -24251,11 +31166,18 @@ export const V2ReviewStartResponse__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__ImageDetail, Schema.Null])), path: Schema.String, @@ -24283,6 +31205,14 @@ export const V2ReviewStartResponse__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ReviewStartResponse__UserInput" }); +export type V2ReviewStartResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ReviewStartResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ReviewStartResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ReviewStartResponse__FunctionCallOutputBody" }); + export type V2SkillsListResponse__SkillMetadata = { readonly dependencies?: V2SkillsListResponse__SkillDependencies | null; readonly description: string; @@ -24290,6 +31220,7 @@ export type V2SkillsListResponse__SkillMetadata = { readonly interface?: V2SkillsListResponse__SkillInterface | null; readonly name: string; readonly path: V2SkillsListResponse__AbsolutePathBuf; + readonly pluginId?: string | null; readonly scope: V2SkillsListResponse__SkillScope; readonly shortDescription?: string | null; }; @@ -24302,6 +31233,14 @@ export const V2SkillsListResponse__SkillMetadata = Schema.Struct({ interface: Schema.optionalKey(Schema.Union([V2SkillsListResponse__SkillInterface, Schema.Null])), name: Schema.String, path: V2SkillsListResponse__AbsolutePathBuf, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Owning plugin ID, matching `PluginSummary.id`, when known.", + }), + Schema.Null, + ]), + ), scope: V2SkillsListResponse__SkillScope, shortDescription: Schema.optionalKey( Schema.Union([ @@ -24337,6 +31276,7 @@ export type V2ThreadForkResponse__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ThreadForkResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ThreadForkResponse__MisalignmentErrorDetails | null; }; export const V2ThreadForkResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -24344,6 +31284,12 @@ export const V2ThreadForkResponse__TurnError = Schema.Struct({ Schema.Union([V2ThreadForkResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ThreadForkResponse__TurnError" }); export type V2ThreadForkResponse__UserInput = @@ -24357,6 +31303,11 @@ export type V2ThreadForkResponse__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ThreadForkResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ThreadForkResponse__ImageDetail | null; readonly path: string; @@ -24378,13 +31329,110 @@ export const V2ThreadForkResponse__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + }).annotate({ title: "AudioUserInput" }), Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadForkResponse__UserInput" }); + +export type V2ThreadForkResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadForkResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadForkResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadForkResponse__FunctionCallOutputBody" }); + +export type V2ThreadItemsListResponse__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2ThreadItemsListResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2ThreadItemsListResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } + | { + readonly detail?: V2ThreadItemsListResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadItemsListResponse__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadItemsListResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadItemsListResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadItemsListResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadItemsListResponse__ImageDetail, Schema.Null]), + ), path: Schema.String, type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), }).annotate({ title: "LocalImageUserInput" }), @@ -24408,7 +31456,15 @@ export const V2ThreadForkResponse__UserInput = Schema.Union( }).annotate({ title: "MentionUserInput" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadForkResponse__UserInput" }); +).annotate({ identifier: "V2ThreadItemsListResponse__UserInput" }); + +export type V2ThreadItemsListResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadItemsListResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadItemsListResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadItemsListResponse__FunctionCallOutputBody" }); export type V2ThreadListResponse__SessionSource = | "cli" @@ -24433,6 +31489,7 @@ export type V2ThreadListResponse__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ThreadListResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ThreadListResponse__MisalignmentErrorDetails | null; }; export const V2ThreadListResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -24440,6 +31497,12 @@ export const V2ThreadListResponse__TurnError = Schema.Struct({ Schema.Union([V2ThreadListResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ThreadListResponse__TurnError" }); export type V2ThreadListResponse__UserInput = @@ -24453,6 +31516,11 @@ export type V2ThreadListResponse__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ThreadListResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ThreadListResponse__ImageDetail | null; readonly path: string; @@ -24474,11 +31542,18 @@ export const V2ThreadListResponse__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([V2ThreadListResponse__ImageDetail, Schema.Null])), path: Schema.String, @@ -24506,6 +31581,14 @@ export const V2ThreadListResponse__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadListResponse__UserInput" }); +export type V2ThreadListResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadListResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadListResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadListResponse__FunctionCallOutputBody" }); + export type V2ThreadMetadataUpdateResponse__SessionSource = | "cli" | "vscode" @@ -24529,6 +31612,7 @@ export type V2ThreadMetadataUpdateResponse__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ThreadMetadataUpdateResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ThreadMetadataUpdateResponse__MisalignmentErrorDetails | null; }; export const V2ThreadMetadataUpdateResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -24536,6 +31620,12 @@ export const V2ThreadMetadataUpdateResponse__TurnError = Schema.Struct({ Schema.Union([V2ThreadMetadataUpdateResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ThreadMetadataUpdateResponse__TurnError" }); export type V2ThreadMetadataUpdateResponse__UserInput = @@ -24549,6 +31639,11 @@ export type V2ThreadMetadataUpdateResponse__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ThreadMetadataUpdateResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ThreadMetadataUpdateResponse__ImageDetail | null; readonly path: string; @@ -24570,13 +31665,22 @@ export const V2ThreadMetadataUpdateResponse__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey( Schema.Union([V2ThreadMetadataUpdateResponse__ImageDetail, Schema.Null]), @@ -24606,6 +31710,14 @@ export const V2ThreadMetadataUpdateResponse__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadMetadataUpdateResponse__UserInput" }); +export type V2ThreadMetadataUpdateResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadMetadataUpdateResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadMetadataUpdateResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadMetadataUpdateResponse__FunctionCallOutputBody" }); + export type V2ThreadReadResponse__SessionSource = | "cli" | "vscode" @@ -24629,6 +31741,7 @@ export type V2ThreadReadResponse__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ThreadReadResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ThreadReadResponse__MisalignmentErrorDetails | null; }; export const V2ThreadReadResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -24636,6 +31749,12 @@ export const V2ThreadReadResponse__TurnError = Schema.Struct({ Schema.Union([V2ThreadReadResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ThreadReadResponse__TurnError" }); export type V2ThreadReadResponse__UserInput = @@ -24649,6 +31768,11 @@ export type V2ThreadReadResponse__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ThreadReadResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ThreadReadResponse__ImageDetail | null; readonly path: string; @@ -24670,11 +31794,18 @@ export const V2ThreadReadResponse__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__ImageDetail, Schema.Null])), path: Schema.String, @@ -24702,6 +31833,14 @@ export const V2ThreadReadResponse__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadReadResponse__UserInput" }); +export type V2ThreadReadResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadReadResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadReadResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadReadResponse__FunctionCallOutputBody" }); + export type V2ThreadResumeParams__FunctionCallOutputBody = | string | ReadonlyArray; @@ -24710,6 +31849,18 @@ export const V2ThreadResumeParams__FunctionCallOutputBody = Schema.Union([ Schema.Array(V2ThreadResumeParams__FunctionCallOutputContentItem), ]).annotate({ identifier: "V2ThreadResumeParams__FunctionCallOutputBody" }); +export type V2ThreadResumeResponse__CollaborationMode = { + readonly mode: V2ThreadResumeResponse__ModeKind; + readonly settings: V2ThreadResumeResponse__Settings; +}; +export const V2ThreadResumeResponse__CollaborationMode = Schema.Struct({ + mode: V2ThreadResumeResponse__ModeKind, + settings: V2ThreadResumeResponse__Settings, +}).annotate({ + description: "Collaboration mode for a Codex session.", + identifier: "V2ThreadResumeResponse__CollaborationMode", +}); + export type V2ThreadResumeResponse__SessionSource = | "cli" | "vscode" @@ -24733,6 +31884,7 @@ export type V2ThreadResumeResponse__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ThreadResumeResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ThreadResumeResponse__MisalignmentErrorDetails | null; }; export const V2ThreadResumeResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -24740,6 +31892,12 @@ export const V2ThreadResumeResponse__TurnError = Schema.Struct({ Schema.Union([V2ThreadResumeResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ThreadResumeResponse__TurnError" }); export type V2ThreadResumeResponse__UserInput = @@ -24753,6 +31911,11 @@ export type V2ThreadResumeResponse__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ThreadResumeResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ThreadResumeResponse__ImageDetail | null; readonly path: string; @@ -24774,11 +31937,22 @@ export const V2ThreadResumeResponse__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__ImageDetail, Schema.Null])), path: Schema.String, @@ -24806,51 +31980,71 @@ export const V2ThreadResumeResponse__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadResumeResponse__UserInput" }); -export type V2ThreadRollbackResponse__SessionSource = +export type V2ThreadResumeResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadResumeResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadResumeResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadResumeResponse__FunctionCallOutputBody" }); + +export type V2ThreadRevertResponse__SessionSource = | "cli" | "vscode" | "exec" | "appServer" | "unknown" | { readonly custom: string } - | { readonly subAgent: V2ThreadRollbackResponse__SubAgentSource }; -export const V2ThreadRollbackResponse__SessionSource = Schema.Union( + | { readonly subAgent: V2ThreadRevertResponse__SubAgentSource }; +export const V2ThreadRevertResponse__SessionSource = Schema.Union( [ Schema.Literals(["cli", "vscode", "exec", "appServer", "unknown"]), Schema.Struct({ custom: Schema.String }).annotate({ title: "CustomSessionSource" }), - Schema.Struct({ subAgent: V2ThreadRollbackResponse__SubAgentSource }).annotate({ + Schema.Struct({ subAgent: V2ThreadRevertResponse__SubAgentSource }).annotate({ title: "SubAgentSessionSource", }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__SessionSource" }); +).annotate({ identifier: "V2ThreadRevertResponse__SessionSource" }); -export type V2ThreadRollbackResponse__TurnError = { +export type V2ThreadRevertResponse__TurnError = { readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2ThreadRollbackResponse__CodexErrorInfo | null; + readonly codexErrorInfo?: V2ThreadRevertResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ThreadRevertResponse__MisalignmentErrorDetails | null; }; -export const V2ThreadRollbackResponse__TurnError = Schema.Struct({ +export const V2ThreadRevertResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), codexErrorInfo: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__CodexErrorInfo, Schema.Null]), + Schema.Union([V2ThreadRevertResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, -}).annotate({ identifier: "V2ThreadRollbackResponse__TurnError" }); + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), +}).annotate({ identifier: "V2ThreadRevertResponse__TurnError" }); -export type V2ThreadRollbackResponse__UserInput = +export type V2ThreadRevertResponse__UserInput = | { readonly text: string; - readonly text_elements?: ReadonlyArray; + readonly text_elements?: ReadonlyArray; readonly type: "text"; } | { - readonly detail?: V2ThreadRollbackResponse__ImageDetail | null; + readonly detail?: V2ThreadRevertResponse__ImageDetail | null; readonly type: "image"; readonly url: string; } | { - readonly detail?: V2ThreadRollbackResponse__ImageDetail | null; + readonly detail?: V2ThreadRevertResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } + | { + readonly detail?: V2ThreadRevertResponse__ImageDetail | null; readonly path: string; readonly type: "localImage"; } @@ -24858,29 +32052,36 @@ export type V2ThreadRollbackResponse__UserInput = | { readonly path: string; readonly type: "localAudio" } | { readonly name: string; readonly path: string; readonly type: "skill" } | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2ThreadRollbackResponse__UserInput = Schema.Union( +export const V2ThreadRevertResponse__UserInput = Schema.Union( [ Schema.Struct({ text: Schema.String, text_elements: Schema.optionalKey( - Schema.Array(V2ThreadRollbackResponse__TextElement).annotate({ + Schema.Array(V2ThreadRevertResponse__TextElement).annotate({ description: "UI-defined spans within `text` used to render or persist special elements.", default: [], }), ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__ImageDetail, Schema.Null]), - ), + detail: Schema.optionalKey(Schema.Union([V2ThreadRevertResponse__ImageDetail, Schema.Null])), path: Schema.String, type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), }).annotate({ title: "LocalImageUserInput" }), @@ -24904,7 +32105,15 @@ export const V2ThreadRollbackResponse__UserInput = Schema.Union( }).annotate({ title: "MentionUserInput" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__UserInput" }); +).annotate({ identifier: "V2ThreadRevertResponse__UserInput" }); + +export type V2ThreadRevertResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadRevertResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadRevertResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadRevertResponse__FunctionCallOutputBody" }); export type V2ThreadSettingsUpdatedNotification__CollaborationMode = { readonly mode: V2ThreadSettingsUpdatedNotification__ModeKind; @@ -24941,6 +32150,7 @@ export type V2ThreadStartedNotification__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ThreadStartedNotification__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ThreadStartedNotification__MisalignmentErrorDetails | null; }; export const V2ThreadStartedNotification__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -24948,6 +32158,12 @@ export const V2ThreadStartedNotification__TurnError = Schema.Struct({ Schema.Union([V2ThreadStartedNotification__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ThreadStartedNotification__TurnError" }); export type V2ThreadStartedNotification__UserInput = @@ -24961,6 +32177,11 @@ export type V2ThreadStartedNotification__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ThreadStartedNotification__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ThreadStartedNotification__ImageDetail | null; readonly path: string; @@ -24982,13 +32203,22 @@ export const V2ThreadStartedNotification__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey( Schema.Union([V2ThreadStartedNotification__ImageDetail, Schema.Null]), @@ -25018,6 +32248,14 @@ export const V2ThreadStartedNotification__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2ThreadStartedNotification__UserInput" }); +export type V2ThreadStartedNotification__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadStartedNotification__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadStartedNotification__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadStartedNotification__FunctionCallOutputBody" }); + export type V2ThreadStartResponse__SessionSource = | "cli" | "vscode" @@ -25041,6 +32279,7 @@ export type V2ThreadStartResponse__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ThreadStartResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ThreadStartResponse__MisalignmentErrorDetails | null; }; export const V2ThreadStartResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -25048,6 +32287,12 @@ export const V2ThreadStartResponse__TurnError = Schema.Struct({ Schema.Union([V2ThreadStartResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ThreadStartResponse__TurnError" }); export type V2ThreadStartResponse__UserInput = @@ -25061,6 +32306,11 @@ export type V2ThreadStartResponse__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ThreadStartResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ThreadStartResponse__ImageDetail | null; readonly path: string; @@ -25082,13 +32332,130 @@ export const V2ThreadStartResponse__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + }).annotate({ title: "AudioUserInput" }), Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__ImageDetail, Schema.Null])), + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadStartResponse__UserInput" }); + +export type V2ThreadStartResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadStartResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadStartResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadStartResponse__FunctionCallOutputBody" }); + +export type V2ThreadTurnsListResponse__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2ThreadTurnsListResponse__CodexErrorInfo | null; + readonly message: string; + readonly misalignment?: V2ThreadTurnsListResponse__MisalignmentErrorDetails | null; +}; +export const V2ThreadTurnsListResponse__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), +}).annotate({ identifier: "V2ThreadTurnsListResponse__TurnError" }); + +export type V2ThreadTurnsListResponse__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2ThreadTurnsListResponse__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2ThreadTurnsListResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } + | { + readonly detail?: V2ThreadTurnsListResponse__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2ThreadTurnsListResponse__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2ThreadTurnsListResponse__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__ImageDetail, Schema.Null]), + ), path: Schema.String, type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), }).annotate({ title: "LocalImageUserInput" }), @@ -25112,7 +32479,15 @@ export const V2ThreadStartResponse__UserInput = Schema.Union( }).annotate({ title: "MentionUserInput" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadStartResponse__UserInput" }); +).annotate({ identifier: "V2ThreadTurnsListResponse__UserInput" }); + +export type V2ThreadTurnsListResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadTurnsListResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadTurnsListResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadTurnsListResponse__FunctionCallOutputBody" }); export type V2ThreadUnarchiveResponse__SessionSource = | "cli" @@ -25137,6 +32512,7 @@ export type V2ThreadUnarchiveResponse__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2ThreadUnarchiveResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2ThreadUnarchiveResponse__MisalignmentErrorDetails | null; }; export const V2ThreadUnarchiveResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -25144,6 +32520,12 @@ export const V2ThreadUnarchiveResponse__TurnError = Schema.Struct({ Schema.Union([V2ThreadUnarchiveResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2ThreadUnarchiveResponse__TurnError" }); export type V2ThreadUnarchiveResponse__UserInput = @@ -25157,6 +32539,11 @@ export type V2ThreadUnarchiveResponse__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2ThreadUnarchiveResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2ThreadUnarchiveResponse__ImageDetail | null; readonly path: string; @@ -25178,97 +32565,135 @@ export const V2ThreadUnarchiveResponse__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey( Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + path: Schema.String, + type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), + }).annotate({ title: "LocalImageUserInput" }), + Schema.Struct({ + type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + }).annotate({ title: "AudioUserInput" }), + Schema.Struct({ + path: Schema.String, + type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), + }).annotate({ title: "LocalAudioUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), + }).annotate({ title: "SkillUserInput" }), + Schema.Struct({ + name: Schema.String, + path: Schema.String, + type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), + }).annotate({ title: "MentionUserInput" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ThreadUnarchiveResponse__UserInput" }); + +export type V2ThreadUnarchiveResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2ThreadUnarchiveResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2ThreadUnarchiveResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2ThreadUnarchiveResponse__FunctionCallOutputBody" }); + +export type V2TurnCompletedNotification__TurnError = { + readonly additionalDetails?: string | null; + readonly codexErrorInfo?: V2TurnCompletedNotification__CodexErrorInfo | null; + readonly message: string; + readonly misalignment?: V2TurnCompletedNotification__MisalignmentErrorDetails | null; +}; +export const V2TurnCompletedNotification__TurnError = Schema.Struct({ + additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + codexErrorInfo: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__CodexErrorInfo, Schema.Null]), + ), + message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), +}).annotate({ identifier: "V2TurnCompletedNotification__TurnError" }); + +export type V2TurnCompletedNotification__UserInput = + | { + readonly text: string; + readonly text_elements?: ReadonlyArray; + readonly type: "text"; + } + | { + readonly detail?: V2TurnCompletedNotification__ImageDetail | null; + readonly type: "image"; + readonly url: string; + } + | { + readonly detail?: V2TurnCompletedNotification__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } + | { + readonly detail?: V2TurnCompletedNotification__ImageDetail | null; + readonly path: string; + readonly type: "localImage"; + } + | { readonly type: "audio"; readonly url: string } + | { readonly path: string; readonly type: "localAudio" } + | { readonly name: string; readonly path: string; readonly type: "skill" } + | { readonly name: string; readonly path: string; readonly type: "mention" }; +export const V2TurnCompletedNotification__UserInput = Schema.Union( + [ + Schema.Struct({ + text: Schema.String, + text_elements: Schema.optionalKey( + Schema.Array(V2TurnCompletedNotification__TextElement).annotate({ + description: "UI-defined spans within `text` used to render or persist special elements.", + default: [], + }), + ), + type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), + }).annotate({ title: "TextUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey( - Schema.Union([V2ThreadUnarchiveResponse__ImageDetail, Schema.Null]), - ), - path: Schema.String, - type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), - }).annotate({ title: "LocalImageUserInput" }), - Schema.Struct({ - type: Schema.Literal("audio").annotate({ title: "AudioUserInputType" }), - url: Schema.String, - }).annotate({ title: "AudioUserInput" }), - Schema.Struct({ - path: Schema.String, - type: Schema.Literal("localAudio").annotate({ title: "LocalAudioUserInputType" }), - }).annotate({ title: "LocalAudioUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("skill").annotate({ title: "SkillUserInputType" }), - }).annotate({ title: "SkillUserInput" }), - Schema.Struct({ - name: Schema.String, - path: Schema.String, - type: Schema.Literal("mention").annotate({ title: "MentionUserInputType" }), - }).annotate({ title: "MentionUserInput" }), - ], - { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadUnarchiveResponse__UserInput" }); - -export type V2TurnCompletedNotification__TurnError = { - readonly additionalDetails?: string | null; - readonly codexErrorInfo?: V2TurnCompletedNotification__CodexErrorInfo | null; - readonly message: string; -}; -export const V2TurnCompletedNotification__TurnError = Schema.Struct({ - additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - codexErrorInfo: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__CodexErrorInfo, Schema.Null]), - ), - message: Schema.String, -}).annotate({ identifier: "V2TurnCompletedNotification__TurnError" }); - -export type V2TurnCompletedNotification__UserInput = - | { - readonly text: string; - readonly text_elements?: ReadonlyArray; - readonly type: "text"; - } - | { - readonly detail?: V2TurnCompletedNotification__ImageDetail | null; - readonly type: "image"; - readonly url: string; - } - | { - readonly detail?: V2TurnCompletedNotification__ImageDetail | null; - readonly path: string; - readonly type: "localImage"; - } - | { readonly type: "audio"; readonly url: string } - | { readonly path: string; readonly type: "localAudio" } - | { readonly name: string; readonly path: string; readonly type: "skill" } - | { readonly name: string; readonly path: string; readonly type: "mention" }; -export const V2TurnCompletedNotification__UserInput = Schema.Union( - [ - Schema.Struct({ - text: Schema.String, - text_elements: Schema.optionalKey( - Schema.Array(V2TurnCompletedNotification__TextElement).annotate({ - description: "UI-defined spans within `text` used to render or persist special elements.", - default: [], - }), - ), - type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), - }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), + Schema.Union([V2TurnCompletedNotification__ImageDetail, Schema.Null]), ), path: Schema.String, type: Schema.Literal("localImage").annotate({ title: "LocalImageUserInputType" }), @@ -25295,10 +32720,19 @@ export const V2TurnCompletedNotification__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnCompletedNotification__UserInput" }); +export type V2TurnCompletedNotification__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2TurnCompletedNotification__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2TurnCompletedNotification__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2TurnCompletedNotification__FunctionCallOutputBody" }); + export type V2TurnStartedNotification__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2TurnStartedNotification__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2TurnStartedNotification__MisalignmentErrorDetails | null; }; export const V2TurnStartedNotification__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -25306,6 +32740,12 @@ export const V2TurnStartedNotification__TurnError = Schema.Struct({ Schema.Union([V2TurnStartedNotification__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2TurnStartedNotification__TurnError" }); export type V2TurnStartedNotification__UserInput = @@ -25319,6 +32759,11 @@ export type V2TurnStartedNotification__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2TurnStartedNotification__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2TurnStartedNotification__ImageDetail | null; readonly path: string; @@ -25340,13 +32785,22 @@ export const V2TurnStartedNotification__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey( - Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), - ), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), + ), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey( Schema.Union([V2TurnStartedNotification__ImageDetail, Schema.Null]), @@ -25376,6 +32830,14 @@ export const V2TurnStartedNotification__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnStartedNotification__UserInput" }); +export type V2TurnStartedNotification__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2TurnStartedNotification__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2TurnStartedNotification__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2TurnStartedNotification__FunctionCallOutputBody" }); + export type V2TurnStartParams__UserInput = | { readonly text: string; @@ -25387,6 +32849,11 @@ export type V2TurnStartParams__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2TurnStartParams__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2TurnStartParams__ImageDetail | null; readonly path: string; @@ -25408,11 +32875,18 @@ export const V2TurnStartParams__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([V2TurnStartParams__ImageDetail, Schema.Null])), path: Schema.String, @@ -25440,10 +32914,19 @@ export const V2TurnStartParams__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnStartParams__UserInput" }); +export type V2TurnStartParams__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2TurnStartParams__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2TurnStartParams__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2TurnStartParams__FunctionCallOutputBody" }); + export type V2TurnStartResponse__TurnError = { readonly additionalDetails?: string | null; readonly codexErrorInfo?: V2TurnStartResponse__CodexErrorInfo | null; readonly message: string; + readonly misalignment?: V2TurnStartResponse__MisalignmentErrorDetails | null; }; export const V2TurnStartResponse__TurnError = Schema.Struct({ additionalDetails: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -25451,6 +32934,12 @@ export const V2TurnStartResponse__TurnError = Schema.Struct({ Schema.Union([V2TurnStartResponse__CodexErrorInfo, Schema.Null]), ), message: Schema.String, + misalignment: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__MisalignmentErrorDetails, Schema.Null]).annotate({ + description: + "Optional public explanation and continuation instruction for a misalignment block.", + }), + ), }).annotate({ identifier: "V2TurnStartResponse__TurnError" }); export type V2TurnStartResponse__UserInput = @@ -25464,6 +32953,11 @@ export type V2TurnStartResponse__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2TurnStartResponse__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2TurnStartResponse__ImageDetail | null; readonly path: string; @@ -25485,11 +32979,18 @@ export const V2TurnStartResponse__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([V2TurnStartResponse__ImageDetail, Schema.Null])), path: Schema.String, @@ -25517,6 +33018,14 @@ export const V2TurnStartResponse__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnStartResponse__UserInput" }); +export type V2TurnStartResponse__FunctionCallOutputBody = + | string + | ReadonlyArray; +export const V2TurnStartResponse__FunctionCallOutputBody = Schema.Union([ + Schema.String, + Schema.Array(V2TurnStartResponse__FunctionCallOutputContentItem), +]).annotate({ identifier: "V2TurnStartResponse__FunctionCallOutputBody" }); + export type V2TurnSteerParams__UserInput = | { readonly text: string; @@ -25528,6 +33037,11 @@ export type V2TurnSteerParams__UserInput = readonly type: "image"; readonly url: string; } + | { + readonly detail?: V2TurnSteerParams__ImageDetail | null; + readonly type: "image"; + readonly fileId: string; + } | { readonly detail?: V2TurnSteerParams__ImageDetail | null; readonly path: string; @@ -25549,11 +33063,18 @@ export const V2TurnSteerParams__UserInput = Schema.Union( ), type: Schema.Literal("text").annotate({ title: "TextUserInputType" }), }).annotate({ title: "TextUserInput" }), - Schema.Struct({ - detail: Schema.optionalKey(Schema.Union([V2TurnSteerParams__ImageDetail, Schema.Null])), - type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), - url: Schema.String, - }).annotate({ title: "ImageUserInput" }), + Schema.Union([ + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnSteerParams__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + url: Schema.String, + }).annotate({ title: "UrlUserInput" }), + Schema.Struct({ + detail: Schema.optionalKey(Schema.Union([V2TurnSteerParams__ImageDetail, Schema.Null])), + type: Schema.Literal("image").annotate({ title: "ImageUserInputType" }), + fileId: Schema.String, + }).annotate({ title: "FileIdUserInput" }), + ]).annotate({ title: "ImageUserInput" }), Schema.Struct({ detail: Schema.optionalKey(Schema.Union([V2TurnSteerParams__ImageDetail, Schema.Null])), path: Schema.String, @@ -25581,89 +33102,6 @@ export const V2TurnSteerParams__UserInput = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnSteerParams__UserInput" }); -export type ClientRequest__TurnStartParams = { - readonly approvalPolicy?: ClientRequest__AskForApproval | null; - readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; - readonly clientUserMessageId?: string | null; - readonly cwd?: string | null; - readonly effort?: ClientRequest__ReasoningEffort | null; - readonly input: ReadonlyArray; - readonly model?: string | null; - readonly outputSchema?: Schema.Json; - readonly personality?: ClientRequest__Personality | null; - readonly sandboxPolicy?: ClientRequest__SandboxPolicy | null; - readonly serviceTier?: string | null; - readonly summary?: ClientRequest__ReasoningSummary | null; - readonly threadId: string; -}; -export const ClientRequest__TurnStartParams = Schema.Struct({ - approvalPolicy: Schema.optionalKey( - Schema.Union([ClientRequest__AskForApproval, Schema.Null]).annotate({ - description: "Override the approval policy for this turn and subsequent turns.", - }), - ), - approvalsReviewer: Schema.optionalKey( - Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ - description: - "Override where approval requests are routed for review on this turn and subsequent turns.", - }), - ), - clientUserMessageId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - cwd: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Override the working directory for this turn and subsequent turns.", - }), - Schema.Null, - ]), - ), - effort: Schema.optionalKey( - Schema.Union([ClientRequest__ReasoningEffort, Schema.Null]).annotate({ - description: "Override the reasoning effort for this turn and subsequent turns.", - }), - ), - input: Schema.Array(ClientRequest__UserInput), - model: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Override the model for this turn and subsequent turns.", - }), - Schema.Null, - ]), - ), - outputSchema: Schema.optionalKey( - Schema.Json.annotate({ - expected: "JSON value", - description: - "Optional JSON Schema used to constrain the final assistant message for this turn.", - }), - ), - personality: Schema.optionalKey( - Schema.Union([ClientRequest__Personality, Schema.Null]).annotate({ - description: "Override the personality for this turn and subsequent turns.", - }), - ), - sandboxPolicy: Schema.optionalKey( - Schema.Union([ClientRequest__SandboxPolicy, Schema.Null]).annotate({ - description: "Override the sandbox policy for this turn and subsequent turns.", - }), - ), - serviceTier: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Override the service tier for this turn and subsequent turns.", - }), - Schema.Null, - ]), - ), - summary: Schema.optionalKey( - Schema.Union([ClientRequest__ReasoningSummary, Schema.Null]).annotate({ - description: "Override the reasoning summary for this turn and subsequent turns.", - }), - ), - threadId: Schema.String, -}).annotate({ identifier: "ClientRequest__TurnStartParams" }); - export type ClientRequest__TurnSteerParams = { readonly clientUserMessageId?: string | null; readonly expectedTurnId: string; @@ -25680,9 +33118,21 @@ export const ClientRequest__TurnSteerParams = Schema.Struct({ threadId: Schema.String, }).annotate({ identifier: "ClientRequest__TurnSteerParams" }); +export type ClientRequest__TurnToolOutput = { + readonly name: string; + readonly namespace?: string | null; + readonly output: ClientRequest__FunctionCallOutputBody; +}; +export const ClientRequest__TurnToolOutput = Schema.Struct({ + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: ClientRequest__FunctionCallOutputBody, +}).annotate({ identifier: "ClientRequest__TurnToolOutput" }); + export type ClientRequest__ExternalAgentConfigImportParams = { readonly migrationItems: ReadonlyArray; readonly migrationSource?: string | null; + readonly providerId?: string | null; readonly source?: string | null; }; export const ClientRequest__ExternalAgentConfigImportParams = Schema.Struct({ @@ -25696,6 +33146,15 @@ export const ClientRequest__ExternalAgentConfigImportParams = Schema.Struct({ Schema.Null, ]), ), + providerId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Opaque provider identifier supplied by the caller for analytics attribution and import history display. This does not select the migration source.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -25706,6 +33165,19 @@ export const ClientRequest__ExternalAgentConfigImportParams = Schema.Struct({ ), }).annotate({ identifier: "ClientRequest__ExternalAgentConfigImportParams" }); +export type ClientRequest__ExternalAgentConfigImportHistoryRecordParams = { + readonly itemTypeResults: ReadonlyArray; + readonly providerId: string; +}; +export const ClientRequest__ExternalAgentConfigImportHistoryRecordParams = Schema.Struct({ + itemTypeResults: Schema.Array( + ClientRequest__ExternalAgentConfigImportHistoryRecordTypeResultParams, + ).annotate({ description: "Completed results grouped by imported item type." }), + providerId: Schema.String.annotate({ + description: "Opaque provider identifier for the externally completed import.", + }), +}).annotate({ identifier: "ClientRequest__ExternalAgentConfigImportHistoryRecordParams" }); + export type CommandExecutionRequestApprovalParams__FileSystemSandboxEntry = { readonly access: CommandExecutionRequestApprovalParams__FileSystemAccessMode; readonly path: CommandExecutionRequestApprovalParams__FileSystemPath; @@ -25756,6 +33228,49 @@ export const ServerNotification__ErrorNotification = Schema.Struct({ willRetry: Schema.Boolean, }).annotate({ identifier: "ServerNotification__ErrorNotification" }); +export type ServerNotification__ThreadSettings = { + readonly activePermissionProfile?: ServerNotification__ActivePermissionProfile | null; + readonly approvalPolicy: ServerNotification__AskForApproval; + readonly approvalsReviewer: ServerNotification__ApprovalsReviewer; + readonly collaborationMode: ServerNotification__CollaborationMode; + readonly cwd: ServerNotification__AbsolutePathBuf; + readonly disabledPluginIds?: ReadonlyArray; + readonly effort?: ServerNotification__ReasoningEffort | null; + readonly model: string; + readonly modelProvider: string; + readonly personality?: ServerNotification__Personality | null; + readonly sandboxPolicy: ServerNotification__SandboxPolicy; + readonly serviceTier?: string | null; + readonly summary?: ServerNotification__ReasoningSummary | null; +}; +export const ServerNotification__ThreadSettings = Schema.Struct({ + activePermissionProfile: Schema.optionalKey( + Schema.Union([ServerNotification__ActivePermissionProfile, Schema.Null]), + ), + approvalPolicy: ServerNotification__AskForApproval, + approvalsReviewer: ServerNotification__ApprovalsReviewer, + collaborationMode: ServerNotification__CollaborationMode, + cwd: ServerNotification__AbsolutePathBuf, + disabledPluginIds: Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + description: "Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.", + default: [], + }), + ), + effort: Schema.optionalKey(Schema.Union([ServerNotification__ReasoningEffort, Schema.Null])), + model: Schema.String, + modelProvider: Schema.String, + personality: Schema.optionalKey( + Schema.Union([ServerNotification__Personality, Schema.Null]).annotate({ + description: + "@deprecated Reports the saved setting; `friendly` and `pragmatic` no longer select a style.", + }), + ), + sandboxPolicy: ServerNotification__SandboxPolicy, + serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + summary: Schema.optionalKey(Schema.Union([ServerNotification__ReasoningSummary, Schema.Null])), +}).annotate({ identifier: "ServerNotification__ThreadSettings" }); + export type ServerNotification__ThreadItem = | { readonly clientId?: string | null; @@ -25769,17 +33284,21 @@ export type ServerNotification__ThreadItem = readonly type: "hookPrompt"; } | { + readonly delivery?: ServerNotification__AgentMessageDelivery | null; readonly id: string; readonly memoryCitation?: ServerNotification__MemoryCitation | null; readonly phase?: ServerNotification__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: ServerNotification__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -25795,7 +33314,9 @@ export type ServerNotification__ThreadItem = readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; + readonly scriptPath?: string | null; readonly source?: ServerNotification__CommandExecutionSource; readonly status: ServerNotification__CommandExecutionStatus; readonly type: "commandExecution"; @@ -25813,7 +33334,9 @@ export type ServerNotification__ThreadItem = readonly error?: ServerNotification__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: ServerNotification__McpAppUi | null; readonly pluginId?: string | null; + readonly readOnlyHint?: boolean | null; readonly result?: ServerNotification__McpToolCallResult | null; readonly server: string; readonly status: ServerNotification__McpToolCallStatus; @@ -25864,11 +33387,13 @@ export type ServerNotification__ThreadItem = } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: ServerNotification__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; readonly savedPath?: ServerNotification__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } @@ -25888,26 +33413,29 @@ export const ServerNotification__ThreadItem = Schema.Union( type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([ServerNotification__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( Schema.Union([ServerNotification__MemoryCitation, Schema.Null]), ), phase: Schema.optionalKey(Schema.Union([ServerNotification__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + Schema.Union([Schema.Array(ServerNotification__AsyncUserInputQuestion), Schema.Null]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: ServerNotification__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -25960,6 +33488,15 @@ export const ServerNotification__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -25968,6 +33505,15 @@ export const ServerNotification__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( (): Schema.Codec => @@ -26004,12 +33550,20 @@ export const ServerNotification__ThreadItem = Schema.Union( mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([ServerNotification__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( Schema.Union([ServerNotification__McpToolCallResult, Schema.Null]), ), @@ -26131,6 +33685,9 @@ export const ServerNotification__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([ServerNotification__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -26138,6 +33695,7 @@ export const ServerNotification__ThreadItem = Schema.Union( Schema.Union([ServerNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -26173,37 +33731,6 @@ export const ServerNotification__FileSystemSandboxEntry = Schema.Struct({ path: ServerNotification__FileSystemPath, }).annotate({ identifier: "ServerNotification__FileSystemSandboxEntry" }); -export type ServerNotification__ThreadSettings = { - readonly activePermissionProfile?: ServerNotification__ActivePermissionProfile | null; - readonly approvalPolicy: ServerNotification__AskForApproval; - readonly approvalsReviewer: ServerNotification__ApprovalsReviewer; - readonly collaborationMode: ServerNotification__CollaborationMode; - readonly cwd: ServerNotification__AbsolutePathBuf; - readonly effort?: ServerNotification__ReasoningEffort | null; - readonly model: string; - readonly modelProvider: string; - readonly personality?: ServerNotification__Personality | null; - readonly sandboxPolicy: ServerNotification__SandboxPolicy; - readonly serviceTier?: string | null; - readonly summary?: ServerNotification__ReasoningSummary | null; -}; -export const ServerNotification__ThreadSettings = Schema.Struct({ - activePermissionProfile: Schema.optionalKey( - Schema.Union([ServerNotification__ActivePermissionProfile, Schema.Null]), - ), - approvalPolicy: ServerNotification__AskForApproval, - approvalsReviewer: ServerNotification__ApprovalsReviewer, - collaborationMode: ServerNotification__CollaborationMode, - cwd: ServerNotification__AbsolutePathBuf, - effort: Schema.optionalKey(Schema.Union([ServerNotification__ReasoningEffort, Schema.Null])), - model: Schema.String, - modelProvider: Schema.String, - personality: Schema.optionalKey(Schema.Union([ServerNotification__Personality, Schema.Null])), - sandboxPolicy: ServerNotification__SandboxPolicy, - serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - summary: Schema.optionalKey(Schema.Union([ServerNotification__ReasoningSummary, Schema.Null])), -}).annotate({ identifier: "ServerNotification__ThreadSettings" }); - export type ServerNotification__HookStartedNotification = { readonly run: ServerNotification__HookRunSummary; readonly threadId: string; @@ -26271,157 +33798,43 @@ export const ServerRequest__McpElicitationMultiSelectEnumSchema = Schema.Union([ ServerRequest__McpElicitationTitledMultiSelectEnumSchema, ]).annotate({ identifier: "ServerRequest__McpElicitationMultiSelectEnumSchema" }); -export type V2ConfigReadResponse__Config = { - readonly analytics?: V2ConfigReadResponse__AnalyticsConfig | null; - readonly approval_policy?: V2ConfigReadResponse__AskForApproval | null; - readonly approvals_reviewer?: V2ConfigReadResponse__ApprovalsReviewer | null; - readonly compact_prompt?: string | null; - readonly desktop?: { readonly [x: string]: Schema.Json } | null; - readonly developer_instructions?: string | null; - readonly forced_chatgpt_workspace_id?: V2ConfigReadResponse__ForcedChatgptWorkspaceIds | null; - readonly forced_login_method?: V2ConfigReadResponse__ForcedLoginMethod | null; - readonly instructions?: string | null; - readonly model?: string | null; - readonly model_auto_compact_token_limit?: number | null; - readonly model_auto_compact_token_limit_scope?: V2ConfigReadResponse__AutoCompactTokenLimitScope | null; - readonly model_context_window?: number | null; - readonly model_provider?: string | null; - readonly model_reasoning_effort?: V2ConfigReadResponse__ReasoningEffort | null; - readonly model_reasoning_summary?: V2ConfigReadResponse__ReasoningSummary | null; - readonly model_verbosity?: V2ConfigReadResponse__Verbosity | null; - readonly review_model?: string | null; - readonly sandbox_mode?: V2ConfigReadResponse__SandboxMode | null; - readonly sandbox_workspace_write?: V2ConfigReadResponse__SandboxWorkspaceWrite | null; - readonly service_tier?: string | null; - readonly tools?: V2ConfigReadResponse__ToolsV2 | null; - readonly web_search?: V2ConfigReadResponse__WebSearchMode | null; -} & { readonly [x: string]: Schema.Json }; -export const V2ConfigReadResponse__Config = Schema.StructWithRest( - Schema.Struct({ - analytics: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__AnalyticsConfig, Schema.Null]), - ), - approval_policy: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__AskForApproval, Schema.Null]), - ), - approvals_reviewer: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ApprovalsReviewer, Schema.Null]).annotate({ - description: - "[UNSTABLE] Optional default for where approval requests are routed for review.", - }), - ), - compact_prompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - desktop: Schema.optionalKey( - Schema.Union([ - Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), - Schema.Null, - ]), - ), - developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - forced_chatgpt_workspace_id: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ForcedChatgptWorkspaceIds, Schema.Null]), - ), - forced_login_method: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ForcedLoginMethod, Schema.Null]), - ), - instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model_auto_compact_token_limit: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "int64" }).check( - Schema.isInt().annotate({ expected: "an integer" }), - ), - Schema.Null, - ]), - ), - model_auto_compact_token_limit_scope: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__AutoCompactTokenLimitScope, Schema.Null]), - ), - model_context_window: Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ format: "int64" }).check( - Schema.isInt().annotate({ expected: "an integer" }), - ), - Schema.Null, - ]), - ), - model_provider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - model_reasoning_effort: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ReasoningEffort, Schema.Null]), - ), - model_reasoning_summary: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__ReasoningSummary, Schema.Null]), - ), - model_verbosity: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__Verbosity, Schema.Null]), - ), - review_model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - sandbox_mode: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__SandboxMode, Schema.Null]), - ), - sandbox_workspace_write: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__SandboxWorkspaceWrite, Schema.Null]), - ), - service_tier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - tools: Schema.optionalKey(Schema.Union([V2ConfigReadResponse__ToolsV2, Schema.Null])), - web_search: Schema.optionalKey( - Schema.Union([V2ConfigReadResponse__WebSearchMode, Schema.Null]), - ), - }), - [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], -).annotate({ identifier: "V2ConfigReadResponse__Config" }); - -export type V2ConfigRequirementsReadResponse__ConfigRequirements = { - readonly allowAppshots?: boolean | null; - readonly allowManagedHooksOnly?: boolean | null; - readonly allowRemoteControl?: boolean | null; - readonly allowedApprovalPolicies?: ReadonlyArray | null; - readonly allowedPermissionProfiles?: { readonly [x: string]: boolean } | null; - readonly allowedSandboxModes?: ReadonlyArray | null; - readonly allowedWebSearchModes?: ReadonlyArray | null; - readonly allowedWindowsSandboxImplementations?: ReadonlyArray | null; - readonly computerUse?: V2ConfigRequirementsReadResponse__ComputerUseRequirements | null; - readonly defaultPermissions?: string | null; - readonly enforceResidency?: V2ConfigRequirementsReadResponse__ResidencyRequirement | null; - readonly featureRequirements?: { readonly [x: string]: boolean } | null; - readonly models?: V2ConfigRequirementsReadResponse__ModelsRequirements | null; +export type V2ConfigReadResponse__ComputerUseConfig = { + readonly default_app_access?: V2ConfigReadResponse__AllowDenyRequirement | null; + readonly macos?: V2ConfigReadResponse__ComputerUseMacosConfig | null; + readonly windows?: V2ConfigReadResponse__ComputerUseWindowsConfig | null; }; -export const V2ConfigRequirementsReadResponse__ConfigRequirements = Schema.Struct({ - allowAppshots: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - allowManagedHooksOnly: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - allowRemoteControl: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - allowedApprovalPolicies: Schema.optionalKey( - Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__AskForApproval), Schema.Null]), +export const V2ConfigReadResponse__ComputerUseConfig = Schema.Struct({ + default_app_access: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AllowDenyRequirement, Schema.Null]), ), - allowedPermissionProfiles: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Boolean), Schema.Null]), - ), - allowedSandboxModes: Schema.optionalKey( - Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__SandboxMode), Schema.Null]), - ), - allowedWebSearchModes: Schema.optionalKey( - Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__WebSearchMode), Schema.Null]), + macos: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ComputerUseMacosConfig, Schema.Null]), ), - allowedWindowsSandboxImplementations: Schema.optionalKey( - Schema.Union([ - Schema.Array(V2ConfigRequirementsReadResponse__WindowsSandboxSetupMode), - Schema.Null, - ]), + windows: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ComputerUseWindowsConfig, Schema.Null]), ), - computerUse: Schema.optionalKey( - Schema.Union([V2ConfigRequirementsReadResponse__ComputerUseRequirements, Schema.Null]), - ), - defaultPermissions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - enforceResidency: Schema.optionalKey( - Schema.Union([V2ConfigRequirementsReadResponse__ResidencyRequirement, Schema.Null]), +}).annotate({ identifier: "V2ConfigReadResponse__ComputerUseConfig" }); + +export type V2ConfigRequirementsReadResponse__ComputerUseRequirements = { + readonly allowLockedComputerUse?: boolean | null; + readonly allowPersistentApproval?: boolean | null; + readonly defaultAppAccess?: V2ConfigRequirementsReadResponse__AllowDenyRequirement | null; + readonly macos?: V2ConfigRequirementsReadResponse__ComputerUseMacosRequirements | null; + readonly windows?: V2ConfigRequirementsReadResponse__ComputerUseWindowsRequirements | null; +}; +export const V2ConfigRequirementsReadResponse__ComputerUseRequirements = Schema.Struct({ + allowLockedComputerUse: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowPersistentApproval: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + defaultAppAccess: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__AllowDenyRequirement, Schema.Null]), ), - featureRequirements: Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Boolean), Schema.Null]), + macos: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__ComputerUseMacosRequirements, Schema.Null]), ), - models: Schema.optionalKey( - Schema.Union([V2ConfigRequirementsReadResponse__ModelsRequirements, Schema.Null]), + windows: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__ComputerUseWindowsRequirements, Schema.Null]), ), -}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ConfigRequirements" }); +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ComputerUseRequirements" }); export type V2ConfigWriteResponse__OverriddenMetadata = { readonly effectiveValue: Schema.Json; @@ -26447,17 +33860,21 @@ export type V2ItemCompletedNotification__ThreadItem = readonly type: "hookPrompt"; } | { + readonly delivery?: V2ItemCompletedNotification__AgentMessageDelivery | null; readonly id: string; readonly memoryCitation?: V2ItemCompletedNotification__MemoryCitation | null; readonly phase?: V2ItemCompletedNotification__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ItemCompletedNotification__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -26473,7 +33890,9 @@ export type V2ItemCompletedNotification__ThreadItem = readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; + readonly scriptPath?: string | null; readonly source?: V2ItemCompletedNotification__CommandExecutionSource; readonly status: V2ItemCompletedNotification__CommandExecutionStatus; readonly type: "commandExecution"; @@ -26491,7 +33910,9 @@ export type V2ItemCompletedNotification__ThreadItem = readonly error?: V2ItemCompletedNotification__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ItemCompletedNotification__McpAppUi | null; readonly pluginId?: string | null; + readonly readOnlyHint?: boolean | null; readonly result?: V2ItemCompletedNotification__McpToolCallResult | null; readonly server: string; readonly status: V2ItemCompletedNotification__McpToolCallStatus; @@ -26544,11 +33965,13 @@ export type V2ItemCompletedNotification__ThreadItem = } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ItemCompletedNotification__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; readonly savedPath?: V2ItemCompletedNotification__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } @@ -26568,6 +33991,9 @@ export const V2ItemCompletedNotification__ThreadItem = Schema.Union( type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( Schema.Union([V2ItemCompletedNotification__MemoryCitation, Schema.Null]), @@ -26575,21 +34001,24 @@ export const V2ItemCompletedNotification__ThreadItem = Schema.Union( phase: Schema.optionalKey( Schema.Union([V2ItemCompletedNotification__MessagePhase, Schema.Null]), ), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + Schema.Array(V2ItemCompletedNotification__AsyncUserInputQuestion), Schema.Null, ]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ItemCompletedNotification__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -26642,6 +34071,15 @@ export const V2ItemCompletedNotification__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -26650,6 +34088,15 @@ export const V2ItemCompletedNotification__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( (): Schema.Codec => @@ -26688,12 +34135,20 @@ export const V2ItemCompletedNotification__ThreadItem = Schema.Union( mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( Schema.Union([V2ItemCompletedNotification__McpToolCallResult, Schema.Null]), ), @@ -26818,6 +34273,9 @@ export const V2ItemCompletedNotification__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ItemCompletedNotification__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -26825,6 +34283,7 @@ export const V2ItemCompletedNotification__ThreadItem = Schema.Union( Schema.Union([V2ItemCompletedNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -26888,17 +34347,21 @@ export type V2ItemStartedNotification__ThreadItem = readonly type: "hookPrompt"; } | { + readonly delivery?: V2ItemStartedNotification__AgentMessageDelivery | null; readonly id: string; readonly memoryCitation?: V2ItemStartedNotification__MemoryCitation | null; readonly phase?: V2ItemStartedNotification__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ItemStartedNotification__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -26914,7 +34377,9 @@ export type V2ItemStartedNotification__ThreadItem = readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; + readonly scriptPath?: string | null; readonly source?: V2ItemStartedNotification__CommandExecutionSource; readonly status: V2ItemStartedNotification__CommandExecutionStatus; readonly type: "commandExecution"; @@ -26932,7 +34397,9 @@ export type V2ItemStartedNotification__ThreadItem = readonly error?: V2ItemStartedNotification__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ItemStartedNotification__McpAppUi | null; readonly pluginId?: string | null; + readonly readOnlyHint?: boolean | null; readonly result?: V2ItemStartedNotification__McpToolCallResult | null; readonly server: string; readonly status: V2ItemStartedNotification__McpToolCallStatus; @@ -26983,11 +34450,13 @@ export type V2ItemStartedNotification__ThreadItem = } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ItemStartedNotification__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; readonly savedPath?: V2ItemStartedNotification__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } @@ -27007,6 +34476,9 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union( type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ItemStartedNotification__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( Schema.Union([V2ItemStartedNotification__MemoryCitation, Schema.Null]), @@ -27014,21 +34486,24 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union( phase: Schema.optionalKey( Schema.Union([V2ItemStartedNotification__MessagePhase, Schema.Null]), ), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + Schema.Array(V2ItemStartedNotification__AsyncUserInputQuestion), Schema.Null, ]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ItemStartedNotification__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -27081,6 +34556,15 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -27089,6 +34573,15 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( (): Schema.Codec => @@ -27127,12 +34620,20 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union( mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ItemStartedNotification__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( Schema.Union([V2ItemStartedNotification__McpToolCallResult, Schema.Null]), ), @@ -27257,6 +34758,9 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ItemStartedNotification__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -27264,6 +34768,7 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union( Schema.Union([V2ItemStartedNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -27293,11 +34798,14 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union( export type V2PluginInstalledResponse__PluginSummary = { readonly authPolicy: V2PluginInstalledResponse__PluginAuthPolicy; readonly availability?: V2PluginInstalledResponse__PluginAvailability; + readonly disabledReason?: V2PluginInstalledResponse__PluginDisabledReason | null; + readonly eligiblePlanTypes?: ReadonlyArray | null; readonly enabled: boolean; readonly id: string; readonly installPolicy: V2PluginInstalledResponse__PluginInstallPolicy; readonly installPolicySource?: V2PluginInstalledResponse__PluginInstallPolicySource | null; readonly installed: boolean; + readonly installedAt?: number | null; readonly interface?: V2PluginInstalledResponse__PluginInterface | null; readonly keywords?: ReadonlyArray; readonly localVersion?: string | null; @@ -27319,6 +34827,19 @@ export const V2PluginInstalledResponse__PluginSummary = Schema.Struct({ default: "AVAILABLE", }), ), + disabledReason: Schema.optionalKey( + Schema.Union([V2PluginInstalledResponse__PluginDisabledReason, Schema.Null]).annotate({ + description: "Why the remote plugin is unavailable, when provided by plugin-service.", + }), + ), + eligiblePlanTypes: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: "Raw plugin-service plan identifiers eligible to install the plugin.", + }), + Schema.Null, + ]), + ), enabled: Schema.Boolean, id: Schema.String, installPolicy: V2PluginInstalledResponse__PluginInstallPolicy, @@ -27326,6 +34847,16 @@ export const V2PluginInstalledResponse__PluginSummary = Schema.Struct({ Schema.Union([V2PluginInstalledResponse__PluginInstallPolicySource, Schema.Null]), ), installed: Schema.Boolean, + installedAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Unix timestamp in seconds when the remote plugin was installed, when available.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), interface: Schema.optionalKey( Schema.Union([V2PluginInstalledResponse__PluginInterface, Schema.Null]), ), @@ -27365,11 +34896,14 @@ export const V2PluginInstalledResponse__PluginSummary = Schema.Struct({ export type V2PluginListResponse__PluginSummary = { readonly authPolicy: V2PluginListResponse__PluginAuthPolicy; readonly availability?: V2PluginListResponse__PluginAvailability; + readonly disabledReason?: V2PluginListResponse__PluginDisabledReason | null; + readonly eligiblePlanTypes?: ReadonlyArray | null; readonly enabled: boolean; readonly id: string; readonly installPolicy: V2PluginListResponse__PluginInstallPolicy; readonly installPolicySource?: V2PluginListResponse__PluginInstallPolicySource | null; readonly installed: boolean; + readonly installedAt?: number | null; readonly interface?: V2PluginListResponse__PluginInterface | null; readonly keywords?: ReadonlyArray; readonly localVersion?: string | null; @@ -27391,6 +34925,19 @@ export const V2PluginListResponse__PluginSummary = Schema.Struct({ default: "AVAILABLE", }), ), + disabledReason: Schema.optionalKey( + Schema.Union([V2PluginListResponse__PluginDisabledReason, Schema.Null]).annotate({ + description: "Why the remote plugin is unavailable, when provided by plugin-service.", + }), + ), + eligiblePlanTypes: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: "Raw plugin-service plan identifiers eligible to install the plugin.", + }), + Schema.Null, + ]), + ), enabled: Schema.Boolean, id: Schema.String, installPolicy: V2PluginListResponse__PluginInstallPolicy, @@ -27398,6 +34945,16 @@ export const V2PluginListResponse__PluginSummary = Schema.Struct({ Schema.Union([V2PluginListResponse__PluginInstallPolicySource, Schema.Null]), ), installed: Schema.Boolean, + installedAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Unix timestamp in seconds when the remote plugin was installed, when available.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), interface: Schema.optionalKey(Schema.Union([V2PluginListResponse__PluginInterface, Schema.Null])), keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), localVersion: Schema.optionalKey( @@ -27435,11 +34992,14 @@ export const V2PluginListResponse__PluginSummary = Schema.Struct({ export type V2PluginReadResponse__PluginSummary = { readonly authPolicy: V2PluginReadResponse__PluginAuthPolicy; readonly availability?: V2PluginReadResponse__PluginAvailability; + readonly disabledReason?: V2PluginReadResponse__PluginDisabledReason | null; + readonly eligiblePlanTypes?: ReadonlyArray | null; readonly enabled: boolean; readonly id: string; readonly installPolicy: V2PluginReadResponse__PluginInstallPolicy; readonly installPolicySource?: V2PluginReadResponse__PluginInstallPolicySource | null; readonly installed: boolean; + readonly installedAt?: number | null; readonly interface?: V2PluginReadResponse__PluginInterface | null; readonly keywords?: ReadonlyArray; readonly localVersion?: string | null; @@ -27461,6 +35021,19 @@ export const V2PluginReadResponse__PluginSummary = Schema.Struct({ default: "AVAILABLE", }), ), + disabledReason: Schema.optionalKey( + Schema.Union([V2PluginReadResponse__PluginDisabledReason, Schema.Null]).annotate({ + description: "Why the remote plugin is unavailable, when provided by plugin-service.", + }), + ), + eligiblePlanTypes: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: "Raw plugin-service plan identifiers eligible to install the plugin.", + }), + Schema.Null, + ]), + ), enabled: Schema.Boolean, id: Schema.String, installPolicy: V2PluginReadResponse__PluginInstallPolicy, @@ -27468,6 +35041,16 @@ export const V2PluginReadResponse__PluginSummary = Schema.Struct({ Schema.Union([V2PluginReadResponse__PluginInstallPolicySource, Schema.Null]), ), installed: Schema.Boolean, + installedAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Unix timestamp in seconds when the remote plugin was installed, when available.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), interface: Schema.optionalKey(Schema.Union([V2PluginReadResponse__PluginInterface, Schema.Null])), keywords: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), localVersion: Schema.optionalKey( @@ -27505,11 +35088,14 @@ export const V2PluginReadResponse__PluginSummary = Schema.Struct({ export type V2PluginShareListResponse__PluginSummary = { readonly authPolicy: V2PluginShareListResponse__PluginAuthPolicy; readonly availability?: V2PluginShareListResponse__PluginAvailability; + readonly disabledReason?: V2PluginShareListResponse__PluginDisabledReason | null; + readonly eligiblePlanTypes?: ReadonlyArray | null; readonly enabled: boolean; readonly id: string; readonly installPolicy: V2PluginShareListResponse__PluginInstallPolicy; readonly installPolicySource?: V2PluginShareListResponse__PluginInstallPolicySource | null; readonly installed: boolean; + readonly installedAt?: number | null; readonly interface?: V2PluginShareListResponse__PluginInterface | null; readonly keywords?: ReadonlyArray; readonly localVersion?: string | null; @@ -27531,6 +35117,19 @@ export const V2PluginShareListResponse__PluginSummary = Schema.Struct({ default: "AVAILABLE", }), ), + disabledReason: Schema.optionalKey( + Schema.Union([V2PluginShareListResponse__PluginDisabledReason, Schema.Null]).annotate({ + description: "Why the remote plugin is unavailable, when provided by plugin-service.", + }), + ), + eligiblePlanTypes: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: "Raw plugin-service plan identifiers eligible to install the plugin.", + }), + Schema.Null, + ]), + ), enabled: Schema.Boolean, id: Schema.String, installPolicy: V2PluginShareListResponse__PluginInstallPolicy, @@ -27538,6 +35137,16 @@ export const V2PluginShareListResponse__PluginSummary = Schema.Struct({ Schema.Union([V2PluginShareListResponse__PluginInstallPolicySource, Schema.Null]), ), installed: Schema.Boolean, + installedAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Unix timestamp in seconds when the remote plugin was installed, when available.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), interface: Schema.optionalKey( Schema.Union([V2PluginShareListResponse__PluginInterface, Schema.Null]), ), @@ -27610,6 +35219,7 @@ export type V2RawResponseItemCompletedNotification__ResponseItem = | { readonly arguments: string; readonly call_id: string; + readonly encrypted_function_args?: ReadonlyArray | null; readonly id?: string | null; readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; readonly name: string; @@ -27626,9 +35236,11 @@ export type V2RawResponseItemCompletedNotification__ResponseItem = readonly type: "tool_search_call"; } | { - readonly call_id: string; + readonly call_id?: string | null; readonly id?: string | null; readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; + readonly name?: string | null; + readonly namespace?: string | null; readonly output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody; readonly type: "function_call_output"; } @@ -27680,6 +35292,10 @@ export type V2RawResponseItemCompletedNotification__ResponseItem = readonly internal_chat_message_metadata_passthrough?: V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough | null; readonly type: "compaction"; } + | { + readonly reasoning: V2RawResponseItemCompletedNotification__ConfigurationReasoning; + readonly type: "configuration_update"; + } | { readonly type: "compaction_trigger" } | { readonly encrypted_content?: string | null; @@ -27711,242 +35327,1181 @@ export const V2RawResponseItemCompletedNotification__ResponseItem = Schema.Union id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + recipient: Schema.String, + type: Schema.Literal("agent_message").annotate({ title: "AgentMessageResponseItemType" }), + }).annotate({ title: "AgentMessageResponseItem" }), + Schema.Struct({ + content: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2RawResponseItemCompletedNotification__ReasoningItemContent), + Schema.Null, + ]), + ), + encrypted_content: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + summary: Schema.Array(V2RawResponseItemCompletedNotification__ReasoningItemReasoningSummary), + type: Schema.Literal("reasoning").annotate({ title: "ReasoningResponseItemType" }), + }).annotate({ title: "ReasoningResponseItem" }), + Schema.Struct({ + action: V2RawResponseItemCompletedNotification__LocalShellAction, + call_id: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Set when using the Responses API." }), + Schema.Null, + ]), + ), + id: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Legacy id field retained for compatibility with older payloads.", + }), + Schema.Null, + ]), + ), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + status: V2RawResponseItemCompletedNotification__LocalShellStatus, + type: Schema.Literal("local_shell_call").annotate({ + title: "LocalShellCallResponseItemType", + }), + }).annotate({ title: "LocalShellCallResponseItem" }), + Schema.Struct({ + arguments: Schema.String, + call_id: Schema.String, + encrypted_function_args: Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]), + ), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("function_call").annotate({ title: "FunctionCallResponseItemType" }), + }).annotate({ title: "FunctionCallResponseItem" }), + Schema.Struct({ + arguments: Schema.Json.annotate({ expected: "JSON value" }), + call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + execution: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("tool_search_call").annotate({ + title: "ToolSearchCallResponseItemType", + }), + }).annotate({ title: "ToolSearchCallResponseItem" }), + Schema.Struct({ + call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + name: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody, + type: Schema.Literal("function_call_output").annotate({ + title: "FunctionCallOutputResponseItemType", + }), + }).annotate({ title: "FunctionCallOutputResponseItem" }), + Schema.Struct({ + call_id: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + input: Schema.String, + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("custom_tool_call").annotate({ + title: "CustomToolCallResponseItemType", + }), + }).annotate({ title: "CustomToolCallResponseItem" }), + Schema.Struct({ + call_id: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + name: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody, + type: Schema.Literal("custom_tool_call_output").annotate({ + title: "CustomToolCallOutputResponseItemType", + }), + }).annotate({ title: "CustomToolCallOutputResponseItem" }), + Schema.Struct({ + call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + execution: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + status: Schema.String, + tools: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), + type: Schema.Literal("tool_search_output").annotate({ + title: "ToolSearchOutputResponseItemType", + }), + }).annotate({ title: "ToolSearchOutputResponseItem" }), + Schema.Struct({ + action: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction, + Schema.Null, + ]), + ), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("web_search_call").annotate({ title: "WebSearchCallResponseItemType" }), + }).annotate({ title: "WebSearchCallResponseItem" }), + Schema.Struct({ + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + result: Schema.String, + revised_prompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: Schema.String, + type: Schema.Literal("image_generation_call").annotate({ + title: "ImageGenerationCallResponseItemType", + }), + }).annotate({ title: "ImageGenerationCallResponseItem" }), + Schema.Struct({ + encrypted_content: Schema.String, + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + type: Schema.Literal("compaction").annotate({ title: "CompactionResponseItemType" }), + }).annotate({ title: "CompactionResponseItem" }), + Schema.Struct({ + reasoning: V2RawResponseItemCompletedNotification__ConfigurationReasoning, + type: Schema.Literal("configuration_update").annotate({ + title: "ConfigurationUpdateResponseItemType", + }), + }).annotate({ + title: "ConfigurationUpdateResponseItem", + description: "A durable input control interpreted by the backend at its position in history.", + }), + Schema.Struct({ + type: Schema.Literal("compaction_trigger").annotate({ + title: "CompactionTriggerResponseItemType", + }), + }).annotate({ title: "CompactionTriggerResponseItem" }), + Schema.Struct({ + encrypted_content: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + internal_chat_message_metadata_passthrough: Schema.optionalKey( + Schema.Union([ + V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Null, + ]), + ), + type: Schema.Literal("context_compaction").annotate({ + title: "ContextCompactionResponseItemType", + }), + }).annotate({ title: "ContextCompactionResponseItem" }), + Schema.Struct({ + type: Schema.Literal("other").annotate({ title: "OtherResponseItemType" }), + }).annotate({ title: "OtherResponseItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2RawResponseItemCompletedNotification__ResponseItem" }); + +export type V2ReviewStartResponse__ThreadItem = + | { + readonly clientId?: string | null; + readonly content: ReadonlyArray; + readonly id: string; + readonly type: "userMessage"; + } + | { + readonly fragments: ReadonlyArray; + readonly id: string; + readonly type: "hookPrompt"; + } + | { + readonly delivery?: V2ReviewStartResponse__AgentMessageDelivery | null; + readonly id: string; + readonly memoryCitation?: V2ReviewStartResponse__MemoryCitation | null; + readonly phase?: V2ReviewStartResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; + readonly text: string; + readonly type: "agentMessage"; + } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ReviewStartResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } + | { readonly id: string; readonly text: string; readonly type: "plan" } + | { + readonly content?: ReadonlyArray; + readonly id: string; + readonly summary?: ReadonlyArray; + readonly type: "reasoning"; + } + | { + readonly aggregatedOutput?: string | null; + readonly command: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ReviewStartResponse__LegacyAppPathString; + readonly durationMs?: number | null; + readonly exitCode?: number | null; + readonly id: string; + readonly pluginId?: string | null; + readonly processId?: string | null; + readonly scriptPath?: string | null; + readonly source?: V2ReviewStartResponse__CommandExecutionSource; + readonly status: V2ReviewStartResponse__CommandExecutionStatus; + readonly type: "commandExecution"; + } + | { + readonly changes: ReadonlyArray; + readonly id: string; + readonly status: V2ReviewStartResponse__PatchApplyStatus; + readonly type: "fileChange"; + } + | { + readonly appContext?: V2ReviewStartResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; + readonly durationMs?: number | null; + readonly error?: V2ReviewStartResponse__McpToolCallError | null; + readonly id: string; + readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ReviewStartResponse__McpAppUi | null; + readonly pluginId?: string | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ReviewStartResponse__McpToolCallResult | null; + readonly server: string; + readonly status: V2ReviewStartResponse__McpToolCallStatus; + readonly tool: string; + readonly type: "mcpToolCall"; + } + | { + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; + readonly durationMs?: number | null; + readonly id: string; + readonly namespace?: string | null; + readonly status: V2ReviewStartResponse__DynamicToolCallStatus; + readonly success?: boolean | null; + readonly tool: string; + readonly type: "dynamicToolCall"; + } + | { + readonly agentsStates: { readonly [x: string]: V2ReviewStartResponse__CollabAgentState }; + readonly id: string; + readonly model?: string | null; + readonly prompt?: string | null; + readonly reasoningEffort?: V2ReviewStartResponse__ReasoningEffort | null; + readonly receiverThreadIds: ReadonlyArray; + readonly senderThreadId: string; + readonly status: V2ReviewStartResponse__CollabAgentToolCallStatus; + readonly tool: V2ReviewStartResponse__CollabAgentTool; + readonly type: "collabAgentToolCall"; + } + | { + readonly agentPath: string; + readonly agentThreadId: string; + readonly id: string; + readonly kind: V2ReviewStartResponse__SubAgentActivityKind; + readonly type: "subAgentActivity"; + } + | { + readonly action?: V2ReviewStartResponse__WebSearchAction | null; + readonly id: string; + readonly query: string; + readonly results?: ReadonlyArray | null; + readonly type: "webSearch"; + } + | { + readonly id: string; + readonly path: V2ReviewStartResponse__LegacyAppPathString; + readonly type: "imageView"; + } + | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } + | { + readonly failure?: V2ReviewStartResponse__ImageGenerationFailure | null; + readonly id: string; + readonly result: string; + readonly revisedPrompt?: string | null; + readonly savedPath?: V2ReviewStartResponse__AbsolutePathBuf | null; + readonly status: string; + readonly transparentBackground?: boolean | null; + readonly type: "imageGeneration"; + } + | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } + | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } + | { readonly id: string; readonly type: "contextCompaction" }; +export const V2ReviewStartResponse__ThreadItem = Schema.Union( + [ + Schema.Struct({ + clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + content: Schema.Array(V2ReviewStartResponse__UserInput), + id: Schema.String, + type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), + }).annotate({ title: "UserMessageThreadItem" }), + Schema.Struct({ + fragments: Schema.Array(V2ReviewStartResponse__HookPromptFragment), + id: Schema.String, + type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), + }).annotate({ title: "HookPromptThreadItem" }), + Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__AgentMessageDelivery, Schema.Null]), + ), + id: Schema.String, + memoryCitation: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__MessagePhase, Schema.Null])), + questions: Schema.optionalKey( + Schema.Union([Schema.Array(V2ReviewStartResponse__AsyncUserInputQuestion), Schema.Null]), + ), + text: Schema.String, + type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), + }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ReviewStartResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), + Schema.Struct({ + id: Schema.String, + text: Schema.String, + type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), + }).annotate({ + title: "PlanThreadItem", + description: + "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", + }), + Schema.Struct({ + content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + id: Schema.String, + summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), + }).annotate({ title: "ReasoningThreadItem" }), + Schema.Struct({ + aggregatedOutput: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "The command's output, aggregated from stdout and stderr.", + }), + Schema.Null, + ]), + ), + command: Schema.String.annotate({ description: "The command to be executed." }), + commandActions: Schema.Array(V2ReviewStartResponse__CommandAction).annotate({ + description: + "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", + }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ReviewStartResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the command execution in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + exitCode: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The command's exit code.", + format: "int32", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), + processId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Identifier for the underlying PTY process (when available).", + }), + Schema.Null, + ]), + ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), + source: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ReviewStartResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), + ), + status: V2ReviewStartResponse__CommandExecutionStatus, + type: Schema.Literal("commandExecution").annotate({ + title: "CommandExecutionThreadItemType", + }), + }).annotate({ title: "CommandExecutionThreadItem" }), + Schema.Struct({ + changes: Schema.Array(V2ReviewStartResponse__FileUpdateChange), + id: Schema.String, + status: V2ReviewStartResponse__PatchApplyStatus, + type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), + }).annotate({ title: "FileChangeThreadItem" }), + Schema.Struct({ + appContext: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__McpToolCallAppContext, Schema.Null]), + ), + arguments: Schema.Json.annotate({ expected: "JSON value" }), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the MCP tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + error: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__McpToolCallError, Schema.Null]), + ), + id: Schema.String, + mcpAppResourceUri: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", + }), + Schema.Null, + ]), + ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + result: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__McpToolCallResult, Schema.Null]), + ), + server: Schema.String, + status: V2ReviewStartResponse__McpToolCallStatus, + tool: Schema.String, + type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), + }).annotate({ title: "McpToolCallThreadItem" }), + Schema.Struct({ + arguments: Schema.Json.annotate({ expected: "JSON value" }), + contentItems: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ReviewStartResponse__DynamicToolCallOutputContentItem), + Schema.Null, + ]), + ), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "The duration of the dynamic tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + id: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + status: V2ReviewStartResponse__DynamicToolCallStatus, + success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + tool: Schema.String, + type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), + }).annotate({ title: "DynamicToolCallThreadItem" }), + Schema.Struct({ + agentsStates: Schema.Record(Schema.String, V2ReviewStartResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), + id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Model requested for the spawned agent, when applicable.", + }), + Schema.Null, + ]), + ), + prompt: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Prompt text sent as part of the collab tool call, when available.", + }), + Schema.Null, + ]), + ), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__ReasoningEffort, Schema.Null]).annotate({ + description: "Reasoning effort requested for the spawned agent, when applicable.", + }), + ), + receiverThreadIds: Schema.Array(Schema.String).annotate({ + description: + "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", + }), + senderThreadId: Schema.String.annotate({ + description: "Thread ID of the agent issuing the collab request.", + }), + status: Schema.suspend( + (): Schema.Codec => + V2ReviewStartResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ReviewStartResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), + type: Schema.Literal("collabAgentToolCall").annotate({ + title: "CollabAgentToolCallThreadItemType", + }), + }).annotate({ title: "CollabAgentToolCallThreadItem" }), + Schema.Struct({ + agentPath: Schema.String, + agentThreadId: Schema.String, + id: Schema.String, + kind: V2ReviewStartResponse__SubAgentActivityKind, + type: Schema.Literal("subAgentActivity").annotate({ + title: "SubAgentActivityThreadItemType", + }), + }).annotate({ title: "SubAgentActivityThreadItem" }), + Schema.Struct({ + action: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__WebSearchAction, Schema.Null]), + ), + id: Schema.String, + query: Schema.String, + results: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: + "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", + }), + Schema.Null, + ]), + ), + type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), + }).annotate({ title: "WebSearchThreadItem" }), + Schema.Struct({ + id: Schema.String, + path: V2ReviewStartResponse__LegacyAppPathString, + type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), + }).annotate({ title: "ImageViewThreadItem" }), + Schema.Struct({ + durationMs: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + id: Schema.String, + type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), + }).annotate({ + title: "SleepThreadItem", + description: "Display item emitted by the interruptible `clock.sleep` tool.", + }), + Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__ImageGenerationFailure, Schema.Null]), + ), + id: Schema.String, + result: Schema.String, + revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + savedPath: Schema.optionalKey( + Schema.Union([V2ReviewStartResponse__AbsolutePathBuf, Schema.Null]), + ), + status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), + }).annotate({ title: "ImageGenerationThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("enteredReviewMode").annotate({ + title: "EnteredReviewModeThreadItemType", + }), + }).annotate({ title: "EnteredReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + review: Schema.String, + type: Schema.Literal("exitedReviewMode").annotate({ + title: "ExitedReviewModeThreadItemType", + }), + }).annotate({ title: "ExitedReviewModeThreadItem" }), + Schema.Struct({ + id: Schema.String, + type: Schema.Literal("contextCompaction").annotate({ + title: "ContextCompactionThreadItemType", + }), + }).annotate({ title: "ContextCompactionThreadItem" }), + ], + { mode: "oneOf" }, +).annotate({ identifier: "V2ReviewStartResponse__ThreadItem" }); + +export type V2SkillsListResponse__SkillsListEntry = { + readonly cwd: string; + readonly errors: ReadonlyArray; + readonly skills: ReadonlyArray; +}; +export const V2SkillsListResponse__SkillsListEntry = Schema.Struct({ + cwd: Schema.String, + errors: Schema.Array(V2SkillsListResponse__SkillErrorInfo), + skills: Schema.Array(V2SkillsListResponse__SkillMetadata), +}).annotate({ identifier: "V2SkillsListResponse__SkillsListEntry" }); + +export type V2ThreadForkResponse__ThreadItem = + | { + readonly clientId?: string | null; + readonly content: ReadonlyArray; + readonly id: string; + readonly type: "userMessage"; + } + | { + readonly fragments: ReadonlyArray; + readonly id: string; + readonly type: "hookPrompt"; + } + | { + readonly delivery?: V2ThreadForkResponse__AgentMessageDelivery | null; + readonly id: string; + readonly memoryCitation?: V2ThreadForkResponse__MemoryCitation | null; + readonly phase?: V2ThreadForkResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; + readonly text: string; + readonly type: "agentMessage"; + } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadForkResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } + | { readonly id: string; readonly text: string; readonly type: "plan" } + | { + readonly content?: ReadonlyArray; + readonly id: string; + readonly summary?: ReadonlyArray; + readonly type: "reasoning"; + } + | { + readonly aggregatedOutput?: string | null; + readonly command: string; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadForkResponse__LegacyAppPathString; + readonly durationMs?: number | null; + readonly exitCode?: number | null; + readonly id: string; + readonly pluginId?: string | null; + readonly processId?: string | null; + readonly scriptPath?: string | null; + readonly source?: V2ThreadForkResponse__CommandExecutionSource; + readonly status: V2ThreadForkResponse__CommandExecutionStatus; + readonly type: "commandExecution"; + } + | { + readonly changes: ReadonlyArray; + readonly id: string; + readonly status: V2ThreadForkResponse__PatchApplyStatus; + readonly type: "fileChange"; + } + | { + readonly appContext?: V2ThreadForkResponse__McpToolCallAppContext | null; + readonly arguments: Schema.Json; + readonly durationMs?: number | null; + readonly error?: V2ThreadForkResponse__McpToolCallError | null; + readonly id: string; + readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadForkResponse__McpAppUi | null; + readonly pluginId?: string | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadForkResponse__McpToolCallResult | null; + readonly server: string; + readonly status: V2ThreadForkResponse__McpToolCallStatus; + readonly tool: string; + readonly type: "mcpToolCall"; + } + | { + readonly arguments: Schema.Json; + readonly contentItems?: ReadonlyArray | null; + readonly durationMs?: number | null; + readonly id: string; + readonly namespace?: string | null; + readonly status: V2ThreadForkResponse__DynamicToolCallStatus; + readonly success?: boolean | null; + readonly tool: string; + readonly type: "dynamicToolCall"; + } + | { + readonly agentsStates: { readonly [x: string]: V2ThreadForkResponse__CollabAgentState }; + readonly id: string; + readonly model?: string | null; + readonly prompt?: string | null; + readonly reasoningEffort?: V2ThreadForkResponse__ReasoningEffort | null; + readonly receiverThreadIds: ReadonlyArray; + readonly senderThreadId: string; + readonly status: V2ThreadForkResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadForkResponse__CollabAgentTool; + readonly type: "collabAgentToolCall"; + } + | { + readonly agentPath: string; + readonly agentThreadId: string; + readonly id: string; + readonly kind: V2ThreadForkResponse__SubAgentActivityKind; + readonly type: "subAgentActivity"; + } + | { + readonly action?: V2ThreadForkResponse__WebSearchAction | null; + readonly id: string; + readonly query: string; + readonly results?: ReadonlyArray | null; + readonly type: "webSearch"; + } + | { + readonly id: string; + readonly path: V2ThreadForkResponse__LegacyAppPathString; + readonly type: "imageView"; + } + | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } + | { + readonly failure?: V2ThreadForkResponse__ImageGenerationFailure | null; + readonly id: string; + readonly result: string; + readonly revisedPrompt?: string | null; + readonly savedPath?: V2ThreadForkResponse__AbsolutePathBuf | null; + readonly status: string; + readonly transparentBackground?: boolean | null; + readonly type: "imageGeneration"; + } + | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } + | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } + | { readonly id: string; readonly type: "contextCompaction" }; +export const V2ThreadForkResponse__ThreadItem = Schema.Union( + [ + Schema.Struct({ + clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + content: Schema.Array(V2ThreadForkResponse__UserInput), + id: Schema.String, + type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), + }).annotate({ title: "UserMessageThreadItem" }), + Schema.Struct({ + fragments: Schema.Array(V2ThreadForkResponse__HookPromptFragment), + id: Schema.String, + type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), + }).annotate({ title: "HookPromptThreadItem" }), + Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__AgentMessageDelivery, Schema.Null]), + ), + id: Schema.String, + memoryCitation: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__MessagePhase, Schema.Null])), + questions: Schema.optionalKey( + Schema.Union([Schema.Array(V2ThreadForkResponse__AsyncUserInputQuestion), Schema.Null]), + ), + text: Schema.String, + type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), + }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadForkResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), + Schema.Struct({ + id: Schema.String, + text: Schema.String, + type: Schema.Literal("plan").annotate({ title: "PlanThreadItemType" }), + }).annotate({ + title: "PlanThreadItem", + description: + "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", + }), + Schema.Struct({ + content: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + id: Schema.String, + summary: Schema.optionalKey(Schema.Array(Schema.String).annotate({ default: [] })), + type: Schema.Literal("reasoning").annotate({ title: "ReasoningThreadItemType" }), + }).annotate({ title: "ReasoningThreadItem" }), + Schema.Struct({ + aggregatedOutput: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "The command's output, aggregated from stdout and stderr.", + }), Schema.Null, ]), ), - recipient: Schema.String, - type: Schema.Literal("agent_message").annotate({ title: "AgentMessageResponseItemType" }), - }).annotate({ title: "AgentMessageResponseItem" }), - Schema.Struct({ - content: Schema.optionalKey( + command: Schema.String.annotate({ description: "The command to be executed." }), + commandActions: Schema.Array(V2ThreadForkResponse__CommandAction).annotate({ + description: + "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", + }), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__LegacyAppPathString, + ).annotate({ description: "The command's working directory." }), + durationMs: Schema.optionalKey( Schema.Union([ - Schema.Array(V2RawResponseItemCompletedNotification__ReasoningItemContent), + Schema.Number.annotate({ + description: "The duration of the command execution in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - encrypted_content: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + exitCode: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Number.annotate({ + description: "The command's exit code.", + format: "int32", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - summary: Schema.Array(V2RawResponseItemCompletedNotification__ReasoningItemReasoningSummary), - type: Schema.Literal("reasoning").annotate({ title: "ReasoningResponseItemType" }), - }).annotate({ title: "ReasoningResponseItem" }), - Schema.Struct({ - action: V2RawResponseItemCompletedNotification__LocalShellAction, - call_id: Schema.optionalKey( + id: Schema.String, + pluginId: Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ description: "Set when using the Responses API." }), + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), Schema.Null, ]), ), - id: Schema.optionalKey( + processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Legacy id field retained for compatibility with older payloads.", + description: "Identifier for the underlying PTY process (when available).", }), Schema.Null, ]), ), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + scriptPath: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), Schema.Null, ]), ), - status: V2RawResponseItemCompletedNotification__LocalShellStatus, - type: Schema.Literal("local_shell_call").annotate({ - title: "LocalShellCallResponseItemType", + source: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__CommandExecutionSource, + ).annotate({ default: "agent" }), + ), + status: V2ThreadForkResponse__CommandExecutionStatus, + type: Schema.Literal("commandExecution").annotate({ + title: "CommandExecutionThreadItemType", }), - }).annotate({ title: "LocalShellCallResponseItem" }), + }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - arguments: Schema.String, - call_id: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + changes: Schema.Array(V2ThreadForkResponse__FileUpdateChange), + id: Schema.String, + status: V2ThreadForkResponse__PatchApplyStatus, + type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), + }).annotate({ title: "FileChangeThreadItem" }), + Schema.Struct({ + appContext: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__McpToolCallAppContext, Schema.Null]), + ), + arguments: Schema.Json.annotate({ expected: "JSON value" }), + durationMs: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Number.annotate({ + description: "The duration of the MCP tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - name: Schema.String, - namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("function_call").annotate({ title: "FunctionCallResponseItemType" }), - }).annotate({ title: "FunctionCallResponseItem" }), - Schema.Struct({ - arguments: Schema.Json.annotate({ expected: "JSON value" }), - call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - execution: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + error: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__McpToolCallError, Schema.Null]), + ), + id: Schema.String, + mcpAppResourceUri: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.String.annotate({ + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", + }), Schema.Null, ]), ), - status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("tool_search_call").annotate({ - title: "ToolSearchCallResponseItemType", - }), - }).annotate({ title: "ToolSearchCallResponseItem" }), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), + pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + result: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__McpToolCallResult, Schema.Null]), + ), + server: Schema.String, + status: V2ThreadForkResponse__McpToolCallStatus, + tool: Schema.String, + type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), + }).annotate({ title: "McpToolCallThreadItem" }), Schema.Struct({ - call_id: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + arguments: Schema.Json.annotate({ expected: "JSON value" }), + contentItems: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Array(V2ThreadForkResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), - output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody, - type: Schema.Literal("function_call_output").annotate({ - title: "FunctionCallOutputResponseItemType", - }), - }).annotate({ title: "FunctionCallOutputResponseItem" }), - Schema.Struct({ - call_id: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - input: Schema.String, - internal_chat_message_metadata_passthrough: Schema.optionalKey( + durationMs: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Number.annotate({ + description: "The duration of the dynamic tool call in milliseconds.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, ]), ), - name: Schema.String, + id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("custom_tool_call").annotate({ - title: "CustomToolCallResponseItemType", - }), - }).annotate({ title: "CustomToolCallResponseItem" }), + status: V2ThreadForkResponse__DynamicToolCallStatus, + success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + tool: Schema.String, + type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), + }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - call_id: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + agentsStates: Schema.Record(Schema.String, V2ThreadForkResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), + id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), + model: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.String.annotate({ + description: "Model requested for the spawned agent, when applicable.", + }), Schema.Null, ]), ), - name: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - output: V2RawResponseItemCompletedNotification__FunctionCallOutputBody, - type: Schema.Literal("custom_tool_call_output").annotate({ - title: "CustomToolCallOutputResponseItemType", - }), - }).annotate({ title: "CustomToolCallOutputResponseItem" }), - Schema.Struct({ - call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - execution: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + prompt: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.String.annotate({ + description: "Prompt text sent as part of the collab tool call, when available.", + }), Schema.Null, ]), ), - status: Schema.String, - tools: Schema.Array(Schema.Json.annotate({ expected: "JSON value" })), - type: Schema.Literal("tool_search_output").annotate({ - title: "ToolSearchOutputResponseItemType", + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__ReasoningEffort, Schema.Null]).annotate({ + description: "Reasoning effort requested for the spawned agent, when applicable.", + }), + ), + receiverThreadIds: Schema.Array(Schema.String).annotate({ + description: + "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", }), - }).annotate({ title: "ToolSearchOutputResponseItem" }), + senderThreadId: Schema.String.annotate({ + description: "Thread ID of the agent issuing the collab request.", + }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__CollabAgentToolCallStatus, + ).annotate({ description: "Current status of the collab tool call." }), + tool: Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__CollabAgentTool, + ).annotate({ description: "Name of the collab tool that was invoked." }), + type: Schema.Literal("collabAgentToolCall").annotate({ + title: "CollabAgentToolCallThreadItemType", + }), + }).annotate({ title: "CollabAgentToolCallThreadItem" }), + Schema.Struct({ + agentPath: Schema.String, + agentThreadId: Schema.String, + id: Schema.String, + kind: V2ThreadForkResponse__SubAgentActivityKind, + type: Schema.Literal("subAgentActivity").annotate({ + title: "SubAgentActivityThreadItemType", + }), + }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__ResponsesApiWebSearchAction, - Schema.Null, - ]), + Schema.Union([V2ThreadForkResponse__WebSearchAction, Schema.Null]), ), - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( + id: Schema.String, + query: Schema.String, + results: Schema.optionalKey( Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, + Schema.Array(Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: + "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", + }), Schema.Null, ]), ), - status: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - type: Schema.Literal("web_search_call").annotate({ title: "WebSearchCallResponseItemType" }), - }).annotate({ title: "WebSearchCallResponseItem" }), + type: Schema.Literal("webSearch").annotate({ title: "WebSearchThreadItemType" }), + }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, - Schema.Null, - ]), + id: Schema.String, + path: V2ThreadForkResponse__LegacyAppPathString, + type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), + }).annotate({ title: "ImageViewThreadItem" }), + Schema.Struct({ + durationMs: Schema.Number.annotate({ format: "uint64" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + id: Schema.String, + type: Schema.Literal("sleep").annotate({ title: "SleepThreadItemType" }), + }).annotate({ + title: "SleepThreadItem", + description: "Display item emitted by the interruptible `clock.sleep` tool.", + }), + Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__ImageGenerationFailure, Schema.Null]), ), + id: Schema.String, result: Schema.String, - revised_prompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: Schema.String, - type: Schema.Literal("image_generation_call").annotate({ - title: "ImageGenerationCallResponseItemType", - }), - }).annotate({ title: "ImageGenerationCallResponseItem" }), - Schema.Struct({ - encrypted_content: Schema.String, - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, - Schema.Null, - ]), + revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + savedPath: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__AbsolutePathBuf, Schema.Null]), ), - type: Schema.Literal("compaction").annotate({ title: "CompactionResponseItemType" }), - }).annotate({ title: "CompactionResponseItem" }), + status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), + }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ - type: Schema.Literal("compaction_trigger").annotate({ - title: "CompactionTriggerResponseItemType", + id: Schema.String, + review: Schema.String, + type: Schema.Literal("enteredReviewMode").annotate({ + title: "EnteredReviewModeThreadItemType", }), - }).annotate({ title: "CompactionTriggerResponseItem" }), + }).annotate({ title: "EnteredReviewModeThreadItem" }), Schema.Struct({ - encrypted_content: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - internal_chat_message_metadata_passthrough: Schema.optionalKey( - Schema.Union([ - V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough, - Schema.Null, - ]), - ), - type: Schema.Literal("context_compaction").annotate({ - title: "ContextCompactionResponseItemType", + id: Schema.String, + review: Schema.String, + type: Schema.Literal("exitedReviewMode").annotate({ + title: "ExitedReviewModeThreadItemType", }), - }).annotate({ title: "ContextCompactionResponseItem" }), + }).annotate({ title: "ExitedReviewModeThreadItem" }), Schema.Struct({ - type: Schema.Literal("other").annotate({ title: "OtherResponseItemType" }), - }).annotate({ title: "OtherResponseItem" }), + id: Schema.String, + type: Schema.Literal("contextCompaction").annotate({ + title: "ContextCompactionThreadItemType", + }), + }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2RawResponseItemCompletedNotification__ResponseItem" }); +).annotate({ identifier: "V2ThreadForkResponse__ThreadItem" }); -export type V2ReviewStartResponse__ThreadItem = +export type V2ThreadItemsListResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadItemsListResponse__AgentMessageDelivery | null; readonly id: string; - readonly memoryCitation?: V2ReviewStartResponse__MemoryCitation | null; - readonly phase?: V2ReviewStartResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadItemsListResponse__MemoryCitation | null; + readonly phase?: V2ThreadItemsListResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadItemsListResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -27957,68 +36512,72 @@ export type V2ReviewStartResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: V2ReviewStartResponse__LegacyAppPathString; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadItemsListResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; - readonly source?: V2ReviewStartResponse__CommandExecutionSource; - readonly status: V2ReviewStartResponse__CommandExecutionStatus; + readonly scriptPath?: string | null; + readonly source?: V2ThreadItemsListResponse__CommandExecutionSource; + readonly status: V2ThreadItemsListResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ReviewStartResponse__PatchApplyStatus; + readonly status: V2ThreadItemsListResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ReviewStartResponse__McpToolCallAppContext | null; + readonly appContext?: V2ThreadItemsListResponse__McpToolCallAppContext | null; readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ReviewStartResponse__McpToolCallError | null; + readonly error?: V2ThreadItemsListResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadItemsListResponse__McpAppUi | null; readonly pluginId?: string | null; - readonly result?: V2ReviewStartResponse__McpToolCallResult | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadItemsListResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ReviewStartResponse__McpToolCallStatus; + readonly status: V2ThreadItemsListResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { readonly arguments: Schema.Json; - readonly contentItems?: ReadonlyArray | null; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ReviewStartResponse__DynamicToolCallStatus; + readonly status: V2ThreadItemsListResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ReviewStartResponse__CollabAgentState }; + readonly agentsStates: { readonly [x: string]: V2ThreadItemsListResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ReviewStartResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadItemsListResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: V2ReviewStartResponse__CollabAgentToolCallStatus; - readonly tool: V2ReviewStartResponse__CollabAgentTool; + readonly status: V2ThreadItemsListResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadItemsListResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ReviewStartResponse__SubAgentActivityKind; + readonly kind: V2ThreadItemsListResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ReviewStartResponse__WebSearchAction | null; + readonly action?: V2ThreadItemsListResponse__WebSearchAction | null; readonly id: string; readonly query: string; readonly results?: ReadonlyArray | null; @@ -28026,55 +36585,65 @@ export type V2ReviewStartResponse__ThreadItem = } | { readonly id: string; - readonly path: V2ReviewStartResponse__LegacyAppPathString; + readonly path: V2ThreadItemsListResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadItemsListResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ReviewStartResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadItemsListResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ReviewStartResponse__ThreadItem = Schema.Union( +export const V2ThreadItemsListResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ReviewStartResponse__UserInput), + content: Schema.Array(V2ThreadItemsListResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ReviewStartResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadItemsListResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadItemsListResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadItemsListResponse__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey( + Schema.Union([V2ThreadItemsListResponse__MessagePhase, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ReviewStartResponse__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + Schema.Array(V2ThreadItemsListResponse__AsyncUserInputQuestion), Schema.Null, ]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadItemsListResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -28100,13 +36669,13 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ReviewStartResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadItemsListResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), cwd: Schema.suspend( - (): Schema.Codec => - V2ReviewStartResponse__LegacyAppPathString, + (): Schema.Codec => + V2ThreadItemsListResponse__LegacyAppPathString, ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ @@ -28127,6 +36696,15 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -28135,26 +36713,35 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ReviewStartResponse__CommandExecutionSource, + (): Schema.Codec => + V2ThreadItemsListResponse__CommandExecutionSource, ).annotate({ default: "agent" }), ), - status: V2ReviewStartResponse__CommandExecutionStatus, + status: V2ThreadItemsListResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ReviewStartResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadItemsListResponse__FileUpdateChange), id: Schema.String, - status: V2ReviewStartResponse__PatchApplyStatus, + status: V2ThreadItemsListResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadItemsListResponse__McpToolCallAppContext, Schema.Null]), ), arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( @@ -28167,23 +36754,31 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( ]), ), error: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadItemsListResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadItemsListResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadItemsListResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ReviewStartResponse__McpToolCallStatus, + status: V2ThreadItemsListResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), @@ -28191,7 +36786,7 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ReviewStartResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadItemsListResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -28206,15 +36801,16 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ReviewStartResponse__DynamicToolCallStatus, + status: V2ThreadItemsListResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ReviewStartResponse__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", - }), + agentsStates: Schema.Record( + Schema.String, + V2ThreadItemsListResponse__CollabAgentState, + ).annotate({ description: "Last known status of the target agents, when available." }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -28233,7 +36829,7 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadItemsListResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -28245,12 +36841,12 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( description: "Thread ID of the agent issuing the collab request.", }), status: Schema.suspend( - (): Schema.Codec => - V2ReviewStartResponse__CollabAgentToolCallStatus, + (): Schema.Codec => + V2ThreadItemsListResponse__CollabAgentToolCallStatus, ).annotate({ description: "Current status of the collab tool call." }), tool: Schema.suspend( - (): Schema.Codec => - V2ReviewStartResponse__CollabAgentTool, + (): Schema.Codec => + V2ThreadItemsListResponse__CollabAgentTool, ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", @@ -28260,14 +36856,14 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ReviewStartResponse__SubAgentActivityKind, + kind: V2ThreadItemsListResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadItemsListResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, @@ -28284,7 +36880,7 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ReviewStartResponse__LegacyAppPathString, + path: V2ThreadItemsListResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ @@ -28302,13 +36898,17 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadItemsListResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ReviewStartResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadItemsListResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -28333,43 +36933,36 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ReviewStartResponse__ThreadItem" }); - -export type V2SkillsListResponse__SkillsListEntry = { - readonly cwd: string; - readonly errors: ReadonlyArray; - readonly skills: ReadonlyArray; -}; -export const V2SkillsListResponse__SkillsListEntry = Schema.Struct({ - cwd: Schema.String, - errors: Schema.Array(V2SkillsListResponse__SkillErrorInfo), - skills: Schema.Array(V2SkillsListResponse__SkillMetadata), -}).annotate({ identifier: "V2SkillsListResponse__SkillsListEntry" }); +).annotate({ identifier: "V2ThreadItemsListResponse__ThreadItem" }); -export type V2ThreadForkResponse__ThreadItem = +export type V2ThreadListResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadListResponse__AgentMessageDelivery | null; readonly id: string; - readonly memoryCitation?: V2ThreadForkResponse__MemoryCitation | null; - readonly phase?: V2ThreadForkResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadListResponse__MemoryCitation | null; + readonly phase?: V2ThreadListResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadListResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -28380,68 +36973,72 @@ export type V2ThreadForkResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: V2ThreadForkResponse__LegacyAppPathString; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadListResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; - readonly source?: V2ThreadForkResponse__CommandExecutionSource; - readonly status: V2ThreadForkResponse__CommandExecutionStatus; + readonly scriptPath?: string | null; + readonly source?: V2ThreadListResponse__CommandExecutionSource; + readonly status: V2ThreadListResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadForkResponse__PatchApplyStatus; + readonly status: V2ThreadListResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadForkResponse__McpToolCallAppContext | null; + readonly appContext?: V2ThreadListResponse__McpToolCallAppContext | null; readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadForkResponse__McpToolCallError | null; + readonly error?: V2ThreadListResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadListResponse__McpAppUi | null; readonly pluginId?: string | null; - readonly result?: V2ThreadForkResponse__McpToolCallResult | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadListResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadForkResponse__McpToolCallStatus; + readonly status: V2ThreadListResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { readonly arguments: Schema.Json; - readonly contentItems?: ReadonlyArray | null; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadForkResponse__DynamicToolCallStatus; + readonly status: V2ThreadListResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadForkResponse__CollabAgentState }; + readonly agentsStates: { readonly [x: string]: V2ThreadListResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadForkResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadListResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: V2ThreadForkResponse__CollabAgentToolCallStatus; - readonly tool: V2ThreadForkResponse__CollabAgentTool; + readonly status: V2ThreadListResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadListResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadForkResponse__SubAgentActivityKind; + readonly kind: V2ThreadListResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadForkResponse__WebSearchAction | null; + readonly action?: V2ThreadListResponse__WebSearchAction | null; readonly id: string; readonly query: string; readonly results?: ReadonlyArray | null; @@ -28449,55 +37046,60 @@ export type V2ThreadForkResponse__ThreadItem = } | { readonly id: string; - readonly path: V2ThreadForkResponse__LegacyAppPathString; + readonly path: V2ThreadListResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadListResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadForkResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadListResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadForkResponse__ThreadItem = Schema.Union( +export const V2ThreadListResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadForkResponse__UserInput), + content: Schema.Array(V2ThreadListResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadForkResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadListResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadListResponse__MemoryCitation, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ThreadForkResponse__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + phase: Schema.optionalKey(Schema.Union([V2ThreadListResponse__MessagePhase, Schema.Null])), questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + Schema.Union([Schema.Array(V2ThreadListResponse__AsyncUserInputQuestion), Schema.Null]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadListResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -28523,13 +37125,13 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadForkResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadListResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadForkResponse__LegacyAppPathString, + (): Schema.Codec => + V2ThreadListResponse__LegacyAppPathString, ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ @@ -28550,6 +37152,15 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -28558,26 +37169,35 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ThreadForkResponse__CommandExecutionSource, + (): Schema.Codec => + V2ThreadListResponse__CommandExecutionSource, ).annotate({ default: "agent" }), ), - status: V2ThreadForkResponse__CommandExecutionStatus, + status: V2ThreadListResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadForkResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadListResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadForkResponse__PatchApplyStatus, + status: V2ThreadListResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadListResponse__McpToolCallAppContext, Schema.Null]), ), arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( @@ -28590,23 +37210,31 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadListResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadListResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadForkResponse__McpToolCallStatus, + status: V2ThreadListResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), @@ -28614,7 +37242,7 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadForkResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadListResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -28629,13 +37257,13 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadForkResponse__DynamicToolCallStatus, + status: V2ThreadListResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadForkResponse__CollabAgentState).annotate({ + agentsStates: Schema.Record(Schema.String, V2ThreadListResponse__CollabAgentState).annotate({ description: "Last known status of the target agents, when available.", }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), @@ -28656,7 +37284,7 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadListResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -28668,12 +37296,12 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( description: "Thread ID of the agent issuing the collab request.", }), status: Schema.suspend( - (): Schema.Codec => - V2ThreadForkResponse__CollabAgentToolCallStatus, + (): Schema.Codec => + V2ThreadListResponse__CollabAgentToolCallStatus, ).annotate({ description: "Current status of the collab tool call." }), tool: Schema.suspend( - (): Schema.Codec => - V2ThreadForkResponse__CollabAgentTool, + (): Schema.Codec => + V2ThreadListResponse__CollabAgentTool, ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", @@ -28683,14 +37311,14 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadForkResponse__SubAgentActivityKind, + kind: V2ThreadListResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadListResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, @@ -28707,7 +37335,7 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadForkResponse__LegacyAppPathString, + path: V2ThreadListResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ @@ -28725,13 +37353,17 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadForkResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadListResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -28756,32 +37388,36 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadForkResponse__ThreadItem" }); +).annotate({ identifier: "V2ThreadListResponse__ThreadItem" }); -export type V2ThreadListResponse__ThreadItem = +export type V2ThreadMetadataUpdateResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadMetadataUpdateResponse__AgentMessageDelivery | null; readonly id: string; - readonly memoryCitation?: V2ThreadListResponse__MemoryCitation | null; - readonly phase?: V2ThreadListResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadMetadataUpdateResponse__MemoryCitation | null; + readonly phase?: V2ThreadMetadataUpdateResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadMetadataUpdateResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -28792,68 +37428,74 @@ export type V2ThreadListResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: V2ThreadListResponse__LegacyAppPathString; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadMetadataUpdateResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; - readonly source?: V2ThreadListResponse__CommandExecutionSource; - readonly status: V2ThreadListResponse__CommandExecutionStatus; + readonly scriptPath?: string | null; + readonly source?: V2ThreadMetadataUpdateResponse__CommandExecutionSource; + readonly status: V2ThreadMetadataUpdateResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadListResponse__PatchApplyStatus; + readonly status: V2ThreadMetadataUpdateResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadListResponse__McpToolCallAppContext | null; + readonly appContext?: V2ThreadMetadataUpdateResponse__McpToolCallAppContext | null; readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadListResponse__McpToolCallError | null; + readonly error?: V2ThreadMetadataUpdateResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadMetadataUpdateResponse__McpAppUi | null; readonly pluginId?: string | null; - readonly result?: V2ThreadListResponse__McpToolCallResult | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadMetadataUpdateResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadListResponse__McpToolCallStatus; + readonly status: V2ThreadMetadataUpdateResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { readonly arguments: Schema.Json; - readonly contentItems?: ReadonlyArray | null; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadListResponse__DynamicToolCallStatus; + readonly status: V2ThreadMetadataUpdateResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadListResponse__CollabAgentState }; + readonly agentsStates: { + readonly [x: string]: V2ThreadMetadataUpdateResponse__CollabAgentState; + }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadListResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadMetadataUpdateResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: V2ThreadListResponse__CollabAgentToolCallStatus; - readonly tool: V2ThreadListResponse__CollabAgentTool; + readonly status: V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadMetadataUpdateResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadListResponse__SubAgentActivityKind; + readonly kind: V2ThreadMetadataUpdateResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadListResponse__WebSearchAction | null; + readonly action?: V2ThreadMetadataUpdateResponse__WebSearchAction | null; readonly id: string; readonly query: string; readonly results?: ReadonlyArray | null; @@ -28861,55 +37503,65 @@ export type V2ThreadListResponse__ThreadItem = } | { readonly id: string; - readonly path: V2ThreadListResponse__LegacyAppPathString; + readonly path: V2ThreadMetadataUpdateResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadMetadataUpdateResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadListResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadMetadataUpdateResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadListResponse__ThreadItem = Schema.Union( +export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadListResponse__UserInput), + content: Schema.Array(V2ThreadMetadataUpdateResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadListResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadMetadataUpdateResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__MessagePhase, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ThreadListResponse__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + Schema.Array(V2ThreadMetadataUpdateResponse__AsyncUserInputQuestion), Schema.Null, ]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadMetadataUpdateResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -28935,13 +37587,13 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadListResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadMetadataUpdateResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadListResponse__LegacyAppPathString, + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__LegacyAppPathString, ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ @@ -28962,6 +37614,15 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -28970,26 +37631,35 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ThreadListResponse__CommandExecutionSource, + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__CommandExecutionSource, ).annotate({ default: "agent" }), ), - status: V2ThreadListResponse__CommandExecutionStatus, + status: V2ThreadMetadataUpdateResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadListResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadMetadataUpdateResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadListResponse__PatchApplyStatus, + status: V2ThreadMetadataUpdateResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallAppContext, Schema.Null]), ), arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( @@ -29002,23 +37672,31 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadListResponse__McpToolCallStatus, + status: V2ThreadMetadataUpdateResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), @@ -29026,7 +37704,7 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadListResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadMetadataUpdateResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -29041,15 +37719,16 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadListResponse__DynamicToolCallStatus, + status: V2ThreadMetadataUpdateResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadListResponse__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", - }), + agentsStates: Schema.Record( + Schema.String, + V2ThreadMetadataUpdateResponse__CollabAgentState, + ).annotate({ description: "Last known status of the target agents, when available." }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -29068,7 +37747,7 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadMetadataUpdateResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -29080,12 +37759,12 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( description: "Thread ID of the agent issuing the collab request.", }), status: Schema.suspend( - (): Schema.Codec => - V2ThreadListResponse__CollabAgentToolCallStatus, + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus, ).annotate({ description: "Current status of the collab tool call." }), tool: Schema.suspend( - (): Schema.Codec => - V2ThreadListResponse__CollabAgentTool, + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__CollabAgentTool, ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", @@ -29095,14 +37774,14 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadListResponse__SubAgentActivityKind, + kind: V2ThreadMetadataUpdateResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, @@ -29119,7 +37798,7 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadListResponse__LegacyAppPathString, + path: V2ThreadMetadataUpdateResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ @@ -29137,13 +37816,17 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadListResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadMetadataUpdateResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -29168,32 +37851,36 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadListResponse__ThreadItem" }); +).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ThreadItem" }); -export type V2ThreadMetadataUpdateResponse__ThreadItem = +export type V2ThreadReadResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadReadResponse__AgentMessageDelivery | null; readonly id: string; - readonly memoryCitation?: V2ThreadMetadataUpdateResponse__MemoryCitation | null; - readonly phase?: V2ThreadMetadataUpdateResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadReadResponse__MemoryCitation | null; + readonly phase?: V2ThreadReadResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadReadResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -29204,70 +37891,72 @@ export type V2ThreadMetadataUpdateResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: V2ThreadMetadataUpdateResponse__LegacyAppPathString; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadReadResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; - readonly source?: V2ThreadMetadataUpdateResponse__CommandExecutionSource; - readonly status: V2ThreadMetadataUpdateResponse__CommandExecutionStatus; + readonly scriptPath?: string | null; + readonly source?: V2ThreadReadResponse__CommandExecutionSource; + readonly status: V2ThreadReadResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadMetadataUpdateResponse__PatchApplyStatus; + readonly status: V2ThreadReadResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadMetadataUpdateResponse__McpToolCallAppContext | null; + readonly appContext?: V2ThreadReadResponse__McpToolCallAppContext | null; readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadMetadataUpdateResponse__McpToolCallError | null; + readonly error?: V2ThreadReadResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadReadResponse__McpAppUi | null; readonly pluginId?: string | null; - readonly result?: V2ThreadMetadataUpdateResponse__McpToolCallResult | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadReadResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadMetadataUpdateResponse__McpToolCallStatus; + readonly status: V2ThreadReadResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { readonly arguments: Schema.Json; - readonly contentItems?: ReadonlyArray | null; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadMetadataUpdateResponse__DynamicToolCallStatus; + readonly status: V2ThreadReadResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { - readonly [x: string]: V2ThreadMetadataUpdateResponse__CollabAgentState; - }; + readonly agentsStates: { readonly [x: string]: V2ThreadReadResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadMetadataUpdateResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadReadResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus; - readonly tool: V2ThreadMetadataUpdateResponse__CollabAgentTool; + readonly status: V2ThreadReadResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadReadResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadMetadataUpdateResponse__SubAgentActivityKind; + readonly kind: V2ThreadReadResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadMetadataUpdateResponse__WebSearchAction | null; + readonly action?: V2ThreadReadResponse__WebSearchAction | null; readonly id: string; readonly query: string; readonly results?: ReadonlyArray | null; @@ -29275,57 +37964,60 @@ export type V2ThreadMetadataUpdateResponse__ThreadItem = } | { readonly id: string; - readonly path: V2ThreadMetadataUpdateResponse__LegacyAppPathString; + readonly path: V2ThreadReadResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadReadResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadMetadataUpdateResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadReadResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( +export const V2ThreadReadResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadMetadataUpdateResponse__UserInput), + content: Schema.Array(V2ThreadReadResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadMetadataUpdateResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadReadResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__MessagePhase, Schema.Null]), + Schema.Union([V2ThreadReadResponse__MemoryCitation, Schema.Null]), ), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + phase: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__MessagePhase, Schema.Null])), questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + Schema.Union([Schema.Array(V2ThreadReadResponse__AsyncUserInputQuestion), Schema.Null]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadReadResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -29351,13 +38043,13 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadMetadataUpdateResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadReadResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadMetadataUpdateResponse__LegacyAppPathString, + (): Schema.Codec => + V2ThreadReadResponse__LegacyAppPathString, ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ @@ -29378,6 +38070,15 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -29386,26 +38087,35 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ThreadMetadataUpdateResponse__CommandExecutionSource, + (): Schema.Codec => + V2ThreadReadResponse__CommandExecutionSource, ).annotate({ default: "agent" }), ), - status: V2ThreadMetadataUpdateResponse__CommandExecutionStatus, + status: V2ThreadReadResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadMetadataUpdateResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadReadResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadMetadataUpdateResponse__PatchApplyStatus, + status: V2ThreadReadResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadReadResponse__McpToolCallAppContext, Schema.Null]), ), arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( @@ -29418,23 +38128,31 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadReadResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadReadResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadMetadataUpdateResponse__McpToolCallStatus, + status: V2ThreadReadResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), @@ -29442,7 +38160,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadMetadataUpdateResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadReadResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -29457,16 +38175,15 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadMetadataUpdateResponse__DynamicToolCallStatus, + status: V2ThreadReadResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record( - Schema.String, - V2ThreadMetadataUpdateResponse__CollabAgentState, - ).annotate({ description: "Last known status of the target agents, when available." }), + agentsStates: Schema.Record(Schema.String, V2ThreadReadResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -29485,7 +38202,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadReadResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -29497,12 +38214,12 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( description: "Thread ID of the agent issuing the collab request.", }), status: Schema.suspend( - (): Schema.Codec => - V2ThreadMetadataUpdateResponse__CollabAgentToolCallStatus, + (): Schema.Codec => + V2ThreadReadResponse__CollabAgentToolCallStatus, ).annotate({ description: "Current status of the collab tool call." }), tool: Schema.suspend( - (): Schema.Codec => - V2ThreadMetadataUpdateResponse__CollabAgentTool, + (): Schema.Codec => + V2ThreadReadResponse__CollabAgentTool, ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", @@ -29512,14 +38229,14 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadMetadataUpdateResponse__SubAgentActivityKind, + kind: V2ThreadReadResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadReadResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, @@ -29536,7 +38253,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadMetadataUpdateResponse__LegacyAppPathString, + path: V2ThreadReadResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ @@ -29554,13 +38271,17 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadReadResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -29585,32 +38306,36 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ThreadItem" }); +).annotate({ identifier: "V2ThreadReadResponse__ThreadItem" }); -export type V2ThreadReadResponse__ThreadItem = +export type V2ThreadResumeResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadResumeResponse__AgentMessageDelivery | null; readonly id: string; - readonly memoryCitation?: V2ThreadReadResponse__MemoryCitation | null; - readonly phase?: V2ThreadReadResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadResumeResponse__MemoryCitation | null; + readonly phase?: V2ThreadResumeResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadResumeResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -29621,68 +38346,72 @@ export type V2ThreadReadResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: V2ThreadReadResponse__LegacyAppPathString; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadResumeResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; - readonly source?: V2ThreadReadResponse__CommandExecutionSource; - readonly status: V2ThreadReadResponse__CommandExecutionStatus; + readonly scriptPath?: string | null; + readonly source?: V2ThreadResumeResponse__CommandExecutionSource; + readonly status: V2ThreadResumeResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadReadResponse__PatchApplyStatus; + readonly status: V2ThreadResumeResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadReadResponse__McpToolCallAppContext | null; + readonly appContext?: V2ThreadResumeResponse__McpToolCallAppContext | null; readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadReadResponse__McpToolCallError | null; + readonly error?: V2ThreadResumeResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadResumeResponse__McpAppUi | null; readonly pluginId?: string | null; - readonly result?: V2ThreadReadResponse__McpToolCallResult | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadResumeResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadReadResponse__McpToolCallStatus; + readonly status: V2ThreadResumeResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { readonly arguments: Schema.Json; - readonly contentItems?: ReadonlyArray | null; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadReadResponse__DynamicToolCallStatus; + readonly status: V2ThreadResumeResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadReadResponse__CollabAgentState }; + readonly agentsStates: { readonly [x: string]: V2ThreadResumeResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadReadResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadResumeResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: V2ThreadReadResponse__CollabAgentToolCallStatus; - readonly tool: V2ThreadReadResponse__CollabAgentTool; + readonly status: V2ThreadResumeResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadResumeResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadReadResponse__SubAgentActivityKind; + readonly kind: V2ThreadResumeResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadReadResponse__WebSearchAction | null; + readonly action?: V2ThreadResumeResponse__WebSearchAction | null; readonly id: string; readonly query: string; readonly results?: ReadonlyArray | null; @@ -29690,55 +38419,60 @@ export type V2ThreadReadResponse__ThreadItem = } | { readonly id: string; - readonly path: V2ThreadReadResponse__LegacyAppPathString; + readonly path: V2ThreadResumeResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadResumeResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadReadResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadResumeResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadReadResponse__ThreadItem = Schema.Union( +export const V2ThreadResumeResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadReadResponse__UserInput), + content: Schema.Array(V2ThreadResumeResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadReadResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadResumeResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__MemoryCitation, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ThreadReadResponse__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + phase: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__MessagePhase, Schema.Null])), questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + Schema.Union([Schema.Array(V2ThreadResumeResponse__AsyncUserInputQuestion), Schema.Null]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadResumeResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -29764,13 +38498,13 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadReadResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadResumeResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadReadResponse__LegacyAppPathString, + (): Schema.Codec => + V2ThreadResumeResponse__LegacyAppPathString, ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ @@ -29791,6 +38525,15 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -29799,26 +38542,35 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ThreadReadResponse__CommandExecutionSource, + (): Schema.Codec => + V2ThreadResumeResponse__CommandExecutionSource, ).annotate({ default: "agent" }), ), - status: V2ThreadReadResponse__CommandExecutionStatus, + status: V2ThreadResumeResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadReadResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadResumeResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadReadResponse__PatchApplyStatus, + status: V2ThreadResumeResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__McpToolCallAppContext, Schema.Null]), ), arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( @@ -29831,23 +38583,31 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadReadResponse__McpToolCallStatus, + status: V2ThreadResumeResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), @@ -29855,7 +38615,7 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadReadResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadResumeResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -29870,15 +38630,15 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadReadResponse__DynamicToolCallStatus, + status: V2ThreadResumeResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadReadResponse__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", - }), + agentsStates: Schema.Record(Schema.String, V2ThreadResumeResponse__CollabAgentState).annotate( + { description: "Last known status of the target agents, when available." }, + ), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -29897,7 +38657,7 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadResumeResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -29909,12 +38669,12 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( description: "Thread ID of the agent issuing the collab request.", }), status: Schema.suspend( - (): Schema.Codec => - V2ThreadReadResponse__CollabAgentToolCallStatus, + (): Schema.Codec => + V2ThreadResumeResponse__CollabAgentToolCallStatus, ).annotate({ description: "Current status of the collab tool call." }), tool: Schema.suspend( - (): Schema.Codec => - V2ThreadReadResponse__CollabAgentTool, + (): Schema.Codec => + V2ThreadResumeResponse__CollabAgentTool, ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", @@ -29924,14 +38684,14 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadReadResponse__SubAgentActivityKind, + kind: V2ThreadResumeResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, @@ -29948,7 +38708,7 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadReadResponse__LegacyAppPathString, + path: V2ThreadResumeResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ @@ -29966,13 +38726,17 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadResumeResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -29997,32 +38761,36 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadReadResponse__ThreadItem" }); +).annotate({ identifier: "V2ThreadResumeResponse__ThreadItem" }); -export type V2ThreadResumeResponse__ThreadItem = +export type V2ThreadRevertResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadRevertResponse__AgentMessageDelivery | null; readonly id: string; - readonly memoryCitation?: V2ThreadResumeResponse__MemoryCitation | null; - readonly phase?: V2ThreadResumeResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadRevertResponse__MemoryCitation | null; + readonly phase?: V2ThreadRevertResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadRevertResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -30033,68 +38801,72 @@ export type V2ThreadResumeResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: V2ThreadResumeResponse__LegacyAppPathString; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadRevertResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; - readonly source?: V2ThreadResumeResponse__CommandExecutionSource; - readonly status: V2ThreadResumeResponse__CommandExecutionStatus; + readonly scriptPath?: string | null; + readonly source?: V2ThreadRevertResponse__CommandExecutionSource; + readonly status: V2ThreadRevertResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadResumeResponse__PatchApplyStatus; + readonly status: V2ThreadRevertResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadResumeResponse__McpToolCallAppContext | null; + readonly appContext?: V2ThreadRevertResponse__McpToolCallAppContext | null; readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadResumeResponse__McpToolCallError | null; + readonly error?: V2ThreadRevertResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadRevertResponse__McpAppUi | null; readonly pluginId?: string | null; - readonly result?: V2ThreadResumeResponse__McpToolCallResult | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadRevertResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadResumeResponse__McpToolCallStatus; + readonly status: V2ThreadRevertResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { readonly arguments: Schema.Json; - readonly contentItems?: ReadonlyArray | null; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadResumeResponse__DynamicToolCallStatus; + readonly status: V2ThreadRevertResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadResumeResponse__CollabAgentState }; + readonly agentsStates: { readonly [x: string]: V2ThreadRevertResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadResumeResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadRevertResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: V2ThreadResumeResponse__CollabAgentToolCallStatus; - readonly tool: V2ThreadResumeResponse__CollabAgentTool; + readonly status: V2ThreadRevertResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadRevertResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadResumeResponse__SubAgentActivityKind; + readonly kind: V2ThreadRevertResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadResumeResponse__WebSearchAction | null; + readonly action?: V2ThreadRevertResponse__WebSearchAction | null; readonly id: string; readonly query: string; readonly results?: ReadonlyArray | null; @@ -30102,55 +38874,60 @@ export type V2ThreadResumeResponse__ThreadItem = } | { readonly id: string; - readonly path: V2ThreadResumeResponse__LegacyAppPathString; + readonly path: V2ThreadRevertResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadRevertResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadResumeResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadRevertResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadResumeResponse__ThreadItem = Schema.Union( +export const V2ThreadRevertResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadResumeResponse__UserInput), + content: Schema.Array(V2ThreadRevertResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadResumeResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadRevertResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadRevertResponse__MemoryCitation, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ThreadResumeResponse__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + phase: Schema.optionalKey(Schema.Union([V2ThreadRevertResponse__MessagePhase, Schema.Null])), questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + Schema.Union([Schema.Array(V2ThreadRevertResponse__AsyncUserInputQuestion), Schema.Null]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadRevertResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -30176,13 +38953,13 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadResumeResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadRevertResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadResumeResponse__LegacyAppPathString, + (): Schema.Codec => + V2ThreadRevertResponse__LegacyAppPathString, ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ @@ -30203,6 +38980,15 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -30211,26 +38997,35 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ThreadResumeResponse__CommandExecutionSource, + (): Schema.Codec => + V2ThreadRevertResponse__CommandExecutionSource, ).annotate({ default: "agent" }), ), - status: V2ThreadResumeResponse__CommandExecutionStatus, + status: V2ThreadRevertResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadResumeResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadRevertResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadResumeResponse__PatchApplyStatus, + status: V2ThreadRevertResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadRevertResponse__McpToolCallAppContext, Schema.Null]), ), arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( @@ -30243,23 +39038,31 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadRevertResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadRevertResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadResumeResponse__McpToolCallStatus, + status: V2ThreadRevertResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), @@ -30267,7 +39070,7 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadResumeResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadRevertResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -30282,13 +39085,13 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadResumeResponse__DynamicToolCallStatus, + status: V2ThreadRevertResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadResumeResponse__CollabAgentState).annotate( + agentsStates: Schema.Record(Schema.String, V2ThreadRevertResponse__CollabAgentState).annotate( { description: "Last known status of the target agents, when available." }, ), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), @@ -30309,7 +39112,7 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadRevertResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -30321,12 +39124,12 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( description: "Thread ID of the agent issuing the collab request.", }), status: Schema.suspend( - (): Schema.Codec => - V2ThreadResumeResponse__CollabAgentToolCallStatus, + (): Schema.Codec => + V2ThreadRevertResponse__CollabAgentToolCallStatus, ).annotate({ description: "Current status of the collab tool call." }), tool: Schema.suspend( - (): Schema.Codec => - V2ThreadResumeResponse__CollabAgentTool, + (): Schema.Codec => + V2ThreadRevertResponse__CollabAgentTool, ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", @@ -30336,14 +39139,14 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadResumeResponse__SubAgentActivityKind, + kind: V2ThreadRevertResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadRevertResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, @@ -30360,7 +39163,7 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadResumeResponse__LegacyAppPathString, + path: V2ThreadRevertResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ @@ -30378,13 +39181,17 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadResumeResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadRevertResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -30409,32 +39216,83 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadResumeResponse__ThreadItem" }); +).annotate({ identifier: "V2ThreadRevertResponse__ThreadItem" }); -export type V2ThreadRollbackResponse__ThreadItem = +export type V2ThreadSettingsUpdatedNotification__ThreadSettings = { + readonly activePermissionProfile?: V2ThreadSettingsUpdatedNotification__ActivePermissionProfile | null; + readonly approvalPolicy: V2ThreadSettingsUpdatedNotification__AskForApproval; + readonly approvalsReviewer: V2ThreadSettingsUpdatedNotification__ApprovalsReviewer; + readonly collaborationMode: V2ThreadSettingsUpdatedNotification__CollaborationMode; + readonly cwd: V2ThreadSettingsUpdatedNotification__AbsolutePathBuf; + readonly disabledPluginIds?: ReadonlyArray; + readonly effort?: V2ThreadSettingsUpdatedNotification__ReasoningEffort | null; + readonly model: string; + readonly modelProvider: string; + readonly personality?: V2ThreadSettingsUpdatedNotification__Personality | null; + readonly sandboxPolicy: V2ThreadSettingsUpdatedNotification__SandboxPolicy; + readonly serviceTier?: string | null; + readonly summary?: V2ThreadSettingsUpdatedNotification__ReasoningSummary | null; +}; +export const V2ThreadSettingsUpdatedNotification__ThreadSettings = Schema.Struct({ + activePermissionProfile: Schema.optionalKey( + Schema.Union([V2ThreadSettingsUpdatedNotification__ActivePermissionProfile, Schema.Null]), + ), + approvalPolicy: V2ThreadSettingsUpdatedNotification__AskForApproval, + approvalsReviewer: V2ThreadSettingsUpdatedNotification__ApprovalsReviewer, + collaborationMode: V2ThreadSettingsUpdatedNotification__CollaborationMode, + cwd: V2ThreadSettingsUpdatedNotification__AbsolutePathBuf, + disabledPluginIds: Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + description: "Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.", + default: [], + }), + ), + effort: Schema.optionalKey( + Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningEffort, Schema.Null]), + ), + model: Schema.String, + modelProvider: Schema.String, + personality: Schema.optionalKey( + Schema.Union([V2ThreadSettingsUpdatedNotification__Personality, Schema.Null]).annotate({ + description: + "@deprecated Reports the saved setting; `friendly` and `pragmatic` no longer select a style.", + }), + ), + sandboxPolicy: V2ThreadSettingsUpdatedNotification__SandboxPolicy, + serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + summary: Schema.optionalKey( + Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningSummary, Schema.Null]), + ), +}).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__ThreadSettings" }); + +export type V2ThreadStartedNotification__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadStartedNotification__AgentMessageDelivery | null; readonly id: string; - readonly memoryCitation?: V2ThreadRollbackResponse__MemoryCitation | null; - readonly phase?: V2ThreadRollbackResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadStartedNotification__MemoryCitation | null; + readonly phase?: V2ThreadStartedNotification__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadStartedNotification__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -30445,68 +39303,74 @@ export type V2ThreadRollbackResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: V2ThreadRollbackResponse__LegacyAppPathString; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadStartedNotification__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; - readonly source?: V2ThreadRollbackResponse__CommandExecutionSource; - readonly status: V2ThreadRollbackResponse__CommandExecutionStatus; + readonly scriptPath?: string | null; + readonly source?: V2ThreadStartedNotification__CommandExecutionSource; + readonly status: V2ThreadStartedNotification__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadRollbackResponse__PatchApplyStatus; + readonly status: V2ThreadStartedNotification__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadRollbackResponse__McpToolCallAppContext | null; + readonly appContext?: V2ThreadStartedNotification__McpToolCallAppContext | null; readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadRollbackResponse__McpToolCallError | null; + readonly error?: V2ThreadStartedNotification__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadStartedNotification__McpAppUi | null; readonly pluginId?: string | null; - readonly result?: V2ThreadRollbackResponse__McpToolCallResult | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadStartedNotification__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadRollbackResponse__McpToolCallStatus; + readonly status: V2ThreadStartedNotification__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { readonly arguments: Schema.Json; - readonly contentItems?: ReadonlyArray | null; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadRollbackResponse__DynamicToolCallStatus; + readonly status: V2ThreadStartedNotification__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadRollbackResponse__CollabAgentState }; + readonly agentsStates: { + readonly [x: string]: V2ThreadStartedNotification__CollabAgentState; + }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadRollbackResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadStartedNotification__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: V2ThreadRollbackResponse__CollabAgentToolCallStatus; - readonly tool: V2ThreadRollbackResponse__CollabAgentTool; + readonly status: V2ThreadStartedNotification__CollabAgentToolCallStatus; + readonly tool: V2ThreadStartedNotification__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadRollbackResponse__SubAgentActivityKind; + readonly kind: V2ThreadStartedNotification__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadRollbackResponse__WebSearchAction | null; + readonly action?: V2ThreadStartedNotification__WebSearchAction | null; readonly id: string; readonly query: string; readonly results?: ReadonlyArray | null; @@ -30514,57 +39378,65 @@ export type V2ThreadRollbackResponse__ThreadItem = } | { readonly id: string; - readonly path: V2ThreadRollbackResponse__LegacyAppPathString; + readonly path: V2ThreadStartedNotification__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadStartedNotification__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadRollbackResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadStartedNotification__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( +export const V2ThreadStartedNotification__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadRollbackResponse__UserInput), + content: Schema.Array(V2ThreadStartedNotification__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadRollbackResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadStartedNotification__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__MemoryCitation, Schema.Null]), ), phase: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__MessagePhase, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__MessagePhase, Schema.Null]), ), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + Schema.Array(V2ThreadStartedNotification__AsyncUserInputQuestion), Schema.Null, ]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadStartedNotification__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -30590,13 +39462,13 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadRollbackResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadStartedNotification__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadRollbackResponse__LegacyAppPathString, + (): Schema.Codec => + V2ThreadStartedNotification__LegacyAppPathString, ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ @@ -30617,6 +39489,15 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -30625,26 +39506,35 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ThreadRollbackResponse__CommandExecutionSource, + (): Schema.Codec => + V2ThreadStartedNotification__CommandExecutionSource, ).annotate({ default: "agent" }), ), - status: V2ThreadRollbackResponse__CommandExecutionStatus, + status: V2ThreadStartedNotification__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadRollbackResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadStartedNotification__FileUpdateChange), id: Schema.String, - status: V2ThreadRollbackResponse__PatchApplyStatus, + status: V2ThreadStartedNotification__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__McpToolCallAppContext, Schema.Null]), ), arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( @@ -30657,23 +39547,31 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadRollbackResponse__McpToolCallStatus, + status: V2ThreadStartedNotification__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), @@ -30681,7 +39579,7 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadRollbackResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadStartedNotification__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -30696,7 +39594,7 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadRollbackResponse__DynamicToolCallStatus, + status: V2ThreadStartedNotification__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), @@ -30704,7 +39602,7 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( Schema.Struct({ agentsStates: Schema.Record( Schema.String, - V2ThreadRollbackResponse__CollabAgentState, + V2ThreadStartedNotification__CollabAgentState, ).annotate({ description: "Last known status of the target agents, when available." }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( @@ -30724,7 +39622,7 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadStartedNotification__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -30736,12 +39634,12 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( description: "Thread ID of the agent issuing the collab request.", }), status: Schema.suspend( - (): Schema.Codec => - V2ThreadRollbackResponse__CollabAgentToolCallStatus, + (): Schema.Codec => + V2ThreadStartedNotification__CollabAgentToolCallStatus, ).annotate({ description: "Current status of the collab tool call." }), tool: Schema.suspend( - (): Schema.Codec => - V2ThreadRollbackResponse__CollabAgentTool, + (): Schema.Codec => + V2ThreadStartedNotification__CollabAgentTool, ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", @@ -30751,14 +39649,14 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadRollbackResponse__SubAgentActivityKind, + kind: V2ThreadStartedNotification__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, @@ -30775,7 +39673,7 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadRollbackResponse__LegacyAppPathString, + path: V2ThreadStartedNotification__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ @@ -30793,13 +39691,17 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadStartedNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -30824,69 +39726,36 @@ export const V2ThreadRollbackResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadRollbackResponse__ThreadItem" }); - -export type V2ThreadSettingsUpdatedNotification__ThreadSettings = { - readonly activePermissionProfile?: V2ThreadSettingsUpdatedNotification__ActivePermissionProfile | null; - readonly approvalPolicy: V2ThreadSettingsUpdatedNotification__AskForApproval; - readonly approvalsReviewer: V2ThreadSettingsUpdatedNotification__ApprovalsReviewer; - readonly collaborationMode: V2ThreadSettingsUpdatedNotification__CollaborationMode; - readonly cwd: V2ThreadSettingsUpdatedNotification__AbsolutePathBuf; - readonly effort?: V2ThreadSettingsUpdatedNotification__ReasoningEffort | null; - readonly model: string; - readonly modelProvider: string; - readonly personality?: V2ThreadSettingsUpdatedNotification__Personality | null; - readonly sandboxPolicy: V2ThreadSettingsUpdatedNotification__SandboxPolicy; - readonly serviceTier?: string | null; - readonly summary?: V2ThreadSettingsUpdatedNotification__ReasoningSummary | null; -}; -export const V2ThreadSettingsUpdatedNotification__ThreadSettings = Schema.Struct({ - activePermissionProfile: Schema.optionalKey( - Schema.Union([V2ThreadSettingsUpdatedNotification__ActivePermissionProfile, Schema.Null]), - ), - approvalPolicy: V2ThreadSettingsUpdatedNotification__AskForApproval, - approvalsReviewer: V2ThreadSettingsUpdatedNotification__ApprovalsReviewer, - collaborationMode: V2ThreadSettingsUpdatedNotification__CollaborationMode, - cwd: V2ThreadSettingsUpdatedNotification__AbsolutePathBuf, - effort: Schema.optionalKey( - Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningEffort, Schema.Null]), - ), - model: Schema.String, - modelProvider: Schema.String, - personality: Schema.optionalKey( - Schema.Union([V2ThreadSettingsUpdatedNotification__Personality, Schema.Null]), - ), - sandboxPolicy: V2ThreadSettingsUpdatedNotification__SandboxPolicy, - serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - summary: Schema.optionalKey( - Schema.Union([V2ThreadSettingsUpdatedNotification__ReasoningSummary, Schema.Null]), - ), -}).annotate({ identifier: "V2ThreadSettingsUpdatedNotification__ThreadSettings" }); +).annotate({ identifier: "V2ThreadStartedNotification__ThreadItem" }); -export type V2ThreadStartedNotification__ThreadItem = +export type V2ThreadStartResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadStartResponse__AgentMessageDelivery | null; readonly id: string; - readonly memoryCitation?: V2ThreadStartedNotification__MemoryCitation | null; - readonly phase?: V2ThreadStartedNotification__MessagePhase | null; + readonly memoryCitation?: V2ThreadStartResponse__MemoryCitation | null; + readonly phase?: V2ThreadStartResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadStartResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -30897,70 +39766,72 @@ export type V2ThreadStartedNotification__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: V2ThreadStartedNotification__LegacyAppPathString; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadStartResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; - readonly source?: V2ThreadStartedNotification__CommandExecutionSource; - readonly status: V2ThreadStartedNotification__CommandExecutionStatus; + readonly scriptPath?: string | null; + readonly source?: V2ThreadStartResponse__CommandExecutionSource; + readonly status: V2ThreadStartResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadStartedNotification__PatchApplyStatus; + readonly status: V2ThreadStartResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadStartedNotification__McpToolCallAppContext | null; + readonly appContext?: V2ThreadStartResponse__McpToolCallAppContext | null; readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadStartedNotification__McpToolCallError | null; + readonly error?: V2ThreadStartResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadStartResponse__McpAppUi | null; readonly pluginId?: string | null; - readonly result?: V2ThreadStartedNotification__McpToolCallResult | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadStartResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadStartedNotification__McpToolCallStatus; + readonly status: V2ThreadStartResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { readonly arguments: Schema.Json; - readonly contentItems?: ReadonlyArray | null; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadStartedNotification__DynamicToolCallStatus; + readonly status: V2ThreadStartResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { - readonly [x: string]: V2ThreadStartedNotification__CollabAgentState; - }; + readonly agentsStates: { readonly [x: string]: V2ThreadStartResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadStartedNotification__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadStartResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: V2ThreadStartedNotification__CollabAgentToolCallStatus; - readonly tool: V2ThreadStartedNotification__CollabAgentTool; + readonly status: V2ThreadStartResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadStartResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadStartedNotification__SubAgentActivityKind; + readonly kind: V2ThreadStartResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadStartedNotification__WebSearchAction | null; + readonly action?: V2ThreadStartResponse__WebSearchAction | null; readonly id: string; readonly query: string; readonly results?: ReadonlyArray | null; @@ -30968,57 +39839,60 @@ export type V2ThreadStartedNotification__ThreadItem = } | { readonly id: string; - readonly path: V2ThreadStartedNotification__LegacyAppPathString; + readonly path: V2ThreadStartResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadStartResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadStartedNotification__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadStartResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadStartedNotification__ThreadItem = Schema.Union( +export const V2ThreadStartResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadStartedNotification__UserInput), + content: Schema.Array(V2ThreadStartResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadStartedNotification__HookPromptFragment), + fragments: Schema.Array(V2ThreadStartResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__MemoryCitation, Schema.Null]), - ), - phase: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__MessagePhase, Schema.Null]), + Schema.Union([V2ThreadStartResponse__MemoryCitation, Schema.Null]), ), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), + phase: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__MessagePhase, Schema.Null])), questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + Schema.Union([Schema.Array(V2ThreadStartResponse__AsyncUserInputQuestion), Schema.Null]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadStartResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -31044,13 +39918,13 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadStartedNotification__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadStartResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadStartedNotification__LegacyAppPathString, + (): Schema.Codec => + V2ThreadStartResponse__LegacyAppPathString, ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ @@ -31071,6 +39945,15 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -31079,26 +39962,35 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ThreadStartedNotification__CommandExecutionSource, + (): Schema.Codec => + V2ThreadStartResponse__CommandExecutionSource, ).annotate({ default: "agent" }), ), - status: V2ThreadStartedNotification__CommandExecutionStatus, + status: V2ThreadStartResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadStartedNotification__FileUpdateChange), + changes: Schema.Array(V2ThreadStartResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadStartedNotification__PatchApplyStatus, + status: V2ThreadStartResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadStartResponse__McpToolCallAppContext, Schema.Null]), ), arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( @@ -31111,23 +40003,31 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadStartResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadStartResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadStartedNotification__McpToolCallStatus, + status: V2ThreadStartResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), @@ -31135,7 +40035,7 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadStartedNotification__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadStartResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -31150,16 +40050,15 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadStartedNotification__DynamicToolCallStatus, + status: V2ThreadStartResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record( - Schema.String, - V2ThreadStartedNotification__CollabAgentState, - ).annotate({ description: "Last known status of the target agents, when available." }), + agentsStates: Schema.Record(Schema.String, V2ThreadStartResponse__CollabAgentState).annotate({ + description: "Last known status of the target agents, when available.", + }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -31178,7 +40077,7 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadStartResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -31190,12 +40089,12 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( description: "Thread ID of the agent issuing the collab request.", }), status: Schema.suspend( - (): Schema.Codec => - V2ThreadStartedNotification__CollabAgentToolCallStatus, + (): Schema.Codec => + V2ThreadStartResponse__CollabAgentToolCallStatus, ).annotate({ description: "Current status of the collab tool call." }), tool: Schema.suspend( - (): Schema.Codec => - V2ThreadStartedNotification__CollabAgentTool, + (): Schema.Codec => + V2ThreadStartResponse__CollabAgentTool, ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", @@ -31205,14 +40104,14 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadStartedNotification__SubAgentActivityKind, + kind: V2ThreadStartResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadStartResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, @@ -31229,7 +40128,7 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadStartedNotification__LegacyAppPathString, + path: V2ThreadStartResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ @@ -31247,13 +40146,17 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadStartedNotification__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadStartResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -31278,32 +40181,36 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadStartedNotification__ThreadItem" }); +).annotate({ identifier: "V2ThreadStartResponse__ThreadItem" }); -export type V2ThreadStartResponse__ThreadItem = +export type V2ThreadTurnsListResponse__ThreadItem = | { readonly clientId?: string | null; - readonly content: ReadonlyArray; + readonly content: ReadonlyArray; readonly id: string; readonly type: "userMessage"; } | { - readonly fragments: ReadonlyArray; + readonly fragments: ReadonlyArray; readonly id: string; readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadTurnsListResponse__AgentMessageDelivery | null; readonly id: string; - readonly memoryCitation?: V2ThreadStartResponse__MemoryCitation | null; - readonly phase?: V2ThreadStartResponse__MessagePhase | null; + readonly memoryCitation?: V2ThreadTurnsListResponse__MemoryCitation | null; + readonly phase?: V2ThreadTurnsListResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadTurnsListResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -31314,68 +40221,72 @@ export type V2ThreadStartResponse__ThreadItem = | { readonly aggregatedOutput?: string | null; readonly command: string; - readonly commandActions: ReadonlyArray; - readonly cwd: V2ThreadStartResponse__LegacyAppPathString; + readonly commandActions: ReadonlyArray; + readonly cwd: V2ThreadTurnsListResponse__LegacyAppPathString; readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; - readonly source?: V2ThreadStartResponse__CommandExecutionSource; - readonly status: V2ThreadStartResponse__CommandExecutionStatus; + readonly scriptPath?: string | null; + readonly source?: V2ThreadTurnsListResponse__CommandExecutionSource; + readonly status: V2ThreadTurnsListResponse__CommandExecutionStatus; readonly type: "commandExecution"; } | { - readonly changes: ReadonlyArray; + readonly changes: ReadonlyArray; readonly id: string; - readonly status: V2ThreadStartResponse__PatchApplyStatus; + readonly status: V2ThreadTurnsListResponse__PatchApplyStatus; readonly type: "fileChange"; } | { - readonly appContext?: V2ThreadStartResponse__McpToolCallAppContext | null; + readonly appContext?: V2ThreadTurnsListResponse__McpToolCallAppContext | null; readonly arguments: Schema.Json; readonly durationMs?: number | null; - readonly error?: V2ThreadStartResponse__McpToolCallError | null; + readonly error?: V2ThreadTurnsListResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadTurnsListResponse__McpAppUi | null; readonly pluginId?: string | null; - readonly result?: V2ThreadStartResponse__McpToolCallResult | null; + readonly readOnlyHint?: boolean | null; + readonly result?: V2ThreadTurnsListResponse__McpToolCallResult | null; readonly server: string; - readonly status: V2ThreadStartResponse__McpToolCallStatus; + readonly status: V2ThreadTurnsListResponse__McpToolCallStatus; readonly tool: string; readonly type: "mcpToolCall"; } | { readonly arguments: Schema.Json; - readonly contentItems?: ReadonlyArray | null; + readonly contentItems?: ReadonlyArray | null; readonly durationMs?: number | null; readonly id: string; readonly namespace?: string | null; - readonly status: V2ThreadStartResponse__DynamicToolCallStatus; + readonly status: V2ThreadTurnsListResponse__DynamicToolCallStatus; readonly success?: boolean | null; readonly tool: string; readonly type: "dynamicToolCall"; } | { - readonly agentsStates: { readonly [x: string]: V2ThreadStartResponse__CollabAgentState }; + readonly agentsStates: { readonly [x: string]: V2ThreadTurnsListResponse__CollabAgentState }; readonly id: string; readonly model?: string | null; readonly prompt?: string | null; - readonly reasoningEffort?: V2ThreadStartResponse__ReasoningEffort | null; + readonly reasoningEffort?: V2ThreadTurnsListResponse__ReasoningEffort | null; readonly receiverThreadIds: ReadonlyArray; readonly senderThreadId: string; - readonly status: V2ThreadStartResponse__CollabAgentToolCallStatus; - readonly tool: V2ThreadStartResponse__CollabAgentTool; + readonly status: V2ThreadTurnsListResponse__CollabAgentToolCallStatus; + readonly tool: V2ThreadTurnsListResponse__CollabAgentTool; readonly type: "collabAgentToolCall"; } | { readonly agentPath: string; readonly agentThreadId: string; readonly id: string; - readonly kind: V2ThreadStartResponse__SubAgentActivityKind; + readonly kind: V2ThreadTurnsListResponse__SubAgentActivityKind; readonly type: "subAgentActivity"; } | { - readonly action?: V2ThreadStartResponse__WebSearchAction | null; + readonly action?: V2ThreadTurnsListResponse__WebSearchAction | null; readonly id: string; readonly query: string; readonly results?: ReadonlyArray | null; @@ -31383,55 +40294,65 @@ export type V2ThreadStartResponse__ThreadItem = } | { readonly id: string; - readonly path: V2ThreadStartResponse__LegacyAppPathString; + readonly path: V2ThreadTurnsListResponse__LegacyAppPathString; readonly type: "imageView"; } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadTurnsListResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; - readonly savedPath?: V2ThreadStartResponse__AbsolutePathBuf | null; + readonly savedPath?: V2ThreadTurnsListResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } | { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" } | { readonly id: string; readonly type: "contextCompaction" }; -export const V2ThreadStartResponse__ThreadItem = Schema.Union( +export const V2ThreadTurnsListResponse__ThreadItem = Schema.Union( [ Schema.Struct({ clientId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - content: Schema.Array(V2ThreadStartResponse__UserInput), + content: Schema.Array(V2ThreadTurnsListResponse__UserInput), id: Schema.String, type: Schema.Literal("userMessage").annotate({ title: "UserMessageThreadItemType" }), }).annotate({ title: "UserMessageThreadItem" }), Schema.Struct({ - fragments: Schema.Array(V2ThreadStartResponse__HookPromptFragment), + fragments: Schema.Array(V2ThreadTurnsListResponse__HookPromptFragment), id: Schema.String, type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__MemoryCitation, Schema.Null]), + Schema.Union([V2ThreadTurnsListResponse__MemoryCitation, Schema.Null]), + ), + phase: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__MessagePhase, Schema.Null]), ), - phase: Schema.optionalKey(Schema.Union([V2ThreadStartResponse__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + Schema.Array(V2ThreadTurnsListResponse__AsyncUserInputQuestion), Schema.Null, ]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadTurnsListResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -31457,13 +40378,13 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( ]), ), command: Schema.String.annotate({ description: "The command to be executed." }), - commandActions: Schema.Array(V2ThreadStartResponse__CommandAction).annotate({ + commandActions: Schema.Array(V2ThreadTurnsListResponse__CommandAction).annotate({ description: "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", }), cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadStartResponse__LegacyAppPathString, + (): Schema.Codec => + V2ThreadTurnsListResponse__LegacyAppPathString, ).annotate({ description: "The command's working directory." }), durationMs: Schema.optionalKey( Schema.Union([ @@ -31484,6 +40405,15 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -31492,26 +40422,35 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ThreadStartResponse__CommandExecutionSource, + (): Schema.Codec => + V2ThreadTurnsListResponse__CommandExecutionSource, ).annotate({ default: "agent" }), ), - status: V2ThreadStartResponse__CommandExecutionStatus, + status: V2ThreadTurnsListResponse__CommandExecutionStatus, type: Schema.Literal("commandExecution").annotate({ title: "CommandExecutionThreadItemType", }), }).annotate({ title: "CommandExecutionThreadItem" }), Schema.Struct({ - changes: Schema.Array(V2ThreadStartResponse__FileUpdateChange), + changes: Schema.Array(V2ThreadTurnsListResponse__FileUpdateChange), id: Schema.String, - status: V2ThreadStartResponse__PatchApplyStatus, + status: V2ThreadTurnsListResponse__PatchApplyStatus, type: Schema.Literal("fileChange").annotate({ title: "FileChangeThreadItemType" }), }).annotate({ title: "FileChangeThreadItem" }), Schema.Struct({ appContext: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__McpToolCallAppContext, Schema.Null]), + Schema.Union([V2ThreadTurnsListResponse__McpToolCallAppContext, Schema.Null]), ), arguments: Schema.Json.annotate({ expected: "JSON value" }), durationMs: Schema.optionalKey( @@ -31524,23 +40463,31 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__McpToolCallError, Schema.Null]), + Schema.Union([V2ThreadTurnsListResponse__McpToolCallError, Schema.Null]), ), id: Schema.String, mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__McpToolCallResult, Schema.Null]), + Schema.Union([V2ThreadTurnsListResponse__McpToolCallResult, Schema.Null]), ), server: Schema.String, - status: V2ThreadStartResponse__McpToolCallStatus, + status: V2ThreadTurnsListResponse__McpToolCallStatus, tool: Schema.String, type: Schema.Literal("mcpToolCall").annotate({ title: "McpToolCallThreadItemType" }), }).annotate({ title: "McpToolCallThreadItem" }), @@ -31548,7 +40495,7 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( arguments: Schema.Json.annotate({ expected: "JSON value" }), contentItems: Schema.optionalKey( Schema.Union([ - Schema.Array(V2ThreadStartResponse__DynamicToolCallOutputContentItem), + Schema.Array(V2ThreadTurnsListResponse__DynamicToolCallOutputContentItem), Schema.Null, ]), ), @@ -31563,15 +40510,16 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( ), id: Schema.String, namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - status: V2ThreadStartResponse__DynamicToolCallStatus, + status: V2ThreadTurnsListResponse__DynamicToolCallStatus, success: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tool: Schema.String, type: Schema.Literal("dynamicToolCall").annotate({ title: "DynamicToolCallThreadItemType" }), }).annotate({ title: "DynamicToolCallThreadItem" }), Schema.Struct({ - agentsStates: Schema.Record(Schema.String, V2ThreadStartResponse__CollabAgentState).annotate({ - description: "Last known status of the target agents, when available.", - }), + agentsStates: Schema.Record( + Schema.String, + V2ThreadTurnsListResponse__CollabAgentState, + ).annotate({ description: "Last known status of the target agents, when available." }), id: Schema.String.annotate({ description: "Unique identifier for this collab tool call." }), model: Schema.optionalKey( Schema.Union([ @@ -31590,7 +40538,7 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( ]), ), reasoningEffort: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__ReasoningEffort, Schema.Null]).annotate({ + Schema.Union([V2ThreadTurnsListResponse__ReasoningEffort, Schema.Null]).annotate({ description: "Reasoning effort requested for the spawned agent, when applicable.", }), ), @@ -31602,12 +40550,12 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( description: "Thread ID of the agent issuing the collab request.", }), status: Schema.suspend( - (): Schema.Codec => - V2ThreadStartResponse__CollabAgentToolCallStatus, + (): Schema.Codec => + V2ThreadTurnsListResponse__CollabAgentToolCallStatus, ).annotate({ description: "Current status of the collab tool call." }), tool: Schema.suspend( - (): Schema.Codec => - V2ThreadStartResponse__CollabAgentTool, + (): Schema.Codec => + V2ThreadTurnsListResponse__CollabAgentTool, ).annotate({ description: "Name of the collab tool that was invoked." }), type: Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType", @@ -31617,14 +40565,14 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( agentPath: Schema.String, agentThreadId: Schema.String, id: Schema.String, - kind: V2ThreadStartResponse__SubAgentActivityKind, + kind: V2ThreadTurnsListResponse__SubAgentActivityKind, type: Schema.Literal("subAgentActivity").annotate({ title: "SubAgentActivityThreadItemType", }), }).annotate({ title: "SubAgentActivityThreadItem" }), Schema.Struct({ action: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__WebSearchAction, Schema.Null]), + Schema.Union([V2ThreadTurnsListResponse__WebSearchAction, Schema.Null]), ), id: Schema.String, query: Schema.String, @@ -31641,7 +40589,7 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( }).annotate({ title: "WebSearchThreadItem" }), Schema.Struct({ id: Schema.String, - path: V2ThreadStartResponse__LegacyAppPathString, + path: V2ThreadTurnsListResponse__LegacyAppPathString, type: Schema.Literal("imageView").annotate({ title: "ImageViewThreadItemType" }), }).annotate({ title: "ImageViewThreadItem" }), Schema.Struct({ @@ -31659,13 +40607,17 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), savedPath: Schema.optionalKey( - Schema.Union([V2ThreadStartResponse__AbsolutePathBuf, Schema.Null]), + Schema.Union([V2ThreadTurnsListResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -31690,7 +40642,7 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union( }).annotate({ title: "ContextCompactionThreadItem" }), ], { mode: "oneOf" }, -).annotate({ identifier: "V2ThreadStartResponse__ThreadItem" }); +).annotate({ identifier: "V2ThreadTurnsListResponse__ThreadItem" }); export type V2ThreadUnarchiveResponse__ThreadItem = | { @@ -31705,17 +40657,21 @@ export type V2ThreadUnarchiveResponse__ThreadItem = readonly type: "hookPrompt"; } | { + readonly delivery?: V2ThreadUnarchiveResponse__AgentMessageDelivery | null; readonly id: string; readonly memoryCitation?: V2ThreadUnarchiveResponse__MemoryCitation | null; readonly phase?: V2ThreadUnarchiveResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2ThreadUnarchiveResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -31731,7 +40687,9 @@ export type V2ThreadUnarchiveResponse__ThreadItem = readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; + readonly scriptPath?: string | null; readonly source?: V2ThreadUnarchiveResponse__CommandExecutionSource; readonly status: V2ThreadUnarchiveResponse__CommandExecutionStatus; readonly type: "commandExecution"; @@ -31749,7 +40707,9 @@ export type V2ThreadUnarchiveResponse__ThreadItem = readonly error?: V2ThreadUnarchiveResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2ThreadUnarchiveResponse__McpAppUi | null; readonly pluginId?: string | null; + readonly readOnlyHint?: boolean | null; readonly result?: V2ThreadUnarchiveResponse__McpToolCallResult | null; readonly server: string; readonly status: V2ThreadUnarchiveResponse__McpToolCallStatus; @@ -31800,11 +40760,13 @@ export type V2ThreadUnarchiveResponse__ThreadItem = } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2ThreadUnarchiveResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; readonly savedPath?: V2ThreadUnarchiveResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } @@ -31824,6 +40786,9 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( Schema.Union([V2ThreadUnarchiveResponse__MemoryCitation, Schema.Null]), @@ -31831,21 +40796,24 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( phase: Schema.optionalKey( Schema.Union([V2ThreadUnarchiveResponse__MessagePhase, Schema.Null]), ), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + Schema.Array(V2ThreadUnarchiveResponse__AsyncUserInputQuestion), Schema.Null, ]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2ThreadUnarchiveResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -31898,6 +40866,15 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -31906,6 +40883,15 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( (): Schema.Codec => @@ -31944,12 +40930,20 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( Schema.Union([V2ThreadUnarchiveResponse__McpToolCallResult, Schema.Null]), ), @@ -32074,6 +41068,9 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -32081,6 +41078,7 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union( Schema.Union([V2ThreadUnarchiveResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -32120,17 +41118,21 @@ export type V2TurnCompletedNotification__ThreadItem = readonly type: "hookPrompt"; } | { + readonly delivery?: V2TurnCompletedNotification__AgentMessageDelivery | null; readonly id: string; readonly memoryCitation?: V2TurnCompletedNotification__MemoryCitation | null; readonly phase?: V2TurnCompletedNotification__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2TurnCompletedNotification__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -32146,7 +41148,9 @@ export type V2TurnCompletedNotification__ThreadItem = readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; + readonly scriptPath?: string | null; readonly source?: V2TurnCompletedNotification__CommandExecutionSource; readonly status: V2TurnCompletedNotification__CommandExecutionStatus; readonly type: "commandExecution"; @@ -32164,7 +41168,9 @@ export type V2TurnCompletedNotification__ThreadItem = readonly error?: V2TurnCompletedNotification__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2TurnCompletedNotification__McpAppUi | null; readonly pluginId?: string | null; + readonly readOnlyHint?: boolean | null; readonly result?: V2TurnCompletedNotification__McpToolCallResult | null; readonly server: string; readonly status: V2TurnCompletedNotification__McpToolCallStatus; @@ -32217,11 +41223,13 @@ export type V2TurnCompletedNotification__ThreadItem = } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2TurnCompletedNotification__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; readonly savedPath?: V2TurnCompletedNotification__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } @@ -32241,6 +41249,9 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( Schema.Union([V2TurnCompletedNotification__MemoryCitation, Schema.Null]), @@ -32248,21 +41259,24 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( phase: Schema.optionalKey( Schema.Union([V2TurnCompletedNotification__MessagePhase, Schema.Null]), ), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + Schema.Array(V2TurnCompletedNotification__AsyncUserInputQuestion), Schema.Null, ]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2TurnCompletedNotification__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -32315,6 +41329,15 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -32323,6 +41346,15 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( (): Schema.Codec => @@ -32361,12 +41393,20 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( Schema.Union([V2TurnCompletedNotification__McpToolCallResult, Schema.Null]), ), @@ -32491,6 +41531,9 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2TurnCompletedNotification__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -32498,6 +41541,7 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union( Schema.Union([V2TurnCompletedNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -32537,17 +41581,21 @@ export type V2TurnStartedNotification__ThreadItem = readonly type: "hookPrompt"; } | { + readonly delivery?: V2TurnStartedNotification__AgentMessageDelivery | null; readonly id: string; readonly memoryCitation?: V2TurnStartedNotification__MemoryCitation | null; readonly phase?: V2TurnStartedNotification__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2TurnStartedNotification__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -32563,7 +41611,9 @@ export type V2TurnStartedNotification__ThreadItem = readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; + readonly scriptPath?: string | null; readonly source?: V2TurnStartedNotification__CommandExecutionSource; readonly status: V2TurnStartedNotification__CommandExecutionStatus; readonly type: "commandExecution"; @@ -32581,7 +41631,9 @@ export type V2TurnStartedNotification__ThreadItem = readonly error?: V2TurnStartedNotification__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2TurnStartedNotification__McpAppUi | null; readonly pluginId?: string | null; + readonly readOnlyHint?: boolean | null; readonly result?: V2TurnStartedNotification__McpToolCallResult | null; readonly server: string; readonly status: V2TurnStartedNotification__McpToolCallStatus; @@ -32632,11 +41684,13 @@ export type V2TurnStartedNotification__ThreadItem = } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2TurnStartedNotification__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; readonly savedPath?: V2TurnStartedNotification__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } @@ -32656,6 +41710,9 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( Schema.Union([V2TurnStartedNotification__MemoryCitation, Schema.Null]), @@ -32663,21 +41720,24 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( phase: Schema.optionalKey( Schema.Union([V2TurnStartedNotification__MessagePhase, Schema.Null]), ), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), + Schema.Array(V2TurnStartedNotification__AsyncUserInputQuestion), Schema.Null, ]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2TurnStartedNotification__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -32730,6 +41790,15 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -32738,6 +41807,15 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( (): Schema.Codec => @@ -32776,12 +41854,20 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( Schema.Union([V2TurnStartedNotification__McpToolCallResult, Schema.Null]), ), @@ -32906,6 +41992,9 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2TurnStartedNotification__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -32913,6 +42002,7 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( Schema.Union([V2TurnStartedNotification__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -32939,6 +42029,17 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnStartedNotification__ThreadItem" }); +export type V2TurnStartParams__TurnToolOutput = { + readonly name: string; + readonly namespace?: string | null; + readonly output: V2TurnStartParams__FunctionCallOutputBody; +}; +export const V2TurnStartParams__TurnToolOutput = Schema.Struct({ + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2TurnStartParams__FunctionCallOutputBody, +}).annotate({ identifier: "V2TurnStartParams__TurnToolOutput" }); + export type V2TurnStartResponse__ThreadItem = | { readonly clientId?: string | null; @@ -32952,17 +42053,21 @@ export type V2TurnStartResponse__ThreadItem = readonly type: "hookPrompt"; } | { + readonly delivery?: V2TurnStartResponse__AgentMessageDelivery | null; readonly id: string; readonly memoryCitation?: V2TurnStartResponse__MemoryCitation | null; readonly phase?: V2TurnStartResponse__MessagePhase | null; + readonly questions?: ReadonlyArray | null; readonly text: string; - readonly delivery?: "async" | null; - readonly questions?: ReadonlyArray<{ - readonly title: string; - readonly options?: ReadonlyArray | null; - }> | null; readonly type: "agentMessage"; } + | { + readonly id: string; + readonly name: string; + readonly namespace?: string | null; + readonly output: V2TurnStartResponse__FunctionCallOutputBody; + readonly type: "functionCallOutput"; + } | { readonly id: string; readonly text: string; readonly type: "plan" } | { readonly content?: ReadonlyArray; @@ -32978,7 +42083,9 @@ export type V2TurnStartResponse__ThreadItem = readonly durationMs?: number | null; readonly exitCode?: number | null; readonly id: string; + readonly pluginId?: string | null; readonly processId?: string | null; + readonly scriptPath?: string | null; readonly source?: V2TurnStartResponse__CommandExecutionSource; readonly status: V2TurnStartResponse__CommandExecutionStatus; readonly type: "commandExecution"; @@ -32996,7 +42103,9 @@ export type V2TurnStartResponse__ThreadItem = readonly error?: V2TurnStartResponse__McpToolCallError | null; readonly id: string; readonly mcpAppResourceUri?: string | null; + readonly mcpAppUi?: V2TurnStartResponse__McpAppUi | null; readonly pluginId?: string | null; + readonly readOnlyHint?: boolean | null; readonly result?: V2TurnStartResponse__McpToolCallResult | null; readonly server: string; readonly status: V2TurnStartResponse__McpToolCallStatus; @@ -33047,11 +42156,13 @@ export type V2TurnStartResponse__ThreadItem = } | { readonly durationMs: number; readonly id: string; readonly type: "sleep" } | { + readonly failure?: V2TurnStartResponse__ImageGenerationFailure | null; readonly id: string; readonly result: string; readonly revisedPrompt?: string | null; readonly savedPath?: V2TurnStartResponse__AbsolutePathBuf | null; readonly status: string; + readonly transparentBackground?: boolean | null; readonly type: "imageGeneration"; } | { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" } @@ -33071,26 +42182,29 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( type: Schema.Literal("hookPrompt").annotate({ title: "HookPromptThreadItemType" }), }).annotate({ title: "HookPromptThreadItem" }), Schema.Struct({ + delivery: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__AgentMessageDelivery, Schema.Null]), + ), id: Schema.String, memoryCitation: Schema.optionalKey( Schema.Union([V2TurnStartResponse__MemoryCitation, Schema.Null]), ), phase: Schema.optionalKey(Schema.Union([V2TurnStartResponse__MessagePhase, Schema.Null])), - text: Schema.String, - delivery: Schema.optionalKey(Schema.Union([Schema.Literal("async"), Schema.Null])), questions: Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ - title: Schema.String, - options: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), - }), - ), - Schema.Null, - ]), + Schema.Union([Schema.Array(V2TurnStartResponse__AsyncUserInputQuestion), Schema.Null]), ), + text: Schema.String, type: Schema.Literal("agentMessage").annotate({ title: "AgentMessageThreadItemType" }), }).annotate({ title: "AgentMessageThreadItem" }), + Schema.Struct({ + id: Schema.String, + name: Schema.String, + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + output: V2TurnStartResponse__FunctionCallOutputBody, + type: Schema.Literal("functionCallOutput").annotate({ + title: "FunctionCallOutputThreadItemType", + }), + }).annotate({ title: "FunctionCallOutputThreadItem" }), Schema.Struct({ id: Schema.String, text: Schema.String, @@ -33143,6 +42257,15 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( ]), ), id: Schema.String, + pluginId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Trusted first-party plugin id when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), processId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -33151,6 +42274,15 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( Schema.Null, ]), ), + scriptPath: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Safe plugin-relative path when this command resolves to one plugin script.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.suspend( (): Schema.Codec => @@ -33187,12 +42319,20 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( mcpAppResourceUri: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ - description: "Deprecated: use `appContext.resourceUri` instead.", + description: + "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.", }), Schema.Null, ]), ), + mcpAppUi: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__McpAppUi, Schema.Null]).annotate({ + description: + "Presentation captured from the invoked descriptor; absent in older history.", + }), + ), pluginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + readOnlyHint: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), result: Schema.optionalKey( Schema.Union([V2TurnStartResponse__McpToolCallResult, Schema.Null]), ), @@ -33314,6 +42454,9 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( description: "Display item emitted by the interruptible `clock.sleep` tool.", }), Schema.Struct({ + failure: Schema.optionalKey( + Schema.Union([V2TurnStartResponse__ImageGenerationFailure, Schema.Null]), + ), id: Schema.String, result: Schema.String, revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -33321,6 +42464,7 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( Schema.Union([V2TurnStartResponse__AbsolutePathBuf, Schema.Null]), ), status: Schema.String, + transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }), }).annotate({ title: "ImageGenerationThreadItem" }), Schema.Struct({ @@ -33347,6 +42491,122 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union( { mode: "oneOf" }, ).annotate({ identifier: "V2TurnStartResponse__ThreadItem" }); +export type ClientRequest__TurnStartParams = { + readonly approvalPolicy?: ClientRequest__AskForApproval | null; + readonly approvalsReviewer?: ClientRequest__ApprovalsReviewer | null; + readonly clientUserMessageId?: string | null; + readonly cwd?: string | null; + readonly disabledPluginIds?: ReadonlyArray | null; + readonly effort?: ClientRequest__ReasoningEffort | null; + readonly input: ReadonlyArray; + readonly model?: string | null; + readonly outputSchema?: Schema.Json; + readonly personality?: ClientRequest__Personality | null; + readonly sandboxPolicy?: ClientRequest__SandboxPolicy | null; + readonly serviceTier?: string | null; + readonly serviceTierForTurn?: string | null; + readonly summary?: ClientRequest__ReasoningSummary | null; + readonly threadId: string; + readonly toolOutput?: ClientRequest__TurnToolOutput | null; + readonly turnTrigger?: string | null; +}; +export const ClientRequest__TurnStartParams = Schema.Struct({ + approvalPolicy: Schema.optionalKey( + Schema.Union([ClientRequest__AskForApproval, Schema.Null]).annotate({ + description: "Override the approval policy for this turn and subsequent turns.", + }), + ), + approvalsReviewer: Schema.optionalKey( + Schema.Union([ClientRequest__ApprovalsReviewer, Schema.Null]).annotate({ + description: + "Override where approval requests are routed for review on this turn and subsequent turns.", + }), + ), + clientUserMessageId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + cwd: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Override the working directory for this turn and subsequent turns.", + }), + Schema.Null, + ]), + ), + disabledPluginIds: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: + "Replace this thread's disabled plugin IDs. Omitted/null preserves the list; [] clears it.", + }), + Schema.Null, + ]), + ), + effort: Schema.optionalKey( + Schema.Union([ClientRequest__ReasoningEffort, Schema.Null]).annotate({ + description: "Override the reasoning effort for this turn and subsequent turns.", + }), + ), + input: Schema.Array(ClientRequest__UserInput), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Override the model for this turn and subsequent turns.", + }), + Schema.Null, + ]), + ), + outputSchema: Schema.optionalKey( + Schema.Json.annotate({ + expected: "JSON value", + description: + "Optional JSON Schema used to constrain the final assistant message for this turn.", + }), + ), + personality: Schema.optionalKey( + Schema.Union([ClientRequest__Personality, Schema.Null]).annotate({ + description: + "@deprecated `friendly` and `pragmatic` no longer select a style. Changing this does not rewrite the thread's existing instructions.", + }), + ), + sandboxPolicy: Schema.optionalKey( + Schema.Union([ClientRequest__SandboxPolicy, Schema.Null]).annotate({ + description: "Override the sandbox policy for this turn and subsequent turns.", + }), + ), + serviceTier: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Override the service tier for this turn and subsequent turns.", + }), + Schema.Null, + ]), + ), + serviceTierForTurn: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Override the service tier only when this request starts a new turn. Use \"default\" for standard speed. Omitted or null inherits the thread's tier. Does not change the thread's tier or a turn being steered.", + }), + Schema.Null, + ]), + ), + summary: Schema.optionalKey( + Schema.Union([ClientRequest__ReasoningSummary, Schema.Null]).annotate({ + description: "Override the reasoning summary for this turn and subsequent turns.", + }), + ), + threadId: Schema.String, + toolOutput: Schema.optionalKey(Schema.Union([ClientRequest__TurnToolOutput, Schema.Null])), + turnTrigger: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional source classification for the caller that starts this turn. Ignored when this request steers an already-active turn.", + }), + Schema.Null, + ]), + ), +}).annotate({ identifier: "ClientRequest__TurnStartParams" }); + export type CommandExecutionRequestApprovalParams__AdditionalFileSystemPermissions = { readonly entries?: ReadonlyArray | null; readonly globScanMaxDepth?: number | null; @@ -33490,6 +42750,15 @@ export const PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions ), }).annotate({ identifier: "PermissionsRequestApprovalResponse__AdditionalFileSystemPermissions" }); +export type ServerNotification__ThreadSettingsUpdatedNotification = { + readonly threadId: string; + readonly threadSettings: ServerNotification__ThreadSettings; +}; +export const ServerNotification__ThreadSettingsUpdatedNotification = Schema.Struct({ + threadId: Schema.String, + threadSettings: ServerNotification__ThreadSettings, +}).annotate({ identifier: "ServerNotification__ThreadSettingsUpdatedNotification" }); + export type ServerNotification__Turn = { readonly completedAt?: number | null; readonly durationMs?: number | null; @@ -33622,15 +42891,6 @@ export const ServerNotification__AdditionalFileSystemPermissions = Schema.Struct ), }).annotate({ identifier: "ServerNotification__AdditionalFileSystemPermissions" }); -export type ServerNotification__ThreadSettingsUpdatedNotification = { - readonly threadId: string; - readonly threadSettings: ServerNotification__ThreadSettings; -}; -export const ServerNotification__ThreadSettingsUpdatedNotification = Schema.Struct({ - threadId: Schema.String, - threadSettings: ServerNotification__ThreadSettings, -}).annotate({ identifier: "ServerNotification__ThreadSettingsUpdatedNotification" }); - export type ServerRequest__AdditionalFileSystemPermissions = { readonly entries?: ReadonlyArray | null; readonly globScanMaxDepth?: number | null; @@ -33681,6 +42941,230 @@ export const ServerRequest__McpElicitationEnumSchema = Schema.Union([ ServerRequest__McpElicitationLegacyTitledEnumSchema, ]).annotate({ identifier: "ServerRequest__McpElicitationEnumSchema" }); +export type V2ConfigReadResponse__Config = { + readonly analytics?: V2ConfigReadResponse__AnalyticsConfig | null; + readonly approval_policy?: V2ConfigReadResponse__AskForApproval | null; + readonly approvals_reviewer?: V2ConfigReadResponse__ApprovalsReviewer | null; + readonly browser_use?: V2ConfigReadResponse__BrowserUseConfig | null; + readonly compact_prompt?: string | null; + readonly computer_use?: V2ConfigReadResponse__ComputerUseConfig | null; + readonly desktop?: { readonly [x: string]: Schema.Json } | null; + readonly developer_instructions?: string | null; + readonly forced_chatgpt_workspace_id?: V2ConfigReadResponse__ForcedChatgptWorkspaceIds | null; + readonly forced_login_method?: V2ConfigReadResponse__ForcedLoginMethod | null; + readonly instructions?: string | null; + readonly model?: string | null; + readonly model_auto_compact_token_limit?: number | null; + readonly model_auto_compact_token_limit_scope?: V2ConfigReadResponse__AutoCompactTokenLimitScope | null; + readonly model_context_window?: number | null; + readonly model_provider?: string | null; + readonly model_reasoning_effort?: V2ConfigReadResponse__ReasoningEffort | null; + readonly model_reasoning_summary?: V2ConfigReadResponse__ReasoningSummary | null; + readonly model_verbosity?: V2ConfigReadResponse__Verbosity | null; + readonly review_model?: string | null; + readonly sandbox_mode?: V2ConfigReadResponse__SandboxMode | null; + readonly sandbox_workspace_write?: V2ConfigReadResponse__SandboxWorkspaceWrite | null; + readonly service_tier?: string | null; + readonly tools?: V2ConfigReadResponse__ToolsV2 | null; + readonly web_search?: V2ConfigReadResponse__WebSearchMode | null; +} & { readonly [x: string]: Schema.Json }; +export const V2ConfigReadResponse__Config = Schema.StructWithRest( + Schema.Struct({ + analytics: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AnalyticsConfig, Schema.Null]), + ), + approval_policy: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AskForApproval, Schema.Null]), + ), + approvals_reviewer: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ApprovalsReviewer, Schema.Null]).annotate({ + description: + "[UNSTABLE] Optional default for where approval requests are routed for review.", + }), + ), + browser_use: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__BrowserUseConfig, Schema.Null]), + ), + compact_prompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + computer_use: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ComputerUseConfig, Schema.Null]), + ), + desktop: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })), + Schema.Null, + ]), + ), + developer_instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + forced_chatgpt_workspace_id: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ForcedChatgptWorkspaceIds, Schema.Null]), + ), + forced_login_method: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ForcedLoginMethod, Schema.Null]), + ), + instructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model_auto_compact_token_limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + model_auto_compact_token_limit_scope: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AutoCompactTokenLimitScope, Schema.Null]), + ), + model_context_window: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "int64" }).check( + Schema.isInt().annotate({ expected: "an integer" }), + ), + Schema.Null, + ]), + ), + model_provider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + model_reasoning_effort: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ReasoningEffort, Schema.Null]), + ), + model_reasoning_summary: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ReasoningSummary, Schema.Null]), + ), + model_verbosity: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__Verbosity, Schema.Null]), + ), + review_model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + sandbox_mode: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__SandboxMode, Schema.Null]), + ), + sandbox_workspace_write: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__SandboxWorkspaceWrite, Schema.Null]), + ), + service_tier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + tools: Schema.optionalKey(Schema.Union([V2ConfigReadResponse__ToolsV2, Schema.Null])), + web_search: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__WebSearchMode, Schema.Null]), + ), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], +).annotate({ identifier: "V2ConfigReadResponse__Config" }); + +export type V2ConfigRequirementsReadResponse__ConfigRequirements = { + readonly additionalDeveloperInstructions?: string | null; + readonly allowAppshots?: boolean | null; + readonly allowBrowserAndComputerUse?: boolean | null; + readonly allowLoginShell?: boolean | null; + readonly allowManagedHooksOnly?: boolean | null; + readonly allowRemoteControl?: boolean | null; + readonly allowedApprovalPolicies?: ReadonlyArray | null; + readonly allowedLoginMethods?: ReadonlyArray | null; + readonly allowedPermissionProfiles?: { readonly [x: string]: boolean } | null; + readonly allowedSandboxModes?: ReadonlyArray | null; + readonly allowedWebSearchModes?: ReadonlyArray | null; + readonly allowedWindowsSandboxImplementations?: ReadonlyArray | null; + readonly autoReview?: V2ConfigRequirementsReadResponse__AutoReviewRequirements | null; + readonly browserUse?: V2ConfigRequirementsReadResponse__BrowserUseRequirements | null; + readonly chatgptBaseUrl?: string | null; + readonly checkForUpdateOnStartup?: boolean | null; + readonly cliAuthCredentialsStore?: V2ConfigRequirementsReadResponse__CliAuthCredentialsStoreMode | null; + readonly computerUse?: V2ConfigRequirementsReadResponse__ComputerUseRequirements | null; + readonly defaultPermissions?: string | null; + readonly enforceResidency?: V2ConfigRequirementsReadResponse__ResidencyRequirement | null; + readonly featureRequirements?: { readonly [x: string]: boolean } | null; + readonly feedback?: V2ConfigRequirementsReadResponse__FeedbackRequirements | null; + readonly inAppBrowser?: V2ConfigRequirementsReadResponse__InAppBrowserRequirements | null; + readonly logDir?: string | null; + readonly modelCatalogJson?: string | null; + readonly modelProvider?: string | null; + readonly modelProviders?: { readonly [x: string]: Schema.Json } | null; + readonly models?: V2ConfigRequirementsReadResponse__ModelsRequirements | null; + readonly sqliteHome?: string | null; +}; +export const V2ConfigRequirementsReadResponse__ConfigRequirements = Schema.Struct({ + additionalDeveloperInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + allowAppshots: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowBrowserAndComputerUse: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowLoginShell: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowManagedHooksOnly: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowRemoteControl: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + allowedApprovalPolicies: Schema.optionalKey( + Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__AskForApproval), Schema.Null]), + ), + allowedLoginMethods: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ConfigRequirementsReadResponse__ForcedLoginMethod).annotate({ + description: + "Effective login methods after managed, forced-login, and workspace restrictions. An empty list permits no login method. Older servers may omit this field.", + }), + Schema.Null, + ]), + ), + allowedPermissionProfiles: Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.Boolean), Schema.Null]), + ), + allowedSandboxModes: Schema.optionalKey( + Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__SandboxMode), Schema.Null]), + ), + allowedWebSearchModes: Schema.optionalKey( + Schema.Union([Schema.Array(V2ConfigRequirementsReadResponse__WebSearchMode), Schema.Null]), + ), + allowedWindowsSandboxImplementations: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ConfigRequirementsReadResponse__WindowsSandboxImplementation), + Schema.Null, + ]), + ), + autoReview: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__AutoReviewRequirements, Schema.Null]), + ), + browserUse: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__BrowserUseRequirements, Schema.Null]), + ), + chatgptBaseUrl: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + checkForUpdateOnStartup: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + cliAuthCredentialsStore: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__CliAuthCredentialsStoreMode, Schema.Null]), + ), + computerUse: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__ComputerUseRequirements, Schema.Null]), + ), + defaultPermissions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + enforceResidency: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__ResidencyRequirement, Schema.Null]), + ), + featureRequirements: Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.Boolean), Schema.Null]), + ), + feedback: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__FeedbackRequirements, Schema.Null]), + ), + inAppBrowser: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__InAppBrowserRequirements, Schema.Null]), + ), + logDir: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + modelCatalogJson: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + modelProvider: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Exact provider selection required by managed policy.", + }), + Schema.Null, + ]), + ), + modelProviders: Schema.optionalKey( + Schema.Union([ + Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ + description: "Complete required provider definitions, using config.toml field names.", + }), + Schema.Null, + ]), + ), + models: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__ModelsRequirements, Schema.Null]), + ), + sqliteHome: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ identifier: "V2ConfigRequirementsReadResponse__ConfigRequirements" }); + export type V2ItemGuardianApprovalReviewCompletedNotification__AdditionalFileSystemPermissions = { readonly entries?: ReadonlyArray | null; readonly globScanMaxDepth?: number | null; @@ -33822,6 +43306,7 @@ export type V2PluginReadResponse__PluginDetail = { readonly marketplaceName: string; readonly marketplacePath?: V2PluginReadResponse__AbsolutePathBuf | null; readonly mcpServers: ReadonlyArray; + readonly onboardingSkill?: V2PluginReadResponse__SkillSummary | null; readonly scheduledTasks?: ReadonlyArray | null; readonly shareUrl?: string | null; readonly skills: ReadonlyArray; @@ -33837,6 +43322,11 @@ export const V2PluginReadResponse__PluginDetail = Schema.Struct({ Schema.Union([V2PluginReadResponse__AbsolutePathBuf, Schema.Null]), ), mcpServers: Schema.Array(Schema.String), + onboardingSkill: Schema.optionalKey( + Schema.Union([V2PluginReadResponse__SkillSummary, Schema.Null]).annotate({ + description: "The declared onboarding skill, when the plugin and visible skill are enabled.", + }), + ), scheduledTasks: Schema.optionalKey( Schema.Union([Schema.Array(V2PluginReadResponse__ScheduledTaskSummary), Schema.Null]), ), @@ -33977,6 +43467,15 @@ export const V2ThreadForkResponse__Turn = Schema.Struct({ status: V2ThreadForkResponse__TurnStatus, }).annotate({ identifier: "V2ThreadForkResponse__Turn" }); +export type V2ThreadItemsListResponse__ThreadItemEntry = { + readonly item: V2ThreadItemsListResponse__ThreadItem; + readonly turnId: string; +}; +export const V2ThreadItemsListResponse__ThreadItemEntry = Schema.Struct({ + item: V2ThreadItemsListResponse__ThreadItem, + turnId: Schema.String.annotate({ description: "Turn containing this item." }), +}).annotate({ identifier: "V2ThreadItemsListResponse__ThreadItemEntry" }); + export type V2ThreadListResponse__Turn = { readonly completedAt?: number | null; readonly durationMs?: number | null; @@ -34219,17 +43718,17 @@ export const V2ThreadResumeResponse__Turn = Schema.Struct({ status: V2ThreadResumeResponse__TurnStatus, }).annotate({ identifier: "V2ThreadResumeResponse__Turn" }); -export type V2ThreadRollbackResponse__Turn = { +export type V2ThreadRevertResponse__Turn = { readonly completedAt?: number | null; readonly durationMs?: number | null; - readonly error?: V2ThreadRollbackResponse__TurnError | null; + readonly error?: V2ThreadRevertResponse__TurnError | null; readonly id: string; - readonly items: ReadonlyArray; - readonly itemsView?: V2ThreadRollbackResponse__TurnItemsView; + readonly items: ReadonlyArray; + readonly itemsView?: V2ThreadRevertResponse__TurnItemsView; readonly startedAt?: number | null; - readonly status: V2ThreadRollbackResponse__TurnStatus; + readonly status: V2ThreadRevertResponse__TurnStatus; }; -export const V2ThreadRollbackResponse__Turn = Schema.Struct({ +export const V2ThreadRevertResponse__Turn = Schema.Struct({ completedAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -34249,20 +43748,20 @@ export const V2ThreadRollbackResponse__Turn = Schema.Struct({ ]), ), error: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__TurnError, Schema.Null]).annotate({ + Schema.Union([V2ThreadRevertResponse__TurnError, Schema.Null]).annotate({ description: "Only populated when the Turn's status is failed.", }), ), id: Schema.String.annotate({ description: "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", }), - items: Schema.Array(V2ThreadRollbackResponse__ThreadItem).annotate({ + items: Schema.Array(V2ThreadRevertResponse__ThreadItem).annotate({ description: "Thread items currently included in this turn payload.", }), itemsView: Schema.optionalKey( Schema.suspend( - (): Schema.Codec => - V2ThreadRollbackResponse__TurnItemsView, + (): Schema.Codec => + V2ThreadRevertResponse__TurnItemsView, ).annotate({ description: "Describes how much of `items` has been loaded for this turn.", default: "full", @@ -34277,8 +43776,8 @@ export const V2ThreadRollbackResponse__Turn = Schema.Struct({ Schema.Null, ]), ), - status: V2ThreadRollbackResponse__TurnStatus, -}).annotate({ identifier: "V2ThreadRollbackResponse__Turn" }); + status: V2ThreadRevertResponse__TurnStatus, +}).annotate({ identifier: "V2ThreadRevertResponse__Turn" }); export type V2ThreadStartedNotification__Turn = { readonly completedAt?: number | null; @@ -34402,6 +43901,67 @@ export const V2ThreadStartResponse__Turn = Schema.Struct({ status: V2ThreadStartResponse__TurnStatus, }).annotate({ identifier: "V2ThreadStartResponse__Turn" }); +export type V2ThreadTurnsListResponse__Turn = { + readonly completedAt?: number | null; + readonly durationMs?: number | null; + readonly error?: V2ThreadTurnsListResponse__TurnError | null; + readonly id: string; + readonly items: ReadonlyArray; + readonly itemsView?: V2ThreadTurnsListResponse__TurnItemsView; + readonly startedAt?: number | null; + readonly status: V2ThreadTurnsListResponse__TurnStatus; +}; +export const V2ThreadTurnsListResponse__Turn = Schema.Struct({ + completedAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the turn completed.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + durationMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Duration between turn start and completion in milliseconds, if known.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + error: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListResponse__TurnError, Schema.Null]).annotate({ + description: "Only populated when the Turn's status is failed.", + }), + ), + id: Schema.String.annotate({ + description: "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", + }), + items: Schema.Array(V2ThreadTurnsListResponse__ThreadItem).annotate({ + description: "Thread items currently included in this turn payload.", + }), + itemsView: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadTurnsListResponse__TurnItemsView, + ).annotate({ + description: "Describes how much of `items` has been loaded for this turn.", + default: "full", + }), + ), + startedAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the turn started.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + status: V2ThreadTurnsListResponse__TurnStatus, +}).annotate({ identifier: "V2ThreadTurnsListResponse__Turn" }); + export type V2ThreadUnarchiveResponse__Turn = { readonly completedAt?: number | null; readonly durationMs?: number | null; @@ -34695,13 +44255,20 @@ export type ServerNotification__Thread = { readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: ServerNotification__GitInfo | null; + readonly historyMode?: ServerNotification__ThreadHistoryMode; readonly id: string; + readonly model?: string | null; readonly modelProvider: string; readonly name?: string | null; + readonly originator?: string | null; readonly parentThreadId?: string | null; readonly path?: string | null; readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: ServerNotification__ReasoningEffort | null; readonly recencyAt?: number | null; + readonly section?: ServerNotification__ThreadSection | null; + readonly sectionEnteredAt?: number | null; readonly sessionId: string; readonly source: ServerNotification__SessionSource; readonly status: ServerNotification__ThreadStatus; @@ -34753,9 +44320,27 @@ export const ServerNotification__Thread = Schema.Struct({ description: "Optional Git metadata captured when the thread was created.", }), ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + ServerNotification__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), id: Schema.String.annotate({ description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), modelProvider: Schema.String.annotate({ description: "Model provider used for this thread (for example, 'openai').", }), @@ -34765,6 +44350,15 @@ export const ServerNotification__Thread = Schema.Struct({ Schema.Null, ]), ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), parentThreadId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -34783,6 +44377,18 @@ export const ServerNotification__Thread = Schema.Struct({ preview: Schema.String.annotate({ description: "Usually the first user message in the thread, if available.", }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([ServerNotification__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), recencyAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -34792,6 +44398,20 @@ export const ServerNotification__Thread = Schema.Struct({ Schema.Null, ]), ), + section: Schema.optionalKey( + Schema.Union([ServerNotification__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", + }), + ), + sectionEnteredAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp in seconds when the thread entered its current section.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), @@ -34810,7 +44430,7 @@ export const ServerNotification__Thread = Schema.Struct({ ), turns: Schema.Array(ServerNotification__Turn).annotate({ description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", @@ -34927,13 +44547,20 @@ export type V2ThreadForkResponse__Thread = { readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadForkResponse__GitInfo | null; + readonly historyMode?: V2ThreadForkResponse__ThreadHistoryMode; readonly id: string; + readonly model?: string | null; readonly modelProvider: string; readonly name?: string | null; + readonly originator?: string | null; readonly parentThreadId?: string | null; readonly path?: string | null; readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: V2ThreadForkResponse__ReasoningEffort | null; readonly recencyAt?: number | null; + readonly section?: V2ThreadForkResponse__ThreadSection | null; + readonly sectionEnteredAt?: number | null; readonly sessionId: string; readonly source: V2ThreadForkResponse__SessionSource; readonly status: V2ThreadForkResponse__ThreadStatus; @@ -34986,9 +44613,27 @@ export const V2ThreadForkResponse__Thread = Schema.Struct({ description: "Optional Git metadata captured when the thread was created.", }), ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadForkResponse__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), id: Schema.String.annotate({ description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), modelProvider: Schema.String.annotate({ description: "Model provider used for this thread (for example, 'openai').", }), @@ -34998,6 +44643,15 @@ export const V2ThreadForkResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), parentThreadId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -35016,6 +44670,18 @@ export const V2ThreadForkResponse__Thread = Schema.Struct({ preview: Schema.String.annotate({ description: "Usually the first user message in the thread, if available.", }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), recencyAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -35025,6 +44691,20 @@ export const V2ThreadForkResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + section: Schema.optionalKey( + Schema.Union([V2ThreadForkResponse__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", + }), + ), + sectionEnteredAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp in seconds when the thread entered its current section.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), @@ -35043,7 +44723,7 @@ export const V2ThreadForkResponse__Thread = Schema.Struct({ ), turns: Schema.Array(V2ThreadForkResponse__Turn).annotate({ description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", @@ -35060,13 +44740,20 @@ export type V2ThreadListResponse__Thread = { readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadListResponse__GitInfo | null; + readonly historyMode?: V2ThreadListResponse__ThreadHistoryMode; readonly id: string; + readonly model?: string | null; readonly modelProvider: string; readonly name?: string | null; + readonly originator?: string | null; readonly parentThreadId?: string | null; readonly path?: string | null; readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: V2ThreadListResponse__ReasoningEffort | null; readonly recencyAt?: number | null; + readonly section?: V2ThreadListResponse__ThreadSection | null; + readonly sectionEnteredAt?: number | null; readonly sessionId: string; readonly source: V2ThreadListResponse__SessionSource; readonly status: V2ThreadListResponse__ThreadStatus; @@ -35119,9 +44806,27 @@ export const V2ThreadListResponse__Thread = Schema.Struct({ description: "Optional Git metadata captured when the thread was created.", }), ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadListResponse__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), id: Schema.String.annotate({ description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), modelProvider: Schema.String.annotate({ description: "Model provider used for this thread (for example, 'openai').", }), @@ -35131,6 +44836,15 @@ export const V2ThreadListResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), parentThreadId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -35149,6 +44863,18 @@ export const V2ThreadListResponse__Thread = Schema.Struct({ preview: Schema.String.annotate({ description: "Usually the first user message in the thread, if available.", }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), recencyAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -35158,6 +44884,20 @@ export const V2ThreadListResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + section: Schema.optionalKey( + Schema.Union([V2ThreadListResponse__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", + }), + ), + sectionEnteredAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp in seconds when the thread entered its current section.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), @@ -35176,7 +44916,7 @@ export const V2ThreadListResponse__Thread = Schema.Struct({ ), turns: Schema.Array(V2ThreadListResponse__Turn).annotate({ description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", @@ -35193,13 +44933,20 @@ export type V2ThreadMetadataUpdateResponse__Thread = { readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadMetadataUpdateResponse__GitInfo | null; + readonly historyMode?: V2ThreadMetadataUpdateResponse__ThreadHistoryMode; readonly id: string; + readonly model?: string | null; readonly modelProvider: string; readonly name?: string | null; + readonly originator?: string | null; readonly parentThreadId?: string | null; readonly path?: string | null; readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: V2ThreadMetadataUpdateResponse__ReasoningEffort | null; readonly recencyAt?: number | null; + readonly section?: V2ThreadMetadataUpdateResponse__ThreadSection | null; + readonly sectionEnteredAt?: number | null; readonly sessionId: string; readonly source: V2ThreadMetadataUpdateResponse__SessionSource; readonly status: V2ThreadMetadataUpdateResponse__ThreadStatus; @@ -35252,9 +44999,27 @@ export const V2ThreadMetadataUpdateResponse__Thread = Schema.Struct({ description: "Optional Git metadata captured when the thread was created.", }), ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), id: Schema.String.annotate({ description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), modelProvider: Schema.String.annotate({ description: "Model provider used for this thread (for example, 'openai').", }), @@ -35264,6 +45029,210 @@ export const V2ThreadMetadataUpdateResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), + parentThreadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "The ID of the parent thread. This will only be set if this thread is a subagent.", + }), + Schema.Null, + ]), + ), + path: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "[UNSTABLE] Path to the thread on disk." }), + Schema.Null, + ]), + ), + preview: Schema.String.annotate({ + description: "Usually the first user message in the thread, if available.", + }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), + recencyAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp (in seconds) used for thread recency ordering.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + section: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", + }), + ), + sectionEnteredAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp in seconds when the thread entered its current section.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), + sessionId: Schema.String.annotate({ + description: "Session id shared by threads that belong to the same session tree.", + }), + source: Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__SessionSource, + ).annotate({ + description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", + }), + status: Schema.suspend( + (): Schema.Codec => + V2ThreadMetadataUpdateResponse__ThreadStatus, + ).annotate({ description: "Current runtime status for the thread." }), + threadSource: Schema.optionalKey( + Schema.Union([V2ThreadMetadataUpdateResponse__ThreadSource, Schema.Null]).annotate({ + description: "Optional analytics source classification for this thread.", + }), + ), + turns: Schema.Array(V2ThreadMetadataUpdateResponse__Turn).annotate({ + description: + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + }), + updatedAt: Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the thread was last updated.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), +}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__Thread" }); + +export type V2ThreadReadResponse__Thread = { + readonly agentNickname?: string | null; + readonly agentRole?: string | null; + readonly cliVersion: string; + readonly createdAt: number; + readonly cwd: V2ThreadReadResponse__AbsolutePathBuf; + readonly ephemeral: boolean; + readonly forkedFromId?: string | null; + readonly gitInfo?: V2ThreadReadResponse__GitInfo | null; + readonly historyMode?: V2ThreadReadResponse__ThreadHistoryMode; + readonly id: string; + readonly model?: string | null; + readonly modelProvider: string; + readonly name?: string | null; + readonly originator?: string | null; + readonly parentThreadId?: string | null; + readonly path?: string | null; + readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: V2ThreadReadResponse__ReasoningEffort | null; + readonly recencyAt?: number | null; + readonly section?: V2ThreadReadResponse__ThreadSection | null; + readonly sectionEnteredAt?: number | null; + readonly sessionId: string; + readonly source: V2ThreadReadResponse__SessionSource; + readonly status: V2ThreadReadResponse__ThreadStatus; + readonly threadSource?: V2ThreadReadResponse__ThreadSource | null; + readonly turns: ReadonlyArray; + readonly updatedAt: number; +}; +export const V2ThreadReadResponse__Thread = Schema.Struct({ + agentNickname: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional random unique nickname assigned to an AgentControl-spawned sub-agent.", + }), + Schema.Null, + ]), + ), + agentRole: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.", + }), + Schema.Null, + ]), + ), + cliVersion: Schema.String.annotate({ + description: "Version of the CLI that created the thread.", + }), + createdAt: Schema.Number.annotate({ + description: "Unix timestamp (in seconds) when the thread was created.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + cwd: Schema.suspend( + (): Schema.Codec => + V2ThreadReadResponse__AbsolutePathBuf, + ).annotate({ description: "Working directory captured for the thread." }), + ephemeral: Schema.Boolean.annotate({ + description: "Whether the thread is ephemeral and should not be materialized on disk.", + }), + forkedFromId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Source thread id when this thread was created by forking another thread.", + }), + Schema.Null, + ]), + ), + gitInfo: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__GitInfo, Schema.Null]).annotate({ + description: "Optional Git metadata captured when the thread was created.", + }), + ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadReadResponse__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), + id: Schema.String.annotate({ + description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", + }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), + modelProvider: Schema.String.annotate({ + description: "Model provider used for this thread (for example, 'openai').", + }), + name: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "Optional user-facing thread title." }), + Schema.Null, + ]), + ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), parentThreadId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -35282,6 +45251,18 @@ export const V2ThreadMetadataUpdateResponse__Thread = Schema.Struct({ preview: Schema.String.annotate({ description: "Usually the first user message in the thread, if available.", }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), recencyAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -35291,136 +45272,15 @@ export const V2ThreadMetadataUpdateResponse__Thread = Schema.Struct({ Schema.Null, ]), ), - sessionId: Schema.String.annotate({ - description: "Session id shared by threads that belong to the same session tree.", - }), - source: Schema.suspend( - (): Schema.Codec => - V2ThreadMetadataUpdateResponse__SessionSource, - ).annotate({ - description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", - }), - status: Schema.suspend( - (): Schema.Codec => - V2ThreadMetadataUpdateResponse__ThreadStatus, - ).annotate({ description: "Current runtime status for the thread." }), - threadSource: Schema.optionalKey( - Schema.Union([V2ThreadMetadataUpdateResponse__ThreadSource, Schema.Null]).annotate({ - description: "Optional analytics source classification for this thread.", + section: Schema.optionalKey( + Schema.Union([V2ThreadReadResponse__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", }), ), - turns: Schema.Array(V2ThreadMetadataUpdateResponse__Turn).annotate({ - description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", - }), - updatedAt: Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the thread was last updated.", - format: "int64", - }).check(Schema.isInt().annotate({ expected: "an integer" })), -}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__Thread" }); - -export type V2ThreadReadResponse__Thread = { - readonly agentNickname?: string | null; - readonly agentRole?: string | null; - readonly cliVersion: string; - readonly createdAt: number; - readonly cwd: V2ThreadReadResponse__AbsolutePathBuf; - readonly ephemeral: boolean; - readonly forkedFromId?: string | null; - readonly gitInfo?: V2ThreadReadResponse__GitInfo | null; - readonly id: string; - readonly modelProvider: string; - readonly name?: string | null; - readonly parentThreadId?: string | null; - readonly path?: string | null; - readonly preview: string; - readonly recencyAt?: number | null; - readonly sessionId: string; - readonly source: V2ThreadReadResponse__SessionSource; - readonly status: V2ThreadReadResponse__ThreadStatus; - readonly threadSource?: V2ThreadReadResponse__ThreadSource | null; - readonly turns: ReadonlyArray; - readonly updatedAt: number; -}; -export const V2ThreadReadResponse__Thread = Schema.Struct({ - agentNickname: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "Optional random unique nickname assigned to an AgentControl-spawned sub-agent.", - }), - Schema.Null, - ]), - ), - agentRole: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.", - }), - Schema.Null, - ]), - ), - cliVersion: Schema.String.annotate({ - description: "Version of the CLI that created the thread.", - }), - createdAt: Schema.Number.annotate({ - description: "Unix timestamp (in seconds) when the thread was created.", - format: "int64", - }).check(Schema.isInt().annotate({ expected: "an integer" })), - cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadReadResponse__AbsolutePathBuf, - ).annotate({ description: "Working directory captured for the thread." }), - ephemeral: Schema.Boolean.annotate({ - description: "Whether the thread is ephemeral and should not be materialized on disk.", - }), - forkedFromId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: "Source thread id when this thread was created by forking another thread.", - }), - Schema.Null, - ]), - ), - gitInfo: Schema.optionalKey( - Schema.Union([V2ThreadReadResponse__GitInfo, Schema.Null]).annotate({ - description: "Optional Git metadata captured when the thread was created.", - }), - ), - id: Schema.String.annotate({ - description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", - }), - modelProvider: Schema.String.annotate({ - description: "Model provider used for this thread (for example, 'openai').", - }), - name: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "Optional user-facing thread title." }), - Schema.Null, - ]), - ), - parentThreadId: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - description: - "The ID of the parent thread. This will only be set if this thread is a subagent.", - }), - Schema.Null, - ]), - ), - path: Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ description: "[UNSTABLE] Path to the thread on disk." }), - Schema.Null, - ]), - ), - preview: Schema.String.annotate({ - description: "Usually the first user message in the thread, if available.", - }), - recencyAt: Schema.optionalKey( + sectionEnteredAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ - description: "Unix timestamp (in seconds) used for thread recency ordering.", + description: "Unix timestamp in seconds when the thread entered its current section.", format: "int64", }).check(Schema.isInt().annotate({ expected: "an integer" })), Schema.Null, @@ -35444,7 +45304,7 @@ export const V2ThreadReadResponse__Thread = Schema.Struct({ ), turns: Schema.Array(V2ThreadReadResponse__Turn).annotate({ description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", @@ -35461,13 +45321,20 @@ export type V2ThreadResumeResponse__Thread = { readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadResumeResponse__GitInfo | null; + readonly historyMode?: V2ThreadResumeResponse__ThreadHistoryMode; readonly id: string; + readonly model?: string | null; readonly modelProvider: string; readonly name?: string | null; + readonly originator?: string | null; readonly parentThreadId?: string | null; readonly path?: string | null; readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: V2ThreadResumeResponse__ReasoningEffort | null; readonly recencyAt?: number | null; + readonly section?: V2ThreadResumeResponse__ThreadSection | null; + readonly sectionEnteredAt?: number | null; readonly sessionId: string; readonly source: V2ThreadResumeResponse__SessionSource; readonly status: V2ThreadResumeResponse__ThreadStatus; @@ -35520,9 +45387,27 @@ export const V2ThreadResumeResponse__Thread = Schema.Struct({ description: "Optional Git metadata captured when the thread was created.", }), ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadResumeResponse__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), id: Schema.String.annotate({ description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), modelProvider: Schema.String.annotate({ description: "Model provider used for this thread (for example, 'openai').", }), @@ -35532,6 +45417,15 @@ export const V2ThreadResumeResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), parentThreadId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -35550,6 +45444,18 @@ export const V2ThreadResumeResponse__Thread = Schema.Struct({ preview: Schema.String.annotate({ description: "Usually the first user message in the thread, if available.", }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), recencyAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -35559,6 +45465,20 @@ export const V2ThreadResumeResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + section: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", + }), + ), + sectionEnteredAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp in seconds when the thread entered its current section.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), @@ -35578,7 +45498,7 @@ export const V2ThreadResumeResponse__Thread = Schema.Struct({ ), turns: Schema.Array(V2ThreadResumeResponse__Turn).annotate({ description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", @@ -35586,30 +45506,37 @@ export const V2ThreadResumeResponse__Thread = Schema.Struct({ }).check(Schema.isInt().annotate({ expected: "an integer" })), }).annotate({ identifier: "V2ThreadResumeResponse__Thread" }); -export type V2ThreadRollbackResponse__Thread = { +export type V2ThreadRevertResponse__Thread = { readonly agentNickname?: string | null; readonly agentRole?: string | null; readonly cliVersion: string; readonly createdAt: number; - readonly cwd: V2ThreadRollbackResponse__AbsolutePathBuf; + readonly cwd: V2ThreadRevertResponse__AbsolutePathBuf; readonly ephemeral: boolean; readonly forkedFromId?: string | null; - readonly gitInfo?: V2ThreadRollbackResponse__GitInfo | null; + readonly gitInfo?: V2ThreadRevertResponse__GitInfo | null; + readonly historyMode?: V2ThreadRevertResponse__ThreadHistoryMode; readonly id: string; + readonly model?: string | null; readonly modelProvider: string; readonly name?: string | null; + readonly originator?: string | null; readonly parentThreadId?: string | null; readonly path?: string | null; readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: V2ThreadRevertResponse__ReasoningEffort | null; readonly recencyAt?: number | null; + readonly section?: V2ThreadRevertResponse__ThreadSection | null; + readonly sectionEnteredAt?: number | null; readonly sessionId: string; - readonly source: V2ThreadRollbackResponse__SessionSource; - readonly status: V2ThreadRollbackResponse__ThreadStatus; - readonly threadSource?: V2ThreadRollbackResponse__ThreadSource | null; - readonly turns: ReadonlyArray; + readonly source: V2ThreadRevertResponse__SessionSource; + readonly status: V2ThreadRevertResponse__ThreadStatus; + readonly threadSource?: V2ThreadRevertResponse__ThreadSource | null; + readonly turns: ReadonlyArray; readonly updatedAt: number; }; -export const V2ThreadRollbackResponse__Thread = Schema.Struct({ +export const V2ThreadRevertResponse__Thread = Schema.Struct({ agentNickname: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -35635,8 +45562,8 @@ export const V2ThreadRollbackResponse__Thread = Schema.Struct({ format: "int64", }).check(Schema.isInt().annotate({ expected: "an integer" })), cwd: Schema.suspend( - (): Schema.Codec => - V2ThreadRollbackResponse__AbsolutePathBuf, + (): Schema.Codec => + V2ThreadRevertResponse__AbsolutePathBuf, ).annotate({ description: "Working directory captured for the thread." }), ephemeral: Schema.Boolean.annotate({ description: "Whether the thread is ephemeral and should not be materialized on disk.", @@ -35650,13 +45577,31 @@ export const V2ThreadRollbackResponse__Thread = Schema.Struct({ ]), ), gitInfo: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__GitInfo, Schema.Null]).annotate({ + Schema.Union([V2ThreadRevertResponse__GitInfo, Schema.Null]).annotate({ description: "Optional Git metadata captured when the thread was created.", }), ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadRevertResponse__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), id: Schema.String.annotate({ description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), modelProvider: Schema.String.annotate({ description: "Model provider used for this thread (for example, 'openai').", }), @@ -35666,6 +45611,15 @@ export const V2ThreadRollbackResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), parentThreadId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -35684,6 +45638,18 @@ export const V2ThreadRollbackResponse__Thread = Schema.Struct({ preview: Schema.String.annotate({ description: "Usually the first user message in the thread, if available.", }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), recencyAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -35693,33 +45659,46 @@ export const V2ThreadRollbackResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + section: Schema.optionalKey( + Schema.Union([V2ThreadRevertResponse__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", + }), + ), + sectionEnteredAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp in seconds when the thread entered its current section.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), source: Schema.suspend( - (): Schema.Codec => - V2ThreadRollbackResponse__SessionSource, + (): Schema.Codec => + V2ThreadRevertResponse__SessionSource, ).annotate({ description: "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).", }), status: Schema.suspend( - (): Schema.Codec => - V2ThreadRollbackResponse__ThreadStatus, + (): Schema.Codec => V2ThreadRevertResponse__ThreadStatus, ).annotate({ description: "Current runtime status for the thread." }), threadSource: Schema.optionalKey( - Schema.Union([V2ThreadRollbackResponse__ThreadSource, Schema.Null]).annotate({ + Schema.Union([V2ThreadRevertResponse__ThreadSource, Schema.Null]).annotate({ description: "Optional analytics source classification for this thread.", }), ), - turns: Schema.Array(V2ThreadRollbackResponse__Turn).annotate({ + turns: Schema.Array(V2ThreadRevertResponse__Turn).annotate({ description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", format: "int64", }).check(Schema.isInt().annotate({ expected: "an integer" })), -}).annotate({ identifier: "V2ThreadRollbackResponse__Thread" }); +}).annotate({ identifier: "V2ThreadRevertResponse__Thread" }); export type V2ThreadStartedNotification__Thread = { readonly agentNickname?: string | null; @@ -35730,13 +45709,20 @@ export type V2ThreadStartedNotification__Thread = { readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadStartedNotification__GitInfo | null; + readonly historyMode?: V2ThreadStartedNotification__ThreadHistoryMode; readonly id: string; + readonly model?: string | null; readonly modelProvider: string; readonly name?: string | null; + readonly originator?: string | null; readonly parentThreadId?: string | null; readonly path?: string | null; readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: V2ThreadStartedNotification__ReasoningEffort | null; readonly recencyAt?: number | null; + readonly section?: V2ThreadStartedNotification__ThreadSection | null; + readonly sectionEnteredAt?: number | null; readonly sessionId: string; readonly source: V2ThreadStartedNotification__SessionSource; readonly status: V2ThreadStartedNotification__ThreadStatus; @@ -35789,9 +45775,27 @@ export const V2ThreadStartedNotification__Thread = Schema.Struct({ description: "Optional Git metadata captured when the thread was created.", }), ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadStartedNotification__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), id: Schema.String.annotate({ description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), modelProvider: Schema.String.annotate({ description: "Model provider used for this thread (for example, 'openai').", }), @@ -35801,6 +45805,15 @@ export const V2ThreadStartedNotification__Thread = Schema.Struct({ Schema.Null, ]), ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), parentThreadId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -35819,6 +45832,18 @@ export const V2ThreadStartedNotification__Thread = Schema.Struct({ preview: Schema.String.annotate({ description: "Usually the first user message in the thread, if available.", }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), recencyAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -35828,6 +45853,20 @@ export const V2ThreadStartedNotification__Thread = Schema.Struct({ Schema.Null, ]), ), + section: Schema.optionalKey( + Schema.Union([V2ThreadStartedNotification__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", + }), + ), + sectionEnteredAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp in seconds when the thread entered its current section.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), @@ -35848,7 +45887,7 @@ export const V2ThreadStartedNotification__Thread = Schema.Struct({ ), turns: Schema.Array(V2ThreadStartedNotification__Turn).annotate({ description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", @@ -35865,13 +45904,20 @@ export type V2ThreadStartResponse__Thread = { readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadStartResponse__GitInfo | null; + readonly historyMode?: V2ThreadStartResponse__ThreadHistoryMode; readonly id: string; + readonly model?: string | null; readonly modelProvider: string; readonly name?: string | null; + readonly originator?: string | null; readonly parentThreadId?: string | null; readonly path?: string | null; readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: V2ThreadStartResponse__ReasoningEffort | null; readonly recencyAt?: number | null; + readonly section?: V2ThreadStartResponse__ThreadSection | null; + readonly sectionEnteredAt?: number | null; readonly sessionId: string; readonly source: V2ThreadStartResponse__SessionSource; readonly status: V2ThreadStartResponse__ThreadStatus; @@ -35924,9 +45970,27 @@ export const V2ThreadStartResponse__Thread = Schema.Struct({ description: "Optional Git metadata captured when the thread was created.", }), ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadStartResponse__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), id: Schema.String.annotate({ description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), modelProvider: Schema.String.annotate({ description: "Model provider used for this thread (for example, 'openai').", }), @@ -35936,6 +46000,15 @@ export const V2ThreadStartResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), parentThreadId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -35954,6 +46027,18 @@ export const V2ThreadStartResponse__Thread = Schema.Struct({ preview: Schema.String.annotate({ description: "Usually the first user message in the thread, if available.", }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), recencyAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -35963,6 +46048,20 @@ export const V2ThreadStartResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + section: Schema.optionalKey( + Schema.Union([V2ThreadStartResponse__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", + }), + ), + sectionEnteredAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp in seconds when the thread entered its current section.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), @@ -35981,7 +46080,7 @@ export const V2ThreadStartResponse__Thread = Schema.Struct({ ), turns: Schema.Array(V2ThreadStartResponse__Turn).annotate({ description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", @@ -35998,13 +46097,20 @@ export type V2ThreadUnarchiveResponse__Thread = { readonly ephemeral: boolean; readonly forkedFromId?: string | null; readonly gitInfo?: V2ThreadUnarchiveResponse__GitInfo | null; + readonly historyMode?: V2ThreadUnarchiveResponse__ThreadHistoryMode; readonly id: string; + readonly model?: string | null; readonly modelProvider: string; readonly name?: string | null; + readonly originator?: string | null; readonly parentThreadId?: string | null; readonly path?: string | null; readonly preview: string; + readonly projectId: string | null; + readonly reasoningEffort?: V2ThreadUnarchiveResponse__ReasoningEffort | null; readonly recencyAt?: number | null; + readonly section?: V2ThreadUnarchiveResponse__ThreadSection | null; + readonly sectionEnteredAt?: number | null; readonly sessionId: string; readonly source: V2ThreadUnarchiveResponse__SessionSource; readonly status: V2ThreadUnarchiveResponse__ThreadStatus; @@ -36057,9 +46163,27 @@ export const V2ThreadUnarchiveResponse__Thread = Schema.Struct({ description: "Optional Git metadata captured when the thread was created.", }), ), + historyMode: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + V2ThreadUnarchiveResponse__ThreadHistoryMode, + ).annotate({ + description: "Persisted thread history contract selected when this thread was created.", + default: "legacy", + }), + ), id: Schema.String.annotate({ description: "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", }), + model: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.", + }), + Schema.Null, + ]), + ), modelProvider: Schema.String.annotate({ description: "Model provider used for this thread (for example, 'openai').", }), @@ -36069,6 +46193,15 @@ export const V2ThreadUnarchiveResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + originator: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.", + }), + Schema.Null, + ]), + ), parentThreadId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -36087,6 +46220,18 @@ export const V2ThreadUnarchiveResponse__Thread = Schema.Struct({ preview: Schema.String.annotate({ description: "Usually the first user message in the thread, if available.", }), + projectId: Schema.Union([ + Schema.String.annotate({ + description: "Canonical project assignment owned by app-server, if any.", + }), + Schema.Null, + ]), + reasoningEffort: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ReasoningEffort, Schema.Null]).annotate({ + description: + "Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.", + }), + ), recencyAt: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ @@ -36096,6 +46241,20 @@ export const V2ThreadUnarchiveResponse__Thread = Schema.Struct({ Schema.Null, ]), ), + section: Schema.optionalKey( + Schema.Union([V2ThreadUnarchiveResponse__ThreadSection, Schema.Null]).annotate({ + description: "The independently persisted section selected for this thread, if any.", + }), + ), + sectionEnteredAt: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Unix timestamp in seconds when the thread entered its current section.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), sessionId: Schema.String.annotate({ description: "Session id shared by threads that belong to the same session tree.", }), @@ -36116,7 +46275,7 @@ export const V2ThreadUnarchiveResponse__Thread = Schema.Struct({ ), turns: Schema.Array(V2ThreadUnarchiveResponse__Turn).annotate({ description: - "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", }), updatedAt: Schema.Number.annotate({ description: "Unix timestamp (in seconds) when the thread was last updated.", @@ -36156,7 +46315,7 @@ export const ServerNotification__ThreadStartedNotification = Schema.Struct({ export type ServerNotification__GuardianApprovalReviewAction = | { readonly command: string; - readonly cwd: ServerNotification__AbsolutePathBuf; + readonly cwd: ServerNotification__LegacyAppPathString; readonly source: ServerNotification__GuardianCommandSource; readonly type: "command"; } @@ -36168,8 +46327,15 @@ export type ServerNotification__GuardianApprovalReviewAction = readonly type: "execve"; } | { - readonly cwd: ServerNotification__AbsolutePathBuf; - readonly files: ReadonlyArray; + readonly approvalId: string; + readonly cwd: ServerNotification__LegacyAppPathString; + readonly processId: string; + readonly stdin: string; + readonly type: "writeStdin"; + } + | { + readonly cwd: ServerNotification__LegacyAppPathString; + readonly files: ReadonlyArray; readonly type: "applyPatch"; } | { @@ -36196,7 +46362,7 @@ export const ServerNotification__GuardianApprovalReviewAction = Schema.Union( [ Schema.Struct({ command: Schema.String, - cwd: ServerNotification__AbsolutePathBuf, + cwd: ServerNotification__LegacyAppPathString, source: ServerNotification__GuardianCommandSource, type: Schema.Literal("command").annotate({ title: "CommandGuardianApprovalReviewActionType", @@ -36210,8 +46376,20 @@ export const ServerNotification__GuardianApprovalReviewAction = Schema.Union( type: Schema.Literal("execve").annotate({ title: "ExecveGuardianApprovalReviewActionType" }), }).annotate({ title: "ExecveGuardianApprovalReviewAction" }), Schema.Struct({ - cwd: ServerNotification__AbsolutePathBuf, - files: Schema.Array(ServerNotification__AbsolutePathBuf), + approvalId: Schema.String, + cwd: ServerNotification__LegacyAppPathString, + processId: Schema.String, + stdin: Schema.String, + type: Schema.Literal("writeStdin").annotate({ + title: "WriteStdinGuardianApprovalReviewActionType", + }), + }).annotate({ + title: "WriteStdinGuardianApprovalReviewAction", + description: "A child approval for input to an existing command execution item.", + }), + Schema.Struct({ + cwd: ServerNotification__LegacyAppPathString, + files: Schema.Array(ServerNotification__LegacyAppPathString), type: Schema.Literal("applyPatch").annotate({ title: "ApplyPatchGuardianApprovalReviewActionType", }), @@ -36253,7 +46431,7 @@ export const ServerNotification__GuardianApprovalReviewAction = Schema.Union( ).annotate({ identifier: "ServerNotification__GuardianApprovalReviewAction" }); export type ServerRequest__PermissionsRequestApprovalParams = { - readonly cwd: ServerRequest__AbsolutePathBuf; + readonly cwd: ServerRequest__LegacyAppPathString; readonly environmentId?: string | null; readonly itemId: string; readonly permissions: ServerRequest__RequestPermissionProfile; @@ -36263,7 +46441,7 @@ export type ServerRequest__PermissionsRequestApprovalParams = { readonly turnId: string; }; export const ServerRequest__PermissionsRequestApprovalParams = Schema.Struct({ - cwd: ServerRequest__AbsolutePathBuf, + cwd: ServerRequest__LegacyAppPathString, environmentId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), itemId: Schema.String, permissions: ServerRequest__RequestPermissionProfile, @@ -36296,7 +46474,7 @@ export const ServerRequest__McpElicitationSchema = Schema.Struct({ export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalReviewAction = | { readonly command: string; - readonly cwd: V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf; + readonly cwd: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString; readonly source: V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandSource; readonly type: "command"; } @@ -36308,8 +46486,15 @@ export type V2ItemGuardianApprovalReviewCompletedNotification__GuardianApprovalR readonly type: "execve"; } | { - readonly cwd: V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf; - readonly files: ReadonlyArray; + readonly approvalId: string; + readonly cwd: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString; + readonly processId: string; + readonly stdin: string; + readonly type: "writeStdin"; + } + | { + readonly cwd: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString; + readonly files: ReadonlyArray; readonly type: "applyPatch"; } | { @@ -36337,7 +46522,7 @@ export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianApproval [ Schema.Struct({ command: Schema.String, - cwd: V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf, + cwd: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString, source: V2ItemGuardianApprovalReviewCompletedNotification__GuardianCommandSource, type: Schema.Literal("command").annotate({ title: "CommandGuardianApprovalReviewActionType", @@ -36353,8 +46538,20 @@ export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianApproval }), }).annotate({ title: "ExecveGuardianApprovalReviewAction" }), Schema.Struct({ - cwd: V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf, - files: Schema.Array(V2ItemGuardianApprovalReviewCompletedNotification__AbsolutePathBuf), + approvalId: Schema.String, + cwd: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString, + processId: Schema.String, + stdin: Schema.String, + type: Schema.Literal("writeStdin").annotate({ + title: "WriteStdinGuardianApprovalReviewActionType", + }), + }).annotate({ + title: "WriteStdinGuardianApprovalReviewAction", + description: "A child approval for input to an existing command execution item.", + }), + Schema.Struct({ + cwd: V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString, + files: Schema.Array(V2ItemGuardianApprovalReviewCompletedNotification__LegacyAppPathString), type: Schema.Literal("applyPatch").annotate({ title: "ApplyPatchGuardianApprovalReviewActionType", }), @@ -36400,7 +46597,7 @@ export const V2ItemGuardianApprovalReviewCompletedNotification__GuardianApproval export type V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalReviewAction = | { readonly command: string; - readonly cwd: V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf; + readonly cwd: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString; readonly source: V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSource; readonly type: "command"; } @@ -36412,8 +46609,15 @@ export type V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalRev readonly type: "execve"; } | { - readonly cwd: V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf; - readonly files: ReadonlyArray; + readonly approvalId: string; + readonly cwd: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString; + readonly processId: string; + readonly stdin: string; + readonly type: "writeStdin"; + } + | { + readonly cwd: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString; + readonly files: ReadonlyArray; readonly type: "applyPatch"; } | { @@ -36441,7 +46645,7 @@ export const V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalRe [ Schema.Struct({ command: Schema.String, - cwd: V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf, + cwd: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString, source: V2ItemGuardianApprovalReviewStartedNotification__GuardianCommandSource, type: Schema.Literal("command").annotate({ title: "CommandGuardianApprovalReviewActionType", @@ -36457,8 +46661,20 @@ export const V2ItemGuardianApprovalReviewStartedNotification__GuardianApprovalRe }), }).annotate({ title: "ExecveGuardianApprovalReviewAction" }), Schema.Struct({ - cwd: V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf, - files: Schema.Array(V2ItemGuardianApprovalReviewStartedNotification__AbsolutePathBuf), + approvalId: Schema.String, + cwd: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString, + processId: Schema.String, + stdin: Schema.String, + type: Schema.Literal("writeStdin").annotate({ + title: "WriteStdinGuardianApprovalReviewActionType", + }), + }).annotate({ + title: "WriteStdinGuardianApprovalReviewAction", + description: "A child approval for input to an existing command execution item.", + }), + Schema.Struct({ + cwd: V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString, + files: Schema.Array(V2ItemGuardianApprovalReviewStartedNotification__LegacyAppPathString), type: Schema.Literal("applyPatch").annotate({ title: "ApplyPatchGuardianApprovalReviewActionType", }), @@ -36522,7 +46738,7 @@ export const ServerNotification__ItemGuardianApprovalReviewStartedNotification = Schema.Union([ Schema.String.annotate({ description: - "Identifier for the reviewed item or tool call when one exists.\n\nIn most cases, one review maps to one target item. The exceptions are - execve reviews, where a single command may contain multiple execve calls to review (only possible when using the shell_zsh_fork feature) - network policy reviews, where there is no target item\n\nA network call is triggered by a CommandExecution item, so having a target_item_id set to the CommandExecution item would be misleading because the review is about the network call, not the command execution. Therefore, target_item_id is set to None for network policy reviews.", + "Identifier for the reviewed item or tool call when one exists.\n\nIn most cases, one review maps to one target item. The exceptions are - execve reviews, where a single command may contain multiple execve calls to review (only possible when using the shell_zsh_fork feature) - stdin reviews, which refer to the existing parent command item and have a separate approval ID in the action payload - network policy reviews, where there is no target item\n\nA network call is triggered by a CommandExecution item, so having a target_item_id set to the CommandExecution item would be misleading because the review is about the network call, not the command execution. Therefore, target_item_id is set to None for network policy reviews.", }), Schema.Null, ]), @@ -36563,7 +46779,7 @@ export const ServerNotification__ItemGuardianApprovalReviewCompletedNotification Schema.Union([ Schema.String.annotate({ description: - "Identifier for the reviewed item or tool call when one exists.\n\nIn most cases, one review maps to one target item. The exceptions are - execve reviews, where a single command may contain multiple execve calls to review (only possible when using the shell_zsh_fork feature) - network policy reviews, where there is no target item\n\nA network call is triggered by a CommandExecution item, so having a target_item_id set to the CommandExecution item would be misleading because the review is about the network call, not the command execution. Therefore, target_item_id is set to None for network policy reviews.", + "Identifier for the reviewed item or tool call when one exists.\n\nIn most cases, one review maps to one target item. The exceptions are - execve reviews, where a single command may contain multiple execve calls to review (only possible when using the shell_zsh_fork feature) - stdin reviews, which refer to the existing parent command item and have a separate approval ID in the action payload - network policy reviews, where there is no target item\n\nA network call is triggered by a CommandExecution item, so having a target_item_id set to the CommandExecution item would be misleading because the review is about the network call, not the command execution. Therefore, target_item_id is set to None for network policy reviews.", }), Schema.Null, ]), @@ -36595,6 +46811,15 @@ export type ServerRequest__McpServerElicitationRequestParams = readonly mode: "openai/form"; readonly requestedSchema: Schema.Json; } + | { + readonly serverName: string; + readonly threadId: string; + readonly turnId?: string | null; + readonly _meta?: Schema.Json; + readonly message: string; + readonly mode: "openaiForm"; + readonly requestedSchema: Schema.Json; + } | { readonly serverName: string; readonly threadId: string; @@ -36641,6 +46866,23 @@ export const ServerRequest__McpServerElicitationRequestParams = Schema.Union( mode: Schema.Literal("openai/form"), requestedSchema: Schema.Json.annotate({ expected: "JSON value" }), }), + Schema.Struct({ + serverName: Schema.String, + threadId: Schema.String, + turnId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Active Codex turn when this elicitation was observed, if app-server could correlate one.\n\nThis is nullable because MCP models elicitation as a standalone server-to-client request identified by the MCP server request id. It may be triggered during a turn, but turn context is app-server correlation rather than part of the protocol identity of the elicitation itself.", + }), + Schema.Null, + ]), + ), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + message: Schema.String, + mode: Schema.Literal("openaiForm"), + requestedSchema: Schema.Json.annotate({ expected: "JSON value" }), + }), Schema.Struct({ serverName: Schema.String, threadId: Schema.String, @@ -36813,6 +47055,26 @@ export type ClientRequest = readonly method: "thread/metadata/update"; readonly params: ClientRequest__ThreadMetadataUpdateParams; } + | { + readonly id: ClientRequest__RequestId; + readonly method: "thread/attachment/add"; + readonly params: ClientRequest__ThreadAttachmentAddParams; + } + | { + readonly id: ClientRequest__RequestId; + readonly method: "thread/attachment/list"; + readonly params: ClientRequest__ThreadAttachmentListParams; + } + | { + readonly id: ClientRequest__RequestId; + readonly method: "thread/attachment/remove"; + readonly params: ClientRequest__ThreadAttachmentRemoveParams; + } + | { + readonly id: ClientRequest__RequestId; + readonly method: "thread/section/move"; + readonly params: ClientRequest__ThreadSectionMoveParams; + } | { readonly id: ClientRequest__RequestId; readonly method: "thread/unarchive"; @@ -36835,14 +47097,34 @@ export type ClientRequest = } | { readonly id: ClientRequest__RequestId; - readonly method: "thread/rollback"; - readonly params: ClientRequest__ThreadRollbackParams; + readonly method: "thread/revert"; + readonly params: ClientRequest__ThreadRevertParams; } | { readonly id: ClientRequest__RequestId; readonly method: "thread/list"; readonly params: ClientRequest__ThreadListParams; } + | { + readonly id: ClientRequest__RequestId; + readonly method: "threadSection/list"; + readonly params: ClientRequest__ThreadSectionListParams; + } + | { + readonly id: ClientRequest__RequestId; + readonly method: "threadSection/create"; + readonly params: ClientRequest__ThreadSectionCreateParams; + } + | { + readonly id: ClientRequest__RequestId; + readonly method: "threadSection/update"; + readonly params: ClientRequest__ThreadSectionUpdateParams; + } + | { + readonly id: ClientRequest__RequestId; + readonly method: "threadSection/delete"; + readonly params: ClientRequest__ThreadSectionDeleteParams; + } | { readonly id: ClientRequest__RequestId; readonly method: "thread/loaded/list"; @@ -36853,6 +47135,16 @@ export type ClientRequest = readonly method: "thread/read"; readonly params: ClientRequest__ThreadReadParams; } + | { + readonly id: ClientRequest__RequestId; + readonly method: "thread/turns/list"; + readonly params: ClientRequest__ThreadTurnsListParams; + } + | { + readonly id: ClientRequest__RequestId; + readonly method: "thread/items/list"; + readonly params: ClientRequest__ThreadItemsListParams; + } | { readonly id: ClientRequest__RequestId; readonly method: "thread/inject_items"; @@ -36898,6 +47190,11 @@ export type ClientRequest = readonly method: "plugin/installed"; readonly params: ClientRequest__PluginInstalledParams; } + | { + readonly id: ClientRequest__RequestId; + readonly method: "plugin/reconcile"; + readonly params: ClientRequest__PluginReconcileParams; + } | { readonly id: ClientRequest__RequestId; readonly method: "plugin/read"; @@ -37106,7 +47403,7 @@ export type ClientRequest = | { readonly id: ClientRequest__RequestId; readonly method: "account/rateLimits/read"; - readonly params?: null; + readonly params?: ClientRequest__GetAccountRateLimitsParams | null; } | { readonly id: ClientRequest__RequestId; @@ -37116,7 +47413,7 @@ export type ClientRequest = | { readonly id: ClientRequest__RequestId; readonly method: "account/usage/read"; - readonly params?: null; + readonly params?: ClientRequest__GetAccountTokenUsageParams | null; } | { readonly id: ClientRequest__RequestId; @@ -37168,6 +47465,11 @@ export type ClientRequest = readonly method: "externalAgentConfig/import"; readonly params: ClientRequest__ExternalAgentConfigImportParams; } + | { + readonly id: ClientRequest__RequestId; + readonly method: "externalAgentConfig/import/recordHistory"; + readonly params: ClientRequest__ExternalAgentConfigImportHistoryRecordParams; + } | { readonly id: ClientRequest__RequestId; readonly method: "externalAgentConfig/import/readHistories"; @@ -37266,6 +47568,34 @@ export const ClientRequest = Schema.Union( }), params: ClientRequest__ThreadMetadataUpdateParams, }).annotate({ title: "Thread/metadata/updateRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("thread/attachment/add").annotate({ + title: "Thread/attachment/addRequestMethod", + }), + params: ClientRequest__ThreadAttachmentAddParams, + }).annotate({ title: "Thread/attachment/addRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("thread/attachment/list").annotate({ + title: "Thread/attachment/listRequestMethod", + }), + params: ClientRequest__ThreadAttachmentListParams, + }).annotate({ title: "Thread/attachment/listRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("thread/attachment/remove").annotate({ + title: "Thread/attachment/removeRequestMethod", + }), + params: ClientRequest__ThreadAttachmentRemoveParams, + }).annotate({ title: "Thread/attachment/removeRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("thread/section/move").annotate({ + title: "Thread/section/moveRequestMethod", + }), + params: ClientRequest__ThreadSectionMoveParams, + }).annotate({ title: "Thread/section/moveRequest" }), Schema.Struct({ id: ClientRequest__RequestId, method: Schema.Literal("thread/unarchive").annotate({ @@ -37296,14 +47626,42 @@ export const ClientRequest = Schema.Union( }).annotate({ title: "Thread/approveGuardianDeniedActionRequest" }), Schema.Struct({ id: ClientRequest__RequestId, - method: Schema.Literal("thread/rollback").annotate({ title: "Thread/rollbackRequestMethod" }), - params: ClientRequest__ThreadRollbackParams, - }).annotate({ title: "Thread/rollbackRequest" }), + method: Schema.Literal("thread/revert").annotate({ title: "Thread/revertRequestMethod" }), + params: ClientRequest__ThreadRevertParams, + }).annotate({ title: "Thread/revertRequest" }), Schema.Struct({ id: ClientRequest__RequestId, method: Schema.Literal("thread/list").annotate({ title: "Thread/listRequestMethod" }), params: ClientRequest__ThreadListParams, }).annotate({ title: "Thread/listRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("threadSection/list").annotate({ + title: "ThreadSection/listRequestMethod", + }), + params: ClientRequest__ThreadSectionListParams, + }).annotate({ title: "ThreadSection/listRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("threadSection/create").annotate({ + title: "ThreadSection/createRequestMethod", + }), + params: ClientRequest__ThreadSectionCreateParams, + }).annotate({ title: "ThreadSection/createRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("threadSection/update").annotate({ + title: "ThreadSection/updateRequestMethod", + }), + params: ClientRequest__ThreadSectionUpdateParams, + }).annotate({ title: "ThreadSection/updateRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("threadSection/delete").annotate({ + title: "ThreadSection/deleteRequestMethod", + }), + params: ClientRequest__ThreadSectionDeleteParams, + }).annotate({ title: "ThreadSection/deleteRequest" }), Schema.Struct({ id: ClientRequest__RequestId, method: Schema.Literal("thread/loaded/list").annotate({ @@ -37316,6 +47674,20 @@ export const ClientRequest = Schema.Union( method: Schema.Literal("thread/read").annotate({ title: "Thread/readRequestMethod" }), params: ClientRequest__ThreadReadParams, }).annotate({ title: "Thread/readRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("thread/turns/list").annotate({ + title: "Thread/turns/listRequestMethod", + }), + params: ClientRequest__ThreadTurnsListParams, + }).annotate({ title: "Thread/turns/listRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("thread/items/list").annotate({ + title: "Thread/items/listRequestMethod", + }), + params: ClientRequest__ThreadItemsListParams, + }).annotate({ title: "Thread/items/listRequest" }), Schema.Struct({ id: ClientRequest__RequestId, method: Schema.Literal("thread/inject_items").annotate({ @@ -37375,6 +47747,13 @@ export const ClientRequest = Schema.Union( }), params: ClientRequest__PluginInstalledParams, }).annotate({ title: "Plugin/installedRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("plugin/reconcile").annotate({ + title: "Plugin/reconcileRequestMethod", + }), + params: ClientRequest__PluginReconcileParams, + }).annotate({ title: "Plugin/reconcileRequest" }), Schema.Struct({ id: ClientRequest__RequestId, method: Schema.Literal("plugin/read").annotate({ title: "Plugin/readRequestMethod" }), @@ -37631,7 +48010,9 @@ export const ClientRequest = Schema.Union( method: Schema.Literal("account/rateLimits/read").annotate({ title: "Account/rateLimits/readRequestMethod", }), - params: Schema.optionalKey(Schema.Null), + params: Schema.optionalKey( + Schema.Union([ClientRequest__GetAccountRateLimitsParams, Schema.Null]), + ), }).annotate({ title: "Account/rateLimits/readRequest" }), Schema.Struct({ id: ClientRequest__RequestId, @@ -37645,7 +48026,9 @@ export const ClientRequest = Schema.Union( method: Schema.Literal("account/usage/read").annotate({ title: "Account/usage/readRequestMethod", }), - params: Schema.optionalKey(Schema.Null), + params: Schema.optionalKey( + Schema.Union([ClientRequest__GetAccountTokenUsageParams, Schema.Null]), + ), }).annotate({ title: "Account/usage/readRequest" }), Schema.Struct({ id: ClientRequest__RequestId, @@ -37724,6 +48107,13 @@ export const ClientRequest = Schema.Union( }), params: ClientRequest__ExternalAgentConfigImportParams, }).annotate({ title: "ExternalAgentConfig/importRequest" }), + Schema.Struct({ + id: ClientRequest__RequestId, + method: Schema.Literal("externalAgentConfig/import/recordHistory").annotate({ + title: "ExternalAgentConfig/import/recordHistoryRequestMethod", + }), + params: ClientRequest__ExternalAgentConfigImportHistoryRecordParams, + }).annotate({ title: "ExternalAgentConfig/import/recordHistoryRequest" }), Schema.Struct({ id: ClientRequest__RequestId, method: Schema.Literal("externalAgentConfig/import/readHistories").annotate({ @@ -37791,6 +48181,16 @@ export const ClientRequest__CollaborationMode = Schema.Struct({ settings: ClientRequest__Settings, }).annotate({ description: "Collaboration mode for a Codex session." }); +export type ClientRequest__CyberAccessProgram = "standard" | "daybreakBlue" | "daybreakRed"; +export const ClientRequest__CyberAccessProgram = Schema.Literals([ + "standard", + "daybreakBlue", + "daybreakRed", +]).annotate({ + description: + "Requested cyber treatment for a ChatGPT-authenticated Codex turn. Authorization and model-tier restrictions remain server-owned.", +}); + export type ClientRequest__DynamicToolSpec = | { readonly deferLoading?: boolean; @@ -37839,6 +48239,13 @@ export const ClientRequest__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); +export type ClientRequest__PluginSearchScope = "global" | "workspace" | "personal"; +export const ClientRequest__PluginSearchScope = Schema.Literals([ + "global", + "workspace", + "personal", +]); + export type ClientRequest__ProcessTerminalSize = { readonly cols: number; readonly rows: number }; export const ClientRequest__ProcessTerminalSize = Schema.Struct({ cols: Schema.Number.annotate({ @@ -37859,6 +48266,12 @@ export const ClientRequest__ProcessTerminalSize = Schema.Struct({ ), }).annotate({ description: "PTY size in character cells for `process/spawn` PTY sessions." }); +export type ClientRequest__ProjectRoot = { readonly path: ClientRequest__AbsolutePathBuf }; +export const ClientRequest__ProjectRoot = Schema.Struct({ path: ClientRequest__AbsolutePathBuf }); + +export type ClientRequest__ProjectSortKey = "position" | "recencyAt"; +export const ClientRequest__ProjectSortKey = Schema.Literals(["position", "recencyAt"]); + export type ClientRequest__RealtimeConversationVersion = "v1" | "v2" | "v3"; export const ClientRequest__RealtimeConversationVersion = Schema.Literals(["v1", "v2", "v3"]); @@ -37953,6 +48366,7 @@ export type ClientRequest__ResponseItem = | { readonly arguments: string; readonly call_id: string; + readonly encrypted_function_args?: ReadonlyArray | null; readonly id?: string | null; readonly internal_chat_message_metadata_passthrough?: ClientRequest__InternalChatMessageMetadataPassthrough | null; readonly name: string; @@ -37969,9 +48383,11 @@ export type ClientRequest__ResponseItem = readonly type: "tool_search_call"; } | { - readonly call_id: string; + readonly call_id?: string | null; readonly id?: string | null; readonly internal_chat_message_metadata_passthrough?: ClientRequest__InternalChatMessageMetadataPassthrough | null; + readonly name?: string | null; + readonly namespace?: string | null; readonly output: ClientRequest__FunctionCallOutputBody; readonly type: "function_call_output"; } @@ -38023,6 +48439,10 @@ export type ClientRequest__ResponseItem = readonly internal_chat_message_metadata_passthrough?: ClientRequest__InternalChatMessageMetadataPassthrough | null; readonly type: "compaction"; } + | { + readonly reasoning: ClientRequest__ConfigurationReasoning; + readonly type: "configuration_update"; + } | { readonly type: "compaction_trigger" } | { readonly encrypted_content?: string | null; @@ -38092,6 +48512,9 @@ export const ClientRequest__ResponseItem = Schema.Union( Schema.Struct({ arguments: Schema.String, call_id: Schema.String, + encrypted_function_args: Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]), + ), id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ClientRequest__InternalChatMessageMetadataPassthrough, Schema.Null]), @@ -38114,11 +48537,13 @@ export const ClientRequest__ResponseItem = Schema.Union( }), }).annotate({ title: "ToolSearchCallResponseItem" }), Schema.Struct({ - call_id: Schema.String, + call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([ClientRequest__InternalChatMessageMetadataPassthrough, Schema.Null]), ), + name: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), output: ClientRequest__FunctionCallOutputBody, type: Schema.Literal("function_call_output").annotate({ title: "FunctionCallOutputResponseItemType", @@ -38194,6 +48619,15 @@ export const ClientRequest__ResponseItem = Schema.Union( ), type: Schema.Literal("compaction").annotate({ title: "CompactionResponseItemType" }), }).annotate({ title: "CompactionResponseItem" }), + Schema.Struct({ + reasoning: ClientRequest__ConfigurationReasoning, + type: Schema.Literal("configuration_update").annotate({ + title: "ConfigurationUpdateResponseItemType", + }), + }).annotate({ + title: "ConfigurationUpdateResponseItem", + description: "A durable input control interpreted by the backend at its position in history.", + }), Schema.Struct({ type: Schema.Literal("compaction_trigger").annotate({ title: "CompactionTriggerResponseItemType", @@ -38285,7 +48719,8 @@ export const ClientRequest__ThreadRealtimeInitialItem = Schema.Struct({ export type ClientRequest__ThreadRealtimeStartTransport = | { readonly type: "websocket" } - | { readonly sdp: string; readonly type: "webrtc" }; + | { readonly sdp: string; readonly type: "webrtc" } + | { readonly callId: string; readonly type: "existingCall" }; export const ClientRequest__ThreadRealtimeStartTransport = Schema.Union( [ Schema.Struct({ @@ -38300,6 +48735,14 @@ export const ClientRequest__ThreadRealtimeStartTransport = Schema.Union( }), type: Schema.Literal("webrtc").annotate({ title: "WebrtcThreadRealtimeStartTransportType" }), }).annotate({ title: "WebrtcThreadRealtimeStartTransport" }), + Schema.Struct({ + callId: Schema.String.annotate({ + description: "Identifier of a realtime call already created and negotiated by the client.", + }), + type: Schema.Literal("existingCall").annotate({ + title: "ExistingCallThreadRealtimeStartTransportType", + }), + }).annotate({ title: "ExistingCallThreadRealtimeStartTransport" }), ], { mode: "oneOf" }, ).annotate({ description: "EXPERIMENTAL - transport used by thread realtime." }); @@ -38334,6 +48777,13 @@ export const ClientRequest__ThreadResumeInitialTurnsPageParams = Schema.Struct({ ), }); +export type ClientRequest__ThreadSearchSortKey = "created_at" | "updated_at" | "recency_at"; +export const ClientRequest__ThreadSearchSortKey = Schema.Literals([ + "created_at", + "updated_at", + "recency_at", +]); + export type ClientRequest__TurnEnvironmentParams = { readonly cwd: ClientRequest__LegacyAppPathString; readonly environmentId: string; @@ -38359,6 +48809,7 @@ export type CommandExecutionRequestApprovalParams = { readonly cwd?: CommandExecutionRequestApprovalParams__LegacyAppPathString | null; readonly environmentId?: string | null; readonly itemId: string; + readonly kind?: CommandExecutionRequestApprovalParams__CommandExecutionApprovalKind; readonly networkApprovalContext?: CommandExecutionRequestApprovalParams__NetworkApprovalContext | null; readonly proposedExecpolicyAmendment?: ReadonlyArray | null; readonly proposedNetworkPolicyAmendments?: ReadonlyArray | null; @@ -38372,7 +48823,7 @@ export const CommandExecutionRequestApprovalParams = Schema.Struct({ Schema.Union([ Schema.String.annotate({ description: - "Unique identifier for this specific approval callback.\n\nFor regular shell/unified_exec approvals, this is null.\n\nFor zsh-exec-bridge subcommand approvals, multiple callbacks can belong to one parent `itemId`, so `approvalId` is a distinct opaque callback id (a UUID) used to disambiguate routing.", + "Unique identifier for this specific approval callback.\n\nFor regular shell/unified_exec approvals, this is null.\n\nFor zsh-exec-bridge subcommand approvals, multiple callbacks can belong to one parent `itemId`, so `approvalId` is a distinct opaque callback id (a UUID) used to disambiguate routing. Stdin approvals also use a distinct callback id; inspect `kind` to distinguish them.", }), Schema.Null, ]), @@ -38404,6 +48855,15 @@ export const CommandExecutionRequestApprovalParams = Schema.Struct({ ]), ), itemId: Schema.String, + kind: Schema.optionalKey( + Schema.suspend( + (): Schema.Codec => + CommandExecutionRequestApprovalParams__CommandExecutionApprovalKind, + ).annotate({ + description: "Kind of action under review. Defaults to `command` for older servers.", + default: "command", + }), + ), networkApprovalContext: Schema.optionalKey( Schema.Union([ CommandExecutionRequestApprovalParams__NetworkApprovalContext, @@ -38797,6 +49257,15 @@ export type McpServerElicitationRequestParams = readonly mode: "openai/form"; readonly requestedSchema: Schema.Json; } + | { + readonly serverName: string; + readonly threadId: string; + readonly turnId?: string | null; + readonly _meta?: Schema.Json; + readonly message: string; + readonly mode: "openaiForm"; + readonly requestedSchema: Schema.Json; + } | { readonly serverName: string; readonly threadId: string; @@ -38843,6 +49312,23 @@ export const McpServerElicitationRequestParams = Schema.Union( mode: Schema.Literal("openai/form"), requestedSchema: Schema.Json.annotate({ expected: "JSON value" }), }), + Schema.Struct({ + serverName: Schema.String, + threadId: Schema.String, + turnId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Active Codex turn when this elicitation was observed, if app-server could correlate one.\n\nThis is nullable because MCP models elicitation as a standalone server-to-client request identified by the MCP server request id. It may be triggered during a turn, but turn context is app-server correlation rather than part of the protocol identity of the elicitation itself.", + }), + Schema.Null, + ]), + ), + _meta: Schema.optionalKey(Schema.Json.annotate({ expected: "JSON value" })), + message: Schema.String, + mode: Schema.Literal("openaiForm"), + requestedSchema: Schema.Json.annotate({ expected: "JSON value" }), + }), Schema.Struct({ serverName: Schema.String, threadId: Schema.String, @@ -38888,7 +49374,7 @@ export const McpServerElicitationRequestResponse = Schema.Struct({ }).annotate({ title: "McpServerElicitationRequestResponse" }); export type PermissionsRequestApprovalParams = { - readonly cwd: PermissionsRequestApprovalParams__AbsolutePathBuf; + readonly cwd: PermissionsRequestApprovalParams__LegacyAppPathString; readonly environmentId?: string | null; readonly itemId: string; readonly permissions: PermissionsRequestApprovalParams__RequestPermissionProfile; @@ -38898,7 +49384,7 @@ export type PermissionsRequestApprovalParams = { readonly turnId: string; }; export const PermissionsRequestApprovalParams = Schema.Struct({ - cwd: PermissionsRequestApprovalParams__AbsolutePathBuf, + cwd: PermissionsRequestApprovalParams__LegacyAppPathString, environmentId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), itemId: Schema.String, permissions: PermissionsRequestApprovalParams__RequestPermissionProfile, @@ -38979,6 +49465,11 @@ export type ServerNotification = readonly method: "thread/closed"; readonly params: ServerNotification__ThreadClosedNotification; } + | { + readonly emittedAtMs?: number; + readonly method: "thread/reverted"; + readonly params: ServerNotification__ThreadRevertedNotification; + } | { readonly emittedAtMs?: number; readonly method: "skills/changed"; @@ -38989,6 +49480,11 @@ export type ServerNotification = readonly method: "thread/name/updated"; readonly params: ServerNotification__ThreadNameUpdatedNotification; } + | { + readonly emittedAtMs?: number; + readonly method: "thread/attachment/updated"; + readonly params: ServerNotification__ThreadAttachmentUpdatedNotification; + } | { readonly emittedAtMs?: number; readonly method: "thread/goal/updated"; @@ -38999,6 +49495,21 @@ export type ServerNotification = readonly method: "thread/goal/cleared"; readonly params: ServerNotification__ThreadGoalClearedNotification; } + | { + readonly emittedAtMs?: number; + readonly method: "thread/queue/changed"; + readonly params: ServerNotification__ThreadQueueChangedNotification; + } + | { + readonly emittedAtMs?: number; + readonly method: "project/changed"; + readonly params: ServerNotification__ProjectChangedNotification; + } + | { + readonly emittedAtMs?: number; + readonly method: "thread/project/updated"; + readonly params: ServerNotification__ThreadProjectUpdatedNotification; + } | { readonly emittedAtMs?: number; readonly method: "thread/environment/connected"; @@ -39064,6 +49575,11 @@ export type ServerNotification = readonly method: "item/autoApprovalReview/completed"; readonly params: ServerNotification__ItemGuardianApprovalReviewCompletedNotification; } + | { + readonly emittedAtMs?: number; + readonly method: "autoApprovalReview/strictReviewRequired"; + readonly params: ServerNotification__StrictReviewRequiredNotification; + } | { readonly emittedAtMs?: number; readonly method: "item/completed"; @@ -39134,6 +49650,11 @@ export type ServerNotification = readonly method: "mcpServer/startupStatus/updated"; readonly params: ServerNotification__McpServerStatusUpdatedNotification; } + | { + readonly emittedAtMs?: number; + readonly method: "mcpServer/event/stream/notification"; + readonly params: ServerNotification__McpServerEventStreamNotification; + } | { readonly emittedAtMs?: number; readonly method: "account/updated"; @@ -39199,6 +49720,16 @@ export type ServerNotification = readonly method: "model/verification"; readonly params: ServerNotification__ModelVerificationNotification; } + | { + readonly emittedAtMs?: number; + readonly method: "modelProvider/authRecoveryStarted"; + readonly params: ServerNotification__AuthRecoveryNotification; + } + | { + readonly emittedAtMs?: number; + readonly method: "modelProvider/authRecoveryCompleted"; + readonly params: ServerNotification__AuthRecoveryNotification; + } | { readonly emittedAtMs?: number; readonly method: "turn/moderationMetadata"; @@ -39249,6 +49780,21 @@ export type ServerNotification = readonly method: "thread/realtime/itemAdded"; readonly params: ServerNotification__ThreadRealtimeItemAddedNotification; } + | { + readonly emittedAtMs?: number; + readonly method: "thread/realtime/item/started"; + readonly params: ServerNotification__ThreadRealtimeItemStartedNotification; + } + | { + readonly emittedAtMs?: number; + readonly method: "thread/realtime/item/transcript/delta"; + readonly params: ServerNotification__ThreadRealtimeItemTranscriptDeltaNotification; + } + | { + readonly emittedAtMs?: number; + readonly method: "thread/realtime/item/completed"; + readonly params: ServerNotification__ThreadRealtimeItemCompletedNotification; + } | { readonly emittedAtMs?: number; readonly method: "thread/realtime/transcript/delta"; @@ -39385,6 +49931,19 @@ export const ServerNotification = Schema.Union( }), params: ServerNotification__ThreadClosedNotification, }).annotate({ title: "Thread/closedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("thread/reverted").annotate({ + title: "Thread/revertedNotificationMethod", + }), + params: ServerNotification__ThreadRevertedNotification, + }).annotate({ title: "Thread/revertedNotification" }), Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ @@ -39411,6 +49970,19 @@ export const ServerNotification = Schema.Union( }), params: ServerNotification__ThreadNameUpdatedNotification, }).annotate({ title: "Thread/name/updatedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("thread/attachment/updated").annotate({ + title: "Thread/attachment/updatedNotificationMethod", + }), + params: ServerNotification__ThreadAttachmentUpdatedNotification, + }).annotate({ title: "Thread/attachment/updatedNotification" }), Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ @@ -39437,6 +50009,45 @@ export const ServerNotification = Schema.Union( }), params: ServerNotification__ThreadGoalClearedNotification, }).annotate({ title: "Thread/goal/clearedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("thread/queue/changed").annotate({ + title: "Thread/queue/changedNotificationMethod", + }), + params: ServerNotification__ThreadQueueChangedNotification, + }).annotate({ title: "Thread/queue/changedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("project/changed").annotate({ + title: "Project/changedNotificationMethod", + }), + params: ServerNotification__ProjectChangedNotification, + }).annotate({ title: "Project/changedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("thread/project/updated").annotate({ + title: "Thread/project/updatedNotificationMethod", + }), + params: ServerNotification__ThreadProjectUpdatedNotification, + }).annotate({ title: "Thread/project/updatedNotification" }), Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ @@ -39600,6 +50211,19 @@ export const ServerNotification = Schema.Union( }), params: ServerNotification__ItemGuardianApprovalReviewCompletedNotification, }).annotate({ title: "Item/autoApprovalReview/completedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("autoApprovalReview/strictReviewRequired").annotate({ + title: "AutoApprovalReview/strictReviewRequiredNotificationMethod", + }), + params: ServerNotification__StrictReviewRequiredNotification, + }).annotate({ title: "AutoApprovalReview/strictReviewRequiredNotification" }), Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ @@ -39799,6 +50423,19 @@ export const ServerNotification = Schema.Union( }), params: ServerNotification__McpServerStatusUpdatedNotification, }).annotate({ title: "McpServer/startupStatus/updatedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("mcpServer/event/stream/notification").annotate({ + title: "McpServer/event/stream/notificationNotificationMethod", + }), + params: ServerNotification__McpServerEventStreamNotification, + }).annotate({ title: "McpServer/event/stream/notificationNotification" }), Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ @@ -39969,6 +50606,32 @@ export const ServerNotification = Schema.Union( }), params: ServerNotification__ModelVerificationNotification, }).annotate({ title: "Model/verificationNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("modelProvider/authRecoveryStarted").annotate({ + title: "ModelProvider/authRecoveryStartedNotificationMethod", + }), + params: ServerNotification__AuthRecoveryNotification, + }).annotate({ title: "ModelProvider/authRecoveryStartedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("modelProvider/authRecoveryCompleted").annotate({ + title: "ModelProvider/authRecoveryCompletedNotificationMethod", + }), + params: ServerNotification__AuthRecoveryNotification, + }).annotate({ title: "ModelProvider/authRecoveryCompletedNotification" }), Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ @@ -40097,6 +50760,45 @@ export const ServerNotification = Schema.Union( }), params: ServerNotification__ThreadRealtimeItemAddedNotification, }).annotate({ title: "Thread/realtime/itemAddedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("thread/realtime/item/started").annotate({ + title: "Thread/realtime/item/startedNotificationMethod", + }), + params: ServerNotification__ThreadRealtimeItemStartedNotification, + }).annotate({ title: "Thread/realtime/item/startedNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("thread/realtime/item/transcript/delta").annotate({ + title: "Thread/realtime/item/transcript/deltaNotificationMethod", + }), + params: ServerNotification__ThreadRealtimeItemTranscriptDeltaNotification, + }).annotate({ title: "Thread/realtime/item/transcript/deltaNotification" }), + Schema.Struct({ + emittedAtMs: Schema.optionalKey( + Schema.Number.annotate({ + description: + "Unix timestamp (in milliseconds) when app-server emitted this notification.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + ), + method: Schema.Literal("thread/realtime/item/completed").annotate({ + title: "Thread/realtime/item/completedNotificationMethod", + }), + params: ServerNotification__ThreadRealtimeItemCompletedNotification, + }).annotate({ title: "Thread/realtime/item/completedNotification" }), Schema.Struct({ emittedAtMs: Schema.optionalKey( Schema.Number.annotate({ @@ -40240,15 +50942,25 @@ export const ServerNotification__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); +export type ServerNotification__ThreadEnvironment = { + readonly cwd: ServerNotification__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const ServerNotification__ThreadEnvironment = Schema.Struct({ + cwd: ServerNotification__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(ServerNotification__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + export type ServerNotification__ThreadExtra = { readonly [x: string]: Schema.Json }; export const ServerNotification__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type ServerNotification__ThreadHistoryMode = "legacy" | "paginated"; -export const ServerNotification__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); - export type ServerRequest = | { readonly id: ServerRequest__RequestId; @@ -40474,6 +51186,7 @@ export const ServerRequest__CommandExecutionApprovalDecision = Schema.Union( export type ToolRequestUserInputParams = { readonly autoResolutionMs?: number | null; + readonly isBlocking: boolean; readonly itemId: string; readonly questions: ReadonlyArray; readonly threadId: string; @@ -40482,7 +51195,10 @@ export type ToolRequestUserInputParams = { export const ToolRequestUserInputParams = Schema.Struct({ autoResolutionMs: Schema.optionalKey( Schema.Union([ - Schema.Number.annotate({ format: "uint64" }) + Schema.Number.annotate({ + description: "@deprecated Use `isBlocking` to decide whether the request should block.", + format: "uint64", + }) .check(Schema.isInt().annotate({ expected: "an integer" })) .check( Schema.isGreaterThanOrEqualTo(0).annotate({ @@ -40492,6 +51208,7 @@ export const ToolRequestUserInputParams = Schema.Struct({ Schema.Null, ]), ), + isBlocking: Schema.Boolean, itemId: Schema.String, questions: Schema.Array(ToolRequestUserInputParams__ToolRequestUserInputQuestion), threadId: Schema.String, @@ -40549,11 +51266,15 @@ export const V1InitializeResponse = Schema.Struct({ export type V2AccountLoginCompletedNotification = { readonly error?: string | null; readonly loginId?: string | null; + readonly onboardingEntrypoint?: V2AccountLoginCompletedNotification__DesktopOnboardingEntrypoint | null; readonly success: boolean; }; export const V2AccountLoginCompletedNotification = Schema.Struct({ error: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), loginId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + onboardingEntrypoint: Schema.optionalKey( + Schema.Union([V2AccountLoginCompletedNotification__DesktopOnboardingEntrypoint, Schema.Null]), + ), success: Schema.Boolean, }).annotate({ title: "AccountLoginCompletedNotification" }); @@ -40703,6 +51424,7 @@ export const V2AppsListResponse = Schema.Struct({ export type V2AppsReadParams = { readonly appIds: ReadonlyArray; readonly includeTools?: boolean; + readonly threadId?: string | null; }; export const V2AppsReadParams = Schema.Struct({ appIds: Schema.Array(Schema.String).annotate({ @@ -40715,6 +51437,14 @@ export const V2AppsReadParams = Schema.Struct({ "When true, include display-only public tool summaries in the returned metadata.", }), ), + threadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional loaded thread id used to evaluate effective app configuration.", + }), + Schema.Null, + ]), + ), }).annotate({ title: "AppsReadParams", description: "EXPERIMENTAL - read metadata for specific apps/connectors.", @@ -40729,6 +51459,19 @@ export const V2AppsReadResponse = Schema.Struct({ missingAppIds: Schema.Array(Schema.String), }).annotate({ title: "AppsReadResponse", description: "EXPERIMENTAL - app/read response." }); +export type V2AuthRecoveryNotification = { + readonly message: string; + readonly provider: string; + readonly threadId: string; + readonly turnId: string; +}; +export const V2AuthRecoveryNotification = Schema.Struct({ + message: Schema.String, + provider: Schema.String, + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ title: "AuthRecoveryNotification" }); + export type V2CancelLoginAccountParams = { readonly loginId: string }; export const V2CancelLoginAccountParams = Schema.Struct({ loginId: Schema.String }).annotate({ title: "CancelLoginAccountParams", @@ -41022,7 +51765,7 @@ export const V2ConfigBatchWriteParams = Schema.Struct({ reloadUserConfig: Schema.optionalKey( Schema.Boolean.annotate({ description: - "When true, hot-reload the updated user config into all loaded threads after writing.", + "When true, hot-reload updated runtime settings into loaded threads after writing. Session-static model, reasoning-effort, Plan-mode reasoning-effort, and service-tier defaults are not reloaded. The deprecated personality setting is also not reloaded.", }), ), }).annotate({ title: "ConfigBatchWriteParams" }); @@ -41060,6 +51803,8 @@ export type V2ConfigReadResponse__AppConfig = { readonly default_tools_enabled?: boolean | null; readonly destructive_enabled?: boolean | null; readonly enabled?: boolean; + readonly links?: V2ConfigReadResponse__AppLinksConfig | null; + readonly omit_tools_from?: ReadonlyArray | null; readonly open_world_enabled?: boolean | null; readonly tools?: V2ConfigReadResponse__AppToolsConfig | null; }; @@ -41073,10 +51818,36 @@ export const V2ConfigReadResponse__AppConfig = Schema.Struct({ default_tools_enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), destructive_enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), enabled: Schema.optionalKey(Schema.Boolean.annotate({ default: true })), + links: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AppLinksConfig, Schema.Null]).annotate({ + description: "Per-account approval settings keyed by link ID.", + }), + ), + omit_tools_from: Schema.optionalKey( + Schema.Union([ + Schema.Array(V2ConfigReadResponse__ToolExposureSurface).annotate({ + description: "Additional model-facing surfaces omitted for this connector's tools.", + }), + Schema.Null, + ]), + ), open_world_enabled: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), tools: Schema.optionalKey(Schema.Union([V2ConfigReadResponse__AppToolsConfig, Schema.Null])), }); +export type V2ConfigReadResponse__AppLinkConfig = { + readonly approvals_reviewer?: V2ConfigReadResponse__ApprovalsReviewer | null; + readonly default_tools_approval_mode?: V2ConfigReadResponse__AppToolApproval | null; +}; +export const V2ConfigReadResponse__AppLinkConfig = Schema.Struct({ + approvals_reviewer: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__ApprovalsReviewer, Schema.Null]), + ), + default_tools_approval_mode: Schema.optionalKey( + Schema.Union([V2ConfigReadResponse__AppToolApproval, Schema.Null]), + ), +}).annotate({ description: "Approval settings for a connected account within an app." }); + export type V2ConfigReadResponse__AppsConfig = { readonly _default?: V2ConfigReadResponse__AppsDefaultConfig | null; }; @@ -41109,6 +51880,15 @@ export const V2ConfigRequirementsReadResponse = Schema.Struct({ ), }).annotate({ title: "ConfigRequirementsReadResponse" }); +export type V2ConfigRequirementsReadResponse__ApplicationRequirements = { + readonly network?: V2ConfigRequirementsReadResponse__ApplicationNetworkRequirements | null; +}; +export const V2ConfigRequirementsReadResponse__ApplicationRequirements = Schema.Struct({ + network: Schema.optionalKey( + Schema.Union([V2ConfigRequirementsReadResponse__ApplicationNetworkRequirements, Schema.Null]), + ), +}); + export type V2ConfigRequirementsReadResponse__ApprovalsReviewer = | "user" | "auto_review" @@ -41123,6 +51903,7 @@ export const V2ConfigRequirementsReadResponse__ApprovalsReviewer = Schema.Litera }); export type V2ConfigRequirementsReadResponse__ManagedHooksRequirements = { + readonly Interrupt?: ReadonlyArray; readonly PermissionRequest: ReadonlyArray; readonly PostCompact: ReadonlyArray; readonly PostToolUse: ReadonlyArray; @@ -41138,6 +51919,11 @@ export type V2ConfigRequirementsReadResponse__ManagedHooksRequirements = { readonly windowsManagedDir?: string | null; }; export const V2ConfigRequirementsReadResponse__ManagedHooksRequirements = Schema.Struct({ + Interrupt: Schema.optionalKey( + Schema.Array(V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup).annotate({ + default: [], + }), + ), PermissionRequest: Schema.Array(V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup), PostCompact: Schema.Array(V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup), PostToolUse: Schema.Array(V2ConfigRequirementsReadResponse__ConfiguredHookMatcherGroup), @@ -41484,6 +52270,8 @@ export const V2ExperimentalFeatureListResponse = Schema.Struct({ export type V2ExternalAgentConfigDetectParams = { readonly cwds?: ReadonlyArray | null; readonly includeHome?: boolean; + readonly maxSessionAgeDays?: number | null; + readonly maxSessions?: number | null; readonly migrationSource?: string | null; readonly source?: string | null; }; @@ -41501,6 +52289,37 @@ export const V2ExternalAgentConfigDetectParams = Schema.Struct({ description: "If true, include detection under the user's home directory.", }), ), + maxSessionAgeDays: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Maximum age in days for detected sessions. Missing values use the default limit.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + maxSessions: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Maximum number of sessions to detect. Missing values use the default limit.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), migrationSource: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -41522,9 +52341,15 @@ export const V2ExternalAgentConfigDetectParams = Schema.Struct({ }).annotate({ title: "ExternalAgentConfigDetectParams" }); export type V2ExternalAgentConfigDetectResponse = { + readonly connectors?: ReadonlyArray; readonly items: ReadonlyArray; }; export const V2ExternalAgentConfigDetectResponse = Schema.Struct({ + connectors: Schema.optionalKey( + Schema.Array( + V2ExternalAgentConfigDetectResponse__ExternalAgentDetectedConnectorCandidate, + ).annotate({ default: [] }), + ), items: Schema.Array(V2ExternalAgentConfigDetectResponse__ExternalAgentConfigMigrationItem), }).annotate({ title: "ExternalAgentConfigDetectResponse" }); @@ -41552,9 +52377,28 @@ export const V2ExternalAgentConfigImportHistoriesReadResponse = Schema.Struct({ ), }).annotate({ title: "ExternalAgentConfigImportHistoriesReadResponse" }); +export type V2ExternalAgentConfigImportHistoryRecordParams = { + readonly itemTypeResults: ReadonlyArray; + readonly providerId: string; +}; +export const V2ExternalAgentConfigImportHistoryRecordParams = Schema.Struct({ + itemTypeResults: Schema.Array( + V2ExternalAgentConfigImportHistoryRecordParams__ExternalAgentConfigImportHistoryRecordTypeResultParams, + ).annotate({ description: "Completed results grouped by imported item type." }), + providerId: Schema.String.annotate({ + description: "Opaque provider identifier for the externally completed import.", + }), +}).annotate({ title: "ExternalAgentConfigImportHistoryRecordParams" }); + +export type V2ExternalAgentConfigImportHistoryRecordResponse = { readonly importId: string }; +export const V2ExternalAgentConfigImportHistoryRecordResponse = Schema.Struct({ + importId: Schema.String, +}).annotate({ title: "ExternalAgentConfigImportHistoryRecordResponse" }); + export type V2ExternalAgentConfigImportParams = { readonly migrationItems: ReadonlyArray; readonly migrationSource?: string | null; + readonly providerId?: string | null; readonly source?: string | null; }; export const V2ExternalAgentConfigImportParams = Schema.Struct({ @@ -41568,6 +52412,15 @@ export const V2ExternalAgentConfigImportParams = Schema.Struct({ Schema.Null, ]), ), + providerId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Opaque provider identifier supplied by the caller for analytics attribution and import history display. This does not select the migration source.", + }), + Schema.Null, + ]), + ), source: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -41613,10 +52466,22 @@ export const V2FeedbackUploadParams = Schema.Struct({ threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ title: "FeedbackUploadParams" }); -export type V2FeedbackUploadResponse = { readonly threadId: string }; -export const V2FeedbackUploadResponse = Schema.Struct({ threadId: Schema.String }).annotate({ - title: "FeedbackUploadResponse", -}); +export type V2FeedbackUploadResponse = { + readonly promptHash?: string | null; + readonly threadId: string; +}; +export const V2FeedbackUploadResponse = Schema.Struct({ + promptHash: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Whitespace-normalized SHA-256 of the session base instructions, matching the uploaded `prompt_hash` tag. Does not include later developer messages. Null when the reported rollout has no prompt metadata.", + }), + Schema.Null, + ]), + ), + threadId: Schema.String, +}).annotate({ title: "FeedbackUploadResponse" }); export type V2FileChangeOutputDeltaNotification = { readonly delta: string; @@ -41906,16 +52771,43 @@ export const V2GetAccountParams = Schema.Struct({ }).annotate({ title: "GetAccountParams" }); export type V2GetAccountRateLimitsResponse = { + readonly accountId?: string | null; + readonly ordinaryUsageAllowed?: boolean | null; readonly rateLimitResetCredits?: V2GetAccountRateLimitsResponse__RateLimitResetCreditsSummary | null; + readonly rateLimitUpsell?: Schema.Json; readonly rateLimits: V2GetAccountRateLimitsResponse__RateLimitSnapshot; readonly rateLimitsByLimitId?: { readonly [x: string]: V2GetAccountRateLimitsResponse__RateLimitSnapshot; } | null; }; export const V2GetAccountRateLimitsResponse = Schema.Struct({ + accountId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Account associated with this usage snapshot, when supplied by the backend.", + }), + Schema.Null, + ]), + ), + ordinaryUsageAllowed: Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ + description: + "Backend permission for ordinary included usage, validated against the active account. Null means unavailable; clients must not infer recovery from percentages or reset times.", + }), + Schema.Null, + ]), + ), rateLimitResetCredits: Schema.optionalKey( Schema.Union([V2GetAccountRateLimitsResponse__RateLimitResetCreditsSummary, Schema.Null]), ), + rateLimitUpsell: Schema.optionalKey( + Schema.Json.annotate({ + expected: "JSON value", + description: + "Optional backend-owned banner from the same usage read. Its nested keys retain the backend's snake_case contract; an absent banner leaves the client's existing UI unchanged.", + }), + ), rateLimits: Schema.suspend( (): Schema.Codec => V2GetAccountRateLimitsResponse__RateLimitSnapshot, @@ -41941,9 +52833,21 @@ export const V2GetAccountResponse = Schema.Struct({ requiresOpenaiAuth: Schema.Boolean, }).annotate({ title: "GetAccountResponse" }); +export type V2GetAccountResponse__WorkspaceRouting = { + readonly accountRoutingOverride: V2GetAccountResponse__AccountRoutingOverride; + readonly backendOrigin: string; + readonly chatgptAccountId: string; +}; +export const V2GetAccountResponse__WorkspaceRouting = Schema.Struct({ + accountRoutingOverride: V2GetAccountResponse__AccountRoutingOverride, + backendOrigin: Schema.String, + chatgptAccountId: Schema.String, +}); + export type V2GetAccountTokenUsageResponse = { readonly dailyUsageBuckets?: ReadonlyArray | null; readonly summary: V2GetAccountTokenUsageResponse__AccountTokenUsageSummary; + readonly threadUsage?: V2GetAccountTokenUsageResponse__ThreadUsage | null; }; export const V2GetAccountTokenUsageResponse = Schema.Struct({ dailyUsageBuckets: Schema.optionalKey( @@ -41953,6 +52857,12 @@ export const V2GetAccountTokenUsageResponse = Schema.Struct({ ]), ), summary: V2GetAccountTokenUsageResponse__AccountTokenUsageSummary, + threadUsage: Schema.optionalKey( + Schema.Union([V2GetAccountTokenUsageResponse__ThreadUsage, Schema.Null]).annotate({ + description: + "Estimated usage when a thread was requested and its billing route is available.", + }), + ), }).annotate({ title: "GetAccountTokenUsageResponse" }); export type V2GetWorkspaceMessagesResponse = { @@ -42058,7 +52968,7 @@ export const V2ItemGuardianApprovalReviewCompletedNotification = Schema.Struct({ Schema.Union([ Schema.String.annotate({ description: - "Identifier for the reviewed item or tool call when one exists.\n\nIn most cases, one review maps to one target item. The exceptions are - execve reviews, where a single command may contain multiple execve calls to review (only possible when using the shell_zsh_fork feature) - network policy reviews, where there is no target item\n\nA network call is triggered by a CommandExecution item, so having a target_item_id set to the CommandExecution item would be misleading because the review is about the network call, not the command execution. Therefore, target_item_id is set to None for network policy reviews.", + "Identifier for the reviewed item or tool call when one exists.\n\nIn most cases, one review maps to one target item. The exceptions are - execve reviews, where a single command may contain multiple execve calls to review (only possible when using the shell_zsh_fork feature) - stdin reviews, which refer to the existing parent command item and have a separate approval ID in the action payload - network policy reviews, where there is no target item\n\nA network call is triggered by a CommandExecution item, so having a target_item_id set to the CommandExecution item would be misleading because the review is about the network call, not the command execution. Therefore, target_item_id is set to None for network policy reviews.", }), Schema.Null, ]), @@ -42092,7 +53002,7 @@ export const V2ItemGuardianApprovalReviewStartedNotification = Schema.Struct({ Schema.Union([ Schema.String.annotate({ description: - "Identifier for the reviewed item or tool call when one exists.\n\nIn most cases, one review maps to one target item. The exceptions are - execve reviews, where a single command may contain multiple execve calls to review (only possible when using the shell_zsh_fork feature) - network policy reviews, where there is no target item\n\nA network call is triggered by a CommandExecution item, so having a target_item_id set to the CommandExecution item would be misleading because the review is about the network call, not the command execution. Therefore, target_item_id is set to None for network policy reviews.", + "Identifier for the reviewed item or tool call when one exists.\n\nIn most cases, one review maps to one target item. The exceptions are - execve reviews, where a single command may contain multiple execve calls to review (only possible when using the shell_zsh_fork feature) - stdin reviews, which refer to the existing parent command item and have a separate approval ID in the action payload - network policy reviews, where there is no target item\n\nA network call is triggered by a CommandExecution item, so having a target_item_id set to the CommandExecution item would be misleading because the review is about the network call, not the command execution. Therefore, target_item_id is set to None for network policy reviews.", }), Schema.Null, ]), @@ -42192,7 +53102,14 @@ export type V2LoginAccountParams = readonly chatgptPlanType?: string | null; readonly type: "chatgptAuthTokens"; } - | { readonly apiKey: string; readonly region: string; readonly type: "amazonBedrock" }; + | { readonly apiKey: string; readonly region: string; readonly type: "amazonBedrock" } + | { + readonly accessKeyId: string; + readonly region: string; + readonly secretAccessKey: string; + readonly sessionToken?: string | null; + readonly type: "amazonBedrockAccessKeys"; + }; export const V2LoginAccountParams = Schema.Union( [ Schema.Struct({ @@ -42247,6 +53164,18 @@ export const V2LoginAccountParams = Schema.Union( title: "AmazonBedrockv2::LoginAccountParams", description: "[UNSTABLE] Managed Amazon Bedrock login is experimental.", }), + Schema.Struct({ + accessKeyId: Schema.String, + region: Schema.String, + secretAccessKey: Schema.String, + sessionToken: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + type: Schema.Literal("amazonBedrockAccessKeys").annotate({ + title: "AmazonBedrockAccessKeysv2::LoginAccountParamsType", + }), + }).annotate({ + title: "AmazonBedrockAccessKeysv2::LoginAccountParams", + description: "[UNSTABLE] Managed Amazon Bedrock AWS access key login is experimental.", + }), ], { mode: "oneOf" }, ).annotate({ title: "LoginAccountParams" }); @@ -42362,11 +53291,22 @@ export const V2MarketplaceUpgradeResponse = Schema.Struct({ }).annotate({ title: "MarketplaceUpgradeResponse" }); export type V2McpResourceReadParams = { + readonly connectorId?: string | null; + readonly originCallId?: string | null; readonly server: string; readonly threadId?: string | null; readonly uri: string; }; export const V2McpResourceReadParams = Schema.Struct({ + connectorId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + originCallId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Originating MCP tool call used to select the resource's app.", + }), + Schema.Null, + ]), + ), server: Schema.String, threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, @@ -42374,11 +53314,29 @@ export const V2McpResourceReadParams = Schema.Struct({ export type V2McpResourceReadResponse = { readonly contents: ReadonlyArray; + readonly originCallId?: string | null; }; export const V2McpResourceReadResponse = Schema.Struct({ contents: Schema.Array(V2McpResourceReadResponse__ResourceContent), + originCallId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Originating call when the server applied app-specific resource scoping.", + }), + Schema.Null, + ]), + ), }).annotate({ title: "McpResourceReadResponse" }); +export type V2McpServerEventStreamNotification = { + readonly notification: V2McpServerEventStreamNotification__McpServerEventNotification; + readonly subscriptionId: string; +}; +export const V2McpServerEventStreamNotification = Schema.Struct({ + notification: V2McpServerEventStreamNotification__McpServerEventNotification, + subscriptionId: Schema.String, +}).annotate({ title: "McpServerEventStreamNotification" }); + export type V2McpServerOauthLoginCompletedNotification = { readonly error?: string | null; readonly name: string; @@ -42393,12 +53351,22 @@ export const V2McpServerOauthLoginCompletedNotification = Schema.Struct({ }).annotate({ title: "McpServerOauthLoginCompletedNotification" }); export type V2McpServerOauthLoginParams = { + readonly clientRegistration?: V2McpServerOauthLoginParams__McpServerOauthClientRegistration | null; readonly name: string; readonly scopes?: ReadonlyArray | null; readonly threadId?: string | null; readonly timeoutSecs?: number | null; }; export const V2McpServerOauthLoginParams = Schema.Struct({ + clientRegistration: Schema.optionalKey( + Schema.Union([ + V2McpServerOauthLoginParams__McpServerOauthClientRegistration, + Schema.Null, + ]).annotate({ + description: + "Registration strategy for this login only; omission selects automatic discovery.", + }), + ), name: Schema.String, scopes: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null])), threadId: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -42602,6 +53570,18 @@ export const V2ModelVerificationNotification = Schema.Struct({ verifications: Schema.Array(V2ModelVerificationNotification__ModelVerification), }).annotate({ title: "ModelVerificationNotification" }); +export type V2NullableGetAccountRateLimitsParams = V2NullableGetAccountRateLimitsParams__GetAccountRateLimitsParams | null; +export const V2NullableGetAccountRateLimitsParams = Schema.Union([ + V2NullableGetAccountRateLimitsParams__GetAccountRateLimitsParams, + Schema.Null, +]).annotate({ title: "Nullable_GetAccountRateLimitsParams" }); + +export type V2NullableGetAccountTokenUsageParams = V2NullableGetAccountTokenUsageParams__GetAccountTokenUsageParams | null; +export const V2NullableGetAccountTokenUsageParams = Schema.Union([ + V2NullableGetAccountTokenUsageParams__GetAccountTokenUsageParams, + Schema.Null, +]).annotate({ title: "Nullable_GetAccountTokenUsageParams" }); + export type V2PermissionProfileListParams = { readonly cursor?: string | null; readonly cwd?: string | null; @@ -42711,11 +53691,20 @@ export const V2PluginInstalledResponse = Schema.Struct({ }).annotate({ title: "PluginInstalledResponse" }); export type V2PluginInstallParams = { + readonly installAttemptId?: string | null; readonly marketplacePath?: V2PluginInstallParams__AbsolutePathBuf | null; readonly pluginName: string; readonly remoteMarketplaceName?: string | null; }; export const V2PluginInstallParams = Schema.Struct({ + installAttemptId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Client-generated identifier used to correlate one installation attempt.", + }), + Schema.Null, + ]), + ), marketplacePath: Schema.optionalKey( Schema.Union([V2PluginInstallParams__AbsolutePathBuf, Schema.Null]), ), @@ -42734,6 +53723,7 @@ export const V2PluginInstallResponse = Schema.Struct({ export type V2PluginListParams = { readonly cwds?: ReadonlyArray | null; + readonly forceRefetch?: boolean; readonly marketplaceKinds?: ReadonlyArray | null; }; export const V2PluginListParams = Schema.Struct({ @@ -42746,6 +53736,11 @@ export const V2PluginListParams = Schema.Struct({ Schema.Null, ]), ), + forceRefetch: Schema.optionalKey( + Schema.Boolean.annotate({ + description: "Whether the client requests a fresh remote plugin catalog fetch.", + }), + ), marketplaceKinds: Schema.optionalKey( Schema.Union([ Schema.Array(V2PluginListParams__PluginListMarketplaceKind).annotate({ @@ -42788,6 +53783,41 @@ export const V2PluginReadResponse = Schema.Struct({ plugin: V2PluginReadResponse__PluginDetail, }).annotate({ title: "PluginReadResponse" }); +export type V2PluginReconcileParams = { readonly reason?: string | null }; +export const V2PluginReconcileParams = Schema.Struct({ + reason: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Optional client-provided reason recorded with the reconciliation attempt.", + }), + Schema.Null, + ]), + ), +}).annotate({ title: "PluginReconcileParams" }); + +export type V2PluginReconcileResponse = { + readonly changedPlugins: ReadonlyArray; + readonly failedMaterializationRemotePluginIds: ReadonlyArray; + readonly failedRemotePluginIds: ReadonlyArray; +}; +export const V2PluginReconcileResponse = Schema.Struct({ + changedPlugins: Schema.Array(V2PluginReconcileResponse__PluginReconcileChangedPlugin).annotate({ + description: + "Plugins affected by bundle changes, enablement changes, or removals. Installed-state changes compare against the previous cached snapshot, including cached reinstalls. Removal hints survive cache cleanup failures; unchanged plugins are omitted.", + }), + failedMaterializationRemotePluginIds: Schema.Array(Schema.String).annotate({ + description: + "Subset of failures for which the requested bundle could not be materialized. A previously cached version may still be available.", + }), + failedRemotePluginIds: Schema.Array(Schema.String).annotate({ + description: "Backend remote plugin IDs whose bundle or identity update failed.", + }), +}).annotate({ + title: "PluginReconcileResponse", + description: + "Bundle and installed-state changes observed by this pass, not a runtime-readiness acknowledgement or a cumulative diff since the client's last request. Other metadata-only changes are not listed.", +}); + export type V2PluginShareCheckoutParams = { readonly remotePluginId: string }; export const V2PluginShareCheckoutParams = Schema.Struct({ remotePluginId: Schema.String, @@ -42854,10 +53884,12 @@ export const V2PluginShareSaveParams = Schema.Struct({ }).annotate({ title: "PluginShareSaveParams" }); export type V2PluginShareSaveResponse = { + readonly canPublishToWorkspace?: boolean | null; readonly remotePluginId: string; readonly shareUrl: string; }; export const V2PluginShareSaveResponse = Schema.Struct({ + canPublishToWorkspace: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), remotePluginId: Schema.String, shareUrl: Schema.String, }).annotate({ title: "PluginShareSaveResponse" }); @@ -42969,11 +54001,21 @@ export const V2ProcessOutputDeltaNotification = Schema.Struct({ description: "Base64-encoded output chunk emitted for a streaming `process/spawn` request.", }); +export type V2ProjectChangedNotification = { + readonly changeType: V2ProjectChangedNotification__ProjectChangeType; + readonly projectId: string; +}; +export const V2ProjectChangedNotification = Schema.Struct({ + changeType: V2ProjectChangedNotification__ProjectChangeType, + projectId: Schema.String, +}).annotate({ title: "ProjectChangedNotification" }); + export type V2RawResponseCompletedNotification = { readonly responseId: string; readonly threadId: string; readonly turnId: string; readonly usage?: V2RawResponseCompletedNotification__TokenUsageBreakdown | null; + readonly usageMetadata?: V2RawResponseCompletedNotification__ResponseUsageMetadata | null; }; export const V2RawResponseCompletedNotification = Schema.Struct({ responseId: Schema.String, @@ -42982,6 +54024,9 @@ export const V2RawResponseCompletedNotification = Schema.Struct({ usage: Schema.optionalKey( Schema.Union([V2RawResponseCompletedNotification__TokenUsageBreakdown, Schema.Null]), ), + usageMetadata: Schema.optionalKey( + Schema.Union([V2RawResponseCompletedNotification__ResponseUsageMetadata, Schema.Null]), + ), }).annotate({ title: "RawResponseCompletedNotification", description: @@ -43073,7 +54118,7 @@ export const V2ReviewStartParams = Schema.Struct({ delivery: Schema.optionalKey( Schema.Union([V2ReviewStartParams__ReviewDelivery, Schema.Null]).annotate({ description: - "Where to run the review: inline (default) on the current thread or detached on a new thread (returned in `reviewThreadId`).", + "Where to run the review: inline (default) on the current thread or detached on a new thread (returned in `reviewThreadId`). Detached delivery is deprecated and emits `deprecationNotice`. Use `thread/start` followed by an inline review for a separate review thread.", }), ), target: V2ReviewStartParams__ReviewTarget, @@ -43184,6 +54229,20 @@ export const V2SkillsListResponse = Schema.Struct({ data: Schema.Array(V2SkillsListResponse__SkillsListEntry), }).annotate({ title: "SkillsListResponse" }); +export type V2StrictReviewRequiredNotification = { + readonly startedAtMs: number; + readonly threadId: string; + readonly turnId: string; +}; +export const V2StrictReviewRequiredNotification = Schema.Struct({ + startedAtMs: Schema.Number.annotate({ + description: "Unix timestamp (in milliseconds) when this review started.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + threadId: Schema.String, + turnId: Schema.String, +}).annotate({ title: "StrictReviewRequiredNotification" }); + export type V2TerminalInteractionNotification = { readonly itemId: string; readonly processId: string; @@ -43233,6 +54292,112 @@ export const V2ThreadArchiveResponse = Schema.Record( Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ title: "ThreadArchiveResponse" }); +export type V2ThreadAttachmentAddParams = { + readonly attachmentType: string; + readonly identityKey: string; + readonly payload: Schema.Json; + readonly threadId: string; +}; +export const V2ThreadAttachmentAddParams = Schema.Struct({ + attachmentType: Schema.String, + identityKey: Schema.String, + payload: Schema.Json.annotate({ expected: "JSON value" }), + threadId: Schema.String, +}).annotate({ + title: "ThreadAttachmentAddParams", + description: "Parameters for creating or locating an attachment on its owning thread.", +}); + +export type V2ThreadAttachmentAddResponse = { + readonly attachment: V2ThreadAttachmentAddResponse__ThreadAttachment; + readonly outcome: V2ThreadAttachmentAddResponse__ThreadAttachmentAddOutcome; +}; +export const V2ThreadAttachmentAddResponse = Schema.Struct({ + attachment: V2ThreadAttachmentAddResponse__ThreadAttachment, + outcome: V2ThreadAttachmentAddResponse__ThreadAttachmentAddOutcome, +}).annotate({ + title: "ThreadAttachmentAddResponse", + description: "The created or existing attachment.", +}); + +export type V2ThreadAttachmentListParams = { + readonly cursor?: string | null; + readonly limit?: number | null; + readonly threadId: string; +}; +export const V2ThreadAttachmentListParams = Schema.Struct({ + cursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + threadId: Schema.String, +}).annotate({ + title: "ThreadAttachmentListParams", + description: "Parameters for listing attachments from one thread.", +}); + +export type V2ThreadAttachmentListResponse = { + readonly data: ReadonlyArray; + readonly nextCursor?: string | null; +}; +export const V2ThreadAttachmentListResponse = Schema.Struct({ + data: Schema.Array(V2ThreadAttachmentListResponse__ThreadAttachment), + nextCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), +}).annotate({ + title: "ThreadAttachmentListResponse", + description: "One page of attachments associated with the requested thread.", +}); + +export type V2ThreadAttachmentRemoveParams = { + readonly attachmentType: string; + readonly identityKey: string; + readonly threadId: string; +}; +export const V2ThreadAttachmentRemoveParams = Schema.Struct({ + attachmentType: Schema.String, + identityKey: Schema.String, + threadId: Schema.String, +}).annotate({ + title: "ThreadAttachmentRemoveParams", + description: "Parameters for deleting an attachment by its stable thread-local identity.", +}); + +export type V2ThreadAttachmentRemoveResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadAttachmentRemoveResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ + title: "ThreadAttachmentRemoveResponse", + description: "Successful deletion does not return additional attachment data.", +}); + +export type V2ThreadAttachmentUpdatedNotification = { + readonly attachmentId: string; + readonly attachmentType: string; + readonly identityKey: string; + readonly operation: V2ThreadAttachmentUpdatedNotification__ThreadAttachmentOperation; + readonly threadId: string; +}; +export const V2ThreadAttachmentUpdatedNotification = Schema.Struct({ + attachmentId: Schema.String, + attachmentType: Schema.String, + identityKey: Schema.String, + operation: V2ThreadAttachmentUpdatedNotification__ThreadAttachmentOperation, + threadId: Schema.String, +}).annotate({ + title: "ThreadAttachmentUpdatedNotification", + description: "Notification published after a thread attachment is created or deleted.", +}); + export type V2ThreadClosedNotification = { readonly threadId: string }; export const V2ThreadClosedNotification = Schema.Struct({ threadId: Schema.String }).annotate({ title: "ThreadClosedNotification", @@ -43273,6 +54438,7 @@ export type V2ThreadForkParams = { readonly cwd?: string | null; readonly developerInstructions?: string | null; readonly ephemeral?: boolean; + readonly excludeTurns?: boolean; readonly lastTurnId?: string | null; readonly model?: string | null; readonly modelProvider?: string | null; @@ -43301,6 +54467,12 @@ export const V2ThreadForkParams = Schema.Struct({ cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), ephemeral: Schema.optionalKey(Schema.Boolean), + excludeTurns: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "When true, return only thread metadata and live fork state without populating `thread.turns`. This is useful when the client plans to call `thread/turns/list` immediately after forking. Full-history hydration is deprecated for paginated threads; use this with `thread/turns/list` and `thread/items/list` instead.", + }), + ), lastTurnId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -43344,6 +54516,7 @@ export type V2ThreadForkResponse = { readonly approvalPolicy: V2ThreadForkResponse__AskForApproval; readonly approvalsReviewer: V2ThreadForkResponse__ApprovalsReviewer; readonly cwd: V2ThreadForkResponse__AbsolutePathBuf; + readonly disabledPluginIds?: ReadonlyArray; readonly instructionSources?: ReadonlyArray; readonly model: string; readonly modelProvider: string; @@ -43359,6 +54532,12 @@ export const V2ThreadForkResponse = Schema.Struct({ V2ThreadForkResponse__ApprovalsReviewer, ).annotate({ description: "Reviewer currently used for approval requests on this thread." }), cwd: V2ThreadForkResponse__AbsolutePathBuf, + disabledPluginIds: Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + description: "Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.", + default: [], + }), + ), instructionSources: Schema.optionalKey( Schema.Array(V2ThreadForkResponse__LegacyAppPathString).annotate({ description: @@ -43416,15 +54595,25 @@ export const V2ThreadForkResponse__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); +export type V2ThreadForkResponse__ThreadEnvironment = { + readonly cwd: V2ThreadForkResponse__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const V2ThreadForkResponse__ThreadEnvironment = Schema.Struct({ + cwd: V2ThreadForkResponse__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(V2ThreadForkResponse__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + export type V2ThreadForkResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; export const V2ThreadForkResponse__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type V2ThreadForkResponse__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadForkResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); - export type V2ThreadGoalClearedNotification = { readonly threadId: string }; export const V2ThreadGoalClearedNotification = Schema.Struct({ threadId: Schema.String }).annotate({ title: "ThreadGoalClearedNotification", @@ -43505,13 +54694,87 @@ export const V2ThreadInjectItemsResponse = Schema.Record( Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ title: "ThreadInjectItemsResponse" }); +export type V2ThreadItemsListParams = { + readonly cursor?: string | null; + readonly limit?: number | null; + readonly sortDirection?: V2ThreadItemsListParams__SortDirection | null; + readonly threadId: string; + readonly turnId?: string | null; +}; +export const V2ThreadItemsListParams = Schema.Struct({ + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque cursor to pass to the next call to continue after the last item.", + }), + Schema.Null, + ]), + ), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ description: "Optional item page size.", format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + sortDirection: Schema.optionalKey( + Schema.Union([V2ThreadItemsListParams__SortDirection, Schema.Null]).annotate({ + description: "Optional item pagination direction; defaults to ascending.", + }), + ), + threadId: Schema.String, + turnId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional turn id to filter by. When omitted, returns items across the thread.", + }), + Schema.Null, + ]), + ), +}).annotate({ title: "ThreadItemsListParams" }); + +export type V2ThreadItemsListResponse = { + readonly backwardsCursor?: string | null; + readonly data: ReadonlyArray; + readonly nextCursor?: string | null; +}; +export const V2ThreadItemsListResponse = Schema.Struct({ + backwardsCursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Opaque cursor to pass as `cursor` when reversing `sortDirection`. This is only populated when the page contains at least one item.", + }), + Schema.Null, + ]), + ), + data: Schema.Array(V2ThreadItemsListResponse__ThreadItemEntry), + nextCursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Opaque cursor to pass to the next call to continue after the last item. if None, there are no more items to return.", + }), + Schema.Null, + ]), + ), +}).annotate({ title: "ThreadItemsListResponse" }); + export type V2ThreadListParams = { readonly archived?: boolean | null; readonly cursor?: string | null; readonly cwd?: V2ThreadListParams__ThreadListCwdFilter | null; readonly limit?: number | null; readonly modelProviders?: ReadonlyArray | null; + readonly originators?: ReadonlyArray | null; readonly searchTerm?: string | null; + readonly sectionId?: string | null; readonly sortDirection?: V2ThreadListParams__SortDirection | null; readonly sortKey?: V2ThreadListParams__ThreadSortKey | null; readonly sourceKinds?: ReadonlyArray | null; @@ -43565,6 +54828,15 @@ export const V2ThreadListParams = Schema.Struct({ Schema.Null, ]), ), + originators: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: + "Optional originator allowlist, matching any supplied value exactly. Supported by hosted backends only; the local app-server rejects a nonempty list. Omitted or empty lists leave originators unrestricted.", + }), + Schema.Null, + ]), + ), searchTerm: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -43573,6 +54845,15 @@ export const V2ThreadListParams = Schema.Struct({ Schema.Null, ]), ), + sectionId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Omit to include every section, set to `null` for unsectioned threads, or provide a section ID to return only threads in that section.", + }), + Schema.Null, + ]), + ), sortDirection: Schema.optionalKey( Schema.Union([V2ThreadListParams__SortDirection, Schema.Null]).annotate({ description: "Optional sort direction; defaults to descending (newest first).", @@ -43627,15 +54908,25 @@ export const V2ThreadListResponse = Schema.Struct({ ), }).annotate({ title: "ThreadListResponse" }); +export type V2ThreadListResponse__ThreadEnvironment = { + readonly cwd: V2ThreadListResponse__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const V2ThreadListResponse__ThreadEnvironment = Schema.Struct({ + cwd: V2ThreadListResponse__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(V2ThreadListResponse__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + export type V2ThreadListResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; export const V2ThreadListResponse__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type V2ThreadListResponse__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadListResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); - export type V2ThreadLoadedListParams = { readonly cursor?: string | null; readonly limit?: number | null; @@ -43709,18 +55000,25 @@ export const V2ThreadMetadataUpdateResponse = Schema.Struct({ thread: V2ThreadMetadataUpdateResponse__Thread, }).annotate({ title: "ThreadMetadataUpdateResponse" }); +export type V2ThreadMetadataUpdateResponse__ThreadEnvironment = { + readonly cwd: V2ThreadMetadataUpdateResponse__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const V2ThreadMetadataUpdateResponse__ThreadEnvironment = Schema.Struct({ + cwd: V2ThreadMetadataUpdateResponse__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(V2ThreadMetadataUpdateResponse__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + export type V2ThreadMetadataUpdateResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; export const V2ThreadMetadataUpdateResponse__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type V2ThreadMetadataUpdateResponse__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadMetadataUpdateResponse__ThreadHistoryMode = Schema.Literals([ - "legacy", - "paginated", -]); - export type V2ThreadNameUpdatedNotification = { readonly threadId: string; readonly threadName?: string | null; @@ -43730,11 +55028,26 @@ export const V2ThreadNameUpdatedNotification = Schema.Struct({ threadName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ title: "ThreadNameUpdatedNotification" }); +export type V2ThreadProjectUpdatedNotification = { + readonly projectId: string | null; + readonly threadId: string; +}; +export const V2ThreadProjectUpdatedNotification = Schema.Struct({ + projectId: Schema.Union([Schema.String, Schema.Null]), + threadId: Schema.String, +}).annotate({ title: "ThreadProjectUpdatedNotification" }); + +export type V2ThreadQueueChangedNotification = { readonly threadId: string }; +export const V2ThreadQueueChangedNotification = Schema.Struct({ threadId: Schema.String }).annotate( + { title: "ThreadQueueChangedNotification" }, +); + export type V2ThreadReadParams = { readonly includeTurns?: boolean; readonly threadId: string }; export const V2ThreadReadParams = Schema.Struct({ includeTurns: Schema.optionalKey( Schema.Boolean.annotate({ - description: "When true, include turns and their items from rollout history.", + description: + "When true, include turns and their items from rollout history. Full-history hydration is deprecated for paginated threads; prefer a metadata-only read and page with `thread/turns/list` and `thread/items/list`.", }), ), threadId: Schema.String, @@ -43745,15 +55058,25 @@ export const V2ThreadReadResponse = Schema.Struct({ thread: V2ThreadReadResponse__Thread, }).annotate({ title: "ThreadReadResponse" }); +export type V2ThreadReadResponse__ThreadEnvironment = { + readonly cwd: V2ThreadReadResponse__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const V2ThreadReadResponse__ThreadEnvironment = Schema.Struct({ + cwd: V2ThreadReadResponse__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(V2ThreadReadResponse__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + export type V2ThreadReadResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; export const V2ThreadReadResponse__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type V2ThreadReadResponse__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadReadResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); - export type V2ThreadRealtimeClosedNotification = { readonly reason?: string | null; readonly threadId: string; @@ -43790,6 +55113,44 @@ export const V2ThreadRealtimeItemAddedNotification = Schema.Struct({ description: "EXPERIMENTAL - raw non-audio thread realtime item emitted by the backend.", }); +export type V2ThreadRealtimeItemCompletedNotification = { + readonly item: V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeItem; + readonly threadId: string; +}; +export const V2ThreadRealtimeItemCompletedNotification = Schema.Struct({ + item: V2ThreadRealtimeItemCompletedNotification__ThreadRealtimeItem, + threadId: Schema.String, +}).annotate({ + title: "ThreadRealtimeItemCompletedNotification", + description: "EXPERIMENTAL - a realtime timeline item published after canonical commit.", +}); + +export type V2ThreadRealtimeItemStartedNotification = { + readonly item: V2ThreadRealtimeItemStartedNotification__ThreadRealtimeItem; + readonly threadId: string; +}; +export const V2ThreadRealtimeItemStartedNotification = Schema.Struct({ + item: V2ThreadRealtimeItemStartedNotification__ThreadRealtimeItem, + threadId: Schema.String, +}).annotate({ + title: "ThreadRealtimeItemStartedNotification", + description: "EXPERIMENTAL - a realtime timeline item started before its content streams.", +}); + +export type V2ThreadRealtimeItemTranscriptDeltaNotification = { + readonly delta: string; + readonly itemId: string; + readonly threadId: string; +}; +export const V2ThreadRealtimeItemTranscriptDeltaNotification = Schema.Struct({ + delta: Schema.String, + itemId: Schema.String, + threadId: Schema.String, +}).annotate({ + title: "ThreadRealtimeItemTranscriptDeltaNotification", + description: "EXPERIMENTAL - text appended to an active realtime transcript item.", +}); + export type V2ThreadRealtimeOutputAudioDeltaNotification = { readonly audio: V2ThreadRealtimeOutputAudioDeltaNotification__ThreadRealtimeAudioChunk; readonly threadId: string; @@ -43862,6 +55223,7 @@ export type V2ThreadResumeParams = { readonly config?: { readonly [x: string]: Schema.Json } | null; readonly cwd?: string | null; readonly developerInstructions?: string | null; + readonly excludeTurns?: boolean; readonly model?: string | null; readonly modelProvider?: string | null; readonly personality?: V2ThreadResumeParams__Personality | null; @@ -43888,6 +55250,12 @@ export const V2ThreadResumeParams = Schema.Struct({ ), cwd: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), developerInstructions: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + excludeTurns: Schema.optionalKey( + Schema.Boolean.annotate({ + description: + "When true, return only thread metadata and live-resume state without populating `thread.turns`. This is useful when the client plans to call `thread/turns/list` immediately after resuming. Full-history hydration is deprecated for paginated threads; use this with `thread/turns/list` and `thread/items/list` instead.", + }), + ), model: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ @@ -43897,7 +55265,12 @@ export const V2ThreadResumeParams = Schema.Struct({ ]), ), modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - personality: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__Personality, Schema.Null])), + personality: Schema.optionalKey( + Schema.Union([V2ThreadResumeParams__Personality, Schema.Null]).annotate({ + description: + "@deprecated `friendly` and `pragmatic` no longer select a style. Changing this does not rewrite the thread's existing instructions.", + }), + ), sandbox: Schema.optionalKey(Schema.Union([V2ThreadResumeParams__SandboxMode, Schema.Null])), serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), threadId: Schema.String, @@ -43949,6 +55322,7 @@ export type V2ThreadResumeParams__ResponseItem = | { readonly arguments: string; readonly call_id: string; + readonly encrypted_function_args?: ReadonlyArray | null; readonly id?: string | null; readonly internal_chat_message_metadata_passthrough?: V2ThreadResumeParams__InternalChatMessageMetadataPassthrough | null; readonly name: string; @@ -43965,9 +55339,11 @@ export type V2ThreadResumeParams__ResponseItem = readonly type: "tool_search_call"; } | { - readonly call_id: string; + readonly call_id?: string | null; readonly id?: string | null; readonly internal_chat_message_metadata_passthrough?: V2ThreadResumeParams__InternalChatMessageMetadataPassthrough | null; + readonly name?: string | null; + readonly namespace?: string | null; readonly output: V2ThreadResumeParams__FunctionCallOutputBody; readonly type: "function_call_output"; } @@ -44019,6 +55395,10 @@ export type V2ThreadResumeParams__ResponseItem = readonly internal_chat_message_metadata_passthrough?: V2ThreadResumeParams__InternalChatMessageMetadataPassthrough | null; readonly type: "compaction"; } + | { + readonly reasoning: V2ThreadResumeParams__ConfigurationReasoning; + readonly type: "configuration_update"; + } | { readonly type: "compaction_trigger" } | { readonly encrypted_content?: string | null; @@ -44088,6 +55468,9 @@ export const V2ThreadResumeParams__ResponseItem = Schema.Union( Schema.Struct({ arguments: Schema.String, call_id: Schema.String, + encrypted_function_args: Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]), + ), id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([V2ThreadResumeParams__InternalChatMessageMetadataPassthrough, Schema.Null]), @@ -44110,11 +55493,13 @@ export const V2ThreadResumeParams__ResponseItem = Schema.Union( }), }).annotate({ title: "ToolSearchCallResponseItem" }), Schema.Struct({ - call_id: Schema.String, + call_id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), id: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), internal_chat_message_metadata_passthrough: Schema.optionalKey( Schema.Union([V2ThreadResumeParams__InternalChatMessageMetadataPassthrough, Schema.Null]), ), + name: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + namespace: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), output: V2ThreadResumeParams__FunctionCallOutputBody, type: Schema.Literal("function_call_output").annotate({ title: "FunctionCallOutputResponseItemType", @@ -44190,6 +55575,15 @@ export const V2ThreadResumeParams__ResponseItem = Schema.Union( ), type: Schema.Literal("compaction").annotate({ title: "CompactionResponseItemType" }), }).annotate({ title: "CompactionResponseItem" }), + Schema.Struct({ + reasoning: V2ThreadResumeParams__ConfigurationReasoning, + type: Schema.Literal("configuration_update").annotate({ + title: "ConfigurationUpdateResponseItemType", + }), + }).annotate({ + title: "ConfigurationUpdateResponseItem", + description: "A durable input control interpreted by the backend at its position in history.", + }), Schema.Struct({ type: Schema.Literal("compaction_trigger").annotate({ title: "CompactionTriggerResponseItemType", @@ -44245,14 +55639,18 @@ export const V2ThreadResumeParams__ThreadResumeInitialTurnsPageParams = Schema.S export type V2ThreadResumeResponse = { readonly approvalPolicy: V2ThreadResumeResponse__AskForApproval; readonly approvalsReviewer: V2ThreadResumeResponse__ApprovalsReviewer; + readonly collaborationMode?: V2ThreadResumeResponse__CollaborationMode | null; readonly cwd: V2ThreadResumeResponse__AbsolutePathBuf; + readonly disabledPluginIds?: ReadonlyArray; readonly instructionSources?: ReadonlyArray; + readonly itemsBackwardsCursor?: string | null; readonly model: string; readonly modelProvider: string; readonly reasoningEffort?: V2ThreadResumeResponse__ReasoningEffort | null; readonly sandbox: V2ThreadResumeResponse__SandboxPolicy; readonly serviceTier?: string | null; readonly thread: V2ThreadResumeResponse__Thread; + readonly turnsBackwardsCursor?: string | null; }; export const V2ThreadResumeResponse = Schema.Struct({ approvalPolicy: V2ThreadResumeResponse__AskForApproval, @@ -44260,7 +55658,18 @@ export const V2ThreadResumeResponse = Schema.Struct({ (): Schema.Codec => V2ThreadResumeResponse__ApprovalsReviewer, ).annotate({ description: "Reviewer currently used for approval requests on this thread." }), + collaborationMode: Schema.optionalKey( + Schema.Union([V2ThreadResumeResponse__CollaborationMode, Schema.Null]).annotate({ + description: "Effective collaboration mode. Absent when resuming from an older server.", + }), + ), cwd: V2ThreadResumeResponse__AbsolutePathBuf, + disabledPluginIds: Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + description: "Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.", + default: [], + }), + ), instructionSources: Schema.optionalKey( Schema.Array(V2ThreadResumeResponse__LegacyAppPathString).annotate({ description: @@ -44268,6 +55677,15 @@ export const V2ThreadResumeResponse = Schema.Struct({ default: [], }), ), + itemsBackwardsCursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + 'Opaque cursor for hydrating paginated items backwards.\n\nPass this as `cursor` to `thread/items/list` with `sortDirection: "desc"`. The first page includes the item identified by the cursor.', + }), + Schema.Null, + ]), + ), model: Schema.String, modelProvider: Schema.String, reasoningEffort: Schema.optionalKey( @@ -44282,6 +55700,15 @@ export const V2ThreadResumeResponse = Schema.Struct({ }), serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), thread: V2ThreadResumeResponse__Thread, + turnsBackwardsCursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + 'Opaque cursor for hydrating paginated turns backwards.\n\nPass this as `cursor` to `thread/turns/list` with `sortDirection: "desc"`. The first page includes the turn identified by the cursor.', + }), + Schema.Null, + ]), + ), }).annotate({ title: "ThreadResumeResponse" }); export type V2ThreadResumeResponse__ActivePermissionProfile = { @@ -44319,15 +55746,25 @@ export const V2ThreadResumeResponse__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); +export type V2ThreadResumeResponse__ThreadEnvironment = { + readonly cwd: V2ThreadResumeResponse__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const V2ThreadResumeResponse__ThreadEnvironment = Schema.Struct({ + cwd: V2ThreadResumeResponse__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(V2ThreadResumeResponse__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + export type V2ThreadResumeResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; export const V2ThreadResumeResponse__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type V2ThreadResumeResponse__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadResumeResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); - export type V2ThreadResumeResponse__TurnsPage = { readonly backwardsCursor?: string | null; readonly data: ReadonlyArray; @@ -44339,41 +55776,232 @@ export const V2ThreadResumeResponse__TurnsPage = Schema.Struct({ nextCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }); -export type V2ThreadRollbackParams = { readonly numTurns: number; readonly threadId: string }; -export const V2ThreadRollbackParams = Schema.Struct({ - numTurns: Schema.Number.annotate({ - description: - "The number of turns to drop from the end of the thread. Must be >= 1.\n\nThis only modifies the thread's history and does not revert local file changes that have been made by the agent. Clients are responsible for reverting these changes.", - format: "uint32", - }) - .check(Schema.isInt().annotate({ expected: "an integer" })) - .check( - Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), - ), +export type V2ThreadRevertedNotification = { readonly threadId: string }; +export const V2ThreadRevertedNotification = Schema.Struct({ threadId: Schema.String }).annotate({ + title: "ThreadRevertedNotification", +}); + +export type V2ThreadRevertParams = { readonly beforeTurnId: string; readonly threadId: string }; +export const V2ThreadRevertParams = Schema.Struct({ + beforeTurnId: Schema.String.annotate({ + description: "Turn excluded from the replacement history, together with every later turn.", + }), threadId: Schema.String, }).annotate({ - title: "ThreadRollbackParams", - description: "DEPRECATED: `thread/rollback` will be removed soon.", + title: "ThreadRevertParams", + description: + "Replace a paginated thread's durable history with the prefix before one turn.\n\nThis only changes persisted conversation history. It does not revert local file changes.", }); -export type V2ThreadRollbackResponse = { readonly thread: V2ThreadRollbackResponse__Thread }; -export const V2ThreadRollbackResponse = Schema.Struct({ +export type V2ThreadRevertResponse = { + readonly itemsBackwardsCursor?: string | null; + readonly thread: V2ThreadRevertResponse__Thread; + readonly turnsBackwardsCursor?: string | null; +}; +export const V2ThreadRevertResponse = Schema.Struct({ + itemsBackwardsCursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + 'Opaque cursor for hydrating paginated items backwards.\n\nPass this as `cursor` to `thread/items/list` with `sortDirection: "desc"`. The first page includes the item identified by the cursor.', + }), + Schema.Null, + ]), + ), thread: Schema.suspend( - (): Schema.Codec => V2ThreadRollbackResponse__Thread, + (): Schema.Codec => V2ThreadRevertResponse__Thread, ).annotate({ description: - "The updated thread after applying the rollback, with `turns` populated.\n\nThe ThreadItems stored in each Turn are lossy since we explicitly do not persist all agent interactions, such as command executions. This is the same behavior as `thread/resume`.", + "Updated loaded thread metadata. `turns` is always empty; hydrate retained history through `thread/turns/list`.", }), -}).annotate({ title: "ThreadRollbackResponse" }); + turnsBackwardsCursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + 'Opaque cursor for hydrating paginated turns backwards.\n\nPass this as `cursor` to `thread/turns/list` with `sortDirection: "desc"`. The first page includes the turn identified by the cursor.', + }), + Schema.Null, + ]), + ), +}).annotate({ title: "ThreadRevertResponse" }); -export type V2ThreadRollbackResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; -export const V2ThreadRollbackResponse__ThreadExtra = Schema.Record( +export type V2ThreadRevertResponse__ThreadEnvironment = { + readonly cwd: V2ThreadRevertResponse__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const V2ThreadRevertResponse__ThreadEnvironment = Schema.Struct({ + cwd: V2ThreadRevertResponse__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(V2ThreadRevertResponse__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + +export type V2ThreadRevertResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; +export const V2ThreadRevertResponse__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type V2ThreadRollbackResponse__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadRollbackResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); +export type V2ThreadSectionCreateParams = { + readonly appearance?: V2ThreadSectionCreateParams__ThreadSectionAppearance | null; + readonly name: string; +}; +export const V2ThreadSectionCreateParams = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadSectionCreateParams__ThreadSectionAppearance, Schema.Null]), + ), + name: Schema.String.annotate({ description: "The user-visible name of the section." }), +}).annotate({ + title: "ThreadSectionCreateParams", + description: "Parameters for creating an independently persisted thread section.", +}); + +export type V2ThreadSectionCreateResponse = { + readonly section: V2ThreadSectionCreateResponse__ThreadSection; +}; +export const V2ThreadSectionCreateResponse = Schema.Struct({ + section: V2ThreadSectionCreateResponse__ThreadSection, +}).annotate({ + title: "ThreadSectionCreateResponse", + description: "The independently persisted section created by the server.", +}); + +export type V2ThreadSectionDeleteParams = { readonly sectionId: string }; +export const V2ThreadSectionDeleteParams = Schema.Struct({ + sectionId: Schema.String.annotate({ + description: "The stable, server-generated identity of the section to delete.", + }), +}).annotate({ + title: "ThreadSectionDeleteParams", + description: "Parameters for deleting an independently persisted thread section.", +}); + +export type V2ThreadSectionDeleteResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadSectionDeleteResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ + title: "ThreadSectionDeleteResponse", + description: "Successful deletion does not return additional section data.", +}); + +export type V2ThreadSectionListParams = { + readonly cursor?: string | null; + readonly limit?: number | null; +}; +export const V2ThreadSectionListParams = Schema.Struct({ + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque pagination cursor returned by a previous call.", + }), + Schema.Null, + ]), + ), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: "Maximum number of sections to return.", + format: "uint32", + }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), +}).annotate({ + title: "ThreadSectionListParams", + description: "Parameters for listing independently persisted thread sections.", +}); + +export type V2ThreadSectionListResponse = { + readonly data: ReadonlyArray; + readonly nextCursor?: string | null; +}; +export const V2ThreadSectionListResponse = Schema.Struct({ + data: Schema.Array(V2ThreadSectionListResponse__ThreadSection), + nextCursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque cursor for the next page, or `null` when no sections remain.", + }), + Schema.Null, + ]), + ), +}).annotate({ + title: "ThreadSectionListResponse", + description: "One page of independently persisted thread sections.", +}); + +export type V2ThreadSectionMoveParams = { + readonly beforeThreadId?: string | null; + readonly sectionId: string | null; + readonly threadId: string; +}; +export const V2ThreadSectionMoveParams = Schema.Struct({ + beforeThreadId: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Existing thread to insert before; omission or null appends to the section.", + }), + Schema.Null, + ]), + ), + sectionId: Schema.Union([ + Schema.String.annotate({ + description: "Destination section, or `null` to remove the thread from its section.", + }), + Schema.Null, + ]), + threadId: Schema.String.annotate({ + description: "Thread to move into, within, or out of a section.", + }), +}).annotate({ + title: "ThreadSectionMoveParams", + description: "Parameters for moving a thread within a server-owned section ordering.", +}); + +export type V2ThreadSectionMoveResponse = { readonly [x: string]: Schema.Json }; +export const V2ThreadSectionMoveResponse = Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), +).annotate({ title: "ThreadSectionMoveResponse" }); + +export type V2ThreadSectionUpdateParams = { + readonly appearance?: V2ThreadSectionUpdateParams__ThreadSectionAppearance | null; + readonly name: string; + readonly sectionId: string; +}; +export const V2ThreadSectionUpdateParams = Schema.Struct({ + appearance: Schema.optionalKey( + Schema.Union([V2ThreadSectionUpdateParams__ThreadSectionAppearance, Schema.Null]).annotate({ + description: "Omit to preserve appearance, use `null` to clear it, or provide a replacement.", + }), + ), + name: Schema.String.annotate({ description: "The updated user-visible name of the section." }), + sectionId: Schema.String.annotate({ + description: "The stable, server-generated identity of the section to update.", + }), +}).annotate({ + title: "ThreadSectionUpdateParams", + description: "Parameters for updating an independently persisted thread section.", +}); + +export type V2ThreadSectionUpdateResponse = { + readonly section: V2ThreadSectionUpdateResponse__ThreadSection; +}; +export const V2ThreadSectionUpdateResponse = Schema.Struct({ + section: V2ThreadSectionUpdateResponse__ThreadSection, +}).annotate({ + title: "ThreadSectionUpdateResponse", + description: "The independently persisted section after its name is updated.", +}); export type V2ThreadSetNameParams = { readonly name: string; readonly threadId: string }; export const V2ThreadSetNameParams = Schema.Struct({ @@ -44411,13 +56039,27 @@ export const V2ThreadSettingsUpdatedNotification__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); -export type V2ThreadShellCommandParams = { readonly command: string; readonly threadId: string }; +export type V2ThreadShellCommandParams = { + readonly command: string; + readonly threadId: string; + readonly timeoutMs?: number | null; +}; export const V2ThreadShellCommandParams = Schema.Struct({ command: Schema.String.annotate({ description: "Shell command string evaluated by the thread's configured shell. Unlike `command/exec`, this intentionally preserves shell syntax such as pipes, redirects, and quoting. This runs unsandboxed with full access rather than inheriting the thread sandbox policy.", }), threadId: Schema.String, + timeoutMs: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + description: + "Maximum execution time in milliseconds. Defaults to one hour when omitted or null. Must be non-negative; zero requests an immediate timeout, not unlimited execution. Does not affect the immediate RPC acknowledgement.", + format: "int64", + }).check(Schema.isInt().annotate({ expected: "an integer" })), + Schema.Null, + ]), + ), }).annotate({ title: "ThreadShellCommandParams" }); export type V2ThreadShellCommandResponse = { readonly [x: string]: Schema.Json }; @@ -44431,18 +56073,25 @@ export const V2ThreadStartedNotification = Schema.Struct({ thread: V2ThreadStartedNotification__Thread, }).annotate({ title: "ThreadStartedNotification" }); +export type V2ThreadStartedNotification__ThreadEnvironment = { + readonly cwd: V2ThreadStartedNotification__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const V2ThreadStartedNotification__ThreadEnvironment = Schema.Struct({ + cwd: V2ThreadStartedNotification__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(V2ThreadStartedNotification__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + export type V2ThreadStartedNotification__ThreadExtra = { readonly [x: string]: Schema.Json }; export const V2ThreadStartedNotification__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type V2ThreadStartedNotification__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadStartedNotification__ThreadHistoryMode = Schema.Literals([ - "legacy", - "paginated", -]); - export type V2ThreadStartParams = { readonly approvalPolicy?: V2ThreadStartParams__AskForApproval | null; readonly approvalsReviewer?: V2ThreadStartParams__ApprovalsReviewer | null; @@ -44482,7 +56131,11 @@ export const V2ThreadStartParams = Schema.Struct({ ephemeral: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), model: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), modelProvider: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - personality: Schema.optionalKey(Schema.Union([V2ThreadStartParams__Personality, Schema.Null])), + personality: Schema.optionalKey( + Schema.Union([V2ThreadStartParams__Personality, Schema.Null]).annotate({ + description: "@deprecated `friendly` and `pragmatic` no longer select a style.", + }), + ), sandbox: Schema.optionalKey(Schema.Union([V2ThreadStartParams__SandboxMode, Schema.Null])), serviceName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), serviceTier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), @@ -44591,6 +56244,7 @@ export type V2ThreadStartResponse = { readonly approvalPolicy: V2ThreadStartResponse__AskForApproval; readonly approvalsReviewer: V2ThreadStartResponse__ApprovalsReviewer; readonly cwd: V2ThreadStartResponse__AbsolutePathBuf; + readonly disabledPluginIds?: ReadonlyArray; readonly instructionSources?: ReadonlyArray; readonly model: string; readonly modelProvider: string; @@ -44606,6 +56260,12 @@ export const V2ThreadStartResponse = Schema.Struct({ V2ThreadStartResponse__ApprovalsReviewer, ).annotate({ description: "Reviewer currently used for approval requests on this thread." }), cwd: V2ThreadStartResponse__AbsolutePathBuf, + disabledPluginIds: Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + description: "Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.", + default: [], + }), + ), instructionSources: Schema.optionalKey( Schema.Array(V2ThreadStartResponse__LegacyAppPathString).annotate({ description: @@ -44663,15 +56323,25 @@ export const V2ThreadStartResponse__MultiAgentMode = Schema.Union( "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", }); +export type V2ThreadStartResponse__ThreadEnvironment = { + readonly cwd: V2ThreadStartResponse__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const V2ThreadStartResponse__ThreadEnvironment = Schema.Struct({ + cwd: V2ThreadStartResponse__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(V2ThreadStartResponse__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + export type V2ThreadStartResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; export const V2ThreadStartResponse__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type V2ThreadStartResponse__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadStartResponse__ThreadHistoryMode = Schema.Literals(["legacy", "paginated"]); - export type V2ThreadStatusChangedNotification = { readonly status: V2ThreadStatusChangedNotification__ThreadStatus; readonly threadId: string; @@ -44692,6 +56362,74 @@ export const V2ThreadTokenUsageUpdatedNotification = Schema.Struct({ turnId: Schema.String, }).annotate({ title: "ThreadTokenUsageUpdatedNotification" }); +export type V2ThreadTurnsListParams = { + readonly cursor?: string | null; + readonly itemsView?: V2ThreadTurnsListParams__TurnItemsView | null; + readonly limit?: number | null; + readonly sortDirection?: V2ThreadTurnsListParams__SortDirection | null; + readonly threadId: string; +}; +export const V2ThreadTurnsListParams = Schema.Struct({ + cursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: "Opaque cursor to pass to the next call to continue after the last turn.", + }), + Schema.Null, + ]), + ), + itemsView: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListParams__TurnItemsView, Schema.Null]).annotate({ + description: "How much item detail to include for each returned turn; defaults to summary.", + }), + ), + limit: Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ description: "Optional turn page size.", format: "uint32" }) + .check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(0).annotate({ + expected: "a value greater than or equal to 0", + }), + ), + Schema.Null, + ]), + ), + sortDirection: Schema.optionalKey( + Schema.Union([V2ThreadTurnsListParams__SortDirection, Schema.Null]).annotate({ + description: "Optional turn pagination direction; defaults to descending.", + }), + ), + threadId: Schema.String, +}).annotate({ title: "ThreadTurnsListParams" }); + +export type V2ThreadTurnsListResponse = { + readonly backwardsCursor?: string | null; + readonly data: ReadonlyArray; + readonly nextCursor?: string | null; +}; +export const V2ThreadTurnsListResponse = Schema.Struct({ + backwardsCursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Opaque cursor to pass as `cursor` when reversing `sortDirection`. This is only populated when the page contains at least one turn. Use it with the opposite `sortDirection` to include the anchor turn again and catch updates to that turn.", + }), + Schema.Null, + ]), + ), + data: Schema.Array(V2ThreadTurnsListResponse__Turn), + nextCursor: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Opaque cursor to pass to the next call to continue after the last turn. if None, there are no more turns to return.", + }), + Schema.Null, + ]), + ), +}).annotate({ title: "ThreadTurnsListResponse" }); + export type V2ThreadUnarchivedNotification = { readonly threadId: string }; export const V2ThreadUnarchivedNotification = Schema.Struct({ threadId: Schema.String }).annotate({ title: "ThreadUnarchivedNotification", @@ -44707,18 +56445,25 @@ export const V2ThreadUnarchiveResponse = Schema.Struct({ thread: V2ThreadUnarchiveResponse__Thread, }).annotate({ title: "ThreadUnarchiveResponse" }); +export type V2ThreadUnarchiveResponse__ThreadEnvironment = { + readonly cwd: V2ThreadUnarchiveResponse__LegacyAppPathString; + readonly environmentId: string; + readonly runtimeWorkspaceRoots: ReadonlyArray; +}; +export const V2ThreadUnarchiveResponse__ThreadEnvironment = Schema.Struct({ + cwd: V2ThreadUnarchiveResponse__LegacyAppPathString, + environmentId: Schema.String, + runtimeWorkspaceRoots: Schema.Array(V2ThreadUnarchiveResponse__LegacyAppPathString), +}).annotate({ + description: "An environment selected by a loaded thread, independent of connection status.", +}); + export type V2ThreadUnarchiveResponse__ThreadExtra = { readonly [x: string]: Schema.Json }; export const V2ThreadUnarchiveResponse__ThreadExtra = Schema.Record( Schema.String, Schema.Json.annotate({ expected: "JSON value" }), ).annotate({ description: "Extra app-server data for a thread." }); -export type V2ThreadUnarchiveResponse__ThreadHistoryMode = "legacy" | "paginated"; -export const V2ThreadUnarchiveResponse__ThreadHistoryMode = Schema.Literals([ - "legacy", - "paginated", -]); - export type V2ThreadUnsubscribeParams = { readonly threadId: string }; export const V2ThreadUnsubscribeParams = Schema.Struct({ threadId: Schema.String }).annotate({ title: "ThreadUnsubscribeParams", @@ -44805,6 +56550,7 @@ export type V2TurnStartParams = { readonly approvalsReviewer?: V2TurnStartParams__ApprovalsReviewer | null; readonly clientUserMessageId?: string | null; readonly cwd?: string | null; + readonly disabledPluginIds?: ReadonlyArray | null; readonly effort?: V2TurnStartParams__ReasoningEffort | null; readonly input: ReadonlyArray; readonly model?: string | null; @@ -44812,8 +56558,11 @@ export type V2TurnStartParams = { readonly personality?: V2TurnStartParams__Personality | null; readonly sandboxPolicy?: V2TurnStartParams__SandboxPolicy | null; readonly serviceTier?: string | null; + readonly serviceTierForTurn?: string | null; readonly summary?: V2TurnStartParams__ReasoningSummary | null; readonly threadId: string; + readonly toolOutput?: V2TurnStartParams__TurnToolOutput | null; + readonly turnTrigger?: string | null; }; export const V2TurnStartParams = Schema.Struct({ approvalPolicy: Schema.optionalKey( @@ -44836,6 +56585,15 @@ export const V2TurnStartParams = Schema.Struct({ Schema.Null, ]), ), + disabledPluginIds: Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String).annotate({ + description: + "Replace this thread's disabled plugin IDs. Omitted/null preserves the list; [] clears it.", + }), + Schema.Null, + ]), + ), effort: Schema.optionalKey( Schema.Union([V2TurnStartParams__ReasoningEffort, Schema.Null]).annotate({ description: "Override the reasoning effort for this turn and subsequent turns.", @@ -44859,7 +56617,8 @@ export const V2TurnStartParams = Schema.Struct({ ), personality: Schema.optionalKey( Schema.Union([V2TurnStartParams__Personality, Schema.Null]).annotate({ - description: "Override the personality for this turn and subsequent turns.", + description: + "@deprecated `friendly` and `pragmatic` no longer select a style. Changing this does not rewrite the thread's existing instructions.", }), ), sandboxPolicy: Schema.optionalKey( @@ -44875,12 +56634,31 @@ export const V2TurnStartParams = Schema.Struct({ Schema.Null, ]), ), + serviceTierForTurn: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Override the service tier only when this request starts a new turn. Use \"default\" for standard speed. Omitted or null inherits the thread's tier. Does not change the thread's tier or a turn being steered.", + }), + Schema.Null, + ]), + ), summary: Schema.optionalKey( Schema.Union([V2TurnStartParams__ReasoningSummary, Schema.Null]).annotate({ description: "Override the reasoning summary for this turn and subsequent turns.", }), ), threadId: Schema.String, + toolOutput: Schema.optionalKey(Schema.Union([V2TurnStartParams__TurnToolOutput, Schema.Null])), + turnTrigger: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + description: + "Optional source classification for the caller that starts this turn. Ignored when this request steers an already-active turn.", + }), + Schema.Null, + ]), + ), }).annotate({ title: "TurnStartParams" }); export type V2TurnStartParams__AdditionalContextEntry = { @@ -44901,6 +56679,16 @@ export const V2TurnStartParams__CollaborationMode = Schema.Struct({ settings: V2TurnStartParams__Settings, }).annotate({ description: "Collaboration mode for a Codex session." }); +export type V2TurnStartParams__CyberAccessProgram = "standard" | "daybreakBlue" | "daybreakRed"; +export const V2TurnStartParams__CyberAccessProgram = Schema.Literals([ + "standard", + "daybreakBlue", + "daybreakRed", +]).annotate({ + description: + "Requested cyber treatment for a ChatGPT-authenticated Codex turn. Authorization and model-tier restrictions remain server-owned.", +}); + export type V2TurnStartParams__MultiAgentMode = | "explicitRequestOnly" | "proactive" diff --git a/packages/effect-codex-app-server/src/client.test.ts b/packages/effect-codex-app-server/src/client.test.ts index 3830c5fc5f6f..f7eca6207ca7 100644 --- a/packages/effect-codex-app-server/src/client.test.ts +++ b/packages/effect-codex-app-server/src/client.test.ts @@ -95,6 +95,7 @@ it.layer(NodeServices.layer)("effect-codex-app-server client", (it) => { assert.equal(result.skills.data[0]?.skills.length, 0); assert.deepEqual(yield* Ref.get(userInputRequests), [ { + isBlocking: true, itemId: "item-approval-1", threadId: "thread-1", turnId: "turn-1", diff --git a/packages/effect-codex-app-server/src/schema.test.ts b/packages/effect-codex-app-server/src/schema.test.ts index 0c9fc3561002..8e2160fdd517 100644 --- a/packages/effect-codex-app-server/src/schema.test.ts +++ b/packages/effect-codex-app-server/src/schema.test.ts @@ -6,7 +6,6 @@ import * as CodexSchema from "./schema.ts"; const isGetAccountResponse = Schema.is(CodexSchema.V2GetAccountResponse); const isThreadReadResponse = Schema.is(CodexSchema.V2ThreadReadResponse); const isThreadResumeResponse = Schema.is(CodexSchema.V2ThreadResumeResponse); -const isThreadRollbackResponse = Schema.is(CodexSchema.V2ThreadRollbackResponse); const isThreadForkResponse = Schema.is(CodexSchema.V2ThreadForkResponse); const isTurnCompletedNotification = Schema.is(CodexSchema.V2TurnCompletedNotification); const decodeThreadResumeResponse = Schema.decodeUnknownSync(CodexSchema.V2ThreadResumeResponse); @@ -76,6 +75,7 @@ it("accepts Codex 0.150 multi-agent values", () => { id: "root-thread", modelProvider: "openai", preview: "", + projectId: null, sessionId: "session-1", source: "cli", status: { type: "idle" }, @@ -112,6 +112,7 @@ it("accepts Codex rate limit errors for thread responses", () => { id: "thread-1", modelProvider: "openai", preview: "", + projectId: null, sessionId: "session-1", source: "cli", status: { type: "idle" }, @@ -141,7 +142,6 @@ it("accepts Codex rate limit errors for thread responses", () => { }), true, ); - assert.equal(isThreadRollbackResponse({ thread: failedThread }), true); }); it("accepts Codex misalignment policy errors for thread responses", () => { @@ -153,6 +153,7 @@ it("accepts Codex misalignment policy errors for thread responses", () => { id: "thread-1", modelProvider: "openai", preview: "", + projectId: null, sessionId: "session-1", source: "cli", status: { type: "idle" }, @@ -180,7 +181,6 @@ it("accepts Codex misalignment policy errors for thread responses", () => { }; assert.equal(isThreadReadResponse({ thread: failedThread }), true); assert.equal(isThreadResumeResponse(resumeLikeResponse), true); - assert.equal(isThreadRollbackResponse({ thread: failedThread }), true); assert.equal(isThreadForkResponse(resumeLikeResponse), true); const decodedResume = decodeThreadResumeResponse(resumeLikeResponse); assert.equal(decodedResume.thread.turns[0]?.error?.codexErrorInfo, "misalignmentPolicyViolation"); diff --git a/packages/effect-codex-app-server/test/fixtures/codex-app-server-mock-peer.ts b/packages/effect-codex-app-server/test/fixtures/codex-app-server-mock-peer.ts index 3f2a213d38c7..59e5eb28faf9 100644 --- a/packages/effect-codex-app-server/test/fixtures/codex-app-server-mock-peer.ts +++ b/packages/effect-codex-app-server/test/fixtures/codex-app-server-mock-peer.ts @@ -84,6 +84,7 @@ const handleMethod = (message: Record) => { case "skills/list": { pendingSkillsListRequestId = message.id as number | string; pendingUserInputRequestId = sendRequest("item/tool/requestUserInput", { + isBlocking: true, itemId: "item-approval-1", threadId: "thread-1", turnId: "turn-1", From 0109670411d13b9e380766e98b386b2f756ecf5b Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 14:41:49 -0700 Subject: [PATCH 06/58] feat(threads): add per-thread auto-settle switch (#11846) Co-authored-by: Claude Opus 5.5 (1M context) --- apps/desktop/src/electron/ElectronMenu.ts | 2 + apps/mobile/src/components/AppSymbol.tsx | 1 + .../src/features/home/HomeRouteScreen.tsx | 2 + apps/mobile/src/features/home/HomeScreen.tsx | 23 +++ .../src/features/home/useThreadListActions.ts | 46 ++++++ .../threads/ThreadNavigationSidebar.tsx | 14 ++ .../features/threads/thread-list-v2-items.tsx | 58 ++++++- apps/mobile/src/state/use-thread-selection.ts | 1 + .../src/environment/ServerEnvironment.ts | 1 + .../Layers/ProjectionPipeline.ts | 16 ++ .../Layers/ProjectionSnapshotQuery.test.ts | 2 + .../Layers/ProjectionSnapshotQuery.ts | 10 ++ apps/server/src/orchestration/Schemas.ts | 2 + .../ThreadSettlementPolicy.test.ts | 24 +++ .../orchestration/ThreadSettlementPolicy.ts | 1 + .../decider.autoSettleSet.test.ts | 154 ++++++++++++++++++ apps/server/src/orchestration/decider.ts | 36 +++- .../projector.autoSettleSet.test.ts | 105 ++++++++++++ .../src/orchestration/projector.test.ts | 1 + apps/server/src/orchestration/projector.ts | 13 ++ .../persistence/Layers/ProjectionThreads.ts | 4 + apps/server/src/persistence/Migrations.ts | 2 + ...jectionThreadsAutoSettleDisabledAt.test.ts | 41 +++++ ...4_ProjectionThreadsAutoSettleDisabledAt.ts | 15 ++ .../persistence/Services/ProjectionThreads.ts | 1 + .../src/project/AgentSessionImporter.ts | 1 + apps/web/src/components/Sidebar.tsx | 25 +++ .../components/threadActionMenu.logic.test.ts | 46 +++++- .../src/components/threadActionMenu.logic.ts | 32 ++++ apps/web/src/contextMenuFallback.ts | 23 ++- apps/web/src/hooks/useThreadActionMenu.ts | 11 ++ apps/web/src/hooks/useThreadActions.ts | 39 +++++ apps/web/src/state/entities.ts | 9 + docs/user/thread-sidebar.md | 5 + .../client-runtime/src/operations/commands.ts | 11 ++ .../src/state/threadCommands.ts | 9 + .../client-runtime/src/state/threadDetail.ts | 1 + .../src/state/threadReducer.test.ts | 40 +++++ .../client-runtime/src/state/threadReducer.ts | 11 ++ packages/contracts/src/environment.ts | 3 + packages/contracts/src/ipc.ts | 4 + packages/contracts/src/orchestration.ts | 28 ++++ 42 files changed, 862 insertions(+), 11 deletions(-) create mode 100644 apps/server/src/orchestration/decider.autoSettleSet.test.ts create mode 100644 apps/server/src/orchestration/projector.autoSettleSet.test.ts create mode 100644 apps/server/src/persistence/Migrations/054_ProjectionThreadsAutoSettleDisabledAt.test.ts create mode 100644 apps/server/src/persistence/Migrations/054_ProjectionThreadsAutoSettleDisabledAt.ts diff --git a/apps/desktop/src/electron/ElectronMenu.ts b/apps/desktop/src/electron/ElectronMenu.ts index ce9e0fb48979..1360fb545bd0 100644 --- a/apps/desktop/src/electron/ElectronMenu.ts +++ b/apps/desktop/src/electron/ElectronMenu.ts @@ -80,6 +80,7 @@ function normalizeContextMenuItems(source: readonly ContextMenuItem[]): ContextM destructive: sourceItem.destructive === true, disabled: sourceItem.disabled === true, ...(sourceItem.separatorBefore === true ? { separatorBefore: true } : {}), + ...(typeof sourceItem.checked === "boolean" ? { checked: sourceItem.checked } : {}), }; if (sourceItem.children) { @@ -168,6 +169,7 @@ export const make = Effect.gen(function* () { const itemOption: Electron.MenuItemConstructorOptions = { label: item.label, enabled: !item.disabled, + ...(typeof item.checked === "boolean" ? { type: "checkbox", checked: item.checked } : {}), }; if (item.children && item.children.length > 0) { itemOption.submenu = buildTemplate(item.children, complete); diff --git a/apps/mobile/src/components/AppSymbol.tsx b/apps/mobile/src/components/AppSymbol.tsx index d85d9db7d780..eef05ee94f40 100644 --- a/apps/mobile/src/components/AppSymbol.tsx +++ b/apps/mobile/src/components/AppSymbol.tsx @@ -140,6 +140,7 @@ const ANDROID_ICON_BY_SF_SYMBOL = { "checkmark.circle": IconCircleCheck, circle: IconCircle, clock: IconClock, + timer: IconClock, ticket: IconTicket, cloud: IconCloud, cube: IconBox, diff --git a/apps/mobile/src/features/home/HomeRouteScreen.tsx b/apps/mobile/src/features/home/HomeRouteScreen.tsx index c480d0be48f1..05070397cef5 100644 --- a/apps/mobile/src/features/home/HomeRouteScreen.tsx +++ b/apps/mobile/src/features/home/HomeRouteScreen.tsx @@ -49,6 +49,7 @@ export function HomeRouteScreen() { unsnoozeThread, pinThread, unpinThread, + setThreadAutoSettle, moveThread, renameThread, regenerateThreadTitle, @@ -206,6 +207,7 @@ export function HomeRouteScreen() { onUnsettleThread={unsettleThread} onPinThread={pinThread} onUnpinThread={unpinThread} + onSetThreadAutoSettle={setThreadAutoSettle} onMoveThread={moveThread} onRenameThread={renameThread} onRegenerateThreadTitle={regenerateThreadTitle} diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx index 4fb442b94273..7f4bfcf3a1c4 100644 --- a/apps/mobile/src/features/home/HomeScreen.tsx +++ b/apps/mobile/src/features/home/HomeScreen.tsx @@ -96,6 +96,10 @@ interface HomeScreenProps { readonly onUnsettleThread: (thread: EnvironmentThreadShell) => void; readonly onPinThread: (thread: EnvironmentThreadShell) => Promise; readonly onUnpinThread: (thread: EnvironmentThreadShell) => Promise; + readonly onSetThreadAutoSettle: ( + thread: EnvironmentThreadShell, + enabled: boolean, + ) => Promise; readonly onMoveThread: ( thread: EnvironmentThreadShell, direction: ThreadMoveDestination, @@ -378,6 +382,12 @@ export function HomeScreen(props: HomeScreenProps) { }, [props.onUnpinThread], ); + const handleSetThreadAutoSettle = useCallback( + (thread: EnvironmentThreadShell, enabled: boolean) => { + void props.onSetThreadAutoSettle(thread, enabled); + }, + [props.onSetThreadAutoSettle], + ); const handleRegenerateThreadTitle = useCallback( (thread: EnvironmentThreadShell) => { void props.onRegenerateThreadTitle(thread); @@ -456,6 +466,15 @@ export function HomeScreen(props: HomeScreenProps) { } return supported; }, [serverConfigs]); + const autoSettleOptOutEnvironmentIds = useMemo(() => { + const supported = new Set(); + for (const [environmentId, config] of serverConfigs) { + if (config.environment.capabilities.threadAutoSettleOptOut === true) { + supported.add(environmentId); + } + } + return supported; + }, [serverConfigs]); const pinReorderEnvironmentIds = useMemo(() => { const supported = new Set(); for (const [environmentId, config] of serverConfigs) { @@ -726,6 +745,7 @@ export function HomeScreen(props: HomeScreenProps) { onSettleThread={handleSettleThread} snoozeSupported={snoozeEnvironmentIds.has(thread.environmentId)} pinningSupported={pinningEnvironmentIds.has(thread.environmentId)} + autoSettleOptOutSupported={autoSettleOptOutEnvironmentIds.has(thread.environmentId)} reorderSupported={ item.item.pinned ? pinReorderEnvironmentIds.has(thread.environmentId) @@ -738,6 +758,7 @@ export function HomeScreen(props: HomeScreenProps) { onUnsettleThread={handleUnsettleThread} onPinThread={handlePinThread} onUnpinThread={handleUnpinThread} + onSetThreadAutoSettle={handleSetThreadAutoSettle} onMoveThread={handleMoveThread} onSwipeableClose={handleSwipeableClose} onSwipeableWillOpen={handleSwipeableWillOpen} @@ -758,6 +779,8 @@ export function HomeScreen(props: HomeScreenProps) { handleSwipeableClose, handleSwipeableWillOpen, handleUnsettleThread, + handleSetThreadAutoSettle, + autoSettleOptOutEnvironmentIds, pinningEnvironmentIds, machineByEnvironmentId, pinReorderEnvironmentIds, diff --git a/apps/mobile/src/features/home/useThreadListActions.ts b/apps/mobile/src/features/home/useThreadListActions.ts index 9b599110883c..4a43facc6172 100644 --- a/apps/mobile/src/features/home/useThreadListActions.ts +++ b/apps/mobile/src/features/home/useThreadListActions.ts @@ -59,6 +59,15 @@ function environmentSupportsPinReorder(environmentId: EnvironmentThreadShell["en ); } +function environmentSupportsAutoSettleOptOut( + environmentId: EnvironmentThreadShell["environmentId"], +) { + return ( + appAtomRegistry.get(environmentServerConfigsAtom).get(environmentId)?.environment.capabilities + .threadAutoSettleOptOut === true + ); +} + function environmentSupportsTitleRegeneration( environmentId: EnvironmentThreadShell["environmentId"], ) { @@ -237,6 +246,11 @@ export function useThreadListActions(): { readonly unsettleThread: (thread: EnvironmentThreadShell) => Promise; readonly pinThread: (thread: EnvironmentThreadShell) => Promise; readonly unpinThread: (thread: EnvironmentThreadShell) => Promise; + /** Sets per-thread automatic settlement on or off. */ + readonly setThreadAutoSettle: ( + thread: EnvironmentThreadShell, + enabled: boolean, + ) => Promise; readonly moveThread: ( thread: EnvironmentThreadShell, direction: ThreadMoveDestination, @@ -249,6 +263,9 @@ export function useThreadListActions(): { const unsnoozeMutation = useAtomCommand(threadEnvironment.unsnooze, { reportFailure: false }); const pinMutation = useAtomCommand(threadEnvironment.pin, { reportFailure: false }); const unpinMutation = useAtomCommand(threadEnvironment.unpin, { reportFailure: false }); + const setAutoSettleMutation = useAtomCommand(threadEnvironment.setAutoSettle, { + reportFailure: false, + }); const updateThreadMetadata = useAtomCommand(threadEnvironment.updateMetadata, { reportFailure: false, }); @@ -435,6 +452,34 @@ export function useThreadListActions(): { }, [unpinMutation], ); + const setThreadAutoSettle = useCallback( + async (thread: EnvironmentThreadShell, enabled: boolean) => { + if (!environmentSupportsAutoSettleOptOut(thread.environmentId)) { + Alert.alert( + "Could not update auto-settle", + "This environment's server does not support turning auto-settle off per thread yet. Update the server to use it.", + ); + return false; + } + selectionHaptic(); + const result = await setAutoSettleMutation({ + environmentId: thread.environmentId, + input: { threadId: thread.id, enabled }, + }); + if (result._tag === "Failure") { + const error = Cause.squash(result.cause); + Alert.alert( + "Could not update auto-settle", + error instanceof Error && error.message.trim().length > 0 + ? error.message + : "The auto-settle setting could not be changed.", + ); + return false; + } + return true; + }, + [setAutoSettleMutation], + ); const regenerateThreadTitle = useCallback( async (thread: EnvironmentThreadShell) => { const key = scopedThreadKey(thread.environmentId, thread.id); @@ -698,6 +743,7 @@ export function useThreadListActions(): { unsettleThread, pinThread, unpinThread, + setThreadAutoSettle, moveThread, renameThread, regenerateThreadTitle, diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx index 160392fdd5d9..c478bae6312a 100644 --- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx +++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx @@ -150,6 +150,7 @@ function ThreadNavigationSidebarPane( unsettleThread, pinThread, unpinThread, + setThreadAutoSettle, moveThread, renameThread, regenerateThreadTitle, @@ -334,6 +335,15 @@ function ThreadNavigationSidebarPane( } return supported; }, [serverConfigs]); + const autoSettleOptOutEnvironmentIds = useMemo(() => { + const supported = new Set(); + for (const [environmentId, config] of serverConfigs) { + if (config.environment.capabilities.threadAutoSettleOptOut === true) { + supported.add(environmentId); + } + } + return supported; + }, [serverConfigs]); const pinReorderEnvironmentIds = useMemo(() => { const supported = new Set(); for (const [environmentId, config] of serverConfigs) { @@ -766,6 +776,7 @@ function ThreadNavigationSidebarPane( onSettleThread={settleThread} snoozeSupported={snoozeEnvironmentIds.has(thread.environmentId)} pinningSupported={pinningEnvironmentIds.has(thread.environmentId)} + autoSettleOptOutSupported={autoSettleOptOutEnvironmentIds.has(thread.environmentId)} reorderSupported={ item.item.pinned ? pinReorderEnvironmentIds.has(thread.environmentId) @@ -778,6 +789,7 @@ function ThreadNavigationSidebarPane( onUnsettleThread={unsettleThread} onPinThread={pinThread} onUnpinThread={unpinThread} + onSetThreadAutoSettle={setThreadAutoSettle} onMoveThread={moveThread} onSwipeableClose={handleSwipeableClose} onSwipeableWillOpen={handleSwipeableWillOpen} @@ -829,6 +841,8 @@ function ThreadNavigationSidebarPane( pinReorderEnvironmentIds, pinThread, pinningEnvironmentIds, + autoSettleOptOutEnvironmentIds, + setThreadAutoSettle, projectByKey, projectTitleByProjectKey, regenerateThreadTitle, diff --git a/apps/mobile/src/features/threads/thread-list-v2-items.tsx b/apps/mobile/src/features/threads/thread-list-v2-items.tsx index 43c5de09c726..e2dd3cc725df 100644 --- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx +++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx @@ -493,6 +493,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { readonly onArchiveThread: (thread: EnvironmentThreadShell) => void; readonly onPinThread: (thread: EnvironmentThreadShell) => void; readonly onUnpinThread: (thread: EnvironmentThreadShell) => void; + readonly onSetThreadAutoSettle: (thread: EnvironmentThreadShell, enabled: boolean) => void; /** False on environments whose server predates thread.settle/unsettle: swipe + menu fall back to Archive instead of failing on use. */ readonly settlementSupported: boolean; @@ -500,6 +501,8 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { readonly snoozeSupported: boolean; /** False on servers that predate thread.pin/unpin. */ readonly pinningSupported: boolean; + /** False on servers that predate thread.auto-settle.set. */ + readonly autoSettleOptOutSupported: boolean; /** False on servers that predate thread title regeneration. */ readonly titleRegenerationSupported: boolean; /** Server supports reordering this card's section. */ @@ -536,6 +539,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { onArchiveThread, onPinThread, onUnpinThread, + onSetThreadAutoSettle, onMoveThread, } = props; const snoozedRow = props.snoozed === true; @@ -583,6 +587,10 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { const handleUnsettle = useCallback(() => onUnsettleThread(thread), [onUnsettleThread, thread]); const handlePin = useCallback(() => onPinThread(thread), [onPinThread, thread]); const handleUnpin = useCallback(() => onUnpinThread(thread), [onUnpinThread, thread]); + const handleSetAutoSettle = useCallback( + (enabled: boolean) => onSetThreadAutoSettle(thread, enabled), + [onSetThreadAutoSettle, thread], + ); const handleMoveUp = useCallback(() => onMoveThread?.(thread, "up"), [onMoveThread, thread]); const handleMoveDown = useCallback(() => onMoveThread?.(thread, "down"), [onMoveThread, thread]); const handleArchive = useCallback(() => onArchiveThread(thread), [onArchiveThread, thread]); @@ -661,6 +669,33 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { variant, ], ); + // A submenu with the current option checked, matching web. This is a + // per-thread setting, not a lifecycle verb. + const autoSettleMenuItems = useMemo( + () => + props.autoSettleOptOutSupported + ? [ + { + id: "auto-settle", + title: "Auto-settle behavior", + image: "timer", + subactions: [ + { + id: "auto-settle:enabled", + title: "Enabled", + state: thread.autoSettleDisabledAt == null ? "on" : "off", + }, + { + id: "auto-settle:disabled", + title: "Disabled", + state: thread.autoSettleDisabledAt == null ? "off" : "on", + }, + ], + } satisfies MenuAction, + ] + : [], + [props.autoSettleOptOutSupported, thread.autoSettleDisabledAt], + ); const titleMenuItems = useMemo( () => [ { id: "rename", title: "Rename", image: "square.and.pencil" }, @@ -682,19 +717,23 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { }, ...arrangementMenuItems, ...titleMenuItems, + ...autoSettleMenuItems, { id: "delete", title: "Delete", image: "trash", attributes: { destructive: true } }, ], - [arrangementMenuItems, snoozePresetActions, titleMenuItems], + [arrangementMenuItems, autoSettleMenuItems, snoozePresetActions, titleMenuItems], ); const cardMenuActions = useMemo( () => [ CARD_MENU_ACTIONS[0]!, ...arrangementMenuItems, ...titleMenuItems, + ...autoSettleMenuItems, ...CARD_MENU_ACTIONS.slice(1), ], - [arrangementMenuItems, titleMenuItems], + [arrangementMenuItems, autoSettleMenuItems, titleMenuItems], ); + // Settled and snoozed rows keep the setting too, matching web where every + // row shares one menu builder. const slimMenuActions = useMemo( () => [ SLIM_MENU_ACTIONS[0]!, @@ -702,13 +741,19 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { (action) => action.id !== "move-up" && action.id !== "move-down", ), ...titleMenuItems, + ...autoSettleMenuItems, SLIM_MENU_ACTIONS[1]!, ], - [arrangementMenuItems, titleMenuItems], + [arrangementMenuItems, autoSettleMenuItems, titleMenuItems], ); const snoozedMenuActions = useMemo( - () => [SNOOZED_MENU_ACTIONS[0]!, ...titleMenuItems, SNOOZED_MENU_ACTIONS[1]!], - [titleMenuItems], + () => [ + SNOOZED_MENU_ACTIONS[0]!, + ...titleMenuItems, + ...autoSettleMenuItems, + SNOOZED_MENU_ACTIONS[1]!, + ], + [autoSettleMenuItems, titleMenuItems], ); const legacyMenuActions = useMemo( () => [ @@ -727,6 +772,8 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { if (nativeEvent.event === "unsnooze") handleUnsnooze(); if (nativeEvent.event === "pin") handlePin(); if (nativeEvent.event === "unpin") handleUnpin(); + if (nativeEvent.event === "auto-settle:enabled") handleSetAutoSettle(true); + if (nativeEvent.event === "auto-settle:disabled") handleSetAutoSettle(false); if (nativeEvent.event === "arrange") appAtomRegistry.set(threadArrangementOpenAtom, true); if (nativeEvent.event === "move-up") handleMoveUp(); if (nativeEvent.event === "move-down") handleMoveDown(); @@ -764,6 +811,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { handlePin, handleSettle, handleSnooze, + handleSetAutoSettle, handleUnpin, handleUnsettle, handleUnsnooze, diff --git a/apps/mobile/src/state/use-thread-selection.ts b/apps/mobile/src/state/use-thread-selection.ts index d922eb7f6d5c..108afbbc9416 100644 --- a/apps/mobile/src/state/use-thread-selection.ts +++ b/apps/mobile/src/state/use-thread-selection.ts @@ -74,6 +74,7 @@ function threadDetailToShell( settledAt: thread.settledAt, unsettledAt: thread.unsettledAt, activeOrderKey: thread.activeOrderKey, + autoSettleDisabledAt: thread.autoSettleDisabledAt, pinnedAt: thread.pinnedAt, pinOrderKey: thread.pinOrderKey, snoozedUntil: thread.snoozedUntil ?? null, diff --git a/apps/server/src/environment/ServerEnvironment.ts b/apps/server/src/environment/ServerEnvironment.ts index a36c0a03b6f2..17fe73cc326f 100644 --- a/apps/server/src/environment/ServerEnvironment.ts +++ b/apps/server/src/environment/ServerEnvironment.ts @@ -236,6 +236,7 @@ export const make = Effect.gen(function* () { threadPinning: true, threadPinReorder: true, threadActiveReorder: true, + threadAutoSettleOptOut: true, threadTitleRegeneration: true, threadPullRequests: true, pullRequestStackActions: true, diff --git a/apps/server/src/orchestration/Layers/ProjectionPipeline.ts b/apps/server/src/orchestration/Layers/ProjectionPipeline.ts index b5e6cb0cdd54..4163168157e7 100644 --- a/apps/server/src/orchestration/Layers/ProjectionPipeline.ts +++ b/apps/server/src/orchestration/Layers/ProjectionPipeline.ts @@ -633,6 +633,7 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti pinnedAt: null, pinOrderKey: null, activeOrderKey: null, + autoSettleDisabledAt: null, titleRegenerationRequestId: null, titleRegenerationStartedAt: null, latestUserMessageAt: null, @@ -782,6 +783,21 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti return; } + case "thread.auto-settle-set": { + const existingRow = yield* projectionThreadRepository.getById({ + threadId: event.payload.threadId, + }); + if (Option.isNone(existingRow)) { + return; + } + yield* projectionThreadRepository.upsert({ + ...existingRow.value, + autoSettleDisabledAt: event.payload.autoSettleDisabledAt, + updatedAt: event.payload.updatedAt, + }); + return; + } + case "thread.pin-reordered": { const existingRow = yield* projectionThreadRepository.getById({ threadId: event.payload.threadId, diff --git a/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts b/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts index 843eb8343d84..890c8ae55c53 100644 --- a/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts +++ b/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts @@ -485,6 +485,7 @@ projectionSnapshotLayer("ProjectionSnapshotQuery", (it) => { pinnedAt: "2026-02-24T00:00:01.000Z", pinOrderKey: "gm", activeOrderKey: "hq", + autoSettleDisabledAt: null, titleRegeneration: null, titleState: null, deletedAt: null, @@ -611,6 +612,7 @@ projectionSnapshotLayer("ProjectionSnapshotQuery", (it) => { pinnedAt: "2026-02-24T00:00:01.000Z", pinOrderKey: "gm", activeOrderKey: "hq", + autoSettleDisabledAt: null, titleRegeneration: null, titleState: null, session: { diff --git a/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts b/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts index 1e7058742e25..1b44054c7a32 100644 --- a/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts +++ b/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts @@ -587,6 +587,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () { pinned_at AS "pinnedAt", pin_order_key AS "pinOrderKey", active_order_key AS "activeOrderKey", + auto_settle_disabled_at AS "autoSettleDisabledAt", title_regeneration_request_id AS "titleRegenerationRequestId", title_regeneration_started_at AS "titleRegenerationStartedAt", latest_user_message_at AS "latestUserMessageAt", @@ -628,6 +629,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () { pinned_at AS "pinnedAt", pin_order_key AS "pinOrderKey", active_order_key AS "activeOrderKey", + auto_settle_disabled_at AS "autoSettleDisabledAt", title_regeneration_request_id AS "titleRegenerationRequestId", title_regeneration_started_at AS "titleRegenerationStartedAt", latest_user_message_at AS "latestUserMessageAt", @@ -701,6 +703,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () { pinned_at AS "pinnedAt", pin_order_key AS "pinOrderKey", active_order_key AS "activeOrderKey", + auto_settle_disabled_at AS "autoSettleDisabledAt", title_regeneration_request_id AS "titleRegenerationRequestId", title_regeneration_started_at AS "titleRegenerationStartedAt", latest_user_message_at AS "latestUserMessageAt", @@ -1266,6 +1269,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () { pinned_at AS "pinnedAt", pin_order_key AS "pinOrderKey", active_order_key AS "activeOrderKey", + auto_settle_disabled_at AS "autoSettleDisabledAt", title_regeneration_request_id AS "titleRegenerationRequestId", title_regeneration_started_at AS "titleRegenerationStartedAt", latest_user_message_at AS "latestUserMessageAt", @@ -2341,6 +2345,7 @@ pending_approval_requests AS ( pinnedAt: row.pinnedAt, pinOrderKey: row.pinOrderKey ?? null, activeOrderKey: row.activeOrderKey ?? null, + autoSettleDisabledAt: row.autoSettleDisabledAt ?? null, titleRegeneration: mapTitleRegeneration(row), titleState: row.titleState, deletedAt: row.deletedAt, @@ -2586,6 +2591,7 @@ pending_approval_requests AS ( pinnedAt: row.pinnedAt, pinOrderKey: row.pinOrderKey ?? null, activeOrderKey: row.activeOrderKey ?? null, + autoSettleDisabledAt: row.autoSettleDisabledAt ?? null, titleRegeneration: mapTitleRegeneration(row), titleState: row.titleState, deletedAt: row.deletedAt, @@ -2742,6 +2748,7 @@ pending_approval_requests AS ( pinnedAt: row.pinnedAt, pinOrderKey: row.pinOrderKey ?? null, activeOrderKey: row.activeOrderKey ?? null, + autoSettleDisabledAt: row.autoSettleDisabledAt ?? null, titleRegeneration: mapTitleRegeneration(row), titleState: row.titleState, session: sessionByThread.get(row.threadId) ?? null, @@ -2905,6 +2912,7 @@ pending_approval_requests AS ( pinnedAt: row.pinnedAt, pinOrderKey: row.pinOrderKey ?? null, activeOrderKey: row.activeOrderKey ?? null, + autoSettleDisabledAt: row.autoSettleDisabledAt ?? null, titleRegeneration: mapTitleRegeneration(row), titleState: row.titleState, session: sessionByThread.get(row.threadId) ?? null, @@ -3261,6 +3269,7 @@ pending_approval_requests AS ( pinnedAt: threadRow.value.pinnedAt, pinOrderKey: threadRow.value.pinOrderKey ?? null, activeOrderKey: threadRow.value.activeOrderKey ?? null, + autoSettleDisabledAt: threadRow.value.autoSettleDisabledAt ?? null, titleRegeneration: mapTitleRegeneration(threadRow.value), titleState: threadRow.value.titleState, session: Option.isSome(sessionRow) ? mapSessionRow(sessionRow.value) : null, @@ -3562,6 +3571,7 @@ pending_approval_requests AS ( pinnedAt: threadRow.value.pinnedAt, pinOrderKey: threadRow.value.pinOrderKey ?? null, activeOrderKey: threadRow.value.activeOrderKey ?? null, + autoSettleDisabledAt: threadRow.value.autoSettleDisabledAt ?? null, titleRegeneration: mapTitleRegeneration(threadRow.value), titleState: threadRow.value.titleState, deletedAt: null, diff --git a/apps/server/src/orchestration/Schemas.ts b/apps/server/src/orchestration/Schemas.ts index 29468dc3f84e..f4fe2e0104f6 100644 --- a/apps/server/src/orchestration/Schemas.ts +++ b/apps/server/src/orchestration/Schemas.ts @@ -16,6 +16,7 @@ import { ThreadPinnedPayload as ContractsThreadPinnedPayloadSchema, ThreadUnpinnedPayload as ContractsThreadUnpinnedPayloadSchema, ThreadPinReorderedPayload as ContractsThreadPinReorderedPayloadSchema, + ThreadAutoSettleSetPayload as ContractsThreadAutoSettleSetPayloadSchema, ThreadPullRequestLinkedPayload as ContractsThreadPullRequestLinkedPayloadSchema, ThreadPullRequestUnlinkedPayload as ContractsThreadPullRequestUnlinkedPayloadSchema, ThreadPullRequestSyncedPayload as ContractsThreadPullRequestSyncedPayloadSchema, @@ -51,6 +52,7 @@ export const ThreadUnsnoozedPayload = ContractsThreadUnsnoozedPayloadSchema; export const ThreadPinnedPayload = ContractsThreadPinnedPayloadSchema; export const ThreadUnpinnedPayload = ContractsThreadUnpinnedPayloadSchema; export const ThreadPinReorderedPayload = ContractsThreadPinReorderedPayloadSchema; +export const ThreadAutoSettleSetPayload = ContractsThreadAutoSettleSetPayloadSchema; export const ThreadPullRequestLinkedPayload = ContractsThreadPullRequestLinkedPayloadSchema; export const ThreadPullRequestUnlinkedPayload = ContractsThreadPullRequestUnlinkedPayloadSchema; export const ThreadPullRequestSyncedPayload = ContractsThreadPullRequestSyncedPayloadSchema; diff --git a/apps/server/src/orchestration/ThreadSettlementPolicy.test.ts b/apps/server/src/orchestration/ThreadSettlementPolicy.test.ts index 252b99439400..8a1588b18752 100644 --- a/apps/server/src/orchestration/ThreadSettlementPolicy.test.ts +++ b/apps/server/src/orchestration/ThreadSettlementPolicy.test.ts @@ -171,6 +171,15 @@ describe("resolveAutoSettlementAt", () => { it("blocks pins, snooze, pending work, live sessions, and queued starts", () => { expect(decide(makeThread({ settledOverride: "active" }))).toBe(false); + }); + + it("never settles a thread whose auto-settle is turned off, by inactivity or merge", () => { + const held = makeThread({ autoSettleDisabledAt: "2026-08-21T00:00:00.000Z" }); + expect(decide(held)).toBe(false); + expect( + decide(held, { state: "merged", mergedAt: "2026-08-21T00:00:00.000Z", closedAt: null }), + ).toBe(false); + expect(decide(makeThread({ autoSettleDisabledAt: null }))).toBe(true); expect(decide(makeThread({ snoozedUntil: "2026-08-29T00:00:00.000Z" }))).toBe(false); expect(decide(makeThread({ hasPendingApprovals: true }))).toBe(false); expect(decide(makeThread({ hasPendingUserInput: true }))).toBe(false); @@ -248,6 +257,21 @@ const terminalSnapshot = ( syncedAt: NOW, }); +describe("per-thread auto-settle opt out", () => { + it("blocks both inactivity and merge settlement while auto-settle is off", () => { + const merged = linkedRequest(1, terminalSnapshot("merged", NOW)); + expect(decide(makeThread({ latestUserMessageAt: "2026-08-01T00:00:00.000Z" }))).toBe(true); + expect(decide(makeThread({ pullRequests: [merged] }), null, { days: null })).toBe(true); + const held = { autoSettleDisabledAt: NOW }; + expect(decide(makeThread({ ...held, latestUserMessageAt: "2026-08-01T00:00:00.000Z" }))).toBe( + false, + ); + expect(decide(makeThread({ ...held, pullRequests: [merged] }), null, { days: null })).toBe( + false, + ); + }); +}); + describe("linked request settlement", () => { it.each(["closed", "merged"] as const)( "uses the latest actual %s transition despite later comments on another PR", diff --git a/apps/server/src/orchestration/ThreadSettlementPolicy.ts b/apps/server/src/orchestration/ThreadSettlementPolicy.ts index 92063745eff5..113d68204e59 100644 --- a/apps/server/src/orchestration/ThreadSettlementPolicy.ts +++ b/apps/server/src/orchestration/ThreadSettlementPolicy.ts @@ -117,6 +117,7 @@ export function resolveAutoSettlementAt(input: { /** Cheap checks that run before any source control lookup. */ export function isAutoSettlementCandidate(thread: OrchestrationThreadShell, now: string): boolean { if (thread.archivedAt !== null || thread.settledOverride !== null) return false; + if (thread.autoSettleDisabledAt != null) return false; if (thread.hasPendingApprovals || thread.hasPendingUserInput) return false; if (thread.session?.status === "starting" || thread.session?.status === "running") return false; if (thread.backgroundLiveness != null) return false; diff --git a/apps/server/src/orchestration/decider.autoSettleSet.test.ts b/apps/server/src/orchestration/decider.autoSettleSet.test.ts new file mode 100644 index 000000000000..99657069cc74 --- /dev/null +++ b/apps/server/src/orchestration/decider.autoSettleSet.test.ts @@ -0,0 +1,154 @@ +import { + CommandId, + ProjectId, + ProviderInstanceId, + ThreadId, + type OrchestrationReadModel, +} from "@t3tools/contracts"; +import * as NodeServices from "@effect/platform-node/NodeServices"; +import { expect, it } from "@effect/vitest"; +import * as Effect from "effect/Effect"; + +import { decideOrchestrationCommand } from "./decider.ts"; + +const NOW = "2026-01-01T00:00:00.000Z"; +const DISABLED_AT = "2025-12-30T00:00:00.000Z"; + +function makeReadModel(input: { + readonly autoSettleDisabledAt?: string | null; + readonly settledOverride?: "settled" | "active" | null; +}): OrchestrationReadModel { + return { + snapshotSequence: 0, + projects: [], + threads: [ + { + id: ThreadId.make("thread-1"), + projectId: ProjectId.make("project-1"), + title: "Thread", + modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" }, + runtimeMode: "full-access", + interactionMode: "default", + branch: null, + worktreePath: null, + pullRequests: [], + latestTurn: null, + createdAt: NOW, + updatedAt: NOW, + archivedAt: null, + settledOverride: input.settledOverride ?? null, + settledAt: input.settledOverride === "settled" ? NOW : null, + autoSettleDisabledAt: input.autoSettleDisabledAt ?? null, + deletedAt: null, + messages: [], + proposedPlans: [], + activities: [], + checkpoints: [], + session: null, + }, + ], + updatedAt: NOW, + }; +} + +const events = (event: Effect.Success>) => + Array.isArray(event) ? event : [event]; + +it.layer(NodeServices.layer)("thread.auto-settle.set decider", (it) => { + it.effect("turning auto-settle off stamps autoSettleDisabledAt and updatedAt together", () => + Effect.gen(function* () { + const [event] = events( + yield* decideOrchestrationCommand({ + command: { + type: "thread.auto-settle.set", + commandId: CommandId.make("cmd-off"), + threadId: ThreadId.make("thread-1"), + enabled: false, + }, + readModel: makeReadModel({}), + }), + ); + expect(event?.type).toBe("thread.auto-settle-set"); + if (event?.type === "thread.auto-settle-set") { + expect(event.payload.autoSettleDisabledAt).toBe(event.payload.updatedAt); + expect(event.payload.updatedAt).not.toBe(NOW); + } + }), + ); + + it.effect("turning it off again keeps the original stamp and updatedAt", () => + Effect.gen(function* () { + const [event] = events( + yield* decideOrchestrationCommand({ + command: { + type: "thread.auto-settle.set", + commandId: CommandId.make("cmd-off-again"), + threadId: ThreadId.make("thread-1"), + enabled: false, + }, + readModel: makeReadModel({ autoSettleDisabledAt: DISABLED_AT }), + }), + ); + expect(event?.type).toBe("thread.auto-settle-set"); + if (event?.type === "thread.auto-settle-set") { + expect(event.payload.autoSettleDisabledAt).toBe(DISABLED_AT); + expect(event.payload.updatedAt).toBe(NOW); + } + }), + ); + + it.effect("turning auto-settle back on clears the stamp", () => + Effect.gen(function* () { + const [event] = events( + yield* decideOrchestrationCommand({ + command: { + type: "thread.auto-settle.set", + commandId: CommandId.make("cmd-on"), + threadId: ThreadId.make("thread-1"), + enabled: true, + }, + readModel: makeReadModel({ autoSettleDisabledAt: DISABLED_AT }), + }), + ); + expect(event?.type).toBe("thread.auto-settle-set"); + if (event?.type === "thread.auto-settle-set") { + expect(event.payload.autoSettleDisabledAt).toBeNull(); + expect(event.payload.updatedAt).not.toBe(NOW); + } + }), + ); + + it.effect("automatic settlement is rejected while auto-settle is off", () => + Effect.gen(function* () { + const result = yield* Effect.exit( + decideOrchestrationCommand({ + command: { + type: "thread.auto-settle", + commandId: CommandId.make("cmd-auto"), + threadId: ThreadId.make("thread-1"), + snapshotSequence: 0, + settledAt: NOW, + }, + readModel: makeReadModel({ autoSettleDisabledAt: DISABLED_AT }), + }), + ); + expect(result._tag).toBe("Failure"); + }), + ); + + it.effect("a manual settle still works while auto-settle is off", () => + Effect.gen(function* () { + const [event] = events( + yield* decideOrchestrationCommand({ + command: { + type: "thread.settle", + commandId: CommandId.make("cmd-manual"), + threadId: ThreadId.make("thread-1"), + }, + readModel: makeReadModel({ autoSettleDisabledAt: DISABLED_AT }), + }), + ); + expect(event?.type).toBe("thread.settled"); + }), + ); +}); diff --git a/apps/server/src/orchestration/decider.ts b/apps/server/src/orchestration/decider.ts index 0119c0e8599a..b610f3868525 100644 --- a/apps/server/src/orchestration/decider.ts +++ b/apps/server/src/orchestration/decider.ts @@ -484,7 +484,10 @@ export const decideOrchestrationCommand = Effect.fn("decideOrchestrationCommand" command, threadId: command.threadId, }); - if (command.type === "thread.auto-settle" && thread.settledOverride !== null) { + if ( + command.type === "thread.auto-settle" && + (thread.settledOverride !== null || thread.autoSettleDisabledAt != null) + ) { return yield* Effect.fail( new OrchestrationCommandInvariantError({ commandType: command.type, @@ -860,6 +863,37 @@ export const decideOrchestrationCommand = Effect.fn("decideOrchestrationCommand" }; } + case "thread.auto-settle.set": { + const thread = yield* requireThreadNotArchived({ + readModel, + command, + threadId: command.threadId, + }); + // Idempotent by re-emission (see thread.unpin): setting the current + // state again keeps the existing timestamps so duplicates do not churn + // ordering. The flag is independent of the settled lifecycle: it only + // gates the automatic paths, so it never blocks a manual settle. + const currentlyDisabledAt = thread.autoSettleDisabledAt ?? null; + const unchanged = command.enabled + ? currentlyDisabledAt === null + : currentlyDisabledAt !== null; + const occurredAt = yield* nowIso; + return { + ...(yield* withEventBase({ + aggregateKind: "thread", + aggregateId: command.threadId, + occurredAt, + commandId: command.commandId, + })), + type: "thread.auto-settle-set", + payload: { + threadId: command.threadId, + autoSettleDisabledAt: command.enabled ? null : (currentlyDisabledAt ?? occurredAt), + updatedAt: unchanged ? thread.updatedAt : occurredAt, + }, + }; + } + case "thread.active.reorder": { const thread = yield* requireThreadNotArchived({ readModel, diff --git a/apps/server/src/orchestration/projector.autoSettleSet.test.ts b/apps/server/src/orchestration/projector.autoSettleSet.test.ts new file mode 100644 index 000000000000..cc12f6905910 --- /dev/null +++ b/apps/server/src/orchestration/projector.autoSettleSet.test.ts @@ -0,0 +1,105 @@ +import { + CommandId, + EventId, + ProjectId, + ThreadId, + type OrchestrationEvent, +} from "@t3tools/contracts"; +import { expect, it } from "@effect/vitest"; +import * as Effect from "effect/Effect"; + +import { createEmptyReadModel, projectEvent } from "./projector.ts"; + +function makeEvent(input: { + readonly sequence: number; + readonly type: OrchestrationEvent["type"]; + readonly payload: unknown; +}): OrchestrationEvent { + return { + sequence: input.sequence, + eventId: EventId.make(`event-${input.sequence}`), + type: input.type, + aggregateKind: "thread", + aggregateId: ThreadId.make("thread-1"), + occurredAt: "2026-01-01T00:00:00.000Z", + commandId: CommandId.make(`command-${input.sequence}`), + causationEventId: null, + correlationId: null, + metadata: {}, + payload: input.payload as never, + } as OrchestrationEvent; +} + +it.effect("projects auto-settle opt-out and survives a manual settle", () => + Effect.gen(function* () { + const now = "2026-01-01T00:00:00.000Z"; + const later = "2026-01-02T00:00:00.000Z"; + const created = yield* projectEvent( + createEmptyReadModel(now), + makeEvent({ + sequence: 1, + type: "thread.created", + payload: { + threadId: ThreadId.make("thread-1"), + projectId: ProjectId.make("project-1"), + title: "Thread", + modelSelection: { provider: "codex", model: "gpt-5.4" }, + runtimeMode: "full-access", + interactionMode: "default", + branch: null, + worktreePath: null, + createdAt: now, + updatedAt: now, + }, + }), + ); + expect(created.threads[0]?.autoSettleDisabledAt ?? null).toBeNull(); + + const disabled = yield* projectEvent( + created, + makeEvent({ + sequence: 2, + type: "thread.auto-settle-set", + payload: { threadId: ThreadId.make("thread-1"), autoSettleDisabledAt: now, updatedAt: now }, + }), + ); + expect(disabled.threads[0]?.autoSettleDisabledAt).toBe(now); + + // The flag is independent of the settled lifecycle: settling by hand and + // un-settling later must not clear it. + const settled = yield* projectEvent( + disabled, + makeEvent({ + sequence: 3, + type: "thread.settled", + payload: { threadId: ThreadId.make("thread-1"), settledAt: later, updatedAt: later }, + }), + ); + expect(settled.threads[0]?.settledOverride).toBe("settled"); + expect(settled.threads[0]?.autoSettleDisabledAt).toBe(now); + + const unsettled = yield* projectEvent( + settled, + makeEvent({ + sequence: 4, + type: "thread.unsettled", + payload: { threadId: ThreadId.make("thread-1"), reason: "user", updatedAt: later }, + }), + ); + expect(unsettled.threads[0]?.autoSettleDisabledAt).toBe(now); + + const enabled = yield* projectEvent( + unsettled, + makeEvent({ + sequence: 5, + type: "thread.auto-settle-set", + payload: { + threadId: ThreadId.make("thread-1"), + autoSettleDisabledAt: null, + updatedAt: later, + }, + }), + ); + expect(enabled.threads[0]?.autoSettleDisabledAt).toBeNull(); + }), +); diff --git a/apps/server/src/orchestration/projector.test.ts b/apps/server/src/orchestration/projector.test.ts index c4e1996f1ddd..516b85fbdae8 100644 --- a/apps/server/src/orchestration/projector.test.ts +++ b/apps/server/src/orchestration/projector.test.ts @@ -93,6 +93,7 @@ describe("orchestration projector", () => { updatedAt: now, archivedAt: null, activeOrderKey: null, + autoSettleDisabledAt: null, settledOverride: null, settledAt: null, unsettledAt: null, diff --git a/apps/server/src/orchestration/projector.ts b/apps/server/src/orchestration/projector.ts index 53013770b15b..85d9db3fdfed 100644 --- a/apps/server/src/orchestration/projector.ts +++ b/apps/server/src/orchestration/projector.ts @@ -42,6 +42,7 @@ import { ThreadSettledPayload, ThreadPinnedPayload, ThreadPinReorderedPayload, + ThreadAutoSettleSetPayload, ThreadPullRequestLinkedPayload, ThreadPullRequestSyncedPayload, ThreadPullRequestUnlinkedPayload, @@ -440,6 +441,7 @@ export function projectEvent( settledAt: null, unsettledAt: null, activeOrderKey: null, + autoSettleDisabledAt: null, snoozedUntil: null, snoozedAt: null, deletedAt: null, @@ -580,6 +582,17 @@ export function projectEvent( })), ); + case "thread.auto-settle-set": + return decodeForEvent(ThreadAutoSettleSetPayload, event.payload, event.type, "payload").pipe( + Effect.map((payload) => ({ + ...nextBase, + threads: updateThread(nextBase.threads, payload.threadId, { + autoSettleDisabledAt: payload.autoSettleDisabledAt, + updatedAt: payload.updatedAt, + }), + })), + ); + case "thread.pin-reordered": return decodeForEvent(ThreadPinReorderedPayload, event.payload, event.type, "payload").pipe( Effect.map((payload) => ({ diff --git a/apps/server/src/persistence/Layers/ProjectionThreads.ts b/apps/server/src/persistence/Layers/ProjectionThreads.ts index af36578f286e..595bc0b5594c 100644 --- a/apps/server/src/persistence/Layers/ProjectionThreads.ts +++ b/apps/server/src/persistence/Layers/ProjectionThreads.ts @@ -54,6 +54,7 @@ const makeProjectionThreadRepository = Effect.gen(function* () { pinned_at, pin_order_key, active_order_key, + auto_settle_disabled_at, title_regeneration_request_id, title_regeneration_started_at, latest_user_message_at, @@ -86,6 +87,7 @@ const makeProjectionThreadRepository = Effect.gen(function* () { ${row.pinnedAt}, ${row.pinOrderKey ?? null}, ${row.activeOrderKey ?? null}, + ${row.autoSettleDisabledAt ?? null}, ${row.titleRegenerationRequestId ?? null}, ${row.titleRegenerationStartedAt ?? null}, ${row.latestUserMessageAt}, @@ -118,6 +120,7 @@ const makeProjectionThreadRepository = Effect.gen(function* () { pinned_at = excluded.pinned_at, pin_order_key = excluded.pin_order_key, active_order_key = excluded.active_order_key, + auto_settle_disabled_at = excluded.auto_settle_disabled_at, title_regeneration_request_id = excluded.title_regeneration_request_id, title_regeneration_started_at = excluded.title_regeneration_started_at, latest_user_message_at = excluded.latest_user_message_at, @@ -157,6 +160,7 @@ const makeProjectionThreadRepository = Effect.gen(function* () { pinned_at AS "pinnedAt", pin_order_key AS "pinOrderKey", active_order_key AS "activeOrderKey", + auto_settle_disabled_at AS "autoSettleDisabledAt", title_regeneration_request_id AS "titleRegenerationRequestId", title_regeneration_started_at AS "titleRegenerationStartedAt", latest_user_message_at AS "latestUserMessageAt", diff --git a/apps/server/src/persistence/Migrations.ts b/apps/server/src/persistence/Migrations.ts index 18aae09febf8..c837ae3f4c50 100644 --- a/apps/server/src/persistence/Migrations.ts +++ b/apps/server/src/persistence/Migrations.ts @@ -65,6 +65,7 @@ import Migration0050 from "./Migrations/050_ProjectionThreadPullRequests.ts"; import Migration0051 from "./Migrations/051_ProjectionThreadMessageContext.ts"; import Migration0052 from "./Migrations/052_ProjectionThreadTitleState.ts"; import Migration0053 from "./Migrations/053_PullRequestFilesViewed.ts"; +import Migration0054 from "./Migrations/054_ProjectionThreadsAutoSettleDisabledAt.ts"; /** * Migration loader with all migrations defined inline. @@ -130,6 +131,7 @@ const migrationEntries = [ [51, "ProjectionThreadMessageContext", Migration0051], [52, "ProjectionThreadTitleState", Migration0052], [53, "PullRequestFilesViewed", Migration0053], + [54, "ProjectionThreadsAutoSettleDisabledAt", Migration0054], ] as const; export const migrationManifest = migrationEntries.map(([id, name]) => [id, name] as const); diff --git a/apps/server/src/persistence/Migrations/054_ProjectionThreadsAutoSettleDisabledAt.test.ts b/apps/server/src/persistence/Migrations/054_ProjectionThreadsAutoSettleDisabledAt.test.ts new file mode 100644 index 000000000000..df6403316e5b --- /dev/null +++ b/apps/server/src/persistence/Migrations/054_ProjectionThreadsAutoSettleDisabledAt.test.ts @@ -0,0 +1,41 @@ +import { assert, it } from "@effect/vitest"; +import * as Effect from "effect/Effect"; +import * as SqlClient from "effect/unstable/sql/SqlClient"; +import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient"; + +import { runMigrations } from "../Migrations.ts"; +import migrateAutoSettleDisabledAt from "./054_ProjectionThreadsAutoSettleDisabledAt.ts"; + +it.layer(NodeSqliteClient.layer({ filename: ":memory:" }))( + "054_ProjectionThreadsAutoSettleDisabledAt", + (it) => { + it.effect("adds the column with auto-settle left on for existing threads", () => + Effect.gen(function* () { + const sql = yield* SqlClient.SqlClient; + yield* runMigrations({ toMigrationInclusive: 53 }); + const now = "2026-01-01T00:00:00.000Z"; + yield* sql` + INSERT INTO projection_threads ( + thread_id, project_id, title, model_selection_json, runtime_mode, + created_at, updated_at + ) VALUES ( + 'thread-1', 'project-1', 'Existing thread', + '{"instanceId":"codex","model":"gpt-5.4"}', 'full-access', ${now}, ${now} + ) + `; + yield* runMigrations({ toMigrationInclusive: 54 }); + const migrated = yield* sql<{ readonly autoSettleDisabledAt: string | null }>` + SELECT auto_settle_disabled_at AS "autoSettleDisabledAt" FROM projection_threads WHERE thread_id = 'thread-1' + `; + assert.deepEqual(migrated, [{ autoSettleDisabledAt: null }]); + // Re-running against a database that already has the column keeps its value. + yield* sql`UPDATE projection_threads SET auto_settle_disabled_at = ${now} WHERE thread_id = 'thread-1'`; + yield* migrateAutoSettleDisabledAt; + const rows = yield* sql<{ readonly autoSettleDisabledAt: string | null }>` + SELECT auto_settle_disabled_at AS "autoSettleDisabledAt" FROM projection_threads WHERE thread_id = 'thread-1' + `; + assert.deepEqual(rows, [{ autoSettleDisabledAt: now }]); + }), + ); + }, +); diff --git a/apps/server/src/persistence/Migrations/054_ProjectionThreadsAutoSettleDisabledAt.ts b/apps/server/src/persistence/Migrations/054_ProjectionThreadsAutoSettleDisabledAt.ts new file mode 100644 index 000000000000..f91f6d8abdfa --- /dev/null +++ b/apps/server/src/persistence/Migrations/054_ProjectionThreadsAutoSettleDisabledAt.ts @@ -0,0 +1,15 @@ +import * as Effect from "effect/Effect"; +import * as SqlClient from "effect/unstable/sql/SqlClient"; + +export default Effect.gen(function* () { + const sql = yield* SqlClient.SqlClient; + const columns = yield* sql<{ readonly name: string }>` + PRAGMA table_info(projection_threads) + `; + if (!columns.some((column) => column.name === "auto_settle_disabled_at")) { + yield* sql` + ALTER TABLE projection_threads + ADD COLUMN auto_settle_disabled_at TEXT + `; + } +}); diff --git a/apps/server/src/persistence/Services/ProjectionThreads.ts b/apps/server/src/persistence/Services/ProjectionThreads.ts index 895fe596db24..abd964382a09 100644 --- a/apps/server/src/persistence/Services/ProjectionThreads.ts +++ b/apps/server/src/persistence/Services/ProjectionThreads.ts @@ -50,6 +50,7 @@ export const ProjectionThread = Schema.Struct({ pinnedAt: Schema.NullOr(IsoDateTime), pinOrderKey: Schema.optional(Schema.NullOr(Schema.String)), activeOrderKey: Schema.optional(Schema.NullOr(Schema.String)), + autoSettleDisabledAt: Schema.optional(Schema.NullOr(IsoDateTime)), titleRegenerationRequestId: Schema.optional(Schema.NullOr(CommandId)), titleRegenerationStartedAt: Schema.optional(Schema.NullOr(IsoDateTime)), latestUserMessageAt: Schema.NullOr(IsoDateTime), diff --git a/apps/server/src/project/AgentSessionImporter.ts b/apps/server/src/project/AgentSessionImporter.ts index 5ebb41a1bb54..bf9eb702ebe5 100644 --- a/apps/server/src/project/AgentSessionImporter.ts +++ b/apps/server/src/project/AgentSessionImporter.ts @@ -87,6 +87,7 @@ function hasImportBlockingActivity( thread.snoozedAt != null || thread.pinnedAt != null || thread.pinOrderKey != null || + thread.autoSettleDisabledAt != null || thread.titleRegeneration != null || thread.linkedPullRequest != null || thread.unsettledAt != null || diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 9f73f09eff68..9e9b12e3233f 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -2154,6 +2154,7 @@ export default function Sidebar() { confirmAndUnpinThread, reorderPinnedThread, reorderActiveThread, + setThreadAutoSettle, archiveThread, deleteThread, } = useThreadActions(); @@ -4020,6 +4021,9 @@ export default function Sidebar() { serverConfigs.get(thread.environmentId)?.environment.capabilities.threadSnooze === true; const supportsPinning = serverConfigs.get(thread.environmentId)?.environment.capabilities.threadPinning === true; + const supportsAutoSettleOptOut = + serverConfigs.get(thread.environmentId)?.environment.capabilities + .threadAutoSettleOptOut === true; const supportsTitleRegeneration = serverConfigs.get(thread.environmentId)?.environment.capabilities .threadTitleRegeneration === true; @@ -4049,6 +4053,7 @@ export default function Sidebar() { : null, isPinned, isSettled, + autoSettleEnabled: thread.autoSettleDisabledAt == null, isSnoozed, canSnoozeNow: canSnooze(thread, { now: new Date().toISOString() }), isRegeneratingTitle, @@ -4056,6 +4061,7 @@ export default function Sidebar() { thread.session?.status === "running" && thread.session.activeTurnId != null, supports: { settlement: supportsSettlement, + autoSettleOptOut: supportsAutoSettleOptOut, snooze: supportsSnooze, pinning: supportsPinning, titleRegeneration: supportsTitleRegeneration, @@ -4127,6 +4133,24 @@ export default function Sidebar() { case "unpin": attemptUnpin(threadRef); return; + case "auto-settle:enabled": + case "auto-settle:disabled": { + const result = await setThreadAutoSettle( + threadRef, + clicked.value === "auto-settle:enabled", + ); + if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) { + const error = squashAtomCommandFailure(result); + toastManager.add( + stackedThreadToast({ + type: "error", + title: "Failed to update auto-settle", + description: error instanceof Error ? error.message : "An error occurred.", + }), + ); + } + return; + } case "rename": startThreadRename(threadRef, thread.title); return; @@ -4253,6 +4277,7 @@ export default function Sidebar() { projectByKey, serverConfigs, setProjectScopeKey, + setThreadAutoSettle, startThreadRename, updateThreadMetadata, timestampFormat, diff --git a/apps/web/src/components/threadActionMenu.logic.test.ts b/apps/web/src/components/threadActionMenu.logic.test.ts index 14965d4add58..c5ebeda55627 100644 --- a/apps/web/src/components/threadActionMenu.logic.test.ts +++ b/apps/web/src/components/threadActionMenu.logic.test.ts @@ -7,11 +7,18 @@ const baseState: ThreadActionMenuState = { projectFilter: null, isPinned: false, isSettled: false, + autoSettleEnabled: true, isSnoozed: false, canSnoozeNow: true, isRegeneratingTitle: false, isRunning: false, - supports: { settlement: true, snooze: true, pinning: true, titleRegeneration: true }, + supports: { + settlement: true, + autoSettleOptOut: true, + snooze: true, + pinning: true, + titleRegeneration: true, + }, snoozePresets: [ { id: "hour", label: "In 1 hour", whenLabel: "3:00 PM", snoozedUntil: "2026-08-07T15:00:00Z" }, ], @@ -32,7 +39,13 @@ describe("buildThreadActionMenuItems", () => { expect( ids({ ...baseState, - supports: { settlement: false, snooze: false, pinning: false, titleRegeneration: false }, + supports: { + settlement: false, + autoSettleOptOut: false, + snooze: false, + pinning: false, + titleRegeneration: false, + }, }), ).toEqual(["rename", "mark-unread", "copy", "project-settings", "archive", "delete"]); }); @@ -66,7 +79,7 @@ describe("buildThreadActionMenuItems", () => { const filterIndex = items.findIndex((candidate) => candidate.id === "filter-by-project"); expect(items[filterIndex]).toMatchObject({ label: "Show all projects", icon: "folder-tree" }); expect(items[filterIndex - 1]?.id).toBe("mark-unread"); - expect(items[filterIndex + 1]?.id).toBe("copy"); + expect(items[filterIndex + 1]?.id).toBe("auto-settle"); }); it("includes branch items only for threads with a branch", () => { @@ -84,6 +97,25 @@ describe("buildThreadActionMenuItems", () => { expect(ids(baseState)).toEqual(expect.arrayContaining(["pin", "settle", "snooze"])); }); + it("offers auto-settle as a submenu with the current option checked", () => { + const find = (state: ThreadActionMenuState) => + buildThreadActionMenuItems(state).find((item) => item.id === "auto-settle"); + const on = find(baseState); + expect(on?.label).toBe("Auto-settle behavior"); + expect(on?.children?.map((child) => [child.id, child.checked])).toEqual([ + ["auto-settle:enabled", true], + ["auto-settle:disabled", false], + ]); + const off = find({ ...baseState, autoSettleEnabled: false }); + expect(off?.children?.map((child) => child.checked)).toEqual([false, true]); + // Sits with the per-thread settings after Mark unread, not the lifecycle verbs. + const items = buildThreadActionMenuItems(baseState); + expect(items[items.findIndex((item) => item.id === "mark-unread") + 1]?.id).toBe("auto-settle"); + expect( + ids({ ...baseState, supports: { ...baseState.supports, autoSettleOptOut: false } }), + ).not.toContain("auto-settle"); + }); + it("disables snooze when the thread cannot snooze, keeping presets visible", () => { const snooze = buildThreadActionMenuItems({ ...baseState, canSnoozeNow: false }).find( (item) => item.id === "snooze", @@ -117,7 +149,13 @@ describe("buildThreadActionMenuItems", () => { expect( ids({ ...baseState, - supports: { settlement: false, snooze: false, pinning: false, titleRegeneration: false }, + supports: { + settlement: false, + autoSettleOptOut: false, + snooze: false, + pinning: false, + titleRegeneration: false, + }, }), ).toContain("archive"); }); diff --git a/apps/web/src/components/threadActionMenu.logic.ts b/apps/web/src/components/threadActionMenu.logic.ts index c37ec31f929c..838fc91a636c 100644 --- a/apps/web/src/components/threadActionMenu.logic.ts +++ b/apps/web/src/components/threadActionMenu.logic.ts @@ -14,6 +14,9 @@ export type ThreadActionMenuId = | "unpin" | "settle" | "unsettle" + | "auto-settle" + | "auto-settle:enabled" + | "auto-settle:disabled" | "snooze" | `snooze:${string}` | "unsnooze" @@ -40,6 +43,8 @@ export interface ThreadActionMenuState { } | null; readonly isPinned: boolean; readonly isSettled: boolean; + /** False while the user has turned automatic settlement off for this thread. */ + readonly autoSettleEnabled: boolean; readonly isSnoozed: boolean; readonly canSnoozeNow: boolean; readonly isRegeneratingTitle: boolean; @@ -47,6 +52,8 @@ export interface ThreadActionMenuState { readonly isRunning: boolean; readonly supports: { readonly settlement: boolean; + /** Server understands thread.auto-settle.set. */ + readonly autoSettleOptOut: boolean; readonly snooze: boolean; readonly pinning: boolean; readonly titleRegeneration: boolean; @@ -131,6 +138,31 @@ export function buildThreadActionMenuItems( }, ] : []), + // A submenu with the current option checked, not a one-shot action: + // this is a setting, and it sits with the other per-thread settings + // rather than the lifecycle verbs above. Disabled keeps long-running + // threads out of the settled shelf no matter how quiet they get. + ...(state.supports.autoSettleOptOut + ? [ + { + id: "auto-settle" as const, + label: "Auto-settle behavior", + icon: "timer", + children: [ + { + id: "auto-settle:enabled" as const, + label: "Enabled", + checked: state.autoSettleEnabled, + }, + { + id: "auto-settle:disabled" as const, + label: "Disabled", + checked: !state.autoSettleEnabled, + }, + ], + }, + ] + : []), { id: "copy", label: "Copy", diff --git a/apps/web/src/contextMenuFallback.ts b/apps/web/src/contextMenuFallback.ts index 2c43641b2b56..db14ed8c860c 100644 --- a/apps/web/src/contextMenuFallback.ts +++ b/apps/web/src/contextMenuFallback.ts @@ -9,6 +9,12 @@ const ICON_PATHS: Record( button.style.pointerEvents = "none"; } - if (typeof item.icon === "string") { + if (typeof item.checked === "boolean") { + // Option rows use the icon slot for the check so labels line up + // with icon rows. The unselected option keeps the slot empty. + button.setAttribute("role", "menuitemradio"); + button.setAttribute("aria-checked", item.checked ? "true" : "false"); + const check = item.checked ? createIconElement("check", "neutral") : null; + if (check) { + button.appendChild(check); + } else { + const spacer = document.createElement("span"); + spacer.className = "size-4.5 shrink-0 sm:size-4"; + spacer.style.cssText = "display:inline-block;width:1rem;height:1rem;flex-shrink:0;"; + spacer.setAttribute("aria-hidden", "true"); + button.appendChild(spacer); + } + } else if (typeof item.icon === "string") { const icon = createIconElement(item.icon, isLeafDestructive ? "destructive" : "neutral"); if (icon) { button.appendChild(icon); diff --git a/apps/web/src/hooks/useThreadActionMenu.ts b/apps/web/src/hooks/useThreadActionMenu.ts index 8a24c5110fa7..4a99fa8f5c73 100644 --- a/apps/web/src/hooks/useThreadActionMenu.ts +++ b/apps/web/src/hooks/useThreadActionMenu.ts @@ -20,6 +20,7 @@ import { stackedThreadToast, toastManager } from "../components/ui/toast"; import { threadEnvironment } from "../state/threads"; import { useAtomCommand } from "../state/use-atom-command"; import { + readEnvironmentSupportsAutoSettleOptOut, readEnvironmentSupportsPinning, readEnvironmentSupportsSettlement, readEnvironmentSupportsSnooze, @@ -88,6 +89,7 @@ export function useThreadActionMenu(input: { unsnoozeThread, pinThread, confirmAndUnpinThread, + setThreadAutoSettle, archiveThread, deleteThread, } = useThreadActions(); @@ -132,6 +134,7 @@ export function useThreadActionMenu(input: { const now = new Date(); const supports = { settlement: readEnvironmentSupportsSettlement(threadRef.environmentId), + autoSettleOptOut: readEnvironmentSupportsAutoSettleOptOut(threadRef.environmentId), snooze: readEnvironmentSupportsSnooze(threadRef.environmentId), pinning: readEnvironmentSupportsPinning(threadRef.environmentId), titleRegeneration: readEnvironmentSupportsTitleRegeneration(threadRef.environmentId), @@ -145,6 +148,7 @@ export function useThreadActionMenu(input: { projectFilter: null, isPinned: thread.pinnedAt != null, isSettled: supports.settlement && thread.settledOverride === "settled", + autoSettleEnabled: thread.autoSettleDisabledAt == null, isSnoozed: supports.snooze && effectiveSnoozed(thread, { now: now.toISOString() }), canSnoozeNow: canSnooze(thread, { now: now.toISOString() }), isRegeneratingTitle, @@ -225,6 +229,12 @@ export function useThreadActionMenu(input: { await reportFailure("Failed to unpin thread", () => confirmAndUnpinThread(threadRef)); return; } + case "auto-settle:enabled": + case "auto-settle:disabled": + await reportFailure("Failed to update auto-settle", () => + setThreadAutoSettle(threadRef, action === "auto-settle:enabled"), + ); + return; case "rename": onStartRename(); return; @@ -333,6 +343,7 @@ export function useThreadActionMenu(input: { projectGroupingSettings, projects, router, + setThreadAutoSettle, settleThread, snoozeThread, threadRef, diff --git a/apps/web/src/hooks/useThreadActions.ts b/apps/web/src/hooks/useThreadActions.ts index 0e5491099223..6a82b920ab31 100644 --- a/apps/web/src/hooks/useThreadActions.ts +++ b/apps/web/src/hooks/useThreadActions.ts @@ -26,6 +26,7 @@ import { refreshArchivedThreadsForEnvironment } from "../lib/archivedThreadsStat import { releaseComposerDraftUploads } from "../lib/composerDraftUploads"; import { readLocalApi } from "../localApi"; import { + readEnvironmentSupportsAutoSettleOptOut, readEnvironmentSupportsPinning, readEnvironmentSupportsPinReorder, readEnvironmentSupportsActiveReorder, @@ -106,6 +107,18 @@ function topOfPinnedRunOrderKey(): string | undefined { return pinOrderKeyBetween(null, firstKey) ?? undefined; } +export class ThreadAutoSettleOptOutUnsupportedError extends Schema.TaggedError()( + "ThreadAutoSettleOptOutUnsupportedError", + { + environmentId: EnvironmentId, + threadId: ThreadId, + }, +) { + override get message(): string { + return "This environment's server does not support turning auto-settle off per thread yet. Update the server to use it."; + } +} + export class ThreadPinningUnsupportedError extends Schema.TaggedError()( "ThreadPinningUnsupportedError", { @@ -200,6 +213,9 @@ export function useThreadActions() { const unpinThreadMutation = useAtomCommand(threadEnvironment.unpin, { reportFailure: false, }); + const setThreadAutoSettleMutation = useAtomCommand(threadEnvironment.setAutoSettle, { + reportFailure: false, + }); const reorderPinnedThreadMutation = useAtomCommand(threadEnvironment.reorderPin, { reportFailure: false, }); @@ -556,6 +572,27 @@ export function useThreadActions() { [unsettleThreadMutation], ); + /** Turns automatic settlement (inactivity, merged PR) on or off for one thread. */ + const setThreadAutoSettle = useCallback( + async (target: ScopedThreadRef, enabled: boolean) => { + if (!readEnvironmentSupportsAutoSettleOptOut(target.environmentId)) { + return AsyncResult.failure( + Cause.fail( + new ThreadAutoSettleOptOutUnsupportedError({ + environmentId: target.environmentId, + threadId: target.threadId, + }), + ), + ); + } + return setThreadAutoSettleMutation({ + environmentId: target.environmentId, + input: { threadId: target.threadId, enabled }, + }); + }, + [setThreadAutoSettleMutation], + ); + const pinThread = useCallback( async (target: ScopedThreadRef, opts: { orderKey?: string } = {}) => { // Version skew: never send the command to a server that predates it. @@ -875,6 +912,7 @@ export function useThreadActions() { confirmAndUnpinThread, reorderPinnedThread, reorderActiveThread, + setThreadAutoSettle, }), [ archiveThread, @@ -884,6 +922,7 @@ export function useThreadActions() { pinThread, reorderPinnedThread, reorderActiveThread, + setThreadAutoSettle, settleThread, snoozeThread, unarchiveThread, diff --git a/apps/web/src/state/entities.ts b/apps/web/src/state/entities.ts index d9610e20717f..dcd6358cb52c 100644 --- a/apps/web/src/state/entities.ts +++ b/apps/web/src/state/entities.ts @@ -229,6 +229,15 @@ export function readEnvironmentSupportsPinReorder(environmentId: EnvironmentId): ); } +/** Whether the environment's server understands thread.auto-settle.set. + Same version-skew contract as settlement. */ +export function readEnvironmentSupportsAutoSettleOptOut(environmentId: EnvironmentId): boolean { + return ( + appAtomRegistry.get(environmentServerConfigsAtom).get(environmentId)?.environment.capabilities + .threadAutoSettleOptOut === true + ); +} + export function readEnvironmentSupportsActiveReorder(environmentId: EnvironmentId): boolean { return ( appAtomRegistry.get(environmentServerConfigsAtom).get(environmentId)?.environment.capabilities diff --git a/docs/user/thread-sidebar.md b/docs/user/thread-sidebar.md index 3d3215a193f6..0d7cfb736774 100644 --- a/docs/user/thread-sidebar.md +++ b/docs/user/thread-sidebar.md @@ -99,6 +99,11 @@ prevent automatic settlement. An open pull request does not prevent inactivity settlement, but an old closed or merged pull request does not settle work you resumed after it closed. +To keep one thread out of the settled shelf no matter how long it sits idle, open its menu, +choose **Auto-settle behavior**, and pick **Disabled**. The current option is checked. Pick +**Enabled** to return to the usual rules. Manual settle, snooze, and archive still work while it +is disabled. + Change these rules in **Settings → General** on web and desktop, or **Settings → Thread behavior** on mobile. They continue to run when your apps are closed. On web and desktop, choose an environment at the top to change only its rules, or **All environments** to update connected environments together. diff --git a/packages/client-runtime/src/operations/commands.ts b/packages/client-runtime/src/operations/commands.ts index 8f313c1632ff..a08adba22949 100644 --- a/packages/client-runtime/src/operations/commands.ts +++ b/packages/client-runtime/src/operations/commands.ts @@ -42,6 +42,7 @@ export type UnsnoozeThreadInput = CommandInput<"thread.unsnooze">; export type PinThreadInput = CommandInput<"thread.pin">; export type UnpinThreadInput = CommandInput<"thread.unpin">; export type ReorderPinnedThreadInput = CommandInput<"thread.pin.reorder">; +export type SetThreadAutoSettleInput = CommandInput<"thread.auto-settle.set">; export type ReorderActiveThreadInput = CommandInput<"thread.active.reorder">; export type UpdateThreadMetadataInput = CommandInput<"thread.meta.update">; export type LinkThreadPullRequestInput = CommandInput<"thread.pull-request.link">; @@ -226,6 +227,16 @@ export const unpinThread: (input: UnpinThreadInput) => CommandEffect = Effect.fn }); }); +export const setThreadAutoSettle: (input: SetThreadAutoSettleInput) => CommandEffect = Effect.fn( + "EnvironmentCommands.setThreadAutoSettle", +)(function* (input) { + return yield* dispatch({ + ...input, + type: "thread.auto-settle.set", + commandId: yield* commandId(input), + }); +}); + export const reorderPinnedThread: (input: ReorderPinnedThreadInput) => CommandEffect = Effect.fn( "EnvironmentCommands.reorderPinnedThread", )(function* (input) { diff --git a/packages/client-runtime/src/state/threadCommands.ts b/packages/client-runtime/src/state/threadCommands.ts index 93e22cfd0c70..bb70356aab6a 100644 --- a/packages/client-runtime/src/state/threadCommands.ts +++ b/packages/client-runtime/src/state/threadCommands.ts @@ -29,6 +29,7 @@ import { type PinThreadInput, type ReorderPinnedThreadInput, type ReorderActiveThreadInput, + type SetThreadAutoSettleInput, type SettleThreadInput, type SnoozeThreadInput, type StartThreadTurnInput, @@ -53,6 +54,7 @@ import { pinThread, reorderPinnedThread, reorderActiveThread, + setThreadAutoSettle, settleThread, snoozeThread, startThreadTurn, @@ -81,6 +83,7 @@ export type { PinThreadInput, ReorderPinnedThreadInput, ReorderActiveThreadInput, + SetThreadAutoSettleInput, SettleThreadInput, SnoozeThreadInput, StartThreadTurnInput, @@ -170,6 +173,12 @@ export function createThreadEnvironmentAtoms( scheduler, concurrency, }), + setAutoSettle: createEnvironmentCommand(runtime, { + label: "environment-data:commands:thread:set-auto-settle", + execute: (input: SetThreadAutoSettleInput) => setThreadAutoSettle(input), + scheduler, + concurrency, + }), reorderActive: createEnvironmentCommand(runtime, { label: "environment-data:commands:thread:reorder-active", execute: (input: ReorderActiveThreadInput) => reorderActiveThread(input), diff --git a/packages/client-runtime/src/state/threadDetail.ts b/packages/client-runtime/src/state/threadDetail.ts index 379985b71243..d32329a741b4 100644 --- a/packages/client-runtime/src/state/threadDetail.ts +++ b/packages/client-runtime/src/state/threadDetail.ts @@ -60,6 +60,7 @@ export function mergeEnvironmentThread( settledAt: shell.settledAt, unsettledAt: shell.unsettledAt, activeOrderKey: shell.activeOrderKey, + autoSettleDisabledAt: shell.autoSettleDisabledAt, snoozedUntil: shell.snoozedUntil, snoozedAt: shell.snoozedAt, pinnedAt: shell.pinnedAt, diff --git a/packages/client-runtime/src/state/threadReducer.test.ts b/packages/client-runtime/src/state/threadReducer.test.ts index dbee48d7808c..0330d3dd8bd9 100644 --- a/packages/client-runtime/src/state/threadReducer.test.ts +++ b/packages/client-runtime/src/state/threadReducer.test.ts @@ -290,6 +290,46 @@ describe("applyThreadDetailEvent", () => { }); }); + describe("thread.auto-settle-set", () => { + it("stores and clears autoSettleDisabledAt", () => { + const disabledAt = "2026-04-01T05:00:00.000Z"; + const off = applyThreadDetailEvent(baseThread, { + ...baseEventFields, + sequence: 7, + occurredAt: disabledAt, + aggregateKind: "thread", + aggregateId: ThreadId.make("thread-1"), + type: "thread.auto-settle-set", + payload: { + threadId: ThreadId.make("thread-1"), + autoSettleDisabledAt: disabledAt, + updatedAt: disabledAt, + }, + }); + expect(off.kind).toBe("updated"); + if (off.kind !== "updated") return; + expect(off.thread.autoSettleDisabledAt).toBe(disabledAt); + + const on = applyThreadDetailEvent(off.thread, { + ...baseEventFields, + sequence: 8, + occurredAt: "2026-04-01T06:00:00.000Z", + aggregateKind: "thread", + aggregateId: ThreadId.make("thread-1"), + type: "thread.auto-settle-set", + payload: { + threadId: ThreadId.make("thread-1"), + autoSettleDisabledAt: null, + updatedAt: "2026-04-01T06:00:00.000Z", + }, + }); + expect(on.kind).toBe("updated"); + if (on.kind === "updated") { + expect(on.thread.autoSettleDisabledAt).toBeNull(); + } + }); + }); + describe("thread.meta-updated", () => { it.each(["f", null] as const)( "updates the active key to %s without activity", diff --git a/packages/client-runtime/src/state/threadReducer.ts b/packages/client-runtime/src/state/threadReducer.ts index 101bb34fba91..66f78a0464ec 100644 --- a/packages/client-runtime/src/state/threadReducer.ts +++ b/packages/client-runtime/src/state/threadReducer.ts @@ -131,6 +131,7 @@ export function applyThreadDetailEvent( settledAt: null, unsettledAt: null, activeOrderKey: null, + autoSettleDisabledAt: null, snoozedUntil: null, snoozedAt: null, deletedAt: null, @@ -249,6 +250,16 @@ export function applyThreadDetailEvent( }, }; + case "thread.auto-settle-set": + return { + kind: "updated", + thread: { + ...thread, + autoSettleDisabledAt: event.payload.autoSettleDisabledAt, + updatedAt: event.payload.updatedAt, + }, + }; + // ── Thread metadata ───────────────────────────────────────────── case "thread.meta-updated": return { diff --git a/packages/contracts/src/environment.ts b/packages/contracts/src/environment.ts index b5a3290f6314..089133d878a4 100644 --- a/packages/contracts/src/environment.ts +++ b/packages/contracts/src/environment.ts @@ -141,6 +141,9 @@ export const ExecutionEnvironmentCapabilities = Schema.Struct({ threadPinReorder: Schema.optionalKey(Schema.Boolean), /** Server persists manual Active order through thread.active.reorder. */ threadActiveReorder: Schema.optionalKey(Schema.Boolean), + /** Server understands thread.auto-settle.set (per-thread auto-settle off). + Same version-skew contract as threadSettlement. */ + threadAutoSettleOptOut: Schema.optionalKey(Schema.Boolean), /** Server understands regenerateTitle on thread.meta.update. Absent on older servers, so clients hide the action instead of sending it. */ threadTitleRegeneration: Schema.optionalKey(Schema.Boolean), diff --git a/packages/contracts/src/ipc.ts b/packages/contracts/src/ipc.ts index ffa8661eb9c8..7caf6d1cac75 100644 --- a/packages/contracts/src/ipc.ts +++ b/packages/contracts/src/ipc.ts @@ -40,6 +40,8 @@ export interface ContextMenuItem { icon?: string; /** Inserts a visual section divider immediately before this item. */ separatorBefore?: boolean; + /** Shows a check mark. Used to mark the current option inside a submenu. */ + checked?: boolean; children?: readonly ContextMenuItem[]; } @@ -55,6 +57,7 @@ export interface ContextMenuItemSchemaType { readonly header?: boolean; readonly icon?: string; readonly separatorBefore?: boolean; + readonly checked?: boolean; readonly children?: readonly ContextMenuItemSchemaType[]; } @@ -66,6 +69,7 @@ export const ContextMenuItemSchema: Schema.Codec = Sc header: Schema.optionalKey(Schema.Boolean), icon: Schema.optionalKey(Schema.String), separatorBefore: Schema.optionalKey(Schema.Boolean), + checked: Schema.optionalKey(Schema.Boolean), children: Schema.optionalKey( Schema.Array( Schema.suspend((): Schema.Codec => ContextMenuItemSchema), diff --git a/packages/contracts/src/orchestration.ts b/packages/contracts/src/orchestration.ts index 3e323e4964d5..1ae704d3f666 100644 --- a/packages/contracts/src/orchestration.ts +++ b/packages/contracts/src/orchestration.ts @@ -838,6 +838,10 @@ export const OrchestrationThread = Schema.Struct({ // Manual Active placement. Keyless threads retain their creation/re-entry // order above the arranged run. Settling clears this slot. activeOrderKey: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)), + // Set while the user has turned automatic settlement off for this thread. + // Survives manual settle, un-settle, and activity: only the user clears it. + // Optional so payloads from older servers still decode. + autoSettleDisabledAt: Schema.optional(Schema.NullOr(IsoDateTime)), // Pending-only state. Optional so older servers remain compatible. titleRegeneration: Schema.optional(Schema.NullOr(ThreadTitleRegeneration)), titleState: Schema.optional(Schema.NullOr(ThreadTitleState)), @@ -908,6 +912,7 @@ export const OrchestrationThreadShell = Schema.Struct({ pinnedAt: Schema.optional(Schema.NullOr(IsoDateTime)), pinOrderKey: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)), activeOrderKey: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)), + autoSettleDisabledAt: Schema.optional(Schema.NullOr(IsoDateTime)), titleRegeneration: Schema.optional(Schema.NullOr(ThreadTitleRegeneration)), titleState: Schema.optional(Schema.NullOr(ThreadTitleState)), session: Schema.NullOr(OrchestrationSession), @@ -1218,6 +1223,14 @@ const ThreadPinReorderCommand = Schema.Struct({ orderKey: TrimmedNonEmptyString, }); +const ThreadAutoSettleSetCommand = Schema.Struct({ + type: Schema.Literal("thread.auto-settle.set"), + commandId: CommandId, + threadId: ThreadId, + // false turns automatic settlement off for this thread, true turns it back on. + enabled: Schema.Boolean, +}); + const ThreadActiveReorderCommand = Schema.Struct({ type: Schema.Literal("thread.active.reorder"), commandId: CommandId, @@ -1426,6 +1439,7 @@ const DispatchableClientOrchestrationCommand = Schema.Union([ ThreadPinCommand, ThreadUnpinCommand, ThreadPinReorderCommand, + ThreadAutoSettleSetCommand, ThreadActiveReorderCommand, ThreadMetaUpdateCommand, ThreadPullRequestLinkCommand, @@ -1459,6 +1473,7 @@ export const ClientOrchestrationCommand = Schema.Union([ ThreadPinCommand, ThreadUnpinCommand, ThreadPinReorderCommand, + ThreadAutoSettleSetCommand, ThreadActiveReorderCommand, ThreadMetaUpdateCommand, ThreadPullRequestLinkCommand, @@ -1687,6 +1702,7 @@ export const OrchestrationEventType = Schema.Literals([ "thread.pinned", "thread.unpinned", "thread.pin-reordered", + "thread.auto-settle-set", "thread.meta-updated", "thread.pull-request-linked", "thread.pull-request-unlinked", @@ -1825,6 +1841,13 @@ export const ThreadPinReorderedPayload = Schema.Struct({ updatedAt: IsoDateTime, }); +export const ThreadAutoSettleSetPayload = Schema.Struct({ + threadId: ThreadId, + // Null re-enables automatic settlement. + autoSettleDisabledAt: Schema.NullOr(IsoDateTime), + updatedAt: IsoDateTime, +}); + export const ThreadMetaUpdatedPayload = Schema.Struct({ threadId: ThreadId, // Order updates use this existing event so older clients can ignore the @@ -2089,6 +2112,11 @@ export const OrchestrationEvent = Schema.Union([ type: Schema.Literal("thread.pin-reordered"), payload: ThreadPinReorderedPayload, }), + Schema.Struct({ + ...EventBaseFields, + type: Schema.Literal("thread.auto-settle-set"), + payload: ThreadAutoSettleSetPayload, + }), Schema.Struct({ ...EventBaseFields, type: Schema.Literal("thread.meta-updated"), From 8251c8de78a021014b83ffe986dc52a480d71e41 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 15:07:41 -0700 Subject: [PATCH 07/58] fix(web): working and monitoring threads fade in the sidebar again (#13506) Co-authored-by: Claude Opus 5.5 (1M context) --- apps/web/src/components/Sidebar.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 9e9b12e3233f..bf99a1423378 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -1400,6 +1400,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { : shouldRecede ? "text-sidebar-muted-foreground/75 hover:bg-sidebar-row-hover hover:text-sidebar-foreground" : "bg-transparent text-sidebar-foreground hover:bg-sidebar-row-hover", + // Background work fades as a whole row, status label included, so it + // takes less attention than rows that need a human (input, approval). + shouldRecede && + (status === "working" || status === "monitoring") && + "opacity-70 transition-opacity hover:opacity-100 focus-within:opacity-100 motion-reduce:transition-none", isFileDragOver && "ring-1 ring-inset ring-primary/70", // The hover tint must not clobber an active/selected row's own surface. isFileDragOver && !props.isActive && !isSelected && "bg-sidebar-row-hover", From a36af0637a63ebf316beb5db5670be226df01cbc Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 15:10:39 -0700 Subject: [PATCH 08/58] fix(server): streamed section titles wait for the text under them (#13504) Co-authored-by: Claude Opus 5.5 (1M context) --- .../Layers/ProviderRuntimeIngestion.test.ts | 55 +++++++++++++++++++ .../Layers/ProviderRuntimeIngestion.ts | 27 ++++++++- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts b/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts index d61739f72c21..9b5b56309749 100644 --- a/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts +++ b/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts @@ -5174,4 +5174,59 @@ describe("splitBufferedAssistantText", () => { rest: "```\n- one\n- two\n", }); }); + + it("holds a heading until the block under it is done", () => { + expect(splitBufferedAssistantText("intro\n\n## Setup\n\nInstall it")).toEqual({ + ready: "intro\n\n", + rest: "## Setup\n\nInstall it", + }); + expect( + splitBufferedAssistantText("intro\n\n# Plan\n\n## Setup\n\nInstall it.\n\nNext"), + ).toEqual({ + ready: "intro\n\n# Plan\n\n## Setup\n\nInstall it.\n\n", + rest: "Next", + }); + }); + + it("delivers the paragraph above a heading with no blank line between them", () => { + expect(splitBufferedAssistantText("para\n## Setup\n\nInstall")).toEqual({ + ready: "para\n", + rest: "## Setup\n\nInstall", + }); + // A bold line there continues the paragraph, so both stay buffered. + expect(splitBufferedAssistantText("para\n**Setup**\n\nInstall")).toEqual({ + ready: "", + rest: "para\n**Setup**\n\nInstall", + }); + }); + + it("holds a line of only bold text like a heading", () => { + expect(splitBufferedAssistantText("**Risk by area:**\n\n| a |\n|---|\n")).toEqual({ + ready: "", + rest: "**Risk by area:**\n\n| a |\n|---|\n", + }); + expect(splitBufferedAssistantText("**Use *npm* now**\n\nInstall it")).toEqual({ + ready: "", + rest: "**Use *npm* now**\n\nInstall it", + }); + expect(splitBufferedAssistantText("**Note:** read this.\n\nNext")).toEqual({ + ready: "**Note:** read this.\n\n", + rest: "Next", + }); + }); + + it("delivers a held heading with its first list item or its whole code block", () => { + expect(splitBufferedAssistantText("## Steps\n\n- one\n- tw")).toEqual({ + ready: "## Steps\n\n- one\n", + rest: "- tw", + }); + expect(splitBufferedAssistantText("## Code\n\n```ts\na\n\nb\n")).toEqual({ + ready: "", + rest: "## Code\n\n```ts\na\n\nb\n", + }); + expect(splitBufferedAssistantText("## Code\n\n```ts\na\n```\nafter")).toEqual({ + ready: "## Code\n\n```ts\na\n```\n", + rest: "after", + }); + }); }); diff --git a/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts b/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts index 0db70e491235..d26930637db1 100644 --- a/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts +++ b/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts @@ -211,6 +211,12 @@ const BLANK_LINE_PATTERN = /^[ \t]*$/; // nested items count. The trailing space is required, so a partial `-` or // `1.` never matches before the model finishes the marker. const LIST_ITEM_START_PATTERN = /^[ \t]*(?:[-*+]|\d{1,9}[.)])[ \t]/; +// A section title: an ATX heading, or a line of only bold text, which models +// often use as a heading. +const SECTION_TITLE_PATTERN = /^ {0,3}(?:#{1,6}(?:[ \t]|$)|\*\*(?:[^*]|\*(?!\*))+\*\*:?$)/; +// An unindented ATX heading ends the paragraph or list above it, even with no +// blank line between them. A bold line would continue the paragraph instead. +const TOP_LEVEL_HEADING_PATTERN = /^#{1,6}(?:[ \t]|$)/; /** * Splits buffered assistant text at the last blank line, closing code fence, @@ -221,17 +227,26 @@ const LIST_ITEM_START_PATTERN = /^[ \t]*(?:[-*+]|\d{1,9}[.)])[ \t]/; * never leaks; a list item start is the one lookahead that may sit on the * partial line, since tight lists have no blank lines between items and would * otherwise land all at once. + * + * A section title holds the boundary until a content line follows it, so a + * title never lands alone and waits above a block that is still streaming. */ export function splitBufferedAssistantText(text: string): { ready: string; rest: string } { let openFence: { marker: string; indent: number } | null = null; let boundary = -1; let lineStart = 0; + let titleAwaitingContent = false; for (;;) { const newline = text.indexOf("\n", lineStart); const line = text .slice(lineStart, newline === -1 ? text.length : newline) .replace(/[ \t\r]+$/, ""); - if (openFence === null && lineStart > 0 && LIST_ITEM_START_PATTERN.test(line)) { + if ( + openFence === null && + lineStart > 0 && + !titleAwaitingContent && + LIST_ITEM_START_PATTERN.test(line) + ) { boundary = lineStart; } if (newline === -1) { @@ -243,6 +258,7 @@ export function splitBufferedAssistantText(text: string): { ready: string; rest: const marker = fenceMatch[2]!; if (openFence === null) { openFence = { marker, indent }; + titleAwaitingContent = false; } else if ( marker[0] === openFence.marker[0] && marker.length >= openFence.marker.length && @@ -254,7 +270,14 @@ export function splitBufferedAssistantText(text: string): { ready: string; rest: boundary = newline + 1; } } else if (openFence === null && BLANK_LINE_PATTERN.test(line) && lineStart > 0) { - boundary = newline + 1; + if (!titleAwaitingContent) { + boundary = newline + 1; + } + } else if (openFence === null) { + if (lineStart > 0 && !titleAwaitingContent && TOP_LEVEL_HEADING_PATTERN.test(line)) { + boundary = lineStart; + } + titleAwaitingContent = SECTION_TITLE_PATTERN.test(line); } lineStart = newline + 1; } From 720490adc9b8f3676c614f3611d8c7fd9f4dd368 Mon Sep 17 00:00:00 2001 From: "t3-code[bot]" <269035359+t3-code[bot]@users.noreply.github.com> Date: Thu, 24 Sep 2026 19:19:41 -0300 Subject: [PATCH 09/58] fix(web): normalize disabled control opacity (#11441) Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com> Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com> --- apps/web/src/components/GitActionsControl.tsx | 2 +- apps/web/src/components/ThreadTerminalDrawer.tsx | 8 ++++---- apps/web/src/components/chat/ChatComposer.tsx | 2 +- apps/web/src/components/chat/ComposerPrimaryActions.tsx | 2 +- .../src/components/settings/AddProviderInstanceDialog.tsx | 2 +- apps/web/src/components/settings/settingsLayout.tsx | 2 +- apps/web/src/components/ui/discovery-list.tsx | 2 +- apps/web/src/components/ui/sidebar.tsx | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsx index 5c9d37d8b4e5..2c26f1e69b1d 100644 --- a/apps/web/src/components/GitActionsControl.tsx +++ b/apps/web/src/components/GitActionsControl.tsx @@ -636,7 +636,7 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) { return (
diff --git a/apps/web/src/components/ThreadTerminalDrawer.tsx b/apps/web/src/components/ThreadTerminalDrawer.tsx index b34b8a60b12f..b155421572e0 100644 --- a/apps/web/src/components/ThreadTerminalDrawer.tsx +++ b/apps/web/src/components/ThreadTerminalDrawer.tsx @@ -1447,7 +1447,7 @@ export default function ThreadTerminalDrawer({ event.preventDefault()} diff --git a/apps/web/src/components/chat/ComposerPrimaryActions.tsx b/apps/web/src/components/chat/ComposerPrimaryActions.tsx index c1f448a73ea8..76ea907b84cd 100644 --- a/apps/web/src/components/chat/ComposerPrimaryActions.tsx +++ b/apps/web/src/components/chat/ComposerPrimaryActions.tsx @@ -215,7 +215,7 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
) : null} - {status !== "streaming" ? ( + {retainingAndroidFrame && showPhone && showRestartNotice ? ( +
+ + Waiting for device video… + +
+ ) : null} + {status !== "streaming" && !(retainingAndroidFrame && showPhone) ? (
=> + typeof value === "object" && value !== null && !Array.isArray(value); + +const parseFold = (payload: unknown): AndroidFoldState => { + if (!isRecord(payload) || payload.ok !== true || !isRecord(payload.fold)) { + throw new Error("Unexpected Android fold response."); + } + const { supported, posture, hingeAngle } = payload.fold; + if ( + typeof supported !== "boolean" || + (posture !== null && + posture !== "closed" && + posture !== "half_opened" && + posture !== "opened" && + posture !== "flipped" && + posture !== "tent") || + (hingeAngle !== null && (typeof hingeAngle !== "number" || !Number.isFinite(hingeAngle))) + ) { + throw new Error("Unexpected Android fold response."); + } + return { supported, posture, hingeAngle }; +}; + +const foldRequest = async ( + access: DeviceHubAccess, + deviceId: string, + posture?: AndroidFoldPosture, + signal?: AbortSignal, +): Promise => { + const url = withDeviceHubQuery( + `${access.httpBase}/vendor/serve-emu/api/fold?${new URLSearchParams({ device: deviceId })}`, + access, + ); + const response = await fetch(url, { + method: posture ? "POST" : "GET", + cache: "no-store", + credentials: access.credentials ? "include" : "same-origin", + ...(posture + ? { headers: { "content-type": "application/json" }, body: JSON.stringify({ posture }) } + : {}), + ...(signal ? { signal } : {}), + }); + if (!response.ok) { + const payload: unknown = await response.json().catch(() => null); + const error = isRecord(payload) ? payload.error : null; + throw new Error( + typeof error === "string" ? error : `Fold command failed (${response.status}).`, + ); + } + return parseFold(await response.json()); +}; + +export const readAndroidFold = (access: DeviceHubAccess, deviceId: string, signal?: AbortSignal) => + foldRequest(access, deviceId, undefined, signal); + +export const setAndroidFold = ( + access: DeviceHubAccess, + deviceId: string, + posture: AndroidFoldPosture, + signal?: AbortSignal, +) => foldRequest(access, deviceId, posture, signal); diff --git a/docs/user/devices.md b/docs/user/devices.md index 68f85ee214a6..a87770853a2d 100644 --- a/docs/user/devices.md +++ b/docs/user/devices.md @@ -44,6 +44,8 @@ interactive. On iPhone Duo, use the fold and stance controls to change its physical pose, or pinch over the device to adjust the hinge. Turning the model to the other screen switches the live display and touch input to that screen. **Restore 3D view** returns the device to a screen-facing position. +On supported Android foldables, use **Fold device** and **Unfold device** beside +the screen to change its posture in either view. ## Tools diff --git a/packages/client-runtime/src/device/androidFoldScene.test.ts b/packages/client-runtime/src/device/androidFoldScene.test.ts new file mode 100644 index 000000000000..bb677c4818ee --- /dev/null +++ b/packages/client-runtime/src/device/androidFoldScene.test.ts @@ -0,0 +1,57 @@ +import { Box3, Mesh, PerspectiveCamera, Texture, Vector3 } from "three"; +import { describe, expect, it } from "vite-plus/test"; +import { createAndroidFoldScene } from "./androidFoldScene.ts"; +import { phoneDisplayLayout } from "./phoneScene.ts"; + +describe("Android fold scene", () => { + it("moves one physical half around the hinge while preserving both screen halves", () => { + const texture = new Texture(); + const scene = createAndroidFoldScene( + texture, + phoneDisplayLayout({ width: 2200, height: 1840, orientation: "landscape_left" }, 2200, 1840), + 180, + ); + const moving = scene.orientation.children[0]!; + const fixed = scene.orientation.children[1]!; + const openWidth = new Box3().setFromObject(scene.root).getSize(new Vector3()).x; + const leftScreen = scene.root.getObjectByName("left-inner-screen") as Mesh; + const rightScreen = scene.root.getObjectByName("right-inner-screen") as Mesh; + leftScreen.geometry.computeBoundingBox(); + rightScreen.geometry.computeBoundingBox(); + const creaseWidth = + rightScreen.geometry.boundingBox!.min.x - leftScreen.geometry.boundingBox!.max.x; + expect(creaseWidth).toBeLessThan(0.01); + const continuousScreen = scene.root.getObjectByName("continuous-inner-screen") as Mesh; + const positions = continuousScreen.geometry.getAttribute("position"); + expect(continuousScreen.geometry.index).not.toBeNull(); + expect(Array.from({ length: positions.count }, (_, i) => positions.getX(i))).toContain(0); + scene.setAngle(90); + expect(moving.rotation.y).toBeCloseTo(Math.PI / 2); + expect(fixed.rotation.y).toBe(0); + scene.setAngle(0); + const closedWidth = new Box3().setFromObject(scene.root).getSize(new Vector3()).x; + expect(closedWidth).toBeLessThan(openWidth * 0.7); + expect(scene.root.getObjectByName("cover-screen")?.visible).toBe(true); + scene.dispose(); + texture.dispose(); + }); + + it("maps touches on each open half and the closed cover to the live frame", () => { + const texture = new Texture(); + const scene = createAndroidFoldScene(texture, phoneDisplayLayout(null, 2200, 1840), 180); + const camera = new PerspectiveCamera(32, 1, 0.1, 30); + camera.position.z = 6; + camera.updateMatrixWorld(true); + const project = (x: number) => { + const point = new Vector3(x, 0, 0.041).project(camera); + return scene.screenPoint((point.x + 1) / 2, (1 - point.y) / 2, camera); + }; + expect(project(-0.52)?.x).toBeCloseTo(0.25, 1); + expect(project(0.52)?.x).toBeCloseTo(0.75, 1); + expect(scene.screenPoint(0.99, 0.5, camera, true)?.x).toBe(1); + scene.setAngle(0); + expect(project(0.52)?.x).toBeCloseTo(0.5, 1); + scene.dispose(); + texture.dispose(); + }); +}); diff --git a/packages/client-runtime/src/device/androidFoldScene.ts b/packages/client-runtime/src/device/androidFoldScene.ts new file mode 100644 index 000000000000..3c30ecabc550 --- /dev/null +++ b/packages/client-runtime/src/device/androidFoldScene.ts @@ -0,0 +1,395 @@ +import { + BoxGeometry, + CircleGeometry, + CylinderGeometry, + ExtrudeGeometry, + Group, + Mesh, + MeshBasicMaterial, + MeshPhysicalMaterial, + MeshStandardMaterial, + PlaneGeometry, + Raycaster, + Shape, + ShapeGeometry, + Vector2, + Vector3, + type Camera, + type Texture, +} from "three"; +import type { PhoneDisplayLayout } from "./phoneScene.ts"; + +const HALF_WIDTH = 1.04; +const HEIGHT = 2.2; +const DEPTH = 0.075; +const INSET = 0.026; +const CREASE = 0.004; +const BEVEL = 0.008; +// The hinge axis sits just above the inner screens so closed halves meet face to face. +const PIVOT_Z = DEPTH / 2 + 0.005; +const SPINE_RADIUS = PIVOT_Z + DEPTH / 2 - 0.002; + +function panelPath(side: "left" | "right", inset: number, radius: number, hingeInset = 0) { + const left = side === "left" ? -HALF_WIDTH + inset : CREASE / 2 + hingeInset; + const right = side === "left" ? -CREASE / 2 - hingeInset : HALF_WIDTH - inset; + const bottom = -HEIGHT / 2 + inset; + const top = HEIGHT / 2 - inset; + const path = new Shape(); + if (side === "left") { + path.moveTo(left + radius, bottom); + path.lineTo(right, bottom); + path.lineTo(right, top); + path.lineTo(left + radius, top); + path.quadraticCurveTo(left, top, left, top - radius); + path.lineTo(left, bottom + radius); + path.quadraticCurveTo(left, bottom, left + radius, bottom); + } else { + path.moveTo(left, bottom); + path.lineTo(right - radius, bottom); + path.quadraticCurveTo(right, bottom, right, bottom + radius); + path.lineTo(right, top - radius); + path.quadraticCurveTo(right, top, right - radius, top); + path.lineTo(left, top); + } + path.closePath(); + return path; +} + +function roundedRectPath(width: number, height: number, radius: number) { + const path = new Shape(); + path.moveTo(-width / 2 + radius, -height / 2); + path.lineTo(width / 2 - radius, -height / 2); + path.quadraticCurveTo(width / 2, -height / 2, width / 2, -height / 2 + radius); + path.lineTo(width / 2, height / 2 - radius); + path.quadraticCurveTo(width / 2, height / 2, width / 2 - radius, height / 2); + path.lineTo(-width / 2 + radius, height / 2); + path.quadraticCurveTo(-width / 2, height / 2, -width / 2, height / 2 - radius); + path.lineTo(-width / 2, -height / 2 + radius); + path.quadraticCurveTo(-width / 2, -height / 2, -width / 2 + radius, -height / 2); + path.closePath(); + return path; +} + +function coverPath() { + return roundedRectPath(HALF_WIDTH - INSET * 2 - 0.02, HEIGHT - INSET * 2 - 0.04, 0.07); +} + +/** A procedural book-style foldable: one fixed half, one half rotating around a shared hinge. */ +export function createAndroidFoldScene( + texture: Texture, + layout: PhoneDisplayLayout, + initialAngle: number, +) { + const root = new Group(); + const orientation = new Group(); + root.add(orientation); + const left = new Group(); + const right = new Group(); + orientation.add(left, right); + const frameMetal = new MeshStandardMaterial({ + color: 0xa3abb2, + metalness: 0.9, + roughness: 0.28, + }); + const polishedMetal = new MeshStandardMaterial({ + color: 0xc4cad0, + metalness: 0.95, + roughness: 0.16, + }); + const bezel = new MeshPhysicalMaterial({ + color: 0x0b0d10, + metalness: 0.1, + roughness: 0.2, + clearcoat: 1, + }); + const backGlass = new MeshPhysicalMaterial({ + color: 0x2c3237, + metalness: 0.35, + roughness: 0.52, + clearcoat: 0.4, + clearcoatRoughness: 0.6, + }); + const island = new MeshPhysicalMaterial({ + color: 0x1a1e22, + metalness: 0.55, + roughness: 0.3, + clearcoat: 1, + }); + const lensMaterial = new MeshPhysicalMaterial({ + color: 0x061022, + metalness: 0.6, + roughness: 0.1, + clearcoat: 1, + }); + const flashMaterial = new MeshBasicMaterial({ color: 0xf2ead6 }); + const displayMaterial = new MeshBasicMaterial({ map: texture, toneMapped: false }); + const hitMaterial = new MeshBasicMaterial({ colorWrite: false, depthWrite: false }); + const coverMaterial = new MeshBasicMaterial({ map: texture, toneMapped: false }); + const materials = [ + frameMetal, + polishedMetal, + bezel, + backGlass, + island, + lensMaterial, + flashMaterial, + displayMaterial, + hitMaterial, + coverMaterial, + ]; + + // Each half's meshes live in body coordinates; `left` pivots them around the hinge axis. + left.position.z = PIVOT_Z; + const leftBody = new Group(); + leftBody.position.z = -PIVOT_Z; + left.add(leftBody); + + function half(group: Group, side: "left" | "right", back: MeshPhysicalMaterial) { + const body = new Mesh( + new ExtrudeGeometry(panelPath(side, BEVEL, 0.1, BEVEL), { + depth: DEPTH - BEVEL * 2, + bevelEnabled: true, + bevelSize: BEVEL, + bevelThickness: BEVEL, + bevelSegments: 3, + curveSegments: 12, + }), + frameMetal, + ); + body.position.z = -DEPTH / 2 + BEVEL; + group.add(body); + const frame = new Mesh(new ShapeGeometry(panelPath(side, 0.01, 0.095, 0.002), 12), bezel); + frame.position.z = DEPTH / 2 + 0.001; + group.add(frame); + // A back-facing shape mirrors X, so it is drawn from the opposite side's outline. + const rear = new Mesh( + new ShapeGeometry(panelPath(side === "left" ? "right" : "left", 0.01, 0.095, 0.002), 12), + back, + ); + rear.name = `${side}-back`; + rear.rotation.y = Math.PI; + rear.position.set(0, 0, -DEPTH / 2 - 0.001); + group.add(rear); + const geometry = new ShapeGeometry(panelPath(side, INSET, 0.076)); + geometry.computeBoundingBox(); + const display = new Mesh(geometry, hitMaterial); + display.name = `${side}-inner-screen`; + display.position.z = DEPTH / 2 + 0.003; + group.add(display); + return display; + } + + const innerLeft = half(leftBody, "left", bezel); + const innerRight = half(right, "right", backGlass); + // One indexed surface keeps adjacent pixels joined at the crease. The + // physical halves move separately underneath it. + const screenWidth = 2 * (HALF_WIDTH - INSET); + const screenHeight = HEIGHT - 2 * INSET; + const screenGeometry = new PlaneGeometry(screenWidth, screenHeight, 40, 48); + const screenPositions = screenGeometry.getAttribute("position"); + const screenUvs = screenGeometry.getAttribute("uv"); + const baseX = new Float32Array(screenPositions.count); + for (let i = 0; i < screenPositions.count; i++) { + const y = screenPositions.getY(i); + const outerX = screenWidth / 2; + const outerY = screenHeight / 2; + const radius = 0.076; + const cornerY = Math.max(0, Math.abs(y) - (outerY - radius)); + const limit = outerX - radius + Math.sqrt(Math.max(0, radius * radius - cornerY * cornerY)); + const x = Math.max(-limit, Math.min(limit, screenPositions.getX(i))); + baseX[i] = x; + screenUvs.setXY(i, x / screenWidth + 0.5, y / screenHeight + 0.5); + } + screenUvs.needsUpdate = true; + const innerSurface = new Mesh(screenGeometry, displayMaterial); + innerSurface.name = "continuous-inner-screen"; + orientation.add(innerSurface); + // The outer half of the hinge housing. It tucks behind the back glass when + // open and becomes the rounded spine when closed. + const spineSlack = 0.15; + const spine = new Mesh( + new CylinderGeometry( + SPINE_RADIUS, + SPINE_RADIUS, + HEIGHT - 0.012, + 32, + 1, + false, + Math.PI / 2 + spineSlack, + Math.PI - spineSlack * 2, + ), + polishedMetal, + ); + spine.name = "hinge-spine"; + spine.position.z = PIVOT_Z; + orientation.add(spine); + + const cover = new Mesh(new ShapeGeometry(coverPath()), coverMaterial); + cover.name = "cover-screen"; + cover.position.set(-HALF_WIDTH / 2, 0, -DEPTH / 2 - 0.003); + cover.rotation.y = Math.PI; + leftBody.add(cover); + + // Rear components use back-surface coordinates, with outward positive Z. + const rearCamera = new Group(); + rearCamera.name = "rear-camera"; + const islandWidth = 0.46; + const islandHeight = 0.2; + rearCamera.position.set( + HALF_WIDTH - 0.07 - islandWidth / 2, + HEIGHT / 2 - 0.08 - islandHeight / 2, + -DEPTH / 2 - 0.002, + ); + rearCamera.rotation.y = Math.PI; + right.add(rearCamera); + const plateDepth = 0.02; + const plate = new Mesh( + new ExtrudeGeometry(roundedRectPath(islandWidth, islandHeight, 0.07), { + depth: plateDepth, + bevelEnabled: true, + bevelSize: 0.008, + bevelThickness: 0.006, + bevelSegments: 3, + curveSegments: 12, + }), + island, + ); + plate.name = "camera-plate"; + rearCamera.add(plate); + const plateFront = plateDepth + 0.006; + for (const [x, radius] of [ + [-0.14, 0.05], + [-0.01, 0.05], + [0.105, 0.036], + ] as const) { + const ring = new Mesh( + new CylinderGeometry(radius + 0.012, radius + 0.012, 0.012, 32), + frameMetal, + ); + ring.rotation.x = Math.PI / 2; + ring.position.set(x, 0, plateFront + 0.004); + rearCamera.add(ring); + const lens = new Mesh(new CircleGeometry(radius, 32), lensMaterial); + lens.name = "camera-lens"; + lens.position.set(x, 0, plateFront + 0.0105); + rearCamera.add(lens); + } + const flash = new Mesh(new CircleGeometry(0.018, 20), flashMaterial); + flash.position.set(0.185, 0.045, plateFront + 0.0005); + rearCamera.add(flash); + + // Power and volume keys sit on the fixed half's outer edge. + for (const [y, length] of [ + [0.52, 0.16], + [0.2, 0.3], + ] as const) { + const key = new Mesh(new BoxGeometry(0.02, length, DEPTH * 0.45), frameMetal); + key.position.set(HALF_WIDTH + 0.008, y, 0); + right.add(key); + } + + const raycaster = new Raycaster(); + const pointer = new Vector2(); + const local = new Vector3(); + let capturedDisplay: Mesh | null = null; + let activeLayout = layout; + let angle = initialAngle; + const updateVisibleScreen = () => { + const innerActive = angle >= 90; + innerSurface.visible = innerActive; + innerLeft.visible = innerActive; + innerRight.visible = innerActive; + cover.visible = !innerActive; + }; + const setAngle = (next: number) => { + angle = Math.max(0, Math.min(180, next)); + left.rotation.y = Math.PI * (1 - angle / 180); + spine.rotation.y = left.rotation.y / 2; + const radians = left.rotation.y; + const cosine = Math.cos(radians); + const sine = Math.sin(radians); + const frontZ = DEPTH / 2 + 0.004 - PIVOT_Z; + for (let i = 0; i < screenPositions.count; i++) { + const x = baseX[i]!; + if (x < 0) { + screenPositions.setXYZ( + i, + x * cosine + frontZ * sine, + screenPositions.getY(i), + -x * sine + frontZ * cosine + PIVOT_Z, + ); + } else { + screenPositions.setXYZ(i, x, screenPositions.getY(i), frontZ + PIVOT_Z); + } + } + screenPositions.needsUpdate = true; + screenGeometry.computeBoundingBox(); + screenGeometry.computeBoundingSphere(); + updateVisibleScreen(); + }; + const setDisplay = (nextTexture: Texture, nextLayout: PhoneDisplayLayout) => { + activeLayout = nextLayout; + displayMaterial.map = nextTexture; + coverMaterial.map = nextTexture; + cover.geometry.computeBoundingBox(); + const bounds = cover.geometry.boundingBox!; + const uv = cover.geometry.getAttribute("uv"); + const position = cover.geometry.getAttribute("position"); + for (let i = 0; i < uv.count; i++) { + const u = (position.getX(i) - bounds.min.x) / (bounds.max.x - bounds.min.x); + const v = (position.getY(i) - bounds.min.y) / (bounds.max.y - bounds.min.y); + uv.setXY(i, u, v); + } + uv.needsUpdate = true; + updateVisibleScreen(); + }; + setAngle(initialAngle); + setDisplay(texture, layout); + + return { + root, + orientation, + width: HALF_WIDTH * 2, + height: HEIGHT, + setAngle, + setDisplay, + screenPoint(x: number, y: number, camera: Camera, captured = false) { + orientation.updateWorldMatrix(true, true); + camera.updateMatrixWorld(true); + pointer.set(x * 2 - 1, 1 - y * 2); + raycaster.setFromCamera(pointer, camera); + const screens = cover.visible ? [cover] : [innerLeft, innerRight]; + const hit = raycaster.intersectObjects(screens, false)[0]; + if (!hit && !captured) { + capturedDisplay = null; + return null; + } + const display = + (hit?.object as Mesh | undefined) ?? + (capturedDisplay?.visible ? capturedDisplay : screens[0]); + if (!display) return null; + if (hit) capturedDisplay = display; + if (hit) local.copy(hit.point); + else { + const plane = new Vector3(0, 0, 1).transformDirection(display.matrixWorld); + const point = new Vector3().setFromMatrixPosition(display.matrixWorld); + const distance = + plane.dot(point.clone().sub(raycaster.ray.origin)) / plane.dot(raycaster.ray.direction); + if (!Number.isFinite(distance)) return null; + local.copy(raycaster.ray.direction).multiplyScalar(distance).add(raycaster.ray.origin); + } + display.worldToLocal(local); + const bounds = display.geometry.boundingBox!; + const u = Math.max(0, Math.min(1, (local.x - bounds.min.x) / (bounds.max.x - bounds.min.x))); + const v = Math.max(0, Math.min(1, (bounds.max.y - local.y) / (bounds.max.y - bounds.min.y))); + const across = display === cover ? u : (display === innerLeft ? u : 1 + u) / 2; + return activeLayout.rotation === Math.PI ? { x: 1 - across, y: 1 - v } : { x: across, y: v }; + }, + dispose() { + root.traverse((object) => { + if (object instanceof Mesh) object.geometry.dispose(); + }); + for (const material of materials) material.dispose(); + }, + }; +} diff --git a/packages/client-runtime/src/device/phoneViewer.test.ts b/packages/client-runtime/src/device/phoneViewer.test.ts index ddb08bddf976..61baa8293f1a 100644 --- a/packages/client-runtime/src/device/phoneViewer.test.ts +++ b/packages/client-runtime/src/device/phoneViewer.test.ts @@ -11,6 +11,7 @@ const gpu = vi.hoisted(() => ({ scene: Scene; phone: Object3D | undefined; rotation: Quaternion | undefined; + displayAngle: number | undefined; yaw: number | undefined; cameraZ: number; }[]; @@ -50,6 +51,7 @@ vi.mock("three", async () => { scene, phone, rotation: phone?.quaternion.clone(), + displayAngle: phone?.children[0]?.rotation.z, yaw: phone?.rotation.y, cameraZ: camera.position.z, }); @@ -81,7 +83,12 @@ vi.mock("./modelScene.ts", async () => { import { BoxGeometry, Group, Mesh, MeshBasicMaterial, PlaneGeometry, Quaternion } from "three"; import { disposeDeviceModel } from "./modelScene.ts"; import { createPhoneViewer } from "./phoneViewer.ts"; -import { IOS_TABLET_SHAPE } from "./shapeProfile.ts"; +import { + ANDROID_PHONE_SHAPE, + IOS_TABLET_SHAPE, + resolveDeviceShape, + type DeviceShapeProfile, +} from "./shapeProfile.ts"; afterEach(() => { vi.restoreAllMocks(); @@ -90,7 +97,7 @@ afterEach(() => { models.pending.length = 0; }); -function fixture() { +function fixture(profile?: DeviceShapeProfile) { const pending = new Map(); let id = 0; let now = 0; @@ -104,7 +111,13 @@ function fixture() { const source = { width: 1206, height: 2622 } as HTMLCanvasElement; const onUnavailable = vi.fn(); const onFramingAspect = vi.fn(); - const viewer = createPhoneViewer({ canvas, source, onUnavailable, onFramingAspect }); + const viewer = createPhoneViewer({ + canvas, + source, + onUnavailable, + onFramingAspect, + ...(profile ? { profile } : {}), + }); const draw = (time = now) => { now = time; const callbacks = [...pending.values()]; @@ -194,6 +207,117 @@ it("changes device shape without replacing the renderer, decoded source or pose" viewer.dispose(); }); +it("keeps the Android viewer while the resized framebuffer turns between fold postures", () => { + const openProfile = resolveDeviceShape({ platform: "android", portraitAspect: 0.96 }); + const { viewer, draw, source, state } = fixture(openProfile); + const scene = state.frames.at(-1)!.scene; + source.width = 2076; + source.height = 2152; + viewer.setScreen({ width: 2076, height: 2152, orientation: "landscape_left" }); + viewer.frameUpdated(); + draw(0); + expect(state.frames.at(-1)!.displayAngle).toBeCloseTo(0); + draw(225); + expect(state.frames.at(-1)!.displayAngle).toBeCloseTo(-Math.PI / 4); + draw(450); + expect(state.frames.at(-1)!.displayAngle).toBeCloseTo(-Math.PI / 2); + expect(state.frames.at(-1)!.scene).toBe(scene); + expect(gpu.instances).toHaveLength(1); + + source.width = 1080; + source.height = 2424; + viewer.setScreen({ width: 1080, height: 2424, orientation: "portrait" }, ANDROID_PHONE_SHAPE); + viewer.frameUpdated(); + draw(450); + expect(state.frames.at(-1)!.displayAngle).toBeCloseTo(-Math.PI / 2); + draw(675); + expect(state.frames.at(-1)!.displayAngle).toBeCloseTo(-Math.PI / 4); + draw(900); + expect(state.frames.at(-1)!.displayAngle).toBeCloseTo(0); + expect(state.frames.at(-1)!.scene).toBe(scene); + viewer.dispose(); +}); + +it("animates the Android hinge on the same scene through an encoder resize", () => { + const openProfile = resolveDeviceShape({ platform: "android", portraitAspect: 0.96 }); + const { viewer, draw, source, state } = fixture(openProfile); + viewer.setFoldAngle(180); + draw(0); + const shell = state.frames.at(-1)!.phone!; + const moving = shell.children[0]!.children[0]!; + viewer.setFoldAngle(0); + draw(425); + expect(moving.rotation.y).toBeCloseTo(Math.PI / 2); + source.width = 1080; + source.height = 2424; + viewer.setScreen({ width: 1080, height: 2424, orientation: "portrait" }, ANDROID_PHONE_SHAPE); + viewer.frameUpdated(); + draw(850); + expect(moving.rotation.y).toBeCloseTo(Math.PI); + expect(state.frames.at(-1)!.phone).toBe(shell); + expect(gpu.instances).toHaveLength(1); + viewer.dispose(); +}); + +it("retargets an unfinished hinge turn from its visible angle", () => { + const { viewer, draw, state } = fixture(ANDROID_PHONE_SHAPE); + viewer.setFoldAngle(180); + draw(0); + const moving = state.frames.at(-1)!.phone!.children[0]!.children[0]!; + viewer.setFoldAngle(0); + draw(200); + const visibleAngle = moving.rotation.y; + viewer.setFoldAngle(180); + draw(200); + expect(moving.rotation.y).toBeCloseTo(visibleAngle); + draw(1050); + expect(moving.rotation.y).toBeCloseTo(0); + viewer.dispose(); +}); + +it("stops a hinge turn when a loaded model replaces the fold scene", async () => { + const { viewer, draw, pending } = fixture(ANDROID_PHONE_SHAPE); + viewer.setFoldAngle(180); + draw(0); + viewer.setFoldAngle(0); + viewer.setModel({ id: "iphone-18-pro", url: "/fold.glb" }); + const asset = new Group(); + const body = new Mesh(new BoxGeometry(1, 2, 0.1), new MeshBasicMaterial()); + const display = new Mesh(new PlaneGeometry(0.9, 1.9), new MeshBasicMaterial()); + display.name = "device-screen"; + asset.add(body, display); + models.pending[0]!.resolve({ asset, dispose: () => disposeDeviceModel(asset) }); + await Promise.resolve(); + draw(200); + draw(1050); + expect(pending.size).toBe(0); + viewer.dispose(); +}); + +it("keeps a loaded model when the fold angle changes and releases it once", async () => { + const { viewer, draw, state } = fixture(ANDROID_PHONE_SHAPE); + viewer.setModel({ id: "iphone-18-pro", url: "/pro.glb" }); + const asset = new Group(); + const body = new Mesh(new BoxGeometry(1.15, 2.3, 0.1), new MeshBasicMaterial()); + body.position.z = -0.02; + const display = new Mesh(new PlaneGeometry(1, 2.2), new MeshBasicMaterial()); + display.geometry.translate(0, 0, 0.043); + display.name = "device-screen"; + asset.add(body, display); + const dispose = vi.fn(() => disposeDeviceModel(asset)); + models.pending[0]!.resolve({ asset, dispose }); + await Promise.resolve(); + draw(); + const loaded = state.frames.at(-1)!.phone; + expect(loaded?.getObjectByName("device-screen")).toBe(display); + viewer.setFoldAngle(180); + viewer.setFoldAngle(0); + draw(); + expect(state.frames.at(-1)!.phone).toBe(loaded); + viewer.dispose(); + expect(dispose).toHaveBeenCalledOnce(); +}); + it("retains the loaded model and pose through rotation and framebuffer resolution changes, then releases it once", async () => { const { viewer, draw, source, state } = fixture(); viewer.orbit(0.08, 0.04); diff --git a/packages/client-runtime/src/device/phoneViewer.ts b/packages/client-runtime/src/device/phoneViewer.ts index 0794490606d1..009907442433 100644 --- a/packages/client-runtime/src/device/phoneViewer.ts +++ b/packages/client-runtime/src/device/phoneViewer.ts @@ -19,6 +19,7 @@ import { } from "./model.ts"; import { createImportedPhoneScene, loadDeviceModel } from "./modelScene.ts"; import { createPhoneScene, phoneDisplayLayout } from "./phoneScene.ts"; +import { createAndroidFoldScene } from "./androidFoldScene.ts"; import { createRenderScheduler } from "./renderScheduler.ts"; import { createDeviceMotion } from "./deviceMotion.ts"; import { createDeviceFraming } from "./deviceFraming.ts"; @@ -31,6 +32,7 @@ export interface PhoneViewer { readonly setAccessory: (source: DeviceAccessorySource | null) => void; readonly frameUpdated: () => void; readonly setScreen: (screen: DeviceScreenSize | null, profile?: DeviceShapeProfile) => void; + readonly setFoldAngle: (angle: number | null) => void; readonly resize: (width: number, height: number, pixelRatio: number) => void; readonly screenPoint: ( x: number, @@ -43,6 +45,9 @@ export interface PhoneViewer { readonly dispose: () => void; } +const ANDROID_ORIENTATION_TURN_MS = 450; +const ANDROID_FOLD_TURN_MS = 850; + /** Owns only presentation resources. The caller retains the decoded canvas and the stream connection. */ export function createPhoneViewer(options: { readonly canvas: HTMLCanvasElement; @@ -53,6 +58,7 @@ export function createPhoneViewer(options: { readonly profile?: DeviceShapeProfile; readonly model?: DeviceModelSource | null; readonly accessory?: DeviceAccessorySource | null; + readonly foldAngle?: number | null; }): PhoneViewer { const renderer = new WebGLRenderer({ canvas: options.canvas, @@ -87,11 +93,19 @@ export function createPhoneViewer(options: { let screen: DeviceScreenSize | null = null; let layout = phoneDisplayLayout(screen, options.source.width, options.source.height); let profile = options.profile ?? IOS_PHONE_SHAPE; + let foldAngle = options.foldAngle ?? null; + let orientationAngle = + foldAngle !== null && profile.id.startsWith("android") ? 0 : layout.rotation; + let orientationTurn: { from: number; to: number; startedAt: number } | null = null; let imported: Awaited> | null = null; let modelSource = options.model ?? null; let accessory: Awaited> | null = null; let accessoryBounds: Box3 | null = null; - let phone = createPhoneScene(texture, layout, profile); + let foldTurn: { from: number; to: number; startedAt: number } | null = null; + let phone: ReturnType | ReturnType = + foldAngle !== null && profile.id.startsWith("android") + ? createAndroidFoldScene(texture, layout, foldAngle) + : createPhoneScene(texture, layout, profile); scene.add(phone.root); let disposed = false; const rest = new Quaternion(); @@ -116,7 +130,7 @@ export function createPhoneViewer(options: { new Vector3(phone.width / 2, phone.height / 2, 0), ); if (imported && accessoryBounds) bounds.union(accessoryBounds); - bounds.applyMatrix4(new Matrix4().makeRotationZ(layout.rotation)); + bounds.applyMatrix4(new Matrix4().makeRotationZ(orientationAngle)); const size = bounds.getSize(new Vector3()); const aspect = size.x / size.y; if (aspect !== framingAspect) { @@ -140,7 +154,7 @@ export function createPhoneViewer(options: { }; const applyPose = () => { phone.root.quaternion.copy(motion.rotation); - phone.orientation.rotation.z = layout.rotation; + phone.orientation.rotation.z = orientationAngle; }; const scheduler = createRenderScheduler(() => { if (disposed || !viewport.width || !viewport.height) return; @@ -160,10 +174,30 @@ export function createPhoneViewer(options: { applyPose(); fit(reducedMotion()); } + if (orientationTurn) { + const progress = Math.min( + 1, + (now - orientationTurn.startedAt) / ANDROID_ORIENTATION_TURN_MS, + ); + const eased = progress * progress * (3 - 2 * progress); + orientationAngle = + orientationTurn.from + (orientationTurn.to - orientationTurn.from) * eased; + if (progress === 1) orientationTurn = null; + applyPose(); + fit(reducedMotion()); + } + if (foldTurn && "setAngle" in phone) { + const progress = Math.min(1, (now - foldTurn.startedAt) / ANDROID_FOLD_TURN_MS); + const eased = progress * progress * (3 - 2 * progress); + phone.setAngle(foldTurn.from + (foldTurn.to - foldTurn.from) * eased); + if (progress === 1) foldTurn = null; + fit(reducedMotion()); + } framing.advance(now, reducedMotion()); applyCamera(); renderer.render(scene, camera); - if (motion.needsFrame() || framing.needsFrame()) scheduler.invalidate(); + if (motion.needsFrame() || framing.needsFrame() || orientationTurn || foldTurn) + scheduler.invalidate(); } catch { options.onUnavailable(); } @@ -188,7 +222,11 @@ export function createPhoneViewer(options: { phone.setDisplay(texture, next); previous.dispose(); } - if (!imported && (nextProfile !== profile || next.aspect !== layout.aspect)) { + if ( + !imported && + !("setAngle" in phone) && + (nextProfile !== profile || next.aspect !== layout.aspect) + ) { scene.remove(phone.root); phone.dispose(); phone = createPhoneScene(texture, next, nextProfile); @@ -196,10 +234,26 @@ export function createPhoneViewer(options: { } else { phone.setDisplay(texture, next); } + if (next.rotation !== layout.rotation) { + if (nextProfile.id.startsWith("android") && !("setAngle" in phone) && !reducedMotion()) { + const difference = Math.atan2( + Math.sin(next.rotation - orientationAngle), + Math.cos(next.rotation - orientationAngle), + ); + orientationTurn = { + from: orientationAngle, + to: orientationAngle + difference, + startedAt: performance.now(), + }; + } else { + orientationTurn = null; + orientationAngle = "setAngle" in phone ? 0 : next.rotation; + } + } layout = next; profile = nextProfile; applyPose(); - fit(true); + fit(!orientationTurn); } applyPose(); }; @@ -212,7 +266,10 @@ export function createPhoneViewer(options: { ? null : model ? createImportedPhoneScene(model.asset, texture, layout) - : createPhoneScene(texture, layout, profile); + : foldAngle !== null && profile.id.startsWith("android") + ? createAndroidFoldScene(texture, layout, foldAngle) + : createPhoneScene(texture, layout, profile); + foldTurn = null; scene.remove(phone.root); phone.dispose(); imported = model; @@ -267,6 +324,43 @@ export function createPhoneViewer(options: { modelSlot.set(source); }, setAccessory, + setFoldAngle(next) { + if (disposed || next === foldAngle) return; + const previous = foldAngle; + foldAngle = next; + // A loaded model owns the scene; install() reads foldAngle if it is removed. + if (imported) return; + if (next === null || !("setAngle" in phone)) { + scene.remove(phone.root); + phone.dispose(); + phone = + next === null + ? createPhoneScene(texture, layout, profile) + : createAndroidFoldScene(texture, layout, next); + scene.add(phone.root); + orientationTurn = null; + orientationAngle = next === null ? layout.rotation : 0; + foldTurn = null; + applyPose(); + fit(true); + } else { + const progress = foldTurn + ? Math.min(1, (performance.now() - foldTurn.startedAt) / ANDROID_FOLD_TURN_MS) + : 1; + const eased = progress * progress * (3 - 2 * progress); + const from = foldTurn + ? foldTurn.from + (foldTurn.to - foldTurn.from) * eased + : (previous ?? next); + if (reducedMotion()) { + foldTurn = null; + phone.setAngle(next); + fit(true); + } else { + foldTurn = { from, to: next, startedAt: performance.now() }; + } + } + scheduler.invalidate(); + }, frameUpdated() { if (disposed) return; updateLayout(); From 4f27a8463105662ddfc834e01bca375d5124be79 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 21:52:01 -0700 Subject: [PATCH 29/58] fix(mcp): preview snapshots fit in the agent's tool output again (#13558) Co-authored-by: Claude Opus 5.5 (1M context) --- apps/server/src/mcp/McpHttpServer.test.ts | 63 +++++++++++- apps/server/src/mcp/McpHttpServer.ts | 98 ++++++++++++------- apps/server/src/mcp/toolkits/preview/tools.ts | 4 +- 3 files changed, 125 insertions(+), 40 deletions(-) diff --git a/apps/server/src/mcp/McpHttpServer.test.ts b/apps/server/src/mcp/McpHttpServer.test.ts index 16bf696e935c..1415e2e8dcb8 100644 --- a/apps/server/src/mcp/McpHttpServer.test.ts +++ b/apps/server/src/mcp/McpHttpServer.test.ts @@ -248,7 +248,10 @@ it.effect.each([ const metadata = { ...page, title: `Snapshot ${call}`, screenshot }; const { accessibilityTree: _tree, ...boundedMetadata } = metadata; expect(snapshot.isError).toBe(false); - expect(snapshot.structuredContent).toEqual(metadata); + expect(snapshot.structuredContent).toEqual({ + ...boundedMetadata, + omitted: ["accessibilityTree (use interactiveElements locators or preview_evaluate)"], + }); const [identity, text, ...rest] = snapshot.content; expect(identity?.type === "text" ? decodeJsonText(identity.text) : null).toEqual({ url: page.url, @@ -287,7 +290,8 @@ it.effect.each([ "text", "image", ]); - expect(nextDefault.structuredContent).toEqual({ ...page, title: "Snapshot 7", screenshot }); + expect(nextDefault.structuredContent).toMatchObject({ title: "Snapshot 7", screenshot }); + expect(nextDefault.structuredContent).not.toHaveProperty("accessibilityTree"); expect(requests).toBe(7); }), ).pipe(Effect.provide(TestLayer)), @@ -341,6 +345,15 @@ it.effect("saves the snapshot PNG on request and reports its path", () => const unsaved = yield* callSnapshot({}); expect(unsaved.structuredContent).not.toHaveProperty("screenshotPath"); + + // A save without the image skips the page dump. + const pathOnly = yield* callSnapshot({ save: true, includeImage: false }); + const saved = pathOnly.structuredContent as { readonly screenshotPath: string }; + expect(saved).toEqual({ url: snapshotResult.url, screenshotPath: expect.any(String) }); + expect(Buffer.from(yield* fileSystem.readFile(saved.screenshotPath)).toString()).toBe("png"); + const [only, ...others] = pathOnly.content; + expect(others).toEqual([]); + expect(only?.type === "text" ? decodeJsonText(only.text) : null).toEqual(saved); }), ).pipe(Effect.provide(TestLayer)), ); @@ -460,9 +473,10 @@ it.effect("keeps the snapshot text under the agent's output ceiling", () => expect(parsed.consoleEntries[0]?.text).toBe("entry 60"); expect(notice?.type === "text" ? notice.text : "").toContain("accessibilityTree"); expect(notice?.type === "text" ? notice.text : "").toContain("60 older console entries"); - // The structured result is untouched; only the text the agent reads is bounded. - expect(snapshot.structuredContent).toMatchObject({ - accessibilityTree: oversized.accessibilityTree, + // Claude Code shows the model structuredContent instead of the text, so it is bounded too. + expect(snapshot.structuredContent).toEqual({ + ...parsed, + omitted: expect.arrayContaining(["60 older console entries"]), }); }), ).pipe(Effect.provide(TestLayer)), @@ -500,6 +514,45 @@ it.effect("bounds the snapshot text even when nothing but logs and the title are ).pipe(Effect.provide(TestLayer)), ); +it.effect("bounds page text made of wide characters before dropping locators", () => + Effect.scoped( + Effect.gen(function* () { + // The character caps alone leave 8,000 three-byte characters, about 24 KB. + yield* serveSnapshots("mcp-wide-text-client", { + ...snapshotResult, + visibleText: "界".repeat(9_000), + interactiveElements: Array.from({ length: 20 }, (_, i) => ({ + tag: "button", + role: "button", + name: `Button ${i}`, + selector: `#button-${i}`, + x: 0, + y: 0, + width: 10, + height: 10, + })), + }); + + const snapshot = yield* callSnapshot({ includeImage: false }); + + const [, text, notice] = snapshot.content; + const body = text?.type === "text" ? text.text : ""; + expect(Buffer.byteLength(body, "utf8")).toBeLessThanOrEqual( + McpHttpServer.MAX_SNAPSHOT_TEXT_BYTES, + ); + const parsed = decodeJsonText(body) as { + readonly visibleText: string; + readonly interactiveElements: ReadonlyArray; + }; + expect(parsed.visibleText).toMatch(/^界+…$/); + expect(parsed.interactiveElements).toHaveLength(20); + expect(notice?.type === "text" ? notice.text : "").toContain( + "visibleText after 4000 characters", + ); + }), + ).pipe(Effect.provide(TestLayer)), +); + it.effect("sheds log entries before locators when every list is full", () => Effect.scoped( Effect.gen(function* () { diff --git a/apps/server/src/mcp/McpHttpServer.ts b/apps/server/src/mcp/McpHttpServer.ts index 5a8cb573ad88..f93c7643dafb 100644 --- a/apps/server/src/mcp/McpHttpServer.ts +++ b/apps/server/src/mcp/McpHttpServer.ts @@ -114,12 +114,15 @@ const McpAuthMiddlewareLive = HttpRouter.middleware<{ }>()(makeMcpAuthMiddleware).layer; /** - * Claude Code drops every MCP result above 25k tokens (~100 KB of text) and - * hands the agent a truncation notice instead, so a snapshot that carries the - * full accessibility tree and 20 KB of page text loses its locators too. Keep - * the text under that ceiling and tell the agent what was cut. + * Claude Code moves an MCP result above its output limit to a file and hands + * the agent a notice instead, so a snapshot that carries the full + * accessibility tree and page text loses its locators too. Claude Code also + * shows the model `structuredContent` in place of the text blocks when a + * result has both, so both carry the same bounded snapshot. Keep it near + * 20 KB and tell the agent what was cut. The short `omitted` notes may go a + * little over; the provider limit is far above this. */ -export const MAX_SNAPSHOT_TEXT_BYTES = 60_000; +export const MAX_SNAPSHOT_TEXT_BYTES = 20_000; const MAX_SNAPSHOT_VISIBLE_TEXT_CHARS = 8_000; const MAX_SNAPSHOT_ELEMENT_NAME_CHARS = 200; const MAX_SNAPSHOT_LOG_ENTRIES = 40; @@ -164,12 +167,11 @@ type SnapshotMetadata = { /** * Drops the accessibility tree, shortens page text, element names, identifiers, * and log strings, keeps only the newest log entries, and finally sheds - * interactive elements until the JSON fits. Returns the text plus notes on - * what is missing so the agent can reach for preview_evaluate. + * interactive elements until the JSON fits. Returns the bounded value, its + * text, and notes on what is missing so the agent can reach for + * preview_evaluate. */ -const boundSnapshotMetadata = ( - metadata: SnapshotMetadata, -): { readonly text: string; readonly omitted: ReadonlyArray } => { +const boundSnapshotMetadata = (metadata: SnapshotMetadata) => { const omitted: Array = []; const { accessibilityTree, ...withoutTree } = metadata; if (accessibilityTree !== undefined) { @@ -198,16 +200,10 @@ const boundSnapshotMetadata = ( ) { omitted.push(`element names longer than ${MAX_SNAPSHOT_ELEMENT_NAME_CHARS} characters`); } - if (metadata.visibleText.length > MAX_SNAPSHOT_VISIBLE_TEXT_CHARS) { - omitted.push( - `visibleText after ${MAX_SNAPSHOT_VISIBLE_TEXT_CHARS} characters (use preview_evaluate for more)`, - ); - } const bounded = { ...withoutTree, url: cutText(metadata.url, MAX_SNAPSHOT_IDENTIFIER_CHARS), title: cutText(metadata.title, MAX_SNAPSHOT_IDENTIFIER_CHARS), - visibleText: cutText(metadata.visibleText, MAX_SNAPSHOT_VISIBLE_TEXT_CHARS), interactiveElements: metadata.interactiveElements.map((element) => ({ ...element, name: cutText(element.name, MAX_SNAPSHOT_ELEMENT_NAME_CHARS), @@ -218,9 +214,10 @@ const boundSnapshotMetadata = ( }; // Per-field caps do not sum below the ceiling: three log arrays of 40 capped - // entries alone can pass 60 KB. Shed the least useful lists first, halving - // one list per round, until the JSON fits. With every list empty the rest - // is bounded by the identifier and visibleText caps, so this terminates. + // entries alone can pass 60 KB, and the caps count characters, not bytes. + // Halve one thing per round until the JSON fits: logs first, then page + // text, then the locators. The identifier caps bound the rest, so this + // terminates. const shedOrder = [ "actionTimeline", "networkEntries", @@ -239,31 +236,51 @@ const boundSnapshotMetadata = ( networkEntries: 0, actionTimeline: 0, }; - let text = encodeJsonText({ ...bounded, ...lists }); + let visibleTextChars = Math.min(metadata.visibleText.length, MAX_SNAPSHOT_VISIBLE_TEXT_CHARS); + const value = () => ({ + ...bounded, + visibleText: cutText(metadata.visibleText, visibleTextChars), + ...lists, + }); + let text = encodeJsonText(value()); while (utf8Length(text) > MAX_SNAPSHOT_TEXT_BYTES) { // Elements carry the locators, so they go last; logs shed newest-last. const key = shedOrder.find( (candidate) => candidate !== "interactiveElements" && lists[candidate].length > 0, - ) ?? (lists.interactiveElements.length > 0 ? "interactiveElements" : undefined); + ) ?? + (visibleTextChars > 0 + ? "visibleText" + : lists.interactiveElements.length > 0 + ? "interactiveElements" + : undefined); if (key === undefined) break; - const keep = Math.floor(lists[key].length / 2); - dropped[key] += lists[key].length - keep; - // slice(-0) keeps everything, so spell out the empty case. - lists[key] = - keep === 0 - ? [] - : key === "interactiveElements" - ? lists[key].slice(0, keep) - : lists[key].slice(-keep); - text = encodeJsonText({ ...bounded, ...lists }); + if (key === "visibleText") { + visibleTextChars = Math.floor(visibleTextChars / 2); + } else { + const keep = Math.floor(lists[key].length / 2); + dropped[key] += lists[key].length - keep; + // slice(-0) keeps everything, so spell out the empty case. + lists[key] = + keep === 0 + ? [] + : key === "interactiveElements" + ? lists[key].slice(0, keep) + : lists[key].slice(-keep); + } + text = encodeJsonText(value()); + } + if (visibleTextChars < metadata.visibleText.length) { + omitted.push( + `visibleText after ${visibleTextChars} characters (use preview_evaluate for more)`, + ); } for (const key of shedOrder) { if (dropped[key] > 0) { omitted.push(`${dropped[key]} of ${bounded[key].length} ${key}`); } } - return { text, omitted }; + return { value: value(), text, omitted }; }; export class PreviewScreenshotSaveError extends Schema.TaggedError()( @@ -396,6 +413,18 @@ const registerPreviewSnapshot = Effect.fn("McpHttpServer.registerPreviewSnapshot const png = new Uint8Array(Buffer.from(screenshot.data, "base64")); const screenshotPath = payload?.save === true ? yield* saveScreenshot(snapshot.url, png) : undefined; + if (screenshotPath !== undefined && payload?.includeImage === false) { + // The agent only wants a file to show the user. The url keeps the site icon on the tool row. + const saved = { + url: cutText(snapshot.url, MAX_SNAPSHOT_IDENTIFIER_CHARS), + screenshotPath, + }; + return new McpSchema.CallToolResult({ + isError: false, + structuredContent: saved, + content: [{ type: "text", text: encodeJsonText(saved) }], + }); + } const metadata = { ...page, screenshot: { @@ -408,7 +437,10 @@ const registerPreviewSnapshot = Effect.fn("McpHttpServer.registerPreviewSnapshot const bounded = boundSnapshotMetadata(metadata); return new McpSchema.CallToolResult({ isError: false, - structuredContent: metadata, + structuredContent: + bounded.omitted.length === 0 + ? bounded.value + : { ...bounded.value, omitted: bounded.omitted }, content: [ // Keep the page identity readable even if a provider truncates the snapshot. { diff --git a/apps/server/src/mcp/toolkits/preview/tools.ts b/apps/server/src/mcp/toolkits/preview/tools.ts index 3f80e84e9a59..1c790e8b643a 100644 --- a/apps/server/src/mcp/toolkits/preview/tools.ts +++ b/apps/server/src/mcp/toolkits/preview/tools.ts @@ -119,7 +119,7 @@ const PreviewSetAppearanceTool = safeBrowserTool( export const PreviewSnapshotTool = readonlyBrowserTool( Tool.make("preview_snapshot", { description: - "Inspect a page before interacting. Pass tabId to inspect a specific tab; omit it to use this agent session's current tab. Returns page state, semantic elements, diagnostics, action history, and a PNG screenshot. Set includeImage=false for text-only output with the same page metadata. Set save=true to also write the PNG to disk and get screenshotPath back; embed that path in your reply as ![alt](screenshotPath) so the user sees it. This is the only way to show the user a screenshot; the image in the tool result is not saved anywhere.", + "Inspect a page before interacting. Pass tabId to inspect a specific tab; omit it to use this agent session's current tab. Returns page state, semantic elements, diagnostics, action history, and a PNG screenshot. The text is capped near 20 KB and lists what it omitted; use preview_evaluate to read more. Set includeImage=false for text-only output with the same page metadata. Set save=true to also write the PNG to disk and get screenshotPath back; with includeImage=false, save=true returns only the url and screenshotPath. Embed that path in your reply as ![alt](screenshotPath) so the user sees it. This is the only way to show the user a screenshot; the image in the tool result is not saved anywhere.", parameters: Schema.Struct({ ...PreviewAutomationTabTargetInput.fields, includeImage: Schema.optional( @@ -131,7 +131,7 @@ export const PreviewSnapshotTool = readonlyBrowserTool( save: Schema.optional( Schema.Boolean.annotate({ description: - "Write the screenshot PNG to disk and return its absolute path as screenshotPath. Defaults to false.", + "Write the screenshot PNG to disk and return its absolute path as screenshotPath. With includeImage=false, return only the url and screenshotPath. Defaults to false.", }), ), }), From 0c84b4289cc9dee9af770a823f812ea1e8bea05d Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 21:56:54 -0700 Subject: [PATCH 30/58] fix(web): paste after clicking away from the composer lands in it again (#13553) Co-authored-by: Claude Opus 5.5 (1M context) --- apps/web/src/components/ChatView.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index e33e12f4eaca..079c7d97b5bb 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -642,6 +642,8 @@ const TYPE_TO_FOCUS_INTERACTIVE_SELECTOR = [ '[role="switch"]', '[role="tab"]', ].join(","); +// Popups match only while open or closing: some stay mounted when closed, +// such as the chat header actions menu. const TYPE_TO_FOCUS_FLOATING_LAYER_SELECTOR = [ '[role="dialog"][aria-modal="true"]', '[data-slot="alert-dialog-popup"]:is([data-open],[data-ending-style])', @@ -649,11 +651,11 @@ const TYPE_TO_FOCUS_FLOATING_LAYER_SELECTOR = [ '[data-slot="dialog-popup"]:is([data-open],[data-ending-style])', '[data-slot="sheet-popup"]:is([data-open],[data-ending-style])', '[data-slot="sidebar"][data-mobile="true"]:is([data-open],[data-ending-style])', - '[data-slot="menu-popup"]', - '[data-slot="select-popup"]', - '[data-slot="popover-popup"]', - '[data-slot="combobox-popup"]', - '[data-slot="autocomplete-popup"]', + '[data-slot="menu-popup"]:is([data-open],[data-ending-style])', + '[data-slot="select-popup"]:is([data-open],[data-ending-style])', + '[data-slot="popover-popup"]:is([data-open],[data-ending-style])', + '[data-slot="combobox-popup"]:is([data-open],[data-ending-style])', + '[data-slot="autocomplete-popup"]:is([data-open],[data-ending-style])', ].join(","); type EnvironmentUnavailableState = { From 99641fd09a509feb644b3c8ef718c12c60cf436c Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 21:57:35 -0700 Subject: [PATCH 31/58] feat(desktop): keep running threads synced in the background (#13554) Co-authored-by: Claude Opus 5.5 (1M context) --- .../desktop/RunningThreadKeepAlive.tsx | 14 ++ apps/web/src/routes/__root.tsx | 3 + apps/web/src/state/threads.test.ts | 200 ++++++++++++++++++ apps/web/src/state/threads.ts | 86 +++++++- docs/internals/connection-runtime.md | 9 + packages/client-runtime/src/state/threads.ts | 11 +- 6 files changed, 320 insertions(+), 3 deletions(-) create mode 100644 apps/web/src/components/desktop/RunningThreadKeepAlive.tsx create mode 100644 apps/web/src/state/threads.test.ts diff --git a/apps/web/src/components/desktop/RunningThreadKeepAlive.tsx b/apps/web/src/components/desktop/RunningThreadKeepAlive.tsx new file mode 100644 index 000000000000..68c2c0cf609a --- /dev/null +++ b/apps/web/src/components/desktop/RunningThreadKeepAlive.tsx @@ -0,0 +1,14 @@ +import { useAtomMount } from "@effect/atom-react"; + +import { runningThreadKeepAliveAtom } from "../../state/threads"; + +/** + * Desktop only. Keeps each running thread subscribed in every enabled + * environment, so opening one shows live state without a replay or a sync + * status flash. It mounts the atom without reading it, so thread updates + * never re-render. + */ +export function RunningThreadKeepAlive() { + useAtomMount(runningThreadKeepAliveAtom); + return null; +} diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsx index eee703ac3f47..8480dc70c717 100644 --- a/apps/web/src/routes/__root.tsx +++ b/apps/web/src/routes/__root.tsx @@ -26,6 +26,7 @@ import { RelayClientInstallDialog } from "../components/cloud/RelayClientInstall import { SshPasswordPromptDialog } from "../components/desktop/SshPasswordPromptDialog"; import { SnapShotCoordinator } from "../components/desktop/SnapShotCoordinator"; import { DesktopAppActivationCoordinator } from "../components/desktop/DesktopAppActivationCoordinator"; +import { RunningThreadKeepAlive } from "../components/desktop/RunningThreadKeepAlive"; import { ProviderUpdateLaunchNotification } from "../components/ProviderUpdateLaunchNotification"; import { ThreadNotificationCoordinator } from "../components/ThreadNotificationCoordinator"; import { ProjectCloneToastCoordinator } from "../components/ProjectCloneToastCoordinator"; @@ -43,6 +44,7 @@ import { toastManager, } from "../components/ui/toast"; import { resolveAndPersistPreferredEditor } from "../editorPreferences"; +import { isElectron } from "../env"; import { applyAppearanceFontVariables } from "~/appearanceFonts"; import { applyAppearanceContrast } from "~/appearanceContrast"; import { useClientSettings } from "../hooks/useSettings"; @@ -219,6 +221,7 @@ function RootRouteView() { > {primaryEnvironmentAuthenticated ? : null} {primaryEnvironmentAuthenticated ? : null} + {isElectron ? : null} diff --git a/apps/web/src/state/threads.test.ts b/apps/web/src/state/threads.test.ts new file mode 100644 index 000000000000..cf1fc8777283 --- /dev/null +++ b/apps/web/src/state/threads.test.ts @@ -0,0 +1,200 @@ +import { + EMPTY_ENVIRONMENT_THREAD_STATE, + type EnvironmentThreadState, +} from "@t3tools/client-runtime/state/threads"; +import { + EnvironmentId, + ProjectId, + ProviderInstanceId, + ThreadId, + type OrchestrationSessionStatus, + type OrchestrationThread, + type OrchestrationThreadShell, +} from "@t3tools/contracts"; +import * as Option from "effect/Option"; +import { AsyncResult, Atom, AtomRegistry } from "effect/unstable/reactivity"; +import { describe, expect, it } from "vite-plus/test"; + +import { createRunningThreadKeepAliveAtom } from "./threads"; + +const LOCAL = EnvironmentId.make("local"); +const REMOTE = EnvironmentId.make("remote"); + +function session(threadId: ThreadId, status: OrchestrationSessionStatus) { + return { + threadId, + status, + providerName: "codex", + runtimeMode: "full-access", + activeTurnId: null, + lastError: null, + updatedAt: "2026-09-24T00:00:00.000Z", + } satisfies OrchestrationThread["session"]; +} + +function shell(id: string, status: OrchestrationSessionStatus | null) { + const threadId = ThreadId.make(id); + return { + id: threadId, + session: status === null ? null : session(threadId, status), + } satisfies Pick; +} + +function detail( + id: string, + status: OrchestrationSessionStatus, + overrides: Partial = {}, +) { + const threadId = ThreadId.make(id); + const thread: OrchestrationThread = { + id: threadId, + projectId: ProjectId.make("project"), + title: id, + modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" }, + runtimeMode: "full-access", + interactionMode: "default", + branch: null, + worktreePath: null, + latestTurn: null, + createdAt: "2026-09-24T00:00:00.000Z", + updatedAt: "2026-09-24T00:00:00.000Z", + archivedAt: null, + settledOverride: null, + settledAt: null, + pullRequests: [], + deletedAt: null, + messages: [], + proposedPlans: [], + activities: [], + checkpoints: [], + session: session(threadId, status), + }; + return AsyncResult.success({ + ...EMPTY_ENVIRONMENT_THREAD_STATE, + status: "live", + data: Option.some(thread), + ...overrides, + }); +} + +function makeHarness() { + // Registry cleanup runs only on `flush`, like the real deferred task. + const tasks: Array<() => void> = []; + const registry = AtomRegistry.make({ + scheduleTask: (task) => { + tasks.push(task); + return () => {}; + }, + }); + const flush = () => { + for (let task = tasks.shift(); task !== undefined; task = tasks.shift()) task(); + }; + const environmentIds = Atom.make>([LOCAL, REMOTE]).pipe( + Atom.keepAlive, + ); + const threads = Atom.family((_environmentId: EnvironmentId) => + Atom.make>>([]).pipe(Atom.keepAlive), + ); + // Stand-ins for the thread state atoms. Each one lives only while mounted, + // as the real stream does. + const keys = new Set(); + const states = Atom.family((_key: string) => + Atom.make>( + AsyncResult.success(EMPTY_ENVIRONMENT_THREAD_STATE), + ), + ); + const stateAtom = (environmentId: EnvironmentId, threadId: string) => { + const key = `${environmentId}:${threadId}`; + keys.add(key); + return states(key); + }; + const keepAlive = createRunningThreadKeepAliveAtom({ + environmentIdsAtom: environmentIds, + threadsAtom: threads, + stateAtom, + }); + registry.mount(keepAlive); + return { + registry, + environmentIds, + threads, + stateAtom, + keepAlive, + openStreams: () => { + flush(); + return [...keys].filter((key) => registry.getNodes().has(states(key))).toSorted(); + }, + }; +} + +describe("createRunningThreadKeepAliveAtom", () => { + it("keeps running threads open across shell updates and thread view visits", () => { + const h = makeHarness(); + h.registry.set(h.threads(LOCAL), [ + shell("a", "running"), + shell("b", "ready"), + shell("c", null), + ]); + h.registry.set(h.threads(REMOTE), [shell("d", "starting")]); + expect(h.openStreams()).toEqual(["local:a", "remote:d"]); + + // A thread view that comes and goes shares the kept stream. + const live = detail("a", "running"); + h.registry.set(h.stateAtom(LOCAL, "a"), live); + h.registry.mount(h.stateAtom(LOCAL, "a"))(); + + // A shell update that starts or stops nothing does not rebuild the set. + const kept = h.registry.get(h.keepAlive); + h.registry.set(h.threads(LOCAL), [shell("a", "running"), shell("b", "ready")]); + expect(h.registry.get(h.keepAlive)).toBe(kept); + expect(h.openStreams()).toEqual(["local:a", "remote:d"]); + expect(h.registry.get(h.stateAtom(LOCAL, "a"))).toBe(live); + }); + + it("holds a stopped thread until its own stream is live and shows the stop", () => { + const h = makeHarness(); + h.registry.set(h.threads(LOCAL), [ + shell("a", "running"), + shell("b", "running"), + shell("c", "running"), + ]); + // "b" has not loaded yet. "c" hit a stream error. + h.registry.set(h.stateAtom(LOCAL, "a"), detail("a", "running")); + h.registry.set( + h.stateAtom(LOCAL, "c"), + detail("c", "running", { status: "cached", error: Option.some("Could not sync.") }), + ); + + // The shell reports the stops first. A failed stream cannot deliver its + // stop, so only it is released now. + h.registry.set(h.threads(LOCAL), [ + shell("a", "ready"), + shell("b", "ready"), + shell("c", "ready"), + ]); + expect(h.openStreams()).toEqual(["local:a", "local:b"]); + + h.registry.set(h.stateAtom(LOCAL, "a"), detail("a", "ready")); + h.registry.set(h.stateAtom(LOCAL, "b"), detail("b", "ready", { status: "synchronizing" })); + expect(h.openStreams()).toEqual(["local:b"]); + h.registry.set(h.stateAtom(LOCAL, "b"), detail("b", "ready")); + expect(h.openStreams()).toEqual([]); + }); + + it("follows environments that connect and go away", () => { + const h = makeHarness(); + h.registry.set(h.environmentIds, [LOCAL]); + h.registry.set(h.threads(REMOTE), [shell("d", "running")]); + expect(h.openStreams()).toEqual([]); + + h.registry.set(h.environmentIds, [LOCAL, REMOTE]); + expect(h.openStreams()).toEqual(["remote:d"]); + + // Removal drops every mount, including one still waiting for its stop. + h.registry.set(h.stateAtom(REMOTE, "d"), detail("d", "running")); + h.registry.set(h.threads(REMOTE), [shell("d", "ready")]); + expect(h.openStreams()).toEqual(["remote:d"]); + h.registry.set(h.environmentIds, [LOCAL]); + expect(h.openStreams()).toEqual([]); + }); +}); diff --git a/apps/web/src/state/threads.ts b/apps/web/src/state/threads.ts index deda3ca29e9a..31f8fea47b3f 100644 --- a/apps/web/src/state/threads.ts +++ b/apps/web/src/state/threads.ts @@ -1,4 +1,6 @@ import { useAtomValue } from "@effect/atom-react"; +import { enabledEnvironmentIds } from "@t3tools/client-runtime/state/connections"; +import { arrayElementsEqual } from "@t3tools/client-runtime/state/entities"; import { createEnvironmentThreadDetailAtoms, createEnvironmentThreadShellAtoms, @@ -6,8 +8,9 @@ import { EMPTY_ENVIRONMENT_THREAD_STATE, type EnvironmentThreadState, createThreadEnvironmentAtoms, + isThreadSessionRunning, } from "@t3tools/client-runtime/state/threads"; -import type { EnvironmentId, ThreadId } from "@t3tools/contracts"; +import type { EnvironmentId, OrchestrationThreadShell, ThreadId } from "@t3tools/contracts"; import * as Option from "effect/Option"; import { AsyncResult, Atom } from "effect/unstable/reactivity"; @@ -46,3 +49,84 @@ export function useEnvironmentThread( () => EMPTY_ENVIRONMENT_THREAD_STATE, ) as EnvironmentThreadState; } + +type KeptThreads = ReadonlyMap>; + +// True once a thread's own stream no longer needs to stay open: it is in sync +// and shows a settled session, or it cannot progress (deleted or failed). A +// stream that is still loading or reconnecting keeps waiting for the stop. +function isDetailDone(result: AsyncResult.AsyncResult): boolean { + if (!AsyncResult.isSuccess(result)) return true; + const { status, data, error } = result.value; + if (status === "deleted" || Option.isSome(error)) return true; + return ( + status === "live" && !Option.exists(data, (thread) => isThreadSessionRunning(thread.session)) + ); +} + +/** + * Keeps the thread state atom mounted for each running thread in the listed + * environments. Mount the result; its value is only bookkeeping. + * + * The shell and detail streams are independent, so the shell can report a + * stop before the detail loads or catches up. A stopped thread stays mounted + * until its own detail is live and shows the stop too. Then the stream closes + * and saves the settled state to disk. + */ +export function createRunningThreadKeepAliveAtom(input: { + readonly environmentIdsAtom: Atom.Atom>; + readonly threadsAtom: ( + environmentId: EnvironmentId, + ) => Atom.Atom>>; + readonly stateAtom: ( + environmentId: EnvironmentId, + threadId: ThreadId, + ) => Atom.Atom>; +}) { + // Keeps its identity until a thread starts or stops, so ordinary shell + // updates do not rebuild the keep-alive set. + const runningThreadIdsAtom = Atom.family((environmentId: EnvironmentId) => { + let previous: ReadonlyArray = []; + return Atom.make((get) => { + const running = get(input.threadsAtom(environmentId)).flatMap((thread) => + isThreadSessionRunning(thread.session) ? [thread.id] : [], + ); + if (arrayElementsEqual(previous, running)) return previous; + previous = running; + return running; + }).pipe(Atom.withLabel(`web-running-thread-ids:${environmentId}`)); + }); + + return Atom.make((get): KeptThreads => { + const previous = Option.getOrUndefined(get.self()); + const kept = new Map>(); + // An environment that leaves the list is not visited, so its mounts drop. + for (const environmentId of get(input.environmentIdsAtom)) { + const threadIds = new Set(get(runningThreadIdsAtom(environmentId))); + for (const threadId of previous?.get(environmentId) ?? []) { + if (threadIds.has(threadId)) continue; + const stateAtom = input.stateAtom(environmentId, threadId); + // `once`, not `get`: a dependency on a stopped thread would hold its + // stream open until some other change rebuilds this atom. + if (isDetailDone(get.once(stateAtom))) continue; + threadIds.add(threadId); + // Rebuild when this detail is done, not on each update. + get.subscribe(stateAtom, (state) => { + if (isDetailDone(state)) get.refreshSelf(); + }); + } + for (const threadId of threadIds) get.mount(input.stateAtom(environmentId, threadId)); + kept.set(environmentId, threadIds); + } + return kept; + }).pipe(Atom.withLabel("web-running-thread-keep-alive")); +} + +/** Mounted by `RunningThreadKeepAlive` on desktop, for every enabled environment. */ +export const runningThreadKeepAliveAtom = createRunningThreadKeepAliveAtom({ + environmentIdsAtom: Atom.map(environmentCatalog.catalogValueAtom, (catalog) => [ + ...enabledEnvironmentIds(catalog), + ]), + threadsAtom: environmentThreadShells.environmentThreadsAtom, + stateAtom: environmentThreads.stateAtom, +}); diff --git a/docs/internals/connection-runtime.md b/docs/internals/connection-runtime.md index 797ff8fe31fe..301e1e0ffecb 100644 --- a/docs/internals/connection-runtime.md +++ b/docs/internals/connection-runtime.md @@ -61,6 +61,15 @@ stream, which stops when the last consumer unmounts; hidden mounted routes still count. A registry-local cache retains state and its replay cursor for five idle minutes so back navigation can resume without another snapshot download. +The desktop app adds one consumer: a +[keep-alive](../../apps/web/src/state/threads.ts) mounts every thread whose +session is starting or running, in each enabled environment. Opening a running +thread then needs no replay. The shell and detail streams are independent, so +the shell can report a stop before the detail loads or catches up. A stopped +thread stays mounted until its own stream is live and shows the stop, and the +stream then closes and saves the settled state. +Web and mobile do not keep threads alive. + Retain state and cursor together only after an update finishes. Cancellation must not advance the cached cursor beyond the applied data, and an old scope must not overwrite its successor's cache. Preserve pagination data on reuse, but clear diff --git a/packages/client-runtime/src/state/threads.ts b/packages/client-runtime/src/state/threads.ts index b7074b9304bb..e0be27d35358 100644 --- a/packages/client-runtime/src/state/threads.ts +++ b/packages/client-runtime/src/state/threads.ts @@ -126,9 +126,16 @@ function formatThreadError(cause: Cause.Cause): string { : "Could not synchronize the thread."; } +/** + * A starting or running session is mid-turn. Its detail can change many times + * per second, so the disk cache waits for it to settle. + */ +export function isThreadSessionRunning(session: OrchestrationThread["session"]): boolean { + return session?.status === "starting" || session?.status === "running"; +} + function shouldPersistThread(thread: OrchestrationThread): boolean { - const status = thread.session?.status; - return status !== "starting" && status !== "running"; + return !isThreadSessionRunning(thread.session); } interface ThreadResumeSnapshot { From 1e192b25583dd682324acd52f396be3d2ec9ee23 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 22:05:20 -0700 Subject: [PATCH 32/58] fix(mcp): preview errors tell agents what to do instead (#13559) Co-authored-by: Claude Opus 5.5 (1M context) --- apps/server/src/mcp/McpHttpServer.test.ts | 54 ++++++++++++++++++- apps/server/src/mcp/McpHttpServer.ts | 11 +++- .../src/mcp/McpInvocationContext.test.ts | 3 +- packages/contracts/src/previewAutomation.ts | 13 +++-- 4 files changed, 70 insertions(+), 11 deletions(-) diff --git a/apps/server/src/mcp/McpHttpServer.test.ts b/apps/server/src/mcp/McpHttpServer.test.ts index 1415e2e8dcb8..5619f19b2549 100644 --- a/apps/server/src/mcp/McpHttpServer.test.ts +++ b/apps/server/src/mcp/McpHttpServer.test.ts @@ -161,21 +161,73 @@ it.effect.each([{}, { includeImage: false }])( Effect.provideService(McpSchema.McpServerClient, client), ); + const message = "Preview automation snapshot failed on client mcp-failure-client."; expect(snapshot.isError).toBe(true); expect(snapshot.content).toEqual([ - { type: "text", text: "Preview snapshot failed: PreviewAutomationExecutionError." }, + { type: "text", text: `Preview snapshot failed: ${message}` }, ]); expect(snapshot.structuredContent).toEqual({ error: { _tag: "PreviewAutomationExecutionError", operation: "snapshot", failureCount: 1, + message, }, }); }), ).pipe(Effect.provide(TestLayer)), ); +it.effect.each([ + { args: {}, advice: "No active preview tab was found for snapshot. Call preview_open first." }, + { + args: { tabId: alternateTabId }, + advice: `Preview tab ${alternateTabId} was not found for snapshot. Omit tabId to use the current tab, or call preview_open.`, + }, +])("tells the agent to open a tab when the snapshot has none $args", ({ args, advice }) => + Effect.scoped( + Effect.gen(function* () { + const broker = yield* PreviewAutomationBroker.PreviewAutomationBroker; + const connected = yield* Deferred.make(); + const events = yield* broker.connect({ clientId: "mcp-no-tab-client", environmentId }); + yield* Stream.runForEach(events, (event) => + event.type === "connected" + ? Deferred.succeed(connected, undefined) + : broker.respond({ + clientId: "mcp-no-tab-client", + connectionId: event.connectionId, + requestId: event.request.requestId, + ok: false, + error: { _tag: "PreviewAutomationTabNotFoundError", message: "no tab" }, + }), + ).pipe(Effect.forkScoped); + yield* Deferred.await(connected); + + const snapshot = yield* callSnapshot(args); + + expect(snapshot.isError).toBe(true); + expect(snapshot.content).toEqual([ + { type: "text", text: `Preview snapshot failed: ${advice}` }, + ]); + }), + ).pipe(Effect.provide(TestLayer)), +); + +it.effect("tells the agent how to fall back when no desktop app can run the snapshot", () => + Effect.gen(function* () { + const snapshot = yield* callSnapshot({}); + + expect(snapshot.isError).toBe(true); + const [text] = snapshot.content; + expect(text?.type === "text" ? text.text : "").toContain( + "use a headless browser from the shell", + ); + expect(snapshot.structuredContent).toMatchObject({ + error: { _tag: "PreviewAutomationNoAvailableHostError" }, + }); + }).pipe(Effect.provide(TestLayer)), +); + it.effect.each([ { mode: "default", input: {}, images: true }, { mode: "explicit image", input: { includeImage: true }, images: true }, diff --git a/apps/server/src/mcp/McpHttpServer.ts b/apps/server/src/mcp/McpHttpServer.ts index f93c7643dafb..5a807fc328af 100644 --- a/apps/server/src/mcp/McpHttpServer.ts +++ b/apps/server/src/mcp/McpHttpServer.ts @@ -13,6 +13,7 @@ import * as Stream from "effect/Stream"; import type * as Types from "effect/Types"; import { McpProtocol, McpSchema, McpServer, Tool } from "effect/unstable/ai"; import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/unstable/http"; +import { PreviewAutomationError } from "@t3tools/contracts"; import packageJson from "../../package.json" with { type: "json" }; import * as ServerConfig from "../config.ts"; @@ -328,6 +329,8 @@ const saveScreenshot = Effect.fn("McpHttpServer.saveScreenshot")(function* ( return screenshotPath; }); +const isPreviewAutomationError = Schema.is(PreviewAutomationError); + const previewSnapshotFailure = (cause: Cause.Cause) => { if (Cause.hasInterrupts(cause) || cause.reasons.some(Cause.isDieReason)) { return Effect.failCause(cause).pipe(Effect.orDie); @@ -341,6 +344,9 @@ const previewSnapshotFailure = (cause: Cause.Cause) => { typeof firstFailure._tag === "string" ? firstFailure._tag : "PreviewSnapshotError"; + // Preview errors build their message on the server, never from page output, + // and it tells the agent what to do next, such as falling back to a shell browser. + const message = isPreviewAutomationError(firstFailure) ? firstFailure.message : undefined; const result = new McpSchema.CallToolResult({ isError: true, structuredContent: { @@ -348,10 +354,11 @@ const previewSnapshotFailure = (cause: Cause.Cause) => { _tag: errorTag, operation: "snapshot", failureCount: failures.length, + ...(message === undefined ? {} : { message }), }, }, - // Agents usually see only the text content, so name the tag there too. - content: [{ type: "text", text: `Preview snapshot failed: ${errorTag}.` }], + // Some clients show only the text content and others only structuredContent, so both carry it. + content: [{ type: "text", text: `Preview snapshot failed: ${message ?? `${errorTag}.`}` }], }); return Effect.logWarning("preview snapshot failed", { operation: "snapshot", diff --git a/apps/server/src/mcp/McpInvocationContext.test.ts b/apps/server/src/mcp/McpInvocationContext.test.ts index 123944206e37..4314c82e6ddc 100644 --- a/apps/server/src/mcp/McpInvocationContext.test.ts +++ b/apps/server/src/mcp/McpInvocationContext.test.ts @@ -34,7 +34,8 @@ it.effect("reports the scoped credential context when preview capability is unav providerSessionId: invocation.providerSessionId, providerInstanceId: invocation.providerInstanceId, }); - expect(error.message).toBe("MCP credential does not grant the preview capability."); + expect(error.message).toContain("MCP credential does not grant the preview capability"); + expect(error.message).toContain("use a headless browser from the shell"); }); }); diff --git a/packages/contracts/src/previewAutomation.ts b/packages/contracts/src/previewAutomation.ts index 431e83189d22..f87739670f75 100644 --- a/packages/contracts/src/previewAutomation.ts +++ b/packages/contracts/src/previewAutomation.ts @@ -649,6 +649,7 @@ const McpCapabilityErrorFields = { providerInstanceId: ProviderInstanceId, }; +/** Agents read this message, so it names the next step and not only the failure. */ export class PreviewAutomationUnavailableError extends Schema.TaggedError()( "PreviewAutomationUnavailableError", { @@ -657,7 +658,7 @@ export class PreviewAutomationUnavailableError extends Schema.TaggedError Date: Thu, 24 Sep 2026 22:06:27 -0700 Subject: [PATCH 33/58] feat(web): agents working banner links to the Agents panel (#13572) Co-authored-by: Claude Opus 5.5 (1M context) --- apps/web/src/components/ChatView.tsx | 29 ++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 079c7d97b5bb..cd36675860df 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -6299,6 +6299,9 @@ export default function ChatView(props: ChatViewProps) { } const working = activeBackgroundLiveness === "working"; const liveCount = agentPanelModel.liveCount; + // Hidden once the Agents surface is on screen; the link would point at nothing. + const showViewAgents = + liveCount > 0 && !(rightPanelOpen && activeRightPanelSurface?.kind === "agents"); return { id: `background-liveness:${activeThread.id}`, variant: "default", @@ -6315,22 +6318,32 @@ export default function ChatView(props: ChatViewProps) { : "Background work" : "Monitoring", actions: ( - + <> + {showViewAgents ? ( + + ) : null} + + ), }; }, [ activeBackgroundLiveness, + activeRightPanelSurface?.kind, activeThread, + addAgentsSurface, agentPanelModel.liveCount, handleStopBackgroundWork, isStoppingBackgroundWork, + rightPanelOpen, ]); // A woken thread announces itself in the open view, not just the sidebar // pill. Dismissing marks the wake as seen (same acknowledgment as the From 7b84431161a64c9f9e9b57637dec23474a1b4236 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 24 Sep 2026 22:14:36 -0700 Subject: [PATCH 34/58] fix(web): size the Android fold model from the inner display (#13574) Co-authored-by: Claude Opus 5.5 (1M context) --- .../src/device/androidFoldScene.test.ts | 21 +++++++ .../src/device/androidFoldScene.ts | 61 +++++++++++++------ .../src/device/phoneViewer.test.ts | 58 +++++++++++++++++- .../client-runtime/src/device/phoneViewer.ts | 48 ++++++++++----- 4 files changed, 154 insertions(+), 34 deletions(-) diff --git a/packages/client-runtime/src/device/androidFoldScene.test.ts b/packages/client-runtime/src/device/androidFoldScene.test.ts index bb677c4818ee..e1e237a9f131 100644 --- a/packages/client-runtime/src/device/androidFoldScene.test.ts +++ b/packages/client-runtime/src/device/androidFoldScene.test.ts @@ -54,4 +54,25 @@ describe("Android fold scene", () => { scene.dispose(); texture.dispose(); }); + + it("shapes the inner display to the raw frame, portrait or landscape", () => { + const texture = new Texture(); + for (const [width, height] of [ + [2076, 2152], + [2208, 1840], + ] as const) { + const scene = createAndroidFoldScene( + texture, + phoneDisplayLayout(null, width, height), + 180, + width / height, + ); + const screen = scene.root.getObjectByName("continuous-inner-screen") as Mesh; + screen.geometry.computeBoundingBox(); + const size = screen.geometry.boundingBox!.getSize(new Vector3()); + expect(size.x / size.y).toBeCloseTo(width / height, 2); + scene.dispose(); + } + texture.dispose(); + }); }); diff --git a/packages/client-runtime/src/device/androidFoldScene.ts b/packages/client-runtime/src/device/androidFoldScene.ts index 3c30ecabc550..b2c1f84fe038 100644 --- a/packages/client-runtime/src/device/androidFoldScene.ts +++ b/packages/client-runtime/src/device/androidFoldScene.ts @@ -19,7 +19,6 @@ import { } from "three"; import type { PhoneDisplayLayout } from "./phoneScene.ts"; -const HALF_WIDTH = 1.04; const HEIGHT = 2.2; const DEPTH = 0.075; const INSET = 0.026; @@ -28,10 +27,24 @@ const BEVEL = 0.008; // The hinge axis sits just above the inner screens so closed halves meet face to face. const PIVOT_Z = DEPTH / 2 + 0.005; const SPINE_RADIUS = PIVOT_Z + DEPTH / 2 - 0.002; +/** Width over height of the unfolded inner display until a live frame reports its own. */ +export const DEFAULT_FOLD_INNER_ASPECT = 2076 / 2152; +/** + * Unfolded inner displays are near square in either orientation. Cover displays are + * phone shaped (about 0.4-0.5, or 2-2.6 when rotated), so they never retune the body. + */ +export const isFoldInnerAspect = (aspect: number) => + Number.isFinite(aspect) && aspect > 0.75 && aspect < 1.5; -function panelPath(side: "left" | "right", inset: number, radius: number, hingeInset = 0) { - const left = side === "left" ? -HALF_WIDTH + inset : CREASE / 2 + hingeInset; - const right = side === "left" ? -CREASE / 2 - hingeInset : HALF_WIDTH - inset; +function panelPath( + halfWidth: number, + side: "left" | "right", + inset: number, + radius: number, + hingeInset = 0, +) { + const left = side === "left" ? -halfWidth + inset : CREASE / 2 + hingeInset; + const right = side === "left" ? -CREASE / 2 - hingeInset : halfWidth - inset; const bottom = -HEIGHT / 2 + inset; const top = HEIGHT / 2 - inset; const path = new Shape(); @@ -70,16 +83,22 @@ function roundedRectPath(width: number, height: number, radius: number) { return path; } -function coverPath() { - return roundedRectPath(HALF_WIDTH - INSET * 2 - 0.02, HEIGHT - INSET * 2 - 0.04, 0.07); +function coverPath(halfWidth: number) { + return roundedRectPath(halfWidth - INSET * 2 - 0.02, HEIGHT - INSET * 2 - 0.04, 0.07); } -/** A procedural book-style foldable: one fixed half, one half rotating around a shared hinge. */ +/** + * A procedural book-style foldable: one fixed half, one half rotating around a shared hinge. + * The inner display keeps the raw framebuffer's native aspect, portrait or landscape. + */ export function createAndroidFoldScene( texture: Texture, layout: PhoneDisplayLayout, initialAngle: number, + innerAspect = DEFAULT_FOLD_INNER_ASPECT, ) { + const screenHeight = HEIGHT - 2 * INSET; + const halfWidth = (innerAspect * screenHeight) / 2 + INSET; const root = new Group(); const orientation = new Group(); root.add(orientation); @@ -146,7 +165,7 @@ export function createAndroidFoldScene( function half(group: Group, side: "left" | "right", back: MeshPhysicalMaterial) { const body = new Mesh( - new ExtrudeGeometry(panelPath(side, BEVEL, 0.1, BEVEL), { + new ExtrudeGeometry(panelPath(halfWidth, side, BEVEL, 0.1, BEVEL), { depth: DEPTH - BEVEL * 2, bevelEnabled: true, bevelSize: BEVEL, @@ -158,19 +177,25 @@ export function createAndroidFoldScene( ); body.position.z = -DEPTH / 2 + BEVEL; group.add(body); - const frame = new Mesh(new ShapeGeometry(panelPath(side, 0.01, 0.095, 0.002), 12), bezel); + const frame = new Mesh( + new ShapeGeometry(panelPath(halfWidth, side, 0.01, 0.095, 0.002), 12), + bezel, + ); frame.position.z = DEPTH / 2 + 0.001; group.add(frame); // A back-facing shape mirrors X, so it is drawn from the opposite side's outline. const rear = new Mesh( - new ShapeGeometry(panelPath(side === "left" ? "right" : "left", 0.01, 0.095, 0.002), 12), + new ShapeGeometry( + panelPath(halfWidth, side === "left" ? "right" : "left", 0.01, 0.095, 0.002), + 12, + ), back, ); rear.name = `${side}-back`; rear.rotation.y = Math.PI; rear.position.set(0, 0, -DEPTH / 2 - 0.001); group.add(rear); - const geometry = new ShapeGeometry(panelPath(side, INSET, 0.076)); + const geometry = new ShapeGeometry(panelPath(halfWidth, side, INSET, 0.076)); geometry.computeBoundingBox(); const display = new Mesh(geometry, hitMaterial); display.name = `${side}-inner-screen`; @@ -183,8 +208,7 @@ export function createAndroidFoldScene( const innerRight = half(right, "right", backGlass); // One indexed surface keeps adjacent pixels joined at the crease. The // physical halves move separately underneath it. - const screenWidth = 2 * (HALF_WIDTH - INSET); - const screenHeight = HEIGHT - 2 * INSET; + const screenWidth = 2 * (halfWidth - INSET); const screenGeometry = new PlaneGeometry(screenWidth, screenHeight, 40, 48); const screenPositions = screenGeometry.getAttribute("position"); const screenUvs = screenGeometry.getAttribute("uv"); @@ -224,9 +248,9 @@ export function createAndroidFoldScene( spine.position.z = PIVOT_Z; orientation.add(spine); - const cover = new Mesh(new ShapeGeometry(coverPath()), coverMaterial); + const cover = new Mesh(new ShapeGeometry(coverPath(halfWidth)), coverMaterial); cover.name = "cover-screen"; - cover.position.set(-HALF_WIDTH / 2, 0, -DEPTH / 2 - 0.003); + cover.position.set(-halfWidth / 2, 0, -DEPTH / 2 - 0.003); cover.rotation.y = Math.PI; leftBody.add(cover); @@ -236,7 +260,7 @@ export function createAndroidFoldScene( const islandWidth = 0.46; const islandHeight = 0.2; rearCamera.position.set( - HALF_WIDTH - 0.07 - islandWidth / 2, + halfWidth - 0.07 - islandWidth / 2, HEIGHT / 2 - 0.08 - islandHeight / 2, -DEPTH / 2 - 0.002, ); @@ -284,7 +308,7 @@ export function createAndroidFoldScene( [0.2, 0.3], ] as const) { const key = new Mesh(new BoxGeometry(0.02, length, DEPTH * 0.45), frameMetal); - key.position.set(HALF_WIDTH + 0.008, y, 0); + key.position.set(halfWidth + 0.008, y, 0); right.add(key); } @@ -349,8 +373,9 @@ export function createAndroidFoldScene( return { root, orientation, - width: HALF_WIDTH * 2, + width: halfWidth * 2, height: HEIGHT, + innerAspect, setAngle, setDisplay, screenPoint(x: number, y: number, camera: Camera, captured = false) { diff --git a/packages/client-runtime/src/device/phoneViewer.test.ts b/packages/client-runtime/src/device/phoneViewer.test.ts index 61baa8293f1a..d40ddc72b39d 100644 --- a/packages/client-runtime/src/device/phoneViewer.test.ts +++ b/packages/client-runtime/src/device/phoneViewer.test.ts @@ -80,7 +80,16 @@ vi.mock("./modelScene.ts", async () => { }; }); -import { BoxGeometry, Group, Mesh, MeshBasicMaterial, PlaneGeometry, Quaternion } from "three"; +import { + Box3, + BoxGeometry, + Group, + Mesh, + MeshBasicMaterial, + PlaneGeometry, + Quaternion, + Vector3, +} from "three"; import { disposeDeviceModel } from "./modelScene.ts"; import { createPhoneViewer } from "./phoneViewer.ts"; import { @@ -259,6 +268,53 @@ it("animates the Android hinge on the same scene through an encoder resize", () viewer.dispose(); }); +it("resizes the fold body for a landscape inner display and keeps it through the cover frame", () => { + const openProfile = resolveDeviceShape({ platform: "android", portraitAspect: 0.83 }); + const { viewer, draw, source, state } = fixture(openProfile); + viewer.setFoldAngle(180); + draw(0); + const portraitWidth = new Box3() + .setFromObject(state.frames.at(-1)!.phone!) + .getSize(new Vector3()).x; + source.width = 2208; + source.height = 1840; + viewer.setScreen({ width: 2208, height: 1840, orientation: "portrait" }); + viewer.frameUpdated(); + draw(10); + const landscape = state.frames.at(-1)!.phone!; + const landscapeWidth = new Box3().setFromObject(landscape).getSize(new Vector3()).x; + expect(landscapeWidth / portraitWidth).toBeGreaterThan(1.15); + source.width = 1080; + source.height = 2092; + viewer.setScreen({ width: 1080, height: 2092, orientation: "portrait" }, ANDROID_PHONE_SHAPE); + viewer.frameUpdated(); + draw(20); + expect(state.frames.at(-1)!.phone).toBe(landscape); + expect(gpu.instances).toHaveLength(1); + viewer.dispose(); +}); + +it("keeps the fold body through a rotated cover frame and learns the inner shape before fold mode", () => { + const { viewer, draw, source, state } = fixture(ANDROID_PHONE_SHAPE); + source.width = 2208; + source.height = 1840; + viewer.setScreen({ width: 2208, height: 1840, orientation: "portrait" }); + viewer.frameUpdated(); + draw(0); + viewer.setFoldAngle(180); + draw(10); + const landscape = state.frames.at(-1)!.phone!; + const width = new Box3().setFromObject(landscape).getSize(new Vector3()).x; + expect(width / new Box3().setFromObject(landscape).getSize(new Vector3()).y).toBeGreaterThan(1.1); + source.width = 2092; + source.height = 1080; + viewer.setScreen({ width: 2092, height: 1080, orientation: "landscape_left" }); + viewer.frameUpdated(); + draw(20); + expect(state.frames.at(-1)!.phone).toBe(landscape); + viewer.dispose(); +}); + it("retargets an unfinished hinge turn from its visible angle", () => { const { viewer, draw, state } = fixture(ANDROID_PHONE_SHAPE); viewer.setFoldAngle(180); diff --git a/packages/client-runtime/src/device/phoneViewer.ts b/packages/client-runtime/src/device/phoneViewer.ts index 009907442433..3dfc25048e02 100644 --- a/packages/client-runtime/src/device/phoneViewer.ts +++ b/packages/client-runtime/src/device/phoneViewer.ts @@ -19,7 +19,11 @@ import { } from "./model.ts"; import { createImportedPhoneScene, loadDeviceModel } from "./modelScene.ts"; import { createPhoneScene, phoneDisplayLayout } from "./phoneScene.ts"; -import { createAndroidFoldScene } from "./androidFoldScene.ts"; +import { + createAndroidFoldScene, + DEFAULT_FOLD_INNER_ASPECT, + isFoldInnerAspect, +} from "./androidFoldScene.ts"; import { createRenderScheduler } from "./renderScheduler.ts"; import { createDeviceMotion } from "./deviceMotion.ts"; import { createDeviceFraming } from "./deviceFraming.ts"; @@ -102,9 +106,21 @@ export function createPhoneViewer(options: { let accessory: Awaited> | null = null; let accessoryBounds: Box3 | null = null; let foldTurn: { from: number; to: number; startedAt: number } | null = null; + // The inner display's raw width over height. Cover frames leave the last unfolded shape. + const rawAspect = () => options.source.width / options.source.height; + let foldAspect = isFoldInnerAspect(rawAspect()) ? rawAspect() : DEFAULT_FOLD_INNER_ASPECT; + const createFoldScene = (angle: number, displayLayout = layout) => + createAndroidFoldScene(texture, displayLayout, angle, foldAspect); + /** The hinge angle currently on screen, including an unfinished turn. */ + const visibleFoldAngle = (fallback: number) => { + if (!foldTurn) return fallback; + const progress = Math.min(1, (performance.now() - foldTurn.startedAt) / ANDROID_FOLD_TURN_MS); + const eased = progress * progress * (3 - 2 * progress); + return foldTurn.from + (foldTurn.to - foldTurn.from) * eased; + }; let phone: ReturnType | ReturnType = foldAngle !== null && profile.id.startsWith("android") - ? createAndroidFoldScene(texture, layout, foldAngle) + ? createFoldScene(foldAngle) : createPhoneScene(texture, layout, profile); scene.add(phone.root); let disposed = false; @@ -222,7 +238,18 @@ export function createPhoneViewer(options: { phone.setDisplay(texture, next); previous.dispose(); } - if ( + // Learn the inner display shape from any unfolded frame, including before fold mode. + const frameAspect = rawAspect(); + const innerChanged = isFoldInnerAspect(frameAspect) && frameAspect !== foldAspect; + if (innerChanged) foldAspect = frameAspect; + if (!imported && "setAngle" in phone && innerChanged) { + // A new inner display shape resizes the body; the hinge keeps its visible angle. + const angle = visibleFoldAngle(foldAngle ?? 180); + scene.remove(phone.root); + phone.dispose(); + phone = createFoldScene(angle, next); + scene.add(phone.root); + } else if ( !imported && !("setAngle" in phone) && (nextProfile !== profile || next.aspect !== layout.aspect) @@ -267,7 +294,7 @@ export function createPhoneViewer(options: { : model ? createImportedPhoneScene(model.asset, texture, layout) : foldAngle !== null && profile.id.startsWith("android") - ? createAndroidFoldScene(texture, layout, foldAngle) + ? createFoldScene(foldAngle) : createPhoneScene(texture, layout, profile); foldTurn = null; scene.remove(phone.root); @@ -333,10 +360,7 @@ export function createPhoneViewer(options: { if (next === null || !("setAngle" in phone)) { scene.remove(phone.root); phone.dispose(); - phone = - next === null - ? createPhoneScene(texture, layout, profile) - : createAndroidFoldScene(texture, layout, next); + phone = next === null ? createPhoneScene(texture, layout, profile) : createFoldScene(next); scene.add(phone.root); orientationTurn = null; orientationAngle = next === null ? layout.rotation : 0; @@ -344,13 +368,7 @@ export function createPhoneViewer(options: { applyPose(); fit(true); } else { - const progress = foldTurn - ? Math.min(1, (performance.now() - foldTurn.startedAt) / ANDROID_FOLD_TURN_MS) - : 1; - const eased = progress * progress * (3 - 2 * progress); - const from = foldTurn - ? foldTurn.from + (foldTurn.to - foldTurn.from) * eased - : (previous ?? next); + const from = visibleFoldAngle(previous ?? next); if (reducedMotion()) { foldTurn = null; phone.setAngle(next); From a107f8a0792c3add90d398602998c55c3ebaef27 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 22:36:51 -0700 Subject: [PATCH 35/58] fix(clients): a preview app no longer knocks the desktop's own server offline (#13577) Co-authored-by: Claude Opus 5.5 (1M context) --- .../client-runtime/src/connection/layer.ts | 7 ++ .../src/connection/registry.test.ts | 96 ++++++++++++++++++- 2 files changed, 98 insertions(+), 5 deletions(-) diff --git a/packages/client-runtime/src/connection/layer.ts b/packages/client-runtime/src/connection/layer.ts index 46dcdcf569b9..b64e58c4fef1 100644 --- a/packages/client-runtime/src/connection/layer.ts +++ b/packages/client-runtime/src/connection/layer.ts @@ -32,11 +32,18 @@ export const watchDiscoveredCompatibility = Effect.fn("connection.watchDiscovere if (!current.environments.has(environmentId)) seenChecks.delete(environmentId); } } + const registered = yield* SubscriptionRef.get(registry.entries); for (const entry of current.environments.values()) { const status = Option.getOrNull(entry.status); const descriptor = status?.descriptor; if (status === null || descriptor === undefined) continue; const environmentId = entry.environment.environmentId; + // Discovery describes the server behind the relay route. A direct + // connection (the desktop's own server, a saved URL, SSH) can reach + // a different server with the same environment id, such as a + // preview app that shares the home directory. Its socket handshake + // already checks the protocol. + if (registered.get(environmentId)?.target._tag !== "RelayConnectionTarget") continue; const previous = seenChecks.get(environmentId); const fresh = previous?.checkedAt !== status.checkedAt || diff --git a/packages/client-runtime/src/connection/registry.test.ts b/packages/client-runtime/src/connection/registry.test.ts index c07a15101f60..8a71344ad173 100644 --- a/packages/client-runtime/src/connection/registry.test.ts +++ b/packages/client-runtime/src/connection/registry.test.ts @@ -683,7 +683,7 @@ describe("EnvironmentRegistry", () => { it.effect("only a fresh health check for the rejected environment unlocks it", () => Effect.gen(function* () { - const harness = yield* makeHarness([RELAY_TARGET], [], [], { + const harness = yield* makeHarness([RELAY_TARGET, SECOND_RELAY_TARGET], [], [], { initialDisabled: [RELAY_TARGET.environmentId], }); const descriptor = (environmentId: EnvironmentId): ExecutionEnvironmentDescriptor => ({ @@ -778,8 +778,8 @@ describe("EnvironmentRegistry", () => { yield* SubscriptionRef.update(discoveryState, (state) => ({ ...state, environments: new Map(state.environments).set( - SECOND_TARGET.environmentId, - discovered(descriptor(SECOND_TARGET.environmentId)), + SECOND_RELAY_TARGET.environmentId, + discovered(descriptor(SECOND_RELAY_TARGET.environmentId)), ), })); yield* Deferred.await(unrelated); @@ -798,8 +798,8 @@ describe("EnvironmentRegistry", () => { environments: new Map([ [RELAY_TARGET.environmentId, discovered(descriptor(RELAY_TARGET.environmentId))], [ - SECOND_TARGET.environmentId, - discovered(descriptor(SECOND_TARGET.environmentId), "2026-09-15T00:01:00Z"), + SECOND_RELAY_TARGET.environmentId, + discovered(descriptor(SECOND_RELAY_TARGET.environmentId), "2026-09-15T00:01:00Z"), ], ]), })); @@ -827,6 +827,92 @@ describe("EnvironmentRegistry", () => { }), ); + it.effect("discovery leaves direct connections that share an environment id alone", () => + Effect.gen(function* () { + const harness = yield* makeHarness([TARGET, RELAY_TARGET]); + const discovered = (environmentId: EnvironmentId) => { + const endpoint = { + httpBaseUrl: "https://relay.example.test", + wsBaseUrl: "wss://relay.example.test", + providerKind: "manual" as const, + }; + return { + environment: { + environmentId, + label: "Preview server", + endpoint, + linkedAt: "2026-09-25T00:00:00Z", + }, + availability: "online" as const, + status: Option.some({ + environmentId, + endpoint, + status: "online", + checkedAt: "2026-09-25T00:00:00Z", + descriptor: { + environmentId, + label: "Preview server", + platform: { os: "darwin", arch: "arm64" }, + serverVersion: "2.0.0", + orchestrationProtocolVersion: ORCHESTRATION_PROTOCOL_VERSION + 1, + capabilities: { repositoryIdentity: true }, + }, + }), + error: Option.none(), + }; + }; + yield* Effect.gen(function* () { + const registry = yield* EnvironmentRegistry.EnvironmentRegistry; + yield* registry.start; + yield* awaitConnectionState( + registry, + TARGET.environmentId, + (state) => state.phase === "connected", + ); + const relayChecked = yield* Deferred.make(); + yield* watchDiscoveredCompatibility().pipe( + Effect.provideService(EnvironmentRegistry.EnvironmentRegistry, { + ...registry, + setCompatibility: (environmentId, error) => + registry + .setCompatibility(environmentId, error) + .pipe( + Effect.andThen( + environmentId === RELAY_TARGET.environmentId + ? Deferred.succeed(relayChecked, undefined) + : Effect.void, + ), + ), + }), + Effect.provideService( + RelayEnvironmentDiscovery.RelayEnvironmentDiscovery, + RelayEnvironmentDiscovery.RelayEnvironmentDiscovery.of({ + state: + yield* SubscriptionRef.make( + { + ...RelayEnvironmentDiscovery.EMPTY_RELAY_ENVIRONMENT_DISCOVERY_STATE, + environments: new Map([ + [TARGET.environmentId, discovered(TARGET.environmentId)], + [RELAY_TARGET.environmentId, discovered(RELAY_TARGET.environmentId)], + ]), + }, + ), + refresh: Effect.void, + }), + ), + Effect.forkScoped, + ); + yield* Deferred.await(relayChecked); + + const entries = yield* SubscriptionRef.get(registry.entries); + expect(entries.get(RELAY_TARGET.environmentId)).toMatchObject({ enabled: false }); + expect(entries.get(TARGET.environmentId)).toMatchObject({ enabled: true }); + expect(entries.get(TARGET.environmentId)?.unsupportedReason).toBeUndefined(); + expect((yield* registry.state(TARGET.environmentId)).phase).toBe("connected"); + }).pipe(Effect.provide(harness.layer), Effect.scoped); + }), + ); + it.effect("discovery keeps unsupported environments off until compatibility changes", () => Effect.gen(function* () { const harness = yield* makeHarness([RELAY_TARGET], [], [], { From 20f0ff1781fb02898a6fa5f97f76f36079cff0b8 Mon Sep 17 00:00:00 2001 From: Dominic Roy Date: Fri, 25 Sep 2026 01:54:08 -0400 Subject: [PATCH 36/58] fix(web): keep nested task states out of parent bullets (#11477) Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com> --- apps/web/src/markdown-clipboard.test.ts | 71 +++++++++++++++++++++++-- apps/web/src/markdown-clipboard.ts | 4 +- 2 files changed, 71 insertions(+), 4 deletions(-) diff --git a/apps/web/src/markdown-clipboard.test.ts b/apps/web/src/markdown-clipboard.test.ts index 9296967e4b82..a08dc299161b 100644 --- a/apps/web/src/markdown-clipboard.test.ts +++ b/apps/web/src/markdown-clipboard.test.ts @@ -19,6 +19,7 @@ class FakeText { class FakeElement { readonly nodeType = ELEMENT_NODE; + checked = false; readonly childNodes: Array = []; readonly classList = { contains: (name: string) => this.classNames.includes(name), @@ -61,18 +62,31 @@ class FakeElement { /** Supports only the selectors markdown-clipboard actually asks for. */ querySelector(selector: string): FakeElement | null { + if (selector.includes(", ")) { + for (const part of selector.split(", ")) { + const match = this.querySelector(part); + if (match) return match; + } + return null; + } const childOnly = selector.startsWith(":scope > "); - const target = childOnly ? selector.slice(":scope > ".length) : selector; + const [target, ...rest] = (childOnly ? selector.slice(":scope > ".length) : selector).split( + " > ", + ); const matches = (element: FakeElement): boolean => { if (target === 'input[type="checkbox"]') { return element.tagName === "INPUT" && element.getAttribute("type") === "checkbox"; } - return element.tagName === target.toUpperCase(); + return element.tagName === target?.toUpperCase(); }; const search = (parent: FakeElement): FakeElement | null => { for (const child of parent.childNodes) { if (!(child instanceof FakeElement)) continue; - if (matches(child)) return child; + if (matches(child)) { + if (rest.length === 0) return child; + const nested = child.querySelector(`:scope > ${rest.join(" > ")}`); + if (nested) return nested; + } if (!childOnly) { const nested = search(child); if (nested) return nested; @@ -143,6 +157,57 @@ describe("serializeRenderedMarkdownFragment", () => { expect(serializeRenderedMarkdownFragment(asNode(container))).toBe("run `git status` first"); }); + describe.each([ + { parentLayout: "tight", childLayout: "tight" }, + { parentLayout: "tight", childLayout: "loose" }, + { parentLayout: "loose", childLayout: "tight" }, + { parentLayout: "loose", childLayout: "loose" }, + ])("$parentLayout parent with $childLayout child", ({ parentLayout, childLayout }) => { + it.each([ + { parentChecked: null, childChecked: true, parent: "- Parent", child: " - [x] Child" }, + { + parentChecked: false, + childChecked: true, + parent: "- [ ] Parent", + child: " - [x] Child", + }, + { + parentChecked: true, + childChecked: false, + parent: "- [x] Parent", + child: " - [ ] Child", + }, + ])("copies $parent with $child", ({ parentChecked, childChecked, parent, child }) => { + const parentContent = parentLayout === "loose" ? new FakeElement("P") : new FakeElement("LI"); + if (parentChecked !== null) { + const checkbox = new FakeElement("INPUT", [], { type: "checkbox" }); + checkbox.checked = parentChecked; + parentContent.append(checkbox, new FakeText(" ")); + } + parentContent.append(new FakeText("Parent")); + const parentItem = + parentLayout === "loose" ? new FakeElement("LI").append(parentContent) : parentContent; + const checkbox = new FakeElement("INPUT", [], { type: "checkbox" }); + checkbox.checked = childChecked; + const childContent = new FakeElement(childLayout === "loose" ? "P" : "LI").append( + checkbox, + new FakeText(" Child"), + ); + const childItem = + childLayout === "loose" ? new FakeElement("LI").append(childContent) : childContent; + parentItem.append(new FakeText("\n"), new FakeElement("UL").append(childItem)); + const container = new FakeElement("DIV").append( + new FakeElement("P").append(new FakeText("Before")), + new FakeElement("UL").append(parentItem), + new FakeElement("P").append(new FakeText("After")), + ); + + expect(serializeRenderedMarkdownFragment(asNode(container))).toBe( + `Before\n\n${parent}${parentLayout === "loose" ? "\n\n" : "\n"}${child}\n\nAfter`, + ); + }); + }); + it("copies the complete quote, source, and comment instead of the comment-only chip label", () => { const citation = { version: 1 as const, diff --git a/apps/web/src/markdown-clipboard.ts b/apps/web/src/markdown-clipboard.ts index 4a96c8b31d13..39b941801638 100644 --- a/apps/web/src/markdown-clipboard.ts +++ b/apps/web/src/markdown-clipboard.ts @@ -119,7 +119,9 @@ function serializeTable(table: Element): string { } function serializeListItem(item: Element, ordered: boolean, index: number): string { - const checkbox = item.querySelector('input[type="checkbox"]'); + const checkbox = item.querySelector( + ':scope > input[type="checkbox"], :scope > p > input[type="checkbox"]', + ); const task = checkbox ? `[${(checkbox as HTMLInputElement).checked ? "x" : " "}] ` : ""; const marker = ordered ? `${index}. ${task}` : `- ${task}`; let content = serializeChildren(item) From c13f7d93fff0f578886985a3f673b4b21b7f6ac8 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 23:08:35 -0700 Subject: [PATCH 37/58] feat(release): ship a Linux .deb that updates itself (#13575) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Linux release build now also makes a .deb in the same electron-builder run as the AppImage, and the release publishes it. electron-builder lists it in latest-linux.yml and writes resources/package-type into it, so the app updates a .deb install through electron-updater, which installs the new .deb with dpkg. The desktop updater now allows that path. The .deb uses xz in threaded mode (XZ_DEFAULTS=-T0): 113 MB in place of 141 MB with gzip. The Linux arm64 release job moves to a 16-vCPU Blacksmith arm64 runner. The download page, README, install guide, and release docs list the .deb. Based on community work in #4071, #5139, #4900, and #4887. Co-authored-by: chukfinley Co-authored-by: Primož Ajdišek Co-authored-by: benthecarman Co-authored-by: NaveDanan Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/release-desktop.yml | 1 + .github/workflows/release.yml | 3 +- README.md | 8 +++++ .../src/updates/DesktopUpdates.test.ts | 19 +++++++++++ apps/desktop/src/updates/DesktopUpdates.ts | 18 ++++++++-- .../desktop/src/updates/updatesTestHarness.ts | 17 +++++++++- apps/marketing/src/pages/download.astro | 14 ++++++++ docs/operations/release.md | 4 +-- docs/user/install.md | 17 ++++++---- scripts/build-desktop-artifact.test.ts | 2 ++ scripts/build-desktop-artifact.ts | 34 ++++++++++++++++++- 11 files changed, 124 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index c374a8692db6..c743b961560b 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -510,6 +510,7 @@ jobs: "release/*.dmg" "release/*.zip" "release/*.AppImage" + "release/*.deb" "release/*.exe" ) # Preview builds have no publish config, so electron-builder writes diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 387330713d05..014176b87613 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -625,7 +625,7 @@ jobs: clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }} relay_url: ${{ needs.relay_public_config.outputs.relay_url }} label: Linux arm64 - runner: ubuntu-24.04-arm + runner: blacksmith-16vcpu-ubuntu-2404-arm platform: linux target: AppImage arch: arm64 @@ -875,6 +875,7 @@ jobs: echo 'release-assets/*.dmg' echo 'release-assets/*.zip' echo 'release-assets/*.AppImage' + echo 'release-assets/*.deb' echo 'release-assets/*.exe' if [[ "${{ needs.preflight.outputs.release_channel }}" != "preview" ]]; then echo 'release-assets/*.blockmap' diff --git a/README.md b/README.md index 28cc78162085..175e52d9de46 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,14 @@ winget install T3Tools.T3Code brew install --cask t3-code ``` +#### Debian, Ubuntu (`.deb`) + +Download the `.deb` from [GitHub Releases](https://github.com/pingdotgg/t3code/releases), then: + +```bash +sudo apt install ./T3-Code-*.deb +``` + #### Arch Linux (AUR) Stable: diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts index c9ed4c66bce9..9745662c1209 100644 --- a/apps/desktop/src/updates/DesktopUpdates.test.ts +++ b/apps/desktop/src/updates/DesktopUpdates.test.ts @@ -87,6 +87,25 @@ describe("DesktopUpdates", () => { }).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); }); + it.effect("updates Linux .deb installs and leaves other non-AppImage installs off", () => + Effect.gen(function* () { + const linuxState = (packageType: string | undefined) => + Effect.scoped( + Effect.gen(function* () { + const updates = yield* DesktopUpdates.DesktopUpdates; + yield* updates.configure; + return yield* updates.getState; + }), + ).pipe(Effect.provide(makeHarness({ platform: "linux", packageType }).layer)); + + const deb = yield* linuxState("deb\n"); + assert.equal(deb.status, "idle"); + + const unmarked = yield* linuxState(undefined); + assert.equal(unmarked.status, "disabled"); + }), + ); + it.effect("subscribe delivers the latest state plus subsequent changes", () => { const harness = makeHarness(); diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts index c42ef564918f..245925a6e731 100644 --- a/apps/desktop/src/updates/DesktopUpdates.ts +++ b/apps/desktop/src/updates/DesktopUpdates.ts @@ -250,6 +250,7 @@ function getAutoUpdateDisabledReason(args: { isPackaged: boolean; platform: NodeJS.Platform; appImage?: string | undefined; + isDebPackage: boolean; disabledByEnv: boolean; hasUpdateFeedConfig: boolean; }): string | null { @@ -262,8 +263,8 @@ function getAutoUpdateDisabledReason(args: { if (args.disabledByEnv) { return "Automatic updates are disabled by the T3CODE_DISABLE_AUTO_UPDATE setting."; } - if (args.platform === "linux" && !args.appImage) { - return "Automatic updates on Linux require running the AppImage build."; + if (args.platform === "linux" && !args.appImage && !args.isDebPackage) { + return "Automatic updates on Linux require the AppImage or the .deb package."; } return null; } @@ -332,6 +333,18 @@ export const make = Effect.gen(function* () { ), ); + // The .deb carries electron-builder's resources/package-type marker. + // electron-updater reads the same file and installs updates with dpkg. + const isDebPackage = + environment.platform === "linux" && environment.isPackaged + ? yield* fileSystem + .readFileString(environment.path.join(environment.resourcesPath, "package-type")) + .pipe( + Effect.map((packageType) => packageType.trim() === "deb"), + Effect.orElseSucceed(() => false), + ) + : false; + const hasUpdateFeedConfig = Ref.get(appUpdateYmlConfigRef).pipe( Effect.map((appUpdateYmlConfig) => Option.isSome(appUpdateYmlConfig) || config.mockUpdates), ); @@ -344,6 +357,7 @@ export const make = Effect.gen(function* () { isPackaged: environment.isPackaged, platform: environment.platform, appImage: Option.getOrUndefined(config.appImagePath), + isDebPackage, disabledByEnv: config.disableAutoUpdate, hasUpdateFeedConfig: hasFeedConfig, }), diff --git a/apps/desktop/src/updates/updatesTestHarness.ts b/apps/desktop/src/updates/updatesTestHarness.ts index a0b9a36399d2..5455f1602855 100644 --- a/apps/desktop/src/updates/updatesTestHarness.ts +++ b/apps/desktop/src/updates/updatesTestHarness.ts @@ -2,6 +2,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices"; import type { DesktopUpdateState } from "@t3tools/contracts"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; +import * as PlatformError from "effect/PlatformError"; import * as Layer from "effect/Layer"; import * as Option from "effect/Option"; @@ -33,6 +34,9 @@ export interface UpdatesHarnessOptions { readonly stopBackend?: Effect.Effect; readonly startBackend?: Effect.Effect; readonly env?: Record; + readonly platform?: NodeJS.Platform; + /** Contents of the resources/package-type marker a Linux package ships. */ + readonly packageType?: string | undefined; } export function makeHarness(options: UpdatesHarnessOptions = {}) { @@ -146,7 +150,7 @@ export function makeHarness(options: UpdatesHarnessOptions = {}) { const environmentLayer = DesktopEnvironment.layer({ dirname: "/repo/apps/desktop/src", homeDirectory: `/tmp/t3-desktop-updates-home-${process.pid}`, - platform: "darwin", + platform: options.platform ?? "darwin", processArch: "x64", appVersion: "1.2.3", appPath: "/repo", @@ -208,6 +212,17 @@ export function makeHarness(options: UpdatesHarnessOptions = {}) { // disk I/O that would outrun the tests' settle loops. const updateRestartMarkers = new Set(); const fileSystemLayer = FileSystem.layerNoop({ + readFileString: (path) => + path === "/missing/resources/package-type" && options.packageType !== undefined + ? Effect.succeed(options.packageType) + : Effect.fail( + PlatformError.systemError({ + module: "FileSystem", + method: "readFileString", + _tag: "NotFound", + pathOrDescriptor: path, + }), + ), makeDirectory: () => Effect.void, writeFileString: (path) => Effect.sync(() => { diff --git a/apps/marketing/src/pages/download.astro b/apps/marketing/src/pages/download.astro index f3212d1e38ae..7fb22e52f481 100644 --- a/apps/marketing/src/pages/download.astro +++ b/apps/marketing/src/pages/download.astro @@ -91,6 +91,16 @@ const imageProps = {

Linux

+

+ On ARM? Download the arm64 .deb or + AppImage. +

diff --git a/docs/operations/release.md b/docs/operations/release.md index a86a36432d34..4116ceeb388f 100644 --- a/docs/operations/release.md +++ b/docs/operations/release.md @@ -29,7 +29,7 @@ This document covers the unified release workflow for stable and nightly desktop - Builds six desktop artifacts in parallel for both channels, each as its own job (`desktop__`, one call of `release-desktop.yml`) on hardware of its own architecture, gated only on the bundle (the Windows jobs also wait for the same-arch Linux job, whose CLI archive they embed as the WSL runtime): - macOS `arm64` DMG - macOS `x64` DMG - - Linux `x64` and `arm64` AppImage + - Linux `x64` and `arm64` AppImage and `.deb`, from one electron-builder run. The `.deb` updates in the app through electron-updater, which installs it with `dpkg`. - Windows `x64` and `arm64` NSIS installer - Publishes one GitHub Release with all produced files. - Stable tags with a suffix after `X.Y.Z` (for example `1.2.3-alpha.1`) are published as GitHub prereleases. @@ -329,7 +329,7 @@ available. - `T3CODE_DESKTOP_UPDATE_REPOSITORY` (format `owner/repo`), if set. - otherwise `GITHUB_REPOSITORY` from GitHub Actions. - Required release assets for updater: - - platform installers (`.exe`, `.dmg`, `.AppImage`, plus macOS `.zip` for Squirrel.Mac update payloads) + - platform installers (`.exe`, `.dmg`, `.AppImage`, `.deb`, plus macOS `.zip` for Squirrel.Mac update payloads) - channel metadata: `latest*.yml` for stable releases, `nightly*.yml` for nightly releases - `*.blockmap` files (used for differential downloads) - macOS metadata note: diff --git a/docs/user/install.md b/docs/user/install.md index 773979e77302..53ad5fbbed8d 100644 --- a/docs/user/install.md +++ b/docs/user/install.md @@ -58,12 +58,17 @@ update it with `git pull` and a rebuild. Download a release from [GitHub Releases](https://github.com/pingdotgg/t3code/releases), or use a package manager: -| Platform | Install | -| ------------------ | ------------------------------- | -| Windows | `winget install T3Tools.T3Code` | -| macOS | `brew install --cask t3-code` | -| Arch Linux | `yay -S t3code-bin` | -| Arch Linux nightly | `yay -S t3code-nightly-bin` | +| Platform | Install | +| ------------------ | ---------------------------------- | +| Windows | `winget install T3Tools.T3Code` | +| macOS | `brew install --cask t3-code` | +| Debian, Ubuntu | `sudo apt install ./T3-Code-*.deb` | +| Arch Linux | `yay -S t3code-bin` | +| Arch Linux nightly | `yay -S t3code-nightly-bin` | + +The `.deb` updates itself like the other desktop builds. It asks for your +password to install each update. If your desktop has no password prompt, the +update fails. Download the new `.deb` and install it the same way. ### Windows Subsystem for Linux diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts index 05fc0baa45a0..4e97301ddba8 100644 --- a/scripts/build-desktop-artifact.test.ts +++ b/scripts/build-desktop-artifact.test.ts @@ -668,6 +668,8 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { iconSize: 120, iconTextSize: 12, }); + // A Linux AppImage build also emits the .deb from the same run. + assert.deepStrictEqual((linux.linux as Record).target, ["AppImage", "deb"]); // Linux must register the renderer schemes so the generated .desktop // entry advertises MimeType=x-scheme-handler/t3code; for OAuth deep links. assert.deepStrictEqual((linux.linux as Record).protocols, [ diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index 02e514d83fbd..c05716ced8f3 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -929,6 +929,7 @@ interface StagePackageJson { readonly private: true; readonly packageManager: string; readonly description: string; + readonly homepage: string; readonly author: string; readonly main: string; readonly build: Record; @@ -2733,10 +2734,17 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* ( if (platform === "linux") { buildConfig.linux = { - target: [target], + // The .deb is built from the same unpacked app after the AppImage. + // electron-builder lists both in latest-linux.yml and writes + // resources/package-type into the .deb only, so electron-updater updates + // each install in its own format. + target: target === "AppImage" ? [target, "deb"] : [target], executableName: "t3code", icon: "icons", category: "Development", + synopsis: "Desktop GUI for coding agents", + // Required by the .deb control file. + maintainer: "T3 Tools ", // electron-builder turns these into MimeType=x-scheme-handler/; // in the .desktop entry (Exec already gets %U), so browsers can hand // t3code:// OAuth callbacks to the app. @@ -2752,6 +2760,23 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* ( }, }, }; + buildConfig.deb = { + // Electron's runtime libraries. Debian 13 and Ubuntu 24.04 renamed some + // for 64-bit time; the old name is the fallback for older releases. + depends: [ + "libasound2t64 | libasound2", + "libatspi2.0-0t64 | libatspi2.0-0", + "libgbm1", + "libgtk-3-0t64 | libgtk-3-0", + "libnotify4", + "libnss3", + "libsecret-1-0", + "libuuid1", + "libxss1", + "libxtst6", + "xdg-utils", + ], + }; } if (platform === "win") { @@ -3642,6 +3667,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( private: true, packageManager: rootPackageJson.packageManager, description: "T3 Code desktop build", + // Required by the .deb control file. + homepage: "https://t3.codes", author: "T3 Tools", main: "apps/desktop/dist-electron/main.cjs", build: yield* createBuildConfig( @@ -3738,6 +3765,11 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( delete buildEnv[key]; } } + if (options.platform === "linux") { + // fpm compresses the .deb with the system xz through tar. Threaded mode + // takes seconds on a many-core runner instead of about two minutes. + buildEnv.XZ_DEFAULTS = "-T0"; + } if (!options.signed) { buildEnv.CSC_IDENTITY_AUTO_DISCOVERY = "false"; delete buildEnv.CSC_LINK; From d10bd1360ace3ab1dbccc1ee706c9169982d98ae Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 23:43:48 -0700 Subject: [PATCH 38/58] perf(desktop): cache compiled JavaScript between launches (#13501) Co-authored-by: Claude Opus 5.5 (1M context) --- apps/desktop/package.json | 2 +- .../scripts/main-process-bundle.test.mjs | 63 +++++++++++++++++++ apps/desktop/scripts/smoke-test.mjs | 2 +- apps/desktop/src/app/DesktopEnvironment.ts | 3 + .../DesktopBackendConfiguration.test.ts | 7 +++ .../backend/DesktopBackendConfiguration.ts | 11 +++- apps/desktop/src/boot.ts | 4 ++ apps/desktop/src/compileCache.ts | 28 +++++++++ apps/desktop/src/electron/ElectronProtocol.ts | 3 + apps/desktop/vite.config.ts | 13 ++++ apps/server/src/compileCache.test.ts | 53 ++++++++++++++++ apps/server/src/compileCache.ts | 9 +++ apps/server/src/serverRuntimeStartup.ts | 2 + knip.jsonc | 2 + scripts/build-desktop-artifact.ts | 2 +- 15 files changed, 200 insertions(+), 4 deletions(-) create mode 100644 apps/desktop/src/boot.ts create mode 100644 apps/desktop/src/compileCache.ts create mode 100644 apps/server/src/compileCache.test.ts create mode 100644 apps/server/src/compileCache.ts diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 2e48f321dd47..daedb89a1283 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -3,7 +3,7 @@ "version": "0.0.42", "private": true, "type": "module", - "main": "dist-electron/main.cjs", + "main": "dist-electron/boot.cjs", "scripts": { "ensure:electron": "node scripts/ensure-electron-runtime.mjs", "start": "node scripts/start-electron.mjs", diff --git a/apps/desktop/scripts/main-process-bundle.test.mjs b/apps/desktop/scripts/main-process-bundle.test.mjs index 28d8e37d7a9e..678b62f58aac 100644 --- a/apps/desktop/scripts/main-process-bundle.test.mjs +++ b/apps/desktop/scripts/main-process-bundle.test.mjs @@ -1,3 +1,4 @@ +import * as NodeChildProcess from "node:child_process"; import * as NodeFSP from "node:fs/promises"; import * as NodeOS from "node:os"; import * as NodePath from "node:path"; @@ -108,3 +109,65 @@ void import("./linux.ts").then(({ result }) => process.emit("ready", result));`, await NodeFSP.rm(directory, { recursive: true, force: true }); } }); + +it("loads the emitted packaged boot entry and backend cache preload", async () => { + const directory = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-desktop-boot-")); + try { + const entries = ["src/boot.ts", "src/compileCache.ts"]; + await NodeFSP.mkdir(NodePath.join(directory, "src")); + await Promise.all( + entries.map((entry) => + NodeFSP.copyFile(new URL(`../${entry}`, import.meta.url), NodePath.join(directory, entry)), + ), + ); + assert.ok(Array.isArray(desktopConfig.pack)); + for (const packConfig of desktopConfig.pack) { + if (!Array.isArray(packConfig.entry)) continue; + if (!packConfig.entry.some((entry) => entries.includes(entry))) continue; + await build({ + ...packConfig, + config: false, + cwd: directory, + tsconfig: false, + sourcemap: false, + onSuccess: undefined, + logLevel: "silent", + }); + } + const outputDirectory = NodePath.join(directory, "dist-electron"); + const fixture = `console.log(require('node:module').getCompileCacheDir() ? 'cached' : 'uncached');`; + await NodeFSP.writeFile(NodePath.join(outputDirectory, "main.cjs"), fixture); + await NodeFSP.writeFile( + NodePath.join(outputDirectory, "backend.mjs"), + `import { getCompileCacheDir } from 'node:module'; console.log(getCompileCacheDir() ? 'cached' : 'uncached');`, + ); + for (const disabled of [false, true]) { + for (const args of [ + [NodePath.join(outputDirectory, "boot.cjs")], + [ + "--require", + NodePath.join(outputDirectory, "compileCache.cjs"), + NodePath.join(outputDirectory, "backend.mjs"), + ], + ]) { + const child = NodeChildProcess.spawnSync(process.execPath, args, { + encoding: "utf8", + env: { + ...process.env, + APPIMAGE: "", + NODE_COMPILE_CACHE: undefined, + NODE_DISABLE_COMPILE_CACHE: disabled ? "1" : undefined, + XDG_CACHE_HOME: directory, + TMPDIR: directory, + TEMP: directory, + TMP: directory, + }, + }); + assert.equal(child.status, 0, child.stderr); + assert.equal(child.stdout.trim(), disabled ? "uncached" : "cached"); + } + } + } finally { + await NodeFSP.rm(directory, { recursive: true, force: true }); + } +}); diff --git a/apps/desktop/scripts/smoke-test.mjs b/apps/desktop/scripts/smoke-test.mjs index fea5f0a120e5..05195bb8d8cd 100644 --- a/apps/desktop/scripts/smoke-test.mjs +++ b/apps/desktop/scripts/smoke-test.mjs @@ -5,7 +5,7 @@ import { resolveElectronLaunchCommand } from "./electron-launcher.mjs"; const __dirname = NodePath.dirname(NodeURL.fileURLToPath(import.meta.url)); const desktopDir = NodePath.resolve(__dirname, ".."); -const mainJs = NodePath.resolve(desktopDir, "dist-electron/main.cjs"); +const mainJs = NodePath.resolve(desktopDir, "dist-electron/boot.cjs"); console.log("\nLaunching Electron smoke test..."); diff --git a/apps/desktop/src/app/DesktopEnvironment.ts b/apps/desktop/src/app/DesktopEnvironment.ts index d6924b08acec..beb09bd50a46 100644 --- a/apps/desktop/src/app/DesktopEnvironment.ts +++ b/apps/desktop/src/app/DesktopEnvironment.ts @@ -66,6 +66,8 @@ export class DesktopEnvironment extends Context.Service< readonly clientAssetsDir: string; readonly backendCwd: string; readonly preloadPath: string; + // Preload that turns on the V8 compile cache for the local backend. + readonly compileCachePath: string; readonly appUpdateYmlPath: string; readonly devServerUrl: Option.Option; readonly devRemoteT3ServerEntryPath: Option.Option; @@ -221,6 +223,7 @@ const make = Effect.fn("desktop.environment.make")(function* ( clientAssetsDir: path.join(serverRoot, "apps/server/dist/client"), backendCwd: input.isPackaged ? homeDirectory : appRoot, preloadPath: path.join(input.dirname, "preload.cjs"), + compileCachePath: path.join(input.dirname, "compileCache.cjs"), appUpdateYmlPath: input.isPackaged ? path.join(resourcesPath, "app-update.yml") : path.join(input.appPath, "dev-app-update.yml"), diff --git a/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts b/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts index 83189e1ee0af..8d297750f784 100644 --- a/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts +++ b/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts @@ -235,6 +235,11 @@ describe("DesktopBackendConfiguration", () => { const second = yield* configuration.resolvePrimary; assert.equal(first.executablePath, process.execPath); + assert.deepEqual(first.args.slice(0, 3), [ + "--require", + environment.compileCachePath, + environment.backendEntryPath, + ]); assert.equal(first.entryPath, environment.backendEntryPath); assert.equal(first.cwd, environment.backendCwd); assert.equal(first.captureOutput, true); @@ -927,6 +932,8 @@ describe("DesktopBackendConfiguration", () => { const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration; const config = yield* configuration.resolvePrimary; assert.equal(config.captureOutput, true); + // Dev never shares the prod compile cache. + assert.notInclude(config.args, "--require"); }).pipe( Effect.provide( DesktopBackendConfiguration.layer.pipe( diff --git a/apps/desktop/src/backend/DesktopBackendConfiguration.ts b/apps/desktop/src/backend/DesktopBackendConfiguration.ts index 13b6eef442a0..d400c7a3a878 100644 --- a/apps/desktop/src/backend/DesktopBackendConfiguration.ts +++ b/apps/desktop/src/backend/DesktopBackendConfiguration.ts @@ -550,7 +550,16 @@ const resolvePrimaryStartConfig = Effect.fn("desktop.backendConfiguration.resolv return { executablePath: process.execPath, - args: [environment.backendEntryPath, "--bootstrap-fd", "3"], + // Packaged builds only, so a dev instance never shares the cache with the + // prod app it is often run from. `--require` rather than NODE_COMPILE_CACHE, + // so the setting does not leak into the provider and terminal processes + // the backend starts. + args: [ + ...(environment.isPackaged ? ["--require", environment.compileCachePath] : []), + environment.backendEntryPath, + "--bootstrap-fd", + "3", + ], entryPath: environment.backendEntryPath, cwd: environment.backendCwd, env: { diff --git a/apps/desktop/src/boot.ts b/apps/desktop/src/boot.ts new file mode 100644 index 000000000000..c9eb35b24e5f --- /dev/null +++ b/apps/desktop/src/boot.ts @@ -0,0 +1,4 @@ +// Packaged app entry. Enables the compile cache before the main bundle loads, +// so the cache also covers main.cjs itself. +require("./compileCache.cjs"); +require("./main.cjs"); diff --git a/apps/desktop/src/compileCache.ts b/apps/desktop/src/compileCache.ts new file mode 100644 index 000000000000..20f942db7db9 --- /dev/null +++ b/apps/desktop/src/compileCache.ts @@ -0,0 +1,28 @@ +// @effect-diagnostics nodeBuiltinImport:off +// Runs before any Effect runtime exists, so it stays on Node built-ins. +import * as NodeModule from "node:module"; +import * as NodeOS from "node:os"; +import * as NodePath from "node:path"; + +// Turns on Node's on-disk V8 code cache for every module loaded after this one, +// so later launches skip recompiling the large main and server bundles. +// Packaged builds only: boot.ts loads it for the main process, and the local +// backend gets it with `--require`. Dev launches main.cjs directly and skips it. +// Linux uses the user's cache dir because /tmp is shared between users; the +// macOS and Windows temp dirs are already per user. +// +// Skipped under AppImage: it mounts the app at a new /tmp/.mount_* path each +// launch, and Node keys entries by path, so every launch would miss and leave +// another copy behind. The backend inherits APPIMAGE, so this covers it too. +try { + if (!process.env.APPIMAGE) { + const cacheRoot = + // oxlint-disable-next-line t3code/no-global-process-runtime -- Loads before any Effect runtime. + process.platform === "linux" + ? process.env.XDG_CACHE_HOME || NodePath.join(NodeOS.homedir(), ".cache") + : NodeOS.tmpdir(); + NodeModule.enableCompileCache(NodePath.join(cacheRoot, "t3code", "compile-cache")); + } +} catch { + // The cache is only a speedup. Never let it stop the app from starting. +} diff --git a/apps/desktop/src/electron/ElectronProtocol.ts b/apps/desktop/src/electron/ElectronProtocol.ts index c3cecf88b2e4..30feb85043f8 100644 --- a/apps/desktop/src/electron/ElectronProtocol.ts +++ b/apps/desktop/src/electron/ElectronProtocol.ts @@ -126,6 +126,9 @@ function registerDesktopSchemePrivilegesSync(): void { supportFetchAPI: true, corsEnabled: true, stream: true, + // Custom schemes skip Chromium's V8 code cache unless they opt in. + // Dev stays off: Vite serves changing code at stable URLs. + codeCache: true, }, }, { diff --git a/apps/desktop/vite.config.ts b/apps/desktop/vite.config.ts index c451a89b5767..17ce805ffe16 100644 --- a/apps/desktop/vite.config.ts +++ b/apps/desktop/vite.config.ts @@ -85,6 +85,19 @@ export default defineConfig({ onlyBundle: false, }, }, + { + // boot.cjs requires the other two at runtime, so all three stay separate files. + format: "cjs", + outDir: "dist-electron", + dts: false, + sourcemap: true, + outExtensions: () => ({ js: ".cjs" }), + entry: ["src/boot.ts", "src/compileCache.ts"], + clean: false, + deps: { + neverBundle: (id) => id === "./main.cjs" || id === "./compileCache.cjs", + }, + }, { format: "cjs", outDir: "dist-electron", diff --git a/apps/server/src/compileCache.test.ts b/apps/server/src/compileCache.test.ts new file mode 100644 index 000000000000..17827bb38ba9 --- /dev/null +++ b/apps/server/src/compileCache.test.ts @@ -0,0 +1,53 @@ +// @effect-diagnostics nodeBuiltinImport:off - the test kills a real Node process to prove the cache is on disk. +import * as NodeChildProcess from "node:child_process"; +import * as NodeFSP from "node:fs/promises"; +import * as NodeOS from "node:os"; +import * as NodePath from "node:path"; +import { assert, it } from "@effect/vitest"; + +it.each([false, true])( + "persists an enabled cache before forced exit (disabled: %s)", + async (disabled) => { + const directory = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-compile-cache-")); + try { + const cacheDirectory = NodePath.join(directory, "cache"); + const child = NodeChildProcess.spawnSync( + process.execPath, + [ + "--input-type=module", + "--eval", + `import * as Effect from ${JSON.stringify(import.meta.resolve("effect/Effect"))}; +const { flushCompileCache } = await import(${JSON.stringify(new URL("./compileCache.ts", import.meta.url).href)}); +await Effect.runPromise(flushCompileCache); +process.kill(process.pid, "SIGKILL");`, + ], + { + encoding: "utf8", + env: { + ...process.env, + NODE_COMPILE_CACHE: cacheDirectory, + NODE_DISABLE_COMPILE_CACHE: disabled ? "1" : undefined, + }, + }, + ); + assert.equal(child.error, undefined); + assert.equal(child.stderr, ""); + assert.notEqual(child.status, 0); + const entries = await NodeFSP.readdir(cacheDirectory, { recursive: true }).catch( + (error: NodeJS.ErrnoException) => { + if (error.code === "ENOENT") return []; + throw error; + }, + ); + const files = await Promise.all( + entries.map((entry) => NodeFSP.stat(NodePath.join(cacheDirectory, entry))), + ); + assert.equal( + files.some((entry) => entry.isFile()), + !disabled, + ); + } finally { + await NodeFSP.rm(directory, { recursive: true, force: true }); + } + }, +); diff --git a/apps/server/src/compileCache.ts b/apps/server/src/compileCache.ts new file mode 100644 index 000000000000..d31e4305774c --- /dev/null +++ b/apps/server/src/compileCache.ts @@ -0,0 +1,9 @@ +import * as NodeModule from "node:module"; +import * as Effect from "effect/Effect"; + +// Desktop enables this cache before loading the backend. Windows force-kills +// the backend on quit, so persist it after startup instead of waiting for exit. +// This is a no-op when caching is disabled, including normal dev launches. +export const flushCompileCache = Effect.try(() => NodeModule.flushCompileCache()).pipe( + Effect.ignore, +); diff --git a/apps/server/src/serverRuntimeStartup.ts b/apps/server/src/serverRuntimeStartup.ts index be0cbbc6a6ba..138dbcedfa85 100644 --- a/apps/server/src/serverRuntimeStartup.ts +++ b/apps/server/src/serverRuntimeStartup.ts @@ -33,6 +33,7 @@ import * as Schema from "effect/Schema"; import * as Scope from "effect/Scope"; import * as ServerConfig from "./config.ts"; +import { flushCompileCache } from "./compileCache.ts"; import * as Keybindings from "./keybindings.ts"; import * as ExternalLauncher from "./process/externalLauncher.ts"; import * as OrchestrationEngine from "./orchestration/Services/OrchestrationEngine.ts"; @@ -1074,6 +1075,7 @@ export const make = (options?: StartupOptions) => }), ); yield* Effect.logDebug("startup phase: complete"); + yield* flushCompileCache; }).pipe( Effect.annotateSpans({ "server.mode": serverConfig.mode, diff --git a/knip.jsonc b/knip.jsonc index 5e87b4d5bc55..d2f1d7f88395 100644 --- a/knip.jsonc +++ b/knip.jsonc @@ -38,6 +38,8 @@ "src/snapShot/GlobalShiftShortcutWorker.ts!", "src/snapShot/RegionSnapShotWorker.ts!", "src/snapShot/SnapShotAccessibilityWorker.ts!", + "src/boot.ts!", + "src/compileCache.ts!", "src/main.ts!", "src/preload.ts!", "src/preview-pick-preload.ts!", diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index c05716ced8f3..d2d9df767946 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -3670,7 +3670,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( // Required by the .deb control file. homepage: "https://t3.codes", author: "T3 Tools", - main: "apps/desktop/dist-electron/main.cjs", + main: "apps/desktop/dist-electron/boot.cjs", build: yield* createBuildConfig( options.platform, options.target, From b3de243d5ed44783c4e7990d8e63cb519d390a03 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 24 Sep 2026 23:56:35 -0700 Subject: [PATCH 39/58] fix(dev): one t3.json setup action that works on every OS (#13589) Co-authored-by: Claude Opus 5.5 (1M context) --- docs/operations/development.md | 3 +-- knip.jsonc | 7 +++--- scripts/setup-worktree.ts | 45 ++++++++++++++++++++++++++++++++++ t3.json | 8 +----- 4 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 scripts/setup-worktree.ts diff --git a/docs/operations/development.md b/docs/operations/development.md index 1cbf09c16008..b7e1b257d0b2 100644 --- a/docs/operations/development.md +++ b/docs/operations/development.md @@ -76,8 +76,7 @@ Put that value in the main checkout's gitignored `.env`: T3CODE_DEV_AUTH_TOKEN= ``` -The `t3.json` Setup Worktree commands on Unix and Windows link that file to each worktree's -`.env`. The dev runner reads repository env files at startup. `.env.local` and inherited process +The `t3.json` Setup Worktree action links that file to each worktree's `.env`. The dev runner reads repository env files at startup. `.env.local` and inherited process environment values override `.env`, so no per-worktree export is needed after setup. For a manual worktree or launcher without that link, export the same fixed value instead: diff --git a/knip.jsonc b/knip.jsonc index d2f1d7f88395..a6e4f94143a0 100644 --- a/knip.jsonc +++ b/knip.jsonc @@ -13,8 +13,9 @@ "vitest": { "entry": [".github/**/*.test.cjs"] }, }, "scripts": { - // Knip loads its preprocessor through a CLI option; native verification runs directly. - "entry": ["knip-schemas.ts", "mobile-native-client.ts"], + // Knip loads its preprocessor through a CLI option; native verification and + // worktree setup (from t3.json) run directly. + "entry": ["knip-schemas.ts", "mobile-native-client.ts", "setup-worktree.ts"], }, "apps/server": { // Vite+ pack entries and the launcher used by installed background services. @@ -52,7 +53,7 @@ "ignoreDependencies": ["playwright-core", "electron-builder"], }, "apps/web": { - // Worktree setup invokes this directly from t3.json. + // Worktree setup (scripts/setup-worktree.ts) runs this directly. "entry": ["scripts/warm-dep-cache.ts"], // UI component modules are copied and adapted as cohesive sets. Keep their // named subcomponents even before they have callers; the file audit still diff --git a/scripts/setup-worktree.ts b/scripts/setup-worktree.ts new file mode 100644 index 000000000000..ea07a8b65ad8 --- /dev/null +++ b/scripts/setup-worktree.ts @@ -0,0 +1,45 @@ +// @effect-diagnostics nodeBuiltinImport:off - runs before `vp i`, so only Node built-ins exist. +/** + * Worktree setup, run by the t3.json "Setup Worktree" action as + * `node scripts/setup-worktree.ts`. Plain Node keeps one command working in + * every shell T3 Code spawns (zsh, bash, fish, PowerShell): it installs + * dependencies, links the main checkout's gitignored env files into this + * worktree, then warms the web dependency cache. + */ +import * as NodeChildProcess from "node:child_process"; +import * as NodeFS from "node:fs"; +import * as NodePath from "node:path"; + +const ENV_FILES = [".env", NodePath.join("infra", "relay", ".env")]; + +const projectRoot = process.env.T3CODE_PROJECT_ROOT; +if (!projectRoot) { + throw new Error("T3CODE_PROJECT_ROOT is not set. Run this through the t3.json setup action."); +} +const worktree = NodePath.dirname(import.meta.dirname); + +// `shell` resolves `vp` through PATH, including Windows command shims. +const install = NodeChildProcess.spawnSync("vp i", { + cwd: worktree, + shell: true, + stdio: "inherit", +}); +if (install.status !== 0) process.exit(install.status ?? 1); + +// In the main checkout itself, relinking would replace the real env files. +if (NodeFS.realpathSync(projectRoot) !== NodeFS.realpathSync(worktree)) { + for (const file of ENV_FILES) { + const source = NodePath.join(projectRoot, file); + if (!NodeFS.existsSync(source)) continue; + const target = NodePath.join(worktree, file); + NodeFS.rmSync(target, { force: true }); + NodeFS.symlinkSync(source, target); + } +} + +const warm = NodeChildProcess.spawnSync( + process.execPath, + [NodePath.join(worktree, "apps", "web", "scripts", "warm-dep-cache.ts")], + { cwd: worktree, stdio: "inherit" }, +); +process.exit(warm.status ?? 1); diff --git a/t3.json b/t3.json index 284d416a6820..d2c55e050776 100644 --- a/t3.json +++ b/t3.json @@ -4,13 +4,7 @@ "scripts": [ { "name": "Setup Worktree", - "command": "vp i && ln -sf $T3CODE_PROJECT_ROOT/.env .env && ln -sf $T3CODE_PROJECT_ROOT/infra/relay/.env infra/relay/.env && node apps/web/scripts/warm-dep-cache.ts", - "icon": "configure", - "runOnWorktreeCreate": true - }, - { - "name": "Setup Worktree (Windows)", - "command": "vp i && New-Item -ItemType SymbolicLink -Path .env -Target \"$env:T3CODE_PROJECT_ROOT\\.env\" -Force && New-Item -ItemType SymbolicLink -Path \"infra\\relay\\.env\" -Target \"$env:T3CODE_PROJECT_ROOT\\infra\\relay\\.env\" -Force && node apps\\web\\scripts\\warm-dep-cache.ts", + "command": "node scripts/setup-worktree.ts", "icon": "configure", "runOnWorktreeCreate": true } From 13d6b30515e9d44bb4cc2d223b8b3179c2ba4c79 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Fri, 25 Sep 2026 00:03:04 -0700 Subject: [PATCH 40/58] fix(web): new worktree threads no longer say "checkout" during setup (#13590) Co-authored-by: Claude Opus 5.5 (1M context) --- .../components/BranchToolbar.logic.test.ts | 28 +++++++++++++++++-- .../web/src/components/BranchToolbar.logic.ts | 19 ++++++++++--- apps/web/src/components/BranchToolbar.tsx | 22 ++++----------- .../BranchToolbarEnvModeSelector.tsx | 12 ++++---- apps/web/src/components/ChatView.tsx | 5 ++-- 5 files changed, 54 insertions(+), 32 deletions(-) diff --git a/apps/web/src/components/BranchToolbar.logic.test.ts b/apps/web/src/components/BranchToolbar.logic.test.ts index ff4bb76bf12a..bd1b11a6cd28 100644 --- a/apps/web/src/components/BranchToolbar.logic.test.ts +++ b/apps/web/src/components/BranchToolbar.logic.test.ts @@ -489,6 +489,24 @@ describe("resolveEffectiveEnvMode", () => { }), ).toBe("worktree"); }); + + it("keeps a server thread in worktree mode while its worktree is still being created", () => { + expect( + resolveEffectiveEnvMode({ + activeWorktreePath: null, + hasServerThread: true, + draftThreadEnvMode: undefined, + preparingWorktree: true, + }), + ).toBe("worktree"); + expect( + resolveEffectiveEnvMode({ + activeWorktreePath: null, + hasServerThread: true, + draftThreadEnvMode: undefined, + }), + ).toBe("local"); + }); }); describe("resolveEnvModeLabel", () => { @@ -510,11 +528,17 @@ describe("resolveCurrentWorkspaceLabel", () => { describe("resolveLockedWorkspaceLabel", () => { it("uses a shorter label for the main repo checkout", () => { - expect(resolveLockedWorkspaceLabel(null)).toBe("Local checkout"); + expect(resolveLockedWorkspaceLabel(null, "local")).toBe("Local checkout"); }); it("uses a shorter label for an attached worktree", () => { - expect(resolveLockedWorkspaceLabel("/repo/.t3/worktrees/feature-a")).toBe("Worktree"); + expect(resolveLockedWorkspaceLabel("/repo/.t3/worktrees/feature-a", "worktree")).toBe( + "Worktree", + ); + }); + + it("describes a worktree that is still being created as a new worktree", () => { + expect(resolveLockedWorkspaceLabel(null, "worktree")).toBe("New worktree"); }); }); diff --git a/apps/web/src/components/BranchToolbar.logic.ts b/apps/web/src/components/BranchToolbar.logic.ts index 85d306f919ae..cbc887954019 100644 --- a/apps/web/src/components/BranchToolbar.logic.ts +++ b/apps/web/src/components/BranchToolbar.logic.ts @@ -104,8 +104,14 @@ export function resolveCurrentWorkspaceLabel(activeWorktreePath: string | null): return activeWorktreePath ? "Current worktree" : resolveEnvModeLabel("local"); } -export function resolveLockedWorkspaceLabel(activeWorktreePath: string | null): string { - return activeWorktreePath ? "Worktree" : "Local checkout"; +// A locked thread in worktree mode with no path is still creating its +// worktree, so it reads as a new worktree rather than the project checkout. +export function resolveLockedWorkspaceLabel( + activeWorktreePath: string | null, + effectiveEnvMode: EnvMode, +): string { + if (activeWorktreePath) return "Worktree"; + return effectiveEnvMode === "worktree" ? resolveEnvModeLabel("worktree") : "Local checkout"; } export interface PreviousWorktreeSeed { @@ -159,15 +165,20 @@ export function resolveEffectiveEnvMode(input: { activeWorktreePath: string | null; hasServerThread: boolean; draftThreadEnvMode: EnvMode | undefined; + /** + * The server is still creating this thread's worktree. The thread exists + * from the start of that setup but gets its worktree path only at the end. + */ + preparingWorktree?: boolean; }): EnvMode { - const { activeWorktreePath, hasServerThread, draftThreadEnvMode } = input; + const { activeWorktreePath, hasServerThread, draftThreadEnvMode, preparingWorktree } = input; if (!hasServerThread) { if (activeWorktreePath) { return "local"; } return draftThreadEnvMode === "worktree" ? "worktree" : "local"; } - return activeWorktreePath ? "worktree" : "local"; + return activeWorktreePath || preparingWorktree ? "worktree" : "local"; } export function resolveDraftEnvModeAfterBranchChange(input: { diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsx index 1e5cb85a9737..eca4fab601d0 100644 --- a/apps/web/src/components/BranchToolbar.tsx +++ b/apps/web/src/components/BranchToolbar.tsx @@ -28,7 +28,6 @@ import { resolveContextStripLabelsCompact, resolveCurrentWorkspaceLabel, resolveEnvModeLabel, - resolveEffectiveEnvMode, resolveLockedWorkspaceLabel, resolvePreviousWorktreeLabel, resolvePreviousWorktreeSeed, @@ -74,7 +73,8 @@ interface BranchToolbarProps { showGitControls: boolean; draftId?: DraftId; onEnvModeChange: (mode: EnvMode) => void; - effectiveEnvModeOverride?: EnvMode; + /** The thread's env mode as ChatView resolves it. */ + envMode: EnvMode; activeThreadBranchOverride?: string | null; onActiveThreadBranchOverrideChange?: (branch: string | null) => void; startFromOrigin: boolean; @@ -141,7 +141,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({ const workspaceLabel = forceNewWorktree ? resolveEnvModeLabel("worktree") : envModeLocked - ? resolveLockedWorkspaceLabel(activeWorktreePath) + ? resolveLockedWorkspaceLabel(activeWorktreePath, effectiveEnvMode) : effectiveEnvMode === "worktree" ? resolveEnvModeLabel("worktree") : resolveCurrentWorkspaceLabel(activeWorktreePath); @@ -511,7 +511,7 @@ export const BranchToolbar = memo(function BranchToolbar({ showGitControls, draftId, onEnvModeChange, - effectiveEnvModeOverride, + envMode, activeThreadBranchOverride, onActiveThreadBranchOverrideChange, startFromOrigin, @@ -546,13 +546,7 @@ export const BranchToolbar = memo(function BranchToolbar({ const activeWorktreePath = forceNewWorktree ? null : (serverThread?.worktreePath ?? draftThread?.worktreePath ?? null); - const effectiveEnvMode = - (forceNewWorktree ? "worktree" : effectiveEnvModeOverride) ?? - resolveEffectiveEnvMode({ - activeWorktreePath, - hasServerThread: serverThread !== null, - draftThreadEnvMode: draftThread?.envMode, - }); + const effectiveEnvMode = forceNewWorktree ? "worktree" : envMode; const envModeLocked = envLocked || (serverThread !== null && activeWorktreePath !== null); // "Previous worktree" hops a draft into the most recently active worktree @@ -720,11 +714,7 @@ export const BranchToolbar = memo(function BranchToolbar({ threadId={threadId} {...(draftId ? { draftId } : {})} envLocked={envLocked} - {...(forceNewWorktree - ? { effectiveEnvModeOverride: "worktree" } - : effectiveEnvModeOverride - ? { effectiveEnvModeOverride } - : {})} + effectiveEnvModeOverride={effectiveEnvMode} {...(activeThreadBranchOverride !== undefined ? { activeThreadBranchOverride } : {})} {...(onActiveThreadBranchOverrideChange ? { onActiveThreadBranchOverrideChange } : {})} startFromOrigin={startFromOrigin} diff --git a/apps/web/src/components/BranchToolbarEnvModeSelector.tsx b/apps/web/src/components/BranchToolbarEnvModeSelector.tsx index 1d72ddf87e18..40692063e979 100644 --- a/apps/web/src/components/BranchToolbarEnvModeSelector.tsx +++ b/apps/web/src/components/BranchToolbarEnvModeSelector.tsx @@ -64,10 +64,10 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe className="inline-flex h-7 min-w-0 items-center gap-1 border border-transparent px-1.75 font-normal text-muted-foreground/70 text-xs sm:h-6" data-composer-context-control > - {forceNewWorktree ? ( - - ) : activeWorktreePath ? ( + {activeWorktreePath ? ( + ) : effectiveEnvMode === "worktree" ? ( + ) : ( )} @@ -79,16 +79,14 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe data-composer-label-motion className="block w-full min-w-0 max-w-[240px] truncate transition-opacity duration-180 ease-drawer group-data-[compact]/composer-context:opacity-0 motion-reduce:transition-none" > - {forceNewWorktree - ? resolveEnvModeLabel("worktree") - : resolveLockedWorkspaceLabel(activeWorktreePath)} + {resolveLockedWorkspaceLabel(activeWorktreePath, effectiveEnvMode)}
{forceNewWorktree ? "Each model starts in its own worktree." - : resolveLockedWorkspaceLabel(activeWorktreePath)} + : resolveLockedWorkspaceLabel(activeWorktreePath, effectiveEnvMode)}
); diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index cd36675860df..f5c3825cee33 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -5845,6 +5845,7 @@ export default function ChatView(props: ChatViewProps) { activeWorktreePath, hasServerThread: isServerThread, draftThreadEnvMode: isLocalDraftThread ? draftThread?.envMode : undefined, + preparingWorktree: isPreparingWorktree, }); const canOverrideServerThreadEnvMode = Boolean( isServerThread && @@ -10238,9 +10239,7 @@ export default function ChatView(props: ChatViewProps) { onEnvModeChange={onEnvModeChange} startFromOrigin={startFromOrigin} onStartFromOriginChange={onStartFromOriginChange} - {...(canOverrideServerThreadEnvMode - ? { effectiveEnvModeOverride: envMode } - : {})} + envMode={envMode} {...(canOverrideServerThreadEnvMode ? { activeThreadBranchOverride: activeThreadBranch, From 86054b6df2c5e38b6e27b980eae2716bfe1da202 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Fri, 25 Sep 2026 00:12:41 -0700 Subject: [PATCH 41/58] fix(desktop): `t3 app` keeps working after a second desktop app quits (#13585) Co-authored-by: Claude Opus 5.5 (1M context) --- .../src/app/DesktopAppActivation.test.ts | 67 +++++++ apps/desktop/src/app/DesktopAppActivation.ts | 178 ++++++++++++++---- 2 files changed, 206 insertions(+), 39 deletions(-) diff --git a/apps/desktop/src/app/DesktopAppActivation.test.ts b/apps/desktop/src/app/DesktopAppActivation.test.ts index d6ce80322798..8ab165afce0a 100644 --- a/apps/desktop/src/app/DesktopAppActivation.test.ts +++ b/apps/desktop/src/app/DesktopAppActivation.test.ts @@ -44,6 +44,25 @@ function request(requestId: string, platform: NodeJS.Platform): DesktopAppActiva }; } +function startOkServer(target: ReturnType, userId: number | undefined) { + return startDesktopAppControlServer({ + ...target, + userId, + handle: async (input) => ({ + version: 1, + requestId: input.requestId, + ok: true, + projectId: ProjectId.make("project-1"), + threadId: ThreadId.make("thread-1"), + }), + cancel: () => undefined, + onReclaimError: () => undefined, + }).then((server) => { + openServers.push(server); + return server; + }); +} + function exchange(address: string, payload: DesktopAppActivationRequest) { return new Promise((resolve, reject) => { const socket = NodeNet.createConnection(address); @@ -84,6 +103,7 @@ describe("desktop app control server", () => { }; }, cancel: () => undefined, + onReclaimError: () => undefined, }); openServers.push(server); @@ -117,6 +137,7 @@ describe("desktop app control server", () => { userId, handle: () => new Promise(() => undefined), cancel: resolveCanceled, + onReclaimError: () => undefined, }); openServers.push(server); const socket = NodeNet.createConnection(target.address); @@ -137,4 +158,50 @@ describe("desktop app control server", () => { }); }), ); + + // Two desktop apps can share one state dir, such as nightly and a preview build. + it.effect("keeps a newer app's socket when an older app on the same state dir quits", () => + Effect.gen(function* () { + const platform = yield* HostProcessPlatform; + const userId = yield* HostProcessUserId; + if (platform === "win32") return; + yield* Effect.promise(async () => { + const root = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-app-takeover-test-")); + const target = makeTarget(NodePath.join(root, "userdata"), platform, userId); + const older = await startOkServer(target, userId); + await startOkServer(target, userId); + + await older.close(); + + await expect( + exchange(target.address, request("after-quit", platform)), + ).resolves.toMatchObject({ ok: true, requestId: "after-quit" }); + await NodeFSP.rm(root, { recursive: true, force: true }); + }); + }), + ); + + it.effect("binds its address again after the socket file is removed", () => + Effect.gen(function* () { + const platform = yield* HostProcessPlatform; + const userId = yield* HostProcessUserId; + if (platform === "win32") return; + yield* Effect.promise(async () => { + const root = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-app-reclaim-test-")); + const target = makeTarget(NodePath.join(root, "userdata"), platform, userId); + const server = await startOkServer(target, userId); + + await NodeFSP.unlink(target.address); + await server.reclaim(); + + await expect( + exchange(target.address, request("reclaimed", platform)), + ).resolves.toMatchObject({ + ok: true, + requestId: "reclaimed", + }); + await NodeFSP.rm(root, { recursive: true, force: true }); + }); + }), + ); }); diff --git a/apps/desktop/src/app/DesktopAppActivation.ts b/apps/desktop/src/app/DesktopAppActivation.ts index 50fc70d783e4..740799955da2 100644 --- a/apps/desktop/src/app/DesktopAppActivation.ts +++ b/apps/desktop/src/app/DesktopAppActivation.ts @@ -1,7 +1,10 @@ -// @effect-diagnostics nodeBuiltinImport:off -- Local socket ownership checks need lstat uid and an atomic stale-socket unlink at the Node adapter boundary. +// @effect-diagnostics nodeBuiltinImport:off -- Local socket ownership checks need lstat, an atomic rename, and a directory watch at the Node adapter boundary. +import * as NodeCrypto from "node:crypto"; +import * as NodeFS from "node:fs"; import * as NodeFSP from "node:fs/promises"; import * as NodeNet from "node:net"; import * as NodeOS from "node:os"; +import * as NodePath from "node:path"; import { DESKTOP_APP_ACTIVATION_PROTOCOL_VERSION, @@ -44,6 +47,8 @@ export class DesktopAppActivationStartError extends Schema.TaggedError Promise; readonly close: () => Promise; } @@ -70,12 +75,12 @@ function requestIdFromUnknown(value: unknown): string { return "invalid-request"; } -async function prepareUnixSocket(input: { - readonly address: string; +/** Makes sure the socket directory is safe to use. Returns true when it had to create it. */ +async function prepareUnixDirectory(input: { readonly directory: string; readonly userId: number | undefined; -}): Promise { - await NodeFSP.mkdir(input.directory, { recursive: true, mode: 0o700 }); +}): Promise { + const created = await NodeFSP.mkdir(input.directory, { recursive: true, mode: 0o700 }); const stat = await NodeFSP.lstat(input.directory); if (!stat.isDirectory() || stat.isSymbolicLink()) { throw new Error(`${input.directory} is not a directory.`); @@ -84,28 +89,43 @@ async function prepareUnixSocket(input: { throw new Error(`${input.directory} is owned by another user.`); } await NodeFSP.chmod(input.directory, 0o700); - await NodeFSP.unlink(input.address).catch((error: NodeJS.ErrnoException) => { - if (error.code !== "ENOENT") throw error; - }); + return created !== undefined; +} + +async function inodeAt(path: string): Promise { + return NodeFSP.lstat(path).then( + (stat) => stat.ino, + (error: NodeJS.ErrnoException) => { + if (error.code === "ENOENT") return null; + throw error; + }, + ); +} + +function closeServer(server: NodeNet.Server): Promise { + return new Promise((resolve) => server.close(() => resolve())); } +/** + * Serves `t3 app` requests on the local control address until `close`. + * + * Two desktop apps can share one state dir, for example nightly and a preview + * build. They share one socket path, so on Unix: + * - The newest app takes the path over. + * - `close` removes the socket file only while it is still this app's socket. + * - An app binds the path again when it is gone, for example after the app that + * took it over quits. + */ export async function startDesktopAppControlServer(input: { readonly address: string; readonly directory: string | null; readonly userId: number | undefined; readonly handle: (request: DesktopAppActivationRequest) => Promise; readonly cancel: (requestId: string) => void; + readonly onReclaimError: (error: unknown) => void; }): Promise { - if (input.directory !== null) { - await prepareUnixSocket({ - address: input.address, - directory: input.directory, - userId: input.userId, - }); - } - const sockets = new Set(); - const server = NodeNet.createServer((socket) => { + const handleConnection = (socket: NodeNet.Socket) => { sockets.add(socket); socket.setEncoding("utf8"); let buffer = ""; @@ -160,40 +180,116 @@ export async function startDesktopAppControlServer(input: { sockets.delete(socket); if (!responseSent && activeRequestId !== null) input.cancel(activeRequestId); }); - }); + }; - await new Promise((resolve, reject) => { - const onError = (error: Error) => { - server.removeListener("listening", onListening); - reject(error); - }; - const onListening = () => { - server.removeListener("error", onError); - resolve(); - }; - server.once("error", onError); - server.once("listening", onListening); - server.listen(input.address); - }); + const listen = (address: string) => + new Promise((resolve, reject) => { + const server = NodeNet.createServer(handleConnection); + const onError = (error: Error) => { + server.removeListener("listening", onListening); + reject(error); + }; + const onListening = () => { + server.removeListener("error", onError); + resolve(server); + }; + server.once("error", onError); + server.once("listening", onListening); + server.listen(address); + }); - try { - if (input.directory !== null) { - await NodeFSP.chmod(input.address, 0o600); + // Closing a Unix socket server unlinks the path it was bound to, even when + // another app's socket lives there now. Bind a staging path and move it onto + // the address instead, so a later close only unlinks the staging path, which + // is already gone. `rename` takes the address over in one step. `link` claims + // it only while it is free, and fails with EEXIST otherwise. + const bindUnix = async (directory: string, mode: "take-over" | "claim-free") => { + const staging = NodePath.join(directory, `${NodeCrypto.randomBytes(6).toString("hex")}.tmp`); + const server = await listen(staging); + try { + await NodeFSP.chmod(staging, 0o600); + const inode = await inodeAt(staging); + if (mode === "take-over") { + await NodeFSP.rename(staging, input.address); + } else { + await NodeFSP.link(staging, input.address); + await NodeFSP.unlink(staging); + } + return { server, inode }; + } catch (error) { + await closeServer(server); + throw error; } - } catch (error) { - await new Promise((resolve) => server.close(() => resolve())); - throw error; + }; + + let server: NodeNet.Server; + let inode: number | null = null; + if (input.directory === null) { + // Named pipes close with the app that owns them, so no other app can remove this one. + server = await listen(input.address); + } else { + await prepareUnixDirectory({ directory: input.directory, userId: input.userId }); + ({ server, inode } = await bindUnix(input.directory, "take-over")); } let closed = false; + const reclaimOnce = async () => { + // Never replace a socket that exists, so two apps cannot trade the path back and forth. + if (closed || input.directory === null || (await inodeAt(input.address)) !== null) return; + if (await prepareUnixDirectory({ directory: input.directory, userId: input.userId })) { + // A watch follows the directory's inode, so a recreated directory needs a new one. + watchDirectory(input.directory); + } + const next = await bindUnix(input.directory, "claim-free").catch( + (error: NodeJS.ErrnoException) => { + // Another app bound the address first. + if (error.code === "EEXIST") return null; + throw error; + }, + ); + if (next === null) return; + const previous = server; + ({ server, inode } = next); + previous.close(); + }; + let pendingReclaim = Promise.resolve(); + const reclaim = () => { + const run = pendingReclaim.then(reclaimOnce); + pendingReclaim = run.catch(() => undefined); + return run; + }; + let watcher: NodeFS.FSWatcher | null = null; + const watchDirectory = (directory: string) => { + watcher?.close(); + watcher = null; + try { + watcher = NodeFS.watch(directory, { persistent: false }, () => { + reclaim().catch(input.onReclaimError); + }); + watcher.on("error", input.onReclaimError); + } catch (error) { + // The socket still works without a watcher. It only cannot recover after removal. + input.onReclaimError(error); + } + }; + if (input.directory !== null) { + watchDirectory(input.directory); + // Catch a removal that happened before the watcher started. + reclaim().catch(input.onReclaimError); + } + return { + reclaim, close: async () => { if (closed) return; closed = true; + // A running reclaim can replace the watcher, so close the watcher after it. + await pendingReclaim; + watcher?.close(); for (const socket of sockets) socket.destroy(); - await new Promise((resolve) => server.close(() => resolve())); + await closeServer(server); server.removeAllListeners(); - if (input.directory !== null) { + if (inode !== null && (await inodeAt(input.address)) === inode) { await NodeFSP.unlink(input.address).catch((error: NodeJS.ErrnoException) => { if (error.code !== "ENOENT") throw error; }); @@ -258,6 +354,10 @@ export const make = Effect.gen(function* () { userId, handle: (request) => broker.request(request), cancel: (requestId) => broker.cancel(requestId), + onReclaimError: (cause) => + void runPromise( + logWarning("failed to restore the desktop app control socket", { cause }), + ), }), catch: (cause) => new DesktopAppActivationStartError({ address: address.address, cause }), }), From e3e7cc3fc2e02966efe4efc45216dadcd046bfbb Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Fri, 25 Sep 2026 00:58:13 -0700 Subject: [PATCH 42/58] fix(usage): price Claude fast-mode requests at the fast rate (#13599) Co-authored-by: Claude Opus 5.5 (1M context) --- .../server/src/usage/usageAggregation.test.ts | 2 + apps/server/src/usage/usageAggregation.ts | 11 +--- apps/server/src/usage/usagePricing.test.ts | 42 ++++++++++--- apps/server/src/usage/usagePricing.ts | 60 +++++++++++++------ apps/server/src/usage/usageScanCache.test.ts | 20 ++++++- apps/server/src/usage/usageScanCache.ts | 12 +++- .../server/src/usage/usageTranscripts.test.ts | 11 ++++ apps/server/src/usage/usageTranscripts.ts | 9 +++ 8 files changed, 129 insertions(+), 38 deletions(-) diff --git a/apps/server/src/usage/usageAggregation.test.ts b/apps/server/src/usage/usageAggregation.test.ts index 8da4e920ac06..75435de08ff7 100644 --- a/apps/server/src/usage/usageAggregation.test.ts +++ b/apps/server/src/usage/usageAggregation.test.ts @@ -12,6 +12,7 @@ const rates: RateTable = new Map([ outputCostPerToken: 5e-5, cacheReadCostPerToken: 1e-6, cacheCreationCostPerToken: 1.25e-5, + fastMultiplier: 1, }, ], ]); @@ -31,6 +32,7 @@ function record(overrides: Partial = {}): UsageRecord { reasoningTokens: 0, }, reportedCostUsd: null, + fast: false, dedupeKey: null, ...overrides, }; diff --git a/apps/server/src/usage/usageAggregation.ts b/apps/server/src/usage/usageAggregation.ts index 2ad3893ad4e6..684f0a520614 100644 --- a/apps/server/src/usage/usageAggregation.ts +++ b/apps/server/src/usage/usageAggregation.ts @@ -161,20 +161,13 @@ export class UsageAggregator { this.#buckets.set(key, bucket); } - const priced = priceUsage( - this.#options.rates, - record.model, - record.totals, - record.reportedCostUsd, - this.#options.priceOverrides, - ); + const priced = priceUsage(this.#options.rates, record, this.#options.priceOverrides); bucket.totals = addTotals(bucket.totals, record.totals); bucket.costUsd += priced.costUsd; bucket.cacheSavingsUsd += cacheSavingsUsd( this.#options.rates, - record.model, - record.totals, + record, this.#options.priceOverrides, ); bucket.records += 1; diff --git a/apps/server/src/usage/usagePricing.test.ts b/apps/server/src/usage/usagePricing.test.ts index 713d860999cb..ca340a44a64e 100644 --- a/apps/server/src/usage/usagePricing.test.ts +++ b/apps/server/src/usage/usagePricing.test.ts @@ -22,6 +22,12 @@ describe("usage pricing", () => { outputTokens: 1_000_000, reasoningTokens: 500_000, }; + const record = (model: string, reportedCostUsd: number | null = null, fast = false) => ({ + model, + totals, + reportedCostUsd, + fast, + }); it("uses custom token rates ahead of public and provider-reported costs", () => { const table = parseRateTable({ "example-model": rate(1) }); @@ -35,12 +41,12 @@ describe("usage pricing", () => { }); for (const reportedCostUsd of [null, 99]) { - expect(priceUsage(table, "example-model", totals, reportedCostUsd, overrides)).toEqual({ + expect(priceUsage(table, record("example-model", reportedCostUsd), overrides)).toEqual({ costUsd: 13.5, costSource: "modelPriced", }); } - expect(cacheSavingsUsd(table, "example-model", totals, overrides)).toBe(1.5); + expect(cacheSavingsUsd(table, record("example-model"), overrides)).toBe(1.5); }); it("prices unknown models offline and uses input prices for omitted cache rates", () => { @@ -49,11 +55,11 @@ describe("usage pricing", () => { "example-model": { inputCostPerMillionTokens: 2, outputCostPerMillionTokens: 8 }, }); - expect(priceUsage(table, "example-model", totals, null, overrides)).toEqual({ + expect(priceUsage(table, record("example-model"), overrides)).toEqual({ costUsd: 14, costSource: "modelPriced", }); - expect(cacheSavingsUsd(table, "example-model", totals, overrides)).toBe(0); + expect(cacheSavingsUsd(table, record("example-model"), overrides)).toBe(0); }); it("preserves explicit zero rates and matches only the exact trimmed model ID", () => { @@ -64,7 +70,7 @@ describe("usage pricing", () => { outputCostPerMillionTokens: 0, }, }); - expect(priceUsage(table, " vendor/example-model[1m] ", totals, 99, overrides)).toEqual({ + expect(priceUsage(table, record(" vendor/example-model[1m] ", 99), overrides)).toEqual({ costUsd: 0, costSource: "modelPriced", }); @@ -74,14 +80,36 @@ describe("usage pricing", () => { "vendor/Example-model[1m]", "other/example-model[1m]", ]) { - expect(priceUsage(table, model, totals, null, overrides).costSource).toBe("unpriced"); - expect(priceUsage(table, model, totals, 99, overrides)).toEqual({ + expect(priceUsage(table, record(model), overrides).costSource).toBe("unpriced"); + expect(priceUsage(table, record(model, 99), overrides)).toEqual({ costUsd: 99, costSource: "providerReported", }); } }); + it("prices fast-mode requests at the model's published fast multiple", () => { + const table = parseRateTable({ + "claude-opus-5-5": { ...rate(4e-6, 2e-7), provider_specific_entry: { fast: 2, us: 1.1 } }, + "claude-fable-5-1": { ...rate(1e-5, 2.5e-7), provider_specific_entry: { us: 1.1 } }, + }); + const overrides = createOverrideRateTable({ + "claude-opus-5-5": { inputCostPerMillionTokens: 4, outputCostPerMillionTokens: 20 }, + }); + const cost = (model: string, fast: boolean, custom?: typeof overrides) => + priceUsage(table, record(model, null, fast), custom).costUsd; + + expect(cost("claude-opus-5-5", true)).toBeCloseTo(2 * cost("claude-opus-5-5", false)); + expect(cacheSavingsUsd(table, record("claude-opus-5-5", null, true))).toBeCloseTo( + 2 * cacheSavingsUsd(table, record("claude-opus-5-5")), + ); + // No published fast tier, and custom prices, both stay at the standard rate. + expect(cost("claude-fable-5-1", true)).toBe(cost("claude-fable-5-1", false)); + expect(cost("claude-opus-5-5", true, overrides)).toBe( + cost("claude-opus-5-5", false, overrides), + ); + }); + it("keeps the canonical Fable rate separate from DeepInfra in either order", () => { const canonical = ["claude-fable-5", rate(1e-5, 1e-6)] as const; const deepInfra = ["deepinfra/anthropic/claude-fable-5", rate(1e-5)] as const; diff --git a/apps/server/src/usage/usagePricing.ts b/apps/server/src/usage/usagePricing.ts index 6c94be424827..60bf31b93e31 100644 --- a/apps/server/src/usage/usagePricing.ts +++ b/apps/server/src/usage/usagePricing.ts @@ -7,11 +7,9 @@ * * @module usagePricing */ -import type { - UsageCostSource, - UsageModelPriceOverride, - UsageTokenTotals, -} from "@t3tools/contracts"; +import type { UsageCostSource, UsageModelPriceOverride } from "@t3tools/contracts"; + +import type { UsageRecord } from "./usageTranscripts.ts"; /** * The subset of a LiteLLM entry we price against. All values are USD per token. @@ -26,11 +24,19 @@ export interface ModelRate { readonly outputCostPerToken: number; readonly cacheReadCostPerToken: number; readonly cacheCreationCostPerToken: number; + /** + * Multiple of the rates above billed for a fast-mode request, from LiteLLM's + * `provider_specific_entry.fast`. `1` when the model publishes no fast tier. + */ + readonly fastMultiplier: number; } export type RateTable = ReadonlyMap; -/** Custom IDs keep their case, provider prefix, and variant suffix. */ +/** + * Custom IDs keep their case, provider prefix, and variant suffix. Custom rates + * apply as entered, fast-mode requests included. + */ export function createOverrideRateTable( overrides: Readonly>, ): RateTable { @@ -44,6 +50,7 @@ export function createOverrideRateTable( (prices.cacheReadCostPerMillionTokens ?? prices.inputCostPerMillionTokens) / 1_000_000, cacheCreationCostPerToken: (prices.cacheWriteCostPerMillionTokens ?? prices.inputCostPerMillionTokens) / 1_000_000, + fastMultiplier: 1, }, ]), ); @@ -55,12 +62,21 @@ interface LiteLlmEntry { readonly output_cost_per_token?: unknown; readonly cache_read_input_token_cost?: unknown; readonly cache_creation_input_token_cost?: unknown; + readonly provider_specific_entry?: unknown; } function finiteNumber(value: unknown): number | null { return typeof value === "number" && Number.isFinite(value) ? value : null; } +/** Reads `provider_specific_entry.fast`, e.g. `2` for Claude Opus 5.5. */ +function fastMultiplier(entry: LiteLlmEntry): number { + const specific = entry.provider_specific_entry; + if (typeof specific !== "object" || specific === null) return 1; + const fast = finiteNumber((specific as Record)["fast"]); + return fast !== null && fast > 0 ? fast : 1; +} + /** * Projects the LiteLLM document into a rate table. * @@ -92,6 +108,7 @@ export function parseRateTable(document: unknown): RateTable { // input rather than as free. cacheReadCostPerToken: finiteNumber(entry.cache_read_input_token_cost) ?? input, cacheCreationCostPerToken: finiteNumber(entry.cache_creation_input_token_cost) ?? input, + fastMultiplier: fastMultiplier(entry), }); } @@ -119,7 +136,8 @@ function sameRate(a: ModelRate, b: ModelRate): boolean { a.inputCostPerToken === b.inputCostPerToken && a.outputCostPerToken === b.outputCostPerToken && a.cacheReadCostPerToken === b.cacheReadCostPerToken && - a.cacheCreationCostPerToken === b.cacheCreationCostPerToken + a.cacheCreationCostPerToken === b.cacheCreationCostPerToken && + a.fastMultiplier === b.fastMultiplier ); } @@ -165,24 +183,26 @@ export function lookupRate(table: RateTable, model: string): ModelRate | null { return table.get(key) ?? null; } +/** The parts of a transcript record that decide its price. */ +export type PricedRecord = Pick; + export interface PricedUsage { readonly costUsd: number; readonly costSource: UsageCostSource; } /** - * Prices a bucket's tokens. + * Prices one record's tokens. * * `reasoningTokens` is intentionally not charged separately: it is already * counted inside `outputTokens`. */ export function priceUsage( table: RateTable, - model: string, - totals: UsageTokenTotals, - reportedCostUsd: number | null, + record: PricedRecord, overrides?: RateTable, ): PricedUsage { + const { model, totals, reportedCostUsd } = record; const override = overrides?.get(model.trim()); if (override === undefined && reportedCostUsd !== null && Number.isFinite(reportedCostUsd)) { return { costUsd: reportedCostUsd, costSource: "providerReported" }; @@ -191,13 +211,16 @@ export function priceUsage( const rate = override ?? lookupRate(table, model); if (rate === null) return { costUsd: 0, costSource: "unpriced" }; - const costUsd = + const standardCostUsd = totals.uncachedInputTokens * rate.inputCostPerToken + totals.cachedInputTokens * rate.cacheReadCostPerToken + totals.cacheCreationTokens * rate.cacheCreationCostPerToken + totals.outputTokens * rate.outputCostPerToken; - return { costUsd, costSource: "modelPriced" }; + return { + costUsd: standardCostUsd * (record.fast ? rate.fastMultiplier : 1), + costSource: "modelPriced", + }; } /** @@ -206,11 +229,14 @@ export function priceUsage( */ export function cacheSavingsUsd( table: RateTable, - model: string, - totals: UsageTokenTotals, + record: PricedRecord, overrides?: RateTable, ): number { - const rate = overrides?.get(model.trim()) ?? lookupRate(table, model); + const rate = overrides?.get(record.model.trim()) ?? lookupRate(table, record.model); if (rate === null) return 0; - return totals.cachedInputTokens * (rate.inputCostPerToken - rate.cacheReadCostPerToken); + return ( + record.totals.cachedInputTokens * + (rate.inputCostPerToken - rate.cacheReadCostPerToken) * + (record.fast ? rate.fastMultiplier : 1) + ); } diff --git a/apps/server/src/usage/usageScanCache.test.ts b/apps/server/src/usage/usageScanCache.test.ts index cc1bdbcc1626..6455b1eb7770 100644 --- a/apps/server/src/usage/usageScanCache.test.ts +++ b/apps/server/src/usage/usageScanCache.test.ts @@ -24,6 +24,7 @@ function record(overrides: Partial = {}): UsageRecord { reasoningTokens: 0, }, reportedCostUsd: null, + fast: false, dedupeKey: "msg_1:", ...overrides, }; @@ -57,7 +58,11 @@ function cacheWith(entries: readonly [string, number, readonly UsageRecord[]][]) describe("scan cache round trip", () => { it("restores records unchanged", () => { const original = cacheWith([ - ["/a.jsonl", 100, [record(), record({ dedupeKey: "msg_2:", model: "claude-opus-5" })]], + [ + "/a.jsonl", + 100, + [record(), record({ dedupeKey: "msg_2:", model: "claude-opus-5-5", fast: true })], + ], ["/b.jsonl", 200, [record({ sessionId: "session-b", reportedCostUsd: 1.5 })]], ]); original.set("/grok.jsonl", { @@ -123,9 +128,20 @@ describe("scan cache round trip", () => { expect(decodeScanCache(JSON.parse(JSON.stringify(poisoned))).has("/a.jsonl")).toBe(false); }); + it("drops an entry whose fast flag is not 0 or 1", () => { + const encoded = encodeScanCache(cacheWith([["/a.jsonl", 100, [record({ fast: true })]]])); + const row = encoded.files["/a.jsonl"]!.r[0]!; + const poisoned = { + ...encoded, + files: { "/a.jsonl": { ...encoded.files["/a.jsonl"]!, r: [[...row.slice(0, 10), true]] } }, + }; + + expect(decodeScanCache(JSON.parse(JSON.stringify(poisoned))).has("/a.jsonl")).toBe(false); + }); + it("rejects a document from the previous cache version", () => { const encoded = encodeScanCache(cacheWith([["/a.jsonl", 100, [record()]]])); - const previous = { ...encoded, version: 2 }; + const previous = { ...encoded, version: 3 }; expect(decodeScanCache(JSON.parse(JSON.stringify(previous))).size).toBe(0); }); diff --git a/apps/server/src/usage/usageScanCache.ts b/apps/server/src/usage/usageScanCache.ts index 71ef25051eb6..79cca5cff8e2 100644 --- a/apps/server/src/usage/usageScanCache.ts +++ b/apps/server/src/usage/usageScanCache.ts @@ -23,7 +23,8 @@ import type { CodexScanState, UsageRecord } from "./usageTranscripts.ts"; // entries would keep serving double-counted records forever. // v3: entries carry the parse position and reducer state so a grown file // re-parses only its appended bytes instead of starting over. -const USAGE_SCAN_CACHE_VERSION = 3 as const; +// v4: records carry Claude fast mode, which v3 rows never captured. +const USAGE_SCAN_CACHE_VERSION = 4 as const; export interface CachedFile { readonly size: number; @@ -58,6 +59,7 @@ type SerializedRecord = readonly [ reasoningTokens: number, dedupeKey: string | null, reportedCostUsd: number | null, + fast: 0 | 1, ]; interface SerializedFile { @@ -109,6 +111,7 @@ export function encodeScanCache(cache: ScanCache): SerializedCache { record.totals.reasoningTokens, record.dedupeKey, record.reportedCostUsd, + record.fast ? 1 : 0, ]; const files: Record = {}; @@ -165,7 +168,7 @@ export function decodeScanCache(document: unknown): ScanCache { ): UsageRecord[] | null => { const records: UsageRecord[] = []; for (const row of rows) { - if (!isRecordArray(row) || row.length < 10) return null; + if (!isRecordArray(row) || row.length < 11) return null; const [ timestampMs, modelIndex, @@ -177,6 +180,7 @@ export function decodeScanCache(document: unknown): ScanCache { reasoning, dedupeKey, reportedCostUsd, + fast, ] = row as SerializedRecord; const model = typeof modelIndex === "number" ? models[modelIndex] : undefined; @@ -188,7 +192,8 @@ export function decodeScanCache(document: unknown): ScanCache { !Number.isFinite(cached) || !Number.isFinite(cacheCreation) || !Number.isFinite(output) || - !Number.isFinite(reasoning) + !Number.isFinite(reasoning) || + (fast !== 0 && fast !== 1) ) { return null; } @@ -206,6 +211,7 @@ export function decodeScanCache(document: unknown): ScanCache { reasoningTokens: reasoning, }, reportedCostUsd: typeof reportedCostUsd === "number" ? reportedCostUsd : null, + fast: fast === 1, dedupeKey: typeof dedupeKey === "string" ? dedupeKey : null, }); } diff --git a/apps/server/src/usage/usageTranscripts.test.ts b/apps/server/src/usage/usageTranscripts.test.ts index b09db613ed85..ace3b7d18cf7 100644 --- a/apps/server/src/usage/usageTranscripts.test.ts +++ b/apps/server/src/usage/usageTranscripts.test.ts @@ -15,6 +15,7 @@ function claudeLine(overrides: { contentType: string; model?: string; outputTokens?: number; + speed?: string; }): string { return JSON.stringify({ type: "assistant", @@ -31,6 +32,7 @@ function claudeLine(overrides: { cache_creation_input_tokens: 66818, cache_read_input_tokens: 1000, output_tokens: overrides.outputTokens ?? 286, + ...(overrides.speed === undefined ? {} : { speed: overrides.speed }), }, }, }); @@ -51,6 +53,15 @@ describe("parseClaudeLine", () => { reasoningTokens: 0, }); expect(record?.dedupeKey).toBe("msg_1:"); + expect(record?.fast).toBe(false); + }); + + it("marks fast-mode requests", () => { + const line = (speed: string) => + parseClaudeLine(claudeLine({ messageId: "msg_1", contentType: "text", speed })); + + expect(line("fast")?.fast).toBe(true); + expect(line("standard")?.fast).toBe(false); }); it("gives every content block of one message the same dedupe key", () => { diff --git a/apps/server/src/usage/usageTranscripts.ts b/apps/server/src/usage/usageTranscripts.ts index 5d909379eb10..5da13168a1af 100644 --- a/apps/server/src/usage/usageTranscripts.ts +++ b/apps/server/src/usage/usageTranscripts.ts @@ -15,6 +15,11 @@ export interface UsageRecord { readonly sessionId: string; readonly totals: UsageTokenTotals; readonly reportedCostUsd: number | null; + /** + * Whether the request ran in fast mode, which bills at a model-specific + * multiple of the standard rate. Only Claude Code records this. + */ + readonly fast: boolean; /** * Key for cross-file de-duplication, or `null` when the record is inherently * unique and needs no dedup. @@ -145,6 +150,7 @@ export function parseClaudeLine(line: string): UsageRecord | null { reasoningTokens: 0, }, reportedCostUsd: typeof cost === "number" && Number.isFinite(cost) ? cost : null, + fast: usageRecord["speed"] === "fast", dedupeKey, }; } @@ -304,6 +310,7 @@ export function parseCodexLine(line: string, state: CodexScanState): UsageRecord totals, // Codex does not report cost in the rollout. reportedCostUsd: null, + fast: false, // Events surviving the fork-copy suppression above are unique to this // rollout, so they need no global dedup. dedupeKey: null, @@ -433,6 +440,7 @@ export function parseGrokLine(line: string): readonly UsageRecord[] { sessionId, totals: grokTotalsToUsage(topLevel), reportedCostUsd: grokCostTicksToUsd(topLevel.costUsdTicks), + fast: false, // No prompt id means we cannot tell two same-second updates apart. dedupeKey: promptId === null ? null : `${sessionId}:${promptId}:grok`, }, @@ -479,6 +487,7 @@ export function parseGrokLine(line: string): readonly UsageRecord[] { sessionId, totals, reportedCostUsd, + fast: false, dedupeKey: promptId === null ? null : `${sessionId}:${promptId}:${entry.model}`, }); } From e55e7315e4a4c3870711acd6825ea5347c2d4812 Mon Sep 17 00:00:00 2001 From: aaditagrawal <103925638+aaditagrawal@users.noreply.github.com> Date: Fri, 25 Sep 2026 16:04:16 +0530 Subject: [PATCH 43/58] fix: update OpenAI logo to current brand asset (#13611) Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) --- apps/marketing/public/harnesses/openai_dark.svg | 4 +++- apps/mobile/src/components/ProviderIcon.tsx | 6 ++++-- apps/web/src/components/Icons.tsx | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/marketing/public/harnesses/openai_dark.svg b/apps/marketing/public/harnesses/openai_dark.svg index b78a51db7bc6..956f87c99f60 100644 --- a/apps/marketing/public/harnesses/openai_dark.svg +++ b/apps/marketing/public/harnesses/openai_dark.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/apps/mobile/src/components/ProviderIcon.tsx b/apps/mobile/src/components/ProviderIcon.tsx index 374738d0aeca..49de96a8d74c 100644 --- a/apps/mobile/src/components/ProviderIcon.tsx +++ b/apps/mobile/src/components/ProviderIcon.tsx @@ -75,10 +75,12 @@ export function ProviderIcon(props: ProviderIconProps) { // codex (and unknown drivers) return ( - + ); diff --git a/apps/web/src/components/Icons.tsx b/apps/web/src/components/Icons.tsx index 2a4463c11a06..df7ea7b1c95e 100644 --- a/apps/web/src/components/Icons.tsx +++ b/apps/web/src/components/Icons.tsx @@ -547,10 +547,14 @@ export const OpenAI: Icon = ({ className, ...props }) => ( - + ); From 1c1270663880903b16568594c4bf5f322407903a Mon Sep 17 00:00:00 2001 From: Dara Adedeji <76637177+SunkenInTime@users.noreply.github.com> Date: Fri, 25 Sep 2026 07:01:48 -0400 Subject: [PATCH 44/58] fix(mobile): render assigned project icons in chat list (#12810) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com> --- apps/mobile/src/components/ProjectFavicon.tsx | 69 +++++++++++++++- .../archive/ArchivedThreadsScreen.tsx | 1 + .../SettingsProjectOverviewRouteScreen.tsx | 3 +- .../features/threads/NewTaskRouteScreen.tsx | 2 + .../features/threads/thread-list-v2-items.tsx | 9 ++- apps/mobile/src/lib/projectIcon.ts | 81 +++++++++++++++++++ 6 files changed, 158 insertions(+), 7 deletions(-) create mode 100644 apps/mobile/src/lib/projectIcon.ts diff --git a/apps/mobile/src/components/ProjectFavicon.tsx b/apps/mobile/src/components/ProjectFavicon.tsx index e1d883a01026..83505730d808 100644 --- a/apps/mobile/src/components/ProjectFavicon.tsx +++ b/apps/mobile/src/components/ProjectFavicon.tsx @@ -1,8 +1,9 @@ import { SymbolView } from "./AppSymbol"; +import { AppText } from "./AppText"; import { Image } from "expo-image"; import { useLayoutEffect, useMemo, useState } from "react"; import { View } from "react-native"; -import type { EnvironmentId } from "@t3tools/contracts"; +import type { EnvironmentId, ProjectIconOverride } from "@t3tools/contracts"; import { getProjectFaviconCacheKey, getProjectFaviconResourceKey, @@ -11,6 +12,12 @@ import { import { useAtomValue } from "@effect/atom-react"; import { Atom } from "effect/unstable/reactivity"; import { projectFaviconUrlAtom } from "../state/assets"; +import { + countGlyphs, + projectIconColorClassNames, + resolveProjectIconGlyph, + type ProjectIconGlyph, +} from "../lib/projectIcon"; import { beginProjectFaviconRequest, @@ -30,10 +37,12 @@ export function ProjectFavicon(props: { readonly projectTitle: string; readonly workspaceRoot?: string | null; readonly faviconPath?: string | null; + readonly projectIcon?: ProjectIconOverride | null; }) { const size = props.size ?? 42; + const glyph = resolveProjectIconGlyph(props.projectIcon, props.projectTitle); const faviconUrl = useAtomValue( - props.workspaceRoot == null + props.workspaceRoot == null || glyph !== null ? EMPTY_FAVICON_URL : projectFaviconUrlAtom({ environmentId: props.environmentId, @@ -51,6 +60,10 @@ export function ProjectFavicon(props: { : getProjectFaviconCacheKey(props.environmentId, props.workspaceRoot, renderableFaviconUrl) : null; + if (glyph !== null) { + return ; + } + return ( + + {glyph.emoji} + + + ); + } + + const colors = projectIconColorClassNames(glyph.color); + return ( + + + {glyph.text} + + + ); +} + function ProjectFaviconImage(props: { readonly cacheKey: string | null; readonly faviconUrl: string | null; @@ -105,7 +168,7 @@ function ProjectFaviconImage(props: { {!showImage ? ( diff --git a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx index ea150180393c..b786f9f4066c 100644 --- a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx +++ b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx @@ -151,6 +151,7 @@ function ProjectGroupLabel(props: { diff --git a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx index f74542076be2..27a9b3217c7e 100644 --- a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx +++ b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx @@ -333,6 +333,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps ) : null} @@ -890,8 +891,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { ) : null} @@ -1124,8 +1126,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { diff --git a/apps/mobile/src/lib/projectIcon.ts b/apps/mobile/src/lib/projectIcon.ts new file mode 100644 index 000000000000..885c583aa543 --- /dev/null +++ b/apps/mobile/src/lib/projectIcon.ts @@ -0,0 +1,81 @@ +import type { ProjectIconColor, ProjectIconOverride } from "@t3tools/contracts"; + +export type ProjectIconGlyph = + | { readonly kind: "emoji"; readonly emoji: string } + | { readonly kind: "monogram"; readonly text: string; readonly color: ProjectIconColor }; + +/** + * Visible glyph count for sizing monogram text. Hermes has no Intl.Segmenter, so combining + * marks are folded into their base character instead of full grapheme segmentation. + */ +export function countGlyphs(text: string): number { + return Array.from(text.replace(/\p{M}/gu, "")).length; +} + +/** Mirrors the automatic monogram web derives from a project name when it has no favicon. */ +export function projectMonogram(projectName: string): string { + const words = + projectName + .normalize("NFKC") + .trim() + .match(/[\p{L}\p{N}]+/gu) ?? []; + const firstWord = words[0]; + if (!firstWord) return "PR"; + + const glyphs = Array.from(firstWord); + const first = glyphs[0] ?? "P"; + const second = + glyphs.slice(1).find((glyph) => /\p{N}/u.test(glyph)) ?? + (words.length > 1 ? Array.from(words.at(-1) ?? "")[0] : glyphs.at(-1)) ?? + first; + return Array.from(`${first}${second}`.toUpperCase()).slice(0, 2).join(""); +} + +/** + * Picks what mobile draws for an assigned project icon. Mobile does not bundle + * the Lucide set, so a Lucide override keeps its color and falls back to the + * project's monogram instead of the folder glyph. + */ +export function resolveProjectIconGlyph( + projectIcon: ProjectIconOverride | null | undefined, + projectTitle: string, +): ProjectIconGlyph | null { + switch (projectIcon?.kind) { + case "emoji": + return { kind: "emoji", emoji: projectIcon.emoji }; + case "monogram": + return { kind: "monogram", text: projectIcon.text, color: projectIcon.color }; + case "lucide": + return { kind: "monogram", text: projectMonogram(projectTitle), color: projectIcon.color }; + case undefined: + return null; + } +} + +const PROJECT_ICON_COLOR_CLASSES: Record< + ProjectIconColor, + { readonly text: string; readonly background: string } +> = { + gray: { text: "text-gray-500", background: "bg-gray-500/15" }, + red: { text: "text-red-500", background: "bg-red-500/15" }, + orange: { text: "text-orange-500", background: "bg-orange-500/15" }, + amber: { text: "text-amber-500", background: "bg-amber-500/15" }, + yellow: { text: "text-yellow-500", background: "bg-yellow-500/15" }, + lime: { text: "text-lime-500", background: "bg-lime-500/15" }, + green: { text: "text-green-500", background: "bg-green-500/15" }, + emerald: { text: "text-emerald-500", background: "bg-emerald-500/15" }, + teal: { text: "text-teal-500", background: "bg-teal-500/15" }, + cyan: { text: "text-cyan-500", background: "bg-cyan-500/15" }, + sky: { text: "text-sky-500", background: "bg-sky-500/15" }, + blue: { text: "text-blue-500", background: "bg-blue-500/15" }, + indigo: { text: "text-indigo-500", background: "bg-indigo-500/15" }, + violet: { text: "text-violet-500", background: "bg-violet-500/15" }, + purple: { text: "text-purple-500", background: "bg-purple-500/15" }, + fuchsia: { text: "text-fuchsia-500", background: "bg-fuchsia-500/15" }, + pink: { text: "text-pink-500", background: "bg-pink-500/15" }, + rose: { text: "text-rose-500", background: "bg-rose-500/15" }, +}; + +export function projectIconColorClassNames(color: ProjectIconColor) { + return PROJECT_ICON_COLOR_CLASSES[color]; +} From e5a46d6c5d00b89afba5274a94d42428c8d79763 Mon Sep 17 00:00:00 2001 From: maria Date: Fri, 25 Sep 2026 08:26:36 -0300 Subject: [PATCH 45/58] feat(usage): read cursor, opencode, and antigravity history (#10409) Co-authored-by: Yash Singh --- .../src/features/usage/UsageLimitsPooled.tsx | 73 ++- .../src/features/usage/UsageLimitsSection.tsx | 11 +- .../src/features/usage/UsageRouteScreen.tsx | 190 +++++- .../src/features/usage/usageProviders.ts | 15 +- apps/server/package.json | 1 + .../src/provider/Drivers/CursorDriver.ts | 12 +- .../provider/Layers/CursorProvider.test.ts | 79 ++- .../src/provider/Layers/cursorUsageLimits.ts | 51 +- .../provider/cursorCredentialStore.test.ts | 22 + .../src/provider/cursorCredentialStore.ts | 29 + apps/server/src/usage/UsageService.test.ts | 213 ++++++- apps/server/src/usage/UsageService.ts | 212 ++++++- .../src/usage/antigravityUsageReader.ts | 374 ++++++++++++ apps/server/src/usage/cursorUsageReader.ts | 254 ++++++++ apps/server/src/usage/opencodeUsageReader.ts | 188 ++++++ apps/server/src/usage/usageAggregation.ts | 8 +- .../src/usage/usageTranscriptReader.test.ts | 554 ++++++++++++++++++ .../settings/ProviderSettingsPanel.tsx | 21 + .../settings/SettingsSidebarNav.tsx | 2 +- .../settings/UsageProviderSettings.tsx | 47 +- .../settings/settingsSearch.test.ts | 25 + .../src/components/settings/settingsSearch.ts | 11 + .../useAvailableSettingsSearchItems.ts | 14 +- apps/web/src/components/usage/UsageLimits.tsx | 6 +- .../components/usage/UsageLimitsPooled.tsx | 65 +- apps/web/src/components/usage/UsagePage.tsx | 205 ++++++- .../usage/UsageProviderChart.test.ts | 3 + .../src/components/usage/usageProviders.ts | 13 +- docs/user/usage.md | 22 +- packages/client-runtime/src/state/server.ts | 10 +- .../client-runtime/src/state/usage.test.ts | 13 + packages/client-runtime/src/state/usage.ts | 9 + packages/contracts/src/settings.ts | 5 + packages/contracts/src/usage.ts | 29 +- packages/shared/src/usageFormat.test.ts | 12 + packages/shared/src/usageFormat.ts | 5 +- packages/shared/src/usageLimits.test.ts | 48 ++ packages/shared/src/usageLimits.ts | 38 ++ packages/shared/src/usageMerge.test.ts | 161 ++++- packages/shared/src/usageMerge.ts | 121 +++- pnpm-lock.yaml | 3 + scripts/lib/cli-external-packages.test.ts | 3 +- scripts/lib/cli-external-packages.ts | 1 + 43 files changed, 3049 insertions(+), 129 deletions(-) create mode 100644 apps/server/src/provider/cursorCredentialStore.test.ts create mode 100644 apps/server/src/provider/cursorCredentialStore.ts create mode 100644 apps/server/src/usage/antigravityUsageReader.ts create mode 100644 apps/server/src/usage/cursorUsageReader.ts create mode 100644 apps/server/src/usage/opencodeUsageReader.ts diff --git a/apps/mobile/src/features/usage/UsageLimitsPooled.tsx b/apps/mobile/src/features/usage/UsageLimitsPooled.tsx index 4e3e7339765c..0bcc0cd74958 100644 --- a/apps/mobile/src/features/usage/UsageLimitsPooled.tsx +++ b/apps/mobile/src/features/usage/UsageLimitsPooled.tsx @@ -5,13 +5,15 @@ import { collectLimitAccounts, collectLimitNotices, collectLimitPools, + cursorUsageWindowDetails, + displayLimitWindows, formatDuration, formatResetsIn, remainingPercent, type LimitAccount, type LimitPoolWindow, } from "@t3tools/shared/usageLimits"; -import { useId, useState } from "react"; +import { Fragment, type ReactNode, useId, useState } from "react"; import { Pressable, ScrollView, View } from "react-native"; import { Defs, Path, Pattern, Rect, Svg } from "react-native-svg"; import { useSafeAreaInsets } from "react-native-safe-area-context"; @@ -70,11 +72,15 @@ function PoolWindowCard({ color, now, environmentIds, + label, + description, }: { readonly pool: LimitPoolWindow; readonly color: string; readonly now: number; readonly environmentIds: readonly string[] | null; + readonly label?: string; + readonly description?: string; }) { const navigation = useNavigation(); const nextRefill = pool.resets.find((reset) => reset.restoresPercent > 0); @@ -96,7 +102,7 @@ function PoolWindowCard({ - {pool.label} + {label ?? pool.label} {pool.remainingPercent}% @@ -108,6 +114,7 @@ function PoolWindowCard({ {PACE_LABEL[pool.pace]} ) : null} + {description ? {description} : null} {nextRefill ? ( ↻ +{nextRefill.restoresPercent}%{" "} @@ -196,10 +203,12 @@ export function UsageLimitsSection({ now, failedLabels, selectedEnvironmentIds, + cursorPrompt, }: { readonly now: number; readonly failedLabels: readonly string[]; readonly selectedEnvironmentIds: ReadonlySet | null; + readonly cursorPrompt?: ReactNode; }) { const presentations = useAtomValue(environmentPresentations.presentationsAtom); const selected = @@ -209,34 +218,54 @@ export function UsageLimitsSection({ const pools = collectLimitPools(collectLimitAccounts(selected), now); const notices = collectLimitNotices(selected); const colors = useProviderColors(); + const cursorPromptAt = + Math.max( + pools.findIndex((pool) => pool.driver === "codex"), + pools.findIndex((pool) => pool.driver === "claudeAgent"), + ) + 1; return ( - {pools.length === 0 && notices.length === 0 && failedLabels.length === 0 ? ( + {pools.length === 0 && notices.length === 0 && failedLabels.length === 0 && !cursorPrompt ? ( {selected.size === 0 ? "Select an environment to see limits." : "No provider on the selected environments reports subscription limits."} ) : null} - {pools.map((pool) => ( - - - - - {DRIVER_LABEL[pool.driver] ?? pool.driver} - - - {pool.windows.map((window) => ( - - ))} - - ))} + {pools.map((pool, index) => { + const windows = displayLimitWindows(pool); + return ( + + {index === cursorPromptAt ? cursorPrompt : null} + + + + + {DRIVER_LABEL[pool.driver] ?? pool.driver} + + + {windows.map((window) => { + const details = + pool.driver === "cursor" ? cursorUsageWindowDetails(window.id) : undefined; + return ( + + ); + })} + + + ); + })} + {cursorPromptAt === pools.length ? cursorPrompt : null} {notices.length > 0 || failedLabels.length > 0 ? ( ([]); - const refresh = async (automatic = false) => { + const refresh = async (automatic = false, afterPending = false) => { const connected = [...presentations].filter( ([environmentId, presentation]) => presentation.connection.phase === "connected" && @@ -307,6 +307,7 @@ export function useRefreshLimits( environmentId, () => refreshProviders({ environmentId, input: {} }), automatic, + afterPending, ); if (result === undefined) return; setFailedEnvironments((previous) => [ @@ -354,5 +355,11 @@ export function useRefreshLimits( selectedEnvironmentIds === null || selectedEnvironmentIds.has(environmentId), ) .map(({ label }) => label); - return { now, refreshing, failedLabels, refresh: refreshManually }; + return { + now, + refreshing, + failedLabels, + refresh: refreshManually, + refreshAfterEnable: () => refresh(false, true), + }; } diff --git a/apps/mobile/src/features/usage/UsageRouteScreen.tsx b/apps/mobile/src/features/usage/UsageRouteScreen.tsx index 7494ac9b34bd..2d5e5398bc51 100644 --- a/apps/mobile/src/features/usage/UsageRouteScreen.tsx +++ b/apps/mobile/src/features/usage/UsageRouteScreen.tsx @@ -25,9 +25,12 @@ import { useSafeAreaInsets } from "react-native-safe-area-context"; import { SegmentedControl } from "../../components/SegmentedControl"; import { AppText as Text } from "../../components/AppText"; +import { ProviderIcon } from "../../components/ProviderIcon"; import { cn } from "../../lib/cn"; import { SettingsScreen } from "../settings/components/SettingsScreen"; import { useUsage, type EnvironmentUsageStatus } from "../../state/usage"; +import { serverEnvironment } from "../../state/server"; +import { useAtomCommand } from "../../state/use-atom-command"; import { SettingsSection } from "../settings/components/SettingsSection"; import { UsageDailyChart } from "./UsageDailyChart"; import { toggleUsageEnvironment } from "./usageEnvironmentSelection"; @@ -59,6 +62,7 @@ const METRIC_OPTIONS = [ ] as const satisfies readonly { value: UsageChartMetric; label: string }[]; const CHART_HEIGHT = 180; +const CURSOR_KEYCHAIN_COPY = "Requires access to your Cursor login in macOS Keychain."; /** * Two tabs over one screen. Usage is the transcript-derived spend for a @@ -97,6 +101,29 @@ export function UsageRouteScreen() { ); const isFocused = useIsFocused(); const limits = useRefreshLimits(selectedEnvironmentIds, isFocused && tab === "limits"); + const cursorAccessEnvironments = selectedEnvironments.filter((environment) => + environment.summary?.sources.some((source) => source.action === "enableCursorKeychain"), + ); + const refreshAfterCursorEnable = () => { + void refresh(); + void limits.refreshAfterEnable(); + }; + const sourceMessages = [ + ...new Set( + selectedEnvironments.flatMap( + (environment) => + environment.summary?.sources.flatMap((source) => + source.message && + !source.action && + (source.status === "partial" || + source.status === "failed" || + source.fingerprint.provider === "cursor") + ? [source.message] + : [], + ) ?? [], + ), + ), + ]; const days = useMemo( () => enumerateDays(window.sinceDay, window.untilDay), @@ -251,7 +278,6 @@ export function UsageRouteScreen() { } > - 0 ? ( + + ) : null + } /> ) : ( <> @@ -301,6 +335,11 @@ export function UsageRouteScreen() { ) : ( <> + {sourceMessages.map((message) => ( + + {message} + + ))} - + 1} + onCursorEnabled={refreshAfterCursorEnable} + /> @@ -324,6 +369,110 @@ export function UsageRouteScreen() { ); } +function CursorEnableAction({ + environmentId, + label, + onEnabled, + buttonText = "Enable", +}: { + readonly environmentId: EnvironmentId; + readonly label: string; + readonly onEnabled: () => void; + readonly buttonText?: string; +}) { + const updateSettings = useAtomCommand(serverEnvironment.updateSettings, { + label: "enable Cursor account usage", + }); + const [pending, setPending] = useState(false); + const enable = async () => { + setPending(true); + try { + const result = await updateSettings({ + environmentId, + input: { patch: { cursorKeychainUsageEnabled: true } }, + }); + if (result._tag === "Success") onEnabled(); + } finally { + setPending(false); + } + }; + return ( + void enable()} + className="rounded-full bg-primary px-4 py-2" + > + {buttonText} + + ); +} + +function CursorEnableRow({ + environmentId, + label, + showEnvironment, + bordered, + onEnabled, +}: { + readonly environmentId: EnvironmentId; + readonly label: string; + readonly showEnvironment: boolean; + readonly bordered: boolean; + readonly onEnabled: () => void; +}) { + const colors = useProviderColors(); + return ( + + + + + Cursor{showEnvironment ? ` · ${label}` : ""} + + + + + ); +} + +function CursorEnableLimits({ + environments, + onEnabled, +}: { + readonly environments: readonly EnvironmentUsageStatus[]; + readonly onEnabled: () => void; +}) { + return ( + + + + Cursor + + + {CURSOR_KEYCHAIN_COPY} + + {environments.map((environment) => ( + 1 ? `Enable on ${environment.label}` : "Enable"} + onEnabled={onEnabled} + /> + ))} + + + + ); +} + /** Headline figure, the animated daily chart, and its legend, in one card. */ function ChartCard(props: { readonly merged: MergedUsage; @@ -400,20 +549,53 @@ function ChartCard(props: { function ProviderSection(props: { readonly merged: MergedUsage; readonly metric: UsageChartMetric; + readonly cursorAccessEnvironments: readonly EnvironmentUsageStatus[]; + readonly showCursorEnvironment: boolean; + readonly onCursorEnabled: () => void; }) { const { merged, metric } = props; const colors = useProviderColors(); - if (merged.providers.length === 0) return null; + if (merged.providers.length === 0 && props.cursorAccessEnvironments.length === 0) return null; // Ranked by whatever the toggle is showing, so the rows always descend. // .sort() on a copy, not .toSorted(): Hermes doesn't ship the ES2023 method. const ordered = [...merged.providers].sort((a, b) => metric === "cost" ? b.costUsd - a.costUsd : b.totalTokens - a.totalTokens, ); + const rows: Array< + | { readonly kind: "usage"; readonly provider: (typeof ordered)[number] } + | { readonly kind: "enable"; readonly environment: EnvironmentUsageStatus } + > = ordered.map((provider) => ({ kind: "usage", provider })); + const cursorInsertAt = + Math.max( + ordered.findIndex((provider) => provider.provider === "codex"), + ordered.findIndex((provider) => provider.provider === "claude"), + ) + 1; + rows.splice( + cursorInsertAt, + 0, + ...props.cursorAccessEnvironments.map((environment) => ({ + kind: "enable" as const, + environment, + })), + ); return ( - {ordered.map((provider, index) => { + {rows.map((row, index) => { + if (row.kind === "enable") { + return ( + 0} + onEnabled={props.onCursorEnabled} + /> + ); + } + const provider = row.provider; const share = metric === "cost" ? provider.costShare : provider.tokenShare; return ( = { claude: "Claude Code", codex: "Codex", grok: "Grok Build", + cursor: "Cursor", + opencode: "OpenCode", + antigravity: "Antigravity", }; /** @@ -23,5 +33,8 @@ export function useProviderColors(): Record { claude: "#d97757", codex: scheme === "dark" ? "#e6e6e6" : "#3c3c43", grok: scheme === "dark" ? "#a1a1aa" : "#52525b", + cursor: "#8b8b8b", + opencode: "#5b9bbd", + antigravity: "#8c7bd1", }; } diff --git a/apps/server/package.json b/apps/server/package.json index b7f1bce88768..afa2ca18fdfc 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -27,6 +27,7 @@ "@effect/platform-node": "catalog:", "@effect/platform-node-shared": "catalog:", "@ff-labs/fff-node": "0.9.4", + "@napi-rs/keyring": "^1.3.0", "@opencode-ai/sdk": "^1.3.15", "diff": "8.0.3", "effect": "catalog:", diff --git a/apps/server/src/provider/Drivers/CursorDriver.ts b/apps/server/src/provider/Drivers/CursorDriver.ts index d2ad661b4af4..521c1b943e84 100644 --- a/apps/server/src/provider/Drivers/CursorDriver.ts +++ b/apps/server/src/provider/Drivers/CursorDriver.ts @@ -148,9 +148,15 @@ export const CursorDriver: ProviderDriver = { snapshot.auth.status === "authenticated" ), (snapshot) => - readCursorUsageLimits(effectiveConfig, processEnv).pipe( - Effect.map((usageLimits) => ({ ...snapshot, usageLimits })), - ), + Effect.gen(function* () { + const settings = yield* serverSettings.getSettings; + const usageLimits = yield* readCursorUsageLimits( + effectiveConfig, + processEnv, + settings.cursorKeychainUsageEnabled, + ); + return { ...snapshot, usageLimits }; + }), ), Effect.map(stampIdentity), Effect.provideService(HttpClient.HttpClient, httpClient), diff --git a/apps/server/src/provider/Layers/CursorProvider.test.ts b/apps/server/src/provider/Layers/CursorProvider.test.ts index 47826fcc8704..aa5207f3aef2 100644 --- a/apps/server/src/provider/Layers/CursorProvider.test.ts +++ b/apps/server/src/provider/Layers/CursorProvider.test.ts @@ -991,21 +991,21 @@ describe("Cursor usage limits", () => { { id: "totalPercentUsed", kind: "monthly", - label: "Monthly", + label: "Overall", usedPercent: 72.4, resetsAt: "2026-09-20T03:53:06.000Z", }, { id: "autoPercentUsed", kind: "monthly", - label: "Monthly · Auto", + label: "Cursor Models", usedPercent: 69.5, resetsAt: "2026-09-20T03:53:06.000Z", }, { id: "apiPercentUsed", kind: "monthly", - label: "Monthly · API", + label: "Other Models", usedPercent: 100, resetsAt: "2026-09-20T03:53:06.000Z", }, @@ -1019,10 +1019,10 @@ describe("Cursor usage limits", () => { ); expect( cursorUsageResponseToLimits({ planUsage: { totalPercentUsed: 0 } }, checkedAt).windows, - ).toEqual([{ id: "totalPercentUsed", kind: "monthly", label: "Monthly", usedPercent: 0 }]); + ).toEqual([{ id: "totalPercentUsed", kind: "monthly", label: "Overall", usedPercent: 0 }]); expect( cursorUsageResponseToLimits({ planUsage: { totalPercentUsed: 150 } }, checkedAt).windows, - ).toEqual([{ id: "totalPercentUsed", kind: "monthly", label: "Monthly", usedPercent: 100 }]); + ).toEqual([{ id: "totalPercentUsed", kind: "monthly", label: "Overall", usedPercent: 100 }]); }); it("reads the instance's credentials and endpoint even when usage enabled is false", async () => { @@ -1079,6 +1079,10 @@ describe("Cursor usage limits", () => { AGENT_CLI_CREDENTIAL_STORE: platform === "linux" ? "memory" : "default", ...(token ? { CURSOR_AUTH_TOKEN: token } : {}), }, + false, + async () => { + throw new Error("must not read Keychain before opt-in"); + }, ).pipe( Effect.provideService(HostProcessPlatform, platform), Effect.provideService( @@ -1108,6 +1112,71 @@ describe("Cursor usage limits", () => { } }); + it("reads the default macOS Cursor login from Keychain for limits", async () => { + const limits = await runNode( + readCursorUsageLimits({ apiEndpoint: "" }, {}, true, async () => "keychain-token").pipe( + Effect.provideService(HostProcessPlatform, "darwin"), + Effect.provideService( + FileSystem.FileSystem, + FileSystem.makeNoop({ + readFileString: () => Effect.die("must not read a stale credential file"), + }), + ), + Effect.provideService( + HttpClient.HttpClient, + HttpClient.make((request) => { + expect(request.headers.authorization).toBe("Bearer keychain-token"); + return Effect.succeed( + HttpClientResponse.fromWeb( + request, + Response.json({ planUsage: { totalPercentUsed: 42 } }), + ), + ); + }), + ), + ), + ); + expect(limits.windows[0]?.usedPercent).toBe(42); + }); + + it("reports a Keychain initialization failure without failing the provider refresh", async () => { + const limits = await runNode( + readCursorUsageLimits({ apiEndpoint: "" }, {}, true, async () => { + throw new Error("Keychain initialization failed"); + }).pipe( + Effect.provideService(HostProcessPlatform, "darwin"), + Effect.provideService( + HttpClient.HttpClient, + HttpClient.make(() => Effect.die("must not request limits without a login")), + ), + ), + ); + expect(limits.unavailable?.reason).toBe("probeFailed"); + }); + + it("does not read Keychain or send its token to a custom endpoint", async () => { + for (const [apiEndpoint, environment] of [ + ["http://localhost:3000", {}], + ["", { CURSOR_API_ENDPOINT: "http://localhost:3000" }], + ["https://cursor-proxy.example", {}], + ["", { CURSOR_API_ENDPOINT: "https://cursor-proxy.example" }], + ] as const) { + const limits = await runNode( + readCursorUsageLimits({ apiEndpoint }, environment, true, async () => { + throw new Error("must not read Keychain for a custom endpoint"); + }).pipe( + Effect.provideService(HostProcessPlatform, "darwin"), + Effect.provideService( + HttpClient.HttpClient, + HttpClient.make(() => Effect.die("must not send a Keychain credential to a proxy")), + ), + ), + ); + expect(limits.unavailable?.reason).toBe("unsupported"); + expect(limits.unavailable?.message).toContain("default Cursor endpoint"); + } + }); + it("reports failed requests without exposing credentials or response bodies", async () => { const limits = await runNode( readCursorUsageLimits({ apiEndpoint: "" }, { CURSOR_AUTH_TOKEN: "private-token" }).pipe( diff --git a/apps/server/src/provider/Layers/cursorUsageLimits.ts b/apps/server/src/provider/Layers/cursorUsageLimits.ts index 2fbaec59adb0..e0611e0c50ab 100644 --- a/apps/server/src/provider/Layers/cursorUsageLimits.ts +++ b/apps/server/src/provider/Layers/cursorUsageLimits.ts @@ -1,6 +1,7 @@ import * as NodeOS from "node:os"; import type { CursorSettings, ServerProviderUsageWindow } from "@t3tools/contracts"; import { HostProcessPlatform } from "@t3tools/shared/hostProcess"; +import { CURSOR_USAGE_WINDOWS } from "@t3tools/shared/usageLimits"; import * as DateTime from "effect/DateTime"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; @@ -13,8 +14,10 @@ import { makeUnavailableUsageLimits, makeUsageLimits, } from "../providerUsageLimits.ts"; +import { readMacCursorAccessToken } from "../cursorCredentialStore.ts"; const CursorCredentials = Schema.Struct({ accessToken: Schema.optional(Schema.String) }); +const DEFAULT_CURSOR_API_ENDPOINT = "https://api2.cursor.sh"; const decodeCredentials = Schema.decodeEffect(Schema.fromJsonString(CursorCredentials)); const CursorUsageResponse = Schema.Struct({ billingCycleEnd: Schema.optional(Schema.Union([Schema.String, Schema.Number])), @@ -39,15 +42,11 @@ export function cursorUsageResponseToLimits( : undefined; const windows: ServerProviderUsageWindow[] = []; if (response.planUsage) { - for (const [key, label] of [ - ["totalPercentUsed", "Monthly"], - ["autoPercentUsed", "Monthly · Auto"], - ["apiPercentUsed", "Monthly · API"], - ] as const) { - const usedPercent = response.planUsage[key]; + for (const { id, label } of CURSOR_USAGE_WINDOWS) { + const usedPercent = response.planUsage[id]; if (usedPercent === undefined || !Number.isFinite(usedPercent)) continue; windows.push({ - id: key, + id, kind: "monthly", label, usedPercent: clampPercent(usedPercent), @@ -63,30 +62,49 @@ export function cursorUsageResponseToLimits( export const readCursorUsageLimits = Effect.fn("readCursorUsageLimits")(function* ( settings: Pick, environment: NodeJS.ProcessEnv = process.env, + allowKeychain = false, + keychainToken: () => Promise = readMacCursorAccessToken, ) { const checkedAt = DateTime.formatIso(yield* DateTime.now); return yield* Effect.gen(function* () { const fs = yield* FileSystem.FileSystem; const path = yield* Path.Path; const platform = yield* HostProcessPlatform; + const endpoint = ( + settings.apiEndpoint.trim() || + environment.CURSOR_API_ENDPOINT?.trim() || + DEFAULT_CURSOR_API_ENDPOINT + ).replace(/\/$/, ""); let token = environment.CURSOR_AUTH_TOKEN?.trim(); // An explicit API key can name a different account from the stored login. if (!token && environment.CURSOR_API_KEY?.trim()) { return makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" }); } const credentialStore = environment.AGENT_CLI_CREDENTIAL_STORE; - if ( - !token && - (credentialStore === "memory" || (platform === "darwin" && credentialStore !== "file")) - ) { - // Cursor's default macOS login lives in the keychain; a leftover file may be another account. + if (!token && credentialStore === "memory") { return makeUnavailableUsageLimits({ checkedAt, reason: "unsupported", - message: "Cursor usage requires a file-based login or CURSOR_AUTH_TOKEN.", + message: "Cursor usage requires a CLI login or CURSOR_AUTH_TOKEN.", }); } - if (!token) { + if (!token && platform === "darwin" && credentialStore !== "file") { + if (!allowKeychain) { + return makeUnavailableUsageLimits({ + checkedAt, + reason: "unsupported", + message: "Enable Cursor account usage in T3 Code to read its Keychain login.", + }); + } + if (endpoint !== DEFAULT_CURSOR_API_ENDPOINT) { + return makeUnavailableUsageLimits({ + checkedAt, + reason: "unsupported", + message: "Cursor account usage requires the default Cursor endpoint when using Keychain.", + }); + } + token = (yield* Effect.tryPromise(keychainToken))?.trim(); + } else if (!token) { const home = (platform === "win32" ? environment.USERPROFILE : environment.HOME) || NodeOS.homedir(); const directory = @@ -106,11 +124,6 @@ export const readCursorUsageLimits = Effect.fn("readCursorUsageLimits")(function } if (!token) return makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" }); const client = yield* HttpClient.HttpClient; - const endpoint = ( - settings.apiEndpoint.trim() || - environment.CURSOR_API_ENDPOINT?.trim() || - "https://api2.cursor.sh" - ).replace(/\/$/, ""); const response = yield* client.execute( HttpClientRequest.post(`${endpoint}/aiserver.v1.DashboardService/GetCurrentPeriodUsage`).pipe( HttpClientRequest.bearerToken(token), diff --git a/apps/server/src/provider/cursorCredentialStore.test.ts b/apps/server/src/provider/cursorCredentialStore.test.ts new file mode 100644 index 000000000000..051cb5425c69 --- /dev/null +++ b/apps/server/src/provider/cursorCredentialStore.test.ts @@ -0,0 +1,22 @@ +import { assert, describe, it } from "@effect/vitest"; + +import { makeCachedCursorAccessTokenReader } from "./cursorCredentialStore.ts"; + +describe("Cursor Keychain reader", () => { + it("shares concurrent reads and rechecks after the cache expires", async () => { + let reads = 0; + let time = 0; + const read = makeCachedCursorAccessTokenReader( + async () => { + reads++; + return `token-${reads}`; + }, + () => time, + ); + assert.deepStrictEqual(await Promise.all([read(), read()]), ["token-1", "token-1"]); + assert.strictEqual(await read(), "token-1"); + assert.strictEqual(reads, 1); + time = 5 * 60_000; + assert.strictEqual(await read(), "token-2"); + }); +}); diff --git a/apps/server/src/provider/cursorCredentialStore.ts b/apps/server/src/provider/cursorCredentialStore.ts new file mode 100644 index 000000000000..c071e2a88578 --- /dev/null +++ b/apps/server/src/provider/cursorCredentialStore.ts @@ -0,0 +1,29 @@ +const CACHE_MS = 5 * 60_000; + +/** Share one Keychain request across usage history and limits in this server process. */ +export function makeCachedCursorAccessTokenReader( + read: () => Promise, + now: () => number = Date.now, +): () => Promise { + let cached: { token: string; until: number } | null = null; + let pending: Promise | null = null; + return () => { + if (cached && cached.until > now()) return Promise.resolve(cached.token); + if (pending) return pending; + pending = read() + .then((token) => { + cached = token ? { token, until: now() + CACHE_MS } : null; + return token; + }) + .finally(() => { + pending = null; + }); + return pending; + }; +} + +/** Read the Cursor CLI's default macOS credential without invoking the shared security binary. */ +export const readMacCursorAccessToken = makeCachedCursorAccessTokenReader(async () => { + const { AsyncEntry } = await import("@napi-rs/keyring"); + return (await new AsyncEntry("cursor-access-token", "cursor-user").getPassword()) ?? null; +}); diff --git a/apps/server/src/usage/UsageService.test.ts b/apps/server/src/usage/UsageService.test.ts index b391e213ab9a..a80a31f48ae6 100644 --- a/apps/server/src/usage/UsageService.test.ts +++ b/apps/server/src/usage/UsageService.test.ts @@ -3,10 +3,11 @@ import * as NodeFSP from "node:fs/promises"; import * as NodeOS from "node:os"; import * as NodePath from "node:path"; +import * as NodeSqlite from "node:sqlite"; import { assert, describe, it } from "@effect/vitest"; import * as NodeServices from "@effect/platform-node/NodeServices"; -import { HostProcessEnvironment } from "@t3tools/shared/hostProcess"; +import { HostProcessEnvironment, HostProcessPlatform } from "@t3tools/shared/hostProcess"; import { mergeUsage } from "@t3tools/shared/usageMerge"; import { EnvironmentId, @@ -31,6 +32,7 @@ import * as ServerConfig from "../config.ts"; import * as ServerSettings from "../serverSettings.ts"; import * as UsageService from "./UsageService.ts"; +const encodeUnknownJson = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown)); const encodeUnknownJsonString = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown)); function claudeLine(id: number, outputTokens: number, model = "claude-fable-5"): string { @@ -82,9 +84,11 @@ const serviceLayers = (input: { /** Defaults to an unparsable document so every scan retries the fetch. */ readonly ratesDocument?: unknown; readonly environment?: NodeJS.ProcessEnv; + readonly platform?: NodeJS.Platform; }) => ServerConfig.layerTest(process.cwd(), { prefix: input.prefix }).pipe( Layer.provideMerge(NodeServices.layer), + Layer.provideMerge(Layer.succeed(HostProcessPlatform, input.platform ?? "linux")), Layer.provideMerge(ServerSettings.layerTest(input.settings)), Layer.provideMerge( Layer.succeed( @@ -101,7 +105,12 @@ const serviceLayers = (input: { ), Layer.provideMerge( Layer.succeed(HostProcessEnvironment, { + HOME: input.home, GROK_HOME: NodePath.join(input.home, "grok"), + OPENCODE_DATA_DIR: NodePath.join(input.home, "opencode"), + ANTIGRAVITY_DATA_DIR: NodePath.join(input.home, "antigravity"), + XDG_CONFIG_HOME: NodePath.join(input.home, "config"), + APPDATA: NodePath.join(input.home, "config"), ...input.environment, }), ), @@ -112,6 +121,193 @@ function totalOutputTokens(summary: { buckets: readonly { totals: { outputTokens } describe("UsageService", () => { + it.live("does not read the macOS Cursor Keychain before account usage is enabled", () => + Effect.gen(function* () { + const { settings, home } = yield* setup; + const service = yield* UsageService.make.pipe( + Effect.provide( + serviceLayers({ + prefix: "usage-service-cursor-keychain-disabled", + home, + settings, + platform: "darwin", + environment: {}, + }), + ), + ); + const summary = yield* service.readSummary(WINDOW); + const cursor = summary.sources.find((source) => source.fingerprint.provider === "cursor"); + assert.strictEqual(cursor?.status, "missing"); + assert.strictEqual(cursor?.action, "enableCursorKeychain"); + }).pipe(Effect.scoped), + ); + + it.live("ignores stale Cursor file logins when the active credential store differs", () => + Effect.gen(function* () { + const { settings, home } = yield* setup; + for (const [index, testCase] of [ + { + platform: "darwin" as const, + environment: { AGENT_CLI_CREDENTIAL_STORE: "memory" }, + authPath: [".cursor", "auth.json"], + }, + { + platform: "linux" as const, + environment: { AGENT_CLI_CREDENTIAL_STORE: "memory" }, + authPath: ["config", "cursor", "auth.json"], + }, + { + platform: "linux" as const, + environment: { CURSOR_API_KEY: "different-account" }, + authPath: ["config", "cursor", "auth.json"], + }, + ].entries()) { + const authPath = NodePath.join(home, ...testCase.authPath); + yield* Effect.promise(async () => { + await NodeFSP.mkdir(NodePath.dirname(authPath), { recursive: true }); + await NodeFSP.writeFile( + authPath, + encodeUnknownJsonString({ accessToken: "stale-token" }), + ); + }); + const service = yield* UsageService.make.pipe( + Effect.provide( + serviceLayers({ + prefix: `usage-service-cursor-store-${index}`, + home, + settings, + platform: testCase.platform, + environment: testCase.environment, + }), + ), + ); + const summary = yield* service.readSummary(WINDOW); + const cursor = summary.sources.find((source) => source.fingerprint.provider === "cursor"); + assert.strictEqual(cursor?.status, "missing"); + assert.include(cursor?.message ?? "", "Cursor CLI login"); + assert.isFalse(summary.buckets.some((bucket) => bucket.provider === "cursor")); + } + }).pipe(Effect.scoped), + ); + + it.live( + "includes OpenCode history but does not substitute desktop usage for an unavailable Cursor account", + () => + Effect.gen(function* () { + const { settings, home } = yield* setup; + const root = NodePath.join(home, "opencode"); + const message = yield* encodeUnknownJson({ + id: "msg_1", + sessionID: "session-1", + role: "assistant", + modelID: "example-model", + time: { created: Date.parse("2026-08-01T10:00:00Z") }, + tokens: { input: 10, output: 5, reasoning: 2, cache: { read: 20, write: 3 } }, + }); + const bubble = yield* encodeUnknownJson({ + type: 2, + createdAt: "2026-08-01T10:00:00Z", + modelInfo: { modelName: "example-model" }, + tokenCount: { inputTokens: 100, outputTokens: 20 }, + }); + yield* Effect.promise(async () => { + const directory = NodePath.join(root, "storage", "message", "session-1"); + await NodeFSP.mkdir(directory, { recursive: true }); + await NodeFSP.writeFile(NodePath.join(directory, "msg_1.json"), message); + const desktop = NodePath.join(home, "config", "Cursor", "User", "globalStorage"); + await NodeFSP.mkdir(desktop, { recursive: true }); + const db = new NodeSqlite.DatabaseSync(NodePath.join(desktop, "state.vscdb")); + try { + db.exec("CREATE TABLE cursorDiskKV (key TEXT, value TEXT)"); + db.prepare("INSERT INTO cursorDiskKV VALUES (?, ?)").run( + "bubbleId:session:assistant", + bubble, + ); + } finally { + db.close(); + } + }); + const service = yield* UsageService.make.pipe( + Effect.provide(serviceLayers({ prefix: "usage-service-opencode", home, settings })), + ); + const summary = yield* service.readSummary(WINDOW); + assert.strictEqual(summary.buckets[0]?.provider, "opencode"); + assert.isFalse(summary.buckets.some((bucket) => bucket.provider === "cursor")); + assert.strictEqual( + summary.sources.find((source) => source.fingerprint.provider === "cursor")?.status, + "missing", + ); + assert.strictEqual( + summary.buckets[0]?.sourcePath, + yield* Effect.promise(() => NodeFSP.realpath(root)), + ); + assert.strictEqual(summary.buckets[0]?.totals.outputTokens, 7); + assert.strictEqual( + summary.sources.find((source) => source.fingerprint.provider === "opencode") + ?.distinctSessions, + 1, + ); + assert.include( + summary.sources.find((source) => source.fingerprint.provider === "cursor")?.message ?? "", + "Cursor account history needs a Cursor CLI login", + ); + }).pipe(Effect.scoped), + ); + + it.live("counts aliased OpenCode and Antigravity directories once", () => + Effect.gen(function* () { + const { settings, home } = yield* setup; + const opencode = NodePath.join(home, "opencode-store"); + const opencodeAlias = NodePath.join(home, "opencode-alias"); + const conversations = NodePath.join(home, "antigravity-conversations"); + const antigravityA = NodePath.join(home, "antigravity-a"); + const antigravityB = NodePath.join(home, "antigravity-b"); + yield* Effect.promise(async () => { + await NodeFSP.mkdir(opencode); + await NodeFSP.symlink(opencode, opencodeAlias, "junction"); + await NodeFSP.mkdir(conversations); + await NodeFSP.mkdir(antigravityA); + await NodeFSP.mkdir(antigravityB); + await NodeFSP.symlink( + conversations, + NodePath.join(antigravityA, "conversations"), + "junction", + ); + await NodeFSP.symlink( + conversations, + NodePath.join(antigravityB, "conversations"), + "junction", + ); + }); + const service = yield* UsageService.make.pipe( + Effect.provide( + serviceLayers({ + prefix: "usage-service-aliased-roots-test", + home, + settings, + environment: { + OPENCODE_DATA_DIR: `${opencode},${opencodeAlias}`, + ANTIGRAVITY_DATA_DIR: `${antigravityA},${antigravityB}`, + }, + }), + ), + ); + const summary = yield* service.readSummary(WINDOW); + const sourcesFor = (provider: "opencode" | "antigravity") => + summary.sources.filter((source) => source.fingerprint.provider === provider); + assert.strictEqual(sourcesFor("opencode").length, 1); + assert.strictEqual(sourcesFor("antigravity").length, 1); + assert.strictEqual( + sourcesFor("opencode")[0]?.fingerprint.resolvedHomePath, + yield* Effect.promise(() => NodeFSP.realpath(opencode)), + ); + assert.strictEqual( + sourcesFor("antigravity")[0]?.fingerprint.resolvedHomePath, + yield* Effect.promise(() => NodeFSP.realpath(conversations)), + ); + }).pipe(Effect.scoped), + ); + it.live("reads configured and disabled accounts once across shared and aliased homes", () => Effect.gen(function* () { const { transcript, settings, home } = yield* setup; @@ -258,9 +454,12 @@ describe("UsageService", () => { const service = yield* UsageService.make; const first = yield* service.readSummary(WINDOW); assert.strictEqual(totalOutputTokens(first), 7); + const configuredProjects = yield* Effect.promise(() => + NodeFSP.realpath(NodePath.join(configured, "projects")), + ); assert.include( first.sources.map((source) => source.fingerprint.resolvedHomePath), - NodePath.join(configured, "projects"), + configuredProjects, ); yield* settingsService.updateSettings({ providerInstances: { @@ -275,9 +474,12 @@ describe("UsageService", () => { }); const second = yield* service.readSummary(WINDOW); assert.strictEqual(totalOutputTokens(second), 8); + const environmentProjects = yield* Effect.promise(() => + NodeFSP.realpath(NodePath.join(environmentHome, "projects")), + ); assert.include( second.sources.map((source) => source.fingerprint.resolvedHomePath), - NodePath.join(environmentHome, "projects"), + environmentProjects, ); }).pipe( Effect.provide( @@ -505,6 +707,9 @@ describe("UsageService", () => { Effect.gen(function* () { const { transcript, settings, home } = yield* setup; yield* Effect.promise(() => NodeFSP.writeFile(transcript, claudeLine(1, 5, "example-model"))); + const transcriptDir = yield* Effect.promise(() => + NodeFSP.realpath(NodePath.join(home, "claude", "projects")), + ); yield* Effect.gen(function* () { const settingsService = yield* ServerSettings.ServerSettingsService; @@ -519,7 +724,7 @@ describe("UsageService", () => { exists: (path) => fileSystem.exists(path).pipe( Effect.tap(() => { - if (path !== NodePath.join(home, "claude", "projects")) return Effect.void; + if (path !== transcriptDir) return Effect.void; homeProbes += 1; return Deferred.succeed( homeProbes === 1 ? firstScanStarted : secondScanStarted, diff --git a/apps/server/src/usage/UsageService.ts b/apps/server/src/usage/UsageService.ts index 1bf3e6f8c202..6930c7307d8c 100644 --- a/apps/server/src/usage/UsageService.ts +++ b/apps/server/src/usage/UsageService.ts @@ -1,14 +1,14 @@ /** * UsageService - scans provider transcripts and returns priced usage buckets. * - * The scan reads the provider CLIs' own session files (Claude Code, Codex, and - * Grok Build) rather than T3 Code's orchestration projections, so usage covers - * turns driven outside T3 Code too. This is the approach `ccusage` takes. + * The scan reads native session files and databases, including work driven + * outside T3 Code. Cursor's local records provide only partial coverage. * - * Transcripts are append-only, so parsed records are memoised per file by + * JSONL transcripts are append-only, so parsed records are memoised per file by * `(size, mtime)`. A cold 30-day scan of ~1.4 GB lands around 2-3 seconds; warm * scans only reparse files that changed, and a file that merely grew resumes * from its cached parse position so only the appended bytes are read. + * SQLite readers query live databases each scan so WAL writes remain visible. * * @module UsageService */ @@ -19,6 +19,7 @@ import { CodexSettings, type ProviderInstanceConfig, USAGE_CONTRACT_VERSION, + ProviderInstanceId, type ServerSettings as ServerSettingsValue, type UsageProviderKind, type UsageSource, @@ -27,10 +28,11 @@ import { type UsageSummaryInput, UsageReadError, } from "@t3tools/contracts"; -import { HostProcessEnvironment } from "@t3tools/shared/hostProcess"; +import { HostProcessEnvironment, HostProcessPlatform } from "@t3tools/shared/hostProcess"; import * as Cause from "effect/Cause"; import * as Clock from "effect/Clock"; import * as Context from "effect/Context"; +import * as Crypto from "effect/Crypto"; import * as DateTime from "effect/DateTime"; import * as Deferred from "effect/Deferred"; import * as Effect from "effect/Effect"; @@ -46,7 +48,11 @@ import { ServerConfig } from "../config.ts"; import { expandHomePath } from "../pathExpansion.ts"; import * as ServerSettings from "../serverSettings.ts"; import { resolveCodexHomeLayout } from "../provider/Drivers/CodexHomeLayout.ts"; +import { resolveAntigravityInstanceDirectories } from "../provider/antigravityAuthSupport.ts"; import { mergeProviderInstanceEnvironment } from "../provider/ProviderInstanceEnvironment.ts"; +import { readOpenCodeUsage } from "./opencodeUsageReader.ts"; +import { readAntigravityUsage } from "./antigravityUsageReader.ts"; +import { readCursorAccountUsage } from "./cursorUsageReader.ts"; import { UsageAggregator } from "./usageAggregation.ts"; import { createOverrideRateTable, parseRateTable, type RateTable } from "./usagePricing.ts"; import { @@ -144,12 +150,14 @@ export const layerTest = Layer.succeed( ); export const make = Effect.gen(function* () { + const crypto = yield* Crypto.Crypto; const fileSystem = yield* FileSystem.FileSystem; const path = yield* Path.Path; const config = yield* ServerConfig; const settingsService = yield* ServerSettings.ServerSettingsService; const httpClient = yield* HttpClient.HttpClient; const hostEnvironment = yield* HostProcessEnvironment; + const platform = yield* HostProcessPlatform; const fileCache: ScanCache = new Map(); const sourceCache = new Map(); @@ -446,6 +454,10 @@ export const make = Effect.gen(function* () { readonly provider: UsageProviderKind; readonly dir: string; readonly volumeId: string; + readonly hostId?: string; + readonly status?: UsageSource["status"]; + readonly message?: string; + readonly action?: UsageSource["action"]; /** Parsed records per file, or `null` when the directory does not exist. */ readonly files: | readonly { readonly path: string; readonly records: readonly UsageRecord[] }[] @@ -481,6 +493,171 @@ export const make = Effect.gen(function* () { } scanned.push({ provider, dir, volumeId, files: parsedFiles }); } + + const home = NodeOS.homedir(); + const envRoots = Effect.fnUntraced(function* (key: string, defaults: readonly string[]) { + const roots = hostEnvironment[key] + ?.split(",") + .map((value) => value.trim()) + .filter(Boolean); + const canonical = new Set(); + for (const root of roots?.length ? roots : defaults) { + const resolved = path.resolve(expandHomePath(root)); + canonical.add( + yield* fileSystem.realPath(resolved).pipe(Effect.orElseSucceed(() => resolved)), + ); + } + return [...canonical]; + }); + const dataHome = hostEnvironment["XDG_DATA_HOME"]?.trim(); + for (const dir of yield* envRoots("OPENCODE_DATA_DIR", [ + path.join( + dataHome && path.isAbsolute(dataHome) ? dataHome : path.join(home, ".local", "share"), + "opencode", + ), + ])) { + const result = yield* Effect.promise(() => readOpenCodeUsage(dir, windowStartMs)); + scanned.push({ + provider: "opencode", + dir, + volumeId: yield* Effect.promise(() => readDirectoryVolumeId(dir)), + files: result.missing && !result.error ? null : result.files, + status: result.error ? "partial" : "ok", + ...(result.error ? { message: "Some OpenCode history could not be read." } : {}), + }); + } + const antigravityRoots = yield* envRoots("ANTIGRAVITY_DATA_DIR", [ + ...["antigravity", "antigravity-cli", "antigravity-ide", "antigravity-backup"].map((name) => + path.join(home, ".gemini", name), + ), + path.join(home, ".config", "antigravity"), + ]); + for (const [instanceId, instance] of Object.entries(settings.providerInstances)) { + if (instance.driver === "antigravity") { + const directories = yield* resolveAntigravityInstanceDirectories( + config.stateDir, + ProviderInstanceId.make(instanceId), + ).pipe( + Effect.provideService(Crypto.Crypto, crypto), + Effect.provideService(Path.Path, path), + Effect.mapError( + (cause) => + new UsageReadError({ + reason: "scanFailed", + detail: "Antigravity profile directory could not be resolved.", + cause, + }), + ), + ); + antigravityRoots.push(path.join(directories.profile, "antigravity-acp")); + } + } + const antigravityDirs = new Set(); + for (const root of antigravityRoots) { + const resolvedRoot = yield* fileSystem.realPath(root).pipe(Effect.orElseSucceed(() => root)); + const nested = path.join(resolvedRoot, "conversations"); + const dir = (yield* fileSystem + .exists(nested) + .pipe(Effect.catchCause(() => Effect.succeed(false)))) + ? nested + : resolvedRoot; + antigravityDirs.add(yield* fileSystem.realPath(dir).pipe(Effect.orElseSucceed(() => dir))); + } + const antigravity = yield* Effect.promise(() => + readAntigravityUsage([...antigravityDirs], windowStartMs), + ); + for (const dir of antigravityDirs) { + const exists = yield* fileSystem + .exists(dir) + .pipe(Effect.catchCause(() => Effect.succeed(false))); + const failed = antigravity.errors.some( + (error) => error === dir || error.startsWith(`${dir}${path.sep}`), + ); + scanned.push({ + provider: "antigravity", + dir, + volumeId: yield* Effect.promise(() => readDirectoryVolumeId(dir)), + files: !exists && !failed ? null : antigravity.files.filter((file) => file.root === dir), + status: failed ? "partial" : "ok", + ...(failed ? { message: "Some Antigravity history could not be read." } : {}), + }); + } + const cursorUserHome = + (platform === "win32" ? hostEnvironment["USERPROFILE"] : hostEnvironment["HOME"]) || home; + const configHome = hostEnvironment["XDG_CONFIG_HOME"]?.trim(); + const cursorHome = + platform === "darwin" + ? path.join(cursorUserHome, "Library", "Application Support") + : platform === "win32" + ? hostEnvironment["APPDATA"] || path.join(cursorUserHome, "AppData", "Roaming") + : configHome && path.isAbsolute(configHome) + ? configHome + : path.join(cursorUserHome, ".config"); + const cursorAuthPath = + platform === "darwin" + ? path.join(cursorUserHome, ".cursor", "auth.json") + : path.join(cursorHome, platform === "win32" ? "Cursor" : "cursor", "auth.json"); + const credentialStore = hostEnvironment["AGENT_CLI_CREDENTIAL_STORE"]; + const loginUnavailable = + Boolean(hostEnvironment["CURSOR_AUTH_TOKEN"]?.trim()) || + Boolean(hostEnvironment["CURSOR_API_KEY"]?.trim()) || + credentialStore === "memory"; + if ( + platform === "darwin" && + credentialStore !== "file" && + !loginUnavailable && + !settings.cursorKeychainUsageEnabled + ) { + scanned.push({ + provider: "cursor", + dir: cursorAuthPath, + volumeId: "", + files: null, + message: "Cursor account usage is off on this environment.", + action: "enableCursorKeychain", + }); + return scanned; + } + const cursorUntilMs = yield* Clock.currentTimeMillis; + const account = loginUnavailable + ? { + accountKey: null, + records: [], + missing: true, + error: "Cursor account history needs a Cursor CLI login on this server.", + } + : yield* Effect.promise(() => + readCursorAccountUsage( + platform === "darwin" && credentialStore !== "file" + ? { kind: "keychain" } + : cursorAuthPath, + windowStartMs, + cursorUntilMs, + ), + ); + if (account.accountKey !== null && account.error === null && !account.missing) { + // The same account includes CLI and desktop history from every machine. + // A stable remote fingerprint prevents connected environments counting it twice. + const source = `cursor-account:${account.accountKey}`; + scanned.push({ + provider: "cursor", + dir: source, + hostId: "cursor.com", + volumeId: account.accountKey, + files: [{ path: source, records: account.records }], + status: "ok", + }); + return scanned; + } + scanned.push({ + provider: "cursor", + dir: cursorAuthPath, + volumeId: yield* Effect.promise(() => readDirectoryVolumeId(cursorAuthPath)), + // Never combine a local fallback with another server's account-wide history. + files: null, + message: + account.error ?? "Cursor account history needs a Cursor CLI login saved on this server.", + }); return scanned; }); @@ -555,7 +732,16 @@ export const make = Effect.gen(function* () { const sources: UsageSource[] = []; - for (const { provider, dir, volumeId, files } of scannedDirs) { + for (const { + provider, + dir, + volumeId, + files, + status, + message, + action, + hostId: sourceHostId, + } of scannedDirs) { const retainedFiles = [...(files ?? [])]; const livePaths = new Set(retainedFiles.map((file) => file.path)); // Cleanup may remove transcripts, but the usage we already saved still @@ -601,21 +787,23 @@ export const make = Effect.gen(function* () { } // Only sessions contributing in-window count; the mtime slack can // admit boundary files whose records fall outside the range. - if (aggregator.add(usageRecord) && record.sessionId.length > 0) { + if (aggregator.add(usageRecord, dir) && record.sessionId.length > 0) { sessionIds.add(record.sessionId); } } } sources.push({ - fingerprint: { hostId, provider, resolvedHomePath: dir, volumeId }, + fingerprint: { hostId: sourceHostId ?? hostId, provider, resolvedHomePath: dir, volumeId }, // Clients exclude missing sources, so saved records remain an available source. - status: files === null && scannedFiles === 0 ? "missing" : "ok", + status: files === null && scannedFiles === 0 ? "missing" : (status ?? "ok"), scannedFiles, skippedFiles, malformedRecords: 0, distinctSessions: sessionIds.size, - message: files === null ? "No transcript directory on this environment." : null, + message: + message ?? (files === null ? "No transcript directory on this environment." : null), + ...(action ? { action } : {}), }); } @@ -650,6 +838,7 @@ export const make = Effect.gen(function* () { const scanKey = ( input: UsageSummaryInput, priceOverrides: ServerSettingsValue["usagePriceOverrides"], + cursorKeychainUsageEnabled: boolean, ): string => JSON.stringify([ input.timeZone, @@ -659,11 +848,12 @@ export const make = Effect.gen(function* () { input.sinceTime ?? null, input.untilTime ?? null, priceOverrides, + cursorKeychainUsageEnabled, ]); const readSummary = Effect.fn("UsageService.readSummary")(function* (input: UsageSummaryInput) { const settings = yield* readSettings; - const key = scanKey(input, settings.usagePriceOverrides); + const key = scanKey(input, settings.usagePriceOverrides, settings.cursorKeychainUsageEnabled); const deferred = yield* Effect.uninterruptible( Effect.gen(function* () { const existing = inflightScans.get(key); diff --git a/apps/server/src/usage/antigravityUsageReader.ts b/apps/server/src/usage/antigravityUsageReader.ts new file mode 100644 index 000000000000..54c00b804b7a --- /dev/null +++ b/apps/server/src/usage/antigravityUsageReader.ts @@ -0,0 +1,374 @@ +// node:sqlite reads live conversation databases while Node fs discovers them. +// @effect-diagnostics nodeBuiltinImport:off +import * as NodeFSP from "node:fs/promises"; +import * as NodePath from "node:path"; +import * as NodeSqlite from "node:sqlite"; +import * as NodeTimersPromises from "node:timers/promises"; + +import type { UsageRecord } from "./usageTranscripts.ts"; + +type FieldValue = number | bigint | Uint8Array; +type Fields = Map; + +/** Antigravity stores usage metadata as protobuf, independently of conversation text. */ +function fields(bytes: Uint8Array): Fields { + let offset = 0; + const result: Fields = new Map(); + const varint = () => { + let value = 0n; + for (let shift = 0n; shift < 70n; shift += 7n) { + const byte = bytes[offset++]; + if (byte === undefined || (shift === 63n && byte > 1)) { + throw new Error("Invalid Antigravity protobuf varint"); + } + value |= BigInt(byte & 127) << shift; + if (byte < 128) { + return value > BigInt(Number.MAX_SAFE_INTEGER) ? value : Number(value); + } + } + throw new Error("Invalid Antigravity protobuf varint"); + }; + while (offset < bytes.length) { + const tag = varint(); + if (typeof tag !== "number") throw new Error("Invalid protobuf field"); + const number = Math.floor(tag / 8); + const wire = tag % 8; + if (number === 0) throw new Error("Invalid protobuf field"); + let value: FieldValue; + if (wire === 0) { + value = varint(); + } else if (wire === 1 || wire === 5 || wire === 2) { + const length = wire === 2 ? varint() : wire === 1 ? 8 : 4; + if (typeof length !== "number") throw new Error("Invalid protobuf field length"); + if (length > bytes.length - offset) throw new Error("Truncated protobuf field"); + value = bytes.subarray(offset, offset + length); + offset += length; + if (wire !== 2) continue; + } else { + throw new Error("Unsupported protobuf wire type"); + } + const entries = result.get(number) ?? []; + entries.push(value); + result.set(number, entries); + } + return result; +} + +const numberAt = (value: Fields, key: number) => { + const entry = value.get(key)?.[0]; + return typeof entry === "number" ? entry : 0; +}; +const bytesAt = (value: Fields, key: number) => { + const entry = value.get(key)?.[0]; + return entry instanceof Uint8Array ? entry : undefined; +}; +const nested = (value: Fields, key: number) => { + const bytes = bytesAt(value, key); + return bytes === undefined ? new Map() : fields(bytes); +}; +const textAt = (value: Fields, key: number) => { + const bytes = bytesAt(value, key); + return bytes === undefined ? "" : new TextDecoder("utf-8", { fatal: true }).decode(bytes).trim(); +}; +const timestamp = (value: Fields) => { + const seconds = numberAt(value, 1); + return seconds > 0 ? seconds * 1000 + Math.floor(numberAt(value, 2) / 1_000_000) : null; +}; + +const MODEL_IDS: Record = { + 246: "gemini-2.5-pro", + 312: "gemini-2.5-flash", + 313: "gemini-2.5-flash-thinking", + 329: "gemini-2.5-flash-thinking", + 330: "gemini-2.5-flash-lite", + 281: "claude-sonnet-4", + 282: "claude-sonnet-4", + 290: "claude-opus-4", + 291: "claude-opus-4", + 333: "claude-sonnet-4-5", + 334: "claude-sonnet-4-5", + 340: "claude-haiku-4-5", + 341: "claude-haiku-4-5", + 1026: "claude-opus-4-6", + 1035: "claude-sonnet-4-6", + 1016: "gemini-3.1-pro", + 1036: "gemini-3.1-pro", + 1037: "gemini-3.1-pro", + 1018: "gemini-3-flash-preview", + 1084: "gemini-3-flash-preview", + 1047: "gemini-3-flash-preview", +}; + +function modelName(name: string, id: number): string { + if (name) { + const normalized = name + .toLowerCase() + .replace(/\s*\([^)]*\)\s*$/, "") + .replaceAll(" ", "-"); + if (normalized.startsWith("claude-")) { + return normalized + .replace(/^claude-(4(?:\.\d+)?)-(sonnet|opus|haiku)/, "claude-$2-$1") + .replaceAll(".", "-"); + } + return normalized; + } + return MODEL_IDS[id] ?? (id > 0 ? `antigravity-model-${id}` : ""); +} + +interface Metadata { + model: string; + timestampMs: number | null; + usages: Fields[]; +} + +function metadata(bytes: Uint8Array, step: boolean): Metadata { + const root = fields(bytes); + if (!step && bytesAt(root, 1) === undefined) { + throw new Error("Missing Antigravity generation metadata"); + } + const data = step ? root : nested(root, 1); + const model = step ? nested(data, 24) : data; + const usage = bytesAt(data, step ? 9 : 4); + const usages = usage === undefined ? [] : [fields(usage)]; + for (const retry of data.get(step ? 28 : 17) ?? []) { + if (!(retry instanceof Uint8Array)) throw new Error("Invalid retry metadata"); + const retryUsage = bytesAt(fields(retry), 2); + if (retryUsage !== undefined) usages.push(fields(retryUsage)); + } + return { + model: modelName( + textAt(model, step ? 12 : 19) || textAt(model, step ? 8 : 21), + numberAt(model, step ? 1 : 3), + ), + timestampMs: step + ? (timestamp(nested(data, 8)) ?? timestamp(nested(data, 1))) + : timestamp(nested(nested(data, 9), 4)), + usages, + }; +} + +function blob(value: unknown): Uint8Array { + if (!(value instanceof Uint8Array)) throw new Error("Invalid Antigravity metadata blob"); + return value; +} + +interface UsageCandidate { + record: UsageRecord; + keys: readonly string[]; + timestampQuality: number; +} + +async function readDatabase(path: string, fallbackTimestamp: number): Promise { + const db = new NodeSqlite.DatabaseSync(path, { readOnly: true }); + try { + db.exec("PRAGMA busy_timeout = 100; BEGIN"); + const tables = new Set( + db + .prepare("SELECT name FROM sqlite_master WHERE type = 'table'") + .all() + .map((row) => row.name), + ); + if (!tables.has("gen_metadata") && !tables.has("steps")) { + throw new Error("Missing Antigravity usage tables"); + } + const readMetadata = async (query: string, column: string, step: boolean) => { + const entries: Array<{ idx: number; entry: Metadata }> = []; + for (const row of db.prepare(query).iterate()) { + if (typeof row.idx !== "number") throw new Error("Invalid Antigravity metadata index"); + entries.push({ idx: row.idx, entry: metadata(blob(row[column]), step) }); + if (entries.length % 256 === 0) await NodeTimersPromises.setImmediate(); + } + return entries; + }; + const generations = tables.has("gen_metadata") + ? await readMetadata("SELECT idx, data FROM gen_metadata ORDER BY idx", "data", false) + : []; + let trajectoryTimestamp: number | null = null; + if (tables.has("trajectory_metadata_blob")) { + for (const row of db.prepare("SELECT data FROM trajectory_metadata_blob").iterate()) { + trajectoryTimestamp ??= timestamp(nested(fields(blob(row.data)), 2)); + } + } + const steps = tables.has("steps") + ? await readMetadata( + "SELECT idx, metadata FROM steps WHERE metadata IS NOT NULL ORDER BY idx", + "metadata", + true, + ) + : []; + const sessionId = NodePath.basename(path, ".db"); + const records: UsageCandidate[] = []; + const generationModels = new Map(generations.map(({ idx, entry }) => [idx, entry.model])); + for (const [source, entries] of [ + ["step", steps], + ["generation", generations], + ] as const) { + for (const [index, { idx, entry }] of entries.entries()) { + for (const [usageIndex, usage] of entry.usages.entries()) { + const outputTokens = Math.max( + numberAt(usage, 3), + numberAt(usage, 9) + numberAt(usage, 10), + ); + const totals = { + uncachedInputTokens: numberAt(usage, 2), + cachedInputTokens: numberAt(usage, 5), + cacheCreationTokens: numberAt(usage, 4), + outputTokens, + reasoningTokens: Math.min(outputTokens, numberAt(usage, 9)), + }; + if ( + totals.uncachedInputTokens + + totals.cachedInputTokens + + totals.cacheCreationTokens + + outputTokens === + 0 + ) + continue; + const keys = ([11, 12, 7] as const).flatMap((key) => { + const id = textAt(usage, key); + return id ? [`antigravity:${key}:${id}`] : []; + }); + const record: UsageRecord = { + provider: "antigravity", + sessionId, + timestampMs: entry.timestampMs ?? trajectoryTimestamp ?? fallbackTimestamp, + model: + MODEL_IDS[numberAt(usage, 1)] || + entry.model || + (source === "step" ? generationModels.get(idx) : "") || + modelName("", numberAt(usage, 1)) || + "antigravity-unknown", + totals, + reportedCostUsd: null, + fast: false, + dedupeKey: keys[0] ?? `antigravity:${sessionId}:${source}:${index}:${usageIndex}`, + }; + records.push({ + record, + keys, + timestampQuality: entry.timestampMs !== null ? 2 : trajectoryTimestamp !== null ? 1 : 0, + }); + } + } + } + return records; + } finally { + db.close(); + } +} + +/** Reads and merges aliases across every configured Antigravity store before date filtering. */ +export async function readAntigravityUsage( + conversationsDirectories: string | readonly string[], + sinceMs: number, +) { + const roots = + typeof conversationsDirectories === "string" + ? [conversationsDirectories] + : conversationsDirectories; + const files: Array<{ root: string; path: string; records: UsageRecord[] }> = []; + const errors: string[] = []; + const identities = new Map(); + const groups: Array< + UsageCandidate & { parent: number; size: number; owner: number; fileIndex: number } + > = []; + const find = (index: number): number => { + let root = index; + while (groups[root]!.parent !== root) root = groups[root]!.parent; + while (index !== root) { + const parent = groups[index]!.parent; + groups[index]!.parent = root; + index = parent; + } + return root; + }; + const merge = (left: number, right: number): number => { + let a = find(left); + let b = find(right); + if (a === b) return a; + if (groups[a]!.size < groups[b]!.size) [a, b] = [b, a]; + const target = groups[a]!; + const source = groups[b]!; + const first = target.owner < source.owner ? target : source; + const bestTime = + source.timestampQuality > target.timestampQuality || + (source.timestampQuality === target.timestampQuality && + source.record.timestampMs < target.record.timestampMs) + ? source + : target; + const x = target.record.totals; + const y = source.record.totals; + target.record = { + ...first.record, + model: + first.record.model === "antigravity-unknown" + ? first === target + ? source.record.model + : target.record.model + : first.record.model, + timestampMs: bestTime.record.timestampMs, + totals: { + uncachedInputTokens: Math.max(x.uncachedInputTokens, y.uncachedInputTokens), + cachedInputTokens: Math.max(x.cachedInputTokens, y.cachedInputTokens), + cacheCreationTokens: Math.max(x.cacheCreationTokens, y.cacheCreationTokens), + outputTokens: Math.max(x.outputTokens, y.outputTokens), + reasoningTokens: Math.max(x.reasoningTokens, y.reasoningTokens), + }, + }; + target.timestampQuality = bestTime.timestampQuality; + target.owner = first.owner; + target.fileIndex = first.fileIndex; + target.size += source.size; + source.parent = a; + return a; + }; + const append = (candidate: UsageCandidate, fileIndex: number) => { + const index = groups.length; + groups.push({ ...candidate, parent: index, size: 1, owner: index, fileIndex }); + for (const key of candidate.keys) { + const existing = identities.get(key); + if (existing !== undefined) merge(index, existing); + identities.set(key, index); + } + }; + const visited = new Set(); + const walk = async (directory: string, root: string): Promise => { + let entries; + try { + entries = await NodeFSP.readdir(directory, { withFileTypes: true }); + } catch (error) { + if ((error as NodeJS.ErrnoException).code !== "ENOENT") errors.push(directory); + return; + } + entries.sort((a, b) => a.name.localeCompare(b.name)); + for (const entry of entries) { + const path = NodePath.join(directory, entry.name); + if (entry.isDirectory()) { + await walk(path, root); + } else if (entry.isFile() && entry.name.endsWith(".db")) { + try { + const canonical = await NodeFSP.realpath(path); + if (visited.has(canonical)) continue; + visited.add(canonical); + const stat = await NodeFSP.stat(path); + const candidates = await readDatabase(path, stat.mtimeMs); + const fileIndex = files.length; + files.push({ root, path, records: [] }); + for (const [index, candidate] of candidates.entries()) { + append(candidate, fileIndex); + if (index % 256 === 255) await NodeTimersPromises.setImmediate(); + } + } catch { + errors.push(path); + } + } + } + }; + for (const root of roots) await walk(root, root); + for (const [index, group] of groups.entries()) { + if (group.parent === index && group.record.timestampMs >= sinceMs) { + files[group.fileIndex]!.records.push(group.record); + } + } + return { files, errors }; +} diff --git a/apps/server/src/usage/cursorUsageReader.ts b/apps/server/src/usage/cursorUsageReader.ts new file mode 100644 index 000000000000..81c680afff0b --- /dev/null +++ b/apps/server/src/usage/cursorUsageReader.ts @@ -0,0 +1,254 @@ +// Node fs reads CLI credentials, and crypto hashes account IDs for deduplication. +// @effect-diagnostics nodeBuiltinImport:off +import * as NodeFSP from "node:fs/promises"; +import * as NodeCrypto from "node:crypto"; +import * as NodeTimersPromises from "node:timers/promises"; + +import type { UsageRecord } from "./usageTranscripts.ts"; +import { readMacCursorAccessToken } from "../provider/cursorCredentialStore.ts"; + +function object(value: unknown): Record { + return typeof value === "object" && value !== null && !Array.isArray(value) + ? (value as Record) + : {}; +} + +function tokens(value: unknown): number { + return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : 0; +} + +export interface CursorAccountUsageReadResult { + readonly accountKey: string | null; + readonly records: readonly UsageRecord[]; + readonly missing: boolean; + readonly error: string | null; +} + +const accountHash = (value: string) => NodeCrypto.createHash("sha256").update(value).digest("hex"); + +function canonicalJson(value: unknown): string { + if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`; + if (value !== null && typeof value === "object") { + return `{${Object.entries(value) + .sort(([a], [b]) => a.localeCompare(b)) + .map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`) + .join(",")}}`; + } + return JSON.stringify(value) ?? "null"; +} + +/** Find the longest exact suffix/prefix overlap in linear time. */ +function boundaryOverlap(previous: readonly string[], current: readonly string[]): number { + const sequence = [...current, "", ...previous]; + const lengths = Array.from({ length: sequence.length }, () => 0); + for (let index = 1; index < sequence.length; index++) { + let length = lengths[index - 1]!; + while (length > 0 && sequence[index] !== sequence[length]) length = lengths[length - 1]!; + if (sequence[index] === sequence[length]) length++; + lengths[index] = length; + } + return lengths.at(-1) ?? 0; +} + +/** Dashboard usage includes headless agents and reports fresh input separately from cache reads. */ +export async function readCursorAccountUsage( + credentialSource: string | { readonly kind: "keychain" }, + sinceMs: number, + endDate: number, + request: (url: string, init: RequestInit) => Promise = globalThis.fetch, + keychainToken: () => Promise = readMacCursorAccessToken, +): Promise { + let accessToken: unknown; + try { + accessToken = + typeof credentialSource === "string" + ? object(JSON.parse(await NodeFSP.readFile(credentialSource, "utf8"))).accessToken + : await keychainToken(); + } catch (cause) { + const missing = typeof credentialSource === "string" && object(cause).code === "ENOENT"; + return { + accountKey: null, + records: [], + missing, + error: missing + ? null + : typeof credentialSource === "string" + ? "Cursor credentials could not be read." + : "Cursor Keychain credentials could not be read.", + }; + } + if (typeof accessToken !== "string" || !accessToken) { + return { + accountKey: null, + records: [], + missing: true, + error: + typeof credentialSource === "string" + ? null + : "Cursor account history needs a macOS Keychain CLI login on this server.", + }; + } + let accountKey: string | null = null; + try { + const payload = accessToken.split(".")[1]; + const subject = object( + JSON.parse(Buffer.from(payload ?? "", "base64url").toString("utf8")), + ).sub; + if (typeof subject !== "string" || !subject) throw new Error("Invalid authentication"); + const userId = subject.split("|").at(-1); + if (!userId) throw new Error("Invalid authentication"); + accountKey = accountHash(subject); + if (!Number.isFinite(sinceMs) || !Number.isFinite(endDate) || sinceMs < 0 || sinceMs > endDate) + throw new Error("Invalid date window"); + const deadline = AbortSignal.timeout(60_000); + const records: UsageRecord[] = []; + const occurrences = new Map(); + const pages: unknown[][] = []; + let completed = false; + const pageSize = 1000; + let total: number | undefined; + for (let page = 1; ; page++) { + // A count can include overlapping page boundaries. Allow room to + // reconcile them without imposing a fixed account-size limit. + if (page > (total === undefined ? 1000 : Math.ceil(total / pageSize) * 2 + 1)) { + throw new Error("Account usage page limit exceeded"); + } + const response = await request("https://cursor.com/api/dashboard/get-filtered-usage-events", { + method: "POST", + redirect: "error", + signal: AbortSignal.any([deadline, AbortSignal.timeout(10_000)]), + headers: { + "Content-Type": "application/json", + Origin: "https://cursor.com", + Cookie: `WorkosCursorSessionToken=${encodeURIComponent(`${userId}::${accessToken}`)}`, + }, + body: JSON.stringify({ + page, + pageSize, + startDate: String(sinceMs), + endDate: String(endDate), + }), + }); + if (response.status === 401 || response.status === 403) { + return { + accountKey, + records: [], + missing: false, + error: "Sign in to Cursor again to read account usage.", + }; + } + if (!response.ok) throw new Error("Account usage request failed"); + const parsed: unknown = await response.json(); + if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) { + throw new Error("Invalid account usage page"); + } + const body = object(parsed); + const keys = Object.keys(body); + if ("error" in body || "message" in body || "code" in body) + throw new Error("Account usage error response"); + const count = keys.length === 0 ? 0 : body.totalUsageEventsCount; + const events = + keys.length === 0 || (keys.length === 1 && keys[0] === "totalUsageEventsCount") + ? [] + : body.usageEventsDisplay; + if ( + (count !== undefined && + (typeof count !== "number" || + !Number.isSafeInteger(count) || + count < 0 || + (total !== undefined && count !== total))) || + !Array.isArray(events) || + events.length > pageSize || + (count === undefined && !Array.isArray(body.usageEventsDisplay)) + ) { + throw new Error("Inconsistent account usage page"); + } + if (typeof count === "number") total = count; + pages.push(events); + if (events.length < pageSize) { + completed = true; + break; + } + } + if (!completed) throw new Error("Account usage page limit exceeded"); + const rawCount = pages.reduce((sum, page) => sum + page.length, 0); + if (total !== undefined && rawCount < total) throw new Error("Incomplete account usage pages"); + let removalsRemaining = total === undefined ? 0 : rawCount - total; + let previousKeys: string[] = []; + for (const events of pages) { + const eventKeys = + removalsRemaining > 0 ? events.map((event) => accountHash(canonicalJson(event))) : []; + const removalCount = Math.min(removalsRemaining, boundaryOverlap(previousKeys, eventKeys)); + removalsRemaining -= removalCount; + previousKeys = eventKeys; + for (const raw of events.slice(removalCount)) { + const event = object(raw); + const usage = object(event.tokenUsage); + if (event.tokenUsage === undefined || event.tokenUsage === null) continue; + for (const key of [ + "inputTokens", + "outputTokens", + "cacheReadTokens", + "cacheWriteTokens", + "totalCents", + ]) { + const value = usage[key]; + if ( + value !== undefined && + (typeof value !== "number" || !Number.isFinite(value) || value < 0) + ) { + throw new Error("Invalid account usage totals"); + } + } + const timestampMs = + typeof event.timestamp === "string" && event.timestamp.trim() !== "" + ? Number(event.timestamp) + : event.timestamp; + if ( + typeof timestampMs !== "number" || + !Number.isFinite(timestampMs) || + typeof event.model !== "string" || + !event.model + ) + throw new Error("Invalid account usage event"); + if (timestampMs < sinceMs || timestampMs > endDate) continue; + const totals = { + uncachedInputTokens: tokens(usage.inputTokens), + cachedInputTokens: tokens(usage.cacheReadTokens), + cacheCreationTokens: tokens(usage.cacheWriteTokens), + outputTokens: tokens(usage.outputTokens), + reasoningTokens: 0, + }; + const reportedCostUsd = + typeof usage.totalCents === "number" ? usage.totalCents / 100 : null; + const sessionId = typeof event.conversationId === "string" ? event.conversationId : ""; + // No event ID is provided. Preserve identical billed rows with an occurrence index. + const key = accountHash( + JSON.stringify([timestampMs, event.model, sessionId, totals, reportedCostUsd]), + ); + const occurrence = occurrences.get(key) ?? 0; + occurrences.set(key, occurrence + 1); + records.push({ + provider: "cursor", + timestampMs, + model: event.model, + sessionId, + totals, + reportedCostUsd, + fast: false, + dedupeKey: `cursor-account:${accountKey}:${key}:${occurrence}`, + }); + } + await NodeTimersPromises.setImmediate(); + } + if (removalsRemaining !== 0) throw new Error("Inconsistent account usage boundaries"); + return { accountKey, records, missing: false, error: null }; + } catch { + return { + accountKey, + records: [], + missing: false, + error: "Cursor account usage could not be read.", + }; + } +} diff --git a/apps/server/src/usage/opencodeUsageReader.ts b/apps/server/src/usage/opencodeUsageReader.ts new file mode 100644 index 000000000000..45d6ef33a584 --- /dev/null +++ b/apps/server/src/usage/opencodeUsageReader.ts @@ -0,0 +1,188 @@ +// node:sqlite reads live OpenCode databases; Node fs walks legacy JSON history. +// @effect-diagnostics nodeBuiltinImport:off +import * as NodeFSP from "node:fs/promises"; +import * as NodePath from "node:path"; +import * as NodeSqlite from "node:sqlite"; +import * as NodeTimersPromises from "node:timers/promises"; + +import { totalTokens, type UsageRecord } from "./usageTranscripts.ts"; + +function object(value: unknown): Record { + return typeof value === "object" && value !== null && !Array.isArray(value) + ? (value as Record) + : {}; +} + +function tokens(value: unknown): number { + return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : 0; +} + +function text(value: unknown): string { + return typeof value === "string" ? value : ""; +} + +/** OpenCode stores uncached input and reasoning separately from input/output. */ +function parseOpenCodeMessage( + source: string, + fallback: { + readonly id?: string; + readonly sessionId?: string; + readonly timestampMs?: number; + } = {}, +): UsageRecord | null { + let parsed: unknown; + try { + parsed = JSON.parse(source); + } catch { + return null; + } + const message = object(parsed); + if (message.role !== undefined && message.role !== "assistant") return null; + const usage = object(message.tokens); + const cache = object(usage.cache); + const modelReference = object(message.model); + const model = text(modelReference.id) || text(modelReference.modelID) || text(message.modelID); + const timestampMs = object(message.time).created ?? fallback.timestampMs; + if (!model || typeof timestampMs !== "number" || !Number.isFinite(timestampMs)) return null; + const reasoningTokens = tokens(usage.reasoning); + const totals = { + uncachedInputTokens: tokens(usage.input), + cachedInputTokens: tokens(cache.read), + cacheCreationTokens: tokens(cache.write), + outputTokens: tokens(usage.output) + reasoningTokens, + reasoningTokens, + }; + if (totalTokens(totals) === 0) return null; + const id = fallback.id || text(message.id); + const cost = message.cost; + return { + provider: "opencode", + timestampMs, + model, + sessionId: fallback.sessionId || text(message.sessionID), + totals, + // OpenCode writes zero for models without a known rate, including paid + // subscription models. Let the shared price table estimate those records. + reportedCostUsd: typeof cost === "number" && Number.isFinite(cost) && cost > 0 ? cost : null, + fast: false, + dedupeKey: id ? `opencode:${id}` : null, + }; +} + +export interface OpenCodeUsageReadResult { + readonly files: readonly { readonly path: string; readonly records: readonly UsageRecord[] }[]; + readonly missing: boolean; + readonly error: boolean; +} + +/** Reads current SQLite and pre-migration JSON stores without modifying either. */ +export async function readOpenCodeUsage( + root: string, + sinceMs: number, +): Promise { + const files: { path: string; records: UsageRecord[] }[] = []; + const seen = new Set(); + let found = false; + let error = false; + const append = (records: UsageRecord[], record: UsageRecord | null) => { + if (record === null || record.timestampMs < sinceMs) return; + if (record.dedupeKey !== null) { + if (seen.has(record.dedupeKey)) return; + seen.add(record.dedupeKey); + } + records.push(record); + }; + + let databases: string[] = []; + try { + databases = (await NodeFSP.readdir(root, { withFileTypes: true })) + .filter((entry) => entry.isFile() && /^opencode(?:-[a-zA-Z0-9_-]+)?\.db$/.test(entry.name)) + .map((entry) => entry.name) + .sort((a, b) => (a === "opencode.db" ? -1 : b === "opencode.db" ? 1 : a.localeCompare(b))); + } catch (cause) { + if (object(cause).code !== "ENOENT") error = true; + } + for (const name of databases) { + found = true; + const file = { path: NodePath.join(root, name), records: [] as UsageRecord[] }; + files.push(file); + let database: NodeSqlite.DatabaseSync | undefined; + try { + database = new NodeSqlite.DatabaseSync(NodePath.join(root, name), { readOnly: true }); + // A busy live provider should fail this source promptly rather than + // stalling the server while SQLite waits for its writer. + database.exec("PRAGMA busy_timeout = 100"); + const tables = new Set( + database + .prepare("SELECT name FROM sqlite_master WHERE type = 'table'") + .all() + .map((row) => row.name), + ); + if (!tables.has("message") && !tables.has("session_message")) error = true; + for (const table of ["message", "session_message"] as const) { + if (!tables.has(table)) continue; + const columns = new Set( + database + .prepare(`PRAGMA table_info(${table})`) + .all() + .map((row) => row.name), + ); + const timestamp = columns.has("time_created") ? "time_created" : "NULL"; + const predicates = table === "session_message" ? ["type = 'assistant'"] : []; + if (timestamp !== "NULL") predicates.push("time_created >= ?"); + const where = predicates.length > 0 ? ` WHERE ${predicates.join(" AND ")}` : ""; + const statement = database.prepare( + `SELECT id, session_id, data, ${timestamp} AS created FROM ${table}${where}`, + ); + let count = 0; + for (const row of statement.iterate(...(timestamp === "NULL" ? [] : [sinceMs]))) { + append( + file.records, + parseOpenCodeMessage(text(row.data), { + id: text(row.id), + sessionId: text(row.session_id), + ...(typeof row.created === "number" ? { timestampMs: row.created } : {}), + }), + ); + if (++count % 256 === 0) await NodeTimersPromises.setImmediate(); + } + } + } catch { + error = true; + } finally { + database?.close(); + } + } + + // Do not follow symlinks, including cycles. Database records win over their + // old JSON copies when OpenCode has migrated a store in place. + const directories = [NodePath.join(root, "storage", "message")]; + while (directories.length > 0) { + const directory = directories.pop()!; + try { + for (const entry of await NodeFSP.readdir(directory, { withFileTypes: true })) { + const path = NodePath.join(directory, entry.name); + if (entry.isDirectory()) { + directories.push(path); + } else if (entry.isFile() && entry.name.endsWith(".json")) { + found = true; + const id = entry.name.slice(0, -5); + if (seen.has(`opencode:${id}`)) continue; + const file = { path, records: [] as UsageRecord[] }; + files.push(file); + try { + append( + file.records, + parseOpenCodeMessage(await NodeFSP.readFile(path, "utf8"), { id }), + ); + } catch (cause) { + if (object(cause).code !== "ENOENT") error = true; + } + } + } + } catch (cause) { + if (object(cause).code !== "ENOENT") error = true; + } + } + return { files, missing: !found && !error, error }; +} diff --git a/apps/server/src/usage/usageAggregation.ts b/apps/server/src/usage/usageAggregation.ts index 684f0a520614..92abfef74108 100644 --- a/apps/server/src/usage/usageAggregation.ts +++ b/apps/server/src/usage/usageAggregation.ts @@ -112,7 +112,7 @@ export class UsageAggregator { * can derive per-window facts (distinct sessions, for one) from the records * that landed rather than everything the mtime prefilter happened to admit. */ - add(record: UsageRecord): boolean { + add(record: UsageRecord, sourcePath?: string): boolean { if (record.dedupeKey !== null) { if (this.#seen.has(record.dedupeKey)) { this.#duplicatesDropped += 1; @@ -146,7 +146,7 @@ export class UsageAggregator { this.#hourlyWindow.sinceTimeMs + Math.floor((record.timestampMs - this.#hourlyWindow.sinceTimeMs) / HOUR_MS) * HOUR_MS, ).toISOString(); - const key = `${day}\u0000${hourStart}\u0000${record.provider}\u0000${record.model}`; + const key = `${day}\u0000${hourStart}\u0000${record.provider}\u0000${record.model}\u0000${sourcePath ?? ""}`; let bucket = this.#buckets.get(key); if (bucket === undefined) { bucket = { @@ -180,12 +180,14 @@ export class UsageAggregator { finish(): AggregateResult { const buckets: UsageBucket[] = []; for (const [key, bucket] of this.#buckets) { - const [day = "", hourStart = "", provider = "", model = ""] = key.split("\u0000"); + const [day = "", hourStart = "", provider = "", model = "", sourcePath = ""] = + key.split("\u0000"); buckets.push({ day: day as UsageDay, ...(hourStart === "" ? {} : { hourStart }), provider: provider as UsageBucket["provider"], model, + ...(sourcePath === "" ? {} : { sourcePath }), totals: bucket.totals, costUsd: bucket.costUsd, cacheSavingsUsd: bucket.cacheSavingsUsd, diff --git a/apps/server/src/usage/usageTranscriptReader.test.ts b/apps/server/src/usage/usageTranscriptReader.test.ts index 5feb68b2ff58..6c95a36df19b 100644 --- a/apps/server/src/usage/usageTranscriptReader.test.ts +++ b/apps/server/src/usage/usageTranscriptReader.test.ts @@ -4,13 +4,40 @@ import * as NodeFSP from "node:fs/promises"; import * as NodeOS from "node:os"; import * as NodePath from "node:path"; +import * as NodeSqlite from "node:sqlite"; import { afterEach, assert, beforeEach, describe, it } from "@effect/vitest"; import { readTranscriptRecords } from "./usageTranscriptReader.ts"; +import { readOpenCodeUsage } from "./opencodeUsageReader.ts"; +import { readCursorAccountUsage } from "./cursorUsageReader.ts"; +import { readAntigravityUsage } from "./antigravityUsageReader.ts"; let dir: string; +function protoNumber(field: number, value: number): number[] { + const varint = (number: number) => { + const bytes: number[] = []; + do { + const byte = number % 128; + number = Math.floor(number / 128); + bytes.push(byte + (number > 0 ? 128 : 0)); + } while (number > 0); + return bytes; + }; + return [...varint(field * 8), ...varint(value)]; +} + +function protoBytes(field: number, bytes: readonly number[]): number[] { + const encoded = protoNumber(field, bytes.length); + encoded[0] = encoded[0]! + 2; + return [...encoded, ...bytes]; +} + +function protoText(field: number, value: string): number[] { + return protoBytes(field, [...Buffer.from(value)]); +} + beforeEach(async () => { dir = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "usage-reader-test-")); }); @@ -208,3 +235,530 @@ describe("readTranscriptRecords resume", () => { assert.isNull(await readTranscriptRecords(NodePath.join(dir, "missing.jsonl"), "claude")); }); }); + +describe("SQLite usage readers", () => { + it("reads Cursor account history with the default macOS Keychain login", async () => { + const accessToken = `header.${Buffer.from(JSON.stringify({ sub: "auth|demo" })).toString("base64url")}.signature`; + let keychainReads = 0; + const result = await readCursorAccountUsage( + { kind: "keychain" }, + 0, + 1781000000000, + async (_url, init) => { + assert.include(new Headers(init.headers).get("cookie") ?? "", "demo%3A%3A"); + return Response.json({ totalUsageEventsCount: 0, usageEventsDisplay: [] }); + }, + async () => { + keychainReads++; + return accessToken; + }, + ); + assert.strictEqual(keychainReads, 1); + assert.isNull(result.error); + assert.isFalse(result.missing); + assert.isNotNull(result.accountKey); + }); + + it("reads paginated Cursor account history including headless calls with separate cache tokens", async () => { + const authPath = NodePath.join(dir, "auth.json"); + const accessToken = `header.${Buffer.from(JSON.stringify({ sub: "auth|demo", exp: 4102444800 })).toString("base64url")}.signature`; + await NodeFSP.writeFile(authPath, JSON.stringify({ accessToken })); + const pages: number[] = []; + const signals: AbortSignal[] = []; + const request = async (url: string, init: RequestInit) => { + assert.strictEqual(String(url), "https://cursor.com/api/dashboard/get-filtered-usage-events"); + assert.strictEqual(init?.redirect, "error"); + const headers = new Headers(init?.headers); + assert.strictEqual(headers.get("origin"), "https://cursor.com"); + assert.include(headers.get("cookie") ?? "", "WorkosCursorSessionToken=demo%3A%3A"); + const body = JSON.parse(String(init?.body)); + pages.push(body.page); + if (init.signal) signals.push(init.signal); + return Response.json({ + totalUsageEventsCount: 1001, + usageEventsDisplay: Array.from({ length: body.page === 1 ? 1000 : 1 }, (_, index) => ({ + timestamp: String(1780000000000 + ((body.page - 1) * 1000 + index) * 1000), + model: "claude-sonnet-4-5", + conversationId: `conversation-${body.page}`, + isHeadless: body.page === 2, + chargedCents: 0, + tokenUsage: { + inputTokens: 10, + outputTokens: 5, + cacheReadTokens: 30, + cacheWriteTokens: 2, + totalCents: 25, + }, + })), + }); + }; + const result = await readCursorAccountUsage(authPath, 0, 1781000000000, request); + assert.isNull(result.error); + assert.deepStrictEqual(pages, [1, 2]); + assert.lengthOf(signals, 2); + assert.notStrictEqual(signals[0], signals[1]); + assert.strictEqual(result.records.length, 1001); + assert.strictEqual(result.records.at(-1)?.sessionId, "conversation-2"); + assert.deepStrictEqual(result.records[0]?.totals, { + uncachedInputTokens: 10, + cachedInputTokens: 30, + cacheCreationTokens: 2, + outputTokens: 5, + reasoningTokens: 0, + }); + assert.strictEqual(result.records[0]?.reportedCostUsd, 0.25); + assert.isFalse(result.accountKey?.includes("demo") ?? true); + }); + + it("reads Cursor account history beyond 100 pages", async () => { + const authPath = NodePath.join(dir, "auth.json"); + const accessToken = `header.${Buffer.from(JSON.stringify({ sub: "auth|demo" })).toString("base64url")}.signature`; + await NodeFSP.writeFile(authPath, JSON.stringify({ accessToken })); + const fullPage = Array.from({ length: 1000 }, () => ({ tokenUsage: null })); + let requests = 0; + const result = await readCursorAccountUsage(authPath, 0, 1781000000000, async () => { + requests += 1; + return Response.json({ + totalUsageEventsCount: 100_001, + usageEventsDisplay: requests <= 100 ? fullPage : [{ tokenUsage: null }], + }); + }); + assert.isNull(result.error); + assert.strictEqual(requests, 101); + assert.deepStrictEqual(result.records, []); + }); + + it("accepts confirmed empty Cursor usage but rejects error envelopes", async () => { + const authPath = NodePath.join(dir, "auth.json"); + const accessToken = `header.${Buffer.from(JSON.stringify({ sub: "auth|demo" })).toString("base64url")}.signature`; + await NodeFSP.writeFile(authPath, JSON.stringify({ accessToken })); + for (const body of [ + {}, + { totalUsageEventsCount: 0 }, + { totalUsageEventsCount: 0, usageEventsDisplay: [] }, + ]) { + const result = await readCursorAccountUsage(authPath, 0, 1781000000000, async () => + Response.json(body), + ); + assert.isNull(result.error); + assert.deepStrictEqual(result.records, []); + assert.isFalse(result.missing); + } + for (const body of [ + { error: "upstream error" }, + { detail: "unknown error envelope" }, + { totalUsageEventsCount: 0, error: "upstream error" }, + null, + [], + "invalid", + 0, + ]) { + const result = await readCursorAccountUsage(authPath, 0, 1781000000000, async () => + Response.json(body), + ); + assert.isNotNull(result.error); + assert.deepStrictEqual(result.records, []); + } + }); + + it("requires a terminal Cursor page after a full page reaches the reported count", async () => { + const authPath = NodePath.join(dir, "auth.json"); + const accessToken = `header.${Buffer.from(JSON.stringify({ sub: "auth|demo" })).toString("base64url")}.signature`; + await NodeFSP.writeFile(authPath, JSON.stringify({ accessToken })); + let requests = 0; + const result = await readCursorAccountUsage(authPath, 0, 1781000000000, async () => { + requests++; + return Response.json( + requests === 1 + ? { + totalUsageEventsCount: 1000, + usageEventsDisplay: Array.from({ length: 1000 }, (_, index) => ({ + timestamp: String(1780000000000 + index), + model: "gpt-5", + tokenUsage: { inputTokens: 10, outputTokens: 5 }, + })), + } + : { totalUsageEventsCount: 1000 }, + ); + }); + assert.isNull(result.error); + assert.strictEqual(result.records.length, 1000); + assert.strictEqual(requests, 2); + }); + + it("removes only count-proven Cursor boundary copies and preserves identical billed events", async () => { + const authPath = NodePath.join(dir, "auth.json"); + const accessToken = `header.${Buffer.from(JSON.stringify({ sub: "auth|demo" })).toString("base64url")}.signature`; + await NodeFSP.writeFile(authPath, JSON.stringify({ accessToken })); + const event = (index: number) => ({ + timestamp: String(1780000000000 + index), + model: "gpt-5", + tokenUsage: { inputTokens: 10, outputTokens: 5, totalCents: 1 }, + }); + for (const total of [2000, 2001]) { + let requests = 0; + const result = await readCursorAccountUsage(authPath, 0, 1781000000000, async () => { + requests++; + return Response.json({ + totalUsageEventsCount: total, + usageEventsDisplay: + requests === 1 + ? Array.from({ length: 1000 }, (_, index) => event(index)) + : requests === 2 + ? Array.from({ length: 1000 }, (_, index) => event(999 + index)) + : [event(1999)], + }); + }); + assert.isNull(result.error); + assert.strictEqual(result.records.length, total); + assert.strictEqual(requests, 3); + assert.strictEqual(result.records.at(-1)?.timestampMs, 1780000001999); + assert.strictEqual( + result.records.filter((record) => record.timestampMs === 1780000000999).length, + total === 2000 ? 1 : 2, + ); + assert.strictEqual(new Set(result.records.map((record) => record.dedupeKey)).size, total); + } + let requests = 0; + const inconsistent = await readCursorAccountUsage(authPath, 0, 1781000000000, async () => { + requests++; + return Response.json({ + totalUsageEventsCount: 1001, + usageEventsDisplay: + requests === 1 + ? Array.from({ length: 1000 }, (_, index) => event(index)) + : [event(500), event(1000)], + }); + }); + assert.isNotNull(inconsistent.error); + assert.deepStrictEqual(inconsistent.records, []); + }); + + it("does not present truncated Cursor account pages or authentication failures as complete history", async () => { + const authPath = NodePath.join(dir, "auth.json"); + const accessToken = `header.${Buffer.from(JSON.stringify({ sub: "auth|demo", exp: 4102444800 })).toString("base64url")}.signature`; + await NodeFSP.writeFile(authPath, JSON.stringify({ accessToken })); + const truncated = await readCursorAccountUsage(authPath, 0, 1781000000000, async () => + Response.json({ totalUsageEventsCount: 101, usageEventsDisplay: [] }), + ); + assert.isNotNull(truncated.error); + assert.deepStrictEqual(truncated.records, []); + const denied = await readCursorAccountUsage( + authPath, + 0, + 1781000000000, + async () => new Response(accessToken, { status: 401 }), + ); + assert.isNotNull(denied.error); + assert.isFalse(denied.error?.includes(accessToken) ?? true); + assert.deepStrictEqual(denied.records, []); + let requested = false; + const missing = await readCursorAccountUsage( + NodePath.join(dir, "missing.json"), + 0, + 1781000000000, + async () => { + requested = true; + return Response.json({}); + }, + ); + assert.isTrue(missing.missing); + assert.isFalse(requested); + }); + + it("counts migrated OpenCode messages once and sees subsequent WAL writes", async () => { + const db = new NodeSqlite.DatabaseSync(NodePath.join(dir, "opencode.db")); + try { + db.exec( + "PRAGMA journal_mode = WAL; PRAGMA wal_autocheckpoint = 0; CREATE TABLE message (id TEXT, session_id TEXT, data TEXT)", + ); + const message = { + id: "msg-1", + sessionID: "session-1", + role: "assistant", + modelID: "claude-sonnet-4-5", + time: { created: 1780000000000 }, + cost: 0.25, + tokens: { input: 100, output: 20, reasoning: 5, cache: { read: 30, write: 10 } }, + }; + const insert = db.prepare("INSERT INTO message VALUES (?, ?, ?)"); + insert.run(message.id, message.sessionID, JSON.stringify(message)); + const legacy = NodePath.join(dir, "storage", "message", message.sessionID); + await NodeFSP.mkdir(legacy, { recursive: true }); + await NodeFSP.writeFile(NodePath.join(legacy, "msg-1.json"), JSON.stringify(message)); + const first = await readOpenCodeUsage(dir, 0); + assert.isFalse(first.error); + const records = first.files.flatMap((file) => file.records); + assert.strictEqual(records.length, 1); + assert.deepStrictEqual(records[0]?.totals, { + uncachedInputTokens: 100, + cachedInputTokens: 30, + cacheCreationTokens: 10, + outputTokens: 25, + reasoningTokens: 5, + }); + assert.strictEqual(records[0]?.reportedCostUsd, 0.25); + insert.run( + "msg-2", + message.sessionID, + JSON.stringify({ ...message, id: "msg-2", time: { created: 1780000001000 } }), + ); + const next = await readOpenCodeUsage(dir, 1780000001000); + assert.isFalse(next.error); + assert.deepStrictEqual( + next.files.flatMap((file) => file.records).map((record) => record.dedupeKey), + ["opencode:msg-2"], + ); + assert.isAbove((await NodeFSP.stat(NodePath.join(dir, "opencode.db-wal"))).size, 0); + } finally { + db.close(); + } + }); + + it("deduplicates Antigravity generation and step usage while preserving retry model and token buckets", async () => { + const db = new NodeSqlite.DatabaseSync(NodePath.join(dir, "session-1.db")); + const stamp = protoNumber(1, 1780000000); + const usage = [ + ...protoNumber(2, 100), + ...protoNumber(3, 40), + ...protoNumber(4, 5), + ...protoNumber(5, 20), + ...protoNumber(9, 10), + ...protoText(11, "response-1"), + ]; + const retry = [ + ...protoNumber(1, 1026), + ...protoNumber(2, 12), + ...protoNumber(3, 3), + ...protoText(11, "retry-1"), + ]; + const generation = protoBytes(1, [ + ...protoBytes(4, usage), + ...protoText(19, "Gemini 3 Pro"), + ...protoBytes(9, protoBytes(4, stamp)), + ]); + const step = [ + ...protoBytes(9, usage), + ...protoBytes(8, stamp), + ...protoBytes(28, protoBytes(2, retry)), + ]; + try { + db.exec( + "CREATE TABLE gen_metadata (idx INTEGER, data BLOB); CREATE TABLE steps (idx INTEGER, metadata BLOB)", + ); + db.prepare("INSERT INTO gen_metadata VALUES (?, ?)").run(0, new Uint8Array(generation)); + db.prepare("INSERT INTO steps VALUES (?, ?)").run(0, new Uint8Array(step)); + } finally { + db.close(); + } + const result = await readAntigravityUsage(dir, 0); + assert.deepStrictEqual(result.errors, []); + const records = result.files.flatMap((file) => file.records); + assert.strictEqual(records.length, 2); + const main = records.find((record) => record.model === "gemini-3-pro"); + assert.isDefined(main); + assert.strictEqual(main?.timestampMs, 1780000000000); + assert.strictEqual(main?.sessionId, "session-1"); + assert.deepStrictEqual(main?.totals, { + uncachedInputTokens: 100, + cachedInputTokens: 20, + cacheCreationTokens: 5, + outputTokens: 40, + reasoningTokens: 10, + }); + assert.strictEqual( + records.find((record) => record.model === "claude-opus-4-6")?.totals.uncachedInputTokens, + 12, + ); + assert.deepStrictEqual( + (await readAntigravityUsage(dir, 1780000000001)).files.flatMap((file) => file.records), + [], + ); + }); + + it("uses the matching Antigravity generation model for each model-less step", async () => { + const db = new NodeSqlite.DatabaseSync(NodePath.join(dir, "model-switch.db")); + try { + db.exec( + "CREATE TABLE gen_metadata (idx INTEGER, data BLOB); CREATE TABLE steps (idx INTEGER, metadata BLOB)", + ); + const generation = db.prepare("INSERT INTO gen_metadata VALUES (?, ?)"); + const step = db.prepare("INSERT INTO steps VALUES (?, ?)"); + for (const [idx, name] of ["Gemini 3 Pro", "Claude Opus 4.6"].entries()) { + generation.run(idx, new Uint8Array(protoBytes(1, protoText(19, name)))); + step.run(idx, new Uint8Array(protoBytes(9, protoNumber(2, 10 + idx)))); + } + } finally { + db.close(); + } + const result = await readAntigravityUsage(dir, 0); + assert.deepStrictEqual(result.errors, []); + assert.deepStrictEqual( + result.files.flatMap((file) => file.records).map((record) => record.model), + ["gemini-3-pro", "claude-opus-4-6"], + ); + }); + + it("merges Antigravity aliases that bridge previously separate step records", async () => { + const db = new NodeSqlite.DatabaseSync(NodePath.join(dir, "bridge.db")); + try { + db.exec( + "CREATE TABLE gen_metadata (idx INTEGER, data BLOB); CREATE TABLE steps (idx INTEGER, metadata BLOB)", + ); + const step = db.prepare("INSERT INTO steps VALUES (?, ?)"); + step.run( + 0, + new Uint8Array(protoBytes(9, [...protoNumber(2, 100), ...protoText(11, "response")])), + ); + step.run( + 1, + new Uint8Array(protoBytes(9, [...protoNumber(3, 40), ...protoText(12, "provider")])), + ); + db.prepare("INSERT INTO gen_metadata VALUES (?, ?)").run( + 0, + new Uint8Array( + protoBytes(1, [ + ...protoText(19, "Gemini 3 Pro"), + ...protoBytes(4, [ + ...protoNumber(2, 50), + ...protoNumber(5, 20), + ...protoText(11, "response"), + ...protoText(12, "provider"), + ]), + ]), + ), + ); + } finally { + db.close(); + } + const result = await readAntigravityUsage(dir, 0); + assert.deepStrictEqual(result.errors, []); + const records = result.files.flatMap((file) => file.records); + assert.strictEqual(records.length, 1); + assert.deepStrictEqual(records[0]?.totals, { + uncachedInputTokens: 100, + cachedInputTokens: 20, + cacheCreationTokens: 0, + outputTokens: 40, + reasoningTokens: 0, + }); + }); + + it("merges Antigravity provider and message aliases across configured roots while keeping original ownership", async () => { + const roots = [NodePath.join(dir, "first"), NodePath.join(dir, "second")]; + for (const [index, root] of roots.entries()) { + await NodeFSP.mkdir(root); + const db = new NodeSqlite.DatabaseSync(NodePath.join(root, `session-${index}.db`)); + try { + db.exec("CREATE TABLE steps (idx INTEGER, metadata BLOB)"); + for (const identity of [7, 12]) { + const usage = [ + ...protoNumber(1, 246), + ...protoNumber(2, index === 0 ? 100 : 150), + ...protoText(11, `response-${index}-${identity}`), + ...protoText(identity, `shared-${identity}`), + ]; + db.prepare("INSERT INTO steps VALUES (?, ?)").run( + identity, + new Uint8Array(protoBytes(9, usage)), + ); + } + } finally { + db.close(); + } + } + const result = await readAntigravityUsage(roots, 0); + assert.deepStrictEqual(result.errors, []); + assert.strictEqual(result.files.length, 2); + assert.strictEqual(result.files[0]?.root, roots[0]); + assert.strictEqual(result.files[0]?.records.length, 2); + assert.strictEqual(result.files[1]?.records.length, 0); + assert.deepStrictEqual( + result.files[0]?.records.map((record) => record.totals.uncachedInputTokens), + [150, 150], + ); + assert.isTrue(result.files[0]?.records.every((record) => record.sessionId === "session-0")); + }); + + it("upgrades Antigravity fallback timestamps before applying the date window", async () => { + for (const fallback of ["mtime", "trajectory"]) { + const path = NodePath.join(dir, `${fallback}.db`); + const db = new NodeSqlite.DatabaseSync(path); + try { + db.exec( + "CREATE TABLE gen_metadata (idx INTEGER, data BLOB); CREATE TABLE steps (idx INTEGER, metadata BLOB)", + ); + if (fallback === "trajectory") { + db.exec("CREATE TABLE trajectory_metadata_blob (data BLOB)"); + db.prepare("INSERT INTO trajectory_metadata_blob VALUES (?)").run( + new Uint8Array(protoBytes(2, protoNumber(1, 1780000200))), + ); + } + for (const [index, seconds] of [1780000000, 1780000200].entries()) { + const usage = [...protoNumber(2, 10), ...protoText(11, `${fallback}-${index}`)]; + db.prepare("INSERT INTO steps VALUES (?, ?)").run( + index, + new Uint8Array(protoBytes(9, usage)), + ); + db.prepare("INSERT INTO gen_metadata VALUES (?, ?)").run( + index, + new Uint8Array( + protoBytes(1, [ + ...protoBytes(4, usage), + ...protoBytes(9, protoBytes(4, protoNumber(1, seconds))), + ]), + ), + ); + } + } finally { + db.close(); + } + await NodeFSP.utimes(path, 1780000000, 1780000000); + } + const result = await readAntigravityUsage(dir, 1780000100000); + assert.deepStrictEqual(result.errors, []); + const records = result.files.flatMap((file) => file.records); + assert.strictEqual(records.length, 2); + assert.deepStrictEqual( + records.map((record) => record.timestampMs), + [1780000200000, 1780000200000], + ); + }); + + it("reads Antigravity step-only stores and reports malformed databases", async () => { + const db = new NodeSqlite.DatabaseSync(NodePath.join(dir, "steps.db")); + try { + db.exec("CREATE TABLE steps (idx INTEGER, metadata BLOB)"); + const usage = [...protoNumber(1, 246), ...protoNumber(2, 10), ...protoNumber(3, 5)]; + db.prepare("INSERT INTO steps VALUES (?, ?)").run( + 0, + new Uint8Array([...protoBytes(9, usage), ...protoBytes(8, protoNumber(1, 1780000000))]), + ); + } finally { + db.close(); + } + await NodeFSP.writeFile(NodePath.join(dir, "broken.db"), "not a sqlite database"); + const result = await readAntigravityUsage(dir, 0); + assert.strictEqual(result.errors.length, 1); + assert.strictEqual(result.files.flatMap((file) => file.records)[0]?.model, "gemini-2.5-pro"); + assert.strictEqual(result.files.flatMap((file) => file.records)[0]?.totals.outputTokens, 5); + }); + + it("ignores large values in unused Antigravity protobuf fields", async () => { + const db = new NodeSqlite.DatabaseSync(NodePath.join(dir, "large-varint.db")); + try { + db.exec("CREATE TABLE steps (idx INTEGER, metadata BLOB)"); + const unusedField = [...protoNumber(99, 0).slice(0, -1), ...Array(9).fill(0xff), 0x01]; + const usage = [...protoNumber(1, 246), ...protoNumber(2, 10), ...unusedField]; + db.prepare("INSERT INTO steps VALUES (?, ?)").run(0, new Uint8Array(protoBytes(9, usage))); + } finally { + db.close(); + } + const result = await readAntigravityUsage(dir, 0); + assert.deepStrictEqual(result.errors, []); + assert.strictEqual( + result.files.flatMap((file) => file.records)[0]?.totals.uncachedInputTokens, + 10, + ); + }); +}); diff --git a/apps/web/src/components/settings/ProviderSettingsPanel.tsx b/apps/web/src/components/settings/ProviderSettingsPanel.tsx index acec3be8387f..6722969075a1 100644 --- a/apps/web/src/components/settings/ProviderSettingsPanel.tsx +++ b/apps/web/src/components/settings/ProviderSettingsPanel.tsx @@ -314,7 +314,25 @@ function ProviderSettingsPanelContent(target: ProviderSettingsTarget) { hasServerConfig: environment.serverConfig !== null, }), )?.environmentId; + const searchableCursorEnvironmentId = options.find( + (environment) => + environment.serverConfig?.environment.platform.os === "darwin" && + isProviderSettingsEnvironmentAvailable({ + connectionPhase: environment.connection.phase, + hasServerConfig: true, + }), + )?.environmentId; useEffect(() => { + if ( + !target.scoped && + searchTargetId === searchableSetting("cursor-keychain-usage").id && + (!selectedEnvironmentCanRenderSettings || + selectedEnvironment?.serverConfig?.environment.platform.os !== "darwin") && + searchableCursorEnvironmentId !== undefined + ) { + setSelectedEnvironmentId(searchableCursorEnvironmentId); + return; + } if ( !target.scoped && (searchTargetId === searchableSetting("provider-health-check-interval").id || @@ -326,7 +344,9 @@ function ProviderSettingsPanelContent(target: ProviderSettingsTarget) { } }, [ searchTargetId, + searchableCursorEnvironmentId, searchableEnvironmentId, + selectedEnvironment, selectedEnvironmentCanRenderSettings, target.scoped, ]); @@ -1102,6 +1122,7 @@ export function EnvironmentProviderSettings({ environmentId={environmentId} environmentLabel={environmentLabel} sources={settings.usageLimitSources} + cursorKeychainUsageEnabled={settings.cursorKeychainUsageEnabled} readOnly={readOnly} /> diff --git a/apps/web/src/components/settings/SettingsSidebarNav.tsx b/apps/web/src/components/settings/SettingsSidebarNav.tsx index e2ea39c761f2..142972cf1ece 100644 --- a/apps/web/src/components/settings/SettingsSidebarNav.tsx +++ b/apps/web/src/components/settings/SettingsSidebarNav.tsx @@ -116,7 +116,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) { const searchInputRef = useRef(null); const [query, setQuery] = useState(""); const [activeResultIndex, setActiveResultIndex] = useState(0); - const searchableItems = useAvailableSettingsSearchItems(); + const searchableItems = useAvailableSettingsSearchItems(scopeSearch); const results = useMemo(() => searchSettings(query, searchableItems), [query, searchableItems]); const isSearching = query.trim().length > 0; const hasResults = results.length > 0; diff --git a/apps/web/src/components/settings/UsageProviderSettings.tsx b/apps/web/src/components/settings/UsageProviderSettings.tsx index cf2887f39684..46ed099b166e 100644 --- a/apps/web/src/components/settings/UsageProviderSettings.tsx +++ b/apps/web/src/components/settings/UsageProviderSettings.tsx @@ -1,8 +1,11 @@ import type { EnvironmentId, UnifiedSettings } from "@t3tools/contracts"; +import { useAtomValue } from "@effect/atom-react"; import { PlusIcon } from "lucide-react"; import { useState } from "react"; import { useUpdateEnvironmentSettings } from "../../hooks/useSettings"; +import { serverEnvironment } from "../../state/server"; +import { useAtomCommand } from "../../state/use-atom-command"; import { AlertDialog, AlertDialogClose, @@ -13,6 +16,7 @@ import { AlertDialogTitle, } from "../ui/alert-dialog"; import { Button } from "../ui/button"; +import { Switch } from "../ui/switch"; import { AddUsageLimitSourceDialog } from "./AddUsageLimitSourceDialog"; import { searchableSetting } from "./settingsSearch"; import { SettingsRow, SettingsSection } from "./settingsLayout"; @@ -22,17 +26,43 @@ export function UsageProviderSettings({ environmentId, environmentLabel, sources, + cursorKeychainUsageEnabled, readOnly, }: { readonly environmentId: EnvironmentId; readonly environmentLabel: string; readonly sources: UnifiedSettings["usageLimitSources"]; + readonly cursorKeychainUsageEnabled: boolean; readonly readOnly: boolean; }) { const updateSettings = useUpdateEnvironmentSettings(environmentId); + const updateCursorSettings = useAtomCommand(serverEnvironment.updateSettings, { + label: "update Cursor account usage", + }); + const refreshProviders = useAtomCommand(serverEnvironment.refreshProviders, { + reportFailure: false, + }); + const platform = useAtomValue(serverEnvironment.configValueAtom(environmentId))?.environment + .platform; const [adding, setAdding] = useState(false); + const [updatingCursor, setUpdatingCursor] = useState(false); const entries = Object.entries(sources); + const setCursorUsageEnabled = async (enabled: boolean) => { + setUpdatingCursor(true); + try { + const result = await updateCursorSettings({ + environmentId, + input: { patch: { cursorKeychainUsageEnabled: enabled } }, + }); + if (result._tag === "Success") { + await refreshProviders({ environmentId, input: {} }); + } + } finally { + setUpdatingCursor(false); + } + }; + return ( <> + {platform?.os === "darwin" ? ( + void setCursorUsageEnabled(enabled)} + /> + } + /> + ) : null} {entries.length === 0 ? ( - + ) : ( entries.map(([id, source]) => { const label = source.label?.trim() || source.url; diff --git a/apps/web/src/components/settings/settingsSearch.test.ts b/apps/web/src/components/settings/settingsSearch.test.ts index 569d736a62de..9bd4f9906acd 100644 --- a/apps/web/src/components/settings/settingsSearch.test.ts +++ b/apps/web/src/components/settings/settingsSearch.test.ts @@ -154,6 +154,7 @@ describe("searchSettings", () => { hasCloudPublicConfig: false, hasEnvironment: false, hasProviderSettingsEnvironment: false, + hasMacProviderSettingsEnvironment: false, canManageLocalBackend: false, isWslSettingsRowVisible: false, hasThreadAutoSettlement: false, @@ -165,6 +166,7 @@ describe("searchSettings", () => { "network-access", "publish-agent-activity", "provider-health-check-interval", + "cursor-keychain-usage", "source-control-writer-model", "source-control-writing-style", "t3-connect", @@ -177,11 +179,31 @@ describe("searchSettings", () => { expect(available.map((item) => item.id).filter((id) => gatedIds.has(id))).toEqual([]); }); + it("offers Cursor Keychain settings only when a macOS provider environment is available", () => { + const availability = { + hasCloudPublicConfig: false, + hasEnvironment: true, + hasProviderSettingsEnvironment: true, + hasMacProviderSettingsEnvironment: false, + canManageLocalBackend: false, + isWslSettingsRowVisible: false, + hasThreadAutoSettlement: false, + }; + const itemIds = (macAvailable: boolean) => + filterAvailableSettingsSearchItems({ + ...availability, + hasMacProviderSettingsEnvironment: macAvailable, + }).map((item) => item.id); + expect(itemIds(false)).not.toContain("cursor-keychain-usage"); + expect(itemIds(true)).toContain("cursor-keychain-usage"); + }); + it("keeps the local toggle searchable without offering hidden host publishing controls", () => { const availability = { hasCloudPublicConfig: true, hasEnvironment: true, hasProviderSettingsEnvironment: true, + hasMacProviderSettingsEnvironment: false, canManageLocalBackend: false, isWslSettingsRowVisible: false, hasThreadAutoSettlement: false, @@ -204,6 +226,7 @@ describe("searchSettings", () => { hasCloudPublicConfig: false, hasEnvironment: false, hasProviderSettingsEnvironment: false, + hasMacProviderSettingsEnvironment: false, canManageLocalBackend: false, isWslSettingsRowVisible: false, hasThreadAutoSettlement: true, @@ -330,6 +353,7 @@ describe("searchSettings", () => { hasCloudPublicConfig: false, hasEnvironment: true, hasProviderSettingsEnvironment: true, + hasMacProviderSettingsEnvironment: false, canManageLocalBackend: false, isWslSettingsRowVisible: false, hasThreadAutoSettlement: true, @@ -424,6 +448,7 @@ describe("auto-settlement search availability", () => { hasCloudPublicConfig: false, hasEnvironment: true, hasProviderSettingsEnvironment: true, + hasMacProviderSettingsEnvironment: false, canManageLocalBackend: false, isWslSettingsRowVisible: false, hasThreadAutoSettlement: availability.eligibleEnvironmentIds.length > 0, diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts index acc9b7eb7dbe..539e780baaa8 100644 --- a/apps/web/src/components/settings/settingsSearch.ts +++ b/apps/web/src/components/settings/settingsSearch.ts @@ -55,6 +55,7 @@ export interface SettingsSearchItem { readonly cloudOnly?: boolean; readonly environmentOnly?: boolean; readonly providerSettingsOnly?: boolean; + readonly macProviderSettingsOnly?: boolean; readonly localBackendManagementOnly?: boolean; readonly localEnvironmentOnly?: boolean; readonly wslAvailableOnly?: boolean; @@ -71,6 +72,7 @@ export interface SettingsSearchAvailability { readonly hasCloudPublicConfig: boolean; readonly hasEnvironment: boolean; readonly hasProviderSettingsEnvironment: boolean; + readonly hasMacProviderSettingsEnvironment: boolean; readonly canManageLocalBackend: boolean; readonly isWslSettingsRowVisible: boolean; readonly hasThreadAutoSettlement: boolean; @@ -546,6 +548,14 @@ export const SETTINGS_SEARCH_ITEMS = [ ], providerSettingsOnly: true, }, + { + id: "cursor-keychain-usage", + title: "Cursor account usage", + to: "/settings/providers", + searchTerms: ["cursor macOS keychain usage tokens cost limits permission"], + providerSettingsOnly: true, + macProviderSettingsOnly: true, + }, { id: "provider-health-check-interval", title: "Health check interval", @@ -943,6 +953,7 @@ export function filterAvailableSettingsSearchItems( (!item.cloudOnly || availability.hasCloudPublicConfig) && (!item.environmentOnly || availability.hasEnvironment) && (!item.providerSettingsOnly || availability.hasProviderSettingsEnvironment) && + (!item.macProviderSettingsOnly || availability.hasMacProviderSettingsEnvironment) && (!item.localBackendManagementOnly || availability.canManageLocalBackend) && (!item.localEnvironmentOnly || !availability.localEnvironmentDisabled) && (!item.wslAvailableOnly || availability.isWslSettingsRowVisible) && diff --git a/apps/web/src/components/settings/useAvailableSettingsSearchItems.ts b/apps/web/src/components/settings/useAvailableSettingsSearchItems.ts index a0601e41729f..a5be950b81ab 100644 --- a/apps/web/src/components/settings/useAvailableSettingsSearchItems.ts +++ b/apps/web/src/components/settings/useAvailableSettingsSearchItems.ts @@ -10,12 +10,13 @@ import { useEnvironmentQuery } from "~/state/query"; import { usePrimarySessionState } from "~/environments/primary"; import { isWslSettingsRowVisible } from "./ConnectionsSettings.logic"; import { isProviderSettingsEnvironmentAvailable } from "./ProviderSettingsPanel.logic"; +import type { SettingsScopeSearch } from "./settingsScope"; import { filterAvailableSettingsSearchItems, getThreadAutoSettlementSearchAvailability, } from "./settingsSearch"; -export function useAvailableSettingsSearchItems() { +export function useAvailableSettingsSearchItems(scopeSearch: SettingsScopeSearch = {}) { const { environments } = useEnvironments(); const primarySessionState = usePrimarySessionState(); const localEnvironmentDisabled = isLocalEnvironmentDisabled(); @@ -41,6 +42,16 @@ export function useAvailableSettingsSearchItems() { hasServerConfig: environment.serverConfig !== null, }), ), + hasMacProviderSettingsEnvironment: environments.some( + (environment) => + (scopeSearch.machine === undefined || + environment.environmentId === scopeSearch.machine) && + environment.serverConfig?.environment.platform.os === "darwin" && + isProviderSettingsEnvironmentAvailable({ + connectionPhase: environment.connection.phase, + hasServerConfig: true, + }), + ), canManageLocalBackend, isWslSettingsRowVisible: isWslSettingsRowVisible({ state: desktopWsl.data, @@ -55,6 +66,7 @@ export function useAvailableSettingsSearchItems() { desktopWsl.error, environments, localEnvironmentDisabled, + scopeSearch.machine, ], ); } diff --git a/apps/web/src/components/usage/UsageLimits.tsx b/apps/web/src/components/usage/UsageLimits.tsx index 05c91739e251..585bd6ccf100 100644 --- a/apps/web/src/components/usage/UsageLimits.tsx +++ b/apps/web/src/components/usage/UsageLimits.tsx @@ -17,7 +17,7 @@ import { remainingPercent, } from "@t3tools/shared/usageLimits"; import { GaugeIcon, TrendingDownIcon, TrendingUpIcon } from "lucide-react"; -import { Fragment, useState } from "react"; +import { Fragment, type ReactNode, useState } from "react"; import { usePrimarySettings } from "../../hooks/useSettings"; import { environmentPresentations } from "../../state/presentation"; @@ -322,14 +322,16 @@ export function ResetCredits({ export function UsageLimitsSection({ selectedEnvironmentIds, now, + cursorPrompt, }: { readonly selectedEnvironmentIds: ReadonlySet | null; readonly now: number; + readonly cursorPrompt?: ReactNode; }) { const presentations = useAtomValue(environmentPresentations.presentationsAtom); const selected = selectedEnvironmentIds === null ? presentations : new Map([...presentations].filter(([id]) => selectedEnvironmentIds.has(id))); - return ; + return ; } diff --git a/apps/web/src/components/usage/UsageLimitsPooled.tsx b/apps/web/src/components/usage/UsageLimitsPooled.tsx index 70858262b6a3..bdb291836328 100644 --- a/apps/web/src/components/usage/UsageLimitsPooled.tsx +++ b/apps/web/src/components/usage/UsageLimitsPooled.tsx @@ -2,7 +2,8 @@ import { collectLimitAccounts, collectLimitNotices, collectLimitPools, - formatDuration, + cursorUsageWindowDetails, + displayLimitWindows, formatResetsIn, type LimitAccount, type LimitPool, @@ -11,7 +12,7 @@ import { remainingPercent, } from "@t3tools/shared/usageLimits"; import { AlertTriangleIcon, TicketIcon } from "lucide-react"; -import { type ReactNode, useState } from "react"; +import { Fragment, type ReactNode, useState } from "react"; import { usePrimarySettings } from "../../hooks/useSettings"; import { cn } from "../../lib/utils"; @@ -224,6 +225,7 @@ function PoolSegment({ color, now, index, + showAccountName, }: { readonly account: LimitAccount; readonly window: LimitPoolMember["window"]; @@ -232,6 +234,7 @@ function PoolSegment({ readonly now: number; /** 1-based position in the bar, shown on the strip and its legend row to tie them together. */ readonly index: number; + readonly showAccountName: boolean; }) { const [open, setOpen] = useState(false); const remaining = remainingPercent(window); @@ -274,7 +277,12 @@ function PoolSegment({ {index}
- + {showAccountName ? ( + + ) : null} {remaining}% {/* Countdown and badge get their own plate: fill and hatching run under them otherwise. */} @@ -463,6 +471,7 @@ function PoolBar({ color={color} now={now} index={position + 1} + showAccountName={pool.columns.length > 1} /> ) : null, )} @@ -479,17 +488,21 @@ function PoolWindowCard({ pool, color, now, + label, + description, }: { readonly pool: LimitPoolWindow; readonly color: string; readonly now: number; + readonly label?: string | undefined; + readonly description?: string | undefined; }) { // The soonest reset that hands anything back; an untouched account resets to no effect. const nextRefill = pool.resets.find((reset) => reset.restoresPercent > 0); return (
- {pool.label} + {label ?? pool.label} {pool.remainingPercent}% @@ -497,14 +510,16 @@ function PoolWindowCard({ left {pool.pace ? : null} - {nextRefill ? ( - - ↻ +{nextRefill.restoresPercent}%{" "} - {nextRefill.at <= now ? "now" : `in ${formatDuration(nextRefill.at - now)}`} + {nextRefill && pool.columns.length > 1 ? ( + + ↻ +{nextRefill.restoresPercent}% ) : null}
+ {description ? ( +

{description}

+ ) : null}
); } @@ -512,6 +527,7 @@ function PoolWindowCard({ function PoolSection({ pool, now }: { readonly pool: LimitPool; readonly now: number }) { const color = barColor(pool.driver); const label = getDriverOption(pool.driver)?.label ?? String(pool.driver); + const windows = displayLimitWindows(pool); return (

@@ -524,9 +540,19 @@ function PoolSection({ pool, now }: { readonly pool: LimitPool; readonly now: nu /> {label}

- {pool.windows.map((window) => ( - - ))} + {windows.map((window) => { + const details = pool.driver === "cursor" ? cursorUsageWindowDetails(window.id) : undefined; + return ( + + ); + })}
); } @@ -539,22 +565,33 @@ function PoolSection({ pool, now }: { readonly pool: LimitPool; readonly now: nu export function UsageLimitsPooled({ presentations, now, + cursorPrompt, }: { readonly presentations: Parameters[0]; readonly now: number; + readonly cursorPrompt?: ReactNode; }) { const pools = collectLimitPools(collectLimitAccounts(presentations), now); const notices = collectLimitNotices(presentations); + const cursorPromptAt = + Math.max( + pools.findIndex((pool) => pool.driver === "codex"), + pools.findIndex((pool) => pool.driver === "claudeAgent"), + ) + 1; return (
- {pools.length === 0 && notices.length === 0 ? ( + {pools.length === 0 && notices.length === 0 && !cursorPrompt ? (

No provider on the selected environments reports subscription limits.

) : null} - {pools.map((pool) => ( - + {pools.map((pool, index) => ( + + {index === cursorPromptAt ? cursorPrompt : null} + + ))} + {cursorPromptAt === pools.length ? cursorPrompt : null}
); diff --git a/apps/web/src/components/usage/UsagePage.tsx b/apps/web/src/components/usage/UsagePage.tsx index b3748e120d1d..1387bb3a9d9e 100644 --- a/apps/web/src/components/usage/UsagePage.tsx +++ b/apps/web/src/components/usage/UsagePage.tsx @@ -1,6 +1,7 @@ import { RefreshIcon } from "~/components/ui/refresh-icon"; import { useAtomValue } from "@effect/atom-react"; import { + ProviderDriverKind, USAGE_CONTRACT_VERSION, type EnvironmentId, type UsageProviderKind, @@ -40,6 +41,7 @@ import { makeWindow, } from "@t3tools/shared/usageFormat"; import { Button, InlineButton } from "../ui/button"; +import { ProviderInstanceIcon } from "../chat/ProviderInstanceIcon"; import { Menu, MenuCheckboxItem, @@ -53,6 +55,7 @@ import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ import { SidebarInset } from "../ui/sidebar"; import { Skeleton } from "../ui/skeleton"; import { Toggle, ToggleGroup } from "../ui/toggle-group"; +import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { WorkspaceBreadcrumb, WorkspaceBreadcrumbItem, @@ -118,6 +121,25 @@ export function UsagePage() { selectedEnvironmentIds, ); const presentations = useAtomValue(environmentPresentations.presentationsAtom); + const cursorAccessEnvironments = selectedEnvironments.filter((environment) => + environment.summary?.sources.some((source) => source.action === "enableCursorKeychain"), + ); + const sourceMessages = [ + ...new Set( + selectedEnvironments.flatMap( + (environment) => + environment.summary?.sources.flatMap((source) => + source.message && + !source.action && + (source.status === "partial" || + source.status === "failed" || + source.fingerprint.provider === "cursor") + ? [source.message] + : [], + ) ?? [], + ), + ), + ]; const refreshProviders = useAtomCommand(serverEnvironment.refreshProviders, { reportFailure: false, }); @@ -147,6 +169,17 @@ export function UsagePage() { [breakdown, merged.models, metric], ); const activeProviders = useMemo(() => providersWithUsage(merged.providers), [merged.providers]); + const summaryRows: Array< + | { readonly kind: "usage"; readonly provider: UsageProviderKind } + | { readonly kind: "enable"; readonly environment: EnvironmentUsageStatus } + > = activeProviders.map((provider) => ({ kind: "usage", provider })); + const cursorInsertAt = + Math.max(activeProviders.indexOf("codex"), activeProviders.indexOf("claude")) + 1; + summaryRows.splice( + cursorInsertAt, + 0, + ...cursorAccessEnvironments.map((environment) => ({ kind: "enable" as const, environment })), + ); const timeValueColumnWidth = `${60 / (activeProviders.length + 2)}%`; const selectWindow = (days: number) => { @@ -165,7 +198,7 @@ export function UsagePage() { setPreferences(nextPreferences); saveUsagePagePreferences(nextPreferences); }; - const refreshLimits = async (automatic = false) => { + const refreshLimits = async (automatic = false, afterPending = false) => { try { await Promise.all( Array.from(presentations, ([environmentId, presentation]) => { @@ -175,6 +208,7 @@ export function UsagePage() { environmentId, () => refreshProviders({ environmentId, input: {} }), automatic, + afterPending, ); } }), @@ -380,11 +414,30 @@ export function UsagePage() { : `Select an environment to see ${showingLimits ? "limits" : "usage"}.`}

) : showingLimits ? ( - + 0 ? ( + { + void refresh(); + void refreshLimits(false, true); + }} + /> + ) : null + } + /> ) : isPending ? ( ) : ( <> + {sourceMessages.map((message) => ( +

+ {message} +

+ ))}
@@ -404,7 +457,22 @@ export function UsagePage() {
- {activeProviders.map((provider) => { + {summaryRows.map((row) => { + if (row.kind === "enable") { + return ( + 1} + onEnabled={() => { + void refresh(); + void refreshLimits(false, true); + }} + /> + ); + } + const provider = row.provider; const totals = merged.providers.find((entry) => entry.provider === provider); const share = metric === "cost" ? (totals?.costShare ?? 0) : (totals?.tokenShare ?? 0); @@ -636,6 +704,137 @@ export function UsagePage() { ); } +const CURSOR_KEYCHAIN_COPY = "Requires access to your Cursor login in macOS Keychain."; + +function CursorEnableButton({ + environmentId, + label, + onEnabled, + tooltip, + buttonText = "Enable", +}: { + readonly environmentId: EnvironmentId; + readonly label: string; + readonly onEnabled: () => void; + readonly tooltip: boolean; + readonly buttonText?: string; +}) { + const updateSettings = useAtomCommand(serverEnvironment.updateSettings, { + label: "enable Cursor account usage", + }); + const [pending, setPending] = useState(false); + const enable = async () => { + setPending(true); + try { + const result = await updateSettings({ + environmentId, + input: { patch: { cursorKeychainUsageEnabled: true } }, + }); + if (result._tag === "Success") onEnabled(); + } finally { + setPending(false); + } + }; + const button = tooltip ? ( + void enable()} + > + {buttonText} + + ) : ( + + ); + if (!tooltip) return button; + return ( + + + {CURSOR_KEYCHAIN_COPY} + + ); +} + +function CursorEnableRow({ + environmentId, + label, + showEnvironment, + onEnabled, +}: { + readonly environmentId: EnvironmentId; + readonly label: string; + readonly showEnvironment: boolean; + readonly onEnabled: () => void; +}) { + return ( +
+ + + + Cursor{showEnvironment ? ` · ${label}` : ""} + + +
+ ); +} + +function CursorEnableLimits({ + environments, + onEnabled, +}: { + readonly environments: readonly EnvironmentUsageStatus[]; + readonly onEnabled: () => void; +}) { + return ( +
+

+ + Cursor +

+
+

{CURSOR_KEYCHAIN_COPY}

+
+ {environments.map((environment) => ( + 1 ? `Enable on ${environment.label}` : "Enable"} + onEnabled={onEnabled} + tooltip={false} + /> + ))} +
+
+
+ ); +} + /** Brand mark for the harness a row belongs to. */ function ProviderMark({ provider, diff --git a/apps/web/src/components/usage/UsageProviderChart.test.ts b/apps/web/src/components/usage/UsageProviderChart.test.ts index 622d73d13844..e3060dbaefd3 100644 --- a/apps/web/src/components/usage/UsageProviderChart.test.ts +++ b/apps/web/src/components/usage/UsageProviderChart.test.ts @@ -89,6 +89,9 @@ describe("buildPeriodColumns", () => { { provider: "codex", value: 10 }, { provider: "claude", value: 20 }, { provider: "grok", value: 0 }, + { provider: "cursor", value: 0 }, + { provider: "opencode", value: 0 }, + { provider: "antigravity", value: 0 }, ]); }); diff --git a/apps/web/src/components/usage/usageProviders.ts b/apps/web/src/components/usage/usageProviders.ts index efad95e531ad..38b78cbcdb04 100644 --- a/apps/web/src/components/usage/usageProviders.ts +++ b/apps/web/src/components/usage/usageProviders.ts @@ -1,6 +1,14 @@ import type { UsageProviderKind } from "@t3tools/contracts"; -import { ClaudeAI, GrokIcon, type Icon, OpenAI } from "../Icons"; +import { + AntigravityIcon, + ClaudeAI, + CursorIcon, + GrokIcon, + type Icon, + OpenAI, + OpenCodeIcon, +} from "../Icons"; type UsageProviderPresentation = { readonly label: string; @@ -30,6 +38,9 @@ export const PROVIDER_PRESENTATION = { color: "color-mix(in oklab, var(--contrast-foreground) 72%, var(--background))", mark: GrokIcon, }, + cursor: { label: "Cursor", color: "#8b8b8b", mark: CursorIcon }, + opencode: { label: "OpenCode", color: "#5b9bbd", mark: OpenCodeIcon }, + antigravity: { label: "Antigravity", color: "#8c7bd1", mark: AntigravityIcon }, } satisfies Record; /** Stable provider reading order across charts, summaries, tables, and hover rows. */ diff --git a/docs/user/usage.md b/docs/user/usage.md index 5da542b26a26..ab77f70a6b3a 100644 --- a/docs/user/usage.md +++ b/docs/user/usage.md @@ -6,13 +6,25 @@ desktop when the terminal is not focused. Customize `usage.open` in ## Understand your usage -**Usage** combines Codex, Claude Code, and Grok Build session history from your connected +**Usage** combines Codex, Claude Code, Grok Build, OpenCode, Antigravity, and Cursor history from your connected environments. It shows token use, cache savings, model breakdowns, and estimated API-equivalent cost. These estimates are not your subscription bill. Totals depend on the history available on each server. Grok turns without a saved completed-turn record are missing from the totals. +OpenCode reads its SQLite database and older JSON history. Antigravity reads local conversation +databases, including T3-managed profiles. Set `OPENCODE_DATA_DIR` or `ANTIGRAVITY_DATA_DIR` on the +server to read a different data directory; comma-separated paths read multiple directories. + +Cursor reads account usage from Cursor's dashboard API using the CLI login saved on the server. +This includes headless T3 sessions and desktop usage across machines; the same account counts +once across connected environments. Without an accessible CLI login, T3 shows a +notice instead of incomplete local totals. T3 does not estimate missing tokens from conversation text. +On macOS, choose **Enable Cursor usage** on Usage to allow T3 to read your existing CLI login +from Keychain. You can turn it off in **Settings → Providers → Usage providers**. macOS may ask +you to allow access on the server Mac. + Usage includes each configured account's history, including disabled accounts. Custom homes follow the account's home setting or its `CODEX_HOME`, `CLAUDE_CONFIG_DIR`, or `GROK_HOME` environment variable. Use absolute paths or `~/` paths in the account's environment settings; relative @@ -78,10 +90,10 @@ anything. The command is offered only for providers that appear under **Usage OpenCode Go reports its session, weekly, and monthly allowance when OpenCode runs locally in the environment. T3 cannot report limits for external OpenCode servers because their credentials belong to the remote server. Cursor reports -its monthly allowance, including separate Auto and API usage, using a file-based CLI login or -`CURSOR_AUTH_TOKEN`. Cursor's default macOS keychain login does not currently report limits. -On macOS, use `AGENT_CLI_CREDENTIAL_STORE=file` when signing in and in the provider's environment -to use a file-based login. +its monthly allowance, including separate Auto and API usage, using the CLI login or +`CURSOR_AUTH_TOKEN`. On macOS, this includes the default Keychain login after you enable Cursor +usage. Keychain login is used for limits only with Cursor's default API endpoint. If you configure +a custom Cursor endpoint, use an explicit token or file-based CLI login for limits. Grok reports the remaining subscription allowance and reset time for its current billing period after signing in with `grok login`. Explicit `XAI_API_KEY` connections and custom authentication diff --git a/packages/client-runtime/src/state/server.ts b/packages/client-runtime/src/state/server.ts index a7476ec17157..5919c0af263a 100644 --- a/packages/client-runtime/src/state/server.ts +++ b/packages/client-runtime/src/state/server.ts @@ -933,6 +933,14 @@ export function createServerEnvironmentAtoms( ); }).pipe(Atom.withLabel(`environment-data:server:usage-prices:${environmentId}`)), ); + const usageScanSettingsAtom = Atom.family((environmentId: EnvironmentId) => + Atom.make((get) => + JSON.stringify([ + get(usagePricesAtom(environmentId)), + get(settingsValueAtom(environmentId))?.cursorKeychainUsageEnabled ?? false, + ]), + ).pipe(Atom.withLabel(`environment-data:server:usage-scan-settings:${environmentId}`)), + ); const providersValueAtom = Atom.family((environmentId: EnvironmentId) => Atom.make((get) => get(configValueAtom(environmentId))?.providers ?? null).pipe( Atom.withLabel(`environment-data:server:providers:${environmentId}`), @@ -1050,7 +1058,7 @@ export function createServerEnvironmentAtoms( label: "environment-data:server:usage-summary", tag: WS_METHODS.serverGetUsageSummary, staleTimeMs: 60_000, - refreshTrigger: ({ environmentId }) => usagePricesAtom(environmentId), + refreshTrigger: ({ environmentId }) => usageScanSettingsAtom(environmentId), }), configProjection, welcome, diff --git a/packages/client-runtime/src/state/usage.test.ts b/packages/client-runtime/src/state/usage.test.ts index 98eb46e13ca8..75977d20de74 100644 --- a/packages/client-runtime/src/state/usage.test.ts +++ b/packages/client-runtime/src/state/usage.test.ts @@ -184,6 +184,19 @@ describe("manual usage refresh", () => { }); describe("limits refresh cooldown", () => { + it("runs a fresh check after an in-flight check when settings change", async () => { + const id = EnvironmentId.make("limits-after-enable"); + const oldCheck = Promise.withResolvers(); + const first = refreshUsageLimits(id, () => oldCheck.promise, true); + const newCheck = vi.fn(async () => "new limits"); + const afterEnable = refreshUsageLimits(id, newCheck, false, true); + expect(newCheck).not.toHaveBeenCalled(); + oldCheck.resolve("old limits"); + expect(await first).toBe("old limits"); + expect(await afterEnable).toBe("new limits"); + expect(newCheck).toHaveBeenCalledTimes(1); + }); + it("joins manual calls and gates automatic refreshes after success or failure", async () => { const clock = vi.spyOn(Date, "now").mockReturnValue(1_000); try { diff --git a/packages/client-runtime/src/state/usage.ts b/packages/client-runtime/src/state/usage.ts index 8a2b1a44a951..11cfd26fbe6c 100644 --- a/packages/client-runtime/src/state/usage.ts +++ b/packages/client-runtime/src/state/usage.ts @@ -16,9 +16,18 @@ export async function refreshUsageLimits( environmentId: EnvironmentId, refresh: () => Promise, automatic = false, + afterPending = false, ): Promise { const pending = limitsRefreshes.get(environmentId); if (pending !== undefined) { + if (afterPending) { + try { + await pending; + } catch { + // The new check still needs to run if the earlier one failed. + } + return refreshUsageLimits(environmentId, refresh, false, true); + } // Manual refresh waits for the current check; automatic refresh does not repeat it. return automatic ? undefined : ((await pending) as A); } diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts index 94bc27734923..a8cce4487549 100644 --- a/packages/contracts/src/settings.ts +++ b/packages/contracts/src/settings.ts @@ -1277,6 +1277,10 @@ export const ServerSettings = Schema.Struct({ usageLimitSources: Schema.Record(UsageLimitSourceId, UsageLimitSourceConfig).pipe( Schema.withDecodingDefault(Effect.succeed({})), ), + /** Allows this server to read the Cursor CLI's macOS Keychain login for account usage. */ + cursorKeychainUsageEnabled: Schema.Boolean.pipe( + Schema.withDecodingDefault(Effect.succeed(false)), + ), /** Exact model IDs, applied to past and future usage on this environment. */ usagePriceOverrides: Schema.Record(TrimmedNonEmptyString, UsageModelPriceOverride).pipe( Schema.withDecodingDefault(Effect.succeed({})), @@ -1550,6 +1554,7 @@ export const ServerSettingsPatch = Schema.Struct({ usageLimitSources: Schema.optionalKey( Schema.Record(UsageLimitSourceId, Schema.NullOr(UsageLimitSourceConfig)), ), + cursorKeychainUsageEnabled: Schema.optionalKey(Schema.Boolean), /** Each entry replaces one model's rates; `null` restores automatic pricing. */ usagePriceOverrides: Schema.optionalKey( Schema.Record(TrimmedNonEmptyString, Schema.NullOr(UsageModelPriceOverride)), diff --git a/packages/contracts/src/usage.ts b/packages/contracts/src/usage.ts index 29fb75bf949c..a6431330558a 100644 --- a/packages/contracts/src/usage.ts +++ b/packages/contracts/src/usage.ts @@ -1,13 +1,10 @@ /** * Usage reporting contract. * - * Each environment scans the provider CLIs' own on-disk session transcripts - * (`~/.claude/projects/**\/*.jsonl`, `~/.codex/sessions/**\/*.jsonl`, - * `~/.grok/sessions/**\/updates.jsonl`) rather than relying on T3 Code's own - * orchestration projections, so usage stays complete even for turns that were - * never driven through T3 Code. This mirrors the approach `ccusage` takes. + * Each environment scans native session files and databases, including work + * driven outside T3 Code. Source status describes gaps in local coverage. * - * Environments return pre-aggregated `(day, hourStart?, provider, model)` + * Environments return pre-aggregated `(day, hourStart?, provider, model, sourcePath?)` * buckets. Raw transcript records never cross the wire. * * @module usage @@ -21,18 +18,24 @@ import { NonNegativeInt, TrimmedNonEmptyString } from "./baseSchemas.ts"; * client renders partial coverage when an environment reports an older version * rather than failing the whole page. */ -export const USAGE_CONTRACT_VERSION = 5 as const; +export const USAGE_CONTRACT_VERSION = 6 as const; /** * Oldest {@link UsageSummary} version a current client will still merge. * - * v5 only adds `grok` to {@link UsageProviderKind}; v4 Claude/Codex buckets - * remain valid, so mixed-version environments keep those totals instead of - * treating every older server as stale. + * v5/v6 add providers and optional source attribution; v4 Claude/Codex + * buckets remain valid in mixed-version environments. */ export const USAGE_MERGE_COMPATIBLE_SINCE = 4 as const; -export const UsageProviderKind = Schema.Literals(["claude", "codex", "grok"]); +export const UsageProviderKind = Schema.Literals([ + "claude", + "codex", + "grok", + "cursor", + "opencode", + "antigravity", +]); export type UsageProviderKind = typeof UsageProviderKind.Type; /** @@ -93,6 +96,8 @@ export const UsageBucket = Schema.Struct({ hourStart: Schema.optional(TrimmedNonEmptyString), provider: UsageProviderKind, model: TrimmedNonEmptyString, + /** Source directory, so overlapping multi-home environments merge once per source. */ + sourcePath: Schema.optional(TrimmedNonEmptyString), totals: UsageTokenTotals, costUsd: Schema.Number, /** @@ -151,6 +156,8 @@ export const UsageSource = Schema.Struct({ */ distinctSessions: NonNegativeInt, message: Schema.NullOr(TrimmedNonEmptyString), + /** An action the client can offer to make this source available. */ + action: Schema.optionalKey(Schema.Literal("enableCursorKeychain")), }); export type UsageSource = typeof UsageSource.Type; diff --git a/packages/shared/src/usageFormat.test.ts b/packages/shared/src/usageFormat.test.ts index 3e92d0b3cb85..3a47ede3bcc8 100644 --- a/packages/shared/src/usageFormat.test.ts +++ b/packages/shared/src/usageFormat.test.ts @@ -5,10 +5,22 @@ import { enumerateHourStarts, formatDateTimeShort, formatHourShort, + formatPercent, formatRelativeHourShort, makeWindow, } from "./usageFormat.ts"; +describe("formatPercent", () => { + it("distinguishes a small positive share from zero", () => { + expect(formatPercent(0)).toBe("0.0%"); + expect(formatPercent(0.0004)).toBe("<0.1%"); + expect(formatPercent(0.0009)).toBe("<0.1%"); + expect(formatPercent(0.001)).toBe("0.1%"); + expect(formatPercent(0.023)).toBe("2.3%"); + expect(formatPercent(0.00004, 2)).toBe("<0.01%"); + }); +}); + describe("hourly usage formatting", () => { it("keeps requested zones separate when formatting repeated calls", () => { const instant = "2026-08-11T12:37:00.000Z"; diff --git a/packages/shared/src/usageFormat.ts b/packages/shared/src/usageFormat.ts index 442687308323..328e0cf814e7 100644 --- a/packages/shared/src/usageFormat.ts +++ b/packages/shared/src/usageFormat.ts @@ -43,7 +43,10 @@ function trim(value: number): string { } export function formatPercent(share: number, digits = 1): string { - return `${(share * 100).toFixed(digits)}%`; + const percent = share * 100; + const smallest = 10 ** -digits; + if (percent > 0 && percent < smallest) return `<${smallest.toFixed(digits)}%`; + return `${percent.toFixed(digits)}%`; } /** `2026-08-07` to `Aug 7`. */ diff --git a/packages/shared/src/usageLimits.test.ts b/packages/shared/src/usageLimits.test.ts index 0ef53b1e7f55..0646953a5f08 100644 --- a/packages/shared/src/usageLimits.test.ts +++ b/packages/shared/src/usageLimits.test.ts @@ -16,6 +16,7 @@ import { collectLimitAccounts, collectLimitNotices, collectLimitPools, + displayLimitWindows, elapsedShare, formatResetsIn, limitsNotice, @@ -687,6 +688,53 @@ describe("pooled account columns", () => { }); }); +describe("Cursor limit presentation", () => { + const cursorAccount: LimitAccount = { + key: "cursor", + driver: ProviderDriverKind.make("cursor"), + displayName: "Cursor", + email: undefined, + plan: undefined, + accentColor: undefined, + environments: [], + sourceLabel: "Cursor", + redeem: null, + limits: { + checkedAt: "2026-09-03T11:00:00.000Z", + windows: [ + { id: "apiPercentUsed", kind: "monthly", label: "Other Models", usedPercent: 49 }, + { id: "autoPercentUsed", kind: "monthly", label: "Cursor Models", usedPercent: 9 }, + { id: "totalPercentUsed", kind: "monthly", label: "Overall", usedPercent: 15 }, + ], + }, + }; + + it("hides the combined percentage and orders the two pools", () => { + const [pool] = collectLimitPools([cursorAccount], now); + const display = displayLimitWindows(pool!); + expect(display.map((window) => window.id)).toEqual(["autoPercentUsed", "apiPercentUsed"]); + }); + + it("keeps the combined percentage as a card if either allowance is missing", () => { + const [pool] = collectLimitPools( + [ + { + ...cursorAccount, + limits: { + ...cursorAccount.limits, + windows: cursorAccount.limits.windows.filter( + (window) => window.id !== "apiPercentUsed", + ), + }, + }, + ], + now, + ); + const display = displayLimitWindows(pool!); + expect(display.map((window) => window.id)).toEqual(["totalPercentUsed", "autoPercentUsed"]); + }); +}); + describe("collectLimitNotices", () => { const checkedAt = "2026-09-03T11:00:00.000Z"; const claude = ProviderDriverKind.make("claudeAgent"); diff --git a/packages/shared/src/usageLimits.ts b/packages/shared/src/usageLimits.ts index 17ba1feab5d6..f2b5cfe53b84 100644 --- a/packages/shared/src/usageLimits.ts +++ b/packages/shared/src/usageLimits.ts @@ -24,6 +24,33 @@ const MINUTE = 60_000; const HOUR = 60 * MINUTE; const DAY = 24 * HOUR; +export const CURSOR_USAGE_WINDOWS = [ + { + id: "totalPercentUsed", + label: "Overall", + description: "Combined usage across both allowances, not a third quota.", + }, + { + id: "autoPercentUsed", + label: "Cursor Models", + description: "Grok and Composer use this first. Auto can use either pool.", + }, + { + id: "apiPercentUsed", + label: "Other Models", + description: "Claude, GPT, and Gemini use this pool. Grok and Composer fall back here.", + }, +] as const; + +export function cursorUsageWindowDetails(id: string) { + return CURSOR_USAGE_WINDOWS.find((window) => window.id === id); +} + +function cursorUsageWindowRank(id: string): number { + const rank = CURSOR_USAGE_WINDOWS.findIndex((window) => window.id === id); + return rank < 0 ? CURSOR_USAGE_WINDOWS.length : rank; +} + /** * Providers that belong on the Limits view: enabled, installed, and one whose * driver reports subscription usage at all. A driver with no notion of usage @@ -282,6 +309,17 @@ export interface LimitPool { readonly windows: readonly LimitPoolWindow[]; } +/** Show Cursor's two usable pools instead of a combined percentage when both are available. */ +export function displayLimitWindows(pool: LimitPool) { + if (pool.driver !== "cursor") return pool.windows; + const hasAuto = pool.windows.some((window) => window.id === "autoPercentUsed"); + const hasApi = pool.windows.some((window) => window.id === "apiPercentUsed"); + const hasBothPools = hasAuto && hasApi; + return pool.windows + .filter((window) => !hasBothPools || window.id !== "totalPercentUsed") + .sort((left, right) => cursorUsageWindowRank(left.id) - cursorUsageWindowRank(right.id)); +} + const WINDOW_KIND_ORDER: Record = { session: 0, weekly: 1, diff --git a/packages/shared/src/usageMerge.test.ts b/packages/shared/src/usageMerge.test.ts index 668d8bcc2723..178282238482 100644 --- a/packages/shared/src/usageMerge.test.ts +++ b/packages/shared/src/usageMerge.test.ts @@ -1,5 +1,6 @@ import { USAGE_CONTRACT_VERSION, + USAGE_MERGE_COMPATIBLE_SINCE, type EnvironmentId, type UsageBucket, type UsageDay, @@ -74,6 +75,41 @@ function environment(id: string, usageSummary: UsageSummary): EnvironmentUsage { } describe("mergeUsage", () => { + it("counts a Cursor account once across servers while retaining each server's other providers", () => { + const account = { + provider: "cursor" as const, + hostId: "cursor.com", + homePath: "cursor-account:account-hash", + volumeId: "account-hash", + }; + const merged = mergeUsage( + [ + environment( + "mac", + summary([bucket({ provider: "cursor", sourcePath: account.homePath })], [account]), + ), + environment( + "linux", + summary( + [ + bucket({ provider: "cursor", sourcePath: account.homePath }), + bucket({ provider: "opencode", sourcePath: "/opencode" }), + ], + [account, { provider: "opencode", hostId: "linux", homePath: "/opencode" }], + ), + ), + ], + USAGE_CONTRACT_VERSION, + ); + expect( + merged.providers.map((provider) => [provider.provider, provider.costUsd]).sort(), + ).toEqual([ + ["cursor", 10], + ["opencode", 10], + ]); + expect(merged.duplicateSources).toHaveLength(1); + }); + it("sums environments that read different transcript directories", () => { const merged = mergeUsage( [ @@ -146,6 +182,31 @@ describe("mergeUsage", () => { ).toEqual({ claude: 1, codex: 1 }); }); + it("counts overlapping provider roots once while keeping each environment's unique root", () => { + const source = (homePath: string) => ({ + provider: "opencode" as const, + hostId: "host", + homePath, + }); + const usage = (sourcePath: string, costUsd: number) => + bucket({ provider: "opencode", sourcePath, costUsd }); + const merged = mergeUsage( + [ + environment( + "env-a", + summary([usage("/shared", 10), usage("/a", 2)], [source("/shared"), source("/a")]), + ), + environment( + "env-b", + summary([usage("/shared", 10), usage("/b", 3)], [source("/shared"), source("/b")]), + ), + ], + USAGE_CONTRACT_VERSION, + ); + expect(merged.costUsd).toBe(15); + expect(merged.sessions).toBe(3); + }); + it("uses the newest scan when environments share the same transcript directory", () => { const source = { provider: "claude" as const, hostId: "mac", homePath: "/home/theo/.claude" }; const environments = [ @@ -166,6 +227,104 @@ describe("mergeUsage", () => { } }); + it("prefers a complete scan over a newer partial scan of the same directory", () => { + const source = { provider: "claude" as const, hostId: "mac", homePath: "/home/theo/.claude" }; + const incomplete = summary([bucket({ costUsd: 4, records: 2 })], [source]); + const partial = environment("new", { + ...incomplete, + readAt: "2026-08-07T01:00:00.000Z", + sources: incomplete.sources.map((entry) => ({ ...entry, status: "partial" as const })), + }); + const complete = environment("old", summary([bucket()], [source])); + + for (const ordered of [ + [partial, complete], + [complete, partial], + ]) { + const merged = mergeUsage(ordered, USAGE_CONTRACT_VERSION); + expect(merged.costUsd).toBe(10); + expect(merged.contributingEnvironments).toEqual(["old"]); + expect(merged.duplicateSources).toEqual(["new: /home/theo/.claude"]); + } + expect(mergeUsage([partial], USAGE_CONTRACT_VERSION).costUsd).toBe(4); + }); + + it("keeps new cells from a later partial scan without recounting older cells", () => { + const source = { provider: "claude" as const, hostId: "mac", homePath: "/home/theo/.claude" }; + const complete = environment( + "old", + summary([bucket()], [source], USAGE_MERGE_COMPATIBLE_SINCE), + ); + const partialSummary = summary( + [ + bucket({ sourcePath: source.homePath, costUsd: 4, records: 2 }), + bucket({ + day: "2026-08-08" as UsageDay, + sourcePath: source.homePath, + costUsd: 3, + records: 1, + }), + ], + [{ ...source, distinctSessions: 2 }], + ); + const partial = environment("new", { + ...partialSummary, + readAt: "2026-08-08T01:00:00.000Z", + sources: partialSummary.sources.map((entry) => ({ ...entry, status: "partial" as const })), + }); + + for (const ordered of [ + [complete, partial], + [partial, complete], + ]) { + const merged = mergeUsage(ordered, USAGE_CONTRACT_VERSION); + expect(merged.costUsd).toBe(13); + expect(merged.records).toBe(6); + expect(merged.sessions).toBe(2); + expect(merged.daily.map(({ day, costUsd }) => [day, costUsd])).toEqual([ + ["2026-08-07", 10], + ["2026-08-08", 3], + ]); + expect(merged.contributingEnvironments).toEqual( + ordered.map(({ environmentId }) => environmentId), + ); + expect(merged.duplicateSources).toEqual(["new: /home/theo/.claude"]); + } + }); + + it("retains a complete cell when a larger partial cell may have skipped old records", () => { + const source = { provider: "claude" as const, hostId: "mac", homePath: "/home/theo/.claude" }; + const complete = environment("old", summary([bucket()], [source])); + const partialSummary = summary( + [ + bucket({ + costUsd: 4, + records: 6, + totals: { + uncachedInputTokens: 80, + cachedInputTokens: 500, + cacheCreationTokens: 10, + outputTokens: 30, + reasoningTokens: 0, + }, + }), + ], + [{ ...source, distinctSessions: 2 }], + ); + const partial = environment("new", { + ...partialSummary, + readAt: "2026-08-07T01:00:00.000Z", + sources: partialSummary.sources.map((entry) => ({ ...entry, status: "partial" as const })), + }); + + const merged = mergeUsage([complete, partial], USAGE_CONTRACT_VERSION); + expect(merged.costUsd).toBe(10); + expect(merged.totalTokens).toBe(1160); + expect(merged.records).toBe(5); + expect(merged.sessions).toBe(1); + expect(merged.contributingEnvironments).toEqual(["old"]); + }); + it("excludes an environment reporting an older contract version", () => { const merged = mergeUsage( [ @@ -178,7 +337,7 @@ describe("mergeUsage", () => { summary( [bucket()], [{ provider: "claude", hostId: "linux", homePath: "/b" }], - USAGE_CONTRACT_VERSION - 2, + USAGE_MERGE_COMPATIBLE_SINCE - 1, ), ), ], diff --git a/packages/shared/src/usageMerge.ts b/packages/shared/src/usageMerge.ts index fee8e9c95666..c4a56829a420 100644 --- a/packages/shared/src/usageMerge.ts +++ b/packages/shared/src/usageMerge.ts @@ -11,6 +11,7 @@ import { type EnvironmentId, type UsageBucket, type UsageProviderKind, + type UsageSource, type UsageSourceFingerprint, type UsageSummary, } from "@t3tools/contracts"; @@ -113,20 +114,46 @@ function fingerprintKey(fingerprint: UsageSourceFingerprint): string { ].join(" "); } +function bucketsForSource(summary: UsageSummary, source: UsageSource): readonly UsageBucket[] { + const providerSources = summary.sources.filter( + (entry) => entry.fingerprint.provider === source.fingerprint.provider, + ); + return summary.buckets.filter( + (bucket) => + bucket.provider === source.fingerprint.provider && + (bucket.sourcePath === source.fingerprint.resolvedHomePath || + (bucket.sourcePath === undefined && providerSources.length === 1)), + ); +} + +function bucketKey(bucket: UsageBucket): string { + return JSON.stringify([bucket.day, bucket.hourStart ?? null, bucket.provider, bucket.model]); +} + /** * Decides which environment owns each physical transcript directory. * * Several environments on one machine (worktree servers, for instance) resolve * the same provider home and would otherwise double count every token. The - * most recently read summary claims a fingerprint; the rest have that provider's - * buckets dropped. Environment ids break ties so the winner is stable when - * summaries have the same read time. + * Complete scans claim a fingerprint ahead of partial scans, then the most + * recently read scan wins within each status. A newer partial scan can still + * contribute cells absent from an older complete scan. Environment ids break + * ties so the result is stable when summaries have the same read time. */ function claimSources(environments: readonly EnvironmentUsage[]): { readonly ownerByFingerprint: ReadonlyMap; + readonly supplementalBucketsByEnvironment: ReadonlyMap>; + readonly sessionsByFingerprint: ReadonlyMap; readonly duplicates: readonly string[]; } { const ownerByFingerprint = new Map(); + const ownerScanByFingerprint = new Map< + string, + { environment: EnvironmentUsage; source: UsageSource } + >(); + const seenBucketKeysByFingerprint = new Map>(); + const supplementalBucketsByEnvironment = new Map>(); + const sessionsByFingerprint = new Map(); const duplicates: string[] = []; const ordered = [...environments].sort( @@ -135,30 +162,82 @@ function claimSources(environments: readonly EnvironmentUsage[]): { a.environmentId.localeCompare(b.environmentId), ); + // A complete scan takes precedence over a newer partial scan of the same + // directory. Partial history still contributes when no complete copy exists. + for (const status of ["ok", "partial", "failed"] as const) { + for (const environment of ordered) { + for (const source of environment.summary.sources) { + if (source.status !== status) continue; + const key = fingerprintKey(source.fingerprint); + if (ownerByFingerprint.has(key)) { + duplicates.push(`${environment.label}: ${source.fingerprint.resolvedHomePath}`); + continue; + } + ownerByFingerprint.set(key, environment.environmentId); + ownerScanByFingerprint.set(key, { environment, source }); + sessionsByFingerprint.set(key, source.distinctSessions); + } + } + } + + // A newer partial scan may contain usage recorded after an older complete + // scan. Keep cells absent from the complete scan. Aggregated cells do not + // reveal enough to reconcile overlapping records without double counting. for (const environment of ordered) { for (const source of environment.summary.sources) { - if (source.status === "missing") continue; + if (source.status !== "partial") continue; const key = fingerprintKey(source.fingerprint); - if (ownerByFingerprint.has(key)) { - duplicates.push(`${environment.label}: ${source.fingerprint.resolvedHomePath}`); + const owner = ownerScanByFingerprint.get(key); + if ( + owner?.source.status !== "ok" || + Date.parse(environment.summary.readAt) <= Date.parse(owner.environment.summary.readAt) + ) { continue; } - ownerByFingerprint.set(key, environment.environmentId); + let seen = seenBucketKeysByFingerprint.get(key); + if (seen === undefined) { + seen = new Set(bucketsForSource(owner.environment.summary, owner.source).map(bucketKey)); + seenBucketKeysByFingerprint.set(key, seen); + } + const supplemental = + supplementalBucketsByEnvironment.get(environment.environmentId) ?? new Set(); + let added = false; + for (const bucket of bucketsForSource(environment.summary, source)) { + const cell = bucketKey(bucket); + if (seen.has(cell)) continue; + seen.add(cell); + supplemental.add(bucket); + added = true; + } + if (!added) continue; + supplementalBucketsByEnvironment.set(environment.environmentId, supplemental); + sessionsByFingerprint.set( + key, + Math.max(sessionsByFingerprint.get(key) ?? 0, source.distinctSessions), + ); } } - return { ownerByFingerprint, duplicates }; + return { + ownerByFingerprint, + supplementalBucketsByEnvironment, + sessionsByFingerprint, + duplicates, + }; } /** Sources this environment owns after fingerprint claims, plus their buckets. */ function ownedContribution( environment: EnvironmentUsage, ownerByFingerprint: ReadonlyMap, + supplementalBuckets: ReadonlySet, + sessionsByFingerprint: ReadonlyMap, ): { readonly buckets: readonly UsageBucket[]; readonly sessionsByProvider: ReadonlyMap; } { const ownedProviders = new Set(); + const ownedSources = new Set(); const sessionsByProvider = new Map(); for (const source of environment.summary.sources) { if (source.status === "missing") continue; @@ -166,16 +245,24 @@ function ownedContribution( if (ownerByFingerprint.get(key) === environment.environmentId) { const provider = source.fingerprint.provider; ownedProviders.add(provider); + ownedSources.add(`${provider}\u0000${source.fingerprint.resolvedHomePath}`); // Distinct within a directory. Summing per-bucket session counts instead // would count a session once per day and model it spans. sessionsByProvider.set( provider, - (sessionsByProvider.get(provider) ?? 0) + source.distinctSessions, + (sessionsByProvider.get(provider) ?? 0) + + (sessionsByFingerprint.get(key) ?? source.distinctSessions), ); } } return { - buckets: environment.summary.buckets.filter((bucket) => ownedProviders.has(bucket.provider)), + buckets: environment.summary.buckets.filter( + (bucket) => + supplementalBuckets.has(bucket) || + (bucket.sourcePath === undefined + ? ownedProviders.has(bucket.provider) + : ownedSources.has(`${bucket.provider}\u0000${bucket.sourcePath}`)), + ), sessionsByProvider, }; } @@ -246,7 +333,12 @@ export function mergeUsage( } } - const { ownerByFingerprint, duplicates } = claimSources(current); + const { + ownerByFingerprint, + supplementalBucketsByEnvironment, + sessionsByFingerprint, + duplicates, + } = claimSources(current); let costUsd = 0; let uncachedInputTokens = 0; @@ -295,7 +387,12 @@ export function mergeUsage( const contributingEnvironments: EnvironmentId[] = []; for (const environment of current) { - const { buckets, sessionsByProvider } = ownedContribution(environment, ownerByFingerprint); + const { buckets, sessionsByProvider } = ownedContribution( + environment, + ownerByFingerprint, + supplementalBucketsByEnvironment.get(environment.environmentId) ?? new Set(), + sessionsByFingerprint, + ); if (buckets.length > 0) contributingEnvironments.push(environment.environmentId); for (const [providerKind, providerSessions] of sessionsByProvider) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1090902dab8b..d512900e23bc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -516,6 +516,9 @@ importers: '@ff-labs/fff-node': specifier: 0.9.4 version: 0.9.4(patch_hash=c4e3cc2420ceb9dc650f9d189e9c24baf7e83f342998bacda5f459a4ce7927a8) + '@napi-rs/keyring': + specifier: ^1.3.0 + version: 1.3.0 '@opencode-ai/sdk': specifier: ^1.3.15 version: 1.15.13 diff --git a/scripts/lib/cli-external-packages.test.ts b/scripts/lib/cli-external-packages.test.ts index ebcc81020bfe..5168e770a114 100644 --- a/scripts/lib/cli-external-packages.test.ts +++ b/scripts/lib/cli-external-packages.test.ts @@ -49,6 +49,7 @@ describe("shouldBundleCliDependency", () => { "ffi-rs", "@yuuang/ffi-rs-win32-x64-msvc", "@ff-labs/fff-node", + "@napi-rs/keyring", "@clerk/electron-passkeys", "node-addon-api", ]) { @@ -82,7 +83,7 @@ describe("selectCliRuntimeExternalDependencies", () => { it("selects every external root declared by the server", () => { assert.deepStrictEqual( Object.keys(selectCliRuntimeExternalDependencies(serverPackageJson.dependencies)).sort(), - ["@ff-labs/fff-node", "node-pty"], + ["@ff-labs/fff-node", "@napi-rs/keyring", "node-pty"], ); }); }); diff --git a/scripts/lib/cli-external-packages.ts b/scripts/lib/cli-external-packages.ts index 5cafee960675..c158ccaff7f4 100644 --- a/scripts/lib/cli-external-packages.ts +++ b/scripts/lib/cli-external-packages.ts @@ -30,6 +30,7 @@ export const CLI_RUNTIME_EXTERNAL_PREFIXES = [ "ffi-rs", "@yuuang/", "@ff-labs/", + "@napi-rs/keyring", "@clerk/electron-passkeys", "node-gyp-build", "node-addon-api", From d06f0ff1048d42a156824765316c5a2dc54f5bca Mon Sep 17 00:00:00 2001 From: Aditya Garud <153842990+yashranaway@users.noreply.github.com> Date: Fri, 25 Sep 2026 20:20:04 +0530 Subject: [PATCH 46/58] fix(sqlite): retry failed statement preparations (#10584) Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com> --- packages/shared/src/nodeSqliteClient.test.ts | 48 ++++++++++++++++++++ packages/shared/src/nodeSqliteClient.ts | 8 ++-- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/packages/shared/src/nodeSqliteClient.test.ts b/packages/shared/src/nodeSqliteClient.test.ts index 25b0ba2d38e8..bbdaa4624901 100644 --- a/packages/shared/src/nodeSqliteClient.test.ts +++ b/packages/shared/src/nodeSqliteClient.test.ts @@ -1,6 +1,10 @@ +import * as NodeSqlite from "node:sqlite"; +import * as NodeServices from "@effect/platform-node/NodeServices"; import { assert, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; +import * as FileSystem from "effect/FileSystem"; import * as Layer from "effect/Layer"; +import * as Path from "effect/Path"; import * as SqlClient from "effect/unstable/sql/SqlClient"; import * as SqliteClient from "./nodeSqliteClient.ts"; @@ -8,6 +12,21 @@ import * as SqliteClient from "./nodeSqliteClient.ts"; const layer = it.layer(SqliteClient.layer({ filename: ":memory:" })); layer("NodeSqliteClient", (it) => { + it.effect("retries preparing a query after the missing schema becomes available", () => + Effect.gen(function* () { + const sql = yield* SqlClient.SqlClient; + const select = sql<{ name: string }>`SELECT name FROM created_after_prepare_failure`; + const error = yield* select.pipe(Effect.flip); + assert.equal(error._tag, "SqlError"); + assert.equal(error.reason.operation, "prepare"); + + yield* sql`CREATE TABLE created_after_prepare_failure(name TEXT NOT NULL)`; + yield* sql`INSERT INTO created_after_prepare_failure VALUES ('recovered')`; + assert.deepEqual(yield* select, [{ name: "recovered" }]); + assert.deepEqual(yield* select.values, [["recovered"]]); + }), + ); + it.effect("runs prepared queries and returns positional values", () => Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; @@ -54,3 +73,32 @@ it.effect("returns a typed failure when the database cannot be opened", () => assert.equal(error.reason.operation, "open"); }), ); + +it.effect( + "recovers a prepared query immediately after an exclusive database lock is released", + () => + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + const directory = yield* fs.makeTempDirectoryScoped({ prefix: "t3-sqlite-prepare-" }); + const filename = path.join(directory, "state.sqlite"); + const blocker = yield* Effect.acquireRelease( + Effect.sync(() => new NodeSqlite.DatabaseSync(filename)), + (database) => Effect.sync(() => database.close()), + ); + yield* Effect.sync(() => { + blocker.exec("CREATE TABLE entries(value TEXT); INSERT INTO entries VALUES ('retained')"); + }); + yield* Effect.gen(function* () { + const sql = yield* SqlClient.SqlClient; + yield* Effect.sync(() => blocker.exec("BEGIN EXCLUSIVE")); + const select = sql`SELECT value FROM entries`; + const error = yield* select.values.pipe(Effect.flip); + assert.equal(error._tag, "SqlError"); + assert.equal(error.reason.operation, "prepare"); + yield* Effect.sync(() => blocker.exec("ROLLBACK")); + assert.deepEqual(yield* select.values, [["retained"]]); + assert.deepEqual(yield* select, [{ value: "retained" }]); + }).pipe(Effect.provide(SqliteClient.layer({ filename }))); + }).pipe(Effect.provide(NodeServices.layer)), +); diff --git a/packages/shared/src/nodeSqliteClient.ts b/packages/shared/src/nodeSqliteClient.ts index 71ba11884626..047de403ed8c 100644 --- a/packages/shared/src/nodeSqliteClient.ts +++ b/packages/shared/src/nodeSqliteClient.ts @@ -9,6 +9,7 @@ import * as NodeSqlite from "node:sqlite"; import * as Cache from "effect/Cache"; import * as Duration from "effect/Duration"; import * as Effect from "effect/Effect"; +import * as Exit from "effect/Exit"; import * as Fiber from "effect/Fiber"; import { identity } from "effect/Function"; import * as Layer from "effect/Layer"; @@ -144,10 +145,11 @@ const make = Effect.fn("makeWithDatabase")(function* ( }), }); - const prepareCache = yield* Cache.make({ + const prepareCache = yield* Cache.makeWith(prepare, { capacity: options.prepareCacheSize ?? 200, - timeToLive: options.prepareCacheTTL ?? Duration.minutes(10), - lookup: prepare, + // A transient prepare failure must not outlive the lock or missing schema. + timeToLive: (exit) => + Exit.isSuccess(exit) ? (options.prepareCacheTTL ?? Duration.minutes(10)) : Duration.zero, }); const runStatement = ( From 7a12aff471ffe2b22b9fee495b04b32c43f45a37 Mon Sep 17 00:00:00 2001 From: Nick Anisimov Date: Fri, 25 Sep 2026 21:14:50 +0400 Subject: [PATCH 47/58] fix(mobile): scale Android controls with appearance text size (#13356) --- .../src/components/AndroidAnchoredMenu.tsx | 22 ++++--- .../src/components/AndroidScreenHeader.tsx | 17 +++-- .../src/components/CompactBrandTitle.tsx | 21 +++++-- .../components/ComposerAttachmentButton.tsx | 4 +- .../mobile/src/components/ComposerToolbar.tsx | 25 +++++--- apps/mobile/src/components/ControlPill.tsx | 4 +- .../src/components/MaterialButton.android.tsx | 6 +- .../MaterialFloatingActionButton.android.tsx | 12 +++- .../components/MaterialIconButton.android.tsx | 10 +-- .../mobile/src/components/MaterialListRow.tsx | 4 +- .../components/MaterialMenuPopup.android.tsx | 63 +++++++++++-------- .../src/components/MaterialMenuPopup.tsx | 1 + .../MaterialScrollComposeButton.android.tsx | 58 +++++++++++++---- .../src/components/MaterialSearchField.tsx | 22 +++++-- .../src/components/ScreenHeader.android.tsx | 54 ++++++++++------ .../src/components/useAndroidControlSizing.ts | 13 ++++ .../components/useMaterialToolbarHeight.ts | 11 ---- .../components/useMaterialToolbarLayout.ts | 21 +++++++ .../features/files/MaterialFilesHeader.tsx | 11 ++-- .../features/home/AndroidHomeFab.android.tsx | 17 ++++- apps/mobile/src/features/home/HomeScreen.tsx | 4 +- .../home/MaterialThreadListToolbar.tsx | 16 ++--- .../home/WorkspaceConnectionTitle.tsx | 24 ++++--- .../settings/appearance/useScaledTextRole.ts | 21 ++----- .../features/threads/NewTaskDraftScreen.tsx | 37 +++++++---- .../src/features/threads/ThreadComposer.tsx | 6 +- .../threads/ThreadNavigationSidebar.tsx | 10 +-- .../src/lib/androidControlSizing.test.ts | 22 +++++++ apps/mobile/src/lib/androidControlSizing.ts | 23 +++++++ apps/mobile/src/lib/appearancePreferences.ts | 10 +++ 30 files changed, 390 insertions(+), 179 deletions(-) create mode 100644 apps/mobile/src/components/useAndroidControlSizing.ts delete mode 100644 apps/mobile/src/components/useMaterialToolbarHeight.ts create mode 100644 apps/mobile/src/components/useMaterialToolbarLayout.ts create mode 100644 apps/mobile/src/lib/androidControlSizing.test.ts create mode 100644 apps/mobile/src/lib/androidControlSizing.ts diff --git a/apps/mobile/src/components/AndroidAnchoredMenu.tsx b/apps/mobile/src/components/AndroidAnchoredMenu.tsx index dfa0dea8d05a..4c465a9f9ef4 100644 --- a/apps/mobile/src/components/AndroidAnchoredMenu.tsx +++ b/apps/mobile/src/components/AndroidAnchoredMenu.tsx @@ -7,9 +7,9 @@ import { useKeyboardState } from "react-native-keyboard-controller"; import Animated, { FadeIn } from "react-native-reanimated"; import { OverlayPortal } from "./OverlayPortal"; +import { useAndroidControlSizing } from "./useAndroidControlSizing"; import { MaterialMenuPopup } from "./MaterialMenuPopup"; -const MENU_WIDTH = 250; const SCREEN_MARGIN = 12; const ANCHOR_GAP = 6; @@ -55,6 +55,7 @@ export type AndroidAnchoredMenuProps = { * menus use the native popup for placement, animation and dismissal. */ export function AndroidAnchoredMenu(props: AndroidAnchoredMenuProps) { + const { scale, menuWidth: desiredMenuWidth } = useAndroidControlSizing(); const [anchor, setAnchor] = useState(null); const [path, setPath] = useState([]); // Height of the modal's root view, in the modal's own coordinate space. @@ -68,6 +69,10 @@ export function AndroidAnchoredMenu(props: AndroidAnchoredMenuProps) { // are converted into this frame, so the menu lands correctly no matter // where the portal host sits (status bar, keyboard resize, etc.). const [overlay, setOverlay] = useState(null); + const menuWidth = + overlay === null + ? desiredMenuWidth + : Math.min(desiredMenuWidth, Math.max(0, overlay.width - 2 * SCREEN_MARGIN)); const anchorRef = useRef(null); const overlayRef = useRef(null); @@ -131,14 +136,11 @@ export function AndroidAnchoredMenu(props: AndroidAnchoredMenuProps) { ? 0 : local.x + local.width / 2 <= overlay.width / 2 ? local.x - : local.x + local.width - MENU_WIDTH; + : local.x + local.width - menuWidth; const left = overlay === null ? 0 - : Math.min( - Math.max(preferredLeft, SCREEN_MARGIN), - overlay.width - MENU_WIDTH - SCREEN_MARGIN, - ); + : Math.min(Math.max(preferredLeft, SCREEN_MARGIN), overlay.width - menuWidth - SCREEN_MARGIN); // The keyboard stays up while the menu is open (in-window overlay, no // focus change), so the space it covers is not usable — without this the // composer-pill menus "open down" into the IME and can't be tapped. @@ -201,6 +203,7 @@ export function AndroidAnchoredMenu(props: AndroidAnchoredMenuProps) { {!placeable || local === null ? null : !anchor.keyboardWasVisible ? ( 2 ? (headerWidth >= 600 ? 3 : 1) : actions.length; @@ -51,16 +51,13 @@ export function AndroidScreenHeader(props: { return ( setHeaderWidth(event.nativeEvent.layout.width)} - className="border-b border-header-border bg-header px-2 pb-2" + className="border-b border-header-border bg-header px-2" style={{ - paddingTop: props.embedded ? 8 : Math.max(insets.top, 12), + ...headerPadding, borderBottomWidth: props.hideBottomBorder ? 0 : undefined, }} > - + {props.onBack ? ( - + Code - + {stageLabel} diff --git a/apps/mobile/src/components/ComposerAttachmentButton.tsx b/apps/mobile/src/components/ComposerAttachmentButton.tsx index 8ea70a45c020..b6b3d6e78a49 100644 --- a/apps/mobile/src/components/ComposerAttachmentButton.tsx +++ b/apps/mobile/src/components/ComposerAttachmentButton.tsx @@ -1,6 +1,7 @@ import type { MenuAction } from "@react-native-menu/menu"; import { Pressable } from "react-native"; +import { useAndroidControlSizing } from "./useAndroidControlSizing"; import { SymbolView } from "./AppSymbol"; import { ControlPillMenu } from "./ControlPill"; @@ -15,6 +16,7 @@ export function ComposerAttachmentButton(props: { readonly onPickMedia: () => Promise; readonly onPickFiles: () => Promise; }) { + const { scale } = useAndroidControlSizing(); const button = ( ["name"]; - readonly iconNode?: ReactNode; + readonly renderIcon?: (size: number) => ReactNode; readonly label: string; readonly maxWidth?: ViewStyle["maxWidth"]; readonly onPress?: () => void; @@ -39,6 +41,7 @@ export function ComposerInlineControl(props: { readonly chevronDirection?: "down" | "right"; readonly showChevron?: boolean; }) { + const { scale, smallIconSize } = useAndroidControlSizing(); return ( - {props.iconNode ? ( - {props.iconNode} + {props.renderIcon ? ( + + {props.renderIcon(smallIconSize)} + ) : props.icon ? ( void; readonly variant?: "primary" | "danger"; }) { + const { scale, smallIconSize } = useAndroidControlSizing(); + const circleSize = Math.round(30 * scale); return ( { @@ -133,7 +135,7 @@ export function ControlPill(props: { ) : props.icon ? ( diff --git a/apps/mobile/src/components/MaterialButton.android.tsx b/apps/mobile/src/components/MaterialButton.android.tsx index f2df6464f103..f7a62f1ecb0b 100644 --- a/apps/mobile/src/components/MaterialButton.android.tsx +++ b/apps/mobile/src/components/MaterialButton.android.tsx @@ -14,10 +14,12 @@ import { View } from "react-native"; import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole"; import type { MaterialButtonProps } from "./MaterialButton"; +import { useAndroidControlSizing } from "./useAndroidControlSizing"; export function MaterialButton(props: MaterialButtonProps) { const { themeAppearance, themeVariables: colors } = useAppearancePreferences(); const typography = useScaledTextRole("footnote"); + const { scale, mediumIconSize } = useAndroidControlSizing(); const tone = props.tone ?? "secondary"; const Component = tone === "text" ? TextButton : tone === "secondary" ? FilledTonalButton : Button; @@ -77,11 +79,11 @@ export function MaterialButton(props: MaterialButtonProps) { {props.loading ? ( <> - + ) : null} {props.label} diff --git a/apps/mobile/src/components/MaterialFloatingActionButton.android.tsx b/apps/mobile/src/components/MaterialFloatingActionButton.android.tsx index 2882d0d91ec0..29f396fc9d6d 100644 --- a/apps/mobile/src/components/MaterialFloatingActionButton.android.tsx +++ b/apps/mobile/src/components/MaterialFloatingActionButton.android.tsx @@ -6,8 +6,9 @@ import { LargeFloatingActionButton, Text, } from "@expo/ui/jetpack-compose"; -import { size } from "@expo/ui/jetpack-compose/modifiers"; +import { defaultMinSize, height, size, width } from "@expo/ui/jetpack-compose/modifiers"; import { View, type StyleProp, type ViewStyle } from "react-native"; +import { useAndroidControlSizing } from "./useAndroidControlSizing"; import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole"; import { SymbolView, type AppSymbolName } from "./AppSymbol"; @@ -24,6 +25,8 @@ export function MaterialFloatingActionButton(props: { }) { const { themeAppearance, themeVariables: colors } = useAppearancePreferences(); const typography = useScaledTextRole("footnote"); + const { scale, iconSize: standardIconSize, fabSize, largeFabSize } = useAndroidControlSizing(); + const buttonSize = props.variant === "large" ? largeFabSize : fabSize; const primary = props.tone === "primary"; const containerColor = colors[primary ? "--color-primary" : "--color-secondary"]; const contentColor = @@ -34,7 +37,7 @@ export function MaterialFloatingActionButton(props: { : props.variant === "large" ? LargeFloatingActionButton : FloatingActionButton; - const iconSize = props.variant === "large" ? 36 : 24; + const iconSize = props.variant === "large" ? Math.round(36 * scale) : standardIconSize; return ( { if (!props.disabled) props.onPress?.(); }} - style={{ width: 48, height: 48 }} + style={{ width: buttonSize, height: buttonSize }} > diff --git a/apps/mobile/src/components/MaterialListRow.tsx b/apps/mobile/src/components/MaterialListRow.tsx index 539472e4bd96..cef104a02f50 100644 --- a/apps/mobile/src/components/MaterialListRow.tsx +++ b/apps/mobile/src/components/MaterialListRow.tsx @@ -5,6 +5,7 @@ import { useAppearancePreferences } from "../features/settings/appearance/Appear import { cn } from "../lib/cn"; import { AppText } from "./AppText"; import { SymbolView } from "./AppSymbol"; +import { useAndroidControlSizing } from "./useAndroidControlSizing"; /** Shared geometry for Material navigation and selection lists. Group rows in one card. */ export function MaterialListRow({ @@ -23,6 +24,7 @@ export function MaterialListRow({ readonly trailing?: ReactNode; }) { const { themeVariables } = useAppearancePreferences(); + const { smallIconSize } = useAndroidControlSizing(); return ( + ) : null} ); diff --git a/apps/mobile/src/components/MaterialMenuPopup.android.tsx b/apps/mobile/src/components/MaterialMenuPopup.android.tsx index c49db1815039..4f9fe3d1ada4 100644 --- a/apps/mobile/src/components/MaterialMenuPopup.android.tsx +++ b/apps/mobile/src/components/MaterialMenuPopup.android.tsx @@ -7,9 +7,11 @@ import { RNHostView, Text, } from "@expo/ui/jetpack-compose"; -import { padding, size, width } from "@expo/ui/jetpack-compose/modifiers"; +import { defaultMinSize, padding, size, width } from "@expo/ui/jetpack-compose/modifiers"; import { View } from "react-native"; +import { resolveScaledTextRole } from "../lib/appearancePreferences"; +import { useAndroidControlSizing } from "./useAndroidControlSizing"; import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; import type { MaterialMenuPopupProps } from "./MaterialMenuPopup"; import { isAppSymbolName, SymbolView, type AppSymbolName } from "./AppSymbol"; @@ -19,12 +21,16 @@ function MenuIcon(props: { readonly destructive?: boolean; readonly disabled?: boolean; }) { + const { iconSize } = useAndroidControlSizing(); return ( - - + + {props.parent ? ( - + - + {props.parent.title} ) : props.title ? ( - + {props.title} ) : null} @@ -66,19 +81,22 @@ export function MaterialMenuPopup(props: MaterialMenuPopupProps) { props.onPress(action)} > + {action.image && isAppSymbolName(action.image) ? ( + + + + ) : null} {action.subtitle ? ( - + {action.subtitle} ) : null} - {action.image && isAppSymbolName(action.image) ? ( - - - - ) : null} {(action.subactions?.length ?? 0) > 0 ? ( @@ -124,7 +133,7 @@ export function MaterialMenuPopup(props: MaterialMenuPopupProps) { colorScheme={themeAppearance} ignoreSafeAreaKeyboardInsets matchContents - style={{ width: 250 }} + style={{ width: props.menuWidth }} > {items} diff --git a/apps/mobile/src/components/MaterialMenuPopup.tsx b/apps/mobile/src/components/MaterialMenuPopup.tsx index 3a23e5de7ab4..06019a0e1512 100644 --- a/apps/mobile/src/components/MaterialMenuPopup.tsx +++ b/apps/mobile/src/components/MaterialMenuPopup.tsx @@ -1,6 +1,7 @@ import type { MenuAction } from "@react-native-menu/menu"; export interface MaterialMenuPopupProps { + readonly menuWidth: number; readonly anchor: { readonly x: number; readonly y: number; diff --git a/apps/mobile/src/components/MaterialScrollComposeButton.android.tsx b/apps/mobile/src/components/MaterialScrollComposeButton.android.tsx index 018dbdc19b42..8c653e67ee9a 100644 --- a/apps/mobile/src/components/MaterialScrollComposeButton.android.tsx +++ b/apps/mobile/src/components/MaterialScrollComposeButton.android.tsx @@ -1,9 +1,17 @@ import { Box, ExtendedFloatingActionButton, Host, Icon, Text } from "@expo/ui/jetpack-compose"; -import { fillMaxWidth, onSizeChanged, size } from "@expo/ui/jetpack-compose/modifiers"; +import { + defaultMinSize, + fillMaxWidth, + graphicsLayer, + height, + onSizeChanged, + size, +} from "@expo/ui/jetpack-compose/modifiers"; import { useCallback, useState } from "react"; import { Pressable, View, type StyleProp, type ViewStyle } from "react-native"; +import { useAndroidControlSizing } from "./useAndroidControlSizing"; import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; -import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole"; +import { resolveScaledTextRole } from "../lib/appearancePreferences"; /** Keep the animated width and icon positioning entirely inside Compose, not Yoga. */ export function MaterialScrollComposeButton(props: { @@ -12,14 +20,23 @@ export function MaterialScrollComposeButton(props: { readonly className?: string; readonly style?: StyleProp; }) { - const { themeAppearance, themeVariables: colors } = useAppearancePreferences(); - const typography = useScaledTextRole("footnote"); - const [expandedWidth, setExpandedWidth] = useState(56); + const { appearance, themeAppearance, themeVariables: colors } = useAppearancePreferences(); + const typography = resolveScaledTextRole("footnote", appearance.baseFontSize); + const { iconSize, fabSize } = useAndroidControlSizing(); + // Scale the native 56dp minimum; keep text and icons at their requested sizes. + const nativeSize = Math.max(56, fabSize); + const scale = fabSize / nativeSize; + const nativeIconSize = Math.round(iconSize / scale); + const [buttonWidth, setButtonWidth] = useState(nativeSize); const rememberWidth = useCallback(({ width }: { width: number }) => { - setExpandedWidth((previous) => Math.max(previous, width)); + setButtonWidth((previous) => Math.max(previous, width)); }, []); return ( - + - + @@ -45,7 +72,11 @@ export function MaterialScrollComposeButton(props: { New thread @@ -65,8 +96,9 @@ export function MaterialScrollComposeButton(props: { right: 0, top: 0, bottom: 0, - width: props.expanded ? expandedWidth : 56, - borderRadius: 16, + // Release the label area as soon as collapse starts, before native measurements arrive. + width: props.expanded ? buttonWidth * scale : fabSize, + borderRadius: 16 * scale, overflow: "hidden", }} /> diff --git a/apps/mobile/src/components/MaterialSearchField.tsx b/apps/mobile/src/components/MaterialSearchField.tsx index ab96440f5f09..3609430a6e1a 100644 --- a/apps/mobile/src/components/MaterialSearchField.tsx +++ b/apps/mobile/src/components/MaterialSearchField.tsx @@ -2,6 +2,7 @@ import type { RefObject } from "react"; import { Pressable, TextInput, View } from "react-native"; import { SymbolView } from "./AppSymbol"; +import { useAndroidControlSizing } from "./useAndroidControlSizing"; export function MaterialSearchField({ inputRef, @@ -18,9 +19,21 @@ export function MaterialSearchField({ readonly value: string; readonly onChangeText: (value: string) => void; }) { + const { scale, mediumIconSize } = useAndroidControlSizing(); return ( - - + + @@ -49,7 +63,7 @@ export function MaterialSearchField({ > diff --git a/apps/mobile/src/components/ScreenHeader.android.tsx b/apps/mobile/src/components/ScreenHeader.android.tsx index 61a38c3a00c2..1d3232fd1641 100644 --- a/apps/mobile/src/components/ScreenHeader.android.tsx +++ b/apps/mobile/src/components/ScreenHeader.android.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { BackHandler, Keyboard, Pressable, TextInput, View } from "react-native"; -import { useSafeAreaInsets } from "react-native-safe-area-context"; +import { useMaterialToolbarLayout } from "./useMaterialToolbarLayout"; import { NativeStackScreenOptions } from "../native/StackHeader"; import { AndroidWorkspaceSidebarButton } from "../features/layout/workspace-sidebar-toolbar"; import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; @@ -11,10 +11,12 @@ import { ControlPillMenu } from "./ControlPill"; import { MaterialSearchField } from "./MaterialSearchField"; import { androidHeaderMenuActions, findHeaderMenuAction } from "./headerMenu.android"; import type { ScreenHeaderProps } from "./ScreenHeader.types"; +import { useAndroidControlSizing } from "./useAndroidControlSizing"; export function ScreenHeader(props: ScreenHeaderProps) { const { search } = props; - const insets = useSafeAreaInsets(); + const { paddingTop, paddingBottom } = useMaterialToolbarLayout(); + const { scale, buttonSize, iconSize, smallIconSize } = useAndroidControlSizing(); const { themeVariables } = useAppearancePreferences(); const inputRef = useRef(null); const [searchOpen, setSearchOpen] = useState(false); @@ -48,11 +50,12 @@ export function ScreenHeader(props: ScreenHeaderProps) { @@ -80,30 +83,43 @@ export function ScreenHeader(props: ScreenHeaderProps) { <> {options} - + {props.onBack ? ( ) : null} - + @@ -112,9 +128,14 @@ export function ScreenHeader(props: ScreenHeaderProps) { autoCapitalize="none" onChangeText={search.onChangeText} value={search.value} - placeholder={search.placeholder} + placeholder={ + search.compactToolbar + ? (search.compactPlaceholder ?? search.placeholder) + : search.placeholder + } placeholderTextColorClassName="accent-placeholder" - className="flex-1 py-2 text-base font-sans text-header-foreground" + className="flex-1 text-base font-sans text-header-foreground" + style={{ paddingVertical: 7 * scale }} /> {menuView} @@ -173,11 +194,8 @@ export function ScreenHeader(props: ScreenHeaderProps) { {header} {searching ? ( - - + + void; readonly leading?: ReactNode; }) { - const insets = useSafeAreaInsets(); + const { paddingTop, paddingBottom } = useMaterialToolbarLayout(); const searchRef = useRef(null); const [searchOpen, setSearchOpen] = useState(false); const searching = searchOpen || props.searchQuery.length > 0; @@ -77,11 +77,8 @@ export function MaterialFilesHeader(props: { /> {searching ? ( - - + + ) { const insets = useSafeAreaInsets(); + const { appearance } = useAppearancePreferences(); + const { fontScale } = useWindowDimensions(); + const [layoutWidth, setLayoutWidth] = useState(null); const { state } = useWorkspaceState(); const [expanded, setExpanded] = useState(true); const scrollState = useRef({ anchor: 0, expanded: true }); @@ -23,11 +32,13 @@ export function AndroidHomeFabLayout(props: ComponentProps + setLayoutWidth(event.nativeEvent.layout.width)}> {props.children} - {state.hasConnections ? ( + {state.hasConnections && layoutWidth !== null ? ( (null); const insets = useSafeAreaInsets(); + const { fabClearance } = useAndroidControlSizing(); const iosBottomToolbarClearance = Platform.OS === "ios" && !NATIVE_LIQUID_GLASS_SUPPORTED ? PRE_LIQUID_GLASS_BOTTOM_TOOLBAR_HEIGHT @@ -983,7 +985,7 @@ export function HomeScreen(props: HomeScreenProps) { paddingBottom: Platform.OS === "ios" ? Math.max(insets.bottom, 24) + 96 + iosBottomToolbarClearance - : Math.max(insets.bottom, 16) + (Platform.OS === "android" ? 148 : 88), + : Math.max(insets.bottom, 16) + (Platform.OS === "android" ? fabClearance : 88), }} /> diff --git a/apps/mobile/src/features/home/MaterialThreadListToolbar.tsx b/apps/mobile/src/features/home/MaterialThreadListToolbar.tsx index 2d852f8f7be2..6cea625aced9 100644 --- a/apps/mobile/src/features/home/MaterialThreadListToolbar.tsx +++ b/apps/mobile/src/features/home/MaterialThreadListToolbar.tsx @@ -12,7 +12,8 @@ import { MaterialSearchField } from "../../components/MaterialSearchField"; import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands"; import { WorkspaceConnectionTitle } from "./WorkspaceConnectionTitle"; import { useWorkspaceState } from "../../state/workspace"; -import { useMaterialToolbarHeight } from "../../components/useMaterialToolbarHeight"; +import { useAndroidControlSizing } from "../../components/useAndroidControlSizing"; +import { useMaterialToolbarLayout } from "../../components/useMaterialToolbarLayout"; /** One toolbar height for the compact list and expanded sidebar, including search. */ export function MaterialThreadListToolbar(props: { @@ -28,7 +29,8 @@ export function MaterialThreadListToolbar(props: { readonly onRequestVisibility?: () => void; }) { const insets = useSafeAreaInsets(); - const toolbarHeight = useMaterialToolbarHeight(); + const { fabSize } = useAndroidControlSizing(); + const { height: toolbarHeight, ...headerPadding } = useMaterialToolbarLayout(); const { state } = useWorkspaceState(); const { onRequestVisibility, onSearchQueryChange } = props; const searchRef = useRef(null); @@ -76,11 +78,9 @@ export function MaterialThreadListToolbar(props: { {searching ? ( @@ -116,14 +116,14 @@ export function MaterialThreadListToolbar(props: { )} - {/* Sit 8dp above the 56dp extended New thread FAB. */} + {/* Keep the filter above the New thread FAB at every text size. */} {state.hasConnections ? ( diff --git a/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx b/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx index 9b9333b46c7f..d2b068a07c59 100644 --- a/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx +++ b/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx @@ -1,9 +1,10 @@ import type { NativeStackNavigationOptions } from "@react-navigation/native-stack"; import { useEffect, useRef, useState, type ReactNode } from "react"; -import { ActivityIndicator, Animated, Pressable, View } from "react-native"; +import { ActivityIndicator, Animated, Platform, Pressable, View } from "react-native"; import { SymbolView } from "../../components/AppSymbol"; import { AppText as Text } from "../../components/AppText"; +import { useAndroidControlSizing } from "../../components/useAndroidControlSizing"; import { brandTitleOffset, CompactBrandTitle, @@ -105,6 +106,7 @@ export function WorkspaceConnectionTitle(props: { }) { const status = useDelayedConnectionStatus(); const size = props.size ?? "navbar"; + const { scale } = useAndroidControlSizing(); if (status === null) { return props.grow ? ( @@ -126,26 +128,28 @@ export function WorkspaceConnectionTitle(props: { hitSlop={8} onPress={props.onPress} className="flex-row items-center gap-2" - style={{ flexShrink: 1, marginLeft: props.statusOffset ?? 0 }} + style={[ + { flexShrink: 1, marginLeft: props.statusOffset ?? 0 }, + Platform.OS === "android" && { gap: 7 * scale }, + ]} > {status.showsProgress ? ( - + ) : ( )} {status.label} diff --git a/apps/mobile/src/features/settings/appearance/useScaledTextRole.ts b/apps/mobile/src/features/settings/appearance/useScaledTextRole.ts index 62f918a0e6b0..561cc53e44a7 100644 --- a/apps/mobile/src/features/settings/appearance/useScaledTextRole.ts +++ b/apps/mobile/src/features/settings/appearance/useScaledTextRole.ts @@ -1,10 +1,6 @@ import { useMemo } from "react"; -import { - DEFAULT_BASE_FONT_SIZE, - normalizeBaseFontSize, - scaledTypographyLineHeight, -} from "../../../lib/appearancePreferences"; +import { resolveScaledTextRole } from "../../../lib/appearancePreferences"; import { MOBILE_TYPOGRAPHY } from "../../../lib/typography"; import { useAppearancePreferences } from "./AppearancePreferencesProvider"; @@ -20,15 +16,8 @@ export interface ScaledTextRole { */ export function useScaledTextRole(role: keyof typeof MOBILE_TYPOGRAPHY): ScaledTextRole { const { appearance } = useAppearancePreferences(); - return useMemo(() => { - const baseFontSize = normalizeBaseFontSize(appearance.baseFontSize); - const typography = MOBILE_TYPOGRAPHY[role]; - return { - fontSize: Math.max( - 8, - Math.round(typography.fontSize * (baseFontSize / DEFAULT_BASE_FONT_SIZE)), - ), - lineHeight: scaledTypographyLineHeight(typography, baseFontSize), - }; - }, [appearance.baseFontSize, role]); + return useMemo( + () => resolveScaledTextRole(role, appearance.baseFontSize), + [appearance.baseFontSize, role], + ); } diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx index 681f6c5ee52d..7e90b0743374 100644 --- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx +++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx @@ -132,30 +132,40 @@ import { fileRoutePathSegments } from "../files/filePath"; function NewTaskWorkspaceIcon(props: { readonly workspaceMode: "local" | "worktree"; readonly worktreePath: string | null; + readonly size: number; }) { if (props.workspaceMode === "local" && props.worktreePath === null) { return ( ); } + const boxSize = (14 * props.size) / 16; return ( - + - + @@ -1476,13 +1486,13 @@ export function NewTaskDraftScreen(props: { accessibilityLabel={`Environment: ${selectedEnvironmentLabel}`} chevronDirection="right" disabled={isComposerInteractionLocked || voiceInput.isBusy} - iconNode={ + renderIcon={(size) => ( - } + )} label={`on ${selectedEnvironmentLabel}`} maxWidth={260} onPress={ @@ -1517,12 +1527,13 @@ export function NewTaskDraftScreen(props: { accessibilityHint={`Switches to ${flow.workspaceMode === "local" ? "a new worktree" : "the current checkout"}`} accessibilityLabel={workspaceLabel} disabled={isComposerInteractionLocked || voiceInput.isBusy} - iconNode={ + renderIcon={(size) => ( - } + )} label={workspaceLabel} maxWidth={flow.workspaceMode === "local" ? 220 : 148} onPress={() => flow.setWorkspaceMode(flow.workspaceMode === "local" ? "worktree" : "local")} @@ -1681,12 +1692,12 @@ export function NewTaskDraftScreen(props: { accessibilityLabel="Model and reasoning settings" disabled={isComposerInteractionLocked} emphasized - iconNode={ + renderIcon={(size) => ( - } + )} label={flow.selectedModelOption?.label ?? "Choose model"} maxWidth="100%" onPress={settingsSheetPresentation.open} diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsx index 23ddc65896b9..d131dfaa51f1 100644 --- a/apps/mobile/src/features/threads/ThreadComposer.tsx +++ b/apps/mobile/src/features/threads/ThreadComposer.tsx @@ -961,9 +961,9 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer - } + renderIcon={(size) => ( + + )} label={currentModelOption?.label ?? currentModelSelection.model} maxWidth="100%" onPress={openSettings} diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx index c478bae6312a..d9e165bd0107 100644 --- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx +++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx @@ -1,3 +1,4 @@ +import { useAndroidControlSizing } from "../../components/useAndroidControlSizing"; import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider"; import { computeThreadMoveAvailability } from "./threadOrder"; import type { @@ -50,7 +51,7 @@ import { } from "../home/WorkspaceConnectionTitle"; import { SidebarHeaderActions } from "./sidebar-header-actions"; import { MaterialThreadListToolbar } from "../home/MaterialThreadListToolbar"; -import { useMaterialToolbarHeight } from "../../components/useMaterialToolbarHeight"; +import { useMaterialToolbarLayout } from "../../components/useMaterialToolbarLayout"; import { useMaterialFabScroll } from "../home/MaterialFabScrollContext"; import { SidebarFilterButton } from "./sidebar-filter-button"; import { createSidebarHeaderItems } from "./sidebar-native-header-items"; @@ -133,6 +134,7 @@ function ThreadNavigationSidebarPane( const drawerColor = materialTheme["--color-drawer"]; const insets = useSafeAreaInsets(); + const { fabClearance } = useAndroidControlSizing(); const projects = useProjects(); const threads = useThreadShells(); const { environments: workspaceEnvironments, state: catalogState } = useWorkspaceState(); @@ -603,14 +605,14 @@ function ThreadNavigationSidebarPane( ); const [measuredHeaderHeight, setMeasuredHeaderHeight] = useState(null); - const materialToolbarHeight = useMaterialToolbarHeight(); + const { height, paddingTop, paddingBottom } = useMaterialToolbarLayout(); // The sticky header (title row, search field, optional connection status) // is measured so the list inset always matches its real height — no // hardcoded per-variant constants. const stickyHeaderHeight = measuredHeaderHeight ?? (Platform.OS === "android" - ? Math.max(insets.top, 12) + materialToolbarHeight + 8 + ? paddingTop + height + paddingBottom : insets.top + SIDEBAR_STICKY_HEADER_HEIGHT); const topListInset = stickyHeaderHeight + 6; const handleStickyHeaderLayout = useCallback((event: LayoutChangeEvent) => { @@ -1039,7 +1041,7 @@ function ThreadNavigationSidebarPane( { paddingBottom: Platform.OS === "android" - ? Math.max(insets.bottom, 16) + 148 - insets.bottom + ? Math.max(insets.bottom, 16) + fabClearance - insets.bottom : 16 + insets.bottom, paddingTop: Platform.OS === "android" ? 6 : topListInset, }, diff --git a/apps/mobile/src/lib/androidControlSizing.test.ts b/apps/mobile/src/lib/androidControlSizing.test.ts new file mode 100644 index 000000000000..8b9fd9751cbb --- /dev/null +++ b/apps/mobile/src/lib/androidControlSizing.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, it } from "vite-plus/test"; + +import { resolveAndroidControlSizing } from "./androidControlSizing"; + +describe("Android control sizing", () => { + it.each([ + [11, 17, 48, 48, 172, 48], + [16, 24, 48, 56, 250, 48], + [22, 33, 66, 77, 344, 66], + ])( + "scales controls at %ipt", + (fontSize, iconSize, buttonSize, fabSize, menuWidth, menuItemHeight) => { + expect(resolveAndroidControlSizing(fontSize)).toMatchObject({ + iconSize, + buttonSize, + fabSize, + menuWidth, + menuItemHeight, + }); + }, + ); +}); diff --git a/apps/mobile/src/lib/androidControlSizing.ts b/apps/mobile/src/lib/androidControlSizing.ts new file mode 100644 index 000000000000..f6868ad07bdd --- /dev/null +++ b/apps/mobile/src/lib/androidControlSizing.ts @@ -0,0 +1,23 @@ +import { DEFAULT_BASE_FONT_SIZE, normalizeBaseFontSize } from "./appearancePreferences"; + +/** Android controls follow the app's text size; buttons and menu rows retain a 48dp touch target. */ +export function resolveAndroidControlSizing(baseFontSize: number) { + const scale = normalizeBaseFontSize(baseFontSize) / DEFAULT_BASE_FONT_SIZE; + const iconSize = Math.round(24 * scale); + const buttonSize = Math.max(48, Math.round(48 * scale)); + const fabSize = Math.max(48, Math.round(56 * scale)); + + return { + scale, + iconSize, + smallIconSize: Math.round(16 * scale), + mediumIconSize: Math.round(18 * scale), + buttonSize, + fabSize, + largeFabSize: Math.round(96 * scale), + menuWidth: Math.round(250 * scale), + menuItemHeight: Math.max(48, Math.round(48 * scale)), + // Two floating actions, their gap, and the space below the lower action. + fabClearance: fabSize * 2 + 36, + }; +} diff --git a/apps/mobile/src/lib/appearancePreferences.ts b/apps/mobile/src/lib/appearancePreferences.ts index 2ce6a8b5a367..981b35808a54 100644 --- a/apps/mobile/src/lib/appearancePreferences.ts +++ b/apps/mobile/src/lib/appearancePreferences.ts @@ -219,6 +219,16 @@ export function scaledTypographyLineHeight( return Math.max(10, Math.round(role.lineHeight * scale)); } +/** Text dimensions shared by React Native and Compose consumers of an appearance role. */ +export function resolveScaledTextRole(role: keyof typeof MOBILE_TYPOGRAPHY, baseFontSize: number) { + const typography = MOBILE_TYPOGRAPHY[role]; + const scale = normalizeBaseFontSize(baseFontSize) / DEFAULT_BASE_FONT_SIZE; + return { + fontSize: Math.max(8, Math.round(typography.fontSize * scale)), + lineHeight: scaledTypographyLineHeight(typography, baseFontSize), + }; +} + export function resolveNativeMarkdownTypography(baseFontSize: number): NativeMarkdownTypography { const fontSizes = resolveMarkdownFontSizes(baseFontSize); return { From a4f6078bebcb3283e53e1cea247257136ce82cc8 Mon Sep 17 00:00:00 2001 From: MacKinley Smith Date: Fri, 25 Sep 2026 13:43:35 -0600 Subject: [PATCH 48/58] fix(web): return focus to the composer after saving a citation note (#13450) --- .../components/ComposerPromptEditorTiptap.tsx | 55 +++++++++++++++++++ .../components/chat/AssistantCitationChip.tsx | 20 +++++++ 2 files changed, 75 insertions(+) diff --git a/apps/web/src/components/ComposerPromptEditorTiptap.tsx b/apps/web/src/components/ComposerPromptEditorTiptap.tsx index 74e8736f04e7..2a5fe2ba0588 100644 --- a/apps/web/src/components/ComposerPromptEditorTiptap.tsx +++ b/apps/web/src/components/ComposerPromptEditorTiptap.tsx @@ -29,6 +29,7 @@ import { useMemo, useRef, useState, + type KeyboardEvent as ReactKeyboardEvent, } from "react"; import { EditorContent, useEditor } from "@tiptap/react"; @@ -371,6 +372,16 @@ function ComposerCitationNodeView({ node, editor, getPos }: NodeViewProps) { .run(); }, [editor, nodePos]); + // Put the caret right after the chip so Enter sends and typing continues the prompt. + const onRestoreFocus = useCallback(() => { + if (!editor.isEditable) return; + const pos = nodePos(); + if (pos === null) return; + const current = editor.state.doc.nodeAt(pos); + if (!current || current.type.name !== "composer-citation") return; + editor.commands.focus(pos + current.nodeSize); + }, [editor, nodePos]); + return ( ) => { + // Tab from the comment button returns to the caret after the chip. + if ( + !editor.isEditable || + event.key !== "Tab" || + event.shiftKey || + event.altKey || + event.metaKey || + event.ctrlKey || + !(event.target instanceof HTMLElement) || + event.target.dataset.citationCommentTrigger === undefined + ) { + return; + } + event.preventDefault(); + onRestoreFocus(); + }} > @@ -856,6 +885,32 @@ function ComposerPromptEditorTiptapInner(props: ComposerPromptEditorProps) { return true; } } + // Shift+Tab from just after a citation reaches its comment button, which + // native tab order skips because the chip lives inside the editor. + if ( + event.key === "Tab" && + event.shiftKey && + !event.altKey && + !event.metaKey && + !event.ctrlKey && + view.state.selection.empty + ) { + const { $from } = view.state.selection; + const citation = $from.nodeBefore; + if (citation?.type.name === "composer-citation") { + const chip = view.nodeDOM($from.pos - citation.nodeSize); + const commentButton = + chip instanceof HTMLElement + ? chip.querySelector("[data-citation-comment-trigger]") + : null; + if (commentButton) { + event.preventDefault(); + event.stopPropagation(); + commentButton.focus(); + return true; + } + } + } if (event.key === "Enter" && (event.isComposing || event.keyCode === 229)) { event.stopPropagation(); return true; diff --git a/apps/web/src/components/chat/AssistantCitationChip.tsx b/apps/web/src/components/chat/AssistantCitationChip.tsx index 6baf14b18887..e03872553a88 100644 --- a/apps/web/src/components/chat/AssistantCitationChip.tsx +++ b/apps/web/src/components/chat/AssistantCitationChip.tsx @@ -39,10 +39,13 @@ export function AssistantCitationChip({ onCancel?: () => void; onSave: (comment: string) => boolean; onSaveAndSend?: (comment: string) => boolean; + /** Returns focus to the host editor when the popover closes instead of to the pencil trigger. */ + onRestoreFocus?: () => void; }; }) { const navigate = useNavigate(); const commentInputRef = useRef(null); + const commentPopupRef = useRef(null); const draftCommentRef = useRef(null); const [unavailableSourceAnchor, setUnavailableSourceAnchor] = useState(null); @@ -155,6 +158,7 @@ export function AssistantCitationChip({ > } > { + readonly value: A | undefined; + readonly warning?: string; +} + +/** + * Reads one variable. Blank reads as unset, and a value `parse` rejects warns + * without echoing it, since these variables carry credentials. + */ +const readOrWarn = ( + name: string, + parse: (raw: string) => Option.Option, + warning: string, +): Config.Config> => + Config.String(name).pipe( + Config.option, + Config.map((option): Setting => { + const raw = blankAsUnset(Option.getOrUndefined(option)); + if (raw === undefined) { + return { value: undefined }; + } + return Option.match(parse(raw), { + onNone: () => ({ value: undefined, warning }), + onSome: (value) => ({ value }), + }); + }), + ); + +const parseHttpUrl = (raw: string) => + Option.liftThrowable((value: string) => new URL(value))(raw).pipe( + Option.filter((url) => url.protocol === "http:" || url.protocol === "https:"), + ); + +const NOT_EXPORTED = "so the signals it configures are not exported"; + +const endpoint = (name: string) => + readOrWarn(name, parseHttpUrl, `${name} is not an http or https URL, ${NOT_EXPORTED}`); + +// The specification reads enum values case-insensitively. +const protocol = (name: string) => + readOrWarn( + name, + (raw) => Schema.decodeUnknownOption(OtlpProtocol)(raw.toLowerCase()), + `${name} is not http/protobuf or http/json, ${NOT_EXPORTED}`, + ); + +const headers = (name: string) => + readOrWarn( + name, + Schema.decodeUnknownOption(OtlpHeadersFromString), + `${name} is not a list of key=value pairs with percent-encoded values, ${NOT_EXPORTED}`, + ); + +interface Settings { + readonly endpoint: Setting; + readonly protocol: Setting; + readonly headers: Setting>>; +} + +const settings = (prefix: string): Config.Config => + Config.all({ + endpoint: endpoint(`${prefix}ENDPOINT`), + protocol: protocol(`${prefix}PROTOCOL`), + headers: headers(`${prefix}HEADERS`), + }); + +/** The signal's own variable claims the signal once set, valid or not. */ +const isClaimed = (setting: Setting) => + setting.value !== undefined || setting.warning !== undefined; + +const claimed = (own: Setting, generic: Setting) => (isClaimed(own) ? own : generic); + +/** Appends the signal's path, keeping the query an intake may take its API key in. */ +const withSignalPath = (signal: OtlpSignalName, base: URL) => { + const url = new URL(base); + const slash = url.pathname.endsWith("/") ? "" : "/"; + url.pathname += `${slash}v1/${signal.toLowerCase()}`; + return url; +}; + +interface ResolvedSignal { + readonly signal: OtelSignal; + /** The settings this signal read, whose warnings are the signal's to report. */ + readonly used: ReadonlyArray>; +} + +/** + * A signal whose endpoint, protocol, or headers do not read is not exported + * rather than sent somewhere, in a format, or without the credentials its + * collector expects. + */ +const signal = (name: OtlpSignalName, own: Settings, generic: Settings): ResolvedSignal => { + const ownEndpoint = isClaimed(own.endpoint); + const endpoint = ownEndpoint ? own.endpoint : generic.endpoint; + if (endpoint.value === undefined) { + const signal = endpoint.warning === undefined ? OtelSignal.Unset() : OtelSignal.Off(); + return { signal, used: [endpoint] }; + } + const protocol = claimed(own.protocol, generic.protocol); + const headers = claimed(own.headers, generic.headers); + const used = [endpoint, protocol, headers]; + if (protocol.warning !== undefined || headers.warning !== undefined) { + return { signal: OtelSignal.Off(), used }; + } + const url = ownEndpoint ? endpoint.value : withSignalPath(name, endpoint.value); + return { + signal: OtelSignal.Export({ + url: url.toString(), + protocol: protocol.value ?? "http/protobuf", + headers: headers.value, + }), + used, + }; +}; + export const load: Effect.Effect = Config.all({ t3: flag( "T3CODE_OTEL_SDK_DISABLED", @@ -111,12 +259,31 @@ export const load: Effect.Effect = Config.all({ `OTEL_SDK_DISABLED=${value} was read as false; the OpenTelemetry specification recognizes only the string true, so use OTEL_SDK_DISABLED=true or T3CODE_OTEL_SDK_DISABLED to say it any other way`, ), resource: resourceAttributes, + generic: settings("OTEL_EXPORTER_OTLP_"), + traces: settings("OTEL_EXPORTER_OTLP_TRACES_"), + metrics: settings("OTEL_EXPORTER_OTLP_METRICS_"), + logs: settings("OTEL_EXPORTER_OTLP_LOGS_"), }).pipe( - Effect.map(({ t3, spec, resource }) => { + Effect.map(({ t3, spec, resource, generic, ...own }) => { const disabled = t3.value ?? spec.value ?? false; - const warnings = [t3.warning, spec.warning, resource.warning].filter( - (warning) => warning !== undefined, + // The kill switch wins outright, so the signals say nothing once it is set. + const signals = disabled + ? undefined + : { + traces: signal("TRACES", own.traces, generic), + metrics: signal("METRICS", own.metrics, generic), + logs: signal("LOGS", own.logs, generic), + }; + // A generic variable read by several signals warns once. + const used = new Set( + signals === undefined ? [] : Object.values(signals).flatMap((resolved) => resolved.used), ); + const warnings = [ + t3.warning, + spec.warning, + resource.warning, + ...Array.from(used, (setting) => setting.warning), + ].filter((warning) => warning !== undefined); if (disabled) { warnings.push( t3.value @@ -124,12 +291,58 @@ export const load: Effect.Effect = Config.all({ : "OTEL_SDK_DISABLED is set, so no telemetry is exported, whatever configured it; set T3CODE_OTEL_SDK_DISABLED=false to export anyway", ); } - return { disabled, warnings, resourceAttributes: resource.value }; + return { + disabled, + warnings, + resourceAttributes: resource.value, + traces: signals?.traces.signal ?? OtelSignal.Unset(), + metrics: signals?.metrics.signal ?? OtelSignal.Unset(), + logs: signals?.logs.signal ?? OtelSignal.Unset(), + }; }), // Every read above falls back instead of failing, so this cannot happen. Effect.orDie, ); +export type SignalName = "traces" | "metrics" | "logs"; + +export interface SignalEndpoint { + readonly url: string; + readonly export: SignalExport; +} + +/** + * Where one signal exports and how. `T3CODE_OTLP_*_URL` wins outright with + * T3 Code's own export, then an OTEL endpoint with its own headers and + * protocol, since `T3CODE_OTLP_HEADERS` was written for a different + * collector, then the first of `fallbackUrls` with T3 Code's own export. + */ +export const resolveSignalEndpoint = ( + otel: OtelEnvironment, + signal: SignalName, + t3: { readonly url: string | undefined; readonly export: SignalExport }, + ...fallbackUrls: ReadonlyArray +): SignalEndpoint | undefined => { + if (otel.disabled) { + return undefined; + } + const t3Url = blankAsUnset(t3.url); + if (t3Url !== undefined) { + return { url: t3Url, export: t3.export }; + } + return OtelSignal.$match(otel[signal], { + Export: ({ url, protocol, headers }): SignalEndpoint => ({ + url, + export: { protocol, headers, exportIntervalMs: t3.export.exportIntervalMs }, + }), + Off: () => undefined, + Unset: () => { + const url = fallbackUrls.map(blankAsUnset).find((candidate) => candidate !== undefined); + return url === undefined ? undefined : { url, export: t3.export }; + }, + }); +}; + /** * Provide this around Effect's OTLP exporters, which read * `OTEL_RESOURCE_ATTRIBUTES` for themselves and die when it does not decode, @@ -154,4 +367,7 @@ export const none: OtelEnvironment = { disabled: false, warnings: [], resourceAttributes: {}, + traces: OtelSignal.Unset(), + metrics: OtelSignal.Unset(), + logs: OtelSignal.Unset(), }; From 1a0c915c41024ddb47e16befd9fc730c1173af02 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Fri, 25 Sep 2026 13:09:30 -0700 Subject: [PATCH 50/58] fix(terminal): settling a thread closes its idle shells (#13673) Co-authored-by: Claude Opus 5.5 (1M context) --- .../OrchestrationEngineHarness.integration.ts | 2 + .../Layers/ProviderCommandReactor.test.ts | 75 ++++++++++++++++++ .../Layers/ProviderCommandReactor.ts | 15 ++-- .../src/project/AgentSessionImporter.test.ts | 2 + .../project/ProjectSetupScriptRunner.test.ts | 74 +++++++++++++++++- .../src/project/ProjectSetupScriptRunner.ts | 13 +++- apps/server/src/terminal/Manager.test.ts | 67 ++++++++++++++++ apps/server/src/terminal/Manager.ts | 77 ++++++++++++++++++- docs/user/thread-sidebar.md | 4 +- 9 files changed, 318 insertions(+), 11 deletions(-) diff --git a/apps/server/integration/OrchestrationEngineHarness.integration.ts b/apps/server/integration/OrchestrationEngineHarness.integration.ts index 0df54be2f701..1e116a91fea7 100644 --- a/apps/server/integration/OrchestrationEngineHarness.integration.ts +++ b/apps/server/integration/OrchestrationEngineHarness.integration.ts @@ -26,6 +26,7 @@ import * as Tracer from "effect/Tracer"; import * as CheckpointStore from "../src/checkpointing/CheckpointStore.ts"; import { TextGeneration } from "../src/textGeneration/TextGeneration.ts"; +import * as TerminalManager from "../src/terminal/Manager.ts"; import { OrchestrationCommandReceiptRepositoryLive } from "../src/persistence/Layers/OrchestrationCommandReceipts.ts"; import { OrchestrationEventStoreLive } from "../src/persistence/Layers/OrchestrationEventStore.ts"; import { ProjectionPendingApprovalRepositoryLive } from "../src/persistence/Layers/ProjectionPendingApprovals.ts"; @@ -340,6 +341,7 @@ export const makeOrchestrationIntegrationHarness = ( tryHandlePromptCommand: () => Effect.succeed(false), }), ), + Layer.provide(Layer.mock(TerminalManager.TerminalManager)({ closeIdle: () => Effect.void })), Layer.provideMerge(runtimeServicesLayer), Layer.provideMerge(gitWorkflowLayer), Layer.provideMerge(textGenerationLayer), diff --git a/apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts b/apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts index c7d9417bc75b..254aec4bde7e 100644 --- a/apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts +++ b/apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts @@ -55,6 +55,7 @@ import { import { ProviderAuthService } from "../../provider/Services/ProviderAuthService.ts"; import { makeProviderRegistryLayer } from "../../provider/testUtils/providerRegistryMock.ts"; import { TextGeneration } from "../../textGeneration/TextGeneration.ts"; +import { TerminalManager } from "../../terminal/Manager.ts"; import * as RepositoryIdentityResolver from "../../project/RepositoryIdentityResolver.ts"; import { OrchestrationEngineLive } from "./OrchestrationEngine.ts"; import { OrchestrationProjectionPipelineLive } from "./ProjectionPipeline.ts"; @@ -307,6 +308,7 @@ describe("ProviderCommandReactor", () => { }), ); const pruneWorktrees = vi.fn((_: { readonly cwd: string }) => Effect.void); + const closeIdleTerminals = vi.fn((_: { readonly threadId: string }) => Effect.void); const createWorktree = vi.fn( (input: { readonly refName: string; readonly path: string | null }) => Effect.succeed({ worktree: { path: input.path ?? "", refName: input.refName } }), @@ -490,6 +492,7 @@ describe("ProviderCommandReactor", () => { generateThreadTitle, }), ), + Layer.provideMerge(Layer.mock(TerminalManager)({ closeIdle: closeIdleTerminals })), Layer.provideMerge(ServerSettingsService.layerTest()), Layer.provideMerge(SqlitePersistenceMemory), Layer.provideMerge(ServerConfig.layerTest(process.cwd(), baseDir)), @@ -621,6 +624,7 @@ describe("ProviderCommandReactor", () => { renameBranch, pruneWorktrees, createWorktree, + closeIdleTerminals, refreshStatus, generateBranchName, generateThreadTitle, @@ -4339,6 +4343,77 @@ describe("ProviderCommandReactor", () => { expect(thread?.settledOverride).toBe("settled"); expect(thread?.session?.status).toBe("stopped"); expect(thread?.session?.providerInstanceId).toBe(ProviderInstanceId.make("codex_work")); + expect(harness.closeIdleTerminals).toHaveBeenCalledWith({ + threadId: ThreadId.make("thread-1"), + }); }), ); + + effectIt.effect("closes idle terminals when a thread without a session settles", () => + Effect.gen(function* () { + const harness = yield* Effect.promise(() => createHarness()); + const terminalsClosed = yield* Deferred.make(); + harness.closeIdleTerminals.mockImplementation(() => + Deferred.succeed(terminalsClosed, undefined).pipe(Effect.asVoid), + ); + + yield* harness.engine.dispatch({ + type: "thread.settle", + commandId: CommandId.make("cmd-settle-without-session"), + threadId: ThreadId.make("thread-1"), + }); + yield* Deferred.await(terminalsClosed); + yield* Effect.promise(() => harness.drain()); + + expect(harness.closeIdleTerminals).toHaveBeenCalledWith({ + threadId: ThreadId.make("thread-1"), + }); + expect(harness.stopSession).not.toHaveBeenCalled(); + }), + ); + + effectIt.effect( + "keeps terminals when the thread is un-settled before its settle event runs", + () => + Effect.gen(function* () { + const harness = yield* Effect.promise(() => createHarness()); + const threadId = ThreadId.make("thread-1"); + const firstCloseStarted = yield* Deferred.make(); + const releaseFirstClose = yield* Deferred.make(); + harness.closeIdleTerminals.mockImplementationOnce(() => + Deferred.succeed(firstCloseStarted, undefined).pipe( + Effect.andThen(Deferred.await(releaseFirstClose)), + ), + ); + + yield* harness.engine.dispatch({ + type: "thread.settle", + commandId: CommandId.make("cmd-settle-first"), + threadId, + }); + // The reactor is busy with the first settle while the user changes their mind. + yield* Deferred.await(firstCloseStarted); + yield* harness.engine.dispatch({ + type: "thread.unsettle", + commandId: CommandId.make("cmd-unsettle-first"), + threadId, + reason: "user", + }); + yield* harness.engine.dispatch({ + type: "thread.settle", + commandId: CommandId.make("cmd-settle-second"), + threadId, + }); + yield* harness.engine.dispatch({ + type: "thread.unsettle", + commandId: CommandId.make("cmd-unsettle-second"), + threadId, + reason: "user", + }); + yield* Deferred.succeed(releaseFirstClose, undefined); + yield* Effect.promise(() => harness.drain()); + + expect(harness.closeIdleTerminals).toHaveBeenCalledTimes(1); + }), + ); }); diff --git a/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts b/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts index bff5a6096421..f6794135a925 100644 --- a/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts +++ b/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts @@ -65,6 +65,7 @@ import { import { resolveProjectSettings } from "@t3tools/shared/projectSettings"; import { VcsStatusBroadcaster } from "../../vcs/VcsStatusBroadcaster.ts"; import { GitWorkflowService } from "../../git/GitWorkflowService.ts"; +import * as TerminalManager from "../../terminal/Manager.ts"; const isProviderAdapterProcessError = Schema.is(ProviderAdapterProcessError); const isProviderAdapterRequestError = Schema.is(ProviderAdapterRequestError); const isProviderAdapterValidationError = Schema.is(ProviderAdapterValidationError); @@ -222,6 +223,7 @@ const make = Effect.gen(function* () { const vcsStatusBroadcaster = yield* VcsStatusBroadcaster; const textGeneration = yield* TextGeneration; const serverSettingsService = yield* ServerSettingsService; + const terminalManager = yield* TerminalManager.TerminalManager; /** Environment settings with the thread's project overrides applied. */ const projectSettingsForThread = Effect.fnUntraced(function* (threadId: ThreadId) { const settings = yield* serverSettingsService.getSettings; @@ -1822,11 +1824,14 @@ const make = Effect.gen(function* () { return; case "thread.settled": { const thread = yield* projectionSnapshotQuery.getThreadShellById(event.payload.threadId); - if ( - Option.isNone(thread) || - thread.value.session == null || - thread.value.session.status === "stopped" - ) { + // A thread re-engaged before this event ran keeps its shells and session. + if (Option.isNone(thread) || thread.value.settledOverride !== "settled") { + return; + } + // Idle shells close so they stop holding the worktree. A terminal that + // runs a command (a dev server, an editor) stays for the user to close. + yield* terminalManager.closeIdle({ threadId: event.payload.threadId }); + if (thread.value.session == null || thread.value.session.status === "stopped") { return; } yield* orchestrationEngine.dispatch({ diff --git a/apps/server/src/project/AgentSessionImporter.test.ts b/apps/server/src/project/AgentSessionImporter.test.ts index 7d623c91b326..2438edca8b1b 100644 --- a/apps/server/src/project/AgentSessionImporter.test.ts +++ b/apps/server/src/project/AgentSessionImporter.test.ts @@ -56,6 +56,7 @@ import { makeProviderRegistryLayer } from "../provider/testUtils/providerRegistr import { ServerSettingsService } from "../serverSettings.ts"; import * as AnalyticsService from "../telemetry/AnalyticsService.ts"; import { TextGeneration } from "../textGeneration/TextGeneration.ts"; +import { TerminalManager } from "../terminal/Manager.ts"; import { VcsStatusBroadcaster } from "../vcs/VcsStatusBroadcaster.ts"; import * as RepositoryIdentityResolver from "./RepositoryIdentityResolver.ts"; import { importRecentAgentThreads } from "./AgentSessionImporter.ts"; @@ -931,6 +932,7 @@ it.layer(integrationLayer)("AgentSessionImporter integration", (it) => { Layer.provide(Layer.mock(GitWorkflowService)({})), Layer.provide(Layer.mock(VcsStatusBroadcaster)({})), Layer.provide(Layer.mock(TextGeneration)({})), + Layer.provide(Layer.mock(TerminalManager)({ closeIdle: () => Effect.void })), Layer.provide(ServerSettingsService.layerTest()), ); diff --git a/apps/server/src/project/ProjectSetupScriptRunner.test.ts b/apps/server/src/project/ProjectSetupScriptRunner.test.ts index dd341a7f7859..650f304e8481 100644 --- a/apps/server/src/project/ProjectSetupScriptRunner.test.ts +++ b/apps/server/src/project/ProjectSetupScriptRunner.test.ts @@ -58,7 +58,7 @@ const makeProjectionSnapshotQueryLayer = (project: OrchestrationProject) => }); type TerminalOverrides = Pick & - Partial>; + Partial>; const makeTerminalManagerLayer = (overrides: TerminalOverrides) => Layer.succeed(TerminalManager.TerminalManager, { @@ -67,6 +67,7 @@ const makeTerminalManagerLayer = (overrides: TerminalOverrides) => clear: () => Effect.void, restart: () => Effect.die(new Error("unused")), close: () => Effect.void, + closeIdle: () => Effect.void, subscribe: () => Effect.succeed(() => undefined), subscribeMetadata: () => Effect.succeed(() => undefined), ...overrides, @@ -262,6 +263,7 @@ describe("ProjectSetupScriptRunner", () => { listener = null; }); }); + const closeIdle = vi.fn(() => Effect.void); const project = makeProject([ { id: "setup", @@ -329,14 +331,82 @@ describe("ProjectSetupScriptRunner", () => { ]); // The subscription is torn down once the sentinel arrives. expect(listener).toBeNull(); + // A failed run keeps its shell open for a look. + expect(closeIdle).not.toHaveBeenCalled(); }).pipe( - Effect.provide(testLayer(project, { open, write, subscribe })), + Effect.provide(testLayer(project, { open, write, subscribe, closeIdle })), Effect.provideService(HostProcessPlatform, "linux"), Effect.provideService(HostProcessEnvironment, { SHELL: "/bin/zsh" }), ); }, ); + it.effect("closes the idle setup shell after a clean exit", () => { + const open = vi.fn(() => + Effect.succeed({ + threadId: "thread-1", + terminalId: "setup-setup", + cwd: "/repo/worktrees/a", + worktreePath: "/repo/worktrees/a", + status: "running" as const, + pid: 123, + history: "", + exitCode: null, + exitSignal: null, + label: "setup-setup", + updatedAt: "2026-01-01T00:00:00.000Z", + }), + ); + let written = ""; + const write = vi.fn((input: { data: string }) => + Effect.sync(() => void (written = input.data)), + ); + let listener: ((event: TerminalEvent) => Effect.Effect) | null = null; + const subscribe = vi.fn((next: (event: TerminalEvent) => Effect.Effect) => { + listener = next; + return Effect.succeed(() => { + listener = null; + }); + }); + const closeIdle = vi.fn(() => Effect.void); + const project = makeProject([ + { + id: "setup", + name: "Setup", + command: "bun install", + icon: "configure", + runOnWorktreeCreate: true, + }, + ]); + + return Effect.gen(function* () { + const runner = yield* ProjectSetupScriptRunner.ProjectSetupScriptRunner; + const result = yield* runner.runForThread({ + threadId: "thread-1", + projectCwd: "/repo/project", + worktreePath: "/repo/worktrees/a", + observeCompletion: {}, + }); + if (result.status !== "started" || !result.completion) { + return yield* Effect.die("expected an observed setup run"); + } + const sentinel = /__T3_SETUP_DONE___[0-9a-f]{32}:/.exec(written)?.[0]; + yield* listener!({ + threadId: "thread-1", + terminalId: "setup-setup", + type: "output", + data: `${sentinel}0\r\n`, + }); + + expect((yield* result.completion).exitCode).toBe(0); + expect(closeIdle).toHaveBeenCalledWith({ threadId: "thread-1", terminalId: "setup-setup" }); + }).pipe( + Effect.provide(testLayer(project, { open, write, subscribe, closeIdle })), + Effect.provideService(HostProcessPlatform, "linux"), + Effect.provideService(HostProcessEnvironment, { SHELL: "/bin/zsh" }), + ); + }); + it.effect("unsubscribes from terminal output when the command cannot be written", () => { const open = vi.fn(() => Effect.succeed({ diff --git a/apps/server/src/project/ProjectSetupScriptRunner.ts b/apps/server/src/project/ProjectSetupScriptRunner.ts index 16cbfaa59496..74bc41e5e8cd 100644 --- a/apps/server/src/project/ProjectSetupScriptRunner.ts +++ b/apps/server/src/project/ProjectSetupScriptRunner.ts @@ -36,6 +36,7 @@ export interface ProjectSetupScriptRunnerResultStarted { * Resolves when the script's shell prints the completion sentinel. The * exit code is null when the terminal exited or was closed before the * sentinel arrived. Only present when `observeCompletion` was requested. + * An exit code of 0 closes the setup shell if it has nothing left running. */ readonly completion?: Effect.Effect; } @@ -412,6 +413,16 @@ export const make = Effect.gen(function* () { Effect.tapError(() => Effect.sync(() => observed?.unsubscribe())), ); + // A clean run leaves only an idle prompt behind; its output stays in the + // terminal history. A failed run keeps its shell open for a look. + const completion = observed?.completion.pipe( + Effect.tap(({ exitCode }) => + exitCode === 0 + ? terminalManager.closeIdle({ threadId: input.threadId, terminalId }) + : Effect.void, + ), + ); + return { status: "started", scriptId: script.id, @@ -420,7 +431,7 @@ export const make = Effect.gen(function* () { terminalId, cwd, async: script.async !== false, - ...(observed ? { completion: observed.completion } : {}), + ...(completion ? { completion } : {}), } as const; }); diff --git a/apps/server/src/terminal/Manager.test.ts b/apps/server/src/terminal/Manager.test.ts index 80ab2c43e42c..f04161cfbd3c 100644 --- a/apps/server/src/terminal/Manager.test.ts +++ b/apps/server/src/terminal/Manager.test.ts @@ -1230,6 +1230,73 @@ it.layer( }), ); + it.effect("closes only a thread's idle shells, ignoring a helper forked from the shell", () => + Effect.gen(function* () { + // FakePtyAdapter assigns pids from 9000 in open order. + const { manager, ptyAdapter } = yield* createManager(5, { + processTable: Effect.succeed([ + { pid: 9000, ppid: 1, name: "zsh" }, + // An async prompt worker: a copy of the shell with no children. + { pid: 100, ppid: 9000, name: "zsh" }, + { pid: 9001, ppid: 1, name: "zsh" }, + { pid: 200, ppid: 9001, name: "node" }, + { pid: 9002, ppid: 1, name: "zsh" }, + // A subshell with a child is real work. + { pid: 300, ppid: 9002, name: "zsh" }, + { pid: 301, ppid: 300, name: "sleep" }, + { pid: 9003, ppid: 1, name: "zsh" }, + ]), + }).pipe(Effect.provide(withHostPlatform("linux"))); + yield* manager.open(openInput({ terminalId: "idle" })); + yield* manager.open(openInput({ terminalId: "dev-server" })); + yield* manager.open(openInput({ terminalId: "subshell" })); + yield* manager.open(openInput({ threadId: "thread-2" })); + + yield* manager.closeIdle({ threadId: "thread-1" }); + + expect(ptyAdapter.processes.map((process) => process.killed)).toEqual([ + true, + false, + false, + false, + ]); + }), + ); + + it.effect("keeps terminals that get input or output while closeIdle checks them", () => + Effect.gen(function* () { + const ptyAdapter = new FakePtyAdapter(); + // The typed command's process misses the snapshot, but its input or echo lands. + let duringCheck: (pid: number) => Effect.Effect = () => Effect.void; + const { manager, getEvents } = yield* createManager(5, { + ptyAdapter, + subprocessPollIntervalMs: 60_000, + subprocessInspector: (pid) => + duringCheck(pid).pipe( + Effect.as({ hasRunningSubprocess: false, childCommand: null, processIds: [] }), + ), + }); + yield* manager.open(openInput({ terminalId: "typed" })); + yield* manager.open(openInput({ terminalId: "echoed" })); + const [typed, echoed] = ptyAdapter.processes; + duringCheck = (pid) => + pid === typed!.pid + ? manager + .write({ threadId: "thread-1", terminalId: "typed", data: "make build\r" }) + .pipe(Effect.orDie) + : Effect.gen(function* () { + echoed!.emitData("make build\r\n"); + yield* waitFor( + Effect.map(getEvents, (events) => events.some((event) => event.type === "output")), + ); + }).pipe(Effect.orDie); + + yield* manager.closeIdle({ threadId: "thread-1" }); + + expect(ptyAdapter.processes.map((process) => process.killed)).toEqual([false, false]); + }), + ); + it.effect("backs off the spawned fallback when the resource monitor snapshot fails", () => Effect.gen(function* () { const fallbackCalls: Array = []; diff --git a/apps/server/src/terminal/Manager.ts b/apps/server/src/terminal/Manager.ts index 1a65587430d5..75d592c00c0d 100644 --- a/apps/server/src/terminal/Manager.ts +++ b/apps/server/src/terminal/Manager.ts @@ -198,6 +198,17 @@ export class TerminalManager extends Context.Service< */ readonly close: (input: TerminalCloseInput) => Effect.Effect; + /** + * Close a thread's terminals that wait at an idle shell prompt. A terminal + * that runs a command stays open. When `terminalId` is set, only that + * terminal is considered. Used when a thread settles and when a setup + * script finishes. + */ + readonly closeIdle: (input: { + readonly threadId: string; + readonly terminalId?: string; + }) => Effect.Effect; + /** * Subscribe to terminal runtime events with a direct callback. * @@ -275,6 +286,8 @@ interface TerminalSessionState { exitSignal: number | null; updatedAt: string; eventSequence: number; + /** Counts writes, so closeIdle can see input that has not echoed yet. */ + inputCount: number; cols: number; rows: number; process: PtyAdapter.PtyProcess | null; @@ -692,7 +705,17 @@ function deriveSubprocessInspectResult( terminalPid: number, platform: NodeJS.Platform, ): TerminalSubprocessInspectResult { - const childPid = (snapshot.childrenByParent.get(terminalPid) ?? [])[0]; + const commandName = (pid: number) => + normalizeChildCommandName(snapshot.commandById.get(pid) ?? "", platform); + const shellName = commandName(terminalPid); + // Async prompt themes fork the shell into a helper that waits with no + // children of its own. That copy is not a command the user started. + const childPid = (snapshot.childrenByParent.get(terminalPid) ?? []).find( + (pid) => + shellName === null || + commandName(pid) !== shellName || + (snapshot.childrenByParent.get(pid)?.length ?? 0) > 0, + ); if (childPid === undefined) { return { hasRunningSubprocess: false, childCommand: null, processIds: [] }; } @@ -707,7 +730,7 @@ function deriveSubprocessInspectResult( pending.push(pid); } } - const normalized = normalizeChildCommandName(snapshot.commandById.get(childPid) ?? "", platform); + const normalized = commandName(childPid); return { hasRunningSubprocess: true, childCommand: normalized ? truncateTerminalWireLabel(normalized) : null, @@ -2537,6 +2560,7 @@ export const makeWithOptions = Effect.fn("TerminalManager.makeWithOptions")(func exitSignal: null, updatedAt: yield* nowIso, eventSequence: 0, + inputCount: 0, cols, rows, process: null, @@ -2877,6 +2901,7 @@ export const makeWithOptions = Effect.fn("TerminalManager.makeWithOptions")(func terminalId, }); } + session.inputCount += 1; yield* Effect.try({ try: () => process.write(input.data), catch: (cause) => @@ -2958,6 +2983,7 @@ export const makeWithOptions = Effect.fn("TerminalManager.makeWithOptions")(func exitSignal: null, updatedAt: yield* nowIso, eventSequence: 0, + inputCount: 0, cols, rows, process: null, @@ -3042,6 +3068,52 @@ export const makeWithOptions = Effect.fn("TerminalManager.makeWithOptions")(func }), ); + const closeIdle: TerminalManager["Service"]["closeIdle"] = (input) => + withThreadLock( + input.threadId, + Effect.gen(function* () { + const running = (yield* sessionsForThread(input.threadId)).filter( + (session): session is TerminalSessionState & { pid: number } => + session.status === "running" && + Number.isInteger(session.pid) && + (input.terminalId === undefined || session.terminalId === input.terminalId), + ); + if (running.length === 0) return; + // A command started during the process check can miss the snapshot, + // but its input or echo still lands. Both counters only grow, so the + // sum changes when either one does. + const activityMark = (session: TerminalSessionState) => + session.eventSequence + session.inputCount; + const marks = new Map( + running.map((session) => [session.terminalId, activityMark(session)]), + ); + // Inspect now instead of trusting the last poll, so a command started + // since then keeps its terminal. + const { inspector } = yield* acquireSubprocessInspector; + yield* Effect.forEach( + running, + (session) => + inspector(session.pid).pipe( + Effect.flatMap((result) => + result.hasRunningSubprocess || + activityMark(session) !== marks.get(session.terminalId) + ? Effect.void + : closeSession(input.threadId, session.terminalId, false), + ), + ), + { discard: true }, + ); + }), + ).pipe( + // The process check failed, so every terminal stays open. + Effect.catch((error) => + Effect.logWarning("failed to close idle terminals", { + threadId: input.threadId, + error: error.message, + }), + ), + ); + return TerminalManager.of({ open, attachStream, @@ -3050,6 +3122,7 @@ export const makeWithOptions = Effect.fn("TerminalManager.makeWithOptions")(func clear, restart, close, + closeIdle, subscribe, subscribeMetadata, }); diff --git a/docs/user/thread-sidebar.md b/docs/user/thread-sidebar.md index 0d7cfb736774..4a19bac401b9 100644 --- a/docs/user/thread-sidebar.md +++ b/docs/user/thread-sidebar.md @@ -90,7 +90,9 @@ Choose **Settle thread** from its menu to move finished work out of the active l without deleting the conversation. **Un-settle thread** restores it to active work and prevents automatic settlement until new activity resumes the usual rules. Manually settling an idle thread dismisses unanswered async questions without -sending an answer or restarting the agent. +sending an answer or restarting the agent. Settling also closes the thread's +terminals that wait at an idle prompt, and keeps their output. A terminal that +runs a command, such as a dev server, stays open. By default, environments settle inactive threads after three days and settle threads whose pull request merged. A closed pull request can also settle an idle From f5bd2fddbf00021b29c1dbe32210240886806718 Mon Sep 17 00:00:00 2001 From: Yash Singh Date: Fri, 25 Sep 2026 15:17:22 -0500 Subject: [PATCH 51/58] fix(server): load Cursor keyring with createRequire (#13678) --- apps/server/src/provider/cursorCredentialStore.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/server/src/provider/cursorCredentialStore.ts b/apps/server/src/provider/cursorCredentialStore.ts index c071e2a88578..9d7d1c3bccff 100644 --- a/apps/server/src/provider/cursorCredentialStore.ts +++ b/apps/server/src/provider/cursorCredentialStore.ts @@ -1,5 +1,9 @@ +import * as NodeModule from "node:module"; + const CACHE_MS = 5 * 60_000; +const requireForKeyring = NodeModule.createRequire(import.meta.url); + /** Share one Keychain request across usage history and limits in this server process. */ export function makeCachedCursorAccessTokenReader( read: () => Promise, @@ -24,6 +28,6 @@ export function makeCachedCursorAccessTokenReader( /** Read the Cursor CLI's default macOS credential without invoking the shared security binary. */ export const readMacCursorAccessToken = makeCachedCursorAccessTokenReader(async () => { - const { AsyncEntry } = await import("@napi-rs/keyring"); + const { AsyncEntry } = requireForKeyring("@napi-rs/keyring") as typeof import("@napi-rs/keyring"); return (await new AsyncEntry("cursor-access-token", "cursor-user").getPassword()) ?? null; }); From 4293433eccbe6c6661acd020e584ae5d2234bf1e Mon Sep 17 00:00:00 2001 From: shivam <91240327+shivamhwp@users.noreply.github.com> Date: Sat, 26 Sep 2026 01:47:54 +0530 Subject: [PATCH 52/58] perf(server): avoid rereading unchanged files in review previews (#13395) --- apps/server/src/vcs/GitVcsDriverCore.test.ts | 38 ++++++++++++++++++++ apps/server/src/vcs/GitVcsDriverCore.ts | 5 +-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.test.ts b/apps/server/src/vcs/GitVcsDriverCore.test.ts index 4a5dff870fd2..47ca4e178700 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.test.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.test.ts @@ -1449,6 +1449,44 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => { }), ); + for (const splitIndex of [false, true]) { + it.effect(`keeps the preceding second cached in review previews (split: ${splitIndex})`, () => + Effect.gen(function* () { + const cwd = yield* makeTmpDir(); + yield* initRepoWithCommit(cwd); + const driver = yield* GitVcsDriver.GitVcsDriver; + const fs = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + yield* writeTextFile(cwd, ".gitattributes", "stable.txt filter=probe\n"); + yield* writeTextFile(cwd, "stable.txt", "unchanged\n"); + yield* writeTextFile( + cwd, + ".git/filter.cjs", + 'require("node:fs").appendFileSync(".git/filter-runs", "read\\n"); process.stdin.pipe(process.stdout);', + ); + yield* git(cwd, ["config", "filter.probe.clean", "node .git/filter.cjs"]); + yield* fs.utimes(path.join(cwd, "stable.txt"), 1_699_999_999.5, 1_699_999_999.5); + yield* git(cwd, ["add", "."]); + yield* git(cwd, ["commit", "-m", "cache stable file"]); + if (splitIndex) yield* git(cwd, ["update-index", "--split-index"]); + const indexPath = path.join(cwd, ".git", "index"); + yield* fs.utimes(indexPath, 1_700_000_000, 1_700_000_000); + const originalIndex = yield* fs.readFile(indexPath); + const originalMtime = (yield* fs.stat(indexPath)).mtime; + yield* writeTextFile(cwd, ".git/filter-runs", ""); + yield* writeTextFile(cwd, "untracked.txt", "new\n"); + const preview = yield* driver.getReviewDiffPreview({ cwd }); + assert.deepStrictEqual( + preview.sources.find((source) => source.kind === "working-tree")!.files, + [{ path: "untracked.txt", previousPath: null, additions: 1, deletions: 0 }], + ); + assert.strictEqual(yield* fs.readFileString(path.join(cwd, ".git/filter-runs")), ""); + assert.deepStrictEqual(yield* fs.readFile(indexPath), originalIndex); + assert.deepStrictEqual((yield* fs.stat(indexPath)).mtime, originalMtime); + }), + ); + } + for (const [timestamp, splitIndex] of [ [1_700_000_000, false], [1_700_000_000.9999, false], diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index b15cd28b4e92..8ec274a46611 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -2358,9 +2358,10 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* if (indexExists) { const { mtime } = yield* fileSystem.stat(indexPath); yield* fileSystem.copyFile(indexPath, tempIndexPath); - // A newer copy timestamp hides racily clean edits. Round down before Git reads or rewrites it. + // Node FileSystem.stat truncates bigint timestamps to milliseconds before creating its Date. + // Flooring preserves the source second without making preceding-second files racy. const indexTime = Option.isSome(mtime) - ? Math.max(0, Math.floor((mtime.value.getTime() - 1) / 1000)) + ? Math.max(0, Math.floor(mtime.value.getTime() / 1000)) : 0; yield* fileSystem.utimes(tempIndexPath, indexTime, indexTime); } From 2598ce7a5ab0b25e32e0b67b084a9ec23cd8144f Mon Sep 17 00:00:00 2001 From: Yordis Prieto Date: Fri, 25 Sep 2026 16:42:12 -0400 Subject: [PATCH 53/58] feat(desktop): honor the standard OTLP variables in the main process and WSL backends (#13641) Signed-off-by: Yordis Prieto --- .../src/app/DesktopObservability.test.ts | 105 ++++++++++++++++-- apps/desktop/src/app/DesktopObservability.ts | 64 +++++++---- .../DesktopBackendConfiguration.test.ts | 76 ++++++++++++- .../backend/DesktopBackendConfiguration.ts | 40 ++++--- docs/operations/observability.md | 23 ++-- 5 files changed, 254 insertions(+), 54 deletions(-) diff --git a/apps/desktop/src/app/DesktopObservability.test.ts b/apps/desktop/src/app/DesktopObservability.test.ts index 215998631e92..0e4c4d7a969d 100644 --- a/apps/desktop/src/app/DesktopObservability.test.ts +++ b/apps/desktop/src/app/DesktopObservability.test.ts @@ -93,6 +93,9 @@ const collectorLayer = (requests: Array) => ), ); +// A developer's own OTEL_* variables would otherwise pick the endpoints. +const emptyEnv = ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })); + const encodeObservabilitySettingsFile = Schema.encodeSync( Schema.fromJsonString( Schema.Struct({ observability: Schema.Record(Schema.String, Schema.String) }), @@ -182,7 +185,7 @@ describe("DesktopObservability", () => { assert.isFalse(yield* fileSystem.exists(logPath)); }).pipe( Effect.scoped, - Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici)), + Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici, emptyEnv)), ), ); @@ -260,7 +263,7 @@ describe("DesktopObservability", () => { ); }).pipe( Effect.scoped, - Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici)), + Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici, emptyEnv)), ), ); @@ -300,7 +303,7 @@ describe("DesktopObservability", () => { assert.equal(records.at(-1)?.annotations.details, "code=1"); }).pipe( Effect.scoped, - Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici)), + Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici, emptyEnv)), ), ); @@ -344,7 +347,7 @@ describe("DesktopObservability", () => { assert.isFalse(text.includes("y")); }).pipe( Effect.scoped, - Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici)), + Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici, emptyEnv)), ), ); @@ -378,7 +381,7 @@ describe("DesktopObservability", () => { assert.equal(lines.length, 258); }).pipe( Effect.scoped, - Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici)), + Effect.provide(Layer.mergeAll(NodeServices.layer, NodeHttpClient.layerUndici, emptyEnv)), ), ); @@ -424,7 +427,93 @@ describe("DesktopObservability", () => { assert.lengthOf(record?.events ?? [], 0); }).pipe( Effect.scoped, - Effect.provide(Layer.mergeAll(NodeServices.layer, collectorLayer(requests))), + Effect.provide(Layer.mergeAll(NodeServices.layer, collectorLayer(requests), emptyEnv)), + ); + }); + + it.effect("exports to an OTEL endpoint over Settings, with its own headers and protocol", () => { + const requests: Array = []; + return Effect.gen(function* () { + const fileSystem = yield* FileSystem.FileSystem; + const baseDir = yield* fileSystem.makeTempDirectoryScoped({ + prefix: "t3-desktop-observability-test-", + }); + const environmentLayer = makeEnvironmentLayer(baseDir, true, { + T3CODE_OTLP_HEADERS: "x-scope=desktop", + }); + yield* writeObservabilitySettings(environmentLayer, { + otlpLogsUrl: "https://settings.example.com/v1/logs", + }); + + yield* Effect.scoped( + Effect.logInfo("desktop otel export").pipe( + Effect.provide(DesktopObservability.layer.pipe(Layer.provideMerge(environmentLayer))), + ), + ); + + assert.lengthOf(requests, 1); + const [request] = requests; + assert.strictEqual(request?.url, "https://collector.example.com/v1/logs"); + assert.strictEqual(request?.headers["x-otel"], "desktop"); + assert.strictEqual(request?.headers["x-scope"], undefined); + assert.strictEqual(request?.headers["content-type"], "application/json"); + }).pipe( + Effect.scoped, + Effect.provide( + Layer.mergeAll( + NodeServices.layer, + collectorLayer(requests), + ConfigProvider.layer( + ConfigProvider.fromEnv({ + env: { + OTEL_EXPORTER_OTLP_ENDPOINT: "https://collector.example.com", + OTEL_EXPORTER_OTLP_HEADERS: "x-otel=desktop", + OTEL_EXPORTER_OTLP_LOGS_PROTOCOL: "http/json", + }, + }), + ), + ), + ), + ); + }); + + it.effect("exports nothing to Settings for logs an unusable OTEL endpoint claimed", () => { + const requests: Array = []; + return Effect.gen(function* () { + const fileSystem = yield* FileSystem.FileSystem; + const baseDir = yield* fileSystem.makeTempDirectoryScoped({ + prefix: "t3-desktop-observability-test-", + }); + const environmentLayer = makeEnvironmentLayer(baseDir, true, { + T3CODE_OTLP_HEADERS: "x-scope=desktop", + }); + yield* writeObservabilitySettings(environmentLayer, { + otlpLogsUrl: "https://settings.example.com/v1/logs", + }); + + yield* Effect.scoped( + Effect.logInfo("desktop otel off").pipe( + Effect.provide(DesktopObservability.layer.pipe(Layer.provideMerge(environmentLayer))), + ), + ); + + assert.lengthOf(requests, 0); + }).pipe( + Effect.scoped, + Effect.provide( + Layer.mergeAll( + NodeServices.layer, + collectorLayer(requests), + ConfigProvider.layer( + ConfigProvider.fromEnv({ + env: { + OTEL_EXPORTER_OTLP_ENDPOINT: "https://collector.example.com", + OTEL_EXPORTER_OTLP_LOGS_PROTOCOL: "grpc", + }, + }), + ), + ), + ), ); }); @@ -495,7 +584,7 @@ describe("DesktopObservability", () => { ); }).pipe( Effect.scoped, - Effect.provide(Layer.mergeAll(NodeServices.layer, collectorLayer(requests))), + Effect.provide(Layer.mergeAll(NodeServices.layer, collectorLayer(requests), emptyEnv)), ); }); @@ -519,7 +608,7 @@ describe("DesktopObservability", () => { assert.lengthOf(requests, 0); }).pipe( Effect.scoped, - Effect.provide(Layer.mergeAll(NodeServices.layer, collectorLayer(requests))), + Effect.provide(Layer.mergeAll(NodeServices.layer, collectorLayer(requests), emptyEnv)), ); }); diff --git a/apps/desktop/src/app/DesktopObservability.ts b/apps/desktop/src/app/DesktopObservability.ts index d39b517759ad..0bcb4d602102 100644 --- a/apps/desktop/src/app/DesktopObservability.ts +++ b/apps/desktop/src/app/DesktopObservability.ts @@ -3,6 +3,7 @@ import { makeLocalFileTracer, makeTraceSink, otlpSerializationLayer, + type SignalExport, } from "@t3tools/shared/observability"; import * as OtelEnvironment from "@t3tools/shared/otelEnvironment"; import { @@ -350,8 +351,10 @@ const readPersistedObservabilitySettings: Effect.Effect< }); /** - * Settings is read once for every signal, so the main process cannot - * resolve traces against one revision of the file and logs against another. + * Resolved as the server resolves them, with persisted Settings as the + * fallback. Settings is read once for every signal, so the main process + * cannot resolve traces against one revision of the file and logs against + * another. */ const resolveOtlpEndpoints = Effect.gen(function* () { const otel = yield* OtelEnvironment.load; @@ -367,10 +370,30 @@ const resolveOtlpEndpoints = Effect.gen(function* () { const environment = yield* DesktopEnvironment.DesktopEnvironment; const persisted = yield* readPersistedObservabilitySettings; + const signalExport: SignalExport = { + protocol: environment.otlpProtocol, + headers: Option.getOrUndefined(environment.otlpHeaders), + exportIntervalMs: environment.otlpExportIntervalMs, + }; return { - traces: Option.getOrUndefined(environment.otlpTracesUrl) ?? persisted.otlpTracesUrl, - metrics: Option.getOrUndefined(environment.otlpMetricsUrl) ?? persisted.otlpMetricsUrl, - logs: Option.getOrUndefined(environment.otlpLogsUrl) ?? persisted.otlpLogsUrl, + traces: OtelEnvironment.resolveSignalEndpoint( + otel, + "traces", + { url: Option.getOrUndefined(environment.otlpTracesUrl), export: signalExport }, + persisted.otlpTracesUrl, + ), + metrics: OtelEnvironment.resolveSignalEndpoint( + otel, + "metrics", + { url: Option.getOrUndefined(environment.otlpMetricsUrl), export: signalExport }, + persisted.otlpMetricsUrl, + ), + logs: OtelEnvironment.resolveSignalEndpoint( + otel, + "logs", + { url: Option.getOrUndefined(environment.otlpLogsUrl), export: signalExport }, + persisted.otlpLogsUrl, + ), warnings: otel.warnings, resourceAttributes: otel.resourceAttributes, }; @@ -602,8 +625,6 @@ const telemetryLayer = Layer.unwrap( Effect.gen(function* () { const environment = yield* DesktopEnvironment.DesktopEnvironment; const endpoints = yield* resolveOtlpEndpoints; - const headers = Option.getOrUndefined(environment.otlpHeaders); - const serializationLayer = otlpSerializationLayer(environment.otlpProtocol); const resource = { serviceName: "desktop", attributes: { @@ -629,14 +650,19 @@ const telemetryLayer = Layer.unwrap( : [ Logger.consolePretty(), OtlpLogger.make({ - url: endpoints.logs, - exportInterval: `${environment.otlpExportIntervalMs} millis`, - headers, + url: endpoints.logs.url, + exportInterval: `${endpoints.logs.export.exportIntervalMs} millis`, + headers: endpoints.logs.export.headers, resource, }), ], { mergeWithExisting: false }, - ).pipe(Layer.provide(OtlpExporter.layerFlusher), Layer.provide(serializationLayer)); + ).pipe( + Layer.provide(OtlpExporter.layerFlusher), + Layer.provide( + otlpSerializationLayer(endpoints.logs?.export.protocol ?? environment.otlpProtocol), + ), + ); const tracerLayer = Layer.unwrap( Effect.gen(function* () { @@ -651,11 +677,11 @@ const telemetryLayer = Layer.unwrap( endpoints.traces === undefined ? undefined : yield* OtlpTracer.make({ - url: endpoints.traces, - exportInterval: `${environment.otlpExportIntervalMs} millis`, - headers, + url: endpoints.traces.url, + exportInterval: `${endpoints.traces.export.exportIntervalMs} millis`, + headers: endpoints.traces.export.headers, resource, - }).pipe(Effect.provide(serializationLayer)); + }).pipe(Effect.provide(otlpSerializationLayer(endpoints.traces.export.protocol))); const tracer = yield* makeLocalFileTracer({ filePath: tracePath, maxBytes: DESKTOP_LOG_FILE_MAX_BYTES, @@ -679,11 +705,11 @@ const telemetryLayer = Layer.unwrap( // endpoints.metrics === undefined // ? Layer.empty // : OtlpMetrics.layer({ - // url: endpoints.metrics, - // exportInterval: `${environment.otlpExportIntervalMs} millis`, - // headers, + // url: endpoints.metrics.url, + // exportInterval: `${endpoints.metrics.export.exportIntervalMs} millis`, + // headers: endpoints.metrics.export.headers, // resource, - // }).pipe(Layer.provide(serializationLayer)); + // }).pipe(Layer.provide(otlpSerializationLayer(endpoints.metrics.export.protocol))); // Logged once the loggers above are installed, so the warnings use them. const otelWarningsLayer = Layer.effectDiscard( diff --git a/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts b/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts index 8d297750f784..07644a8af47c 100644 --- a/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts +++ b/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts @@ -780,12 +780,11 @@ describe("DesktopBackendConfiguration", () => { const config = yield* configuration.resolveWsl({ port: 5050, distro: null }); // No settings.json exists here: the endpoints come from the desktop - // process's env, which a WSL child cannot inherit, so the bootstrap - // has to carry them or log export stays off inside the distro. + // environment, and the bootstrap carries them for a WSL child that + // lacks the variables. assert.equal(config.bootstrap.otlpTracesUrl, "http://127.0.0.1:4318/v1/traces"); assert.equal(config.bootstrap.otlpMetricsUrl, "http://127.0.0.1:4318/v1/metrics"); assert.equal(config.bootstrap.otlpLogsUrl, "http://127.0.0.1:4318/v1/logs"); - assert.notInclude(config.env.WSLENV ?? "", "T3CODE_OTLP_LOGS_URL"); }).pipe( Effect.provide( DesktopBackendConfiguration.layer.pipe( @@ -996,6 +995,73 @@ describe("DesktopBackendConfiguration", () => { }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), ); + it.effect( + "resolveWsl carries the standard OTLP endpoint, headers, and protocol into the distro", + () => + Effect.gen(function* () { + const fileSystem = yield* FileSystem.FileSystem; + const baseDir = yield* fileSystem.makeTempDirectoryScoped({ + prefix: "t3-desktop-backend-config-test-", + }); + + const standard = { + OTEL_EXPORTER_OTLP_ENDPOINT: "https://collector.example.com:4318/base?api_key=secret", + OTEL_EXPORTER_OTLP_LOGS_HEADERS: "authorization=Bearer%20token", + T3CODE_OTLP_TRACES_URL: "http://t3.example.com:4318/v1/traces", + }; + const previousWslEnv = process.env.WSLENV; + // A developer's own OTLP variables would be forwarded too. + const ambientOtel = Object.entries(process.env).filter( + ([name]) => name.startsWith("OTEL_") || name.startsWith("T3CODE_OTLP_"), + ); + try { + for (const [name] of ambientOtel) delete process.env[name]; + delete process.env.WSLENV; + Object.assign(process.env, standard); + + yield* Effect.gen(function* () { + const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration; + const config = yield* configuration.resolveWsl({ port: 5050, distro: null }); + + assert.equal( + config.env.OTEL_EXPORTER_OTLP_ENDPOINT, + "https://collector.example.com:4318/base?api_key=secret", + ); + assert.equal( + config.env.OTEL_EXPORTER_OTLP_LOGS_HEADERS, + "authorization=Bearer%20token", + ); + // Without a flag, WSL passes the values through untranslated. + const wslEnv = (config.env.WSLENV ?? "").split(":"); + assert.include(wslEnv, "OTEL_EXPORTER_OTLP_ENDPOINT"); + assert.include(wslEnv, "OTEL_EXPORTER_OTLP_LOGS_HEADERS"); + assert.equal(config.env.T3CODE_OTLP_TRACES_URL, "http://t3.example.com:4318/v1/traces"); + assert.include(wslEnv, "T3CODE_OTLP_TRACES_URL"); + }).pipe( + Effect.provide( + DesktopBackendConfiguration.layer.pipe( + Layer.provideMerge(serverExposureLayer), + Layer.provideMerge(DesktopAppSettings.layerTest()), + Layer.provideMerge(DesktopWslServerTree.layerTest()), + Layer.provideMerge( + DesktopWslEnvironment.layerTest({ + isAvailable: true, + windowsToWslPath: () => Option.some("/mnt/c/repo/apps/server/src/index.ts"), + getDistroIp: () => Option.some("172.27.0.99"), + }), + ), + Layer.provideMerge(makeEnvironmentLayer(baseDir, { platform: "win32" })), + ), + ), + ); + } finally { + for (const name of Object.keys(standard)) delete process.env[name]; + restoreEnv("WSLENV", previousWslEnv); + for (const [name, value] of ambientOtel) restoreEnv(name, value); + } + }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), + ); + it.effect("resolveWsl preserves existing WSLENV entries when forwarding backend secrets", () => Effect.gen(function* () { const fileSystem = yield* FileSystem.FileSystem; @@ -1008,7 +1074,10 @@ describe("DesktopBackendConfiguration", () => { const previousAnthropicKey = process.env.ANTHROPIC_API_KEY; const previousOtlpHeaders = process.env.T3CODE_OTLP_HEADERS; const previousOtlpProtocol = process.env.T3CODE_OTLP_PROTOCOL; + // A developer's own OTEL_* variables would be forwarded too. + const ambientOtel = Object.entries(process.env).filter(([name]) => name.startsWith("OTEL_")); try { + for (const [name] of ambientOtel) delete process.env[name]; process.env.WSLENV = "GOPATH/p:OPENAI_API_KEY/u:EMPTY::AZURE_DEVOPS_EXT_PAT/u"; process.env.OPENAI_API_KEY = "openai-key"; process.env.ANTHROPIC_API_KEY = "anthropic-key"; @@ -1065,6 +1134,7 @@ describe("DesktopBackendConfiguration", () => { restoreEnv("ANTHROPIC_API_KEY", previousAnthropicKey); restoreEnv("T3CODE_OTLP_HEADERS", previousOtlpHeaders); restoreEnv("T3CODE_OTLP_PROTOCOL", previousOtlpProtocol); + for (const [name, value] of ambientOtel) restoreEnv(name, value); } }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), ); diff --git a/apps/desktop/src/backend/DesktopBackendConfiguration.ts b/apps/desktop/src/backend/DesktopBackendConfiguration.ts index d400c7a3a878..b3bec8830ec6 100644 --- a/apps/desktop/src/backend/DesktopBackendConfiguration.ts +++ b/apps/desktop/src/backend/DesktopBackendConfiguration.ts @@ -90,9 +90,8 @@ const DESKTOP_BACKEND_ENV_NAMES = [ ] as const; // Env vars that the WSL backend needs but Windows process.env won't forward -// across the wsl.exe boundary without WSLENV. The dev-server URL is handled -// separately via a `--dev-url` CLI flag because WSLENV translation of -// URL-shaped values (colons / slashes) is unreliable. +// across the wsl.exe boundary without WSLENV. The dev-server URL travels as +// the `--dev-url` CLI flag instead. const WSL_FORWARDED_ENV_NAMES = [ "OPENAI_API_KEY", "ANTHROPIC_API_KEY", @@ -101,6 +100,24 @@ const WSL_FORWARDED_ENV_NAMES = [ "OTEL_SDK_DISABLED", "T3CODE_OTLP_HEADERS", "T3CODE_OTLP_PROTOCOL", + // Forwarded without a WSLENV flag, so the values arrive untranslated. The + // server prefers an OTEL endpoint over the bootstrap envelope, so the T3 URLs + // travel as variables to keep winning inside the distro as they do on Windows. + "T3CODE_OTLP_TRACES_URL", + "T3CODE_OTLP_METRICS_URL", + "T3CODE_OTLP_LOGS_URL", + "OTEL_EXPORTER_OTLP_ENDPOINT", + "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", + "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT", + "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT", + "OTEL_EXPORTER_OTLP_HEADERS", + "OTEL_EXPORTER_OTLP_TRACES_HEADERS", + "OTEL_EXPORTER_OTLP_METRICS_HEADERS", + "OTEL_EXPORTER_OTLP_LOGS_HEADERS", + "OTEL_EXPORTER_OTLP_PROTOCOL", + "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", + "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", + "OTEL_EXPORTER_OTLP_LOGS_PROTOCOL", ] as const; const WSL_SERVER_SYSTEM_PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"; @@ -221,12 +238,11 @@ const readPersistedBackendObservabilitySettings = Effect.gen(function* () { }; }); -// The bootstrap is the only channel that carries an OTLP endpoint to every -// backend. A Windows-native child inherits the desktop process's env, but a -// WSL child gets nothing across wsl.exe that WSLENV does not declare, and -// WSLENV translation of URL-shaped values is unreliable, so the endpoints are -// deliberately not forwarded that way. Env beats the persisted settings file, -// matching the precedence resolveServerConfig and DesktopObservability apply. +// The bootstrap carries the OTLP endpoints to every backend, including a WSL +// child that lacks the variables. The T3 URLs also travel as variables in +// WSL_FORWARDED_ENV_NAMES so they outrank a forwarded OTEL endpoint. Env beats +// the persisted settings file, matching the precedence resolveServerConfig and +// DesktopObservability apply. const readBackendObservabilitySettings = Effect.gen(function* () { const environment = yield* DesktopEnvironment.DesktopEnvironment; const persisted = yield* readPersistedBackendObservabilitySettings; @@ -742,10 +758,8 @@ const resolveWslStartConfig = Effect.fn("desktop.backendConfiguration.resolveWsl }; // Forward the dev-server URL as an explicit CLI flag so the WSL backend's - // config resolution lands in dev/ instead of userdata/. Inheriting through - // WSLENV is unreliable in practice (URL-shaped values with colons / - // slashes get translated unpredictably depending on flags), and the - // packaged build leaves devServerUrl as None anyway. + // config resolution lands in dev/ instead of userdata/. The packaged build + // leaves devServerUrl as None. const devUrlArgs = Option.match(environment.devServerUrl, { onNone: () => [] as ReadonlyArray, onSome: (url) => ["--dev-url", url.href], diff --git a/docs/operations/observability.md b/docs/operations/observability.md index 0bdb0eb0c0f8..abe82d680b97 100644 --- a/docs/operations/observability.md +++ b/docs/operations/observability.md @@ -552,17 +552,18 @@ OTLP export: `OTEL_EXPORTER_OTLP_HEADERS`: comma-separated `key=value` pairs with percent-encoded values. - `T3CODE_OTLP_PROTOCOL`: `http/json` (default) or `http/protobuf` -The server also reads the standard `OTEL_EXPORTER_OTLP_{TRACES,METRICS,LOGS}_ENDPOINT` and generic -`OTEL_EXPORTER_OTLP_ENDPOINT` (with `/v1/traces`, `/v1/metrics`, or `/v1/logs` appended), for a -collector expecting those instead. A non-blank `T3CODE_OTLP_*_URL` wins over either, and a -per-signal endpoint wins over the generic one for its signal. A blank value counts as unset. A -signal with an OTEL endpoint takes its headers from `OTEL_EXPORTER_OTLP_HEADERS` and its protocol -from `OTEL_EXPORTER_OTLP_PROTOCOL` (default `http/protobuf`, read case-insensitively), and a -per-signal `OTEL_EXPORTER_OTLP_{TRACES,METRICS,LOGS}_HEADERS` or `_PROTOCOL` wins over the generic -one for its signal. `T3CODE_OTLP_HEADERS` and `T3CODE_OTLP_PROTOCOL` never apply to it. An endpoint -that is not an `http` or `https` URL, a protocol other than `http/protobuf` or `http/json` such as -`grpc`, or headers that are not `key=value` pairs with percent-encoded values turn that signal's -export off with a startup warning, rather than sending it to the Settings endpoint. +The server and the desktop app also read the standard +`OTEL_EXPORTER_OTLP_{TRACES,METRICS,LOGS}_ENDPOINT` and generic `OTEL_EXPORTER_OTLP_ENDPOINT` (with +`/v1/traces`, `/v1/metrics`, or `/v1/logs` appended), for a collector expecting those instead. A +non-blank `T3CODE_OTLP_*_URL` wins over either, and a per-signal endpoint wins over the generic one +for its signal. A blank value counts as unset. A signal with an OTEL endpoint takes its headers from +`OTEL_EXPORTER_OTLP_HEADERS` and its protocol from `OTEL_EXPORTER_OTLP_PROTOCOL` (default +`http/protobuf`, read case-insensitively), and a per-signal +`OTEL_EXPORTER_OTLP_{TRACES,METRICS,LOGS}_HEADERS` or `_PROTOCOL` wins over the generic one for its +signal. `T3CODE_OTLP_HEADERS` and `T3CODE_OTLP_PROTOCOL` never apply to it. An endpoint that is not +an `http` or `https` URL, a protocol other than `http/protobuf` or `http/json` such as `grpc`, or +headers that are not `key=value` pairs with percent-encoded values turn that signal's export off +with a startup warning, rather than sending it to the Settings endpoint. If the OTLP URLs are unset, local tracing still works, metrics stay in-process only, and logs stay on stdout only. From ed809f7ad274ebccdfbf029ccfd7ff2582fd486a Mon Sep 17 00:00:00 2001 From: "t3-code[bot]" <269035359+t3-code[bot]@users.noreply.github.com> Date: Fri, 25 Sep 2026 14:29:42 -0700 Subject: [PATCH 54/58] fix(web): restore compact provider instance badges (#13700) Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> --- apps/web/src/components/Sidebar.tsx | 2 +- apps/web/src/components/chat/ModelPickerSidebar.tsx | 2 +- apps/web/src/components/chat/ProviderInstanceIcon.tsx | 2 +- apps/web/src/components/chat/ProviderModelPicker.test.tsx | 3 --- apps/web/src/components/chat/ProviderModelPicker.tsx | 2 +- apps/web/src/components/settings/ProviderInstanceCard.tsx | 2 +- apps/web/src/index.css | 7 ++++++- apps/web/src/lib/utils.ts | 2 +- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 7cbae330c318..4b8027c14108 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -1965,7 +1965,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { showBadge={showInstanceBadge} // Glyph dims, badge stays saturated; offset matches the composer trigger. iconClassName="size-3.5 opacity-60" - badgeClassName="right-[-0.1875rem] bottom-[-0.1875rem] h-3 min-w-3 px-0.5 text-3xs" + badgeClassName="right-[-0.1875rem] bottom-[-0.1875rem] h-3 min-w-3 px-0.5 text-5xs" /> ) : null} diff --git a/apps/web/src/components/chat/ModelPickerSidebar.tsx b/apps/web/src/components/chat/ModelPickerSidebar.tsx index 80b06cbc680d..d043c053a073 100644 --- a/apps/web/src/components/chat/ModelPickerSidebar.tsx +++ b/apps/web/src/components/chat/ModelPickerSidebar.tsx @@ -210,7 +210,7 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: { ? "var(--background)" : "color-mix(in oklab, var(--muted) 30%, transparent)" } - {...(entry.accentColor ? { badgeClassName: "h-3 min-w-3 px-0.5 text-3xs" } : {})} + {...(entry.accentColor ? { badgeClassName: "h-3 min-w-3 px-0.5 text-5xs" } : {})} /> {showNewBadge ? ( diff --git a/apps/web/src/components/chat/ProviderInstanceIcon.tsx b/apps/web/src/components/chat/ProviderInstanceIcon.tsx index 4f6d83eb92bf..6c36087a1e29 100644 --- a/apps/web/src/components/chat/ProviderInstanceIcon.tsx +++ b/apps/web/src/components/chat/ProviderInstanceIcon.tsx @@ -55,7 +55,7 @@ export const ProviderInstanceIcon = memo(function ProviderInstanceIcon(props: { {props.showBadge ? ( { ); expect(markup).toContain(">CP"); - expect(markup).toContain("size-4"); - expect(markup).toContain("h-3"); - expect(markup).toContain("text-3xs"); }); }); diff --git a/apps/web/src/components/chat/ProviderModelPicker.tsx b/apps/web/src/components/chat/ProviderModelPicker.tsx index c24a3189435a..fbc178965378 100644 --- a/apps/web/src/components/chat/ProviderModelPicker.tsx +++ b/apps/web/src/components/chat/ProviderModelPicker.tsx @@ -250,7 +250,7 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: { iconClassName={cn("size-4", props.activeProviderIconClassName)} indicatorBackground={props.instanceIndicatorBackground ?? "var(--contrast-input)"} badgeClassName={cn( - "right-[-0.125rem] bottom-[-0.125rem] h-3 min-w-3 px-0.5 text-3xs", + "right-[-0.125rem] bottom-[-0.125rem] h-3 min-w-3 px-0.5 text-5xs", size === "xs" && "shadow-none", )} /> diff --git a/apps/web/src/components/settings/ProviderInstanceCard.tsx b/apps/web/src/components/settings/ProviderInstanceCard.tsx index 4e2405c138b1..ff0546f5012d 100644 --- a/apps/web/src/components/settings/ProviderInstanceCard.tsx +++ b/apps/web/src/components/settings/ProviderInstanceCard.tsx @@ -570,7 +570,7 @@ export function ProviderInstanceCard({ showBadge={Boolean(accentColor)} className="size-5" iconClassName="size-4 text-foreground/80" - badgeClassName="right-[-0.125rem] bottom-[-0.125rem] h-3 min-w-3 px-0.5 text-3xs" + badgeClassName="right-[-0.125rem] bottom-[-0.125rem] h-3 min-w-3 px-0.5 text-5xs" /> ) : FallbackIconComponent ? ( diff --git a/apps/web/src/index.css b/apps/web/src/index.css index 9caf42ca2d6c..1039f23b19b8 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -161,12 +161,17 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil @theme inline { /* Two steps below Tailwind's text-xs (12px) for dense UI: metadata rows, badges, counters, keyboard hints and diagnostics tables. 2xs is 11px, - 3xs is 10px and the floor of the scale. Registered with tailwind-merge in + 3xs is 10px. Provider icon overlays use 4xs (8px) and 5xs (7px) to fit + their smaller badges. Registered with tailwind-merge in lib/utils.ts so cn() treats them as font sizes, not colours. */ --text-2xs: 0.6875rem; --text-2xs--line-height: calc(1 / 0.6875); --text-3xs: 0.625rem; --text-3xs--line-height: calc(0.875 / 0.625); + --text-4xs: 0.5rem; + --text-4xs--line-height: 1; + --text-5xs: 0.4375rem; + --text-5xs--line-height: 1; /* Motion. drawer is the decelerating curve for surfaces that slide or pop in (composer context, pills). */ --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts index 43d55682e12d..ca9a3a6340c2 100644 --- a/apps/web/src/lib/utils.ts +++ b/apps/web/src/lib/utils.ts @@ -6,7 +6,7 @@ import { DraftId } from "../composerDraftStore"; // The theme's extra font sizes (index.css). Unregistered, tailwind-merge reads // text-2xs as a colour and drops it next to text-muted-foreground. -const twMerge = extendTailwindMerge({ extend: { theme: { text: ["2xs", "3xs"] } } }); +const twMerge = extendTailwindMerge({ extend: { theme: { text: ["2xs", "3xs", "4xs", "5xs"] } } }); export function cn(...inputs: CxOptions) { return twMerge(cx(inputs)); From 525af2d1ad4b6de847ea658c37a081fd7afe8ef6 Mon Sep 17 00:00:00 2001 From: AKolenda Date: Fri, 25 Sep 2026 18:23:19 -0600 Subject: [PATCH 55/58] perf(mobile): lighter Home rows away from the viewport (#13702) --- apps/mobile/src/features/home/HomeScreen.tsx | 62 +++++++++++++++-- .../home/swipe-row-activation.test.ts | 68 +++++++++++++++++++ .../src/features/home/swipe-row-activation.ts | 62 +++++++++++++++++ .../features/home/thread-swipe-actions.tsx | 25 ++++++- .../features/threads/thread-list-v2-items.tsx | 5 ++ 5 files changed, 217 insertions(+), 5 deletions(-) create mode 100644 apps/mobile/src/features/home/swipe-row-activation.test.ts create mode 100644 apps/mobile/src/features/home/swipe-row-activation.ts diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx index d1d108d3bed0..c57ac15b1ee5 100644 --- a/apps/mobile/src/features/home/HomeScreen.tsx +++ b/apps/mobile/src/features/home/HomeScreen.tsx @@ -1,7 +1,7 @@ import { useAndroidControlSizing } from "../../components/useAndroidControlSizing"; import type { ThreadMoveDestination } from "../threads/threadOrder"; import { computeThreadMoveAvailability } from "../threads/threadOrder"; -import { LegendList } from "@legendapp/list/react-native"; +import { LegendList, type LegendListRef } from "@legendapp/list/react-native"; import { type EnvironmentProject, type EnvironmentThreadShell, @@ -18,7 +18,14 @@ import { import { useAtomValue } from "@effect/atom-react"; import { useFocusEffect } from "@react-navigation/native"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { ActivityIndicator, Platform, View } from "react-native"; +import { + ActivityIndicator, + Platform, + View, + type GestureResponderEvent, + type NativeScrollEvent, + type NativeSyntheticEvent, +} from "react-native"; import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable"; import { useSafeAreaInsets } from "react-native-safe-area-context"; @@ -59,6 +66,7 @@ import { sortHomeProjectScopes, type HomeProjectSortOrder, } from "./homeThreadList"; +import { createSwipeRowActivation } from "./swipe-row-activation"; import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "./thread-swipe-actions"; import { useMaterialFabScroll } from "./MaterialFabScrollContext"; @@ -266,8 +274,45 @@ export function HomeScreen(props: HomeScreenProps) { openSwipeableRef.current?.close(); }, []); const onMaterialFabScroll = useMaterialFabScroll(); + const listRef = useRef(null); + const swipeRowActivation = useMemo(() => createSwipeRowActivation(), []); + const activateVisibleRows = useCallback( + (rows: ReadonlyArray) => { + const state = listRef.current?.getState(); + if (state === undefined || !(state.end >= 0)) return; + swipeRowActivation.activate( + rows.slice(Math.max(0, state.start - 2), state.end + 3).map((row) => row.key), + ); + }, + [swipeRowActivation], + ); + // Status-bar, accessibility and programmatic scrolls never arm the scroll + // gate, so every scroll also activates the visible rows once it settles. + const activationTimerRef = useRef | undefined>(undefined); + useEffect(() => () => clearTimeout(activationTimerRef.current), []); + const handleListScroll = useCallback( + (event: NativeSyntheticEvent) => { + onMaterialFabScroll?.(event); + clearTimeout(activationTimerRef.current); + activationTimerRef.current = setTimeout( + () => activateVisibleRows(listRef.current?.getState().data ?? []), + 200, + ); + }, + [activateVisibleRows, onMaterialFabScroll], + ); + const trackListTouches = useCallback( + (event: GestureResponderEvent, started: boolean) => { + const { changedTouches, touches } = event.nativeEvent; + swipeRowActivation.trackTouches( + started ? changedTouches.map((touch) => touch.identifier) : [], + touches.map((touch) => touch.identifier), + ); + }, + [swipeRowActivation], + ); const { swipeEnabled, scrollGateHandlers } = useSwipeableScrollGate({ - onScroll: onMaterialFabScroll, + onScroll: handleListScroll, onScrollBeginDrag: handleScrollBeginDrag, }); @@ -657,6 +702,9 @@ export function HomeScreen(props: HomeScreenProps) { ); useThreadJumpShortcuts(threadListV2Items, props.onSelectThread); + useEffect(() => { + if (swipeEnabled) activateVisibleRows(threadListV2Items); + }, [activateVisibleRows, swipeEnabled, threadListV2Items]); const renderV2Item = useCallback( ({ item }: { readonly item: ThreadListV2ListItem }) => { @@ -764,6 +812,7 @@ export function HomeScreen(props: HomeScreenProps) { onMoveThread={handleMoveThread} onSwipeableClose={handleSwipeableClose} onSwipeableWillOpen={handleSwipeableWillOpen} + activationKey={item.key} /> ); }, @@ -952,8 +1001,13 @@ export function HomeScreen(props: HomeScreenProps) { {/* Shared with the iPad sidebar: cells are reused across data rebuilds and `itemsAreEqual` keeps a minute tick (or an unrelated shell update) from re-rendering untouched rows. */} - + activateVisibleRows(threadListV2Items)} + onTouchStart={(event) => trackListTouches(event, true)} + onTouchEnd={(event) => trackListTouches(event, false)} + onTouchCancel={(event) => trackListTouches(event, false)} data={threadListV2Items} renderItem={renderV2Item} keyExtractor={v2KeyExtractor} diff --git a/apps/mobile/src/features/home/swipe-row-activation.test.ts b/apps/mobile/src/features/home/swipe-row-activation.test.ts new file mode 100644 index 000000000000..43f8dcf0ca7e --- /dev/null +++ b/apps/mobile/src/features/home/swipe-row-activation.test.ts @@ -0,0 +1,68 @@ +import { describe, expect, it, vi } from "vite-plus/test"; + +import { createSwipeRowActivation } from "./swipe-row-activation"; + +describe("createSwipeRowActivation", () => { + it("activates exactly the requested rows and notifies only on change", () => { + const activation = createSwipeRowActivation(); + const listener = vi.fn(); + activation.subscribe(listener); + + activation.activate(["a", "b"]); + activation.activate(["b", "a"]); + + expect(activation.isActive("a")).toBe(true); + expect(activation.isActive("c")).toBe(false); + expect(listener).toHaveBeenCalledTimes(1); + + activation.activate(["c"]); + expect(activation.isActive("a")).toBe(false); + expect(activation.isActive("c")).toBe(true); + expect(listener).toHaveBeenCalledTimes(2); + }); + + it("defers changes while a finger is on the list so a press is never remounted", () => { + const activation = createSwipeRowActivation(); + activation.activate(["a"]); + + activation.trackTouches(["1"], ["1"]); + activation.activate(["b"]); + activation.activate(["c"]); + expect(activation.isActive("a")).toBe(true); + expect(activation.isActive("c")).toBe(false); + + activation.trackTouches([], []); + expect(activation.isActive("a")).toBe(false); + expect(activation.isActive("b")).toBe(false); + expect(activation.isActive("c")).toBe(true); + }); + + it("ignores fingers that did not start on the list", () => { + const activation = createSwipeRowActivation(); + activation.trackTouches(["1"], ["1", "2"]); + activation.activate(["a"]); + + // The list finger lifts while finger 2 stays on another control. + activation.trackTouches([], ["2"]); + expect(activation.isActive("a")).toBe(true); + }); + + it("drops a list finger whose end event never arrived", () => { + const activation = createSwipeRowActivation(); + activation.trackTouches(["1"], ["1"]); + activation.activate(["a"]); + + activation.trackTouches(["2"], ["2"]); + activation.trackTouches([], []); + expect(activation.isActive("a")).toBe(true); + }); + + it("stops notifying after unsubscribe", () => { + const activation = createSwipeRowActivation(); + const listener = vi.fn(); + const unsubscribe = activation.subscribe(listener); + unsubscribe(); + activation.activate(["a"]); + expect(listener).not.toHaveBeenCalled(); + }); +}); diff --git a/apps/mobile/src/features/home/swipe-row-activation.ts b/apps/mobile/src/features/home/swipe-row-activation.ts new file mode 100644 index 000000000000..d56d12cba56f --- /dev/null +++ b/apps/mobile/src/features/home/swipe-row-activation.ts @@ -0,0 +1,62 @@ +import { createContext, use, useSyncExternalStore } from "react"; + +/** + * Full swipe rows (pan gesture, animated actions, hidden action buttons) only + * exist around the viewport. Every other Home row renders a dormant frame that + * paints the same content with a fraction of the native views, so a row the + * list rebuilds while scrolling is cheap. The scroll gate already disables + * swipes while the list moves, so rows are activated once it rests. + */ +export function createSwipeRowActivation() { + let activeKeys = new Set(); + // Swapping a row's frame remounts it, which would cancel a press or long + // press in progress, so changes wait until every finger that started on the + // list has lifted. + const listTouches = new Set(); + let pendingKeys: ReadonlyArray | null = null; + const listeners = new Set<() => void>(); + const apply = (keys: ReadonlyArray) => { + if (keys.length === activeKeys.size && keys.every((key) => activeKeys.has(key))) return; + activeKeys = new Set(keys); + for (const listener of listeners) listener(); + }; + return { + subscribe(listener: () => void) { + listeners.add(listener); + return () => void listeners.delete(listener); + }, + isActive: (key: string) => activeKeys.has(key), + activate(keys: ReadonlyArray) { + if (listTouches.size > 0) pendingKeys = keys; + else apply(keys); + }, + /** + * `started` are touches that just began on the list; `onScreen` is every + * finger still down anywhere. A finger on another control never holds + * changes, and one whose end event went missing is dropped here. + */ + trackTouches(started: ReadonlyArray, onScreen: ReadonlyArray) { + for (const id of started) listTouches.add(id); + for (const id of listTouches) if (!onScreen.includes(id)) listTouches.delete(id); + if (listTouches.size > 0 || pendingKeys === null) return; + const keys = pendingKeys; + pendingKeys = null; + apply(keys); + }, + }; +} + +export type SwipeRowActivation = ReturnType; + +export const SwipeRowActivationContext = createContext(null); + +const subscribeNever = () => () => {}; + +/** Rows outside an activation provider (e.g. the iPad sidebar) stay live. */ +export function useSwipeRowDormant(key: string | undefined): boolean { + const activation = use(SwipeRowActivationContext); + return useSyncExternalStore( + activation?.subscribe ?? subscribeNever, + () => activation !== null && key !== undefined && !activation.isActive(key), + ); +} diff --git a/apps/mobile/src/features/home/thread-swipe-actions.tsx b/apps/mobile/src/features/home/thread-swipe-actions.tsx index 44f3c36e6655..e62935c28861 100644 --- a/apps/mobile/src/features/home/thread-swipe-actions.tsx +++ b/apps/mobile/src/features/home/thread-swipe-actions.tsx @@ -40,6 +40,7 @@ import Animated, { } from "react-native-reanimated"; import { AppText as Text } from "../../components/AppText"; +import { SwipeRowActivationContext, type SwipeRowActivation } from "./swipe-row-activation"; import { registerThreadDismissal } from "./thread-dismissal"; // Wide enough for the longest action label ("Unarchive"). @@ -129,11 +130,14 @@ const SwipeableScrollGateContext = createContext(true); export function SwipeableScrollGateProvider(props: { readonly enabled: boolean; + readonly activation?: SwipeRowActivation; readonly children: ReactNode; }) { return ( - {props.children} + + {props.children} + ); } @@ -260,13 +264,32 @@ interface ThreadSwipeableProps { * open/mid-drag state can't leak onto another row. */ readonly resetKey?: string; + /** Paints the row without swipe machinery; see swipe-row-activation. */ + readonly dormant?: boolean; readonly simultaneousWithExternalGesture?: ComponentProps< typeof ReanimatedSwipeable >["simultaneousWithExternalGesture"]; readonly threadTitle: string; } +const closeDormant = () => {}; + export function ThreadSwipeable(props: ThreadSwipeableProps) { + if (props.dormant) { + // Mirrors ReanimatedSwipeable's container and children views. + return ( + + + {props.children(closeDormant)} + + + ); + } // Recycled content gets fresh native and animation state. Late callbacks // from the previous row retain its action, never the replacement's action. return ; diff --git a/apps/mobile/src/features/threads/thread-list-v2-items.tsx b/apps/mobile/src/features/threads/thread-list-v2-items.tsx index 31039388dc09..eb089b95060a 100644 --- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx +++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx @@ -35,6 +35,7 @@ import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic"; import { useUniwindTheme } from "../../lib/useUniwindTheme"; import type { PendingNewTask } from "../../state/use-pending-new-tasks"; import { useThreadPr } from "../../state/use-thread-pr"; +import { useSwipeRowDormant } from "../home/swipe-row-activation"; import { ThreadSwipeable } from "../home/thread-swipe-actions"; import { buildThreadTitleRegenerationMenuItems } from "./thread-title-regeneration-menu"; import { @@ -518,6 +519,8 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { readonly canMoveDown?: boolean; readonly onSwipeableWillOpen: (methods: SwipeableMethods) => void; readonly onSwipeableClose: (methods: SwipeableMethods) => void; + /** List key checked against the Home swipe row activation. */ + readonly activationKey?: string; readonly searchMatch?: EnvironmentThreadSearchMatch; readonly searchQuery?: string; readonly simultaneousSwipeGesture?: ComponentProps< @@ -545,6 +548,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { } = props; const snoozedRow = props.snoozed === true; const pinnedRow = props.pinned === true; + const dormant = useSwipeRowDormant(props.activationKey); const pr = useThreadPr(thread); @@ -1180,6 +1184,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { setCustomSnoozeOpen(false)} onSnooze={handleSnooze} /> )} Date: Fri, 25 Sep 2026 19:27:37 -0500 Subject: [PATCH 56/58] fix(usage): price Cursor cache savings by base model (#13731) --- apps/server/src/usage/cursorUsageReader.ts | 13 +++++++++++++ apps/server/src/usage/usagePricing.test.ts | 21 +++++++++++++++++++++ apps/server/src/usage/usagePricing.ts | 10 +++++++--- apps/server/src/usage/usageTranscripts.ts | 5 +++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/apps/server/src/usage/cursorUsageReader.ts b/apps/server/src/usage/cursorUsageReader.ts index 81c680afff0b..1e07fcc7a825 100644 --- a/apps/server/src/usage/cursorUsageReader.ts +++ b/apps/server/src/usage/cursorUsageReader.ts @@ -17,6 +17,18 @@ function tokens(value: unknown): number { return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : 0; } +/** + * Maps Cursor's tiered names (`cursor-grok-4.6-high-fast`, + * `claude-fable-5-1-thinking-high`) to the base model's rate-table key. + * Grok resolves through xAI's first-party entry, which has no bare alias. + */ +export function cursorRateModel(model: string): string { + const base = model + .replace(/^cursor-/, "") + .replace(/(?:-thinking)?(?:-(?:none|minimal|low|medium|high|xhigh|max))?(?:-fast)?$/, ""); + return base.startsWith("grok-") ? `xai/${base}` : base; +} + export interface CursorAccountUsageReadResult { readonly accountKey: string | null; readonly records: readonly UsageRecord[]; @@ -232,6 +244,7 @@ export async function readCursorAccountUsage( provider: "cursor", timestampMs, model: event.model, + rateModel: cursorRateModel(event.model), sessionId, totals, reportedCostUsd, diff --git a/apps/server/src/usage/usagePricing.test.ts b/apps/server/src/usage/usagePricing.test.ts index ca340a44a64e..db4f68c2cb42 100644 --- a/apps/server/src/usage/usagePricing.test.ts +++ b/apps/server/src/usage/usagePricing.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from "@effect/vitest"; +import { cursorRateModel } from "./cursorUsageReader.ts"; import { cacheSavingsUsd, createOverrideRateTable, @@ -49,6 +50,26 @@ describe("usage pricing", () => { expect(cacheSavingsUsd(table, record("example-model"), overrides)).toBe(1.5); }); + it("prices Cursor cache savings at the base model rate", () => { + const table = parseRateTable({ + "claude-fable-5-1": rate(10e-6, 1e-6), + "xai/grok-4.7": rate(2e-6, 0.5e-6), + "openrouter/x-ai/grok-4.7": rate(3e-6, 0.5e-6), + }); + const cursorRecord = (model: string) => ({ + ...record(model, 0.25), + rateModel: cursorRateModel(model), + }); + + expect(cacheSavingsUsd(table, cursorRecord("claude-fable-5-1-thinking-high"))).toBeCloseTo(9); + expect(cacheSavingsUsd(table, cursorRecord("cursor-grok-4.7-high-fast"))).toBeCloseTo(1.5); + expect(cacheSavingsUsd(table, cursorRecord("default"))).toBe(0); + expect(priceUsage(table, cursorRecord("grok-4.7-xhigh-fast"))).toEqual({ + costUsd: 0.25, + costSource: "providerReported", + }); + }); + it("prices unknown models offline and uses input prices for omitted cache rates", () => { const table = parseRateTable({}); const overrides = createOverrideRateTable({ diff --git a/apps/server/src/usage/usagePricing.ts b/apps/server/src/usage/usagePricing.ts index 60bf31b93e31..78f6cf2c5cd9 100644 --- a/apps/server/src/usage/usagePricing.ts +++ b/apps/server/src/usage/usagePricing.ts @@ -184,7 +184,10 @@ export function lookupRate(table: RateTable, model: string): ModelRate | null { } /** The parts of a transcript record that decide its price. */ -export type PricedRecord = Pick; +export type PricedRecord = Pick< + UsageRecord, + "model" | "rateModel" | "totals" | "fast" | "reportedCostUsd" +>; export interface PricedUsage { readonly costUsd: number; @@ -208,7 +211,7 @@ export function priceUsage( return { costUsd: reportedCostUsd, costSource: "providerReported" }; } - const rate = override ?? lookupRate(table, model); + const rate = override ?? lookupRate(table, record.rateModel ?? model); if (rate === null) return { costUsd: 0, costSource: "unpriced" }; const standardCostUsd = @@ -232,7 +235,8 @@ export function cacheSavingsUsd( record: PricedRecord, overrides?: RateTable, ): number { - const rate = overrides?.get(record.model.trim()) ?? lookupRate(table, record.model); + const rate = + overrides?.get(record.model.trim()) ?? lookupRate(table, record.rateModel ?? record.model); if (rate === null) return 0; return ( record.totals.cachedInputTokens * diff --git a/apps/server/src/usage/usageTranscripts.ts b/apps/server/src/usage/usageTranscripts.ts index 5da13168a1af..6e01c2c5a8ed 100644 --- a/apps/server/src/usage/usageTranscripts.ts +++ b/apps/server/src/usage/usageTranscripts.ts @@ -12,6 +12,11 @@ export interface UsageRecord { readonly provider: UsageProviderKind; readonly timestampMs: number; readonly model: string; + /** + * Rate-table key when the provider's display name carries tiers the table + * does not know, such as Cursor's `claude-opus-5-5-high`. Defaults to `model`. + */ + readonly rateModel?: string; readonly sessionId: string; readonly totals: UsageTokenTotals; readonly reportedCostUsd: number | null; From 595a1e1f537f403eba408817c2aba35e61c2ac29 Mon Sep 17 00:00:00 2001 From: AKolenda Date: Fri, 25 Sep 2026 18:35:33 -0600 Subject: [PATCH 57/58] perf(mobile): render Home rows further ahead while scrolling (#13705) Co-authored-by: Julius Marminge Co-authored-by: Claude Opus 5.5 (1M context) --- apps/mobile/src/features/home/HomeScreen.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx index c57ac15b1ee5..75be079f0de8 100644 --- a/apps/mobile/src/features/home/HomeScreen.tsx +++ b/apps/mobile/src/features/home/HomeScreen.tsx @@ -138,6 +138,10 @@ interface HomeScreenProps { // measured-height pool expansion. The old tallest-card estimate (~92) fired // that warning on every ordinary shelf expand, so the average wins. const ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT = 72; +// Rows away from the viewport are cheap dormant frames (see +// swipe-row-activation), so render further ahead: a fast fling then reaches +// rows that are already built instead of rows still being rebuilt. +const THREAD_LIST_V2_DRAW_DISTANCE = 1_000; const PRE_LIQUID_GLASS_BOTTOM_TOOLBAR_HEIGHT = 44; /** * Top spacing between the list and the Android custom header. The Android @@ -1014,7 +1018,7 @@ export function HomeScreen(props: HomeScreenProps) { getItemType={(item) => item.type} itemsAreEqual={threadListV2ListItemsAreEqual} estimatedItemSize={ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT} - drawDistance={500} + drawDistance={THREAD_LIST_V2_DRAW_DISTANCE} recycleItems extraData={v2ExtraData} ListHeaderComponent={v2ListHeader} From 2a9832b8019039f812706639c11ccc24ce4c4e05 Mon Sep 17 00:00:00 2001 From: Yordis Prieto Date: Fri, 25 Sep 2026 20:49:17 -0400 Subject: [PATCH 58/58] refactor(observability): name each service after its application (#13699) Signed-off-by: Yordis Prieto --- .../src/app/DesktopObservability.test.ts | 43 +++++++++++++++++++ apps/desktop/src/app/DesktopObservability.ts | 3 +- .../src/features/observability/tracing.ts | 2 +- apps/server/src/bin.test.ts | 1 - apps/server/src/cli/config.test.ts | 1 - apps/server/src/cli/config.ts | 2 - apps/server/src/cli/pair.ts | 1 - apps/server/src/cloud/relayTracing.ts | 4 +- apps/server/src/config.ts | 5 +-- .../src/environment/ServerEnvironment.test.ts | 1 - apps/server/src/persistence/Layers/Sqlite.ts | 2 +- apps/server/src/server.test.ts | 11 +++-- apps/server/src/serverLogger.test.ts | 31 ++++++++++++- apps/web/src/lib/runtime.ts | 2 +- apps/web/src/observability/clientTracing.ts | 3 +- docs/operations/observability.md | 24 ++++++----- infra/relay/src/observability.test.ts | 9 ++++ infra/relay/src/observability.ts | 3 +- packages/shared/src/relayTracing.test.ts | 2 + packages/shared/src/relayTracing.ts | 1 + 20 files changed, 116 insertions(+), 35 deletions(-) diff --git a/apps/desktop/src/app/DesktopObservability.test.ts b/apps/desktop/src/app/DesktopObservability.test.ts index 0e4c4d7a969d..e23d78aa2161 100644 --- a/apps/desktop/src/app/DesktopObservability.test.ts +++ b/apps/desktop/src/app/DesktopObservability.test.ts @@ -477,6 +477,49 @@ describe("DesktopObservability", () => { ); }); + it.effect("keeps its service name while OTEL resource attributes add dimensions", () => { + const requests: Array = []; + return Effect.gen(function* () { + const fileSystem = yield* FileSystem.FileSystem; + const baseDir = yield* fileSystem.makeTempDirectoryScoped({ + prefix: "t3-desktop-observability-test-", + }); + const environmentLayer = makeEnvironmentLayer(baseDir, true, { + T3CODE_OTLP_LOGS_URL: "https://collector.example.com/v1/logs", + }); + + yield* Effect.scoped( + Effect.logInfo("desktop service name").pipe( + Effect.provide(DesktopObservability.layer.pipe(Layer.provideMerge(environmentLayer))), + ), + ); + + assert.lengthOf(requests, 1); + const body = requests[0]?.body ?? ""; + assert.include(body, '"stringValue":"t3code-desktop"'); + assert.include(body, "deployment.environment.name"); + assert.include(body, '"key":"service.namespace","value":{"stringValue":"t3code"}'); + assert.notInclude(body, "renamed"); + }).pipe( + Effect.scoped, + Effect.provide( + Layer.mergeAll( + NodeServices.layer, + collectorLayer(requests), + ConfigProvider.layer( + ConfigProvider.fromEnv({ + env: { + OTEL_SERVICE_NAME: "renamed", + OTEL_RESOURCE_ATTRIBUTES: + "service.name=renamed,service.namespace=renamed,deployment.environment.name=development", + }, + }), + ), + ), + ), + ); + }); + it.effect("exports nothing to Settings for logs an unusable OTEL endpoint claimed", () => { const requests: Array = []; return Effect.gen(function* () { diff --git a/apps/desktop/src/app/DesktopObservability.ts b/apps/desktop/src/app/DesktopObservability.ts index 0bcb4d602102..ce8233e56612 100644 --- a/apps/desktop/src/app/DesktopObservability.ts +++ b/apps/desktop/src/app/DesktopObservability.ts @@ -626,8 +626,9 @@ const telemetryLayer = Layer.unwrap( const environment = yield* DesktopEnvironment.DesktopEnvironment; const endpoints = yield* resolveOtlpEndpoints; const resource = { - serviceName: "desktop", + serviceName: "t3code-desktop", attributes: { + "service.namespace": "t3code", "service.runtime": "desktop", "service.mode": environment.isDevelopment ? "development" : "packaged", }, diff --git a/apps/mobile/src/features/observability/tracing.ts b/apps/mobile/src/features/observability/tracing.ts index eb73abba292b..ae204413e777 100644 --- a/apps/mobile/src/features/observability/tracing.ts +++ b/apps/mobile/src/features/observability/tracing.ts @@ -25,7 +25,7 @@ export function resolveTracingConfig(): TracingConfig | null { export function makeTracingLayer(config: TracingConfig | null, resource: TracingResource) { return makeRelayClientTracingLayer(config, { - serviceName: "t3-mobile-relay-client", + serviceName: "t3code-mobile", serviceVersion: resource.serviceVersion, runtime: "react-native", client: `mobile-${resource.appVariant}`, diff --git a/apps/server/src/bin.test.ts b/apps/server/src/bin.test.ts index 31a96304c3e5..aecf82eeac67 100644 --- a/apps/server/src/bin.test.ts +++ b/apps/server/src/bin.test.ts @@ -106,7 +106,6 @@ const makeCliTestServerConfig = (baseDir: string) => otlpTracesExport: DEFAULT_SIGNAL_EXPORT, otlpMetricsExport: DEFAULT_SIGNAL_EXPORT, otlpLogsExport: DEFAULT_SIGNAL_EXPORT, - otlpServiceName: "t3-server", otelEnvironment: OtelEnvironment.none, mode: "web", port: 0, diff --git a/apps/server/src/cli/config.test.ts b/apps/server/src/cli/config.test.ts index 6b42756ad175..ef7cdd578899 100644 --- a/apps/server/src/cli/config.test.ts +++ b/apps/server/src/cli/config.test.ts @@ -56,7 +56,6 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => { otlpTracesExport: DEFAULT_SIGNAL_EXPORT, otlpMetricsExport: DEFAULT_SIGNAL_EXPORT, otlpLogsExport: DEFAULT_SIGNAL_EXPORT, - otlpServiceName: "t3-server", otelEnvironment: OtelEnvironment.none, devAllowedOrigins: [], } as const; diff --git a/apps/server/src/cli/config.ts b/apps/server/src/cli/config.ts index 9c1ceac82101..d724730c953f 100644 --- a/apps/server/src/cli/config.ts +++ b/apps/server/src/cli/config.ts @@ -108,7 +108,6 @@ const EnvServerConfig = Config.all({ otlpExportIntervalMs: Config.Int("T3CODE_OTLP_EXPORT_INTERVAL_MS").pipe( Config.withDefault(10_000), ), - otlpServiceName: Config.String("T3CODE_OTLP_SERVICE_NAME").pipe(Config.withDefault("t3-server")), otlpHeaders: Config.schema(OtlpHeadersFromString, "T3CODE_OTLP_HEADERS").pipe( Config.option, Config.map(Option.getOrUndefined), @@ -431,7 +430,6 @@ export const resolveServerConfig = ( otlpTracesExport: traces?.export ?? signalExport, otlpMetricsExport: metrics?.export ?? signalExport, otlpLogsExport: logs?.export ?? signalExport, - otlpServiceName: env.otlpServiceName, otelEnvironment: otel, mode, port, diff --git a/apps/server/src/cli/pair.ts b/apps/server/src/cli/pair.ts index 6b29ef60927f..04ce0332c14c 100644 --- a/apps/server/src/cli/pair.ts +++ b/apps/server/src/cli/pair.ts @@ -326,7 +326,6 @@ const makePairServerConfig = Effect.fn(function* (input: { otlpTracesExport: DEFAULT_SIGNAL_EXPORT, otlpMetricsExport: DEFAULT_SIGNAL_EXPORT, otlpLogsExport: DEFAULT_SIGNAL_EXPORT, - otlpServiceName: "t3-server", otelEnvironment: OtelEnvironment.none, mode: "web", port: state.port, diff --git a/apps/server/src/cloud/relayTracing.ts b/apps/server/src/cloud/relayTracing.ts index e35c94545a5e..eeea28a2b68f 100644 --- a/apps/server/src/cloud/relayTracing.ts +++ b/apps/server/src/cloud/relayTracing.ts @@ -7,14 +7,14 @@ const relayClientTracingConfig = resolveRelayClientTracingConfig(); export const headlessRelayClientTracingLayer = makeRelayClientTracingLayer( relayClientTracingConfig, { - serviceName: "t3-headless-relay-client", + serviceName: "t3code-server", runtime: "node", client: "headless-cli", }, ); export const serverRelayBrokerTracingLayer = makeRelayClientTracingLayer(relayClientTracingConfig, { - serviceName: "t3-server", + serviceName: "t3code-server", runtime: "node", client: "environment-server", component: "relay-broker", diff --git a/apps/server/src/config.ts b/apps/server/src/config.ts index 344619c0eb93..74ffde8efef0 100644 --- a/apps/server/src/config.ts +++ b/apps/server/src/config.ts @@ -82,7 +82,6 @@ export class ServerConfig extends Context.Service< readonly otlpTracesExport: SignalExport; readonly otlpMetricsExport: SignalExport; readonly otlpLogsExport: SignalExport; - readonly otlpServiceName: string; readonly otelEnvironment: OtelEnvironment.OtelEnvironment; readonly mode: RuntimeMode; readonly port: number; @@ -119,8 +118,9 @@ export const make = (config: ServerConfig["Service"]) => ServerConfig.of(config) * logs report the same service identity to the collector. */ export const otlpResource = (config: ServerConfig["Service"]) => ({ - serviceName: config.otlpServiceName, + serviceName: "t3code-server", attributes: { + "service.namespace": "t3code", "service.runtime": "t3-server", "service.mode": config.mode, }, @@ -222,7 +222,6 @@ const makeTest = Effect.fn("ServerConfig.makeTest")(function* ( otlpTracesExport: DEFAULT_SIGNAL_EXPORT, otlpMetricsExport: DEFAULT_SIGNAL_EXPORT, otlpLogsExport: DEFAULT_SIGNAL_EXPORT, - otlpServiceName: "t3-server", otelEnvironment: OtelEnvironment.none, cwd, baseDir, diff --git a/apps/server/src/environment/ServerEnvironment.test.ts b/apps/server/src/environment/ServerEnvironment.test.ts index 12ae321c1cf3..6eb95c84b477 100644 --- a/apps/server/src/environment/ServerEnvironment.test.ts +++ b/apps/server/src/environment/ServerEnvironment.test.ts @@ -59,7 +59,6 @@ const makeServerConfig = Effect.fn(function* (baseDir: string) { otlpTracesExport: DEFAULT_SIGNAL_EXPORT, otlpMetricsExport: DEFAULT_SIGNAL_EXPORT, otlpLogsExport: DEFAULT_SIGNAL_EXPORT, - otlpServiceName: "t3-server", otelEnvironment: OtelEnvironment.none, cwd: process.cwd(), baseDir, diff --git a/apps/server/src/persistence/Layers/Sqlite.ts b/apps/server/src/persistence/Layers/Sqlite.ts index 88342cbf1fad..032b44645089 100644 --- a/apps/server/src/persistence/Layers/Sqlite.ts +++ b/apps/server/src/persistence/Layers/Sqlite.ts @@ -32,7 +32,7 @@ export const makeSqlitePersistenceLive = Effect.fn("makeSqlitePersistenceLive")( filename: dbPath, spanAttributes: { "db.name": path.basename(dbPath), - "service.name": "t3-server", + "service.name": "t3code-server", }, }), ); diff --git a/apps/server/src/server.test.ts b/apps/server/src/server.test.ts index 12f37780701d..6836d28e25c1 100644 --- a/apps/server/src/server.test.ts +++ b/apps/server/src/server.test.ts @@ -489,7 +489,7 @@ const makeBrowserOtlpPayload = (spanName: string) => url: collector.url, exportInterval: "10 millis", resource: { - serviceName: "t3-web", + serviceName: "t3code-web", attributes: { "service.runtime": "t3-web", "service.mode": "browser", @@ -588,7 +588,6 @@ const buildAppUnderTest = (options?: { otlpTracesExport: DEFAULT_SIGNAL_EXPORT, otlpMetricsExport: DEFAULT_SIGNAL_EXPORT, otlpLogsExport: DEFAULT_SIGNAL_EXPORT, - otlpServiceName: "t3-server", otelEnvironment: OtelEnvironment.none, mode: "desktop", port: 0, @@ -5283,7 +5282,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { attributes: [ { key: "service.name", - value: { stringValue: "t3-web" }, + value: { stringValue: "t3code-web" }, }, ], }, @@ -5425,7 +5424,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { "rpc.method": "server.getSettings", }, resourceAttributes: { - "service.name": "t3-web", + "service.name": "t3code-web", }, scope: { name: "effect", @@ -5556,7 +5555,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { // the stub's utf8 decode even though the surrounding bytes don't. assert.notEqual(forwarded.body[0], "{"); assert.include(forwarded.body, "client.protobuf.test"); - assert.include(forwarded.body, "t3-web"); + assert.include(forwarded.body, "t3code-web"); }).pipe(Effect.provide(NodeHttpServer.layerTest)), ); @@ -5657,7 +5656,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => { assert.deepEqual(record.links, []); assert.equal(record.scope.name, scopeSpan.scope.name); assert.deepEqual(record.scope.attributes, {}); - assert.equal(record.resourceAttributes["service.name"], "t3-web"); + assert.equal(record.resourceAttributes["service.name"], "t3code-web"); assert.equal(record.status?.code, String(span.status.code)); }).pipe(Effect.provide(NodeHttpServer.layerTest)), ); diff --git a/apps/server/src/serverLogger.test.ts b/apps/server/src/serverLogger.test.ts index a5437582d2e3..43843b249eea 100644 --- a/apps/server/src/serverLogger.test.ts +++ b/apps/server/src/serverLogger.test.ts @@ -1,6 +1,7 @@ import * as NodePath from "@effect/platform-node/NodePath"; import { assert, describe, it } from "@effect/vitest"; import * as NodeOS from "node:os"; +import * as ConfigProvider from "effect/ConfigProvider"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; import * as Path from "effect/Path"; @@ -57,7 +58,6 @@ const configLayer = (overrides: Partial) = otlpTracesExport: DEFAULT_SIGNAL_EXPORT, otlpMetricsExport: DEFAULT_SIGNAL_EXPORT, otlpLogsExport: DEFAULT_SIGNAL_EXPORT, - otlpServiceName: "t3-server", otelEnvironment: OtelEnvironment.none, cwd: baseDir, baseDir, @@ -146,11 +146,38 @@ describe("ServerLoggerLive", () => { const [request] = requests; assert.strictEqual(request?.url, "https://collector.example.com/v1/logs"); assert.include(request?.body ?? "", "server logger under test"); - assert.include(request?.body ?? "", "t3-server"); + assert.include(request?.body ?? "", "t3code-server"); assert.include(request?.body ?? "", "service.runtime"); }), ); + it.effect("keeps its service name while OTEL resource attributes add dimensions", () => + Effect.gen(function* () { + const requests = yield* logThrough({ + otlpLogsUrl: "https://collector.example.com/v1/logs", + }).pipe( + Effect.provide( + ConfigProvider.layer( + ConfigProvider.fromEnv({ + env: { + OTEL_SERVICE_NAME: "renamed", + OTEL_RESOURCE_ATTRIBUTES: + "service.name=renamed,service.namespace=renamed,deployment.environment.name=development", + }, + }), + ), + ), + ); + + assert.lengthOf(requests, 1); + const body = requests[0]?.body ?? ""; + assert.include(body, '"stringValue":"t3code-server"'); + assert.include(body, "deployment.environment.name"); + assert.include(body, '"key":"service.namespace","value":{"stringValue":"t3code"}'); + assert.notInclude(body, "renamed"); + }), + ); + it.effect("stays off the network when no logs endpoint is configured", () => Effect.gen(function* () { const requests = yield* logThrough({}); diff --git a/apps/web/src/lib/runtime.ts b/apps/web/src/lib/runtime.ts index 866f38875c76..fd4f2b194096 100644 --- a/apps/web/src/lib/runtime.ts +++ b/apps/web/src/lib/runtime.ts @@ -19,7 +19,7 @@ function configuredRelayUrl(): string { const httpClientLayer = remoteHttpClientLayer((input, init) => globalThis.fetch(input, init)); const relayTracingLayer = makeRelayClientTracingLayer(resolveRelayTracingConfig(), { - serviceName: "t3-web-relay-client", + serviceName: "t3code-web", serviceVersion: import.meta.env.APP_VERSION, runtime: "browser", client: typeof window !== "undefined" && window.desktopBridge ? "desktop" : "web", diff --git a/apps/web/src/observability/clientTracing.ts b/apps/web/src/observability/clientTracing.ts index 2471de958615..e8ccd4173d35 100644 --- a/apps/web/src/observability/clientTracing.ts +++ b/apps/web/src/observability/clientTracing.ts @@ -15,8 +15,9 @@ import { APP_VERSION } from "~/branding"; const DEFAULT_EXPORT_INTERVAL_MS = 1_000; const CLIENT_TRACING_RESOURCE = { - serviceName: "t3-web", + serviceName: "t3code-web", attributes: { + "service.namespace": "t3code", "service.runtime": "t3-web", "service.mode": isElectron ? "electron" : "browser", "service.version": APP_VERSION, diff --git a/docs/operations/observability.md b/docs/operations/observability.md index abe82d680b97..86a65702c270 100644 --- a/docs/operations/observability.md +++ b/docs/operations/observability.md @@ -129,7 +129,7 @@ Default Grafana login: export T3CODE_OTLP_TRACES_URL=http://localhost:4318/v1/traces export T3CODE_OTLP_METRICS_URL=http://localhost:4318/v1/metrics export T3CODE_OTLP_LOGS_URL=http://localhost:4318/v1/logs -export T3CODE_OTLP_SERVICE_NAME=t3-local +export OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=development ``` Optional: @@ -169,7 +169,6 @@ macOS app bundle example: T3CODE_OTLP_TRACES_URL=http://localhost:4318/v1/traces \ T3CODE_OTLP_METRICS_URL=http://localhost:4318/v1/metrics \ T3CODE_OTLP_LOGS_URL=http://localhost:4318/v1/logs \ -T3CODE_OTLP_SERVICE_NAME=t3-desktop \ "/Applications/T3 Code.app/Contents/MacOS/T3 Code" ``` @@ -179,7 +178,6 @@ Direct binary example: T3CODE_OTLP_TRACES_URL=http://localhost:4318/v1/traces \ T3CODE_OTLP_METRICS_URL=http://localhost:4318/v1/metrics \ T3CODE_OTLP_LOGS_URL=http://localhost:4318/v1/logs \ -T3CODE_OTLP_SERVICE_NAME=t3-desktop \ ./path/to/your/desktop-app-binary ``` @@ -311,11 +309,13 @@ Recommended flow in Grafana: 2. Pick the `Tempo` data source. 3. Set the time range to something recent like `Last 15 minutes`. 4. Start broad. Do not begin with a very narrow query. -5. Look for spans from your configured service name, then narrow by span name or attributes. +5. Look for spans from the `t3code-server` or `t3code-desktop` service, then narrow by span name or + attributes. Good first searches: -- service name such as `t3-local`, `t3-dev`, or `t3-desktop` +- service name `t3code-server` or `t3code-desktop`, plus a resource attribute such as + `deployment.environment.name` - span names like `sendTurn` or a Git operation such as `GitVcsDriver.statusDetails.status` - Git spans whose `git.operation` attribute identifies the operation - orchestration spans with attributes like `orchestration.command_type` @@ -525,10 +525,10 @@ It provides: The desktop main process is a second producer, assembled in `apps/desktop/src/app/DesktopObservability.ts`. It reads the same `T3CODE_OTLP_*` names and the same Settings entries as the backend it supervises, and covers work the backend cannot see: app startup, -window and menu handling, backend supervision, and updates. It reports as service `desktop` -regardless of `T3CODE_OTLP_SERVICE_NAME`, so a collector shows it alongside the backend rather than -mixed into it. It exports traces and logs only; the main process records no metrics, so the metrics -endpoint applies to the backend alone. +window and menu handling, backend supervision, and updates. It reports as service +`t3code-desktop`, so a collector shows it alongside the backend rather than mixed into it. It +exports traces and logs only; the main process records no metrics, so the metrics endpoint applies +to the backend alone. ### Env Vars @@ -547,7 +547,6 @@ OTLP export: - `T3CODE_OTLP_METRICS_URL`: OTLP metric endpoint - `T3CODE_OTLP_LOGS_URL`: OTLP log endpoint - `T3CODE_OTLP_EXPORT_INTERVAL_MS`: export interval, default `10000` -- `T3CODE_OTLP_SERVICE_NAME`: service name, default `t3-server` - `T3CODE_OTLP_HEADERS`: extra headers for all three exporters, same format as `OTEL_EXPORTER_OTLP_HEADERS`: comma-separated `key=value` pairs with percent-encoded values. - `T3CODE_OTLP_PROTOCOL`: `http/json` (default) or `http/protobuf` @@ -565,6 +564,11 @@ an `http` or `https` URL, a protocol other than `http/protobuf` or `http/json` s headers that are not `key=value` pairs with percent-encoded values turn that signal's export off with a startup warning, rather than sending it to the Settings endpoint. +Service names are fixed: `t3code-server` for the backend and `t3code-desktop` for the desktop main +process, both in `service.namespace` `t3code`. `OTEL_SERVICE_NAME` and a `service.name` or +`service.namespace` in `OTEL_RESOURCE_ATTRIBUTES` are ignored. Tell installations apart with other +resource attributes, such as `OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=development`. + If the OTLP URLs are unset, local tracing still works, metrics stay in-process only, and logs stay on stdout only. diff --git a/infra/relay/src/observability.test.ts b/infra/relay/src/observability.test.ts index 3958b28b95dd..d77c01277f1c 100644 --- a/infra/relay/src/observability.test.ts +++ b/infra/relay/src/observability.test.ts @@ -62,6 +62,11 @@ it.effect("exports schema error fields as span attributes", () => const request = yield* Deferred.await(exportedRequest).pipe(Effect.timeout("1 second")); const payload = (yield* decodeJson(request.body)) as OtlpTracer.TraceData; + const resourceAttributes = Object.fromEntries( + payload.resourceSpans + .flatMap((resourceSpan) => resourceSpan.resource.attributes) + .map((attribute) => [attribute.key, otlpAttributeValue(attribute.value)]), + ); const span = payload.resourceSpans .flatMap((resourceSpan) => resourceSpan.scopeSpans) .flatMap((scopeSpan) => scopeSpan.spans) @@ -75,6 +80,10 @@ it.effect("exports schema error fields as span attributes", () => expect(request.authorization).toBe("Bearer test-token"); expect(request.dataset).toBe("relay-test-traces"); + expect(resourceAttributes).toMatchObject({ + "service.name": "t3code-relay", + "service.namespace": "t3code", + }); expect(attributes).toMatchObject({ "error.type": "EnvironmentConnectNotAuthorized", "error.environmentId": "environment-1", diff --git a/infra/relay/src/observability.ts b/infra/relay/src/observability.ts index ca091d8cce6b..2325d7e0432a 100644 --- a/infra/relay/src/observability.ts +++ b/infra/relay/src/observability.ts @@ -222,8 +222,9 @@ export const makeRelayTraceLayer = (input: { OtlpTracer.make({ url: input.tracesEndpoint, resource: { - serviceName: "t3-code-relay-worker", + serviceName: "t3code-relay", attributes: { + "service.namespace": "t3code", "service.runtime": "cloudflare-worker", "service.component": "relay", }, diff --git a/packages/shared/src/relayTracing.test.ts b/packages/shared/src/relayTracing.test.ts index 3bb7f1ea1ac2..f96dfea8bb3b 100644 --- a/packages/shared/src/relayTracing.test.ts +++ b/packages/shared/src/relayTracing.test.ts @@ -97,6 +97,8 @@ describe("withRelayClientTracing", () => { const payload = new TextDecoder().decode(fetchFn.mock.calls[0]?.[1]?.body as Uint8Array); expect(payload).toContain("relay request failed"); expect(payload).toContain("relay socket closed"); + expect(payload).toContain('"key":"service.name","value":{"stringValue":"relay-test"}'); + expect(payload).toContain('"key":"service.namespace","value":{"stringValue":"t3code"}'); }), ), ); diff --git a/packages/shared/src/relayTracing.ts b/packages/shared/src/relayTracing.ts index 907773bc15a5..76954558eb07 100644 --- a/packages/shared/src/relayTracing.ts +++ b/packages/shared/src/relayTracing.ts @@ -142,6 +142,7 @@ export function makeRelayClientTracingLayer( serviceName: resource.serviceName, serviceVersion: resource.serviceVersion, attributes: { + "service.namespace": "t3code", "service.runtime": resource.runtime, "service.component": resource.component ?? "relay-client", "t3.client.surface": resource.client,