gentle-pi 4.8.0 → 4.9.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 (370) hide show
  1. package/README.md +60 -0
  2. package/assets/agents/gentle-ai-explore.md +1 -1
  3. package/assets/agents/gentle-ai-verify.md +1 -1
  4. package/assets/agents/gentle-ai-worker.md +10 -9
  5. package/assets/design-canvas/canvas-boards.js +22 -2
  6. package/assets/design-canvas/canvas-boot.js +3 -1
  7. package/assets/design-canvas/canvas-i18n-es.js +5 -0
  8. package/assets/design-canvas/canvas-menu.js +13 -7
  9. package/assets/design-canvas/canvas-messages.js +1 -1
  10. package/assets/design-canvas/canvas-rail.js +5 -2
  11. package/assets/design-canvas/canvas-store.js +3 -0
  12. package/assets/design-canvas/canvas-theme.js +69 -0
  13. package/assets/design-canvas/canvas.css +27 -2
  14. package/assets/design-canvas/index.html +3 -0
  15. package/assets/design-canvas/inspector.js +28 -5
  16. package/assets/design-canvas/theme-early.js +10 -0
  17. package/assets/migrations/agent-body-history.json +6 -0
  18. package/assets/orchestrator-delegation.md +1 -5
  19. package/assets/orchestrator-full-delegation-card.md +9 -13
  20. package/assets/orchestrator-full-delegation.md +2 -2
  21. package/assets/orchestrator-memory.md +2 -2
  22. package/assets/orchestrator-prompts.md +3 -31
  23. package/assets/orchestrator-tracking.md +6 -6
  24. package/assets/orchestrator-verification.md +4 -4
  25. package/assets/orchestrator-writer.md +12 -12
  26. package/assets/orchestrator.md +2 -2
  27. package/bin/gentle-shell.mjs +77 -1
  28. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +7 -7
  29. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/manifest.json +3 -3
  30. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/orchestration/pi.md +1 -1
  31. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/routing/pi.md +10 -10
  32. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
  33. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
  34. package/docs/assets/features/gentle-tower.png +0 -0
  35. package/docs/auto-permission-answers.md +1 -1
  36. package/docs/bundled-install.md +1 -1
  37. package/docs/delegated-verification.md +6 -4
  38. package/docs/desktop-feed.md +303 -0
  39. package/docs/desktop-rpc.md +703 -25
  40. package/docs/fast-mode.md +2 -2
  41. package/docs/gentle-shell-desktop.md +465 -0
  42. package/docs/gentle-shell.md +65 -3
  43. package/docs/images/desktop/chat.png +0 -0
  44. package/docs/images/desktop/palette.png +0 -0
  45. package/docs/images/desktop/todo.png +0 -0
  46. package/docs/install-wizard.md +1 -1
  47. package/docs/odd-preparation-continuity.md +1 -1
  48. package/docs/readme-reference.md +44 -15
  49. package/docs/work-continuity.md +10 -7
  50. package/extensions/ask-user-choice.ts +36 -18
  51. package/extensions/ask-user-question.ts +47 -8
  52. package/extensions/gentle-agents.ts +206 -37
  53. package/extensions/gentle-ai.ts +234 -24
  54. package/extensions/gentle-desktop-feed.ts +778 -0
  55. package/extensions/gentle-desktop-rpc.ts +145 -12
  56. package/extensions/gentle-herdr-desktop-status.ts +275 -0
  57. package/extensions/gentle-shell.ts +69 -7
  58. package/extensions/gentle-stats.ts +30 -1
  59. package/extensions/gentle-tower.ts +305 -0
  60. package/extensions/skill-registry.ts +13 -3
  61. package/herdr/RECIPE.md +157 -0
  62. package/herdr/keys.json +14 -0
  63. package/herdr/layouts/gentle-shell.json +202 -0
  64. package/herdr/mods/gentle-agents/icons/kind-herdr.svg +1 -0
  65. package/herdr/mods/gentle-agents/icons/kind-remote.svg +1 -0
  66. package/herdr/mods/gentle-agents/icons/kind-tui.svg +1 -0
  67. package/herdr/mods/gentle-agents/main.js +190 -0
  68. package/herdr/mods/gentle-agents/mod.json +1 -0
  69. package/herdr/mods/gentle-agents/snapshot.js +469 -0
  70. package/herdr/mods/gentle-agents/tokens.js +273 -0
  71. package/herdr/mods/gentle-chat/MINIMAL.md +69 -0
  72. package/herdr/mods/gentle-chat/actions.js +180 -0
  73. package/herdr/mods/gentle-chat/feed.js +321 -0
  74. package/herdr/mods/gentle-chat/icons/branch.svg +1 -0
  75. package/herdr/mods/gentle-chat/icons/chat.svg +1 -0
  76. package/herdr/mods/gentle-chat/icons/check.svg +1 -0
  77. package/herdr/mods/gentle-chat/icons/chev.svg +1 -0
  78. package/herdr/mods/gentle-chat/icons/clip.svg +1 -0
  79. package/herdr/mods/gentle-chat/icons/down.svg +1 -0
  80. package/herdr/mods/gentle-chat/icons/folder.svg +1 -0
  81. package/herdr/mods/gentle-chat/icons/kind-herdr.svg +1 -0
  82. package/herdr/mods/gentle-chat/icons/kind-remote.svg +1 -0
  83. package/herdr/mods/gentle-chat/icons/kind-tui.svg +1 -0
  84. package/herdr/mods/gentle-chat/icons/mark.svg +1 -0
  85. package/herdr/mods/gentle-chat/icons/send.svg +1 -0
  86. package/herdr/mods/gentle-chat/icons/shield.svg +1 -0
  87. package/herdr/mods/gentle-chat/icons/stop.svg +1 -0
  88. package/herdr/mods/gentle-chat/icons/term.svg +1 -0
  89. package/herdr/mods/gentle-chat/icons/user.svg +1 -0
  90. package/herdr/mods/gentle-chat/icons/x.svg +1 -0
  91. package/herdr/mods/gentle-chat/main.js +968 -0
  92. package/herdr/mods/gentle-chat/mod.json +1 -0
  93. package/herdr/mods/gentle-chat/session.js +212 -0
  94. package/herdr/mods/gentle-chat/snapshot.js +469 -0
  95. package/herdr/mods/gentle-chat/tokens.js +137 -0
  96. package/herdr/mods/gentle-chat/ui.js +883 -0
  97. package/herdr/mods/gentle-confirm/main.js +60 -0
  98. package/herdr/mods/gentle-confirm/mod.json +1 -0
  99. package/herdr/mods/gentle-inspector/actions.js +180 -0
  100. package/herdr/mods/gentle-inspector/icons/bolt.svg +1 -0
  101. package/herdr/mods/gentle-inspector/icons/bot.svg +1 -0
  102. package/herdr/mods/gentle-inspector/icons/check.svg +1 -0
  103. package/herdr/mods/gentle-inspector/icons/db.svg +1 -0
  104. package/herdr/mods/gentle-inspector/icons/diff.svg +1 -0
  105. package/herdr/mods/gentle-inspector/icons/jobs.svg +1 -0
  106. package/herdr/mods/gentle-inspector/icons/plug.svg +1 -0
  107. package/herdr/mods/gentle-inspector/icons/review.svg +1 -0
  108. package/herdr/mods/gentle-inspector/icons/stats.svg +1 -0
  109. package/herdr/mods/gentle-inspector/icons/stop.svg +1 -0
  110. package/herdr/mods/gentle-inspector/icons/todo.svg +1 -0
  111. package/herdr/mods/gentle-inspector/main.js +500 -0
  112. package/herdr/mods/gentle-inspector/mod.json +1 -0
  113. package/herdr/mods/gentle-inspector/snapshot.js +469 -0
  114. package/herdr/mods/gentle-inspector/tokens.js +273 -0
  115. package/herdr/mods/gentle-palette/actions.js +180 -0
  116. package/herdr/mods/gentle-palette/icons/bolt.svg +1 -0
  117. package/herdr/mods/gentle-palette/icons/bot.svg +1 -0
  118. package/herdr/mods/gentle-palette/icons/chat.svg +1 -0
  119. package/herdr/mods/gentle-palette/icons/check.svg +1 -0
  120. package/herdr/mods/gentle-palette/icons/cmd.svg +1 -0
  121. package/herdr/mods/gentle-palette/icons/diff.svg +1 -0
  122. package/herdr/mods/gentle-palette/icons/jobs.svg +1 -0
  123. package/herdr/mods/gentle-palette/icons/plus.svg +1 -0
  124. package/herdr/mods/gentle-palette/icons/review.svg +1 -0
  125. package/herdr/mods/gentle-palette/icons/search.svg +1 -0
  126. package/herdr/mods/gentle-palette/icons/shield.svg +1 -0
  127. package/herdr/mods/gentle-palette/icons/stats.svg +1 -0
  128. package/herdr/mods/gentle-palette/icons/stop.svg +1 -0
  129. package/herdr/mods/gentle-palette/icons/term.svg +1 -0
  130. package/herdr/mods/gentle-palette/icons/todo.svg +1 -0
  131. package/herdr/mods/gentle-palette/main.js +333 -0
  132. package/herdr/mods/gentle-palette/mod.json +1 -0
  133. package/herdr/mods/gentle-palette/snapshot.js +469 -0
  134. package/herdr/mods/gentle-palette/tokens.js +273 -0
  135. package/herdr/mods/gentle-pane/icons/chat.svg +1 -0
  136. package/herdr/mods/gentle-pane/icons/close.svg +1 -0
  137. package/herdr/mods/gentle-pane/icons/kind-herdr.svg +1 -0
  138. package/herdr/mods/gentle-pane/icons/kind-remote.svg +1 -0
  139. package/herdr/mods/gentle-pane/icons/kind-tui.svg +1 -0
  140. package/herdr/mods/gentle-pane/icons/split-down.svg +1 -0
  141. package/herdr/mods/gentle-pane/icons/split-right.svg +1 -0
  142. package/herdr/mods/gentle-pane/icons/term.svg +1 -0
  143. package/herdr/mods/gentle-pane/icons/unzoom.svg +1 -0
  144. package/herdr/mods/gentle-pane/icons/zoom.svg +1 -0
  145. package/herdr/mods/gentle-pane/main.js +91 -0
  146. package/herdr/mods/gentle-pane/mod.json +1 -0
  147. package/herdr/mods/gentle-pane/snapshot.js +469 -0
  148. package/herdr/mods/gentle-pane/tokens.js +273 -0
  149. package/herdr/mods/gentle-sidebar/actions.js +180 -0
  150. package/herdr/mods/gentle-sidebar/icons/gear.svg +1 -0
  151. package/herdr/mods/gentle-sidebar/icons/mark.svg +1 -0
  152. package/herdr/mods/gentle-sidebar/icons/refresh.svg +1 -0
  153. package/herdr/mods/gentle-sidebar/icons/server-plus.svg +1 -0
  154. package/herdr/mods/gentle-sidebar/main.js +171 -0
  155. package/herdr/mods/gentle-sidebar/mod.json +1 -0
  156. package/herdr/mods/gentle-sidebar/snapshot.js +469 -0
  157. package/herdr/mods/gentle-sidebar/tokens.js +273 -0
  158. package/herdr/mods/gentle-spaces/icons/kind-herdr.svg +1 -0
  159. package/herdr/mods/gentle-spaces/icons/kind-remote.svg +1 -0
  160. package/herdr/mods/gentle-spaces/icons/kind-tui.svg +1 -0
  161. package/herdr/mods/gentle-spaces/icons/monitor.svg +1 -0
  162. package/herdr/mods/gentle-spaces/icons/plus.svg +1 -0
  163. package/herdr/mods/gentle-spaces/icons/server.svg +1 -0
  164. package/herdr/mods/gentle-spaces/machines.js +31 -0
  165. package/herdr/mods/gentle-spaces/main.js +299 -0
  166. package/herdr/mods/gentle-spaces/mod.json +1 -0
  167. package/herdr/mods/gentle-spaces/snapshot.js +469 -0
  168. package/herdr/mods/gentle-spaces/tokens.js +273 -0
  169. package/herdr/mods/gentle-status/actions.js +180 -0
  170. package/herdr/mods/gentle-status/main.js +192 -0
  171. package/herdr/mods/gentle-status/mod.json +1 -0
  172. package/herdr/mods/gentle-status/snapshot.js +469 -0
  173. package/herdr/mods/gentle-status/tokens.js +273 -0
  174. package/herdr/mods/gentle-tabs/icons/close.svg +1 -0
  175. package/herdr/mods/gentle-tabs/icons/kind-herdr.svg +1 -0
  176. package/herdr/mods/gentle-tabs/icons/kind-remote.svg +1 -0
  177. package/herdr/mods/gentle-tabs/icons/kind-tui.svg +1 -0
  178. package/herdr/mods/gentle-tabs/icons/plus.svg +1 -0
  179. package/herdr/mods/gentle-tabs/icons/win-close.svg +1 -0
  180. package/herdr/mods/gentle-tabs/icons/win-max.svg +1 -0
  181. package/herdr/mods/gentle-tabs/icons/win-min.svg +1 -0
  182. package/herdr/mods/gentle-tabs/icons/win-restore.svg +1 -0
  183. package/herdr/mods/gentle-tabs/main.js +171 -0
  184. package/herdr/mods/gentle-tabs/mod.json +1 -0
  185. package/herdr/mods/gentle-tabs/snapshot.js +469 -0
  186. package/herdr/mods/gentle-tabs/tokens.js +273 -0
  187. package/herdr/mods/gentle-tokens/main.js +20 -0
  188. package/herdr/mods/gentle-tokens/mod.json +1 -0
  189. package/herdr/mods/gentle-tokens/snapshot.js +469 -0
  190. package/herdr/mods/gentle-tokens/tokens.js +273 -0
  191. package/herdr/preview.png +0 -0
  192. package/herdr/themes/gentle-shell-dark.json +33 -0
  193. package/herdr/themes/gentle-shell-light.json +34 -0
  194. package/lib/agents-protocol.ts +2 -0
  195. package/lib/agents-rpc-publisher.ts +39 -12
  196. package/lib/agents-runner.ts +1 -0
  197. package/lib/auto-permission-answers.ts +2 -1
  198. package/lib/background-jobs.ts +22 -2
  199. package/lib/bounded-writer-admission.ts +1 -1
  200. package/lib/change-diff.ts +104 -0
  201. package/lib/commit-slice-signal.ts +1 -1
  202. package/lib/design-canvas-assets.ts +2 -0
  203. package/lib/desktop-agents-service.ts +31 -10
  204. package/lib/desktop-changes-service.ts +171 -0
  205. package/lib/desktop-feed-actions.ts +804 -0
  206. package/lib/desktop-feed-answers.ts +129 -0
  207. package/lib/desktop-feed-sources.ts +184 -0
  208. package/lib/desktop-feed-stats.ts +98 -0
  209. package/lib/desktop-feed-store.ts +124 -0
  210. package/lib/desktop-feed.ts +788 -0
  211. package/lib/desktop-jobs-service.ts +34 -7
  212. package/lib/desktop-review-service.ts +187 -0
  213. package/lib/desktop-rpc-agents.ts +112 -3
  214. package/lib/desktop-rpc-changes.ts +223 -0
  215. package/lib/desktop-rpc-config-watch.ts +285 -0
  216. package/lib/desktop-rpc-config.ts +162 -8
  217. package/lib/desktop-rpc-jobs.ts +118 -9
  218. package/lib/desktop-rpc-permissions.ts +154 -3
  219. package/lib/desktop-rpc-review.ts +180 -0
  220. package/lib/desktop-rpc-session.ts +203 -0
  221. package/lib/desktop-rpc-sessions.ts +250 -0
  222. package/lib/desktop-rpc-stats.ts +187 -0
  223. package/lib/desktop-rpc-updates.ts +143 -0
  224. package/lib/desktop-rpc.ts +116 -5
  225. package/lib/desktop-session-service.ts +223 -0
  226. package/lib/desktop-sessions-service.ts +249 -0
  227. package/lib/desktop-stats-service.ts +142 -0
  228. package/lib/desktop-updates-service.ts +268 -0
  229. package/lib/gentle-shell-desktop.ts +1370 -0
  230. package/lib/gentle-shell-launcher.ts +45 -3
  231. package/lib/herdr-desktop-events.ts +40 -0
  232. package/lib/herdr-desktop-status.ts +229 -0
  233. package/lib/jobs-sidebar-state.ts +5 -0
  234. package/lib/native-review-cli.ts +7 -0
  235. package/lib/openai-fast-tier.ts +1 -0
  236. package/lib/session-profile-freeze.ts +13 -5
  237. package/lib/stats-collector.ts +56 -27
  238. package/lib/tower-actions.ts +100 -0
  239. package/lib/tower-hub.ts +73 -0
  240. package/lib/tower-launch.ts +111 -0
  241. package/lib/tower-open.ts +99 -0
  242. package/lib/tower-presence.ts +70 -0
  243. package/lib/tower-server.ts +234 -0
  244. package/lib/tower-snapshot.ts +298 -0
  245. package/lib/update-status.ts +238 -0
  246. package/lib/verifier-settle-reminder.ts +1 -1
  247. package/package.json +13 -4
  248. package/runtime/design-canvas-assets.mjs +2 -0
  249. package/runtime/gentle-shell-desktop.mjs +1371 -0
  250. package/runtime/gentle-shell-launcher.mjs +44 -2
  251. package/runtime/native-review-cli.mjs +7 -0
  252. package/runtime/tower-actions.mjs +101 -0
  253. package/runtime/tower-hub.mjs +74 -0
  254. package/runtime/tower-launch.mjs +112 -0
  255. package/runtime/tower-open.mjs +100 -0
  256. package/runtime/tower-presence.mjs +71 -0
  257. package/runtime/tower-server.mjs +234 -0
  258. package/runtime/tower-snapshot.mjs +299 -0
  259. package/scripts/build-full-delegation-card.mjs +1 -21
  260. package/scripts/build-runtime-modules.mjs +9 -0
  261. package/scripts/gentle-ai-installer.mjs +10 -10
  262. package/scripts/verify-package-files.mjs +35 -15
  263. package/skills/provider-defect-report/SKILL.md +61 -0
  264. package/skills/rdd-defect-workflow/SKILL.md +3 -3
  265. package/tests/agent-prompt-diet-contract.test.ts +2 -2
  266. package/tests/append-system-prompt-route.test.ts +16 -5
  267. package/tests/ask-user-choice.test.ts +78 -21
  268. package/tests/ask-user-question.test.ts +59 -5
  269. package/tests/auto-permission-answers.test.ts +12 -1
  270. package/tests/background-jobs.test.ts +12 -0
  271. package/tests/bounded-stop-contract.test.ts +139 -26
  272. package/tests/change-diff.test.ts +75 -0
  273. package/tests/commit-slice-signal.test.ts +3 -2
  274. package/tests/decision-routing-contract.test.ts +390 -0
  275. package/tests/delegated-key-learnings-contract.test.ts +21 -28
  276. package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
  277. package/tests/design-canvas-i18n.test.ts +24 -22
  278. package/tests/design-canvas-inspector.test.ts +67 -0
  279. package/tests/design-canvas-modules.test.ts +3 -2
  280. package/tests/design-canvas-rail.test.ts +10 -10
  281. package/tests/design-canvas-store.test.ts +9 -0
  282. package/tests/design-canvas-theme.test.ts +198 -0
  283. package/tests/design-canvas-tokens.test.ts +1 -1
  284. package/tests/desktop-feed-actions-guards.test.ts +595 -0
  285. package/tests/desktop-feed-actions.test.ts +761 -0
  286. package/tests/desktop-feed-live-work.test.ts +209 -0
  287. package/tests/desktop-feed-performance.test.ts +369 -0
  288. package/tests/desktop-feed-plan-profiles.test.ts +509 -0
  289. package/tests/desktop-feed-send-prompt.test.ts +303 -0
  290. package/tests/desktop-feed-tool-summaries.test.ts +69 -0
  291. package/tests/desktop-feed.test.ts +615 -0
  292. package/tests/desktop-rpc-agents.test.ts +428 -2
  293. package/tests/desktop-rpc-changes.test.ts +608 -0
  294. package/tests/desktop-rpc-config-watch.test.ts +1159 -0
  295. package/tests/desktop-rpc-config.test.ts +11 -1
  296. package/tests/desktop-rpc-design.test.ts +11 -1
  297. package/tests/desktop-rpc-jobs.test.ts +402 -5
  298. package/tests/desktop-rpc-permissions.test.ts +11 -1
  299. package/tests/desktop-rpc-review.test.ts +678 -0
  300. package/tests/desktop-rpc-session.test.ts +642 -0
  301. package/tests/desktop-rpc-sessions.test.ts +647 -0
  302. package/tests/desktop-rpc-stats.test.ts +431 -0
  303. package/tests/desktop-rpc-updates.test.ts +525 -0
  304. package/tests/desktop-rpc-usage.test.ts +11 -1
  305. package/tests/desktop-rpc.test.ts +43 -2
  306. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +11 -13
  307. package/tests/fixtures/session-profile-v1/replay.ts +4 -1
  308. package/tests/full-delegation-closure.test.ts +20 -1
  309. package/tests/gentle-agents.test.ts +519 -4
  310. package/tests/gentle-ai-binary.test.ts +1 -1
  311. package/tests/gentle-ai-installer.test.ts +52 -52
  312. package/tests/gentle-ai.test.ts +75 -16
  313. package/tests/gentle-fast.test.ts +15 -0
  314. package/tests/gentle-herdr-desktop-status.test.ts +595 -0
  315. package/tests/gentle-shell-desktop-bin.test.ts +125 -0
  316. package/tests/gentle-shell-desktop.test.ts +927 -0
  317. package/tests/gentle-shell-launcher-tower.test.ts +104 -0
  318. package/tests/gentle-shell.test.ts +3 -0
  319. package/tests/gentle-tower.test.ts +578 -0
  320. package/tests/herdr-desktop-status.test.ts +285 -0
  321. package/tests/independent-recovery-delivery.test.ts +16 -4
  322. package/tests/installer-server.test.ts +2 -2
  323. package/tests/lazy-module-contradictions-contract.test.ts +27 -4
  324. package/tests/maintainer/desktop-rpc.maintest.ts +279 -4
  325. package/tests/native-review-capability-contract.test.ts +9 -1
  326. package/tests/no-self-pause-contract.test.ts +23 -13
  327. package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
  328. package/tests/odd-routing-contract.test.ts +19 -3
  329. package/tests/orchestrator-budget.test.ts +3 -1
  330. package/tests/orchestrator-prompt-budget.test.ts +2 -1
  331. package/tests/orchestrator-prompt-diet-contract.test.ts +31 -3
  332. package/tests/package-manifest.test.ts +10 -10
  333. package/tests/pi-routing-measured-values.test.ts +24 -0
  334. package/tests/primary-session-prompt.test.ts +25 -0
  335. package/tests/profile-fast-tier.test.ts +66 -1
  336. package/tests/provider-defect-handoff.test.ts +118 -100
  337. package/tests/review-contract-prompt.test.ts +2 -1
  338. package/tests/review-due-public-boundary.test.ts +2 -1
  339. package/tests/sensitive-path-tools.test.ts +138 -4
  340. package/tests/session-profile-extension.test.ts +310 -16
  341. package/tests/session-profile-freeze.test.ts +26 -0
  342. package/tests/session-profile-v1-compat.test.ts +20 -0
  343. package/tests/skill-collision-prefixes.test.ts +1 -0
  344. package/tests/skill-contradictions-contract.test.ts +5 -3
  345. package/tests/skill-registry.test.ts +54 -0
  346. package/tests/stats-collector.test.ts +109 -2
  347. package/tests/support/design-canvas-dom.ts +17 -0
  348. package/tests/task-size-routing-contract.test.ts +7 -3
  349. package/tests/tower-actions.test.ts +247 -0
  350. package/tests/tower-artifacts.test.ts +114 -0
  351. package/tests/tower-open.test.ts +97 -0
  352. package/tests/tower-presence.test.ts +175 -0
  353. package/tests/tower-server.test.ts +122 -0
  354. package/tests/tower-snapshot.test.ts +236 -0
  355. package/tests/tower-web-echo.test.ts +125 -0
  356. package/tests/tower-web-hover.test.ts +251 -0
  357. package/tests/verification-scoped-stop-contract.test.ts +32 -0
  358. package/tests/verification-tiers-contract.test.ts +5 -5
  359. package/tests/verifier-settle-reminder.test.ts +2 -2
  360. package/tests/verify-first-launch-contract.test.ts +2 -2
  361. package/tests/work-continuity-contract.test.ts +83 -17
  362. package/tests/writer-rejection-next-step.test.ts +55 -0
  363. package/tests/writer-surface-authority-contract.test.ts +158 -0
  364. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/README.md +0 -0
  365. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
  366. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
  367. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  368. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
  369. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
  370. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
@@ -180,8 +180,8 @@ test("installed Pi dispatches Desktop RPC without adding conversation messages",
180
180
  assert.equal(response.kind, "response");
181
181
  assert.equal(response.requestId, "real-1");
182
182
  assert.equal(response.ok, true);
183
- assert.deepEqual(response.data.methods, ["capabilities", "get_snapshot", "get_config", "set_config", "get_permission_mode", "set_permission_mode", "get_subscription_usage", "refresh_subscription_usage", "get_design_canvas", "list_jobs", "cancel_job", "apply_profile", "list_subagents", "cancel_subagent"]);
184
- assert.deepEqual(response.data.events, ["config_changed", "permission_mode_changed", "rate_limit", "design_canvas", "jobs_update", "profile_applied", "agents_update"]);
183
+ assert.deepEqual(response.data.methods, ["capabilities", "get_snapshot", "get_config", "set_config", "get_permission_mode", "set_permission_mode", "get_subscription_usage", "refresh_subscription_usage", "get_design_canvas", "list_jobs", "cancel_job", "get_job_output", "apply_profile", "list_subagents", "cancel_subagent", "get_subagent_thread", "list_sessions", "switch_session", "get_changes", "get_change_diff", "get_review_mode", "set_review_mode", "get_usage_stats", "get_update_status"]);
184
+ assert.deepEqual(response.data.events, ["config_changed", "permission_mode_changed", "rate_limit", "design_canvas", "jobs_update", "profile_applied", "agents_update", "review_mode_changed"]);
185
185
  } finally {
186
186
  rmSync(root, { recursive: true, force: true });
187
187
  }
@@ -410,18 +410,66 @@ test("installed Pi serves the owner-loaded empty job list without starting a job
410
410
  }
411
411
  });
412
412
 
413
+ /**
414
+ * Real production wiring for the update-status slice: the installed runtime
415
+ * reads its own version, the channel record, and Pi's package listing. The
416
+ * probe runs with `PI_OFFLINE=1`, so even `refresh: true` looks nothing up and
417
+ * every looked-up item stays unknown — never "up to date".
418
+ */
419
+ test("installed Pi serves offline update status without a lookup and without paths", async () => {
420
+ const root = isolatedRoot("desktop-rpc-updates-");
421
+ const probe = new LiveProbe(root, [desktopExtension]);
422
+ try {
423
+ const responseFor = (requestId: string) => probe.waitFor(
424
+ (record) => record.type === "extension_ui_request" && record.widgetKey === DESKTOP_RPC_WIDGET &&
425
+ JSON.parse(record.widgetLines[0]).kind === "response" &&
426
+ JSON.parse(record.widgetLines[0]).requestId === requestId,
427
+ `response ${requestId}`,
428
+ ).then((record) => JSON.parse(record.widgetLines[0]));
429
+
430
+ // The refresh is sent only after the plain read answered: each request
431
+ // is a separate prompt, and the probe keeps one in flight at a time.
432
+ for (const [id, params] of [["updates-1", {}], ["updates-2", { refresh: true }]] as const) {
433
+ probe.send(prompt(`prompt-${id}`, desktopRequest(id, "get_update_status", params)));
434
+ const status = await responseFor(id);
435
+ assert.equal(status.ok, true, JSON.stringify(status));
436
+ assert.equal(status.data.offline, true);
437
+ assert.equal(status.data.refreshed, false);
438
+ assert.equal(status.data.gentleShell.channel, "release", "no channel record means release");
439
+ assert.equal(status.data.gentleShell.command, "gentle-shell upgrade");
440
+ assert.notEqual(status.data.gentleShell.state, "up_to_date");
441
+ assert.match(status.data.pi.current, /^\d+\.\d+\.\d+/);
442
+ assert.deepEqual([status.data.pi.latest, status.data.pi.state], [null, "unknown"]);
443
+ assert.deepEqual(status.data.packages, { available: true, items: [], truncated: false, command: "gentle-shell update --extensions", checkedAt: null });
444
+ }
445
+ const payloads = probe.desktopPayloads();
446
+ assert.equal(payloads.some((payload) => payload.kind === "event"), false, "a read emits nothing");
447
+ const wire = JSON.stringify(payloads);
448
+ assert.equal(wire.includes(root) || wire.includes(JSON.stringify(root).slice(1, -1)), false, "no absolute path leaks into the wire");
449
+
450
+ const closed = await probe.close();
451
+ assert.equal(closed.status, 0, closed.stderr);
452
+ assert.equal(closed.stderr, "");
453
+ } finally {
454
+ probe.kill();
455
+ rmSync(root, { recursive: true, force: true });
456
+ }
457
+ });
458
+
413
459
  /**
414
460
  * Real production wiring for the subagents slice: the installed runtime loads
415
461
  * the actual agents owner (`extensions/gentle-agents.ts`, which owns the single
416
462
  * parent-session `TaskStore` plus the parent `AgentRunner`) alongside this
417
- * transport extension. `list_subagents` is a read, so the probe stays offline
418
- * and observes the truthful owner-loaded empty list — it never starts a child.
463
+ * transport extension. `list_subagents` and `get_subagent_thread` are reads, so
464
+ * the probe stays offline and observes the truthful owner-loaded empty list and
465
+ * a typed `not_found` thread — it never starts a child.
419
466
  */
420
467
  test("installed Pi serves the owner-loaded empty subagent list without starting a child", () => {
421
468
  const root = isolatedRoot("desktop-rpc-agents-");
422
469
  try {
423
470
  const input = [
424
471
  prompt("prompt-list", desktopRequest("agents-1", "list_subagents")),
472
+ prompt("prompt-thread", desktopRequest("agents-2", "get_subagent_thread", { id: "unknown-subagent" })),
425
473
  ].map((value) => JSON.stringify(value)).join("\n") + "\n";
426
474
  const child = spawnSync(process.execPath, probeArgs(root, [jobsOwnerExtension, desktopExtension]), {
427
475
  cwd: join(root, "workspace"),
@@ -444,6 +492,10 @@ test("installed Pi serves the owner-loaded empty subagent list without starting
444
492
  assert.equal(list.ok, true, JSON.stringify(list));
445
493
  assert.deepEqual(list.data, { agents: [] }, "no subagents exist, so the list is empty rather than fabricated");
446
494
 
495
+ const thread = byRequest("agents-2");
496
+ assert.equal(thread.ok, false, JSON.stringify(thread));
497
+ assert.equal(thread.error.code, "not_found", "the loaded owner answers an unknown thread id as not_found, not agents_unavailable");
498
+
447
499
  assert.equal(payloads.some((payload) => payload.kind === "event"), false, "an offline list emits nothing");
448
500
  assert.equal(JSON.stringify(payloads).includes("prompt"), false, "no prompt text leaks into the wire");
449
501
  assert.equal(JSON.stringify(payloads).includes("sessionPath"), false, "no session path leaks into the wire");
@@ -630,3 +682,226 @@ test("installed Pi applies a Desktop permission change through the real owner wi
630
682
  rmSync(root, { recursive: true, force: true });
631
683
  }
632
684
  });
685
+
686
+ /**
687
+ * Real production wiring for the sessions slice: the installed runtime lists
688
+ * sessions through Pi's own `SessionManager` with the probe's custom
689
+ * `--session-dir`, then switches by id through the command context's
690
+ * `switchSession`. The response arrives from the replacement session, whose
691
+ * router starts a fresh event sequence, and the switched-to conversation is
692
+ * the one Pi now serves. No provider is called.
693
+ */
694
+ test("installed Pi lists sessions and switches by id through the runtime's own session owner", async () => {
695
+ const root = isolatedRoot("desktop-rpc-sessions-");
696
+ const workspace = join(root, "workspace");
697
+ const seeded = Date.UTC(2026, 10, 1);
698
+ const header = { type: "session", version: 3, id: "probe-seeded", timestamp: new Date(seeded).toISOString(), cwd: workspace };
699
+ const message = {
700
+ type: "message",
701
+ id: "probe-m1",
702
+ parentId: null,
703
+ timestamp: new Date(seeded + 1000).toISOString(),
704
+ message: { role: "user", content: [{ type: "text", text: "seeded question" }], timestamp: seeded + 1000 },
705
+ };
706
+ writeFileSync(join(root, "sessions", "2026-11-01T00-00-00-000Z_probe-seeded.jsonl"), `${JSON.stringify(header)}\n${JSON.stringify(message)}\n`);
707
+ const probe = new LiveProbe(root, [desktopExtension]);
708
+ try {
709
+ const responseFor = (requestId: string) => probe.waitFor(
710
+ (record) => record.type === "extension_ui_request" && record.widgetKey === DESKTOP_RPC_WIDGET &&
711
+ JSON.parse(record.widgetLines[0]).kind === "response" &&
712
+ JSON.parse(record.widgetLines[0]).requestId === requestId,
713
+ `response ${requestId}`,
714
+ ).then((record) => JSON.parse(record.widgetLines[0]));
715
+
716
+ probe.send(prompt("prompt-list", desktopRequest("sessions-1", "list_sessions")));
717
+ const listed = await responseFor("sessions-1");
718
+ assert.equal(listed.ok, true, JSON.stringify(listed));
719
+ const seededEntry = listed.data.sessions.find((session: any) => session.id === "probe-seeded");
720
+ assert.deepEqual(seededEntry, {
721
+ id: "probe-seeded",
722
+ modified: seeded + 1000,
723
+ messageCount: 1,
724
+ firstMessage: "seeded question",
725
+ project: "workspace",
726
+ current: false,
727
+ });
728
+
729
+ probe.send(prompt("prompt-switch", desktopRequest("switch-1", "switch_session", { id: "probe-seeded" })));
730
+ const switched = await responseFor("switch-1");
731
+ assert.deepEqual(switched.data, { id: "probe-seeded", changed: true }, JSON.stringify(switched));
732
+
733
+ probe.send(prompt("prompt-snapshot", desktopRequest("snapshot-1", "get_snapshot")));
734
+ const snapshot = await responseFor("snapshot-1");
735
+ assert.equal(snapshot.data.sequence, 0, "the replacement session's router starts a fresh sequence");
736
+
737
+ probe.send(prompt("prompt-list-2", desktopRequest("sessions-2", "list_sessions")));
738
+ const after = await responseFor("sessions-2");
739
+ assert.equal(after.data.sessions.find((session: any) => session.id === "probe-seeded").current, true);
740
+
741
+ probe.send(prompt("prompt-same", desktopRequest("switch-2", "switch_session", { id: "probe-seeded" })));
742
+ assert.deepEqual((await responseFor("switch-2")).data, { id: "probe-seeded", changed: false });
743
+
744
+ probe.send({ id: "messages-1", type: "get_messages" });
745
+ const messages = await probe.waitFor((record) => record.id === "messages-1", "get_messages response");
746
+ assert.equal(messages.data.messages.length, 1, "Pi now serves the switched-to conversation");
747
+
748
+ const wire = JSON.stringify(probe.desktopPayloads());
749
+ assert.equal(wire.includes(".jsonl"), false, "no session file crosses the wire");
750
+ assert.equal(wire.includes(JSON.stringify(root).slice(1, -1)), false, "no absolute path crosses the wire");
751
+ assert.equal(probe.desktopPayloads().some((payload) => payload.kind === "event"), false, "listing and switching emit no event");
752
+
753
+ const closed = await probe.close();
754
+ assert.equal(closed.status, 0, closed.stderr);
755
+ assert.equal(closed.stderr, "");
756
+ } finally {
757
+ probe.kill();
758
+ rmSync(root, { recursive: true, force: true });
759
+ }
760
+ });
761
+
762
+ /**
763
+ * Regression for back-to-back requests while a switch is in flight: Pi's RPC
764
+ * loop dispatches prompts concurrently, so requests sent right after a
765
+ * `switch_session` reach the session that is being torn down. Every request
766
+ * must still get exactly one response, and the session the last list reports
767
+ * as current must agree with the switches that answered `changed: true`.
768
+ */
769
+ test("installed Pi answers every request exactly once while a switch is in flight", async () => {
770
+ const root = isolatedRoot("desktop-rpc-sessions-race-");
771
+ const workspace = join(root, "workspace");
772
+ const seeded = Date.UTC(2026, 10, 1);
773
+ for (const [id, offset] of [["sess-a", 0], ["sess-b", 5000]] as const) {
774
+ const at = seeded + offset;
775
+ const header = { type: "session", version: 3, id, timestamp: new Date(at).toISOString(), cwd: workspace };
776
+ const message = {
777
+ type: "message",
778
+ id: `${id}-m1`,
779
+ parentId: null,
780
+ timestamp: new Date(at + 1000).toISOString(),
781
+ message: { role: "user", content: [{ type: "text", text: `${id} question` }], timestamp: at + 1000 },
782
+ };
783
+ writeFileSync(join(root, "sessions", `${new Date(at).toISOString().replace(/[:.]/g, "-")}_${id}.jsonl`), `${JSON.stringify(header)}\n${JSON.stringify(message)}\n`);
784
+ }
785
+ const probe = new LiveProbe(root, [desktopExtension]);
786
+ try {
787
+ const responses = (requestId: string) => probe.desktopPayloads().filter((payload) => payload.kind === "response" && payload.requestId === requestId);
788
+ const responseFor = (requestId: string) => probe.waitFor(
789
+ (record) => record.type === "extension_ui_request" && record.widgetKey === DESKTOP_RPC_WIDGET &&
790
+ JSON.parse(record.widgetLines[0]).kind === "response" &&
791
+ JSON.parse(record.widgetLines[0]).requestId === requestId,
792
+ `response ${requestId}`,
793
+ ).then((record) => JSON.parse(record.widgetLines[0]));
794
+
795
+ probe.send(prompt("prompt-sw-1", desktopRequest("sw-1", "switch_session", { id: "sess-a" })));
796
+ assert.deepEqual((await responseFor("sw-1")).data, { id: "sess-a", changed: true });
797
+
798
+ probe.send(prompt("prompt-sw-2", desktopRequest("sw-2", "switch_session", { id: "sess-b" })));
799
+ probe.send(prompt("prompt-sw-3", desktopRequest("sw-3", "switch_session", { id: "sess-a" })));
800
+ probe.send(prompt("prompt-ls-4", desktopRequest("ls-4", "list_sessions")));
801
+ const sw2 = await responseFor("sw-2");
802
+ const sw3 = await responseFor("sw-3");
803
+ const ls4 = await responseFor("ls-4");
804
+ // Late duplicates would arrive after the replacement session settles.
805
+ await new Promise((resolveDelay) => setTimeout(resolveDelay, 1000));
806
+ for (const id of ["sw-1", "sw-2", "sw-3", "ls-4"]) assert.equal(responses(id).length, 1, `exactly one response for ${id}`);
807
+ assert.deepEqual(sw2.data, { id: "sess-b", changed: true }, JSON.stringify(sw2));
808
+ for (const answer of [sw3, ls4]) {
809
+ if (!answer.ok) assert.equal(answer.error.code, "session_switching", JSON.stringify(answer));
810
+ }
811
+
812
+ probe.send(prompt("prompt-ls-5", desktopRequest("ls-5", "list_sessions")));
813
+ const ls5 = await responseFor("ls-5");
814
+ const expected = sw3.ok && sw3.data.changed === true ? "sess-a" : "sess-b";
815
+ assert.deepEqual(
816
+ ls5.data.sessions.filter((session: any) => session.current).map((session: any) => session.id),
817
+ [expected],
818
+ "the current session matches the last switch that answered changed: true",
819
+ );
820
+
821
+ const closed = await probe.close();
822
+ assert.equal(closed.status, 0, closed.stderr);
823
+ } finally {
824
+ probe.kill();
825
+ rmSync(root, { recursive: true, force: true });
826
+ }
827
+ });
828
+
829
+ /** Two saved sessions in the probe's workspace: `sess-a`, and the newer `sess-b`. */
830
+ function seedSwitchSessions(root: string): void {
831
+ const workspace = join(root, "workspace");
832
+ const seeded = Date.UTC(2026, 10, 1);
833
+ for (const [id, offset] of [["sess-a", 0], ["sess-b", 5000]] as const) {
834
+ const at = seeded + offset;
835
+ const header = { type: "session", version: 3, id, timestamp: new Date(at).toISOString(), cwd: workspace };
836
+ const message = {
837
+ type: "message",
838
+ id: `${id}-m1`,
839
+ parentId: null,
840
+ timestamp: new Date(at + 1000).toISOString(),
841
+ message: { role: "user", content: [{ type: "text", text: `${id} question` }], timestamp: at + 1000 },
842
+ };
843
+ writeFileSync(join(root, "sessions", `${new Date(at).toISOString().replace(/[:.]/g, "-")}_${id}.jsonl`), `${JSON.stringify(header)}\n${JSON.stringify(message)}\n`);
844
+ }
845
+ }
846
+
847
+ /**
848
+ * Sends `burst` back to back on a fresh runtime, waits for one response per
849
+ * request plus a settle window for late duplicates, and returns each request's
850
+ * responses and the session the following `list_sessions` reports as current.
851
+ */
852
+ async function switchBurst(prefix: string, burst: Array<[string, string, Record<string, unknown>]>) {
853
+ const root = isolatedRoot(prefix);
854
+ seedSwitchSessions(root);
855
+ const probe = new LiveProbe(root, [desktopExtension]);
856
+ try {
857
+ const responses = (requestId: string) => probe.desktopPayloads().filter((payload) => payload.kind === "response" && payload.requestId === requestId);
858
+ const responseFor = (requestId: string) => probe.waitFor(
859
+ (record) => record.type === "extension_ui_request" && record.widgetKey === DESKTOP_RPC_WIDGET &&
860
+ JSON.parse(record.widgetLines[0]).kind === "response" &&
861
+ JSON.parse(record.widgetLines[0]).requestId === requestId,
862
+ `response ${requestId}`,
863
+ ).then((record) => JSON.parse(record.widgetLines[0]));
864
+ burst.forEach(([requestId, method, params]) => probe.send(prompt(`prompt-${requestId}`, desktopRequest(requestId, method, params))));
865
+ for (const [requestId] of burst) await responseFor(requestId);
866
+ await new Promise((resolveDelay) => setTimeout(resolveDelay, 1000));
867
+ const answers = new Map(burst.map(([requestId]) => [requestId, responses(requestId)]));
868
+ probe.send(prompt("prompt-final", desktopRequest("final", "list_sessions")));
869
+ const final = await responseFor("final");
870
+ const current = final.data.sessions.filter((session: any) => session.current).map((session: any) => session.id);
871
+ const closed = await probe.close();
872
+ assert.equal(closed.status, 0, closed.stderr);
873
+ return { answers, current };
874
+ } finally {
875
+ probe.kill();
876
+ rmSync(root, { recursive: true, force: true });
877
+ }
878
+ }
879
+
880
+ test("installed Pi refuses a second back-to-back switch to the same id and keeps the first", async () => {
881
+ const { answers, current } = await switchBurst("desktop-rpc-sessions-twice-", [
882
+ ["sw-x1", "switch_session", { id: "sess-b" }],
883
+ ["sw-x2", "switch_session", { id: "sess-b" }],
884
+ ]);
885
+ assert.equal(answers.get("sw-x1")!.length, 1, "exactly one response for sw-x1");
886
+ assert.equal(answers.get("sw-x2")!.length, 1, "exactly one response for sw-x2");
887
+ assert.deepEqual(answers.get("sw-x1")![0].data, { id: "sess-b", changed: true });
888
+ assert.equal(answers.get("sw-x2")![0].error.code, "session_switching");
889
+ assert.deepEqual(current, ["sess-b"]);
890
+ });
891
+
892
+ test("installed Pi refuses get_snapshot, capabilities, and list_jobs sent during a switch exactly once each", async () => {
893
+ const { answers, current } = await switchBurst("desktop-rpc-sessions-reads-", [
894
+ ["sw-y", "switch_session", { id: "sess-a" }],
895
+ ["snap", "get_snapshot", {}],
896
+ ["caps", "capabilities", {}],
897
+ ["jobs", "list_jobs", {}],
898
+ ]);
899
+ assert.equal(answers.get("sw-y")!.length, 1);
900
+ assert.deepEqual(answers.get("sw-y")![0].data, { id: "sess-a", changed: true });
901
+ for (const id of ["snap", "caps", "jobs"]) {
902
+ assert.equal(answers.get(id)!.length, 1, `exactly one response for ${id}`);
903
+ assert.equal(answers.get(id)![0].ok, false, id);
904
+ assert.equal(answers.get(id)![0].error.code, "session_switching", id);
905
+ }
906
+ assert.deepEqual(current, ["sess-a"]);
907
+ });
@@ -408,11 +408,19 @@ test("4.5.0 explicitly repeats 4.4.0 because capabilities/v2.6 still carries the
408
408
  assert.deepEqual(contract, NATIVE_CLI_CONTRACTS["4.4.0"] as Record<string, boolean>);
409
409
  });
410
410
 
411
+ test("4.6.0 keeps the 4.5.0 native CLI contract despite provider bundle 1.6.0", () => {
412
+ // The published v4.6.0 binary still advertises capabilities/v2.6 at
413
+ // protocol 2.6, and the upstream review-integration artifacts are unchanged.
414
+ const contract = NATIVE_CLI_CONTRACTS["4.6.0"] as Record<string, boolean>;
415
+ assert.ok(contract, "the pinned version must have an explicit capability row");
416
+ assert.deepEqual(contract, NATIVE_CLI_CONTRACTS["4.5.0"] as Record<string, boolean>);
417
+ });
418
+
411
419
  test("no shipped version key was added beyond the pin bump", () => {
412
420
  // Rows are promises to consumers, so a new key only ever appears in a
413
421
  // dedicated commit alongside a pin bump, never as a side effect. v2.2.4 and
414
422
  // v2.3.0 shipped upstream while Pi stayed on 2.2.3 and were never pinned,
415
423
  // so they get no row: a row asserts ground truth measured against a binary
416
424
  // Pi actually ran, and the table only has to be ascending, not gapless.
417
- assert.deepEqual(Object.keys(NATIVE_CLI_CONTRACTS), [...DARK_VERSIONS, "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.4.0", "2.5.0-rc.3", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.8.1", "2.8.2", "2.9.0", "2.9.1", "3.0.0", "3.0.1", "3.1.0", "3.2.1", "3.4.0", "3.5.0", "3.6.0", "3.6.1", "3.7.0", "4.0.0", "4.1.1", "4.2.0", "4.3.1", "4.4.0", "4.5.0"]);
425
+ assert.deepEqual(Object.keys(NATIVE_CLI_CONTRACTS), [...DARK_VERSIONS, "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.4.0", "2.5.0-rc.3", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.8.1", "2.8.2", "2.9.0", "2.9.1", "3.0.0", "3.0.1", "3.1.0", "3.2.1", "3.4.0", "3.5.0", "3.6.0", "3.6.1", "3.7.0", "4.0.0", "4.1.1", "4.2.0", "4.3.1", "4.4.0", "4.5.0", "4.6.0"]);
418
426
  });
@@ -30,9 +30,10 @@ test("clarification preserves understanding without reopening informed approval"
30
30
 
31
31
  test("resolved subdecisions retain the original authorized objective", () => {
32
32
  const prompt = __testing.buildGentlePrompt("gentleman");
33
- assert.ok(prompt.includes("Resolving an incident or subdecision does not complete or cancel the original authorized objective; resume safe, necessary in-scope steps automatically, using judgment for proportionate recovery and respecting explicit user dispositions. Investigate pending technical uncertainty rather than treating it alone as a new human decision."));
34
- assert.ok(prompt.includes("Stop for an unresolved consequential scope/product decision, required explicit consent, a denied action, or the human's explicit stop."));
35
- assert.ok(prompt.includes("Unavailable required proof blocks completion and delivery; it does not alone prohibit specifically authorized in-scope implementation where actual native authority and other limits permit it."));
33
+ assert.ok(prompt.includes("Resolving an incident or subdecision does not complete or cancel the original authorized objective; resume safe, necessary in-scope steps automatically, using judgment for proportionate recovery and respecting explicit user dispositions."));
34
+ assert.ok(!prompt.includes("Investigate pending technical uncertainty"), "the canonical real-human-decision boundary owns that clause");
35
+ assert.ok(prompt.includes("only a real human decision, the user's explicit stop, a denial, missing consent, or an exhausted limit stops the work it applies to, never independent authorized work"));
36
+ assert.ok(prompt.includes("Missing, partial, unavailable, or declined proof forbids claiming completion of the affected work, never an independently authorized next step"));
36
37
  // cost-speed-painpoints S15 P4: the verifier-setup rules load with the Verification rule, not on every turn.
37
38
  const verification = read("assets/orchestrator-verification.md");
38
39
  for (const sentence of [
@@ -80,21 +81,27 @@ test("T13: hedged delivery wording asks for resumable notes and separate commits
80
81
  assert.doesNotMatch(sentence, /\bask (?:one|a|the user)\b|question/i, "the hedge rule must not add a product or design question");
81
82
  });
82
83
 
83
- test("T13: the Close gate requires continuing or quoting the user's explicit stop", () => {
84
+ test("S3: the Close gate allows a pending tracked task only for a launched child, scoped denial/consent/exhaustion, or an open human decision", () => {
84
85
  const section = authorizationSection();
85
- assert.ok(
86
- section.includes(
87
- "Close gate: before the final answer, if any tracked task in the feature document or `todo` is still pending, continue it or quote the exact user sentence that orders the stop.",
88
- ),
89
- "tracking module must carry the Close gate",
90
- );
86
+ for (const clause of [
87
+ "continue every pending tracked task in the document or `todo` unless it waits on a launched child",
88
+ "an already-decided denial, missing consent, or exhausted limit applies to that affected work",
89
+ "the user stopped only that work",
90
+ "or a genuine human decision is open",
91
+ "Unrelated runnable authorized work continues",
92
+ ]) assert.ok(section.includes(clause), `tracking Close gate is missing: ${clause}`);
93
+ assert.ok(!section.includes("tracked or untracked work alike"), "the unscoped stop exception must go");
94
+ assert.ok(!section.includes("Needs your decision"), "tracking must not license a generic terminal phrase");
95
+ assert.ok(!section.includes("also a valid stop"), "tracking must not keep the old terminal stop license");
91
96
  });
92
97
 
93
98
  test("T13: budgets hold and the pinned human-control line is untouched", () => {
94
99
  const bytes = Buffer.byteLength(tracking, "utf8");
95
100
  // S14: close the open slice before a high-risk commit; outcomes per commit (12,600 -> 12,850 B), same as MODULE_BUDGETS.
96
101
  // P5b: contradictions and step 3 / Phase reporting restatements removed; 1.4.0 commit-boundary rules kept (12,850 -> 10,324 B).
97
- assert.ok(bytes <= 10_324, `orchestrator-tracking.md is ${bytes} B, over its 10,324 B budget`);
102
+ // harness-continuity S3: the canonical Close owns the authorized-work boundary; the local gate now names only a launched
103
+ // child, an explicit stop, or an open human decision, so the generic terminal license leaves the tracking module.
104
+ assert.ok(bytes <= 10_308, `orchestrator-tracking.md is ${bytes} B, over its 10,308 B budget`);
98
105
  assert.ok(core.includes("- Preserve human control: user decisions beat agent momentum."), "core human-control line must stay verbatim");
99
106
  assert.ok(core.includes("4. **Track**") && core.includes("`orchestrator-tracking.md`"), "Track must still load the tracking module");
100
107
  });
@@ -114,7 +121,10 @@ test("T13: the always-on harness narrows conditional intent and gates Close on p
114
121
  "harness must say hedged delivery wording is not a stop",
115
122
  );
116
123
  assert.ok(
117
- harness.includes("Never end with a tracked task pending unless you quote the user's explicit stop."),
118
- "harness Close step must gate pending tracked tasks",
124
+ harness.includes("A tracked task ends the turn pending only while it waits on already-launched work, for the affected work a denial, missing consent, the user's explicit stop, or an exhausted limit applies to, or for a genuine human decision still outstanding"),
125
+ "harness Close step must keep a legitimate pending child or scoped human decision",
119
126
  );
127
+ assert.ok(harness.includes("Hedged wording is not a stop."), "harness Close step must keep hedged wording out of stops");
128
+ assert.ok(!harness.includes("Never end with a tracked task pending unless you quote the user's explicit stop."), "the broad pending-task gate must go");
129
+ assert.ok(!harness.includes("Needs your decision"), "the harness must not license a generic terminal phrase");
120
130
  });
@@ -211,6 +211,16 @@ const ANCHORS: readonly RoutingAnchor[] = [
211
211
  { surface: DELEGATION, includes: "These triggers only choose between direct inline and delegated direct inside ODD" },
212
212
  ],
213
213
  },
214
+ {
215
+ // harness-continuity S3: authorized work continues; a pending child is a
216
+ // wait event, not a human decision. Pi's continuity scopes an explicit stop
217
+ // to the work it names without restating the boundary.
218
+ label: "authorized work continues across a pending child",
219
+ canonical: "a pending child is a wait event whose completion resumes the turn without asking the human",
220
+ mirrors: [
221
+ { surface: EXTENSION, includes: "An explicit user stop applies only to the work it names." },
222
+ ],
223
+ },
214
224
  {
215
225
  label: "handoffs pass the feature spec by reference (gentle-shell#1713)",
216
226
  canonical: "Hand off by reference, never by paraphrase: name the document, task, and specs",
@@ -45,7 +45,6 @@ test("research uses adaptive evidence gathering and existing general workers onl
45
45
  containsAll(delegation, [
46
46
  "problem, intended outcome, constraints, and current evidence",
47
47
  "no fixed questionnaire or mandatory rounds",
48
- "one focused user question",
49
48
  "stop and wait",
50
49
  "workers return gaps to the parent",
51
50
  "available authorized documentation/web tools",
@@ -58,6 +57,10 @@ test("research uses adaptive evidence gathering and existing general workers onl
58
57
  "do not create a specialized agent or create a new workflow",
59
58
  "no new persistence or readiness machinery",
60
59
  ]);
60
+ // harness-continuity S4: step 3 as rendered replaced the retired "one focused user question" route.
61
+ containsAll(wrapper, [
62
+ "Continue when no human decision remains; ask with the available compatible tool; text only for a genuinely open clarification or no usable compatible interface",
63
+ ]);
61
64
  });
62
65
 
63
66
  test("task sizing is explicitly advisory and forwarded without cosmetic savings", () => {
@@ -100,6 +103,13 @@ test("organic progress preserves both complete feature copies and reconciles act
100
103
  assert.doesNotMatch(memory, /`todo` tool is an optional session\/UI projection/);
101
104
  });
102
105
 
106
+ // harness-continuity S7 (T7b): one canonical-state statement, owned by the memory module.
107
+ test("S7: the feature document is canonical and the Engram mirror and `todo` are projections, stated once", () => {
108
+ const statement = "The feature document is canonical; the Engram mirror and `todo` are projections refreshed at task transitions.";
109
+ assert.equal(memory.split(statement).length - 1, 1, "the memory module states the canonical source once");
110
+ assert.ok(!delegation.includes(statement), "the delegation modules do not restate it");
111
+ });
112
+
103
113
  // gentle-shell#1494 field follow-up: tracking must not grow its own reconciliation
104
114
  // scripts, invented size gates, or repeated malformed writer launches.
105
115
  test("tracking sync recovers from partial writes without custom reconciliation gates", () => {
@@ -187,7 +197,10 @@ test("ODD commits work units in reviewable slices and reviews the commit or PR s
187
197
  "forecast authored changed lines (additions plus deletions, generated files excluded) from the task list",
188
198
  "keep a running count from work-unit commits",
189
199
  "`ask-on-risk` (default), `auto-chain`, `single-pr`, or `exception-ok`",
190
- "apply the chosen strategy before the next commit",
200
+ // harness-continuity S7 (T7): the oversized-delivery menu waits for a publish request.
201
+ "record the slice boundary in the feature document",
202
+ "apply the chosen strategy only when the user asks to publish (push or PR), never before a local work-unit commit",
203
+ "Local work-unit commits stay separate from publishing",
191
204
  "`ask-on-risk` asks once using the ordered oversized-delivery menu",
192
205
  "`auto-chain` asks only for a missing chain strategy and slices automatically",
193
206
  "Cache both choices, and record slice boundaries",
@@ -196,7 +209,10 @@ test("ODD commits work units in reviewable slices and reviews the commit or PR s
196
209
  "The delivery budget below reads the accumulated branch, not this per-task heuristic",
197
210
  ]);
198
211
  assert.ok(!wrapper.includes("Every tracked task closes with at least one work-unit commit"), "step 6 keeps the per-task commit rule");
212
+ assert.ok(!delegation.includes("before the next commit"), "S7: the delivery menu no longer gates a local commit");
199
213
  const docs = read("docs/readme-reference.md");
214
+ assert.ok(!docs.includes("before the next commit"), "S7: docs no longer gate a local commit on the delivery menu");
215
+ assert.ok(docs.includes("only when the user asks to publish (push or PR), never before a local work-unit commit"), "S7: docs say the menu waits for a publish request");
200
216
  containsAll(docs, [
201
217
  "Commit work units in reviewable slices of about 400 authored changed lines on the feature branch (branch first when on the default branch)",
202
218
  "a unit whose Risk line names a high-risk item gets its own commit so native review can take it alone",
@@ -486,7 +502,7 @@ test("ODD protocol is always-on in the rendered system prompt and runs by defaul
486
502
  "Tell the user in one line which feature document was created and how many tasks it holds",
487
503
  "6. **Implement task by task.**",
488
504
  "7. **Close.**",
489
- "call `gentle_odd_phase` only when the primary session's ODD phase actually changes",
505
+ "call it from the primary session only when its ODD phase actually changes",
490
506
  "Harness principles:",
491
507
  "# el Gentleman Orchestrator",
492
508
  ];
@@ -43,7 +43,9 @@ const FIXTURE_PATH = join(import.meta.dirname, "fixtures", "orchestrator.pre-die
43
43
  // intro carries the same pointer); measured 9,347 -> 9,197 B at the 128-char root: 9,350 -> 9,197 B.
44
44
  // cost-speed-painpoints S15 P5a: verdicts C7, C9, C12, X1, X3 and C8 (L41); measured 9,197 -> 9,189 B at the 128-char root.
45
45
  // cost-speed P14 (PD-81): the Evidence-budget lookup number matches the runtime notice; measured 9,189 -> 9,177 B.
46
- const BUDGET_BYTES = 9177;
46
+ // fix/temp-dir-exemption (user decision 2026-11-16): the confinement clause exempts the OS temp directory
47
+ // (read/write, deleting only what the session or its tools created); approved up to 9,352 B, measured 9,177 -> 9,347 B at the 128-char root.
48
+ const BUDGET_BYTES = 9347;
47
49
  const MIN_CONTROLLED_LONG_ASSETS_ROOT_CHARS = 93;
48
50
 
49
51
  const LAZY_ASSET_NAMES = [
@@ -61,7 +61,8 @@ test("rendered orchestrator core and selected declarations fit the byte budget",
61
61
  // cost-speed P14 (PD-81): the core's Evidence-budget lookup number matches the runtime; 16,683 -> 16,671 B.
62
62
  // #3188: orchestrator_session_id state also accepts a JSON string (same validation), +18 B structural anyOf
63
63
  // variant with no added description text; 16,671 -> 16,689 B.
64
- assert.ok(total <= 16689, `rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
64
+ // fix/temp-dir-exemption (user decision 2026-11-16): the confinement clause exempts the OS temp directory; approved up to 16,864 B, measured 16,689 -> 16,859 B.
65
+ assert.ok(total <= 16859, `rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
65
66
  });
66
67
 
67
68
  // Pi 1.4 does not export its pure system assembler from the package root.
@@ -159,7 +159,32 @@ test("S5 change 5: gentle_odd_phase does not restate the Phase reporting cadence
159
159
  assert.ok(prose.includes("Pass phase exactly as its schema enum"), "schema rule must stay");
160
160
  assert.ok(prose.includes("Never call this from a subagent or background/child task"), "child rule must stay: children do not receive Phase reporting");
161
161
  for (const mode of MODES) {
162
- assert.ok(render("gentleman", mode).includes("call `gentle_odd_phase` only when the primary session's ODD phase actually changes, never per tool call or on a fixed cadence, and never from a subagent"), `[${mode}] Phase reporting keeps the cadence`);
162
+ assert.ok(render("gentleman", mode).includes("call it from the primary session only when its ODD phase actually changes, never per tool call or on a fixed cadence"), `[${mode}] Phase reporting keeps the cadence`);
163
+ }
164
+ });
165
+
166
+ // --- harness-continuity S3: the authorized-work boundary is mode- and RDD-stable ---
167
+
168
+ const CANONICAL_CLOSE = [
169
+ "Authorized work continues: runnable in-scope steps run, a pending child is a wait event whose completion resumes the turn without asking the human",
170
+ "A tracked task ends the turn pending only while it waits on already-launched work, for the affected work a denial, missing consent, the user's explicit stop, or an exhausted limit applies to, or for a genuine human decision still outstanding",
171
+ "only a real human decision, the user's explicit stop, a denial, missing consent, or an exhausted limit stops the work it applies to, never independent authorized work",
172
+ "Missing, partial, unavailable, or declined proof forbids claiming completion of the affected work, never an independently authorized next step",
173
+ "while a required authorized check the existing budget still allows keeps running",
174
+ "Never turn a report into a blind self-reprompt loop.",
175
+ ] as const;
176
+
177
+ test("S3: organic and full delegation keep the authorized-work boundary under RDD on and off", () => {
178
+ const statuses = [
179
+ "Receipt-driven development: on (decided by global)",
180
+ "Receipt-driven development: off (decided by global)",
181
+ ];
182
+ for (const status of statuses) for (const mode of MODES) {
183
+ const prompt = __testing.buildGentlePrompt("gentleman", join(scratch, "project"), ACTIVE_TOOLS, status, undefined, mode).replaceAll(ASSETS, "/a");
184
+ for (const clause of CANONICAL_CLOSE) assert.ok(prompt.includes(clause), `[${status}/${mode}] canonical Close is missing: ${clause}`);
185
+ assert.ok(prompt.includes("An explicit user stop applies only to the work it names."), `[${status}/${mode}] explicit-stop coverage`);
186
+ assert.ok(!prompt.includes("Needs your decision"), `[${status}/${mode}] no generic terminal phrase`);
187
+ assert.ok(!prompt.includes("never more verification"), `[${status}/${mode}] no broad verification stop`);
163
188
  }
164
189
  });
165
190
 
@@ -173,12 +198,15 @@ test("S5 change 5: gentle_odd_phase does not restate the Phase reporting cadence
173
198
  // cost-speed P14: the duplicate gentleman Language line (-80 B, PD-57) and the core's evidence-budget number aligned
174
199
  // to the runtime (-12 B in both modes, PD-81); measured organic 24,164/24,416 B and full delegation 22,131/22,383 B.
175
200
  const PRIMARY_PROMPT_BUDGETS: Record<(typeof MODES)[number], Record<(typeof PERSONAS)[number], number>> = {
176
- organic: { gentleman: 24_164, neutral: 24_416 },
201
+ // fix/temp-dir-exemption (user decision 2026-11-16, approved up to +175 B): the confinement clause exempts the OS temp
202
+ // directory in every mode and persona; measured organic 24,164/24,416 -> 24,251/24,503 B and full delegation
203
+ // 22,128/22,380 -> 22,210/22,462 B.
204
+ organic: { gentleman: 24_251, neutral: 24_503 },
177
205
  // cost-speed P6 (X9): launch form, continue-one-worker rule and the tracking pointer, paid by the motivation
178
206
  // sentence and a duplicate of step 6's verbatim-request rule (22,253/22,425 -> 22,223/22,395 B).
179
207
  // cost-speed P6b: the launch sentence names the same assistant message, the `codemode` route and the sequential
180
208
  // tools (+126 B), paid by tightening five sentences of the same asset (22,131/22,383 -> 22,128/22,380 B).
181
- "full-delegation": { gentleman: 22_128, neutral: 22_380 },
209
+ "full-delegation": { gentleman: 22_210, neutral: 22_462 },
182
210
  };
183
211
 
184
212
  test("S5: the rendered primary prompt fits the lowered per-mode budgets", (t) => {
@@ -431,20 +431,20 @@ test("package manifest installs pi-pretty through a wrapper without bundling nat
431
431
  );
432
432
  });
433
433
 
434
- test("package verification binds the published Gentle AI v4.5.0 runtime pin", () => {
434
+ test("package verification binds the published Gentle AI v4.6.0 runtime pin", () => {
435
435
  const installer = readFileSync(join(PACKAGE_ROOT, "scripts", "gentle-ai-installer.mjs"), "utf8");
436
436
  const binary = readFileSync(join(PACKAGE_ROOT, "lib", "gentle-ai-binary.ts"), "utf8");
437
437
  const verifier = readFileSync(join(PACKAGE_ROOT, "scripts", "verify-package-files.mjs"), "utf8");
438
438
 
439
- assert.match(installer, /INSTALLER_VERSION = "4\.5\.0"/);
439
+ assert.match(installer, /INSTALLER_VERSION = "4\.6\.0"/);
440
440
  assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_PACKAGE.*GENTLE_AI_WINDOWS_SOURCE_MODULE/);
441
- assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:81Hsy\+cboAbUse1ORVJuwji6V9sRIGlFwC73EtMdw0c="/);
441
+ assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:FXR0FEGvnov6eCf\/FR7Ey8PfxxdhbDHq1\/WnkjpA1AQ="/);
442
442
  assert.match(installer, /GOTOOLCHAIN: "local"/);
443
443
  assert.match(installer, /GOSUMDB: "sum\.golang\.org"/);
444
444
  assert.match(binary, /GENTLE_AI_VERSION = INSTALLER_VERSION/);
445
445
  assert.match(binary, /GO_SUMDB_SOURCE_BUILD/);
446
446
  assert.match(binary, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM/);
447
- assert.match(verifier, /v4\.5\.0/);
447
+ assert.match(verifier, /v\$\{INSTALLER_VERSION\} runtime pin/);
448
448
  });
449
449
 
450
450
 
@@ -1645,10 +1645,10 @@ test("gentle-ai-worker packages the exact scoped writer contract", () => {
1645
1645
  const contextContract = readMarkdownSection(source, "Context contract");
1646
1646
  assert.match(contextContract, /pre-existing untracked targets explicitly listed by the parent/);
1647
1647
  assert.match(contextContract, /new files required by the delegated task/);
1648
- assert.match(contextContract, /derived candidate set the human can approve or narrow/);
1649
- assert.match(contextContract, /never an open request for the human to author paths or globs/);
1650
- assert.match(interactionContract, /closed set the human can approve, decline, or select from/);
1651
- assert.match(interactionContract, /never ask the human to author paths, globs, identifiers, or commands as free text/);
1648
+ assert.match(contextContract, /derived candidate set the parent can approve, narrow, or route to the human/);
1649
+ assert.match(contextContract, /never an open request for anyone to author paths or globs/);
1650
+ assert.match(interactionContract, /closed set the decision owner can approve, decline, or select from/);
1651
+ assert.match(interactionContract, /never ask anyone to author paths, globs, identifiers, or commands as free text/);
1652
1652
 
1653
1653
  const implementationRules = readMarkdownSection(source, "Implementation rules");
1654
1654
  assert.match(implementationRules, /`blocked` only for a non-human technical blocker/);
@@ -1949,9 +1949,9 @@ test("pi-pretty wrapper uses cached ESM loading for compiled and pnpm symlink in
1949
1949
  assert.match(wrapper, /quietToolsEnabled/);
1950
1950
  });
1951
1951
 
1952
- test("Gentle Shell v4.8.0 package manifest declares the release version", () => {
1952
+ test("Gentle Shell v4.9.0 package manifest declares the release version", () => {
1953
1953
  const packageJson = readPackageJson();
1954
- assert.equal(packageJson.version, "4.8.0", "the release manifest must be explicitly pinned to v4.8.0");
1954
+ assert.equal(packageJson.version, "4.9.0", "the release manifest must be explicitly pinned to v4.9.0");
1955
1955
  assert.equal(packageJson.scripts?.test, "node scripts/run-test-suite.mjs");
1956
1956
  assert.ok(packageJson.files?.includes("assets/"));
1957
1957
  assert.ok(packageJson.files?.includes("contracts/"));