@shardworks/spider-apparatus 0.1.300 → 0.1.302

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 CHANGED
@@ -176,7 +176,7 @@ Return the merged effective writ-type → template-name mapping. Config mappings
176
176
 
177
177
  ## Configuration
178
178
 
179
- The Spider reads its config from `guild.json["spider"]`. Zero-config works out of the box for mandate dispatch — Spider's apparatus contributes a plugin-default rig template (`default`: draft → implement → review → revise → seal) and a default mapping (`mandate → default`) via its own supportKit. A minimal guild only needs to declare `spider.variables` so the default template can interpolate role / build command / test command:
179
+ The Spider reads its config from `guild.json["spider"]`. Zero-config works out of the box for mandate dispatch — Spider's apparatus contributes a plugin-default rig template (`default`: draft → implement → review → revise → verify → seal) and a default mapping (`mandate → default`) via its own supportKit. A minimal guild only needs to declare `spider.variables` so the default template can interpolate role / build command / test command:
180
180
 
181
181
  ```json
182
182
  {
@@ -422,6 +422,7 @@ Built-in block types contributed via the Spider's support kit:
422
422
  | `implement` | quick | Run the implementation session |
423
423
  | `review` | quick | Run the review session |
424
424
  | `revise` | quick | Revise based on review findings |
425
+ | `verify` | clockwork | Re-run the mechanical `buildCommand` / `testCommand` checks after revise to catch regressions before seal merges |
425
426
  | `seal` | clockwork | Seal the draft (or grafts a recovery tail on rebase conflict — see below) |
426
427
  | `anima-session` | quick | General-purpose anima session engine |
427
428
  | `manual-merge` | quick | Grafted by the `seal` engine — summons the `spider.mender` anima to reconcile rebase conflicts |
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Spider's plugin-default rig template (`default`).
3
3
  *
4
- * This is the canonical draft → implement → review → revise → seal
4
+ * This is the canonical draft → implement → review → revise → verify → seal
5
5
  * pipeline that every guild used to declare inline under
6
6
  * `spider.rigTemplates.default` in its `guild.json`. It is now
7
7
  * contributed as a plugin default so mandate dispatch works out of the
@@ -17,6 +17,15 @@
17
17
  * defaults for `${vars.role}`, `${vars.buildCommand}`, or
18
18
  * `${vars.testCommand}` — a missing variable raises at dispatch time so
19
19
  * misconfiguration is surfaced loudly rather than masked.
20
+ *
21
+ * The `verify` clockwork engine sits between `revise` and `seal` and
22
+ * re-runs the same mechanical `buildCommand` / `testCommand` checks that
23
+ * `review` performs. This catches regressions introduced during revise —
24
+ * a build break, a test failure, or an undone fix — before they merge
25
+ * into the sealed binding. Verify is fully synchronous (no anima session,
26
+ * no model cost) and reuses `${vars.buildCommand}` / `${vars.testCommand}`,
27
+ * so the draft → implement → review → revise → verify → seal pipeline
28
+ * needs no additional configuration beyond what `review` already required.
20
29
  */
21
30
  import type { RigTemplate } from './types.ts';
22
31
  export declare const defaultRigTemplate: RigTemplate;
@@ -1 +1 @@
1
- {"version":3,"file":"default-template.d.ts","sourceRoot":"","sources":["../src/default-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,eAAO,MAAM,kBAAkB,EAAE,WAsChC,CAAC"}
1
+ {"version":3,"file":"default-template.d.ts","sourceRoot":"","sources":["../src/default-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,eAAO,MAAM,kBAAkB,EAAE,WA+ChC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Spider's plugin-default rig template (`default`).
3
3
  *
4
- * This is the canonical draft → implement → review → revise → seal
4
+ * This is the canonical draft → implement → review → revise → verify → seal
5
5
  * pipeline that every guild used to declare inline under
6
6
  * `spider.rigTemplates.default` in its `guild.json`. It is now
7
7
  * contributed as a plugin default so mandate dispatch works out of the
@@ -17,6 +17,15 @@
17
17
  * defaults for `${vars.role}`, `${vars.buildCommand}`, or
18
18
  * `${vars.testCommand}` — a missing variable raises at dispatch time so
19
19
  * misconfiguration is surfaced loudly rather than masked.
20
+ *
21
+ * The `verify` clockwork engine sits between `revise` and `seal` and
22
+ * re-runs the same mechanical `buildCommand` / `testCommand` checks that
23
+ * `review` performs. This catches regressions introduced during revise —
24
+ * a build break, a test failure, or an undone fix — before they merge
25
+ * into the sealed binding. Verify is fully synchronous (no anima session,
26
+ * no model cost) and reuses `${vars.buildCommand}` / `${vars.testCommand}`,
27
+ * so the draft → implement → review → revise → verify → seal pipeline
28
+ * needs no additional configuration beyond what `review` already required.
20
29
  */
21
30
  export const defaultRigTemplate = {
22
31
  engines: [
@@ -48,10 +57,19 @@ export const defaultRigTemplate = {
48
57
  upstream: ['review'],
49
58
  givens: { writ: '${writ}', role: '${vars.role}' },
50
59
  },
60
+ {
61
+ id: 'verify',
62
+ designId: 'verify',
63
+ upstream: ['revise'],
64
+ givens: {
65
+ buildCommand: '${vars.buildCommand}',
66
+ testCommand: '${vars.testCommand}',
67
+ },
68
+ },
51
69
  {
52
70
  id: 'seal',
53
71
  designId: 'seal',
54
- upstream: ['revise'],
72
+ upstream: ['verify'],
55
73
  givens: {},
56
74
  },
57
75
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"default-template.js","sourceRoot":"","sources":["../src/default-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAgB;IAC7C,OAAO,EAAE;QACP;YACE,EAAE,EAAE,OAAO;YACX,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAC5B;QACD;YACE,EAAE,EAAE,WAAW;YACf,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,CAAC,OAAO,CAAC;YACnB,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE;SAClD;QACD;YACE,EAAE,EAAE,QAAQ;YACZ,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,CAAC,WAAW,CAAC;YACvB,MAAM,EAAE;gBACN,IAAI,EA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AE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE;SAClD;QACD;YACE,EAAE,EAAE,QAAQ;YACZ,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC;YACpB,MAAM,EAAE;gBACN,YAAY,EAAE,sBAAsB;gBACpC,WAAW,EAAE,qBAAqB;aACnC;SACF;QACD;YACE,EAAE,EAAE,MAAM;YACV,QAAQ,EAAE,MAAM;YAChB,QAAQ,EAAE,CAAC,QAAQ,CAAC;YACpB,MAAM,EAAE,EAAE;SACX;KACF;IACD,gBAAgB,EAAE,MAAM;CACzB,CAAC"}
@@ -7,4 +7,5 @@ export { default as stepSessionEngine } from './step-session.ts';
7
7
  export { default as reviewEngine } from './review.ts';
8
8
  export { default as reviseEngine } from './revise.ts';
9
9
  export { default as sealEngine } from './seal.ts';
10
+ export { default as verifyEngine } from './verify.ts';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engines/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engines/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -7,4 +7,5 @@ export { default as stepSessionEngine } from "./step-session.js";
7
7
  export { default as reviewEngine } from "./review.js";
8
8
  export { default as reviseEngine } from "./revise.js";
9
9
  export { default as sealEngine } from "./seal.js";
10
+ export { default as verifyEngine } from "./verify.js";
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engines/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engines/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Shared helpers for mechanical build/test checks.
3
+ *
4
+ * Extracted from `review.ts` so both the `review` and `verify` clockwork
5
+ * engines consume the same canonical `runCheck` and `truncate`
6
+ * implementations. The truncation policy (4 KB cap, head-bias on success,
7
+ * tail-bias on failure) is a contract that must stay identical across
8
+ * every engine that runs build/test commands and surfaces their output.
9
+ */
10
+ import type { MechanicalCheck } from '../types.ts';
11
+ /**
12
+ * Truncate to at most `max` chars total (including a short truncation marker),
13
+ * biased toward the **tail** on failure.
14
+ *
15
+ * Failure context (stack traces, exit messages, threshold-check verdicts) is
16
+ * almost always more informative at the end of a build/test run than at the
17
+ * start — the head is dominated by setup logs and individual test PASS lines.
18
+ * For passing checks we keep the head, since long passing logs typically have
19
+ * their useful summary near the top.
20
+ *
21
+ * The truncation marker is budgeted at 64 chars so the returned string is
22
+ * guaranteed `<= max` regardless of how many digits the truncated-count needs.
23
+ */
24
+ export declare function truncate(text: string, max: number, bias: 'head' | 'tail'): string;
25
+ /**
26
+ * Run a single mechanical check (build or test) shell command in `cwd` and
27
+ * return a structured `MechanicalCheck` result. A non-zero exit produces
28
+ * `passed: false` rather than a thrown error; engines decide what to do
29
+ * with the failed-result list.
30
+ */
31
+ export declare function runCheck(name: 'build' | 'test', command: string, cwd: string): Promise<MechanicalCheck>;
32
+ //# sourceMappingURL=mechanical-checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mechanical-checks.d.ts","sourceRoot":"","sources":["../../src/engines/mechanical-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CASjF;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,OAAO,GAAG,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,eAAe,CAAC,CAW1B"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Shared helpers for mechanical build/test checks.
3
+ *
4
+ * Extracted from `review.ts` so both the `review` and `verify` clockwork
5
+ * engines consume the same canonical `runCheck` and `truncate`
6
+ * implementations. The truncation policy (4 KB cap, head-bias on success,
7
+ * tail-bias on failure) is a contract that must stay identical across
8
+ * every engine that runs build/test commands and surfaces their output.
9
+ */
10
+ import { execFile } from 'node:child_process';
11
+ import { promisify } from 'node:util';
12
+ const execFileAsync = promisify(execFile);
13
+ /**
14
+ * Truncate to at most `max` chars total (including a short truncation marker),
15
+ * biased toward the **tail** on failure.
16
+ *
17
+ * Failure context (stack traces, exit messages, threshold-check verdicts) is
18
+ * almost always more informative at the end of a build/test run than at the
19
+ * start — the head is dominated by setup logs and individual test PASS lines.
20
+ * For passing checks we keep the head, since long passing logs typically have
21
+ * their useful summary near the top.
22
+ *
23
+ * The truncation marker is budgeted at 64 chars so the returned string is
24
+ * guaranteed `<= max` regardless of how many digits the truncated-count needs.
25
+ */
26
+ export function truncate(text, max, bias) {
27
+ if (text.length <= max)
28
+ return text;
29
+ const MARKER_BUDGET = 64;
30
+ const sliceLen = Math.max(0, max - MARKER_BUDGET);
31
+ const truncated = text.length - sliceLen;
32
+ if (bias === 'tail') {
33
+ return `[…truncated ${truncated} leading chars]\n${text.slice(-sliceLen)}`;
34
+ }
35
+ return `${text.slice(0, sliceLen)}\n[…truncated ${truncated} trailing chars]`;
36
+ }
37
+ /**
38
+ * Run a single mechanical check (build or test) shell command in `cwd` and
39
+ * return a structured `MechanicalCheck` result. A non-zero exit produces
40
+ * `passed: false` rather than a thrown error; engines decide what to do
41
+ * with the failed-result list.
42
+ */
43
+ export async function runCheck(name, command, cwd) {
44
+ const start = Date.now();
45
+ try {
46
+ const { stdout, stderr } = await execFileAsync('sh', ['-c', command], { cwd });
47
+ const output = truncate(stdout + stderr, 4096, 'head');
48
+ return { name, passed: true, output, durationMs: Date.now() - start };
49
+ }
50
+ catch (err) {
51
+ const execErr = err;
52
+ const output = truncate((execErr.stdout ?? '') + (execErr.stderr ?? ''), 4096, 'tail');
53
+ return { name, passed: false, output, durationMs: Date.now() - start };
54
+ }
55
+ }
56
+ //# sourceMappingURL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,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACvD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IACxE,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,GAA2C,CAAC;QAC5D,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACvF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IACzE,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/engines/review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAyHrE,QAAA,MAAM,YAAY,EAAE,YAoDnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/engines/review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAqFrE,QAAA,MAAM,YAAY,EAAE,YAoDnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -14,44 +14,8 @@
14
14
  import { execFile } from 'node:child_process';
15
15
  import { promisify } from 'node:util';
16
16
  import { guild } from '@shardworks/nexus-core';
17
+ import { runCheck } from "./mechanical-checks.js";
17
18
  const execFileAsync = promisify(execFile);
18
- /**
19
- * Truncate to at most `max` chars total (including a short truncation marker),
20
- * biased toward the **tail** on failure.
21
- *
22
- * Failure context (stack traces, exit messages, threshold-check verdicts) is
23
- * almost always more informative at the end of a build/test run than at the
24
- * start — the head is dominated by setup logs and individual test PASS lines.
25
- * For passing checks we keep the head, since long passing logs typically have
26
- * their useful summary near the top.
27
- *
28
- * The truncation marker is budgeted at 64 chars so the returned string is
29
- * guaranteed `<= max` regardless of how many digits the truncated-count needs.
30
- */
31
- function truncate(text, max, bias) {
32
- if (text.length <= max)
33
- return text;
34
- const MARKER_BUDGET = 64;
35
- const sliceLen = Math.max(0, max - MARKER_BUDGET);
36
- const truncated = text.length - sliceLen;
37
- if (bias === 'tail') {
38
- return `[…truncated ${truncated} leading chars]\n${text.slice(-sliceLen)}`;
39
- }
40
- return `${text.slice(0, sliceLen)}\n[…truncated ${truncated} trailing chars]`;
41
- }
42
- async function runCheck(name, command, cwd) {
43
- const start = Date.now();
44
- try {
45
- const { stdout, stderr } = await execFileAsync('sh', ['-c', command], { cwd });
46
- const output = truncate(stdout + stderr, 4096, 'head');
47
- return { name, passed: true, output, durationMs: Date.now() - start };
48
- }
49
- catch (err) {
50
- const execErr = err;
51
- const output = truncate((execErr.stdout ?? '') + (execErr.stderr ?? ''), 4096, 'tail');
52
- return { name, passed: false, output, durationMs: Date.now() - start };
53
- }
54
- }
55
19
  async function gitDiff(cwd, baseSha) {
56
20
  try {
57
21
  const { stdout } = await execFileAsync('git', ['diff', `${baseSha}..HEAD`], { cwd });
@@ -1 +1 @@
1
- {"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/engines/review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAO/C,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C;;;;;;;;;;;;G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AAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,gBAAgB,EAAE,MAAM;aACzB;SACF,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,SAAiB;QAC7B,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,SAAS,CAAY,QAAQ,CAAC,CAAC;QACtD,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAa,UAAU,EAAE,UAAU,CAAC,CAAC;QACzE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAClD,MAAM,QAAQ,GAAG,OAAO,EAAE,MAAM,IAAI,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzD,MAAM,gBAAgB,GAAI,OAAO,EAAE,QAAQ,EAAE,gBAAsC,IAAI,EAAE,CAAC;QAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC3D,CAAC;CACF,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Verify engine — clockwork.
3
+ *
4
+ * Mechanical post-revise gate. Re-runs the same `buildCommand` /
5
+ * `testCommand` checks the `review` engine performs, but inserted
6
+ * between `revise` and `seal` in the plugin-default rig template — its
7
+ * purpose is to surface any regression introduced during revise (build
8
+ * break, test failure, undone fix) loud and clear, before the seal
9
+ * engine fast-forward-merges the draft branch into the codex.
10
+ *
11
+ * No anima session, no model cost, no `collect()`: verify is fully
12
+ * synchronous and deterministic. Both checks always run regardless of
13
+ * the build's outcome (no short-circuit), so an operator inspecting a
14
+ * failure sees the full state, not just the first thing that broke.
15
+ *
16
+ * Failure semantics. On any non-zero exit the engine throws. The
17
+ * standard engine-failure path takes over: `attempts[-1].status='failed'`
18
+ * with the thrown message captured as `error`, the rig cancels every
19
+ * non-terminal engine (so `seal` never runs), `rig.status='failed'`,
20
+ * and the rig→writs CDC translates that to `writ.phase='failed'`.
21
+ * Operators inspect the embedded check outputs in
22
+ * `attempts[-1].error` (Oculus and `rig-show` render it directly).
23
+ *
24
+ * No retry, no graft, no recovery tail: a deterministic regression is
25
+ * the human-intervention signal verify exists to surface.
26
+ *
27
+ * Configuration. Reuses `${vars.buildCommand}` and `${vars.testCommand}`
28
+ * from `spider.variables`; no new SpiderConfig key. If both givens are
29
+ * absent the engine throws a configuration error — a totally-vacuous
30
+ * verify silently passing seal would defeat the whole gate. If only one
31
+ * is absent, verify runs the present check and completes normally
32
+ * (matches review's silent-skip behaviour for partial config).
33
+ */
34
+ import type { EngineDesign } from '@shardworks/fabricator-apparatus';
35
+ declare const verifyEngine: EngineDesign;
36
+ export default verifyEngine;
37
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/engines/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAuBrE,QAAA,MAAM,YAAY,EAAE,YA6CnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Verify engine — clockwork.
3
+ *
4
+ * Mechanical post-revise gate. Re-runs the same `buildCommand` /
5
+ * `testCommand` checks the `review` engine performs, but inserted
6
+ * between `revise` and `seal` in the plugin-default rig template — its
7
+ * purpose is to surface any regression introduced during revise (build
8
+ * break, test failure, undone fix) loud and clear, before the seal
9
+ * engine fast-forward-merges the draft branch into the codex.
10
+ *
11
+ * No anima session, no model cost, no `collect()`: verify is fully
12
+ * synchronous and deterministic. Both checks always run regardless of
13
+ * the build's outcome (no short-circuit), so an operator inspecting a
14
+ * failure sees the full state, not just the first thing that broke.
15
+ *
16
+ * Failure semantics. On any non-zero exit the engine throws. The
17
+ * standard engine-failure path takes over: `attempts[-1].status='failed'`
18
+ * with the thrown message captured as `error`, the rig cancels every
19
+ * non-terminal engine (so `seal` never runs), `rig.status='failed'`,
20
+ * and the rig→writs CDC translates that to `writ.phase='failed'`.
21
+ * Operators inspect the embedded check outputs in
22
+ * `attempts[-1].error` (Oculus and `rig-show` render it directly).
23
+ *
24
+ * No retry, no graft, no recovery tail: a deterministic regression is
25
+ * the human-intervention signal verify exists to surface.
26
+ *
27
+ * Configuration. Reuses `${vars.buildCommand}` and `${vars.testCommand}`
28
+ * from `spider.variables`; no new SpiderConfig key. If both givens are
29
+ * absent the engine throws a configuration error — a totally-vacuous
30
+ * verify silently passing seal would defeat the whole gate. If only one
31
+ * is absent, verify runs the present check and completes normally
32
+ * (matches review's silent-skip behaviour for partial config).
33
+ */
34
+ import { runCheck } from "./mechanical-checks.js";
35
+ /**
36
+ * Format the per-check section embedded in the thrown-error message on
37
+ * the failure path. `attempts[-1].error` is the only post-throw channel
38
+ * the substrate preserves, so the entire diagnostic surface — one-line
39
+ * summary + per-check truncated outputs — has to live in the message.
40
+ */
41
+ function formatFailureMessage(checks) {
42
+ const summary = checks
43
+ .map((c) => `${c.name} ${c.passed ? 'PASSED' : 'FAILED'}`)
44
+ .join(', ');
45
+ const sections = checks
46
+ .map((c) => {
47
+ const verdict = c.passed ? 'PASSED' : 'FAILED';
48
+ return `### ${c.name}: ${verdict} (${c.durationMs}ms)\n\`\`\`\n${c.output}\n\`\`\``;
49
+ })
50
+ .join('\n\n');
51
+ return `Verify failed: ${summary}.\n\n${sections}`;
52
+ }
53
+ const verifyEngine = {
54
+ id: 'verify',
55
+ // No retry. Build/test regressions are deterministic; retrying masks
56
+ // the very signal verify exists to surface. (Aligns with peer
57
+ // clockwork engines like seal and draft, which also omit `retry`.)
58
+ async run(givens, context) {
59
+ const draft = context.upstream['draft'];
60
+ if (!draft) {
61
+ throw new Error('Verify engine requires draft yields in context.upstream but none found.');
62
+ }
63
+ const buildCommand = givens.buildCommand;
64
+ const testCommand = givens.testCommand;
65
+ // D11 — refuse to be a totally-vacuous gate. If both checks are
66
+ // missing the engine cannot do its job; failing loud at config time
67
+ // is strictly better than silently passing seal.
68
+ if (!buildCommand && !testCommand) {
69
+ throw new Error('Verify engine requires at least one of `spider.variables.buildCommand` or `spider.variables.testCommand` to be configured. Both are missing — a verify gate with no checks cannot perform its job.');
70
+ }
71
+ // D6 — always run both checks (when configured). No short-circuit:
72
+ // an operator inspecting a verify failure wants the full state.
73
+ const checks = [];
74
+ if (buildCommand) {
75
+ checks.push(await runCheck('build', buildCommand, draft.path));
76
+ }
77
+ if (testCommand) {
78
+ checks.push(await runCheck('test', testCommand, draft.path));
79
+ }
80
+ const anyFailed = checks.some((c) => !c.passed);
81
+ if (anyFailed) {
82
+ throw new Error(formatFailureMessage(checks));
83
+ }
84
+ const yields = { checks };
85
+ return { status: 'completed', yields };
86
+ },
87
+ };
88
+ export default verifyEngine;
89
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/engines/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,MAAyB;IACrD,MAAM,OAAO,GAAG,MAAM;SACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;SACzD,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,QAAQ,GAAG,MAAM;SACpB,GAAG,CAAC,CAAC,CAAC,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,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,MAAM,GAAiB,EAAE,MAAM,EAAE,CAAC;QACxC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;IACzC,CAAC;CACF,CAAC;AAEF,eAAe,YAAY,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * Public types (RigDoc, EngineInstance, CrawlResult, SpiderApi, etc.) are
8
8
  * re-exported for consumers that inspect walk results or rig state.
9
9
  */
10
- export type { EngineStatus, EngineAttempt, EngineInstance, EngineRetryConfig, EngineRetryBackoffConfig, RigStatus, RigDoc, RigView, RigCostSummary, EngineCostSummary, RigFilters, CrawlResult, SpiderApi, SpiderConfig, BlockType, BlockTypeInfo, CheckResult, DraftYields, SealYields, RigTemplate, RigTemplateEngine, RigTemplateInfo, SpiderEngineRunResult, SpiderCollectResult, InputRequestStatus, InputRequestDoc, ChoiceQuestionSpec, BooleanQuestionSpec, TextQuestionSpec, QuestionSpec, ChoiceAnswer, AnswerValue, SpiderStuckCause, SpiderWritStatus, } from './types.ts';
10
+ export type { EngineStatus, EngineAttempt, EngineInstance, EngineRetryConfig, EngineRetryBackoffConfig, RigStatus, RigDoc, RigView, RigCostSummary, EngineCostSummary, RigFilters, CrawlResult, SpiderApi, SpiderConfig, BlockType, BlockTypeInfo, CheckResult, DraftYields, SealYields, VerifyYields, RigTemplate, RigTemplateEngine, RigTemplateInfo, SpiderEngineRunResult, SpiderCollectResult, InputRequestStatus, InputRequestDoc, ChoiceQuestionSpec, BooleanQuestionSpec, TextQuestionSpec, QuestionSpec, ChoiceAnswer, AnswerValue, SpiderStuckCause, SpiderWritStatus, } from './types.ts';
11
11
  export type { SpiderKit } from './spider.ts';
12
12
  /**
13
13
  * Create a fresh Spider apparatus plugin instance.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,SAAS,EACT,MAAM,EACN,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,SAAS,EACT,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;;AAI3C,wBAA8B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,SAAS,EACT,MAAM,EACN,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,SAAS,EACT,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;;AAI3C,wBAA8B"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA2C3C,yEAAyE;AAEzE;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,yEAAyE;AAEzE,eAAe,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA4C3C,yEAAyE;AAEzE;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,yEAAyE;AAEzE,eAAe,YAAY,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"spider.d.ts","sourceRoot":"","sources":["../src/spider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAA4B,MAAM,wBAAwB,CAAC;AAS/E,OAAO,KAAK,EACV,MAAM,EAWN,WAAW,EAOZ,MAAM,YAAY,CAAC;AA0DpB,uEAAuE;AACvE,MAAM,WAAW,SAAS;IACxB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3C,oFAAoF;IACpF,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C;AA+CD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAQ1D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM5D;AA4rCD,wBAAgB,YAAY,IAAI,MAAM,CAm6DrC"}
1
+ {"version":3,"file":"spider.d.ts","sourceRoot":"","sources":["../src/spider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAA4B,MAAM,wBAAwB,CAAC;AAS/E,OAAO,KAAK,EACV,MAAM,EAWN,WAAW,EAOZ,MAAM,YAAY,CAAC;AA2DpB,uEAAuE;AACvE,MAAM,WAAW,SAAS;IACxB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3C,oFAAoF;IACpF,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C;AA+CD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAQ1D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM5D;AA8rCD,wBAAgB,YAAY,IAAI,MAAM,CAo6DrC"}
package/dist/spider.js CHANGED
@@ -28,7 +28,7 @@
28
28
  import { guild, generateId, shortId } from '@shardworks/nexus-core';
29
29
  import { isDispatchable } from '@shardworks/animator-apparatus';
30
30
  import { resolveEngineRetryConfigWithOverrides, validateEngineRetryConfig, } from '@shardworks/fabricator-apparatus';
31
- import { animaSessionEngine, draftEngine, implementEngine, implementLoopEngine, manualMergeEngine, stepSessionEngine, reviewEngine, reviseEngine, sealEngine, } from "./engines/index.js";
31
+ import { animaSessionEngine, draftEngine, implementEngine, implementLoopEngine, manualMergeEngine, stepSessionEngine, reviewEngine, reviseEngine, sealEngine, verifyEngine, } from "./engines/index.js";
32
32
  import { writPhaseBlockType, scheduledTimeBlockType, bookUpdatedBlockType, patronInputBlockType, animatorPausedBlockType, } from "./block-types/index.js";
33
33
  import { rigShowTool, rigListTool, rigForWritTool, rigResumeTool, inputRequestListTool, inputRequestShowTool, inputRequestAnswerTool, inputRequestCompleteTool, inputRequestRejectTool, inputRequestExportTool, inputRequestImportTool, engineDesignsTool, blockTypesTool, rigCancelTool, writRescueStuckTool, } from "./tools/index.js";
34
34
  import { spiderRoutes } from "./oculus-routes.js";
@@ -380,6 +380,7 @@ function validateTemplates(rigTemplates, fabricator) {
380
380
  reviewEngine.id,
381
381
  reviseEngine.id,
382
382
  sealEngine.id,
383
+ verifyEngine.id,
383
384
  ]);
384
385
  for (const [templateKey, template] of Object.entries(rigTemplates)) {
385
386
  const engines = template.engines;
@@ -758,6 +759,7 @@ class RigTemplateRegistry {
758
759
  reviewEngine.id,
759
760
  reviseEngine.id,
760
761
  sealEngine.id,
762
+ verifyEngine.id,
761
763
  ];
762
764
  for (const id of builtinIds) {
763
765
  this.designSourceMap.set(id, 'spider');
@@ -2624,6 +2626,7 @@ export function createSpider() {
2624
2626
  'step-session': stepSessionEngine,
2625
2627
  review: reviewEngine,
2626
2628
  revise: reviseEngine,
2629
+ verify: verifyEngine,
2627
2630
  seal: sealEngine,
2628
2631
  },
2629
2632
  roles: {