@code-yeongyu/senpi 2026.8.10 → 2026.8.11-2

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 (203) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/brand-dir-migration.d.ts +28 -0
  3. package/dist/brand-dir-migration.d.ts.map +1 -0
  4. package/dist/brand-dir-migration.js +77 -0
  5. package/dist/brand-dir-migration.js.map +1 -0
  6. package/dist/cli/grok-neo-gate.d.ts +0 -8
  7. package/dist/cli/grok-neo-gate.d.ts.map +1 -1
  8. package/dist/cli/grok-neo-gate.js +4 -2
  9. package/dist/cli/grok-neo-gate.js.map +1 -1
  10. package/dist/cli-main.js +3 -0
  11. package/dist/cli-main.js.map +1 -1
  12. package/dist/cli.js +2 -2
  13. package/dist/cli.js.map +1 -1
  14. package/dist/config.d.ts +27 -1
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +41 -9
  17. package/dist/config.js.map +1 -1
  18. package/dist/core/agent-session.d.ts.map +1 -1
  19. package/dist/core/agent-session.js +2 -1
  20. package/dist/core/agent-session.js.map +1 -1
  21. package/dist/core/brand.d.ts +79 -0
  22. package/dist/core/brand.d.ts.map +1 -0
  23. package/dist/core/brand.js +141 -0
  24. package/dist/core/brand.js.map +1 -0
  25. package/dist/core/dynamic-prompt/identity.d.ts.map +1 -1
  26. package/dist/core/dynamic-prompt/identity.js +2 -1
  27. package/dist/core/dynamic-prompt/identity.js.map +1 -1
  28. package/dist/core/experimental.d.ts.map +1 -1
  29. package/dist/core/experimental.js +2 -1
  30. package/dist/core/experimental.js.map +1 -1
  31. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.d.ts.map +1 -1
  32. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js +10 -1
  33. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js.map +1 -1
  34. package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
  35. package/dist/core/extensions/builtin/compaction/log.js +2 -1
  36. package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
  37. package/dist/core/extensions/builtin/config-reload/generated-shim-filter.d.ts.map +1 -1
  38. package/dist/core/extensions/builtin/config-reload/generated-shim-filter.js +4 -4
  39. package/dist/core/extensions/builtin/config-reload/generated-shim-filter.js.map +1 -1
  40. package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
  41. package/dist/core/extensions/builtin/goal/index.js +5 -0
  42. package/dist/core/extensions/builtin/goal/index.js.map +1 -1
  43. package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts +2 -2
  44. package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts.map +1 -1
  45. package/dist/core/extensions/builtin/goal/lifecycle-helpers.js +3 -3
  46. package/dist/core/extensions/builtin/goal/lifecycle-helpers.js.map +1 -1
  47. package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
  48. package/dist/core/extensions/builtin/goal/monitor-continuation.js +6 -0
  49. package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
  50. package/dist/core/extensions/builtin/goal/store.d.ts +3 -2
  51. package/dist/core/extensions/builtin/goal/store.d.ts.map +1 -1
  52. package/dist/core/extensions/builtin/goal/store.js +128 -101
  53. package/dist/core/extensions/builtin/goal/store.js.map +1 -1
  54. package/dist/core/extensions/builtin/help/index.d.ts.map +1 -1
  55. package/dist/core/extensions/builtin/help/index.js +3 -2
  56. package/dist/core/extensions/builtin/help/index.js.map +1 -1
  57. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.d.ts.map +1 -1
  58. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js +2 -1
  59. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js.map +1 -1
  60. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.d.ts.map +1 -1
  61. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js +2 -1
  62. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js.map +1 -1
  63. package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.d.ts.map +1 -1
  64. package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js +2 -1
  65. package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js.map +1 -1
  66. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
  67. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +2 -1
  68. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
  69. package/dist/core/extensions/builtin/prompt-preset/grok-4.5.d.ts.map +1 -1
  70. package/dist/core/extensions/builtin/prompt-preset/grok-4.5.js +6 -5
  71. package/dist/core/extensions/builtin/prompt-preset/grok-4.5.js.map +1 -1
  72. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -1
  73. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +2 -1
  74. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
  75. package/dist/core/footer-data-provider.d.ts +1 -4
  76. package/dist/core/footer-data-provider.d.ts.map +1 -1
  77. package/dist/core/footer-data-provider.js +0 -7
  78. package/dist/core/footer-data-provider.js.map +1 -1
  79. package/dist/core/generated-shim-banner.d.ts +15 -0
  80. package/dist/core/generated-shim-banner.d.ts.map +1 -0
  81. package/dist/core/generated-shim-banner.js +26 -0
  82. package/dist/core/generated-shim-banner.js.map +1 -0
  83. package/dist/core/model-runtime.d.ts.map +1 -1
  84. package/dist/core/model-runtime.js +7 -3
  85. package/dist/core/model-runtime.js.map +1 -1
  86. package/dist/core/package-manager.d.ts.map +1 -1
  87. package/dist/core/package-manager.js +2 -1
  88. package/dist/core/package-manager.js.map +1 -1
  89. package/dist/core/resource-loader.d.ts.map +1 -1
  90. package/dist/core/resource-loader.js +3 -5
  91. package/dist/core/resource-loader.js.map +1 -1
  92. package/dist/core/session-log.d.ts.map +1 -1
  93. package/dist/core/session-log.js +4 -2
  94. package/dist/core/session-log.js.map +1 -1
  95. package/dist/core/settings-manager.d.ts.map +1 -1
  96. package/dist/core/settings-manager.js +3 -2
  97. package/dist/core/settings-manager.js.map +1 -1
  98. package/dist/core/telemetry.d.ts.map +1 -1
  99. package/dist/core/telemetry.js +2 -1
  100. package/dist/core/telemetry.js.map +1 -1
  101. package/dist/core/timings.d.ts +0 -4
  102. package/dist/core/timings.d.ts.map +1 -1
  103. package/dist/core/timings.js +2 -1
  104. package/dist/core/timings.js.map +1 -1
  105. package/dist/inspector-policy.d.ts.map +1 -1
  106. package/dist/inspector-policy.js +2 -1
  107. package/dist/inspector-policy.js.map +1 -1
  108. package/dist/main.d.ts.map +1 -1
  109. package/dist/main.js +5 -4
  110. package/dist/main.js.map +1 -1
  111. package/dist/migrations.d.ts.map +1 -1
  112. package/dist/migrations.js +4 -0
  113. package/dist/migrations.js.map +1 -1
  114. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  115. package/dist/modes/interactive/components/footer.js +1 -8
  116. package/dist/modes/interactive/components/footer.js.map +1 -1
  117. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  118. package/dist/modes/interactive/interactive-mode.js +6 -7
  119. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  120. package/dist/modes/interactive/tips/catalog/cli-tips.d.ts.map +1 -1
  121. package/dist/modes/interactive/tips/catalog/cli-tips.js +2 -1
  122. package/dist/modes/interactive/tips/catalog/cli-tips.js.map +1 -1
  123. package/dist/modes/interactive/tips/catalog/ethos-tips.d.ts.map +1 -1
  124. package/dist/modes/interactive/tips/catalog/ethos-tips.js +4 -3
  125. package/dist/modes/interactive/tips/catalog/ethos-tips.js.map +1 -1
  126. package/dist/modes/interactive/tips/catalog/model-tips.d.ts.map +1 -1
  127. package/dist/modes/interactive/tips/catalog/model-tips.js +2 -1
  128. package/dist/modes/interactive/tips/catalog/model-tips.js.map +1 -1
  129. package/dist/modes/interactive/tips/catalog/session-tips.d.ts.map +1 -1
  130. package/dist/modes/interactive/tips/catalog/session-tips.js +2 -1
  131. package/dist/modes/interactive/tips/catalog/session-tips.js.map +1 -1
  132. package/dist/modes/interactive/tips/catalog/settings-tips.d.ts.map +1 -1
  133. package/dist/modes/interactive/tips/catalog/settings-tips.js +3 -2
  134. package/dist/modes/interactive/tips/catalog/settings-tips.js.map +1 -1
  135. package/dist/modes/interactive/tips/catalog/workspace-tips.d.ts.map +1 -1
  136. package/dist/modes/interactive/tips/catalog/workspace-tips.js +4 -3
  137. package/dist/modes/interactive/tips/catalog/workspace-tips.js.map +1 -1
  138. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  139. package/dist/modes/rpc/rpc-mode.js +2 -1
  140. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  141. package/dist/nearest-parent-config.d.ts +6 -1
  142. package/dist/nearest-parent-config.d.ts.map +1 -1
  143. package/dist/nearest-parent-config.js +18 -2
  144. package/dist/nearest-parent-config.js.map +1 -1
  145. package/dist/package-manager-cli.d.ts.map +1 -1
  146. package/dist/package-manager-cli.js +13 -1
  147. package/dist/package-manager-cli.js.map +1 -1
  148. package/dist/rpc-entry.js +2 -0
  149. package/dist/rpc-entry.js.map +1 -1
  150. package/dist/self-update-bootstrap.d.ts.map +1 -1
  151. package/dist/self-update-bootstrap.js +6 -0
  152. package/dist/self-update-bootstrap.js.map +1 -1
  153. package/dist/senpi +2 -2
  154. package/dist/utils/pi-user-agent.d.ts +1 -1
  155. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  156. package/dist/utils/pi-user-agent.js +4 -3
  157. package/dist/utils/pi-user-agent.js.map +1 -1
  158. package/dist/utils/tools-manager.d.ts.map +1 -1
  159. package/dist/utils/tools-manager.js +2 -1
  160. package/dist/utils/tools-manager.js.map +1 -1
  161. package/dist/utils/version-check.d.ts +3 -0
  162. package/dist/utils/version-check.d.ts.map +1 -1
  163. package/dist/utils/version-check.js +37 -6
  164. package/dist/utils/version-check.js.map +1 -1
  165. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +24 -0
  166. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  167. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  168. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  169. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +4 -2
  170. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  171. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts.map +1 -1
  172. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js +2 -1
  173. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js.map +1 -1
  174. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
  175. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  176. package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
  177. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  178. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  179. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  180. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  181. package/node_modules/@earendil-works/pi-ai/dist/wire-identity.d.ts +14 -0
  182. package/node_modules/@earendil-works/pi-ai/dist/wire-identity.d.ts.map +1 -0
  183. package/node_modules/@earendil-works/pi-ai/dist/wire-identity.js +24 -0
  184. package/node_modules/@earendil-works/pi-ai/dist/wire-identity.js.map +1 -0
  185. package/node_modules/@earendil-works/pi-ai/package.json +1 -1
  186. package/node_modules/@earendil-works/pi-pty/dist/pipe-fallback.d.ts.map +1 -1
  187. package/node_modules/@earendil-works/pi-pty/dist/pipe-fallback.js +11 -3
  188. package/node_modules/@earendil-works/pi-pty/dist/pipe-fallback.js.map +1 -1
  189. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  190. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  191. package/package.json +6 -6
  192. package/dist/core/omo-native-detect.d.ts +0 -3
  193. package/dist/core/omo-native-detect.d.ts.map +0 -1
  194. package/dist/core/omo-native-detect.js +0 -64
  195. package/dist/core/omo-native-detect.js.map +0 -1
  196. package/dist/core/omo-native-detect.test.d.ts +0 -2
  197. package/dist/core/omo-native-detect.test.d.ts.map +0 -1
  198. package/dist/core/omo-native-detect.test.js +0 -47
  199. package/dist/core/omo-native-detect.test.js.map +0 -1
  200. package/dist/modes/interactive/components/footer-omo-native-badge.test.d.ts +0 -2
  201. package/dist/modes/interactive/components/footer-omo-native-badge.test.d.ts.map +0 -1
  202. package/dist/modes/interactive/components/footer-omo-native-badge.test.js +0 -52
  203. package/dist/modes/interactive/components/footer-omo-native-badge.test.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -14,6 +14,60 @@
14
14
 
15
15
  ### Removed
16
16
 
17
+ ## [2026.8.11-2] - 2026-08-10
18
+
19
+ ### New Features
20
+
21
+ ### Breaking Changes
22
+
23
+ ### Added
24
+
25
+ - Distributions repackaging senpi can set their own product identity through a `SENPI_BRAND` profile: name, display
26
+ version, config directory (optionally flat), environment prefix, wire identity and update channel. The profile is
27
+ consumed and scrubbed at startup, so nested senpi processes keep the engine identity. A standalone install is
28
+ unchanged ([#783](https://github.com/code-yeongyu/senpi/pull/783)).
29
+ - Product settings are read across the brand prefix and the legacy `SENPI_`/`PI_` prefixes, so existing environments
30
+ keep working after a rebrand ([#783](https://github.com/code-yeongyu/senpi/pull/783)).
31
+ - A branded install checks its own release channel for updates, and the update notice, changelog link and self-update
32
+ paths point at the distribution's own command instead of `senpi update`
33
+ ([#783](https://github.com/code-yeongyu/senpi/pull/783)).
34
+
35
+ ### Changed
36
+
37
+ ### Fixed
38
+
39
+ - Windows pipe-fallback shutdown no longer crashes with an uncaught `spawn taskkill ENOENT` when the helper cannot
40
+ resolve. Senpi now invokes `taskkill.exe` explicitly and falls back to direct child termination if helper startup
41
+ fails ([#792](https://github.com/code-yeongyu/senpi/pull/792)).
42
+ - A brand profile carrying an unsafe `configDir` (a path separator, `.` or `..`) is rejected instead of redirecting
43
+ agent state and its migration outside the intended directory
44
+ ([#787](https://github.com/code-yeongyu/senpi/pull/787)).
45
+ - A branded install without an update channel no longer falls back to checking the engine's own releases, which it
46
+ cannot install ([#787](https://github.com/code-yeongyu/senpi/pull/787)).
47
+ - Prevented an asynchronous goal continuation from restoring a goal after `thread/goal/clear` or recording delivery
48
+ against a replacement goal ([#788](https://github.com/code-yeongyu/senpi/pull/788)).
49
+ - Prevented Claude Agent SDK OAuth sessions from scheduling `assistant_rewritten` forks when only host-side thinking
50
+ timing annotations changed, preserving resident-session and prompt-cache continuity for reasoning-heavy turns
51
+ ([#751](https://github.com/code-yeongyu/senpi/pull/751) by [@goldtg](https://github.com/goldtg)).
52
+
53
+ ### Removed
54
+
55
+ ## [2026.8.11] - 2026-08-10
56
+
57
+ ### New Features
58
+
59
+ ### Breaking Changes
60
+
61
+ ### Added
62
+
63
+ ### Changed
64
+
65
+ ### Fixed
66
+
67
+ ### Removed
68
+
69
+ - Removed the OmO-specific footer badge, its detection module, and the `isOmoNative` provider surface. Downstream packages contribute footer content through the supported `ctx.ui.setStatus` extension API instead, so no product-specific markers live in the coding agent.
70
+
17
71
  ## [2026.8.10] - 2026-08-10
18
72
 
19
73
  ### New Features
@@ -0,0 +1,28 @@
1
+ /**
2
+ * First-run copy-forward for a rebranded install.
3
+ *
4
+ * A machine that already ran the engine keeps its state in the engine's own directory. A
5
+ * branded install reads a different location, so the existing state is COPIED once - never
6
+ * moved - because the same machine may keep running the engine standalone, and a move would
7
+ * silently empty that install.
8
+ */
9
+ /** Written last, so an interrupted copy simply runs again next start. */
10
+ export declare const MIGRATION_MARKER = ".migrated-from-senpi";
11
+ export interface BrandDirMigrationResult {
12
+ readonly migrated: boolean;
13
+ readonly copied: readonly string[];
14
+ readonly from: string;
15
+ readonly to: string;
16
+ }
17
+ /**
18
+ * Copies engine state into the branded directory. Idempotent: entries that already exist in
19
+ * the destination are left untouched, so a re-run after a partial copy completes it instead of
20
+ * overwriting newer state.
21
+ */
22
+ export declare function migrateEngineStateToBrandDir(legacyAgentDir: string, brandDir: string): BrandDirMigrationResult;
23
+ /**
24
+ * Runs the copy-forward for the active brand, announcing it once so the user knows the two
25
+ * installs now hold independent state.
26
+ */
27
+ export declare function migrateEngineStateForBrand(homeDir?: string): BrandDirMigrationResult | undefined;
28
+ //# sourceMappingURL=brand-dir-migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-dir-migration.d.ts","sourceRoot":"","sources":["../src/brand-dir-migration.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AAEH,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AASvD,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,uBAAuB,CAgC9G;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,GAAE,MAAkB,GAAG,uBAAuB,GAAG,SAAS,CAS3G"}
@@ -0,0 +1,77 @@
1
+ import { cpSync, existsSync, mkdirSync, readdirSync, writeFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+ import chalk from "chalk";
5
+ import { CONFIG_DIR_NAME, CONFIG_FLAT_LAYOUT, FLAT_LAYOUT_SENTINEL } from "./config.js";
6
+ /**
7
+ * First-run copy-forward for a rebranded install.
8
+ *
9
+ * A machine that already ran the engine keeps its state in the engine's own directory. A
10
+ * branded install reads a different location, so the existing state is COPIED once - never
11
+ * moved - because the same machine may keep running the engine standalone, and a move would
12
+ * silently empty that install.
13
+ */
14
+ /** Written last, so an interrupted copy simply runs again next start. */
15
+ export const MIGRATION_MARKER = ".migrated-from-senpi";
16
+ /** Regenerable state: caches, logs and build worktrees are rebuilt on demand. */
17
+ const SKIPPED_ENTRIES = new Set(["cache", "logs", "omo-local-update"]);
18
+ function isSkipped(entry) {
19
+ return SKIPPED_ENTRIES.has(entry) || entry.endsWith(".log");
20
+ }
21
+ /**
22
+ * Copies engine state into the branded directory. Idempotent: entries that already exist in
23
+ * the destination are left untouched, so a re-run after a partial copy completes it instead of
24
+ * overwriting newer state.
25
+ */
26
+ export function migrateEngineStateToBrandDir(legacyAgentDir, brandDir) {
27
+ const result = { migrated: false, copied: [], from: legacyAgentDir, to: brandDir };
28
+ if (!existsSync(legacyAgentDir))
29
+ return result;
30
+ if (existsSync(join(brandDir, MIGRATION_MARKER)))
31
+ return result;
32
+ if (existsSync(join(brandDir, FLAT_LAYOUT_SENTINEL)))
33
+ return result;
34
+ let entries;
35
+ try {
36
+ entries = readdirSync(legacyAgentDir);
37
+ }
38
+ catch {
39
+ return result;
40
+ }
41
+ mkdirSync(brandDir, { recursive: true });
42
+ const copied = [];
43
+ for (const entry of entries) {
44
+ if (isSkipped(entry))
45
+ continue;
46
+ const target = join(brandDir, entry);
47
+ if (existsSync(target))
48
+ continue;
49
+ try {
50
+ cpSync(join(legacyAgentDir, entry), target, { recursive: true, errorOnExist: false });
51
+ copied.push(entry);
52
+ }
53
+ catch { }
54
+ }
55
+ try {
56
+ writeFileSync(join(brandDir, MIGRATION_MARKER), `${legacyAgentDir}\n`);
57
+ }
58
+ catch {
59
+ return { ...result, copied };
60
+ }
61
+ return { migrated: true, copied, from: legacyAgentDir, to: brandDir };
62
+ }
63
+ /**
64
+ * Runs the copy-forward for the active brand, announcing it once so the user knows the two
65
+ * installs now hold independent state.
66
+ */
67
+ export function migrateEngineStateForBrand(homeDir = homedir()) {
68
+ if (!CONFIG_FLAT_LAYOUT)
69
+ return undefined;
70
+ const result = migrateEngineStateToBrandDir(join(homeDir, ".senpi", "agent"), join(homeDir, CONFIG_DIR_NAME));
71
+ if (result.migrated && result.copied.length > 0) {
72
+ console.log(chalk.green(`Copied existing settings from ${result.from} to ${result.to}`));
73
+ console.log(chalk.dim("The original directory is untouched; the two installs keep separate state from now on."));
74
+ }
75
+ return result;
76
+ }
77
+ //# sourceMappingURL=brand-dir-migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-dir-migration.js","sourceRoot":"","sources":["../src/brand-dir-migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExF;;;;;;;GAOG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEvD,iFAAiF;AACjF,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEvE,SAAS,SAAS,CAAC,KAAa;IAC/B,OAAO,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC;AASD;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,cAAsB,EAAE,QAAgB;IACpF,MAAM,MAAM,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAc,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;IAC/F,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AE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAO,GAAW,OAAO,EAAE;IACrE,IAAI,CAAC,kBAAkB;QAAE,OAAO,SAAS,CAAC;IAE1C,MAAM,MAAM,GAAG,4BAA4B,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IAC9G,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,iCAAiC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACzF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,wFAAwF,CAAC,CAAC,CAAC;IAClH,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import { cpSync, existsSync, mkdirSync, readdirSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport chalk from \"chalk\";\nimport { CONFIG_DIR_NAME, CONFIG_FLAT_LAYOUT, FLAT_LAYOUT_SENTINEL } from \"./config.ts\";\n\n/**\n * First-run copy-forward for a rebranded install.\n *\n * A machine that already ran the engine keeps its state in the engine's own directory. A\n * branded install reads a different location, so the existing state is COPIED once - never\n * moved - because the same machine may keep running the engine standalone, and a move would\n * silently empty that install.\n */\n\n/** Written last, so an interrupted copy simply runs again next start. */\nexport const MIGRATION_MARKER = \".migrated-from-senpi\";\n\n/** Regenerable state: caches, logs and build worktrees are rebuilt on demand. */\nconst SKIPPED_ENTRIES = new Set([\"cache\", \"logs\", \"omo-local-update\"]);\n\nfunction isSkipped(entry: string): boolean {\n\treturn SKIPPED_ENTRIES.has(entry) || entry.endsWith(\".log\");\n}\n\nexport interface BrandDirMigrationResult {\n\treadonly migrated: boolean;\n\treadonly copied: readonly string[];\n\treadonly from: string;\n\treadonly to: string;\n}\n\n/**\n * Copies engine state into the branded directory. Idempotent: entries that already exist in\n * the destination are left untouched, so a re-run after a partial copy completes it instead of\n * overwriting newer state.\n */\nexport function migrateEngineStateToBrandDir(legacyAgentDir: string, brandDir: string): BrandDirMigrationResult {\n\tconst result = { migrated: false, copied: [] as string[], from: legacyAgentDir, to: brandDir };\n\tif (!existsSync(legacyAgentDir)) return result;\n\tif (existsSync(join(brandDir, MIGRATION_MARKER))) return result;\n\tif (existsSync(join(brandDir, FLAT_LAYOUT_SENTINEL))) return result;\n\n\tlet entries: string[];\n\ttry {\n\t\tentries = readdirSync(legacyAgentDir);\n\t} catch {\n\t\treturn result;\n\t}\n\n\tmkdirSync(brandDir, { recursive: true });\n\tconst copied: string[] = [];\n\tfor (const entry of entries) {\n\t\tif (isSkipped(entry)) continue;\n\t\tconst target = join(brandDir, entry);\n\t\tif (existsSync(target)) continue;\n\t\ttry {\n\t\t\tcpSync(join(legacyAgentDir, entry), target, { recursive: true, errorOnExist: false });\n\t\t\tcopied.push(entry);\n\t\t} catch {}\n\t}\n\n\ttry {\n\t\twriteFileSync(join(brandDir, MIGRATION_MARKER), `${legacyAgentDir}\\n`);\n\t} catch {\n\t\treturn { ...result, copied };\n\t}\n\n\treturn { migrated: true, copied, from: legacyAgentDir, to: brandDir };\n}\n\n/**\n * Runs the copy-forward for the active brand, announcing it once so the user knows the two\n * installs now hold independent state.\n */\nexport function migrateEngineStateForBrand(homeDir: string = homedir()): BrandDirMigrationResult | undefined {\n\tif (!CONFIG_FLAT_LAYOUT) return undefined;\n\n\tconst result = migrateEngineStateToBrandDir(join(homeDir, \".senpi\", \"agent\"), join(homeDir, CONFIG_DIR_NAME));\n\tif (result.migrated && result.copied.length > 0) {\n\t\tconsole.log(chalk.green(`Copied existing settings from ${result.from} to ${result.to}`));\n\t\tconsole.log(chalk.dim(\"The original directory is untouched; the two installs keep separate state from now on.\"));\n\t}\n\treturn result;\n}\n"]}
@@ -1,11 +1,3 @@
1
- /**
2
- * Feature gate for the grok-neo interactive chrome.
3
- *
4
- * The grok chrome is experimental, so its `--grok-neo` handoff stays behind an
5
- * opt-in env gate: OFF by default, the flag is absent from help and parses as
6
- * an unknown extension flag, exactly as if the feature did not exist. Set
7
- * `SENPI_ENABLE_GROK_NEO=1` (or `true`/`yes`) to enable it.
8
- */
9
1
  export declare const ENV_ENABLE_GROK_NEO = "SENPI_ENABLE_GROK_NEO";
10
2
  /** Whether the experimental grok-neo CLI flag is exposed for this process. */
11
3
  export declare function isGrokNeoEnabled(env?: NodeJS.ProcessEnv): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"grok-neo-gate.d.ts","sourceRoot":"","sources":["../../src/cli/grok-neo-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAK9E"}
1
+ {"version":3,"file":"grok-neo-gate.d.ts","sourceRoot":"","sources":["../../src/cli/grok-neo-gate.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAK9E"}
@@ -4,12 +4,14 @@
4
4
  * The grok chrome is experimental, so its `--grok-neo` handoff stays behind an
5
5
  * opt-in env gate: OFF by default, the flag is absent from help and parses as
6
6
  * an unknown extension flag, exactly as if the feature did not exist. Set
7
- * `SENPI_ENABLE_GROK_NEO=1` (or `true`/`yes`) to enable it.
7
+ * `<PREFIX>_ENABLE_GROK_NEO=1` (or `true`/`yes`) to enable it, where the prefix is the
8
+ * running product's own prefix; the legacy `SENPI_`/`PI_` names keep working.
8
9
  */
10
+ import { envValue } from "../core/brand.js";
9
11
  export const ENV_ENABLE_GROK_NEO = "SENPI_ENABLE_GROK_NEO";
10
12
  /** Whether the experimental grok-neo CLI flag is exposed for this process. */
11
13
  export function isGrokNeoEnabled(env = process.env) {
12
- const value = env[ENV_ENABLE_GROK_NEO];
14
+ const value = envValue("ENABLE_GROK_NEO", env);
13
15
  if (value === undefined)
14
16
  return false;
15
17
  const normalized = value.trim().toLowerCase();
@@ -1 +1 @@
1
- {"version":3,"file":"grok-neo-gate.js","sourceRoot":"","sources":["../../src/cli/grok-neo-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE3D,8EAA8E;AAC9E,MAAM,UAAU,gBAAgB,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IACpE,MAAM,KAAK,GAAG,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACvC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAO,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,KAAK,CAAC;AAC5E,CAAC","sourcesContent":["/**\n * Feature gate for the grok-neo interactive chrome.\n *\n * The grok chrome is experimental, so its `--grok-neo` handoff stays behind an\n * opt-in env gate: OFF by default, the flag is absent from help and parses as\n * an unknown extension flag, exactly as if the feature did not exist. Set\n * `SENPI_ENABLE_GROK_NEO=1` (or `true`/`yes`) to enable it.\n */\nexport const ENV_ENABLE_GROK_NEO = \"SENPI_ENABLE_GROK_NEO\";\n\n/** Whether the experimental grok-neo CLI flag is exposed for this process. */\nexport function isGrokNeoEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n\tconst value = env[ENV_ENABLE_GROK_NEO];\n\tif (value === undefined) return false;\n\tconst normalized = value.trim().toLowerCase();\n\treturn normalized === \"1\" || normalized === \"true\" || normalized === \"yes\";\n}\n"]}
1
+ {"version":3,"file":"grok-neo-gate.js","sourceRoot":"","sources":["../../src/cli/grok-neo-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE3D,8EAA8E;AAC9E,MAAM,UAAU,gBAAgB,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IACpE,MAAM,KAAK,GAAG,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IAC/C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAO,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,KAAK,CAAC;AAC5E,CAAC","sourcesContent":["/**\n * Feature gate for the grok-neo interactive chrome.\n *\n * The grok chrome is experimental, so its `--grok-neo` handoff stays behind an\n * opt-in env gate: OFF by default, the flag is absent from help and parses as\n * an unknown extension flag, exactly as if the feature did not exist. Set\n * `<PREFIX>_ENABLE_GROK_NEO=1` (or `true`/`yes`) to enable it, where the prefix is the\n * running product's own prefix; the legacy `SENPI_`/`PI_` names keep working.\n */\nimport { envValue } from \"../core/brand.ts\";\n\nexport const ENV_ENABLE_GROK_NEO = \"SENPI_ENABLE_GROK_NEO\";\n\n/** Whether the experimental grok-neo CLI flag is exposed for this process. */\nexport function isGrokNeoEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n\tconst value = envValue(\"ENABLE_GROK_NEO\", env);\n\tif (value === undefined) return false;\n\tconst normalized = value.trim().toLowerCase();\n\treturn normalized === \"1\" || normalized === \"true\" || normalized === \"yes\";\n}\n"]}
package/dist/cli-main.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { APP_NAME } from "./config.js";
3
+ import { scrubBrandFromEnvironment } from "./core/brand.js";
3
4
  import { configureHttpDispatcher } from "./core/http-dispatcher.js";
4
5
  import { installEarlyInspectorVmImportRecovery } from "./inspector-policy.js";
5
6
  import { main } from "./main.js";
@@ -7,6 +8,8 @@ import { main } from "./main.js";
7
8
  // import rejection can fire before interactive mode registers its own crash handler.
8
9
  installEarlyInspectorVmImportRecovery();
9
10
  process.title = APP_NAME;
11
+ // The brand has been resolved for this process; nested engine runs must not inherit it.
12
+ scrubBrandFromEnvironment();
10
13
  process.env.PI_CODING_AGENT = "true";
11
14
  process.emitWarning = (() => { });
12
15
  configureHttpDispatcher();
@@ -1 +1 @@
1
- {"version":3,"file":"cli-main.js","sourceRoot":"","sources":["../src/cli-main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,yFAAyF;AACzF,qFAAqF;AACrF,qCAAqC,EAAE,CAAC;AAExC,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;AACzB,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC;AACrC,OAAO,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,GAAE,CAAC,CAA+B,CAAC;AAE/D,uBAAuB,EAAE,CAAC;AAE1B,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { APP_NAME } from \"./config.ts\";\nimport { configureHttpDispatcher } from \"./core/http-dispatcher.ts\";\nimport { installEarlyInspectorVmImportRecovery } from \"./inspector-policy.ts\";\nimport { main } from \"./main.ts\";\n\n// Must precede the asynchronous bootstrap: with --inspect-brk, the recoverable Inspector\n// import rejection can fire before interactive mode registers its own crash handler.\ninstallEarlyInspectorVmImportRecovery();\n\nprocess.title = APP_NAME;\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\nconfigureHttpDispatcher();\n\nawait main(process.argv.slice(2));\n"]}
1
+ {"version":3,"file":"cli-main.js","sourceRoot":"","sources":["../src/cli-main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,yFAAyF;AACzF,qFAAqF;AACrF,qCAAqC,EAAE,CAAC;AAExC,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;AACzB,wFAAwF;AACxF,yBAAyB,EAAE,CAAC;AAC5B,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC;AACrC,OAAO,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,GAAE,CAAC,CAA+B,CAAC;AAE/D,uBAAuB,EAAE,CAAC;AAE1B,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { APP_NAME } from \"./config.ts\";\nimport { scrubBrandFromEnvironment } from \"./core/brand.ts\";\nimport { configureHttpDispatcher } from \"./core/http-dispatcher.ts\";\nimport { installEarlyInspectorVmImportRecovery } from \"./inspector-policy.ts\";\nimport { main } from \"./main.ts\";\n\n// Must precede the asynchronous bootstrap: with --inspect-brk, the recoverable Inspector\n// import rejection can fire before interactive mode registers its own crash handler.\ninstallEarlyInspectorVmImportRecovery();\n\nprocess.title = APP_NAME;\n// The brand has been resolved for this process; nested engine runs must not inherit it.\nscrubBrandFromEnvironment();\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\nconfigureHttpDispatcher();\n\nawait main(process.argv.slice(2));\n"]}
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { spawn } from "node:child_process";
3
3
  import { existsSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
- import { APP_NAME, getPackageDir, VERSION } from "./config.js";
6
+ import { APP_NAME, DISPLAY_VERSION, getPackageDir } from "./config.js";
7
7
  import { releaseInheritedInspectorForChild } from "./inspector-policy.js";
8
8
  import { handleBootstrapSelfUpdate } from "./self-update-bootstrap.js";
9
9
  process.title = APP_NAME;
@@ -50,7 +50,7 @@ async function runFullCli() {
50
50
  });
51
51
  }
52
52
  if (isRootCommand(args) && (args.includes("--version") || args.includes("-v"))) {
53
- console.log(VERSION);
53
+ console.log(DISPLAY_VERSION);
54
54
  process.exit();
55
55
  }
56
56
  if (isMissingBundledWorkspaceDependencies(getPackageDir())) {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE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C,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC;IAC5D,IAAI,MAAM,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,OAAO,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;AACF,CAAC;AAED,OAAO,CAAC,QAAQ,GAAG,MAAM,UAAU,EAAE,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { APP_NAME, getPackageDir, VERSION } from \"./config.ts\";\nimport { releaseInheritedInspectorForChild } from \"./inspector-policy.ts\";\nimport { handleBootstrapSelfUpdate } from \"./self-update-bootstrap.ts\";\n\nprocess.title = APP_NAME;\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\nconst args = process.argv.slice(2);\nconst PACKAGE_COMMANDS = new Set([\"install\", \"remove\", \"uninstall\", \"update\", \"list\", \"config\"]);\n\nfunction isRootCommand(args: readonly string[]): boolean {\n\tconst firstArg = args[0];\n\treturn firstArg === undefined || !PACKAGE_COMMANDS.has(firstArg);\n}\n\nfunction isPackageManagerInstall(packageDir: string): boolean {\n\treturn packageDir.replace(/\\\\/g, \"/\").includes(\"/node_modules/@code-yeongyu/senpi\");\n}\n\nfunction isMissingBundledWorkspaceDependencies(packageDir: string): boolean {\n\tif (!isPackageManagerInstall(packageDir)) {\n\t\treturn false;\n\t}\n\tconst bundledPackages = [\"pi-agent-core\", \"pi-ai\", \"pi-tui\"];\n\treturn bundledPackages.some((name) => {\n\t\treturn !existsSync(join(packageDir, \"node_modules\", \"@earendil-works\", name, \"dist\", \"index.js\"));\n\t});\n}\n\nasync function runFullCli(): Promise<number> {\n\tconst extension = import.meta.url.endsWith(\".ts\") ? \".ts\" : \".js\";\n\tconst fullCliPath = fileURLToPath(new URL(`./cli-main${extension}`, import.meta.url));\n\treleaseInheritedInspectorForChild();\n\treturn await new Promise<number>((resolve, reject) => {\n\t\tconst child = spawn(process.execPath, [...process.execArgv, fullCliPath, ...args], {\n\t\t\tenv: process.env,\n\t\t\tstdio: \"inherit\",\n\t\t});\n\t\tchild.on(\"error\", (error) => {\n\t\t\treject(error);\n\t\t});\n\t\tchild.on(\"close\", (code, signal) => {\n\t\t\tif (signal) {\n\t\t\t\tprocess.kill(process.pid, signal);\n\t\t\t\tresolve(1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(code ?? 1);\n\t\t});\n\t});\n}\n\nif (isRootCommand(args) && (args.includes(\"--version\") || args.includes(\"-v\"))) {\n\tconsole.log(VERSION);\n\tprocess.exit();\n}\n\nif (isMissingBundledWorkspaceDependencies(getPackageDir())) {\n\tif (await handleBootstrapSelfUpdate(args)) {\n\t\tprocess.exit();\n\t}\n}\n\nprocess.exitCode = await runFullCli();\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;AACzB,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC;AACrC,OAAO,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,GAAE,CAAC,CAA+B,CAAC;AAE/D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC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\"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { APP_NAME, DISPLAY_VERSION, getPackageDir } from \"./config.ts\";\nimport { releaseInheritedInspectorForChild } from \"./inspector-policy.ts\";\nimport { handleBootstrapSelfUpdate } from \"./self-update-bootstrap.ts\";\n\nprocess.title = APP_NAME;\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\nconst args = process.argv.slice(2);\nconst PACKAGE_COMMANDS = new Set([\"install\", \"remove\", \"uninstall\", \"update\", \"list\", \"config\"]);\n\nfunction isRootCommand(args: readonly string[]): boolean {\n\tconst firstArg = args[0];\n\treturn firstArg === undefined || !PACKAGE_COMMANDS.has(firstArg);\n}\n\nfunction isPackageManagerInstall(packageDir: string): boolean {\n\treturn packageDir.replace(/\\\\/g, \"/\").includes(\"/node_modules/@code-yeongyu/senpi\");\n}\n\nfunction isMissingBundledWorkspaceDependencies(packageDir: string): boolean {\n\tif (!isPackageManagerInstall(packageDir)) {\n\t\treturn false;\n\t}\n\tconst bundledPackages = [\"pi-agent-core\", \"pi-ai\", \"pi-tui\"];\n\treturn bundledPackages.some((name) => {\n\t\treturn !existsSync(join(packageDir, \"node_modules\", \"@earendil-works\", name, \"dist\", \"index.js\"));\n\t});\n}\n\nasync function runFullCli(): Promise<number> {\n\tconst extension = import.meta.url.endsWith(\".ts\") ? \".ts\" : \".js\";\n\tconst fullCliPath = fileURLToPath(new URL(`./cli-main${extension}`, import.meta.url));\n\treleaseInheritedInspectorForChild();\n\treturn await new Promise<number>((resolve, reject) => {\n\t\tconst child = spawn(process.execPath, [...process.execArgv, fullCliPath, ...args], {\n\t\t\tenv: process.env,\n\t\t\tstdio: \"inherit\",\n\t\t});\n\t\tchild.on(\"error\", (error) => {\n\t\t\treject(error);\n\t\t});\n\t\tchild.on(\"close\", (code, signal) => {\n\t\t\tif (signal) {\n\t\t\t\tprocess.kill(process.pid, signal);\n\t\t\t\tresolve(1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(code ?? 1);\n\t\t});\n\t});\n}\n\nif (isRootCommand(args) && (args.includes(\"--version\") || args.includes(\"-v\"))) {\n\tconsole.log(DISPLAY_VERSION);\n\tprocess.exit();\n}\n\nif (isMissingBundledWorkspaceDependencies(getPackageDir())) {\n\tif (await handleBootstrapSelfUpdate(args)) {\n\t\tprocess.exit();\n\t}\n}\n\nprocess.exitCode = await runFullCli();\n"]}
package/dist/config.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type BrandProfile } from "./core/brand.ts";
1
2
  /**
2
3
  * Detect if we're running as a Bun compiled binary.
3
4
  * Bun binaries have import.meta.url containing "$bunfs", "~BUN", or "%7EBUN" (Bun's virtual filesystem path)
@@ -62,20 +63,45 @@ export declare function getChangelogPath(): string;
62
63
  export declare function getInteractiveAssetsDir(): string;
63
64
  /** Get path to a bundled interactive asset */
64
65
  export declare function getBundledInteractiveAssetPath(name: string): string;
66
+ /**
67
+ * A distribution repackaging this engine injects its brand once. The profile is consumed
68
+ * here - which also scrubs the variable - so every process spawned later inherits a clean
69
+ * environment and keeps the engine's own identity.
70
+ */
71
+ export declare const BRAND: BrandProfile | undefined;
65
72
  export declare const PACKAGE_NAME: string;
66
73
  export declare const APP_NAME: string;
67
74
  export declare const APP_TITLE: string;
68
75
  export declare const CONFIG_DIR_NAME: string;
76
+ /** True when the brand stores agent state directly under the config dir, with no `agent` segment. */
77
+ export declare const CONFIG_FLAT_LAYOUT: boolean;
69
78
  export declare const VERSION: string;
79
+ /** Version shown to users; VERSION stays the engine version used for update comparisons. */
80
+ export declare const DISPLAY_VERSION: string;
81
+ /** Primary environment prefix for this product; legacy prefixes stay readable. */
82
+ export declare const ENV_PREFIX: string;
70
83
  export declare const ENV_AGENT_DIR: string;
71
84
  export declare const ENV_SESSION_DIR: string;
72
85
  export declare function expandTildePath(path: string): string;
73
86
  /** Get the share viewer URL for a gist ID */
74
87
  export declare function getShareViewerUrl(gistId: string): string;
75
- /** Resolve the agent config directory from an explicit environment. */
88
+ /** Marker file that identifies a flat-layout config directory. */
89
+ export declare const FLAT_LAYOUT_SENTINEL = "settings.json";
90
+ /**
91
+ * Resolve the agent config directory from an explicit environment.
92
+ *
93
+ * A flat-layout brand keeps its state directly under the config directory, so it looks for
94
+ * the settings file as proof rather than for an `agent` subdirectory - the config directory
95
+ * name may also be used by unrelated project tooling.
96
+ */
76
97
  export declare function resolveAgentDir(cwd: string, homeDir: string, envDir?: string): string;
77
98
  /** Get the agent config directory (e.g., ~/.senpi/agent/) */
78
99
  export declare function getAgentDir(): string;
100
+ /**
101
+ * Short, display-only spelling of the agent directory for help text and tips, e.g.
102
+ * `~/.omo` for a flat brand or `~/.senpi/agent` for the engine layout.
103
+ */
104
+ export declare function agentDirLabel(): string;
79
105
  /** Get path to user's custom themes directory */
80
106
  export declare function getCustomThemesDir(): string;
81
107
  /** Get path to models.json */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,WAAW,SACqF,CAAC;AAE9G,gEAAgE;AAChE,eAAO,MAAM,YAAY,SAAyB,CAAC;AAMnD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;AAEvF,UAAU,qBAAqB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC/D,KAAK,CAAC,EAAE,qBAAqB,EAAE,CAAC;CAChC;AAED,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAsC7F,wBAAg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AI,MAAM,CAEpC;AAED,sDAAsD;AACtD,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,6CAA6C;AAC7C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,qCAAqC;AACrC,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,iCAAiC;AACjC,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
package/dist/config.js CHANGED
@@ -3,6 +3,7 @@ import { homedir } from "os";
3
3
  import { basename, dirname, join, resolve, sep, win32 } from "path";
4
4
  import { fileURLToPath } from "url";
5
5
  import { createBunLauncherRepairCommand } from "./bun-global-launcher.js";
6
+ import { brandProfile, envValue } from "./core/brand.js";
6
7
  import { findNearestParentConfigDir } from "./nearest-parent-config.js";
7
8
  import { spawnProcessSync } from "./utils/child-process.js";
8
9
  import { normalizePath } from "./utils/paths.js";
@@ -305,7 +306,7 @@ export function getUpdateInstruction(packageName) {
305
306
  */
306
307
  export function getPackageDir() {
307
308
  // Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)
308
- const envDir = process.env.PI_PACKAGE_DIR;
309
+ const envDir = envValue("PACKAGE_DIR");
309
310
  if (envDir) {
310
311
  return normalizePath(envDir);
311
312
  }
@@ -401,37 +402,68 @@ catch (e) {
401
402
  throw e;
402
403
  }
403
404
  const piConfigName = pkg.piConfig?.name;
405
+ /**
406
+ * A distribution repackaging this engine injects its brand once. The profile is consumed
407
+ * here - which also scrubs the variable - so every process spawned later inherits a clean
408
+ * environment and keeps the engine's own identity.
409
+ */
410
+ export const BRAND = brandProfile();
404
411
  export const PACKAGE_NAME = pkg.name || "@earendil-works/pi-coding-agent";
405
- export const APP_NAME = piConfigName || "pi";
406
- export const APP_TITLE = piConfigName ? APP_NAME : "π";
407
- export const CONFIG_DIR_NAME = pkg.piConfig?.configDir || ".pi";
412
+ export const APP_NAME = BRAND?.name || piConfigName || "pi";
413
+ export const APP_TITLE = BRAND?.name || (piConfigName ? APP_NAME : "π");
414
+ export const CONFIG_DIR_NAME = BRAND?.configDir || pkg.piConfig?.configDir || ".pi";
415
+ /** True when the brand stores agent state directly under the config dir, with no `agent` segment. */
416
+ export const CONFIG_FLAT_LAYOUT = BRAND?.flatLayout === true;
408
417
  export const VERSION = pkg.version || "0.0.0";
418
+ /** Version shown to users; VERSION stays the engine version used for update comparisons. */
419
+ export const DISPLAY_VERSION = BRAND?.displayVersion || VERSION;
409
420
  // e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR
410
- export const ENV_AGENT_DIR = `${APP_NAME.toUpperCase()}_CODING_AGENT_DIR`;
411
- export const ENV_SESSION_DIR = `${APP_NAME.toUpperCase()}_CODING_AGENT_SESSION_DIR`;
421
+ /** Primary environment prefix for this product; legacy prefixes stay readable. */
422
+ export const ENV_PREFIX = BRAND?.envPrefix || APP_NAME.toUpperCase();
423
+ export const ENV_AGENT_DIR = `${ENV_PREFIX}_CODING_AGENT_DIR`;
424
+ export const ENV_SESSION_DIR = `${ENV_PREFIX}_CODING_AGENT_SESSION_DIR`;
412
425
  export function expandTildePath(path) {
413
426
  return normalizePath(path);
414
427
  }
415
428
  const DEFAULT_SHARE_VIEWER_URL = "https://pi.dev/session/";
416
429
  /** Get the share viewer URL for a gist ID */
417
430
  export function getShareViewerUrl(gistId) {
418
- const baseUrl = process.env.PI_SHARE_VIEWER_URL || DEFAULT_SHARE_VIEWER_URL;
431
+ const baseUrl = envValue("SHARE_VIEWER_URL") || DEFAULT_SHARE_VIEWER_URL;
419
432
  return `${baseUrl}#${gistId}`;
420
433
  }
421
434
  // =============================================================================
422
435
  // User Config Paths (~/.senpi/agent/*)
423
436
  // =============================================================================
424
- /** Resolve the agent config directory from an explicit environment. */
437
+ /** Marker file that identifies a flat-layout config directory. */
438
+ export const FLAT_LAYOUT_SENTINEL = "settings.json";
439
+ /**
440
+ * Resolve the agent config directory from an explicit environment.
441
+ *
442
+ * A flat-layout brand keeps its state directly under the config directory, so it looks for
443
+ * the settings file as proof rather than for an `agent` subdirectory - the config directory
444
+ * name may also be used by unrelated project tooling.
445
+ */
425
446
  export function resolveAgentDir(cwd, homeDir, envDir) {
426
447
  if (envDir) {
427
448
  return normalizePath(envDir, { homeDir });
428
449
  }
450
+ if (CONFIG_FLAT_LAYOUT) {
451
+ const flatProjectDir = findNearestParentConfigDir(cwd, homeDir, CONFIG_DIR_NAME, undefined, FLAT_LAYOUT_SENTINEL);
452
+ return flatProjectDir ?? join(homeDir, CONFIG_DIR_NAME);
453
+ }
429
454
  const projectConfigDir = findNearestParentConfigDir(cwd, homeDir, CONFIG_DIR_NAME, "agent");
430
455
  return projectConfigDir ? join(projectConfigDir, "agent") : join(homeDir, CONFIG_DIR_NAME, "agent");
431
456
  }
432
457
  /** Get the agent config directory (e.g., ~/.senpi/agent/) */
433
458
  export function getAgentDir() {
434
- return resolveAgentDir(process.cwd(), homedir(), process.env[ENV_AGENT_DIR]);
459
+ return resolveAgentDir(process.cwd(), homedir(), envValue("CODING_AGENT_DIR"));
460
+ }
461
+ /**
462
+ * Short, display-only spelling of the agent directory for help text and tips, e.g.
463
+ * `~/.omo` for a flat brand or `~/.senpi/agent` for the engine layout.
464
+ */
465
+ export function agentDirLabel() {
466
+ return CONFIG_FLAT_LAYOUT ? `~/${CONFIG_DIR_NAME}` : `~/${CONFIG_DIR_NAME}/agent`;
435
467
  }
436
468
  /** Get path to user's custom themes directory */
437
469
  export function getCustomThemesDir() {