@code-yeongyu/senpi 2026.9.18-2 → 2026.9.18-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/dist/bundle/chunks/{anthropic-messages-ZEJ3DPCP.js → anthropic-messages-WZCFP6BT.js} +1 -1
  3. package/dist/bundle/chunks/{app-server-command-NFZDKQOY.js → app-server-command-SXMDPCO3.js} +1 -1
  4. package/dist/bundle/chunks/bun-extension-importer-JIWSA22V.js +10 -0
  5. package/dist/bundle/chunks/{chunk-XJUVWITG.js → chunk-3FRTRCR6.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-VRAYXSST.js → chunk-FDLVINNY.js} +2 -2
  7. package/dist/bundle/chunks/{chunk-PJ5U4M7M.js → chunk-FYFLULRU.js} +5 -5
  8. package/dist/bundle/chunks/chunk-IXAUDPOK.js +2 -0
  9. package/dist/bundle/chunks/chunk-MA3Z67LK.js +8 -0
  10. package/dist/bundle/chunks/{chunk-ANTGWIGI.js → chunk-MUC3MZTV.js} +1 -1
  11. package/dist/bundle/chunks/chunk-NQAVM5XL.js +2 -0
  12. package/dist/bundle/chunks/{chunk-4C7LNOHI.js → chunk-PLZK7ABD.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-CKNRCW35.js → chunk-RLRLQRI2.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-NBUMCMS4.js → chunk-VRDDXZF3.js} +1 -1
  15. package/dist/bundle/chunks/{chunk-QROWINIH.js → chunk-XK24AFYU.js} +1 -1
  16. package/dist/bundle/chunks/cli-main-ACDTRT2W.js +3 -0
  17. package/dist/bundle/chunks/{interactive-host-runtime-LMJRUOPI.js → interactive-host-runtime-FAKC3LHA.js} +1 -1
  18. package/dist/bundle/chunks/interactive-mode-4YCBGS3E.js +2 -0
  19. package/dist/bundle/chunks/{multi-session-host-G5EQB6ED.js → multi-session-host-HBY64KFU.js} +1 -1
  20. package/dist/bundle/chunks/{openai-completions-2RS3VSPV.js → openai-completions-TOWYKX2U.js} +1 -1
  21. package/dist/bundle/chunks/{package-manager-cli-OE6ZSJ6C.js → package-manager-cli-23TYIHVC.js} +1 -1
  22. package/dist/bundle/chunks/{rotation-stream-EBOPFJMX.js → rotation-stream-KDLA7K6X.js} +1 -1
  23. package/dist/bundle/chunks/rpc-mode-ARUKMUCA.js +2 -0
  24. package/dist/bundle/chunks/{session-picker-BUHK3FCS.js → session-picker-DXCITGLS.js} +1 -1
  25. package/dist/bundle/chunks/session-worker.js +25 -25
  26. package/dist/bundle/cli.js +1 -1
  27. package/dist/bundle/index.js +1 -1
  28. package/dist/bundle/rpc-entry.js +1 -1
  29. package/dist/core/extensions/bun-extension-registry.d.ts +4 -0
  30. package/dist/core/extensions/bun-extension-registry.d.ts.map +1 -1
  31. package/dist/core/extensions/bun-extension-registry.js +59 -11
  32. package/dist/core/extensions/bun-extension-registry.js.map +1 -1
  33. package/dist/core/extensions/extension-runtime-module.d.ts +5 -0
  34. package/dist/core/extensions/extension-runtime-module.d.ts.map +1 -0
  35. package/dist/core/extensions/extension-runtime-module.js +6 -0
  36. package/dist/core/extensions/extension-runtime-module.js.map +1 -0
  37. package/dist/core/model-resolver.d.ts.map +1 -1
  38. package/dist/core/model-resolver.js +1 -0
  39. package/dist/core/model-resolver.js.map +1 -1
  40. package/docs/providers.md +30 -0
  41. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +12 -0
  42. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  43. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  44. package/node_modules/@earendil-works/pi-ai/README.md +9 -0
  45. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
  46. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -0
  47. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  48. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +2 -0
  49. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  50. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +2 -0
  51. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  52. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
  53. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +2 -0
  54. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
  55. package/node_modules/@earendil-works/pi-ai/dist/providers/bai-stream.d.ts +13 -0
  56. package/node_modules/@earendil-works/pi-ai/dist/providers/bai-stream.d.ts.map +1 -0
  57. package/node_modules/@earendil-works/pi-ai/dist/providers/bai-stream.js +55 -0
  58. package/node_modules/@earendil-works/pi-ai/dist/providers/bai-stream.js.map +1 -0
  59. package/node_modules/@earendil-works/pi-ai/dist/providers/bai.d.ts +11 -0
  60. package/node_modules/@earendil-works/pi-ai/dist/providers/bai.d.ts.map +1 -0
  61. package/node_modules/@earendil-works/pi-ai/dist/providers/bai.js +94 -0
  62. package/node_modules/@earendil-works/pi-ai/dist/providers/bai.js.map +1 -0
  63. package/node_modules/@earendil-works/pi-ai/dist/providers/bai.models.d.ts +4 -0
  64. package/node_modules/@earendil-works/pi-ai/dist/providers/bai.models.d.ts.map +1 -0
  65. package/node_modules/@earendil-works/pi-ai/dist/providers/bai.models.js +6 -0
  66. package/node_modules/@earendil-works/pi-ai/dist/providers/bai.models.js.map +1 -0
  67. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  68. package/node_modules/@earendil-works/pi-ai/dist/providers/data/bai.json +1 -0
  69. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  70. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opengateway.json +1 -1
  71. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  72. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  73. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +1 -1
  74. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  75. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  76. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  77. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  78. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  79. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  80. package/package.json +7 -7
  81. package/dist/bundle/chunks/bun-extension-importer-SW7XGNSG.js +0 -10
  82. package/dist/bundle/chunks/chunk-63UWBQCO.js +0 -8
  83. package/dist/bundle/chunks/chunk-AGXZF7RF.js +0 -2
  84. package/dist/bundle/chunks/cli-main-IAO3GSNA.js +0 -3
  85. package/dist/bundle/chunks/interactive-mode-YOXSSB5S.js +0 -2
  86. package/dist/bundle/chunks/rpc-mode-2IA6LPSI.js +0 -2
@@ -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,releaseInheritedInspectorForChild}from"./chunks/chunk-TVOODZJH.js";import"./chunks/chunk-I7YUNMWH.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,DISPLAY_VERSION,PACKAGE_NAME,VERSION,brandProfile,getAgentDir,getPackageDir,getSelfUpdateCommand,getSelfUpdateUnavailableInstruction,isBundledNode}from"./chunks/chunk-H5RK2RYZ.js";import"./chunks/chunk-TDTKQR7C.js";import"./chunks/chunk-VR4X5O2Z.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{homedir as osHomedir}from"node:os";import{posix,win32}from"node:path";var RUNTIME_ENV_VAR="SENPI_RUNTIME";function normalize(path){return path.replaceAll("\\","/")}function paths(options){return options.platform==="win32"?win32:posix}function bunRoot(options){let configured=options.env.BUN_INSTALL;return configured!==void 0&&configured.trim()!==""?configured:paths(options).join(options.homedir,".bun")}function resolveOrSelf(path,options){try{return options.realpath(path)}catch{return path}}function isUnderBunGlobalTree(scriptRealPath,options){let globalRoot=paths(options).join(bunRoot(options),"install","global"),script=normalize(scriptRealPath);for(let candidate of new Set([globalRoot,resolveOrSelf(globalRoot,options)]))if(script.startsWith(`${normalize(candidate)}/`))return!0;return!1}function bunExecutableName(options){return options.platform==="win32"?"bun.exe":"bun"}function pathCandidateNames(options){if(options.platform!=="win32")return["bun"];let extensions=(options.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").map(extension=>extension.trim()).filter(extension=>extension.length>0);return extensions.length>0?extensions.map(extension=>`bun${extension}`):["bun.exe"]}function findBunBinary(options){let path=paths(options),executable=bunExecutableName(options),rootCandidates=[path.join(bunRoot(options),"bin",executable),path.join(options.homedir,".bun","bin",executable)];for(let candidate of rootCandidates)if(options.exists(candidate))return candidate;let pathValue=options.env.PATH??options.env.Path;if(pathValue===void 0||pathValue==="")return;let names=pathCandidateNames(options);for(let directory of pathValue.split(path.delimiter))if(directory!=="")for(let name of names){let candidate=path.join(directory,name);if(options.exists(candidate))return candidate}}function readRuntimePin(options){let value=options.env[RUNTIME_ENV_VAR];if(value==="node"||value==="bun")return value}function resolveBunReexec(input){if(input.versions.bun!==void 0)return{action:"stay",reason:"already-bun"};let pinned=readRuntimePin(input.options);if(pinned==="node")return{action:"stay",reason:"runtime-pinned-node"};if(input.hasInheritedInspectorOption)return{action:"stay",reason:"inspector"};if(!(pinned==="bun"||isUnderBunGlobalTree(input.scriptRealPath,input.options)))return{action:"stay",reason:"not-bun-install"};let bunPath=findBunBinary(input.options);return bunPath===void 0?{action:"stay",reason:"bun-not-found"}:{action:"reexec",bunPath}}function processBunRuntimeOptions(exists,realpath){return{env:process.env,homedir:osHomedir(),platform:process.platform,exists,realpath}}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-RQDCLDQT.js");tryPrintHelpWithoutEngine(args)&&process.exit()}isMissingBundledWorkspaceDependencies(getPackageDir())&&await handleBootstrapSelfUpdate(args)&&process.exit();requiresIsolatedProcess()?process.exitCode=await spawnFullCli():await import("./chunks/cli-main-IAO3GSNA.js");
3
+ import{enableStartupCompileCache}from"./chunks/chunk-F73COJ7R.js";import{getLatestPiRelease,hasInheritedInspectorOption,isNewerPackageVersion,releaseInheritedInspectorForChild}from"./chunks/chunk-TVOODZJH.js";import"./chunks/chunk-I7YUNMWH.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,DISPLAY_VERSION,PACKAGE_NAME,VERSION,brandProfile,getAgentDir,getPackageDir,getSelfUpdateCommand,getSelfUpdateUnavailableInstruction,isBundledNode}from"./chunks/chunk-H5RK2RYZ.js";import"./chunks/chunk-TDTKQR7C.js";import"./chunks/chunk-VR4X5O2Z.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{homedir as osHomedir}from"node:os";import{posix,win32}from"node:path";var RUNTIME_ENV_VAR="SENPI_RUNTIME";function normalize(path){return path.replaceAll("\\","/")}function paths(options){return options.platform==="win32"?win32:posix}function bunRoot(options){let configured=options.env.BUN_INSTALL;return configured!==void 0&&configured.trim()!==""?configured:paths(options).join(options.homedir,".bun")}function resolveOrSelf(path,options){try{return options.realpath(path)}catch{return path}}function isUnderBunGlobalTree(scriptRealPath,options){let globalRoot=paths(options).join(bunRoot(options),"install","global"),script=normalize(scriptRealPath);for(let candidate of new Set([globalRoot,resolveOrSelf(globalRoot,options)]))if(script.startsWith(`${normalize(candidate)}/`))return!0;return!1}function bunExecutableName(options){return options.platform==="win32"?"bun.exe":"bun"}function pathCandidateNames(options){if(options.platform!=="win32")return["bun"];let extensions=(options.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").map(extension=>extension.trim()).filter(extension=>extension.length>0);return extensions.length>0?extensions.map(extension=>`bun${extension}`):["bun.exe"]}function findBunBinary(options){let path=paths(options),executable=bunExecutableName(options),rootCandidates=[path.join(bunRoot(options),"bin",executable),path.join(options.homedir,".bun","bin",executable)];for(let candidate of rootCandidates)if(options.exists(candidate))return candidate;let pathValue=options.env.PATH??options.env.Path;if(pathValue===void 0||pathValue==="")return;let names=pathCandidateNames(options);for(let directory of pathValue.split(path.delimiter))if(directory!=="")for(let name of names){let candidate=path.join(directory,name);if(options.exists(candidate))return candidate}}function readRuntimePin(options){let value=options.env[RUNTIME_ENV_VAR];if(value==="node"||value==="bun")return value}function resolveBunReexec(input){if(input.versions.bun!==void 0)return{action:"stay",reason:"already-bun"};let pinned=readRuntimePin(input.options);if(pinned==="node")return{action:"stay",reason:"runtime-pinned-node"};if(input.hasInheritedInspectorOption)return{action:"stay",reason:"inspector"};if(!(pinned==="bun"||isUnderBunGlobalTree(input.scriptRealPath,input.options)))return{action:"stay",reason:"not-bun-install"};let bunPath=findBunBinary(input.options);return bunPath===void 0?{action:"stay",reason:"bun-not-found"}:{action:"reexec",bunPath}}function processBunRuntimeOptions(exists,realpath){return{env:process.env,homedir:osHomedir(),platform:process.platform,exists,realpath}}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-RQDCLDQT.js");tryPrintHelpWithoutEngine(args)&&process.exit()}isMissingBundledWorkspaceDependencies(getPackageDir())&&await handleBootstrapSelfUpdate(args)&&process.exit();requiresIsolatedProcess()?process.exitCode=await spawnFullCli():await import("./chunks/cli-main-ACDTRT2W.js");
@@ -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,compact,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,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,shouldCompact,stripFrontmatter,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-PJ5U4M7M.js";import{DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionSelectorComponent,keyHint,keyText,rawKeyHint}from"./chunks/chunk-XJUVWITG.js";import"./chunks/chunk-EONVPHVX.js";import"./chunks/chunk-3Q4WGKFA.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-NBUMCMS4.js";import"./chunks/chunk-GFUZPFHN.js";import{runRpcMode}from"./chunks/chunk-63UWBQCO.js";import{Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme}from"./chunks/chunk-CKNRCW35.js";import{sanitizeTerminalLabel}from"./chunks/chunk-YRN3PCTM.js";import{SettingsManager}from"./chunks/chunk-4C7LNOHI.js";import"./chunks/chunk-QOBJEPJZ.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-KFIHWCMN.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-2LSXWYT5.js";import"./chunks/chunk-U6Z6OBX4.js";import{createHostDaemonPaths}from"./chunks/chunk-RA3P6BWS.js";import{compareEngineOrdinal,engineBuildIdentity,engineBuildIdentityFrom}from"./chunks/chunk-HSH674C6.js";import"./chunks/chunk-BQVRDBW6.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-QROWINIH.js";import"./chunks/chunk-ANTGWIGI.js";import{getPowerShellConfig,getShellConfig}from"./chunks/chunk-2H3Y7EYQ.js";import"./chunks/chunk-VRAYXSST.js";import"./chunks/chunk-56TWFZ2C.js";import"./chunks/chunk-34GCWLNV.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-3XHLKHSK.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-EAMTSSEH.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-OYXTZDVT.js";import"./chunks/chunk-V55B77HQ.js";import"./chunks/chunk-FC7R7NOV.js";import"./chunks/chunk-PRC5XIIH.js";import"./chunks/chunk-I3F6VZZF.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-TVOODZJH.js";import"./chunks/chunk-I7YUNMWH.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-U7RQY7MH.js";import"./chunks/chunk-UAYBYTFN.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-QPIXPR6I.js";import{parseArgs}from"./chunks/chunk-HGAX6JZ7.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-3P23SBT3.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-H5RK2RYZ.js";import"./chunks/chunk-TDTKQR7C.js";import"./chunks/chunk-VR4X5O2Z.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,compact,compareEngineOrdinal,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,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,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runHostCommand,runHostRequest,runPrintMode,runRpcMode,sanitizeTerminalLabel,serializeConversation,sessionEntryToContextMessages,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
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,compact,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,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,shouldCompact,stripFrontmatter,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-FYFLULRU.js";import{DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionSelectorComponent,keyHint,keyText,rawKeyHint}from"./chunks/chunk-3FRTRCR6.js";import"./chunks/chunk-EONVPHVX.js";import"./chunks/chunk-3Q4WGKFA.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-VRDDXZF3.js";import"./chunks/chunk-GFUZPFHN.js";import{runRpcMode}from"./chunks/chunk-MA3Z67LK.js";import{Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme}from"./chunks/chunk-RLRLQRI2.js";import{sanitizeTerminalLabel}from"./chunks/chunk-YRN3PCTM.js";import{SettingsManager}from"./chunks/chunk-PLZK7ABD.js";import"./chunks/chunk-QOBJEPJZ.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-KFIHWCMN.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-2LSXWYT5.js";import"./chunks/chunk-U6Z6OBX4.js";import{createHostDaemonPaths}from"./chunks/chunk-RA3P6BWS.js";import{compareEngineOrdinal,engineBuildIdentity,engineBuildIdentityFrom}from"./chunks/chunk-HSH674C6.js";import"./chunks/chunk-BQVRDBW6.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-XK24AFYU.js";import"./chunks/chunk-MUC3MZTV.js";import{getPowerShellConfig,getShellConfig}from"./chunks/chunk-2H3Y7EYQ.js";import"./chunks/chunk-FDLVINNY.js";import"./chunks/chunk-56TWFZ2C.js";import"./chunks/chunk-34GCWLNV.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-3XHLKHSK.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-IXAUDPOK.js";import"./chunks/chunk-EAMTSSEH.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-OYXTZDVT.js";import"./chunks/chunk-V55B77HQ.js";import"./chunks/chunk-FC7R7NOV.js";import"./chunks/chunk-PRC5XIIH.js";import"./chunks/chunk-I3F6VZZF.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-TVOODZJH.js";import"./chunks/chunk-I7YUNMWH.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-U7RQY7MH.js";import"./chunks/chunk-UAYBYTFN.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-QPIXPR6I.js";import{parseArgs}from"./chunks/chunk-HGAX6JZ7.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-3P23SBT3.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-H5RK2RYZ.js";import"./chunks/chunk-TDTKQR7C.js";import"./chunks/chunk-VR4X5O2Z.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,compact,compareEngineOrdinal,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,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,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runHostCommand,runHostRequest,runPrintMode,runRpcMode,sanitizeTerminalLabel,serializeConversation,sessionEntryToContextMessages,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
3
- import{main}from"./chunks/chunk-PJ5U4M7M.js";import"./chunks/chunk-XJUVWITG.js";import"./chunks/chunk-EONVPHVX.js";import"./chunks/chunk-3Q4WGKFA.js";import"./chunks/chunk-NBUMCMS4.js";import"./chunks/chunk-GFUZPFHN.js";import"./chunks/chunk-63UWBQCO.js";import"./chunks/chunk-CKNRCW35.js";import"./chunks/chunk-YRN3PCTM.js";import{configureHttpDispatcher}from"./chunks/chunk-4C7LNOHI.js";import"./chunks/chunk-QOBJEPJZ.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-KFIHWCMN.js";import"./chunks/chunk-2LSXWYT5.js";import"./chunks/chunk-U6Z6OBX4.js";import"./chunks/chunk-RA3P6BWS.js";import"./chunks/chunk-HSH674C6.js";import"./chunks/chunk-BQVRDBW6.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-QROWINIH.js";import"./chunks/chunk-ANTGWIGI.js";import"./chunks/chunk-2H3Y7EYQ.js";import"./chunks/chunk-VRAYXSST.js";import"./chunks/chunk-56TWFZ2C.js";import"./chunks/chunk-34GCWLNV.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-3XHLKHSK.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-EAMTSSEH.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-OYXTZDVT.js";import"./chunks/chunk-V55B77HQ.js";import"./chunks/chunk-FC7R7NOV.js";import"./chunks/chunk-PRC5XIIH.js";import"./chunks/chunk-I3F6VZZF.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-TVOODZJH.js";import"./chunks/chunk-I7YUNMWH.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-U7RQY7MH.js";import"./chunks/chunk-UAYBYTFN.js";import"./chunks/chunk-QPIXPR6I.js";import"./chunks/chunk-HGAX6JZ7.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-3P23SBT3.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-H5RK2RYZ.js";import"./chunks/chunk-TDTKQR7C.js";import"./chunks/chunk-VR4X5O2Z.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)]);
3
+ import{main}from"./chunks/chunk-FYFLULRU.js";import"./chunks/chunk-3FRTRCR6.js";import"./chunks/chunk-EONVPHVX.js";import"./chunks/chunk-3Q4WGKFA.js";import"./chunks/chunk-VRDDXZF3.js";import"./chunks/chunk-GFUZPFHN.js";import"./chunks/chunk-MA3Z67LK.js";import"./chunks/chunk-RLRLQRI2.js";import"./chunks/chunk-YRN3PCTM.js";import{configureHttpDispatcher}from"./chunks/chunk-PLZK7ABD.js";import"./chunks/chunk-QOBJEPJZ.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-KFIHWCMN.js";import"./chunks/chunk-2LSXWYT5.js";import"./chunks/chunk-U6Z6OBX4.js";import"./chunks/chunk-RA3P6BWS.js";import"./chunks/chunk-HSH674C6.js";import"./chunks/chunk-BQVRDBW6.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-XK24AFYU.js";import"./chunks/chunk-MUC3MZTV.js";import"./chunks/chunk-2H3Y7EYQ.js";import"./chunks/chunk-FDLVINNY.js";import"./chunks/chunk-56TWFZ2C.js";import"./chunks/chunk-34GCWLNV.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-3XHLKHSK.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-IXAUDPOK.js";import"./chunks/chunk-EAMTSSEH.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-OYXTZDVT.js";import"./chunks/chunk-V55B77HQ.js";import"./chunks/chunk-FC7R7NOV.js";import"./chunks/chunk-PRC5XIIH.js";import"./chunks/chunk-I3F6VZZF.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-TVOODZJH.js";import"./chunks/chunk-I7YUNMWH.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-U7RQY7MH.js";import"./chunks/chunk-UAYBYTFN.js";import"./chunks/chunk-QPIXPR6I.js";import"./chunks/chunk-HGAX6JZ7.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-3P23SBT3.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-H5RK2RYZ.js";import"./chunks/chunk-TDTKQR7C.js";import"./chunks/chunk-VR4X5O2Z.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)]);
@@ -12,6 +12,10 @@ export interface ExtensionGraph {
12
12
  require(specifier: string, filename: string): unknown;
13
13
  }
14
14
  export declare const extensionNamespace = "senpi-extension";
15
+ export declare class ExtensionModuleIdError extends Error {
16
+ readonly name = "ExtensionModuleIdError";
17
+ constructor(id: string);
18
+ }
15
19
  export declare class ExtensionGenerationDisposedError extends Error {
16
20
  readonly name = "ExtensionGenerationDisposedError";
17
21
  readonly generation: string;
@@ -1 +1 @@
1
- {"version":3,"file":"bun-extension-registry.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/bun-extension-registry.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,CAAC;AAChF,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/E,MAAM,WAAW,cAAc;IAC9B,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IACrD,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CACtD;AAmBD,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAQpD,qBAAa,gCAAiC,SAAQ,KAAK;IAC1D,QAAQ,CAAC,IAAI,sCAAsC;IACnD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,YAAY,UAAU,EAAE,MAAM,EAG7B;CACD;AA4DD,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,cAAc,EACrB,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;;;EAa3E;AAED,gFAAgF;AAChF,wBAAgB,yBAAyB;IAC/B,WAAW;IAAgE,OAAO;EAC3F"}
1
+ {"version":3,"file":"bun-extension-registry.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/bun-extension-registry.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,CAAC;AAChF,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/E,MAAM,WAAW,cAAc;IAC9B,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IACrD,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CACtD;AAmBD,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAgCpD,qBAAa,sBAAuB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,4BAA4B;IACzC,YAAY,EAAE,EAAE,MAAM,EAErB;CACD;AAED,qBAAa,gCAAiC,SAAQ,KAAK;IAC1D,QAAQ,CAAC,IAAI,sCAAsC;IACnD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,YAAY,UAAU,EAAE,MAAM,EAG7B;CACD;AA2ED,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,cAAc,EACrB,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;;;EAa3E;AAED,gFAAgF;AAChF,wBAAgB,yBAAyB;IAC/B,WAAW;IAAgE,OAAO;EAC3F"}
@@ -6,15 +6,47 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
6
6
  }
7
7
  return path;
8
8
  };
9
+ import { existsSync } from "node:fs";
9
10
  import { dirname } from "node:path";
10
- import { pathToFileURL } from "node:url";
11
+ import { fileURLToPath, pathToFileURL } from "node:url";
12
+ import { publishRuntimeMetadata } from "./extension-runtime-module.js";
11
13
  export const extensionNamespace = "senpi-extension";
14
+ const RUNTIME_SPECIFIER = "runtime";
15
+ // Inside a `bun build --compile` binary the shim has no on-disk path (import.meta.url is a
16
+ // $bunfs URL), so the file route is only available when the file is really there; the compiled
17
+ // binary keeps the virtual module, which it never had a problem with.
18
+ const runtimeModulePath = resolveRuntimeModulePath();
19
+ function resolveRuntimeModulePath() {
20
+ try {
21
+ const candidate = fileURLToPath(new URL("./extension-runtime-module.js", import.meta.url));
22
+ return existsSync(candidate) ? candidate : undefined;
23
+ }
24
+ catch {
25
+ return undefined;
26
+ }
27
+ }
28
+ // An id is `<generation>/<encodeURIComponent(filename)>`. The encoded half never contains a
29
+ // literal "/" (Windows separators arrive as %5C), so the FIRST slash is always the generation
30
+ // separator — but only when one exists. A bare id with no slash used to slice to nonsense and
31
+ // surface as `Cannot find package '<generation>'` (omo#8427).
32
+ function splitModuleId(id) {
33
+ const slash = id.indexOf("/");
34
+ if (slash <= 0 || slash === id.length - 1)
35
+ return undefined;
36
+ return { generation: id.slice(0, slash), filename: decodeURIComponent(id.slice(slash + 1)) };
37
+ }
12
38
  const graphs = new Map();
13
39
  const collected = new FinalizationRegistry((generation) => graphs.delete(generation));
14
40
  let nextGeneration = 0;
15
41
  let installed = false;
16
42
  let pluginRegistrations = 0;
17
43
  const registeredHosts = new Set();
44
+ export class ExtensionModuleIdError extends Error {
45
+ constructor(id) {
46
+ super(`Extension module id is not "<generation>/<encoded filename>": ${id}`);
47
+ this.name = "ExtensionModuleIdError";
48
+ }
49
+ }
18
50
  export class ExtensionGenerationDisposedError extends Error {
19
51
  constructor(generation) {
20
52
  super(`Extension generation ${generation} has been disposed`);
@@ -60,20 +92,36 @@ function installRegistry(virtualModules) {
60
92
  }
61
93
  if (installed)
62
94
  return;
63
- builder.module(`${extensionNamespace}:runtime`, () => ({ exports: { metadata }, loader: "object" }));
95
+ // "runtime" resolves to a real file, never a Bun.plugin virtual module. A
96
+ // builder.module() registration is intermittently invisible to the resolver under
97
+ // `bun test --parallel` on a loaded Windows shard: onResolve still fires and returns
98
+ // the namespace, the registration is still listed, and Bun answers
99
+ // `Cannot find package 'runtime'` anyway — generation 1 served 40 resolves and
100
+ // refused the 41st in the same worker (omo#8427, run 35329245740). A file on disk
101
+ // has no registration window to lose.
102
+ publishRuntimeMetadata(metadata);
103
+ builder.module(`${extensionNamespace}:${RUNTIME_SPECIFIER}`, () => ({
104
+ exports: { metadata },
105
+ loader: "object",
106
+ }));
64
107
  builder.onResolve({ filter: /.*/, namespace: extensionNamespace }, ({ path }) => {
65
- if (path === "runtime")
66
- return { path, namespace: extensionNamespace };
67
- const slash = path.indexOf("/");
68
- graphFor(path.slice(0, slash));
69
- const filename = decodeURIComponent(path.slice(slash + 1));
70
- return /\.[cm]?[jt]sx?$/.test(filename)
108
+ if (path === RUNTIME_SPECIFIER)
109
+ return runtimeModulePath === undefined
110
+ ? { path, namespace: extensionNamespace }
111
+ : { path: runtimeModulePath, namespace: "file" };
112
+ const parsed = splitModuleId(path);
113
+ if (parsed === undefined)
114
+ throw new ExtensionModuleIdError(path);
115
+ graphFor(parsed.generation);
116
+ return /\.[cm]?[jt]sx?$/.test(parsed.filename)
71
117
  ? { path, namespace: extensionNamespace }
72
- : { path: filename, namespace: "file" };
118
+ : { path: parsed.filename, namespace: "file" };
73
119
  });
74
120
  builder.onLoad({ filter: /.*/, namespace: extensionNamespace }, ({ path }) => {
75
- const slash = path.indexOf("/");
76
- return graphFor(path.slice(0, slash)).load(decodeURIComponent(path.slice(slash + 1)));
121
+ const parsed = splitModuleId(path);
122
+ if (parsed === undefined)
123
+ throw new ExtensionModuleIdError(path);
124
+ return graphFor(parsed.generation).load(parsed.filename);
77
125
  });
78
126
  installed = true;
79
127
  },
@@ -1 +1 @@
1
- {"version":3,"file":"bun-extension-registry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AC,CAAC;oBAChC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBACvF,CAAC,CAAC,CAAC;gBACH,SAAS,GAAG,IAAI,CAAC;YAClB,CAAC;SACD,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,MAAM,UAAU,sBAAsB,CACrC,KAAqB,EACrB,cAA2E;IAE3E,eAAe,CAAC,cAAc,CAAC,CAAC;IAChC,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3C,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAC7C,OAAO;QACN,UAAU;QACV,OAAO;YACN,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC1B,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;KACD,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,yBAAyB;IACxC,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;AACpH,CAAC","sourcesContent":["import { dirname } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nexport type ModuleSource = { readonly contents: string; readonly loader: \"js\" };\nexport type Resolution = { readonly path: string; readonly namespace: string };\nexport interface ExtensionGraph {\n\tresolve(specifier: string, filename: string): string;\n\tload(filename: string): ModuleSource;\n\trequire(specifier: string, filename: string): unknown;\n}\ntype ModuleObject = { readonly exports: Readonly<Record<string, unknown>>; readonly loader: \"object\" };\ndeclare const Bun: {\n\tplugin(options: {\n\t\treadonly name: string;\n\t\treadonly setup: (builder: {\n\t\t\tmodule(name: string, load: () => ModuleObject): void;\n\t\t\tonResolve(\n\t\t\t\toptions: { readonly filter: RegExp; readonly namespace: string },\n\t\t\t\tresolve: (args: { readonly path: string }) => Resolution,\n\t\t\t): void;\n\t\t\tonLoad(\n\t\t\t\toptions: { readonly filter: RegExp; readonly namespace: string },\n\t\t\t\tload: (args: { readonly path: string }) => ModuleSource,\n\t\t\t): void;\n\t\t}) => void;\n\t}): void;\n};\n\nexport const extensionNamespace = \"senpi-extension\";\nconst graphs = new Map<string, WeakRef<ExtensionGraph>>();\nconst collected = new FinalizationRegistry<string>((generation) => graphs.delete(generation));\nlet nextGeneration = 0;\nlet installed = false;\nlet pluginRegistrations = 0;\nconst registeredHosts = new Set<string>();\n\nexport class ExtensionGenerationDisposedError extends Error {\n\treadonly name = \"ExtensionGenerationDisposedError\";\n\treadonly generation: string;\n\tconstructor(generation: string) {\n\t\tsuper(`Extension generation ${generation} has been disposed`);\n\t\tthis.generation = generation;\n\t}\n}\nfunction graphFor(generation: string): ExtensionGraph {\n\tconst graph = graphs.get(generation)?.deref();\n\tif (!graph) throw new ExtensionGenerationDisposedError(generation);\n\treturn graph;\n}\n\n// Module-registry exports must never close over a graph: Bun retains modules.\n// Only the importer, returned factory wrappers, and live runtimes own graphs.\nfunction metadata(generation: string, filename: string) {\n\treturn {\n\t\turl: pathToFileURL(filename).href,\n\t\tpath: filename,\n\t\tdir: dirname(filename),\n\t\trequire: (specifier: string) => graphFor(generation).require(specifier, filename),\n\t\timport: async (specifier: string, options?: ImportCallOptions) =>\n\t\t\timport(graphFor(generation).resolve(specifier, filename), { ...options }),\n\t\tresolve: (specifier: string) => {\n\t\t\tconst id = graphFor(generation).resolve(specifier, filename);\n\t\t\treturn id.startsWith(`${extensionNamespace}:`)\n\t\t\t\t? pathToFileURL(decodeURIComponent(id.slice(id.indexOf(\"/\") + 1))).href\n\t\t\t\t: id;\n\t\t},\n\t};\n}\n\n// A separate activation prevents permanent hooks from sharing a closure\n// environment with registerExtensionGraph's disposable graph reference.\nfunction installRegistry(virtualModules: Readonly<Record<string, Readonly<Record<string, unknown>>>>) {\n\tconst hosts = Object.entries(virtualModules).filter(([name]) => !registeredHosts.has(name));\n\tif (!installed || hosts.length > 0) {\n\t\tpluginRegistrations++;\n\t\tBun.plugin({\n\t\t\tname: extensionNamespace,\n\t\t\tsetup(builder) {\n\t\t\t\tfor (const [name, exports] of hosts) {\n\t\t\t\t\tbuilder.module(name, () => ({ exports, loader: \"object\" }));\n\t\t\t\t\tregisteredHosts.add(name);\n\t\t\t\t}\n\t\t\t\tif (installed) return;\n\t\t\t\tbuilder.module(`${extensionNamespace}:runtime`, () => ({ exports: { metadata }, loader: \"object\" }));\n\t\t\t\tbuilder.onResolve({ filter: /.*/, namespace: extensionNamespace }, ({ path }) => {\n\t\t\t\t\tif (path === \"runtime\") return { path, namespace: extensionNamespace };\n\t\t\t\t\tconst slash = path.indexOf(\"/\");\n\t\t\t\t\tgraphFor(path.slice(0, slash));\n\t\t\t\t\tconst filename = decodeURIComponent(path.slice(slash + 1));\n\t\t\t\t\treturn /\\.[cm]?[jt]sx?$/.test(filename)\n\t\t\t\t\t\t? { path, namespace: extensionNamespace }\n\t\t\t\t\t\t: { path: filename, namespace: \"file\" };\n\t\t\t\t});\n\t\t\t\tbuilder.onLoad({ filter: /.*/, namespace: extensionNamespace }, ({ path }) => {\n\t\t\t\t\tconst slash = path.indexOf(\"/\");\n\t\t\t\t\treturn graphFor(path.slice(0, slash)).load(decodeURIComponent(path.slice(slash + 1)));\n\t\t\t\t});\n\t\t\t\tinstalled = true;\n\t\t\t},\n\t\t});\n\t}\n}\n\nexport function registerExtensionGraph(\n\tgraph: ExtensionGraph,\n\tvirtualModules: Readonly<Record<string, Readonly<Record<string, unknown>>>>,\n) {\n\tinstallRegistry(virtualModules);\n\tconst generation = String(nextGeneration++);\n\tgraphs.set(generation, new WeakRef(graph));\n\tcollected.register(graph, generation, graph);\n\treturn {\n\t\tgeneration,\n\t\tdispose() {\n\t\t\tgraphs.delete(generation);\n\t\t\tcollected.unregister(graph);\n\t\t},\n\t};\n}\n\n/** Internal lifecycle diagnostics, shared by regression and compiled probes. */\nexport function bunExtensionImporterStats() {\n\treturn { generations: [...graphs.values()].filter((entry) => entry.deref()).length, plugins: pluginRegistrations };\n}\n"]}
1
+ {"version":3,"file":"bun-extension-registry.js","sourceRoot":"","sources":["../../../src/core/extensions/bun-extension-registry.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AA2BvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,iBAAiB,GAAG,SAAS,CAAC;AACpC,2FAA2F;AAC3F,+FAA+F;AAC/F,sEAAsE;AACtE,MAAM,iBAAiB,GAAG,wBAAwB,EAAE,CAAC;AAErD,SAAS,wBAAwB;IAChC,IAAI,CAAC;QACJ,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,+BAA+B,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3F,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED,4FAA4F;AAC5F,8FAA8F;AAC9F,8FAA8F;AAC9F,8DAA8D;AAC9D,SAAS,aAAa,CAAC,EAAU;IAChC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B,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;KACD,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,yBAAyB;IACxC,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;AACpH,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { publishRuntimeMetadata } from \"./extension-runtime-module.ts\";\n\nexport type ModuleSource = { readonly contents: string; readonly loader: \"js\" };\nexport type Resolution = { readonly path: string; readonly namespace: string };\nexport interface ExtensionGraph {\n\tresolve(specifier: string, filename: string): string;\n\tload(filename: string): ModuleSource;\n\trequire(specifier: string, filename: string): unknown;\n}\ntype ModuleObject = { readonly exports: Readonly<Record<string, unknown>>; readonly loader: \"object\" };\ndeclare const Bun: {\n\tplugin(options: {\n\t\treadonly name: string;\n\t\treadonly setup: (builder: {\n\t\t\tmodule(name: string, load: () => ModuleObject): void;\n\t\t\tonResolve(\n\t\t\t\toptions: { readonly filter: RegExp; readonly namespace: string },\n\t\t\t\tresolve: (args: { readonly path: string }) => Resolution,\n\t\t\t): void;\n\t\t\tonLoad(\n\t\t\t\toptions: { readonly filter: RegExp; readonly namespace: string },\n\t\t\t\tload: (args: { readonly path: string }) => ModuleSource,\n\t\t\t): void;\n\t\t}) => void;\n\t}): void;\n};\n\nexport const extensionNamespace = \"senpi-extension\";\nconst RUNTIME_SPECIFIER = \"runtime\";\n// Inside a `bun build --compile` binary the shim has no on-disk path (import.meta.url is a\n// $bunfs URL), so the file route is only available when the file is really there; the compiled\n// binary keeps the virtual module, which it never had a problem with.\nconst runtimeModulePath = resolveRuntimeModulePath();\n\nfunction resolveRuntimeModulePath(): string | undefined {\n\ttry {\n\t\tconst candidate = fileURLToPath(new URL(\"./extension-runtime-module.js\", import.meta.url));\n\t\treturn existsSync(candidate) ? candidate : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n// An id is `<generation>/<encodeURIComponent(filename)>`. The encoded half never contains a\n// literal \"/\" (Windows separators arrive as %5C), so the FIRST slash is always the generation\n// separator — but only when one exists. A bare id with no slash used to slice to nonsense and\n// surface as `Cannot find package '<generation>'` (omo#8427).\nfunction splitModuleId(id: string): { readonly generation: string; readonly filename: string } | undefined {\n\tconst slash = id.indexOf(\"/\");\n\tif (slash <= 0 || slash === id.length - 1) return undefined;\n\treturn { generation: id.slice(0, slash), filename: decodeURIComponent(id.slice(slash + 1)) };\n}\nconst graphs = new Map<string, WeakRef<ExtensionGraph>>();\nconst collected = new FinalizationRegistry<string>((generation) => graphs.delete(generation));\nlet nextGeneration = 0;\nlet installed = false;\nlet pluginRegistrations = 0;\nconst registeredHosts = new Set<string>();\n\nexport class ExtensionModuleIdError extends Error {\n\treadonly name = \"ExtensionModuleIdError\";\n\tconstructor(id: string) {\n\t\tsuper(`Extension module id is not \"<generation>/<encoded filename>\": ${id}`);\n\t}\n}\n\nexport class ExtensionGenerationDisposedError extends Error {\n\treadonly name = \"ExtensionGenerationDisposedError\";\n\treadonly generation: string;\n\tconstructor(generation: string) {\n\t\tsuper(`Extension generation ${generation} has been disposed`);\n\t\tthis.generation = generation;\n\t}\n}\nfunction graphFor(generation: string): ExtensionGraph {\n\tconst graph = graphs.get(generation)?.deref();\n\tif (!graph) throw new ExtensionGenerationDisposedError(generation);\n\treturn graph;\n}\n\n// Module-registry exports must never close over a graph: Bun retains modules.\n// Only the importer, returned factory wrappers, and live runtimes own graphs.\nfunction metadata(generation: string, filename: string) {\n\treturn {\n\t\turl: pathToFileURL(filename).href,\n\t\tpath: filename,\n\t\tdir: dirname(filename),\n\t\trequire: (specifier: string) => graphFor(generation).require(specifier, filename),\n\t\timport: async (specifier: string, options?: ImportCallOptions) =>\n\t\t\timport(graphFor(generation).resolve(specifier, filename), { ...options }),\n\t\tresolve: (specifier: string) => {\n\t\t\tconst id = graphFor(generation).resolve(specifier, filename);\n\t\t\treturn id.startsWith(`${extensionNamespace}:`)\n\t\t\t\t? pathToFileURL(decodeURIComponent(id.slice(id.indexOf(\"/\") + 1))).href\n\t\t\t\t: id;\n\t\t},\n\t};\n}\n\n// A separate activation prevents permanent hooks from sharing a closure\n// environment with registerExtensionGraph's disposable graph reference.\nfunction installRegistry(virtualModules: Readonly<Record<string, Readonly<Record<string, unknown>>>>) {\n\tconst hosts = Object.entries(virtualModules).filter(([name]) => !registeredHosts.has(name));\n\tif (!installed || hosts.length > 0) {\n\t\tpluginRegistrations++;\n\t\tBun.plugin({\n\t\t\tname: extensionNamespace,\n\t\t\tsetup(builder) {\n\t\t\t\tfor (const [name, exports] of hosts) {\n\t\t\t\t\tbuilder.module(name, () => ({ exports, loader: \"object\" }));\n\t\t\t\t\tregisteredHosts.add(name);\n\t\t\t\t}\n\t\t\t\tif (installed) return;\n\t\t\t\t// \"runtime\" resolves to a real file, never a Bun.plugin virtual module. A\n\t\t\t\t// builder.module() registration is intermittently invisible to the resolver under\n\t\t\t\t// `bun test --parallel` on a loaded Windows shard: onResolve still fires and returns\n\t\t\t\t// the namespace, the registration is still listed, and Bun answers\n\t\t\t\t// `Cannot find package 'runtime'` anyway — generation 1 served 40 resolves and\n\t\t\t\t// refused the 41st in the same worker (omo#8427, run 35329245740). A file on disk\n\t\t\t\t// has no registration window to lose.\n\t\t\t\tpublishRuntimeMetadata(metadata);\n\t\t\t\tbuilder.module(`${extensionNamespace}:${RUNTIME_SPECIFIER}`, () => ({\n\t\t\t\t\texports: { metadata },\n\t\t\t\t\tloader: \"object\",\n\t\t\t\t}));\n\t\t\t\tbuilder.onResolve({ filter: /.*/, namespace: extensionNamespace }, ({ path }) => {\n\t\t\t\t\tif (path === RUNTIME_SPECIFIER)\n\t\t\t\t\t\treturn runtimeModulePath === undefined\n\t\t\t\t\t\t\t? { path, namespace: extensionNamespace }\n\t\t\t\t\t\t\t: { path: runtimeModulePath, namespace: \"file\" };\n\t\t\t\t\tconst parsed = splitModuleId(path);\n\t\t\t\t\tif (parsed === undefined) throw new ExtensionModuleIdError(path);\n\t\t\t\t\tgraphFor(parsed.generation);\n\t\t\t\t\treturn /\\.[cm]?[jt]sx?$/.test(parsed.filename)\n\t\t\t\t\t\t? { path, namespace: extensionNamespace }\n\t\t\t\t\t\t: { path: parsed.filename, namespace: \"file\" };\n\t\t\t\t});\n\t\t\t\tbuilder.onLoad({ filter: /.*/, namespace: extensionNamespace }, ({ path }) => {\n\t\t\t\t\tconst parsed = splitModuleId(path);\n\t\t\t\t\tif (parsed === undefined) throw new ExtensionModuleIdError(path);\n\t\t\t\t\treturn graphFor(parsed.generation).load(parsed.filename);\n\t\t\t\t});\n\t\t\t\tinstalled = true;\n\t\t\t},\n\t\t});\n\t}\n}\n\nexport function registerExtensionGraph(\n\tgraph: ExtensionGraph,\n\tvirtualModules: Readonly<Record<string, Readonly<Record<string, unknown>>>>,\n) {\n\tinstallRegistry(virtualModules);\n\tconst generation = String(nextGeneration++);\n\tgraphs.set(generation, new WeakRef(graph));\n\tcollected.register(graph, generation, graph);\n\treturn {\n\t\tgeneration,\n\t\tdispose() {\n\t\t\tgraphs.delete(generation);\n\t\t\tcollected.unregister(graph);\n\t\t},\n\t};\n}\n\n/** Internal lifecycle diagnostics, shared by regression and compiled probes. */\nexport function bunExtensionImporterStats() {\n\treturn { generations: [...graphs.values()].filter((entry) => entry.deref()).length, plugins: pluginRegistrations };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ type Metadata = (generation: string, filename: string) => unknown;
2
+ export declare function publishRuntimeMetadata(value: Metadata): void;
3
+ export declare const metadata: Metadata;
4
+ export {};
5
+ //# sourceMappingURL=extension-runtime-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-runtime-module.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/extension-runtime-module.ts"],"names":[],"mappings":"AAEA,KAAK,QAAQ,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;AAElE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAE5D;AAED,eAAO,MAAM,QAAQ,EAAE,QACuE,CAAC"}
@@ -0,0 +1,6 @@
1
+ const RUNTIME_METADATA = Symbol.for("senpi.extension.runtime.metadata");
2
+ export function publishRuntimeMetadata(value) {
3
+ globalThis[RUNTIME_METADATA] = value;
4
+ }
5
+ export const metadata = (generation, filename) => globalThis[RUNTIME_METADATA](generation, filename);
6
+ //# sourceMappingURL=extension-runtime-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-runtime-module.js","sourceRoot":"","sources":["../../../src/core/extensions/extension-runtime-module.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAIxE,MAAM,UAAU,sBAAsB,CAAC,KAAe;IACpD,UAAsC,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE,CACxD,UAAsC,CAAC,gBAAgB,CAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["const RUNTIME_METADATA = Symbol.for(\"senpi.extension.runtime.metadata\");\n\ntype Metadata = (generation: string, filename: string) => unknown;\n\nexport function publishRuntimeMetadata(value: Metadata): void {\n\t(globalThis as Record<symbol, unknown>)[RUNTIME_METADATA] = value;\n}\n\nexport const metadata: Metadata = (generation, filename) =>\n\t((globalThis as Record<symbol, unknown>)[RUNTIME_METADATA] as Metadata)(generation, filename);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"model-resolver.d.ts","sourceRoot":"","sources":["../../src/core/model-resolver.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C5C,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,EACpC,mBAAmB,EAAE,OAAO,EAC5B,YAAY,EAAE,YAAY,GACxB,OAAO,CAAC;IACV,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC9B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC,CAoED"}
@@ -11,6 +11,7 @@ export const defaultModelPerProvider = {
11
11
  "amazon-bedrock": "us.anthropic.claude-opus-4-6-v1",
12
12
  "ant-ling": "Ring-2.6-1T",
13
13
  anthropic: "claude-opus-4-8",
14
+ bai: "gpt-5.6-sol",
14
15
  openai: "gpt-5.6-sol",
15
16
  "azure-openai-responses": "gpt-5.4",
16
17
  "openai-codex": "gpt-5.6-sol",