dsh-spec-collab 0.3.0 → 0.4.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 +19 -0
- package/README.md +66 -24
- package/docs/assets/demo-01-workspace.png +0 -0
- package/docs/assets/demo-02-ai-review.png +0 -0
- package/docs/assets/demo-03-patches.png +0 -0
- package/docs/assets/demo-04-decisions.png +0 -0
- package/docs/assets/demo-05-ready.png +0 -0
- package/docs/usage-walkthrough.md +25 -43
- package/lib/client.js +863 -626
- package/lib/index.js +71 -71
- package/lib/types/client/index.d.ts +2 -3
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/sidebar-anchor.d.ts.map +1 -1
- package/lib/types/client/workflow.d.ts.map +1 -1
- package/lib/types/engine.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/ready-admission.d.ts +14 -0
- package/lib/types/ready-admission.d.ts.map +1 -0
- package/lib/types/review-runtime.d.ts +12 -3
- package/lib/types/review-runtime.d.ts.map +1 -1
- package/package.json +35 -27
- package/src/client/index.ts +2 -4
- package/src/client/sidebar-anchor.ts +2 -0
- package/src/client/workflow.ts +8 -9
- package/src/engine.ts +10 -6
- package/src/index.ts +4 -4
- package/src/ready-admission.ts +29 -0
- package/src/review-runtime.ts +29 -29
- package/docs/assets/spec-collab-walkthrough.mp4 +0 -0
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve } from "node:path";
|
|
3
|
-
import Schema from "schemastery";
|
|
3
|
+
import Schema from "@deepseek-ai/schemastery";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
5
|
import { closeSync, copyFileSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { execFileSync } from "node:child_process";
|
|
@@ -482,6 +482,32 @@ function backtrack(trace, left, right) {
|
|
|
482
482
|
return result.reverse();
|
|
483
483
|
}
|
|
484
484
|
//#endregion
|
|
485
|
+
//#region src/ready-admission.ts
|
|
486
|
+
function hasCompletedCurrentReview(record, kind) {
|
|
487
|
+
return record.aiRuns.some((run) => run.commit === record.currentCommit && run.kind === kind && run.status === "completed");
|
|
488
|
+
}
|
|
489
|
+
function hasVersionConfirmation(record, role) {
|
|
490
|
+
return record.confirmations.some((item) => item.commit === record.currentCommit && item.role === role && item.scope === "version" && item.status === "active");
|
|
491
|
+
}
|
|
492
|
+
/** Shared by workflow guidance and the authoritative Ready write. Checks must come from the current Git body. */
|
|
493
|
+
function readyAdmission(record, checks) {
|
|
494
|
+
const activeRun = record.aiRuns.slice().reverse().find((run) => run.commit === record.currentCommit && (run.status === "queued" || run.status === "running"));
|
|
495
|
+
const engineeringReviewed = hasCompletedCurrentReview(record, "engineering-precheck");
|
|
496
|
+
const pendingPatches = record.patches.filter((item) => item.baseCommit === record.currentCommit && item.status === "pending");
|
|
497
|
+
const failedChecks = checks.filter((check) => !check.passed);
|
|
498
|
+
const productConfirmed = hasVersionConfirmation(record, "product");
|
|
499
|
+
const engineeringConfirmed = hasVersionConfirmation(record, "engineering");
|
|
500
|
+
return {
|
|
501
|
+
activeRun,
|
|
502
|
+
engineeringReviewed,
|
|
503
|
+
pendingPatches,
|
|
504
|
+
failedChecks,
|
|
505
|
+
productConfirmed,
|
|
506
|
+
engineeringConfirmed,
|
|
507
|
+
error: record.stage !== "joint-review" ? "readiness gate is not satisfied" : !record.workspaceId?.trim() ? "review workspace is required" : activeRun ? "current version review is still running" : !engineeringReviewed ? "engineering precheck is required for the current version" : pendingPatches.length > 0 ? "current version has pending patches" : failedChecks.length > 0 ? "readiness gate is not satisfied" : !productConfirmed || !engineeringConfirmed ? "current version needs product and engineering confirmation" : void 0
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
//#endregion
|
|
485
511
|
//#region src/engine.ts
|
|
486
512
|
const emptyState = () => ({
|
|
487
513
|
schemaVersion: 3,
|
|
@@ -1122,9 +1148,8 @@ var CollaborationEngine = class {
|
|
|
1122
1148
|
this.persist();
|
|
1123
1149
|
} else if (action.kind === "ready.generate") {
|
|
1124
1150
|
requireHuman(action.participant);
|
|
1125
|
-
const
|
|
1126
|
-
if (
|
|
1127
|
-
if (!hasVersionConfirmation(record, "product") || !hasVersionConfirmation(record, "engineering")) throw new Error("current version needs product and engineering confirmation");
|
|
1151
|
+
const admission = readyAdmission(record, readiness(this.versions.read(record.id, record.currentCommit).markdown, record));
|
|
1152
|
+
if (admission.error) throw new Error(admission.error);
|
|
1128
1153
|
const markdown = readyMarkdown(this.view(record.id));
|
|
1129
1154
|
record.readyPackage = {
|
|
1130
1155
|
requirementId: record.id,
|
|
@@ -1441,14 +1466,17 @@ var CollaborationEngine = class {
|
|
|
1441
1466
|
run,
|
|
1442
1467
|
...existingSession ? { sessionId: existingSession } : {}
|
|
1443
1468
|
}).then((sessionId) => {
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1469
|
+
const currentRecord = this.state.requirements.find((item) => item.id === record.id);
|
|
1470
|
+
const currentRun = currentRecord?.aiRuns.find((item) => item.id === run.id);
|
|
1471
|
+
if (currentRecord === void 0 || currentRun === void 0) return;
|
|
1472
|
+
if (currentRun.status === "queued") currentRun.status = "running";
|
|
1473
|
+
currentRun.sessionId = sessionId;
|
|
1474
|
+
currentRun.updatedAt = Date.now();
|
|
1475
|
+
this.rememberStageConversation(currentRecord, sessionId, requestedStage, requestedStageCycle);
|
|
1448
1476
|
this.persist({
|
|
1449
1477
|
types: ["ai.status", "metrics.changed"],
|
|
1450
|
-
requirementId:
|
|
1451
|
-
objectId:
|
|
1478
|
+
requirementId: currentRecord.id,
|
|
1479
|
+
objectId: currentRun.id
|
|
1452
1480
|
});
|
|
1453
1481
|
}, (error) => this.markAiFailure(record.id, run.id, error instanceof Error ? error.message : String(error)));
|
|
1454
1482
|
}
|
|
@@ -1907,9 +1935,6 @@ function actionForReview(item) {
|
|
|
1907
1935
|
updatedAt: now
|
|
1908
1936
|
};
|
|
1909
1937
|
}
|
|
1910
|
-
function hasVersionConfirmation(record, role) {
|
|
1911
|
-
return record.confirmations.some((item) => item.role === role && item.scope === "version" && item.commit === record.currentCommit && item.status === "active");
|
|
1912
|
-
}
|
|
1913
1938
|
function enterStage(record, stage) {
|
|
1914
1939
|
if (record.stage === stage) return;
|
|
1915
1940
|
record.stage = stage;
|
|
@@ -1922,7 +1947,7 @@ function advance(record, participant) {
|
|
|
1922
1947
|
"non-blocking-verify",
|
|
1923
1948
|
"joint-review"
|
|
1924
1949
|
].includes(item.status))) throw new Error("product blocking review items remain");
|
|
1925
|
-
if (!record
|
|
1950
|
+
if (!hasCompletedCurrentReview(record, "product-second")) throw new Error("product second review is required");
|
|
1926
1951
|
enterStage(record, "product-confirmation");
|
|
1927
1952
|
return;
|
|
1928
1953
|
}
|
|
@@ -2427,31 +2452,25 @@ function errorMessage(error) {
|
|
|
2427
2452
|
}
|
|
2428
2453
|
//#endregion
|
|
2429
2454
|
//#region src/review-runtime.ts
|
|
2430
|
-
function request(payload) {
|
|
2431
|
-
return {
|
|
2432
|
-
rpcId: `spec-collab-${crypto.randomUUID()}`,
|
|
2433
|
-
payload
|
|
2434
|
-
};
|
|
2435
|
-
}
|
|
2436
|
-
function failure(error) {
|
|
2437
|
-
return /* @__PURE__ */ new Error(`${error.code}: ${error.message}`);
|
|
2438
|
-
}
|
|
2439
2455
|
const FOLLOW_UP_METADATA = "\n\n<!-- dsh-spec-collab-follow-up:";
|
|
2440
2456
|
var DshReviewCoordinator = class {
|
|
2441
|
-
|
|
2457
|
+
host;
|
|
2442
2458
|
contexts;
|
|
2443
2459
|
prompts;
|
|
2444
2460
|
stageSessions = /* @__PURE__ */ new Map();
|
|
2445
|
-
|
|
2446
|
-
|
|
2461
|
+
lifetime = new AbortController();
|
|
2462
|
+
constructor(host, contexts = new ReviewContextCatalog(), prompts = {}) {
|
|
2463
|
+
this.host = host;
|
|
2447
2464
|
this.contexts = contexts;
|
|
2448
2465
|
this.prompts = resolveReviewPrompts(prompts);
|
|
2449
2466
|
}
|
|
2467
|
+
dispose() {
|
|
2468
|
+
this.lifetime.abort();
|
|
2469
|
+
this.stageSessions.clear();
|
|
2470
|
+
}
|
|
2450
2471
|
async reviewWorkspaces() {
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
return listed.result.value.items.map((item) => ({
|
|
2454
|
-
workspaceId: item.workspaceId,
|
|
2472
|
+
return this.host.workspaceRegistry.list().map((item) => ({
|
|
2473
|
+
workspaceId: item.id,
|
|
2455
2474
|
title: item.title,
|
|
2456
2475
|
path: item.path
|
|
2457
2476
|
}));
|
|
@@ -2476,26 +2495,25 @@ var DshReviewCoordinator = class {
|
|
|
2476
2495
|
});
|
|
2477
2496
|
}
|
|
2478
2497
|
async conversation(sessionId) {
|
|
2479
|
-
const history = await this.
|
|
2480
|
-
if (!history.result.ok) throw failure(history.result.error);
|
|
2498
|
+
const history = await this.host.sessionController.inspect(sessionId, this.lifetime.signal);
|
|
2481
2499
|
const rows = [];
|
|
2482
2500
|
let skippedOrchestrationPrompt = false;
|
|
2483
|
-
for (const entry of history.
|
|
2484
|
-
if (entry.
|
|
2485
|
-
if (entry.
|
|
2501
|
+
for (const entry of history.events) {
|
|
2502
|
+
if (entry.type !== "user/message" && entry.type !== "assistant/message") continue;
|
|
2503
|
+
if (entry.type === "user/message" && !skippedOrchestrationPrompt) {
|
|
2486
2504
|
skippedOrchestrationPrompt = true;
|
|
2487
2505
|
continue;
|
|
2488
2506
|
}
|
|
2489
|
-
const value = entry.
|
|
2507
|
+
const value = entry.data;
|
|
2490
2508
|
const message = isObject(value) && "message" in value ? value.message : value;
|
|
2491
2509
|
let messageText = collectText(isObject(message) && "content" in message ? message.content : message).join("\n").trim();
|
|
2492
|
-
if (entry.
|
|
2510
|
+
if (entry.type === "user/message") {
|
|
2493
2511
|
const followUp = storedFollowUp(messageText) ?? extractPromptValue(messageText, this.prompts.followUp.trim(), "CONTENT") ?? extractPromptValue(messageText, DEFAULT_REVIEW_PROMPTS.followUp, "CONTENT");
|
|
2494
2512
|
if (followUp === void 0) continue;
|
|
2495
2513
|
messageText = followUp.trim();
|
|
2496
2514
|
}
|
|
2497
2515
|
if (messageText !== "") rows.push({
|
|
2498
|
-
role: entry.
|
|
2516
|
+
role: entry.type === "user/message" ? "user" : "assistant",
|
|
2499
2517
|
text: messageText
|
|
2500
2518
|
});
|
|
2501
2519
|
}
|
|
@@ -2506,15 +2524,7 @@ var DshReviewCoordinator = class {
|
|
|
2506
2524
|
if (content === "") throw new Error("追问内容不能为空");
|
|
2507
2525
|
const metadata = Buffer.from(content, "utf8").toString("base64url");
|
|
2508
2526
|
const promptText = `${renderPrompt(this.prompts.followUp, { CONTENT: content }).trim()}${FOLLOW_UP_METADATA}${metadata} -->`;
|
|
2509
|
-
|
|
2510
|
-
sessionId,
|
|
2511
|
-
mode: "queue",
|
|
2512
|
-
content: [{
|
|
2513
|
-
type: "text",
|
|
2514
|
-
text: promptText
|
|
2515
|
-
}]
|
|
2516
|
-
}));
|
|
2517
|
-
if (!prompted.result.ok) throw failure(prompted.result.error);
|
|
2527
|
+
await this.promptExisting(sessionId, promptText);
|
|
2518
2528
|
}
|
|
2519
2529
|
async inStageSession(requirement, existingSessionId, continuation, launch) {
|
|
2520
2530
|
const key = `${requirement.id}:${requirement.stage}:${requirement.stageCycle}`;
|
|
@@ -2548,43 +2558,30 @@ var DshReviewCoordinator = class {
|
|
|
2548
2558
|
}
|
|
2549
2559
|
}
|
|
2550
2560
|
async promptExisting(sessionId, promptText) {
|
|
2551
|
-
|
|
2561
|
+
await this.host.sessionController.prompt({
|
|
2562
|
+
requestId: `spec-collab-${crypto.randomUUID()}`,
|
|
2552
2563
|
sessionId,
|
|
2553
2564
|
mode: "queue",
|
|
2554
2565
|
content: [{
|
|
2555
2566
|
type: "text",
|
|
2556
2567
|
text: promptText
|
|
2557
2568
|
}]
|
|
2558
|
-
})
|
|
2559
|
-
if (!prompted.result.ok) throw failure(prompted.result.error);
|
|
2569
|
+
}, this.lifetime.signal);
|
|
2560
2570
|
}
|
|
2561
2571
|
async launch(title, promptText, workspaceId, agentPreset) {
|
|
2562
2572
|
if (agentPreset !== void 0) {
|
|
2563
|
-
const
|
|
2564
|
-
if (!presets.result.ok) throw failure(presets.result.error);
|
|
2565
|
-
const preset = presets.result.value.presets.find((item) => item.id === agentPreset);
|
|
2573
|
+
const preset = (await this.host.agentPresets.list()).find((item) => item.id === agentPreset);
|
|
2566
2574
|
if (preset === void 0 || preset.broken !== void 0) throw new Error("agent preset is unavailable");
|
|
2567
2575
|
}
|
|
2568
|
-
const
|
|
2576
|
+
const { sessionId } = await this.host.sessionController.create({
|
|
2569
2577
|
workspaceId,
|
|
2570
2578
|
...agentPreset === void 0 ? {} : { agentPreset }
|
|
2571
|
-
})
|
|
2572
|
-
|
|
2573
|
-
const sessionId = created.result.value.sessionId;
|
|
2574
|
-
const renamed = await this.api.sessions.rename(request({
|
|
2579
|
+
});
|
|
2580
|
+
await this.host.sessionController.rename({
|
|
2575
2581
|
sessionId,
|
|
2576
2582
|
title
|
|
2577
|
-
})
|
|
2578
|
-
|
|
2579
|
-
const prompted = await this.api.sessions.prompt(request({
|
|
2580
|
-
sessionId,
|
|
2581
|
-
mode: "queue",
|
|
2582
|
-
content: [{
|
|
2583
|
-
type: "text",
|
|
2584
|
-
text: promptText.replaceAll("{{SESSION_ID}}", sessionId)
|
|
2585
|
-
}]
|
|
2586
|
-
}));
|
|
2587
|
-
if (!prompted.result.ok) throw failure(prompted.result.error);
|
|
2583
|
+
});
|
|
2584
|
+
await this.promptExisting(sessionId, promptText.replaceAll("{{SESSION_ID}}", sessionId));
|
|
2588
2585
|
return sessionId;
|
|
2589
2586
|
}
|
|
2590
2587
|
async resolveWorkspace(workspaceId) {
|
|
@@ -3494,7 +3491,9 @@ function allSpecTools(engine) {
|
|
|
3494
3491
|
const name = "spec-collab";
|
|
3495
3492
|
const inject = [
|
|
3496
3493
|
"webServer",
|
|
3497
|
-
"
|
|
3494
|
+
"sessionController",
|
|
3495
|
+
"workspaceRegistry",
|
|
3496
|
+
"agentPresets",
|
|
3498
3497
|
"tools",
|
|
3499
3498
|
"systemPrompt"
|
|
3500
3499
|
];
|
|
@@ -3532,8 +3531,9 @@ function apply(ctx, config = {}) {
|
|
|
3532
3531
|
const contexts = new ReviewContextCatalog(config);
|
|
3533
3532
|
const prompts = resolveReviewPrompts(config.prompts);
|
|
3534
3533
|
const engine = new CollaborationEngine(join(dataRoot, "collaboration-v3.json"), new GitRequirementStore(config.repositoryPath ?? join(dataRoot, "repository")), { legacyPath: join(dataRoot, "collaboration-v2.json") });
|
|
3535
|
-
const coordinator = new DshReviewCoordinator(ctx
|
|
3534
|
+
const coordinator = new DshReviewCoordinator(ctx, contexts, prompts);
|
|
3536
3535
|
engine.setCoordinator(coordinator);
|
|
3536
|
+
ctx.effect(() => () => coordinator.dispose(), "spec-collab: review lifetime");
|
|
3537
3537
|
ctx.effect(() => {
|
|
3538
3538
|
const disposers = makeRoutes(engine, coordinator).map((route) => ctx.webServer.register(route));
|
|
3539
3539
|
return () => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare
|
|
3
|
-
export declare function apply(ctx: ClientContext): void;
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
export declare function apply(ctx: Context): void;
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAIlD,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CASxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-anchor.d.ts","sourceRoot":"","sources":["../../../src/client/sidebar-anchor.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,iBAAiB,CAAA;IAC1B,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAA;CAC9B;AAMD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"sidebar-anchor.d.ts","sourceRoot":"","sources":["../../../src/client/sidebar-anchor.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,iBAAiB,CAAA;IAC1B,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAA;CAC9B;AAMD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS,CAQ/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../../src/client/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../../src/client/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGlF,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAA;AACrD,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,G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aAAa,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,mBAAmB,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAS/G,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAS3E,OAAO,CAAC,UAAU;IA6PlB,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,yBAAyB;IAKjC,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,aAAa;IAoBrB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,IAAI;CAwBb;AAsRD,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,cAAc,EAAE,CAYvF"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
-
import Schema from 'schemastery';
|
|
2
|
+
import Schema from '@deepseek-ai/schemastery';
|
|
3
3
|
import { DEFAULT_REVIEW_PROMPTS, resolveReviewPrompts, type ReviewPromptConfig } from './prompts.ts';
|
|
4
4
|
import { type ReviewContextConfig } from './review-context.ts';
|
|
5
5
|
export { DEFAULT_REVIEW_PROMPTS, resolveReviewPrompts };
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAM7C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEpG,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAIpF,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,CAAA;AACvD,YAAY,EAAE,kBAAkB,EAAE,CAAA;AAElC,eAAO,MAAM,IAAI,gBAAgB,CAAA;AACjC,eAAO,MAAM,MAAM,UAAmG,CAAA;AACtH,MAAM,WAAW,MAAO,SAAQ,mBAAmB;IAAG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,kBAAkB,CAAA;CAAE;AAUhI,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,CAoBd,CAAA;AAEpB,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CAc7D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ParticipantRole, ReadinessCheck, RequirementRecord, ReviewKind } from './protocol.ts';
|
|
2
|
+
export declare function hasCompletedCurrentReview(record: Pick<RequirementRecord, 'aiRuns' | 'currentCommit'>, kind: ReviewKind): boolean;
|
|
3
|
+
export declare function hasVersionConfirmation(record: Pick<RequirementRecord, 'confirmations' | 'currentCommit'>, role: ParticipantRole): boolean;
|
|
4
|
+
/** Shared by workflow guidance and the authoritative Ready write. Checks must come from the current Git body. */
|
|
5
|
+
export declare function readyAdmission(record: RequirementRecord, checks: ReadinessCheck[]): {
|
|
6
|
+
activeRun: import("./protocol.ts").AiReviewRun | undefined;
|
|
7
|
+
engineeringReviewed: boolean;
|
|
8
|
+
pendingPatches: import("./protocol.ts").CandidatePatch[];
|
|
9
|
+
failedChecks: ReadinessCheck[];
|
|
10
|
+
productConfirmed: boolean;
|
|
11
|
+
engineeringConfirmed: boolean;
|
|
12
|
+
error: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=ready-admission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ready-admission.d.ts","sourceRoot":"","sources":["../../src/ready-admission.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAEnG,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,eAAe,CAAC,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAGhI;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,eAAe,CAAC,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAEzI;AAED,iHAAiH;AACjH,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,EAAE;;;;;;;;EAgBjF"}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SessionController } from '@deepseek-ai/dsh-api-session-controller';
|
|
2
|
+
import type { AgentPresetRegistry } from '@deepseek-ai/dsh-agent-preset-registry';
|
|
3
|
+
import type { WorkspaceRegistry } from '@deepseek-ai/dsh-workspace';
|
|
2
4
|
import type { AiCoordinator } from './engine.ts';
|
|
3
5
|
import type { AiReviewRun, CommentThread, RequirementView, ReviewWorkspaceSummary } from './protocol.ts';
|
|
4
6
|
import { type ReviewPromptConfig } from './prompts.ts';
|
|
5
7
|
import { ReviewContextCatalog } from './review-context.ts';
|
|
8
|
+
export interface DshReviewHost {
|
|
9
|
+
sessionController: Pick<SessionController, 'create' | 'rename' | 'prompt' | 'inspect'>;
|
|
10
|
+
workspaceRegistry: Pick<WorkspaceRegistry, 'list'>;
|
|
11
|
+
agentPresets: Pick<AgentPresetRegistry, 'list'>;
|
|
12
|
+
}
|
|
6
13
|
export declare class DshReviewCoordinator implements AiCoordinator {
|
|
7
|
-
private readonly
|
|
14
|
+
private readonly host;
|
|
8
15
|
private readonly contexts;
|
|
9
16
|
private readonly prompts;
|
|
10
17
|
private readonly stageSessions;
|
|
11
|
-
|
|
18
|
+
private readonly lifetime;
|
|
19
|
+
constructor(host: DshReviewHost, contexts?: ReviewContextCatalog, prompts?: ReviewPromptConfig);
|
|
20
|
+
dispose(): void;
|
|
12
21
|
reviewWorkspaces(): Promise<ReviewWorkspaceSummary[]>;
|
|
13
22
|
assertWorkspaceAvailable(workspaceId: string): Promise<void>;
|
|
14
23
|
requestReview(input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-runtime.d.ts","sourceRoot":"","sources":["../../src/review-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"review-runtime.d.ts","sourceRoot":"","sources":["../../src/review-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAwB,MAAM,yCAAyC,CAAA;AACtG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AACjF,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACxG,OAAO,EAA8G,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAClK,OAAO,EAAE,oBAAoB,EAAuB,MAAM,qBAAqB,CAAA;AAG/E,MAAM,WAAW,aAAa;IAC5B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAA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B,OAAO,CAAC,oBAAoB;YACd,cAAc;YAOd,MAAM;YAUN,gBAAgB;CAK/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-spec-collab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "AI-assisted requirement clarification and Git-backed Spec co-creation for DeepSeek Harness, ending at a human-confirmed Ready Spec.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -36,46 +36,40 @@
|
|
|
36
36
|
"patch": "./cordis.patch.yml"
|
|
37
37
|
},
|
|
38
38
|
"client": {
|
|
39
|
-
"inject": [
|
|
40
|
-
"@deepseek-ai/dsh-client-runtime",
|
|
41
|
-
"@deepseek-ai/dsh-client-connection"
|
|
42
|
-
],
|
|
43
39
|
"platform": "web"
|
|
44
40
|
}
|
|
45
41
|
},
|
|
46
42
|
"files": [
|
|
47
43
|
"lib",
|
|
48
44
|
"src",
|
|
49
|
-
"docs",
|
|
45
|
+
"docs/*.md",
|
|
46
|
+
"docs/*.csv",
|
|
47
|
+
"docs/assets",
|
|
50
48
|
"cordis.patch.yml",
|
|
51
|
-
"README.md"
|
|
49
|
+
"README.md",
|
|
50
|
+
"CHANGELOG.md"
|
|
52
51
|
],
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"build": "npm run clean && tsc -p tsconfig.build.json && tsdown",
|
|
56
|
-
"bundle": "tsdown",
|
|
57
|
-
"prepare": "npm run build",
|
|
58
|
-
"typecheck": "tsc --noEmit",
|
|
59
|
-
"test": "vitest run --maxWorkers=1 --minWorkers=1 --exclude tests/e2e/**",
|
|
60
|
-
"test:e2e": "playwright test"
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"registry": "https://registry.npmjs.org"
|
|
61
54
|
},
|
|
62
55
|
"dependencies": {
|
|
63
56
|
"@toast-ui/editor": "3.2.2",
|
|
64
57
|
"lightningcss": "^1.32.0",
|
|
65
58
|
"markdown-it": "^14.1.0",
|
|
66
59
|
"prosemirror-inputrules": "^1.5.0",
|
|
67
|
-
"schemastery": "
|
|
60
|
+
"@deepseek-ai/schemastery": "~3.18.5"
|
|
68
61
|
},
|
|
69
62
|
"devDependencies": {
|
|
70
63
|
"@axe-core/playwright": "^4.10.0",
|
|
71
|
-
"@deepseek-ai/cordis": "
|
|
72
|
-
"@deepseek-ai/dsh-
|
|
73
|
-
"@deepseek-ai/dsh-
|
|
74
|
-
"@deepseek-ai/dsh-
|
|
75
|
-
"@deepseek-ai/dsh-host-webserver": "
|
|
76
|
-
"@deepseek-ai/dsh-llm": "
|
|
77
|
-
"@deepseek-ai/dsh-system-prompt": "
|
|
78
|
-
"@deepseek-ai/dsh-tools": "
|
|
64
|
+
"@deepseek-ai/cordis": "~4.0.5",
|
|
65
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.1-rc.5",
|
|
66
|
+
"@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.5",
|
|
67
|
+
"@deepseek-ai/dsh-app-boot": "0.2.1-rc.5",
|
|
68
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.1-rc.5",
|
|
69
|
+
"@deepseek-ai/dsh-llm": "0.2.1-rc.5",
|
|
70
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-rc.5",
|
|
71
|
+
"@deepseek-ai/dsh-tools": "0.2.1-rc.5",
|
|
72
|
+
"@deepseek-ai/dsh-workspace": "0.2.1-rc.5",
|
|
79
73
|
"@playwright/test": "^1.55.0",
|
|
80
74
|
"@types/markdown-it": "^14.1.2",
|
|
81
75
|
"@types/node": "^22.20.0",
|
|
@@ -89,12 +83,26 @@
|
|
|
89
83
|
"vitest": "^3.0.0"
|
|
90
84
|
},
|
|
91
85
|
"peerDependencies": {
|
|
86
|
+
"@deepseek-ai/cordis": "~4.0.5",
|
|
87
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.1-rc.5",
|
|
88
|
+
"@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.5",
|
|
89
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.1-rc.5",
|
|
90
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-rc.5",
|
|
91
|
+
"@deepseek-ai/dsh-tools": "0.2.1-rc.5",
|
|
92
|
+
"@deepseek-ai/dsh-workspace": "0.2.1-rc.5",
|
|
92
93
|
"react": "^18.2.0",
|
|
93
94
|
"react-dom": "^18.2.0"
|
|
94
95
|
},
|
|
95
96
|
"engines": {
|
|
96
97
|
"node": ">=20"
|
|
97
98
|
},
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
}
|
|
99
|
+
"license": "Apache-2.0",
|
|
100
|
+
"scripts": {
|
|
101
|
+
"clean": "node -e \"require('node:fs').rmSync('lib', { recursive: true, force: true })\"",
|
|
102
|
+
"build": "npm run clean && tsc -p tsconfig.build.json && tsdown",
|
|
103
|
+
"bundle": "tsdown",
|
|
104
|
+
"typecheck": "tsc --noEmit",
|
|
105
|
+
"test": "vitest run --maxWorkers=1 --minWorkers=1 --exclude tests/e2e/**",
|
|
106
|
+
"test:e2e": "playwright test"
|
|
107
|
+
}
|
|
108
|
+
}
|
package/src/client/index.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
2
2
|
import { SpecApi } from './api.ts'
|
|
3
3
|
import { mountSidebarEntry, mountWorkbench } from './mount.tsx'
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
export function apply(ctx: ClientContext): void {
|
|
5
|
+
export function apply(ctx: Context): void {
|
|
8
6
|
const api = new SpecApi()
|
|
9
7
|
const disposers: Array<() => void> = []
|
|
10
8
|
try {
|
|
@@ -10,6 +10,8 @@ function exactTextButton(document: Document, text: string): HTMLButtonElement |
|
|
|
10
10
|
export function findSidebarAnchor(document: Document): SidebarAnchor | undefined {
|
|
11
11
|
const skillCenter = document.querySelector<HTMLButtonElement>('button[aria-label="技能中心"]') ?? exactTextButton(document, '技能中心')
|
|
12
12
|
if (skillCenter !== undefined && skillCenter !== null) return { element: skillCenter, placement: 'after' }
|
|
13
|
+
const plugins = document.querySelector<HTMLButtonElement>('button[aria-label="插件"], button[aria-label="Plugins"]') ?? exactTextButton(document, '插件') ?? exactTextButton(document, 'Plugins')
|
|
14
|
+
if (plugins !== undefined && plugins !== null) return { element: plugins, placement: 'after' }
|
|
13
15
|
const settings = document.querySelector<HTMLButtonElement>('button[aria-label="设置"]') ?? exactTextButton(document, '设置')
|
|
14
16
|
if (settings !== undefined && settings !== null) return { element: settings, placement: 'before' }
|
|
15
17
|
return undefined
|
package/src/client/workflow.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ParticipantRole, RequirementView, ReviewKind } from '../protocol.ts'
|
|
2
|
+
import { hasCompletedCurrentReview, readyAdmission } from '../ready-admission.ts'
|
|
2
3
|
|
|
3
4
|
export type TaskView = 'review' | 'patches' | 'ready'
|
|
4
5
|
export type WorkflowCommand =
|
|
@@ -27,15 +28,10 @@ export function workflowState(requirement: RequirementView, participantRole: Par
|
|
|
27
28
|
const blockers = currentReviews.filter(item => item.severity === 'blocking' && reviewIsOpen(item.status))
|
|
28
29
|
const productBlockers = blockers.filter(item => item.status !== 'joint-review')
|
|
29
30
|
const unanswered = blockers.filter(item => item.status === 'open')
|
|
30
|
-
const currentPatches
|
|
31
|
-
const
|
|
32
|
-
const activeRun = currentRuns.slice().reverse().find(run => ['queued', 'running'].includes(run.status))
|
|
33
|
-
const completed = (kind: ReviewKind): boolean => currentRuns.some(run => run.kind === kind && run.status === 'completed')
|
|
34
|
-
const productConfirmed = requirement.confirmations.some(item => item.commit === requirement.currentCommit && item.role === 'product' && item.scope === 'version' && item.status === 'active')
|
|
35
|
-
const engineeringConfirmed = requirement.confirmations.some(item => item.commit === requirement.currentCommit && item.role === 'engineering' && item.scope === 'version' && item.status === 'active')
|
|
36
|
-
const failedChecks = requirement.readiness.filter(check => !check.passed)
|
|
31
|
+
const { activeRun, engineeringReviewed, pendingPatches: currentPatches, failedChecks, productConfirmed, engineeringConfirmed } = readyAdmission(requirement, requirement.readiness)
|
|
32
|
+
const completed = (kind: ReviewKind): boolean => hasCompletedCurrentReview(requirement, kind)
|
|
37
33
|
|
|
38
|
-
if (!requirement.workspaceId) return {
|
|
34
|
+
if (!requirement.workspaceId?.trim()) return {
|
|
39
35
|
eyebrow: '开始前', title: '关联需求所在的项目', detail: 'AI 会从这个项目读取代码、规范和团队知识,关联后不能中途切换。',
|
|
40
36
|
actionLabel: '选择项目', command: { kind: 'bind-workspace' },
|
|
41
37
|
}
|
|
@@ -81,7 +77,7 @@ export function workflowState(requirement: RequirementView, participantRole: Par
|
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
if (requirement.stage === 'joint-review') {
|
|
84
|
-
if (!
|
|
80
|
+
if (!engineeringReviewed) return {
|
|
85
81
|
eyebrow: '产研共审', title: '从研发视角检查可实施性', detail: '重点检查现有实现、影响范围、兼容性和测试落点。',
|
|
86
82
|
actionLabel: '开始研发检查', command: { kind: 'request-review', reviewKind: 'engineering-precheck' },
|
|
87
83
|
}
|
|
@@ -125,6 +121,9 @@ export function workflowState(requirement: RequirementView, participantRole: Par
|
|
|
125
121
|
|
|
126
122
|
export function friendlyActionError(error: string): string {
|
|
127
123
|
const messages: Array<[string, string]> = [
|
|
124
|
+
['engineering precheck is required for the current version', '需要先完成当前版本的研发检查;正文变更后请重新检查。'],
|
|
125
|
+
['current version review is still running', '当前版本的 AI 检查仍在进行,请等待完成后再生成就绪需求。'],
|
|
126
|
+
['current version has pending patches', '当前版本还有待审核的正文修改,请先接受或拒绝。'],
|
|
128
127
|
['product blocking review items remain', '还有阻塞问题未处理,请先完成待澄清事项。'],
|
|
129
128
|
['product second review is required', '需要先让 AI 根据回复整理并复核正文。'],
|
|
130
129
|
['product must confirm the current version', '需要产品角色确认当前版本后才能进入产研共审。'],
|
package/src/engine.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { basename, dirname, extname, join } from 'node:path'
|
|
|
4
4
|
import { GitRequirementStore, VersionConflictError } from './git-store.ts'
|
|
5
5
|
import { SCHEMA_VERSION, type ActionItem, type ActionResult, type AiReviewRun, type CandidatePatch, type CollaborationAction, type CollaborationEvent, type CollaborationState, type CommentThread, type FeedbackSource, type Insight, type InsightImportance, type InsightLink, type MyActionItem, type MyItemCategory, type Notification, type ParticipantSnapshot, type ReadinessCheck, type RequirementMetrics, type RequirementRecord, type RequirementSummary, type RequirementVersion, type RequirementView, type ReviewItem, type ReviewKind, type SaveConflict, type StructuredDiff } from './protocol.ts'
|
|
6
6
|
import { buildStructuredDiff } from './structured-diff.ts'
|
|
7
|
+
import { hasCompletedCurrentReview, hasVersionConfirmation, readyAdmission } from './ready-admission.ts'
|
|
7
8
|
|
|
8
9
|
export interface AiCoordinator {
|
|
9
10
|
requestReview(input: { requirement: RequirementView; run: AiReviewRun; sessionId?: string }): Promise<string>
|
|
@@ -319,9 +320,8 @@ export class CollaborationEngine {
|
|
|
319
320
|
advance(record, action.participant); this.persist()
|
|
320
321
|
} else if (action.kind === 'ready.generate') {
|
|
321
322
|
requireHuman(action.participant)
|
|
322
|
-
const
|
|
323
|
-
if (
|
|
324
|
-
if (!hasVersionConfirmation(record, 'product') || !hasVersionConfirmation(record, 'engineering')) throw new Error('current version needs product and engineering confirmation')
|
|
323
|
+
const admission = readyAdmission(record, readiness(this.versions.read(record.id, record.currentCommit).markdown, record))
|
|
324
|
+
if (admission.error) throw new Error(admission.error)
|
|
325
325
|
const markdown = readyMarkdown(this.view(record.id))
|
|
326
326
|
record.readyPackage = { requirementId: record.id, commit: record.currentCommit, packageHash: createHash('sha256').update(markdown).digest('hex'), generatedAt: now, generatedBy: action.participant, markdown }
|
|
327
327
|
enterStage(record, 'ready'); this.persist()
|
|
@@ -465,7 +465,12 @@ export class CollaborationEngine {
|
|
|
465
465
|
const requestedStage = record.stage; const requestedStageCycle = record.stageCycle
|
|
466
466
|
const existingSession = record.aiConversations.find(item => item.stage === requestedStage && item.stageCycle === requestedStageCycle)?.sessionId
|
|
467
467
|
void coordinator.requestReview({ requirement: view, run, ...(existingSession ? { sessionId: existingSession } : {}) }).then(sessionId => {
|
|
468
|
-
|
|
468
|
+
// Rejected actions restore a cloned state while this launch can still be pending.
|
|
469
|
+
const currentRecord = this.state.requirements.find(item => item.id === record.id)
|
|
470
|
+
const currentRun = currentRecord?.aiRuns.find(item => item.id === run.id)
|
|
471
|
+
if (currentRecord === undefined || currentRun === undefined) return
|
|
472
|
+
if (currentRun.status === 'queued') currentRun.status = 'running'
|
|
473
|
+
currentRun.sessionId = sessionId; currentRun.updatedAt = Date.now(); this.rememberStageConversation(currentRecord, sessionId, requestedStage, requestedStageCycle); this.persist({ types: ['ai.status', 'metrics.changed'], requirementId: currentRecord.id, objectId: currentRun.id })
|
|
469
474
|
}, error => this.markAiFailure(record.id, run.id, error instanceof Error ? error.message : String(error)))
|
|
470
475
|
}
|
|
471
476
|
|
|
@@ -715,7 +720,6 @@ function assertChineseFeedback(...values: string[]): void {
|
|
|
715
720
|
}
|
|
716
721
|
function requireHuman(participant: ParticipantSnapshot): void { if (participant.kind !== 'human') throw new Error('human participant is required') }
|
|
717
722
|
function actionForReview(item: ReviewItem): ActionItem { const now = Date.now(); return { id: randomUUID(), requirementId: item.requirementId, sourceType: 'review-item', sourceId: item.id, type: 'reply', assigneeRole: item.ownerRole, blocking: item.severity === 'blocking', status: 'pending', dueStage: item.reviewKind.startsWith('product') ? 'product-review' : 'joint-review', createdAt: now, updatedAt: now } }
|
|
718
|
-
function hasVersionConfirmation(record: RequirementRecord, role: 'product' | 'engineering'): boolean { return record.confirmations.some(item => item.role === role && item.scope === 'version' && item.commit === record.currentCommit && item.status === 'active') }
|
|
719
723
|
function enterStage(record: RequirementRecord, stage: RequirementRecord['stage']): void {
|
|
720
724
|
if (record.stage === stage) return
|
|
721
725
|
record.stage = stage
|
|
@@ -724,7 +728,7 @@ function enterStage(record: RequirementRecord, stage: RequirementRecord['stage']
|
|
|
724
728
|
function advance(record: RequirementRecord, participant: ParticipantSnapshot): void {
|
|
725
729
|
if (record.stage === 'product-review') {
|
|
726
730
|
if (record.reviewItems.some(item => item.commit === record.currentCommit && item.severity === 'blocking' && !['resolved', 'non-blocking-verify', 'joint-review'].includes(item.status))) throw new Error('product blocking review items remain')
|
|
727
|
-
if (!record
|
|
731
|
+
if (!hasCompletedCurrentReview(record, 'product-second')) throw new Error('product second review is required')
|
|
728
732
|
enterStage(record, 'product-confirmation'); return
|
|
729
733
|
}
|
|
730
734
|
if (record.stage === 'product-confirmation') {
|