pagegraph 0.13.0 → 0.14.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/README.md +48 -41
- package/dist/anthropic-messages-TqKpKmfW.js +1067 -0
- package/dist/anthropic-messages-TqKpKmfW.js.map +1 -0
- package/dist/audit.d.ts +2 -0
- package/dist/audit.js +1 -1
- package/dist/audit.js.map +1 -1
- package/dist/azure-openai-responses-DJjBLwoI.js +231 -0
- package/dist/azure-openai-responses-DJjBLwoI.js.map +1 -0
- package/dist/cli.js +10487 -38044
- package/dist/cli.js.map +1 -1
- package/dist/cloudflare-workers-ai-system-one-f3ZrvNYZ.js +41 -0
- package/dist/cloudflare-workers-ai-system-one-f3ZrvNYZ.js.map +1 -0
- package/dist/config.d.ts +6 -6
- package/dist/config.js.map +1 -1
- package/dist/diagnostics-Wt5faNDM.js +108 -0
- package/dist/diagnostics-Wt5faNDM.js.map +1 -0
- package/dist/dist-cFoAzruL.js +4794 -0
- package/dist/dist-cFoAzruL.js.map +1 -0
- package/dist/env-api-keys-C-OA0yM-.js +124 -0
- package/dist/env-api-keys-C-OA0yM-.js.map +1 -0
- package/dist/error-body-CyiejW4b.js +103 -0
- package/dist/error-body-CyiejW4b.js.map +1 -0
- package/dist/github-copilot-headers-CEpMOpQF.js +24 -0
- package/dist/github-copilot-headers-CEpMOpQF.js.map +1 -0
- package/dist/google-generative-ai-BxABKIKO.js +330 -0
- package/dist/google-generative-ai-BxABKIKO.js.map +1 -0
- package/dist/google-shared-0gpM2jFi.js +19471 -0
- package/dist/google-shared-0gpM2jFi.js.map +1 -0
- package/dist/google-vertex-D8Eb5cbu.js +376 -0
- package/dist/google-vertex-D8Eb5cbu.js.map +1 -0
- package/dist/hash-Dp7EzZUo.js +18 -0
- package/dist/hash-Dp7EzZUo.js.map +1 -0
- package/dist/headers-BRNMVpzu.js +19 -0
- package/dist/headers-BRNMVpzu.js.map +1 -0
- package/dist/json-parse-C10znB7l.js +383 -0
- package/dist/json-parse-C10znB7l.js.map +1 -0
- package/dist/mistral-conversations-CvaqBWjR.js +690 -0
- package/dist/mistral-conversations-CvaqBWjR.js.map +1 -0
- package/dist/models-DcT5qOEL.js +1203 -0
- package/dist/models-DcT5qOEL.js.map +1 -0
- package/dist/node-Ccvru9GE.js +26 -0
- package/dist/node-Ccvru9GE.js.map +1 -0
- package/dist/node-MEosBOF2.js +2403 -0
- package/dist/node-MEosBOF2.js.map +1 -0
- package/dist/openai-BCBEd2eO.js +17350 -0
- package/dist/openai-BCBEd2eO.js.map +1 -0
- package/dist/openai-codex-responses-vJqxeeRC.js +1268 -0
- package/dist/openai-codex-responses-vJqxeeRC.js.map +1 -0
- package/dist/openai-completions-Cb_fRAbI.js +989 -0
- package/dist/openai-completions-Cb_fRAbI.js.map +1 -0
- package/dist/openai-prompt-cache-Bc6qNWt0.js +10 -0
- package/dist/openai-prompt-cache-Bc6qNWt0.js.map +1 -0
- package/dist/openai-responses-sDuh82G5.js +268 -0
- package/dist/openai-responses-sDuh82G5.js.map +1 -0
- package/dist/openai-responses-shared-mhuo1Jov.js +599 -0
- package/dist/openai-responses-shared-mhuo1Jov.js.map +1 -0
- package/dist/openrouter-images-CRmBkzpX.js +127 -0
- package/dist/openrouter-images-CRmBkzpX.js.map +1 -0
- package/dist/pi-D3mMmYey.js +56805 -0
- package/dist/pi-D3mMmYey.js.map +1 -0
- package/dist/pi-messages-CejiVYvO.js +308 -0
- package/dist/pi-messages-CejiVYvO.js.map +1 -0
- package/dist/provider-env-t38GK5FF.js +39 -0
- package/dist/provider-env-t38GK5FF.js.map +1 -0
- package/dist/provider-retry-DzKoh1X7.js +80 -0
- package/dist/provider-retry-DzKoh1X7.js.map +1 -0
- package/dist/rolldown-runtime-B-lAHAz2.js +37 -0
- package/dist/sanitize-unicode-Ds14l9Om.js +28 -0
- package/dist/sanitize-unicode-Ds14l9Om.js.map +1 -0
- package/dist/sdk-C9_wiO6w.js +12503 -0
- package/dist/sdk-C9_wiO6w.js.map +1 -0
- package/dist/state-BuJP_3Lr.js +28102 -0
- package/dist/state-BuJP_3Lr.js.map +1 -0
- package/dist/system-one-shared-Dl10ZF7Z.js +167 -0
- package/dist/system-one-shared-Dl10ZF7Z.js.map +1 -0
- package/dist/transform-messages-BLJ8EfK6.js +468 -0
- package/dist/transform-messages-BLJ8EfK6.js.map +1 -0
- package/dist/typesafe-system-one-CwEWMV8P.js +25 -0
- package/dist/typesafe-system-one-CwEWMV8P.js.map +1 -0
- package/package.json +4 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mistral-conversations-CvaqBWjR.js","names":[],"sources":["../node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js"],"sourcesContent":["import { calculateCost, clampThinkingLevel } from \"../models.js\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.js\";\nimport { shortHash } from \"../utils/hash.js\";\nimport { headersToRecord } from \"../utils/headers.js\";\nimport { parseStreamingJson } from \"../utils/json-parse.js\";\nimport { getPiUserAgent } from \"../utils/pi-user-agent.js\";\nimport { sanitizeSurrogates } from \"../utils/sanitize-unicode.js\";\nimport { getSystemMessageText, renderSystemMessageUpdate } from \"../utils/text.js\";\nimport { getCurrentTools, resolveTranscript } from \"../utils/transcript.js\";\nimport { getJsonSchemaToolParameters, resolveJsonSchemaStrictSampling } from \"./constrained-sampling.js\";\nimport { buildBaseOptions } from \"./simple-options.js\";\nimport { transformMessages } from \"./transform-messages.js\";\nconst MISTRAL_TOOL_CALL_ID_LENGTH = 9;\nconst MAX_MISTRAL_ERROR_BODY_CHARS = 4000;\n/**\n * Stream responses from the native Mistral Chat Completions endpoint.\n */\nexport const stream = (model, context, options) => {\n const stream = new AssistantMessageEventStream();\n const normalizedContext = resolveTranscript(context, model.compat?.supportsMidConvoSystemMessages);\n (async () => {\n const output = createOutput(model);\n try {\n const apiKey = options?.apiKey;\n if (!apiKey) {\n throw new Error(`No API key for provider: ${model.provider}`);\n }\n const normalizeMistralToolCallId = createMistralToolCallIdNormalizer();\n const transformedMessages = transformMessages(normalizedContext.messages, model, (id) => normalizeMistralToolCallId(id));\n let payload = buildChatPayload(model, normalizedContext, transformedMessages, options);\n const nextPayload = await options?.onPayload?.(payload, model);\n if (nextPayload !== undefined) {\n payload = nextPayload;\n }\n const mistralStream = await requestMistralStream(model, payload, apiKey, options);\n stream.push({ type: \"start\", partial: output });\n await consumeChatStream(model, output, stream, mistralStream, options?.onProviderStreamEvent);\n if (options?.signal?.aborted) {\n throw new Error(\"Request was aborted\");\n }\n if (output.stopReason === \"pending\") {\n throw new Error(\"Mistral stream ended without a finish reason\");\n }\n if (output.stopReason === \"aborted\" || output.stopReason === \"error\") {\n throw new Error(output.errorMessage || \"An unknown error occurred\");\n }\n stream.push({ type: \"done\", reason: output.stopReason, message: output });\n stream.end();\n }\n catch (error) {\n for (const block of output.content) {\n // partialArgs is only a streaming scratch buffer; never persist it.\n delete block.partialArgs;\n }\n output.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n output.errorMessage = formatMistralError(error);\n stream.push({ type: \"error\", reason: output.stopReason, error: output });\n stream.end();\n }\n })();\n return stream;\n};\n/**\n * Maps provider-agnostic `SimpleStreamOptions` to Mistral options.\n */\nexport const streamSimple = (model, context, options) => {\n const apiKey = options?.apiKey;\n if (!apiKey) {\n throw new Error(`No API key for provider: ${model.provider}`);\n }\n const base = {\n ...buildBaseOptions(model, context, options, apiKey),\n toolChoice: options?.toolChoice,\n };\n const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;\n const reasoning = clampedReasoning === \"off\" ? undefined : clampedReasoning;\n // Models with a thinking level map use `reasoning_effort`; other reasoning models use `prompt_mode`.\n const effortMap = model.reasoning ? model.thinkingLevelMap : undefined;\n const reasoningEffort = effortMap\n ? reasoning\n ? (effortMap[reasoning] ?? \"high\")\n : (effortMap.off ?? undefined)\n : undefined;\n return stream(model, context, {\n ...base,\n promptMode: model.reasoning && !effortMap && reasoning ? \"reasoning\" : undefined,\n reasoningEffort: reasoningEffort,\n });\n};\nfunction createOutput(model) {\n return {\n role: \"assistant\",\n content: [],\n api: model.api,\n provider: model.provider,\n model: model.id,\n usage: {\n input: 0,\n output: 0,\n cacheRead: 0,\n cacheWrite: 0,\n totalTokens: 0,\n cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n },\n stopReason: \"pending\",\n timestamp: Date.now(),\n };\n}\nfunction createMistralToolCallIdNormalizer() {\n const idMap = new Map();\n const reverseMap = new Map();\n return (id) => {\n const existing = idMap.get(id);\n if (existing)\n return existing;\n let attempt = 0;\n while (true) {\n const candidate = deriveMistralToolCallId(id, attempt);\n const owner = reverseMap.get(candidate);\n if (!owner || owner === id) {\n idMap.set(id, candidate);\n reverseMap.set(candidate, id);\n return candidate;\n }\n attempt++;\n }\n };\n}\nfunction deriveMistralToolCallId(id, attempt) {\n const normalized = id.replace(/[^a-zA-Z0-9]/g, \"\");\n if (attempt === 0 && normalized.length === MISTRAL_TOOL_CALL_ID_LENGTH)\n return normalized;\n const seedBase = normalized || id;\n const seed = attempt === 0 ? seedBase : `${seedBase}:${attempt}`;\n return shortHash(seed)\n .replace(/[^a-zA-Z0-9]/g, \"\")\n .slice(0, MISTRAL_TOOL_CALL_ID_LENGTH);\n}\nfunction formatMistralError(error) {\n if (error instanceof Error) {\n const httpError = error;\n const statusCode = typeof httpError.statusCode === \"number\" ? httpError.statusCode : undefined;\n const bodyText = typeof httpError.body === \"string\" ? httpError.body.trim() : undefined;\n if (statusCode !== undefined && bodyText) {\n return `Mistral API error (${statusCode}): ${truncateErrorText(bodyText, MAX_MISTRAL_ERROR_BODY_CHARS)}`;\n }\n if (statusCode !== undefined)\n return `Mistral API error (${statusCode}): ${error.message}`;\n return error.message;\n }\n return safeJsonStringify(error);\n}\nfunction truncateErrorText(text, maxChars) {\n if (text.length <= maxChars)\n return text;\n return `${text.slice(0, maxChars)}... [truncated ${text.length - maxChars} chars]`;\n}\nfunction safeJsonStringify(value) {\n try {\n const serialized = JSON.stringify(value);\n return serialized === undefined ? String(value) : serialized;\n }\n catch {\n return String(value);\n }\n}\nasync function requestMistralStream(model, payload, apiKey, options) {\n const baseUrl = new URL(model.baseUrl);\n baseUrl.pathname = `${baseUrl.pathname.replace(/\\/+$/u, \"\")}/`;\n const url = new URL(\"v1/chat/completions\", baseUrl);\n const headers = buildMistralHeaders(model, apiKey, options);\n const timeoutSignal = AbortSignal.timeout(options?.timeoutMs ?? 60_000);\n const signal = options?.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;\n const response = await (options?.fetch ?? globalThis.fetch)(url, {\n method: \"POST\",\n headers,\n body: JSON.stringify(toMistralWirePayload(payload)),\n signal,\n });\n await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);\n if (!response.ok) {\n const body = await response.text();\n throw new MistralHttpError(response.status, body, response.statusText);\n }\n if (!response.body) {\n throw new Error(\"Mistral response has no body\");\n }\n return readMistralEvents(response.body, signal);\n}\nclass MistralHttpError extends Error {\n statusCode;\n body;\n constructor(statusCode, body, statusText) {\n super(statusText || `Request failed with status ${statusCode}`);\n this.name = \"MistralHttpError\";\n this.statusCode = statusCode;\n this.body = body;\n }\n}\nfunction buildMistralHeaders(model, apiKey, options) {\n const headers = new Headers({\n \"User-Agent\": getPiUserAgent(),\n accept: \"text/event-stream\",\n authorization: `Bearer ${apiKey}`,\n \"content-type\": \"application/json\",\n });\n applyMistralHeaderOverrides(headers, model.headers);\n applyMistralHeaderOverrides(headers, options?.headers);\n const hasExplicitAffinity = hasMistralHeaderOverride(model.headers, \"x-affinity\") || hasMistralHeaderOverride(options?.headers, \"x-affinity\");\n if (shouldUsePromptCaching(options) && !hasExplicitAffinity) {\n headers.set(\"x-affinity\", options.sessionId);\n }\n return headers;\n}\nfunction applyMistralHeaderOverrides(headers, overrides) {\n if (!overrides)\n return;\n for (const [name, value] of Object.entries(overrides)) {\n if (value === null)\n headers.delete(name);\n else\n headers.set(name, value);\n }\n}\nfunction hasMistralHeaderOverride(overrides, target) {\n return !!overrides && Object.keys(overrides).some((name) => name.toLowerCase() === target);\n}\nfunction toMistralWirePayload(payload) {\n const wirePayload = { ...payload };\n for (const [source, target] of [\n [\"topP\", \"top_p\"],\n [\"maxTokens\", \"max_tokens\"],\n [\"randomSeed\", \"random_seed\"],\n [\"responseFormat\", \"response_format\"],\n [\"toolChoice\", \"tool_choice\"],\n [\"presencePenalty\", \"presence_penalty\"],\n [\"frequencyPenalty\", \"frequency_penalty\"],\n [\"parallelToolCalls\", \"parallel_tool_calls\"],\n [\"reasoningEffort\", \"reasoning_effort\"],\n [\"promptMode\", \"prompt_mode\"],\n [\"promptCacheKey\", \"prompt_cache_key\"],\n [\"safePrompt\", \"safe_prompt\"],\n ]) {\n remapMistralProperty(wirePayload, source, target);\n }\n wirePayload.messages = payload.messages.map((message) => toMistralWireMessage(message));\n const responseFormat = wirePayload.response_format;\n if (isMistralRecord(responseFormat)) {\n const wireResponseFormat = { ...responseFormat };\n remapMistralProperty(wireResponseFormat, \"jsonSchema\", \"json_schema\");\n const jsonSchema = wireResponseFormat.json_schema;\n if (isMistralRecord(jsonSchema)) {\n const wireJsonSchema = { ...jsonSchema };\n remapMistralProperty(wireJsonSchema, \"schemaDefinition\", \"schema\");\n wireResponseFormat.json_schema = wireJsonSchema;\n }\n wirePayload.response_format = wireResponseFormat;\n }\n return wirePayload;\n}\nfunction toMistralWireMessage(message) {\n const wireMessage = { ...message };\n remapMistralProperty(wireMessage, \"toolCalls\", \"tool_calls\");\n remapMistralProperty(wireMessage, \"toolCallId\", \"tool_call_id\");\n if (Array.isArray(message.content)) {\n wireMessage.content = message.content.map((chunk) => toMistralWireContentChunk(chunk));\n }\n return wireMessage;\n}\nfunction toMistralWireContentChunk(chunk) {\n const wireChunk = { ...chunk };\n for (const [source, target] of [\n [\"imageUrl\", \"image_url\"],\n [\"documentUrl\", \"document_url\"],\n [\"documentName\", \"document_name\"],\n [\"fileId\", \"file_id\"],\n [\"referenceIds\", \"reference_ids\"],\n [\"inputAudio\", \"input_audio\"],\n ]) {\n remapMistralProperty(wireChunk, source, target);\n }\n return wireChunk;\n}\nfunction remapMistralProperty(record, source, target) {\n if (!(source in record))\n return;\n record[target] = record[source];\n delete record[source];\n}\nfunction isMistralRecord(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nconst MISTRAL_STREAM_DONE = Symbol(\"mistral-stream-done\");\nasync function* readMistralEvents(body, signal) {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n const onAbort = () => {\n void reader.cancel().catch(() => { });\n };\n signal.addEventListener(\"abort\", onAbort, { once: true });\n try {\n while (true) {\n if (signal.aborted)\n throw signal.reason;\n const { done, value } = await reader.read();\n if (signal.aborted)\n throw signal.reason;\n buffer += done ? decoder.decode() : decoder.decode(value, { stream: true });\n let boundary = findMistralEventBoundary(buffer);\n while (boundary) {\n const event = parseMistralEvent(buffer.slice(0, boundary.index));\n buffer = buffer.slice(boundary.index + boundary.length);\n if (event === MISTRAL_STREAM_DONE)\n return;\n if (event)\n yield event;\n boundary = findMistralEventBoundary(buffer);\n }\n if (done)\n break;\n }\n if (buffer.trim()) {\n const event = parseMistralEvent(buffer);\n if (event !== MISTRAL_STREAM_DONE && event)\n yield event;\n }\n }\n finally {\n signal.removeEventListener(\"abort\", onAbort);\n try {\n await reader.cancel();\n }\n catch { }\n try {\n reader.releaseLock();\n }\n catch { }\n }\n}\nfunction findMistralEventBoundary(buffer) {\n const match = /\\r\\n\\r\\n|\\r\\n\\r|\\r\\n\\n|\\r\\r\\n|\\n\\r\\n|\\r\\r|\\n\\r|\\n\\n/u.exec(buffer);\n return match?.index === undefined ? undefined : { index: match.index, length: match[0].length };\n}\nfunction parseMistralEvent(raw) {\n const data = raw\n .split(/\\r\\n|\\r|\\n/u)\n .filter((line) => line.startsWith(\"data:\"))\n .map((line) => line.slice(5).trimStart())\n .join(\"\\n\")\n .trim();\n if (!data)\n return undefined;\n if (data === \"[DONE]\")\n return MISTRAL_STREAM_DONE;\n const parsed = JSON.parse(data);\n if (!isMistralRecord(parsed) || !Array.isArray(parsed.choices)) {\n throw new Error(\"Invalid Mistral streaming event\");\n }\n return { data: parsed };\n}\nfunction buildChatPayload(model, context, messages, options) {\n const payload = {\n model: model.id,\n stream: true,\n messages: toChatMessages(messages, model.input.includes(\"image\")),\n };\n const currentTools = getCurrentTools(context.messages);\n if (currentTools.length > 0)\n payload.tools = toFunctionTools(currentTools);\n if (options?.temperature !== undefined)\n payload.temperature = options.temperature;\n if (options?.maxTokens !== undefined)\n payload.maxTokens = options.maxTokens;\n if (options?.toolChoice)\n payload.toolChoice = mapToolChoice(options.toolChoice);\n if (options?.promptMode)\n payload.promptMode = options.promptMode;\n if (options?.reasoningEffort)\n payload.reasoningEffort = options.reasoningEffort;\n if (shouldUsePromptCaching(options))\n payload.promptCacheKey = options.sessionId;\n return payload;\n}\nfunction shouldUsePromptCaching(options) {\n return options?.cacheRetention !== \"none\" && !!options?.sessionId;\n}\nfunction getMistralCachedPromptTokens(usage, promptTokens) {\n const rawUsage = usage;\n const rawCachedTokens = rawUsage.promptTokensDetails?.cachedTokens ??\n rawUsage.prompt_tokens_details?.cached_tokens ??\n rawUsage.promptTokenDetails?.cachedTokens ??\n rawUsage.prompt_token_details?.cached_tokens ??\n rawUsage.numCachedTokens ??\n rawUsage.num_cached_tokens ??\n 0;\n const cachedTokens = typeof rawCachedTokens === \"number\" && Number.isFinite(rawCachedTokens) ? rawCachedTokens : 0;\n return Math.min(promptTokens, Math.max(0, cachedTokens));\n}\nasync function consumeChatStream(model, output, stream, mistralStream, onProviderStreamEvent) {\n let currentBlock = null;\n const blocks = output.content;\n const blockIndex = () => blocks.length - 1;\n const toolBlocksByKey = new Map();\n const finishCurrentBlock = (block) => {\n if (!block)\n return;\n if (block.type === \"text\") {\n stream.push({\n type: \"text_end\",\n contentIndex: blockIndex(),\n content: block.text,\n partial: output,\n });\n return;\n }\n if (block.type === \"thinking\") {\n stream.push({\n type: \"thinking_end\",\n contentIndex: blockIndex(),\n content: block.thinking,\n partial: output,\n });\n }\n };\n for await (const event of mistralStream) {\n const chunk = event.data;\n await onProviderStreamEvent?.(chunk, model);\n // Mistral's streamed CompletionChunk carries an id field. Keep the first non-empty one,\n // mirroring how OpenAI-style streaming exposes a stable response identifier per stream.\n output.responseId ||= chunk.id;\n if (chunk.usage) {\n const promptTokens = chunk.usage.prompt_tokens || 0;\n const cachedPromptTokens = getMistralCachedPromptTokens(chunk.usage, promptTokens);\n output.usage.input = Math.max(0, promptTokens - cachedPromptTokens);\n output.usage.output = chunk.usage.completion_tokens || 0;\n output.usage.cacheRead = cachedPromptTokens;\n output.usage.cacheWrite = 0;\n output.usage.totalTokens =\n chunk.usage.total_tokens ||\n output.usage.input + output.usage.output + output.usage.cacheRead + output.usage.cacheWrite;\n calculateCost(model, output.usage);\n }\n const choice = chunk.choices[0];\n if (!choice)\n continue;\n if (choice.finish_reason) {\n output.rawStopReason = choice.finish_reason;\n const stopReasonResult = mapChatStopReason(choice.finish_reason);\n output.stopReason = stopReasonResult.stopReason;\n if (stopReasonResult.errorMessage) {\n output.errorMessage = stopReasonResult.errorMessage;\n }\n }\n const delta = choice.delta;\n if (delta.content !== null && delta.content !== undefined) {\n const contentItems = typeof delta.content === \"string\" ? [delta.content] : delta.content;\n for (const item of contentItems) {\n if (typeof item === \"string\") {\n const textDelta = sanitizeSurrogates(item);\n // GLM models on Mistral send empty content deltas around thinking and tool calls.\n // Opening a block for them splits thinking into multiple blocks, which Mistral rejects on replay.\n if (!textDelta)\n continue;\n if (!currentBlock || currentBlock.type !== \"text\") {\n finishCurrentBlock(currentBlock);\n currentBlock = { type: \"text\", text: \"\" };\n output.content.push(currentBlock);\n stream.push({ type: \"text_start\", contentIndex: blockIndex(), partial: output });\n }\n currentBlock.text += textDelta;\n stream.push({\n type: \"text_delta\",\n contentIndex: blockIndex(),\n delta: textDelta,\n partial: output,\n });\n continue;\n }\n if (item.type === \"thinking\") {\n const deltaText = (item.thinking ?? [])\n .map((part) => part.text ?? \"\")\n .filter((text) => text.length > 0)\n .join(\"\");\n const thinkingDelta = sanitizeSurrogates(deltaText);\n if (!thinkingDelta)\n continue;\n if (!currentBlock || currentBlock.type !== \"thinking\") {\n finishCurrentBlock(currentBlock);\n currentBlock = { type: \"thinking\", thinking: \"\" };\n output.content.push(currentBlock);\n stream.push({ type: \"thinking_start\", contentIndex: blockIndex(), partial: output });\n }\n currentBlock.thinking += thinkingDelta;\n stream.push({\n type: \"thinking_delta\",\n contentIndex: blockIndex(),\n delta: thinkingDelta,\n partial: output,\n });\n continue;\n }\n if (item.type === \"text\") {\n const textDelta = sanitizeSurrogates(item.text ?? \"\");\n if (!textDelta)\n continue;\n if (!currentBlock || currentBlock.type !== \"text\") {\n finishCurrentBlock(currentBlock);\n currentBlock = { type: \"text\", text: \"\" };\n output.content.push(currentBlock);\n stream.push({ type: \"text_start\", contentIndex: blockIndex(), partial: output });\n }\n currentBlock.text += textDelta;\n stream.push({\n type: \"text_delta\",\n contentIndex: blockIndex(),\n delta: textDelta,\n partial: output,\n });\n }\n }\n }\n const toolCalls = delta.tool_calls || [];\n for (const toolCall of toolCalls) {\n if (currentBlock) {\n finishCurrentBlock(currentBlock);\n currentBlock = null;\n }\n const callId = toolCall.id && toolCall.id !== \"null\"\n ? toolCall.id\n : deriveMistralToolCallId(`toolcall:${toolCall.index ?? 0}`, 0);\n const key = toolCall.index ?? callId;\n const existingIndex = toolBlocksByKey.get(key);\n let block;\n if (existingIndex !== undefined) {\n const existing = output.content[existingIndex];\n if (existing?.type === \"toolCall\") {\n block = existing;\n }\n }\n if (!block) {\n block = {\n type: \"toolCall\",\n id: callId,\n name: toolCall.function.name,\n arguments: {},\n partialArgs: \"\",\n };\n output.content.push(block);\n toolBlocksByKey.set(key, output.content.length - 1);\n stream.push({ type: \"toolcall_start\", contentIndex: output.content.length - 1, partial: output });\n }\n const argsDelta = typeof toolCall.function.arguments === \"string\"\n ? toolCall.function.arguments\n : JSON.stringify(toolCall.function.arguments || {});\n block.partialArgs = (block.partialArgs || \"\") + argsDelta;\n block.arguments = parseStreamingJson(block.partialArgs);\n stream.push({\n type: \"toolcall_delta\",\n contentIndex: toolBlocksByKey.get(key),\n delta: argsDelta,\n partial: output,\n });\n }\n }\n finishCurrentBlock(currentBlock);\n for (const index of toolBlocksByKey.values()) {\n const block = output.content[index];\n if (block.type !== \"toolCall\")\n continue;\n const toolBlock = block;\n toolBlock.arguments = parseStreamingJson(toolBlock.partialArgs);\n // Finalize in-place and strip the scratch buffer so replay only\n // carries parsed arguments.\n delete toolBlock.partialArgs;\n stream.push({\n type: \"toolcall_end\",\n contentIndex: index,\n toolCall: toolBlock,\n partial: output,\n });\n }\n}\nfunction toFunctionTools(tools) {\n return tools.map((tool) => {\n const strict = resolveJsonSchemaStrictSampling(tool, true);\n return {\n type: \"function\",\n function: {\n name: tool.name,\n description: tool.description,\n parameters: stripSymbolKeys(getJsonSchemaToolParameters(tool, strict)),\n strict: strict ?? false,\n },\n };\n });\n}\nfunction stripSymbolKeys(value) {\n if (Array.isArray(value)) {\n return value.map((item) => stripSymbolKeys(item));\n }\n if (value && typeof value === \"object\") {\n const result = {};\n for (const [key, entry] of Object.entries(value)) {\n result[key] = stripSymbolKeys(entry);\n }\n return result;\n }\n return value;\n}\nfunction toChatMessages(messages, supportsImages) {\n const result = [];\n for (const [index, msg] of messages.entries()) {\n if (msg.role === \"system\") {\n const text = index === 0 ? getSystemMessageText(msg) : renderSystemMessageUpdate(msg);\n if (text.length > 0)\n result.push({ role: \"system\", content: sanitizeSurrogates(text) });\n continue;\n }\n if (msg.role === \"user\") {\n if (typeof msg.content === \"string\") {\n result.push({ role: \"user\", content: sanitizeSurrogates(msg.content) });\n continue;\n }\n const hadImages = msg.content.some((item) => item.type === \"image\");\n const content = msg.content\n .filter((item) => item.type === \"text\" || supportsImages)\n .map((item) => {\n if (item.type === \"text\")\n return { type: \"text\", text: sanitizeSurrogates(item.text) };\n return { type: \"image_url\", imageUrl: `data:${item.mimeType};base64,${item.data}` };\n });\n if (content.length > 0) {\n result.push({ role: \"user\", content });\n continue;\n }\n if (hadImages && !supportsImages) {\n result.push({ role: \"user\", content: \"(image omitted: model does not support images)\" });\n }\n continue;\n }\n if (msg.role === \"assistant\") {\n const contentParts = [];\n const toolCalls = [];\n for (const block of msg.content) {\n if (block.type === \"text\") {\n if (block.text.trim().length > 0) {\n contentParts.push({ type: \"text\", text: sanitizeSurrogates(block.text) });\n }\n continue;\n }\n if (block.type === \"thinking\") {\n if (block.thinking.trim().length > 0) {\n contentParts.push({\n type: \"thinking\",\n thinking: [{ type: \"text\", text: sanitizeSurrogates(block.thinking) }],\n });\n }\n continue;\n }\n toolCalls.push({\n id: block.id,\n type: \"function\",\n function: { name: block.name, arguments: JSON.stringify(block.arguments || {}) },\n index: 0,\n });\n }\n const assistantMessage = { role: \"assistant\", prefix: false };\n if (contentParts.length > 0)\n assistantMessage.content = contentParts;\n if (toolCalls.length > 0)\n assistantMessage.toolCalls = toolCalls;\n if (contentParts.length > 0 || toolCalls.length > 0)\n result.push(assistantMessage);\n continue;\n }\n const toolContent = [];\n const textResult = msg.content\n .filter((part) => part.type === \"text\")\n .map((part) => (part.type === \"text\" ? sanitizeSurrogates(part.text) : \"\"))\n .join(\"\\n\");\n const hasImages = msg.content.some((part) => part.type === \"image\");\n const toolText = buildToolResultText(textResult, hasImages, supportsImages, msg.isError);\n toolContent.push({ type: \"text\", text: toolText });\n for (const part of msg.content) {\n if (!supportsImages)\n continue;\n if (part.type !== \"image\")\n continue;\n toolContent.push({\n type: \"image_url\",\n imageUrl: `data:${part.mimeType};base64,${part.data}`,\n });\n }\n result.push({\n role: \"tool\",\n toolCallId: msg.toolCallId,\n name: msg.toolName,\n content: toolContent,\n });\n }\n return result;\n}\nfunction buildToolResultText(text, hasImages, supportsImages, isError) {\n const trimmed = text.trim();\n const errorPrefix = isError ? \"[tool error] \" : \"\";\n if (trimmed.length > 0) {\n const imageSuffix = hasImages && !supportsImages ? \"\\n[tool image omitted: model does not support images]\" : \"\";\n return `${errorPrefix}${trimmed}${imageSuffix}`;\n }\n if (hasImages) {\n if (supportsImages) {\n return isError ? \"[tool error] (see attached image)\" : \"(see attached image)\";\n }\n return isError\n ? \"[tool error] (image omitted: model does not support images)\"\n : \"(image omitted: model does not support images)\";\n }\n return isError ? \"[tool error] (no tool output)\" : \"(no tool output)\";\n}\nfunction mapToolChoice(choice) {\n if (!choice)\n return undefined;\n if (choice === \"auto\" || choice === \"none\" || choice === \"any\" || choice === \"required\") {\n return choice;\n }\n return {\n type: \"function\",\n function: { name: choice.function.name },\n };\n}\nfunction mapChatStopReason(reason) {\n if (reason === null)\n return { stopReason: \"stop\" };\n switch (reason) {\n case \"stop\":\n return { stopReason: \"stop\" };\n case \"length\":\n case \"model_length\":\n return { stopReason: \"length\" };\n case \"tool_calls\":\n return { stopReason: \"toolUse\" };\n case \"error\":\n return { stopReason: \"error\", errorMessage: \"Provider stopped with: error\" };\n default:\n return { stopReason: \"error\", errorMessage: `Provider stopped with: ${reason}` };\n }\n}\n//# sourceMappingURL=mistral-conversations.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAYA,MAAM,8BAA8B;AACpC,MAAM,+BAA+B;;;;AAIrC,MAAa,UAAU,OAAO,SAAS,YAAY;CAC/C,MAAM,SAAS,IAAI,4BAA4B;CAC/C,MAAM,oBAAoB,kBAAkB,SAAS,MAAM,QAAQ,8BAA8B;CACjG,CAAC,YAAY;EACT,MAAM,SAAS,aAAa,KAAK;EACjC,IAAI;GACA,MAAM,SAAS,SAAS;GACxB,IAAI,CAAC,QACD,MAAM,IAAI,MAAM,4BAA4B,MAAM,UAAU;GAEhE,MAAM,6BAA6B,kCAAkC;GACrE,MAAM,sBAAsB,kBAAkB,kBAAkB,UAAU,QAAQ,OAAO,2BAA2B,EAAE,CAAC;GACvH,IAAI,UAAU,iBAAiB,OAAO,mBAAmB,qBAAqB,OAAO;GACrF,MAAM,cAAc,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