@dzhechkov/harness-core 0.3.150 → 0.4.1

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.
Files changed (106) hide show
  1. package/.dz-manifest.json +399 -55
  2. package/README.md +80 -3
  3. package/dist/agentdb-index.d.ts.map +1 -1
  4. package/dist/agentdb-index.js +10 -2
  5. package/dist/agentdb-index.js.map +1 -1
  6. package/dist/backlog-embed.d.ts +94 -0
  7. package/dist/backlog-embed.d.ts.map +1 -0
  8. package/dist/backlog-embed.js +138 -0
  9. package/dist/backlog-embed.js.map +1 -0
  10. package/dist/backlog.d.ts +180 -7
  11. package/dist/backlog.d.ts.map +1 -1
  12. package/dist/backlog.js +429 -26
  13. package/dist/backlog.js.map +1 -1
  14. package/dist/challenge-panel.d.ts +3 -0
  15. package/dist/challenge-panel.d.ts.map +1 -1
  16. package/dist/challenge-panel.js +3 -0
  17. package/dist/challenge-panel.js.map +1 -1
  18. package/dist/export-holdout.d.ts +149 -0
  19. package/dist/export-holdout.d.ts.map +1 -0
  20. package/dist/export-holdout.js +198 -0
  21. package/dist/export-holdout.js.map +1 -0
  22. package/dist/feature-adr-checkpoints.d.ts +82 -0
  23. package/dist/feature-adr-checkpoints.d.ts.map +1 -1
  24. package/dist/feature-adr-checkpoints.js +138 -1
  25. package/dist/feature-adr-checkpoints.js.map +1 -1
  26. package/dist/feature-adr-routing.d.ts +3 -0
  27. package/dist/feature-adr-routing.d.ts.map +1 -1
  28. package/dist/feature-adr-routing.js +3 -0
  29. package/dist/feature-adr-routing.js.map +1 -1
  30. package/dist/guard.d.ts +42 -0
  31. package/dist/guard.d.ts.map +1 -1
  32. package/dist/guard.js +73 -1
  33. package/dist/guard.js.map +1 -1
  34. package/dist/index.d.ts +15 -2
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +27 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/loop-blobs.generated.d.ts +33 -0
  39. package/dist/loop-blobs.generated.d.ts.map +1 -0
  40. package/dist/loop-blobs.generated.js +101 -0
  41. package/dist/loop-blobs.generated.js.map +1 -0
  42. package/dist/loop-lint.d.ts +63 -0
  43. package/dist/loop-lint.d.ts.map +1 -0
  44. package/dist/loop-lint.js +606 -0
  45. package/dist/loop-lint.js.map +1 -0
  46. package/dist/loop-plan.d.ts +416 -0
  47. package/dist/loop-plan.d.ts.map +1 -0
  48. package/dist/loop-plan.js +1151 -0
  49. package/dist/loop-plan.js.map +1 -0
  50. package/dist/loop-render.d.ts +104 -0
  51. package/dist/loop-render.d.ts.map +1 -0
  52. package/dist/loop-render.js +989 -0
  53. package/dist/loop-render.js.map +1 -0
  54. package/dist/loop-trace.d.ts +204 -0
  55. package/dist/loop-trace.d.ts.map +1 -0
  56. package/dist/loop-trace.js +550 -0
  57. package/dist/loop-trace.js.map +1 -0
  58. package/dist/mutation-gate.d.ts +247 -0
  59. package/dist/mutation-gate.d.ts.map +1 -0
  60. package/dist/mutation-gate.js +535 -0
  61. package/dist/mutation-gate.js.map +1 -0
  62. package/dist/no-stubs.d.ts +53 -0
  63. package/dist/no-stubs.d.ts.map +1 -0
  64. package/dist/no-stubs.js +190 -0
  65. package/dist/no-stubs.js.map +1 -0
  66. package/dist/package-skill-layouts.d.ts +67 -0
  67. package/dist/package-skill-layouts.d.ts.map +1 -0
  68. package/dist/package-skill-layouts.js +81 -0
  69. package/dist/package-skill-layouts.js.map +1 -0
  70. package/dist/patterns.d.ts.map +1 -1
  71. package/dist/patterns.js +156 -75
  72. package/dist/patterns.js.map +1 -1
  73. package/dist/recall-domain-boost.d.ts.map +1 -1
  74. package/dist/recall-domain-boost.js +6 -0
  75. package/dist/recall-domain-boost.js.map +1 -1
  76. package/dist/store-lock.d.ts +108 -0
  77. package/dist/store-lock.d.ts.map +1 -0
  78. package/dist/store-lock.js +231 -0
  79. package/dist/store-lock.js.map +1 -0
  80. package/dist/workflows.d.ts +16 -22
  81. package/dist/workflows.d.ts.map +1 -1
  82. package/dist/workflows.js +17 -98
  83. package/dist/workflows.js.map +1 -1
  84. package/package.json +8 -6
  85. package/sbom.json +1062 -202
  86. package/src/agentdb-index.ts +10 -1
  87. package/src/backlog-embed.ts +156 -0
  88. package/src/backlog.ts +536 -28
  89. package/src/challenge-panel.ts +4 -0
  90. package/src/export-holdout.ts +235 -0
  91. package/src/feature-adr-checkpoints.ts +192 -1
  92. package/src/feature-adr-routing.ts +4 -0
  93. package/src/guard.ts +106 -1
  94. package/src/index.ts +61 -1
  95. package/src/loop-blobs.generated.ts +114 -0
  96. package/src/loop-lint.ts +643 -0
  97. package/src/loop-plan.ts +1419 -0
  98. package/src/loop-render.ts +1050 -0
  99. package/src/loop-trace.ts +650 -0
  100. package/src/mutation-gate.ts +701 -0
  101. package/src/no-stubs.ts +204 -0
  102. package/src/package-skill-layouts.ts +107 -0
  103. package/src/patterns.ts +135 -60
  104. package/src/recall-domain-boost.ts +6 -0
  105. package/src/store-lock.ts +258 -0
  106. package/src/workflows.ts +18 -117
@@ -0,0 +1,108 @@
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
+ /** 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 +1 @@
1
+ {"version":3,"file":"store-lock.js","sourceRoot":"","sources":["../src/store-lock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,2FAA2F;AAC3F,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AACpC,sFAAsF;AACtF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC,oEAAoE;AACpE,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B,mFAAmF;AACnF,MAAM,UAAU,aAAa,CAAC,WAAmB;IAC/C,OAAO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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"}
@@ -1,28 +1,22 @@
1
1
  /**
2
- * Dynamic workflow templates for Opus 4.8+ orchestration.
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
- * Per ADR-005: workflows live in the orchestration layer only.
5
- * They generate JS scripts that Claude Code's dynamic workflow engine executes.
6
- * Core schema, adapters, and skill content remain model-agnostic.
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
- * @packageDocumentation
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
- /** A workflow template generates a JS orchestration script from parameters. */
11
- export interface WorkflowTemplate {
12
- readonly name: string;
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
@@ -1 +1 @@
1
- {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC;CACzD;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAsFD,yCAAyC;AACzC,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAKtD,CAAC;AAEF,4BAA4B;AAC5B,eAAO,MAAM,cAAc,UAAyB,CAAC;AAErD,kCAAkC;AAClC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEtE"}
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"}
package/dist/workflows.js CHANGED
@@ -1,103 +1,22 @@
1
1
  /**
2
- * Dynamic workflow templates for Opus 4.8+ orchestration.
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
- * Per ADR-005: workflows live in the orchestration layer only.
5
- * They generate JS scripts that Claude Code's dynamic workflow engine executes.
6
- * Core schema, adapters, and skill content remain model-agnostic.
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
- * @packageDocumentation
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
- const coverageLift = {
11
- name: 'coverage-lift',
12
- description: 'Lift Tier-A package coverage to ≥95% using parallel agents per package.',
13
- generate: (opts) => `
14
- // Dynamic Workflow: Coverage Lift
15
- // Generated for: ${opts.projectRoot}
16
- // Per ADR-005: orchestration only — no adapter/core changes
17
-
18
- const tierA = ${JSON.stringify(opts.packages ?? [
19
- 'core', 'memory', 'harness-core', 'harness-cli',
20
- 'harness-presets', 'mcp-server-tools',
21
- 'adapter-claude', 'adapter-codex', 'adapter-opencode', 'adapter-hermes',
22
- 'skills-qe',
23
- ])};
24
-
25
- const tasks = tierA.map(pkg => ({
26
- name: \`coverage-\${pkg}\`,
27
- description: \`Lift @dzhechkov/\${pkg} to ≥95% line coverage. Run: pnpm --filter @dzhechkov/\${pkg} test -- --coverage. Add tests for uncovered lines.\`,
28
- }));
29
-
30
- // Claude Code dynamic workflow engine will:
31
- // 1. Spawn one agent per task (up to 16 concurrent)
32
- // 2. Each agent reads coverage, writes tests, re-runs coverage
33
- // 3. Results aggregated when all agents complete
34
- export default { tasks, maxConcurrency: 4${opts.dryRun ? ', dryRun: true' : ''} };
35
- `.trim(),
36
- };
37
- const mutationKill = {
38
- name: 'mutation-kill',
39
- description: 'Kill surviving mutants across core packages using parallel Stryker runs.',
40
- generate: (opts) => `
41
- // Dynamic Workflow: Mutation Kill
42
- // Generated for: ${opts.projectRoot}
43
-
44
- const packages = ${JSON.stringify(opts.packages ?? ['core', 'memory', 'harness-core'])};
45
-
46
- const tasks = packages.map(pkg => ({
47
- name: \`mutate-\${pkg}\`,
48
- description: \`Run Stryker on @dzhechkov/\${pkg}, analyze survivors, write tests to kill them. Target: ≥80% mutation score.\`,
49
- }));
50
-
51
- export default { tasks, maxConcurrency: 3${opts.dryRun ? ', dryRun: true' : ''} };
52
- `.trim(),
53
- };
54
- const canonicalize = {
55
- name: 'canonicalize',
56
- description: 'Canonicalize packages from vendored directories into @dzhechkov/* namespace.',
57
- generate: (opts) => `
58
- // Dynamic Workflow: Canonicalize
59
- // Generated for: ${opts.projectRoot}
60
-
61
- const tasks = [
62
- { name: 'discover', description: 'Scan vendored directories for un-canonicalized packages.' },
63
- { name: 'copy', description: 'Copy discovered packages to packages/@dzhechkov/. Exclude node_modules, .git, runtime state.' },
64
- { name: 'metadata', description: 'Add publishConfig, repository, homepage to each package.json.' },
65
- { name: 'verify', description: 'Run byte-level diff between source and canonical. 0 missing, 0 changed.' },
66
- { name: 'test', description: 'Run canonical-packages structural tests. All must pass.' },
67
- ];
68
-
69
- export default { tasks, maxConcurrency: 2${opts.dryRun ? ', dryRun: true' : ''} };
70
- `.trim(),
71
- };
72
- const securityAudit = {
73
- name: 'security-audit',
74
- description: 'Run adversarial security audit with parallel boundary scanning.',
75
- generate: (opts) => `
76
- // Dynamic Workflow: Security Audit
77
- // Generated for: ${opts.projectRoot}
78
-
79
- const tasks = [
80
- { name: 'npm-audit', description: 'Run pnpm audit, capture baseline.' },
81
- { name: 'gitleaks', description: 'Run gitleaks detect, document findings.' },
82
- { name: 'boundaries', description: 'Verify all 8 input boundaries have runtime guards.' },
83
- { name: 'payloads', description: 'Test aidefence payloads against boundaries.' },
84
- { name: 'report', description: 'Generate security-audit.md with 6 H2 sections.' },
85
- ];
86
-
87
- export default { tasks, maxConcurrency: 3${opts.dryRun ? ', dryRun: true' : ''} };
88
- `.trim(),
89
- };
90
- /** All registered workflow templates. */
91
- export const WORKFLOWS = {
92
- 'coverage-lift': coverageLift,
93
- 'mutation-kill': mutationKill,
94
- 'canonicalize': canonicalize,
95
- 'security-audit': securityAudit,
96
- };
97
- /** Valid workflow names. */
98
- export const WORKFLOW_NAMES = Object.keys(WORKFLOWS);
99
- /** Look up a workflow by name. */
100
- export function getWorkflow(name) {
101
- return WORKFLOWS[name];
102
- }
18
+ /** The pinned retirement message the CLI prints (tested by workflow-legacy-shim.test.ts). */
19
+ export const WORKFLOW_TEMPLATES_RETIRED_MESSAGE = 'dz workflow: the ADR-005 templates are retired (they emitted a pre-meta format the runtime cannot run) — use dz workflow init/render';
20
+ /** Empty by design: no legacy template names remain. */
21
+ export const WORKFLOW_NAMES = [];
103
22
  //# sourceMappingURL=workflows.js.map
@@ -1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AAE;CACP,CAAC;AAEF,MAAM,aAAa,GAAqB;IACtC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,iEAAiE;IAC9E,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;;oBAEF,IAAI,CAAC,WAAW;;;;;;;;;;2CAUO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE;CAC7E,CAAC,IAAI,EAAE;CACP,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,MAAM,SAAS,GAAqC;IACzD,eAAe,EAAE,YAAY;IAC7B,eAAe,EAAE,YAAY;IAC7B,cAAc,EAAE,YAAY;IAC5B,gBAAgB,EAAE,aAAa;CAChC,CAAC;AAEF,4BAA4B;AAC5B,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAErD,kCAAkC;AAClC,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
1
+ {"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,6FAA6F;AAC7F,MAAM,CAAC,MAAM,kCAAkC,GAC7C,sIAAsI,CAAC;AAEzI,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAa,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzhechkov/harness-core",
3
- "version": "0.3.150",
3
+ "version": "0.4.1",
4
4
  "description": "Shared harness logic - skill loading, additive apply, and the init/sync/verify/doctor operations.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -31,14 +31,15 @@
31
31
  "@dzhechkov/adapter-hermes": "^0.2.0",
32
32
  "@dzhechkov/adapter-openclaude": "^0.1.0",
33
33
  "@dzhechkov/adapter-opencode": "^0.2.0",
34
+ "proper-lockfile": "^4.1.2",
34
35
  "yaml": "^2.0.0",
35
36
  "@dzhechkov/adapter-agents-md": "0.1.1",
37
+ "@dzhechkov/adapter-copilot": "0.1.1",
36
38
  "@dzhechkov/adapter-cursor": "0.1.1",
37
39
  "@dzhechkov/adapter-gemini": "0.1.1",
38
- "@dzhechkov/adapter-copilot": "0.1.1",
39
40
  "@dzhechkov/adapter-windsurf": "0.1.1",
40
- "@dzhechkov/core": "0.2.14",
41
- "@dzhechkov/memory": "0.2.9"
41
+ "@dzhechkov/memory": "0.2.9",
42
+ "@dzhechkov/core": "0.2.14"
42
43
  },
43
44
  "peerDependenciesMeta": {
44
45
  "@ruvector/rvf": {
@@ -46,10 +47,11 @@
46
47
  }
47
48
  },
48
49
  "devDependencies": {
50
+ "@ruvector/rvf": "^0.2.3",
49
51
  "@types/node": "^25.6.0",
52
+ "@types/proper-lockfile": "^4.1.4",
50
53
  "typescript": "^5.7.0",
51
- "vitest": "^3.0.0",
52
- "@ruvector/rvf": "^0.2.3"
54
+ "vitest": "^3.0.0"
53
55
  },
54
56
  "engines": {
55
57
  "node": ">=20"