@code-yeongyu/senpi 2026.9.29-2 → 2026.9.29-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 (115) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/bundle/chunks/{anthropic-messages-OMTQOHSI.js → anthropic-messages-7WTVWELD.js} +1 -1
  3. package/dist/bundle/chunks/{app-server-command-ZC6A4C3L.js → app-server-command-5DSRGKFG.js} +1 -1
  4. package/dist/bundle/chunks/{azure-openai-responses-Z4FAFKPJ.js → azure-openai-responses-XVZ3FMH2.js} +1 -1
  5. package/dist/bundle/chunks/{chunk-U2SAEU63.js → chunk-27C3ZSZG.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-YJUO37UX.js → chunk-2POUJCWM.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-4LVZQRDG.js → chunk-4VWWEMCJ.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-36ACNYQR.js → chunk-7RVWDN5Z.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-YS72TY6S.js → chunk-CZNE6LIO.js} +1 -1
  10. package/dist/bundle/chunks/{chunk-ILELKDDB.js → chunk-DWNYCJ43.js} +1 -1
  11. package/dist/bundle/chunks/{chunk-OMLHHPMZ.js → chunk-EB3GDOU4.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-2HWLCW54.js → chunk-EQBN6TVJ.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-E5F5SVZF.js → chunk-FUGMDU6B.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-RSPHQOSG.js → chunk-GE32OHDE.js} +7 -7
  15. package/dist/bundle/chunks/chunk-GKR74EKE.js +3 -0
  16. package/dist/bundle/chunks/{chunk-UYV2UM6E.js → chunk-ILQTW6KB.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-TH4XD7AJ.js → chunk-JEWB5XTL.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-FAV4DX74.js → chunk-K2SHQNAA.js} +1 -1
  19. package/dist/bundle/chunks/{chunk-NVJUCNHP.js → chunk-K7B7NFOK.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-TZMNXKL2.js → chunk-KO6GO5ZY.js} +1 -1
  21. package/dist/bundle/chunks/{chunk-5CGFVKUK.js → chunk-LB2B2Q4P.js} +1 -1
  22. package/dist/bundle/chunks/{chunk-77OBRAUG.js → chunk-M4AHRI5L.js} +1 -1
  23. package/dist/bundle/chunks/{chunk-SW4U2HHU.js → chunk-OVDACFW2.js} +1 -1
  24. package/dist/bundle/chunks/{chunk-BTRONX2A.js → chunk-RUOJQL6B.js} +1 -1
  25. package/dist/bundle/chunks/{chunk-ASAQQ6VM.js → chunk-SH6VUPE4.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-TFW6SS3P.js → chunk-SNDTJL2H.js} +1 -1
  27. package/dist/bundle/chunks/{chunk-Y5A6TKBN.js → chunk-T3HGPHPP.js} +1 -1
  28. package/dist/bundle/chunks/{chunk-BPZ5KIOS.js → chunk-UK5TE7WR.js} +1 -1
  29. package/dist/bundle/chunks/{chunk-NDNZU2X7.js → chunk-UNTVGMGW.js} +3 -3
  30. package/dist/bundle/chunks/{chunk-BQGFWWDC.js → chunk-VLTMFAWQ.js} +1 -1
  31. package/dist/bundle/chunks/{chunk-XDZ5RSMX.js → chunk-W4AG5TN4.js} +1 -1
  32. package/dist/bundle/chunks/chunk-WCAKUCN3.js +14 -0
  33. package/dist/bundle/chunks/{chunk-UEWSEALS.js → chunk-WRPX2M5D.js} +1 -1
  34. package/dist/bundle/chunks/{chunk-DA4W77J7.js → chunk-XBGO2JZD.js} +1 -1
  35. package/dist/bundle/chunks/chunk-XVX4M3DZ.js +2 -0
  36. package/dist/bundle/chunks/chunk-YD32NXKZ.js +8 -0
  37. package/dist/bundle/chunks/chunk-YOPVJDSU.js +2 -0
  38. package/dist/bundle/chunks/cli-main-V3T5WOV6.js +3 -0
  39. package/dist/bundle/chunks/{google-generative-ai-NFSRK6V5.js → google-generative-ai-XO6BUQVD.js} +1 -1
  40. package/dist/bundle/chunks/{google-vertex-6YEVHEPI.js → google-vertex-SGNV6ZMK.js} +1 -1
  41. package/dist/bundle/chunks/{help-fast-path-RYMO5ODA.js → help-fast-path-AYPE26W2.js} +1 -1
  42. package/dist/bundle/chunks/{host-command-BU6XSX4H.js → host-command-ZTMADQIT.js} +1 -1
  43. package/dist/bundle/chunks/{host-lifecycle-22DRSTVI.js → host-lifecycle-FTH7WAQN.js} +1 -1
  44. package/dist/bundle/chunks/{interactive-host-runtime-P3FYZWSY.js → interactive-host-runtime-XDRXCEJ3.js} +1 -1
  45. package/dist/bundle/chunks/{interactive-mode-VCIOGSIZ.js → interactive-mode-6VFVZKKW.js} +1 -1
  46. package/dist/bundle/chunks/{list-tips-XXZ5PLE3.js → list-tips-ASETMEFS.js} +1 -1
  47. package/dist/bundle/chunks/{mistral-conversations-R5PTP4P3.js → mistral-conversations-TVJBIL35.js} +1 -1
  48. package/dist/bundle/chunks/{multi-session-host-PRY7CJLK.js → multi-session-host-5VFMTPY7.js} +1 -1
  49. package/dist/bundle/chunks/{native-loader-SU5SGTSW.js → native-loader-WM7NDPEO.js} +1 -1
  50. package/dist/bundle/chunks/{openai-codex-responses-6B2ZLWTN.js → openai-codex-responses-RUT66DHS.js} +1 -1
  51. package/dist/bundle/chunks/{openai-completions-5NTZZNVJ.js → openai-completions-THHRTH7B.js} +1 -1
  52. package/dist/bundle/chunks/{openai-responses-V4JEBGEX.js → openai-responses-ITED6XXB.js} +1 -1
  53. package/dist/bundle/chunks/{package-manager-cli-RQ2NJAJ3.js → package-manager-cli-RAQRCH5L.js} +3 -3
  54. package/dist/bundle/chunks/{rg-engine-XHGOVGVG.js → rg-engine-G2YTYL2T.js} +1 -1
  55. package/dist/bundle/chunks/{rotation-stream-YQLGLRCX.js → rotation-stream-4FQW6IX5.js} +1 -1
  56. package/dist/bundle/chunks/{rpc-mode-U2EQRVC3.js → rpc-mode-W5P5QMF7.js} +1 -1
  57. package/dist/bundle/chunks/{schedule-command-DXC3ECXT.js → schedule-command-EFQUSPN4.js} +1 -1
  58. package/dist/bundle/chunks/{session-picker-KTXLU6MQ.js → session-picker-FF2J4OQA.js} +1 -1
  59. package/dist/bundle/chunks/session-worker.js +188 -188
  60. package/dist/bundle/chunks/{state-store-5A2TZ4SG.js → state-store-IIQL55GC.js} +1 -1
  61. package/dist/bundle/cli.js +2 -1
  62. package/dist/bundle/index.js +1 -1
  63. package/dist/bundle/rpc-entry.js +1 -1
  64. package/dist/bundle/runtime-manifest.json +1 -0
  65. package/dist/cli.js +24 -4
  66. package/dist/cli.js.map +1 -1
  67. package/dist/config.d.ts +5 -0
  68. package/dist/config.d.ts.map +1 -1
  69. package/dist/config.js +16 -6
  70. package/dist/config.js.map +1 -1
  71. package/dist/main.d.ts.map +1 -1
  72. package/dist/main.js +2 -2
  73. package/dist/main.js.map +1 -1
  74. package/dist/package-manager-cli.js +3 -3
  75. package/dist/package-manager-cli.js.map +1 -1
  76. package/dist/runtime-snapshot/enter.d.ts +17 -0
  77. package/dist/runtime-snapshot/enter.d.ts.map +1 -0
  78. package/dist/runtime-snapshot/enter.js +72 -0
  79. package/dist/runtime-snapshot/enter.js.map +1 -0
  80. package/dist/runtime-snapshot/layout.d.ts +15 -0
  81. package/dist/runtime-snapshot/layout.d.ts.map +1 -0
  82. package/dist/runtime-snapshot/layout.js +126 -0
  83. package/dist/runtime-snapshot/layout.js.map +1 -0
  84. package/dist/runtime-snapshot/marker.d.ts +13 -0
  85. package/dist/runtime-snapshot/marker.d.ts.map +1 -0
  86. package/dist/runtime-snapshot/marker.js +40 -0
  87. package/dist/runtime-snapshot/marker.js.map +1 -0
  88. package/dist/runtime-snapshot/registry.d.ts +14 -0
  89. package/dist/runtime-snapshot/registry.d.ts.map +1 -0
  90. package/dist/runtime-snapshot/registry.js +124 -0
  91. package/dist/runtime-snapshot/registry.js.map +1 -0
  92. package/dist/senpi +24 -4
  93. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +12 -0
  94. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  95. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  96. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts.map +1 -1
  97. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +2 -1
  98. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js.map +1 -1
  99. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  100. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  101. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-failure-description.d.ts +7 -0
  102. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-failure-description.d.ts.map +1 -1
  103. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-failure-description.js +21 -0
  104. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-failure-description.js.map +1 -1
  105. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  106. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  107. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  108. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  109. package/package.json +7 -7
  110. package/dist/bundle/chunks/chunk-DXU53IPJ.js +0 -8
  111. package/dist/bundle/chunks/chunk-FILEUW2D.js +0 -3
  112. package/dist/bundle/chunks/chunk-PBWQK23Z.js +0 -14
  113. package/dist/bundle/chunks/chunk-TJV2LFKM.js +0 -2
  114. package/dist/bundle/chunks/chunk-UIOI2SK3.js +0 -2
  115. package/dist/bundle/chunks/cli-main-RPQFXRJ7.js +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,IAA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OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;AACxC,CAAC;AAED,iCAAiC;AACjC,MAAM,UAAU,eAAe;IAC9B,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,QAAQ,YAAY,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import { accessSync, constants, existsSync, readFileSync, realpathSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { basename, dirname, join, resolve, sep, win32 } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { createBunLauncherRepairCommand } from \"./bun-global-launcher.ts\";\nimport { type BrandProfile, brandProfile, envValue } from \"./core/brand.ts\";\nimport { findNearestParentConfigDir } from \"./nearest-parent-config.ts\";\nimport { spawnProcessSync } from \"./utils/child-process.ts\";\nimport { normalizePath } from \"./utils/paths.ts\";\nimport { stripBom } from \"./utils/text.ts\";\n\n// =============================================================================\n// Package Detection\n// =============================================================================\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Detect if we're running as a Bun compiled binary.\n * Bun binaries have import.meta.url containing \"$bunfs\", \"~BUN\", or \"%7EBUN\" (Bun's virtual filesystem path)\n */\nexport const isBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\n/** Detect if Bun is the runtime (compiled binary or bun run) */\nexport const isBunRuntime = !!process.versions.bun;\n\n/** Detect the esbuild-bundled Node.js distribution. */\ndeclare const PI_BUNDLED_NODE: boolean;\nexport const isBundledNode = typeof PI_BUNDLED_NODE !== \"undefined\" && PI_BUNDLED_NODE;\n\n// =============================================================================\n// Install Method Detection\n// =============================================================================\n\nexport type InstallMethod = \"bun-binary\" | \"npm\" | \"pnpm\" | \"yarn\" | \"bun\" | \"unknown\";\n\ninterface SelfUpdateCommandStep {\n\tcommand: string;\n\targs: string[];\n\tdisplay: string;\n}\n\nexport interface SelfUpdateCommand extends SelfUpdateCommandStep {\n\tsteps?: SelfUpdateCommandStep[];\n}\n\nexport type SelfUpdatePackageTarget = string | { packageName: string; installSpec?: string };\n\nfunction normalizeSelfUpdatePackageTarget(target: SelfUpdatePackageTarget): {\n\tpackageName: string;\n\tinstallSpec: string;\n} {\n\tif (typeof target === \"string\") {\n\t\treturn { packageName: target, installSpec: target };\n\t}\n\treturn { packageName: target.packageName, installSpec: target.installSpec ?? target.packageName };\n}\n\nfunction makeSelfUpdateCommand(\n\tinstallStep: SelfUpdateCommandStep,\n\tuninstallStep?: SelfUpdateCommandStep,\n\tpostInstallStep?: SelfUpdateCommandStep,\n): SelfUpdateCommand {\n\tconst steps = [\n\t\t...(uninstallStep ? [uninstallStep] : []),\n\t\tinstallStep,\n\t\t...(postInstallStep ? [postInstallStep] : []),\n\t];\n\tif (steps.length === 1) return installStep;\n\treturn {\n\t\t...installStep,\n\t\tdisplay: steps.map((step) => step.display).join(\" && \"),\n\t\tsteps,\n\t};\n}\n\nfunction makeSelfUpdateCommandStep(command: string, args: string[]): SelfUpdateCommandStep {\n\treturn {\n\t\tcommand,\n\t\targs,\n\t\tdisplay: [command, ...args].map((arg) => (/\\s/.test(arg) ? `\"${arg}\"` : arg)).join(\" \"),\n\t};\n}\n\nexport function detectInstallMethod(): InstallMethod {\n\tif (isBunBinary) {\n\t\treturn \"bun-binary\";\n\t}\n\n\tconst resolvedPath = `${__dirname}\\0${process.execPath || \"\"}`.toLowerCase().replace(/\\\\/g, \"/\");\n\n\tif (resolvedPath.includes(\"/pnpm/\") || resolvedPath.includes(\"/.pnpm/\")) {\n\t\treturn \"pnpm\";\n\t}\n\tif (resolvedPath.includes(\"/yarn/\") || resolvedPath.includes(\"/.yarn/\")) {\n\t\treturn \"yarn\";\n\t}\n\tif (isBunRuntime || resolvedPath.includes(\"/install/global/node_modules/\")) {\n\t\treturn \"bun\";\n\t}\n\tif (resolvedPath.includes(\"/npm/\") || resolvedPath.includes(\"/node_modules/\")) {\n\t\treturn \"npm\";\n\t}\n\n\treturn \"unknown\";\n}\n\nfunction getInferredNpmInstall(): { root: string; prefix: string } | undefined {\n\tconst packageDir = getPackageDir();\n\tconst path = process.platform === \"win32\" || packageDir.includes(\"\\\\\") ? win32 : { basename, dirname };\n\tconst parent = path.dirname(packageDir);\n\tlet root: string | undefined;\n\tif (path.basename(parent).startsWith(\"@\") && path.basename(path.dirname(parent)) === \"node_modules\") {\n\t\troot = path.dirname(parent);\n\t} else if (path.basename(parent) === \"node_modules\") {\n\t\troot = parent;\n\t}\n\tif (!root) return undefined;\n\tconst rootParent = path.dirname(root);\n\tif (path.basename(rootParent) === \"lib\") return { root, prefix: path.dirname(rootParent) };\n\t// Windows global npm prefixes use `<prefix>\\\\node_modules`, which is\n\t// indistinguishable from local project installs by path shape alone. Do not\n\t// infer unsupported Windows custom prefixes without `npm root -g` evidence.\n\treturn undefined;\n}\n\nfunction getSelfUpdateCommandForMethod(\n\tmethod: InstallMethod,\n\tinstalledPackageName: string,\n\tupdatePackageTarget: SelfUpdatePackageTarget = installedPackageName,\n\tnpmCommand?: string[],\n): SelfUpdateCommand | undefined {\n\tconst target = normalizeSelfUpdatePackageTarget(updatePackageTarget);\n\tswitch (method) {\n\t\tcase \"bun-binary\":\n\t\t\treturn undefined;\n\t\tcase \"pnpm\": {\n\t\t\tconst match = readCommandOutput(\"pnpm\", [\"root\", \"-g\"])\n\t\t\t\t? undefined\n\t\t\t\t: /^(.*[\\\\/]global[\\\\/][^\\\\/]+)[\\\\/]\\.pnpm[\\\\/]/.exec(getPackageDir());\n\t\t\tconst binDirArgs = match\n\t\t\t\t? [`--config.global-bin-dir=${process.env.PNPM_HOME || dirname(dirname(match[1]))}`]\n\t\t\t\t: [];\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"pnpm\", [\n\t\t\t\t\t\"install\",\n\t\t\t\t\t\"-g\",\n\t\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\t\"--config.minimumReleaseAge=0\",\n\t\t\t\t\t...binDirArgs,\n\t\t\t\t\ttarget.installSpec,\n\t\t\t\t]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"pnpm\", [\"remove\", \"-g\", ...binDirArgs, installedPackageName]),\n\t\t\t);\n\t\t}\n\t\tcase \"yarn\":\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"yarn\", [\"global\", \"add\", \"--ignore-scripts\", target.installSpec]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"yarn\", [\"global\", \"remove\", installedPackageName]),\n\t\t\t);\n\t\tcase \"bun\": {\n\t\t\tconst binDir = readCommandOutput(\"bun\", [\"pm\", \"bin\", \"-g\"]);\n\t\t\tif (!binDir) return undefined;\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"bun\", [\n\t\t\t\t\t\"install\",\n\t\t\t\t\t\"-g\",\n\t\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\t\"--minimum-release-age=0\",\n\t\t\t\t\ttarget.installSpec,\n\t\t\t\t]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"bun\", [\"uninstall\", \"-g\", installedPackageName]),\n\t\t\t\tprocess.platform === \"win32\"\n\t\t\t\t\t? undefined\n\t\t\t\t\t: createBunLauncherRepairCommand(binDir, target.packageName, APP_NAME),\n\t\t\t);\n\t\t}\n\t\tcase \"npm\": {\n\t\t\tconst [command = \"npm\", ...npmArgs] = npmCommand ?? [];\n\t\t\tconst inferred = npmCommand?.length ? undefined : getInferredNpmInstall();\n\t\t\tconst prefixArgs = [...npmArgs, ...(inferred ? [\"--prefix\", inferred.prefix] : [])];\n\t\t\tconst installStep = makeSelfUpdateCommandStep(command, [\n\t\t\t\t...prefixArgs,\n\t\t\t\t\"install\",\n\t\t\t\t\"-g\",\n\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\"--min-release-age=0\",\n\t\t\t\ttarget.installSpec,\n\t\t\t]);\n\t\t\tconst uninstallStep =\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(command, [...prefixArgs, \"uninstall\", \"-g\", installedPackageName]);\n\t\t\treturn makeSelfUpdateCommand(installStep, uninstallStep);\n\t\t}\n\t\tcase \"unknown\":\n\t\t\treturn undefined;\n\t}\n}\n\nfunction readCommandOutput(\n\tcommand: string,\n\targs: string[],\n\toptions: { requireSuccess?: boolean } = {},\n): string | undefined {\n\tconst result = spawnProcessSync(command, args, {\n\t\tencoding: \"utf-8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t});\n\tif (result.status === 0) return result.stdout.trim() || undefined;\n\tif (options.requireSuccess) {\n\t\tconst reason = result.error?.message || result.stderr.trim() || `exit code ${result.status ?? \"unknown\"}`;\n\t\tthrow new Error(`Failed to run ${[command, ...args].join(\" \")}: ${reason}`);\n\t}\n\treturn undefined;\n}\n\nfunction getGlobalPackageRoots(method: InstallMethod, _packageName: string, npmCommand?: string[]): string[] {\n\tswitch (method) {\n\t\tcase \"npm\": {\n\t\t\tconst configured = !!npmCommand?.length;\n\t\t\tconst [command = \"npm\", ...npmArgs] = npmCommand ?? [];\n\t\t\tif (configured && command === \"bun\") {\n\t\t\t\tconst bunBin = readCommandOutput(command, [...npmArgs, \"pm\", \"bin\", \"-g\"], {\n\t\t\t\t\trequireSuccess: true,\n\t\t\t\t});\n\t\t\t\tconst roots = [join(homedir(), \".bun\", \"install\", \"global\", \"node_modules\")];\n\t\t\t\tif (bunBin) {\n\t\t\t\t\troots.push(join(dirname(bunBin), \"install\", \"global\", \"node_modules\"));\n\t\t\t\t}\n\t\t\t\treturn roots;\n\t\t\t}\n\t\t\tconst root = readCommandOutput(command, [...npmArgs, \"root\", \"-g\"], {\n\t\t\t\trequireSuccess: configured,\n\t\t\t});\n\t\t\tconst inferred = configured ? undefined : getInferredNpmInstall();\n\t\t\treturn [root, inferred?.root].filter((x): x is string => !!x);\n\t\t}\n\t\tcase \"pnpm\": {\n\t\t\tconst root = readCommandOutput(\"pnpm\", [\"root\", \"-g\"]);\n\t\t\tif (root) return [root, dirname(root)];\n\t\t\tconst match = /^(.*[\\\\/]global[\\\\/][^\\\\/]+)[\\\\/]\\.pnpm[\\\\/]/.exec(getPackageDir());\n\t\t\treturn match ? [match[1]] : [];\n\t\t}\n\t\tcase \"yarn\": {\n\t\t\tconst dir = readCommandOutput(\"yarn\", [\"global\", \"dir\"]);\n\t\t\treturn dir ? [dir, join(dir, \"node_modules\")] : [];\n\t\t}\n\t\tcase \"bun\": {\n\t\t\tconst bunBin = readCommandOutput(\"bun\", [\"pm\", \"bin\", \"-g\"]);\n\t\t\tconst roots = [join(homedir(), \".bun\", \"install\", \"global\", \"node_modules\")];\n\t\t\tif (bunBin) {\n\t\t\t\troots.push(join(dirname(bunBin), \"install\", \"global\", \"node_modules\"));\n\t\t\t}\n\t\t\treturn roots;\n\t\t}\n\t\tcase \"bun-binary\":\n\t\tcase \"unknown\":\n\t\t\treturn [];\n\t}\n}\n\nfunction normalizeExistingPathForComparison(path: string, resolveSymlinks: boolean): string | undefined {\n\tconst resolvedPath = resolve(path);\n\tif (!existsSync(resolvedPath)) {\n\t\treturn undefined;\n\t}\n\tlet normalizedPath = resolvedPath;\n\tif (resolveSymlinks) {\n\t\ttry {\n\t\t\tnormalizedPath = realpathSync(resolvedPath);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\tif (process.platform === \"win32\") {\n\t\tnormalizedPath = normalizedPath.toLowerCase();\n\t}\n\treturn normalizedPath;\n}\n\nfunction getPathComparisonCandidates(path: string): string[] {\n\treturn Array.from(\n\t\tnew Set(\n\t\t\t[normalizeExistingPathForComparison(path, false), normalizeExistingPathForComparison(path, true)].filter(\n\t\t\t\t(candidate): candidate is string => !!candidate,\n\t\t\t),\n\t\t),\n\t);\n}\n\nfunction getEntrypointPackageDir(): string | undefined {\n\tconst entrypoint = process.argv[1];\n\tif (!entrypoint) return undefined;\n\tlet dir = dirname(entrypoint);\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\treturn undefined;\n}\n\nfunction isSelfUpdatePathWritable(): boolean {\n\tconst packageDir = getPackageDir();\n\ttry {\n\t\taccessSync(packageDir, constants.W_OK);\n\t\taccessSync(dirname(packageDir), constants.W_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction isManagedByGlobalPackageManager(method: InstallMethod, packageName: string, npmCommand?: string[]): boolean {\n\tconst packageDirs = [getPackageDir(), getEntrypointPackageDir()].filter((dir): dir is string => !!dir);\n\tconst packageDirCandidates = packageDirs.flatMap((dir) => getPathComparisonCandidates(dir));\n\treturn getGlobalPackageRoots(method, packageName, npmCommand).some((root) => {\n\t\treturn getPathComparisonCandidates(root).some((normalizedRoot) => {\n\t\t\tconst rootPrefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\t\treturn packageDirCandidates.some((packageDir) => packageDir.startsWith(rootPrefix));\n\t\t});\n\t});\n}\n\nexport function getSelfUpdateCommand(\n\tpackageName: string,\n\tnpmCommand?: string[],\n\tupdatePackageTarget: SelfUpdatePackageTarget = packageName,\n): SelfUpdateCommand | undefined {\n\tconst method = detectInstallMethod();\n\tconst command = getSelfUpdateCommandForMethod(method, packageName, updatePackageTarget, npmCommand);\n\tif (!command || !isManagedByGlobalPackageManager(method, packageName, npmCommand) || !isSelfUpdatePathWritable()) {\n\t\treturn undefined;\n\t}\n\treturn command;\n}\n\nexport function getSelfUpdateUnavailableInstruction(\n\tpackageName: string,\n\tnpmCommand?: string[],\n\tupdatePackageTarget: SelfUpdatePackageTarget = packageName,\n): string {\n\tconst method = detectInstallMethod();\n\tconst target = normalizeSelfUpdatePackageTarget(updatePackageTarget);\n\tif (method === \"bun-binary\") {\n\t\treturn `Download from: https://github.com/code-yeongyu/senpi/releases/latest`;\n\t}\n\tconst command = getSelfUpdateCommandForMethod(method, packageName, target, npmCommand);\n\tif (command) {\n\t\tif (isManagedByGlobalPackageManager(method, packageName, npmCommand) && !isSelfUpdatePathWritable()) {\n\t\t\treturn `This installation is managed by a global ${method} install, but the install path is not writable. Update it yourself with: ${command.display}`;\n\t\t}\n\t\treturn `This installation is not managed by a global ${method} install. Update it with the package manager, wrapper, or source checkout that provides it.`;\n\t}\n\treturn `Update ${target.installSpec} using the package manager, wrapper, or source checkout that provides this installation.`;\n}\n\nexport function getUpdateInstruction(packageName: string): string {\n\tconst method = detectInstallMethod();\n\tconst command = getSelfUpdateCommandForMethod(method, packageName);\n\tif (command) {\n\t\treturn `Run: ${command.display}`;\n\t}\n\treturn getSelfUpdateUnavailableInstruction(packageName);\n}\n\n// =============================================================================\n// Package Asset Paths (shipped with executable)\n// =============================================================================\n\n/**\n * Get the base directory for resolving package assets (themes, package.json, README.md, CHANGELOG.md).\n * - For Bun binary: returns the directory containing the executable\n * - For Node.js and tsx: returns the package root containing package.json\n * - Ignores Bun binary metadata copied into dist/ when the package root is available\n */\nexport function findNodePackageDir(startDir: string): string {\n\tlet dir = startDir;\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\tconst parent = dirname(dir);\n\t\t\t// build:binary places Bun's metadata inside dist/. Node still needs the\n\t\t\t// package root so its dist-relative asset paths do not become dist/dist/.\n\t\t\tif (basename(dir) === \"dist\" && existsSync(join(parent, \"package.json\"))) {\n\t\t\t\treturn parent;\n\t\t\t}\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\treturn startDir;\n}\n\nexport function getPackageDir(): string {\n\t// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)\n\tconst envDir = envValue(\"PACKAGE_DIR\");\n\tif (envDir) {\n\t\treturn normalizePath(envDir);\n\t}\n\n\tif (isBunBinary) {\n\t\t// Bun binary: process.execPath points to the compiled executable\n\t\treturn dirname(process.execPath);\n\t}\n\treturn findNodePackageDir(__dirname);\n}\n\n/** One asset directory shipped with the package, in both the Bun-binary and Node layouts. */\ninterface ShippedAsset {\n\t/** Directory name next to a compiled Bun binary. */\n\treadonly binaryDir: string;\n\t/** Path segments under the package's src/ or dist/ root. */\n\treadonly sourceSegments: readonly string[];\n\t/** A file the directory must contain; a root without it does not ship this asset. */\n\treadonly probe: string;\n}\n\nconst THEMES_ASSET: ShippedAsset = {\n\tbinaryDir: \"theme\",\n\tsourceSegments: [\"modes\", \"interactive\", \"theme\"],\n\tprobe: \"dark.json\",\n};\n\nconst EXPORT_TEMPLATE_ASSET: ShippedAsset = {\n\tbinaryDir: \"export-html\",\n\tsourceSegments: [\"core\", \"export-html\"],\n\tprobe: \"template.html\",\n};\n\nconst INTERACTIVE_ASSETS: ShippedAsset = {\n\tbinaryDir: \"assets\",\n\tsourceSegments: [\"modes\", \"interactive\", \"assets\"],\n\tprobe: \"clankolas.png\",\n};\n\nfunction assetDirIn(root: string, asset: ShippedAsset): string {\n\tif (isBunBinary) {\n\t\treturn join(root, asset.binaryDir);\n\t}\n\tconst srcOrDist = existsSync(join(root, \"src\")) ? \"src\" : \"dist\";\n\treturn join(root, srcOrDist, ...asset.sourceSegments);\n}\n\n/**\n * Resolve a shipped asset directory, preferring PACKAGE_DIR but never trusting it blindly.\n *\n * PACKAGE_DIR relocates the package root (Nix/Guix store paths), and a Bun binary that embeds this\n * CLI pins it to the binary's own root. When such a root is inherited by a Node install of the CLI,\n * the Node layout resolves under it to a directory that cannot exist and startup dies on ENOENT\n * (an omo binary keeps its themes in a flat theme/, so the inherited root has no dist/ tree at all).\n * Fall back to the running install whenever the preferred root does not actually ship the asset. When\n * neither ships it the install is genuinely broken, and the running install's own path is returned so\n * the resulting error names the tree that was supposed to carry the asset rather than a foreign root.\n */\nfunction resolveShippedAssetDir(asset: ShippedAsset): string {\n\tconst preferred = assetDirIn(getPackageDir(), asset);\n\tif (existsSync(join(preferred, asset.probe))) {\n\t\treturn preferred;\n\t}\n\treturn assetDirIn(isBunBinary ? dirname(process.execPath) : findNodePackageDir(__dirname), asset);\n}\n\n/**\n * Get path to built-in themes directory (shipped with package)\n * - For Bun binary: theme/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/theme/\n * - For tsx (src/): src/modes/interactive/theme/\n */\nexport function getThemesDir(): string {\n\treturn resolveShippedAssetDir(THEMES_ASSET);\n}\n\n/**\n * Get path to HTML export template directory (shipped with package)\n * - For Bun binary: export-html/ next to executable\n * - For Node.js (dist/): dist/core/export-html/\n * - For tsx (src/): src/core/export-html/\n */\nexport function getExportTemplateDir(): string {\n\treturn resolveShippedAssetDir(EXPORT_TEMPLATE_ASSET);\n}\n\n/** Get path to package.json */\nexport function getPackageJsonPath(): string {\n\treturn join(getPackageDir(), \"package.json\");\n}\n\n/** Get path to README.md */\nexport function getReadmePath(): string {\n\treturn resolve(join(getPackageDir(), \"README.md\"));\n}\n\n/** Get path to docs directory */\nexport function getDocsPath(): string {\n\treturn resolve(join(getPackageDir(), \"docs\"));\n}\n\n/** Get path to examples directory */\nexport function getExamplesPath(): string {\n\treturn resolve(join(getPackageDir(), \"examples\"));\n}\n\n/** Get path to CHANGELOG.md */\nexport function getChangelogPath(): string {\n\treturn resolve(join(getPackageDir(), \"CHANGELOG.md\"));\n}\n\n/**\n * Get path to built-in interactive assets directory.\n * - For Bun binary: assets/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/assets/\n * - For tsx (src/): src/modes/interactive/assets/\n */\nexport function getInteractiveAssetsDir(): string {\n\treturn resolveShippedAssetDir(INTERACTIVE_ASSETS);\n}\n\n/** Get path to a bundled interactive asset */\nexport function getBundledInteractiveAssetPath(name: string): string {\n\treturn join(getInteractiveAssetsDir(), name);\n}\n\n// =============================================================================\n// App Config (from package.json piConfig)\n// =============================================================================\n\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\tpiConfig?: {\n\t\tname?: string;\n\t\tconfigDir?: string;\n\t};\n}\n\nlet pkg: PackageJson = {};\ntry {\n\tpkg = JSON.parse(stripBom(readFileSync(getPackageJsonPath(), \"utf-8\"))) as PackageJson;\n} catch (e: unknown) {\n\tconst err = e as NodeJS.ErrnoException;\n\tif (err.code !== \"ENOENT\") throw e;\n}\n\nconst piConfigName: string | undefined = pkg.piConfig?.name;\n\n/**\n * A distribution repackaging this engine injects its brand once. The profile is consumed\n * here - which also scrubs the variable - so every process spawned later inherits a clean\n * environment and keeps the engine's own identity.\n */\nexport const BRAND: BrandProfile | undefined = brandProfile();\n\nexport const PACKAGE_NAME: string = pkg.name || \"@earendil-works/pi-coding-agent\";\nexport const APP_NAME: string = BRAND?.name || piConfigName || \"pi\";\n/** Command-line name; brands whose binary differs from their display name set this. */\nexport const APP_COMMAND: string = BRAND?.command ?? APP_NAME;\nexport const APP_TITLE: string = BRAND?.name || (piConfigName ? APP_NAME : \"π\");\nexport const CONFIG_DIR_NAME: string = BRAND?.configDir || pkg.piConfig?.configDir || \".pi\";\n/** True when the brand stores agent state directly under the config dir, with no `agent` segment. */\nexport const CONFIG_FLAT_LAYOUT: boolean = BRAND?.flatLayout === true;\nexport const VERSION: string = pkg.version || \"0.0.0\";\n/** Version shown to users; VERSION stays the engine version used for update comparisons. */\nexport const DISPLAY_VERSION: string = BRAND?.displayVersion || VERSION;\n\n// e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR\n/** Primary environment prefix for this product; legacy prefixes stay readable. */\nexport const ENV_PREFIX: string = BRAND?.envPrefix || APP_NAME.toUpperCase();\nexport const ENV_AGENT_DIR = `${ENV_PREFIX}_CODING_AGENT_DIR`;\nexport const ENV_SESSION_DIR = `${ENV_PREFIX}_CODING_AGENT_SESSION_DIR`;\n\nexport function expandTildePath(path: string): string {\n\treturn normalizePath(path);\n}\n\nconst DEFAULT_SHARE_VIEWER_URL = \"https://pi.dev/session/\";\n\n/** Get the share viewer URL for a gist ID. */\nexport function getShareViewerUrl(gistId: string): string {\n\tconst baseUrl = envValue(\"SHARE_VIEWER_URL\") || DEFAULT_SHARE_VIEWER_URL;\n\treturn `${baseUrl}#${gistId}`;\n}\n\n// =============================================================================\n// User Config Paths (~/.senpi/agent/*)\n// =============================================================================\n\n/** Marker file that identifies a flat-layout config directory. */\nexport const FLAT_LAYOUT_SENTINEL = \"settings.json\";\n\n/**\n * Resolve the agent config directory from an explicit environment.\n *\n * A flat-layout brand keeps its state directly under the config directory, so it looks for\n * the settings file as proof rather than for an `agent` subdirectory - the config directory\n * name may also be used by unrelated project tooling.\n */\nexport function resolveAgentDir(cwd: string, homeDir: string, envDir?: string): string {\n\tif (envDir) {\n\t\treturn normalizePath(envDir, { homeDir });\n\t}\n\tif (CONFIG_FLAT_LAYOUT) {\n\t\tconst flatProjectDir = findNearestParentConfigDir(cwd, homeDir, CONFIG_DIR_NAME, undefined, FLAT_LAYOUT_SENTINEL);\n\t\treturn flatProjectDir ?? join(homeDir, CONFIG_DIR_NAME);\n\t}\n\tconst projectConfigDir = findNearestParentConfigDir(cwd, homeDir, CONFIG_DIR_NAME, \"agent\");\n\treturn projectConfigDir ? join(projectConfigDir, \"agent\") : join(homeDir, CONFIG_DIR_NAME, \"agent\");\n}\n\n/** Get the agent config directory (e.g., ~/.senpi/agent/) */\nexport function getAgentDir(): string {\n\treturn resolveAgentDir(process.cwd(), homedir(), envValue(\"CODING_AGENT_DIR\"));\n}\n\n/**\n * Short, display-only spelling of the agent directory for help text and tips, e.g.\n * `~/.omo` for a flat brand or `~/.senpi/agent` for the engine layout.\n */\nexport function agentDirLabel(): string {\n\treturn CONFIG_FLAT_LAYOUT ? `~/${CONFIG_DIR_NAME}` : `~/${CONFIG_DIR_NAME}/agent`;\n}\n\n/** Get path to user's custom themes directory */\nexport function getCustomThemesDir(): string {\n\treturn join(getAgentDir(), \"themes\");\n}\n\n/** Get path to models.json */\nexport function getModelsPath(): string {\n\treturn join(getAgentDir(), \"models.json\");\n}\n\n/** Get path to auth.json */\nexport function getAuthPath(): string {\n\treturn join(getAgentDir(), \"auth.json\");\n}\n\n/** Get path to settings.json */\nexport function getSettingsPath(): string {\n\treturn join(getAgentDir(), \"settings.json\");\n}\n\n/** Get path to tools directory */\nexport function getToolsDir(): string {\n\treturn join(getAgentDir(), \"tools\");\n}\n\n/** Get path to managed binaries directory (fd, rg) */\nexport function getBinDir(): string {\n\treturn join(getAgentDir(), \"bin\");\n}\n\n/** Get path to prompt templates directory */\nexport function getPromptsDir(): string {\n\treturn join(getAgentDir(), \"prompts\");\n}\n\n/** Get path to sessions directory */\nexport function getSessionsDir(): string {\n\treturn join(getAgentDir(), \"sessions\");\n}\n\n/** Get path to debug log file */\nexport function getDebugLogPath(): string {\n\treturn join(getAgentDir(), `${APP_NAME}-debug.log`);\n}\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAqB,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;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AAE,EAAE,GAAG,QAAQ,YAAY,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import { accessSync, constants, existsSync, readFileSync, realpathSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { basename, dirname, join, resolve, sep, win32 } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { createBunLauncherRepairCommand } from \"./bun-global-launcher.ts\";\nimport { type BrandProfile, brandProfile, envValue } from \"./core/brand.ts\";\nimport { findNearestParentConfigDir } from \"./nearest-parent-config.ts\";\nimport { resolveInstallPath } from \"./runtime-snapshot/marker.ts\";\nimport { spawnProcessSync } from \"./utils/child-process.ts\";\nimport { normalizePath } from \"./utils/paths.ts\";\nimport { stripBom } from \"./utils/text.ts\";\n\n// =============================================================================\n// Package Detection\n// =============================================================================\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Detect if we're running as a Bun compiled binary.\n * Bun binaries have import.meta.url containing \"$bunfs\", \"~BUN\", or \"%7EBUN\" (Bun's virtual filesystem path)\n */\nexport const isBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\n/** Detect if Bun is the runtime (compiled binary or bun run) */\nexport const isBunRuntime = !!process.versions.bun;\n\n/** Detect the esbuild-bundled Node.js distribution. */\ndeclare const PI_BUNDLED_NODE: boolean;\nexport const isBundledNode = typeof PI_BUNDLED_NODE !== \"undefined\" && PI_BUNDLED_NODE;\n\n// =============================================================================\n// Install Method Detection\n// =============================================================================\n\nexport type InstallMethod = \"bun-binary\" | \"npm\" | \"pnpm\" | \"yarn\" | \"bun\" | \"unknown\";\n\ninterface SelfUpdateCommandStep {\n\tcommand: string;\n\targs: string[];\n\tdisplay: string;\n}\n\nexport interface SelfUpdateCommand extends SelfUpdateCommandStep {\n\tsteps?: SelfUpdateCommandStep[];\n}\n\nexport type SelfUpdatePackageTarget = string | { packageName: string; installSpec?: string };\n\nfunction normalizeSelfUpdatePackageTarget(target: SelfUpdatePackageTarget): {\n\tpackageName: string;\n\tinstallSpec: string;\n} {\n\tif (typeof target === \"string\") {\n\t\treturn { packageName: target, installSpec: target };\n\t}\n\treturn { packageName: target.packageName, installSpec: target.installSpec ?? target.packageName };\n}\n\nfunction makeSelfUpdateCommand(\n\tinstallStep: SelfUpdateCommandStep,\n\tuninstallStep?: SelfUpdateCommandStep,\n\tpostInstallStep?: SelfUpdateCommandStep,\n): SelfUpdateCommand {\n\tconst steps = [\n\t\t...(uninstallStep ? [uninstallStep] : []),\n\t\tinstallStep,\n\t\t...(postInstallStep ? [postInstallStep] : []),\n\t];\n\tif (steps.length === 1) return installStep;\n\treturn {\n\t\t...installStep,\n\t\tdisplay: steps.map((step) => step.display).join(\" && \"),\n\t\tsteps,\n\t};\n}\n\nfunction makeSelfUpdateCommandStep(command: string, args: string[]): SelfUpdateCommandStep {\n\treturn {\n\t\tcommand,\n\t\targs,\n\t\tdisplay: [command, ...args].map((arg) => (/\\s/.test(arg) ? `\"${arg}\"` : arg)).join(\" \"),\n\t};\n}\n\nexport function detectInstallMethod(): InstallMethod {\n\tif (isBunBinary) {\n\t\treturn \"bun-binary\";\n\t}\n\n\tconst moduleDir = resolveInstallPath(__dirname, findNodePackageDir(__dirname));\n\tconst resolvedPath = `${moduleDir}\\0${process.execPath || \"\"}`.toLowerCase().replace(/\\\\/g, \"/\");\n\n\tif (resolvedPath.includes(\"/pnpm/\") || resolvedPath.includes(\"/.pnpm/\")) {\n\t\treturn \"pnpm\";\n\t}\n\tif (resolvedPath.includes(\"/yarn/\") || resolvedPath.includes(\"/.yarn/\")) {\n\t\treturn \"yarn\";\n\t}\n\tif (isBunRuntime || resolvedPath.includes(\"/install/global/node_modules/\")) {\n\t\treturn \"bun\";\n\t}\n\tif (resolvedPath.includes(\"/npm/\") || resolvedPath.includes(\"/node_modules/\")) {\n\t\treturn \"npm\";\n\t}\n\n\treturn \"unknown\";\n}\n\nfunction getInferredNpmInstall(): { root: string; prefix: string } | undefined {\n\tconst packageDir = getInstallPackageDir();\n\tconst path = process.platform === \"win32\" || packageDir.includes(\"\\\\\") ? win32 : { basename, dirname };\n\tconst parent = path.dirname(packageDir);\n\tlet root: string | undefined;\n\tif (path.basename(parent).startsWith(\"@\") && path.basename(path.dirname(parent)) === \"node_modules\") {\n\t\troot = path.dirname(parent);\n\t} else if (path.basename(parent) === \"node_modules\") {\n\t\troot = parent;\n\t}\n\tif (!root) return undefined;\n\tconst rootParent = path.dirname(root);\n\tif (path.basename(rootParent) === \"lib\") return { root, prefix: path.dirname(rootParent) };\n\t// Windows global npm prefixes use `<prefix>\\\\node_modules`, which is\n\t// indistinguishable from local project installs by path shape alone. Do not\n\t// infer unsupported Windows custom prefixes without `npm root -g` evidence.\n\treturn undefined;\n}\n\nfunction getSelfUpdateCommandForMethod(\n\tmethod: InstallMethod,\n\tinstalledPackageName: string,\n\tupdatePackageTarget: SelfUpdatePackageTarget = installedPackageName,\n\tnpmCommand?: string[],\n): SelfUpdateCommand | undefined {\n\tconst target = normalizeSelfUpdatePackageTarget(updatePackageTarget);\n\tswitch (method) {\n\t\tcase \"bun-binary\":\n\t\t\treturn undefined;\n\t\tcase \"pnpm\": {\n\t\t\tconst match = readCommandOutput(\"pnpm\", [\"root\", \"-g\"])\n\t\t\t\t? undefined\n\t\t\t\t: /^(.*[\\\\/]global[\\\\/][^\\\\/]+)[\\\\/]\\.pnpm[\\\\/]/.exec(getInstallPackageDir());\n\t\t\tconst binDirArgs = match\n\t\t\t\t? [`--config.global-bin-dir=${process.env.PNPM_HOME || dirname(dirname(match[1]))}`]\n\t\t\t\t: [];\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"pnpm\", [\n\t\t\t\t\t\"install\",\n\t\t\t\t\t\"-g\",\n\t\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\t\"--config.minimumReleaseAge=0\",\n\t\t\t\t\t...binDirArgs,\n\t\t\t\t\ttarget.installSpec,\n\t\t\t\t]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"pnpm\", [\"remove\", \"-g\", ...binDirArgs, installedPackageName]),\n\t\t\t);\n\t\t}\n\t\tcase \"yarn\":\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"yarn\", [\"global\", \"add\", \"--ignore-scripts\", target.installSpec]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"yarn\", [\"global\", \"remove\", installedPackageName]),\n\t\t\t);\n\t\tcase \"bun\": {\n\t\t\tconst binDir = readCommandOutput(\"bun\", [\"pm\", \"bin\", \"-g\"]);\n\t\t\tif (!binDir) return undefined;\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"bun\", [\n\t\t\t\t\t\"install\",\n\t\t\t\t\t\"-g\",\n\t\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\t\"--minimum-release-age=0\",\n\t\t\t\t\ttarget.installSpec,\n\t\t\t\t]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"bun\", [\"uninstall\", \"-g\", installedPackageName]),\n\t\t\t\tprocess.platform === \"win32\"\n\t\t\t\t\t? undefined\n\t\t\t\t\t: createBunLauncherRepairCommand(binDir, target.packageName, APP_NAME),\n\t\t\t);\n\t\t}\n\t\tcase \"npm\": {\n\t\t\tconst [command = \"npm\", ...npmArgs] = npmCommand ?? [];\n\t\t\tconst inferred = npmCommand?.length ? undefined : getInferredNpmInstall();\n\t\t\tconst prefixArgs = [...npmArgs, ...(inferred ? [\"--prefix\", inferred.prefix] : [])];\n\t\t\tconst installStep = makeSelfUpdateCommandStep(command, [\n\t\t\t\t...prefixArgs,\n\t\t\t\t\"install\",\n\t\t\t\t\"-g\",\n\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\"--min-release-age=0\",\n\t\t\t\ttarget.installSpec,\n\t\t\t]);\n\t\t\tconst uninstallStep =\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(command, [...prefixArgs, \"uninstall\", \"-g\", installedPackageName]);\n\t\t\treturn makeSelfUpdateCommand(installStep, uninstallStep);\n\t\t}\n\t\tcase \"unknown\":\n\t\t\treturn undefined;\n\t}\n}\n\nfunction readCommandOutput(\n\tcommand: string,\n\targs: string[],\n\toptions: { requireSuccess?: boolean } = {},\n): string | undefined {\n\tconst result = spawnProcessSync(command, args, {\n\t\tencoding: \"utf-8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t});\n\tif (result.status === 0) return result.stdout.trim() || undefined;\n\tif (options.requireSuccess) {\n\t\tconst reason = result.error?.message || result.stderr.trim() || `exit code ${result.status ?? \"unknown\"}`;\n\t\tthrow new Error(`Failed to run ${[command, ...args].join(\" \")}: ${reason}`);\n\t}\n\treturn undefined;\n}\n\nfunction getGlobalPackageRoots(method: InstallMethod, _packageName: string, npmCommand?: string[]): string[] {\n\tswitch (method) {\n\t\tcase \"npm\": {\n\t\t\tconst configured = !!npmCommand?.length;\n\t\t\tconst [command = \"npm\", ...npmArgs] = npmCommand ?? [];\n\t\t\tif (configured && command === \"bun\") {\n\t\t\t\tconst bunBin = readCommandOutput(command, [...npmArgs, \"pm\", \"bin\", \"-g\"], {\n\t\t\t\t\trequireSuccess: true,\n\t\t\t\t});\n\t\t\t\tconst roots = [join(homedir(), \".bun\", \"install\", \"global\", \"node_modules\")];\n\t\t\t\tif (bunBin) {\n\t\t\t\t\troots.push(join(dirname(bunBin), \"install\", \"global\", \"node_modules\"));\n\t\t\t\t}\n\t\t\t\treturn roots;\n\t\t\t}\n\t\t\tconst root = readCommandOutput(command, [...npmArgs, \"root\", \"-g\"], {\n\t\t\t\trequireSuccess: configured,\n\t\t\t});\n\t\t\tconst inferred = configured ? undefined : getInferredNpmInstall();\n\t\t\treturn [root, inferred?.root].filter((x): x is string => !!x);\n\t\t}\n\t\tcase \"pnpm\": {\n\t\t\tconst root = readCommandOutput(\"pnpm\", [\"root\", \"-g\"]);\n\t\t\tif (root) return [root, dirname(root)];\n\t\t\tconst match = /^(.*[\\\\/]global[\\\\/][^\\\\/]+)[\\\\/]\\.pnpm[\\\\/]/.exec(getInstallPackageDir());\n\t\t\treturn match ? [match[1]] : [];\n\t\t}\n\t\tcase \"yarn\": {\n\t\t\tconst dir = readCommandOutput(\"yarn\", [\"global\", \"dir\"]);\n\t\t\treturn dir ? [dir, join(dir, \"node_modules\")] : [];\n\t\t}\n\t\tcase \"bun\": {\n\t\t\tconst bunBin = readCommandOutput(\"bun\", [\"pm\", \"bin\", \"-g\"]);\n\t\t\tconst roots = [join(homedir(), \".bun\", \"install\", \"global\", \"node_modules\")];\n\t\t\tif (bunBin) {\n\t\t\t\troots.push(join(dirname(bunBin), \"install\", \"global\", \"node_modules\"));\n\t\t\t}\n\t\t\treturn roots;\n\t\t}\n\t\tcase \"bun-binary\":\n\t\tcase \"unknown\":\n\t\t\treturn [];\n\t}\n}\n\nfunction normalizeExistingPathForComparison(path: string, resolveSymlinks: boolean): string | undefined {\n\tconst resolvedPath = resolve(path);\n\tif (!existsSync(resolvedPath)) {\n\t\treturn undefined;\n\t}\n\tlet normalizedPath = resolvedPath;\n\tif (resolveSymlinks) {\n\t\ttry {\n\t\t\tnormalizedPath = realpathSync(resolvedPath);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\tif (process.platform === \"win32\") {\n\t\tnormalizedPath = normalizedPath.toLowerCase();\n\t}\n\treturn normalizedPath;\n}\n\nfunction getPathComparisonCandidates(path: string): string[] {\n\treturn Array.from(\n\t\tnew Set(\n\t\t\t[normalizeExistingPathForComparison(path, false), normalizeExistingPathForComparison(path, true)].filter(\n\t\t\t\t(candidate): candidate is string => !!candidate,\n\t\t\t),\n\t\t),\n\t);\n}\n\nfunction getEntrypointPackageDir(): string | undefined {\n\tconst entrypoint = process.argv[1];\n\tif (!entrypoint) return undefined;\n\tlet dir = dirname(entrypoint);\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\treturn undefined;\n}\n\nfunction isSelfUpdatePathWritable(): boolean {\n\tconst packageDir = getInstallPackageDir();\n\ttry {\n\t\taccessSync(packageDir, constants.W_OK);\n\t\taccessSync(dirname(packageDir), constants.W_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction isManagedByGlobalPackageManager(method: InstallMethod, packageName: string, npmCommand?: string[]): boolean {\n\tconst packageDirs = [getInstallPackageDir(), getEntrypointPackageDir()].filter((dir): dir is string => !!dir);\n\tconst packageDirCandidates = packageDirs.flatMap((dir) => getPathComparisonCandidates(dir));\n\treturn getGlobalPackageRoots(method, packageName, npmCommand).some((root) => {\n\t\treturn getPathComparisonCandidates(root).some((normalizedRoot) => {\n\t\t\tconst rootPrefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\t\treturn packageDirCandidates.some((packageDir) => packageDir.startsWith(rootPrefix));\n\t\t});\n\t});\n}\n\nexport function getSelfUpdateCommand(\n\tpackageName: string,\n\tnpmCommand?: string[],\n\tupdatePackageTarget: SelfUpdatePackageTarget = packageName,\n): SelfUpdateCommand | undefined {\n\tconst method = detectInstallMethod();\n\tconst command = getSelfUpdateCommandForMethod(method, packageName, updatePackageTarget, npmCommand);\n\tif (!command || !isManagedByGlobalPackageManager(method, packageName, npmCommand) || !isSelfUpdatePathWritable()) {\n\t\treturn undefined;\n\t}\n\treturn command;\n}\n\nexport function getSelfUpdateUnavailableInstruction(\n\tpackageName: string,\n\tnpmCommand?: string[],\n\tupdatePackageTarget: SelfUpdatePackageTarget = packageName,\n): string {\n\tconst method = detectInstallMethod();\n\tconst target = normalizeSelfUpdatePackageTarget(updatePackageTarget);\n\tif (method === \"bun-binary\") {\n\t\treturn `Download from: https://github.com/code-yeongyu/senpi/releases/latest`;\n\t}\n\tconst command = getSelfUpdateCommandForMethod(method, packageName, target, npmCommand);\n\tif (command) {\n\t\tif (isManagedByGlobalPackageManager(method, packageName, npmCommand) && !isSelfUpdatePathWritable()) {\n\t\t\treturn `This installation is managed by a global ${method} install, but the install path is not writable. Update it yourself with: ${command.display}`;\n\t\t}\n\t\treturn `This installation is not managed by a global ${method} install. Update it with the package manager, wrapper, or source checkout that provides it.`;\n\t}\n\treturn `Update ${target.installSpec} using the package manager, wrapper, or source checkout that provides this installation.`;\n}\n\nexport function getUpdateInstruction(packageName: string): string {\n\tconst method = detectInstallMethod();\n\tconst command = getSelfUpdateCommandForMethod(method, packageName);\n\tif (command) {\n\t\treturn `Run: ${command.display}`;\n\t}\n\treturn getSelfUpdateUnavailableInstruction(packageName);\n}\n\n// =============================================================================\n// Package Asset Paths (shipped with executable)\n// =============================================================================\n\n/**\n * Get the base directory for resolving package assets (themes, package.json, README.md, CHANGELOG.md).\n * - For Bun binary: returns the directory containing the executable\n * - For Node.js and tsx: returns the package root containing package.json\n * - Ignores Bun binary metadata copied into dist/ when the package root is available\n */\nexport function findNodePackageDir(startDir: string): string {\n\tlet dir = startDir;\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\tconst parent = dirname(dir);\n\t\t\t// build:binary places Bun's metadata inside dist/. Node still needs the\n\t\t\t// package root so its dist-relative asset paths do not become dist/dist/.\n\t\t\tif (basename(dir) === \"dist\" && existsSync(join(parent, \"package.json\"))) {\n\t\t\t\treturn parent;\n\t\t\t}\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\treturn startDir;\n}\n\nexport function getPackageDir(): string {\n\t// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)\n\tconst envDir = envValue(\"PACKAGE_DIR\");\n\tif (envDir) {\n\t\treturn normalizePath(envDir);\n\t}\n\n\tif (isBunBinary) {\n\t\t// Bun binary: process.execPath points to the compiled executable\n\t\treturn dirname(process.execPath);\n\t}\n\treturn findNodePackageDir(__dirname);\n}\n\n/**\n * Where the package manager installed this package. Equals `getPackageDir()` except in a process\n * running from its runtime snapshot (`runtime-snapshot/`), whose assets live in the snapshot.\n */\nexport function getInstallPackageDir(): string {\n\tconst packageDir = getPackageDir();\n\treturn resolveInstallPath(packageDir, packageDir);\n}\n\n/** One asset directory shipped with the package, in both the Bun-binary and Node layouts. */\ninterface ShippedAsset {\n\t/** Directory name next to a compiled Bun binary. */\n\treadonly binaryDir: string;\n\t/** Path segments under the package's src/ or dist/ root. */\n\treadonly sourceSegments: readonly string[];\n\t/** A file the directory must contain; a root without it does not ship this asset. */\n\treadonly probe: string;\n}\n\nconst THEMES_ASSET: ShippedAsset = {\n\tbinaryDir: \"theme\",\n\tsourceSegments: [\"modes\", \"interactive\", \"theme\"],\n\tprobe: \"dark.json\",\n};\n\nconst EXPORT_TEMPLATE_ASSET: ShippedAsset = {\n\tbinaryDir: \"export-html\",\n\tsourceSegments: [\"core\", \"export-html\"],\n\tprobe: \"template.html\",\n};\n\nconst INTERACTIVE_ASSETS: ShippedAsset = {\n\tbinaryDir: \"assets\",\n\tsourceSegments: [\"modes\", \"interactive\", \"assets\"],\n\tprobe: \"clankolas.png\",\n};\n\nfunction assetDirIn(root: string, asset: ShippedAsset): string {\n\tif (isBunBinary) {\n\t\treturn join(root, asset.binaryDir);\n\t}\n\tconst srcOrDist = existsSync(join(root, \"src\")) ? \"src\" : \"dist\";\n\treturn join(root, srcOrDist, ...asset.sourceSegments);\n}\n\n/**\n * Resolve a shipped asset directory, preferring PACKAGE_DIR but never trusting it blindly.\n *\n * PACKAGE_DIR relocates the package root (Nix/Guix store paths), and a Bun binary that embeds this\n * CLI pins it to the binary's own root. When such a root is inherited by a Node install of the CLI,\n * the Node layout resolves under it to a directory that cannot exist and startup dies on ENOENT\n * (an omo binary keeps its themes in a flat theme/, so the inherited root has no dist/ tree at all).\n * Fall back to the running install whenever the preferred root does not actually ship the asset. When\n * neither ships it the install is genuinely broken, and the running install's own path is returned so\n * the resulting error names the tree that was supposed to carry the asset rather than a foreign root.\n */\nfunction resolveShippedAssetDir(asset: ShippedAsset): string {\n\tconst preferred = assetDirIn(getPackageDir(), asset);\n\tif (existsSync(join(preferred, asset.probe))) {\n\t\treturn preferred;\n\t}\n\treturn assetDirIn(isBunBinary ? dirname(process.execPath) : findNodePackageDir(__dirname), asset);\n}\n\n/**\n * Get path to built-in themes directory (shipped with package)\n * - For Bun binary: theme/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/theme/\n * - For tsx (src/): src/modes/interactive/theme/\n */\nexport function getThemesDir(): string {\n\treturn resolveShippedAssetDir(THEMES_ASSET);\n}\n\n/**\n * Get path to HTML export template directory (shipped with package)\n * - For Bun binary: export-html/ next to executable\n * - For Node.js (dist/): dist/core/export-html/\n * - For tsx (src/): src/core/export-html/\n */\nexport function getExportTemplateDir(): string {\n\treturn resolveShippedAssetDir(EXPORT_TEMPLATE_ASSET);\n}\n\n/** Get path to package.json */\nexport function getPackageJsonPath(): string {\n\treturn join(getPackageDir(), \"package.json\");\n}\n\n/** Get path to README.md */\nexport function getReadmePath(): string {\n\treturn resolve(join(getPackageDir(), \"README.md\"));\n}\n\n/** Get path to docs directory */\nexport function getDocsPath(): string {\n\treturn resolve(join(getPackageDir(), \"docs\"));\n}\n\n/** Get path to examples directory */\nexport function getExamplesPath(): string {\n\treturn resolve(join(getPackageDir(), \"examples\"));\n}\n\n/** Get path to CHANGELOG.md */\nexport function getChangelogPath(): string {\n\treturn resolve(join(getPackageDir(), \"CHANGELOG.md\"));\n}\n\n/**\n * Get path to built-in interactive assets directory.\n * - For Bun binary: assets/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/assets/\n * - For tsx (src/): src/modes/interactive/assets/\n */\nexport function getInteractiveAssetsDir(): string {\n\treturn resolveShippedAssetDir(INTERACTIVE_ASSETS);\n}\n\n/** Get path to a bundled interactive asset */\nexport function getBundledInteractiveAssetPath(name: string): string {\n\treturn join(getInteractiveAssetsDir(), name);\n}\n\n// =============================================================================\n// App Config (from package.json piConfig)\n// =============================================================================\n\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\tpiConfig?: {\n\t\tname?: string;\n\t\tconfigDir?: string;\n\t};\n}\n\nlet pkg: PackageJson = {};\ntry {\n\tpkg = JSON.parse(stripBom(readFileSync(getPackageJsonPath(), \"utf-8\"))) as PackageJson;\n} catch (e: unknown) {\n\tconst err = e as NodeJS.ErrnoException;\n\tif (err.code !== \"ENOENT\") throw e;\n}\n\nconst piConfigName: string | undefined = pkg.piConfig?.name;\n\n/**\n * A distribution repackaging this engine injects its brand once. The profile is consumed\n * here - which also scrubs the variable - so every process spawned later inherits a clean\n * environment and keeps the engine's own identity.\n */\nexport const BRAND: BrandProfile | undefined = brandProfile();\n\nexport const PACKAGE_NAME: string = pkg.name || \"@earendil-works/pi-coding-agent\";\nexport const APP_NAME: string = BRAND?.name || piConfigName || \"pi\";\n/** Command-line name; brands whose binary differs from their display name set this. */\nexport const APP_COMMAND: string = BRAND?.command ?? APP_NAME;\nexport const APP_TITLE: string = BRAND?.name || (piConfigName ? APP_NAME : \"π\");\nexport const CONFIG_DIR_NAME: string = BRAND?.configDir || pkg.piConfig?.configDir || \".pi\";\n/** True when the brand stores agent state directly under the config dir, with no `agent` segment. */\nexport const CONFIG_FLAT_LAYOUT: boolean = BRAND?.flatLayout === true;\nexport const VERSION: string = pkg.version || \"0.0.0\";\n/** Version shown to users; VERSION stays the engine version used for update comparisons. */\nexport const DISPLAY_VERSION: string = BRAND?.displayVersion || VERSION;\n\n// e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR\n/** Primary environment prefix for this product; legacy prefixes stay readable. */\nexport const ENV_PREFIX: string = BRAND?.envPrefix || APP_NAME.toUpperCase();\nexport const ENV_AGENT_DIR = `${ENV_PREFIX}_CODING_AGENT_DIR`;\nexport const ENV_SESSION_DIR = `${ENV_PREFIX}_CODING_AGENT_SESSION_DIR`;\n\nexport function expandTildePath(path: string): string {\n\treturn normalizePath(path);\n}\n\nconst DEFAULT_SHARE_VIEWER_URL = \"https://pi.dev/session/\";\n\n/** Get the share viewer URL for a gist ID. */\nexport function getShareViewerUrl(gistId: string): string {\n\tconst baseUrl = envValue(\"SHARE_VIEWER_URL\") || DEFAULT_SHARE_VIEWER_URL;\n\treturn `${baseUrl}#${gistId}`;\n}\n\n// =============================================================================\n// User Config Paths (~/.senpi/agent/*)\n// =============================================================================\n\n/** Marker file that identifies a flat-layout config directory. */\nexport const FLAT_LAYOUT_SENTINEL = \"settings.json\";\n\n/**\n * Resolve the agent config directory from an explicit environment.\n *\n * A flat-layout brand keeps its state directly under the config directory, so it looks for\n * the settings file as proof rather than for an `agent` subdirectory - the config directory\n * name may also be used by unrelated project tooling.\n */\nexport function resolveAgentDir(cwd: string, homeDir: string, envDir?: string): string {\n\tif (envDir) {\n\t\treturn normalizePath(envDir, { homeDir });\n\t}\n\tif (CONFIG_FLAT_LAYOUT) {\n\t\tconst flatProjectDir = findNearestParentConfigDir(cwd, homeDir, CONFIG_DIR_NAME, undefined, FLAT_LAYOUT_SENTINEL);\n\t\treturn flatProjectDir ?? join(homeDir, CONFIG_DIR_NAME);\n\t}\n\tconst projectConfigDir = findNearestParentConfigDir(cwd, homeDir, CONFIG_DIR_NAME, \"agent\");\n\treturn projectConfigDir ? join(projectConfigDir, \"agent\") : join(homeDir, CONFIG_DIR_NAME, \"agent\");\n}\n\n/** Get the agent config directory (e.g., ~/.senpi/agent/) */\nexport function getAgentDir(): string {\n\treturn resolveAgentDir(process.cwd(), homedir(), envValue(\"CODING_AGENT_DIR\"));\n}\n\n/**\n * Short, display-only spelling of the agent directory for help text and tips, e.g.\n * `~/.omo` for a flat brand or `~/.senpi/agent` for the engine layout.\n */\nexport function agentDirLabel(): string {\n\treturn CONFIG_FLAT_LAYOUT ? `~/${CONFIG_DIR_NAME}` : `~/${CONFIG_DIR_NAME}/agent`;\n}\n\n/** Get path to user's custom themes directory */\nexport function getCustomThemesDir(): string {\n\treturn join(getAgentDir(), \"themes\");\n}\n\n/** Get path to models.json */\nexport function getModelsPath(): string {\n\treturn join(getAgentDir(), \"models.json\");\n}\n\n/** Get path to auth.json */\nexport function getAuthPath(): string {\n\treturn join(getAgentDir(), \"auth.json\");\n}\n\n/** Get path to settings.json */\nexport function getSettingsPath(): string {\n\treturn join(getAgentDir(), \"settings.json\");\n}\n\n/** Get path to tools directory */\nexport function getToolsDir(): string {\n\treturn join(getAgentDir(), \"tools\");\n}\n\n/** Get path to managed binaries directory (fd, rg) */\nexport function getBinDir(): string {\n\treturn join(getAgentDir(), \"bin\");\n}\n\n/** Get path to prompt templates directory */\nexport function getPromptsDir(): string {\n\treturn join(getAgentDir(), \"prompts\");\n}\n\n/** Get path to sessions directory */\nexport function getSessionsDir(): string {\n\treturn join(getAgentDir(), \"sessions\");\n}\n\n/** Get path to debug log file */\nexport function getDebugLogPath(): string {\n\treturn join(getAgentDir(), `${APP_NAME}-debug.log`);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAQH,OAAO,EAAE,KAAK,IAAI,EAAgF,MAAM,eAAe,CAAC;AAmCxH,OAAO,EACN,6BAA6B,EAG7B,MAAM,oCAAoC,CAAC;AAI5C,OAAO,EACN,KAAK,6BAA6B,EAGlC,MAAM,kCAAkC,CAAC;AAM1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAQlE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,EAAE,KAAK,OAAO,EAAyB,MAAM,yBAAyB,CAAC;AAS9E,OAAO,EAAwB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGjF,OAAO,EA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G,OAAO,CAAC,OAAO,CAAC,CAmBrE;AAmGD,wBAAsB,oBAAoB,CACzC,MAAM,EAAE,IAAI,EACZ,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,OAAO,GACd,OAAO,CAAC,cAAc,CAAC,CAqJzB;AA0HD,MAAM,WAAW,WAAW;IAC3B,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI,CAYhF;AAED,MAAM,WAAW,uBAAuB;IACvC,MAAM,EAAE,IAAI,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,kGAAkG;AAClG,wBAAgB,uBAAuB,CACtC,aAAa,EAAE,uBAAuB,EACtC,KAAK,GAAE;IACN,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,uBAAuB,CAAC,EAAE,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC;IAC3E;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CACvB,GACJ,wBAAwB,CAkO1B;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,iBA0f/D"}
package/dist/main.js CHANGED
@@ -28,7 +28,7 @@ import { isModelsDiscoverCommand, runModelsDiscoverCommand } from "./cli/models-
28
28
  import { createProjectTrustContext } from "./cli/project-trust.js";
29
29
  import { createStartupLoadingIndicator, pauseIndicatorDuringPrompts, shouldShowStartupLoadingIndicator, } from "./cli/startup-loading-indicator.js";
30
30
  import { shouldRunFirstTimeSetup, showFirstTimeSetup, showStartupSelector } from "./cli/startup-ui.js";
31
- import { APP_NAME, DISPLAY_VERSION, ENV_SESSION_DIR, expandTildePath, getAgentDir, getPackageDir } from "./config.js";
31
+ import { APP_NAME, DISPLAY_VERSION, ENV_SESSION_DIR, expandTildePath, getAgentDir, getInstallPackageDir, } from "./config.js";
32
32
  import { createAgentSessionRuntime } from "./core/agent-session-runtime.js";
33
33
  import { createAgentSessionFromServices, createAgentSessionServices, } from "./core/agent-session-services.js";
34
34
  import { formatNoModelsAvailableMessage } from "./core/auth-guidance.js";
@@ -846,7 +846,7 @@ export async function main(args, options) {
846
846
  return;
847
847
  }
848
848
  if (process.platform === "win32") {
849
- cleanupWindowsSelfUpdateQuarantine(getPackageDir());
849
+ cleanupWindowsSelfUpdateQuarantine(getInstallPackageDir());
850
850
  }
851
851
  const cwd = process.cwd();
852
852
  const agentDir = getAgentDir();