@punch-bot/cli 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +2 -2
  3. package/dist/bundle/chunks/{chunk-6WNF4BLC.js → chunk-LP6WVVUV.js} +1 -1
  4. package/dist/bundle/chunks/{chunk-6YKFJ7FQ.js → chunk-MCGQGCDS.js} +5 -5
  5. package/dist/bundle/chunks/github-copilot.js +1 -1
  6. package/dist/bundle/chunks/{virtual-modules-GZVZPCK3.js → virtual-modules-WOHWUS3S.js} +1 -1
  7. package/dist/bundle/cli-runtime.js +1 -1
  8. package/dist/bundle/index.js +1 -1
  9. package/dist/bundle/rpc-entry.js +1 -1
  10. package/dist/core/model-resolver.js +1 -1
  11. package/dist/core/model-resolver.js.map +1 -1
  12. package/dist/core/system-prompt.d.ts +1 -1
  13. package/dist/core/system-prompt.d.ts.map +1 -1
  14. package/dist/core/system-prompt.js +8 -9
  15. package/dist/core/system-prompt.js.map +1 -1
  16. package/docs/cli.md +1 -1
  17. package/docs/configuration.md +2 -2
  18. package/docs/usage.md +4 -2
  19. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  20. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  21. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  22. package/examples/extensions/gondolin/package-lock.json +2 -2
  23. package/examples/extensions/gondolin/package.json +1 -1
  24. package/examples/extensions/sandbox/package-lock.json +2 -2
  25. package/examples/extensions/sandbox/package.json +1 -1
  26. package/examples/extensions/with-deps/package-lock.json +2 -2
  27. package/examples/extensions/with-deps/package.json +1 -1
  28. package/examples/sdk/03-custom-prompt.ts +1 -1
  29. package/npm-shrinkwrap.json +21 -21
  30. package/package.json +7 -7
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- var github_copilot_default={"anthropic-messages":{"chat:claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},thinkingLevelMap:{off:null,xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-fable-5.1":{id:"claude-fable-5.1",name:"Claude Fable 5.1",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:.25,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},thinkingLevelMap:{off:null,xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-haiku-5.5":{id:"claude-haiku-5.5",name:"Claude Haiku 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:1e5,input:.5,output:2.5,cacheRead:.05,cacheWrite:.625}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-4.7":{id:"claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:32e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-4.8":{id:"claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5":{id:"claude-opus-5",name:"Claude Opus 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5.5":{id:"claude-opus-5.5",name:"Claude Opus 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.2,cacheWrite:5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:32e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{max:"max",minimal:"low"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5":{id:"claude-sonnet-5",name:"Claude Sonnet 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{xhigh:"xhigh",max:"max"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5.5":{id:"claude-sonnet-5.5",name:"Claude Sonnet 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-completions":{"chat:gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:2e5,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-3.6-flash":{id:"gemini-3.6-flash",name:"Gemini 3.6 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.75,cacheRead:.075,cacheWrite:0},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-3.7-flash":{id:"gemini-3.7-flash",name:"Gemini 3.7 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.75,cacheRead:.075,cacheWrite:0},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-3.8-flash":{id:"gemini-3.8-flash",name:"Gemini 3.8 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.75,cacheRead:.075,cacheWrite:0},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-4-argon":{id:"gemini-4-argon",name:"Gemini 4 Argon",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:0},contextWindow:1048576,maxTokens:65536,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:kimi-k2.7-code":{id:"kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:256e3,maxTokens:32e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:kimi-k3":{id:"kimi-k3",name:"Kimi K3",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:0},contextWindow:1048576,maxTokens:131072,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-responses":{"chat:gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:264e3,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0,tiers:[{inputTokensAbove:272e3,input:5,output:22.5,cacheRead:.5,cacheWrite:0}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:272e3,input:10,output:45,cacheRead:1,cacheWrite:0}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-luna":{id:"gpt-5.6-luna",name:"GPT-5.6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25,tiers:[{inputTokensAbove:2e5,input:.4,output:1.8,cacheRead:.04,cacheWrite:.5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-sol":{id:"gpt-5.6-sol",name:"GPT-5.6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.4,cacheWrite:5,tiers:[{inputTokensAbove:272e3,input:8,output:30,cacheRead:.8,cacheWrite:10}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-terra":{id:"gpt-5.6-terra",name:"GPT-5.6 Terra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:18,cacheRead:.4,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-astra":{id:"gpt-6-astra",name:"GPT-6 Astra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5,tiers:[{inputTokensAbove:272e3,input:20,output:75,cacheRead:2,cacheWrite:25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-luna":{id:"gpt-6-luna",name:"GPT-6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:272e3,input:.2,output:.75,cacheRead:.02,cacheWrite:.25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-sol":{id:"gpt-6-sol",name:"GPT-6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.4,cacheWrite:5}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6.1-sol":{id:"gpt-6.1-sol",name:"GPT-6.1 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.2,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.5":{id:"grok-4.5",name:"Grok 4.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.6":{id:"grok-4.6",name:"Grok 4.6",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.7":{id:"grok-4.7",name:"Grok 4.7",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:mai-code-1-flash-picker":{id:"mai-code-1-flash-picker",name:"MAI-Code-1-Flash",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:256e3,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},type:"chat"},"chat:mai-code-1.1-flash":{id:"mai-code-1.1-flash",name:"MAI-Code-1.1-Flash",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}}};function flattenModelCatalog(groups,type){return Object.fromEntries(Object.values(groups).flatMap(models=>Object.values(models)).filter(model=>model.type===type).map(model=>[model.id,model]))}function flattenChatModelCatalog(_provider,groups){return flattenModelCatalog(groups,"chat")}function flattenImageModelCatalog(_provider,groups){return flattenModelCatalog(groups,"image")}function flattenClassifierModelCatalog(_provider,groups){return flattenModelCatalog(groups,"classifier")}var GITHUB_COPILOT_MODELS=flattenChatModelCatalog("github-copilot",github_copilot_default),GITHUB_COPILOT_IMAGE_MODELS=flattenImageModelCatalog("github-copilot",github_copilot_default),GITHUB_COPILOT_CLASSIFIER_MODELS=flattenClassifierModelCatalog("github-copilot",github_copilot_default);function sleep(ms,signal){return new Promise((resolve,reject)=>{signal.throwIfAborted();let onAbort=()=>{clearTimeout(timeout),reject(signal.reason)},timeout=setTimeout(()=>{signal.removeEventListener("abort",onAbort),resolve()},ms);signal.addEventListener("abort",onAbort,{once:!0})})}var CANCEL_MESSAGE="Login cancelled",TIMEOUT_MESSAGE="Device flow timed out",SLOW_DOWN_TIMEOUT_MESSAGE="Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.";function abortableSleep(ms,signal,cancelMessage){return new Promise((resolve,reject)=>{if(signal.aborted){reject(new Error(cancelMessage));return}let onAbort=()=>{clearTimeout(timeout),reject(new Error(cancelMessage))},timeout=setTimeout(()=>{signal.removeEventListener("abort",onAbort),resolve()},ms);signal.addEventListener("abort",onAbort,{once:!0})})}async function pollOAuthDeviceCodeFlow(options){let deadline=typeof options.expiresInSeconds=="number"?Date.now()+options.expiresInSeconds*1e3:Number.POSITIVE_INFINITY,intervalMs=Math.max(1e3,Math.floor((options.intervalSeconds??5)*1e3)),slowDownResponses=0;if(options.waitBeforeFirstPoll){let remainingMs=deadline-Date.now();remainingMs>0&&await abortableSleep(Math.min(intervalMs,remainingMs),options.signal,CANCEL_MESSAGE)}for(;Date.now()<deadline;){if(options.signal.aborted)throw new Error(CANCEL_MESSAGE);let result=await options.poll();if(result.status==="complete")return result.value;if(result.status==="failed")throw new Error(result.message);result.status==="slow_down"&&(slowDownResponses+=1,intervalMs=typeof result.intervalSeconds=="number"&&Number.isFinite(result.intervalSeconds)&&result.intervalSeconds>0?Math.max(1e3,Math.floor(result.intervalSeconds*1e3)):Math.max(1e3,intervalMs+5e3));let remainingMs=deadline-Date.now();if(remainingMs<=0)break;await abortableSleep(Math.min(intervalMs,remainingMs),options.signal,CANCEL_MESSAGE)}throw new Error(slowDownResponses>0?SLOW_DOWN_TIMEOUT_MESSAGE:TIMEOUT_MESSAGE)}var decode=s=>atob(s),CLIENT_ID=decode("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),COPILOT_HEADERS={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},COPILOT_API_VERSION="2026-06-01";function normalizeDomain(input){let trimmed=input.trim();if(!trimmed)return null;try{return(trimmed.includes("://")?new URL(trimmed):new URL(`https://${trimmed}`)).hostname}catch{return null}}function getUrls(domain){return{deviceCodeUrl:`https://${domain}/login/device/code`,accessTokenUrl:`https://${domain}/login/oauth/access_token`,copilotTokenUrl:`https://api.${domain}/copilot_internal/v2/token`}}function getBaseUrlFromToken(token){let match=token.match(/proxy-ep=([^;]+)/);return match?`https://${match[1].replace(/^proxy\./,"api.")}`:null}function getGitHubCopilotBaseUrl(token,enterpriseDomain){if(token){let urlFromToken=getBaseUrlFromToken(token);if(urlFromToken)return urlFromToken}return enterpriseDomain?`https://copilot-api.${enterpriseDomain}`:"https://api.individual.githubcopilot.com"}function asRecord(value){return value&&typeof value=="object"?value:void 0}function parseGitHubCopilotModelCatalog(raw,allowPolicyFallback){let data=asRecord(raw)?.data;if(!Array.isArray(data))throw new Error("Invalid Copilot models response");let accountModels=data.flatMap(rawItem=>{let item=asRecord(rawItem),id=item?.id;if(!item||typeof id!="string")return[];let capabilities=asRecord(item.capabilities);return asRecord(capabilities?.supports)?.tool_calls===!1?[]:[{id,pickerEnabled:item.model_picker_enabled===!0,policyState:asRecord(item.policy)?.state}]}),pickerModelIds=accountModels.filter(model=>model.pickerEnabled&&model.policyState!=="disabled").map(model=>model.id),usePolicyFallback=allowPolicyFallback&&pickerModelIds.length===0,availableModelIds=pickerModelIds.length>0||!allowPolicyFallback?pickerModelIds:accountModels.filter(model=>model.policyState==="enabled").map(model=>model.id),policyModelIds=accountModels.filter(model=>model.policyState==="unconfigured"&&Object.hasOwn(GITHUB_COPILOT_MODELS,model.id)&&(model.pickerEnabled||usePolicyFallback)).map(model=>model.id);return{availableModelIds,policyModelIds}}async function fetchWithRateLimitRetry(url,init,signal,retryPolicy){let retryBudgetSignal=retryPolicy.maxRetries>0&&retryPolicy.maxElapsedMs>0?AbortSignal.timeout(retryPolicy.maxElapsedMs):void 0,requestSignal=retryBudgetSignal?AbortSignal.any([signal,retryBudgetSignal]):signal,retryDeadline=retryBudgetSignal?Date.now()+retryPolicy.maxElapsedMs:void 0;for(let retry=0;;retry++){let response=await fetch(url,{...init,signal:AbortSignal.any([requestSignal,AbortSignal.timeout(5e3)])});if(response.status!==429||retry===retryPolicy.maxRetries)return response;let retryAfter=response.headers.get("retry-after"),delayMs=500*2**retry;if(retryAfter){let seconds=Number.parseFloat(retryAfter);if(delayMs=Number.isNaN(seconds)?Date.parse(retryAfter)-Date.now():seconds*1e3,!Number.isFinite(delayMs))return response}if(delayMs=Math.max(0,delayMs),retryDeadline!==void 0&&delayMs>=retryDeadline-Date.now())return response;await response.body?.cancel(),await sleep(delayMs,requestSignal)}}async function fetchGitHubCopilotModels(copilotToken,enterpriseDomain,signal,retryPolicy){let baseUrl=getGitHubCopilotBaseUrl(copilotToken,enterpriseDomain),allowPolicyFallback=baseUrl==="https://api.individual.githubcopilot.com",response=await fetchWithRateLimitRetry(`${baseUrl}/models`,{headers:{Accept:"application/json",Authorization:`Bearer ${copilotToken}`,...COPILOT_HEADERS,"X-GitHub-Api-Version":COPILOT_API_VERSION}},signal,retryPolicy);if(!response.ok)throw new Error(`${response.status} ${response.statusText}: ${await response.text()}`);return parseGitHubCopilotModelCatalog(await response.json(),allowPolicyFallback)}async function fetchJson(url,init){let response=await fetch(url,init);if(!response.ok){let text=await response.text();throw new Error(`${response.status} ${response.statusText}: ${text}`)}return response.json()}async function startDeviceFlow(domain,signal){let urls=getUrls(domain),data=await fetchJson(urls.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:CLIENT_ID,scope:"read:user"}),signal});if(!data||typeof data!="object")throw new Error("Invalid device code response");let deviceCode=data.device_code,userCode=data.user_code,verificationUri=data.verification_uri,interval=data.interval,expiresIn=data.expires_in;if(typeof deviceCode!="string"||typeof userCode!="string"||typeof verificationUri!="string"||interval!==void 0&&typeof interval!="number"||typeof expiresIn!="number")throw new Error("Invalid device code response fields");let parsedUri;try{parsedUri=new URL(verificationUri)}catch{throw new Error("Untrusted verification_uri in device code response")}if(parsedUri.protocol!=="https:"&&parsedUri.protocol!=="http:")throw new Error("Untrusted verification_uri in device code response");return{device_code:deviceCode,user_code:userCode,verification_uri:parsedUri.href,interval,expires_in:expiresIn}}async function pollForGitHubAccessToken(domain,device,signal){let urls=getUrls(domain);return pollOAuthDeviceCodeFlow({intervalSeconds:device.interval,expiresInSeconds:device.expires_in,waitBeforeFirstPoll:!0,signal,poll:async()=>{let raw=await fetchJson(urls.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:CLIENT_ID,device_code:device.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal});if(raw&&typeof raw=="object"&&typeof raw.access_token=="string")return{status:"complete",value:raw.access_token};if(raw&&typeof raw=="object"&&typeof raw.error=="string"){let{error,error_description:description,interval}=raw;if(error==="authorization_pending")return{status:"pending"};if(error==="slow_down")return{status:"slow_down",intervalSeconds:typeof interval=="number"?interval:void 0};let descriptionSuffix=description?`: ${description}`:"";return{status:"failed",message:`Device flow failed: ${error}${descriptionSuffix}`}}return{status:"failed",message:"Invalid device token response"}}})}async function refreshGitHubCopilotAccessToken(refreshToken,enterpriseDomain,signal){let urls=getUrls(enterpriseDomain||"github.com"),raw=await fetchJson(urls.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${refreshToken}`,...COPILOT_HEADERS},signal});if(!raw||typeof raw!="object")throw new Error("Invalid Copilot token response");let token=raw.token,expiresAt=raw.expires_at;if(typeof token!="string"||typeof expiresAt!="number")throw new Error("Invalid Copilot token response fields");return{type:"oauth",refresh:refreshToken,access:token,expires:expiresAt*1e3-300*1e3,enterpriseUrl:enterpriseDomain}}async function refreshGitHubCopilotToken(refreshToken,enterpriseDomain,signal){let credentials=await refreshGitHubCopilotAccessToken(refreshToken,enterpriseDomain,signal),{availableModelIds}=await fetchGitHubCopilotModels(credentials.access,enterpriseDomain,signal,{maxRetries:0,maxElapsedMs:0});return{...credentials,availableModelIds}}async function enableGitHubCopilotModel(token,modelId,enterpriseDomain,signal){let url=`${getGitHubCopilotBaseUrl(token,enterpriseDomain)}/models/${modelId}/policy`,response;try{response=await fetchWithRateLimitRetry(url,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${token}`,...COPILOT_HEADERS,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})},signal,{maxRetries:2,maxElapsedMs:5e3})}catch(error){if(signal.aborted)throw error;return!1}if(response.status===429)throw new Error(`${response.status} ${response.statusText}: ${await response.text()}`);return response.ok}async function enableGitHubCopilotModels(token,modelIds,enterpriseDomain,signal){let enabledModelIds=[];for(let modelId of modelIds)try{await enableGitHubCopilotModel(token,modelId,enterpriseDomain,signal)&&enabledModelIds.push(modelId)}catch(error){if(signal.aborted)throw error;break}return enabledModelIds}async function loginGitHubCopilot(interaction){let input=await interaction.prompt({type:"text",message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com"});if(interaction.signal.aborted)throw new Error("Login cancelled");let trimmed=input.trim(),enterpriseDomain=normalizeDomain(input);if(trimmed&&!enterpriseDomain)throw new Error("Invalid GitHub Enterprise URL/domain");let domain=enterpriseDomain||"github.com",device=await startDeviceFlow(domain,interaction.signal);interaction.notify({type:"device_code",userCode:device.user_code,verificationUri:device.verification_uri,intervalSeconds:device.interval,expiresInSeconds:device.expires_in});let githubAccessToken=await pollForGitHubAccessToken(domain,device,interaction.signal),credentials=await refreshGitHubCopilotAccessToken(githubAccessToken,enterpriseDomain??void 0,interaction.signal),models=await fetchGitHubCopilotModels(credentials.access,enterpriseDomain??void 0,interaction.signal,{maxRetries:2,maxElapsedMs:5e3}),enabledModelIds=[];return models.policyModelIds.length>0&&(interaction.notify({type:"progress",message:"Enabling models..."}),enabledModelIds=await enableGitHubCopilotModels(credentials.access,models.policyModelIds,enterpriseDomain??void 0,interaction.signal)),{...credentials,availableModelIds:[...new Set([...models.availableModelIds,...enabledModelIds])]}}function copilotEnterpriseDomain(credential){let enterpriseUrl=credential.enterpriseUrl;if(!(typeof enterpriseUrl!="string"||!enterpriseUrl))return normalizeDomain(enterpriseUrl)??void 0}var githubCopilotOAuth={name:"GitHub Copilot",isSubscription:!0,login:loginGitHubCopilot,refresh:(credential,signal)=>refreshGitHubCopilotToken(credential.refresh,copilotEnterpriseDomain(credential),signal),async toAuth(credential){return{apiKey:credential.access,baseUrl:getGitHubCopilotBaseUrl(credential.access,copilotEnterpriseDomain(credential))}}};export{githubCopilotOAuth};
2
+ var github_copilot_default={"anthropic-messages":{"chat:claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},thinkingLevelMap:{off:null,xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-fable-5.1":{id:"claude-fable-5.1",name:"Claude Fable 5.1",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:.25,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},thinkingLevelMap:{off:null,xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-haiku-5.5":{id:"claude-haiku-5.5",name:"Claude Haiku 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:1e5,input:.5,output:2.5,cacheRead:.05,cacheWrite:.625}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-4.8":{id:"claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5":{id:"claude-opus-5",name:"Claude Opus 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5.5":{id:"claude-opus-5.5",name:"Claude Opus 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.2,cacheWrite:5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:32e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{max:"max",minimal:"low"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5":{id:"claude-sonnet-5",name:"Claude Sonnet 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{xhigh:"xhigh",max:"max"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5.5":{id:"claude-sonnet-5.5",name:"Claude Sonnet 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-completions":{"chat:gemini-3.8-flash":{id:"gemini-3.8-flash",name:"Gemini 3.8 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.75,cacheRead:.075,cacheWrite:0},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-4-argon":{id:"gemini-4-argon",name:"Gemini 4 Argon",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:0},contextWindow:1048576,maxTokens:65536,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:kimi-k3":{id:"kimi-k3",name:"Kimi K3",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:0},contextWindow:1048576,maxTokens:131072,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-responses":{"chat:gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-luna":{id:"gpt-5.6-luna",name:"GPT-5.6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25,tiers:[{inputTokensAbove:2e5,input:.4,output:1.8,cacheRead:.04,cacheWrite:.5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-sol":{id:"gpt-5.6-sol",name:"GPT-5.6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.4,cacheWrite:5,tiers:[{inputTokensAbove:272e3,input:8,output:30,cacheRead:.8,cacheWrite:10}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-terra":{id:"gpt-5.6-terra",name:"GPT-5.6 Terra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:18,cacheRead:.4,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-astra":{id:"gpt-6-astra",name:"GPT-6 Astra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5,tiers:[{inputTokensAbove:272e3,input:20,output:75,cacheRead:2,cacheWrite:25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-luna":{id:"gpt-6-luna",name:"GPT-6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:272e3,input:.2,output:.75,cacheRead:.02,cacheWrite:.25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-sol":{id:"gpt-6-sol",name:"GPT-6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.4,cacheWrite:5}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6.1-sol":{id:"gpt-6.1-sol",name:"GPT-6.1 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.2,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.5":{id:"grok-4.5",name:"Grok 4.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.6":{id:"grok-4.6",name:"Grok 4.6",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.7":{id:"grok-4.7",name:"Grok 4.7",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:mai-code-1.1-flash":{id:"mai-code-1.1-flash",name:"MAI-Code-1.1-Flash",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}}};function flattenModelCatalog(groups,type){return Object.fromEntries(Object.values(groups).flatMap(models=>Object.values(models)).filter(model=>model.type===type).map(model=>[model.id,model]))}function flattenChatModelCatalog(_provider,groups){return flattenModelCatalog(groups,"chat")}function flattenImageModelCatalog(_provider,groups){return flattenModelCatalog(groups,"image")}function flattenClassifierModelCatalog(_provider,groups){return flattenModelCatalog(groups,"classifier")}var GITHUB_COPILOT_MODELS=flattenChatModelCatalog("github-copilot",github_copilot_default),GITHUB_COPILOT_IMAGE_MODELS=flattenImageModelCatalog("github-copilot",github_copilot_default),GITHUB_COPILOT_CLASSIFIER_MODELS=flattenClassifierModelCatalog("github-copilot",github_copilot_default);function sleep(ms,signal){return new Promise((resolve,reject)=>{signal.throwIfAborted();let onAbort=()=>{clearTimeout(timeout),reject(signal.reason)},timeout=setTimeout(()=>{signal.removeEventListener("abort",onAbort),resolve()},ms);signal.addEventListener("abort",onAbort,{once:!0})})}var CANCEL_MESSAGE="Login cancelled",TIMEOUT_MESSAGE="Device flow timed out",SLOW_DOWN_TIMEOUT_MESSAGE="Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.";function abortableSleep(ms,signal,cancelMessage){return new Promise((resolve,reject)=>{if(signal.aborted){reject(new Error(cancelMessage));return}let onAbort=()=>{clearTimeout(timeout),reject(new Error(cancelMessage))},timeout=setTimeout(()=>{signal.removeEventListener("abort",onAbort),resolve()},ms);signal.addEventListener("abort",onAbort,{once:!0})})}async function pollOAuthDeviceCodeFlow(options){let deadline=typeof options.expiresInSeconds=="number"?Date.now()+options.expiresInSeconds*1e3:Number.POSITIVE_INFINITY,intervalMs=Math.max(1e3,Math.floor((options.intervalSeconds??5)*1e3)),slowDownResponses=0;if(options.waitBeforeFirstPoll){let remainingMs=deadline-Date.now();remainingMs>0&&await abortableSleep(Math.min(intervalMs,remainingMs),options.signal,CANCEL_MESSAGE)}for(;Date.now()<deadline;){if(options.signal.aborted)throw new Error(CANCEL_MESSAGE);let result=await options.poll();if(result.status==="complete")return result.value;if(result.status==="failed")throw new Error(result.message);result.status==="slow_down"&&(slowDownResponses+=1,intervalMs=typeof result.intervalSeconds=="number"&&Number.isFinite(result.intervalSeconds)&&result.intervalSeconds>0?Math.max(1e3,Math.floor(result.intervalSeconds*1e3)):Math.max(1e3,intervalMs+5e3));let remainingMs=deadline-Date.now();if(remainingMs<=0)break;await abortableSleep(Math.min(intervalMs,remainingMs),options.signal,CANCEL_MESSAGE)}throw new Error(slowDownResponses>0?SLOW_DOWN_TIMEOUT_MESSAGE:TIMEOUT_MESSAGE)}var decode=s=>atob(s),CLIENT_ID=decode("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),COPILOT_HEADERS={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},COPILOT_API_VERSION="2026-06-01";function normalizeDomain(input){let trimmed=input.trim();if(!trimmed)return null;try{return(trimmed.includes("://")?new URL(trimmed):new URL(`https://${trimmed}`)).hostname}catch{return null}}function getUrls(domain){return{deviceCodeUrl:`https://${domain}/login/device/code`,accessTokenUrl:`https://${domain}/login/oauth/access_token`,copilotTokenUrl:`https://api.${domain}/copilot_internal/v2/token`}}function getBaseUrlFromToken(token){let match=token.match(/proxy-ep=([^;]+)/);return match?`https://${match[1].replace(/^proxy\./,"api.")}`:null}function getGitHubCopilotBaseUrl(token,enterpriseDomain){if(token){let urlFromToken=getBaseUrlFromToken(token);if(urlFromToken)return urlFromToken}return enterpriseDomain?`https://copilot-api.${enterpriseDomain}`:"https://api.individual.githubcopilot.com"}function asRecord(value){return value&&typeof value=="object"?value:void 0}function parseGitHubCopilotModelCatalog(raw,allowPolicyFallback){let data=asRecord(raw)?.data;if(!Array.isArray(data))throw new Error("Invalid Copilot models response");let accountModels=data.flatMap(rawItem=>{let item=asRecord(rawItem),id=item?.id;if(!item||typeof id!="string")return[];let capabilities=asRecord(item.capabilities);return asRecord(capabilities?.supports)?.tool_calls===!1?[]:[{id,pickerEnabled:item.model_picker_enabled===!0,policyState:asRecord(item.policy)?.state}]}),pickerModelIds=accountModels.filter(model=>model.pickerEnabled&&model.policyState!=="disabled").map(model=>model.id),usePolicyFallback=allowPolicyFallback&&pickerModelIds.length===0,availableModelIds=pickerModelIds.length>0||!allowPolicyFallback?pickerModelIds:accountModels.filter(model=>model.policyState==="enabled").map(model=>model.id),policyModelIds=accountModels.filter(model=>model.policyState==="unconfigured"&&Object.hasOwn(GITHUB_COPILOT_MODELS,model.id)&&(model.pickerEnabled||usePolicyFallback)).map(model=>model.id);return{availableModelIds,policyModelIds}}async function fetchWithRateLimitRetry(url,init,signal,retryPolicy){let retryBudgetSignal=retryPolicy.maxRetries>0&&retryPolicy.maxElapsedMs>0?AbortSignal.timeout(retryPolicy.maxElapsedMs):void 0,requestSignal=retryBudgetSignal?AbortSignal.any([signal,retryBudgetSignal]):signal,retryDeadline=retryBudgetSignal?Date.now()+retryPolicy.maxElapsedMs:void 0;for(let retry=0;;retry++){let response=await fetch(url,{...init,signal:AbortSignal.any([requestSignal,AbortSignal.timeout(5e3)])});if(response.status!==429||retry===retryPolicy.maxRetries)return response;let retryAfter=response.headers.get("retry-after"),delayMs=500*2**retry;if(retryAfter){let seconds=Number.parseFloat(retryAfter);if(delayMs=Number.isNaN(seconds)?Date.parse(retryAfter)-Date.now():seconds*1e3,!Number.isFinite(delayMs))return response}if(delayMs=Math.max(0,delayMs),retryDeadline!==void 0&&delayMs>=retryDeadline-Date.now())return response;await response.body?.cancel(),await sleep(delayMs,requestSignal)}}async function fetchGitHubCopilotModels(copilotToken,enterpriseDomain,signal,retryPolicy){let baseUrl=getGitHubCopilotBaseUrl(copilotToken,enterpriseDomain),allowPolicyFallback=baseUrl==="https://api.individual.githubcopilot.com",response=await fetchWithRateLimitRetry(`${baseUrl}/models`,{headers:{Accept:"application/json",Authorization:`Bearer ${copilotToken}`,...COPILOT_HEADERS,"X-GitHub-Api-Version":COPILOT_API_VERSION}},signal,retryPolicy);if(!response.ok)throw new Error(`${response.status} ${response.statusText}: ${await response.text()}`);return parseGitHubCopilotModelCatalog(await response.json(),allowPolicyFallback)}async function fetchJson(url,init){let response=await fetch(url,init);if(!response.ok){let text=await response.text();throw new Error(`${response.status} ${response.statusText}: ${text}`)}return response.json()}async function startDeviceFlow(domain,signal){let urls=getUrls(domain),data=await fetchJson(urls.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:CLIENT_ID,scope:"read:user"}),signal});if(!data||typeof data!="object")throw new Error("Invalid device code response");let deviceCode=data.device_code,userCode=data.user_code,verificationUri=data.verification_uri,interval=data.interval,expiresIn=data.expires_in;if(typeof deviceCode!="string"||typeof userCode!="string"||typeof verificationUri!="string"||interval!==void 0&&typeof interval!="number"||typeof expiresIn!="number")throw new Error("Invalid device code response fields");let parsedUri;try{parsedUri=new URL(verificationUri)}catch{throw new Error("Untrusted verification_uri in device code response")}if(parsedUri.protocol!=="https:"&&parsedUri.protocol!=="http:")throw new Error("Untrusted verification_uri in device code response");return{device_code:deviceCode,user_code:userCode,verification_uri:parsedUri.href,interval,expires_in:expiresIn}}async function pollForGitHubAccessToken(domain,device,signal){let urls=getUrls(domain);return pollOAuthDeviceCodeFlow({intervalSeconds:device.interval,expiresInSeconds:device.expires_in,waitBeforeFirstPoll:!0,signal,poll:async()=>{let raw=await fetchJson(urls.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:CLIENT_ID,device_code:device.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal});if(raw&&typeof raw=="object"&&typeof raw.access_token=="string")return{status:"complete",value:raw.access_token};if(raw&&typeof raw=="object"&&typeof raw.error=="string"){let{error,error_description:description,interval}=raw;if(error==="authorization_pending")return{status:"pending"};if(error==="slow_down")return{status:"slow_down",intervalSeconds:typeof interval=="number"?interval:void 0};let descriptionSuffix=description?`: ${description}`:"";return{status:"failed",message:`Device flow failed: ${error}${descriptionSuffix}`}}return{status:"failed",message:"Invalid device token response"}}})}async function refreshGitHubCopilotAccessToken(refreshToken,enterpriseDomain,signal){let urls=getUrls(enterpriseDomain||"github.com"),raw=await fetchJson(urls.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${refreshToken}`,...COPILOT_HEADERS},signal});if(!raw||typeof raw!="object")throw new Error("Invalid Copilot token response");let token=raw.token,expiresAt=raw.expires_at;if(typeof token!="string"||typeof expiresAt!="number")throw new Error("Invalid Copilot token response fields");return{type:"oauth",refresh:refreshToken,access:token,expires:expiresAt*1e3-300*1e3,enterpriseUrl:enterpriseDomain}}async function refreshGitHubCopilotToken(refreshToken,enterpriseDomain,signal){let credentials=await refreshGitHubCopilotAccessToken(refreshToken,enterpriseDomain,signal),{availableModelIds}=await fetchGitHubCopilotModels(credentials.access,enterpriseDomain,signal,{maxRetries:0,maxElapsedMs:0});return{...credentials,availableModelIds}}async function enableGitHubCopilotModel(token,modelId,enterpriseDomain,signal){let url=`${getGitHubCopilotBaseUrl(token,enterpriseDomain)}/models/${modelId}/policy`,response;try{response=await fetchWithRateLimitRetry(url,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${token}`,...COPILOT_HEADERS,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})},signal,{maxRetries:2,maxElapsedMs:5e3})}catch(error){if(signal.aborted)throw error;return!1}if(response.status===429)throw new Error(`${response.status} ${response.statusText}: ${await response.text()}`);return response.ok}async function enableGitHubCopilotModels(token,modelIds,enterpriseDomain,signal){let enabledModelIds=[];for(let modelId of modelIds)try{await enableGitHubCopilotModel(token,modelId,enterpriseDomain,signal)&&enabledModelIds.push(modelId)}catch(error){if(signal.aborted)throw error;break}return enabledModelIds}async function loginGitHubCopilot(interaction){let input=await interaction.prompt({type:"text",message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com"});if(interaction.signal.aborted)throw new Error("Login cancelled");let trimmed=input.trim(),enterpriseDomain=normalizeDomain(input);if(trimmed&&!enterpriseDomain)throw new Error("Invalid GitHub Enterprise URL/domain");let domain=enterpriseDomain||"github.com",device=await startDeviceFlow(domain,interaction.signal);interaction.notify({type:"device_code",userCode:device.user_code,verificationUri:device.verification_uri,intervalSeconds:device.interval,expiresInSeconds:device.expires_in});let githubAccessToken=await pollForGitHubAccessToken(domain,device,interaction.signal),credentials=await refreshGitHubCopilotAccessToken(githubAccessToken,enterpriseDomain??void 0,interaction.signal),models=await fetchGitHubCopilotModels(credentials.access,enterpriseDomain??void 0,interaction.signal,{maxRetries:2,maxElapsedMs:5e3}),enabledModelIds=[];return models.policyModelIds.length>0&&(interaction.notify({type:"progress",message:"Enabling models..."}),enabledModelIds=await enableGitHubCopilotModels(credentials.access,models.policyModelIds,enterpriseDomain??void 0,interaction.signal)),{...credentials,availableModelIds:[...new Set([...models.availableModelIds,...enabledModelIds])]}}function copilotEnterpriseDomain(credential){let enterpriseUrl=credential.enterpriseUrl;if(!(typeof enterpriseUrl!="string"||!enterpriseUrl))return normalizeDomain(enterpriseUrl)??void 0}var githubCopilotOAuth={name:"GitHub Copilot",isSubscription:!0,login:loginGitHubCopilot,refresh:(credential,signal)=>refreshGitHubCopilotToken(credential.refresh,copilotEnterpriseDomain(credential),signal),async toAuth(credential){return{apiKey:credential.access,baseUrl:getGitHubCopilotBaseUrl(credential.access,copilotEnterpriseDomain(credential))}}};export{githubCopilotOAuth};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{dist_exports as dist_exports2}from"./chunk-6WNF4BLC.js";import{all_exports,compat_exports,compile_exports,dist_exports,value_exports}from"./chunk-6YKFJ7FQ.js";import{build_exports}from"./chunk-6C5VKHGV.js";import"./chunk-2M76JOVH.js";import"./chunk-WUIPA42N.js";import"./chunk-YWHGLBPB.js";import"./chunk-USJZMAIR.js";import"./chunk-S3GGRYIO.js";import"./chunk-QQO2NSV6.js";import"./chunk-22CYIUS4.js";import"./chunk-ZBURYEWF.js";import"./chunk-DRQDKNXA.js";import"./chunk-PYGXRV27.js";import"./chunk-HACVPRBJ.js";import"./chunk-LPXNMA2W.js";import"./chunk-4L3WN2XY.js";var oauth_exports={};var VIRTUAL_MODULES={typebox:build_exports,"typebox/compile":compile_exports,"typebox/value":value_exports,"@sinclair/typebox":build_exports,"@sinclair/typebox/compile":compile_exports,"@sinclair/typebox/value":value_exports,"@punch-bot/agent":dist_exports,"@punch-bot/ai":compat_exports,"@punch-bot/ai/compat":compat_exports,"@punch-bot/ai/oauth":oauth_exports,"@punch-bot/ai/providers/all":all_exports,"@punch-bot/cli":dist_exports2,"@mariozechner/pi-agent-core":dist_exports,"@mariozechner/pi-ai":compat_exports,"@mariozechner/pi-ai/compat":compat_exports,"@mariozechner/pi-ai/oauth":oauth_exports,"@mariozechner/pi-ai/providers/all":all_exports,"@mariozechner/pi-coding-agent":dist_exports2};export{VIRTUAL_MODULES};
2
+ import{dist_exports as dist_exports2}from"./chunk-LP6WVVUV.js";import{all_exports,compat_exports,compile_exports,dist_exports,value_exports}from"./chunk-MCGQGCDS.js";import{build_exports}from"./chunk-6C5VKHGV.js";import"./chunk-2M76JOVH.js";import"./chunk-WUIPA42N.js";import"./chunk-YWHGLBPB.js";import"./chunk-USJZMAIR.js";import"./chunk-S3GGRYIO.js";import"./chunk-QQO2NSV6.js";import"./chunk-22CYIUS4.js";import"./chunk-ZBURYEWF.js";import"./chunk-DRQDKNXA.js";import"./chunk-PYGXRV27.js";import"./chunk-HACVPRBJ.js";import"./chunk-LPXNMA2W.js";import"./chunk-4L3WN2XY.js";var oauth_exports={};var VIRTUAL_MODULES={typebox:build_exports,"typebox/compile":compile_exports,"typebox/value":value_exports,"@sinclair/typebox":build_exports,"@sinclair/typebox/compile":compile_exports,"@sinclair/typebox/value":value_exports,"@punch-bot/agent":dist_exports,"@punch-bot/ai":compat_exports,"@punch-bot/ai/compat":compat_exports,"@punch-bot/ai/oauth":oauth_exports,"@punch-bot/ai/providers/all":all_exports,"@punch-bot/cli":dist_exports2,"@mariozechner/pi-agent-core":dist_exports,"@mariozechner/pi-ai":compat_exports,"@mariozechner/pi-ai/compat":compat_exports,"@mariozechner/pi-ai/oauth":oauth_exports,"@mariozechner/pi-ai/providers/all":all_exports,"@mariozechner/pi-coding-agent":dist_exports2};export{VIRTUAL_MODULES};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
3
- import{configureHttpDispatcher,main}from"./chunks/chunk-6YKFJ7FQ.js";import"./chunks/chunk-6C5VKHGV.js";import"./chunks/chunk-2M76JOVH.js";import"./chunks/chunk-WUIPA42N.js";import{APP_NAME}from"./chunks/chunk-YWHGLBPB.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-QQO2NSV6.js";import"./chunks/chunk-22CYIUS4.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-PYGXRV27.js";import"./chunks/chunk-HACVPRBJ.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-4L3WN2XY.js";function setupCli(){process.title=APP_NAME,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),configureHttpDispatcher()}setupCli();main(process.argv.slice(2));
3
+ import{configureHttpDispatcher,main}from"./chunks/chunk-MCGQGCDS.js";import"./chunks/chunk-6C5VKHGV.js";import"./chunks/chunk-2M76JOVH.js";import"./chunks/chunk-WUIPA42N.js";import{APP_NAME}from"./chunks/chunk-YWHGLBPB.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-QQO2NSV6.js";import"./chunks/chunk-22CYIUS4.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-PYGXRV27.js";import"./chunks/chunk-HACVPRBJ.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-4L3WN2XY.js";function setupCli(){process.title=APP_NAME,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),configureHttpDispatcher()}setupCli();main(process.argv.slice(2));
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{copyToClipboard}from"./chunks/chunk-6WNF4BLC.js";import{AgentSession,AgentSessionRuntime,CURRENT_SESSION_VERSION,CredentialSynchronizationError,DEFAULT_COMPACTION_SETTINGS,DefaultPackageManager,DefaultResourceLoader,ExtensionRunner,ModelRegistry,ModelRuntime,RpcClient,SessionManager,SettingsManager,Theme,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-6YKFJ7FQ.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatSize,truncateHead,truncateLine,truncateTail}from"./chunks/chunk-6C5VKHGV.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-2M76JOVH.js";import{getPowerShellConfig,getShellConfig,readStoredCredential}from"./chunks/chunk-WUIPA42N.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-YWHGLBPB.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-QQO2NSV6.js";import"./chunks/chunk-22CYIUS4.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-PYGXRV27.js";import"./chunks/chunk-HACVPRBJ.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-4L3WN2XY.js";export{AgentSession,AgentSessionRuntime,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CredentialSynchronizationError,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,ExtensionRunner,ModelRegistry,ModelRuntime,ProjectTrustStore,RpcClient,SessionManager,SettingsManager,Theme,VERSION,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getPackageDir,getPowerShellConfig,getReadmePath,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,readStoredCredential,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
2
+ import{copyToClipboard}from"./chunks/chunk-LP6WVVUV.js";import{AgentSession,AgentSessionRuntime,CURRENT_SESSION_VERSION,CredentialSynchronizationError,DEFAULT_COMPACTION_SETTINGS,DefaultPackageManager,DefaultResourceLoader,ExtensionRunner,ModelRegistry,ModelRuntime,RpcClient,SessionManager,SettingsManager,Theme,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-MCGQGCDS.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatSize,truncateHead,truncateLine,truncateTail}from"./chunks/chunk-6C5VKHGV.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-2M76JOVH.js";import{getPowerShellConfig,getShellConfig,readStoredCredential}from"./chunks/chunk-WUIPA42N.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-YWHGLBPB.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-QQO2NSV6.js";import"./chunks/chunk-22CYIUS4.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-PYGXRV27.js";import"./chunks/chunk-HACVPRBJ.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-4L3WN2XY.js";export{AgentSession,AgentSessionRuntime,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CredentialSynchronizationError,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,ExtensionRunner,ModelRegistry,ModelRuntime,ProjectTrustStore,RpcClient,SessionManager,SettingsManager,Theme,VERSION,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getPackageDir,getPowerShellConfig,getReadmePath,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,readStoredCredential,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
3
- import{configureHttpDispatcher,main}from"./chunks/chunk-6YKFJ7FQ.js";import"./chunks/chunk-6C5VKHGV.js";import"./chunks/chunk-2M76JOVH.js";import"./chunks/chunk-WUIPA42N.js";import{APP_NAME}from"./chunks/chunk-YWHGLBPB.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-QQO2NSV6.js";import"./chunks/chunk-22CYIUS4.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-PYGXRV27.js";import"./chunks/chunk-HACVPRBJ.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-4L3WN2XY.js";process.title=`${APP_NAME}-rpc`;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT="pi";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
3
+ import{configureHttpDispatcher,main}from"./chunks/chunk-MCGQGCDS.js";import"./chunks/chunk-6C5VKHGV.js";import"./chunks/chunk-2M76JOVH.js";import"./chunks/chunk-WUIPA42N.js";import{APP_NAME}from"./chunks/chunk-YWHGLBPB.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-QQO2NSV6.js";import"./chunks/chunk-22CYIUS4.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-PYGXRV27.js";import"./chunks/chunk-HACVPRBJ.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-4L3WN2XY.js";process.title=`${APP_NAME}-rpc`;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT="pi";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
@@ -20,7 +20,7 @@ export const defaultModelPerProvider = {
20
20
  deepseek: "deepseek-v4-pro",
21
21
  google: "gemini-3.1-pro-preview",
22
22
  "google-vertex": "gemini-3.1-pro-preview",
23
- "github-copilot": "gpt-5.4",
23
+ "github-copilot": "gpt-6.1-sol",
24
24
  openrouter: "moonshotai/kimi-k2.6",
25
25
  "vercel-ai-gateway": "zai/glm-5.1",
26
26
  xai: "grok-4.7",
@@ -1 +1 @@
1
- {"version":3,"file":"model-resolver.js","sourceRoot":"","sources":["../../src/core/model-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAuE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,wBAAwB,EAA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YACP,CAAC;QACF,CAAC;QAED,2CAA2C;QAC3C,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,mBAAmB,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,aAAa,CAAC,QAAQ,IAAI,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO;YACN,KAAK,EAAE,aAAa;YACpB,eAAe,EAAE,2BAA2B,aAAa,IAAI,YAAY,KAAK,MAAM,YAAY,aAAa,CAAC,QAAQ,IAAI,aAAa,CAAC,EAAE,GAAG;SAC7I,CAAC;IACH,CAAC;IAED,sBAAsB;IACtB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AACzD,CAAC","sourcesContent":["/**\n * Model resolution, scoping, and initial selection\n */\n\nimport type { ThinkingLevel } from \"@punch-bot/agent\";\nimport { type Api, type AuthOperationOptions, type KnownProvider, type Model, modelsAreEqual } from \"@punch-bot/ai\";\nimport chalk from \"chalk\";\nimport { minimatch } from \"minimatch\";\nimport { isValidThinkingLevel } from \"../cli/args.ts\";\nimport { DEFAULT_THINKING_LEVEL } from \"./defaults.ts\";\nimport type { ModelRuntime } from \"./model-runtime.ts\";\nimport { findModelOrSuffixVariant } from \"./model-suffix-variants.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-4-6-v1\",\n\t\"ant-ling\": \"Ring-2.6-1T\",\n\tanthropic: \"claude-opus-4-8\",\n\topenai: \"gpt-5.5\",\n\tazure: \"gpt-5.4\",\n\t\"openai-codex\": \"gpt-6.1-sol\",\n\tradius: \"balanced\",\n\tnvidia: \"nvidia/nemotron-3-ultra-550b-a55b\",\n\tdeepseek: \"deepseek-v4-pro\",\n\tgoogle: \"gemini-3.1-pro-preview\",\n\t\"google-vertex\": \"gemini-3.1-pro-preview\",\n\t\"github-copilot\": \"gpt-5.4\",\n\topenrouter: \"moonshotai/kimi-k2.6\",\n\t\"vercel-ai-gateway\": \"zai/glm-5.1\",\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-M2.7\",\n\t\"minimax-cn\": \"MiniMax-M2.7\",\n\tmoonshotai: \"kimi-k2.6\",\n\t\"moonshotai-cn\": \"kimi-k2.6\",\n\thuggingface: \"moonshotai/Kimi-K2.6\",\n\tfireworks: \"accounts/fireworks/models/kimi-k3\",\n\ttogether: \"moonshotai/Kimi-K3\",\n\tbaseten: \"zai-org/GLM-5.2\",\n\topencode: \"kimi-k2.6\",\n\t\"opencode-go\": \"kimi-k3\",\n\t\"kimi-coding\": \"kimi-for-coding\",\n\tmeta: \"muse-spark-1.3\",\n\t\"cloudflare-workers-ai\": \"@cf/moonshotai/kimi-k2.6\",\n\t\"cloudflare-ai-gateway\": \"workers-ai/@cf/moonshotai/kimi-k2.6\",\n\t\"qwen-token-plan\": \"qwen3.7-max\",\n\t\"qwen-token-plan-cn\": \"qwen3.7-max\",\n\t\"qwen-token-plan-individual\": \"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| {\n\t\t\tstatus: \"resolved\";\n\t\t\tmodel: Model<Api>;\n\t\t\tthinkingLevel?: ThinkingLevel;\n\t\t\twarning?: string;\n\t\t\t/** Set when the text only partially matched the model's id or name. */\n\t\t\tpartial?: boolean;\n\t }\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\tconst slashIndex = text.indexOf(\"/\");\n\tif (slashIndex === -1) return undefined;\n\tconst prefix = text.substring(0, slashIndex).trim().toLowerCase();\n\tconst modelText = text.substring(slashIndex + 1).trim();\n\tif (!prefix || !modelText) return undefined;\n\tconst provider = models.find((model) => model.provider.toLowerCase() === prefix)?.provider;\n\treturn provider ? { provider, modelText } : undefined;\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(text, 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.5-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\tlet namedPartially = false;\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\tif (!named && fuzzy) {\n\t\t\tnamed = bestFuzzyMatch(split.modelText, fuzzyMatches(split.modelText, providerModels));\n\t\t\tnamedPartially = named !== undefined;\n\t\t}\n\t}\n\tconst resolved = (model: Model<Api>): ResolvedOrAmbiguous =>\n\t\tmodel === named && namedPartially ? { status: \"resolved\", model, partial: true } : { status: \"resolved\", model };\n\n\tconst others = raw.filter((model) => model !== named);\n\tconst candidates = named ? [named, ...others] : others;\n\tif (candidates.length === 0) return undefined;\n\t// Within one provider, the literal id (OpenRouter's `openrouter/fusion`) beats the prefix-stripped `fusion`\n\tif (new Set(candidates.map((model) => model.provider)).size === 1) return resolved(raw[0] ?? candidates[0]);\n\tif (named && usable(named.provider)) return resolved(named);\n\tconst usableOthers = others.filter((model) => usable(model.provider));\n\tif (usableOthers.length === 1) return resolved(usableOthers[0]);\n\tif (usableOthers.length === 0 && named) return resolved(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(\n\ttext: string,\n\tmatches: Model<Api>[],\n\tusable: (provider: string) => boolean,\n): 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(text, 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)\n\t\treturn { status: \"resolved\", model: best, partial: true };\n\treturn {\n\t\tstatus: \"ambiguous\",\n\t\tcandidates: tied,\n\t\tusableCount: usableMatches.length > 0 ? tied.length : 0,\n\t};\n}\n\n/**\n * Rank partial matches, each rule applied to the models left by the previous one:\n * 1. A base id beats its catalog variants: `gemini-2.5-pro` matches `google/gemini-2.5-pro`, not\n * `google/gemini-2.5-pro:batch`. Typing the variant's full id still selects it.\n * 2. An id ending in the text at a separator beats one that continues it: `sonnet-5` matches\n * `claude-sonnet-5`, not `claude-sonnet-5.5`.\n * 3. Aliases (`claude-sonnet-4-5`) beat dated versions (`claude-sonnet-4-5-20250929`), then the latest id wins.\n */\nfunction bestFuzzyMatch(text: string, matches: readonly Model<Api>[]): Model<Api> | undefined {\n\tconst keys = new Set(matches.map((model) => `${model.provider}/${model.id}`));\n\tconst bases = matches.filter((model) => {\n\t\tconst colon = model.id.lastIndexOf(\":\");\n\t\treturn colon === -1 || !keys.has(`${model.provider}/${model.id.slice(0, colon)}`);\n\t});\n\tconst lowerText = text.toLowerCase();\n\tconst closest = bases.filter((model) => endsAtSeparator(model.id.toLowerCase(), lowerText));\n\tconst ranked = closest.length > 0 ? closest : bases;\n\tconst aliases = ranked.filter((model) => isAlias(model.id));\n\treturn [...(aliases.length > 0 ? aliases : ranked)].sort((a, b) => b.id.localeCompare(a.id))[0];\n}\n\nfunction endsAtSeparator(id: string, text: string): boolean {\n\tif (!id.endsWith(text)) return false;\n\tconst before = id[id.length - text.length - 1];\n\treturn before === undefined || \"/-_.:\".includes(before);\n}\n\nfunction isAlias(id: string): boolean {\n\treturn id.endsWith(\"-latest\") || !/-\\d{8}$/.test(id);\n}\n\n/** Describe a partial match, so a client sees which model a short or misspelled id selected. */\nfunction partialMatchWarning(text: string, model: Model<Api>): string {\n\treturn `No exact match for \"${text}\". Using ${model.provider}/${model.id}.`;\n}\n\n/**\n * A custom id `<catalog id>:<suffix>` (OpenRouter's `:nitro` routing, for example) keeps the catalog model's\n * metadata. Other custom ids copy the provider's default model.\n */\nfunction buildFallbackModel(providerModels: [Model<Api>, ...Model<Api>[]], modelId: string): Model<Api> {\n\tconst variant = findModelOrSuffixVariant(modelId, (id) => providerModels.find((model) => model.id === id));\n\tif (variant) return variant;\n\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\" | \"partial-match\";\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// A literal id such as `model[1m]:high` wins before `:high` is read as a thinking level\n\t\t\tconst literal = resolveModelReference(\n\t\t\t\t{ text: pattern, thinkingSuffix: \"none\", fuzzy: false },\n\t\t\t\tmodels,\n\t\t\t\t() => true,\n\t\t\t);\n\t\t\tif (literal.status === \"resolved\") {\n\t\t\t\tadd(literal.model, undefined);\n\t\t\t\tcontinue;\n\t\t\t}\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// A glob naming a provider (`anthropic/*`) only matches that provider's ids, not gateway ids such as\n\t\t\t\t// OpenRouter's `anthropic/claude-sonnet-5`. Other globs match \"provider/modelId\" or just the model id,\n\t\t\t\t// so \"*sonnet*\" matches without requiring \"anthropic/*sonnet*\".\n\t\t\t\tconst slash = globPattern.indexOf(\"/\");\n\t\t\t\tconst prefix = slash === -1 ? undefined : globPattern.slice(0, slash).toLowerCase();\n\t\t\t\tconst namedProvider = prefix !== undefined && models.some((m) => m.provider.toLowerCase() === prefix);\n\t\t\t\tmatches = models.filter((m) =>\n\t\t\t\t\tnamedProvider\n\t\t\t\t\t\t? m.provider.toLowerCase() === prefix &&\n\t\t\t\t\t\t\tminimatch(m.id, globPattern.slice(slash + 1), { nocase: true })\n\t\t\t\t\t\t: minimatch(`${m.provider}/${m.id}`, globPattern, { nocase: true }) ||\n\t\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\t// `provider/<catalog id>:<suffix>` (OpenRouter's `:nitro`) selects that variant, before the lenient\n\t\t// fallback below would drop the suffix as an invalid thinking level and select the base model\n\t\tconst exact = resolveModelReference(\n\t\t\t{ text: pattern, thinkingSuffix: \"strict\", fuzzy: false },\n\t\t\tmodels,\n\t\t\t() => true,\n\t\t);\n\t\tif (exact.status === \"not-found\" && exact.target) {\n\t\t\tconst { target } = exact;\n\t\t\tconst variant = findModelOrSuffixVariant(target.modelId, (id) =>\n\t\t\t\ttarget.providerModels.find((model) => model.id === id),\n\t\t\t);\n\t\t\tif (variant) {\n\t\t\t\tadd(variant, target.thinkingLevel);\n\t\t\t\tcontinue;\n\t\t\t}\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 === \"resolved\" && result.partial) {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"partial-match\",\n\t\t\t\tmessage: partialMatchWarning(pattern, result.model),\n\t\t\t\tpattern,\n\t\t\t});\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 async function resolveModelScope(\n\tpatterns: string[],\n\tmodelRuntime: ModelRuntime,\n\toptions?: AuthOperationOptions,\n): Promise<ScopedModel[]> {\n\tconst { scopedModels, diagnostics } = await resolveModelScopeWithDiagnostics(patterns, modelRuntime, options);\n\tfor (const diagnostic of diagnostics) {\n\t\tconsole.warn(chalk.yellow(`Warning: ${diagnostic.message}`));\n\t}\n\treturn scopedModels;\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), with a warning\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\t// An empty --model is an error, not a request for the default model.\n\tif (cliModel === undefined) {\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\tconst warning = result.partial ? partialMatchWarning(cliModel, result.model) : result.warning;\n\t\treturn { model: result.model, thinkingLevel: result.thinkingLevel, 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\tlet defaultMiss: string | undefined;\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\tdefaultMiss = `Could not select default model ${defaultProvider}/${defaultModelId} (${found ? \"no auth configured\" : \"model not found\"})`;\n\t}\n\tconst fallback = (match: Model<Api>): InitialModelResult => ({\n\t\tmodel: match,\n\t\tthinkingLevel: DEFAULT_THINKING_LEVEL,\n\t\tfallbackMessage: defaultMiss && `${defaultMiss}. Using ${match.provider}/${match.id}.`,\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) return fallback(match);\n\t\t}\n\n\t\t// If no default found, use first available\n\t\treturn fallback(availableModels[0]);\n\t}\n\n\t// 4. No model found\n\treturn { model: undefined, thinkingLevel: DEFAULT_THINKING_LEVEL, fallbackMessage: undefined };\n}\n\n/**\n * Restore model from session, with fallback to available models\n */\nexport async function restoreModelFromSession(\n\tsavedProvider: string,\n\tsavedModelId: string,\n\tcurrentModel: Model<Api> | undefined,\n\tshouldPrintMessages: boolean,\n\tmodelRuntime: ModelRuntime,\n): Promise<{ model: Model<Api> | undefined; fallbackMessage: string | undefined }> {\n\tconst restoredModel = modelRuntime.getModel(savedProvider, savedModelId);\n\n\t// Check if restored model exists and still has auth configured\n\tconst hasConfiguredAuth = restoredModel ? modelRuntime.hasConfiguredAuth(restoredModel.provider) : false;\n\n\tif (restoredModel && hasConfiguredAuth) {\n\t\tif (shouldPrintMessages) {\n\t\t\tconsole.log(chalk.dim(`Restored model: ${savedProvider}/${savedModelId}`));\n\t\t}\n\t\treturn { model: restoredModel, fallbackMessage: undefined };\n\t}\n\n\t// Model not found or no API key - fall back\n\tconst reason = !restoredModel ? \"model no longer exists\" : \"no auth configured\";\n\n\tif (shouldPrintMessages) {\n\t\tconsole.error(chalk.yellow(`Warning: Could not restore model ${savedProvider}/${savedModelId} (${reason}).`));\n\t}\n\n\t// If we already have a model, use it as fallback\n\tif (currentModel) {\n\t\tif (shouldPrintMessages) {\n\t\t\tconsole.log(chalk.dim(`Falling back to: ${currentModel.provider}/${currentModel.id}`));\n\t\t}\n\t\treturn {\n\t\t\tmodel: currentModel,\n\t\t\tfallbackMessage: `Could not restore model ${savedProvider}/${savedModelId} (${reason}). Using ${currentModel.provider}/${currentModel.id}.`,\n\t\t};\n\t}\n\n\t// Try to find any available model\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\tlet fallbackModel: Model<Api> | undefined;\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\tfallbackModel = match;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// If no default found, use first available\n\t\tif (!fallbackModel) {\n\t\t\tfallbackModel = availableModels[0];\n\t\t}\n\n\t\tif (shouldPrintMessages) {\n\t\t\tconsole.log(chalk.dim(`Falling back to: ${fallbackModel.provider}/${fallbackModel.id}`));\n\t\t}\n\n\t\treturn {\n\t\t\tmodel: fallbackModel,\n\t\t\tfallbackMessage: `Could not restore model ${savedProvider}/${savedModelId} (${reason}). Using ${fallbackModel.provider}/${fallbackModel.id}.`,\n\t\t};\n\t}\n\n\t// No models available\n\treturn { model: undefined, fallbackMessage: undefined };\n}\n"]}
1
+ {"version":3,"file":"model-resolver.js","sourceRoot":"","sources":["../../src/core/model-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAuE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA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F,CAAC;QAED,2CAA2C;QAC3C,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,mBAAmB,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,aAAa,CAAC,QAAQ,IAAI,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO;YACN,KAAK,EAAE,aAAa;YACpB,eAAe,EAAE,2BAA2B,aAAa,IAAI,YAAY,KAAK,MAAM,YAAY,aAAa,CAAC,QAAQ,IAAI,aAAa,CAAC,EAAE,GAAG;SAC7I,CAAC;IACH,CAAC;IAED,sBAAsB;IACtB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AACzD,CAAC","sourcesContent":["/**\n * Model resolution, scoping, and initial selection\n */\n\nimport type { ThinkingLevel } from \"@punch-bot/agent\";\nimport { type Api, type AuthOperationOptions, type KnownProvider, type Model, modelsAreEqual } from \"@punch-bot/ai\";\nimport chalk from \"chalk\";\nimport { minimatch } from \"minimatch\";\nimport { isValidThinkingLevel } from \"../cli/args.ts\";\nimport { DEFAULT_THINKING_LEVEL } from \"./defaults.ts\";\nimport type { ModelRuntime } from \"./model-runtime.ts\";\nimport { findModelOrSuffixVariant } from \"./model-suffix-variants.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-4-6-v1\",\n\t\"ant-ling\": \"Ring-2.6-1T\",\n\tanthropic: \"claude-opus-4-8\",\n\topenai: \"gpt-5.5\",\n\tazure: \"gpt-5.4\",\n\t\"openai-codex\": \"gpt-6.1-sol\",\n\tradius: \"balanced\",\n\tnvidia: \"nvidia/nemotron-3-ultra-550b-a55b\",\n\tdeepseek: \"deepseek-v4-pro\",\n\tgoogle: \"gemini-3.1-pro-preview\",\n\t\"google-vertex\": \"gemini-3.1-pro-preview\",\n\t\"github-copilot\": \"gpt-6.1-sol\",\n\topenrouter: \"moonshotai/kimi-k2.6\",\n\t\"vercel-ai-gateway\": \"zai/glm-5.1\",\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-M2.7\",\n\t\"minimax-cn\": \"MiniMax-M2.7\",\n\tmoonshotai: \"kimi-k2.6\",\n\t\"moonshotai-cn\": \"kimi-k2.6\",\n\thuggingface: \"moonshotai/Kimi-K2.6\",\n\tfireworks: \"accounts/fireworks/models/kimi-k3\",\n\ttogether: \"moonshotai/Kimi-K3\",\n\tbaseten: \"zai-org/GLM-5.2\",\n\topencode: \"kimi-k2.6\",\n\t\"opencode-go\": \"kimi-k3\",\n\t\"kimi-coding\": \"kimi-for-coding\",\n\tmeta: \"muse-spark-1.3\",\n\t\"cloudflare-workers-ai\": \"@cf/moonshotai/kimi-k2.6\",\n\t\"cloudflare-ai-gateway\": \"workers-ai/@cf/moonshotai/kimi-k2.6\",\n\t\"qwen-token-plan\": \"qwen3.7-max\",\n\t\"qwen-token-plan-cn\": \"qwen3.7-max\",\n\t\"qwen-token-plan-individual\": \"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| {\n\t\t\tstatus: \"resolved\";\n\t\t\tmodel: Model<Api>;\n\t\t\tthinkingLevel?: ThinkingLevel;\n\t\t\twarning?: string;\n\t\t\t/** Set when the text only partially matched the model's id or name. */\n\t\t\tpartial?: boolean;\n\t }\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\tconst slashIndex = text.indexOf(\"/\");\n\tif (slashIndex === -1) return undefined;\n\tconst prefix = text.substring(0, slashIndex).trim().toLowerCase();\n\tconst modelText = text.substring(slashIndex + 1).trim();\n\tif (!prefix || !modelText) return undefined;\n\tconst provider = models.find((model) => model.provider.toLowerCase() === prefix)?.provider;\n\treturn provider ? { provider, modelText } : undefined;\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(text, 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.5-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\tlet namedPartially = false;\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\tif (!named && fuzzy) {\n\t\t\tnamed = bestFuzzyMatch(split.modelText, fuzzyMatches(split.modelText, providerModels));\n\t\t\tnamedPartially = named !== undefined;\n\t\t}\n\t}\n\tconst resolved = (model: Model<Api>): ResolvedOrAmbiguous =>\n\t\tmodel === named && namedPartially ? { status: \"resolved\", model, partial: true } : { status: \"resolved\", model };\n\n\tconst others = raw.filter((model) => model !== named);\n\tconst candidates = named ? [named, ...others] : others;\n\tif (candidates.length === 0) return undefined;\n\t// Within one provider, the literal id (OpenRouter's `openrouter/fusion`) beats the prefix-stripped `fusion`\n\tif (new Set(candidates.map((model) => model.provider)).size === 1) return resolved(raw[0] ?? candidates[0]);\n\tif (named && usable(named.provider)) return resolved(named);\n\tconst usableOthers = others.filter((model) => usable(model.provider));\n\tif (usableOthers.length === 1) return resolved(usableOthers[0]);\n\tif (usableOthers.length === 0 && named) return resolved(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(\n\ttext: string,\n\tmatches: Model<Api>[],\n\tusable: (provider: string) => boolean,\n): 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(text, 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)\n\t\treturn { status: \"resolved\", model: best, partial: true };\n\treturn {\n\t\tstatus: \"ambiguous\",\n\t\tcandidates: tied,\n\t\tusableCount: usableMatches.length > 0 ? tied.length : 0,\n\t};\n}\n\n/**\n * Rank partial matches, each rule applied to the models left by the previous one:\n * 1. A base id beats its catalog variants: `gemini-2.5-pro` matches `google/gemini-2.5-pro`, not\n * `google/gemini-2.5-pro:batch`. Typing the variant's full id still selects it.\n * 2. An id ending in the text at a separator beats one that continues it: `sonnet-5` matches\n * `claude-sonnet-5`, not `claude-sonnet-5.5`.\n * 3. Aliases (`claude-sonnet-4-5`) beat dated versions (`claude-sonnet-4-5-20250929`), then the latest id wins.\n */\nfunction bestFuzzyMatch(text: string, matches: readonly Model<Api>[]): Model<Api> | undefined {\n\tconst keys = new Set(matches.map((model) => `${model.provider}/${model.id}`));\n\tconst bases = matches.filter((model) => {\n\t\tconst colon = model.id.lastIndexOf(\":\");\n\t\treturn colon === -1 || !keys.has(`${model.provider}/${model.id.slice(0, colon)}`);\n\t});\n\tconst lowerText = text.toLowerCase();\n\tconst closest = bases.filter((model) => endsAtSeparator(model.id.toLowerCase(), lowerText));\n\tconst ranked = closest.length > 0 ? closest : bases;\n\tconst aliases = ranked.filter((model) => isAlias(model.id));\n\treturn [...(aliases.length > 0 ? aliases : ranked)].sort((a, b) => b.id.localeCompare(a.id))[0];\n}\n\nfunction endsAtSeparator(id: string, text: string): boolean {\n\tif (!id.endsWith(text)) return false;\n\tconst before = id[id.length - text.length - 1];\n\treturn before === undefined || \"/-_.:\".includes(before);\n}\n\nfunction isAlias(id: string): boolean {\n\treturn id.endsWith(\"-latest\") || !/-\\d{8}$/.test(id);\n}\n\n/** Describe a partial match, so a client sees which model a short or misspelled id selected. */\nfunction partialMatchWarning(text: string, model: Model<Api>): string {\n\treturn `No exact match for \"${text}\". Using ${model.provider}/${model.id}.`;\n}\n\n/**\n * A custom id `<catalog id>:<suffix>` (OpenRouter's `:nitro` routing, for example) keeps the catalog model's\n * metadata. Other custom ids copy the provider's default model.\n */\nfunction buildFallbackModel(providerModels: [Model<Api>, ...Model<Api>[]], modelId: string): Model<Api> {\n\tconst variant = findModelOrSuffixVariant(modelId, (id) => providerModels.find((model) => model.id === id));\n\tif (variant) return variant;\n\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\" | \"partial-match\";\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// A literal id such as `model[1m]:high` wins before `:high` is read as a thinking level\n\t\t\tconst literal = resolveModelReference(\n\t\t\t\t{ text: pattern, thinkingSuffix: \"none\", fuzzy: false },\n\t\t\t\tmodels,\n\t\t\t\t() => true,\n\t\t\t);\n\t\t\tif (literal.status === \"resolved\") {\n\t\t\t\tadd(literal.model, undefined);\n\t\t\t\tcontinue;\n\t\t\t}\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// A glob naming a provider (`anthropic/*`) only matches that provider's ids, not gateway ids such as\n\t\t\t\t// OpenRouter's `anthropic/claude-sonnet-5`. Other globs match \"provider/modelId\" or just the model id,\n\t\t\t\t// so \"*sonnet*\" matches without requiring \"anthropic/*sonnet*\".\n\t\t\t\tconst slash = globPattern.indexOf(\"/\");\n\t\t\t\tconst prefix = slash === -1 ? undefined : globPattern.slice(0, slash).toLowerCase();\n\t\t\t\tconst namedProvider = prefix !== undefined && models.some((m) => m.provider.toLowerCase() === prefix);\n\t\t\t\tmatches = models.filter((m) =>\n\t\t\t\t\tnamedProvider\n\t\t\t\t\t\t? m.provider.toLowerCase() === prefix &&\n\t\t\t\t\t\t\tminimatch(m.id, globPattern.slice(slash + 1), { nocase: true })\n\t\t\t\t\t\t: minimatch(`${m.provider}/${m.id}`, globPattern, { nocase: true }) ||\n\t\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\t// `provider/<catalog id>:<suffix>` (OpenRouter's `:nitro`) selects that variant, before the lenient\n\t\t// fallback below would drop the suffix as an invalid thinking level and select the base model\n\t\tconst exact = resolveModelReference(\n\t\t\t{ text: pattern, thinkingSuffix: \"strict\", fuzzy: false },\n\t\t\tmodels,\n\t\t\t() => true,\n\t\t);\n\t\tif (exact.status === \"not-found\" && exact.target) {\n\t\t\tconst { target } = exact;\n\t\t\tconst variant = findModelOrSuffixVariant(target.modelId, (id) =>\n\t\t\t\ttarget.providerModels.find((model) => model.id === id),\n\t\t\t);\n\t\t\tif (variant) {\n\t\t\t\tadd(variant, target.thinkingLevel);\n\t\t\t\tcontinue;\n\t\t\t}\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 === \"resolved\" && result.partial) {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"partial-match\",\n\t\t\t\tmessage: partialMatchWarning(pattern, result.model),\n\t\t\t\tpattern,\n\t\t\t});\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 async function resolveModelScope(\n\tpatterns: string[],\n\tmodelRuntime: ModelRuntime,\n\toptions?: AuthOperationOptions,\n): Promise<ScopedModel[]> {\n\tconst { scopedModels, diagnostics } = await resolveModelScopeWithDiagnostics(patterns, modelRuntime, options);\n\tfor (const diagnostic of diagnostics) {\n\t\tconsole.warn(chalk.yellow(`Warning: ${diagnostic.message}`));\n\t}\n\treturn scopedModels;\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), with a warning\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\t// An empty --model is an error, not a request for the default model.\n\tif (cliModel === undefined) {\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\tconst warning = result.partial ? partialMatchWarning(cliModel, result.model) : result.warning;\n\t\treturn { model: result.model, thinkingLevel: result.thinkingLevel, 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\tlet defaultMiss: string | undefined;\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\tdefaultMiss = `Could not select default model ${defaultProvider}/${defaultModelId} (${found ? \"no auth configured\" : \"model not found\"})`;\n\t}\n\tconst fallback = (match: Model<Api>): InitialModelResult => ({\n\t\tmodel: match,\n\t\tthinkingLevel: DEFAULT_THINKING_LEVEL,\n\t\tfallbackMessage: defaultMiss && `${defaultMiss}. Using ${match.provider}/${match.id}.`,\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) return fallback(match);\n\t\t}\n\n\t\t// If no default found, use first available\n\t\treturn fallback(availableModels[0]);\n\t}\n\n\t// 4. No model found\n\treturn { model: undefined, thinkingLevel: DEFAULT_THINKING_LEVEL, fallbackMessage: undefined };\n}\n\n/**\n * Restore model from session, with fallback to available models\n */\nexport async function restoreModelFromSession(\n\tsavedProvider: string,\n\tsavedModelId: string,\n\tcurrentModel: Model<Api> | undefined,\n\tshouldPrintMessages: boolean,\n\tmodelRuntime: ModelRuntime,\n): Promise<{ model: Model<Api> | undefined; fallbackMessage: string | undefined }> {\n\tconst restoredModel = modelRuntime.getModel(savedProvider, savedModelId);\n\n\t// Check if restored model exists and still has auth configured\n\tconst hasConfiguredAuth = restoredModel ? modelRuntime.hasConfiguredAuth(restoredModel.provider) : false;\n\n\tif (restoredModel && hasConfiguredAuth) {\n\t\tif (shouldPrintMessages) {\n\t\t\tconsole.log(chalk.dim(`Restored model: ${savedProvider}/${savedModelId}`));\n\t\t}\n\t\treturn { model: restoredModel, fallbackMessage: undefined };\n\t}\n\n\t// Model not found or no API key - fall back\n\tconst reason = !restoredModel ? \"model no longer exists\" : \"no auth configured\";\n\n\tif (shouldPrintMessages) {\n\t\tconsole.error(chalk.yellow(`Warning: Could not restore model ${savedProvider}/${savedModelId} (${reason}).`));\n\t}\n\n\t// If we already have a model, use it as fallback\n\tif (currentModel) {\n\t\tif (shouldPrintMessages) {\n\t\t\tconsole.log(chalk.dim(`Falling back to: ${currentModel.provider}/${currentModel.id}`));\n\t\t}\n\t\treturn {\n\t\t\tmodel: currentModel,\n\t\t\tfallbackMessage: `Could not restore model ${savedProvider}/${savedModelId} (${reason}). Using ${currentModel.provider}/${currentModel.id}.`,\n\t\t};\n\t}\n\n\t// Try to find any available model\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\tlet fallbackModel: Model<Api> | undefined;\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\tfallbackModel = match;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// If no default found, use first available\n\t\tif (!fallbackModel) {\n\t\t\tfallbackModel = availableModels[0];\n\t\t}\n\n\t\tif (shouldPrintMessages) {\n\t\t\tconsole.log(chalk.dim(`Falling back to: ${fallbackModel.provider}/${fallbackModel.id}`));\n\t\t}\n\n\t\treturn {\n\t\t\tmodel: fallbackModel,\n\t\t\tfallbackMessage: `Could not restore model ${savedProvider}/${savedModelId} (${reason}). Using ${fallbackModel.provider}/${fallbackModel.id}.`,\n\t\t};\n\t}\n\n\t// No models available\n\treturn { model: undefined, fallbackMessage: undefined };\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { type Skill } from "./skills.ts";
5
5
  export interface BuildSystemPromptOptions {
6
- /** Custom system prompt (replaces the default prefix). */
6
+ /** Custom system prompt (replaces the default opening; tools and rules sections are kept, pi docs are left out). */
7
7
  customPrompt?: string;
8
8
  /** Exact full prompt replacement set by a before_agent_start handler. */
9
9
  forceSystemPrompt?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAyB,KAAK,KAAK,EAAE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