gsd-pi 2.79.0-dev.8f814f3af → 2.79.0-dev.9941c9c24
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/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/gsd/auto/contracts.js +1 -0
- package/dist/resources/extensions/gsd/auto/orchestrator.js +146 -0
- package/dist/resources/extensions/gsd/auto/phases.js +55 -6
- package/dist/resources/extensions/gsd/auto/session.js +8 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +45 -52
- package/dist/resources/extensions/gsd/auto-runtime-state.js +4 -0
- package/dist/resources/extensions/gsd/auto.js +159 -2
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +9 -1
- package/dist/resources/extensions/gsd/gsd-db.js +34 -1
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +13 -13
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +13 -13
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/package.json +1 -1
- package/src/resources/extensions/gsd/auto/contracts.ts +87 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +10 -3
- package/src/resources/extensions/gsd/auto/orchestrator.ts +161 -0
- package/src/resources/extensions/gsd/auto/phases.ts +82 -8
- package/src/resources/extensions/gsd/auto/session.ts +11 -0
- package/src/resources/extensions/gsd/auto-recovery.ts +42 -50
- package/src/resources/extensions/gsd/auto-runtime-state.ts +7 -0
- package/src/resources/extensions/gsd/auto.ts +167 -1
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +14 -1
- package/src/resources/extensions/gsd/gsd-db.ts +35 -1
- package/src/resources/extensions/gsd/interrupted-session.ts +1 -0
- package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +353 -0
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +3 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +134 -0
- package/src/resources/extensions/gsd/tests/paused-session-via-db.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +27 -0
- /package/dist/web/standalone/.next/static/{-O_omrDQQ0SfyCjHy578c → zSHLdEn5cpkqivbJZq0Qq}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{-O_omrDQQ0SfyCjHy578c → zSHLdEn5cpkqivbJZq0Qq}/_ssgManifest.js +0 -0
|
@@ -399,6 +399,140 @@ test("runDispatch pauses when complete-milestone summary exists on disk but the
|
|
|
399
399
|
assert.equal(stopCalls, 0, "mismatch pause should not hard-stop the loop");
|
|
400
400
|
});
|
|
401
401
|
|
|
402
|
+
test("runDispatch clears stuck state after Level 1 artifact recovery", async (t) => {
|
|
403
|
+
const capture = createEventCapture();
|
|
404
|
+
let invalidateCalls = 0;
|
|
405
|
+
let stopCalls = 0;
|
|
406
|
+
const base = join(tmpdir(), `gsd-stuck-plan-${randomUUID()}`);
|
|
407
|
+
t.after(() => {
|
|
408
|
+
closeDatabase();
|
|
409
|
+
rmSync(base, { recursive: true, force: true });
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
const sliceDir = join(base, ".gsd", "milestones", "M001", "slices", "S01");
|
|
413
|
+
const tasksDir = join(sliceDir, "tasks");
|
|
414
|
+
mkdirSync(tasksDir, { recursive: true });
|
|
415
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
416
|
+
insertMilestone({ id: "M001", title: "Test", status: "active" });
|
|
417
|
+
insertSlice({ id: "S01", milestoneId: "M001", title: "Slice", status: "pending" });
|
|
418
|
+
insertTask({ id: "T01", milestoneId: "M001", sliceId: "S01", title: "First task", status: "pending" });
|
|
419
|
+
writeFileSync(join(sliceDir, "S01-PLAN.md"), "# S01\n\n## Tasks\n\n- [ ] **T01: First task** `est:1h`\n");
|
|
420
|
+
writeFileSync(join(tasksDir, "T01-PLAN.md"), "# T01 Plan\n");
|
|
421
|
+
|
|
422
|
+
const deps = makeMockDeps(capture, {
|
|
423
|
+
invalidateAllCaches: () => { invalidateCalls++; },
|
|
424
|
+
stopAuto: async () => { stopCalls++; },
|
|
425
|
+
resolveDispatch: async () => ({
|
|
426
|
+
action: "dispatch" as const,
|
|
427
|
+
unitType: "plan-slice",
|
|
428
|
+
unitId: "M001/S01",
|
|
429
|
+
prompt: "plan the slice",
|
|
430
|
+
matchedRule: "planning → plan-slice",
|
|
431
|
+
}),
|
|
432
|
+
});
|
|
433
|
+
const ic = makeIC(deps, {
|
|
434
|
+
s: {
|
|
435
|
+
...makeSession(),
|
|
436
|
+
basePath: base,
|
|
437
|
+
originalBasePath: base,
|
|
438
|
+
} as any,
|
|
439
|
+
});
|
|
440
|
+
const preData: PreDispatchData = {
|
|
441
|
+
state: {
|
|
442
|
+
phase: "planning",
|
|
443
|
+
activeMilestone: { id: "M001", title: "Test", status: "active" },
|
|
444
|
+
activeSlice: { id: "S01", title: "Slice" },
|
|
445
|
+
registry: [{ id: "M001", status: "active" }],
|
|
446
|
+
blockers: [],
|
|
447
|
+
} as any,
|
|
448
|
+
mid: "M001",
|
|
449
|
+
midTitle: "Test Milestone",
|
|
450
|
+
};
|
|
451
|
+
const loopState: LoopState = {
|
|
452
|
+
recentUnits: [
|
|
453
|
+
{ key: "plan-slice/M001/S01" },
|
|
454
|
+
{ key: "plan-slice/M001/S01" },
|
|
455
|
+
],
|
|
456
|
+
stuckRecoveryAttempts: 0,
|
|
457
|
+
consecutiveFinalizeTimeouts: 0,
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
const result = await runDispatch(ic, preData, loopState);
|
|
461
|
+
|
|
462
|
+
assert.equal(result.action, "continue");
|
|
463
|
+
assert.equal(invalidateCalls, 1, "Level 1 artifact recovery should invalidate caches");
|
|
464
|
+
assert.equal(stopCalls, 0, "Level 1 artifact recovery should not hard-stop");
|
|
465
|
+
assert.deepEqual(loopState.recentUnits, [], "Level 1 artifact recovery should clear the stuck window");
|
|
466
|
+
assert.equal(loopState.stuckRecoveryAttempts, 0, "Level 1 artifact recovery should reset the recovery counter");
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
test("runDispatch escapes Level 2 stuck stop when artifact verifies after cache invalidation", async (t) => {
|
|
470
|
+
const capture = createEventCapture();
|
|
471
|
+
let invalidateCalls = 0;
|
|
472
|
+
let stopCalls = 0;
|
|
473
|
+
const base = join(tmpdir(), `gsd-stuck-plan-l2-${randomUUID()}`);
|
|
474
|
+
t.after(() => {
|
|
475
|
+
closeDatabase();
|
|
476
|
+
rmSync(base, { recursive: true, force: true });
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
const sliceDir = join(base, ".gsd", "milestones", "M001", "slices", "S01");
|
|
480
|
+
const tasksDir = join(sliceDir, "tasks");
|
|
481
|
+
mkdirSync(tasksDir, { recursive: true });
|
|
482
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
483
|
+
insertMilestone({ id: "M001", title: "Test", status: "active" });
|
|
484
|
+
insertSlice({ id: "S01", milestoneId: "M001", title: "Slice", status: "pending" });
|
|
485
|
+
insertTask({ id: "T01", milestoneId: "M001", sliceId: "S01", title: "First task", status: "pending" });
|
|
486
|
+
writeFileSync(join(sliceDir, "S01-PLAN.md"), "# S01\n\n## Tasks\n\n- [ ] **T01: First task** `est:1h`\n");
|
|
487
|
+
writeFileSync(join(tasksDir, "T01-PLAN.md"), "# T01 Plan\n");
|
|
488
|
+
|
|
489
|
+
const deps = makeMockDeps(capture, {
|
|
490
|
+
invalidateAllCaches: () => { invalidateCalls++; },
|
|
491
|
+
stopAuto: async () => { stopCalls++; },
|
|
492
|
+
resolveDispatch: async () => ({
|
|
493
|
+
action: "dispatch" as const,
|
|
494
|
+
unitType: "plan-slice",
|
|
495
|
+
unitId: "M001/S01",
|
|
496
|
+
prompt: "plan the slice",
|
|
497
|
+
matchedRule: "planning → plan-slice",
|
|
498
|
+
}),
|
|
499
|
+
});
|
|
500
|
+
const ic = makeIC(deps, {
|
|
501
|
+
s: {
|
|
502
|
+
...makeSession(),
|
|
503
|
+
basePath: base,
|
|
504
|
+
originalBasePath: base,
|
|
505
|
+
} as any,
|
|
506
|
+
});
|
|
507
|
+
const preData: PreDispatchData = {
|
|
508
|
+
state: {
|
|
509
|
+
phase: "planning",
|
|
510
|
+
activeMilestone: { id: "M001", title: "Test", status: "active" },
|
|
511
|
+
activeSlice: { id: "S01", title: "Slice" },
|
|
512
|
+
registry: [{ id: "M001", status: "active" }],
|
|
513
|
+
blockers: [],
|
|
514
|
+
} as any,
|
|
515
|
+
mid: "M001",
|
|
516
|
+
midTitle: "Test Milestone",
|
|
517
|
+
};
|
|
518
|
+
const loopState: LoopState = {
|
|
519
|
+
recentUnits: [
|
|
520
|
+
{ key: "plan-slice/M001/S01" },
|
|
521
|
+
{ key: "plan-slice/M001/S01" },
|
|
522
|
+
],
|
|
523
|
+
stuckRecoveryAttempts: 1,
|
|
524
|
+
consecutiveFinalizeTimeouts: 0,
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
const result = await runDispatch(ic, preData, loopState);
|
|
528
|
+
|
|
529
|
+
assert.equal(result.action, "continue");
|
|
530
|
+
assert.equal(invalidateCalls, 1, "Level 2 escape should invalidate caches before rechecking artifacts");
|
|
531
|
+
assert.equal(stopCalls, 0, "verified artifacts should escape Level 2 hard stop");
|
|
532
|
+
assert.deepEqual(loopState.recentUnits, [], "Level 2 artifact escape should clear the stuck window");
|
|
533
|
+
assert.equal(loopState.stuckRecoveryAttempts, 0, "Level 2 artifact escape should reset the recovery counter");
|
|
534
|
+
});
|
|
535
|
+
|
|
402
536
|
test("runUnitPhase emits unit-start and unit-end with causedBy reference", async () => {
|
|
403
537
|
const capture = createEventCapture();
|
|
404
538
|
|
|
@@ -64,6 +64,7 @@ test("readPausedSessionMetadata round-trips a real PausedSessionMetadata payload
|
|
|
64
64
|
activeRunDir: null,
|
|
65
65
|
autoStartTime: Date.now(),
|
|
66
66
|
milestoneLock: null,
|
|
67
|
+
pauseReason: "Blocked: waiting for UAT",
|
|
67
68
|
};
|
|
68
69
|
setRuntimeKv("global", "", PAUSED_SESSION_KV_KEY, meta);
|
|
69
70
|
|
|
@@ -73,6 +74,7 @@ test("readPausedSessionMetadata round-trips a real PausedSessionMetadata payload
|
|
|
73
74
|
assert.equal(loaded!.unitType, "plan-slice");
|
|
74
75
|
assert.equal(loaded!.unitId, "M001/S01");
|
|
75
76
|
assert.equal(loaded!.sessionFile, "/tmp/session.jsonl");
|
|
77
|
+
assert.equal(loaded!.pauseReason, "Blocked: waiting for UAT");
|
|
76
78
|
});
|
|
77
79
|
|
|
78
80
|
test("readPausedSessionMetadata auto-deletes stale pseudo-milestone pause rows", (t) => {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// GSD Extension — Plan-slice tool integration tests.
|
|
2
|
+
|
|
1
3
|
import test from 'node:test';
|
|
2
4
|
import assert from 'node:assert/strict';
|
|
3
5
|
import { mkdtempSync, mkdirSync, rmSync, readFileSync, existsSync, writeFileSync } from 'node:fs';
|
|
@@ -8,6 +10,7 @@ import { openDatabase, closeDatabase, insertMilestone, insertSlice, getSlice, ge
|
|
|
8
10
|
import { handlePlanSlice } from '../tools/plan-slice.ts';
|
|
9
11
|
import { parsePlan } from '../parsers-legacy.ts';
|
|
10
12
|
import { parseTaskPlanFile } from '../files.ts';
|
|
13
|
+
import { deriveState, invalidateStateCache } from '../state.ts';
|
|
11
14
|
|
|
12
15
|
function makeTmpBase(): string {
|
|
13
16
|
const base = mkdtempSync(join(tmpdir(), 'gsd-plan-slice-'));
|
|
@@ -98,6 +101,30 @@ test('handlePlanSlice writes slice/task planning state and renders plan artifact
|
|
|
98
101
|
}
|
|
99
102
|
});
|
|
100
103
|
|
|
104
|
+
test('handlePlanSlice advances DB-derived state out of planning immediately', async () => {
|
|
105
|
+
const base = makeTmpBase();
|
|
106
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
107
|
+
|
|
108
|
+
try {
|
|
109
|
+
seedParentSlice();
|
|
110
|
+
|
|
111
|
+
invalidateStateCache();
|
|
112
|
+
const before = await deriveState(base);
|
|
113
|
+
assert.equal(before.phase, 'planning');
|
|
114
|
+
assert.equal(before.progress?.tasks?.total, 0);
|
|
115
|
+
|
|
116
|
+
const result = await handlePlanSlice(validParams(), base);
|
|
117
|
+
assert.ok(!('error' in result), `unexpected error: ${'error' in result ? result.error : ''}`);
|
|
118
|
+
|
|
119
|
+
invalidateStateCache();
|
|
120
|
+
const after = await deriveState(base);
|
|
121
|
+
assert.notEqual(after.phase, 'planning');
|
|
122
|
+
assert.equal(after.progress?.tasks?.total, 2);
|
|
123
|
+
} finally {
|
|
124
|
+
cleanup(base);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
101
128
|
test('handlePlanSlice leaves omitted enrichment fields empty instead of rendering placeholders', async () => {
|
|
102
129
|
const base = makeTmpBase();
|
|
103
130
|
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
File without changes
|
|
File without changes
|