@memnexus-ai/mx-agent-cli 0.1.294 → 0.1.295-next.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 (637) hide show
  1. package/dist/__tests__/agents-md-canonicalization.test.js +31 -1
  2. package/dist/__tests__/agents-md-canonicalization.test.js.map +1 -1
  3. package/dist/__tests__/behavioral-extraction.test.js +50 -0
  4. package/dist/__tests__/behavioral-extraction.test.js.map +1 -1
  5. package/dist/__tests__/bootstrap-behavioral-contract.test.js +6 -3
  6. package/dist/__tests__/bootstrap-behavioral-contract.test.js.map +1 -1
  7. package/dist/__tests__/bundle-config.test.js +28 -2
  8. package/dist/__tests__/bundle-config.test.js.map +1 -1
  9. package/dist/__tests__/catalog-interaction.test.d.ts +25 -0
  10. package/dist/__tests__/catalog-interaction.test.d.ts.map +1 -0
  11. package/dist/__tests__/catalog-interaction.test.js +269 -0
  12. package/dist/__tests__/catalog-interaction.test.js.map +1 -0
  13. package/dist/__tests__/catalog-named-memories.test.d.ts +2 -0
  14. package/dist/__tests__/catalog-named-memories.test.d.ts.map +1 -0
  15. package/dist/__tests__/catalog-named-memories.test.js +204 -0
  16. package/dist/__tests__/catalog-named-memories.test.js.map +1 -0
  17. package/dist/__tests__/catalog-origin-main.test.d.ts +15 -0
  18. package/dist/__tests__/catalog-origin-main.test.d.ts.map +1 -0
  19. package/dist/__tests__/catalog-origin-main.test.js +296 -0
  20. package/dist/__tests__/catalog-origin-main.test.js.map +1 -0
  21. package/dist/__tests__/catalog.test.d.ts +2 -0
  22. package/dist/__tests__/catalog.test.d.ts.map +1 -0
  23. package/dist/__tests__/catalog.test.js +131 -0
  24. package/dist/__tests__/catalog.test.js.map +1 -0
  25. package/dist/__tests__/cli-build-integration.test.d.ts +2 -0
  26. package/dist/__tests__/cli-build-integration.test.d.ts.map +1 -0
  27. package/dist/__tests__/cli-build-integration.test.js +64 -0
  28. package/dist/__tests__/cli-build-integration.test.js.map +1 -0
  29. package/dist/__tests__/cli-build.test.d.ts +2 -0
  30. package/dist/__tests__/cli-build.test.d.ts.map +1 -0
  31. package/dist/__tests__/cli-build.test.js +640 -0
  32. package/dist/__tests__/cli-build.test.js.map +1 -0
  33. package/dist/__tests__/codex-deploy-config.test.js +60 -0
  34. package/dist/__tests__/codex-deploy-config.test.js.map +1 -1
  35. package/dist/__tests__/completion-rows-discriminate.test.d.ts +20 -0
  36. package/dist/__tests__/completion-rows-discriminate.test.d.ts.map +1 -0
  37. package/dist/__tests__/completion-rows-discriminate.test.js +481 -0
  38. package/dist/__tests__/completion-rows-discriminate.test.js.map +1 -0
  39. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts +2 -0
  40. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts.map +1 -0
  41. package/dist/__tests__/config-fidelity-archived-symlinks.test.js +127 -0
  42. package/dist/__tests__/config-fidelity-archived-symlinks.test.js.map +1 -0
  43. package/dist/__tests__/config-fidelity-display.test.d.ts +2 -0
  44. package/dist/__tests__/config-fidelity-display.test.d.ts.map +1 -0
  45. package/dist/__tests__/config-fidelity-display.test.js +77 -0
  46. package/dist/__tests__/config-fidelity-display.test.js.map +1 -0
  47. package/dist/__tests__/config-fidelity.test.js +166 -33
  48. package/dist/__tests__/config-fidelity.test.js.map +1 -1
  49. package/dist/__tests__/config-generation-gate.test.js +78 -0
  50. package/dist/__tests__/config-generation-gate.test.js.map +1 -1
  51. package/dist/__tests__/config-sync.test.js +89 -1
  52. package/dist/__tests__/config-sync.test.js.map +1 -1
  53. package/dist/__tests__/coordination-401-production-wiring.test.js +12 -7
  54. package/dist/__tests__/coordination-401-production-wiring.test.js.map +1 -1
  55. package/dist/__tests__/coordination-401-recovery.test.js +39 -32
  56. package/dist/__tests__/coordination-401-recovery.test.js.map +1 -1
  57. package/dist/__tests__/coordination-brief-pin.test.js +21 -8
  58. package/dist/__tests__/coordination-brief-pin.test.js.map +1 -1
  59. package/dist/__tests__/coordination-client.test.js +227 -3
  60. package/dist/__tests__/coordination-client.test.js.map +1 -1
  61. package/dist/__tests__/coordination-credential-endpoint.test.d.ts +24 -0
  62. package/dist/__tests__/coordination-credential-endpoint.test.d.ts.map +1 -0
  63. package/dist/__tests__/coordination-credential-endpoint.test.js +1230 -0
  64. package/dist/__tests__/coordination-credential-endpoint.test.js.map +1 -0
  65. package/dist/__tests__/coordination-memory.test.js +20 -4
  66. package/dist/__tests__/coordination-memory.test.js.map +1 -1
  67. package/dist/__tests__/coordination-provision.test.js +22 -14
  68. package/dist/__tests__/coordination-provision.test.js.map +1 -1
  69. package/dist/__tests__/coordination-status-registration.test.d.ts +16 -0
  70. package/dist/__tests__/coordination-status-registration.test.d.ts.map +1 -0
  71. package/dist/__tests__/coordination-status-registration.test.js +480 -0
  72. package/dist/__tests__/coordination-status-registration.test.js.map +1 -0
  73. package/dist/__tests__/coordination-token-multitenant.test.js +11 -11
  74. package/dist/__tests__/coordination-token-multitenant.test.js.map +1 -1
  75. package/dist/__tests__/coordination-token.test.js +35 -28
  76. package/dist/__tests__/coordination-token.test.js.map +1 -1
  77. package/dist/__tests__/creation-pr-class-check.test.d.ts +17 -0
  78. package/dist/__tests__/creation-pr-class-check.test.d.ts.map +1 -0
  79. package/dist/__tests__/creation-pr-class-check.test.js +346 -0
  80. package/dist/__tests__/creation-pr-class-check.test.js.map +1 -0
  81. package/dist/__tests__/decision-check.test.d.ts +2 -0
  82. package/dist/__tests__/decision-check.test.d.ts.map +1 -0
  83. package/dist/__tests__/decision-check.test.js +105 -0
  84. package/dist/__tests__/decision-check.test.js.map +1 -0
  85. package/dist/__tests__/digest-team-omission.test.d.ts +15 -0
  86. package/dist/__tests__/digest-team-omission.test.d.ts.map +1 -0
  87. package/dist/__tests__/digest-team-omission.test.js +247 -0
  88. package/dist/__tests__/digest-team-omission.test.js.map +1 -0
  89. package/dist/__tests__/doctor-worktree-path.test.d.ts +17 -0
  90. package/dist/__tests__/doctor-worktree-path.test.d.ts.map +1 -0
  91. package/dist/__tests__/doctor-worktree-path.test.js +158 -0
  92. package/dist/__tests__/doctor-worktree-path.test.js.map +1 -0
  93. package/dist/__tests__/fleet-data.test.js +40 -7
  94. package/dist/__tests__/fleet-data.test.js.map +1 -1
  95. package/dist/__tests__/fleet-tmux.test.js +2 -2
  96. package/dist/__tests__/fleet-tmux.test.js.map +1 -1
  97. package/dist/__tests__/generate-claude.test.js +137 -3
  98. package/dist/__tests__/generate-claude.test.js.map +1 -1
  99. package/dist/__tests__/git-env.test.d.ts +14 -0
  100. package/dist/__tests__/git-env.test.d.ts.map +1 -0
  101. package/dist/__tests__/git-env.test.js +131 -0
  102. package/dist/__tests__/git-env.test.js.map +1 -0
  103. package/dist/__tests__/git-identity-isolation.test.d.ts +33 -0
  104. package/dist/__tests__/git-identity-isolation.test.d.ts.map +1 -0
  105. package/dist/__tests__/git-identity-isolation.test.js +626 -0
  106. package/dist/__tests__/git-identity-isolation.test.js.map +1 -0
  107. package/dist/__tests__/harness-extract.test.d.ts +19 -0
  108. package/dist/__tests__/harness-extract.test.d.ts.map +1 -0
  109. package/dist/__tests__/harness-extract.test.js +566 -0
  110. package/dist/__tests__/harness-extract.test.js.map +1 -0
  111. package/dist/__tests__/harness-wiring.test.d.ts +16 -0
  112. package/dist/__tests__/harness-wiring.test.d.ts.map +1 -0
  113. package/dist/__tests__/harness-wiring.test.js +469 -0
  114. package/dist/__tests__/harness-wiring.test.js.map +1 -0
  115. package/dist/__tests__/hook-heal.test.js +17 -0
  116. package/dist/__tests__/hook-heal.test.js.map +1 -1
  117. package/dist/__tests__/init-coordination-url.test.d.ts +11 -0
  118. package/dist/__tests__/init-coordination-url.test.d.ts.map +1 -0
  119. package/dist/__tests__/init-coordination-url.test.js +114 -0
  120. package/dist/__tests__/init-coordination-url.test.js.map +1 -0
  121. package/dist/__tests__/memory-autocreate.test.js +574 -8
  122. package/dist/__tests__/memory-autocreate.test.js.map +1 -1
  123. package/dist/__tests__/memory-log-result.test.d.ts +13 -0
  124. package/dist/__tests__/memory-log-result.test.d.ts.map +1 -0
  125. package/dist/__tests__/memory-log-result.test.js +113 -0
  126. package/dist/__tests__/memory-log-result.test.js.map +1 -0
  127. package/dist/__tests__/memory-named-exists.test.d.ts +16 -0
  128. package/dist/__tests__/memory-named-exists.test.d.ts.map +1 -0
  129. package/dist/__tests__/memory-named-exists.test.js +288 -0
  130. package/dist/__tests__/memory-named-exists.test.js.map +1 -0
  131. package/dist/__tests__/mx-agent-cli-pin-validation.test.js +23 -47
  132. package/dist/__tests__/mx-agent-cli-pin-validation.test.js.map +1 -1
  133. package/dist/__tests__/mx-agent-cli-version-pin.test.js +34 -88
  134. package/dist/__tests__/mx-agent-cli-version-pin.test.js.map +1 -1
  135. package/dist/__tests__/new-project-first-team.test.d.ts +15 -0
  136. package/dist/__tests__/new-project-first-team.test.d.ts.map +1 -0
  137. package/dist/__tests__/new-project-first-team.test.js +263 -0
  138. package/dist/__tests__/new-project-first-team.test.js.map +1 -0
  139. package/dist/__tests__/otel-env.test.d.ts +2 -0
  140. package/dist/__tests__/otel-env.test.d.ts.map +1 -0
  141. package/dist/__tests__/otel-env.test.js +127 -0
  142. package/dist/__tests__/otel-env.test.js.map +1 -0
  143. package/dist/__tests__/project-config.test.js +283 -1
  144. package/dist/__tests__/project-config.test.js.map +1 -1
  145. package/dist/__tests__/provision-behavioral-contract.test.js +96 -4
  146. package/dist/__tests__/provision-behavioral-contract.test.js.map +1 -1
  147. package/dist/__tests__/provision-catalog-precondition.test.d.ts +26 -0
  148. package/dist/__tests__/provision-catalog-precondition.test.d.ts.map +1 -0
  149. package/dist/__tests__/provision-catalog-precondition.test.js +620 -0
  150. package/dist/__tests__/provision-catalog-precondition.test.js.map +1 -0
  151. package/dist/__tests__/provision-completion-rows.test.d.ts +17 -0
  152. package/dist/__tests__/provision-completion-rows.test.d.ts.map +1 -0
  153. package/dist/__tests__/provision-completion-rows.test.js +3095 -0
  154. package/dist/__tests__/provision-completion-rows.test.js.map +1 -0
  155. package/dist/__tests__/provision-identity-gate.test.d.ts +20 -0
  156. package/dist/__tests__/provision-identity-gate.test.d.ts.map +1 -0
  157. package/dist/__tests__/provision-identity-gate.test.js +600 -0
  158. package/dist/__tests__/provision-identity-gate.test.js.map +1 -0
  159. package/dist/__tests__/provision-resume.test.d.ts +26 -0
  160. package/dist/__tests__/provision-resume.test.d.ts.map +1 -0
  161. package/dist/__tests__/provision-resume.test.js +1164 -0
  162. package/dist/__tests__/provision-resume.test.js.map +1 -0
  163. package/dist/__tests__/provision-roleguide-anchors.test.d.ts +27 -0
  164. package/dist/__tests__/provision-roleguide-anchors.test.d.ts.map +1 -0
  165. package/dist/__tests__/provision-roleguide-anchors.test.js +747 -0
  166. package/dist/__tests__/provision-roleguide-anchors.test.js.map +1 -0
  167. package/dist/__tests__/provision-skeleton-fill.test.d.ts +16 -0
  168. package/dist/__tests__/provision-skeleton-fill.test.d.ts.map +1 -0
  169. package/dist/__tests__/provision-skeleton-fill.test.js +488 -0
  170. package/dist/__tests__/provision-skeleton-fill.test.js.map +1 -0
  171. package/dist/__tests__/provision-teambuilder-flow.test.js +93 -7
  172. package/dist/__tests__/provision-teambuilder-flow.test.js.map +1 -1
  173. package/dist/__tests__/repo-guard-wiring.test.d.ts +21 -0
  174. package/dist/__tests__/repo-guard-wiring.test.d.ts.map +1 -0
  175. package/dist/__tests__/repo-guard-wiring.test.js +638 -0
  176. package/dist/__tests__/repo-guard-wiring.test.js.map +1 -0
  177. package/dist/__tests__/report-format.test.d.ts +2 -0
  178. package/dist/__tests__/report-format.test.d.ts.map +1 -0
  179. package/dist/__tests__/report-format.test.js +219 -0
  180. package/dist/__tests__/report-format.test.js.map +1 -0
  181. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts +2 -0
  182. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts.map +1 -0
  183. package/dist/__tests__/runtime-codex-gateway-pilot.test.js +309 -0
  184. package/dist/__tests__/runtime-codex-gateway-pilot.test.js.map +1 -0
  185. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts +2 -0
  186. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts.map +1 -0
  187. package/dist/__tests__/runtime-codex-gateway-provider.test.js +163 -0
  188. package/dist/__tests__/runtime-codex-gateway-provider.test.js.map +1 -0
  189. package/dist/__tests__/runtime-identity.test.d.ts +2 -0
  190. package/dist/__tests__/runtime-identity.test.d.ts.map +1 -0
  191. package/dist/__tests__/runtime-identity.test.js +117 -0
  192. package/dist/__tests__/runtime-identity.test.js.map +1 -0
  193. package/dist/__tests__/session-pause-provisioning.test.js +6 -1
  194. package/dist/__tests__/session-pause-provisioning.test.js.map +1 -1
  195. package/dist/__tests__/session-record-disclosure.test.d.ts +24 -0
  196. package/dist/__tests__/session-record-disclosure.test.d.ts.map +1 -0
  197. package/dist/__tests__/session-record-disclosure.test.js +494 -0
  198. package/dist/__tests__/session-record-disclosure.test.js.map +1 -0
  199. package/dist/__tests__/session.test.js +35 -0
  200. package/dist/__tests__/session.test.js.map +1 -1
  201. package/dist/__tests__/slug-validation.test.js +27 -21
  202. package/dist/__tests__/slug-validation.test.js.map +1 -1
  203. package/dist/__tests__/standards-injection.test.d.ts +2 -0
  204. package/dist/__tests__/standards-injection.test.d.ts.map +1 -0
  205. package/dist/__tests__/standards-injection.test.js +179 -0
  206. package/dist/__tests__/standards-injection.test.js.map +1 -0
  207. package/dist/__tests__/start-interactive-role.test.d.ts +22 -0
  208. package/dist/__tests__/start-interactive-role.test.d.ts.map +1 -0
  209. package/dist/__tests__/start-interactive-role.test.js +204 -0
  210. package/dist/__tests__/start-interactive-role.test.js.map +1 -0
  211. package/dist/__tests__/start-team-identity.test.d.ts +25 -0
  212. package/dist/__tests__/start-team-identity.test.d.ts.map +1 -0
  213. package/dist/__tests__/start-team-identity.test.js +307 -0
  214. package/dist/__tests__/start-team-identity.test.js.map +1 -0
  215. package/dist/__tests__/team-memory-commands.test.js +142 -19
  216. package/dist/__tests__/team-memory-commands.test.js.map +1 -1
  217. package/dist/__tests__/template-sync.test.d.ts +19 -0
  218. package/dist/__tests__/template-sync.test.d.ts.map +1 -0
  219. package/dist/__tests__/template-sync.test.js +270 -0
  220. package/dist/__tests__/template-sync.test.js.map +1 -0
  221. package/dist/__tests__/test-project.test.d.ts +18 -0
  222. package/dist/__tests__/test-project.test.d.ts.map +1 -0
  223. package/dist/__tests__/test-project.test.js +465 -0
  224. package/dist/__tests__/test-project.test.js.map +1 -0
  225. package/dist/__tests__/usage-per-call-grouping.test.d.ts +25 -0
  226. package/dist/__tests__/usage-per-call-grouping.test.d.ts.map +1 -0
  227. package/dist/__tests__/usage-per-call-grouping.test.js +952 -0
  228. package/dist/__tests__/usage-per-call-grouping.test.js.map +1 -0
  229. package/dist/__tests__/verify-hooks-check-all.test.d.ts +32 -0
  230. package/dist/__tests__/verify-hooks-check-all.test.d.ts.map +1 -0
  231. package/dist/__tests__/verify-hooks-check-all.test.js +553 -0
  232. package/dist/__tests__/verify-hooks-check-all.test.js.map +1 -0
  233. package/dist/__tests__/worktree-sync-fixture.test.d.ts +17 -0
  234. package/dist/__tests__/worktree-sync-fixture.test.d.ts.map +1 -0
  235. package/dist/__tests__/worktree-sync-fixture.test.js +519 -0
  236. package/dist/__tests__/worktree-sync-fixture.test.js.map +1 -0
  237. package/dist/__tests__/worktree-sync-hardening.test.d.ts +13 -0
  238. package/dist/__tests__/worktree-sync-hardening.test.d.ts.map +1 -0
  239. package/dist/__tests__/worktree-sync-hardening.test.js +919 -0
  240. package/dist/__tests__/worktree-sync-hardening.test.js.map +1 -0
  241. package/dist/__tests__/worktree-sync-shell-free.test.d.ts +25 -0
  242. package/dist/__tests__/worktree-sync-shell-free.test.d.ts.map +1 -0
  243. package/dist/__tests__/worktree-sync-shell-free.test.js +185 -0
  244. package/dist/__tests__/worktree-sync-shell-free.test.js.map +1 -0
  245. package/dist/__tests__/worktree.test.js +75 -1
  246. package/dist/__tests__/worktree.test.js.map +1 -1
  247. package/dist/agent-config/.mx-config-generation.json +2 -2
  248. package/dist/agent-config/AGENTS.md.template +2 -2
  249. package/dist/agent-config/agents/bar-raiser.md +34 -1
  250. package/dist/agent-config/agents/red-team.md +34 -1
  251. package/dist/agent-config/agents/security-reviewer.md +22 -1
  252. package/dist/agent-config/claude-md/CLAUDE.core.md +6 -1
  253. package/dist/agent-config/claude-md/CLAUDE.overlay.memnexus.md +1 -3
  254. package/dist/agent-config/coordination-rosters.generated.json +10 -0
  255. package/dist/agent-config/hooks/HOOK-TIMEOUTS.md +27 -1
  256. package/dist/agent-config/hooks/OR-TRUE-AUDIT.md +8 -8
  257. package/dist/agent-config/hooks/auto-capture-precompact.sh +180 -83
  258. package/dist/agent-config/hooks/auto-capture-session-end.sh +216 -87
  259. package/dist/agent-config/hooks/auto-checkpoint.sh +75 -5
  260. package/dist/agent-config/hooks/coordination-brief.sh +290 -245
  261. package/dist/agent-config/hooks/deploy-verification-reminder.sh +359 -22
  262. package/dist/agent-config/hooks/git-mutation-guard.sh +85 -13
  263. package/dist/agent-config/hooks/observability-sync.sh +46 -9
  264. package/dist/agent-config/hooks/session-idle-gate.sh +177 -12
  265. package/dist/agent-config/hooks/subagent-write-guard.sh +670 -0
  266. package/dist/agent-config/hooks/worktree-guard.sh +36 -7
  267. package/dist/agent-config/settings.json +15 -2
  268. package/dist/agent-config/shared/creation-pr-review-checklist.md +317 -0
  269. package/dist/commands/bootstrap.d.ts.map +1 -1
  270. package/dist/commands/bootstrap.js +22 -10
  271. package/dist/commands/bootstrap.js.map +1 -1
  272. package/dist/commands/config-sync.d.ts +37 -0
  273. package/dist/commands/config-sync.d.ts.map +1 -1
  274. package/dist/commands/config-sync.js +36 -18
  275. package/dist/commands/config-sync.js.map +1 -1
  276. package/dist/commands/config.d.ts.map +1 -1
  277. package/dist/commands/config.js +28 -1
  278. package/dist/commands/config.js.map +1 -1
  279. package/dist/commands/coordination.d.ts +150 -8
  280. package/dist/commands/coordination.d.ts.map +1 -1
  281. package/dist/commands/coordination.js +519 -25
  282. package/dist/commands/coordination.js.map +1 -1
  283. package/dist/commands/create.d.ts +913 -1
  284. package/dist/commands/create.d.ts.map +1 -1
  285. package/dist/commands/create.js +4879 -345
  286. package/dist/commands/create.js.map +1 -1
  287. package/dist/commands/dashboard.d.ts.map +1 -1
  288. package/dist/commands/dashboard.js +10 -2
  289. package/dist/commands/dashboard.js.map +1 -1
  290. package/dist/commands/decision.d.ts +20 -0
  291. package/dist/commands/decision.d.ts.map +1 -0
  292. package/dist/commands/decision.js +54 -0
  293. package/dist/commands/decision.js.map +1 -0
  294. package/dist/commands/digest.d.ts.map +1 -1
  295. package/dist/commands/digest.js +91 -7
  296. package/dist/commands/digest.js.map +1 -1
  297. package/dist/commands/fleet-tmux.js +1 -1
  298. package/dist/commands/fleet-tmux.js.map +1 -1
  299. package/dist/commands/init.d.ts +8 -0
  300. package/dist/commands/init.d.ts.map +1 -1
  301. package/dist/commands/init.js +26 -1
  302. package/dist/commands/init.js.map +1 -1
  303. package/dist/commands/list.d.ts +32 -1
  304. package/dist/commands/list.d.ts.map +1 -1
  305. package/dist/commands/list.js +98 -5
  306. package/dist/commands/list.js.map +1 -1
  307. package/dist/commands/monitor.d.ts.map +1 -1
  308. package/dist/commands/monitor.js +8 -2
  309. package/dist/commands/monitor.js.map +1 -1
  310. package/dist/commands/new.d.ts +2 -0
  311. package/dist/commands/new.d.ts.map +1 -1
  312. package/dist/commands/new.js +114 -21
  313. package/dist/commands/new.js.map +1 -1
  314. package/dist/commands/report.d.ts +33 -0
  315. package/dist/commands/report.d.ts.map +1 -0
  316. package/dist/commands/report.js +73 -0
  317. package/dist/commands/report.js.map +1 -0
  318. package/dist/commands/session.js +1 -1
  319. package/dist/commands/session.js.map +1 -1
  320. package/dist/commands/start.d.ts +42 -0
  321. package/dist/commands/start.d.ts.map +1 -1
  322. package/dist/commands/start.js +177 -8
  323. package/dist/commands/start.js.map +1 -1
  324. package/dist/commands/sync.d.ts +57 -0
  325. package/dist/commands/sync.d.ts.map +1 -1
  326. package/dist/commands/sync.js +117 -3
  327. package/dist/commands/sync.js.map +1 -1
  328. package/dist/commands/update.d.ts +13 -1
  329. package/dist/commands/update.d.ts.map +1 -1
  330. package/dist/commands/update.js +50 -1
  331. package/dist/commands/update.js.map +1 -1
  332. package/dist/commands/usage.d.ts +64 -0
  333. package/dist/commands/usage.d.ts.map +1 -1
  334. package/dist/commands/usage.js +96 -3
  335. package/dist/commands/usage.js.map +1 -1
  336. package/dist/commands/verify-hooks.d.ts +37 -1
  337. package/dist/commands/verify-hooks.d.ts.map +1 -1
  338. package/dist/commands/verify-hooks.js +114 -2
  339. package/dist/commands/verify-hooks.js.map +1 -1
  340. package/dist/commands/window.d.ts +10 -0
  341. package/dist/commands/window.d.ts.map +1 -0
  342. package/dist/commands/window.js +265 -0
  343. package/dist/commands/window.js.map +1 -0
  344. package/dist/commands/worktree-sync.d.ts +54 -0
  345. package/dist/commands/worktree-sync.d.ts.map +1 -0
  346. package/dist/commands/worktree-sync.js +135 -0
  347. package/dist/commands/worktree-sync.js.map +1 -0
  348. package/dist/index.d.ts.map +1 -1
  349. package/dist/index.js +189 -14
  350. package/dist/index.js.map +1 -1
  351. package/dist/lib/agent-session.d.ts +12 -0
  352. package/dist/lib/agent-session.d.ts.map +1 -1
  353. package/dist/lib/agent-session.js +189 -42
  354. package/dist/lib/agent-session.js.map +1 -1
  355. package/dist/lib/catalog.d.ts +321 -2
  356. package/dist/lib/catalog.d.ts.map +1 -1
  357. package/dist/lib/catalog.js +490 -11
  358. package/dist/lib/catalog.js.map +1 -1
  359. package/dist/lib/claude.d.ts +65 -23
  360. package/dist/lib/claude.d.ts.map +1 -1
  361. package/dist/lib/claude.js +335 -19
  362. package/dist/lib/claude.js.map +1 -1
  363. package/dist/lib/cli-build.d.ts +172 -0
  364. package/dist/lib/cli-build.d.ts.map +1 -0
  365. package/dist/lib/cli-build.js +654 -0
  366. package/dist/lib/cli-build.js.map +1 -0
  367. package/dist/lib/code-context-file.d.ts +109 -0
  368. package/dist/lib/code-context-file.d.ts.map +1 -0
  369. package/dist/lib/code-context-file.js +219 -0
  370. package/dist/lib/code-context-file.js.map +1 -0
  371. package/dist/lib/code-context-file.test.d.ts +19 -0
  372. package/dist/lib/code-context-file.test.d.ts.map +1 -0
  373. package/dist/lib/code-context-file.test.js +202 -0
  374. package/dist/lib/code-context-file.test.js.map +1 -0
  375. package/dist/lib/config-fidelity.d.ts +40 -20
  376. package/dist/lib/config-fidelity.d.ts.map +1 -1
  377. package/dist/lib/config-fidelity.js +144 -56
  378. package/dist/lib/config-fidelity.js.map +1 -1
  379. package/dist/lib/coordination-client.d.ts +73 -0
  380. package/dist/lib/coordination-client.d.ts.map +1 -1
  381. package/dist/lib/coordination-client.js +180 -8
  382. package/dist/lib/coordination-client.js.map +1 -1
  383. package/dist/lib/coordination-token.d.ts +304 -6
  384. package/dist/lib/coordination-token.d.ts.map +1 -1
  385. package/dist/lib/coordination-token.js +851 -52
  386. package/dist/lib/coordination-token.js.map +1 -1
  387. package/dist/lib/decision-check.d.ts +48 -0
  388. package/dist/lib/decision-check.d.ts.map +1 -0
  389. package/dist/lib/decision-check.js +149 -0
  390. package/dist/lib/decision-check.js.map +1 -0
  391. package/dist/lib/fleet-data.d.ts +34 -0
  392. package/dist/lib/fleet-data.d.ts.map +1 -1
  393. package/dist/lib/fleet-data.js +37 -9
  394. package/dist/lib/fleet-data.js.map +1 -1
  395. package/dist/lib/fleet-render.js +1 -1
  396. package/dist/lib/fleet-render.js.map +1 -1
  397. package/dist/lib/git-identity.d.ts +302 -0
  398. package/dist/lib/git-identity.d.ts.map +1 -0
  399. package/dist/lib/git-identity.js +546 -0
  400. package/dist/lib/git-identity.js.map +1 -0
  401. package/dist/lib/harness/console/announce.d.ts +45 -0
  402. package/dist/lib/harness/console/announce.d.ts.map +1 -0
  403. package/dist/lib/harness/console/announce.js +48 -0
  404. package/dist/lib/harness/console/announce.js.map +1 -0
  405. package/dist/lib/harness/console/announce.test.d.ts +2 -0
  406. package/dist/lib/harness/console/announce.test.d.ts.map +1 -0
  407. package/dist/lib/harness/console/announce.test.js +104 -0
  408. package/dist/lib/harness/console/announce.test.js.map +1 -0
  409. package/dist/lib/harness/console/by-session.d.ts +50 -0
  410. package/dist/lib/harness/console/by-session.d.ts.map +1 -0
  411. package/dist/lib/harness/console/by-session.js +83 -0
  412. package/dist/lib/harness/console/by-session.js.map +1 -0
  413. package/dist/lib/harness/console/by-session.test.d.ts +2 -0
  414. package/dist/lib/harness/console/by-session.test.d.ts.map +1 -0
  415. package/dist/lib/harness/console/by-session.test.js +86 -0
  416. package/dist/lib/harness/console/by-session.test.js.map +1 -0
  417. package/dist/lib/harness/console/console.d.ts +67 -0
  418. package/dist/lib/harness/console/console.d.ts.map +1 -0
  419. package/dist/lib/harness/console/console.js +373 -0
  420. package/dist/lib/harness/console/console.js.map +1 -0
  421. package/dist/lib/harness/console/console.test.d.ts +2 -0
  422. package/dist/lib/harness/console/console.test.d.ts.map +1 -0
  423. package/dist/lib/harness/console/console.test.js +269 -0
  424. package/dist/lib/harness/console/console.test.js.map +1 -0
  425. package/dist/lib/harness/console/decision-request.d.ts +32 -0
  426. package/dist/lib/harness/console/decision-request.d.ts.map +1 -0
  427. package/dist/lib/harness/console/decision-request.js +112 -0
  428. package/dist/lib/harness/console/decision-request.js.map +1 -0
  429. package/dist/lib/harness/console/decision-request.test.d.ts +2 -0
  430. package/dist/lib/harness/console/decision-request.test.d.ts.map +1 -0
  431. package/dist/lib/harness/console/decision-request.test.js +75 -0
  432. package/dist/lib/harness/console/decision-request.test.js.map +1 -0
  433. package/dist/lib/harness/console/fixtures.d.ts +16 -0
  434. package/dist/lib/harness/console/fixtures.d.ts.map +1 -0
  435. package/dist/lib/harness/console/fixtures.js +49 -0
  436. package/dist/lib/harness/console/fixtures.js.map +1 -0
  437. package/dist/lib/harness/console/index.d.ts +15 -0
  438. package/dist/lib/harness/console/index.d.ts.map +1 -0
  439. package/dist/lib/harness/console/index.js +14 -0
  440. package/dist/lib/harness/console/index.js.map +1 -0
  441. package/dist/lib/harness/console/rank.d.ts +73 -0
  442. package/dist/lib/harness/console/rank.d.ts.map +1 -0
  443. package/dist/lib/harness/console/rank.js +113 -0
  444. package/dist/lib/harness/console/rank.js.map +1 -0
  445. package/dist/lib/harness/console/rank.test.d.ts +2 -0
  446. package/dist/lib/harness/console/rank.test.d.ts.map +1 -0
  447. package/dist/lib/harness/console/rank.test.js +124 -0
  448. package/dist/lib/harness/console/rank.test.js.map +1 -0
  449. package/dist/lib/harness/console/render.d.ts +22 -0
  450. package/dist/lib/harness/console/render.d.ts.map +1 -0
  451. package/dist/lib/harness/console/render.js +65 -0
  452. package/dist/lib/harness/console/render.js.map +1 -0
  453. package/dist/lib/harness/console/render.test.d.ts +2 -0
  454. package/dist/lib/harness/console/render.test.d.ts.map +1 -0
  455. package/dist/lib/harness/console/render.test.js +96 -0
  456. package/dist/lib/harness/console/render.test.js.map +1 -0
  457. package/dist/lib/harness/console/replay-cli.test.d.ts +2 -0
  458. package/dist/lib/harness/console/replay-cli.test.d.ts.map +1 -0
  459. package/dist/lib/harness/console/replay-cli.test.js +96 -0
  460. package/dist/lib/harness/console/replay-cli.test.js.map +1 -0
  461. package/dist/lib/harness/console/replay.d.ts +36 -0
  462. package/dist/lib/harness/console/replay.d.ts.map +1 -0
  463. package/dist/lib/harness/console/replay.js +59 -0
  464. package/dist/lib/harness/console/replay.js.map +1 -0
  465. package/dist/lib/harness/console/replay.test.d.ts +2 -0
  466. package/dist/lib/harness/console/replay.test.d.ts.map +1 -0
  467. package/dist/lib/harness/console/replay.test.js +81 -0
  468. package/dist/lib/harness/console/replay.test.js.map +1 -0
  469. package/dist/lib/harness/console/turn-reader.d.ts +50 -0
  470. package/dist/lib/harness/console/turn-reader.d.ts.map +1 -0
  471. package/dist/lib/harness/console/turn-reader.js +184 -0
  472. package/dist/lib/harness/console/turn-reader.js.map +1 -0
  473. package/dist/lib/harness/console/turn-reader.test.d.ts +2 -0
  474. package/dist/lib/harness/console/turn-reader.test.d.ts.map +1 -0
  475. package/dist/lib/harness/console/turn-reader.test.js +108 -0
  476. package/dist/lib/harness/console/turn-reader.test.js.map +1 -0
  477. package/dist/lib/harness/console/types.d.ts +109 -0
  478. package/dist/lib/harness/console/types.d.ts.map +1 -0
  479. package/dist/lib/harness/console/types.js +2 -0
  480. package/dist/lib/harness/console/types.js.map +1 -0
  481. package/dist/lib/harness/contract.d.ts +229 -0
  482. package/dist/lib/harness/contract.d.ts.map +1 -0
  483. package/dist/lib/harness/contract.js +22 -0
  484. package/dist/lib/harness/contract.js.map +1 -0
  485. package/dist/lib/harness/credential.d.ts +23 -0
  486. package/dist/lib/harness/credential.d.ts.map +1 -0
  487. package/dist/lib/harness/credential.js +81 -0
  488. package/dist/lib/harness/credential.js.map +1 -0
  489. package/dist/lib/harness/credential.test.d.ts +2 -0
  490. package/dist/lib/harness/credential.test.d.ts.map +1 -0
  491. package/dist/lib/harness/credential.test.js +74 -0
  492. package/dist/lib/harness/credential.test.js.map +1 -0
  493. package/dist/lib/harness/evaluate.d.ts +390 -0
  494. package/dist/lib/harness/evaluate.d.ts.map +1 -0
  495. package/dist/lib/harness/evaluate.js +988 -0
  496. package/dist/lib/harness/evaluate.js.map +1 -0
  497. package/dist/lib/harness/evaluate.test.d.ts +2 -0
  498. package/dist/lib/harness/evaluate.test.d.ts.map +1 -0
  499. package/dist/lib/harness/evaluate.test.js +621 -0
  500. package/dist/lib/harness/evaluate.test.js.map +1 -0
  501. package/dist/lib/harness/extract.d.ts +152 -0
  502. package/dist/lib/harness/extract.d.ts.map +1 -0
  503. package/dist/lib/harness/extract.js +1601 -0
  504. package/dist/lib/harness/extract.js.map +1 -0
  505. package/dist/lib/harness/gate.d.ts +48 -0
  506. package/dist/lib/harness/gate.d.ts.map +1 -0
  507. package/dist/lib/harness/gate.js +60 -0
  508. package/dist/lib/harness/gate.js.map +1 -0
  509. package/dist/lib/harness/gate.test.d.ts +2 -0
  510. package/dist/lib/harness/gate.test.d.ts.map +1 -0
  511. package/dist/lib/harness/gate.test.js +111 -0
  512. package/dist/lib/harness/gate.test.js.map +1 -0
  513. package/dist/lib/harness/self-check.d.ts +59 -0
  514. package/dist/lib/harness/self-check.d.ts.map +1 -0
  515. package/dist/lib/harness/self-check.js +56 -0
  516. package/dist/lib/harness/self-check.js.map +1 -0
  517. package/dist/lib/harness/self-check.test.d.ts +2 -0
  518. package/dist/lib/harness/self-check.test.d.ts.map +1 -0
  519. package/dist/lib/harness/self-check.test.js +43 -0
  520. package/dist/lib/harness/self-check.test.js.map +1 -0
  521. package/dist/lib/harness/transcript.d.ts +65 -0
  522. package/dist/lib/harness/transcript.d.ts.map +1 -0
  523. package/dist/lib/harness/transcript.js +144 -0
  524. package/dist/lib/harness/transcript.js.map +1 -0
  525. package/dist/lib/harness/transcript.test.d.ts +2 -0
  526. package/dist/lib/harness/transcript.test.d.ts.map +1 -0
  527. package/dist/lib/harness/transcript.test.js +118 -0
  528. package/dist/lib/harness/transcript.test.js.map +1 -0
  529. package/dist/lib/harness-wiring.d.ts +145 -0
  530. package/dist/lib/harness-wiring.d.ts.map +1 -0
  531. package/dist/lib/harness-wiring.js +280 -0
  532. package/dist/lib/harness-wiring.js.map +1 -0
  533. package/dist/lib/hook-staleness.d.ts +95 -0
  534. package/dist/lib/hook-staleness.d.ts.map +1 -0
  535. package/dist/lib/hook-staleness.js +304 -0
  536. package/dist/lib/hook-staleness.js.map +1 -0
  537. package/dist/lib/jsonl.d.ts +270 -2
  538. package/dist/lib/jsonl.d.ts.map +1 -1
  539. package/dist/lib/jsonl.js +472 -76
  540. package/dist/lib/jsonl.js.map +1 -1
  541. package/dist/lib/memory.d.ts +350 -23
  542. package/dist/lib/memory.d.ts.map +1 -1
  543. package/dist/lib/memory.js +751 -38
  544. package/dist/lib/memory.js.map +1 -1
  545. package/dist/lib/otel-env.d.ts +90 -0
  546. package/dist/lib/otel-env.d.ts.map +1 -0
  547. package/dist/lib/otel-env.js +98 -0
  548. package/dist/lib/otel-env.js.map +1 -0
  549. package/dist/lib/project-config.d.ts +167 -0
  550. package/dist/lib/project-config.d.ts.map +1 -1
  551. package/dist/lib/project-config.js +321 -5
  552. package/dist/lib/project-config.js.map +1 -1
  553. package/dist/lib/projects-registry.d.ts +82 -0
  554. package/dist/lib/projects-registry.d.ts.map +1 -0
  555. package/dist/lib/projects-registry.js +145 -0
  556. package/dist/lib/projects-registry.js.map +1 -0
  557. package/dist/lib/projects-registry.test.d.ts +2 -0
  558. package/dist/lib/projects-registry.test.d.ts.map +1 -0
  559. package/dist/lib/projects-registry.test.js +176 -0
  560. package/dist/lib/projects-registry.test.js.map +1 -0
  561. package/dist/lib/repo-guard-scope.d.ts +126 -0
  562. package/dist/lib/repo-guard-scope.d.ts.map +1 -0
  563. package/dist/lib/repo-guard-scope.js +249 -0
  564. package/dist/lib/repo-guard-scope.js.map +1 -0
  565. package/dist/lib/report-format.d.ts +132 -0
  566. package/dist/lib/report-format.d.ts.map +1 -0
  567. package/dist/lib/report-format.js +317 -0
  568. package/dist/lib/report-format.js.map +1 -0
  569. package/dist/lib/roster.d.ts +87 -0
  570. package/dist/lib/roster.d.ts.map +1 -0
  571. package/dist/lib/roster.js +332 -0
  572. package/dist/lib/roster.js.map +1 -0
  573. package/dist/lib/roster.test.d.ts +15 -0
  574. package/dist/lib/roster.test.d.ts.map +1 -0
  575. package/dist/lib/roster.test.js +299 -0
  576. package/dist/lib/roster.test.js.map +1 -0
  577. package/dist/lib/runtime/codex-adapter.d.ts.map +1 -1
  578. package/dist/lib/runtime/codex-adapter.js +5 -0
  579. package/dist/lib/runtime/codex-adapter.js.map +1 -1
  580. package/dist/lib/runtime/codex-config.d.ts +129 -0
  581. package/dist/lib/runtime/codex-config.d.ts.map +1 -1
  582. package/dist/lib/runtime/codex-config.js +225 -0
  583. package/dist/lib/runtime/codex-config.js.map +1 -1
  584. package/dist/lib/runtime/identity.d.ts +72 -0
  585. package/dist/lib/runtime/identity.d.ts.map +1 -0
  586. package/dist/lib/runtime/identity.js +128 -0
  587. package/dist/lib/runtime/identity.js.map +1 -0
  588. package/dist/lib/standards.d.ts +99 -0
  589. package/dist/lib/standards.d.ts.map +1 -0
  590. package/dist/lib/standards.js +201 -0
  591. package/dist/lib/standards.js.map +1 -0
  592. package/dist/lib/team-identity.d.ts +134 -0
  593. package/dist/lib/team-identity.d.ts.map +1 -0
  594. package/dist/lib/team-identity.js +193 -0
  595. package/dist/lib/team-identity.js.map +1 -0
  596. package/dist/lib/templates.d.ts +29 -2
  597. package/dist/lib/templates.d.ts.map +1 -1
  598. package/dist/lib/templates.js +1042 -82
  599. package/dist/lib/templates.js.map +1 -1
  600. package/dist/lib/terminal-ui.d.ts.map +1 -1
  601. package/dist/lib/terminal-ui.js +12 -1
  602. package/dist/lib/terminal-ui.js.map +1 -1
  603. package/dist/lib/test-project.d.ts +95 -0
  604. package/dist/lib/test-project.d.ts.map +1 -0
  605. package/dist/lib/test-project.js +103 -0
  606. package/dist/lib/test-project.js.map +1 -0
  607. package/dist/lib/vault.d.ts +60 -0
  608. package/dist/lib/vault.d.ts.map +1 -0
  609. package/dist/lib/vault.js +102 -0
  610. package/dist/lib/vault.js.map +1 -0
  611. package/dist/lib/vault.test.d.ts +17 -0
  612. package/dist/lib/vault.test.d.ts.map +1 -0
  613. package/dist/lib/vault.test.js +169 -0
  614. package/dist/lib/vault.test.js.map +1 -0
  615. package/dist/lib/window-view.d.ts +63 -0
  616. package/dist/lib/window-view.d.ts.map +1 -0
  617. package/dist/lib/window-view.js +217 -0
  618. package/dist/lib/window-view.js.map +1 -0
  619. package/dist/lib/window-view.test.d.ts +2 -0
  620. package/dist/lib/window-view.test.d.ts.map +1 -0
  621. package/dist/lib/window-view.test.js +168 -0
  622. package/dist/lib/window-view.test.js.map +1 -0
  623. package/dist/lib/worktree-sync.d.ts +439 -0
  624. package/dist/lib/worktree-sync.d.ts.map +1 -0
  625. package/dist/lib/worktree-sync.js +1167 -0
  626. package/dist/lib/worktree-sync.js.map +1 -0
  627. package/dist/lib/worktree.d.ts +58 -1
  628. package/dist/lib/worktree.d.ts.map +1 -1
  629. package/dist/lib/worktree.js +91 -4
  630. package/dist/lib/worktree.js.map +1 -1
  631. package/dist/standards/decision-request.md +98 -0
  632. package/dist/standards/fail-loud-standard.md +495 -0
  633. package/dist/standards/po-communication-standard.md +126 -0
  634. package/dist/standards/report-format.md +128 -0
  635. package/dist/standards/writing-standard.md +382 -0
  636. package/package.json +3 -2
  637. package/scripts/generate-claude.mjs +119 -46
@@ -0,0 +1,546 @@
1
+ /**
2
+ * git-identity -- the per-team git identity `mx-agent provision` writes into the
3
+ * worktree it is provisioning, and the values every commit from that worktree
4
+ * then carries (#440 part A).
5
+ *
6
+ * WHAT THIS FIXES. Every team's worktree here is a LINKED worktree of one shared
7
+ * repository, and every one of them resolved `user.name` from the single file
8
+ * `/workspace/.git/config`. Eight worktrees, one identity, so `git log` could not
9
+ * say which team produced a commit. The design memory
10
+ * `0aaa2f4f-5614-442b-afb5-47c8aa600ea1` and `docs/agent-github-identity-setup.md`
11
+ * both prescribed plain `git config user.name <slug>` for this, which is the one
12
+ * mechanism that makes it WORSE: from a linked worktree that writes the shared
13
+ * file, so the first team to provision reassigns the identity of every other
14
+ * team's live session, and the next team to provision overwrites it again.
15
+ *
16
+ * SO `--worktree` IS THE MECHANISM AND PLAIN `git config` IS FORBIDDEN HERE
17
+ * (issue #440, comment 5559622174, which supersedes the environment-variable
18
+ * choice in comment 5559576380). `git config --worktree` writes
19
+ * `$GIT_COMMON_DIR/worktrees/<name>/config.worktree`, which only that worktree
20
+ * reads. Nothing in this module ever runs `git config` without `--worktree`
21
+ * except to READ, and the two read call sites are named in their own comments.
22
+ *
23
+ * `--worktree` NEEDS `extensions.worktreeConfig=true` ON THE SHARED REPOSITORY,
24
+ * AND THIS MODULE NEVER ENABLES IT. Enabling it is a change to state shared by
25
+ * every worktree on the machine, it is the bootstrap lead's to make after the
26
+ * pre-flight check below, and a provisioning run is not the place to make a
27
+ * change whose reach is every other team. When the extension is off this module
28
+ * WRITES NOTHING and returns a refusal naming the command an operator must run.
29
+ *
30
+ * That refusal is belt on top of braces rather than the only guard. Measured in
31
+ * a throwaway repository on git 2.49.0, 2026-09-06: with the extension off,
32
+ * `git config --worktree user.name alpha` exits 128 with `fatal: --worktree
33
+ * cannot be used with multiple working trees unless the config extension
34
+ * worktreeConfig is enabled`, and the shared config is byte-identical
35
+ * afterwards. Git itself fails closed here; there is no silent fall-through to
36
+ * the shared file. The detection exists so an operator reads one sentence with a
37
+ * remedy instead of a git fatal, not because the write would otherwise land
38
+ * somewhere dangerous.
39
+ *
40
+ * IT IS ATTRIBUTION, NOT AUTHENTICATION. Any session can set any name, so a
41
+ * commit's author records which worktree produced it and proves nothing about
42
+ * who that session was. The same caveat the design records about the app setting
43
+ * a passing check without doing the work applies here, and it should survive
44
+ * into every document that describes this (#440, comment 5559576380, "Should Fix
45
+ * items").
46
+ *
47
+ * NOTHING HERE THROWS. Every failure is a returned outcome with a `kind`, for
48
+ * the reason `lib/claude.ts:549-557` gives about the behavioral block: an
49
+ * identity that could not be written degrades attribution and does not endanger
50
+ * the worktree, so it warns and continues rather than refusing a creation that
51
+ * has already made a worktree, a catalog entry and three memories.
52
+ */
53
+ import { spawnSync } from 'child_process';
54
+ import { isValidProjectSlug } from './slug.js';
55
+ // One-line collapse and length cap for a git-supplied value. `behavioral-injection`
56
+ // imports nothing local, so this direction cannot cycle; `lib/claude.ts` imports
57
+ // this module and must not be imported back.
58
+ import { sanitizeForMessage } from './behavioral-injection.js';
59
+ /**
60
+ * The domain every team's git email is under. Resolves to no GitHub account by
61
+ * design: a `Co-authored-by` trailer naming it persists as text in the commit
62
+ * body and shows as an unlinked co-author, which is what `git log` attribution
63
+ * needs and is NOT a GitHub identity (#440, comment 5555802652).
64
+ */
65
+ export const TEAM_EMAIL_DOMAIN = 'mx-agent.local';
66
+ /** The two config keys this module owns. Nothing else is written. */
67
+ export const IDENTITY_KEYS = ['user.name', 'user.email'];
68
+ /** `<slug>@mx-agent.local`. */
69
+ export function teamGitEmail(slug) {
70
+ return `${slug}@${TEAM_EMAIL_DOMAIN}`;
71
+ }
72
+ /**
73
+ * The trailer that carries this team's attribution through a squash merge.
74
+ *
75
+ * ONE DEFINITION, for the reason `behavioralPointerLine` states about the
76
+ * pointer line (`lib/claude.ts:735-745`): the generator that writes the
77
+ * instruction into `CLAUDE.local.md` and any later reader of a commit body would
78
+ * otherwise hold two copies of the literal and drift silently.
79
+ *
80
+ * GitHub aggregates `Co-authored-by` trailers from a branch's commits into the
81
+ * squash commit body rather than dropping them, measured on this repository's
82
+ * own `main`: 12 of the last 60 commits carry trailers, every one of them a
83
+ * squash merge, and two carry 7 and 9 (#440, comment 5555802652). That is what
84
+ * makes the trailer the durable half of the attribution, since the branch-level
85
+ * author does not reach `main` under a squash.
86
+ */
87
+ export function teamCoAuthorTrailer(slug) {
88
+ return `Co-authored-by: ${slug} <${teamGitEmail(slug)}>`;
89
+ }
90
+ /**
91
+ * Run git and return its trimmed stdout, or null when it did not exit 0.
92
+ *
93
+ * ARRAY FORM, NEVER A SHELL STRING. Every value this module passes git comes
94
+ * from a slug `isValidProjectSlug` accepted or from a path the caller resolved,
95
+ * and `spawnSync` with an argv array means neither is ever parsed by a shell.
96
+ * The slug check also guarantees a leading `[a-z]` (`lib/slug.ts:22`), so a
97
+ * value can never be read by git as an option.
98
+ */
99
+ function git(args, cwd) {
100
+ const r = spawnSync('git', args, {
101
+ cwd,
102
+ encoding: 'utf-8',
103
+ stdio: ['ignore', 'pipe', 'pipe'],
104
+ });
105
+ if (r.error || r.status !== 0)
106
+ return null;
107
+ return (r.stdout ?? '').trim();
108
+ }
109
+ /**
110
+ * RUN git once and report whether it succeeded, with its stderr when it did not.
111
+ *
112
+ * Named for the fact that it EXECUTES: the write path calls it, so a reader must
113
+ * not take it for a formatter over a result someone else produced. The stderr is
114
+ * collapsed to one line and bounded at 240 characters before it can reach a
115
+ * terminal, the same defence `sanitizeForMessage` gives elsewhere: git's message
116
+ * is three lines here and an operator reads it inside a row detail.
117
+ */
118
+ function runGit(args, cwd) {
119
+ const r = spawnSync('git', args, {
120
+ cwd,
121
+ encoding: 'utf-8',
122
+ stdio: ['ignore', 'pipe', 'pipe'],
123
+ });
124
+ if (!r.error && r.status === 0)
125
+ return { ok: true, err: '' };
126
+ const text = r.error ? r.error.message : (r.stderr ?? '');
127
+ return { ok: false, err: text.replace(/\s+/g, ' ').trim().slice(0, 240) };
128
+ }
129
+ // ── The pre-flight check ─────────────────────────────────────────────────────
130
+ /**
131
+ * The three settings that decide whether enabling `extensions.worktreeConfig` on
132
+ * a shared repository is additive or needs a manual migration first.
133
+ *
134
+ * FROM GIT'S OWN DOCUMENTATION, not from a test that happened to pass.
135
+ * `git-worktree(1)`, CONFIGURATION FILE: "Note that in this file, the exception
136
+ * for `core.bare` and `core.worktree` is gone. If they exist in
137
+ * `$GIT_DIR/config`, you must move them to the `config.worktree` of the main
138
+ * worktree. `core.bare` should not be shared if the value is `core.bare=true`.
139
+ * `core.sparseCheckout` should not be shared, unless you are sure you always use
140
+ * sparse checkout for all worktrees."
141
+ *
142
+ * The bootstrap lead's own test of additivity ran in a repository where all
143
+ * three were absent, which is why it read as unconditional (#440, comment
144
+ * 5559669566). This function is the condition stated as a check.
145
+ */
146
+ export const PREFLIGHT_KEYS = ['core.bare', 'core.worktree', 'core.sparseCheckout'];
147
+ /**
148
+ * Read the three settings and say whether enabling the extension is additive
149
+ * right now.
150
+ *
151
+ * READ-ONLY AND RUN AT THE MOMENT OF USE. It is not a fact established once: any
152
+ * team's change could set one of these between a plan and its implementation,
153
+ * and nothing would announce it (#440, comment 5559669566, "They are checked
154
+ * again at implementation time because they can change").
155
+ *
156
+ * `--local` deliberately. The question is what is in THIS repository's config,
157
+ * not what a global or system file also supplies: the migration git describes
158
+ * is a migration of `$GIT_DIR/config`, and a `core.bare` inherited from a global
159
+ * file is not in that file and is not what needs moving.
160
+ */
161
+ export function checkWorktreeConfigPreflight(repoPath) {
162
+ // Cheapest proof that this is a git repository at all, and the one call whose
163
+ // failure means every reading below would be meaningless rather than absent.
164
+ const inRepo = git(['-C', repoPath, 'rev-parse', '--git-dir']);
165
+ if (inRepo === null) {
166
+ return {
167
+ safe: false,
168
+ readings: [],
169
+ alreadyEnabled: false,
170
+ couldNotRun: `${repoPath} is not a readable git repository`,
171
+ };
172
+ }
173
+ const alreadyEnabled = readWorktreeConfigExtension(repoPath) === true;
174
+ const readings = PREFLIGHT_KEYS.map((key) => {
175
+ const value = git(['-C', repoPath, 'config', '--local', '--get', key]);
176
+ if (key === 'core.bare') {
177
+ // Unset or false is the shareable value; `true` is the one git names.
178
+ const safe = value === null || value.toLowerCase() === 'false';
179
+ return {
180
+ key,
181
+ value,
182
+ safe,
183
+ why: safe
184
+ ? 'unset or false, which git names as safe to share'
185
+ : 'core.bare=true must move to the main worktree\'s config.worktree before the extension is enabled',
186
+ };
187
+ }
188
+ if (key === 'core.worktree') {
189
+ const safe = value === null;
190
+ return {
191
+ key,
192
+ value,
193
+ safe,
194
+ why: safe
195
+ ? 'unset'
196
+ : 'a value must move to the main worktree\'s config.worktree before the extension is enabled',
197
+ };
198
+ }
199
+ const safe = value === null;
200
+ return {
201
+ key,
202
+ value,
203
+ safe,
204
+ why: safe
205
+ ? 'unset'
206
+ : 'set, so it would stop being shared: enable only if every worktree uses sparse checkout',
207
+ };
208
+ });
209
+ return {
210
+ safe: readings.every((r) => r.safe),
211
+ readings,
212
+ alreadyEnabled,
213
+ couldNotRun: null,
214
+ };
215
+ }
216
+ /** One line per reading, for a message or a report. */
217
+ export function describePreflight(p) {
218
+ if (p.couldNotRun)
219
+ return `could not run: ${p.couldNotRun}`;
220
+ return p.readings.map((r) => `${r.key}=${r.value ?? '<unset>'} (${r.safe ? 'ok' : 'BLOCKS'})`).join(', ');
221
+ }
222
+ // ── Reading the extension and the worktree's own identity ────────────────────
223
+ /**
224
+ * Whether `extensions.worktreeConfig` is on, or null when the repository could
225
+ * not be read.
226
+ *
227
+ * A READ WITHOUT `--worktree`, and one of only two in this module. The extension
228
+ * lives in the shared config by definition, so there is nothing per-worktree to
229
+ * ask for, and a read cannot write.
230
+ */
231
+ export function readWorktreeConfigExtension(repoOrWorktreePath) {
232
+ const raw = git(['-C', repoOrWorktreePath, 'config', '--type=bool', '--get', 'extensions.worktreeConfig']);
233
+ if (raw === null) {
234
+ // Exit 1 for "unset" and exit 128 for "not a repository" are two different
235
+ // answers, and only the second is unreadable. Distinguish them, so a
236
+ // non-repository is never reported as a repository with the extension off.
237
+ return git(['-C', repoOrWorktreePath, 'rev-parse', '--git-dir']) === null ? null : false;
238
+ }
239
+ return raw === 'true';
240
+ }
241
+ /**
242
+ * What this worktree's own config.worktree holds, read back from disk.
243
+ *
244
+ * THE ARTIFACT, NOT THE WRITE'S RETURN VALUE. Completion row 15 calls this for
245
+ * the reason row 14 re-reads `dist/index.js` rather than trusting the build
246
+ * result (`commands/create.ts:3377-3380`): the row reports what exists now, so a
247
+ * value written by this run and removed since is not an asserted row, and a
248
+ * `--recheck`, which writes nothing, gets a real answer from the same function.
249
+ */
250
+ export function readTeamGitIdentity(worktreePath) {
251
+ const extensionEnabled = readWorktreeConfigExtension(worktreePath) === true;
252
+ if (!extensionEnabled) {
253
+ return { name: null, email: null, effectiveNameOrigin: null, extensionEnabled: false };
254
+ }
255
+ const name = git(['-C', worktreePath, 'config', '--worktree', '--get', 'user.name']);
256
+ const email = git(['-C', worktreePath, 'config', '--worktree', '--get', 'user.email']);
257
+ // The second read without `--worktree`. It asks which FILE the value a commit
258
+ // would use comes from, which is the only way to tell a per-worktree value
259
+ // from the shared fallback that happens to hold the same string.
260
+ //
261
+ // `--show-origin` prints `<type>:<path>\t<value>`, where the type is `file`,
262
+ // `blob`, `command line`, `standard input` or `submodule-blob`. Only `file` is
263
+ // reachable here and only `file` is unwrapped: any other type is returned as
264
+ // git printed it, so it cannot end in `config.worktree` and the caller reads
265
+ // it as "not this worktree's own file" rather than as a path.
266
+ const origin = git(['-C', worktreePath, 'config', '--show-origin', '--get', 'user.name']);
267
+ const originField = origin === null ? null : (origin.split('\t')[0] ?? null);
268
+ const effectiveNameOrigin = originField !== null && originField.startsWith('file:')
269
+ ? originField.slice('file:'.length)
270
+ : originField;
271
+ return { name, email, effectiveNameOrigin, extensionEnabled };
272
+ }
273
+ /**
274
+ * Read this worktree's git identity and say whether it is this team's own.
275
+ *
276
+ * READS THE ARTIFACT, NOT A WRITE'S RETURN VALUE, for the reason
277
+ * `readTeamGitIdentity`'s header gives: the answer must be the same for a fresh
278
+ * provision, a resume, a `--recheck` that writes nothing, and an
279
+ * `mx-agent start` days later that never calls the writer at all. A state
280
+ * threaded down from `writeTeamGitIdentity` would be available on exactly one
281
+ * of those four paths, and `mx-agent start` regenerates `CLAUDE.local.md` on
282
+ * every session.
283
+ *
284
+ * The isolation criterion is the strict one row 15 already applied: the name and
285
+ * email must match the team AND the effective `user.name` must resolve from a
286
+ * `config.worktree`. A shared config that happens to hold the team's name is not
287
+ * isolation, and accepting it would report success for the exact defect #440
288
+ * exists to prevent (#440, comment 5555843161).
289
+ */
290
+ export function describeTeamGitIdentityState(worktreePath, slug) {
291
+ const base = {
292
+ name: null,
293
+ email: null,
294
+ effectiveAuthor: null,
295
+ effectiveNameOrigin: null,
296
+ };
297
+ if (!worktreePath) {
298
+ return {
299
+ ...base,
300
+ isolated: false,
301
+ code: 'no-worktree-path',
302
+ couldNotRun: true,
303
+ reason: 'no worktree path to read the per-worktree git config from',
304
+ };
305
+ }
306
+ const extension = readWorktreeConfigExtension(worktreePath);
307
+ if (extension === null) {
308
+ return {
309
+ ...base,
310
+ isolated: false,
311
+ code: 'unreadable',
312
+ couldNotRun: true,
313
+ reason: `${worktreePath} is not a git repository this run can read`,
314
+ };
315
+ }
316
+ // The author a commit would carry is read whatever the extension holds: with
317
+ // the extension off it is the whole answer, and with it on it is what proves
318
+ // the value comes from this worktree's own file.
319
+ const effective = readEffectiveAuthor(worktreePath);
320
+ if (extension === false) {
321
+ return {
322
+ ...base,
323
+ ...effective,
324
+ isolated: false,
325
+ code: 'extension-disabled',
326
+ couldNotRun: true,
327
+ reason: 'extensions.worktreeConfig is not enabled on the shared repository, so git refuses '
328
+ + '--worktree and no per-worktree identity exists to read',
329
+ };
330
+ }
331
+ const read = readTeamGitIdentity(worktreePath);
332
+ const expectedEmail = teamGitEmail(slug);
333
+ const fromOwnFile = read.effectiveNameOrigin !== null && read.effectiveNameOrigin.endsWith('config.worktree');
334
+ if (read.name === slug && read.email === expectedEmail && fromOwnFile) {
335
+ return {
336
+ isolated: true,
337
+ code: 'isolated',
338
+ couldNotRun: false,
339
+ name: read.name,
340
+ email: read.email,
341
+ effectiveAuthor: effective.effectiveAuthor,
342
+ effectiveNameOrigin: read.effectiveNameOrigin,
343
+ reason: `resolved from ${read.effectiveNameOrigin}`,
344
+ };
345
+ }
346
+ if (read.name === null && read.email === null) {
347
+ return {
348
+ ...base,
349
+ ...effective,
350
+ isolated: false,
351
+ code: 'unset',
352
+ couldNotRun: false,
353
+ reason: 'this worktree sets no user.name or user.email of its own',
354
+ };
355
+ }
356
+ const wrong = [];
357
+ if (read.name !== slug) {
358
+ wrong.push(`user.name is ${read.name === null ? 'unset for this worktree' : JSON.stringify(read.name)}`);
359
+ }
360
+ if (read.email !== expectedEmail) {
361
+ wrong.push(`user.email is ${read.email === null ? 'unset for this worktree' : JSON.stringify(read.email)}`);
362
+ }
363
+ if (read.name === slug && read.email === expectedEmail && !fromOwnFile) {
364
+ wrong.push(`the values match but the effective user.name resolves from ${read.effectiveNameOrigin ?? 'an unreadable origin'}, `
365
+ + 'not this worktree\'s own config.worktree, so it is the shared identity rather than this team\'s');
366
+ }
367
+ return {
368
+ isolated: false,
369
+ code: 'mismatch',
370
+ couldNotRun: false,
371
+ name: read.name,
372
+ email: read.email,
373
+ effectiveAuthor: effective.effectiveAuthor,
374
+ effectiveNameOrigin: read.effectiveNameOrigin,
375
+ reason: sanitizeOneLine(wrong.join('; ')),
376
+ };
377
+ }
378
+ /**
379
+ * `<name> <<email>>` git would put on a commit made here now, with the file the
380
+ * name came from.
381
+ *
382
+ * A READ WITHOUT `--worktree`, the third and last in this module, and the point
383
+ * of it: it asks what a commit ACTUALLY gets, which with the extension off is
384
+ * the shared identity and is the fact the refused block has to state.
385
+ *
386
+ * Both values are sanitized here rather than at each sink. They come out of a
387
+ * config file this command does not own, they end up in `CLAUDE.local.md`, and
388
+ * `git config` can store a value containing a newline.
389
+ */
390
+ function readEffectiveAuthor(worktreePath) {
391
+ const name = git(['-C', worktreePath, 'config', '--get', 'user.name']);
392
+ const email = git(['-C', worktreePath, 'config', '--get', 'user.email']);
393
+ const origin = git(['-C', worktreePath, 'config', '--show-origin', '--get', 'user.name']);
394
+ const originField = origin === null ? null : (origin.split('\t')[0] ?? null);
395
+ const effectiveNameOrigin = originField !== null && originField.startsWith('file:')
396
+ ? originField.slice('file:'.length)
397
+ : originField;
398
+ if (name === null && email === null)
399
+ return { effectiveAuthor: null, effectiveNameOrigin };
400
+ return {
401
+ effectiveAuthor: sanitizeOneLine(`${name ?? '<unset>'} <${email ?? '<unset>'}>`),
402
+ effectiveNameOrigin,
403
+ };
404
+ }
405
+ /** One line, bounded, with C0/C1 replaced. The same defence `runGit` applies to stderr. */
406
+ function sanitizeOneLine(value) {
407
+ return sanitizeForMessage(value.replace(/\s+/g, ' ').trim(), 240);
408
+ }
409
+ /**
410
+ * Write `user.name` and `user.email` for ONE worktree, or refuse and write
411
+ * nothing.
412
+ *
413
+ * FOUR GUARDS RUN BEFORE ANY WRITE, and each one exists because the failure it
414
+ * prevents is silent:
415
+ *
416
+ * 1. THE SLUG IS RE-VALIDATED. `isValidProjectSlug` is the same rule the
417
+ * coordination service applies (`lib/slug.ts:1-19`), and the caller already
418
+ * applies it, and it runs again here for the reason `writeCodeContextFile`
419
+ * re-validates its four values (`commands/create.ts:5302-5306`): a value
420
+ * reaching this point that no earlier gate covered is a bug worth naming
421
+ * rather than passing to git.
422
+ * 2. THE PATH MUST BE A LINKED WORKTREE. `git rev-parse --absolute-git-dir`
423
+ * equal to `--git-common-dir` is the main checkout, where `--worktree`
424
+ * writes `$GIT_COMMON_DIR/config.worktree` — a file inside the shared `.git`
425
+ * that only the main worktree reads. Measured 2026-09-06: writing there
426
+ * leaves every linked worktree's resolution untouched, so it is not the
427
+ * eight-worktree defect, and provisioning still has no business setting an
428
+ * identity on the operator's own checkout.
429
+ * 3. THE EXTENSION MUST BE ON, and this function never turns it on. See the
430
+ * module header.
431
+ * 4. THE SHARED CONFIG IS SNAPSHOTTED BEFORE AND AFTER. This is the control
432
+ * that would catch the original defect if it ever came back by a route the
433
+ * three guards above do not cover: two `--local --get` reads, compared. A
434
+ * change across a write that only used `--worktree` is not something this
435
+ * module can cause, which is exactly why observing one is worth a loud
436
+ * refusal rather than a silent pass.
437
+ *
438
+ * IDEMPOTENT. A resume, and a re-provision of a team that already has an
439
+ * identity, both write the same two values again and report `written`. There is
440
+ * no separate "already correct" outcome, because the operator's next action is
441
+ * the same either way and a second kind would only be another branch to test.
442
+ */
443
+ export function writeTeamGitIdentity(opts) {
444
+ const { worktreePath, slug } = opts;
445
+ // Guard 1.
446
+ if (!isValidProjectSlug(slug)) {
447
+ return {
448
+ kind: 'refused',
449
+ code: 'invalid-slug',
450
+ // JSON.stringify for the reason `invalidProjectSlugMessage` gives
451
+ // (`lib/slug.ts:44`, CWE-117): the value reaches a terminal line.
452
+ detail: `team slug ${JSON.stringify(slug)} is not a valid slug, so no git identity was written`,
453
+ };
454
+ }
455
+ // Guard 2.
456
+ const gitDir = git(['-C', worktreePath, 'rev-parse', '--absolute-git-dir']);
457
+ const commonDir = git(['-C', worktreePath, 'rev-parse', '--path-format=absolute', '--git-common-dir']);
458
+ if (gitDir === null || commonDir === null) {
459
+ return {
460
+ kind: 'refused',
461
+ code: 'not-a-worktree',
462
+ detail: `${worktreePath} is not a git worktree this run can read, so no git identity was written`,
463
+ };
464
+ }
465
+ if (gitDir === commonDir) {
466
+ return {
467
+ kind: 'refused',
468
+ code: 'main-worktree',
469
+ detail: `${worktreePath} is the main checkout, not a linked worktree. A per-team identity is written `
470
+ + 'only into a linked worktree, so nothing was written',
471
+ };
472
+ }
473
+ // Guard 3.
474
+ const extension = readWorktreeConfigExtension(worktreePath);
475
+ if (extension !== true) {
476
+ const preflight = checkWorktreeConfigPreflight(commonDir);
477
+ const remedy = preflight.safe
478
+ ? `Enable it once on the shared repository: git -C ${commonDir} config extensions.worktreeConfig true`
479
+ : `Enabling it needs a migration first (git-worktree(1), CONFIGURATION FILE): ${describePreflight(preflight)}`;
480
+ return {
481
+ kind: 'refused',
482
+ code: 'extension-disabled',
483
+ detail: (extension === null
484
+ ? 'extensions.worktreeConfig could not be read on the shared repository'
485
+ : 'extensions.worktreeConfig is not enabled on the shared repository')
486
+ + `, so git refuses --worktree and this run wrote NO identity for ${slug}. `
487
+ + 'Plain `git config` is not the fallback: from a linked worktree it writes the shared config '
488
+ + `and reassigns every worktree's identity at once (#440). ${remedy}. `
489
+ + `Pre-flight: ${describePreflight(preflight)}`,
490
+ };
491
+ }
492
+ // Guard 4, first half.
493
+ const sharedBefore = readSharedIdentity(commonDir);
494
+ const name = slug;
495
+ const email = teamGitEmail(slug);
496
+ for (const [key, value] of [['user.name', name], ['user.email', email]]) {
497
+ // THE ONLY WRITES IN THIS MODULE, and both carry `--worktree`.
498
+ const run = runGit(['-C', worktreePath, 'config', '--worktree', key, value]);
499
+ if (!run.ok) {
500
+ return {
501
+ kind: 'refused',
502
+ code: 'write-failed',
503
+ detail: `git config --worktree ${key} failed for ${slug}: ${run.err}`,
504
+ };
505
+ }
506
+ }
507
+ // Guard 4, second half.
508
+ const sharedAfter = readSharedIdentity(commonDir);
509
+ if (sharedBefore.name !== sharedAfter.name || sharedBefore.email !== sharedAfter.email) {
510
+ return {
511
+ kind: 'refused',
512
+ code: 'shared-config-changed',
513
+ detail: `the shared repository's user.name/user.email changed while writing ${slug}'s per-worktree `
514
+ + `identity (${sharedBefore.name ?? '<unset>'}/${sharedBefore.email ?? '<unset>'} -> `
515
+ + `${sharedAfter.name ?? '<unset>'}/${sharedAfter.email ?? '<unset>'}). This run wrote only `
516
+ + `--worktree values and cannot have caused it. Inspect ${commonDir}/config before relying on `
517
+ + 'any worktree\'s identity',
518
+ };
519
+ }
520
+ // READ BACK WHAT WAS WRITTEN before claiming it (AGENTS.md, "Tools that fail
521
+ // silently"). An exit 0 says the call succeeded, not that the stored value is
522
+ // the one asked for.
523
+ const readBack = readTeamGitIdentity(worktreePath);
524
+ if (readBack.name !== name || readBack.email !== email) {
525
+ return {
526
+ kind: 'refused',
527
+ code: 'write-failed',
528
+ detail: `wrote ${name} <${email}> for this worktree and read back `
529
+ + `${readBack.name ?? '<unset>'} <${readBack.email ?? '<unset>'}>`,
530
+ };
531
+ }
532
+ return { kind: 'written', name, email, originFile: readBack.effectiveNameOrigin };
533
+ }
534
+ /**
535
+ * The shared repository's own `user.name` and `user.email`.
536
+ *
537
+ * `--local` against the common directory, so it reads the one file the original
538
+ * defect would have written and nothing that a per-worktree file supplies.
539
+ */
540
+ function readSharedIdentity(commonDir) {
541
+ return {
542
+ name: git(['-C', commonDir, 'config', '--local', '--get', 'user.name']),
543
+ email: git(['-C', commonDir, 'config', '--local', '--get', 'user.email']),
544
+ };
545
+ }
546
+ //# sourceMappingURL=git-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-identity.js","sourceRoot":"","sources":["../../src/lib/git-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,oFAAoF;AACpF,iFAAiF;AACjF,6CAA6C;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAEl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SAAS,yBAAyB;kBAC3F,wDAAwD,SAAS,4BAA4B;kBAC7F,0BAA0B;SAC/B,CAAC;IACJ,CAAC;IAED,6EAA6E;IAC7E,8EAA8E;IAC9E,qBAAqB;IACrB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;IACnD,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;QACvD,OAAO;YACL,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,cAAc;YACpB,MAAM,EACJ,SAAS,IAAI,KAAK,KAAK,oCAAoC;kBACzD,GAAG,QAAQ,CAAC,IAAI,IAAI,SAAS,KAAK,QAAQ,CAAC,KAAK,IAAI,SAAS,GAAG;SACrE,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,mBAAmB,EAAE,CAAC;AACpF,CAAC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,SAAiB;IAC3C,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACvE,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;KAC1E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Saying it out loud.
3
+ *
4
+ * `FleetConsole` already classifies, ranks and pushes: `subscribe` fires with
5
+ * what appeared and what cleared, and it only computes when somebody is
6
+ * listening. Until now nothing subscribed, so a live session built a perfectly
7
+ * good list of things needing a person and showed it to nobody. The milestone
8
+ * asks that a refusal reach the operator without them going to look, and this
9
+ * is the missing half of that sentence.
10
+ *
11
+ * WHAT IT PRINTS AND WHAT IT WITHHOLDS. Only what is new. Reprinting the whole
12
+ * list on every change is the fastest way to teach someone to skim past it, and
13
+ * POC-3 measured the cost of a console that reports quiet while things go
14
+ * wrong: three of eight moments reached the operator. So new items announce,
15
+ * cleared items say so in one line, and an unchanged list says nothing at all.
16
+ *
17
+ * CONFIDENCE IS SHOWN, NOT FLATTENED. Items read out of an agent's prose are
18
+ * marked. POC-3b measured a post-hoc reader at about a third of what matters,
19
+ * unstably, and POC-3e showed a better model does not fix it. Presenting that
20
+ * beside a guard refusal as though they carry the same weight would be a claim
21
+ * neither measurement supports.
22
+ */
23
+ import type { ConsoleItem } from './types.js';
24
+ import type { FleetConsole } from './console.js';
25
+ export interface AnnounceOptions {
26
+ /** Where the lines go. Injected so this is testable and so a caller can
27
+ * route it somewhere other than the session's own output. */
28
+ write: (line: string) => void;
29
+ /** Announce items the console cannot vouch for. On by default: they are the
30
+ * largest category by far, 276 of 325 in a measured week. */
31
+ includeLowConfidence?: boolean;
32
+ /** Most items to announce in one change. A burst larger than this is
33
+ * summarised rather than printed, because a wall is not a notification. */
34
+ maxPerChange?: number;
35
+ }
36
+ /** One item, as two lines: what it is, and the evidence for it. */
37
+ export declare function renderAnnouncement(item: ConsoleItem): string[];
38
+ /**
39
+ * Subscribe to a console and print what appears.
40
+ *
41
+ * Returns the unsubscribe function, so a session can stop announcing without
42
+ * tearing down the console that other sessions are still feeding.
43
+ */
44
+ export declare function attachAnnouncer(fleet: FleetConsole, options: AnnounceOptions): () => void;
45
+ //# sourceMappingURL=announce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announce.d.ts","sourceRoot":"","sources":["../../../../src/lib/harness/console/announce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B;kEAC8D;IAC9D,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B;kEAC8D;IAC9D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;gFAC4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAOD,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,EAAE,CAS9D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,MAAM,IAAI,CAyBzF"}
@@ -0,0 +1,48 @@
1
+ const clip = (s, n = 110) => {
2
+ const line = String(s ?? '').replace(/\s+/g, ' ').trim();
3
+ return line.length > n ? line.slice(0, n).trimEnd() + '…' : line;
4
+ };
5
+ /** One item, as two lines: what it is, and the evidence for it. */
6
+ export function renderAnnouncement(item) {
7
+ const mark = item.lowConfidence ? ' (unverified, read from the agent\'s own words)' : '';
8
+ const lines = [` NEEDS YOU ${item.kind} ${item.principal.team}${mark}`];
9
+ lines.push(` ${clip(item.headline, 120)}`);
10
+ // Two detail lines, not one. For a refusal the first is the rule and the
11
+ // second is the reason, and the reason is the half a person needs to decide
12
+ // whether the rule was wrong or the attempt was.
13
+ for (const d of (item.detail ?? []).slice(0, 2))
14
+ lines.push(` ${clip(d)}`);
15
+ return lines;
16
+ }
17
+ /**
18
+ * Subscribe to a console and print what appears.
19
+ *
20
+ * Returns the unsubscribe function, so a session can stop announcing without
21
+ * tearing down the console that other sessions are still feeding.
22
+ */
23
+ export function attachAnnouncer(fleet, options) {
24
+ const { write } = options;
25
+ const includeLow = options.includeLowConfidence !== false;
26
+ const maxPerChange = options.maxPerChange ?? 3;
27
+ return fleet.subscribe((change) => {
28
+ const added = change.added.filter((i) => includeLow || i.lowConfidence !== true);
29
+ if (added.length > 0) {
30
+ write('');
31
+ const shown = added.slice(0, maxPerChange);
32
+ for (const item of shown)
33
+ for (const line of renderAnnouncement(item))
34
+ write(line);
35
+ if (added.length > shown.length) {
36
+ write(` and ${added.length - shown.length} more. Run \`mx-agent console\` for the list.`);
37
+ }
38
+ write('');
39
+ return;
40
+ }
41
+ // Nothing new. A cleared item is worth one line, because an operator who
42
+ // was told about something is owed the news that it went away.
43
+ if (change.removed.length > 0) {
44
+ write(` cleared: ${change.removed.length} item(s) no longer need you.`);
45
+ }
46
+ });
47
+ }
48
+ //# sourceMappingURL=announce.js.map