gemi 0.205.0 → 0.205.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/AgentProvider.d.ts +9 -6
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +1 -1
- package/dist/ai/providers/endpoints.d.ts +13 -2
- package/dist/ai/providers/endpoints.d.ts.map +1 -1
- package/dist/ai/testing/index.js +1 -1
- package/dist/{chunk-ff63e1wx.js → chunk-3ek0s8fx.js} +1 -1
- package/dist/{chunk-2qcmcbsk.js → chunk-8a5wngew.js} +2 -2
- package/dist/{chunk-2qcmcbsk.js.map → chunk-8a5wngew.js.map} +1 -1
- package/dist/{chunk-at49en07.js → chunk-bb74k64k.js} +4 -4
- package/dist/{chunk-at49en07.js.map → chunk-bb74k64k.js.map} +4 -4
- package/dist/{chunk-b1fcttsr.js → chunk-fe2nkshn.js} +1 -1
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-ff63e1wx.js.map → chunk-3ek0s8fx.js.map} +0 -0
- /package/dist/{chunk-b1fcttsr.js.map → chunk-fe2nkshn.js.map} +0 -0
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"import type {\n ProviderCapabilities,\n ProviderStreamParams,\n ProviderToolNamespace,\n ProviderToolSpec,\n} from \"../AgentProvider\";\nimport type { JSONSchema } from \"../Schema\";\nimport type { AgentMessage, FilePart, ReasoningPart } from \"../types\";\nimport { unreadableNote } from \"./fileRejection\";\nimport {\n assertFilePart,\n attachmentIdOf,\n attachmentLine,\n isImageFile,\n toolResultOutput,\n} from \"./request\";\n\n/**\n * `ProviderStreamParams` to a Messages API body (`POST /v1/messages`), as a\n * pure function, for the reason `request.ts` gives: everything that can be\n * wrong here is wrong without a socket.\n *\n * The shapes follow Anthropic's API reference. What differs from the\n * Responses builder, and why:\n *\n * - Roles alternate and a tool result is a `user` block. gemi keeps a step's\n * calls and their results on one assistant message; here the calls stay in\n * the assistant turn and the results open the user turn right after it.\n * - `max_tokens` is required, so a call without `maxOutputTokens` sends\n * `DEFAULT_MAX_TOKENS`.\n * - `temperature` is never sent. On API version `2026-10-21` (see\n * `ANTHROPIC_VERSION`) it is a 400 on every model, whatever its value.\n * - `promptCacheKey` has no Anthropic counterpart: the cache keys on the\n * prefix itself, so it is not sent. Caching is asked for with `cache_control`\n * breakpoints instead; see `withCacheBreakpoints`.\n */\n\nexport type MessagesBlock = Record<string, unknown>;\nexport type MessagesMessage = { role: \"user\" | \"assistant\"; content: MessagesBlock[] };\nexport type MessagesTool = Record<string, unknown>;\n\nexport type MessagesRequest = {\n model: string;\n max_tokens: number;\n messages: MessagesMessage[];\n stream: true;\n system?: MessagesBlock[];\n tools?: MessagesTool[];\n tool_choice?: { type: \"auto\" | \"any\" | \"none\" | \"tool\"; name?: string; disable_parallel_tool_use?: boolean };\n thinking?:\n | {\n type: \"adaptive\";\n display?: \"summarized\";\n block_binding?: { prefix_mismatch_behavior: \"drop_block\" };\n }\n | { type: \"between_tools\" };\n output_config?: {\n effort?: string;\n format?: { type: \"json_schema\"; schema: JSONSchema };\n };\n};\n\n/**\n * Sent when the agent sets no `maxOutputTokens`. Every current Claude model\n * takes 64K or more (128K on the 4.6-and-later families, 64K on Haiku 4.5), and\n * the request is streamed, so a high cap costs nothing until it is used; a low\n * one cuts an answer off mid-thought.\n */\nexport const DEFAULT_MAX_TOKENS = 64_000;\n\nexport function buildMessagesRequest(\n params: ProviderStreamParams,\n ctx: {\n /** What the request names: the model id, or a Foundry deployment. */\n model: string;\n /** The model id, which the per-model rules below read. */\n modelId: string;\n capabilities: ProviderCapabilities;\n forcedToolChoice: boolean;\n /** Whether `thinking.block_binding` can be sent (it needs a beta header\n * that Anthropic's API takes and Foundry is not known to). */\n blockBinding: boolean;\n },\n): MessagesRequest {\n const body: MessagesRequest = {\n model: ctx.model,\n max_tokens: params.maxOutputTokens ?? DEFAULT_MAX_TOKENS,\n messages: toMessages(params.messages, ctx.capabilities),\n stream: true,\n };\n\n // A strict schema goes as `output_config.format`, unless it is over the\n // compiler's limits, in which case it is asked for like a loose one.\n const output = params.output;\n const strict = !!output?.strict && !overSchemaLimits(output.schema);\n\n const loose = output && !strict ? looseOutputInstruction(output.schema) : undefined;\n const system = [params.systemPrompt, loose].filter(Boolean);\n if (system.length > 0) body.system = [{ type: \"text\", text: system.join(\"\\n\\n\") }];\n\n const reasoning = ctx.capabilities.reasoning ? params.reasoning : undefined;\n if (reasoning === \"none\") {\n // Off where the model has a switch for it: Claude Sonnet 5.5 takes\n // `between_tools` at effort `high` or below. Claude Opus 5.5 and the\n // other 5.x models cannot turn thinking off (`disabled` is a 400), so\n // there `none` is the lowest effort and the model still thinks.\n if (/^claude-sonnet-5-5(?:-\\d{8})?$/.test(ctx.modelId)) body.thinking = { type: \"between_tools\" };\n body.output_config = { effort: \"low\" };\n } else if (reasoning) {\n body.thinking = { type: \"adaptive\", display: \"summarized\" };\n body.output_config = { effort: effortOf(reasoning, ctx.modelId) };\n } else if (ctx.capabilities.reasoning && repliesWithThinking(body.messages)) {\n // No effort was asked for, but the model thought anyway (adaptive\n // thinking is the default on the 5.x models) and its blocks are being sent\n // back. `thinking` is made explicit, which is what it already was, so\n // the binding below can be set on it.\n body.thinking = { type: \"adaptive\" };\n }\n\n // PRESERVED THINKING. A thinking block is bound to the conversation that\n // produced it, and `Agent` edits conversations: `contextWindow` and\n // compaction cut the start of the history, `activeTools` narrows the tools\n // and `prepareStep` the instructions from one step to the next. On the\n // models that check (Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable and Mythos 5.1\n // and 5.2), a block sent back after such an edit is a 400 for accounts\n // created from 2026-08-31 (on every account for Mythos 5.1 and the 5.2\n // models). `drop_block` has the API drop those blocks instead: the step\n // loses that reasoning and runs. Where the binding cannot be sent, the\n // provider strips the blocks and asks once more on that 400\n // (`thinkingMismatch`).\n if (body.thinking?.type === \"adaptive\" && ctx.blockBinding) {\n body.thinking.block_binding = { prefix_mismatch_behavior: \"drop_block\" };\n }\n\n if (output && strict) {\n body.output_config = {\n ...body.output_config,\n format: { type: \"json_schema\", schema: toClaudeSchema(output.schema) },\n };\n }\n\n const tools = toMessagesTools(params.tools);\n if (tools.length > 0) {\n body.tools = tools;\n // Forced choice works with adaptive thinking; only manual budgeted\n // thinking, which is never sent, refuses it.\n const choice = toolChoice(params.toolChoice, ctx.forcedToolChoice);\n if (!ctx.capabilities.parallelToolCalls) choice.disable_parallel_tool_use = true;\n if (params.toolChoice !== undefined || choice.disable_parallel_tool_use) body.tool_choice = choice;\n }\n\n return withCacheBreakpoints(body);\n}\n\nfunction repliesWithThinking(messages: MessagesMessage[]): boolean {\n return messages.some((message) =>\n message.content.some((block) => block.type === \"thinking\" || block.type === \"redacted_thinking\"),\n );\n}\n\n/** The beta header `thinking.block_binding` needs. */\nexport const THINKING_BINDING_BETA = \"thinking-binding-controls-2026-08-01\";\n\n/**\n * The request edits that answer a 400 once, with what to change.\n *\n * - `thinking`: a thinking block was bound to a different conversation (see\n * PRESERVED THINKING above) and the binding was not sent. The blocks are\n * stripped and the request asked again, which keeps the text and tool calls\n * and loses only the reasoning, as `drop_block` would.\n * - `schema`: `Schema is too complex for compilation.` The answer is asked for\n * in the system prompt instead, as for a loose schema.\n */\nexport function recoverableRequestError(message: string): \"thinking\" | \"schema\" | undefined {\n if (/bound to a different conversation|Invalid `signature` in `thinking` block/i.test(message)) {\n return \"thinking\";\n }\n if (/schema is too complex/i.test(message)) return \"schema\";\n return undefined;\n}\n\n/** The request without any thinking block, for the `thinking` retry. */\nexport function withoutThinkingBlocks(body: MessagesRequest): MessagesRequest {\n const messages: MessagesMessage[] = [];\n for (const message of body.messages) {\n const content = message.content.filter(\n (block) => block.type !== \"thinking\" && block.type !== \"redacted_thinking\",\n );\n if (content.length === 0) continue;\n const last = messages.at(-1);\n if (last?.role === message.role) last.content.push(...content);\n else messages.push({ role: message.role, content });\n }\n return { ...body, messages };\n}\n\n/**\n * gemi's effort onto `output_config.effort` (`low` … `max`). `minimal` and\n * `none` have no counterpart and are `low`. `xhigh` is `high` on the 4.6\n * models, which predate it. Anything else is sent as written, so a new level\n * works without a gemi release.\n */\nfunction effortOf(reasoning: string, modelId: string): string {\n if (reasoning === \"none\" || reasoning === \"minimal\") return \"low\";\n if (reasoning === \"xhigh\" && /^claude-(?:opus|sonnet)-4-6(?:-|$)/.test(modelId)) return \"high\";\n return reasoning;\n}\n\n/**\n * Prompt caching. The cache holds a prefix in render order (`tools`, then\n * `system`, then `messages`) up to a block marked `cache_control`, so three\n * breakpoints cover what an agent repeats: the last tool (the tool list), the\n * system prompt, and the last block of the last message, which the next step\n * extends, so it reads this step's prefix back. That is three of the four\n * allowed. A prefix under the model's minimum is not cached and costs nothing\n * extra: 512 tokens on Opus 5.5 and 5, Sonnet 5.5, Haiku 5.5 and Fable 5.x,\n * 1024 on Sonnet 5, Opus 4.8 and Sonnet 4.6, up to 4096 on Opus 4.6 and Haiku\n * 4.5. A cache write costs 1.25x input.\n *\n * Thinking blocks cannot carry `cache_control`, so the last message's\n * breakpoint goes on its last block that can.\n */\nfunction withCacheBreakpoints(body: MessagesRequest): MessagesRequest {\n const mark = (block: MessagesBlock | MessagesTool | undefined) => {\n if (block) block.cache_control = { type: \"ephemeral\" };\n };\n mark(body.tools?.at(-1));\n mark(body.system?.at(-1));\n const last = body.messages.at(-1)?.content ?? [];\n mark([...last].reverse().find((b) => b.type !== \"thinking\" && b.type !== \"redacted_thinking\"));\n return body;\n}\n\n// --- structured output ---------------------------------------------------\n\n/**\n * Keywords structured outputs refuse, per Anthropic's JSON schema limits:\n * numeric and string length constraints, and array constraints beyond\n * `minItems` 0 or 1.\n */\nconst UNSUPPORTED_KEYWORDS = new Set([\n \"minimum\",\n \"maximum\",\n \"exclusiveMinimum\",\n \"exclusiveMaximum\",\n \"multipleOf\",\n \"minLength\",\n \"maxLength\",\n \"maxItems\",\n \"uniqueItems\",\n]);\n\n/** The string formats structured outputs take. */\nconst SUPPORTED_FORMATS = new Set([\n \"date-time\",\n \"time\",\n \"date\",\n \"duration\",\n \"email\",\n \"hostname\",\n \"uri\",\n \"ipv4\",\n \"ipv6\",\n \"uuid\",\n]);\n\n/** Regex features structured outputs refuse: backreferences, lookaround and\n * word boundaries. */\nconst UNSUPPORTED_PATTERN = /\\\\[1-9]|\\(\\?<?[=!]|\\\\[bB]/;\n\nconst SCHEMA_MAPS = new Set([\"properties\", \"patternProperties\", \"$defs\", \"definitions\"]);\n\n/**\n * The agent's schema as structured outputs takes it, transformed the way\n * Anthropic's SDKs transform one: a constraint the API refuses (the keywords\n * above, a `minItems` over 1, a string `format` outside the supported list, a\n * `pattern` with backreferences, lookaround or `\\b`) is removed and written\n * into the node's `description` instead (`{minimum: 100}`), so the model still\n * reads it; and every object gets `additionalProperties: false`, which the API\n * requires. Nothing is lost: `Agent` validates the answer against the agent's\n * own schema, constraints included.\n */\nexport function toClaudeSchema(schema: JSONSchema): JSONSchema {\n const transform = (node: unknown): unknown => {\n if (Array.isArray(node)) return node.map(transform);\n if (!isObject(node)) return node;\n const out: Record<string, unknown> = {};\n const moved: string[] = [];\n for (const [key, value] of Object.entries(node)) {\n const refused =\n UNSUPPORTED_KEYWORDS.has(key) ||\n (key === \"minItems\" && typeof value === \"number\" && value > 1) ||\n (key === \"format\" && typeof value === \"string\" && !SUPPORTED_FORMATS.has(value)) ||\n (key === \"pattern\" && typeof value === \"string\" && UNSUPPORTED_PATTERN.test(value));\n if (refused) {\n moved.push(`${key}: ${JSON.stringify(value)}`);\n continue;\n }\n // These map names to schemas; a property named `minimum` is kept.\n out[key] =\n SCHEMA_MAPS.has(key) && isObject(value)\n ? Object.fromEntries(Object.entries(value).map(([name, sub]) => [name, transform(sub)]))\n : transform(value);\n }\n if (moved.length > 0) {\n const note = `{${moved.join(\", \")}}`;\n out.description = typeof out.description === \"string\" ? `${out.description} ${note}` : note;\n }\n if (out.type === \"object\" || isObject(out.properties)) out.additionalProperties = false;\n return out;\n };\n return transform(schema) as JSONSchema;\n}\n\n/**\n * Whether a schema is over the structured-output compiler's limits: 24\n * optional properties and 16 union-typed ones (`anyOf` or a type array)\n * across the request. Tools are not sent strict, so the output schema is the\n * only one counted. Over either, the API answers `Schema is too complex for\n * compilation.`; the answer is asked for like a loose schema's instead.\n */\nfunction overSchemaLimits(schema: JSONSchema): boolean {\n let optional = 0;\n let unions = 0;\n const visit = (node: unknown): void => {\n if (Array.isArray(node)) return node.forEach(visit);\n if (!isObject(node)) return;\n if (Array.isArray(node.anyOf) || Array.isArray(node.type)) unions++;\n if (isObject(node.properties)) {\n const required = new Set(Array.isArray(node.required) ? node.required : []);\n optional += Object.keys(node.properties).filter((name) => !required.has(name)).length;\n }\n for (const [key, value] of Object.entries(node)) {\n if (SCHEMA_MAPS.has(key) && isObject(value)) Object.values(value).forEach(visit);\n else visit(value);\n }\n };\n visit(schema);\n return optional > 24 || unions > 16;\n}\n\n/**\n * A schema that is not `strict` holds a free-form node (`s.json()`), which\n * structured outputs cannot express (every object needs `additionalProperties:\n * false`). It is not sent as `output_config.format`, which would be a 400;\n * the model is asked for the JSON in the system prompt instead, and `Agent`\n * validates what comes back. Schemas over the compiler's limits go the same\n * way (`overSchemaLimits`).\n */\nfunction looseOutputInstruction(schema: JSONSchema): string {\n return `Answer with only a JSON value (no prose, no code fence) that matches this JSON schema:\\n${JSON.stringify(schema)}`;\n}\n\n/**\n * gemi's `toolChoice` onto `tool_choice`.\n *\n * `\"required\"` is `any` and `{ name }` is `tool`, on the models that take them.\n * Claude Opus 5.5, Claude Sonnet 5.5 and Claude Fable 5.1 answer both with a\n * 400 (`tool_choice: type \"tool\" and \"any\" are not supported for this model.`),\n * so on those, and on any id `supportsForcedToolChoice` does not know, the\n * choice is sent as `auto`: the step still runs, and the prompt that asked for\n * the tool still asks for it. Failing the step instead would fail every step a\n * `prepareStep` forces, with no setting to turn it off.\n */\nfunction toolChoice(\n choice: ProviderStreamParams[\"toolChoice\"],\n forced: boolean,\n): NonNullable<MessagesRequest[\"tool_choice\"]> {\n if (choice === \"none\") return { type: \"none\" };\n if (choice === \"required\") return forced ? { type: \"any\" } : { type: \"auto\" };\n if (choice && typeof choice === \"object\") {\n return forced ? { type: \"tool\", name: choice.name } : { type: \"auto\" };\n }\n return { type: \"auto\" };\n}\n\n// --- messages ------------------------------------------------------------\n\n/**\n * `AgentMessage[]` to alternating `user` / `assistant` messages.\n *\n * Parts are laid out in order, each with the role it has on this API: the\n * assistant's text and tool calls are `assistant`, a tool result is `user`, and\n * the user's own words and files are `user`. Consecutive blocks of one role\n * are one message, which is what the API wants and what a step that called\n * three tools needs: three `tool_use` blocks in one turn, three `tool_result`\n * blocks in the next.\n *\n * Tool results are not placed where they sit in gemi's message but right after\n * the turn that made their calls, first in the user turn, in call order: the\n * API requires every `tool_use` to be answered in the very next message, with\n * the results before anything else in it. A step's calls are answered where\n * the step is known to be over: at the next message, or, when gemi kept the\n * next step on the same message, at the first block after a tool result. The\n * pairing rules are those of\n * `reconcileToolPairs` in `request.ts`, and for the same reasons: a repeated\n * call or result is dropped, a result for a call this history does not hold is\n * dropped, and a call left without a result gets one saying so.\n */\nexport function toMessages(\n messages: AgentMessage[],\n capabilities: ProviderCapabilities,\n): MessagesMessage[] {\n // `step-end` marks where a step's calls are known to be done: a new\n // message, or a tool result (the next step's blocks can share the message).\n const blocks: ({ role: \"user\" | \"assistant\"; block: MessagesBlock } | \"step-end\")[] = [];\n const results = new Map<string, MessagesBlock>();\n\n for (const message of messages) {\n // A system-role message in the history is the app's, not the user's, but\n // `messages` takes only two roles; it is sent as user text.\n const role = message.role === \"assistant\" ? \"assistant\" : \"user\";\n blocks.push(\"step-end\");\n for (const part of message.content ?? []) {\n switch (part.type) {\n case \"text\": {\n // The assistant's text goes back exactly as the model wrote it,\n // whitespace-only blocks included (the \"\\n\\n\" before a tool call):\n // anything else is an edit to the turn. Only an empty string, which\n // the API refuses, is left out. A user's blank text is noise.\n const keep = role === \"assistant\" ? !!part.text : !!part.text?.trim();\n if (keep) blocks.push({ role, block: { type: \"text\", text: part.text } });\n break;\n }\n case \"output\": {\n if (part.partial) break;\n // The model's own text when the part kept it; re-serializing the\n // value would change its whitespace and number formatting.\n const text = part.text ?? JSON.stringify(part.value);\n blocks.push({ role, block: { type: \"text\", text } });\n break;\n }\n case \"file\": {\n if (role === \"assistant\") break;\n for (const block of fileBlocks(part, capabilities)) blocks.push({ role, block });\n break;\n }\n case \"reasoning\": {\n // Claude's own thinking goes back as it came, signature and all,\n // empty ones included. Another provider's reasoning (a Responses\n // item id) means nothing here and is left out.\n const block = role === \"assistant\" ? thinkingBlock(part) : undefined;\n if (block) blocks.push({ role, block });\n break;\n }\n case \"tool-call\": {\n if (part.partial) break;\n blocks.push({\n role: \"assistant\",\n block: {\n type: \"tool_use\",\n id: part.toolCallId,\n name: String(part.name),\n input: isObject(part.input) ? part.input : {},\n },\n });\n break;\n }\n case \"tool-result\": {\n blocks.push(\"step-end\");\n if (results.has(part.toolCallId)) break;\n results.set(part.toolCallId, {\n type: \"tool_result\",\n tool_use_id: part.toolCallId,\n content: toolResultOutput(part),\n ...(part.status === \"error\" ? { is_error: true } : {}),\n });\n break;\n }\n }\n }\n }\n\n const out: MessagesMessage[] = [];\n const push = (role: \"user\" | \"assistant\", block: MessagesBlock) => {\n const last = out[out.length - 1];\n if (last && last.role === role) last.content.push(block);\n else out.push({ role, content: [block] });\n };\n const called = new Set<string>();\n // The calls of the assistant turn being written, answered when it ends.\n let open: string[] = [];\n let stepEnded = false;\n const answer = () => {\n for (const id of open) push(\"user\", results.get(id) ?? noResult(id));\n open = [];\n stepEnded = false;\n };\n\n for (const entry of blocks) {\n if (entry === \"step-end\") {\n stepEnded = true;\n continue;\n }\n const { role, block } = entry;\n // Anything after a finished step's calls, in either role, comes after\n // their results.\n if (stepEnded || role === \"user\") answer();\n if (block.type === \"tool_use\") {\n const id = String(block.id);\n if (called.has(id)) continue;\n called.add(id);\n open.push(id);\n }\n push(role, block);\n }\n answer();\n\n // The API wants a user turn first, and on the 4.6-and-later models it\n // refuses a history that ends on the assistant (that is a prefill). Both\n // happen when an app starts a run from a trimmed or assistant-authored\n // history. The turns added are fixed text, so the prefix stays the same\n // from one step to the next.\n if (out[0]?.role === \"assistant\") {\n out.unshift({ role: \"user\", content: [{ type: \"text\", text: HISTORY_STARTS_HERE }] });\n }\n if (out.at(-1)?.role === \"assistant\") {\n out.push({ role: \"user\", content: [{ type: \"text\", text: CONTINUE }] });\n }\n return out;\n}\n\nconst HISTORY_STARTS_HERE = \"(The conversation continues from an earlier point.)\";\nconst CONTINUE = \"Continue.\";\n\nconst NO_RESULT_RECORDED = \"No result was recorded for this tool call. Assume it did not complete.\";\n\nfunction noResult(toolUseId: string): MessagesBlock {\n return { type: \"tool_result\", tool_use_id: toolUseId, content: NO_RESULT_RECORDED };\n}\n\n/** A reasoning part this provider wrote, back as its block; else nothing. */\nfunction thinkingBlock(part: ReasoningPart): MessagesBlock | undefined {\n const meta = part.providerMetadata?.anthropic;\n if (!isObject(meta)) return undefined;\n if (meta.type === \"thinking\" && typeof meta.signature === \"string\") {\n return { type: \"thinking\", thinking: part.text ?? \"\", signature: meta.signature };\n }\n if (meta.type === \"redacted_thinking\" && typeof meta.data === \"string\") {\n return { type: \"redacted_thinking\", data: meta.data };\n }\n return undefined;\n}\n\n/**\n * A file part as the model is told about it, with the rules of the `file` case\n * in `toResponsesInput`: the attachment line when the part has an attachment\n * id, and the file itself when the model can read it.\n *\n * Files go by Files API id (`source: {type: \"file\"}`): an image as an `image`\n * block, a PDF or plain text as a `document`. Those are the types the API\n * reads; any other file is not shown (it would be a 400), and the model is told\n * so. Without `fileInput` it is the attachment line alone.\n */\nfunction fileBlocks(part: FilePart, capabilities: ProviderCapabilities): MessagesBlock[] {\n const attachmentId = attachmentIdOf(part);\n const line = (shown: boolean): MessagesBlock[] =>\n attachmentId ? [{ type: \"text\", text: attachmentLine(part, shown) }] : [];\n if (!capabilities.fileInput) return line(false);\n assertFilePart(part, attachmentId);\n if (!part.fileId) return line(false);\n const kind = part.providerRejected ? undefined : fileKind(part);\n if (!kind) return [...line(false), { type: \"text\", text: unreadableNote(part.name) }];\n return [...line(true), { type: kind, source: { type: \"file\", file_id: part.fileId } }];\n}\n\nconst IMAGE_TYPES = new Set([\"image/jpeg\", \"image/png\", \"image/gif\", \"image/webp\"]);\n\nfunction fileKind(part: FilePart): \"image\" | \"document\" | undefined {\n const mimeType = part.mimeType?.trim().toLowerCase() ?? \"\";\n if (isImageFile(part)) return !mimeType || IMAGE_TYPES.has(mimeType) ? \"image\" : undefined;\n if (mimeType) return mimeType === \"application/pdf\" || mimeType === \"text/plain\" ? \"document\" : undefined;\n return /\\.(pdf|txt)$/i.test(part.name ?? \"\") ? \"document\" : undefined;\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\n\n// --- tools ---------------------------------------------------------------\n\nfunction isNamespace(\n entry: ProviderToolSpec | ProviderToolNamespace,\n): entry is ProviderToolNamespace {\n return Array.isArray((entry as ProviderToolNamespace).tools);\n}\n\n/**\n * Tools onto the `tools` array, flat: this provider reports no tool search\n * (`capabilitiesForClaude`), so a namespace is flattened and a deferred tool\n * is sent whole, exactly as `toResponsesTools` does for a model without it.\n *\n * `strict` is not sent. Anthropic's strict tool use allows at most 20 strict\n * tools and 24 optional parameters across them per request, and refuses\n * numeric and length constraints, so passing gemi's flag through would turn an\n * agent with many tools into a 400. `Agent` validates every call's arguments\n * against the tool's schema either way.\n *\n * `eager_input_streaming` is on for every tool: the request is always\n * streamed, and without it the API buffers each argument until it is whole, so\n * a tool that writes a file sends nothing for as long as the model writes it.\n * It also gives up the API's own validation of the arguments, which `Agent`\n * does anyway.\n */\nexport function toMessagesTools(\n tools: (ProviderToolSpec | ProviderToolNamespace)[] | undefined,\n): MessagesTool[] {\n const out: MessagesTool[] = [];\n for (const entry of tools ?? []) {\n for (const tool of isNamespace(entry) ? entry.tools : [entry]) {\n out.push({\n name: tool.name,\n description: tool.description,\n input_schema: tool.parameters,\n eager_input_streaming: true,\n });\n }\n }\n return out;\n}\n",
|
|
13
13
|
"import type { ProviderEvent } from \"../AgentProvider\";\nimport type { AgentError, FinishReason, Usage } from \"../types\";\nimport { emptyUsage, sseMessages } from \"./stream\";\n\n/**\n * The Messages API SSE stream to `ProviderEvent`, a pure function over chunks\n * like `parseResponsesStream`, driven in the tests by the hand-written\n * fixtures in `__fixtures__/anthropic-*.sse`.\n *\n * The event flow, from Anthropic's streaming reference: `message_start` (the\n * model and the input usage), then per content block `content_block_start`,\n * its `content_block_delta`s and `content_block_stop`, then `message_delta`\n * (the stop reason, and usage that is CUMULATIVE, not an increment) and\n * `message_stop`. `ping` frames come at any time, an `error` frame can replace\n * the rest, and unknown event types are to be ignored.\n *\n * Thinking is `reasoning-delta`s with no id. A `thinking` block's text streams\n * as it comes, and at its stop one more, empty delta carries the signature as\n * `providerMetadata.anthropic`, which closes the part. A `redacted_thinking`\n * block is one empty delta carrying its `data`. `anthropicRequest.ts` turns\n * those parts back into the blocks, unchanged, as the API requires.\n */\n\ntype ParseOptions = {\n /** The agent asked for an `output` schema, so text is the answer's JSON. */\n structuredOutput?: boolean;\n};\n\ntype OpenBlock = { type: string; id?: string; name?: string; args: string; signature: string };\n\nexport async function* parseMessagesStream(\n chunks: AsyncIterable<string> | Iterable<string>,\n options: ParseOptions = {},\n): AsyncGenerator<ProviderEvent> {\n const blocks = new Map<number, OpenBlock>();\n // Calls whose arguments are not whole JSON, held until the stop reason says\n // whether they were cut off.\n const held: OpenBlock[] = [];\n let model: string | undefined;\n let usage: RawUsage = {};\n let stopReason: string | undefined;\n let stopDetails: Record<string, any> | undefined;\n let finished = false;\n\n const ended = (reason: FinishReason): ProviderEvent => ({\n type: \"finish\",\n reason,\n usage: toAnthropicUsage(usage),\n ...(model ? { model } : {}),\n });\n\n for await (const message of sseMessages(chunks)) {\n let payload: Record<string, any>;\n try {\n payload = JSON.parse(message.data);\n } catch {\n continue;\n }\n const type: string = typeof payload.type === \"string\" ? payload.type : message.event;\n\n switch (type) {\n case \"message_start\": {\n const start = payload.message ?? {};\n if (typeof start.model === \"string\" && start.model) model = start.model;\n usage = mergeUsage(usage, start.usage);\n break;\n }\n\n case \"content_block_start\": {\n const index = Number(payload.index);\n const block = payload.content_block ?? {};\n const open: OpenBlock = {\n type: String(block.type ?? \"\"),\n id: typeof block.id === \"string\" ? block.id : undefined,\n name: typeof block.name === \"string\" ? block.name : undefined,\n args: \"\",\n signature: typeof block.signature === \"string\" ? block.signature : \"\",\n };\n blocks.set(index, open);\n // Redacted thinking arrives whole: encrypted, nothing to show, and\n // sent back as it came.\n if (open.type === \"redacted_thinking\") {\n yield {\n type: \"reasoning-delta\",\n delta: \"\",\n providerMetadata: { anthropic: { type: \"redacted_thinking\", data: String(block.data ?? \"\") } },\n };\n }\n // A text block opens empty in every recorded shape, but the field is\n // there, so a gateway that sends it whole is read.\n if (open.type === \"text\" && typeof block.text === \"string\" && block.text) {\n yield textEvent(block.text, options);\n }\n break;\n }\n\n case \"content_block_delta\": {\n const block = blocks.get(Number(payload.index));\n const delta = payload.delta ?? {};\n if (!block) break;\n if (delta.type === \"text_delta\") {\n const text = String(delta.text ?? \"\");\n if (text) yield textEvent(text, options);\n } else if (delta.type === \"thinking_delta\") {\n const text = String(delta.thinking ?? \"\");\n if (text) yield { type: \"reasoning-delta\", delta: text };\n } else if (delta.type === \"signature_delta\") {\n block.signature += String(delta.signature ?? \"\");\n } else if (delta.type === \"input_json_delta\" && block.type === \"tool_use\") {\n const fragment = String(delta.partial_json ?? \"\");\n if (!fragment) break;\n block.args += fragment;\n yield {\n type: \"tool-call-delta\",\n toolCallId: block.id ?? \"\",\n name: block.name ?? \"\",\n argsDelta: fragment,\n };\n }\n break;\n }\n\n case \"content_block_stop\": {\n const index = Number(payload.index);\n const block = blocks.get(index);\n blocks.delete(index);\n // The signature closes the thinking part, and is what lets it be sent\n // back (see `ReasoningPart.providerMetadata`). A block with no text\n // (`display: \"omitted\"`) still becomes a part: it has to go back too.\n if (block?.type === \"thinking\") {\n yield {\n type: \"reasoning-delta\",\n delta: \"\",\n providerMetadata: { anthropic: { type: \"thinking\", signature: block.signature } },\n };\n }\n if (block?.type === \"tool_use\") {\n // A call with no arguments streams no delta at all; its input is\n // the empty object.\n block.args ||= \"{}\";\n // A block is stopped even when `max_tokens` cut it off, and then its\n // arguments are a prefix of the JSON. Such a call must not be\n // emitted whole, or it would run; it is held for `message_stop`.\n if (isJson(block.args)) yield toolCall(block);\n else held.push(block);\n }\n break;\n }\n\n case \"message_delta\": {\n if (typeof payload.delta?.stop_reason === \"string\") stopReason = payload.delta.stop_reason;\n if (payload.delta?.stop_details) stopDetails = payload.delta.stop_details;\n usage = mergeUsage(usage, payload.usage);\n break;\n }\n\n case \"message_stop\": {\n finished = true;\n // A refusal is the model's safety classifier declining, on HTTP 200.\n // Ending it `stop` would read as an answer, which is the mistake\n // `content_filtered` exists to prevent (as with OpenAI's refusal item).\n if (stopReason === \"refusal\") {\n yield { type: \"error\", error: refusalError(stopDetails) };\n yield ended(\"error\");\n break;\n }\n const reason = finishReasonOf(stopReason);\n // Cut off: the held calls never finished, so they are discarded (the\n // agent forgets them and the client removes their partial parts) and\n // the call ends `length`. Otherwise a held call is the model's own\n // malformed JSON, passed on for `Agent` to report against the tool.\n if (held.length > 0 && reason === \"length\") {\n yield { type: \"tool-call-discard\", toolCallIds: held.map((b) => b.id ?? \"\") };\n } else {\n for (const block of held) yield toolCall(block);\n }\n yield ended(reason);\n break;\n }\n\n case \"error\": {\n finished = true;\n yield { type: \"error\", error: anthropicStreamError(payload.error ?? payload) };\n yield ended(\"error\");\n break;\n }\n }\n\n if (finished) return;\n }\n\n // No `message_stop`: the connection closed under the answer. Retryable, as\n // in `parseResponsesStream`.\n yield {\n type: \"error\",\n error: {\n code: \"provider_error\",\n message: \"The provider stream ended without a terminal event.\",\n retryable: true,\n },\n };\n yield ended(\"error\");\n}\n\nfunction toolCall(block: OpenBlock): ProviderEvent {\n return { type: \"tool-call\", toolCallId: block.id ?? \"\", name: block.name ?? \"\", args: block.args };\n}\n\nfunction isJson(text: string): boolean {\n try {\n JSON.parse(text);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction textEvent(delta: string, options: ParseOptions): ProviderEvent {\n return options.structuredOutput ? { type: \"output-delta\", delta } : { type: \"text-delta\", delta };\n}\n\n/**\n * `stop_reason` onto gemi's finish reasons. `max_tokens` is a truncated answer,\n * and so is `model_context_window_exceeded` (the answer ran into the context\n * window rather than the cap). Everything else that ends a turn normally\n * (`end_turn`, `tool_use`, `stop_sequence`, and `pause_turn`, which only\n * server tools produce) is `stop`; `Agent` reads the tool calls themselves.\n */\nfunction finishReasonOf(stopReason: string | undefined): FinishReason {\n if (stopReason === \"max_tokens\" || stopReason === \"model_context_window_exceeded\") return \"length\";\n return \"stop\";\n}\n\nfunction refusalError(details: Record<string, any> | undefined): AgentError {\n const explanation = typeof details?.explanation === \"string\" ? details.explanation : \"\";\n const category = typeof details?.category === \"string\" ? ` (${details.category})` : \"\";\n return {\n code: \"content_filtered\",\n message: explanation || `The model declined to answer${category}.`,\n retryable: false,\n };\n}\n\n/**\n * An `error` frame, which arrives on a 200: the request was accepted and the\n * failure came later, so it is retryable unless its type says the request\n * itself is wrong. `overloaded_error` is the one seen most, the 529 of a\n * streamed call.\n */\nexport function anthropicStreamError(raw: any): AgentError {\n const type = String(raw?.type ?? \"\").toLowerCase();\n const message = typeof raw?.message === \"string\" ? raw.message : \"The provider stream failed.\";\n if (type === \"rate_limit_error\") return { code: \"rate_limited\", message, retryable: true };\n if (type === \"invalid_request_error\" || type === \"request_too_large\") {\n const tooLong = /prompt is too long|request_too_large/i.test(`${type} ${message}`);\n return {\n code: tooLong ? \"context_length_exceeded\" : \"provider_error\",\n message,\n retryable: false,\n };\n }\n if (\n type === \"authentication_error\" ||\n type === \"permission_error\" ||\n type === \"billing_error\" ||\n type === \"not_found_error\"\n ) {\n return { code: \"provider_error\", message, retryable: false };\n }\n return { code: \"provider_error\", message, retryable: true };\n}\n\ntype RawUsage = {\n input_tokens?: number;\n output_tokens?: number;\n cache_creation_input_tokens?: number;\n cache_read_input_tokens?: number;\n /** From `output_tokens_details.thinking_tokens`, part of `output_tokens`. */\n thinking_tokens?: number;\n};\n\n/** The latest value of each field: `message_delta` usage is cumulative. */\nfunction mergeUsage(total: RawUsage, raw: any): RawUsage {\n if (!raw || typeof raw !== \"object\") return total;\n const next = { ...total };\n for (const key of [\n \"input_tokens\",\n \"output_tokens\",\n \"cache_creation_input_tokens\",\n \"cache_read_input_tokens\",\n ] as const) {\n if (typeof raw[key] === \"number\") next[key] = raw[key];\n }\n const thinking = raw.output_tokens_details?.thinking_tokens;\n if (typeof thinking === \"number\") next.thinking_tokens = thinking;\n return next;\n}\n\n/**\n * Anthropic usage onto `Usage`.\n *\n * Anthropic reports input in three disjoint parts: `input_tokens` (after the\n * last cache breakpoint), `cache_read_input_tokens` and\n * `cache_creation_input_tokens`. gemi's `inputTokens` is the whole prompt, as\n * OpenAI reports it, so it is their sum, and the two cache parts are its\n * breakdown (`cachedInputTokens`, `cacheWriteInputTokens`). Thinking tokens are part\n * of `output_tokens` and are its `reasoningTokens` breakdown. A field the\n * response did not carry stays absent rather than zero.\n */\nexport function toAnthropicUsage(raw: RawUsage | undefined): Usage {\n if (!raw) return emptyUsage();\n const read = raw.cache_read_input_tokens;\n const write = raw.cache_creation_input_tokens;\n const inputTokens = (raw.input_tokens ?? 0) + (read ?? 0) + (write ?? 0);\n const outputTokens = raw.output_tokens ?? 0;\n const usage: Usage = { inputTokens, outputTokens, totalTokens: inputTokens + outputTokens };\n if (typeof read === \"number\") usage.cachedInputTokens = read;\n if (typeof write === \"number\") usage.cacheWriteInputTokens = write;\n if (typeof raw.thinking_tokens === \"number\") usage.reasoningTokens = raw.thinking_tokens;\n return usage;\n}\n",
|
|
14
14
|
"import type { ProviderCapabilities } from \"../AgentProvider\";\n\n/**\n * What a model can do, read off its id.\n *\n * Hardcoding `true` was never an option — `reasoning: { effort }` is a 400 on\n * gpt-4o, and `defer_loading` is a 400 on anything that predates tool search —\n * but neither is a table lookup that only answers for ids we shipped knowing\n * about.\n *\n * SO AN UNKNOWN ID GETS EVERY CAPABILITY. That is the whole point: a model\n * released next Tuesday must be usable by writing its name, not by waiting for\n * a gemi release. The default is chosen for how it fails, not for how often it\n * is right. Guessing high fails loudly and once — the API rejects the request\n * and names the parameter it disliked, and the fix is one line of config.\n * Guessing low fails silently and forever: reasoning is dropped, every deferred\n * schema is inlined, and the only symptom is a bigger bill and a worse answer.\n * Unknown ids also skew new rather than old, because nobody invents the name of\n * a model that already shipped.\n *\n * The named families below exist to make the *known-old* cases right, which is\n * the only place a guess can be wrong in the quiet direction.\n *\n * Note what an answer of `false` does and does not buy. `reasoning: false` and\n * `toolSearch: false` change the request, because both are optimizations and\n * the run is identical without them. `structuredOutput: false` does not: it is\n * reported honestly for a caller that wants to branch on it, but the request\n * builder still sends the schema, because an agent that declared an `output`\n * has an app waiting on a typed result and dropping the parameter would answer\n * prose forever with nothing to branch on. See `request.ts`.\n *\n * `fileInput` IS DELIBERATELY STILL ONE FLAG, and this was reopened rather than\n * inherited. Splitting it into \"reads images\" and \"reads documents\" was the\n * obvious answer to #488, so it was measured before it was written: gpt-5.4 and\n * gpt-4o were each sent an uploaded PNG as `input_image` and an uploaded PDF as\n * `input_file`, and all four calls returned 200 with the right answer (the\n * transcript is in `request.ts`, above `IMAGE_EXTENSIONS`). The two abilities\n * did not come apart on either model, so there is nothing here for a second\n * flag to describe.\n *\n * Adding it anyway would be worse than none. Every guess in this file is a\n * guess about an id nobody has run yet, and the guess is high on purpose; a\n * second flag does not describe the world more finely, it doubles the number of\n * ways that guess can be wrong quietly, and the wrong-quiet direction is the\n * one with no error message. The split earns its place the day a model answers\n * 200 to one of those two calls and 400 to the other — and that call is cheap\n * to repeat, which is why the recipe is written down rather than the conclusion\n * alone.\n */\nexport function capabilitiesForModel(model: string): ProviderCapabilities {\n const id = normalizeModelId(model);\n\n // Everything before the tool-era models. Listed by prefix because these names\n // are closed sets now — nothing new will be called `gpt-3.5-*`.\n if (id.startsWith(\"gpt-3.5\") || id.startsWith(\"text-\") || id.startsWith(\"davinci\")) {\n return {\n reasoning: false,\n structuredOutput: false,\n fileInput: false,\n parallelToolCalls: true,\n toolSearch: false,\n };\n }\n\n const family = parseFamily(id);\n\n // o1 reasons but takes its tool calls one at a time; o3/o4 do not have that\n // restriction. Both predate tool search.\n if (family?.kind === \"o\") {\n return {\n reasoning: true,\n structuredOutput: true,\n fileInput: true,\n parallelToolCalls: family.major > 1,\n toolSearch: supportsToolSearch(family),\n };\n }\n\n if (family?.kind === \"gpt\") {\n return {\n // gpt-4 and gpt-4o are strong models with no reasoning parameter at all.\n reasoning: family.major >= 5,\n // Strict `json_schema` landed with gpt-4o; plain gpt-4 only has json_object.\n structuredOutput: family.major > 4 || id.startsWith(\"gpt-4o\") || id.startsWith(\"gpt-4.1\"),\n fileInput: family.major > 4 || id.startsWith(\"gpt-4o\") || id.startsWith(\"gpt-4.1\"),\n parallelToolCalls: true,\n toolSearch: supportsToolSearch(family),\n };\n }\n\n return {\n reasoning: true,\n structuredOutput: true,\n fileInput: true,\n parallelToolCalls: true,\n toolSearch: true,\n };\n}\n\n/**\n * Tool search, by generation.\n *\n * MEASURED, not read off a changelog. Every id below was sent a request\n * carrying `{type:\"tool_search\"}` plus one `namespace` of deferred functions,\n * against `https://api.openai.com/v1/responses`:\n *\n * accepted (200): gpt-5.6-terra, gpt-5.5, gpt-5.4, gpt-5.4-mini,\n * gpt-5.3-codex, gpt-5.2\n * rejected (400): gpt-5.1, gpt-5, gpt-5-mini, gpt-4.1, gpt-4o, o4-mini, o3\n *\n * with the rejection reading, verbatim,\n * `Tool 'tool_search' is not supported with gpt-5.1.` — recorded as\n * `__fixtures__/openai-error-tool-search-unsupported.json`.\n *\n * So the boundary is the *minor* number, and the whole-major rule this used to\n * carry (`major >= 5`) was wrong in the expensive direction for four shipped\n * models: gpt-5, gpt-5-mini and gpt-5.1 would have had `defer_loading` and a\n * `tool_search` tool put in every request and answered 400 on all of them.\n * Reading the minor is the only way to be right here, because gpt-5 and gpt-5.4\n * differ by a decimal point and by this capability.\n *\n * The o-series keeps its `major >= 5` guard rather than being hardcoded false:\n * o1 through o4 are all measured rejections above, and an o5 that does not\n * exist gets the same benefit-of-the-doubt an unknown id gets, for the reason\n * in the module comment.\n */\nfunction supportsToolSearch(family: Family): boolean {\n if (family.kind === \"o\") return family.major >= 5;\n return family.major > 5 || (family.major === 5 && family.minor >= 2);\n}\n\n/**\n * What a Claude model can do, read off its id, with the same bias as\n * `capabilitiesForModel`: an id this does not know gets every capability that\n * is safe to guess.\n *\n * - `reasoning`: adaptive thinking (`thinking: {type: \"adaptive\"}` with\n * `output_config.effort`), which the 4.6 models and everything after take.\n * The 4.5 generation and older only take a token budget and answer adaptive\n * thinking with a 400, so `reasoning` is dropped for them.\n * - `fileInput`: images (JPEG, PNG, GIF, WebP), PDFs and plain text, uploaded\n * through the Files API. Other types are not shown; see `fileBlocks`.\n * - `toolSearch`: false for now. Anthropic has a tool search tool, but\n * replaying its results in a history is not built yet, so deferred tools and\n * namespaces are sent flat and whole, which runs the agent the same.\n *\n * Forced tool choice is not a capability an agent can branch on; it decides\n * how the request is built. See `supportsForcedToolChoice`.\n */\nexport function capabilitiesForClaude(model: string): ProviderCapabilities {\n const id = normalizeModelId(model);\n // `claude-opus-4-1`, `claude-haiku-4-5`, `claude-sonnet-4-20250514` (minor\n // 0): the 4.x releases before 4.6.\n const four = /^claude-(?:opus|sonnet|haiku)-4(?:-(\\d{1,2}))?(?:-\\d{8})?$/.exec(id);\n const legacy = /^claude-(?:3|2|instant)/.test(id) || (!!four && Number(four[1] ?? 0) <= 5);\n return {\n reasoning: !legacy,\n structuredOutput: true,\n fileInput: true,\n parallelToolCalls: true,\n toolSearch: false,\n };\n}\n\n/**\n * Whether a Claude model takes `tool_choice` `any` and `tool`.\n *\n * Claude Opus 5.5, Claude Sonnet 5.5, Claude Fable 5.1 (and the Mythos and\n * 5.2 releases beside them) answer both with a 400, and every release since\n * Claude Opus 5 that did not keep them has dropped them. So this is a list of\n * the families known to take them, not of those known to refuse, and an id it\n * does not know is sent `auto`: a step that should have called a tool and\n * wrote text instead is a worse step, while a 400 is a failed one on every\n * forced step.\n */\nexport function supportsForcedToolChoice(model: string): boolean {\n const id = normalizeModelId(model);\n return (\n /^claude-(?:3|2|instant)/.test(id) ||\n /^claude-(?:opus|sonnet|haiku)-4(?:-|$)/.test(id) ||\n /^claude-(?:opus|sonnet|fable|mythos)-5(?:-\\d{8})?$/.test(id) ||\n /^claude-haiku-5-5(?:-\\d{8})?$/.test(id)\n );\n}\n\n/**\n * Azure deployment names are chosen by whoever ran the ARM template, so half of\n * them look nothing like a model id. That is not a special case here: an\n * unrecognizable deployment name lands on the same all-true default as an\n * unrecognized model, for the same reason.\n */\nfunction normalizeModelId(model: string): string {\n return model.trim().toLowerCase();\n}\n\nexport type Family = { kind: \"gpt\" | \"o\"; major: number; minor: number };\n\n/**\n * Reads the generation out of `gpt-5.4-mini-2025-01-01` or `o3-mini`.\n *\n * The minor number is read as well as the major, and it is load-bearing: tool\n * search arrived at gpt-5.2, so `gpt-5` and `gpt-5.4` are two different answers\n * to the same question and a major-only reading gets one of them wrong. An id\n * with no minor — `gpt-5`, `gpt-4o`, `o3` — is minor 0, which is what it is.\n *\n * Exported for its own test: the classification is what the guards below are\n * really about, and it is the only place they are observable — two ids can\n * classify differently and still land on the same capability answer today.\n */\nexport function parseFamily(id: string): Family | null {\n const gpt = /^gpt-(\\d+)(?:\\.(\\d+))?/.exec(id);\n if (gpt?.[1]) return { kind: \"gpt\", major: Number(gpt[1]), minor: Number(gpt[2] ?? 0) };\n // `o1`, `o3-mini`, `o4-mini`. The boundary is what keeps an id whose leading\n // digits are not a generation out of this family — `o200k-base` is a\n // tokenizer, not an o-series model, and `/^o(\\d+)/` alone reads it as\n // generation 200. (`omni-moderation` never gets this far: `m` is not a\n // digit.) Both land on the unknown default today, so the boundary is only\n // visible in the classification — which is where a future rule keyed on\n // `major` would read it.\n const o = /^o(\\d+)(?:[-.]|$)/.exec(id);\n // The o-series never had a minor: `o3-mini` is a size, not a point release.\n if (o?.[1]) return { kind: \"o\", major: Number(o[1]), minor: 0 };\n return null;\n}\n",
|
|
15
|
-
"/**\n * Where a vendor lives, and who we are to it — resolved once, for every kind of\n * call.\n *\n * WHY THIS IS ITS OWN MODULE. The Responses path and the images path differ only\n * in the last segment of the URL. Everything before it — which host, whether the\n * configured endpoint already carried `/openai`, whether the api-version is\n * dated and therefore routes to the older path, whether to send `authorization:\n * Bearer` or `api-key`, whether an Entra token has to be minted again because\n * the last one expired mid-conversation — is identical, and every line of it was\n * worked out by measuring a real resource rather than reading documentation (the\n * transcripts are on `azureBase` below).\n *\n * That is exactly the kind of knowledge that must not be copied. A second copy\n * in an image provider would be correct on the day it was written and would\n * drift on the first fix that only one of them got, and the symptom of the drift\n * is a 404 on every request for whichever apps configured the provider the\n * documented way — which is the bug `azureBase` exists because of.\n *\n * So a provider resolves a `ProviderTarget` and appends its own path. Nothing\n * here knows about Responses, files or images.\n */\n\nexport type ProviderConfig = {\n apiKey?: string;\n baseURL?: string;\n timeoutMs?: number;\n /**\n * The longest a streamed answer may go without sending anything (an event or\n * a keepalive) once its response has started. Every chunk resets it. When it\n * runs out the attempt is aborted with a retryable `ProviderTimeoutError`:\n * before the first content event it is asked again like any other dropped\n * stream, after it the call ends with an error. Default\n * `DEFAULT_STREAM_IDLE_TIMEOUT_MS` (120 s); `0` turns it off.\n */\n streamIdleTimeoutMs?: number;\n /**\n * The longest one attempt's stream may run, from its response headers to its\n * last event, however steadily it keeps sending (#1169). No chunk resets it.\n * When it runs out the attempt is aborted with a retryable `provider_error`.\n * Default `DEFAULT_STREAM_MAX_DURATION_MS` (300 s); `0` turns it off.\n */\n streamMaxDurationMs?: number;\n /**\n * The most argument text one tool call may stream without finishing (#1169),\n * in characters. Past it the attempt is aborted with a retryable\n * `provider_error`, as a runaway generation. Default `0`, off: how large a\n * legitimate call gets depends entirely on the app's tools.\n */\n maxToolArgumentChars?: number;\n maxRetries?: number;\n headers?: Record<string, string>;\n};\n\nexport type AzureConfig = ProviderConfig & {\n /**\n * The resource host, with or without a trailing `/openai`. Both spellings\n * work — `https://<resource>.cognitiveservices.azure.com` and\n * `https://<resource>.openai.azure.com` — and neither is rewritten, because\n * only one of them exists for a resource that was not created as\n * kind=OpenAI. See `azureBase` for what is done to it.\n */\n endpoint?: string;\n /**\n * Just the resource name, when there is no endpoint to hand. `<name>` is\n * expanded to `https://<name>.cognitiveservices.azure.com/openai`.\n */\n resourceName?: string;\n apiVersion?: string;\n /**\n * The deployment to call, when it is not named after the model. Azure lets\n * whoever ran the template call it anything, and plenty of them are called\n * `prod` — this is the override the class comment promises.\n */\n deployment?: string;\n /**\n * For Entra ID instead of a key. A function, not a token, because these\n * expire mid-conversation.\n */\n getToken?: () => Promise<string>;\n};\n\n/**\n * A resolved vendor, ready for a path to be appended.\n *\n * `base` and `query` are separate because Azure's api-version is a query\n * parameter and a caller appending `/images/generations` must not have to know\n * that it goes *before* the `?`. Every URL is `${base}${path}${query}`.\n */\nexport type ProviderTarget = {\n /** e.g. `https://api.openai.com/v1`, or `https://<host>/openai/v1`. */\n base: string;\n /** e.g. `` or `?api-version=preview`. Already encoded. */\n query: string;\n /** Called per request. See the Azure branch for why that is not an accident. */\n headers: () => Promise<Record<string, string>>;\n timeoutMs: number;\n /** See `ProviderConfig.streamIdleTimeoutMs`. `0` is off. */\n streamIdleTimeoutMs: number;\n /** See `ProviderConfig.streamMaxDurationMs`. `0` is off. */\n streamMaxDurationMs: number;\n /** See `ProviderConfig.maxToolArgumentChars`. `0` is off. */\n maxToolArgumentChars: number;\n maxRetries: number;\n};\n\n/** Long enough for a reasoning model to think before it says anything, short\n * enough that a hung connection is not mistaken for a slow one. For a streamed\n * call it only covers getting a response; the stream that follows is bounded\n * by `streamIdleTimeoutMs` instead. For a one-shot call it is the whole deadline — which is why the\n * images path sets its own, and why `retryTimeouts` exists. */\nexport const DEFAULT_TIMEOUT_MS = 120_000;\nexport const DEFAULT_MAX_RETRIES = 2;\n\n/**\n * How long a streamed answer may stay silent once it has started (#1167).\n *\n * `timeoutMs` stops at the response headers, and a Responses stream sends its\n * headers (and `response.created`) within a second or so, so before this\n * nothing bounded a stream that went quiet: a stalled step waited for the\n * run's `maxRunDurationMs`. Seen on an Azure deployment: completed steps took\n * 1–12 s with the first event after 1–5 s, and the one that stalled sent\n * nothing more for ten minutes.\n *\n * WHY NOT SHORTER. The cost of the two mistakes is not symmetric. Too long, and\n * a rare stall takes two minutes to notice instead of one. Too short, and a\n * reasoning model at a high effort, which can think for a long while between\n * two events, is cut off mid-thought on every hard request, retried (and billed)\n * up to `maxRetries` times, and fails anyway. So the default matches the\n * header timeout, which already had to be long enough for a model to think\n * before saying anything. An app on low effort can set it lower.\n */\nexport const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 120_000;\n\n/**\n * How long one attempt's stream may run in all, however steadily it sends\n * (#1169).\n *\n * `streamIdleTimeoutMs` cannot see a stream that keeps trickling: seen on an\n * Azure deployment, one function call whose argument deltas kept coming for\n * 500 s (1,228 deltas against 20–60 normally), each one resetting the idle\n * clock, until the run's `maxRunDurationMs` ended the whole run. Completed\n * calls of the same agent took 4 s at p50 and 43 s at most.\n *\n * WHY 300 S. The same asymmetry as the idle limit, sharper. A limit that cuts a\n * legitimate call does not just cost a retry: the retry is the same long call\n * and is cut again, so a request that used to work now always fails. Five\n * minutes leaves room for a reasoning model at a high effort that thinks for\n * minutes before writing, and for a long answer or a large tool call (about\n * 15–30k output tokens at common streaming rates). And it is half the default\n * `maxRunDurationMs` (ten minutes), so a run that hits a runaway early still\n * has the time to ask again and finish. An app whose calls are short (a low\n * reasoning effort, small tools) can set it much lower.\n */\nexport const DEFAULT_STREAM_MAX_DURATION_MS = 300_000;\n\nexport function env(name: string): string | undefined {\n return typeof process === \"undefined\" ? undefined : process.env?.[name];\n}\n\n/**\n * `preview` selects Azure's `/openai/v1` surface, which is the OpenAI-shaped\n * one — same request body, same SSE frames, same `model` field naming the\n * deployment — and it is the only surface the Responses API has that gemi's\n * request builder can talk to unchanged. It takes no dated version: sending\n * `api-version=2025-04-01-preview` to `/openai/v1/responses` answers\n * `400 {\"code\":\"BadRequest\",\"message\":\"API version not supported\"}`.\n *\n * A dated version is still honoured, and routes to the older\n * `/openai/responses` path instead — see `azurePath`. So an app that pinned\n * one keeps working, which is the promise the old comment here made and could\n * not keep once the paths diverged.\n */\nexport const AZURE_API_VERSION = \"preview\";\n\n/**\n * Where an Azure call goes, worked out live rather than from docs.\n *\n * THE PROBLEM THIS SOLVES. `AZURE_OPENAI_ENDPOINT` is conventionally written\n * with `/openai` already on the end, and the old code appended `/openai` again\n * and then a deployment path, producing\n * `…/openai/openai/deployments/<dep>/responses` — a 404 on every request, for\n * every app that configured the provider the documented way. Two separate\n * mistakes were stacked there, and only measuring told them apart.\n *\n * WHAT WAS MEASURED, against a real resource, POSTing a Responses body:\n *\n * 404 {endpoint}/openai/deployments/gpt-5.4/responses?api-version=2025-04-01-preview\n * 404 {host}/openai/deployments/gpt-5.4/responses?api-version=2025-04-01-preview\n * 404 {host}/openai/deployments/gpt-5.4/responses?api-version=preview\n * 400 {host}/openai/v1/responses?api-version=2025-04-01-preview (\"API version not supported\")\n * 200 {host}/openai/v1/responses?api-version=preview\n * 200 {host}/openai/v1/responses (no api-version at all)\n * 200 {host}/openai/responses?api-version=2025-04-01-preview\n *\n * for {host} in BOTH `https://<resource>.cognitiveservices.azure.com` and\n * `https://<resource>.openai.azure.com` — both spellings answered identically,\n * so the host was never the variable. The deployment-in-the-URL path is the\n * Chat Completions shape and the Responses API does not serve it at all; the\n * deployment goes in the body's `model`, which is what `buildResponsesRequest`\n * already puts there.\n *\n * `/openai/v1/files?api-version=preview` and\n * `/openai/files?api-version=2025-04-01-preview` were both checked too (200,\n * empty list), so uploads follow the same fork.\n *\n * And so do images, measured the same way against a `gpt-image-2` deployment:\n *\n * 200 {host}/openai/v1/images/generations?api-version=preview\n * 200 {host}/openai/v1/images/edits?api-version=preview\n *\n * which is the whole reason this function is shared rather than reimplemented.\n */\nexport function azureBase(raw: string): string {\n const trimmed = raw.trim().replace(/\\/+$/, \"\");\n if (!trimmed) return \"\";\n // A configured endpoint may or may not already carry `/openai`, and may even\n // carry `/openai/v1` if someone copied a full URL. Normalize down to the\n // resource base and put exactly one `/openai` back, rather than appending\n // blind — appending blind is the bug.\n const base = trimmed.replace(/\\/openai(?:\\/v1)?$/i, \"\");\n return `${base}/openai`;\n}\n\n/** Dated versions belong to the older path; `preview` (and anything that is not\n * a date) belongs to `/v1`. Both were verified above. */\nexport function azurePath(apiVersion: string): string {\n return /^\\d{4}-\\d{2}-\\d{2}/.test(apiVersion) ? \"\" : \"/v1\";\n}\n\n/** Overrides for a call whose deadline is not a streaming handshake's. */\nexport type TargetDefaults = { timeoutMs?: number };\n\nexport function openAITarget(\n config: ProviderConfig,\n defaults: TargetDefaults = {},\n): ProviderTarget {\n const base = (config.baseURL ?? env(\"OPENAI_BASE_URL\") ?? \"https://api.openai.com/v1\").replace(\n /\\/+$/,\n \"\",\n );\n\n return {\n base,\n query: \"\",\n headers: async () => {\n const apiKey = config.apiKey ?? env(\"OPENAI_API_KEY\");\n return {\n ...(apiKey ? { authorization: `Bearer ${apiKey}` } : {}),\n ...config.headers,\n };\n },\n timeoutMs: config.timeoutMs ?? defaults.timeoutMs ?? DEFAULT_TIMEOUT_MS,\n streamIdleTimeoutMs: config.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS,\n streamMaxDurationMs: config.streamMaxDurationMs ?? DEFAULT_STREAM_MAX_DURATION_MS,\n maxToolArgumentChars: config.maxToolArgumentChars ?? 0,\n maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES,\n };\n}\n\n/**\n * The resource base, `<host>/openai`, from whichever of the three ways it was\n * configured. A bare resource name expands to the `cognitiveservices` host\n * rather than the `openai.azure.com` one: both answer for a resource created\n * as kind=OpenAI, only `cognitiveservices` answers for an AI Foundry or\n * multi-service resource, so it is the spelling that is right more often. An\n * app on the other one sets `endpoint` and nothing rewrites it.\n */\nexport function azureResourceBase(config: AzureConfig): string {\n const configured = config.baseURL ?? config.endpoint ?? env(\"AZURE_OPENAI_ENDPOINT\");\n if (configured) return azureBase(configured);\n const resource =\n config.resourceName ?? env(\"AZURE_OPENAI_RESOURCE_NAME\") ?? env(\"AZURE_RESOURCE_NAME\");\n return resource ? azureBase(`https://${resource.trim()}.cognitiveservices.azure.com`) : \"\";\n}\n\nexport function azureTarget(config: AzureConfig, defaults: TargetDefaults = {}): ProviderTarget {\n const apiVersion = config.apiVersion ?? env(\"AZURE_OPENAI_API_VERSION\") ?? AZURE_API_VERSION;\n\n return {\n base: `${azureResourceBase(config)}${azurePath(apiVersion)}`,\n query: `?api-version=${encodeURIComponent(apiVersion)}`,\n headers: async () => {\n // Called per request, not per provider: an Entra token minted when the\n // app booted is expired by the time a long conversation reaches step\n // nine, and that failure looks like a random 401 in the middle of a\n // working feature.\n if (config.getToken) {\n return { authorization: `Bearer ${await config.getToken()}`, ...config.headers };\n }\n const apiKey = config.apiKey ?? env(\"AZURE_OPENAI_API_KEY\");\n return { ...(apiKey ? { \"api-key\": apiKey } : {}), ...config.headers };\n },\n timeoutMs: config.timeoutMs ?? defaults.timeoutMs ?? DEFAULT_TIMEOUT_MS,\n streamIdleTimeoutMs: config.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS,\n streamMaxDurationMs: config.streamMaxDurationMs ?? DEFAULT_STREAM_MAX_DURATION_MS,\n maxToolArgumentChars: config.maxToolArgumentChars ?? 0,\n maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES,\n };\n}\n\n/**\n * The Messages API version sent as `anthropic-version`. `2026-10-21` is the\n * version the current SDKs send: on it `temperature`, `top_p` and `top_k` are a\n * 400 on every model, which is why `buildMessagesRequest` never sends them.\n */\nexport const ANTHROPIC_VERSION = \"2026-10-21\";\n\n/**\n * Anthropic's API, `https://api.anthropic.com` unless `baseURL` (or\n * `ANTHROPIC_BASE_URL`) names a gateway in front of it. The base is the host,\n * as the SDKs take it; a trailing `/v1` is accepted too and not doubled.\n *\n * Authenticates with `x-api-key` (`apiKey`, else `ANTHROPIC_API_KEY`), or\n * with `ANTHROPIC_AUTH_TOKEN` as a bearer when there is no key (the SDKs'\n * order), read per request like the others.\n */\nexport function anthropicTarget(config: ProviderConfig, defaults: TargetDefaults = {}): ProviderTarget {\n const host = config.baseURL ?? env(\"ANTHROPIC_BASE_URL\") ?? \"https://api.anthropic.com\";\n return messagesTarget(host, config, defaults, async () => {\n const apiKey = config.apiKey ?? env(\"ANTHROPIC_API_KEY\");\n if (apiKey) return { \"x-api-key\": apiKey };\n const token = env(\"ANTHROPIC_AUTH_TOKEN\");\n return token ? { authorization: `Bearer ${token}` } : {};\n });\n}\n\n/** `AzureAnthropicProvider`'s config: the Azure OpenAI fields that apply. */\nexport type FoundryConfig = ProviderConfig & {\n /**\n * The resource's Anthropic base, `https://<resource>.services.ai.azure.com/anthropic`\n * (the deployment's Target URI without `/v1/messages`). `baseURL` works too.\n */\n endpoint?: string;\n /** Just the resource name; expanded to the base above. */\n resourceName?: string;\n /** The deployment to call, when it is not named after the model. */\n deployment?: string;\n /** For Entra ID instead of a key, called per request (tokens expire). */\n getToken?: () => Promise<string>;\n};\n\n/**\n * Claude on Azure AI Foundry: the same Messages API under the resource's\n * `/anthropic` path. The settings and their environment variables are the\n * ones Anthropic's Foundry SDK clients read: `endpoint`/`baseURL` or\n * `ANTHROPIC_FOUNDRY_BASE_URL`, else `resourceName` or\n * `ANTHROPIC_FOUNDRY_RESOURCE`; the key in `api-key` (`apiKey`, else\n * `ANTHROPIC_FOUNDRY_API_KEY`), or an Entra token from `getToken` as a bearer\n * (scope `https://ai.azure.com/.default`).\n */\nexport function foundryTarget(config: FoundryConfig, defaults: TargetDefaults = {}): ProviderTarget {\n const resource = config.resourceName ?? env(\"ANTHROPIC_FOUNDRY_RESOURCE\");\n const host =\n config.baseURL ??\n config.endpoint ??\n env(\"ANTHROPIC_FOUNDRY_BASE_URL\") ??\n (resource ? `https://${resource.trim()}.services.ai.azure.com/anthropic` : \"\");\n // Without one, every request would go to a relative `/v1/messages` and fail\n // as a network error that names nothing.\n if (!host.trim()) {\n throw new Error(\n \"AzureAnthropicProvider has no Foundry endpoint. Set `endpoint` (the deployment's Target URI without `/v1/messages`, e.g. `https://<resource>.services.ai.azure.com/anthropic`) or `resourceName`, or the ANTHROPIC_FOUNDRY_BASE_URL or ANTHROPIC_FOUNDRY_RESOURCE environment variable.\",\n );\n }\n return messagesTarget(host, config, defaults, async () => {\n if (config.getToken) return { authorization: `Bearer ${await config.getToken()}` };\n const apiKey = config.apiKey ?? env(\"ANTHROPIC_FOUNDRY_API_KEY\");\n return apiKey ? { \"api-key\": apiKey } : {};\n });\n}\n\n/** What Anthropic and Foundry share: `/v1` under the host, and the version. */\nfunction messagesTarget(\n host: string,\n config: ProviderConfig,\n defaults: TargetDefaults,\n auth: () => Promise<Record<string, string>>,\n): ProviderTarget {\n const base = host.trim().replace(/\\/+$/, \"\").replace(/\\/v1$/, \"\");\n return {\n base: `${base}/v1`,\n query: \"\",\n headers: async () => ({\n ...(await auth()),\n \"anthropic-version\": ANTHROPIC_VERSION,\n ...config.headers,\n }),\n timeoutMs: config.timeoutMs ?? defaults.timeoutMs ?? DEFAULT_TIMEOUT_MS,\n streamIdleTimeoutMs: config.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS,\n streamMaxDurationMs: config.streamMaxDurationMs ?? DEFAULT_STREAM_MAX_DURATION_MS,\n maxToolArgumentChars: config.maxToolArgumentChars ?? 0,\n maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES,\n };\n}\n\n/**\n * Azure's realtime surface, which is the GA `/openai/v1` one regardless of the\n * configured api-version.\n *\n * WHY NOT `azureTarget`. A dated api-version routes `azureTarget` to the older\n * `/openai/...` path (see `azurePath`), and that path has no `realtime/calls`:\n * the WebRTC \"unified interface\", the client secrets and the call's sideband\n * socket are documented on `/openai/v1/realtime/...` only, and the documented\n * URLs carry no `api-version` at all. An app that pinned a dated version for\n * its Responses calls must not lose voice for it, so this target ignores the\n * version and keeps everything else — the resource base and, above all, the\n * per-request credential — from the one place that resolves them.\n *\n * NOT YET MEASURED against a real Azure realtime deployment (there was none to\n * measure when this was written). The shape follows Azure's GA realtime\n * documentation; when a deployment exists, the transcripts belong here as they\n * do on `azureBase`.\n */\nexport function azureRealtimeTarget(\n config: AzureConfig,\n defaults: TargetDefaults = {},\n): ProviderTarget {\n const target = azureTarget(config, defaults);\n return { ...target, base: `${azureResourceBase(config)}/v1`, query: \"\" };\n}\n",
|
|
16
|
-
"import type { ReasoningEffort } from \"./Agent\";\nimport {\n responsesEndpoint,\n streamResponses,\n uploadFile,\n type ResponsesEndpoint,\n} from \"./providers/call\";\nimport {\n buildMessagesRequest,\n recoverableRequestError,\n THINKING_BINDING_BETA,\n withoutThinkingBlocks,\n type MessagesRequest,\n} from \"./providers/anthropicRequest\";\nimport { parseMessagesStream } from \"./providers/anthropicStream\";\nimport {\n capabilitiesForClaude,\n capabilitiesForModel,\n supportsForcedToolChoice,\n} from \"./providers/capabilities\";\nimport {\n anthropicTarget,\n azureRealtimeTarget,\n foundryTarget,\n type FoundryConfig,\n azureTarget,\n openAITarget,\n type AzureConfig,\n type ProviderConfig,\n type ProviderTarget,\n} from \"./providers/endpoints\";\nimport { normalizeProviderError } from \"./providers/errors\";\nimport { sentFiles } from \"./providers/fileRejection\";\nimport { RealtimeClient, DEFAULT_REALTIME_TIMEOUT_MS } from \"./providers/realtime\";\nimport { isContentEvent } from \"./runtime\";\nimport { buildResponsesRequest } from \"./providers/request\";\nimport type { JSONSchema } from \"./Schema\";\nimport type { AgentError, AgentMessage, FinishReason, Usage } from \"./types\";\n\n/**\n * A provider makes one model call. It does not run the tool loop.\n *\n * The split matters: approvals, `maxSteps`, deferred tools, skill loading and\n * persistence are all provider-independent, and putting them in the provider\n * would mean writing them again for the second provider. So the provider's\n * whole job is to translate gemi's messages into a request, and the response\n * stream back into `ProviderEvent`s. Everything above that lives in `Agent`.\n *\n * v1 targets OpenAI's Responses API — native reasoning items and strict\n * structured output without reassembling them by hand. The interface is kept\n * free of anything Responses-specific so a Chat Completions provider (for older\n * Azure deployments and OpenAI-compatible gateways) can be added later without\n * touching Agent, Controller or the client.\n */\n\n/** What a provider will actually honour, so `Agent` can drop the rest rather\n * than have a request rejected at runtime. */\nexport type ProviderCapabilities = {\n reasoning: boolean;\n structuredOutput: boolean;\n fileInput: boolean;\n parallelToolCalls: boolean;\n /**\n * Tool search, and with it deferred loading. Only recent models have it, so a\n * provider that answers `false` is sent every schema inline and the agent\n * runs identically — deferral is a token optimization, and an optimization\n * that changed behaviour when unavailable would not be one.\n */\n toolSearch: boolean;\n};\n\n/** A tool as the model is shown it: schema only, no implementation. */\nexport type ProviderToolSpec = {\n name: string;\n description: string;\n parameters: JSONSchema;\n strict: boolean;\n /** `defer_loading`: send the name and description, withhold the schema until\n * the model searches for it. Ignored when `capabilities.toolSearch` is\n * false. */\n deferred?: boolean;\n};\n\n/** Tools grouped for search. Flattened back to a list by a provider without\n * tool search, since the grouping exists to be searched. */\nexport type ProviderToolNamespace = {\n name: string;\n description: string;\n tools: ProviderToolSpec[];\n};\n\n/** See `ProviderStreamParams.toolChoice`. */\nexport type ProviderToolChoice = \"auto\" | \"required\" | \"none\" | { name: string };\n\nexport interface ProviderStreamParams {\n messages: AgentMessage[];\n systemPrompt?: string;\n tools?: (ProviderToolSpec | ProviderToolNamespace)[];\n /**\n * Whether the model must call a tool on this call (#1010): `\"auto\"` (it\n * chooses, the provider's default), `\"required\"` (some tool), `\"none\"` (no\n * tool, though `tools` is still sent so the prompt prefix stays the same),\n * or `{ name }` (that tool). Unset: the provider's default. Set by\n * `PrepareStepResult.toolChoice`.\n */\n toolChoice?: ProviderToolChoice;\n /**\n * Sent as `prompt_cache_key` (#1223): requests with the same key and prefix\n * share a prompt cache. Set by `Agent` from `promptCacheKey`.\n */\n promptCacheKey?: string;\n /** Set when the agent declares an `output` schema; the provider turns it into\n * whatever its own strict-JSON parameter is. `strict` comes from the schema —\n * false when it contains an `s.json()` node, which strict mode cannot\n * express — and is required rather than defaulted so that a new caller has to\n * answer it instead of inheriting a 400. */\n output?: { name: string; schema: JSONSchema; strict: boolean };\n /** Optional: silently dropped by a provider whose `capabilities.reasoning`\n * is false, since a model that cannot reason should not fail a request. */\n reasoning?: ReasoningEffort;\n temperature?: number;\n maxOutputTokens?: number;\n signal?: AbortSignal;\n}\n\n/**\n * The events of a single model call. Deliberately smaller than\n * `AgentStreamEvent`: no run, message, tool-result or approval events, because\n * a provider knows about none of those.\n */\nexport type ProviderEvent =\n | { type: \"text-delta\"; delta: string }\n /**\n * `providerMetadata` is what the provider needs to send the part back, kept\n * on `ReasoningPart.providerMetadata` (#477). Sent once, on the part's last\n * delta, which closes the part: the next reasoning delta starts a new one.\n */\n | {\n type: \"reasoning-delta\";\n delta: string;\n id?: string;\n providerMetadata?: Record<string, unknown>;\n }\n /** Arguments arrive as JSON fragments; the provider passes them through and\n * `Agent` assembles and validates against the tool's schema. */\n | {\n type: \"tool-call-delta\";\n toolCallId: string;\n name: string;\n argsDelta: string;\n namespace?: string;\n }\n /**\n * `name` IS FLAT AND STAYS FLAT. This was an open question and the API has\n * answered it: a call to a function that lives inside a namespace comes back\n * as `{name: \"getOrder\", namespace: \"crm\"}`, not as `\"crm.getOrder\"` —\n * recorded in `providers/__fixtures__/openai-tool-search.sse` and pinned by\n * a test that reads that file. So `name` is already the key `Agent`'s tool\n * registry is built on, which is what makes tool names having to be globally\n * unique within an agent (see `ToolNamespace`) the right rule rather than an\n * inconvenience.\n *\n * `namespace` is carried beside it, absent for a tool that was listed bare.\n * It is provenance, not identity: it says which group the model chose to\n * look in, which is worth recording next to the call and is worthless for\n * finding the tool. Folding it into `name` would make a name that is\n * sometimes qualified and sometimes not, and nothing could match on that.\n */\n | { type: \"tool-call\"; toolCallId: string; name: string; args: string; namespace?: string }\n /**\n * The provider is asking the model again, and the calls named here, which\n * only ever streamed `tool-call-delta` and never completed, are void (#1169).\n * A stream that broke (or was cut as a runaway) before anything but argument\n * deltas had been sent is retried like one that broke before its first\n * content event, and this is how the deltas already passed on are taken\n * back: `Agent` forgets the calls and tells the client to drop them, so the\n * retried answer does not sit beside a half-written call that will never\n * run. A provider that never retries after a delta need not send this.\n */\n | { type: \"tool-call-discard\"; toolCallIds: string[] }\n /**\n * The model went looking for a deferred tool and pulled its schema in. Worth\n * surfacing rather than swallowing: it is a step the user paid for, and the\n * pause before it is otherwise unexplained.\n *\n * TWO FIELDS, not one. `loaded` is the function names — `[\"listOrders\",\n * \"getOrder\"]` — and `namespaces` is the groups they came out of —\n * `[\"crm\"]`. Search results arrive as a tree of namespaces containing\n * functions, so a single flat list has to pick one level and throw the other\n * away, and both levels are worth saying: \"searched crm, loaded getOrder\"\n * reads better than either half, and the group is the thing the model\n * actually chose between.\n *\n * `namespaces` is required rather than optional because the parser always\n * knows the answer, and an optional field would let a future provider forget\n * to fill it in silently. Empty means the search returned bare functions.\n */\n /**\n * `arguments` is the query the model searched with, as the provider sent it\n * (`{paths: [\"crm\"]}` on the Responses API), when it said. Kept so the\n * search can be replayed on later requests (#776); see `ToolSearchRecord`.\n */\n | { type: \"tool-search\"; loaded: string[]; namespaces: string[]; arguments?: unknown }\n | { type: \"output-delta\"; delta: string }\n /**\n * `model` is the model the vendor says produced the response (`response.model`\n * on the Responses API), which is not always the one asked for: an Azure\n * deployment name answers with the model behind it, and an alias like\n * `gpt-5.4` with a dated snapshot. Absent when the vendor did not say — a\n * request that failed before any response, or a provider that does not know.\n * Optional so a custom provider need not fill it in (#741).\n */\n | { type: \"finish\"; reason: FinishReason; usage: Usage; model?: string }\n /**\n * `status` and `requestId` describe the HTTP response the error came from,\n * when there was one. They are for the server's record of the run\n * (`AgentRunResult.error`) and are never written to a client frame; leave\n * them out for an error that was not a response.\n */\n /**\n * The provider refused a stored file (`fileId` is the provider's id) and the\n * call was sent again with a note in the file's place, so the turn goes on.\n * `Agent` marks the stored `FilePart` `providerRejected`, which makes later\n * requests send the note instead of the id — otherwise the same refusal\n * costs a failed request on every turn of the thread (#684). `message` is\n * the provider's, for the log. A provider that never retries need not send\n * this; `Agent` treats its absence as nothing having been rejected.\n */\n | { type: \"file-rejected\"; fileId: string; message: string; status?: number; requestId?: string }\n /**\n * An attempt failed and the provider is about to ask again (#1192), sent\n * before the backoff wait, so it arrives while the call is still waiting\n * rather than after. Informational only: it is not content, it commits\n * nothing, and a consumer that ignores it loses nothing. See\n * `ProviderRetryInfo` for the fields. A provider that never retries need not\n * send it.\n */\n | ({ type: \"retry\" } & ProviderRetryInfo)\n | { type: \"error\"; error: AgentError; status?: number; requestId?: string };\n\n/**\n * One failed attempt of a provider call that is about to be asked again.\n *\n * - `attempt`: the attempt that failed, from 1. The next one is `attempt + 1`.\n * - `maxRetries`: the provider's `maxRetries`, so `attempt <= maxRetries`.\n * - `error`: the failure, normalized; `status` and `requestId` describe the\n * HTTP response it came from, when there was one.\n * - `phase`: `\"request\"` when no response arrived (or an error status did),\n * `\"stream\"` when the response started and its body broke before the first\n * content event.\n * - `timedOut`: the attempt was cut by `timeoutMs`, `streamIdleTimeoutMs` or\n * `streamMaxDurationMs`.\n * - `delayMs`: how long the provider waits before the next attempt.\n * - `elapsedMs`: since the call's first attempt started.\n */\nexport type ProviderRetryInfo = {\n attempt: number;\n maxRetries: number;\n error: AgentError;\n status?: number;\n requestId?: string;\n phase: \"request\" | \"stream\";\n timedOut: boolean;\n delayMs: number;\n elapsedMs: number;\n};\n\nexport type ProviderStream = AsyncIterable<ProviderEvent>;\n\n/**\n * Re-exported rather than declared here. What these configure is the *vendor*,\n * not the Responses API, and the images path resolves the same host, credential\n * and api-version from the same fields — see `providers/endpoints.ts` for why\n * that resolution lives in one place and what happens when it does not.\n */\nexport type { AzureConfig, FoundryConfig, ProviderConfig } from \"./providers/endpoints\";\n\nexport abstract class AgentProvider {\n abstract readonly model: string;\n abstract readonly capabilities: ProviderCapabilities;\n\n /** The model ids this provider knows about — for autocomplete only; any\n * string is still accepted, because a new model must not require a gemi\n * release to use. */\n static models(): readonly string[] {\n return [];\n }\n\n abstract stream(params: ProviderStreamParams): ProviderStream;\n\n /**\n * Uploads a file and returns the id a `FilePart` carries. Message history\n * therefore holds provider file ids, which is the trade for getting vision\n * and PDF input without gemi owning a storage story in v1.\n */\n abstract upload(file: File): Promise<string>;\n\n /**\n * Maps a provider's error body onto the normalized codes, so an app can\n * branch on `rate_limited` without knowing whose rate limit it was.\n *\n * Shared rather than abstract-in-practice: Azure answers the same error\n * envelope as OpenAI, and the one place it differs — the content filter's\n * code, buried in `innererror` — is handled by reading both.\n */\n normalizeError(error: unknown): AgentError {\n return normalizeProviderError(error);\n }\n}\n\n/**\n * Autocomplete, not a gate. Every id here was confirmed present in\n * `GET https://api.openai.com/v1/models`; any other string is still accepted,\n * because a model released next Tuesday must not need a gemi release to use —\n * see `capabilitiesForModel` for what an unrecognized id is assumed to do.\n *\n * Ordered newest first, and deliberately short. `/v1/models` answers with\n * ninety-odd chat ids once the dated snapshots and the `-codex`, `-pro`,\n * `-chat-latest`, `-search-api` and `-nano` variants are counted; a list that\n * tried to be complete would be stale within the month and would bury the\n * handful of names anyone actually types. Snapshot-pinned ids\n * (`gpt-5.4-2026-03-05`) are left out for the same reason and work identically.\n *\n * The Azure provider returns this same list, which is a small lie it has always\n * told: a resource serves the deployments someone created, not the catalogue.\n * `AzureConfig.deployment` is the escape hatch, and an unrecognized deployment\n * name lands on the same capable default as an unrecognized model.\n */\nconst OPENAI_MODELS = [\n \"gpt-5.5\",\n \"gpt-5.4\",\n \"gpt-5.4-mini\",\n \"gpt-5.4-nano\",\n \"gpt-5.2\",\n \"gpt-5.1\",\n \"gpt-5\",\n \"gpt-5-mini\",\n \"gpt-5-nano\",\n \"gpt-4.1\",\n \"gpt-4.1-mini\",\n \"gpt-4.1-nano\",\n \"gpt-4o\",\n \"gpt-4o-mini\",\n \"o4-mini\",\n \"o3\",\n \"o3-mini\",\n] as const;\n\nexport class OpenAIProvider extends AgentProvider {\n readonly model: string;\n readonly capabilities: ProviderCapabilities;\n protected readonly config: ProviderConfig;\n\n constructor(model: string, config: ProviderConfig = {}) {\n super();\n this.model = model;\n this.capabilities = capabilitiesForModel(model);\n this.config = config;\n }\n\n /** Config defaults come from gemi's config (`ai.openai`), so an app that has\n * set `OPENAI_API_KEY` writes only the model name. */\n static model(model: string, config?: ProviderConfig): OpenAIProvider {\n return new OpenAIProvider(model, config);\n }\n\n static models(): readonly string[] {\n return OPENAI_MODELS;\n }\n\n stream(params: ProviderStreamParams): ProviderStream {\n const body = buildResponsesRequest(params, {\n model: this.model,\n capabilities: this.capabilities,\n });\n return streamResponses(this.endpoint(), body, {\n signal: params.signal,\n // The request carries the schema whenever the agent declared one, so the\n // parser has to read the answer as one too — a model that ignored the\n // parameter answers 400, not prose.\n structuredOutput: Boolean(params.output),\n files: sentFiles(params.messages),\n });\n }\n\n upload(file: File): Promise<string> {\n return uploadFile(this.endpoint(), file);\n }\n\n protected endpoint(): ResponsesEndpoint {\n return responsesEndpoint(openAITarget(this.config));\n }\n\n /**\n * Realtime (voice) calls on this provider's account: `createCall`,\n * `clientSecret`, `sideband` and `hangup`. The provider's model is the call's\n * default model, so build it with a realtime one\n * (`OpenAIProvider.model(\"gpt-realtime-mini\").realtime`). See\n * `providers/realtime.ts`.\n *\n * @experimental Not yet verified against a live call.\n */\n get realtime(): RealtimeClient {\n return new RealtimeClient(\n openAITarget(this.config, { timeoutMs: DEFAULT_REALTIME_TIMEOUT_MS }),\n { model: this.model },\n );\n }\n}\n\n/**\n * The current Claude models, newest family first. Autocomplete, not a gate,\n * like `OPENAI_MODELS`: any id is accepted, and `capabilitiesForClaude` says\n * what an unknown one is assumed to do.\n */\nconst CLAUDE_MODELS = [\n \"claude-opus-5-5\",\n \"claude-sonnet-5-5\",\n \"claude-haiku-5-5\",\n \"claude-fable-5-2\",\n \"claude-fable-5-1\",\n \"claude-opus-5\",\n \"claude-sonnet-5\",\n \"claude-fable-5\",\n \"claude-opus-4-8\",\n \"claude-sonnet-4-6\",\n \"claude-haiku-4-5\",\n] as const;\n\n/**\n * Claude on Anthropic's Messages API (`POST /v1/messages`), with an API key.\n *\n * The same request path as the OpenAI providers below the request body:\n * `streamResponses` does the retries, the stream limits and the holding back\n * until the first content event, and `parseMessagesStream` reads the stream.\n * `baseURL` (or `ANTHROPIC_BASE_URL`) points it at a gateway; see\n * `anthropicTarget`. `AzureAnthropicProvider` is the Azure AI Foundry\n * variant; Bedrock and Vertex are not covered.\n */\nexport class AnthropicProvider extends AgentProvider {\n readonly model: string;\n readonly capabilities: ProviderCapabilities;\n protected readonly config: ProviderConfig;\n\n constructor(model: string, config: ProviderConfig = {}) {\n super();\n this.model = model;\n this.capabilities = capabilitiesForClaude(model);\n this.config = config;\n }\n\n /** `ANTHROPIC_API_KEY` from the environment unless `config.apiKey` is set. */\n static model(model: string, config?: ProviderConfig): AnthropicProvider {\n return new AnthropicProvider(model, config);\n }\n\n static models(): readonly string[] {\n return CLAUDE_MODELS;\n }\n\n stream(params: ProviderStreamParams): ProviderStream {\n return this.send(params);\n }\n\n /**\n * One call, asked again at most once per kind of 400 that a changed request\n * answers (`recoverableRequestError`): a thinking block bound to another\n * conversation, with the thinking blocks stripped, and a schema too complex\n * to compile, with the answer asked for in the prompt. Only before anything\n * was yielded, which a 400 always is.\n */\n private async *send(params: ProviderStreamParams): ProviderStream {\n let request = params;\n let stripThinking = false;\n const tried = new Set<string>();\n for (;;) {\n let body = this.request(request);\n if (stripThinking) body = withoutThinkingBlocks(body);\n let recover: \"thinking\" | \"schema\" | undefined;\n let yielded = false;\n for await (const event of streamResponses(this.endpointFor(body), body, {\n signal: params.signal,\n structuredOutput: Boolean(params.output),\n parse: parseMessagesStream,\n })) {\n if (recover) continue;\n if (!yielded && event.type === \"error\" && event.status === 400) {\n const kind = recoverableRequestError(event.error.message);\n if (kind && !tried.has(kind)) {\n tried.add(kind);\n recover = kind;\n continue;\n }\n }\n if (isContentEvent(event)) yielded = true;\n yield event;\n }\n if (!recover) return;\n if (recover === \"thinking\") stripThinking = true;\n else if (request.output) request = { ...request, output: { ...request.output, strict: false } };\n }\n }\n\n private request(params: ProviderStreamParams): MessagesRequest {\n return buildMessagesRequest(params, {\n model: this.deployment(),\n modelId: this.model,\n capabilities: this.capabilities,\n forcedToolChoice: supportsForcedToolChoice(this.model),\n blockBinding: this.bindsThinking(),\n });\n }\n\n /** The beta header goes with the body that needs it. */\n private endpointFor(body: MessagesRequest): ResponsesEndpoint {\n const endpoint = this.endpoint();\n const binding = body.thinking?.type === \"adaptive\" && body.thinking.block_binding;\n if (!binding) return endpoint;\n return {\n ...endpoint,\n headers: async () => {\n const headers = await endpoint.headers();\n const beta = headers[\"anthropic-beta\"];\n return { ...headers, \"anthropic-beta\": beta ? `${beta},${THINKING_BINDING_BETA}` : THINKING_BINDING_BETA };\n },\n };\n }\n\n /** Whether `thinking.block_binding` and its beta header can be sent. */\n protected bindsThinking(): boolean {\n return true;\n }\n\n /** The `model` the request names. */\n protected deployment(): string {\n return this.model;\n }\n\n /** Through the Files API (`POST /v1/files`), which takes no `purpose`. */\n upload(file: File): Promise<string> {\n return uploadFile(this.endpoint(), file, null);\n }\n\n protected endpoint(): ResponsesEndpoint {\n return messagesEndpoint(anthropicTarget(this.config));\n }\n}\n\nfunction messagesEndpoint(target: ProviderTarget): ResponsesEndpoint {\n return { ...responsesEndpoint(target), responsesUrl: `${target.base}/messages` };\n}\n\n/**\n * Claude on Azure AI Foundry, which serves the same Messages API under the\n * resource's `/anthropic` path, so this is `AnthropicProvider` with another\n * endpoint and auth (see `foundryTarget`) and, as with `AzureOpenAIProvider`,\n * a deployment name that can differ from the model id. Capabilities are read\n * off the model, as there.\n *\n * NO FILES. The Files API is a 400 on deployments hosted on Azure (the\n * default hosting) and a beta on the ones hosted on Anthropic, so\n * `fileInput` is false and `upload()` refuses: a file a user attaches is\n * stored by gemi and named to the model by its attachment id, for a tool to\n * read. Everything else the agent uses (streaming, tools, thinking, structured\n * output, prompt caching) is supported on both hostings. Thinking is not\n * bound (`bindsThinking`).\n */\nexport class AzureAnthropicProvider extends AnthropicProvider {\n declare readonly capabilities: ProviderCapabilities;\n protected declare readonly config: FoundryConfig;\n\n constructor(model: string, config: FoundryConfig = {}) {\n super(model, config);\n this.capabilities = { ...capabilitiesForClaude(model), fileInput: false };\n }\n\n /** `ANTHROPIC_FOUNDRY_*` from the environment for what `config` leaves out. */\n static override model(model: string, config?: FoundryConfig): AzureAnthropicProvider {\n return new AzureAnthropicProvider(model, config);\n }\n\n override upload(_file: File): Promise<string> {\n return Promise.reject(\n new Error(\n \"AzureAnthropicProvider does not upload files: the Files API is not available on Azure-hosted Foundry deployments. The file is still stored by gemi and named to the model by its attachment id.\",\n ),\n );\n }\n\n protected override deployment(): string {\n return this.config.deployment ?? this.model;\n }\n\n /**\n * Thinking block-binding controls are unconfirmed on Foundry, and sending\n * the field where the beta is not taken is a 400 on every request. Without\n * it, a thinking block invalidated by an edit to the history is handled by\n * stripping the blocks and asking once more (see `AnthropicProvider.send`).\n */\n protected override bindsThinking(): boolean {\n return false;\n }\n\n protected override endpoint(): ResponsesEndpoint {\n return messagesEndpoint(foundryTarget(this.config));\n }\n}\n\n/**\n * Its own class rather than a flag on `OpenAIProvider`: Azure names the\n * deployment rather than the model, pins an api-version, authenticates with an\n * `api-key` header or an Entra token, and puts the resource in the host. One\n * class carrying both shapes means every field is conditionally meaningful.\n *\n * (It used to put the deployment in the URL as well. It does not: the Responses\n * API serves no such path — see `azureBase` for the measurements.)\n *\n * The API stays symmetrical — `.model()`, not `.deployment()`. Apps name a\n * model; mapping that onto a deployment is this class's problem, and an app\n * that named its deployment differently overrides it in config.\n */\nexport class AzureOpenAIProvider extends AgentProvider {\n readonly model: string;\n readonly capabilities: ProviderCapabilities;\n protected readonly config: AzureConfig;\n\n constructor(model: string, config: AzureConfig = {}) {\n super();\n this.model = model;\n // Read off the model, not the deployment: a deployment called `prod` says\n // nothing, and an unrecognized name lands on the all-capabilities default\n // anyway. See `capabilitiesForModel`.\n this.capabilities = capabilitiesForModel(model);\n this.config = config;\n }\n\n /** Defaults from gemi's config (`ai.azure`). */\n static model(model: string, config?: AzureConfig): AzureOpenAIProvider {\n return new AzureOpenAIProvider(model, config);\n }\n\n static models(): readonly string[] {\n return OPENAI_MODELS;\n }\n\n stream(params: ProviderStreamParams): ProviderStream {\n const body = buildResponsesRequest(params, {\n model: this.deployment(),\n capabilities: this.capabilities,\n });\n return streamResponses(this.endpoint(), body, {\n signal: params.signal,\n // The request carries the schema whenever the agent declared one, so the\n // parser has to read the answer as one too — a model that ignored the\n // parameter answers 400, not prose.\n structuredOutput: Boolean(params.output),\n files: sentFiles(params.messages),\n });\n }\n\n /** `assistants`, not OpenAI's `user_data`: Azure's Responses API refuses a\n * `user_data` id outright (#682). See `UploadPurpose`. */\n upload(file: File): Promise<string> {\n return uploadFile(this.endpoint(), file, \"assistants\");\n }\n\n protected deployment(): string {\n return this.config.deployment ?? this.model;\n }\n\n protected endpoint(): ResponsesEndpoint {\n return responsesEndpoint(azureTarget(this.config));\n }\n\n /**\n * Realtime (voice) calls on this Azure resource, on its GA\n * `/openai/v1/realtime` surface whatever `apiVersion` says (see\n * `azureRealtimeTarget`). The deployment is the call's default model, as it\n * is a text call's.\n *\n * Calls use Azure's documented server-proxied flow by default: a client\n * secret minted with the resource's credential, then the raw SDP posted with\n * that secret (`callFlow: \"ephemeral\"`), all server-side. Pass\n * `createCall({ flow: \"unified\" })` to try the multipart shape instead.\n *\n * @experimental Not yet verified against a live Azure call.\n */\n get realtime(): RealtimeClient {\n return new RealtimeClient(\n azureRealtimeTarget(this.config, { timeoutMs: DEFAULT_REALTIME_TIMEOUT_MS }),\n { model: this.deployment(), callFlow: \"ephemeral\" },\n );\n }\n}\n"
|
|
15
|
+
"/**\n * Where a vendor lives, and who we are to it — resolved once, for every kind of\n * call.\n *\n * WHY THIS IS ITS OWN MODULE. The Responses path and the images path differ only\n * in the last segment of the URL. Everything before it — which host, whether the\n * configured endpoint already carried `/openai`, whether the api-version is\n * dated and therefore routes to the older path, whether to send `authorization:\n * Bearer` or `api-key`, whether an Entra token has to be minted again because\n * the last one expired mid-conversation — is identical, and every line of it was\n * worked out by measuring a real resource rather than reading documentation (the\n * transcripts are on `azureBase` below).\n *\n * That is exactly the kind of knowledge that must not be copied. A second copy\n * in an image provider would be correct on the day it was written and would\n * drift on the first fix that only one of them got, and the symptom of the drift\n * is a 404 on every request for whichever apps configured the provider the\n * documented way — which is the bug `azureBase` exists because of.\n *\n * So a provider resolves a `ProviderTarget` and appends its own path. Nothing\n * here knows about Responses, files or images.\n */\n\nexport type ProviderConfig = {\n apiKey?: string;\n baseURL?: string;\n timeoutMs?: number;\n /**\n * The longest a streamed answer may go without sending anything (an event or\n * a keepalive) once its response has started. Every chunk resets it. When it\n * runs out the attempt is aborted with a retryable `ProviderTimeoutError`:\n * before the first content event it is asked again like any other dropped\n * stream, after it the call ends with an error. Default\n * `DEFAULT_STREAM_IDLE_TIMEOUT_MS` (120 s); `0` turns it off.\n */\n streamIdleTimeoutMs?: number;\n /**\n * The longest one attempt's stream may run, from its response headers to its\n * last event, however steadily it keeps sending (#1169). No chunk resets it.\n * When it runs out the attempt is aborted with a retryable `provider_error`.\n * Default `DEFAULT_STREAM_MAX_DURATION_MS` (300 s); `0` turns it off.\n */\n streamMaxDurationMs?: number;\n /**\n * The most argument text one tool call may stream without finishing (#1169),\n * in characters. Past it the attempt is aborted with a retryable\n * `provider_error`, as a runaway generation. Default `0`, off: how large a\n * legitimate call gets depends entirely on the app's tools.\n */\n maxToolArgumentChars?: number;\n maxRetries?: number;\n headers?: Record<string, string>;\n};\n\nexport type AzureConfig = ProviderConfig & {\n /**\n * The resource host, with or without a trailing `/openai`. Both spellings\n * work — `https://<resource>.cognitiveservices.azure.com` and\n * `https://<resource>.openai.azure.com` — and neither is rewritten, because\n * only one of them exists for a resource that was not created as\n * kind=OpenAI. See `azureBase` for what is done to it.\n */\n endpoint?: string;\n /**\n * Just the resource name, when there is no endpoint to hand. `<name>` is\n * expanded to `https://<name>.cognitiveservices.azure.com/openai`.\n */\n resourceName?: string;\n apiVersion?: string;\n /**\n * The deployment to call, when it is not named after the model. Azure lets\n * whoever ran the template call it anything, and plenty of them are called\n * `prod` — this is the override the class comment promises.\n */\n deployment?: string;\n /**\n * For Entra ID instead of a key. A function, not a token, because these\n * expire mid-conversation.\n */\n getToken?: () => Promise<string>;\n};\n\n/**\n * A resolved vendor, ready for a path to be appended.\n *\n * `base` and `query` are separate because Azure's api-version is a query\n * parameter and a caller appending `/images/generations` must not have to know\n * that it goes *before* the `?`. Every URL is `${base}${path}${query}`.\n */\nexport type ProviderTarget = {\n /** e.g. `https://api.openai.com/v1`, or `https://<host>/openai/v1`. */\n base: string;\n /** e.g. `` or `?api-version=preview`. Already encoded. */\n query: string;\n /** Called per request. See the Azure branch for why that is not an accident. */\n headers: () => Promise<Record<string, string>>;\n timeoutMs: number;\n /** See `ProviderConfig.streamIdleTimeoutMs`. `0` is off. */\n streamIdleTimeoutMs: number;\n /** See `ProviderConfig.streamMaxDurationMs`. `0` is off. */\n streamMaxDurationMs: number;\n /** See `ProviderConfig.maxToolArgumentChars`. `0` is off. */\n maxToolArgumentChars: number;\n maxRetries: number;\n};\n\n/** Long enough for a reasoning model to think before it says anything, short\n * enough that a hung connection is not mistaken for a slow one. For a streamed\n * call it only covers getting a response; the stream that follows is bounded\n * by `streamIdleTimeoutMs` instead. For a one-shot call it is the whole deadline — which is why the\n * images path sets its own, and why `retryTimeouts` exists. */\nexport const DEFAULT_TIMEOUT_MS = 120_000;\nexport const DEFAULT_MAX_RETRIES = 2;\n\n/**\n * How long a streamed answer may stay silent once it has started (#1167).\n *\n * `timeoutMs` stops at the response headers, and a Responses stream sends its\n * headers (and `response.created`) within a second or so, so before this\n * nothing bounded a stream that went quiet: a stalled step waited for the\n * run's `maxRunDurationMs`. Seen on an Azure deployment: completed steps took\n * 1–12 s with the first event after 1–5 s, and the one that stalled sent\n * nothing more for ten minutes.\n *\n * WHY NOT SHORTER. The cost of the two mistakes is not symmetric. Too long, and\n * a rare stall takes two minutes to notice instead of one. Too short, and a\n * reasoning model at a high effort, which can think for a long while between\n * two events, is cut off mid-thought on every hard request, retried (and billed)\n * up to `maxRetries` times, and fails anyway. So the default matches the\n * header timeout, which already had to be long enough for a model to think\n * before saying anything. An app on low effort can set it lower.\n */\nexport const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 120_000;\n\n/**\n * How long one attempt's stream may run in all, however steadily it sends\n * (#1169).\n *\n * `streamIdleTimeoutMs` cannot see a stream that keeps trickling: seen on an\n * Azure deployment, one function call whose argument deltas kept coming for\n * 500 s (1,228 deltas against 20–60 normally), each one resetting the idle\n * clock, until the run's `maxRunDurationMs` ended the whole run. Completed\n * calls of the same agent took 4 s at p50 and 43 s at most.\n *\n * WHY 300 S. The same asymmetry as the idle limit, sharper. A limit that cuts a\n * legitimate call does not just cost a retry: the retry is the same long call\n * and is cut again, so a request that used to work now always fails. Five\n * minutes leaves room for a reasoning model at a high effort that thinks for\n * minutes before writing, and for a long answer or a large tool call (about\n * 15–30k output tokens at common streaming rates). And it is half the default\n * `maxRunDurationMs` (ten minutes), so a run that hits a runaway early still\n * has the time to ask again and finish. An app whose calls are short (a low\n * reasoning effort, small tools) can set it much lower.\n */\nexport const DEFAULT_STREAM_MAX_DURATION_MS = 300_000;\n\nexport function env(name: string): string | undefined {\n return typeof process === \"undefined\" ? undefined : process.env?.[name];\n}\n\n/**\n * `preview` selects Azure's `/openai/v1` surface, which is the OpenAI-shaped\n * one — same request body, same SSE frames, same `model` field naming the\n * deployment — and it is the only surface the Responses API has that gemi's\n * request builder can talk to unchanged. It takes no dated version: sending\n * `api-version=2025-04-01-preview` to `/openai/v1/responses` answers\n * `400 {\"code\":\"BadRequest\",\"message\":\"API version not supported\"}`.\n *\n * A dated version is still honoured, and routes to the older\n * `/openai/responses` path instead — see `azurePath`. So an app that pinned\n * one keeps working, which is the promise the old comment here made and could\n * not keep once the paths diverged.\n */\nexport const AZURE_API_VERSION = \"preview\";\n\n/**\n * Where an Azure call goes, worked out live rather than from docs.\n *\n * THE PROBLEM THIS SOLVES. `AZURE_OPENAI_ENDPOINT` is conventionally written\n * with `/openai` already on the end, and the old code appended `/openai` again\n * and then a deployment path, producing\n * `…/openai/openai/deployments/<dep>/responses` — a 404 on every request, for\n * every app that configured the provider the documented way. Two separate\n * mistakes were stacked there, and only measuring told them apart.\n *\n * WHAT WAS MEASURED, against a real resource, POSTing a Responses body:\n *\n * 404 {endpoint}/openai/deployments/gpt-5.4/responses?api-version=2025-04-01-preview\n * 404 {host}/openai/deployments/gpt-5.4/responses?api-version=2025-04-01-preview\n * 404 {host}/openai/deployments/gpt-5.4/responses?api-version=preview\n * 400 {host}/openai/v1/responses?api-version=2025-04-01-preview (\"API version not supported\")\n * 200 {host}/openai/v1/responses?api-version=preview\n * 200 {host}/openai/v1/responses (no api-version at all)\n * 200 {host}/openai/responses?api-version=2025-04-01-preview\n *\n * for {host} in BOTH `https://<resource>.cognitiveservices.azure.com` and\n * `https://<resource>.openai.azure.com` — both spellings answered identically,\n * so the host was never the variable. The deployment-in-the-URL path is the\n * Chat Completions shape and the Responses API does not serve it at all; the\n * deployment goes in the body's `model`, which is what `buildResponsesRequest`\n * already puts there.\n *\n * `/openai/v1/files?api-version=preview` and\n * `/openai/files?api-version=2025-04-01-preview` were both checked too (200,\n * empty list), so uploads follow the same fork.\n *\n * And so do images, measured the same way against a `gpt-image-2` deployment:\n *\n * 200 {host}/openai/v1/images/generations?api-version=preview\n * 200 {host}/openai/v1/images/edits?api-version=preview\n *\n * which is the whole reason this function is shared rather than reimplemented.\n */\nexport function azureBase(raw: string): string {\n const trimmed = raw.trim().replace(/\\/+$/, \"\");\n if (!trimmed) return \"\";\n // A configured endpoint may or may not already carry `/openai`, and may even\n // carry `/openai/v1` if someone copied a full URL. Normalize down to the\n // resource base and put exactly one `/openai` back, rather than appending\n // blind — appending blind is the bug.\n const base = trimmed.replace(/\\/openai(?:\\/v1)?$/i, \"\");\n return `${base}/openai`;\n}\n\n/** Dated versions belong to the older path; `preview` (and anything that is not\n * a date) belongs to `/v1`. Both were verified above. */\nexport function azurePath(apiVersion: string): string {\n return /^\\d{4}-\\d{2}-\\d{2}/.test(apiVersion) ? \"\" : \"/v1\";\n}\n\n/** Overrides for a call whose deadline is not a streaming handshake's. */\nexport type TargetDefaults = { timeoutMs?: number };\n\nexport function openAITarget(\n config: ProviderConfig,\n defaults: TargetDefaults = {},\n): ProviderTarget {\n const base = (config.baseURL ?? env(\"OPENAI_BASE_URL\") ?? \"https://api.openai.com/v1\").replace(\n /\\/+$/,\n \"\",\n );\n\n return {\n base,\n query: \"\",\n headers: async () => {\n const apiKey = config.apiKey ?? env(\"OPENAI_API_KEY\");\n return {\n ...(apiKey ? { authorization: `Bearer ${apiKey}` } : {}),\n ...config.headers,\n };\n },\n timeoutMs: config.timeoutMs ?? defaults.timeoutMs ?? DEFAULT_TIMEOUT_MS,\n streamIdleTimeoutMs: config.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS,\n streamMaxDurationMs: config.streamMaxDurationMs ?? DEFAULT_STREAM_MAX_DURATION_MS,\n maxToolArgumentChars: config.maxToolArgumentChars ?? 0,\n maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES,\n };\n}\n\n/**\n * The resource base, `<host>/openai`, from whichever of the three ways it was\n * configured. A bare resource name expands to the `cognitiveservices` host\n * rather than the `openai.azure.com` one: both answer for a resource created\n * as kind=OpenAI, only `cognitiveservices` answers for an AI Foundry or\n * multi-service resource, so it is the spelling that is right more often. An\n * app on the other one sets `endpoint` and nothing rewrites it.\n */\nexport function azureResourceBase(config: AzureConfig): string {\n const configured = config.baseURL ?? config.endpoint ?? env(\"AZURE_OPENAI_ENDPOINT\");\n if (configured) return azureBase(configured);\n const resource =\n config.resourceName ?? env(\"AZURE_OPENAI_RESOURCE_NAME\") ?? env(\"AZURE_RESOURCE_NAME\");\n return resource ? azureBase(`https://${resource.trim()}.cognitiveservices.azure.com`) : \"\";\n}\n\nexport function azureTarget(config: AzureConfig, defaults: TargetDefaults = {}): ProviderTarget {\n const apiVersion = config.apiVersion ?? env(\"AZURE_OPENAI_API_VERSION\") ?? AZURE_API_VERSION;\n\n return {\n base: `${azureResourceBase(config)}${azurePath(apiVersion)}`,\n query: `?api-version=${encodeURIComponent(apiVersion)}`,\n headers: async () => {\n // Called per request, not per provider: an Entra token minted when the\n // app booted is expired by the time a long conversation reaches step\n // nine, and that failure looks like a random 401 in the middle of a\n // working feature.\n if (config.getToken) {\n return { authorization: `Bearer ${await config.getToken()}`, ...config.headers };\n }\n const apiKey = config.apiKey ?? env(\"AZURE_OPENAI_API_KEY\");\n return { ...(apiKey ? { \"api-key\": apiKey } : {}), ...config.headers };\n },\n timeoutMs: config.timeoutMs ?? defaults.timeoutMs ?? DEFAULT_TIMEOUT_MS,\n streamIdleTimeoutMs: config.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS,\n streamMaxDurationMs: config.streamMaxDurationMs ?? DEFAULT_STREAM_MAX_DURATION_MS,\n maxToolArgumentChars: config.maxToolArgumentChars ?? 0,\n maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES,\n };\n}\n\n/**\n * The Messages API version sent as `anthropic-version`. `2026-10-21` is the\n * version the current SDKs send: on it `temperature`, `top_p` and `top_k` are a\n * 400 on every model, which is why `buildMessagesRequest` never sends them.\n */\nexport const ANTHROPIC_VERSION = \"2026-10-21\";\n\n/** `AnthropicProvider`'s config. */\nexport type AnthropicConfig = ProviderConfig & {\n /**\n * The workspace to bill and scope requests to, sent as\n * `anthropic-workspace-id` on every request (Messages and Files). Needed for\n * an API key that is not scoped to a workspace, which the API otherwise\n * answers with a 400. Else `ANTHROPIC_WORKSPACE_ID`; unset sends no header.\n */\n workspaceId?: string;\n};\n\n/**\n * Anthropic's API, `https://api.anthropic.com` unless `baseURL` (or\n * `ANTHROPIC_BASE_URL`) names a gateway in front of it. The base is the host,\n * as the SDKs take it; a trailing `/v1` is accepted too and not doubled.\n *\n * Authenticates with `x-api-key` (`apiKey`, else `ANTHROPIC_API_KEY`), or\n * with `ANTHROPIC_AUTH_TOKEN` as a bearer when there is no key (the SDKs'\n * order), read per request like the others. `workspaceId` (else\n * `ANTHROPIC_WORKSPACE_ID`) adds `anthropic-workspace-id`.\n */\nexport function anthropicTarget(config: AnthropicConfig, defaults: TargetDefaults = {}): ProviderTarget {\n const host = config.baseURL ?? env(\"ANTHROPIC_BASE_URL\") ?? \"https://api.anthropic.com\";\n return messagesTarget(host, config, defaults, async () => {\n const workspaceId = config.workspaceId ?? env(\"ANTHROPIC_WORKSPACE_ID\");\n const workspace = workspaceId ? { \"anthropic-workspace-id\": workspaceId } : {};\n const apiKey = config.apiKey ?? env(\"ANTHROPIC_API_KEY\");\n if (apiKey) return { \"x-api-key\": apiKey, ...workspace };\n const token = env(\"ANTHROPIC_AUTH_TOKEN\");\n return token ? { authorization: `Bearer ${token}`, ...workspace } : workspace;\n });\n}\n\n/** `AzureAnthropicProvider`'s config: the Azure OpenAI fields that apply. */\nexport type FoundryConfig = ProviderConfig & {\n /**\n * The resource's Anthropic base, `https://<resource>.services.ai.azure.com/anthropic`\n * (the deployment's Target URI without `/v1/messages`). `baseURL` works too.\n */\n endpoint?: string;\n /** Just the resource name; expanded to the base above. */\n resourceName?: string;\n /** The deployment to call, when it is not named after the model. */\n deployment?: string;\n /** For Entra ID instead of a key, called per request (tokens expire). */\n getToken?: () => Promise<string>;\n};\n\n/**\n * Claude on Azure AI Foundry: the same Messages API under the resource's\n * `/anthropic` path. The settings and their environment variables are the\n * ones Anthropic's Foundry SDK clients read: `endpoint`/`baseURL` or\n * `ANTHROPIC_FOUNDRY_BASE_URL`, else `resourceName` or\n * `ANTHROPIC_FOUNDRY_RESOURCE`; the key in `api-key` (`apiKey`, else\n * `ANTHROPIC_FOUNDRY_API_KEY`), or an Entra token from `getToken` as a bearer\n * (scope `https://ai.azure.com/.default`).\n */\nexport function foundryTarget(config: FoundryConfig, defaults: TargetDefaults = {}): ProviderTarget {\n const resource = config.resourceName ?? env(\"ANTHROPIC_FOUNDRY_RESOURCE\");\n const host =\n config.baseURL ??\n config.endpoint ??\n env(\"ANTHROPIC_FOUNDRY_BASE_URL\") ??\n (resource ? `https://${resource.trim()}.services.ai.azure.com/anthropic` : \"\");\n // Without one, every request would go to a relative `/v1/messages` and fail\n // as a network error that names nothing.\n if (!host.trim()) {\n throw new Error(\n \"AzureAnthropicProvider has no Foundry endpoint. Set `endpoint` (the deployment's Target URI without `/v1/messages`, e.g. `https://<resource>.services.ai.azure.com/anthropic`) or `resourceName`, or the ANTHROPIC_FOUNDRY_BASE_URL or ANTHROPIC_FOUNDRY_RESOURCE environment variable.\",\n );\n }\n return messagesTarget(host, config, defaults, async () => {\n if (config.getToken) return { authorization: `Bearer ${await config.getToken()}` };\n const apiKey = config.apiKey ?? env(\"ANTHROPIC_FOUNDRY_API_KEY\");\n return apiKey ? { \"api-key\": apiKey } : {};\n });\n}\n\n/** What Anthropic and Foundry share: `/v1` under the host, and the version. */\nfunction messagesTarget(\n host: string,\n config: ProviderConfig,\n defaults: TargetDefaults,\n auth: () => Promise<Record<string, string>>,\n): ProviderTarget {\n const base = host.trim().replace(/\\/+$/, \"\").replace(/\\/v1$/, \"\");\n return {\n base: `${base}/v1`,\n query: \"\",\n headers: async () => ({\n ...(await auth()),\n \"anthropic-version\": ANTHROPIC_VERSION,\n ...config.headers,\n }),\n timeoutMs: config.timeoutMs ?? defaults.timeoutMs ?? DEFAULT_TIMEOUT_MS,\n streamIdleTimeoutMs: config.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS,\n streamMaxDurationMs: config.streamMaxDurationMs ?? DEFAULT_STREAM_MAX_DURATION_MS,\n maxToolArgumentChars: config.maxToolArgumentChars ?? 0,\n maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES,\n };\n}\n\n/**\n * Azure's realtime surface, which is the GA `/openai/v1` one regardless of the\n * configured api-version.\n *\n * WHY NOT `azureTarget`. A dated api-version routes `azureTarget` to the older\n * `/openai/...` path (see `azurePath`), and that path has no `realtime/calls`:\n * the WebRTC \"unified interface\", the client secrets and the call's sideband\n * socket are documented on `/openai/v1/realtime/...` only, and the documented\n * URLs carry no `api-version` at all. An app that pinned a dated version for\n * its Responses calls must not lose voice for it, so this target ignores the\n * version and keeps everything else — the resource base and, above all, the\n * per-request credential — from the one place that resolves them.\n *\n * NOT YET MEASURED against a real Azure realtime deployment (there was none to\n * measure when this was written). The shape follows Azure's GA realtime\n * documentation; when a deployment exists, the transcripts belong here as they\n * do on `azureBase`.\n */\nexport function azureRealtimeTarget(\n config: AzureConfig,\n defaults: TargetDefaults = {},\n): ProviderTarget {\n const target = azureTarget(config, defaults);\n return { ...target, base: `${azureResourceBase(config)}/v1`, query: \"\" };\n}\n",
|
|
16
|
+
"import type { ReasoningEffort } from \"./Agent\";\nimport {\n responsesEndpoint,\n streamResponses,\n uploadFile,\n type ResponsesEndpoint,\n} from \"./providers/call\";\nimport {\n buildMessagesRequest,\n recoverableRequestError,\n THINKING_BINDING_BETA,\n withoutThinkingBlocks,\n type MessagesRequest,\n} from \"./providers/anthropicRequest\";\nimport { parseMessagesStream } from \"./providers/anthropicStream\";\nimport {\n capabilitiesForClaude,\n capabilitiesForModel,\n supportsForcedToolChoice,\n} from \"./providers/capabilities\";\nimport {\n anthropicTarget,\n azureRealtimeTarget,\n foundryTarget,\n type AnthropicConfig,\n type FoundryConfig,\n azureTarget,\n openAITarget,\n type AzureConfig,\n type ProviderConfig,\n type ProviderTarget,\n} from \"./providers/endpoints\";\nimport { normalizeProviderError } from \"./providers/errors\";\nimport { sentFiles } from \"./providers/fileRejection\";\nimport { RealtimeClient, DEFAULT_REALTIME_TIMEOUT_MS } from \"./providers/realtime\";\nimport { isContentEvent } from \"./runtime\";\nimport { buildResponsesRequest } from \"./providers/request\";\nimport type { JSONSchema } from \"./Schema\";\nimport type { AgentError, AgentMessage, FinishReason, Usage } from \"./types\";\n\n/**\n * A provider makes one model call. It does not run the tool loop.\n *\n * The split matters: approvals, `maxSteps`, deferred tools, skill loading and\n * persistence are all provider-independent, and putting them in the provider\n * would mean writing them again for the second provider. So the provider's\n * whole job is to translate gemi's messages into a request, and the response\n * stream back into `ProviderEvent`s. Everything above that lives in `Agent`.\n *\n * v1 targets OpenAI's Responses API — native reasoning items and strict\n * structured output without reassembling them by hand. The interface is kept\n * free of anything Responses-specific so a Chat Completions provider (for older\n * Azure deployments and OpenAI-compatible gateways) can be added later without\n * touching Agent, Controller or the client.\n */\n\n/** What a provider will actually honour, so `Agent` can drop the rest rather\n * than have a request rejected at runtime. */\nexport type ProviderCapabilities = {\n reasoning: boolean;\n structuredOutput: boolean;\n fileInput: boolean;\n parallelToolCalls: boolean;\n /**\n * Tool search, and with it deferred loading. Only recent models have it, so a\n * provider that answers `false` is sent every schema inline and the agent\n * runs identically — deferral is a token optimization, and an optimization\n * that changed behaviour when unavailable would not be one.\n */\n toolSearch: boolean;\n};\n\n/** A tool as the model is shown it: schema only, no implementation. */\nexport type ProviderToolSpec = {\n name: string;\n description: string;\n parameters: JSONSchema;\n strict: boolean;\n /** `defer_loading`: send the name and description, withhold the schema until\n * the model searches for it. Ignored when `capabilities.toolSearch` is\n * false. */\n deferred?: boolean;\n};\n\n/** Tools grouped for search. Flattened back to a list by a provider without\n * tool search, since the grouping exists to be searched. */\nexport type ProviderToolNamespace = {\n name: string;\n description: string;\n tools: ProviderToolSpec[];\n};\n\n/** See `ProviderStreamParams.toolChoice`. */\nexport type ProviderToolChoice = \"auto\" | \"required\" | \"none\" | { name: string };\n\nexport interface ProviderStreamParams {\n messages: AgentMessage[];\n systemPrompt?: string;\n tools?: (ProviderToolSpec | ProviderToolNamespace)[];\n /**\n * Whether the model must call a tool on this call (#1010): `\"auto\"` (it\n * chooses, the provider's default), `\"required\"` (some tool), `\"none\"` (no\n * tool, though `tools` is still sent so the prompt prefix stays the same),\n * or `{ name }` (that tool). Unset: the provider's default. Set by\n * `PrepareStepResult.toolChoice`.\n */\n toolChoice?: ProviderToolChoice;\n /**\n * Sent as `prompt_cache_key` (#1223): requests with the same key and prefix\n * share a prompt cache. Set by `Agent` from `promptCacheKey`.\n */\n promptCacheKey?: string;\n /** Set when the agent declares an `output` schema; the provider turns it into\n * whatever its own strict-JSON parameter is. `strict` comes from the schema —\n * false when it contains an `s.json()` node, which strict mode cannot\n * express — and is required rather than defaulted so that a new caller has to\n * answer it instead of inheriting a 400. */\n output?: { name: string; schema: JSONSchema; strict: boolean };\n /** Optional: silently dropped by a provider whose `capabilities.reasoning`\n * is false, since a model that cannot reason should not fail a request. */\n reasoning?: ReasoningEffort;\n temperature?: number;\n maxOutputTokens?: number;\n signal?: AbortSignal;\n}\n\n/**\n * The events of a single model call. Deliberately smaller than\n * `AgentStreamEvent`: no run, message, tool-result or approval events, because\n * a provider knows about none of those.\n */\nexport type ProviderEvent =\n | { type: \"text-delta\"; delta: string }\n /**\n * `providerMetadata` is what the provider needs to send the part back, kept\n * on `ReasoningPart.providerMetadata` (#477). Sent once, on the part's last\n * delta, which closes the part: the next reasoning delta starts a new one.\n */\n | {\n type: \"reasoning-delta\";\n delta: string;\n id?: string;\n providerMetadata?: Record<string, unknown>;\n }\n /** Arguments arrive as JSON fragments; the provider passes them through and\n * `Agent` assembles and validates against the tool's schema. */\n | {\n type: \"tool-call-delta\";\n toolCallId: string;\n name: string;\n argsDelta: string;\n namespace?: string;\n }\n /**\n * `name` IS FLAT AND STAYS FLAT. This was an open question and the API has\n * answered it: a call to a function that lives inside a namespace comes back\n * as `{name: \"getOrder\", namespace: \"crm\"}`, not as `\"crm.getOrder\"` —\n * recorded in `providers/__fixtures__/openai-tool-search.sse` and pinned by\n * a test that reads that file. So `name` is already the key `Agent`'s tool\n * registry is built on, which is what makes tool names having to be globally\n * unique within an agent (see `ToolNamespace`) the right rule rather than an\n * inconvenience.\n *\n * `namespace` is carried beside it, absent for a tool that was listed bare.\n * It is provenance, not identity: it says which group the model chose to\n * look in, which is worth recording next to the call and is worthless for\n * finding the tool. Folding it into `name` would make a name that is\n * sometimes qualified and sometimes not, and nothing could match on that.\n */\n | { type: \"tool-call\"; toolCallId: string; name: string; args: string; namespace?: string }\n /**\n * The provider is asking the model again, and the calls named here, which\n * only ever streamed `tool-call-delta` and never completed, are void (#1169).\n * A stream that broke (or was cut as a runaway) before anything but argument\n * deltas had been sent is retried like one that broke before its first\n * content event, and this is how the deltas already passed on are taken\n * back: `Agent` forgets the calls and tells the client to drop them, so the\n * retried answer does not sit beside a half-written call that will never\n * run. A provider that never retries after a delta need not send this.\n */\n | { type: \"tool-call-discard\"; toolCallIds: string[] }\n /**\n * The model went looking for a deferred tool and pulled its schema in. Worth\n * surfacing rather than swallowing: it is a step the user paid for, and the\n * pause before it is otherwise unexplained.\n *\n * TWO FIELDS, not one. `loaded` is the function names — `[\"listOrders\",\n * \"getOrder\"]` — and `namespaces` is the groups they came out of —\n * `[\"crm\"]`. Search results arrive as a tree of namespaces containing\n * functions, so a single flat list has to pick one level and throw the other\n * away, and both levels are worth saying: \"searched crm, loaded getOrder\"\n * reads better than either half, and the group is the thing the model\n * actually chose between.\n *\n * `namespaces` is required rather than optional because the parser always\n * knows the answer, and an optional field would let a future provider forget\n * to fill it in silently. Empty means the search returned bare functions.\n */\n /**\n * `arguments` is the query the model searched with, as the provider sent it\n * (`{paths: [\"crm\"]}` on the Responses API), when it said. Kept so the\n * search can be replayed on later requests (#776); see `ToolSearchRecord`.\n */\n | { type: \"tool-search\"; loaded: string[]; namespaces: string[]; arguments?: unknown }\n | { type: \"output-delta\"; delta: string }\n /**\n * `model` is the model the vendor says produced the response (`response.model`\n * on the Responses API), which is not always the one asked for: an Azure\n * deployment name answers with the model behind it, and an alias like\n * `gpt-5.4` with a dated snapshot. Absent when the vendor did not say — a\n * request that failed before any response, or a provider that does not know.\n * Optional so a custom provider need not fill it in (#741).\n */\n | { type: \"finish\"; reason: FinishReason; usage: Usage; model?: string }\n /**\n * `status` and `requestId` describe the HTTP response the error came from,\n * when there was one. They are for the server's record of the run\n * (`AgentRunResult.error`) and are never written to a client frame; leave\n * them out for an error that was not a response.\n */\n /**\n * The provider refused a stored file (`fileId` is the provider's id) and the\n * call was sent again with a note in the file's place, so the turn goes on.\n * `Agent` marks the stored `FilePart` `providerRejected`, which makes later\n * requests send the note instead of the id — otherwise the same refusal\n * costs a failed request on every turn of the thread (#684). `message` is\n * the provider's, for the log. A provider that never retries need not send\n * this; `Agent` treats its absence as nothing having been rejected.\n */\n | { type: \"file-rejected\"; fileId: string; message: string; status?: number; requestId?: string }\n /**\n * An attempt failed and the provider is about to ask again (#1192), sent\n * before the backoff wait, so it arrives while the call is still waiting\n * rather than after. Informational only: it is not content, it commits\n * nothing, and a consumer that ignores it loses nothing. See\n * `ProviderRetryInfo` for the fields. A provider that never retries need not\n * send it.\n */\n | ({ type: \"retry\" } & ProviderRetryInfo)\n | { type: \"error\"; error: AgentError; status?: number; requestId?: string };\n\n/**\n * One failed attempt of a provider call that is about to be asked again.\n *\n * - `attempt`: the attempt that failed, from 1. The next one is `attempt + 1`.\n * - `maxRetries`: the provider's `maxRetries`, so `attempt <= maxRetries`.\n * - `error`: the failure, normalized; `status` and `requestId` describe the\n * HTTP response it came from, when there was one.\n * - `phase`: `\"request\"` when no response arrived (or an error status did),\n * `\"stream\"` when the response started and its body broke before the first\n * content event.\n * - `timedOut`: the attempt was cut by `timeoutMs`, `streamIdleTimeoutMs` or\n * `streamMaxDurationMs`.\n * - `delayMs`: how long the provider waits before the next attempt.\n * - `elapsedMs`: since the call's first attempt started.\n */\nexport type ProviderRetryInfo = {\n attempt: number;\n maxRetries: number;\n error: AgentError;\n status?: number;\n requestId?: string;\n phase: \"request\" | \"stream\";\n timedOut: boolean;\n delayMs: number;\n elapsedMs: number;\n};\n\nexport type ProviderStream = AsyncIterable<ProviderEvent>;\n\n/**\n * Re-exported rather than declared here. What these configure is the *vendor*,\n * not the Responses API, and the images path resolves the same host, credential\n * and api-version from the same fields — see `providers/endpoints.ts` for why\n * that resolution lives in one place and what happens when it does not.\n */\nexport type { AnthropicConfig, AzureConfig, FoundryConfig, ProviderConfig } from \"./providers/endpoints\";\n\nexport abstract class AgentProvider {\n abstract readonly model: string;\n abstract readonly capabilities: ProviderCapabilities;\n\n /** The model ids this provider knows about — for autocomplete only; any\n * string is still accepted, because a new model must not require a gemi\n * release to use. */\n static models(): readonly string[] {\n return [];\n }\n\n abstract stream(params: ProviderStreamParams): ProviderStream;\n\n /**\n * Uploads a file and returns the id a `FilePart` carries. Message history\n * therefore holds provider file ids, which is the trade for getting vision\n * and PDF input without gemi owning a storage story in v1.\n */\n abstract upload(file: File): Promise<string>;\n\n /**\n * Maps a provider's error body onto the normalized codes, so an app can\n * branch on `rate_limited` without knowing whose rate limit it was.\n *\n * Shared rather than abstract-in-practice: Azure answers the same error\n * envelope as OpenAI, and the one place it differs — the content filter's\n * code, buried in `innererror` — is handled by reading both.\n */\n normalizeError(error: unknown): AgentError {\n return normalizeProviderError(error);\n }\n}\n\n/**\n * Autocomplete, not a gate. Every id here was confirmed present in\n * `GET https://api.openai.com/v1/models`; any other string is still accepted,\n * because a model released next Tuesday must not need a gemi release to use —\n * see `capabilitiesForModel` for what an unrecognized id is assumed to do.\n *\n * Ordered newest first, and deliberately short. `/v1/models` answers with\n * ninety-odd chat ids once the dated snapshots and the `-codex`, `-pro`,\n * `-chat-latest`, `-search-api` and `-nano` variants are counted; a list that\n * tried to be complete would be stale within the month and would bury the\n * handful of names anyone actually types. Snapshot-pinned ids\n * (`gpt-5.4-2026-03-05`) are left out for the same reason and work identically.\n *\n * The Azure provider returns this same list, which is a small lie it has always\n * told: a resource serves the deployments someone created, not the catalogue.\n * `AzureConfig.deployment` is the escape hatch, and an unrecognized deployment\n * name lands on the same capable default as an unrecognized model.\n */\nconst OPENAI_MODELS = [\n \"gpt-5.5\",\n \"gpt-5.4\",\n \"gpt-5.4-mini\",\n \"gpt-5.4-nano\",\n \"gpt-5.2\",\n \"gpt-5.1\",\n \"gpt-5\",\n \"gpt-5-mini\",\n \"gpt-5-nano\",\n \"gpt-4.1\",\n \"gpt-4.1-mini\",\n \"gpt-4.1-nano\",\n \"gpt-4o\",\n \"gpt-4o-mini\",\n \"o4-mini\",\n \"o3\",\n \"o3-mini\",\n] as const;\n\nexport class OpenAIProvider extends AgentProvider {\n readonly model: string;\n readonly capabilities: ProviderCapabilities;\n protected readonly config: ProviderConfig;\n\n constructor(model: string, config: ProviderConfig = {}) {\n super();\n this.model = model;\n this.capabilities = capabilitiesForModel(model);\n this.config = config;\n }\n\n /** Config defaults come from gemi's config (`ai.openai`), so an app that has\n * set `OPENAI_API_KEY` writes only the model name. */\n static model(model: string, config?: ProviderConfig): OpenAIProvider {\n return new OpenAIProvider(model, config);\n }\n\n static models(): readonly string[] {\n return OPENAI_MODELS;\n }\n\n stream(params: ProviderStreamParams): ProviderStream {\n const body = buildResponsesRequest(params, {\n model: this.model,\n capabilities: this.capabilities,\n });\n return streamResponses(this.endpoint(), body, {\n signal: params.signal,\n // The request carries the schema whenever the agent declared one, so the\n // parser has to read the answer as one too — a model that ignored the\n // parameter answers 400, not prose.\n structuredOutput: Boolean(params.output),\n files: sentFiles(params.messages),\n });\n }\n\n upload(file: File): Promise<string> {\n return uploadFile(this.endpoint(), file);\n }\n\n protected endpoint(): ResponsesEndpoint {\n return responsesEndpoint(openAITarget(this.config));\n }\n\n /**\n * Realtime (voice) calls on this provider's account: `createCall`,\n * `clientSecret`, `sideband` and `hangup`. The provider's model is the call's\n * default model, so build it with a realtime one\n * (`OpenAIProvider.model(\"gpt-realtime-mini\").realtime`). See\n * `providers/realtime.ts`.\n *\n * @experimental Not yet verified against a live call.\n */\n get realtime(): RealtimeClient {\n return new RealtimeClient(\n openAITarget(this.config, { timeoutMs: DEFAULT_REALTIME_TIMEOUT_MS }),\n { model: this.model },\n );\n }\n}\n\n/**\n * The current Claude models, newest family first. Autocomplete, not a gate,\n * like `OPENAI_MODELS`: any id is accepted, and `capabilitiesForClaude` says\n * what an unknown one is assumed to do.\n */\nconst CLAUDE_MODELS = [\n \"claude-opus-5-5\",\n \"claude-sonnet-5-5\",\n \"claude-haiku-5-5\",\n \"claude-fable-5-2\",\n \"claude-fable-5-1\",\n \"claude-opus-5\",\n \"claude-sonnet-5\",\n \"claude-fable-5\",\n \"claude-opus-4-8\",\n \"claude-sonnet-4-6\",\n \"claude-haiku-4-5\",\n] as const;\n\n/**\n * Claude on Anthropic's Messages API (`POST /v1/messages`), with an API key.\n *\n * The same request path as the OpenAI providers below the request body:\n * `streamResponses` does the retries, the stream limits and the holding back\n * until the first content event, and `parseMessagesStream` reads the stream.\n * `baseURL` (or `ANTHROPIC_BASE_URL`) points it at a gateway; see\n * `anthropicTarget`. `AzureAnthropicProvider` is the Azure AI Foundry\n * variant; Bedrock and Vertex are not covered.\n */\nexport class AnthropicProvider extends AgentProvider {\n readonly model: string;\n readonly capabilities: ProviderCapabilities;\n protected readonly config: AnthropicConfig;\n\n constructor(model: string, config: AnthropicConfig = {}) {\n super();\n this.model = model;\n this.capabilities = capabilitiesForClaude(model);\n this.config = config;\n }\n\n /**\n * `ANTHROPIC_API_KEY` (and `ANTHROPIC_WORKSPACE_ID`) from the environment\n * unless `config.apiKey` (`config.workspaceId`) is set.\n */\n static model(model: string, config?: AnthropicConfig): AnthropicProvider {\n return new AnthropicProvider(model, config);\n }\n\n static models(): readonly string[] {\n return CLAUDE_MODELS;\n }\n\n stream(params: ProviderStreamParams): ProviderStream {\n return this.send(params);\n }\n\n /**\n * One call, asked again at most once per kind of 400 that a changed request\n * answers (`recoverableRequestError`): a thinking block bound to another\n * conversation, with the thinking blocks stripped, and a schema too complex\n * to compile, with the answer asked for in the prompt. Only before anything\n * was yielded, which a 400 always is.\n */\n private async *send(params: ProviderStreamParams): ProviderStream {\n let request = params;\n let stripThinking = false;\n const tried = new Set<string>();\n for (;;) {\n let body = this.request(request);\n if (stripThinking) body = withoutThinkingBlocks(body);\n let recover: \"thinking\" | \"schema\" | undefined;\n let yielded = false;\n for await (const event of streamResponses(this.endpointFor(body), body, {\n signal: params.signal,\n structuredOutput: Boolean(params.output),\n parse: parseMessagesStream,\n })) {\n if (recover) continue;\n if (!yielded && event.type === \"error\" && event.status === 400) {\n const kind = recoverableRequestError(event.error.message);\n if (kind && !tried.has(kind)) {\n tried.add(kind);\n recover = kind;\n continue;\n }\n }\n if (isContentEvent(event)) yielded = true;\n yield event;\n }\n if (!recover) return;\n if (recover === \"thinking\") stripThinking = true;\n else if (request.output) request = { ...request, output: { ...request.output, strict: false } };\n }\n }\n\n private request(params: ProviderStreamParams): MessagesRequest {\n return buildMessagesRequest(params, {\n model: this.deployment(),\n modelId: this.model,\n capabilities: this.capabilities,\n forcedToolChoice: supportsForcedToolChoice(this.model),\n blockBinding: this.bindsThinking(),\n });\n }\n\n /** The beta header goes with the body that needs it. */\n private endpointFor(body: MessagesRequest): ResponsesEndpoint {\n const endpoint = this.endpoint();\n const binding = body.thinking?.type === \"adaptive\" && body.thinking.block_binding;\n if (!binding) return endpoint;\n return {\n ...endpoint,\n headers: async () => {\n const headers = await endpoint.headers();\n const beta = headers[\"anthropic-beta\"];\n return { ...headers, \"anthropic-beta\": beta ? `${beta},${THINKING_BINDING_BETA}` : THINKING_BINDING_BETA };\n },\n };\n }\n\n /** Whether `thinking.block_binding` and its beta header can be sent. */\n protected bindsThinking(): boolean {\n return true;\n }\n\n /** The `model` the request names. */\n protected deployment(): string {\n return this.model;\n }\n\n /** Through the Files API (`POST /v1/files`), which takes no `purpose`. */\n upload(file: File): Promise<string> {\n return uploadFile(this.endpoint(), file, null);\n }\n\n protected endpoint(): ResponsesEndpoint {\n return messagesEndpoint(anthropicTarget(this.config));\n }\n}\n\nfunction messagesEndpoint(target: ProviderTarget): ResponsesEndpoint {\n return { ...responsesEndpoint(target), responsesUrl: `${target.base}/messages` };\n}\n\n/**\n * Claude on Azure AI Foundry, which serves the same Messages API under the\n * resource's `/anthropic` path, so this is `AnthropicProvider` with another\n * endpoint and auth (see `foundryTarget`) and, as with `AzureOpenAIProvider`,\n * a deployment name that can differ from the model id. Capabilities are read\n * off the model, as there.\n *\n * NO FILES. The Files API is a 400 on deployments hosted on Azure (the\n * default hosting) and a beta on the ones hosted on Anthropic, so\n * `fileInput` is false and `upload()` refuses: a file a user attaches is\n * stored by gemi and named to the model by its attachment id, for a tool to\n * read. Everything else the agent uses (streaming, tools, thinking, structured\n * output, prompt caching) is supported on both hostings. Thinking is not\n * bound (`bindsThinking`).\n */\nexport class AzureAnthropicProvider extends AnthropicProvider {\n declare readonly capabilities: ProviderCapabilities;\n protected declare readonly config: FoundryConfig;\n\n constructor(model: string, config: FoundryConfig = {}) {\n super(model, config);\n this.capabilities = { ...capabilitiesForClaude(model), fileInput: false };\n }\n\n /** `ANTHROPIC_FOUNDRY_*` from the environment for what `config` leaves out. */\n static override model(model: string, config?: FoundryConfig): AzureAnthropicProvider {\n return new AzureAnthropicProvider(model, config);\n }\n\n override upload(_file: File): Promise<string> {\n return Promise.reject(\n new Error(\n \"AzureAnthropicProvider does not upload files: the Files API is not available on Azure-hosted Foundry deployments. The file is still stored by gemi and named to the model by its attachment id.\",\n ),\n );\n }\n\n protected override deployment(): string {\n return this.config.deployment ?? this.model;\n }\n\n /**\n * Thinking block-binding controls are unconfirmed on Foundry, and sending\n * the field where the beta is not taken is a 400 on every request. Without\n * it, a thinking block invalidated by an edit to the history is handled by\n * stripping the blocks and asking once more (see `AnthropicProvider.send`).\n */\n protected override bindsThinking(): boolean {\n return false;\n }\n\n protected override endpoint(): ResponsesEndpoint {\n return messagesEndpoint(foundryTarget(this.config));\n }\n}\n\n/**\n * Its own class rather than a flag on `OpenAIProvider`: Azure names the\n * deployment rather than the model, pins an api-version, authenticates with an\n * `api-key` header or an Entra token, and puts the resource in the host. One\n * class carrying both shapes means every field is conditionally meaningful.\n *\n * (It used to put the deployment in the URL as well. It does not: the Responses\n * API serves no such path — see `azureBase` for the measurements.)\n *\n * The API stays symmetrical — `.model()`, not `.deployment()`. Apps name a\n * model; mapping that onto a deployment is this class's problem, and an app\n * that named its deployment differently overrides it in config.\n */\nexport class AzureOpenAIProvider extends AgentProvider {\n readonly model: string;\n readonly capabilities: ProviderCapabilities;\n protected readonly config: AzureConfig;\n\n constructor(model: string, config: AzureConfig = {}) {\n super();\n this.model = model;\n // Read off the model, not the deployment: a deployment called `prod` says\n // nothing, and an unrecognized name lands on the all-capabilities default\n // anyway. See `capabilitiesForModel`.\n this.capabilities = capabilitiesForModel(model);\n this.config = config;\n }\n\n /** Defaults from gemi's config (`ai.azure`). */\n static model(model: string, config?: AzureConfig): AzureOpenAIProvider {\n return new AzureOpenAIProvider(model, config);\n }\n\n static models(): readonly string[] {\n return OPENAI_MODELS;\n }\n\n stream(params: ProviderStreamParams): ProviderStream {\n const body = buildResponsesRequest(params, {\n model: this.deployment(),\n capabilities: this.capabilities,\n });\n return streamResponses(this.endpoint(), body, {\n signal: params.signal,\n // The request carries the schema whenever the agent declared one, so the\n // parser has to read the answer as one too — a model that ignored the\n // parameter answers 400, not prose.\n structuredOutput: Boolean(params.output),\n files: sentFiles(params.messages),\n });\n }\n\n /** `assistants`, not OpenAI's `user_data`: Azure's Responses API refuses a\n * `user_data` id outright (#682). See `UploadPurpose`. */\n upload(file: File): Promise<string> {\n return uploadFile(this.endpoint(), file, \"assistants\");\n }\n\n protected deployment(): string {\n return this.config.deployment ?? this.model;\n }\n\n protected endpoint(): ResponsesEndpoint {\n return responsesEndpoint(azureTarget(this.config));\n }\n\n /**\n * Realtime (voice) calls on this Azure resource, on its GA\n * `/openai/v1/realtime` surface whatever `apiVersion` says (see\n * `azureRealtimeTarget`). The deployment is the call's default model, as it\n * is a text call's.\n *\n * Calls use Azure's documented server-proxied flow by default: a client\n * secret minted with the resource's credential, then the raw SDP posted with\n * that secret (`callFlow: \"ephemeral\"`), all server-side. Pass\n * `createCall({ flow: \"unified\" })` to try the multipart shape instead.\n *\n * @experimental Not yet verified against a live Azure call.\n */\n get realtime(): RealtimeClient {\n return new RealtimeClient(\n azureRealtimeTarget(this.config, { timeoutMs: DEFAULT_REALTIME_TIMEOUT_MS }),\n { model: this.deployment(), callFlow: \"ephemeral\" },\n );\n }\n}\n"
|
|
17
17
|
],
|
|
18
|
-
"mappings": ";qKAmEA,FAAM,GAAgB,IACT,GAAe,MAYrB,SAAS,EAAe,CAAC,EAAkC,EAAiC,CACjG,GAAI,CAAC,EAAO,OACZ,IAAM,EAAU,EAAM,KAAK,EAC3B,GAAI,gBAAgB,KAAK,CAAO,EAAG,OAAO,KAAK,IAAI,EAAG,OAAO,CAAO,EAAI,IAAI,EAC5E,IAAM,EAAO,KAAK,MAAM,CAAO,EAC/B,GAAI,OAAO,MAAM,CAAI,EAAG,OACxB,OAAO,KAAK,IAAI,EAAG,EAAO,CAAG,EAQxB,SAAS,CAAc,CAAC,EAAiB,EAA8B,CAC5E,IAAM,EAAU,KAAK,IAAI,GAAc,GAAgB,GAAK,CAAO,EACnE,OAAO,KAAK,MAAM,GAAW,IAAM,EAAO,EAAI,IAAI,EAGpD,SAAS,EAAiB,CAAC,EAAyB,CAIlD,OAAO,IAAW,KAAO,IAAW,KAAO,IAAW,KAAO,GAAU,IAiBzE,SAAS,EAAW,CAAC,EAAgB,EAAmC,CACtE,OAAO,GAAkB,CAAM,GAAK,EAAuB,CAAK,EAAE,UAGpE,SAAS,EAAW,CAAC,EAA8B,CACjD,OAAO,EAAO,QAAU,IAAI,aAAa,6BAA8B,YAAY,EAGrF,SAAS,EAAY,CAAC,EAAY,EAAqC,CACrE,OAAO,IAAI,QAAQ,CAAC,EAAS,IAAW,CAC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