@code-yeongyu/senpi 2026.10.10-8 → 2026.10.10-9
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 +16 -0
- package/dist/bundle/chunks/{anthropic-messages-6EZ2RZQI.js → anthropic-messages-2B35OVB7.js} +2 -2
- package/dist/bundle/chunks/{app-server-command-WVQZIVCM.js → app-server-command-2ZXLBILW.js} +1 -1
- package/dist/bundle/chunks/{chunk-KKJJVAVT.js → chunk-4WZF7G6N.js} +1 -1
- package/dist/bundle/chunks/{chunk-TUGQPBQG.js → chunk-NTH33AXY.js} +15 -4
- package/dist/bundle/chunks/{chunk-56NFYCQ3.js → chunk-QMUL36OS.js} +19 -24
- package/dist/bundle/chunks/{chunk-TLK72OXY.js → chunk-QQZREV6B.js} +1 -1
- package/dist/bundle/chunks/chunk-Z72GD25U.js +9 -0
- package/dist/bundle/chunks/{chunk-QYKYTDMI.js → chunk-ZCYTYHDN.js} +1 -1
- package/dist/bundle/chunks/{chunk-DOMETRRO.js → chunk-ZPJHS64R.js} +1 -1
- package/dist/bundle/chunks/{cli-main-CED4CUJM.js → cli-main-VTGNVET5.js} +1 -1
- package/dist/bundle/chunks/{help-fast-path-PSP2GJSG.js → help-fast-path-5P73752B.js} +1 -1
- package/dist/bundle/chunks/{host-command-5ILDFZVI.js → host-command-MWQNTWFA.js} +1 -1
- package/dist/bundle/chunks/{interactive-mode-ZKESRBOA.js → interactive-mode-ERBFHQQJ.js} +1 -1
- package/dist/bundle/chunks/{multi-session-host-AL2DTLN2.js → multi-session-host-S37LFCMH.js} +1 -1
- package/dist/bundle/chunks/{package-manager-cli-U4UWVUUX.js → package-manager-cli-FVEIJBD5.js} +1 -1
- package/dist/bundle/chunks/{rotation-stream-TAARAJGY.js → rotation-stream-FQH63DMY.js} +1 -1
- package/dist/bundle/chunks/{rpc-mode-MXEWGXIB.js → rpc-mode-KJFVBWIP.js} +1 -1
- package/dist/bundle/chunks/{session-control-endpoint-EQXHX4WI.js → session-control-endpoint-OH7XV2FN.js} +1 -1
- package/dist/bundle/chunks/{session-picker-LIZG5P3Q.js → session-picker-UUSW6YSU.js} +1 -1
- package/dist/bundle/chunks/session-worker.js +31 -30
- 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 +16 -0
- package/dist/core/agent-session.js +61 -0
- package/dist/core/engine-turn-limit.d.ts +36 -0
- package/dist/core/engine-turn-limit.js +74 -0
- package/dist/core/extensions/builtin/ask-user/format.d.ts +9 -4
- package/dist/core/extensions/builtin/ask-user/format.js +37 -9
- package/dist/core/extensions/builtin/ask-user/params.d.ts +2 -0
- package/dist/core/extensions/builtin/ask-user/params.js +6 -0
- package/dist/core/extensions/builtin/ask-user/resume.js +8 -1
- package/dist/core/extensions/builtin/ask-user/schema.js +4 -0
- package/dist/core/extensions/builtin/ask-user/tool.js +18 -7
- package/dist/core/extensions/builtin/hooks/index.js +1 -1
- package/dist/core/extensions/builtin/ttsr/follow-up-limit.d.ts +11 -0
- package/dist/core/extensions/builtin/ttsr/follow-up-limit.js +30 -0
- package/dist/core/extensions/builtin/ttsr/index.js +9 -1
- package/dist/core/extensions/runner.d.ts +2 -0
- package/dist/core/extensions/runner.js +4 -0
- package/dist/core/extensions/types.d.ts +2 -0
- package/dist/core/settings-manager.d.ts +9 -0
- package/dist/core/settings-manager.js +9 -0
- package/dist/modes/interactive/interactive-mode.js +1 -1
- package/docs/settings.md +9 -0
- package/package.json +6 -6
- package/dist/bundle/chunks/chunk-V43EN5GQ.js +0 -14
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{captureStdout,exitAfterOutput,getLatestPiRelease,hasInheritedInspectorOption,isNewerPackageVersion,printThenExit,processBunRuntimeOptions,releaseInheritedInspectorForChild,resolveBunReexec}from"./chunks/chunk-5PB3SNZ7.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"))&&await printThenExit(()=>console.log(DISPLAY_VERSION));if(isRootCommand(args)&&args.some(arg=>arg==="--help"||arg==="-h")){let{tryPrintHelpWithoutEngine}=await import("./chunks/help-fast-path-PSP2GJSG.js"),help=await captureStdout(()=>tryPrintHelpWithoutEngine(args));help.result&&await exitAfterOutput(help.output),process.stdout.write(help.output)}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-CED4CUJM.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"))&&await printThenExit(()=>console.log(DISPLAY_VERSION));if(isRootCommand(args)&&args.some(arg=>arg==="--help"||arg==="-h")){let{tryPrintHelpWithoutEngine}=await import("./chunks/help-fast-path-5P73752B.js"),help=await captureStdout(()=>tryPrintHelpWithoutEngine(args));help.result&&await exitAfterOutput(help.output),process.stdout.write(help.output)}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-VTGNVET5.js")}
|
package/dist/bundle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
|
|
2
|
-
import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultResourceLoader,EVAL_HANDLE_ERROR_CODES,EvalHandleError,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SESSION_CONTROL_DELIVERY_TYPE,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildNoticeBox,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,connectWebViewService,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isSessionControlDeliveryDetails,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,prepareBranchEntries,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,sessionControlSenderOf,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-56NFYCQ3.js";import{UnknownCommandError,readOwnFootprint,readProcessFootprint,runRpcMode}from"./chunks/chunk-V43EN5GQ.js";import"./chunks/chunk-XMHO4QQN.js";import{CURRENT_SESSION_VERSION,DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionManager,SessionSelectorComponent,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,getLatestCompactionEntry,keyHint,keyText,migrateSessionEntries,parseSessionEntries,rawKeyHint,sessionEntryToContextMessages}from"./chunks/chunk-KKJJVAVT.js";import{SettingsManager,Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,parseSkillBlock}from"./chunks/chunk-TUGQPBQG.js";import"./chunks/chunk-LYYI74CY.js";import"./chunks/chunk-4GPJOGXZ.js";import{sanitizeTerminalLabel,visibleWidth}from"./chunks/chunk-KCVSSFOV.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-U5KVIAHJ.js";import"./chunks/chunk-TLK72OXY.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-HKRW6HT5.js";import"./chunks/chunk-TJPMB4VH.js";import{createSyntheticSourceInfo}from"./chunks/chunk-QMRJYMNH.js";import{gcHostEndpoints,listHostEndpoints}from"./chunks/chunk-MYVBK47X.js";import{compareEngineOrdinal,engineBuildIdentity,engineBuildIdentityFrom}from"./chunks/chunk-ZJHRDQCH.js";import"./chunks/chunk-UWYQPA26.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-QYKYTDMI.js";import"./chunks/chunk-JMYO34RK.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-5AKP2VFB.js";import"./chunks/chunk-CIRZTP7W.js";import{ENDPOINT_REGISTRY_VERSION,createHostDaemonPaths,daemonDirectoryName,shardKey,shardSocketPath,shardSocketPathForKey}from"./chunks/chunk-LR5EN45D.js";import"./chunks/chunk-YI7SPFDN.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-G2XAU4BX.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-RRU5LXMS.js";import{parseArgs}from"./chunks/chunk-VE3D74HN.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-DOMETRRO.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-2JKDZXIY.js";import"./chunks/chunk-5PB3SNZ7.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-I5HLTDT4.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-YOPVJDSU.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-VYKBN4MR.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-TAV6QZFM.js";import"./chunks/chunk-PELNNWGO.js";import"./chunks/chunk-L4HVJWIF.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,EVAL_HANDLE_ERROR_CODES,EvalHandleError,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,sessionControlSenderOf,sessionEntryToContextMessages,shardKey,shardSocketPath,shardSocketPathForKey,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,visibleWidth,withBundledBunCommands,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
|
|
2
|
+
import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultResourceLoader,EVAL_HANDLE_ERROR_CODES,EvalHandleError,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SESSION_CONTROL_DELIVERY_TYPE,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildNoticeBox,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,connectWebViewService,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isSessionControlDeliveryDetails,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,prepareBranchEntries,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,sessionControlSenderOf,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-QMUL36OS.js";import{UnknownCommandError,readOwnFootprint,readProcessFootprint,runRpcMode}from"./chunks/chunk-Z72GD25U.js";import"./chunks/chunk-XMHO4QQN.js";import{CURRENT_SESSION_VERSION,DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionManager,SessionSelectorComponent,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,getLatestCompactionEntry,keyHint,keyText,migrateSessionEntries,parseSessionEntries,rawKeyHint,sessionEntryToContextMessages}from"./chunks/chunk-4WZF7G6N.js";import{SettingsManager,Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,parseSkillBlock}from"./chunks/chunk-NTH33AXY.js";import"./chunks/chunk-LYYI74CY.js";import"./chunks/chunk-4GPJOGXZ.js";import{sanitizeTerminalLabel,visibleWidth}from"./chunks/chunk-KCVSSFOV.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-U5KVIAHJ.js";import"./chunks/chunk-QQZREV6B.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-HKRW6HT5.js";import"./chunks/chunk-TJPMB4VH.js";import{createSyntheticSourceInfo}from"./chunks/chunk-QMRJYMNH.js";import{gcHostEndpoints,listHostEndpoints}from"./chunks/chunk-MYVBK47X.js";import{compareEngineOrdinal,engineBuildIdentity,engineBuildIdentityFrom}from"./chunks/chunk-ZJHRDQCH.js";import"./chunks/chunk-UWYQPA26.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-ZCYTYHDN.js";import"./chunks/chunk-JMYO34RK.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-5AKP2VFB.js";import"./chunks/chunk-CIRZTP7W.js";import{ENDPOINT_REGISTRY_VERSION,createHostDaemonPaths,daemonDirectoryName,shardKey,shardSocketPath,shardSocketPathForKey}from"./chunks/chunk-LR5EN45D.js";import"./chunks/chunk-YI7SPFDN.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-G2XAU4BX.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-RRU5LXMS.js";import{parseArgs}from"./chunks/chunk-VE3D74HN.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-ZPJHS64R.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-2JKDZXIY.js";import"./chunks/chunk-5PB3SNZ7.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-I5HLTDT4.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-YOPVJDSU.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-VYKBN4MR.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-TAV6QZFM.js";import"./chunks/chunk-PELNNWGO.js";import"./chunks/chunk-L4HVJWIF.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,EVAL_HANDLE_ERROR_CODES,EvalHandleError,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,sessionControlSenderOf,sessionEntryToContextMessages,shardKey,shardSocketPath,shardSocketPathForKey,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,visibleWidth,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-QMUL36OS.js";import"./chunks/chunk-Z72GD25U.js";import"./chunks/chunk-XMHO4QQN.js";import"./chunks/chunk-4WZF7G6N.js";import{configureHttpDispatcher}from"./chunks/chunk-NTH33AXY.js";import"./chunks/chunk-LYYI74CY.js";import"./chunks/chunk-4GPJOGXZ.js";import"./chunks/chunk-KCVSSFOV.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-U5KVIAHJ.js";import"./chunks/chunk-QQZREV6B.js";import"./chunks/chunk-JABBHOD5.js";import"./chunks/chunk-HKRW6HT5.js";import"./chunks/chunk-TJPMB4VH.js";import"./chunks/chunk-QMRJYMNH.js";import"./chunks/chunk-MYVBK47X.js";import"./chunks/chunk-ZJHRDQCH.js";import"./chunks/chunk-UWYQPA26.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-ZCYTYHDN.js";import"./chunks/chunk-JMYO34RK.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-5AKP2VFB.js";import"./chunks/chunk-CIRZTP7W.js";import"./chunks/chunk-LR5EN45D.js";import"./chunks/chunk-YI7SPFDN.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-G2XAU4BX.js";import"./chunks/chunk-RRU5LXMS.js";import"./chunks/chunk-VE3D74HN.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-ZPJHS64R.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-2JKDZXIY.js";import"./chunks/chunk-5PB3SNZ7.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-I5HLTDT4.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-YOPVJDSU.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-VYKBN4MR.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-TAV6QZFM.js";import"./chunks/chunk-PELNNWGO.js";import"./chunks/chunk-L4HVJWIF.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":"7543bf2924c3d8b2","externals":["@earendil-works/chord","@earendil-works/pi-pty","@silvia-odwyer/photon-node","bufferutil","canvas","kerberos","supports-color","utf-8-validate"]}
|
|
@@ -524,6 +524,7 @@ export declare class AgentSession {
|
|
|
524
524
|
private _sessionStartDispatching;
|
|
525
525
|
/** User-abort generation at the start of an idle trigger turn's awaited admission hooks. */
|
|
526
526
|
private _triggerTurnAdmissionAbortGeneration;
|
|
527
|
+
private _engineTurnStarts;
|
|
527
528
|
private _nextInputId;
|
|
528
529
|
private _idleWaitPromise;
|
|
529
530
|
private _resolveIdleWait;
|
|
@@ -1268,6 +1269,21 @@ export declare class AgentSession {
|
|
|
1268
1269
|
triggerTurn?: boolean;
|
|
1269
1270
|
deliverAs?: "steer" | "followUp" | "nextTurn";
|
|
1270
1271
|
}, deferredTurnClaim?: DeferredTurnClaim): Promise<void>;
|
|
1272
|
+
/**
|
|
1273
|
+
* An engine-originated turn (an extension's `sendMessage` with `triggerTurn`, from any source) that would
|
|
1274
|
+
* exceed the engine-wide bound is not started: the message is still recorded, and the stop is recorded,
|
|
1275
|
+
* emitted and shown (senpi#2967).
|
|
1276
|
+
*/
|
|
1277
|
+
/**
|
|
1278
|
+
* The engine-turn bound's bookkeeping must never stop a turn: a session file that refuses the write (read-only,
|
|
1279
|
+
* full disk) only loses the count, as the turn's own persistence reports the failure (senpi#2967).
|
|
1280
|
+
*/
|
|
1281
|
+
private _recordEngineTurnStart;
|
|
1282
|
+
/** A refused engine turn still records its message and settles a cross-session delivery it carries. */
|
|
1283
|
+
private _recordRefusedEngineTurnMessage;
|
|
1284
|
+
/** Keeps this process's engine-turn record: a user message clears it, a tool call marks the running engine turn. */
|
|
1285
|
+
private _observeEngineTurnMessage;
|
|
1286
|
+
private _stopEngineTurn;
|
|
1271
1287
|
/** Environment context a new turn must carry: set when cwd or date differs from the latest one visible (senpi#2093). */
|
|
1272
1288
|
private _pendingEnvironmentContextMessage;
|
|
1273
1289
|
private _appendCustomMessage;
|
|
@@ -49,6 +49,7 @@ import { resolveDiscoveredResourcePaths } from "./discovered-resource-scope.js";
|
|
|
49
49
|
import { buildDynamicSystemPrompt, resolvePromptSurface, } from "./dynamic-prompt/index.js";
|
|
50
50
|
import { AssistantEditError, assertExpectedLeaf, assistantTextEquals, buildEditedAssistantMessage, SessionStreamingError, } from "./edited-assistant-message.js";
|
|
51
51
|
import { assertExpectedUserLeaf, buildEditedUserMessage, UserEditError, userTextEquals, } from "./edited-user-message.js";
|
|
52
|
+
import { ENGINE_TURN_LIMIT_ENTRY_TYPE, ENGINE_TURN_LIMIT_EVENT, ENGINE_TURN_START_ENTRY_TYPE, engineTurnLimitNotice, engineTurnStop, isUserDirectedTurn, } from "./engine-turn-limit.js";
|
|
52
53
|
import { environmentContextMessageIfChanged, resolveEnvironmentContext, } from "./environment-context.js";
|
|
53
54
|
import { areExperimentalFeaturesEnabled } from "./experimental.js";
|
|
54
55
|
import { exportSessionToHtml } from "./export-html/index.js";
|
|
@@ -308,6 +309,7 @@ export class AgentSession {
|
|
|
308
309
|
this._promptStartPending = false;
|
|
309
310
|
/** True while a reload's `session_start` handlers run; a nested reload would retire the runner they run on. */
|
|
310
311
|
this._sessionStartDispatching = false;
|
|
312
|
+
this._engineTurnStarts = [];
|
|
311
313
|
this._nextInputId = 0;
|
|
312
314
|
this._settlementEpoch = 0;
|
|
313
315
|
/** Set by the idle release; every runtime read re-hydrates before handing the array out. */
|
|
@@ -2096,6 +2098,7 @@ export class AgentSession {
|
|
|
2096
2098
|
}
|
|
2097
2099
|
// Handle session persistence
|
|
2098
2100
|
if (event.type === "message_end") {
|
|
2101
|
+
this._observeEngineTurnMessage(event.message);
|
|
2099
2102
|
let entryId;
|
|
2100
2103
|
try {
|
|
2101
2104
|
// Check if this is a custom message from extensions
|
|
@@ -4295,6 +4298,9 @@ export class AgentSession {
|
|
|
4295
4298
|
this.agent.steer(appMessage);
|
|
4296
4299
|
}
|
|
4297
4300
|
}
|
|
4301
|
+
else if (options?.triggerTurn && this._stopEngineTurn(message.customType)) {
|
|
4302
|
+
this._recordRefusedEngineTurnMessage(appMessage);
|
|
4303
|
+
}
|
|
4298
4304
|
else if (options?.triggerTurn) {
|
|
4299
4305
|
finishSessionWork ??= this._sessionWorkBarrier.begin();
|
|
4300
4306
|
const environmentContext = this._pendingEnvironmentContextMessage();
|
|
@@ -4338,6 +4344,8 @@ export class AgentSession {
|
|
|
4338
4344
|
finally {
|
|
4339
4345
|
this._triggerTurnAdmissionAbortGeneration = undefined;
|
|
4340
4346
|
}
|
|
4347
|
+
if (!isUserDirectedTurn(message.customType))
|
|
4348
|
+
this._recordEngineTurnStart(message.customType);
|
|
4341
4349
|
await this._promptAgent(messages, deferredTurnClaim);
|
|
4342
4350
|
}
|
|
4343
4351
|
else if (this.isStreaming) {
|
|
@@ -4352,6 +4360,59 @@ export class AgentSession {
|
|
|
4352
4360
|
finishSessionWork?.();
|
|
4353
4361
|
}
|
|
4354
4362
|
}
|
|
4363
|
+
/**
|
|
4364
|
+
* An engine-originated turn (an extension's `sendMessage` with `triggerTurn`, from any source) that would
|
|
4365
|
+
* exceed the engine-wide bound is not started: the message is still recorded, and the stop is recorded,
|
|
4366
|
+
* emitted and shown (senpi#2967).
|
|
4367
|
+
*/
|
|
4368
|
+
/**
|
|
4369
|
+
* The engine-turn bound's bookkeeping must never stop a turn: a session file that refuses the write (read-only,
|
|
4370
|
+
* full disk) only loses the count, as the turn's own persistence reports the failure (senpi#2967).
|
|
4371
|
+
*/
|
|
4372
|
+
_recordEngineTurnStart(customType) {
|
|
4373
|
+
this._engineTurnStarts.push({ at: Date.now(), toolUsed: false });
|
|
4374
|
+
try {
|
|
4375
|
+
this._emitEntryAppended(this.sessionManager.appendCustomEntry(ENGINE_TURN_START_ENTRY_TYPE, { customType }));
|
|
4376
|
+
}
|
|
4377
|
+
catch {
|
|
4378
|
+
return;
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4381
|
+
/** A refused engine turn still records its message and settles a cross-session delivery it carries. */
|
|
4382
|
+
_recordRefusedEngineTurnMessage(appMessage) {
|
|
4383
|
+
try {
|
|
4384
|
+
this._appendCustomMessage(appMessage);
|
|
4385
|
+
this.externalAdmission.observePersisted(appMessage);
|
|
4386
|
+
}
|
|
4387
|
+
catch (error) {
|
|
4388
|
+
this.externalAdmission.observeRefused(appMessage, error instanceof Error ? error.message : String(error));
|
|
4389
|
+
}
|
|
4390
|
+
}
|
|
4391
|
+
/** Keeps this process's engine-turn record: a user message clears it, a tool call marks the running engine turn. */
|
|
4392
|
+
_observeEngineTurnMessage(message) {
|
|
4393
|
+
if (message.role === "user" || (message.role === "custom" && isUserDirectedTurn(message.customType))) {
|
|
4394
|
+
this._engineTurnStarts = [];
|
|
4395
|
+
return;
|
|
4396
|
+
}
|
|
4397
|
+
const running = this._engineTurnStarts.at(-1);
|
|
4398
|
+
if (running !== undefined &&
|
|
4399
|
+
message.role === "assistant" &&
|
|
4400
|
+
message.content.some((block) => block.type === "toolCall")) {
|
|
4401
|
+
running.toolUsed = true;
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4404
|
+
_stopEngineTurn(customType) {
|
|
4405
|
+
if (isUserDirectedTurn(customType))
|
|
4406
|
+
return false;
|
|
4407
|
+
const stop = engineTurnStop(this.sessionManager.getEntries(), Date.now(), this.settingsManager.getEngineTurnSettings(), this._engineTurnStarts);
|
|
4408
|
+
if (stop === null)
|
|
4409
|
+
return false;
|
|
4410
|
+
const details = { customType, ...stop, at: Date.now() };
|
|
4411
|
+
this._emitEntryAppended(this.sessionManager.appendCustomEntry(ENGINE_TURN_LIMIT_ENTRY_TYPE, details));
|
|
4412
|
+
this._extensionRunner.emitBusEvent(ENGINE_TURN_LIMIT_EVENT, details);
|
|
4413
|
+
this._extensionRunner.getUIContext().notify(engineTurnLimitNotice(stop), "warning");
|
|
4414
|
+
return true;
|
|
4415
|
+
}
|
|
4355
4416
|
/** Environment context a new turn must carry: set when cwd or date differs from the latest one visible (senpi#2093). */
|
|
4356
4417
|
_pendingEnvironmentContextMessage() {
|
|
4357
4418
|
if (!this._environmentContextEnabled)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SessionEntry } from "./session-manager.ts";
|
|
2
|
+
export declare const MAX_ENGINE_TURNS_PER_USER_INPUT = 150;
|
|
3
|
+
export declare const MAX_TOOL_FREE_ENGINE_TURNS_PER_WINDOW = 12;
|
|
4
|
+
export declare const ENGINE_TURN_WINDOW_MS = 60000;
|
|
5
|
+
/** Appended when the engine starts a turn no user message asked for; the limits count these. */
|
|
6
|
+
export declare const ENGINE_TURN_START_ENTRY_TYPE = "engine-turn-start";
|
|
7
|
+
export declare const ENGINE_TURN_LIMIT_ENTRY_TYPE = "engine-turn-limit";
|
|
8
|
+
export declare const ENGINE_TURN_LIMIT_EVENT = "engine:turn-limit";
|
|
9
|
+
export type EngineTurnStopReason = "per-user-input" | "tool-free-rate";
|
|
10
|
+
/** A limit of 0 turns that limit off. */
|
|
11
|
+
export interface EngineTurnLimits {
|
|
12
|
+
readonly maxPerUserInput: number;
|
|
13
|
+
readonly maxToolFreePerMinute: number;
|
|
14
|
+
}
|
|
15
|
+
/** An engine turn this process started since the user's last message, kept even when the session file refuses writes. */
|
|
16
|
+
export interface EngineTurnStartRecord {
|
|
17
|
+
readonly at: number;
|
|
18
|
+
toolUsed: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface EngineTurnStop {
|
|
21
|
+
readonly reason: EngineTurnStopReason;
|
|
22
|
+
readonly sinceUserInput: number;
|
|
23
|
+
readonly toolFreeInWindow: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function engineTurnLimitNotice(stop: EngineTurnStop): string;
|
|
26
|
+
/** A `.` manual continue or a continue-from-leaf is the user's own request, not an automatic turn. */
|
|
27
|
+
export declare function isUserDirectedTurn(customType: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether one more engine-started turn may begin. Only turns since the user's last message count, so any
|
|
30
|
+
* message the user sends lifts a pause at once. Read from the session entries, so a host that rebuilds
|
|
31
|
+
* extensions or reopens the session between turns is bounded too (senpi#2967). The per-minute breaker counts
|
|
32
|
+
* only engine turns whose reply called no tool: measured goal runs never exceed it, while every observed
|
|
33
|
+
* runaway has that shape.
|
|
34
|
+
*/
|
|
35
|
+
export declare function engineTurnStop(entries: readonly SessionEntry[], now: number, limits: EngineTurnLimits, inProcess?: readonly EngineTurnStartRecord[]): EngineTurnStop | null;
|
|
36
|
+
//# sourceMappingURL=engine-turn-limit.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CONTINUE_FROM_LEAF_CUSTOM_TYPE } from "./continue-from-leaf.js";
|
|
2
|
+
import { MANUAL_CONTINUE_CUSTOM_TYPE } from "./manual-continue.js";
|
|
3
|
+
export const MAX_ENGINE_TURNS_PER_USER_INPUT = 150;
|
|
4
|
+
export const MAX_TOOL_FREE_ENGINE_TURNS_PER_WINDOW = 12;
|
|
5
|
+
export const ENGINE_TURN_WINDOW_MS = 60_000;
|
|
6
|
+
/** Appended when the engine starts a turn no user message asked for; the limits count these. */
|
|
7
|
+
export const ENGINE_TURN_START_ENTRY_TYPE = "engine-turn-start";
|
|
8
|
+
export const ENGINE_TURN_LIMIT_ENTRY_TYPE = "engine-turn-limit";
|
|
9
|
+
export const ENGINE_TURN_LIMIT_EVENT = "engine:turn-limit";
|
|
10
|
+
export function engineTurnLimitNotice(stop) {
|
|
11
|
+
return stop.reason === "per-user-input"
|
|
12
|
+
? `Paused: the agent started ${stop.sinceUserInput} turns on its own since your last message. Send any message to continue.`
|
|
13
|
+
: `Paused: the agent started ${stop.toolFreeInWindow} turns on its own in the last minute without doing any work. Send any message to continue.`;
|
|
14
|
+
}
|
|
15
|
+
/** A `.` manual continue or a continue-from-leaf is the user's own request, not an automatic turn. */
|
|
16
|
+
export function isUserDirectedTurn(customType) {
|
|
17
|
+
return customType === MANUAL_CONTINUE_CUSTOM_TYPE || customType === CONTINUE_FROM_LEAF_CUSTOM_TYPE;
|
|
18
|
+
}
|
|
19
|
+
function isUserMessage(entry) {
|
|
20
|
+
if (entry.type === "custom_message")
|
|
21
|
+
return isUserDirectedTurn(entry.customType);
|
|
22
|
+
return entry.type === "message" && entry.message.role === "user";
|
|
23
|
+
}
|
|
24
|
+
function isEngineTurnStart(entry) {
|
|
25
|
+
return entry.type === "custom" && entry.customType === ENGINE_TURN_START_ENTRY_TYPE;
|
|
26
|
+
}
|
|
27
|
+
function callsATool(entry) {
|
|
28
|
+
return (entry.type === "message" &&
|
|
29
|
+
entry.message.role === "assistant" &&
|
|
30
|
+
entry.message.content.some((block) => block.type === "toolCall"));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Whether one more engine-started turn may begin. Only turns since the user's last message count, so any
|
|
34
|
+
* message the user sends lifts a pause at once. Read from the session entries, so a host that rebuilds
|
|
35
|
+
* extensions or reopens the session between turns is bounded too (senpi#2967). The per-minute breaker counts
|
|
36
|
+
* only engine turns whose reply called no tool: measured goal runs never exceed it, while every observed
|
|
37
|
+
* runaway has that shape.
|
|
38
|
+
*/
|
|
39
|
+
export function engineTurnStop(entries, now, limits, inProcess = []) {
|
|
40
|
+
let start = entries.length;
|
|
41
|
+
while (start > 0 && !isUserMessage(entries[start - 1]))
|
|
42
|
+
start -= 1;
|
|
43
|
+
let sinceUserInput = 0;
|
|
44
|
+
let toolFreeInWindow = 0;
|
|
45
|
+
for (let index = start; index < entries.length; index++) {
|
|
46
|
+
const entry = entries[index];
|
|
47
|
+
if (!isEngineTurnStart(entry))
|
|
48
|
+
continue;
|
|
49
|
+
sinceUserInput += 1;
|
|
50
|
+
if (now - Date.parse(entry.timestamp) >= ENGINE_TURN_WINDOW_MS)
|
|
51
|
+
continue;
|
|
52
|
+
let toolUsed = false;
|
|
53
|
+
for (let next = index + 1; next < entries.length && !isEngineTurnStart(entries[next]); next++) {
|
|
54
|
+
if (callsATool(entries[next])) {
|
|
55
|
+
toolUsed = true;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!toolUsed)
|
|
60
|
+
toolFreeInWindow += 1;
|
|
61
|
+
}
|
|
62
|
+
// The session record and this process's own record: the larger count wins, so a file that refuses writes
|
|
63
|
+
// cannot lift the bound for the process that is running the turns.
|
|
64
|
+
sinceUserInput = Math.max(sinceUserInput, inProcess.length);
|
|
65
|
+
toolFreeInWindow = Math.max(toolFreeInWindow, inProcess.filter((record) => !record.toolUsed && now - record.at < ENGINE_TURN_WINDOW_MS).length);
|
|
66
|
+
if (limits.maxPerUserInput > 0 && sinceUserInput >= limits.maxPerUserInput) {
|
|
67
|
+
return { reason: "per-user-input", sinceUserInput, toolFreeInWindow };
|
|
68
|
+
}
|
|
69
|
+
if (limits.maxToolFreePerMinute > 0 && toolFreeInWindow >= limits.maxToolFreePerMinute) {
|
|
70
|
+
return { reason: "tool-free-rate", sinceUserInput, toolFreeInWindow };
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=engine-turn-limit.js.map
|
|
@@ -21,13 +21,18 @@ export type ClaudeResultDetails = {
|
|
|
21
21
|
userWords?: ToolResultUserWord[];
|
|
22
22
|
};
|
|
23
23
|
type Questions = QuestionRequest["questions"];
|
|
24
|
+
/**
|
|
25
|
+
* A required question cancelled with a reason (a UI failure): the reason stands in for the status line,
|
|
26
|
+
* a draft the user typed is named and marked not an answer, and the action is refused (senpi#2949).
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatGatedCancellation(reason: string, response: QuestionResponse, requestId: string, questions: Questions): string;
|
|
24
29
|
/** The answer as a person reads it, with the user's words inline (hooks, the transcript card). */
|
|
25
|
-
export declare function formatResultText(_variant: AskUserVariant, response: QuestionResponse, questions?: Questions): string;
|
|
30
|
+
export declare function formatResultText(_variant: AskUserVariant, response: QuestionResponse, questions?: Questions, required?: boolean): string;
|
|
26
31
|
/**
|
|
27
32
|
* The answer as the model receives it: `text` holds only the structure and the options the model
|
|
28
33
|
* offered; each of the user's own words is a `words` entry that `text` names by its label.
|
|
29
34
|
*/
|
|
30
|
-
export declare function formatModelAnswer(response: QuestionResponse, requestId: string, questions?: Questions): {
|
|
35
|
+
export declare function formatModelAnswer(response: QuestionResponse, requestId: string, questions?: Questions, required?: boolean): {
|
|
31
36
|
text: string;
|
|
32
37
|
words: ToolResultUserWord[];
|
|
33
38
|
};
|
|
@@ -36,7 +41,7 @@ export declare function formatModelAnswer(response: QuestionResponse, requestId:
|
|
|
36
41
|
* structure, then each of the user's words after its own label block. An answer with no typed
|
|
37
42
|
* words stays the single framed string it always was.
|
|
38
43
|
*/
|
|
39
|
-
export declare function formatUserMessage(response: QuestionResponse, requestId: string, questions?: Questions): string | TextContent[];
|
|
44
|
+
export declare function formatUserMessage(response: QuestionResponse, requestId: string, questions?: Questions, required?: boolean): string | TextContent[];
|
|
40
45
|
/** Display text of a framed answer whose words travel as labelled blocks; undefined otherwise. */
|
|
41
46
|
export declare function askUserAnswerDisplayText(content: string | (TextContent | ImageContent)[]): string | undefined;
|
|
42
47
|
export interface AskUserAnswerFrame {
|
|
@@ -44,6 +49,6 @@ export interface AskUserAnswerFrame {
|
|
|
44
49
|
readonly body: string;
|
|
45
50
|
}
|
|
46
51
|
export declare function parseAskUserAnswerFrame(text: string): AskUserAnswerFrame | undefined;
|
|
47
|
-
export declare function formatResultDetails(variant: AskUserVariant, response: QuestionResponse, requestId: string, questions?: Questions): CodexResultDetails | ClaudeResultDetails;
|
|
52
|
+
export declare function formatResultDetails(variant: AskUserVariant, response: QuestionResponse, requestId: string, questions?: Questions, required?: boolean): CodexResultDetails | ClaudeResultDetails;
|
|
48
53
|
export {};
|
|
49
54
|
//# sourceMappingURL=format.d.ts.map
|
|
@@ -44,7 +44,35 @@ function answeredLines(response, questions, words) {
|
|
|
44
44
|
}
|
|
45
45
|
return lines;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
const GATED_NO_ANSWER = "No answer: do not take the action it gates. Keep that action pending and end the turn.";
|
|
48
|
+
/** A required question gates an action, so every settlement without an answer refuses that action (senpi#2949). */
|
|
49
|
+
function formatGatedNoAnswer(response, questions, words, cancellationReason) {
|
|
50
|
+
const reason = cancellationReason ??
|
|
51
|
+
(response.status === "timed_out"
|
|
52
|
+
? `The user did not answer within ${Math.round((response.autoResolvedAfterMs ?? DEFAULT_ASK_USER_TIMEOUT_MS) / 60_000)} minutes. (사용자가 답변을 안하고 timeout 으로 종료됨)`
|
|
53
|
+
: response.status === "cancelled"
|
|
54
|
+
? "The user dismissed the question."
|
|
55
|
+
: response.status === "orphaned-after-restart"
|
|
56
|
+
? "The pending question could not be resumed after a restart."
|
|
57
|
+
: "This session has no user attached (subagent or headless).");
|
|
58
|
+
const lines = [reason];
|
|
59
|
+
const selected = answeredLines(response, questions, words);
|
|
60
|
+
if (selected.length > 0)
|
|
61
|
+
lines.push(`Before going idle the user had selected (not an answer): ${selected.join("; ")}`);
|
|
62
|
+
lines.push(GATED_NO_ANSWER);
|
|
63
|
+
return lines.join("\n");
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A required question cancelled with a reason (a UI failure): the reason stands in for the status line,
|
|
67
|
+
* a draft the user typed is named and marked not an answer, and the action is refused (senpi#2949).
|
|
68
|
+
*/
|
|
69
|
+
export function formatGatedCancellation(reason, response, requestId, questions) {
|
|
70
|
+
return formatGatedNoAnswer(response, questions, separatedWords(requestId), reason);
|
|
71
|
+
}
|
|
72
|
+
function formatBody(response, questions, words, required = false) {
|
|
73
|
+
if (required && response.status !== "answered" && response.status !== "comment-submitted") {
|
|
74
|
+
return formatGatedNoAnswer(response, questions, words);
|
|
75
|
+
}
|
|
48
76
|
switch (response.status) {
|
|
49
77
|
case "answered": {
|
|
50
78
|
const lines = answeredLines(response, questions, words);
|
|
@@ -85,24 +113,24 @@ function formatBody(response, questions, words) {
|
|
|
85
113
|
}
|
|
86
114
|
}
|
|
87
115
|
/** The answer as a person reads it, with the user's words inline (hooks, the transcript card). */
|
|
88
|
-
export function formatResultText(_variant, response, questions = []) {
|
|
89
|
-
return formatBody(response, questions, INLINE_WORDS);
|
|
116
|
+
export function formatResultText(_variant, response, questions = [], required = false) {
|
|
117
|
+
return formatBody(response, questions, INLINE_WORDS, required);
|
|
90
118
|
}
|
|
91
119
|
/**
|
|
92
120
|
* The answer as the model receives it: `text` holds only the structure and the options the model
|
|
93
121
|
* offered; each of the user's own words is a `words` entry that `text` names by its label.
|
|
94
122
|
*/
|
|
95
|
-
export function formatModelAnswer(response, requestId, questions = []) {
|
|
123
|
+
export function formatModelAnswer(response, requestId, questions = [], required = false) {
|
|
96
124
|
const placement = separatedWords(requestId);
|
|
97
|
-
return { text: formatBody(response, questions, placement), words: placement.words };
|
|
125
|
+
return { text: formatBody(response, questions, placement, required), words: placement.words };
|
|
98
126
|
}
|
|
99
127
|
/**
|
|
100
128
|
* The framed user message for a later answer: the `[Answer to question <id>]` frame with the
|
|
101
129
|
* structure, then each of the user's words after its own label block. An answer with no typed
|
|
102
130
|
* words stays the single framed string it always was.
|
|
103
131
|
*/
|
|
104
|
-
export function formatUserMessage(response, requestId, questions = []) {
|
|
105
|
-
const answer = formatModelAnswer(response, requestId, questions);
|
|
132
|
+
export function formatUserMessage(response, requestId, questions = [], required = false) {
|
|
133
|
+
const answer = formatModelAnswer(response, requestId, questions, required);
|
|
106
134
|
const frame = `[Answer to question ${requestId}]\n${answer.text}`;
|
|
107
135
|
if (answer.words.length === 0)
|
|
108
136
|
return frame;
|
|
@@ -128,8 +156,8 @@ function selectedAnswers(answer) {
|
|
|
128
156
|
const text = answer.text?.trim();
|
|
129
157
|
return text === undefined || text.length === 0 ? [] : [text];
|
|
130
158
|
}
|
|
131
|
-
export function formatResultDetails(variant, response, requestId, questions = []) {
|
|
132
|
-
const { words } = formatModelAnswer(response, requestId, questions);
|
|
159
|
+
export function formatResultDetails(variant, response, requestId, questions = [], required = false) {
|
|
160
|
+
const { words } = formatModelAnswer(response, requestId, questions, required);
|
|
133
161
|
if (variant === "codex") {
|
|
134
162
|
const answers = {};
|
|
135
163
|
for (const [id, answer] of Object.entries(response.answers)) {
|
|
@@ -11,6 +11,7 @@ export declare const CODEX_PARAMS: Type.TObject<{
|
|
|
11
11
|
multiSelect: Type.TOptional<Type.TBoolean>;
|
|
12
12
|
}>>;
|
|
13
13
|
wait_for_answer: Type.TBoolean;
|
|
14
|
+
required: Type.TOptional<Type.TBoolean>;
|
|
14
15
|
}>;
|
|
15
16
|
export declare const CLAUDE_PARAMS: Type.TObject<{
|
|
16
17
|
questions: Type.TArray<Type.TObject<{
|
|
@@ -23,5 +24,6 @@ export declare const CLAUDE_PARAMS: Type.TObject<{
|
|
|
23
24
|
multiSelect: Type.TBoolean;
|
|
24
25
|
}>>;
|
|
25
26
|
waitForAnswer: Type.TBoolean;
|
|
27
|
+
required: Type.TOptional<Type.TBoolean>;
|
|
26
28
|
}>;
|
|
27
29
|
//# sourceMappingURL=params.d.ts.map
|
|
@@ -37,6 +37,9 @@ export const CODEX_PARAMS = Type.Object({
|
|
|
37
37
|
wait_for_answer: Type.Boolean({
|
|
38
38
|
description: "Set true to pause here until the user answers; set false to keep working and receive the answer later as a user message.",
|
|
39
39
|
}),
|
|
40
|
+
required: Type.Optional(Type.Boolean({
|
|
41
|
+
description: "Set true when the answer decides whether you take an action (for example, which of two irreversible paths to take, or whether to proceed): with no answer, that action is not taken.",
|
|
42
|
+
})),
|
|
40
43
|
}, { additionalProperties: false });
|
|
41
44
|
const CLAUDE_OPTION = Type.Object({
|
|
42
45
|
label: Type.String({
|
|
@@ -74,5 +77,8 @@ export const CLAUDE_PARAMS = Type.Object({
|
|
|
74
77
|
waitForAnswer: Type.Boolean({
|
|
75
78
|
description: "Set true to pause here until the user answers; set false to keep working and receive the answer later as a user message.",
|
|
76
79
|
}),
|
|
80
|
+
required: Type.Optional(Type.Boolean({
|
|
81
|
+
description: "Set true when the answer decides whether you take an action (for example, which of two irreversible paths to take, or whether to proceed): with no answer, that action is not taken.",
|
|
82
|
+
})),
|
|
77
83
|
});
|
|
78
84
|
//# sourceMappingURL=params.js.map
|
|
@@ -92,7 +92,14 @@ function requestFromCall(dangling, timeoutMs) {
|
|
|
92
92
|
* model learns it was lost and can ask again.
|
|
93
93
|
*/
|
|
94
94
|
function settleUnrestorable(pi, ctx, dangling, timeoutMs) {
|
|
95
|
-
const
|
|
95
|
+
const required = isRecord(dangling.args) && dangling.args.required === true;
|
|
96
|
+
const lost = {
|
|
97
|
+
requestId: dangling.toolCallId,
|
|
98
|
+
questions: [],
|
|
99
|
+
waitForAnswer: false,
|
|
100
|
+
timeoutMs,
|
|
101
|
+
...(required ? { required: true } : {}),
|
|
102
|
+
};
|
|
96
103
|
const response = { status: "orphaned-after-restart", answers: {}, unanswered: [] };
|
|
97
104
|
pi.appendEntry(ASK_USER_SETTLEMENT_ENTRY, { requestId: lost.requestId, status: response.status });
|
|
98
105
|
emitAskUserClosed(pi, lost.requestId, response);
|
|
@@ -88,6 +88,9 @@ export function toCanonical(variant, args, options) {
|
|
|
88
88
|
if (!isRecord(args))
|
|
89
89
|
throw new AskUserSchemaError(WAIT_FLAG_STEER_TEXT);
|
|
90
90
|
const waitForAnswer = readWaitFlag(variant, args);
|
|
91
|
+
if (args.required !== undefined && typeof args.required !== "boolean") {
|
|
92
|
+
throw new AskUserSchemaError("required must be a boolean when present");
|
|
93
|
+
}
|
|
91
94
|
const limits = LIMITS[variant];
|
|
92
95
|
if (!Array.isArray(args.questions) || args.questions.length < 1 || args.questions.length > limits.maxQuestions) {
|
|
93
96
|
throw new AskUserSchemaError(`questions must contain 1 to ${limits.maxQuestions} items`);
|
|
@@ -97,6 +100,7 @@ export function toCanonical(variant, args, options) {
|
|
|
97
100
|
questions: args.questions.map((question, index) => parseQuestion(variant, question, index)),
|
|
98
101
|
waitForAnswer,
|
|
99
102
|
timeoutMs: options?.timeoutMs ?? DEFAULT_ASK_USER_TIMEOUT_MS,
|
|
103
|
+
...(args.required === true ? { required: true } : {}),
|
|
100
104
|
};
|
|
101
105
|
}
|
|
102
106
|
//# sourceMappingURL=schema.js.map
|