Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
test(openai-codex): cover exec resume, history rebuild and relay
Jack Rudenko1e3f9110ab13
diff --git a/packages/cli/src/code-mode/input-builder.test.ts b/packages/cli/src/code-mode/input-builder.test.tsnew file mode 100644index 00000000..cd8d38eb--- /dev/null+++ b/packages/cli/src/code-mode/input-builder.test.ts@@ -0,0 +1,364 @@+import { afterEach, describe, expect, setSystemTime, test } from "bun:test";+import { createHash } from "node:crypto";+import { readFileSync } from "node:fs";+import { accountKeyFromBinding, sessionKeyFor } from "./ids.js";+import { buildCodeModeInput } from "./input-builder.js";+import { createCodeModeTurnHooks } from "./relay.js";+import { resumeFromToolResults } from "./resume.js";+import { loadQuickJSModule, resetQuickJSLoaderForTests } from "./sandbox/quickjs-loader.js";+import { ScriptStore } from "./script-store.js";+import type { CodeModeStores } from "./stores.js";+import { ToolNameTable } from "./tool-names.js";+import { nestedResultFromToolResult } from "./tool-results.js";+import { transliterateRound } from "./transliterate.js";+import { TurnRecords } from "./turn-records.js";+import type { ClaudeContentBlock, ClaudeMessage, NestedToolUse, ResponsesItem } from "./types.js";++const session = "33333333-3333-4333-8333-333333333333";+const binding = {+ auth: { arm: "oauth" as const, headers: { "chatgpt-account-id": "t4-builder" } },+};+const accountKey = accountKeyFromBinding(binding)!;+const keys = { accountKey, sessionKey: sessionKeyFor(session, accountKey)! };+const tools = [+ {+ name: "Read",+ description: "Read a file",+ input_schema: { type: "object", properties: { file_path: { type: "string" } } },+ },+];+const names = new ToolNameTable(["Read"]);+const allStores: CodeModeStores[] = [];+const transcript = readFileSync(+ new URL("../pane/test-fixtures/transcripts/tools-session.jsonl", import.meta.url),+ "utf8"+)+ .trim()+ .split("\n")+ .map((line) => JSON.parse(line));+const capturedBlocks: ClaudeContentBlock[] = transcript.flatMap((row) =>+ Array.isArray(row.message?.content) ? row.message.content : []+);+const capturedResult = capturedBlocks.find(+ (b) => b.type === "tool_result" && b.is_error === false+)!;+const classicResult = capturedBlocks.find(+ (b) =>+ b.type === "tool_result" &&+ capturedBlocks.some((u) => u.type === "tool_use" && u.id === b.tool_use_id)+)!;+const classicUse = capturedBlocks.find(+ (b) => b.type === "tool_use" && b.id === classicResult.tool_use_id+)!;+const denialRows = readFileSync(+ new URL("../pane/test-fixtures/transcripts/permission-bash-esc.jsonl", import.meta.url),+ "utf8"+)+ .trim()+ .split("\n")+ .map((line) => JSON.parse(line));+const denial: ClaudeContentBlock = denialRows+ .flatMap((row) => (Array.isArray(row.message?.content) ? row.message.content : []))+ .find((b: ClaudeContentBlock) => b.type === "tool_result" && b.is_error);++function stores(): CodeModeStores {+ const s = { scripts: new ScriptStore({ now: () => 1000 }), turns: new TurnRecords() };+ allStores.push(s);+ return s;+}+afterEach(() => {+ setSystemTime();+ for (const s of allStores.splice(0)) {+ s.scripts.clear();+ s.turns.clear();+ }+ resetQuickJSLoaderForTests();+});+const req = (messages: ClaudeMessage[]) => ({+ messages,+ tools,+ metadata: {+ user_id: JSON.stringify({ device_id: "t4", account_uuid: "t4", session_id: session }),+ },+});+const assistant = (blocks: NestedToolUse[]): ClaudeMessage => ({+ role: "assistant",+ content: blocks.map((b) => ({ type: "tool_use", id: b.id, name: b.name, input: b.input })),+});+const answer = (blocks: NestedToolUse[], label: string): ClaudeMessage => ({+ role: "user",+ content: blocks.map((b, i) => ({+ ...structuredClone(capturedResult),+ tool_use_id: b.id,+ content: `${label}-${i}`,+ })),+});+const build = (messages: ClaudeMessage[], s: CodeModeStores) =>+ buildCodeModeInput(messages, s, keys, { toolNames: names });++// Derived Claude Code message arrays use the real tool_use/tool_result shapes in+// tools-session.jsonl and permission-bash-esc.jsonl. Only IDs and text are local.+async function history(intervening = false) {+ const s = stores();+ const module = await loadQuickJSModule();+ const hooks = createCodeModeTurnHooks({+ stores: s,+ ...keys,+ shape: () => "classic",+ names,+ allTools: [],+ defaultMaxOutputTokens: 10000,+ previousMessage: undefined,+ loadModule: async () => module,+ limits: { cpuMs: 100 },+ });+ const callId = "call_abcdef0123456789abcdef0123456789";+ const first = await hooks.onExecCall({+ callId,+ input:+ 'text(await tools.Read({file_path:"first"})); text(await tools.Read({file_path:"second"}));',+ precedingItems: [],+ truncated: false,+ });+ if (first.kind !== "emit-tool-uses") throw new Error("Expected initial nested calls");+ const messages: ClaudeMessage[] = [+ { role: "user", content: [{ type: "text", text: "Read both files" }] },+ assistant(first.blocks),+ answer(first.blocks, "first-result"),+ ];+ const second = resumeFromToolResults(req(messages), binding, s, undefined);+ expect(second.kind).toBe("reply");+ if (second.kind !== "reply") throw new Error("Expected the second nested call");+ messages.push(assistant(second.blocks));+ if (intervening)+ messages.push({ role: "user", content: [{ type: "text", text: "intervening-user-message" }] });+ messages.push(answer(second.blocks, "second-result"));+ expect(resumeFromToolResults(req(messages), binding, s, undefined)).toEqual({ kind: "continue" });+ return { messages, s, callId };+}++describe("T4 code-mode history", () => {+ test("REQ-15 TEST-17 emits one call and one output across two completed rounds", async () => {+ const { messages, s, callId } = await history();+ const input = build(messages, s);+ const calls = input.filter((item) => item.type === "custom_tool_call");+ const outputs = input.filter((item) => item.type === "custom_tool_call_output");+ expect(calls).toHaveLength(1);+ expect(outputs).toHaveLength(1);+ expect(calls[0]).toEqual({+ type: "custom_tool_call",+ call_id: callId,+ name: "exec",+ input:+ 'text(await tools.Read({file_path:"first"})); text(await tools.Read({file_path:"second"}));',+ });+ expect(outputs[0].call_id).toBe(callId);+ expect(JSON.stringify(outputs)).toContain("first-result-0");+ expect(JSON.stringify(outputs)).toContain("second-result-0");+ expect(JSON.stringify(outputs)).toContain("Script completed");+ expect(input.some((i) => i.type === "function_call" || i.type === "function_call_output")).toBe(+ false+ );+ }, 20000);++ test("REQ-16 TEST-18 emits a delayed result after its intervening user message", async () => {+ const { messages, s } = await history(true);+ const input = build(messages, s);+ const intervening = input.findIndex(+ (i) => i.type === "message" && JSON.stringify(i).includes("intervening-user-message")+ );+ const output = input.findIndex((i) => i.type === "custom_tool_call_output");+ expect(intervening).toBeGreaterThanOrEqual(0);+ expect(output).toBeGreaterThan(intervening);+ expect(input.filter((i) => i.type === "custom_tool_call_output")).toHaveLength(1);+ expect(JSON.stringify(input[output])).toContain("second-result-0");+ }, 20000);++ test("REQ-20 TEST-23 builds byte-identical input despite elapsed time and repeated calls", async () => {+ const { messages, s } = await history();+ setSystemTime(new Date("2026-10-16T00:00:00.000Z"));+ const first = JSON.stringify(build(messages, s));+ setSystemTime(new Date("2026-10-17T00:00:00.000Z"));+ const second = JSON.stringify(build(structuredClone(messages), s));+ expect(second).toBe(first);+ expect(JSON.stringify(build(messages, s))).toBe(first);+ }, 20000);++ test("REQ-20 TEST-24 moving cache_control markers does not alter a completed script's output", async () => {+ const { messages, s } = await history();+ const first = structuredClone(messages);+ const second = structuredClone(messages);+ (first[0].content as ClaudeContentBlock[])[0].cache_control = { type: "ephemeral" };+ (second[2].content as ClaudeContentBlock[])[0].cache_control = { type: "ephemeral" };+ expect(JSON.stringify(build(first, s))).toBe(JSON.stringify(build(second, s)));+ expect(JSON.stringify(build(first, s))).toContain("Script completed");+ }, 20000);++ test.each(["toolu_cx_0123456789abcdef0123456789abcdef_0", classicResult.tool_use_id!])(+ "REQ-18 TEST-20 preserves an orphan result %s as user text, not an unattached output",+ (orphanId) => {+ const s = stores();+ const messages: ClaudeMessage[] = [+ {+ role: "user",+ content: [+ {+ ...structuredClone(capturedResult),+ tool_use_id: orphanId,+ content: "orphan-visible-text",+ },+ ],+ },+ ];+ const input = build(messages, s);+ expect(input).toEqual([+ {+ type: "message",+ role: "user",+ content: [{ type: "input_text", text: "[Tool Result]: orphan-visible-text" }],+ },+ ]);+ }+ );++ test("REQ-19 TEST-21 transliterates the captured classic round into one exec call and output", () => {+ const s = stores();+ const messages: ClaudeMessage[] = [+ { role: "assistant", content: [structuredClone(classicUse)] },+ { role: "user", content: [structuredClone(classicResult)] },+ ];+ const input = build(messages, s);+ const callId = "call_" + createHash("sha256").update(classicUse.id!).digest("hex").slice(0, 32);+ expect(input.filter((i) => i.type === "custom_tool_call")).toHaveLength(1);+ expect(input.filter((i) => i.type === "custom_tool_call_output")).toHaveLength(1);+ expect(input[0]).toMatchObject({ type: "custom_tool_call", call_id: callId, name: "exec" });+ expect(input[1]).toMatchObject({ type: "custom_tool_call_output", call_id: callId });+ expect(JSON.stringify(input[1])).toContain("Script completed");+ expect(JSON.stringify(input[1])).toContain(String(classicResult.content));+ expect(input.some((i) => i.type.startsWith("function_call"))).toBe(false);+ });++ test("REQ-19 TEST-22 uses bracket form for a classic tool missing from today's list", () => {+ const use = { ...structuredClone(classicUse), name: "mcp__missing-tool__read" };+ const result = transliterateRound(+ { uses: [use], results: new Map([[classicResult.tool_use_id!, classicResult]]) },+ { names }+ );+ expect(result.call.input).toContain('tools["mcp__missing-tool__read"]');+ expect(result.call.input).toContain("Promise.allSettled");+ expect(result.output.status).toBe("completed");+ });++ test("REQ-19 a classic denial is output data, with the exact captured rejection text", () => {+ const result = { ...structuredClone(denial), tool_use_id: classicUse.id };+ const round = transliterateRound({+ uses: [classicUse],+ results: new Map([[classicUse.id!, result]]),+ });+ expect(round.output.status).toBe("completed");+ expect(JSON.stringify(round.output.parts)).toContain("Error: The user doesn't want to proceed");+ });++ test("REQ-19 a classic prefill emits only the exec call without a fabricated result", () => {+ const input = build([{ role: "assistant", content: [structuredClone(classicUse)] }], stores());+ expect(input).toHaveLength(1);+ expect(input[0].type).toBe("custom_tool_call");+ });++ test("REQ-20 cache_control inside tool arguments is semantic and must not be stripped", () => {+ const firstUse = {+ ...structuredClone(classicUse),+ input: { config: { cache_control: "public" } },+ };+ const secondUse = { ...firstUse, input: { config: { cache_control: "no-store" } } };+ const first = build([{ role: "assistant", content: [firstUse] }], stores());+ const second = build([{ role: "assistant", content: [secondUse] }], stores());+ expect(JSON.stringify(first)).not.toBe(JSON.stringify(second));+ expect(first[0].input).toContain("public");+ expect(second[0].input).toContain("no-store");+ });++ test("REQ-15 TEST-34 renders an owner's completed run identically for a fork", async () => {+ const { messages, s } = await history();+ const forkKeys = {+ accountKey,+ sessionKey: sessionKeyFor("44444444-4444-4444-8444-444444444444", accountKey)!,+ };+ expect(buildCodeModeInput(messages, s, forkKeys, { toolNames: names })).toEqual(+ build(messages, s)+ );+ }, 20000);++ test.each(["parts", "string", "script-error"])(+ "REQ-19 uses the accepted exec item envelope from the real %s roundtrip capture",+ (shape) => {+ const captured = JSON.parse(+ readFileSync(+ new URL(`../test-fixtures/code-mode/roundtrip-${shape}.request.json`, import.meta.url),+ "utf8"+ )+ );+ const capturedItems: ResponsesItem[] = captured.body.input;+ const acceptedCall = capturedItems.find((i) => i.type === "custom_tool_call")!;+ const acceptedOutput = capturedItems.find((i) => i.type === "custom_tool_call_output")!;+ const input = build(+ [+ { role: "assistant", content: [structuredClone(classicUse)] },+ { role: "user", content: [structuredClone(classicResult)] },+ ],+ stores()+ );+ expect(Object.keys(input[0]).sort()).toEqual(Object.keys(acceptedCall).sort());+ expect(Object.keys(input[1]).sort()).toEqual(Object.keys(acceptedOutput).sort());+ expect(input[0].name).toBe(acceptedCall.name);+ }+ );++ test("REQ-15 TEST-35 preserves a recorded interstitial exec before the final exec group exactly once", async () => {+ const { messages, s, callId } = await history();+ const captured = JSON.parse(+ readFileSync(+ new URL("../test-fixtures/code-mode/roundtrip-parts.request.json", import.meta.url),+ "utf8"+ )+ );+ const interstitial: ResponsesItem[] = captured.body.input.slice(-2);+ const firstNestedId = (messages[1].content as ClaudeContentBlock[])[0].id!;+ s.turns.put(keys.sessionKey, firstNestedId, structuredClone(interstitial));++ const input = build(messages, s);+ expect(+ input.filter((item) => item.type === "custom_tool_call").map((item) => item.call_id)+ ).toEqual(["call_probe_1", callId]);+ expect(+ input.filter((item) => item.type === "custom_tool_call_output").map((item) => item.call_id)+ ).toEqual(["call_probe_1", callId]);+ expect(input.slice(1, 3)).toEqual(interstitial);+ expect(JSON.stringify(build(messages, s))).toBe(JSON.stringify(input));+ }, 20000);++ test("REQ-15 TEST-36 renders an already resolved script after a restart as completed, not failed", async () => {+ const { messages } = await history();+ const later: ClaudeMessage[] = [+ ...messages,+ { role: "assistant", content: "The read finished" },+ { role: "user", content: "Next request" },+ ];+ const restartedStores = stores();++ const input = build(later, restartedStores);+ const outputs = input.filter((item) => item.type === "custom_tool_call_output");+ expect(outputs).toHaveLength(1);+ expect(JSON.stringify(outputs)).toContain("Script completed");+ expect(JSON.stringify(outputs)).toContain("output unavailable after a claudish restart");+ expect(JSON.stringify(outputs)).not.toContain("Script failed");+ expect(JSON.stringify(build(later, restartedStores))).toBe(JSON.stringify(input));+ }, 20000);++ test("REQ-1 tool result conversion preserves captured success and denial semantics", () => {+ const ok = nestedResultFromToolResult(3, capturedResult);+ const denied = nestedResultFromToolResult(4, denial);+ expect(ok).toMatchObject({ seq: 3, ok: true, text: capturedResult.content });+ expect(denied).toMatchObject({ seq: 4, ok: false, text: denial.content });+ });+});diff --git a/packages/cli/src/code-mode/relay.test.ts b/packages/cli/src/code-mode/relay.test.tsnew file mode 100644index 00000000..e9e22541--- /dev/null+++ b/packages/cli/src/code-mode/relay.test.ts@@ -0,0 +1,329 @@+import { afterEach, describe, expect, test } from "bun:test";+import { readFileSync } from "node:fs";+import { Hono } from "hono";+import { sseResponseToJson } from "../handlers/shared/collect-sse-message.js";+import {+ createResponsesStreamHandler,+ createSyntheticToolUseReply,+} from "../handlers/shared/stream-parsers/openai-responses-sse.js";+import type { StallClock } from "../handlers/shared/stream-parsers/responses/stall-guard.js";+import { accountKeyFromBinding, sessionKeyFor } from "./ids.js";+import { createCodeModeTurnHooks } from "./relay.js";+import { loadQuickJSModule, resetQuickJSLoaderForTests } from "./sandbox/quickjs-loader.js";+import { ScriptStore } from "./script-store.js";+import type { CodeModeStores } from "./stores.js";+import { ToolNameTable } from "./tool-names.js";+import { TurnRecords } from "./turn-records.js";+import type { CodeModeTurnHooks, ResponsesItem } from "./types.js";++const turn1 = readFileSync(+ new URL("../test-fixtures/sse-responses/codex-exec-turn1.sse", import.meta.url),+ "utf8"+);+const turn2 = readFileSync(+ new URL("../test-fixtures/sse-responses/codex-exec-turn2.sse", import.meta.url),+ "utf8"+);+const classic = readFileSync(+ new URL(+ "../test-fixtures/sse-responses/gpt-5.6-sol-responses-toolsonly-turn1.sse",+ import.meta.url+ ),+ "utf8"+);+const roundtrip = JSON.parse(+ readFileSync(+ new URL("../test-fixtures/code-mode/roundtrip-parts.request.json", import.meta.url),+ "utf8"+ )+);+const storesToClear: CodeModeStores[] = [];+const session = "55555555-5555-4555-8555-555555555555";+const binding = { auth: { arm: "oauth" as const, headers: { "chatgpt-account-id": "t4-relay" } } };+const accountKey = accountKeyFromBinding(binding)!;+const keys = { accountKey, sessionKey: sessionKeyFor(session, accountKey)! };+const modelName = "capture-model";++type Event = {+ type: string;+ index?: number;+ content_block?: { type: string; id?: string; name?: string; input?: Record<string, unknown> };+ delta?: { type?: string; text?: string; partial_json?: string; stop_reason?: string };+ message?: { usage?: { input_tokens: number; output_tokens: number } };+ usage?: { input_tokens: number; output_tokens: number };+ error?: { type: string; message: string };+};+function frames(wire: string): string[] {+ return wire.split(/\r?\n\r?\n/).filter((block) => block.includes("data: "));+}+function data(frame: string): Record<string, unknown> {+ const line = frame.split(/\r?\n/).find((l) => l.startsWith("data: "))!;+ return JSON.parse(line.slice(6));+}+function wire(frames: string[]): string {+ return frames.join("\n\n") + "\n\n";+}+const execFrames = frames(turn1);+const execStart = execFrames.findIndex((f) => {+ const e = data(f);+ return (+ e.type === "response.output_item.added" &&+ (e.item as { type?: string })?.type === "custom_tool_call"+ );+});+const midExec = wire(execFrames.slice(0, execStart + 4));+function clock(): StallClock {+ const pending = new Set<() => void>();+ return {+ now: () => 1000,+ setTimeout: (fn) => {+ pending.add(fn);+ return fn;+ },+ clearTimeout: (handle) => {+ pending.delete(handle as () => void);+ },+ };+}+function upstream(body: string | ReadableStream<Uint8Array>): Response {+ return new Response(body, { headers: { "content-type": "text/event-stream" } });+}+async function stream(+ response: Response,+ codeMode: CodeModeTurnHooks,+ extra: Partial<Parameters<typeof createResponsesStreamHandler>[2]> = {}+) {+ const app = new Hono();+ app.get("/", (c) =>+ createResponsesStreamHandler(c, response, {+ modelName,+ codeMode,+ retry: {+ stall: { thresholdMs: 0 },+ stallClock: clock(),+ issueLeg: async () => {+ throw new Error("Unexpected upstream continuation in a blocking-exec test");+ },+ },+ ...extra,+ })+ );+ const result = await app.fetch(new Request("http://t4.invalid/"));+ return frames(await result.text()).map((f) => data(f) as unknown as Event);+}+function toolUses(events: Event[]) {+ const uses = new Map<number, { id: string; name: string; json: string }>();+ for (const e of events) {+ if (e.type === "content_block_start" && e.content_block?.type === "tool_use")+ uses.set(e.index!, { id: e.content_block.id!, name: e.content_block.name!, json: "" });+ if (e.type === "content_block_delta" && e.delta?.type === "input_json_delta") {+ const use = uses.get(e.index!);+ if (use) use.json += e.delta.partial_json ?? "";+ }+ }+ return [...uses.values()].map(({ id, name, json }) => ({+ id,+ name,+ input: JSON.parse(json || "{}"),+ }));+}+async function hooks() {+ const stores = { scripts: new ScriptStore({ now: () => 1000 }), turns: new TurnRecords() };+ storesToClear.push(stores);+ const module = await loadQuickJSModule();+ expect(module).toBeDefined();+ return createCodeModeTurnHooks({+ stores,+ ...keys,+ shape: () => "classic",+ names: new ToolNameTable(["exec_command"]),+ allTools: [],+ defaultMaxOutputTokens: 10000,+ previousMessage: undefined,+ loadModule: async () => module,+ limits: { cpuMs: 100 },+ });+}+afterEach(() => {+ for (const s of storesToClear.splice(0)) {+ s.scripts.clear();+ s.turns.clear();+ }+ resetQuickJSLoaderForTests();+});++describe("T4 code-mode relay through the public Responses handler", () => {+ test("REQ-21 TEST-25 relays the real exec as exactly two nested tool_use blocks, never exec", async () => {+ const events = await stream(upstream(turn1), await hooks());+ expect(toolUses(events)).toEqual([+ {+ id: "toolu_cx_c0d07fd9ccd84fe29372c0e72ed12869_0",+ name: "exec_command",+ input: { cmd: "cat README.md; wc -l README.md", max_output_tokens: 3000 },+ },+ {+ id: "toolu_cx_c0d07fd9ccd84fe29372c0e72ed12869_1",+ name: "exec_command",+ input: { cmd: "cat notes.txt; wc -l notes.txt", max_output_tokens: 3000 },+ },+ ]);+ expect(events.filter((e) => e.type === "message_start")).toHaveLength(1);+ expect(events.filter((e) => e.type === "message_stop")).toHaveLength(1);+ expect(events.some((e) => e.type === "error")).toBe(false);+ expect(events.find((e) => e.type === "message_delta")?.delta?.stop_reason).toBe("tool_use");+ expect(events.find((e) => e.type === "message_delta")?.usage).toMatchObject({+ input_tokens: 30678,+ output_tokens: 134,+ });+ }, 20000);++ test("REQ-21 the captured answer turn keeps text and finishes without inventing tools", async () => {+ const events = await stream(upstream(turn2), await hooks());+ expect(toolUses(events)).toEqual([]);+ expect(events.some((e) => e.type === "error")).toBe(false);+ expect(events.find((e) => e.type === "message_delta")?.delta?.stop_reason).toBe("end_turn");+ expect(+ events.some(+ (e) => e.type === "content_block_delta" && e.delta?.type === "text_delta" && e.delta.text+ )+ ).toBe(true);+ }, 20000);++ test.each(["body end", "socket error"])(+ "REQ-22 TEST-26 emits SSE error when %s cuts the real exec input",+ async (how) => {+ // Derived solely by cutting codex-exec-turn1.sse after real input deltas.+ const bytes = new TextEncoder().encode(midExec);+ let sent = false;+ const body =+ how === "body end"+ ? midExec+ : new ReadableStream<Uint8Array>({+ pull(controller) {+ if (!sent) {+ sent = true;+ controller.enqueue(bytes);+ } else controller.error(new Error("injected socket drop"));+ },+ });+ const events = await stream(upstream(body), await hooks());+ expect(events.some((e) => e.type === "error")).toBe(true);+ expect(toolUses(events)).toEqual([]);+ expect(+ events.some((e) => e.type === "message_delta" && e.delta?.stop_reason === "tool_use")+ ).toBe(false);+ },+ 20000+ );++ test("REQ-23 TEST-27 refuses a tool_use finish over a cut-off classic block beside a blocking exec", async () => {+ // Derived event sequence: untouched added+delta frames for the first classic+ // call in gpt-5.6-sol-responses-toolsonly-turn1.sse, followed by untouched+ // exec and terminal frames of codex-exec-turn1.sse. Omit classic done frames+ // to model a cut-off block; do not fabricate protocol events.+ const ordinary = frames(classic);+ const start = ordinary.findIndex((f) => {+ const e = data(f);+ return (+ e.type === "response.output_item.added" &&+ (e.item as { type?: string })?.type === "function_call"+ );+ });+ const heldExec = execFrames.filter((f) => {+ const e = data(f);+ return (+ e.type === "response.completed" ||+ String(e.type).includes("custom_tool_call_input") ||+ (e.item as { type?: string })?.type === "custom_tool_call"+ );+ });+ const mixed = wire([...ordinary.slice(0, start + 2), ...heldExec]);+ const events = await stream(upstream(mixed), await hooks());+ expect(events.some((e) => e.type === "error")).toBe(true);+ expect(+ events.some((e) => e.type === "message_delta" && e.delta?.stop_reason === "tool_use")+ ).toBe(false);+ }, 20000);++ test("REQ-24 TEST-28 records an exec output even when a complete classic call shares its leg", async () => {+ // Derived from the first COMPLETE classic call's verbatim frames and real+ // exec frames. The public runtime seam supplies the accepted G roundtrip's+ // verbatim exec call/output pair to model an interstitial completed exec.+ const ordinary = frames(classic);+ const start = ordinary.findIndex((f) => {+ const e = data(f);+ return (+ e.type === "response.output_item.added" &&+ (e.item as { type?: string })?.type === "function_call"+ );+ });+ const end = ordinary.findIndex(+ (f, i) => i > start && data(f).type === "response.output_item.done"+ );+ const heldExec = execFrames.filter((f) => {+ const e = data(f);+ return (+ e.type === "response.completed" ||+ String(e.type).includes("custom_tool_call_input") ||+ (e.item as { type?: string })?.type === "custom_tool_call"+ );+ });+ const appendItems: ResponsesItem[] = roundtrip.body.input.slice(-2);+ let recorded: ResponsesItem[] = [];+ const codeMode: CodeModeTurnHooks = {+ onExecCall: () => ({ kind: "continue", appendItems: structuredClone(appendItems) }),+ onTurnEnd: (record) => {+ recorded = record.items;+ },+ onTurnAbandoned: () => {},+ };+ const events = await stream(+ upstream(wire([...ordinary.slice(0, end + 1), ...heldExec])),+ codeMode+ );+ expect(toolUses(events)).toEqual([+ { id: expect.any(String), name: "read_file", input: { path: "a.ts" } },+ ]);+ expect(events.find((e) => e.type === "message_delta")?.delta?.stop_reason).toBe("tool_use");+ expect(events.some((e) => e.type === "error")).toBe(false);+ expect(+ recorded.filter((i) => i.type === "custom_tool_call" || i.type === "custom_tool_call_output")+ ).toEqual(appendItems);+ }, 20000);++ test("REQ-26 TEST-32 synthetic replies share repair, prior usage and the JSON exit", async () => {+ const sse = createSyntheticToolUseReply(+ [+ {+ id: "toolu_cx_0123456789abcdef0123456789abcdef_1",+ name: "Read",+ input: { file_path: "f1" },+ },+ ],+ {+ modelName,+ priorInputTokens: 1234,+ shouldBufferTool: (name) => name === "Read",+ onToolCall: (_name, args) => JSON.stringify({ ...JSON.parse(args), repaired: true }),+ }+ );+ const json = await sseResponseToJson(sse, modelName);+ expect(json.status).toBe(200);+ const body = await json.json();+ expect(body).toMatchObject({+ type: "message",+ role: "assistant",+ model: modelName,+ stop_reason: "tool_use",+ content: [+ {+ type: "tool_use",+ id: "toolu_cx_0123456789abcdef0123456789abcdef_1",+ name: "Read",+ input: { file_path: "f1", repaired: true },+ },+ ],+ usage: { input_tokens: 1234, output_tokens: 0 },+ });+ }, 20000);+});diff --git a/packages/cli/src/code-mode/resume.test.ts b/packages/cli/src/code-mode/resume.test.tsnew file mode 100644index 00000000..168f3211--- /dev/null+++ b/packages/cli/src/code-mode/resume.test.ts@@ -0,0 +1,420 @@+import { afterEach, describe, expect, test } from "bun:test";+import { readFileSync } from "node:fs";+import { accountKeyFromBinding, execKeyFor, sessionKeyFor } from "./ids.js";+import { buildCodeModeInput } from "./input-builder.js";+import { createCodeModeTurnHooks } from "./relay.js";+import { resumeFromToolResults } from "./resume.js";+import { loadQuickJSModule, resetQuickJSLoaderForTests } from "./sandbox/quickjs-loader.js";+import { ScriptStore } from "./script-store.js";+import type { CodeModeStores } from "./stores.js";+import { ToolNameTable } from "./tool-names.js";+import { TurnRecords } from "./turn-records.js";+import {+ type ClaudeContentBlock,+ type ClaudeMessage,+ type NestedToolUse,+ relayNestedInput,+} from "./types.js";++const OWNER = "11111111-1111-4111-8111-111111111111";+const FORK = "22222222-2222-4222-8222-222222222222";+const CALL = "call_0123456789abcdef0123456789abcdef";+const tools = [+ {+ name: "Read",+ description: "Read a file",+ input_schema: {+ type: "object",+ properties: { file_path: { type: "string" } },+ required: ["file_path"],+ },+ },+];+const names = new ToolNameTable(["Read"]);+const binding = {+ auth: { arm: "oauth" as const, headers: { "chatgpt-account-id": "t4-account" } },+};+const accountKey = accountKeyFromBinding(binding)!;+const keys = (session = OWNER) => ({ accountKey, sessionKey: sessionKeyFor(session, accountKey)! });+const transcripts = (name: string) =>+ readFileSync(new URL(`../pane/test-fixtures/transcripts/${name}`, import.meta.url), "utf8")+ .trim()+ .split("\n")+ .map((line) => JSON.parse(line));+const blocksIn = (rows: ReturnType<typeof transcripts>): ClaudeContentBlock[] =>+ rows.flatMap((row) => (Array.isArray(row.message?.content) ? row.message.content : []));+const success = blocksIn(transcripts("tools-session.jsonl")).find(+ (b) => b.type === "tool_result" && b.is_error === false+)!;+const permissionBlocks = blocksIn(transcripts("permission-bash-esc.jsonl"));+const denial = permissionBlocks.find((b) => b.type === "tool_result" && b.is_error)!;+const interrupt = permissionBlocks.find(+ (b) => b.type === "text" && b.text?.startsWith("[Request interrupted by user")+)!;+const threeRounds =+ 'text(await tools.Read({file_path:"f0"})); text(await tools.Read({file_path:"f1"})); text(await tools.Read({file_path:"f2"}));';+const storesToClear: CodeModeStores[] = [];++function makeStores(): CodeModeStores {+ const stores = { scripts: new ScriptStore({ now: () => 1000 }), turns: new TurnRecords() };+ storesToClear.push(stores);+ return stores;+}+afterEach(() => {+ for (const s of storesToClear.splice(0)) {+ s.scripts.clear();+ s.turns.clear();+ }+ resetQuickJSLoaderForTests();+});++// Derived message arrays: exact tool_result / interrupt block shapes from+// pane transcripts permission-bash-esc.jsonl and tools-session.jsonl, with local+// IDs/content replaced to answer each script. No protocol stream is fabricated.+function result(id: string, text = "LONGDONE"): ClaudeContentBlock {+ return { ...structuredClone(success), tool_use_id: id, content: text };+}+function assistant(uses: NestedToolUse[]): ClaudeMessage {+ return {+ role: "assistant",+ content: uses.map((b) => ({ type: "tool_use", id: b.id, name: b.name, input: b.input })),+ };+}+function answer(uses: NestedToolUse[], prefix = "r"): ClaudeMessage {+ return { role: "user", content: uses.map((b, i) => result(b.id, `${prefix}${i}`)) };+}+function request(messages: ClaudeMessage[], session = OWNER) {+ // Public resume signature leaves metadata unknown; use Claude Code's JSON+ // user_id form. The plan records this explicit contract assumption.+ return {+ messages,+ tools,+ metadata: {+ user_id: JSON.stringify({ device_id: "t4", account_uuid: "t4", session_id: session }),+ },+ };+}+function resume(messages: ClaudeMessage[], stores: CodeModeStores, session = OWNER) {+ return resumeFromToolResults(request(messages, session), binding, stores, undefined);+}+function output(messages: ClaudeMessage[], stores: CodeModeStores, session = OWNER) {+ return JSON.stringify(buildCodeModeInput(messages, stores, keys(session), { toolNames: names }));+}+function next(+ outcome: ReturnType<typeof resumeFromToolResults>+): [NestedToolUse, ...NestedToolUse[]] {+ expect(outcome.kind).toBe("reply");+ if (outcome.kind !== "reply") throw new Error("Expected a synthetic tool-use reply");+ return outcome.blocks;+}+async function begin(source = threeRounds) {+ const stores = makeStores();+ const module = await loadQuickJSModule();+ expect(module).toBeDefined();+ const hooks = createCodeModeTurnHooks({+ stores,+ ...keys(),+ shape: () => "classic",+ names,+ allTools: [],+ defaultMaxOutputTokens: 10000,+ previousMessage: undefined,+ loadModule: async () => module,+ limits: { cpuMs: 100 },+ });+ const step = await hooks.onExecCall({+ callId: CALL,+ input: source,+ precedingItems: [],+ truncated: false,+ });+ expect(step.kind).toBe("emit-tool-uses");+ if (step.kind !== "emit-tool-uses") throw new Error("Script did not block");+ const messages: ClaudeMessage[] = [+ { role: "user", content: "Read the files" },+ assistant(step.blocks),+ answer(step.blocks),+ ];+ return { stores, messages, blocks: step.blocks, hooks };+}+function addRound(+ messages: ClaudeMessage[],+ blocks: NestedToolUse[],+ prefix = "r"+): ClaudeMessage[] {+ return [...messages, assistant(blocks), answer(blocks, prefix)];+}+function lose(stores: CodeModeStores) {+ const record = stores.scripts.get(accountKey, execKeyFor(CALL))!;+ stores.scripts.transition(record, "evict");+}++describe("T4 resume table", () => {+ test("REQ-1 TEST-1 replies with the owner's next batch and TEST-2 continues after completion", async () => {+ const { stores, messages } = await begin(+ 'text(await tools.Read({file_path:"f0"})); text(await tools.Read({file_path:"f1"}));'+ );+ const blocks = next(resume(messages, stores));+ expect(blocks).toEqual([+ {+ id: "toolu_cx_0123456789abcdef0123456789abcdef_1",+ name: "Read",+ input: { file_path: "f1" },+ },+ ]);+ const completed = addRound(messages, blocks, "last");+ expect(resume(completed, stores)).toEqual({ kind: "continue" });+ expect(output(completed, stores)).toContain("Script completed");+ expect(output(completed, stores)).toContain("last0");+ }, 20000);++ test("REQ-2 TEST-3 rejects a missing parallel result with no tool_result returned", async () => {+ const { stores, messages, blocks } = await begin(+ 'const r=await Promise.allSettled([tools.Read({file_path:"a"}),tools.Read({file_path:"b"})]); r.forEach(x=>text(JSON.stringify(x)));'+ );+ messages[messages.length - 1] = { role: "user", content: [result(blocks[0].id)] };+ expect(resume(messages, stores)).toEqual({ kind: "continue" });+ expect(output(messages, stores)).toContain("no tool_result returned");+ expect(output(messages, stores)).toContain("rejected");+ expect(output(messages, stores)).toContain("LONGDONE");+ }, 20000);++ test("REQ-3 TEST-4 replays identical batch IDs on duplicate requests and keeps completion stable", async () => {+ const { stores, messages } = await begin();+ const first = next(resume(messages, stores));+ expect(next(resume(structuredClone(messages), stores))).toEqual(first);+ const round1 = addRound(messages, first);+ const second = next(resume(round1, stores));+ const completed = addRound(round1, second, "final");+ expect(resume(completed, stores)).toEqual({ kind: "continue" });+ const before = output(completed, stores);+ expect(resume(structuredClone(completed), stores)).toEqual({ kind: "continue" });+ expect(output(completed, stores)).toBe(before);+ }, 20000);++ test("REQ-4 TEST-5 terminates for the captured interrupt and preserves the denied result", async () => {+ const { stores, messages, blocks } = await begin();+ messages[messages.length - 1] = {+ role: "user",+ content: [+ { ...structuredClone(denial), tool_use_id: blocks[0].id },+ structuredClone(interrupt),+ ],+ };+ expect(resume(messages, stores)).toEqual({ kind: "continue" });+ const built = output(messages, stores);+ expect(built).toContain("Script terminated");+ expect(built).toContain("interrupted by the user");+ expect(built).toContain("The user doesn't want to proceed");+ expect(built).not.toContain("Script completed");+ }, 20000);++ test("REQ-1 TEST-33 passes a denial without an interrupt to the script as a plain rejected string", async () => {+ const { stores, messages, blocks } = await begin(+ 'try { await tools.Read({file_path:"a"}); } catch(e) { text(typeof e); text(e); }'+ );+ messages[messages.length - 1] = {+ role: "user",+ content: [{ ...structuredClone(denial), tool_use_id: blocks[0].id }],+ };+ expect(resume(messages, stores)).toEqual({ kind: "continue" });+ expect(output(messages, stores)).toContain("Script completed");+ expect(output(messages, stores)).toContain('"string"');+ expect(output(messages, stores)).toContain("The user doesn't want to proceed");+ expect(output(messages, stores)).not.toContain("Script terminated");+ }, 20000);++ test.each(["empty", "omitted"])(+ "REQ-6 TEST-7 leaves a suspended batch alone when tools are %s",+ async (variant) => {+ const { stores, messages } = await begin();+ const req: { messages: ClaudeMessage[]; metadata: unknown; tools?: typeof tools } =+ request(messages);+ if (variant === "empty") req.tools = [];+ else delete req.tools;+ expect(resumeFromToolResults(req, binding, stores, undefined)).toEqual({ kind: "none" });+ expect(next(resume(messages, stores))[0].input).toEqual({ file_path: "f1" });+ },+ 20000+ );++ test("REQ-7 TEST-8 gives a consumed-batch fork a tombstone without stealing the owner's next round", async () => {+ const { stores, messages } = await begin();+ const round1 = next(resume(messages, stores));+ expect(resume(messages, stores, FORK)).toEqual({ kind: "continue" });+ const forkOutput = output(messages, stores, FORK);+ expect(forkOutput).toContain("Script failed");+ expect(forkOutput).toContain("this script belongs to the session this one was forked from");+ expect(forkOutput).not.toContain("Script completed");+ const ownerRound1 = addRound(messages, round1, "owner");+ const round2 = next(resume(ownerRound1, stores));+ expect(round2[0].input).toEqual({ file_path: "f2" });+ const finished = addRound(ownerRound1, round2, "finished");+ expect(resume(finished, stores)).toEqual({ kind: "continue" });+ expect(output(finished, stores, FORK)).toBe(output(finished, stores));+ }, 20000);++ test("REQ-8 TEST-9 tombstones when earlier consumed results change", async () => {+ const { stores, messages } = await begin();+ const later = addRound(messages, next(resume(messages, stores)));+ const changed = structuredClone(later);+ (changed[2].content as ClaudeContentBlock[])[0].content = "changed first result";+ expect(resume(changed, stores)).toEqual({ kind: "continue" });+ expect(output(changed, stores)).toContain("Script failed");+ expect(output(changed, stores)).toContain("claudish lost this script's state");+ }, 20000);++ test("REQ-9 TEST-10 cannot resume another account's record", async () => {+ const { stores, messages } = await begin();+ const other = {+ auth: { arm: "oauth" as const, headers: { "chatgpt-account-id": "other-t4-account" } },+ };+ expect(resumeFromToolResults(request(messages), other, stores, undefined).kind).not.toBe(+ "reply"+ );+ expect(next(resume(messages, stores))[0].input).toEqual({ file_path: "f1" });+ }, 20000);++ test.each([{ type: "any" }, { type: "none" }, { type: "tool", name: "Read" }] as const)(+ "REQ-25 TEST-29 ignores a forced tool choice $type",+ async (choice) => {+ const { stores, messages } = await begin();+ expect(resumeFromToolResults(request(messages), binding, stores, choice)).toEqual({+ kind: "none",+ });+ expect(next(resume(messages, stores))[0].input).toEqual({ file_path: "f1" });+ },+ 20000+ );++ test("REQ-25 TEST-30 leaves prefill and unrelated subagent history resumable", async () => {+ const { stores, messages } = await begin();+ resume(messages.slice(0, -1), stores);+ resume([{ role: "user", content: "An unrelated subagent prompt" }], stores);+ expect(next(resume(messages, stores))[0].input).toEqual({ file_path: "f1" });+ }, 20000);++ test("REQ-25 TEST-31 terminates when the conversation moves past the pending batch", async () => {+ const { stores, messages } = await begin();+ const moved = [+ ...messages.slice(0, -1),+ { role: "user", content: "Do something else instead" },+ ];+ resume(moved, stores);+ expect(output(moved, stores)).toContain("Script terminated");+ expect(output(moved, stores)).toContain("the conversation moved on without the tool results");+ expect(resume(messages, stores).kind).not.toBe("reply");+ }, 20000);+});++describe("T4 restart and replay", () => {+ test("REQ-5 REQ-10 TEST-6 TEST-11 creates a stable failed tombstone on the first answer after restart", async () => {+ const started = await begin();+ const stores = makeStores();+ expect(+ resumeFromToolResults(request(started.messages), binding, undefined, undefined, {+ createStores: () => stores,+ })+ ).toEqual({ kind: "continue" });+ const first = output(started.messages, stores);+ expect(first).toContain("Script failed");+ expect(first).toContain("claudish lost this script's state");+ expect(first).toContain("r0");+ const later: ClaudeMessage[] = [+ ...started.messages,+ { role: "assistant", content: "Recovered answer" },+ { role: "user", content: "Next question" },+ ];+ for (let i = 0; i < 2; i++) {+ resume(later, stores);+ const rendered = buildCodeModeInput(later, stores, keys()).filter(+ (x) => x.type === "custom_tool_call_output"+ );+ const original = buildCodeModeInput(started.messages, stores, keys()).filter(+ (x) => x.type === "custom_tool_call_output"+ );+ expect(rendered).toEqual(original);+ expect(JSON.stringify(rendered)).toContain("Script failed");+ }+ }, 20000);++ test("REQ-11 TEST-12 requests a missing module once and tombstones if loading is not allowed", async () => {+ const { stores, messages } = await begin();+ lose(stores);+ resetQuickJSLoaderForTests();+ expect(+ resumeFromToolResults(request(messages), binding, stores, undefined, {+ mayRequestModule: true,+ })+ ).toEqual({ kind: "needs-module" });+ expect(+ resumeFromToolResults(request(messages), binding, stores, undefined, {+ mayRequestModule: false,+ })+ ).toEqual({ kind: "continue" });+ expect(output(messages, stores)).toContain("Script failed");+ expect(+ resumeFromToolResults(request(messages), binding, stores, undefined, {+ mayRequestModule: true,+ }).kind+ ).not.toBe("needs-module");+ }, 20000);++ test("REQ-11 TEST-13 re-enters after loading a module and returns the next batch", async () => {+ const { stores, messages } = await begin();+ lose(stores);+ resetQuickJSLoaderForTests();+ expect(+ resumeFromToolResults(request(messages), binding, stores, undefined, {+ mayRequestModule: true,+ })+ ).toEqual({ kind: "needs-module" });+ expect(await loadQuickJSModule()).toBeDefined();+ expect(+ next(+ resumeFromToolResults(request(messages), binding, stores, undefined, {+ mayRequestModule: false,+ })+ )[0].input+ ).toEqual({ file_path: "f1" });+ }, 20000);++ test("REQ-12 TEST-14 replays two answered rounds and blocks on the third call", async () => {+ const { stores, messages } = await begin();+ const round1 = addRound(messages, next(resume(messages, stores)), "second");+ lose(stores);+ expect(next(resume(round1, stores))).toEqual([+ {+ id: "toolu_cx_0123456789abcdef0123456789abcdef_2",+ name: "Read",+ input: { file_path: "f2" },+ },+ ]);+ }, 20000);++ test("REQ-13 TEST-15 terminates interrupted replay without emitting the next call", async () => {+ const { stores, messages } = await begin();+ const round1 = addRound(messages, next(resume(messages, stores)), "second");+ (round1[round1.length - 1].content as ClaudeContentBlock[]).push(structuredClone(interrupt));+ lose(stores);+ expect(resume(round1, stores)).toEqual({ kind: "continue" });+ const rendered = output(round1, stores);+ expect(rendered).toContain("Script terminated");+ expect(rendered).toContain("interrupted by the user");+ expect(rendered).toContain("second0");+ expect(rendered).not.toContain("Script completed");+ }, 20000);++ test("REQ-14 TEST-16 replays recorded Layer 4 repairs instead of treating them as divergence", async () => {+ const { stores, messages, blocks } = await begin();+ const repair = (_name: string, args: string) =>+ JSON.stringify({ ...JSON.parse(args), repaired: true });+ relayNestedInput(blocks[0], repair);+ messages[1] = assistant(blocks);+ const second = next(resume(messages, stores));+ relayNestedInput(second[0], repair);+ const round1 = addRound(messages, second, "repaired-result");+ lose(stores);+ expect(next(resume(round1, stores))[0].input).toEqual({ file_path: "f2" });+ }, 20000);+});diff --git a/packages/cli/src/test-fixtures/code-mode/roundtrip-parts.request.json b/packages/cli/src/test-fixtures/code-mode/roundtrip-parts.request.jsonnew file mode 100644index 00000000..3066ea07--- /dev/null+++ b/packages/cli/src/test-fixtures/code-mode/roundtrip-parts.request.json@@ -0,0 +1,74 @@+{+ "headers": {+ "authorization": "<redacted>",+ "chatgpt-account-id": "<redacted>",+ "content-type": "application/json",+ "accept": "text/event-stream",+ "originator": "codex_exec",+ "user-agent": "codex_exec/0.161.0 (variant-probe)",+ "version": "0.161.0"+ },+ "body": {+ "model": "gpt-6.1-sol",+ "stream": true,+ "store": false,+ "tool_choice": "auto",+ "parallel_tool_calls": false,+ "include": ["reasoning.encrypted_content"],+ "reasoning": {+ "effort": "low"+ },+ "text": {+ "verbosity": "low"+ },+ "instructions": "You are a coding agent. Use the exec tool for any file access.",+ "tools": [+ {+ "type": "custom",+ "name": "exec",+ "description": "Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\n\n### `exec_command`\nRuns a command.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n // Shell command to execute.\n cmd: string;\n}): Promise<{ output: string; exit_code?: number; wall_time_seconds: number }>; };\n```",+ "format": {+ "type": "grammar",+ "syntax": "lark",+ "definition": "\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"+ }+ }+ ],+ "input": [+ {+ "type": "message",+ "role": "user",+ "content": [+ {+ "type": "input_text",+ "text": "Read README.md and notes.txt in parallel and report line counts."+ }+ ]+ },+ {+ "type": "custom_tool_call",+ "call_id": "call_probe_1",+ "name": "exec",+ "input": "const r = await Promise.all([tools.exec_command({cmd:\"wc -l README.md\"}), tools.exec_command({cmd:\"wc -l notes.txt\"})]);\nr.forEach((x)=>text(x.output));\n"+ },+ {+ "type": "custom_tool_call_output",+ "call_id": "call_probe_1",+ "output": [+ {+ "type": "input_text",+ "text": "Script completed\nWall time 0.2 seconds\nOutput:\n"+ },+ {+ "type": "input_text",+ "text": " 6 README.md\n"+ },+ {+ "type": "input_text",+ "text": " 3 notes.txt\n"+ }+ ]+ }+ ]+ }+}diff --git a/packages/cli/src/test-fixtures/code-mode/roundtrip-script-error.request.json b/packages/cli/src/test-fixtures/code-mode/roundtrip-script-error.request.jsonnew file mode 100644index 00000000..7ed31f6e--- /dev/null+++ b/packages/cli/src/test-fixtures/code-mode/roundtrip-script-error.request.json@@ -0,0 +1,70 @@+{+ "headers": {+ "authorization": "<redacted>",+ "chatgpt-account-id": "<redacted>",+ "content-type": "application/json",+ "accept": "text/event-stream",+ "originator": "codex_exec",+ "user-agent": "codex_exec/0.161.0 (variant-probe)",+ "version": "0.161.0"+ },+ "body": {+ "model": "gpt-6.1-sol",+ "stream": true,+ "store": false,+ "tool_choice": "auto",+ "parallel_tool_calls": false,+ "include": ["reasoning.encrypted_content"],+ "reasoning": {+ "effort": "low"+ },+ "text": {+ "verbosity": "low"+ },+ "instructions": "You are a coding agent. Use the exec tool for any file access.",+ "tools": [+ {+ "type": "custom",+ "name": "exec",+ "description": "Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\n\n### `exec_command`\nRuns a command.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n // Shell command to execute.\n cmd: string;\n}): Promise<{ output: string; exit_code?: number; wall_time_seconds: number }>; };\n```",+ "format": {+ "type": "grammar",+ "syntax": "lark",+ "definition": "\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"+ }+ }+ ],+ "input": [+ {+ "type": "message",+ "role": "user",+ "content": [+ {+ "type": "input_text",+ "text": "Read README.md and notes.txt in parallel and report line counts."+ }+ ]+ },+ {+ "type": "custom_tool_call",+ "call_id": "call_probe_1",+ "name": "exec",+ "input": "const r = await Promise.all([tools.exec_command({cmd:\"wc -l README.md\"}), tools.exec_command({cmd:\"wc -l notes.txt\"})]);\nr.forEach((x)=>text(x.output));\n"+ },+ {+ "type": "custom_tool_call_output",+ "call_id": "call_probe_1",+ "output": [+ {+ "type": "input_text",+ "text": "Script failed\nWall time 0.0 seconds\nOutput:\n"+ },+ {+ "type": "input_text",+ "text": "Script error:\nTypeError: x.output is undefined"+ }+ ]+ }+ ]+ }+}diff --git a/packages/cli/src/test-fixtures/code-mode/roundtrip-string.request.json b/packages/cli/src/test-fixtures/code-mode/roundtrip-string.request.jsonnew file mode 100644index 00000000..5cd16812--- /dev/null+++ b/packages/cli/src/test-fixtures/code-mode/roundtrip-string.request.json@@ -0,0 +1,61 @@+{+ "headers": {+ "authorization": "<redacted>",+ "chatgpt-account-id": "<redacted>",+ "content-type": "application/json",+ "accept": "text/event-stream",+ "originator": "codex_exec",+ "user-agent": "codex_exec/0.161.0 (variant-probe)",+ "version": "0.161.0"+ },+ "body": {+ "model": "gpt-6.1-sol",+ "stream": true,+ "store": false,+ "tool_choice": "auto",+ "parallel_tool_calls": false,+ "include": ["reasoning.encrypted_content"],+ "reasoning": {+ "effort": "low"+ },+ "text": {+ "verbosity": "low"+ },+ "instructions": "You are a coding agent. Use the exec tool for any file access.",+ "tools": [+ {+ "type": "custom",+ "name": "exec",+ "description": "Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\n\n### `exec_command`\nRuns a command.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n // Shell command to execute.\n cmd: string;\n}): Promise<{ output: string; exit_code?: number; wall_time_seconds: number }>; };\n```",+ "format": {+ "type": "grammar",+ "syntax": "lark",+ "definition": "\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"+ }+ }+ ],+ "input": [+ {+ "type": "message",+ "role": "user",+ "content": [+ {+ "type": "input_text",+ "text": "Read README.md and notes.txt in parallel and report line counts."+ }+ ]+ },+ {+ "type": "custom_tool_call",+ "call_id": "call_probe_1",+ "name": "exec",+ "input": "const r = await Promise.all([tools.exec_command({cmd:\"wc -l README.md\"}), tools.exec_command({cmd:\"wc -l notes.txt\"})]);\nr.forEach((x)=>text(x.output));\n"+ },+ {+ "type": "custom_tool_call_output",+ "call_id": "call_probe_1",+ "output": "Script completed\nWall time 0.2 seconds\nOutput:\n 6 README.md\n 3 notes.txt\n"+ }+ ]+ }+}diff --git a/packages/cli/src/test-fixtures/sse-responses/codex-exec-turn1.sse b/packages/cli/src/test-fixtures/sse-responses/codex-exec-turn1.ssenew file mode 100644index 00000000..06b65e78--- /dev/null+++ b/packages/cli/src/test-fixtures/sse-responses/codex-exec-turn1.sse@@ -0,0 +1,387 @@+event: response.created+data: {"type":"response.created","sequence_number":0,"safety_buffering":false,"response":{"id":"resp_07438c2e31b28b62016ad2395bfc388191a56b110cd48b3292","object":"response","created_at":1792162140,"completed_at":null,"status":"in_progress","background":false,"frequency_penalty":0.0,"presence_penalty":0.0,"moderation":null,"model":"gpt-6.1-sol","access_programs":{"cyber":"standard"},"previous_response_id":null,"instructions":null,"output":[],"error":null,"incomplete_details":null,"tools":[{"type":"namespace","name":"functions","description":"","tools":[{"type":"function","strict":false,"name":"wait","description":"Waits on a yielded `exec` cell and returns new output or completion.\n- Use `wait` only after `exec` returns `Script running with cell ID ...`.\n- `cell_id` identifies the running `exec` cell to resume.\n- `yield_time_ms` controls how long to wait for more output before yielding again. Defaults to 10000 ms.\n- `max_tokens` limits how much new output this wait call returns. Defaults to 10000 tokens.\n- `terminate: true` stops the running cell; false or omitted waits for output.\n- `wait` returns only the new output since the last yield, or the final completion or termination result for that cell.\n- If the cell is still running, `wait` may yield again with the same `cell_id`.\n- If the cell has already finished, `wait` returns the completed result and closes the cell.","output_schema":null,"parameters":{"type":"object","properties":{"cell_id":{"type":"string","description":"Identifier of the running exec cell."},"max_tokens":{"type":"number","description":"Output token budget for this wait call. Defaults to 10000 tokens."},"terminate":{"type":"boolean","description":"True stops the running exec cell; false or omitted waits for output."},"yield_time_ms":{"type":"number","description":"Wait before yielding more output. Defaults to 10000 ms."}},"required":["cell_id"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input","description":"Request user input for one to three short questions and wait for the response. This tool is only available in Plan mode.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"Questions to show the user. Prefer 1 and do not exceed 3","items":{"type":"object","properties":{"header":{"type":"string","description":"Short header label shown in the UI (12 or fewer chars)."},"id":{"type":"string","description":"Stable identifier for mapping answers (snake_case)."},"options":{"type":"array","description":"Provide 2-3 mutually exclusive choices. Put the recommended option first and suffix its label with \"(Recommended)\". Do not include an \"Other\" option in this list; the client will add a free-form \"Other\" option automatically.","items":{"type":"object","properties":{"description":{"type":"string","description":"One short sentence explaining impact/tradeoff if selected."},"label":{"type":"string","description":"User-facing label (1-5 words)."}},"required":["label","description"],"additionalProperties":false}},"question":{"type":"string","description":"Single-sentence prompt shown to the user."}},"required":["id","header","question","options"],"additionalProperties":false}}},"required":["questions"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input_async","description":"Ask the user one or more questions during ongoing work. Use this tool only to request missing information, preferences, constraints, clarification, or approval. The tool returns immediately without ending the turn or waiting for a reply; any reply arrives asynchronously as a new user message. Keep questions concise, self-contained, and easy to understand, using a level of detail appropriate to the user and task. The UI always allows a free-text answer, including when suggested options are provided. A preselected option is not submitted automatically.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"One or more self-contained questions to present together, in display order.","items":{"type":"object","properties":{"options":{"type":"array","description":"Suggested answers, in display order. Put the recommended answer first; the first option is preselected by default. The user can select one option or enter a free-text answer. Do not include an Other option or a free-text placeholder; the UI provides free-text input automatically. Omit options for a free-text-only question.","items":{"type":"string"},"minItems":1},"title":{"type":"string","description":"The complete question shown to the user, including any context needed to answer it."}},"required":["title"],"additionalProperties":false},"minItems":1}},"required":["questions"],"additionalProperties":false}},{"type":"custom","name":"exec","description":"Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\nShared MCP Types:\n```ts\ntype Role = \"user\" | \"assistant\";\ntype MetaObject = Record<string, unknown>;\ntype Annotations = {\n audience?: Role[];\n priority?: number;\n lastModified?: string;\n};\ntype Icon = {\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n};\ntype TextResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n text: string;\n};\ntype BlobResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n blob: string;\n};\ntype TextContent = {\n type: \"text\";\n text: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ImageContent = {\n type: \"image\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype AudioContent = {\n type: \"audio\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ResourceLink = {\n icons?: Icon[];\n name: string;\n title?: string;\n uri: string;\n description?: string;\n mimeType?: string;\n annotations?: Annotations;\n size?: number;\n _meta?: MetaObject;\n type: \"resource_link\";\n};\ntype EmbeddedResource = {\n type: \"resource\";\n resource: TextResourceContents | BlobResourceContents;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ContentBlock =\n | TextContent\n | ImageContent\n | AudioContent\n | ResourceLink\n | EmbeddedResource;\ntype CallToolResult<TStructured = { [key: string]: unknown }> = {\n _meta?: MetaObject;\n content: ContentBlock[];\n isError?: boolean;\n structuredContent?: TStructured;\n [key: string]: unknown;\n};\n```\n\n### `apply_patch`\nThe `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.\n\nexec tool declaration:\n```ts\ndeclare const tools: { apply_patch(input: string): Promise<unknown>; };\n```\n\n### `create_goal`\nCreate a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks.\nSet token_budget only when an explicit token budget is requested. Fails if an unfinished goal exists; use update_goal only for status.\n\nexec tool declaration:\n```ts\ndeclare const tools: { create_goal(args: {\n // Required. The concrete objective to start pursuing. This starts a new active goal when no goal exists or replaces the current goal when it is complete.\n objective: string;\n // Positive token budget for the new goal. Omit unless explicitly requested.\n token_budget?: number;\n}): Promise<unknown>; };\n```\n\n### `exec_command`\nRuns a command in a PTY, returning output or a session ID for ongoing interaction.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n // Shell command to execute.\n cmd: string;\n // User-facing approval question for `require_escalated`; omit otherwise.\n justification?: string;\n // True runs the shell with -l/-i semantics; false disables them. Defaults to true.\n login?: boolean;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Reusable approval prefix for `cmd`, only with `sandbox_permissions: \"require_escalated\"`; for example [\"git\", \"pull\"].\n prefix_rule?: Array<string>;\n // Per-command sandbox override. Defaults to `use_default`; use `require_escalated` for unsandboxed execution.\n sandbox_permissions?: \"use_default\" | \"require_escalated\";\n // Shell binary to launch. Defaults to the user's default shell.\n shell?: string;\n // True allocates a PTY for the command; false or omitted uses plain pipes.\n tty?: boolean;\n // Working directory for the command. Defaults to the turn cwd.\n workdir?: string;\n // Wait before yielding output. Defaults to 10000 ms; effective range is 250-30000 ms.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n### `get_goal`\nGet the current goal for this thread, including status, budgets, token and elapsed-time usage, and remaining token budget.\n\nexec tool declaration:\n```ts\ndeclare const tools: { get_goal(args: {}): Promise<unknown>; };\n```\n\n### `list_mcp_resource_templates`\nLists resource templates provided by MCP servers. Parameterized resource templates allow servers to share data that takes parameters and provides context to language models, such as files, database schemas, or application-specific information. Prefer resource templates over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resource_templates(args: {\n // Opaque cursor from a previous list_mcp_resource_templates call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resource templates from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `list_mcp_resources`\nLists resources provided by MCP servers. Resources allow servers to share data that provides context to language models, such as files, database schemas, or application-specific information. Prefer resources over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resources(args: {\n // Opaque cursor from a previous list_mcp_resources call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resources from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `read_mcp_resource`\nRead a specific resource from an MCP server given the server name and resource URI.\n\nexec tool declaration:\n```ts\ndeclare const tools: { read_mcp_resource(args: {\n // MCP server name exactly as configured. Must match the 'server' field returned by list_mcp_resources.\n server: string;\n // Resource URI to read. Must be one of the URIs returned by list_mcp_resources.\n uri: string;\n}): Promise<unknown>; };\n```\n\n### `request_plugin_install`\n# Suggest a recommended plugin installation\n\nUse this tool only when all of the following are true:\n- The user explicitly asks to use a specific plugin that is not already available in the current context or active `tools` list.\n- Tool search has already been exhausted and did not find or make the requested tool callable.\n- The plugin is listed in `<recommended_plugins>`.\n\nDo not use it for adjacent capabilities, broad recommendations, or plugins that merely seem useful. Briefly explain why the plugin can help with the current request in `suggest_reason`.\n\nIMPORTANT: DO NOT call this tool in parallel with other tools.\n\nexec tool declaration:\n```ts\ndeclare const tools: { request_plugin_install(args: {\n // The parenthesized plugin ID from the `<recommended_plugins>` list.\n plugin_id: string;\n // Concise one-line user-facing reason why this plugin can help with the current request.\n suggest_reason: string;\n}): Promise<unknown>; };\n```\n\n### `update_goal`\nUpdate the existing goal.\nSet status to `paused` only at the user's explicit request to pause this goal, never on your own initiative. Ask if unclear; a later resume revokes that request. Report the returned status and stop goal work. Budget limits take precedence over pausing.\nSet status to `complete` only when the objective has actually been achieved and no required work remains.\nSet status to `blocked` only when the same blocking condition has repeated for at least three consecutive goal turns, counting the original/user-triggered turn and any automatic continuations, and the agent cannot make meaningful progress without user input or an external-state change.\nIf the user resumes a goal that was previously marked `blocked`, treat the resumed run as a fresh blocked audit. If the same blocking condition then repeats for at least three consecutive resumed goal turns, set status to `blocked` again.\nOnce the blocked threshold is satisfied, do not keep reporting that you are still blocked while leaving the goal active; set status to `blocked`.\nDo not use `blocked` merely because the work is hard, slow, uncertain, incomplete, or would benefit from clarification.\nDo not mark a goal complete merely because its budget is nearly exhausted or because you are stopping work.\nYou cannot use this tool to resume, budget-limit, or usage-limit a goal; those status changes are controlled by the user or system.\nWhen marking a budgeted goal achieved with status `complete`, report the final token usage from the tool result to the user.\n\nexec tool declaration:\n```ts\ndeclare const tools: { update_goal(args: {\n // Required. `paused` requires an explicit user request. Set to `complete` only when the objective is achieved and no required work remains. Set to `blocked` only after the same blocking condition has recurred for at least three consecutive goal turns and the agent is at an impasse. After a previously blocked goal is resumed, the resumed run starts a fresh blocked audit.\n status: \"complete\" | \"blocked\" | \"paused\";\n}): Promise<unknown>; };\n```\n\n### `view_image`\nView a local image file from the filesystem when visual inspection is needed. Use this for images already available on disk.\n\nexec tool declaration:\n```ts\ndeclare const tools: { view_image(args: {\n // Image detail level. Defaults to `high`; use `original` to preserve exact resolution.\n detail?: \"high\" | \"original\";\n // Local filesystem path to an image file.\n path: string;\n}): Promise<{\n // Image detail hint returned by view_image. Returns `high` for default resized behavior or `original` when original resolution is preserved.\n detail: \"high\" | \"original\";\n // Data URL for the loaded image.\n image_url: string;\n}>; };\n```\n\n### `write_stdin`\nWrites characters to an existing unified exec session and returns recent output.\n\nexec tool declaration:\n```ts\ndeclare const tools: { write_stdin(args: {\n // Bytes to write to stdin. Defaults to empty, which polls without writing.\n chars?: string;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Identifier of the running unified exec session.\n session_id: number;\n // Wait before yielding output. Non-empty writes default to 250 ms and cap at 30000 ms; empty polls wait 5000-300000 ms by default.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n## clock\nTools for reading and waiting on time.\n\n### `clock__curr_time`\nReturn the current time in UTC.\n\nexec tool declaration:\n```ts\ndeclare const tools: { clock__curr_time(args: {}): Promise<{\n // Current UTC time formatted as YYYY-MM-DD HH:MM:SS UTC.\n current_time: string;\n}>; };\n```\n\n## image_gen\nTools in the image_gen namespace.\n\n### `image_gen__imagegen`\nThe `image_gen.imagegen` tool enables image generation from descriptions and editing of existing images based on specific instructions. Use it when:\n\n- The user requests an image based on a scene description, such as a diagram, portrait, comic, meme, or any other visual.\n- The user wants to modify an attached or previously generated image with specific changes, including adding or removing elements, altering colors, improving quality/resolution, or transforming the style (e.g., cartoon, oil painting).\n\nGuidelines:\n- imagegen needs a few minutes to finish. In code-mode, use the first-line @exec directive to give the initial call 120 seconds and the same yield for any waits that follow. Once it finishes, return the image with generatedImage(result).\n- Avoid printing the full result or its base64 image data with `text()` or `notify()`; print only small metadata when needed.\n- Set `transparent_background` to true when the request calls for a transparent background, including background removal or a cutout; set it to false otherwise. For edits, preserve existing transparency unless the user asks to change it.\n- Omit both `referenced_image_paths` and `num_last_images_to_include` when generating a brand new image.\n- For edits, use `referenced_image_paths` when every target image has a local file path.\n- If you have not seen a local image yet, use `view_image` to inspect it before editing.\n- Use `num_last_images_to_include` only when at least one target image has no local file path.\n- Set `num_last_images_to_include` to the smallest number of recent conversation images that includes every target image, up to 5.\n- Never provide both `referenced_image_paths` and `num_last_images_to_include`.\n- If neither mechanism can include every target image, ask the user to attach the missing images again.\n- Directly generate the image without reconfirmation or clarification unless required images must be attached again.\n- Always use this tool for image editing unless the user explicitly requests otherwise. Do not use the `python` tool for image editing unless specifically instructed.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { image_gen__imagegen(args: {\n num_last_images_to_include?: number | null;\n prompt: string;\n referenced_image_paths?: Array<string> | null;\n // Whether the output should have a transparent background. Defaults to false.\n transparent_background?: boolean;\n}): Promise<unknown>; };\n```\n\n## web\nTools in the web namespace.\n\n### `web__run`\nTool for accessing the internet.\n\n\n---\n\n## Examples of different commands available in this tool\n\nExamples of different commands available in this tool:\n* `search_query`: {\"search_query\": [{\"q\": \"What is the capital of France?\"}, {\"q\": \"What is the capital of belgium?\"}]}. Searches the internet for a given query (and optionally with a domain or recency filter)\n* `image_query`: {\"image_query\":[{\"q\": \"waterfalls\"}]}.\n* `open`: {\"open\": [{\"ref_id\": \"turn0search0\"}, {\"ref_id\": \"https://www.openai.com\", \"lineno\": 120}]}\n* `click`: {\"click\": [{\"ref_id\": \"turn0fetch3\", \"id\": 17}]}\n* `find`: {\"find\": [{\"ref_id\": \"turn0fetch3\", \"pattern\": \"Annie Case\"}]}\n* `screenshot`: {\"screenshot\": [{\"ref_id\": \"turn1view0\", \"pageno\": 0}, {\"ref_id\": \"turn1view0\", \"pageno\": 3}]}\n* `finance`: {\"finance\":[{\"ticker\":\"AMD\",\"type\":\"equity\",\"market\":\"USA\"}]}, {\"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}]}\n* `weather`: {\"weather\":[{\"location\":\"San Francisco, CA\"}]}\n* `sports`: {\"sports\":[{\"fn\":\"standings\",\"league\":\"nfl\"}, {\"fn\":\"schedule\",\"league\":\"nba\",\"team\":\"GSW\",\"date_from\":\"2025-02-24\"}]}\n* `time`: {\"time\":[{\"utc_offset\":\"+03:00\"}]}\n\n---\n\n## Usage hints\nTo use this tool efficiently:\n* Use multiple commands and queries in one call to get more results faster; e.g. {\"search_query\": [{\"q\": \"bitcoin news\"}], \"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}], \"find\": [{\"ref_id\": \"turn0search0\", \"pattern\": \"Annie Case\"}, {\"ref_id\": \"turn0search1\", \"pattern\": \"John Smith\"}]}\n* Use \"response_length\" to control the number of results returned by this tool, omit it if you intend to pass \"short\" in\n* Only write required parameters; do not write empty lists or nulls where they could be omitted.\n* `search_query` must have length at most 4 in each call. If it has length > 3, response_length must be medium or long\n* If you find yourself in a situation where you accidentally call the `web.run` tool, it's best just to send an empty query: {\"search_query\": [{\"q\": \"\"}]}.\n\n---\n\n## Decision boundary\n\nIf the user makes an explicit request to search the internet, find latest information, look up, etc (or to not do so), you must obey their request.\nWhen you make an assumption, always consider whether it is temporally stable; i.e. whether there's even a small (>10%) chance it has changed. If it is unstable, you must verify with browsing the internet for verification.\n\n<situations_where_you_must_browse_the_internet>\nBelow is a list of scenarios where browsing the internet MUST be used. PAY CLOSE ATTENTION: you MUST browse the internet in these cases. If you're unsure or on the fence, you MUST bias towards browsing the internet.\n- The information could have changed recently: for example news; prices; laws; schedules; product specs; sports scores; economic indicators; political/public/company figures (e.g. the question relates to 'the president of country A' or 'the CEO of company B', which might change over time); rules; regulations; standards; software libraries that could be updated; exchange rates; recommendations (i.e., recommendations about various topics or things might be informed by what currently exists / is popular / is safe / is unsafe / is in the zeitgeist / etc.); and many many many more categories -- again, if you're on the fence, you MUST browse the internet!\n - For news queries, prioritize more recent events, ensuring you compare publish dates and the date that the event happened.\n- The user is seeking recommendations that could lead them to spend substantial time or money -- researching products, restaurants, travel plans, etc.\n- The user wants (or would benefit from) direct quotes, links, or precise source attribution.\n- A specific page, paper, dataset, PDF, or site is referenced and you haven't been given its contents.\n- You're unsure about a fact, the topic is niche or emerging, or you suspect there's at least a 10% chance you will incorrectly recall it\n- High-stakes accuracy matters (medical, legal, financial guidance). For these you generally should search by default because this information is highly temporally unstable\n- The user explicitly says to search, browse, verify, or look it up.\n</situations_where_you_must_browse_the_internet>\n\n---\n\n## Citations\n\nResults from `web.run` include internal reference IDs such as `turn2search5`. Use\nthose reference IDs only in calls to `web.run`; do not expose them in the final\nresponse.\n\nCite sources in the final response using Markdown links:\n\n- Cite a single source as `[descriptive source title](https://example.com/page)`.\n- Cite multiple sources with separate Markdown links, for example\n `[first source](https://example.com/one), [second source](https://example.com/two)`.\n- Link directly to the page that supports the claim. Do not link to search result\n pages or use bare URLs.\n\nFormatting of citations:\n\n- Place each citation as near as possible to the claim it supports, normally at\n the end of the sentence or paragraph and after punctuation.\n- Do not place citations inside code fences.\n- Do not put citations on a line by themselves or collect all citations at the\n end of the response.\n\nIf you browse the internet, cite statements supported by web sources. Each cited\nsource must directly support the associated claim. Prefer primary and\nauthoritative sources, and use sources from different domains when the response\nbenefits from multiple perspectives.\n\n---\n\n## Special cases\nIf these conflict with any other instructions, these should take precedence.\n\n<special_cases>\n- When the user asks for information about how to use OpenAI products, (ChatGPT, the OpenAI API, etc.), you should check the code in local env and only browse as fallback, when you browse restrict your sources to official OpenAI websites using the domains filter, unless otherwise requested.\n- When using search to answer technical questions, you must only rely on primary sources (research papers, official documentation, etc.)\n- Clearly indicate when you are making an inference from sources.\n</special_cases>\n\n---\n\n## Word limits\nResponses may not excessively quote or draw on a specific source. There are several limits here:\n- **Limit on verbatim quotes:**\n - You may not quote more than 25 words verbatim from any single non-lyrical source, unless the source is reddit.\n - For song lyrics, verbatim quotes must be limited to at most 10 words.\n - Long quotes from reddit are allowed, as long as you indicate that those are direct quotes via a markdown blockquote starting with \">\", copy verbatim, and link the source.\n- **Word limits:**\n - Each webpage source in the sources has a word limit label formatted like \"[wordlim N]\", in which N is the maximum number of words in the whole response that are attributed to that source. If omitted, the word limit is 200 words.\n - Non-contiguous words derived from a given source must be counted to the word limit.\n - The summarization limit N is a maximum for each source.\n - When using multiple sources, their summarization limits add together. However, each article used must be relevant to the response.\n- **Copyright compliance:**\n - You must avoid providing full articles, long verbatim passages, or extensive direct quotes due to copyright concerns.\n - If the user asked for a verbatim quote, the response should provide a short compliant excerpt and then answer with paraphrases and summaries.\n - Again, this limit does not apply to reddit content, as long as it's appropriately indicated that those are direct quotes and you link to the source.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { web__run(args: {\n // Open links from previously opened pages.\n click?: Array<{\n // Numbered link id to open.\n id: number;\n // Reference id containing the numbered link.\n ref_id: string;\n}>;\n // Look up prices for the given stock symbols.\n finance?: Array<{\n // ISO 3166-1 alpha-3 country code, \"OTC\", or \"\" for cryptocurrency.\n market?: string;\n // Ticker symbol to look up.\n ticker: string;\n // Asset type to look up.\n type: \"equity\" | \"fund\" | \"crypto\" | \"index\";\n}>;\n // Find text patterns in pages.\n find?: Array<{\n // Text pattern to find.\n pattern: string;\n // Reference id or URL to search within.\n ref_id: string;\n}>;\n // Query the image search engine for a given list of queries.\n image_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Open pages by reference id or URL.\n open?: Array<{\n // Line number to position the page at.\n lineno?: number;\n // Reference id or URL to open.\n ref_id: string;\n}>;\n // Set the length of the response to be returned.\n response_length?: \"short\" | \"medium\" | \"long\";\n // Take screenshots of PDF pages.\n screenshot?: Array<{\n // Zero-indexed PDF page number.\n pageno: number;\n // Reference id or URL to screenshot.\n ref_id: string;\n}>;\n // Query the internet search engine for a given list of queries.\n search_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Look up sports schedules and standings.\n sports?: Array<{\n // Start date in YYYY-MM-DD format.\n date_from?: string;\n // End date in YYYY-MM-DD format.\n date_to?: string;\n // Sports function to call.\n fn: \"schedule\" | \"standings\";\n // League to look up.\n league: \"nba\" | \"wnba\" | \"nfl\" | \"nhl\" | \"mlb\" | \"epl\" | \"ncaamb\" | \"ncaawb\" | \"ipl\";\n // Locale for the lookup.\n locale?: string;\n // Number of games to return.\n num_games?: number;\n // Opponent to use with `team` when narrowing the lookup.\n opponent?: string;\n // Team to look up, using the common 3 or 4 letter alias used in broadcasts.\n team?: string;\n // Tool name for sports requests.\n tool?: \"sports\";\n}>;\n // Get time for the given UTC offsets.\n time?: Array<{\n // UTC offset formatted like \"+03:00\".\n utc_offset: string;\n}>;\n // Look up weather forecasts.\n weather?: Array<{\n // Number of days to return. Defaults to 7.\n duration?: number;\n // Location in \"Country, Area, City\" format.\n location: string;\n // Start date in YYYY-MM-DD format. Defaults to today.\n start?: string;\n}>;\n}): Promise<unknown>; };\n```","format":{"type":"grammar","syntax":"lark","definition":"\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"}}]},{"type":"namespace","name":"clock","description":"Tools for reading and waiting on time.","tools":[{"type":"function","strict":false,"name":"sleep","description":"Pause execution for a specified duration. The sleep ends early when new input arrives for the active turn. Returns the elapsed wall-clock time.","output_schema":null,"parameters":{"type":"object","properties":{"duration_ms":{"type":"number","description":"How long to sleep in milliseconds. Must be between 1 and 43200000."}},"required":["duration_ms"],"additionalProperties":false}}]},{"type":"namespace","name":"collaboration","description":"Tools for spawning and managing sub-agents.","tools":[{"type":"function","strict":false,"name":"followup_task","description":"Send a follow-up task to an existing non-root target agent and trigger a turn if it is idle. If the target is already running, deliver the task promptly at message boundaries while sampling, or after the pending tool call completes.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to send to the target agent.","encrypted":true},"target":{"type":"string","description":"Agent id or canonical task name to send a follow-up task to (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"interrupt_agent","description":"Interrupt an agent's current turn, if any, and return its previous status. The agent remains available for messages and follow-up tasks.","output_schema":null,"parameters":{"type":"object","properties":{"target":{"type":"string","description":"Agent id or canonical task name to interrupt (from spawn_agent)."}},"required":["target"],"additionalProperties":false}},{"type":"function","strict":false,"name":"list_agents","description":"List live agents in the current root thread tree. Optionally filter by task-path prefix.","output_schema":null,"parameters":{"type":"object","properties":{"path_prefix":{"type":"string","description":"Task-path prefix filter without a trailing slash. Omit to list all live agents."}},"additionalProperties":false}},{"type":"function","strict":false,"name":"send_message","description":"Send a message to an existing agent. The message will be delivered promptly. Does not trigger a new turn.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to queue on the target agent.","encrypted":true},"target":{"type":"string","description":"Relative or canonical task name to message (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"spawn_agent","description":"\n Available model overrides (optional; inherited parent model is preferred):\n- `gpt-6.1-sol`: Latest workhorse model for coding and everyday work. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-astra`: Frontier intelligence for the most demanding work. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-sol`: Previous generation workhorse model. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-luna`: Fast and affordable model for easier tasks. Reasoning efforts: low, medium (default), high, xhigh, max. Service tiers: priority.\n- `gpt-5.6-sol`: Older generation workhorse model. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n Spawns an agent to work on the specified task. If your current task is `/root/task1` and you spawn_agent with task_name \"task_3\" the agent will have canonical task name `/root/task1/task_3`.\nYou are then able to refer to this agent as `task_3` or `/root/task1/task_3` interchangeably. However an agent `/root/task2/task_3` would only be able to communicate with this agent via its canonical name `/root/task1/task_3`.\nThe spawned agent will have the same tools as you and the ability to spawn its own subagents.\n\nIt will be able to send you and other running agents messages, and its final answer will be provided to you when it finishes.\nThe new agent's canonical task name will be provided to it along with the message.\n\nNote that passing `fork_turns=\"none\"` will not pass any surrounding context to the spawned subagent, which may cause the agent to lack the context it needs to complete its task, whereas `fork_turns=\"all\"` will provide the subagent with all surrounding context.","output_schema":null,"parameters":{"type":"object","properties":{"fork_turns":{"type":"string","description":"Optional number of turns to fork. Defaults to `all`. Use `none`, `all`, or a positive integer string such as `3` to fork only the most recent turns."},"message":{"type":"string","description":"Initial plain-text task for the new agent.","encrypted":true},"model":{"type":"string","description":"Model override for the new agent. Omit unless an explicit override is needed."},"reasoning_effort":{"type":"string","description":"Reasoning effort override for the new agent. Omit to inherit the parent effort."},"task_name":{"type":"string","description":"Task name for the new agent. Use lowercase letters, digits, and underscores."}},"required":["task_name","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"wait_agent","description":"Wait for a mailbox update from any live agent, including queued messages and final-status notifications. The wait also ends early when new user input is steered into the active turn. Does not return the content; returns either a summary of which agents have updates (if any), an interruption summary for steered input, or a timeout summary if no activity arrives before the deadline.","output_schema":null,"parameters":{"type":"object","properties":{"timeout_ms":{"type":"number","description":"Timeout in milliseconds. Defaults to 30000, min 10000, max 3600000."}},"additionalProperties":false}}]},{"type":"namespace","name":"mcp__cua_repl","description":"UI automation through cua_repl using the initialized cua API.","tools":[{"type":"function","strict":false,"name":"js","description":"Control native apps or browsers on the user’s computer by reading or operating UI. Prefer purpose-built skills, connectors, APIs, or CLIs when available.\n\nOn the first invocation of `cua_repl`, or after resetting it, execute exactly one of the API calls shown below, optionally assigning its result to a variable. Do not add other API calls, waits, or snapshots to that invocation.\nThe tool result will include documentation and, when creating or selecting a tab or selecting an app, its initial UI state. Selecting a browser does not open a tab. Read that result before continuing.\nUse only APIs described in the tool instructions or returned documentation.\n\nWhen you need an inventory of available apps, browsers, and tabs, get a snapshot of all enabled surfaces. Otherwise, use the relevant entry point below:\n\n```javascript\nawait cua.getState();\n```\n\nUse the first matching browser control option from the user's request:\n\nFor a tab @-mention (`mention=tab-v1`):\nPass the complete `plugin://...` URL to get the referenced tab.\n\n```javascript\nlet tab = await cua.getTab({ mention: tabMentionUrl });\n```\n\nFor an existing tab identified by URL in browser context (including the current IAB tab):\n\n```javascript\nlet tab = await cua.getTab({ url }, { browser: browserId });\n```\n\nKnown tab ID (`tabId` or `providerTabId`) and browser (name or browser @-mention):\n\n```javascript\nlet tab = await cua.getTab(tabId, { browser: browserId });\n```\n\nTo open a URL in the in-app browser (`@Browser`):\n\n```javascript\nlet tab = await cua.createBrowserTab(\"iab\", url, { visible: boolean });\n```\n\nTo open a URL in another named browser: pass its name directly; do not call `getBrowser` first.\n\n```javascript\nlet tab = await cua.createBrowserTab(browserName, url, browserOptions);\n```\n\nKnown URL, only when the user has not specified a browser by name or @-mention:\n\n```javascript\nlet browser = await cua.getBrowser({ url });\n```\n\nBrowser IDs and options:\n\n- `\"mcpapps\"`: use `cua.getBrowser({ id: \"mcpapps\" })` for existing full-screen MCP Apps in the task’s side panel.\n- `\"iab\"` (in-app browser): in `createBrowserTab`, use `visible: true` to show the browser; `false` to keep it hidden.\n- `\"dot\"` (Dot): use only when present in browser inventory. It accesses tabs on Dot's active main thread. `cua.getTab(tabId, { browser: \"dot\" })` claims an existing tab; `cua.createBrowserTab(\"dot\", url, { visible: boolean })` creates one with the same visibility options as `\"iab\"`.\n- `\"chrome\"` (@Chrome), `\"edge\"` (@Edge): pass a short, emoji-prefixed `sessionName` (e.g. `\"🔎 Task\"`) to `createBrowserTab` when starting a task.\n\nIf the user specifies an app to use, get the app by name, bundle ID, or path:\n\n```javascript\nlet app = await cua.getApp(\"Example App\");\n```\n\nTo add other content to the tool result, use `nodeRepl.write(value)` for text or other values and `await nodeRepl.emitImage(image)` for images. The APIs listed above already display their documentation or UI state; do not wrap their results in `write` or `emitImage`.\n\nIf your context begins with a summary of an existing computer use task, call `await cua.rewriteDocumentation()` before continuing the computer use task to ensure you have a complete view of the necessary documentation. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{"code":{"type":"string","description":"JavaScript to execute using the initialized cua_repl runtime."},"timeout_ms":{"type":"integer","description":"Optional execution timeout in milliseconds. Defaults to 30000 (30 seconds) when omitted."},"title":{"type":"string","description":"Short user-facing description of what the code does."}},"required":["code"],"additionalProperties":false}},{"type":"function","strict":false,"name":"js_reset","description":"Reset the persistent cua_repl JavaScript session. All JavaScript bindings are discarded. The next cua_repl.js call initializes a fresh runtime for the enabled surfaces. This does not close browser tabs or native apps, or erase their state. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{},"additionalProperties":false}}]}],"tool_choice":"auto","parallel_tool_calls":false,"prompt_cache_key":"01a14530-0099-7142-8981-e5e98a2373b1","prompt_cache_retention":"24h","text":{"format":{"type":"text"},"verbosity":"low"},"top_p":0.98,"top_logprobs":0,"temperature":1.0,"reasoning":{"effort":"low","context":"all_turns","summary":null,"mode":"standard"},"user":null,"usage":null,"tool_usage":{"image_gen":{"input_tokens":0,"output_tokens":0,"total_tokens":0,"input_tokens_details":{"text_tokens":0,"image_tokens":0},"output_tokens_details":{"image_tokens":0,"text_tokens":0}},"web_search":{"num_requests":0}},"safety_identifier":"user-LCV4XMHz3BRmrwLTeTQWC5P7","store":false,"metadata":{},"max_output_tokens":null,"max_tool_calls":null,"service_tier":"auto","truncation":"disabled"}}++event: response.in_progress+data: {"type":"response.in_progress","sequence_number":1,"safety_buffering":false,"response":{"id":"resp_07438c2e31b28b62016ad2395bfc388191a56b110cd48b3292","object":"response","created_at":1792162140,"completed_at":null,"status":"in_progress","background":false,"frequency_penalty":0.0,"presence_penalty":0.0,"moderation":null,"model":"gpt-6.1-sol","access_programs":{"cyber":"standard"},"previous_response_id":null,"instructions":null,"output":[],"error":null,"incomplete_details":null,"tools":[{"type":"namespace","name":"functions","description":"","tools":[{"type":"function","strict":false,"name":"wait","description":"Waits on a yielded `exec` cell and returns new output or completion.\n- Use `wait` only after `exec` returns `Script running with cell ID ...`.\n- `cell_id` identifies the running `exec` cell to resume.\n- `yield_time_ms` controls how long to wait for more output before yielding again. Defaults to 10000 ms.\n- `max_tokens` limits how much new output this wait call returns. Defaults to 10000 tokens.\n- `terminate: true` stops the running cell; false or omitted waits for output.\n- `wait` returns only the new output since the last yield, or the final completion or termination result for that cell.\n- If the cell is still running, `wait` may yield again with the same `cell_id`.\n- If the cell has already finished, `wait` returns the completed result and closes the cell.","output_schema":null,"parameters":{"type":"object","properties":{"cell_id":{"type":"string","description":"Identifier of the running exec cell."},"max_tokens":{"type":"number","description":"Output token budget for this wait call. Defaults to 10000 tokens."},"terminate":{"type":"boolean","description":"True stops the running exec cell; false or omitted waits for output."},"yield_time_ms":{"type":"number","description":"Wait before yielding more output. Defaults to 10000 ms."}},"required":["cell_id"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input","description":"Request user input for one to three short questions and wait for the response. This tool is only available in Plan mode.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"Questions to show the user. Prefer 1 and do not exceed 3","items":{"type":"object","properties":{"header":{"type":"string","description":"Short header label shown in the UI (12 or fewer chars)."},"id":{"type":"string","description":"Stable identifier for mapping answers (snake_case)."},"options":{"type":"array","description":"Provide 2-3 mutually exclusive choices. Put the recommended option first and suffix its label with \"(Recommended)\". Do not include an \"Other\" option in this list; the client will add a free-form \"Other\" option automatically.","items":{"type":"object","properties":{"description":{"type":"string","description":"One short sentence explaining impact/tradeoff if selected."},"label":{"type":"string","description":"User-facing label (1-5 words)."}},"required":["label","description"],"additionalProperties":false}},"question":{"type":"string","description":"Single-sentence prompt shown to the user."}},"required":["id","header","question","options"],"additionalProperties":false}}},"required":["questions"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input_async","description":"Ask the user one or more questions during ongoing work. Use this tool only to request missing information, preferences, constraints, clarification, or approval. The tool returns immediately without ending the turn or waiting for a reply; any reply arrives asynchronously as a new user message. Keep questions concise, self-contained, and easy to understand, using a level of detail appropriate to the user and task. The UI always allows a free-text answer, including when suggested options are provided. A preselected option is not submitted automatically.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"One or more self-contained questions to present together, in display order.","items":{"type":"object","properties":{"options":{"type":"array","description":"Suggested answers, in display order. Put the recommended answer first; the first option is preselected by default. The user can select one option or enter a free-text answer. Do not include an Other option or a free-text placeholder; the UI provides free-text input automatically. Omit options for a free-text-only question.","items":{"type":"string"},"minItems":1},"title":{"type":"string","description":"The complete question shown to the user, including any context needed to answer it."}},"required":["title"],"additionalProperties":false},"minItems":1}},"required":["questions"],"additionalProperties":false}},{"type":"custom","name":"exec","description":"Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\nShared MCP Types:\n```ts\ntype Role = \"user\" | \"assistant\";\ntype MetaObject = Record<string, unknown>;\ntype Annotations = {\n audience?: Role[];\n priority?: number;\n lastModified?: string;\n};\ntype Icon = {\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n};\ntype TextResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n text: string;\n};\ntype BlobResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n blob: string;\n};\ntype TextContent = {\n type: \"text\";\n text: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ImageContent = {\n type: \"image\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype AudioContent = {\n type: \"audio\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ResourceLink = {\n icons?: Icon[];\n name: string;\n title?: string;\n uri: string;\n description?: string;\n mimeType?: string;\n annotations?: Annotations;\n size?: number;\n _meta?: MetaObject;\n type: \"resource_link\";\n};\ntype EmbeddedResource = {\n type: \"resource\";\n resource: TextResourceContents | BlobResourceContents;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ContentBlock =\n | TextContent\n | ImageContent\n | AudioContent\n | ResourceLink\n | EmbeddedResource;\ntype CallToolResult<TStructured = { [key: string]: unknown }> = {\n _meta?: MetaObject;\n content: ContentBlock[];\n isError?: boolean;\n structuredContent?: TStructured;\n [key: string]: unknown;\n};\n```\n\n### `apply_patch`\nThe `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.\n\nexec tool declaration:\n```ts\ndeclare const tools: { apply_patch(input: string): Promise<unknown>; };\n```\n\n### `create_goal`\nCreate a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks.\nSet token_budget only when an explicit token budget is requested. Fails if an unfinished goal exists; use update_goal only for status.\n\nexec tool declaration:\n```ts\ndeclare const tools: { create_goal(args: {\n // Required. The concrete objective to start pursuing. This starts a new active goal when no goal exists or replaces the current goal when it is complete.\n objective: string;\n // Positive token budget for the new goal. Omit unless explicitly requested.\n token_budget?: number;\n}): Promise<unknown>; };\n```\n\n### `exec_command`\nRuns a command in a PTY, returning output or a session ID for ongoing interaction.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n // Shell command to execute.\n cmd: string;\n // User-facing approval question for `require_escalated`; omit otherwise.\n justification?: string;\n // True runs the shell with -l/-i semantics; false disables them. Defaults to true.\n login?: boolean;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Reusable approval prefix for `cmd`, only with `sandbox_permissions: \"require_escalated\"`; for example [\"git\", \"pull\"].\n prefix_rule?: Array<string>;\n // Per-command sandbox override. Defaults to `use_default`; use `require_escalated` for unsandboxed execution.\n sandbox_permissions?: \"use_default\" | \"require_escalated\";\n // Shell binary to launch. Defaults to the user's default shell.\n shell?: string;\n // True allocates a PTY for the command; false or omitted uses plain pipes.\n tty?: boolean;\n // Working directory for the command. Defaults to the turn cwd.\n workdir?: string;\n // Wait before yielding output. Defaults to 10000 ms; effective range is 250-30000 ms.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n### `get_goal`\nGet the current goal for this thread, including status, budgets, token and elapsed-time usage, and remaining token budget.\n\nexec tool declaration:\n```ts\ndeclare const tools: { get_goal(args: {}): Promise<unknown>; };\n```\n\n### `list_mcp_resource_templates`\nLists resource templates provided by MCP servers. Parameterized resource templates allow servers to share data that takes parameters and provides context to language models, such as files, database schemas, or application-specific information. Prefer resource templates over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resource_templates(args: {\n // Opaque cursor from a previous list_mcp_resource_templates call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resource templates from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `list_mcp_resources`\nLists resources provided by MCP servers. Resources allow servers to share data that provides context to language models, such as files, database schemas, or application-specific information. Prefer resources over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resources(args: {\n // Opaque cursor from a previous list_mcp_resources call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resources from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `read_mcp_resource`\nRead a specific resource from an MCP server given the server name and resource URI.\n\nexec tool declaration:\n```ts\ndeclare const tools: { read_mcp_resource(args: {\n // MCP server name exactly as configured. Must match the 'server' field returned by list_mcp_resources.\n server: string;\n // Resource URI to read. Must be one of the URIs returned by list_mcp_resources.\n uri: string;\n}): Promise<unknown>; };\n```\n\n### `request_plugin_install`\n# Suggest a recommended plugin installation\n\nUse this tool only when all of the following are true:\n- The user explicitly asks to use a specific plugin that is not already available in the current context or active `tools` list.\n- Tool search has already been exhausted and did not find or make the requested tool callable.\n- The plugin is listed in `<recommended_plugins>`.\n\nDo not use it for adjacent capabilities, broad recommendations, or plugins that merely seem useful. Briefly explain why the plugin can help with the current request in `suggest_reason`.\n\nIMPORTANT: DO NOT call this tool in parallel with other tools.\n\nexec tool declaration:\n```ts\ndeclare const tools: { request_plugin_install(args: {\n // The parenthesized plugin ID from the `<recommended_plugins>` list.\n plugin_id: string;\n // Concise one-line user-facing reason why this plugin can help with the current request.\n suggest_reason: string;\n}): Promise<unknown>; };\n```\n\n### `update_goal`\nUpdate the existing goal.\nSet status to `paused` only at the user's explicit request to pause this goal, never on your own initiative. Ask if unclear; a later resume revokes that request. Report the returned status and stop goal work. Budget limits take precedence over pausing.\nSet status to `complete` only when the objective has actually been achieved and no required work remains.\nSet status to `blocked` only when the same blocking condition has repeated for at least three consecutive goal turns, counting the original/user-triggered turn and any automatic continuations, and the agent cannot make meaningful progress without user input or an external-state change.\nIf the user resumes a goal that was previously marked `blocked`, treat the resumed run as a fresh blocked audit. If the same blocking condition then repeats for at least three consecutive resumed goal turns, set status to `blocked` again.\nOnce the blocked threshold is satisfied, do not keep reporting that you are still blocked while leaving the goal active; set status to `blocked`.\nDo not use `blocked` merely because the work is hard, slow, uncertain, incomplete, or would benefit from clarification.\nDo not mark a goal complete merely because its budget is nearly exhausted or because you are stopping work.\nYou cannot use this tool to resume, budget-limit, or usage-limit a goal; those status changes are controlled by the user or system.\nWhen marking a budgeted goal achieved with status `complete`, report the final token usage from the tool result to the user.\n\nexec tool declaration:\n```ts\ndeclare const tools: { update_goal(args: {\n // Required. `paused` requires an explicit user request. Set to `complete` only when the objective is achieved and no required work remains. Set to `blocked` only after the same blocking condition has recurred for at least three consecutive goal turns and the agent is at an impasse. After a previously blocked goal is resumed, the resumed run starts a fresh blocked audit.\n status: \"complete\" | \"blocked\" | \"paused\";\n}): Promise<unknown>; };\n```\n\n### `view_image`\nView a local image file from the filesystem when visual inspection is needed. Use this for images already available on disk.\n\nexec tool declaration:\n```ts\ndeclare const tools: { view_image(args: {\n // Image detail level. Defaults to `high`; use `original` to preserve exact resolution.\n detail?: \"high\" | \"original\";\n // Local filesystem path to an image file.\n path: string;\n}): Promise<{\n // Image detail hint returned by view_image. Returns `high` for default resized behavior or `original` when original resolution is preserved.\n detail: \"high\" | \"original\";\n // Data URL for the loaded image.\n image_url: string;\n}>; };\n```\n\n### `write_stdin`\nWrites characters to an existing unified exec session and returns recent output.\n\nexec tool declaration:\n```ts\ndeclare const tools: { write_stdin(args: {\n // Bytes to write to stdin. Defaults to empty, which polls without writing.\n chars?: string;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Identifier of the running unified exec session.\n session_id: number;\n // Wait before yielding output. Non-empty writes default to 250 ms and cap at 30000 ms; empty polls wait 5000-300000 ms by default.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n## clock\nTools for reading and waiting on time.\n\n### `clock__curr_time`\nReturn the current time in UTC.\n\nexec tool declaration:\n```ts\ndeclare const tools: { clock__curr_time(args: {}): Promise<{\n // Current UTC time formatted as YYYY-MM-DD HH:MM:SS UTC.\n current_time: string;\n}>; };\n```\n\n## image_gen\nTools in the image_gen namespace.\n\n### `image_gen__imagegen`\nThe `image_gen.imagegen` tool enables image generation from descriptions and editing of existing images based on specific instructions. Use it when:\n\n- The user requests an image based on a scene description, such as a diagram, portrait, comic, meme, or any other visual.\n- The user wants to modify an attached or previously generated image with specific changes, including adding or removing elements, altering colors, improving quality/resolution, or transforming the style (e.g., cartoon, oil painting).\n\nGuidelines:\n- imagegen needs a few minutes to finish. In code-mode, use the first-line @exec directive to give the initial call 120 seconds and the same yield for any waits that follow. Once it finishes, return the image with generatedImage(result).\n- Avoid printing the full result or its base64 image data with `text()` or `notify()`; print only small metadata when needed.\n- Set `transparent_background` to true when the request calls for a transparent background, including background removal or a cutout; set it to false otherwise. For edits, preserve existing transparency unless the user asks to change it.\n- Omit both `referenced_image_paths` and `num_last_images_to_include` when generating a brand new image.\n- For edits, use `referenced_image_paths` when every target image has a local file path.\n- If you have not seen a local image yet, use `view_image` to inspect it before editing.\n- Use `num_last_images_to_include` only when at least one target image has no local file path.\n- Set `num_last_images_to_include` to the smallest number of recent conversation images that includes every target image, up to 5.\n- Never provide both `referenced_image_paths` and `num_last_images_to_include`.\n- If neither mechanism can include every target image, ask the user to attach the missing images again.\n- Directly generate the image without reconfirmation or clarification unless required images must be attached again.\n- Always use this tool for image editing unless the user explicitly requests otherwise. Do not use the `python` tool for image editing unless specifically instructed.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { image_gen__imagegen(args: {\n num_last_images_to_include?: number | null;\n prompt: string;\n referenced_image_paths?: Array<string> | null;\n // Whether the output should have a transparent background. Defaults to false.\n transparent_background?: boolean;\n}): Promise<unknown>; };\n```\n\n## web\nTools in the web namespace.\n\n### `web__run`\nTool for accessing the internet.\n\n\n---\n\n## Examples of different commands available in this tool\n\nExamples of different commands available in this tool:\n* `search_query`: {\"search_query\": [{\"q\": \"What is the capital of France?\"}, {\"q\": \"What is the capital of belgium?\"}]}. Searches the internet for a given query (and optionally with a domain or recency filter)\n* `image_query`: {\"image_query\":[{\"q\": \"waterfalls\"}]}.\n* `open`: {\"open\": [{\"ref_id\": \"turn0search0\"}, {\"ref_id\": \"https://www.openai.com\", \"lineno\": 120}]}\n* `click`: {\"click\": [{\"ref_id\": \"turn0fetch3\", \"id\": 17}]}\n* `find`: {\"find\": [{\"ref_id\": \"turn0fetch3\", \"pattern\": \"Annie Case\"}]}\n* `screenshot`: {\"screenshot\": [{\"ref_id\": \"turn1view0\", \"pageno\": 0}, {\"ref_id\": \"turn1view0\", \"pageno\": 3}]}\n* `finance`: {\"finance\":[{\"ticker\":\"AMD\",\"type\":\"equity\",\"market\":\"USA\"}]}, {\"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}]}\n* `weather`: {\"weather\":[{\"location\":\"San Francisco, CA\"}]}\n* `sports`: {\"sports\":[{\"fn\":\"standings\",\"league\":\"nfl\"}, {\"fn\":\"schedule\",\"league\":\"nba\",\"team\":\"GSW\",\"date_from\":\"2025-02-24\"}]}\n* `time`: {\"time\":[{\"utc_offset\":\"+03:00\"}]}\n\n---\n\n## Usage hints\nTo use this tool efficiently:\n* Use multiple commands and queries in one call to get more results faster; e.g. {\"search_query\": [{\"q\": \"bitcoin news\"}], \"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}], \"find\": [{\"ref_id\": \"turn0search0\", \"pattern\": \"Annie Case\"}, {\"ref_id\": \"turn0search1\", \"pattern\": \"John Smith\"}]}\n* Use \"response_length\" to control the number of results returned by this tool, omit it if you intend to pass \"short\" in\n* Only write required parameters; do not write empty lists or nulls where they could be omitted.\n* `search_query` must have length at most 4 in each call. If it has length > 3, response_length must be medium or long\n* If you find yourself in a situation where you accidentally call the `web.run` tool, it's best just to send an empty query: {\"search_query\": [{\"q\": \"\"}]}.\n\n---\n\n## Decision boundary\n\nIf the user makes an explicit request to search the internet, find latest information, look up, etc (or to not do so), you must obey their request.\nWhen you make an assumption, always consider whether it is temporally stable; i.e. whether there's even a small (>10%) chance it has changed. If it is unstable, you must verify with browsing the internet for verification.\n\n<situations_where_you_must_browse_the_internet>\nBelow is a list of scenarios where browsing the internet MUST be used. PAY CLOSE ATTENTION: you MUST browse the internet in these cases. If you're unsure or on the fence, you MUST bias towards browsing the internet.\n- The information could have changed recently: for example news; prices; laws; schedules; product specs; sports scores; economic indicators; political/public/company figures (e.g. the question relates to 'the president of country A' or 'the CEO of company B', which might change over time); rules; regulations; standards; software libraries that could be updated; exchange rates; recommendations (i.e., recommendations about various topics or things might be informed by what currently exists / is popular / is safe / is unsafe / is in the zeitgeist / etc.); and many many many more categories -- again, if you're on the fence, you MUST browse the internet!\n - For news queries, prioritize more recent events, ensuring you compare publish dates and the date that the event happened.\n- The user is seeking recommendations that could lead them to spend substantial time or money -- researching products, restaurants, travel plans, etc.\n- The user wants (or would benefit from) direct quotes, links, or precise source attribution.\n- A specific page, paper, dataset, PDF, or site is referenced and you haven't been given its contents.\n- You're unsure about a fact, the topic is niche or emerging, or you suspect there's at least a 10% chance you will incorrectly recall it\n- High-stakes accuracy matters (medical, legal, financial guidance). For these you generally should search by default because this information is highly temporally unstable\n- The user explicitly says to search, browse, verify, or look it up.\n</situations_where_you_must_browse_the_internet>\n\n---\n\n## Citations\n\nResults from `web.run` include internal reference IDs such as `turn2search5`. Use\nthose reference IDs only in calls to `web.run`; do not expose them in the final\nresponse.\n\nCite sources in the final response using Markdown links:\n\n- Cite a single source as `[descriptive source title](https://example.com/page)`.\n- Cite multiple sources with separate Markdown links, for example\n `[first source](https://example.com/one), [second source](https://example.com/two)`.\n- Link directly to the page that supports the claim. Do not link to search result\n pages or use bare URLs.\n\nFormatting of citations:\n\n- Place each citation as near as possible to the claim it supports, normally at\n the end of the sentence or paragraph and after punctuation.\n- Do not place citations inside code fences.\n- Do not put citations on a line by themselves or collect all citations at the\n end of the response.\n\nIf you browse the internet, cite statements supported by web sources. Each cited\nsource must directly support the associated claim. Prefer primary and\nauthoritative sources, and use sources from different domains when the response\nbenefits from multiple perspectives.\n\n---\n\n## Special cases\nIf these conflict with any other instructions, these should take precedence.\n\n<special_cases>\n- When the user asks for information about how to use OpenAI products, (ChatGPT, the OpenAI API, etc.), you should check the code in local env and only browse as fallback, when you browse restrict your sources to official OpenAI websites using the domains filter, unless otherwise requested.\n- When using search to answer technical questions, you must only rely on primary sources (research papers, official documentation, etc.)\n- Clearly indicate when you are making an inference from sources.\n</special_cases>\n\n---\n\n## Word limits\nResponses may not excessively quote or draw on a specific source. There are several limits here:\n- **Limit on verbatim quotes:**\n - You may not quote more than 25 words verbatim from any single non-lyrical source, unless the source is reddit.\n - For song lyrics, verbatim quotes must be limited to at most 10 words.\n - Long quotes from reddit are allowed, as long as you indicate that those are direct quotes via a markdown blockquote starting with \">\", copy verbatim, and link the source.\n- **Word limits:**\n - Each webpage source in the sources has a word limit label formatted like \"[wordlim N]\", in which N is the maximum number of words in the whole response that are attributed to that source. If omitted, the word limit is 200 words.\n - Non-contiguous words derived from a given source must be counted to the word limit.\n - The summarization limit N is a maximum for each source.\n - When using multiple sources, their summarization limits add together. However, each article used must be relevant to the response.\n- **Copyright compliance:**\n - You must avoid providing full articles, long verbatim passages, or extensive direct quotes due to copyright concerns.\n - If the user asked for a verbatim quote, the response should provide a short compliant excerpt and then answer with paraphrases and summaries.\n - Again, this limit does not apply to reddit content, as long as it's appropriately indicated that those are direct quotes and you link to the source.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { web__run(args: {\n // Open links from previously opened pages.\n click?: Array<{\n // Numbered link id to open.\n id: number;\n // Reference id containing the numbered link.\n ref_id: string;\n}>;\n // Look up prices for the given stock symbols.\n finance?: Array<{\n // ISO 3166-1 alpha-3 country code, \"OTC\", or \"\" for cryptocurrency.\n market?: string;\n // Ticker symbol to look up.\n ticker: string;\n // Asset type to look up.\n type: \"equity\" | \"fund\" | \"crypto\" | \"index\";\n}>;\n // Find text patterns in pages.\n find?: Array<{\n // Text pattern to find.\n pattern: string;\n // Reference id or URL to search within.\n ref_id: string;\n}>;\n // Query the image search engine for a given list of queries.\n image_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Open pages by reference id or URL.\n open?: Array<{\n // Line number to position the page at.\n lineno?: number;\n // Reference id or URL to open.\n ref_id: string;\n}>;\n // Set the length of the response to be returned.\n response_length?: \"short\" | \"medium\" | \"long\";\n // Take screenshots of PDF pages.\n screenshot?: Array<{\n // Zero-indexed PDF page number.\n pageno: number;\n // Reference id or URL to screenshot.\n ref_id: string;\n}>;\n // Query the internet search engine for a given list of queries.\n search_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Look up sports schedules and standings.\n sports?: Array<{\n // Start date in YYYY-MM-DD format.\n date_from?: string;\n // End date in YYYY-MM-DD format.\n date_to?: string;\n // Sports function to call.\n fn: \"schedule\" | \"standings\";\n // League to look up.\n league: \"nba\" | \"wnba\" | \"nfl\" | \"nhl\" | \"mlb\" | \"epl\" | \"ncaamb\" | \"ncaawb\" | \"ipl\";\n // Locale for the lookup.\n locale?: string;\n // Number of games to return.\n num_games?: number;\n // Opponent to use with `team` when narrowing the lookup.\n opponent?: string;\n // Team to look up, using the common 3 or 4 letter alias used in broadcasts.\n team?: string;\n // Tool name for sports requests.\n tool?: \"sports\";\n}>;\n // Get time for the given UTC offsets.\n time?: Array<{\n // UTC offset formatted like \"+03:00\".\n utc_offset: string;\n}>;\n // Look up weather forecasts.\n weather?: Array<{\n // Number of days to return. Defaults to 7.\n duration?: number;\n // Location in \"Country, Area, City\" format.\n location: string;\n // Start date in YYYY-MM-DD format. Defaults to today.\n start?: string;\n}>;\n}): Promise<unknown>; };\n```","format":{"type":"grammar","syntax":"lark","definition":"\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"}}]},{"type":"namespace","name":"clock","description":"Tools for reading and waiting on time.","tools":[{"type":"function","strict":false,"name":"sleep","description":"Pause execution for a specified duration. The sleep ends early when new input arrives for the active turn. Returns the elapsed wall-clock time.","output_schema":null,"parameters":{"type":"object","properties":{"duration_ms":{"type":"number","description":"How long to sleep in milliseconds. Must be between 1 and 43200000."}},"required":["duration_ms"],"additionalProperties":false}}]},{"type":"namespace","name":"collaboration","description":"Tools for spawning and managing sub-agents.","tools":[{"type":"function","strict":false,"name":"followup_task","description":"Send a follow-up task to an existing non-root target agent and trigger a turn if it is idle. If the target is already running, deliver the task promptly at message boundaries while sampling, or after the pending tool call completes.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to send to the target agent.","encrypted":true},"target":{"type":"string","description":"Agent id or canonical task name to send a follow-up task to (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"interrupt_agent","description":"Interrupt an agent's current turn, if any, and return its previous status. The agent remains available for messages and follow-up tasks.","output_schema":null,"parameters":{"type":"object","properties":{"target":{"type":"string","description":"Agent id or canonical task name to interrupt (from spawn_agent)."}},"required":["target"],"additionalProperties":false}},{"type":"function","strict":false,"name":"list_agents","description":"List live agents in the current root thread tree. Optionally filter by task-path prefix.","output_schema":null,"parameters":{"type":"object","properties":{"path_prefix":{"type":"string","description":"Task-path prefix filter without a trailing slash. Omit to list all live agents."}},"additionalProperties":false}},{"type":"function","strict":false,"name":"send_message","description":"Send a message to an existing agent. The message will be delivered promptly. Does not trigger a new turn.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to queue on the target agent.","encrypted":true},"target":{"type":"string","description":"Relative or canonical task name to message (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"spawn_agent","description":"\n Available model overrides (optional; inherited parent model is preferred):\n- `gpt-6.1-sol`: Latest workhorse model for coding and everyday work. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-astra`: Frontier intelligence for the most demanding work. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-sol`: Previous generation workhorse model. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-luna`: Fast and affordable model for easier tasks. Reasoning efforts: low, medium (default), high, xhigh, max. Service tiers: priority.\n- `gpt-5.6-sol`: Older generation workhorse model. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n Spawns an agent to work on the specified task. If your current task is `/root/task1` and you spawn_agent with task_name \"task_3\" the agent will have canonical task name `/root/task1/task_3`.\nYou are then able to refer to this agent as `task_3` or `/root/task1/task_3` interchangeably. However an agent `/root/task2/task_3` would only be able to communicate with this agent via its canonical name `/root/task1/task_3`.\nThe spawned agent will have the same tools as you and the ability to spawn its own subagents.\n\nIt will be able to send you and other running agents messages, and its final answer will be provided to you when it finishes.\nThe new agent's canonical task name will be provided to it along with the message.\n\nNote that passing `fork_turns=\"none\"` will not pass any surrounding context to the spawned subagent, which may cause the agent to lack the context it needs to complete its task, whereas `fork_turns=\"all\"` will provide the subagent with all surrounding context.","output_schema":null,"parameters":{"type":"object","properties":{"fork_turns":{"type":"string","description":"Optional number of turns to fork. Defaults to `all`. Use `none`, `all`, or a positive integer string such as `3` to fork only the most recent turns."},"message":{"type":"string","description":"Initial plain-text task for the new agent.","encrypted":true},"model":{"type":"string","description":"Model override for the new agent. Omit unless an explicit override is needed."},"reasoning_effort":{"type":"string","description":"Reasoning effort override for the new agent. Omit to inherit the parent effort."},"task_name":{"type":"string","description":"Task name for the new agent. Use lowercase letters, digits, and underscores."}},"required":["task_name","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"wait_agent","description":"Wait for a mailbox update from any live agent, including queued messages and final-status notifications. The wait also ends early when new user input is steered into the active turn. Does not return the content; returns either a summary of which agents have updates (if any), an interruption summary for steered input, or a timeout summary if no activity arrives before the deadline.","output_schema":null,"parameters":{"type":"object","properties":{"timeout_ms":{"type":"number","description":"Timeout in milliseconds. Defaults to 30000, min 10000, max 3600000."}},"additionalProperties":false}}]},{"type":"namespace","name":"mcp__cua_repl","description":"UI automation through cua_repl using the initialized cua API.","tools":[{"type":"function","strict":false,"name":"js","description":"Control native apps or browsers on the user’s computer by reading or operating UI. Prefer purpose-built skills, connectors, APIs, or CLIs when available.\n\nOn the first invocation of `cua_repl`, or after resetting it, execute exactly one of the API calls shown below, optionally assigning its result to a variable. Do not add other API calls, waits, or snapshots to that invocation.\nThe tool result will include documentation and, when creating or selecting a tab or selecting an app, its initial UI state. Selecting a browser does not open a tab. Read that result before continuing.\nUse only APIs described in the tool instructions or returned documentation.\n\nWhen you need an inventory of available apps, browsers, and tabs, get a snapshot of all enabled surfaces. Otherwise, use the relevant entry point below:\n\n```javascript\nawait cua.getState();\n```\n\nUse the first matching browser control option from the user's request:\n\nFor a tab @-mention (`mention=tab-v1`):\nPass the complete `plugin://...` URL to get the referenced tab.\n\n```javascript\nlet tab = await cua.getTab({ mention: tabMentionUrl });\n```\n\nFor an existing tab identified by URL in browser context (including the current IAB tab):\n\n```javascript\nlet tab = await cua.getTab({ url }, { browser: browserId });\n```\n\nKnown tab ID (`tabId` or `providerTabId`) and browser (name or browser @-mention):\n\n```javascript\nlet tab = await cua.getTab(tabId, { browser: browserId });\n```\n\nTo open a URL in the in-app browser (`@Browser`):\n\n```javascript\nlet tab = await cua.createBrowserTab(\"iab\", url, { visible: boolean });\n```\n\nTo open a URL in another named browser: pass its name directly; do not call `getBrowser` first.\n\n```javascript\nlet tab = await cua.createBrowserTab(browserName, url, browserOptions);\n```\n\nKnown URL, only when the user has not specified a browser by name or @-mention:\n\n```javascript\nlet browser = await cua.getBrowser({ url });\n```\n\nBrowser IDs and options:\n\n- `\"mcpapps\"`: use `cua.getBrowser({ id: \"mcpapps\" })` for existing full-screen MCP Apps in the task’s side panel.\n- `\"iab\"` (in-app browser): in `createBrowserTab`, use `visible: true` to show the browser; `false` to keep it hidden.\n- `\"dot\"` (Dot): use only when present in browser inventory. It accesses tabs on Dot's active main thread. `cua.getTab(tabId, { browser: \"dot\" })` claims an existing tab; `cua.createBrowserTab(\"dot\", url, { visible: boolean })` creates one with the same visibility options as `\"iab\"`.\n- `\"chrome\"` (@Chrome), `\"edge\"` (@Edge): pass a short, emoji-prefixed `sessionName` (e.g. `\"🔎 Task\"`) to `createBrowserTab` when starting a task.\n\nIf the user specifies an app to use, get the app by name, bundle ID, or path:\n\n```javascript\nlet app = await cua.getApp(\"Example App\");\n```\n\nTo add other content to the tool result, use `nodeRepl.write(value)` for text or other values and `await nodeRepl.emitImage(image)` for images. The APIs listed above already display their documentation or UI state; do not wrap their results in `write` or `emitImage`.\n\nIf your context begins with a summary of an existing computer use task, call `await cua.rewriteDocumentation()` before continuing the computer use task to ensure you have a complete view of the necessary documentation. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{"code":{"type":"string","description":"JavaScript to execute using the initialized cua_repl runtime."},"timeout_ms":{"type":"integer","description":"Optional execution timeout in milliseconds. Defaults to 30000 (30 seconds) when omitted."},"title":{"type":"string","description":"Short user-facing description of what the code does."}},"required":["code"],"additionalProperties":false}},{"type":"function","strict":false,"name":"js_reset","description":"Reset the persistent cua_repl JavaScript session. All JavaScript bindings are discarded. The next cua_repl.js call initializes a fresh runtime for the enabled surfaces. This does not close browser tabs or native apps, or erase their state. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{},"additionalProperties":false}}]}],"tool_choice":"auto","parallel_tool_calls":false,"prompt_cache_key":"01a14530-0099-7142-8981-e5e98a2373b1","prompt_cache_retention":"24h","text":{"format":{"type":"text"},"verbosity":"low"},"top_p":0.98,"top_logprobs":0,"temperature":1.0,"reasoning":{"effort":"low","context":"all_turns","summary":null,"mode":"standard"},"user":null,"usage":null,"tool_usage":{"image_gen":{"input_tokens":0,"output_tokens":0,"total_tokens":0,"input_tokens_details":{"text_tokens":0,"image_tokens":0},"output_tokens_details":{"image_tokens":0,"text_tokens":0}},"web_search":{"num_requests":0}},"safety_identifier":"user-LCV4XMHz3BRmrwLTeTQWC5P7","store":false,"metadata":{},"max_output_tokens":null,"max_tool_calls":null,"service_tier":"auto","truncation":"disabled"}}++event: response.output_item.added+data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"type":"message","id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","metadata":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"internal_chat_message_metadata_passthrough":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"role":"assistant","status":"in_progress","content":[],"phase":"commentary"}}++event: response.content_part.added+data: {"type":"response.content_part.added","sequence_number":3,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"part":{"type":"output_text","text":"","annotations":[],"logprobs":[]}}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":4,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":"I","logprobs":[],"safety_buffering":false,"obfuscation":"XaSqRA7pkLNwCNu"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":5,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":"’ll","logprobs":[],"safety_buffering":false,"obfuscation":"xcICABSFVhTiJ"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":6,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" read","logprobs":[],"safety_buffering":false,"obfuscation":"FIYhlQP40Gp"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":7,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" both","logprobs":[],"safety_buffering":false,"obfuscation":"SBuhqaKnf9u"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":8,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" files","logprobs":[],"safety_buffering":false,"obfuscation":"ijp8mtrvdT"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":9,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" in","logprobs":[],"safety_buffering":false,"obfuscation":"Ld3fpgrE2V7sY"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":10,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" parallel","logprobs":[],"safety_buffering":false,"obfuscation":"JDJ01pu"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":11,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":",","logprobs":[],"safety_buffering":false,"obfuscation":"uyq3G0i6S5plun4"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":12,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" count","logprobs":[],"safety_buffering":false,"obfuscation":"athc1aunjy"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":13,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" their","logprobs":[],"safety_buffering":false,"obfuscation":"T4aYfmkUYM"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":14,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" lines","logprobs":[],"safety_buffering":false,"obfuscation":"KMNDVlGejq"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":15,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":",","logprobs":[],"safety_buffering":false,"obfuscation":"klj5iY9FgmfnHFb"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":16,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" then","logprobs":[],"safety_buffering":false,"obfuscation":"JdFOcf8P4sS"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":17,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" try","logprobs":[],"safety_buffering":false,"obfuscation":"n1fCUZZeStVY"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":18,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":" `","logprobs":[],"safety_buffering":false,"obfuscation":"yDUaJ62MCc4Q1Y"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":19,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":"missing","logprobs":[],"safety_buffering":false,"obfuscation":"TA9zNetLk"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":20,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":".txt","logprobs":[],"safety_buffering":false,"obfuscation":"Zcqj8T9Sd8Az"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":21,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"delta":"`.","logprobs":[],"safety_buffering":false,"obfuscation":"sVH9n9EILMCgYV"}++event: response.output_text.done+data: {"type":"response.output_text.done","sequence_number":22,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"text":"I’ll read both files in parallel, count their lines, then try `missing.txt`.","logprobs":[]}++event: response.content_part.done+data: {"type":"response.content_part.done","sequence_number":23,"item_id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","output_index":0,"content_index":0,"part":{"type":"output_text","text":"I’ll read both files in parallel, count their lines, then try `missing.txt`.","annotations":[],"logprobs":[]}}++event: response.output_item.done+data: {"type":"response.output_item.done","sequence_number":24,"output_index":0,"item":{"type":"message","id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","metadata":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"internal_chat_message_metadata_passthrough":{"create_time":1792162141.5549767,"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"role":"assistant","status":"completed","content":[{"type":"output_text","text":"I’ll read both files in parallel, count their lines, then try `missing.txt`.","annotations":[],"logprobs":[]}],"phase":"commentary"}}++event: response.output_item.added+data: {"type":"response.output_item.added","sequence_number":25,"output_index":1,"item":{"type":"custom_tool_call","id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","metadata":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"internal_chat_message_metadata_passthrough":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"call_id":"call_c0d07fd9ccd84fe29372c0e72ed12869","name":"exec","input":"","status":"in_progress"}}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":26,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"const","obfuscation":"aukMLlG4iy0"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":27,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" results","obfuscation":"PhdP903d"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":28,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" =","obfuscation":"EYw45jnGf38dBp"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":29,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" await","obfuscation":"3UukhQ9b5E"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":30,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" Promise","obfuscation":"LJ1KVA4r"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":31,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".all","obfuscation":"c3ocIprdyEkr"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":32,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"Sett","obfuscation":"WJbNsF5vXusW"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":33,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"led","obfuscation":"W3l7LNJCR70PI"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":34,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"([\n","obfuscation":"tvlZJkCTqz42q"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":35,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" ","obfuscation":"QwqFMZSf3APoqoj"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":36,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" tools","obfuscation":"WVMEzK8N0j"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":37,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".exec","obfuscation":"Y85oKHOmCNv"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":38,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"_command","obfuscation":"Mrehsozh"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":39,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"({","obfuscation":"DWNEiSYSZjQydP"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":40,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"cmd","obfuscation":"Z2HRs4ZurGP9H"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":41,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":":\"","obfuscation":"9IfB9ta7yk7Oov"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":42,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"cat","obfuscation":"3Zm51dKC5vBPM"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":43,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" README","obfuscation":"Glf26yzbE"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":44,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".md","obfuscation":"A1NkJEhSH6JMN"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":45,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":";","obfuscation":"i36QJRuw9jlILji"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":46,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" wc","obfuscation":"H06QVDaWiefLJ"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":47,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" -","obfuscation":"vl6iBwLoEiquwq"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":48,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"l","obfuscation":"t0GPEJ1mFZvYgvI"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":49,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" README","obfuscation":"1d1RFrYxC"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":50,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".md","obfuscation":"Gbrc5S2UlxvSC"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":51,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"\",","obfuscation":"FsOcQDIaNp1LhI"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":52,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"max","obfuscation":"JTdYeSfv1loC6"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":53,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"_output","obfuscation":"TFNJLXriy"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":54,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"_tokens","obfuscation":"qNiKlXDWB"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":55,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":":","obfuscation":"NIhFgihnaK9IURA"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":56,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"300","obfuscation":"2cDtrToHw4Wio"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":57,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"0","obfuscation":"OPk0Vsw1AvnNSNO"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":58,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"}),\n","obfuscation":"15ZvlGA65F2P"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":59,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" ","obfuscation":"J7pBAXubhjhFjK0"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":60,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" tools","obfuscation":"fs7Sg23an2"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":61,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".exec","obfuscation":"AY6pRrQQnX6"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":62,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"_command","obfuscation":"UNewowmw"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":63,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"({","obfuscation":"JrR2rUDo4wMiRT"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":64,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"cmd","obfuscation":"rEIjGvUAaqmxs"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":65,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":":\"","obfuscation":"zsbHQtN8zwXjWy"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":66,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"cat","obfuscation":"Na6Nhvi6vZC7s"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":67,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" notes","obfuscation":"oQv6HTjdMK"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":68,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".txt","obfuscation":"MAIPLGcv3pKU"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":69,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":";","obfuscation":"KAgu84766xUt0fg"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":70,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" wc","obfuscation":"ENM8N2lsvf2Ye"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":71,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" -","obfuscation":"hKaMK2Sts7Nbwx"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":72,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"l","obfuscation":"BwUyxjZWbQI4WKO"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":73,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" notes","obfuscation":"kTpWmcUA19"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":74,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".txt","obfuscation":"8EKtY3P2Al30"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":75,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"\",","obfuscation":"SpjMLalK2pyciL"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":76,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"max","obfuscation":"S3iIChMa3LuTk"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":77,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"_output","obfuscation":"f5DaiZ9QQ"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":78,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"_tokens","obfuscation":"ismgWZKPI"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":79,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":":","obfuscation":"2sj8ck4uqhYgopL"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":80,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"300","obfuscation":"ROvkCmcf5wS5r"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":81,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"0","obfuscation":"khWTbSyeMcKFSxH"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":82,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"})\n","obfuscation":"ImoZDae8mF7Rb"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":83,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"]);","obfuscation":"YE29gTUI1QfO9"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":84,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" results","obfuscation":"lky6gZJb"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":85,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".for","obfuscation":"cD6FIfE6EaYA"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":86,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"Each","obfuscation":"1OHUoEqJN5us"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":87,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"((","obfuscation":"f45pvXd8ehozJy"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":88,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"r","obfuscation":"5Qp9GCWaleUiwmO"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":89,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":",i","obfuscation":"s1e8hVYbEVxacm"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":90,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":")=>","obfuscation":"tK0jcMBKyzvWE"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":91,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"text","obfuscation":"tu9Fz7JVYn2T"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":92,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"({","obfuscation":"LXu2K4u2mN1Ewl"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":93,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"file","obfuscation":"KXR99P93RpOA"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":94,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":":[\"","obfuscation":"byoOmFsK51Rlx"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":95,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"README","obfuscation":"BI5NxCxVHM"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":96,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".md","obfuscation":"LZxAWRGY0TWAV"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":97,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"\",\"","obfuscation":"F0KL2q06iwn7r"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":98,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"notes","obfuscation":"K5UqIhOKM13"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":99,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".txt","obfuscation":"td2RGIlU1Nh7"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":100,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"\"][","obfuscation":"2jtwQPz4TcK9m"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":101,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"i","obfuscation":"7FVaUxoxo5QJfFh"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":102,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"],","obfuscation":"FcpKG0ZWVaJUBm"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":103,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"result","obfuscation":"Xg0VjpRDvn"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":104,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":":r","obfuscation":"5HD2rqrIumrGcj"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":105,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"}));\n","obfuscation":"kC90woDc5E6"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":106,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"text","obfuscation":"uPWK2852iiRW"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":107,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"(await","obfuscation":"7ei4H5oldk"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":108,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" tools","obfuscation":"YuOSGhqJcV"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":109,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".exec","obfuscation":"7L5gN27IcsC"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":110,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"_command","obfuscation":"54xDMIIS"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":111,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"({","obfuscation":"hDZQb89jUhOQdD"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":112,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"cmd","obfuscation":"uQEajUtSzD01d"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":113,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":":\"","obfuscation":"b4f2U3BCbOAepb"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":114,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"cat","obfuscation":"a648XsNHc8O0r"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":115,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":" missing","obfuscation":"F7MyFXCU"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":116,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":".txt","obfuscation":"zmIy4GuRzFnV"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":117,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"\",","obfuscation":"KqCcMc45Z6cQNs"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":118,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"max","obfuscation":"BTEgsNUxFdhoY"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":119,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"_output","obfuscation":"din8Ag1Al"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":120,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"_tokens","obfuscation":"fgUyEoB3z"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":121,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":":","obfuscation":"YEWD6NdrCKEGNVw"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":122,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"100","obfuscation":"8yzvGQQa9yzWI"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":123,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"0","obfuscation":"WKq9CdrHhECSDSr"}++event: response.custom_tool_call_input.delta+data: {"type":"response.custom_tool_call_input.delta","sequence_number":124,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"delta":"}));\n","obfuscation":"KlVF4rxOXuw"}++event: response.custom_tool_call_input.done+data: {"type":"response.custom_tool_call_input.done","sequence_number":125,"item_id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","output_index":1,"input":"const results = await Promise.allSettled([\n tools.exec_command({cmd:\"cat README.md; wc -l README.md\",max_output_tokens:3000}),\n tools.exec_command({cmd:\"cat notes.txt; wc -l notes.txt\",max_output_tokens:3000})\n]); results.forEach((r,i)=>text({file:[\"README.md\",\"notes.txt\"][i],result:r}));\ntext(await tools.exec_command({cmd:\"cat missing.txt\",max_output_tokens:1000}));\n"}++event: response.output_item.done+data: {"type":"response.output_item.done","sequence_number":126,"output_index":1,"item":{"type":"custom_tool_call","id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","metadata":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"internal_chat_message_metadata_passthrough":{"create_time":1792162142.1386368,"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"call_id":"call_c0d07fd9ccd84fe29372c0e72ed12869","name":"exec","input":"const results = await Promise.allSettled([\n tools.exec_command({cmd:\"cat README.md; wc -l README.md\",max_output_tokens:3000}),\n tools.exec_command({cmd:\"cat notes.txt; wc -l notes.txt\",max_output_tokens:3000})\n]); results.forEach((r,i)=>text({file:[\"README.md\",\"notes.txt\"][i],result:r}));\ntext(await tools.exec_command({cmd:\"cat missing.txt\",max_output_tokens:1000}));\n","status":"completed"}}++event: response.metadata+data: {"type":"response.metadata","sequence_number":127,"response_id":"resp_07438c2e31b28b62016ad2395bfc388191a56b110cd48b3292","metadata":{"openai_chatgpt_moderation_metadata":{"prompt":{"omnimod":{"protection_type":"omnimod","outputs":[{"results":[{"category_flags":{"A1":false,"A2":false,"A3":false,"C1":false,"C11":false,"C2":false,"E1":false,"E2":false,"E3":false,"H1":false,"H2":false,"H3":false,"JB1":false,"K1":false,"K2":false,"K3":false,"K4":false,"P1":false,"P2":false,"P3":false,"P4":false,"PD1":false,"PD4":false,"S1":false,"S3+":false,"S4":false,"SH":false,"TXT-C3":false,"TXT-C4":false,"V1":false,"V2+":false,"V4+":false,"REFUSED":false,"CBRN-B1+":false,"IMG-C1":false,"IMG-C11":false,"IMG-C2":false,"IMG-S1":false,"IMG-SH":false,"IMG-V1":false,"IMG-V2+":false,"IMG-V4+":false}}],"is_blocked":false}]}},"generation":{},"tool_call":{},"tool_response":{}}}}++event: response.completed+data: {"type":"response.completed","sequence_number":128,"safety_buffering":false,"response":{"id":"resp_07438c2e31b28b62016ad2395bfc388191a56b110cd48b3292","object":"response","created_at":1792162140,"completed_at":1792162143,"status":"completed","background":false,"frequency_penalty":0.0,"presence_penalty":0.0,"moderation":null,"model":"gpt-6.1-sol","access_programs":{"cyber":"standard"},"previous_response_id":null,"instructions":null,"output":[{"type":"message","id":"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e","metadata":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"internal_chat_message_metadata_passthrough":{"create_time":1792162141.5549767,"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"role":"assistant","status":"completed","content":[{"type":"output_text","text":"I’ll read both files in parallel, count their lines, then try `missing.txt`.","annotations":[],"logprobs":[]}],"phase":"commentary"},{"type":"custom_tool_call","id":"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f","metadata":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"internal_chat_message_metadata_passthrough":{"create_time":1792162142.1386368,"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"call_id":"call_c0d07fd9ccd84fe29372c0e72ed12869","name":"exec","input":"const results = await Promise.allSettled([\n tools.exec_command({cmd:\"cat README.md; wc -l README.md\",max_output_tokens:3000}),\n tools.exec_command({cmd:\"cat notes.txt; wc -l notes.txt\",max_output_tokens:3000})\n]); results.forEach((r,i)=>text({file:[\"README.md\",\"notes.txt\"][i],result:r}));\ntext(await tools.exec_command({cmd:\"cat missing.txt\",max_output_tokens:1000}));\n","status":"completed"}],"error":null,"incomplete_details":null,"tools":[{"type":"namespace","name":"functions","description":"","tools":[{"type":"function","strict":false,"name":"wait","description":"Waits on a yielded `exec` cell and returns new output or completion.\n- Use `wait` only after `exec` returns `Script running with cell ID ...`.\n- `cell_id` identifies the running `exec` cell to resume.\n- `yield_time_ms` controls how long to wait for more output before yielding again. Defaults to 10000 ms.\n- `max_tokens` limits how much new output this wait call returns. Defaults to 10000 tokens.\n- `terminate: true` stops the running cell; false or omitted waits for output.\n- `wait` returns only the new output since the last yield, or the final completion or termination result for that cell.\n- If the cell is still running, `wait` may yield again with the same `cell_id`.\n- If the cell has already finished, `wait` returns the completed result and closes the cell.","output_schema":null,"parameters":{"type":"object","properties":{"cell_id":{"type":"string","description":"Identifier of the running exec cell."},"max_tokens":{"type":"number","description":"Output token budget for this wait call. Defaults to 10000 tokens."},"terminate":{"type":"boolean","description":"True stops the running exec cell; false or omitted waits for output."},"yield_time_ms":{"type":"number","description":"Wait before yielding more output. Defaults to 10000 ms."}},"required":["cell_id"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input","description":"Request user input for one to three short questions and wait for the response. This tool is only available in Plan mode.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"Questions to show the user. Prefer 1 and do not exceed 3","items":{"type":"object","properties":{"header":{"type":"string","description":"Short header label shown in the UI (12 or fewer chars)."},"id":{"type":"string","description":"Stable identifier for mapping answers (snake_case)."},"options":{"type":"array","description":"Provide 2-3 mutually exclusive choices. Put the recommended option first and suffix its label with \"(Recommended)\". Do not include an \"Other\" option in this list; the client will add a free-form \"Other\" option automatically.","items":{"type":"object","properties":{"description":{"type":"string","description":"One short sentence explaining impact/tradeoff if selected."},"label":{"type":"string","description":"User-facing label (1-5 words)."}},"required":["label","description"],"additionalProperties":false}},"question":{"type":"string","description":"Single-sentence prompt shown to the user."}},"required":["id","header","question","options"],"additionalProperties":false}}},"required":["questions"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input_async","description":"Ask the user one or more questions during ongoing work. Use this tool only to request missing information, preferences, constraints, clarification, or approval. The tool returns immediately without ending the turn or waiting for a reply; any reply arrives asynchronously as a new user message. Keep questions concise, self-contained, and easy to understand, using a level of detail appropriate to the user and task. The UI always allows a free-text answer, including when suggested options are provided. A preselected option is not submitted automatically.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"One or more self-contained questions to present together, in display order.","items":{"type":"object","properties":{"options":{"type":"array","description":"Suggested answers, in display order. Put the recommended answer first; the first option is preselected by default. The user can select one option or enter a free-text answer. Do not include an Other option or a free-text placeholder; the UI provides free-text input automatically. Omit options for a free-text-only question.","items":{"type":"string"},"minItems":1},"title":{"type":"string","description":"The complete question shown to the user, including any context needed to answer it."}},"required":["title"],"additionalProperties":false},"minItems":1}},"required":["questions"],"additionalProperties":false}},{"type":"custom","name":"exec","description":"Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\nShared MCP Types:\n```ts\ntype Role = \"user\" | \"assistant\";\ntype MetaObject = Record<string, unknown>;\ntype Annotations = {\n audience?: Role[];\n priority?: number;\n lastModified?: string;\n};\ntype Icon = {\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n};\ntype TextResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n text: string;\n};\ntype BlobResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n blob: string;\n};\ntype TextContent = {\n type: \"text\";\n text: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ImageContent = {\n type: \"image\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype AudioContent = {\n type: \"audio\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ResourceLink = {\n icons?: Icon[];\n name: string;\n title?: string;\n uri: string;\n description?: string;\n mimeType?: string;\n annotations?: Annotations;\n size?: number;\n _meta?: MetaObject;\n type: \"resource_link\";\n};\ntype EmbeddedResource = {\n type: \"resource\";\n resource: TextResourceContents | BlobResourceContents;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ContentBlock =\n | TextContent\n | ImageContent\n | AudioContent\n | ResourceLink\n | EmbeddedResource;\ntype CallToolResult<TStructured = { [key: string]: unknown }> = {\n _meta?: MetaObject;\n content: ContentBlock[];\n isError?: boolean;\n structuredContent?: TStructured;\n [key: string]: unknown;\n};\n```\n\n### `apply_patch`\nThe `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.\n\nexec tool declaration:\n```ts\ndeclare const tools: { apply_patch(input: string): Promise<unknown>; };\n```\n\n### `create_goal`\nCreate a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks.\nSet token_budget only when an explicit token budget is requested. Fails if an unfinished goal exists; use update_goal only for status.\n\nexec tool declaration:\n```ts\ndeclare const tools: { create_goal(args: {\n // Required. The concrete objective to start pursuing. This starts a new active goal when no goal exists or replaces the current goal when it is complete.\n objective: string;\n // Positive token budget for the new goal. Omit unless explicitly requested.\n token_budget?: number;\n}): Promise<unknown>; };\n```\n\n### `exec_command`\nRuns a command in a PTY, returning output or a session ID for ongoing interaction.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n // Shell command to execute.\n cmd: string;\n // User-facing approval question for `require_escalated`; omit otherwise.\n justification?: string;\n // True runs the shell with -l/-i semantics; false disables them. Defaults to true.\n login?: boolean;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Reusable approval prefix for `cmd`, only with `sandbox_permissions: \"require_escalated\"`; for example [\"git\", \"pull\"].\n prefix_rule?: Array<string>;\n // Per-command sandbox override. Defaults to `use_default`; use `require_escalated` for unsandboxed execution.\n sandbox_permissions?: \"use_default\" | \"require_escalated\";\n // Shell binary to launch. Defaults to the user's default shell.\n shell?: string;\n // True allocates a PTY for the command; false or omitted uses plain pipes.\n tty?: boolean;\n // Working directory for the command. Defaults to the turn cwd.\n workdir?: string;\n // Wait before yielding output. Defaults to 10000 ms; effective range is 250-30000 ms.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n### `get_goal`\nGet the current goal for this thread, including status, budgets, token and elapsed-time usage, and remaining token budget.\n\nexec tool declaration:\n```ts\ndeclare const tools: { get_goal(args: {}): Promise<unknown>; };\n```\n\n### `list_mcp_resource_templates`\nLists resource templates provided by MCP servers. Parameterized resource templates allow servers to share data that takes parameters and provides context to language models, such as files, database schemas, or application-specific information. Prefer resource templates over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resource_templates(args: {\n // Opaque cursor from a previous list_mcp_resource_templates call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resource templates from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `list_mcp_resources`\nLists resources provided by MCP servers. Resources allow servers to share data that provides context to language models, such as files, database schemas, or application-specific information. Prefer resources over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resources(args: {\n // Opaque cursor from a previous list_mcp_resources call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resources from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `read_mcp_resource`\nRead a specific resource from an MCP server given the server name and resource URI.\n\nexec tool declaration:\n```ts\ndeclare const tools: { read_mcp_resource(args: {\n // MCP server name exactly as configured. Must match the 'server' field returned by list_mcp_resources.\n server: string;\n // Resource URI to read. Must be one of the URIs returned by list_mcp_resources.\n uri: string;\n}): Promise<unknown>; };\n```\n\n### `request_plugin_install`\n# Suggest a recommended plugin installation\n\nUse this tool only when all of the following are true:\n- The user explicitly asks to use a specific plugin that is not already available in the current context or active `tools` list.\n- Tool search has already been exhausted and did not find or make the requested tool callable.\n- The plugin is listed in `<recommended_plugins>`.\n\nDo not use it for adjacent capabilities, broad recommendations, or plugins that merely seem useful. Briefly explain why the plugin can help with the current request in `suggest_reason`.\n\nIMPORTANT: DO NOT call this tool in parallel with other tools.\n\nexec tool declaration:\n```ts\ndeclare const tools: { request_plugin_install(args: {\n // The parenthesized plugin ID from the `<recommended_plugins>` list.\n plugin_id: string;\n // Concise one-line user-facing reason why this plugin can help with the current request.\n suggest_reason: string;\n}): Promise<unknown>; };\n```\n\n### `update_goal`\nUpdate the existing goal.\nSet status to `paused` only at the user's explicit request to pause this goal, never on your own initiative. Ask if unclear; a later resume revokes that request. Report the returned status and stop goal work. Budget limits take precedence over pausing.\nSet status to `complete` only when the objective has actually been achieved and no required work remains.\nSet status to `blocked` only when the same blocking condition has repeated for at least three consecutive goal turns, counting the original/user-triggered turn and any automatic continuations, and the agent cannot make meaningful progress without user input or an external-state change.\nIf the user resumes a goal that was previously marked `blocked`, treat the resumed run as a fresh blocked audit. If the same blocking condition then repeats for at least three consecutive resumed goal turns, set status to `blocked` again.\nOnce the blocked threshold is satisfied, do not keep reporting that you are still blocked while leaving the goal active; set status to `blocked`.\nDo not use `blocked` merely because the work is hard, slow, uncertain, incomplete, or would benefit from clarification.\nDo not mark a goal complete merely because its budget is nearly exhausted or because you are stopping work.\nYou cannot use this tool to resume, budget-limit, or usage-limit a goal; those status changes are controlled by the user or system.\nWhen marking a budgeted goal achieved with status `complete`, report the final token usage from the tool result to the user.\n\nexec tool declaration:\n```ts\ndeclare const tools: { update_goal(args: {\n // Required. `paused` requires an explicit user request. Set to `complete` only when the objective is achieved and no required work remains. Set to `blocked` only after the same blocking condition has recurred for at least three consecutive goal turns and the agent is at an impasse. After a previously blocked goal is resumed, the resumed run starts a fresh blocked audit.\n status: \"complete\" | \"blocked\" | \"paused\";\n}): Promise<unknown>; };\n```\n\n### `view_image`\nView a local image file from the filesystem when visual inspection is needed. Use this for images already available on disk.\n\nexec tool declaration:\n```ts\ndeclare const tools: { view_image(args: {\n // Image detail level. Defaults to `high`; use `original` to preserve exact resolution.\n detail?: \"high\" | \"original\";\n // Local filesystem path to an image file.\n path: string;\n}): Promise<{\n // Image detail hint returned by view_image. Returns `high` for default resized behavior or `original` when original resolution is preserved.\n detail: \"high\" | \"original\";\n // Data URL for the loaded image.\n image_url: string;\n}>; };\n```\n\n### `write_stdin`\nWrites characters to an existing unified exec session and returns recent output.\n\nexec tool declaration:\n```ts\ndeclare const tools: { write_stdin(args: {\n // Bytes to write to stdin. Defaults to empty, which polls without writing.\n chars?: string;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Identifier of the running unified exec session.\n session_id: number;\n // Wait before yielding output. Non-empty writes default to 250 ms and cap at 30000 ms; empty polls wait 5000-300000 ms by default.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n## clock\nTools for reading and waiting on time.\n\n### `clock__curr_time`\nReturn the current time in UTC.\n\nexec tool declaration:\n```ts\ndeclare const tools: { clock__curr_time(args: {}): Promise<{\n // Current UTC time formatted as YYYY-MM-DD HH:MM:SS UTC.\n current_time: string;\n}>; };\n```\n\n## image_gen\nTools in the image_gen namespace.\n\n### `image_gen__imagegen`\nThe `image_gen.imagegen` tool enables image generation from descriptions and editing of existing images based on specific instructions. Use it when:\n\n- The user requests an image based on a scene description, such as a diagram, portrait, comic, meme, or any other visual.\n- The user wants to modify an attached or previously generated image with specific changes, including adding or removing elements, altering colors, improving quality/resolution, or transforming the style (e.g., cartoon, oil painting).\n\nGuidelines:\n- imagegen needs a few minutes to finish. In code-mode, use the first-line @exec directive to give the initial call 120 seconds and the same yield for any waits that follow. Once it finishes, return the image with generatedImage(result).\n- Avoid printing the full result or its base64 image data with `text()` or `notify()`; print only small metadata when needed.\n- Set `transparent_background` to true when the request calls for a transparent background, including background removal or a cutout; set it to false otherwise. For edits, preserve existing transparency unless the user asks to change it.\n- Omit both `referenced_image_paths` and `num_last_images_to_include` when generating a brand new image.\n- For edits, use `referenced_image_paths` when every target image has a local file path.\n- If you have not seen a local image yet, use `view_image` to inspect it before editing.\n- Use `num_last_images_to_include` only when at least one target image has no local file path.\n- Set `num_last_images_to_include` to the smallest number of recent conversation images that includes every target image, up to 5.\n- Never provide both `referenced_image_paths` and `num_last_images_to_include`.\n- If neither mechanism can include every target image, ask the user to attach the missing images again.\n- Directly generate the image without reconfirmation or clarification unless required images must be attached again.\n- Always use this tool for image editing unless the user explicitly requests otherwise. Do not use the `python` tool for image editing unless specifically instructed.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { image_gen__imagegen(args: {\n num_last_images_to_include?: number | null;\n prompt: string;\n referenced_image_paths?: Array<string> | null;\n // Whether the output should have a transparent background. Defaults to false.\n transparent_background?: boolean;\n}): Promise<unknown>; };\n```\n\n## web\nTools in the web namespace.\n\n### `web__run`\nTool for accessing the internet.\n\n\n---\n\n## Examples of different commands available in this tool\n\nExamples of different commands available in this tool:\n* `search_query`: {\"search_query\": [{\"q\": \"What is the capital of France?\"}, {\"q\": \"What is the capital of belgium?\"}]}. Searches the internet for a given query (and optionally with a domain or recency filter)\n* `image_query`: {\"image_query\":[{\"q\": \"waterfalls\"}]}.\n* `open`: {\"open\": [{\"ref_id\": \"turn0search0\"}, {\"ref_id\": \"https://www.openai.com\", \"lineno\": 120}]}\n* `click`: {\"click\": [{\"ref_id\": \"turn0fetch3\", \"id\": 17}]}\n* `find`: {\"find\": [{\"ref_id\": \"turn0fetch3\", \"pattern\": \"Annie Case\"}]}\n* `screenshot`: {\"screenshot\": [{\"ref_id\": \"turn1view0\", \"pageno\": 0}, {\"ref_id\": \"turn1view0\", \"pageno\": 3}]}\n* `finance`: {\"finance\":[{\"ticker\":\"AMD\",\"type\":\"equity\",\"market\":\"USA\"}]}, {\"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}]}\n* `weather`: {\"weather\":[{\"location\":\"San Francisco, CA\"}]}\n* `sports`: {\"sports\":[{\"fn\":\"standings\",\"league\":\"nfl\"}, {\"fn\":\"schedule\",\"league\":\"nba\",\"team\":\"GSW\",\"date_from\":\"2025-02-24\"}]}\n* `time`: {\"time\":[{\"utc_offset\":\"+03:00\"}]}\n\n---\n\n## Usage hints\nTo use this tool efficiently:\n* Use multiple commands and queries in one call to get more results faster; e.g. {\"search_query\": [{\"q\": \"bitcoin news\"}], \"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}], \"find\": [{\"ref_id\": \"turn0search0\", \"pattern\": \"Annie Case\"}, {\"ref_id\": \"turn0search1\", \"pattern\": \"John Smith\"}]}\n* Use \"response_length\" to control the number of results returned by this tool, omit it if you intend to pass \"short\" in\n* Only write required parameters; do not write empty lists or nulls where they could be omitted.\n* `search_query` must have length at most 4 in each call. If it has length > 3, response_length must be medium or long\n* If you find yourself in a situation where you accidentally call the `web.run` tool, it's best just to send an empty query: {\"search_query\": [{\"q\": \"\"}]}.\n\n---\n\n## Decision boundary\n\nIf the user makes an explicit request to search the internet, find latest information, look up, etc (or to not do so), you must obey their request.\nWhen you make an assumption, always consider whether it is temporally stable; i.e. whether there's even a small (>10%) chance it has changed. If it is unstable, you must verify with browsing the internet for verification.\n\n<situations_where_you_must_browse_the_internet>\nBelow is a list of scenarios where browsing the internet MUST be used. PAY CLOSE ATTENTION: you MUST browse the internet in these cases. If you're unsure or on the fence, you MUST bias towards browsing the internet.\n- The information could have changed recently: for example news; prices; laws; schedules; product specs; sports scores; economic indicators; political/public/company figures (e.g. the question relates to 'the president of country A' or 'the CEO of company B', which might change over time); rules; regulations; standards; software libraries that could be updated; exchange rates; recommendations (i.e., recommendations about various topics or things might be informed by what currently exists / is popular / is safe / is unsafe / is in the zeitgeist / etc.); and many many many more categories -- again, if you're on the fence, you MUST browse the internet!\n - For news queries, prioritize more recent events, ensuring you compare publish dates and the date that the event happened.\n- The user is seeking recommendations that could lead them to spend substantial time or money -- researching products, restaurants, travel plans, etc.\n- The user wants (or would benefit from) direct quotes, links, or precise source attribution.\n- A specific page, paper, dataset, PDF, or site is referenced and you haven't been given its contents.\n- You're unsure about a fact, the topic is niche or emerging, or you suspect there's at least a 10% chance you will incorrectly recall it\n- High-stakes accuracy matters (medical, legal, financial guidance). For these you generally should search by default because this information is highly temporally unstable\n- The user explicitly says to search, browse, verify, or look it up.\n</situations_where_you_must_browse_the_internet>\n\n---\n\n## Citations\n\nResults from `web.run` include internal reference IDs such as `turn2search5`. Use\nthose reference IDs only in calls to `web.run`; do not expose them in the final\nresponse.\n\nCite sources in the final response using Markdown links:\n\n- Cite a single source as `[descriptive source title](https://example.com/page)`.\n- Cite multiple sources with separate Markdown links, for example\n `[first source](https://example.com/one), [second source](https://example.com/two)`.\n- Link directly to the page that supports the claim. Do not link to search result\n pages or use bare URLs.\n\nFormatting of citations:\n\n- Place each citation as near as possible to the claim it supports, normally at\n the end of the sentence or paragraph and after punctuation.\n- Do not place citations inside code fences.\n- Do not put citations on a line by themselves or collect all citations at the\n end of the response.\n\nIf you browse the internet, cite statements supported by web sources. Each cited\nsource must directly support the associated claim. Prefer primary and\nauthoritative sources, and use sources from different domains when the response\nbenefits from multiple perspectives.\n\n---\n\n## Special cases\nIf these conflict with any other instructions, these should take precedence.\n\n<special_cases>\n- When the user asks for information about how to use OpenAI products, (ChatGPT, the OpenAI API, etc.), you should check the code in local env and only browse as fallback, when you browse restrict your sources to official OpenAI websites using the domains filter, unless otherwise requested.\n- When using search to answer technical questions, you must only rely on primary sources (research papers, official documentation, etc.)\n- Clearly indicate when you are making an inference from sources.\n</special_cases>\n\n---\n\n## Word limits\nResponses may not excessively quote or draw on a specific source. There are several limits here:\n- **Limit on verbatim quotes:**\n - You may not quote more than 25 words verbatim from any single non-lyrical source, unless the source is reddit.\n - For song lyrics, verbatim quotes must be limited to at most 10 words.\n - Long quotes from reddit are allowed, as long as you indicate that those are direct quotes via a markdown blockquote starting with \">\", copy verbatim, and link the source.\n- **Word limits:**\n - Each webpage source in the sources has a word limit label formatted like \"[wordlim N]\", in which N is the maximum number of words in the whole response that are attributed to that source. If omitted, the word limit is 200 words.\n - Non-contiguous words derived from a given source must be counted to the word limit.\n - The summarization limit N is a maximum for each source.\n - When using multiple sources, their summarization limits add together. However, each article used must be relevant to the response.\n- **Copyright compliance:**\n - You must avoid providing full articles, long verbatim passages, or extensive direct quotes due to copyright concerns.\n - If the user asked for a verbatim quote, the response should provide a short compliant excerpt and then answer with paraphrases and summaries.\n - Again, this limit does not apply to reddit content, as long as it's appropriately indicated that those are direct quotes and you link to the source.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { web__run(args: {\n // Open links from previously opened pages.\n click?: Array<{\n // Numbered link id to open.\n id: number;\n // Reference id containing the numbered link.\n ref_id: string;\n}>;\n // Look up prices for the given stock symbols.\n finance?: Array<{\n // ISO 3166-1 alpha-3 country code, \"OTC\", or \"\" for cryptocurrency.\n market?: string;\n // Ticker symbol to look up.\n ticker: string;\n // Asset type to look up.\n type: \"equity\" | \"fund\" | \"crypto\" | \"index\";\n}>;\n // Find text patterns in pages.\n find?: Array<{\n // Text pattern to find.\n pattern: string;\n // Reference id or URL to search within.\n ref_id: string;\n}>;\n // Query the image search engine for a given list of queries.\n image_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Open pages by reference id or URL.\n open?: Array<{\n // Line number to position the page at.\n lineno?: number;\n // Reference id or URL to open.\n ref_id: string;\n}>;\n // Set the length of the response to be returned.\n response_length?: \"short\" | \"medium\" | \"long\";\n // Take screenshots of PDF pages.\n screenshot?: Array<{\n // Zero-indexed PDF page number.\n pageno: number;\n // Reference id or URL to screenshot.\n ref_id: string;\n}>;\n // Query the internet search engine for a given list of queries.\n search_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Look up sports schedules and standings.\n sports?: Array<{\n // Start date in YYYY-MM-DD format.\n date_from?: string;\n // End date in YYYY-MM-DD format.\n date_to?: string;\n // Sports function to call.\n fn: \"schedule\" | \"standings\";\n // League to look up.\n league: \"nba\" | \"wnba\" | \"nfl\" | \"nhl\" | \"mlb\" | \"epl\" | \"ncaamb\" | \"ncaawb\" | \"ipl\";\n // Locale for the lookup.\n locale?: string;\n // Number of games to return.\n num_games?: number;\n // Opponent to use with `team` when narrowing the lookup.\n opponent?: string;\n // Team to look up, using the common 3 or 4 letter alias used in broadcasts.\n team?: string;\n // Tool name for sports requests.\n tool?: \"sports\";\n}>;\n // Get time for the given UTC offsets.\n time?: Array<{\n // UTC offset formatted like \"+03:00\".\n utc_offset: string;\n}>;\n // Look up weather forecasts.\n weather?: Array<{\n // Number of days to return. Defaults to 7.\n duration?: number;\n // Location in \"Country, Area, City\" format.\n location: string;\n // Start date in YYYY-MM-DD format. Defaults to today.\n start?: string;\n}>;\n}): Promise<unknown>; };\n```","format":{"type":"grammar","syntax":"lark","definition":"\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"}}]},{"type":"namespace","name":"clock","description":"Tools for reading and waiting on time.","tools":[{"type":"function","strict":false,"name":"sleep","description":"Pause execution for a specified duration. The sleep ends early when new input arrives for the active turn. Returns the elapsed wall-clock time.","output_schema":null,"parameters":{"type":"object","properties":{"duration_ms":{"type":"number","description":"How long to sleep in milliseconds. Must be between 1 and 43200000."}},"required":["duration_ms"],"additionalProperties":false}}]},{"type":"namespace","name":"collaboration","description":"Tools for spawning and managing sub-agents.","tools":[{"type":"function","strict":false,"name":"followup_task","description":"Send a follow-up task to an existing non-root target agent and trigger a turn if it is idle. If the target is already running, deliver the task promptly at message boundaries while sampling, or after the pending tool call completes.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to send to the target agent.","encrypted":true},"target":{"type":"string","description":"Agent id or canonical task name to send a follow-up task to (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"interrupt_agent","description":"Interrupt an agent's current turn, if any, and return its previous status. The agent remains available for messages and follow-up tasks.","output_schema":null,"parameters":{"type":"object","properties":{"target":{"type":"string","description":"Agent id or canonical task name to interrupt (from spawn_agent)."}},"required":["target"],"additionalProperties":false}},{"type":"function","strict":false,"name":"list_agents","description":"List live agents in the current root thread tree. Optionally filter by task-path prefix.","output_schema":null,"parameters":{"type":"object","properties":{"path_prefix":{"type":"string","description":"Task-path prefix filter without a trailing slash. Omit to list all live agents."}},"additionalProperties":false}},{"type":"function","strict":false,"name":"send_message","description":"Send a message to an existing agent. The message will be delivered promptly. Does not trigger a new turn.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to queue on the target agent.","encrypted":true},"target":{"type":"string","description":"Relative or canonical task name to message (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"spawn_agent","description":"\n Available model overrides (optional; inherited parent model is preferred):\n- `gpt-6.1-sol`: Latest workhorse model for coding and everyday work. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-astra`: Frontier intelligence for the most demanding work. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-sol`: Previous generation workhorse model. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-luna`: Fast and affordable model for easier tasks. Reasoning efforts: low, medium (default), high, xhigh, max. Service tiers: priority.\n- `gpt-5.6-sol`: Older generation workhorse model. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n Spawns an agent to work on the specified task. If your current task is `/root/task1` and you spawn_agent with task_name \"task_3\" the agent will have canonical task name `/root/task1/task_3`.\nYou are then able to refer to this agent as `task_3` or `/root/task1/task_3` interchangeably. However an agent `/root/task2/task_3` would only be able to communicate with this agent via its canonical name `/root/task1/task_3`.\nThe spawned agent will have the same tools as you and the ability to spawn its own subagents.\n\nIt will be able to send you and other running agents messages, and its final answer will be provided to you when it finishes.\nThe new agent's canonical task name will be provided to it along with the message.\n\nNote that passing `fork_turns=\"none\"` will not pass any surrounding context to the spawned subagent, which may cause the agent to lack the context it needs to complete its task, whereas `fork_turns=\"all\"` will provide the subagent with all surrounding context.","output_schema":null,"parameters":{"type":"object","properties":{"fork_turns":{"type":"string","description":"Optional number of turns to fork. Defaults to `all`. Use `none`, `all`, or a positive integer string such as `3` to fork only the most recent turns."},"message":{"type":"string","description":"Initial plain-text task for the new agent.","encrypted":true},"model":{"type":"string","description":"Model override for the new agent. Omit unless an explicit override is needed."},"reasoning_effort":{"type":"string","description":"Reasoning effort override for the new agent. Omit to inherit the parent effort."},"task_name":{"type":"string","description":"Task name for the new agent. Use lowercase letters, digits, and underscores."}},"required":["task_name","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"wait_agent","description":"Wait for a mailbox update from any live agent, including queued messages and final-status notifications. The wait also ends early when new user input is steered into the active turn. Does not return the content; returns either a summary of which agents have updates (if any), an interruption summary for steered input, or a timeout summary if no activity arrives before the deadline.","output_schema":null,"parameters":{"type":"object","properties":{"timeout_ms":{"type":"number","description":"Timeout in milliseconds. Defaults to 30000, min 10000, max 3600000."}},"additionalProperties":false}}]},{"type":"namespace","name":"mcp__cua_repl","description":"UI automation through cua_repl using the initialized cua API.","tools":[{"type":"function","strict":false,"name":"js","description":"Control native apps or browsers on the user’s computer by reading or operating UI. Prefer purpose-built skills, connectors, APIs, or CLIs when available.\n\nOn the first invocation of `cua_repl`, or after resetting it, execute exactly one of the API calls shown below, optionally assigning its result to a variable. Do not add other API calls, waits, or snapshots to that invocation.\nThe tool result will include documentation and, when creating or selecting a tab or selecting an app, its initial UI state. Selecting a browser does not open a tab. Read that result before continuing.\nUse only APIs described in the tool instructions or returned documentation.\n\nWhen you need an inventory of available apps, browsers, and tabs, get a snapshot of all enabled surfaces. Otherwise, use the relevant entry point below:\n\n```javascript\nawait cua.getState();\n```\n\nUse the first matching browser control option from the user's request:\n\nFor a tab @-mention (`mention=tab-v1`):\nPass the complete `plugin://...` URL to get the referenced tab.\n\n```javascript\nlet tab = await cua.getTab({ mention: tabMentionUrl });\n```\n\nFor an existing tab identified by URL in browser context (including the current IAB tab):\n\n```javascript\nlet tab = await cua.getTab({ url }, { browser: browserId });\n```\n\nKnown tab ID (`tabId` or `providerTabId`) and browser (name or browser @-mention):\n\n```javascript\nlet tab = await cua.getTab(tabId, { browser: browserId });\n```\n\nTo open a URL in the in-app browser (`@Browser`):\n\n```javascript\nlet tab = await cua.createBrowserTab(\"iab\", url, { visible: boolean });\n```\n\nTo open a URL in another named browser: pass its name directly; do not call `getBrowser` first.\n\n```javascript\nlet tab = await cua.createBrowserTab(browserName, url, browserOptions);\n```\n\nKnown URL, only when the user has not specified a browser by name or @-mention:\n\n```javascript\nlet browser = await cua.getBrowser({ url });\n```\n\nBrowser IDs and options:\n\n- `\"mcpapps\"`: use `cua.getBrowser({ id: \"mcpapps\" })` for existing full-screen MCP Apps in the task’s side panel.\n- `\"iab\"` (in-app browser): in `createBrowserTab`, use `visible: true` to show the browser; `false` to keep it hidden.\n- `\"dot\"` (Dot): use only when present in browser inventory. It accesses tabs on Dot's active main thread. `cua.getTab(tabId, { browser: \"dot\" })` claims an existing tab; `cua.createBrowserTab(\"dot\", url, { visible: boolean })` creates one with the same visibility options as `\"iab\"`.\n- `\"chrome\"` (@Chrome), `\"edge\"` (@Edge): pass a short, emoji-prefixed `sessionName` (e.g. `\"🔎 Task\"`) to `createBrowserTab` when starting a task.\n\nIf the user specifies an app to use, get the app by name, bundle ID, or path:\n\n```javascript\nlet app = await cua.getApp(\"Example App\");\n```\n\nTo add other content to the tool result, use `nodeRepl.write(value)` for text or other values and `await nodeRepl.emitImage(image)` for images. The APIs listed above already display their documentation or UI state; do not wrap their results in `write` or `emitImage`.\n\nIf your context begins with a summary of an existing computer use task, call `await cua.rewriteDocumentation()` before continuing the computer use task to ensure you have a complete view of the necessary documentation. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{"code":{"type":"string","description":"JavaScript to execute using the initialized cua_repl runtime."},"timeout_ms":{"type":"integer","description":"Optional execution timeout in milliseconds. Defaults to 30000 (30 seconds) when omitted."},"title":{"type":"string","description":"Short user-facing description of what the code does."}},"required":["code"],"additionalProperties":false}},{"type":"function","strict":false,"name":"js_reset","description":"Reset the persistent cua_repl JavaScript session. All JavaScript bindings are discarded. The next cua_repl.js call initializes a fresh runtime for the enabled surfaces. This does not close browser tabs or native apps, or erase their state. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{},"additionalProperties":false}}]}],"tool_choice":"auto","parallel_tool_calls":false,"prompt_cache_key":"01a14530-0099-7142-8981-e5e98a2373b1","prompt_cache_retention":"24h","text":{"format":{"type":"text"},"verbosity":"low"},"top_p":0.98,"top_logprobs":0,"temperature":1.0,"reasoning":{"effort":"low","context":"all_turns","summary":null,"mode":"standard"},"user":null,"usage":{"input_tokens":30678,"input_tokens_details":{"cached_tokens":13312,"cache_write_tokens":0},"output_tokens":134,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":30812,"attribution":{"items":{"at_64412749-886e-5d5b-896e-977cf0176f2b":{"input_tokens":9237,"cached_tokens":9237,"cache_write_tokens":0,"output_tokens":0},"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f":{"input_tokens":0,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":111},"msg_01a14530-0bac-7712-b4af-40fb294025d9":{"input_tokens":10323,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":3928,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":5981,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":67,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":178,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":169,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0}]},"msg_01a14530-0bac-7712-b4af-4106285f4fcc":{"input_tokens":539,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":539,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0}]},"msg_01a14530-0bac-7712-b4af-41146d376454":{"input_tokens":56,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":56,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0}]},"msg_01a14530-0bac-7712-b4af-41286c9f7736":{"input_tokens":6277,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":6090,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":187,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0}]},"msg_01a14530-0c20-70a1-8262-3b3474e80c36":{"input_tokens":28,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":28,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0}]},"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e":{"input_tokens":2,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":23,"content":[{"input_tokens":2,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":23}]},"msg_e54f931f-aa11-5faf-8380-98e58a7c8fd1":{"input_tokens":4216,"cached_tokens":4075,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":4216,"cached_tokens":4075,"cache_write_tokens":0,"output_tokens":0}]}}}},"tool_usage":{"image_gen":{"input_tokens":0,"output_tokens":0,"total_tokens":0,"input_tokens_details":{"text_tokens":0,"image_tokens":0},"output_tokens_details":{"image_tokens":0,"text_tokens":0}},"web_search":{"num_requests":0}},"safety_identifier":"user-LCV4XMHz3BRmrwLTeTQWC5P7","store":false,"metadata":{},"max_output_tokens":null,"max_tool_calls":null,"service_tier":"default","truncation":"disabled"}}+diff --git a/packages/cli/src/test-fixtures/sse-responses/codex-exec-turn2.sse b/packages/cli/src/test-fixtures/sse-responses/codex-exec-turn2.ssenew file mode 100644index 00000000..543a4b08--- /dev/null+++ b/packages/cli/src/test-fixtures/sse-responses/codex-exec-turn2.sse@@ -0,0 +1,135 @@+event: response.created+data: {"type":"response.created","sequence_number":0,"safety_buffering":false,"response":{"id":"resp_07438c2e31b28b62016ad2396120848191928cb5504aad5871","object":"response","created_at":1792162145,"completed_at":null,"status":"in_progress","background":false,"frequency_penalty":0.0,"presence_penalty":0.0,"moderation":null,"model":"gpt-6.1-sol","access_programs":{"cyber":"standard"},"previous_response_id":null,"instructions":null,"output":[],"error":null,"incomplete_details":null,"tools":[{"type":"namespace","name":"functions","description":"","tools":[{"type":"function","strict":false,"name":"wait","description":"Waits on a yielded `exec` cell and returns new output or completion.\n- Use `wait` only after `exec` returns `Script running with cell ID ...`.\n- `cell_id` identifies the running `exec` cell to resume.\n- `yield_time_ms` controls how long to wait for more output before yielding again. Defaults to 10000 ms.\n- `max_tokens` limits how much new output this wait call returns. Defaults to 10000 tokens.\n- `terminate: true` stops the running cell; false or omitted waits for output.\n- `wait` returns only the new output since the last yield, or the final completion or termination result for that cell.\n- If the cell is still running, `wait` may yield again with the same `cell_id`.\n- If the cell has already finished, `wait` returns the completed result and closes the cell.","output_schema":null,"parameters":{"type":"object","properties":{"cell_id":{"type":"string","description":"Identifier of the running exec cell."},"max_tokens":{"type":"number","description":"Output token budget for this wait call. Defaults to 10000 tokens."},"terminate":{"type":"boolean","description":"True stops the running exec cell; false or omitted waits for output."},"yield_time_ms":{"type":"number","description":"Wait before yielding more output. Defaults to 10000 ms."}},"required":["cell_id"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input","description":"Request user input for one to three short questions and wait for the response. This tool is only available in Plan mode.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"Questions to show the user. Prefer 1 and do not exceed 3","items":{"type":"object","properties":{"header":{"type":"string","description":"Short header label shown in the UI (12 or fewer chars)."},"id":{"type":"string","description":"Stable identifier for mapping answers (snake_case)."},"options":{"type":"array","description":"Provide 2-3 mutually exclusive choices. Put the recommended option first and suffix its label with \"(Recommended)\". Do not include an \"Other\" option in this list; the client will add a free-form \"Other\" option automatically.","items":{"type":"object","properties":{"description":{"type":"string","description":"One short sentence explaining impact/tradeoff if selected."},"label":{"type":"string","description":"User-facing label (1-5 words)."}},"required":["label","description"],"additionalProperties":false}},"question":{"type":"string","description":"Single-sentence prompt shown to the user."}},"required":["id","header","question","options"],"additionalProperties":false}}},"required":["questions"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input_async","description":"Ask the user one or more questions during ongoing work. Use this tool only to request missing information, preferences, constraints, clarification, or approval. The tool returns immediately without ending the turn or waiting for a reply; any reply arrives asynchronously as a new user message. Keep questions concise, self-contained, and easy to understand, using a level of detail appropriate to the user and task. The UI always allows a free-text answer, including when suggested options are provided. A preselected option is not submitted automatically.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"One or more self-contained questions to present together, in display order.","items":{"type":"object","properties":{"options":{"type":"array","description":"Suggested answers, in display order. Put the recommended answer first; the first option is preselected by default. The user can select one option or enter a free-text answer. Do not include an Other option or a free-text placeholder; the UI provides free-text input automatically. Omit options for a free-text-only question.","items":{"type":"string"},"minItems":1},"title":{"type":"string","description":"The complete question shown to the user, including any context needed to answer it."}},"required":["title"],"additionalProperties":false},"minItems":1}},"required":["questions"],"additionalProperties":false}},{"type":"custom","name":"exec","description":"Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\nShared MCP Types:\n```ts\ntype Role = \"user\" | \"assistant\";\ntype MetaObject = Record<string, unknown>;\ntype Annotations = {\n audience?: Role[];\n priority?: number;\n lastModified?: string;\n};\ntype Icon = {\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n};\ntype TextResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n text: string;\n};\ntype BlobResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n blob: string;\n};\ntype TextContent = {\n type: \"text\";\n text: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ImageContent = {\n type: \"image\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype AudioContent = {\n type: \"audio\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ResourceLink = {\n icons?: Icon[];\n name: string;\n title?: string;\n uri: string;\n description?: string;\n mimeType?: string;\n annotations?: Annotations;\n size?: number;\n _meta?: MetaObject;\n type: \"resource_link\";\n};\ntype EmbeddedResource = {\n type: \"resource\";\n resource: TextResourceContents | BlobResourceContents;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ContentBlock =\n | TextContent\n | ImageContent\n | AudioContent\n | ResourceLink\n | EmbeddedResource;\ntype CallToolResult<TStructured = { [key: string]: unknown }> = {\n _meta?: MetaObject;\n content: ContentBlock[];\n isError?: boolean;\n structuredContent?: TStructured;\n [key: string]: unknown;\n};\n```\n\n### `apply_patch`\nThe `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.\n\nexec tool declaration:\n```ts\ndeclare const tools: { apply_patch(input: string): Promise<unknown>; };\n```\n\n### `create_goal`\nCreate a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks.\nSet token_budget only when an explicit token budget is requested. Fails if an unfinished goal exists; use update_goal only for status.\n\nexec tool declaration:\n```ts\ndeclare const tools: { create_goal(args: {\n // Required. The concrete objective to start pursuing. This starts a new active goal when no goal exists or replaces the current goal when it is complete.\n objective: string;\n // Positive token budget for the new goal. Omit unless explicitly requested.\n token_budget?: number;\n}): Promise<unknown>; };\n```\n\n### `exec_command`\nRuns a command in a PTY, returning output or a session ID for ongoing interaction.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n // Shell command to execute.\n cmd: string;\n // User-facing approval question for `require_escalated`; omit otherwise.\n justification?: string;\n // True runs the shell with -l/-i semantics; false disables them. Defaults to true.\n login?: boolean;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Reusable approval prefix for `cmd`, only with `sandbox_permissions: \"require_escalated\"`; for example [\"git\", \"pull\"].\n prefix_rule?: Array<string>;\n // Per-command sandbox override. Defaults to `use_default`; use `require_escalated` for unsandboxed execution.\n sandbox_permissions?: \"use_default\" | \"require_escalated\";\n // Shell binary to launch. Defaults to the user's default shell.\n shell?: string;\n // True allocates a PTY for the command; false or omitted uses plain pipes.\n tty?: boolean;\n // Working directory for the command. Defaults to the turn cwd.\n workdir?: string;\n // Wait before yielding output. Defaults to 10000 ms; effective range is 250-30000 ms.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n### `get_goal`\nGet the current goal for this thread, including status, budgets, token and elapsed-time usage, and remaining token budget.\n\nexec tool declaration:\n```ts\ndeclare const tools: { get_goal(args: {}): Promise<unknown>; };\n```\n\n### `list_mcp_resource_templates`\nLists resource templates provided by MCP servers. Parameterized resource templates allow servers to share data that takes parameters and provides context to language models, such as files, database schemas, or application-specific information. Prefer resource templates over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resource_templates(args: {\n // Opaque cursor from a previous list_mcp_resource_templates call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resource templates from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `list_mcp_resources`\nLists resources provided by MCP servers. Resources allow servers to share data that provides context to language models, such as files, database schemas, or application-specific information. Prefer resources over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resources(args: {\n // Opaque cursor from a previous list_mcp_resources call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resources from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `read_mcp_resource`\nRead a specific resource from an MCP server given the server name and resource URI.\n\nexec tool declaration:\n```ts\ndeclare const tools: { read_mcp_resource(args: {\n // MCP server name exactly as configured. Must match the 'server' field returned by list_mcp_resources.\n server: string;\n // Resource URI to read. Must be one of the URIs returned by list_mcp_resources.\n uri: string;\n}): Promise<unknown>; };\n```\n\n### `request_plugin_install`\n# Suggest a recommended plugin installation\n\nUse this tool only when all of the following are true:\n- The user explicitly asks to use a specific plugin that is not already available in the current context or active `tools` list.\n- Tool search has already been exhausted and did not find or make the requested tool callable.\n- The plugin is listed in `<recommended_plugins>`.\n\nDo not use it for adjacent capabilities, broad recommendations, or plugins that merely seem useful. Briefly explain why the plugin can help with the current request in `suggest_reason`.\n\nIMPORTANT: DO NOT call this tool in parallel with other tools.\n\nexec tool declaration:\n```ts\ndeclare const tools: { request_plugin_install(args: {\n // The parenthesized plugin ID from the `<recommended_plugins>` list.\n plugin_id: string;\n // Concise one-line user-facing reason why this plugin can help with the current request.\n suggest_reason: string;\n}): Promise<unknown>; };\n```\n\n### `update_goal`\nUpdate the existing goal.\nSet status to `paused` only at the user's explicit request to pause this goal, never on your own initiative. Ask if unclear; a later resume revokes that request. Report the returned status and stop goal work. Budget limits take precedence over pausing.\nSet status to `complete` only when the objective has actually been achieved and no required work remains.\nSet status to `blocked` only when the same blocking condition has repeated for at least three consecutive goal turns, counting the original/user-triggered turn and any automatic continuations, and the agent cannot make meaningful progress without user input or an external-state change.\nIf the user resumes a goal that was previously marked `blocked`, treat the resumed run as a fresh blocked audit. If the same blocking condition then repeats for at least three consecutive resumed goal turns, set status to `blocked` again.\nOnce the blocked threshold is satisfied, do not keep reporting that you are still blocked while leaving the goal active; set status to `blocked`.\nDo not use `blocked` merely because the work is hard, slow, uncertain, incomplete, or would benefit from clarification.\nDo not mark a goal complete merely because its budget is nearly exhausted or because you are stopping work.\nYou cannot use this tool to resume, budget-limit, or usage-limit a goal; those status changes are controlled by the user or system.\nWhen marking a budgeted goal achieved with status `complete`, report the final token usage from the tool result to the user.\n\nexec tool declaration:\n```ts\ndeclare const tools: { update_goal(args: {\n // Required. `paused` requires an explicit user request. Set to `complete` only when the objective is achieved and no required work remains. Set to `blocked` only after the same blocking condition has recurred for at least three consecutive goal turns and the agent is at an impasse. After a previously blocked goal is resumed, the resumed run starts a fresh blocked audit.\n status: \"complete\" | \"blocked\" | \"paused\";\n}): Promise<unknown>; };\n```\n\n### `view_image`\nView a local image file from the filesystem when visual inspection is needed. Use this for images already available on disk.\n\nexec tool declaration:\n```ts\ndeclare const tools: { view_image(args: {\n // Image detail level. Defaults to `high`; use `original` to preserve exact resolution.\n detail?: \"high\" | \"original\";\n // Local filesystem path to an image file.\n path: string;\n}): Promise<{\n // Image detail hint returned by view_image. Returns `high` for default resized behavior or `original` when original resolution is preserved.\n detail: \"high\" | \"original\";\n // Data URL for the loaded image.\n image_url: string;\n}>; };\n```\n\n### `write_stdin`\nWrites characters to an existing unified exec session and returns recent output.\n\nexec tool declaration:\n```ts\ndeclare const tools: { write_stdin(args: {\n // Bytes to write to stdin. Defaults to empty, which polls without writing.\n chars?: string;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Identifier of the running unified exec session.\n session_id: number;\n // Wait before yielding output. Non-empty writes default to 250 ms and cap at 30000 ms; empty polls wait 5000-300000 ms by default.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n## clock\nTools for reading and waiting on time.\n\n### `clock__curr_time`\nReturn the current time in UTC.\n\nexec tool declaration:\n```ts\ndeclare const tools: { clock__curr_time(args: {}): Promise<{\n // Current UTC time formatted as YYYY-MM-DD HH:MM:SS UTC.\n current_time: string;\n}>; };\n```\n\n## image_gen\nTools in the image_gen namespace.\n\n### `image_gen__imagegen`\nThe `image_gen.imagegen` tool enables image generation from descriptions and editing of existing images based on specific instructions. Use it when:\n\n- The user requests an image based on a scene description, such as a diagram, portrait, comic, meme, or any other visual.\n- The user wants to modify an attached or previously generated image with specific changes, including adding or removing elements, altering colors, improving quality/resolution, or transforming the style (e.g., cartoon, oil painting).\n\nGuidelines:\n- imagegen needs a few minutes to finish. In code-mode, use the first-line @exec directive to give the initial call 120 seconds and the same yield for any waits that follow. Once it finishes, return the image with generatedImage(result).\n- Avoid printing the full result or its base64 image data with `text()` or `notify()`; print only small metadata when needed.\n- Set `transparent_background` to true when the request calls for a transparent background, including background removal or a cutout; set it to false otherwise. For edits, preserve existing transparency unless the user asks to change it.\n- Omit both `referenced_image_paths` and `num_last_images_to_include` when generating a brand new image.\n- For edits, use `referenced_image_paths` when every target image has a local file path.\n- If you have not seen a local image yet, use `view_image` to inspect it before editing.\n- Use `num_last_images_to_include` only when at least one target image has no local file path.\n- Set `num_last_images_to_include` to the smallest number of recent conversation images that includes every target image, up to 5.\n- Never provide both `referenced_image_paths` and `num_last_images_to_include`.\n- If neither mechanism can include every target image, ask the user to attach the missing images again.\n- Directly generate the image without reconfirmation or clarification unless required images must be attached again.\n- Always use this tool for image editing unless the user explicitly requests otherwise. Do not use the `python` tool for image editing unless specifically instructed.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { image_gen__imagegen(args: {\n num_last_images_to_include?: number | null;\n prompt: string;\n referenced_image_paths?: Array<string> | null;\n // Whether the output should have a transparent background. Defaults to false.\n transparent_background?: boolean;\n}): Promise<unknown>; };\n```\n\n## web\nTools in the web namespace.\n\n### `web__run`\nTool for accessing the internet.\n\n\n---\n\n## Examples of different commands available in this tool\n\nExamples of different commands available in this tool:\n* `search_query`: {\"search_query\": [{\"q\": \"What is the capital of France?\"}, {\"q\": \"What is the capital of belgium?\"}]}. Searches the internet for a given query (and optionally with a domain or recency filter)\n* `image_query`: {\"image_query\":[{\"q\": \"waterfalls\"}]}.\n* `open`: {\"open\": [{\"ref_id\": \"turn0search0\"}, {\"ref_id\": \"https://www.openai.com\", \"lineno\": 120}]}\n* `click`: {\"click\": [{\"ref_id\": \"turn0fetch3\", \"id\": 17}]}\n* `find`: {\"find\": [{\"ref_id\": \"turn0fetch3\", \"pattern\": \"Annie Case\"}]}\n* `screenshot`: {\"screenshot\": [{\"ref_id\": \"turn1view0\", \"pageno\": 0}, {\"ref_id\": \"turn1view0\", \"pageno\": 3}]}\n* `finance`: {\"finance\":[{\"ticker\":\"AMD\",\"type\":\"equity\",\"market\":\"USA\"}]}, {\"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}]}\n* `weather`: {\"weather\":[{\"location\":\"San Francisco, CA\"}]}\n* `sports`: {\"sports\":[{\"fn\":\"standings\",\"league\":\"nfl\"}, {\"fn\":\"schedule\",\"league\":\"nba\",\"team\":\"GSW\",\"date_from\":\"2025-02-24\"}]}\n* `time`: {\"time\":[{\"utc_offset\":\"+03:00\"}]}\n\n---\n\n## Usage hints\nTo use this tool efficiently:\n* Use multiple commands and queries in one call to get more results faster; e.g. {\"search_query\": [{\"q\": \"bitcoin news\"}], \"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}], \"find\": [{\"ref_id\": \"turn0search0\", \"pattern\": \"Annie Case\"}, {\"ref_id\": \"turn0search1\", \"pattern\": \"John Smith\"}]}\n* Use \"response_length\" to control the number of results returned by this tool, omit it if you intend to pass \"short\" in\n* Only write required parameters; do not write empty lists or nulls where they could be omitted.\n* `search_query` must have length at most 4 in each call. If it has length > 3, response_length must be medium or long\n* If you find yourself in a situation where you accidentally call the `web.run` tool, it's best just to send an empty query: {\"search_query\": [{\"q\": \"\"}]}.\n\n---\n\n## Decision boundary\n\nIf the user makes an explicit request to search the internet, find latest information, look up, etc (or to not do so), you must obey their request.\nWhen you make an assumption, always consider whether it is temporally stable; i.e. whether there's even a small (>10%) chance it has changed. If it is unstable, you must verify with browsing the internet for verification.\n\n<situations_where_you_must_browse_the_internet>\nBelow is a list of scenarios where browsing the internet MUST be used. PAY CLOSE ATTENTION: you MUST browse the internet in these cases. If you're unsure or on the fence, you MUST bias towards browsing the internet.\n- The information could have changed recently: for example news; prices; laws; schedules; product specs; sports scores; economic indicators; political/public/company figures (e.g. the question relates to 'the president of country A' or 'the CEO of company B', which might change over time); rules; regulations; standards; software libraries that could be updated; exchange rates; recommendations (i.e., recommendations about various topics or things might be informed by what currently exists / is popular / is safe / is unsafe / is in the zeitgeist / etc.); and many many many more categories -- again, if you're on the fence, you MUST browse the internet!\n - For news queries, prioritize more recent events, ensuring you compare publish dates and the date that the event happened.\n- The user is seeking recommendations that could lead them to spend substantial time or money -- researching products, restaurants, travel plans, etc.\n- The user wants (or would benefit from) direct quotes, links, or precise source attribution.\n- A specific page, paper, dataset, PDF, or site is referenced and you haven't been given its contents.\n- You're unsure about a fact, the topic is niche or emerging, or you suspect there's at least a 10% chance you will incorrectly recall it\n- High-stakes accuracy matters (medical, legal, financial guidance). For these you generally should search by default because this information is highly temporally unstable\n- The user explicitly says to search, browse, verify, or look it up.\n</situations_where_you_must_browse_the_internet>\n\n---\n\n## Citations\n\nResults from `web.run` include internal reference IDs such as `turn2search5`. Use\nthose reference IDs only in calls to `web.run`; do not expose them in the final\nresponse.\n\nCite sources in the final response using Markdown links:\n\n- Cite a single source as `[descriptive source title](https://example.com/page)`.\n- Cite multiple sources with separate Markdown links, for example\n `[first source](https://example.com/one), [second source](https://example.com/two)`.\n- Link directly to the page that supports the claim. Do not link to search result\n pages or use bare URLs.\n\nFormatting of citations:\n\n- Place each citation as near as possible to the claim it supports, normally at\n the end of the sentence or paragraph and after punctuation.\n- Do not place citations inside code fences.\n- Do not put citations on a line by themselves or collect all citations at the\n end of the response.\n\nIf you browse the internet, cite statements supported by web sources. Each cited\nsource must directly support the associated claim. Prefer primary and\nauthoritative sources, and use sources from different domains when the response\nbenefits from multiple perspectives.\n\n---\n\n## Special cases\nIf these conflict with any other instructions, these should take precedence.\n\n<special_cases>\n- When the user asks for information about how to use OpenAI products, (ChatGPT, the OpenAI API, etc.), you should check the code in local env and only browse as fallback, when you browse restrict your sources to official OpenAI websites using the domains filter, unless otherwise requested.\n- When using search to answer technical questions, you must only rely on primary sources (research papers, official documentation, etc.)\n- Clearly indicate when you are making an inference from sources.\n</special_cases>\n\n---\n\n## Word limits\nResponses may not excessively quote or draw on a specific source. There are several limits here:\n- **Limit on verbatim quotes:**\n - You may not quote more than 25 words verbatim from any single non-lyrical source, unless the source is reddit.\n - For song lyrics, verbatim quotes must be limited to at most 10 words.\n - Long quotes from reddit are allowed, as long as you indicate that those are direct quotes via a markdown blockquote starting with \">\", copy verbatim, and link the source.\n- **Word limits:**\n - Each webpage source in the sources has a word limit label formatted like \"[wordlim N]\", in which N is the maximum number of words in the whole response that are attributed to that source. If omitted, the word limit is 200 words.\n - Non-contiguous words derived from a given source must be counted to the word limit.\n - The summarization limit N is a maximum for each source.\n - When using multiple sources, their summarization limits add together. However, each article used must be relevant to the response.\n- **Copyright compliance:**\n - You must avoid providing full articles, long verbatim passages, or extensive direct quotes due to copyright concerns.\n - If the user asked for a verbatim quote, the response should provide a short compliant excerpt and then answer with paraphrases and summaries.\n - Again, this limit does not apply to reddit content, as long as it's appropriately indicated that those are direct quotes and you link to the source.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { web__run(args: {\n // Open links from previously opened pages.\n click?: Array<{\n // Numbered link id to open.\n id: number;\n // Reference id containing the numbered link.\n ref_id: string;\n}>;\n // Look up prices for the given stock symbols.\n finance?: Array<{\n // ISO 3166-1 alpha-3 country code, \"OTC\", or \"\" for cryptocurrency.\n market?: string;\n // Ticker symbol to look up.\n ticker: string;\n // Asset type to look up.\n type: \"equity\" | \"fund\" | \"crypto\" | \"index\";\n}>;\n // Find text patterns in pages.\n find?: Array<{\n // Text pattern to find.\n pattern: string;\n // Reference id or URL to search within.\n ref_id: string;\n}>;\n // Query the image search engine for a given list of queries.\n image_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Open pages by reference id or URL.\n open?: Array<{\n // Line number to position the page at.\n lineno?: number;\n // Reference id or URL to open.\n ref_id: string;\n}>;\n // Set the length of the response to be returned.\n response_length?: \"short\" | \"medium\" | \"long\";\n // Take screenshots of PDF pages.\n screenshot?: Array<{\n // Zero-indexed PDF page number.\n pageno: number;\n // Reference id or URL to screenshot.\n ref_id: string;\n}>;\n // Query the internet search engine for a given list of queries.\n search_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Look up sports schedules and standings.\n sports?: Array<{\n // Start date in YYYY-MM-DD format.\n date_from?: string;\n // End date in YYYY-MM-DD format.\n date_to?: string;\n // Sports function to call.\n fn: \"schedule\" | \"standings\";\n // League to look up.\n league: \"nba\" | \"wnba\" | \"nfl\" | \"nhl\" | \"mlb\" | \"epl\" | \"ncaamb\" | \"ncaawb\" | \"ipl\";\n // Locale for the lookup.\n locale?: string;\n // Number of games to return.\n num_games?: number;\n // Opponent to use with `team` when narrowing the lookup.\n opponent?: string;\n // Team to look up, using the common 3 or 4 letter alias used in broadcasts.\n team?: string;\n // Tool name for sports requests.\n tool?: \"sports\";\n}>;\n // Get time for the given UTC offsets.\n time?: Array<{\n // UTC offset formatted like \"+03:00\".\n utc_offset: string;\n}>;\n // Look up weather forecasts.\n weather?: Array<{\n // Number of days to return. Defaults to 7.\n duration?: number;\n // Location in \"Country, Area, City\" format.\n location: string;\n // Start date in YYYY-MM-DD format. Defaults to today.\n start?: string;\n}>;\n}): Promise<unknown>; };\n```","format":{"type":"grammar","syntax":"lark","definition":"\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"}}]},{"type":"namespace","name":"clock","description":"Tools for reading and waiting on time.","tools":[{"type":"function","strict":false,"name":"sleep","description":"Pause execution for a specified duration. The sleep ends early when new input arrives for the active turn. Returns the elapsed wall-clock time.","output_schema":null,"parameters":{"type":"object","properties":{"duration_ms":{"type":"number","description":"How long to sleep in milliseconds. Must be between 1 and 43200000."}},"required":["duration_ms"],"additionalProperties":false}}]},{"type":"namespace","name":"collaboration","description":"Tools for spawning and managing sub-agents.","tools":[{"type":"function","strict":false,"name":"followup_task","description":"Send a follow-up task to an existing non-root target agent and trigger a turn if it is idle. If the target is already running, deliver the task promptly at message boundaries while sampling, or after the pending tool call completes.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to send to the target agent.","encrypted":true},"target":{"type":"string","description":"Agent id or canonical task name to send a follow-up task to (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"interrupt_agent","description":"Interrupt an agent's current turn, if any, and return its previous status. The agent remains available for messages and follow-up tasks.","output_schema":null,"parameters":{"type":"object","properties":{"target":{"type":"string","description":"Agent id or canonical task name to interrupt (from spawn_agent)."}},"required":["target"],"additionalProperties":false}},{"type":"function","strict":false,"name":"list_agents","description":"List live agents in the current root thread tree. Optionally filter by task-path prefix.","output_schema":null,"parameters":{"type":"object","properties":{"path_prefix":{"type":"string","description":"Task-path prefix filter without a trailing slash. Omit to list all live agents."}},"additionalProperties":false}},{"type":"function","strict":false,"name":"send_message","description":"Send a message to an existing agent. The message will be delivered promptly. Does not trigger a new turn.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to queue on the target agent.","encrypted":true},"target":{"type":"string","description":"Relative or canonical task name to message (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"spawn_agent","description":"\n Available model overrides (optional; inherited parent model is preferred):\n- `gpt-6.1-sol`: Latest workhorse model for coding and everyday work. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-astra`: Frontier intelligence for the most demanding work. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-sol`: Previous generation workhorse model. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-luna`: Fast and affordable model for easier tasks. Reasoning efforts: low, medium (default), high, xhigh, max. Service tiers: priority.\n- `gpt-5.6-sol`: Older generation workhorse model. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n Spawns an agent to work on the specified task. If your current task is `/root/task1` and you spawn_agent with task_name \"task_3\" the agent will have canonical task name `/root/task1/task_3`.\nYou are then able to refer to this agent as `task_3` or `/root/task1/task_3` interchangeably. However an agent `/root/task2/task_3` would only be able to communicate with this agent via its canonical name `/root/task1/task_3`.\nThe spawned agent will have the same tools as you and the ability to spawn its own subagents.\n\nIt will be able to send you and other running agents messages, and its final answer will be provided to you when it finishes.\nThe new agent's canonical task name will be provided to it along with the message.\n\nNote that passing `fork_turns=\"none\"` will not pass any surrounding context to the spawned subagent, which may cause the agent to lack the context it needs to complete its task, whereas `fork_turns=\"all\"` will provide the subagent with all surrounding context.","output_schema":null,"parameters":{"type":"object","properties":{"fork_turns":{"type":"string","description":"Optional number of turns to fork. Defaults to `all`. Use `none`, `all`, or a positive integer string such as `3` to fork only the most recent turns."},"message":{"type":"string","description":"Initial plain-text task for the new agent.","encrypted":true},"model":{"type":"string","description":"Model override for the new agent. Omit unless an explicit override is needed."},"reasoning_effort":{"type":"string","description":"Reasoning effort override for the new agent. Omit to inherit the parent effort."},"task_name":{"type":"string","description":"Task name for the new agent. Use lowercase letters, digits, and underscores."}},"required":["task_name","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"wait_agent","description":"Wait for a mailbox update from any live agent, including queued messages and final-status notifications. The wait also ends early when new user input is steered into the active turn. Does not return the content; returns either a summary of which agents have updates (if any), an interruption summary for steered input, or a timeout summary if no activity arrives before the deadline.","output_schema":null,"parameters":{"type":"object","properties":{"timeout_ms":{"type":"number","description":"Timeout in milliseconds. Defaults to 30000, min 10000, max 3600000."}},"additionalProperties":false}}]},{"type":"namespace","name":"mcp__cua_repl","description":"UI automation through cua_repl using the initialized cua API.","tools":[{"type":"function","strict":false,"name":"js","description":"Control native apps or browsers on the user’s computer by reading or operating UI. Prefer purpose-built skills, connectors, APIs, or CLIs when available.\n\nOn the first invocation of `cua_repl`, or after resetting it, execute exactly one of the API calls shown below, optionally assigning its result to a variable. Do not add other API calls, waits, or snapshots to that invocation.\nThe tool result will include documentation and, when creating or selecting a tab or selecting an app, its initial UI state. Selecting a browser does not open a tab. Read that result before continuing.\nUse only APIs described in the tool instructions or returned documentation.\n\nWhen you need an inventory of available apps, browsers, and tabs, get a snapshot of all enabled surfaces. Otherwise, use the relevant entry point below:\n\n```javascript\nawait cua.getState();\n```\n\nUse the first matching browser control option from the user's request:\n\nFor a tab @-mention (`mention=tab-v1`):\nPass the complete `plugin://...` URL to get the referenced tab.\n\n```javascript\nlet tab = await cua.getTab({ mention: tabMentionUrl });\n```\n\nFor an existing tab identified by URL in browser context (including the current IAB tab):\n\n```javascript\nlet tab = await cua.getTab({ url }, { browser: browserId });\n```\n\nKnown tab ID (`tabId` or `providerTabId`) and browser (name or browser @-mention):\n\n```javascript\nlet tab = await cua.getTab(tabId, { browser: browserId });\n```\n\nTo open a URL in the in-app browser (`@Browser`):\n\n```javascript\nlet tab = await cua.createBrowserTab(\"iab\", url, { visible: boolean });\n```\n\nTo open a URL in another named browser: pass its name directly; do not call `getBrowser` first.\n\n```javascript\nlet tab = await cua.createBrowserTab(browserName, url, browserOptions);\n```\n\nKnown URL, only when the user has not specified a browser by name or @-mention:\n\n```javascript\nlet browser = await cua.getBrowser({ url });\n```\n\nBrowser IDs and options:\n\n- `\"mcpapps\"`: use `cua.getBrowser({ id: \"mcpapps\" })` for existing full-screen MCP Apps in the task’s side panel.\n- `\"iab\"` (in-app browser): in `createBrowserTab`, use `visible: true` to show the browser; `false` to keep it hidden.\n- `\"dot\"` (Dot): use only when present in browser inventory. It accesses tabs on Dot's active main thread. `cua.getTab(tabId, { browser: \"dot\" })` claims an existing tab; `cua.createBrowserTab(\"dot\", url, { visible: boolean })` creates one with the same visibility options as `\"iab\"`.\n- `\"chrome\"` (@Chrome), `\"edge\"` (@Edge): pass a short, emoji-prefixed `sessionName` (e.g. `\"🔎 Task\"`) to `createBrowserTab` when starting a task.\n\nIf the user specifies an app to use, get the app by name, bundle ID, or path:\n\n```javascript\nlet app = await cua.getApp(\"Example App\");\n```\n\nTo add other content to the tool result, use `nodeRepl.write(value)` for text or other values and `await nodeRepl.emitImage(image)` for images. The APIs listed above already display their documentation or UI state; do not wrap their results in `write` or `emitImage`.\n\nIf your context begins with a summary of an existing computer use task, call `await cua.rewriteDocumentation()` before continuing the computer use task to ensure you have a complete view of the necessary documentation. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{"code":{"type":"string","description":"JavaScript to execute using the initialized cua_repl runtime."},"timeout_ms":{"type":"integer","description":"Optional execution timeout in milliseconds. Defaults to 30000 (30 seconds) when omitted."},"title":{"type":"string","description":"Short user-facing description of what the code does."}},"required":["code"],"additionalProperties":false}},{"type":"function","strict":false,"name":"js_reset","description":"Reset the persistent cua_repl JavaScript session. All JavaScript bindings are discarded. The next cua_repl.js call initializes a fresh runtime for the enabled surfaces. This does not close browser tabs or native apps, or erase their state. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{},"additionalProperties":false}}]}],"tool_choice":"auto","parallel_tool_calls":false,"prompt_cache_key":"01a14530-0099-7142-8981-e5e98a2373b1","prompt_cache_retention":"24h","text":{"format":{"type":"text"},"verbosity":"low"},"top_p":0.98,"top_logprobs":0,"temperature":1.0,"reasoning":{"effort":"low","context":"all_turns","summary":null,"mode":"standard"},"user":null,"usage":null,"tool_usage":{"image_gen":{"input_tokens":0,"output_tokens":0,"total_tokens":0,"input_tokens_details":{"text_tokens":0,"image_tokens":0},"output_tokens_details":{"image_tokens":0,"text_tokens":0}},"web_search":{"num_requests":0}},"safety_identifier":"user-LCV4XMHz3BRmrwLTeTQWC5P7","store":false,"metadata":{},"max_output_tokens":null,"max_tool_calls":null,"service_tier":"auto","truncation":"disabled"}}++event: response.in_progress+data: {"type":"response.in_progress","sequence_number":1,"safety_buffering":false,"response":{"id":"resp_07438c2e31b28b62016ad2396120848191928cb5504aad5871","object":"response","created_at":1792162145,"completed_at":null,"status":"in_progress","background":false,"frequency_penalty":0.0,"presence_penalty":0.0,"moderation":null,"model":"gpt-6.1-sol","access_programs":{"cyber":"standard"},"previous_response_id":null,"instructions":null,"output":[],"error":null,"incomplete_details":null,"tools":[{"type":"namespace","name":"functions","description":"","tools":[{"type":"function","strict":false,"name":"wait","description":"Waits on a yielded `exec` cell and returns new output or completion.\n- Use `wait` only after `exec` returns `Script running with cell ID ...`.\n- `cell_id` identifies the running `exec` cell to resume.\n- `yield_time_ms` controls how long to wait for more output before yielding again. Defaults to 10000 ms.\n- `max_tokens` limits how much new output this wait call returns. Defaults to 10000 tokens.\n- `terminate: true` stops the running cell; false or omitted waits for output.\n- `wait` returns only the new output since the last yield, or the final completion or termination result for that cell.\n- If the cell is still running, `wait` may yield again with the same `cell_id`.\n- If the cell has already finished, `wait` returns the completed result and closes the cell.","output_schema":null,"parameters":{"type":"object","properties":{"cell_id":{"type":"string","description":"Identifier of the running exec cell."},"max_tokens":{"type":"number","description":"Output token budget for this wait call. Defaults to 10000 tokens."},"terminate":{"type":"boolean","description":"True stops the running exec cell; false or omitted waits for output."},"yield_time_ms":{"type":"number","description":"Wait before yielding more output. Defaults to 10000 ms."}},"required":["cell_id"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input","description":"Request user input for one to three short questions and wait for the response. This tool is only available in Plan mode.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"Questions to show the user. Prefer 1 and do not exceed 3","items":{"type":"object","properties":{"header":{"type":"string","description":"Short header label shown in the UI (12 or fewer chars)."},"id":{"type":"string","description":"Stable identifier for mapping answers (snake_case)."},"options":{"type":"array","description":"Provide 2-3 mutually exclusive choices. Put the recommended option first and suffix its label with \"(Recommended)\". Do not include an \"Other\" option in this list; the client will add a free-form \"Other\" option automatically.","items":{"type":"object","properties":{"description":{"type":"string","description":"One short sentence explaining impact/tradeoff if selected."},"label":{"type":"string","description":"User-facing label (1-5 words)."}},"required":["label","description"],"additionalProperties":false}},"question":{"type":"string","description":"Single-sentence prompt shown to the user."}},"required":["id","header","question","options"],"additionalProperties":false}}},"required":["questions"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input_async","description":"Ask the user one or more questions during ongoing work. Use this tool only to request missing information, preferences, constraints, clarification, or approval. The tool returns immediately without ending the turn or waiting for a reply; any reply arrives asynchronously as a new user message. Keep questions concise, self-contained, and easy to understand, using a level of detail appropriate to the user and task. The UI always allows a free-text answer, including when suggested options are provided. A preselected option is not submitted automatically.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"One or more self-contained questions to present together, in display order.","items":{"type":"object","properties":{"options":{"type":"array","description":"Suggested answers, in display order. Put the recommended answer first; the first option is preselected by default. The user can select one option or enter a free-text answer. Do not include an Other option or a free-text placeholder; the UI provides free-text input automatically. Omit options for a free-text-only question.","items":{"type":"string"},"minItems":1},"title":{"type":"string","description":"The complete question shown to the user, including any context needed to answer it."}},"required":["title"],"additionalProperties":false},"minItems":1}},"required":["questions"],"additionalProperties":false}},{"type":"custom","name":"exec","description":"Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\nShared MCP Types:\n```ts\ntype Role = \"user\" | \"assistant\";\ntype MetaObject = Record<string, unknown>;\ntype Annotations = {\n audience?: Role[];\n priority?: number;\n lastModified?: string;\n};\ntype Icon = {\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n};\ntype TextResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n text: string;\n};\ntype BlobResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n blob: string;\n};\ntype TextContent = {\n type: \"text\";\n text: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ImageContent = {\n type: \"image\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype AudioContent = {\n type: \"audio\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ResourceLink = {\n icons?: Icon[];\n name: string;\n title?: string;\n uri: string;\n description?: string;\n mimeType?: string;\n annotations?: Annotations;\n size?: number;\n _meta?: MetaObject;\n type: \"resource_link\";\n};\ntype EmbeddedResource = {\n type: \"resource\";\n resource: TextResourceContents | BlobResourceContents;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ContentBlock =\n | TextContent\n | ImageContent\n | AudioContent\n | ResourceLink\n | EmbeddedResource;\ntype CallToolResult<TStructured = { [key: string]: unknown }> = {\n _meta?: MetaObject;\n content: ContentBlock[];\n isError?: boolean;\n structuredContent?: TStructured;\n [key: string]: unknown;\n};\n```\n\n### `apply_patch`\nThe `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.\n\nexec tool declaration:\n```ts\ndeclare const tools: { apply_patch(input: string): Promise<unknown>; };\n```\n\n### `create_goal`\nCreate a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks.\nSet token_budget only when an explicit token budget is requested. Fails if an unfinished goal exists; use update_goal only for status.\n\nexec tool declaration:\n```ts\ndeclare const tools: { create_goal(args: {\n // Required. The concrete objective to start pursuing. This starts a new active goal when no goal exists or replaces the current goal when it is complete.\n objective: string;\n // Positive token budget for the new goal. Omit unless explicitly requested.\n token_budget?: number;\n}): Promise<unknown>; };\n```\n\n### `exec_command`\nRuns a command in a PTY, returning output or a session ID for ongoing interaction.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n // Shell command to execute.\n cmd: string;\n // User-facing approval question for `require_escalated`; omit otherwise.\n justification?: string;\n // True runs the shell with -l/-i semantics; false disables them. Defaults to true.\n login?: boolean;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Reusable approval prefix for `cmd`, only with `sandbox_permissions: \"require_escalated\"`; for example [\"git\", \"pull\"].\n prefix_rule?: Array<string>;\n // Per-command sandbox override. Defaults to `use_default`; use `require_escalated` for unsandboxed execution.\n sandbox_permissions?: \"use_default\" | \"require_escalated\";\n // Shell binary to launch. Defaults to the user's default shell.\n shell?: string;\n // True allocates a PTY for the command; false or omitted uses plain pipes.\n tty?: boolean;\n // Working directory for the command. Defaults to the turn cwd.\n workdir?: string;\n // Wait before yielding output. Defaults to 10000 ms; effective range is 250-30000 ms.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n### `get_goal`\nGet the current goal for this thread, including status, budgets, token and elapsed-time usage, and remaining token budget.\n\nexec tool declaration:\n```ts\ndeclare const tools: { get_goal(args: {}): Promise<unknown>; };\n```\n\n### `list_mcp_resource_templates`\nLists resource templates provided by MCP servers. Parameterized resource templates allow servers to share data that takes parameters and provides context to language models, such as files, database schemas, or application-specific information. Prefer resource templates over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resource_templates(args: {\n // Opaque cursor from a previous list_mcp_resource_templates call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resource templates from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `list_mcp_resources`\nLists resources provided by MCP servers. Resources allow servers to share data that provides context to language models, such as files, database schemas, or application-specific information. Prefer resources over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resources(args: {\n // Opaque cursor from a previous list_mcp_resources call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resources from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `read_mcp_resource`\nRead a specific resource from an MCP server given the server name and resource URI.\n\nexec tool declaration:\n```ts\ndeclare const tools: { read_mcp_resource(args: {\n // MCP server name exactly as configured. Must match the 'server' field returned by list_mcp_resources.\n server: string;\n // Resource URI to read. Must be one of the URIs returned by list_mcp_resources.\n uri: string;\n}): Promise<unknown>; };\n```\n\n### `request_plugin_install`\n# Suggest a recommended plugin installation\n\nUse this tool only when all of the following are true:\n- The user explicitly asks to use a specific plugin that is not already available in the current context or active `tools` list.\n- Tool search has already been exhausted and did not find or make the requested tool callable.\n- The plugin is listed in `<recommended_plugins>`.\n\nDo not use it for adjacent capabilities, broad recommendations, or plugins that merely seem useful. Briefly explain why the plugin can help with the current request in `suggest_reason`.\n\nIMPORTANT: DO NOT call this tool in parallel with other tools.\n\nexec tool declaration:\n```ts\ndeclare const tools: { request_plugin_install(args: {\n // The parenthesized plugin ID from the `<recommended_plugins>` list.\n plugin_id: string;\n // Concise one-line user-facing reason why this plugin can help with the current request.\n suggest_reason: string;\n}): Promise<unknown>; };\n```\n\n### `update_goal`\nUpdate the existing goal.\nSet status to `paused` only at the user's explicit request to pause this goal, never on your own initiative. Ask if unclear; a later resume revokes that request. Report the returned status and stop goal work. Budget limits take precedence over pausing.\nSet status to `complete` only when the objective has actually been achieved and no required work remains.\nSet status to `blocked` only when the same blocking condition has repeated for at least three consecutive goal turns, counting the original/user-triggered turn and any automatic continuations, and the agent cannot make meaningful progress without user input or an external-state change.\nIf the user resumes a goal that was previously marked `blocked`, treat the resumed run as a fresh blocked audit. If the same blocking condition then repeats for at least three consecutive resumed goal turns, set status to `blocked` again.\nOnce the blocked threshold is satisfied, do not keep reporting that you are still blocked while leaving the goal active; set status to `blocked`.\nDo not use `blocked` merely because the work is hard, slow, uncertain, incomplete, or would benefit from clarification.\nDo not mark a goal complete merely because its budget is nearly exhausted or because you are stopping work.\nYou cannot use this tool to resume, budget-limit, or usage-limit a goal; those status changes are controlled by the user or system.\nWhen marking a budgeted goal achieved with status `complete`, report the final token usage from the tool result to the user.\n\nexec tool declaration:\n```ts\ndeclare const tools: { update_goal(args: {\n // Required. `paused` requires an explicit user request. Set to `complete` only when the objective is achieved and no required work remains. Set to `blocked` only after the same blocking condition has recurred for at least three consecutive goal turns and the agent is at an impasse. After a previously blocked goal is resumed, the resumed run starts a fresh blocked audit.\n status: \"complete\" | \"blocked\" | \"paused\";\n}): Promise<unknown>; };\n```\n\n### `view_image`\nView a local image file from the filesystem when visual inspection is needed. Use this for images already available on disk.\n\nexec tool declaration:\n```ts\ndeclare const tools: { view_image(args: {\n // Image detail level. Defaults to `high`; use `original` to preserve exact resolution.\n detail?: \"high\" | \"original\";\n // Local filesystem path to an image file.\n path: string;\n}): Promise<{\n // Image detail hint returned by view_image. Returns `high` for default resized behavior or `original` when original resolution is preserved.\n detail: \"high\" | \"original\";\n // Data URL for the loaded image.\n image_url: string;\n}>; };\n```\n\n### `write_stdin`\nWrites characters to an existing unified exec session and returns recent output.\n\nexec tool declaration:\n```ts\ndeclare const tools: { write_stdin(args: {\n // Bytes to write to stdin. Defaults to empty, which polls without writing.\n chars?: string;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Identifier of the running unified exec session.\n session_id: number;\n // Wait before yielding output. Non-empty writes default to 250 ms and cap at 30000 ms; empty polls wait 5000-300000 ms by default.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n## clock\nTools for reading and waiting on time.\n\n### `clock__curr_time`\nReturn the current time in UTC.\n\nexec tool declaration:\n```ts\ndeclare const tools: { clock__curr_time(args: {}): Promise<{\n // Current UTC time formatted as YYYY-MM-DD HH:MM:SS UTC.\n current_time: string;\n}>; };\n```\n\n## image_gen\nTools in the image_gen namespace.\n\n### `image_gen__imagegen`\nThe `image_gen.imagegen` tool enables image generation from descriptions and editing of existing images based on specific instructions. Use it when:\n\n- The user requests an image based on a scene description, such as a diagram, portrait, comic, meme, or any other visual.\n- The user wants to modify an attached or previously generated image with specific changes, including adding or removing elements, altering colors, improving quality/resolution, or transforming the style (e.g., cartoon, oil painting).\n\nGuidelines:\n- imagegen needs a few minutes to finish. In code-mode, use the first-line @exec directive to give the initial call 120 seconds and the same yield for any waits that follow. Once it finishes, return the image with generatedImage(result).\n- Avoid printing the full result or its base64 image data with `text()` or `notify()`; print only small metadata when needed.\n- Set `transparent_background` to true when the request calls for a transparent background, including background removal or a cutout; set it to false otherwise. For edits, preserve existing transparency unless the user asks to change it.\n- Omit both `referenced_image_paths` and `num_last_images_to_include` when generating a brand new image.\n- For edits, use `referenced_image_paths` when every target image has a local file path.\n- If you have not seen a local image yet, use `view_image` to inspect it before editing.\n- Use `num_last_images_to_include` only when at least one target image has no local file path.\n- Set `num_last_images_to_include` to the smallest number of recent conversation images that includes every target image, up to 5.\n- Never provide both `referenced_image_paths` and `num_last_images_to_include`.\n- If neither mechanism can include every target image, ask the user to attach the missing images again.\n- Directly generate the image without reconfirmation or clarification unless required images must be attached again.\n- Always use this tool for image editing unless the user explicitly requests otherwise. Do not use the `python` tool for image editing unless specifically instructed.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { image_gen__imagegen(args: {\n num_last_images_to_include?: number | null;\n prompt: string;\n referenced_image_paths?: Array<string> | null;\n // Whether the output should have a transparent background. Defaults to false.\n transparent_background?: boolean;\n}): Promise<unknown>; };\n```\n\n## web\nTools in the web namespace.\n\n### `web__run`\nTool for accessing the internet.\n\n\n---\n\n## Examples of different commands available in this tool\n\nExamples of different commands available in this tool:\n* `search_query`: {\"search_query\": [{\"q\": \"What is the capital of France?\"}, {\"q\": \"What is the capital of belgium?\"}]}. Searches the internet for a given query (and optionally with a domain or recency filter)\n* `image_query`: {\"image_query\":[{\"q\": \"waterfalls\"}]}.\n* `open`: {\"open\": [{\"ref_id\": \"turn0search0\"}, {\"ref_id\": \"https://www.openai.com\", \"lineno\": 120}]}\n* `click`: {\"click\": [{\"ref_id\": \"turn0fetch3\", \"id\": 17}]}\n* `find`: {\"find\": [{\"ref_id\": \"turn0fetch3\", \"pattern\": \"Annie Case\"}]}\n* `screenshot`: {\"screenshot\": [{\"ref_id\": \"turn1view0\", \"pageno\": 0}, {\"ref_id\": \"turn1view0\", \"pageno\": 3}]}\n* `finance`: {\"finance\":[{\"ticker\":\"AMD\",\"type\":\"equity\",\"market\":\"USA\"}]}, {\"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}]}\n* `weather`: {\"weather\":[{\"location\":\"San Francisco, CA\"}]}\n* `sports`: {\"sports\":[{\"fn\":\"standings\",\"league\":\"nfl\"}, {\"fn\":\"schedule\",\"league\":\"nba\",\"team\":\"GSW\",\"date_from\":\"2025-02-24\"}]}\n* `time`: {\"time\":[{\"utc_offset\":\"+03:00\"}]}\n\n---\n\n## Usage hints\nTo use this tool efficiently:\n* Use multiple commands and queries in one call to get more results faster; e.g. {\"search_query\": [{\"q\": \"bitcoin news\"}], \"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}], \"find\": [{\"ref_id\": \"turn0search0\", \"pattern\": \"Annie Case\"}, {\"ref_id\": \"turn0search1\", \"pattern\": \"John Smith\"}]}\n* Use \"response_length\" to control the number of results returned by this tool, omit it if you intend to pass \"short\" in\n* Only write required parameters; do not write empty lists or nulls where they could be omitted.\n* `search_query` must have length at most 4 in each call. If it has length > 3, response_length must be medium or long\n* If you find yourself in a situation where you accidentally call the `web.run` tool, it's best just to send an empty query: {\"search_query\": [{\"q\": \"\"}]}.\n\n---\n\n## Decision boundary\n\nIf the user makes an explicit request to search the internet, find latest information, look up, etc (or to not do so), you must obey their request.\nWhen you make an assumption, always consider whether it is temporally stable; i.e. whether there's even a small (>10%) chance it has changed. If it is unstable, you must verify with browsing the internet for verification.\n\n<situations_where_you_must_browse_the_internet>\nBelow is a list of scenarios where browsing the internet MUST be used. PAY CLOSE ATTENTION: you MUST browse the internet in these cases. If you're unsure or on the fence, you MUST bias towards browsing the internet.\n- The information could have changed recently: for example news; prices; laws; schedules; product specs; sports scores; economic indicators; political/public/company figures (e.g. the question relates to 'the president of country A' or 'the CEO of company B', which might change over time); rules; regulations; standards; software libraries that could be updated; exchange rates; recommendations (i.e., recommendations about various topics or things might be informed by what currently exists / is popular / is safe / is unsafe / is in the zeitgeist / etc.); and many many many more categories -- again, if you're on the fence, you MUST browse the internet!\n - For news queries, prioritize more recent events, ensuring you compare publish dates and the date that the event happened.\n- The user is seeking recommendations that could lead them to spend substantial time or money -- researching products, restaurants, travel plans, etc.\n- The user wants (or would benefit from) direct quotes, links, or precise source attribution.\n- A specific page, paper, dataset, PDF, or site is referenced and you haven't been given its contents.\n- You're unsure about a fact, the topic is niche or emerging, or you suspect there's at least a 10% chance you will incorrectly recall it\n- High-stakes accuracy matters (medical, legal, financial guidance). For these you generally should search by default because this information is highly temporally unstable\n- The user explicitly says to search, browse, verify, or look it up.\n</situations_where_you_must_browse_the_internet>\n\n---\n\n## Citations\n\nResults from `web.run` include internal reference IDs such as `turn2search5`. Use\nthose reference IDs only in calls to `web.run`; do not expose them in the final\nresponse.\n\nCite sources in the final response using Markdown links:\n\n- Cite a single source as `[descriptive source title](https://example.com/page)`.\n- Cite multiple sources with separate Markdown links, for example\n `[first source](https://example.com/one), [second source](https://example.com/two)`.\n- Link directly to the page that supports the claim. Do not link to search result\n pages or use bare URLs.\n\nFormatting of citations:\n\n- Place each citation as near as possible to the claim it supports, normally at\n the end of the sentence or paragraph and after punctuation.\n- Do not place citations inside code fences.\n- Do not put citations on a line by themselves or collect all citations at the\n end of the response.\n\nIf you browse the internet, cite statements supported by web sources. Each cited\nsource must directly support the associated claim. Prefer primary and\nauthoritative sources, and use sources from different domains when the response\nbenefits from multiple perspectives.\n\n---\n\n## Special cases\nIf these conflict with any other instructions, these should take precedence.\n\n<special_cases>\n- When the user asks for information about how to use OpenAI products, (ChatGPT, the OpenAI API, etc.), you should check the code in local env and only browse as fallback, when you browse restrict your sources to official OpenAI websites using the domains filter, unless otherwise requested.\n- When using search to answer technical questions, you must only rely on primary sources (research papers, official documentation, etc.)\n- Clearly indicate when you are making an inference from sources.\n</special_cases>\n\n---\n\n## Word limits\nResponses may not excessively quote or draw on a specific source. There are several limits here:\n- **Limit on verbatim quotes:**\n - You may not quote more than 25 words verbatim from any single non-lyrical source, unless the source is reddit.\n - For song lyrics, verbatim quotes must be limited to at most 10 words.\n - Long quotes from reddit are allowed, as long as you indicate that those are direct quotes via a markdown blockquote starting with \">\", copy verbatim, and link the source.\n- **Word limits:**\n - Each webpage source in the sources has a word limit label formatted like \"[wordlim N]\", in which N is the maximum number of words in the whole response that are attributed to that source. If omitted, the word limit is 200 words.\n - Non-contiguous words derived from a given source must be counted to the word limit.\n - The summarization limit N is a maximum for each source.\n - When using multiple sources, their summarization limits add together. However, each article used must be relevant to the response.\n- **Copyright compliance:**\n - You must avoid providing full articles, long verbatim passages, or extensive direct quotes due to copyright concerns.\n - If the user asked for a verbatim quote, the response should provide a short compliant excerpt and then answer with paraphrases and summaries.\n - Again, this limit does not apply to reddit content, as long as it's appropriately indicated that those are direct quotes and you link to the source.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { web__run(args: {\n // Open links from previously opened pages.\n click?: Array<{\n // Numbered link id to open.\n id: number;\n // Reference id containing the numbered link.\n ref_id: string;\n}>;\n // Look up prices for the given stock symbols.\n finance?: Array<{\n // ISO 3166-1 alpha-3 country code, \"OTC\", or \"\" for cryptocurrency.\n market?: string;\n // Ticker symbol to look up.\n ticker: string;\n // Asset type to look up.\n type: \"equity\" | \"fund\" | \"crypto\" | \"index\";\n}>;\n // Find text patterns in pages.\n find?: Array<{\n // Text pattern to find.\n pattern: string;\n // Reference id or URL to search within.\n ref_id: string;\n}>;\n // Query the image search engine for a given list of queries.\n image_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Open pages by reference id or URL.\n open?: Array<{\n // Line number to position the page at.\n lineno?: number;\n // Reference id or URL to open.\n ref_id: string;\n}>;\n // Set the length of the response to be returned.\n response_length?: \"short\" | \"medium\" | \"long\";\n // Take screenshots of PDF pages.\n screenshot?: Array<{\n // Zero-indexed PDF page number.\n pageno: number;\n // Reference id or URL to screenshot.\n ref_id: string;\n}>;\n // Query the internet search engine for a given list of queries.\n search_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Look up sports schedules and standings.\n sports?: Array<{\n // Start date in YYYY-MM-DD format.\n date_from?: string;\n // End date in YYYY-MM-DD format.\n date_to?: string;\n // Sports function to call.\n fn: \"schedule\" | \"standings\";\n // League to look up.\n league: \"nba\" | \"wnba\" | \"nfl\" | \"nhl\" | \"mlb\" | \"epl\" | \"ncaamb\" | \"ncaawb\" | \"ipl\";\n // Locale for the lookup.\n locale?: string;\n // Number of games to return.\n num_games?: number;\n // Opponent to use with `team` when narrowing the lookup.\n opponent?: string;\n // Team to look up, using the common 3 or 4 letter alias used in broadcasts.\n team?: string;\n // Tool name for sports requests.\n tool?: \"sports\";\n}>;\n // Get time for the given UTC offsets.\n time?: Array<{\n // UTC offset formatted like \"+03:00\".\n utc_offset: string;\n}>;\n // Look up weather forecasts.\n weather?: Array<{\n // Number of days to return. Defaults to 7.\n duration?: number;\n // Location in \"Country, Area, City\" format.\n location: string;\n // Start date in YYYY-MM-DD format. Defaults to today.\n start?: string;\n}>;\n}): Promise<unknown>; };\n```","format":{"type":"grammar","syntax":"lark","definition":"\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"}}]},{"type":"namespace","name":"clock","description":"Tools for reading and waiting on time.","tools":[{"type":"function","strict":false,"name":"sleep","description":"Pause execution for a specified duration. The sleep ends early when new input arrives for the active turn. Returns the elapsed wall-clock time.","output_schema":null,"parameters":{"type":"object","properties":{"duration_ms":{"type":"number","description":"How long to sleep in milliseconds. Must be between 1 and 43200000."}},"required":["duration_ms"],"additionalProperties":false}}]},{"type":"namespace","name":"collaboration","description":"Tools for spawning and managing sub-agents.","tools":[{"type":"function","strict":false,"name":"followup_task","description":"Send a follow-up task to an existing non-root target agent and trigger a turn if it is idle. If the target is already running, deliver the task promptly at message boundaries while sampling, or after the pending tool call completes.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to send to the target agent.","encrypted":true},"target":{"type":"string","description":"Agent id or canonical task name to send a follow-up task to (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"interrupt_agent","description":"Interrupt an agent's current turn, if any, and return its previous status. The agent remains available for messages and follow-up tasks.","output_schema":null,"parameters":{"type":"object","properties":{"target":{"type":"string","description":"Agent id or canonical task name to interrupt (from spawn_agent)."}},"required":["target"],"additionalProperties":false}},{"type":"function","strict":false,"name":"list_agents","description":"List live agents in the current root thread tree. Optionally filter by task-path prefix.","output_schema":null,"parameters":{"type":"object","properties":{"path_prefix":{"type":"string","description":"Task-path prefix filter without a trailing slash. Omit to list all live agents."}},"additionalProperties":false}},{"type":"function","strict":false,"name":"send_message","description":"Send a message to an existing agent. The message will be delivered promptly. Does not trigger a new turn.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to queue on the target agent.","encrypted":true},"target":{"type":"string","description":"Relative or canonical task name to message (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"spawn_agent","description":"\n Available model overrides (optional; inherited parent model is preferred):\n- `gpt-6.1-sol`: Latest workhorse model for coding and everyday work. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-astra`: Frontier intelligence for the most demanding work. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-sol`: Previous generation workhorse model. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-luna`: Fast and affordable model for easier tasks. Reasoning efforts: low, medium (default), high, xhigh, max. Service tiers: priority.\n- `gpt-5.6-sol`: Older generation workhorse model. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n Spawns an agent to work on the specified task. If your current task is `/root/task1` and you spawn_agent with task_name \"task_3\" the agent will have canonical task name `/root/task1/task_3`.\nYou are then able to refer to this agent as `task_3` or `/root/task1/task_3` interchangeably. However an agent `/root/task2/task_3` would only be able to communicate with this agent via its canonical name `/root/task1/task_3`.\nThe spawned agent will have the same tools as you and the ability to spawn its own subagents.\n\nIt will be able to send you and other running agents messages, and its final answer will be provided to you when it finishes.\nThe new agent's canonical task name will be provided to it along with the message.\n\nNote that passing `fork_turns=\"none\"` will not pass any surrounding context to the spawned subagent, which may cause the agent to lack the context it needs to complete its task, whereas `fork_turns=\"all\"` will provide the subagent with all surrounding context.","output_schema":null,"parameters":{"type":"object","properties":{"fork_turns":{"type":"string","description":"Optional number of turns to fork. Defaults to `all`. Use `none`, `all`, or a positive integer string such as `3` to fork only the most recent turns."},"message":{"type":"string","description":"Initial plain-text task for the new agent.","encrypted":true},"model":{"type":"string","description":"Model override for the new agent. Omit unless an explicit override is needed."},"reasoning_effort":{"type":"string","description":"Reasoning effort override for the new agent. Omit to inherit the parent effort."},"task_name":{"type":"string","description":"Task name for the new agent. Use lowercase letters, digits, and underscores."}},"required":["task_name","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"wait_agent","description":"Wait for a mailbox update from any live agent, including queued messages and final-status notifications. The wait also ends early when new user input is steered into the active turn. Does not return the content; returns either a summary of which agents have updates (if any), an interruption summary for steered input, or a timeout summary if no activity arrives before the deadline.","output_schema":null,"parameters":{"type":"object","properties":{"timeout_ms":{"type":"number","description":"Timeout in milliseconds. Defaults to 30000, min 10000, max 3600000."}},"additionalProperties":false}}]},{"type":"namespace","name":"mcp__cua_repl","description":"UI automation through cua_repl using the initialized cua API.","tools":[{"type":"function","strict":false,"name":"js","description":"Control native apps or browsers on the user’s computer by reading or operating UI. Prefer purpose-built skills, connectors, APIs, or CLIs when available.\n\nOn the first invocation of `cua_repl`, or after resetting it, execute exactly one of the API calls shown below, optionally assigning its result to a variable. Do not add other API calls, waits, or snapshots to that invocation.\nThe tool result will include documentation and, when creating or selecting a tab or selecting an app, its initial UI state. Selecting a browser does not open a tab. Read that result before continuing.\nUse only APIs described in the tool instructions or returned documentation.\n\nWhen you need an inventory of available apps, browsers, and tabs, get a snapshot of all enabled surfaces. Otherwise, use the relevant entry point below:\n\n```javascript\nawait cua.getState();\n```\n\nUse the first matching browser control option from the user's request:\n\nFor a tab @-mention (`mention=tab-v1`):\nPass the complete `plugin://...` URL to get the referenced tab.\n\n```javascript\nlet tab = await cua.getTab({ mention: tabMentionUrl });\n```\n\nFor an existing tab identified by URL in browser context (including the current IAB tab):\n\n```javascript\nlet tab = await cua.getTab({ url }, { browser: browserId });\n```\n\nKnown tab ID (`tabId` or `providerTabId`) and browser (name or browser @-mention):\n\n```javascript\nlet tab = await cua.getTab(tabId, { browser: browserId });\n```\n\nTo open a URL in the in-app browser (`@Browser`):\n\n```javascript\nlet tab = await cua.createBrowserTab(\"iab\", url, { visible: boolean });\n```\n\nTo open a URL in another named browser: pass its name directly; do not call `getBrowser` first.\n\n```javascript\nlet tab = await cua.createBrowserTab(browserName, url, browserOptions);\n```\n\nKnown URL, only when the user has not specified a browser by name or @-mention:\n\n```javascript\nlet browser = await cua.getBrowser({ url });\n```\n\nBrowser IDs and options:\n\n- `\"mcpapps\"`: use `cua.getBrowser({ id: \"mcpapps\" })` for existing full-screen MCP Apps in the task’s side panel.\n- `\"iab\"` (in-app browser): in `createBrowserTab`, use `visible: true` to show the browser; `false` to keep it hidden.\n- `\"dot\"` (Dot): use only when present in browser inventory. It accesses tabs on Dot's active main thread. `cua.getTab(tabId, { browser: \"dot\" })` claims an existing tab; `cua.createBrowserTab(\"dot\", url, { visible: boolean })` creates one with the same visibility options as `\"iab\"`.\n- `\"chrome\"` (@Chrome), `\"edge\"` (@Edge): pass a short, emoji-prefixed `sessionName` (e.g. `\"🔎 Task\"`) to `createBrowserTab` when starting a task.\n\nIf the user specifies an app to use, get the app by name, bundle ID, or path:\n\n```javascript\nlet app = await cua.getApp(\"Example App\");\n```\n\nTo add other content to the tool result, use `nodeRepl.write(value)` for text or other values and `await nodeRepl.emitImage(image)` for images. The APIs listed above already display their documentation or UI state; do not wrap their results in `write` or `emitImage`.\n\nIf your context begins with a summary of an existing computer use task, call `await cua.rewriteDocumentation()` before continuing the computer use task to ensure you have a complete view of the necessary documentation. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{"code":{"type":"string","description":"JavaScript to execute using the initialized cua_repl runtime."},"timeout_ms":{"type":"integer","description":"Optional execution timeout in milliseconds. Defaults to 30000 (30 seconds) when omitted."},"title":{"type":"string","description":"Short user-facing description of what the code does."}},"required":["code"],"additionalProperties":false}},{"type":"function","strict":false,"name":"js_reset","description":"Reset the persistent cua_repl JavaScript session. All JavaScript bindings are discarded. The next cua_repl.js call initializes a fresh runtime for the enabled surfaces. This does not close browser tabs or native apps, or erase their state. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{},"additionalProperties":false}}]}],"tool_choice":"auto","parallel_tool_calls":false,"prompt_cache_key":"01a14530-0099-7142-8981-e5e98a2373b1","prompt_cache_retention":"24h","text":{"format":{"type":"text"},"verbosity":"low"},"top_p":0.98,"top_logprobs":0,"temperature":1.0,"reasoning":{"effort":"low","context":"all_turns","summary":null,"mode":"standard"},"user":null,"usage":null,"tool_usage":{"image_gen":{"input_tokens":0,"output_tokens":0,"total_tokens":0,"input_tokens_details":{"text_tokens":0,"image_tokens":0},"output_tokens_details":{"image_tokens":0,"text_tokens":0}},"web_search":{"num_requests":0}},"safety_identifier":"user-LCV4XMHz3BRmrwLTeTQWC5P7","store":false,"metadata":{},"max_output_tokens":null,"max_tool_calls":null,"service_tier":"auto","truncation":"disabled"}}++event: response.output_item.added+data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"type":"message","id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","metadata":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"internal_chat_message_metadata_passthrough":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"role":"assistant","status":"in_progress","content":[],"phase":"final_answer"}}++event: response.content_part.added+data: {"type":"response.content_part.added","sequence_number":3,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"part":{"type":"output_text","text":"","annotations":[],"logprobs":[]}}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":4,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"Read","logprobs":[],"safety_buffering":false,"obfuscation":"rBpCsMqNnP6v"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":5,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" both","logprobs":[],"safety_buffering":false,"obfuscation":"AFrEIIBDxdV"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":6,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" files","logprobs":[],"safety_buffering":false,"obfuscation":"1e1NoGtmqo"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":7,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" in","logprobs":[],"safety_buffering":false,"obfuscation":"aoSUY7059QZpe"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":8,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" parallel","logprobs":[],"safety_buffering":false,"obfuscation":"mw3Sdk7"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":9,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":":\n\n","logprobs":[],"safety_buffering":false,"obfuscation":"qUydGImhNorwo"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":10,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"-","logprobs":[],"safety_buffering":false,"obfuscation":"q88dfoYtgtAPX2y"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":11,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" `","logprobs":[],"safety_buffering":false,"obfuscation":"FiX7n8oawiiS92"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":12,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"README","logprobs":[],"safety_buffering":false,"obfuscation":"epjzrybOiE"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":13,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":".md","logprobs":[],"safety_buffering":false,"obfuscation":"MPfrQYNb7F4ce"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":14,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"`:","logprobs":[],"safety_buffering":false,"obfuscation":"9heqT9sDpYdpbP"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":15,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" ","logprobs":[],"safety_buffering":false,"obfuscation":"nGJlVJrRXnyMmRU"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":16,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"6","logprobs":[],"safety_buffering":false,"obfuscation":"TPK6nc5xSJrPHJg"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":17,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" lines","logprobs":[],"safety_buffering":false,"obfuscation":"lOtfrRCmNQ"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":18,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"\n","logprobs":[],"safety_buffering":false,"obfuscation":"TJTpAsJ262glfBZ"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":19,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"-","logprobs":[],"safety_buffering":false,"obfuscation":"IzkBCZ4dRsxwpfj"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":20,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" `","logprobs":[],"safety_buffering":false,"obfuscation":"QneR53zwbG77oO"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":21,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"notes","logprobs":[],"safety_buffering":false,"obfuscation":"9ydyxHqjAlY"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":22,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":".txt","logprobs":[],"safety_buffering":false,"obfuscation":"gUGmWqvJOiPz"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":23,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"`:","logprobs":[],"safety_buffering":false,"obfuscation":"N6rktuf9s5Xyun"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":24,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" ","logprobs":[],"safety_buffering":false,"obfuscation":"sQtd5zB8sYbXTyS"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":25,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"3","logprobs":[],"safety_buffering":false,"obfuscation":"lHRBBRahW5nOLtu"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":26,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" lines","logprobs":[],"safety_buffering":false,"obfuscation":"Ys4YsOC6h5"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":27,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"\n\n","logprobs":[],"safety_buffering":false,"obfuscation":"cdUamf9B2ae4gT"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":28,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"T","logprobs":[],"safety_buffering":false,"obfuscation":"1t1GXKMlhxl0ZbK"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":29,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"ried","logprobs":[],"safety_buffering":false,"obfuscation":"Y5lYZqVhZCH1"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":30,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" reading","logprobs":[],"safety_buffering":false,"obfuscation":"vqWWRGF5"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":31,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" `","logprobs":[],"safety_buffering":false,"obfuscation":"ct05BIwPIa8nWh"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":32,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"missing","logprobs":[],"safety_buffering":false,"obfuscation":"dzMQzSlWo"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":33,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":".txt","logprobs":[],"safety_buffering":false,"obfuscation":"DFY9Lm5DjcUk"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":34,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":"`;","logprobs":[],"safety_buffering":false,"obfuscation":"EoYjHatDhC9wGH"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":35,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" it","logprobs":[],"safety_buffering":false,"obfuscation":"1oAfFhA5aDXEq"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":36,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" does","logprobs":[],"safety_buffering":false,"obfuscation":"qJ3ftNc3y3Q"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":37,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" not","logprobs":[],"safety_buffering":false,"obfuscation":"ORMv521TOwhs"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":38,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":" exist","logprobs":[],"safety_buffering":false,"obfuscation":"3xWZJG7RPo"}++event: response.output_text.delta+data: {"type":"response.output_text.delta","sequence_number":39,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"delta":".","logprobs":[],"safety_buffering":false,"obfuscation":"YFZ20H5PXpFf3fN"}++event: response.metadata+data: {"type":"response.metadata","sequence_number":40,"response_id":"resp_07438c2e31b28b62016ad2396120848191928cb5504aad5871","metadata":{"openai_chatgpt_moderation_metadata":{"prompt":{"omnimod":{"protection_type":"omnimod","outputs":[{"results":[{"category_flags":{"A1":false,"A2":false,"A3":false,"C1":false,"C11":false,"C2":false,"E1":false,"E2":false,"E3":false,"H1":false,"H2":false,"H3":false,"JB1":false,"K1":false,"K2":false,"K3":false,"K4":false,"P1":false,"P2":false,"P3":false,"P4":false,"PD1":false,"PD4":false,"S1":false,"S3+":false,"S4":false,"SH":false,"TXT-C3":false,"TXT-C4":false,"V1":false,"V2+":false,"V4+":false,"REFUSED":false,"CBRN-B1+":false,"IMG-C1":false,"IMG-C11":false,"IMG-C2":false,"IMG-S1":false,"IMG-SH":false,"IMG-V1":false,"IMG-V2+":false,"IMG-V4+":false}}],"is_blocked":false}]}},"generation":{},"tool_call":{},"tool_response":{}}}}++event: response.output_text.done+data: {"type":"response.output_text.done","sequence_number":41,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"text":"Read both files in parallel:\n\n- `README.md`: 6 lines\n- `notes.txt`: 3 lines\n\nTried reading `missing.txt`; it does not exist.","logprobs":[]}++event: response.content_part.done+data: {"type":"response.content_part.done","sequence_number":42,"item_id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","output_index":0,"content_index":0,"part":{"type":"output_text","text":"Read both files in parallel:\n\n- `README.md`: 6 lines\n- `notes.txt`: 3 lines\n\nTried reading `missing.txt`; it does not exist.","annotations":[],"logprobs":[]}}++event: response.output_item.done+data: {"type":"response.output_item.done","sequence_number":43,"output_index":0,"item":{"type":"message","id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","metadata":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"internal_chat_message_metadata_passthrough":{"create_time":1792162146.791901,"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"role":"assistant","status":"completed","content":[{"type":"output_text","text":"Read both files in parallel:\n\n- `README.md`: 6 lines\n- `notes.txt`: 3 lines\n\nTried reading `missing.txt`; it does not exist.","annotations":[],"logprobs":[]}],"phase":"final_answer"}}++event: response.completed+data: {"type":"response.completed","sequence_number":44,"safety_buffering":false,"response":{"id":"resp_07438c2e31b28b62016ad2396120848191928cb5504aad5871","object":"response","created_at":1792162145,"completed_at":1792162147,"status":"completed","background":false,"frequency_penalty":0.0,"presence_penalty":0.0,"moderation":null,"model":"gpt-6.1-sol","access_programs":{"cyber":"standard"},"previous_response_id":null,"instructions":null,"output":[{"type":"message","id":"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462","metadata":{"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"internal_chat_message_metadata_passthrough":{"create_time":1792162146.791901,"turn_id":"01a14530-0621-7653-8f96-dc18c51bb17e"},"role":"assistant","status":"completed","content":[{"type":"output_text","text":"Read both files in parallel:\n\n- `README.md`: 6 lines\n- `notes.txt`: 3 lines\n\nTried reading `missing.txt`; it does not exist.","annotations":[],"logprobs":[]}],"phase":"final_answer"}],"error":null,"incomplete_details":null,"tools":[{"type":"namespace","name":"functions","description":"","tools":[{"type":"function","strict":false,"name":"wait","description":"Waits on a yielded `exec` cell and returns new output or completion.\n- Use `wait` only after `exec` returns `Script running with cell ID ...`.\n- `cell_id` identifies the running `exec` cell to resume.\n- `yield_time_ms` controls how long to wait for more output before yielding again. Defaults to 10000 ms.\n- `max_tokens` limits how much new output this wait call returns. Defaults to 10000 tokens.\n- `terminate: true` stops the running cell; false or omitted waits for output.\n- `wait` returns only the new output since the last yield, or the final completion or termination result for that cell.\n- If the cell is still running, `wait` may yield again with the same `cell_id`.\n- If the cell has already finished, `wait` returns the completed result and closes the cell.","output_schema":null,"parameters":{"type":"object","properties":{"cell_id":{"type":"string","description":"Identifier of the running exec cell."},"max_tokens":{"type":"number","description":"Output token budget for this wait call. Defaults to 10000 tokens."},"terminate":{"type":"boolean","description":"True stops the running exec cell; false or omitted waits for output."},"yield_time_ms":{"type":"number","description":"Wait before yielding more output. Defaults to 10000 ms."}},"required":["cell_id"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input","description":"Request user input for one to three short questions and wait for the response. This tool is only available in Plan mode.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"Questions to show the user. Prefer 1 and do not exceed 3","items":{"type":"object","properties":{"header":{"type":"string","description":"Short header label shown in the UI (12 or fewer chars)."},"id":{"type":"string","description":"Stable identifier for mapping answers (snake_case)."},"options":{"type":"array","description":"Provide 2-3 mutually exclusive choices. Put the recommended option first and suffix its label with \"(Recommended)\". Do not include an \"Other\" option in this list; the client will add a free-form \"Other\" option automatically.","items":{"type":"object","properties":{"description":{"type":"string","description":"One short sentence explaining impact/tradeoff if selected."},"label":{"type":"string","description":"User-facing label (1-5 words)."}},"required":["label","description"],"additionalProperties":false}},"question":{"type":"string","description":"Single-sentence prompt shown to the user."}},"required":["id","header","question","options"],"additionalProperties":false}}},"required":["questions"],"additionalProperties":false}},{"type":"function","strict":false,"name":"request_user_input_async","description":"Ask the user one or more questions during ongoing work. Use this tool only to request missing information, preferences, constraints, clarification, or approval. The tool returns immediately without ending the turn or waiting for a reply; any reply arrives asynchronously as a new user message. Keep questions concise, self-contained, and easy to understand, using a level of detail appropriate to the user and task. The UI always allows a free-text answer, including when suggested options are provided. A preselected option is not submitted automatically.","output_schema":null,"parameters":{"type":"object","properties":{"questions":{"type":"array","description":"One or more self-contained questions to present together, in display order.","items":{"type":"object","properties":{"options":{"type":"array","description":"Suggested answers, in display order. Put the recommended answer first; the first option is preselected by default. The user can select one option or enter a free-text answer. Do not include an Other option or a free-text placeholder; the UI provides free-text input automatically. Omit options for a free-text-only question.","items":{"type":"string"},"minItems":1},"title":{"type":"string","description":"The complete question shown to the user, including any context needed to answer it."}},"required":["title"],"additionalProperties":false},"minItems":1}},"required":["questions"],"additionalProperties":false}},{"type":"custom","name":"exec","description":"Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\nShared MCP Types:\n```ts\ntype Role = \"user\" | \"assistant\";\ntype MetaObject = Record<string, unknown>;\ntype Annotations = {\n audience?: Role[];\n priority?: number;\n lastModified?: string;\n};\ntype Icon = {\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n};\ntype TextResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n text: string;\n};\ntype BlobResourceContents = {\n uri: string;\n mimeType?: string;\n _meta?: MetaObject;\n blob: string;\n};\ntype TextContent = {\n type: \"text\";\n text: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ImageContent = {\n type: \"image\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype AudioContent = {\n type: \"audio\";\n data: string;\n mimeType: string;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ResourceLink = {\n icons?: Icon[];\n name: string;\n title?: string;\n uri: string;\n description?: string;\n mimeType?: string;\n annotations?: Annotations;\n size?: number;\n _meta?: MetaObject;\n type: \"resource_link\";\n};\ntype EmbeddedResource = {\n type: \"resource\";\n resource: TextResourceContents | BlobResourceContents;\n annotations?: Annotations;\n _meta?: MetaObject;\n};\ntype ContentBlock =\n | TextContent\n | ImageContent\n | AudioContent\n | ResourceLink\n | EmbeddedResource;\ntype CallToolResult<TStructured = { [key: string]: unknown }> = {\n _meta?: MetaObject;\n content: ContentBlock[];\n isError?: boolean;\n structuredContent?: TStructured;\n [key: string]: unknown;\n};\n```\n\n### `apply_patch`\nThe `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.\n\nexec tool declaration:\n```ts\ndeclare const tools: { apply_patch(input: string): Promise<unknown>; };\n```\n\n### `create_goal`\nCreate a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks.\nSet token_budget only when an explicit token budget is requested. Fails if an unfinished goal exists; use update_goal only for status.\n\nexec tool declaration:\n```ts\ndeclare const tools: { create_goal(args: {\n // Required. The concrete objective to start pursuing. This starts a new active goal when no goal exists or replaces the current goal when it is complete.\n objective: string;\n // Positive token budget for the new goal. Omit unless explicitly requested.\n token_budget?: number;\n}): Promise<unknown>; };\n```\n\n### `exec_command`\nRuns a command in a PTY, returning output or a session ID for ongoing interaction.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n // Shell command to execute.\n cmd: string;\n // User-facing approval question for `require_escalated`; omit otherwise.\n justification?: string;\n // True runs the shell with -l/-i semantics; false disables them. Defaults to true.\n login?: boolean;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Reusable approval prefix for `cmd`, only with `sandbox_permissions: \"require_escalated\"`; for example [\"git\", \"pull\"].\n prefix_rule?: Array<string>;\n // Per-command sandbox override. Defaults to `use_default`; use `require_escalated` for unsandboxed execution.\n sandbox_permissions?: \"use_default\" | \"require_escalated\";\n // Shell binary to launch. Defaults to the user's default shell.\n shell?: string;\n // True allocates a PTY for the command; false or omitted uses plain pipes.\n tty?: boolean;\n // Working directory for the command. Defaults to the turn cwd.\n workdir?: string;\n // Wait before yielding output. Defaults to 10000 ms; effective range is 250-30000 ms.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n### `get_goal`\nGet the current goal for this thread, including status, budgets, token and elapsed-time usage, and remaining token budget.\n\nexec tool declaration:\n```ts\ndeclare const tools: { get_goal(args: {}): Promise<unknown>; };\n```\n\n### `list_mcp_resource_templates`\nLists resource templates provided by MCP servers. Parameterized resource templates allow servers to share data that takes parameters and provides context to language models, such as files, database schemas, or application-specific information. Prefer resource templates over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resource_templates(args: {\n // Opaque cursor from a previous list_mcp_resource_templates call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resource templates from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `list_mcp_resources`\nLists resources provided by MCP servers. Resources allow servers to share data that provides context to language models, such as files, database schemas, or application-specific information. Prefer resources over web search when possible.\n\nexec tool declaration:\n```ts\ndeclare const tools: { list_mcp_resources(args: {\n // Opaque cursor from a previous list_mcp_resources call; omit for the first page.\n cursor?: string;\n // MCP server name. Omit to list resources from every configured server.\n server?: string;\n}): Promise<unknown>; };\n```\n\n### `read_mcp_resource`\nRead a specific resource from an MCP server given the server name and resource URI.\n\nexec tool declaration:\n```ts\ndeclare const tools: { read_mcp_resource(args: {\n // MCP server name exactly as configured. Must match the 'server' field returned by list_mcp_resources.\n server: string;\n // Resource URI to read. Must be one of the URIs returned by list_mcp_resources.\n uri: string;\n}): Promise<unknown>; };\n```\n\n### `request_plugin_install`\n# Suggest a recommended plugin installation\n\nUse this tool only when all of the following are true:\n- The user explicitly asks to use a specific plugin that is not already available in the current context or active `tools` list.\n- Tool search has already been exhausted and did not find or make the requested tool callable.\n- The plugin is listed in `<recommended_plugins>`.\n\nDo not use it for adjacent capabilities, broad recommendations, or plugins that merely seem useful. Briefly explain why the plugin can help with the current request in `suggest_reason`.\n\nIMPORTANT: DO NOT call this tool in parallel with other tools.\n\nexec tool declaration:\n```ts\ndeclare const tools: { request_plugin_install(args: {\n // The parenthesized plugin ID from the `<recommended_plugins>` list.\n plugin_id: string;\n // Concise one-line user-facing reason why this plugin can help with the current request.\n suggest_reason: string;\n}): Promise<unknown>; };\n```\n\n### `update_goal`\nUpdate the existing goal.\nSet status to `paused` only at the user's explicit request to pause this goal, never on your own initiative. Ask if unclear; a later resume revokes that request. Report the returned status and stop goal work. Budget limits take precedence over pausing.\nSet status to `complete` only when the objective has actually been achieved and no required work remains.\nSet status to `blocked` only when the same blocking condition has repeated for at least three consecutive goal turns, counting the original/user-triggered turn and any automatic continuations, and the agent cannot make meaningful progress without user input or an external-state change.\nIf the user resumes a goal that was previously marked `blocked`, treat the resumed run as a fresh blocked audit. If the same blocking condition then repeats for at least three consecutive resumed goal turns, set status to `blocked` again.\nOnce the blocked threshold is satisfied, do not keep reporting that you are still blocked while leaving the goal active; set status to `blocked`.\nDo not use `blocked` merely because the work is hard, slow, uncertain, incomplete, or would benefit from clarification.\nDo not mark a goal complete merely because its budget is nearly exhausted or because you are stopping work.\nYou cannot use this tool to resume, budget-limit, or usage-limit a goal; those status changes are controlled by the user or system.\nWhen marking a budgeted goal achieved with status `complete`, report the final token usage from the tool result to the user.\n\nexec tool declaration:\n```ts\ndeclare const tools: { update_goal(args: {\n // Required. `paused` requires an explicit user request. Set to `complete` only when the objective is achieved and no required work remains. Set to `blocked` only after the same blocking condition has recurred for at least three consecutive goal turns and the agent is at an impasse. After a previously blocked goal is resumed, the resumed run starts a fresh blocked audit.\n status: \"complete\" | \"blocked\" | \"paused\";\n}): Promise<unknown>; };\n```\n\n### `view_image`\nView a local image file from the filesystem when visual inspection is needed. Use this for images already available on disk.\n\nexec tool declaration:\n```ts\ndeclare const tools: { view_image(args: {\n // Image detail level. Defaults to `high`; use `original` to preserve exact resolution.\n detail?: \"high\" | \"original\";\n // Local filesystem path to an image file.\n path: string;\n}): Promise<{\n // Image detail hint returned by view_image. Returns `high` for default resized behavior or `original` when original resolution is preserved.\n detail: \"high\" | \"original\";\n // Data URL for the loaded image.\n image_url: string;\n}>; };\n```\n\n### `write_stdin`\nWrites characters to an existing unified exec session and returns recent output.\n\nexec tool declaration:\n```ts\ndeclare const tools: { write_stdin(args: {\n // Bytes to write to stdin. Defaults to empty, which polls without writing.\n chars?: string;\n // Output token budget. Defaults to 10000 tokens; larger requests may be capped by policy.\n max_output_tokens?: number;\n // Identifier of the running unified exec session.\n session_id: number;\n // Wait before yielding output. Non-empty writes default to 250 ms and cap at 30000 ms; empty polls wait 5000-300000 ms by default.\n yield_time_ms?: number;\n}): Promise<{\n // Chunk identifier included when the response reports one.\n chunk_id?: string;\n // Process exit code when the command finished during this call.\n exit_code?: number;\n // Approximate token count before output truncation.\n original_token_count?: number;\n // Command output text, possibly truncated.\n output: string;\n // Session identifier to pass to write_stdin when the process is still running.\n session_id?: number;\n // Elapsed wall time spent waiting for output in seconds.\n wall_time_seconds: number;\n}>; };\n```\n\n## clock\nTools for reading and waiting on time.\n\n### `clock__curr_time`\nReturn the current time in UTC.\n\nexec tool declaration:\n```ts\ndeclare const tools: { clock__curr_time(args: {}): Promise<{\n // Current UTC time formatted as YYYY-MM-DD HH:MM:SS UTC.\n current_time: string;\n}>; };\n```\n\n## image_gen\nTools in the image_gen namespace.\n\n### `image_gen__imagegen`\nThe `image_gen.imagegen` tool enables image generation from descriptions and editing of existing images based on specific instructions. Use it when:\n\n- The user requests an image based on a scene description, such as a diagram, portrait, comic, meme, or any other visual.\n- The user wants to modify an attached or previously generated image with specific changes, including adding or removing elements, altering colors, improving quality/resolution, or transforming the style (e.g., cartoon, oil painting).\n\nGuidelines:\n- imagegen needs a few minutes to finish. In code-mode, use the first-line @exec directive to give the initial call 120 seconds and the same yield for any waits that follow. Once it finishes, return the image with generatedImage(result).\n- Avoid printing the full result or its base64 image data with `text()` or `notify()`; print only small metadata when needed.\n- Set `transparent_background` to true when the request calls for a transparent background, including background removal or a cutout; set it to false otherwise. For edits, preserve existing transparency unless the user asks to change it.\n- Omit both `referenced_image_paths` and `num_last_images_to_include` when generating a brand new image.\n- For edits, use `referenced_image_paths` when every target image has a local file path.\n- If you have not seen a local image yet, use `view_image` to inspect it before editing.\n- Use `num_last_images_to_include` only when at least one target image has no local file path.\n- Set `num_last_images_to_include` to the smallest number of recent conversation images that includes every target image, up to 5.\n- Never provide both `referenced_image_paths` and `num_last_images_to_include`.\n- If neither mechanism can include every target image, ask the user to attach the missing images again.\n- Directly generate the image without reconfirmation or clarification unless required images must be attached again.\n- Always use this tool for image editing unless the user explicitly requests otherwise. Do not use the `python` tool for image editing unless specifically instructed.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { image_gen__imagegen(args: {\n num_last_images_to_include?: number | null;\n prompt: string;\n referenced_image_paths?: Array<string> | null;\n // Whether the output should have a transparent background. Defaults to false.\n transparent_background?: boolean;\n}): Promise<unknown>; };\n```\n\n## web\nTools in the web namespace.\n\n### `web__run`\nTool for accessing the internet.\n\n\n---\n\n## Examples of different commands available in this tool\n\nExamples of different commands available in this tool:\n* `search_query`: {\"search_query\": [{\"q\": \"What is the capital of France?\"}, {\"q\": \"What is the capital of belgium?\"}]}. Searches the internet for a given query (and optionally with a domain or recency filter)\n* `image_query`: {\"image_query\":[{\"q\": \"waterfalls\"}]}.\n* `open`: {\"open\": [{\"ref_id\": \"turn0search0\"}, {\"ref_id\": \"https://www.openai.com\", \"lineno\": 120}]}\n* `click`: {\"click\": [{\"ref_id\": \"turn0fetch3\", \"id\": 17}]}\n* `find`: {\"find\": [{\"ref_id\": \"turn0fetch3\", \"pattern\": \"Annie Case\"}]}\n* `screenshot`: {\"screenshot\": [{\"ref_id\": \"turn1view0\", \"pageno\": 0}, {\"ref_id\": \"turn1view0\", \"pageno\": 3}]}\n* `finance`: {\"finance\":[{\"ticker\":\"AMD\",\"type\":\"equity\",\"market\":\"USA\"}]}, {\"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}]}\n* `weather`: {\"weather\":[{\"location\":\"San Francisco, CA\"}]}\n* `sports`: {\"sports\":[{\"fn\":\"standings\",\"league\":\"nfl\"}, {\"fn\":\"schedule\",\"league\":\"nba\",\"team\":\"GSW\",\"date_from\":\"2025-02-24\"}]}\n* `time`: {\"time\":[{\"utc_offset\":\"+03:00\"}]}\n\n---\n\n## Usage hints\nTo use this tool efficiently:\n* Use multiple commands and queries in one call to get more results faster; e.g. {\"search_query\": [{\"q\": \"bitcoin news\"}], \"finance\":[{\"ticker\":\"BTC\",\"type\":\"crypto\",\"market\":\"\"}], \"find\": [{\"ref_id\": \"turn0search0\", \"pattern\": \"Annie Case\"}, {\"ref_id\": \"turn0search1\", \"pattern\": \"John Smith\"}]}\n* Use \"response_length\" to control the number of results returned by this tool, omit it if you intend to pass \"short\" in\n* Only write required parameters; do not write empty lists or nulls where they could be omitted.\n* `search_query` must have length at most 4 in each call. If it has length > 3, response_length must be medium or long\n* If you find yourself in a situation where you accidentally call the `web.run` tool, it's best just to send an empty query: {\"search_query\": [{\"q\": \"\"}]}.\n\n---\n\n## Decision boundary\n\nIf the user makes an explicit request to search the internet, find latest information, look up, etc (or to not do so), you must obey their request.\nWhen you make an assumption, always consider whether it is temporally stable; i.e. whether there's even a small (>10%) chance it has changed. If it is unstable, you must verify with browsing the internet for verification.\n\n<situations_where_you_must_browse_the_internet>\nBelow is a list of scenarios where browsing the internet MUST be used. PAY CLOSE ATTENTION: you MUST browse the internet in these cases. If you're unsure or on the fence, you MUST bias towards browsing the internet.\n- The information could have changed recently: for example news; prices; laws; schedules; product specs; sports scores; economic indicators; political/public/company figures (e.g. the question relates to 'the president of country A' or 'the CEO of company B', which might change over time); rules; regulations; standards; software libraries that could be updated; exchange rates; recommendations (i.e., recommendations about various topics or things might be informed by what currently exists / is popular / is safe / is unsafe / is in the zeitgeist / etc.); and many many many more categories -- again, if you're on the fence, you MUST browse the internet!\n - For news queries, prioritize more recent events, ensuring you compare publish dates and the date that the event happened.\n- The user is seeking recommendations that could lead them to spend substantial time or money -- researching products, restaurants, travel plans, etc.\n- The user wants (or would benefit from) direct quotes, links, or precise source attribution.\n- A specific page, paper, dataset, PDF, or site is referenced and you haven't been given its contents.\n- You're unsure about a fact, the topic is niche or emerging, or you suspect there's at least a 10% chance you will incorrectly recall it\n- High-stakes accuracy matters (medical, legal, financial guidance). For these you generally should search by default because this information is highly temporally unstable\n- The user explicitly says to search, browse, verify, or look it up.\n</situations_where_you_must_browse_the_internet>\n\n---\n\n## Citations\n\nResults from `web.run` include internal reference IDs such as `turn2search5`. Use\nthose reference IDs only in calls to `web.run`; do not expose them in the final\nresponse.\n\nCite sources in the final response using Markdown links:\n\n- Cite a single source as `[descriptive source title](https://example.com/page)`.\n- Cite multiple sources with separate Markdown links, for example\n `[first source](https://example.com/one), [second source](https://example.com/two)`.\n- Link directly to the page that supports the claim. Do not link to search result\n pages or use bare URLs.\n\nFormatting of citations:\n\n- Place each citation as near as possible to the claim it supports, normally at\n the end of the sentence or paragraph and after punctuation.\n- Do not place citations inside code fences.\n- Do not put citations on a line by themselves or collect all citations at the\n end of the response.\n\nIf you browse the internet, cite statements supported by web sources. Each cited\nsource must directly support the associated claim. Prefer primary and\nauthoritative sources, and use sources from different domains when the response\nbenefits from multiple perspectives.\n\n---\n\n## Special cases\nIf these conflict with any other instructions, these should take precedence.\n\n<special_cases>\n- When the user asks for information about how to use OpenAI products, (ChatGPT, the OpenAI API, etc.), you should check the code in local env and only browse as fallback, when you browse restrict your sources to official OpenAI websites using the domains filter, unless otherwise requested.\n- When using search to answer technical questions, you must only rely on primary sources (research papers, official documentation, etc.)\n- Clearly indicate when you are making an inference from sources.\n</special_cases>\n\n---\n\n## Word limits\nResponses may not excessively quote or draw on a specific source. There are several limits here:\n- **Limit on verbatim quotes:**\n - You may not quote more than 25 words verbatim from any single non-lyrical source, unless the source is reddit.\n - For song lyrics, verbatim quotes must be limited to at most 10 words.\n - Long quotes from reddit are allowed, as long as you indicate that those are direct quotes via a markdown blockquote starting with \">\", copy verbatim, and link the source.\n- **Word limits:**\n - Each webpage source in the sources has a word limit label formatted like \"[wordlim N]\", in which N is the maximum number of words in the whole response that are attributed to that source. If omitted, the word limit is 200 words.\n - Non-contiguous words derived from a given source must be counted to the word limit.\n - The summarization limit N is a maximum for each source.\n - When using multiple sources, their summarization limits add together. However, each article used must be relevant to the response.\n- **Copyright compliance:**\n - You must avoid providing full articles, long verbatim passages, or extensive direct quotes due to copyright concerns.\n - If the user asked for a verbatim quote, the response should provide a short compliant excerpt and then answer with paraphrases and summaries.\n - Again, this limit does not apply to reddit content, as long as it's appropriately indicated that those are direct quotes and you link to the source.\n\n\nexec tool declaration:\n```ts\ndeclare const tools: { web__run(args: {\n // Open links from previously opened pages.\n click?: Array<{\n // Numbered link id to open.\n id: number;\n // Reference id containing the numbered link.\n ref_id: string;\n}>;\n // Look up prices for the given stock symbols.\n finance?: Array<{\n // ISO 3166-1 alpha-3 country code, \"OTC\", or \"\" for cryptocurrency.\n market?: string;\n // Ticker symbol to look up.\n ticker: string;\n // Asset type to look up.\n type: \"equity\" | \"fund\" | \"crypto\" | \"index\";\n}>;\n // Find text patterns in pages.\n find?: Array<{\n // Text pattern to find.\n pattern: string;\n // Reference id or URL to search within.\n ref_id: string;\n}>;\n // Query the image search engine for a given list of queries.\n image_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Open pages by reference id or URL.\n open?: Array<{\n // Line number to position the page at.\n lineno?: number;\n // Reference id or URL to open.\n ref_id: string;\n}>;\n // Set the length of the response to be returned.\n response_length?: \"short\" | \"medium\" | \"long\";\n // Take screenshots of PDF pages.\n screenshot?: Array<{\n // Zero-indexed PDF page number.\n pageno: number;\n // Reference id or URL to screenshot.\n ref_id: string;\n}>;\n // Query the internet search engine for a given list of queries.\n search_query?: Array<{\n // Whether to filter by a specific list of domains.\n domains?: Array<string>;\n // Search query.\n q: string;\n // Whether to filter by recency, as a number of recent days.\n recency?: number;\n}>;\n // Look up sports schedules and standings.\n sports?: Array<{\n // Start date in YYYY-MM-DD format.\n date_from?: string;\n // End date in YYYY-MM-DD format.\n date_to?: string;\n // Sports function to call.\n fn: \"schedule\" | \"standings\";\n // League to look up.\n league: \"nba\" | \"wnba\" | \"nfl\" | \"nhl\" | \"mlb\" | \"epl\" | \"ncaamb\" | \"ncaawb\" | \"ipl\";\n // Locale for the lookup.\n locale?: string;\n // Number of games to return.\n num_games?: number;\n // Opponent to use with `team` when narrowing the lookup.\n opponent?: string;\n // Team to look up, using the common 3 or 4 letter alias used in broadcasts.\n team?: string;\n // Tool name for sports requests.\n tool?: \"sports\";\n}>;\n // Get time for the given UTC offsets.\n time?: Array<{\n // UTC offset formatted like \"+03:00\".\n utc_offset: string;\n}>;\n // Look up weather forecasts.\n weather?: Array<{\n // Number of days to return. Defaults to 7.\n duration?: number;\n // Location in \"Country, Area, City\" format.\n location: string;\n // Start date in YYYY-MM-DD format. Defaults to today.\n start?: string;\n}>;\n}): Promise<unknown>; };\n```","format":{"type":"grammar","syntax":"lark","definition":"\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"}}]},{"type":"namespace","name":"clock","description":"Tools for reading and waiting on time.","tools":[{"type":"function","strict":false,"name":"sleep","description":"Pause execution for a specified duration. The sleep ends early when new input arrives for the active turn. Returns the elapsed wall-clock time.","output_schema":null,"parameters":{"type":"object","properties":{"duration_ms":{"type":"number","description":"How long to sleep in milliseconds. Must be between 1 and 43200000."}},"required":["duration_ms"],"additionalProperties":false}}]},{"type":"namespace","name":"collaboration","description":"Tools for spawning and managing sub-agents.","tools":[{"type":"function","strict":false,"name":"followup_task","description":"Send a follow-up task to an existing non-root target agent and trigger a turn if it is idle. If the target is already running, deliver the task promptly at message boundaries while sampling, or after the pending tool call completes.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to send to the target agent.","encrypted":true},"target":{"type":"string","description":"Agent id or canonical task name to send a follow-up task to (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"interrupt_agent","description":"Interrupt an agent's current turn, if any, and return its previous status. The agent remains available for messages and follow-up tasks.","output_schema":null,"parameters":{"type":"object","properties":{"target":{"type":"string","description":"Agent id or canonical task name to interrupt (from spawn_agent)."}},"required":["target"],"additionalProperties":false}},{"type":"function","strict":false,"name":"list_agents","description":"List live agents in the current root thread tree. Optionally filter by task-path prefix.","output_schema":null,"parameters":{"type":"object","properties":{"path_prefix":{"type":"string","description":"Task-path prefix filter without a trailing slash. Omit to list all live agents."}},"additionalProperties":false}},{"type":"function","strict":false,"name":"send_message","description":"Send a message to an existing agent. The message will be delivered promptly. Does not trigger a new turn.","output_schema":null,"parameters":{"type":"object","properties":{"message":{"type":"string","description":"Message text to queue on the target agent.","encrypted":true},"target":{"type":"string","description":"Relative or canonical task name to message (from spawn_agent)."}},"required":["target","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"spawn_agent","description":"\n Available model overrides (optional; inherited parent model is preferred):\n- `gpt-6.1-sol`: Latest workhorse model for coding and everyday work. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-astra`: Frontier intelligence for the most demanding work. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-sol`: Previous generation workhorse model. Reasoning efforts: low, medium (default), high, xhigh, max, ultra. Service tiers: priority.\n- `gpt-6-luna`: Fast and affordable model for easier tasks. Reasoning efforts: low, medium (default), high, xhigh, max. Service tiers: priority.\n- `gpt-5.6-sol`: Older generation workhorse model. Reasoning efforts: low (default), medium, high, xhigh, max, ultra. Service tiers: priority.\n Spawns an agent to work on the specified task. If your current task is `/root/task1` and you spawn_agent with task_name \"task_3\" the agent will have canonical task name `/root/task1/task_3`.\nYou are then able to refer to this agent as `task_3` or `/root/task1/task_3` interchangeably. However an agent `/root/task2/task_3` would only be able to communicate with this agent via its canonical name `/root/task1/task_3`.\nThe spawned agent will have the same tools as you and the ability to spawn its own subagents.\n\nIt will be able to send you and other running agents messages, and its final answer will be provided to you when it finishes.\nThe new agent's canonical task name will be provided to it along with the message.\n\nNote that passing `fork_turns=\"none\"` will not pass any surrounding context to the spawned subagent, which may cause the agent to lack the context it needs to complete its task, whereas `fork_turns=\"all\"` will provide the subagent with all surrounding context.","output_schema":null,"parameters":{"type":"object","properties":{"fork_turns":{"type":"string","description":"Optional number of turns to fork. Defaults to `all`. Use `none`, `all`, or a positive integer string such as `3` to fork only the most recent turns."},"message":{"type":"string","description":"Initial plain-text task for the new agent.","encrypted":true},"model":{"type":"string","description":"Model override for the new agent. Omit unless an explicit override is needed."},"reasoning_effort":{"type":"string","description":"Reasoning effort override for the new agent. Omit to inherit the parent effort."},"task_name":{"type":"string","description":"Task name for the new agent. Use lowercase letters, digits, and underscores."}},"required":["task_name","message"],"additionalProperties":false}},{"type":"function","strict":false,"name":"wait_agent","description":"Wait for a mailbox update from any live agent, including queued messages and final-status notifications. The wait also ends early when new user input is steered into the active turn. Does not return the content; returns either a summary of which agents have updates (if any), an interruption summary for steered input, or a timeout summary if no activity arrives before the deadline.","output_schema":null,"parameters":{"type":"object","properties":{"timeout_ms":{"type":"number","description":"Timeout in milliseconds. Defaults to 30000, min 10000, max 3600000."}},"additionalProperties":false}}]},{"type":"namespace","name":"mcp__cua_repl","description":"UI automation through cua_repl using the initialized cua API.","tools":[{"type":"function","strict":false,"name":"js","description":"Control native apps or browsers on the user’s computer by reading or operating UI. Prefer purpose-built skills, connectors, APIs, or CLIs when available.\n\nOn the first invocation of `cua_repl`, or after resetting it, execute exactly one of the API calls shown below, optionally assigning its result to a variable. Do not add other API calls, waits, or snapshots to that invocation.\nThe tool result will include documentation and, when creating or selecting a tab or selecting an app, its initial UI state. Selecting a browser does not open a tab. Read that result before continuing.\nUse only APIs described in the tool instructions or returned documentation.\n\nWhen you need an inventory of available apps, browsers, and tabs, get a snapshot of all enabled surfaces. Otherwise, use the relevant entry point below:\n\n```javascript\nawait cua.getState();\n```\n\nUse the first matching browser control option from the user's request:\n\nFor a tab @-mention (`mention=tab-v1`):\nPass the complete `plugin://...` URL to get the referenced tab.\n\n```javascript\nlet tab = await cua.getTab({ mention: tabMentionUrl });\n```\n\nFor an existing tab identified by URL in browser context (including the current IAB tab):\n\n```javascript\nlet tab = await cua.getTab({ url }, { browser: browserId });\n```\n\nKnown tab ID (`tabId` or `providerTabId`) and browser (name or browser @-mention):\n\n```javascript\nlet tab = await cua.getTab(tabId, { browser: browserId });\n```\n\nTo open a URL in the in-app browser (`@Browser`):\n\n```javascript\nlet tab = await cua.createBrowserTab(\"iab\", url, { visible: boolean });\n```\n\nTo open a URL in another named browser: pass its name directly; do not call `getBrowser` first.\n\n```javascript\nlet tab = await cua.createBrowserTab(browserName, url, browserOptions);\n```\n\nKnown URL, only when the user has not specified a browser by name or @-mention:\n\n```javascript\nlet browser = await cua.getBrowser({ url });\n```\n\nBrowser IDs and options:\n\n- `\"mcpapps\"`: use `cua.getBrowser({ id: \"mcpapps\" })` for existing full-screen MCP Apps in the task’s side panel.\n- `\"iab\"` (in-app browser): in `createBrowserTab`, use `visible: true` to show the browser; `false` to keep it hidden.\n- `\"dot\"` (Dot): use only when present in browser inventory. It accesses tabs on Dot's active main thread. `cua.getTab(tabId, { browser: \"dot\" })` claims an existing tab; `cua.createBrowserTab(\"dot\", url, { visible: boolean })` creates one with the same visibility options as `\"iab\"`.\n- `\"chrome\"` (@Chrome), `\"edge\"` (@Edge): pass a short, emoji-prefixed `sessionName` (e.g. `\"🔎 Task\"`) to `createBrowserTab` when starting a task.\n\nIf the user specifies an app to use, get the app by name, bundle ID, or path:\n\n```javascript\nlet app = await cua.getApp(\"Example App\");\n```\n\nTo add other content to the tool result, use `nodeRepl.write(value)` for text or other values and `await nodeRepl.emitImage(image)` for images. The APIs listed above already display their documentation or UI state; do not wrap their results in `write` or `emitImage`.\n\nIf your context begins with a summary of an existing computer use task, call `await cua.rewriteDocumentation()` before continuing the computer use task to ensure you have a complete view of the necessary documentation. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{"code":{"type":"string","description":"JavaScript to execute using the initialized cua_repl runtime."},"timeout_ms":{"type":"integer","description":"Optional execution timeout in milliseconds. Defaults to 30000 (30 seconds) when omitted."},"title":{"type":"string","description":"Short user-facing description of what the code does."}},"required":["code"],"additionalProperties":false}},{"type":"function","strict":false,"name":"js_reset","description":"Reset the persistent cua_repl JavaScript session. All JavaScript bindings are discarded. The next cua_repl.js call initializes a fresh runtime for the enabled surfaces. This does not close browser tabs or native apps, or erase their state. This tool is part of plugin `unified-computer-use`.","output_schema":null,"parameters":{"type":"object","properties":{},"additionalProperties":false}}]}],"tool_choice":"auto","parallel_tool_calls":false,"prompt_cache_key":"01a14530-0099-7142-8981-e5e98a2373b1","prompt_cache_retention":"24h","text":{"format":{"type":"text"},"verbosity":"low"},"top_p":0.98,"top_logprobs":0,"temperature":1.0,"reasoning":{"effort":"low","context":"all_turns","summary":null,"mode":"standard"},"user":null,"usage":{"input_tokens":31022,"input_tokens_details":{"cached_tokens":30464,"cache_write_tokens":0},"output_tokens":40,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":31062,"attribution":{"items":{"at_64412749-886e-5d5b-896e-977cf0176f2b":{"input_tokens":9237,"cached_tokens":9237,"cache_write_tokens":0,"output_tokens":0},"ctc_07438c2e31b28b62016ad2395e227c8191a764ecc05974989f":{"input_tokens":111,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0},"ctco_01a14530-2010-70d3-b206-2818f13f0999":{"input_tokens":208,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":20,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":84,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":60,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":44,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0}]},"msg_01a14530-0bac-7712-b4af-40fb294025d9":{"input_tokens":10323,"cached_tokens":10323,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":3928,"cached_tokens":3928,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":5981,"cached_tokens":5981,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":67,"cached_tokens":67,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":178,"cached_tokens":178,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":169,"cached_tokens":169,"cache_write_tokens":0,"output_tokens":0}]},"msg_01a14530-0bac-7712-b4af-4106285f4fcc":{"input_tokens":539,"cached_tokens":539,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":539,"cached_tokens":539,"cache_write_tokens":0,"output_tokens":0}]},"msg_01a14530-0bac-7712-b4af-41146d376454":{"input_tokens":56,"cached_tokens":56,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":56,"cached_tokens":56,"cache_write_tokens":0,"output_tokens":0}]},"msg_01a14530-0bac-7712-b4af-41286c9f7736":{"input_tokens":6277,"cached_tokens":6093,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":6090,"cached_tokens":6090,"cache_write_tokens":0,"output_tokens":0},{"input_tokens":187,"cached_tokens":3,"cache_write_tokens":0,"output_tokens":0}]},"msg_01a14530-0c20-70a1-8262-3b3474e80c36":{"input_tokens":28,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":28,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0}]},"msg_07438c2e31b28b62016ad2395d8c548191bb42ef70b81cab0e":{"input_tokens":25,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":25,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":0}]},"msg_07438c2e31b28b62016ad23962c8988191bacf28b3144f2462":{"input_tokens":2,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":40,"content":[{"input_tokens":2,"cached_tokens":0,"cache_write_tokens":0,"output_tokens":40}]},"msg_e54f931f-aa11-5faf-8380-98e58a7c8fd1":{"input_tokens":4216,"cached_tokens":4216,"cache_write_tokens":0,"output_tokens":0,"content":[{"input_tokens":4216,"cached_tokens":4216,"cache_write_tokens":0,"output_tokens":0}]}}}},"tool_usage":{"image_gen":{"input_tokens":0,"output_tokens":0,"total_tokens":0,"input_tokens_details":{"text_tokens":0,"image_tokens":0},"output_tokens_details":{"image_tokens":0,"text_tokens":0}},"web_search":{"num_requests":0}},"safety_identifier":"user-LCV4XMHz3BRmrwLTeTQWC5P7","store":false,"metadata":{},"max_output_tokens":null,"max_tool_calls":null,"service_tier":"default","truncation":"disabled"}}+