@planu/cli 8.5.1 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +16 -4
- package/dist/sdd-engine/completion-guard.js +2 -3
- package/dist/sdd-engine/contracts.d.ts +172 -0
- package/dist/sdd-engine/contracts.js +235 -10
- package/dist/sdd-engine/evidence-checkpoints.d.ts +6 -0
- package/dist/sdd-engine/evidence-checkpoints.js +280 -0
- package/dist/sdd-engine/evidence-journal.d.ts +25 -0
- package/dist/sdd-engine/evidence-journal.js +326 -0
- package/dist/sdd-engine/feature-manifest.d.ts +2 -1
- package/dist/sdd-engine/host-rule-pack.d.ts +4 -0
- package/dist/sdd-engine/host-rule-pack.js +114 -55
- package/dist/sdd-engine/host-skill-reader.d.ts +8 -1
- package/dist/sdd-engine/host-skill-reader.js +73 -0
- package/dist/sdd-engine/resume-history.d.ts +35 -3
- package/dist/sdd-engine/resume-history.js +242 -13
- package/dist/sdd-engine/resume-views.d.ts +7 -6
- package/dist/sdd-engine/resume-views.js +246 -114
- package/dist/sdd-engine/task-content.d.ts +2 -1
- package/dist/sdd-engine/task-failures.d.ts +30 -13
- package/dist/sdd-engine/task-failures.js +284 -115
- package/dist/sdd-engine/task-window.d.ts +6 -3
- package/dist/sdd-engine/task-window.js +12 -23
- package/dist/sdd-engine/tools/compact-result.d.ts +35 -5
- package/dist/sdd-engine/tools/compact-result.js +279 -2
- package/dist/sdd-engine/tools/execution-tools.js +20 -9
- package/dist/sdd-engine/tools/workspace-tools.js +80 -51
- package/dist/sdd-engine/trinity-structure.d.ts +2 -2
- package/dist/sdd-engine/verification-inputs.d.ts +2 -1
- package/dist/sdd-engine/verification-policy.d.ts +7 -6
- package/dist/sdd-engine/verification-policy.js +74 -85
- package/dist/sdd-engine/verification-preflight.d.ts +9 -7
- package/dist/sdd-engine/verification-preflight.js +108 -89
- package/dist/sdd-engine/verification-receipts.d.ts +2 -2
- package/dist/sdd-engine/verification-receipts.js +2 -1
- package/dist/sdd-engine/verification-runner.d.ts +3 -1
- package/dist/sdd-engine/verification-runner.js +12 -7
- package/dist/types/completion.d.ts +183 -3
- package/dist/types/resume-views.d.ts +221 -2
- package/dist/types/sdd-engine.d.ts +52 -112
- package/dist/types/verification.d.ts +26 -9
- package/package.json +5 -5
- package/templates/AGENTS.md +4 -0
- package/templates/host/planu-sdd.md +4 -0
- package/templates/skills/preflight-guardian.md +4 -0
- package/templates/skills/reconciler.md +6 -0
- package/templates/skills/spec-architect.md +44 -0
- package/templates/skills/spec-executor.md +6 -0
- package/templates/skills/verification-auditor.md +6 -0
- package/dist/sdd-engine/tools/format-result.d.ts +0 -3
- package/dist/sdd-engine/tools/format-result.js +0 -22
|
@@ -1,149 +1,281 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as evidenceJournal from './evidence-journal.js';
|
|
1
3
|
import * as path from 'node:path';
|
|
2
|
-
import
|
|
4
|
+
import * as history from './resume-history.js';
|
|
3
5
|
import { GetActiveTaskInputSchema } from './contracts.js';
|
|
4
|
-
import
|
|
6
|
+
import * as failures from './task-failures.js';
|
|
5
7
|
import { homeFallbackFailure } from './workspace-root.js';
|
|
6
|
-
import
|
|
8
|
+
import * as featureAuthority from './feature-authority.js';
|
|
7
9
|
import { summarizeTaskContent } from './task-content.js';
|
|
8
|
-
import { captureVerificationRoot } from './verification-inputs.js';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
class
|
|
12
|
-
}
|
|
13
|
-
function contractReference(snapshot) {
|
|
14
|
-
const locked = snapshot.locked;
|
|
15
|
-
return locked
|
|
16
|
-
? {
|
|
17
|
-
specSha256: hashArtifact(locked.specContent),
|
|
18
|
-
planSha256: hashArtifact(locked.planContent),
|
|
19
|
-
tasksSha256: hashArtifact(locked.tasksContent),
|
|
20
|
-
lockSha256: hashArtifact(locked.lockContent),
|
|
21
|
-
}
|
|
22
|
-
: null;
|
|
23
|
-
}
|
|
24
|
-
function historyReference(snapshot) {
|
|
25
|
-
const locked = snapshot.locked;
|
|
26
|
-
if (!locked) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const raw = JSON.parse(locked.lockContent);
|
|
30
|
-
const history = raw.relockHistory;
|
|
31
|
-
if (history !== undefined && !Array.isArray(history)) {
|
|
32
|
-
throw new InvalidResumeHistoryError();
|
|
33
|
-
}
|
|
34
|
-
const count = Array.isArray(history) ? history.length : 0;
|
|
35
|
-
return {
|
|
36
|
-
count,
|
|
37
|
-
lockSha256: hashArtifact(locked.lockContent),
|
|
38
|
-
firstCursor: count ? { snapshotSha256: locked.digest, startIndex: count - 1 } : null,
|
|
39
|
-
};
|
|
10
|
+
import { captureVerificationRoot, revalidateVerificationInputs } from './verification-inputs.js';
|
|
11
|
+
import * as preflight from './verification-preflight.js';
|
|
12
|
+
import * as compact from './tools/compact-result.js';
|
|
13
|
+
class InvalidCompactIdentifierError extends Error {
|
|
40
14
|
}
|
|
41
15
|
function checkpoint(snapshot, summary, assessment) {
|
|
42
|
-
|
|
43
|
-
const evidence = assessment?.evidence;
|
|
44
|
-
return {
|
|
45
|
-
version: 1,
|
|
46
|
-
featureId: path.basename(snapshot.feature),
|
|
47
|
-
progress: summary.progress,
|
|
48
|
-
...presentation,
|
|
49
|
-
contract: contractReference(snapshot),
|
|
50
|
-
candidate: evidence
|
|
51
|
-
? {
|
|
52
|
-
workspaceSha256: evidence.workspaceSha256,
|
|
53
|
-
candidateSha256: evidence.candidateSha256,
|
|
54
|
-
observedSha256: evidence.observedSha256,
|
|
55
|
-
}
|
|
56
|
-
: null,
|
|
57
|
-
gates: assessment?.preflight.gates ?? [],
|
|
58
|
-
history: historyReference(snapshot),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function checkpointStatus(snapshot, summary) {
|
|
62
|
-
if (!snapshot.locked) {
|
|
63
|
-
return 'unlocked';
|
|
64
|
-
}
|
|
65
|
-
if (!summary.progress.total) {
|
|
66
|
-
return 'no_tasks';
|
|
67
|
-
}
|
|
68
|
-
return summary.current.success && summary.current.data.activeTask ? 'active' : 'complete';
|
|
16
|
+
return compact.resumeProjection(path.basename(snapshot.feature), summary.progress, failures.checkpointPresentation(snapshot, summary, assessment), history.contractReference(snapshot), assessment, history.historyRef(snapshot));
|
|
69
17
|
}
|
|
70
|
-
function
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
integration: 'not_applicable',
|
|
88
|
-
blockers: status === 'unlocked' ? [{ reason: 'unlocked' }] : [],
|
|
89
|
-
nextAction: status === 'unlocked' ? 'review_lock' : status === 'no_tasks' ? 'inspect_tasks' : 'none',
|
|
18
|
+
async function budgetCheckpoint(core, assessment, tasksPath, workspaceRoot, scopedPolicy, reader) {
|
|
19
|
+
const { root, snapshot, summary } = core;
|
|
20
|
+
const base = assessment?.preflight ?? preflight.report(core.active?.taskId ?? null, [], [], false);
|
|
21
|
+
const budget = await preflight.observeVerificationBudget({
|
|
22
|
+
tasksPath,
|
|
23
|
+
workspaceRoot,
|
|
24
|
+
root,
|
|
25
|
+
snapshot,
|
|
26
|
+
selected: core.active && {
|
|
27
|
+
taskId: core.active.taskId,
|
|
28
|
+
command: core.active.verificationCommand,
|
|
29
|
+
},
|
|
30
|
+
preflight: base,
|
|
31
|
+
}, scopedPolicy, reader);
|
|
32
|
+
const decorated = assessment && {
|
|
33
|
+
...assessment,
|
|
34
|
+
preflight: failures.withVerificationBudget(base, budget),
|
|
90
35
|
};
|
|
36
|
+
return { ...checkpoint(snapshot, summary, decorated), budget };
|
|
91
37
|
}
|
|
92
|
-
function
|
|
93
|
-
return id.length <= 128 && /^[A-Z0-9_-]+$/u.test(id);
|
|
94
|
-
}
|
|
95
|
-
export async function getResumeCheckpoint(tasksPath, workspaceRoot, extractCommand, receipts, scopedPolicy, signal) {
|
|
38
|
+
export async function getResumeCheckpoint(tasksPath, workspaceRoot, extractCommand, receipts, scopedPolicy, signal, reader, explicit = true) {
|
|
96
39
|
try {
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
(active && !validIdentifier(active.taskId))) {
|
|
104
|
-
return compactFailure('compact_identifier_invalid');
|
|
105
|
-
}
|
|
106
|
-
const assessment = snapshot.locked && active
|
|
107
|
-
? await assessVerificationPreflight(snapshot.locked, root, workspaceRoot, active, receipts, scopedPolicy, signal)
|
|
108
|
-
: undefined;
|
|
109
|
-
const resume = checkpoint(snapshot, summary, assessment);
|
|
40
|
+
const core = await captureCore(tasksPath, workspaceRoot, extractCommand);
|
|
41
|
+
const assessment = await assessCore(core, workspaceRoot, receipts, scopedPolicy, signal);
|
|
42
|
+
const { root, snapshot, summary } = core;
|
|
43
|
+
const resume = explicit
|
|
44
|
+
? await budgetCheckpoint(core, assessment, tasksPath, workspaceRoot, scopedPolicy, reader)
|
|
45
|
+
: checkpoint(snapshot, summary, assessment);
|
|
110
46
|
if (signal?.aborted) {
|
|
111
|
-
throw new CompletionGuardError('cancelled', 'Compact read was cancelled.');
|
|
47
|
+
throw new featureAuthority.CompletionGuardError('cancelled', 'Compact read was cancelled.');
|
|
112
48
|
}
|
|
113
|
-
await revalidateReadSnapshot(snapshot, root, workspaceRoot);
|
|
49
|
+
await preflight.revalidateReadSnapshot(snapshot, root, workspaceRoot);
|
|
114
50
|
if (signal?.aborted) {
|
|
115
|
-
return compactFailure('cancelled', 'ERR_VERIFICATION_FAILED');
|
|
51
|
+
return compact.compactFailure('cancelled', 'ERR_VERIFICATION_FAILED');
|
|
116
52
|
}
|
|
117
53
|
return { success: true, data: { resume } };
|
|
118
54
|
}
|
|
119
55
|
catch (error) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
56
|
+
if (error instanceof InvalidCompactIdentifierError) {
|
|
57
|
+
return compact.compactFailure('compact_identifier_invalid');
|
|
58
|
+
}
|
|
59
|
+
return error instanceof history.InvalidHistoryError
|
|
60
|
+
? compact.compactFailure('history_invalid')
|
|
61
|
+
: compact.compactReadError(error);
|
|
123
62
|
}
|
|
124
63
|
}
|
|
125
|
-
export async function getResumeToolResult(rawArgs, workspace, policy, signal) {
|
|
64
|
+
export async function getResumeToolResult(rawArgs, workspace, policy, signal, reader) {
|
|
126
65
|
try {
|
|
127
66
|
const parsed = GetActiveTaskInputSchema.safeParse(rawArgs);
|
|
128
67
|
if (!parsed.success) {
|
|
129
|
-
return formatCompactResult(compactFailure('compact_input_invalid'));
|
|
68
|
+
return compact.formatCompactResult(compact.compactFailure('compact_input_invalid'));
|
|
130
69
|
}
|
|
131
70
|
const args = parsed.data;
|
|
132
|
-
if (!
|
|
133
|
-
return formatCompactResult(compactFailure('compact_identifier_invalid'));
|
|
71
|
+
if (!failures.validCompactIdentifier(args.feature_id)) {
|
|
72
|
+
return compact.formatCompactResult(compact.compactFailure('compact_identifier_invalid'));
|
|
73
|
+
}
|
|
74
|
+
const newView = ['execution_window', 'execution_detail', 'evidence_history'].includes(args.view ?? '');
|
|
75
|
+
const capability = newView ? evidenceJournal.checkpointCapability() : null;
|
|
76
|
+
if (newView && !capability) {
|
|
77
|
+
throw new compact.CheckpointCapabilityError();
|
|
134
78
|
}
|
|
135
79
|
const resolved = await workspace.resolve();
|
|
136
80
|
if (homeFallbackFailure(resolved, 'sdd_get_active_task')) {
|
|
137
|
-
return formatCompactResult(compactFailure('workspace_unresolved', 'ERR_WORKSPACE_UNRESOLVED'));
|
|
81
|
+
return compact.formatCompactResult(compact.compactFailure('workspace_unresolved', 'ERR_WORKSPACE_UNRESOLVED'));
|
|
138
82
|
}
|
|
139
83
|
const tasksPath = path.join(resolved.sddDir, 'features', args.feature_id, 'tasks.md');
|
|
140
|
-
|
|
141
|
-
|
|
84
|
+
let result;
|
|
85
|
+
if (capability) {
|
|
86
|
+
result = await getExecutionView(args, {
|
|
87
|
+
tasksPath,
|
|
88
|
+
workspaceRoot: resolved.workspaceRoot,
|
|
89
|
+
capability,
|
|
90
|
+
scopedPolicy: policy?.mode === 'scoped' ? policy : undefined,
|
|
91
|
+
signal,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else if (args.view === 'relock_history') {
|
|
95
|
+
result = await history.getRelockHistory(tasksPath, resolved.workspaceRoot, args.history_cursor, signal);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
result = await getResumeCheckpoint(tasksPath, resolved.workspaceRoot, failures.verificationCommand, args.verification_receipts, policy?.mode === 'scoped' ? policy : undefined, signal, reader, args.view === 'resume');
|
|
142
99
|
}
|
|
143
|
-
return formatCompactResult(
|
|
100
|
+
return compact.formatCompactResult(result);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
return compact.formatCompactResult(compact.compactReadError(error));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async function proveUnlockedJournalAbsent(feature) {
|
|
107
|
+
try {
|
|
108
|
+
await fs.lstat(path.join(feature, '.evidence-checkpoints.jsonl'));
|
|
109
|
+
throw new compact.CheckpointError('checkpoint_requires_lock');
|
|
144
110
|
}
|
|
145
111
|
catch (error) {
|
|
146
|
-
|
|
112
|
+
if (error.code !== 'ENOENT') {
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function captureCore(tasksPath, workspaceRoot, extractCommand) {
|
|
118
|
+
const root = await captureVerificationRoot(workspaceRoot);
|
|
119
|
+
const snapshot = await preflight.captureReadSnapshot(path.dirname(tasksPath), root);
|
|
120
|
+
await preflight.assertGuardAbsent(snapshot.feature);
|
|
121
|
+
const summary = summarizeTaskContent(snapshot.artifacts['tasks.md']?.content ?? '', extractCommand);
|
|
122
|
+
const active = summary.current.success ? summary.current.data.activeTask : null;
|
|
123
|
+
if (!failures.validCompactIdentifier(path.basename(snapshot.feature)) ||
|
|
124
|
+
(active && !failures.validCompactIdentifier(active.taskId))) {
|
|
125
|
+
throw new InvalidCompactIdentifierError();
|
|
147
126
|
}
|
|
127
|
+
return { root, snapshot, summary, active };
|
|
128
|
+
}
|
|
129
|
+
async function assessCore(core, workspaceRoot, receipts, policy, signal) {
|
|
130
|
+
return core.snapshot.locked && core.active
|
|
131
|
+
? preflight.assessVerificationPreflight(core.snapshot.locked, core.root, workspaceRoot, core.active, receipts, policy, signal)
|
|
132
|
+
: undefined;
|
|
133
|
+
}
|
|
134
|
+
async function compactCapture(args, context) {
|
|
135
|
+
const { tasksPath, workspaceRoot, capability, scopedPolicy, signal } = context;
|
|
136
|
+
const startSeq = args.evidence_cursor?.startSeq;
|
|
137
|
+
const core = await captureCore(tasksPath, workspaceRoot, failures.verificationCommand);
|
|
138
|
+
const { root, snapshot } = core;
|
|
139
|
+
const records = [];
|
|
140
|
+
let journal = null;
|
|
141
|
+
let authority = null;
|
|
142
|
+
let assessment;
|
|
143
|
+
if (snapshot.locked) {
|
|
144
|
+
evidenceJournal.requireOwnedSnapshot(snapshot.locked, capability);
|
|
145
|
+
authority = evidenceJournal.evidenceAuthoritySha256(snapshot.locked, root);
|
|
146
|
+
assessment = await assessCore(core, workspaceRoot, args.verification_receipts, scopedPolicy, signal);
|
|
147
|
+
const capture = await evidenceJournal.captureJournal(snapshot.locked, root, capability, (record) => {
|
|
148
|
+
if (startSeq === undefined || record.seq <= startSeq) {
|
|
149
|
+
records.push(record);
|
|
150
|
+
if (records.length > 8) {
|
|
151
|
+
records.shift();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
journal = capture.reference;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
await proveUnlockedJournalAbsent(snapshot.feature);
|
|
159
|
+
}
|
|
160
|
+
return { ...core, assessment, authority, journal, records };
|
|
161
|
+
}
|
|
162
|
+
async function revalidateCompact(c, context) {
|
|
163
|
+
const { workspaceRoot, capability, signal } = context;
|
|
164
|
+
if (signal?.aborted) {
|
|
165
|
+
throw new featureAuthority.CompletionGuardError('cancelled', 'Compact read was cancelled.');
|
|
166
|
+
}
|
|
167
|
+
if (c.assessment?.inputs) {
|
|
168
|
+
await revalidateVerificationInputs(c.assessment.inputs, signal);
|
|
169
|
+
}
|
|
170
|
+
if (c.snapshot.locked) {
|
|
171
|
+
const again = await evidenceJournal.captureJournal(c.snapshot.locked, c.root, capability);
|
|
172
|
+
if (JSON.stringify(again.reference) !== JSON.stringify(c.journal)) {
|
|
173
|
+
throw new featureAuthority.CompletionGuardError('contract_drift', 'Compact authority changed.');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
await proveUnlockedJournalAbsent(c.snapshot.feature);
|
|
178
|
+
}
|
|
179
|
+
await preflight.revalidateReadSnapshot(c.snapshot, c.root, workspaceRoot);
|
|
180
|
+
if (signal?.aborted) {
|
|
181
|
+
throw new featureAuthority.CompletionGuardError('cancelled', 'Compact read was cancelled.');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async function getExecutionView(args, context) {
|
|
185
|
+
try {
|
|
186
|
+
const cursor = args.execution_cursor;
|
|
187
|
+
const historyCursor = args.evidence_cursor;
|
|
188
|
+
if (args.view === 'execution_detail' && (!cursor || cursor.offset < 0)) {
|
|
189
|
+
return compact.compactFailure('detail_cursor_invalid', 'ERR_INVALID_SLICE');
|
|
190
|
+
}
|
|
191
|
+
if (args.view === 'evidence_history' && historyCursor && historyCursor.startSeq < 1) {
|
|
192
|
+
return compact.compactFailure('journal_cursor_invalid', 'ERR_INVALID_SLICE');
|
|
193
|
+
}
|
|
194
|
+
const c = await compactCapture(args, context);
|
|
195
|
+
const result = selectExecutionResult(args, c);
|
|
196
|
+
if (result.success) {
|
|
197
|
+
await revalidateCompact(c, context);
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
if (error instanceof InvalidCompactIdentifierError) {
|
|
203
|
+
return compact.compactFailure('compact_identifier_invalid');
|
|
204
|
+
}
|
|
205
|
+
if (error instanceof history.InvalidHistoryError) {
|
|
206
|
+
return compact.compactFailure('history_invalid');
|
|
207
|
+
}
|
|
208
|
+
return error instanceof compact.CheckpointError && error.reason === 'checkpoint_requires_lock'
|
|
209
|
+
? compact.compactFailure('unlocked', 'ERR_SPEC_NOT_LOCKED')
|
|
210
|
+
: compact.executionReadError(error);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function selectExecutionResult(args, c) {
|
|
214
|
+
if (args.view === 'execution_window') {
|
|
215
|
+
const resume = checkpoint(c.snapshot, c.summary, c.assessment);
|
|
216
|
+
return compact.executionWindowResult(executionWindow(c, resume));
|
|
217
|
+
}
|
|
218
|
+
if (!c.authority) {
|
|
219
|
+
return compact.compactFailure('unlocked', 'ERR_SPEC_NOT_LOCKED');
|
|
220
|
+
}
|
|
221
|
+
return args.view === 'execution_detail' && args.execution_cursor
|
|
222
|
+
? selectDetail(c, args.execution_cursor)
|
|
223
|
+
: selectEvidenceHistory(c, c.authority, args.evidence_cursor);
|
|
224
|
+
}
|
|
225
|
+
function selectDetail(c, cursor) {
|
|
226
|
+
if (cursor.snapshotSha256 !== c.authority ||
|
|
227
|
+
cursor.journalSnapshotSha256 !== (c.journal?.snapshotSha256 ?? null)) {
|
|
228
|
+
return compact.compactFailure('detail_cursor_stale', 'ERR_INVALID_SLICE');
|
|
229
|
+
}
|
|
230
|
+
const content = history.sections(c).texts[cursor.section];
|
|
231
|
+
if (featureAuthority.hashArtifact(content) !== cursor.contentSha256) {
|
|
232
|
+
return compact.compactFailure('detail_cursor_stale', 'ERR_INVALID_SLICE');
|
|
233
|
+
}
|
|
234
|
+
const page = history.detailPage(path.basename(c.snapshot.feature), cursor, content);
|
|
235
|
+
return page
|
|
236
|
+
? { success: true, data: { executionDetail: page } }
|
|
237
|
+
: compact.compactFailure('detail_cursor_invalid', 'ERR_INVALID_SLICE');
|
|
238
|
+
}
|
|
239
|
+
function selectEvidenceHistory(c, authority, cursor) {
|
|
240
|
+
if (cursor &&
|
|
241
|
+
(cursor.snapshotSha256 !== c.authority ||
|
|
242
|
+
cursor.journalSnapshotSha256 !== c.journal?.snapshotSha256 ||
|
|
243
|
+
cursor.headSha256 !== c.journal.headSha256)) {
|
|
244
|
+
return compact.compactFailure('journal_cursor_stale', 'ERR_INVALID_SLICE');
|
|
245
|
+
}
|
|
246
|
+
if (cursor && (!c.journal || cursor.startSeq > c.journal.count)) {
|
|
247
|
+
return compact.compactFailure('journal_cursor_invalid', 'ERR_INVALID_SLICE');
|
|
248
|
+
}
|
|
249
|
+
const page = compact.journalPage(path.basename(c.snapshot.feature), authority, c.journal, c.records, cursor?.startSeq ?? c.journal?.count ?? 0);
|
|
250
|
+
return page
|
|
251
|
+
? { success: true, data: { evidenceHistory: page } }
|
|
252
|
+
: compact.compactFailure('journal_cursor_invalid', 'ERR_INVALID_SLICE');
|
|
253
|
+
}
|
|
254
|
+
function executionWindow(c, resume) {
|
|
255
|
+
const last = c.records.at(-1);
|
|
256
|
+
const data = history.sections(c);
|
|
257
|
+
return {
|
|
258
|
+
version: 1,
|
|
259
|
+
featureId: resume.featureId,
|
|
260
|
+
status: resume.status,
|
|
261
|
+
progress: resume.progress,
|
|
262
|
+
task: resume.task,
|
|
263
|
+
snapshotSha256: c.authority,
|
|
264
|
+
contract: resume.contract,
|
|
265
|
+
candidate: resume.candidate,
|
|
266
|
+
verification: {
|
|
267
|
+
readiness: resume.readiness,
|
|
268
|
+
integration: resume.integration,
|
|
269
|
+
nextAction: resume.nextAction,
|
|
270
|
+
gateCounts: history.gateCounts(resume),
|
|
271
|
+
blockerReasons: resume.blockers.map((b) => b.reason),
|
|
272
|
+
},
|
|
273
|
+
scope: history.scopeProjection(c, data),
|
|
274
|
+
taskDetail: history.detailCursor(c, 'active_task', data.texts.active_task),
|
|
275
|
+
verificationDetail: history.detailCursor(c, 'verification', data.texts.verification),
|
|
276
|
+
delta: history.deltaProjection(resume, last),
|
|
277
|
+
journal: history.journalProjection(c, last),
|
|
278
|
+
relocks: history.relockProjection(c, resume),
|
|
279
|
+
};
|
|
148
280
|
}
|
|
149
281
|
//# sourceMappingURL=resume-views.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TaskBlock } from '../types/completion.js';
|
|
2
|
+
import type { ActiveTaskResult, FeatureSummary, SddResult } from '../types/sdd-engine.js';
|
|
2
3
|
export declare function activeTaskFromContent(content: string, extractCommand: (markdown: string) => string | null): SddResult<ActiveTaskResult>;
|
|
3
4
|
export declare function summarizeTaskContent(content: string, extractCommand: (markdown: string) => string | null): {
|
|
4
5
|
current: SddResult<ActiveTaskResult>;
|
|
@@ -1,14 +1,31 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
1
|
+
import type * as completion from '../types/completion.js';
|
|
2
|
+
import type * as resumeTypes from '../types/resume-views.js';
|
|
3
|
+
import type * as engine from '../types/sdd-engine.js';
|
|
4
|
+
import type { ScopedVerificationRun, VerificationBudgetDiagnostic, VerificationProcessEvidence } from '../types/verification.js';
|
|
5
|
+
export declare function verificationProcessEvidence(run: ScopedVerificationRun): VerificationProcessEvidence;
|
|
6
|
+
export declare function withVerificationProcess(result: engine.SddResult<engine.CompleteTaskResult>, run: ScopedVerificationRun): engine.SddResult<engine.CompleteTaskResult>;
|
|
7
|
+
export declare function completionFailure(reason: string, code?: 'ERR_VERIFICATION_FAILED' | 'ERR_SPEC_DRIFT', trigger?: string): engine.SddResult<never>;
|
|
8
|
+
export declare function patchMutationError(error: unknown): engine.SddResult<never>;
|
|
9
|
+
export declare function receiptFailure(reason: string, details?: Record<string, unknown>, trigger?: string): engine.SddResult<never>;
|
|
10
|
+
export declare function completionError(error: unknown, trigger?: string): engine.SddResult<never>;
|
|
11
|
+
export declare function taskOutOfSequence(taskId: string, activeTaskId: string | null, alreadyCompleted?: boolean): engine.SddResult<engine.CompleteTaskResult>;
|
|
12
|
+
export declare function verificationMissing(): engine.SddResult<engine.CompleteTaskResult>;
|
|
13
|
+
export declare function verificationFailed(run: ScopedVerificationRun): engine.SddResult<engine.CompleteTaskResult>;
|
|
14
|
+
export declare function unsupportedVerificationPlatform(): engine.SddResult<engine.CompleteTaskResult>;
|
|
15
|
+
export declare function scopedPathMismatch(): engine.SddResult<never>;
|
|
16
|
+
export declare function taskFileMissing(tasksFilePath: string): engine.SddResult<never>;
|
|
17
|
+
export declare function catalogueReadFailure(error: unknown, id: string): engine.SddResult<never>;
|
|
18
|
+
export declare function snapshotFailure(workspace?: boolean): engine.SddFailure;
|
|
19
|
+
export declare function uncertainCompletion(): engine.SddFailure;
|
|
20
|
+
export declare function scopedFailure(details: Record<string, unknown>): engine.SddFailure;
|
|
21
|
+
export declare function cancelledVerification(signal: AbortSignal): engine.SddFailure | null;
|
|
22
|
+
export declare function nextAction(reasons: ReadonlySet<engine.PreflightBlockerReason>): engine.PreflightAction;
|
|
23
|
+
export declare function verificationCommand(taskMarkdown: string): string | null;
|
|
24
|
+
export declare function withVerificationBudget(preflight: engine.VerificationPreflight, budget: VerificationBudgetDiagnostic): engine.VerificationPreflight;
|
|
25
|
+
export declare function checkpointPresentation(snapshot: completion.PreflightReadSnapshot, summary: resumeTypes.CompactCore['summary'], assessment?: resumeTypes.PreflightAssessment): resumeTypes.ResumePresentation;
|
|
26
|
+
export declare function preflightError(error: unknown): engine.SddResult<never>;
|
|
27
|
+
export declare function deniedBudget(reason: completion.BudgetDeniedReason): VerificationBudgetDiagnostic;
|
|
28
|
+
export declare function budgetPrecondition(context: completion.VerificationBudgetContext): completion.BudgetDeniedReason | null;
|
|
29
|
+
export declare function defaultBudget(reason: 'default_policy' | 'outside_scoped_grant'): VerificationBudgetDiagnostic;
|
|
30
|
+
export declare function validCompactIdentifier(id: string): boolean;
|
|
14
31
|
//# sourceMappingURL=task-failures.d.ts.map
|