@oscaner-skills/cdd-engine 4.12.0 → 4.14.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/README.md +22 -0
- package/README.zh-CN.md +22 -0
- package/dist/contract/census.js +134 -0
- package/dist/contract/invariants.js +11 -6
- package/dist/contract/pins.js +893 -0
- package/dist/contract/review-criteria.js +332 -0
- package/dist/face/artifacts.js +13 -4
- package/dist/face/board-view.js +414 -71
- package/dist/face/capsule.js +7 -5
- package/dist/face/cli.js +192 -63
- package/dist/face/declare.js +10 -6
- package/dist/face/lifecycle.js +303 -114
- package/dist/face/preview.js +9 -0
- package/dist/face/route-render.js +23 -7
- package/dist/face/words.js +53 -7
- package/dist/infra/carrier-seal.js +47 -24
- package/dist/infra/plan-source.js +180 -78
- package/dist/infra/slug-index.js +58 -27
- package/dist/infra/workspace.js +19 -1
- package/dist/render/templates.js +84 -16
- package/dist/session/artifact-reads.js +108 -0
- package/dist/session/carrier-rulings.js +98 -45
- package/dist/session/dispatch-authority.js +2 -3
- package/dist/session/handoff-schema.js +137 -5
- package/dist/session/inflight.js +5 -2
- package/dist/session/ledger.js +178 -248
- package/dist/session/next.js +62 -15
- package/dist/session/round-artifacts.js +645 -0
- package/dist/session/round-naming.js +16 -81
- package/dist/session/run.js +19 -16
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// packages/cdd-engine/src-next/session/round-naming.ts
|
|
2
2
|
// P34 T1 — the naming single source: ONE round identity renders every artifact name
|
|
3
|
-
// (draft · final · report · log · crash · evidence
|
|
4
|
-
// spelling and its siblings' can never drift
|
|
5
|
-
// (
|
|
3
|
+
// (draft · final · report · log · crash · evidence · the orchestrator's rulings) through
|
|
4
|
+
// `renderName`, so a kind's spelling and its siblings' can never drift. The REVERSE
|
|
5
|
+
// direction (name → identity) is the artifact matrix's (`session/round-artifacts.ts`
|
|
6
|
+
// `attribute`), never a second predicate here: a carrier-name grammar kept beside the
|
|
7
|
+
// matrix would be the second spelling this phase retires (P36 §2.5).
|
|
6
8
|
//
|
|
7
9
|
// The identity is a triple: the LINE (`tasks-{tasks}` · `branch` · the doc word), the
|
|
8
10
|
// OP (`implement` · `review` · `fix` — branch-review rides the review family), the
|
|
@@ -13,42 +15,9 @@
|
|
|
13
15
|
// cycle segment too, never a `-undefined` token.
|
|
14
16
|
//
|
|
15
17
|
// Module-level exports are types / the class — zero behavior-carrying bare functions.
|
|
16
|
-
// One module-level value: the compiled carrier predicate below (`CARRIER`).
|
|
17
18
|
var _a;
|
|
18
|
-
import { TargetFaceTable
|
|
19
|
-
|
|
20
|
-
* Both accept the `-a{n}` attempt segment and the final's `.c{cycle}` suffix; every
|
|
21
|
-
* other artifact (report · log · crash · evidence) is deliberately outside the
|
|
22
|
-
* predicate, so the seal sweep can never touch it. The legacy cycle-less implement
|
|
23
|
-
* spelling (`tasks-{tasks}-implement.json`) stays accepted for the drafts a
|
|
24
|
-
* pre-P34 engine left on disk.
|
|
25
|
-
*
|
|
26
|
-
* Module scope, not a `static readonly #CARRIER` field: tsc down-levels a static
|
|
27
|
-
* field initializer that reads the class's own private static member into a temp
|
|
28
|
-
* (`static #CARRIER = _a.#carrierPattern()`) assigned only AFTER the class body, so
|
|
29
|
-
* the module threw `Receiver must be class RoundNaming` at import. Reading a plain
|
|
30
|
-
* const keeps the pattern out of that transform's reach.
|
|
31
|
-
*
|
|
32
|
-
* A wave line takes the wave-only `tasks-` spine, every other line word takes the
|
|
33
|
-
* round-bearing ops; the op set and the line words come from the ONE target-face
|
|
34
|
-
* table, so neither is re-spelled here. The `.c{cycle}` final suffix hangs off the
|
|
35
|
-
* CYCLE-BEARING alternatives alone — a cycle-less identity has no cycle to suffix, so
|
|
36
|
-
* `tasks-1-implement.c1.json` is a shape the renderer can never mint. */
|
|
37
|
-
const carrierPattern = () => {
|
|
38
|
-
const lines = Object.keys(targetFaces).filter((word) => word !== "wave");
|
|
39
|
-
const attempt = "(?:-a\\d+)?";
|
|
40
|
-
const final = "(?:\\.c\\d+)?";
|
|
41
|
-
const cycleBearing = [
|
|
42
|
-
"tasks-.+?-implement-\\d+",
|
|
43
|
-
"tasks-.+?-(?:review|fix)-\\d+",
|
|
44
|
-
`(?:${lines.join("|")})-(?:review|fix)-\\d+`,
|
|
45
|
-
].join("|");
|
|
46
|
-
// The legacy cycle-less implement draft: a draft on disk, never a final and never
|
|
47
|
-
// an attempt — this engine mints neither on a cycle-less identity.
|
|
48
|
-
const legacy = "tasks-.+?-implement";
|
|
49
|
-
return new RegExp(`^(?:(?:${cycleBearing})${attempt}${final}|${legacy})\\.json$`);
|
|
50
|
-
};
|
|
51
|
-
const CARRIER = carrierPattern();
|
|
19
|
+
import { TargetFaceTable } from "./faces.js";
|
|
20
|
+
import { ArtifactRegistry, renderRound } from "./round-artifacts.js";
|
|
52
21
|
/**
|
|
53
22
|
* RoundNaming — the one home of a round's prescribed artifact names. A frame's
|
|
54
23
|
* report / log / crash / evidence / carrier names derive here, so every consumer
|
|
@@ -76,55 +45,20 @@ export class RoundNaming {
|
|
|
76
45
|
static lineOf(type, params) {
|
|
77
46
|
return type === "wave" ? `tasks-${params.tasks ?? ""}` : type;
|
|
78
47
|
}
|
|
79
|
-
/** Render one round identity as one artifact name — the ONE naming rule
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
48
|
+
/** Render one round identity as one artifact name — the ONE naming rule, delegated
|
|
49
|
+
* to the artifact matrix's round row (`renderRound`): one spelling, two entry forms
|
|
50
|
+
* (this static method and `ArtifactRegistry#render`). A `final` has no cycle to key
|
|
51
|
+
* on when the identity carries none: it renders the draft name back, never a
|
|
52
|
+
* malformed `.cundefined` suffix. The stem's cycle segment is omitted for a
|
|
84
53
|
* cycle-less identity; its attempt segment is omitted on the first attempt (an
|
|
85
54
|
* `-a1` never appears). */
|
|
86
55
|
static renderName(artifact, kind) {
|
|
87
|
-
|
|
88
|
-
const attempt = artifact.attempt === undefined || artifact.attempt <= 1 ? "" : `-a${artifact.attempt}`;
|
|
89
|
-
const stem = `${artifact.line}-${artifact.op}${cycle}${attempt}`;
|
|
90
|
-
switch (kind) {
|
|
91
|
-
case "draft":
|
|
92
|
-
return `${stem}.json`;
|
|
93
|
-
case "final":
|
|
94
|
-
return artifact.cycle === undefined || artifact.cycle === ""
|
|
95
|
-
? `${stem}.json`
|
|
96
|
-
: `${stem}.c${artifact.cycle}.json`;
|
|
97
|
-
case "report":
|
|
98
|
-
return `${stem}-report.md`;
|
|
99
|
-
case "log":
|
|
100
|
-
return `${stem}.log`;
|
|
101
|
-
case "crash":
|
|
102
|
-
return `crash-${stem}.json`;
|
|
103
|
-
case "evidence":
|
|
104
|
-
return `${stem}-test-evidence.json`;
|
|
105
|
-
}
|
|
56
|
+
return renderRound({ domain: "round", ...artifact }, kind);
|
|
106
57
|
}
|
|
107
|
-
/** The carrier-name predicate's compiled pattern — a wave line takes the wave-only
|
|
108
|
-
* `tasks-` spine, every other line word takes the round-bearing ops. The op set and
|
|
109
|
-
* the line words come from the ONE target-face table, so neither is re-spelled here.
|
|
110
|
-
* Only `implement` has a cycle-less spelling (the pre-P34 draft on disk); `review`
|
|
111
|
-
* and `fix` always carry their cycle, so a `tasks-1-review.json` is no carrier at all.
|
|
112
|
-
* The `.c{cycle}` final suffix hangs off the CYCLE-BEARING alternatives alone — a
|
|
113
|
-
* cycle-less identity has no cycle to suffix, so `tasks-1-implement.c1.json` is a
|
|
114
|
-
* shape the renderer can never mint. */
|
|
115
58
|
/** The rendered name resolved against the workspace — the read/write syscall form. */
|
|
116
59
|
renderPath(artifact, kind) {
|
|
117
60
|
return this.#workspace.resolve(_a.renderName(artifact, kind));
|
|
118
61
|
}
|
|
119
|
-
/** Whether a workspace file name is one of the two carrier shapes this engine mints.
|
|
120
|
-
* Every neighbouring artifact — `progress.json` · `base.json` · the test-evidence
|
|
121
|
-
* sibling · a carrier's `.rulings.json` sidecar · a report · a crash record — is NOT
|
|
122
|
-
* a carrier, so the sweep that seals carriers can never touch them. Static: the
|
|
123
|
-
* judgment reads a NAME and nothing else, so the seal sweep (`CarrierSeal`) applies
|
|
124
|
-
* the same predicate without holding a workspace. */
|
|
125
|
-
static isCarrierName(name) {
|
|
126
|
-
return CARRIER.test(name);
|
|
127
|
-
}
|
|
128
62
|
/** The handoff-family op of a frame — branch-review rides the review family. The
|
|
129
63
|
* artifact names embed this op, so the mapping is a naming fact owned here (the
|
|
130
64
|
* lifecycle's op read delegates, never a second copy of the rule). */
|
|
@@ -139,9 +73,10 @@ export class RoundNaming {
|
|
|
139
73
|
return this.#workspace.resolve(this.briefName(tasks));
|
|
140
74
|
}
|
|
141
75
|
/** The brief's workspace-relative NAME — the write face takes the name, the read
|
|
142
|
-
* faces take the resolved path (one derivation, both spellings).
|
|
76
|
+
* faces take the resolved path (one derivation, both spellings). The template is the
|
|
77
|
+
* artifact matrix's `brief` row; this is a delegate, never a second rendering. */
|
|
143
78
|
briefName(tasks) {
|
|
144
|
-
return
|
|
79
|
+
return ArtifactRegistry.nameOf("brief", tasks);
|
|
145
80
|
}
|
|
146
81
|
/** The prescribed report path of a round — the shared stem with `-report.md`. */
|
|
147
82
|
report(frame) {
|
package/dist/session/run.js
CHANGED
|
@@ -177,7 +177,10 @@ export class Lifecycle {
|
|
|
177
177
|
this.#state = opts.state;
|
|
178
178
|
this.#ledger = opts.ledger;
|
|
179
179
|
this.#dispatch = opts.dispatch;
|
|
180
|
-
|
|
180
|
+
// The router is built in the constructor body (never a field initializer): the
|
|
181
|
+
// injected artifact matrix rides the opts field, so the readback face and this
|
|
182
|
+
// hop share ONE registry.
|
|
183
|
+
this.#router = opts.router ?? new NextStepRouter(opts.artifacts ?? null);
|
|
181
184
|
this.#target = opts.target ?? null;
|
|
182
185
|
this.#capsule = opts.capsule ?? null;
|
|
183
186
|
this.#preflight = opts.preflight ?? null;
|
|
@@ -237,7 +240,7 @@ export class Lifecycle {
|
|
|
237
240
|
if (verdict !== null && !verdict.ok) {
|
|
238
241
|
return {
|
|
239
242
|
frame,
|
|
240
|
-
round: this.#ledger.roundCount(frame.key, frame.phase
|
|
243
|
+
round: this.#ledger.roundCount(frame.key, frame.phase),
|
|
241
244
|
route: null,
|
|
242
245
|
capsuleLines: [],
|
|
243
246
|
preflight: verdict,
|
|
@@ -308,9 +311,7 @@ export class Lifecycle {
|
|
|
308
311
|
* records (`RoundNaming#attemptOf`, the naming single source) and shared by the
|
|
309
312
|
* round record and the round log's name. */
|
|
310
313
|
#attemptFor(phase, key, round) {
|
|
311
|
-
return this.#ledger
|
|
312
|
-
.naming()
|
|
313
|
-
.attemptOf(this.#ledger.recordsOf(key, this.#face.type), this.#opOf(phase), round);
|
|
314
|
+
return this.#ledger.naming().attemptOf(this.#ledger.recordsOf(key), this.#opOf(phase), round);
|
|
314
315
|
}
|
|
315
316
|
/** The next phase of one wave line — the SAME single derivation the wave gate reads
|
|
316
317
|
* (`Ledger#waveLinePhase` · D26: one fact, one place). The lifecycle's frame
|
|
@@ -381,7 +382,7 @@ export class Lifecycle {
|
|
|
381
382
|
if (phase === "implement")
|
|
382
383
|
return 1;
|
|
383
384
|
if (phase === "fix") {
|
|
384
|
-
const completed = this.#ledger.completedCycles(key, "review"
|
|
385
|
+
const completed = this.#ledger.completedCycles(key, "review");
|
|
385
386
|
return completed.length > 0 ? Math.max(...completed) : 1;
|
|
386
387
|
}
|
|
387
388
|
return this.#reviewCount(key) + 1;
|
|
@@ -389,7 +390,7 @@ export class Lifecycle {
|
|
|
389
390
|
/** The review-lead round count of a key (branch counts its branch-review mode,
|
|
390
391
|
* the others the review mode — the face row's single source). */
|
|
391
392
|
#reviewCount(key) {
|
|
392
|
-
return this.#ledger.roundCount(key, this.#face.product.reviewLead
|
|
393
|
+
return this.#ledger.roundCount(key, this.#face.product.reviewLead);
|
|
393
394
|
}
|
|
394
395
|
/** The progress key of a single-target line — the line's STABLE key (find #9 ·
|
|
395
396
|
* spec §6.5/§3.7 — `"branch"` per workspace for the branch line, accumulating
|
|
@@ -510,7 +511,7 @@ export class Lifecycle {
|
|
|
510
511
|
// A round that persisted no carrier records no digest column at all — the
|
|
511
512
|
// absence is the fact, never a null placeholder.
|
|
512
513
|
...(carrierDigest === null ? {} : { carrierDigest }),
|
|
513
|
-
}
|
|
514
|
+
});
|
|
514
515
|
// The completed-round revision write-back is gated on the round's VERDICT (a
|
|
515
516
|
// hard-failed round must not bind the current revision — that would silently
|
|
516
517
|
// close the drift identity the round never delivered). WHICH reviewed input the
|
|
@@ -553,7 +554,7 @@ export class Lifecycle {
|
|
|
553
554
|
break;
|
|
554
555
|
}
|
|
555
556
|
}
|
|
556
|
-
return this.#ledger.roundCount(frame.key, frame.phase
|
|
557
|
+
return this.#ledger.roundCount(frame.key, frame.phase);
|
|
557
558
|
}
|
|
558
559
|
/** The reviewed-revision write-back — bind the completed round's input revision to
|
|
559
560
|
* the line record (the T7 doc + D30 wave identity gates' reopen-compare basis). The
|
|
@@ -567,7 +568,7 @@ export class Lifecycle {
|
|
|
567
568
|
#recordReviewedDocRevision(frame) {
|
|
568
569
|
if (frame.target.kind !== "plan" && frame.target.kind !== "spec")
|
|
569
570
|
return;
|
|
570
|
-
this.#recordDocRevisionOf(frame.key, frame.target.doc
|
|
571
|
+
this.#recordDocRevisionOf(frame.key, frame.target.doc);
|
|
571
572
|
}
|
|
572
573
|
/** The wave line's reviewed-brief write-back (D30 · P29 §2.2) — bind the wave's
|
|
573
574
|
* TASK-ONLY projection revision (`BriefRenderer#taskBody` — the same face the
|
|
@@ -591,17 +592,17 @@ export class Lifecycle {
|
|
|
591
592
|
const planPath = this.#plan.stationPath();
|
|
592
593
|
if (planPath === null)
|
|
593
594
|
return;
|
|
594
|
-
this.#ledger.recordReviewedPlanRevision(frame.key, planPath
|
|
595
|
+
this.#ledger.recordReviewedPlanRevision(frame.key, planPath);
|
|
595
596
|
}
|
|
596
597
|
/** The doc-revision write-back body — read the round's document and bind its
|
|
597
598
|
* current revision to the line row (the ONE read + hash + record path the doc
|
|
598
599
|
* leg owns; the branch leg binds the plan read it already judged). An unreadable
|
|
599
600
|
* input records nothing — the line keeps the legacy closed face (present facts
|
|
600
601
|
* only). */
|
|
601
|
-
#recordDocRevisionOf(key, path
|
|
602
|
+
#recordDocRevisionOf(key, path) {
|
|
602
603
|
try {
|
|
603
604
|
const content = readFileSync(path, "utf8");
|
|
604
|
-
this.#ledger.recordReviewedRevision(key, this.#ledger.refs().docRevision(path, content)
|
|
605
|
+
this.#ledger.recordReviewedRevision(key, this.#ledger.refs().docRevision(path, content));
|
|
605
606
|
}
|
|
606
607
|
catch {
|
|
607
608
|
// unreadable input — no reviewed identity recorded (present facts only)
|
|
@@ -740,9 +741,11 @@ export class Lifecycle {
|
|
|
740
741
|
/** The capsule lines of one step — empty unless a capsule is attached (the non-hard
|
|
741
742
|
* interaction point). A success round carries the handoff carrier path; a failure
|
|
742
743
|
* round (TIMEOUT / BLOCKED) carries the crash record as its handoff cell, emitted
|
|
743
|
-
* only when that record exists (a no-host BLOCKED writes none). The
|
|
744
|
-
*
|
|
745
|
-
*
|
|
744
|
+
* only when that record exists (a no-host BLOCKED writes none). The round's
|
|
745
|
+
* `dispositionsSummary` — the fix round's disposition summary, or the review round's
|
|
746
|
+
* downgrade note — is handed to the capsule as its `summary` (the ONE slot both
|
|
747
|
+
* fillers share); the render places it between the status line and the `next:` row
|
|
748
|
+
* (P22 §10). */
|
|
746
749
|
#capsuleLines(frame, outcome, hop) {
|
|
747
750
|
const summary = outcome.dispositionsSummary;
|
|
748
751
|
if (this.#capsule === null)
|