opencode-swarm 7.140.0 → 7.140.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/.opencode/skills/commit-pr/SKILL.md +7 -0
  2. package/.opencode/skills/issue-ingest/SKILL.md +32 -1
  3. package/.opencode/skills/swarm-pr-feedback/SKILL.md +2 -2
  4. package/.opencode/skills/swarm-pr-review/SKILL.md +14 -3
  5. package/dist/cli/{config-doctor-3bm8pvnb.js → config-doctor-0b5z13vq.js} +3 -3
  6. package/dist/cli/{core-jtj9j6z5.js → core-m5y25n0j.js} +2 -2
  7. package/dist/cli/{curation-policy-zkvkg4np.js → curation-policy-bn7g8n40.js} +2 -2
  8. package/dist/cli/{curator-78ejknh2.js → curator-b7f6nt8h.js} +14 -14
  9. package/dist/cli/{curator-llm-factory-kbqtk2wm.js → curator-llm-factory-0mkbw2hg.js} +14 -14
  10. package/dist/cli/{guardrail-explain-d6emse0z.js → guardrail-explain-p2htdqkz.js} +15 -15
  11. package/dist/cli/{guardrail-log-27d6r2xq.js → guardrail-log-rqt9wrzw.js} +4 -4
  12. package/dist/cli/{hive-promoter-r5x4a2ta.js → hive-promoter-61sjdrgt.js} +14 -14
  13. package/dist/cli/{index-43k8ntw7.js → index-0an7an2s.js} +2 -2
  14. package/dist/cli/{index-6d7jkk1s.js → index-6fwr2w8v.js} +2 -2
  15. package/dist/cli/{index-mb34t6w9.js → index-7f72x6nv.js} +71 -53
  16. package/dist/cli/{index-bdnrrx3w.js → index-7nhrn9sy.js} +1 -1
  17. package/dist/cli/{index-6ykm2eha.js → index-a98msw3z.js} +1 -1
  18. package/dist/cli/{index-0jbhmm8b.js → index-acc18zrj.js} +2 -2
  19. package/dist/cli/{index-s38e38qy.js → index-dbg3agxz.js} +4 -4
  20. package/dist/cli/{index-6yv6wda9.js → index-dn3nkwbc.js} +1 -1
  21. package/dist/cli/{index-scbp2d32.js → index-ff7b0cr5.js} +16 -16
  22. package/dist/cli/{index-chycpf9y.js → index-hgrzjhsf.js} +3 -3
  23. package/dist/cli/{index-ma8vk3v1.js → index-hnprx6qv.js} +2 -2
  24. package/dist/cli/{index-0pqh1710.js → index-jq7n7w9y.js} +2 -2
  25. package/dist/cli/{index-zebb6yw0.js → index-m9csth1h.js} +2 -2
  26. package/dist/cli/{index-fxw0zvxc.js → index-r7tg8kjh.js} +5 -5
  27. package/dist/cli/{index-r4t92q32.js → index-v1d4qz8y.js} +8 -0
  28. package/dist/cli/{index-hbnsmnb0.js → index-vw75bhf3.js} +1 -1
  29. package/dist/cli/{index-p6h8f59v.js → index-wysn7pcz.js} +1 -1
  30. package/dist/cli/{index-f8dhh53t.js → index-yf6p4wc5.js} +3 -3
  31. package/dist/cli/index.js +14 -14
  32. package/dist/cli/{knowledge-escalator-qjdfv9sj.js → knowledge-escalator-twwz5a0d.js} +3 -3
  33. package/dist/cli/{knowledge-events-7szzg70x.js → knowledge-events-hgaz06m8.js} +1 -1
  34. package/dist/cli/{knowledge-store-9mr7a9n8.js → knowledge-store-46jrzgvm.js} +1 -1
  35. package/dist/cli/{knowledge-validator-58s2j0dp.js → knowledge-validator-7vnqwjtv.js} +4 -4
  36. package/dist/cli/{scan-cursor-h3j1egky.js → scan-cursor-acsjpv2n.js} +2 -2
  37. package/dist/cli/{schema-9ryqandr.js → schema-4dy7emnw.js} +2 -2
  38. package/dist/cli/{skill-generator-66ez26yh.js → skill-generator-a48t83hf.js} +5 -5
  39. package/dist/hooks/issue-trace-reducer.d.ts +37 -13
  40. package/dist/hooks/issue-trace-state.d.ts +38 -9
  41. package/dist/hooks/issue-trace.d.ts +15 -2
  42. package/dist/hooks/pr-workflow-gate.d.ts +9 -1
  43. package/dist/index.js +47 -42
  44. package/dist/tools/index.d.ts +2 -0
  45. package/dist/tools/manifest.d.ts +2 -0
  46. package/dist/tools/record-issue-publication.d.ts +16 -0
  47. package/dist/tools/record-issue-reproduction.d.ts +22 -0
  48. package/dist/tools/tool-metadata.d.ts +8 -0
  49. package/package.json +1 -1
@@ -6,13 +6,13 @@ import {
6
6
  resolveSwarmKnowledgePath,
7
7
  transactKnowledge,
8
8
  wordBigrams
9
- } from "./index-s38e38qy.js";
9
+ } from "./index-dbg3agxz.js";
10
10
  import {
11
11
  countEntryContradictionsInWindow,
12
12
  countEntryViolationsInWindow,
13
13
  readKnowledgeEvents,
14
14
  recordKnowledgeEvent
15
- } from "./index-p6h8f59v.js";
15
+ } from "./index-wysn7pcz.js";
16
16
  import {
17
17
  init_knowledge_types,
18
18
  isActiveStatus
@@ -190,11 +190,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
190
190
  alreadyInactive: true
191
191
  };
192
192
  }
193
- const { quarantineEntry } = await import("./knowledge-validator-58s2j0dp.js");
193
+ const { quarantineEntry } = await import("./knowledge-validator-7vnqwjtv.js");
194
194
  let policyConfig;
195
195
  try {
196
- const { KnowledgeConfigSchema } = await import("./schema-9ryqandr.js");
197
- const { loadPluginConfigWithMeta } = await import("./index-chycpf9y.js");
196
+ const { KnowledgeConfigSchema } = await import("./schema-4dy7emnw.js");
197
+ const { loadPluginConfigWithMeta } = await import("./index-hgrzjhsf.js");
198
198
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
199
199
  policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
200
200
  } catch {
@@ -246,6 +246,14 @@ var init_tool_metadata = __esm(() => {
246
246
  description: "preserve explicit dirty tracked files before an unbound PR workflow checkout with an auditable recovery receipt",
247
247
  agents: ["architect"]
248
248
  },
249
+ record_issue_publication: {
250
+ description: "record a publication receipt so the /swarm issue --trace workflow reaches its terminal published state after the PR is created/updated",
251
+ agents: ["architect"]
252
+ },
253
+ record_issue_reproduction: {
254
+ description: "record the reproduction outcome for the current traced issue so the /swarm issue --trace workflow can satisfy its reproduction gate and transition to PLAN",
255
+ agents: ["architect"]
256
+ },
249
257
  run_pr_feedback_stage_a: {
250
258
  description: "execute and persist mandatory PR-feedback Stage A checks on a content-bound revision",
251
259
  agents: ["architect"]
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  SWARM_WORKTREE_DIR_NAME,
14
14
  init_constants
15
- } from "./index-r4t92q32.js";
15
+ } from "./index-v1d4qz8y.js";
16
16
  import {
17
17
  __require
18
18
  } from "./index-a76rekgs.js";
@@ -628,7 +628,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
628
628
  deltas.push({ id, delta });
629
629
  }
630
630
  if (deltas.length > 0) {
631
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-9mr7a9n8.js");
631
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-46jrzgvm.js");
632
632
  await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
633
633
  }
634
634
  return {
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  ALLOWED_SKILL_PATH_PREFIXES,
4
4
  validateSkillPath
5
- } from "./index-ma8vk3v1.js";
5
+ } from "./index-hnprx6qv.js";
6
6
  import {
7
7
  computeOutcomeSignal,
8
8
  readKnowledge,
9
9
  resolveHiveKnowledgePath,
10
10
  resolveSwarmKnowledgePath,
11
11
  transactKnowledge
12
- } from "./index-s38e38qy.js";
12
+ } from "./index-dbg3agxz.js";
13
13
  import {
14
14
  effectiveRetrievalOutcomes,
15
15
  readKnowledgeCounterRollups
16
- } from "./index-p6h8f59v.js";
16
+ } from "./index-wysn7pcz.js";
17
17
  import {
18
18
  advisoryWarn,
19
19
  init_warning_buffer
package/dist/cli/index.js CHANGED
@@ -6,19 +6,19 @@ import {
6
6
  getPluginConfigDir,
7
7
  getPluginLockFilePaths,
8
8
  resolveCommand
9
- } from "./index-mb34t6w9.js";
9
+ } from "./index-7f72x6nv.js";
10
10
  import"./index-41hkt36g.js";
11
11
  import"./index-1m1ksyqt.js";
12
- import"./index-zebb6yw0.js";
13
- import"./index-0jbhmm8b.js";
12
+ import"./index-m9csth1h.js";
13
+ import"./index-acc18zrj.js";
14
14
  import"./index-brh827g0.js";
15
15
  import"./index-yyyk63kk.js";
16
16
  import"./index-y8552snf.js";
17
17
  import"./index-4905hd2m.js";
18
18
  import"./index-134d35c1.js";
19
- import"./index-f8dhh53t.js";
20
- import"./index-fxw0zvxc.js";
21
- import"./index-bdnrrx3w.js";
19
+ import"./index-yf6p4wc5.js";
20
+ import"./index-r7tg8kjh.js";
21
+ import"./index-7nhrn9sy.js";
22
22
  import"./index-v2xrer41.js";
23
23
  import"./index-c8s9a3zh.js";
24
24
  import"./index-9ss2m4rs.js";
@@ -28,7 +28,7 @@ import"./index-556ja8an.js";
28
28
  import"./index-kbfsp07d.js";
29
29
  import"./index-1kyex7z2.js";
30
30
  import"./index-b8zgtz81.js";
31
- import"./index-hbnsmnb0.js";
31
+ import"./index-vw75bhf3.js";
32
32
  import"./index-b9rd29ge.js";
33
33
  import"./index-k46me75h.js";
34
34
  import"./index-ee3x66a5.js";
@@ -36,11 +36,11 @@ import"./index-74hpm6sh.js";
36
36
  import"./index-n0pja0qs.js";
37
37
  import"./index-8fwhhayc.js";
38
38
  import"./index-q1exe2b3.js";
39
- import"./index-ma8vk3v1.js";
40
- import"./index-6ykm2eha.js";
39
+ import"./index-hnprx6qv.js";
40
+ import"./index-a98msw3z.js";
41
41
  import"./index-rtry5xyf.js";
42
- import"./index-s38e38qy.js";
43
- import"./index-p6h8f59v.js";
42
+ import"./index-dbg3agxz.js";
43
+ import"./index-wysn7pcz.js";
44
44
  import"./index-ae75rja9.js";
45
45
  import"./index-rs1f1bh0.js";
46
46
  import"./index-h2waehqq.js";
@@ -48,7 +48,7 @@ import"./index-ed5ykebp.js";
48
48
  import"./index-hfvxhk4z.js";
49
49
  import"./index-7g4c7s5r.js";
50
50
  import"./index-4nt52yr9.js";
51
- import"./index-43k8ntw7.js";
51
+ import"./index-0an7an2s.js";
52
52
  import"./index-gprxjmm7.js";
53
53
  import"./index-n832052r.js";
54
54
  import"./index-d181x9zr.js";
@@ -57,11 +57,11 @@ import"./index-zgwm4ryv.js";
57
57
  import {
58
58
  init_package,
59
59
  package_default
60
- } from "./index-0pqh1710.js";
60
+ } from "./index-jq7n7w9y.js";
61
61
  import {
62
62
  DEFAULT_AGENT_CONFIGS,
63
63
  init_constants
64
- } from "./index-r4t92q32.js";
64
+ } from "./index-v1d4qz8y.js";
65
65
  import"./index-zjygnfay.js";
66
66
  import"./index-bk5tah7q.js";
67
67
  import"./index-ry0hgg3m.js";
@@ -8,9 +8,9 @@ import {
8
8
  maybeEscalateOnViolation,
9
9
  maybeQuarantineOnContradiction,
10
10
  readRecentEscalations
11
- } from "./index-fxw0zvxc.js";
12
- import"./index-s38e38qy.js";
13
- import"./index-p6h8f59v.js";
11
+ } from "./index-r7tg8kjh.js";
12
+ import"./index-dbg3agxz.js";
13
+ import"./index-wysn7pcz.js";
14
14
  import"./index-ae75rja9.js";
15
15
  import"./index-rs1f1bh0.js";
16
16
  import"./index-h2waehqq.js";
@@ -28,7 +28,7 @@ import {
28
28
  resolveKnowledgeCounterBaselinePath,
29
29
  resolveKnowledgeEventsPath,
30
30
  resolveLegacyApplicationLogPath
31
- } from "./index-p6h8f59v.js";
31
+ } from "./index-wysn7pcz.js";
32
32
  import"./index-ae75rja9.js";
33
33
  import"./index-rs1f1bh0.js";
34
34
  import"./index-h2waehqq.js";
@@ -41,7 +41,7 @@ import {
41
41
  transactKnowledge,
42
42
  transactKnowledgeWithCas,
43
43
  wordBigrams
44
- } from "./index-s38e38qy.js";
44
+ } from "./index-dbg3agxz.js";
45
45
  import {
46
46
  resolveHiveDataDir
47
47
  } from "./index-ae75rja9.js";
@@ -23,11 +23,11 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-ma8vk3v1.js";
27
- import"./index-6ykm2eha.js";
26
+ } from "./index-hnprx6qv.js";
27
+ import"./index-a98msw3z.js";
28
28
  import"./index-rtry5xyf.js";
29
- import"./index-s38e38qy.js";
30
- import"./index-p6h8f59v.js";
29
+ import"./index-dbg3agxz.js";
30
+ import"./index-wysn7pcz.js";
31
31
  import"./index-ae75rja9.js";
32
32
  import"./index-rs1f1bh0.js";
33
33
  import"./index-h2waehqq.js";
@@ -4,8 +4,8 @@ import {
4
4
  alreadyCuratedThisGeneration,
5
5
  claimNextScanBatch,
6
6
  getScanStatus
7
- } from "./index-bdnrrx3w.js";
8
- import"./index-s38e38qy.js";
7
+ } from "./index-7nhrn9sy.js";
8
+ import"./index-dbg3agxz.js";
9
9
  import"./index-ae75rja9.js";
10
10
  import"./index-rs1f1bh0.js";
11
11
  import"./index-h2waehqq.js";
@@ -96,8 +96,8 @@ import {
96
96
  resolveGeneratedAgentRole,
97
97
  resolveGuardrailsConfig,
98
98
  stripKnownSwarmPrefix
99
- } from "./index-0pqh1710.js";
100
- import"./index-r4t92q32.js";
99
+ } from "./index-jq7n7w9y.js";
100
+ import"./index-v1d4qz8y.js";
101
101
  import"./index-zjygnfay.js";
102
102
  import"./index-bk5tah7q.js";
103
103
  import"./index-bpmtbmy9.js";
@@ -33,12 +33,12 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-f8dhh53t.js";
37
- import"./index-ma8vk3v1.js";
38
- import"./index-6ykm2eha.js";
36
+ } from "./index-yf6p4wc5.js";
37
+ import"./index-hnprx6qv.js";
38
+ import"./index-a98msw3z.js";
39
39
  import"./index-rtry5xyf.js";
40
- import"./index-s38e38qy.js";
41
- import"./index-p6h8f59v.js";
40
+ import"./index-dbg3agxz.js";
41
+ import"./index-wysn7pcz.js";
42
42
  import"./index-ae75rja9.js";
43
43
  import"./index-rs1f1bh0.js";
44
44
  import"./index-h2waehqq.js";
@@ -3,7 +3,15 @@
3
3
  *
4
4
  * Determines the next mode transition for an issue-trace workflow
5
5
  * based on current trace state and workflow artifacts. Evaluated
6
- * top-to-bottom (first-match-wins) against an 8-row decision table.
6
+ * top-to-bottom (first-match-wins) against the decision table below.
7
+ *
8
+ * Issue #2131 finding 2: the reducer no longer conflates "the engine
9
+ * handed off to commit-pr" with "the issue is resolved." Trace state is a
10
+ * typed `status` (`in_progress` → `publication_handoff` → `published`), and
11
+ * the commit-pr handoff sets `publication_handoff` (NOT a terminal
12
+ * "completed"). `published` is reachable only after a verifiable publication
13
+ * receipt is observed. A reproduction gate (evidence OR a typed waiver) must
14
+ * be satisfied before the PLAN transition fires.
7
15
  */
8
16
  export interface IssueReference {
9
17
  url: string;
@@ -22,10 +30,20 @@ export interface IssueReference {
22
30
  timestamp: string;
23
31
  };
24
32
  }
33
+ /**
34
+ * Trace lifecycle status. Replaces the boolean `completed` (issue #2131
35
+ * finding 2.4):
36
+ * - `in_progress`: the engine is driving PLAN → CRITIC-GATE → EXECUTE.
37
+ * - `publication_handoff`: all phases complete; the engine has emitted the
38
+ * commit-pr directive and stopped driving. This is NOT "issue resolved" —
39
+ * publication is owned by commit-pr and has not yet been confirmed.
40
+ * - `published`: a verifiable publication receipt was observed. Terminal.
41
+ */
42
+ export type TraceStatus = 'in_progress' | 'publication_handoff' | 'published';
25
43
  export interface TraceState {
26
44
  issueNumber: number;
27
45
  lastTransition: string | null;
28
- completed: boolean;
46
+ status: TraceStatus;
29
47
  }
30
48
  export interface WorkflowArtifacts {
31
49
  specExists: boolean;
@@ -33,12 +51,16 @@ export interface WorkflowArtifacts {
33
51
  planExists: boolean;
34
52
  criticApproved: boolean;
35
53
  allPhasesComplete: boolean;
54
+ /** Reproduction evidence OR a typed waiver is present (issue #2131 2.6). */
55
+ reproductionPermitted: boolean;
56
+ /** A verifiable publication receipt has been observed (issue #2131 2.4). */
57
+ publicationObserved: boolean;
36
58
  }
37
59
  export interface TransitionResult {
38
60
  nextMode: string | null;
39
61
  directive: string | null;
40
62
  nextLastTransition: string | null;
41
- nextCompleted: boolean;
63
+ nextStatus: TraceStatus;
42
64
  }
43
65
  export interface ComputeNextModeParams {
44
66
  issueReference: IssueReference | null;
@@ -51,16 +73,18 @@ export interface ComputeNextModeParams {
51
73
  *
52
74
  * Decision table (top-to-bottom, first match wins):
53
75
  * (a) No issue reference or trace not requested → no-op
54
- * (b) Trace already completed → no-op
55
- * (c) Cross-issue guard (spec issue current issue) → no-op
56
- * (d) Spec does not exist → no-op
57
- * (e) Spec exists, no plan, never transitioned PLAN
58
- * (f) Plan exists but critic not approved → no-op
59
- * (g) Critic approved, phases incomplete, not yet PLAN_TO_EXECUTE EXECUTE
60
- * (h) All phases complete, not yet EXECUTE_TO_COMMIT COMMIT directive
76
+ * (b) Trace already published (terminal) → no-op
77
+ * (c) publication_handoff: observe publication PUBLISHED; else no-op
78
+ * (d) Cross-issue guard (spec issue ≠ current issue) → no-op
79
+ * (e) Spec does not exist no-op
80
+ * (f) Spec exists, no plan, reproduction permitted,
81
+ * never transitioned (or re-entrant idempotency) PLAN
82
+ * (f-block) Spec exists, no plan, reproduction NOT permitted no-op
83
+ * (g) Plan exists but critic not approved → no-op
84
+ * (h) Critic approved, phases incomplete, not yet PLAN_TO_EXECUTE → EXECUTE
85
+ * (i) All phases complete, not yet EXECUTE_TO_COMMIT → publication_handoff + COMMIT directive
61
86
  *
62
- * Idempotency: rows (e), (g), (h) return no-op when
63
- * `traceState.lastTransition` already equals the target
64
- * transition value.
87
+ * Idempotency: rows (f), (h), (i) return no-op when
88
+ * `traceState.lastTransition` already equals the target transition value.
65
89
  */
66
90
  export declare function computeNextMode(params: ComputeNextModeParams): TransitionResult;
@@ -4,11 +4,19 @@
4
4
  *
5
5
  * Uses the `_internals` DI seam pattern (AGENTS.md invariant 7) so
6
6
  * tests can override filesystem calls without `mock.module` leakage.
7
+ *
8
+ * Issue #2131 finding 2.3: plan state is read through the AUTHORITATIVE
9
+ * ledger-aware `loadPlan` (never `loadPlanJsonOnly`, never projection
10
+ * existence). Finding 2.4: trace state is a typed `status`, with
11
+ * backward-compatible reading of legacy `completed: boolean` records.
12
+ * Findings 2.6 / 2.4(published): reproduction + publication receipt readers.
7
13
  */
8
14
  import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
9
15
  import type { Plan } from '../config/plan-schema';
10
16
  import type { IssueReference, TraceState } from './issue-trace-reducer';
11
17
  declare function _defaultLoadPlanFromLedger(directory: string): Promise<Plan | null>;
18
+ declare function _defaultReproductionReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
19
+ declare function _defaultPublicationReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
12
20
  export declare const _internals: {
13
21
  readFileSync: typeof readFileSync;
14
22
  writeFileSync: typeof writeFileSync;
@@ -17,6 +25,8 @@ export declare const _internals: {
17
25
  mkdirSync: typeof mkdirSync;
18
26
  unlinkSync: typeof unlinkSync;
19
27
  loadPlanFromLedger: typeof _defaultLoadPlanFromLedger;
28
+ reproductionReceiptExists: typeof _defaultReproductionReceiptExists;
29
+ publicationReceiptExists: typeof _defaultPublicationReceiptExists;
20
30
  };
21
31
  /**
22
32
  * Reads `.swarm/issue-reference.json` and returns the parsed object,
@@ -24,9 +34,10 @@ export declare const _internals: {
24
34
  */
25
35
  export declare function readIssueReference(directory: string): IssueReference | null;
26
36
  /**
27
- * Reads `.swarm/issue-trace-state.json` and returns the parsed state,
28
- * or a default `{issueNumber:0, lastTransition:null, completed:false}`
29
- * if the file is absent or malformed.
37
+ * Reads `.swarm/issue-trace-state.json` and returns the parsed state
38
+ * (new `status` or legacy `completed`, normalized), or a default
39
+ * `{issueNumber:0, lastTransition:null, status:'in_progress'}` if the file is
40
+ * absent or malformed.
30
41
  */
31
42
  export declare function readTraceState(directory: string): TraceState;
32
43
  /**
@@ -42,23 +53,41 @@ export declare function writeTraceState(directory: string, state: TraceState): v
42
53
  */
43
54
  export declare function readSpecIssueNumber(directory: string): number | null;
44
55
  /**
45
- * Loads the plan from the ledger-aware plan loader.
46
- * Async because the underlying ledger loader is async.
56
+ * Loads the plan from the AUTHORITATIVE ledger-aware loader (issue #2131 2.3).
57
+ * Async because the underlying loader is async.
47
58
  */
48
59
  export declare function loadPlanFromLedger(directory: string): Promise<Plan | null>;
49
60
  /**
50
- * Checks whether all phases in the plan have a completed status.
51
- * Returns `{allComplete: false}` if the plan is null.
61
+ * Computes plan presence AND phase-completion status from a single
62
+ * AUTHORITATIVE plan load. `planExists` reflects ledger authority, not
63
+ * projection (`.swarm/plan.json`) existence. Returns
64
+ * `{ planExists: false, allComplete: false }` if the plan is null/empty.
52
65
  */
53
66
  export declare function readPlanPhaseStatus(directory: string): Promise<{
67
+ planExists: boolean;
54
68
  allComplete: boolean;
55
69
  }>;
70
+ /**
71
+ * Returns whether an AUTHORITATIVE plan exists (ledger-aware). Async because
72
+ * the loader is async. Prefer {@link readPlanPhaseStatus} when both presence
73
+ * and phase status are needed, to load the plan once.
74
+ */
75
+ export declare function planExists(directory: string): Promise<boolean>;
56
76
  /**
57
77
  * Returns whether `.swarm/spec.md` exists.
58
78
  */
59
79
  export declare function specExists(directory: string): boolean;
60
80
  /**
61
- * Returns whether `.swarm/plan.json` exists.
81
+ * Returns whether a valid reproduction receipt exists for the given issue
82
+ * (issue #2131 2.6). The receipt is written by the `record_issue_reproduction`
83
+ * tool and binds to the issue number.
84
+ */
85
+ export declare function reproductionReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
86
+ /**
87
+ * Returns whether a valid publication receipt exists for the given issue (issue
88
+ * #2131 2.4). The receipt is written by the `record_issue_publication` tool
89
+ * after PR creation and is issue-bound so a prior issue's receipt cannot satisfy
90
+ * a new trace.
62
91
  */
63
- export declare function planExists(directory: string): boolean;
92
+ export declare function publicationReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
64
93
  export {};
@@ -8,9 +8,16 @@
8
8
  *
9
9
  * Uses the `_internals` DI seam pattern (AGENTS.md invariant 7) so
10
10
  * tests can override adapter functions without `mock.module` leakage.
11
+ *
12
+ * Issue #2131 finding 2.5: a transition is persisted ONLY AFTER its
13
+ * directive/mode message is durably appended to the host `output.messages`.
14
+ * If the host output lacks a mutable messages array the transition is NOT
15
+ * advanced, so the next cycle recomputes and retries — a lost directive can
16
+ * no longer be permanently suppressed by idempotency while state advances.
11
17
  */
18
+ import { error as _logErrorImpl } from '../utils/logger.js';
12
19
  import { isPlanCriticApproved } from './delegation-gate';
13
- import { planExists, readIssueReference, readPlanPhaseStatus, readSpecIssueNumber, readTraceState, specExists, writeTraceState } from './issue-trace-state';
20
+ import { publicationReceiptExists, readIssueReference, readPlanPhaseStatus, readSpecIssueNumber, readTraceState, reproductionReceiptExists, specExists, writeTraceState } from './issue-trace-state';
14
21
  export declare const _internals: {
15
22
  readIssueReference: typeof readIssueReference;
16
23
  readTraceState: typeof readTraceState;
@@ -18,8 +25,10 @@ export declare const _internals: {
18
25
  readSpecIssueNumber: typeof readSpecIssueNumber;
19
26
  readPlanPhaseStatus: typeof readPlanPhaseStatus;
20
27
  specExists: typeof specExists;
21
- planExists: typeof planExists;
28
+ reproductionReceiptExists: typeof reproductionReceiptExists;
29
+ publicationReceiptExists: typeof publicationReceiptExists;
22
30
  isPlanCriticApproved: typeof isPlanCriticApproved;
31
+ logError: typeof _logErrorImpl;
23
32
  };
24
33
  export declare function createIssueTraceHook(_config: unknown, directory: string, approvalTimeoutMs?: number): {
25
34
  messagesTransform: (input: unknown, output: unknown) => Promise<void>;
@@ -29,3 +38,7 @@ export declare function createIssueTraceHook(_config: unknown, directory: string
29
38
  * cross-test pollution from the module-level cache.
30
39
  */
31
40
  export declare function resetApprovalCache(): void;
41
+ /**
42
+ * Reset the plan phase-status cache. Called by tests in afterEach.
43
+ */
44
+ export declare function resetPhaseStatusCache(): void;
@@ -380,13 +380,21 @@ export declare function clearPrWorkflowGateState(directory: string, sessionID: s
380
380
  * commit. The tool gate refuses armed abort too (defense in depth).
381
381
  * 4. Refuses while open `swarm-pr-*` delegations exist, matching
382
382
  * `completePrWorkflow` — aborting mid-flight would orphan running lanes.
383
+ * 5. Issue #2131 finding 1a: a `recovery` abort of a BOUND gate (prHeadSha
384
+ * set — checkout succeeded) is refused unless a controller-recorded
385
+ * terminal recovery condition (`checkoutRecovery`) exists. Binding
386
+ * succeeded, so "checkout unreachable" no longer justifies a recovery
387
+ * abort; the architect must complete, or the user must authorize a
388
+ * `force` abort. `force` may clear a bound gate without a recovery
389
+ * condition (explicit user override).
383
390
  *
384
391
  * Records a non-fatal audit event into the existing `.swarm/events.jsonl`
385
392
  * (no new ledger file), then delegates to `clearPrWorkflowGateState`.
386
393
  */
387
394
  export declare function abortPrWorkflow(directory: string, sessionID: string, options?: {
388
395
  expectedMode?: PrWorkflowMode;
389
- reason?: string;
396
+ kind: 'recovery' | 'force';
397
+ reason: string;
390
398
  }): Promise<{
391
399
  mode: PrWorkflowMode;
392
400
  prHeadSha?: string;