@dzhechkov/harness-core 0.3.150 → 0.4.2
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/.dz-manifest.json +410 -62
- package/README.md +81 -3
- package/dist/agentdb-index.d.ts.map +1 -1
- package/dist/agentdb-index.js +10 -2
- package/dist/agentdb-index.js.map +1 -1
- package/dist/backlog-embed.d.ts +94 -0
- package/dist/backlog-embed.d.ts.map +1 -0
- package/dist/backlog-embed.js +138 -0
- package/dist/backlog-embed.js.map +1 -0
- package/dist/backlog.d.ts +180 -7
- package/dist/backlog.d.ts.map +1 -1
- package/dist/backlog.js +429 -26
- package/dist/backlog.js.map +1 -1
- package/dist/challenge-panel.d.ts +3 -0
- package/dist/challenge-panel.d.ts.map +1 -1
- package/dist/challenge-panel.js +3 -0
- package/dist/challenge-panel.js.map +1 -1
- package/dist/export-holdout.d.ts +149 -0
- package/dist/export-holdout.d.ts.map +1 -0
- package/dist/export-holdout.js +198 -0
- package/dist/export-holdout.js.map +1 -0
- package/dist/feature-adr-checkpoints.d.ts +127 -0
- package/dist/feature-adr-checkpoints.d.ts.map +1 -1
- package/dist/feature-adr-checkpoints.js +199 -1
- package/dist/feature-adr-checkpoints.js.map +1 -1
- package/dist/feature-adr-routing.d.ts +3 -0
- package/dist/feature-adr-routing.d.ts.map +1 -1
- package/dist/feature-adr-routing.js +3 -0
- package/dist/feature-adr-routing.js.map +1 -1
- package/dist/guard.d.ts +42 -0
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +73 -1
- package/dist/guard.js.map +1 -1
- package/dist/index.d.ts +16 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -2
- package/dist/index.js.map +1 -1
- package/dist/loop-blobs.generated.d.ts +33 -0
- package/dist/loop-blobs.generated.d.ts.map +1 -0
- package/dist/loop-blobs.generated.js +101 -0
- package/dist/loop-blobs.generated.js.map +1 -0
- package/dist/loop-lint.d.ts +63 -0
- package/dist/loop-lint.d.ts.map +1 -0
- package/dist/loop-lint.js +606 -0
- package/dist/loop-lint.js.map +1 -0
- package/dist/loop-plan.d.ts +416 -0
- package/dist/loop-plan.d.ts.map +1 -0
- package/dist/loop-plan.js +1151 -0
- package/dist/loop-plan.js.map +1 -0
- package/dist/loop-render.d.ts +104 -0
- package/dist/loop-render.d.ts.map +1 -0
- package/dist/loop-render.js +1068 -0
- package/dist/loop-render.js.map +1 -0
- package/dist/loop-trace.d.ts +229 -0
- package/dist/loop-trace.d.ts.map +1 -0
- package/dist/loop-trace.js +614 -0
- package/dist/loop-trace.js.map +1 -0
- package/dist/mutation-gate.d.ts +247 -0
- package/dist/mutation-gate.d.ts.map +1 -0
- package/dist/mutation-gate.js +535 -0
- package/dist/mutation-gate.js.map +1 -0
- package/dist/no-stubs.d.ts +53 -0
- package/dist/no-stubs.d.ts.map +1 -0
- package/dist/no-stubs.js +190 -0
- package/dist/no-stubs.js.map +1 -0
- package/dist/package-skill-layouts.d.ts +67 -0
- package/dist/package-skill-layouts.d.ts.map +1 -0
- package/dist/package-skill-layouts.js +81 -0
- package/dist/package-skill-layouts.js.map +1 -0
- package/dist/patterns.d.ts.map +1 -1
- package/dist/patterns.js +156 -75
- package/dist/patterns.js.map +1 -1
- package/dist/recall-domain-boost.d.ts.map +1 -1
- package/dist/recall-domain-boost.js +6 -0
- package/dist/recall-domain-boost.js.map +1 -1
- package/dist/statusline.d.ts +10 -2
- package/dist/statusline.d.ts.map +1 -1
- package/dist/statusline.js +122 -36
- package/dist/statusline.js.map +1 -1
- package/dist/store-lock.d.ts +108 -0
- package/dist/store-lock.d.ts.map +1 -0
- package/dist/store-lock.js +231 -0
- package/dist/store-lock.js.map +1 -0
- package/dist/workflows.d.ts +16 -22
- package/dist/workflows.d.ts.map +1 -1
- package/dist/workflows.js +17 -98
- package/dist/workflows.js.map +1 -1
- package/package.json +6 -4
- package/sbom.json +1073 -203
- package/src/agentdb-index.ts +10 -1
- package/src/backlog-embed.ts +156 -0
- package/src/backlog.ts +536 -28
- package/src/challenge-panel.ts +4 -0
- package/src/export-holdout.ts +235 -0
- package/src/feature-adr-checkpoints.ts +291 -1
- package/src/feature-adr-routing.ts +4 -0
- package/src/guard.ts +106 -1
- package/src/index.ts +62 -2
- package/src/loop-blobs.generated.ts +114 -0
- package/src/loop-lint.ts +643 -0
- package/src/loop-plan.ts +1419 -0
- package/src/loop-render.ts +1126 -0
- package/src/loop-trace.ts +727 -0
- package/src/mutation-gate.ts +701 -0
- package/src/no-stubs.ts +204 -0
- package/src/package-skill-layouts.ts +107 -0
- package/src/patterns.ts +135 -60
- package/src/recall-domain-boost.ts +6 -0
- package/src/statusline.ts +117 -30
- package/src/store-lock.ts +258 -0
- package/src/workflows.ts +18 -117
package/dist/statusline.js
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @packageDocumentation
|
|
15
15
|
*/
|
|
16
|
-
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
17
|
-
import {
|
|
16
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import { join, resolve } from 'node:path';
|
|
18
18
|
import { createRequire } from 'node:module';
|
|
19
19
|
import { listBrain } from './brain.js';
|
|
20
20
|
import { RECALL_USAGE_LOG_RELATIVE, aggregateRecallUsage, parseRecallUsageLog } from './recall-usage.js';
|
|
@@ -26,9 +26,27 @@ function sqlitePatternPath(projectRoot) {
|
|
|
26
26
|
function consolidateWatermarkPath(projectRoot) {
|
|
27
27
|
return join(projectRoot, '.dz', 'memory', 'consolidate.json');
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
export function
|
|
31
|
-
return join(projectRoot, '.dz', 'feature-adr', 'learning-state
|
|
29
|
+
/** Directory of the per-slug live `/feature-adr` learning-state slots. */
|
|
30
|
+
export function featureAdrStateDir(projectRoot) {
|
|
31
|
+
return join(projectRoot, '.dz', 'feature-adr', 'learning-state');
|
|
32
|
+
}
|
|
33
|
+
/** Make a slug safe as one bounded filename component (never `/`, `..`, or leading dot/dash). */
|
|
34
|
+
function featureAdrStateSlug(slug) {
|
|
35
|
+
const safe = slug
|
|
36
|
+
.replace(/[^A-Za-z0-9._-]/g, '_')
|
|
37
|
+
.replace(/^[.-]+/, '_')
|
|
38
|
+
.replace(/\.{2,}/g, '_')
|
|
39
|
+
.slice(0, 60);
|
|
40
|
+
return safe.length > 0 ? safe : '_unnamed';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Path of a live `/feature-adr` learning-state file. With a slug this is its namespaced slot;
|
|
44
|
+
* without one this remains the legacy single-slot path for backward-compatible readers/callers.
|
|
45
|
+
*/
|
|
46
|
+
export function featureAdrStatePath(projectRoot, slug) {
|
|
47
|
+
return slug === undefined
|
|
48
|
+
? join(projectRoot, '.dz', 'feature-adr', 'learning-state.json')
|
|
49
|
+
: join(featureAdrStateDir(projectRoot), `${featureAdrStateSlug(slug)}.json`);
|
|
32
50
|
}
|
|
33
51
|
/**
|
|
34
52
|
* Freshness window for the `/feature-adr` panel: a run older than this is considered finished, so
|
|
@@ -135,38 +153,88 @@ function consolidatedAgeHours(projectRoot, now) {
|
|
|
135
153
|
* @param now Injectable clock (epoch ms) for the freshness check — defaults to `Date.now()`.
|
|
136
154
|
*/
|
|
137
155
|
export function readFeatureAdrState(projectRoot, now = Date.now()) {
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
156
|
+
const root = resolve(projectRoot);
|
|
157
|
+
const candidates = [];
|
|
158
|
+
// Keep the legacy single slot in the candidate set: an older dz may still be writing it while a
|
|
159
|
+
// newer statusline renders. Directory discovery is guarded separately because this is the hot,
|
|
160
|
+
// readonly ~300ms render path; it never performs housekeeping or any other write.
|
|
141
161
|
try {
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
if (typeof parsed.step !== 'string' || parsed.step.length === 0)
|
|
146
|
-
return undefined;
|
|
147
|
-
if (typeof parsed.ts !== 'string')
|
|
148
|
-
return undefined;
|
|
149
|
-
const tsMs = Date.parse(parsed.ts);
|
|
150
|
-
if (Number.isNaN(tsMs))
|
|
151
|
-
return undefined;
|
|
152
|
-
if (now - tsMs > FEATURE_ADR_FRESH_MS)
|
|
153
|
-
return undefined; // stale run — do not surface a panel
|
|
154
|
-
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
155
|
-
const state = {
|
|
156
|
-
slug: parsed.slug,
|
|
157
|
-
step: parsed.step,
|
|
158
|
-
pool: num(parsed.pool),
|
|
159
|
-
recalled: num(parsed.recalled),
|
|
160
|
-
stored: num(parsed.stored),
|
|
161
|
-
...(num(parsed.reinforced) > 0 ? { reinforced: num(parsed.reinforced) } : {}),
|
|
162
|
-
ts: parsed.ts,
|
|
163
|
-
...(typeof parsed.mode === 'string' && parsed.mode.length > 0 ? { mode: parsed.mode } : {}),
|
|
164
|
-
};
|
|
165
|
-
return state;
|
|
162
|
+
const legacyPath = featureAdrStatePath(root);
|
|
163
|
+
if (existsSync(legacyPath))
|
|
164
|
+
candidates.push(legacyPath);
|
|
166
165
|
}
|
|
167
|
-
catch {
|
|
168
|
-
|
|
166
|
+
catch { /* best-effort candidate discovery */ }
|
|
167
|
+
try {
|
|
168
|
+
const remaining = 64 - candidates.length;
|
|
169
|
+
if (remaining > 0) {
|
|
170
|
+
const dir = featureAdrStateDir(root);
|
|
171
|
+
const names = readdirSync(dir)
|
|
172
|
+
.filter((name) => name.endsWith('.json'))
|
|
173
|
+
.map((name) => {
|
|
174
|
+
let mtimeMs = -Infinity;
|
|
175
|
+
try {
|
|
176
|
+
mtimeMs = statSync(join(dir, name)).mtimeMs;
|
|
177
|
+
}
|
|
178
|
+
catch { /* a disappearing/unreadable entry sorts last */ }
|
|
179
|
+
return { name, mtimeMs };
|
|
180
|
+
})
|
|
181
|
+
// Truncation may only drop the least recent slots: kind-rank arbitration cannot rescue a non-candidate.
|
|
182
|
+
.sort((a, b) => b.mtimeMs - a.mtimeMs)
|
|
183
|
+
.slice(0, remaining);
|
|
184
|
+
for (const { name } of names)
|
|
185
|
+
candidates.push(join(dir, name));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch { /* absent/unreadable per-slug directory is normal */ }
|
|
189
|
+
const parseCandidate = (path) => {
|
|
190
|
+
try {
|
|
191
|
+
const parsed = JSON.parse(readFileSync(path, 'utf-8'));
|
|
192
|
+
if (typeof parsed.slug !== 'string' || parsed.slug.length === 0)
|
|
193
|
+
return undefined;
|
|
194
|
+
if (typeof parsed.step !== 'string' || parsed.step.length === 0)
|
|
195
|
+
return undefined;
|
|
196
|
+
if (typeof parsed.ts !== 'string')
|
|
197
|
+
return undefined;
|
|
198
|
+
const tsMs = Date.parse(parsed.ts);
|
|
199
|
+
if (Number.isNaN(tsMs))
|
|
200
|
+
return undefined;
|
|
201
|
+
if (now - tsMs > FEATURE_ADR_FRESH_MS)
|
|
202
|
+
return undefined; // stale run — do not surface a panel
|
|
203
|
+
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
204
|
+
// The panel exists to surface the /feature-adr Pattern-memory loop. A generated loop writes
|
|
205
|
+
// zero recalled/stored counters far more often, so freshest-wins would recreate F5 by making
|
|
206
|
+
// a live pipeline's meaningful counters disappear. Missing/invalid legacy markers therefore
|
|
207
|
+
// retain the historical `feature-adr` rank, which outranks every loop slot regardless of ts.
|
|
208
|
+
const kind = parsed.kind === 'loop' ? 'loop' : 'feature-adr';
|
|
209
|
+
const state = {
|
|
210
|
+
kind,
|
|
211
|
+
slug: parsed.slug,
|
|
212
|
+
step: parsed.step,
|
|
213
|
+
pool: num(parsed.pool),
|
|
214
|
+
recalled: num(parsed.recalled),
|
|
215
|
+
stored: num(parsed.stored),
|
|
216
|
+
...(num(parsed.reinforced) > 0 ? { reinforced: num(parsed.reinforced) } : {}),
|
|
217
|
+
ts: parsed.ts,
|
|
218
|
+
...(typeof parsed.mode === 'string' && parsed.mode.length > 0 ? { mode: parsed.mode } : {}),
|
|
219
|
+
};
|
|
220
|
+
return { state, tsMs, rank: kind === 'feature-adr' ? 1 : 0 };
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
let winner;
|
|
227
|
+
for (const path of candidates) {
|
|
228
|
+
const candidate = parseCandidate(path);
|
|
229
|
+
if (candidate === undefined)
|
|
230
|
+
continue;
|
|
231
|
+
if (winner === undefined
|
|
232
|
+
|| candidate.rank > winner.rank
|
|
233
|
+
|| (candidate.rank === winner.rank && candidate.tsMs > winner.tsMs)) {
|
|
234
|
+
winner = candidate;
|
|
235
|
+
}
|
|
169
236
|
}
|
|
237
|
+
return winner?.state;
|
|
170
238
|
}
|
|
171
239
|
/**
|
|
172
240
|
* Record the live `/feature-adr` learning state — called by the pipeline at Steps 0/8/9. Computes
|
|
@@ -186,6 +254,7 @@ export function writeFeatureAdrState(projectRoot, input, now = Date.now()) {
|
|
|
186
254
|
pool = 0;
|
|
187
255
|
}
|
|
188
256
|
const state = {
|
|
257
|
+
kind: input.kind === 'loop' ? 'loop' : 'feature-adr',
|
|
189
258
|
slug: input.slug,
|
|
190
259
|
step: input.step,
|
|
191
260
|
pool,
|
|
@@ -196,8 +265,25 @@ export function writeFeatureAdrState(projectRoot, input, now = Date.now()) {
|
|
|
196
265
|
...(input.mode !== undefined && input.mode.length > 0 ? { mode: input.mode } : {}),
|
|
197
266
|
};
|
|
198
267
|
try {
|
|
199
|
-
const
|
|
200
|
-
mkdirSync(
|
|
268
|
+
const dir = featureAdrStateDir(root);
|
|
269
|
+
mkdirSync(dir, { recursive: true });
|
|
270
|
+
// Housekeeping belongs only on this write path, never the ~300ms render path. Every file is
|
|
271
|
+
// independently guarded so an unreadable/racing entry cannot prevent the live state write.
|
|
272
|
+
try {
|
|
273
|
+
const cutoff = Date.now() - 24 * 60 * 60 * 1_000;
|
|
274
|
+
for (const name of readdirSync(dir)) {
|
|
275
|
+
if (!name.endsWith('.json'))
|
|
276
|
+
continue;
|
|
277
|
+
const stalePath = join(dir, name);
|
|
278
|
+
try {
|
|
279
|
+
if (statSync(stalePath).mtimeMs < cutoff)
|
|
280
|
+
unlinkSync(stalePath);
|
|
281
|
+
}
|
|
282
|
+
catch { /* best-effort per-file cleanup */ }
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
catch { /* best-effort directory cleanup */ }
|
|
286
|
+
const path = featureAdrStatePath(root, input.slug);
|
|
201
287
|
writeFileSync(path, `${JSON.stringify(state, null, 2)}\n`);
|
|
202
288
|
}
|
|
203
289
|
catch {
|
package/dist/statusline.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusline.js","sourceRoot":"","sources":["../src/statusline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAyCzG,6DAA6D;AAC7D,SAAS,iBAAiB,CAAC,WAAmB;IAC5C,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAC/D,CAAC;AAED,2EAA2E;AAC3E,SAAS,wBAAwB,CAAC,WAAmB;IACnD,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AAChE,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAAC,WAAmB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process exclusive lock for the JSON pattern store — built on `proper-lockfile`.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS. The JSON backend writes ATOMICALLY (temp file + rename), so no reader
|
|
5
|
+
* ever sees a torn file. That is a different property from the one needed here. A teach is
|
|
6
|
+
* a read-modify-write: load every record, add one, write them all back. Two teaches that
|
|
7
|
+
* overlap both load the same N records, and each writes back N+1 — the second rename wins
|
|
8
|
+
* and the first lesson is gone. BOTH processes report success, so a lost lesson is silent.
|
|
9
|
+
* Atomicity prevents corruption; only mutual exclusion prevents a lost update.
|
|
10
|
+
*
|
|
11
|
+
* The SQLite backend has its own transaction locking and does not go through here.
|
|
12
|
+
*
|
|
13
|
+
* WHY `proper-lockfile` AND NOT THE PREVIOUS HAND-ROLLED LOCK. An independent review
|
|
14
|
+
* (Codex gpt-5.6-sol) graded the hand-rolled `wx`-file lock F. Its findings, and how this
|
|
15
|
+
* implementation answers them:
|
|
16
|
+
*
|
|
17
|
+
* 1. *Stale-break deleted a successor's live lock* — the old code `rmSync`'d a lock file
|
|
18
|
+
* by PATHNAME after deciding it was stale, so two waiters breaking the same stale lock
|
|
19
|
+
* could delete each other's freshly created locks in a cascade. `proper-lockfile`
|
|
20
|
+
* acquires with an atomic `mkdir`, and a waiter that breaks a stale lock retries with
|
|
21
|
+
* staleness DISABLED, so per acquisition attempt it can remove at most the one lock it
|
|
22
|
+
* observed as stale — never a successor's fresh lock in a loop. The residual
|
|
23
|
+
* microsecond window (stat-stale → holder replaced → rmdir) is closed by DETECTION:
|
|
24
|
+
* every holder heartbeats its lock's mtime and treats a foreign mtime as ECOMPROMISED,
|
|
25
|
+
* which {@link withStoreLock} converts into a loud error instead of a silent lost
|
|
26
|
+
* update. (This is also the model the RVF spec uses for `.rvf` writer locks:
|
|
27
|
+
* single-writer advisory lock file + ownership verification before unlink —
|
|
28
|
+
* `ruvector/docs/research/rvf/spec/09-concurrency-versioning.md`.)
|
|
29
|
+
*
|
|
30
|
+
* 2. *"Unparseable means dead" deleted live locks* — there is no lock BODY to parse any
|
|
31
|
+
* more. The lock is a directory; its existence is the lock, so the empty-file /
|
|
32
|
+
* half-written-file misclassification class is structurally gone.
|
|
33
|
+
*
|
|
34
|
+
* 3. *Age was mistaken for liveness* — staleness is now filesystem mtime plus a HEARTBEAT:
|
|
35
|
+
* the holder refreshes the lock's mtime on a timer (every `staleMs / 2`, ≥ 1s), so a
|
|
36
|
+
* holder slower than `staleMs` is never broken while alive, and a crashed holder's lock
|
|
37
|
+
* stops being refreshed and is reclaimed after `staleMs`. Nothing trusts a
|
|
38
|
+
* self-reported timestamp, so a forged far-future `ts` can no longer block forever.
|
|
39
|
+
* NOTE: the heartbeat runs on the event loop, so a SYNCHRONOUS critical section longer
|
|
40
|
+
* than `staleMs` could still be observed as stale — keep {@link withStoreLockSync}
|
|
41
|
+
* bodies short (they are: single-file JSON rewrites) or raise `staleMs`.
|
|
42
|
+
*
|
|
43
|
+
* 4. *The timeout was not an acquisition deadline* — the retry loops below compute a real
|
|
44
|
+
* deadline (`now + timeoutMs`), re-check it after EVERY sleep, clamp the last sleep to
|
|
45
|
+
* the remaining budget, and never acquire after the deadline has passed.
|
|
46
|
+
*
|
|
47
|
+
* 5. *The lock was not store-wide* — every JSON-tier writer in `patterns.ts` now runs
|
|
48
|
+
* under this lock (see the writer inventory in that module).
|
|
49
|
+
*
|
|
50
|
+
* On timeout this THROWS ({@link StoreLockTimeoutError}) rather than proceeding unlocked.
|
|
51
|
+
* Proceeding would restore exactly the silent lost-update this exists to stop, and a teach
|
|
52
|
+
* that failed loudly can be retried — one that vanished cannot.
|
|
53
|
+
*
|
|
54
|
+
* MIGRATION: the pre-`proper-lockfile` implementation left a regular FILE at
|
|
55
|
+
* `.dz/store.lock`; the library's lock is a DIRECTORY at the same path. A leftover file
|
|
56
|
+
* from a crashed old process is removed only once it is older than `staleMs` — a fresh
|
|
57
|
+
* one is honoured as held, same as any other lock.
|
|
58
|
+
*/
|
|
59
|
+
/** A lock whose HEARTBEAT stopped this long ago is presumed abandoned (crashed holder). */
|
|
60
|
+
export declare const STALE_LOCK_MS = 30000;
|
|
61
|
+
/** Give up waiting after this long and say so, rather than blocking a CLI forever. */
|
|
62
|
+
export declare const LOCK_TIMEOUT_MS = 10000;
|
|
63
|
+
/** Path of the lock guarding a project's pattern store (a DIRECTORY when held). */
|
|
64
|
+
export declare function storeLockPath(projectRoot: string): string;
|
|
65
|
+
/** Options accepted by {@link withStoreLock} / {@link withStoreLockSync}. */
|
|
66
|
+
export interface StoreLockOptions {
|
|
67
|
+
/** Heartbeat-stopped threshold before a lock is presumed abandoned (min 2000, lib-enforced). */
|
|
68
|
+
readonly staleMs?: number;
|
|
69
|
+
/** Acquisition deadline. Also overridable via `DZ_STORE_LOCK_TIMEOUT_MS` (tests/ops). */
|
|
70
|
+
readonly timeoutMs?: number;
|
|
71
|
+
/** Delay between acquisition attempts while the lock is held by someone else. */
|
|
72
|
+
readonly pollMs?: number;
|
|
73
|
+
}
|
|
74
|
+
/** Acquisition gave up at the deadline. Nothing was written; the operation can be retried. */
|
|
75
|
+
export declare class StoreLockTimeoutError extends Error {
|
|
76
|
+
readonly code = "ELOCKTIMEOUT";
|
|
77
|
+
constructor(lockPath: string, waitedMs: number);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The holder detected that its lock was broken out from under it (ECOMPROMISED) — e.g. a
|
|
81
|
+
* waiter reclaimed the lock after this process was suspended past `staleMs`. The critical
|
|
82
|
+
* section DID run, but it may have raced another writer, so the operation must be treated
|
|
83
|
+
* as failed and retried (store writes are idempotent by deterministic record id).
|
|
84
|
+
*/
|
|
85
|
+
export declare class StoreLockCompromisedError extends Error {
|
|
86
|
+
readonly code = "ECOMPROMISED";
|
|
87
|
+
constructor(lockPath: string, cause: Error);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Run `fn` while holding the store lock, releasing it however `fn` ends.
|
|
91
|
+
*
|
|
92
|
+
* Throws {@link StoreLockTimeoutError} when the lock cannot be acquired by the deadline
|
|
93
|
+
* (nothing has run), and {@link StoreLockCompromisedError} when the lock was broken while
|
|
94
|
+
* `fn` ran (it DID run, but may have raced — retry; store writes are idempotent).
|
|
95
|
+
*/
|
|
96
|
+
export declare function withStoreLock<T>(projectRoot: string, fn: () => Promise<T>, opts?: StoreLockOptions): Promise<T>;
|
|
97
|
+
/**
|
|
98
|
+
* Synchronous {@link withStoreLock}, for the store's synchronous writers (prune / remove).
|
|
99
|
+
* Same deadline and failure semantics. The heartbeat cannot fire while `fn` blocks the
|
|
100
|
+
* event loop, so keep bodies well under `staleMs` (they are: single-file JSON rewrites).
|
|
101
|
+
*
|
|
102
|
+
* CAVEAT: do not contend with an ASYNC `withStoreLock` holder in the SAME process — the
|
|
103
|
+
* sync wait blocks the event loop that would release that holder, so the wait can only
|
|
104
|
+
* end in the loud {@link StoreLockTimeoutError} (never a lost update). Cross-process
|
|
105
|
+
* contention, the case this lock exists for, is unaffected.
|
|
106
|
+
*/
|
|
107
|
+
export declare function withStoreLockSync<T>(projectRoot: string, fn: () => T, opts?: StoreLockOptions): T;
|
|
108
|
+
//# sourceMappingURL=store-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-lock.d.ts","sourceRoot":"","sources":["../src/store-lock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAMH,2FAA2F;AAC3F,eAAO,MAAM,aAAa,QAAS,CAAC;AACpC,sFAAsF;AACtF,eAAO,MAAM,eAAe,QAAS,CAAC;AAKtC,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,gGAAgG;IAChG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,yFAAyF;IACzF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,8FAA8F;AAC9F,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,kBAAkB;gBACnB,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAO/C;AAED;;;;;GAKG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,kBAAkB;gBACnB,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAI3C;AA0ED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,CAAC,CAAC,CAuBZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,MAAM,CAAC,EACX,IAAI,GAAE,gBAAqB,GAC1B,CAAC,CAuBH"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-process exclusive lock for the JSON pattern store — built on `proper-lockfile`.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS. The JSON backend writes ATOMICALLY (temp file + rename), so no reader
|
|
5
|
+
* ever sees a torn file. That is a different property from the one needed here. A teach is
|
|
6
|
+
* a read-modify-write: load every record, add one, write them all back. Two teaches that
|
|
7
|
+
* overlap both load the same N records, and each writes back N+1 — the second rename wins
|
|
8
|
+
* and the first lesson is gone. BOTH processes report success, so a lost lesson is silent.
|
|
9
|
+
* Atomicity prevents corruption; only mutual exclusion prevents a lost update.
|
|
10
|
+
*
|
|
11
|
+
* The SQLite backend has its own transaction locking and does not go through here.
|
|
12
|
+
*
|
|
13
|
+
* WHY `proper-lockfile` AND NOT THE PREVIOUS HAND-ROLLED LOCK. An independent review
|
|
14
|
+
* (Codex gpt-5.6-sol) graded the hand-rolled `wx`-file lock F. Its findings, and how this
|
|
15
|
+
* implementation answers them:
|
|
16
|
+
*
|
|
17
|
+
* 1. *Stale-break deleted a successor's live lock* — the old code `rmSync`'d a lock file
|
|
18
|
+
* by PATHNAME after deciding it was stale, so two waiters breaking the same stale lock
|
|
19
|
+
* could delete each other's freshly created locks in a cascade. `proper-lockfile`
|
|
20
|
+
* acquires with an atomic `mkdir`, and a waiter that breaks a stale lock retries with
|
|
21
|
+
* staleness DISABLED, so per acquisition attempt it can remove at most the one lock it
|
|
22
|
+
* observed as stale — never a successor's fresh lock in a loop. The residual
|
|
23
|
+
* microsecond window (stat-stale → holder replaced → rmdir) is closed by DETECTION:
|
|
24
|
+
* every holder heartbeats its lock's mtime and treats a foreign mtime as ECOMPROMISED,
|
|
25
|
+
* which {@link withStoreLock} converts into a loud error instead of a silent lost
|
|
26
|
+
* update. (This is also the model the RVF spec uses for `.rvf` writer locks:
|
|
27
|
+
* single-writer advisory lock file + ownership verification before unlink —
|
|
28
|
+
* `ruvector/docs/research/rvf/spec/09-concurrency-versioning.md`.)
|
|
29
|
+
*
|
|
30
|
+
* 2. *"Unparseable means dead" deleted live locks* — there is no lock BODY to parse any
|
|
31
|
+
* more. The lock is a directory; its existence is the lock, so the empty-file /
|
|
32
|
+
* half-written-file misclassification class is structurally gone.
|
|
33
|
+
*
|
|
34
|
+
* 3. *Age was mistaken for liveness* — staleness is now filesystem mtime plus a HEARTBEAT:
|
|
35
|
+
* the holder refreshes the lock's mtime on a timer (every `staleMs / 2`, ≥ 1s), so a
|
|
36
|
+
* holder slower than `staleMs` is never broken while alive, and a crashed holder's lock
|
|
37
|
+
* stops being refreshed and is reclaimed after `staleMs`. Nothing trusts a
|
|
38
|
+
* self-reported timestamp, so a forged far-future `ts` can no longer block forever.
|
|
39
|
+
* NOTE: the heartbeat runs on the event loop, so a SYNCHRONOUS critical section longer
|
|
40
|
+
* than `staleMs` could still be observed as stale — keep {@link withStoreLockSync}
|
|
41
|
+
* bodies short (they are: single-file JSON rewrites) or raise `staleMs`.
|
|
42
|
+
*
|
|
43
|
+
* 4. *The timeout was not an acquisition deadline* — the retry loops below compute a real
|
|
44
|
+
* deadline (`now + timeoutMs`), re-check it after EVERY sleep, clamp the last sleep to
|
|
45
|
+
* the remaining budget, and never acquire after the deadline has passed.
|
|
46
|
+
*
|
|
47
|
+
* 5. *The lock was not store-wide* — every JSON-tier writer in `patterns.ts` now runs
|
|
48
|
+
* under this lock (see the writer inventory in that module).
|
|
49
|
+
*
|
|
50
|
+
* On timeout this THROWS ({@link StoreLockTimeoutError}) rather than proceeding unlocked.
|
|
51
|
+
* Proceeding would restore exactly the silent lost-update this exists to stop, and a teach
|
|
52
|
+
* that failed loudly can be retried — one that vanished cannot.
|
|
53
|
+
*
|
|
54
|
+
* MIGRATION: the pre-`proper-lockfile` implementation left a regular FILE at
|
|
55
|
+
* `.dz/store.lock`; the library's lock is a DIRECTORY at the same path. A leftover file
|
|
56
|
+
* from a crashed old process is removed only once it is older than `staleMs` — a fresh
|
|
57
|
+
* one is honoured as held, same as any other lock.
|
|
58
|
+
*/
|
|
59
|
+
import { mkdirSync, rmSync, statSync } from 'node:fs';
|
|
60
|
+
import { join, resolve } from 'node:path';
|
|
61
|
+
import { lockSync } from 'proper-lockfile';
|
|
62
|
+
/** A lock whose HEARTBEAT stopped this long ago is presumed abandoned (crashed holder). */
|
|
63
|
+
export const STALE_LOCK_MS = 30_000;
|
|
64
|
+
/** Give up waiting after this long and say so, rather than blocking a CLI forever. */
|
|
65
|
+
export const LOCK_TIMEOUT_MS = 10_000;
|
|
66
|
+
/** `proper-lockfile` silently clamps `stale` up to this minimum. */
|
|
67
|
+
const MIN_STALE_MS = 2_000;
|
|
68
|
+
/** Path of the lock guarding a project's pattern store (a DIRECTORY when held). */
|
|
69
|
+
export function storeLockPath(projectRoot) {
|
|
70
|
+
return join(projectRoot, '.dz', 'store.lock');
|
|
71
|
+
}
|
|
72
|
+
/** Acquisition gave up at the deadline. Nothing was written; the operation can be retried. */
|
|
73
|
+
export class StoreLockTimeoutError extends Error {
|
|
74
|
+
code = 'ELOCKTIMEOUT';
|
|
75
|
+
constructor(lockPath, waitedMs) {
|
|
76
|
+
super(`the pattern store at ${lockPath} stayed locked for ${waitedMs}ms — ` +
|
|
77
|
+
'another dz process is still writing. Nothing was written; retry.');
|
|
78
|
+
this.name = 'StoreLockTimeoutError';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The holder detected that its lock was broken out from under it (ECOMPROMISED) — e.g. a
|
|
83
|
+
* waiter reclaimed the lock after this process was suspended past `staleMs`. The critical
|
|
84
|
+
* section DID run, but it may have raced another writer, so the operation must be treated
|
|
85
|
+
* as failed and retried (store writes are idempotent by deterministic record id).
|
|
86
|
+
*/
|
|
87
|
+
export class StoreLockCompromisedError extends Error {
|
|
88
|
+
code = 'ECOMPROMISED';
|
|
89
|
+
constructor(lockPath, cause) {
|
|
90
|
+
super(`the pattern store lock at ${lockPath} was compromised while held (${cause.message}) — retry the operation.`);
|
|
91
|
+
this.name = 'StoreLockCompromisedError';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const defaultTimeoutMs = () => {
|
|
95
|
+
const env = Number(process.env['DZ_STORE_LOCK_TIMEOUT_MS']);
|
|
96
|
+
return Number.isFinite(env) && env > 0 ? env : LOCK_TIMEOUT_MS;
|
|
97
|
+
};
|
|
98
|
+
const sleep = (ms) => new Promise((r) => { setTimeout(r, ms); });
|
|
99
|
+
/** Synchronous sleep without spinning (Atomics.wait on a throwaway buffer). */
|
|
100
|
+
const sleepSync = (ms) => {
|
|
101
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Remove a REGULAR-FILE lock left by the pre-`proper-lockfile` implementation, but only
|
|
105
|
+
* once it is stale — a fresh legacy lock belongs to a live old-version process and is
|
|
106
|
+
* honoured. (Never deletes a directory: that is a live library lock.)
|
|
107
|
+
*/
|
|
108
|
+
function clearStaleLegacyLockFile(lockPath, staleMs) {
|
|
109
|
+
try {
|
|
110
|
+
const st = statSync(lockPath);
|
|
111
|
+
if (st.isFile() && Date.now() - st.mtimeMs >= staleMs)
|
|
112
|
+
rmSync(lockPath, { force: true });
|
|
113
|
+
}
|
|
114
|
+
catch { /* gone already — fine */ }
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* One acquisition attempt. Returns `'held'` when someone else holds the lock (retry later);
|
|
118
|
+
* throws on real I/O errors. `mkdir`-based, so creation is atomic; staleness is heartbeat
|
|
119
|
+
* mtime, and the library's own stale-break retries with staleness disabled (see header §1).
|
|
120
|
+
*/
|
|
121
|
+
function tryAcquire(projectRoot, staleMs, onCompromised) {
|
|
122
|
+
const lockPath = storeLockPath(projectRoot);
|
|
123
|
+
try {
|
|
124
|
+
const release = lockSync(resolve(projectRoot, '.dz', 'store'), {
|
|
125
|
+
lockfilePath: lockPath,
|
|
126
|
+
stale: staleMs,
|
|
127
|
+
realpath: false, // the guarded resource is a concept, not an existing file
|
|
128
|
+
onCompromised,
|
|
129
|
+
});
|
|
130
|
+
return {
|
|
131
|
+
release: () => {
|
|
132
|
+
try {
|
|
133
|
+
release();
|
|
134
|
+
}
|
|
135
|
+
catch { /* ERELEASED after a compromise — the lock is no longer ours to remove */ }
|
|
136
|
+
},
|
|
137
|
+
compromise: () => undefined,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
const code = err.code;
|
|
142
|
+
if (code === 'ELOCKED')
|
|
143
|
+
return 'held';
|
|
144
|
+
if (code === 'ENOTDIR') {
|
|
145
|
+
// A stale legacy FILE lock: the library can only rmdir directories. Clear it (only
|
|
146
|
+
// if actually stale) and report 'held' so the caller's loop retries.
|
|
147
|
+
clearStaleLegacyLockFile(lockPath, staleMs);
|
|
148
|
+
return 'held';
|
|
149
|
+
}
|
|
150
|
+
throw err;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function resolveOpts(opts) {
|
|
154
|
+
return {
|
|
155
|
+
staleMs: Math.max(opts.staleMs ?? STALE_LOCK_MS, MIN_STALE_MS),
|
|
156
|
+
timeoutMs: opts.timeoutMs ?? defaultTimeoutMs(),
|
|
157
|
+
pollMs: opts.pollMs ?? 25,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Run `fn` while holding the store lock, releasing it however `fn` ends.
|
|
162
|
+
*
|
|
163
|
+
* Throws {@link StoreLockTimeoutError} when the lock cannot be acquired by the deadline
|
|
164
|
+
* (nothing has run), and {@link StoreLockCompromisedError} when the lock was broken while
|
|
165
|
+
* `fn` ran (it DID run, but may have raced — retry; store writes are idempotent).
|
|
166
|
+
*/
|
|
167
|
+
export async function withStoreLock(projectRoot, fn, opts = {}) {
|
|
168
|
+
const { staleMs, timeoutMs, pollMs } = resolveOpts(opts);
|
|
169
|
+
mkdirSync(join(projectRoot, '.dz'), { recursive: true });
|
|
170
|
+
const started = Date.now();
|
|
171
|
+
const deadline = started + timeoutMs;
|
|
172
|
+
let compromised;
|
|
173
|
+
const onCompromised = (e) => { compromised = e; };
|
|
174
|
+
for (;;) {
|
|
175
|
+
const got = tryAcquire(projectRoot, staleMs, onCompromised);
|
|
176
|
+
if (got !== 'held') {
|
|
177
|
+
let result;
|
|
178
|
+
try {
|
|
179
|
+
result = await fn();
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
got.release();
|
|
183
|
+
}
|
|
184
|
+
if (compromised !== undefined)
|
|
185
|
+
throw new StoreLockCompromisedError(storeLockPath(projectRoot), compromised);
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
const now = Date.now();
|
|
189
|
+
if (now >= deadline)
|
|
190
|
+
throw new StoreLockTimeoutError(storeLockPath(projectRoot), now - started);
|
|
191
|
+
await sleep(Math.min(pollMs, deadline - now));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Synchronous {@link withStoreLock}, for the store's synchronous writers (prune / remove).
|
|
196
|
+
* Same deadline and failure semantics. The heartbeat cannot fire while `fn` blocks the
|
|
197
|
+
* event loop, so keep bodies well under `staleMs` (they are: single-file JSON rewrites).
|
|
198
|
+
*
|
|
199
|
+
* CAVEAT: do not contend with an ASYNC `withStoreLock` holder in the SAME process — the
|
|
200
|
+
* sync wait blocks the event loop that would release that holder, so the wait can only
|
|
201
|
+
* end in the loud {@link StoreLockTimeoutError} (never a lost update). Cross-process
|
|
202
|
+
* contention, the case this lock exists for, is unaffected.
|
|
203
|
+
*/
|
|
204
|
+
export function withStoreLockSync(projectRoot, fn, opts = {}) {
|
|
205
|
+
const { staleMs, timeoutMs, pollMs } = resolveOpts(opts);
|
|
206
|
+
mkdirSync(join(projectRoot, '.dz'), { recursive: true });
|
|
207
|
+
const started = Date.now();
|
|
208
|
+
const deadline = started + timeoutMs;
|
|
209
|
+
let compromised;
|
|
210
|
+
const onCompromised = (e) => { compromised = e; };
|
|
211
|
+
for (;;) {
|
|
212
|
+
const got = tryAcquire(projectRoot, staleMs, onCompromised);
|
|
213
|
+
if (got !== 'held') {
|
|
214
|
+
let result;
|
|
215
|
+
try {
|
|
216
|
+
result = fn();
|
|
217
|
+
}
|
|
218
|
+
finally {
|
|
219
|
+
got.release();
|
|
220
|
+
}
|
|
221
|
+
if (compromised !== undefined)
|
|
222
|
+
throw new StoreLockCompromisedError(storeLockPath(projectRoot), compromised);
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
const now = Date.now();
|
|
226
|
+
if (now >= deadline)
|
|
227
|
+
throw new StoreLockTimeoutError(storeLockPath(projectRoot), now - started);
|
|
228
|
+
sleepSync(Math.min(pollMs, deadline - now));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=store-lock.js.map
|
|
@@ -0,0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AAE,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC3B,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IACrC,IAAI,WAA8B,CAAC;IACnC,MAAM,aAAa,GAAG,CAAC,CAAQ,EAAQ,EAAE,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,SAAS,CAAC;QACR,MAAM,GAAG,GAAG,UAAU,CAAC,WAAW,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;QAC5D,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;YACnB,IAAI,MAAS,CAAC;YACd,IAAI,CAAC;gBACH,MAAM,GAAG,EAAE,EAAE,CAAC;YAChB,CAAC;oBAAS,CAAC;gBACT,GAAG,CAAC,OAAO,EAAE,CAAC;YAChB,CAAC;YACD,IAAI,WAAW,KAAK,SAAS;gBAAE,MAAM,IAAI,yBAAyB,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC;YAC5G,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,GAAG,IAAI,QAAQ;YAAE,MAAM,IAAI,qBAAqB,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC;QAChG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC"}
|
package/dist/workflows.d.ts
CHANGED
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* RETIRED — the ADR-005 workflow templates are gone (feature loop-designer, AM-6 / architecture
|
|
3
|
+
* §8.2). They emitted a pre-`meta`/`phases` format (`export default {tasks, maxConcurrency}`) the
|
|
4
|
+
* current Workflow runtime cannot execute — a broken command, not a feature.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* Replacement: `dz workflow init` (scaffold a `loop-plan/1` plan), `dz workflow validate`,
|
|
7
|
+
* `dz workflow render` (plan → executable region-delimited loop script), plus the sibling gates
|
|
8
|
+
* `dz workflow-lint` and `dz workflow-trace`. See `loop-plan.ts` / `loop-render.ts`.
|
|
7
9
|
*
|
|
8
|
-
*
|
|
10
|
+
* BREAKING (deliberate, channeled): removing `WorkflowTemplate`/`WORKFLOWS`/`getWorkflow` is a
|
|
11
|
+
* public API change for harness-core. harness-core is 0.x, where MINOR is this repo's breaking
|
|
12
|
+
* channel; the removal is named in the CHANGELOG and README — never silent. The only internal
|
|
13
|
+
* importer was `harness-cli`'s `cmdWorkflow` (MEASURED at plan time), rewritten in the same change.
|
|
14
|
+
*
|
|
15
|
+
* This module stays as a deprecation shim so stale imports fail LOUDLY with a pointer, not with a
|
|
16
|
+
* confusing "module not found".
|
|
9
17
|
*/
|
|
10
|
-
/**
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
readonly description: string;
|
|
14
|
-
readonly generate: (options: WorkflowOptions) => string;
|
|
15
|
-
}
|
|
16
|
-
/** Options passed to workflow generation. */
|
|
17
|
-
export interface WorkflowOptions {
|
|
18
|
-
readonly projectRoot: string;
|
|
19
|
-
readonly dryRun?: boolean;
|
|
20
|
-
readonly packages?: readonly string[];
|
|
21
|
-
}
|
|
22
|
-
/** All registered workflow templates. */
|
|
23
|
-
export declare const WORKFLOWS: Record<string, WorkflowTemplate>;
|
|
24
|
-
/** Valid workflow names. */
|
|
18
|
+
/** The pinned retirement message the CLI prints (tested by workflow-legacy-shim.test.ts). */
|
|
19
|
+
export declare const WORKFLOW_TEMPLATES_RETIRED_MESSAGE = "dz workflow: the ADR-005 templates are retired (they emitted a pre-meta format the runtime cannot run) \u2014 use dz workflow init/render";
|
|
20
|
+
/** Empty by design: no legacy template names remain. */
|
|
25
21
|
export declare const WORKFLOW_NAMES: string[];
|
|
26
|
-
/** Look up a workflow by name. */
|
|
27
|
-
export declare function getWorkflow(name: string): WorkflowTemplate | undefined;
|
|
28
22
|
//# sourceMappingURL=workflows.d.ts.map
|
package/dist/workflows.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,6FAA6F;AAC7F,eAAO,MAAM,kCAAkC,8IACyF,CAAC;AAEzI,wDAAwD;AACxD,eAAO,MAAM,cAAc,EAAE,MAAM,EAAO,CAAC"}
|