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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/bundle/chunks/{chunk-Q4RJ4WLE.js → chunk-225TDKTA.js} +4 -4
  3. package/dist/bundle/chunks/{chunk-QSU2456D.js → chunk-3KR3CDGM.js} +1 -1
  4. package/dist/bundle/chunks/{chunk-AOTHPTMU.js → chunk-5GCZFK4X.js} +2 -2
  5. package/dist/bundle/chunks/{chunk-BMADOJHZ.js → chunk-5QIFH624.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-THYIV26N.js → chunk-GQEXLLWJ.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-3RILB2OD.js → chunk-OJOPOUAY.js} +9 -9
  8. package/dist/bundle/chunks/{chunk-64FJ4QQJ.js → chunk-PPCAJQDJ.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-74HCKLRH.js → chunk-TEXE4HT6.js} +1 -1
  10. package/dist/bundle/chunks/{chunk-RRFDLGX6.js → chunk-TNYFCGI7.js} +156 -156
  11. package/dist/bundle/chunks/{cli-main-GNQY2LTU.js → cli-main-CV3ODX4A.js} +1 -1
  12. package/dist/bundle/chunks/{hand-entry-D3DNH6XL.js → hand-entry-2NN7ZTY6.js} +1 -1
  13. package/dist/bundle/chunks/{interactive-mode-ATBPY4M5.js → interactive-mode-TGHZWM2T.js} +1 -1
  14. package/dist/bundle/chunks/{main-OMFVSMUR.js → main-B7WEY4JW.js} +1 -1
  15. package/dist/bundle/chunks/{multi-session-host-ACQ5N4UB.js → multi-session-host-53YLL2OD.js} +1 -1
  16. package/dist/bundle/chunks/{package-manager-cli-2VMRV4HL.js → package-manager-cli-2U54AVKW.js} +1 -1
  17. package/dist/bundle/chunks/{role-BTH5PVME.js → role-4IXZZAL4.js} +1 -1
  18. package/dist/bundle/chunks/{rpc-mode-XUK5SYKH.js → rpc-mode-RRYXENML.js} +1 -1
  19. package/dist/bundle/chunks/{runtime-session-VO3X4OE3.js → runtime-session-KKHEYZOH.js} +1 -1
  20. package/dist/bundle/chunks/{session-control-endpoint-Y5EIFFPY.js → session-control-endpoint-HVULSIUR.js} +1 -1
  21. package/dist/bundle/chunks/session-worker.js +331 -331
  22. package/dist/bundle/cli.js +2 -2
  23. package/dist/bundle/index.js +1 -1
  24. package/dist/bundle/rpc-entry.js +1 -1
  25. package/dist/bundle/runtime-manifest.json +1 -1
  26. package/dist/core/agent-session.d.ts +6 -0
  27. package/dist/core/agent-session.js +34 -3
  28. package/dist/core/extensions/builtin/anthropic-subscription/auth-lane.d.ts +2 -0
  29. package/dist/core/extensions/builtin/anthropic-subscription/auth-lane.js +1 -0
  30. package/dist/core/extensions/builtin/anthropic-subscription/failover.d.ts +2 -0
  31. package/dist/core/extensions/builtin/anthropic-subscription/failover.js +22 -4
  32. package/dist/core/extensions/builtin/anthropic-subscription/index.js +7 -2
  33. package/dist/core/extensions/builtin/anthropic-subscription/limit-recheck.d.ts +15 -0
  34. package/dist/core/extensions/builtin/anthropic-subscription/limit-recheck.js +55 -0
  35. package/dist/core/extensions/builtin/anthropic-subscription/session-stream.d.ts +1 -0
  36. package/dist/core/extensions/builtin/anthropic-subscription/session-stream.js +1 -0
  37. package/dist/core/extensions/builtin/anthropic-subscription/stream-guidance.js +8 -5
  38. package/dist/core/extensions/builtin/anthropic-subscription/stream.d.ts +1 -1
  39. package/dist/core/extensions/builtin/anthropic-subscription/stream.js +3 -1
  40. package/dist/core/extensions/builtin/terminal/extension-state.js +15 -0
  41. package/dist/core/extensions/builtin/terminal/notify.d.ts +2 -1
  42. package/dist/core/extensions/builtin/terminal/notify.js +15 -6
  43. package/dist/core/extensions/builtin/terminal/session-bundle.d.ts +5 -1
  44. package/dist/core/extensions/builtin/terminal/session-bundle.js +41 -1
  45. package/dist/core/extensions/builtin/terminal/tools/context.d.ts +4 -0
  46. package/dist/core/extensions/loader.js +5 -0
  47. package/dist/core/extensions/runner.d.ts +1 -0
  48. package/dist/core/extensions/runner.js +5 -0
  49. package/dist/core/extensions/types.d.ts +7 -0
  50. package/dist/core/run-background-jobs.d.ts +33 -0
  51. package/dist/core/run-background-jobs.js +47 -0
  52. package/dist/core/tools/bash-core.d.ts +50 -0
  53. package/dist/core/tools/bash-core.js +169 -0
  54. package/dist/core/tools/bash-schema.d.ts +48 -0
  55. package/dist/core/tools/bash-schema.js +34 -0
  56. package/dist/core/tools/bash.d.ts +4 -70
  57. package/dist/core/tools/bash.js +32 -409
  58. package/dist/core/tools/coding-tools-core.d.ts +24 -0
  59. package/dist/core/tools/coding-tools-core.js +14 -0
  60. package/dist/core/tools/edit-core.d.ts +56 -0
  61. package/dist/core/tools/edit-core.js +175 -0
  62. package/dist/core/tools/edit-diff.d.ts +0 -5
  63. package/dist/core/tools/edit-diff.js +0 -32
  64. package/dist/core/tools/edit-preview.d.ts +7 -0
  65. package/dist/core/tools/edit-preview.js +34 -0
  66. package/dist/core/tools/edit.d.ts +5 -43
  67. package/dist/core/tools/edit.js +10 -158
  68. package/dist/core/tools/encoding.d.ts +10 -0
  69. package/dist/core/tools/encoding.js +58 -0
  70. package/dist/core/tools/file-tool-host.d.ts +25 -0
  71. package/dist/core/tools/file-tool-host.js +109 -0
  72. package/dist/core/tools/fs-error-code.d.ts +2 -0
  73. package/dist/core/tools/fs-error-code.js +15 -0
  74. package/dist/core/tools/machine-output-spill.d.ts +11 -0
  75. package/dist/core/tools/machine-output-spill.js +65 -0
  76. package/dist/core/tools/machine.d.ts +4 -24
  77. package/dist/core/tools/machine.js +4 -44
  78. package/dist/core/tools/output-accumulator-core.d.ts +84 -0
  79. package/dist/core/tools/output-accumulator-core.js +200 -0
  80. package/dist/core/tools/output-accumulator.d.ts +9 -61
  81. package/dist/core/tools/output-accumulator.js +90 -265
  82. package/dist/core/tools/path-utils.js +3 -48
  83. package/dist/core/tools/posix-signals.d.ts +3 -0
  84. package/dist/core/tools/posix-signals.js +113 -0
  85. package/dist/core/tools/read-core.d.ts +64 -0
  86. package/dist/core/tools/read-core.js +180 -0
  87. package/dist/core/tools/read-text.d.ts +23 -0
  88. package/dist/core/tools/read-text.js +90 -0
  89. package/dist/core/tools/read.d.ts +6 -47
  90. package/dist/core/tools/read.js +13 -218
  91. package/dist/core/tools/renderers/bash.d.ts +0 -1
  92. package/dist/core/tools/renderers/bash.js +0 -1
  93. package/dist/core/tools/renderers/edit.d.ts +1 -1
  94. package/dist/core/tools/renderers/edit.js +1 -1
  95. package/dist/core/tools/secret-output-redactor.js +2 -1
  96. package/dist/core/tools/shell-operations.d.ts +53 -0
  97. package/dist/core/tools/shell-operations.js +115 -0
  98. package/dist/core/tools/shell-output.d.ts +20 -0
  99. package/dist/core/tools/shell-output.js +152 -0
  100. package/dist/core/tools/tail-window.js +5 -7
  101. package/dist/core/tools/tool-machine.d.ts +30 -0
  102. package/dist/core/tools/tool-machine.js +47 -0
  103. package/dist/core/tools/truncate.js +15 -14
  104. package/dist/core/tools/write-core.d.ts +47 -0
  105. package/dist/core/tools/write-core.js +108 -0
  106. package/dist/core/tools/write-result.d.ts +0 -1
  107. package/dist/core/tools/write-result.js +0 -13
  108. package/dist/core/tools/write.d.ts +6 -31
  109. package/dist/core/tools/write.js +25 -77
  110. package/dist/core/turn-origin.d.ts +4 -2
  111. package/dist/core/turn-origin.js +15 -8
  112. package/dist/modes/interactive/session-control-session-commands.js +1 -1
  113. package/dist/modes/rpc/connection-handler.js +2 -2
  114. package/dist/modes/rpc/effect-commands.d.ts +1 -4
  115. package/dist/modes/rpc/method-classes-schema-session.d.ts +1 -0
  116. package/dist/modes/rpc/method-classes-schema-session.js +5 -1
  117. package/dist/modes/rpc/method-classes-schema.d.ts +1 -0
  118. package/dist/modes/rpc/pause-command-validation.js +2 -0
  119. package/dist/modes/rpc/rpc-mutation-response-types.d.ts +2 -4
  120. package/dist/modes/rpc/rpc-session-command-types.d.ts +1 -0
  121. package/dist/modes/rpc/session-control-actions-data.d.ts +7 -3
  122. package/dist/modes/rpc/session-control-actions-data.js +12 -6
  123. package/dist/tools-core.d.ts +14 -0
  124. package/dist/tools-core.js +9 -0
  125. package/dist/utils/image-mime.d.ts +4 -0
  126. package/dist/utils/image-mime.js +99 -0
  127. package/dist/utils/mime.d.ts +1 -1
  128. package/dist/utils/mime.js +2 -97
  129. package/docs/extensions.md +7 -1
  130. package/docs/rpc.md +14 -0
  131. package/package.json +11 -7
  132. package/vendor/senpi-machine-ops/files/local-files.js +34 -5
@@ -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
- import{dispatchAgentDirectoryCommand,enableStartupCompileCache}from"./chunks/chunk-QSU2456D.js";import"./chunks/chunk-THYIV26N.js";import{getLatestPiRelease,isNewerPackageVersion,processBunRuntimeOptions,resolveBunReexec}from"./chunks/chunk-QVG5SUSV.js";import{captureStdout,exitAfterOutput,hasInheritedInspectorOption,printThenExit,releaseInheritedInspectorForChild}from"./chunks/chunk-74HCKLRH.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-ZFIC2DZV.js";import"./chunks/chunk-2SOVDETB.js";import{preparePrivateFdSpawn,runtimeExecArgv,spawnWithPrivateFds}from"./chunks/chunk-LJFQYCFH.js";import{releaseInheritedStartupFillers}from"./chunks/chunk-K3GAGIPX.js";import{HOST_STARTUP_EVENTS_ENV}from"./chunks/chunk-RUGTHELO.js";import{isFifoMode}from"./chunks/chunk-42XRJQM6.js";import"./chunks/chunk-IHES3JES.js";import"./chunks/chunk-5XHOHZIR.js";import"./chunks/chunk-HW6AAS3R.js";import{APP_NAME,DISPLAY_VERSION,PACKAGE_NAME,RUNTIME_SNAPSHOT_MARKER,VERSION,brandProfile,findNodePackageDir,getAgentDir,getInstallPackageDir,getSelfUpdateCommand,getSelfUpdateUnavailableInstruction,isBundledNode,readRuntimeSnapshotMarker}from"./chunks/chunk-SODMQEHO.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-FQXWKEVK.js";import"./chunks/chunk-IKOFCODM.js";releaseInheritedStartupFillers(process.env);import{spawn as spawn2,spawnSync}from"node:child_process";import{existsSync as existsSync3,fstatSync,realpathSync as realpathSync5}from"node:fs";import{dirname as dirname4,join as join8}from"node:path";import{fileURLToPath}from"node:url";async function dispatchKillGuardCommand(args2){if(args2[0]!=="__kill-guard")return;let{runKillGuardCheckCommand}=await import("./chunks/check-command-KGFICS6A.js");process.exit(runKillGuardCheckCommand())}import{createHash}from"node:crypto";import{readFileSync as readFileSync5,realpathSync as realpathSync4}from"node:fs";import{basename as basename2,dirname as dirname3,join as join6,relative}from"node:path";import{pathToFileURL}from"node:url";import{existsSync as existsSync2,readFileSync as readFileSync3,realpathSync as realpathSync3,renameSync,rmSync,writeFileSync}from"node:fs";import{basename,dirname as dirname2,join as join4}from"node:path";import{existsSync,readFileSync}from"node:fs";import{join}from"node:path";var INERT_TREE=/^(?:tests?|__tests__|__fixtures__|fixtures|docs?|examples?|bench(?:marks?)?)$/,ROOT_NOTES=/^(?:readme|changelog|history)(?:\.[^/]*)?$/i,ROOT_MARKDOWN=/^[^/]+\.md$/i,LICENSE=/^licen[cs]e(?:\.[^/]*)?$/i;function dependencyFileExclusions(packageDir){let manifest=JSON.parse(readFileSync(join(packageDir,"package.json"),"utf8"));if(typeof manifest!="object"||manifest===null)return()=>!1;let entryRoots=new Set,built=!1,visit=value=>{if(typeof value=="string"){let entry=value.replace(/^\.\//,"");entryRoots.add(entry.split("/")[0]??""),/\.[cm]?js$/.test(entry)&&existsSync(join(packageDir,entry))&&(built=!0)}else if(Array.isArray(value))for(let child of value)visit(child);else if(typeof value=="object"&&value!==null)for(let[condition,child]of Object.entries(value))condition!=="types"&&visit(child)};for(let[key,value]of Object.entries(manifest))["main","module","exports","bin","pi"].includes(key)&&visit(value);return path=>{let root=path.split("/")[0]??"";return entryRoots.has(root)||entryRoots.has("*")||entryRoots.has("**")?!1:INERT_TREE.test(root)||ROOT_NOTES.test(path)||ROOT_MARKDOWN.test(path)&&!LICENSE.test(path)?!0:built&&root==="src"&&/\.[cm]?tsx?$/.test(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))}import{mkdirSync as mkdirSync2,readdirSync as readdirSync2,readFileSync as readFileSync2,realpathSync as realpathSync2,statSync as statSync2}from"node:fs";import{dirname,join as join3}from"node:path";import{mkdirSync,readdirSync,realpathSync,statSync}from"node:fs";import{join as join2}from"node:path";var 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,excluded=()=>!1,relativeDir=""){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 relativePath=relativeDir===""?entry.name:`${relativeDir}/${entry.name}`;if(excluded(relativePath))continue;let from=join2(real,entry.name),to=join2(target,entry.name);if(entry.isDirectory())planTree(from,to,files,skipModules,seen,excluded,relativePath);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,excluded,relativePath):UNLOADED_FILE.test(entry.name)||files.push([realpathSync(from),to])}}seen.delete(real)}}var ALWAYS_SHIPPED=/^(?:package\.json|readme(?:\..*)?|licen[cs]e(?:\..*)?)$/i;function globToRegExp(glob){let source="";for(let index=0;index<glob.length;index++){let char=glob[index];glob.startsWith("**/",index)?(source+="(?:.*/)?",index+=2):glob.startsWith("**",index)?(source+=".*",index+=1):char==="*"?source+="[^/]*":char==="?"?source+="[^/]":source+=char.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${source}(?:/.*)?$`)}function shippedEntries(packageDir){let manifest=JSON.parse(readFileSync2(join3(packageDir,"package.json"),"utf8")),listed=typeof manifest=="object"&&manifest!==null?manifest.files:void 0;if(!Array.isArray(listed)||!listed.every(entry=>typeof entry=="string"))return;let normalize=entry=>entry.replace(/^\.\//,"").replace(/\/+$/,"");return{include:listed.filter(entry=>!entry.startsWith("!")).map(normalize),exclude:listed.filter(entry=>entry.startsWith("!")).map(entry=>globToRegExp(normalize(entry.slice(1))))}}function planPackageRoot(packageDir,target,files){let shipped=shippedEntries(packageDir);if(shipped===void 0){planTree(packageDir,target,files,!0);return}let root=realpathSync2(packageDir),excluded=relativePath=>shipped.exclude.some(pattern=>pattern.test(relativePath)),planned=new Set,plan=relativePath=>{if(planned.has(relativePath)||excluded(relativePath))return;let from=join3(root,relativePath),isDirectory;try{isDirectory=statSync2(from).isDirectory()}catch(error){if(isMissing(error))return;throw error}planned.add(relativePath);let to=join3(target,relativePath);isDirectory?planTree(from,to,files,!0,new Set([root]),excluded,relativePath):UNLOADED_FILE.test(relativePath)||(mkdirSync2(dirname(to),{recursive:!0}),files.push([realpathSync2(from),to]))};mkdirSync2(target,{recursive:!0});let topLevel=readdirSync2(root).filter(name=>name!=="node_modules");for(let name of topLevel)ALWAYS_SHIPPED.test(name)&&plan(name);for(let entry of shipped.include){let segments=entry.split("/"),wildcard=segments.findIndex(segment=>/[*?]/.test(segment));if(wildcard===-1)plan(entry);else if(wildcard>0)plan(segments.slice(0,wildcard).join("/"));else{let pattern=globToRegExp(segments[0]??"");for(let name of topLevel)pattern.test(name)&&plan(name)}}}var RuntimeSnapshotLayoutError=class extends Error{constructor(packageName){super(`runtime snapshot resolves ${packageName} differently from the install`),this.packageName=packageName}},STAGING_PREFIX=".tmp-";function moduleDirectoriesFrom(dir){let directories=[];for(let current=dir;;current=dirname2(current)){if(basename(current)!=="node_modules"){let candidate=join4(current,"node_modules");existsSync2(candidate)&&directories.push(candidate)}if(dirname2(current)===current)return directories}}function packageRootFrom(dir,packageName){for(let modules of moduleDirectoriesFrom(dir)){let root=join4(modules,packageName);if(existsSync2(join4(root,"package.json")))return realpathSync3(root)}}function dependencyNames(packageDir){let manifest=JSON.parse(readFileSync3(join4(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=[realpathSync3(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=realpathSync3(packageDir),placed=new Map,pending=[],place=(installDir,snapshotDir)=>{planTree(installDir,snapshotDir,files,!0,new Set,dependencyFileExclusions(installDir)),placed.set(snapshotDir,installDir),pending.push({installDir,snapshotDir})},resolvePlaced=(from,name)=>{for(let dir=from;;dir=dirname2(dir)){if(basename(dir)!=="node_modules"){let found=placed.get(join4(dir,"node_modules",name));if(found!==void 0)return found}if(dir===snapshotRoot||dirname2(dir)===dir)return}};for(let name of closureNames(packageDir,externals)){let source=packageRootFrom(packageDir,name);source!==void 0&&source!==self&&place(source,join4(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,join4(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=>join4(modules,name)).find(root=>existsSync2(join4(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=join4(dirname2(target),`${STAGING_PREFIX}${basename(target)}-${process.pid}`);rmSync(staging,{recursive:!0,force:!0});try{let files=[];planPackageRoot(packageDir,staging,files);let placed=planModules(packageDir,staging,manifest.externals,files);await copyFiles(files,copier),verifyExternals(packageDir,join4(staging,"dist","bundle","chunks"),manifest.externals,placed);let marker={buildId:manifest.buildId,installPackageDir:realpathSync3(packageDir)};writeFileSync(join4(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 mkdirSync3,readdirSync as readdirSync3,readFileSync as readFileSync4,renameSync as renameSync2,rmSync as rmSync2,statSync as statSync3,unlinkSync,utimesSync,writeFileSync as writeFileSync2}from"node:fs";import{join as join5}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-statSync3(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){mkdirSync3(root,{recursive:!0});let lock=join5(root,LOCK_NAME),deadline=Date.now()+LOCK_WAIT_MS;for(;;){try{mkdirSync3(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(readFileSync4(join5(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){mkdirSync3(root,{recursive:!0});let lock=join5(root,`${BUILD_LOCK_PREFIX}${id}`),deadline=Date.now()+BUILD_WAIT_MS;for(;;){try{mkdirSync3(lock),writeFileSync2(join5(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 readdirSync3(root))name.startsWith(`${STAGING_PREFIX}${id}-`)&&rmSync2(join5(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){mkdirSync3(join5(snapshotDir,CLAIMS_DIR),{recursive:!0}),writeFileSync2(join5(snapshotDir,CLAIMS_DIR,String(pid)),"");let now=new Date;utimesSync(join5(snapshotDir,RUNTIME_SNAPSHOT_MARKER),now,now)}function reapClaims(snapshotDir,isAlive){let names;try{names=readdirSync3(join5(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(join5(snapshotDir,CLAIMS_DIR,name))}return live}function pruneRuntimeSnapshots(root,keep,now,isAlive=isProcessAlive){reapClaims(join5(root,keep),isAlive);for(let name of readdirSync3(root)){if(name===LOCK_NAME||name===keep)continue;let path=join5(root,name);if(name.startsWith(".")){ageMs(path,now)>LEFTOVER_MS&&rmSync2(path,{recursive:!0,force:!0});continue}if(reapClaims(path,isAlive)>0||ageMs(join5(path,RUNTIME_SNAPSHOT_MARKER),now)<=UNUSED_SNAPSHOT_GRACE_MS)continue;let trash=join5(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(readFileSync5(join6(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=dirname3(entryPath),runtimeRoot=join6(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)!==join6("dist","bundle"))return{kind:"run-here"};let installId=createHash("sha256").update(realpathSync4(packageDir)).digest("hex").slice(0,12),snapshotId=`${manifest.buildId}-${installId}`,snapshotDir=join6(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(join6(snapshotDir,"dist","bundle",basename2(entryPath))).href,snapshotDir}}catch{return{kind:"run-here"}}}import{spawn}from"node:child_process";import{readFileSync as readFileSync6}from"node:fs";import{join as join7}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(readFileSync6(join7(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",windowsHide:!0});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 reexecStdio(){let base=channelStdio();if(!process.env[HOST_STARTUP_EVENTS_ENV])return base;try{let stat=fstatSync(16);if(!stat.isSocket()&&!isFifoMode(stat.mode))return base}catch{return base}let slots=typeof base=="string"?[base,base,base]:[...base];for(;slots.length<16;)slots.push("ignore");return slots[16]=16,slots}function channelStdio(){let argv=process.argv.slice(2),presenter=argv.indexOf("--mcp-presenter-fd");if(presenter<0||argv[presenter+1]!=="4")return"inherit";try{let stat=fstatSync(4);if(!stat.isSocket()&&!stat.isFIFO())return"inherit"}catch{return"inherit"}let owner=argv.indexOf("--owner-fd");return["inherit","inherit","inherit",owner>=0&&argv[owner+1]==="3"||process.env.SENPI_RPC_HOST_WATCH_FD==="3"?3:"ignore",4]}function reexecUnderBunIfNeeded(){let options=processBunRuntimeOptions(existsSync3,realpathSync5),scriptRealPath=process.argv[1]??fileURLToPath(import.meta.url);try{scriptRealPath=realpathSync5(scriptRealPath)}catch{}let decision=resolveBunReexec({scriptRealPath,versions:process.versions,hasInheritedInspectorOption:hasInheritedInspectorOption(),options});if(decision.action==="stay")return!1;let transfer=preparePrivateFdSpawn({stdio:reexecStdio(),windowsHide:!0}),result=(()=>{try{return spawnSync(decision.bunPath,[scriptRealPath,...process.argv.slice(2)],transfer.options)}finally{transfer.close()}})();return result.signal?(process.kill(process.pid,result.signal),!0):(process.exitCode=result.status??1,!0)}await dispatchKillGuardCommand(process.argv.slice(2));reexecUnderBunIfNeeded()&&process.exit();var args=process.argv.slice(2);await dispatchAgentDirectoryCommand(args);await enableStartupCompileCache();process.title=APP_NAME;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});var 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=>!existsSync3(join8(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:runtimeExecArgv().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={...process.env,[ISOLATED_CHILD_ENV]:"1"};return await new Promise((resolve,reject)=>{let child=spawnWithPrivateFds(spawn2,process.execPath,[...runtimeExecArgv(),fullCliPath,...args],{env:childEnvironment,stdio:reexecStdio()});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-JWHUCE4E.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(dirname4(entryPath)),getAgentDir()):void 0;snapshot?.kind==="hand-off"?await import(__rewriteRelativeImportExtension(snapshot.entryUrl)):await import("./chunks/cli-main-GNQY2LTU.js")}
3
+ import{dispatchAgentDirectoryCommand,enableStartupCompileCache}from"./chunks/chunk-3KR3CDGM.js";import"./chunks/chunk-GQEXLLWJ.js";import{getLatestPiRelease,isNewerPackageVersion,processBunRuntimeOptions,resolveBunReexec}from"./chunks/chunk-QVG5SUSV.js";import{captureStdout,exitAfterOutput,hasInheritedInspectorOption,printThenExit,releaseInheritedInspectorForChild}from"./chunks/chunk-TEXE4HT6.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-ZFIC2DZV.js";import"./chunks/chunk-2SOVDETB.js";import{preparePrivateFdSpawn,runtimeExecArgv,spawnWithPrivateFds}from"./chunks/chunk-LJFQYCFH.js";import{releaseInheritedStartupFillers}from"./chunks/chunk-K3GAGIPX.js";import{HOST_STARTUP_EVENTS_ENV}from"./chunks/chunk-RUGTHELO.js";import{isFifoMode}from"./chunks/chunk-42XRJQM6.js";import"./chunks/chunk-IHES3JES.js";import"./chunks/chunk-5XHOHZIR.js";import"./chunks/chunk-HW6AAS3R.js";import{APP_NAME,DISPLAY_VERSION,PACKAGE_NAME,RUNTIME_SNAPSHOT_MARKER,VERSION,brandProfile,findNodePackageDir,getAgentDir,getInstallPackageDir,getSelfUpdateCommand,getSelfUpdateUnavailableInstruction,isBundledNode,readRuntimeSnapshotMarker}from"./chunks/chunk-SODMQEHO.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-FQXWKEVK.js";import"./chunks/chunk-IKOFCODM.js";releaseInheritedStartupFillers(process.env);import{spawn as spawn2,spawnSync}from"node:child_process";import{existsSync as existsSync3,fstatSync,realpathSync as realpathSync5}from"node:fs";import{dirname as dirname4,join as join8}from"node:path";import{fileURLToPath}from"node:url";async function dispatchKillGuardCommand(args2){if(args2[0]!=="__kill-guard")return;let{runKillGuardCheckCommand}=await import("./chunks/check-command-KGFICS6A.js");process.exit(runKillGuardCheckCommand())}import{createHash}from"node:crypto";import{readFileSync as readFileSync5,realpathSync as realpathSync4}from"node:fs";import{basename as basename2,dirname as dirname3,join as join6,relative}from"node:path";import{pathToFileURL}from"node:url";import{existsSync as existsSync2,readFileSync as readFileSync3,realpathSync as realpathSync3,renameSync,rmSync,writeFileSync}from"node:fs";import{basename,dirname as dirname2,join as join4}from"node:path";import{existsSync,readFileSync}from"node:fs";import{join}from"node:path";var INERT_TREE=/^(?:tests?|__tests__|__fixtures__|fixtures|docs?|examples?|bench(?:marks?)?)$/,ROOT_NOTES=/^(?:readme|changelog|history)(?:\.[^/]*)?$/i,ROOT_MARKDOWN=/^[^/]+\.md$/i,LICENSE=/^licen[cs]e(?:\.[^/]*)?$/i;function dependencyFileExclusions(packageDir){let manifest=JSON.parse(readFileSync(join(packageDir,"package.json"),"utf8"));if(typeof manifest!="object"||manifest===null)return()=>!1;let entryRoots=new Set,built=!1,visit=value=>{if(typeof value=="string"){let entry=value.replace(/^\.\//,"");entryRoots.add(entry.split("/")[0]??""),/\.[cm]?js$/.test(entry)&&existsSync(join(packageDir,entry))&&(built=!0)}else if(Array.isArray(value))for(let child of value)visit(child);else if(typeof value=="object"&&value!==null)for(let[condition,child]of Object.entries(value))condition!=="types"&&visit(child)};for(let[key,value]of Object.entries(manifest))["main","module","exports","bin","pi"].includes(key)&&visit(value);return path=>{let root=path.split("/")[0]??"";return entryRoots.has(root)||entryRoots.has("*")||entryRoots.has("**")?!1:INERT_TREE.test(root)||ROOT_NOTES.test(path)||ROOT_MARKDOWN.test(path)&&!LICENSE.test(path)?!0:built&&root==="src"&&/\.[cm]?tsx?$/.test(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))}import{mkdirSync as mkdirSync2,readdirSync as readdirSync2,readFileSync as readFileSync2,realpathSync as realpathSync2,statSync as statSync2}from"node:fs";import{dirname,join as join3}from"node:path";import{mkdirSync,readdirSync,realpathSync,statSync}from"node:fs";import{join as join2}from"node:path";var 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,excluded=()=>!1,relativeDir=""){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 relativePath=relativeDir===""?entry.name:`${relativeDir}/${entry.name}`;if(excluded(relativePath))continue;let from=join2(real,entry.name),to=join2(target,entry.name);if(entry.isDirectory())planTree(from,to,files,skipModules,seen,excluded,relativePath);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,excluded,relativePath):UNLOADED_FILE.test(entry.name)||files.push([realpathSync(from),to])}}seen.delete(real)}}var ALWAYS_SHIPPED=/^(?:package\.json|readme(?:\..*)?|licen[cs]e(?:\..*)?)$/i;function globToRegExp(glob){let source="";for(let index=0;index<glob.length;index++){let char=glob[index];glob.startsWith("**/",index)?(source+="(?:.*/)?",index+=2):glob.startsWith("**",index)?(source+=".*",index+=1):char==="*"?source+="[^/]*":char==="?"?source+="[^/]":source+=char.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${source}(?:/.*)?$`)}function shippedEntries(packageDir){let manifest=JSON.parse(readFileSync2(join3(packageDir,"package.json"),"utf8")),listed=typeof manifest=="object"&&manifest!==null?manifest.files:void 0;if(!Array.isArray(listed)||!listed.every(entry=>typeof entry=="string"))return;let normalize=entry=>entry.replace(/^\.\//,"").replace(/\/+$/,"");return{include:listed.filter(entry=>!entry.startsWith("!")).map(normalize),exclude:listed.filter(entry=>entry.startsWith("!")).map(entry=>globToRegExp(normalize(entry.slice(1))))}}function planPackageRoot(packageDir,target,files){let shipped=shippedEntries(packageDir);if(shipped===void 0){planTree(packageDir,target,files,!0);return}let root=realpathSync2(packageDir),excluded=relativePath=>shipped.exclude.some(pattern=>pattern.test(relativePath)),planned=new Set,plan=relativePath=>{if(planned.has(relativePath)||excluded(relativePath))return;let from=join3(root,relativePath),isDirectory;try{isDirectory=statSync2(from).isDirectory()}catch(error){if(isMissing(error))return;throw error}planned.add(relativePath);let to=join3(target,relativePath);isDirectory?planTree(from,to,files,!0,new Set([root]),excluded,relativePath):UNLOADED_FILE.test(relativePath)||(mkdirSync2(dirname(to),{recursive:!0}),files.push([realpathSync2(from),to]))};mkdirSync2(target,{recursive:!0});let topLevel=readdirSync2(root).filter(name=>name!=="node_modules");for(let name of topLevel)ALWAYS_SHIPPED.test(name)&&plan(name);for(let entry of shipped.include){let segments=entry.split("/"),wildcard=segments.findIndex(segment=>/[*?]/.test(segment));if(wildcard===-1)plan(entry);else if(wildcard>0)plan(segments.slice(0,wildcard).join("/"));else{let pattern=globToRegExp(segments[0]??"");for(let name of topLevel)pattern.test(name)&&plan(name)}}}var RuntimeSnapshotLayoutError=class extends Error{constructor(packageName){super(`runtime snapshot resolves ${packageName} differently from the install`),this.packageName=packageName}},STAGING_PREFIX=".tmp-";function moduleDirectoriesFrom(dir){let directories=[];for(let current=dir;;current=dirname2(current)){if(basename(current)!=="node_modules"){let candidate=join4(current,"node_modules");existsSync2(candidate)&&directories.push(candidate)}if(dirname2(current)===current)return directories}}function packageRootFrom(dir,packageName){for(let modules of moduleDirectoriesFrom(dir)){let root=join4(modules,packageName);if(existsSync2(join4(root,"package.json")))return realpathSync3(root)}}function dependencyNames(packageDir){let manifest=JSON.parse(readFileSync3(join4(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=[realpathSync3(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=realpathSync3(packageDir),placed=new Map,pending=[],place=(installDir,snapshotDir)=>{planTree(installDir,snapshotDir,files,!0,new Set,dependencyFileExclusions(installDir)),placed.set(snapshotDir,installDir),pending.push({installDir,snapshotDir})},resolvePlaced=(from,name)=>{for(let dir=from;;dir=dirname2(dir)){if(basename(dir)!=="node_modules"){let found=placed.get(join4(dir,"node_modules",name));if(found!==void 0)return found}if(dir===snapshotRoot||dirname2(dir)===dir)return}};for(let name of closureNames(packageDir,externals)){let source=packageRootFrom(packageDir,name);source!==void 0&&source!==self&&place(source,join4(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,join4(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=>join4(modules,name)).find(root=>existsSync2(join4(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=join4(dirname2(target),`${STAGING_PREFIX}${basename(target)}-${process.pid}`);rmSync(staging,{recursive:!0,force:!0});try{let files=[];planPackageRoot(packageDir,staging,files);let placed=planModules(packageDir,staging,manifest.externals,files);await copyFiles(files,copier),verifyExternals(packageDir,join4(staging,"dist","bundle","chunks"),manifest.externals,placed);let marker={buildId:manifest.buildId,installPackageDir:realpathSync3(packageDir)};writeFileSync(join4(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 mkdirSync3,readdirSync as readdirSync3,readFileSync as readFileSync4,renameSync as renameSync2,rmSync as rmSync2,statSync as statSync3,unlinkSync,utimesSync,writeFileSync as writeFileSync2}from"node:fs";import{join as join5}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-statSync3(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){mkdirSync3(root,{recursive:!0});let lock=join5(root,LOCK_NAME),deadline=Date.now()+LOCK_WAIT_MS;for(;;){try{mkdirSync3(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(readFileSync4(join5(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){mkdirSync3(root,{recursive:!0});let lock=join5(root,`${BUILD_LOCK_PREFIX}${id}`),deadline=Date.now()+BUILD_WAIT_MS;for(;;){try{mkdirSync3(lock),writeFileSync2(join5(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 readdirSync3(root))name.startsWith(`${STAGING_PREFIX}${id}-`)&&rmSync2(join5(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){mkdirSync3(join5(snapshotDir,CLAIMS_DIR),{recursive:!0}),writeFileSync2(join5(snapshotDir,CLAIMS_DIR,String(pid)),"");let now=new Date;utimesSync(join5(snapshotDir,RUNTIME_SNAPSHOT_MARKER),now,now)}function reapClaims(snapshotDir,isAlive){let names;try{names=readdirSync3(join5(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(join5(snapshotDir,CLAIMS_DIR,name))}return live}function pruneRuntimeSnapshots(root,keep,now,isAlive=isProcessAlive){reapClaims(join5(root,keep),isAlive);for(let name of readdirSync3(root)){if(name===LOCK_NAME||name===keep)continue;let path=join5(root,name);if(name.startsWith(".")){ageMs(path,now)>LEFTOVER_MS&&rmSync2(path,{recursive:!0,force:!0});continue}if(reapClaims(path,isAlive)>0||ageMs(join5(path,RUNTIME_SNAPSHOT_MARKER),now)<=UNUSED_SNAPSHOT_GRACE_MS)continue;let trash=join5(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(readFileSync5(join6(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=dirname3(entryPath),runtimeRoot=join6(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)!==join6("dist","bundle"))return{kind:"run-here"};let installId=createHash("sha256").update(realpathSync4(packageDir)).digest("hex").slice(0,12),snapshotId=`${manifest.buildId}-${installId}`,snapshotDir=join6(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(join6(snapshotDir,"dist","bundle",basename2(entryPath))).href,snapshotDir}}catch{return{kind:"run-here"}}}import{spawn}from"node:child_process";import{readFileSync as readFileSync6}from"node:fs";import{join as join7}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(readFileSync6(join7(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",windowsHide:!0});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 reexecStdio(){let base=channelStdio();if(!process.env[HOST_STARTUP_EVENTS_ENV])return base;try{let stat=fstatSync(16);if(!stat.isSocket()&&!isFifoMode(stat.mode))return base}catch{return base}let slots=typeof base=="string"?[base,base,base]:[...base];for(;slots.length<16;)slots.push("ignore");return slots[16]=16,slots}function channelStdio(){let argv=process.argv.slice(2),presenter=argv.indexOf("--mcp-presenter-fd");if(presenter<0||argv[presenter+1]!=="4")return"inherit";try{let stat=fstatSync(4);if(!stat.isSocket()&&!stat.isFIFO())return"inherit"}catch{return"inherit"}let owner=argv.indexOf("--owner-fd");return["inherit","inherit","inherit",owner>=0&&argv[owner+1]==="3"||process.env.SENPI_RPC_HOST_WATCH_FD==="3"?3:"ignore",4]}function reexecUnderBunIfNeeded(){let options=processBunRuntimeOptions(existsSync3,realpathSync5),scriptRealPath=process.argv[1]??fileURLToPath(import.meta.url);try{scriptRealPath=realpathSync5(scriptRealPath)}catch{}let decision=resolveBunReexec({scriptRealPath,versions:process.versions,hasInheritedInspectorOption:hasInheritedInspectorOption(),options});if(decision.action==="stay")return!1;let transfer=preparePrivateFdSpawn({stdio:reexecStdio(),windowsHide:!0}),result=(()=>{try{return spawnSync(decision.bunPath,[scriptRealPath,...process.argv.slice(2)],transfer.options)}finally{transfer.close()}})();return result.signal?(process.kill(process.pid,result.signal),!0):(process.exitCode=result.status??1,!0)}await dispatchKillGuardCommand(process.argv.slice(2));reexecUnderBunIfNeeded()&&process.exit();var args=process.argv.slice(2);await dispatchAgentDirectoryCommand(args);await enableStartupCompileCache();process.title=APP_NAME;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});var 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=>!existsSync3(join8(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:runtimeExecArgv().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={...process.env,[ISOLATED_CHILD_ENV]:"1"};return await new Promise((resolve,reject)=>{let child=spawnWithPrivateFds(spawn2,process.execPath,[...runtimeExecArgv(),fullCliPath,...args],{env:childEnvironment,stdio:reexecStdio()});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-JWHUCE4E.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(dirname4(entryPath)),getAgentDir()):void 0;snapshot?.kind==="hand-off"?await import(__rewriteRelativeImportExtension(snapshot.entryUrl)):await import("./chunks/cli-main-CV3ODX4A.js")}
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{AgentSession,AgentSessionRuntime,ArminComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultResourceLoader,DeviceMachineConflictError,DeviceUnavailableError,EVAL_HANDLE_ERROR_CODES,EvalHandleError,ExtensionRunner,FooterComponent,InteractiveMode,JOB_WIDGET_STATE_EVENT,KILL_GUARD_MODULE_URL,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ReservedCustodyKey,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,TextTap,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageSelectorComponent,buildNoticeBox,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,connectWebViewService,convertToPng,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createToolMachine,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,kernelToolsStorage,killGuardProtectedPids,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,parseSkillBlock,prepareBranchEntries,readKillGuardSetting,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-RRFDLGX6.js";import"./chunks/chunk-64FJ4QQJ.js";import{RELOCATION_TOOL_NAMES,SESSION_CONTROL_DELIVERY_TYPE,isSessionControlDeliveryDetails,sessionControlRemoteOriginOf,sessionControlSenderOf}from"./chunks/chunk-Q4RJ4WLE.js";import{RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,UnknownCommandError,isTransportGoneError}from"./chunks/chunk-TPLEPLEB.js";import"./chunks/chunk-75O3CWR5.js";import"./chunks/chunk-WAGFTIT4.js";import"./chunks/chunk-NLYT7BND.js";import{DefaultPackageManager,SessionSelectorComponent,SettingsManager}from"./chunks/chunk-HTWWKJJI.js";import"./chunks/chunk-DEUEMEV3.js";import"./chunks/chunk-XI6THO4F.js";import{CURRENT_SESSION_VERSION,SessionManager,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,getLatestCompactionEntry,migrateSessionEntries,parseSessionEntries,sessionEntryToContextMessages}from"./chunks/chunk-FYVQEZYN.js";import"./chunks/chunk-WMDJMN5W.js";import"./chunks/chunk-GTJJ73DE.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-VD7AKTGP.js";import{AssistantMessageComponent,CustomEditor,ExtensionEditorComponent,REQUIRED_COMPACTION_ERROR_MESSAGE,RequiredCompactionError,UserMessageComponent,copyToClipboard}from"./chunks/chunk-PWA75RQU.js";import"./chunks/chunk-M2VJVJMK.js";import"./chunks/chunk-TQHNFP77.js";import{DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,Theme,findReservedKeywordRuns,findReservedKeywordSpans,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,keyHint,keyText,rawKeyHint}from"./chunks/chunk-5NECOJNK.js";import{SecretInputUnavailableError}from"./chunks/chunk-HKCFMDJN.js";import"./chunks/chunk-A3LGSX7Z.js";import"./chunks/chunk-3QPE75AR.js";import"./chunks/chunk-ULWRGKP2.js";import"./chunks/chunk-4B5JSLLR.js";import"./chunks/chunk-FWIO636S.js";import"./chunks/chunk-MOVB6H22.js";import{registerRpcRemoteSource}from"./chunks/chunk-DLPV4B3R.js";import"./chunks/chunk-VPVD5G32.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-RNLFZ67U.js";import"./chunks/chunk-SOMFLLPD.js";import{readOwnFootprint,readProcessFootprint}from"./chunks/chunk-MTQQ2VQH.js";import{DEFAULT_HOST_LAUNCH_SPEC,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HostLaunchSpecError,PINNED_HOST_CLIENT_CAPABILITIES,TUI_PROBE_TIMEOUT_MS,classifyEndpointLiveness,endpointProbeTimeoutMs,ensureHost,handoffHost,loadHostLaunchSpec,parseHostLaunchSpec,readAllHostStatus,readHostStatus,runHostCommand,runHostRequest}from"./chunks/chunk-WMHESZCU.js";import{GENERATION_HANDOFF_CAPABILITY,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,REQUIRED_HOST_CAPABILITIES,compareEngineOrdinal,decideHostAction,engineBuildIdentity,engineBuildIdentityFrom,gcHostEndpoints,parseHostProtocolInfo,probeHost,stopHost}from"./chunks/chunk-IJXKHJYR.js";import{createSyntheticSourceInfo}from"./chunks/chunk-QMRJYMNH.js";import{listHostEndpoints}from"./chunks/chunk-DZQA5LVN.js";import{parseArgs}from"./chunks/chunk-IEY2SL46.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-4JMGWVRH.js";import"./chunks/chunk-E5O4SP5I.js";import"./chunks/chunk-AT5G5BUI.js";import"./chunks/chunk-7WYJAYHH.js";import"./chunks/chunk-5HMYIYQB.js";import"./chunks/chunk-OSNR3IRD.js";import"./chunks/chunk-UCXBDE6R.js";import{ENDPOINT_REGISTRY_VERSION,createHostDaemonPaths,daemonDirectoryName,shardKey,shardSocketPath,shardSocketPathForKey}from"./chunks/chunk-YI6KRJDC.js";import"./chunks/chunk-VUY4BZDI.js";import"./chunks/chunk-SF4MQDKZ.js";import"./chunks/chunk-Z4PN2MDA.js";import"./chunks/chunk-7BX3JQ7F.js";import"./chunks/chunk-GILDYS3O.js";import"./chunks/chunk-KLAX467B.js";import"./chunks/chunk-C4AHHZ6P.js";import"./chunks/chunk-CEFKVI3E.js";import"./chunks/chunk-HGCQAMC6.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-236TAYFX.js";import"./chunks/chunk-36BLGKRO.js";import"./chunks/chunk-FKX6EWFV.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-EUCZC2RF.js";import"./chunks/chunk-WHQ2QPP5.js";import"./chunks/chunk-RLIY3AUC.js";import"./chunks/chunk-WB4BUHOH.js";import"./chunks/chunk-NJ43NBSP.js";import"./chunks/chunk-KDUJCDLM.js";import{decideKillGuardRequest}from"./chunks/chunk-6APXZK7W.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-6QQL3SKM.js";import"./chunks/chunk-2IKL4F24.js";import"./chunks/chunk-KJR3XXMI.js";import"./chunks/chunk-IYL5E4QQ.js";import"./chunks/chunk-7THM57HH.js";import"./chunks/chunk-AC72EWI5.js";import"./chunks/chunk-RQFD6LG2.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatSize,getJobWidgetState,registerJobWidgetSource,setJobWidgetAuthorResolver,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunks/chunk-3RILB2OD.js";import{sanitizeTerminalLabel,visibleWidth}from"./chunks/chunk-4PMRUR4L.js";import"./chunks/chunk-LPYBKMPT.js";import{activateKillGuardRuntime,activeKillGuardEnvironment,getPowerShellConfig,getShellConfig,releaseKillGuardRuntime,withBundledBunCommands}from"./chunks/chunk-ZJUL5ODW.js";import"./chunks/chunk-7CXLNKEH.js";import"./chunks/chunk-R7J5TEYK.js";import"./chunks/chunk-62OVOJPI.js";import"./chunks/chunk-G7U4BOJP.js";import"./chunks/chunk-IK3S2NDB.js";import"./chunks/chunk-XDEZA6U6.js";import{KILL_GUARD_TAG}from"./chunks/chunk-WOHQJ6JB.js";import"./chunks/chunk-COH5F7QV.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-Y7QPP7BG.js";import"./chunks/chunk-PWTXZXHH.js";import"./chunks/chunk-GVSBCJFI.js";import"./chunks/chunk-QTS2XGPQ.js";import"./chunks/chunk-Z6TEQEZO.js";import"./chunks/chunk-ZG3MNTNX.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-UAOOH2V7.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-OH5TKHW7.js";import"./chunks/chunk-NDNQ23SK.js";import"./chunks/chunk-JGKH3D6W.js";import"./chunks/chunk-3SASTB6Y.js";import"./chunks/chunk-PJ34QVL5.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-QVG5SUSV.js";import"./chunks/chunk-74HCKLRH.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-ZFIC2DZV.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-LJFQYCFH.js";import"./chunks/chunk-K3GAGIPX.js";import"./chunks/chunk-RUGTHELO.js";import"./chunks/chunk-42XRJQM6.js";import"./chunks/chunk-IHES3JES.js";import"./chunks/chunk-5XHOHZIR.js";import"./chunks/chunk-HW6AAS3R.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-SODMQEHO.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-EYSV6A7S.js";import"./chunks/chunk-MIENF2YK.js";import"./chunks/chunk-OXNWERO4.js";import"./chunks/chunk-44BJPS5I.js";import"./chunks/chunk-AOTHPTMU.js";import"./chunks/chunk-O5RYI3IW.js";import"./chunks/chunk-RFFMEA4B.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,DeviceMachineConflictError,DeviceUnavailableError,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,JOB_WIDGET_STATE_EVENT,KILL_GUARD_MODULE_URL,KILL_GUARD_TAG,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,PINNED_HOST_CLIENT_CAPABILITIES,ProjectTrustStore,RELOCATION_TOOL_NAMES,REQUIRED_COMPACTION_ERROR_MESSAGE,REQUIRED_HOST_CAPABILITIES,RequiredCompactionError,ReservedCustodyKey,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SESSION_CONTROL_DELIVERY_TYPE,SecretInputUnavailableError,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,TUI_PROBE_TIMEOUT_MS,TextTap,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UnknownCommandError,UserMessageComponent,UserMessageSelectorComponent,VERSION,VIRTUAL_MODEL_STATE_ENTRY,activateKillGuardRuntime,activeKillGuardEnvironment,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,createToolMachine,createWriteTool,createWriteToolDefinition,daemonDirectoryName,decideHostAction,decideKillGuardRequest,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,endpointProbeTimeoutMs,engineBuildIdentity,engineBuildIdentityFrom,ensureHost,estimateTokens,findCutPoint,findReservedKeywordRuns,findReservedKeywordSpans,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,gcHostEndpoints,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getJobWidgetState,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,killGuardProtectedPids,listHostEndpoints,loadHostLaunchSpec,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseArgs,parseFrontmatter,parseHostLaunchSpec,parseHostProtocolInfo,parseSessionEntries,parseSkillBlock,prepareBranchEntries,probeHost,rawKeyHint,readAllHostStatus,readHostStatus,readKillGuardSetting,readOwnFootprint,readProcessFootprint,readStoredCredential,registerJobWidgetSource,registerReadClassifier,registerRpcRemoteSource,releaseKillGuardRuntime,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runHostCommand,runHostRequest,runPrintMode,runRpcMode,sanitizeTerminalLabel,serializeConversation,sessionControlRemoteOriginOf,sessionControlSenderOf,sessionEntryToContextMessages,setJobWidgetAuthorResolver,shardKey,shardSocketPath,shardSocketPathForKey,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,visibleWidth,withBundledBunCommands,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
2
+ import{AgentSession,AgentSessionRuntime,ArminComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultResourceLoader,DeviceMachineConflictError,DeviceUnavailableError,EVAL_HANDLE_ERROR_CODES,EvalHandleError,ExtensionRunner,FooterComponent,InteractiveMode,JOB_WIDGET_STATE_EVENT,KILL_GUARD_MODULE_URL,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ReservedCustodyKey,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,TextTap,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageSelectorComponent,buildNoticeBox,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,connectWebViewService,convertToPng,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createToolMachine,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,kernelToolsStorage,killGuardProtectedPids,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,parseSkillBlock,prepareBranchEntries,readKillGuardSetting,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-TNYFCGI7.js";import"./chunks/chunk-PPCAJQDJ.js";import{RELOCATION_TOOL_NAMES,SESSION_CONTROL_DELIVERY_TYPE,isSessionControlDeliveryDetails,sessionControlRemoteOriginOf,sessionControlSenderOf}from"./chunks/chunk-225TDKTA.js";import{RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,UnknownCommandError,isTransportGoneError}from"./chunks/chunk-TPLEPLEB.js";import"./chunks/chunk-75O3CWR5.js";import"./chunks/chunk-WAGFTIT4.js";import"./chunks/chunk-NLYT7BND.js";import{DefaultPackageManager,SessionSelectorComponent,SettingsManager}from"./chunks/chunk-HTWWKJJI.js";import"./chunks/chunk-DEUEMEV3.js";import"./chunks/chunk-XI6THO4F.js";import{CURRENT_SESSION_VERSION,SessionManager,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,getLatestCompactionEntry,migrateSessionEntries,parseSessionEntries,sessionEntryToContextMessages}from"./chunks/chunk-FYVQEZYN.js";import"./chunks/chunk-WMDJMN5W.js";import"./chunks/chunk-GTJJ73DE.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-VD7AKTGP.js";import{AssistantMessageComponent,CustomEditor,ExtensionEditorComponent,REQUIRED_COMPACTION_ERROR_MESSAGE,RequiredCompactionError,UserMessageComponent,copyToClipboard}from"./chunks/chunk-PWA75RQU.js";import"./chunks/chunk-M2VJVJMK.js";import"./chunks/chunk-TQHNFP77.js";import{DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,Theme,findReservedKeywordRuns,findReservedKeywordSpans,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,keyHint,keyText,rawKeyHint}from"./chunks/chunk-5NECOJNK.js";import{SecretInputUnavailableError}from"./chunks/chunk-HKCFMDJN.js";import"./chunks/chunk-A3LGSX7Z.js";import"./chunks/chunk-3QPE75AR.js";import"./chunks/chunk-ULWRGKP2.js";import"./chunks/chunk-4B5JSLLR.js";import"./chunks/chunk-FWIO636S.js";import"./chunks/chunk-MOVB6H22.js";import{registerRpcRemoteSource}from"./chunks/chunk-DLPV4B3R.js";import"./chunks/chunk-VPVD5G32.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-RNLFZ67U.js";import"./chunks/chunk-SOMFLLPD.js";import{readOwnFootprint,readProcessFootprint}from"./chunks/chunk-MTQQ2VQH.js";import{DEFAULT_HOST_LAUNCH_SPEC,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HostLaunchSpecError,PINNED_HOST_CLIENT_CAPABILITIES,TUI_PROBE_TIMEOUT_MS,classifyEndpointLiveness,endpointProbeTimeoutMs,ensureHost,handoffHost,loadHostLaunchSpec,parseHostLaunchSpec,readAllHostStatus,readHostStatus,runHostCommand,runHostRequest}from"./chunks/chunk-WMHESZCU.js";import{GENERATION_HANDOFF_CAPABILITY,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,REQUIRED_HOST_CAPABILITIES,compareEngineOrdinal,decideHostAction,engineBuildIdentity,engineBuildIdentityFrom,gcHostEndpoints,parseHostProtocolInfo,probeHost,stopHost}from"./chunks/chunk-IJXKHJYR.js";import{createSyntheticSourceInfo}from"./chunks/chunk-QMRJYMNH.js";import{listHostEndpoints}from"./chunks/chunk-DZQA5LVN.js";import{parseArgs}from"./chunks/chunk-IEY2SL46.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-4JMGWVRH.js";import"./chunks/chunk-E5O4SP5I.js";import"./chunks/chunk-AT5G5BUI.js";import"./chunks/chunk-7WYJAYHH.js";import"./chunks/chunk-5HMYIYQB.js";import"./chunks/chunk-OSNR3IRD.js";import"./chunks/chunk-UCXBDE6R.js";import{ENDPOINT_REGISTRY_VERSION,createHostDaemonPaths,daemonDirectoryName,shardKey,shardSocketPath,shardSocketPathForKey}from"./chunks/chunk-YI6KRJDC.js";import"./chunks/chunk-VUY4BZDI.js";import"./chunks/chunk-SF4MQDKZ.js";import"./chunks/chunk-Z4PN2MDA.js";import"./chunks/chunk-7BX3JQ7F.js";import"./chunks/chunk-GILDYS3O.js";import"./chunks/chunk-KLAX467B.js";import"./chunks/chunk-C4AHHZ6P.js";import"./chunks/chunk-CEFKVI3E.js";import"./chunks/chunk-HGCQAMC6.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-236TAYFX.js";import"./chunks/chunk-36BLGKRO.js";import"./chunks/chunk-FKX6EWFV.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-EUCZC2RF.js";import"./chunks/chunk-WHQ2QPP5.js";import"./chunks/chunk-RLIY3AUC.js";import"./chunks/chunk-WB4BUHOH.js";import"./chunks/chunk-NJ43NBSP.js";import"./chunks/chunk-KDUJCDLM.js";import{decideKillGuardRequest}from"./chunks/chunk-6APXZK7W.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-6QQL3SKM.js";import"./chunks/chunk-2IKL4F24.js";import"./chunks/chunk-KJR3XXMI.js";import"./chunks/chunk-IYL5E4QQ.js";import"./chunks/chunk-7THM57HH.js";import"./chunks/chunk-AC72EWI5.js";import"./chunks/chunk-RQFD6LG2.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatSize,getJobWidgetState,registerJobWidgetSource,setJobWidgetAuthorResolver,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunks/chunk-OJOPOUAY.js";import{sanitizeTerminalLabel,visibleWidth}from"./chunks/chunk-4PMRUR4L.js";import"./chunks/chunk-LPYBKMPT.js";import{activateKillGuardRuntime,activeKillGuardEnvironment,getPowerShellConfig,getShellConfig,releaseKillGuardRuntime,withBundledBunCommands}from"./chunks/chunk-ZJUL5ODW.js";import"./chunks/chunk-7CXLNKEH.js";import"./chunks/chunk-R7J5TEYK.js";import"./chunks/chunk-62OVOJPI.js";import"./chunks/chunk-G7U4BOJP.js";import"./chunks/chunk-IK3S2NDB.js";import"./chunks/chunk-XDEZA6U6.js";import{KILL_GUARD_TAG}from"./chunks/chunk-WOHQJ6JB.js";import"./chunks/chunk-COH5F7QV.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-Y7QPP7BG.js";import"./chunks/chunk-PWTXZXHH.js";import"./chunks/chunk-GVSBCJFI.js";import"./chunks/chunk-QTS2XGPQ.js";import"./chunks/chunk-Z6TEQEZO.js";import"./chunks/chunk-ZG3MNTNX.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-UAOOH2V7.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-OH5TKHW7.js";import"./chunks/chunk-NDNQ23SK.js";import"./chunks/chunk-JGKH3D6W.js";import"./chunks/chunk-3SASTB6Y.js";import"./chunks/chunk-PJ34QVL5.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-QVG5SUSV.js";import"./chunks/chunk-TEXE4HT6.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-ZFIC2DZV.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-LJFQYCFH.js";import"./chunks/chunk-K3GAGIPX.js";import"./chunks/chunk-RUGTHELO.js";import"./chunks/chunk-42XRJQM6.js";import"./chunks/chunk-IHES3JES.js";import"./chunks/chunk-5XHOHZIR.js";import"./chunks/chunk-HW6AAS3R.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-SODMQEHO.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-EYSV6A7S.js";import"./chunks/chunk-MIENF2YK.js";import"./chunks/chunk-OXNWERO4.js";import"./chunks/chunk-44BJPS5I.js";import"./chunks/chunk-5GCZFK4X.js";import"./chunks/chunk-O5RYI3IW.js";import"./chunks/chunk-RFFMEA4B.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,DeviceMachineConflictError,DeviceUnavailableError,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,JOB_WIDGET_STATE_EVENT,KILL_GUARD_MODULE_URL,KILL_GUARD_TAG,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,PINNED_HOST_CLIENT_CAPABILITIES,ProjectTrustStore,RELOCATION_TOOL_NAMES,REQUIRED_COMPACTION_ERROR_MESSAGE,REQUIRED_HOST_CAPABILITIES,RequiredCompactionError,ReservedCustodyKey,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SESSION_CONTROL_DELIVERY_TYPE,SecretInputUnavailableError,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,TUI_PROBE_TIMEOUT_MS,TextTap,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UnknownCommandError,UserMessageComponent,UserMessageSelectorComponent,VERSION,VIRTUAL_MODEL_STATE_ENTRY,activateKillGuardRuntime,activeKillGuardEnvironment,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,createToolMachine,createWriteTool,createWriteToolDefinition,daemonDirectoryName,decideHostAction,decideKillGuardRequest,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,endpointProbeTimeoutMs,engineBuildIdentity,engineBuildIdentityFrom,ensureHost,estimateTokens,findCutPoint,findReservedKeywordRuns,findReservedKeywordSpans,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,gcHostEndpoints,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getJobWidgetState,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,killGuardProtectedPids,listHostEndpoints,loadHostLaunchSpec,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseArgs,parseFrontmatter,parseHostLaunchSpec,parseHostProtocolInfo,parseSessionEntries,parseSkillBlock,prepareBranchEntries,probeHost,rawKeyHint,readAllHostStatus,readHostStatus,readKillGuardSetting,readOwnFootprint,readProcessFootprint,readStoredCredential,registerJobWidgetSource,registerReadClassifier,registerRpcRemoteSource,releaseKillGuardRuntime,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runHostCommand,runHostRequest,runPrintMode,runRpcMode,sanitizeTerminalLabel,serializeConversation,sessionControlRemoteOriginOf,sessionControlSenderOf,sessionEntryToContextMessages,setJobWidgetAuthorResolver,shardKey,shardSocketPath,shardSocketPathForKey,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,visibleWidth,withBundledBunCommands,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
3
- import"./chunks/chunk-THYIV26N.js";import{main}from"./chunks/chunk-RRFDLGX6.js";import"./chunks/chunk-64FJ4QQJ.js";import"./chunks/chunk-Q4RJ4WLE.js";import"./chunks/chunk-TPLEPLEB.js";import"./chunks/chunk-75O3CWR5.js";import"./chunks/chunk-WAGFTIT4.js";import"./chunks/chunk-NLYT7BND.js";import"./chunks/chunk-HTWWKJJI.js";import{configureHttpDispatcher}from"./chunks/chunk-DEUEMEV3.js";import"./chunks/chunk-XI6THO4F.js";import"./chunks/chunk-FYVQEZYN.js";import"./chunks/chunk-WMDJMN5W.js";import"./chunks/chunk-GTJJ73DE.js";import"./chunks/chunk-VD7AKTGP.js";import"./chunks/chunk-PWA75RQU.js";import"./chunks/chunk-M2VJVJMK.js";import"./chunks/chunk-TQHNFP77.js";import"./chunks/chunk-5NECOJNK.js";import"./chunks/chunk-HKCFMDJN.js";import"./chunks/chunk-A3LGSX7Z.js";import"./chunks/chunk-3QPE75AR.js";import"./chunks/chunk-ULWRGKP2.js";import"./chunks/chunk-4B5JSLLR.js";import"./chunks/chunk-FWIO636S.js";import"./chunks/chunk-MOVB6H22.js";import"./chunks/chunk-DLPV4B3R.js";import"./chunks/chunk-VPVD5G32.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-RNLFZ67U.js";import"./chunks/chunk-SOMFLLPD.js";import"./chunks/chunk-MTQQ2VQH.js";import"./chunks/chunk-WMHESZCU.js";import"./chunks/chunk-IJXKHJYR.js";import"./chunks/chunk-QMRJYMNH.js";import"./chunks/chunk-DZQA5LVN.js";import"./chunks/chunk-IEY2SL46.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-4JMGWVRH.js";import"./chunks/chunk-E5O4SP5I.js";import"./chunks/chunk-AT5G5BUI.js";import"./chunks/chunk-7WYJAYHH.js";import"./chunks/chunk-5HMYIYQB.js";import"./chunks/chunk-OSNR3IRD.js";import"./chunks/chunk-UCXBDE6R.js";import"./chunks/chunk-YI6KRJDC.js";import"./chunks/chunk-VUY4BZDI.js";import"./chunks/chunk-SF4MQDKZ.js";import"./chunks/chunk-Z4PN2MDA.js";import"./chunks/chunk-7BX3JQ7F.js";import"./chunks/chunk-GILDYS3O.js";import"./chunks/chunk-KLAX467B.js";import"./chunks/chunk-C4AHHZ6P.js";import"./chunks/chunk-CEFKVI3E.js";import"./chunks/chunk-HGCQAMC6.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-236TAYFX.js";import"./chunks/chunk-36BLGKRO.js";import"./chunks/chunk-FKX6EWFV.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-EUCZC2RF.js";import"./chunks/chunk-WHQ2QPP5.js";import"./chunks/chunk-RLIY3AUC.js";import"./chunks/chunk-WB4BUHOH.js";import"./chunks/chunk-NJ43NBSP.js";import"./chunks/chunk-KDUJCDLM.js";import"./chunks/chunk-6APXZK7W.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-6QQL3SKM.js";import"./chunks/chunk-2IKL4F24.js";import"./chunks/chunk-KJR3XXMI.js";import"./chunks/chunk-IYL5E4QQ.js";import"./chunks/chunk-7THM57HH.js";import"./chunks/chunk-AC72EWI5.js";import"./chunks/chunk-RQFD6LG2.js";import"./chunks/chunk-3RILB2OD.js";import"./chunks/chunk-4PMRUR4L.js";import"./chunks/chunk-LPYBKMPT.js";import"./chunks/chunk-ZJUL5ODW.js";import"./chunks/chunk-7CXLNKEH.js";import"./chunks/chunk-R7J5TEYK.js";import"./chunks/chunk-62OVOJPI.js";import"./chunks/chunk-G7U4BOJP.js";import"./chunks/chunk-IK3S2NDB.js";import"./chunks/chunk-XDEZA6U6.js";import"./chunks/chunk-WOHQJ6JB.js";import"./chunks/chunk-COH5F7QV.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-Y7QPP7BG.js";import"./chunks/chunk-PWTXZXHH.js";import"./chunks/chunk-GVSBCJFI.js";import"./chunks/chunk-QTS2XGPQ.js";import"./chunks/chunk-Z6TEQEZO.js";import"./chunks/chunk-ZG3MNTNX.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-UAOOH2V7.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-OH5TKHW7.js";import"./chunks/chunk-NDNQ23SK.js";import"./chunks/chunk-JGKH3D6W.js";import"./chunks/chunk-3SASTB6Y.js";import"./chunks/chunk-PJ34QVL5.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-QVG5SUSV.js";import"./chunks/chunk-74HCKLRH.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-ZFIC2DZV.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-LJFQYCFH.js";import"./chunks/chunk-K3GAGIPX.js";import"./chunks/chunk-RUGTHELO.js";import"./chunks/chunk-42XRJQM6.js";import"./chunks/chunk-IHES3JES.js";import"./chunks/chunk-5XHOHZIR.js";import"./chunks/chunk-HW6AAS3R.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-SODMQEHO.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-EYSV6A7S.js";import"./chunks/chunk-MIENF2YK.js";import"./chunks/chunk-FQXWKEVK.js";import"./chunks/chunk-OXNWERO4.js";import"./chunks/chunk-44BJPS5I.js";import"./chunks/chunk-AOTHPTMU.js";import"./chunks/chunk-O5RYI3IW.js";import"./chunks/chunk-RFFMEA4B.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)]);
3
+ import"./chunks/chunk-GQEXLLWJ.js";import{main}from"./chunks/chunk-TNYFCGI7.js";import"./chunks/chunk-PPCAJQDJ.js";import"./chunks/chunk-225TDKTA.js";import"./chunks/chunk-TPLEPLEB.js";import"./chunks/chunk-75O3CWR5.js";import"./chunks/chunk-WAGFTIT4.js";import"./chunks/chunk-NLYT7BND.js";import"./chunks/chunk-HTWWKJJI.js";import{configureHttpDispatcher}from"./chunks/chunk-DEUEMEV3.js";import"./chunks/chunk-XI6THO4F.js";import"./chunks/chunk-FYVQEZYN.js";import"./chunks/chunk-WMDJMN5W.js";import"./chunks/chunk-GTJJ73DE.js";import"./chunks/chunk-VD7AKTGP.js";import"./chunks/chunk-PWA75RQU.js";import"./chunks/chunk-M2VJVJMK.js";import"./chunks/chunk-TQHNFP77.js";import"./chunks/chunk-5NECOJNK.js";import"./chunks/chunk-HKCFMDJN.js";import"./chunks/chunk-A3LGSX7Z.js";import"./chunks/chunk-3QPE75AR.js";import"./chunks/chunk-ULWRGKP2.js";import"./chunks/chunk-4B5JSLLR.js";import"./chunks/chunk-FWIO636S.js";import"./chunks/chunk-MOVB6H22.js";import"./chunks/chunk-DLPV4B3R.js";import"./chunks/chunk-VPVD5G32.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-RNLFZ67U.js";import"./chunks/chunk-SOMFLLPD.js";import"./chunks/chunk-MTQQ2VQH.js";import"./chunks/chunk-WMHESZCU.js";import"./chunks/chunk-IJXKHJYR.js";import"./chunks/chunk-QMRJYMNH.js";import"./chunks/chunk-DZQA5LVN.js";import"./chunks/chunk-IEY2SL46.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-4JMGWVRH.js";import"./chunks/chunk-E5O4SP5I.js";import"./chunks/chunk-AT5G5BUI.js";import"./chunks/chunk-7WYJAYHH.js";import"./chunks/chunk-5HMYIYQB.js";import"./chunks/chunk-OSNR3IRD.js";import"./chunks/chunk-UCXBDE6R.js";import"./chunks/chunk-YI6KRJDC.js";import"./chunks/chunk-VUY4BZDI.js";import"./chunks/chunk-SF4MQDKZ.js";import"./chunks/chunk-Z4PN2MDA.js";import"./chunks/chunk-7BX3JQ7F.js";import"./chunks/chunk-GILDYS3O.js";import"./chunks/chunk-KLAX467B.js";import"./chunks/chunk-C4AHHZ6P.js";import"./chunks/chunk-CEFKVI3E.js";import"./chunks/chunk-HGCQAMC6.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-236TAYFX.js";import"./chunks/chunk-36BLGKRO.js";import"./chunks/chunk-FKX6EWFV.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-EUCZC2RF.js";import"./chunks/chunk-WHQ2QPP5.js";import"./chunks/chunk-RLIY3AUC.js";import"./chunks/chunk-WB4BUHOH.js";import"./chunks/chunk-NJ43NBSP.js";import"./chunks/chunk-KDUJCDLM.js";import"./chunks/chunk-6APXZK7W.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-6QQL3SKM.js";import"./chunks/chunk-2IKL4F24.js";import"./chunks/chunk-KJR3XXMI.js";import"./chunks/chunk-IYL5E4QQ.js";import"./chunks/chunk-7THM57HH.js";import"./chunks/chunk-AC72EWI5.js";import"./chunks/chunk-RQFD6LG2.js";import"./chunks/chunk-OJOPOUAY.js";import"./chunks/chunk-4PMRUR4L.js";import"./chunks/chunk-LPYBKMPT.js";import"./chunks/chunk-ZJUL5ODW.js";import"./chunks/chunk-7CXLNKEH.js";import"./chunks/chunk-R7J5TEYK.js";import"./chunks/chunk-62OVOJPI.js";import"./chunks/chunk-G7U4BOJP.js";import"./chunks/chunk-IK3S2NDB.js";import"./chunks/chunk-XDEZA6U6.js";import"./chunks/chunk-WOHQJ6JB.js";import"./chunks/chunk-COH5F7QV.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-Y7QPP7BG.js";import"./chunks/chunk-PWTXZXHH.js";import"./chunks/chunk-GVSBCJFI.js";import"./chunks/chunk-QTS2XGPQ.js";import"./chunks/chunk-Z6TEQEZO.js";import"./chunks/chunk-ZG3MNTNX.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-UAOOH2V7.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-OH5TKHW7.js";import"./chunks/chunk-NDNQ23SK.js";import"./chunks/chunk-JGKH3D6W.js";import"./chunks/chunk-3SASTB6Y.js";import"./chunks/chunk-PJ34QVL5.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-QVG5SUSV.js";import"./chunks/chunk-TEXE4HT6.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-ZFIC2DZV.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-LJFQYCFH.js";import"./chunks/chunk-K3GAGIPX.js";import"./chunks/chunk-RUGTHELO.js";import"./chunks/chunk-42XRJQM6.js";import"./chunks/chunk-IHES3JES.js";import"./chunks/chunk-5XHOHZIR.js";import"./chunks/chunk-HW6AAS3R.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-SODMQEHO.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-EYSV6A7S.js";import"./chunks/chunk-MIENF2YK.js";import"./chunks/chunk-FQXWKEVK.js";import"./chunks/chunk-OXNWERO4.js";import"./chunks/chunk-44BJPS5I.js";import"./chunks/chunk-5GCZFK4X.js";import"./chunks/chunk-O5RYI3IW.js";import"./chunks/chunk-RFFMEA4B.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":"f366c384a78b3717","externals":["@earendil-works/chord","@earendil-works/pi-pty","@silvia-odwyer/photon-node","bufferutil","canvas","kerberos","supports-color","utf-8-validate"]}
1
+ {"buildId":"351c64856112ea04","externals":["@earendil-works/chord","@earendil-works/pi-pty","@silvia-odwyer/photon-node","bufferutil","canvas","kerberos","supports-color","utf-8-validate"]}
@@ -51,6 +51,7 @@ import type { ResourceLoader } from "./resource-loader.ts";
51
51
  import { type FallbackRungRefusal } from "./retry-fallback/controller.ts";
52
52
  import { type ModelConfigErrorEvent } from "./retry-fallback/model-config-error.ts";
53
53
  import { type FallbackRungFailure } from "./retry-fallback/exhaustion.ts";
54
+ import { type RunBackgroundJob, type RunBackgroundStopOutcome } from "./run-background-jobs.ts";
54
55
  import { type InheritResult, type ReleaseInheritedResult, type RunRef } from "./run-holds.ts";
55
56
  import { SecurityNoticeSnapshot } from "./security-notices.ts";
56
57
  import { type SessionActivitySnapshot } from "./session-activity.ts";
@@ -808,6 +809,7 @@ export declare class AgentSession {
808
809
  private readonly _humanInputListeners;
809
810
  private readonly _heldInputs;
810
811
  private readonly _runHolds;
812
+ private readonly _runBackgroundJobs;
811
813
  private readonly _resumeEffects;
812
814
  private _stopInterrupt;
813
815
  private _deliveredHeldInputIds;
@@ -1455,6 +1457,10 @@ export declare class AgentSession {
1455
1457
  get isStreaming(): boolean;
1456
1458
  /** The running turn's id (its admission epoch); undefined while no turn runs. A steer names it as `expectedTurnId`. */
1457
1459
  get currentTurnId(): string | undefined;
1460
+ /** Record a background job under the running turn; outside a turn nothing is recorded. */
1461
+ registerRunBackgroundJob(job: RunBackgroundJob): () => void;
1462
+ /** Stop the background jobs `turnId` started (`interrupt { background: "stop" }`). */
1463
+ stopRunBackgroundJobs(turnId: string): Promise<RunBackgroundStopOutcome>;
1458
1464
  /** True while a provider retry is in flight; the deadline lease treats it as turn progress. */
1459
1465
  get isRetryInFlight(): boolean;
1460
1466
  /** Whether the session has no active agent run, retry, or queued continuation. */
@@ -145,6 +145,7 @@ import { AccountUsageLimitError, formatResetTime, describeUsageLimitEntry, descr
145
145
  import { recordRungFailure } from "./retry-fallback/exhaustion.js";
146
146
  import { limitResetAt } from "./retry-fallback/limit-reset.js";
147
147
  import { validateFallbackChains } from "./retry-fallback/validate.js";
148
+ import { RunBackgroundJobs, } from "./run-background-jobs.js";
148
149
  import { RunHolds } from "./run-holds.js";
149
150
  import { startRunResumeTurn } from "./run-resume-turn.js";
150
151
  import { SecurityNoticeSnapshot } from "./security-notices.js";
@@ -494,6 +495,7 @@ export class AgentSession {
494
495
  this._resumeSettlement = Promise.resolve();
495
496
  this._engineTurnRelease = new EngineTurnRelease();
496
497
  this._humanInputListeners = new Set();
498
+ this._runBackgroundJobs = new RunBackgroundJobs();
497
499
  this._resumeEffects = new Map();
498
500
  this._deliveredHeldInputIds = [];
499
501
  /** Held person input is captured synchronously but its skills are read asynchronously, so it waits here as a promise. */
@@ -818,8 +820,15 @@ export class AgentSession {
818
820
  ...queuedInputPort,
819
821
  // A follow-up the core drains starts a new turn, inside the same run: the armed turn's barrier ends here.
820
822
  commitConsumption: (queue, messages) => {
821
- if (queue === "followUp")
823
+ if (queue === "followUp") {
822
824
  this._toolBarrier.clear();
825
+ // Only drained custom follow-ups open an engine turn. Custom context in the person's initial
826
+ // prompt batch never crosses this boundary and must keep that person's allowance (senpi#6727).
827
+ for (const message of messages) {
828
+ if (message.role === "custom" && !hasInputTurnMark(message))
829
+ markInputTurnOrigin(message, "engine");
830
+ }
831
+ }
823
832
  return queuedInputPort.commitConsumption(queue, messages);
824
833
  },
825
834
  };
@@ -3710,6 +3719,15 @@ export class AgentSession {
3710
3719
  get currentTurnId() {
3711
3720
  return this._isAgentRunActive ? String(this.externalAdmission.turnEpoch) : undefined;
3712
3721
  }
3722
+ /** Record a background job under the running turn; outside a turn nothing is recorded. */
3723
+ registerRunBackgroundJob(job) {
3724
+ const turnId = this.currentTurnId;
3725
+ return turnId === undefined ? () => { } : this._runBackgroundJobs.register(turnId, job);
3726
+ }
3727
+ /** Stop the background jobs `turnId` started (`interrupt { background: "stop" }`). */
3728
+ stopRunBackgroundJobs(turnId) {
3729
+ return this._runBackgroundJobs.stop(turnId);
3730
+ }
3713
3731
  /** True while a provider retry is in flight; the deadline lease treats it as turn progress. */
3714
3732
  get isRetryInFlight() {
3715
3733
  return this._retryPromise !== undefined;
@@ -4571,6 +4589,7 @@ export class AgentSession {
4571
4589
  return (this._extensionRunner.getCommand(spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex)) !== undefined);
4572
4590
  }
4573
4591
  async _prompt(text, options) {
4592
+ let claudeRecheckProvider;
4574
4593
  const throwIfCancelled = () => {
4575
4594
  if (!options?.signal?.aborted)
4576
4595
  return;
@@ -4713,6 +4732,12 @@ export class AgentSession {
4713
4732
  : undefined;
4714
4733
  if (model && pool?.usable)
4715
4734
  this._retryFallback.releaseAccountHold(model.provider);
4735
+ // Defer this hold to the Claude pool only if the person's input is ultimately admitted (senpi#6727).
4736
+ if (model?.provider === "anthropic-subscription" &&
4737
+ !this._pendingModelSwitch &&
4738
+ this._modelRuntime.getRegisteredProviderConfig(model.provider)?.ownsAccountSelection === true &&
4739
+ attributionOf(options) === "user")
4740
+ claudeRecheckProvider = model.provider;
4716
4741
  // A limit the provider lifted before the reset it stated shows in the account's usage: newer usage under its
4717
4742
  // limits releases the hold for any turn. Only a person's turn reads usage early, at most once a minute per
4718
4743
  // account, so a loop never probes a held account more often than the poll does (senpi#6536, senpi#3131).
@@ -4723,6 +4748,7 @@ export class AgentSession {
4723
4748
  }
4724
4749
  if (model &&
4725
4750
  !this._pendingModelSwitch &&
4751
+ claudeRecheckProvider !== model.provider &&
4726
4752
  this._retryFallback.isProviderSpent(model.provider) &&
4727
4753
  !(attributionOf(options) === "user" && this._retryFallback.releaseGuessedAccountHold(model.provider))) {
4728
4754
  this._retryFallback.resetTurn();
@@ -5039,7 +5065,7 @@ export class AgentSession {
5039
5065
  ...clientMessageIdentity(options),
5040
5066
  };
5041
5067
  this._userInputSources.set(userMessage, options?.source ?? "interactive");
5042
- markInputTurnOrigin(userMessage, inputTurnMark(options ?? {}));
5068
+ markInputTurnOrigin(userMessage, inputTurnMark(options ?? {}), attributionOf(options) === "user");
5043
5069
  messages.push(userMessage);
5044
5070
  // Consume next-turn messages transactionally: a final admission rejection
5045
5071
  // restores them in their original order rather than dropping or duplicating
@@ -5072,6 +5098,10 @@ export class AgentSession {
5072
5098
  return;
5073
5099
  }
5074
5100
  await emitInputDisposition("started");
5101
+ if (claudeRecheckProvider !== undefined &&
5102
+ !this._pendingModelSwitch &&
5103
+ this.model?.provider === claudeRecheckProvider)
5104
+ this._retryFallback.releaseAccountHold(claudeRecheckProvider);
5075
5105
  }
5076
5106
  catch (error) {
5077
5107
  await emitInputDisposition("rejected");
@@ -5554,7 +5584,7 @@ export class AgentSession {
5554
5584
  this._userInputSources.set(message, input.source);
5555
5585
  // Restored input with no source keeps no mark: an unmarked turn is engine work, never a trusted origin.
5556
5586
  if (input.source !== undefined)
5557
- markInputTurnOrigin(message, inputTurnMark(input));
5587
+ markInputTurnOrigin(message, inputTurnMark(input), attributionOf(input) === "user");
5558
5588
  else if (recordIsDelegated())
5559
5589
  markInputTurnOrigin(message, "delegated");
5560
5590
  if (input.inputId !== undefined)
@@ -10029,6 +10059,7 @@ export class AgentSession {
10029
10059
  getPauseState: () => this._pauseState(),
10030
10060
  fenceRun: (runRef) => this._runHolds.fence(runRef),
10031
10061
  releaseRunFence: (runRef) => this._runHolds.releaseFences("run_cancelled", [runRef]),
10062
+ registerRunBackgroundJob: (job) => this.registerRunBackgroundJob(job),
10032
10063
  questionInput: () => {
10033
10064
  this._humanInputAdmitted("answer");
10034
10065
  // Under the parent's run pause the answer is held like every person input: nothing is released or run (senpi#3811).
@@ -24,6 +24,8 @@ export type AuthenticatedQueryInput = {
24
24
  * is tried even while blocked, and no block is stored or cleared. Requires `pinnedAccount`.
25
25
  */
26
26
  probe?: boolean;
27
+ /** Accounts already attempted on this person's turn; absent on automated and auxiliary requests. */
28
+ recheckedAccounts?: Set<string>;
27
29
  /** The account this session's SDK transcript lives under; preferred while it can serve (senpi#2891). */
28
30
  preferredAccount?: string;
29
31
  onQuery?: (query: ReturnType<SdkQuery>) => void;
@@ -231,6 +231,7 @@ export async function* queryWithAuthLane(input) {
231
231
  let askedLegacyLongContext = false;
232
232
  yield* runFailover({
233
233
  accounts: pool.accounts,
234
+ recheckedAccounts: input.probe === true ? undefined : input.recheckedAccounts,
234
235
  accountFallback: input.providerSettings.accountFallback,
235
236
  selectFn: (accounts) => selectAccount(accounts, {
236
237
  sessionId: input.sessionId,
@@ -17,6 +17,8 @@ export type FailoverEvent = {
17
17
  };
18
18
  export type FailoverOptions<TEvent> = {
19
19
  accounts: readonly AccountSlot[];
20
+ /** Shared across this person's turn, including retries; consumed before an account's first attempt. */
21
+ recheckedAccounts?: Set<string>;
20
22
  /** When false, only the selected account may be attempted; same-account retries remain enabled. */
21
23
  readonly accountFallback?: boolean;
22
24
  selectFn: (accounts: readonly AccountSlot[]) => AccountSlot;
@@ -3,6 +3,7 @@ import { activeModelBlockUntil, mergeModelBlocks, modelBlockKey, pruneModelBlock
3
3
  import { usageLimitResetMs } from "../../../credential-pool/reset-time.js";
4
4
  import { logAccountBlocked } from "./account-block-log.js";
5
5
  import { AllAccountsBlockedError, clearExpiredBlocks } from "./affinity.js";
6
+ import { recheckSelection, unverifiedLimitBlock } from "./limit-recheck.js";
6
7
  import { isConfirmedAccountUsageLimit, usageLimitBlockMs } from "./usage-limit-block.js";
7
8
  export const MAX_RATE_LIMIT_BLOCK_MS = 48 * 60 * 60 * 1_000;
8
9
  export const DEFAULT_RATE_LIMIT_BLOCK_MS = 60_000;
@@ -292,6 +293,16 @@ export async function* runFailover(options) {
292
293
  const now = options.now ?? Date.now;
293
294
  const baseBlockMs = options.baseBlockMs ?? DEFAULT_RATE_LIMIT_BLOCK_MS;
294
295
  let accounts = clearExpiredBlocks(withSessionBlocks(options.accounts, options.sessionKey, now()), now());
296
+ const select = () => {
297
+ try {
298
+ return options.selectFn(accounts);
299
+ }
300
+ catch (error) {
301
+ if (!(error instanceof AllAccountsBlockedError) || options.recheckedAccounts === undefined)
302
+ throw error;
303
+ return options.selectFn(recheckSelection(accounts, options.recheckedAccounts, now()));
304
+ }
305
+ };
295
306
  const attemptLimit = options.accountFallback === false ? Math.min(accounts.length, 1) : accounts.length;
296
307
  let lastError;
297
308
  const retriedOnStoredMaterial = new Set();
@@ -303,7 +314,10 @@ export async function* runFailover(options) {
303
314
  // attempt holding the same stored object must still report the account it actually ran on.
304
315
  const retrySlot = retryAccountName === undefined ? undefined : accounts.find((slot) => slot.name === retryAccountName);
305
316
  retryAccountName = undefined;
306
- const account = { ...(retrySlot ?? options.selectFn(accounts)) };
317
+ const account = { ...(retrySlot ?? select()) };
318
+ const held = accounts.find((slot) => slot.name === account.name);
319
+ const rechecking = held !== undefined && unverifiedLimitBlock(held, now()) && retrySlot === undefined;
320
+ options.recheckedAccounts?.add(account.name);
307
321
  let visibleDeltaEmitted = false;
308
322
  let completed = false;
309
323
  const startedAt = now();
@@ -324,6 +338,9 @@ export async function* runFailover(options) {
324
338
  lastError = classified;
325
339
  if (!classification.retryable)
326
340
  throw classified;
341
+ // An inconclusive half-open check retains the old block. It must not multiply into same-account retries.
342
+ if (rechecking && (isTransient(classification) || classification.kind === "long_context_unavailable"))
343
+ throw classified;
327
344
  // A refused 1M window is the account's entitlement, not a limit: never block or rotate it.
328
345
  // Retry once on the same account at the standard window (senpi#3408).
329
346
  if (classification.kind === "long_context_unavailable") {
@@ -369,7 +386,7 @@ export async function* runFailover(options) {
369
386
  accounts = replaceAccount(accounts, unreadable);
370
387
  let nextAccount;
371
388
  try {
372
- nextAccount = options.selectFn(accounts);
389
+ nextAccount = select();
373
390
  }
374
391
  catch (selectError) {
375
392
  if (selectError instanceof AllAccountsBlockedError)
@@ -394,6 +411,7 @@ export async function* runFailover(options) {
394
411
  rememberSessionBlock(options.sessionKey, blocked);
395
412
  const superseded = persists && shared ? await persistBlock(options.store, options.providerId, blocked, now()) : undefined;
396
413
  if (superseded &&
414
+ !rechecking &&
397
415
  !visibleDeltaEmitted &&
398
416
  usable(superseded, now(), options.model) &&
399
417
  !retriedOnStoredMaterial.has(account.name)) {
@@ -421,7 +439,7 @@ export async function* runFailover(options) {
421
439
  let poolState;
422
440
  try {
423
441
  if (!visibleDeltaEmitted && attempt + 1 < attemptLimit) {
424
- event.nextAccount = options.selectFn(accounts);
442
+ event.nextAccount = select();
425
443
  }
426
444
  }
427
445
  catch (selectError) {
@@ -453,7 +471,7 @@ export async function* runFailover(options) {
453
471
  // model alone, the pool's refusal (a model-scoped limit) is what the fallback chain must read (senpi#5007).
454
472
  if (lastError !== undefined && lastError.classification.modelFamily === undefined && options.model !== undefined) {
455
473
  try {
456
- options.selectFn(accounts);
474
+ select();
457
475
  }
458
476
  catch (refusal) {
459
477
  if (refusal instanceof AllAccountsBlockedError && refusal.limitedModel !== undefined)
@@ -10,6 +10,7 @@ import { CLAUDE_SDK_OAUTH_API_ID } from "./api-id.js";
10
10
  import { plannedContextWindow } from "./context-window.js";
11
11
  import { claudeCliDefaultModel } from "./claude-cli-account-test.js";
12
12
  import { longContextAvailable, onLongContextAvailabilityChange } from "./long-context.js";
13
+ import { registerLimitRecheck } from "./limit-recheck.js";
13
14
  import { createOAuthConfig } from "./oauth-login.js";
14
15
  import { registerSessionRegistry } from "./session-registry-wiring.js";
15
16
  import { requireAnthropicSubscriptionCwd } from "./session-cwd.js";
@@ -55,6 +56,7 @@ export function registerAnthropicSubscriptionExtension(pi, deps = {}) {
55
56
  const cwd = requireAnthropicSubscriptionCwd(pi.cwd);
56
57
  registerClaudeAccountCommand(pi);
57
58
  registerSessionRegistry(pi);
59
+ const limitRecheck = registerLimitRecheck(pi);
58
60
  // The lane re-registers whenever the 1M window is refused or offered again, so the session's current
59
61
  // model, and compaction with it, plans against the window the requests get. Each registration is the
60
62
  // whole config: the runtime validates a registration on its own, not merged with the previous one.
@@ -62,7 +64,7 @@ export function registerAnthropicSubscriptionExtension(pi, deps = {}) {
62
64
  baseUrl: CLAUDE_SDK_OAUTH_API_ID,
63
65
  api: CLAUDE_SDK_OAUTH_API_ID,
64
66
  models: anthropicSubscriptionModels(longContext),
65
- streamSimple: (model, context, options) => streamAnthropicSubscription(model, toBuiltinProviderContext(context), options),
67
+ streamSimple: (model, context, options) => streamAnthropicSubscription(model, toBuiltinProviderContext(context), options, options?.streamKind === "main" ? limitRecheck.accounts() : undefined),
66
68
  // A verbatim `enabled: false` is the kill switch: the lane cannot serve, so
67
69
  // it must not consume an implicit fallback-expansion slot. An absent flag
68
70
  // stays eligible - an explicit senpi-side login keeps the lane usable.
@@ -107,7 +109,10 @@ export function registerAnthropicSubscriptionExtension(pi, deps = {}) {
107
109
  const stopFollowingLongContext = onLongContextAvailabilityChange((available) => {
108
110
  pi.registerProvider(ANTHROPIC_SUBSCRIPTION_PROVIDER_ID, providerConfig(available));
109
111
  });
110
- pi.on("session_shutdown", () => stopFollowingLongContext());
112
+ pi.on("session_shutdown", () => {
113
+ stopFollowingLongContext();
114
+ limitRecheck.reset();
115
+ });
111
116
  }
112
117
  export default function anthropicSubscriptionExtension(pi) {
113
118
  registerAnthropicSubscriptionExtension(pi);
@@ -0,0 +1,15 @@
1
+ import type { ExtensionAPI } from "../../types.ts";
2
+ import type { AccountSlot } from "./accounts.ts";
3
+ /**
4
+ * One allowance per account on an admitted person's turn (senpi#6727). Its identity follows the actual message,
5
+ * not a predicted end event: a fresh run drops it even when the previous retry was cancelled or blocked.
6
+ */
7
+ export declare function registerLimitRecheck(pi: ExtensionAPI): {
8
+ readonly accounts: () => Set<string> | undefined;
9
+ readonly reset: () => void;
10
+ };
11
+ /** A rate-limit block with no successful usage reading newer than the block. Errors are not usage evidence. */
12
+ export declare function unverifiedLimitBlock(account: AccountSlot, now: number): boolean;
13
+ /** The selection view alone is opened. Persistent state and model-specific blocks remain authoritative. */
14
+ export declare function recheckSelection(accounts: readonly AccountSlot[], attempted: ReadonlySet<string> | undefined, now: number): readonly AccountSlot[];
15
+ //# sourceMappingURL=limit-recheck.d.ts.map