gentle-pi 4.9.0 → 5.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 (443) hide show
  1. package/README.md +2 -2
  2. package/assets/agents/gentle-ai-explore.md +3 -6
  3. package/assets/agents/gentle-ai-verify.md +2 -2
  4. package/assets/agents/gentle-ai-worker.md +9 -9
  5. package/assets/agents/jd-fix-agent.md +2 -2
  6. package/assets/agents/jd-judge-a.md +0 -1
  7. package/assets/agents/jd-judge-b.md +0 -1
  8. package/assets/migrations/agent-body-history.json +9 -0
  9. package/assets/orchestrator-delegation.md +1 -1
  10. package/assets/orchestrator-full-delegation.md +1 -1
  11. package/assets/orchestrator-maintenance.md +11 -0
  12. package/assets/orchestrator-quota-recovery.md +1 -1
  13. package/assets/orchestrator-skills.md +10 -0
  14. package/assets/orchestrator-tracking.md +2 -2
  15. package/assets/orchestrator-verification.md +10 -8
  16. package/assets/orchestrator.md +2 -2
  17. package/bin/gentle-shell.mjs +69 -17
  18. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +11 -10
  19. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/manifest.json +5 -5
  20. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/orchestration/pi.md +5 -3
  21. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/routing/pi.md +2 -2
  22. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/lens.schema.json +3 -3
  23. package/contracts/review-provider-contract-mirror/v1.7.0/bundle/vectors/lens.json +1 -0
  24. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-capabilities.baseline.json +3 -3
  25. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-roles.baseline.json +3 -3
  26. package/docs/bundled-install.md +2 -2
  27. package/docs/delegated-verification.md +10 -6
  28. package/docs/desktop-feed.md +15 -6
  29. package/docs/desktop-rpc.md +298 -30
  30. package/docs/gentle-shell-desktop.md +10 -3
  31. package/docs/gentle-shell.md +25 -19
  32. package/docs/install-wizard.md +7 -5
  33. package/docs/native-authority-architecture.md +3 -3
  34. package/docs/odd-preparation-continuity.md +2 -2
  35. package/docs/permission-modes.md +10 -2
  36. package/docs/readme-reference.md +53 -24
  37. package/docs/review-coordinator.md +4 -2
  38. package/docs/session-profile-format.md +33 -7
  39. package/docs/sound-notifications.md +1 -1
  40. package/docs/work-continuity.md +7 -7
  41. package/docs/yolo-mode.md +1 -1
  42. package/extensions/ask-user-choice.ts +2 -2
  43. package/extensions/ask-user-question.ts +1 -1
  44. package/extensions/child-context.ts +2 -11
  45. package/extensions/gentle-agents.ts +86 -30
  46. package/extensions/gentle-ai.ts +918 -632
  47. package/extensions/gentle-desktop-feed.ts +13 -3
  48. package/extensions/gentle-desktop-rpc.ts +51 -2
  49. package/extensions/gentle-fast.ts +9 -2
  50. package/extensions/gentle-music.ts +2 -0
  51. package/extensions/gentle-notifications.ts +12 -4
  52. package/extensions/gentle-shell.ts +157 -62
  53. package/extensions/gentle-star-prompt.ts +3 -0
  54. package/extensions/gentle-tps.ts +7 -0
  55. package/extensions/history/index.ts +1 -1
  56. package/extensions/quiet-tools.ts +13 -22
  57. package/extensions/skill-registry.ts +9 -1
  58. package/extensions/startup-banner.ts +8 -13
  59. package/herdr/mods/gentle-agents/snapshot.js +30 -23
  60. package/herdr/mods/gentle-chat/feed.js +6 -0
  61. package/herdr/mods/gentle-chat/main.js +76 -16
  62. package/herdr/mods/gentle-chat/session.js +13 -5
  63. package/herdr/mods/gentle-chat/snapshot.js +30 -23
  64. package/herdr/mods/gentle-chat/ui.js +7 -1
  65. package/herdr/mods/gentle-inspector/main.js +2 -0
  66. package/herdr/mods/gentle-inspector/snapshot.js +30 -23
  67. package/herdr/mods/gentle-palette/main.js +1 -1
  68. package/herdr/mods/gentle-palette/snapshot.js +30 -23
  69. package/herdr/mods/gentle-pane/snapshot.js +30 -23
  70. package/herdr/mods/gentle-sidebar/snapshot.js +30 -23
  71. package/herdr/mods/gentle-spaces/snapshot.js +30 -23
  72. package/herdr/mods/gentle-status/snapshot.js +30 -23
  73. package/herdr/mods/gentle-tabs/main.js +3 -2
  74. package/herdr/mods/gentle-tabs/new-tab.js +9 -0
  75. package/herdr/mods/gentle-tabs/snapshot.js +30 -23
  76. package/herdr/mods/gentle-tokens/snapshot.js +30 -23
  77. package/lib/agent-profiles.ts +50 -10
  78. package/lib/agents-config.ts +69 -5
  79. package/lib/agents-runner.ts +34 -1
  80. package/lib/auto-permission-runtime.ts +2 -1
  81. package/lib/background-jobs-tools.ts +24 -16
  82. package/lib/banner-config.ts +69 -0
  83. package/lib/child-session.ts +6 -0
  84. package/lib/claude-bridge-config.ts +41 -0
  85. package/lib/codex-turn-continuation.ts +40 -0
  86. package/lib/compaction-threshold.ts +46 -0
  87. package/lib/context-threshold.ts +5 -5
  88. package/lib/desktop-agent-definitions-service.ts +93 -0
  89. package/lib/desktop-auth-service.ts +102 -0
  90. package/lib/desktop-background-subagents-service.ts +155 -0
  91. package/lib/desktop-command-rpc.ts +71 -0
  92. package/lib/desktop-feed-sources.ts +44 -1
  93. package/lib/desktop-feed.ts +41 -29
  94. package/lib/desktop-rpc-agent-definitions.ts +119 -0
  95. package/lib/desktop-rpc-agents.ts +44 -3
  96. package/lib/desktop-rpc-auth.ts +103 -0
  97. package/lib/desktop-rpc-background-subagents.ts +126 -0
  98. package/lib/desktop-rpc-changes.ts +13 -4
  99. package/lib/desktop-rpc-config.ts +287 -13
  100. package/lib/desktop-rpc-profile-binding.ts +212 -0
  101. package/lib/desktop-rpc-profiles.ts +2 -0
  102. package/lib/desktop-rpc-stats.ts +16 -4
  103. package/lib/desktop-rpc-status.ts +103 -0
  104. package/lib/desktop-status-service.ts +86 -0
  105. package/lib/destructive-command-guard.ts +9 -185
  106. package/lib/exploration-budget.ts +3 -7
  107. package/lib/gentle-design.ts +23 -4
  108. package/lib/gentle-shell-desktop.ts +85 -0
  109. package/lib/gentle-shell-launcher.ts +120 -8
  110. package/lib/mcp-config.ts +214 -0
  111. package/lib/native-choice-list.ts +1 -1
  112. package/lib/native-fullscreen-interaction.ts +3 -0
  113. package/lib/native-pointer-region.ts +1 -1
  114. package/lib/native-review-cli.ts +213 -397
  115. package/lib/odd-phase-inference.ts +1 -1
  116. package/lib/orchestrator-mode-policy.ts +25 -12
  117. package/lib/path-consent-fence.ts +113 -0
  118. package/lib/persona-config.ts +77 -0
  119. package/lib/pi-settings.ts +157 -0
  120. package/lib/questionnaire/questionnaire-view.ts +1 -1
  121. package/lib/review-continuation-registry.ts +9 -26
  122. package/lib/review-coordinator.ts +13 -2
  123. package/lib/review-host-relay.ts +2 -35
  124. package/lib/review-integration-v2.ts +129 -180
  125. package/lib/review-object-store.ts +0 -57
  126. package/lib/review-repository.ts +0 -44
  127. package/lib/review-risk-assessment.ts +11 -36
  128. package/lib/review-start-context.ts +2 -1
  129. package/lib/review-transaction.ts +6 -6
  130. package/lib/sensitive-paths.ts +45 -0
  131. package/lib/session-profile-binding.ts +29 -0
  132. package/lib/session-profile-freeze.ts +11 -4
  133. package/lib/session-worktree-registry.ts +11 -5
  134. package/lib/shell-bar.ts +41 -18
  135. package/lib/shell-card.ts +27 -1
  136. package/lib/shell-changes-view.ts +6 -2
  137. package/lib/shell-changes.ts +94 -37
  138. package/lib/shell-git-worker.ts +158 -0
  139. package/lib/shell-idle-changes.ts +88 -0
  140. package/lib/shell-untracked-cache.ts +142 -0
  141. package/lib/shell-untracked-lines.ts +178 -0
  142. package/lib/stats-collector.ts +24 -0
  143. package/lib/tower-open.ts +8 -1
  144. package/lib/tps-policy.ts +85 -0
  145. package/lib/vim-editor-adapter.ts +9 -2
  146. package/lib/voice-artifacts.ts +8 -1
  147. package/lib/voice-install.ts +7 -3
  148. package/lib/yolo-session-policy.ts +2 -2
  149. package/package.json +1 -1
  150. package/runtime/gentle-shell-desktop.mjs +85 -0
  151. package/runtime/gentle-shell-launcher.mjs +120 -8
  152. package/runtime/native-review-cli.mjs +206 -390
  153. package/runtime/review-integration-v2.mjs +129 -180
  154. package/runtime/review-risk-assessment.mjs +11 -36
  155. package/runtime/sensitive-paths.mjs +46 -0
  156. package/runtime/tower-open.mjs +8 -1
  157. package/scripts/build-runtime-modules.mjs +2 -0
  158. package/scripts/gentle-ai-installer.mjs +13 -14
  159. package/scripts/installer-preflight.mjs +1 -1
  160. package/scripts/main-channel.mjs +47 -11
  161. package/scripts/pi-update.mjs +10 -4
  162. package/scripts/prepare-verifier.mjs +14 -4
  163. package/scripts/verify-package-files.mjs +45 -13
  164. package/skills/judgment-day/SKILL.md +1 -1
  165. package/skills/judgment-day/references/prompts-and-formats.md +1 -1
  166. package/skills/provider-defect-report/SKILL.md +1 -1
  167. package/skills/rdd-defect-workflow/SKILL.md +2 -2
  168. package/skills/skill-creator/SKILL.md +4 -4
  169. package/skills/skill-improver/SKILL.md +4 -4
  170. package/skills/skill-registry/SKILL.md +2 -2
  171. package/tests/agent-profiles-workflow.test.ts +102 -0
  172. package/tests/agent-risk-escalation.test.ts +15 -0
  173. package/tests/agents-config.test.ts +22 -2
  174. package/tests/agents-protocol.test.ts +1 -1
  175. package/tests/agents-runner.test.ts +94 -2
  176. package/tests/append-system-prompt-route.test.ts +16 -11
  177. package/tests/ask-user-choice.test.ts +19 -0
  178. package/tests/ask-user-question.test.ts +23 -4
  179. package/tests/auto-permission-runtime.test.ts +4 -4
  180. package/tests/bounded-stop-contract.test.ts +50 -62
  181. package/tests/built-web-guard.test.ts +32 -0
  182. package/tests/child-context-files.test.ts +6 -6
  183. package/tests/child-ui-extensions.test.ts +125 -0
  184. package/tests/child-web-package.test.ts +1 -1
  185. package/tests/codex-turn-continuation.test.ts +183 -0
  186. package/tests/committed-range-untracked-exclusion.test.ts +18 -0
  187. package/tests/controlled-engineering-editor.test.ts +192 -0
  188. package/tests/controlled-engineering-launch.test.ts +136 -0
  189. package/tests/controlled-engineering.test.ts +244 -0
  190. package/tests/delegate-for-reason-contract.test.ts +1 -1
  191. package/tests/delivery-b-rendered-surfaces.test.ts +1 -1
  192. package/tests/delivery-conflict-markers.test.ts +2 -3
  193. package/tests/desktop-feed-tool-summaries.test.ts +1 -1
  194. package/tests/desktop-feed-transcript.test.ts +17 -0
  195. package/tests/desktop-feed.test.ts +141 -7
  196. package/tests/desktop-liveness.test.ts +125 -0
  197. package/tests/desktop-persona.test.ts +17 -0
  198. package/tests/desktop-rpc-agent-definitions.test.ts +219 -0
  199. package/tests/desktop-rpc-agents.test.ts +113 -3
  200. package/tests/desktop-rpc-auth.test.ts +278 -0
  201. package/tests/desktop-rpc-background-subagents.test.ts +186 -0
  202. package/tests/desktop-rpc-changes.test.ts +81 -4
  203. package/tests/desktop-rpc-config-mcp-fidelity.test.ts +106 -0
  204. package/tests/desktop-rpc-config-readonly-stores.test.ts +458 -0
  205. package/tests/desktop-rpc-config-settings.test.ts +234 -0
  206. package/tests/desktop-rpc-config.test.ts +17 -3
  207. package/tests/desktop-rpc-design.test.ts +30 -1
  208. package/tests/desktop-rpc-jobs.test.ts +9 -1
  209. package/tests/desktop-rpc-permissions.test.ts +9 -1
  210. package/tests/desktop-rpc-profile-binding.test.ts +195 -0
  211. package/tests/desktop-rpc-review.test.ts +1 -1
  212. package/tests/desktop-rpc-session-snapshot-commands.test.ts +50 -0
  213. package/tests/desktop-rpc-session.test.ts +2 -2
  214. package/tests/desktop-rpc-stats.test.ts +42 -11
  215. package/tests/desktop-rpc-status.test.ts +195 -0
  216. package/tests/desktop-rpc-updates.test.ts +1 -1
  217. package/tests/desktop-rpc-usage.test.ts +9 -1
  218. package/tests/desktop-rpc.test.ts +2 -2
  219. package/tests/desktop-session-switch.test.ts +237 -0
  220. package/tests/desktop-target-session.test.ts +104 -0
  221. package/tests/destructive-command-guard.test.ts +187 -0
  222. package/tests/devbinary/pi-host-relay.devtest.ts +73 -9
  223. package/tests/exploration-budget.test.ts +2 -26
  224. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +15 -11
  225. package/tests/full-delegation-closure.test.ts +19 -9
  226. package/tests/generic-agent-tools.test.ts +3 -3
  227. package/tests/gentle-agents.test.ts +215 -10
  228. package/tests/gentle-ai-binary.test.ts +3 -3
  229. package/tests/gentle-ai-exploration-budget.test.ts +3 -2
  230. package/tests/gentle-ai-installer.test.ts +60 -59
  231. package/tests/gentle-ai.test.ts +30 -59
  232. package/tests/gentle-chat-read-failure.test.ts +74 -0
  233. package/tests/gentle-chat-session-read.test.ts +127 -0
  234. package/tests/gentle-design.test.ts +39 -0
  235. package/tests/gentle-notifications.test.ts +43 -5
  236. package/tests/gentle-shell-desktop.test.ts +108 -0
  237. package/tests/gentle-shell-launcher-auto-provision.test.ts +152 -0
  238. package/tests/gentle-shell-launcher-machine-output.test.ts +356 -0
  239. package/tests/gentle-shell-launcher-tower.test.ts +7 -1
  240. package/tests/gentle-shell.test.ts +163 -15
  241. package/tests/gentle-tps.test.ts +57 -0
  242. package/tests/independent-recovery-delivery.test.ts +15 -13
  243. package/tests/installer-preflight.test.ts +3 -2
  244. package/tests/installer-server.test.ts +3 -2
  245. package/tests/installer-windows-bootstrap.test.ts +6 -0
  246. package/tests/job-turn-end-texts.test.ts +57 -0
  247. package/tests/judgment-day-dispatch-diagnostics.test.ts +87 -0
  248. package/tests/lazy-module-contradictions-contract.test.ts +2 -3
  249. package/tests/main-channel-upgrade.test.ts +14 -7
  250. package/tests/main-channel.test.ts +78 -23
  251. package/tests/maintainer/desktop-rpc.maintest.ts +4 -4
  252. package/tests/native-fullscreen-interaction.test.ts +37 -1
  253. package/tests/native-review-capability-contract.test.ts +13 -1
  254. package/tests/native-review-cli-nonblocking-findings.test.ts +9 -84
  255. package/tests/native-review-cli.test.ts +199 -21
  256. package/tests/native-review-consent.test.ts +20 -3
  257. package/tests/native-review-start-escalation-real-binary.test.ts +42 -0
  258. package/tests/no-self-pause-contract.test.ts +8 -7
  259. package/tests/odd-phase-inference.test.ts +2 -2
  260. package/tests/odd-routing-canonical-ratchet.test.ts +1 -1
  261. package/tests/odd-routing-contract.test.ts +2 -2
  262. package/tests/orchestrator-budget.test.ts +7 -2
  263. package/tests/orchestrator-prompt-diet-contract.test.ts +5 -5
  264. package/tests/orchestrator-skills-inline-contract.test.ts +26 -0
  265. package/tests/package-manifest.test.ts +11 -16
  266. package/tests/packaged-agent-codemode.test.ts +79 -0
  267. package/tests/path-consent-fence.test.ts +326 -0
  268. package/tests/persona-config.test.ts +42 -0
  269. package/tests/pi-update-launcher.test.ts +1 -1
  270. package/tests/pi-update-source.test.ts +48 -2
  271. package/tests/primary-session-prompt.test.ts +9 -7
  272. package/tests/profile-fast-tier.test.ts +79 -4
  273. package/tests/progress-rule-contract.test.ts +54 -0
  274. package/tests/rdd-delivery-warning.test.ts +109 -0
  275. package/tests/review-actor-tool-deny.test.ts +1 -2
  276. package/tests/review-agent-end-preflight.test.ts +3 -1
  277. package/tests/review-assess-escalation-forwarding.test.ts +99 -0
  278. package/tests/review-authority-recovery-docs.test.ts +9 -12
  279. package/tests/review-continuation-registry.test.ts +24 -25
  280. package/tests/review-controller-native-recovery.test.ts +165 -178
  281. package/tests/review-controller-native-routing.test.ts +352 -27
  282. package/tests/review-coordinator-correction-gate.test.ts +5 -9
  283. package/tests/review-coordinator-runtime.test.ts +3 -2
  284. package/tests/review-coordinator.test.ts +14 -0
  285. package/tests/review-due-compaction.test.ts +1 -1
  286. package/tests/review-failure-facts.test.ts +2 -2
  287. package/tests/review-host-relay-restart-parity.test.ts +2 -52
  288. package/tests/review-host-relay-routing.test.ts +59 -298
  289. package/tests/review-host-relay.test.ts +0 -46
  290. package/tests/review-integration-nonblocking-findings.test.ts +3 -6
  291. package/tests/review-integration-v2-forward.test.ts +114 -234
  292. package/tests/review-integration-v2.test.ts +85 -39
  293. package/tests/review-json-arguments.test.ts +30 -9
  294. package/tests/review-legacy-check.test.ts +38 -0
  295. package/tests/review-object-store.test.ts +2 -57
  296. package/tests/review-one-call-findings.test.ts +1 -0
  297. package/tests/review-one-call.test.ts +56 -0
  298. package/tests/review-risk-assessment.test.ts +14 -43
  299. package/tests/review-run-escalate-forwarding.test.ts +59 -0
  300. package/tests/review-sidebar-state.test.ts +2 -1
  301. package/tests/review-untracked-inventory-replay.test.ts +181 -0
  302. package/tests/runtime-harness.mjs +30 -4
  303. package/tests/sensitive-path-tools.test.ts +210 -5
  304. package/tests/session-profile-binding-observers.test.ts +47 -0
  305. package/tests/session-profile-extension.test.ts +109 -11
  306. package/tests/session-profile-freeze.test.ts +49 -2
  307. package/tests/session-profile-v1-compat.test.ts +11 -3
  308. package/tests/session-worktree-registry.test.ts +23 -0
  309. package/tests/shell-bar.test.ts +21 -3
  310. package/tests/shell-changes-idle-start.test.ts +510 -0
  311. package/tests/shell-changes-untracked-bound.test.ts +230 -0
  312. package/tests/shell-changes-view.test.ts +8 -2
  313. package/tests/shell-changes.test.ts +134 -0
  314. package/tests/shell-git-runner-stall.test.ts +74 -0
  315. package/tests/shell-git-worker-fallback.test.ts +140 -0
  316. package/tests/shell-git-worker-lifetime.test.ts +91 -0
  317. package/tests/shell-render-cache-runtime.test.ts +256 -3
  318. package/tests/shell-sidebar-layout.test.ts +1 -1
  319. package/tests/shell-sidebar-scroll-benchmark.test.ts +14 -5
  320. package/tests/shell-untracked-cache.test.ts +213 -0
  321. package/tests/short-check-routing-contract.test.ts +11 -7
  322. package/tests/skill-references.test.ts +39 -0
  323. package/tests/skill-registry.test.ts +4 -4
  324. package/tests/startup-banner.test.ts +2 -1
  325. package/tests/status-timing-diagnostics.test.ts +2 -1
  326. package/tests/support/capabilities-v26.ts +22 -0
  327. package/tests/support/chat-ui.ts +39 -0
  328. package/tests/support/review-coordinator-runtime.ts +11 -2
  329. package/tests/support/status-v9.ts +8 -0
  330. package/tests/t7-recovery-preservation.test.ts +68 -0
  331. package/tests/tower-open.test.ts +24 -0
  332. package/tests/tower-pack.test.ts +48 -0
  333. package/tests/tps-policy.test.ts +96 -0
  334. package/tests/turn-end-rule-contract.test.ts +155 -0
  335. package/tests/turn-end-scope.test.ts +39 -0
  336. package/tests/verification-proportionality.test.ts +1 -1
  337. package/tests/verification-scoped-stop-contract.test.ts +1 -1
  338. package/tests/verification-tiers-contract.test.ts +4 -3
  339. package/tests/verifier-admission.test.ts +1 -1
  340. package/tests/verifier-preparation.test.ts +94 -1
  341. package/tests/verifier-settle-reminder.test.ts +1 -1
  342. package/tests/verify-first-launch-contract.test.ts +19 -7
  343. package/tests/vim-editor-adapter.test.ts +12 -2
  344. package/tests/voice-install.test.ts +97 -11
  345. package/tests/windows-hidden-processes.test.ts +11 -44
  346. package/tests/work-continuity-contract.test.ts +48 -55
  347. package/tests/yolo-session-policy.test.ts +2 -0
  348. package/web/tower/dist/assets/BatchableSprite-BJ_TQxjN.js +217 -0
  349. package/web/tower/dist/assets/BufferResource-DeJpHuO6.js +139 -0
  350. package/web/tower/dist/assets/CanvasPool-cwc03T_x.js +23 -0
  351. package/web/tower/dist/assets/CanvasRenderer-DO84oP5R.js +1 -0
  352. package/web/tower/dist/assets/Filter-BKhT9lO8.js +1 -0
  353. package/web/tower/dist/assets/GlUniformGroupSystem-DluI7cqd.js +130 -0
  354. package/web/tower/dist/assets/GpuUboSystem-CM4Dys0F.js +17 -0
  355. package/web/tower/dist/assets/Graphics-3OyUtCzC.js +1 -0
  356. package/web/tower/dist/assets/RenderTargetSystem-X-9GAQ1C.js +184 -0
  357. package/web/tower/dist/assets/WebGLRenderer-I0fqIX1w.js +20 -0
  358. package/web/tower/dist/assets/WebGPURenderer-BRWSXotK.js +79 -0
  359. package/web/tower/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
  360. package/web/tower/dist/assets/abnfDiagram-VCTEODGH-C4iBBhTL.js +1 -0
  361. package/web/tower/dist/assets/architectureDiagram-5GKGNRK7-Ih-qvfTu.js +36 -0
  362. package/web/tower/dist/assets/blockDiagram-I7D4REHJ-I9z_u3wb.js +129 -0
  363. package/web/tower/dist/assets/browserAll-gmBFNIA4.js +14 -0
  364. package/web/tower/dist/assets/c4Diagram-7LVT6UL2-DOyk2rEJ.js +38 -0
  365. package/web/tower/dist/assets/canvasUtils-DTaMcbkN.js +1 -0
  366. package/web/tower/dist/assets/channel-wuxBkGGz.js +1 -0
  367. package/web/tower/dist/assets/chunk-2Q5K7J3B-BaJ-OrJ_.js +1 -0
  368. package/web/tower/dist/assets/chunk-5VM5RSS4-wICrhvyw.js +15 -0
  369. package/web/tower/dist/assets/chunk-F27PBJKO-DUQ_JqvZ.js +1 -0
  370. package/web/tower/dist/assets/chunk-IMKFNOWR-DKfgQrGM.js +231 -0
  371. package/web/tower/dist/assets/chunk-JWPE2WC7-1k1LW87d.js +1 -0
  372. package/web/tower/dist/assets/chunk-POPQ4Y6H-Df8cN2w9.js +1 -0
  373. package/web/tower/dist/assets/chunk-SVP7TREG-CxU5LDj8.js +88 -0
  374. package/web/tower/dist/assets/chunk-TICWLB2K-CEuHEBi0.js +206 -0
  375. package/web/tower/dist/assets/chunk-XXDRQBXY-CbSAjj9l.js +1 -0
  376. package/web/tower/dist/assets/classDiagram-ZZMXUADV-DbRmVQRX.js +1 -0
  377. package/web/tower/dist/assets/classDiagram-v2-VYDZK3BY-DbRmVQRX.js +1 -0
  378. package/web/tower/dist/assets/cose-bilkent-JH36ORCC-8xZLSHER.js +1 -0
  379. package/web/tower/dist/assets/cynefin-OW5HDTMX-Cw4XG9Zj.js +166 -0
  380. package/web/tower/dist/assets/cynefinDiagram-5FMLGOSQ-CcQdokUv.js +62 -0
  381. package/web/tower/dist/assets/cytoscape.esm-BHa1VTXv.js +321 -0
  382. package/web/tower/dist/assets/d3-scale-4DPf7zan.js +1 -0
  383. package/web/tower/dist/assets/dagre-GXQ25YYZ-D-Xv7L9X.js +4 -0
  384. package/web/tower/dist/assets/diagram-S7CK7UJ4-Bqy2eT2c.js +30 -0
  385. package/web/tower/dist/assets/diagram-UQ7AKVKN-B2wK2GHj.js +41 -0
  386. package/web/tower/dist/assets/diagram-VSXAHHWV-CIZqh7BH.js +3 -0
  387. package/web/tower/dist/assets/diagram-VX7I27RA-BGX4HBj2.js +24 -0
  388. package/web/tower/dist/assets/diagram-Z3DM3KII-DYpsfaJW.js +24 -0
  389. package/web/tower/dist/assets/ebnfDiagram-PWID7BFC-BNnwCZNv.js +1 -0
  390. package/web/tower/dist/assets/erDiagram-RLTQ6QDP-_MN9W-1E.js +99 -0
  391. package/web/tower/dist/assets/flowDiagram-HODETNUW-D_ndx1UC.js +168 -0
  392. package/web/tower/dist/assets/ganttDiagram-EL5Y4UJY-C8chdEiZ.js +292 -0
  393. package/web/tower/dist/assets/getPo2TextureFromSource-CqJsdi0J.js +1 -0
  394. package/web/tower/dist/assets/getTexelRangeRects-DN3N5aFp.js +57 -0
  395. package/web/tower/dist/assets/getTextureBatchBindGroup-RNSiAVH3.js +1 -0
  396. package/web/tower/dist/assets/gitGraphDiagram-WWUBYQGX-B5ijv7LI.js +106 -0
  397. package/web/tower/dist/assets/index-B1Ho-Igs.css +1 -0
  398. package/web/tower/dist/assets/index-CfNjH1Wr.js +45 -0
  399. package/web/tower/dist/assets/infoDiagram-27XIBGKW-AYbp5ElT.js +2 -0
  400. package/web/tower/dist/assets/ishikawaDiagram-5VMMS53U-DnmwARuR.js +70 -0
  401. package/web/tower/dist/assets/journeyDiagram-3NMN7TZE-CK737kko.js +139 -0
  402. package/web/tower/dist/assets/kanban-definition-UXKFOSKX-0AhM3axC.js +89 -0
  403. package/web/tower/dist/assets/katex-HP8lGamR.js +257 -0
  404. package/web/tower/dist/assets/layout-wOIeK9c_.js +1 -0
  405. package/web/tower/dist/assets/mermaid.core-CGYyw6G7.js +310 -0
  406. package/web/tower/dist/assets/mindmap-definition-YA3MSWOX-CkZ_JOdx.js +96 -0
  407. package/web/tower/dist/assets/pegDiagram-XKGWAZYB-CHAPspih.js +1 -0
  408. package/web/tower/dist/assets/pieDiagram-E7YTZNPT-LwCcZl5o.js +39 -0
  409. package/web/tower/dist/assets/preload-helper-PPVm8Dsz.js +1 -0
  410. package/web/tower/dist/assets/quadrantDiagram-AXDQQJYC-Cm4uijV2.js +7 -0
  411. package/web/tower/dist/assets/railroadDiagram-O6MQD6OU-BPQHZ2b5.js +1 -0
  412. package/web/tower/dist/assets/requirementDiagram-BXWQKSXE-JLtSUDfS.js +84 -0
  413. package/web/tower/dist/assets/sankeyDiagram-P5KCCOFB-DJsYv9ii.js +40 -0
  414. package/web/tower/dist/assets/sequenceDiagram-WJ2MYXX4-Ca8T8sT0.js +162 -0
  415. package/web/tower/dist/assets/sizeCapture-INFHLROL-Ch4i2dS-.js +1 -0
  416. package/web/tower/dist/assets/stateDiagram-D77RDMKH-DDSkncYm.js +1 -0
  417. package/web/tower/dist/assets/stateDiagram-v2-MP3YSRHH-BkO_9mIH.js +1 -0
  418. package/web/tower/dist/assets/swimlanes-42K2YHIH-Bns5iI3y.js +1 -0
  419. package/web/tower/dist/assets/swimlanesDiagram-VR7AAH4N--LEBb1ti.js +8 -0
  420. package/web/tower/dist/assets/timeline-definition-24CTP7MA-QJDuVTb3.js +120 -0
  421. package/web/tower/dist/assets/vennDiagram-4TSXK5OY-pBNxKxOV.js +34 -0
  422. package/web/tower/dist/assets/wardleyDiagram-VM6X3IG4-1PEarjN1.js +78 -0
  423. package/web/tower/dist/assets/webworkerAll-D_Np003p.js +83 -0
  424. package/web/tower/dist/assets/xychartDiagram-S5SC5T6Z-CLwsvOg7.js +7 -0
  425. package/web/tower/dist/index.html +41 -0
  426. package/contracts/review-provider-contract-mirror/v1.6.0/bundle/vectors/lens.json +0 -1
  427. package/docs/review-delivery-preflight.md +0 -22
  428. package/extensions/codegraph-tools.ts +0 -437
  429. package/lib/native-review-authority-quarantine.ts +0 -2
  430. package/lib/review-delivery-preflight.ts +0 -85
  431. package/lib/review-legacy-detector.ts +0 -81
  432. package/tests/child-codegraph-bootstrap.test.ts +0 -74
  433. package/tests/codegraph-tools.test.ts +0 -554
  434. package/tests/fixtures/devbinary/capabilities-v2.1.derived.json +0 -331
  435. package/tests/fixtures/refusal-identity.probe.mjs +0 -139
  436. package/tests/native-review-authority-quarantine.test.ts +0 -10
  437. package/tests/native-review-refusal-identity.test.ts +0 -25
  438. package/tests/review-delivery-preflight.test.ts +0 -462
  439. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/README.md +0 -0
  440. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/refuter.schema.json +0 -0
  441. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  442. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/refuter.json +0 -0
  443. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/targeted-validator.json +0 -0
@@ -1,9 +1,12 @@
1
1
  import assert from "node:assert/strict";
2
+ import { execFileSync } from "node:child_process";
2
3
  import { createHash } from "node:crypto";
3
- import { mkdtempSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
4
+ import { existsSync, mkdtempSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
4
5
  import { tmpdir } from "node:os";
5
6
  import { join } from "node:path";
6
7
  import test from "node:test";
8
+ import { setTimeout as delay } from "node:timers/promises";
9
+ import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
7
10
  import {
8
11
  decodeReviewConsentV3,
9
12
  } from "../lib/review-integration-v2.ts";
@@ -26,6 +29,8 @@ import {
26
29
  type NativeTargetStatusRequest,
27
30
  } from "../lib/native-review-cli.ts";
28
31
  import { setBundledInstallForTesting } from "../lib/gentle-shell-bundled.ts";
32
+ import { capabilitiesV26 } from "./support/capabilities-v26.ts";
33
+ import { statusV9 } from "./support/status-v9.ts";
29
34
 
30
35
  const fixture = (name: string): Record<string, unknown> => JSON.parse(
31
36
  readFileSync(join(process.cwd(), "tests", "fixtures", "devbinary", name), "utf8"),
@@ -176,8 +181,21 @@ test("scoped native mode surfaces stderr, exit, and malformed responses without
176
181
  }
177
182
  });
178
183
 
179
- test("negotiated STATUS accepts the pinned v5 receipt before routing its transition", async () => {
180
- const status = fixture("status-v5.captured.json");
184
+ test("negotiated STATUS refuses an older status envelope with the actionable minimum-version error", async () => {
185
+ for (const version of [5, 8]) {
186
+ const older = fixture("status-v5.captured.json");
187
+ older.schema = `gentle-ai.review-integration.status/v${version}`;
188
+ const queue = queuedAdapter([{ stdout: JSON.stringify(older) }]);
189
+ await assert.rejects(client(queue.adapter).targetStatus({ cwd: "/repo", lineageId: "review-status-fixture", agent: "pi" }), (error: any) => {
190
+ assert.equal(error.code, "version-incompatible");
191
+ assert.equal(error.message, `gentle-ai native review status/v${version} is older than the supported v9 (gentle-ai v4.6.0); update gentle-ai or remove the dev-binary override`);
192
+ return true;
193
+ });
194
+ }
195
+ });
196
+
197
+ test("negotiated STATUS accepts the pinned status/v9 receipt before routing its transition", async () => {
198
+ const status = statusV9(fixture("status-v5.captured.json"));
181
199
  const queue = queuedAdapter([{ stdout: JSON.stringify(status) }]);
182
200
  const result = await client(queue.adapter).targetStatus({ cwd: "/repo", lineageId: "review-status-fixture", agent: "pi" });
183
201
  assert.deepEqual(result.receipt, { status: "not_applicable" });
@@ -384,7 +402,7 @@ test("malformed closure output remains a typed schema failure and never authoriz
384
402
  });
385
403
 
386
404
  function currentStatusFixture(): Record<string, unknown> {
387
- return fixture("status-v5.captured.json");
405
+ return statusV9(fixture("status-v5.captured.json"));
388
406
  }
389
407
 
390
408
  function negotiatedStartStatus(targetIdentity: string, tokens: readonly string[]): Record<string, unknown> {
@@ -544,7 +562,7 @@ const LENS_SELECTION_UNSUPPORTED_FAILURE = {
544
562
  };
545
563
 
546
564
  function contextClient(responses: QueuedResult[], features = ["start_request_context", "start_options_preflight"], executable = join(process.cwd(), "package.json")) {
547
- const capabilities = JSON.parse(readFileSync(join(process.cwd(), "contracts/review-integration/v2/fixtures/capabilities.fixture.json"), "utf8"));
565
+ const capabilities = capabilitiesV26(JSON.parse(readFileSync(join(process.cwd(), "contracts/review-integration/v2/fixtures/capabilities.fixture.json"), "utf8")));
548
566
  capabilities.executable.sha256 = "sha256:" + createHash("sha256").update(readFileSync(executable)).digest("hex");
549
567
  capabilities.features.optional.push(...features.map(name => ({ name, supported: true, requires: [] })));
550
568
  const queue = queuedAdapter([{ stdout: JSON.stringify(capabilities) }, ...responses]);
@@ -564,6 +582,52 @@ test("START discovers capabilities before forwarding the explicit request file u
564
582
  assert.deepEqual(host.calls[2].arguments, ["review", "start", ...tokens]);
565
583
  });
566
584
 
585
+ const ESCALATE_BASE = ["--contract=gentle-ai.review-integration/v2", "--cwd=/repo", "--target=" + TARGET, "--projection=workspace", "--agent=pi", "--consent=relay"];
586
+ const ESCALATE_TOKENS = [...ESCALATE_BASE, "--escalate-item=3", "--escalate-reason=touches the auth boundary"];
587
+ const escalateFlags = (arguments_: readonly string[]) => arguments_.filter((token) => token.startsWith("--escalate"));
588
+
589
+ test("START sends the escalation only to a second STATUS after a fresh START is offered and runs the provider START unchanged", async () => {
590
+ const escalate = { item: 3 as const, reason: "touches the auth boundary" };
591
+ const queue = queuedAdapter([
592
+ { stdout: JSON.stringify(negotiatedStartStatus(TARGET, ESCALATE_BASE)) },
593
+ { stdout: JSON.stringify(negotiatedStartStatus(TARGET, ESCALATE_TOKENS)) },
594
+ { stdout: JSON.stringify(fixture("start-v3-zero-lens-closed.captured.json")) },
595
+ ]);
596
+ await client(queue.adapter).start({ cwd: "/repo", escalate });
597
+ assert.equal(queue.calls.length, 3);
598
+ assert.deepEqual(escalateFlags(queue.calls[0].arguments), [], "the first STATUS never carries the escalation");
599
+ assert.deepEqual(queue.calls[1].arguments.slice(-5), ["--escalate-item", "3", "--escalate-reason", "touches the auth boundary", "--next-transition"]);
600
+ assert.deepEqual(queue.calls[1].arguments.filter((token) => token !== "--escalate-item" && token !== "3" && token !== "--escalate-reason" && token !== "touches the auth boundary"), queue.calls[0].arguments);
601
+ assert.deepEqual(queue.calls[2].arguments, ["review", "start", ...ESCALATE_TOKENS]);
602
+ });
603
+
604
+ test("a STATUS whose next transition is not a fresh START never receives the escalation", async () => {
605
+ const queue = queuedAdapter([{ stdout: JSON.stringify(currentStatusFixture()) }]);
606
+ const status = await client(queue.adapter).targetStatus({ cwd: "/repo", escalate: { item: 3, reason: "r" } });
607
+ assert.ok(status.targetIdentity !== undefined);
608
+ assert.equal(queue.calls.length, 1);
609
+ assert.deepEqual(escalateFlags(queue.calls[0].arguments), []);
610
+ });
611
+
612
+ test("START without escalate issues one STATUS free of escalation flags; a START that drops the escalation is rejected", async () => {
613
+ const plain = queuedAdapter([{ stdout: JSON.stringify(negotiatedStartStatus(TARGET, ESCALATE_BASE)) }, { stdout: JSON.stringify(fixture("start-v3-zero-lens-closed.captured.json")) }]);
614
+ await client(plain.adapter).start({ cwd: "/repo" });
615
+ assert.equal(plain.calls.length, 2);
616
+ assert.deepEqual(escalateFlags(plain.calls[0].arguments), []);
617
+ const dropped = queuedAdapter([{ stdout: JSON.stringify(negotiatedStartStatus(TARGET, ESCALATE_BASE)) }, { stdout: JSON.stringify(negotiatedStartStatus(TARGET, ESCALATE_BASE)) }]);
618
+ await assert.rejects(client(dropped.adapter).start({ cwd: "/repo", escalate: { item: 3, reason: "r" } }), /did not retain the agent escalation/);
619
+ assert.equal(dropped.calls.length, 2);
620
+ });
621
+
622
+ test("an invalid escalate is rejected before any native call", async () => {
623
+ for (const escalate of [{ item: 9, reason: "x" }, { item: 2, reason: "" }, { item: 2, reason: "é".repeat(251) }, { item: 2, reason: "a\nb" }]) {
624
+ const queue = queuedAdapter([]);
625
+ await assert.rejects(client(queue.adapter).targetStatus({ cwd: "/repo", escalate: escalate as never }), /escalate/);
626
+ await assert.rejects(client(queue.adapter).start({ cwd: "/repo", escalate: escalate as never }), /escalate/);
627
+ assert.equal(queue.calls.length, 0);
628
+ }
629
+ });
630
+
567
631
  test("request context reuses capabilities while every STATUS remains fresh", async () => {
568
632
  const host = contextClient([1, 2].map(() => ({ stdout: JSON.stringify(negotiatedStartStatus(TARGET, [])) })));
569
633
  for (let i = 0; i < 2; i++) await host.client.targetStatus({ cwd: "/repo", requestContextPath: "/spec.md" });
@@ -575,7 +639,7 @@ test("request context invalidates capabilities when executable bytes change", as
575
639
  t.after(() => rmSync(directory, { recursive: true, force: true }));
576
640
  const executable = join(directory, "native");
577
641
  writeFileSync(executable, "first executable");
578
- const replacementCapabilities = JSON.parse(readFileSync(join(process.cwd(), "contracts/review-integration/v2/fixtures/capabilities.fixture.json"), "utf8"));
642
+ const replacementCapabilities = capabilitiesV26(JSON.parse(readFileSync(join(process.cwd(), "contracts/review-integration/v2/fixtures/capabilities.fixture.json"), "utf8")));
579
643
  replacementCapabilities.executable.sha256 = "sha256:" + createHash("sha256").update("replacement executable").digest("hex");
580
644
  const host = contextClient([{ stdout: JSON.stringify(negotiatedStartStatus(TARGET, [])) }, { stdout: JSON.stringify(replacementCapabilities) }], undefined, executable);
581
645
  await host.client.targetStatus({ cwd: "/repo", requestContextPath: "/spec.md" });
@@ -585,6 +649,19 @@ test("request context invalidates capabilities when executable bytes change", as
585
649
  assert.deepEqual(host.calls.map(call => call.arguments[1]), ["capabilities", "status", "capabilities"]);
586
650
  });
587
651
 
652
+ test("request context refuses an older capabilities advertisement with the actionable minimum-version error", async () => {
653
+ const older = JSON.parse(readFileSync(join(process.cwd(), "contracts/review-integration/v2/fixtures/capabilities.fixture.json"), "utf8"));
654
+ const executable = join(process.cwd(), "package.json");
655
+ older.schema = "gentle-ai.review-integration.capabilities/v2.5";
656
+ older.executable.sha256 = "sha256:" + createHash("sha256").update(readFileSync(executable)).digest("hex");
657
+ const queue = queuedAdapter([{ stdout: JSON.stringify(older) }]);
658
+ await assert.rejects(new NativeReviewCliV216(queue.adapter, executable).targetStatus({ cwd: "/repo", requestContextPath: "/spec.md" }), (error: any) => {
659
+ assert.equal(error.code, "version-incompatible");
660
+ assert.equal(error.message, "gentle-ai native review capabilities/v2.5 is older than the supported v2.6 (gentle-ai v4.6.0); update gentle-ai or remove the dev-binary override");
661
+ return true;
662
+ });
663
+ });
664
+
588
665
  test("request context never caches malformed capability discovery", async () => {
589
666
  const host = contextClient([]);
590
667
  let discoveries = 0;
@@ -675,23 +752,15 @@ test("native START preflights the agent lens selection through STATUS", async ()
675
752
  ]);
676
753
  });
677
754
 
678
- test("native START falls back to the tier default when the provider predates lens selection", async () => {
679
- const tokens = [
680
- "--contract=gentle-ai.review-integration/v2", "--cwd=/repo", `--target=${TARGET}`,
681
- "--projection=workspace", "--agent=pi", "--consent=relay",
682
- ];
683
- const queue = queuedAdapter([
684
- { stdout: JSON.stringify(LENS_SELECTION_UNSUPPORTED_FAILURE), exitCode: 1 },
685
- { stdout: JSON.stringify(negotiatedStartStatus(TARGET, tokens)) },
686
- { stdout: JSON.stringify(fixture("start-v3-zero-lens-closed.captured.json")) },
687
- ]);
688
- const result = await client(queue.adapter).start({ cwd: "/repo", targetIdentity: TARGET, lenses: ["review-risk"], lensesReason: "changes token parsing" });
689
- assert.equal(result.action, "closed");
755
+ test("native START no longer falls back when the provider refuses lens selection: the refusal surfaces and STATUS is not retried", async () => {
756
+ const queue = queuedAdapter([{ stdout: JSON.stringify(LENS_SELECTION_UNSUPPORTED_FAILURE), exitCode: 1 }]);
757
+ await assert.rejects(
758
+ () => client(queue.adapter).start({ cwd: "/repo", targetIdentity: TARGET, lenses: ["review-risk"], lensesReason: "changes token parsing" }),
759
+ (error: unknown) => error instanceof NativeReviewIntegrationError && error.failureEnvelope.cause === LENS_SELECTION_UNSUPPORTED_FAILURE.cause,
760
+ );
690
761
  assert.deepEqual(queue.calls.map((call) => call.arguments), [
691
762
  ["review", "status", "--contract", "gentle-ai.review-integration/v2", "--cwd", "/repo", "--projection", "workspace", "--agent", "pi",
692
763
  "--lenses", "review-risk", "--lenses-reason", "changes token parsing", "--next-transition"],
693
- ["review", "status", "--contract", "gentle-ai.review-integration/v2", "--cwd", "/repo", "--projection", "workspace", "--agent", "pi", "--next-transition"],
694
- ["review", "start", ...tokens],
695
764
  ]);
696
765
  });
697
766
 
@@ -1031,6 +1100,115 @@ test("node execFile adapter passes AbortSignal to child_process", async () => {
1031
1100
  await assert.rejects(pending, (error: unknown) => error instanceof Error && error.name === "AbortError");
1032
1101
  });
1033
1102
 
1103
+ test("POSIX review STATUS settles as timed out when the native child ignores SIGTERM", { skip: process.platform === "win32" }, async (t) => {
1104
+ const cwd = realpathSync(mkdtempSync(join(tmpdir(), "gentle-pi-native-status-")));
1105
+ const invocation = join(cwd, "invocation.json");
1106
+ const binary = join(cwd, "gentle-ai.cjs");
1107
+ t.after(() => {
1108
+ try { process.kill(JSON.parse(readFileSync(invocation, "utf8")).pid, "SIGKILL"); } catch { /* Not started, or already reaped. */ }
1109
+ rmSync(cwd, { recursive: true, force: true });
1110
+ });
1111
+ execFileSync("git", ["init", "-q"], { cwd });
1112
+ const status = negotiatedStartStatus(TARGET, ["--contract=gentle-ai.review-integration/v2"]);
1113
+ writeFileSync(binary, `#!${process.execPath}
1114
+ if (!process.argv.includes("--lineage")) {
1115
+ process.stdout.write(${JSON.stringify(JSON.stringify(status))});
1116
+ } else {
1117
+ process.on("SIGTERM", () => {});
1118
+ require("node:fs").writeFileSync(${JSON.stringify(invocation)}, JSON.stringify({ argv: process.argv.slice(2), pid: process.pid }));
1119
+ setTimeout(() => {}, 10_000);
1120
+ }
1121
+ `, { mode: 0o700 });
1122
+ let review: { execute(id: string, parameters: Record<string, unknown>, signal: undefined, onUpdate: undefined, context: unknown): Promise<{ details: Record<string, unknown>; content: unknown }> };
1123
+ createGentleAiExtension({ nativeReviewCli: new NativeReviewCliV216(createNodeExecFileAdapter(), binary, 300), candidateViews: null, processEnv: { GENTLE_AI_TELEMETRY: "0" } })(
1124
+ { on() {}, registerCommand() {}, registerTool(tool: typeof review & { name: string }) { if (tool.name === "gentle_review") review = tool; } } as never);
1125
+ const context = { cwd, hasUI: false, sessionManager: { getSessionId: () => cwd } };
1126
+ const normal = await review!.execute("status-complete", { operation: "status" }, undefined, undefined, context);
1127
+ assert.deepEqual(normal.details, { operation: "status", status: "ready", result: status });
1128
+
1129
+ const lineageId = "stalled-native-status";
1130
+ const pending = review!.execute("status-timeout", { operation: "status", lineageId }, undefined, undefined, context);
1131
+ const result = await Promise.race([pending, delay(1_500, "still pending", { ref: false })]);
1132
+ const { argv, pid } = JSON.parse(readFileSync(invocation, "utf8"));
1133
+ assert.deepEqual(argv, ["review", "status", "--contract", "gentle-ai.review-integration/v2", "--cwd", cwd, "--projection", "workspace", "--lineage", lineageId, "--agent", "pi", "--next-transition"]);
1134
+ assert.notEqual(result, "still pending", "STATUS was still pending 1,500 ms after invocation (native deadline 300 ms)");
1135
+ if (typeof result === "string") return;
1136
+ assert.deepEqual(result.content, [{ type: "text", text: JSON.stringify(result.details) }]);
1137
+ assert.deepEqual({
1138
+ status: result.details.status,
1139
+ outcome: result.details.outcome,
1140
+ mutationPerformed: result.details.mutation_performed,
1141
+ mutationOutcome: result.details.mutation_outcome,
1142
+ nextAction: result.details.next_action,
1143
+ diagnostics: result.details.diagnostics,
1144
+ }, {
1145
+ status: "blocked", outcome: "native-status-timed-out", mutationPerformed: false, mutationOutcome: "none", nextAction: "rerun-native-status",
1146
+ diagnostics: { operation: "review/status", error_code: "timeout", exit_code: 1, timed_out: true, output_limit_exceeded: false },
1147
+ });
1148
+ // Settlement doesn't wait for libuv to reap the signalled child.
1149
+ const reapingDeadline = Date.now() + 1_000;
1150
+ while (Date.now() < reapingDeadline) {
1151
+ try { process.kill(pid, 0); } catch (error) { if ((error as NodeJS.ErrnoException).code === "ESRCH") return; throw error; }
1152
+ await delay(10);
1153
+ }
1154
+ assert.throws(() => process.kill(pid, 0), { code: "ESRCH" }, "timed-out child must not be left running");
1155
+ });
1156
+
1157
+ test("POSIX review STATUS settles as timed out after the native child exits with inherited pipes open", { skip: process.platform === "win32" }, async (t) => {
1158
+ const cwd = realpathSync(mkdtempSync(join(tmpdir(), "gentle-pi-native-status-pipes-")));
1159
+ const invocation = join(cwd, "invocation.json");
1160
+ const binary = join(cwd, "gentle-ai.cjs");
1161
+ const readInvocation = (): { pid: number; descendantPid: number; argv: string[] } => JSON.parse(readFileSync(invocation, "utf8"));
1162
+ t.after(() => {
1163
+ try { process.kill(readInvocation().descendantPid, "SIGKILL"); } catch { /* Not started, or already gone. */ }
1164
+ rmSync(cwd, { recursive: true, force: true });
1165
+ });
1166
+ execFileSync("git", ["init", "-q"], { cwd });
1167
+ writeFileSync(binary, `#!${process.execPath}
1168
+ const { spawn } = require("node:child_process");
1169
+ const { renameSync, writeFileSync } = require("node:fs");
1170
+ const descendant = spawn(process.execPath, ["-e", "setTimeout(() => {}, 30_000)"], { detached: true, stdio: "inherit" });
1171
+ const invocation = ${JSON.stringify(invocation)};
1172
+ writeFileSync(invocation + ".tmp", JSON.stringify({ pid: process.pid, descendantPid: descendant.pid, argv: process.argv.slice(2) }));
1173
+ renameSync(invocation + ".tmp", invocation);
1174
+ process.exit(0);
1175
+ `, { mode: 0o700 });
1176
+ let review: { execute(id: string, parameters: Record<string, unknown>, signal: undefined, onUpdate: undefined, context: unknown): Promise<{ details: Record<string, unknown> }> };
1177
+ createGentleAiExtension({ nativeReviewCli: new NativeReviewCliV216(createNodeExecFileAdapter(), binary, 500), candidateViews: null, processEnv: { GENTLE_AI_TELEMETRY: "0" } })(
1178
+ { on() {}, registerCommand() {}, registerTool(tool: typeof review & { name: string }) { if (tool.name === "gentle_review") review = tool; } } as never);
1179
+ const lineageId = "exited-native-status";
1180
+ const pending = review!.execute("status-open-pipes", { operation: "status", lineageId }, undefined, undefined, { cwd, hasUI: false, sessionManager: { getSessionId: () => cwd } });
1181
+ const limit = delay(1_500, "still pending", { ref: false });
1182
+ const reaped = async () => {
1183
+ while (!existsSync(invocation)) await delay(10, undefined, { ref: false, signal: t.signal });
1184
+ const record = readInvocation();
1185
+ for (;;) {
1186
+ try { process.kill(record.pid, 0); } catch (error) { if ((error as NodeJS.ErrnoException).code === "ESRCH") return record; throw error; }
1187
+ await delay(10, undefined, { ref: false, signal: t.signal });
1188
+ }
1189
+ };
1190
+ const first = await Promise.race([reaped(), pending, limit]);
1191
+ assert.ok(typeof first === "object" && "descendantPid" in first, "the native child must exit before STATUS settles");
1192
+ assert.deepEqual(first.argv, ["review", "status", "--contract", "gentle-ai.review-integration/v2", "--cwd", cwd, "--projection", "workspace", "--lineage", lineageId, "--agent", "pi", "--next-transition"]);
1193
+
1194
+ const result = await Promise.race([pending, limit]);
1195
+ assert.ok(typeof result !== "string", "STATUS must settle without waiting for the descendant to close the pipes");
1196
+ assert.equal(result.details.status, "blocked");
1197
+ assert.equal(result.details.outcome, "native-status-timed-out");
1198
+ assert.equal(result.details.mutation_performed, false);
1199
+ assert.equal(result.details.mutation_outcome, "none");
1200
+ assert.deepEqual(result.details.diagnostics, { operation: "review/status", error_code: "timeout", exit_code: 1, timed_out: true, output_limit_exceeded: false });
1201
+ assert.doesNotThrow(() => process.kill(first.descendantPid, 0), "the descendant is still alive when STATUS settles");
1202
+ });
1203
+
1204
+ test("POSIX non-STATUS adapter calls retain Node's ordinary timeout handling", { skip: process.platform === "win32" }, async () => {
1205
+ const result = await createNodeExecFileAdapter()({
1206
+ file: process.execPath, arguments: ["-e", "setTimeout(() => {}, 10_000)"],
1207
+ cwd: process.cwd(), maxBufferBytes: 1024, timeoutMs: 100,
1208
+ });
1209
+ assert.deepEqual(result, { stdout: "", stderr: "", exitCode: 1, signal: "SIGTERM", timedOut: true, outputLimitExceeded: false });
1210
+ });
1211
+
1034
1212
  // On Windows, killing gentle-ai alone leaves its git children running against
1035
1213
  // the repository index; abort and timeout must take the whole tree down.
1036
1214
  test("node execFile adapter kills the whole process tree on Windows abort and timeout", async () => {
@@ -1292,7 +1470,7 @@ test("acknowledge-approved decodes the captured review-acknowledged/v1 burn enve
1292
1470
  test("acknowledge-approved fails closed on a foreign, drifted, or mismatched success body", async () => {
1293
1471
  const raw = JSON.parse(readFileSync(join(process.cwd(), "tests", "fixtures", "devbinary", "review-acknowledged-v1.captured.json"), "utf8")) as Record<string, unknown>;
1294
1472
  const bodies: Array<[string, string, { lineageId: string; targetIdentity: string; revision: string }]> = [
1295
- ["a STATUS envelope", JSON.stringify(fixture("status-v5.captured.json")), ACKNOWLEDGED_BINDING],
1473
+ ["a STATUS envelope", JSON.stringify(statusV9(fixture("status-v5.captured.json"))), ACKNOWLEDGED_BINDING],
1296
1474
  ["a last-event closure", JSON.stringify(fixture("last-event-capture-result-approved.captured.json")), ACKNOWLEDGED_BINDING],
1297
1475
  ["an envelope with an unknown field", JSON.stringify({ ...raw, receipt: {} }), ACKNOWLEDGED_BINDING],
1298
1476
  ["an envelope naming another lineage", JSON.stringify(raw), { ...ACKNOWLEDGED_BINDING, lineageId: "review-other" }],
@@ -3,6 +3,8 @@ import { readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import test from "node:test";
5
5
  import { GENTLE_AI_VERSION } from "../lib/gentle-ai-binary.ts";
6
+ import { capabilitiesV26 } from "./support/capabilities-v26.ts";
7
+ import { statusV9 } from "./support/status-v9.ts";
6
8
  import {
7
9
  NativeReviewCliV216,
8
10
  NativeReviewConsentBindingError,
@@ -17,13 +19,13 @@ const fixture = <T = Record<string, unknown>>(name: string): T => JSON.parse(rea
17
19
  const executableDigest = "dcc846103b16d365eaeeb9d7f289c23fc4f2897f23def1cb3fe7f05557b64705";
18
20
 
19
21
  function capabilities(): Record<string, unknown> {
20
- const value = fixture<Record<string, unknown>>("capabilities.fixture.json");
22
+ const value = capabilitiesV26(fixture<Record<string, unknown>>("capabilities.fixture.json"));
21
23
  (value.package as Record<string, unknown>).version = GENTLE_AI_VERSION;
22
24
  return value;
23
25
  }
24
26
 
25
27
  function unrelatedStatus(targetIdentity: string): Record<string, unknown> {
26
- const status = fixture<Record<string, unknown>>("status.fixture.json");
28
+ const status = statusV9(fixture<Record<string, unknown>>("status.fixture.json"));
27
29
  status.applicability = "unrelated";
28
30
  delete status.receipt;
29
31
  status.action = "start";
@@ -73,7 +75,7 @@ function queuedAdapter(outputs: readonly Record<string, unknown>[]): { adapter:
73
75
  // V216 no longer probes capabilities before negotiated STATUS. Keep the
74
76
  // historical queue construction below, but discard only its obsolete probe
75
77
  // response so every remaining entry binds the current invocation.
76
- const queue = outputs.filter((body) => body.schema !== "gentle-ai.review-integration.capabilities/v2");
78
+ const queue = outputs.filter((body) => body.schema !== "gentle-ai.review-integration.capabilities/v2.6");
77
79
  const calls: Array<readonly string[]> = [];
78
80
  return {
79
81
  calls,
@@ -539,3 +541,18 @@ test("a declined Pi consent/v3 answer replays the captured exact agent-bound inv
539
541
  assert.deepEqual(queue.calls.at(-1), decoded.choices[1].invocation.split(" ").slice(1));
540
542
  assert.equal(queue.calls.filter((arguments_) => arguments_.includes("--agent") && arguments_.includes("pi")).length, 1);
541
543
  });
544
+
545
+ test("consent invocation must still carry the requested escalation exactly once", async () => {
546
+ const consent = (await import("../lib/review-integration-v2.ts")).decodeReviewConsentV2(fixture<Record<string, unknown>>("consent.fixture.json"));
547
+ const escalate = { item: 3 as const, reason: "touches the auth boundary" };
548
+ const carried = structuredClone(consent);
549
+ for (const choice of carried.choices) choice.invocation = choice.invocation.replace(/ --consent /, ` --escalate-item ${escalate.item} --escalate-reason 'touches the auth boundary' --consent `);
550
+ const started = fixture<Record<string, unknown>>("start.fixture.json");
551
+ started.artifact_subjects = [];
552
+ const queue = queuedAdapter([capabilities(), started]);
553
+ const answered = await client(queue.adapter).answerConsent!({ cwd: "/repo", consent: carried, answer: "granted", escalate }).catch((error) => error);
554
+ assert.ok(!(answered instanceof NativeReviewConsentBindingError && answered.reason === "consent-invocation-escalate-changed"), String(answered));
555
+ const dropped = queuedAdapter([capabilities(), started]);
556
+ await assert.rejects(client(dropped.adapter).answerConsent!({ cwd: "/repo", consent, answer: "granted", escalate }), (error: unknown) => error instanceof NativeReviewConsentBindingError && error.reason === "consent-invocation-escalate-changed");
557
+ assert.equal(dropped.calls.filter((arguments_) => arguments_.includes("granted")).length, 0);
558
+ });
@@ -0,0 +1,42 @@
1
+ import assert from "node:assert/strict";
2
+ import { execFileSync } from "node:child_process";
3
+ import { existsSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
4
+ import { tmpdir } from "node:os";
5
+ import { join } from "node:path";
6
+ import test from "node:test";
7
+ import { createNativeReviewCli, createNodeExecFileAdapter, NativeReviewConsentRequiredError } from "../lib/native-review-cli.ts";
8
+
9
+ // gentle-ai#6203: against the real provider (gentle-ai main) an agent-escalated
10
+ // medium candidate's START reports risk high. Stops at the consent question: no
11
+ // reviewer capture, and consent is never answered.
12
+ const binary = process.env.GENTLE_AI_REAL_BINARY ?? join(process.env.HOME ?? "", "go", "bin", "gentle-ai");
13
+
14
+ test("real provider: START carries the escalation so the consent reads high; without it medium", { skip: !existsSync(binary) }, async () => {
15
+ const root = realpathSync(mkdtempSync(join(tmpdir(), "gp-escalate-")));
16
+ const saved = { HOME: process.env.HOME, TMPDIR: process.env.TMPDIR };
17
+ try {
18
+ const repo = join(root, "repo");
19
+ mkdirSync(join(root, "home")); mkdirSync(join(root, "tmp")); mkdirSync(repo);
20
+ process.env.HOME = join(root, "home"); process.env.TMPDIR = join(root, "tmp");
21
+ const git = (...args: string[]) => execFileSync("git", args, { cwd: repo, stdio: "pipe" });
22
+ git("init", "-q"); git("config", "user.email", "t@example.invalid"); git("config", "user.name", "t");
23
+ writeFileSync(join(repo, "a.txt"), "a\n"); git("add", "."); git("commit", "-qm", "init");
24
+ writeFileSync(join(repo, "a.txt"), Array.from({ length: 40 }, (_, i) => `line ${i}`).join("\n") + "\n");
25
+ const risk = async (escalate?: { item: 2; reason: string }): Promise<unknown> => {
26
+ const cli = createNativeReviewCli(createNodeExecFileAdapter(), () => binary);
27
+ try { await cli.start({ cwd: repo, ...(escalate === undefined ? {} : { escalate }) }); }
28
+ catch (error) {
29
+ if (!(error instanceof NativeReviewConsentRequiredError)) throw error;
30
+ return JSON.stringify(error.consent.raw);
31
+ }
32
+ throw new Error("expected the provider to ask for consent");
33
+ };
34
+ const escalated = String(await risk({ item: 2, reason: "changes the auth boundary" }));
35
+ assert.match(escalated, /"risk_(?:tier|level)":\s*"high"/);
36
+ const plain = String(await risk());
37
+ assert.doesNotMatch(plain, /"risk_(?:tier|level)":\s*"high"/);
38
+ } finally {
39
+ for (const key of ["HOME", "TMPDIR"] as const) { if (saved[key] === undefined) delete process.env[key]; else process.env[key] = saved[key]; }
40
+ rmSync(root, { recursive: true, force: true });
41
+ }
42
+ });
@@ -8,7 +8,7 @@ import { __testing } from "../extensions/gentle-ai.ts";
8
8
  // stop you between the two and pick the second part up later"; every Gentle
9
9
  // cell delivered only the first part and paused by itself. Hedged delivery
10
10
  // wording asks for resumable notes and separate commits, never a stop, and
11
- // the close step must not leave tracked tasks pending without a user stop.
11
+ // the Close step must not leave runnable authorized tasks pending.
12
12
 
13
13
  const REPO_ROOT = join(import.meta.dirname, "..");
14
14
  const read = (relative: string): string => readFileSync(join(REPO_ROOT, relative), "utf8");
@@ -16,7 +16,7 @@ const read = (relative: string): string => readFileSync(join(REPO_ROOT, relative
16
16
  const tracking = read("assets/orchestrator-tracking.md");
17
17
  const core = read("assets/orchestrator.md");
18
18
 
19
- const contextualApproval = 'Interpret short replies such as "yes", "go ahead", or "eso mismo" against the immediately preceding proposal. When the human unambiguously accepts a concrete implementation action they already understand, execute that action within its agreed scope without asking again. Confirming a preference alone does not authorize implementation; genuinely unclear change intent still requires one focused question. Contextual approval never substitutes for provider-owned consent, exact-token authorization, or separate publishing and destructive-action permission.';
19
+ const contextualApproval = 'Read short replies ("yes", "go ahead", "eso mismo") against the preceding proposal. Act within scope on clear, informed approval of a concrete change without asking again. Preference alone is not approval. Ask one focused question if change intent is unclear. Contextual approval never substitutes for provider-owned consent, exact-token authorization, or separate publishing and destructive-action permission.';
20
20
  const informedClarification = 'Clarify scope, constraints, acceptance criteria, and non-goals when needed for the human to understand the action or to resolve consequential uncertainty. Reuse what is already established; after informed approval, proceed without repeating the clarification unless new consequential uncertainty appears.';
21
21
 
22
22
  test("contextual approval continues the agreed action without weakening consent boundaries", () => {
@@ -30,10 +30,11 @@ 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."));
33
+ assert.ok(prompt.includes("After resolving an incident or subdecision, automatically resume safe, necessary in-scope work on the original authorized objective. Recover proportionately and respect explicit user dispositions."));
34
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"));
35
+ assert.ok(prompt.includes("Only a real human decision, explicit user stop, denial, missing consent, exhausted limit, or failure without a permitted route stops only affected work."));
36
+ assert.ok(prompt.includes("Continue independent authorized work; never abandon runnable work or present an unverified outcome as final."));
37
+ assert.ok(prompt.includes("Missing, partial, unavailable, or declined proof bars claiming completion of affected work, not independent authorized work or required authorized checks in budget."));
37
38
  // cost-speed-painpoints S15 P4: the verifier-setup rules load with the Verification rule, not on every turn.
38
39
  const verification = read("assets/orchestrator-verification.md");
39
40
  for (const sentence of [
@@ -43,7 +44,7 @@ test("resolved subdecisions retain the original authorized objective", () => {
43
44
  assert.ok(verification.includes(sentence), `verification module keeps: ${sentence}`);
44
45
  assert.ok(!prompt.includes(sentence), `always-on prompt no longer carries: ${sentence}`);
45
46
  }
46
- assert.ok(prompt.includes("Do not infer permission for publishing, destructive actions, unrelated scope or native consent from this continuity rule."));
47
+ assert.ok(prompt.includes("Do not infer permission for publishing, destructive actions, unrelated scope or native consent."));
47
48
  });
48
49
 
49
50
  function authorizationSection(): string {
@@ -121,7 +122,7 @@ test("T13: the always-on harness narrows conditional intent and gates Close on p
121
122
  "harness must say hedged delivery wording is not a stop",
122
123
  );
123
124
  assert.ok(
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.includes("A tracked task ends the turn pending only for launched work still running, a real human decision, denial, missing consent, explicit stop, or exhausted limit."),
125
126
  "harness Close step must keep a legitimate pending child or scoped human decision",
126
127
  );
127
128
  assert.ok(harness.includes("Hedged wording is not a stop."), "harness Close step must keep hedged wording out of stops");
@@ -6,7 +6,7 @@ import { inferOddPhase } from "../lib/odd-phase-inference.ts";
6
6
  // working label. Unknown tools and ambiguous shell commands never change it.
7
7
 
8
8
  test("read-only file tools infer exploring", () => {
9
- for (const tool of ["read", "grep", "find", "ls", "codegraph"]) {
9
+ for (const tool of ["read", "grep", "find", "ls"]) {
10
10
  assert.equal(inferOddPhase(tool, { path: "src/index.ts" }), "exploring", tool);
11
11
  }
12
12
  });
@@ -110,7 +110,7 @@ test("a checking segment wins over an exploring segment in the same command", ()
110
110
  // read-only inspection must still read as exploring.
111
111
  test("real compound read-only shell commands infer exploring", () => {
112
112
  for (const command of [
113
- `cd /repo && git rev-parse --show-toplevel && ls -d .codegraph 2>/dev/null; git log -1 --oneline; grep -rniI "bridge" --include=*.ts -l . 2>/dev/null | grep -v node_modules | head -30`,
113
+ `cd /repo && git rev-parse --show-toplevel && ls -d lib 2>/dev/null; git log -1 --oneline; grep -rniI "bridge" --include=*.ts -l . 2>/dev/null | grep -v node_modules | head -30`,
114
114
  `ls ~/work | grep -i -E "shell|pi"; for d in ~/work/a ~/dev/b; do [ -d $d ] && echo "== $d" && cd $d && git log -1 --oneline && grep -rniI "bridge" -l . 2>/dev/null | grep -v node_modules | head -20; done`,
115
115
  `cd ~/w && grep -rniI "bridge" src | grep -v test | head -15; echo ===; cat ~/.config/settings.json 2>/dev/null | head -40; cd ~/repo && git branch -a --contains 6776520be 2>/dev/null | head`,
116
116
  `f=~/.local/bin/tool; ls -la $f; file -h $f; readlink -f $f; head -c 1500 "$(readlink -f $f)" | strings | head -40`,
@@ -216,7 +216,7 @@ const ANCHORS: readonly RoutingAnchor[] = [
216
216
  // wait event, not a human decision. Pi's continuity scopes an explicit stop
217
217
  // to the work it names without restating the boundary.
218
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",
219
+ canonical: "A pending child is a wait: completion resumes the turn without asking.",
220
220
  mirrors: [
221
221
  { surface: EXTENSION, includes: "An explicit user stop applies only to the work it names." },
222
222
  ],
@@ -143,7 +143,7 @@ test("assumption challenge and task checks do not activate or duplicate native r
143
143
  // P5b (C5): the injected contract governs how a review starts, runs, and gets consent; tracking keeps the
144
144
  // commit-boundary rules mirrored from routing/pi.md, which the rendered prompt carries nowhere else.
145
145
  "When RDD is enabled, the injected Gentle AI contract governs native review start, execution and consent; this module adds only assessment and commit boundaries.",
146
- "A not-due `passive` commit needs no review and the boundary advances; `under_budget` stays pending in the slice until a later commit reaches the budget.",
146
+ "A not-due `passive` commit needs no review and the boundary advances; `under_budget` stays pending in the slice and never triggers review by itself.",
147
147
  "lower the tier or infer low risk",
148
148
  "When RDD is disabled, do not start or prompt for RDD",
149
149
  ]);
@@ -491,7 +491,7 @@ test("ODD protocol is always-on in the rendered system prompt and runs by defaul
491
491
  const orderedClauses = [
492
492
  "Default workflow: Organic Driven Development (MANDATORY)",
493
493
  "predefined workflow of this orchestrator",
494
- "Never describe this workflow only when asked about it: run it.",
494
+ "Every request enters it unasked. Apply it, don't just describe it. Run these steps in this order on every request:",
495
495
  "1. **Authorize.**",
496
496
  "2. **Explore.**",
497
497
  "3. **Resolve uncertainty.**",
@@ -45,7 +45,12 @@ const FIXTURE_PATH = join(import.meta.dirname, "fixtures", "orchestrator.pre-die
45
45
  // cost-speed P14 (PD-81): the Evidence-budget lookup number matches the runtime notice; measured 9,189 -> 9,177 B.
46
46
  // fix/temp-dir-exemption (user decision 2026-11-16): the confinement clause exempts the OS temp directory
47
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;
48
+ // gentle-shell#348 rebase (2026-11-16): the parent-inline skill-read duty clause (+49 B over its
49
+ // original base) rides on the current 9,347 B baseline; measured below at the 128-char root.
50
+ // review follow-up (2026-11-16): 9,396 B is the new pin for this candidate — the clause was
51
+ // re-approved with the rebase in issues/348 (budget note, 2026-10-30); the previous 9,352 B cap
52
+ // recorded above predates this candidate's clause and is superseded by this pin.
53
+ const BUDGET_BYTES = 9396;
49
54
  const MIN_CONTROLLED_LONG_ASSETS_ROOT_CHARS = 93;
50
55
 
51
56
  const LAZY_ASSET_NAMES = [
@@ -138,7 +143,7 @@ function measureOrchestratorPromptBytes(assetsDir: string): number {
138
143
  // measuring a shorter render again.
139
144
  const RDD_WORST_CASE_LINE = "Receipt-driven development: unknown (native status unavailable)";
140
145
 
141
- test("getOrchestratorPrompt return value stays within the canonical 9,197 B budget at a short assets root", () => {
146
+ test("getOrchestratorPrompt return value stays within the canonical 9,396 B budget at a short assets root", () => {
142
147
  const rendered = __testing.renderOrchestratorPrompt(representativeProductionAssetsDir);
143
148
  assert.ok(
144
149
  rendered.includes(RDD_WORST_CASE_LINE),
@@ -166,11 +166,11 @@ test("S5 change 5: gentle_odd_phase does not restate the Phase reporting cadence
166
166
  // --- harness-continuity S3: the authorized-work boundary is mode- and RDD-stable ---
167
167
 
168
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",
169
+ "Run authorized in-scope steps. Work through failures with a permitted route. A pending child is a wait: completion resumes the turn without asking.",
170
+ "A tracked task ends the turn pending only for launched work still running, a real human decision, denial, missing consent, explicit stop, or exhausted limit.",
171
+ "Only a real human decision, explicit user stop, denial, missing consent, exhausted limit, or failure without a permitted route stops only affected work.",
172
+ "Continue independent authorized work; never abandon runnable work or present an unverified outcome as final.",
173
+ "Missing, partial, unavailable, or declined proof bars claiming completion of affected work, not independent authorized work or required authorized checks in budget.",
174
174
  "Never turn a report into a blind self-reprompt loop.",
175
175
  ] as const;
176
176
 
@@ -0,0 +1,26 @@
1
+ import assert from "node:assert/strict";
2
+ import { readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import test from "node:test";
5
+
6
+ const readAsset = (name: string) => readFileSync(join(import.meta.dirname, "..", "assets", name), "utf8");
7
+ const skills = readAsset("orchestrator-skills.md");
8
+ const parentExecution = (skills.split(/^### Parent execution\s*$/m)[1] ?? "")
9
+ .split(/^#{1,6} /m)[0].replace(/\s+/g, " ");
10
+
11
+ // Pin the instructions the parent receives, not the output of a scripted model.
12
+ test("the parent is routed to read the exact indexed skill before acting", () => {
13
+ assert.match(readAsset("orchestrator.md"), /inline\/fallbacks: `orchestrator-skills\.md`/);
14
+ assert.match(parentExecution, /read the exact indexed `SKILL\.md` in this session before acting/);
15
+ });
16
+
17
+ test("the parent follows the skill's output contract only after reading it", () => {
18
+ assert.match(parentExecution, /let the skill's declared `## Output Contract` shape the result, so the reply carries the same contract markers applying the skill directly would produce/);
19
+ assert.match(parentExecution, /Never present contract markers without the in-session read/);
20
+ });
21
+
22
+ test("the parent proceeds unskilled on an unreadable path and adds no attribution line", () => {
23
+ assert.match(parentExecution, /If the indexed path is unreadable, proceed unskilled/);
24
+ assert.doesNotMatch(skills, /Skill (applied|unavailable) \(parent\)/);
25
+ assert.doesNotMatch(parentExecution, /attribution/i);
26
+ });