@mmerterden/multi-agent-pipeline 24.0.0 → 24.1.1

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 (49) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +5 -3
  3. package/README.tr.md +5 -3
  4. package/docs/architecture.md +1 -1
  5. package/docs/ecosystem.md +1 -1
  6. package/docs/facts.json +3 -3
  7. package/docs/features.md +9 -1
  8. package/install/_dev-only-files.mjs +1 -0
  9. package/manifest.json +51 -50
  10. package/package.json +4 -2
  11. package/pipeline/commands/multi-agent/SKILL.md +1 -1
  12. package/pipeline/commands/multi-agent/analysis/SKILL.md +1 -1
  13. package/pipeline/contract/CHANGELOG.md +15 -0
  14. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  15. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  16. package/pipeline/contract/fixtures/runs-awaiting-question.json +6 -1
  17. package/pipeline/contract/fixtures/runs-empty.json +1 -1
  18. package/pipeline/contract/fixtures/runs-failed.json +21 -1
  19. package/pipeline/contract/fixtures/runs-old-schema.json +18 -3
  20. package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +31 -1
  21. package/pipeline/contract/fixtures/runs-pr-opened.json +31 -1
  22. package/pipeline/contract/fixtures/runs-running.json +16 -1
  23. package/pipeline/contract/manifest.json +13 -13
  24. package/pipeline/contract/types/index.d.ts +19 -1
  25. package/pipeline/multi-agent-refs/analysis/render.md +12 -1
  26. package/pipeline/multi-agent-refs/features/local-model.md +2 -2
  27. package/pipeline/multi-agent-refs/features/model-fallback.md +1 -1
  28. package/pipeline/multi-agent-refs/help/en.md +10 -2
  29. package/pipeline/multi-agent-refs/help/tr.md +8 -2
  30. package/pipeline/multi-agent-refs/phases/phase-0-init.md +1 -0
  31. package/pipeline/multi-agent-refs/phases/phase-3-review.md +1 -1
  32. package/pipeline/multi-agent-refs/phases/phase-4-commit.md +1 -0
  33. package/pipeline/multi-agent-refs/phases/phase-5-report.md +1 -1
  34. package/pipeline/multi-agent-refs/review/panel.md +1 -1
  35. package/pipeline/multi-agent-refs/sync/overview.md +1 -1
  36. package/pipeline/multi-agent-refs/tracker-contract.md +36 -10
  37. package/pipeline/office/index.html +75 -2
  38. package/pipeline/schemas/activity.schema.json +63 -4
  39. package/pipeline/schemas/hosts.json +1 -1
  40. package/pipeline/schemas/now-lines.json +103 -0
  41. package/pipeline/schemas/now-lines.schema.json +42 -0
  42. package/pipeline/schemas/runs-index.schema.json +22 -1
  43. package/pipeline/scripts/_contract-core.mjs +1 -1
  44. package/pipeline/scripts/activity-snapshot.mjs +27 -1
  45. package/pipeline/scripts/phase-tracker.sh +80 -12
  46. package/pipeline/scripts/render-work-summary.sh +51 -1
  47. package/pipeline/scripts/runs-index.mjs +2 -1
  48. package/pipeline/skills/.skill-manifest.json +1 -1
  49. package/pipeline/scripts/.doctor-mut.47076.mjs +0 -2253
@@ -0,0 +1,103 @@
1
+ {
2
+ "$comment": "The canonical current-action lines, per phase. A run writes one with `phase-tracker.sh now <phase> \"<line>\"`; the tracker caps it at 60 characters, the card prints it as `Now:`, the subject carries it last and the office shows it on the phase card. Angle brackets are runtime values. A phase that is working and has written none falls back to the name of its in-progress sub-step, so the surfaces are never blank; the lines here are what makes that fallback rare rather than the normal case.",
3
+ "cap": 60,
4
+ "phases": {
5
+ "0": {
6
+ "name": "Init",
7
+ "lines": [
8
+ "checking access and loading preferences",
9
+ "checking service tokens",
10
+ "reading task <id>",
11
+ "reading linked pages and issues",
12
+ "choosing the project and extra repos",
13
+ "picking the base branch",
14
+ "creating the workspace on <branch>",
15
+ "working out the task type and test depth",
16
+ "checking the task is clear enough to start",
17
+ "waiting for your choice: <what is asked>"
18
+ ]
19
+ },
20
+ "1": {
21
+ "name": "Plan",
22
+ "lines": [
23
+ "loading project rules and past learnings",
24
+ "capturing the design frames",
25
+ "looking for existing code to reuse",
26
+ "detecting the stack",
27
+ "exploring the codebase (<n> explorers)",
28
+ "writing the analysis document",
29
+ "splitting the work into tasks",
30
+ "reviewing the architecture",
31
+ "checking the plan covers every requirement",
32
+ "waiting for your plan approval",
33
+ "revising the plan: <edit summary>"
34
+ ]
35
+ },
36
+ "2": {
37
+ "name": "Dev",
38
+ "lines": [
39
+ "reading the analysis and binding standards",
40
+ "choosing the skills for this work",
41
+ "<plan task title>",
42
+ "writing the failing test",
43
+ "confirming the test fails",
44
+ "writing the code",
45
+ "adding tests",
46
+ "running the tests",
47
+ "waiting for the build queue",
48
+ "building",
49
+ "saving a checkpoint commit",
50
+ "building the component: <sub-phase name>",
51
+ "checking the work against the plan",
52
+ "capturing screenshots of the change",
53
+ "simplifying the diff",
54
+ "checking nothing outside the task changed",
55
+ "verifying: build",
56
+ "verifying: lint",
57
+ "verifying: tests",
58
+ "verifying: secret scan",
59
+ "fixing review finding <i> of <n>: <title>"
60
+ ]
61
+ },
62
+ "3": {
63
+ "name": "Review",
64
+ "lines": [
65
+ "running the pre-review checks",
66
+ "ranking the riskiest files",
67
+ "review in progress: <n> reviewers",
68
+ "review: <k> of <n> reviewers done",
69
+ "security audit in progress",
70
+ "comparing the screen to the design",
71
+ "sorting the findings",
72
+ "fixing <n> accepted findings (round <r> of <max>)",
73
+ "awaiting local test (user)",
74
+ "applying fix: <summary>"
75
+ ]
76
+ },
77
+ "4": {
78
+ "name": "Commit",
79
+ "lines": [
80
+ "checking every plan task is covered",
81
+ "building all repos together",
82
+ "writing the commit message",
83
+ "committing <n> files",
84
+ "pushing <branch>",
85
+ "pushing <branch> (attempt <k> of <max>)",
86
+ "writing the pull request description",
87
+ "opening the pull request",
88
+ "publishing screenshots",
89
+ "cleaning up the workspace"
90
+ ]
91
+ },
92
+ "5": {
93
+ "name": "Report",
94
+ "lines": [
95
+ "waiting for your choice: where to send the report",
96
+ "sending the report: <channel>",
97
+ "writing the run log",
98
+ "saving what this run learned",
99
+ "printing the summary"
100
+ ]
101
+ }
102
+ }
103
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "now-lines.schema.json",
4
+ "title": "Current-action lines",
5
+ "description": "The canonical lines a run writes with `phase-tracker.sh now`, one set per phase. The tracker caps each at `cap` characters after runtime values are substituted, so a template is already too long when it exceeds the cap empty. lint-now-lines.mjs holds this file and the phase docs to each other.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["cap", "phases"],
9
+ "properties": {
10
+ "$comment": { "type": "string" },
11
+ "cap": {
12
+ "type": "integer",
13
+ "minimum": 20,
14
+ "maximum": 200,
15
+ "description": "Characters the tracker keeps. Beyond it the line is cut, so a longer template loses its end rather than being refused."
16
+ },
17
+ "phases": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "description": "Keyed by the phase id as a string, matching schemas/phases.json.",
21
+ "propertyNames": { "pattern": "^[0-9]+$" },
22
+ "additionalProperties": {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "required": ["name", "lines"],
26
+ "properties": {
27
+ "name": {
28
+ "type": "string",
29
+ "minLength": 1,
30
+ "description": "The phase's name, which must be the one phases.json gives it."
31
+ },
32
+ "lines": {
33
+ "type": "array",
34
+ "minItems": 1,
35
+ "description": "What this phase says it is doing. Angle brackets mark a runtime value.",
36
+ "items": { "type": "string", "minLength": 1 }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
@@ -379,7 +379,8 @@
379
379
  "completedAt",
380
380
  "now",
381
381
  "subs",
382
- "subList"
382
+ "subList",
383
+ "tokens"
383
384
  ],
384
385
  "properties": {
385
386
  "id": {
@@ -437,6 +438,26 @@
437
438
  }
438
439
  }
439
440
  },
441
+ "tokens": {
442
+ "type": "object",
443
+ "required": ["in", "out", "cached"],
444
+ "x-sensitivity": "none",
445
+ "description": "What this one phase spent, from its own tracker counters. The run's total is the `tokens` beside it on the run record. Added in 1.6.0.",
446
+ "properties": {
447
+ "in": {
448
+ "type": "integer",
449
+ "minimum": 0
450
+ },
451
+ "out": {
452
+ "type": "integer",
453
+ "minimum": 0
454
+ },
455
+ "cached": {
456
+ "type": "integer",
457
+ "minimum": 0
458
+ }
459
+ }
460
+ },
440
461
  "progress": {
441
462
  "type": ["number", "null"],
442
463
  "minimum": 0,
@@ -21,7 +21,7 @@ import { launchRepoAllowed, launchRepos } from "./launch-request.mjs";
21
21
  import { selectRuns } from "./runs-index.mjs";
22
22
 
23
23
  /** The contract as a whole; pipeline/contract/manifest.json carries the same. */
24
- export const CONTRACT_VERSION = "2.3.0";
24
+ export const CONTRACT_VERSION = "2.4.0";
25
25
  /** Confirm tokens held at once; the oldest is dropped past this. */
26
26
  export const MAX_CONFIRMS = 256;
27
27
  /** How long a kill or gc confirm token stays valid. */
@@ -84,7 +84,7 @@ import { ArgsError, parseArgs as parseArgv } from "../lib/args.mjs";
84
84
 
85
85
  exitOnHelp(import.meta.url);
86
86
 
87
- export const CONTRACT_VERSION = "1.4.0";
87
+ export const CONTRACT_VERSION = "1.5.0";
88
88
  export const RECENT_MS = 10 * 60_000;
89
89
 
90
90
  export const ROLES = JSON.parse(
@@ -875,6 +875,9 @@ const MAX_TASKS = 20;
875
875
  const TASK_STATES = new Set(["pending", "in_progress", "completed"]);
876
876
  const fraction = (v) =>
877
877
  typeof v === "number" && v >= 0 && v <= 1 ? Math.round(v * 100) / 100 : null;
878
+ // runs-index keeps `subs` as the count an older reader already decodes and the
879
+ // steps themselves as `subList`, so the list is read from there.
880
+ const subRows = (p) => (Array.isArray(p?.subList) ? p.subList : []);
878
881
  // The command a table runs, named the way a user types it.
879
882
  // The commands installed beside this script; a mode with no command of its
880
883
  // own (dev, short, dev-local) is a /multi-agent run.
@@ -1026,10 +1029,33 @@ function renderTable(team, clean, now) {
1026
1029
  name: phaseRow?.name || phaseName(runType, shownPhase),
1027
1030
  last: LAST_PHASE,
1028
1031
  },
1032
+ // The office shows what the terminal surfaces show, from the same record:
1033
+ // which model is spending, what the phase is doing right now, and how far
1034
+ // through its own steps it is. Without these the page can only name the
1035
+ // phase, which is the one thing a reader already knows.
1029
1036
  phaseHistory: phases.map((p) => ({
1030
1037
  id: Number.isFinite(Number(p.id)) ? Number(p.id) : null,
1031
1038
  name: clean(p.name, 60) ?? "",
1032
1039
  status: String(p.status ?? "pending"),
1040
+ model: clean(p.model, 40) ?? null,
1041
+ // Only a phase that is working, or stopped where it was working, has a
1042
+ // current action; on any other status it would describe a past moment.
1043
+ // Falling back to the step in progress keeps the card from going blank
1044
+ // on a phase that moved without writing a line.
1045
+ now:
1046
+ p.status === "in_progress" || p.status === "failed"
1047
+ ? (clean(p.now, 60) ??
1048
+ clean(subRows(p).find((x) => x?.status === "in_progress")?.name, 60) ??
1049
+ null)
1050
+ : null,
1051
+ tokens: Number(p.tokens?.in ?? 0) + Number(p.tokens?.out ?? 0) || null,
1052
+ subs: subRows(p)
1053
+ .slice(0, MAX_TASKS)
1054
+ .map((sb) => ({
1055
+ id: clean(String(sb?.id ?? ""), 12) ?? "",
1056
+ name: clean(sb?.name, 60) ?? "",
1057
+ status: TASK_STATES.has(sb?.status) ? sb.status : "pending",
1058
+ })),
1033
1059
  startedAt: p.startedAt ?? null,
1034
1060
  completedAt: p.completedAt ?? null,
1035
1061
  progress: fraction(p.progress),
@@ -918,6 +918,48 @@ EOF
918
918
  # Every segment is omitted while it is empty, so a pending phase is just its name
919
919
  # and a finished one carries its whole bill. Separator is ` - `, not a middle dot:
920
920
  # a subject is a task title and travels through surfaces that are not a terminal.
921
+ # A task subject is a title: it travels through surfaces that are not a terminal
922
+ # and a host truncates it where it likes, so the length is ours to decide. The
923
+ # action is the only segment that grows without a bound, so it is last and it is
924
+ # the one that gets shortened; the phase, its elapsed time and its step counter
925
+ # are what a reader scans for and never drop.
926
+ #
927
+ # Order of sacrifice when the line is too long: the cost, which comes back when
928
+ # the phase completes; then the action, down to a floor below which it says
929
+ # nothing; then the tokens; then the model.
930
+ SUBJECT_MAX=96
931
+ SUBJECT_ACTION_FLOOR=24
932
+
933
+ # Each segment arrives on its own so the drop order is the code rather than a
934
+ # claim about it: nothing has to be parsed back out of an assembled line.
935
+ compose_subject() {
936
+ local phase="$1" model="$2" elapsed="$3" tok="$4" cost="$5" step="$6" act="$7" line
937
+ _subject_fits() { line="$phase$model$elapsed$tok$cost$step$act"; [ "${#line}" -le "$SUBJECT_MAX" ]; }
938
+
939
+ _subject_fits && { printf '%s' "$line"; return 0; }
940
+ cost=""
941
+ _subject_fits && { printf '%s' "$line"; return 0; }
942
+
943
+ if [ -n "$act" ]; then
944
+ local room=$(( SUBJECT_MAX - ${#phase} - ${#model} - ${#elapsed} - ${#tok} - ${#step} - 6 ))
945
+ if [ "$room" -ge "$SUBJECT_ACTION_FLOOR" ]; then
946
+ act=" - ${act:3:$room}..."
947
+ _subject_fits && { printf '%s' "$line"; return 0; }
948
+ fi
949
+ fi
950
+
951
+ tok=""
952
+ _subject_fits && { printf '%s' "$line"; return 0; }
953
+
954
+ # The model is the last to go: without it a reader cannot tell what is
955
+ # spending, and by this point the action has already been cut to its floor.
956
+ # The phase, its elapsed time and its counter stay, which is what the order
957
+ # above promises.
958
+ model=""
959
+ _subject_fits && { printf '%s' "$line"; return 0; }
960
+ printf '%s' "$line"
961
+ }
962
+
921
963
  subjects() {
922
964
  need_jq
923
965
  local state want="${1:-}" new_only=""
@@ -946,17 +988,20 @@ subjects() {
946
988
  (.id // ""), (.name // ""), (.status // ""),
947
989
  (.started_at // ""), (.completed_at // ""), (.model // ""),
948
990
  (((.tokens_in // 0) + (.tokens_out // 0)) | tostring),
949
- (usd_of(.) | if . == null then "" else (((. * 100) | floor) / 100 | tostring) end)
991
+ (usd_of(.) | if . == null then "" else (((. * 100) | floor) / 100 | tostring) end),
992
+ ([.subs[]? | select(.status == "completed")] | length | tostring),
993
+ ([.subs[]?] | length | tostring),
994
+ (. as $p | ($p.meta.Now // "") | if . == "" then ([$p.subs[]? | select(.status == "in_progress") | .name] | first // "") else . end)
950
995
  ] | join("\u001f")')
951
- local pid pname pstatus p_start p_end pmodel ptok pusd
952
- while IFS=$'\x1f' read -r pid pname pstatus p_start p_end pmodel ptok pusd; do
996
+ local pid pname pstatus p_start p_end pmodel ptok pusd pdone ptotal paction
997
+ while IFS=$'\x1f' read -r pid pname pstatus p_start p_end pmodel ptok pusd pdone ptotal paction; do
953
998
  [ -n "$pid" ] || continue
954
999
  [ -z "$want" ] || [ "$want" = "$pid" ] || continue
955
1000
  if [ -n "$new_only" ]; then
956
1001
  case "$new_ids" in *" $pid "*) ;; *) continue ;; esac
957
1002
  fi
958
- local line="Phase $pid $pname"
959
- [ -n "$pmodel" ] && line="$line - $pmodel"
1003
+ local seg_phase="Phase $pid $pname" seg_model=""
1004
+ [ -n "$pmodel" ] && seg_model=" - $pmodel"
960
1005
  local s_ep e_ep el=""
961
1006
  s_ep=$(iso_to_epoch "$p_start")
962
1007
  e_ep=$(iso_to_epoch "$p_end")
@@ -967,11 +1012,26 @@ subjects() {
967
1012
  esac
968
1013
  fi
969
1014
  if [ -n "$el" ] && [ "$el" -lt 0 ] 2>/dev/null; then el=0; fi
970
- [ -n "$el" ] && line="$line - $(format_elapsed "$el")"
1015
+ local seg_el=""
1016
+ [ -n "$el" ] && seg_el=" - $(format_elapsed "$el")"
1017
+ local seg_tok="" seg_cost=""
971
1018
  if [ "${ptok:-0}" -gt 0 ] 2>/dev/null; then
972
- line="$line - $(format_tokens "$ptok") tok"
973
- [ -n "$pusd" ] && line="$line - $(printf '~$%.2f' "$pusd" 2>/dev/null || echo '')"
1019
+ seg_tok=" - $(format_tokens "$ptok") tok"
1020
+ [ -n "$pusd" ] && seg_cost=" - $(printf '~$%.2f' "$pusd" 2>/dev/null || echo '')"
974
1021
  fi
1022
+ # The counter and the action belong to a phase that is running or stopped in
1023
+ # place. On a finished phase they would describe a moment that has passed,
1024
+ # and on a pending one there is nothing to describe.
1025
+ local seg_step="" seg_act=""
1026
+ case "$pstatus" in
1027
+ in_progress|failed)
1028
+ [ "${ptotal:-0}" -gt 0 ] 2>/dev/null && seg_step=" - step ${pdone:-0}/${ptotal}"
1029
+ [ -n "$paction" ] && seg_act=" - $paction"
1030
+ ;;
1031
+ esac
1032
+ local line
1033
+ line=$(compose_subject "$seg_phase" "$seg_model" "$seg_el" \
1034
+ "$seg_tok" "$seg_cost" "$seg_step" "$seg_act")
975
1035
  printf '%s\n' "$line"
976
1036
 
977
1037
  # Sub-phases ride out on the SAME list, indented in the subject string.
@@ -1173,20 +1233,21 @@ render() {
1173
1233
  ((.tokens_out // 0) | tostring),
1174
1234
  ((.subs // []) | length | tostring),
1175
1235
  ((.meta // {}) | keys_unsorted | join(",")),
1236
+ (.model // ""),
1176
1237
  (usd_of(.) | if . == null then "" else (((. * 100) | floor) / 100 | tostring) end)
1177
1238
  ] | join("")
1178
1239
  ')
1179
1240
 
1180
1241
  local phase_count=0
1181
1242
  local -a row_status=() row_started=() row_completed=() row_id=() row_name=()
1182
- local -a row_tin=() row_tout=() row_subcount=() row_metakeys=() row_usd=()
1243
+ local -a row_tin=() row_tout=() row_subcount=() row_metakeys=() row_usd=() row_model=()
1183
1244
  if [ -n "$phase_data" ]; then
1184
- local _s _st _ed _id _nm _ti _to _sc _mk _us
1185
- while IFS=$'\x1f' read -r _s _st _ed _id _nm _ti _to _sc _mk _us; do
1245
+ local _s _st _ed _id _nm _ti _to _sc _mk _md _us
1246
+ while IFS=$'\x1f' read -r _s _st _ed _id _nm _ti _to _sc _mk _md _us; do
1186
1247
  row_status+=("$_s"); row_started+=("$_st"); row_completed+=("$_ed")
1187
1248
  row_id+=("$_id"); row_name+=("$_nm")
1188
1249
  row_tin+=("$_ti"); row_tout+=("$_to")
1189
- row_subcount+=("$_sc"); row_metakeys+=("$_mk"); row_usd+=("$_us")
1250
+ row_subcount+=("$_sc"); row_metakeys+=("$_mk"); row_usd+=("$_us"); row_model+=("$_md")
1190
1251
  phase_count=$((phase_count + 1))
1191
1252
  done <<< "$phase_data"
1192
1253
  fi
@@ -1266,6 +1327,13 @@ render() {
1266
1327
  fi
1267
1328
  [ -n "$usd_label" ] && [ -n "$tok_label" ] && tok_label="${tok_label} · ${usd_label}"
1268
1329
 
1330
+ # The model belongs beside the bill it explains: a phase's cost means
1331
+ # nothing without knowing which model spent it, and on the card there is
1332
+ # room to say so plainly.
1333
+ local p_model="${row_model[$i]}"
1334
+ [ -n "$p_model" ] && [ -n "$tok_label" ] && tok_label="${p_model} · ${tok_label}"
1335
+ [ -n "$p_model" ] && [ -z "$tok_label" ] && tok_label="$p_model"
1336
+
1269
1337
  local right_block=""
1270
1338
  if [ -n "$el_label" ] && [ -n "$tok_label" ]; then
1271
1339
  right_block=$(printf "%b%s%b ${C_DIM}·${C_RESET} %b%s%b" "$el_color" "$el_label" "$C_RESET" "$C_DIM" "$tok_label" "$C_RESET")
@@ -9,7 +9,13 @@
9
9
  # changed?" without parsing the full pipeline log.
10
10
  #
11
11
  # Usage:
12
- # render-work-summary.sh <task-id> [--worktree <path>] [--branch <name>]
12
+ # render-work-summary.sh <task-id> [--format markdown|terminal]
13
+ # [--worktree <path>] [--branch <name>]
14
+ #
15
+ # `markdown` (the default) is the block a channel carries: a Jira comment, a
16
+ # Confluence page, a pull request body. `terminal` is the same facts for the
17
+ # person who just watched the run: no markup, one screen, and it names what is
18
+ # left for them. The two render from one collection, so they cannot disagree.
13
19
  # [--base-branch <name>]
14
20
  #
15
21
  # Source of truth precedence:
@@ -55,6 +61,7 @@ need_value() { [ $# -ge 2 ] || { echo "render-work-summary: $1 needs a value" >&
55
61
 
56
62
  while [ $# -gt 0 ]; do
57
63
  case "$1" in
64
+ --format) need_value "$@"; FORMAT="$2"; shift 2 ;;
58
65
  --worktree) need_value "$@"; WORKTREE="$2"; shift 2 ;;
59
66
  --branch) need_value "$@"; BRANCH="$2"; shift 2 ;;
60
67
  --base-branch) need_value "$@"; BASE="$2"; shift 2 ;;
@@ -264,6 +271,49 @@ rejected=$(jq -r '.rejected // [] | length' <<< "$state_triage" 2>/dev/null || e
264
271
  approved=$(jq -r '.approved // false' <<< "$state_triage" 2>/dev/null || echo false)
265
272
 
266
273
  # ─── Render ────────────────────────────────────────────────────────
274
+ if [ "${FORMAT:-markdown}" = "terminal" ]; then
275
+ # Plain text, because this is read where it is printed. The order answers the
276
+ # three questions a person has when a run stops: what changed, was it checked,
277
+ # and is anything waiting on me.
278
+ line="${state_jira:-this run}"
279
+ [ -n "$state_branch" ] && line="$line on $state_branch"
280
+ printf '%s\n\n' "$line"
281
+
282
+ if [ -n "$tasks_block" ]; then
283
+ printf 'What changed\n'
284
+ printf '%s\n' "$tasks_block" | sed 's/^/ /'
285
+ fi
286
+ if [ "$files_count" -gt 0 ]; then
287
+ printf ' %d file(s) changed (+%d / -%d)\n' "$files_count" "$total_add" "$total_del"
288
+ fi
289
+ printf '\n'
290
+
291
+ if [ "$accepted" != "0" ] || [ "$deferred" != "0" ] || [ "$rejected" != "0" ]; then
292
+ printf 'Checked\n review: %s accepted, %s deferred, %s rejected\n\n' \
293
+ "$accepted" "$deferred" "$rejected"
294
+ fi
295
+
296
+ # The file counts come from `base...tip`, so a non-zero count means the work
297
+ # is committed. Saying "nothing published" there would be false on the
298
+ # commit-straight-to-branch path, which is a configured way to run.
299
+ printf 'Delivered\n'
300
+ if [ -n "$state_pr" ] && [ "$state_pr" != "null" ]; then
301
+ printf ' pull request %s\n' "$state_pr"
302
+ elif [ "$files_count" -gt 0 ] && [ -n "$state_branch" ]; then
303
+ printf ' committed on %s, no pull request\n' "$state_branch"
304
+ else
305
+ printf ' nothing published\n'
306
+ fi
307
+ printf '\n'
308
+
309
+ # Deferred findings are the one thing a reader has to act on, so they are
310
+ # last and they are named rather than counted away.
311
+ if [ "${deferred:-0}" != "0" ]; then
312
+ printf 'Left for you\n %s deferred finding(s)\n' "$deferred"
313
+ fi
314
+ exit 0
315
+ fi
316
+
267
317
  printf '### Work Summary\n'
268
318
 
269
319
  header="**Task**: \`$state_jira\`"
@@ -82,7 +82,7 @@ const PHASE_WAITING_FROM = PHASE_CONTRACT.thresholds.waitingFromPhase;
82
82
  */
83
83
  const LAST_PHASE = PHASE_CONTRACT.phases[PHASE_CONTRACT.phases.length - 1].id;
84
84
 
85
- export const CONTRACT_VERSION = "1.5.0";
85
+ export const CONTRACT_VERSION = "1.6.0";
86
86
 
87
87
  const STATE_MAX_BYTES = 16 * 1024 * 1024;
88
88
 
@@ -378,6 +378,7 @@ function summarisePhases(tracker) {
378
378
  status: sub?.status ?? "pending",
379
379
  }))
380
380
  : [],
381
+ tokens: { in: tin, out: tout, cached: tcached },
381
382
  progress: phaseProgress(status, tasks),
382
383
  tasks,
383
384
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-11-16T18:57:02Z",
3
+ "generatedAt": "2026-11-17T21:18:28Z",
4
4
  "skillCount": 258,
5
5
  "entries": [
6
6
  {