opencode-swarm 7.181.4 → 7.183.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 (104) hide show
  1. package/.opencode/skills/issue-ingest/SKILL.md +19 -1
  2. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  3. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  4. package/dist/cli/{coder-settlement-vbs5rj3z.js → coder-settlement-6m5stw7s.js} +12 -12
  5. package/dist/cli/{config-doctor-3cb51z08.js → config-doctor-g6r21wdz.js} +3 -3
  6. package/dist/cli/{core-0h7y8z0s.js → core-6dzx3z8q.js} +4 -4
  7. package/dist/cli/{curation-policy-r4dkajw9.js → curation-policy-fm7mtvbk.js} +5 -5
  8. package/dist/cli/{curator-9sn55eyk.js → curator-0xqj2rxm.js} +39 -39
  9. package/dist/cli/{curator-drift-d4jkgrba.js → curator-drift-art0x91j.js} +9 -9
  10. package/dist/cli/curator-llm-factory-grnfsaa2.js +74 -0
  11. package/dist/cli/{evidence-summary-service-sb5seqs3.js → evidence-summary-service-h1vb58rd.js} +18 -18
  12. package/dist/cli/{gate-evidence-emq2y7kz.js → gate-evidence-ps3rg5fh.js} +7 -7
  13. package/dist/cli/guardrail-explain-2sb06877.js +75 -0
  14. package/dist/cli/{guardrail-log-ftv03v4x.js → guardrail-log-x2gdf8ys.js} +8 -8
  15. package/dist/cli/{guardrail-reset-d6qmnvff.js → guardrail-reset-mwkys4ff.js} +39 -39
  16. package/dist/cli/{hive-promoter-pktjn46n.js → hive-promoter-gndjyg7e.js} +39 -39
  17. package/dist/cli/{index-dwc1wztn.js → index-0n24h4zb.js} +7 -7
  18. package/dist/cli/{index-x4am0jxt.js → index-1ex9ecf5.js} +4 -4
  19. package/dist/cli/{index-by9wfeja.js → index-1kpa3an2.js} +2 -2
  20. package/dist/cli/{index-a2hvmc3a.js → index-25m6rekr.js} +1 -1
  21. package/dist/cli/{index-1epynxc4.js → index-29f69hzd.js} +2 -2
  22. package/dist/cli/{index-nw3z614g.js → index-30pz2xvj.js} +7 -7
  23. package/dist/cli/{index-23mdeh2a.js → index-3bcmw8pc.js} +1 -1
  24. package/dist/cli/{index-v4h99xhr.js → index-4aggsva0.js} +4 -4
  25. package/dist/cli/{index-vvgpgcyn.js → index-5cvm6ykc.js} +1 -1
  26. package/dist/cli/{index-hqa71xfm.js → index-6f7tfq3m.js} +8 -8
  27. package/dist/cli/{index-68ben2q8.js → index-6nhzekvt.js} +2 -2
  28. package/dist/cli/{index-enmvd9ap.js → index-7p6s4yfb.js} +1 -1
  29. package/dist/cli/{index-ved1325w.js → index-820e6w22.js} +2 -2
  30. package/dist/cli/{index-4qpz7mpn.js → index-94pwd45k.js} +4 -4
  31. package/dist/cli/{index-dkprb20b.js → index-9gehw4xb.js} +2 -2
  32. package/dist/cli/{index-y03jadcy.js → index-a6np52p4.js} +3 -3
  33. package/dist/cli/{index-zp6fss8c.js → index-brfs5jqw.js} +4 -4
  34. package/dist/cli/{index-9eg8f4zm.js → index-c6zrffwn.js} +2281 -2038
  35. package/dist/cli/{index-3ga3ts3h.js → index-fb0v3e71.js} +2 -2
  36. package/dist/cli/{index-gtpq64q7.js → index-fqc1a1vj.js} +4 -4
  37. package/dist/cli/{index-sf51gh68.js → index-ht88g5mc.js} +1 -1
  38. package/dist/cli/{index-j97nc02q.js → index-jf9cvkzr.js} +4 -4
  39. package/dist/cli/{index-myacmqmf.js → index-jsdnhdzg.js} +39 -39
  40. package/dist/cli/{index-y28np6j9.js → index-k88thqa0.js} +6 -6
  41. package/dist/cli/{index-fsye9ygy.js → index-kv0k3b60.js} +6 -6
  42. package/dist/cli/{index-rgfz80gt.js → index-mewsqwbq.js} +1 -1
  43. package/dist/cli/{index-0ea0c676.js → index-nmfnggaa.js} +13 -13
  44. package/dist/cli/{index-r4vve32m.js → index-pvtf7cjg.js} +7 -7
  45. package/dist/cli/{index-9s2rp2j5.js → index-qws72zbs.js} +3 -3
  46. package/dist/cli/{index-6jrn46zy.js → index-r65yxdv7.js} +1 -1
  47. package/dist/cli/{index-s34y6gbh.js → index-r7dqevkc.js} +1 -1
  48. package/dist/cli/{index-427x3j6p.js → index-rfggc332.js} +2 -2
  49. package/dist/cli/{index-989v83pb.js → index-s1y70y0w.js} +8 -2
  50. package/dist/cli/{index-mkpdcbye.js → index-tt705bap.js} +86 -48
  51. package/dist/cli/{index-ap6hs8fj.js → index-v2rbpcqy.js} +2 -2
  52. package/dist/cli/{index-jrxrjz89.js → index-v8ja5zcr.js} +2 -2
  53. package/dist/cli/{index-54sd9bbn.js → index-w670pfv4.js} +5 -5
  54. package/dist/cli/{index-kkrbybgt.js → index-w6hrms7j.js} +2 -2
  55. package/dist/cli/{index-01r2wrwa.js → index-wjqc2mnc.js} +1 -1
  56. package/dist/cli/{index-w1ydvzef.js → index-wnkx6gs0.js} +1 -1
  57. package/dist/cli/{index-1msszzg2.js → index-wqg2j647.js} +7 -7
  58. package/dist/cli/{index-2t21pv2v.js → index-wzec3c4g.js} +13 -1
  59. package/dist/cli/{index-12fxtcce.js → index-ybrwvrd4.js} +41 -41
  60. package/dist/cli/{index-epq8am78.js → index-yv5fmjcf.js} +2 -2
  61. package/dist/cli/index.js +40 -40
  62. package/dist/cli/{knowledge-escalator-5q4y97e4.js → knowledge-escalator-gjp71cn2.js} +13 -13
  63. package/dist/cli/{knowledge-events-x7q8yepd.js → knowledge-events-d8k9fmkg.js} +11 -11
  64. package/dist/cli/{knowledge-link-655xa3db.js → knowledge-link-anzhs41w.js} +4 -4
  65. package/dist/cli/{knowledge-store-r7ng2nf8.js → knowledge-store-sqmwvcjd.js} +5 -5
  66. package/dist/cli/{knowledge-validator-e78m6cqe.js → knowledge-validator-gjqm2zby.js} +7 -7
  67. package/dist/cli/{mcp-208jwxps.js → mcp-phvvtsmt.js} +1 -1
  68. package/dist/cli/{model-preflight-xakn1356.js → model-preflight-ehqa8h7x.js} +39 -39
  69. package/dist/cli/{pending-delegations-w4a5tg11.js → pending-delegations-mxs88d0x.js} +11 -11
  70. package/dist/cli/{pr-subscriptions-8289esc9.js → pr-subscriptions-n3ymnt5w.js} +11 -11
  71. package/dist/cli/{pr-workflow-gate-b7yx0x21.js → pr-workflow-gate-t8axhfzw.js} +39 -39
  72. package/dist/cli/{runner-b5vt1any.js → runner-9kd080km.js} +5 -5
  73. package/dist/cli/{scan-cursor-edpbzp72.js → scan-cursor-qg4eg6ah.js} +6 -6
  74. package/dist/cli/{schema-dnsxhyr3.js → schema-73z5xbmd.js} +2 -2
  75. package/dist/cli/{scope-persistence-z1f7d4tw.js → scope-persistence-b9924hz1.js} +15 -15
  76. package/dist/cli/{server-t2edntv4.js → server-jn6xd5bh.js} +39 -39
  77. package/dist/cli/{skill-generator-5n7vf0s3.js → skill-generator-k344y5m2.js} +15 -15
  78. package/dist/cli/{snapshot-coordination-init-t14dk9je.js → snapshot-coordination-init-a8992336.js} +39 -39
  79. package/dist/cli/{speckit-checkoff-4ws84g13.js → speckit-checkoff-0tctprtz.js} +5 -5
  80. package/dist/cli/{telemetry-6k8t2mrw.js → telemetry-vqyy5nha.js} +1 -1
  81. package/dist/cli/{workspace-snapshot-hsssm50w.js → workspace-snapshot-7e9me3q7.js} +3 -3
  82. package/dist/cli/{worktree-collision-ownership-wj6337ec.js → worktree-collision-ownership-6r6jekr9.js} +12 -12
  83. package/dist/cli/{worktree-isolation-9fyj85tc.js → worktree-isolation-5kw6jnej.js} +39 -39
  84. package/dist/commands/registry.d.ts +1 -1
  85. package/dist/commands/report.d.ts +20 -4
  86. package/dist/hooks/guardrails/stage-a-route.d.ts +16 -0
  87. package/dist/hooks/issue-trace-reducer.d.ts +29 -6
  88. package/dist/hooks/issue-trace-state.d.ts +29 -0
  89. package/dist/hooks/issue-trace.d.ts +4 -1
  90. package/dist/index.js +410 -409
  91. package/dist/observability/catalog.d.ts +2 -2
  92. package/dist/observability/envelope.d.ts +4 -0
  93. package/dist/services/execution-attempt.d.ts +80 -0
  94. package/dist/services/task-cohort.d.ts +123 -0
  95. package/dist/telemetry.d.ts +1 -1
  96. package/dist/tools/index.d.ts +3 -0
  97. package/dist/tools/manifest.d.ts +3 -0
  98. package/dist/tools/record-branch-freshness.d.ts +17 -0
  99. package/dist/tools/record-merge-approval.d.ts +17 -0
  100. package/dist/tools/record-trace-validation.d.ts +18 -0
  101. package/dist/tools/tool-metadata.d.ts +12 -0
  102. package/package.json +1 -1
  103. package/dist/cli/curator-llm-factory-zwc2gpe7.js +0 -74
  104. package/dist/cli/guardrail-explain-a3hcrpwv.js +0 -75
@@ -21,69 +21,69 @@ import {
21
21
  sanitizeWorktreeTaskId,
22
22
  standardWorktreeByCallID,
23
23
  standardWorktreeSerializationSessions
24
- } from "./index-9eg8f4zm.js";
25
- import"./index-gtpq64q7.js";
24
+ } from "./index-c6zrffwn.js";
25
+ import"./index-fqc1a1vj.js";
26
26
  import"./index-hamqvzqn.js";
27
- import"./index-01r2wrwa.js";
28
- import"./index-y03jadcy.js";
29
- import"./index-dkprb20b.js";
30
- import"./index-0ea0c676.js";
31
- import"./index-sf51gh68.js";
27
+ import"./index-wjqc2mnc.js";
28
+ import"./index-a6np52p4.js";
29
+ import"./index-9gehw4xb.js";
30
+ import"./index-nmfnggaa.js";
31
+ import"./index-ht88g5mc.js";
32
32
  import"./index-txdagbh7.js";
33
- import"./index-rgfz80gt.js";
33
+ import"./index-mewsqwbq.js";
34
34
  import"./index-6b295cas.js";
35
- import"./index-x4am0jxt.js";
36
- import"./index-54sd9bbn.js";
37
- import"./index-1epynxc4.js";
35
+ import"./index-1ex9ecf5.js";
36
+ import"./index-w670pfv4.js";
37
+ import"./index-29f69hzd.js";
38
38
  import"./index-rdec0y3z.js";
39
- import"./index-nw3z614g.js";
39
+ import"./index-30pz2xvj.js";
40
40
  import"./index-cjapb4hy.js";
41
41
  import"./index-zsrtt42s.js";
42
- import"./index-r4vve32m.js";
43
- import"./index-jrxrjz89.js";
44
- import"./index-by9wfeja.js";
42
+ import"./index-pvtf7cjg.js";
43
+ import"./index-v8ja5zcr.js";
44
+ import"./index-1kpa3an2.js";
45
45
  import"./index-pt7h91zc.js";
46
46
  import"./index-q7sjgr1y.js";
47
- import"./index-epq8am78.js";
48
- import"./index-j97nc02q.js";
49
- import"./index-v4h99xhr.js";
50
- import"./index-1msszzg2.js";
51
- import"./index-hqa71xfm.js";
52
- import"./index-a2hvmc3a.js";
47
+ import"./index-yv5fmjcf.js";
48
+ import"./index-jf9cvkzr.js";
49
+ import"./index-4aggsva0.js";
50
+ import"./index-wqg2j647.js";
51
+ import"./index-6f7tfq3m.js";
52
+ import"./index-25m6rekr.js";
53
53
  import"./index-2s7dvzff.js";
54
- import"./index-4qpz7mpn.js";
55
- import"./index-s34y6gbh.js";
54
+ import"./index-94pwd45k.js";
55
+ import"./index-r7dqevkc.js";
56
56
  import"./index-rtry5xyf.js";
57
57
  import {
58
58
  resolveWorktreeIsolationConfig
59
- } from "./index-9s2rp2j5.js";
59
+ } from "./index-qws72zbs.js";
60
60
  import"./index-frcemc0b.js";
61
61
  import"./index-0725jpp7.js";
62
- import"./index-y28np6j9.js";
63
- import"./index-fsye9ygy.js";
64
- import"./index-427x3j6p.js";
65
- import"./index-ved1325w.js";
66
- import"./index-w1ydvzef.js";
67
- import"./index-vvgpgcyn.js";
62
+ import"./index-k88thqa0.js";
63
+ import"./index-kv0k3b60.js";
64
+ import"./index-rfggc332.js";
65
+ import"./index-820e6w22.js";
66
+ import"./index-wnkx6gs0.js";
67
+ import"./index-5cvm6ykc.js";
68
68
  import"./index-rdm3px0g.js";
69
69
  import"./index-ry16d01s.js";
70
- import"./index-kkrbybgt.js";
71
- import"./index-dwc1wztn.js";
70
+ import"./index-w6hrms7j.js";
71
+ import"./index-0n24h4zb.js";
72
72
  import"./index-vzm6zre7.js";
73
73
  import"./index-ae75rja9.js";
74
- import"./index-23mdeh2a.js";
75
- import"./index-ap6hs8fj.js";
76
- import"./index-mkpdcbye.js";
74
+ import"./index-3bcmw8pc.js";
75
+ import"./index-v2rbpcqy.js";
76
+ import"./index-tt705bap.js";
77
77
  import"./index-1xnse449.js";
78
78
  import"./index-c1ggtmpm.js";
79
79
  import"./index-ejhxgyvm.js";
80
80
  import"./index-7g4c7s5r.js";
81
- import"./index-989v83pb.js";
81
+ import"./index-s1y70y0w.js";
82
82
  import"./index-gx2vp8gx.js";
83
- import"./index-6jrn46zy.js";
83
+ import"./index-r65yxdv7.js";
84
84
  import"./index-zxdawwc7.js";
85
- import"./index-3ga3ts3h.js";
86
- import"./index-2t21pv2v.js";
85
+ import"./index-fb0v3e71.js";
86
+ import"./index-wzec3c4g.js";
87
87
  import"./index-bk5tah7q.js";
88
88
  import"./index-gknz3bv1.js";
89
89
  import"./index-zpsr8rpc.js";
@@ -549,7 +549,7 @@ export declare const COMMAND_REGISTRY: {
549
549
  readonly handler: (ctx: CommandContext) => Promise<string>;
550
550
  readonly description: "Report swarm observability events from the SQLite query authority [--task <id>] [--session <id>] [--trace <id>] [--run <batchId>] [--since <ISO-8601>] [--json]";
551
551
  readonly args: "--task <id>, --session <id>, --trace <id>, --run <batchId>, --since <ISO-8601>, --json";
552
- readonly details: "Bounded, deterministic query over the observability events store in .swarm/swarm.db (the first run performs a bounded, idempotent legacy-import into the local sink). --run filters the lane/dispatch batch axis (workflow.batchId). Unmatched delegation begins are disclosed, never fabricated into ends. --json emits a schemaVersion-tagged block.";
552
+ readonly details: "Bounded, deterministic query over the observability events store in .swarm/swarm.db (the first run performs a bounded, idempotent legacy-import into the local sink). --run filters the lane/dispatch batch axis (workflow.batchId). Unmatched delegation begins are disclosed, never fabricated into ends. Includes a Task attempts (cohort) section (issue #2676): execution-attempt records folded through a snapshot-qualified cohort with per-class counts, known/unavailable cost split, uncertainty, and an explicit causal-rate qualification line. --json emits a schemaVersion-tagged block (schema v2 adds the taskAttempts cohort field).";
553
553
  readonly category: "diagnostics";
554
554
  readonly toolPolicy: "agent";
555
555
  };
@@ -2,7 +2,7 @@
2
2
  * `/swarm report` — bounded, deterministic observability report over the
3
3
  * SQLite-native query authority (issue #2482 / D3, absorbing #2048).
4
4
  *
5
- * - Read-only. Queries `.swarm/swarm.db` `observability_event` via the
5
+ * - Read-only over the stores it queries: queries `.swarm/swarm.db` `observability_event` via the
6
6
  * bounded store queries (`src/db/observability-event-store.ts`); lazily
7
7
  * syncs the rebuildable legacy import (`syncObservabilityImport`) FIRST so
8
8
  * the report covers the bounded `telemetry.jsonl(.1)` window too.
@@ -13,17 +13,33 @@
13
13
  * `--json` emits a versioned JSON block. Each value flag may appear at
14
14
  * most once with a non-empty value; any subset is valid.
15
15
  * - Bounded: row cap + truncated flag (`MAX_REPORT_ROWS`), ordering is
16
- * `occurred_at, rowid` (code-unit string compare — no locale collation),
17
- * so the same query window yields byte-identical output (proven by test).
16
+ * `occurred_at, rowid` (code-unit string compare — no locale collation).
17
+ * Determinism: the markdown report is byte-identical for the same query
18
+ * window (proven by test); the `--json` block additionally carries the
19
+ * cohort snapshot's wall-clock `capturedAt`, which the determinism test
20
+ * normalizes.
18
21
  * - Honest coverage: live vs imported row counts, quarantined rows (excluded
19
22
  * from the timeline), the sink's own health counters, and the delegation
20
23
  * begin/end pairing delta — unmatched begins are DISCLOSED, never
21
24
  * fabricated into ends.
25
+ * - Task-attempts cohort (issue #2676): `execution_attempt_recorded` rows are
26
+ * folded through a SNAPSHOT (denominator cannot drift with the live
27
+ * stores) with per-class counts, known/unavailable cost split, uncertainty,
28
+ * and an explicit causal-rate qualification line. The report stays
29
+ * read-only over the observability stores it queries; the snapshot
30
+ * persists its own provenance manifest under
31
+ * `.swarm/observability/cohorts/` (the report's evidentiary boundary).
22
32
  * - Fail-open: a missing/unopenable store yields an explicit empty report
23
33
  * with `coverage.unavailable`, never an error.
24
34
  */
25
35
  import { type ObservabilityEventFilter } from '../db/observability-event-store.js';
26
- export declare const REPORT_JSON_SCHEMA_VERSION = 1;
36
+ /**
37
+ * v2 (issue #2676): additive `taskAttempts` cohort section — per-class counts,
38
+ * known/unavailable cost split, uncertainty, and the qualification line, built
39
+ * from a population snapshot whose denominator cannot drift with the live
40
+ * stores.
41
+ */
42
+ export declare const REPORT_JSON_SCHEMA_VERSION = 2;
27
43
  interface ParsedReportArgs {
28
44
  filter: ObservabilityEventFilter;
29
45
  json: boolean;
@@ -1,4 +1,5 @@
1
1
  import { appendCoreEventSync } from '../../events/core-events.js';
2
+ import { type ExecutionAttemptClass } from '../../services/execution-attempt.js';
2
3
  /**
3
4
  * Stage A attribution route events (issue #2664).
4
5
  *
@@ -27,8 +28,23 @@ export interface StageAGateRouteEventInput {
27
28
  /** Attributed task, or null when no single task is attributable. */
28
29
  taskId: string | null;
29
30
  guardrailsEnabled: boolean;
31
+ /**
32
+ * The correlation's workflow generation cursor, when the caller holds one
33
+ * (the guardrails pending-gate-task map carries it). Required for the
34
+ * `late` attempt class to be recordable; absent leaves the recorder's
35
+ * fail-open refusal in force.
36
+ */
37
+ generation?: number;
30
38
  }
31
39
  declare function buildEvent(input: StageAGateRouteEventInput): Record<string, unknown>;
40
+ /**
41
+ * Route → execution-attempt class (issue #2676). Stage A route events fire at
42
+ * gate-tool-call COMPLETION (toolAfter), so `valid_pass` is the completed
43
+ * call's outcome record (`result`, success); the four refusal routes are
44
+ * `denial` (outcome unknown — the gate refused before a task outcome
45
+ * existed); `late_result` is `late`; `duplicate_result` is `duplicate`.
46
+ */
47
+ export declare function stageARouteAttemptClass(route: StageAGateRoute): ExecutionAttemptClass;
32
48
  /**
33
49
  * Record one Stage A route event. Fail-open for the hook: append failures
34
50
  * (typed CORE_EVENT_LOCKED / CORE_EVENT_LINE_TOO_LARGE) are logged warn-only
@@ -37,9 +37,14 @@ export interface IssueReference {
37
37
  * - `publication_handoff`: all phases complete; the engine has emitted the
38
38
  * commit-pr directive and stopped driving. This is NOT "issue resolved" —
39
39
  * publication is owned by commit-pr and has not yet been confirmed.
40
- * - `published`: a verifiable publication receipt was observed. Terminal.
40
+ * - `published`: a verifiable publication receipt was observed.
41
+ * - `merge_approval_recorded`: a PR-head-bound merge-approval receipt was
42
+ * observed after publication (issue #2564). TERMINAL. The plugin RECORDS the
43
+ * human approval for audit; it never certifies, drives, or green-lights the
44
+ * merge itself — the merge is human-enforced (mirrors trace-check.sh's
45
+ * merge gate posture).
41
46
  */
42
- export type TraceStatus = 'in_progress' | 'publication_handoff' | 'published';
47
+ export type TraceStatus = 'in_progress' | 'publication_handoff' | 'published' | 'merge_approval_recorded';
43
48
  export interface TraceState {
44
49
  issueNumber: number;
45
50
  lastTransition: string | null;
@@ -53,12 +58,26 @@ export interface WorkflowArtifacts {
53
58
  allPhasesComplete: boolean;
54
59
  /** Reproduction evidence OR a typed waiver is present (issue #2131 2.6). */
55
60
  reproductionPermitted: boolean;
61
+ /**
62
+ * Phase 0 branch-freshness receipt permits the trace: `synced`, or a
63
+ * fail-closed fetch failure carrying a recorded user override (issue #2564,
64
+ * mirroring trace-check.sh phase0). A `behind` result never permits.
65
+ */
66
+ freshnessPermitted: boolean;
56
67
  /** A verifiable publication receipt has been observed (issue #2131 2.4). */
57
68
  publicationObserved: boolean;
58
69
  /** A valid recurrence-sweep receipt exists (issue #2131 residual B). */
59
70
  recurrenceSweepVerified: boolean;
60
71
  /** Fresh reviewer + critic APPROVE verdicts recorded (issue #2131 residual B). */
61
72
  implementationReviewVerified: boolean;
73
+ /**
74
+ * Every recorded per-phase `trace-check.sh` validation for this issue is a
75
+ * pass bound to a 40-hex reviewed-commit + tree-id (issue #2564). A fail
76
+ * entry fails closed until that phase is re-recorded as a pass.
77
+ */
78
+ traceValidationVerified: boolean;
79
+ /** A PR-head-bound merge-approval receipt has been observed (issue #2564). */
80
+ mergeApprovalObserved: boolean;
62
81
  }
63
82
  export interface TransitionResult {
64
83
  nextMode: string | null;
@@ -77,18 +96,22 @@ export interface ComputeNextModeParams {
77
96
  *
78
97
  * Decision table (top-to-bottom, first match wins):
79
98
  * (a) No issue reference or trace not requested → no-op
80
- * (b) Trace already published (terminal) → no-op
99
+ * (b) merge_approval_recorded (truly terminal) → no-op
100
+ * (b') published + merge-approval receipt observed → merge_approval_recorded (RECORDED, never certified)
81
101
  * (c) publication_handoff: observe publication → PUBLISHED; else no-op
82
102
  * (d) Cross-issue guard (spec issue ≠ current issue) → no-op
83
103
  * (e) Spec does not exist → no-op
84
- * (f) Spec exists, no plan, reproduction permitted,
104
+ * (f-0) Spec exists, no plan, branch-freshness NOT
105
+ * permitted → one-shot FRESHNESS_GATE directive
106
+ * (f) Spec exists, no plan, freshness permitted, reproduction permitted,
85
107
  * never transitioned (or re-entrant idempotency) → PLAN
86
- * (f-block) Spec exists, no plan, reproduction NOT permitted → no-op
108
+ * (f-block) Spec exists, no plan, reproduction NOT permitted → one-shot REPRO_GATE directive
87
109
  * (g) Plan exists but critic not approved → no-op
88
110
  * (h) Critic approved, phases incomplete, not yet PLAN_TO_EXECUTE → EXECUTE
89
111
  * (i-pre1) Phases complete, impl-review receipt missing → one-shot REVIEW_GATE directive
90
112
  * (i-pre2) Impl-review ok, recurrence-sweep receipt missing → one-shot RECURRENCE_GATE directive
91
- * (i) All phases complete + both gates verified, not yet EXECUTE_TO_COMMITpublication_handoff + COMMIT directive
113
+ * (i-pre3) Both ok, trace-validation receipts missing/failingone-shot TRACE_VALIDATION_GATE directive
114
+ * (i) All phases complete + all gates verified, not yet EXECUTE_TO_COMMIT → publication_handoff + COMMIT directive
92
115
  *
93
116
  * Idempotency: rows (f), (h), (i) return no-op when
94
117
  * `traceState.lastTransition` already equals the target transition value.
@@ -19,6 +19,9 @@ declare function _defaultReproductionReceiptExists(directory: string, issueNumbe
19
19
  declare function _defaultPublicationReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
20
20
  declare function _defaultRecurrenceSweepReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
21
21
  declare function _defaultImplementationReviewReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
22
+ declare function _defaultBranchFreshnessReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
23
+ declare function _defaultTraceValidationReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
24
+ declare function _defaultMergeApprovalReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
22
25
  export declare const _internals: {
23
26
  readFileSync: typeof readFileSync;
24
27
  writeFileSync: typeof writeFileSync;
@@ -31,6 +34,9 @@ export declare const _internals: {
31
34
  publicationReceiptExists: typeof _defaultPublicationReceiptExists;
32
35
  recurrenceSweepReceiptExists: typeof _defaultRecurrenceSweepReceiptExists;
33
36
  implementationReviewReceiptExists: typeof _defaultImplementationReviewReceiptExists;
37
+ branchFreshnessReceiptExists: typeof _defaultBranchFreshnessReceiptExists;
38
+ traceValidationReceiptExists: typeof _defaultTraceValidationReceiptExists;
39
+ mergeApprovalReceiptExists: typeof _defaultMergeApprovalReceiptExists;
34
40
  };
35
41
  /**
36
42
  * Reads `.swarm/issue-reference.json` and returns the parsed object,
@@ -108,4 +114,27 @@ export declare function recurrenceSweepReceiptExists(directory: string, issueNum
108
114
  * contexts both recorded APPROVE verdicts for the implementation diff.
109
115
  */
110
116
  export declare function implementationReviewReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
117
+ /**
118
+ * Returns whether a Phase 0 branch-freshness receipt permits the trace for the
119
+ * given issue (issue #2564, mirroring trace-check.sh phase0): `synced` permits;
120
+ * `behind:<n>` never permits; `fetch-failed:<reason>` permits only with a
121
+ * recorded non-empty user override.
122
+ */
123
+ export declare function branchFreshnessReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
124
+ /**
125
+ * Returns whether the per-phase trace-check.sh validator receipts for the given
126
+ * issue are green (issue #2564): at least one recorded validation exists and
127
+ * every entry (one per phase, upserted by the writer) is a `pass` bound to a
128
+ * 40-hex reviewedCommit + treeId. Any `fail` entry fails closed until that
129
+ * phase is re-recorded as a pass.
130
+ */
131
+ export declare function traceValidationReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
132
+ /**
133
+ * Returns whether a PR-head-bound merge-approval receipt exists for the given
134
+ * issue (issue #2564): both SHAs are 40-hex and prHeadSha equals
135
+ * finalCriticReviewedCommit, mirroring trace-check.sh merge_check's binding.
136
+ * Presence-and-binding only — the approval itself is human-enforced and is
137
+ * never certified by the plugin.
138
+ */
139
+ export declare function mergeApprovalReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
111
140
  export {};
@@ -18,7 +18,7 @@
18
18
  import { getPlanLedgerStateReadOnly } from '../plan/ledger-sqlite';
19
19
  import { error as _logErrorImpl } from '../utils/logger.js';
20
20
  import { isPlanCriticApproved } from './delegation-gate';
21
- import { implementationReviewReceiptExists, publicationReceiptExists, readIssueReference, readPlanPhaseStatus, readSpecIssueNumber, readTraceState, recurrenceSweepReceiptExists, reproductionReceiptExists, specExists, writeTraceState } from './issue-trace-state';
21
+ import { branchFreshnessReceiptExists, implementationReviewReceiptExists, mergeApprovalReceiptExists, publicationReceiptExists, readIssueReference, readPlanPhaseStatus, readSpecIssueNumber, readTraceState, recurrenceSweepReceiptExists, reproductionReceiptExists, specExists, traceValidationReceiptExists, writeTraceState } from './issue-trace-state';
22
22
  export declare const _internals: {
23
23
  readIssueReference: typeof readIssueReference;
24
24
  readTraceState: typeof readTraceState;
@@ -30,6 +30,9 @@ export declare const _internals: {
30
30
  publicationReceiptExists: typeof publicationReceiptExists;
31
31
  recurrenceSweepReceiptExists: typeof recurrenceSweepReceiptExists;
32
32
  implementationReviewReceiptExists: typeof implementationReviewReceiptExists;
33
+ branchFreshnessReceiptExists: typeof branchFreshnessReceiptExists;
34
+ traceValidationReceiptExists: typeof traceValidationReceiptExists;
35
+ mergeApprovalReceiptExists: typeof mergeApprovalReceiptExists;
33
36
  isPlanCriticApproved: typeof isPlanCriticApproved;
34
37
  getPlanLedgerState: typeof getPlanLedgerStateReadOnly;
35
38
  logError: typeof _logErrorImpl;