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.
Files changed (80) hide show
  1. package/README.md +48 -41
  2. package/dist/anthropic-messages-TqKpKmfW.js +1067 -0
  3. package/dist/anthropic-messages-TqKpKmfW.js.map +1 -0
  4. package/dist/audit.d.ts +2 -0
  5. package/dist/audit.js +1 -1
  6. package/dist/audit.js.map +1 -1
  7. package/dist/azure-openai-responses-DJjBLwoI.js +231 -0
  8. package/dist/azure-openai-responses-DJjBLwoI.js.map +1 -0
  9. package/dist/cli.js +10487 -38044
  10. package/dist/cli.js.map +1 -1
  11. package/dist/cloudflare-workers-ai-system-one-f3ZrvNYZ.js +41 -0
  12. package/dist/cloudflare-workers-ai-system-one-f3ZrvNYZ.js.map +1 -0
  13. package/dist/config.d.ts +6 -6
  14. package/dist/config.js.map +1 -1
  15. package/dist/diagnostics-Wt5faNDM.js +108 -0
  16. package/dist/diagnostics-Wt5faNDM.js.map +1 -0
  17. package/dist/dist-cFoAzruL.js +4794 -0
  18. package/dist/dist-cFoAzruL.js.map +1 -0
  19. package/dist/env-api-keys-C-OA0yM-.js +124 -0
  20. package/dist/env-api-keys-C-OA0yM-.js.map +1 -0
  21. package/dist/error-body-CyiejW4b.js +103 -0
  22. package/dist/error-body-CyiejW4b.js.map +1 -0
  23. package/dist/github-copilot-headers-CEpMOpQF.js +24 -0
  24. package/dist/github-copilot-headers-CEpMOpQF.js.map +1 -0
  25. package/dist/google-generative-ai-BxABKIKO.js +330 -0
  26. package/dist/google-generative-ai-BxABKIKO.js.map +1 -0
  27. package/dist/google-shared-0gpM2jFi.js +19471 -0
  28. package/dist/google-shared-0gpM2jFi.js.map +1 -0
  29. package/dist/google-vertex-D8Eb5cbu.js +376 -0
  30. package/dist/google-vertex-D8Eb5cbu.js.map +1 -0
  31. package/dist/hash-Dp7EzZUo.js +18 -0
  32. package/dist/hash-Dp7EzZUo.js.map +1 -0
  33. package/dist/headers-BRNMVpzu.js +19 -0
  34. package/dist/headers-BRNMVpzu.js.map +1 -0
  35. package/dist/json-parse-C10znB7l.js +383 -0
  36. package/dist/json-parse-C10znB7l.js.map +1 -0
  37. package/dist/mistral-conversations-CvaqBWjR.js +690 -0
  38. package/dist/mistral-conversations-CvaqBWjR.js.map +1 -0
  39. package/dist/models-DcT5qOEL.js +1203 -0
  40. package/dist/models-DcT5qOEL.js.map +1 -0
  41. package/dist/node-Ccvru9GE.js +26 -0
  42. package/dist/node-Ccvru9GE.js.map +1 -0
  43. package/dist/node-MEosBOF2.js +2403 -0
  44. package/dist/node-MEosBOF2.js.map +1 -0
  45. package/dist/openai-BCBEd2eO.js +17350 -0
  46. package/dist/openai-BCBEd2eO.js.map +1 -0
  47. package/dist/openai-codex-responses-vJqxeeRC.js +1268 -0
  48. package/dist/openai-codex-responses-vJqxeeRC.js.map +1 -0
  49. package/dist/openai-completions-Cb_fRAbI.js +989 -0
  50. package/dist/openai-completions-Cb_fRAbI.js.map +1 -0
  51. package/dist/openai-prompt-cache-Bc6qNWt0.js +10 -0
  52. package/dist/openai-prompt-cache-Bc6qNWt0.js.map +1 -0
  53. package/dist/openai-responses-sDuh82G5.js +268 -0
  54. package/dist/openai-responses-sDuh82G5.js.map +1 -0
  55. package/dist/openai-responses-shared-mhuo1Jov.js +599 -0
  56. package/dist/openai-responses-shared-mhuo1Jov.js.map +1 -0
  57. package/dist/openrouter-images-CRmBkzpX.js +127 -0
  58. package/dist/openrouter-images-CRmBkzpX.js.map +1 -0
  59. package/dist/pi-D3mMmYey.js +56805 -0
  60. package/dist/pi-D3mMmYey.js.map +1 -0
  61. package/dist/pi-messages-CejiVYvO.js +308 -0
  62. package/dist/pi-messages-CejiVYvO.js.map +1 -0
  63. package/dist/provider-env-t38GK5FF.js +39 -0
  64. package/dist/provider-env-t38GK5FF.js.map +1 -0
  65. package/dist/provider-retry-DzKoh1X7.js +80 -0
  66. package/dist/provider-retry-DzKoh1X7.js.map +1 -0
  67. package/dist/rolldown-runtime-B-lAHAz2.js +37 -0
  68. package/dist/sanitize-unicode-Ds14l9Om.js +28 -0
  69. package/dist/sanitize-unicode-Ds14l9Om.js.map +1 -0
  70. package/dist/sdk-C9_wiO6w.js +12503 -0
  71. package/dist/sdk-C9_wiO6w.js.map +1 -0
  72. package/dist/state-BuJP_3Lr.js +28102 -0
  73. package/dist/state-BuJP_3Lr.js.map +1 -0
  74. package/dist/system-one-shared-Dl10ZF7Z.js +167 -0
  75. package/dist/system-one-shared-Dl10ZF7Z.js.map +1 -0
  76. package/dist/transform-messages-BLJ8EfK6.js +468 -0
  77. package/dist/transform-messages-BLJ8EfK6.js.map +1 -0
  78. package/dist/typesafe-system-one-CwEWMV8P.js +25 -0
  79. package/dist/typesafe-system-one-CwEWMV8P.js.map +1 -0
  80. package/package.json +4 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-generative-ai-BxABKIKO.js","names":[],"sources":["../node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js"],"sourcesContent":["import { GoogleGenAI, } from \"@google/genai\";\nimport { calculateCost, clampThinkingLevel } from \"../models.js\";\nimport { formatProviderError, normalizeProviderError } from \"../utils/error-body.js\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.js\";\nimport { providerHeadersToRecord } from \"../utils/headers.js\";\nimport { getPiUserAgent } from \"../utils/pi-user-agent.js\";\nimport { sanitizeSurrogates } from \"../utils/sanitize-unicode.js\";\nimport { getSystemMessageText } from \"../utils/text.js\";\nimport { collapseSystemMessages, getCurrentTools, getInitialSystemMessage } from \"../utils/transcript.js\";\nimport { convertMessages, convertTools, getDisabledGoogleThinkingConfig, isThinkingPart, mapStopReason, resolveGoogleFunctionCallingMode, resolveGoogleThinkingLevel, retainThoughtSignature, retryGoogleRequest, supportsGoogleStrictToolSampling, toGoogleSdkThinkingLevel, toGoogleThinkingLevel, usesGoogleThinkingLevel, } from \"./google-shared.js\";\nimport { buildBaseOptions } from \"./simple-options.js\";\n// Counter for generating unique tool call IDs\nlet toolCallCounter = 0;\nexport const stream = (model, context, options) => {\n const stream = new AssistantMessageEventStream();\n const normalizedContext = collapseSystemMessages(context);\n (async () => {\n const output = {\n role: \"assistant\",\n content: [],\n api: \"google-generative-ai\",\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 try {\n if (options?.fetch && options.fetch !== globalThis.fetch) {\n throw new Error(\"Custom fetch is not supported by the Google Generative AI adapter\");\n }\n const apiKey = options?.apiKey;\n if (!apiKey) {\n throw new Error(`No API key for provider: ${model.provider}`);\n }\n const client = createClient(model, apiKey, options?.headers);\n let params = buildParams(model, normalizedContext, options);\n const nextParams = await options?.onPayload?.(params, model);\n if (nextParams !== undefined) {\n params = nextParams;\n }\n const googleStream = await retryGoogleRequest(() => client.models.generateContentStream(params), options);\n stream.push({ type: \"start\", partial: output });\n let currentBlock = null;\n const blocks = output.content;\n const blockIndex = () => blocks.length - 1;\n for await (const chunk of googleStream) {\n await options?.onProviderStreamEvent?.(chunk, model);\n // @google/genai documents GenerateContentResponse.responseId as an output-only field\n // used to identify each response. Keep the first non-empty one from the stream.\n output.responseId ||= chunk.responseId;\n const candidate = chunk.candidates?.[0];\n if (candidate?.content?.parts) {\n for (const part of candidate.content.parts) {\n if (part.text !== undefined) {\n const isThinking = isThinkingPart(part);\n if (!currentBlock ||\n (isThinking && currentBlock.type !== \"thinking\") ||\n (!isThinking && currentBlock.type !== \"text\")) {\n if (currentBlock) {\n if (currentBlock.type === \"text\") {\n stream.push({\n type: \"text_end\",\n contentIndex: blocks.length - 1,\n content: currentBlock.text,\n partial: output,\n });\n }\n else {\n stream.push({\n type: \"thinking_end\",\n contentIndex: blockIndex(),\n content: currentBlock.thinking,\n partial: output,\n });\n }\n }\n if (isThinking) {\n currentBlock = { type: \"thinking\", thinking: \"\", thinkingSignature: undefined };\n output.content.push(currentBlock);\n stream.push({ type: \"thinking_start\", contentIndex: blockIndex(), partial: output });\n }\n else {\n currentBlock = { type: \"text\", text: \"\" };\n output.content.push(currentBlock);\n stream.push({ type: \"text_start\", contentIndex: blockIndex(), partial: output });\n }\n }\n if (currentBlock.type === \"thinking\") {\n currentBlock.thinking += part.text;\n currentBlock.thinkingSignature = retainThoughtSignature(currentBlock.thinkingSignature, part.thoughtSignature);\n stream.push({\n type: \"thinking_delta\",\n contentIndex: blockIndex(),\n delta: part.text,\n partial: output,\n });\n }\n else {\n currentBlock.text += part.text;\n currentBlock.textSignature = retainThoughtSignature(currentBlock.textSignature, part.thoughtSignature);\n stream.push({\n type: \"text_delta\",\n contentIndex: blockIndex(),\n delta: part.text,\n partial: output,\n });\n }\n }\n if (part.functionCall) {\n if (currentBlock) {\n if (currentBlock.type === \"text\") {\n stream.push({\n type: \"text_end\",\n contentIndex: blockIndex(),\n content: currentBlock.text,\n partial: output,\n });\n }\n else {\n stream.push({\n type: \"thinking_end\",\n contentIndex: blockIndex(),\n content: currentBlock.thinking,\n partial: output,\n });\n }\n currentBlock = null;\n }\n // Generate unique ID if not provided or if it's a duplicate\n const providedId = part.functionCall.id;\n const needsNewId = !providedId || output.content.some((b) => b.type === \"toolCall\" && b.id === providedId);\n const toolCallId = needsNewId\n ? `${part.functionCall.name}_${Date.now()}_${++toolCallCounter}`\n : providedId;\n const toolCall = {\n type: \"toolCall\",\n id: toolCallId,\n name: part.functionCall.name || \"\",\n arguments: part.functionCall.args ?? {},\n ...(part.thoughtSignature && { thoughtSignature: part.thoughtSignature }),\n };\n output.content.push(toolCall);\n stream.push({ type: \"toolcall_start\", contentIndex: blockIndex(), partial: output });\n stream.push({\n type: \"toolcall_delta\",\n contentIndex: blockIndex(),\n delta: JSON.stringify(toolCall.arguments),\n partial: output,\n });\n stream.push({ type: \"toolcall_end\", contentIndex: blockIndex(), toolCall, partial: output });\n }\n }\n }\n if (candidate?.finishReason) {\n output.rawStopReason = candidate.finishReason;\n output.stopReason = mapStopReason(candidate.finishReason);\n if (output.content.some((b) => b.type === \"toolCall\") && output.stopReason === \"stop\") {\n output.stopReason = \"toolUse\";\n }\n }\n if (chunk.usageMetadata) {\n output.usage = {\n input: (chunk.usageMetadata.promptTokenCount || 0) - (chunk.usageMetadata.cachedContentTokenCount || 0),\n output: (chunk.usageMetadata.candidatesTokenCount || 0) + (chunk.usageMetadata.thoughtsTokenCount || 0),\n cacheRead: chunk.usageMetadata.cachedContentTokenCount || 0,\n cacheWrite: 0,\n reasoning: chunk.usageMetadata.thoughtsTokenCount || 0,\n totalTokens: chunk.usageMetadata.totalTokenCount || 0,\n cost: {\n input: 0,\n output: 0,\n cacheRead: 0,\n cacheWrite: 0,\n total: 0,\n },\n };\n calculateCost(model, output.usage);\n }\n }\n if (currentBlock) {\n if (currentBlock.type === \"text\") {\n stream.push({\n type: \"text_end\",\n contentIndex: blockIndex(),\n content: currentBlock.text,\n partial: output,\n });\n }\n else {\n stream.push({\n type: \"thinking_end\",\n contentIndex: blockIndex(),\n content: currentBlock.thinking,\n partial: output,\n });\n }\n }\n if (options?.signal?.aborted) {\n throw new Error(\"Request was aborted\");\n }\n if (output.stopReason === \"pending\") {\n throw new Error(\"Google stream ended without a finish reason\");\n }\n if (output.stopReason === \"aborted\" || output.stopReason === \"error\") {\n const errorMessage = output.rawStopReason\n ? `Provider stopped with: ${output.rawStopReason}`\n : \"An unknown error occurred\";\n throw new Error(errorMessage);\n }\n stream.push({ type: \"done\", reason: output.stopReason, message: output });\n stream.end();\n }\n catch (error) {\n // Remove internal index property used during streaming\n for (const block of output.content) {\n if (\"index\" in block) {\n delete block.index;\n }\n }\n output.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n output.errorMessage = formatProviderError(normalizeProviderError(error));\n stream.push({ type: \"error\", reason: output.stopReason, error: output });\n stream.end();\n }\n })();\n return stream;\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 if (!options?.reasoning) {\n return stream(model, context, { ...base, thinking: { enabled: false } });\n }\n const clampedReasoning = clampThinkingLevel(model, options.reasoning);\n if (clampedReasoning === \"off\") {\n return stream(model, context, { ...base, thinking: { enabled: false } });\n }\n const resolvedLevel = resolveGoogleThinkingLevel(model, clampedReasoning);\n if (usesGoogleThinkingLevel(model)) {\n return stream(model, context, {\n ...base,\n thinking: {\n enabled: true,\n level: toGoogleThinkingLevel(resolvedLevel),\n },\n });\n }\n return stream(model, context, {\n ...base,\n thinking: {\n enabled: true,\n budgetTokens: getGoogleBudget(model, resolvedLevel, options.thinkingBudgets),\n },\n });\n};\nfunction createClient(model, apiKey, optionsHeaders) {\n const httpOptions = {};\n if (model.baseUrl) {\n httpOptions.baseUrl = model.baseUrl;\n httpOptions.apiVersion = \"\"; // baseUrl already includes version path, don't append\n }\n const headers = providerHeadersToRecord({ \"User-Agent\": getPiUserAgent(), ...model.headers, ...optionsHeaders });\n if (headers) {\n httpOptions.headers = headers;\n }\n return new GoogleGenAI({\n apiKey,\n httpOptions: Object.keys(httpOptions).length > 0 ? httpOptions : undefined,\n });\n}\nfunction buildParams(model, context, options = {}) {\n const contents = convertMessages(model, context);\n const initialSystemMessage = getInitialSystemMessage(context.messages);\n const currentTools = getCurrentTools(context.messages);\n const generationConfig = {};\n if (options.temperature !== undefined) {\n generationConfig.temperature = options.temperature;\n }\n if (options.maxTokens !== undefined) {\n generationConfig.maxOutputTokens = options.maxTokens;\n }\n const supportsStrictMode = supportsGoogleStrictToolSampling(model.id);\n const functionCallingMode = currentTools.length > 0\n ? resolveGoogleFunctionCallingMode(currentTools, options.toolChoice, supportsStrictMode)\n : undefined;\n const systemInstruction = initialSystemMessage ? getSystemMessageText(initialSystemMessage) : \"\";\n const config = {\n ...(Object.keys(generationConfig).length > 0 && generationConfig),\n ...(systemInstruction && { systemInstruction: sanitizeSurrogates(systemInstruction) }),\n ...(currentTools.length > 0 && {\n tools: convertTools(currentTools, false, supportsStrictMode),\n }),\n ...(functionCallingMode !== undefined && {\n toolConfig: { functionCallingConfig: { mode: functionCallingMode } },\n }),\n };\n if (options.thinking?.enabled && model.reasoning) {\n const thinkingConfig = { includeThoughts: true };\n if (options.thinking.level !== undefined) {\n thinkingConfig.thinkingLevel = toGoogleSdkThinkingLevel(options.thinking.level);\n }\n else if (options.thinking.budgetTokens !== undefined) {\n thinkingConfig.thinkingBudget = options.thinking.budgetTokens;\n }\n config.thinkingConfig = thinkingConfig;\n }\n else if (model.reasoning && options.thinking && !options.thinking.enabled) {\n config.thinkingConfig = getDisabledGoogleThinkingConfig(model);\n }\n if (options.signal) {\n if (options.signal.aborted) {\n throw new Error(\"Request aborted\");\n }\n config.abortSignal = options.signal;\n }\n const params = {\n model: model.id,\n contents,\n config,\n };\n return params;\n}\nfunction getGoogleBudget(model, level, customBudgets) {\n if (customBudgets?.[level] !== undefined) {\n return customBudgets[level];\n }\n if (model.id.includes(\"2.5-pro\")) {\n const budgets = {\n minimal: 128,\n low: 2048,\n medium: 8192,\n high: 32768,\n };\n return budgets[level];\n }\n if (model.id.includes(\"2.5-flash-lite\")) {\n const budgets = {\n minimal: 512,\n low: 2048,\n medium: 8192,\n high: 24576,\n };\n return budgets[level];\n }\n if (model.id.includes(\"2.5-flash\")) {\n const budgets = {\n minimal: 128,\n low: 2048,\n medium: 8192,\n high: 24576,\n };\n return budgets[level];\n }\n return -1;\n}\n//# sourceMappingURL=google-generative-ai.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAYA,IAAI,kBAAkB;AACtB,MAAa,UAAU,OAAO,SAAS,YAAY;CAC/C,MAAM,SAAS,IAAI,4BAA4B;CAC/C,MAAM,oBAAoB,uBAAuB,OAAO;CACxD,CAAC,YAAY;EACT,MAAM,SAAS;GACX,MAAM;GACN,S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