gentle-pi 4.6.0 → 4.7.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 (290) hide show
  1. package/README.md +10 -11
  2. package/assets/agents/gentle-ai-explore.md +1 -0
  3. package/assets/agents/gentle-ai-verify.md +5 -2
  4. package/assets/agents/gentle-ai-worker.md +3 -0
  5. package/assets/agents/jd-fix-agent.md +1 -0
  6. package/assets/agents/jd-judge-a.md +1 -0
  7. package/assets/agents/jd-judge-b.md +1 -0
  8. package/assets/design-canvas/canvas.css +13 -1
  9. package/assets/design-canvas/canvas.js +11 -2
  10. package/assets/install-wizard/wizard.js +1 -0
  11. package/assets/migrations/agent-body-history.json +16 -1
  12. package/assets/orchestrator-delegation-reference.md +4 -4
  13. package/assets/orchestrator-delegation.md +1 -1
  14. package/assets/orchestrator-full-delegation-card.md +65 -0
  15. package/assets/orchestrator-full-delegation.md +34 -0
  16. package/assets/orchestrator-memory.md +3 -3
  17. package/assets/orchestrator-prompts.md +1 -1
  18. package/assets/orchestrator-skills.md +1 -1
  19. package/assets/orchestrator-verification.md +7 -5
  20. package/assets/orchestrator.md +3 -3
  21. package/bin/gentle-shell.mjs +164 -56
  22. package/docs/agent-status.md +61 -0
  23. package/docs/bundled-install.md +7 -5
  24. package/docs/delegated-verification.md +29 -7
  25. package/docs/gentle-agents-activity.md +14 -0
  26. package/docs/gentle-shell.md +54 -16
  27. package/docs/install-wizard.md +1 -1
  28. package/docs/permission-modes.md +9 -4
  29. package/docs/readme-reference.md +75 -30
  30. package/docs/render-cache-performance.md +11 -1
  31. package/docs/review-coordinator.md +33 -0
  32. package/docs/review-request-context.md +19 -0
  33. package/docs/review-windows-acl.md +18 -0
  34. package/docs/voice.md +6 -3
  35. package/docs/yolo-mode.md +5 -5
  36. package/extensions/ask-user-choice.ts +1 -0
  37. package/extensions/ask-user-question.ts +1 -0
  38. package/extensions/child-safety.ts +3 -0
  39. package/extensions/gentle-agent-status.ts +99 -0
  40. package/extensions/gentle-agents.ts +326 -34
  41. package/extensions/gentle-ai.ts +1496 -454
  42. package/extensions/gentle-shell.ts +293 -63
  43. package/extensions/gentle-todo.ts +18 -2
  44. package/extensions/gentle-tps.ts +48 -0
  45. package/extensions/quiet-tools.ts +38 -8
  46. package/extensions/skill-registry.ts +175 -18
  47. package/extensions/startup-banner.ts +30 -3
  48. package/lib/agent-profile-pin.ts +3 -3
  49. package/lib/agent-profiles.ts +160 -2
  50. package/lib/agent-status.ts +105 -0
  51. package/lib/agents-config.ts +46 -0
  52. package/lib/agents-history.ts +24 -5
  53. package/lib/agents-messaging.ts +47 -5
  54. package/lib/agents-runner.ts +183 -12
  55. package/lib/auto-permission-runtime.ts +1 -1
  56. package/lib/bounded-writer-admission.ts +13 -1
  57. package/lib/card-content-policy.ts +8 -6
  58. package/lib/command-palette.ts +133 -17
  59. package/lib/context-backstop.ts +14 -5
  60. package/lib/destructive-command-guard.ts +48 -4
  61. package/lib/execution-surface-guard.ts +20 -0
  62. package/lib/exploration-budget.ts +4 -2
  63. package/lib/gentle-ai-binary.ts +1 -1
  64. package/lib/gentle-design.ts +3 -0
  65. package/lib/gentle-shell-bundled.ts +6 -19
  66. package/lib/gentle-shell-launcher.ts +43 -8
  67. package/lib/herdr-activity.ts +14 -2
  68. package/lib/herdr-busy.ts +45 -0
  69. package/lib/image-attachments.ts +33 -0
  70. package/lib/image-disk-cache.ts +137 -0
  71. package/lib/inprocess-reviewer.ts +270 -140
  72. package/lib/jobs-view.ts +198 -11
  73. package/lib/model-routing-authority.ts +22 -4
  74. package/lib/native-choice-list.ts +20 -2
  75. package/lib/native-review-cli.ts +96 -19
  76. package/lib/orchestrator-mode-policy.ts +105 -0
  77. package/lib/questionnaire/questionnaire-view.ts +105 -12
  78. package/lib/rdd-mode-control.ts +32 -0
  79. package/lib/reply-language-anchor.ts +104 -0
  80. package/lib/review-blocker.ts +92 -0
  81. package/lib/review-candidate-symlink-scan.ts +136 -0
  82. package/lib/review-candidate-view-owner.ts +81 -44
  83. package/lib/review-continuation-registry.ts +99 -0
  84. package/lib/review-coordinator.ts +163 -0
  85. package/lib/review-failure-facts.ts +49 -0
  86. package/lib/review-host-relay.ts +46 -10
  87. package/lib/review-integration-v2.ts +7 -1
  88. package/lib/review-relay-phase-timing.ts +45 -0
  89. package/lib/review-start-context.ts +17 -0
  90. package/lib/session-profile-freeze.ts +4 -2
  91. package/lib/shell-bar.ts +140 -58
  92. package/lib/shell-changes.ts +2 -0
  93. package/lib/shell-panel.ts +17 -3
  94. package/lib/shell-sidebar-layout.ts +112 -40
  95. package/lib/shell-sidebar.ts +7 -0
  96. package/lib/shell-todo.ts +10 -3
  97. package/lib/verifier-admission.ts +1 -1
  98. package/lib/visual-customization-policy.ts +36 -16
  99. package/lib/visual-customize-view.ts +216 -21
  100. package/lib/visual-layout-preview.ts +9 -5
  101. package/lib/visual-profiles.ts +2 -2
  102. package/lib/windows-session-transport.ts +53 -2
  103. package/lib/yolo-session-policy.ts +40 -15
  104. package/package.json +2 -1
  105. package/runtime/gentle-ai-binary.mjs +1 -1
  106. package/runtime/gentle-shell-bundled.mjs +6 -19
  107. package/runtime/gentle-shell-launcher.mjs +42 -7
  108. package/runtime/native-review-cli.mjs +93 -16
  109. package/runtime/review-integration-v2.mjs +7 -1
  110. package/scripts/build-full-delegation-card.mjs +175 -0
  111. package/scripts/bundled-install.mjs +38 -8
  112. package/scripts/download-progress.mjs +68 -0
  113. package/scripts/gentle-ai-installer.mjs +41 -18
  114. package/scripts/gentle-ai-proxy.mjs +294 -0
  115. package/scripts/install-gentle-ai.mjs +14 -1
  116. package/scripts/installer-preflight.mjs +5 -5
  117. package/scripts/installer-runner.mjs +27 -12
  118. package/scripts/installer-server.mjs +8 -7
  119. package/scripts/render-cache-host.mjs +72 -0
  120. package/scripts/render-cache-performance-worker.mjs +5 -4
  121. package/scripts/render-cache-performance.mjs +6 -1
  122. package/scripts/run-test-suite.mjs +40 -28
  123. package/scripts/verify-package-files.mjs +12 -2
  124. package/scripts/voice-worker.cjs +32 -6
  125. package/skills/design/SKILL.md +11 -8
  126. package/skills/gentle-ai/SKILL.md +2 -2
  127. package/skills/gentle-ui-design/SKILL.md +46 -0
  128. package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
  129. package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
  130. package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
  131. package/skills/gentle-ui-design/references/task-and-content.md +60 -0
  132. package/skills/skill-registry/SKILL.md +4 -2
  133. package/skills/work-unit-commits/SKILL.md +6 -7
  134. package/tests/agent-home.test.ts +28 -9
  135. package/tests/agent-profiles-workflow.test.ts +163 -0
  136. package/tests/agent-risk-escalation.test.ts +1 -1
  137. package/tests/agent-status.test.ts +143 -0
  138. package/tests/agents-config.test.ts +96 -0
  139. package/tests/agents-history.test.ts +31 -0
  140. package/tests/agents-jobs-frames.test.ts +93 -0
  141. package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
  142. package/tests/agents-runner-drain.test.ts +193 -0
  143. package/tests/agents-runner.test.ts +178 -2
  144. package/tests/append-system-prompt-route.test.ts +4 -1
  145. package/tests/ask-user-choice.test.ts +4 -3
  146. package/tests/ask-user-question.test.ts +97 -0
  147. package/tests/auto-permission-runtime.test.ts +1 -1
  148. package/tests/autonomous-guard.test.ts +346 -10
  149. package/tests/bounded-stop-contract.test.ts +43 -3
  150. package/tests/bridge-cost.test.ts +19 -4
  151. package/tests/bundled-install.test.ts +30 -5
  152. package/tests/card-content-policy.test.ts +3 -3
  153. package/tests/chained-pr-skill.test.ts +8 -6
  154. package/tests/child-safety.test.ts +11 -0
  155. package/tests/codegraph-tools.test.ts +11 -5
  156. package/tests/command-palette.test.ts +284 -1
  157. package/tests/delegate-for-reason-contract.test.ts +3 -3
  158. package/tests/design-canvas-assets.test.ts +185 -2
  159. package/tests/destructive-command-guard.test.ts +52 -0
  160. package/tests/download-progress.test.ts +71 -0
  161. package/tests/execution-surface-guard.test.ts +55 -0
  162. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +9 -5
  163. package/tests/fixtures/proxy-tls/proxy.crt +19 -0
  164. package/tests/fixtures/proxy-tls/proxy.key +28 -0
  165. package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
  166. package/tests/fixtures/session-profile-v1/replay.ts +53 -6
  167. package/tests/full-delegation-closure.test.ts +131 -0
  168. package/tests/full-delegation-notices.test.ts +76 -0
  169. package/tests/generic-agent-tools.test.ts +3 -3
  170. package/tests/gentle-agent-status.test.ts +74 -0
  171. package/tests/gentle-agents-child-jobs.test.ts +237 -0
  172. package/tests/gentle-agents.test.ts +1070 -12
  173. package/tests/gentle-ai-binary.test.ts +3 -1
  174. package/tests/gentle-ai-elapsed-store.test.ts +19 -0
  175. package/tests/gentle-ai-exploration-budget.test.ts +18 -2
  176. package/tests/gentle-ai-installer.test.ts +134 -51
  177. package/tests/gentle-ai-proxy.test.ts +434 -0
  178. package/tests/gentle-ai.test.ts +113 -38
  179. package/tests/gentle-design.test.ts +21 -0
  180. package/tests/gentle-herdr-activity.test.ts +9 -6
  181. package/tests/gentle-shell-bin.test.ts +123 -0
  182. package/tests/gentle-shell-bundled.test.ts +207 -31
  183. package/tests/gentle-shell-launcher.test.ts +77 -10
  184. package/tests/gentle-shell.test.ts +899 -59
  185. package/tests/gentle-todo.test.ts +19 -2
  186. package/tests/gentle-tps.test.ts +123 -0
  187. package/tests/gentle-ui-design-skill.test.ts +59 -0
  188. package/tests/herdr-busy.test.ts +59 -0
  189. package/tests/herdr-task-summary-policy.test.ts +8 -4
  190. package/tests/image-disk-cache.test.ts +163 -0
  191. package/tests/independent-recovery-delivery.test.ts +83 -0
  192. package/tests/inprocess-reviewer.test.ts +176 -4
  193. package/tests/installer-posix-bootstrap.test.ts +1 -1
  194. package/tests/installer-preflight.test.ts +5 -4
  195. package/tests/installer-runner.test.ts +79 -44
  196. package/tests/installer-server.test.ts +14 -11
  197. package/tests/jobs-view.test.ts +260 -6
  198. package/tests/modal-mouse-boundaries.test.ts +136 -0
  199. package/tests/model-routing-authority.test.ts +178 -2
  200. package/tests/native-choice-list.test.ts +77 -2
  201. package/tests/native-review-capability-contract.test.ts +7 -1
  202. package/tests/native-review-cli.test.ts +269 -1
  203. package/tests/no-self-pause-contract.test.ts +4 -1
  204. package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
  205. package/tests/orchestrator-budget.test.ts +7 -2
  206. package/tests/orchestrator-delegation-mode.test.ts +153 -0
  207. package/tests/orchestrator-mode-policy.test.ts +175 -0
  208. package/tests/orchestrator-prompt-budget.test.ts +3 -1
  209. package/tests/orchestrator-rdd-ownership.test.ts +2 -2
  210. package/tests/package-manifest.test.ts +11 -9
  211. package/tests/permission-allowlist.test.ts +202 -0
  212. package/tests/pi-update-launcher.test.ts +8 -0
  213. package/tests/pnpm-workspace-config.test.ts +58 -0
  214. package/tests/primary-session-prompt.test.ts +13 -0
  215. package/tests/profile-pin.test.ts +29 -2
  216. package/tests/profile-tier-footer.test.ts +5 -0
  217. package/tests/profiles-panel-delegation-mode.test.ts +422 -0
  218. package/tests/questionnaire-view.test.ts +115 -0
  219. package/tests/quiet-bash-runtime.test.ts +1 -1
  220. package/tests/quiet-tool-rendering.test.ts +48 -0
  221. package/tests/rdd-aware-verification-contract.test.ts +16 -11
  222. package/tests/rdd-customize.test.ts +287 -0
  223. package/tests/rdd-mode-cache.test.ts +450 -0
  224. package/tests/rdd-mode-control.test.ts +407 -0
  225. package/tests/rdd-mode-scope-regression.test.ts +137 -0
  226. package/tests/rdd-off-independent-regression.test.ts +69 -0
  227. package/tests/rdd-status-line.test.ts +18 -0
  228. package/tests/render-cache-performance.test.ts +171 -2
  229. package/tests/reply-language-anchor.test.ts +173 -0
  230. package/tests/review-agent-end-preflight.test.ts +1 -1
  231. package/tests/review-blocker.test.ts +193 -0
  232. package/tests/review-candidate-owner-retry.test.ts +1 -1
  233. package/tests/review-candidate-symlink-scan.test.ts +157 -0
  234. package/tests/review-candidate-view.test.ts +1 -1
  235. package/tests/review-candidate-windows-boundary.test.ts +131 -0
  236. package/tests/review-candidate-windows-probe.test.ts +63 -0
  237. package/tests/review-committed-restart-ack.test.ts +129 -0
  238. package/tests/review-continuation-registry.test.ts +76 -0
  239. package/tests/review-controller-native-routing.test.ts +261 -5
  240. package/tests/review-controller-workspace-root.test.ts +230 -3
  241. package/tests/review-controller.test.ts +96 -11
  242. package/tests/review-coordinator-runtime.test.ts +117 -0
  243. package/tests/review-coordinator.test.ts +195 -0
  244. package/tests/review-failure-facts.test.ts +87 -0
  245. package/tests/review-host-relay-routing.test.ts +258 -4
  246. package/tests/review-host-relay.test.ts +39 -0
  247. package/tests/review-integration-v2.test.ts +46 -3
  248. package/tests/review-json-arguments.test.ts +65 -10
  249. package/tests/review-last-event-closure.test.ts +68 -0
  250. package/tests/review-loadout-rdd-off-sdk.test.ts +65 -31
  251. package/tests/review-owner-identity.test.ts +60 -24
  252. package/tests/review-relay-phase-timing.test.ts +128 -0
  253. package/tests/review-relay-transport-agent.test.ts +12 -2
  254. package/tests/review-reviewer-evidence.test.ts +183 -0
  255. package/tests/review-risk-assessment.test.ts +74 -3
  256. package/tests/review-session-standing-permission-controller.test.ts +21 -1
  257. package/tests/review-start-context.test.ts +19 -0
  258. package/tests/review-tool-prose-budget.test.ts +121 -0
  259. package/tests/run-test-suite.test.ts +122 -1
  260. package/tests/runtime-harness.mjs +4 -1
  261. package/tests/sensitive-path-tools.test.ts +181 -5
  262. package/tests/session-profile-append-controller-pi.test.ts +60 -31
  263. package/tests/session-profile-binding.test.ts +19 -1
  264. package/tests/session-profile-disk-reader-pi.test.ts +58 -16
  265. package/tests/session-profile-v1-compat.test.ts +35 -1
  266. package/tests/shell-bar.test.ts +186 -42
  267. package/tests/shell-panel.test.ts +50 -22
  268. package/tests/shell-sidebar-fullscreen.test.ts +5 -5
  269. package/tests/shell-sidebar-layout.test.ts +294 -23
  270. package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
  271. package/tests/shell-surface-transparent.test.ts +89 -0
  272. package/tests/shell-todo.test.ts +12 -0
  273. package/tests/skill-registry.test.ts +838 -5
  274. package/tests/startup-banner.test.ts +152 -1
  275. package/tests/startup-home-repo.test.ts +2 -0
  276. package/tests/support/review-coordinator-runtime.ts +69 -0
  277. package/tests/task-size-routing-contract.test.ts +5 -3
  278. package/tests/verifier-admission.test.ts +49 -0
  279. package/tests/verify-first-launch-contract.test.ts +78 -3
  280. package/tests/visual-customization-policy.test.ts +39 -6
  281. package/tests/visual-customize-view.test.ts +573 -9
  282. package/tests/visual-layout-preview.test.ts +15 -1
  283. package/tests/visual-profiles.test.ts +11 -0
  284. package/tests/voice-worker.test.ts +73 -2
  285. package/tests/windows-session-transport.test.ts +126 -0
  286. package/tests/work-continuity-contract.test.ts +28 -0
  287. package/tests/writer-feature-document-admission.test.ts +92 -0
  288. package/tests/yolo-customize.test.ts +27 -4
  289. package/tests/yolo-mode.test.ts +23 -18
  290. package/tests/yolo-session-policy.test.ts +270 -1
@@ -0,0 +1,175 @@
1
+ import assert from "node:assert/strict";
2
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import test, { after } from "node:test";
6
+
7
+ import { bindSessionProfile } from "../lib/session-profile-binding.ts";
8
+ import {
9
+ ORCHESTRATOR_MODE_ENV,
10
+ resolveOrchestratorMode,
11
+ } from "../lib/orchestrator-mode-policy.ts";
12
+
13
+ // ---------------------------------------------------------------------------
14
+ // full-delegation-mode S2/S7: the effective mode follows the live profile.
15
+ //
16
+ // Every case here exists because the mode is read on the hot path of a prompt
17
+ // build: it must never throw, never read a frozen startup snapshot, and never
18
+ // let an unrecognized override pass for a decision.
19
+ // ---------------------------------------------------------------------------
20
+
21
+ const roots: string[] = [];
22
+ function configHomeWithProfiles(profiles: unknown): string {
23
+ const home = mkdtempSync(join(tmpdir(), "gp-orch-mode-"));
24
+ roots.push(home);
25
+ if (profiles !== undefined) {
26
+ writeFileSync(join(home, "profiles.json"), typeof profiles === "string" ? profiles : JSON.stringify(profiles));
27
+ }
28
+ return home;
29
+ }
30
+ after(() => {
31
+ for (const root of roots) rmSync(root, { recursive: true, force: true });
32
+ });
33
+
34
+ function storeWith(workflow?: Record<string, unknown>): unknown {
35
+ return {
36
+ kind: "gentle-pi.agent_model_profiles",
37
+ version: 1,
38
+ active: "normal",
39
+ profiles: {
40
+ normal: { orchestrator: { model: "gpt-5.4" } },
41
+ "frontier-local": { orchestrator: { model: "claude-opus-4-6" } },
42
+ },
43
+ ...(workflow === undefined ? {} : { workflow }),
44
+ };
45
+ }
46
+
47
+ function bind(sessionId: string, profile: string): void {
48
+ bindSessionProfile(sessionId, profile, { orchestrator: { model: "gpt-5.4" } });
49
+ }
50
+
51
+ test("a session with no profile anywhere resolves to the organic default", () => {
52
+ const storeWithoutActive = {
53
+ kind: "gentle-pi.agent_model_profiles",
54
+ version: 1,
55
+ profiles: { normal: { orchestrator: { model: "gpt-5.4" } } },
56
+ };
57
+ const resolution = resolveOrchestratorMode({
58
+ cwd: process.cwd(),
59
+ configHome: configHomeWithProfiles(storeWithoutActive),
60
+ sessionId: "mode-none",
61
+ env: {},
62
+ });
63
+ assert.equal(resolution.mode, "organic");
64
+ assert.equal(resolution.source, "default");
65
+ assert.equal(resolution.profileName, undefined);
66
+ });
67
+
68
+ test("a session that never bound a profile inherits the global active profile's mode", () => {
69
+ const resolution = resolveOrchestratorMode({
70
+ cwd: process.cwd(),
71
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
72
+ sessionId: "mode-fresh",
73
+ env: {},
74
+ });
75
+ // `active` is "normal" in the fixture, which carries no workflow entry.
76
+ assert.equal(resolution.profileName, "normal");
77
+ assert.equal(resolution.mode, "organic");
78
+ assert.equal(resolution.source, "session_profile");
79
+ });
80
+
81
+ test("a bound profile in full delegation mode wins, and names itself as the source", () => {
82
+ bind("mode-full", "frontier-local");
83
+ const resolution = resolveOrchestratorMode({
84
+ cwd: process.cwd(),
85
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
86
+ sessionId: "mode-full",
87
+ env: {},
88
+ });
89
+ assert.equal(resolution.mode, "full-delegation");
90
+ assert.equal(resolution.source, "session_profile");
91
+ assert.equal(resolution.profileName, "frontier-local");
92
+ });
93
+
94
+ test("a profile without a workflow entry still decides, as organic", () => {
95
+ bind("mode-organic", "normal");
96
+ const resolution = resolveOrchestratorMode({
97
+ cwd: process.cwd(),
98
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
99
+ sessionId: "mode-organic",
100
+ env: {},
101
+ });
102
+ assert.equal(resolution.mode, "organic");
103
+ assert.equal(resolution.source, "session_profile");
104
+ assert.equal(resolution.profileName, "normal");
105
+ });
106
+
107
+ test("the bound profile is re-read on every call, so a live switch flips the mode both ways", () => {
108
+ const home = configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } }));
109
+ bind("mode-switch", "frontier-local");
110
+ const options = { cwd: process.cwd(), configHome: home, sessionId: "mode-switch", env: {} };
111
+ assert.equal(resolveOrchestratorMode(options).mode, "full-delegation");
112
+
113
+ // Switching to the organic profile restores today's rules on the next read.
114
+ bind("mode-switch", "normal");
115
+ assert.equal(resolveOrchestratorMode(options).mode, "organic");
116
+
117
+ // And back again, without any process restart.
118
+ bind("mode-switch", "frontier-local");
119
+ assert.equal(resolveOrchestratorMode(options).mode, "full-delegation");
120
+ });
121
+
122
+ test("the env override wins over the profile and says so", () => {
123
+ bind("mode-env", "normal");
124
+ const resolution = resolveOrchestratorMode({
125
+ cwd: process.cwd(),
126
+ configHome: configHomeWithProfiles(storeWith()),
127
+ sessionId: "mode-env",
128
+ env: { [ORCHESTRATOR_MODE_ENV]: "full-delegation" },
129
+ });
130
+ assert.equal(resolution.mode, "full-delegation");
131
+ assert.equal(resolution.source, "environment");
132
+ assert.equal(resolution.envValue, "full-delegation");
133
+ });
134
+
135
+ test("an unrecognized env value is reported but never honoured", () => {
136
+ bind("mode-env-bad", "frontier-local");
137
+ const resolution = resolveOrchestratorMode({
138
+ cwd: process.cwd(),
139
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
140
+ sessionId: "mode-env-bad",
141
+ env: { [ORCHESTRATOR_MODE_ENV]: "super-delegation" },
142
+ });
143
+ assert.equal(resolution.mode, "full-delegation");
144
+ assert.equal(resolution.source, "session_profile");
145
+ assert.equal(resolution.envValue, "super-delegation");
146
+ });
147
+
148
+ test("a missing, malformed or unreadable profiles store fails closed to organic", () => {
149
+ for (const store of [undefined, "{not json", { kind: "wrong" }]) {
150
+ bind("mode-broken", "frontier-local");
151
+ const resolution = resolveOrchestratorMode({
152
+ cwd: process.cwd(),
153
+ configHome: configHomeWithProfiles(store),
154
+ sessionId: "mode-broken",
155
+ env: {},
156
+ });
157
+ assert.equal(resolution.mode, "organic", `store=${JSON.stringify(store)}`);
158
+ // The profile layer was consulted and could not answer: that is a
159
+ // different situation from having no profile at all, and the report says so.
160
+ assert.equal(resolution.source, "session_profile");
161
+ assert.equal(resolution.profileName, "frontier-local");
162
+ }
163
+ });
164
+
165
+ test("a bound profile the store no longer defines resolves to organic instead of throwing", () => {
166
+ bind("mode-ghost", "deleted-profile");
167
+ const resolution = resolveOrchestratorMode({
168
+ cwd: process.cwd(),
169
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
170
+ sessionId: "mode-ghost",
171
+ env: {},
172
+ });
173
+ assert.equal(resolution.mode, "organic");
174
+ assert.equal(resolution.profileName, "deleted-profile");
175
+ });
@@ -52,7 +52,9 @@ test("rendered orchestrator core and selected declarations fit the byte budget",
52
52
  const prompt = Buffer.byteLength(core, "utf8");
53
53
  const total = prompt + declarationBytes;
54
54
  t.diagnostic(`rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
55
- assert.ok(total <= 16600, `rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
55
+ // Issue #2935 (user decision): 16,600 -> 16,700 B with the canonical core budget raise to 9,350 B,
56
+ // so the resolved-skill-read exception keeps the full confinement wording.
57
+ assert.ok(total <= 16700, `rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
56
58
  });
57
59
 
58
60
  // Pi 1.4 does not export its pure system assembler from the package root.
@@ -67,12 +67,12 @@ test("rendered parent prompt keeps the RDD boundary while omitting lifecycle mir
67
67
  // budget below must cover, not a smaller placeholder production later
68
68
  // exceeds. gentle-shell#1731 T10 (user decision): budget 8,192 -> 8,400 B.
69
69
  // Verification by named risk and the writer-rule fix: 8,400 -> 9,100 B; weak-model economy: 9,100 -> 9,250 B
70
- // (the canonical budget in orchestrator-budget.test.ts).
70
+ // issue #2935 (user decision): 9,250 -> 9,350 B (the canonical budget in orchestrator-budget.test.ts).
71
71
  assert.ok(
72
72
  rendered.includes("Receipt-driven development: unknown (native status unavailable)"),
73
73
  "the default render must include the worst-case RDD status line",
74
74
  );
75
- assert.ok(Buffer.byteLength(rendered, "utf8") <= 9250, "the rendered parent prompt must stay within the 9,250 B core budget");
75
+ assert.ok(Buffer.byteLength(rendered, "utf8") <= 9350, "the rendered parent prompt must stay within the 9,350 B core budget");
76
76
  });
77
77
 
78
78
  test("static prompts retain ODD and delegated-work guidance without SDD", () => {
@@ -61,7 +61,7 @@ const V014_MANAGED_ASSETS = join(
61
61
  // gentle-ai-explore.md as their exemplar (packaged, absent from the v0.13
62
62
  // manifest) after review-refuter.md was retired together with every
63
63
  // Pi-authored adversarial review verdict.
64
- const MANAGED_EXEMPLAR_TOOLS = ["read", "grep", "find", "codegraph", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content"];
64
+ const MANAGED_EXEMPLAR_TOOLS = ["read", "grep", "find", "codegraph", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content", "mcp__codegraph__codegraph_explore"];
65
65
  const RETIRED_ADVERSARIAL_AGENTS = ["review-refuter.md", "review-validator.md"];
66
66
 
67
67
  interface ManagedAssetsManifest {
@@ -431,20 +431,20 @@ test("package manifest installs pi-pretty through a wrapper without bundling nat
431
431
  );
432
432
  });
433
433
 
434
- test("package verification binds the published Gentle AI v4.3.1 runtime pin", () => {
434
+ test("package verification binds the published Gentle AI v4.4.0 runtime pin", () => {
435
435
  const installer = readFileSync(join(PACKAGE_ROOT, "scripts", "gentle-ai-installer.mjs"), "utf8");
436
436
  const binary = readFileSync(join(PACKAGE_ROOT, "lib", "gentle-ai-binary.ts"), "utf8");
437
437
  const verifier = readFileSync(join(PACKAGE_ROOT, "scripts", "verify-package-files.mjs"), "utf8");
438
438
 
439
- assert.match(installer, /INSTALLER_VERSION = "4\.3\.1"/);
439
+ assert.match(installer, /INSTALLER_VERSION = "4\.4\.0"/);
440
440
  assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_PACKAGE.*GENTLE_AI_WINDOWS_SOURCE_MODULE/);
441
- assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:00p8dnjJrhYFq1Qikk2oY6K\/UXIty9A\/IBUUOUiX9XA="/);
441
+ assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:cAQAzIsbocYcQfOzA1CmgGpGgiCivUNcPjdfJE8RJ6g="/);
442
442
  assert.match(installer, /GOTOOLCHAIN: "local"/);
443
443
  assert.match(installer, /GOSUMDB: "sum\.golang\.org"/);
444
444
  assert.match(binary, /GENTLE_AI_VERSION = INSTALLER_VERSION/);
445
445
  assert.match(binary, /GO_SUMDB_SOURCE_BUILD/);
446
446
  assert.match(binary, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM/);
447
- assert.match(verifier, /v4\.3\.1/);
447
+ assert.match(verifier, /v4\.4\.0/);
448
448
  });
449
449
 
450
450
 
@@ -1584,6 +1584,7 @@ test("gentle-ai-worker packages the exact scoped writer contract", () => {
1584
1584
  "write",
1585
1585
  "bash",
1586
1586
  "mem_save",
1587
+ "mcp__codegraph__codegraph_explore",
1587
1588
  ]);
1588
1589
  assert.ok(
1589
1590
  tools.every((tool) => !tool.startsWith("subagent_")),
@@ -1703,6 +1704,7 @@ test("package installation gives gentle-ai-worker a loader-compatible scoped ide
1703
1704
  "write",
1704
1705
  "bash",
1705
1706
  "mem_save",
1707
+ "mcp__codegraph__codegraph_explore",
1706
1708
  ]);
1707
1709
  assert.doesNotMatch(
1708
1710
  readAgentFrontmatter(installedAgentPath),
@@ -1826,8 +1828,8 @@ test("global model routing uses PI_CODING_AGENT_DIR for package-installed agents
1826
1828
  test("normal and forced installation copy generic agents with complete role contracts", () => {
1827
1829
  const previousAgentHome = process.env.GENTLE_PI_AGENT_HOME;
1828
1830
  const expectedTools = {
1829
- "gentle-ai-explore": ["read", "grep", "find", "codegraph", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content"],
1830
- "gentle-ai-verify": ["read", "grep", "find", "bash"],
1831
+ "gentle-ai-explore": ["read", "grep", "find", "codegraph", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content", "mcp__codegraph__codegraph_explore"],
1832
+ "gentle-ai-verify": ["read", "grep", "find", "bash", "mcp__codegraph__codegraph_explore"],
1831
1833
  } as const;
1832
1834
 
1833
1835
  try {
@@ -1946,9 +1948,9 @@ test("pi-pretty wrapper uses cached ESM loading for compiled and pnpm symlink in
1946
1948
  assert.match(wrapper, /quietToolsEnabled/);
1947
1949
  });
1948
1950
 
1949
- test("Gentle Shell v4.6.0 package manifest declares the release version", () => {
1951
+ test("Gentle Shell v4.7.0 package manifest declares the release version", () => {
1950
1952
  const packageJson = readPackageJson();
1951
- assert.equal(packageJson.version, "4.6.0", "the release manifest must be explicitly pinned to v4.6.0");
1953
+ assert.equal(packageJson.version, "4.7.0", "the release manifest must be explicitly pinned to v4.7.0");
1952
1954
  assert.equal(packageJson.scripts?.test, "node scripts/run-test-suite.mjs");
1953
1955
  assert.ok(packageJson.files?.includes("assets/"));
1954
1956
  assert.ok(packageJson.files?.includes("contracts/"));
@@ -0,0 +1,202 @@
1
+ import assert from "node:assert/strict";
2
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import test from "node:test";
6
+ import { __testing } from "../extensions/gentle-ai.ts";
7
+
8
+ const { confirmCommand, evaluateGuardedCommand, loadRuntimeGuardrailsConfig, saveGuardedCommandAllowAlways } = __testing as {
9
+ confirmCommand: (command: string, ctx: unknown, events: unknown, herdrLifecycle: unknown, yoloActive?: boolean, autoGate?: unknown, superActive?: boolean) => Promise<{ block: true; reason: string } | undefined>;
10
+ evaluateGuardedCommand: (command: string, config: { autonomousMode: boolean; guardedCommands: Record<string, string> }) => { action: string; dataLoss?: boolean; key?: string };
11
+ loadRuntimeGuardrailsConfig: (cwd: string, options?: { gentlePiConfigHome?: string }) => { autonomousMode: boolean; guardedCommands: Record<string, string> };
12
+ saveGuardedCommandAllowAlways: (key: string, options?: { gentlePiConfigHome?: string }) => boolean;
13
+ };
14
+
15
+ interface Harness {
16
+ home: string;
17
+ pendingSelection: string | undefined;
18
+ selectCalls: Array<{ prompt: string; choices: string[] }>;
19
+ confirmCalls: string[];
20
+ selectWith(value: string | undefined): void;
21
+ setConfigHome(): void;
22
+ restoreConfigHome(): void;
23
+ ctx(sessionManager?: object): Record<string, unknown>;
24
+ events: { emitted: Array<{ state: string }>; emit(_name: string, payload: { state: string }): void };
25
+ lifecycle: { began: number; settled: number; begin(): void; settle(): void };
26
+ run(command: string, sessionManager?: object): Promise<{ block: true; reason: string } | undefined>;
27
+ }
28
+
29
+ function makeHarness(): Harness {
30
+ const home = mkdtempSync(join(tmpdir(), "permission-allowlist-"));
31
+ const previousConfigHome = process.env.GENTLE_PI_CONFIG_HOME;
32
+ const harness: Harness = {
33
+ home,
34
+ selectCalls: [],
35
+ confirmCalls: [],
36
+ pendingSelection: undefined as string | undefined,
37
+ selectWith(value: string | undefined) { harness.pendingSelection = value; },
38
+ setConfigHome() { process.env.GENTLE_PI_CONFIG_HOME = home; },
39
+ restoreConfigHome() {
40
+ if (previousConfigHome === undefined) delete process.env.GENTLE_PI_CONFIG_HOME;
41
+ else process.env.GENTLE_PI_CONFIG_HOME = previousConfigHome;
42
+ },
43
+ ctx(sessionManager: object = { id: "manager" }) {
44
+ return {
45
+ cwd: home,
46
+ sessionManager,
47
+ hasUI: true,
48
+ ui: {
49
+ select: async (prompt: string, choices: string[]) => {
50
+ harness.selectCalls.push({ prompt, choices });
51
+ return harness.pendingSelection;
52
+ },
53
+ confirm: async (title: string, _message: string) => {
54
+ harness.confirmCalls.push(title);
55
+ return harness.pendingSelection === "Allow once";
56
+ },
57
+ notify: () => {},
58
+ },
59
+ };
60
+ },
61
+ events: {
62
+ emitted: [],
63
+ emit(_name: string, payload: { state: string }) { harness.events.emitted.push(payload); },
64
+ },
65
+ lifecycle: {
66
+ began: 0, settled: 0,
67
+ begin() { harness.lifecycle.began += 1; },
68
+ settle() { harness.lifecycle.settled += 1; },
69
+ },
70
+ async run(command: string, sessionManager?: object) {
71
+ return await confirmCommand(command, harness.ctx(sessionManager), harness.events, harness.lifecycle);
72
+ },
73
+ };
74
+ return harness;
75
+ }
76
+
77
+ test("normal-mode confirmation dialog offers once, session and always scopes", async () => {
78
+ const harness = makeHarness();
79
+ harness.setConfigHome();
80
+ try {
81
+ harness.selectWith("Allow once");
82
+ const result = await harness.run("git push origin main", { id: "m1" });
83
+ assert.equal(result, undefined);
84
+ assert.equal(harness.selectCalls.length, 1);
85
+ const { prompt, choices } = harness.selectCalls[0];
86
+ assert.match(prompt, /git push origin main/);
87
+ assert.deepEqual(choices, ["Allow once", "Allow for this session", "Always allow git push", "Deny"]);
88
+ } finally { harness.restoreConfigHome(); rmSync(harness.home, { recursive: true, force: true }); }
89
+ });
90
+
91
+ test("allow once asks again; allow for this session remembers the exact command", async () => {
92
+ const harness = makeHarness();
93
+ harness.setConfigHome();
94
+ try {
95
+ const manager = { id: "m2" };
96
+ harness.selectWith("Allow once");
97
+ assert.equal(await harness.run("git push origin main", manager), undefined);
98
+ assert.equal(await harness.run("git push origin main", manager), undefined);
99
+ assert.equal(harness.selectCalls.length, 2);
100
+
101
+ const manager2 = { id: "m3" };
102
+ harness.selectWith("Allow for this session");
103
+ assert.equal(await harness.run("git push origin main", manager2), undefined);
104
+ assert.equal(await harness.run("git push origin main", manager2), undefined);
105
+ assert.equal(harness.selectCalls.length, 3);
106
+ // A different exact command asks again.
107
+ harness.selectWith("Allow for this session");
108
+ assert.equal(await harness.run("git push origin feature-branch", manager2), undefined);
109
+ assert.equal(harness.selectCalls.length, 4);
110
+ // A different session never inherits the grant.
111
+ harness.selectWith("Allow for this session");
112
+ assert.equal(await harness.run("git push origin main", { id: "m4" }), undefined);
113
+ assert.equal(harness.selectCalls.length, 5);
114
+ } finally { harness.restoreConfigHome(); rmSync(harness.home, { recursive: true, force: true }); }
115
+ });
116
+
117
+ test("deny keeps blocking with the existing reason and permission events", async () => {
118
+ const harness = makeHarness();
119
+ harness.setConfigHome();
120
+ try {
121
+ harness.selectWith("Deny");
122
+ const result = await harness.run("git push origin main", { id: "m5" });
123
+ assert.ok(result?.block);
124
+ assert.match(result.reason, /not confirmed/);
125
+ assert.deepEqual(harness.events.emitted.map(event => event.state), ["waiting", "denied"]);
126
+ assert.equal(harness.lifecycle.began, 1);
127
+ assert.equal(harness.lifecycle.settled, 1);
128
+ } finally { harness.restoreConfigHome(); rmSync(harness.home, { recursive: true, force: true }); }
129
+ });
130
+
131
+ test("data-loss commands never offer an always-allow scope", async () => {
132
+ const harness = makeHarness();
133
+ harness.setConfigHome();
134
+ try {
135
+ harness.selectWith("Allow for this session");
136
+ const manager = { id: "m6" };
137
+ assert.equal(await harness.run("rm -rf data", manager), undefined);
138
+ assert.equal(harness.selectCalls.length, 1);
139
+ const { choices } = harness.selectCalls[0];
140
+ assert.ok(choices.includes("Allow for this session"));
141
+ assert.ok(!choices.some(choice => choice.startsWith("Always allow")));
142
+ // The exact approved command asks no more this session.
143
+ assert.equal(await harness.run("rm -rf data", manager), undefined);
144
+ assert.equal(harness.selectCalls.length, 1);
145
+ } finally { harness.restoreConfigHome(); rmSync(harness.home, { recursive: true, force: true }); }
146
+ });
147
+
148
+ test("always allow persists the guarded key in the user config and future calls skip the dialog", async () => {
149
+ const harness = makeHarness();
150
+ harness.setConfigHome();
151
+ try {
152
+ const manager = { id: "m7" };
153
+ harness.selectWith("Always allow git push");
154
+ assert.equal(await harness.run("git push origin main", manager), undefined);
155
+ const configPath = join(harness.home, "runtime-guardrails.json");
156
+ assert.ok(existsSync(configPath));
157
+ const saved = JSON.parse(readFileSync(configPath, "utf8"));
158
+ assert.equal(saved.guardedCommands.gitPush, "allow");
159
+ // The persisted allow short-circuits evaluation in normal mode.
160
+ const evaluation = evaluateGuardedCommand("git push origin main", loadRuntimeGuardrailsConfig(harness.home));
161
+ assert.equal(evaluation.action, "allow");
162
+ // A brand-new session with the same command runs without any dialog.
163
+ assert.equal(await harness.run("git push origin main", { id: "m8" }), undefined);
164
+ assert.equal(harness.selectCalls.length, 1);
165
+ } finally { harness.restoreConfigHome(); rmSync(harness.home, { recursive: true, force: true }); }
166
+ });
167
+
168
+ test("saveGuardedCommandAllowAlways refuses to rewrite a malformed config", () => {
169
+ const home = mkdtempSync(join(tmpdir(), "permission-allowlist-malformed-"));
170
+ try {
171
+ mkdirSync(home, { recursive: true });
172
+ writeFileSync(join(home, "runtime-guardrails.json"), "{ not json");
173
+ assert.equal(saveGuardedCommandAllowAlways("gitPush", { gentlePiConfigHome: home }), false);
174
+ assert.equal(readFileSync(join(home, "runtime-guardrails.json"), "utf8"), "{ not json");
175
+ } finally { rmSync(home, { recursive: true, force: true }); }
176
+ });
177
+
178
+ test("host without ui.select keeps the plain confirm dialog", async () => {
179
+ const harness = makeHarness();
180
+ harness.setConfigHome();
181
+ try {
182
+ const manager = { id: "m9" };
183
+ const ctx = harness.ctx(manager) as { ui: Record<string, unknown> };
184
+ delete ctx.ui.select;
185
+ harness.pendingSelection = "Allow once";
186
+ const result = await confirmCommand("git push origin main", ctx, harness.events, harness.lifecycle);
187
+ assert.equal(result, undefined);
188
+ assert.equal(harness.confirmCalls.length, 1);
189
+ assert.equal(harness.selectCalls.length, 0);
190
+ assert.deepEqual(harness.events.emitted.map(event => event.state), ["waiting", "approved"]);
191
+ } finally { harness.restoreConfigHome(); rmSync(harness.home, { recursive: true, force: true }); }
192
+ });
193
+
194
+ test("normal mode keeps confirm default and honors explicit allow from user config", () => {
195
+ const config = { autonomousMode: false, guardedCommands: {} };
196
+ assert.equal(evaluateGuardedCommand("git push origin main", config).action, "confirm");
197
+ assert.equal(evaluateGuardedCommand("git rebase main", config).action, "confirm");
198
+ const allowConfig = { autonomousMode: false, guardedCommands: { gitPush: "allow" } };
199
+ assert.equal(evaluateGuardedCommand("git push origin main", allowConfig).action, "allow");
200
+ const confirmConfig = { autonomousMode: false, guardedCommands: { gitPush: "confirm" } };
201
+ assert.equal(evaluateGuardedCommand("git push origin main", confirmConfig).action, "confirm");
202
+ });
@@ -95,6 +95,14 @@ test('public all updates only its owner and then forwards extension updates', ()
95
95
  assert.equal(result.stderr, '');
96
96
  });
97
97
 
98
+ test('public all stops on ambiguous ownership before forwarding extensions', () => {
99
+ const result = launch(['update', '--all'], 'ambiguous');
100
+ assert.equal(result.status, 1);
101
+ assert.equal(result.stdout, '');
102
+ assert.match(result.stderr, /ownership/);
103
+ assert.doesNotMatch(result.stdout + result.stderr, /MUTATION|FORWARD/);
104
+ });
105
+
98
106
  for (const scenario of ['ambiguous', 'malformed', 'npm-link', 'npm-file', 'shared', 'adjacent-shared']) test(`public update rejects ${scenario} ownership without mutation`, () => {
99
107
  const result = launch(['update'], scenario);
100
108
  assert.equal(result.status, 1, result.stdout);
@@ -0,0 +1,58 @@
1
+ import assert from "node:assert/strict";
2
+ import { readdirSync, readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import test from "node:test";
5
+
6
+ // gentle-shell#2926: pnpm 11 runs an implicit `pnpm install` before
7
+ // `pnpm run`/`pnpm exec` unless verifyDepsBeforeRun is off. In a worktree whose
8
+ // node_modules links to another checkout that install tries to purge the shared
9
+ // node_modules and aborts without a TTY. These pins keep the setting, keep it
10
+ // out of published packages, and keep every workflow installing explicitly.
11
+
12
+ const root = join(import.meta.dirname, "..");
13
+ const read = (relative: string): string => readFileSync(join(root, relative), "utf8");
14
+
15
+ test("#2926: pnpm-workspace.yaml disables the implicit install before run", () => {
16
+ const workspace = read("pnpm-workspace.yaml");
17
+ const values = [...workspace.matchAll(/^verifyDepsBeforeRun:\s*(\S+)\s*$/gm)].map((match) => match[1]);
18
+ assert.deepEqual(values, ["false"], "verifyDepsBeforeRun must be set once to false; install and prompt break non-TTY shells");
19
+ assert.match(workspace, /^nodeLinker: hoisted$/m);
20
+ });
21
+
22
+ test("#2926: the repository pnpm-workspace.yaml is not published", () => {
23
+ const files = (JSON.parse(read("package.json")) as { files?: string[] }).files ?? [];
24
+ assert.ok(files.length > 0, "package.json must keep an explicit files allowlist");
25
+ assert.ok(!files.some((entry) => entry.replace(/^\.\//, "").startsWith("pnpm-workspace")), "pnpm-workspace.yaml must stay out of the package");
26
+ });
27
+
28
+ function workflowJobs(text: string): Array<{ name: string; body: string }> {
29
+ const jobsAt = text.search(/^jobs:\s*$/m);
30
+ if (jobsAt < 0) return [];
31
+ const jobs: Array<{ name: string; body: string }> = [];
32
+ let current: { name: string; lines: string[] } | undefined;
33
+ for (const line of text.slice(jobsAt).split("\n").slice(1)) {
34
+ const header = /^ {2}([A-Za-z0-9_-]+):\s*$/.exec(line);
35
+ if (header) {
36
+ if (current) jobs.push({ name: current.name, body: current.lines.join("\n") });
37
+ current = { name: header[1], lines: [] };
38
+ } else if (/^\S/.test(line)) break;
39
+ else current?.lines.push(line);
40
+ }
41
+ if (current) jobs.push({ name: current.name, body: current.lines.join("\n") });
42
+ return jobs;
43
+ }
44
+
45
+ test("#2926: every workflow job installs dependencies before pnpm test, run or exec", () => {
46
+ const dir = ".github/workflows";
47
+ let checked = 0;
48
+ for (const file of readdirSync(join(root, dir)).filter((name) => /\.ya?ml$/.test(name))) {
49
+ for (const job of workflowJobs(read(join(dir, file)))) {
50
+ const usesPnpm = job.body.search(/\bpnpm (test|run|exec)\b/);
51
+ if (usesPnpm < 0) continue;
52
+ checked++;
53
+ const install = job.body.search(/\bpnpm install --frozen-lockfile\b/);
54
+ assert.ok(install >= 0 && install < usesPnpm, `${file} job ${job.name} runs pnpm test/run/exec before pnpm install --frozen-lockfile`);
55
+ }
56
+ }
57
+ assert.ok(checked > 0, "expected at least one workflow job that runs pnpm test/run/exec");
58
+ });
@@ -99,3 +99,16 @@ test("a routing block whose ODD protocol section changed shape fails closed", ()
99
99
  const withoutSection = mirroredRoutingText().replace("### ODD protocol (MANDATORY, in this order, on every request)", "### ODD protocol");
100
100
  assert.throws(() => __testing.readMirroredOddProtocolSteps(tempRoutingMirror(withoutSection)), unexpectedShape);
101
101
  });
102
+
103
+ // Issue #2935: the confinement clause must deliver the resolved-skill-read
104
+ // exception in every mode without loosening the rest of the boundary.
105
+ test("Safety clause allows the task's exact resolved skill reads in every mode without new write rights", () => {
106
+ const line = renderPrimaryPrompt().split("\n").find(candidate => candidate.startsWith("- Keep session work inside the project root"));
107
+ assert.ok(line, "confinement clause is delivered");
108
+ for (const clause of [
109
+ "reading the task's exact resolved skill files needs no per-file question in any mode",
110
+ "Grants are per-target, per-session, never blanket: in-project scripts naming outside paths are not standing consent",
111
+ "ask before any read or write outside it, naming the absolute path",
112
+ "registered same-clone worktrees",
113
+ ]) assert.ok(line.includes(clause), `missing delivered clause: ${clause}`);
114
+ });
@@ -1,6 +1,7 @@
1
1
  import assert from "node:assert/strict";
2
- import { execFileSync } from "node:child_process";
2
+ import childProcess, { execFileSync } from "node:child_process";
3
3
  import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
+ import { syncBuiltinESMExports } from "node:module";
4
5
  import { tmpdir } from "node:os";
5
6
  import { join } from "node:path";
6
7
  import test, { after } from "node:test";
@@ -24,7 +25,7 @@ import {
24
25
  writeProfilePinSync,
25
26
  } from "../lib/agent-profile-pin.ts";
26
27
  import type { AgentModelConfig } from "../lib/model-routing-authority.ts";
27
- import type { WorktreeIdentity } from "../lib/session-worktree-registry.ts";
28
+ import { clearSessionWorktreeMemo, type WorktreeIdentity } from "../lib/session-worktree-registry.ts";
28
29
 
29
30
  // Per-repository agent-model profile pins: two layers holding only a profile name,
30
31
  // resolved at launch against the global profiles store. These tests never touch
@@ -368,3 +369,29 @@ test("normalizeProfilePin accepts only a value-level pin this version writes", (
368
369
  assert.equal(normalizeProfilePin({ kind: PROFILE_PIN_KIND, version: PROFILE_PIN_VERSION, profile: "bad name" }), undefined);
369
370
  assert.equal(normalizeProfilePin("deep-work"), undefined);
370
371
  });
372
+
373
+ test("repeated profile pin status reads share a single Git resolution through the memoized resolver (#2922)", (t) => {
374
+ const repo = join(root, "memoized-status-reads");
375
+ mkdirSync(repo, { recursive: true });
376
+ execFileSync("git", ["init", "--quiet", repo]);
377
+ clearSessionWorktreeMemo();
378
+
379
+ let spawns = 0;
380
+ const original = childProcess.execFileSync;
381
+ childProcess.execFileSync = ((...args: Parameters<typeof original>) => {
382
+ if (args[0] === "git") spawns++;
383
+ return original(...args);
384
+ }) as typeof original;
385
+ syncBuiltinESMExports();
386
+ t.after(() => {
387
+ childProcess.execFileSync = original;
388
+ syncBuiltinESMExports();
389
+ });
390
+
391
+ const first = readProfilePinStatus(repo);
392
+ assert.ok(first);
393
+ for (let i = 0; i < 5; i++) {
394
+ assert.deepEqual(readProfilePinStatus(repo), first);
395
+ }
396
+ assert.equal(spawns, 2, "repeated status reads must not spawn additional git rev-parse children");
397
+ });
@@ -50,6 +50,11 @@ test("bottom bar places configured Fast or Standard beside effort without changi
50
50
  assert.deepEqual(renderShellBar(configured, theme, 120), renderShellBar(base, theme, 120));
51
51
  }
52
52
  assert.doesNotMatch(renderShellStatusBar(base, theme, 120).rows[0]!, /No tier|Fast|Standard|server/);
53
+ const both = { ...base, profileTier: "fast" as const, profile: "team (session)" };
54
+ assert.match(renderShellStatusBar(both, theme, 140).rows[0]!, /gpt-6\.1-sol · xhigh · Fast · team \(session\) │/, "the profile follows the tier");
55
+ const tight = renderShellStatusBar(both, theme, 72).rows[0]!;
56
+ assert.match(tight, /gpt-6\.1-sol · xhigh · Fast/, "the profile gives way before the tier");
57
+ assert.doesNotMatch(tight, /team \(session\)/);
53
58
  });
54
59
 
55
60
  test("legacy tier integration is excluded while permission warnings and other statuses survive", () => {