@mmerterden/multi-agent-pipeline 23.3.0 → 23.4.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 (224) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +25 -6
  3. package/README.tr.md +26 -7
  4. package/docs/adr/0008-installer-modularization-and-secret-leak-defense.md +1 -1
  5. package/docs/adr/0010-own-code-graph.md +299 -8
  6. package/docs/architecture.md +3 -3
  7. package/docs/ecosystem.md +10 -10
  8. package/docs/engineering.md +4 -4
  9. package/docs/facts.json +8 -8
  10. package/docs/features.md +5 -5
  11. package/docs/performance.md +17 -17
  12. package/install/_dev-only-files.mjs +9 -0
  13. package/install/claude.mjs +28 -2
  14. package/install/templates/claude-hooks.json +32 -1
  15. package/manifest.json +223 -155
  16. package/package.json +11 -3
  17. package/pipeline/commands/multi-agent/SKILL.md +1 -1
  18. package/pipeline/commands/multi-agent/design-check/SKILL.md +2 -2
  19. package/pipeline/commands/multi-agent/diff-explain/SKILL.md +3 -3
  20. package/pipeline/commands/multi-agent/graph/SKILL.md +57 -24
  21. package/pipeline/commands/multi-agent/pair/SKILL.md +92 -0
  22. package/pipeline/commands/multi-agent/prune-prompts/SKILL.md +1 -1
  23. package/pipeline/commands/multi-agent/search/SKILL.md +7 -1
  24. package/pipeline/commands/multi-agent/status/SKILL.md +4 -0
  25. package/pipeline/commands/multi-agent/sync/SKILL.md +3 -3
  26. package/pipeline/contract/CHANGELOG.md +49 -0
  27. package/pipeline/contract/build.mjs +13 -1
  28. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  29. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  30. package/pipeline/contract/fixtures/runs-awaiting-question.json +4 -1
  31. package/pipeline/contract/fixtures/runs-empty.json +1 -1
  32. package/pipeline/contract/fixtures/runs-failed.json +4 -1
  33. package/pipeline/contract/fixtures/runs-old-schema.json +3 -0
  34. package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +4 -1
  35. package/pipeline/contract/fixtures/runs-pr-opened.json +4 -1
  36. package/pipeline/contract/fixtures/runs-running.json +4 -1
  37. package/pipeline/contract/manifest.json +28 -15
  38. package/pipeline/contract/types/index.d.ts +55 -3
  39. package/pipeline/lib/detach-self.mjs +95 -0
  40. package/pipeline/lib/public-mcp-servers.mjs +33 -0
  41. package/pipeline/lib/rotated-log.mjs +93 -0
  42. package/pipeline/lib/tls-trust.mjs +29 -0
  43. package/pipeline/lib/usage-lifecycle.mjs +9 -11
  44. package/pipeline/lib/usage-names.generated.mjs +614 -0
  45. package/pipeline/lib/usage-run-key.mjs +235 -0
  46. package/pipeline/lib/usage-vocab.mjs +210 -0
  47. package/pipeline/multi-agent-refs/analysis/intake.md +2 -2
  48. package/pipeline/multi-agent-refs/analysis/render.md +1 -1
  49. package/pipeline/multi-agent-refs/channels/generator.md +4 -5
  50. package/pipeline/multi-agent-refs/cross-cli-contract.md +3 -3
  51. package/pipeline/multi-agent-refs/design-check/scope-and-ledger.md +1 -1
  52. package/pipeline/multi-agent-refs/features/code-graph.md +146 -11
  53. package/pipeline/multi-agent-refs/features/code-intelligence.md +16 -14
  54. package/pipeline/multi-agent-refs/features/dev-critic.md +7 -7
  55. package/pipeline/multi-agent-refs/features/model-fallback.md +6 -4
  56. package/pipeline/multi-agent-refs/features/remote-control.md +252 -0
  57. package/pipeline/multi-agent-refs/features/review-delta.md +1 -1
  58. package/pipeline/multi-agent-refs/features/review-file-set.md +3 -3
  59. package/pipeline/multi-agent-refs/features/review-multi-repo.md +1 -1
  60. package/pipeline/multi-agent-refs/features/session-brief.md +42 -0
  61. package/pipeline/multi-agent-refs/features/skill-conformance.md +3 -3
  62. package/pipeline/multi-agent-refs/features/usage-reporting.md +252 -24
  63. package/pipeline/multi-agent-refs/help/en.md +3 -2
  64. package/pipeline/multi-agent-refs/help/tr.md +3 -2
  65. package/pipeline/multi-agent-refs/knowledge.md +1 -1
  66. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +1 -1
  67. package/pipeline/multi-agent-refs/phases/operations.md +2 -2
  68. package/pipeline/multi-agent-refs/phases/phase-0-init.md +13 -12
  69. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +4 -4
  70. package/pipeline/multi-agent-refs/phases/phase-3-review.md +2 -0
  71. package/pipeline/multi-agent-refs/phases/phase-5-report.md +1 -1
  72. package/pipeline/multi-agent-refs/platform-parity.md +2 -2
  73. package/pipeline/multi-agent-refs/wiki-capture.md +3 -17
  74. package/pipeline/office/index.html +1207 -233
  75. package/pipeline/office/toolkit.json +1 -1
  76. package/pipeline/rules/outside-the-pipeline.md +1 -1
  77. package/pipeline/schemas/activity.schema.json +23 -0
  78. package/pipeline/schemas/agent-state.schema.json +6 -1
  79. package/pipeline/schemas/code-graph-calls.schema.json +254 -0
  80. package/pipeline/schemas/code-graph-docs.schema.json +223 -0
  81. package/pipeline/schemas/code-graph-infra.schema.json +227 -0
  82. package/pipeline/schemas/code-graph.schema.json +2 -2
  83. package/pipeline/schemas/examples/design-check-config.json +27 -0
  84. package/pipeline/schemas/learning-curve.schema.json +67 -0
  85. package/pipeline/schemas/office-jobs.json +69 -2
  86. package/pipeline/schemas/office-jobs.schema.json +8 -1
  87. package/pipeline/schemas/phases.json +5 -0
  88. package/pipeline/schemas/phases.schema.json +8 -0
  89. package/pipeline/schemas/prefs.schema.json +46 -12
  90. package/pipeline/schemas/runs-index.schema.json +17 -0
  91. package/pipeline/schemas/toolkit-path-params.json +84 -8
  92. package/pipeline/scripts/README.md +1 -0
  93. package/pipeline/scripts/_code-graph.mjs +184 -103
  94. package/pipeline/scripts/_contract-core.mjs +1 -1
  95. package/pipeline/scripts/_contract-routes-office.mjs +21 -0
  96. package/pipeline/scripts/_diff-impact.mjs +21 -2
  97. package/pipeline/scripts/_graph-sidecars.mjs +372 -0
  98. package/pipeline/scripts/_http-post.mjs +103 -115
  99. package/pipeline/scripts/_safe-read.mjs +57 -0
  100. package/pipeline/scripts/_skill-practices.mjs +26 -0
  101. package/pipeline/scripts/_strip-code.mjs +380 -0
  102. package/pipeline/scripts/activity-snapshot.mjs +13 -1
  103. package/pipeline/scripts/aggregate-metrics.mjs +3 -5
  104. package/pipeline/scripts/call-graph/index.mjs +78 -0
  105. package/pipeline/scripts/call-graph/lang/cpp.mjs +308 -0
  106. package/pipeline/scripts/call-graph/lang/csharp.mjs +130 -0
  107. package/pipeline/scripts/call-graph/lang/go.mjs +303 -0
  108. package/pipeline/scripts/call-graph/lang/java.mjs +370 -0
  109. package/pipeline/scripts/call-graph/lang/kotlin.mjs +397 -0
  110. package/pipeline/scripts/call-graph/lang/python.mjs +399 -0
  111. package/pipeline/scripts/call-graph/lang/rust.mjs +345 -0
  112. package/pipeline/scripts/call-graph/lang/shared.mjs +230 -0
  113. package/pipeline/scripts/call-graph/lang/swift.mjs +432 -0
  114. package/pipeline/scripts/call-graph/lang/typescript.mjs +692 -0
  115. package/pipeline/scripts/call-graph/lex.mjs +396 -0
  116. package/pipeline/scripts/call-graph/platform.mjs +86 -0
  117. package/pipeline/scripts/call-graph/profiles.mjs +89 -0
  118. package/pipeline/scripts/call-graph/resolve.mjs +1125 -0
  119. package/pipeline/scripts/call-graph/scan.mjs +267 -0
  120. package/pipeline/scripts/code-graph-rules/android.json +7 -2
  121. package/pipeline/scripts/code-graph-rules/cpp.json +99 -0
  122. package/pipeline/scripts/code-graph-rules/csharp.json +102 -0
  123. package/pipeline/scripts/code-graph-rules/go.json +2 -1
  124. package/pipeline/scripts/code-graph-rules/ios.json +3 -1
  125. package/pipeline/scripts/code-graph-rules/java.json +76 -0
  126. package/pipeline/scripts/code-graph-rules/node.json +7 -2
  127. package/pipeline/scripts/code-graph-rules/python.json +6 -2
  128. package/pipeline/scripts/code-graph-rules/rust.json +105 -0
  129. package/pipeline/scripts/contract-server.mjs +1 -0
  130. package/pipeline/scripts/feedback-send.mjs +26 -26
  131. package/pipeline/scripts/gate-ledger.mjs +2 -1
  132. package/pipeline/scripts/gen-usage-names.mjs +124 -0
  133. package/pipeline/scripts/graph-affected.mjs +109 -20
  134. package/pipeline/scripts/graph-build.mjs +95 -15
  135. package/pipeline/scripts/graph-export.mjs +272 -0
  136. package/pipeline/scripts/graph-hint.mjs +15 -2
  137. package/pipeline/scripts/graph-query.mjs +305 -26
  138. package/pipeline/scripts/graph-report.mjs +187 -1
  139. package/pipeline/scripts/health-report.mjs +3 -4
  140. package/pipeline/scripts/infra/docs.mjs +317 -0
  141. package/pipeline/scripts/infra/extract.mjs +998 -0
  142. package/pipeline/scripts/infra/graph.mjs +245 -0
  143. package/pipeline/scripts/infra/yaml-lite.mjs +311 -0
  144. package/pipeline/scripts/job-launch.mjs +67 -2
  145. package/pipeline/scripts/learning-curve.mjs +288 -178
  146. package/pipeline/scripts/log-metric.sh +10 -1
  147. package/pipeline/scripts/note-agent-event.mjs +3 -4
  148. package/pipeline/scripts/note-command-use.mjs +333 -0
  149. package/pipeline/scripts/note-command-use.sh +126 -0
  150. package/pipeline/scripts/note-mcp-call.sh +89 -0
  151. package/pipeline/scripts/note-mcp-failure.mjs +272 -1
  152. package/pipeline/scripts/note-session.sh +62 -3
  153. package/pipeline/scripts/note-skill-use.mjs +58 -2
  154. package/pipeline/scripts/office-build.mjs +115 -1
  155. package/pipeline/scripts/office-memory.mjs +14 -5
  156. package/pipeline/scripts/pair.mjs +333 -0
  157. package/pipeline/scripts/pre-push-check.sh +1 -1
  158. package/pipeline/scripts/remote/cbor.mjs +128 -0
  159. package/pipeline/scripts/remote/contract.mjs +98 -0
  160. package/pipeline/scripts/remote/handler.mjs +317 -0
  161. package/pipeline/scripts/remote/handles.mjs +57 -0
  162. package/pipeline/scripts/remote/lifecycle.mjs +186 -0
  163. package/pipeline/scripts/remote/listener.mjs +204 -0
  164. package/pipeline/scripts/remote/lockout.mjs +103 -0
  165. package/pipeline/scripts/remote/nonces.mjs +61 -0
  166. package/pipeline/scripts/remote/pairing.mjs +519 -0
  167. package/pipeline/scripts/remote/qr-encode.mjs +459 -0
  168. package/pipeline/scripts/remote/store.mjs +188 -0
  169. package/pipeline/scripts/remote/transport.mjs +211 -0
  170. package/pipeline/scripts/remote/verbs.json +70 -0
  171. package/pipeline/scripts/remote/verbs.mjs +217 -0
  172. package/pipeline/scripts/remote/webauthn.mjs +169 -0
  173. package/pipeline/scripts/remote/wire.mjs +364 -0
  174. package/pipeline/scripts/remote-listener.mjs +83 -0
  175. package/pipeline/scripts/route-learn.mjs +4 -4
  176. package/pipeline/scripts/run-kill.mjs +1 -1
  177. package/pipeline/scripts/run-write.mjs +13 -2
  178. package/pipeline/scripts/runs-index.mjs +30 -3
  179. package/pipeline/scripts/search-logs.sh +9 -0
  180. package/pipeline/scripts/session-brief.mjs +458 -0
  181. package/pipeline/scripts/session-brief.sh +130 -0
  182. package/pipeline/scripts/test-gap-rules/cpp.json +25 -0
  183. package/pipeline/scripts/test-gap-rules/csharp.json +20 -0
  184. package/pipeline/scripts/test-gap-rules/java.json +20 -0
  185. package/pipeline/scripts/test-gap-rules/rust.json +14 -0
  186. package/pipeline/scripts/token-budget-report.mjs +3 -2
  187. package/pipeline/scripts/uninstall.mjs +29 -0
  188. package/pipeline/scripts/usage-access.mjs +16 -31
  189. package/pipeline/scripts/usage-health.mjs +31 -62
  190. package/pipeline/scripts/usage-register-beacon.mjs +11 -22
  191. package/pipeline/scripts/usage-register.mjs +39 -29
  192. package/pipeline/scripts/usage-report.mjs +579 -178
  193. package/pipeline/scripts/validate-code-graph.mjs +361 -111
  194. package/pipeline/scripts/write-state.mjs +39 -0
  195. package/pipeline/skills/.skill-manifest.json +21 -17
  196. package/pipeline/skills/.skills-index.json +13 -2
  197. package/pipeline/skills/shared/README.md +5 -4
  198. package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +1 -1
  199. package/pipeline/skills/shared/core/multi-agent-diff-explain/SKILL.md +3 -3
  200. package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +55 -21
  201. package/pipeline/skills/shared/core/multi-agent-pair/SKILL.md +41 -0
  202. package/pipeline/skills/shared/core/multi-agent-prune-prompts/SKILL.md +1 -1
  203. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +3 -3
  204. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +2 -3
  205. package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +2 -2
  206. package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +2 -2
  207. package/pipeline/skills/shared/external/app-store-review/SKILL.md +11 -4
  208. package/pipeline/skills/shared/external/build-settings-audit/SKILL.md +1 -1
  209. package/pipeline/skills/shared/external/build-time-benchmark/SKILL.md +5 -5
  210. package/pipeline/skills/shared/external/build-time-fixes/SKILL.md +5 -5
  211. package/pipeline/skills/shared/external/build-time-optimizer/SKILL.md +6 -6
  212. package/pipeline/skills/shared/external/free-llm-apis/references/providers.md +1 -0
  213. package/pipeline/skills/shared/external/ios-coding-standard/references/STANDARD.md +2 -2
  214. package/pipeline/skills/shared/external/ios-haptics/references/core-haptics.md +1 -1
  215. package/pipeline/skills/shared/external/localization-reuse-map/references/publish-and-snapshot.md +1 -1
  216. package/pipeline/skills/shared/external/package-build-audit/SKILL.md +3 -3
  217. package/pipeline/skills/shared/external/reverse-engineer-own-app/SKILL.md +2 -3
  218. package/pipeline/skills/shared/external/swift-compile-hotspots/SKILL.md +2 -2
  219. package/pipeline/skills/shared/external/weatherkit/SKILL.md +5 -6
  220. package/pipeline/skills/skills-index.md +3 -2
  221. package/docs/FIGMA_PIPELINE.md +0 -137
  222. package/pipeline/lib/identifier-scan.mjs +0 -156
  223. package/pipeline/scripts/publish-staged.mjs +0 -324
  224. package/pipeline/skills/shared/external/ios-coding-standard/scripts/check_structure.py +0 -765
@@ -1,5 +1,5 @@
1
1
  {
2
- "contractVersion": "1.4.0",
2
+ "contractVersion": "1.5.0",
3
3
  "logsRoot": "/Users/example/.claude/logs/multi-agent",
4
4
  "count": 1,
5
5
  "runs": [
@@ -25,6 +25,9 @@
25
25
  "sessionId": "00000000-0000-4000-8000-000000000101",
26
26
  "waitingFor": null,
27
27
  "pendingQuestion": null,
28
+ "waitingSince": null,
29
+ "waitingSinceSource": null,
30
+ "finishedAt": null,
28
31
  "group": "stopped",
29
32
  "phases": [
30
33
  {
@@ -1,5 +1,5 @@
1
1
  {
2
- "contractVersion": "2.0.0",
2
+ "contractVersion": "2.2.0",
3
3
  "supportedMajors": [2, 1],
4
4
  "description": "The pipeline's client contract: every surface a client reads or writes, the CLI invocation and the HTTP route that carry it, and the schema its JSON follows. Schemas are not copied here; schemasDir points at the one tree the producers validate against. Paths in cli are relative to the pipeline directory (installed: ~/.claude).",
5
5
  "schemasDir": "../schemas",
@@ -60,6 +60,7 @@
60
60
  "steer-request.schema.json",
61
61
  "steer.schema.json",
62
62
  "ledger.schema.json",
63
+ "learning-curve.schema.json",
63
64
  "system-status.schema.json",
64
65
  "office-credentials.schema.json",
65
66
  "office-memory.schema.json",
@@ -93,7 +94,7 @@
93
94
  "query": ["group", "redact"],
94
95
  "cli": ["node", "scripts/runs-index.mjs", "--json", "[--group <group>]", "[--redact]"],
95
96
  "schema": "runs-index.schema.json",
96
- "version": "1.4.0",
97
+ "version": "1.5.0",
97
98
  "remote": "read",
98
99
  "risk": "read"
99
100
  },
@@ -104,7 +105,7 @@
104
105
  "query": ["redact"],
105
106
  "cli": ["node", "scripts/runs-index.mjs", "--json", "--task-id", "{id}", "[--redact]"],
106
107
  "schema": "runs-index.schema.json",
107
- "version": "1.4.0",
108
+ "version": "1.5.0",
108
109
  "remote": "read",
109
110
  "risk": "read"
110
111
  },
@@ -202,7 +203,7 @@
202
203
  "body": "repo-request.schema.json",
203
204
  "cli": ["node", "scripts/launch-request.mjs", "register-repo", "<path>"],
204
205
  "schema": "repo-change.schema.json",
205
- "version": "1.2.0",
206
+ "version": "1.4.0",
206
207
  "note": "Two steps: the preview names the repository, the confirmation stores it in launch-repos.json. Only a git checkout that is neither the home directory nor the root is accepted.",
207
208
  "remote": "local-only",
208
209
  "risk": "high"
@@ -213,7 +214,7 @@
213
214
  "path": "/v1/repos/{id}",
214
215
  "query": ["confirm"],
215
216
  "schema": "repo-change.schema.json",
216
- "version": "1.2.0",
217
+ "version": "1.4.0",
217
218
  "note": "Two steps: without confirm the preview and a token; with ?confirm=<token> the registered entry is removed. Configured autopilot repositories are not touched.",
218
219
  "remote": "local-only",
219
220
  "risk": "high"
@@ -395,7 +396,7 @@
395
396
  "query": [],
396
397
  "cli": ["node", "scripts/activity-snapshot.mjs", "--json"],
397
398
  "schema": "activity.schema.json",
398
- "version": "1.2.0",
399
+ "version": "1.4.0",
399
400
  "note": "Derived from disk on every call; no field is machine-local, so redact changes nothing.",
400
401
  "remote": "read",
401
402
  "risk": "read"
@@ -407,7 +408,7 @@
407
408
  "query": [],
408
409
  "cli": ["node", "scripts/activity-snapshot.mjs", "--json"],
409
410
  "schema": "activity.schema.json",
410
- "version": "1.2.0",
411
+ "version": "1.4.0",
411
412
  "note": "text/event-stream: an `activity` event carrying the document whenever it changes (checked every 2 seconds), a comment line as heartbeat. At most 4 streams at once (429 too-many-streams).",
412
413
  "remote": "read",
413
414
  "risk": "read"
@@ -427,7 +428,7 @@
427
428
  "[--limit <n>]"
428
429
  ],
429
430
  "schema": "activity-chat.schema.json",
430
- "version": "1.2.0",
431
+ "version": "1.4.0",
431
432
  "note": "agentId main is the session itself. Refused (403) to any Origin but the server's own page, even an allowed one. limit is 1 to 500, 200 by default; before is the offset the previous page returned.",
432
433
  "remote": "read",
433
434
  "risk": "read"
@@ -439,7 +440,7 @@
439
440
  "query": [],
440
441
  "cli": ["node", "scripts/routine-registry.mjs", "list", "--json"],
441
442
  "schema": "routines.schema.json",
442
- "version": "1.2.0",
443
+ "version": "1.4.0",
443
444
  "remote": "read",
444
445
  "risk": "read"
445
446
  },
@@ -450,7 +451,7 @@
450
451
  "query": ["confirm"],
451
452
  "cli": ["node", "scripts/routine-registry.mjs", "remove", "--name", "{name}"],
452
453
  "schema": "routine-delete.schema.json",
453
- "version": "1.2.0",
454
+ "version": "1.4.0",
454
455
  "note": "Two steps: without confirm the preview and a token; with ?confirm=<token> the removal. A shipped command is refused (409 not-removable). An unattended server refuses both steps with 409 unattended-refused.",
455
456
  "remote": "local-only",
456
457
  "risk": "high"
@@ -462,7 +463,7 @@
462
463
  "query": [],
463
464
  "cli": ["node", "scripts/routine-share.mjs", "browse"],
464
465
  "schema": "shared-routines.schema.json",
465
- "version": "1.2.0",
466
+ "version": "1.4.0",
466
467
  "note": "The routines other site members shared that this machine may see, without bodies, read with the machine's usage token by routine-share.mjs. When sharing cannot answer the body says why (available false, reason) instead of an error. Local only: it spends this machine's token.",
467
468
  "remote": "local-only",
468
469
  "risk": "read"
@@ -474,7 +475,7 @@
474
475
  "query": [],
475
476
  "cli": ["node", "scripts/routine-share.mjs", "fetch", "--id", "{id}"],
476
477
  "schema": "shared-routine.schema.json",
477
- "version": "1.2.0",
478
+ "version": "1.4.0",
478
479
  "note": "One shared routine with its body, version and payload digest, after the body was checked against its sha256; description and argumentHint are the values an import writes, unscrubbed. An unknown id is 404 not-found; a refusal from the sharing server is 502 upstream-failed.",
479
480
  "remote": "local-only",
480
481
  "risk": "read"
@@ -497,7 +498,7 @@
497
498
  "{name}"
498
499
  ],
499
500
  "schema": "shared-routine-import.schema.json",
500
- "version": "1.2.0",
501
+ "version": "1.4.0",
501
502
  "note": "Two steps. {} or {as} previews the full body, its sha256, the description, descriptionTr and argument hint as they become frontmatter, the payload digest over all of them and the local name, and returns a token bound to that routine, sha256, digest and name; a taken name is 409 name-taken, answered with another as; an as that is not a valid local name (the reserved shared included) is 400 invalid-body; a shared routine that would fail the import checks (name, description, descriptionTr, argumentHint, body, sha256) is 502 upstream-failed naming the field. {confirmToken, sha256, digest} installs the routine only when both are the previewed ones (else 409 confirm-mismatch) and the routine still matches them and still passes the import checks (else 409 state-moved). The frontmatter is rebuilt locally and the routine is never run. An unattended server refuses both steps with 409 unattended-refused.",
502
503
  "remote": "local-only",
503
504
  "risk": "high"
@@ -509,7 +510,7 @@
509
510
  "query": [],
510
511
  "cli": ["node", "scripts/job-launch.mjs", "list"],
511
512
  "schema": "office-jobs.schema.json",
512
- "version": "1.1.0",
513
+ "version": "1.2.0",
513
514
  "note": "The jobs the office can hand to someone: the command, the role that does it, team or solo, typed parameters and what it writes outside the machine; available is false when the command is not installed here. An enum with choices has its values read on this machine (review-priority: the teams whose rule file parses, and per team its presets in valuesFor).",
514
515
  "remote": "read",
515
516
  "risk": "read"
@@ -521,7 +522,7 @@
521
522
  "query": [],
522
523
  "body": "job-request.schema.json",
523
524
  "schema": "job-change.schema.json",
524
- "version": "1.1.0",
525
+ "version": "1.2.0",
525
526
  "note": "Two steps: the preview names the role, repository, exact prompt and what the job writes; the confirmation re-checks that the repository is allowed and starts it with claude --bg under the unattended profile after the workspace trust, agent-guard registration and sandbox checks; claude's own output stays in the server's log. A team job is refused while a run is live in that repository.",
526
527
  "remote": "local-only",
527
528
  "risk": "high"
@@ -643,6 +644,18 @@
643
644
  "risk": "high",
644
645
  "note": "Two steps: the preview names the change, the confirmation runs what /multi-agent:language, /multi-agent:fable-on|off or /multi-agent:route-on|off runs; one change at a time (429 busy). Route on passes the saved strategy back; widening it stays in the terminal."
645
646
  },
647
+ {
648
+ "id": "learning-curve",
649
+ "method": "GET",
650
+ "path": "/v1/learning-curve",
651
+ "query": [],
652
+ "cli": ["node", "scripts/learning-curve.mjs", "--json"],
653
+ "schema": "learning-curve.schema.json",
654
+ "version": "1.1.0",
655
+ "remote": "read",
656
+ "risk": "read",
657
+ "note": "How the pipeline's per-task quality and cost move over time, from the metrics log: one bucket per local calendar week, Monday first (first-pass-clean rate, review cycles, rework, tokens, cache reuse, memory precision) and the first-to-last trend. Numbers only; ok is false with a code when there is no log or no events."
658
+ },
646
659
  {
647
660
  "id": "credentials",
648
661
  "method": "GET",
@@ -1,8 +1,8 @@
1
1
  // Generated by pipeline/contract/build.mjs from pipeline/schemas/*.schema.json.
2
2
  // Do not edit: change the schema and run `node pipeline/contract/build.mjs --write`.
3
3
 
4
- export type ContractVersion = "2.0.0";
5
- export type SurfaceId = "runs" | "run" | "commands" | "skills" | "questions" | "issues" | "worktrees" | "launch-spec" | "repos" | "repo-add" | "repo-remove" | "launch" | "answer" | "run-log" | "resume" | "kill" | "gc" | "autopilot" | "autopilot-off" | "autopilot-on" | "steer" | "activity" | "activity-stream" | "agent-chat" | "routines" | "routine-delete" | "routines-shared" | "routine-shared" | "routine-shared-import" | "jobs" | "job-start" | "stack" | "stack-set" | "ledger" | "system" | "prune-logs" | "disk-clean" | "settings" | "settings-set" | "credentials" | "memory" | "server-room" | "archive" | "run-results" | "run-evidence" | "review-verdict" | "issue-maturity" | "prs" | "prs-reach" | "tools" | "tool-call" | "service-confluence" | "service-crashlytics" | "service-figma" | "permissions";
4
+ export type ContractVersion = "2.2.0";
5
+ export type SurfaceId = "runs" | "run" | "commands" | "skills" | "questions" | "issues" | "worktrees" | "launch-spec" | "repos" | "repo-add" | "repo-remove" | "launch" | "answer" | "run-log" | "resume" | "kill" | "gc" | "autopilot" | "autopilot-off" | "autopilot-on" | "steer" | "activity" | "activity-stream" | "agent-chat" | "routines" | "routine-delete" | "routines-shared" | "routine-shared" | "routine-shared-import" | "jobs" | "job-start" | "stack" | "stack-set" | "ledger" | "system" | "prune-logs" | "disk-clean" | "settings" | "settings-set" | "learning-curve" | "credentials" | "memory" | "server-room" | "archive" | "run-results" | "run-evidence" | "review-verdict" | "issue-maturity" | "prs" | "prs-reach" | "tools" | "tool-call" | "service-confluence" | "service-crashlytics" | "service-figma" | "permissions";
6
6
 
7
7
  /** What `runs-index.mjs --json` prints: every run under the log root and the unattended log root (one record per task id), grouped per status/SKILL.md 3b. Fields are only ever added - a decoder ignores keys it does not know. `--redact` drops every x-sensitivity local field (and `logsRoot`) and scrubs the free text in the title, `now`, sub-step names, task subjects and the pending question. */
8
8
  export interface RunsIndex {
@@ -40,6 +40,12 @@ export interface RunsIndexRun {
40
40
  sessionId?: string | null;
41
41
  /** The step a paused run re-enters (agent-state waitingFor): maturity, user-channels-choice, local-test, attended-reply or question; null or absent when the run is not waiting. Added in 1.1.0. */
42
42
  waitingFor?: string | null;
43
+ /** When a run in the waiting group began to wait: the state's own waitingSince when it has one, else the state file's modification time. Null outside the waiting group. Added in 1.5.0. */
44
+ waitingSince?: string | null;
45
+ /** Where waitingSince came from: state is the run's own record of when it parked, file-time is the state file's modification time, which a rewrite moves, so a client shows it as approximate. Null when waitingSince is null. Added in 1.5.0. */
46
+ waitingSinceSource?: "state" | "file-time" | null;
47
+ /** When the run finished or was stopped (agent-state finishedAt); null while it is going and when its state records no end. Added in 1.5.0. */
48
+ finishedAt?: string | null;
43
49
  /** The question the run stopped on, present only with waitingFor question. Answer it with one of options[].id through `answer-question.mjs` or POST /v1/runs/{id}/answer. text and labels are scrubbed under --redact. Added in 1.1.0. */
44
50
  pendingQuestion?: null | RunsIndexQuestion;
45
51
  /** done (added in 1.4.0): the run's status is complete, completed, done, abandoned or cancelled; it is placed before every other test, so a finished run is never offered resume. */
@@ -557,11 +563,13 @@ export interface OfficeJobs {
557
563
  role: string;
558
564
  team: boolean;
559
565
  launch?: "development" | "analysis" | "autopilot";
566
+ /** Flags the job always passes after its parameters, fixed in the catalog. */
567
+ fixedArgs?: Array<string>;
560
568
  available?: boolean;
561
569
  reason?: string | null;
562
570
  params: Array<{
563
571
  name: string;
564
- kind: "work-item" | "pull-request" | "branch" | "run-id" | "jira-key" | "github-issue" | "enum" | "repo-path";
572
+ kind: "work-item" | "pull-request" | "branch" | "run-id" | "jira-key" | "github-issue" | "enum" | "repo-path" | "search-text" | "analysis-doc";
565
573
  values?: Array<string>;
566
574
  /** Where GET /v1/jobs reads an enum's values from on this machine; the catalog itself lists none. */
567
575
  choices?: "review-priority-teams" | "review-priority-presets";
@@ -619,6 +627,12 @@ export interface Activity {
619
627
  generatedAt: string;
620
628
  /** A session or subagent whose transcript changed within this window has a desk. */
621
629
  recentMinutes: number;
630
+ /** The cost budget from prefs.global.costBudget, present only while it is enabled and valid. A run's spend (a table's estUsd) is judged against it: ok under warnPct of maxUsd, warn from there to maxUsd, exceeded above. */
631
+ costBudget?: {
632
+ maxUsd: number;
633
+ warnPct: number;
634
+ onExceed: "warn" | "halt";
635
+ };
622
636
  counts: {
623
637
  rooms: number;
624
638
  tables: number;
@@ -725,6 +739,10 @@ export interface ActivityTable {
725
739
  pr: {
726
740
  number: number;
727
741
  } | null;
742
+ /** When the run began waiting for a person: its own record of when it parked, else its state file's modification time. Null when the run is not waiting, and for a session no run tracks. */
743
+ waitingSince: string | null;
744
+ /** Where waitingSince came from: state is exact, file-time is approximate because a rewrite of the file moves it. Null when waitingSince is null. */
745
+ waitingSinceSource: "state" | "file-time" | null;
728
746
  /** What a waiting run waits for: a step it paused at (the run's waitingFor), or terminal when its session holds a question open in its own window. */
729
747
  waitingFor: "maturity" | "user-channels-choice" | "local-test" | "attended-reply" | "question" | "terminal" | null;
730
748
  /** Where the run's report went, per adapter, for the run window; empty for a session or before Phase 5. */
@@ -1089,6 +1107,40 @@ export interface LedgerWindow {
1089
1107
  byPhase: Array<LedgerRow>;
1090
1108
  }
1091
1109
 
1110
+ /** What GET /v1/learning-curve returns and `learning-curve.mjs --json` prints: the metrics log folded per task and bucketed by the day each task first appeared, with the first-to-last trend of the headline numbers. A rate or ratio is null when nothing was recorded, never 0. ok is false, with a code, when there is no metrics log or no events in it; the CLI adds a reason, the server does not. */
1111
+ export interface LearningCurve {
1112
+ contractVersion: string;
1113
+ ok: boolean;
1114
+ code?: "no-metrics" | "no-events" | "too-large";
1115
+ reason?: string;
1116
+ /** The log generations left out because they were over the size cap. Absent when every generation was read. */
1117
+ skipped?: (Array<"previous" | "current">);
1118
+ bucketDays?: number;
1119
+ buckets: Array<{
1120
+ bucketStart: string;
1121
+ tasks: number;
1122
+ firstPassCleanRate?: LearningCurveRate;
1123
+ avgReviewCycles?: LearningCurveRate;
1124
+ reworkPerTask: number;
1125
+ tokensPerTask: number;
1126
+ cacheRatio?: LearningCurveRate;
1127
+ memoryPrecision?: LearningCurveRate;
1128
+ minedLessonsPerTask?: LearningCurveRate;
1129
+ offloadBytesSavedPerTask?: LearningCurveRate;
1130
+ }>;
1131
+ trend?: {
1132
+ from: string;
1133
+ to: string;
1134
+ firstPassCleanRate?: LearningCurveRate;
1135
+ avgReviewCycles?: LearningCurveRate;
1136
+ tokensPerTask?: LearningCurveRate;
1137
+ cacheRatio?: LearningCurveRate;
1138
+ memoryPrecision?: LearningCurveRate;
1139
+ } | null;
1140
+ }
1141
+
1142
+ export type LearningCurveRate = number | null;
1143
+
1092
1144
  /** What GET /v1/system returns and `system-status.mjs --json` prints: CPU load, memory, free disk and what the pipeline itself uses. Numbers only: no path, process argument, user name or host name. A value that could not be measured is null, never 0. */
1093
1145
  export interface SystemStatus {
1094
1146
  contractVersion: string;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * detach-self.mjs - hand a script's own run to a detached process.
3
+ *
4
+ * The usage scripts are called from phase documents as plain shell lines, and
5
+ * those documents may not use `&` or a subshell (the unattended guard cannot
6
+ * follow a command it does not wait on). `--detach` gives the same result from
7
+ * inside the script: the caller starts a second copy of the script with the
8
+ * same arguments, in its own session with no stdio, and returns at once. The
9
+ * copy knows it is the detached one through DETACHED_ENV, so it never detaches
10
+ * again.
11
+ *
12
+ * The copy has a hard overall limit. Every read it makes has its own timeout,
13
+ * but their sum is not bounded and a blocked synchronous call cannot fire a
14
+ * timer of its own, so a small watchdog process outside the copy kills the
15
+ * copy's whole process group once HARD_LIMIT_MS has passed, then exits. The
16
+ * watchdog polls for the copy and leaves as soon as it is gone.
17
+ *
18
+ * @module pipeline/lib/detach-self
19
+ */
20
+
21
+ import { spawn } from "node:child_process";
22
+
23
+ export const DETACHED_ENV = "MULTI_AGENT_USAGE_DETACHED";
24
+ export const HARD_LIMIT_MS = 120_000;
25
+
26
+ const WATCHDOG = `
27
+ const pid = Number(process.argv[1]);
28
+ const limit = Number(process.argv[2]);
29
+ const started = Date.now();
30
+ const timer = setInterval(() => {
31
+ try {
32
+ process.kill(pid, 0);
33
+ } catch {
34
+ process.exit(0);
35
+ }
36
+ if (Date.now() - started >= limit) {
37
+ try {
38
+ process.kill(-pid, "SIGKILL");
39
+ } catch {
40
+ try {
41
+ process.kill(pid, "SIGKILL");
42
+ } catch {
43
+ /* gone */
44
+ }
45
+ }
46
+ process.exit(0);
47
+ }
48
+ }, 500);
49
+ void timer;
50
+ `;
51
+
52
+ /**
53
+ * Whether this run should hand itself off: `--detach` was given and this is
54
+ * not already the detached copy.
55
+ *
56
+ * @param {string[]} argv
57
+ * @param {NodeJS.ProcessEnv} [env]
58
+ */
59
+ export function shouldDetach(argv, env = process.env) {
60
+ return argv.includes("--detach") && !env[DETACHED_ENV];
61
+ }
62
+
63
+ /**
64
+ * Start `script` again with `argv` minus `--detach`, detached, with a watchdog.
65
+ * Never throws; a copy that cannot start is a report that is not sent.
66
+ *
67
+ * @param {string} script absolute path of the script to run
68
+ * @param {string[]} argv the arguments this run was given
69
+ * @param {NodeJS.ProcessEnv} [env]
70
+ * @param {{hardLimitMs?: number}} [opts]
71
+ * @returns {number | null} the copy's pid
72
+ */
73
+ export function detachSelf(script, argv, env = process.env, { hardLimitMs = HARD_LIMIT_MS } = {}) {
74
+ try {
75
+ const child = spawn(process.execPath, [script, ...argv.filter((a) => a !== "--detach")], {
76
+ detached: true,
77
+ stdio: "ignore",
78
+ env: { ...env, [DETACHED_ENV]: "1" },
79
+ });
80
+ child.on("error", () => {});
81
+ child.unref();
82
+ if (child.pid) {
83
+ const dog = spawn(
84
+ process.execPath,
85
+ ["-e", WATCHDOG, String(child.pid), String(hardLimitMs)],
86
+ { detached: true, stdio: "ignore", env: {} },
87
+ );
88
+ dog.on("error", () => {});
89
+ dog.unref();
90
+ }
91
+ return child.pid ?? null;
92
+ } catch {
93
+ return null;
94
+ }
95
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * public-mcp-servers.mjs - the MCP servers a usage record may name.
3
+ *
4
+ * The same rule the record applies to plugins: a name the product ships or
5
+ * knows as a public server is sent exactly as the list spells it; any other server is somebody's
6
+ * own (an internal service, a customer tool, a ticket-named helper), so it is
7
+ * sent as the constant `private` and its tools are folded into one row. The
8
+ * list is shipped with the pipeline; a machine cannot add to it.
9
+ *
10
+ * @module pipeline/lib/public-mcp-servers
11
+ */
12
+
13
+ import { MCP_SERVER_ID } from "./mcp-rename.mjs";
14
+
15
+ /** Registered server names, as they appear in `mcp__<server>__<tool>`. */
16
+ export const PUBLIC_MCP_SERVERS = [MCP_SERVER_ID, "claude_ai_Figma", "figma", "XcodeBuildMCP"];
17
+
18
+ const PUBLIC = new Set(PUBLIC_MCP_SERVERS);
19
+
20
+ /**
21
+ * True for a server the record may name. The comparison is exact: the name the
22
+ * host registers (`mcp__<server>__<tool>`), as the list spells it. A private
23
+ * server registered under a public name is counted as that public server, with
24
+ * its tool folded into `other`, which reveals nothing.
25
+ */
26
+ export function isPublicMcpServer(name) {
27
+ return PUBLIC.has(String(name ?? ""));
28
+ }
29
+
30
+ /** The server name as the record sends it: itself when public, else `private`. */
31
+ export function publicServerName(name) {
32
+ return isPublicMcpServer(name) ? String(name) : "private";
33
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * rotated-log.mjs - read a local log together with its previous generation.
3
+ *
4
+ * The local logs (metrics.jsonl, errors-ledger.jsonl, session-notes.jsonl) move
5
+ * to `<name>.1` once they pass their size cap. A reader that opened only the
6
+ * current file would lose everything before the move, so every reader goes
7
+ * through this one helper: the previous generation first, then the current
8
+ * file, which keeps rows in the order they were written.
9
+ *
10
+ * @module pipeline/lib/rotated-log
11
+ */
12
+
13
+ import { lstatSync, readFileSync } from "node:fs";
14
+
15
+ function regularFile(path) {
16
+ try {
17
+ return lstatSync(path).isFile();
18
+ } catch {
19
+ return false;
20
+ }
21
+ }
22
+
23
+ /** The generations of `path` that exist as regular files, oldest first. */
24
+ export function rotatedPaths(path) {
25
+ return [`${path}.1`, path].filter(regularFile);
26
+ }
27
+
28
+ /** True when the log or its previous generation exists. */
29
+ export function rotatedExists(path) {
30
+ return rotatedPaths(path).length > 0;
31
+ }
32
+
33
+ /** What identifies a generation: its inode, size and time; "" when it is not a regular file. */
34
+ export function signature(path) {
35
+ try {
36
+ const st = lstatSync(path);
37
+ return st.isFile() ? `${st.ino}:${st.size}:${st.mtimeMs}` : "";
38
+ } catch {
39
+ return "";
40
+ }
41
+ }
42
+
43
+ const inodeOf = (sig) => sig.split(":")[0];
44
+
45
+ function readBoth(path, between) {
46
+ let out = "";
47
+ const take = (p) => {
48
+ let text;
49
+ try {
50
+ text = readFileSync(p, "utf8");
51
+ } catch {
52
+ return;
53
+ }
54
+ if (out && !out.endsWith("\n")) out += "\n";
55
+ out += text;
56
+ };
57
+ const previous = `${path}.1`;
58
+ if (regularFile(previous)) take(previous);
59
+ between?.();
60
+ if (regularFile(path)) take(path);
61
+ return out;
62
+ }
63
+
64
+ /**
65
+ * Both generations as one text, oldest first; "" when neither exists.
66
+ *
67
+ * A rotation between the two reads would give the old `.1` and the new, nearly
68
+ * empty current file, and the rows that moved from current to `.1` would be in
69
+ * neither. So the read is checked: when `.1` changed (a different file, size or
70
+ * time) or the current file was replaced while it was read, everything is read
71
+ * once more.
72
+ *
73
+ * @param {string} path
74
+ * @param {{between?: () => void}} [opts] runs between the two reads (tests)
75
+ */
76
+ export function readRotatedText(path, { between } = {}) {
77
+ const previous = `${path}.1`;
78
+ let text = "";
79
+ for (let attempt = 0; attempt < 2; attempt++) {
80
+ const before = [signature(previous), signature(path)];
81
+ text = readBoth(path, attempt === 0 ? between : undefined);
82
+ const after = [signature(previous), signature(path)];
83
+ if (before[0] === after[0] && inodeOf(before[1]) === inodeOf(after[1])) return text;
84
+ }
85
+ return text;
86
+ }
87
+
88
+ /** The non-blank lines of both generations, oldest first. */
89
+ export function readRotatedLines(path, opts) {
90
+ return readRotatedText(path, opts)
91
+ .split("\n")
92
+ .filter((l) => l.trim());
93
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * tls-trust.mjs - the one trust store every token-carrying transport uses.
3
+ *
4
+ * It is Node's bundled root certificates plus the file NODE_EXTRA_CA_CERTS
5
+ * names (the documented way to trust a corporate TLS-inspecting CA), handed to
6
+ * the request agent as `ca`. An explicit `ca` replaces whatever the process
7
+ * would otherwise load, so SSL_CERT_FILE, SSL_CERT_DIR, `--use-openssl-ca`,
8
+ * NODE_USE_SYSTEM_CA and every other way the environment can add trust stay
9
+ * out of a request that carries a credential.
10
+ *
11
+ * @module pipeline/lib/tls-trust
12
+ */
13
+
14
+ import { readFileSync } from "node:fs";
15
+ import { rootCertificates } from "node:tls";
16
+
17
+ /** @returns {string[]} PEM certificates: bundled roots plus the NODE_EXTRA_CA_CERTS file. */
18
+ export function trustedRoots() {
19
+ const roots = [...rootCertificates];
20
+ const extra = process.env.NODE_EXTRA_CA_CERTS;
21
+ if (extra) {
22
+ try {
23
+ roots.push(readFileSync(extra, "utf8"));
24
+ } catch {
25
+ /* an unreadable file adds nothing */
26
+ }
27
+ }
28
+ return roots;
29
+ }
@@ -18,14 +18,11 @@
18
18
 
19
19
  import { readFileSync, statSync } from "node:fs";
20
20
  import { join } from "node:path";
21
+ import { floorMinute, releaseVersion } from "./usage-vocab.mjs";
21
22
 
22
- const VERSION_RE = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/;
23
23
  const HOSTS = ["claude", "copilot", "codex"];
24
24
 
25
- function version(v) {
26
- const s = typeof v === "string" ? v.trim() : "";
27
- return VERSION_RE.test(s) ? s : null;
28
- }
25
+ const version = releaseVersion;
29
26
 
30
27
  function readStamp(home, host) {
31
28
  const path = join(home, `.${host}`, ".pipeline-version");
@@ -47,7 +44,7 @@ export function installedVersion(home) {
47
44
  const first = stamps[0];
48
45
  return {
49
46
  v: first.v,
50
- at: new Date(Math.floor(first.mtimeMs)).toISOString(),
47
+ at: floorMinute(first.mtimeMs),
51
48
  hosts: stamps.filter((s) => s.v === first.v).map((s) => s.host),
52
49
  };
53
50
  }
@@ -61,9 +58,10 @@ export function installedVersion(home) {
61
58
  * nobody reported.
62
59
  */
63
60
  export function lifecycleEvent({ installed, usageLog = {} }) {
64
- if (!installed?.v) return null;
61
+ const current = version(installed?.v);
62
+ if (!current) return null;
65
63
  const reported = version(usageLog.reportedVersion);
66
- if (reported === installed.v) return null;
64
+ if (reported === current) return null;
67
65
  let ev = "update";
68
66
  if (!reported) {
69
67
  const registeredAt = Date.parse(usageLog.registeredAt || "");
@@ -73,11 +71,11 @@ export function lifecycleEvent({ installed, usageLog = {} }) {
73
71
  if (!registeredEarlier) ev = "install";
74
72
  }
75
73
  return {
76
- id: `lc-${installed.v}-${Date.parse(installed.at)}`,
74
+ id: `lc-${current}-${Date.parse(installed.at)}`,
77
75
  ev,
78
- v: installed.v,
76
+ v: current,
79
77
  vf: reported,
80
- hs: installed.hosts,
78
+ hs: installed.hosts.filter((h) => HOSTS.includes(h)),
81
79
  t: installed.at,
82
80
  };
83
81
  }