@mmerterden/multi-agent-pipeline 23.7.0 → 24.1.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 (162) hide show
  1. package/CHANGELOG.md +60 -1
  2. package/README.md +59 -24
  3. package/README.tr.md +43 -8
  4. package/SECURITY.md +3 -3
  5. package/docs/architecture.md +41 -4
  6. package/docs/ecosystem.md +15 -13
  7. package/docs/facts.json +5 -4
  8. package/docs/features.md +67 -15
  9. package/install/_codex-agents.mjs +13 -8
  10. package/install/_common.mjs +24 -0
  11. package/install/_dev-only-files.mjs +5 -0
  12. package/install/_mcp-register.mjs +6 -2
  13. package/install/_rewrite-tree.mjs +197 -0
  14. package/install/codex.mjs +96 -180
  15. package/install/copilot.mjs +24 -54
  16. package/install/index.mjs +29 -11
  17. package/install/templates/codex-instructions.md +21 -5
  18. package/install/templates/copilot-instructions.md +21 -14
  19. package/manifest.json +2083 -0
  20. package/package.json +8 -2
  21. package/pipeline/commands/multi-agent/SKILL.md +5 -4
  22. package/pipeline/commands/multi-agent/analysis/SKILL.md +5 -1
  23. package/pipeline/commands/multi-agent/autopilot-on/SKILL.md +31 -3
  24. package/pipeline/commands/multi-agent/autopilot-status/SKILL.md +5 -1
  25. package/pipeline/commands/multi-agent/channels/SKILL.md +16 -8
  26. package/pipeline/commands/multi-agent/log/SKILL.md +2 -0
  27. package/pipeline/commands/multi-agent/stack/SKILL.md +1 -1
  28. package/pipeline/contract/CHANGELOG.md +15 -0
  29. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  30. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  31. package/pipeline/contract/fixtures/runs-awaiting-question.json +6 -1
  32. package/pipeline/contract/fixtures/runs-empty.json +1 -1
  33. package/pipeline/contract/fixtures/runs-failed.json +21 -1
  34. package/pipeline/contract/fixtures/runs-old-schema.json +18 -3
  35. package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +31 -1
  36. package/pipeline/contract/fixtures/runs-pr-opened.json +31 -1
  37. package/pipeline/contract/fixtures/runs-running.json +16 -1
  38. package/pipeline/contract/manifest.json +14 -14
  39. package/pipeline/contract/types/index.d.ts +20 -1
  40. package/pipeline/lib/_jira-auth.sh +50 -78
  41. package/pipeline/lib/_service-account.sh +191 -0
  42. package/pipeline/lib/credential-inventory.sh +49 -37
  43. package/pipeline/lib/credential-store.sh +48 -3
  44. package/pipeline/lib/fetch-confluence.sh +76 -92
  45. package/pipeline/lib/fetch-crashlytics.sh +30 -59
  46. package/pipeline/lib/fetch-figma-annotations.sh +9 -9
  47. package/pipeline/lib/fetch-fortify.sh +77 -81
  48. package/pipeline/lib/fetch-graylog.sh +38 -77
  49. package/pipeline/lib/figma-mcp-refresh.sh +23 -4
  50. package/pipeline/lib/figma-screenshot.sh +7 -8
  51. package/pipeline/lib/figma-token.sh +39 -46
  52. package/pipeline/lib/host.mjs +138 -0
  53. package/pipeline/lib/host.sh +48 -0
  54. package/pipeline/lib/issue-fetcher.sh +25 -41
  55. package/pipeline/lib/jira-publish.sh +23 -21
  56. package/pipeline/lib/local-model.mjs +93 -0
  57. package/pipeline/lib/md2confluence-v3.py +37 -30
  58. package/pipeline/lib/model-dispatch.sh +41 -4
  59. package/pipeline/lib/model-resolve.mjs +58 -0
  60. package/pipeline/lib/post-pr-review.sh +38 -53
  61. package/pipeline/lib/reviewer-families.mjs +70 -0
  62. package/pipeline/lib/service-account.mjs +2131 -0
  63. package/pipeline/lib/service-account.sh +35 -0
  64. package/pipeline/lib/usage-token.mjs +64 -24
  65. package/pipeline/lib/usage-vocab.mjs +1 -1
  66. package/pipeline/lib/user-facing.mjs +11 -3
  67. package/pipeline/lib/vercel-deploy.sh +17 -26
  68. package/pipeline/multi-agent-refs/_entry-picker.md +62 -0
  69. package/pipeline/multi-agent-refs/analysis/intake.md +2 -0
  70. package/pipeline/multi-agent-refs/analysis/render.md +12 -1
  71. package/pipeline/multi-agent-refs/analysis/reusable-refs.md +1 -0
  72. package/pipeline/multi-agent-refs/analysis/unattended.md +135 -0
  73. package/pipeline/multi-agent-refs/autopilot-on/details.md +16 -0
  74. package/pipeline/multi-agent-refs/channels/generator.md +10 -2
  75. package/pipeline/multi-agent-refs/channels/menu.md +3 -1
  76. package/pipeline/multi-agent-refs/channels/preview.md +3 -1
  77. package/pipeline/multi-agent-refs/channels/reference.md +16 -2
  78. package/pipeline/multi-agent-refs/channels/report-file.md +188 -0
  79. package/pipeline/multi-agent-refs/cross-cli-contract.md +35 -27
  80. package/pipeline/multi-agent-refs/features/doctor.md +37 -11
  81. package/pipeline/multi-agent-refs/features/free-models.md +3 -3
  82. package/pipeline/multi-agent-refs/features/local-model.md +87 -0
  83. package/pipeline/multi-agent-refs/features/model-fallback.md +25 -10
  84. package/pipeline/multi-agent-refs/features/product-context.md +6 -5
  85. package/pipeline/multi-agent-refs/features/service-accounts.md +233 -0
  86. package/pipeline/multi-agent-refs/features/unattended-security.md +10 -1
  87. package/pipeline/multi-agent-refs/help/en.md +36 -1
  88. package/pipeline/multi-agent-refs/help/tr.md +34 -1
  89. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +2 -1
  90. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +2 -1
  91. package/pipeline/multi-agent-refs/phases/modes.md +20 -1
  92. package/pipeline/multi-agent-refs/phases/phase-0-init.md +1 -0
  93. package/pipeline/multi-agent-refs/phases/phase-4-commit.md +1 -0
  94. package/pipeline/multi-agent-refs/phases/phase-5-report.md +13 -11
  95. package/pipeline/multi-agent-refs/phases.md +4 -3
  96. package/pipeline/multi-agent-refs/review/panel.md +30 -18
  97. package/pipeline/multi-agent-refs/setup/discovery.md +17 -5
  98. package/pipeline/multi-agent-refs/setup/token-save-flow.md +21 -2
  99. package/pipeline/multi-agent-refs/sync/overview.md +11 -5
  100. package/pipeline/multi-agent-refs/tracker-contract.md +64 -20
  101. package/pipeline/office/index.html +77 -4
  102. package/pipeline/schemas/activity.schema.json +63 -4
  103. package/pipeline/schemas/autopilot-config.schema.json +29 -4
  104. package/pipeline/schemas/hosts.json +512 -0
  105. package/pipeline/schemas/hosts.schema.json +310 -0
  106. package/pipeline/schemas/launch.json +22 -2
  107. package/pipeline/schemas/launch.schema.json +2 -1
  108. package/pipeline/schemas/now-lines.json +103 -0
  109. package/pipeline/schemas/now-lines.schema.json +42 -0
  110. package/pipeline/schemas/phases.json +19 -1
  111. package/pipeline/schemas/phases.schema.json +8 -0
  112. package/pipeline/schemas/prefs.schema.json +331 -4
  113. package/pipeline/schemas/runs-index.schema.json +22 -1
  114. package/pipeline/scripts/_autopilot-config.mjs +67 -4
  115. package/pipeline/scripts/_autopilot-item.mjs +67 -0
  116. package/pipeline/scripts/_autopilot-outcomes.mjs +6 -0
  117. package/pipeline/scripts/_contract-core.mjs +1 -1
  118. package/pipeline/scripts/_cost.mjs +75 -3
  119. package/pipeline/scripts/activity-snapshot.mjs +27 -1
  120. package/pipeline/scripts/analysis-sources.mjs +22 -5
  121. package/pipeline/scripts/analysis-unattended.mjs +360 -0
  122. package/pipeline/scripts/anonymize-findings.mjs +3 -7
  123. package/pipeline/scripts/autopilot-arming.mjs +19 -10
  124. package/pipeline/scripts/autopilot-intake.mjs +124 -27
  125. package/pipeline/scripts/autopilot-menubar.swift +7 -0
  126. package/pipeline/scripts/autopilot-runner.mjs +77 -48
  127. package/pipeline/scripts/autopilot-status.sh +32 -9
  128. package/pipeline/scripts/bulk-read.sh +37 -5
  129. package/pipeline/scripts/confluence-readback.mjs +15 -7
  130. package/pipeline/scripts/cost-table.json +65 -25
  131. package/pipeline/scripts/doctor.mjs +119 -32
  132. package/pipeline/scripts/entry-mode.mjs +101 -0
  133. package/pipeline/scripts/estimate.mjs +30 -16
  134. package/pipeline/scripts/feedback-send.mjs +11 -8
  135. package/pipeline/scripts/gen-facts.mjs +7 -9
  136. package/pipeline/scripts/jira-attach.sh +23 -28
  137. package/pipeline/scripts/jira-search.sh +5 -21
  138. package/pipeline/scripts/launch-request.mjs +15 -9
  139. package/pipeline/scripts/migrate-prefs.mjs +56 -0
  140. package/pipeline/scripts/phase-tracker.sh +226 -50
  141. package/pipeline/scripts/priority-review.mjs +14 -7
  142. package/pipeline/scripts/product-context.mjs +26 -7
  143. package/pipeline/scripts/prune-logs.sh +4 -2
  144. package/pipeline/scripts/render-work-summary.sh +51 -1
  145. package/pipeline/scripts/report-file.mjs +285 -0
  146. package/pipeline/scripts/rework-escalation.mjs +19 -4
  147. package/pipeline/scripts/runs-index.mjs +2 -1
  148. package/pipeline/scripts/service-read.mjs +19 -17
  149. package/pipeline/scripts/skill-siblings.mjs +17 -1
  150. package/pipeline/scripts/status-overview.mjs +20 -10
  151. package/pipeline/scripts/uninstall.mjs +145 -57
  152. package/pipeline/scripts/usage-register.mjs +34 -11
  153. package/pipeline/scripts/usage-report.mjs +31 -26
  154. package/pipeline/scripts/validate-triage.mjs +11 -1
  155. package/pipeline/scripts/work-items.mjs +25 -28
  156. package/pipeline/scripts/write-store-config.mjs +37 -11
  157. package/pipeline/skills/.skill-manifest.json +4 -4
  158. package/pipeline/skills/.skills-index.json +1 -1
  159. package/pipeline/skills/shared/core/multi-agent/SKILL.md +11 -3
  160. package/pipeline/skills/shared/core/multi-agent-analysis/SKILL.md +2 -0
  161. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +11 -8
  162. package/pipeline/lib/credential-resolve.mjs +0 -75
@@ -122,8 +122,14 @@ msg() { # $1 = key, $2.. = printf arguments
122
122
  en='Running (%s):'
123
123
  tr='Koşuyor (%s):' ;;
124
124
  heading-queued)
125
- en='Queued (%s):'
126
- tr='Sırada (%s):' ;;
125
+ en='Queued for development (%s) - each ends at a pull request:'
126
+ tr='Geliştirme sırasında (%s) - her biri bir PR ile biter:' ;;
127
+ heading-queued-analysis)
128
+ en='Queued for analysis (%s) - each ends at a written document, no branch and no PR:'
129
+ tr='Analiz sırasında (%s) - her biri yazılı bir dokümanla biter, branch ve PR yok:' ;;
130
+ analysis-subject)
131
+ en='analysis'
132
+ tr='analiz' ;;
127
133
  heading-awaiting)
128
134
  en='Waiting for an answer (%s) - the open questions are posted, and it continues once they are answered:'
129
135
  tr='Cevap bekliyor (%s) - açık soruları yorumladık, cevap gelince devam edecek:' ;;
@@ -164,6 +170,11 @@ QUEUE=$(ma_ap_read queue.json 2>/dev/null || echo '{}')
164
170
  RUNNING=$(printf '%s' "$QUEUE" | jq -c '[.running[]? | select((.state // "running") == "running")]' 2>/dev/null || echo '[]')
165
171
  QUEUED=$(printf '%s' "$QUEUE" | jq -c '[.queued[]?]' 2>/dev/null || echo '[]')
166
172
  AWAITING=$(printf '%s' "$QUEUE" | jq -c '[.awaiting[]?]' 2>/dev/null || echo '[]')
173
+ # The two queues, shown apart because they deliver different things. A row
174
+ # written before the analysis kind existed carries no `kind` and is development,
175
+ # which is what it was.
176
+ QUEUED_DEV=$(printf '%s' "$QUEUED" | jq -c '[.[] | select((.kind // "development") != "analysis")]' 2>/dev/null || echo '[]')
177
+ QUEUED_ANALYSIS=$(printf '%s' "$QUEUED" | jq -c '[.[] | select(.kind == "analysis")]' 2>/dev/null || echo '[]')
167
178
  LAST_TICK=$(printf '%s' "$QUEUE" | jq -r '.lastTickAt // empty' 2>/dev/null)
168
179
  EMPTY_REASON=$(printf '%s' "$QUEUE" | jq -r '.emptyReason // empty' 2>/dev/null)
169
180
  BLOCKED=$(printf '%s' "$QUEUE" | jq -r '.blockedReason // empty' 2>/dev/null)
@@ -241,6 +252,7 @@ build_json() {
241
252
  jq -nc \
242
253
  --argjson on "$ON" --argjson slots "$SLOTS" \
243
254
  --argjson running "$RUNNING" --argjson queued "$QUEUED" --argjson awaiting "$AWAITING" \
255
+ --argjson queuedDevelopment "$QUEUED_DEV" --argjson queuedAnalysis "$QUEUED_ANALYSIS" \
244
256
  --argjson reports "$REPORTS" --argjson todayCount "$TODAY_N" --argjson todayUsd "$TODAY_USD" \
245
257
  --arg power "$POWER" --arg note "$NOTE" --arg stopCommand "$STOP_COMMAND" \
246
258
  --arg emptyReason "$EMPTY_REASON" --arg blockedReason "$BLOCKED" \
@@ -250,7 +262,8 @@ build_json() {
250
262
  --argjson inhibitorHeld "$INHIBITOR_HELD" --arg lastGcReport "$LAST_GC" \
251
263
  --arg lastDigest "$LAST_DIGEST" --argjson maxParallelAgents "$MAX_PAR" \
252
264
  --argjson awake "$AWAKE" \
253
- '{on:$on, slots:$slots, running:$running, queued:$queued, awaiting:$awaiting,
265
+ '{on:$on, slots:$slots, running:$running, queued:$queued,
266
+ queuedDevelopment:$queuedDevelopment, queuedAnalysis:$queuedAnalysis, awaiting:$awaiting,
254
267
  reports:$reports, todayCount:$todayCount, todayUsd:$todayUsd,
255
268
  lastTickAt:$lastTickAt, power:$power, note:$note, stopCommand:$stopCommand,
256
269
  scanIntervalSeconds:$interval, emptyReason:$emptyReason,
@@ -296,13 +309,15 @@ fi
296
309
 
297
310
  NR=$(printf '%s' "$RUNNING" | jq 'length')
298
311
  NQ=$(printf '%s' "$QUEUED" | jq 'length')
312
+ NQD=$(printf '%s' "$QUEUED_DEV" | jq 'length')
313
+ NQA=$(printf '%s' "$QUEUED_ANALYSIS" | jq 'length')
299
314
  NA=$(printf '%s' "$AWAITING" | jq 'length')
300
315
 
301
316
  if [ "$MODE" = "subjects" ]; then
302
317
  # One line per item, with the numbers INSIDE the string: the widget takes
303
318
  # exactly one string per row, so anything the reader needs has to travel in it.
304
- printf '%s' "$RUNNING" | jq -r --arg phase "$(msg phase-word)" '.[] |
305
- "\(.id) · \($phase) \(.phase // "?")\(if .phaseTotal then "/\(.phaseTotal)" else "" end) \(.phaseName // "") · \(.stack // "")"'
319
+ printf '%s' "$RUNNING" | jq -r --arg phase "$(msg phase-word)" --arg analysis "$(msg analysis-subject)" '.[] |
320
+ "\(.id) · \($phase) \(.phase // "?")\(if .phaseTotal then "/\(.phaseTotal)" else "" end) \(.phaseName // "") · \(.stack // "")\(if .kind == "analysis" then " · " + $analysis else "" end)"'
306
321
  printf '%s' "$AWAITING" | jq -r --arg awaiting "$(msg awaiting-subject)" '.[] | "\(.id) · \($awaiting)"'
307
322
  exit 0
308
323
  fi
@@ -339,11 +354,19 @@ fi
339
354
  echo
340
355
  if [ "$NR" -gt 0 ]; then
341
356
  msg heading-running "$NR"
342
- printf '%s' "$RUNNING" | jq -r '.[] | " \(.id) · \(.phaseName // .phase // "?") · \(.stack // "")"'
357
+ printf '%s' "$RUNNING" | jq -r --arg analysis "$(msg analysis-subject)" '.[] |
358
+ " \(.id) · \(.phaseName // .phase // "?") · \(.stack // "")\(if .kind == "analysis" then " · " + $analysis else "" end)"'
343
359
  fi
344
- if [ "$NQ" -gt 0 ]; then
345
- msg heading-queued "$NQ"
346
- printf '%s' "$QUEUED" | jq -r '.[0:8][] | " \(.id)"'
360
+ # Two headings rather than one list with a column: the queues deliver different
361
+ # things, and "queued" without saying which one leaves the reader waiting for a
362
+ # pull request that was never going to arrive.
363
+ if [ "$NQD" -gt 0 ]; then
364
+ msg heading-queued "$NQD"
365
+ printf '%s' "$QUEUED_DEV" | jq -r '.[0:8][] | " \(.id)"'
366
+ fi
367
+ if [ "$NQA" -gt 0 ]; then
368
+ msg heading-queued-analysis "$NQA"
369
+ printf '%s' "$QUEUED_ANALYSIS" | jq -r '.[0:8][] | " \(.id)"'
347
370
  fi
348
371
  if [ "$NA" -gt 0 ]; then
349
372
  msg heading-awaiting "$NA"
@@ -105,7 +105,35 @@ case "$TIMEOUT" in ""|*[!0-9]*|0) TIMEOUT=60 ;; esac
105
105
 
106
106
  FALLBACK_MODEL="${PREF_MODEL:-haiku}"
107
107
  [ "$FALLBACK_MODEL" = "free" ] && FALLBACK_MODEL="haiku"
108
- [ "$MODEL" = "free" ] || command -v claude >/dev/null 2>&1 || degrade "the claude CLI is not on PATH"
108
+
109
+ # The one-shot, non-interactive call this host answers a delegated read with.
110
+ # Not every host has one: a host that only runs interactively cannot be asked
111
+ # this way at all, and saying so is the honest answer - the caller reads the
112
+ # region itself. The argv comes from the registry so this script never names a
113
+ # CLI it might not be installed beside.
114
+ ma_headless_argv() {
115
+ local hosts="$HERE/../schemas/hosts.json" id
116
+ [ -f "$hosts" ] || { printf 'claude\n-p\n--model\n%s\n' "$1"; return 0; }
117
+ command -v jq >/dev/null 2>&1 || { printf 'claude\n-p\n--model\n%s\n' "$1"; return 0; }
118
+ [ -f "$HERE/../lib/host.sh" ] && . "$HERE/../lib/host.sh"
119
+ # An unresolvable host answers with the shipped argv rather than the first
120
+ # registered host's: assuming one would run another CLI's binary.
121
+ id=$(command -v ma_host_id >/dev/null 2>&1 && ma_host_id || echo "")
122
+ [ -n "$id" ] || { printf 'claude\n-p\n--model\n%s\n' "$1"; return 0; }
123
+ # `{model}` is the MODEL this host runs, not the rung name the router returns.
124
+ # They are the same string on a host whose rung names are its model aliases
125
+ # and nowhere else, so the rung is resolved through the registry first.
126
+ jq -r --arg id "$id" --arg r "$1" \
127
+ '(.hosts[$id].models.rungs[$r].model // $r) as $m
128
+ | (.hosts[$id].headless.argv // []) | .[] | sub("\\{model\\}"; $m)' "$hosts" 2>/dev/null
129
+ }
130
+
131
+ HEADLESS=()
132
+ while IFS= read -r _arg; do [ -n "$_arg" ] && HEADLESS+=("$_arg"); done < <(ma_headless_argv "$MODEL")
133
+ if [ "$MODEL" != "free" ]; then
134
+ [ ${#HEADLESS[@]} -gt 0 ] || degrade "this host has no one-shot call a delegated read can use"
135
+ command -v "${HEADLESS[0]}" >/dev/null 2>&1 || degrade "the ${HEADLESS[0]} CLI is not on PATH"
136
+ fi
109
137
 
110
138
  LINES=$(wc -l < "$FILE" | tr -d ' ')
111
139
  BYTES=$(wc -c < "$FILE" | tr -d ' ')
@@ -273,11 +301,15 @@ PYEOF
273
301
  if [ "$FREE_DONE" != 1 ]; then
274
302
  echo "bulk-read: free chain not used ($FREE_REASON); reading on $FALLBACK_MODEL" >&2
275
303
  MODEL="$FALLBACK_MODEL"
276
- command -v claude >/dev/null 2>&1 || degrade "the claude CLI is not on PATH"
304
+ HEADLESS=()
305
+ while IFS= read -r _arg; do [ -n "$_arg" ] && HEADLESS+=("$_arg"); done < <(ma_headless_argv "$MODEL")
306
+ [ ${#HEADLESS[@]} -gt 0 ] || degrade "this host has no one-shot call a delegated read can use"
307
+ command -v "${HEADLESS[0]}" >/dev/null 2>&1 || degrade "the ${HEADLESS[0]} CLI is not on PATH"
277
308
  fi
278
309
  fi
279
310
 
280
- # `claude -p` reads the prompt from stdin; the model flag names the rung. A
311
+ # The headless call reads the prompt from stdin and names the rung in its own
312
+ # argv (registry `headless.argv`, `{model}` substituted above). A
281
313
  # non-zero exit, an empty answer and a non-JSON answer are all degradations, and
282
314
  # each one names itself rather than falling through to a generic failure.
283
315
  # macOS ships no `timeout`; coreutils installs it as `gtimeout`. Naming only the
@@ -287,13 +319,13 @@ fi
287
319
  if [ "$FREE_DONE" = 1 ]; then
288
320
  STATUS=0
289
321
  elif [ -n "$TIMEOUT_BIN" ]; then
290
- "$TIMEOUT_BIN" "$TIMEOUT" claude -p --model "$MODEL" < "$PROMPT_FILE" > "$OUT_FILE" 2>/dev/null
322
+ "$TIMEOUT_BIN" "$TIMEOUT" "${HEADLESS[@]}" < "$PROMPT_FILE" > "$OUT_FILE" 2>/dev/null
291
323
  STATUS=$?
292
324
  else
293
325
  # No timeout binary: the budget cannot be enforced, so say so rather than
294
326
  # letting the caller believe timeoutSeconds is holding.
295
327
  echo "bulk-read: no timeout binary found; bulkRead.timeoutSeconds is not enforced on this host" >&2
296
- claude -p --model "$MODEL" < "$PROMPT_FILE" > "$OUT_FILE" 2>/dev/null
328
+ "${HEADLESS[@]}" < "$PROMPT_FILE" > "$OUT_FILE" 2>/dev/null
297
329
  STATUS=$?
298
330
  fi
299
331
  ELAPSED=$(( $(date +%s) - START ))
@@ -20,7 +20,7 @@
20
20
  import { existsSync, readFileSync } from "node:fs";
21
21
  import { basename } from "node:path";
22
22
 
23
- import { resolveToken } from "../lib/credential-resolve.mjs";
23
+ import { resolveSecretAsync, selectAccount } from "../lib/service-account.mjs";
24
24
  import { runMain } from "../lib/fatal.mjs";
25
25
  import { exitOnHelp } from "../lib/cli-help.mjs";
26
26
 
@@ -91,15 +91,23 @@ async function main() {
91
91
  process.exitCode = 2;
92
92
  return;
93
93
  }
94
- const base = (process.env.CONFLUENCE_BASE_URL || "").replace(/\/+$/, "");
95
- const token = resolveToken("confluence", "CONFLUENCE_TOKEN");
96
- if (!base || !token) {
97
- process.stderr.write(
98
- "ERR: CONFLUENCE_BASE_URL and a Confluence token (credential store or CONFLUENCE_TOKEN) are required\n",
99
- );
94
+ // The base URL is a destination, not a setting: it goes to the resolver,
95
+ // which hands back a token only for a host a Confluence account names.
96
+ const asked = (process.env.CONFLUENCE_BASE_URL || "").replace(/\/+$/, "");
97
+ const chosen = selectAccount({ service: "confluence", url: asked || undefined });
98
+ if (!chosen.ok) {
99
+ process.stderr.write(`ERR: ${chosen.message} ${chosen.remedy}\n`);
100
+ process.exitCode = 2;
101
+ return;
102
+ }
103
+ const base = asked || chosen.account.baseUrl || `https://${chosen.account.hosts[0]}`;
104
+ const answer = await resolveSecretAsync({ service: "confluence", url: base });
105
+ if (!answer.ok) {
106
+ process.stderr.write(`ERR: ${answer.message} ${answer.remedy}\n`);
100
107
  process.exitCode = 2;
101
108
  return;
102
109
  }
110
+ const token = answer.secret;
103
111
  const md = readFileSync(mdPath, "utf8");
104
112
  const id = encodeURIComponent(pageId);
105
113
  let content;
@@ -4,30 +4,62 @@
4
4
  "verifiedAt": "2026-10-14",
5
5
  "_legacyReadme": "`legacy` prices previous-generation wire IDs a transcript may still name, keyed by the exact ID (a dated snapshot of one prices as it). Dispatch never reads it; cost-analyze consults it after the current `modelId` values and the `models` map. Official Anthropic prices per million tokens.",
6
6
  "legacy": {
7
- "claude-fable-5": { "inPerMtok": 10.0, "outPerMtok": 50.0, "cacheReadPerMtok": 1.0 },
8
- "claude-fable-5-1": { "inPerMtok": 10.0, "outPerMtok": 50.0, "cacheReadPerMtok": 0.25 },
9
- "claude-opus-5": { "inPerMtok": 5.0, "outPerMtok": 25.0, "cacheReadPerMtok": 0.5 },
10
- "claude-sonnet-5": { "inPerMtok": 2.0, "outPerMtok": 10.0, "cacheReadPerMtok": 0.2 },
11
- "claude-haiku-4-5": { "inPerMtok": 1.0, "outPerMtok": 5.0, "cacheReadPerMtok": 0.1 }
7
+ "claude-fable-5": {
8
+ "inPerMtok": 10,
9
+ "outPerMtok": 50,
10
+ "cacheReadPerMtok": 1
11
+ },
12
+ "claude-fable-5-1": {
13
+ "inPerMtok": 10,
14
+ "outPerMtok": 50,
15
+ "cacheReadPerMtok": 0.25
16
+ },
17
+ "claude-opus-5": {
18
+ "inPerMtok": 5,
19
+ "outPerMtok": 25,
20
+ "cacheReadPerMtok": 0.5
21
+ },
22
+ "claude-sonnet-5": {
23
+ "inPerMtok": 2,
24
+ "outPerMtok": 10,
25
+ "cacheReadPerMtok": 0.2
26
+ },
27
+ "claude-haiku-4-5": {
28
+ "inPerMtok": 1,
29
+ "outPerMtok": 5,
30
+ "cacheReadPerMtok": 0.1
31
+ }
12
32
  },
13
33
  "_modelsReadme": "`models` prices wire IDs a rung dispatches whose model is not the rung's `modelId`: Copilot CLI's `copilotModelId` values name an older model than the rung's, billed at that model's own rate. Keyed by the exact ID; cost-analyze consults it before the rung rates, so a Copilot CLI session is priced at its own model. Official Anthropic prices per million tokens, verified 2026-10-14.",
14
34
  "models": {
15
- "claude-opus-4.7": { "inPerMtok": 5.0, "outPerMtok": 25.0, "cacheReadPerMtok": 0.5 },
16
- "claude-sonnet-4.6": { "inPerMtok": 3.0, "outPerMtok": 15.0, "cacheReadPerMtok": 0.3 },
17
- "claude-haiku-4.5": { "inPerMtok": 1.0, "outPerMtok": 5.0, "cacheReadPerMtok": 0.1 }
35
+ "claude-opus-4.7": {
36
+ "inPerMtok": 5,
37
+ "outPerMtok": 25,
38
+ "cacheReadPerMtok": 0.5
39
+ },
40
+ "claude-sonnet-4.6": {
41
+ "inPerMtok": 3,
42
+ "outPerMtok": 15,
43
+ "cacheReadPerMtok": 0.3
44
+ },
45
+ "claude-haiku-4.5": {
46
+ "inPerMtok": 1,
47
+ "outPerMtok": 5,
48
+ "cacheReadPerMtok": 0.1
49
+ }
18
50
  },
19
51
  "prices": {
20
52
  "fable": {
21
- "inPerMtok": 8.0,
22
- "outPerMtok": 40.0,
53
+ "inPerMtok": 8,
54
+ "outPerMtok": 40,
23
55
  "cacheReadPerMtok": 0.2,
24
56
  "modelId": "claude-fable-5-2",
25
57
  "provider": "anthropic",
26
58
  "note": "Top tier - architects, Reviewer 1 and triage on Claude Code. Claude Fable 5.2, verified against Anthropic pricing 2026-11-03."
27
59
  },
28
60
  "opus": {
29
- "inPerMtok": 4.0,
30
- "outPerMtok": 20.0,
61
+ "inPerMtok": 4,
62
+ "outPerMtok": 20,
31
63
  "cacheReadPerMtok": 0.2,
32
64
  "modelId": "claude-opus-5-5",
33
65
  "copilotModelId": "claude-opus-4.7",
@@ -35,8 +67,8 @@
35
67
  "note": "Second tier - Reviewer 2 on Claude Code, Reviewer 1 and triage on Copilot CLI, and the opus rung of the fable -> opus -> sonnet fallback ladder. Claude Opus 5.5, verified against Anthropic pricing 2026-10-14."
36
68
  },
37
69
  "sonnet": {
38
- "inPerMtok": 2.0,
39
- "outPerMtok": 10.0,
70
+ "inPerMtok": 2,
71
+ "outPerMtok": 10,
40
72
  "cacheReadPerMtok": 0.1,
41
73
  "modelId": "claude-sonnet-5-5",
42
74
  "copilotModelId": "claude-sonnet-4.6",
@@ -53,36 +85,44 @@
53
85
  "note": "Speed tier - task-clarifier and other latency-sensitive dispatches, plus the terminal rung of the fallback ladder. Claude Haiku 5.5 is priced in two tiers by prompt length (in 0.10, cache-read 0.01, out 0.50 up to 100k input tokens; in 0.50, cache-read 0.05, out 2.50 above); this table holds one rate per rung, so it carries the over-100k tier: over-reporting is the safe direction for a cost ledger. Verified against Anthropic pricing 2026-10-14."
54
86
  },
55
87
  "gpt-5.4": {
56
- "inPerMtok": 10.0,
57
- "outPerMtok": 30.0,
58
- "cacheReadPerMtok": 1.0,
88
+ "inPerMtok": 10,
89
+ "outPerMtok": 30,
90
+ "cacheReadPerMtok": 1,
59
91
  "modelId": "gpt-5.4",
60
92
  "provider": "openai",
61
93
  "note": "Copilot CLI Reviewer 2 and Codex CLI Reviewer 2 - approximate; verify against OpenAI pricing page before relying on totals."
62
94
  },
63
95
  "gpt-5.6": {
64
- "inPerMtok": 10.0,
65
- "outPerMtok": 30.0,
66
- "cacheReadPerMtok": 1.0,
96
+ "inPerMtok": 10,
97
+ "outPerMtok": 30,
98
+ "cacheReadPerMtok": 1,
67
99
  "modelId": "gpt-5.6",
68
100
  "provider": "openai",
69
101
  "note": "Codex CLI top tier - Reviewer 1 at xhigh effort, Reviewer 3 at medium, triage at max, and the fable/opus rungs of the Codex persona tier map. Reasoning effort changes output volume, not the per-token rate, so one entry covers every effort level. Approximate; verify against OpenAI pricing before relying on totals."
70
102
  },
71
103
  "gpt-5.6-terra": {
72
- "inPerMtok": 1.0,
73
- "outPerMtok": 5.0,
104
+ "inPerMtok": 1,
105
+ "outPerMtok": 5,
74
106
  "cacheReadPerMtok": 0.1,
75
107
  "modelId": "gpt-5.6-terra",
76
108
  "provider": "openai",
77
109
  "note": "Codex CLI floor tier - speed-optimised, maps the haiku rung of the Codex persona tier map (task-clarifier). Approximate; verify against OpenAI pricing before relying on totals."
78
110
  },
79
111
  "free": {
80
- "inPerMtok": 0.0,
81
- "outPerMtok": 0.0,
82
- "cacheReadPerMtok": 0.0,
112
+ "inPerMtok": 0,
113
+ "outPerMtok": 0,
114
+ "cacheReadPerMtok": 0,
83
115
  "modelId": "free-chain",
84
116
  "provider": "free-chain",
85
117
  "note": "Layer 2: the multi-agent-mcp's verified free-model chain (llm_delegate / multi-agent-mcp-llm) over free tiers - Groq, Mistral, Gemini, OpenRouter free models, Z.AI GLM Flash, local Ollama. Priced at zero because the provider bills nothing on a free tier; what it saves is reported by route-status from the toolkit's usage log at the rate of the rung it replaced."
118
+ },
119
+ "local": {
120
+ "inPerMtok": 0,
121
+ "outPerMtok": 0,
122
+ "cacheReadPerMtok": 0,
123
+ "modelId": "local",
124
+ "provider": "local",
125
+ "note": "A model served from this machine. Priced at zero because no invoice follows a token, which is the point of the rung; the ledger still counts the tokens, so a run on it is comparable with one that cost money."
86
126
  }
87
127
  }
88
128
  }