gentle-pi 4.6.0 → 4.8.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 (536) hide show
  1. package/README.md +65 -55
  2. package/assets/agents/gentle-ai-explore.md +4 -3
  3. package/assets/agents/gentle-ai-verify.md +23 -6
  4. package/assets/agents/gentle-ai-worker.md +9 -6
  5. package/assets/agents/jd-fix-agent.md +1 -0
  6. package/assets/agents/jd-judge-a.md +2 -3
  7. package/assets/agents/jd-judge-b.md +2 -3
  8. package/assets/agents/review-readability.md +1 -5
  9. package/assets/agents/review-reliability.md +1 -5
  10. package/assets/agents/review-resilience.md +1 -5
  11. package/assets/agents/review-risk.md +1 -5
  12. package/assets/design-canvas/canvas-api.js +45 -0
  13. package/assets/design-canvas/canvas-boards.js +456 -0
  14. package/assets/design-canvas/canvas-boot.js +217 -0
  15. package/assets/design-canvas/canvas-checks.js +491 -0
  16. package/assets/design-canvas/canvas-comments.js +315 -0
  17. package/assets/design-canvas/canvas-compare.js +159 -0
  18. package/assets/design-canvas/canvas-events.js +75 -0
  19. package/assets/design-canvas/canvas-export.js +393 -0
  20. package/assets/design-canvas/canvas-focus.js +203 -0
  21. package/assets/design-canvas/canvas-handoffs.js +150 -0
  22. package/assets/design-canvas/canvas-i18n-es.js +392 -0
  23. package/assets/design-canvas/canvas-i18n.js +108 -0
  24. package/assets/design-canvas/canvas-layout.js +526 -0
  25. package/assets/design-canvas/canvas-menu.js +213 -0
  26. package/assets/design-canvas/canvas-messages.js +86 -0
  27. package/assets/design-canvas/canvas-minimap.js +163 -0
  28. package/assets/design-canvas/canvas-parts.js +401 -0
  29. package/assets/design-canvas/canvas-popover.js +234 -0
  30. package/assets/design-canvas/canvas-rail.js +348 -0
  31. package/assets/design-canvas/canvas-sizes.js +524 -0
  32. package/assets/design-canvas/canvas-store.js +164 -0
  33. package/assets/design-canvas/canvas-tokens.js +674 -0
  34. package/assets/design-canvas/canvas-ui.js +24 -0
  35. package/assets/design-canvas/canvas-view.js +184 -0
  36. package/assets/design-canvas/canvas.css +759 -16
  37. package/assets/design-canvas/canvas.js +2 -1497
  38. package/assets/design-canvas/index.html +117 -36
  39. package/assets/design-canvas/inspector.js +546 -16
  40. package/assets/install-wizard/wizard.js +6 -1
  41. package/assets/migrations/agent-body-history.json +40 -1
  42. package/assets/orchestrator-delegation-reference.md +10 -16
  43. package/assets/orchestrator-delegation.md +5 -5
  44. package/assets/orchestrator-full-delegation-card.md +64 -0
  45. package/assets/orchestrator-full-delegation.md +34 -0
  46. package/assets/orchestrator-memory.md +5 -5
  47. package/assets/orchestrator-prompts.md +2 -2
  48. package/assets/orchestrator-quota-recovery.md +5 -0
  49. package/assets/orchestrator-skills.md +14 -13
  50. package/assets/orchestrator-tracking.md +10 -14
  51. package/assets/orchestrator-verification.md +12 -8
  52. package/assets/orchestrator-writer.md +4 -4
  53. package/assets/orchestrator.md +21 -25
  54. package/bin/gentle-shell.mjs +292 -65
  55. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
  56. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
  57. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
  58. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
  59. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
  60. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
  61. package/docs/agent-status.md +61 -0
  62. package/docs/assets/brand/sponsor-banner.svg +60 -0
  63. package/docs/bundled-install.md +20 -10
  64. package/docs/delegated-verification.md +46 -8
  65. package/docs/desktop-rpc.md +1253 -0
  66. package/docs/gentle-agents-activity.md +40 -0
  67. package/docs/gentle-shell.md +91 -30
  68. package/docs/install-wizard.md +30 -21
  69. package/docs/odd-preparation-continuity.md +24 -0
  70. package/docs/permission-modes.md +17 -4
  71. package/docs/prompt-budget.md +12 -0
  72. package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
  73. package/docs/readme-reference.md +142 -45
  74. package/docs/render-cache-performance.md +11 -1
  75. package/docs/review-coordinator.md +53 -0
  76. package/docs/review-delivery-preflight.md +22 -0
  77. package/docs/review-request-context.md +19 -0
  78. package/docs/review-windows-acl.md +18 -0
  79. package/docs/voice.md +6 -3
  80. package/docs/work-continuity.md +11 -1
  81. package/docs/yolo-mode.md +5 -5
  82. package/extensions/ask-user-choice.ts +1 -0
  83. package/extensions/ask-user-question.ts +3 -2
  84. package/extensions/child-context.ts +21 -7
  85. package/extensions/child-safety.ts +3 -0
  86. package/extensions/gentle-agent-status.ts +99 -0
  87. package/extensions/gentle-agents.ts +559 -66
  88. package/extensions/gentle-ai.ts +2001 -518
  89. package/extensions/gentle-design.ts +69 -3
  90. package/extensions/gentle-desktop-rpc.ts +143 -0
  91. package/extensions/gentle-guide.ts +3 -0
  92. package/extensions/gentle-shell.ts +398 -115
  93. package/extensions/gentle-todo.ts +66 -27
  94. package/extensions/gentle-tps.ts +48 -0
  95. package/extensions/quiet-tools.ts +38 -8
  96. package/extensions/skill-registry.ts +349 -167
  97. package/extensions/startup-banner.ts +30 -3
  98. package/lib/agent-assets.ts +30 -6
  99. package/lib/agent-profile-pin.ts +3 -3
  100. package/lib/agent-profiles.ts +160 -2
  101. package/lib/agent-status.ts +105 -0
  102. package/lib/agent-tool-overlay.ts +117 -0
  103. package/lib/agents-config.ts +93 -6
  104. package/lib/agents-history.ts +24 -5
  105. package/lib/agents-message-delivery.ts +17 -0
  106. package/lib/agents-messaging.ts +55 -7
  107. package/lib/agents-protocol.ts +15 -0
  108. package/lib/agents-report-cap.ts +115 -0
  109. package/lib/agents-runner.ts +272 -16
  110. package/lib/agents-session-transport.ts +17 -1
  111. package/lib/auto-permission-runtime.ts +1 -1
  112. package/lib/background-jobs-tools.ts +9 -4
  113. package/lib/bounded-writer-admission.ts +197 -32
  114. package/lib/card-content-policy.ts +8 -6
  115. package/lib/child-context-files.ts +21 -6
  116. package/lib/codemode-renderer.ts +1 -0
  117. package/lib/command-palette.ts +133 -17
  118. package/lib/context-backstop.ts +14 -5
  119. package/lib/delivery-conflict-markers.ts +349 -0
  120. package/lib/design-canvas-assets.ts +36 -0
  121. package/lib/design-canvas-server.ts +241 -23
  122. package/lib/design-comments.ts +94 -4
  123. package/lib/design-handoffs.ts +2 -1
  124. package/lib/design-layout.ts +125 -0
  125. package/lib/design-parts.ts +281 -0
  126. package/lib/design-system-tokens.ts +111 -0
  127. package/lib/desktop-agents-service.ts +294 -0
  128. package/lib/desktop-design-service.ts +233 -0
  129. package/lib/desktop-jobs-service.ts +263 -0
  130. package/lib/desktop-rpc-agents.ts +294 -0
  131. package/lib/desktop-rpc-config.ts +731 -0
  132. package/lib/desktop-rpc-design.ts +138 -0
  133. package/lib/desktop-rpc-jobs.ts +181 -0
  134. package/lib/desktop-rpc-permissions.ts +177 -0
  135. package/lib/desktop-rpc-profiles.ts +196 -0
  136. package/lib/desktop-rpc-usage.ts +229 -0
  137. package/lib/desktop-rpc.ts +225 -0
  138. package/lib/desktop-usage-service.ts +310 -0
  139. package/lib/destructive-command-guard.ts +236 -17
  140. package/lib/execution-surface-guard.ts +20 -0
  141. package/lib/exploration-budget.ts +4 -2
  142. package/lib/gentle-ai-binary.ts +1 -1
  143. package/lib/gentle-ai-renderer.ts +13 -1
  144. package/lib/gentle-design.ts +204 -14
  145. package/lib/gentle-shell-bundled.ts +106 -28
  146. package/lib/gentle-shell-launcher.ts +43 -8
  147. package/lib/herdr-activity.ts +14 -2
  148. package/lib/herdr-busy.ts +45 -0
  149. package/lib/hidden-tools.ts +35 -0
  150. package/lib/image-attachments.ts +33 -0
  151. package/lib/image-disk-cache.ts +137 -0
  152. package/lib/inprocess-reviewer.ts +358 -144
  153. package/lib/jobs-view.ts +198 -11
  154. package/lib/model-fallback-policy.ts +9 -0
  155. package/lib/model-routing-authority.ts +31 -4
  156. package/lib/nan-provider.ts +42 -28
  157. package/lib/native-choice-list.ts +20 -2
  158. package/lib/native-review-cli.ts +172 -20
  159. package/lib/orchestrator-discovery.ts +39 -2
  160. package/lib/orchestrator-mode-policy.ts +105 -0
  161. package/lib/questionnaire/questionnaire-view.ts +105 -12
  162. package/lib/rdd-mode-control.ts +32 -0
  163. package/lib/reply-language-anchor.ts +129 -0
  164. package/lib/request-context-placement.ts +53 -0
  165. package/lib/review-blocker.ts +92 -0
  166. package/lib/review-candidate-symlink-scan.ts +136 -0
  167. package/lib/review-candidate-view-owner.ts +81 -44
  168. package/lib/review-candidate-view.ts +11 -1
  169. package/lib/review-continuation-registry.ts +116 -0
  170. package/lib/review-coordinator.ts +407 -0
  171. package/lib/review-delivery-preflight.ts +85 -0
  172. package/lib/review-failure-facts.ts +49 -0
  173. package/lib/review-host-relay.ts +51 -11
  174. package/lib/review-integration-v2.ts +63 -4
  175. package/lib/review-relay-phase-timing.ts +45 -0
  176. package/lib/review-start-context.ts +17 -0
  177. package/lib/reviewer-stream.ts +87 -0
  178. package/lib/session-profile-freeze.ts +4 -2
  179. package/lib/shell-bar.ts +140 -58
  180. package/lib/shell-changes.ts +2 -0
  181. package/lib/shell-panel.ts +17 -3
  182. package/lib/shell-prompt.ts +16 -3
  183. package/lib/shell-sidebar-layout.ts +112 -40
  184. package/lib/shell-sidebar.ts +7 -0
  185. package/lib/shell-todo.ts +10 -3
  186. package/lib/shell-usage.ts +10 -0
  187. package/lib/verifier-admission.ts +1 -1
  188. package/lib/vim-editor-adapter.ts +9 -2
  189. package/lib/visual-customization-policy.ts +36 -16
  190. package/lib/visual-customize-view.ts +216 -21
  191. package/lib/visual-layout-preview.ts +9 -5
  192. package/lib/visual-profiles.ts +2 -2
  193. package/lib/windows-session-transport.ts +53 -2
  194. package/lib/writer-batch-admission.ts +55 -0
  195. package/lib/yolo-session-policy.ts +46 -16
  196. package/package.json +3 -2
  197. package/prompts/skill-creation.md +1 -10
  198. package/runtime/design-canvas-assets.mjs +37 -0
  199. package/runtime/gentle-ai-binary.mjs +1 -1
  200. package/runtime/gentle-shell-bundled.mjs +106 -28
  201. package/runtime/gentle-shell-launcher.mjs +42 -7
  202. package/runtime/native-review-cli.mjs +169 -17
  203. package/runtime/review-integration-v2.mjs +63 -4
  204. package/scripts/bootstrap.cmd +2 -2
  205. package/scripts/bootstrap.sh +41 -4
  206. package/scripts/build-full-delegation-card.mjs +179 -0
  207. package/scripts/build-runtime-modules.mjs +1 -0
  208. package/scripts/bundled-install.mjs +38 -8
  209. package/scripts/download-progress.mjs +68 -0
  210. package/scripts/gentle-ai-installer.mjs +41 -18
  211. package/scripts/gentle-ai-proxy.mjs +294 -0
  212. package/scripts/install-gentle-ai.mjs +14 -1
  213. package/scripts/installer-downloads.mjs +34 -8
  214. package/scripts/installer-preflight.mjs +33 -22
  215. package/scripts/installer-probes.mjs +25 -5
  216. package/scripts/installer-runner.mjs +27 -12
  217. package/scripts/installer-server.mjs +46 -16
  218. package/scripts/installer-windows.mjs +2 -2
  219. package/scripts/pi-update.mjs +166 -27
  220. package/scripts/prepare-verifier.mjs +107 -0
  221. package/scripts/render-cache-host.mjs +72 -0
  222. package/scripts/render-cache-performance-worker.mjs +5 -4
  223. package/scripts/render-cache-performance.mjs +6 -1
  224. package/scripts/run-test-suite.mjs +40 -28
  225. package/scripts/update-agent-body-history.mjs +55 -8
  226. package/scripts/verify-package-files.mjs +50 -19
  227. package/scripts/voice-worker.cjs +32 -6
  228. package/skills/branch-pr/SKILL.md +16 -16
  229. package/skills/comment-writer/SKILL.md +1 -1
  230. package/skills/design/SKILL.md +16 -13
  231. package/skills/gentle-ai/SKILL.md +7 -7
  232. package/skills/gentle-ui-design/SKILL.md +46 -0
  233. package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
  234. package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
  235. package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
  236. package/skills/gentle-ui-design/references/task-and-content.md +60 -0
  237. package/skills/judgment-day/SKILL.md +2 -2
  238. package/skills/judgment-day/references/prompts-and-formats.md +1 -1
  239. package/skills/rdd-defect-workflow/SKILL.md +6 -6
  240. package/skills/skill-improver/SKILL.md +2 -2
  241. package/skills/skill-registry/SKILL.md +11 -11
  242. package/skills/tui-design/SKILL.md +1 -1
  243. package/skills/work-unit-commits/SKILL.md +10 -11
  244. package/tests/agent-home.test.ts +28 -9
  245. package/tests/agent-profiles-workflow.test.ts +163 -0
  246. package/tests/agent-prompt-diet-contract.test.ts +101 -0
  247. package/tests/agent-risk-escalation.test.ts +1 -1
  248. package/tests/agent-status.test.ts +143 -0
  249. package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
  250. package/tests/agent-tool-overlay.test.ts +89 -0
  251. package/tests/agents-config.test.ts +106 -1
  252. package/tests/agents-history.test.ts +31 -0
  253. package/tests/agents-jobs-frames.test.ts +93 -0
  254. package/tests/agents-message-delivery.test.ts +36 -0
  255. package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
  256. package/tests/agents-queries.test.ts +144 -4
  257. package/tests/agents-report-cap.test.ts +126 -0
  258. package/tests/agents-runner-drain.test.ts +193 -0
  259. package/tests/agents-runner.test.ts +215 -3
  260. package/tests/agents-session-transport.test.ts +34 -0
  261. package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
  262. package/tests/append-system-prompt-route.test.ts +12 -1
  263. package/tests/approved-text-leftovers-contract.test.ts +136 -0
  264. package/tests/artifact-language.test.ts +1 -1
  265. package/tests/ask-user-choice.test.ts +4 -3
  266. package/tests/ask-user-question.test.ts +99 -1
  267. package/tests/audit-leftovers-contract.test.ts +51 -0
  268. package/tests/auto-permission-runtime.test.ts +1 -1
  269. package/tests/autonomous-guard.test.ts +346 -10
  270. package/tests/bounded-stop-contract.test.ts +51 -3
  271. package/tests/branch-pr-skill.test.ts +10 -1
  272. package/tests/bridge-cost.test.ts +19 -4
  273. package/tests/bundled-install.test.ts +31 -6
  274. package/tests/card-content-policy.test.ts +3 -3
  275. package/tests/chained-pr-skill.test.ts +8 -6
  276. package/tests/child-context-files.test.ts +64 -8
  277. package/tests/child-safety.test.ts +11 -0
  278. package/tests/child-skills-catalog.test.ts +56 -0
  279. package/tests/codegraph-tools.test.ts +11 -5
  280. package/tests/codemode-rendering.test.ts +4 -1
  281. package/tests/command-palette.test.ts +284 -1
  282. package/tests/delegate-for-reason-contract.test.ts +32 -10
  283. package/tests/delivery-conflict-markers.test.ts +348 -0
  284. package/tests/design-canvas-all-sizes.test.ts +631 -0
  285. package/tests/design-canvas-allowlist.test.ts +32 -0
  286. package/tests/design-canvas-assets.test.ts +11 -695
  287. package/tests/design-canvas-boards.test.ts +77 -0
  288. package/tests/design-canvas-checks.test.ts +655 -0
  289. package/tests/design-canvas-compare.test.ts +79 -0
  290. package/tests/design-canvas-events.test.ts +59 -0
  291. package/tests/design-canvas-export.test.ts +1168 -0
  292. package/tests/design-canvas-focus.test.ts +113 -0
  293. package/tests/design-canvas-handoffs.test.ts +59 -0
  294. package/tests/design-canvas-i18n-review.test.ts +513 -0
  295. package/tests/design-canvas-i18n-views.test.ts +259 -0
  296. package/tests/design-canvas-i18n.test.ts +526 -0
  297. package/tests/design-canvas-inspector.test.ts +937 -0
  298. package/tests/design-canvas-layout.test.ts +1222 -0
  299. package/tests/design-canvas-minimap.test.ts +413 -0
  300. package/tests/design-canvas-modules.test.ts +90 -0
  301. package/tests/design-canvas-parts.test.ts +721 -0
  302. package/tests/design-canvas-rail.test.ts +799 -0
  303. package/tests/design-canvas-server.test.ts +855 -17
  304. package/tests/design-canvas-sizes.test.ts +548 -0
  305. package/tests/design-canvas-store.test.ts +180 -0
  306. package/tests/design-canvas-tokens.test.ts +965 -0
  307. package/tests/design-canvas-view.test.ts +299 -0
  308. package/tests/design-comments.test.ts +201 -1
  309. package/tests/design-handoffs.test.ts +20 -0
  310. package/tests/design-layout.test.ts +100 -0
  311. package/tests/design-parts.test.ts +260 -0
  312. package/tests/design-system-tokens.test.ts +215 -0
  313. package/tests/desktop-rpc-agents.test.ts +893 -0
  314. package/tests/desktop-rpc-config.test.ts +1452 -0
  315. package/tests/desktop-rpc-design.test.ts +662 -0
  316. package/tests/desktop-rpc-jobs.test.ts +796 -0
  317. package/tests/desktop-rpc-permissions.test.ts +311 -0
  318. package/tests/desktop-rpc-profiles.test.ts +140 -0
  319. package/tests/desktop-rpc-safety.test.ts +119 -0
  320. package/tests/desktop-rpc-usage.test.ts +697 -0
  321. package/tests/desktop-rpc.test.ts +252 -0
  322. package/tests/destructive-command-guard.test.ts +52 -0
  323. package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
  324. package/tests/devbinary/review-session-consent.devtest.ts +84 -0
  325. package/tests/download-progress.test.ts +71 -0
  326. package/tests/engram-safety.test.ts +111 -0
  327. package/tests/execution-surface-guard.test.ts +55 -0
  328. package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
  329. package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
  330. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -31
  331. package/tests/fixtures/proxy-tls/proxy.crt +19 -0
  332. package/tests/fixtures/proxy-tls/proxy.key +28 -0
  333. package/tests/fixtures/refusal-identity.probe.mjs +139 -0
  334. package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
  335. package/tests/fixtures/session-profile-v1/replay.ts +53 -6
  336. package/tests/full-delegation-closure.test.ts +160 -0
  337. package/tests/full-delegation-notices.test.ts +76 -0
  338. package/tests/generic-agent-tools.test.ts +3 -3
  339. package/tests/gentle-agent-status.test.ts +74 -0
  340. package/tests/gentle-agents-child-jobs.test.ts +237 -0
  341. package/tests/gentle-agents.test.ts +1403 -20
  342. package/tests/gentle-ai-binary.test.ts +3 -1
  343. package/tests/gentle-ai-child-guards.test.ts +1 -0
  344. package/tests/gentle-ai-elapsed-store.test.ts +19 -0
  345. package/tests/gentle-ai-exploration-budget.test.ts +18 -2
  346. package/tests/gentle-ai-installer.test.ts +135 -51
  347. package/tests/gentle-ai-proxy.test.ts +434 -0
  348. package/tests/gentle-ai-renderer.test.ts +36 -2
  349. package/tests/gentle-ai.test.ts +233 -43
  350. package/tests/gentle-design.test.ts +386 -1
  351. package/tests/gentle-herdr-activity.test.ts +9 -6
  352. package/tests/gentle-shell-bin.test.ts +123 -0
  353. package/tests/gentle-shell-bundled.test.ts +293 -31
  354. package/tests/gentle-shell-launcher.test.ts +78 -11
  355. package/tests/gentle-shell.test.ts +1017 -146
  356. package/tests/gentle-todo.test.ts +51 -11
  357. package/tests/gentle-tps.test.ts +123 -0
  358. package/tests/gentle-ui-design-skill.test.ts +59 -0
  359. package/tests/herdr-busy.test.ts +59 -0
  360. package/tests/herdr-task-summary-policy.test.ts +8 -4
  361. package/tests/hidden-tools.test.ts +188 -0
  362. package/tests/image-disk-cache.test.ts +163 -0
  363. package/tests/independent-recovery-delivery.test.ts +97 -0
  364. package/tests/inprocess-reviewer.test.ts +249 -4
  365. package/tests/install-wizard.test.ts +27 -1
  366. package/tests/installer-downloads.test.ts +30 -1
  367. package/tests/installer-posix-bootstrap.test.ts +115 -14
  368. package/tests/installer-preflight.test.ts +54 -5
  369. package/tests/installer-probes.test.ts +146 -0
  370. package/tests/installer-runner.test.ts +79 -44
  371. package/tests/installer-server.test.ts +215 -13
  372. package/tests/installer-windows-bootstrap.test.ts +19 -1
  373. package/tests/jobs-view.test.ts +260 -6
  374. package/tests/judgment-day-severity-admission.test.ts +46 -0
  375. package/tests/lazy-module-contradictions-contract.test.ts +158 -0
  376. package/tests/maintainer/desktop-rpc.maintest.ts +632 -0
  377. package/tests/maintainer/pi-update-source.maintest.ts +48 -18
  378. package/tests/modal-mouse-boundaries.test.ts +136 -0
  379. package/tests/model-fallback-policy.test.ts +26 -7
  380. package/tests/model-routing-authority.test.ts +178 -2
  381. package/tests/nan-provider-runtime.test.ts +17 -3
  382. package/tests/nan-provider.test.ts +111 -56
  383. package/tests/native-choice-list.test.ts +77 -2
  384. package/tests/native-review-capability-contract.test.ts +17 -1
  385. package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
  386. package/tests/native-review-cli.test.ts +269 -1
  387. package/tests/native-review-parity.test.ts +24 -5
  388. package/tests/native-review-refusal-identity.test.ts +25 -0
  389. package/tests/no-self-pause-contract.test.ts +13 -2
  390. package/tests/odd-integration.test.ts +11 -3
  391. package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
  392. package/tests/odd-routing-contract.test.ts +80 -28
  393. package/tests/orchestrator-budget.test.ts +35 -5
  394. package/tests/orchestrator-consultation-sdk.test.ts +32 -6
  395. package/tests/orchestrator-delegation-mode.test.ts +154 -0
  396. package/tests/orchestrator-discovery.test.ts +28 -0
  397. package/tests/orchestrator-mode-policy.test.ts +175 -0
  398. package/tests/orchestrator-prompt-budget.test.ts +13 -2
  399. package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
  400. package/tests/orchestrator-rdd-ownership.test.ts +4 -3
  401. package/tests/orchestrator-work-search.test.ts +4 -2
  402. package/tests/package-files.test.ts +25 -1
  403. package/tests/package-manifest.test.ts +16 -13
  404. package/tests/parallel-reason-contract.test.ts +6 -3
  405. package/tests/permission-allowlist.test.ts +372 -0
  406. package/tests/persona-neutral-voseo.test.ts +4 -4
  407. package/tests/persona-reply-language.test.ts +1 -1
  408. package/tests/persona-single-channel.test.ts +13 -5
  409. package/tests/pi-update-launcher.test.ts +25 -7
  410. package/tests/pi-update-source.test.ts +113 -6
  411. package/tests/pi-update.test.ts +294 -19
  412. package/tests/pnpm-workspace-config.test.ts +58 -0
  413. package/tests/pnpm-workspace-policy.test.ts +47 -0
  414. package/tests/primary-context-files.test.ts +233 -0
  415. package/tests/primary-context-three-files.test.ts +174 -0
  416. package/tests/primary-session-prompt.test.ts +13 -0
  417. package/tests/profile-pin.test.ts +29 -2
  418. package/tests/profile-tier-footer.test.ts +5 -0
  419. package/tests/profiles-panel-delegation-mode.test.ts +422 -0
  420. package/tests/provider-defect-handoff.test.ts +9 -2
  421. package/tests/questionnaire-view.test.ts +115 -0
  422. package/tests/quiet-bash-runtime.test.ts +1 -1
  423. package/tests/quiet-tool-rendering.test.ts +48 -0
  424. package/tests/rdd-aware-verification-contract.test.ts +17 -12
  425. package/tests/rdd-customize.test.ts +287 -0
  426. package/tests/rdd-mode-cache.test.ts +450 -0
  427. package/tests/rdd-mode-control.test.ts +407 -0
  428. package/tests/rdd-mode-scope-regression.test.ts +137 -0
  429. package/tests/rdd-off-independent-regression.test.ts +69 -0
  430. package/tests/rdd-status-line.test.ts +112 -1
  431. package/tests/render-cache-performance.test.ts +171 -2
  432. package/tests/reply-language-anchor-placement.test.ts +184 -0
  433. package/tests/reply-language-anchor.test.ts +189 -0
  434. package/tests/request-context-append-only.test.ts +218 -0
  435. package/tests/request-context-placement.test.ts +148 -0
  436. package/tests/review-agent-end-preflight.test.ts +80 -2
  437. package/tests/review-blocker.test.ts +193 -0
  438. package/tests/review-candidate-owner-retry.test.ts +1 -1
  439. package/tests/review-candidate-symlink-scan.test.ts +157 -0
  440. package/tests/review-candidate-view.test.ts +66 -1
  441. package/tests/review-candidate-windows-boundary.test.ts +131 -0
  442. package/tests/review-candidate-windows-probe.test.ts +63 -0
  443. package/tests/review-committed-restart-ack.test.ts +129 -0
  444. package/tests/review-continuation-registry.test.ts +107 -0
  445. package/tests/review-contract-prompt.test.ts +1 -1
  446. package/tests/review-controller-native-routing.test.ts +261 -5
  447. package/tests/review-controller-workspace-root.test.ts +230 -3
  448. package/tests/review-controller.test.ts +98 -12
  449. package/tests/review-coordinator-correction-gate.test.ts +105 -0
  450. package/tests/review-coordinator-findings.test.ts +206 -0
  451. package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
  452. package/tests/review-coordinator-runtime.test.ts +117 -0
  453. package/tests/review-coordinator.test.ts +462 -0
  454. package/tests/review-delivery-preflight.test.ts +462 -0
  455. package/tests/review-due-compaction.test.ts +31 -0
  456. package/tests/review-due-public-boundary.test.ts +26 -0
  457. package/tests/review-failure-facts.test.ts +87 -0
  458. package/tests/review-host-relay-routing.test.ts +258 -4
  459. package/tests/review-host-relay.test.ts +39 -0
  460. package/tests/review-integration-nonblocking-findings.test.ts +108 -0
  461. package/tests/review-integration-v2.test.ts +46 -3
  462. package/tests/review-json-arguments.test.ts +105 -11
  463. package/tests/review-last-event-closure.test.ts +68 -0
  464. package/tests/review-ledger-contract.test.ts +19 -40
  465. package/tests/review-loadout-rdd-off-sdk.test.ts +95 -32
  466. package/tests/review-one-call-findings.test.ts +131 -0
  467. package/tests/review-one-call-followups.test.ts +308 -0
  468. package/tests/review-one-call-reviewer-requests.test.ts +207 -0
  469. package/tests/review-one-call.test.ts +452 -0
  470. package/tests/review-owner-identity.test.ts +60 -24
  471. package/tests/review-relay-phase-timing.test.ts +128 -0
  472. package/tests/review-relay-transport-agent.test.ts +39 -2
  473. package/tests/review-reviewer-evidence.test.ts +223 -0
  474. package/tests/review-risk-assessment.test.ts +126 -8
  475. package/tests/review-run-statement-guidance-independent.test.ts +54 -0
  476. package/tests/review-session-standing-permission-controller.test.ts +53 -3
  477. package/tests/review-start-context.test.ts +19 -0
  478. package/tests/review-tool-prose-budget.test.ts +122 -0
  479. package/tests/reviewer-stream.test.ts +149 -0
  480. package/tests/run-test-suite.test.ts +122 -1
  481. package/tests/runtime-harness.mjs +4 -1
  482. package/tests/sensitive-path-tools.test.ts +181 -5
  483. package/tests/session-profile-append-controller-pi.test.ts +60 -31
  484. package/tests/session-profile-binding.test.ts +19 -1
  485. package/tests/session-profile-disk-reader-pi.test.ts +58 -16
  486. package/tests/session-profile-extension.test.ts +2 -2
  487. package/tests/session-profile-v1-compat.test.ts +35 -1
  488. package/tests/shell-bar.test.ts +186 -42
  489. package/tests/shell-panel.test.ts +50 -22
  490. package/tests/shell-prompt.test.ts +17 -0
  491. package/tests/shell-sidebar-fullscreen.test.ts +5 -5
  492. package/tests/shell-sidebar-layout.test.ts +294 -23
  493. package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
  494. package/tests/shell-surface-transparent.test.ts +89 -0
  495. package/tests/shell-todo.test.ts +12 -0
  496. package/tests/shell-usage.test.ts +59 -10
  497. package/tests/skill-contradictions-contract.test.ts +122 -0
  498. package/tests/skill-registry-watcher.test.ts +216 -2
  499. package/tests/skill-registry.test.ts +1461 -5
  500. package/tests/startup-banner.test.ts +152 -1
  501. package/tests/startup-home-repo.test.ts +2 -0
  502. package/tests/support/design-canvas-dom.ts +369 -0
  503. package/tests/support/review-coordinator-runtime.ts +264 -0
  504. package/tests/task-size-routing-contract.test.ts +45 -12
  505. package/tests/test-strength-contract.test.ts +2 -1
  506. package/tests/todo-request-append-only.test.ts +214 -0
  507. package/tests/tool-batching-contract.test.ts +3 -1
  508. package/tests/update-agent-body-history.test.ts +138 -0
  509. package/tests/verification-tiers-contract.test.ts +229 -0
  510. package/tests/verifier-admission.test.ts +49 -0
  511. package/tests/verifier-preparation.test.ts +229 -0
  512. package/tests/verify-agent-contract.test.ts +20 -2
  513. package/tests/verify-first-launch-contract.test.ts +162 -11
  514. package/tests/vim-editor-adapter.test.ts +2 -2
  515. package/tests/visual-customization-policy.test.ts +39 -6
  516. package/tests/visual-customize-view.test.ts +573 -9
  517. package/tests/visual-layout-preview.test.ts +15 -1
  518. package/tests/visual-profiles.test.ts +11 -0
  519. package/tests/voice-worker.test.ts +73 -2
  520. package/tests/windows-session-transport.test.ts +126 -0
  521. package/tests/work-continuity-contract.test.ts +77 -6
  522. package/tests/writer-admission-messages.test.ts +232 -0
  523. package/tests/writer-batch-admission.test.ts +66 -0
  524. package/tests/writer-edit-surface-scope.test.ts +52 -20
  525. package/tests/writer-feature-document-admission.test.ts +276 -0
  526. package/tests/yolo-customize.test.ts +27 -4
  527. package/tests/yolo-mode.test.ts +62 -18
  528. package/tests/yolo-session-policy.test.ts +270 -1
  529. package/skills/_shared/review-ledger-contract.md +0 -106
  530. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/README.md +0 -0
  531. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
  532. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
  533. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  534. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
  535. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
  536. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
@@ -14,8 +14,9 @@ function block(name: string, body: string): string {
14
14
  }
15
15
 
16
16
  // Synthetic file shaped like a gentle-ai managed AGENTS.md: unmanaged project
17
- // text, kept blocks, orchestrator-only blocks, a nested kept block inside
18
- // agent-routing, and a nested orchestrator-only block inside sdd-orchestrator.
17
+ // text, kept blocks, orchestrator-only blocks, the engram-protocol block, a
18
+ // nested kept block inside agent-routing, and a nested orchestrator-only block
19
+ // inside sdd-orchestrator.
19
20
  const REALISTIC_AGENTS_MD = [
20
21
  "# Project conventions",
21
22
  "",
@@ -56,8 +57,6 @@ const EXPECTED_REALISTIC = [
56
57
  "",
57
58
  block("codegraph-guidance", "## CodeGraph\n\nUse CodeGraph first."),
58
59
  "",
59
- block("engram-protocol", "## Engram\n\nSave decisions."),
60
- "",
61
60
  block("remote-authorization", "## Remote operation authorization\n\nAsk before remote work."),
62
61
  "",
63
62
  "## Local notes",
@@ -80,17 +79,24 @@ test("filters a realistic managed AGENTS.md: nested kept blocks survive, nested
80
79
  const output = stripOrchestratorOnlyBlocks(REALISTIC_AGENTS_MD);
81
80
  assert.equal(output, EXPECTED_REALISTIC);
82
81
  assert.doesNotMatch(output, /COORDINATOR|sdd-model-assignments|Implementation Routing|4-file rule/);
82
+ assert.doesNotMatch(output, /gentle-ai:engram-protocol/);
83
83
  assert.match(output, /<!-- gentle-ai:remote-authorization -->\n## Remote operation authorization/);
84
84
  });
85
85
 
86
- test("keeps codegraph-guidance, engram-protocol, and unknown managed blocks byte-for-byte", () => {
87
- const input = [
86
+ test("drops engram-protocol while codegraph-guidance and unknown managed blocks stay byte-for-byte", () => {
87
+ const kept = [
88
+ block("codegraph-guidance", "cg"),
89
+ block("some-future-block", "future"),
90
+ "",
91
+ ].join("\n");
92
+ assert.equal(stripOrchestratorOnlyBlocks(kept), kept);
93
+ const withEngram = [
88
94
  block("codegraph-guidance", "cg"),
89
95
  block("engram-protocol", "engram\n\n\n\nspacing kept"),
90
96
  block("some-future-block", "future"),
91
97
  "",
92
98
  ].join("\n");
93
- assert.equal(stripOrchestratorOnlyBlocks(input), input);
99
+ assert.equal(stripOrchestratorOnlyBlocks(withEngram), kept);
94
100
  });
95
101
 
96
102
  test("unmanaged text before, between, and after removed blocks is preserved byte-for-byte", () => {
@@ -172,7 +178,7 @@ test("filterChildContextFiles returns filtered copies, never mutates inputs, and
172
178
  assert.equal(result.files[1].content, "# Plain\n");
173
179
  assert.equal(result.files[2].content, files[2].content);
174
180
  assert.equal(files[0].content, REALISTIC_AGENTS_MD);
175
- assert.equal(result.removedBlocks, 3, "sdd-orchestrator, its nested sdd-model-assignments, and agent-routing");
181
+ assert.equal(result.removedBlocks, 4, "sdd-orchestrator, its nested sdd-model-assignments, agent-routing, and engram-protocol");
176
182
  assert.equal(result.removedBytes, Buffer.byteLength(REALISTIC_AGENTS_MD) - Buffer.byteLength(EXPECTED_REALISTIC));
177
183
  assert.deepEqual(result.failSafePaths, ["/repo/sub/AGENTS.md"]);
178
184
  });
@@ -243,6 +249,56 @@ for (const scenario of ["child", "primary"] as const) {
243
249
  });
244
250
  }
245
251
 
252
+ // The engram-protocol block is dropped from every injected context file, at any
253
+ // depth: the file on disk keeps it for runtimes that read it as a workspace
254
+ // file, and gentle-engram injects its own protocol every turn.
255
+ const PROJECT_WITH_ENGRAM = `# Plain\n\n${block("engram-protocol", "project engram")}\n`;
256
+ const PROJECT_WITHOUT_ENGRAM = "# Plain\n";
257
+
258
+ async function runChildStart(env: NodeJS.ProcessEnv, project: string) {
259
+ const { handlers } = childContextHandlers(env);
260
+ const contextFiles = [
261
+ { path: "/work/AGENTS.md", content: REALISTIC_AGENTS_MD },
262
+ { path: "/work/repo/AGENTS.md", content: project },
263
+ ];
264
+ const systemPromptOptions = { appendSystemPrompt: "", contextFiles };
265
+ const event = { systemPrompt: "base", systemPromptOptions };
266
+ const handler = handlers.get("before_agent_start")!;
267
+ await handler(event, { cwd: "/work/repo" });
268
+ return { contextFiles, systemPromptOptions, rerun: () => handler(event, { cwd: "/work/repo" }) };
269
+ }
270
+
271
+ test("a child drops the engram-protocol block from every loaded file, at any depth", async () => {
272
+ const { contextFiles, systemPromptOptions, rerun } = await runChildStart({ GENTLE_PI_AGENTS_CHILD: "1" }, PROJECT_WITH_ENGRAM);
273
+ assert.deepEqual(systemPromptOptions.contextFiles.map((file) => file.content), [EXPECTED_REALISTIC, PROJECT_WITHOUT_ENGRAM]);
274
+ assert.match(systemPromptOptions.contextFiles[0].content, /<!-- gentle-ai:remote-authorization -->\n## Remote operation authorization/);
275
+ assert.equal(contextFiles[0].content, REALISTIC_AGENTS_MD, "the loaded entries are never mutated");
276
+ assert.equal(contextFiles[1].content, PROJECT_WITH_ENGRAM, "the loaded entries are never mutated");
277
+ const filtered = systemPromptOptions.contextFiles;
278
+ await rerun();
279
+ assert.equal(systemPromptOptions.contextFiles, filtered, "a repeated turn removes nothing more");
280
+ });
281
+
282
+ test("a child with no engram-protocol block anywhere still loses nothing else", async () => {
283
+ const { systemPromptOptions } = await runChildStart({ GENTLE_PI_AGENTS_CHILD: "1" }, PROJECT_WITHOUT_ENGRAM);
284
+ assert.deepEqual(systemPromptOptions.contextFiles.map((file) => file.content), [EXPECTED_REALISTIC, PROJECT_WITHOUT_ENGRAM]);
285
+ });
286
+
287
+ test("filterChildContextFiles drops engram-protocol from files at the same level", () => {
288
+ const result = filterChildContextFiles([
289
+ { path: "/work/repo/AGENTS.md", content: PROJECT_WITH_ENGRAM },
290
+ { path: "/work/repo/CLAUDE.md", content: PROJECT_WITH_ENGRAM },
291
+ ]);
292
+ assert.deepEqual(result.files.map((file) => file.content), [PROJECT_WITHOUT_ENGRAM, PROJECT_WITHOUT_ENGRAM]);
293
+ assert.equal(result.removedBlocks, 2);
294
+ });
295
+
296
+ test("outside a child session the child-context extension leaves context files untouched", async () => {
297
+ const { contextFiles, systemPromptOptions } = await runChildStart({ GENTLE_PI_AGENTS_CHILD: "0" }, PROJECT_WITH_ENGRAM);
298
+ assert.equal(systemPromptOptions.contextFiles, contextFiles);
299
+ assert.deepEqual(systemPromptOptions.contextFiles.map((file) => file.content), [REALISTIC_AGENTS_MD, PROJECT_WITH_ENGRAM]);
300
+ });
301
+
246
302
  test("the child-context extension never throws on missing or malformed options", async () => {
247
303
  const { handlers } = childContextHandlers({ GENTLE_PI_AGENTS_CHILD: "1" });
248
304
  const handler = handlers.get("before_agent_start")!;
@@ -131,3 +131,14 @@ test("children block recognized destructive commands sent to monitor too", async
131
131
  const result = await h.handlers[0]({ toolName: "monitor", input: { command: "echo ok && rm -rf ./data" } }, context(async () => { throw new Error("child must never prompt"); }));
132
132
  assert.equal((result as { block?: boolean })?.block, true);
133
133
  });
134
+
135
+ test("child safety blocks an external pane fallback by its input property (gentle-shell#379)", async () => {
136
+ const h = harness(true);
137
+ const ctx = context(async () => { throw new Error("child must never prompt"); }, false);
138
+ const pane = { toolName: "synthetic_surface", input: { action: "send", cwd: "/tmp/other-repo", openProjectPaneIfMissing: true } } as unknown as ReturnType<typeof event>;
139
+ const result = await h.handlers[0](pane, ctx) as { block?: boolean; reason?: string };
140
+ assert.equal(result?.block, true);
141
+ assert.match(result?.reason ?? "", /code=gentle-ai\.execution-surface\.external-fallback-prohibited/);
142
+ assert.equal(await h.handlers[0]({ toolName: "synthetic_surface", input: { action: "send" } } as unknown as ReturnType<typeof event>, ctx), undefined);
143
+ assert.equal(await h.handlers[0](event("pnpm test"), ctx), undefined);
144
+ });
@@ -0,0 +1,56 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
4
+ import { createChildContextExtension } from "../extensions/child-context.ts";
5
+ import { CHILD_SKILLS_CATALOG_ENV } from "../lib/agents-runner.ts";
6
+
7
+ // The runner marks the children of gentle-ai-worker, gentle-ai-explore and
8
+ // gentle-ai-verify: their parent injects exact skill paths, so the hook empties
9
+ // Pi's skills list and the `<available_skills>` section is never sent.
10
+ type BeforeAgentStart = (event: unknown, ctx: unknown) => unknown;
11
+
12
+ function beforeAgentStart(env: NodeJS.ProcessEnv): BeforeAgentStart {
13
+ let handler: BeforeAgentStart | undefined;
14
+ const pi = { on(name: string, fn: BeforeAgentStart) { if (name === "before_agent_start") handler = fn; } } as unknown as ExtensionAPI;
15
+ createChildContextExtension(env)(pi);
16
+ return handler!;
17
+ }
18
+
19
+ function event() {
20
+ const skills = [{ name: "gentle-ai", filePath: "/pkg/skills/gentle-ai/SKILL.md" }, { name: "user-skill", filePath: "/home/u/.agents/skills/user-skill/SKILL.md" }];
21
+ const contextFiles = [{ path: "/repo/AGENTS.md", content: "# Plain\n" }];
22
+ return { systemPrompt: "base", systemPromptOptions: { appendSystemPrompt: "", contextFiles, skills } };
23
+ }
24
+
25
+ for (const agent of ["gentle-ai-worker", "gentle-ai-explore", "gentle-ai-verify"]) {
26
+ test(`a marked ${agent} child sends no skills catalog`, async () => {
27
+ const handler = beforeAgentStart({ GENTLE_PI_AGENTS_CHILD: "1", [CHILD_SKILLS_CATALOG_ENV]: "1" });
28
+ const e = event();
29
+ const skills = e.systemPromptOptions.skills;
30
+ assert.equal(await handler(e, {}), undefined);
31
+ assert.equal(e.systemPromptOptions.skills, skills, "the same list is emptied in place");
32
+ assert.deepEqual(e.systemPromptOptions.skills, []);
33
+ assert.deepEqual(e.systemPromptOptions.contextFiles.map(file => file.content), ["# Plain\n"], "context files are untouched");
34
+ });
35
+ }
36
+
37
+ test("an unmarked child (any other agent) keeps its skills catalog", async () => {
38
+ const e = event();
39
+ await beforeAgentStart({ GENTLE_PI_AGENTS_CHILD: "1" })(e, {});
40
+ assert.deepEqual(e.systemPromptOptions.skills.map(skill => skill.name), ["gentle-ai", "user-skill"]);
41
+ });
42
+
43
+ test("a primary session keeps its skills catalog even with a stray marker", async () => {
44
+ for (const env of [{ [CHILD_SKILLS_CATALOG_ENV]: "1" }, { GENTLE_PI_AGENTS_CHILD: "0", [CHILD_SKILLS_CATALOG_ENV]: "1" }]) {
45
+ const e = event();
46
+ await beforeAgentStart(env)(e, {});
47
+ assert.deepEqual(e.systemPromptOptions.skills.map(skill => skill.name), ["gentle-ai", "user-skill"]);
48
+ }
49
+ });
50
+
51
+ test("the skills hook never throws on missing or malformed options", async () => {
52
+ const handler = beforeAgentStart({ GENTLE_PI_AGENTS_CHILD: "1", [CHILD_SKILLS_CATALOG_ENV]: "1" });
53
+ for (const e of [undefined, {}, { systemPromptOptions: null }, { systemPromptOptions: { skills: "x" } }]) {
54
+ await assert.doesNotReject(async () => handler(e, {}));
55
+ }
56
+ });
@@ -117,11 +117,17 @@ test("CodeGraph query timeout is reported distinctly from user abort and never b
117
117
  });
118
118
 
119
119
  const bounded = createCodeGraphTool(hanging, { queryTimeoutMs: 20 });
120
- for (const parameters of [{ operation: "query", query: "x" }, { operation: "explore", query: "x" }] as const) {
121
- const result = await bounded.execute("test", parameters, undefined, undefined, ctx);
122
- assert.match(result.content[0].text, /CodeGraph timed out after 20 ms/);
123
- assert.match(result.content[0].text, /Use read, grep, and find/);
124
- assert.equal((result.details as { status: string }).status, "failed");
120
+ // AbortSignal.timeout is unref'd; on Node 22 nothing else keeps the loop alive while the hanging runner awaits it.
121
+ const keepalive = setTimeout(() => {}, 2000);
122
+ try {
123
+ for (const parameters of [{ operation: "query", query: "x" }, { operation: "explore", query: "x" }] as const) {
124
+ const result = await bounded.execute("test", parameters, undefined, undefined, ctx);
125
+ assert.match(result.content[0].text, /CodeGraph timed out after 20 ms/);
126
+ assert.match(result.content[0].text, /Use read, grep, and find/);
127
+ assert.equal((result.details as { status: string }).status, "failed");
128
+ }
129
+ } finally {
130
+ clearTimeout(keepalive);
125
131
  }
126
132
 
127
133
  // A user cancellation is not a timeout.
@@ -46,7 +46,10 @@ function context(overrides: Partial<ToolRenderContext> = {}): ToolRenderContext
46
46
  args: { code: "await tools.read({path: '/private/argument'});" },
47
47
  toolCallId: "code-1", invalidate() {}, lastComponent: undefined, state: {}, cwd: "/fixture",
48
48
  executionStarted: true, argsComplete: true, isPartial: false, expanded: false, showImages: false,
49
- isError: false, durationMs: undefined, outputPad: 0, ...overrides,
49
+ isError: false, durationMs: undefined, outputPad: 0,
50
+ // Pi 1.5 adds required key-hint helpers to the render context; Pi 1.4 ignores them.
51
+ keyText: (_keybinding: string) => "", keyHint: (_keybinding: string, description: string) => description,
52
+ ...overrides,
50
53
  };
51
54
  return fixture;
52
55
  }
@@ -1,7 +1,8 @@
1
1
  import assert from "node:assert/strict";
2
2
  import test from "node:test";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
- import { visibleWidth } from "@earendil-works/pi-tui";
4
+ import { TuiAltScreen, visibleWidth, type Terminal, type TuiMouseEvent } from "@earendil-works/pi-tui";
5
+ import { getThemeByName } from "../node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js";
5
6
  import { CommandPalette, commandsKey, rankPaletteGroups, type CommandPaletteGroup, type CommandPaletteItem, type CommandPaletteResult, type CommandPaletteTheme } from "../lib/command-palette.ts";
6
7
  import { buildCommandPaletteGroups, COMMAND_PALETTE_CATALOG } from "../lib/command-palette-catalog.ts";
7
8
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
@@ -351,6 +352,288 @@ test("a small terminal still renders at least the minimum 12-line card", () => {
351
352
  assert.ok(lines.length <= 12, `expected at most 12 total lines for a tiny terminal, got ${lines.length}`);
352
353
  });
353
354
 
355
+ // --- fullscreen pointer interaction ------------------------------------------
356
+
357
+ function point(frame: string[], text: string): { x: number; y: number } {
358
+ const y = frame.findIndex((line) => line.includes(text));
359
+ assert.ok(y >= 0, `missing ${JSON.stringify(text)} in rendered frame`);
360
+ const line = frame[y]!;
361
+ return { x: visibleWidth(line.slice(0, line.indexOf(text))), y };
362
+ }
363
+
364
+ function mouse(frame: string[], x: number, y: number, type: TuiMouseEvent["type"] = "click", button: TuiMouseEvent["button"] = "left"): TuiMouseEvent {
365
+ return { type, button, x, y, screenX: x + 10, screenY: y + 5, width: visibleWidth(frame[0]!), height: frame.length, shift: false, alt: false, ctrl: false };
366
+ }
367
+
368
+ function at(frame: string[], text: string, type: TuiMouseEvent["type"] = "click", button: TuiMouseEvent["button"] = "left"): TuiMouseEvent {
369
+ const { x, y } = point(frame, text);
370
+ return mouse(frame, x, y, type, button);
371
+ }
372
+
373
+ const pointerTheme: CommandPaletteTheme = {
374
+ fg: (role, text) => role === "warning" ? `\x1b[33m${text}\x1b[39m` : text,
375
+ bg: (_role, text) => `\x1b[44m${text}\x1b[49m`,
376
+ };
377
+
378
+ test("visible command rows use primary click; headings, blanks, borders and other buttons do not run", () => {
379
+ const { palette, results } = createPalette(GROUPS);
380
+ const frame = palette.render(80);
381
+ for (const event of [
382
+ at(frame, "Configuration"), at(frame, "Session"), mouse(frame, 5, 3),
383
+ mouse(frame, 0, point(frame, "Agent-model profiles").y),
384
+ mouse(frame, 79, point(frame, "Agent-model profiles").y),
385
+ at(frame, "Agent-model profiles", "click", "right"),
386
+ at(frame, "Agent-model profiles", "click", "middle"),
387
+ ]) palette.handleMouse(event);
388
+ assert.deepEqual(results, []);
389
+ assert.equal(palette.handleMouse(at(frame, "Agent-model profiles", "press"))?.handled, true);
390
+ assert.deepEqual(results, [], "press alone cannot run a command");
391
+ assert.equal(palette.handleMouse(at(frame, "Agent-model profiles"))?.handled, true);
392
+ assert.deepEqual(results, [{ type: "run", name: "gentle:profiles" }]);
393
+ palette.handleMouse(at(frame, "Assign models and effort"));
394
+ assert.deepEqual(results, [{ type: "run", name: "gentle:profiles" }], "completion is once only");
395
+ });
396
+
397
+ test("hover paints only the visible row with the shared warning role, without selecting it", () => {
398
+ const { palette, results } = createPalette(GROUPS, pointerTheme);
399
+ let frame = palette.render(80);
400
+ const motion = at(frame, "Agent-model profiles", "move", "none");
401
+ const hoverResult = palette.handleMouse(motion);
402
+ assert.equal(hoverResult?.render, true);
403
+ assert.equal(hoverResult?.focus, undefined, "hover cannot request focus");
404
+ frame = palette.render(80);
405
+ const hovered = frame.find((line) => line.includes("Agent-model profiles"))!;
406
+ assert.match(hovered, /\x1b\[33m/);
407
+ assert.doesNotMatch(frame.find((line) => line.includes("Assign models and effort"))!, /\x1b\[33m/);
408
+ assert.deepEqual(results, []);
409
+ assert.equal(palette.handleMouse(motion)?.render, false, "repeated motion does not redraw");
410
+ assert.equal(palette.handleMouse(at(frame, "Configuration", "move", "none"))?.render, true);
411
+ frame = palette.render(80);
412
+ assert.doesNotMatch(frame.find((line) => line.includes("Agent-model profiles"))!, /\x1b\[33m/);
413
+ palette.handleInput(KEY.ENTER);
414
+ assert.deepEqual(results, [{ type: "run", name: "gentle:models" }], "hover never changes keyboard selection");
415
+ });
416
+
417
+ test("hover retains the selected background and uses the warning role for the hovered label and shortcut", () => {
418
+ const { palette } = createPalette(GROUPS, pointerTheme);
419
+ palette.handleInput(KEY.DOWN);
420
+ palette.handleInput(KEY.DOWN);
421
+ let frame = palette.render(80);
422
+ palette.handleMouse(at(frame, "Browse changes", "move", "none"));
423
+ frame = palette.render(80);
424
+ const selected = frame.find((line) => line.includes("Browse changes"))!;
425
+ assert.match(selected, /\x1b\[44m/);
426
+ assert.match(selected, /\x1b\[33m[^\x1b]*Browse changes[^\x1b]*alt\+g/);
427
+ });
428
+
429
+ test("filtering rejects stale hit geometry and runs the newly rendered matching command", () => {
430
+ const { palette, results } = createPalette(GROUPS);
431
+ let frame = palette.render(80);
432
+ const stale = at(frame, "Agent-model profiles");
433
+ type(palette, "changes");
434
+ palette.handleMouse(stale);
435
+ assert.deepEqual(results, []);
436
+ frame = palette.render(80);
437
+ assert.doesNotMatch(frame.join("\n"), /Agent-model profiles|Configuration/);
438
+ palette.handleMouse(at(frame, "Browse changes"));
439
+ assert.deepEqual(results, [{ type: "run", name: "gentle:changes" }]);
440
+ });
441
+
442
+ test("geometry and item identity are invalidated by resize, data changes, invalidate and dispose", () => {
443
+ let height = 24;
444
+ const groups: CommandPaletteGroup[] = [{ title: "Group", items: [{ command: "safe", label: "Safe command" }] }];
445
+ const { palette, results } = createPalette(groups, pointerTheme, () => height);
446
+ let frame = palette.render(80);
447
+ const original = at(frame, "Safe command");
448
+ height = 20;
449
+ palette.handleMouse(original);
450
+ height = 24;
451
+ frame = palette.render(80);
452
+ palette.handleMouse({ ...at(frame, "Safe command"), width: 79 });
453
+ frame = palette.render(80);
454
+ groups[0]!.items[0]!.command = "changed";
455
+ palette.handleMouse(at(frame, "Safe command"));
456
+ assert.deepEqual(results, [], "a stale frame cannot target changed content or dimensions");
457
+ groups[0]!.items[0]!.command = "safe";
458
+ frame = palette.render(80);
459
+ palette.handleMouse(at(frame, "Safe command", "move", "none"));
460
+ palette.invalidate();
461
+ palette.handleMouse(at(frame, "Safe command"));
462
+ assert.deepEqual(results, []);
463
+ frame = palette.render(80);
464
+ assert.doesNotMatch(frame.join("\n"), /\x1b\[33m/, "invalidation clears hover");
465
+ palette.dispose();
466
+ palette.handleMouse(at(frame, "Safe command"));
467
+ palette.handleInput(KEY.ENTER);
468
+ assert.deepEqual(results, [], "disposed palettes cannot act");
469
+ });
470
+
471
+ test("resize clears hover and clipped or empty command rows cannot be activated", () => {
472
+ const groups: CommandPaletteGroup[] = [{ title: "Group", items: [
473
+ { command: "first", label: "First" },
474
+ { command: "long", label: "A long command name that cannot fit" },
475
+ { command: "empty", label: "" },
476
+ ] }];
477
+ const { palette, results } = createPalette(groups, pointerTheme, () => 24);
478
+ let frame = palette.render(80);
479
+ palette.handleMouse(at(frame, "First", "move", "none"));
480
+ frame = palette.render(20);
481
+ assert.doesNotMatch(frame.join("\n"), /\x1b\[33m/, "a new width clears hover");
482
+ const clippedY = frame.findIndex((line) => line.includes("A long comm"));
483
+ assert.ok(clippedY >= 0);
484
+ palette.handleMouse(mouse(frame, 4, clippedY));
485
+ palette.handleMouse(mouse(frame, 4, clippedY + 1));
486
+ assert.deepEqual(results, [], "clipped and blank entries are not actionable");
487
+ palette.handleMouse(at(frame, "First"));
488
+ assert.deepEqual(results, [{ type: "run", name: "first" }]);
489
+ });
490
+
491
+ test("wheel reaches scrolled commands and keeps keyboard navigation working", () => {
492
+ const groups: CommandPaletteGroup[] = [{ title: "Many", items: Array.from({ length: 20 }, (_, i) => ({ command: `cmd:${i}`, label: `Item ${String(i).padStart(2, "0")}` })) }];
493
+ const { palette, results } = createPalette(groups, undefined, () => 16);
494
+ let frame = palette.render(80);
495
+ assert.doesNotMatch(frame.join("\n"), /Item 19/);
496
+ for (let i = 0; i < 19; i++) {
497
+ const event = { ...mouse(frame, 4, 4, "wheel", "none"), wheelDelta: 1 };
498
+ assert.equal(palette.handleMouse(event)?.handled, true);
499
+ frame = palette.render(80);
500
+ }
501
+ assert.match(frame.join("\n"), /Item 19/);
502
+ palette.handleInput(KEY.UP);
503
+ frame = palette.render(80);
504
+ assert.match(frame.join("\n"), /Item 18/);
505
+ palette.handleMouse(at(frame, "Item 18"));
506
+ assert.deepEqual(results, [{ type: "run", name: "cmd:18" }]);
507
+ });
508
+
509
+ test("mouse cannot select, run, scroll or bind while the next key is being captured", () => {
510
+ const { palette, results } = createPalette(GROUPS, pointerTheme);
511
+ palette.handleInput(KEY.DOWN);
512
+ palette.handleInput("\t");
513
+ const frame = palette.render(80);
514
+ palette.handleMouse(at(frame, "Browse changes", "move", "none"));
515
+ palette.handleMouse(at(frame, "Browse changes", "press"));
516
+ palette.handleMouse(at(frame, "Browse changes"));
517
+ palette.handleMouse({ ...at(frame, "Browse changes", "wheel", "none"), wheelDelta: 1 });
518
+ assert.deepEqual(results, []);
519
+ assert.doesNotMatch(palette.render(80).join("\n"), /\x1b\[33m/);
520
+ palette.handleInput("\x1bv");
521
+ assert.deepEqual(results, [{ type: "bind", name: "gentle:profiles", data: "\x1bv" }]);
522
+ });
523
+
524
+ test("centered native overlay receives real SGR motion, click and outside-card motion", (t) => {
525
+ let input: ((data: string) => void) | undefined;
526
+ const terminal: Terminal = {
527
+ start(onInput) { input = onInput; }, stop() {}, async drainInput() {}, write() {},
528
+ get columns() { return 120; }, get rows() { return 30; }, get kittyProtocolActive() { return false; },
529
+ moveBy() {}, hideCursor() {}, showCursor() {}, clearLine() {}, clearFromCursor() {}, clearScreen() {}, setTitle() {}, setProgress() {}, setProgramStatus() {},
530
+ };
531
+ const theme = getThemeByName("dark");
532
+ assert.ok(theme);
533
+ const { palette, results } = createPalette(GROUPS, theme, () => terminal.rows);
534
+ const tui = new TuiAltScreen(terminal, false, undefined, { mouse: true });
535
+ const overlay = tui.showOverlay(palette, { anchor: "center", width: 80, maxHeight: "85%" });
536
+ tui.start();
537
+ tui.renderNow(true);
538
+ try {
539
+ let frame = palette.render(80);
540
+ const beforeFrame = frame.join("\n");
541
+ const before = frame.find((line) => line.includes("Agent-model profiles"))!;
542
+ const bounds = overlay.getBounds();
543
+ assert.ok(bounds && bounds.col > 0 && bounds.row > 0);
544
+ const target = point(frame, "Agent-model profiles");
545
+ const x = bounds.col + target.x + 1, y = bounds.row + target.y + 1;
546
+ input?.(`\x1b[<35;${x};${y}M`);
547
+ frame = palette.render(80);
548
+ const after = frame.find((line) => line.includes("Agent-model profiles"))!;
549
+ if (process.env.GENTLE_PI_PALETTE_VISUAL === "1") {
550
+ t.diagnostic(`before ANSI base64: ${Buffer.from(beforeFrame).toString("base64")}`);
551
+ t.diagnostic(`after ANSI base64: ${Buffer.from(frame.join("\n")).toString("base64")}`);
552
+ }
553
+ assert.notEqual(after, before, "real SGR motion paints hover");
554
+ assert.deepEqual(results, []);
555
+ input?.("\x1b[<35;1;1M");
556
+ frame = palette.render(80);
557
+ assert.equal(frame.find((line) => line.includes("Agent-model profiles")), after,
558
+ "native overlay routing does not deliver outside-card motion to the palette");
559
+ input?.(`\x1b[<0;${x};${y}M`);
560
+ input?.(`\x1b[<0;${x};${y}m`);
561
+ assert.deepEqual(results, [{ type: "run", name: "gentle:profiles" }]);
562
+ } finally {
563
+ tui.stop();
564
+ }
565
+ });
566
+
567
+ test("native SGR wheel reaches and clicks an initially hidden command", () => {
568
+ let input: ((data: string) => void) | undefined;
569
+ const terminal: Terminal = {
570
+ start(onInput) { input = onInput; }, stop() {}, async drainInput() {}, write() {},
571
+ get columns() { return 100; }, get rows() { return 16; }, get kittyProtocolActive() { return false; },
572
+ moveBy() {}, hideCursor() {}, showCursor() {}, clearLine() {}, clearFromCursor() {}, clearScreen() {}, setTitle() {}, setProgress() {}, setProgramStatus() {},
573
+ };
574
+ const groups: CommandPaletteGroup[] = [{ title: "Many", items: Array.from({ length: 15 }, (_, i) => ({ command: `cmd:${i}`, label: `Item ${String(i).padStart(2, "0")}` })) }];
575
+ const { palette, results } = createPalette(groups, undefined, () => terminal.rows);
576
+ const tui = new TuiAltScreen(terminal, false, undefined, { mouse: true });
577
+ const overlay = tui.showOverlay(palette, { anchor: "center", width: 80, maxHeight: "85%" });
578
+ tui.start();
579
+ tui.renderNow(true);
580
+ try {
581
+ assert.doesNotMatch(palette.render(80).join("\n"), /Item 14/);
582
+ for (let i = 0; i < 14; i++) {
583
+ const bounds = overlay.getBounds();
584
+ assert.ok(bounds);
585
+ input?.(`\x1b[<65;${bounds.col + 5};${bounds.row + 5}M`);
586
+ tui.renderNow(true);
587
+ }
588
+ const frame = palette.render(80);
589
+ const bounds = overlay.getBounds();
590
+ assert.ok(bounds);
591
+ const target = point(frame, "Item 14");
592
+ const x = bounds.col + target.x + 1, y = bounds.row + target.y + 1;
593
+ input?.(`\x1b[<0;${x};${y}M`);
594
+ input?.(`\x1b[<0;${x};${y}m`);
595
+ assert.deepEqual(results, [{ type: "run", name: "cmd:14" }]);
596
+ } finally {
597
+ tui.stop();
598
+ }
599
+ });
600
+
601
+ test("a height-clipped native overlay never dispatches a hidden row", () => {
602
+ let input: ((data: string) => void) | undefined;
603
+ const terminal: Terminal = {
604
+ start(onInput) { input = onInput; }, stop() {}, async drainInput() {}, write() {},
605
+ get columns() { return 100; }, get rows() { return 8; }, get kittyProtocolActive() { return false; },
606
+ moveBy() {}, hideCursor() {}, showCursor() {}, clearLine() {}, clearFromCursor() {}, clearScreen() {}, setTitle() {}, setProgress() {}, setProgramStatus() {},
607
+ };
608
+ const groups: CommandPaletteGroup[] = [{ title: "Group", items: [
609
+ { command: "first", label: "First" }, { command: "hidden", label: "Hidden" },
610
+ ] }];
611
+ const { palette, results } = createPalette(groups, undefined, () => terminal.rows);
612
+ const tui = new TuiAltScreen(terminal, false, undefined, { mouse: true });
613
+ const overlay = tui.showOverlay(palette, { anchor: "center", width: 80, maxHeight: "85%" });
614
+ tui.start();
615
+ tui.renderNow(true);
616
+ try {
617
+ const frame = palette.render(80);
618
+ const bounds = overlay.getBounds();
619
+ assert.ok(bounds && bounds.height < frame.length);
620
+ const hidden = point(frame, "Hidden");
621
+ assert.ok(hidden.y >= bounds.height);
622
+ const hiddenX = bounds.col + hidden.x + 1, hiddenY = bounds.row + hidden.y + 1;
623
+ input?.(`\x1b[<0;${hiddenX};${hiddenY}M`);
624
+ input?.(`\x1b[<0;${hiddenX};${hiddenY}m`);
625
+ assert.deepEqual(results, []);
626
+ const first = point(frame, "First");
627
+ assert.ok(first.y < bounds.height);
628
+ const x = bounds.col + first.x + 1, y = bounds.row + first.y + 1;
629
+ input?.(`\x1b[<0;${x};${y}M`);
630
+ input?.(`\x1b[<0;${x};${y}m`);
631
+ assert.deepEqual(results, [{ type: "run", name: "first" }]);
632
+ } finally {
633
+ tui.stop();
634
+ }
635
+ });
636
+
354
637
  // --- commandsKey ---------------------------------------------------------------
355
638
 
356
639
  test("commandsKey defaults to alt+k", () => {
@@ -117,14 +117,14 @@ test("T24/L49: configured per-agent model routing still applies to writers launc
117
117
  test("AC4: verification stays risk-gated and the writer reasons never include risk", () => {
118
118
  assert.ok(
119
119
  core.includes(
120
- "3. **Verification rule** — only a named high-risk item (assess `escalate`) → independent `gentle-ai-verify`; else inline; runtime admission, gates/overengineering: `orchestrator-verification.md`.",
120
+ "3. **Verification rule** — only a named high-risk item (assess `escalate` when RDD is on or unknown) → independent `gentle-ai-verify`; else inline; runtime admission, gates/overengineering: `orchestrator-verification.md`.",
121
121
  ),
122
122
  "core Verification rule changed",
123
123
  );
124
124
  assert.ok(
125
125
  delegation.includes(
126
126
  // S9 canon change (gentle-ai 6b9a71ef): only a named high-risk item adds the verifier.
127
- "3. **Verification rule** (gentle-pi#661/#662, RDD-aware): only a change whose Risk line names a high-risk item (Task Size, assess `escalate`) gets an independent `gentle-ai-verify` run after the change's own checks, as rarely as possible; otherwise whoever made the change runs its focused test and suite inline, small tasks included.",
127
+ "3. **Verification rule** (gentle-pi#661/#662, RDD-aware): only a change whose Risk line names a high-risk item (Task Size, assess `escalate` when RDD is on or unknown) gets an independent `gentle-ai-verify` run after the change's own checks, as rarely as possible; otherwise whoever made the change runs its focused test and suite inline, small tasks included.",
128
128
  ),
129
129
  "lazy Verification rule changed",
130
130
  );
@@ -181,9 +181,10 @@ test("AC5/S6/L4: per-worker independent verify fires only on assess or escalate,
181
181
  assert.ok(item.includes("high-risk list in Task Size"), "the protocol must reference the core high-risk list");
182
182
  });
183
183
 
184
- test("AC5/S7: one inline full-suite seam check after parallel units", () => {
184
+ // cost-speed S15 P5a: "inline" became "run by the parent" so a full-delegation parent can load the module.
185
+ test("AC5/S7: one full-suite seam check run by the parent after parallel units", () => {
185
186
  const item = reviewItem("3. **Seam check**");
186
- for (const clause of ["after parallel units finish", "one inline full-suite command", "parent spot check", "seams between units"]) {
187
+ for (const clause of ["after parallel units finish", "one full-suite command run by the parent", "parent spot check", "seams between units"]) {
187
188
  assert.ok(item.includes(clause), `seam check item is missing: ${clause}`);
188
189
  }
189
190
  });
@@ -208,10 +209,11 @@ test("T12/S6: one independent verify per delegated unit after its self-review, n
208
209
  // T15 (S6, L38): after3 B x4 paid two same-model verifies with 0 defects.
209
210
  // Verification by named risk (user decision: the verifier follows the change's
210
211
  // risk, never the model that wrote it) dropped the smaller-model exception.
211
- test("T15/S6: inline code over several deliveries gets one verify at the feature's end, whatever model wrote it", () => {
212
+ // cost-speed S15 P5a: "Inline code" became "Parent-written code", the same scope without the organic word.
213
+ test("T15/S6: parent-written code over several deliveries gets one verify at the feature's end, whatever model wrote it", () => {
212
214
  const item = reviewItem("2. **Independent verify per unit**");
213
215
  for (const clause of [
214
- "Inline code over several deliveries of one feature",
216
+ "Parent-written code over several deliveries of one feature",
215
217
  "one verify at the feature's end",
216
218
  "only when that unit is high risk",
217
219
  ]) {
@@ -231,7 +233,8 @@ test("T11/S4: the parent hands verify the whole spec, authorizes its probes and
231
233
  "typecheck",
232
234
  "`gentle-ai-verify` holds the checklist",
233
235
  "every in-scope unmet item before closing the unit",
234
- "the writer commits its probes as regression tests",
236
+ // P8 C2: writers never commit; the parent owns git and commits only when a commit is authorized (P16).
237
+ "the writer adds its probes as regression tests; the parent commits when a commit is authorized.",
235
238
  ]) {
236
239
  assert.ok(item.includes(clause), `verify handoff item is missing: ${clause}`);
237
240
  }
@@ -246,9 +249,17 @@ test("T11/S4: the parent hands verify the whole spec, authorizes its probes and
246
249
  test("AC4/S4: the normative verification rule text is unchanged by the review protocol", () => {
247
250
  const normative = sectionFrom(verification, "## Verification rule (normative)");
248
251
  // Re-pinned on purpose: the runtime admission now also accepts a `Risk: item N` sentence (verifier-admission.ts).
252
+ // Re-pinned for cost-speed P8: stale number and not-restated claim removed (X6), the stall watchdog sentence
253
+ // left to the worker's Verification contract it duplicated, a passive change with no reported command (C10), and
254
+ // shorter wording for the tier table lead-in, nativeReviewOutcome, the off fallback, the direct plan request and the
255
+ // continuation relay (B1 bytes).
256
+ // Re-pinned for cost-speed S15 P5a: the focused test and suite "run inline" became "run in the session that made
257
+ // the change", the same rule in words a full-delegation parent can load.
258
+ // Re-pinned for cost-speed S15 P16: two phrases that restated their own sentence ("for the exact rules", the second
259
+ // "when applicable") trimmed to pay for the conditional probe commit in the verify handoff; no rule changed.
249
260
  assert.equal(
250
261
  createHash("sha256").update(normative).digest("hex"),
251
- "f052518b2905e4560d629397876057079aa71b45352272646261a611fb4a1e17",
262
+ "83f5c1f1628a7d2fbb75abfcb558b4a020835239d57d983eef3508c24b338e30",
252
263
  "the normative Verification rule section changed",
253
264
  );
254
265
  assert.ok(verification.includes("or a delegated writer returns"), "the module must still load when a delegated writer returns");
@@ -322,12 +333,18 @@ test("T10: escalate labels name the core high-risk items", () => {
322
333
  }
323
334
  });
324
335
 
325
- test("T9/AC2: the parallelism reason launches every unit together in background and waits for all", () => {
336
+ test("T9/AC2: the parallelism reason launches every unit together in one turn, in any mode, and waits for all", () => {
326
337
  const parallel = lineStarting(writer, "- **Parallelism**");
327
338
  for (const clause of [
328
339
  // Writer-rule fix: a unit is one independent piece of behavior.
329
340
  "every independent unit in the same turn",
330
- '`subagent_run` with `mode: "background"`',
341
+ // P5b (C11): omit `mode`; an explicit background mode throws in single-shot runs.
342
+ "`subagent_run` without `mode`",
343
+ // cost-speed P6 (L41, L36): background is how the units run, never a condition (the core Writer rule says
344
+ // the same); Pi runs one message's calls in parallel, and admission takes only a writer-only message.
345
+ "In every mode,",
346
+ "in one assistant message with no other tool call",
347
+ "(in background when background mode is on)",
331
348
  "wait for all completions",
332
349
  "serial launches void the reason",
333
350
  "work inline",
@@ -336,6 +353,11 @@ test("T9/AC2: the parallelism reason launches every unit together in background
336
353
  assert.ok(parallel.includes(clause), `writer parallelism launch rule is missing: ${clause}`);
337
354
  }
338
355
  assert.ok(!/high risk|high-risk|verify/i.test(parallel), "parallel mixes risk or verification into the writer reasons");
356
+ assert.ok(!/With the Background subagent policy on, launch/.test(parallel), "background mode must not condition the launch");
357
+ });
358
+
359
+ test("P6: the lazy Writer trigger names every route the runtime admits", () => {
360
+ assert.ok(delegationWriter.includes("The runtime admits writers only for a feature-document task, at the measured context backstop, or as 2+ disjoint writers alone in one message."));
339
361
  });
340
362
 
341
363
  // T4 (S2, AC6): the runtime rejects an overlapping live writer at admission,