@mmerterden/multi-agent-pipeline 20.43.1 → 21.0.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 (424) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/README.md +49 -37
  3. package/README.tr.md +48 -37
  4. package/SECURITY.md +4 -4
  5. package/docs/architecture.md +6 -6
  6. package/docs/ecosystem.md +35 -30
  7. package/docs/facts.json +11 -9
  8. package/docs/features.md +6 -5
  9. package/index.js +1 -1
  10. package/install/_common.mjs +5 -1
  11. package/install/_mcp-register.mjs +80 -5
  12. package/install/_plugin-skills.mjs +1 -1
  13. package/install/_unattended-profile.mjs +12 -3
  14. package/install/claude.mjs +45 -4
  15. package/install/codex.mjs +2 -2
  16. package/install/index.mjs +49 -9
  17. package/install/templates/claude-hooks.json +2 -2
  18. package/install/templates/codex-instructions.md +1 -1
  19. package/install/templates/copilot-instructions.md +7 -7
  20. package/manifest.json +410 -400
  21. package/package.json +4 -4
  22. package/pipeline/agents/security-auditor.md +2 -2
  23. package/pipeline/agents/test-gen-analyst.md +1 -1
  24. package/pipeline/commands/archive-guard.md +6 -6
  25. package/pipeline/commands/multi-agent/SKILL.md +23 -2
  26. package/pipeline/commands/multi-agent/analysis/SKILL.md +8 -0
  27. package/pipeline/commands/multi-agent/analysis-jira/SKILL.md +8 -0
  28. package/pipeline/commands/multi-agent/autopilot-off/SKILL.md +10 -6
  29. package/pipeline/commands/multi-agent/bug-bash/SKILL.md +1 -1
  30. package/pipeline/commands/multi-agent/channels/SKILL.md +8 -0
  31. package/pipeline/commands/multi-agent/complaint-analysis/SKILL.md +8 -0
  32. package/pipeline/commands/multi-agent/create-jira/SKILL.md +8 -0
  33. package/pipeline/commands/multi-agent/design-check/SKILL.md +9 -1
  34. package/pipeline/commands/multi-agent/issue/SKILL.md +8 -0
  35. package/pipeline/commands/multi-agent/jira/SKILL.md +8 -0
  36. package/pipeline/commands/multi-agent/kill/SKILL.md +8 -0
  37. package/pipeline/commands/multi-agent/office-off/SKILL.md +3 -4
  38. package/pipeline/commands/multi-agent/office-on/SKILL.md +2 -6
  39. package/pipeline/commands/multi-agent/office-status/SKILL.md +1 -6
  40. package/pipeline/commands/multi-agent/prune-logs/SKILL.md +2 -2
  41. package/pipeline/commands/multi-agent/purge/SKILL.md +8 -0
  42. package/pipeline/commands/multi-agent/refactor/SKILL.md +16 -8
  43. package/pipeline/commands/multi-agent/research/SKILL.md +1 -1
  44. package/pipeline/commands/multi-agent/resume/SKILL.md +8 -0
  45. package/pipeline/commands/multi-agent/review/SKILL.md +8 -0
  46. package/pipeline/commands/multi-agent/review-analysis/SKILL.md +8 -0
  47. package/pipeline/commands/multi-agent/review-issue/SKILL.md +8 -0
  48. package/pipeline/commands/multi-agent/review-jira/SKILL.md +8 -0
  49. package/pipeline/commands/multi-agent/review-priority/SKILL.md +18 -5
  50. package/pipeline/commands/multi-agent/route-on/SKILL.md +1 -1
  51. package/pipeline/commands/multi-agent/routines/SKILL.md +36 -14
  52. package/pipeline/commands/multi-agent/save/SKILL.md +1 -1
  53. package/pipeline/commands/multi-agent/scaffold/SKILL.md +8 -0
  54. package/pipeline/commands/multi-agent/search/SKILL.md +4 -4
  55. package/pipeline/commands/multi-agent/security-review/SKILL.md +9 -4
  56. package/pipeline/commands/multi-agent/setup/SKILL.md +7 -2
  57. package/pipeline/commands/multi-agent/store-ready/SKILL.md +5 -3
  58. package/pipeline/commands/multi-agent/sync/SKILL.md +20 -12
  59. package/pipeline/commands/multi-agent/test/SKILL.md +1 -1
  60. package/pipeline/commands/multi-agent/test-accessibility/SKILL.md +1 -1
  61. package/pipeline/commands/multi-agent/test-dark-mode/SKILL.md +1 -1
  62. package/pipeline/commands/multi-agent/test-dynamic-type/SKILL.md +1 -1
  63. package/pipeline/commands/multi-agent/test-gen/SKILL.md +1 -1
  64. package/pipeline/commands/multi-agent/test-screenshots/SKILL.md +1 -1
  65. package/pipeline/commands/multi-agent/testflight-validation/SKILL.md +1 -1
  66. package/pipeline/commands/multi-agent/uninstall/SKILL.md +3 -3
  67. package/pipeline/commands/multi-agent/update/SKILL.md +17 -12
  68. package/pipeline/commands/sim-test.md +5 -5
  69. package/pipeline/contract/CHANGELOG.md +92 -3
  70. package/pipeline/contract/README.md +92 -85
  71. package/pipeline/contract/build.mjs +0 -5
  72. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  73. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  74. package/pipeline/contract/manifest.json +102 -125
  75. package/pipeline/contract/types/index.d.ts +206 -49
  76. package/pipeline/lib/credential-inventory.sh +3 -2
  77. package/pipeline/lib/cross-repo.mjs +11 -6
  78. package/pipeline/lib/fetch-crashlytics.sh +5 -2
  79. package/pipeline/lib/mcp-rename.mjs +508 -0
  80. package/pipeline/lib/model-dispatch.sh +1 -1
  81. package/pipeline/lib/office-legacy.mjs +207 -0
  82. package/pipeline/lib/outbound-gate.mjs +8 -2
  83. package/pipeline/lib/route-state.sh +2 -2
  84. package/pipeline/lib/routine-secret-scan.mjs +166 -0
  85. package/pipeline/lib/toolkit-llm.sh +12 -10
  86. package/pipeline/lib/unattended.mjs +1 -1
  87. package/pipeline/lib/unattended.sh +1 -1
  88. package/pipeline/lib/untrusted-fence.mjs +1 -1
  89. package/pipeline/lib/usage-endpoint.mjs +32 -0
  90. package/pipeline/lib/usage-token.mjs +76 -0
  91. package/pipeline/multi-agent-refs/_input-parser.md +22 -0
  92. package/pipeline/multi-agent-refs/analysis/locked.md +1 -1
  93. package/pipeline/multi-agent-refs/android-guide.md +2 -2
  94. package/pipeline/multi-agent-refs/audit-guide.md +1 -1
  95. package/pipeline/multi-agent-refs/complaint-analysis/phases.md +1 -1
  96. package/pipeline/multi-agent-refs/cross-cli-contract.md +20 -18
  97. package/pipeline/multi-agent-refs/design-check/build-launch.md +2 -2
  98. package/pipeline/multi-agent-refs/design-check/compare.md +2 -2
  99. package/pipeline/multi-agent-refs/design-check/drive-capture.md +1 -1
  100. package/pipeline/multi-agent-refs/design-check/export.md +1 -1
  101. package/pipeline/multi-agent-refs/design-check/init-inventory.md +2 -2
  102. package/pipeline/multi-agent-refs/design-check/mcp-currency-gate.md +4 -4
  103. package/pipeline/multi-agent-refs/design-check/scope-and-ledger.md +1 -1
  104. package/pipeline/multi-agent-refs/features/build-facts.md +115 -0
  105. package/pipeline/multi-agent-refs/features/code-graph.md +8 -8
  106. package/pipeline/multi-agent-refs/features/code-intelligence.md +5 -5
  107. package/pipeline/multi-agent-refs/features/design-conformance.md +4 -4
  108. package/pipeline/multi-agent-refs/features/doctor.md +43 -4
  109. package/pipeline/multi-agent-refs/features/exploratory-testing.md +1 -1
  110. package/pipeline/multi-agent-refs/features/external-context-injection.md +1 -1
  111. package/pipeline/multi-agent-refs/features/free-models.md +5 -5
  112. package/pipeline/multi-agent-refs/features/office-threat-model.md +11 -32
  113. package/pipeline/multi-agent-refs/features/plan-attachment.md +55 -0
  114. package/pipeline/multi-agent-refs/features/product-context.md +1 -1
  115. package/pipeline/multi-agent-refs/features/routine-sharing.md +196 -0
  116. package/pipeline/multi-agent-refs/features/security-audit.md +3 -3
  117. package/pipeline/multi-agent-refs/features/test-classification.md +2 -2
  118. package/pipeline/multi-agent-refs/features/unattended-gates.md +1 -1
  119. package/pipeline/multi-agent-refs/features/unattended-security.md +8 -23
  120. package/pipeline/multi-agent-refs/features/usage-reporting.md +184 -15
  121. package/pipeline/multi-agent-refs/features/visual-evidence.md +1 -1
  122. package/pipeline/multi-agent-refs/help/en.md +138 -274
  123. package/pipeline/multi-agent-refs/help/tr.md +140 -274
  124. package/pipeline/multi-agent-refs/keychain.md +2 -2
  125. package/pipeline/multi-agent-refs/knowledge.md +4 -4
  126. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +3 -3
  127. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +2 -0
  128. package/pipeline/multi-agent-refs/outside-the-pipeline.md +2 -2
  129. package/pipeline/multi-agent-refs/phases/modes.md +17 -0
  130. package/pipeline/multi-agent-refs/phases/phase-0-init.md +21 -2
  131. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +8 -5
  132. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +2 -2
  133. package/pipeline/multi-agent-refs/phases/phase-3-review.md +4 -4
  134. package/pipeline/multi-agent-refs/phases/phase-5-report.md +10 -0
  135. package/pipeline/multi-agent-refs/refactor/sweep.md +4 -4
  136. package/pipeline/multi-agent-refs/refactor/toolkit-research.md +1 -1
  137. package/pipeline/multi-agent-refs/research/engine.md +1 -1
  138. package/pipeline/multi-agent-refs/rules.md +2 -2
  139. package/pipeline/multi-agent-refs/setup/app-store-connect.md +2 -2
  140. package/pipeline/multi-agent-refs/setup/firebase.md +3 -2
  141. package/pipeline/multi-agent-refs/setup/google-play.md +1 -1
  142. package/pipeline/multi-agent-refs/setup/token-save-flow.md +3 -2
  143. package/pipeline/multi-agent-refs/store-ready/gate-1-static.md +12 -2
  144. package/pipeline/multi-agent-refs/store-ready/gate-3-policy.md +3 -3
  145. package/pipeline/multi-agent-refs/store-ready/gates.md +2 -1
  146. package/pipeline/multi-agent-refs/store-ready/report.md +10 -1
  147. package/pipeline/multi-agent-refs/swiftui-guide.md +2 -2
  148. package/pipeline/multi-agent-refs/sync/codex.md +1 -1
  149. package/pipeline/multi-agent-refs/sync/dev-toolkit.md +5 -5
  150. package/pipeline/multi-agent-refs/sync/overview.md +2 -2
  151. package/pipeline/multi-agent-refs/sync/stack-plugins.md +2 -2
  152. package/pipeline/multi-agent-refs/tracker-contract.md +1 -1
  153. package/pipeline/multi-agent-refs/unattended-contract.md +1 -2
  154. package/pipeline/multi-agent-refs/web-guide.md +2 -2
  155. package/pipeline/office/index.html +1077 -170
  156. package/pipeline/office/toolkit.json +1 -1
  157. package/pipeline/preferences-template.json +6 -6
  158. package/pipeline/rules/figma-pipeline.md +2 -2
  159. package/pipeline/rules/outside-the-pipeline.md +1 -1
  160. package/pipeline/schemas/activity-chat.schema.json +1 -1
  161. package/pipeline/schemas/activity-roles.schema.json +1 -1
  162. package/pipeline/schemas/activity.schema.json +1 -1
  163. package/pipeline/schemas/agent-state.schema.json +36 -2
  164. package/pipeline/schemas/analysis-output.schema.json +1 -1
  165. package/pipeline/schemas/answer-request.schema.json +1 -1
  166. package/pipeline/schemas/answer-result.schema.json +1 -1
  167. package/pipeline/schemas/autopilot-config.schema.json +1 -1
  168. package/pipeline/schemas/autopilot-off-request.schema.json +1 -1
  169. package/pipeline/schemas/autopilot-off.schema.json +1 -1
  170. package/pipeline/schemas/autopilot-on-request.schema.json +1 -1
  171. package/pipeline/schemas/autopilot-on.schema.json +1 -1
  172. package/pipeline/schemas/autopilot-status.schema.json +1 -1
  173. package/pipeline/schemas/bug-bash-verification.schema.json +1 -1
  174. package/pipeline/schemas/code-graph.schema.json +1 -1
  175. package/pipeline/schemas/command-parameters.schema.json +1 -1
  176. package/pipeline/schemas/constitution.schema.json +1 -1
  177. package/pipeline/schemas/contract-error.schema.json +7 -13
  178. package/pipeline/schemas/criteria-manifest.schema.json +1 -1
  179. package/pipeline/schemas/design-check-config.schema.json +1 -1
  180. package/pipeline/schemas/diff-risk.schema.json +1 -1
  181. package/pipeline/schemas/disk-clean-request.schema.json +66 -0
  182. package/pipeline/schemas/disk-clean.schema.json +243 -0
  183. package/pipeline/schemas/doctor-report.schema.json +1 -1
  184. package/pipeline/schemas/explore-run.schema.json +1 -1
  185. package/pipeline/schemas/figma-project-config.schema.json +1 -1
  186. package/pipeline/schemas/gc-request.schema.json +1 -1
  187. package/pipeline/schemas/gc.schema.json +1 -1
  188. package/pipeline/schemas/issue-maturity.schema.json +1 -1
  189. package/pipeline/schemas/issues.schema.json +1 -1
  190. package/pipeline/schemas/job-change.schema.json +1 -1
  191. package/pipeline/schemas/job-request.schema.json +1 -1
  192. package/pipeline/schemas/kill-request.schema.json +1 -1
  193. package/pipeline/schemas/kill.schema.json +1 -1
  194. package/pipeline/schemas/launch-plan.schema.json +1 -1
  195. package/pipeline/schemas/launch-request.schema.json +2 -2
  196. package/pipeline/schemas/launch.schema.json +1 -1
  197. package/pipeline/schemas/learnings-ledger.schema.json +1 -1
  198. package/pipeline/schemas/ledger.schema.json +1 -1
  199. package/pipeline/schemas/office-archive.schema.json +2 -2
  200. package/pipeline/schemas/office-credentials.schema.json +1 -1
  201. package/pipeline/schemas/office-jobs.json +25 -0
  202. package/pipeline/schemas/office-jobs.schema.json +20 -1
  203. package/pipeline/schemas/office-memory.schema.json +1 -1
  204. package/pipeline/schemas/office-server-room.schema.json +1 -1
  205. package/pipeline/schemas/office-settings-request.schema.json +1 -1
  206. package/pipeline/schemas/office-settings.schema.json +1 -1
  207. package/pipeline/schemas/permissions.schema.json +1 -1
  208. package/pipeline/schemas/phases.json +4 -4
  209. package/pipeline/schemas/phases.schema.json +1 -1
  210. package/pipeline/schemas/plan-critique.schema.json +1 -1
  211. package/pipeline/schemas/planning-output.schema.json +1 -1
  212. package/pipeline/schemas/pr-reach.schema.json +1 -1
  213. package/pipeline/schemas/pr-request.schema.json +1 -1
  214. package/pipeline/schemas/prefs.schema.json +40 -18
  215. package/pipeline/schemas/product-tree-overlay.schema.json +1 -1
  216. package/pipeline/schemas/product-tree.schema.json +1 -1
  217. package/pipeline/schemas/prs.schema.json +1 -1
  218. package/pipeline/schemas/prune-logs-request.schema.json +1 -1
  219. package/pipeline/schemas/prune-logs.schema.json +1 -1
  220. package/pipeline/schemas/repo-change.schema.json +1 -1
  221. package/pipeline/schemas/repo-profile.schema.json +1 -1
  222. package/pipeline/schemas/repo-request.schema.json +1 -1
  223. package/pipeline/schemas/repos.schema.json +1 -1
  224. package/pipeline/schemas/research-output.schema.json +1 -1
  225. package/pipeline/schemas/resume-request.schema.json +1 -1
  226. package/pipeline/schemas/review-file-exclusions.schema.json +1 -1
  227. package/pipeline/schemas/review-verdict-request.schema.json +1 -1
  228. package/pipeline/schemas/review-verdict.schema.json +1 -1
  229. package/pipeline/schemas/reviewer-output.schema.json +1 -1
  230. package/pipeline/schemas/route-config.schema.json +2 -2
  231. package/pipeline/schemas/routine-delete.schema.json +1 -1
  232. package/pipeline/schemas/routines.schema.json +1 -1
  233. package/pipeline/schemas/run-evidence.schema.json +1 -1
  234. package/pipeline/schemas/run-log.schema.json +1 -1
  235. package/pipeline/schemas/run-questions.schema.json +1 -1
  236. package/pipeline/schemas/run-results.schema.json +1 -1
  237. package/pipeline/schemas/runs-index.schema.json +1 -1
  238. package/pipeline/schemas/scaffold-manifest.schema.json +1 -1
  239. package/pipeline/schemas/scope-check.schema.json +1 -1
  240. package/pipeline/schemas/secret-patterns.schema.json +1 -1
  241. package/pipeline/schemas/security-finding.schema.json +1 -1
  242. package/pipeline/schemas/service-read.schema.json +1 -1
  243. package/pipeline/schemas/shared-routine-import-request.schema.json +43 -0
  244. package/pipeline/schemas/shared-routine-import.schema.json +118 -0
  245. package/pipeline/schemas/shared-routine.schema.json +79 -0
  246. package/pipeline/schemas/shared-routines.schema.json +83 -0
  247. package/pipeline/schemas/skill-catalog.schema.json +91 -0
  248. package/pipeline/schemas/stack-adapters.schema.json +1 -1
  249. package/pipeline/schemas/stack-change.schema.json +1 -1
  250. package/pipeline/schemas/stack-request.schema.json +1 -1
  251. package/pipeline/schemas/stack.schema.json +1 -1
  252. package/pipeline/schemas/steer-request.schema.json +1 -1
  253. package/pipeline/schemas/steer.schema.json +1 -1
  254. package/pipeline/schemas/system-status.schema.json +2 -2
  255. package/pipeline/schemas/test-gap.schema.json +1 -1
  256. package/pipeline/schemas/test-gen-discovery.schema.json +1 -1
  257. package/pipeline/schemas/test-gen-gaps.schema.json +1 -1
  258. package/pipeline/schemas/test-gen-inventory.schema.json +1 -1
  259. package/pipeline/schemas/test-gen-results.schema.json +1 -1
  260. package/pipeline/schemas/token-budget.json +4 -4
  261. package/pipeline/schemas/token-budget.schema.json +1 -1
  262. package/pipeline/schemas/tool-call-request.schema.json +1 -1
  263. package/pipeline/schemas/tool-call.schema.json +1 -1
  264. package/pipeline/schemas/toolkit-path-params.json +56 -2
  265. package/pipeline/schemas/toolkit-path-params.schema.json +2 -2
  266. package/pipeline/schemas/tools.schema.json +2 -2
  267. package/pipeline/schemas/triage-corpus.schema.json +1 -1
  268. package/pipeline/schemas/triage-output.schema.json +1 -1
  269. package/pipeline/schemas/unattended-policy.json +8 -4
  270. package/pipeline/schemas/unattended-policy.schema.json +1 -1
  271. package/pipeline/schemas/unattended-profile.json +8 -6
  272. package/pipeline/schemas/unattended-profile.schema.json +1 -1
  273. package/pipeline/schemas/worktrees.schema.json +1 -1
  274. package/pipeline/scripts/_contract-core.mjs +1 -1
  275. package/pipeline/scripts/_contract-routes-catalog.mjs +31 -3
  276. package/pipeline/scripts/_contract-routes-ops.mjs +25 -2
  277. package/pipeline/scripts/_contract-routes-routines.mjs +327 -0
  278. package/pipeline/scripts/_contract-routes-runs.mjs +4 -47
  279. package/pipeline/scripts/_guard-probe.mjs +1 -1
  280. package/pipeline/scripts/_renamed-skills.mjs +20 -8
  281. package/pipeline/scripts/_sibling-root.mjs +1 -1
  282. package/pipeline/scripts/_stack-routing.mjs +3 -0
  283. package/pipeline/scripts/_user_guard_rules.py +22 -7
  284. package/pipeline/scripts/autopilot-control.mjs +14 -2
  285. package/pipeline/scripts/autopilot-loop.mjs +16 -1
  286. package/pipeline/scripts/autopilot-runner.mjs +37 -12
  287. package/pipeline/scripts/bulk-read.sh +1 -1
  288. package/pipeline/scripts/contract-server.mjs +72 -147
  289. package/pipeline/scripts/cost-table.json +2 -2
  290. package/pipeline/scripts/doctor.mjs +171 -10
  291. package/pipeline/scripts/feedback-send.mjs +2 -36
  292. package/pipeline/scripts/gen-facts.mjs +21 -1
  293. package/pipeline/scripts/gen-free-hosts.mjs +2 -2
  294. package/pipeline/scripts/gen-mode-dispatch.mjs +11 -7
  295. package/pipeline/scripts/graph-hint.mjs +1 -1
  296. package/pipeline/scripts/health-report.mjs +4 -3
  297. package/pipeline/scripts/job-launch.mjs +51 -10
  298. package/pipeline/scripts/launch-request.mjs +12 -25
  299. package/pipeline/scripts/migrate-prefs.mjs +21 -1
  300. package/pipeline/scripts/office-archive.mjs +1 -2
  301. package/pipeline/scripts/office-control.mjs +17 -92
  302. package/pipeline/scripts/office-disk.mjs +262 -0
  303. package/pipeline/scripts/office-server-room.mjs +1 -1
  304. package/pipeline/scripts/phase0-exit-gate.mjs +1 -1
  305. package/pipeline/scripts/plan-attachment.mjs +1082 -0
  306. package/pipeline/scripts/pre-commit-check.sh +4 -0
  307. package/pipeline/scripts/pre-push-check.sh +1 -1
  308. package/pipeline/scripts/probe-evidence-capability.sh +1 -1
  309. package/pipeline/scripts/repo-recommend.mjs +2 -2
  310. package/pipeline/scripts/routine-registry.mjs +537 -53
  311. package/pipeline/scripts/routine-share.mjs +442 -0
  312. package/pipeline/scripts/runs-index.mjs +1 -1
  313. package/pipeline/scripts/skill-catalog.mjs +302 -0
  314. package/pipeline/scripts/stack-toggle.mjs +104 -41
  315. package/pipeline/scripts/system-status.mjs +8 -2
  316. package/pipeline/scripts/test-classify.mjs +1 -1
  317. package/pipeline/scripts/toolkit-tools.mjs +4 -3
  318. package/pipeline/scripts/unattended_policy.py +18 -5
  319. package/pipeline/scripts/uninstall.mjs +71 -28
  320. package/pipeline/scripts/usage-access.mjs +384 -0
  321. package/pipeline/scripts/usage-identity.mjs +81 -14
  322. package/pipeline/scripts/usage-register.mjs +389 -72
  323. package/pipeline/scripts/usage-report.mjs +124 -11
  324. package/pipeline/scripts/work-items.mjs +1 -1
  325. package/pipeline/scripts/write-store-config.mjs +3 -3
  326. package/pipeline/skills/.skill-manifest.json +72 -68
  327. package/pipeline/skills/.skills-index.json +40 -29
  328. package/pipeline/skills/renamed.json +2 -1
  329. package/pipeline/skills/shared/README.md +13 -12
  330. package/pipeline/skills/shared/core/apple-archive-compliance/SKILL.md +14 -14
  331. package/pipeline/skills/shared/core/apple-archive-compliance/references/examples.md +1 -1
  332. package/pipeline/skills/shared/core/apple-archive-compliance/references/version-history.md +3 -3
  333. package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +1 -1
  334. package/pipeline/skills/shared/core/google-play-compliance/references/notes.md +1 -1
  335. package/pipeline/skills/shared/core/multi-agent/SKILL.md +14 -4
  336. package/pipeline/skills/shared/core/multi-agent-analysis/SKILL.md +8 -0
  337. package/pipeline/skills/shared/core/multi-agent-analysis-jira/SKILL.md +8 -0
  338. package/pipeline/skills/shared/core/multi-agent-autopilot-off/SKILL.md +6 -3
  339. package/pipeline/skills/shared/core/multi-agent-bug-bash/SKILL.md +1 -1
  340. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +8 -0
  341. package/pipeline/skills/shared/core/multi-agent-complaint-analysis/SKILL.md +9 -1
  342. package/pipeline/skills/shared/core/multi-agent-create-jira/SKILL.md +8 -0
  343. package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +13 -5
  344. package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +6 -6
  345. package/pipeline/skills/shared/core/multi-agent-help/SKILL.md +1 -1
  346. package/pipeline/skills/shared/core/multi-agent-issue/SKILL.md +8 -0
  347. package/pipeline/skills/shared/core/multi-agent-jira/SKILL.md +8 -0
  348. package/pipeline/skills/shared/core/multi-agent-kill/SKILL.md +8 -0
  349. package/pipeline/skills/shared/core/multi-agent-office-off/SKILL.md +2 -2
  350. package/pipeline/skills/shared/core/multi-agent-office-on/SKILL.md +1 -1
  351. package/pipeline/skills/shared/core/multi-agent-office-status/SKILL.md +2 -4
  352. package/pipeline/skills/shared/core/multi-agent-purge/SKILL.md +8 -0
  353. package/pipeline/skills/shared/core/multi-agent-refactor/SKILL.md +16 -8
  354. package/pipeline/skills/shared/core/multi-agent-research/SKILL.md +2 -2
  355. package/pipeline/skills/shared/core/multi-agent-resume/SKILL.md +8 -0
  356. package/pipeline/skills/shared/core/multi-agent-review/SKILL.md +8 -0
  357. package/pipeline/skills/shared/core/multi-agent-review-analysis/SKILL.md +8 -0
  358. package/pipeline/skills/shared/core/multi-agent-review-issue/SKILL.md +8 -0
  359. package/pipeline/skills/shared/core/multi-agent-review-jira/SKILL.md +8 -0
  360. package/pipeline/skills/shared/core/multi-agent-review-priority/SKILL.md +11 -2
  361. package/pipeline/skills/shared/core/multi-agent-route-on/SKILL.md +1 -1
  362. package/pipeline/skills/shared/core/multi-agent-routines/SKILL.md +17 -6
  363. package/pipeline/skills/shared/core/multi-agent-save/SKILL.md +3 -3
  364. package/pipeline/skills/shared/core/multi-agent-scaffold/SKILL.md +8 -0
  365. package/pipeline/skills/shared/core/multi-agent-search/SKILL.md +3 -3
  366. package/pipeline/skills/shared/core/multi-agent-security-review/SKILL.md +6 -5
  367. package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +7 -2
  368. package/pipeline/skills/shared/core/multi-agent-store-ready/SKILL.md +20 -8
  369. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +18 -10
  370. package/pipeline/skills/shared/core/multi-agent-test/SKILL.md +5 -3
  371. package/pipeline/skills/shared/core/multi-agent-test-accessibility/SKILL.md +5 -3
  372. package/pipeline/skills/shared/core/multi-agent-test-dark-mode/SKILL.md +5 -3
  373. package/pipeline/skills/shared/core/multi-agent-test-dynamic-type/SKILL.md +5 -3
  374. package/pipeline/skills/shared/core/multi-agent-test-gen/SKILL.md +2 -2
  375. package/pipeline/skills/shared/core/multi-agent-test-screenshots/SKILL.md +5 -3
  376. package/pipeline/skills/shared/core/multi-agent-testflight-validation/SKILL.md +7 -4
  377. package/pipeline/skills/shared/core/multi-agent-update/SKILL.md +75 -22
  378. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +2 -2
  379. package/pipeline/skills/shared/external/app-store-review/SKILL.md +1 -1
  380. package/pipeline/skills/shared/external/e2e-testing/SKILL.md +23 -23
  381. package/pipeline/skills/shared/external/e2e-testing/evals/evals.json +1 -1
  382. package/pipeline/skills/shared/external/e2e-testing/references/document-fixtures.md +6 -6
  383. package/pipeline/skills/shared/external/free-llm-apis/SKILL.md +2 -2
  384. package/pipeline/skills/shared/external/handle-request/SKILL.md +1 -1
  385. package/pipeline/skills/shared/external/hig-app-icons/SKILL.md +2 -2
  386. package/pipeline/skills/shared/external/hig-app-icons/references/icon-workflow.md +1 -1
  387. package/pipeline/skills/shared/external/ios-design-review/SKILL.md +12 -12
  388. package/pipeline/skills/shared/external/ios-design-review/evals/evals.json +1 -1
  389. package/pipeline/skills/shared/external/ios-design-review/references/appearance-matrix.md +17 -17
  390. package/pipeline/skills/shared/external/ios-design-review/references/checklist.md +1 -1
  391. package/pipeline/skills/shared/external/ios-simulator-debugging/SKILL.md +5 -5
  392. package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +4 -4
  393. package/pipeline/skills/shared/external/release-video/SKILL.md +147 -0
  394. package/pipeline/skills/shared/external/release-video/evals/evals.json +45 -0
  395. package/pipeline/skills/shared/external/reverse-engineer-own-app/SKILL.md +231 -0
  396. package/pipeline/skills/shared/external/reverse-engineer-own-app/evals/evals.json +43 -0
  397. package/pipeline/skills/shared/external/security-review/SKILL.md +2 -2
  398. package/pipeline/skills/shared/external/security-review/references/owasp-mobile-top10-2024.md +1 -1
  399. package/pipeline/skills/shared/external/security-review/references/owasp-web-api-top10-2021.md +1 -1
  400. package/pipeline/skills/shared/external/short-video-craft/SKILL.md +177 -0
  401. package/pipeline/skills/shared/external/short-video-craft/evals/evals.json +43 -0
  402. package/pipeline/skills/shared/external/short-video-craft/references/generated-defaults.md +24 -0
  403. package/pipeline/skills/shared/external/signal-community/SKILL.md +6 -6
  404. package/pipeline/skills/shared/external/test-result-triage/SKILL.md +4 -4
  405. package/pipeline/skills/shared/external/web-testing/SKILL.md +3 -3
  406. package/pipeline/skills/shared/external/web-testing/references/testing-examples.md +13 -13
  407. package/pipeline/skills/skills-index.md +9 -8
  408. package/pipeline/commands/multi-agent/autopilot/SKILL.md +0 -123
  409. package/pipeline/commands/multi-agent/office-pair/SKILL.md +0 -89
  410. package/pipeline/contract/fixtures/error-unsigned.json +0 -5
  411. package/pipeline/lib/office-remote.mjs +0 -228
  412. package/pipeline/lib/qr-code.mjs +0 -386
  413. package/pipeline/lib/web-push.mjs +0 -198
  414. package/pipeline/multi-agent-refs/features/office-remote-protocol.md +0 -317
  415. package/pipeline/multi-agent-refs/features/phone-api.md +0 -306
  416. package/pipeline/schemas/phone-devices.schema.json +0 -61
  417. package/pipeline/schemas/phone-signed-request.schema.json +0 -67
  418. package/pipeline/scripts/_phone-auth.mjs +0 -485
  419. package/pipeline/scripts/office-pair.mjs +0 -459
  420. package/pipeline/scripts/office-push.mjs +0 -613
  421. package/pipeline/scripts/office-remote-client.mjs +0 -490
  422. package/pipeline/scripts/phone-devices.mjs +0 -248
  423. package/pipeline/skills/shared/core/multi-agent-autopilot/SKILL.md +0 -62
  424. package/pipeline/skills/shared/core/multi-agent-office-pair/SKILL.md +0 -19
@@ -14,7 +14,10 @@
14
14
  *
15
15
  * - It never ships a secret: the token is REQUESTED, and it is write-only.
16
16
  * - It never writes the token to a file. The credential store holds it; prefs
17
- * hold only the name of the entry.
17
+ * hold only the name of the entry. The store is the helper of whichever host
18
+ * is installed (lib/usage-token.mjs credentialStores: ~/.claude, ~/.copilot,
19
+ * ~/.codex): a stored token is read from each in turn, a new one is written
20
+ * to the first.
18
21
  * - It never registers when `usageLog.optOut` is true. That is permanent and
19
22
  * checked before anything else, including any credential read (the
20
23
  * credential store and gh).
@@ -37,9 +40,35 @@
37
40
  * admin, no credential store: one status line, exit 0.
38
41
  * - It never reports run CONTENT. That is usage-report.mjs's contract, and it
39
42
  * is coarse metadata only.
43
+ * - It never keeps a member account's temporary password. When the site opens
44
+ * a member account for this login it may return the password once
45
+ * (`account.temporaryPassword`); it is printed once to the terminal, or in
46
+ * `--json` mode carried only in the stdout line, and never written to a
47
+ * file, a log, prefs or telemetry. The site is asked for it
48
+ * (`x-account-delivery: 1`) only when the output is seen, never under
49
+ * `--quiet` or `MULTI_AGENT_UNATTENDED=1`; otherwise it waits on the site
50
+ * for a later run. Limit: the printed block, or the --json line a setup or
51
+ * update session reads, lands in the host session transcript on disk, which
52
+ * this script cannot reach. The password stops working at the first sign-in
53
+ * (the site requires a new one) and expires after 7 days unused (the site
54
+ * enforces both), so the person should sign in promptly.
55
+ *
56
+ * A registration that keeps failing is recorded with the time it started
57
+ * failing (`failingSince` in usage-last-register.json); doctor, setup and
58
+ * update show "usage registration failing since <date>: <reason>".
40
59
  *
41
60
  * Usage:
42
61
  * node usage-register.mjs [--prefs <path>] [--json] [--quiet] [--dry-run] [--feedback] [--refresh] [--login <name>]
62
+ * node usage-register.mjs --status-line [--json]
63
+ *
64
+ * `--status-line` prints this machine's reporting state in one line when the
65
+ * person has something to do or know (reportingState), and nothing otherwise;
66
+ * with `--json` it prints the state object. It sends nothing.
67
+ *
68
+ * A context that cannot see the machine's GitHub accounts (an unattended run,
69
+ * or gh naming accounts whose token it cannot read) records `deferred`: it
70
+ * sends nothing, keeps the cached login and starts no back-off, and the next
71
+ * run that can see the accounts registers.
43
72
  *
44
73
  * `--refresh` re-checks which GitHub account on this machine can read the
45
74
  * pipeline repository instead of using the cached `usageLog.login`.
@@ -75,26 +104,33 @@ import { join } from "node:path";
75
104
  import { homedir, hostname, tmpdir } from "node:os";
76
105
  import { pathToFileURL } from "node:url";
77
106
  import { hostCommand } from "../lib/user-facing.mjs";
78
- import { canonicalEndpoint } from "../lib/usage-endpoint.mjs";
107
+ import { DEFAULT_ENDPOINT, canonicalEndpoint, registerUrlAllowed } from "../lib/usage-endpoint.mjs";
79
108
  import {
80
109
  LOGIN_RE,
81
110
  SSH_TIMEOUT_MS,
82
111
  credentialToken,
83
112
  displayPath,
84
113
  ghTokenFor,
114
+ identityHidden,
85
115
  resolveReportingLogin,
86
116
  sshKeygenBin,
87
117
  } from "./usage-identity.mjs";
88
118
  import { lockTimeoutFrom, updateJsonFileSync } from "../lib/json-file-lock.mjs";
89
- import { BEACON_ENV, beaconUrl, httpReason, transportReason } from "./usage-register-beacon.mjs";
119
+ import {
120
+ BEACON_ENV,
121
+ beaconUrl,
122
+ httpReason,
123
+ pipelineVersion,
124
+ transportReason,
125
+ } from "./usage-register-beacon.mjs";
90
126
  import { PREFS_ENV, prefsFileIn } from "../lib/prefs-value.mjs";
127
+ import { credentialStores } from "../lib/usage-token.mjs";
91
128
  import { exitOnHelp } from "../lib/cli-help.mjs";
92
129
  import { parseArgs } from "../lib/args.mjs";
130
+ import { isUnattended } from "../lib/unattended.mjs";
93
131
 
94
132
  exitOnHelp(import.meta.url);
95
133
 
96
- const DEFAULT_ENDPOINT = "https://mmerterden.com/api/usage/ingest";
97
- const BUILT_IN_HOSTS = ["mmerterden.com"];
98
134
  const TIMEOUT_MS = 10000;
99
135
  const CHECK_TIMEOUT_MS = 4000;
100
136
 
@@ -193,37 +229,30 @@ export function registerUrl(endpoint) {
193
229
  return ep.endsWith("/ingest") ? `${ep.slice(0, -"/ingest".length)}/register` : `${ep}/register`;
194
230
  }
195
231
 
196
- function storedToken(prefs, credStore) {
232
+ function storedToken(prefs, stores) {
197
233
  const name = prefs?.global?.keychainMapping?.usage_ingest;
198
- if (!name || !existsSync(credStore)) return null;
199
- const r = spawnSync("bash", [credStore, "get", name], { encoding: "utf8", timeout: 8000 });
200
- const out = (r.stdout || "").trim();
201
- return out || null;
234
+ if (!name) return null;
235
+ for (const store of stores) {
236
+ const r = spawnSync("bash", [store, "get", name], { encoding: "utf8", timeout: 8000 });
237
+ const out = (r.stdout || "").trim();
238
+ if (out) return out;
239
+ }
240
+ return null;
202
241
  }
203
242
 
204
243
  /**
205
244
  * May the gh token be sent to `url`? The token is a full GitHub credential, so
206
245
  * it only goes over https to the reporting site's own hosts or a host the prefs
207
246
  * name in `usageLog.trustedHosts`; http only to loopback (local development).
247
+ * The rule lives in lib/usage-endpoint.mjs, shared with routine sharing.
208
248
  */
209
- export function registerUrlAllowed(url, trustedHosts = []) {
210
- let u;
211
- try {
212
- u = new URL(url);
213
- } catch {
214
- return false;
215
- }
216
- if (u.protocol === "http:") return ["127.0.0.1", "localhost", "[::1]"].includes(u.hostname);
217
- if (u.protocol !== "https:") return false;
218
- const trusted = new Set([...BUILT_IN_HOSTS, ...trustedHosts].map((h) => String(h).toLowerCase()));
219
- return trusted.has(u.hostname.toLowerCase());
220
- }
249
+ export { registerUrlAllowed };
221
250
 
222
251
  // Transport goes through _http-post.mjs, which retries a connection-level
223
252
  // failure through curl (proxy variables, system trust store). The failure text
224
253
  // keeps both causes so a blocked corporate network is diagnosable.
225
- async function postJson(url, body, bearer = null) {
226
- const headers = bearer ? { Authorization: `Bearer ${bearer}` } : {};
254
+ async function postJson(url, body, bearer = null, extra = {}) {
255
+ const headers = { ...extra, ...(bearer ? { Authorization: `Bearer ${bearer}` } : {}) };
227
256
  const r = await postHttp({ url, headers, body: JSON.stringify(body), timeoutMs: TIMEOUT_MS });
228
257
  if (r.failure) {
229
258
  const causes = [r.fetchFailure && `fetch ${r.fetchFailure}`, `curl ${r.failure}`]
@@ -301,39 +330,97 @@ export function checkUrl(url) {
301
330
  return `${url.replace(/\/+$/, "")}/check`;
302
331
  }
303
332
 
333
+ export const ACCOUNT_DELIVERY_HEADER = "x-account-delivery";
334
+
335
+ const PASSWORD_RE = /^[A-Za-z0-9-]{16,64}$/;
336
+ const USERNAME_RE = /^[a-z0-9][a-z0-9._-]{2,31}$/;
337
+
338
+ /**
339
+ * The `account` field of a register or check answer, kept to the fields this
340
+ * script shows: a username plus either a temporary password and sign-in URL,
341
+ * or `exists` / `blocked`. Anything else is dropped.
342
+ */
343
+ export function accountOf(json) {
344
+ const a = json?.account;
345
+ if (
346
+ !a ||
347
+ typeof a !== "object" ||
348
+ typeof a.username !== "string" ||
349
+ !USERNAME_RE.test(a.username)
350
+ )
351
+ return null;
352
+ if (typeof a.temporaryPassword === "string" && PASSWORD_RE.test(a.temporaryPassword)) {
353
+ let loginUrl = null;
354
+ try {
355
+ const u = new URL(String(a.loginUrl));
356
+ const loopback = ["127.0.0.1", "localhost", "[::1]"].includes(u.hostname);
357
+ if (u.protocol === "https:" || (u.protocol === "http:" && loopback)) loginUrl = u.href;
358
+ } catch {
359
+ /* no usable URL: the block says where to sign in without one */
360
+ }
361
+ return { username: a.username, temporaryPassword: a.temporaryPassword, loginUrl };
362
+ }
363
+ if (a.blocked === true) return { username: a.username, blocked: true };
364
+ if (a.exists === true) return { username: a.username, exists: true };
365
+ return null;
366
+ }
367
+
368
+ /** The terminal block for a new member account's temporary password, shown once. */
369
+ export function accountBlock(account) {
370
+ return [
371
+ " -> member account opened on the reporting site",
372
+ ` username: ${account.username}`,
373
+ ` temporary password: ${account.temporaryPassword}`,
374
+ ` sign in at: ${account.loginUrl || "the site's /admin/login page"}`,
375
+ " change it on first login; it is shown only this once and kept nowhere",
376
+ ];
377
+ }
378
+
304
379
  /**
305
380
  * Ask the server whether the stored ingest token still works. The token goes
306
381
  * only in the `x-usage-token` header (from memory, never an argv), and only to
307
382
  * a URL `registerUrlAllowed` accepts; the caller checks that first.
308
- * Returns "valid", "invalid" (an explicit `valid: false`), or "unknown" for a
309
- * transport failure, a timeout, a redirect or any answer without a verdict.
383
+ * `verdict` is "valid", "invalid" (an explicit `valid: false`), or "unknown"
384
+ * for a transport failure, a timeout, a redirect or any answer without a
385
+ * verdict. `account` is a member account the answer names (accountOf); the
386
+ * site includes a temporary password only when `deliver` asked for it.
310
387
  */
311
- export async function checkStoredToken(url, token, post = postHttp) {
388
+ export async function checkStoredTokenDetailed(
389
+ url,
390
+ token,
391
+ post = postHttp,
392
+ { deliver = false } = {},
393
+ ) {
312
394
  let r;
313
395
  try {
314
396
  r = await post({
315
397
  url: checkUrl(url),
316
- headers: { "x-usage-token": token },
398
+ headers: { "x-usage-token": token, ...(deliver ? { [ACCOUNT_DELIVERY_HEADER]: "1" } : {}) },
317
399
  body: "{}",
318
400
  timeoutMs: CHECK_TIMEOUT_MS,
319
401
  });
320
402
  } catch {
321
- return "unknown";
403
+ return { verdict: "unknown", account: null };
322
404
  }
323
- if (!r || r.failure || r.status !== 200) return "unknown";
405
+ if (!r || r.failure || r.status !== 200) return { verdict: "unknown", account: null };
324
406
  let json;
325
407
  try {
326
408
  json = JSON.parse(r.body);
327
409
  } catch {
328
- return "unknown";
410
+ return { verdict: "unknown", account: null };
329
411
  }
330
- if (json?.valid === true) return "valid";
331
- if (json?.valid === false) return "invalid";
332
- return "unknown";
412
+ if (json?.valid === true) return { verdict: "valid", account: accountOf(json) };
413
+ if (json?.valid === false) return { verdict: "invalid", account: null };
414
+ return { verdict: "unknown", account: null };
415
+ }
416
+
417
+ /** The verdict alone; see checkStoredTokenDetailed. */
418
+ export async function checkStoredToken(url, token, post = postHttp) {
419
+ return (await checkStoredTokenDetailed(url, token, post)).verdict;
333
420
  }
334
421
 
335
- async function requestToken(url, body, proof, method) {
336
- const { res, json, failure, reason } = await postJson(url, body, proof);
422
+ async function requestToken(url, body, proof, method, extra = {}) {
423
+ const { res, json, failure, reason } = await postJson(url, body, proof, extra);
337
424
  if (failure) return { token: null, why: failure, reason };
338
425
  if (!res.ok) {
339
426
  const code = typeof json?.code === "string" ? json.code : null;
@@ -344,12 +431,20 @@ async function requestToken(url, body, proof, method) {
344
431
  reason: httpReason(res.status, code),
345
432
  };
346
433
  }
347
- if (json?.accepted === false)
434
+ if (json?.accepted === false) {
435
+ if (json?.code === "pending_approval" || json?.reason === "pending_approval")
436
+ return {
437
+ token: null,
438
+ declined: true,
439
+ pending: true,
440
+ why: "the site holds this registration until its owner approves it",
441
+ };
348
442
  return { token: null, declined: true, why: "the endpoint declined this login" };
443
+ }
349
444
  const token = typeof json?.token === "string" ? json.token.trim() : "";
350
445
  const pinnedLogin = typeof json?.u === "string" && json.u.trim() ? json.u.trim() : null;
351
446
  return token
352
- ? { token, why: null, login: pinnedLogin }
447
+ ? { token, why: null, login: pinnedLogin, account: accountOf(json) }
353
448
  : { token: null, why: "endpoint returned no token", reason: "other" };
354
449
  }
355
450
 
@@ -394,7 +489,7 @@ export function challengeUrl(url) {
394
489
  return `${url.replace(/\/+$/, "")}/challenge`;
395
490
  }
396
491
 
397
- async function requestTokenWithSsh(url, body, key) {
492
+ async function requestTokenWithSsh(url, body, key, extra = {}) {
398
493
  const ch = await postJson(challengeUrl(url), { u: body.u });
399
494
  if (ch.failure) return { token: null, why: ch.failure, reason: ch.reason };
400
495
  if (!ch.res.ok) {
@@ -426,7 +521,7 @@ async function requestTokenWithSsh(url, body, key) {
426
521
  reason: "no-proof",
427
522
  };
428
523
  }
429
- return requestToken(url, { ...body, ssh: { challenge, signature } }, null, "ssh");
524
+ return requestToken(url, { ...body, ssh: { challenge, signature } }, null, "ssh", extra);
430
525
  }
431
526
 
432
527
  /** The account name the person typed at setup or update, when it is a GitHub login. */
@@ -620,27 +715,159 @@ function reportingStaysOff(status, detail) {
620
715
 
621
716
  export const LAST_REGISTER_FILE = "usage-last-register.json";
622
717
 
718
+ /** Outcomes that mean this machine could not register for a reason it did not choose. */
719
+ const FAILING = new Set(["unavailable", "declined"]);
720
+
623
721
  /**
624
722
  * Overwrites the record of the most recent registration attempt. Registration
625
723
  * runs quietly from setup, update and Phase 0, so this file is where a machine
626
- * that never registers shows why; doctor reads it. It holds no token.
724
+ * that never registers shows why; doctor reads it. It holds no token and no
725
+ * password. A failure keeps the `failingSince` of the failure before it, so
726
+ * the record says how long registration has been failing; any other outcome
727
+ * clears it. `noticed` carries forward which held-for-approval send was
728
+ * already announced. Returns the record written.
627
729
  */
628
- function recordRegister(home, status, detail) {
730
+ export function recordRegister(home, status, detail, { reason = null, noticed } = {}) {
629
731
  const dir = join(home, ".claude", "logs", "multi-agent");
630
732
  const target = join(dir, LAST_REGISTER_FILE);
631
733
  const tmp = `${target}.${process.pid}.tmp`;
734
+ const before = readJson(target) || {};
735
+ const t = new Date().toISOString();
736
+ const entry = { t, status, detail: String(detail ?? "").slice(0, 300) };
737
+ if (reason) entry.reason = String(reason).slice(0, 40);
738
+ if (FAILING.has(status)) {
739
+ entry.failingSince =
740
+ (FAILING.has(before.status) || before.status === "deferred") &&
741
+ typeof before.failingSince === "string"
742
+ ? before.failingSince
743
+ : t;
744
+ } else if (status === "deferred" && typeof before.failingSince === "string") {
745
+ // A deferred attempt tried nothing, so it neither ends nor extends a failure.
746
+ entry.failingSince = before.failingSince;
747
+ }
748
+ const keep = noticed !== undefined ? noticed : before.noticedPendingSend;
749
+ if (typeof keep === "string") entry.noticedPendingSend = keep;
632
750
  try {
633
751
  mkdirSync(dir, { recursive: true });
634
- const entry = {
635
- t: new Date().toISOString(),
636
- status,
637
- detail: String(detail ?? "").slice(0, 300),
638
- };
639
752
  writeFileSync(tmp, JSON.stringify(entry) + "\n", { mode: 0o600 });
640
753
  renameSync(tmp, target);
641
754
  } catch {
642
755
  /* logs dir unwritable - never break the caller */
643
756
  }
757
+ return entry;
758
+ }
759
+
760
+ /** "usage registration failing since <date>: <detail>" for a failing record, else null. */
761
+ export function failingLine(entry) {
762
+ if (!entry || !FAILING.has(entry.status) || typeof entry.failingSince !== "string") return null;
763
+ return `usage registration failing since ${entry.failingSince.slice(0, 10)}: ${entry.detail || entry.status}`;
764
+ }
765
+
766
+ const NO_IDENTITY_LINE = {
767
+ en: "registration waiting: enter your GitHub username with /multi-agent:setup",
768
+ tr: "kayıt bekliyor: GitHub kullanıcı adını /multi-agent:setup ile gir",
769
+ };
770
+
771
+ function shortTime(t) {
772
+ return typeof t === "string" && t ? t.replace(/\.\d+Z$/, "Z") : null;
773
+ }
774
+
775
+ /**
776
+ * The reporting state of this machine in one line, from the records of the
777
+ * last send (usage-last-send.json) and the last registration attempt
778
+ * (usage-last-register.json). `state` is one of: opted-out, accepted,
779
+ * healed, rejected, pending-approval, deferred, no-identity, other, none.
780
+ * `attention` is true when the person has something to do or to know.
781
+ * The no-identity line, the one that asks the person for something, follows
782
+ * `lang` (outputLanguage); the rest is English like the rest of doctor.
783
+ */
784
+ export function reportingState({ send = null, register = null, usageLog = {}, lang = "en" } = {}) {
785
+ const sendAt = shortTime(send?.t);
786
+ const lastSend = sendAt ? `last send ${sendAt}` : "nothing sent yet";
787
+ // The records carry text from the server (a refusal's detail), so the line
788
+ // is reduced to printable characters before doctor or a report prints it.
789
+ const mk = (state, line, attention) => ({
790
+ state,
791
+ line: `usage reporting: ${line}`.replace(/[\p{Cc}\p{Cf}]+/gu, " "),
792
+ attention,
793
+ });
794
+ if (usageLog?.optOut === true) return mk("opted-out", "off (opted out)", false);
795
+ const pending =
796
+ register?.status === "pending-approval" ||
797
+ (send?.outcome === "not-accepted" && send?.reason === "pending_approval");
798
+ if (pending) {
799
+ return mk(
800
+ "pending-approval",
801
+ `waiting for the site owner's approval; logs start after approval (${lastSend})`,
802
+ true,
803
+ );
804
+ }
805
+ const registerNewer =
806
+ typeof register?.t === "string" && (!sendAt || String(register.t) > String(send.t));
807
+ if (registerNewer && register.status === "deferred") {
808
+ return mk(
809
+ "deferred",
810
+ `deferred, identity not visible in this context; the next run in a normal terminal registers (${lastSend})`,
811
+ true,
812
+ );
813
+ }
814
+ const noIdentity =
815
+ (registerNewer || !send) &&
816
+ register?.status === "skipped" &&
817
+ /^(cached: )?no GitHub account on this machine/.test(String(register.detail || ""));
818
+ if (noIdentity || (send?.outcome === "skipped" && send?.reason === "no-login")) {
819
+ return {
820
+ state: "no-identity",
821
+ line: lang === "tr" ? NO_IDENTITY_LINE.tr : NO_IDENTITY_LINE.en,
822
+ attention: true,
823
+ };
824
+ }
825
+ if (send?.outcome === "accepted") {
826
+ return send.healed === true
827
+ ? mk(
828
+ "healed",
829
+ `registered; the stored token was rejected, registration ran again and the resend was accepted (${lastSend})`,
830
+ false,
831
+ )
832
+ : mk("accepted", `registered, last send accepted (${lastSend})`, false);
833
+ }
834
+ if (send?.outcome === "rejected" && Number(send.status) === 401) {
835
+ const heal = send.heal
836
+ ? `self-heal: ${send.heal}${send.healDetail ? ` (${send.healDetail})` : ""}`
837
+ : "self-heal not tried";
838
+ return mk("rejected", `token rejected (401); ${heal} (${lastSend})`, true);
839
+ }
840
+ if (register?.status === "deferred") {
841
+ return mk("deferred", `deferred, identity not visible in this context (${lastSend})`, true);
842
+ }
843
+ if (send) {
844
+ const detail = [send.status, send.reason].filter(Boolean).join(", ");
845
+ return mk(
846
+ "other",
847
+ `last send ${send.outcome}${detail ? ` (${detail})` : ""} at ${sendAt}`,
848
+ true,
849
+ );
850
+ }
851
+ if (register?.status) {
852
+ return mk(
853
+ "other",
854
+ `last registration ${register.status} (${lastSend})`,
855
+ register.status !== "registered",
856
+ );
857
+ }
858
+ return mk("none", lastSend, false);
859
+ }
860
+
861
+ /**
862
+ * The last ingest send (usage-report.mjs) that the site held because its
863
+ * token waits for the owner's approval, when this machine has not been told
864
+ * yet: its timestamp, else null.
865
+ */
866
+ function unannouncedPendingSend(home, noticed) {
867
+ const last = readJson(join(home, ".claude", "logs", "multi-agent", "usage-last-send.json"));
868
+ if (!last || last.outcome !== "not-accepted" || last.reason !== "pending_approval") return null;
869
+ if (typeof last.t !== "string" || last.t === noticed) return null;
870
+ return last.t;
644
871
  }
645
872
 
646
873
  /**
@@ -669,7 +896,14 @@ function sendFailureBeacon({ home, prefsPath, login, reason, dryRun }) {
669
896
  }
670
897
  }
671
898
 
672
- async function main(argv) {
899
+ /**
900
+ * One registration attempt, the same one the command line runs; usage-report
901
+ * calls it in-process when the ingest endpoint rejects the stored token.
902
+ * `ingestRejected` says the ingest endpoint just answered 401 for the stored
903
+ * token, so only a check that calls it valid keeps it. Never throws for an
904
+ * expected outcome and never prompts. Returns the outcome `--json` prints.
905
+ */
906
+ export async function register(argv, { ingestRejected = false } = {}) {
673
907
  const opts = {
674
908
  quiet: false,
675
909
  json: false,
@@ -680,7 +914,7 @@ async function main(argv) {
680
914
  login: null,
681
915
  };
682
916
  parseArgs(argv, {
683
- booleans: ["quiet", "json", "dry-run", "feedback", "refresh"],
917
+ booleans: ["quiet", "json", "dry-run", "feedback", "refresh", "status-line"],
684
918
  values: ["prefs", "login"],
685
919
  unknown: "positional",
686
920
  equals: false,
@@ -690,21 +924,60 @@ async function main(argv) {
690
924
  if (flag === "prefs") opts.prefs = value === true ? undefined : value;
691
925
  else if (flag === "login") opts.login = value === true ? "" : value;
692
926
  else if (flag === "dry-run") opts.dryRun = true;
927
+ else if (flag === "status-line") opts.statusLine = true;
693
928
  else if (flag !== null) opts[flag] = true;
694
929
  },
695
930
  });
696
931
  const HOME = homedir();
697
932
  const prefsPath = opts.prefs || prefsFileIn(HOME);
698
- const credStore = join(HOME, ".claude", "lib", "credential-store.sh");
933
+
934
+ // Reads two local records and prefs; sends nothing, reads no credential.
935
+ if (opts.statusLine) {
936
+ const logs = join(HOME, ".claude", "logs", "multi-agent");
937
+ const g = readJson(prefsPath)?.global || {};
938
+ const s = reportingState({
939
+ send: readJson(join(logs, "usage-last-send.json")),
940
+ register: readJson(join(logs, LAST_REGISTER_FILE)),
941
+ usageLog: g.usageLog || {},
942
+ lang: g.outputLanguage === "tr" ? "tr" : "en",
943
+ });
944
+ if (opts.json) process.stdout.write(`${JSON.stringify(s)}\n`);
945
+ else if (s.attention) process.stdout.write(`${s.line}\n`);
946
+ return s;
947
+ }
948
+ const stores = credentialStores(HOME);
699
949
 
700
950
  const say = (line) => {
701
951
  if (!opts.quiet) process.stdout.write(`${line}\n`);
702
952
  };
703
953
  const identity = { login: undefined };
704
954
  const beacon = { login: null };
705
- const outcome = { tokenCheck: "skipped", refusal: null };
955
+ const outcome = { tokenCheck: "skipped", refusal: null, account: null };
956
+ // A temporary password is asked for only when someone will see it: never
957
+ // under --quiet and never in an unattended run.
958
+ const deliver = !opts.quiet && !isUnattended(process.env);
959
+ const delivery = deliver ? { [ACCOUNT_DELIVERY_HEADER]: "1" } : {};
960
+ const previous = readJson(join(HOME, ".claude", "logs", "multi-agent", LAST_REGISTER_FILE)) || {};
961
+ const pendingSend = unannouncedPendingSend(HOME, previous.noticedPendingSend);
962
+ if (pendingSend && !opts.quiet) {
963
+ say(
964
+ " -> operational reporting: the site holds this machine's records until its owner approves the token",
965
+ );
966
+ }
706
967
  const done = (status, detail, reason = null) => {
707
- if (!opts.dryRun) recordRegister(HOME, status, detail);
968
+ const record = opts.dryRun
969
+ ? null
970
+ : recordRegister(HOME, status, detail, {
971
+ reason,
972
+ noticed: pendingSend && !opts.quiet ? pendingSend : undefined,
973
+ });
974
+ const failing = failingLine(record);
975
+ const account = outcome.account;
976
+ if (account?.temporaryPassword && !opts.json && !opts.quiet) {
977
+ for (const line of accountBlock(account)) process.stdout.write(`${line}\n`);
978
+ } else if (account?.blocked && !opts.json) {
979
+ say(` -> member account ${account.username} is blocked on the reporting site`);
980
+ }
708
981
  sendFailureBeacon({
709
982
  home: HOME,
710
983
  prefsPath,
@@ -712,16 +985,24 @@ async function main(argv) {
712
985
  reason,
713
986
  dryRun: opts.dryRun,
714
987
  });
988
+ const needsPersonalAccount =
989
+ status !== "deferred" && personalAccountMissing(readJson(prefsPath), identity.login);
990
+ const out = { status, detail, needsPersonalAccount, tokenCheck: outcome.tokenCheck };
991
+ if (outcome.refusal) out.refusal = outcome.refusal;
992
+ if (failing) out.failingSince = record.failingSince;
993
+ if (pendingSend) out.pendingApproval = true;
715
994
  if (opts.json) {
716
- const needsPersonalAccount = personalAccountMissing(readJson(prefsPath), identity.login);
717
- const out = { status, detail, needsPersonalAccount, tokenCheck: outcome.tokenCheck };
718
- if (outcome.refusal) out.refusal = outcome.refusal;
995
+ if (account) out.account = account;
719
996
  process.stdout.write(`${JSON.stringify(out)}\n`);
997
+ } else if (failing && !opts.quiet && record.failingSince !== record.t) {
998
+ say(` -> ${failing}`);
720
999
  }
721
1000
  if (opts.quiet && reportingStaysOff(status, detail)) {
722
- process.stderr.write(`multi-agent: usage reporting is off - ${detail}\n`);
1001
+ process.stderr.write(
1002
+ `multi-agent: usage reporting is off - ${failing ? failing.replace(/^usage registration /, "") : detail}\n`,
1003
+ );
723
1004
  }
724
- return 0;
1005
+ return out;
725
1006
  };
726
1007
 
727
1008
  const prefs = readJson(prefsPath);
@@ -763,16 +1044,22 @@ async function main(argv) {
763
1044
  pre.reason,
764
1045
  );
765
1046
  // The stored token stays in memory and is sent only in the check's header.
766
- const stored = identityMatters ? storedToken(prefs, credStore) : null;
1047
+ const stored = identityMatters ? storedToken(prefs, stores) : null;
767
1048
  const checkAt = registerUrl(prefs.global?.usageLog?.endpoint);
768
1049
  if (
769
1050
  stored &&
770
1051
  !opts.dryRun &&
771
1052
  registerUrlAllowed(checkAt, prefs.global?.usageLog?.trustedHosts || [])
772
1053
  ) {
773
- outcome.tokenCheck = await checkStoredToken(checkAt, stored);
1054
+ const checked = await checkStoredTokenDetailed(checkAt, stored, postHttp, { deliver });
1055
+ outcome.tokenCheck = checked.verdict;
1056
+ outcome.account = checked.account;
774
1057
  }
775
- const rejected = outcome.tokenCheck === "invalid";
1058
+ // After an ingest 401 only an explicit "valid" keeps the token: the ingest
1059
+ // endpoint already answered for it, and an undecided check adds nothing.
1060
+ const rejected =
1061
+ outcome.tokenCheck === "invalid" ||
1062
+ (ingestRejected && Boolean(stored) && outcome.tokenCheck !== "valid");
776
1063
  if (rejected) {
777
1064
  say(" -> operational reporting: the stored token is no longer accepted; registering again");
778
1065
  }
@@ -782,6 +1069,14 @@ async function main(argv) {
782
1069
  : { login: undefined, reason: null };
783
1070
  const current = readJson(prefsPath) || prefs;
784
1071
  const cu = current.global?.usageLog || {};
1072
+ // A context that cannot see this machine's accounts (usage-identity.mjs
1073
+ // `hidden`) decides nothing: no declared or pinned name is sent in place of
1074
+ // a proof, no claim back-off starts, and the next run that can see the
1075
+ // accounts registers. Only a usable, pinned token is left to the normal path.
1076
+ if (identityMatters && who.hidden && !who.login && opts.login === null && !(has && pinned(cu))) {
1077
+ say(` -> operational reporting: deferred (${who.reason})`);
1078
+ return done("deferred", who.reason);
1079
+ }
785
1080
  // With no usable token, the login this machine was pinned to is a name
786
1081
  // already known, so it is registered as declared rather than asked for.
787
1082
  const known = !has && pinned(cu) && LOGIN_RE.test(cu.registeredAs) ? cu.registeredAs : null;
@@ -853,6 +1148,13 @@ async function main(argv) {
853
1148
  return done("dry-run", url);
854
1149
  }
855
1150
 
1151
+ // The version and platform go with the request so a failure the site
1152
+ // answers itself is recorded with them.
1153
+ const version = pipelineVersion(HOME);
1154
+ const context = {
1155
+ ...(version ? { v: version } : {}),
1156
+ ...(["darwin", "linux"].includes(process.platform) ? { os: process.platform } : {}),
1157
+ };
856
1158
  let result;
857
1159
  if (who.method === "claim") {
858
1160
  const failedAt = Date.parse(current.global?.usageLog?.claimFailedAt ?? "");
@@ -861,11 +1163,16 @@ async function main(argv) {
861
1163
  return done("skipped", "declared registration refused recently");
862
1164
  }
863
1165
  const label = claimLabel(prefsPath, current.global?.usageLog, host);
864
- result = await requestToken(url, { u: user, c: label, claim: true }, null, "claim");
1166
+ result = await requestToken(url, { u: user, c: label, claim: true, ...context }, null, "claim");
865
1167
  } else if (who.method === "ssh") {
866
- result = await requestTokenWithSsh(url, { u: user, c: host }, who.key);
1168
+ result = await requestTokenWithSsh(url, { u: user, c: host, ...context }, who.key, delivery);
867
1169
  } else {
868
1170
  const proof = who.method === "credential" ? credentialToken() : ghTokenFor(user);
1171
+ if (!proof && identityHidden()) {
1172
+ const why = `identity not visible in this context (no ${who.method || "gh"} token readable for the cached login ${user})`;
1173
+ say(` -> operational reporting: deferred (${why})`);
1174
+ return done("deferred", why);
1175
+ }
869
1176
  if (!proof) {
870
1177
  const why =
871
1178
  who.method === "credential"
@@ -874,9 +1181,17 @@ async function main(argv) {
874
1181
  say(` -> operational reporting left off (${why})`);
875
1182
  return done("unavailable", why, "no-proof");
876
1183
  }
877
- result = await requestToken(url, { u: user, c: host }, proof, who.method || "gh");
1184
+ result = await requestToken(
1185
+ url,
1186
+ { u: user, c: host, ...context },
1187
+ proof,
1188
+ who.method || "gh",
1189
+ delivery,
1190
+ );
878
1191
  }
879
- const { token, why, declined, code, reason, login: pinnedLogin } = result;
1192
+ const { token, why, declined, pending, code, reason, login: pinnedLogin } = result;
1193
+ // A declared login proves nothing, so no member account is shown for it.
1194
+ if (result.account && who.method !== "claim") outcome.account = result.account;
880
1195
  if (who.method === "claim" && ["not_collaborator", "proof_required"].includes(code)) {
881
1196
  outcome.refusal = code;
882
1197
  declareLogin(prefsPath, null);
@@ -888,7 +1203,7 @@ async function main(argv) {
888
1203
  patchUsageLog(prefsPath, { claimFailedAt: new Date().toISOString() });
889
1204
  if (declined) {
890
1205
  say(` -> operational reporting left off (${why})`);
891
- return done("declined", why);
1206
+ return done(pending ? "pending-approval" : "declined", why);
892
1207
  }
893
1208
  if (!token) {
894
1209
  say(` -> operational reporting left off (${why})`);
@@ -902,11 +1217,13 @@ async function main(argv) {
902
1217
  rejected && typeof mapped === "string" && /^[A-Za-z0-9._-]{1,128}$/.test(mapped)
903
1218
  ? mapped
904
1219
  : `${process.env.USER || user}_Usage_Ingest_Token`;
905
- const set = spawnSync("bash", [credStore, "set", entry, "-"], {
906
- input: token,
907
- encoding: "utf8",
908
- timeout: 10000,
909
- });
1220
+ const set = stores.length
1221
+ ? spawnSync("bash", [stores[0], "set", entry, "-"], {
1222
+ input: token,
1223
+ encoding: "utf8",
1224
+ timeout: 10000,
1225
+ })
1226
+ : { status: 1 };
910
1227
  if (set.status !== 0) {
911
1228
  say(" -> operational reporting left off (the credential store refused the token)");
912
1229
  beacon.login = pinnedLogin || user;
@@ -940,7 +1257,7 @@ function isEntrypoint() {
940
1257
  }
941
1258
 
942
1259
  if (isEntrypoint()) {
943
- main(process.argv.slice(2)).then((code) => {
944
- process.exitCode = code;
1260
+ register(process.argv.slice(2)).then(() => {
1261
+ process.exitCode = 0;
945
1262
  });
946
1263
  }