gentle-pi 4.0.0 → 4.1.0

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 (398) hide show
  1. package/README.md +122 -8
  2. package/assets/agents/gentle-ai-explore.md +11 -4
  3. package/assets/agents/gentle-ai-verify.md +23 -4
  4. package/assets/agents/gentle-ai-worker.md +6 -6
  5. package/assets/install-wizard/index.html +47 -0
  6. package/assets/install-wizard/wizard.css +1279 -0
  7. package/assets/install-wizard/wizard.js +951 -0
  8. package/assets/orchestrator-delegation.md +70 -163
  9. package/assets/orchestrator-memory.md +11 -4
  10. package/assets/orchestrator-prompts.md +48 -0
  11. package/assets/orchestrator-tracking.md +53 -0
  12. package/assets/orchestrator-verification.md +28 -0
  13. package/assets/orchestrator-writer.md +38 -0
  14. package/assets/orchestrator.md +29 -25
  15. package/assets/sounds/LICENSE.md +52 -0
  16. package/assets/sounds/attention.wav +0 -0
  17. package/assets/sounds/error.wav +0 -0
  18. package/assets/sounds/success.wav +0 -0
  19. package/bin/engram-guard +9 -0
  20. package/bin/gentle-shell-install.mjs +302 -0
  21. package/bin/gentle-shell.mjs +703 -22
  22. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +7 -7
  23. package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/bundle/manifest.json +2 -2
  24. package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/bundle/orchestration/pi.md +16 -4
  25. package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/generated/provider-capabilities.baseline.json +2 -2
  26. package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/generated/provider-roles.baseline.json +1 -1
  27. package/docs/bundled-install.md +397 -0
  28. package/docs/delegated-verification.md +3 -5
  29. package/docs/gentle-agents-activity.md +513 -0
  30. package/docs/gentle-shell-uninstall.md +136 -0
  31. package/docs/gentle-shell.md +81 -31
  32. package/docs/install-wizard.md +2040 -0
  33. package/docs/native-authority-architecture.md +1 -1
  34. package/docs/permission-modes.md +82 -0
  35. package/docs/prompt-history.md +1 -1
  36. package/docs/readme-reference.md +267 -40
  37. package/docs/render-cache-performance.md +28 -0
  38. package/docs/sound-notifications-proposal.md +191 -0
  39. package/docs/sound-notifications.md +114 -0
  40. package/docs/yolo-mode.md +9 -9
  41. package/extensions/child-context.ts +11 -2
  42. package/extensions/child-safety.ts +4 -2
  43. package/extensions/codegraph-tools.ts +18 -5
  44. package/extensions/gentle-agents.ts +688 -88
  45. package/extensions/gentle-ai.ts +886 -238
  46. package/extensions/gentle-herdr-activity.ts +81 -0
  47. package/extensions/gentle-notifications.ts +104 -0
  48. package/extensions/gentle-shell.ts +265 -69
  49. package/extensions/gentle-todo.ts +108 -13
  50. package/extensions/history/index.ts +11 -6
  51. package/extensions/pi-pretty.ts +39 -3
  52. package/extensions/quiet-tools.ts +91 -21
  53. package/extensions/skill-registry.ts +175 -46
  54. package/extensions/startup-banner.ts +11 -2
  55. package/lib/agent-home.ts +10 -1
  56. package/lib/agent-model-resolution.ts +80 -0
  57. package/lib/agent-profiles.ts +13 -3
  58. package/lib/agents-completion-delivery.ts +11 -3
  59. package/lib/agents-messaging.ts +1 -1
  60. package/lib/agents-protocol.ts +40 -1
  61. package/lib/agents-runner.ts +90 -15
  62. package/lib/auto-permission-classifier.ts +280 -0
  63. package/lib/auto-permission-runtime.ts +268 -0
  64. package/lib/background-jobs-tools.ts +202 -0
  65. package/lib/background-jobs.ts +253 -0
  66. package/lib/background-monitor.ts +154 -0
  67. package/lib/bounded-writer-admission.ts +83 -10
  68. package/lib/builtin-codemode-optout.ts +166 -0
  69. package/lib/card-content-policy.ts +85 -0
  70. package/lib/child-package-injection.ts +62 -0
  71. package/lib/codemode-renderer.ts +14 -4
  72. package/lib/command-palette-catalog.ts +3 -2
  73. package/lib/context-threshold.ts +26 -0
  74. package/lib/gentle-ai-binary.ts +109 -4
  75. package/lib/gentle-shell-bundled.ts +517 -0
  76. package/lib/gentle-shell-launcher.ts +74 -23
  77. package/lib/gentle-shell-startup-flow.ts +54 -0
  78. package/lib/gentle-shell-startup-update.ts +92 -0
  79. package/lib/gentle-shell-uninstall.ts +840 -0
  80. package/lib/gentle-shell-update-panel.ts +231 -0
  81. package/lib/herdr-activity.ts +183 -0
  82. package/lib/inprocess-reviewer.ts +3 -0
  83. package/lib/jobs-sidebar-state.ts +20 -0
  84. package/lib/jobs-view.ts +161 -0
  85. package/lib/model-price-ratio.ts +83 -0
  86. package/lib/nan-provider.ts +33 -11
  87. package/lib/native-review-cli.ts +194 -73
  88. package/lib/notification-audio-native.ts +162 -0
  89. package/lib/notification-audio-windows.ts +399 -0
  90. package/lib/notification-audio.ts +332 -0
  91. package/lib/notification-customize.ts +241 -0
  92. package/lib/notification-events.ts +113 -0
  93. package/lib/notification-policy.ts +148 -0
  94. package/lib/notification-pulse-client.ts +367 -0
  95. package/lib/notification-pulse-protocol.ts +305 -0
  96. package/lib/notification-pulse-stream.ts +213 -0
  97. package/lib/notification-pulse-worker.ts +66 -0
  98. package/lib/notification-scheduler.ts +173 -0
  99. package/lib/notification-service.ts +202 -0
  100. package/lib/notification-ui.ts +87 -0
  101. package/lib/odd-phase.ts +1 -1
  102. package/lib/orchestrator-alias.ts +20 -0
  103. package/lib/orchestrator-catalog.ts +79 -0
  104. package/lib/orchestrator-consultation.ts +61 -0
  105. package/lib/orchestrator-discovery.ts +49 -0
  106. package/lib/orchestrator-helper-consent.ts +122 -0
  107. package/lib/orchestrator-helper.ts +167 -0
  108. package/lib/orchestrator-message-card.ts +105 -0
  109. package/lib/orchestrator-presence.ts +115 -14
  110. package/lib/orchestrator-scope.ts +80 -0
  111. package/lib/orchestrator-state.ts +107 -0
  112. package/lib/orchestrator-tool-card.ts +280 -0
  113. package/lib/orchestrator-work-search.ts +218 -0
  114. package/lib/orchestrator-work.ts +79 -0
  115. package/lib/permission-mode-policy.ts +59 -0
  116. package/lib/review-candidate-view-owner.ts +8 -6
  117. package/lib/review-candidate-view.ts +3 -2
  118. package/lib/review-compact-contract.ts +2 -2
  119. package/lib/review-host-relay.ts +7 -2
  120. package/lib/review-integration-v2.ts +100 -22
  121. package/lib/review-publication-gate.ts +1 -1
  122. package/lib/review-risk-assessment.ts +77 -51
  123. package/lib/review-sidebar-state.ts +2 -1
  124. package/lib/review-transaction.ts +72 -3
  125. package/lib/runtime-metrics-children.ts +1 -1
  126. package/lib/runtime-metrics-native.ts +3 -2
  127. package/lib/selection-engine.ts +18 -6
  128. package/lib/session-change-capture.ts +5 -4
  129. package/lib/session-changes.ts +27 -22
  130. package/lib/session-profile-binding.ts +83 -0
  131. package/lib/session-profile-freeze.ts +266 -0
  132. package/lib/session-worktree-registry.ts +74 -8
  133. package/lib/shell-bar.ts +41 -11
  134. package/lib/shell-changes-view.ts +40 -13
  135. package/lib/shell-changes.ts +86 -71
  136. package/lib/shell-sidebar-layout.ts +5 -1
  137. package/lib/shell-todo.ts +62 -19
  138. package/lib/shell-usage.ts +4 -3
  139. package/lib/status-timing-diagnostics.ts +201 -0
  140. package/lib/telemetry-trigger.ts +3 -1
  141. package/lib/vim-editor-adapter.ts +7 -3
  142. package/lib/visual-customization-policy.ts +20 -9
  143. package/lib/visual-customize-view.ts +171 -20
  144. package/lib/writer-surfaces.ts +162 -0
  145. package/lib/yolo-session-policy.ts +198 -121
  146. package/package.json +1 -1
  147. package/runtime/child-package-injection.mjs +63 -0
  148. package/runtime/gentle-ai-binary.mjs +109 -4
  149. package/runtime/gentle-shell-bundled.mjs +518 -0
  150. package/runtime/gentle-shell-launcher.mjs +73 -22
  151. package/runtime/gentle-shell-startup-flow.mjs +55 -0
  152. package/runtime/gentle-shell-startup-update.mjs +93 -0
  153. package/runtime/gentle-shell-uninstall.mjs +841 -0
  154. package/runtime/gentle-shell-update-panel.mjs +232 -0
  155. package/runtime/native-review-cli.mjs +191 -70
  156. package/runtime/review-integration-v2.mjs +100 -22
  157. package/runtime/review-risk-assessment.mjs +77 -51
  158. package/runtime/status-timing-diagnostics.mjs +202 -0
  159. package/runtime/telemetry-trigger.mjs +3 -1
  160. package/scripts/bootstrap.cmd +255 -0
  161. package/scripts/bootstrap.sh +168 -0
  162. package/scripts/build-distribution.mjs +157 -0
  163. package/scripts/build-installer-bundles.mjs +136 -0
  164. package/scripts/build-runtime-modules.mjs +7 -0
  165. package/scripts/bundled-install.mjs +1308 -0
  166. package/scripts/bundled-wizard.mjs +399 -0
  167. package/scripts/check-types.mjs +4 -6
  168. package/scripts/gentle-ai-installer.mjs +79 -32
  169. package/scripts/install-gentle-ai.mjs +48 -1
  170. package/scripts/install-tui-mode-setting.mjs +10 -1
  171. package/scripts/install-wizard-preview.mjs +154 -0
  172. package/scripts/installer-downloads.mjs +648 -0
  173. package/scripts/installer-preflight.mjs +387 -0
  174. package/scripts/installer-probes.mjs +564 -0
  175. package/scripts/installer-runner.mjs +1102 -0
  176. package/scripts/installer-server.mjs +881 -0
  177. package/scripts/installer-windows-artifacts.json +15 -0
  178. package/scripts/installer-windows.mjs +752 -0
  179. package/scripts/main-channel.mjs +452 -0
  180. package/scripts/npm-pack-result.mjs +31 -0
  181. package/scripts/render-cache-performance-worker.mjs +205 -0
  182. package/scripts/render-cache-performance.mjs +115 -0
  183. package/scripts/run-test-suite.mjs +22 -8
  184. package/scripts/test-installer-acceptance.sh +161 -0
  185. package/scripts/test-packed-runner.mjs +23 -5
  186. package/scripts/types-baseline.json +2 -92
  187. package/scripts/verify-package-files.mjs +82 -18
  188. package/skills/gentle-ai/SKILL.md +12 -11
  189. package/tests/agent-home.test.ts +56 -3
  190. package/tests/agent-model-resolution.test.ts +113 -0
  191. package/tests/agent-profiles.test.ts +12 -0
  192. package/tests/agent-risk-escalation.test.ts +123 -0
  193. package/tests/agents-completion-delivery.test.ts +17 -0
  194. package/tests/agents-protocol.test.ts +57 -0
  195. package/tests/agents-queries.test.ts +9 -9
  196. package/tests/agents-runner-process.test.ts +31 -0
  197. package/tests/agents-runner.test.ts +89 -4
  198. package/tests/auto-mode-invariants.test.ts +258 -0
  199. package/tests/auto-mode-sdk.test.ts +57 -0
  200. package/tests/auto-mode.test.ts +49 -0
  201. package/tests/auto-permission-classifier.test.ts +283 -0
  202. package/tests/auto-permission-runtime.test.ts +196 -0
  203. package/tests/background-cache-warming.test.ts +2 -1
  204. package/tests/background-jobs.test.ts +227 -0
  205. package/tests/background-monitor.test.ts +195 -0
  206. package/tests/background-subagents-default-mode.test.ts +28 -5
  207. package/tests/bounded-stop-contract.test.ts +85 -0
  208. package/tests/bounded-writer-admission.test.ts +52 -1
  209. package/tests/bridge-wake-lifecycle.test.ts +129 -0
  210. package/tests/bridge-wake-rendering.test.ts +56 -0
  211. package/tests/build-distribution.test.ts +269 -0
  212. package/tests/builtin-codemode-optout.test.ts +242 -0
  213. package/tests/bundled-install.test.ts +1319 -0
  214. package/tests/bundled-wizard.test.ts +505 -0
  215. package/tests/card-content-policy.test.ts +68 -0
  216. package/tests/card-style-policy.test.ts +34 -2
  217. package/tests/child-codegraph-bootstrap.test.ts +74 -0
  218. package/tests/child-package-entrypoints.test.ts +65 -0
  219. package/tests/child-package-injection.test.ts +74 -0
  220. package/tests/child-safety.test.ts +12 -0
  221. package/tests/child-web-package.test.ts +224 -0
  222. package/tests/codegraph-tools.test.ts +35 -0
  223. package/tests/codemode-rendering.test.ts +107 -2
  224. package/tests/command-palette.test.ts +5 -5
  225. package/tests/context-threshold.test.ts +31 -0
  226. package/tests/delegate-for-reason-contract.test.ts +327 -0
  227. package/tests/delegated-key-learnings-contract.test.ts +3 -2
  228. package/tests/devbinary/native-review-parity.devtest.ts +1 -1
  229. package/tests/devbinary/pi-host-relay.devtest.ts +173 -3
  230. package/tests/engram-safety.test.ts +288 -0
  231. package/tests/generic-agent-tools.test.ts +16 -1
  232. package/tests/gentle-agents.test.ts +1722 -59
  233. package/tests/gentle-ai-binary-isolation.test.ts +135 -0
  234. package/tests/gentle-ai-binary.test.ts +19 -2
  235. package/tests/gentle-ai-child-guards.test.ts +202 -0
  236. package/tests/gentle-ai-dev-binary-surfacing.test.ts +125 -15
  237. package/tests/gentle-ai-installer.test.ts +548 -58
  238. package/tests/gentle-ai-prompt-model-routing.test.ts +123 -0
  239. package/tests/gentle-ai-renderer.test.ts +6 -6
  240. package/tests/gentle-ai.test.ts +999 -31
  241. package/tests/gentle-herdr-activity.test.ts +100 -0
  242. package/tests/gentle-notifications.test.ts +427 -0
  243. package/tests/gentle-shell-bin.test.ts +249 -5
  244. package/tests/gentle-shell-bundled.test.ts +1002 -0
  245. package/tests/gentle-shell-launcher.test.ts +234 -13
  246. package/tests/gentle-shell-startup-flow.test.ts +75 -0
  247. package/tests/gentle-shell-startup-update.test.ts +85 -0
  248. package/tests/gentle-shell-uninstall.test.ts +978 -0
  249. package/tests/gentle-shell-update-panel.test.ts +158 -0
  250. package/tests/gentle-shell.test.ts +541 -96
  251. package/tests/gentle-todo.test.ts +253 -2
  252. package/tests/herdr-activity.test.ts +243 -0
  253. package/tests/history-agent-home.test.ts +81 -0
  254. package/tests/history-child-guard.test.ts +70 -0
  255. package/tests/inprocess-reviewer.test.ts +20 -0
  256. package/tests/install-gentle-ai-failure.test.ts +69 -0
  257. package/tests/install-tui-mode-setting.test.ts +15 -0
  258. package/tests/install-wizard.test.ts +1223 -0
  259. package/tests/installer-bundles.test.ts +122 -0
  260. package/tests/installer-posix-bootstrap.test.ts +1201 -0
  261. package/tests/installer-preflight.test.ts +750 -0
  262. package/tests/installer-probes.test.ts +1106 -0
  263. package/tests/installer-runner.test.ts +2158 -0
  264. package/tests/installer-server.test.ts +1567 -0
  265. package/tests/installer-windows-bootstrap.test.ts +2410 -0
  266. package/tests/jobs-view.test.ts +160 -0
  267. package/tests/main-channel-upgrade.test.ts +389 -0
  268. package/tests/main-channel.test.ts +344 -0
  269. package/tests/maintainer/provider-relay.maintest.ts +13 -12
  270. package/tests/model-price-ratio.test.ts +116 -0
  271. package/tests/model-profiles-preservation.test.ts +153 -0
  272. package/tests/model-routing-package.test.ts +10 -0
  273. package/tests/nan-provider-runtime.test.ts +156 -0
  274. package/tests/nan-provider.test.ts +28 -18
  275. package/tests/native-binary-gate.test.ts +2 -0
  276. package/tests/native-review-capability-contract.test.ts +7 -1
  277. package/tests/native-review-cli.test.ts +236 -1
  278. package/tests/native-review-consent.test.ts +2 -2
  279. package/tests/native-review-parity-runtime.test.ts +1 -1
  280. package/tests/native-review-parity.test.ts +12 -48
  281. package/tests/native-risk-evidence-parity.test.ts +21 -0
  282. package/tests/no-self-pause-contract.test.ts +87 -0
  283. package/tests/notification-audio-native.test.ts +281 -0
  284. package/tests/notification-audio-windows.test.ts +581 -0
  285. package/tests/notification-audio.test.ts +548 -0
  286. package/tests/notification-customize.test.ts +655 -0
  287. package/tests/notification-events.test.ts +115 -0
  288. package/tests/notification-policy.test.ts +201 -0
  289. package/tests/notification-pulse-client.test.ts +356 -0
  290. package/tests/notification-pulse-protocol.test.ts +213 -0
  291. package/tests/notification-pulse-stream.test.ts +320 -0
  292. package/tests/notification-scheduler.test.ts +258 -0
  293. package/tests/notification-ui.test.ts +157 -0
  294. package/tests/npm-pack-result.test.ts +41 -0
  295. package/tests/odd-integration.test.ts +14 -5
  296. package/tests/odd-routing-canonical-ratchet.test.ts +53 -12
  297. package/tests/odd-routing-contract.test.ts +80 -23
  298. package/tests/orchestrator-budget.test.ts +29 -6
  299. package/tests/orchestrator-catalog.test.ts +146 -0
  300. package/tests/orchestrator-consultation-sdk.test.ts +614 -0
  301. package/tests/orchestrator-consultation.test.ts +111 -0
  302. package/tests/orchestrator-discovery.test.ts +241 -0
  303. package/tests/orchestrator-helper-consent.test.ts +171 -0
  304. package/tests/orchestrator-helper.test.ts +297 -0
  305. package/tests/orchestrator-message-card.test.ts +190 -0
  306. package/tests/orchestrator-presence.test.ts +23 -0
  307. package/tests/orchestrator-rdd-ownership.test.ts +6 -5
  308. package/tests/orchestrator-scope.test.ts +107 -0
  309. package/tests/orchestrator-state.test.ts +114 -0
  310. package/tests/orchestrator-status-publication-contract.test.ts +34 -0
  311. package/tests/orchestrator-tool-card.test.ts +398 -0
  312. package/tests/orchestrator-work-search.test.ts +318 -0
  313. package/tests/orchestrator-work.test.ts +147 -0
  314. package/tests/package-manifest.test.ts +101 -17
  315. package/tests/packed-runner-owned-path.test.ts +35 -1
  316. package/tests/parallel-reason-contract.test.ts +21 -0
  317. package/tests/parallel-writer-admission.test.ts +210 -0
  318. package/tests/permission-mode-policy.test.ts +194 -0
  319. package/tests/persona-single-channel.test.ts +4 -12
  320. package/tests/pi-pretty.test.ts +56 -0
  321. package/tests/provider-defect-handoff.test.ts +4 -3
  322. package/tests/quiet-tool-rendering.test.ts +160 -3
  323. package/tests/rdd-aware-verification-contract.test.ts +29 -41
  324. package/tests/render-cache-performance.test.ts +48 -0
  325. package/tests/review-agent-end-preflight.test.ts +62 -10
  326. package/tests/review-candidate-view.test.ts +101 -12
  327. package/tests/review-contract-prompt.test.ts +33 -4
  328. package/tests/review-controller-native-recovery.test.ts +327 -17
  329. package/tests/review-controller-native-routing.test.ts +255 -1
  330. package/tests/review-controller-workspace-root.test.ts +43 -2
  331. package/tests/review-controller.test.ts +2 -2
  332. package/tests/review-correction-lifecycle.test.ts +2 -1
  333. package/tests/review-gate.test.ts +7 -4
  334. package/tests/review-graph-schema.test.ts +2 -2
  335. package/tests/review-host-relay-routing.test.ts +5 -3
  336. package/tests/review-host-relay.test.ts +49 -2
  337. package/tests/review-integration-v2-forward.test.ts +21 -1
  338. package/tests/review-json-arguments.test.ts +167 -0
  339. package/tests/review-last-event-closure.test.ts +157 -8
  340. package/tests/review-ledger-contract.test.ts +5 -4
  341. package/tests/review-policy-judgment-day.test.ts +1 -1
  342. package/tests/review-policy-ordinary.test.ts +2 -2
  343. package/tests/review-relay-transport-agent.test.ts +66 -1
  344. package/tests/review-risk-assessment.test.ts +109 -33
  345. package/tests/review-session-standing-permission-controller.test.ts +16 -17
  346. package/tests/review-session-standing-permission-ipc.test.ts +6 -5
  347. package/tests/review-test-fixtures.ts +7 -1
  348. package/tests/review-transaction.test.ts +18 -1
  349. package/tests/run-test-suite.test.ts +83 -5
  350. package/tests/runtime-harness.mjs +42 -15
  351. package/tests/runtime-metrics-extension.test.ts +1 -1
  352. package/tests/runtime-metrics-native.test.ts +31 -1
  353. package/tests/selection-engine.test.ts +30 -0
  354. package/tests/session-change-capture.test.ts +10 -10
  355. package/tests/session-changes-shell.test.ts +242 -48
  356. package/tests/session-changes.test.ts +17 -24
  357. package/tests/session-profile-binding.test.ts +163 -0
  358. package/tests/session-profile-freeze.test.ts +381 -0
  359. package/tests/session-subject-routing-contract.test.ts +34 -0
  360. package/tests/session-worktree-registry.test.ts +57 -2
  361. package/tests/shell-bar.test.ts +40 -0
  362. package/tests/shell-changes-view.test.ts +85 -34
  363. package/tests/shell-changes.test.ts +61 -62
  364. package/tests/shell-render-cache-runtime.test.ts +69 -0
  365. package/tests/shell-render-cache.test.ts +129 -0
  366. package/tests/shell-sidebar-layout.test.ts +27 -2
  367. package/tests/shell-todo.test.ts +120 -2
  368. package/tests/shell-usage-view.test.ts +1 -1
  369. package/tests/shell-usage.test.ts +35 -0
  370. package/tests/short-check-routing-contract.test.ts +49 -0
  371. package/tests/skill-registry-watcher.test.ts +119 -0
  372. package/tests/skill-registry.test.ts +311 -5
  373. package/tests/startup-banner.test.ts +117 -3
  374. package/tests/startup-home-repo.test.ts +170 -0
  375. package/tests/status-timing-diagnostics.test.ts +283 -0
  376. package/tests/support/orchestrator-modules.ts +19 -0
  377. package/tests/task-size-routing-contract.test.ts +241 -0
  378. package/tests/telemetry-trigger.test.ts +27 -1
  379. package/tests/test-strength-contract.test.ts +124 -0
  380. package/tests/verify-agent-contract.test.ts +90 -0
  381. package/tests/verify-first-launch-contract.test.ts +139 -0
  382. package/tests/verify-package-files.test.ts +56 -0
  383. package/tests/vim-editor-adapter.test.ts +7 -7
  384. package/tests/visual-customization-policy.test.ts +32 -3
  385. package/tests/visual-customize-view.test.ts +288 -10
  386. package/tests/writer-edit-surface-scope.test.ts +59 -2
  387. package/tests/writer-surfaces.test.ts +199 -0
  388. package/tests/yolo-customize.test.ts +18 -3
  389. package/tests/yolo-mode-runtime.test.ts +37 -10
  390. package/tests/yolo-mode.test.ts +32 -4
  391. package/tests/yolo-session-policy.test.ts +1 -1
  392. /package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/bundle/README.md +0 -0
  393. /package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/bundle/schemas/lens.schema.json +0 -0
  394. /package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/bundle/schemas/refuter.schema.json +0 -0
  395. /package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  396. /package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/bundle/vectors/lens.json +0 -0
  397. /package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/bundle/vectors/refuter.json +0 -0
  398. /package/contracts/review-provider-contract-mirror/{v1.2.0 → v1.3.0}/bundle/vectors/targeted-validator.json +0 -0
@@ -1,5 +1,6 @@
1
1
  // Generated by scripts/build-runtime-modules.mjs. Do not edit.
2
- import { join, resolve as resolvePath } from "node:path";
2
+ import { isAbsolute, join, resolve as resolvePath } from "node:path";
3
+ import { CHILD_PACKAGE_INJECTION_ENV, encodeChildPackageInjection, } from "./child-package-injection.mjs";
3
4
 
4
5
  // The gentle-shell launcher: pure, side-effect-free functions over injected
5
6
  // env/fs/exec. `bin/gentle-shell.mjs` (T2) wires these into the real process,
@@ -36,11 +37,12 @@ function isPiSubcommand(token ) {
36
37
 
37
38
 
38
39
 
39
- // Home-subcommand parsing is deliberately shallow: `home` only counts as the
40
- // subcommand when it is argv[0], and everything after it is handed over
40
+ // Home-, upgrade- and self-uninstall-subcommand parsing is deliberately shallow:
41
+ // each only counts as the subcommand when it is argv[0], and everything after it is handed over
41
42
  // untouched as commandArgs — T2 owns interpreting `home link|isolated|<path>`.
43
+ // `self-uninstall` is not `uninstall`, which stays pi's own alias for `remove`.
42
44
  export function parseLauncherArgs(argv ) {
43
- if (argv[0] === "home") {
45
+ if (argv[0] === "home" || argv[0] === "upgrade" || argv[0] === "self-uninstall") {
44
46
  return {
45
47
  link: false,
46
48
  isolated: false,
@@ -48,7 +50,7 @@ export function parseLauncherArgs(argv ) {
48
50
  packageRoot: undefined,
49
51
  help: false,
50
52
  version: false,
51
- command: "home",
53
+ command: argv[0],
52
54
  commandArgs: argv.slice(1),
53
55
  passthrough: [],
54
56
  piSubcommand: undefined,
@@ -189,35 +191,36 @@ export function parseLauncherArgs(argv ) {
189
191
 
190
192
 
191
193
 
192
- // Pi Subagents resolves `PI_CODING_AGENT_DIR || ~/.pi/agent`; `--link` reuses
193
- // that exact home so gentle-shell never diverges from the user's own pi.
194
+ // Pi Subagents resolves `PI_CODING_AGENT_DIR || ~/.pi/agent`; this is the
195
+ // user's own pi home when no Gentle Shell session is involved.
194
196
  function linkDir(env , homedir ) {
195
197
  return env.PI_CODING_AGENT_DIR || join(homedir, ".pi", "agent");
196
198
  }
197
199
 
198
200
  // The isolated home replaces PI_CODING_AGENT_DIR for the whole session, so the
199
201
  // user's own Pi home travels in this variable for read-only features such as
200
- // /gentle:stats. An inherited value wins: a gentle-shell launched from inside
201
- // a Gentle Shell session sees the outer isolated home as PI_CODING_AGENT_DIR.
202
+ // /gentle:stats and for `--link`. An inherited value wins: a gentle-shell
203
+ // launched from inside a Gentle Shell session sees the outer isolated home as
204
+ // PI_CODING_AGENT_DIR, so `--link` must not re-select it (#2015).
202
205
  export const USER_PI_HOME_ENV = "GENTLE_SHELL_USER_PI_HOME";
203
206
 
204
207
  export function userPiHome(env , homedir ) {
205
208
  return env[USER_PI_HOME_ENV] || linkDir(env, homedir);
206
209
  }
207
210
 
208
- function isolatedDir(env , homedir ) {
211
+ export function isolatedDir(env , homedir ) {
209
212
  return env.GENTLE_SHELL_HOME || join(homedir, ".gentle-shell", "agent");
210
213
  }
211
214
 
212
215
  export function resolveHome(input ) {
213
216
  const { args, env, homedir, config } = input;
214
217
 
215
- if (args.link) return { mode: "link", dir: linkDir(env, homedir), source: "flag" };
218
+ if (args.link) return { mode: "link", dir: userPiHome(env, homedir), source: "flag" };
216
219
  if (args.isolated) return { mode: "isolated", dir: isolatedDir(env, homedir), source: "flag" };
217
220
  if (args.home !== undefined) return { mode: "path", dir: args.home, source: "flag" };
218
221
 
219
222
  if (config !== undefined) {
220
- if (config.mode === "link") return { mode: "link", dir: linkDir(env, homedir), source: "config" };
223
+ if (config.mode === "link") return { mode: "link", dir: userPiHome(env, homedir), source: "config" };
221
224
  if (config.mode === "isolated") return { mode: "isolated", dir: isolatedDir(env, homedir), source: "config" };
222
225
  return { mode: "path", dir: config.dir, source: "config" };
223
226
  }
@@ -883,6 +886,10 @@ export function discoverLooseExtensionEntries(dir , fs )
883
886
 
884
887
 
885
888
 
889
+
890
+
891
+
892
+
886
893
 
887
894
 
888
895
 
@@ -920,8 +927,15 @@ export function discoverLooseExtensionEntries(dir , fs )
920
927
  // - Not takeOver, with a declaration: no injection at all — the target
921
928
  // settings already load a gentle-pi the launcher accepts as-is (the
922
929
  // `--link` case with a pi-managed install matching this launcher).
930
+ //
931
+ // The two injecting cases also export CHILD_PACKAGE_INJECTION_ENV (#1690) so
932
+ // the subagent runner can give delegated children the same package. It holds
933
+ // only the launcher's own computed -e set; passthrough -e flags (the managed
934
+ // herdr extension, or one the user typed) are not part of it. Every other case
935
+ // removes an inherited value, so a nested launch never leaks a stale signal.
923
936
  export function buildPiInvocation(input ) {
924
937
  const args = [...input.runtime.args];
938
+ let childInjection ;
925
939
 
926
940
  if (input.piSubcommand !== undefined) {
927
941
  // No injection at all: pi must see the bare subcommand as argv[0].
@@ -946,23 +960,36 @@ export function buildPiInvocation(input ) {
946
960
  injected.add(input.packageRoot);
947
961
  args.push("-e", input.packageRoot);
948
962
  }
949
-
963
+ // The argv dedupe above compares raw strings; the signal dedupes again
964
+ // after absolutizing, so a relative and an absolute spelling of the same
965
+ // file appear once, in first-occurrence order.
966
+ const signalPaths = new Set([...injected].map((path) => absoluteExtensionPath(path, input.cwd)));
967
+ childInjection = { noExtensions: true, extensionPaths: [...signalPaths] };
950
968
  } else if (input.declaration === undefined) {
951
969
  args.push("-e", input.packageRoot);
970
+ childInjection = { noExtensions: false, extensionPaths: [absoluteExtensionPath(input.packageRoot, input.cwd)] };
952
971
  }
953
972
 
954
973
  args.push(...input.passthrough);
955
974
 
956
- return {
957
- command: input.runtime.command,
958
- args,
959
- env: {
960
- ...input.baseEnv,
961
- PI_CODING_AGENT_DIR: input.home.dir,
962
- GENTLE_PI_AGENT_HOME: input.home.dir,
963
- [USER_PI_HOME_ENV]: userPiHome(input.baseEnv, input.homedir),
964
- },
975
+ const env = {
976
+ ...input.baseEnv,
977
+ PI_CODING_AGENT_DIR: input.home.dir,
978
+ GENTLE_PI_AGENT_HOME: input.home.dir,
979
+ [USER_PI_HOME_ENV]: userPiHome(input.baseEnv, input.homedir),
965
980
  };
981
+ if (childInjection === undefined) delete env[CHILD_PACKAGE_INJECTION_ENV];
982
+ else env[CHILD_PACKAGE_INJECTION_ENV] = encodeChildPackageInjection(childInjection);
983
+
984
+ return { command: input.runtime.command, args, env };
985
+ }
986
+
987
+ // pi resolves a relative -e path against its spawn cwd. Children may run
988
+ // elsewhere, so the signal carries the same file as an absolute path. Loose
989
+ // entries can be relative when the isolated or linked home comes from a
990
+ // relative env value.
991
+ function absoluteExtensionPath(path , cwd ) {
992
+ return isAbsolute(path) ? path : resolvePath(cwd, path);
966
993
  }
967
994
 
968
995
  // --- spawn planning ------------------------------------------------------------
@@ -1149,6 +1176,9 @@ export function helpText() {
1149
1176
  "Usage: gentle-shell [options] [-- pi-args...]",
1150
1177
  " gentle-shell home [link|isolated|<path>]",
1151
1178
  " gentle-shell [home selectors] setup [--dry-run]",
1179
+ " gentle-shell upgrade [--channel release|main]",
1180
+ " gentle-shell upgrade --rollback",
1181
+ " gentle-shell self-uninstall [--dry-run] [--yes] [--include-shared]",
1152
1182
  "",
1153
1183
  "Opens pi with the Gentle Shell package loaded, without touching your",
1154
1184
  "vanilla pi installation.",
@@ -1168,19 +1198,40 @@ export function helpText() {
1168
1198
  " (runs the package-local gentle-ai 'install --agent pi --scope global').",
1169
1199
  " Accepts --dry-run, forwarded to gentle-ai. Accepts a home selector",
1170
1200
  " (--link, --isolated, --home <dir>) before it.",
1201
+ " Warns if configured MCP servers remain disabled; never re-enables them.",
1202
+ " upgrade Update Gentle Shell along its channel: the latest release, or the latest",
1203
+ " main commits of Gentle Shell and Gentle AI (built locally; needs Go and",
1204
+ " pnpm). --channel switches the channel first. A bundled install (the web",
1205
+ " installer's own Node, pnpm and Pi) follows the release channel only:",
1206
+ " it installs the new version beside the current one, verifies it, then",
1207
+ " switches; --rollback switches back to the previous kept version.",
1208
+ " self-uninstall Remove Gentle Shell: its own data, the isolated home and the gentle-pi",
1209
+ " package. Shows the plan first and asks before removing (--yes skips",
1210
+ " the question). The shared ~/.pi/gentle-ai configuration is kept unless",
1211
+ " you accept or pass --include-shared; --dry-run only shows the plan.",
1212
+ " Never touches your pi home or custom --home homes.",
1171
1213
  "",
1172
1214
  "Managing packages:",
1173
1215
  " gentle-shell install npm:<pkg> Run pi's own 'install' against the resolved home.",
1174
1216
  " gentle-shell remove <source> Run pi's own 'remove' against the resolved home.",
1175
1217
  " gentle-shell list Run pi's own 'list' against the resolved home.",
1176
1218
  " gentle-shell update [target] Run pi's own 'update' against the resolved home.",
1219
+ " In a bundled install Pi ships pinned: 'update' without a package",
1220
+ " runs 'gentle-shell upgrade' instead of updating Pi.",
1177
1221
  " gentle-shell config Run pi's own 'config' against the resolved home.",
1178
1222
  " gentle-shell auth <command> Run pi's own 'auth' against the resolved home.",
1223
+ " 'gentle-shell uninstall <source>' is pi's own alias for 'remove'; to remove Gentle",
1224
+ " Shell itself, use 'gentle-shell self-uninstall'.",
1179
1225
  " These run pi's own commands, forwarded verbatim, against the --isolated home",
1180
1226
  " (or your own pi home with --link). Running 'gentle-shell install npm:gentle-pi'",
1181
1227
  " inside the isolated home is unnecessary: gentle-shell already loads the",
1182
1228
  " package itself.",
1183
1229
  "",
1230
+ "Bundled interactive startup:",
1231
+ " Before opening Pi, checks for a newer release (at most 1.5 seconds).",
1232
+ " Choose Update now to upgrade and reopen, Not now, or Skip this version.",
1233
+ " Offline, unavailable checks, commands and noninteractive runs open normally.",
1234
+ "",
1184
1235
  "Environment variables:",
1185
1236
  " GENTLE_SHELL_PI Path to the pi executable to run.",
1186
1237
  " GENTLE_SHELL_HOME Directory for the isolated home (default: ~/.gentle-shell/agent).",
@@ -0,0 +1,55 @@
1
+ // Generated by scripts/build-runtime-modules.mjs. Do not edit.
2
+ import { realpathSync, readFileSync } from "node:fs";
3
+ import { join, relative, isAbsolute } from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+
6
+ // Resolve through the switched version, never the old launcher's captured pins.
7
+ export async function resolveStartupRelaunch(input
8
+
9
+ ) {
10
+ const { activeVersion, prefixLayout } = await import("../scripts/bundled-install.mjs");
11
+ const layout = prefixLayout(input);
12
+ const id = activeVersion(layout);
13
+ if (!id) throw new Error("No active Gentle Shell after upgrade");
14
+ const versions = realpathSync(layout.versions);
15
+ const version = realpathSync(join(versions, id));
16
+ const inside = (root , file ) => {
17
+ const path = relative(root, file);
18
+ return path !== "" && !path.startsWith("..") && !isAbsolute(path);
19
+ };
20
+ if (!inside(versions, version) || readFileSync(join(version, ".gentle-shell-version"), "utf8") !== `${id}\n`) {
21
+ throw new Error("Invalid active Gentle Shell version");
22
+ }
23
+ const pkg = join(version, "node_modules", "gentle-pi");
24
+ const modulePath = realpathSync(join(pkg, "scripts", "bundled-install.mjs"));
25
+ const entry = realpathSync(join(pkg, "bin", "gentle-shell.mjs"));
26
+ if (!inside(version, modulePath) || !inside(version, entry)) throw new Error("Active launcher escaped its version");
27
+ const release = await import(pathToFileURL(modulePath).href);
28
+ const next = release.prefixLayout(input);
29
+ return { command: next.node, args: [entry, ...input.argv], env: { ...input.env, GENTLE_SHELL_SKIP_STARTUP_UPDATE: "1" } };
30
+ }
31
+
32
+ // Only an explicit update selection may cross the existing upgrade boundary.
33
+ export async function applyStartupChoice(choice , effects
34
+
35
+
36
+
37
+
38
+ ) {
39
+ if (choice === "cancel") return 130;
40
+ if (choice === "omit") {
41
+ try { effects.omit(); }
42
+ catch { effects.warn?.("Could not remember the skipped release; continuing without saving."); }
43
+ }
44
+ if (choice !== "update") return undefined;
45
+ if (await effects.upgrade() !== 0) return undefined;
46
+ // A failed relaunch must not fall through to the captured old packageRoot.
47
+ return effects.relaunch();
48
+ }
49
+
50
+ export function omitStartupVersion(read , write , version ) {
51
+ const text = read();
52
+ const config = text === undefined ? {} : JSON.parse(text);
53
+ if (config === null || typeof config !== "object" || Array.isArray(config)) throw new Error("Invalid launcher config");
54
+ write(`${JSON.stringify({ ...config, skippedStartupRelease: version }, null, 2)}\n`);
55
+ }
@@ -0,0 +1,93 @@
1
+ // Generated by scripts/build-runtime-modules.mjs. Do not edit.
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+ export function shouldCheckStartupUpdate({ args, env, bundled, inputTTY, outputTTY } ) {
26
+ if (!bundled || !inputTTY || !outputTTY || args.command || args.piSubcommand || args.error || args.help || args.version || args.packageRoot !== undefined) {
27
+ return false;
28
+ }
29
+ if (env.GENTLE_PI_AGENTS_CHILD || env.PI_OFFLINE || env.GENTLE_SHELL_SKIP_STARTUP_UPDATE) {
30
+ return false;
31
+ }
32
+
33
+ // An allowlist keeps new command modes from accidentally showing a prompt.
34
+ for (let i = 0; i < args.passthrough.length; i += 1) {
35
+ const token = args.passthrough[i];
36
+ if (token === "--continue" || token === "-c") continue;
37
+ if (token.startsWith("--resume=") && token.length > "--resume=".length) continue;
38
+ if (token === "--resume" || token === "-r") {
39
+ const next = args.passthrough[i + 1];
40
+ if (next !== undefined && !next.startsWith("-")) i += 1;
41
+ continue;
42
+ }
43
+ return false;
44
+ }
45
+ return true;
46
+ }
47
+
48
+ function stableParts(version ) {
49
+ // No leading zeros, prefixes, whitespace, prereleases or build metadata.
50
+ const match = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.exec(version);
51
+ return match && match[0] === version ? match.slice(1) : undefined;
52
+ }
53
+
54
+ function isNewer(latest , current ) {
55
+ for (let i = 0; i < 3; i += 1) {
56
+ if (latest[i] === current[i]) continue;
57
+ // Decimal string comparison avoids rounding even for arbitrarily large parts.
58
+ return latest[i].length !== current[i].length
59
+ ? latest[i].length > current[i].length
60
+ : latest[i] > current[i];
61
+ }
62
+ return false;
63
+ }
64
+
65
+ export async function findStartupUpdate({ current, skipped, lookup, timeoutMs = 1500 } ) {
66
+ const currentParts = stableParts(current);
67
+ if (!currentParts) return undefined;
68
+ const controller = new AbortController();
69
+ const deadline = Number.isFinite(timeoutMs) && timeoutMs >= 0 && timeoutMs <= 2_147_483_647 ? timeoutMs : 1500;
70
+ let timer ;
71
+ try {
72
+ const timeout = new Promise ((resolve) => {
73
+ timer = setTimeout(() => {
74
+ resolve(undefined);
75
+ controller.abort();
76
+ }, deadline);
77
+ });
78
+ // The race bounds startup even if the injected lookup ignores cancellation.
79
+ const latest = await Promise.race([lookup(controller.signal), timeout]);
80
+ if (latest === undefined || latest === skipped) return undefined;
81
+ const latestParts = stableParts(latest);
82
+ if (!latestParts || !isNewer(latestParts, currentParts)) return undefined;
83
+ return {
84
+ current,
85
+ latest,
86
+ notesUrl: `https://github.com/Gentleman-Programming/gentle-shell/releases/tag/v${latest}`,
87
+ };
88
+ } catch {
89
+ return undefined;
90
+ } finally {
91
+ clearTimeout(timer);
92
+ }
93
+ }