opencode-swarm 7.187.0 → 7.187.2
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.
- package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
- package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
- package/dist/background/pr-review-contract.d.ts +2 -2
- package/dist/cli/{auto-checkpoint-r69e82bh.js → auto-checkpoint-2xmptd5t.js} +8 -8
- package/dist/cli/{checkpoint-1sqwbgra.js → checkpoint-2y7z19y5.js} +14 -13
- package/dist/cli/{coder-settlement-b9qx0732.js → coder-settlement-s4d28fa6.js} +9 -9
- package/dist/cli/{config-doctor-s4fr5qwr.js → config-doctor-312afzhr.js} +13 -12
- package/dist/cli/{core-bezezjy9.js → core-2bywxc4w.js} +2 -2
- package/dist/cli/{curation-policy-2x2w3b57.js → curation-policy-sr29thf5.js} +5 -5
- package/dist/cli/{curator-drift-785xnxdv.js → curator-drift-xx8pp4g9.js} +6 -6
- package/dist/cli/{curator-w4hp7a10.js → curator-dvhf6jex.js} +37 -35
- package/dist/cli/{curator-llm-factory-p0wwyswg.js → curator-llm-factory-4g2nvr76.js} +37 -35
- package/dist/cli/doctor-knowledge-receipt-phase-id-m239pgbz.js +83 -0
- package/dist/cli/{evidence-summary-service-33qcm9xc.js → evidence-summary-service-9et04fjh.js} +17 -16
- package/dist/cli/{gate-evidence-9ehj968e.js → gate-evidence-73vj3bgm.js} +6 -6
- package/dist/cli/{guardrail-explain-5715fdzv.js → guardrail-explain-8n4fx9zv.js} +38 -36
- package/dist/cli/{guardrail-log-k1dfzfzm.js → guardrail-log-9gmfvnd7.js} +7 -7
- package/dist/cli/{guardrail-reset-nt88n9dm.js → guardrail-reset-k3mrq25e.js} +37 -35
- package/dist/cli/{hive-promoter-c8fjn186.js → hive-promoter-bp3rz0q6.js} +37 -35
- package/dist/cli/{index-df2p0k0s.js → index-26zs9wsj.js} +2 -2
- package/dist/cli/{index-ectvhv8e.js → index-310h5192.js} +2 -2
- package/dist/cli/{index-en7vzpeq.js → index-33345434.js} +4 -4
- package/dist/cli/{index-2wgvjwpr.js → index-3ckfawjf.js} +3 -3
- package/dist/cli/{index-b2je0z0t.js → index-3g3n9fjq.js} +4 -4
- package/dist/cli/{index-ycz8z2db.js → index-3y0nr248.js} +3 -3
- package/dist/cli/{index-v08ksq0b.js → index-4g39nne8.js} +2 -2
- package/dist/cli/{index-t3hcd6zz.js → index-6t7ygevg.js} +1 -1
- package/dist/cli/{index-5m56c5r6.js → index-7fxy1s86.js} +4 -4
- package/dist/cli/{index-pymr99as.js → index-85cx1mmb.js} +4 -4
- package/dist/cli/{index-2s8wdagg.js → index-9jafghwk.js} +37 -35
- package/dist/cli/{index-evy5yrsw.js → index-b308erem.js} +3 -3
- package/dist/cli/{index-qzgfheb4.js → index-b5tthmy2.js} +2 -2
- package/dist/cli/{index-yw1g78v9.js → index-bstjg81q.js} +1 -1
- package/dist/cli/{index-hvr82s1t.js → index-dqberkr3.js} +4 -4
- package/dist/cli/{index-jtncfvhe.js → index-dx6bhbd6.js} +1 -1
- package/dist/cli/{index-ww8payq9.js → index-e9ry78z5.js} +2 -2
- package/dist/cli/{index-1vvr69ka.js → index-efbhea00.js} +1 -1
- package/dist/cli/{index-xs96nry2.js → index-exj7czz9.js} +4 -4
- package/dist/cli/{index-sztx0vyt.js → index-f6pft90q.js} +3 -3
- package/dist/cli/{index-6ersmqjd.js → index-j5db3v56.js} +318 -767
- package/dist/cli/{index-pts38j6x.js → index-jh9nrshe.js} +2 -2
- package/dist/cli/{index-0yj79yk1.js → index-jyxgkp4a.js} +1 -1
- package/dist/cli/index-kc635w60.js +748 -0
- package/dist/cli/{index-cppqxjw9.js → index-m1vsqmyr.js} +1 -1
- package/dist/cli/index-m9zzj4ee.js +10 -0
- package/dist/cli/{index-rm676s0p.js → index-n45kz69m.js} +1 -1
- package/dist/cli/{index-dypmvvga.js → index-n55exns2.js} +1 -1
- package/dist/cli/{index-pfpnzf6w.js → index-n8kqhxay.js} +1 -1
- package/dist/cli/{index-bbqxt1p5.js → index-pqffq9mm.js} +3 -3
- package/dist/cli/{index-knbjtqwt.js → index-rtdxyjrg.js} +8 -6
- package/dist/cli/{index-r7gt2w1b.js → index-tkm2rj27.js} +1 -1
- package/dist/cli/{index-cx4s7cak.js → index-tmp07h7b.js} +39 -37
- package/dist/cli/{index-ta48pe8j.js → index-tngc1erw.js} +3 -3
- package/dist/cli/{index-akt0arnt.js → index-tq6sbcys.js} +105 -185
- package/dist/cli/{index-c8ffgcvz.js → index-v9y0230d.js} +1 -1
- package/dist/cli/{index-469xmpd6.js → index-w0bvez8c.js} +1 -1
- package/dist/cli/{index-4g6sw4eq.js → index-wpxy7099.js} +1 -1
- package/dist/cli/{index-yf0cc6c5.js → index-xs070yr9.js} +2 -2
- package/dist/cli/{index-zzxnssy3.js → index-xv0t2sed.js} +4 -4
- package/dist/cli/{index-krqq8kbq.js → index-y81jjedn.js} +6 -6
- package/dist/cli/{index-d6kvatwp.js → index-z04d01pv.js} +11 -16
- package/dist/cli/index.js +38 -36
- package/dist/cli/{knowledge-escalator-qttydcx2.js → knowledge-escalator-fnqctvxz.js} +14 -12
- package/dist/cli/{knowledge-events-4vf0vj82.js → knowledge-events-mr1vh3nb.js} +12 -10
- package/dist/cli/{knowledge-link-p2c8agc8.js → knowledge-link-93nzznwd.js} +4 -4
- package/dist/cli/{knowledge-store-bw1dk2eb.js → knowledge-store-dxy4s9k6.js} +5 -5
- package/dist/cli/{knowledge-validator-gefcc36h.js → knowledge-validator-gy39attk.js} +7 -7
- package/dist/cli/{mcp-d5p0k3p1.js → mcp-bxb59wsq.js} +1 -1
- package/dist/cli/{model-preflight-fmx49pwy.js → model-preflight-2kje0sp0.js} +37 -35
- package/dist/cli/{pending-delegations-8333cb3y.js → pending-delegations-fm2nx2k0.js} +7 -7
- package/dist/cli/{pr-subscriptions-p42ny2sn.js → pr-subscriptions-g4f9rehb.js} +7 -7
- package/dist/cli/{pr-workflow-gate-csy32z8w.js → pr-workflow-gate-qtq1wq95.js} +37 -35
- package/dist/cli/{runner-cbpr45cs.js → runner-verr6er5.js} +5 -5
- package/dist/cli/{scan-cursor-14mwymtz.js → scan-cursor-8taj944f.js} +6 -6
- package/dist/cli/{schema-6426g0gw.js → schema-yxq3bjmd.js} +2 -2
- package/dist/cli/{scope-persistence-avkv3s4m.js → scope-persistence-jppvjncr.js} +12 -12
- package/dist/cli/{server-d9rk2zeb.js → server-2s7wqg9e.js} +37 -35
- package/dist/cli/{skill-generator-epdvdsh5.js → skill-generator-pyf95aqw.js} +16 -14
- package/dist/cli/{snapshot-coordination-init-35f7wrqb.js → snapshot-coordination-init-8gbxw9sa.js} +37 -35
- package/dist/cli/{speckit-checkoff-erwa7fbj.js → speckit-checkoff-x2z0jamv.js} +4 -4
- package/dist/cli/{telemetry-2vwb3n42.js → telemetry-xwj899pd.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-3tqkw81h.js → worktree-collision-ownership-455bdcnk.js} +7 -7
- package/dist/cli/{worktree-isolation-0rrjqypt.js → worktree-isolation-8x4p7tvm.js} +37 -35
- package/dist/commands/doctor-knowledge-receipt-phase-id.d.ts +16 -0
- package/dist/hooks/extractors.d.ts +15 -0
- package/dist/hooks/knowledge-injector.d.ts +5 -0
- package/dist/hooks/knowledge-receipt-ledger.d.ts +50 -4
- package/dist/hooks/knowledge-receipt-observability.d.ts +1 -1
- package/dist/hooks/phase-complete-directive-gate.d.ts +18 -1
- package/dist/hooks/phase-directives.d.ts +7 -3
- package/dist/index.js +469 -460
- package/dist/state.d.ts +26 -3
- package/dist/tools/phase-complete.d.ts +2 -2
- package/dist/tools/repair-knowledge-receipt-ledger.d.ts +26 -0
- package/dist/utils/path.d.ts +23 -0
- package/package.json +1 -1
|
@@ -21,75 +21,77 @@ import {
|
|
|
21
21
|
sanitizeWorktreeTaskId,
|
|
22
22
|
standardWorktreeByCallID,
|
|
23
23
|
standardWorktreeSerializationSessions
|
|
24
|
-
} from "./index-
|
|
25
|
-
import"./index-
|
|
26
|
-
import"./index-
|
|
27
|
-
import"./index-
|
|
24
|
+
} from "./index-tq6sbcys.js";
|
|
25
|
+
import"./index-3g3n9fjq.js";
|
|
26
|
+
import"./index-pqffq9mm.js";
|
|
27
|
+
import"./index-f6pft90q.js";
|
|
28
28
|
import"./index-vx8a8w3b.js";
|
|
29
|
-
import"./index-
|
|
30
|
-
import"./index-
|
|
29
|
+
import"./index-n55exns2.js";
|
|
30
|
+
import"./index-26zs9wsj.js";
|
|
31
31
|
import"./index-txdagbh7.js";
|
|
32
|
-
import"./index-
|
|
32
|
+
import"./index-4g39nne8.js";
|
|
33
33
|
import"./index-rdec0y3z.js";
|
|
34
|
-
import"./index-
|
|
35
|
-
import"./index-
|
|
36
|
-
import"./index-
|
|
37
|
-
import"./index-
|
|
34
|
+
import"./index-tkm2rj27.js";
|
|
35
|
+
import"./index-85cx1mmb.js";
|
|
36
|
+
import"./index-3ckfawjf.js";
|
|
37
|
+
import"./index-rtdxyjrg.js";
|
|
38
38
|
import"./index-mf19yqss.js";
|
|
39
|
-
import"./index-
|
|
39
|
+
import"./index-3y0nr248.js";
|
|
40
40
|
import"./index-cjapb4hy.js";
|
|
41
41
|
import"./index-a8gvszr2.js";
|
|
42
42
|
import"./index-pt7h91zc.js";
|
|
43
43
|
import"./index-q7sjgr1y.js";
|
|
44
|
-
import"./index-
|
|
45
|
-
import"./index-
|
|
44
|
+
import"./index-dqberkr3.js";
|
|
45
|
+
import"./index-z04d01pv.js";
|
|
46
46
|
import"./index-6b295cas.js";
|
|
47
47
|
import"./index-9nyqt3kb.js";
|
|
48
|
-
import"./index-
|
|
48
|
+
import"./index-efbhea00.js";
|
|
49
49
|
import"./index-zsrtt42s.js";
|
|
50
|
-
import"./index-
|
|
51
|
-
import"./index-
|
|
52
|
-
import"./index-
|
|
50
|
+
import"./index-m1vsqmyr.js";
|
|
51
|
+
import"./index-b308erem.js";
|
|
52
|
+
import"./index-jh9nrshe.js";
|
|
53
53
|
import"./index-g4fs6z4e.js";
|
|
54
|
-
import"./index-
|
|
55
|
-
import"./index-
|
|
54
|
+
import"./index-exj7czz9.js";
|
|
55
|
+
import"./index-kc635w60.js";
|
|
56
|
+
import"./index-j5db3v56.js";
|
|
57
|
+
import"./index-m9zzj4ee.js";
|
|
56
58
|
import"./index-bejxkee0.js";
|
|
57
59
|
import"./index-2s7dvzff.js";
|
|
58
|
-
import"./index-
|
|
59
|
-
import"./index-
|
|
60
|
+
import"./index-xv0t2sed.js";
|
|
61
|
+
import"./index-n8kqhxay.js";
|
|
60
62
|
import"./index-rtry5xyf.js";
|
|
61
63
|
import {
|
|
62
64
|
resolveWorktreeIsolationConfig
|
|
63
|
-
} from "./index-
|
|
65
|
+
} from "./index-tngc1erw.js";
|
|
64
66
|
import"./index-kbkk7vnh.js";
|
|
65
67
|
import"./index-0725jpp7.js";
|
|
66
|
-
import"./index-
|
|
67
|
-
import"./index-
|
|
68
|
-
import"./index-
|
|
68
|
+
import"./index-310h5192.js";
|
|
69
|
+
import"./index-7fxy1s86.js";
|
|
70
|
+
import"./index-e9ry78z5.js";
|
|
69
71
|
import"./index-m1qy7f1e.js";
|
|
70
72
|
import"./index-cc1vzq4m.js";
|
|
71
73
|
import"./index-9hag235h.js";
|
|
72
74
|
import"./index-ry16d01s.js";
|
|
73
75
|
import"./index-rdm3px0g.js";
|
|
74
76
|
import"./index-7pmbnjvj.js";
|
|
75
|
-
import"./index-
|
|
76
|
-
import"./index-
|
|
77
|
+
import"./index-v9y0230d.js";
|
|
78
|
+
import"./index-y81jjedn.js";
|
|
77
79
|
import"./index-vzm6zre7.js";
|
|
78
80
|
import"./index-ae75rja9.js";
|
|
79
|
-
import"./index-
|
|
80
|
-
import"./index-
|
|
81
|
-
import"./index-
|
|
81
|
+
import"./index-n45kz69m.js";
|
|
82
|
+
import"./index-6t7ygevg.js";
|
|
83
|
+
import"./index-jyxgkp4a.js";
|
|
82
84
|
import"./index-t7hmqgjy.js";
|
|
83
|
-
import"./index-
|
|
85
|
+
import"./index-dx6bhbd6.js";
|
|
84
86
|
import"./index-fzpt2djt.js";
|
|
85
87
|
import"./index-ejhxgyvm.js";
|
|
86
88
|
import"./index-7g4c7s5r.js";
|
|
87
89
|
import"./index-r6e8syr3.js";
|
|
88
90
|
import"./index-gx2vp8gx.js";
|
|
89
|
-
import"./index-
|
|
91
|
+
import"./index-w0bvez8c.js";
|
|
90
92
|
import"./index-zxdawwc7.js";
|
|
91
|
-
import"./index-
|
|
92
|
-
import"./index-
|
|
93
|
+
import"./index-b5tthmy2.js";
|
|
94
|
+
import"./index-bstjg81q.js";
|
|
93
95
|
import"./index-bk5tah7q.js";
|
|
94
96
|
import"./index-gknz3bv1.js";
|
|
95
97
|
import"./index-zpsr8rpc.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #2947 `/swarm doctor` section: `knowledge-receipt-phase-id`.
|
|
3
|
+
*
|
|
4
|
+
* Detection is always-on and takes the ledger lock like every ledger read;
|
|
5
|
+
* on a legacy store that has not completed cutover yet, a detection call can
|
|
6
|
+
* append the standard `legacy_unverifiable`/`cutover_completed` bootstrap
|
|
7
|
+
* records (base-identical behavior of every `runLocked` read — no phase-data
|
|
8
|
+
* mutation). The journaled backfill runs ONLY under the interactive `--fix`
|
|
9
|
+
* flag. Fail-open on lock or store errors — the doctor is advisory and must
|
|
10
|
+
* still produce its structural report. INVARIANT 1 (AGENTS.md): this section
|
|
11
|
+
* is wired exclusively into the interactive `handleDoctorCommand` and is
|
|
12
|
+
* deliberately absent from `runConfigDoctor`/`runConfigDoctorWithFixes`, so
|
|
13
|
+
* no receipt-journal scan or backfill write can execute on the plugin startup
|
|
14
|
+
* path (src/index.ts registers the startup doctor via those services only).
|
|
15
|
+
*/
|
|
16
|
+
export declare function renderKnowledgeReceiptPhaseIdSection(directory: string, enableAutoFix: boolean): Promise<string>;
|
|
@@ -63,6 +63,21 @@ export declare function extractPatterns(contextContent: string, maxChars?: numbe
|
|
|
63
63
|
* never suppress the summary — the honest active phase is reported instead.
|
|
64
64
|
*/
|
|
65
65
|
export declare function extractCurrentPhaseFromPlan(plan: Plan): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Parse the stable numeric phase id embedded in a stored phase label.
|
|
68
|
+
*
|
|
69
|
+
* Membership labels are immutable once committed, so the embedded id is a
|
|
70
|
+
* stable identity even for legacy records that predate the explicit
|
|
71
|
+
* `phase_id` field (#2947). Accepts BOTH live label shapes — the composed
|
|
72
|
+
* `Phase 2: Name [STATUS]` form and the short architect form `Phase 2` —
|
|
73
|
+
* using the same loose canonical regex as `phaseNumberOf` in
|
|
74
|
+
* knowledge-injector.ts (which delegates here). Returns undefined for labels
|
|
75
|
+
* that carry no `Phase N` prefix AND for `Phase 0`: real plan phases are
|
|
76
|
+
* >= 1 (PhaseSchema), and the architect no-plan fallback label `Phase 0` is a
|
|
77
|
+
* synthetic marker that must never become a membership phase_id. Callers must
|
|
78
|
+
* treat undefined as "no id" and fall back to verbatim-label matching.
|
|
79
|
+
*/
|
|
80
|
+
export declare function extractPhaseIdFromLabel(label: string | undefined): number | undefined;
|
|
66
81
|
/**
|
|
67
82
|
* Extracts the first incomplete task from the current phase of a Plan object.
|
|
68
83
|
*
|
|
@@ -71,6 +71,11 @@ export interface InjectForDelegateParams {
|
|
|
71
71
|
* and the phase-complete gate window directives by phase (Change 2).
|
|
72
72
|
*/
|
|
73
73
|
phase?: string;
|
|
74
|
+
/**
|
|
75
|
+
* #2947: stable numeric phase id persisted on the membership so the
|
|
76
|
+
* phase-complete gate can key on it when the label legitimately drifts.
|
|
77
|
+
*/
|
|
78
|
+
phase_id?: number;
|
|
74
79
|
/** Test seam: override the search function. Defaults to the live one. */
|
|
75
80
|
searchFn?: typeof searchKnowledge;
|
|
76
81
|
}
|
|
@@ -77,6 +77,8 @@ export interface ReceiptMembership {
|
|
|
77
77
|
entry_id: string;
|
|
78
78
|
session_id: string;
|
|
79
79
|
phase?: string;
|
|
80
|
+
/** Stable numeric phase id (#2947); explicit-only at commit. Legacy rows are undefined until backfilled. */
|
|
81
|
+
phase_id?: number;
|
|
80
82
|
task_id?: string;
|
|
81
83
|
agent?: string;
|
|
82
84
|
critical: boolean;
|
|
@@ -124,6 +126,8 @@ interface EmptyTrace {
|
|
|
124
126
|
}
|
|
125
127
|
interface PhaseLifecycle {
|
|
126
128
|
phase: string;
|
|
129
|
+
/** Stable numeric phase id (#2947); optional so pre-existing lifecycle rows keep parsing. */
|
|
130
|
+
phase_id?: number;
|
|
127
131
|
session_id: string;
|
|
128
132
|
task_id?: string;
|
|
129
133
|
intent_event_id?: string;
|
|
@@ -142,7 +146,7 @@ interface ReceiptAuditSummary {
|
|
|
142
146
|
entry_ids?: string[];
|
|
143
147
|
reason_codes?: string[];
|
|
144
148
|
}
|
|
145
|
-
export type ReceiptTransitionKind = 'membership_committed' | 'empty_retrieval_committed' | 'terminal_committed' | 'terminal_attempt_rejected' | 'terminal_attempt_idempotent' | 'authorized_transition_committed' | 'application_marker_committed' | 'gate_release_committed' | 'phase_close_intent' | 'phase_closed' | 'repair_uncertainty_installed' | 'repair_uncertainty_cleared' | 'legacy_imported' | 'legacy_unverifiable' | 'cutover_completed' | 'checkpoint';
|
|
149
|
+
export type ReceiptTransitionKind = 'membership_committed' | 'empty_retrieval_committed' | 'terminal_committed' | 'terminal_attempt_rejected' | 'terminal_attempt_idempotent' | 'authorized_transition_committed' | 'application_marker_committed' | 'gate_release_committed' | 'phase_close_intent' | 'phase_closed' | 'phase_id_backfilled' | 'repair_uncertainty_installed' | 'repair_uncertainty_cleared' | 'legacy_imported' | 'legacy_unverifiable' | 'cutover_completed' | 'checkpoint';
|
|
146
150
|
interface LedgerState {
|
|
147
151
|
memberships: Map<string, ReceiptMembership>;
|
|
148
152
|
traceIds: Set<string>;
|
|
@@ -193,6 +197,8 @@ export interface CommitDisplayedMembershipInput {
|
|
|
193
197
|
trace_id: string;
|
|
194
198
|
session_id: string;
|
|
195
199
|
phase?: string;
|
|
200
|
+
/** Stable numeric phase id (#2947); explicit-only — never derived from the label here. */
|
|
201
|
+
phase_id?: number;
|
|
196
202
|
task_id?: string;
|
|
197
203
|
agent?: string;
|
|
198
204
|
entries: Array<{
|
|
@@ -221,6 +227,8 @@ export interface TerminalBatchInput {
|
|
|
221
227
|
trace_id: string;
|
|
222
228
|
session_id: string;
|
|
223
229
|
phase?: string;
|
|
230
|
+
/** #2947: stable phase id — the wrong_phase reject matches id-first with label fallback. */
|
|
231
|
+
phase_id?: number;
|
|
224
232
|
task_id?: string;
|
|
225
233
|
agent?: string;
|
|
226
234
|
cohort_id?: string;
|
|
@@ -365,6 +373,8 @@ export declare function commitApplicationOutcomeBatch(directory: string, input:
|
|
|
365
373
|
}>>;
|
|
366
374
|
export declare function queryLiveMemberships(directory: string, filters?: {
|
|
367
375
|
phase?: string;
|
|
376
|
+
/** #2947: stable phase id — matches id-first with label fallback for legacy rows. */
|
|
377
|
+
phase_id?: number;
|
|
368
378
|
task_id?: string;
|
|
369
379
|
session_id?: string;
|
|
370
380
|
include_terminal?: boolean;
|
|
@@ -385,18 +395,54 @@ export declare function queryHistoricalOutcomes(directory: string, entryIds?: st
|
|
|
385
395
|
export declare function compactKnowledgeReceiptLedger(directory: string): Promise<ReceiptLedgerResult<{
|
|
386
396
|
compacted: true;
|
|
387
397
|
}>>;
|
|
388
|
-
export declare const recordPhaseCloseIntent: (directory: string, phase: string, sessionId?: string, taskId?: string) => Promise<ReceiptLedgerResult<{
|
|
398
|
+
export declare const recordPhaseCloseIntent: (directory: string, phase: string, sessionId?: string, taskId?: string, phaseId?: number) => Promise<ReceiptLedgerResult<{
|
|
389
399
|
event_id: string;
|
|
390
400
|
}>>;
|
|
391
|
-
export declare const commitPhaseClosed: (directory: string, phase: string, sessionId?: string, taskId?: string) => Promise<ReceiptLedgerResult<{
|
|
401
|
+
export declare const commitPhaseClosed: (directory: string, phase: string, sessionId?: string, taskId?: string, phaseId?: number) => Promise<ReceiptLedgerResult<{
|
|
392
402
|
event_id: string;
|
|
393
403
|
}>>;
|
|
394
|
-
export declare function reconcilePhaseClose(directory: string, phase: string, durablePlanClosed: boolean, sessionId?: string, taskId?: string): Promise<ReceiptLedgerResult<{
|
|
404
|
+
export declare function reconcilePhaseClose(directory: string, phase: string, durablePlanClosed: boolean, sessionId?: string, taskId?: string, phaseId?: number): Promise<ReceiptLedgerResult<{
|
|
395
405
|
reconciled: boolean;
|
|
396
406
|
}>>;
|
|
397
407
|
export declare function ensureLegacyCutover(directory: string, graceDays?: number): Promise<ReceiptLedgerResult<{
|
|
398
408
|
completed: true;
|
|
399
409
|
}>>;
|
|
410
|
+
export interface ReceiptPhaseIdInspection {
|
|
411
|
+
/** Live memberships that carry no explicit phase_id. */
|
|
412
|
+
missing: number;
|
|
413
|
+
/** Subset of `missing` whose stored label parses to a phase id (backfillable). */
|
|
414
|
+
backfillable: number;
|
|
415
|
+
/** Subset of `missing` whose label carries no parsable id (needs operator attention). */
|
|
416
|
+
unparsable: Array<{
|
|
417
|
+
trace_id: string;
|
|
418
|
+
entry_id: string;
|
|
419
|
+
label?: string;
|
|
420
|
+
}>;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* #2947 doctor read: report how many live memberships lack a stable phase id
|
|
424
|
+
* and how many of those a backfill could repair. Lock-taking (like every
|
|
425
|
+
* ledger read; on a legacy store the standard cutover bootstrap may append
|
|
426
|
+
* records — base-identical behavior, no phase-data mutation); the doctor
|
|
427
|
+
* treats any store error as "skipped" (fail-open, advisory).
|
|
428
|
+
*/
|
|
429
|
+
export declare function inspectMembershipPhaseIds(directory: string): Promise<ReceiptLedgerResult<ReceiptPhaseIdInspection>>;
|
|
430
|
+
/**
|
|
431
|
+
* #2947 backfill: durably stamp `phase_id` on live memberships that lack one,
|
|
432
|
+
* deriving the id from the `Phase N` prefix of their stored label. Journaled
|
|
433
|
+
* as ONE `phase_id_backfilled` record; labels are NEVER rewritten; rows that
|
|
434
|
+
* already carry an id are untouched; a second run appends nothing.
|
|
435
|
+
* Unparsable labels are skipped and reported.
|
|
436
|
+
*/
|
|
437
|
+
export declare function backfillMembershipPhaseIds(directory: string): Promise<ReceiptLedgerResult<{
|
|
438
|
+
backfilled: number;
|
|
439
|
+
skipped: Array<{
|
|
440
|
+
trace_id: string;
|
|
441
|
+
entry_id: string;
|
|
442
|
+
label?: string;
|
|
443
|
+
}>;
|
|
444
|
+
journal_records: number;
|
|
445
|
+
}>>;
|
|
400
446
|
export declare const _internals: {
|
|
401
447
|
nowMs: () => number;
|
|
402
448
|
writeSnapshot: typeof writeSnapshot;
|
|
@@ -21,7 +21,7 @@ export declare const RECEIPT_SEMANTICS_VERSION = 2;
|
|
|
21
21
|
* `no_relevant` tombstone that closes an empty retrieval (not a terminal).
|
|
22
22
|
*/
|
|
23
23
|
export type ReceiptObservationOutcome = ReceiptOutcome | 'no_relevant';
|
|
24
|
-
export type KnowledgeReceiptObservedTransition = 'membership_committed' | 'empty_retrieval_committed' | 'terminal_committed' | 'terminal_attempt_rejected' | 'terminal_attempt_idempotent' | 'authorized_transition_committed' | 'application_marker_committed' | 'gate_release_committed' | 'phase_close_intent' | 'phase_closed' | 'repair_uncertainty_installed' | 'repair_uncertainty_cleared' | 'legacy_imported' | 'legacy_unverifiable' | 'cutover_completed' | 'checkpoint';
|
|
24
|
+
export type KnowledgeReceiptObservedTransition = 'membership_committed' | 'empty_retrieval_committed' | 'terminal_committed' | 'terminal_attempt_rejected' | 'terminal_attempt_idempotent' | 'authorized_transition_committed' | 'application_marker_committed' | 'gate_release_committed' | 'phase_close_intent' | 'phase_closed' | 'phase_id_backfilled' | 'repair_uncertainty_installed' | 'repair_uncertainty_cleared' | 'legacy_imported' | 'legacy_unverifiable' | 'cutover_completed' | 'checkpoint';
|
|
25
25
|
export type KnowledgeReceiptObservationReasonCode = 'committed' | 'idempotent' | 'trace_not_found' | 'id_not_in_trace' | 'wrong_session' | 'wrong_phase' | 'wrong_task' | 'duplicate_conflicting_terminal' | 'event_id_conflict' | 'invalid_outcome' | 'empty_receipt' | 'lock_timeout' | 'store_unavailable' | 'store_corrupt' | 'legacy_unverifiable' | 'unauthorized_transition';
|
|
26
26
|
export interface KnowledgeReceiptTransitionObservation {
|
|
27
27
|
transition: KnowledgeReceiptObservedTransition;
|
|
@@ -28,6 +28,21 @@ export interface DirectiveGateResult {
|
|
|
28
28
|
overridden: string[];
|
|
29
29
|
/** True when the gate could not read its inputs (fail-closed → blocked). */
|
|
30
30
|
failedClosed: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* #2947: present when a numeric phase id was supplied, the gate blocked,
|
|
33
|
+
* and the blocking representative's identity disagrees with the query —
|
|
34
|
+
* either its stored label differs from the queried label, or its explicit
|
|
35
|
+
* phase id differs from the queried id (labels can agree in the
|
|
36
|
+
* closing-window shape). Bounded: phase ids plus the two labels,
|
|
37
|
+
* sanitized; never prompt or entry bodies.
|
|
38
|
+
*/
|
|
39
|
+
phaseLabelSkew?: {
|
|
40
|
+
phase_id: number;
|
|
41
|
+
queried_label: string;
|
|
42
|
+
stored_label: string;
|
|
43
|
+
/** The representative's explicit phase id, when it carries one. */
|
|
44
|
+
stored_phase_id?: number;
|
|
45
|
+
};
|
|
31
46
|
failure?: {
|
|
32
47
|
code: DirectiveGateFailureCode;
|
|
33
48
|
action_id: 'knowledge_receipt' | 'phase_complete' | 'repair_knowledge_receipt_ledger';
|
|
@@ -57,12 +72,14 @@ export declare function evaluatePhaseCriticalDirectives(params: {
|
|
|
57
72
|
directory: string;
|
|
58
73
|
sessionId?: string;
|
|
59
74
|
phaseLabel?: string;
|
|
75
|
+
/** #2947: stable numeric phase id; keys the evidence window id-first with label fallback. */
|
|
76
|
+
phaseId?: number;
|
|
60
77
|
acceptViolations?: string[];
|
|
61
78
|
}): Promise<DirectiveGateResult>;
|
|
62
79
|
/**
|
|
63
80
|
* Record an architect override for accepted critical violations. Each accepted
|
|
64
81
|
* id is logged as an `override` event with the written justification.
|
|
65
82
|
*/
|
|
66
|
-
export declare function recordDirectiveOverrides(directory: string, ids: string[], justification: string, sessionId: string | undefined, phaseLabel?: string): Promise<void>;
|
|
83
|
+
export declare function recordDirectiveOverrides(directory: string, ids: string[], justification: string, sessionId: string | undefined, phaseLabel?: string, phaseId?: number): Promise<void>;
|
|
67
84
|
/** Build a structured, human-readable block message for unresolved criticals. */
|
|
68
85
|
export declare function formatDirectiveBlockMessage(unresolved: DirectiveGateResult['unresolved']): string;
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
import type { DirectiveToVerify } from '../agents/reviewer-directive-compliance.js';
|
|
16
16
|
import type { KnowledgeEntryBase } from './knowledge-types.js';
|
|
17
17
|
/** Collect unique entry IDs from authoritative memberships in the phase window. */
|
|
18
|
-
export declare function collectPhaseDirectiveIds(directory: string, phaseLabel?: string
|
|
18
|
+
export declare function collectPhaseDirectiveIds(directory: string, phaseLabel?: string,
|
|
19
|
+
/** #2947: stable phase id — id-first matching with label fallback (#2984 review). */
|
|
20
|
+
phaseId?: number): Promise<string[]>;
|
|
19
21
|
/** Load all knowledge entries (swarm + hive) indexed by id. */
|
|
20
22
|
export declare function readEntriesById(directory: string): Promise<Map<string, KnowledgeEntryBase>>;
|
|
21
23
|
/**
|
|
@@ -53,6 +55,8 @@ export declare function pickDirectiveRepresentatives(candidates: DirectiveCandid
|
|
|
53
55
|
* predicate, deduplicated to ONE obligation per entry. Archived/quarantined
|
|
54
56
|
* entries are excluded. Fail-open: returns [] on any error.
|
|
55
57
|
*/
|
|
56
|
-
export declare function readPhaseDirectivesToVerify(directory: string, phaseLabel?: string
|
|
58
|
+
export declare function readPhaseDirectivesToVerify(directory: string, phaseLabel?: string,
|
|
59
|
+
/** #2947: stable phase id — id-first matching with label fallback (#2984 review). */
|
|
60
|
+
phaseId?: number): Promise<DirectiveToVerify[]>;
|
|
57
61
|
/** The CRITICAL directive IDs retrieved during the phase. */
|
|
58
|
-
export declare function readPhaseCriticalDirectiveIds(directory: string, phaseLabel?: string): Promise<string[]>;
|
|
62
|
+
export declare function readPhaseCriticalDirectiveIds(directory: string, phaseLabel?: string, phaseId?: number): Promise<string[]>;
|