@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
|
@@ -19,6 +19,7 @@ export interface RunScanCommandOptions {
|
|
|
19
19
|
readonly detached?: boolean;
|
|
20
20
|
readonly notes?: readonly string[];
|
|
21
21
|
readonly isOwnerActive?: (runId: string) => boolean | Promise<boolean>;
|
|
22
|
+
readonly cards?: readonly import('./skill-card.ts').SkillCard[];
|
|
22
23
|
}
|
|
23
24
|
export declare function runScanCommand(options: RunScanCommandOptions): Promise<WithMergeRunResult>;
|
|
24
25
|
//# sourceMappingURL=scan-command.d.ts.map
|
|
@@ -9,6 +9,7 @@ export async function runScanCommand(options) {
|
|
|
9
9
|
approval: { platformWrite: options.platformWrite, mergeApproval: options.approval },
|
|
10
10
|
now: options.now,
|
|
11
11
|
...(options.detached === undefined ? {} : { detached: options.detached }),
|
|
12
|
+
...(options.timeoutMinutes === undefined ? {} : { timeoutMinutes: options.timeoutMinutes }),
|
|
12
13
|
async body(ctx) {
|
|
13
14
|
const ports = options.makePorts === undefined ? options.ports : options.makePorts(ctx.runId);
|
|
14
15
|
if (ports === undefined)
|
|
@@ -26,6 +27,7 @@ export async function runScanCommand(options) {
|
|
|
26
27
|
...(options.timeoutMinutes === undefined ? {} : { timeoutMinutes: options.timeoutMinutes }),
|
|
27
28
|
...(options.notes === undefined ? {} : { notes: options.notes }),
|
|
28
29
|
...(options.isOwnerActive === undefined ? {} : { isOwnerActive: options.isOwnerActive }),
|
|
30
|
+
...(options.cards === undefined ? {} : { cards: options.cards }),
|
|
29
31
|
});
|
|
30
32
|
},
|
|
31
33
|
});
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
* Approval on: round1 disposes the child immediately; the row waits in pending and the later
|
|
6
6
|
* approve run must open a new child (not handled by this factory).
|
|
7
7
|
*/
|
|
8
|
-
import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
|
|
8
|
+
import type { EvolutionIoLike, UnitTransaction } from '@lmzhen/dsh-evolution-core';
|
|
9
|
+
import type { MergeDecision, MergeRow } from './contracts.ts';
|
|
9
10
|
import type { SkillCard } from './skill-card.ts';
|
|
10
11
|
import { type ConversationChannelLike } from './channel-port.ts';
|
|
11
12
|
import type { CommitPort } from './commit-execute.ts';
|
|
12
13
|
import type { StageToolContext } from './stage-tool.ts';
|
|
14
|
+
import { type StageEntry } from './domain/stage-aggregate.ts';
|
|
13
15
|
import type { ScanPorts } from './scan-run.ts';
|
|
14
16
|
export interface CreateScanPortsOptions {
|
|
15
17
|
readonly io: EvolutionIoLike;
|
|
@@ -17,6 +19,7 @@ export interface CreateScanPortsOptions {
|
|
|
17
19
|
readonly runId: string;
|
|
18
20
|
readonly cards: readonly SkillCard[];
|
|
19
21
|
readonly screening: ScanPorts['screening'];
|
|
22
|
+
readonly resolve?: ScanPorts['resolve'];
|
|
20
23
|
readonly channel: ConversationChannelLike;
|
|
21
24
|
readonly parent: unknown;
|
|
22
25
|
readonly allow: readonly string[];
|
|
@@ -24,9 +27,26 @@ export interface CreateScanPortsOptions {
|
|
|
24
27
|
readonly timeoutMs: number;
|
|
25
28
|
readonly approval: boolean;
|
|
26
29
|
readonly commitPort: CommitPort;
|
|
30
|
+
readonly unit?: UnitTransaction | undefined;
|
|
31
|
+
readonly limits?: import('@lmzhen/dsh-evolution-core').SkillLimits | undefined;
|
|
27
32
|
readonly now: () => number;
|
|
33
|
+
readonly isBlocked?: (name: string) => boolean | Promise<boolean>;
|
|
28
34
|
readonly onChild?: (context: StageToolContext) => void;
|
|
29
35
|
readonly onChildClosed?: (childId: string) => void;
|
|
30
36
|
}
|
|
37
|
+
export interface StageForCardsOptions {
|
|
38
|
+
readonly io: EvolutionIoLike;
|
|
39
|
+
readonly home: string;
|
|
40
|
+
readonly runId: string;
|
|
41
|
+
readonly cards: readonly SkillCard[];
|
|
42
|
+
readonly now: () => number;
|
|
43
|
+
}
|
|
44
|
+
export declare function createStageForCards(options: StageForCardsOptions): (row: MergeRow, decision: MergeDecision) => Promise<{
|
|
45
|
+
readonly ok: true;
|
|
46
|
+
readonly entry: StageEntry;
|
|
47
|
+
} | {
|
|
48
|
+
readonly ok: false;
|
|
49
|
+
readonly message: string;
|
|
50
|
+
}>;
|
|
31
51
|
export declare function createChannelScanPorts(options: CreateScanPortsOptions): ScanPorts;
|
|
32
52
|
//# sourceMappingURL=scan-ports.d.ts.map
|
package/lib/types/scan-ports.js
CHANGED
|
@@ -1,39 +1,49 @@
|
|
|
1
1
|
import { pairKey } from "./contracts.js";
|
|
2
|
+
function classifyCommitFailure(message) {
|
|
3
|
+
if (message.includes('目标技能') && (message.includes('被改过') || message.includes('不存在')))
|
|
4
|
+
return message.includes('被改过') ? 'target-changed' : 'target-taken';
|
|
5
|
+
if (message.includes('来源技能') && message.includes('被改过'))
|
|
6
|
+
return 'source-changed';
|
|
7
|
+
if (message.includes('来源技能') && message.includes('不存在'))
|
|
8
|
+
return 'source-gone';
|
|
9
|
+
return 'authoring-failed';
|
|
10
|
+
}
|
|
2
11
|
import { runRound1OverChannel } from "./channel-port.js";
|
|
3
12
|
import { runAuthoring } from "./authoring-flow.js";
|
|
4
|
-
import {
|
|
13
|
+
import { buildRound2Prompt, MERGE_PROMPT_VERSION, promptHashOf } from "./prompts.js";
|
|
14
|
+
import { stageKeyOf } from "./staging.js";
|
|
15
|
+
import { createStageTree, reserveStage } from "./domain/stage-aggregate.js";
|
|
5
16
|
import { sourceRevisionOf, targetRevisionOf } from "./revision.js";
|
|
17
|
+
export function createStageForCards(options) {
|
|
18
|
+
return async (row, decision) => {
|
|
19
|
+
const stageKey = stageKeyOf(options.runId, pairKey(row.a, row.b));
|
|
20
|
+
const entry = { version: 1, rowId: row.id, pairKey: row.pairKey, runId: options.runId, ref: stageKey, state: 'reserved', createdAt: options.now(), expiresAt: options.now() + 7 * 86_400_000, updatedAt: options.now() };
|
|
21
|
+
await reserveStage(options.io, options.home, entry);
|
|
22
|
+
const staged = await createStageTree(options.io, options.home, {
|
|
23
|
+
runId: stageKey, target: decision.target,
|
|
24
|
+
sources: options.cards.filter(card => card.name === row.a || card.name === row.b).map(card => ({ name: card.name, body: card.body, files: card.files ?? [] })),
|
|
25
|
+
promptVersion: 'merge-b/v1', ttlDays: 7, now: options.now,
|
|
26
|
+
});
|
|
27
|
+
return staged.ok ? { ok: true, entry } : { ok: false, message: staged.message };
|
|
28
|
+
};
|
|
29
|
+
}
|
|
6
30
|
export function createChannelScanPorts(options) {
|
|
7
31
|
const sessions = new Map();
|
|
8
32
|
return {
|
|
9
33
|
screening: options.screening,
|
|
34
|
+
...(options.resolve === undefined ? {} : { resolve: options.resolve }),
|
|
10
35
|
async round1(candidate, signal) {
|
|
11
36
|
const stageKey = stageKeyOf(options.runId, pairKey(candidate.a, candidate.b));
|
|
12
|
-
const staged = await ensureStaging(options.io, options.home, {
|
|
13
|
-
runId: stageKey,
|
|
14
|
-
target: candidate.a + '-' + candidate.b,
|
|
15
|
-
sources: options.cards
|
|
16
|
-
.filter(card => card.name === candidate.a || card.name === candidate.b)
|
|
17
|
-
.map(card => ({ name: card.name, body: card.body, files: card.files ?? [] })),
|
|
18
|
-
promptVersion: 'merge-b/v1',
|
|
19
|
-
ttlDays: 7,
|
|
20
|
-
now: options.now,
|
|
21
|
-
});
|
|
22
|
-
if (!staged.ok)
|
|
23
|
-
return { kind: 'failed', failure: { stage: 'decide', code: 'staging-create', message: staged.message, retryable: true, retryFrom: 'agent1' } };
|
|
24
37
|
const result = await runRound1OverChannel({
|
|
25
38
|
channel: options.channel,
|
|
26
39
|
parent: options.parent,
|
|
27
40
|
cards: options.cards,
|
|
28
41
|
allow: options.allow,
|
|
29
|
-
cwd:
|
|
42
|
+
cwd: options.cwd ?? options.home,
|
|
30
43
|
timeoutMs: options.timeoutMs,
|
|
31
44
|
onChildOpened: childId => options.onChild?.({ runId: stageKey, childId, expectedChildId: childId, phase: 'decide' }),
|
|
32
45
|
}, candidate, signal);
|
|
33
|
-
if (result.outcome.kind
|
|
34
|
-
await dropStaging(options.io, options.home, stageKey);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
46
|
+
if (result.outcome.kind === 'merge') {
|
|
37
47
|
if (options.approval)
|
|
38
48
|
await result.dispose();
|
|
39
49
|
else {
|
|
@@ -43,6 +53,7 @@ export function createChannelScanPorts(options) {
|
|
|
43
53
|
}
|
|
44
54
|
}
|
|
45
55
|
}
|
|
56
|
+
const round1Usage = result.usage?.();
|
|
46
57
|
const sourceRevision = result.outcome.kind === 'merge' ? sourceRevisionOf(options.cards, candidate.a, candidate.b) : undefined;
|
|
47
58
|
const target = result.outcome.kind === 'merge' ? result.outcome.decision?.target : undefined;
|
|
48
59
|
const targetRevision = target === undefined ? undefined : targetRevisionOf(options.cards, target);
|
|
@@ -51,9 +62,13 @@ export function createChannelScanPorts(options) {
|
|
|
51
62
|
...result.outcome, stagingRef: stageKey, stagingExpiresAt: options.now() + 7 * 86_400_000,
|
|
52
63
|
...(sourceRevision === undefined ? {} : { sourceRevision }),
|
|
53
64
|
...(targetRevision === undefined ? {} : { targetRevision }),
|
|
65
|
+
...(round1Usage === undefined ? {} : { usage: round1Usage }),
|
|
54
66
|
}
|
|
55
|
-
: result.outcome
|
|
67
|
+
: result.outcome.kind === 'failed'
|
|
68
|
+
? { ...result.outcome, degraded: ['round1 child failed: ' + (result.outcome.failure?.code ?? 'unknown')], ...(round1Usage === undefined ? {} : { usage: round1Usage }) }
|
|
69
|
+
: { ...result.outcome, ...(round1Usage === undefined ? {} : { usage: round1Usage }) };
|
|
56
70
|
},
|
|
71
|
+
stage: createStageForCards({ io: options.io, home: options.home, runId: options.runId, cards: options.cards, now: options.now }),
|
|
57
72
|
async round2(row, decision, signal) {
|
|
58
73
|
const key = pairKey(row.a, row.b);
|
|
59
74
|
const entry = sessions.get(key);
|
|
@@ -72,20 +87,33 @@ export function createChannelScanPorts(options) {
|
|
|
72
87
|
mode: decision.mode,
|
|
73
88
|
cards: options.cards,
|
|
74
89
|
commitPort: options.commitPort,
|
|
90
|
+
...(options.unit === undefined ? {} : { unit: options.unit }),
|
|
75
91
|
now: options.now,
|
|
92
|
+
...(options.isBlocked === undefined ? {} : { isBlocked: options.isBlocked }),
|
|
76
93
|
summary: 'merge ' + row.a + ' + ' + row.b,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
94
|
+
...(options.limits === undefined ? {} : { limits: options.limits }),
|
|
95
|
+
promptVersion: MERGE_PROMPT_VERSION,
|
|
96
|
+
promptHash: promptHashOf(buildRound2Prompt(row, decision)),
|
|
97
|
+
revisions: {
|
|
98
|
+
...(decision.targetRevisionRef === undefined ? {} : { targetRevision: decision.targetRevisionRef }),
|
|
99
|
+
...(decision.sourceRevisions === undefined ? {} : { sourceRevisions: decision.sourceRevisions }),
|
|
100
|
+
...(decision.supportDigest === undefined ? {} : { supportDigest: decision.supportDigest }),
|
|
80
101
|
},
|
|
102
|
+
author: async () => (await entry.result.author?.(row, decision, signal)) ?? 'authored',
|
|
81
103
|
});
|
|
104
|
+
const usage = entry.result.usage?.();
|
|
82
105
|
if (!authored.ok) {
|
|
83
|
-
|
|
106
|
+
const limit = authored.findings?.some(finding => finding.rule === 'limit') === true;
|
|
107
|
+
const code = authored.code ?? (limit ? 'merge-over-limit' : authored.findings === undefined ? classifyCommitFailure(authored.message) : 'merge-validation');
|
|
108
|
+
return { kind: 'failed', failure: { stage: 'author', code, message: authored.message, retryable: code !== 'target-changed' && code !== 'source-changed' && code !== 'support-changed', retryFrom: code === 'target-changed' || code === 'source-changed' || code === 'support-changed' ? 'none' : 'agent2', ...(authored.lengths === undefined ? {} : { lengths: authored.lengths }), ...(usage === undefined ? {} : { usage }) }, };
|
|
84
109
|
}
|
|
85
110
|
const receipt = authored.commit.receipt;
|
|
86
111
|
return {
|
|
87
112
|
kind: 'merged',
|
|
88
113
|
...(receipt?.unitId === undefined ? {} : { unitId: receipt.unitId }),
|
|
114
|
+
...(receipt?.evidenceSha256 === undefined ? {} : { evidenceSha256: receipt.evidenceSha256 }),
|
|
115
|
+
...(receipt?.validationPlan === undefined ? {} : { validationPlan: receipt.validationPlan }),
|
|
116
|
+
...(usage === undefined ? {} : { usage }),
|
|
89
117
|
archived: receipt?.archived ?? [],
|
|
90
118
|
target: { requested: decision.target, actual: authored.commit.plan.target, created: receipt?.create ?? false },
|
|
91
119
|
};
|
package/lib/types/scan-run.d.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* candidate → round1 → pending/fuse → commit transitions and returns the report draft.
|
|
4
4
|
*/
|
|
5
5
|
import { type MergeCandidate, type MergeDecision, type MergeFailure, type MergeRow } from './contracts.ts';
|
|
6
|
+
import { type StageEntry } from './domain/stage-aggregate.ts';
|
|
6
7
|
import type { EvolutionIoLike, RunStage } from '@lmzhen/dsh-evolution-core';
|
|
8
|
+
import type { SkillCard } from './skill-card.ts';
|
|
7
9
|
import type { MergeRunReportDraft } from './run-shell.ts';
|
|
8
10
|
export interface ScanRound1Outcome {
|
|
9
11
|
readonly kind: 'keep' | 'merge' | 'failed';
|
|
@@ -13,10 +15,14 @@ export interface ScanRound1Outcome {
|
|
|
13
15
|
readonly stagingExpiresAt?: number;
|
|
14
16
|
readonly sourceRevision?: string;
|
|
15
17
|
readonly targetRevision?: string;
|
|
18
|
+
readonly degraded?: readonly string[];
|
|
19
|
+
readonly usage?: import('./contracts.ts').MergeUsage;
|
|
16
20
|
}
|
|
17
21
|
export interface ScanRound2Outcome {
|
|
18
22
|
readonly kind: 'merged' | 'failed';
|
|
19
23
|
readonly unitId?: string;
|
|
24
|
+
readonly evidenceSha256?: string;
|
|
25
|
+
readonly validationPlan?: import('./contracts.ts').MergeValidationPlanRef;
|
|
20
26
|
readonly archived?: readonly string[];
|
|
21
27
|
readonly target?: {
|
|
22
28
|
readonly requested: string;
|
|
@@ -24,10 +30,20 @@ export interface ScanRound2Outcome {
|
|
|
24
30
|
readonly created: boolean;
|
|
25
31
|
};
|
|
26
32
|
readonly failure?: MergeFailure;
|
|
33
|
+
readonly usage?: import('./contracts.ts').MergeUsage;
|
|
34
|
+
readonly lengths?: Readonly<Record<string, number>>;
|
|
27
35
|
}
|
|
28
36
|
export interface ScanPorts {
|
|
29
37
|
screening(signal: AbortSignal): Promise<readonly MergeCandidate[]>;
|
|
38
|
+
resolve?(candidate: MergeCandidate): Promise<boolean>;
|
|
30
39
|
round1(candidate: MergeCandidate, signal: AbortSignal): Promise<ScanRound1Outcome>;
|
|
40
|
+
stage?(row: MergeRow, decision: MergeDecision): Promise<{
|
|
41
|
+
readonly ok: true;
|
|
42
|
+
readonly entry: StageEntry;
|
|
43
|
+
} | {
|
|
44
|
+
readonly ok: false;
|
|
45
|
+
readonly message: string;
|
|
46
|
+
}>;
|
|
31
47
|
round2(row: MergeRow, decision: MergeDecision, signal: AbortSignal): Promise<ScanRound2Outcome>;
|
|
32
48
|
}
|
|
33
49
|
export interface RunScanOptions {
|
|
@@ -46,6 +62,7 @@ export interface RunScanOptions {
|
|
|
46
62
|
readonly notes?: readonly string[];
|
|
47
63
|
readonly runId?: string;
|
|
48
64
|
readonly isOwnerActive?: (runId: string) => boolean | Promise<boolean>;
|
|
65
|
+
readonly cards?: readonly SkillCard[];
|
|
49
66
|
}
|
|
50
67
|
export declare function runScan(options: RunScanOptions): Promise<MergeRunReportDraft>;
|
|
51
68
|
//# sourceMappingURL=scan-run.d.ts.map
|