@code-yeongyu/senpi 2026.10.2 → 2026.10.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.
- package/CHANGELOG.md +22 -0
- package/dist/bundle/chunks/{app-server-command-SZJAJX5J.js → app-server-command-VSOBULUS.js} +1 -1
- package/dist/bundle/chunks/{chunk-PA7DXEUM.js → chunk-2EYJJDES.js} +13 -30
- package/dist/bundle/chunks/{chunk-LACVPFMM.js → chunk-ATACOV2Q.js} +3 -3
- package/dist/bundle/chunks/{chunk-2NAN2JVY.js → chunk-E6TL3R3I.js} +1 -1
- package/dist/bundle/chunks/chunk-Q23IMPRD.js +6 -0
- package/dist/bundle/chunks/{chunk-GIK2N57G.js → chunk-WIBTUARS.js} +20 -2
- package/dist/bundle/chunks/chunk-XOUTBUAV.js +24 -0
- package/dist/bundle/chunks/{cli-main-B66BJ6WS.js → cli-main-RH4BAWCJ.js} +1 -1
- package/dist/bundle/chunks/{host-command-ESRPUXI2.js → host-command-2ZP7B3DA.js} +1 -1
- package/dist/bundle/chunks/{host-lifecycle-P65B4FWL.js → host-lifecycle-3ZZLFX55.js} +1 -1
- package/dist/bundle/chunks/host-lifecycle.js +2 -2
- package/dist/bundle/chunks/{interactive-mode-LBS4DGTM.js → interactive-mode-LBBIPYPZ.js} +1 -1
- package/dist/bundle/chunks/{multi-session-host-5C2TC4BN.js → multi-session-host-GFWO2JUC.js} +1 -1
- package/dist/bundle/chunks/{package-manager-cli-K3JGGB65.js → package-manager-cli-VHCS5NXO.js} +1 -1
- package/dist/bundle/chunks/{rpc-mode-FJGYYLVG.js → rpc-mode-KAZWRS2K.js} +1 -1
- package/dist/bundle/chunks/{schedule-command-BT36FE6F.js → schedule-command-OUALJDGD.js} +1 -1
- package/dist/bundle/chunks/{session-picker-MMTSHPR5.js → session-picker-UYF62GAF.js} +1 -1
- package/dist/bundle/chunks/session-worker.js +35 -34
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/bundle/runtime-manifest.json +1 -1
- package/dist/core/agent-session.d.ts +4 -0
- package/dist/core/agent-session.js +60 -27
- package/dist/core/extensions/builtin/mcp/index.js +19 -10
- package/dist/core/extensions/builtin/mcp/service-register.d.ts +1 -0
- package/dist/core/extensions/builtin/mcp/service-register.js +2 -4
- package/dist/core/extensions/builtin/mcp/service-tools-changed.d.ts +11 -2
- package/dist/core/extensions/builtin/mcp/service-tools-changed.js +33 -6
- package/dist/core/extensions/builtin/mcp/service-types.d.ts +0 -2
- package/dist/core/extensions/builtin/mcp/service.d.ts +18 -8
- package/dist/core/extensions/builtin/mcp/service.js +231 -76
- package/dist/core/settings-manager.d.ts +2 -0
- package/dist/core/settings-manager.js +7 -0
- package/dist/core/skill-invocation.d.ts +10 -2
- package/dist/core/skill-invocation.js +13 -3
- package/dist/core/webview/native-webview.d.ts +1 -0
- package/dist/core/webview/webview-client.d.ts +5 -2
- package/dist/core/webview/webview-client.js +1 -1
- package/dist/core/webview/webview-readiness.d.ts +41 -0
- package/dist/core/webview/webview-readiness.js +48 -0
- package/dist/core/webview/webview-service.d.ts +8 -1
- package/dist/core/webview/webview-service.js +56 -16
- package/dist/modes/rpc/host-exec-argv.d.ts +7 -0
- package/dist/modes/rpc/host-exec-argv.js +45 -0
- package/dist/modes/rpc/host-launch.js +3 -2
- package/dist/modes/rpc/host-lifecycle.js +2 -1
- package/docs/rpc.md +2 -0
- package/docs/settings.md +1 -0
- package/docs/skills.md +4 -2
- package/package.json +6 -6
- package/dist/bundle/chunks/chunk-UB2RTUY7.js +0 -24
- package/dist/bundle/chunks/chunk-XOZFAFCS.js +0 -6
package/dist/bundle/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
3
|
import{enableStartupCompileCache}from"./chunks/chunk-F73COJ7R.js";import{getLatestPiRelease,hasInheritedInspectorOption,isNewerPackageVersion,processBunRuntimeOptions,releaseInheritedInspectorForChild,resolveBunReexec}from"./chunks/chunk-KEMQXWPY.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,DISPLAY_VERSION,PACKAGE_NAME,RUNTIME_SNAPSHOT_MARKER,VERSION,brandProfile,findNodePackageDir,getAgentDir,getInstallPackageDir,getSelfUpdateCommand,getSelfUpdateUnavailableInstruction,isBundledNode,readRuntimeSnapshotMarker}from"./chunks/chunk-463OK2Y4.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-IKOFCODM.js";import{spawn as spawn2,spawnSync}from"node:child_process";import{existsSync as existsSync2,realpathSync as realpathSync3}from"node:fs";import{dirname as dirname3,join as join5}from"node:path";import{fileURLToPath}from"node:url";import{createHash}from"node:crypto";import{readFileSync as readFileSync3,realpathSync as realpathSync2}from"node:fs";import{basename as basename2,dirname as dirname2,join as join3,relative}from"node:path";import{pathToFileURL}from"node:url";import{existsSync,mkdirSync,readdirSync,readFileSync,realpathSync,renameSync,rmSync,statSync,writeFileSync}from"node:fs";import{basename,dirname,join}from"node:path";import{constants}from"node:fs";import{copyFile,link}from"node:fs/promises";function errorCode(error){return error instanceof Error&&"code"in error?error.code:void 0}var FILE_OPERATIONS={copyFile,link},COPY_CONCURRENCY=8;function nextCopyMode(mode,error,platform){let code=errorCode(error);if(!(code==="ENOENT"||code==="ENOTDIR"||code==="EEXIST"))switch(mode){case"clone":return platform==="darwin"&&code==="ENOSYS"?"clone-or-copy":"link";case"link":return"copy";case"clone-or-copy":case"copy":return}}function createSnapshotFileCopier(platform=process.platform,operations=FILE_OPERATIONS){let mode="clone",attempt=(current,source,target)=>{switch(current){case"clone":return operations.copyFile(source,target,constants.COPYFILE_FICLONE_FORCE);case"clone-or-copy":return operations.copyFile(source,target,constants.COPYFILE_FICLONE);case"link":return operations.link(source,target);case"copy":return operations.copyFile(source,target,0)}};return{get mode(){return mode},async copy(source,target){for(let current=mode;;)try{await attempt(current,source,target);return}catch(error){let next=nextCopyMode(current,error,platform);if(next===void 0)throw error;current=next,mode=next}}}}async function copyFiles(pairs,copier){let next=0,worker=async()=>{for(let index=next++;index<pairs.length;index=next++){let[source,target]=pairs[index]??[];source!==void 0&&target!==void 0&&await copier.copy(source,target)}};await Promise.all(Array.from({length:Math.min(COPY_CONCURRENCY,pairs.length)},worker))}var RuntimeSnapshotLayoutError=class extends Error{constructor(packageName){super(`runtime snapshot resolves ${packageName} differently from the install`),this.packageName=packageName}},STAGING_PREFIX=".tmp-",UNLOADED_FILE=/\.(?:d\.[cm]?ts|map)$/;function isMissing(error){return error instanceof Error&&"code"in error&&(error.code==="ENOENT"||error.code==="ENOTDIR")}function planTree(source,target,files,skipModules,seen=new Set){let real=realpathSync(source);if(!seen.has(real)){seen.add(real),mkdirSync(target,{recursive:!0});for(let entry of readdirSync(real,{withFileTypes:!0})){if(skipModules&&entry.name==="node_modules")continue;let from=join(real,entry.name),to=join(target,entry.name);if(entry.isDirectory())planTree(from,to,files,skipModules,seen);else if(entry.isFile())UNLOADED_FILE.test(entry.name)||files.push([from,to]);else if(entry.isSymbolicLink()){let isDirectory;try{isDirectory=statSync(from).isDirectory()}catch(error){if(isMissing(error))continue;throw error}isDirectory?planTree(from,to,files,skipModules,seen):UNLOADED_FILE.test(entry.name)||files.push([realpathSync(from),to])}}seen.delete(real)}}function moduleDirectoriesFrom(dir){let directories=[];for(let current=dir;;current=dirname(current)){if(basename(current)!=="node_modules"){let candidate=join(current,"node_modules");existsSync(candidate)&&directories.push(candidate)}if(dirname(current)===current)return directories}}function packageRootFrom(dir,packageName){for(let modules of moduleDirectoriesFrom(dir)){let root=join(modules,packageName);if(existsSync(join(root,"package.json")))return realpathSync(root)}}function dependencyNames(packageDir){let manifest=JSON.parse(readFileSync(join(packageDir,"package.json"),"utf8"));if(typeof manifest!="object"||manifest===null)return[];let names=new Set;for(let field of["dependencies","optionalDependencies","peerDependencies"]){let block=manifest[field];if(typeof block=="object"&&block!==null)for(let name of Object.keys(block))names.add(name)}return[...names]}function closureNames(packageDir,extra){let names=new Set(extra),visited=new Set,pending=[realpathSync(packageDir)];for(let dir=pending.pop();dir!==void 0;dir=pending.pop())if(!visited.has(dir)){visited.add(dir);for(let name of dependencyNames(dir)){names.add(name);let root=packageRootFrom(dir,name);root!==void 0&&!visited.has(root)&&pending.push(root)}}return names}function planModules(packageDir,snapshotRoot,externals,files){let self=realpathSync(packageDir),placed=new Map,pending=[],place=(installDir,snapshotDir)=>{planTree(installDir,snapshotDir,files,!0),placed.set(snapshotDir,installDir),pending.push({installDir,snapshotDir})},resolvePlaced=(from,name)=>{for(let dir=from;;dir=dirname(dir)){if(basename(dir)!=="node_modules"){let found=placed.get(join(dir,"node_modules",name));if(found!==void 0)return found}if(dir===snapshotRoot||dirname(dir)===dir)return}};for(let name of closureNames(packageDir,externals)){let source=packageRootFrom(packageDir,name);source!==void 0&&source!==self&&place(source,join(snapshotRoot,"node_modules",name))}for(let next=pending.shift();next!==void 0;next=pending.shift())for(let name of dependencyNames(next.installDir)){let expected=packageRootFrom(next.installDir,name);expected===void 0||expected===self||resolvePlaced(next.snapshotDir,name)!==expected&&place(expected,join(next.snapshotDir,"node_modules",name))}return placed}function verifyExternals(packageDir,snapshotBundleDir,externals,placed){for(let name of externals){let expected=packageRootFrom(packageDir,name);if(expected===void 0)continue;let found=moduleDirectoriesFrom(snapshotBundleDir).map(modules=>join(modules,name)).find(root=>existsSync(join(root,"package.json")));if(found===void 0||placed.get(found)!==expected)throw new RuntimeSnapshotLayoutError(name)}}async function materializeRuntimeSnapshot(packageDir,target,manifest,copier=createSnapshotFileCopier()){let staging=join(dirname(target),`${STAGING_PREFIX}${basename(target)}-${process.pid}`);rmSync(staging,{recursive:!0,force:!0});try{let files=[];planTree(packageDir,staging,files,!0);let placed=planModules(packageDir,staging,manifest.externals,files);await copyFiles(files,copier),verifyExternals(packageDir,join(staging,"dist","bundle","chunks"),manifest.externals,placed);let marker={buildId:manifest.buildId,installPackageDir:realpathSync(packageDir)};writeFileSync(join(staging,RUNTIME_SNAPSHOT_MARKER),`${JSON.stringify(marker)}
|
|
4
|
-
`),rmSync(target,{recursive:!0,force:!0}),renameSync(staging,target)}catch(error){throw rmSync(staging,{recursive:!0,force:!0}),error}}import{mkdirSync as mkdirSync2,readdirSync as readdirSync2,readFileSync as readFileSync2,renameSync as renameSync2,rmSync as rmSync2,statSync as statSync2,unlinkSync,utimesSync,writeFileSync as writeFileSync2}from"node:fs";import{join as join2}from"node:path";var LOCK_NAME=".lock",CLAIMS_DIR="claims",STALE_LOCK_MS=3e4,LOCK_WAIT_MS=5e3,LOCK_RETRY_MS=25,BUILD_LOCK_PREFIX=".build-",BUILD_WAIT_MS=12e4,BUILD_RETRY_MS=50,UNOWNED_BUILD_LOCK_MS=3e4,UNUSED_SNAPSHOT_GRACE_MS=10*6e4,LEFTOVER_MS=60*6e4;function errorCode2(error){return error instanceof Error&&"code"in error?error.code:void 0}function ageMs(path,now){try{return now-statSync2(path).mtimeMs}catch(error){if(errorCode2(error)==="ENOENT")return Number.POSITIVE_INFINITY;throw error}}function sleepSync(ms){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,ms)}function withRuntimeLock(root,task){mkdirSync2(root,{recursive:!0});let lock=join2(root,LOCK_NAME),deadline=Date.now()+LOCK_WAIT_MS;for(;;){try{mkdirSync2(lock);break}catch(error){if(errorCode2(error)!=="EEXIST")throw error}if(ageMs(lock,Date.now())>STALE_LOCK_MS)rmSync2(lock,{recursive:!0,force:!0});else{if(Date.now()>deadline)return;sleepSync(LOCK_RETRY_MS)}}try{return task()}finally{rmSync2(lock,{recursive:!0,force:!0})}}function buildLockHolder(lock){try{let pid=Number(readFileSync2(join2(lock,"pid"),"utf8"));return Number.isSafeInteger(pid)&&pid>0?pid:void 0}catch(error){if(errorCode2(error)==="ENOENT"||errorCode2(error)==="ENOTDIR")return;throw error}}function isAbandonedBuildLock(lock,now,isAlive){let holder=buildLockHolder(lock);return holder===void 0?ageMs(lock,now)>UNOWNED_BUILD_LOCK_MS:!isAlive(holder)}async function withBuildLock(root,id,build,isAlive=isProcessAlive){mkdirSync2(root,{recursive:!0});let lock=join2(root,`${BUILD_LOCK_PREFIX}${id}`),deadline=Date.now()+BUILD_WAIT_MS;for(;;){try{mkdirSync2(lock),writeFileSync2(join2(lock,"pid"),String(process.pid));break}catch(error){if(errorCode2(error)!=="EEXIST")throw error}if(isAbandonedBuildLock(lock,Date.now(),isAlive))rmSync2(lock,{recursive:!0,force:!0});else{if(Date.now()>deadline)return;sleepSync(BUILD_RETRY_MS)}}try{for(let name of readdirSync2(root))name.startsWith(`${STAGING_PREFIX}${id}-`)&&rmSync2(join2(root,name),{recursive:!0,force:!0});return await build()}finally{rmSync2(lock,{recursive:!0,force:!0})}}function isProcessAlive(pid){try{return process.kill(pid,0),!0}catch(error){return errorCode2(error)!=="ESRCH"}}function claimRuntimeSnapshot(snapshotDir,pid){mkdirSync2(join2(snapshotDir,CLAIMS_DIR),{recursive:!0}),writeFileSync2(join2(snapshotDir,CLAIMS_DIR,String(pid)),"");let now=new Date;utimesSync(join2(snapshotDir,RUNTIME_SNAPSHOT_MARKER),now,now)}function reapClaims(snapshotDir,isAlive){let names;try{names=readdirSync2(join2(snapshotDir,CLAIMS_DIR))}catch(error){if(errorCode2(error)==="ENOENT")return 0;throw error}let live=0;for(let name of names){let pid=Number(name);Number.isSafeInteger(pid)&&pid>0&&isAlive(pid)?live+=1:unlinkSync(join2(snapshotDir,CLAIMS_DIR,name))}return live}function pruneRuntimeSnapshots(root,keep,now,isAlive=isProcessAlive){reapClaims(join2(root,keep),isAlive);for(let name of readdirSync2(root)){if(name===LOCK_NAME||name===keep)continue;let path=join2(root,name);if(name.startsWith(".")){ageMs(path,now)>LEFTOVER_MS&&rmSync2(path,{recursive:!0,force:!0});continue}if(reapClaims(path,isAlive)>0||ageMs(join2(path,RUNTIME_SNAPSHOT_MARKER),now)<=UNUSED_SNAPSHOT_GRACE_MS)continue;let trash=join2(root,`.trash-${name}-${process.pid}`);renameSync2(path,trash),rmSync2(trash,{recursive:!0,force:!0})}}var RUNTIME_MANIFEST="runtime-manifest.json";function readRuntimeManifest(bundleDir){let parsed;try{parsed=JSON.parse(readFileSync3(join3(bundleDir,RUNTIME_MANIFEST),"utf8"))}catch(error){if(error instanceof Error&&"code"in error&&error.code==="ENOENT")return;throw error}if(typeof parsed=="object"&&parsed!==null&&"buildId"in parsed&&typeof parsed.buildId=="string"&&/^[A-Za-z0-9._-]+$/.test(parsed.buildId)&&"externals"in parsed&&Array.isArray(parsed.externals)&&parsed.externals.every(name=>typeof name=="string"))return{buildId:parsed.buildId,externals:parsed.externals}}async function prepareRuntimeSnapshot(entryPath,packageDir,agentDir){let bundleDir=dirname2(entryPath),runtimeRoot=join3(agentDir,"runtime");try{if(readRuntimeSnapshotMarker(packageDir))return withRuntimeLock(runtimeRoot,()=>claimRuntimeSnapshot(packageDir,process.pid)),{kind:"run-here"};let manifest=readRuntimeManifest(bundleDir);if(!manifest||relative(packageDir,bundleDir)!==join3("dist","bundle"))return{kind:"run-here"};let installId=createHash("sha256").update(realpathSync2(packageDir)).digest("hex").slice(0,12),snapshotId=`${manifest.buildId}-${installId}`,snapshotDir=join3(runtimeRoot,snapshotId),isBuilt=()=>readRuntimeSnapshotMarker(snapshotDir)?.buildId===manifest.buildId,claim=()=>withRuntimeLock(runtimeRoot,()=>isBuilt()?(claimRuntimeSnapshot(snapshotDir,process.pid),pruneRuntimeSnapshots(runtimeRoot,snapshotId,Date.now()),!0):!1),claimed=claim();return claimed===!1&&await withBuildLock(runtimeRoot,snapshotId,async()=>(isBuilt()||await materializeRuntimeSnapshot(packageDir,snapshotDir,manifest),!0))&&(claimed=claim()),claimed!==!0?{kind:"run-here"}:{kind:"hand-off",entryUrl:pathToFileURL(join3(snapshotDir,"dist","bundle",basename2(entryPath))).href,snapshotDir}}catch{return{kind:"run-here"}}}import{spawn}from"node:child_process";import{readFileSync as readFileSync4}from"node:fs";import{join as join4}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(readFileSync4(join4(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}var __rewriteRelativeImportExtension=function(path,preserveJsx){return typeof path=="string"&&/^\.\.?\//.test(path)?path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(m,tsx,d,ext,cm){return tsx?preserveJsx?".jsx":".js":d&&(!ext||!cm)?m:d+ext+"."+cm.toLowerCase()+"js"}):path};function reexecUnderBunIfNeeded(){let options=processBunRuntimeOptions(existsSync2,realpathSync3),scriptRealPath=process.argv[1]??fileURLToPath(import.meta.url);try{scriptRealPath=realpathSync3(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=>!existsSync2(join5(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-6CAXNLOQ.js");tryPrintHelpWithoutEngine(args)&&process.exit()}isMissingBundledWorkspaceDependencies(getInstallPackageDir())&&await handleBootstrapSelfUpdate(args)&&process.exit();if(requiresIsolatedProcess())process.exitCode=await spawnFullCli();else{let entryPath=fileURLToPath(import.meta.url),snapshot=isBundledNode?await prepareRuntimeSnapshot(entryPath,findNodePackageDir(dirname3(entryPath)),getAgentDir()):void 0;snapshot?.kind==="hand-off"?await import(__rewriteRelativeImportExtension(snapshot.entryUrl)):await import("./chunks/cli-main-B66BJ6WS.js")}
|
|
4
|
+
`),rmSync(target,{recursive:!0,force:!0}),renameSync(staging,target)}catch(error){throw rmSync(staging,{recursive:!0,force:!0}),error}}import{mkdirSync as mkdirSync2,readdirSync as readdirSync2,readFileSync as readFileSync2,renameSync as renameSync2,rmSync as rmSync2,statSync as statSync2,unlinkSync,utimesSync,writeFileSync as writeFileSync2}from"node:fs";import{join as join2}from"node:path";var LOCK_NAME=".lock",CLAIMS_DIR="claims",STALE_LOCK_MS=3e4,LOCK_WAIT_MS=5e3,LOCK_RETRY_MS=25,BUILD_LOCK_PREFIX=".build-",BUILD_WAIT_MS=12e4,BUILD_RETRY_MS=50,UNOWNED_BUILD_LOCK_MS=3e4,UNUSED_SNAPSHOT_GRACE_MS=10*6e4,LEFTOVER_MS=60*6e4;function errorCode2(error){return error instanceof Error&&"code"in error?error.code:void 0}function ageMs(path,now){try{return now-statSync2(path).mtimeMs}catch(error){if(errorCode2(error)==="ENOENT")return Number.POSITIVE_INFINITY;throw error}}function sleepSync(ms){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,ms)}function withRuntimeLock(root,task){mkdirSync2(root,{recursive:!0});let lock=join2(root,LOCK_NAME),deadline=Date.now()+LOCK_WAIT_MS;for(;;){try{mkdirSync2(lock);break}catch(error){if(errorCode2(error)!=="EEXIST")throw error}if(ageMs(lock,Date.now())>STALE_LOCK_MS)rmSync2(lock,{recursive:!0,force:!0});else{if(Date.now()>deadline)return;sleepSync(LOCK_RETRY_MS)}}try{return task()}finally{rmSync2(lock,{recursive:!0,force:!0})}}function buildLockHolder(lock){try{let pid=Number(readFileSync2(join2(lock,"pid"),"utf8"));return Number.isSafeInteger(pid)&&pid>0?pid:void 0}catch(error){if(errorCode2(error)==="ENOENT"||errorCode2(error)==="ENOTDIR")return;throw error}}function isAbandonedBuildLock(lock,now,isAlive){let holder=buildLockHolder(lock);return holder===void 0?ageMs(lock,now)>UNOWNED_BUILD_LOCK_MS:!isAlive(holder)}async function withBuildLock(root,id,build,isAlive=isProcessAlive){mkdirSync2(root,{recursive:!0});let lock=join2(root,`${BUILD_LOCK_PREFIX}${id}`),deadline=Date.now()+BUILD_WAIT_MS;for(;;){try{mkdirSync2(lock),writeFileSync2(join2(lock,"pid"),String(process.pid));break}catch(error){if(errorCode2(error)!=="EEXIST")throw error}if(isAbandonedBuildLock(lock,Date.now(),isAlive))rmSync2(lock,{recursive:!0,force:!0});else{if(Date.now()>deadline)return;sleepSync(BUILD_RETRY_MS)}}try{for(let name of readdirSync2(root))name.startsWith(`${STAGING_PREFIX}${id}-`)&&rmSync2(join2(root,name),{recursive:!0,force:!0});return await build()}finally{rmSync2(lock,{recursive:!0,force:!0})}}function isProcessAlive(pid){try{return process.kill(pid,0),!0}catch(error){return errorCode2(error)!=="ESRCH"}}function claimRuntimeSnapshot(snapshotDir,pid){mkdirSync2(join2(snapshotDir,CLAIMS_DIR),{recursive:!0}),writeFileSync2(join2(snapshotDir,CLAIMS_DIR,String(pid)),"");let now=new Date;utimesSync(join2(snapshotDir,RUNTIME_SNAPSHOT_MARKER),now,now)}function reapClaims(snapshotDir,isAlive){let names;try{names=readdirSync2(join2(snapshotDir,CLAIMS_DIR))}catch(error){if(errorCode2(error)==="ENOENT")return 0;throw error}let live=0;for(let name of names){let pid=Number(name);Number.isSafeInteger(pid)&&pid>0&&isAlive(pid)?live+=1:unlinkSync(join2(snapshotDir,CLAIMS_DIR,name))}return live}function pruneRuntimeSnapshots(root,keep,now,isAlive=isProcessAlive){reapClaims(join2(root,keep),isAlive);for(let name of readdirSync2(root)){if(name===LOCK_NAME||name===keep)continue;let path=join2(root,name);if(name.startsWith(".")){ageMs(path,now)>LEFTOVER_MS&&rmSync2(path,{recursive:!0,force:!0});continue}if(reapClaims(path,isAlive)>0||ageMs(join2(path,RUNTIME_SNAPSHOT_MARKER),now)<=UNUSED_SNAPSHOT_GRACE_MS)continue;let trash=join2(root,`.trash-${name}-${process.pid}`);renameSync2(path,trash),rmSync2(trash,{recursive:!0,force:!0})}}var RUNTIME_MANIFEST="runtime-manifest.json";function readRuntimeManifest(bundleDir){let parsed;try{parsed=JSON.parse(readFileSync3(join3(bundleDir,RUNTIME_MANIFEST),"utf8"))}catch(error){if(error instanceof Error&&"code"in error&&error.code==="ENOENT")return;throw error}if(typeof parsed=="object"&&parsed!==null&&"buildId"in parsed&&typeof parsed.buildId=="string"&&/^[A-Za-z0-9._-]+$/.test(parsed.buildId)&&"externals"in parsed&&Array.isArray(parsed.externals)&&parsed.externals.every(name=>typeof name=="string"))return{buildId:parsed.buildId,externals:parsed.externals}}async function prepareRuntimeSnapshot(entryPath,packageDir,agentDir){let bundleDir=dirname2(entryPath),runtimeRoot=join3(agentDir,"runtime");try{if(readRuntimeSnapshotMarker(packageDir))return withRuntimeLock(runtimeRoot,()=>claimRuntimeSnapshot(packageDir,process.pid)),{kind:"run-here"};let manifest=readRuntimeManifest(bundleDir);if(!manifest||relative(packageDir,bundleDir)!==join3("dist","bundle"))return{kind:"run-here"};let installId=createHash("sha256").update(realpathSync2(packageDir)).digest("hex").slice(0,12),snapshotId=`${manifest.buildId}-${installId}`,snapshotDir=join3(runtimeRoot,snapshotId),isBuilt=()=>readRuntimeSnapshotMarker(snapshotDir)?.buildId===manifest.buildId,claim=()=>withRuntimeLock(runtimeRoot,()=>isBuilt()?(claimRuntimeSnapshot(snapshotDir,process.pid),pruneRuntimeSnapshots(runtimeRoot,snapshotId,Date.now()),!0):!1),claimed=claim();return claimed===!1&&await withBuildLock(runtimeRoot,snapshotId,async()=>(isBuilt()||await materializeRuntimeSnapshot(packageDir,snapshotDir,manifest),!0))&&(claimed=claim()),claimed!==!0?{kind:"run-here"}:{kind:"hand-off",entryUrl:pathToFileURL(join3(snapshotDir,"dist","bundle",basename2(entryPath))).href,snapshotDir}}catch{return{kind:"run-here"}}}import{spawn}from"node:child_process";import{readFileSync as readFileSync4}from"node:fs";import{join as join4}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(readFileSync4(join4(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}var __rewriteRelativeImportExtension=function(path,preserveJsx){return typeof path=="string"&&/^\.\.?\//.test(path)?path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(m,tsx,d,ext,cm){return tsx?preserveJsx?".jsx":".js":d&&(!ext||!cm)?m:d+ext+"."+cm.toLowerCase()+"js"}):path};function reexecUnderBunIfNeeded(){let options=processBunRuntimeOptions(existsSync2,realpathSync3),scriptRealPath=process.argv[1]??fileURLToPath(import.meta.url);try{scriptRealPath=realpathSync3(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=>!existsSync2(join5(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-6CAXNLOQ.js");tryPrintHelpWithoutEngine(args)&&process.exit()}isMissingBundledWorkspaceDependencies(getInstallPackageDir())&&await handleBootstrapSelfUpdate(args)&&process.exit();if(requiresIsolatedProcess())process.exitCode=await spawnFullCli();else{let entryPath=fileURLToPath(import.meta.url),snapshot=isBundledNode?await prepareRuntimeSnapshot(entryPath,findNodePackageDir(dirname3(entryPath)),getAgentDir()):void 0;snapshot?.kind==="hand-off"?await import(__rewriteRelativeImportExtension(snapshot.entryUrl)):await import("./chunks/cli-main-RH4BAWCJ.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,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultResourceLoader,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SESSION_CONTROL_DELIVERY_TYPE,SessionManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildNoticeBox,buildSessionContext,buildSessionProjection,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,connectWebViewService,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,getLatestCompactionEntry,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isSessionControlDeliveryDetails,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,readOwnFootprint,readProcessFootprint,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-PA7DXEUM.js";import{UnknownCommandError,runRpcMode}from"./chunks/chunk-XOZFAFCS.js";import"./chunks/chunk-QNAG7FYM.js";import{DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionSelectorComponent,keyHint,keyText,rawKeyHint}from"./chunks/chunk-2NAN2JVY.js";import{SettingsManager,Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme}from"./chunks/chunk-GIK2N57G.js";import"./chunks/chunk-LYYI74CY.js";import"./chunks/chunk-PPX4BWTM.js";import{sanitizeTerminalLabel}from"./chunks/chunk-5N4ZSDFS.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-U5KVIAHJ.js";import"./chunks/chunk-KL7ZUB7X.js";import"./chunks/chunk-JABBHOD5.js";import{DEFAULT_HOST_LAUNCH_SPEC,GENERATION_HANDOFF_CAPABILITY,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,HostLaunchSpecError,PINNED_HOST_CLIENT_CAPABILITIES,REQUIRED_HOST_CAPABILITIES,TUI_PROBE_TIMEOUT_MS,classifyEndpointLiveness,decideHostAction,endpointProbeTimeoutMs,ensureHost,handoffHost,loadHostLaunchSpec,parseHostLaunchSpec,parseHostProtocolInfo,probeHost,readAllHostStatus,readHostStatus,runHostCommand,runHostRequest,stopHost}from"./chunks/chunk-UB2RTUY7.js";import"./chunks/chunk-LJWC5IVX.js";import{createSyntheticSourceInfo}from"./chunks/chunk-QMRJYMNH.js";import{gcHostEndpoints,listHostEndpoints}from"./chunks/chunk-6KIZRGOT.js";import"./chunks/chunk-UWYQPA26.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-U45BOWV5.js";import"./chunks/chunk-F6EQ7EV3.js";import{getPowerShellConfig,getShellConfig,withBundledBunCommands}from"./chunks/chunk-JEZWV7JW.js";import"./chunks/chunk-S2TCHQTE.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-LACVPFMM.js";import"./chunks/chunk-CIRZTP7W.js";import{ENDPOINT_REGISTRY_VERSION,createHostDaemonPaths,daemonDirectoryName,shardKey,shardSocketPath,shardSocketPathForKey}from"./chunks/chunk-22DAHAHO.js";import{compareEngineOrdinal,engineBuildIdentity,engineBuildIdentityFrom}from"./chunks/chunk-XYDZ3LIE.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-7Q3EY6HH.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-6SMU7ANE.js";import{parseArgs}from"./chunks/chunk-MH2BFYGN.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-F4Y75Q3Q.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-KC5TT7DH.js";import"./chunks/chunk-KEMQXWPY.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-463OK2Y4.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-RBCQOIAD.js";import"./chunks/chunk-JRGNL6WM.js";import"./chunks/chunk-RKJNJ3GI.js";import"./chunks/chunk-CWLCGRUS.js";import"./chunks/chunk-6WCOSBI7.js";import"./chunks/chunk-LHYG7TK7.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-YOPVJDSU.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-2WEI2XTZ.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-BBK6SSYT.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-XL5KIYQF.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-PJ34QVL5.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,ENDPOINT_REGISTRY_VERSION,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,SESSION_CONTROL_DELIVERY_TYPE,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,TUI_PROBE_TIMEOUT_MS,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UnknownCommandError,UserMessageComponent,UserMessageSelectorComponent,VERSION,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildNoticeBox,buildSessionContext,buildSessionProjection,calculateContextTokens,classifyEndpointLiveness,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,endpointProbeTimeoutMs,engineBuildIdentity,engineBuildIdentityFrom,ensureHost,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,gcHostEndpoints,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,isSessionControlDeliveryDetails,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,keyHint,keyText,listHostEndpoints,loadHostLaunchSpec,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseArgs,parseFrontmatter,parseHostLaunchSpec,parseHostProtocolInfo,parseSessionEntries,parseSkillBlock,prepareBranchEntries,probeHost,rawKeyHint,readAllHostStatus,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,withBundledBunCommands,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
|
|
2
|
+
import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultResourceLoader,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SESSION_CONTROL_DELIVERY_TYPE,SessionManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildNoticeBox,buildSessionContext,buildSessionProjection,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,connectWebViewService,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,getLatestCompactionEntry,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isSessionControlDeliveryDetails,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,parseSessionEntries,prepareBranchEntries,readOwnFootprint,readProcessFootprint,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-2EYJJDES.js";import{UnknownCommandError,runRpcMode}from"./chunks/chunk-Q23IMPRD.js";import"./chunks/chunk-QNAG7FYM.js";import{DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionSelectorComponent,keyHint,keyText,rawKeyHint}from"./chunks/chunk-E6TL3R3I.js";import{SettingsManager,Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,parseSkillBlock}from"./chunks/chunk-WIBTUARS.js";import"./chunks/chunk-LYYI74CY.js";import"./chunks/chunk-PPX4BWTM.js";import{sanitizeTerminalLabel}from"./chunks/chunk-5N4ZSDFS.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-U5KVIAHJ.js";import"./chunks/chunk-KL7ZUB7X.js";import"./chunks/chunk-JABBHOD5.js";import{DEFAULT_HOST_LAUNCH_SPEC,GENERATION_HANDOFF_CAPABILITY,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,HostLaunchSpecError,PINNED_HOST_CLIENT_CAPABILITIES,REQUIRED_HOST_CAPABILITIES,TUI_PROBE_TIMEOUT_MS,classifyEndpointLiveness,decideHostAction,endpointProbeTimeoutMs,ensureHost,handoffHost,loadHostLaunchSpec,parseHostLaunchSpec,parseHostProtocolInfo,probeHost,readAllHostStatus,readHostStatus,runHostCommand,runHostRequest,stopHost}from"./chunks/chunk-XOUTBUAV.js";import"./chunks/chunk-LJWC5IVX.js";import{createSyntheticSourceInfo}from"./chunks/chunk-QMRJYMNH.js";import{gcHostEndpoints,listHostEndpoints}from"./chunks/chunk-6KIZRGOT.js";import"./chunks/chunk-UWYQPA26.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-U45BOWV5.js";import"./chunks/chunk-F6EQ7EV3.js";import{getPowerShellConfig,getShellConfig,withBundledBunCommands}from"./chunks/chunk-JEZWV7JW.js";import"./chunks/chunk-S2TCHQTE.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-ATACOV2Q.js";import"./chunks/chunk-CIRZTP7W.js";import{ENDPOINT_REGISTRY_VERSION,createHostDaemonPaths,daemonDirectoryName,shardKey,shardSocketPath,shardSocketPathForKey}from"./chunks/chunk-22DAHAHO.js";import{compareEngineOrdinal,engineBuildIdentity,engineBuildIdentityFrom}from"./chunks/chunk-XYDZ3LIE.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-7Q3EY6HH.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-6SMU7ANE.js";import{parseArgs}from"./chunks/chunk-MH2BFYGN.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-F4Y75Q3Q.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-KC5TT7DH.js";import"./chunks/chunk-KEMQXWPY.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-463OK2Y4.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-RBCQOIAD.js";import"./chunks/chunk-JRGNL6WM.js";import"./chunks/chunk-RKJNJ3GI.js";import"./chunks/chunk-CWLCGRUS.js";import"./chunks/chunk-6WCOSBI7.js";import"./chunks/chunk-LHYG7TK7.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-YOPVJDSU.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-2WEI2XTZ.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-BBK6SSYT.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-XL5KIYQF.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-PJ34QVL5.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,ENDPOINT_REGISTRY_VERSION,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,SESSION_CONTROL_DELIVERY_TYPE,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,TUI_PROBE_TIMEOUT_MS,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UnknownCommandError,UserMessageComponent,UserMessageSelectorComponent,VERSION,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildNoticeBox,buildSessionContext,buildSessionProjection,calculateContextTokens,classifyEndpointLiveness,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,endpointProbeTimeoutMs,engineBuildIdentity,engineBuildIdentityFrom,ensureHost,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,gcHostEndpoints,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,isSessionControlDeliveryDetails,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,keyHint,keyText,listHostEndpoints,loadHostLaunchSpec,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseArgs,parseFrontmatter,parseHostLaunchSpec,parseHostProtocolInfo,parseSessionEntries,parseSkillBlock,prepareBranchEntries,probeHost,rawKeyHint,readAllHostStatus,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,withBundledBunCommands,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-2EYJJDES.js";import"./chunks/chunk-Q23IMPRD.js";import"./chunks/chunk-QNAG7FYM.js";import"./chunks/chunk-E6TL3R3I.js";import{configureHttpDispatcher}from"./chunks/chunk-WIBTUARS.js";import"./chunks/chunk-LYYI74CY.js";import"./chunks/chunk-PPX4BWTM.js";import"./chunks/chunk-5N4ZSDFS.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-U5KVIAHJ.js";import"./chunks/chunk-KL7ZUB7X.js";import"./chunks/chunk-JABBHOD5.js";import"./chunks/chunk-XOUTBUAV.js";import"./chunks/chunk-LJWC5IVX.js";import"./chunks/chunk-QMRJYMNH.js";import"./chunks/chunk-6KIZRGOT.js";import"./chunks/chunk-UWYQPA26.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-U45BOWV5.js";import"./chunks/chunk-F6EQ7EV3.js";import"./chunks/chunk-JEZWV7JW.js";import"./chunks/chunk-S2TCHQTE.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-ATACOV2Q.js";import"./chunks/chunk-CIRZTP7W.js";import"./chunks/chunk-22DAHAHO.js";import"./chunks/chunk-XYDZ3LIE.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-7Q3EY6HH.js";import"./chunks/chunk-6SMU7ANE.js";import"./chunks/chunk-MH2BFYGN.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-F4Y75Q3Q.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-KC5TT7DH.js";import"./chunks/chunk-KEMQXWPY.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-463OK2Y4.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-RBCQOIAD.js";import"./chunks/chunk-JRGNL6WM.js";import"./chunks/chunk-RKJNJ3GI.js";import"./chunks/chunk-CWLCGRUS.js";import"./chunks/chunk-6WCOSBI7.js";import"./chunks/chunk-LHYG7TK7.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-YOPVJDSU.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-2WEI2XTZ.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-BBK6SSYT.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-XL5KIYQF.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-PJ34QVL5.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
|
-
{"buildId":"
|
|
1
|
+
{"buildId":"c3464d0436057db7","externals":["@earendil-works/chord","@earendil-works/pi-pty","@silvia-odwyer/photon-node","bufferutil","canvas","kerberos","supports-color","utf-8-validate"]}
|
|
@@ -1310,6 +1310,10 @@ export declare class AgentSession {
|
|
|
1310
1310
|
* summarization did not get there, so a repairable switch cannot strand itself.
|
|
1311
1311
|
*/
|
|
1312
1312
|
private _applyPendingModelSwitch;
|
|
1313
|
+
/** Whether a recorded resume requirement still blocks: the current context does not fit the current model. */
|
|
1314
|
+
private _resumeRequirementStillBlocks;
|
|
1315
|
+
/** Any committed compaction, manual /compact included, retires a resume requirement the context now satisfies. */
|
|
1316
|
+
private _clearResumeCompactionRequirementIfFits;
|
|
1313
1317
|
admitResumeCompactionRequired(projection: ModelUsabilityBudgetProjection): void;
|
|
1314
1318
|
/** Reduce an over-window restored context deterministically while the recorded transcript stays intact. */
|
|
1315
1319
|
applyResumeSlice(plan: ResumeSlicePlan): void;
|
|
@@ -97,7 +97,7 @@ import { buildSessionContext, CURRENT_SESSION_VERSION, getLatestCompactionEntry,
|
|
|
97
97
|
import { generateSessionTitle, sessionTitleRetryPolicy, shouldSkipSessionTitle } from "./session-title-generator.js";
|
|
98
98
|
import { SessionWorkBarrier } from "./session-work-barrier.js";
|
|
99
99
|
import { DEFAULT_STREAM_START_TIMEOUT_MS, DEFAULT_TOOL_NAMES, } from "./settings-manager.js";
|
|
100
|
-
import { formatSkillInvocationPrompt,
|
|
100
|
+
import { formatSkillInvocationPrompt, parseSkillInvocationTokens, removeSkillInvocationTokens, } from "./skill-invocation.js";
|
|
101
101
|
import { BUILTIN_SLASH_COMMANDS } from "./slash-commands.js";
|
|
102
102
|
import { BUILTIN_PATH_PREFIX, createSyntheticSourceInfo } from "./source-info.js";
|
|
103
103
|
import { getSupportedThinkingLevels, supportsMax, supportsXhigh } from "./thinking-levels.js";
|
|
@@ -3897,10 +3897,13 @@ export class AgentSession {
|
|
|
3897
3897
|
});
|
|
3898
3898
|
if (invocationTokens.length === 0)
|
|
3899
3899
|
return text;
|
|
3900
|
+
const maxExpansions = this.settingsManager.getMaxSkillExpansionsPerPrompt();
|
|
3900
3901
|
const expandedSkillNames = new Set();
|
|
3901
3902
|
const skillBlocks = [];
|
|
3902
3903
|
const invocationMetadata = [];
|
|
3903
3904
|
const removedTokens = [];
|
|
3905
|
+
const unloadedTokens = new Set();
|
|
3906
|
+
const skippedSkillNames = [];
|
|
3904
3907
|
for (const token of invocationTokens) {
|
|
3905
3908
|
const skill = skills.find((candidate) => candidate.name === token.name);
|
|
3906
3909
|
if (!skill) {
|
|
@@ -3908,16 +3911,10 @@ export class AgentSession {
|
|
|
3908
3911
|
break;
|
|
3909
3912
|
continue;
|
|
3910
3913
|
}
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
extensionPath: "skill:expansion",
|
|
3914
|
-
event: "skill_expansion",
|
|
3915
|
-
error: `Expanded at most ${MAX_SKILL_EXPANSIONS_PER_PROMPT} skills; remaining skill commands were left as literal text.`,
|
|
3916
|
-
});
|
|
3917
|
-
break;
|
|
3918
|
-
}
|
|
3919
|
-
removedTokens.push(token);
|
|
3914
|
+
// A repeat of an already expanded skill adds no context, so it never counts
|
|
3915
|
+
// against the cap and keeps its positional marker.
|
|
3920
3916
|
if (expandedSkillNames.has(skill.name)) {
|
|
3917
|
+
removedTokens.push(token);
|
|
3921
3918
|
this._extensionRunner.emitError({
|
|
3922
3919
|
extensionPath: skill.filePath,
|
|
3923
3920
|
event: "skill_expansion",
|
|
@@ -3925,6 +3922,14 @@ export class AgentSession {
|
|
|
3925
3922
|
});
|
|
3926
3923
|
continue;
|
|
3927
3924
|
}
|
|
3925
|
+
if (skillBlocks.length >= maxExpansions) {
|
|
3926
|
+
removedTokens.push(token);
|
|
3927
|
+
unloadedTokens.add(token);
|
|
3928
|
+
if (!skippedSkillNames.includes(skill.name))
|
|
3929
|
+
skippedSkillNames.push(skill.name);
|
|
3930
|
+
continue;
|
|
3931
|
+
}
|
|
3932
|
+
removedTokens.push(token);
|
|
3928
3933
|
try {
|
|
3929
3934
|
const content = readFileSync(skill.filePath, "utf-8");
|
|
3930
3935
|
const body = stripFrontmatter(content).trim();
|
|
@@ -3950,9 +3955,17 @@ export class AgentSession {
|
|
|
3950
3955
|
return text; // Return the original prompt when any skill file cannot be read.
|
|
3951
3956
|
}
|
|
3952
3957
|
}
|
|
3958
|
+
if (skippedSkillNames.length > 0) {
|
|
3959
|
+
const count = skippedSkillNames.length;
|
|
3960
|
+
this._extensionRunner.emitError({
|
|
3961
|
+
extensionPath: "skill:expansion",
|
|
3962
|
+
event: "skill_expansion",
|
|
3963
|
+
error: `Skipped ${count} skill${count === 1 ? "" : "s"} (${skippedSkillNames.join(", ")}): at most ${maxExpansions} skills load per prompt. Raise maxSkillExpansionsPerPrompt to load more.`,
|
|
3964
|
+
});
|
|
3965
|
+
}
|
|
3953
3966
|
if (skillBlocks.length === 0)
|
|
3954
3967
|
return text;
|
|
3955
|
-
const userRequest = removeSkillInvocationTokens(text, removedTokens);
|
|
3968
|
+
const userRequest = removeSkillInvocationTokens(text, removedTokens, unloadedTokens);
|
|
3956
3969
|
this._emit({ type: "skill_invocation", skills: invocationMetadata });
|
|
3957
3970
|
return formatSkillInvocationPrompt(skillBlocks, userRequest);
|
|
3958
3971
|
}
|
|
@@ -4678,6 +4691,27 @@ export class AgentSession {
|
|
|
4678
4691
|
});
|
|
4679
4692
|
return true;
|
|
4680
4693
|
}
|
|
4694
|
+
/** Whether a recorded resume requirement still blocks: the current context does not fit the current model. */
|
|
4695
|
+
_resumeRequirementStillBlocks(model, settings) {
|
|
4696
|
+
const currentContext = estimateContextTokens(filterContextExcludedMessages(this.sessionManager.buildSessionContext().messages)).tokens;
|
|
4697
|
+
return !projectModelUsabilityBudget({
|
|
4698
|
+
model,
|
|
4699
|
+
systemPrompt: this.agent.state.systemPrompt,
|
|
4700
|
+
tools: this.agent.state.tools,
|
|
4701
|
+
liveContextTokens: currentContext,
|
|
4702
|
+
compaction: settings,
|
|
4703
|
+
includeSpeculationLead: false,
|
|
4704
|
+
admission: "resume",
|
|
4705
|
+
}).usable;
|
|
4706
|
+
}
|
|
4707
|
+
/** Any committed compaction, manual /compact included, retires a resume requirement the context now satisfies. */
|
|
4708
|
+
_clearResumeCompactionRequirementIfFits() {
|
|
4709
|
+
const model = this.model;
|
|
4710
|
+
if (this._resumeCompactionRequirement === undefined || !model)
|
|
4711
|
+
return;
|
|
4712
|
+
if (!this._resumeRequirementStillBlocks(model, this._getCompactionSettings(model)))
|
|
4713
|
+
this._resumeCompactionRequirement = undefined;
|
|
4714
|
+
}
|
|
4681
4715
|
admitResumeCompactionRequired(projection) {
|
|
4682
4716
|
this._resumeCompactionRequirement = createResumeCompactionRequirement(projection);
|
|
4683
4717
|
}
|
|
@@ -5536,6 +5570,7 @@ export class AgentSession {
|
|
|
5536
5570
|
throw new CompactionRejectedError(execution.rejectionCause);
|
|
5537
5571
|
}
|
|
5538
5572
|
outcome = "completed";
|
|
5573
|
+
this._clearResumeCompactionRequirementIfFits();
|
|
5539
5574
|
return execution.result;
|
|
5540
5575
|
}
|
|
5541
5576
|
catch (error) {
|
|
@@ -5618,6 +5653,7 @@ export class AgentSession {
|
|
|
5618
5653
|
if (!execution.accepted) {
|
|
5619
5654
|
return { applied: false, reason: "rejected" };
|
|
5620
5655
|
}
|
|
5656
|
+
this._clearResumeCompactionRequirementIfFits();
|
|
5621
5657
|
this._resumeQueuedMessagesAfterCompaction();
|
|
5622
5658
|
return { applied: true, reason: "ok" };
|
|
5623
5659
|
}
|
|
@@ -6081,23 +6117,20 @@ export class AgentSession {
|
|
|
6081
6117
|
if (this._resumeCompactionRequirement !== undefined) {
|
|
6082
6118
|
if (!model)
|
|
6083
6119
|
throw new RequiredCompactionError();
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
}
|
|
6097
|
-
if (!remainingProjection.usable)
|
|
6098
|
-
throw new RequiredCompactionError();
|
|
6120
|
+
// The requirement was projected at resume, possibly on another model or before a manual
|
|
6121
|
+
// /compact (#2589, #2488). It only blocks while the CURRENT context still does not fit the
|
|
6122
|
+
// CURRENT model; otherwise the normal threshold path below decides, so a provider lane that
|
|
6123
|
+
// owns compaction (#1174) is never asked to compact a context that already fits.
|
|
6124
|
+
if (this._resumeRequirementStillBlocks(model, settings)) {
|
|
6125
|
+
const compacted = await this._runPrePromptCompaction(assistantMessage, skipAbortedCheck, inlineReason);
|
|
6126
|
+
if (!compacted)
|
|
6127
|
+
throw new RequiredCompactionError();
|
|
6128
|
+
if (this._resumeRequirementStillBlocks(model, settings))
|
|
6129
|
+
throw new RequiredCompactionError();
|
|
6130
|
+
this._resumeCompactionRequirement = undefined;
|
|
6131
|
+
return true;
|
|
6132
|
+
}
|
|
6099
6133
|
this._resumeCompactionRequirement = undefined;
|
|
6100
|
-
return true;
|
|
6101
6134
|
}
|
|
6102
6135
|
const contextTokens = estimateContextTokens(filterContextExcludedMessages(this.sessionManager.buildSessionContext().messages)).tokens;
|
|
6103
6136
|
const compacted = assistantMessage
|
|
@@ -56,10 +56,10 @@ export function createMcpExtension(service, sessionOwned = true) {
|
|
|
56
56
|
if (loadedSkills.has(skillName) || !skillsByName.has(skillName))
|
|
57
57
|
return;
|
|
58
58
|
loadedSkills.add(skillName);
|
|
59
|
-
const registered = service.getTierBSearchable();
|
|
59
|
+
const registered = service.getTierBSearchable(pi);
|
|
60
60
|
const targets = skillActivationTargets(skillDecls, skillName, registered);
|
|
61
61
|
if (targets.length > 0)
|
|
62
|
-
service.activateSkillMcpTools(targets);
|
|
62
|
+
service.activateSkillMcpTools(targets, pi);
|
|
63
63
|
};
|
|
64
64
|
pi.on("input", async (event, ctx) => {
|
|
65
65
|
const match = /^\s*\/skill:([A-Za-z0-9._-]+)/.exec(event.text);
|
|
@@ -69,7 +69,7 @@ export function createMcpExtension(service, sessionOwned = true) {
|
|
|
69
69
|
// inlined via the sanctioned input transform; failures pass through
|
|
70
70
|
// untouched with a one-line notice so submission is never blocked.
|
|
71
71
|
if (event.text.includes("@mcp:")) {
|
|
72
|
-
const expansion = await expandMcpResourceMentions(event.text, () => service.getMcpResourceServers());
|
|
72
|
+
const expansion = await expandMcpResourceMentions(event.text, () => service.getMcpResourceServers(pi));
|
|
73
73
|
for (const notice of expansion.notices) {
|
|
74
74
|
createMcpLogger("resources").warn(notice);
|
|
75
75
|
void ctx.ui?.notify?.(notice, "warning");
|
|
@@ -108,9 +108,9 @@ export function createMcpExtension(service, sessionOwned = true) {
|
|
|
108
108
|
await service.attachSession(event, ctx, pi);
|
|
109
109
|
refreshMcpInstructionsForSession(service);
|
|
110
110
|
if (sessionOwned)
|
|
111
|
-
registerMcpPromptCommands(service, pi, service.getMcpPromptServers());
|
|
111
|
+
registerMcpPromptCommands(service, pi, service.getMcpPromptServers(pi));
|
|
112
112
|
else
|
|
113
|
-
registerMcpPromptCommands(pi, service.getMcpPromptServers());
|
|
113
|
+
registerMcpPromptCommands(pi, service.getMcpPromptServers(pi));
|
|
114
114
|
})();
|
|
115
115
|
return attachPromise;
|
|
116
116
|
};
|
|
@@ -143,7 +143,7 @@ export function createMcpExtension(service, sessionOwned = true) {
|
|
|
143
143
|
skillDecls = parseSkillMcpDeclarations(skills);
|
|
144
144
|
const warnings = [
|
|
145
145
|
...skillDecls.warnings,
|
|
146
|
-
...(skillDecls.servers.size > 0 ? await service.attachSkillMcpServers(skillDecls.servers) : []),
|
|
146
|
+
...(skillDecls.servers.size > 0 ? await service.attachSkillMcpServers(skillDecls.servers, pi) : []),
|
|
147
147
|
];
|
|
148
148
|
for (const warning of warnings)
|
|
149
149
|
createMcpLogger("skills").warn(warning);
|
|
@@ -170,15 +170,24 @@ export function createMcpExtension(service, sessionOwned = true) {
|
|
|
170
170
|
};
|
|
171
171
|
pi.on("before_agent_start", onBeforeAgentStart, { previewSafe: true });
|
|
172
172
|
pi.on("session_shutdown", wrapAsync("mcp.session_shutdown", async (event) => {
|
|
173
|
-
if (
|
|
173
|
+
if (sessionOwned) {
|
|
174
|
+
disposeControlInventory();
|
|
175
|
+
await service.handleSessionShutdown(event);
|
|
174
176
|
return;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
}
|
|
178
|
+
if (event.reason !== "reload")
|
|
179
|
+
disposeControlInventory();
|
|
180
|
+
// The shared service outlives any one session: release only this session's binding,
|
|
181
|
+
// and dispose only when the last live session quits (#2514).
|
|
182
|
+
await service.releaseSession(pi, event.reason === "quit" ? "quit" : undefined);
|
|
177
183
|
}, sink));
|
|
178
184
|
pi.on("session_extensions_removed", wrapAsync("mcp.session_extensions_removed", async (event) => {
|
|
179
185
|
if (event.removed.some((extension) => extension.path === MCP_BUILTIN_EXTENSION_PATH)) {
|
|
180
186
|
disposeControlInventory();
|
|
181
|
-
|
|
187
|
+
if (sessionOwned)
|
|
188
|
+
await service.dispose("reload");
|
|
189
|
+
else
|
|
190
|
+
await service.releaseSession(pi, "reload");
|
|
182
191
|
}
|
|
183
192
|
}, sink));
|
|
184
193
|
};
|
|
@@ -6,6 +6,7 @@ import type { McpConnectionEntry } from "./service-types.ts";
|
|
|
6
6
|
type McpToolRegistrar = Pick<ExtensionAPI, "getActiveTools" | "setActiveTools" | "registerTool">;
|
|
7
7
|
export interface McpServiceDirectToolRegistrationOptions {
|
|
8
8
|
readonly refreshActiveSetWhenEmpty?: boolean;
|
|
9
|
+
readonly onRegistered?: (entry: McpConnectionEntry, identity: string) => void;
|
|
9
10
|
}
|
|
10
11
|
export declare function registerMcpServiceDirectTools(pi: McpToolRegistrar, config: ResolvedMcpConfig, entries: Iterable<McpConnectionEntry>, toolSearchService: ToolSearchService, options?: McpServiceDirectToolRegistrationOptions): Promise<McpSessionRegistration | undefined>;
|
|
11
12
|
export {};
|
|
@@ -10,15 +10,13 @@ export async function registerMcpServiceDirectTools(pi, config, entries, toolSea
|
|
|
10
10
|
artifacts: entry.artifacts,
|
|
11
11
|
cachedCatalog: startupCatalogPending ? claim?.cachedCatalog : entry.cachedCatalog,
|
|
12
12
|
startupCatalogPending,
|
|
13
|
-
onRegistered: (identity) =>
|
|
14
|
-
entry.registeredIdentity = identity;
|
|
15
|
-
},
|
|
13
|
+
onRegistered: (identity) => options.onRegistered?.(entry, identity),
|
|
16
14
|
connection: entry.connection,
|
|
17
15
|
ensureFresh: () => entry.authPlan?.refresh?.ensureFresh().then(() => undefined) ?? Promise.resolve(),
|
|
18
16
|
ensureCachedToolConnected: () => connectAndRefreshMcpCatalog(entry, serverConfig),
|
|
19
17
|
logger: entry.logger,
|
|
20
18
|
name: entry.name,
|
|
21
19
|
};
|
|
22
|
-
}), toolSearchService, options);
|
|
20
|
+
}), toolSearchService, { refreshActiveSetWhenEmpty: options.refreshActiveSetWhenEmpty });
|
|
23
21
|
}
|
|
24
22
|
//# sourceMappingURL=service-register.js.map
|
|
@@ -3,6 +3,12 @@ import type { ResolvedMcpConfig } from "./config-schema.ts";
|
|
|
3
3
|
import type { McpConnectionEntry } from "./service-types.ts";
|
|
4
4
|
import type { McpAsyncErrorSink } from "./wrap.ts";
|
|
5
5
|
type McpToolRegistrar = Pick<ExtensionAPI, "getActiveTools" | "setActiveTools" | "registerTool">;
|
|
6
|
+
/** One session's registration of a server's catalog: a refresh re-registers it there when stale. */
|
|
7
|
+
export interface McpToolsRefreshTarget {
|
|
8
|
+
readonly pi: McpToolRegistrar;
|
|
9
|
+
readonly registeredIdentity: () => string | undefined;
|
|
10
|
+
readonly register: () => Promise<void>;
|
|
11
|
+
}
|
|
6
12
|
/** Coalesce a server's tools-changed signals into one refresh. `connectOnly` is true when
|
|
7
13
|
* every merged signal came from a connect rather than from a reported change. */
|
|
8
14
|
export declare function subscribeMcpToolsChanged(entry: McpConnectionEntry, refresh: (connectOnly: boolean) => Promise<void>, sink: McpAsyncErrorSink): () => void;
|
|
@@ -11,8 +17,11 @@ export declare function subscribeMcpToolsChanged(entry: McpConnectionEntry, refr
|
|
|
11
17
|
* tools enter INACTIVE (registerToolsPreservingActiveSet keeps the active set),
|
|
12
18
|
* and removed tools are tombstoned so a stale call fails cleanly. Every connect
|
|
13
19
|
* raises the signal too; a connect-only refresh leaves an unchanged catalog
|
|
14
|
-
* registered, so the catalog lands once per session (#2177).
|
|
20
|
+
* registered, so the catalog lands once per session (#2177). Every live session sharing the
|
|
21
|
+
* connection is a target, resolved when registration starts and again until no session that
|
|
22
|
+
* attached mid-refresh is left out; each re-registers in its own tool set, and one session's
|
|
23
|
+
* failure is reported without starving the others (#2514).
|
|
15
24
|
*/
|
|
16
|
-
export declare function refreshMcpToolsOnListChanged(entry: McpConnectionEntry,
|
|
25
|
+
export declare function refreshMcpToolsOnListChanged(entry: McpConnectionEntry, targets: () => readonly McpToolsRefreshTarget[], config: ResolvedMcpConfig, connectOnly: boolean): Promise<void>;
|
|
17
26
|
export {};
|
|
18
27
|
//# sourceMappingURL=service-tools-changed.d.ts.map
|
|
@@ -31,9 +31,12 @@ export function subscribeMcpToolsChanged(entry, refresh, sink) {
|
|
|
31
31
|
* tools enter INACTIVE (registerToolsPreservingActiveSet keeps the active set),
|
|
32
32
|
* and removed tools are tombstoned so a stale call fails cleanly. Every connect
|
|
33
33
|
* raises the signal too; a connect-only refresh leaves an unchanged catalog
|
|
34
|
-
* registered, so the catalog lands once per session (#2177).
|
|
34
|
+
* registered, so the catalog lands once per session (#2177). Every live session sharing the
|
|
35
|
+
* connection is a target, resolved when registration starts and again until no session that
|
|
36
|
+
* attached mid-refresh is left out; each re-registers in its own tool set, and one session's
|
|
37
|
+
* failure is reported without starving the others (#2514).
|
|
35
38
|
*/
|
|
36
|
-
export async function refreshMcpToolsOnListChanged(entry,
|
|
39
|
+
export async function refreshMcpToolsOnListChanged(entry, targets, config, connectOnly) {
|
|
37
40
|
const server = config.servers[entry.name];
|
|
38
41
|
if (server?.config === undefined || entry.connection.state !== "connected")
|
|
39
42
|
return;
|
|
@@ -55,7 +58,10 @@ export async function refreshMcpToolsOnListChanged(entry, pi, config, registerDi
|
|
|
55
58
|
? newNames
|
|
56
59
|
: mapMcpCatalogNames(cachedToolsToCatalogEntries(entry.name, registeredCatalog, entry.connection, server.config.requestTimeoutMs, async () => { })).map(({ name }) => name));
|
|
57
60
|
const diff = diffMcpToolNames(knownNames, newNames);
|
|
58
|
-
|
|
61
|
+
const identity = mcpRegistrationIdentity(catalog, entry.cachedCatalog);
|
|
62
|
+
const initial = targets();
|
|
63
|
+
const stale = connectOnly ? initial.filter((target) => target.registeredIdentity() !== identity) : initial;
|
|
64
|
+
if (stale.length > 0) {
|
|
59
65
|
// Registration reads entry.cachedCatalog. A shared lease refreshed it above; nothing else
|
|
60
66
|
// refreshes a non-shared connection's catalog after its startup connect (#2188).
|
|
61
67
|
if (!(entry.connection instanceof SharedMcpLease)) {
|
|
@@ -64,9 +70,30 @@ export async function refreshMcpToolsOnListChanged(entry, pi, config, registerDi
|
|
|
64
70
|
}
|
|
65
71
|
// Tombstone removed tools BEFORE re-registration so the subsequent
|
|
66
72
|
// setActiveTools (which excludes them) leaves the tombstones inactive.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
const seen = new Set(initial.map((target) => target.pi));
|
|
74
|
+
const failures = [];
|
|
75
|
+
let pending = stale;
|
|
76
|
+
while (pending.length > 0) {
|
|
77
|
+
for (const target of pending) {
|
|
78
|
+
try {
|
|
79
|
+
for (const removed of diff.removed)
|
|
80
|
+
target.pi.registerTool(buildMcpTombstoneDefinition(removed, entry.name));
|
|
81
|
+
await target.register();
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
failures.push(error);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// A session that attached during this refresh registered the catalog cached before it.
|
|
88
|
+
pending = targets().filter((target) => !seen.has(target.pi));
|
|
89
|
+
for (const target of pending)
|
|
90
|
+
seen.add(target.pi);
|
|
91
|
+
}
|
|
92
|
+
if (failures.length > 0) {
|
|
93
|
+
entry.knownToolNames = newNames;
|
|
94
|
+
entry.lastListChangedDelta = formatMcpListChangedDelta(diff);
|
|
95
|
+
throw new AggregateError(failures, `MCP ${entry.name} tool refresh failed in ${failures.length} of ${seen.size} session(s)`);
|
|
96
|
+
}
|
|
70
97
|
}
|
|
71
98
|
entry.knownToolNames = newNames;
|
|
72
99
|
entry.lastListChangedDelta = formatMcpListChangedDelta(diff);
|
|
@@ -142,8 +142,6 @@ export interface McpConnectionEntry {
|
|
|
142
142
|
cachedCatalog?: McpCachedServerCatalog;
|
|
143
143
|
cacheRefreshedAfterConnect: boolean;
|
|
144
144
|
startupCatalogClaim?: McpStartupCatalogClaim;
|
|
145
|
-
/** `mcpRegistrationIdentity` of what the session last registered for this server. */
|
|
146
|
-
registeredIdentity?: string;
|
|
147
145
|
/** Full mcp tool names last registered for this server (list_changed diffing). */
|
|
148
146
|
knownToolNames?: string[];
|
|
149
147
|
/** Latest `/mcp status` list_changed delta line, e.g. "2 added (inactive), 1 removed". */
|
|
@@ -11,8 +11,17 @@ type McpElicitationUi = Pick<ExtensionUIContext, "input" | "select" | "confirm">
|
|
|
11
11
|
export { registerToolsPreservingActiveSet } from "./active-set.ts";
|
|
12
12
|
export declare class McpService {
|
|
13
13
|
#private;
|
|
14
|
-
|
|
14
|
+
/** `servesManySessions` marks the process-wide service every classic session attaches to. */
|
|
15
|
+
constructor(options?: Pick<McpSessionOptions, "mcpRegistry"> & {
|
|
16
|
+
readonly servesManySessions?: boolean;
|
|
17
|
+
});
|
|
15
18
|
attachSession(event: SessionStartEvent, ctx: McpSessionContext, _pi?: Pick<ExtensionAPI, "getActiveTools" | "setActiveTools" | "registerTool">, options?: McpSessionOptions): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Release the binding of the session that owns `pi` (#2514). The shared connections keep
|
|
21
|
+
* serving every other live session; once none is left, `disposeReason` disposes the service
|
|
22
|
+
* the way that last session's own exit would.
|
|
23
|
+
*/
|
|
24
|
+
releaseSession(pi: object, disposeReason?: McpDisposeReason): Promise<void>;
|
|
16
25
|
/**
|
|
17
26
|
* Register skill-declared MCP servers (todo 37). Skill servers are forced
|
|
18
27
|
* into search mode with no directTools, so their catalogs register with
|
|
@@ -21,18 +30,18 @@ export declare class McpService {
|
|
|
21
30
|
* returns a warning (system wins). `${VAR}` expansion follows the declaring
|
|
22
31
|
* skill's trust (skill-server.ts); each trust warning is returned once per session.
|
|
23
32
|
*/
|
|
24
|
-
attachSkillMcpServers(declared: ReadonlyMap<string, SkillServerRegistration
|
|
33
|
+
attachSkillMcpServers(declared: ReadonlyMap<string, SkillServerRegistration>, pi?: object): Promise<string[]>;
|
|
25
34
|
/** Registered searchable catalog (mapped name + server-side tool name),
|
|
26
35
|
* used by the skills loader to compute activation targets. */
|
|
27
|
-
getTierBSearchable(): ReadonlyArray<{
|
|
36
|
+
getTierBSearchable(pi?: object): ReadonlyArray<{
|
|
28
37
|
name: string;
|
|
29
38
|
toolName: string;
|
|
30
39
|
server: string;
|
|
31
40
|
}>;
|
|
32
41
|
/** Connected servers that list prompts (todo 40), for slash registration. */
|
|
33
|
-
getMcpPromptServers(): readonly import("./prompts.ts").McpPromptServer[];
|
|
42
|
+
getMcpPromptServers(pi?: object): readonly import("./prompts.ts").McpPromptServer[];
|
|
34
43
|
/** Connected servers that list resources (todo 39), for mention expansion. */
|
|
35
|
-
getMcpResourceServers(): readonly McpResourceServer[];
|
|
44
|
+
getMcpResourceServers(pi?: object): readonly McpResourceServer[];
|
|
36
45
|
/** Subscribe to completed catalog registrations. Consumers must inspect the
|
|
37
46
|
* resulting snapshot because tool, resource, and prompt catalogs can become
|
|
38
47
|
* available in different startup-race generations. */
|
|
@@ -51,7 +60,7 @@ export declare class McpService {
|
|
|
51
60
|
refreshWireStatusSnapshot(sessionId?: string): Promise<McpWireStatusSnapshot>;
|
|
52
61
|
/** Reveal skill-owned tools (todo 37): activation is effective the next
|
|
53
62
|
* turn, exactly like an tool_search promotion. Unknown names are ignored. */
|
|
54
|
-
activateSkillMcpTools(names: readonly string[]): void;
|
|
63
|
+
activateSkillMcpTools(names: readonly string[], pi?: object): void;
|
|
55
64
|
handleSessionShutdown(event: SessionShutdownEvent): Promise<void>;
|
|
56
65
|
dispose(reason: McpDisposeReason): Promise<void>;
|
|
57
66
|
getMcpOutputArtifacts(): McpOutputArtifacts;
|
|
@@ -70,9 +79,9 @@ export declare class McpService {
|
|
|
70
79
|
*/
|
|
71
80
|
getWireStatusSnapshot(sessionId?: string): McpWireStatusSnapshot;
|
|
72
81
|
/** Route compatibility callers through the shared ownership-aware scanner. */
|
|
73
|
-
rehydrateActiveToolsFromHistory(messages: readonly unknown[]): string[];
|
|
82
|
+
rehydrateActiveToolsFromHistory(messages: readonly unknown[], pi?: object): string[];
|
|
74
83
|
/** Shared service memoization keeps this scan once-per-catalog-generation. */
|
|
75
|
-
maybeRehydrateFromHistory(messages: readonly unknown[]): string[];
|
|
84
|
+
maybeRehydrateFromHistory(messages: readonly unknown[], pi?: object): string[];
|
|
76
85
|
setMcpInstructions(instructions: string): void;
|
|
77
86
|
getMcpInstructions(): string;
|
|
78
87
|
setMcpElicitationUiProvider(provider: (() => McpElicitationUi | undefined) | undefined): void;
|
|
@@ -96,4 +105,5 @@ export declare class McpService {
|
|
|
96
105
|
export declare function getMcpService(): McpService;
|
|
97
106
|
export declare function shouldDisposeMcpService(reason: SessionShutdownEvent["reason"]): reason is McpDisposeReason;
|
|
98
107
|
export declare function resetMcpServiceForTests(): void;
|
|
108
|
+
export declare const MCP_DEFERRED_DISPOSE_TIMEOUT_ENV = "SENPI_MCP_DEFERRED_DISPOSE_TIMEOUT_MS";
|
|
99
109
|
//# sourceMappingURL=service.d.ts.map
|