@code-yeongyu/senpi-ai 2026.9.3 → 2026.9.4-2
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/api/anthropic-messages.d.ts +1 -1
- package/dist/api/anthropic-messages.d.ts.map +1 -1
- package/dist/api/anthropic-messages.js +130 -15
- package/dist/api/anthropic-messages.js.map +1 -1
- package/dist/api/context-room.d.ts +20 -0
- package/dist/api/context-room.d.ts.map +1 -0
- package/dist/api/context-room.js +40 -0
- package/dist/api/context-room.js.map +1 -0
- package/dist/api/mistral-conversations.js +1 -1
- package/dist/api/mistral-conversations.js.map +1 -1
- package/dist/api/openai-completions.d.ts.map +1 -1
- package/dist/api/openai-completions.js +16 -1
- package/dist/api/openai-completions.js.map +1 -1
- package/dist/api/openai-responses.d.ts.map +1 -1
- package/dist/api/openai-responses.js +2 -1
- package/dist/api/openai-responses.js.map +1 -1
- package/dist/api/pi-messages.d.ts +2 -0
- package/dist/api/pi-messages.d.ts.map +1 -1
- package/dist/api/pi-messages.js +6 -0
- package/dist/api/pi-messages.js.map +1 -1
- package/dist/api/simple-options.d.ts +1 -3
- package/dist/api/simple-options.d.ts.map +1 -1
- package/dist/api/simple-options.js +2 -16
- package/dist/api/simple-options.js.map +1 -1
- package/dist/api/warm-prompt-cache.js +1 -1
- package/dist/api/warm-prompt-cache.js.map +1 -1
- package/dist/auth/pool/slots.d.ts +16 -3
- package/dist/auth/pool/slots.d.ts.map +1 -1
- package/dist/auth/pool/slots.js +40 -6
- package/dist/auth/pool/slots.js.map +1 -1
- package/dist/compat/extension-oauth-types.d.ts +8 -0
- package/dist/compat/extension-oauth-types.d.ts.map +1 -1
- package/dist/compat/extension-oauth-types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +3 -2
- package/dist/models.js.map +1 -1
- package/dist/openai-responses-compat.d.ts +2 -0
- package/dist/openai-responses-compat.d.ts.map +1 -1
- package/dist/openai-responses-compat.js.map +1 -1
- package/dist/providers/data/.manifest.json +1 -1
- package/dist/providers/data/anthropic.json +1 -1
- package/dist/providers/data/azure-openai-responses.json +1 -1
- package/dist/providers/data/baseten.json +1 -1
- package/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/dist/providers/data/fireworks.json +1 -1
- package/dist/providers/data/github-copilot.json +1 -1
- package/dist/providers/data/huggingface.json +1 -1
- package/dist/providers/data/nvidia.json +1 -1
- package/dist/providers/data/openai-codex.json +1 -1
- package/dist/providers/data/openai.json +1 -1
- package/dist/providers/data/opencode-go.json +1 -1
- package/dist/providers/data/openrouter.json +1 -1
- package/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.d.ts.map +1 -1
- package/dist/providers/openrouter.js +8 -1
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/types.d.ts +14 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/drop-failed-assistant-turns.d.ts +23 -0
- package/dist/utils/drop-failed-assistant-turns.d.ts.map +1 -0
- package/dist/utils/drop-failed-assistant-turns.js +58 -0
- package/dist/utils/drop-failed-assistant-turns.js.map +1 -0
- package/dist/utils/node-http-proxy.d.ts.map +1 -1
- package/dist/utils/node-http-proxy.js +53 -12
- package/dist/utils/node-http-proxy.js.map +1 -1
- package/dist/utils/overflow.d.ts.map +1 -1
- package/dist/utils/overflow.js +2 -0
- package/dist/utils/overflow.js.map +1 -1
- package/dist/utils/prompt-cache-ttl.d.ts +4 -2
- package/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
- package/dist/utils/prompt-cache-ttl.js +3 -0
- package/dist/utils/prompt-cache-ttl.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-options.js","sourceRoot":"","sources":["../../src/api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,cAAc,CAAC,CAAC;IAC7C,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,EAAE,SAAS,EAAE,aAAa,IAAI,cAAc,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC;IAC1E,CAAC;IACD,IAAI,cAAc,GAAG,sBAAsB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAClE,MAAM,SAAS,GACd,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,GAAG,cAAc,EAAE,cAAc,CAAC,CAAC;IAEzG,IAAI,SAAS,IAAI,cAAc,EAAE,CAAC;QACjC,cAAc,GAAG,+BAA+B,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import type {\n\tApi,\n\tContext,\n\tModel,\n\tSimpleStreamOptions,\n\tStreamOptions,\n\tThinkingBudgets,\n\tThinkingLevel,\n} from \"../types.ts\";\nimport { estimateContextTokens } from \"../utils/estimate.ts\";\n\n/**\n * Merge user-supplied extraBody fields into a provider request payload, skipping\n * any key the provider manages itself (model id, messages, stream flag, etc.).\n * Mutates `target` in place for zero-copy integration into per-provider builders.\n */\nexport function applyExtraBody(\n\ttarget: object,\n\textraBody: Record<string, unknown> | undefined,\n\treservedKeys: ReadonlySet<string>,\n): void {\n\tif (!extraBody) return;\n\tfor (const [key, value] of Object.entries(extraBody)) {\n\t\tif (reservedKeys.has(key)) continue;\n\t\tReflect.set(target, key, value);\n\t}\n}\n\nexport const OPENAI_COMPLETIONS_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"model\",\n\t\"messages\",\n\t\"stream\",\n\t\"stream_options\",\n\t\"tools\",\n\t\"tool_choice\",\n\t\"store\",\n\t\"temperature\",\n\t\"max_tokens\",\n\t\"max_completion_tokens\",\n\t\"reasoning_effort\",\n\t\"reasoning\",\n\t\"thinking\",\n\t\"enable_thinking\",\n\t\"chat_template_kwargs\",\n\t\"tool_stream\",\n\t\"provider\",\n\t\"providerOptions\",\n]);\n\nexport const OPENAI_RESPONSES_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"model\",\n\t\"input\",\n\t\"instructions\",\n\t\"stream\",\n\t\"tools\",\n\t\"tool_choice\",\n\t\"parallel_tool_calls\",\n\t\"reasoning\",\n\t\"max_output_tokens\",\n\t\"temperature\",\n\t\"text\",\n\t\"store\",\n\t\"include\",\n\t\"prompt_cache_key\",\n\t\"prompt_cache_retention\",\n\t\"service_tier\",\n]);\n\n/**\n * Reserved keys for the inner Google `config` object (which is serialized as the\n * request body's generationConfig/tools/systemInstruction by the @google/genai SDK).\n * extraBody is merged into `config`, not the top-level GenerateContentParameters.\n */\nexport const GOOGLE_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"systemInstruction\",\n\t\"tools\",\n\t\"toolConfig\",\n\t\"temperature\",\n\t\"maxOutputTokens\",\n\t\"thinkingConfig\",\n\t\"responseMimeType\",\n\t\"responseSchema\",\n\t\"cachedContent\",\n\t\"abortSignal\",\n\t\"httpOptions\",\n]);\n\nexport const ANTHROPIC_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"model\",\n\t\"messages\",\n\t\"system\",\n\t\"stream\",\n\t\"tools\",\n\t\"tool_choice\",\n\t\"temperature\",\n\t\"max_tokens\",\n\t\"thinking\",\n\t\"output_config\",\n\t\"metadata\",\n]);\n\nexport const MISTRAL_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"model\",\n\t\"messages\",\n\t\"stream\",\n\t\"tools\",\n\t\"toolChoice\",\n\t\"temperature\",\n\t\"maxTokens\",\n\t\"promptMode\",\n]);\n\nexport const BEDROCK_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"modelId\",\n\t\"messages\",\n\t\"system\",\n\t\"toolConfig\",\n\t\"additionalModelRequestFields\",\n\t\"inferenceConfig\",\n\t\"requestMetadata\",\n]);\n\nconst CONTEXT_SAFETY_TOKENS = 4096;\nconst MIN_MAX_TOKENS = 1;\n\nexport function clampMaxTokensToContext(model: Model<Api>, context: Context, maxTokens: number): number {\n\tif (model.contextWindow <= 0) {\n\t\treturn Number.isFinite(maxTokens) && maxTokens > 0\n\t\t\t? Math.max(MIN_MAX_TOKENS, Math.floor(maxTokens))\n\t\t\t: MIN_MAX_TOKENS;\n\t}\n\tconst available = model.contextWindow - estimateContextTokens(context).tokens - CONTEXT_SAFETY_TOKENS;\n\tconst safeAvailable = Math.max(MIN_MAX_TOKENS, available);\n\tconst requested = Number.isFinite(maxTokens) && maxTokens > 0 ? Math.floor(maxTokens) : safeAvailable;\n\treturn Math.min(requested, safeAvailable);\n}\n\nexport function buildBaseOptions(\n\tmodel: Model<Api>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n\tapiKey?: string,\n): StreamOptions {\n\tconst samplingParams =\n\t\tmodel.samplingParams || options?.samplingParams\n\t\t\t? { ...model.samplingParams, ...options?.samplingParams }\n\t\t\t: undefined;\n\treturn {\n\t\ttemperature: options?.temperature,\n\t\tsamplingParams,\n\t\tmaxTokens: clampMaxTokensToContext(model, context, options?.maxTokens ?? model.maxTokens),\n\t\tsignal: options?.signal,\n\t\tabortServerSideFallback: options?.abortServerSideFallback,\n\t\ttelemetryContext: options?.telemetryContext,\n\t\tapiKey: apiKey || options?.apiKey,\n\t\tfetch: options?.fetch,\n\t\ttransport: options?.transport,\n\t\tcacheRetention: options?.cacheRetention ?? model.cacheRetention,\n\t\tsessionId: options?.sessionId,\n\t\theaders: options?.headers,\n\t\textraBody: options?.extraBody,\n\t\tonPayload: options?.onPayload,\n\t\tonResponse: options?.onResponse,\n\t\ttimeoutMs: options?.timeoutMs,\n\t\twebsocketConnectTimeoutMs: options?.websocketConnectTimeoutMs,\n\t\tmaxRetries: options?.maxRetries,\n\t\tmaxRetryDelayMs: options?.maxRetryDelayMs,\n\t\tmetadata: options?.metadata,\n\t\tenv: options?.env,\n\t};\n}\n\n/** Tokens always left for the answer when a thinking budget shares the response ceiling. */\nexport const MIN_ANSWER_TOKENS = 1024;\n\nexport const DEFAULT_THINKING_BUDGETS: ThinkingBudgets = {\n\tminimal: 1024,\n\tlow: 2048,\n\tmedium: 8192,\n\thigh: 16384,\n};\n\nexport function clampReasoning(effort: ThinkingLevel | undefined): Exclude<ThinkingLevel, \"xhigh\" | \"max\"> | undefined {\n\tif (effort === \"xhigh\" || effort === \"max\") return \"high\";\n\treturn effort;\n}\n\n/**\n * Clamp \"max\" to an OpenAI-compatible effort. OpenAI-style reasoning APIs accept\n * low|medium|high|xhigh but not \"max\". Callers that know the model supports xhigh\n * should pass through xhigh; \"max\" downgrades to \"xhigh\" on xhigh-capable models\n * and to \"high\" otherwise.\n */\nexport function clampMaxForOpenAI(\n\teffort: ThinkingLevel | undefined,\n\txhighSupported: boolean,\n): Exclude<ThinkingLevel, \"max\"> | undefined {\n\tif (effort === \"max\") return xhighSupported ? \"xhigh\" : \"high\";\n\treturn effort;\n}\n\nexport function thinkingBudgetForLevel(reasoningLevel: ThinkingLevel, customBudgets?: ThinkingBudgets): number {\n\tconst budgets = { ...DEFAULT_THINKING_BUDGETS, ...customBudgets };\n\tconst level = clampReasoning(reasoningLevel)!;\n\treturn budgets[level]!;\n}\n\n/** Cap a thinking budget so at least MIN_ANSWER_TOKENS remain under a shared response ceiling. */\nexport function clampThinkingBudgetToAnswerRoom(thinkingBudget: number, ceiling: number): number {\n\treturn Math.min(thinkingBudget, Math.max(0, ceiling - MIN_ANSWER_TOKENS));\n}\n\nexport function adjustMaxTokensForThinking(\n\t// Undefined means no explicit caller cap. Use the model cap and fit thinking inside it.\n\tbaseMaxTokens: number | undefined,\n\tmodelMaxTokens: number,\n\treasoningLevel: ThinkingLevel,\n\tcustomBudgets?: ThinkingBudgets,\n): { maxTokens: number; thinkingBudget: number } {\n\t// Fork: an absent/unresolvable level means \"no thinking\", not a NaN budget.\n\tconst level = clampReasoning(reasoningLevel);\n\tif (!level) {\n\t\treturn { maxTokens: baseMaxTokens ?? modelMaxTokens, thinkingBudget: 0 };\n\t}\n\tlet thinkingBudget = thinkingBudgetForLevel(level, customBudgets);\n\tconst maxTokens =\n\t\tbaseMaxTokens === undefined ? modelMaxTokens : Math.min(baseMaxTokens + thinkingBudget, modelMaxTokens);\n\n\tif (maxTokens <= thinkingBudget) {\n\t\tthinkingBudget = clampThinkingBudgetToAnswerRoom(thinkingBudget, maxTokens);\n\t}\n\n\treturn { maxTokens, thinkingBudget };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"simple-options.js","sourceRoot":"","sources":["../../src/api/simple-options.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EACN,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,iBAAiB,GACjB,MAAM,mBAAmB,CAAC;AAE3B;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC7B,MAAc,EACd,SAA8C,EAC9C,YAAiC;IAEjC,IAAI,CAAC,SAAS;QAAE,OAAO;IACvB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACtD,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QACpC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,qCAAqC,GAAwB,IAAI,GAAG,CAAC;IACjF,OAAO;IACP,UAAU;IACV,QAAQ;IACR,gBAAgB;IAChB,OAAO;IACP,aAAa;IACb,OAAO;IACP,aAAa;IACb,YAAY;IACZ,uBAAuB;IACvB,kBAAkB;IAClB,WAAW;IACX,UAAU;IACV,iBAAiB;IACjB,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AC,CAAC;IAEzG,IAAI,SAAS,IAAI,cAAc,EAAE,CAAC;QACjC,cAAc,GAAG,+BAA+B,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import type {\n\tApi,\n\tContext,\n\tModel,\n\tSimpleStreamOptions,\n\tStreamOptions,\n\tThinkingBudgets,\n\tThinkingLevel,\n} from \"../types.ts\";\nimport { clampMaxTokensToContext, MIN_ANSWER_TOKENS } from \"./context-room.ts\";\n\nexport {\n\tCONTEXT_GUARD_MIN_WINDOW,\n\tCONTEXT_SAFETY_TOKENS,\n\tContextWindowExhaustedError,\n\tclampMaxTokensToContext,\n\tMIN_ANSWER_TOKENS,\n} from \"./context-room.ts\";\n\n/**\n * Merge user-supplied extraBody fields into a provider request payload, skipping\n * any key the provider manages itself (model id, messages, stream flag, etc.).\n * Mutates `target` in place for zero-copy integration into per-provider builders.\n */\nexport function applyExtraBody(\n\ttarget: object,\n\textraBody: Record<string, unknown> | undefined,\n\treservedKeys: ReadonlySet<string>,\n): void {\n\tif (!extraBody) return;\n\tfor (const [key, value] of Object.entries(extraBody)) {\n\t\tif (reservedKeys.has(key)) continue;\n\t\tReflect.set(target, key, value);\n\t}\n}\n\nexport const OPENAI_COMPLETIONS_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"model\",\n\t\"messages\",\n\t\"stream\",\n\t\"stream_options\",\n\t\"tools\",\n\t\"tool_choice\",\n\t\"store\",\n\t\"temperature\",\n\t\"max_tokens\",\n\t\"max_completion_tokens\",\n\t\"reasoning_effort\",\n\t\"reasoning\",\n\t\"thinking\",\n\t\"enable_thinking\",\n\t\"chat_template_kwargs\",\n\t\"tool_stream\",\n\t\"provider\",\n\t\"providerOptions\",\n]);\n\nexport const OPENAI_RESPONSES_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"model\",\n\t\"input\",\n\t\"instructions\",\n\t\"stream\",\n\t\"tools\",\n\t\"tool_choice\",\n\t\"parallel_tool_calls\",\n\t\"reasoning\",\n\t\"max_output_tokens\",\n\t\"temperature\",\n\t\"text\",\n\t\"store\",\n\t\"include\",\n\t\"prompt_cache_key\",\n\t\"prompt_cache_retention\",\n\t\"service_tier\",\n]);\n\n/**\n * Reserved keys for the inner Google `config` object (which is serialized as the\n * request body's generationConfig/tools/systemInstruction by the @google/genai SDK).\n * extraBody is merged into `config`, not the top-level GenerateContentParameters.\n */\nexport const GOOGLE_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"systemInstruction\",\n\t\"tools\",\n\t\"toolConfig\",\n\t\"temperature\",\n\t\"maxOutputTokens\",\n\t\"thinkingConfig\",\n\t\"responseMimeType\",\n\t\"responseSchema\",\n\t\"cachedContent\",\n\t\"abortSignal\",\n\t\"httpOptions\",\n]);\n\nexport const ANTHROPIC_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"model\",\n\t\"messages\",\n\t\"system\",\n\t\"stream\",\n\t\"tools\",\n\t\"tool_choice\",\n\t\"temperature\",\n\t\"max_tokens\",\n\t\"thinking\",\n\t\"output_config\",\n\t\"metadata\",\n]);\n\nexport const MISTRAL_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"model\",\n\t\"messages\",\n\t\"stream\",\n\t\"tools\",\n\t\"toolChoice\",\n\t\"temperature\",\n\t\"maxTokens\",\n\t\"promptMode\",\n]);\n\nexport const BEDROCK_RESERVED_BODY_KEYS: ReadonlySet<string> = new Set([\n\t\"modelId\",\n\t\"messages\",\n\t\"system\",\n\t\"toolConfig\",\n\t\"additionalModelRequestFields\",\n\t\"inferenceConfig\",\n\t\"requestMetadata\",\n]);\n\nexport function buildBaseOptions(\n\tmodel: Model<Api>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n\tapiKey?: string,\n): StreamOptions {\n\tconst samplingParams =\n\t\tmodel.samplingParams || options?.samplingParams\n\t\t\t? { ...model.samplingParams, ...options?.samplingParams }\n\t\t\t: undefined;\n\treturn {\n\t\ttemperature: options?.temperature,\n\t\tsamplingParams,\n\t\tmaxTokens: clampMaxTokensToContext(model, context, options?.maxTokens ?? model.maxTokens),\n\t\tsignal: options?.signal,\n\t\tabortServerSideFallback: options?.abortServerSideFallback,\n\t\ttelemetryContext: options?.telemetryContext,\n\t\tapiKey: apiKey || options?.apiKey,\n\t\tfetch: options?.fetch,\n\t\ttransport: options?.transport,\n\t\tcacheRetention: options?.cacheRetention ?? model.cacheRetention,\n\t\tsessionId: options?.sessionId,\n\t\theaders: options?.headers,\n\t\textraBody: options?.extraBody,\n\t\tonPayload: options?.onPayload,\n\t\tonResponse: options?.onResponse,\n\t\ttimeoutMs: options?.timeoutMs,\n\t\twebsocketConnectTimeoutMs: options?.websocketConnectTimeoutMs,\n\t\tmaxRetries: options?.maxRetries,\n\t\tmaxRetryDelayMs: options?.maxRetryDelayMs,\n\t\tmetadata: options?.metadata,\n\t\tenv: options?.env,\n\t};\n}\n\nexport const DEFAULT_THINKING_BUDGETS: ThinkingBudgets = {\n\tminimal: 1024,\n\tlow: 2048,\n\tmedium: 8192,\n\thigh: 16384,\n};\n\nexport function clampReasoning(effort: ThinkingLevel | undefined): Exclude<ThinkingLevel, \"xhigh\" | \"max\"> | undefined {\n\tif (effort === \"xhigh\" || effort === \"max\") return \"high\";\n\treturn effort;\n}\n\n/**\n * Clamp \"max\" to an OpenAI-compatible effort. OpenAI-style reasoning APIs accept\n * low|medium|high|xhigh but not \"max\". Callers that know the model supports xhigh\n * should pass through xhigh; \"max\" downgrades to \"xhigh\" on xhigh-capable models\n * and to \"high\" otherwise.\n */\nexport function clampMaxForOpenAI(\n\teffort: ThinkingLevel | undefined,\n\txhighSupported: boolean,\n): Exclude<ThinkingLevel, \"max\"> | undefined {\n\tif (effort === \"max\") return xhighSupported ? \"xhigh\" : \"high\";\n\treturn effort;\n}\n\nexport function thinkingBudgetForLevel(reasoningLevel: ThinkingLevel, customBudgets?: ThinkingBudgets): number {\n\tconst budgets = { ...DEFAULT_THINKING_BUDGETS, ...customBudgets };\n\tconst level = clampReasoning(reasoningLevel)!;\n\treturn budgets[level]!;\n}\n\n/** Cap a thinking budget so at least MIN_ANSWER_TOKENS remain under a shared response ceiling. */\nexport function clampThinkingBudgetToAnswerRoom(thinkingBudget: number, ceiling: number): number {\n\treturn Math.min(thinkingBudget, Math.max(0, ceiling - MIN_ANSWER_TOKENS));\n}\n\nexport function adjustMaxTokensForThinking(\n\t// Undefined means no explicit caller cap. Use the model cap and fit thinking inside it.\n\tbaseMaxTokens: number | undefined,\n\tmodelMaxTokens: number,\n\treasoningLevel: ThinkingLevel,\n\tcustomBudgets?: ThinkingBudgets,\n): { maxTokens: number; thinkingBudget: number } {\n\t// Fork: an absent/unresolvable level means \"no thinking\", not a NaN budget.\n\tconst level = clampReasoning(reasoningLevel);\n\tif (!level) {\n\t\treturn { maxTokens: baseMaxTokens ?? modelMaxTokens, thinkingBudget: 0 };\n\t}\n\tlet thinkingBudget = thinkingBudgetForLevel(level, customBudgets);\n\tconst maxTokens =\n\t\tbaseMaxTokens === undefined ? modelMaxTokens : Math.min(baseMaxTokens + thinkingBudget, modelMaxTokens);\n\n\tif (maxTokens <= thinkingBudget) {\n\t\tthinkingBudget = clampThinkingBudgetToAnswerRoom(thinkingBudget, maxTokens);\n\t}\n\n\treturn { maxTokens, thinkingBudget };\n}\n"]}
|
|
@@ -32,7 +32,7 @@ export async function warmPromptCache(model, context, options = {}) {
|
|
|
32
32
|
delete sanitized.output_config;
|
|
33
33
|
delete sanitized.tool_choice;
|
|
34
34
|
sanitized.max_tokens = 0;
|
|
35
|
-
const response = await client.messages.create(sanitized, {
|
|
35
|
+
const response = await client.beta.messages.create(sanitized, {
|
|
36
36
|
maxRetries: 0,
|
|
37
37
|
...(options.signal ? { signal: options.signal } : {}),
|
|
38
38
|
...(options.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),
|
|
@@ -1 +1 @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KAC1E,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC;IAChC,OAAO;QACN,SAAS,EAAE,IAAI;QACf,KAAK,EAAE;YACN,KAAK,EAAE,QAAQ,CAAC,YAAY;YAC5B,MAAM,EAAE,QAAQ,CAAC,aAAa;YAC9B,SAAS,EAAE,QAAQ,CAAC,uBAAuB,IAAI,CAAC;YAChD,UAAU,EAAE,QAAQ,CAAC,2BAA2B,IAAI,CAAC;SACrD;QACD,QAAQ;KACR,CAAC;AACH,CAAC","sourcesContent":["import type { Context, Model, ProviderHeaders, StreamOptions } from \"../types.ts\";\nimport { providerHeadersToRecord } from \"../utils/headers.ts\";\nimport { isAnthropicApiBaseUrl } from \"../utils/prompt-cache-ttl.ts\";\nimport type { AnthropicOptions } from \"./anthropic-messages.ts\";\n\nexport interface WarmPromptCacheUsage {\n\treadonly input: number;\n\treadonly output: number;\n\treadonly cacheRead: number;\n\treadonly cacheWrite: number;\n}\n\nexport type WarmPromptCacheResult =\n\t| { readonly supported: false }\n\t| { readonly supported: true; readonly usage: WarmPromptCacheUsage; readonly usageRaw: unknown };\n\nexport type WarmPromptCacheOptions = Pick<\n\tStreamOptions,\n\t\"apiKey\" | \"cacheRetention\" | \"env\" | \"fetch\" | \"headers\" | \"onPayload\" | \"sessionId\" | \"signal\" | \"timeoutMs\"\n>;\n\nexport async function warmPromptCache(\n\tmodel: Model<any>,\n\tcontext: Context,\n\toptions: WarmPromptCacheOptions = {},\n): Promise<WarmPromptCacheResult> {\n\tif (model.api !== \"anthropic-messages\" || !isAnthropicApiBaseUrl(model.baseUrl)) {\n\t\treturn { supported: false };\n\t}\n\n\tconst anthropicModel = model as Model<\"anthropic-messages\">;\n\t// Loaded lazily: a static import would pull the Anthropic SDK into the root\n\t// barrel and break the lazy provider-loading contract (lazy-module-load.test.ts).\n\tconst [{ default: Anthropic }, { buildAnthropicWarmPromptCacheParams }] = await Promise.all([\n\t\timport(\"@anthropic-ai/sdk\"),\n\t\timport(\"./anthropic-messages.ts\"),\n\t]);\n\tconst headers = providerHeadersToRecord(options.headers);\n\tconst client = new Anthropic({\n\t\tapiKey: options.apiKey ?? null,\n\t\tbaseURL: anthropicModel.baseUrl,\n\t\tdangerouslyAllowBrowser: true,\n\t\tfetch: options.fetch,\n\t\tdefaultHeaders: { ...anthropicModel.headers, ...headers },\n\t});\n\tlet params = buildAnthropicWarmPromptCacheParams(anthropicModel, context, options as AnthropicOptions);\n\tconst transformed = await options.onPayload?.(params, anthropicModel, {\n\t\tmodel: anthropicModel,\n\t\theaders: headers as ProviderHeaders,\n\t});\n\tif (transformed !== undefined) params = transformed as typeof params;\n\tconst sanitized = { ...params } as Record<string, unknown>;\n\tdelete sanitized.stream;\n\tdelete sanitized.thinking;\n\tdelete sanitized.output_config;\n\tdelete sanitized.tool_choice;\n\tsanitized.max_tokens = 0;\n\n\tconst response = await client.beta.messages.create(sanitized as unknown as typeof params, {\n\t\tmaxRetries: 0,\n\t\t...(options.signal ? { signal: options.signal } : {}),\n\t\t...(options.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),\n\t});\n\tconst usageRaw = response.usage;\n\treturn {\n\t\tsupported: true,\n\t\tusage: {\n\t\t\tinput: usageRaw.input_tokens,\n\t\t\toutput: usageRaw.output_tokens,\n\t\t\tcacheRead: usageRaw.cache_read_input_tokens ?? 0,\n\t\t\tcacheWrite: usageRaw.cache_creation_input_tokens ?? 0,\n\t\t},\n\t\tusageRaw,\n\t};\n}\n"]}
|
|
@@ -31,6 +31,13 @@ export declare function upsertSlot(credential: PooledCredential | undefined, slo
|
|
|
31
31
|
* Removes one slot. The credential is dropped entirely once its last slot is gone,
|
|
32
32
|
* and a pin naming the removed slot is cleared so selection never points at a slot
|
|
33
33
|
* that no longer exists.
|
|
34
|
+
*
|
|
35
|
+
* When the removed slot was the one the flat top-level fields projected, those
|
|
36
|
+
* fields are re-projected from the first survivor. Without that the pool keeps
|
|
37
|
+
* authenticating with the deleted account's material: a credential with a single
|
|
38
|
+
* remaining slot does not enter the rotation path, so ordinary requests resolve
|
|
39
|
+
* the flat projection and would keep using exactly the account the user removed.
|
|
40
|
+
* `accounts` is preserved either way, so the entry stays a pool.
|
|
34
41
|
*/
|
|
35
42
|
export declare function removeSlot(credential: PooledCredential | undefined, name: string): PooledCredential | undefined;
|
|
36
43
|
export declare function pinSlot(credential: PooledCredential, name: string): PooledCredential;
|
|
@@ -41,9 +48,15 @@ export declare function pinSlot(credential: PooledCredential, name: string): Poo
|
|
|
41
48
|
*/
|
|
42
49
|
export declare function projectSlot(credential: PooledCredential | undefined, name: string): Credential | undefined;
|
|
43
50
|
/**
|
|
44
|
-
* Appends an unnamed flat credential to a pool as a generated `login-N` slot.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
51
|
+
* Appends an unnamed flat credential to a pool as a generated `login-N` slot.
|
|
52
|
+
* An absent current entry keeps today's whole-write shape; a flat current entry
|
|
53
|
+
* is promoted to a pool so the legacy credential stays reachable as `default`
|
|
54
|
+
* instead of being overwritten by the second login.
|
|
55
|
+
*
|
|
56
|
+
* A login result that already carries its own populated `accounts` array is a
|
|
57
|
+
* provider-owned pool: it IS the complete post-login credential, so it is
|
|
58
|
+
* written through untouched. Reading its top-level fields as a flat credential
|
|
59
|
+
* would append the provider's placeholder material as a second slot.
|
|
47
60
|
*/
|
|
48
61
|
export declare function appendLoginSlot(current: PooledCredential | undefined, flat: Credential): Credential;
|
|
49
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../../src/auth/pool/slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE9D,MAAM,MAAM,cAA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,UAAU,CAS7G;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,GAAG,UAAU,CAe3F"}
|
package/dist/auth/pool/slots.js
CHANGED
|
@@ -51,18 +51,43 @@ export function upsertSlot(credential, slot) {
|
|
|
51
51
|
: [...existing, slot];
|
|
52
52
|
return { ...base, accounts };
|
|
53
53
|
}
|
|
54
|
+
/** Whether the flat top-level fields are this slot's material rather than a sibling's. */
|
|
55
|
+
function slotMirrorsFlat(credential, slot) {
|
|
56
|
+
if (credential.type === "oauth")
|
|
57
|
+
return slot.access === credential.access || slot.refresh === credential.refresh;
|
|
58
|
+
return slot.key === credential.key;
|
|
59
|
+
}
|
|
60
|
+
/** Rewrites the flat top-level projection to carry the given slot's material. */
|
|
61
|
+
function projectFlatFields(credential, slot) {
|
|
62
|
+
if (credential.type === "oauth") {
|
|
63
|
+
if (slot.access === undefined || slot.refresh === undefined || slot.expires === undefined)
|
|
64
|
+
return credential;
|
|
65
|
+
return { ...credential, access: slot.access, refresh: slot.refresh, expires: slot.expires };
|
|
66
|
+
}
|
|
67
|
+
return { ...credential, key: slot.key };
|
|
68
|
+
}
|
|
54
69
|
/**
|
|
55
70
|
* Removes one slot. The credential is dropped entirely once its last slot is gone,
|
|
56
71
|
* and a pin naming the removed slot is cleared so selection never points at a slot
|
|
57
72
|
* that no longer exists.
|
|
73
|
+
*
|
|
74
|
+
* When the removed slot was the one the flat top-level fields projected, those
|
|
75
|
+
* fields are re-projected from the first survivor. Without that the pool keeps
|
|
76
|
+
* authenticating with the deleted account's material: a credential with a single
|
|
77
|
+
* remaining slot does not enter the rotation path, so ordinary requests resolve
|
|
78
|
+
* the flat projection and would keep using exactly the account the user removed.
|
|
79
|
+
* `accounts` is preserved either way, so the entry stays a pool.
|
|
58
80
|
*/
|
|
59
81
|
export function removeSlot(credential, name) {
|
|
60
82
|
if (!credential)
|
|
61
83
|
return undefined;
|
|
62
|
-
const
|
|
84
|
+
const existing = listSlots(credential);
|
|
85
|
+
const removed = existing.find((slot) => slot.name === name);
|
|
86
|
+
const accounts = existing.filter((slot) => slot.name !== name);
|
|
63
87
|
if (accounts.length === 0)
|
|
64
88
|
return undefined;
|
|
65
|
-
const
|
|
89
|
+
const reprojected = removed && slotMirrorsFlat(credential, removed) ? projectFlatFields(credential, accounts[0]) : credential;
|
|
90
|
+
const next = { ...reprojected, accounts };
|
|
66
91
|
if (next.pinned === name)
|
|
67
92
|
delete next.pinned;
|
|
68
93
|
return next;
|
|
@@ -112,12 +137,21 @@ function nextLoginSlotName(credential) {
|
|
|
112
137
|
throw new Error("Credential pool is full");
|
|
113
138
|
}
|
|
114
139
|
/**
|
|
115
|
-
* Appends an unnamed flat credential to a pool as a generated `login-N` slot.
|
|
116
|
-
*
|
|
117
|
-
*
|
|
140
|
+
* Appends an unnamed flat credential to a pool as a generated `login-N` slot.
|
|
141
|
+
* An absent current entry keeps today's whole-write shape; a flat current entry
|
|
142
|
+
* is promoted to a pool so the legacy credential stays reachable as `default`
|
|
143
|
+
* instead of being overwritten by the second login.
|
|
144
|
+
*
|
|
145
|
+
* A login result that already carries its own populated `accounts` array is a
|
|
146
|
+
* provider-owned pool: it IS the complete post-login credential, so it is
|
|
147
|
+
* written through untouched. Reading its top-level fields as a flat credential
|
|
148
|
+
* would append the provider's placeholder material as a second slot.
|
|
118
149
|
*/
|
|
119
150
|
export function appendLoginSlot(current, flat) {
|
|
120
|
-
if (
|
|
151
|
+
if ("accounts" in flat && Array.isArray(flat.accounts) && flat.accounts.length > 0) {
|
|
152
|
+
return flat;
|
|
153
|
+
}
|
|
154
|
+
if (!current) {
|
|
121
155
|
return flat;
|
|
122
156
|
}
|
|
123
157
|
return upsertSlot(current, slotFromFlatCredentialNamed(flat, nextLoginSlotName(current)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slots.js","sourceRoot":"","sources":["../../../src/auth/pool/slots.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,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T_NAME = \"default\";\n\nexport type CredentialSlotSource = \"login\" | \"import\" | \"env\";\n\nexport type CredentialSlot = {\n\tname: string;\n\tsource?: CredentialSlotSource;\n\tkey?: string;\n\taccess?: string;\n\trefresh?: string;\n\texpires?: number;\n};\n\nexport type PooledCredential = Credential & {\n\taccounts?: CredentialSlot[];\n\tpinned?: string;\n};\n\nconst SLOT_NAME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/;\n\nexport function assertValidSlotName(name: string): void {\n\tif (!SLOT_NAME_PATTERN.test(name)) {\n\t\tthrow new Error(\n\t\t\t`Invalid account name '${name}': use letters, digits, '-' or '_', starting with a letter or digit`,\n\t\t);\n\t}\n}\n\nfunction storedSlots(credential: PooledCredential): CredentialSlot[] {\n\treturn Array.isArray(credential.accounts) ? credential.accounts : [];\n}\n\nfunction slotFromFlatCredential(credential: PooledCredential): CredentialSlot {\n\tif (credential.type === \"oauth\") {\n\t\treturn {\n\t\t\tname: DEFAULT_SLOT_NAME,\n\t\t\tsource: \"login\",\n\t\t\taccess: credential.access,\n\t\t\trefresh: credential.refresh,\n\t\t\texpires: credential.expires,\n\t\t};\n\t}\n\treturn { name: DEFAULT_SLOT_NAME, source: \"login\", key: credential.key };\n}\n\n/**\n * A flat credential written by a build predating pools is read as a one-slot pool\n * without writing anything back; the caller decides whether a write ever happens.\n */\nexport function listSlots(credential: PooledCredential | undefined): CredentialSlot[] {\n\tif (!credential) return [];\n\tconst slots = storedSlots(credential);\n\treturn slots.length > 0 ? [...slots] : [slotFromFlatCredential(credential)];\n}\n\nexport function findSlot(credential: PooledCredential | undefined, name: string): CredentialSlot | undefined {\n\treturn listSlots(credential).find((slot) => slot.name === name);\n}\n\n/**\n * Replaces or appends one slot while every sibling, the pin, and the flat\n * top-level credential survive untouched. The flat fields stay as written so a\n * build that ignores `accounts` still authenticates from them.\n */\nexport function upsertSlot(credential: PooledCredential | undefined, slot: CredentialSlot): PooledCredential {\n\tassertValidSlotName(slot.name);\n\tconst base: PooledCredential =\n\t\tcredential ??\n\t\t(slot.access !== undefined || slot.refresh !== undefined\n\t\t\t? { type: \"oauth\", access: slot.access ?? \"\", refresh: slot.refresh ?? \"\", expires: slot.expires ?? 0 }\n\t\t\t: { type: \"api_key\", key: slot.key });\n\tconst existing = listSlots(base);\n\tconst index = existing.findIndex((candidate) => candidate.name === slot.name);\n\tconst accounts =\n\t\tindex >= 0\n\t\t\t? existing.map((candidate) => (candidate.name === slot.name ? { ...candidate, ...slot } : candidate))\n\t\t\t: [...existing, slot];\n\treturn { ...base, accounts };\n}\n\n/**\n * Removes one slot. The credential is dropped entirely once its last slot is gone,\n * and a pin naming the removed slot is cleared so selection never points at a slot\n * that no longer exists.\n */\nexport function removeSlot(credential: PooledCredential | undefined, name: string): PooledCredential | undefined {\n\tif (!credential) return undefined;\n\tconst accounts = listSlots(credential).filter((slot) => slot.name !== name);\n\tif (accounts.length === 0) return undefined;\n\tconst next: PooledCredential = { ...credential, accounts };\n\tif (next.pinned === name) delete next.pinned;\n\treturn next;\n}\n\nexport function pinSlot(credential: PooledCredential, name: string): PooledCredential {\n\tassertValidSlotName(name);\n\treturn { ...credential, pinned: name };\n}\n\n/**\n * Projects one named slot onto the flat credential shape for request-scoped\n * resolution; pool bookkeeping fields are stripped so provider handlers see a\n * plain credential and never write pool state back through the projection.\n */\nexport function projectSlot(credential: PooledCredential | undefined, name: string): Credential | undefined {\n\tif (!credential) return undefined;\n\tconst slot = findSlot(credential, name);\n\tif (!slot) return undefined;\n\tconst { accounts: _accounts, pinned: _pinned, ...flat } = credential;\n\tif (flat.type === \"oauth\") {\n\t\tif (slot.access === undefined || slot.refresh === undefined || slot.expires === undefined) return undefined;\n\t\treturn { ...flat, access: slot.access, refresh: slot.refresh, expires: slot.expires };\n\t}\n\treturn { ...flat, key: slot.key };\n}\n\nfunction slotFromFlatCredentialNamed(credential: Credential, name: string): CredentialSlot {\n\tif (credential.type === \"oauth\") {\n\t\treturn {\n\t\t\tname,\n\t\t\tsource: \"login\",\n\t\t\taccess: credential.access,\n\t\t\trefresh: credential.refresh,\n\t\t\texpires: credential.expires,\n\t\t};\n\t}\n\treturn { name, source: \"login\", key: credential.key };\n}\n\nfunction nextLoginSlotName(credential: PooledCredential): string {\n\tconst taken = new Set(listSlots(credential).map((slot) => slot.name));\n\tfor (let index = 2; index < 1000; index++) {\n\t\tconst candidate = `login-${index}`;\n\t\tif (!taken.has(candidate)) return candidate;\n\t}\n\tthrow new Error(\"Credential pool is full\");\n}\n\n/**\n * Appends an unnamed flat credential to a pool as a generated `login-N` slot. A\n * flat or absent current entry keeps today's whole-write shape so no existing\n * user's stored bytes change until a second credential actually exists.\n */\nexport function appendLoginSlot(current: PooledCredential | undefined, flat: Credential): Credential {\n\tif (!current || !Array.isArray(current.accounts) || current.accounts.length === 0) {\n\t\treturn flat;\n\t}\n\treturn upsertSlot(current, slotFromFlatCredentialNamed(flat, nextLoginSlotName(current)));\n}\n\n/**\n * Merges a rotated OAuth credential back into the pool: the slot whose material\n * matches the pre-refresh flat fields is updated in place together with those\n * flat fields, while every sibling and the pin survive byte-identical. A flat\n * current entry keeps today's whole-write shape.\n */\n/**\n * Merges a rotated OAuth credential into the NAMED slot. The flat top-level\n * projection rotates only when it mirrored that slot's previous material, so\n * refreshing a secondary slot never disturbs what an older binary reads.\n */\nexport function mergeRefreshedSlot(current: PooledCredential, name: string, refreshed: Credential): Credential {\n\tif (refreshed.type !== \"oauth\" || current.type !== \"oauth\") return current;\n\tif (!Array.isArray(current.accounts) || current.accounts.length === 0) return mergeRefreshed(current, refreshed);\n\tconst target = current.accounts.find((slot) => slot.name === name);\n\tif (!target) return current;\n\tconst rotated = { access: refreshed.access, refresh: refreshed.refresh, expires: refreshed.expires };\n\tconst accounts = current.accounts.map((slot) => (slot === target ? { ...slot, ...rotated } : slot));\n\tconst mirrorsFlat = target.access === current.access || target.refresh === current.refresh;\n\treturn mirrorsFlat ? { ...current, ...rotated, accounts } : { ...current, accounts };\n}\n\nexport function mergeRefreshed(current: PooledCredential, refreshed: Credential): Credential {\n\tif (!Array.isArray(current.accounts) || current.accounts.length === 0) {\n\t\treturn refreshed;\n\t}\n\tif (refreshed.type !== \"oauth\" || current.type !== \"oauth\") return refreshed;\n\tconst target = current.accounts.find((slot) => slot.access === current.access || slot.refresh === current.refresh);\n\tconst rotated = {\n\t\taccess: refreshed.access,\n\t\trefresh: refreshed.refresh,\n\t\texpires: refreshed.expires,\n\t};\n\tconst accounts = target\n\t\t? current.accounts.map((slot) => (slot === target ? { ...slot, ...rotated } : slot))\n\t\t: current.accounts;\n\treturn { ...current, ...rotated, accounts };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"slots.js","sourceRoot":"","sources":["../../../src/auth/pool/slots.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAkB3C,MAAM,iBAAiB,GAAG,kCAAkC,CAAC;AAE7D,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC/C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACd,yBAAyB,IAAI,qEAAqE,CAClG,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAS,WAAW,CAAC,UAA4B;IAChD,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,sBAAsB,CAAC,UAA4B;IAC3D,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO;YACN,IAAI,EAAE,iBAAiB;YACvB,MAAM,EAAE,OAAO;YACf,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO,EAAE,UAAU,CAAC,OAAO;SAC3B,CAAC;IACH,CAAC;IACD,OAAO,EAAE,I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AC1B,OAAO,EAAE,SAAS,CAAC,OAAO;KAC1B,CAAC;IACF,MAAM,QAAQ,GAAG,MAAM;QACtB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACpF,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACpB,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC7C,CAAC","sourcesContent":["import type { Credential } from \"../types.ts\";\n\nexport type { Credential };\n\nexport const DEFAULT_SLOT_NAME = \"default\";\n\nexport type CredentialSlotSource = \"login\" | \"import\" | \"env\";\n\nexport type CredentialSlot = {\n\tname: string;\n\tsource?: CredentialSlotSource;\n\tkey?: string;\n\taccess?: string;\n\trefresh?: string;\n\texpires?: number;\n};\n\nexport type PooledCredential = Credential & {\n\taccounts?: CredentialSlot[];\n\tpinned?: string;\n};\n\nconst SLOT_NAME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/;\n\nexport function assertValidSlotName(name: string): void {\n\tif (!SLOT_NAME_PATTERN.test(name)) {\n\t\tthrow new Error(\n\t\t\t`Invalid account name '${name}': use letters, digits, '-' or '_', starting with a letter or digit`,\n\t\t);\n\t}\n}\n\nfunction storedSlots(credential: PooledCredential): CredentialSlot[] {\n\treturn Array.isArray(credential.accounts) ? credential.accounts : [];\n}\n\nfunction slotFromFlatCredential(credential: PooledCredential): CredentialSlot {\n\tif (credential.type === \"oauth\") {\n\t\treturn {\n\t\t\tname: DEFAULT_SLOT_NAME,\n\t\t\tsource: \"login\",\n\t\t\taccess: credential.access,\n\t\t\trefresh: credential.refresh,\n\t\t\texpires: credential.expires,\n\t\t};\n\t}\n\treturn { name: DEFAULT_SLOT_NAME, source: \"login\", key: credential.key };\n}\n\n/**\n * A flat credential written by a build predating pools is read as a one-slot pool\n * without writing anything back; the caller decides whether a write ever happens.\n */\nexport function listSlots(credential: PooledCredential | undefined): CredentialSlot[] {\n\tif (!credential) return [];\n\tconst slots = storedSlots(credential);\n\treturn slots.length > 0 ? [...slots] : [slotFromFlatCredential(credential)];\n}\n\nexport function findSlot(credential: PooledCredential | undefined, name: string): CredentialSlot | undefined {\n\treturn listSlots(credential).find((slot) => slot.name === name);\n}\n\n/**\n * Replaces or appends one slot while every sibling, the pin, and the flat\n * top-level credential survive untouched. The flat fields stay as written so a\n * build that ignores `accounts` still authenticates from them.\n */\nexport function upsertSlot(credential: PooledCredential | undefined, slot: CredentialSlot): PooledCredential {\n\tassertValidSlotName(slot.name);\n\tconst base: PooledCredential =\n\t\tcredential ??\n\t\t(slot.access !== undefined || slot.refresh !== undefined\n\t\t\t? { type: \"oauth\", access: slot.access ?? \"\", refresh: slot.refresh ?? \"\", expires: slot.expires ?? 0 }\n\t\t\t: { type: \"api_key\", key: slot.key });\n\tconst existing = listSlots(base);\n\tconst index = existing.findIndex((candidate) => candidate.name === slot.name);\n\tconst accounts =\n\t\tindex >= 0\n\t\t\t? existing.map((candidate) => (candidate.name === slot.name ? { ...candidate, ...slot } : candidate))\n\t\t\t: [...existing, slot];\n\treturn { ...base, accounts };\n}\n\n/** Whether the flat top-level fields are this slot's material rather than a sibling's. */\nfunction slotMirrorsFlat(credential: PooledCredential, slot: CredentialSlot): boolean {\n\tif (credential.type === \"oauth\") return slot.access === credential.access || slot.refresh === credential.refresh;\n\treturn slot.key === credential.key;\n}\n\n/** Rewrites the flat top-level projection to carry the given slot's material. */\nfunction projectFlatFields(credential: PooledCredential, slot: CredentialSlot): PooledCredential {\n\tif (credential.type === \"oauth\") {\n\t\tif (slot.access === undefined || slot.refresh === undefined || slot.expires === undefined) return credential;\n\t\treturn { ...credential, access: slot.access, refresh: slot.refresh, expires: slot.expires };\n\t}\n\treturn { ...credential, key: slot.key };\n}\n\n/**\n * Removes one slot. The credential is dropped entirely once its last slot is gone,\n * and a pin naming the removed slot is cleared so selection never points at a slot\n * that no longer exists.\n *\n * When the removed slot was the one the flat top-level fields projected, those\n * fields are re-projected from the first survivor. Without that the pool keeps\n * authenticating with the deleted account's material: a credential with a single\n * remaining slot does not enter the rotation path, so ordinary requests resolve\n * the flat projection and would keep using exactly the account the user removed.\n * `accounts` is preserved either way, so the entry stays a pool.\n */\nexport function removeSlot(credential: PooledCredential | undefined, name: string): PooledCredential | undefined {\n\tif (!credential) return undefined;\n\tconst existing = listSlots(credential);\n\tconst removed = existing.find((slot) => slot.name === name);\n\tconst accounts = existing.filter((slot) => slot.name !== name);\n\tif (accounts.length === 0) return undefined;\n\tconst reprojected =\n\t\tremoved && slotMirrorsFlat(credential, removed) ? projectFlatFields(credential, accounts[0]) : credential;\n\tconst next: PooledCredential = { ...reprojected, accounts };\n\tif (next.pinned === name) delete next.pinned;\n\treturn next;\n}\n\nexport function pinSlot(credential: PooledCredential, name: string): PooledCredential {\n\tassertValidSlotName(name);\n\treturn { ...credential, pinned: name };\n}\n\n/**\n * Projects one named slot onto the flat credential shape for request-scoped\n * resolution; pool bookkeeping fields are stripped so provider handlers see a\n * plain credential and never write pool state back through the projection.\n */\nexport function projectSlot(credential: PooledCredential | undefined, name: string): Credential | undefined {\n\tif (!credential) return undefined;\n\tconst slot = findSlot(credential, name);\n\tif (!slot) return undefined;\n\tconst { accounts: _accounts, pinned: _pinned, ...flat } = credential;\n\tif (flat.type === \"oauth\") {\n\t\tif (slot.access === undefined || slot.refresh === undefined || slot.expires === undefined) return undefined;\n\t\treturn { ...flat, access: slot.access, refresh: slot.refresh, expires: slot.expires };\n\t}\n\treturn { ...flat, key: slot.key };\n}\n\nfunction slotFromFlatCredentialNamed(credential: Credential, name: string): CredentialSlot {\n\tif (credential.type === \"oauth\") {\n\t\treturn {\n\t\t\tname,\n\t\t\tsource: \"login\",\n\t\t\taccess: credential.access,\n\t\t\trefresh: credential.refresh,\n\t\t\texpires: credential.expires,\n\t\t};\n\t}\n\treturn { name, source: \"login\", key: credential.key };\n}\n\nfunction nextLoginSlotName(credential: PooledCredential): string {\n\tconst taken = new Set(listSlots(credential).map((slot) => slot.name));\n\tfor (let index = 2; index < 1000; index++) {\n\t\tconst candidate = `login-${index}`;\n\t\tif (!taken.has(candidate)) return candidate;\n\t}\n\tthrow new Error(\"Credential pool is full\");\n}\n\n/**\n * Appends an unnamed flat credential to a pool as a generated `login-N` slot.\n * An absent current entry keeps today's whole-write shape; a flat current entry\n * is promoted to a pool so the legacy credential stays reachable as `default`\n * instead of being overwritten by the second login.\n *\n * A login result that already carries its own populated `accounts` array is a\n * provider-owned pool: it IS the complete post-login credential, so it is\n * written through untouched. Reading its top-level fields as a flat credential\n * would append the provider's placeholder material as a second slot.\n */\nexport function appendLoginSlot(current: PooledCredential | undefined, flat: Credential): Credential {\n\tif (\"accounts\" in flat && Array.isArray(flat.accounts) && flat.accounts.length > 0) {\n\t\treturn flat;\n\t}\n\tif (!current) {\n\t\treturn flat;\n\t}\n\treturn upsertSlot(current, slotFromFlatCredentialNamed(flat, nextLoginSlotName(current)));\n}\n\n/**\n * Merges a rotated OAuth credential back into the pool: the slot whose material\n * matches the pre-refresh flat fields is updated in place together with those\n * flat fields, while every sibling and the pin survive byte-identical. A flat\n * current entry keeps today's whole-write shape.\n */\n/**\n * Merges a rotated OAuth credential into the NAMED slot. The flat top-level\n * projection rotates only when it mirrored that slot's previous material, so\n * refreshing a secondary slot never disturbs what an older binary reads.\n */\nexport function mergeRefreshedSlot(current: PooledCredential, name: string, refreshed: Credential): Credential {\n\tif (refreshed.type !== \"oauth\" || current.type !== \"oauth\") return current;\n\tif (!Array.isArray(current.accounts) || current.accounts.length === 0) return mergeRefreshed(current, refreshed);\n\tconst target = current.accounts.find((slot) => slot.name === name);\n\tif (!target) return current;\n\tconst rotated = { access: refreshed.access, refresh: refreshed.refresh, expires: refreshed.expires };\n\tconst accounts = current.accounts.map((slot) => (slot === target ? { ...slot, ...rotated } : slot));\n\tconst mirrorsFlat = target.access === current.access || target.refresh === current.refresh;\n\treturn mirrorsFlat ? { ...current, ...rotated, accounts } : { ...current, accounts };\n}\n\nexport function mergeRefreshed(current: PooledCredential, refreshed: Credential): Credential {\n\tif (!Array.isArray(current.accounts) || current.accounts.length === 0) {\n\t\treturn refreshed;\n\t}\n\tif (refreshed.type !== \"oauth\" || current.type !== \"oauth\") return refreshed;\n\tconst target = current.accounts.find((slot) => slot.access === current.access || slot.refresh === current.refresh);\n\tconst rotated = {\n\t\taccess: refreshed.access,\n\t\trefresh: refreshed.refresh,\n\t\texpires: refreshed.expires,\n\t};\n\tconst accounts = target\n\t\t? current.accounts.map((slot) => (slot === target ? { ...slot, ...rotated } : slot))\n\t\t: current.accounts;\n\treturn { ...current, ...rotated, accounts };\n}\n"]}
|
|
@@ -6,6 +6,12 @@ export interface OAuthPrompt {
|
|
|
6
6
|
message: string;
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
allowEmpty?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Per-prompt cancellation, forwarded from `AuthPrompt.signal`: a provider
|
|
11
|
+
* aborts it when an out-of-band step resolves the flow, e.g. a manual-code
|
|
12
|
+
* prompt raced against a local callback server.
|
|
13
|
+
*/
|
|
14
|
+
signal?: AbortSignal;
|
|
9
15
|
}
|
|
10
16
|
/** Legacy extension OAuth authorization link. */
|
|
11
17
|
export interface OAuthAuthInfo {
|
|
@@ -27,6 +33,8 @@ export interface OAuthSelectOption {
|
|
|
27
33
|
export interface OAuthSelectPrompt {
|
|
28
34
|
message: string;
|
|
29
35
|
options: readonly OAuthSelectOption[];
|
|
36
|
+
/** Per-prompt cancellation, forwarded from `AuthPrompt.signal`. */
|
|
37
|
+
signal?: AbortSignal;
|
|
30
38
|
}
|
|
31
39
|
/** Callback surface retained only for coding-agent extension compatibility. */
|
|
32
40
|
export interface OAuthLoginCallbacks {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-oauth-types.d.ts","sourceRoot":"","sources":["../../src/compat/extension-oauth-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,mEAAmE;AACnE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,qCAAqC;AACrC,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,iDAAiD;AACjD,MAAM,WAAW,aAAa;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"extension-oauth-types.d.ts","sourceRoot":"","sources":["../../src/compat/extension-oauth-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,mEAAmE;AACnE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,qCAAqC;AACrC,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;O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],"names":[],"mappings":"","sourcesContent":["import type { OAuthCredentials } from \"../auth/types.ts\";\n\n/** Legacy provider identifier accepted by extension OAuth APIs. */\nexport type OAuthProviderId = string;\n\n/** Legacy extension OAuth prompt. */\nexport interface OAuthPrompt {\n\tmessage: string;\n\tplaceholder?: string;\n\tallowEmpty?: boolean;\n}\n\n/** Legacy extension OAuth authorization link. */\nexport interface OAuthAuthInfo {\n\turl: string;\n\tinstructions?: string;\n}\n\n/** Legacy extension OAuth device-code notification. */\nexport interface OAuthDeviceCodeInfo {\n\tuserCode: string;\n\tverificationUri: string;\n\tintervalSeconds?: number;\n\texpiresInSeconds?: number;\n}\n\nexport interface OAuthSelectOption {\n\tid: string;\n\tlabel: string;\n\tdescription?: string;\n}\n\nexport interface OAuthSelectPrompt {\n\tmessage: string;\n\toptions: readonly OAuthSelectOption[];\n}\n\n/** Callback surface retained only for coding-agent extension compatibility. */\nexport interface OAuthLoginCallbacks {\n\tonAuth(info: OAuthAuthInfo): void;\n\tonDeviceCode(info: OAuthDeviceCodeInfo): void;\n\tonPrompt(prompt: OAuthPrompt): Promise<string>;\n\tonProgress?(message: string): void;\n\tonManualCodeInput?(): Promise<string>;\n\tonSelect(prompt: OAuthSelectPrompt): Promise<string | undefined>;\n\tsignal?: AbortSignal;\n}\n\nexport type { OAuthCredentials };\n"]}
|
|
1
|
+
{"version":3,"file":"extension-oauth-types.js","sourceRoot":"","sources":["../../src/compat/extension-oauth-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { OAuthCredentials } from \"../auth/types.ts\";\n\n/** Legacy provider identifier accepted by extension OAuth APIs. */\nexport type OAuthProviderId = string;\n\n/** Legacy extension OAuth prompt. */\nexport interface OAuthPrompt {\n\tmessage: string;\n\tplaceholder?: string;\n\tallowEmpty?: boolean;\n\t/**\n\t * Per-prompt cancellation, forwarded from `AuthPrompt.signal`: a provider\n\t * aborts it when an out-of-band step resolves the flow, e.g. a manual-code\n\t * prompt raced against a local callback server.\n\t */\n\tsignal?: AbortSignal;\n}\n\n/** Legacy extension OAuth authorization link. */\nexport interface OAuthAuthInfo {\n\turl: string;\n\tinstructions?: string;\n}\n\n/** Legacy extension OAuth device-code notification. */\nexport interface OAuthDeviceCodeInfo {\n\tuserCode: string;\n\tverificationUri: string;\n\tintervalSeconds?: number;\n\texpiresInSeconds?: number;\n}\n\nexport interface OAuthSelectOption {\n\tid: string;\n\tlabel: string;\n\tdescription?: string;\n}\n\nexport interface OAuthSelectPrompt {\n\tmessage: string;\n\toptions: readonly OAuthSelectOption[];\n\t/** Per-prompt cancellation, forwarded from `AuthPrompt.signal`. */\n\tsignal?: AbortSignal;\n}\n\n/** Callback surface retained only for coding-agent extension compatibility. */\nexport interface OAuthLoginCallbacks {\n\tonAuth(info: OAuthAuthInfo): void;\n\tonDeviceCode(info: OAuthDeviceCodeInfo): void;\n\tonPrompt(prompt: OAuthPrompt): Promise<string>;\n\tonProgress?(message: string): void;\n\tonManualCodeInput?(): Promise<string>;\n\tonSelect(prompt: OAuthSelectPrompt): Promise<string | undefined>;\n\tsignal?: AbortSignal;\n}\n\nexport type { OAuthCredentials };\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export { wrapStreamWithInvokeRecovery } from "./tool-call-middleware/recovery-st
|
|
|
41
41
|
export * from "./types.ts";
|
|
42
42
|
export { type CursorExecResolvedCarrier, copyCursorExecResolved, isCursorExecResolved, kCursorExecResolved, } from "./utils/block-symbols.ts";
|
|
43
43
|
export * from "./utils/diagnostics.ts";
|
|
44
|
+
export { dropFailedAssistantTurns } from "./utils/drop-failed-assistant-turns.ts";
|
|
44
45
|
export { estimateContextTokens } from "./utils/estimate.ts";
|
|
45
46
|
export * from "./utils/event-stream.ts";
|
|
46
47
|
export * from "./utils/json-parse.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAA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BAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,0BAA0B,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACN,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,4BAA4B,GAC5B,MAAM,6BAA6B,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export { wrapStreamWithInvokeRecovery } from "./tool-call-middleware/recovery-st
|
|
|
27
27
|
export * from "./types.js";
|
|
28
28
|
export { copyCursorExecResolved, isCursorExecResolved, kCursorExecResolved, } from "./utils/block-symbols.js";
|
|
29
29
|
export * from "./utils/diagnostics.js";
|
|
30
|
+
export { dropFailedAssistantTurns } from "./utils/drop-failed-assistant-turns.js";
|
|
30
31
|
export { estimateContextTokens } from "./utils/estimate.js";
|
|
31
32
|
export * from "./utils/event-stream.js";
|
|
32
33
|
export * from "./utils/json-parse.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","s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BAAgB,EAChB,2BAA2B,EAC3B,gCAAgC,GAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,8BAA8B,EAAE,MAAM,+DAA+D,CAAC;AAC/G,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,cAAc,YAAY,CAAC;AAC3B,OAAO,EAEN,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,0BAA0B,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACN,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,4BAA4B,GAC5B,MAAM,6BAA6B,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export type { Static, TSchema } from \"typebox\";\nexport { Type } from \"typebox\";\n// Core only, side-effect free: no generated catalogs, no provider factories,\n// no api-registry, no OAuth implementations, no compat. Provider factories\n// live under \"@earendil-works/pi-ai/providers/*\", API implementations under\n// \"@earendil-works/pi-ai/api/*\", the old global API under\n// \"@earendil-works/pi-ai/compat\".\nexport type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from \"./api/anthropic-messages.ts\";\nexport { sanitizeAnthropicToolPairs } from \"./api/anthropic-tool-pairs.ts\";\nexport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nexport type { BedrockOptions, BedrockThinkingDisplay } from \"./api/bedrock-converse-stream.ts\";\nexport { measureCursorHistorySerializedBytes } from \"./api/cursor-agent/measure.ts\";\nexport {\n\tcomposeShellCommand as composeCursorShellCommand,\n\tomitUndefinedArgs as omitUndefinedCursorArgs,\n\tpiLimit as cursorPiLimit,\n\tpiLsPath as cursorPiLsPath,\n\tpiReadArgs as cursorPiReadArgs,\n\tpiTimeout as cursorPiTimeout,\n} from \"./api/cursor-agent/pi-args.ts\";\nexport type {\n\tCursorAgentOptions,\n\tCursorExecHandlerResult,\n\tCursorExecHandlers,\n\tCursorExecPairing,\n\tCursorMcpCall,\n\tCursorPiCall,\n\tCursorShellStreamCallbacks,\n\tCursorToolResultHandler,\n} from \"./api/cursor-agent/types.ts\";\nexport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nexport type { GoogleApiThinkingLevel, ResolvedGoogleThinkingLevel } from \"./api/google-shared.ts\";\nexport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nexport * from \"./api/lazy.ts\";\nexport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nexport type { OpenAICodexResponsesOptions, OpenAICodexWebSocketDebugStats } from \"./api/openai-codex-responses.ts\";\nexport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nexport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nexport { convertResponsesMessages } from \"./api/openai-responses-shared.ts\";\nexport type { PiMessagesEvent, PiMessagesOptions, PiMessagesRewriteImpact } from \"./api/pi-messages.ts\";\nexport {\n\ttype WarmPromptCacheOptions,\n\ttype WarmPromptCacheResult,\n\ttype WarmPromptCacheUsage,\n\twarmPromptCache,\n} from \"./api/warm-prompt-cache.ts\";\nexport { getApiProvider } from \"./api-registry.ts\";\nexport * from \"./auth/context.ts\";\nexport * from \"./auth/credential-store.ts\";\nexport * from \"./auth/headers.ts\";\nexport * from \"./auth/helpers.ts\";\nexport * from \"./auth/types.ts\";\nexport type {\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthProviderId,\n\tOAuthSelectOption,\n\tOAuthSelectPrompt,\n} from \"./compat/extension-oauth-types.ts\";\nexport {\n\tCONTEXT_PROVENANCE_FIELD,\n\ttype ContextProvenance,\n\tcontextProvenanceFingerprint,\n\tcopyContextProvenance,\n\tgetContextProvenance,\n} from \"./context-provenance.ts\";\nexport * from \"./cursor/catalog-grouping.ts\";\nexport {\n\tCURSOR_MODEL_CAPABILITIES,\n\ttype CursorCapabilityEvidence,\n\ttype CursorLevelEncoding,\n\ttype CursorLevelSpec,\n\ttype CursorModelCapability,\n\ttype CursorParameterId,\n\ttype CursorVariantAlias,\n\ttype CursorVariantParse,\n\tgetCursorBaseIdForVariant,\n\tgetCursorCapabilityForBase,\n\tgetCursorVariantAlias,\n} from \"./cursor/model-capabilities.ts\";\nexport {\n\ttype CursorResolvedSelection,\n\trenderCursorCliModelString,\n\tresolveCursorSelectionDescriptor,\n} from \"./cursor/selection-descriptor.ts\";\nexport * from \"./env-api-keys.ts\";\nexport * from \"./images-models.ts\";\nexport * from \"./models.ts\";\nexport * from \"./models-store.ts\";\nexport * from \"./providers/faux.ts\";\nexport * from \"./session-resources.ts\";\nexport {\n\tgetProtocol,\n\tgetToolCallFormat,\n\thasKimiTextToolCallRecovery,\n\tshouldRecoverTextToolCalls,\n\ttransformContext,\n\twrapStreamWithModelRecovery,\n\twrapStreamWithToolCallMiddleware,\n} from \"./tool-call-middleware/index.ts\";\nexport { createXtmlRecoveryStreamParser } from \"./tool-call-middleware/protocols/kimi-xtml/recovery-stream.ts\";\nexport { wrapStreamWithInvokeRecovery } from \"./tool-call-middleware/recovery-stream-wrapper.ts\";\nexport * from \"./types.ts\";\nexport {\n\ttype CursorExecResolvedCarrier,\n\tcopyCursorExecResolved,\n\tisCursorExecResolved,\n\tkCursorExecResolved,\n} from \"./utils/block-symbols.ts\";\nexport * from \"./utils/diagnostics.ts\";\nexport { estimateContextTokens } from \"./utils/estimate.ts\";\nexport * from \"./utils/event-stream.ts\";\nexport * from \"./utils/json-parse.ts\";\nexport { extractOpenAiCodexAccountId } from \"./utils/openai-codex-auth.ts\";\nexport * from \"./utils/overflow.ts\";\nexport {\n\tisAnthropicApiBaseUrl,\n\tPROMPT_CACHE_TTL_LONG_SECONDS,\n\tPROMPT_CACHE_TTL_SHORT_SECONDS,\n\tresolvePromptCacheTtlSeconds,\n} from \"./utils/prompt-cache-ttl.ts\";\nexport * from \"./utils/retry.ts\";\nexport * from \"./utils/server-fallback-receipt.ts\";\nexport * from \"./utils/stop-details.ts\";\nexport { contentText } from \"./utils/text.ts\";\nexport * from \"./utils/tool-pair-repair.ts\";\nexport * from \"./utils/typebox-helpers.ts\";\nexport { uuidv7 } from \"./utils/uuid.ts\";\nexport * from \"./utils/validation.ts\";\nexport * from \"./utils/visible-text.ts\";\nexport { getWireIdentity, setWireIdentity } from \"./wire-identity.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAO/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAG3E,OAAO,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EACN,mBAAmB,IAAI,yBAAyB,EAChD,iBAAiB,IAAI,uBAAuB,EAC5C,OAAO,IAAI,aAAa,EACxB,QAAQ,IAAI,cAAc,EAC1B,UAAU,IAAI,gBAAgB,EAC9B,SAAS,IAAI,eAAe,GAC5B,MAAM,+BAA+B,CAAC;AAcvC,cAAc,eAAe,CAAC;AAK9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAIN,eAAe,GACf,MAA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A8B,CAAC;AAC3E,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACN,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,4BAA4B,GAC5B,MAAM,6BAA6B,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export type { Static, TSchema } from \"typebox\";\nexport { Type } from \"typebox\";\n// Core only, side-effect free: no generated catalogs, no provider factories,\n// no api-registry, no OAuth implementations, no compat. Provider factories\n// live under \"@earendil-works/pi-ai/providers/*\", API implementations under\n// \"@earendil-works/pi-ai/api/*\", the old global API under\n// \"@earendil-works/pi-ai/compat\".\nexport type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from \"./api/anthropic-messages.ts\";\nexport { sanitizeAnthropicToolPairs } from \"./api/anthropic-tool-pairs.ts\";\nexport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nexport type { BedrockOptions, BedrockThinkingDisplay } from \"./api/bedrock-converse-stream.ts\";\nexport { measureCursorHistorySerializedBytes } from \"./api/cursor-agent/measure.ts\";\nexport {\n\tcomposeShellCommand as composeCursorShellCommand,\n\tomitUndefinedArgs as omitUndefinedCursorArgs,\n\tpiLimit as cursorPiLimit,\n\tpiLsPath as cursorPiLsPath,\n\tpiReadArgs as cursorPiReadArgs,\n\tpiTimeout as cursorPiTimeout,\n} from \"./api/cursor-agent/pi-args.ts\";\nexport type {\n\tCursorAgentOptions,\n\tCursorExecHandlerResult,\n\tCursorExecHandlers,\n\tCursorExecPairing,\n\tCursorMcpCall,\n\tCursorPiCall,\n\tCursorShellStreamCallbacks,\n\tCursorToolResultHandler,\n} from \"./api/cursor-agent/types.ts\";\nexport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nexport type { GoogleApiThinkingLevel, ResolvedGoogleThinkingLevel } from \"./api/google-shared.ts\";\nexport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nexport * from \"./api/lazy.ts\";\nexport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nexport type { OpenAICodexResponsesOptions, OpenAICodexWebSocketDebugStats } from \"./api/openai-codex-responses.ts\";\nexport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nexport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nexport { convertResponsesMessages } from \"./api/openai-responses-shared.ts\";\nexport type { PiMessagesEvent, PiMessagesOptions, PiMessagesRewriteImpact } from \"./api/pi-messages.ts\";\nexport {\n\ttype WarmPromptCacheOptions,\n\ttype WarmPromptCacheResult,\n\ttype WarmPromptCacheUsage,\n\twarmPromptCache,\n} from \"./api/warm-prompt-cache.ts\";\nexport { getApiProvider } from \"./api-registry.ts\";\nexport * from \"./auth/context.ts\";\nexport * from \"./auth/credential-store.ts\";\nexport * from \"./auth/headers.ts\";\nexport * from \"./auth/helpers.ts\";\nexport * from \"./auth/types.ts\";\nexport type {\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthProviderId,\n\tOAuthSelectOption,\n\tOAuthSelectPrompt,\n} from \"./compat/extension-oauth-types.ts\";\nexport {\n\tCONTEXT_PROVENANCE_FIELD,\n\ttype ContextProvenance,\n\tcontextProvenanceFingerprint,\n\tcopyContextProvenance,\n\tgetContextProvenance,\n} from \"./context-provenance.ts\";\nexport * from \"./cursor/catalog-grouping.ts\";\nexport {\n\tCURSOR_MODEL_CAPABILITIES,\n\ttype CursorCapabilityEvidence,\n\ttype CursorLevelEncoding,\n\ttype CursorLevelSpec,\n\ttype CursorModelCapability,\n\ttype CursorParameterId,\n\ttype CursorVariantAlias,\n\ttype CursorVariantParse,\n\tgetCursorBaseIdForVariant,\n\tgetCursorCapabilityForBase,\n\tgetCursorVariantAlias,\n} from \"./cursor/model-capabilities.ts\";\nexport {\n\ttype CursorResolvedSelection,\n\trenderCursorCliModelString,\n\tresolveCursorSelectionDescriptor,\n} from \"./cursor/selection-descriptor.ts\";\nexport * from \"./env-api-keys.ts\";\nexport * from \"./images-models.ts\";\nexport * from \"./models.ts\";\nexport * from \"./models-store.ts\";\nexport * from \"./providers/faux.ts\";\nexport * from \"./session-resources.ts\";\nexport {\n\tgetProtocol,\n\tgetToolCallFormat,\n\thasKimiTextToolCallRecovery,\n\tshouldRecoverTextToolCalls,\n\ttransformContext,\n\twrapStreamWithModelRecovery,\n\twrapStreamWithToolCallMiddleware,\n} from \"./tool-call-middleware/index.ts\";\nexport { createXtmlRecoveryStreamParser } from \"./tool-call-middleware/protocols/kimi-xtml/recovery-stream.ts\";\nexport { wrapStreamWithInvokeRecovery } from \"./tool-call-middleware/recovery-stream-wrapper.ts\";\nexport * from \"./types.ts\";\nexport {\n\ttype CursorExecResolvedCarrier,\n\tcopyCursorExecResolved,\n\tisCursorExecResolved,\n\tkCursorExecResolved,\n} from \"./utils/block-symbols.ts\";\nexport * from \"./utils/diagnostics.ts\";\nexport { dropFailedAssistantTurns } from \"./utils/drop-failed-assistant-turns.ts\";\nexport { estimateContextTokens } from \"./utils/estimate.ts\";\nexport * from \"./utils/event-stream.ts\";\nexport * from \"./utils/json-parse.ts\";\nexport { extractOpenAiCodexAccountId } from \"./utils/openai-codex-auth.ts\";\nexport * from \"./utils/overflow.ts\";\nexport {\n\tisAnthropicApiBaseUrl,\n\tPROMPT_CACHE_TTL_LONG_SECONDS,\n\tPROMPT_CACHE_TTL_SHORT_SECONDS,\n\tresolvePromptCacheTtlSeconds,\n} from \"./utils/prompt-cache-ttl.ts\";\nexport * from \"./utils/retry.ts\";\nexport * from \"./utils/server-fallback-receipt.ts\";\nexport * from \"./utils/stop-details.ts\";\nexport { contentText } from \"./utils/text.ts\";\nexport * from \"./utils/tool-pair-repair.ts\";\nexport * from \"./utils/typebox-helpers.ts\";\nexport { uuidv7 } from \"./utils/uuid.ts\";\nexport * from \"./utils/validation.ts\";\nexport * from \"./utils/visible-text.ts\";\nexport { getWireIdentity, setWireIdentity } from \"./wire-identity.ts\";\n"]}
|
package/dist/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,uBAAuB,EAAoC,MAAM,mBAAmB,CAAC;AACnG,OAAO,KAAK,EACX,SAAS,EACT,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACR,UAAU,EACV,eAAe,EACf,YAAY,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAuB,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,KAAK,EACX,GAAG,EACH,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC3B,OAAO,EACP,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,KAAK,EAEL,kBAAkB,EAClB,eAAe,EAEf,eAAe,EACf,mBAAmB,EACnB,KAAK,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MAAM,WAAW,iBAAiB;IACjC,6FAA6F;IAC7F,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IAC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aAAa,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAM3E;AAyCD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAMzE;AAgCD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAS,GAAG,EAC9C,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,EACjC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,CAGT"}
|
package/dist/models.js
CHANGED
|
@@ -644,6 +644,7 @@ const XHIGH_MODEL_IDS = [
|
|
|
644
644
|
"gpt-5.6-luna",
|
|
645
645
|
"gpt-5.6-sol",
|
|
646
646
|
"gpt-5.6-terra",
|
|
647
|
+
"gpt-6-astra",
|
|
647
648
|
"deepseek-v4-pro",
|
|
648
649
|
"deepseek-v4-flash",
|
|
649
650
|
"opus-4-6",
|
|
@@ -694,7 +695,7 @@ const OPENAI_MAX_APIS = [
|
|
|
694
695
|
"openai-completions",
|
|
695
696
|
];
|
|
696
697
|
/** Model family that accepts native `max` effort on OpenAI-compatible APIs. */
|
|
697
|
-
const
|
|
698
|
+
const OPENAI_MAX_MODEL_IDS = ["gpt-5.6-sol", "gpt-6-astra"];
|
|
698
699
|
const MAX_MODEL_IDS = [
|
|
699
700
|
"opus-4-6",
|
|
700
701
|
"opus-4.6",
|
|
@@ -709,7 +710,7 @@ const MAX_MODEL_IDS = [
|
|
|
709
710
|
function supportsMaxModel(model) {
|
|
710
711
|
if (!model.reasoning)
|
|
711
712
|
return false;
|
|
712
|
-
if (OPENAI_MAX_APIS.includes(model.api) && matchesModelFamily(model.id,
|
|
713
|
+
if (OPENAI_MAX_APIS.includes(model.api) && OPENAI_MAX_MODEL_IDS.some((id) => matchesModelFamily(model.id, id)))
|
|
713
714
|
return true;
|
|
714
715
|
return MAX_MODEL_IDS.some((id) => matchesModelFamily(model.id, id));
|
|
715
716
|
}
|