@lmzhen/dsh-evolution-merge 0.30.17 → 0.30.19
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/README.md +25 -7
- package/data/minhash_params.json +1063 -0
- package/lib/index.js +7308 -1800
- package/lib/types/adapters/channel.d.ts +1 -0
- package/lib/types/adapters/channel.js +15 -1
- package/lib/types/adapters/engine-screen.d.ts +1 -1
- package/lib/types/adapters/engine-screen.js +5 -2
- package/lib/types/adapters/library.js +4 -1
- package/lib/types/adapters/model-runner.d.ts +0 -5
- package/lib/types/adapters/model-runner.js +8 -2
- package/lib/types/adapters/model.d.ts +31 -0
- package/lib/types/adapters/model.js +47 -0
- package/lib/types/adapters/select.js +12 -8
- package/lib/types/approve-command.d.ts +14 -1
- package/lib/types/approve-command.js +72 -44
- package/lib/types/authoring-flow.d.ts +19 -1
- package/lib/types/authoring-flow.js +49 -15
- package/lib/types/channel-port.d.ts +3 -1
- package/lib/types/channel-port.js +8 -3
- package/lib/types/command-defs.d.ts +5 -0
- package/lib/types/command-defs.js +33 -0
- package/lib/types/command-surface.d.ts +5 -0
- package/lib/types/command-surface.js +11 -0
- package/lib/types/commands.d.ts +3 -4
- package/lib/types/commands.js +33 -72
- package/lib/types/commit-assembly.d.ts +16 -1
- package/lib/types/commit-assembly.js +72 -11
- package/lib/types/commit-execute.d.ts +14 -2
- package/lib/types/commit-execute.js +76 -14
- package/lib/types/commit-plan.d.ts +7 -1
- package/lib/types/commit-plan.js +4 -0
- package/lib/types/commit-receipt.d.ts +3 -0
- package/lib/types/commit-recovery.d.ts +7 -2
- package/lib/types/commit-recovery.js +73 -96
- package/lib/types/contracts.d.ts +44 -1
- package/lib/types/contracts.js +1 -1
- package/lib/types/coordinator.d.ts +3 -2
- package/lib/types/coordinator.js +4 -3
- package/lib/types/decision.js +1 -1
- package/lib/types/doctor.d.ts +18 -1
- package/lib/types/doctor.js +164 -10
- package/lib/types/domain/authoring-manifest.d.ts +26 -0
- package/lib/types/domain/authoring-manifest.js +43 -0
- package/lib/types/domain/claim.d.ts +4 -1
- package/lib/types/domain/claim.js +2 -2
- package/lib/types/domain/commit-journal-store.js +5 -1
- package/lib/types/domain/commit-journal.js +1 -1
- package/lib/types/domain/consistency.d.ts +22 -0
- package/lib/types/domain/consistency.js +50 -0
- package/lib/types/domain/engine-criteria.d.ts +10 -0
- package/lib/types/domain/engine-criteria.js +11 -0
- package/lib/types/domain/engine-input.d.ts +10 -0
- package/lib/types/domain/engine-input.js +26 -0
- package/lib/types/domain/errors.d.ts +15 -1
- package/lib/types/domain/errors.js +23 -4
- package/lib/types/domain/evidence-hash.d.ts +3 -0
- package/lib/types/domain/evidence-hash.js +14 -0
- package/lib/types/domain/failure-route.d.ts +14 -0
- package/lib/types/domain/failure-route.js +12 -0
- package/lib/types/domain/ledger.js +10 -1
- package/lib/types/domain/live-facts.d.ts +31 -0
- package/lib/types/domain/live-facts.js +54 -0
- package/lib/types/domain/merge-limits.d.ts +18 -0
- package/lib/types/domain/merge-limits.js +22 -0
- package/lib/types/domain/merge-report.d.ts +41 -0
- package/lib/types/domain/merge-report.js +2 -0
- package/lib/types/domain/merge-snapshot.d.ts +99 -0
- package/lib/types/domain/merge-snapshot.js +82 -0
- package/lib/types/domain/migrate-v3.d.ts +20 -0
- package/lib/types/domain/migrate-v3.js +68 -0
- package/lib/types/domain/pair-ledger.d.ts +34 -0
- package/lib/types/domain/pair-ledger.js +96 -0
- package/lib/types/domain/pre-1b-backup.d.ts +43 -0
- package/lib/types/domain/pre-1b-backup.js +140 -0
- package/lib/types/domain/provider-key.d.ts +2 -0
- package/lib/types/domain/provider-key.js +11 -0
- package/lib/types/domain/read-probe.d.ts +5 -0
- package/lib/types/domain/read-probe.js +11 -0
- package/lib/types/domain/reconcile.d.ts +47 -0
- package/lib/types/domain/reconcile.js +178 -0
- package/lib/types/domain/resolve-pair.d.ts +2 -9
- package/lib/types/domain/resolve-pair.js +2 -15
- package/lib/types/domain/row-tx.d.ts +27 -0
- package/lib/types/domain/row-tx.js +31 -0
- package/lib/types/domain/row-v3-bridge.d.ts +6 -0
- package/lib/types/domain/row-v3-bridge.js +47 -0
- package/lib/types/domain/row-v3.d.ts +113 -0
- package/lib/types/domain/row-v3.js +107 -0
- package/lib/types/domain/row-v4.d.ts +148 -0
- package/lib/types/domain/row-v4.js +159 -0
- package/lib/types/domain/row.d.ts +1 -0
- package/lib/types/domain/run-coordinator.d.ts +51 -0
- package/lib/types/domain/run-coordinator.js +45 -0
- package/lib/types/domain/schema4.d.ts +53 -0
- package/lib/types/domain/schema4.js +129 -0
- package/lib/types/domain/selection-policy.d.ts +14 -0
- package/lib/types/domain/selection-policy.js +6 -0
- package/lib/types/domain/skipped-expiry.d.ts +5 -0
- package/lib/types/domain/skipped-expiry.js +16 -0
- package/lib/types/domain/stage-aggregate.d.ts +96 -0
- package/lib/types/domain/stage-aggregate.js +293 -0
- package/lib/types/domain/staging-index.d.ts +15 -0
- package/lib/types/domain/staging-index.js +41 -0
- package/lib/types/domain/state-bootstrap.d.ts +43 -0
- package/lib/types/domain/state-bootstrap.js +267 -0
- package/lib/types/domain/state-v3.d.ts +4 -0
- package/lib/types/domain/state-v3.js +4 -0
- package/lib/types/domain/undo-journal.d.ts +19 -0
- package/lib/types/domain/undo-journal.js +20 -0
- package/lib/types/domain/undo-receipt.d.ts +18 -0
- package/lib/types/domain/undo-receipt.js +22 -0
- package/lib/types/domain/validation-plan.d.ts +65 -0
- package/lib/types/domain/validation-plan.js +49 -0
- package/lib/types/facts.d.ts +26 -0
- package/lib/types/facts.js +65 -0
- package/lib/types/gate-filter.d.ts +31 -0
- package/lib/types/gate-filter.js +64 -0
- package/lib/types/index.d.ts +7 -2
- package/lib/types/index.js +185 -82
- package/lib/types/ladder.js +1 -1
- package/lib/types/merge-command.d.ts +3 -1
- package/lib/types/merge-command.js +10 -6
- package/lib/types/merge-routes.d.ts +12 -7
- package/lib/types/merge-routes.js +87 -23
- package/lib/types/merge-tool.d.ts +1 -1
- package/lib/types/merge-tool.js +2 -2
- package/lib/types/metrics.d.ts +16 -0
- package/lib/types/metrics.js +27 -0
- package/lib/types/new-child-authoring.d.ts +5 -1
- package/lib/types/new-child-authoring.js +71 -13
- package/lib/types/params.d.ts +2 -4
- package/lib/types/params.js +13 -0
- package/lib/types/pending-actions.d.ts +2 -2
- package/lib/types/pending-actions.js +17 -17
- package/lib/types/prompts.d.ts +2 -4
- package/lib/types/prompts.js +21 -8
- package/lib/types/propose.d.ts +26 -0
- package/lib/types/propose.js +69 -0
- package/lib/types/read-commands.d.ts +4 -4
- package/lib/types/read-commands.js +19 -26
- package/lib/types/recovery-coordinator.d.ts +34 -0
- package/lib/types/recovery-coordinator.js +84 -0
- package/lib/types/recovery-projection.d.ts +31 -0
- package/lib/types/recovery-projection.js +96 -0
- package/lib/types/resume-command.d.ts +7 -1
- package/lib/types/resume-command.js +50 -14
- package/lib/types/revision.d.ts +17 -0
- package/lib/types/revision.js +39 -3
- package/lib/types/round2-outcome.d.ts +2 -1
- package/lib/types/round2-outcome.js +68 -12
- package/lib/types/run-shell.d.ts +16 -2
- package/lib/types/run-shell.js +49 -5
- package/lib/types/runtime.d.ts +4 -6
- package/lib/types/runtime.js +341 -86
- package/lib/types/scan-command.d.ts +1 -0
- package/lib/types/scan-command.js +2 -0
- package/lib/types/scan-ports.d.ts +21 -1
- package/lib/types/scan-ports.js +51 -23
- package/lib/types/scan-run.d.ts +17 -0
- package/lib/types/scan-run.js +221 -63
- package/lib/types/screening-port.d.ts +47 -0
- package/lib/types/screening-port.js +93 -0
- package/lib/types/screening.d.ts +30 -0
- package/lib/types/screening.js +75 -0
- package/lib/types/stage-tool-registry.d.ts +7 -0
- package/lib/types/stage-tool-registry.js +12 -1
- package/lib/types/state.d.ts +15 -1
- package/lib/types/state.js +39 -17
- package/lib/types/status.d.ts +8 -0
- package/lib/types/status.js +64 -0
- package/lib/types/surface/body.d.ts +4 -0
- package/lib/types/surface/body.js +16 -0
- package/lib/types/surface/merge-view.d.ts +14 -0
- package/lib/types/surface/merge-view.js +126 -0
- package/lib/types/target-claim.d.ts +1 -0
- package/lib/types/target-claim.js +63 -18
- package/lib/types/undo-operation.d.ts +24 -0
- package/lib/types/undo-operation.js +135 -0
- package/lib/types/unit-claim.d.ts +5 -0
- package/lib/types/unit-claim.js +15 -0
- package/lib/types/wire-projection.d.ts +36 -0
- package/lib/types/wire-projection.js +69 -0
- package/lib/types/wire.d.ts +273 -0
- package/lib/types/wire.js +3 -0
- package/package.json +10 -4
- package/lib/types/routes.d.ts +0 -70
- package/lib/types/routes.js +0 -78
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { contentHash } from '@lmzhen/dsh-evolution-core';
|
|
2
|
+
import { readCommitReceipts } from "./commit-receipt.js";
|
|
3
|
+
import { undoMergeReceipt } from "./undo-merge.js";
|
|
4
|
+
import { writeUndoJournal } from "./domain/undo-journal.js";
|
|
5
|
+
import { readUndoReceipt, writeUndoReceipt } from "./domain/undo-receipt.js";
|
|
6
|
+
import { recordPair } from "./domain/pair-index-store.js";
|
|
7
|
+
import { readRunMeta, writeRunMeta } from "./domain/run-coordinator.js";
|
|
8
|
+
import { readUnitEvidence } from '@lmzhen/dsh-evolution-core';
|
|
9
|
+
import { evidenceSha256 as unitEvidenceDigest } from "./domain/evidence-hash.js";
|
|
10
|
+
function digest(value) { return value === null ? null : contentHash(value); }
|
|
11
|
+
function sortReceipts(receipts) {
|
|
12
|
+
const remaining = [...receipts];
|
|
13
|
+
const out = [];
|
|
14
|
+
while (remaining.length > 0) {
|
|
15
|
+
const last = [...remaining].sort((a, b) => {
|
|
16
|
+
if (b.at !== a.at)
|
|
17
|
+
return b.at - a.at;
|
|
18
|
+
if (b.sources.includes(a.target))
|
|
19
|
+
return 1;
|
|
20
|
+
if (a.sources.includes(b.target))
|
|
21
|
+
return -1;
|
|
22
|
+
return b.sources.length - a.sources.length;
|
|
23
|
+
})[0];
|
|
24
|
+
out.push(last);
|
|
25
|
+
remaining.splice(remaining.indexOf(last), 1);
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
async function preflight(io, home, port, receipt) {
|
|
30
|
+
const evidence = await readUnitEvidence(io, home, receipt.unitId);
|
|
31
|
+
if (evidence === null)
|
|
32
|
+
return { ok: false, code: 'undo-unavailable-legacy-receipt', message: 'commit evidence is missing; undo unavailable for legacy receipt', undone: [] };
|
|
33
|
+
const expectedSha = receipt.evidenceSha256 ?? unitEvidenceDigest(evidence);
|
|
34
|
+
if (unitEvidenceDigest(evidence) !== expectedSha)
|
|
35
|
+
return { ok: false, code: 'undo-evidence-hash-mismatch', message: 'commit receipt evidence hash does not match evidence', undone: [] };
|
|
36
|
+
const targetNow = await port.readSkill(receipt.target);
|
|
37
|
+
const targetAfter = evidence.target.after;
|
|
38
|
+
const targetBefore = evidence.target.before;
|
|
39
|
+
const targetAllowed = targetNow === targetAfter || (receipt.create ? targetNow === null : targetNow === targetBefore);
|
|
40
|
+
if (!targetAllowed)
|
|
41
|
+
return { ok: false, code: 'undo-target-drift', message: 'target no longer matches the committed unit', undone: [] };
|
|
42
|
+
const sourcesNow = {};
|
|
43
|
+
for (const source of evidence.sources) {
|
|
44
|
+
const live = await port.readSkill(source.name);
|
|
45
|
+
sourcesNow[source.name] = live;
|
|
46
|
+
if (live !== null && live !== source.before)
|
|
47
|
+
return { ok: false, code: 'undo-source-drift', message: 'source no longer matches the archived unit: ' + source.name, undone: [] };
|
|
48
|
+
}
|
|
49
|
+
const targetDone = receipt.create ? targetNow === null : targetNow === targetBefore;
|
|
50
|
+
const sourcesDone = evidence.sources.every(source => sourcesNow[source.name] === source.before);
|
|
51
|
+
return { receipt, evidence, targetNow, sourcesNow, done: targetDone && sourcesDone, targetDone, sourcesDone };
|
|
52
|
+
}
|
|
53
|
+
async function settleRun(io, home, runId, pairKey, allPairs, at) {
|
|
54
|
+
const current = await readRunMeta(io, home, runId);
|
|
55
|
+
const previous = current?.undonePairs ?? [];
|
|
56
|
+
const undone = [...new Set([...previous, pairKey])];
|
|
57
|
+
const all = allPairs.length > 0 ? allPairs.every(key => undone.includes(key)) : true;
|
|
58
|
+
await writeRunMeta(io, home, {
|
|
59
|
+
version: 1, runId, phase: all ? 'undone' : 'settled',
|
|
60
|
+
...(current?.parentRunId === undefined ? {} : { parentRunId: current.parentRunId }),
|
|
61
|
+
...(current?.pairCount === undefined ? {} : { pairCount: current.pairCount }),
|
|
62
|
+
...(current?.approval === undefined ? {} : { approval: current.approval }),
|
|
63
|
+
...(current?.reportRef === undefined ? {} : { reportRef: current.reportRef }),
|
|
64
|
+
undonePairs: undone,
|
|
65
|
+
...(all ? { undoneAt: new Date(at).toISOString() } : {}),
|
|
66
|
+
createdAt: current?.createdAt ?? new Date(at).toISOString(), updatedAt: new Date(at).toISOString(),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export async function runUndoOperation(options) {
|
|
70
|
+
const allReceipts = (await readCommitReceipts(options.io, options.home)).filter(receipt => (receipt.parentRunId ?? receipt.runId) === options.runId);
|
|
71
|
+
const allPairKeys = allReceipts.map(receipt => receipt.pairKey ?? receipt.unitId);
|
|
72
|
+
const receipts = options.pairKey === undefined ? allReceipts : allReceipts.filter(receipt => receipt.pairKey === options.pairKey);
|
|
73
|
+
if (receipts.length === 0)
|
|
74
|
+
return { ok: false, message: 'merge run has no commit receipt: ' + options.runId, undone: [] };
|
|
75
|
+
const pairs = receipts.map(receipt => ({ pairKey: receipt.pairKey ?? receipt.unitId, unitId: receipt.unitId, phase: 'pending' }));
|
|
76
|
+
await writeUndoJournal(options.io, options.home, { version: 1, runId: options.runId, phase: 'prepared', pairs, updatedAt: new Date(options.now()).toISOString() });
|
|
77
|
+
const undone = [];
|
|
78
|
+
for (const receipt of sortReceipts(receipts)) {
|
|
79
|
+
const pairKey = receipt.pairKey ?? receipt.unitId;
|
|
80
|
+
if (options.finalizeUnit !== undefined) {
|
|
81
|
+
const finalized = await options.finalizeUnit(receipt.unitId);
|
|
82
|
+
if (!finalized.ok)
|
|
83
|
+
return { ok: false, message: finalized.message ?? 'unit finalize failed', undone };
|
|
84
|
+
}
|
|
85
|
+
const existing = await readUndoReceipt(options.io, options.home, options.runId, pairKey);
|
|
86
|
+
if (existing !== null) {
|
|
87
|
+
await options.onPhase?.('pair-index', pairKey);
|
|
88
|
+
await recordPair(options.io, options.home, { pairKey, runId: options.runId, result: 'undone', target: receipt.target });
|
|
89
|
+
await options.onPhase?.('run-meta', pairKey);
|
|
90
|
+
await settleRun(options.io, options.home, options.runId, pairKey, allPairKeys, options.now());
|
|
91
|
+
undone.push(pairKey);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const checked = await preflight(options.io, options.home, options.port, receipt);
|
|
95
|
+
if ('ok' in checked)
|
|
96
|
+
return { ...checked, undone };
|
|
97
|
+
if (checked.done) {
|
|
98
|
+
await options.onPhase?.('receipt', pairKey);
|
|
99
|
+
await writeUndoReceipt(options.io, options.home, { version: 1, runId: options.runId, ...(receipt.parentRunId === undefined ? {} : { parentRunId: receipt.parentRunId }), pairKey, unitId: receipt.unitId, evidenceSha256: receipt.evidenceSha256 ?? unitEvidenceDigest(checked.evidence), target: receipt.target, sources: checked.evidence.sources.map(source => source.name), restoredTargetHash: receipt.create ? null : digest(checked.evidence.target.before), restoredSourceHashes: Object.fromEntries(checked.evidence.sources.map(source => [source.name, contentHash(source.before)])), at: options.now() });
|
|
100
|
+
await options.onPhase?.('pair-index', pairKey);
|
|
101
|
+
await recordPair(options.io, options.home, { pairKey, runId: options.runId, result: 'undone', target: receipt.target });
|
|
102
|
+
await options.onPhase?.('run-meta', pairKey);
|
|
103
|
+
await settleRun(options.io, options.home, options.runId, pairKey, allPairKeys, options.now());
|
|
104
|
+
undone.push(pairKey);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (!checked.targetDone || !checked.sourcesDone) {
|
|
108
|
+
const targetStage = checked.targetDone ? 'skip' : 'restore';
|
|
109
|
+
const sourceStage = checked.sourcesDone ? 'skip' : 'restore';
|
|
110
|
+
if (targetStage === 'skip' && sourceStage === 'skip') { /* unreachable, done */ }
|
|
111
|
+
}
|
|
112
|
+
if (checked.targetDone !== checked.sourcesDone && (checked.targetDone || checked.sourcesDone)) {
|
|
113
|
+
return { ok: false, code: 'undo-partial-state', message: 'undo is partially applied; manual retry required', undone };
|
|
114
|
+
}
|
|
115
|
+
const phase = (next) => ({ pairKey, unitId: receipt.unitId, phase: next });
|
|
116
|
+
await writeUndoJournal(options.io, options.home, { version: 1, runId: options.runId, phase: 'running', pairs: pairs.map(pair => pair.pairKey === pairKey ? phase('restore-target') : pair), updatedAt: new Date(options.now()).toISOString() });
|
|
117
|
+
await options.onPhase?.('restore-target', pairKey);
|
|
118
|
+
const executed = await undoMergeReceipt(receipt, options.port);
|
|
119
|
+
if (!executed.ok)
|
|
120
|
+
return { ok: false, message: executed.message, undone };
|
|
121
|
+
await writeUndoJournal(options.io, options.home, { version: 1, runId: options.runId, phase: 'running', pairs: pairs.map(pair => pair.pairKey === pairKey ? phase('restore-source') : pair), updatedAt: new Date(options.now()).toISOString() });
|
|
122
|
+
await options.onPhase?.('restore-source', pairKey);
|
|
123
|
+
await writeUndoJournal(options.io, options.home, { version: 1, runId: options.runId, phase: 'running', pairs: pairs.map(pair => pair.pairKey === pairKey ? phase('receipt') : pair), updatedAt: new Date(options.now()).toISOString() });
|
|
124
|
+
await options.onPhase?.('receipt', pairKey);
|
|
125
|
+
await writeUndoReceipt(options.io, options.home, { version: 1, runId: options.runId, ...(receipt.parentRunId === undefined ? {} : { parentRunId: receipt.parentRunId }), pairKey, unitId: receipt.unitId, evidenceSha256: receipt.evidenceSha256 ?? unitEvidenceDigest(checked.evidence), target: receipt.target, sources: checked.evidence.sources.map(source => source.name), restoredTargetHash: receipt.create ? null : digest(checked.evidence.target.before), restoredSourceHashes: Object.fromEntries(checked.evidence.sources.map(source => [source.name, contentHash(source.before)])), at: options.now() });
|
|
126
|
+
await options.onPhase?.('pair-index', pairKey);
|
|
127
|
+
await recordPair(options.io, options.home, { pairKey, runId: options.runId, result: 'undone', target: receipt.target });
|
|
128
|
+
await options.onPhase?.('run-meta', pairKey);
|
|
129
|
+
await settleRun(options.io, options.home, options.runId, pairKey, allPairKeys, options.now());
|
|
130
|
+
undone.push(pairKey);
|
|
131
|
+
}
|
|
132
|
+
await writeUndoJournal(options.io, options.home, { version: 1, runId: options.runId, phase: 'settled', pairs: pairs.map(pair => ({ ...pair, phase: 'done' })), updatedAt: new Date(options.now()).toISOString() });
|
|
133
|
+
return { ok: true, message: 'undone ' + String(undone.length) + ' pair(s)', undone };
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=undo-operation.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
|
|
2
|
+
import type { UnitClaimPort } from '@lmzhen/dsh-evolution-core';
|
|
3
|
+
/** Commit-phase claim: 24h is only stale recovery; commit releases immediately, no approve TTL. */
|
|
4
|
+
export declare function targetClaimUnitPort(io: EvolutionIoLike, home: string, now: () => number): UnitClaimPort;
|
|
5
|
+
//# sourceMappingURL=unit-claim.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { acquireTargetClaim, releaseTargetClaimQuietly } from "./target-claim.js";
|
|
2
|
+
/** Commit-phase claim: 24h is only stale recovery; commit releases immediately, no approve TTL. */
|
|
3
|
+
export function targetClaimUnitPort(io, home, now) {
|
|
4
|
+
return {
|
|
5
|
+
async acquire(target) {
|
|
6
|
+
const claim = await acquireTargetClaim(io, home, target, now());
|
|
7
|
+
if (claim === null)
|
|
8
|
+
throw new Error('target-claim-busy: ' + target);
|
|
9
|
+
return {
|
|
10
|
+
async release() { await releaseTargetClaimQuietly(claim); },
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=unit-claim.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** G5-4 wire projections from merge rows to the frozen envelopes. */
|
|
2
|
+
import type { RunRecord } from '@lmzhen/dsh-evolution-core';
|
|
3
|
+
import type { MergeRow } from './contracts.ts';
|
|
4
|
+
import type { BodyView, DoctorView, HistoryView, MergeCounts, QueueId, QueuePage, RowFact, RunView, RunsView } from './wire.ts';
|
|
5
|
+
/** Host-owned row actions; client only renders/copies them. */
|
|
6
|
+
export declare function actionRefs(row: MergeRow): RowFact['actions'];
|
|
7
|
+
export declare function toRowFact(row: MergeRow, actions?: RowFact['actions']): RowFact;
|
|
8
|
+
export declare function toQueuePage(rows: readonly MergeRow[], queue: QueueId, expiredOnly: boolean, readAt: number, limit?: number): QueuePage;
|
|
9
|
+
export declare function toRunsView(runs: readonly RunRecord[], readAt: number): RunsView;
|
|
10
|
+
export interface DoctorSourceFact {
|
|
11
|
+
readonly key: string;
|
|
12
|
+
readonly status: 'ok' | 'warn' | 'fail' | 'unknown';
|
|
13
|
+
readonly count?: number;
|
|
14
|
+
readonly detail?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function toDoctorView(input: {
|
|
17
|
+
readonly readAt: number;
|
|
18
|
+
readonly counts: MergeCounts;
|
|
19
|
+
readonly latestRun?: RunView;
|
|
20
|
+
readonly approval: {
|
|
21
|
+
mergeApproval: boolean;
|
|
22
|
+
writeApproval?: boolean;
|
|
23
|
+
};
|
|
24
|
+
readonly staging: DoctorView['staging'];
|
|
25
|
+
readonly rows: readonly DoctorSourceFact[];
|
|
26
|
+
}): DoctorView;
|
|
27
|
+
export declare function toBodyView(name: string, side: 'live' | 'archive', text: string, readAt: number): BodyView;
|
|
28
|
+
export declare function toHistoryView(items: readonly {
|
|
29
|
+
name: string;
|
|
30
|
+
kind: 'merged' | 'deleted' | 'split' | 'other';
|
|
31
|
+
reason: string;
|
|
32
|
+
lastVersion: number;
|
|
33
|
+
archivedAt: string;
|
|
34
|
+
sourceRunId?: string;
|
|
35
|
+
}[], readAt: number): HistoryView;
|
|
36
|
+
//# sourceMappingURL=wire-projection.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { countsOf, toRunView } from "./facts.js";
|
|
2
|
+
const queueOf = (row) => row.state === 'approved' ? 'fuse' : row.queue;
|
|
3
|
+
const expiredOf = (row) => row.expired !== undefined;
|
|
4
|
+
/** Host-owned row actions; client only renders/copies them. */
|
|
5
|
+
export function actionRefs(row) {
|
|
6
|
+
const base = '/evolution merge ';
|
|
7
|
+
const disabled = row.expired === undefined ? undefined : 'expired';
|
|
8
|
+
const action = (id, confirm = false, enabled = true) => ({ id, command: base + id + ' ' + row.id, confirm, enabled, ...(enabled ? {} : { disabledReason: disabled ?? 'invalid' }) });
|
|
9
|
+
if (row.state === 'pending' && row.expired !== undefined)
|
|
10
|
+
return [{ id: 'discard', command: base + 'discard ' + row.id, confirm: true, enabled: true }, { id: 'pair', command: base + 'pair ' + row.a + ' ' + row.b, confirm: true, enabled: true }];
|
|
11
|
+
if (row.state === 'pending')
|
|
12
|
+
return [action('approve'), action('reject', true), action('discard', true)];
|
|
13
|
+
if (row.state === 'approved' || row.state === 'fuse')
|
|
14
|
+
return [action('discard', true), action('status')];
|
|
15
|
+
if (row.state === 'skipped')
|
|
16
|
+
return [action('restore', true)];
|
|
17
|
+
return [action('pair')];
|
|
18
|
+
}
|
|
19
|
+
export function toRowFact(row, actions = actionRefs(row)) {
|
|
20
|
+
return {
|
|
21
|
+
id: row.id,
|
|
22
|
+
state: row.state,
|
|
23
|
+
queue: queueOf(row),
|
|
24
|
+
...(row.state === 'verify' ? { verifySubState: 'queued' } : {}),
|
|
25
|
+
a: row.a,
|
|
26
|
+
b: row.b,
|
|
27
|
+
...(row.target === undefined ? {} : { target: { requested: row.target.requested, ...(row.target.actual === undefined ? {} : { actual: row.target.actual }), ...(row.target.created === undefined ? {} : { created: row.target.created }) } }),
|
|
28
|
+
...(row.state === 'pending' ? { summary: { a: null, b: null, rationale: row.decision?.rationale ?? null } } : {}),
|
|
29
|
+
...(row.reason === undefined ? {} : { reason: row.reason }),
|
|
30
|
+
...(row.state === 'skipped' ? { origin: row.origin ?? 'system' } : {}),
|
|
31
|
+
...(row.failure === undefined ? {} : { failure: { stage: row.failure.stage === 'screening' ? 'screening' : row.failure.stage === 'decide' ? 'decide' : row.failure.stage === 'author' ? 'author' : row.failure.stage === 'validate' ? 'validate' : 'commit', code: row.failure.code, retryable: row.failure.retryable, retryFrom: row.failure.retryFrom } }),
|
|
32
|
+
...(row.stagingRef === undefined ? {} : { staging: { state: 'kept', ...(row.stagingExpiresAt === undefined ? {} : { expiresAt: row.stagingExpiresAt }) } }),
|
|
33
|
+
...(row.expired === undefined ? {} : { expired: { kind: row.expired, at: Date.parse(row.updatedAt) } }),
|
|
34
|
+
...(row.attempts === undefined ? {} : { attempts: row.attempts }),
|
|
35
|
+
...(row.decision?.confidence === undefined ? {} : { confidence: row.decision.confidence }),
|
|
36
|
+
...(row.state === 'skipped' && row.stagingExpiresAt !== undefined ? { expiresAt: row.stagingExpiresAt } : {}),
|
|
37
|
+
createdAt: Date.parse(row.createdAt),
|
|
38
|
+
updatedAt: Date.parse(row.updatedAt),
|
|
39
|
+
actions,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function toQueuePage(rows, queue, expiredOnly, readAt, limit = 50) {
|
|
43
|
+
const filtered = rows.filter(row => queueOf(row) === queue && (expiredOnly ? expiredOf(row) : !expiredOf(row)));
|
|
44
|
+
const page = filtered.slice(0, Math.max(0, Math.min(200, limit)));
|
|
45
|
+
const counts = countsOf(rows);
|
|
46
|
+
return { wireVersion: 1, readAt, queue, expiredOnly, counts, rows: page.map(row => toRowFact(row)), ...(filtered.length > page.length ? { nextCursor: String(page.length) } : {}), notes: [] };
|
|
47
|
+
}
|
|
48
|
+
export function toRunsView(runs, readAt) {
|
|
49
|
+
const ordered = [...runs].sort((a, b) => b.startedAt - a.startedAt).slice(0, 50);
|
|
50
|
+
return { wireVersion: 1, readAt, runs: ordered.map(run => toRunView(run, readAt)) };
|
|
51
|
+
}
|
|
52
|
+
export function toDoctorView(input) {
|
|
53
|
+
return {
|
|
54
|
+
wireVersion: 1,
|
|
55
|
+
readAt: input.readAt,
|
|
56
|
+
counts: input.counts,
|
|
57
|
+
...(input.latestRun === undefined ? {} : { latestRun: input.latestRun }),
|
|
58
|
+
staging: input.staging,
|
|
59
|
+
approval: input.approval,
|
|
60
|
+
rows: input.rows.map(row => ({ key: row.key, status: row.status, ...(row.count === undefined ? {} : { count: row.count }), ...(row.detail === undefined ? {} : { detail: row.detail }) })),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function toBodyView(name, side, text, readAt) {
|
|
64
|
+
return { wireVersion: 1, readAt, name, side, text, markdown: true, truncated: false, totalBytes: Buffer.byteLength(text, 'utf8') };
|
|
65
|
+
}
|
|
66
|
+
export function toHistoryView(items, readAt) {
|
|
67
|
+
return { wireVersion: 1, readAt, items: items.map(item => ({ name: item.name, kind: item.kind, reason: item.reason, lastVersion: item.lastVersion, archivedAt: Date.parse(item.archivedAt), ...(item.sourceRunId === undefined ? {} : { sourceRunId: item.sourceRunId }) })) };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=wire-projection.js.map
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/** Merge wire contract v1. Read-only envelopes shared with the client. */
|
|
2
|
+
export declare const WIRE_VERSION: 1;
|
|
3
|
+
export type QueueId = 'verify' | 'pending' | 'fuse' | 'skipped';
|
|
4
|
+
export type WireRowState = 'verify' | 'pending' | 'approved' | 'fuse' | 'skipped';
|
|
5
|
+
export type RowStage = 'screening' | 'decide' | 'author' | 'validate' | 'commit';
|
|
6
|
+
export type RunStage = RowStage | 'settle';
|
|
7
|
+
export type VerifySubState = 'queued' | 'running' | 'failed' | 'cancelled';
|
|
8
|
+
export type StagingState = 'none' | 'kept' | 'cleared-source-ok' | 'cleared-source-gone';
|
|
9
|
+
export type SkipOrigin = 'agent' | 'human' | 'system';
|
|
10
|
+
export type SkipKind = 'agent-keep' | 'human-reject' | 'over-limit' | 'forced';
|
|
11
|
+
export type ExpiredKind = 'target-taken' | 'source-changed' | 'source-gone' | 'skipped-ttl';
|
|
12
|
+
export type WireRunState = 'running' | 'succeeded' | 'failed' | 'cancelled' | 'awaiting-approval' | 'undone' | 'superseded' | 'interrupted' | 'orphan';
|
|
13
|
+
export type ActionId = 'approve' | 'reject' | 'retry-candidates' | 'retry-resume' | 'resume' | 'discard' | 'restore' | 'pair' | 'status' | 'report' | 'cancel';
|
|
14
|
+
export interface MergeCounts {
|
|
15
|
+
readonly active: {
|
|
16
|
+
readonly verify: number;
|
|
17
|
+
readonly pending: number;
|
|
18
|
+
readonly fuse: number;
|
|
19
|
+
readonly skipped: number;
|
|
20
|
+
};
|
|
21
|
+
readonly expired: number;
|
|
22
|
+
}
|
|
23
|
+
export interface FailureFact {
|
|
24
|
+
readonly stage: RowStage | 'settle';
|
|
25
|
+
readonly code: string;
|
|
26
|
+
readonly retryable: boolean;
|
|
27
|
+
readonly retryFrom: 'agent1' | 'agent2' | 'none';
|
|
28
|
+
readonly detail?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SummarySlots {
|
|
31
|
+
readonly a: string | null;
|
|
32
|
+
readonly b: string | null;
|
|
33
|
+
readonly rationale: string | null;
|
|
34
|
+
}
|
|
35
|
+
export interface CommandRef {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly command: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ActionRef {
|
|
40
|
+
readonly id: ActionId;
|
|
41
|
+
readonly command: string;
|
|
42
|
+
readonly confirm: boolean;
|
|
43
|
+
readonly enabled: boolean;
|
|
44
|
+
readonly disabledReason?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface RowFact {
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly state: WireRowState;
|
|
49
|
+
readonly queue: QueueId;
|
|
50
|
+
readonly verifySubState?: VerifySubState;
|
|
51
|
+
/** Optional Batch4 projection; old staging remains compatibility. */
|
|
52
|
+
readonly stage?: 'present' | 'lost' | 'expired';
|
|
53
|
+
readonly a: string;
|
|
54
|
+
readonly b: string;
|
|
55
|
+
readonly target?: {
|
|
56
|
+
readonly requested: string;
|
|
57
|
+
readonly actual?: string;
|
|
58
|
+
readonly created?: boolean;
|
|
59
|
+
};
|
|
60
|
+
readonly summary?: SummarySlots;
|
|
61
|
+
readonly reason?: string;
|
|
62
|
+
readonly origin?: SkipOrigin;
|
|
63
|
+
readonly skipKind?: SkipKind;
|
|
64
|
+
readonly confidence?: number;
|
|
65
|
+
readonly failure?: FailureFact;
|
|
66
|
+
readonly staging?: {
|
|
67
|
+
readonly state: StagingState;
|
|
68
|
+
readonly expiresAt?: number;
|
|
69
|
+
};
|
|
70
|
+
readonly expired?: {
|
|
71
|
+
readonly kind: ExpiredKind;
|
|
72
|
+
readonly at: number;
|
|
73
|
+
};
|
|
74
|
+
readonly bodies?: readonly {
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly side: 'live' | 'archive';
|
|
77
|
+
}[];
|
|
78
|
+
readonly attempts?: number;
|
|
79
|
+
readonly createdAt: number;
|
|
80
|
+
readonly updatedAt: number;
|
|
81
|
+
readonly expiresAt?: number;
|
|
82
|
+
readonly actions: readonly ActionRef[];
|
|
83
|
+
}
|
|
84
|
+
export interface Facts {
|
|
85
|
+
readonly wireVersion: 1;
|
|
86
|
+
readonly readAt: number;
|
|
87
|
+
readonly approval: {
|
|
88
|
+
readonly mergeApproval: boolean;
|
|
89
|
+
readonly platformWrite?: boolean;
|
|
90
|
+
};
|
|
91
|
+
readonly counts: MergeCounts;
|
|
92
|
+
readonly active: RunView | null;
|
|
93
|
+
readonly last: RunView | null;
|
|
94
|
+
readonly startCommands: {
|
|
95
|
+
readonly scan: string;
|
|
96
|
+
readonly pair: string;
|
|
97
|
+
};
|
|
98
|
+
readonly fallback: readonly CommandRef[];
|
|
99
|
+
readonly notes: readonly string[];
|
|
100
|
+
readonly degraded: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface QueuePage {
|
|
103
|
+
readonly wireVersion: 1;
|
|
104
|
+
readonly readAt: number;
|
|
105
|
+
readonly queue: QueueId;
|
|
106
|
+
readonly expiredOnly: boolean;
|
|
107
|
+
readonly counts: MergeCounts;
|
|
108
|
+
readonly rows: readonly RowFact[];
|
|
109
|
+
readonly nextCursor?: string;
|
|
110
|
+
readonly notes: readonly string[];
|
|
111
|
+
}
|
|
112
|
+
export interface RunView {
|
|
113
|
+
readonly wireVersion: 1;
|
|
114
|
+
readonly readAt: number;
|
|
115
|
+
readonly id: string;
|
|
116
|
+
readonly state: WireRunState;
|
|
117
|
+
readonly command: 'scan' | 'pair' | 'approve' | 'resume';
|
|
118
|
+
readonly stage?: RunStage;
|
|
119
|
+
readonly progress?: {
|
|
120
|
+
readonly done: number;
|
|
121
|
+
readonly total: number;
|
|
122
|
+
} | null;
|
|
123
|
+
readonly startedAt: number;
|
|
124
|
+
readonly endedAt?: number;
|
|
125
|
+
readonly stopReason?: string;
|
|
126
|
+
readonly failure?: FailureFact;
|
|
127
|
+
readonly parentRunId?: string;
|
|
128
|
+
readonly currentPairKey?: string;
|
|
129
|
+
readonly resultRef?: string;
|
|
130
|
+
readonly summary?: {
|
|
131
|
+
readonly merged: number;
|
|
132
|
+
readonly kept: number;
|
|
133
|
+
readonly failed: number;
|
|
134
|
+
readonly pending: number;
|
|
135
|
+
readonly cancelled: number;
|
|
136
|
+
};
|
|
137
|
+
readonly actions: readonly ActionRef[];
|
|
138
|
+
}
|
|
139
|
+
export interface RunPair {
|
|
140
|
+
readonly pairKey: string;
|
|
141
|
+
readonly a: string;
|
|
142
|
+
readonly b: string;
|
|
143
|
+
readonly outcome: 'merged' | 'kept' | 'pending' | 'failed' | 'rejected' | 'cancelled' | 'undone';
|
|
144
|
+
readonly stage?: RowStage;
|
|
145
|
+
readonly code?: string;
|
|
146
|
+
readonly detail?: string;
|
|
147
|
+
readonly target?: {
|
|
148
|
+
readonly requested: string;
|
|
149
|
+
readonly actual?: string;
|
|
150
|
+
readonly created?: boolean;
|
|
151
|
+
};
|
|
152
|
+
readonly actions?: readonly ActionRef[];
|
|
153
|
+
}
|
|
154
|
+
export interface RunDetail extends RunView {
|
|
155
|
+
readonly pairs: readonly RunPair[];
|
|
156
|
+
readonly pairsTruncated: boolean;
|
|
157
|
+
readonly meta?: {
|
|
158
|
+
readonly pairKey?: string;
|
|
159
|
+
readonly phase?: string;
|
|
160
|
+
readonly approval?: string;
|
|
161
|
+
};
|
|
162
|
+
readonly reportRef?: string;
|
|
163
|
+
}
|
|
164
|
+
export interface RunsView {
|
|
165
|
+
readonly wireVersion: 1;
|
|
166
|
+
readonly readAt: number;
|
|
167
|
+
readonly runs: readonly RunView[];
|
|
168
|
+
}
|
|
169
|
+
export interface BodyView {
|
|
170
|
+
readonly wireVersion: 1;
|
|
171
|
+
readonly readAt: number;
|
|
172
|
+
readonly name: string;
|
|
173
|
+
readonly side: 'live' | 'archive';
|
|
174
|
+
readonly text: string;
|
|
175
|
+
readonly markdown: boolean;
|
|
176
|
+
readonly truncated: boolean;
|
|
177
|
+
readonly totalBytes: number;
|
|
178
|
+
}
|
|
179
|
+
export interface HistoryItem {
|
|
180
|
+
readonly name: string;
|
|
181
|
+
readonly kind: 'merged' | 'deleted' | 'split' | 'other';
|
|
182
|
+
readonly reason: string;
|
|
183
|
+
readonly reasonCode?: string;
|
|
184
|
+
readonly generation?: number;
|
|
185
|
+
readonly lastVersion: number;
|
|
186
|
+
readonly archivedAt: number;
|
|
187
|
+
readonly sourceRunId?: string;
|
|
188
|
+
readonly runId?: string;
|
|
189
|
+
readonly absorbedInto?: string;
|
|
190
|
+
}
|
|
191
|
+
export interface HistoryView {
|
|
192
|
+
readonly wireVersion: 1;
|
|
193
|
+
readonly readAt: number;
|
|
194
|
+
readonly items: readonly HistoryItem[];
|
|
195
|
+
}
|
|
196
|
+
export interface DoctorFact {
|
|
197
|
+
readonly key: string;
|
|
198
|
+
readonly status: 'ok' | 'warn' | 'fail' | 'unknown';
|
|
199
|
+
readonly code?: string;
|
|
200
|
+
readonly count?: number;
|
|
201
|
+
readonly detail?: string;
|
|
202
|
+
}
|
|
203
|
+
export interface DoctorView {
|
|
204
|
+
readonly wireVersion: 1;
|
|
205
|
+
readonly readAt: number;
|
|
206
|
+
readonly counts: MergeCounts;
|
|
207
|
+
readonly latestRun?: RunView;
|
|
208
|
+
readonly staging: {
|
|
209
|
+
readonly state: 'ok' | 'absent' | 'unreadable';
|
|
210
|
+
readonly dirs: number;
|
|
211
|
+
readonly oldestAgeMs?: number;
|
|
212
|
+
readonly detail?: string;
|
|
213
|
+
};
|
|
214
|
+
readonly approval: {
|
|
215
|
+
readonly mergeApproval: boolean;
|
|
216
|
+
readonly writeApproval?: boolean;
|
|
217
|
+
};
|
|
218
|
+
readonly hostOnly?: {
|
|
219
|
+
readonly code: 'E-323';
|
|
220
|
+
readonly detail?: string;
|
|
221
|
+
};
|
|
222
|
+
/** Set when the read model cannot read the merge state; the rows are empty placeholders. */
|
|
223
|
+
readonly blocked?: {
|
|
224
|
+
readonly code: string;
|
|
225
|
+
readonly message: string;
|
|
226
|
+
};
|
|
227
|
+
readonly rows: readonly DoctorFact[];
|
|
228
|
+
}
|
|
229
|
+
export interface WireFailure {
|
|
230
|
+
readonly wireVersion: 1;
|
|
231
|
+
readonly readAt?: number;
|
|
232
|
+
readonly code: string;
|
|
233
|
+
readonly message?: string;
|
|
234
|
+
}
|
|
235
|
+
export interface CommandFlagSpec {
|
|
236
|
+
readonly name: string;
|
|
237
|
+
readonly kind: 'boolean' | 'value';
|
|
238
|
+
readonly valueName?: string;
|
|
239
|
+
readonly required?: boolean;
|
|
240
|
+
readonly repeatable?: boolean;
|
|
241
|
+
readonly values?: readonly string[];
|
|
242
|
+
}
|
|
243
|
+
export interface CommandPositionalSpec {
|
|
244
|
+
readonly name: string;
|
|
245
|
+
readonly kind: 'skill' | 'target' | 'runId' | 'id' | 'json' | 'text';
|
|
246
|
+
readonly required: boolean;
|
|
247
|
+
readonly variadic?: boolean;
|
|
248
|
+
}
|
|
249
|
+
export interface CommandActionRule {
|
|
250
|
+
readonly id: ActionId;
|
|
251
|
+
readonly command: string;
|
|
252
|
+
readonly confirm?: boolean;
|
|
253
|
+
readonly enabledWhen?: string;
|
|
254
|
+
}
|
|
255
|
+
export interface CommandSpec {
|
|
256
|
+
readonly id: string;
|
|
257
|
+
readonly words: readonly string[];
|
|
258
|
+
readonly flags: readonly CommandFlagSpec[];
|
|
259
|
+
readonly positional: readonly CommandPositionalSpec[];
|
|
260
|
+
readonly summary: string;
|
|
261
|
+
readonly readOnly: boolean;
|
|
262
|
+
readonly needsRun: boolean;
|
|
263
|
+
readonly defaults: Readonly<Record<string, string>>;
|
|
264
|
+
readonly rowActions: readonly CommandActionRule[];
|
|
265
|
+
readonly fallback: string;
|
|
266
|
+
}
|
|
267
|
+
export interface CommandSurface {
|
|
268
|
+
readonly wireVersion: 1;
|
|
269
|
+
readonly prefix: '/evolution merge';
|
|
270
|
+
readonly commands: readonly CommandSpec[];
|
|
271
|
+
readonly fallback: readonly CommandRef[];
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=wire.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-merge",
|
|
3
3
|
"description": "Skill auto-merge domain: screening, two-round authoring, queues and commit orchestration (community build)",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.19",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -22,13 +22,19 @@
|
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"lib/**/*.js",
|
|
25
|
-
"lib/types/**/*.d.ts"
|
|
25
|
+
"lib/types/**/*.d.ts",
|
|
26
|
+
"data/**/*",
|
|
27
|
+
"package.json"
|
|
26
28
|
],
|
|
27
29
|
"license": "MIT",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"verify:publish-manifest": "node scripts/verify-publish-manifest.mjs"
|
|
32
|
+
},
|
|
28
33
|
"dependencies": {
|
|
29
34
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
30
|
-
"@lmzhen/dsh-evolution-core": "^0.30.
|
|
31
|
-
"@lmzhen/dsh-evolution-
|
|
35
|
+
"@lmzhen/dsh-evolution-core": "^0.30.19",
|
|
36
|
+
"@lmzhen/dsh-evolution-commands": "^0.30.19",
|
|
37
|
+
"@lmzhen/dsh-evolution-merge-engine": "0.30.19"
|
|
32
38
|
},
|
|
33
39
|
"peerDependencies": {
|
|
34
40
|
"@deepseek-ai/cordis": "^4.0.5"
|
package/lib/types/routes.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Read-only view models for the four merge routes. Pure functions; the host loads rows and
|
|
3
|
-
* runs, the client renders these shapes. No io, no write paths.
|
|
4
|
-
*/
|
|
5
|
-
import type { RunRecord } from '@lmzhen/dsh-evolution-core';
|
|
6
|
-
import type { MergeQueue, MergeRow } from './contracts.ts';
|
|
7
|
-
import { type MergeCounts } from './status.ts';
|
|
8
|
-
export interface MergeRowView {
|
|
9
|
-
readonly id: string;
|
|
10
|
-
readonly pairKey: string;
|
|
11
|
-
readonly a: string;
|
|
12
|
-
readonly b: string;
|
|
13
|
-
readonly state: MergeRow['state'];
|
|
14
|
-
readonly queue: MergeQueue;
|
|
15
|
-
readonly stage: string | null;
|
|
16
|
-
readonly label: string;
|
|
17
|
-
readonly updatedAt: string;
|
|
18
|
-
readonly createdAt: string;
|
|
19
|
-
readonly target?: string;
|
|
20
|
-
readonly confidence?: number;
|
|
21
|
-
readonly aSummary?: string;
|
|
22
|
-
readonly bSummary?: string;
|
|
23
|
-
readonly rationale?: string;
|
|
24
|
-
readonly failure?: {
|
|
25
|
-
readonly stage: string;
|
|
26
|
-
readonly code: string;
|
|
27
|
-
readonly message: string;
|
|
28
|
-
readonly retryable: boolean;
|
|
29
|
-
};
|
|
30
|
-
readonly attempts?: number;
|
|
31
|
-
readonly origin?: 'agent' | 'human' | 'system';
|
|
32
|
-
readonly stagingExpiresAt?: number;
|
|
33
|
-
readonly expired?: 'target-taken' | 'source-changed';
|
|
34
|
-
readonly reason?: string;
|
|
35
|
-
readonly summary?: readonly string[];
|
|
36
|
-
readonly actions: readonly string[];
|
|
37
|
-
}
|
|
38
|
-
export declare function toRowView(row: MergeRow): MergeRowView;
|
|
39
|
-
export interface MergeView {
|
|
40
|
-
readonly schemaVersion: 2;
|
|
41
|
-
readonly counts: MergeCounts;
|
|
42
|
-
readonly tabs: readonly {
|
|
43
|
-
readonly queue: MergeQueue;
|
|
44
|
-
readonly count: number;
|
|
45
|
-
}[];
|
|
46
|
-
readonly commands: readonly string[];
|
|
47
|
-
readonly latestRun?: MergeRunFact;
|
|
48
|
-
readonly approval?: boolean;
|
|
49
|
-
}
|
|
50
|
-
export declare function buildMergeView(rows: readonly MergeRow[], commands: readonly string[], latestRun?: MergeRunFact, approval?: boolean): MergeView;
|
|
51
|
-
export interface QueuePage {
|
|
52
|
-
readonly queue: MergeQueue;
|
|
53
|
-
readonly items: readonly MergeRowView[];
|
|
54
|
-
readonly nextCursor?: string;
|
|
55
|
-
}
|
|
56
|
-
export declare function pageQueue(rows: readonly MergeRow[], queue: MergeQueue, cursor?: number, limit?: number): QueuePage;
|
|
57
|
-
export interface MergeRunFact {
|
|
58
|
-
readonly id: string;
|
|
59
|
-
readonly state: RunRecord['state'];
|
|
60
|
-
readonly command?: RunRecord['command'];
|
|
61
|
-
readonly stage?: RunRecord['stage'];
|
|
62
|
-
readonly progress?: RunRecord['progress'];
|
|
63
|
-
readonly startedAt: number;
|
|
64
|
-
readonly endedAt?: number;
|
|
65
|
-
readonly resultRef?: string;
|
|
66
|
-
readonly failure?: string;
|
|
67
|
-
readonly supersededAt?: number;
|
|
68
|
-
}
|
|
69
|
-
export declare function toRunFact(run: RunRecord): MergeRunFact;
|
|
70
|
-
//# sourceMappingURL=routes.d.ts.map
|