@planu/cli 8.6.0 → 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.
@@ -1,46 +1,62 @@
1
1
  import { CompletionGuardError } from './feature-authority.js';
2
2
  import { VerificationInputError } from './verification-inputs.js';
3
+ function makeFailure(error) {
4
+ return { success: false, error };
5
+ }
6
+ export function verificationProcessEvidence(run) {
7
+ return {
8
+ version: 1,
9
+ timeoutMs: run.timeoutMs,
10
+ timedOut: run.timedOut,
11
+ cancelled: run.cancelled,
12
+ exitCode: run.exitCode,
13
+ signal: run.signal,
14
+ cleanupComplete: run.cleanupComplete,
15
+ cleanupScope: 'owned_process_group',
16
+ fixturePostconditions: 'unknown',
17
+ };
18
+ }
19
+ export function withVerificationProcess(result, run) {
20
+ const verificationProcess = verificationProcessEvidence(run);
21
+ return result.success
22
+ ? { ...result, data: { ...result.data, verificationProcess } }
23
+ : {
24
+ ...result,
25
+ error: { ...result.error, details: { ...result.error.details, verificationProcess } },
26
+ };
27
+ }
3
28
  export function completionFailure(reason, code = reason === 'contract_drift'
4
29
  ? 'ERR_SPEC_DRIFT'
5
30
  : 'ERR_VERIFICATION_FAILED', trigger = 'sdd_complete_task') {
6
- return {
7
- success: false,
8
- error: {
9
- code,
10
- message: reason === 'persistence_uncertain'
11
- ? 'Completion state requires explicit reviewed recovery with sdd_lock_spec.'
12
- : 'Completion was denied; inspect the bounded reason before retrying.',
13
- trigger,
14
- details: { reason },
15
- },
16
- };
31
+ return makeFailure({
32
+ code,
33
+ message: reason === 'persistence_uncertain'
34
+ ? 'Completion state requires explicit reviewed recovery with sdd_lock_spec.'
35
+ : 'Completion was denied; inspect the bounded reason before retrying.',
36
+ trigger,
37
+ details: { reason },
38
+ });
17
39
  }
18
40
  export function patchMutationError(error) {
19
41
  const guarded = error instanceof CompletionGuardError || error instanceof VerificationInputError;
20
- return {
21
- success: false,
22
- error: {
23
- code: error instanceof VerificationInputError
24
- ? 'ERR_PERMISSION_VIOLATION'
25
- : error instanceof CompletionGuardError
26
- ? error.code
27
- : 'ERR_VERIFICATION_FAILED',
28
- message: guarded ? error.message : 'Feature mutation was denied.',
29
- trigger: 'sdd_apply_file_patch',
30
- details: { reason: guarded ? error.reason : 'failed' },
31
- },
32
- };
42
+ return makeFailure({
43
+ code: error instanceof VerificationInputError
44
+ ? 'ERR_PERMISSION_VIOLATION'
45
+ : error instanceof CompletionGuardError
46
+ ? error.code
47
+ : 'ERR_VERIFICATION_FAILED',
48
+ message: guarded ? error.message : 'Feature mutation was denied.',
49
+ trigger: 'sdd_apply_file_patch',
50
+ details: { reason: guarded ? error.reason : 'failed' },
51
+ });
33
52
  }
34
53
  export function receiptFailure(reason, details = {}, trigger = 'sdd_complete_task') {
35
- return {
36
- success: false,
37
- error: {
38
- code: 'ERR_VERIFICATION_FAILED',
39
- message: 'Receipt verification was denied.',
40
- trigger,
41
- details: { reason, ...details },
42
- },
43
- };
54
+ return makeFailure({
55
+ code: 'ERR_VERIFICATION_FAILED',
56
+ message: 'Receipt verification was denied.',
57
+ trigger,
58
+ details: { reason, ...details },
59
+ });
44
60
  }
45
61
  export function completionError(error, trigger = 'sdd_complete_task') {
46
62
  if (error instanceof VerificationInputError) {
@@ -50,110 +66,263 @@ export function completionError(error, trigger = 'sdd_complete_task') {
50
66
  }, trigger);
51
67
  }
52
68
  if (error instanceof CompletionGuardError) {
53
- return {
54
- success: false,
55
- error: {
56
- code: error.code,
57
- message: error.message,
58
- trigger,
59
- details: { reason: error.reason },
60
- },
61
- };
69
+ return makeFailure({
70
+ code: error.code,
71
+ message: error.message,
72
+ trigger,
73
+ details: { reason: error.reason },
74
+ });
62
75
  }
63
76
  return completionFailure('failed', undefined, trigger);
64
77
  }
65
78
  export function taskOutOfSequence(taskId, activeTaskId, alreadyCompleted = false) {
66
- return {
67
- success: false,
68
- error: {
69
- code: 'ERR_TASK_OUT_OF_SEQUENCE',
70
- message: `Task '${taskId}' is not active or was already completed.`,
71
- trigger: 'sdd_complete_task',
72
- details: {
73
- requestedTaskId: taskId,
74
- activeTaskId,
75
- ...(alreadyCompleted ? { reason: 'already_completed' } : {}),
76
- },
79
+ return makeFailure({
80
+ code: 'ERR_TASK_OUT_OF_SEQUENCE',
81
+ message: `Task '${taskId}' is not active or was already completed.`,
82
+ trigger: 'sdd_complete_task',
83
+ details: {
84
+ requestedTaskId: taskId,
85
+ activeTaskId,
86
+ ...(alreadyCompleted ? { reason: 'already_completed' } : {}),
77
87
  },
78
- };
88
+ });
79
89
  }
80
90
  export function verificationMissing() {
81
- return {
82
- success: false,
83
- error: {
84
- code: 'ERR_VERIFICATION_MISSING',
85
- message: 'The active task needs one Verification line whose command does not contain < or >.',
86
- trigger: 'sdd_complete_task',
87
- },
88
- };
91
+ return makeFailure({
92
+ code: 'ERR_VERIFICATION_MISSING',
93
+ message: 'The active task needs one Verification line whose command does not contain < or >.',
94
+ trigger: 'sdd_complete_task',
95
+ });
89
96
  }
90
97
  export function verificationFailed(run) {
91
98
  const exitCode = run.exitCode ?? 1;
92
- return {
93
- success: false,
94
- error: {
95
- code: 'ERR_VERIFICATION_FAILED',
96
- message: `Verification command exited ${String(exitCode)}.`,
97
- trigger: 'sdd_complete_task',
98
- details: {
99
- reason: run.cancelled ? 'cancelled' : run.timedOut ? 'timeout' : 'failed',
100
- exitCode,
101
- outputTail: run.output.slice(-2000),
102
- cleanupComplete: run.cleanupComplete,
103
- },
99
+ return makeFailure({
100
+ code: 'ERR_VERIFICATION_FAILED',
101
+ message: `Verification command exited ${String(exitCode)}.`,
102
+ trigger: 'sdd_complete_task',
103
+ details: {
104
+ reason: run.cancelled ? 'cancelled' : run.timedOut ? 'timeout' : 'failed',
105
+ exitCode,
106
+ outputTail: run.output.slice(-2000),
107
+ verificationProcess: verificationProcessEvidence(run),
108
+ cleanupComplete: run.cleanupComplete,
104
109
  },
105
- };
110
+ });
106
111
  }
107
112
  export function unsupportedVerificationPlatform() {
108
- return {
109
- success: false,
110
- error: {
111
- code: 'ERR_VERIFICATION_FAILED',
112
- message: 'Automatic task verification currently requires local macOS or Linux for owned process-tree cleanup. Planning and read-only tools remain available.',
113
- trigger: 'sdd_complete_task',
114
- details: {
115
- reason: 'failed',
116
- platform: process.platform,
117
- verificationSupported: false,
118
- },
113
+ return makeFailure({
114
+ code: 'ERR_VERIFICATION_FAILED',
115
+ message: 'Automatic task verification currently requires local macOS or Linux for owned process-tree cleanup. Planning and read-only tools remain available.',
116
+ trigger: 'sdd_complete_task',
117
+ details: {
118
+ reason: 'failed',
119
+ platform: process.platform,
120
+ verificationSupported: false,
119
121
  },
120
- };
122
+ });
121
123
  }
122
124
  export function scopedPathMismatch() {
123
- return {
124
- success: false,
125
- error: {
126
- code: 'ERR_WORKSPACE_UNRESOLVED',
127
- message: 'Scoped verification path does not match its trusted policy.',
128
- trigger: 'sdd_complete_task',
129
- details: { reason: 'verification_policy_workspace_mismatch' },
130
- },
131
- };
125
+ return makeFailure({
126
+ code: 'ERR_WORKSPACE_UNRESOLVED',
127
+ message: 'Scoped verification path does not match its trusted policy.',
128
+ trigger: 'sdd_complete_task',
129
+ details: { reason: 'verification_policy_workspace_mismatch' },
130
+ });
132
131
  }
133
132
  export function taskFileMissing(tasksFilePath) {
134
- return {
135
- success: false,
136
- error: {
137
- code: 'ERR_TASK_NOT_FOUND',
138
- message: `File tasks.md not found at: '${tasksFilePath}'.`,
139
- trigger: 'sdd_get_active_task',
133
+ return makeFailure({
134
+ code: 'ERR_TASK_NOT_FOUND',
135
+ message: `File tasks.md not found at: '${tasksFilePath}'.`,
136
+ trigger: 'sdd_get_active_task',
137
+ });
138
+ }
139
+ export function catalogueReadFailure(error, id) {
140
+ return makeFailure({
141
+ code: error instanceof CompletionGuardError ? error.code : 'ERR_INVALID_ARTIFACT',
142
+ message: error instanceof CompletionGuardError
143
+ ? error.message
144
+ : 'Could not read the complete feature catalogue.',
145
+ trigger: 'sdd_list_features',
146
+ details: {
147
+ entry: id,
148
+ ...(error instanceof CompletionGuardError ? { reason: error.reason } : {}),
140
149
  },
150
+ });
151
+ }
152
+ export function snapshotFailure(workspace = false) {
153
+ return makeFailure({
154
+ code: workspace ? 'ERR_WORKSPACE_UNRESOLVED' : 'ERR_SPEC_DRIFT',
155
+ message: 'Scoped verification context does not match the trusted startup policy.',
156
+ trigger: 'sdd_complete_task',
157
+ details: {
158
+ reason: workspace ? 'verification_policy_workspace_mismatch' : 'verification_policy_mismatch',
159
+ },
160
+ });
161
+ }
162
+ export function uncertainCompletion() {
163
+ return makeFailure({
164
+ code: 'ERR_VERIFICATION_FAILED',
165
+ message: 'Completion persistence is uncertain; operator reconciliation is required.',
166
+ trigger: 'sdd_complete_task',
167
+ details: { reason: 'verification_completion_io', completionState: 'uncertain' },
168
+ });
169
+ }
170
+ export function scopedFailure(details) {
171
+ return makeFailure({
172
+ code: 'ERR_VERIFICATION_FAILED',
173
+ message: 'Scoped verification did not produce a safely committed certificate.',
174
+ trigger: 'sdd_complete_task',
175
+ details,
176
+ });
177
+ }
178
+ export function cancelledVerification(signal) {
179
+ if (!signal.aborted) {
180
+ return null;
181
+ }
182
+ return scopedFailure({ reason: 'verification_cancelled', cancelled: true, timedOut: false });
183
+ }
184
+ export function nextAction(reasons) {
185
+ if (reasons.has('unlocked')) {
186
+ return 'review_lock';
187
+ }
188
+ if (reasons.has('platform_unsupported') || reasons.has('receipt_scoped_unsupported')) {
189
+ return 'use_supported_runtime';
190
+ }
191
+ if (reasons.has('command_missing')) {
192
+ return 'restore_verification';
193
+ }
194
+ if (reasons.has('receipt_input_unavailable')) {
195
+ return 'fix_inputs';
196
+ }
197
+ if (reasons.has('receipt_observed_baseline_drift')) {
198
+ return 'review_observed_drift';
199
+ }
200
+ if (reasons.has('receipt_not_configured')) {
201
+ return 'restore_verification';
202
+ }
203
+ if ([...reasons].some((reason) => reason.startsWith('verification_'))) {
204
+ return 'review_verification_policy';
205
+ }
206
+ return reasons.size ? 'obtain_receipts' : 'attempt_integration';
207
+ }
208
+ export function verificationCommand(taskMarkdown) {
209
+ const line = taskMarkdown
210
+ .split('\n')
211
+ .map((entry) => entry.trim())
212
+ .find((entry) => /^verification:/iu.test(entry));
213
+ if (!line) {
214
+ return null;
215
+ }
216
+ const command = line.replace(/^verification:\s*/iu, '').trim();
217
+ if (command.length === 0 || command.includes('<') || command.includes('>')) {
218
+ return null;
219
+ }
220
+ return command;
221
+ }
222
+ export function withVerificationBudget(preflight, budget) {
223
+ if (budget.admission !== 'denied' || !preflight.taskId || budget.reason === 'unlocked') {
224
+ return { ...preflight, budget };
225
+ }
226
+ if (budget.reason === 'no_active_task') {
227
+ return { ...preflight, budget };
228
+ }
229
+ const reasons = new Set([
230
+ ...preflight.blockers.map(({ reason }) => reason),
231
+ budget.reason,
232
+ ]);
233
+ return {
234
+ ...preflight,
235
+ budget,
236
+ status: 'blocked',
237
+ blockers: [...reasons]
238
+ .sort()
239
+ .slice(0, 16)
240
+ .map((reason) => ({ reason })),
241
+ nextAction: preflight.nextAction === 'attempt_integration' ? nextAction(reasons) : preflight.nextAction,
141
242
  };
142
243
  }
143
- export function catalogueReadFailure(error, id) {
244
+ function checkpointStatus(snapshot, summary) {
245
+ if (!snapshot.locked) {
246
+ return 'unlocked';
247
+ }
248
+ if (summary.progress.total) {
249
+ return summary.current.success && summary.current.data.activeTask ? 'active' : 'complete';
250
+ }
251
+ return 'no_tasks';
252
+ }
253
+ export function checkpointPresentation(snapshot, summary, assessment) {
254
+ const status = checkpointStatus(snapshot, summary);
255
+ const active = summary.current.success ? summary.current.data.activeTask : null;
256
+ if (status === 'active' && active && assessment) {
257
+ return {
258
+ status,
259
+ task: { id: active.taskId, index: active.taskIndex },
260
+ readiness: assessment.preflight.status,
261
+ integration: 'pending',
262
+ blockers: assessment.preflight.blockers,
263
+ nextAction: assessment.preflight.nextAction,
264
+ };
265
+ }
144
266
  return {
145
- success: false,
146
- error: {
147
- code: error instanceof CompletionGuardError ? error.code : 'ERR_INVALID_ARTIFACT',
148
- message: error instanceof CompletionGuardError
149
- ? error.message
150
- : 'Could not read the complete feature catalogue.',
151
- trigger: 'sdd_list_features',
152
- details: {
153
- entry: id,
154
- ...(error instanceof CompletionGuardError ? { reason: error.reason } : {}),
155
- },
156
- },
267
+ status,
268
+ task: null,
269
+ readiness: status === 'unlocked' ? 'blocked' : 'not_applicable',
270
+ integration: 'not_applicable',
271
+ blockers: status === 'unlocked' ? [{ reason: 'unlocked' }] : [],
272
+ nextAction: status === 'unlocked' ? 'review_lock' : status === 'no_tasks' ? 'inspect_tasks' : 'none',
157
273
  };
158
274
  }
275
+ export function preflightError(error) {
276
+ const failure = completionError(error, 'sdd_get_active_task');
277
+ if (failure.success) {
278
+ return makeFailure({
279
+ code: 'ERR_VERIFICATION_FAILED',
280
+ message: 'Verification preflight is unavailable.',
281
+ trigger: 'sdd_get_active_task',
282
+ });
283
+ }
284
+ const rawReason = failure.error.details?.reason;
285
+ const reasons = new Set([
286
+ 'guard_present',
287
+ 'contract_drift',
288
+ 'cancelled',
289
+ 'persistence_uncertain',
290
+ 'receipt_input_drift',
291
+ 'receipt_input_unavailable',
292
+ ]);
293
+ const reason = typeof rawReason === 'string' && reasons.has(rawReason) ? rawReason : 'failed';
294
+ return makeFailure({
295
+ code: failure.error.code,
296
+ message: 'Verification preflight is unavailable; inspect the bounded reason before retrying.',
297
+ trigger: 'sdd_get_active_task',
298
+ details: { reason },
299
+ });
300
+ }
301
+ export function deniedBudget(reason) {
302
+ return { version: 1, admission: 'denied', effectiveTimeoutMs: null, reason };
303
+ }
304
+ export function budgetPrecondition(context) {
305
+ if (!context.snapshot.locked) {
306
+ return 'unlocked';
307
+ }
308
+ if (!context.selected) {
309
+ return 'no_active_task';
310
+ }
311
+ for (const reason of [
312
+ 'command_missing',
313
+ 'platform_unsupported',
314
+ 'receipt_scoped_unsupported',
315
+ ]) {
316
+ if (context.preflight.blockers.some((blocker) => blocker.reason === reason)) {
317
+ return reason;
318
+ }
319
+ }
320
+ return null;
321
+ }
322
+ export function defaultBudget(reason) {
323
+ return { version: 1, admission: 'default', effectiveTimeoutMs: 180000, reason };
324
+ }
325
+ export function validCompactIdentifier(id) {
326
+ return id.length <= 128 && /^[A-Z0-9_-]+$/u.test(id);
327
+ }
159
328
  //# sourceMappingURL=task-failures.js.map
@@ -1,5 +1,7 @@
1
- import type { ActiveTaskResult, CompleteTaskResult, FeatureSummary, SddResult } from '../types/sdd-engine.js';
1
+ import type { ActiveTaskResult, CompleteTaskResult, FeatureSummary, SddResult, SddWorkspaceHandle } from '../types/sdd-engine.js';
2
+ import type { VerificationBudgetReader } from '../types/completion.js';
2
3
  import type { VerificationPolicy } from '../types/verification.js';
4
+ import { getResumeToolResult } from './resume-views.js';
3
5
  export declare class TaskWindowManager {
4
6
  private readonly scopedPolicy;
5
7
  private readonly scoped;
@@ -7,9 +9,10 @@ export declare class TaskWindowManager {
7
9
  private readonly pending;
8
10
  constructor(policy?: VerificationPolicy);
9
11
  shutdown(): Promise<void>;
10
- private activeTaskFromContent;
11
12
  private selectScopedTask;
12
13
  getActiveTask(tasksFilePath: string): Promise<SddResult<ActiveTaskResult>>;
14
+ readonly inspectVerificationBudget: VerificationBudgetReader;
15
+ getResumeToolResult(args: unknown, workspace: SddWorkspaceHandle, signal?: AbortSignal): ReturnType<typeof getResumeToolResult>;
13
16
  getVerificationPreflight(tasksPath: string, workspaceRoot: string, receipts?: unknown, signal?: AbortSignal): Promise<SddResult<ActiveTaskResult>>;
14
17
  getCatalogueEntry(featDir: string): Promise<SddResult<FeatureSummary>>;
15
18
  completeTask(tasksFilePath: string, taskId: string, workspaceRoot: string, _verificationOutput: string, signal?: AbortSignal, receipts?: unknown): Promise<SddResult<CompleteTaskResult>>;
@@ -19,5 +22,5 @@ export declare class TaskWindowManager {
19
22
  private attemptScopedCompletion;
20
23
  private completeOrdinary;
21
24
  }
22
- export declare function verificationCommand(taskMarkdown: string): string | null;
25
+ export { verificationCommand } from './task-failures.js';
23
26
  //# sourceMappingURL=task-window.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import * as path from 'node:path';
2
2
  import { ScopedVerificationCoordinator, runScopedVerification } from './verification-runner.js';
3
3
  import { isScopedVerificationFeature, persistScopedCompletionFiles, scopedFeaturePathFailure, } from './verification-policy.js';
4
+ import { getResumeToolResult } from './resume-views.js';
4
5
  import { getVerificationPreflight } from './verification-preflight.js';
5
6
  import { executionCard } from './lock-integrity.js';
6
7
  import { parseVerificationReceiptPolicy } from './feature-manifest.js';
@@ -9,7 +10,7 @@ import { CompletionGuardError, readFeatureArtifact } from './feature-authority.j
9
10
  import { acquireCompletionLease, inspectCompletionGuard, } from './completion-guard.js';
10
11
  import { captureCompletionSnapshot, revalidateCompletionSnapshot, commitOrdinaryTask, commitOwnedScopedTask, readCatalogueArtifacts, } from './completion-snapshot.js';
11
12
  import { activeTaskFromContent, catalogueFromContent, wasTaskCompleted } from './task-content.js';
12
- import { completionFailure, completionError, taskOutOfSequence, receiptFailure, verificationMissing, verificationFailed, unsupportedVerificationPlatform, scopedPathMismatch, taskFileMissing, catalogueReadFailure, } from './task-failures.js';
13
+ import { verificationCommand, completionFailure, completionError, taskOutOfSequence, receiptFailure, verificationMissing, verificationFailed, withVerificationProcess, unsupportedVerificationPlatform, scopedPathMismatch, taskFileMissing, catalogueReadFailure, } from './task-failures.js';
13
14
  export class TaskWindowManager {
14
15
  scopedPolicy;
15
16
  scoped;
@@ -26,11 +27,8 @@ export class TaskWindowManager {
26
27
  await this.scoped?.shutdown();
27
28
  await Promise.allSettled([...this.pending]);
28
29
  }
29
- activeTaskFromContent(content) {
30
- return activeTaskFromContent(content, verificationCommand);
31
- }
32
30
  selectScopedTask(content) {
33
- const result = this.activeTaskFromContent(content);
31
+ const result = activeTaskFromContent(content, verificationCommand);
34
32
  const active = result.success ? result.data.activeTask : null;
35
33
  return active
36
34
  ? {
@@ -55,7 +53,7 @@ export class TaskWindowManager {
55
53
  }
56
54
  return taskFileMissing(tasksFilePath);
57
55
  }
58
- const built = this.activeTaskFromContent(content);
56
+ const built = activeTaskFromContent(content, verificationCommand);
59
57
  if (!built.success) {
60
58
  return built;
61
59
  }
@@ -76,8 +74,12 @@ export class TaskWindowManager {
76
74
  return completionError(error, 'sdd_get_active_task');
77
75
  }
78
76
  }
77
+ inspectVerificationBudget = (taskId) => this.scoped?.inspectState(taskId);
78
+ getResumeToolResult(args, workspace, signal) {
79
+ return getResumeToolResult(args, workspace, this.scopedPolicy, signal, this.inspectVerificationBudget);
80
+ }
79
81
  async getVerificationPreflight(tasksPath, workspaceRoot, receipts, signal) {
80
- return getVerificationPreflight(tasksPath, workspaceRoot, verificationCommand, receipts, this.scopedPolicy, signal);
82
+ return getVerificationPreflight(tasksPath, workspaceRoot, verificationCommand, receipts, this.scopedPolicy, signal, this.inspectVerificationBudget);
81
83
  }
82
84
  async getCatalogueEntry(featDir) {
83
85
  const id = path.basename(featDir);
@@ -199,7 +201,7 @@ export class TaskWindowManager {
199
201
  return null;
200
202
  }
201
203
  async completeOrdinary(snapshot, lease, taskId, workspaceRoot, signal) {
202
- const active = this.activeTaskFromContent(snapshot.tasksContent);
204
+ const active = activeTaskFromContent(snapshot.tasksContent, verificationCommand);
203
205
  if (!active.success) {
204
206
  return active;
205
207
  }
@@ -237,22 +239,9 @@ export class TaskWindowManager {
237
239
  if (!run.ok) {
238
240
  return verificationFailed(run);
239
241
  }
240
- return commitOrdinaryTask(snapshot, lease, taskId, run.output, signal);
242
+ return withVerificationProcess(await commitOrdinaryTask(snapshot, lease, taskId, run.output, signal), run);
241
243
  }
242
244
  }
243
245
  const VERIFICATION_TIMEOUT_MS = 180_000;
244
- export function verificationCommand(taskMarkdown) {
245
- const line = taskMarkdown
246
- .split('\n')
247
- .map((entry) => entry.trim())
248
- .find((entry) => /^verification:/iu.test(entry));
249
- if (!line) {
250
- return null;
251
- }
252
- const command = line.replace(/^verification:\s*/iu, '').trim();
253
- if (command.length === 0 || command.includes('<') || command.includes('>')) {
254
- return null;
255
- }
256
- return command;
257
- }
246
+ export { verificationCommand } from './task-failures.js';
258
247
  //# sourceMappingURL=task-window.js.map
@@ -9,7 +9,6 @@ import { captureReceiptEvidence } from '../verification-receipts.js';
9
9
  import { captureVerificationRoot, checkReceiptPatchTarget, revalidateVerificationInputs, } from '../verification-inputs.js';
10
10
  import { completionError, completionFailure, patchMutationError } from '../task-failures.js';
11
11
  import { formatResult } from './compact-result.js';
12
- import { getResumeToolResult } from '../resume-views.js';
13
12
  import { acquireCompletionLease, inspectCompletionGuard } from '../completion-guard.js';
14
13
  import { captureCompletionSnapshot, revalidateCompletionSnapshot } from '../completion-snapshot.js';
15
14
  import { homeFallbackFailure, readTextInsideWorkspace } from '../workspace-root.js';
@@ -18,7 +17,7 @@ export function registerExecutionTools(server, workspace, policy) {
18
17
  const taskWindow = new TaskWindowManager(policy);
19
18
  registerReadArtifactTool(server, workspace);
20
19
  registerReadFileSliceTool(server, workspace);
21
- registerGetActiveTaskTool(server, workspace, taskWindow, policy);
20
+ registerGetActiveTaskTool(server, workspace, taskWindow);
22
21
  registerApplyPatchTool(server, workspace);
23
22
  registerCompleteTaskTool(server, workspace, taskWindow);
24
23
  return taskWindow;
@@ -65,7 +64,7 @@ function registerReadFileSliceTool(server, workspace) {
65
64
  return executeReadFileSlice(resolved.workspaceRoot, args.path, args.start_line, args.end_line);
66
65
  });
67
66
  }
68
- function registerGetActiveTaskTool(server, workspace, taskWindow, policy) {
67
+ function registerGetActiveTaskTool(server, workspace, taskWindow) {
69
68
  server.registerTool('sdd_get_active_task', {
70
69
  description: 'Returns only the active task. For fast resumption use view="resume"; use "relock_history" with history_cursor for older lock references, or "verification_preflight" to inspect evidence. Compact views are read-only and do not certify work.',
71
70
  inputSchema: GetActiveTaskInputSchema.shape,
@@ -80,7 +79,7 @@ function registerGetActiveTaskTool(server, workspace, taskWindow, policy) {
80
79
  rawArgs.execution_cursor !== undefined ||
81
80
  rawArgs.evidence_cursor !== undefined ||
82
81
  rawArgs.history_cursor !== undefined) {
83
- return getResumeToolResult(rawArgs, workspace, policy, extra.signal);
82
+ return taskWindow.getResumeToolResult(rawArgs, workspace, extra.signal);
84
83
  }
85
84
  const args = GetActiveTaskInputSchema.parse(rawArgs);
86
85
  const resolved = await workspace.resolve();
@@ -1,4 +1,5 @@
1
- import type { ScopedSnapshotResult } from '../types/completion.js';
1
+ export { uncertainCompletion, scopedFailure, cancelledVerification } from './task-failures.js';
2
+ import type * as completion from '../types/completion.js';
2
3
  import type { SddFailure, SddResult } from '../types/sdd-engine.js';
3
4
  import type { ScopedPolicy, ScopedTaskSelector, ScopedVerificationSnapshot, VerificationPolicy } from '../types/verification.js';
4
5
  export declare const DEFAULT_VERIFICATION_TIMEOUT_MS = 180000;
@@ -6,12 +7,11 @@ export declare function resolveVerificationPolicy(input?: unknown, workspaceRoot
6
7
  export declare function captureVerificationPolicy(raw: string | undefined, workspaceRoot?: string): VerificationPolicy;
7
8
  export declare function verificationDigest(content: string | Uint8Array): string;
8
9
  export declare function isScopedVerificationFeature(policy: ScopedPolicy, featureDirectory: string): Promise<boolean>;
9
- export declare function readScopedVerificationSnapshot(policy: ScopedPolicy, tasksPath: string, workspaceRoot: string, requestedTaskId: string, selectTask: ScopedTaskSelector): Promise<ScopedSnapshotResult>;
10
- export declare function revalidateScopedVerificationSnapshot(policy: ScopedPolicy, snapshot: ScopedVerificationSnapshot, selectTask: ScopedTaskSelector): Promise<ScopedSnapshotResult>;
11
- export declare function uncertainCompletion(): SddFailure;
10
+ export declare function scopedVerificationPathMatches(policy: ScopedPolicy, workspaceRoot: string, tasksPath: string): boolean;
11
+ export declare function compareScopedVerificationPins(policy: ScopedPolicy, capture: completion.ScopedVerificationPinCapture): SddResult<completion.ScopedVerificationTaskPinCheck>;
12
+ export declare function readScopedVerificationSnapshot(policy: ScopedPolicy, tasksPath: string, workspaceRoot: string, requestedTaskId: string, selectTask: ScopedTaskSelector): Promise<completion.ScopedSnapshotResult>;
13
+ export declare function revalidateScopedVerificationSnapshot(policy: ScopedPolicy, snapshot: ScopedVerificationSnapshot, selectTask: ScopedTaskSelector): Promise<completion.ScopedSnapshotResult>;
12
14
  export declare function persistScopedCompletionFiles(policy: ScopedPolicy, snapshot: ScopedVerificationSnapshot, writtenTasks: string, signal: AbortSignal): Promise<SddResult<null>>;
13
15
  export declare function scopedFeaturePathFailure(policy: ScopedPolicy): Promise<SddFailure | null>;
14
16
  export { scopedVerificationEnvironment } from './lock-integrity.js';
15
- export declare function scopedFailure(details: Record<string, unknown>): SddFailure;
16
- export declare function cancelledVerification(signal: AbortSignal): SddFailure | null;
17
17
  //# sourceMappingURL=verification-policy.d.ts.map