@maxmo74/pi-coding-agent 1.6.0-max.16 → 1.7.0-max.17
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/CHANGELOG.md +106 -0
- package/LICENSE +1 -1
- package/dist/bundle/chunks/anthropic-messages-VOAE66ME.js +3 -0
- package/dist/bundle/chunks/azure-openai-responses-FWQRNMCY.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +6 -6
- package/dist/bundle/chunks/chunk-2BKJ4UF2.js +6 -0
- package/dist/bundle/chunks/{chunk-YOWSKVK7.js → chunk-2HV66XRA.js} +1 -1
- package/dist/bundle/chunks/chunk-7TLS4DNZ.js +30 -0
- package/dist/bundle/chunks/{chunk-E6LJTZYC.js → chunk-AIIDHDL2.js} +1 -1
- package/dist/bundle/chunks/chunk-ARDROFM7.js +20 -0
- package/dist/bundle/chunks/{chunk-36QC74V4.js → chunk-D5E4JUBX.js} +1 -1
- package/dist/bundle/chunks/{chunk-EVSO24NP.js → chunk-D5U74ZAG.js} +1 -1
- package/dist/bundle/chunks/{chunk-ILDLA2JW.js → chunk-E3GEPN3H.js} +1 -1
- package/dist/bundle/chunks/{chunk-XGGZYFNG.js → chunk-G5K7SYL7.js} +2 -2
- package/dist/bundle/chunks/chunk-GBB3EUD7.js +16 -0
- package/dist/bundle/chunks/chunk-GMDZZCKH.js +2 -0
- package/dist/bundle/chunks/{chunk-NRY4NBZW.js → chunk-HFTJRRFR.js} +2 -2
- package/dist/bundle/chunks/{chunk-NRLRGOCX.js → chunk-IOF7AZCL.js} +1 -1
- package/dist/bundle/chunks/chunk-J35HXFD7.js +2 -0
- package/dist/bundle/chunks/{chunk-KREOSXD7.js → chunk-KPWXWGGJ.js} +1 -1
- package/dist/bundle/chunks/chunk-MDJ5LWZA.js +44 -0
- package/dist/bundle/chunks/{chunk-I6HYYNH6.js → chunk-O5MXS5TI.js} +1 -1
- package/dist/bundle/chunks/chunk-OVXT2WQH.js +2 -0
- package/dist/bundle/chunks/{chunk-EXXWEFU5.js → chunk-PADKDPJN.js} +99 -104
- package/dist/bundle/chunks/chunk-PST3NXKM.js +2 -0
- package/dist/bundle/chunks/chunk-S2GRKWHT.js +14 -0
- package/dist/bundle/chunks/{chunk-X26YOAEH.js → chunk-V7D5E4XS.js} +13 -12
- package/dist/bundle/chunks/chunk-Z2XZSUHM.js +2 -0
- package/dist/bundle/chunks/{cli-QMJEURSM.js → cli-OH5BEVHD.js} +1 -1
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-Z73UPEZ7.js +2 -0
- package/dist/bundle/chunks/{easter-egg-3d-7CBVPJQ3.js → easter-egg-3d-BOWYTYMI.js} +1 -1
- package/dist/bundle/chunks/{execute-XDNPBEMU.js → execute-UXTJZEKY.js} +3 -3
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-VI7CGXA2.js +2 -0
- package/dist/bundle/chunks/google-vertex-UGCMSJWH.js +2 -0
- package/dist/bundle/chunks/{llama-cpp-classify-XXZYF3RR.js → llama-cpp-classify-SKDW7RUG.js} +2 -2
- package/dist/bundle/chunks/mistral-conversations-F2GKIAZI.js +4 -0
- package/dist/bundle/chunks/openai-codex-responses-B54DADY4.js +2 -0
- package/dist/bundle/chunks/openai-completions-5UNXROMA.js +7 -0
- package/dist/bundle/chunks/{openai-decisions-LZ2RLVRX.js → openai-decisions-IN2F5D4R.js} +1 -1
- package/dist/bundle/chunks/openai-responses-2567WJBU.js +4 -0
- package/dist/bundle/chunks/openrouter-images-MPCL4RTO.js +2 -0
- package/dist/bundle/chunks/pi-decision-GZ2BG2JB.js +2 -0
- package/dist/bundle/chunks/pi-image-CXEQM6AW.js +2 -0
- package/dist/bundle/chunks/pi-messages-PDCTBGXV.js +2 -0
- package/dist/bundle/chunks/{runtime-F3SXQONS.js → runtime-JESTW74H.js} +1 -1
- package/dist/bundle/chunks/typesafe-system-one-6M47QHZX.js +2 -0
- package/dist/bundle/chunks/virtual-modules-QBVXFHBM.js +2 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/agent-dir-arg.d.ts +20 -0
- package/dist/cli/agent-dir-arg.d.ts.map +1 -0
- package/dist/cli/agent-dir-arg.js +38 -0
- package/dist/cli/agent-dir-arg.js.map +1 -0
- package/dist/cli/args.d.ts +6 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +45 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +0 -5
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/project-trust.d.ts.map +1 -1
- package/dist/cli/project-trust.js +6 -6
- package/dist/cli/project-trust.js.map +1 -1
- package/dist/cli/startup-ui.d.ts +3 -2
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +17 -23
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +6 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -2
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +6 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +7 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts +3 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +24 -13
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/client-identity.d.ts +2 -3
- package/dist/core/client-identity.d.ts.map +1 -1
- package/dist/core/client-identity.js +3 -4
- package/dist/core/client-identity.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +3 -0
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +2 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +9 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/messages.d.ts +4 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +10 -2
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +36 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-resolver.js +4 -4
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +6 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/pi-ai-schemas.d.ts +4 -0
- package/dist/core/pi-ai-schemas.d.ts.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/provider-composer.d.ts +1 -0
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +1 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +2 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +4 -0
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/sdk.js +2 -2
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +10 -6
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +6 -2
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +6 -2
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager.d.ts +6 -6
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +23 -16
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +16 -3
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +23 -8
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/tools/bash.d.ts +3 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +24 -9
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +16 -4
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +47 -41
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +9 -3
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +11 -5
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +3 -0
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +36 -5
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +3 -13
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +2 -1
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +3 -3
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +1 -9
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +8 -124
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +18 -3
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +2 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +7 -4
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +13 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
- package/dist/modes/interactive/components/extension-editor.js +2 -2
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +3 -5
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +15 -45
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +13 -4
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +13 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +10 -9
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +3 -3
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -5
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +57 -46
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +3 -3
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +13 -3
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +18 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +105 -75
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/program-resume-reporter.d.ts +32 -0
- package/dist/modes/interactive/program-resume-reporter.d.ts.map +1 -0
- package/dist/modes/interactive/program-resume-reporter.js +56 -0
- package/dist/modes/interactive/program-resume-reporter.js.map +1 -0
- package/dist/modes/interactive/program-status-reporter.d.ts +2 -0
- package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -1
- package/dist/modes/interactive/program-status-reporter.js +4 -0
- package/dist/modes/interactive/program-status-reporter.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts.map +1 -1
- package/dist/modes/interactive/session-share.js +9 -1
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +1 -4
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js +13 -13
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -4
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +10 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/clipboard.js +1 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/output-files.d.ts +20 -4
- package/dist/utils/output-files.d.ts.map +1 -1
- package/dist/utils/output-files.js +37 -2
- package/dist/utils/output-files.js.map +1 -1
- package/dist/utils/shell.d.ts +2 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +56 -7
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +9 -8
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/cli.md +3 -1
- package/docs/codemode.md +16 -5
- package/docs/environment-variables.md +4 -4
- package/docs/extensions.md +14 -4
- package/docs/llama-cpp.md +3 -3
- package/docs/message-types.md +1 -0
- package/docs/models-configuration.md +14 -3
- package/docs/models.md +34 -14
- package/docs/providers.md +3 -3
- package/docs/rpc-commands.md +1 -1
- package/docs/settings.md +5 -3
- package/docs/shell-aliases.md +1 -1
- package/docs/terminal-setup.md +53 -0
- package/docs/windows.md +2 -1
- package/examples/extensions/subagent/index.ts +3 -2
- package/examples/rpc-extension-ui.ts +8 -7
- package/package.json +9 -9
- package/schemas/models.schema.json +20 -7
- package/schemas/settings.schema.json +30 -10
- package/dist/bundle/chunks/anthropic-messages-WAFIHSF7.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-EB4MRIM4.js +0 -2
- package/dist/bundle/chunks/chunk-EEBRZED2.js +0 -44
- package/dist/bundle/chunks/chunk-F7LEMV2T.js +0 -2
- package/dist/bundle/chunks/chunk-NV3NPOPF.js +0 -20
- package/dist/bundle/chunks/chunk-PMRZO46Y.js +0 -2
- package/dist/bundle/chunks/chunk-RCNEHRMW.js +0 -2
- package/dist/bundle/chunks/chunk-X6RQRO3L.js +0 -16
- package/dist/bundle/chunks/chunk-XJ2YV77J.js +0 -30
- package/dist/bundle/chunks/chunk-Y55SJART.js +0 -13
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-AMCR7QEI.js +0 -2
- package/dist/bundle/chunks/google-generative-ai-43M4N5LK.js +0 -2
- package/dist/bundle/chunks/google-vertex-2B3PASK2.js +0 -2
- package/dist/bundle/chunks/mistral-conversations-E3D5ZQKB.js +0 -5
- package/dist/bundle/chunks/openai-codex-responses-MSQDSDUR.js +0 -10
- package/dist/bundle/chunks/openai-completions-4IC6AGTR.js +0 -7
- package/dist/bundle/chunks/openai-responses-MCO3BHCC.js +0 -4
- package/dist/bundle/chunks/openrouter-images-SHUJ3VSG.js +0 -2
- package/dist/bundle/chunks/pi-messages-NIKOQ4O7.js +0 -8
- package/dist/bundle/chunks/typesafe-system-one-R2CDUWNO.js +0 -2
- package/dist/bundle/chunks/virtual-modules-2WYTGPJ3.js +0 -2
- package/dist/core/telemetry.d.ts +0 -3
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js +0 -9
- package/dist/core/telemetry.js.map +0 -1
|
@@ -34,6 +34,7 @@ declare const ModelDefinitionSchema: Type.TObject<{
|
|
|
34
34
|
output: number;
|
|
35
35
|
cacheRead: number;
|
|
36
36
|
cacheWrite: number;
|
|
37
|
+
imageOutput?: number | undefined;
|
|
37
38
|
tiers?: {
|
|
38
39
|
input: number;
|
|
39
40
|
output: number;
|
|
@@ -144,6 +145,7 @@ declare const ModelDefinitionSchema: Type.TObject<{
|
|
|
144
145
|
output: number;
|
|
145
146
|
cacheRead: number;
|
|
146
147
|
cacheWrite: number;
|
|
148
|
+
imageOutput?: number | undefined;
|
|
147
149
|
tiers?: {
|
|
148
150
|
input: number;
|
|
149
151
|
output: number;
|
|
@@ -153,6 +155,7 @@ declare const ModelDefinitionSchema: Type.TObject<{
|
|
|
153
155
|
}[] | undefined;
|
|
154
156
|
};
|
|
155
157
|
}[] | undefined;
|
|
158
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
156
159
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
157
160
|
sendImageOptInHeader?: boolean | undefined;
|
|
158
161
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -197,6 +200,7 @@ declare const ModelOverrideSchema: Type.TObject<{
|
|
|
197
200
|
output: number;
|
|
198
201
|
cacheRead: number;
|
|
199
202
|
cacheWrite: number;
|
|
203
|
+
imageOutput?: number | undefined;
|
|
200
204
|
tiers?: {
|
|
201
205
|
input: number;
|
|
202
206
|
output: number;
|
|
@@ -307,6 +311,7 @@ declare const ModelOverrideSchema: Type.TObject<{
|
|
|
307
311
|
output: number;
|
|
308
312
|
cacheRead: number;
|
|
309
313
|
cacheWrite: number;
|
|
314
|
+
imageOutput?: number | undefined;
|
|
310
315
|
tiers?: {
|
|
311
316
|
input: number;
|
|
312
317
|
output: number;
|
|
@@ -316,6 +321,7 @@ declare const ModelOverrideSchema: Type.TObject<{
|
|
|
316
321
|
}[] | undefined;
|
|
317
322
|
};
|
|
318
323
|
}[] | undefined;
|
|
324
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
319
325
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
320
326
|
sendImageOptInHeader?: boolean | undefined;
|
|
321
327
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -421,6 +427,7 @@ declare const ProviderConfigSchema: Type.TObject<{
|
|
|
421
427
|
output: number;
|
|
422
428
|
cacheRead: number;
|
|
423
429
|
cacheWrite: number;
|
|
430
|
+
imageOutput?: number | undefined;
|
|
424
431
|
tiers?: {
|
|
425
432
|
input: number;
|
|
426
433
|
output: number;
|
|
@@ -430,6 +437,7 @@ declare const ProviderConfigSchema: Type.TObject<{
|
|
|
430
437
|
}[] | undefined;
|
|
431
438
|
};
|
|
432
439
|
}[] | undefined;
|
|
440
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
433
441
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
434
442
|
sendImageOptInHeader?: boolean | undefined;
|
|
435
443
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -477,6 +485,7 @@ declare const ProviderConfigSchema: Type.TObject<{
|
|
|
477
485
|
output: number;
|
|
478
486
|
cacheRead: number;
|
|
479
487
|
cacheWrite: number;
|
|
488
|
+
imageOutput?: number | undefined;
|
|
480
489
|
tiers?: {
|
|
481
490
|
input: number;
|
|
482
491
|
output: number;
|
|
@@ -587,6 +596,7 @@ declare const ProviderConfigSchema: Type.TObject<{
|
|
|
587
596
|
output: number;
|
|
588
597
|
cacheRead: number;
|
|
589
598
|
cacheWrite: number;
|
|
599
|
+
imageOutput?: number | undefined;
|
|
590
600
|
tiers?: {
|
|
591
601
|
input: number;
|
|
592
602
|
output: number;
|
|
@@ -596,6 +606,7 @@ declare const ProviderConfigSchema: Type.TObject<{
|
|
|
596
606
|
}[] | undefined;
|
|
597
607
|
};
|
|
598
608
|
}[] | undefined;
|
|
609
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
599
610
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
600
611
|
sendImageOptInHeader?: boolean | undefined;
|
|
601
612
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -640,6 +651,7 @@ declare const ProviderConfigSchema: Type.TObject<{
|
|
|
640
651
|
output: number;
|
|
641
652
|
cacheRead: number;
|
|
642
653
|
cacheWrite: number;
|
|
654
|
+
imageOutput?: number | undefined;
|
|
643
655
|
tiers?: {
|
|
644
656
|
input: number;
|
|
645
657
|
output: number;
|
|
@@ -750,6 +762,7 @@ declare const ProviderConfigSchema: Type.TObject<{
|
|
|
750
762
|
output: number;
|
|
751
763
|
cacheRead: number;
|
|
752
764
|
cacheWrite: number;
|
|
765
|
+
imageOutput?: number | undefined;
|
|
753
766
|
tiers?: {
|
|
754
767
|
input: number;
|
|
755
768
|
output: number;
|
|
@@ -759,6 +772,7 @@ declare const ProviderConfigSchema: Type.TObject<{
|
|
|
759
772
|
}[] | undefined;
|
|
760
773
|
};
|
|
761
774
|
}[] | undefined;
|
|
775
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
762
776
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
763
777
|
sendImageOptInHeader?: boolean | undefined;
|
|
764
778
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -866,6 +880,7 @@ export declare const ModelsConfigSchema: Type.TObject<{
|
|
|
866
880
|
output: number;
|
|
867
881
|
cacheRead: number;
|
|
868
882
|
cacheWrite: number;
|
|
883
|
+
imageOutput?: number | undefined;
|
|
869
884
|
tiers?: {
|
|
870
885
|
input: number;
|
|
871
886
|
output: number;
|
|
@@ -875,6 +890,7 @@ export declare const ModelsConfigSchema: Type.TObject<{
|
|
|
875
890
|
}[] | undefined;
|
|
876
891
|
};
|
|
877
892
|
}[] | undefined;
|
|
893
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
878
894
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
879
895
|
sendImageOptInHeader?: boolean | undefined;
|
|
880
896
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -922,6 +938,7 @@ export declare const ModelsConfigSchema: Type.TObject<{
|
|
|
922
938
|
output: number;
|
|
923
939
|
cacheRead: number;
|
|
924
940
|
cacheWrite: number;
|
|
941
|
+
imageOutput?: number | undefined;
|
|
925
942
|
tiers?: {
|
|
926
943
|
input: number;
|
|
927
944
|
output: number;
|
|
@@ -1032,6 +1049,7 @@ export declare const ModelsConfigSchema: Type.TObject<{
|
|
|
1032
1049
|
output: number;
|
|
1033
1050
|
cacheRead: number;
|
|
1034
1051
|
cacheWrite: number;
|
|
1052
|
+
imageOutput?: number | undefined;
|
|
1035
1053
|
tiers?: {
|
|
1036
1054
|
input: number;
|
|
1037
1055
|
output: number;
|
|
@@ -1041,6 +1059,7 @@ export declare const ModelsConfigSchema: Type.TObject<{
|
|
|
1041
1059
|
}[] | undefined;
|
|
1042
1060
|
};
|
|
1043
1061
|
}[] | undefined;
|
|
1062
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
1044
1063
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
1045
1064
|
sendImageOptInHeader?: boolean | undefined;
|
|
1046
1065
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -1085,6 +1104,7 @@ export declare const ModelsConfigSchema: Type.TObject<{
|
|
|
1085
1104
|
output: number;
|
|
1086
1105
|
cacheRead: number;
|
|
1087
1106
|
cacheWrite: number;
|
|
1107
|
+
imageOutput?: number | undefined;
|
|
1088
1108
|
tiers?: {
|
|
1089
1109
|
input: number;
|
|
1090
1110
|
output: number;
|
|
@@ -1195,6 +1215,7 @@ export declare const ModelsConfigSchema: Type.TObject<{
|
|
|
1195
1215
|
output: number;
|
|
1196
1216
|
cacheRead: number;
|
|
1197
1217
|
cacheWrite: number;
|
|
1218
|
+
imageOutput?: number | undefined;
|
|
1198
1219
|
tiers?: {
|
|
1199
1220
|
input: number;
|
|
1200
1221
|
output: number;
|
|
@@ -1204,6 +1225,7 @@ export declare const ModelsConfigSchema: Type.TObject<{
|
|
|
1204
1225
|
}[] | undefined;
|
|
1205
1226
|
};
|
|
1206
1227
|
}[] | undefined;
|
|
1228
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
1207
1229
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
1208
1230
|
sendImageOptInHeader?: boolean | undefined;
|
|
1209
1231
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -1314,6 +1336,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1314
1336
|
output: number;
|
|
1315
1337
|
cacheRead: number;
|
|
1316
1338
|
cacheWrite: number;
|
|
1339
|
+
imageOutput?: number | undefined;
|
|
1317
1340
|
tiers?: {
|
|
1318
1341
|
input: number;
|
|
1319
1342
|
output: number;
|
|
@@ -1323,6 +1346,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1323
1346
|
}[] | undefined;
|
|
1324
1347
|
};
|
|
1325
1348
|
}[] | undefined;
|
|
1349
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
1326
1350
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
1327
1351
|
sendImageOptInHeader?: boolean | undefined;
|
|
1328
1352
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -1370,6 +1394,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1370
1394
|
output: number;
|
|
1371
1395
|
cacheRead: number;
|
|
1372
1396
|
cacheWrite: number;
|
|
1397
|
+
imageOutput?: number | undefined;
|
|
1373
1398
|
tiers?: {
|
|
1374
1399
|
input: number;
|
|
1375
1400
|
output: number;
|
|
@@ -1480,6 +1505,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1480
1505
|
output: number;
|
|
1481
1506
|
cacheRead: number;
|
|
1482
1507
|
cacheWrite: number;
|
|
1508
|
+
imageOutput?: number | undefined;
|
|
1483
1509
|
tiers?: {
|
|
1484
1510
|
input: number;
|
|
1485
1511
|
output: number;
|
|
@@ -1489,6 +1515,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1489
1515
|
}[] | undefined;
|
|
1490
1516
|
};
|
|
1491
1517
|
}[] | undefined;
|
|
1518
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
1492
1519
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
1493
1520
|
sendImageOptInHeader?: boolean | undefined;
|
|
1494
1521
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -1533,6 +1560,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1533
1560
|
output: number;
|
|
1534
1561
|
cacheRead: number;
|
|
1535
1562
|
cacheWrite: number;
|
|
1563
|
+
imageOutput?: number | undefined;
|
|
1536
1564
|
tiers?: {
|
|
1537
1565
|
input: number;
|
|
1538
1566
|
output: number;
|
|
@@ -1643,6 +1671,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1643
1671
|
output: number;
|
|
1644
1672
|
cacheRead: number;
|
|
1645
1673
|
cacheWrite: number;
|
|
1674
|
+
imageOutput?: number | undefined;
|
|
1646
1675
|
tiers?: {
|
|
1647
1676
|
input: number;
|
|
1648
1677
|
output: number;
|
|
@@ -1652,6 +1681,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1652
1681
|
}[] | undefined;
|
|
1653
1682
|
};
|
|
1654
1683
|
}[] | undefined;
|
|
1684
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
1655
1685
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
1656
1686
|
sendImageOptInHeader?: boolean | undefined;
|
|
1657
1687
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -1700,6 +1730,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1700
1730
|
output: number;
|
|
1701
1731
|
cacheRead: number;
|
|
1702
1732
|
cacheWrite: number;
|
|
1733
|
+
imageOutput?: number | undefined;
|
|
1703
1734
|
tiers?: {
|
|
1704
1735
|
input: number;
|
|
1705
1736
|
output: number;
|
|
@@ -1810,6 +1841,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1810
1841
|
output: number;
|
|
1811
1842
|
cacheRead: number;
|
|
1812
1843
|
cacheWrite: number;
|
|
1844
|
+
imageOutput?: number | undefined;
|
|
1813
1845
|
tiers?: {
|
|
1814
1846
|
input: number;
|
|
1815
1847
|
output: number;
|
|
@@ -1819,6 +1851,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1819
1851
|
}[] | undefined;
|
|
1820
1852
|
};
|
|
1821
1853
|
}[] | undefined;
|
|
1854
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
1822
1855
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
1823
1856
|
sendImageOptInHeader?: boolean | undefined;
|
|
1824
1857
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -1863,6 +1896,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1863
1896
|
output: number;
|
|
1864
1897
|
cacheRead: number;
|
|
1865
1898
|
cacheWrite: number;
|
|
1899
|
+
imageOutput?: number | undefined;
|
|
1866
1900
|
tiers?: {
|
|
1867
1901
|
input: number;
|
|
1868
1902
|
output: number;
|
|
@@ -1973,6 +2007,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1973
2007
|
output: number;
|
|
1974
2008
|
cacheRead: number;
|
|
1975
2009
|
cacheWrite: number;
|
|
2010
|
+
imageOutput?: number | undefined;
|
|
1976
2011
|
tiers?: {
|
|
1977
2012
|
input: number;
|
|
1978
2013
|
output: number;
|
|
@@ -1982,6 +2017,7 @@ export declare const ModelsJsonSchemas: {
|
|
|
1982
2017
|
}[] | undefined;
|
|
1983
2018
|
};
|
|
1984
2019
|
}[] | undefined;
|
|
2020
|
+
supportsReasoningReplay?: boolean | undefined;
|
|
1985
2021
|
imageInput?: "assets" | "images" | "state-image-urls" | undefined;
|
|
1986
2022
|
sendImageOptInHeader?: boolean | undefined;
|
|
1987
2023
|
supportsDeveloperRole?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-config.d.ts","sourceRoot":"","sources":["../../src/core/model-config.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAGxD,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AA6C5C,QAAA,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"model-config.d.ts","sourceRoot":"","sources":["../../src/core/model-config.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAGxD,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AA6C5C,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBzB,CAAC;AAEH,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBvB,CAAC;AAEH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;IAED,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAE9D;IAED,cAAc,IAAI,SAAS,MAAM,EAAE,CAElC;IAED,QAAQ,IAAI,MAAM,GAAG,SAAS,CAE7B;CACD"}
|
|
@@ -8,7 +8,7 @@ import { DEFAULT_THINKING_LEVEL } from "./defaults.js";
|
|
|
8
8
|
/** Default chat model IDs for providers with built-in chat models. */
|
|
9
9
|
export const defaultModelPerProvider = {
|
|
10
10
|
"amazon-bedrock": "us.anthropic.claude-opus-5-5",
|
|
11
|
-
"ant-ling": "
|
|
11
|
+
"ant-ling": "Ling-3.1-flash",
|
|
12
12
|
anthropic: "claude-opus-5-5",
|
|
13
13
|
openai: "gpt-6.2-sol",
|
|
14
14
|
azure: "gpt-6.2-sol",
|
|
@@ -26,7 +26,7 @@ export const defaultModelPerProvider = {
|
|
|
26
26
|
cerebras: "gpt-oss-120b",
|
|
27
27
|
zai: "glm-5.3",
|
|
28
28
|
"zai-coding-cn": "glm-5.3",
|
|
29
|
-
mistral: "
|
|
29
|
+
mistral: "mistral-medium-latest",
|
|
30
30
|
minimax: "MiniMax-M3",
|
|
31
31
|
"minimax-cn": "MiniMax-M3",
|
|
32
32
|
moonshotai: "kimi-k2.7-code",
|
|
@@ -39,8 +39,8 @@ export const defaultModelPerProvider = {
|
|
|
39
39
|
"opencode-go": "kimi-k3.1-pro",
|
|
40
40
|
"kimi-coding": "kimi-for-coding",
|
|
41
41
|
meta: "muse-spark-1.3",
|
|
42
|
-
"cloudflare-workers-ai": "@cf/
|
|
43
|
-
"cloudflare-ai-gateway": "workers-ai/@cf/
|
|
42
|
+
"cloudflare-workers-ai": "@cf/zai-org/glm-5.3",
|
|
43
|
+
"cloudflare-ai-gateway": "workers-ai/@cf/zai-org/glm-5.3",
|
|
44
44
|
"qwen-token-plan": "qwen3.8-max",
|
|
45
45
|
"qwen-token-plan-cn": "qwen3.8-max",
|
|
46
46
|
"qwen-token-plan-individual": "qwen3.8-max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Ae,EAAE,SAAS,EAAE,CAAC;IACzG,CAAC;IAED,oBAAoB;IACpB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AAChG,CAAC","sourcesContent":["/**\n * Model resolution, scoping, and initial selection\n */\n\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport {\n\ttype Api,\n\ttype AuthOperationOptions,\n\ttype KnownProvider,\n\ttype Model,\n\tmodelsAreEqual,\n} from \"@earendil-works/pi-ai\";\nimport { minimatch } from \"minimatch\";\nimport { isValidThinkingLevel } from \"../cli/args.ts\";\nimport { DEFAULT_THINKING_LEVEL } from \"./defaults.ts\";\nimport type { ModelRuntime } from \"./model-runtime.ts\";\n\n/** Default chat model IDs for providers with built-in chat models. */\nexport const defaultModelPerProvider: Partial<Record<KnownProvider, string>> = {\n\t\"amazon-bedrock\": \"us.anthropic.claude-opus-5-5\",\n\t\"ant-ling\": \"Ring-2.6-1T\",\n\tanthropic: \"claude-opus-5-5\",\n\topenai: \"gpt-6.2-sol\",\n\tazure: \"gpt-6.2-sol\",\n\t\"openai-codex\": \"gpt-6.2-sol\",\n\tradius: \"balanced\",\n\tnvidia: \"nvidia/nemotron-3.5-super-vl-120b-a12b\",\n\tdeepseek: \"deepseek-v4-pro\",\n\tgoogle: \"gemini-4-argon\",\n\t\"google-vertex\": \"gemini-4-argon\",\n\t\"github-copilot\": \"gpt-6.1-sol\",\n\topenrouter: \"moonshotai/kimi-k2.7-code\",\n\t\"vercel-ai-gateway\": \"zai/glm-5.3\",\n\txai: \"grok-4.7\",\n\tgroq: \"openai/gpt-oss-120b\",\n\tcerebras: \"gpt-oss-120b\",\n\tzai: \"glm-5.3\",\n\t\"zai-coding-cn\": \"glm-5.3\",\n\tmistral: \"devstral-medium-latest\",\n\tminimax: \"MiniMax-M3\",\n\t\"minimax-cn\": \"MiniMax-M3\",\n\tmoonshotai: \"kimi-k2.7-code\",\n\t\"moonshotai-cn\": \"kimi-k2.7-code\",\n\thuggingface: \"moonshotai/Kimi-K2.7-Code\",\n\tfireworks: \"accounts/fireworks/models/kimi-k3\",\n\ttogether: \"moonshotai/Kimi-K3\",\n\tbaseten: \"zai-org/GLM-5.3\",\n\topencode: \"kimi-k2.7-code\",\n\t\"opencode-go\": \"kimi-k3.1-pro\",\n\t\"kimi-coding\": \"kimi-for-coding\",\n\tmeta: \"muse-spark-1.3\",\n\t\"cloudflare-workers-ai\": \"@cf/moonshotai/kimi-k2.7-code\",\n\t\"cloudflare-ai-gateway\": \"workers-ai/@cf/moonshotai/kimi-k2.7-code\",\n\t\"qwen-token-plan\": \"qwen3.8-max\",\n\t\"qwen-token-plan-cn\": \"qwen3.8-max\",\n\t\"qwen-token-plan-individual\": \"qwen3.8-max\",\n\t\"qwen-token-plan-individual-cn\": \"qwen3.8-max\",\n\txiaomi: \"mimo-v2.6-pro\",\n\t\"xiaomi-token-plan-cn\": \"mimo-v2.6-pro\",\n\t\"xiaomi-token-plan-ams\": \"mimo-v2.6-pro\",\n\t\"xiaomi-token-plan-sgp\": \"mimo-v2.6-pro\",\n};\n\nexport interface ScopedModel {\n\tmodel: Model<Api>;\n\t/** Thinking level if explicitly specified in pattern (e.g., \"model:high\"), undefined otherwise */\n\tthinkingLevel?: ThinkingLevel;\n}\n\n/*\n * Model reference resolution. Candidates are collected before a provider is chosen, so catalog order\n * never decides the provider and an ambiguous match is reported instead of falling through to a\n * weaker one.\n */\n\nexport interface ModelReferenceRequest {\n\t/** Bare model id or `provider/id`, optionally followed by `:<thinking>`. */\n\ttext: string;\n\t/** Only consider models from this provider. */\n\tprovider?: string;\n\t/**\n\t * A trailing `:<suffix>` is only considered when the full text matches no model, since ids such as\n\t * OpenRouter's `qwen/qwen3-coder:exacto` contain colons.\n\t * - `none`: the suffix stays part of the id\n\t * - `strict`: a valid thinking level is parsed; any other suffix stays part of the id\n\t * - `lenient`: like `strict`, but an invalid suffix is dropped with a warning\n\t */\n\tthinkingSuffix: \"none\" | \"strict\" | \"lenient\";\n\t/** Match id and name substrings when no exact match exists. */\n\tfuzzy: boolean;\n}\n\nexport type ModelReferenceResult =\n\t| { status: \"resolved\"; model: Model<Api>; thinkingLevel?: ThinkingLevel; warning?: string }\n\t| {\n\t\t\tstatus: \"ambiguous\";\n\t\t\tcandidates: Model<Api>[];\n\t\t\tusableCount: number;\n\t\t\tthinkingLevel?: ThinkingLevel;\n\t\t\twarning?: string;\n\t }\n\t| {\n\t\t\tstatus: \"not-found\";\n\t\t\t/** Set when a provider is explicit or named by a `provider/` prefix, for building a custom model id. */\n\t\t\ttarget?: ModelReferenceTarget;\n\t };\n\nexport interface ModelReferenceTarget {\n\tprovider: string;\n\tproviderModels: [Model<Api>, ...Model<Api>[]];\n\t/** Text after the provider prefix as typed, including any `:<suffix>`. */\n\tmodelText: string;\n\t/** `modelText` without a valid thinking suffix (unless `thinkingSuffix` is `none`). */\n\tmodelId: string;\n\tthinkingLevel?: ThinkingLevel;\n}\n\ntype ResolvedOrAmbiguous = Exclude<ModelReferenceResult, { status: \"not-found\" }>;\n\nfunction splitThinkingSuffix(text: string): { base: string; thinkingLevel: ThinkingLevel } | undefined {\n\tconst colonIndex = text.lastIndexOf(\":\");\n\tconst suffix = text.substring(colonIndex + 1);\n\tif (colonIndex === -1 || !isValidThinkingLevel(suffix)) return undefined;\n\treturn { base: text.substring(0, colonIndex), thinkingLevel: suffix };\n}\n\nfunction splitProviderPrefix(\n\ttext: string,\n\tmodels: readonly Model<Api>[],\n): { provider: string; modelText: string } | undefined {\n\t// Provider ids may contain \"/\" themselves (e.g. URL-derived ids), so match known ids, longest first\n\tconst lowerText = text.toLowerCase();\n\tlet best: { provider: string; modelText: string } | undefined;\n\tfor (const { provider } of models) {\n\t\tconst prefix = provider.trim().toLowerCase();\n\t\tif (!prefix || (best && best.provider.length >= provider.length)) continue;\n\t\tconst slashIndex = lowerText.indexOf(\"/\", prefix.length);\n\t\tif (slashIndex === -1 || lowerText.substring(0, slashIndex).trim() !== prefix) continue;\n\t\tconst modelText = text.substring(slashIndex + 1).trim();\n\t\tif (modelText) best = { provider, modelText };\n\t}\n\treturn best;\n}\n\n/**\n * `usable` only breaks ties between providers, so a unique match resolves even without credentials\n * (`--api-key` first-time setup).\n */\nexport function resolveModelReference(\n\trequest: ModelReferenceRequest,\n\tmodels: readonly Model<Api>[],\n\tusable: (provider: string) => boolean,\n): ModelReferenceResult {\n\tconst text = request.text.trim();\n\tif (!text) return { status: \"not-found\" };\n\tconst constraint = request.provider?.toLowerCase();\n\tconst pool = constraint ? models.filter((model) => model.provider.toLowerCase() === constraint) : models;\n\tconst result = resolveText(text, request, pool, usable);\n\tif (result.status !== \"not-found\") return result;\n\n\tconst split = splitProviderPrefix(text, pool);\n\tconst anchor = constraint ? pool[0] : pool.find((model) => model.provider === split?.provider);\n\tif (!anchor) return result;\n\tconst modelText = split?.modelText ?? text;\n\tconst suffix = request.thinkingSuffix === \"none\" ? undefined : splitThinkingSuffix(modelText);\n\treturn {\n\t\tstatus: \"not-found\",\n\t\ttarget: {\n\t\t\tprovider: anchor.provider,\n\t\t\tproviderModels: [anchor, ...pool.filter((model) => model.provider === anchor.provider && model !== anchor)],\n\t\t\tmodelText,\n\t\t\tmodelId: suffix?.base ?? modelText,\n\t\t\tthinkingLevel: suffix?.thinkingLevel,\n\t\t},\n\t};\n}\n\n/** Exact `provider/id` or bare id lookup without thinking suffixes or fuzzy matching. */\nexport function findExactModelReferenceMatch(\n\tmodelReference: string,\n\tmodels: readonly Model<Api>[],\n): Model<Api> | undefined {\n\tconst result = resolveModelReference(\n\t\t{ text: modelReference, thinkingSuffix: \"none\", fuzzy: false },\n\t\tmodels,\n\t\t() => true,\n\t);\n\treturn result.status === \"resolved\" ? result.model : undefined;\n}\n\nfunction resolveText(\n\ttext: string,\n\trequest: ModelReferenceRequest,\n\tpool: readonly Model<Api>[],\n\tusable: (provider: string) => boolean,\n): ModelReferenceResult {\n\tconst reference = selectReference(text, pool, request.fuzzy, usable);\n\tif (reference) return reference;\n\n\tif (request.fuzzy) {\n\t\tconst fuzzy = selectFuzzy(fuzzyMatches(text, pool), usable);\n\t\tif (fuzzy) return fuzzy;\n\t}\n\n\tif (request.thinkingSuffix === \"none\") return { status: \"not-found\" };\n\tconst thinking = splitThinkingSuffix(text);\n\tif (thinking) {\n\t\tconst inner = resolveText(thinking.base, request, pool, usable);\n\t\tif (inner.status === \"not-found\") return inner;\n\t\t// Only use this thinking level if no warning from inner recursion\n\t\treturn { ...inner, thinkingLevel: inner.warning ? undefined : thinking.thinkingLevel };\n\t}\n\t// Keep an invalid suffix as part of the id and fail, rather than resolve a different model\n\tif (request.thinkingSuffix === \"strict\") return { status: \"not-found\" };\n\tconst colonIndex = text.lastIndexOf(\":\");\n\tif (colonIndex === -1) return { status: \"not-found\" };\n\n\tconst suffix = text.substring(colonIndex + 1);\n\tconst inner = resolveText(text.substring(0, colonIndex), request, pool, usable);\n\tif (inner.status === \"not-found\") return inner;\n\treturn {\n\t\t...inner,\n\t\tthinkingLevel: undefined,\n\t\twarning: `Invalid thinking level \"${suffix}\" in pattern \"${text}\". Using default instead.`,\n\t};\n}\n\n/**\n * `provider/rest` is only a hint: the whole text may also be a model id on another provider, such as\n * gateway id `zai/glm-5` or commandcode id `xiaomi/mimo-v2.6-pro`. The named provider wins when usable,\n * since that is what the syntax usually means; otherwise a sole usable raw match wins, since the named\n * provider could not serve the request. An unusable named match is still preferred over unusable raw\n * matches, so `--api-key` can set up the named provider.\n */\nfunction selectReference(\n\ttext: string,\n\tpool: readonly Model<Api>[],\n\tfuzzy: boolean,\n\tusable: (provider: string) => boolean,\n): ResolvedOrAmbiguous | undefined {\n\tconst lowerText = text.toLowerCase();\n\tconst raw = pool.filter((model) => model.id.toLowerCase() === lowerText);\n\tconst split = splitProviderPrefix(text, pool);\n\tlet named: Model<Api> | undefined;\n\tif (split) {\n\t\tconst providerModels = pool.filter((model) => model.provider === split.provider);\n\t\tconst lowerModelText = split.modelText.toLowerCase();\n\t\t// The provider's own literal id (OpenRouter's `openrouter/free`) beats its fuzzy matches\n\t\tnamed =\n\t\t\tproviderModels.find((model) => model.id.toLowerCase() === lowerModelText) ??\n\t\t\traw.find((model) => model.provider === split.provider) ??\n\t\t\t(fuzzy ? bestFuzzyMatch(fuzzyMatches(split.modelText, providerModels)) : undefined);\n\t}\n\n\tconst others = raw.filter((model) => model !== named);\n\tconst candidates = named ? [named, ...others] : others;\n\tif (candidates.length === 0) return undefined;\n\tif (new Set(candidates.map((model) => model.provider)).size === 1)\n\t\treturn { status: \"resolved\", model: candidates[0] };\n\tif (named && usable(named.provider)) return { status: \"resolved\", model: named };\n\tconst usableOthers = others.filter((model) => usable(model.provider));\n\tif (usableOthers.length === 1) return { status: \"resolved\", model: usableOthers[0] };\n\tif (usableOthers.length === 0 && named) return { status: \"resolved\", model: named };\n\treturn { status: \"ambiguous\", candidates, usableCount: usableOthers.length };\n}\n\nfunction fuzzyMatches(text: string, models: readonly Model<Api>[]): Model<Api>[] {\n\tconst lowerText = text.toLowerCase();\n\treturn models.filter(\n\t\t(model) => model.id.toLowerCase().includes(lowerText) || model.name?.toLowerCase().includes(lowerText),\n\t);\n}\n\nfunction selectFuzzy(matches: Model<Api>[], usable: (provider: string) => boolean): ResolvedOrAmbiguous | undefined {\n\tif (matches.length === 0) return undefined;\n\tconst multipleProviders = new Set(matches.map((model) => model.provider)).size > 1;\n\tconst usableMatches = multipleProviders ? matches.filter((model) => usable(model.provider)) : [];\n\tconst pool = usableMatches.length > 0 ? usableMatches : matches;\n\tconst best = bestFuzzyMatch(pool);\n\tif (!best) return undefined;\n\t// The same id on several providers would otherwise be decided by catalog order\n\tconst tied = pool.filter((model) => model.id === best.id);\n\tif (new Set(tied.map((model) => model.provider)).size === 1) return { status: \"resolved\", model: best };\n\treturn {\n\t\tstatus: \"ambiguous\",\n\t\tcandidates: tied,\n\t\tusableCount: usableMatches.length > 0 ? tied.length : 0,\n\t};\n}\n\n/** Prefer aliases (`claude-sonnet-4-5`) over dated versions (`claude-sonnet-4-5-20250929`), then the latest. */\nfunction bestFuzzyMatch(matches: readonly Model<Api>[]): Model<Api> | undefined {\n\tconst aliases = matches.filter((model) => isAlias(model.id));\n\treturn [...(aliases.length > 0 ? aliases : matches)].sort((a, b) => b.id.localeCompare(a.id))[0];\n}\n\nfunction isAlias(id: string): boolean {\n\treturn id.endsWith(\"-latest\") || !/-\\d{8}$/.test(id);\n}\n\nfunction buildFallbackModel(providerModels: [Model<Api>, ...Model<Api>[]], modelId: string): Model<Api> {\n\tconst defaultId = defaultModelPerProvider[providerModels[0].provider as KnownProvider];\n\tconst baseModel = defaultId\n\t\t? (providerModels.find((m) => m.id === defaultId) ?? providerModels[0])\n\t\t: providerModels[0];\n\n\treturn {\n\t\t...baseModel,\n\t\tid: modelId,\n\t\tname: modelId,\n\t};\n}\n\nexport interface ModelScopeDiagnostic {\n\ttype: \"warning\";\n\tcode: \"no-match\" | \"invalid-thinking-level\" | \"ambiguous\";\n\tmessage: string;\n\tpattern: string;\n}\n\nexport interface ResolveModelScopeResult {\n\tscopedModels: ScopedModel[];\n\tdiagnostics: ModelScopeDiagnostic[];\n}\n\n/**\n * Resolve scope patterns (`--models`, `enabledModels`) to models with optional thinking levels.\n *\n * Every model in `models` is usable, so credentials cannot choose between providers offering the same\n * id. All of them are added, with a warning so the user can pick one with `provider/id`.\n */\nexport function resolveModelScopeFromModels(\n\tpatterns: string[],\n\tmodels: readonly Model<Api>[],\n): ResolveModelScopeResult {\n\tconst scopedModels: ScopedModel[] = [];\n\tconst diagnostics: ModelScopeDiagnostic[] = [];\n\tconst add = (model: Model<Api>, thinkingLevel: ThinkingLevel | undefined) => {\n\t\tif (!scopedModels.some((scoped) => modelsAreEqual(scoped.model, model))) {\n\t\t\tscopedModels.push({ model, thinkingLevel });\n\t\t}\n\t};\n\tconst noMatch = (pattern: string) =>\n\t\tdiagnostics.push({ type: \"warning\", code: \"no-match\", message: `No models match pattern \"${pattern}\"`, pattern });\n\tconst ambiguous = (pattern: string, candidates: readonly Model<Api>[]) => {\n\t\tconst providers = [...new Set(candidates.map((m) => m.provider))].sort((a, b) => a.localeCompare(b));\n\t\tdiagnostics.push({\n\t\t\ttype: \"warning\",\n\t\t\tcode: \"ambiguous\",\n\t\t\tmessage: `Pattern \"${pattern}\" matches several providers: ${providers.join(\", \")}. Use provider/id to choose one.`,\n\t\t\tpattern,\n\t\t});\n\t};\n\n\tfor (const pattern of patterns) {\n\t\t// Check if pattern contains glob characters\n\t\tif (pattern.includes(\"*\") || pattern.includes(\"?\") || pattern.includes(\"[\")) {\n\t\t\t// Extract optional thinking level suffix (e.g., \"provider/*:high\")\n\t\t\tconst thinking = splitThinkingSuffix(pattern);\n\t\t\tconst globPattern = thinking?.base ?? pattern;\n\t\t\tconst thinkingLevel = thinking?.thinkingLevel;\n\n\t\t\t// Ids such as `bracketed-model[1m]` are not globs\n\t\t\tconst exact = resolveModelReference(\n\t\t\t\t{ text: globPattern, thinkingSuffix: \"none\", fuzzy: false },\n\t\t\t\tmodels,\n\t\t\t\t() => true,\n\t\t\t);\n\t\t\tlet matches: readonly Model<Api>[] = [];\n\t\t\tif (exact.status === \"resolved\") matches = [exact.model];\n\t\t\telse if (exact.status === \"ambiguous\") {\n\t\t\t\tmatches = exact.candidates;\n\t\t\t\tambiguous(pattern, matches);\n\t\t\t} else {\n\t\t\t\t// Match against \"provider/modelId\" format OR just model ID\n\t\t\t\t// This allows \"*sonnet*\" to match without requiring \"anthropic/*sonnet*\"\n\t\t\t\tmatches = models.filter(\n\t\t\t\t\t(m) =>\n\t\t\t\t\t\tminimatch(`${m.provider}/${m.id}`, globPattern, { nocase: true }) ||\n\t\t\t\t\t\tminimatch(m.id, globPattern, { nocase: true }),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (matches.length === 0) noMatch(pattern);\n\t\t\tfor (const model of matches) add(model, thinkingLevel);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst result = resolveModelReference(\n\t\t\t{ text: pattern, thinkingSuffix: \"lenient\", fuzzy: true },\n\t\t\tmodels,\n\t\t\t() => true,\n\t\t);\n\t\tif (result.status === \"not-found\") {\n\t\t\tnoMatch(pattern);\n\t\t\tcontinue;\n\t\t}\n\t\tif (result.warning) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"invalid-thinking-level\", message: result.warning, pattern });\n\t\t}\n\t\tif (result.status === \"ambiguous\") ambiguous(pattern, result.candidates);\n\t\tconst matches = result.status === \"resolved\" ? [result.model] : result.candidates;\n\t\tfor (const model of matches) add(model, result.thinkingLevel);\n\t}\n\n\treturn { scopedModels, diagnostics };\n}\n\nexport async function resolveModelScopeWithDiagnostics(\n\tpatterns: string[],\n\tmodelRuntime: ModelRuntime,\n\toptions?: AuthOperationOptions,\n): Promise<ResolveModelScopeResult> {\n\treturn resolveModelScopeFromModels(patterns, await modelRuntime.getAvailable(undefined, options));\n}\n\nexport interface ResolveCliModelResult {\n\tmodel: Model<Api> | undefined;\n\tthinkingLevel?: ThinkingLevel;\n\twarning: string | undefined;\n\t/**\n\t * Error message suitable for CLI display.\n\t * When set, model will be undefined.\n\t */\n\terror: string | undefined;\n}\n\n/**\n * Resolve a single model from CLI flags.\n *\n * Supports:\n * - --provider <provider> --model <pattern>\n * - --model <provider>/<pattern>\n * - Fuzzy matching (same rules as model scoping: exact id, then partial id/name)\n *\n * Note: This does not apply the thinking level by itself, but it may *parse* and\n * return a thinking level from \"<pattern>:<thinking>\" so the caller can apply it.\n */\nexport function resolveCliModel(options: {\n\tcliProvider?: string;\n\tcliModel?: string;\n\tcliThinking?: ThinkingLevel;\n\t/** `--api-key` was supplied for the selected provider. */\n\tinlineApiKey?: boolean;\n\tmodelRuntime: ModelRuntime;\n}): ResolveCliModelResult {\n\tconst { cliProvider, cliModel, cliThinking, inlineApiKey, modelRuntime } = options;\n\n\tif (!cliModel) {\n\t\treturn { model: undefined, warning: undefined, error: undefined };\n\t}\n\n\t// Important: use *all* models here, not just models with pre-configured auth.\n\t// This allows \"--api-key\" to be used for first-time setup.\n\tconst models = [...modelRuntime.getModels()];\n\tif (models.length === 0) {\n\t\treturn {\n\t\t\tmodel: undefined,\n\t\t\twarning: undefined,\n\t\t\terror: \"No models available. Check your installation or add models to models.json.\",\n\t\t};\n\t}\n\n\tconst provider = cliProvider\n\t\t? models.find((m) => m.provider.toLowerCase() === cliProvider.toLowerCase())?.provider\n\t\t: undefined;\n\tif (cliProvider && !provider) {\n\t\treturn {\n\t\t\tmodel: undefined,\n\t\t\twarning: undefined,\n\t\t\terror: `Unknown provider \"${cliProvider}\". Use --list-models to see available providers/models.`,\n\t\t};\n\t}\n\n\tconst result = resolveModelReference(\n\t\t{ text: cliModel, provider, thinkingSuffix: \"strict\", fuzzy: true },\n\t\tmodels,\n\t\t// An inline key goes to whichever provider is selected, so stored credentials must not choose it\n\t\tinlineApiKey ? () => false : (providerId) => modelRuntime.hasConfiguredAuth(providerId),\n\t);\n\tif (result.status === \"resolved\") {\n\t\treturn { model: result.model, thinkingLevel: result.thinkingLevel, warning: result.warning, error: undefined };\n\t}\n\tif (result.status === \"ambiguous\") {\n\t\tconst matches = result.candidates\n\t\t\t.map((m) => `${m.provider}/${m.id}`)\n\t\t\t.sort((a, b) => a.localeCompare(b))\n\t\t\t.join(\", \");\n\t\tconst authHint = inlineApiKey\n\t\t\t? \"--api-key does not choose a provider.\"\n\t\t\t: result.usableCount === 0\n\t\t\t\t? \"No matching provider is authenticated.\"\n\t\t\t\t: \"More than one matching provider is authenticated.\";\n\t\treturn {\n\t\t\tmodel: undefined,\n\t\t\twarning: undefined,\n\t\t\terror: `Model \"${cliModel}\" is ambiguous across providers: ${matches}. ${authHint} Use --provider or provider/model.`,\n\t\t};\n\t}\n\n\tconst { target } = result;\n\tif (!target) {\n\t\treturn {\n\t\t\tmodel: undefined,\n\t\t\twarning: undefined,\n\t\t\terror: `Model \"${cliModel}\" not found. Use --list-models to see available models.`,\n\t\t};\n\t}\n\n\t// Use the thinking level suffix only when --thinking is not explicitly provided; otherwise it\n\t// stays part of the custom model id.\n\t// e.g. \"zai-org/GLM-5.1-FP8:high\" → modelId=\"zai-org/GLM-5.1-FP8\", fallbackThinking=\"high\"\n\tconst modelId = cliThinking ? target.modelText : target.modelId;\n\tconst fallbackThinking = cliThinking ? undefined : target.thinkingLevel;\n\tconst fallbackModel = buildFallbackModel(target.providerModels, modelId);\n\tconst requestedThinking = cliThinking ?? fallbackThinking;\n\treturn {\n\t\tmodel: requestedThinking && requestedThinking !== \"off\" ? { ...fallbackModel, reasoning: true } : fallbackModel,\n\t\tthinkingLevel: fallbackThinking,\n\t\twarning: `Model \"${modelId}\" not found for provider \"${target.provider}\". Using custom model id.`,\n\t\terror: undefined,\n\t};\n}\n\nexport interface InitialModelResult {\n\tmodel: Model<Api> | undefined;\n\tthinkingLevel: ThinkingLevel;\n\tfallbackMessage: string | undefined;\n}\n\n/**\n * Find the initial model to use based on priority:\n * 1. First model from scoped models (if not continuing/resuming)\n * 2. Saved default from settings\n * 3. First available model with valid API key\n */\nexport async function findInitialModel(options: {\n\tscopedModels: ScopedModel[];\n\tisContinuing: boolean;\n\tdefaultProvider?: string;\n\tdefaultModelId?: string;\n\tdefaultThinkingLevel?: ThinkingLevel;\n\tmodelThinkingLevels?: Record<string, ThinkingLevel>;\n\tmodelRuntime: ModelRuntime;\n}): Promise<InitialModelResult> {\n\tconst {\n\t\tscopedModels,\n\t\tisContinuing,\n\t\tdefaultProvider,\n\t\tdefaultModelId,\n\t\tdefaultThinkingLevel,\n\t\tmodelThinkingLevels,\n\t\tmodelRuntime,\n\t} = options;\n\n\tlet model: Model<Api> | undefined;\n\tlet thinkingLevel: ThinkingLevel = DEFAULT_THINKING_LEVEL;\n\n\t// 1. Use first model from scoped models (skip if continuing/resuming)\n\tif (scopedModels.length > 0 && !isContinuing) {\n\t\tconst scopedModel = scopedModels[0];\n\t\tconst perModel = modelThinkingLevels?.[`${scopedModel.model.provider}/${scopedModel.model.id}`];\n\t\treturn {\n\t\t\tmodel: scopedModel.model,\n\t\t\tthinkingLevel: scopedModel.thinkingLevel ?? perModel ?? defaultThinkingLevel ?? DEFAULT_THINKING_LEVEL,\n\t\t\tfallbackMessage: undefined,\n\t\t};\n\t}\n\n\t// 2. Try saved default from settings if auth is configured.\n\tif (defaultProvider && defaultModelId) {\n\t\tconst found = modelRuntime.getModel(defaultProvider, defaultModelId);\n\t\tif (found && modelRuntime.hasConfiguredAuth(found.provider)) {\n\t\t\tmodel = found;\n\t\t\tconst perModel = modelThinkingLevels?.[`${defaultProvider}/${defaultModelId}`];\n\t\t\tif (perModel) {\n\t\t\t\tthinkingLevel = perModel;\n\t\t\t} else if (defaultThinkingLevel) {\n\t\t\t\tthinkingLevel = defaultThinkingLevel;\n\t\t\t}\n\t\t\treturn { model, thinkingLevel, fallbackMessage: undefined };\n\t\t}\n\t}\n\n\t// 3. Try first available model with valid API key\n\tconst availableModels = [...modelRuntime.getAvailableSnapshot()];\n\n\tif (availableModels.length > 0) {\n\t\t// Try to find a default model from known providers\n\t\tfor (const provider of Object.keys(defaultModelPerProvider) as KnownProvider[]) {\n\t\t\tconst defaultId = defaultModelPerProvider[provider];\n\t\t\tconst match = availableModels.find((m) => m.provider === provider && m.id === defaultId);\n\t\t\tif (match) {\n\t\t\t\treturn { model: match, thinkingLevel: DEFAULT_THINKING_LEVEL, fallbackMessage: undefined };\n\t\t\t}\n\t\t}\n\n\t\t// If no default found, use first available\n\t\treturn { model: availableModels[0], thinkingLevel: DEFAULT_THINKING_LEVEL, fallbackMessage: undefined };\n\t}\n\n\t// 4. No model found\n\treturn { model: undefined, thinkingLevel: DEFAULT_THINKING_LEVEL, fallbackMessage: undefined };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"model-resolver.js","sourceRoot":"","sources":["../../src/core/model-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAKN,cAAc,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC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evel } from \"@earendil-works/pi-agent-core\";\nimport {\n\ttype Api,\n\ttype AuthOperationOptions,\n\ttype KnownProvider,\n\ttype Model,\n\tmodelsAreEqual,\n} from \"@earendil-works/pi-ai\";\nimport { minimatch } from \"minimatch\";\nimport { isValidThinkingLevel } from \"../cli/args.ts\";\nimport { DEFAULT_THINKING_LEVEL } from \"./defaults.ts\";\nimport type { ModelRuntime } from \"./model-runtime.ts\";\n\n/** Default chat model IDs for providers with built-in chat models. */\nexport const defaultModelPerProvider: Partial<Record<KnownProvider, string>> = {\n\t\"amazon-bedrock\": \"us.anthropic.claude-opus-5-5\",\n\t\"ant-ling\": \"Ling-3.1-flash\",\n\tanthropic: \"claude-opus-5-5\",\n\topenai: \"gpt-6.2-sol\",\n\tazure: \"gpt-6.2-sol\",\n\t\"openai-codex\": \"gpt-6.2-sol\",\n\tradius: \"balanced\",\n\tnvidia: \"nvidia/nemotron-3.5-super-vl-120b-a12b\",\n\tdeepseek: \"deepseek-v4-pro\",\n\tgoogle: \"gemini-4-argon\",\n\t\"google-vertex\": \"gemini-4-argon\",\n\t\"github-copilot\": \"gpt-6.1-sol\",\n\topenrouter: \"moonshotai/kimi-k2.7-code\",\n\t\"vercel-ai-gateway\": \"zai/glm-5.3\",\n\txai: \"grok-4.7\",\n\tgroq: \"openai/gpt-oss-120b\",\n\tcerebras: \"gpt-oss-120b\",\n\tzai: \"glm-5.3\",\n\t\"zai-coding-cn\": \"glm-5.3\",\n\tmistral: \"mistral-medium-latest\",\n\tminimax: \"MiniMax-M3\",\n\t\"minimax-cn\": \"MiniMax-M3\",\n\tmoonshotai: \"kimi-k2.7-code\",\n\t\"moonshotai-cn\": \"kimi-k2.7-code\",\n\thuggingface: \"moonshotai/Kimi-K2.7-Code\",\n\tfireworks: \"accounts/fireworks/models/kimi-k3\",\n\ttogether: \"moonshotai/Kimi-K3\",\n\tbaseten: \"zai-org/GLM-5.3\",\n\topencode: \"kimi-k2.7-code\",\n\t\"opencode-go\": \"kimi-k3.1-pro\",\n\t\"kimi-coding\": \"kimi-for-coding\",\n\tmeta: \"muse-spark-1.3\",\n\t\"cloudflare-workers-ai\": \"@cf/zai-org/glm-5.3\",\n\t\"cloudflare-ai-gateway\": \"workers-ai/@cf/zai-org/glm-5.3\",\n\t\"qwen-token-plan\": \"qwen3.8-max\",\n\t\"qwen-token-plan-cn\": \"qwen3.8-max\",\n\t\"qwen-token-plan-individual\": \"qwen3.8-max\",\n\t\"qwen-token-plan-individual-cn\": \"qwen3.8-max\",\n\txiaomi: \"mimo-v2.6-pro\",\n\t\"xiaomi-token-plan-cn\": \"mimo-v2.6-pro\",\n\t\"xiaomi-token-plan-ams\": \"mimo-v2.6-pro\",\n\t\"xiaomi-token-plan-sgp\": \"mimo-v2.6-pro\",\n};\n\nexport interface ScopedModel {\n\tmodel: Model<Api>;\n\t/** Thinking level if explicitly specified in pattern (e.g., \"model:high\"), undefined otherwise */\n\tthinkingLevel?: ThinkingLevel;\n}\n\n/*\n * Model reference resolution. Candidates are collected before a provider is chosen, so catalog order\n * never decides the provider and an ambiguous match is reported instead of falling through to a\n * weaker one.\n */\n\nexport interface ModelReferenceRequest {\n\t/** Bare model id or `provider/id`, optionally followed by `:<thinking>`. */\n\ttext: string;\n\t/** Only consider models from this provider. */\n\tprovider?: string;\n\t/**\n\t * A trailing `:<suffix>` is only considered when the full text matches no model, since ids such as\n\t * OpenRouter's `qwen/qwen3-coder:exacto` contain colons.\n\t * - `none`: the suffix stays part of the id\n\t * - `strict`: a valid thinking level is parsed; any other suffix stays part of the id\n\t * - `lenient`: like `strict`, but an invalid suffix is dropped with a warning\n\t */\n\tthinkingSuffix: \"none\" | \"strict\" | \"lenient\";\n\t/** Match id and name substrings when no exact match exists. */\n\tfuzzy: boolean;\n}\n\nexport type ModelReferenceResult =\n\t| { status: \"resolved\"; model: Model<Api>; thinkingLevel?: ThinkingLevel; warning?: string }\n\t| {\n\t\t\tstatus: \"ambiguous\";\n\t\t\tcandidates: Model<Api>[];\n\t\t\tusableCount: number;\n\t\t\tthinkingLevel?: ThinkingLevel;\n\t\t\twarning?: string;\n\t }\n\t| {\n\t\t\tstatus: \"not-found\";\n\t\t\t/** Set when a provider is explicit or named by a `provider/` prefix, for building a custom model id. */\n\t\t\ttarget?: ModelReferenceTarget;\n\t };\n\nexport interface ModelReferenceTarget {\n\tprovider: string;\n\tproviderModels: [Model<Api>, ...Model<Api>[]];\n\t/** Text after the provider prefix as typed, including any `:<suffix>`. */\n\tmodelText: string;\n\t/** `modelText` without a valid thinking suffix (unless `thinkingSuffix` is `none`). */\n\tmodelId: string;\n\tthinkingLevel?: ThinkingLevel;\n}\n\ntype ResolvedOrAmbiguous = Exclude<ModelReferenceResult, { status: \"not-found\" }>;\n\nfunction splitThinkingSuffix(text: string): { base: string; thinkingLevel: ThinkingLevel } | undefined {\n\tconst colonIndex = text.lastIndexOf(\":\");\n\tconst suffix = text.substring(colonIndex + 1);\n\tif (colonIndex === -1 || !isValidThinkingLevel(suffix)) return undefined;\n\treturn { base: text.substring(0, colonIndex), thinkingLevel: suffix };\n}\n\nfunction splitProviderPrefix(\n\ttext: string,\n\tmodels: readonly Model<Api>[],\n): { provider: string; modelText: string } | undefined {\n\t// Provider ids may contain \"/\" themselves (e.g. URL-derived ids), so match known ids, longest first\n\tconst lowerText = text.toLowerCase();\n\tlet best: { provider: string; modelText: string } | undefined;\n\tfor (const { provider } of models) {\n\t\tconst prefix = provider.trim().toLowerCase();\n\t\tif (!prefix || (best && best.provider.length >= provider.length)) continue;\n\t\tconst slashIndex = lowerText.indexOf(\"/\", prefix.length);\n\t\tif (slashIndex === -1 || lowerText.substring(0, slashIndex).trim() !== prefix) continue;\n\t\tconst modelText = text.substring(slashIndex + 1).trim();\n\t\tif (modelText) best = { provider, modelText };\n\t}\n\treturn best;\n}\n\n/**\n * `usable` only breaks ties between providers, so a unique match resolves even without credentials\n * (`--api-key` first-time setup).\n */\nexport function resolveModelReference(\n\trequest: ModelReferenceRequest,\n\tmodels: readonly Model<Api>[],\n\tusable: (provider: string) => boolean,\n): ModelReferenceResult {\n\tconst text = request.text.trim();\n\tif (!text) return { status: \"not-found\" };\n\tconst constraint = request.provider?.toLowerCase();\n\tconst pool = constraint ? models.filter((model) => model.provider.toLowerCase() === constraint) : models;\n\tconst result = resolveText(text, request, pool, usable);\n\tif (result.status !== \"not-found\") return result;\n\n\tconst split = splitProviderPrefix(text, pool);\n\tconst anchor = constraint ? pool[0] : pool.find((model) => model.provider === split?.provider);\n\tif (!anchor) return result;\n\tconst modelText = split?.modelText ?? text;\n\tconst suffix = request.thinkingSuffix === \"none\" ? undefined : splitThinkingSuffix(modelText);\n\treturn {\n\t\tstatus: \"not-found\",\n\t\ttarget: {\n\t\t\tprovider: anchor.provider,\n\t\t\tproviderModels: [anchor, ...pool.filter((model) => model.provider === anchor.provider && model !== anchor)],\n\t\t\tmodelText,\n\t\t\tmodelId: suffix?.base ?? modelText,\n\t\t\tthinkingLevel: suffix?.thinkingLevel,\n\t\t},\n\t};\n}\n\n/** Exact `provider/id` or bare id lookup without thinking suffixes or fuzzy matching. */\nexport function findExactModelReferenceMatch(\n\tmodelReference: string,\n\tmodels: readonly Model<Api>[],\n): Model<Api> | undefined {\n\tconst result = resolveModelReference(\n\t\t{ text: modelReference, thinkingSuffix: \"none\", fuzzy: false },\n\t\tmodels,\n\t\t() => true,\n\t);\n\treturn result.status === \"resolved\" ? result.model : undefined;\n}\n\nfunction resolveText(\n\ttext: string,\n\trequest: ModelReferenceRequest,\n\tpool: readonly Model<Api>[],\n\tusable: (provider: string) => boolean,\n): ModelReferenceResult {\n\tconst reference = selectReference(text, pool, request.fuzzy, usable);\n\tif (reference) return reference;\n\n\tif (request.fuzzy) {\n\t\tconst fuzzy = selectFuzzy(fuzzyMatches(text, pool), usable);\n\t\tif (fuzzy) return fuzzy;\n\t}\n\n\tif (request.thinkingSuffix === \"none\") return { status: \"not-found\" };\n\tconst thinking = splitThinkingSuffix(text);\n\tif (thinking) {\n\t\tconst inner = resolveText(thinking.base, request, pool, usable);\n\t\tif (inner.status === \"not-found\") return inner;\n\t\t// Only use this thinking level if no warning from inner recursion\n\t\treturn { ...inner, thinkingLevel: inner.warning ? undefined : thinking.thinkingLevel };\n\t}\n\t// Keep an invalid suffix as part of the id and fail, rather than resolve a different model\n\tif (request.thinkingSuffix === \"strict\") return { status: \"not-found\" };\n\tconst colonIndex = text.lastIndexOf(\":\");\n\tif (colonIndex === -1) return { status: \"not-found\" };\n\n\tconst suffix = text.substring(colonIndex + 1);\n\tconst inner = resolveText(text.substring(0, colonIndex), request, pool, usable);\n\tif (inner.status === \"not-found\") return inner;\n\treturn {\n\t\t...inner,\n\t\tthinkingLevel: undefined,\n\t\twarning: `Invalid thinking level \"${suffix}\" in pattern \"${text}\". Using default instead.`,\n\t};\n}\n\n/**\n * `provider/rest` is only a hint: the whole text may also be a model id on another provider, such as\n * gateway id `zai/glm-5` or commandcode id `xiaomi/mimo-v2.6-pro`. The named provider wins when usable,\n * since that is what the syntax usually means; otherwise a sole usable raw match wins, since the named\n * provider could not serve the request. An unusable named match is still preferred over unusable raw\n * matches, so `--api-key` can set up the named provider.\n */\nfunction selectReference(\n\ttext: string,\n\tpool: readonly Model<Api>[],\n\tfuzzy: boolean,\n\tusable: (provider: string) => boolean,\n): ResolvedOrAmbiguous | undefined {\n\tconst lowerText = text.toLowerCase();\n\tconst raw = pool.filter((model) => model.id.toLowerCase() === lowerText);\n\tconst split = splitProviderPrefix(text, pool);\n\tlet named: Model<Api> | undefined;\n\tif (split) {\n\t\tconst providerModels = pool.filter((model) => model.provider === split.provider);\n\t\tconst lowerModelText = split.modelText.toLowerCase();\n\t\t// The provider's own literal id (OpenRouter's `openrouter/free`) beats its fuzzy matches\n\t\tnamed =\n\t\t\tproviderModels.find((model) => model.id.toLowerCase() === lowerModelText) ??\n\t\t\traw.find((model) => model.provider === split.provider) ??\n\t\t\t(fuzzy ? bestFuzzyMatch(fuzzyMatches(split.modelText, providerModels)) : undefined);\n\t}\n\n\tconst others = raw.filter((model) => model !== named);\n\tconst candidates = named ? [named, ...others] : others;\n\tif (candidates.length === 0) return undefined;\n\tif (new Set(candidates.map((model) => model.provider)).size === 1)\n\t\treturn { status: \"resolved\", model: candidates[0] };\n\tif (named && usable(named.provider)) return { status: \"resolved\", model: named };\n\tconst usableOthers = others.filter((model) => usable(model.provider));\n\tif (usableOthers.length === 1) return { status: \"resolved\", model: usableOthers[0] };\n\tif (usableOthers.length === 0 && named) return { status: \"resolved\", model: named };\n\treturn { status: \"ambiguous\", candidates, usableCount: usableOthers.length };\n}\n\nfunction fuzzyMatches(text: string, models: readonly Model<Api>[]): Model<Api>[] {\n\tconst lowerText = text.toLowerCase();\n\treturn models.filter(\n\t\t(model) => model.id.toLowerCase().includes(lowerText) || model.name?.toLowerCase().includes(lowerText),\n\t);\n}\n\nfunction selectFuzzy(matches: Model<Api>[], usable: (provider: string) => boolean): ResolvedOrAmbiguous | undefined {\n\tif (matches.length === 0) return undefined;\n\tconst multipleProviders = new Set(matches.map((model) => model.provider)).size > 1;\n\tconst usableMatches = multipleProviders ? matches.filter((model) => usable(model.provider)) : [];\n\tconst pool = usableMatches.length > 0 ? usableMatches : matches;\n\tconst best = bestFuzzyMatch(pool);\n\tif (!best) return undefined;\n\t// The same id on several providers would otherwise be decided by catalog order\n\tconst tied = pool.filter((model) => model.id === best.id);\n\tif (new Set(tied.map((model) => model.provider)).size === 1) return { status: \"resolved\", model: best };\n\treturn {\n\t\tstatus: \"ambiguous\",\n\t\tcandidates: tied,\n\t\tusableCount: usableMatches.length > 0 ? tied.length : 0,\n\t};\n}\n\n/** Prefer aliases (`claude-sonnet-4-5`) over dated versions (`claude-sonnet-4-5-20250929`), then the latest. */\nfunction bestFuzzyMatch(matches: readonly Model<Api>[]): Model<Api> | undefined {\n\tconst aliases = matches.filter((model) => isAlias(model.id));\n\treturn [...(aliases.length > 0 ? aliases : matches)].sort((a, b) => b.id.localeCompare(a.id))[0];\n}\n\nfunction isAlias(id: string): boolean {\n\treturn id.endsWith(\"-latest\") || !/-\\d{8}$/.test(id);\n}\n\nfunction buildFallbackModel(providerModels: [Model<Api>, ...Model<Api>[]], modelId: string): Model<Api> {\n\tconst defaultId = defaultModelPerProvider[providerModels[0].provider as KnownProvider];\n\tconst baseModel = defaultId\n\t\t? (providerModels.find((m) => m.id === defaultId) ?? providerModels[0])\n\t\t: providerModels[0];\n\n\treturn {\n\t\t...baseModel,\n\t\tid: modelId,\n\t\tname: modelId,\n\t};\n}\n\nexport interface ModelScopeDiagnostic {\n\ttype: \"warning\";\n\tcode: \"no-match\" | \"invalid-thinking-level\" | \"ambiguous\";\n\tmessage: string;\n\tpattern: string;\n}\n\nexport interface ResolveModelScopeResult {\n\tscopedModels: ScopedModel[];\n\tdiagnostics: ModelScopeDiagnostic[];\n}\n\n/**\n * Resolve scope patterns (`--models`, `enabledModels`) to models with optional thinking levels.\n *\n * Every model in `models` is usable, so credentials cannot choose between providers offering the same\n * id. All of them are added, with a warning so the user can pick one with `provider/id`.\n */\nexport function resolveModelScopeFromModels(\n\tpatterns: string[],\n\tmodels: readonly Model<Api>[],\n): ResolveModelScopeResult {\n\tconst scopedModels: ScopedModel[] = [];\n\tconst diagnostics: ModelScopeDiagnostic[] = [];\n\tconst add = (model: Model<Api>, thinkingLevel: ThinkingLevel | undefined) => {\n\t\tif (!scopedModels.some((scoped) => modelsAreEqual(scoped.model, model))) {\n\t\t\tscopedModels.push({ model, thinkingLevel });\n\t\t}\n\t};\n\tconst noMatch = (pattern: string) =>\n\t\tdiagnostics.push({ type: \"warning\", code: \"no-match\", message: `No models match pattern \"${pattern}\"`, pattern });\n\tconst ambiguous = (pattern: string, candidates: readonly Model<Api>[]) => {\n\t\tconst providers = [...new Set(candidates.map((m) => m.provider))].sort((a, b) => a.localeCompare(b));\n\t\tdiagnostics.push({\n\t\t\ttype: \"warning\",\n\t\t\tcode: \"ambiguous\",\n\t\t\tmessage: `Pattern \"${pattern}\" matches several providers: ${providers.join(\", \")}. Use provider/id to choose one.`,\n\t\t\tpattern,\n\t\t});\n\t};\n\n\tfor (const pattern of patterns) {\n\t\t// Check if pattern contains glob characters\n\t\tif (pattern.includes(\"*\") || pattern.includes(\"?\") || pattern.includes(\"[\")) {\n\t\t\t// Extract optional thinking level suffix (e.g., \"provider/*:high\")\n\t\t\tconst thinking = splitThinkingSuffix(pattern);\n\t\t\tconst globPattern = thinking?.base ?? pattern;\n\t\t\tconst thinkingLevel = thinking?.thinkingLevel;\n\n\t\t\t// Ids such as `bracketed-model[1m]` are not globs\n\t\t\tconst exact = resolveModelReference(\n\t\t\t\t{ text: globPattern, thinkingSuffix: \"none\", fuzzy: false },\n\t\t\t\tmodels,\n\t\t\t\t() => true,\n\t\t\t);\n\t\t\tlet matches: readonly Model<Api>[] = [];\n\t\t\tif (exact.status === \"resolved\") matches = [exact.model];\n\t\t\telse if (exact.status === \"ambiguous\") {\n\t\t\t\tmatches = exact.candidates;\n\t\t\t\tambiguous(pattern, matches);\n\t\t\t} else {\n\t\t\t\t// Match against \"provider/modelId\" format OR just model ID\n\t\t\t\t// This allows \"*sonnet*\" to match without requiring \"anthropic/*sonnet*\"\n\t\t\t\tmatches = models.filter(\n\t\t\t\t\t(m) =>\n\t\t\t\t\t\tminimatch(`${m.provider}/${m.id}`, globPattern, { nocase: true }) ||\n\t\t\t\t\t\tminimatch(m.id, globPattern, { nocase: true }),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (matches.length === 0) noMatch(pattern);\n\t\t\tfor (const model of matches) add(model, thinkingLevel);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst result = resolveModelReference(\n\t\t\t{ text: pattern, thinkingSuffix: \"lenient\", fuzzy: true },\n\t\t\tmodels,\n\t\t\t() => true,\n\t\t);\n\t\tif (result.status === \"not-found\") {\n\t\t\tnoMatch(pattern);\n\t\t\tcontinue;\n\t\t}\n\t\tif (result.warning) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"invalid-thinking-level\", message: result.warning, pattern });\n\t\t}\n\t\tif (result.status === \"ambiguous\") ambiguous(pattern, result.candidates);\n\t\tconst matches = result.status === \"resolved\" ? [result.model] : result.candidates;\n\t\tfor (const model of matches) add(model, result.thinkingLevel);\n\t}\n\n\treturn { scopedModels, diagnostics };\n}\n\nexport async function resolveModelScopeWithDiagnostics(\n\tpatterns: string[],\n\tmodelRuntime: ModelRuntime,\n\toptions?: AuthOperationOptions,\n): Promise<ResolveModelScopeResult> {\n\treturn resolveModelScopeFromModels(patterns, await modelRuntime.getAvailable(undefined, options));\n}\n\nexport interface ResolveCliModelResult {\n\tmodel: Model<Api> | undefined;\n\tthinkingLevel?: ThinkingLevel;\n\twarning: string | undefined;\n\t/**\n\t * Error message suitable for CLI display.\n\t * When set, model will be undefined.\n\t */\n\terror: string | undefined;\n}\n\n/**\n * Resolve a single model from CLI flags.\n *\n * Supports:\n * - --provider <provider> --model <pattern>\n * - --model <provider>/<pattern>\n * - Fuzzy matching (same rules as model scoping: exact id, then partial id/name)\n *\n * Note: This does not apply the thinking level by itself, but it may *parse* and\n * return a thinking level from \"<pattern>:<thinking>\" so the caller can apply it.\n */\nexport function resolveCliModel(options: {\n\tcliProvider?: string;\n\tcliModel?: string;\n\tcliThinking?: ThinkingLevel;\n\t/** `--api-key` was supplied for the selected provider. */\n\tinlineApiKey?: boolean;\n\tmodelRuntime: ModelRuntime;\n}): ResolveCliModelResult {\n\tconst { cliProvider, cliModel, cliThinking, inlineApiKey, modelRuntime } = options;\n\n\tif (!cliModel) {\n\t\treturn { model: undefined, warning: undefined, error: undefined };\n\t}\n\n\t// Important: use *all* models here, not just models with pre-configured auth.\n\t// This allows \"--api-key\" to be used for first-time setup.\n\tconst models = [...modelRuntime.getModels()];\n\tif (models.length === 0) {\n\t\treturn {\n\t\t\tmodel: undefined,\n\t\t\twarning: undefined,\n\t\t\terror: \"No models available. Check your installation or add models to models.json.\",\n\t\t};\n\t}\n\n\tconst provider = cliProvider\n\t\t? models.find((m) => m.provider.toLowerCase() === cliProvider.toLowerCase())?.provider\n\t\t: undefined;\n\tif (cliProvider && !provider) {\n\t\treturn {\n\t\t\tmodel: undefined,\n\t\t\twarning: undefined,\n\t\t\terror: `Unknown provider \"${cliProvider}\". Use --list-models to see available providers/models.`,\n\t\t};\n\t}\n\n\tconst result = resolveModelReference(\n\t\t{ text: cliModel, provider, thinkingSuffix: \"strict\", fuzzy: true },\n\t\tmodels,\n\t\t// An inline key goes to whichever provider is selected, so stored credentials must not choose it\n\t\tinlineApiKey ? () => false : (providerId) => modelRuntime.hasConfiguredAuth(providerId),\n\t);\n\tif (result.status === \"resolved\") {\n\t\treturn { model: result.model, thinkingLevel: result.thinkingLevel, warning: result.warning, error: undefined };\n\t}\n\tif (result.status === \"ambiguous\") {\n\t\tconst matches = result.candidates\n\t\t\t.map((m) => `${m.provider}/${m.id}`)\n\t\t\t.sort((a, b) => a.localeCompare(b))\n\t\t\t.join(\", \");\n\t\tconst authHint = inlineApiKey\n\t\t\t? \"--api-key does not choose a provider.\"\n\t\t\t: result.usableCount === 0\n\t\t\t\t? \"No matching provider is authenticated.\"\n\t\t\t\t: \"More than one matching provider is authenticated.\";\n\t\treturn {\n\t\t\tmodel: undefined,\n\t\t\twarning: undefined,\n\t\t\terror: `Model \"${cliModel}\" is ambiguous across providers: ${matches}. ${authHint} Use --provider or provider/model.`,\n\t\t};\n\t}\n\n\tconst { target } = result;\n\tif (!target) {\n\t\treturn {\n\t\t\tmodel: undefined,\n\t\t\twarning: undefined,\n\t\t\terror: `Model \"${cliModel}\" not found. Use --list-models to see available models.`,\n\t\t};\n\t}\n\n\t// Use the thinking level suffix only when --thinking is not explicitly provided; otherwise it\n\t// stays part of the custom model id.\n\t// e.g. \"zai-org/GLM-5.1-FP8:high\" → modelId=\"zai-org/GLM-5.1-FP8\", fallbackThinking=\"high\"\n\tconst modelId = cliThinking ? target.modelText : target.modelId;\n\tconst fallbackThinking = cliThinking ? undefined : target.thinkingLevel;\n\tconst fallbackModel = buildFallbackModel(target.providerModels, modelId);\n\tconst requestedThinking = cliThinking ?? fallbackThinking;\n\treturn {\n\t\tmodel: requestedThinking && requestedThinking !== \"off\" ? { ...fallbackModel, reasoning: true } : fallbackModel,\n\t\tthinkingLevel: fallbackThinking,\n\t\twarning: `Model \"${modelId}\" not found for provider \"${target.provider}\". Using custom model id.`,\n\t\terror: undefined,\n\t};\n}\n\nexport interface InitialModelResult {\n\tmodel: Model<Api> | undefined;\n\tthinkingLevel: ThinkingLevel;\n\tfallbackMessage: string | undefined;\n}\n\n/**\n * Find the initial model to use based on priority:\n * 1. First model from scoped models (if not continuing/resuming)\n * 2. Saved default from settings\n * 3. First available model with valid API key\n */\nexport async function findInitialModel(options: {\n\tscopedModels: ScopedModel[];\n\tisContinuing: boolean;\n\tdefaultProvider?: string;\n\tdefaultModelId?: string;\n\tdefaultThinkingLevel?: ThinkingLevel;\n\tmodelThinkingLevels?: Record<string, ThinkingLevel>;\n\tmodelRuntime: ModelRuntime;\n}): Promise<InitialModelResult> {\n\tconst {\n\t\tscopedModels,\n\t\tisContinuing,\n\t\tdefaultProvider,\n\t\tdefaultModelId,\n\t\tdefaultThinkingLevel,\n\t\tmodelThinkingLevels,\n\t\tmodelRuntime,\n\t} = options;\n\n\tlet model: Model<Api> | undefined;\n\tlet thinkingLevel: ThinkingLevel = DEFAULT_THINKING_LEVEL;\n\n\t// 1. Use first model from scoped models (skip if continuing/resuming)\n\tif (scopedModels.length > 0 && !isContinuing) {\n\t\tconst scopedModel = scopedModels[0];\n\t\tconst perModel = modelThinkingLevels?.[`${scopedModel.model.provider}/${scopedModel.model.id}`];\n\t\treturn {\n\t\t\tmodel: scopedModel.model,\n\t\t\tthinkingLevel: scopedModel.thinkingLevel ?? perModel ?? defaultThinkingLevel ?? DEFAULT_THINKING_LEVEL,\n\t\t\tfallbackMessage: undefined,\n\t\t};\n\t}\n\n\t// 2. Try saved default from settings if auth is configured.\n\tif (defaultProvider && defaultModelId) {\n\t\tconst found = modelRuntime.getModel(defaultProvider, defaultModelId);\n\t\tif (found && modelRuntime.hasConfiguredAuth(found.provider)) {\n\t\t\tmodel = found;\n\t\t\tconst perModel = modelThinkingLevels?.[`${defaultProvider}/${defaultModelId}`];\n\t\t\tif (perModel) {\n\t\t\t\tthinkingLevel = perModel;\n\t\t\t} else if (defaultThinkingLevel) {\n\t\t\t\tthinkingLevel = defaultThinkingLevel;\n\t\t\t}\n\t\t\treturn { model, thinkingLevel, fallbackMessage: undefined };\n\t\t}\n\t}\n\n\t// 3. Try first available model with valid API key\n\tconst availableModels = [...modelRuntime.getAvailableSnapshot()];\n\n\tif (availableModels.length > 0) {\n\t\t// Try to find a default model from known providers\n\t\tfor (const provider of Object.keys(defaultModelPerProvider) as KnownProvider[]) {\n\t\t\tconst defaultId = defaultModelPerProvider[provider];\n\t\t\tconst match = availableModels.find((m) => m.provider === provider && m.id === defaultId);\n\t\t\tif (match) {\n\t\t\t\treturn { model: match, thinkingLevel: DEFAULT_THINKING_LEVEL, fallbackMessage: undefined };\n\t\t\t}\n\t\t}\n\n\t\t// If no default found, use first available\n\t\treturn { model: availableModels[0], thinkingLevel: DEFAULT_THINKING_LEVEL, fallbackMessage: undefined };\n\t}\n\n\t// 4. No model found\n\treturn { model: undefined, thinkingLevel: DEFAULT_THINKING_LEVEL, fallbackMessage: undefined };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-runtime.d.ts","sourceRoot":"","sources":["../../src/core/model-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,GAAG,EAER,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAEpB,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,cA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,EAAE,WAAW,CAAC;QACrB,MAAM,CAAC,EAAE,gBAAgB,CAAC;QAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;KAChB,GACC,OAAO,CAAC,UAAU,CAAC,CAqBrB;IAED,gDAAgD;IAChD,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAG5E;CACD"}
|
|
@@ -448,8 +448,12 @@ export class ModelRuntime {
|
|
|
448
448
|
getProviderAuthStatus(providerId) {
|
|
449
449
|
if (this.credentials.hasRuntimeApiKey(providerId))
|
|
450
450
|
return { configured: true, source: "runtime" };
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
// A stored credential owns the provider, so it is configured only when it resolves. A failing
|
|
452
|
+
// `!command` key leaves it unresolved, and requests fail with it (#12164). The source still says
|
|
453
|
+
// that a stored credential exists, so the UI can tell this apart from no credential at all.
|
|
454
|
+
if (this.snapshot.storedProviders.has(providerId)) {
|
|
455
|
+
return { configured: this.snapshot.configuredProviders.has(providerId), source: "stored" };
|
|
456
|
+
}
|
|
453
457
|
const configured = configuredRequestAuthStatus(this.config.getProvider(providerId), this.extensionProviders.get(providerId));
|
|
454
458
|
if (configured)
|
|
455
459
|
return configured;
|