@code-yeongyu/senpi 2026.9.28-5 → 2026.9.28-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/bundle/chunks/{anthropic-messages-GG4ZKS6A.js → anthropic-messages-QOQJCY3F.js} +1 -1
- package/dist/bundle/chunks/{app-server-command-3AJWPHKJ.js → app-server-command-5WCSZ4A5.js} +1 -1
- package/dist/bundle/chunks/{chunk-XYGXUFMG.js → chunk-3HCYHGK2.js} +1 -1
- package/dist/bundle/chunks/{chunk-MMHQLGF2.js → chunk-AIM2YESB.js} +1 -1
- package/dist/bundle/chunks/{chunk-EXUI5D5V.js → chunk-AWPLVQ4K.js} +9 -9
- package/dist/bundle/chunks/chunk-BTMM2C5X.js +2 -0
- package/dist/bundle/chunks/{chunk-OHJLQ7BY.js → chunk-DKP4BUY5.js} +1 -1
- package/dist/bundle/chunks/{chunk-Z5NVK72W.js → chunk-DOEV7ITR.js} +1 -1
- package/dist/bundle/chunks/chunk-E5F5SVZF.js +5 -0
- package/dist/bundle/chunks/{chunk-BQGVC47Y.js → chunk-FILEUW2D.js} +1 -1
- package/dist/bundle/chunks/{chunk-7SFG425F.js → chunk-HS2LJYBI.js} +1 -1
- package/dist/bundle/chunks/{chunk-YLIS5N3W.js → chunk-JK5LVAOU.js} +1 -1
- package/dist/bundle/chunks/{chunk-C5I2LUOI.js → chunk-SQUUL72H.js} +1 -1
- package/dist/bundle/chunks/{chunk-LEAJXPT2.js → chunk-TOCWAEQB.js} +1 -1
- package/dist/bundle/chunks/{chunk-JGRPPPHS.js → chunk-VGJESQOS.js} +1 -1
- package/dist/bundle/chunks/{chunk-YEMM3LPR.js → chunk-VW3QZSX3.js} +1 -1
- package/dist/bundle/chunks/{chunk-XNIX26QC.js → chunk-WXN35RD7.js} +1 -1
- package/dist/bundle/chunks/{cli-main-NUSBF3HE.js → cli-main-IBG7ONGV.js} +1 -1
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{help-fast-path-A4S4KOQ6.js → help-fast-path-MWSJXPH6.js} +1 -1
- package/dist/bundle/chunks/{host-command-D2CHSATG.js → host-command-MTK5WOPH.js} +1 -1
- package/dist/bundle/chunks/host-lifecycle-7IJCAHHL.js +3 -0
- package/dist/bundle/chunks/host-lifecycle.js +3 -3
- package/dist/bundle/chunks/{interactive-host-runtime-AAK47HIV.js → interactive-host-runtime-FWMZWK6G.js} +1 -1
- package/dist/bundle/chunks/{interactive-mode-LSTD6EUQ.js → interactive-mode-XUJM4MCN.js} +1 -1
- package/dist/bundle/chunks/{multi-session-host-5WNZ7XRV.js → multi-session-host-7KCH3HUA.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-DVEOAQK4.js → openai-completions-BHE6TMUP.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-7H2ADNW4.js → openai-responses-OGQ5QORF.js} +1 -1
- package/dist/bundle/chunks/{package-manager-cli-3HZYQYVX.js → package-manager-cli-SNVT3VKW.js} +1 -1
- package/dist/bundle/chunks/{rotation-stream-F36RJ6VP.js → rotation-stream-Q2EVDMUU.js} +1 -1
- package/dist/bundle/chunks/{rpc-mode-GMPBEVSL.js → rpc-mode-VYB2Q43O.js} +1 -1
- package/dist/bundle/chunks/{schedule-command-BYWZGYOJ.js → schedule-command-JQ65HF2K.js} +1 -1
- package/dist/bundle/chunks/{session-picker-6VU2F5VF.js → session-picker-DRM7AGPY.js} +1 -1
- package/dist/bundle/chunks/session-worker.js +9 -9
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/extensions/builtin/btw/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/btw/index.js +3 -1
- package/dist/core/extensions/builtin/btw/index.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +2 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/native.d.ts +1 -0
- package/dist/core/extensions/builtin/websearch/websearch/native.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/native.js +8 -1
- package/dist/core/extensions/builtin/websearch/websearch/native.js.map +1 -1
- package/dist/modes/rpc/host-identity-env.d.ts +20 -0
- package/dist/modes/rpc/host-identity-env.d.ts.map +1 -0
- package/dist/modes/rpc/host-identity-env.js +20 -0
- package/dist/modes/rpc/host-identity-env.js.map +1 -0
- package/dist/modes/rpc/host-lifecycle.js +1 -1
- package/dist/modes/rpc/host-lifecycle.js.map +1 -1
- package/dist/modes/rpc/host-spawn-environment.js +1 -1
- package/dist/modes/rpc/host-spawn-environment.js.map +1 -1
- package/dist/modes/rpc/protocol-identity.d.ts +2 -11
- package/dist/modes/rpc/protocol-identity.d.ts.map +1 -1
- package/dist/modes/rpc/protocol-identity.js +2 -11
- package/dist/modes/rpc/protocol-identity.js.map +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +12 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-endpoint.d.ts +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-endpoint.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-endpoint.js +48 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-endpoint.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-errors.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-errors.js +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-errors.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js +18 -36
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.models.d.ts +5 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.models.js +6 -5
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js +15 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
- package/dist/bundle/chunks/chunk-HH3KJDWA.js +0 -2
- package/dist/bundle/chunks/chunk-XPJLBOWV.js +0 -5
- package/dist/bundle/chunks/host-lifecycle-S7O5K62Z.js +0 -3
package/dist/bundle/cli.js
CHANGED
|
@@ -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); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
|
|
3
|
-
import{enableStartupCompileCache}from"./chunks/chunk-F73COJ7R.js";import{getLatestPiRelease,hasInheritedInspectorOption,isNewerPackageVersion,processBunRuntimeOptions,releaseInheritedInspectorForChild,resolveBunReexec}from"./chunks/chunk-4LVZQRDG.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,DISPLAY_VERSION,PACKAGE_NAME,VERSION,brandProfile,getAgentDir,getPackageDir,getSelfUpdateCommand,getSelfUpdateUnavailableInstruction,isBundledNode}from"./chunks/chunk-PBWQK23Z.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-IKOFCODM.js";import{spawn as spawn2,spawnSync}from"node:child_process";import{existsSync,realpathSync}from"node:fs";import{join as join2}from"node:path";import{fileURLToPath}from"node:url";import{spawn}from"node:child_process";import{readFileSync}from"node:fs";import{join}from"node:path";function parseBootstrapSelfUpdateArgs(args2){let[command,...rest]=args2;if(command!=="update")return;let force=!1,selfFlag=!1,extensionsFlag=!1,extensionFlag=!1,source;for(let index=0;index<rest.length;index++){let arg=rest[index];if(arg==="-h"||arg==="--help")return;if(arg==="--force"){force=!0;continue}if(arg==="--self"){selfFlag=!0;continue}if(arg==="--extensions"){extensionsFlag=!0;continue}if(arg==="--extension"){extensionFlag=!0,index++;continue}if(arg.startsWith("-")||source)return;source=arg}if(extensionFlag)return;let sourceIsSelf=source==="self"||source==="pi"||source===APP_NAME;if(!(source&&!sourceIsSelf)&&!(!selfFlag&&!sourceIsSelf&&extensionsFlag))return{force}}function getObjectProperty(value,key){if(!(!value||typeof value!="object"))return Object.getOwnPropertyDescriptor(value,key)?.value}function readConfiguredNpmCommand(){try{let parsed=JSON.parse(readFileSync(join(getAgentDir(),"settings.json"),"utf-8")),npmCommand=getObjectProperty(parsed,"npmCommand");return!Array.isArray(npmCommand)||npmCommand.some(part=>typeof part!="string")?void 0:npmCommand.length>0?npmCommand:void 0}catch{return}}async function runCommand(step){await new Promise((resolve,reject)=>{let child=spawn(step.command,step.args,{stdio:"inherit"});child.on("error",error=>{reject(error)}),child.on("close",(code,signal)=>{code===0?resolve():reject(signal?new Error(`${step.display} terminated by signal ${signal}`):new Error(`${step.display} exited with code ${code??"unknown"}`))})})}async function handleBootstrapSelfUpdate(args2,dependencies={}){let parsed=parseBootstrapSelfUpdateArgs(args2);if(!parsed)return!1;let writeStdout=dependencies.writeStdout??(line=>console.log(line)),writeStderr=dependencies.writeStderr??(line=>console.error(line)),readNpmCommand=dependencies.readNpmCommand??readConfiguredNpmCommand,resolveSelfUpdateCommand=dependencies.getSelfUpdateCommand??getSelfUpdateCommand,resolveUnavailableInstruction=dependencies.getUnavailableInstruction??getSelfUpdateUnavailableInstruction,executeCommand=dependencies.runCommand??runCommand,brandUpdate=brandProfile()?.update;if(brandUpdate)return writeStdout(`${APP_NAME} ships inside ${brandUpdate.packageName}. Update it with: ${brandUpdate.command}`),!0;let loadLatestRelease=dependencies.getLatestRelease??getLatestPiRelease,latestRelease;if(!parsed.force)try{latestRelease=await loadLatestRelease(VERSION)}catch{latestRelease=void 0}let updatePackageName=latestRelease?.packageName??PACKAGE_NAME;if(!(parsed.force||!latestRelease||updatePackageName!==PACKAGE_NAME||isNewerPackageVersion(latestRelease.version,VERSION)))return writeStdout(`${APP_NAME} is already up to date (v${VERSION})`),!0;let npmCommand=readNpmCommand(),selfUpdateCommand=resolveSelfUpdateCommand(PACKAGE_NAME,npmCommand,updatePackageName);if(!selfUpdateCommand)return writeStderr(`error: ${APP_NAME} cannot self-update this installation.`),writeStderr(resolveUnavailableInstruction(PACKAGE_NAME,npmCommand,updatePackageName)),process.argv[1]&&(writeStderr(""),writeStderr(`Location of ${APP_NAME} executable: ${process.argv[1]}`)),process.exitCode=1,!0;latestRelease?.note?.trim()&&(writeStdout(""),writeStdout("Update note"),writeStdout(latestRelease.note.trim()),writeStdout("")),writeStdout(`Updating ${APP_NAME} with ${selfUpdateCommand.display}...`);for(let step of selfUpdateCommand.steps??[selfUpdateCommand])try{await executeCommand(step)}catch(error){let message=error instanceof Error?error.message:"Unknown package command error";return writeStderr(`Error: ${message}`),writeStderr(`If this keeps failing, run this command yourself: ${selfUpdateCommand.display}`),process.exitCode=1,!0}return writeStdout(`Updated ${APP_NAME}`),!0}function reexecUnderBunIfNeeded(){let options=processBunRuntimeOptions(existsSync,realpathSync),scriptRealPath=process.argv[1]??fileURLToPath(import.meta.url);try{scriptRealPath=realpathSync(scriptRealPath)}catch{}let decision=resolveBunReexec({scriptRealPath,versions:process.versions,hasInheritedInspectorOption:hasInheritedInspectorOption(),options});if(decision.action==="stay")return!1;let result=spawnSync(decision.bunPath,[scriptRealPath,...process.argv.slice(2)],{stdio:"inherit",windowsHide:!0});return result.signal?(process.kill(process.pid,result.signal),!0):(process.exitCode=result.status??1,!0)}reexecUnderBunIfNeeded()&&process.exit();enableStartupCompileCache();process.title=APP_NAME;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});var args=process.argv.slice(2),PACKAGE_COMMANDS=new Set(["install","remove","uninstall","update","list","config"]);function isRootCommand(args2){let firstArg=args2[0];return firstArg===void 0||!PACKAGE_COMMANDS.has(firstArg)}function isPackageManagerInstall(packageDir){return packageDir.replace(/\\/g,"/").includes("/node_modules/@code-yeongyu/senpi")}function isMissingBundledWorkspaceDependencies(packageDir){return isPackageManagerInstall(packageDir)?["pi-agent-core","pi-ai","pi-tui"].some(name=>!existsSync(join2(packageDir,"node_modules","@earendil-works",name,"dist","index.js"))):!1}var ISOLATED_CHILD_ENV="SENPI_CLI_ISOLATED_CHILD";function requiresIsolatedProcess(){return process.env[ISOLATED_CHILD_ENV]==="1"?!1:process.execArgv.length>0||hasInheritedInspectorOption()}async function spawnFullCli(){let extension=import.meta.url.endsWith(".ts")?".ts":".js",fullCliPath=isBundledNode?fileURLToPath(import.meta.url):fileURLToPath(new URL(`./cli-main${extension}`,import.meta.url));releaseInheritedInspectorForChild();let childEnvironment=isBundledNode?{...process.env,[ISOLATED_CHILD_ENV]:"1"}:process.env;return await new Promise((resolve,reject)=>{let child=spawn2(process.execPath,[...process.execArgv,fullCliPath,...args],{env:childEnvironment,stdio:"inherit"});child.on("error",error=>{reject(error)}),child.on("close",(code,signal)=>{if(signal){process.kill(process.pid,signal),resolve(1);return}resolve(code??1)})})}isRootCommand(args)&&(args.includes("--version")||args.includes("-v"))&&(console.log(DISPLAY_VERSION),process.exit());if(isRootCommand(args)&&args.some(arg=>arg==="--help"||arg==="-h")){let{tryPrintHelpWithoutEngine}=await import("./chunks/help-fast-path-
|
|
3
|
+
import{enableStartupCompileCache}from"./chunks/chunk-F73COJ7R.js";import{getLatestPiRelease,hasInheritedInspectorOption,isNewerPackageVersion,processBunRuntimeOptions,releaseInheritedInspectorForChild,resolveBunReexec}from"./chunks/chunk-4LVZQRDG.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,DISPLAY_VERSION,PACKAGE_NAME,VERSION,brandProfile,getAgentDir,getPackageDir,getSelfUpdateCommand,getSelfUpdateUnavailableInstruction,isBundledNode}from"./chunks/chunk-PBWQK23Z.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-IKOFCODM.js";import{spawn as spawn2,spawnSync}from"node:child_process";import{existsSync,realpathSync}from"node:fs";import{join as join2}from"node:path";import{fileURLToPath}from"node:url";import{spawn}from"node:child_process";import{readFileSync}from"node:fs";import{join}from"node:path";function parseBootstrapSelfUpdateArgs(args2){let[command,...rest]=args2;if(command!=="update")return;let force=!1,selfFlag=!1,extensionsFlag=!1,extensionFlag=!1,source;for(let index=0;index<rest.length;index++){let arg=rest[index];if(arg==="-h"||arg==="--help")return;if(arg==="--force"){force=!0;continue}if(arg==="--self"){selfFlag=!0;continue}if(arg==="--extensions"){extensionsFlag=!0;continue}if(arg==="--extension"){extensionFlag=!0,index++;continue}if(arg.startsWith("-")||source)return;source=arg}if(extensionFlag)return;let sourceIsSelf=source==="self"||source==="pi"||source===APP_NAME;if(!(source&&!sourceIsSelf)&&!(!selfFlag&&!sourceIsSelf&&extensionsFlag))return{force}}function getObjectProperty(value,key){if(!(!value||typeof value!="object"))return Object.getOwnPropertyDescriptor(value,key)?.value}function readConfiguredNpmCommand(){try{let parsed=JSON.parse(readFileSync(join(getAgentDir(),"settings.json"),"utf-8")),npmCommand=getObjectProperty(parsed,"npmCommand");return!Array.isArray(npmCommand)||npmCommand.some(part=>typeof part!="string")?void 0:npmCommand.length>0?npmCommand:void 0}catch{return}}async function runCommand(step){await new Promise((resolve,reject)=>{let child=spawn(step.command,step.args,{stdio:"inherit"});child.on("error",error=>{reject(error)}),child.on("close",(code,signal)=>{code===0?resolve():reject(signal?new Error(`${step.display} terminated by signal ${signal}`):new Error(`${step.display} exited with code ${code??"unknown"}`))})})}async function handleBootstrapSelfUpdate(args2,dependencies={}){let parsed=parseBootstrapSelfUpdateArgs(args2);if(!parsed)return!1;let writeStdout=dependencies.writeStdout??(line=>console.log(line)),writeStderr=dependencies.writeStderr??(line=>console.error(line)),readNpmCommand=dependencies.readNpmCommand??readConfiguredNpmCommand,resolveSelfUpdateCommand=dependencies.getSelfUpdateCommand??getSelfUpdateCommand,resolveUnavailableInstruction=dependencies.getUnavailableInstruction??getSelfUpdateUnavailableInstruction,executeCommand=dependencies.runCommand??runCommand,brandUpdate=brandProfile()?.update;if(brandUpdate)return writeStdout(`${APP_NAME} ships inside ${brandUpdate.packageName}. Update it with: ${brandUpdate.command}`),!0;let loadLatestRelease=dependencies.getLatestRelease??getLatestPiRelease,latestRelease;if(!parsed.force)try{latestRelease=await loadLatestRelease(VERSION)}catch{latestRelease=void 0}let updatePackageName=latestRelease?.packageName??PACKAGE_NAME;if(!(parsed.force||!latestRelease||updatePackageName!==PACKAGE_NAME||isNewerPackageVersion(latestRelease.version,VERSION)))return writeStdout(`${APP_NAME} is already up to date (v${VERSION})`),!0;let npmCommand=readNpmCommand(),selfUpdateCommand=resolveSelfUpdateCommand(PACKAGE_NAME,npmCommand,updatePackageName);if(!selfUpdateCommand)return writeStderr(`error: ${APP_NAME} cannot self-update this installation.`),writeStderr(resolveUnavailableInstruction(PACKAGE_NAME,npmCommand,updatePackageName)),process.argv[1]&&(writeStderr(""),writeStderr(`Location of ${APP_NAME} executable: ${process.argv[1]}`)),process.exitCode=1,!0;latestRelease?.note?.trim()&&(writeStdout(""),writeStdout("Update note"),writeStdout(latestRelease.note.trim()),writeStdout("")),writeStdout(`Updating ${APP_NAME} with ${selfUpdateCommand.display}...`);for(let step of selfUpdateCommand.steps??[selfUpdateCommand])try{await executeCommand(step)}catch(error){let message=error instanceof Error?error.message:"Unknown package command error";return writeStderr(`Error: ${message}`),writeStderr(`If this keeps failing, run this command yourself: ${selfUpdateCommand.display}`),process.exitCode=1,!0}return writeStdout(`Updated ${APP_NAME}`),!0}function reexecUnderBunIfNeeded(){let options=processBunRuntimeOptions(existsSync,realpathSync),scriptRealPath=process.argv[1]??fileURLToPath(import.meta.url);try{scriptRealPath=realpathSync(scriptRealPath)}catch{}let decision=resolveBunReexec({scriptRealPath,versions:process.versions,hasInheritedInspectorOption:hasInheritedInspectorOption(),options});if(decision.action==="stay")return!1;let result=spawnSync(decision.bunPath,[scriptRealPath,...process.argv.slice(2)],{stdio:"inherit",windowsHide:!0});return result.signal?(process.kill(process.pid,result.signal),!0):(process.exitCode=result.status??1,!0)}reexecUnderBunIfNeeded()&&process.exit();enableStartupCompileCache();process.title=APP_NAME;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});var args=process.argv.slice(2),PACKAGE_COMMANDS=new Set(["install","remove","uninstall","update","list","config"]);function isRootCommand(args2){let firstArg=args2[0];return firstArg===void 0||!PACKAGE_COMMANDS.has(firstArg)}function isPackageManagerInstall(packageDir){return packageDir.replace(/\\/g,"/").includes("/node_modules/@code-yeongyu/senpi")}function isMissingBundledWorkspaceDependencies(packageDir){return isPackageManagerInstall(packageDir)?["pi-agent-core","pi-ai","pi-tui"].some(name=>!existsSync(join2(packageDir,"node_modules","@earendil-works",name,"dist","index.js"))):!1}var ISOLATED_CHILD_ENV="SENPI_CLI_ISOLATED_CHILD";function requiresIsolatedProcess(){return process.env[ISOLATED_CHILD_ENV]==="1"?!1:process.execArgv.length>0||hasInheritedInspectorOption()}async function spawnFullCli(){let extension=import.meta.url.endsWith(".ts")?".ts":".js",fullCliPath=isBundledNode?fileURLToPath(import.meta.url):fileURLToPath(new URL(`./cli-main${extension}`,import.meta.url));releaseInheritedInspectorForChild();let childEnvironment=isBundledNode?{...process.env,[ISOLATED_CHILD_ENV]:"1"}:process.env;return await new Promise((resolve,reject)=>{let child=spawn2(process.execPath,[...process.execArgv,fullCliPath,...args],{env:childEnvironment,stdio:"inherit"});child.on("error",error=>{reject(error)}),child.on("close",(code,signal)=>{if(signal){process.kill(process.pid,signal),resolve(1);return}resolve(code??1)})})}isRootCommand(args)&&(args.includes("--version")||args.includes("-v"))&&(console.log(DISPLAY_VERSION),process.exit());if(isRootCommand(args)&&args.some(arg=>arg==="--help"||arg==="-h")){let{tryPrintHelpWithoutEngine}=await import("./chunks/help-fast-path-MWSJXPH6.js");tryPrintHelpWithoutEngine(args)&&process.exit()}isMissingBundledWorkspaceDependencies(getPackageDir())&&await handleBootstrapSelfUpdate(args)&&process.exit();requiresIsolatedProcess()?process.exitCode=await spawnFullCli():await import("./chunks/cli-main-IBG7ONGV.js");
|
package/dist/bundle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
|
|
2
|
-
import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultResourceLoader,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildNoticeBox,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,connectWebViewService,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,parseSkillBlock,prepareBranchEntries,readOwnFootprint,readProcessFootprint,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,shouldCompact,stripFrontmatter,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-
|
|
2
|
+
import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultResourceLoader,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildNoticeBox,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,connectWebViewService,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,parseSkillBlock,prepareBranchEntries,readOwnFootprint,readProcessFootprint,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,shouldCompact,stripFrontmatter,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-AWPLVQ4K.js";import"./chunks/chunk-FAV4DX74.js";import{DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionSelectorComponent,keyHint,keyText,rawKeyHint}from"./chunks/chunk-VW3QZSX3.js";import"./chunks/chunk-A4UMPXQF.js";import"./chunks/chunk-TFA3YAJK.js";import{CURRENT_SESSION_VERSION,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SessionManager,buildContextEntries,buildSessionContext,convertToLlm,formatSize,getLatestCompactionEntry,isTransportGoneError,migrateSessionEntries,parseSessionEntries,sessionEntryToContextMessages,truncateHead,truncateLine,truncateTail}from"./chunks/chunk-DKP4BUY5.js";import"./chunks/chunk-NZRVAZL2.js";import"./chunks/chunk-U5KVIAHJ.js";import{runRpcMode}from"./chunks/chunk-WXN35RD7.js";import{Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme}from"./chunks/chunk-3HCYHGK2.js";import{sanitizeTerminalLabel}from"./chunks/chunk-6BWCPOCV.js";import"./chunks/chunk-AIM2YESB.js";import{SettingsManager}from"./chunks/chunk-CXVI2YV7.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-BMX2U22F.js";import{DEFAULT_HOST_LAUNCH_SPEC,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HostLaunchSpecError,loadHostLaunchSpec,parseHostLaunchSpec,readHostStatus,runHostCommand,runHostRequest}from"./chunks/chunk-VGJESQOS.js";import{GENERATION_HANDOFF_CAPABILITY,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,PINNED_HOST_CLIENT_CAPABILITIES,REQUIRED_HOST_CAPABILITIES,decideHostAction,ensureHost,handoffHost,parseHostProtocolInfo,probeHost,stopHost}from"./chunks/chunk-DOEV7ITR.js";import"./chunks/chunk-BTMM2C5X.js";import{createHostDaemonPaths,daemonDirectoryName,shardKey,shardSocketPath,shardSocketPathForKey}from"./chunks/chunk-HS2LJYBI.js";import{compareEngineOrdinal,engineBuildIdentity,engineBuildIdentityFrom}from"./chunks/chunk-E5F5SVZF.js";import"./chunks/chunk-DA4W77J7.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-SQUUL72H.js";import"./chunks/chunk-JK5LVAOU.js";import{getPowerShellConfig,getShellConfig}from"./chunks/chunk-ASAQQ6VM.js";import"./chunks/chunk-36ACNYQR.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-4BDFNRBE.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-Y5A6TKBN.js";import{parseArgs}from"./chunks/chunk-KDZAVHA7.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-TOCWAEQB.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-UDTWLXSQ.js";import"./chunks/chunk-4LVZQRDG.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-PBWQK23Z.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-RBCQOIAD.js";import"./chunks/chunk-WASCMT6Y.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-IXAUDPOK.js";import"./chunks/chunk-J5TMX734.js";import"./chunks/chunk-LHYG7TK7.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-TJV2LFKM.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-BBK6SSYT.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-7X4ZMME4.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-IKOFCODM.js";export{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_HOST_LAUNCH_SPEC,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,GENERATION_HANDOFF_CAPABILITY,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,HostLaunchSpecError,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,PINNED_HOST_CLIENT_CAPABILITIES,ProjectTrustStore,REQUIRED_HOST_CAPABILITIES,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VERSION,buildContextEntries,buildNoticeBox,buildSessionContext,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,compareEngineOrdinal,connectWebViewService,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createHostDaemonPaths,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,daemonDirectoryName,decideHostAction,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,engineBuildIdentity,engineBuildIdentityFrom,ensureHost,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,handoffHost,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,keyHint,keyText,loadHostLaunchSpec,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseArgs,parseFrontmatter,parseHostLaunchSpec,parseHostProtocolInfo,parseSessionEntries,parseSkillBlock,prepareBranchEntries,probeHost,rawKeyHint,readHostStatus,readOwnFootprint,readProcessFootprint,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runHostCommand,runHostRequest,runPrintMode,runRpcMode,sanitizeTerminalLabel,serializeConversation,sessionEntryToContextMessages,shardKey,shardSocketPath,shardSocketPathForKey,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
|
package/dist/bundle/rpc-entry.js
CHANGED
|
@@ -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); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
|
|
3
|
-
import{main}from"./chunks/chunk-
|
|
3
|
+
import{main}from"./chunks/chunk-AWPLVQ4K.js";import"./chunks/chunk-FAV4DX74.js";import"./chunks/chunk-VW3QZSX3.js";import"./chunks/chunk-A4UMPXQF.js";import"./chunks/chunk-TFA3YAJK.js";import"./chunks/chunk-DKP4BUY5.js";import"./chunks/chunk-NZRVAZL2.js";import"./chunks/chunk-U5KVIAHJ.js";import"./chunks/chunk-WXN35RD7.js";import"./chunks/chunk-3HCYHGK2.js";import"./chunks/chunk-6BWCPOCV.js";import"./chunks/chunk-AIM2YESB.js";import{configureHttpDispatcher}from"./chunks/chunk-CXVI2YV7.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-VGJESQOS.js";import"./chunks/chunk-DOEV7ITR.js";import"./chunks/chunk-BTMM2C5X.js";import"./chunks/chunk-HS2LJYBI.js";import"./chunks/chunk-E5F5SVZF.js";import"./chunks/chunk-DA4W77J7.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-SQUUL72H.js";import"./chunks/chunk-JK5LVAOU.js";import"./chunks/chunk-ASAQQ6VM.js";import"./chunks/chunk-36ACNYQR.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-4BDFNRBE.js";import"./chunks/chunk-Y5A6TKBN.js";import"./chunks/chunk-KDZAVHA7.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-TOCWAEQB.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-UDTWLXSQ.js";import"./chunks/chunk-4LVZQRDG.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-PBWQK23Z.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-RBCQOIAD.js";import"./chunks/chunk-WASCMT6Y.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-IXAUDPOK.js";import"./chunks/chunk-J5TMX734.js";import"./chunks/chunk-LHYG7TK7.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-TJV2LFKM.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-BBK6SSYT.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-7X4ZMME4.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-IKOFCODM.js";process.title=`${APP_NAME}-rpc`;scrubBrandFromEnvironment();process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/btw/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AAarE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/btw/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AAarE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,EAAE,YAAY,QA0IpD"}
|
|
@@ -92,7 +92,9 @@ export default function btwExtension(pi) {
|
|
|
92
92
|
promptContextWindow: getSideQueryPromptContextWindow(model),
|
|
93
93
|
});
|
|
94
94
|
const { replyText } = await runSideQuery({
|
|
95
|
-
|
|
95
|
+
// The credential's own API host (a Copilot Business or Enterprise account) must
|
|
96
|
+
// survive the explicit key below, as it does for the session's chat requests.
|
|
97
|
+
model: auth.baseUrl ? { ...model, baseUrl: auth.baseUrl } : model,
|
|
96
98
|
auth: {
|
|
97
99
|
apiKey: auth.apiKey,
|
|
98
100
|
headers: auth.headers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/btw/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,+BAA+B,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEvG,MAAM,UAAU,GAAG,KAAK,CAAC;AASzB,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAgB;IACpD,IAAI,MAA6B,CAAC;IAElC,SAAS,OAAO,CAAC,GAAqB,EAAE,OAA2B;QAClE,MAAM,OAAO,GAAG,MAAM,CAAC;QACvB,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,MAAM,GAAG,SAAS,CAAC;QACnB,IAAI,OAAO,CAAC,KAAK;YAAE,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QAC9C,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;QAC9B,IAAI,OAAO,CAAC,KAAK;YAAE,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC5D,CAAC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BAAM,CAAC;oBACP,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,gBAAgB,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;gBACnD,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { isKeyRelease, matchesKey } from \"@earendil-works/pi-tui\";\nimport { convertToLlm, filterContextExcludedMessages } from \"../../../messages.ts\";\nimport { buildSessionContext } from \"../../../session-manager.ts\";\nimport type { ExtensionAPI, ExtensionContext } from \"../../types.ts\";\nimport { BtwPanel } from \"./panel.ts\";\nimport { buildSideQueryContext, getSideQueryPromptContextWindow, runSideQuery } from \"./side-query.ts\";\n\nconst WIDGET_KEY = \"btw\";\n\ninterface ActiveBtw {\n\tcontroller: AbortController;\n\tpanel: BtwPanel | undefined;\n\tunsubscribeEscape: (() => void) | undefined;\n\tsettled: boolean;\n}\n\nexport default function btwExtension(pi: ExtensionAPI) {\n\tlet active: ActiveBtw | undefined;\n\n\tfunction dismiss(ctx: ExtensionContext, options: { abort: boolean }): void {\n\t\tconst current = active;\n\t\tif (!current) return;\n\t\tactive = undefined;\n\t\tif (options.abort) current.controller.abort();\n\t\tcurrent.unsubscribeEscape?.();\n\t\tif (current.panel) ctx.ui.setWidget(WIDGET_KEY, undefined);\n\t}\n\n\tpi.on(\"session_before_switch\", (_event, ctx) => {\n\t\tdismiss(ctx, { abort: true });\n\t});\n\n\tpi.on(\"session_before_fork\", (_event, ctx) => {\n\t\tdismiss(ctx, { abort: true });\n\t});\n\n\tpi.on(\"session_shutdown\", (_event, ctx) => {\n\t\tdismiss(ctx, { abort: true });\n\t});\n\n\tpi.on(\"input\", (_event, ctx) => {\n\t\tif (active?.settled) dismiss(ctx, { abort: false });\n\t});\n\n\tpi.registerCommand(\"btw\", {\n\t\tdescription: \"Ask a side question in parallel without touching the main session\",\n\t\targumentHint: \"<question>\",\n\t\thandler: async (args, ctx) => {\n\t\t\tconst question = args.trim();\n\t\t\tif (!question) {\n\t\t\t\t// Bare /btw is the explicit off switch: it closes the panel (or cancels an\n\t\t\t\t// in-flight side query) without interrupting the main turn the way Escape does.\n\t\t\t\tif (active) {\n\t\t\t\t\tdismiss(ctx, { abort: true });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tctx.ui.notify(\"Usage: /btw <question>\", \"warning\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst model = ctx.model;\n\t\t\tif (!model) {\n\t\t\t\tctx.ui.notify(\"No active model available for /btw.\", \"error\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst snapshot = buildSessionContext(ctx.sessionManager.getEntries(), ctx.sessionManager.getLeafId());\n\t\t\tconst history = convertToLlm(filterContextExcludedMessages(snapshot.messages));\n\t\t\tconst systemPrompt = ctx.getSystemPrompt();\n\t\t\tconst thinkingLevel = pi.getThinkingLevel();\n\t\t\tconst sessionId = ctx.sessionManager.getSessionId();\n\n\t\t\tdismiss(ctx, { abort: true });\n\t\t\tconst controller = new AbortController();\n\t\t\tconst entry: ActiveBtw = { controller, panel: undefined, unsubscribeEscape: undefined, settled: false };\n\t\t\tactive = entry;\n\n\t\t\tif (ctx.mode === \"tui\" && ctx.hasUI) {\n\t\t\t\tctx.ui.setWidget(WIDGET_KEY, (tui, theme) => {\n\t\t\t\t\tconst panel = new BtwPanel(question, tui, theme);\n\t\t\t\t\tentry.panel = panel;\n\t\t\t\t\treturn panel.component;\n\t\t\t\t});\n\t\t\t\tentry.unsubscribeEscape = ctx.ui.onTerminalInput((data) => {\n\t\t\t\t\t// matchesKey accepts the raw byte plus kitty CSI-u / modifyOtherKeys encodings.\n\t\t\t\t\t// Ignore key releases: kitty CSI-u emits a release event after every press,\n\t\t\t\t\t// and this listener runs ahead of the TUI's release filter, so a release\n\t\t\t\t\t// whose press was consumed elsewhere would otherwise cancel the query.\n\t\t\t\t\tif (active !== entry || isKeyRelease(data) || !matchesKey(data, \"escape\")) return undefined;\n\t\t\t\t\tdismiss(ctx, { abort: true });\n\t\t\t\t\treturn undefined;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst auth = await ctx.modelRegistry.getApiKeyAndHeaders(model);\n\t\t\tif (!auth.ok) {\n\t\t\t\tif (active !== entry) return;\n\t\t\t\tdismiss(ctx, { abort: false });\n\t\t\t\tctx.ui.notify(`/btw: ${auth.error}`, \"error\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst context = buildSideQueryContext({\n\t\t\t\t\tsystemPrompt,\n\t\t\t\t\thistory,\n\t\t\t\t\tquestion,\n\t\t\t\t\tpromptContextWindow: getSideQueryPromptContextWindow(model),\n\t\t\t\t});\n\t\t\t\tconst { replyText } = await runSideQuery(\n\t\t\t\t\t{\n\t\t\t\t\t\tmodel,\n\t\t\t\t\t\tauth: {\n\t\t\t\t\t\t\tapiKey: auth.apiKey,\n\t\t\t\t\t\t\theaders: auth.headers,\n\t\t\t\t\t\t\textraBody: auth.extraBody,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\tthinkingLevel: thinkingLevel === \"off\" ? undefined : thinkingLevel,\n\t\t\t\t\t\tstreamFn: (streamModel, streamContext, options) =>\n\t\t\t\t\t\t\tctx.modelRegistry.modelRuntime.streamSimple(streamModel, streamContext, options),\n\t\t\t\t\t},\n\t\t\t\t\tcontext,\n\t\t\t\t\t{\n\t\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t\t\tonTextDelta: (delta) => {\n\t\t\t\t\t\t\tif (active === entry) entry.panel?.appendText(delta);\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tif (active !== entry) return;\n\t\t\t\tentry.settled = true;\n\t\t\t\tif (entry.panel) {\n\t\t\t\t\tentry.panel.markDone();\n\t\t\t\t} else {\n\t\t\t\t\tctx.ui.notify(replyText, \"info\");\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (active !== entry) return;\n\t\t\t\tentry.settled = true;\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tif (controller.signal.aborted) {\n\t\t\t\t\tentry.panel?.markAborted();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (entry.panel) {\n\t\t\t\t\tentry.panel.markError(message);\n\t\t\t\t} else {\n\t\t\t\t\tctx.ui.notify(`/btw failed: ${message}`, \"error\");\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/btw/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,+BAA+B,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEvG,MAAM,UAAU,GAAG,KAAK,CAAC;AASzB,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAgB;IACpD,IAAI,MAA6B,CAAC;IAElC,SAAS,OAAO,CAAC,GAAqB,EAAE,OAA2B;QAClE,MAAM,OAAO,GAAG,MAAM,CAAC;QACvB,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,MAAM,GAAG,SAAS,CAAC;QACnB,IAAI,OAAO,CAAC,KAAK;YAAE,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QAC9C,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;QAC9B,IAAI,OAAO,CAAC,KAAK;YAAE,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC5D,CAAC;IAED,EAAE,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,MA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,KAAK,CAAC,KAAK,EAAE,CAAC;oBACjB,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAChC,CAAC;qBAAM,CAAC;oBACP,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,gBAAgB,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;gBACnD,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { isKeyRelease, matchesKey } from \"@earendil-works/pi-tui\";\nimport { convertToLlm, filterContextExcludedMessages } from \"../../../messages.ts\";\nimport { buildSessionContext } from \"../../../session-manager.ts\";\nimport type { ExtensionAPI, ExtensionContext } from \"../../types.ts\";\nimport { BtwPanel } from \"./panel.ts\";\nimport { buildSideQueryContext, getSideQueryPromptContextWindow, runSideQuery } from \"./side-query.ts\";\n\nconst WIDGET_KEY = \"btw\";\n\ninterface ActiveBtw {\n\tcontroller: AbortController;\n\tpanel: BtwPanel | undefined;\n\tunsubscribeEscape: (() => void) | undefined;\n\tsettled: boolean;\n}\n\nexport default function btwExtension(pi: ExtensionAPI) {\n\tlet active: ActiveBtw | undefined;\n\n\tfunction dismiss(ctx: ExtensionContext, options: { abort: boolean }): void {\n\t\tconst current = active;\n\t\tif (!current) return;\n\t\tactive = undefined;\n\t\tif (options.abort) current.controller.abort();\n\t\tcurrent.unsubscribeEscape?.();\n\t\tif (current.panel) ctx.ui.setWidget(WIDGET_KEY, undefined);\n\t}\n\n\tpi.on(\"session_before_switch\", (_event, ctx) => {\n\t\tdismiss(ctx, { abort: true });\n\t});\n\n\tpi.on(\"session_before_fork\", (_event, ctx) => {\n\t\tdismiss(ctx, { abort: true });\n\t});\n\n\tpi.on(\"session_shutdown\", (_event, ctx) => {\n\t\tdismiss(ctx, { abort: true });\n\t});\n\n\tpi.on(\"input\", (_event, ctx) => {\n\t\tif (active?.settled) dismiss(ctx, { abort: false });\n\t});\n\n\tpi.registerCommand(\"btw\", {\n\t\tdescription: \"Ask a side question in parallel without touching the main session\",\n\t\targumentHint: \"<question>\",\n\t\thandler: async (args, ctx) => {\n\t\t\tconst question = args.trim();\n\t\t\tif (!question) {\n\t\t\t\t// Bare /btw is the explicit off switch: it closes the panel (or cancels an\n\t\t\t\t// in-flight side query) without interrupting the main turn the way Escape does.\n\t\t\t\tif (active) {\n\t\t\t\t\tdismiss(ctx, { abort: true });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tctx.ui.notify(\"Usage: /btw <question>\", \"warning\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst model = ctx.model;\n\t\t\tif (!model) {\n\t\t\t\tctx.ui.notify(\"No active model available for /btw.\", \"error\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst snapshot = buildSessionContext(ctx.sessionManager.getEntries(), ctx.sessionManager.getLeafId());\n\t\t\tconst history = convertToLlm(filterContextExcludedMessages(snapshot.messages));\n\t\t\tconst systemPrompt = ctx.getSystemPrompt();\n\t\t\tconst thinkingLevel = pi.getThinkingLevel();\n\t\t\tconst sessionId = ctx.sessionManager.getSessionId();\n\n\t\t\tdismiss(ctx, { abort: true });\n\t\t\tconst controller = new AbortController();\n\t\t\tconst entry: ActiveBtw = { controller, panel: undefined, unsubscribeEscape: undefined, settled: false };\n\t\t\tactive = entry;\n\n\t\t\tif (ctx.mode === \"tui\" && ctx.hasUI) {\n\t\t\t\tctx.ui.setWidget(WIDGET_KEY, (tui, theme) => {\n\t\t\t\t\tconst panel = new BtwPanel(question, tui, theme);\n\t\t\t\t\tentry.panel = panel;\n\t\t\t\t\treturn panel.component;\n\t\t\t\t});\n\t\t\t\tentry.unsubscribeEscape = ctx.ui.onTerminalInput((data) => {\n\t\t\t\t\t// matchesKey accepts the raw byte plus kitty CSI-u / modifyOtherKeys encodings.\n\t\t\t\t\t// Ignore key releases: kitty CSI-u emits a release event after every press,\n\t\t\t\t\t// and this listener runs ahead of the TUI's release filter, so a release\n\t\t\t\t\t// whose press was consumed elsewhere would otherwise cancel the query.\n\t\t\t\t\tif (active !== entry || isKeyRelease(data) || !matchesKey(data, \"escape\")) return undefined;\n\t\t\t\t\tdismiss(ctx, { abort: true });\n\t\t\t\t\treturn undefined;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst auth = await ctx.modelRegistry.getApiKeyAndHeaders(model);\n\t\t\tif (!auth.ok) {\n\t\t\t\tif (active !== entry) return;\n\t\t\t\tdismiss(ctx, { abort: false });\n\t\t\t\tctx.ui.notify(`/btw: ${auth.error}`, \"error\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst context = buildSideQueryContext({\n\t\t\t\t\tsystemPrompt,\n\t\t\t\t\thistory,\n\t\t\t\t\tquestion,\n\t\t\t\t\tpromptContextWindow: getSideQueryPromptContextWindow(model),\n\t\t\t\t});\n\t\t\t\tconst { replyText } = await runSideQuery(\n\t\t\t\t\t{\n\t\t\t\t\t\t// The credential's own API host (a Copilot Business or Enterprise account) must\n\t\t\t\t\t\t// survive the explicit key below, as it does for the session's chat requests.\n\t\t\t\t\t\tmodel: auth.baseUrl ? { ...model, baseUrl: auth.baseUrl } : model,\n\t\t\t\t\t\tauth: {\n\t\t\t\t\t\t\tapiKey: auth.apiKey,\n\t\t\t\t\t\t\theaders: auth.headers,\n\t\t\t\t\t\t\textraBody: auth.extraBody,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\tthinkingLevel: thinkingLevel === \"off\" ? undefined : thinkingLevel,\n\t\t\t\t\t\tstreamFn: (streamModel, streamContext, options) =>\n\t\t\t\t\t\t\tctx.modelRegistry.modelRuntime.streamSimple(streamModel, streamContext, options),\n\t\t\t\t\t},\n\t\t\t\t\tcontext,\n\t\t\t\t\t{\n\t\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t\t\tonTextDelta: (delta) => {\n\t\t\t\t\t\t\tif (active === entry) entry.panel?.appendText(delta);\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tif (active !== entry) return;\n\t\t\t\tentry.settled = true;\n\t\t\t\tif (entry.panel) {\n\t\t\t\t\tentry.panel.markDone();\n\t\t\t\t} else {\n\t\t\t\t\tctx.ui.notify(replyText, \"info\");\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (active !== entry) return;\n\t\t\t\tentry.settled = true;\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tif (controller.signal.aborted) {\n\t\t\t\t\tentry.panel?.markAborted();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (entry.panel) {\n\t\t\t\t\tentry.panel.markError(message);\n\t\t\t\t} else {\n\t\t\t\t\tctx.ui.notify(`/btw failed: ${message}`, \"error\");\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AA6BxF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAqB,MAAM,eAAe,CAAC;AAEpG,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,KAAK,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC5D,KAAK,6BAA6B,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AA6BxF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAqB,MAAM,eAAe,CAAC;AAEpG,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,KAAK,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC5D,KAAK,6BAA6B,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CACf;AAwPD,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,6BAA6B,EACpC,QAAQ,EAAE,oBAAoB,GAC5B,kBAAkB,GAAG,SAAS,CA4EhC;AA0ED,wBAAgB,aAAa,CAC5B,KAAK,EAAE,6BAA6B,EACpC,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC,GAChD,oBAAoB,GAAG,SAAS,CAMlC"}
|
|
@@ -96,8 +96,9 @@ function hasKimiK3Signal(value) {
|
|
|
96
96
|
function isKimiK3Model(model) {
|
|
97
97
|
return hasKimiK3Signal(model.id) || (model.name !== undefined && hasKimiK3Signal(model.name));
|
|
98
98
|
}
|
|
99
|
+
// Exactly the SWE-2 lanes Devin's Cascade serves; every other swe-2 uid is refused upstream (#2306).
|
|
99
100
|
function hasSWE2Signal(value) {
|
|
100
|
-
return /(?:^|[/@:._-])swe-2-(?:high|max
|
|
101
|
+
return /(?:^|[/@:._-])swe-2-(?:medium|high|max)(?:$|[/@:._])/.test(normalizeModelId(value));
|
|
101
102
|
}
|
|
102
103
|
function isSWE2Model(model) {
|
|
103
104
|
return hasSWE2Signal(model.id) || (model.name !== undefined && hasSWE2Signal(model.name));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAA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AO,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5D,CAAC;AACF,CAAC;AAED,SAAS,YAAY,CAAC,OAAO,GAA6C,EAAE;IAC3E,OAAO;QACN,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE;QACtB,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,EAAE;QAC1C,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;QAChD,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;KAC5B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,KAAoC,EACpC,QAA8B,EAC9B,OAAkD;IAElD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { BuildDynamicSystemPromptOptions } from \"../../../dynamic-prompt/build.ts\";\nimport { buildClaudeFable5Prompt } from \"./claude-fable-5.ts\";\nimport { buildClaudeFable51Prompt } from \"./claude-fable-5-1.ts\";\nimport { buildClaudeOpus45Prompt } from \"./claude-opus-4-5.ts\";\nimport { buildClaudeOpus46Prompt } from \"./claude-opus-4-6.ts\";\nimport { buildClaudeOpus47Prompt } from \"./claude-opus-4-7.ts\";\nimport { buildClaudeOpus48Prompt } from \"./claude-opus-4-8.ts\";\nimport { buildClaudeOpus5Prompt } from \"./claude-opus-5.ts\";\nimport { buildClaudeOpus55Prompt } from \"./claude-opus-5-5.ts\";\nimport { buildDeepseekV41FlashPrompt } from \"./deepseek-v4-1-flash.ts\";\nimport { buildDeepseekV4FlashPrompt } from \"./deepseek-v4-flash.ts\";\nimport { buildDeepseekV4Flash0731Prompt } from \"./deepseek-v4-flash-0731.ts\";\nimport { buildDeepseekV4ProPrompt } from \"./deepseek-v4-pro.ts\";\nimport { buildGlm52Prompt } from \"./glm-5-2.ts\";\nimport { buildGlm53Prompt } from \"./glm-5-3.ts\";\nimport { buildGpt52Prompt } from \"./gpt-5.2.ts\";\nimport { buildGpt53CodexPrompt } from \"./gpt-5.3-codex.ts\";\nimport { buildGpt54Prompt } from \"./gpt-5.4.ts\";\nimport { buildGpt55Prompt } from \"./gpt-5.5.ts\";\nimport { buildGpt56Prompt } from \"./gpt-5.6.ts\";\nimport { buildGpt5Prompt } from \"./gpt-5.ts\";\nimport { buildGpt6AstraPrompt } from \"./gpt-6-astra.ts\";\nimport { buildGrok45Prompt } from \"./grok-4.5.ts\";\nimport { buildGrok46Prompt } from \"./grok-4.6.ts\";\nimport { buildGrok47Prompt } from \"./grok-4.7.ts\";\nimport { buildKimiK26Prompt } from \"./kimi-k2-6.ts\";\nimport { buildKimiK27Prompt } from \"./kimi-k2-7.ts\";\nimport { buildKimiK28Prompt } from \"./kimi-k2-8.ts\";\nimport { buildKimiK3Prompt } from \"./kimi-k3.ts\";\nimport { type PromptPresetName, type PromptPresetSettings, parsePromptPreset } from \"./settings.ts\";\n\nexport type { PromptPresetSettings } from \"./settings.ts\";\n\ntype ResolvedPresetName = Exclude<PromptPresetName, \"auto\">;\ntype ModelWithPromptPresetMetadata = Pick<Model<Api>, \"id\" | \"provider\"> & {\n\tname?: string;\n\tpromptPreset?: string;\n};\n\nexport interface ResolvedPromptPreset {\n\tname: ResolvedPresetName;\n\tprompt: string;\n}\n\nfunction normalizeModelId(modelId: string): string {\n\treturn modelId.toLowerCase().replace(/\\s+/g, \"-\");\n}\n\n// The GPT-6 family (Astra, Sol, Luna) shares one prompting guide\n// (developers.openai.com/api/docs/guides/latest-model, 2026-09-23), so every tier\n// renders the gpt-6-astra preset; the preset keeps that name because settings.json\n// already pins it. Id shapes verified against the OpenAI model pages, codex's\n// models.json, models.dev and Bedrock's catalog: gpt-6-sol, gpt-6-luna-fast, dated\n// snapshots, openai/gpt-6-sol, openai-gpt-6-luna, global.openai.gpt-6-astra, and\n// the display names \"GPT-6 Sol\" / \"GPT-6 Luna\". Bare \"gpt-6\", \"gpt-6-mini\" and a\n// lone tier word stay out: an unknown sibling deserves its own decision.\nfunction hasGpt6FamilySignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])gpt[._-]?6[._-](?:astra|sol|luna)(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isGpt6FamilyModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGpt6FamilySignal(model.id) || (model.name !== undefined && hasGpt6FamilySignal(model.name));\n}\n\ntype Gpt5Version = \"gpt-5.2\" | \"gpt-5.3-codex\" | \"gpt-5.4\" | \"gpt-5.5\" | \"gpt-5.6\";\n\nfunction extractGpt5Version(modelId: string): Gpt5Version | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"gpt-5.6\")) {\n\t\treturn \"gpt-5.6\";\n\t}\n\tif (normalized.includes(\"gpt-5.5\")) {\n\t\treturn \"gpt-5.5\";\n\t}\n\tif (normalized.includes(\"gpt-5.4\")) {\n\t\treturn \"gpt-5.4\";\n\t}\n\tif (normalized.includes(\"gpt-5.3\")) {\n\t\treturn \"gpt-5.3-codex\";\n\t}\n\tif (normalized.includes(\"gpt-5.2\")) {\n\t\treturn \"gpt-5.2\";\n\t}\n\treturn undefined;\n}\n\nfunction hasKimiK26Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK26Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK26Signal(model.id) || (model.name !== undefined && hasKimiK26Signal(model.name));\n}\n\n// Kimi Code addresses its models by rolling product ids rather than version tags:\n// Moonshot upgraded `kimi-for-coding` to K2.8 Preview in place on 2026-09-11 and\n// left `kimi-for-coding-highspeed` on K2.7 Code HighSpeed.\n// https://www.kimi.com/code/docs/en/kimi-code/models.html (checked 2026-09-18)\nconst KIMI_CODE_K27_MODEL_ID = \"kimi-for-coding-highspeed\";\nconst KIMI_CODE_K28_MODEL_ID = \"kimi-for-coding\";\n\nfunction hasKimiK27Signal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn normalized === KIMI_CODE_K27_MODEL_ID || /(?:^|[/@._-])kimi-k2(?:[._-]|p)7(?:$|[/@._:-])/.test(normalized);\n}\n\nfunction isKimiK27Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK27Signal(model.id) || (model.name !== undefined && hasKimiK27Signal(model.name));\n}\n\nfunction hasKimiK28Signal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn normalized === KIMI_CODE_K28_MODEL_ID || /(?:^|[/@._-])kimi-k2(?:[._-]|p)8(?:$|[/@._:-])/.test(normalized);\n}\n\nfunction isKimiK28Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK28Signal(model.id) || (model.name !== undefined && hasKimiK28Signal(model.name));\n}\n\nfunction hasKimiK3Signal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn normalized === \"k3\" || /(?:^|[/@._-])kimi-k3(?:$|[/@._:-])/.test(normalized);\n}\n\nfunction isKimiK3Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK3Signal(model.id) || (model.name !== undefined && hasKimiK3Signal(model.name));\n}\n\nfunction hasSWE2Signal(value: string): boolean {\n\treturn /(?:^|[/@:._-])swe-2-(?:high|max|low|high-lite)(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isSWE2Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasSWE2Signal(model.id) || (model.name !== undefined && hasSWE2Signal(model.name));\n}\n\n// DeepSeek V4 id shapes verified against the OpenRouter live API, models.dev,\n// and senpi's generated provider catalogs (2026-07-31): deepseek-v4-flash,\n// deepseek/deepseek-v4-flash-0731, deepseek-ai/DeepSeek-V4-Pro,\n// accounts/fireworks/models/deepseek-v4-flash, aihubmix's alicloud-deepseek-v4-*,\n// and trailing tags (:free, -free, :thinking, -nothinking, -cheaper, -lightning, -el).\nfunction hasDeepseekV4Flash0731Signal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]flash[._-]0731(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4Flash0731Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn (\n\t\thasDeepseekV4Flash0731Signal(model.id) || (model.name !== undefined && hasDeepseekV4Flash0731Signal(model.name))\n\t);\n}\n\nfunction hasDeepseekV4FlashSignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]flash(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4FlashModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasDeepseekV4FlashSignal(model.id) || (model.name !== undefined && hasDeepseekV4FlashSignal(model.name));\n}\n\n// DeepSeek V4.1 Flash id shapes verified against models.dev and the provider\n// catalogs (2026-09-11): deepseek-flash (the official API name, also opencode-go),\n// deepseek-v4.1-flash and deepseek/deepseek-v4.1-flash[:thinking] (OpenRouter,\n// Vercel, requesty, kilo, ...), deepseek-ai/DeepSeek-V4.1-Flash (Hugging Face,\n// DeepInfra), accounts/fireworks/models/deepseek-v4p1-flash, venice's\n// deepseek-v4-1-flash, and the display name \"DeepSeek V4.1 Flash\".\nfunction hasDeepseekV41FlashSignal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn (\n\t\t/(?:^|[/@:._-])deepseek[._-]v4(?:[._-]1|p1)[._-]flash(?:$|[/@:._-])/.test(normalized) ||\n\t\t/(?:^|[/@:._-])deepseek[._-]flash(?:$|[/@:._-])/.test(normalized)\n\t);\n}\n\nconst DEEPSEEK_OFFICIAL_PROVIDER = \"deepseek\";\n\n// DeepSeek retired V4 Flash on 2026-09-10: on the official API, deepseek-v4-flash\n// and deepseek-v4-flash-vision-exp are served by V4.1 Flash. Every other\n// provider still hosts the V4 weights under those names.\nfunction isRetiredOfficialDeepseekV4FlashAlias(model: ModelWithPromptPresetMetadata): boolean {\n\treturn model.provider === DEEPSEEK_OFFICIAL_PROVIDER && hasDeepseekV4FlashSignal(model.id);\n}\n\nfunction isDeepseekV41FlashModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn (\n\t\thasDeepseekV41FlashSignal(model.id) ||\n\t\t(model.name !== undefined && hasDeepseekV41FlashSignal(model.name)) ||\n\t\tisRetiredOfficialDeepseekV4FlashAlias(model)\n\t);\n}\n\nfunction hasDeepseekV4ProSignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]pro(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4ProModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasDeepseekV4ProSignal(model.id) || (model.name !== undefined && hasDeepseekV4ProSignal(model.name));\n}\n\nfunction hasGlm52Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)2(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm52Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm52Signal(model.id) || (model.name !== undefined && hasGlm52Signal(model.name));\n}\n\nfunction hasGlm53Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)3(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm53Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm53Signal(model.id) || (model.name !== undefined && hasGlm53Signal(model.name));\n}\n\nfunction hasGrok45Signal(value: string): boolean {\n\t// Match any Grok 4.5 id shape: grok-4.5, grok4.5, grok45, grok-4p5, provider:model,\n\t// path/prefix ids, and trailing tags (:thinking, -latest). Keep 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?5(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok45Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok45Signal(model.id) || (model.name !== undefined && hasGrok45Signal(model.name));\n}\n\nfunction hasGrok46Signal(value: string): boolean {\n\t// Same id shapes as hasGrok45Signal with a 4.6 minor version. Keep 4.5 / 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok46Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok46Signal(model.id) || (model.name !== undefined && hasGrok46Signal(model.name));\n}\n\nfunction hasGrok47Signal(value: string): boolean {\n\t// Same id shapes as hasGrok46Signal with a 4.7 minor version, including venice's dashed\n\t// grok-4-7. Keep 4.6 / 4.5 / 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?7(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok47Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok47Signal(model.id) || (model.name !== undefined && hasGrok47Signal(model.name));\n}\n\n// Claude Mythos shares each Fable release's prompting guide (\"Prompting Claude\n// Fable 5.1\" covers Fable 5.1 and Mythos 5.1; \"Prompting Claude Fable 5\"\n// covers Fable 5 and Mythos 5), so Mythos ids route to the matching Fable preset.\nconst CLAUDE_FABLE_51_MARKERS = [\"fable-5-1\", \"fable-5.1\", \"mythos-5-1\", \"mythos-5.1\"] as const;\nconst CLAUDE_FABLE_5_MARKERS = [\"fable-5\", \"mythos-5\"] as const;\n\nfunction isClaudeFable51Model(modelId: string): boolean {\n\tconst normalized = normalizeModelId(modelId);\n\treturn CLAUDE_FABLE_51_MARKERS.some((marker) => normalized.includes(marker));\n}\n\nfunction isClaudeFable5Model(modelId: string): boolean {\n\tconst normalized = normalizeModelId(modelId);\n\treturn CLAUDE_FABLE_5_MARKERS.some((marker) => normalized.includes(marker));\n}\n\nconst CLAUDE_OPUS_55_MARKERS = [\"opus-5-5\", \"opus-5.5\"] as const;\n\nfunction isClaudeOpus55Model(modelId: string): boolean {\n\tconst normalized = normalizeModelId(modelId);\n\treturn CLAUDE_OPUS_55_MARKERS.some((marker) => normalized.includes(marker));\n}\n\nfunction isClaudeOpus5Model(modelId: string): boolean {\n\treturn normalizeModelId(modelId).includes(\"opus-5\");\n}\n\ntype ClaudeOpusVersion = \"claude-opus-4-8\" | \"claude-opus-4-7\" | \"claude-opus-4-6\" | \"claude-opus-4-5\";\n\nfunction extractClaudeOpusVersion(modelId: string): ClaudeOpusVersion | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"opus-4-8\")) {\n\t\treturn \"claude-opus-4-8\";\n\t}\n\tif (normalized.includes(\"opus-4-7\")) {\n\t\treturn \"claude-opus-4-7\";\n\t}\n\tif (normalized.includes(\"opus-4-6\")) {\n\t\treturn \"claude-opus-4-6\";\n\t}\n\tif (normalized.includes(\"opus-4-5\") || normalized.includes(\"opus-4.5\")) {\n\t\treturn \"claude-opus-4-5\";\n\t}\n\treturn undefined;\n}\n\nexport function resolvePresetName(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n): ResolvedPresetName | undefined {\n\tif (settings.promptPreset !== \"auto\") {\n\t\treturn settings.promptPreset;\n\t}\n\n\tconst modelPromptPreset = parsePromptPreset(model.promptPreset);\n\tif (modelPromptPreset && modelPromptPreset !== \"auto\") {\n\t\treturn modelPromptPreset;\n\t}\n\n\tif (isGpt6FamilyModel(model)) {\n\t\treturn \"gpt-6-astra\";\n\t}\n\tconst gpt5Version = extractGpt5Version(model.id);\n\tif (gpt5Version) {\n\t\treturn gpt5Version;\n\t}\n\tif (isSWE2Model(model) || isKimiK3Model(model)) {\n\t\treturn \"kimi-k3\";\n\t}\n\tif (isKimiK28Model(model)) {\n\t\treturn \"kimi-k2-8\";\n\t}\n\tif (isKimiK27Model(model)) {\n\t\treturn \"kimi-k2-7\";\n\t}\n\tif (isKimiK26Model(model)) {\n\t\treturn \"kimi-k2-6\";\n\t}\n\t// The dotted release must resolve before the generic fable-5 substring.\n\tif (isClaudeFable51Model(model.id)) {\n\t\treturn \"claude-fable-5-1\";\n\t}\n\tif (isClaudeFable5Model(model.id)) {\n\t\treturn \"claude-fable-5\";\n\t}\n\t// The dotted release must resolve before the generic opus-5 substring.\n\tif (isClaudeOpus55Model(model.id)) {\n\t\treturn \"claude-opus-5-5\";\n\t}\n\tif (isClaudeOpus5Model(model.id)) {\n\t\treturn \"claude-opus-5\";\n\t}\n\tconst claudeVersion = extractClaudeOpusVersion(model.id);\n\tif (claudeVersion) {\n\t\treturn claudeVersion;\n\t}\n\tif (isGlm53Model(model)) {\n\t\treturn \"glm-5.3\";\n\t}\n\tif (isGlm52Model(model)) {\n\t\treturn \"glm-5.2\";\n\t}\n\t// The dated snapshot must resolve before the generic flash alias.\n\tif (isDeepseekV4Flash0731Model(model)) {\n\t\treturn \"deepseek-v4-flash-0731\";\n\t}\n\tif (isDeepseekV41FlashModel(model)) {\n\t\treturn \"deepseek-v4-1-flash\";\n\t}\n\tif (isDeepseekV4FlashModel(model)) {\n\t\treturn \"deepseek-v4-flash\";\n\t}\n\tif (isDeepseekV4ProModel(model)) {\n\t\treturn \"deepseek-v4-pro\";\n\t}\n\tif (isGrok47Model(model)) {\n\t\treturn \"grok-4.7\";\n\t}\n\tif (isGrok46Model(model)) {\n\t\treturn \"grok-4.6\";\n\t}\n\tif (isGrok45Model(model)) {\n\t\treturn \"grok-4.5\";\n\t}\n\treturn undefined;\n}\n\nfunction buildPreset(name: ResolvedPresetName, options: BuildDynamicSystemPromptOptions): ResolvedPromptPreset {\n\tswitch (name) {\n\t\tcase \"gpt-6-astra\":\n\t\t\treturn { name, prompt: buildGpt6AstraPrompt(options) };\n\t\tcase \"gpt-5.6\":\n\t\t\treturn { name, prompt: buildGpt56Prompt(options) };\n\t\tcase \"gpt-5.5\":\n\t\t\treturn { name, prompt: buildGpt55Prompt(options) };\n\t\tcase \"gpt-5.4\":\n\t\t\treturn { name, prompt: buildGpt54Prompt(options) };\n\t\tcase \"gpt-5.3-codex\":\n\t\t\treturn { name, prompt: buildGpt53CodexPrompt(options) };\n\t\tcase \"gpt-5.2\":\n\t\t\treturn { name, prompt: buildGpt52Prompt(options) };\n\t\tcase \"gpt-5\":\n\t\t\treturn { name, prompt: buildGpt5Prompt(options) };\n\t\tcase \"glm-5.3\":\n\t\t\treturn { name, prompt: buildGlm53Prompt(options) };\n\t\tcase \"glm-5.2\":\n\t\t\treturn { name, prompt: buildGlm52Prompt(options) };\n\t\tcase \"deepseek-v4-flash\":\n\t\t\treturn { name, prompt: buildDeepseekV4FlashPrompt(options) };\n\t\tcase \"deepseek-v4-flash-0731\":\n\t\t\treturn { name, prompt: buildDeepseekV4Flash0731Prompt(options) };\n\t\tcase \"deepseek-v4-1-flash\":\n\t\t\treturn { name, prompt: buildDeepseekV41FlashPrompt(options) };\n\t\tcase \"deepseek-v4-pro\":\n\t\t\treturn { name, prompt: buildDeepseekV4ProPrompt(options) };\n\t\tcase \"grok-4.7\":\n\t\t\treturn { name, prompt: buildGrok47Prompt(options) };\n\t\tcase \"grok-4.6\":\n\t\t\treturn { name, prompt: buildGrok46Prompt(options) };\n\t\tcase \"grok-4.5\":\n\t\t\treturn { name, prompt: buildGrok45Prompt(options) };\n\t\tcase \"kimi-k3\":\n\t\t\treturn { name, prompt: buildKimiK3Prompt(options) };\n\t\tcase \"kimi-k2-8\":\n\t\t\treturn { name, prompt: buildKimiK28Prompt(options) };\n\t\tcase \"kimi-k2-7\":\n\t\t\treturn { name, prompt: buildKimiK27Prompt(options) };\n\t\tcase \"kimi-k2-6\":\n\t\t\treturn { name, prompt: buildKimiK26Prompt(options) };\n\t\tcase \"claude-fable-5-1\":\n\t\t\treturn { name, prompt: buildClaudeFable51Prompt(options) };\n\t\tcase \"claude-fable-5\":\n\t\t\treturn { name, prompt: buildClaudeFable5Prompt(options) };\n\t\tcase \"claude-opus-5-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus55Prompt(options) };\n\t\tcase \"claude-opus-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus5Prompt(options) };\n\t\tcase \"claude-opus-4-8\":\n\t\t\treturn { name, prompt: buildClaudeOpus48Prompt(options) };\n\t\tcase \"claude-opus-4-7\":\n\t\t\treturn { name, prompt: buildClaudeOpus47Prompt(options) };\n\t\tcase \"claude-opus-4-6\":\n\t\t\treturn { name, prompt: buildClaudeOpus46Prompt(options) };\n\t\tcase \"claude-opus-4-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus45Prompt(options) };\n\t}\n}\n\nfunction withDefaults(options: Partial<BuildDynamicSystemPromptOptions> = {}): BuildDynamicSystemPromptOptions {\n\treturn {\n\t\tcwd: options.cwd ?? \"\",\n\t\tselectedTools: options.selectedTools ?? [],\n\t\ttoolSnippets: options.toolSnippets ?? {},\n\t\tpromptGuidelines: options.promptGuidelines ?? [],\n\t\tcontextFiles: options.contextFiles ?? [],\n\t\tskills: options.skills ?? [],\n\t};\n}\n\nexport function resolvePreset(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n\toptions?: Partial<BuildDynamicSystemPromptOptions>,\n): ResolvedPromptPreset | undefined {\n\tconst name = resolvePresetName(model, settings);\n\tif (!name) {\n\t\treturn undefined;\n\t}\n\treturn buildPreset(name, withDefaults(options));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7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M,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5D,CAAC;AACF,CAAC;AAED,SAAS,YAAY,CAAC,OAAO,GAA6C,EAAE;IAC3E,OAAO;QACN,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE;QACtB,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,EAAE;QAC1C,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;QAChD,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;KAC5B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,KAAoC,EACpC,QAA8B,EAC9B,OAAkD;IAElD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { BuildDynamicSystemPromptOptions } from \"../../../dynamic-prompt/build.ts\";\nimport { buildClaudeFable5Prompt } from \"./claude-fable-5.ts\";\nimport { buildClaudeFable51Prompt } from \"./claude-fable-5-1.ts\";\nimport { buildClaudeOpus45Prompt } from \"./claude-opus-4-5.ts\";\nimport { buildClaudeOpus46Prompt } from \"./claude-opus-4-6.ts\";\nimport { buildClaudeOpus47Prompt } from \"./claude-opus-4-7.ts\";\nimport { buildClaudeOpus48Prompt } from \"./claude-opus-4-8.ts\";\nimport { buildClaudeOpus5Prompt } from \"./claude-opus-5.ts\";\nimport { buildClaudeOpus55Prompt } from \"./claude-opus-5-5.ts\";\nimport { buildDeepseekV41FlashPrompt } from \"./deepseek-v4-1-flash.ts\";\nimport { buildDeepseekV4FlashPrompt } from \"./deepseek-v4-flash.ts\";\nimport { buildDeepseekV4Flash0731Prompt } from \"./deepseek-v4-flash-0731.ts\";\nimport { buildDeepseekV4ProPrompt } from \"./deepseek-v4-pro.ts\";\nimport { buildGlm52Prompt } from \"./glm-5-2.ts\";\nimport { buildGlm53Prompt } from \"./glm-5-3.ts\";\nimport { buildGpt52Prompt } from \"./gpt-5.2.ts\";\nimport { buildGpt53CodexPrompt } from \"./gpt-5.3-codex.ts\";\nimport { buildGpt54Prompt } from \"./gpt-5.4.ts\";\nimport { buildGpt55Prompt } from \"./gpt-5.5.ts\";\nimport { buildGpt56Prompt } from \"./gpt-5.6.ts\";\nimport { buildGpt5Prompt } from \"./gpt-5.ts\";\nimport { buildGpt6AstraPrompt } from \"./gpt-6-astra.ts\";\nimport { buildGrok45Prompt } from \"./grok-4.5.ts\";\nimport { buildGrok46Prompt } from \"./grok-4.6.ts\";\nimport { buildGrok47Prompt } from \"./grok-4.7.ts\";\nimport { buildKimiK26Prompt } from \"./kimi-k2-6.ts\";\nimport { buildKimiK27Prompt } from \"./kimi-k2-7.ts\";\nimport { buildKimiK28Prompt } from \"./kimi-k2-8.ts\";\nimport { buildKimiK3Prompt } from \"./kimi-k3.ts\";\nimport { type PromptPresetName, type PromptPresetSettings, parsePromptPreset } from \"./settings.ts\";\n\nexport type { PromptPresetSettings } from \"./settings.ts\";\n\ntype ResolvedPresetName = Exclude<PromptPresetName, \"auto\">;\ntype ModelWithPromptPresetMetadata = Pick<Model<Api>, \"id\" | \"provider\"> & {\n\tname?: string;\n\tpromptPreset?: string;\n};\n\nexport interface ResolvedPromptPreset {\n\tname: ResolvedPresetName;\n\tprompt: string;\n}\n\nfunction normalizeModelId(modelId: string): string {\n\treturn modelId.toLowerCase().replace(/\\s+/g, \"-\");\n}\n\n// The GPT-6 family (Astra, Sol, Luna) shares one prompting guide\n// (developers.openai.com/api/docs/guides/latest-model, 2026-09-23), so every tier\n// renders the gpt-6-astra preset; the preset keeps that name because settings.json\n// already pins it. Id shapes verified against the OpenAI model pages, codex's\n// models.json, models.dev and Bedrock's catalog: gpt-6-sol, gpt-6-luna-fast, dated\n// snapshots, openai/gpt-6-sol, openai-gpt-6-luna, global.openai.gpt-6-astra, and\n// the display names \"GPT-6 Sol\" / \"GPT-6 Luna\". Bare \"gpt-6\", \"gpt-6-mini\" and a\n// lone tier word stay out: an unknown sibling deserves its own decision.\nfunction hasGpt6FamilySignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])gpt[._-]?6[._-](?:astra|sol|luna)(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isGpt6FamilyModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGpt6FamilySignal(model.id) || (model.name !== undefined && hasGpt6FamilySignal(model.name));\n}\n\ntype Gpt5Version = \"gpt-5.2\" | \"gpt-5.3-codex\" | \"gpt-5.4\" | \"gpt-5.5\" | \"gpt-5.6\";\n\nfunction extractGpt5Version(modelId: string): Gpt5Version | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"gpt-5.6\")) {\n\t\treturn \"gpt-5.6\";\n\t}\n\tif (normalized.includes(\"gpt-5.5\")) {\n\t\treturn \"gpt-5.5\";\n\t}\n\tif (normalized.includes(\"gpt-5.4\")) {\n\t\treturn \"gpt-5.4\";\n\t}\n\tif (normalized.includes(\"gpt-5.3\")) {\n\t\treturn \"gpt-5.3-codex\";\n\t}\n\tif (normalized.includes(\"gpt-5.2\")) {\n\t\treturn \"gpt-5.2\";\n\t}\n\treturn undefined;\n}\n\nfunction hasKimiK26Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK26Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK26Signal(model.id) || (model.name !== undefined && hasKimiK26Signal(model.name));\n}\n\n// Kimi Code addresses its models by rolling product ids rather than version tags:\n// Moonshot upgraded `kimi-for-coding` to K2.8 Preview in place on 2026-09-11 and\n// left `kimi-for-coding-highspeed` on K2.7 Code HighSpeed.\n// https://www.kimi.com/code/docs/en/kimi-code/models.html (checked 2026-09-18)\nconst KIMI_CODE_K27_MODEL_ID = \"kimi-for-coding-highspeed\";\nconst KIMI_CODE_K28_MODEL_ID = \"kimi-for-coding\";\n\nfunction hasKimiK27Signal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn normalized === KIMI_CODE_K27_MODEL_ID || /(?:^|[/@._-])kimi-k2(?:[._-]|p)7(?:$|[/@._:-])/.test(normalized);\n}\n\nfunction isKimiK27Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK27Signal(model.id) || (model.name !== undefined && hasKimiK27Signal(model.name));\n}\n\nfunction hasKimiK28Signal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn normalized === KIMI_CODE_K28_MODEL_ID || /(?:^|[/@._-])kimi-k2(?:[._-]|p)8(?:$|[/@._:-])/.test(normalized);\n}\n\nfunction isKimiK28Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK28Signal(model.id) || (model.name !== undefined && hasKimiK28Signal(model.name));\n}\n\nfunction hasKimiK3Signal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn normalized === \"k3\" || /(?:^|[/@._-])kimi-k3(?:$|[/@._:-])/.test(normalized);\n}\n\nfunction isKimiK3Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK3Signal(model.id) || (model.name !== undefined && hasKimiK3Signal(model.name));\n}\n\n// Exactly the SWE-2 lanes Devin's Cascade serves; every other swe-2 uid is refused upstream (#2306).\nfunction hasSWE2Signal(value: string): boolean {\n\treturn /(?:^|[/@:._-])swe-2-(?:medium|high|max)(?:$|[/@:._])/.test(normalizeModelId(value));\n}\n\nfunction isSWE2Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasSWE2Signal(model.id) || (model.name !== undefined && hasSWE2Signal(model.name));\n}\n\n// DeepSeek V4 id shapes verified against the OpenRouter live API, models.dev,\n// and senpi's generated provider catalogs (2026-07-31): deepseek-v4-flash,\n// deepseek/deepseek-v4-flash-0731, deepseek-ai/DeepSeek-V4-Pro,\n// accounts/fireworks/models/deepseek-v4-flash, aihubmix's alicloud-deepseek-v4-*,\n// and trailing tags (:free, -free, :thinking, -nothinking, -cheaper, -lightning, -el).\nfunction hasDeepseekV4Flash0731Signal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]flash[._-]0731(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4Flash0731Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn (\n\t\thasDeepseekV4Flash0731Signal(model.id) || (model.name !== undefined && hasDeepseekV4Flash0731Signal(model.name))\n\t);\n}\n\nfunction hasDeepseekV4FlashSignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]flash(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4FlashModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasDeepseekV4FlashSignal(model.id) || (model.name !== undefined && hasDeepseekV4FlashSignal(model.name));\n}\n\n// DeepSeek V4.1 Flash id shapes verified against models.dev and the provider\n// catalogs (2026-09-11): deepseek-flash (the official API name, also opencode-go),\n// deepseek-v4.1-flash and deepseek/deepseek-v4.1-flash[:thinking] (OpenRouter,\n// Vercel, requesty, kilo, ...), deepseek-ai/DeepSeek-V4.1-Flash (Hugging Face,\n// DeepInfra), accounts/fireworks/models/deepseek-v4p1-flash, venice's\n// deepseek-v4-1-flash, and the display name \"DeepSeek V4.1 Flash\".\nfunction hasDeepseekV41FlashSignal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn (\n\t\t/(?:^|[/@:._-])deepseek[._-]v4(?:[._-]1|p1)[._-]flash(?:$|[/@:._-])/.test(normalized) ||\n\t\t/(?:^|[/@:._-])deepseek[._-]flash(?:$|[/@:._-])/.test(normalized)\n\t);\n}\n\nconst DEEPSEEK_OFFICIAL_PROVIDER = \"deepseek\";\n\n// DeepSeek retired V4 Flash on 2026-09-10: on the official API, deepseek-v4-flash\n// and deepseek-v4-flash-vision-exp are served by V4.1 Flash. Every other\n// provider still hosts the V4 weights under those names.\nfunction isRetiredOfficialDeepseekV4FlashAlias(model: ModelWithPromptPresetMetadata): boolean {\n\treturn model.provider === DEEPSEEK_OFFICIAL_PROVIDER && hasDeepseekV4FlashSignal(model.id);\n}\n\nfunction isDeepseekV41FlashModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn (\n\t\thasDeepseekV41FlashSignal(model.id) ||\n\t\t(model.name !== undefined && hasDeepseekV41FlashSignal(model.name)) ||\n\t\tisRetiredOfficialDeepseekV4FlashAlias(model)\n\t);\n}\n\nfunction hasDeepseekV4ProSignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]pro(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4ProModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasDeepseekV4ProSignal(model.id) || (model.name !== undefined && hasDeepseekV4ProSignal(model.name));\n}\n\nfunction hasGlm52Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)2(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm52Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm52Signal(model.id) || (model.name !== undefined && hasGlm52Signal(model.name));\n}\n\nfunction hasGlm53Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)3(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm53Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm53Signal(model.id) || (model.name !== undefined && hasGlm53Signal(model.name));\n}\n\nfunction hasGrok45Signal(value: string): boolean {\n\t// Match any Grok 4.5 id shape: grok-4.5, grok4.5, grok45, grok-4p5, provider:model,\n\t// path/prefix ids, and trailing tags (:thinking, -latest). Keep 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?5(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok45Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok45Signal(model.id) || (model.name !== undefined && hasGrok45Signal(model.name));\n}\n\nfunction hasGrok46Signal(value: string): boolean {\n\t// Same id shapes as hasGrok45Signal with a 4.6 minor version. Keep 4.5 / 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok46Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok46Signal(model.id) || (model.name !== undefined && hasGrok46Signal(model.name));\n}\n\nfunction hasGrok47Signal(value: string): boolean {\n\t// Same id shapes as hasGrok46Signal with a 4.7 minor version, including venice's dashed\n\t// grok-4-7. Keep 4.6 / 4.5 / 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?7(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok47Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok47Signal(model.id) || (model.name !== undefined && hasGrok47Signal(model.name));\n}\n\n// Claude Mythos shares each Fable release's prompting guide (\"Prompting Claude\n// Fable 5.1\" covers Fable 5.1 and Mythos 5.1; \"Prompting Claude Fable 5\"\n// covers Fable 5 and Mythos 5), so Mythos ids route to the matching Fable preset.\nconst CLAUDE_FABLE_51_MARKERS = [\"fable-5-1\", \"fable-5.1\", \"mythos-5-1\", \"mythos-5.1\"] as const;\nconst CLAUDE_FABLE_5_MARKERS = [\"fable-5\", \"mythos-5\"] as const;\n\nfunction isClaudeFable51Model(modelId: string): boolean {\n\tconst normalized = normalizeModelId(modelId);\n\treturn CLAUDE_FABLE_51_MARKERS.some((marker) => normalized.includes(marker));\n}\n\nfunction isClaudeFable5Model(modelId: string): boolean {\n\tconst normalized = normalizeModelId(modelId);\n\treturn CLAUDE_FABLE_5_MARKERS.some((marker) => normalized.includes(marker));\n}\n\nconst CLAUDE_OPUS_55_MARKERS = [\"opus-5-5\", \"opus-5.5\"] as const;\n\nfunction isClaudeOpus55Model(modelId: string): boolean {\n\tconst normalized = normalizeModelId(modelId);\n\treturn CLAUDE_OPUS_55_MARKERS.some((marker) => normalized.includes(marker));\n}\n\nfunction isClaudeOpus5Model(modelId: string): boolean {\n\treturn normalizeModelId(modelId).includes(\"opus-5\");\n}\n\ntype ClaudeOpusVersion = \"claude-opus-4-8\" | \"claude-opus-4-7\" | \"claude-opus-4-6\" | \"claude-opus-4-5\";\n\nfunction extractClaudeOpusVersion(modelId: string): ClaudeOpusVersion | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"opus-4-8\")) {\n\t\treturn \"claude-opus-4-8\";\n\t}\n\tif (normalized.includes(\"opus-4-7\")) {\n\t\treturn \"claude-opus-4-7\";\n\t}\n\tif (normalized.includes(\"opus-4-6\")) {\n\t\treturn \"claude-opus-4-6\";\n\t}\n\tif (normalized.includes(\"opus-4-5\") || normalized.includes(\"opus-4.5\")) {\n\t\treturn \"claude-opus-4-5\";\n\t}\n\treturn undefined;\n}\n\nexport function resolvePresetName(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n): ResolvedPresetName | undefined {\n\tif (settings.promptPreset !== \"auto\") {\n\t\treturn settings.promptPreset;\n\t}\n\n\tconst modelPromptPreset = parsePromptPreset(model.promptPreset);\n\tif (modelPromptPreset && modelPromptPreset !== \"auto\") {\n\t\treturn modelPromptPreset;\n\t}\n\n\tif (isGpt6FamilyModel(model)) {\n\t\treturn \"gpt-6-astra\";\n\t}\n\tconst gpt5Version = extractGpt5Version(model.id);\n\tif (gpt5Version) {\n\t\treturn gpt5Version;\n\t}\n\tif (isSWE2Model(model) || isKimiK3Model(model)) {\n\t\treturn \"kimi-k3\";\n\t}\n\tif (isKimiK28Model(model)) {\n\t\treturn \"kimi-k2-8\";\n\t}\n\tif (isKimiK27Model(model)) {\n\t\treturn \"kimi-k2-7\";\n\t}\n\tif (isKimiK26Model(model)) {\n\t\treturn \"kimi-k2-6\";\n\t}\n\t// The dotted release must resolve before the generic fable-5 substring.\n\tif (isClaudeFable51Model(model.id)) {\n\t\treturn \"claude-fable-5-1\";\n\t}\n\tif (isClaudeFable5Model(model.id)) {\n\t\treturn \"claude-fable-5\";\n\t}\n\t// The dotted release must resolve before the generic opus-5 substring.\n\tif (isClaudeOpus55Model(model.id)) {\n\t\treturn \"claude-opus-5-5\";\n\t}\n\tif (isClaudeOpus5Model(model.id)) {\n\t\treturn \"claude-opus-5\";\n\t}\n\tconst claudeVersion = extractClaudeOpusVersion(model.id);\n\tif (claudeVersion) {\n\t\treturn claudeVersion;\n\t}\n\tif (isGlm53Model(model)) {\n\t\treturn \"glm-5.3\";\n\t}\n\tif (isGlm52Model(model)) {\n\t\treturn \"glm-5.2\";\n\t}\n\t// The dated snapshot must resolve before the generic flash alias.\n\tif (isDeepseekV4Flash0731Model(model)) {\n\t\treturn \"deepseek-v4-flash-0731\";\n\t}\n\tif (isDeepseekV41FlashModel(model)) {\n\t\treturn \"deepseek-v4-1-flash\";\n\t}\n\tif (isDeepseekV4FlashModel(model)) {\n\t\treturn \"deepseek-v4-flash\";\n\t}\n\tif (isDeepseekV4ProModel(model)) {\n\t\treturn \"deepseek-v4-pro\";\n\t}\n\tif (isGrok47Model(model)) {\n\t\treturn \"grok-4.7\";\n\t}\n\tif (isGrok46Model(model)) {\n\t\treturn \"grok-4.6\";\n\t}\n\tif (isGrok45Model(model)) {\n\t\treturn \"grok-4.5\";\n\t}\n\treturn undefined;\n}\n\nfunction buildPreset(name: ResolvedPresetName, options: BuildDynamicSystemPromptOptions): ResolvedPromptPreset {\n\tswitch (name) {\n\t\tcase \"gpt-6-astra\":\n\t\t\treturn { name, prompt: buildGpt6AstraPrompt(options) };\n\t\tcase \"gpt-5.6\":\n\t\t\treturn { name, prompt: buildGpt56Prompt(options) };\n\t\tcase \"gpt-5.5\":\n\t\t\treturn { name, prompt: buildGpt55Prompt(options) };\n\t\tcase \"gpt-5.4\":\n\t\t\treturn { name, prompt: buildGpt54Prompt(options) };\n\t\tcase \"gpt-5.3-codex\":\n\t\t\treturn { name, prompt: buildGpt53CodexPrompt(options) };\n\t\tcase \"gpt-5.2\":\n\t\t\treturn { name, prompt: buildGpt52Prompt(options) };\n\t\tcase \"gpt-5\":\n\t\t\treturn { name, prompt: buildGpt5Prompt(options) };\n\t\tcase \"glm-5.3\":\n\t\t\treturn { name, prompt: buildGlm53Prompt(options) };\n\t\tcase \"glm-5.2\":\n\t\t\treturn { name, prompt: buildGlm52Prompt(options) };\n\t\tcase \"deepseek-v4-flash\":\n\t\t\treturn { name, prompt: buildDeepseekV4FlashPrompt(options) };\n\t\tcase \"deepseek-v4-flash-0731\":\n\t\t\treturn { name, prompt: buildDeepseekV4Flash0731Prompt(options) };\n\t\tcase \"deepseek-v4-1-flash\":\n\t\t\treturn { name, prompt: buildDeepseekV41FlashPrompt(options) };\n\t\tcase \"deepseek-v4-pro\":\n\t\t\treturn { name, prompt: buildDeepseekV4ProPrompt(options) };\n\t\tcase \"grok-4.7\":\n\t\t\treturn { name, prompt: buildGrok47Prompt(options) };\n\t\tcase \"grok-4.6\":\n\t\t\treturn { name, prompt: buildGrok46Prompt(options) };\n\t\tcase \"grok-4.5\":\n\t\t\treturn { name, prompt: buildGrok45Prompt(options) };\n\t\tcase \"kimi-k3\":\n\t\t\treturn { name, prompt: buildKimiK3Prompt(options) };\n\t\tcase \"kimi-k2-8\":\n\t\t\treturn { name, prompt: buildKimiK28Prompt(options) };\n\t\tcase \"kimi-k2-7\":\n\t\t\treturn { name, prompt: buildKimiK27Prompt(options) };\n\t\tcase \"kimi-k2-6\":\n\t\t\treturn { name, prompt: buildKimiK26Prompt(options) };\n\t\tcase \"claude-fable-5-1\":\n\t\t\treturn { name, prompt: buildClaudeFable51Prompt(options) };\n\t\tcase \"claude-fable-5\":\n\t\t\treturn { name, prompt: buildClaudeFable5Prompt(options) };\n\t\tcase \"claude-opus-5-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus55Prompt(options) };\n\t\tcase \"claude-opus-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus5Prompt(options) };\n\t\tcase \"claude-opus-4-8\":\n\t\t\treturn { name, prompt: buildClaudeOpus48Prompt(options) };\n\t\tcase \"claude-opus-4-7\":\n\t\t\treturn { name, prompt: buildClaudeOpus47Prompt(options) };\n\t\tcase \"claude-opus-4-6\":\n\t\t\treturn { name, prompt: buildClaudeOpus46Prompt(options) };\n\t\tcase \"claude-opus-4-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus45Prompt(options) };\n\t}\n}\n\nfunction withDefaults(options: Partial<BuildDynamicSystemPromptOptions> = {}): BuildDynamicSystemPromptOptions {\n\treturn {\n\t\tcwd: options.cwd ?? \"\",\n\t\tselectedTools: options.selectedTools ?? [],\n\t\ttoolSnippets: options.toolSnippets ?? {},\n\t\tpromptGuidelines: options.promptGuidelines ?? [],\n\t\tcontextFiles: options.contextFiles ?? [],\n\t\tskills: options.skills ?? [],\n\t};\n}\n\nexport function resolvePreset(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n\toptions?: Partial<BuildDynamicSystemPromptOptions>,\n): ResolvedPromptPreset | undefined {\n\tconst name = resolvePresetName(model, settings);\n\tif (!name) {\n\t\treturn undefined;\n\t}\n\treturn buildPreset(name, withDefaults(options));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/websearch/websearch/native.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,gBAAgB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/websearch/websearch/native.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,gBAAgB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACxF;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhC,MAAM,WAAW,mBAAmB;IACnC,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACvE,YAAY,CAAC,IAAI,eAAe,EAAE,CAAC;CACnC;AAwKD,wBAAsB,kBAAkB,CACvC,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,aAAa,EAAE,mBAAmB,GAAG,SAAS,EAC9C,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CA8BhC;AAED,wBAAsB,gBAAgB,CACrC,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,aAAa,EAAE,mBAAmB,GAAG,SAAS,EAC9C,EAAE,SAAW,GACX,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAErC"}
|
|
@@ -132,11 +132,18 @@ async function buildNativeEntryForModel(model, modelRegistry, options = {}) {
|
|
|
132
132
|
}
|
|
133
133
|
if (!auth.ok || !auth.apiKey)
|
|
134
134
|
return null;
|
|
135
|
+
// A credential-specific host (a Copilot Business or Enterprise account's own API host) replaces
|
|
136
|
+
// the catalog host, exactly as it does for the account's chat requests.
|
|
137
|
+
const requestBaseUrl = auth.baseUrl
|
|
138
|
+
? buildEndpointUrl(auth.baseUrl, mapping.resource, mapping.endpointPath)
|
|
139
|
+
: baseUrl;
|
|
140
|
+
if (!isAllowedProviderBaseUrl(requestBaseUrl))
|
|
141
|
+
return null;
|
|
135
142
|
return {
|
|
136
143
|
id: entryId,
|
|
137
144
|
provider: mapping.provider,
|
|
138
145
|
apiKey: auth.apiKey,
|
|
139
|
-
baseUrl,
|
|
146
|
+
baseUrl: requestBaseUrl,
|
|
140
147
|
model: model.id,
|
|
141
148
|
priority: -1,
|
|
142
149
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/websearch/websearch/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AA+BnE,SAAS,aAAa,CAAC,KAAsB;IAC5C,MAAM,aAAa,GAAG,kBAAkB,CA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AAC;QAChD,IAAI,CAAC,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,SAAS;QACpD,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACzB,MAAM,KAAK,GAAG,MAAM,wBAAwB,CAAC,cAAc,EAAE,aAAa,EAAE;YAC3E,EAAE,EAAE,mBAAmB;YACvB,MAAM;SACN,CAAC,CAAC;QACH,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,uBAAuB,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,KAAkC,EAClC,aAA8C,EAC9C,EAAE,GAAG,QAAQ;IAEb,OAAO,wBAAwB,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\n\nimport { isAllowedProviderBaseUrl } from \"./provider-endpoints.ts\";\nimport type { SearchProvider, SearchProviderEntry } from \"./types.ts\";\n\nexport interface NativeModelInfo {\n\tprovider: string;\n\tid: string;\n\tbaseUrl: string;\n\tapi?: string;\n}\n\nexport type NativeAuthResult =\n\t| { ok: true; apiKey?: string; headers?: Record<string, string | null> }\n\t| { ok: false; error: string };\n\nexport interface NativeModelRegistry {\n\tgetApiKeyAndHeaders(model: NativeModelInfo): Promise<NativeAuthResult>;\n\tgetAvailable?(): NativeModelInfo[];\n}\n\ninterface NativeProviderMapping {\n\tprovider: SearchProvider;\n\tresource: string;\n\trouteLabel?: string;\n\tendpointPath?: string;\n}\n\ninterface NativeEntryOptions {\n\tid?: string;\n\tsignal?: AbortSignal;\n}\n\nfunction nativeMapping(model: NativeModelInfo): NativeProviderMapping | null {\n\tconst isOpenAiModel = /^gpt-(4o|4\\.1|5)/.test(model.id) && !model.id.includes(\"codex\");\n\tif (model.provider === \"openai\" && isOpenAiModel) {\n\t\treturn { provider: \"openai\", resource: \"responses\" };\n\t}\n\tif (\n\t\tmodel.provider !== \"openai\" &&\n\t\t(model.api === \"openai-responses\" || model.api === \"azure-openai-responses\") &&\n\t\tisOpenAiModel\n\t) {\n\t\treturn { provider: \"openai\", resource: \"responses\", routeLabel: model.provider };\n\t}\n\n\tif (model.provider === \"anthropic\" && /^claude-/.test(model.id)) {\n\t\treturn { provider: \"anthropic\", resource: \"messages\" };\n\t}\n\tif (model.provider !== \"anthropic\" && model.api === \"anthropic-messages\" && /^claude-/.test(model.id)) {\n\t\treturn { provider: \"anthropic\", resource: \"messages\", routeLabel: model.provider };\n\t}\n\n\tif (model.provider === \"deepseek\" && /^deepseek-v4-/.test(model.id)) {\n\t\treturn {\n\t\t\tprovider: \"deepseek\",\n\t\t\tresource: \"messages\",\n\t\t\trouteLabel: \"deepseek\",\n\t\t\tendpointPath: \"/anthropic/v1/messages\",\n\t\t};\n\t}\n\n\tif (model.provider === \"xai\" && /^grok-/.test(model.id)) {\n\t\treturn { provider: \"xai\", resource: \"responses\" };\n\t}\n\n\tif (model.provider === \"perplexity\" && /^sonar/.test(model.id)) {\n\t\treturn { provider: \"perplexity\", resource: \"chat/completions\" };\n\t}\n\n\tif ((model.provider === \"z-ai\" || model.provider === \"zai\") && /^glm-/.test(model.id)) {\n\t\treturn { provider: \"z-ai\", resource: \"chat/completions\" };\n\t}\n\n\tif (model.provider === \"kimi-coding\") {\n\t\treturn { provider: \"kimi\", resource: \"search\" };\n\t}\n\n\tif (model.provider === \"openrouter\") {\n\t\tconst slashIndex = model.id.indexOf(\"/\");\n\t\tif (slashIndex <= 0) return null;\n\t\tconst effectiveProvider = model.id.slice(0, slashIndex);\n\t\tconst effectiveId = model.id.slice(slashIndex + 1);\n\t\tif (effectiveProvider === \"openrouter\") return null;\n\t\treturn nativeMapping({ ...model, provider: effectiveProvider, id: effectiveId });\n\t}\n\n\treturn null;\n}\n\nfunction shouldDiscoverNativeRoute(activeModel: NativeModelInfo | undefined, availableModel: NativeModelInfo): boolean {\n\tconst mapping = nativeMapping(availableModel);\n\tif (!mapping) return false;\n\tif (!activeModel) return true;\n\treturn activeModel.provider === availableModel.provider;\n}\n\nfunction buildEndpointUrl(baseUrl: string, resource: string, endpointPath?: string): string {\n\tlet configured: URL;\n\ttry {\n\t\tconfigured = new URL(baseUrl);\n\t} catch {\n\t\treturn baseUrl;\n\t}\n\tif (endpointPath) {\n\t\tconfigured.pathname = endpointPath;\n\t\tconfigured.hash = \"\";\n\t\treturn configured.href;\n\t}\n\tconst trimmedPath = configured.pathname.replace(/\\/+$/, \"\");\n\tconst resourceSlash = `/${resource}`;\n\tif (trimmedPath.endsWith(resourceSlash)) {\n\t\tconfigured.pathname = trimmedPath;\n\t} else if (/\\/v\\d+$/.test(trimmedPath)) {\n\t\tconfigured.pathname = `${trimmedPath}${resourceSlash}`;\n\t} else {\n\t\tconfigured.pathname = `${trimmedPath}/v1${resourceSlash}`;\n\t}\n\tconfigured.hash = \"\";\n\treturn configured.href;\n}\n\nfunction nativeRouteKey(model: NativeModelInfo): string | null {\n\tconst mapping = nativeMapping(model);\n\tif (!mapping) return null;\n\tconst baseUrl = buildEndpointUrl(model.baseUrl, mapping.resource, mapping.endpointPath);\n\tif (!isAllowedProviderBaseUrl(baseUrl)) return null;\n\tconst routeUrl = new URL(baseUrl);\n\trouteUrl.hostname = routeUrl.hostname.replace(/\\.$/, \"\");\n\treturn `${mapping.provider}|${routeUrl.href}`;\n}\n\nfunction discoveredNativeEntryId(provider: SearchProvider, routeKey: string): string {\n\tconst routeFingerprint = createHash(\"sha256\").update(routeKey).digest(\"hex\").slice(0, 16);\n\treturn `native-${provider}-${routeFingerprint}`;\n}\n\nasync function buildNativeEntryForModel(\n\tmodel: NativeModelInfo | undefined,\n\tmodelRegistry: NativeModelRegistry | undefined,\n\toptions: NativeEntryOptions = {},\n): Promise<SearchProviderEntry | null> {\n\tif (!model || !modelRegistry) return null;\n\tconst { id, signal } = options;\n\n\tconst mapping = nativeMapping(model);\n\tif (!mapping) return null;\n\tconst entryId = id ?? (mapping.routeLabel ? `${mapping.routeLabel}/native` : \"native\");\n\tconst baseUrl = buildEndpointUrl(model.baseUrl, mapping.resource, mapping.endpointPath);\n\tif (!isAllowedProviderBaseUrl(baseUrl)) return null;\n\n\tsignal?.throwIfAborted();\n\tconst authPromise = modelRegistry.getApiKeyAndHeaders(model);\n\tlet auth: NativeAuthResult;\n\tif (!signal) {\n\t\tauth = await authPromise;\n\t} else {\n\t\tsignal.throwIfAborted();\n\t\tlet removeAbortListener = (): void => {};\n\t\tconst abortPromise = new Promise<never>((_resolve, reject) => {\n\t\t\tconst onAbort = (): void => reject(signal.reason);\n\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\tremoveAbortListener = () => signal.removeEventListener(\"abort\", onAbort);\n\t\t});\n\t\ttry {\n\t\t\tauth = await Promise.race([authPromise, abortPromise]);\n\t\t} finally {\n\t\t\tremoveAbortListener();\n\t\t}\n\t}\n\tif (!auth.ok || !auth.apiKey) return null;\n\n\treturn {\n\t\tid: entryId,\n\t\tprovider: mapping.provider,\n\t\tapiKey: auth.apiKey,\n\t\tbaseUrl,\n\t\tmodel: model.id,\n\t\tpriority: -1,\n\t};\n}\nexport async function buildNativeEntries(\n\tmodel: NativeModelInfo | undefined,\n\tmodelRegistry: NativeModelRegistry | undefined,\n\tsignal?: AbortSignal,\n): Promise<SearchProviderEntry[]> {\n\tsignal?.throwIfAborted();\n\tif (!modelRegistry) return [];\n\n\tconst entries: SearchProviderEntry[] = [];\n\tconst seenRoutes = new Set<string>();\n\n\tconst activeRouteKey = model ? nativeRouteKey(model) : null;\n\tif (activeRouteKey) {\n\t\tseenRoutes.add(activeRouteKey);\n\t\tconst activeEntry = await buildNativeEntryForModel(model, modelRegistry, { signal });\n\t\tif (activeEntry) entries.push(activeEntry);\n\t}\n\n\tif (!modelRegistry.getAvailable) return entries;\n\n\tfor (const availableModel of modelRegistry.getAvailable()) {\n\t\tif (!shouldDiscoverNativeRoute(model, availableModel)) continue;\n\t\tconst routeKey = nativeRouteKey(availableModel);\n\t\tif (!routeKey || seenRoutes.has(routeKey)) continue;\n\t\tseenRoutes.add(routeKey);\n\t\tconst entry = await buildNativeEntryForModel(availableModel, modelRegistry, {\n\t\t\tid: \"native-discovered\",\n\t\t\tsignal,\n\t\t});\n\t\tif (!entry) continue;\n\t\tentries.push({ ...entry, id: discoveredNativeEntryId(entry.provider, routeKey) });\n\t}\n\n\treturn entries;\n}\n\nexport async function buildNativeEntry(\n\tmodel: NativeModelInfo | undefined,\n\tmodelRegistry: NativeModelRegistry | undefined,\n\tid = \"native\",\n): Promise<SearchProviderEntry | null> {\n\treturn buildNativeEntryForModel(model, modelRegistry, { id });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/websearch/websearch/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AA+BnE,SAAS,aAAa,CAAC,KAAsB;IAC5C,MAAM,aAAa,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACvF,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,aAAa,EAAE,CAAC;QAClD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;IACtD,CAAC;IACD,IACC,KAAK,CAAC,QAAQ,KAAK,QAAQ;QAC3B,CAAC,KAAK,CAAC,GAAG,KAAK,kBAAkB,IAAI,KAAK,CAAC,GAAG,KAAK,wBAAwB,CAAC;QAC5E,aAAa,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,CAAC,CAAC;QACzB,MAAM,KAAK,GAAG,MAAM,wBAAwB,CAAC,cAAc,EAAE,aAAa,EAAE;YAC3E,EAAE,EAAE,mBAAmB;YACvB,MAAM;SACN,CAAC,CAAC;QACH,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,uBAAuB,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,KAAkC,EAClC,aAA8C,EAC9C,EAAE,GAAG,QAAQ;IAEb,OAAO,wBAAwB,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\n\nimport { isAllowedProviderBaseUrl } from \"./provider-endpoints.ts\";\nimport type { SearchProvider, SearchProviderEntry } from \"./types.ts\";\n\nexport interface NativeModelInfo {\n\tprovider: string;\n\tid: string;\n\tbaseUrl: string;\n\tapi?: string;\n}\n\nexport type NativeAuthResult =\n\t| { ok: true; apiKey?: string; headers?: Record<string, string | null>; baseUrl?: string }\n\t| { ok: false; error: string };\n\nexport interface NativeModelRegistry {\n\tgetApiKeyAndHeaders(model: NativeModelInfo): Promise<NativeAuthResult>;\n\tgetAvailable?(): NativeModelInfo[];\n}\n\ninterface NativeProviderMapping {\n\tprovider: SearchProvider;\n\tresource: string;\n\trouteLabel?: string;\n\tendpointPath?: string;\n}\n\ninterface NativeEntryOptions {\n\tid?: string;\n\tsignal?: AbortSignal;\n}\n\nfunction nativeMapping(model: NativeModelInfo): NativeProviderMapping | null {\n\tconst isOpenAiModel = /^gpt-(4o|4\\.1|5)/.test(model.id) && !model.id.includes(\"codex\");\n\tif (model.provider === \"openai\" && isOpenAiModel) {\n\t\treturn { provider: \"openai\", resource: \"responses\" };\n\t}\n\tif (\n\t\tmodel.provider !== \"openai\" &&\n\t\t(model.api === \"openai-responses\" || model.api === \"azure-openai-responses\") &&\n\t\tisOpenAiModel\n\t) {\n\t\treturn { provider: \"openai\", resource: \"responses\", routeLabel: model.provider };\n\t}\n\n\tif (model.provider === \"anthropic\" && /^claude-/.test(model.id)) {\n\t\treturn { provider: \"anthropic\", resource: \"messages\" };\n\t}\n\tif (model.provider !== \"anthropic\" && model.api === \"anthropic-messages\" && /^claude-/.test(model.id)) {\n\t\treturn { provider: \"anthropic\", resource: \"messages\", routeLabel: model.provider };\n\t}\n\n\tif (model.provider === \"deepseek\" && /^deepseek-v4-/.test(model.id)) {\n\t\treturn {\n\t\t\tprovider: \"deepseek\",\n\t\t\tresource: \"messages\",\n\t\t\trouteLabel: \"deepseek\",\n\t\t\tendpointPath: \"/anthropic/v1/messages\",\n\t\t};\n\t}\n\n\tif (model.provider === \"xai\" && /^grok-/.test(model.id)) {\n\t\treturn { provider: \"xai\", resource: \"responses\" };\n\t}\n\n\tif (model.provider === \"perplexity\" && /^sonar/.test(model.id)) {\n\t\treturn { provider: \"perplexity\", resource: \"chat/completions\" };\n\t}\n\n\tif ((model.provider === \"z-ai\" || model.provider === \"zai\") && /^glm-/.test(model.id)) {\n\t\treturn { provider: \"z-ai\", resource: \"chat/completions\" };\n\t}\n\n\tif (model.provider === \"kimi-coding\") {\n\t\treturn { provider: \"kimi\", resource: \"search\" };\n\t}\n\n\tif (model.provider === \"openrouter\") {\n\t\tconst slashIndex = model.id.indexOf(\"/\");\n\t\tif (slashIndex <= 0) return null;\n\t\tconst effectiveProvider = model.id.slice(0, slashIndex);\n\t\tconst effectiveId = model.id.slice(slashIndex + 1);\n\t\tif (effectiveProvider === \"openrouter\") return null;\n\t\treturn nativeMapping({ ...model, provider: effectiveProvider, id: effectiveId });\n\t}\n\n\treturn null;\n}\n\nfunction shouldDiscoverNativeRoute(activeModel: NativeModelInfo | undefined, availableModel: NativeModelInfo): boolean {\n\tconst mapping = nativeMapping(availableModel);\n\tif (!mapping) return false;\n\tif (!activeModel) return true;\n\treturn activeModel.provider === availableModel.provider;\n}\n\nfunction buildEndpointUrl(baseUrl: string, resource: string, endpointPath?: string): string {\n\tlet configured: URL;\n\ttry {\n\t\tconfigured = new URL(baseUrl);\n\t} catch {\n\t\treturn baseUrl;\n\t}\n\tif (endpointPath) {\n\t\tconfigured.pathname = endpointPath;\n\t\tconfigured.hash = \"\";\n\t\treturn configured.href;\n\t}\n\tconst trimmedPath = configured.pathname.replace(/\\/+$/, \"\");\n\tconst resourceSlash = `/${resource}`;\n\tif (trimmedPath.endsWith(resourceSlash)) {\n\t\tconfigured.pathname = trimmedPath;\n\t} else if (/\\/v\\d+$/.test(trimmedPath)) {\n\t\tconfigured.pathname = `${trimmedPath}${resourceSlash}`;\n\t} else {\n\t\tconfigured.pathname = `${trimmedPath}/v1${resourceSlash}`;\n\t}\n\tconfigured.hash = \"\";\n\treturn configured.href;\n}\n\nfunction nativeRouteKey(model: NativeModelInfo): string | null {\n\tconst mapping = nativeMapping(model);\n\tif (!mapping) return null;\n\tconst baseUrl = buildEndpointUrl(model.baseUrl, mapping.resource, mapping.endpointPath);\n\tif (!isAllowedProviderBaseUrl(baseUrl)) return null;\n\tconst routeUrl = new URL(baseUrl);\n\trouteUrl.hostname = routeUrl.hostname.replace(/\\.$/, \"\");\n\treturn `${mapping.provider}|${routeUrl.href}`;\n}\n\nfunction discoveredNativeEntryId(provider: SearchProvider, routeKey: string): string {\n\tconst routeFingerprint = createHash(\"sha256\").update(routeKey).digest(\"hex\").slice(0, 16);\n\treturn `native-${provider}-${routeFingerprint}`;\n}\n\nasync function buildNativeEntryForModel(\n\tmodel: NativeModelInfo | undefined,\n\tmodelRegistry: NativeModelRegistry | undefined,\n\toptions: NativeEntryOptions = {},\n): Promise<SearchProviderEntry | null> {\n\tif (!model || !modelRegistry) return null;\n\tconst { id, signal } = options;\n\n\tconst mapping = nativeMapping(model);\n\tif (!mapping) return null;\n\tconst entryId = id ?? (mapping.routeLabel ? `${mapping.routeLabel}/native` : \"native\");\n\tconst baseUrl = buildEndpointUrl(model.baseUrl, mapping.resource, mapping.endpointPath);\n\tif (!isAllowedProviderBaseUrl(baseUrl)) return null;\n\n\tsignal?.throwIfAborted();\n\tconst authPromise = modelRegistry.getApiKeyAndHeaders(model);\n\tlet auth: NativeAuthResult;\n\tif (!signal) {\n\t\tauth = await authPromise;\n\t} else {\n\t\tsignal.throwIfAborted();\n\t\tlet removeAbortListener = (): void => {};\n\t\tconst abortPromise = new Promise<never>((_resolve, reject) => {\n\t\t\tconst onAbort = (): void => reject(signal.reason);\n\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\tremoveAbortListener = () => signal.removeEventListener(\"abort\", onAbort);\n\t\t});\n\t\ttry {\n\t\t\tauth = await Promise.race([authPromise, abortPromise]);\n\t\t} finally {\n\t\t\tremoveAbortListener();\n\t\t}\n\t}\n\tif (!auth.ok || !auth.apiKey) return null;\n\t// A credential-specific host (a Copilot Business or Enterprise account's own API host) replaces\n\t// the catalog host, exactly as it does for the account's chat requests.\n\tconst requestBaseUrl = auth.baseUrl\n\t\t? buildEndpointUrl(auth.baseUrl, mapping.resource, mapping.endpointPath)\n\t\t: baseUrl;\n\tif (!isAllowedProviderBaseUrl(requestBaseUrl)) return null;\n\n\treturn {\n\t\tid: entryId,\n\t\tprovider: mapping.provider,\n\t\tapiKey: auth.apiKey,\n\t\tbaseUrl: requestBaseUrl,\n\t\tmodel: model.id,\n\t\tpriority: -1,\n\t};\n}\nexport async function buildNativeEntries(\n\tmodel: NativeModelInfo | undefined,\n\tmodelRegistry: NativeModelRegistry | undefined,\n\tsignal?: AbortSignal,\n): Promise<SearchProviderEntry[]> {\n\tsignal?.throwIfAborted();\n\tif (!modelRegistry) return [];\n\n\tconst entries: SearchProviderEntry[] = [];\n\tconst seenRoutes = new Set<string>();\n\n\tconst activeRouteKey = model ? nativeRouteKey(model) : null;\n\tif (activeRouteKey) {\n\t\tseenRoutes.add(activeRouteKey);\n\t\tconst activeEntry = await buildNativeEntryForModel(model, modelRegistry, { signal });\n\t\tif (activeEntry) entries.push(activeEntry);\n\t}\n\n\tif (!modelRegistry.getAvailable) return entries;\n\n\tfor (const availableModel of modelRegistry.getAvailable()) {\n\t\tif (!shouldDiscoverNativeRoute(model, availableModel)) continue;\n\t\tconst routeKey = nativeRouteKey(availableModel);\n\t\tif (!routeKey || seenRoutes.has(routeKey)) continue;\n\t\tseenRoutes.add(routeKey);\n\t\tconst entry = await buildNativeEntryForModel(availableModel, modelRegistry, {\n\t\t\tid: \"native-discovered\",\n\t\t\tsignal,\n\t\t});\n\t\tif (!entry) continue;\n\t\tentries.push({ ...entry, id: discoveredNativeEntryId(entry.provider, routeKey) });\n\t}\n\n\treturn entries;\n}\n\nexport async function buildNativeEntry(\n\tmodel: NativeModelInfo | undefined,\n\tmodelRegistry: NativeModelRegistry | undefined,\n\tid = \"native\",\n): Promise<SearchProviderEntry | null> {\n\treturn buildNativeEntryForModel(model, modelRegistry, { id });\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The environment names an ensure uses to hand a spawned host its identity.
|
|
3
|
+
*
|
|
4
|
+
* They live in their own dependency-free module because the lifecycle supervisor needs them and
|
|
5
|
+
* nothing else from `protocol-identity.ts`, whose launch-profile parsing imports the CLI argument
|
|
6
|
+
* parser and, through it, the whole provider catalog. A supervisor runs once per task shard and
|
|
7
|
+
* Desktop thread host, so that graph was resident in every one of them.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Generation of this host within its daemon directory, handed to it by the ensure call
|
|
11
|
+
* that spawned it (the daemon settings travel to the host through its environment).
|
|
12
|
+
* Absent - a bare host nobody ensured - is generation 0.
|
|
13
|
+
*/
|
|
14
|
+
export declare const HOST_GENERATION_ENV = "SENPI_RPC_HOST_GENERATION";
|
|
15
|
+
/**
|
|
16
|
+
* Identity of the host being spawned, chosen by the ensure that spawns it so the daemon directory
|
|
17
|
+
* can hold that generation's state before the process exists. A host nobody ensured names itself.
|
|
18
|
+
*/
|
|
19
|
+
export declare const HOST_INSTANCE_ID_ENV = "SENPI_RPC_HOST_INSTANCE_ID";
|
|
20
|
+
//# sourceMappingURL=host-identity-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-identity-env.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/host-identity-env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The environment names an ensure uses to hand a spawned host its identity.
|
|
3
|
+
*
|
|
4
|
+
* They live in their own dependency-free module because the lifecycle supervisor needs them and
|
|
5
|
+
* nothing else from `protocol-identity.ts`, whose launch-profile parsing imports the CLI argument
|
|
6
|
+
* parser and, through it, the whole provider catalog. A supervisor runs once per task shard and
|
|
7
|
+
* Desktop thread host, so that graph was resident in every one of them.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Generation of this host within its daemon directory, handed to it by the ensure call
|
|
11
|
+
* that spawned it (the daemon settings travel to the host through its environment).
|
|
12
|
+
* Absent - a bare host nobody ensured - is generation 0.
|
|
13
|
+
*/
|
|
14
|
+
export const HOST_GENERATION_ENV = "SENPI_RPC_HOST_GENERATION";
|
|
15
|
+
/**
|
|
16
|
+
* Identity of the host being spawned, chosen by the ensure that spawns it so the daemon directory
|
|
17
|
+
* can hold that generation's state before the process exists. A host nobody ensured names itself.
|
|
18
|
+
*/
|
|
19
|
+
export const HOST_INSTANCE_ID_ENV = "SENPI_RPC_HOST_INSTANCE_ID";
|
|
20
|
+
//# sourceMappingURL=host-identity-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-identity-env.js","sourceRoot":"","sources":["../../../src/modes/rpc/host-identity-env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,4BAA4B,CAAC","sourcesContent":["/**\n * The environment names an ensure uses to hand a spawned host its identity.\n *\n * They live in their own dependency-free module because the lifecycle supervisor needs them and\n * nothing else from `protocol-identity.ts`, whose launch-profile parsing imports the CLI argument\n * parser and, through it, the whole provider catalog. A supervisor runs once per task shard and\n * Desktop thread host, so that graph was resident in every one of them.\n */\n\n/**\n * Generation of this host within its daemon directory, handed to it by the ensure call\n * that spawned it (the daemon settings travel to the host through its environment).\n * Absent - a bare host nobody ensured - is generation 0.\n */\nexport const HOST_GENERATION_ENV = \"SENPI_RPC_HOST_GENERATION\";\n\n/**\n * Identity of the host being spawned, chosen by the ensure that spawns it so the daemon directory\n * can hold that generation's state before the process exists. A host nobody ensured names itself.\n */\nexport const HOST_INSTANCE_ID_ENV = \"SENPI_RPC_HOST_INSTANCE_ID\";\n"]}
|
|
@@ -61,11 +61,11 @@ export { DEFAULT_HANDOFF_GRACE_MS, DEFAULT_HOST_IDLE_EXIT_MS, HANDOFF_GRACE_MS_E
|
|
|
61
61
|
import { hostCrashCleanupPaths } from "./host-cleanup-paths.js";
|
|
62
62
|
import { createHostDaemonPaths, generationPaths, HOST_DAEMON_DIR_ENV } from "./host-daemon-paths.js";
|
|
63
63
|
import { releaseGeneration } from "./host-daemon-registration.js";
|
|
64
|
+
import { HOST_INSTANCE_ID_ENV } from "./host-identity-env.js";
|
|
64
65
|
import { watchForSupersession } from "./host-supersession.js";
|
|
65
66
|
import { HOST_CLEANUP_PATHS_ENV, HOST_PUBLIC_SOCKET_ENV, HOST_SCRATCH_DIR_ENV, HOST_WATCH_FD_ENV, HOST_WATCH_PPID_ENV, } from "./host-watchdog.js";
|
|
66
67
|
import { attachJsonlLineReader, MAX_RPC_LINE_CHARACTERS } from "./jsonl.js";
|
|
67
68
|
import { activeTurnsForIdleDecision, createObserverLink } from "./observer-link.js";
|
|
68
|
-
import { HOST_INSTANCE_ID_ENV } from "./protocol-identity.js";
|
|
69
69
|
import { MAX_SOCKET_PATH_BYTES, PUBLIC_SOCKET_IDENTITY_FILE, shieldSocketDuringClose, statSocketIdentity, unlinkOwnedSocket, writeSocketIdentityFile, } from "./socket-ownership.js";
|
|
70
70
|
import { authenticateSocket, createSocketSecret, ensureSocketSecret, resolveSocketTransportAddress, SOCKET_SECRET_FILE_ENV, sendSocketHandshake, socketSecretPath, } from "./socket-transport.js";
|
|
71
71
|
const CHILD_STOP_TIMEOUT_MS = 5_000;
|