@reqvire-org/ads 0.3.38 → 0.3.40

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 (64) hide show
  1. package/README.md +2 -0
  2. package/dist/bootstrap-ds/ds.config.json +2 -0
  3. package/dist/bun-compiler.mjs +1 -1
  4. package/dist/cli.mjs +7 -4
  5. package/dist/config.mjs +11 -6
  6. package/dist/mcp/build-status.mjs +27 -16
  7. package/dist/mcp/context.mjs +4 -3
  8. package/dist/mcp/drafts.mjs +127 -11
  9. package/dist/mcp/execution-results.mjs +2 -2
  10. package/dist/mcp/mutations.mjs +3 -2
  11. package/dist/mcp/preview-widget.bundle.js +2 -2
  12. package/dist/mcp/resource-loader.js +3 -2
  13. package/dist/mcp/server.mjs +15 -7
  14. package/dist/preview-failure.mjs +20 -0
  15. package/dist/preview-resources.mjs +69 -21
  16. package/dist/scenarios-compiler.mjs +7 -6
  17. package/dist/showcase/client.bundle.js +43 -41
  18. package/dist/showcase/index.html +15 -1
  19. package/dist/showcase/preview-state.js +2 -1
  20. package/dist/showcase/style.css +4 -1
  21. package/dist/skills/ads-break-ui/references/behaviors.md +8 -4
  22. package/dist/skills/ads-break-ui/references/drafts.md +26 -5
  23. package/dist/skills/ads-break-ui/references/guarded-editing.md +4 -2
  24. package/dist/skills/ads-break-ui/references/runtimes.md +4 -3
  25. package/dist/skills/ads-break-ui/references/validation.md +43 -25
  26. package/dist/skills/ads-break-ui/references/workflows.md +4 -3
  27. package/dist/skills/ads-designer/SKILL.md +7 -3
  28. package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +2 -0
  29. package/dist/skills/ads-designer/references/behaviors.md +8 -4
  30. package/dist/skills/ads-designer/references/cli.md +1 -1
  31. package/dist/skills/ads-designer/references/drafts.md +26 -5
  32. package/dist/skills/ads-designer/references/guarded-editing.md +4 -2
  33. package/dist/skills/ads-designer/references/runtimes.md +4 -3
  34. package/dist/skills/ads-designer/references/validation.md +43 -25
  35. package/dist/skills/ads-designer/references/workflows.md +4 -3
  36. package/dist/skills/ads-import/references/behaviors.md +8 -4
  37. package/dist/skills/ads-import/references/cli.md +1 -1
  38. package/dist/skills/ads-import/references/drafts.md +26 -5
  39. package/dist/skills/ads-import/references/guarded-editing.md +4 -2
  40. package/dist/skills/ads-import/references/runtimes.md +4 -3
  41. package/dist/skills/ads-import/references/validation.md +43 -25
  42. package/dist/skills/ads-import/references/workflows.md +4 -3
  43. package/dist/skills/ads-motion/references/behaviors.md +8 -4
  44. package/dist/skills/ads-motion/references/drafts.md +26 -5
  45. package/dist/skills/ads-motion/references/guarded-editing.md +4 -2
  46. package/dist/skills/ads-motion/references/runtimes.md +4 -3
  47. package/dist/skills/ads-motion/references/validation.md +43 -25
  48. package/dist/skills/ads-motion/references/workflows.md +4 -3
  49. package/dist/skills/ads-port/references/behaviors.md +8 -4
  50. package/dist/skills/ads-port/references/cli.md +1 -1
  51. package/dist/skills/ads-port/references/drafts.md +26 -5
  52. package/dist/skills/ads-port/references/guarded-editing.md +4 -2
  53. package/dist/skills/ads-port/references/runtimes.md +4 -3
  54. package/dist/skills/ads-port/references/validation.md +43 -25
  55. package/dist/skills/ads-port/references/workflows.md +4 -3
  56. package/dist/units.mjs +1 -1
  57. package/dist/validation-checks.mjs +10 -5
  58. package/dist/validation.mjs +16 -31
  59. package/docs/ARCHITECTURE.md +15 -4
  60. package/docs/BEHAVIORS.md +6 -3
  61. package/docs/CHANGELOG.md +48 -12
  62. package/docs/GUIDE.md +12 -6
  63. package/docs/MCP.md +39 -18
  64. package/package.json +1 -1
@@ -4,33 +4,51 @@ These checks apply to both [direct editing and MCP-only editing](workflows.md).
4
4
  Direct source edits need current checks and rendered review; ordinary edits do
5
5
  not require a draft or acceptance call. Tracked proposals validate on acceptance.
6
6
 
7
- Use `ads_validate({})` for the complete project audit, equivalent to `ads validate`.
8
- Use `ads_validate({scope:"changed"})`, equivalent to `ads validate --changed`, during
9
- editing when a successful full baseline exists. Both interfaces call the same
10
- engine. Full is the default.
7
+ The project chooses required tests in `ds.config.json`; ADS enforces that choice.
8
+ Architecture, ownership, candidate conflicts and source freshness remain mandatory.
9
+ Registering a behavior contract makes checks discoverable and runnable, without
10
+ implicitly requiring them at acceptance.
11
11
 
12
- - During local editing, use existing guarded edits and affected behavior checks.
13
- Reuse completed guards for unchanged source rather than repeatedly auditing all
14
- owners. Direct edits need `ads_check` and appropriate project/behavior checks.
15
- - After test migrations, ownership changes or validation/runner configuration
16
- changes, run full validation. Also run it before a release or an explicit request
17
- to validate everything. It validates the current source, not a prepared draft.
18
- - Inspect failures through `ads_results` using the returned resultId and sections
19
- diagnostics, checks or outcomes. For browser failures, use the outcome's exact
20
- unit/check/runId with `ads_investigate`. Fix the owner and rerun the appropriate scope.
21
- - Report the actual scope and revision. Scoped, stale, cancelled or incomplete
22
- runs cannot establish successful full validation. Passing covers registered
23
- checks and configured scripts, not arbitrary assertions, visual parity or every
24
- application state.
12
+ ```json
13
+ {
14
+ "acceptance": {"checks": ["typecheck"], "behaviorChecks": false},
15
+ "validation": {"checks": ["typecheck", "test", "build:app"], "behaviorChecks": true}
16
+ }
17
+ ```
25
18
 
26
- Full validation runs core architecture/test-boundary guards, configured project scripts and every registered behavior contract. Defaults use the existing
27
- mutation-check scripts plus a project's `test` and build scripts when present.
28
- Build selection prefers `build:lib`, then `build:app`, then `build`.
29
- Projects can declare `validation.checks` as a list of package
30
- script names for the complete audit; core ADS and registered behaviors remain
31
- mandatory. Commands are trusted project configuration, never MCP arguments.
32
- Use scripts that check/build without changing source. Avoid calling `ads validate`
33
- from a script selected by validation.
19
+ - `ads_accept`, guarded patch/transaction application and their dry runs use
20
+ **acceptance** against the isolated candidate. When `behaviorChecks` is true,
21
+ ADS selects affected registered owners, including controller consumers.
22
+ - Direct source editing uses `ads_validate({policy:"acceptance"})` or
23
+ `ads validate --policy acceptance`. It checks working-tree source and applies
24
+ nothing. `--changed`/`scope:"changed"` can narrow registered owners from this
25
+ policy's own successful full baseline. Without that baseline it expands to all.
26
+ - `ads_validate({})` / `ads validate` select **validation**, default scope all:
27
+ core gates, `validation.checks`, current production previews and, when enabled,
28
+ all registered behavior checks. Use before a release, after ownership/test/config
29
+ migrations and for an explicit complete audit. Changed scope narrows registered
30
+ owners while project scripts and core gates retain full scope.
31
+ - Draft create, edit and show are preview-only; they trigger neither policy.
32
+ `ads_verify` explicitly runs selected checks independently of either policy.
33
+ - Builds, hooks and CI trigger a policy only when their scripts invoke it. Use
34
+ leaf commands in policy lists; a selected script must not call `ads validate`
35
+ directly or recursively. Choose project scripts with the developer; do not
36
+ disable tests or weaken configuration to make a failing change pass.
37
+
38
+ Defaults: both script lists are empty, acceptance `behaviorChecks:false`,
39
+ validation `behaviorChecks:true`. No lint/test/build script names are inferred.
40
+ Every listed script must exist; commands are trusted project configuration, not
41
+ MCP arguments. Move the removed `mcp.mutationChecks` field to `acceptance.checks`
42
+ and explicitly choose behavior gating. Existing `mcp.mutationCheckTimeoutMs`
43
+ still bounds each project script; behavior profiles have separate budgets.
44
+
45
+ Report the chosen policy, scope and revision. Skipped tests are not passed tests;
46
+ acceptance evidence is not complete-validation evidence. The two policies keep
47
+ separate ignored baselines (`.ds/acceptance-baseline.json` and
48
+ `.ds/validation-baseline.json`). Inspect failures with `ads_results` and exact
49
+ unit/check/runId via `ads_investigate`. A passing policy does not establish visual
50
+ parity, accessibility or assertions that were not executed. Behavior claims still
51
+ need appropriate current test evidence and rendered review.
34
52
 
35
53
  Prefer native ADS usage policies over project lint plugins. Notification APIs
36
54
  and hosts can be registered as `usage.notifications: [{api, host, rootFiles}]`;
@@ -19,9 +19,10 @@ write source. A read-only MCP connection is sufficient for this workflow.
19
19
  3. With the default ADS-managed compiler, let the existing watcher rebuild. Open
20
20
  the scenario through `ads_show_scenario` or Explorer and inspect the rendered
21
21
  result. Do not launch a second compiler beside the managed one.
22
- 4. Inspect `ads_status.build` or `ads://project/build`. Run native ADS gates and
23
- appropriate project/registered behavior checks, using MCP or the equivalent
24
- CLI/project commands. Review the final current view before finishing. See
22
+ 4. Inspect `ads_status.build` or `ads://project/build`. Run
23
+ `ads_validate({policy:"acceptance"})` or `ads validate --policy acceptance`
24
+ to enforce the developer's project policy against direct source edits. Run
25
+ additional explicit behavior checks when needed for the requested claims. Review the final current view before finishing. See
25
26
  [validation scope](validation.md).
26
27
 
27
28
  ### External builder: `mcp.previewWatch: false`
package/dist/units.mjs CHANGED
@@ -78,7 +78,7 @@ export function configurationFiles(options) {
78
78
  for (const match of command.matchAll(/\b(?:npm|bun)\s+run\s+([\w:.-]+)/g)) script(match[1]);
79
79
  for (const match of command.matchAll(/\b(?:node|bun|tsx|ts-node)\s+([^\s;&|]+\.[cm]?[jt]sx?)(?=\s|$)/g)) visit(path.resolve(root, match[1]), true);
80
80
  }
81
- for (const name of ["lint:ds", "lint:style", "lint:project", "typecheck", "test", "build", "build:mcp-previews", "generate:icons", "build:lib", "build:app", ...(config.validation?.checks ?? []), ...(config.mcp.mutationChecks ?? [])]) script(name);
81
+ for (const name of ["lint:ds", "lint:style", "lint:project", "typecheck", "test", "build", "build:mcp-previews", "generate:icons", "build:lib", "build:app", ...(config.validation?.checks ?? []), ...(config.acceptance?.checks ?? [])]) script(name);
82
82
  const watch = config.mcp.previewWatch;
83
83
  if (watch) {
84
84
  if (["npm", "bun"].includes(watch.command) && watch.args[0] === "run") script(watch.args[1]);
@@ -59,12 +59,17 @@ export function checkCommand(command, args, cwd, signal, input, gate = {category
59
59
  }
60
60
 
61
61
 
62
- export function projectChecks(options) {
62
+ export function projectChecks(options, policy = "acceptance") {
63
63
  const context = projectContext(options);
64
64
  const pkg = JSON.parse(readFileSync(path.join(options.root, "package.json"), "utf8"));
65
- const managed = options.config.mcp.previewManifest && options.config.mcp.previewWatch;
66
- const scripts = options.config.mcp.mutationChecks ?? [pkg.scripts?.["lint:project"] ? "lint:project" : "lint", "typecheck", ...(managed ? [] : ["build:mcp-previews"])].filter(name => typeof pkg.scripts?.[name] === "string");
67
- if (scripts.some(name => typeof pkg.scripts?.[name] !== "string")) throw fail("mutation-check", "Every configured mcp.mutationChecks script must exist in package.json.");
68
- if (scripts.length && !["npm", "bun"].includes(context.packageManager)) throw fail("mutation-check", "Declare packageManager as npm or bun to run mutation checks.");
65
+ const scripts = options.config[policy].checks;
66
+ if (scripts.some(name => typeof pkg.scripts?.[name] !== "string")) throw fail("project-check", `Every configured ${policy}.checks script must exist in package.json.`);
67
+ if (scripts.length && !["npm", "bun"].includes(context.packageManager)) throw fail("project-check", "Declare packageManager as npm or bun to run project checks.");
68
+ function recursive(script, seen = new Set()) {
69
+ if (seen.has(script)) return false; seen.add(script);
70
+ const text=pkg.scripts?.[script] ?? "";
71
+ return /\bads\s+validate\b|\bcli\.mjs["']?\s+validate\b/.test(text) || [...text.matchAll(/\b(?:npm|bun)\s+(?:--bun\s+)?run\s+([\w:.-]+)/g)].some(match=>recursive(match[1],seen));
72
+ }
73
+ if(scripts.some(script=>recursive(script)))throw fail("project-check", `A selected script calls ads validate recursively. Use leaf scripts in ${policy}.checks.`);
69
74
  return scripts.map(script => packageScriptCommand(context.packageManager, script));
70
75
  }
@@ -8,8 +8,6 @@ import { inspectBehaviors } from "./behaviors.mjs";
8
8
  import { affectedBehaviorUnits, createVerificationController } from "./verification.mjs";
9
9
  import { validationInputFiles } from "./validation-inputs.mjs";
10
10
  import { checkCandidate, checkCommand, projectChecks } from "./validation-checks.mjs";
11
- import { projectContext } from "./mcp/context.mjs";
12
- import { packageScriptCommand } from "./development-runtime.mjs";
13
11
  import { acceptance } from "./evidence.mjs";
14
12
  import { inspectScenarios } from "./scenarios.mjs";
15
13
  import { inspectBuildStatus } from "./mcp/build-status.mjs";
@@ -40,8 +38,9 @@ export function createValidationController(directory, { previewWork } = {}) {
40
38
  return {
41
39
  status() { return { busy: !!active, ...(progress ? {progress} : {}) }; },
42
40
  async close() { const pending = active; pending?.abort(); await pending?.completion; },
43
- async run({scope = "all"} = {}, signal, onProgress) {
41
+ async run({scope = "all", policy = "validation"} = {}, signal, onProgress) {
44
42
  if (!["all","changed"].includes(scope)) throw new Error("Validation scope must be all or changed.");
43
+ if (!["acceptance","validation"].includes(policy)) throw new Error("Policy must be acceptance or validation.");
45
44
  if (active) throw new Error("Validation is already running.");
46
45
  active = new AbortController();
47
46
  const controller = active;
@@ -60,11 +59,11 @@ export function createValidationController(directory, { previewWork } = {}) {
60
59
  if (previewWork) releasePreview = await previewWork.acquire(signal);
61
60
  const options = loadConfig(root);
62
61
  inputs = validationInputs(options);
63
- const baselineFile = outputFile(root,"validation-baseline.json");
62
+ const baselineFile = outputFile(root,`${policy}-baseline.json`);
64
63
  if (scope === "changed") {
65
64
  let baseline;
66
65
  try { if (realpathSync(baselineFile) === baselineFile && lstatSync(baselineFile).size < 8*1024*1024) baseline = JSON.parse(readFileSync(baselineFile,"utf8")); } catch { /* No trusted baseline: perform the complete audit. */ }
67
- if (baseline?.schemaVersion !== 1 || baseline.root !== root || baseline.toolRevision !== toolRevision || !baseline.files || hash(JSON.stringify([toolRevision,baseline.files])) !== baseline.revision) fallback = "No compatible successful full-validation baseline.";
66
+ if (baseline?.schemaVersion !== 1 || baseline.root !== root || baseline.toolRevision !== toolRevision || !baseline.files || hash(JSON.stringify([toolRevision,baseline.files])) !== baseline.revision) fallback = "No compatible successful full-policy baseline.";
68
67
  else {
69
68
  changed = [...new Set([...Object.keys(inputs.files),...Object.keys(baseline.files)])].filter(file => inputs.files[file] !== baseline.files[file]);
70
69
  const inventory = inspectUnits(options);
@@ -80,31 +79,19 @@ export function createValidationController(directory, { previewWork } = {}) {
80
79
  diagnostics.push(...core.diagnostics); advisories.push(...(core.advisories ?? []));
81
80
  checks.push({name:"architecture",passed:core.ok});
82
81
  if (!core.ok) return complete();
83
- const pkg = JSON.parse(readFileSync(path.join(root,"package.json"),"utf8"));
84
- const scripts = projectChecks(options);
85
- if (scope === "all") {
86
- const configured = options.config.validation.checks;
87
- if (configured) scripts.splice(0,scripts.length,...configured.map(script => {
88
- if (typeof pkg.scripts?.[script] !== "string") throw new Error(`Configured validation script does not exist: ${script}`);
89
- return packageScriptCommand(projectContext(options).packageManager,script);
90
- }));
91
- else for (const script of ["test", pkg.scripts?.["build:lib"] ? "build:lib" : pkg.scripts?.["build:app"] ? "build:app" : "build"]) if (typeof pkg.scripts?.[script] === "string" && !scripts.some(item => item.args.at(-1) === script)) scripts.splice(Math.max(0,scripts.length-1),0,packageScriptCommand(projectContext(options).packageManager,script));
92
- }
93
- function recursive(script, seen = new Set()) {
94
- if (seen.has(script)) return false;seen.add(script);
95
- const text=pkg.scripts?.[script] ?? "";
96
- return /\bads\s+validate\b|\bcli\.mjs["']?\s+validate\b/.test(text) || [...text.matchAll(/\b(?:npm|bun)\s+(?:--bun\s+)?run\s+([\w:.-]+)/g)].some(match=>recursive(match[1],seen));
97
- }
98
- if (scripts.some(launch=>recursive(launch.args.at(-1)))) throw new Error("A selected project script calls ads validate recursively. Use leaf check/build scripts in validation.checks.");
82
+ const scripts = projectChecks(options,policy);
99
83
  for (const launch of scripts) await command(`project:${launch.args.at(-1)}`,launch,options);
100
- if (options.config.mcp.previewManifest && options.config.mcp.previewWatch) {
84
+ const behaviors = inspectBehaviors(options);
85
+ units = options.config[policy].behaviorChecks ? (scope === "all" ? behaviors.contracts.map(contract=>contract.unit) : affectedBehaviorUnits(options,changed)) : [];
86
+ const requirePreviews=policy === "validation" || units.length>0;
87
+ if (requirePreviews && options.config.mcp.previewManifest && options.config.mcp.previewWatch) {
101
88
  stage("preview-build");
102
89
  const { startAdsMcp } = await import("./mcp/server.mjs");
103
90
  previewHost = await startAdsMcp(root, { stdio:false });
104
91
  await previewHost.buildAll(signal, {timeoutMs:options.config.mcp.mutationCheckTimeoutMs});
105
92
  checks.push({name:"managed production previews",passed:true});
106
93
  }
107
- if (options.config.mcp.previewManifest || options.config.mcp.apps.length) {
94
+ if (requirePreviews && (options.config.mcp.previewManifest || options.config.mcp.apps.length)) {
108
95
  stage("verified-previews");
109
96
  const apps=[...options.config.mcp.apps,...inspectScenarios(options).scenarios.map(entry=>({id:entry.id,file:entry.artifact}))];
110
97
  const build=previewHost ? previewHost.buildStatus() : inspectBuildStatus(root,{...options.config.mcp,apps});
@@ -118,9 +105,7 @@ export function createValidationController(directory, { previewWork } = {}) {
118
105
  diagnostics.push(...pending.map(entry=>({rule:"validation-previews",message:`${entry.id}: ${entry.state}. A current verified preview is required; successful command exit alone is insufficient.`,details:entry.diagnostics})));
119
106
  return complete();
120
107
  }
121
- } else checks.push({name:"verified-previews",passed:true,skipped:true,reason:"No managed preview output configured."});
122
- const behaviors = inspectBehaviors(options);
123
- units = scope === "all" ? behaviors.contracts.map(contract=>contract.unit) : affectedBehaviorUnits(options,changed);
108
+ } else checks.push({name:"verified-previews",skipped:true,reason:requirePreviews ? "No managed preview output configured." : "Not required by acceptance policy."});
124
109
  if (units.length) {
125
110
  stage("behavior");
126
111
  const verification = createVerificationController(root, {previewHost});
@@ -130,7 +115,7 @@ export function createValidationController(directory, { previewWork } = {}) {
130
115
  results.push(...result.results); diagnostics.push(...result.diagnostics);
131
116
  checks.push({name:"registered-behavior",passed:result.ok});
132
117
  if (!result.ok && !result.diagnostics.length) diagnostics.push({rule:"validation-behavior",message:"Registered behavior checks did not all pass. Inspect the recorded outcomes."});
133
- } else checks.push({name:"registered-behavior",passed:true,skipped:true,reason:scope === "all" ? "No registered behavior contracts." : "No affected behavior contracts."});
118
+ } else checks.push({name:"registered-behavior",skipped:true,reason:!options.config[policy].behaviorChecks ? `Not required by ${policy} policy.` : scope === "all" ? "No registered behavior contracts." : "No affected behavior contracts."});
134
119
  } catch (error) { diagnostics.push(error.diagnostic ?? {rule:signal.aborted ? "validation-cancelled" : "validation-execution",message:error.message}); }
135
120
  finally { try { await previewHost?.close(); } finally { releasePreview?.();active=undefined;progress=undefined;finish(); } }
136
121
  return complete();
@@ -140,15 +125,15 @@ export function createValidationController(directory, { previewWork } = {}) {
140
125
  try { current = !!inputs && validationInputs(loadConfig(root)).revision === inputs.revision; } catch (error) { diagnostics.push({rule:"validation-inputs",message:error.message}); }
141
126
  if (inputs && !current) diagnostics.push({rule:"validation-stale",message:"Project inputs changed during validation. Rerun against current source."});
142
127
  if (signal.aborted && !diagnostics.some(item=>item.rule==="validation-cancelled")) diagnostics.push({rule:"validation-cancelled",message:"Validation was cancelled."});
143
- let ok = current && !signal.aborted && !diagnostics.length && checks.every(check=>check.passed);
128
+ let ok = current && !signal.aborted && !diagnostics.length && checks.every(check=>check.skipped || check.passed);
144
129
  if (ok && scope === "all") {
145
- const file = outputFile(root,"validation-baseline.json"), temporary = `${file}.${randomUUID()}.tmp`;
130
+ const file = outputFile(root,`${policy}-baseline.json`), temporary = `${file}.${randomUUID()}.tmp`;
146
131
  try { writeFileSync(temporary,JSON.stringify({schemaVersion:1,root,toolRevision,...inputs})); renameSync(temporary,file); }
147
132
  catch (error) { ok=false;diagnostics.push({rule:"validation-baseline",message:error.message}); }
148
133
  finally { rmSync(temporary,{force:true}); }
149
134
  }
150
- return {ok,scope,requestedScope,...(fallback?{fallback}:{}),sourceRevision:inputs?.revision,current,elapsedMs:Date.now()-startedAt,selection:{files:changed,units},checks,diagnostics,advisories,results,
151
- acceptance:acceptance(scope === "all" ? "full-project-validation" : "affected-project-validation",ok,checks.filter(check=>check.passed&&!check.skipped).map(check=>check.name),["unconfigured-project-checks","unasserted-behavior","visual-parity","accessibility-audit"])};
135
+ return {ok,policy,scope,requestedScope,...(fallback?{fallback}:{}),sourceRevision:inputs?.revision,current,elapsedMs:Date.now()-startedAt,selection:{files:changed,units},checks,diagnostics,advisories,results,
136
+ acceptance:acceptance(policy === "acceptance" ? "project-acceptance-policy" : scope === "all" ? "full-project-validation" : "affected-project-validation",ok,checks.filter(check=>check.passed&&!check.skipped).map(check=>check.name),["unconfigured-project-checks","unasserted-behavior","visual-parity","accessibility-audit"])};
152
137
  }
153
138
  },
154
139
  };
@@ -346,6 +346,13 @@ scenarios unmounts the previous view while keeping unchanged dependencies cached
346
346
  Persistence is a host lifecycle choice; a new external widget loads the same
347
347
  resources independently. Resource sharing is scoped to an App instance.
348
348
 
349
+ Resource IDs hash original bytes and the transitive graph of URLs they rewrite.
350
+ Cyclic module groups share a deterministic fingerprint. This makes
351
+ IDs independent of compiler filename hashing: rewriting a changed dependency
352
+ cannot put different bytes behind an existing URI. Unrelated graph branches keep
353
+ their IDs and caches. The App still verifies the digest of the final bytes and
354
+ rejects any identity collision without partially registering the new graph.
355
+
349
356
  The showcase's resource bridge can recover a transient fetch failure with at most
350
357
  three read attempts and bounded backoff. This applies only to `resources/read`;
351
358
  tool calls, assertions and whole checks are never replayed. Cancellation,
@@ -595,7 +602,7 @@ Warming an already-current selection does not restart or wait for that compiler.
595
602
  Production reuse requires a successful production build of the exact inputs,
596
603
  not merely a previously compiled development graph. Project-owned additional
597
604
  commands still run as configured. Remove the standalone preview-build command
598
- from `mcp.mutationChecks`; keep it in the ordinary project build.
605
+ from `acceptance.checks`; keep it in the ordinary project build.
599
606
 
600
607
  Candidate architecture inspection runs in a short-lived owned process, releasing
601
608
  its TypeScript heap after completion or cancellation. Semantic preview workers
@@ -779,9 +786,13 @@ candidate files locally and validates a temporary project copy with architecture
779
786
  checks, registered lint rules and project validation scripts.
780
787
  The temporary copy contains the relevant input graph and patched files, with room
781
788
  for 100,000 files / 2 GiB. Unrelated native artifacts are not copied. Declared extra
782
- inputs support project commands that read data outside the UI graph. Affected
783
- registered behavior checks, including consumers of a changed shared controller, also run in
784
- the isolated candidate project. The project owns its test code and runner policy;
789
+ inputs support project commands that read data outside the UI graph. When
790
+ `acceptance.behaviorChecks` is true, affected registered behavior checks, including
791
+ consumers of a changed shared controller, run in the isolated candidate project.
792
+ `acceptance.checks` and `validation.checks` explicitly select project scripts; no
793
+ names are inferred. Validation selects its own `behaviorChecks` flag. Direct
794
+ edits can invoke `ads validate --policy acceptance`; separate baselines prevent
795
+ acceptance evidence from satisfying a complete validation audit. The project owns its test code and runner policy;
785
796
  ADS owns affected-check selection, candidate hosting, progress, evidence freshness
786
797
  and process cleanup. One profile timeout bounds its entire runner process. Parallel
787
798
  workers can share that candidate host with independent App state. Partial outcomes
package/docs/BEHAVIORS.md CHANGED
@@ -374,13 +374,16 @@ scripts still run as configured; ordinary live preview does not automatically ru
374
374
  browser checks and release validation runs the full suite. Persistent Bun
375
375
  compilation and retained preview state do not imply per-test-case execution caches.
376
376
 
377
- Guarded mutations execute affected registered behavior contracts after native ADS gates
377
+ When `acceptance.behaviorChecks` is true, guarded mutations execute affected
378
+ registered behavior contracts after mandatory native ADS gates
378
379
  and configured project checks, before writing source. Imported shared
379
380
  controller changes also select dependent contracts conservatively. Rejected and
380
381
  dry-run patches publish no source changes. Verification output stays under `.ds/`.
381
382
  To check a prepared draft, request its diff and pass the returned `patchFile` to
382
- `ads_apply_patch` with `dryRun:true`. This checks the isolated candidate, including
383
- affected behavior contracts and its configured browser preview. Candidate evidence
383
+ `ads_apply_patch` with `dryRun:true`. This checks the isolated candidate using the acceptance policy, including
384
+ affected behavior contracts and their browser preview when enabled.
385
+ `validation.behaviorChecks` separately controls validation, while explicit
386
+ `ads_verify` always runs requested tests. Candidate evidence
384
387
  is not persisted as passing evidence for live source. `ads_verify` selects checks
385
388
  for current source and has no draft argument.
386
389
 
package/docs/CHANGELOG.md CHANGED
@@ -1,34 +1,70 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.38
3
+ ## 0.3.40
4
4
 
5
5
  <!-- ads-local-tests:start -->
6
- Local verification: **584/584 passed** with `ADS_TEST_BUN=1 npm test`.
7
- Tested commit: `c6f50aa3e3a8c4b746805faf3190c12874108e81`; Node v24.13.0, Bun 1.4.1.
8
- Completed 2026-10-23T21:33:53.937Z (772 seconds).
6
+ Local verification: **602/602 passed** with `ADS_TEST_BUN=1 npm test`.
7
+ Tested commit: `eb5d277c1f5198d54318ca0a3fa836e1eb7ee2a3`; Node v24.13.0, Bun 1.4.1.
8
+ Completed 2026-10-24T18:24:27.888Z (829 seconds).
9
9
 
10
10
  <!-- ads-local-test-proof
11
11
  {
12
12
  "schema": 1,
13
- "version": "0.3.38",
14
- "commit": "c6f50aa3e3a8c4b746805faf3190c12874108e81",
15
- "sourceSha256": "01da9a648eb3206296fadd93ece54996f901ab43b218a137681d5cc5728858e9",
13
+ "version": "0.3.40",
14
+ "commit": "eb5d277c1f5198d54318ca0a3fa836e1eb7ee2a3",
15
+ "sourceSha256": "597fe2f9983e64fac21e3d4584e5bae7068a24fde7f00bde9a57c89ea41fa597",
16
16
  "command": "ADS_TEST_BUN=1 npm test",
17
17
  "result": "pass",
18
- "tests": 584,
19
- "pass": 584,
18
+ "tests": 602,
19
+ "pass": 602,
20
20
  "fail": 0,
21
21
  "cancelled": 0,
22
22
  "skipped": 0,
23
23
  "node": "v24.13.0",
24
24
  "bun": "1.4.1",
25
- "completedAt": "2026-10-23T21:33:53.937Z",
26
- "durationMs": 772285,
27
- "logSha256": "984ecd9909f3a5808afba6fd1ef1e708a1bab0268f0ebc202c0333f3fe804556"
25
+ "completedAt": "2026-10-24T18:24:27.888Z",
26
+ "durationMs": 829113,
27
+ "logSha256": "810783acb0791a199a1e773d8da6779ed537f8a632971b851da40446ebe6fd97"
28
28
  }
29
29
  -->
30
30
  <!-- ads-local-tests:end -->
31
31
 
32
+ - Fix immutable preview resource collisions when a compiler keeps dependency
33
+ filenames stable. Resource identities include transitive dependencies, with
34
+ cycle-aware hashing; unrelated preview branches retain their cached identities.
35
+ Rejected resource graphs no longer partially update the App loader.
36
+ - Move Explorer failures out of the rendered canvas into a compact workspace
37
+ status strip below the toolbar. Details opens the full diagnostics; Retry and
38
+ the retained preview remain available, including at phone widths.
39
+ - Preserve project/scenario/graph failure scope and validation/discovery/build
40
+ phase in preview reports. Explorer and MCP distinguish project validation
41
+ failures from errors in the selected preview, and retain the actual diagnostic
42
+ file, line, column and rule instead of reporting the compiler launcher location.
43
+
44
+
45
+ ## 0.3.39
46
+
47
+ - Start stdio prewarming only on the real initialized connection, preventing
48
+ disposable MCP negotiation probes from launching competing compilers. HTTP-only
49
+ hosts can still prewarm immediately.
50
+
51
+ - Separate developer-owned acceptance and validation policies. Each explicitly
52
+ lists project scripts and chooses whether registered behavior tests gate it.
53
+ Core ADS architecture, ownership and freshness guards remain mandatory.
54
+ Direct edits can run `ads validate --policy acceptance` or MCP
55
+ `ads_validate({policy:"acceptance"})`. Draft editing/show remains preview-only.
56
+ Remove script-name inference; migrate `mcp.mutationChecks` to `acceptance.checks`.
57
+ Defaults: empty script lists, acceptance behavior checks off, validation on.
58
+ Separate baselines and policy-labelled results keep scopes distinct.
59
+ - Reconcile restarted draft preview workspaces against current project inputs,
60
+ including deletions; recover missing workspaces and remove finished orphan
61
+ workspaces. Return draft-private scenario diagnostics and a scoped resource
62
+ even when preview startup fails. Add explicit `ads_update_draft` refresh using
63
+ durable baselines to merge non-overlapping changes without altering accepted
64
+ source; overlaps leave the proposal intact for resolution.
65
+
66
+ ## 0.3.38
67
+
32
68
  - Require Bun 1.4.1+ for ADS's Bun runtime and native compiler. Reject older Bun
33
69
  before work starts and invalidate preview caches when its version changes.
34
70
  Bun 1.3.13 emitted invalid split modules for Reqvire's graph previews; keep
package/docs/GUIDE.md CHANGED
@@ -433,13 +433,19 @@ Exit codes are 0 for success, 1 for check findings, and 2 for invalid
433
433
  input/configuration or execution errors.
434
434
 
435
435
  Guarded MCP editing is opt-in. Its mandatory checks and optional project
436
- `mcp.mutationChecks` scripts run in a temporary project copy with installed
436
+ `acceptance.checks` scripts run in a temporary project copy with installed
437
437
  dependencies. Project scripts default to 60 seconds each; use the explicit
438
438
  `mcp.mutationCheckTimeoutMs` budget (100–300000 ms) for measured slower builds.
439
439
  Behavior profiles have a separate whole-run budget.
440
- For managed resource previews, ADS builds the complete production graph during
441
- acceptance and shares it with browser verification. Remove `build:mcp-previews`
442
- from `mcp.mutationChecks`; keep that script in the ordinary project build.
440
+ Set `acceptance.behaviorChecks` to require affected registered tests at acceptance.
441
+ Set `validation.checks` and `validation.behaviorChecks` independently for audits.
442
+ Both script lists default to empty; no names are inferred. Direct source edits
443
+ can run `ads validate --policy acceptance`; ordinary `ads validate` selects the
444
+ validation policy. See [policy guidance](../skills/ads-designer/references/validation.md).
445
+ When the acceptance policy requires affected registered behavior checks (or
446
+ a capture was requested), ADS builds and shares production previews with browser
447
+ verification. Core-only acceptance does not build the whole graph. Remove `build:mcp-previews`
448
+ from `acceptance.checks`; keep that script in the ordinary project build.
443
449
  See the [editing contract](MCP.md#guarded-editing) for unit ownership,
444
450
  Git patches, bounded reads and preview review. Keep normal build gates enabled
445
451
  for edits made by other tools.
@@ -469,7 +475,7 @@ Arbitrary computed expressions, combined conditional cascade behavior, computed
469
475
  module specifiers, JSX spreads, other styling engines, and renderer-specific APIs
470
476
  need the project's existing checks and review. Continue to run its type checking,
471
477
  component tests, and browser comparisons. Register component-specific guards as
472
- explicit project scripts; include them in builds and `mcp.mutationChecks` when
478
+ explicit project scripts; include them in builds and `acceptance.checks` when
473
479
  required. `ads check` does not invoke project linter plugins.
474
480
 
475
481
  ## Showcase
@@ -943,7 +949,7 @@ Project scale policies remain explicit. A registered check can call
943
949
  from the tooling package. Check `aliasOnly` for strict alias-only policies across
944
950
  all themes; inspect `literals`/`diagnostics` for raw values, cycles and limits.
945
951
  Choose exact targets/origins and documented geometry exceptions in project code;
946
- register the command in `mcp.mutationChecks` and the normal build. ADS owns no
952
+ register the command in `acceptance.checks` and the normal build. ADS owns no
947
953
  universal spacing scale and infers no design meaning from token names.
948
954
 
949
955
  ## Releasing the ADS tool
package/docs/MCP.md CHANGED
@@ -192,9 +192,10 @@ HTML in an opaque sandbox. Project UI is never imported into the shell.
192
192
 
193
193
  The built-in client refreshes menus after catalogue changes and automatically
194
194
  refreshes the active scenario inside the same reusable App after a current
195
- successful build. Failed builds show
196
- file/line diagnostics and identify a retained view as stale. Themes and available
197
- space flow through host context. Other coding-agent hosts retain their own reload
195
+ successful build. Failed builds show a compact status strip below the toolbar,
196
+ outside the App canvas. Details opens full file/line diagnostics; Retry requests
197
+ the selected preview again. The retained view is identified as stale. Themes and
198
+ available space flow through host context. Other coding-agent hosts retain their own reload
198
199
  policy. A disconnected subscription marks retained output stale and tears down
199
200
  App watchers; refresh the page after restarting ADS. Compilation remains necessary for project TSX/Linaria, performed by the
200
201
  managed project compiler on demand and after relevant source changes.
@@ -523,7 +524,7 @@ the selected candidate's sources. StrictMode profiles need a project React
523
524
  development harness. Profiles describe the execution environment, not a proof
524
525
  that every possible interaction or lifecycle has been tested.
525
526
 
526
- Guarded mutations also run affected registered behavior checks, including contracts
527
+ When `acceptance.behaviorChecks` is true, guarded mutations also run affected registered behavior checks, including contracts
527
528
  that depend on changed shared controllers. Failures reject the candidate before
528
529
  writing real source. Projects without contracts retain their existing checks.
529
530
 
@@ -715,20 +716,26 @@ placeholder. For coupled owners use the bounded transaction; a rejection still
715
716
  requires correcting its owner/policy, never a direct-write bypass.
716
717
 
717
718
  Set `dryRun` to `false` to apply. ADS reconstructs complete candidate files locally
718
- and validates a temporary project copy with native ADS guards, including warnings. By default it also runs available `lint:project`
719
- (or `lint`) and `typecheck` scripts. For managed resource previews,
720
- ADS also requests a full production preview build from the managed compiler and
721
- uses that same host and checked graph for registered browser verification. Keep
722
- `build:mcp-previews` for standalone builds; remove it from `mutationChecks` to
723
- avoid a redundant command. Explicit scripts still run exactly as configured.
724
- Projects without managed resource previews retain the standalone script default.
725
- Override the additional script list through project-owned configuration:
719
+ and validates a temporary project copy with mandatory native ADS guards. The
720
+ project's acceptance policy selects additional scripts and registered tests:
726
721
 
727
722
  ```json
728
- { "mcp": { "mutationChecks": ["lint", "typecheck"], "mutationCheckTimeoutMs": 120000 } }
723
+ {
724
+ "acceptance": { "checks": ["typecheck"], "behaviorChecks": true },
725
+ "validation": { "checks": ["typecheck", "test", "build:app"], "behaviorChecks": true },
726
+ "mcp": { "mutationCheckTimeoutMs": 120000 }
727
+ }
729
728
  ```
730
729
 
731
- Every listed script must exist. An empty list still runs mandatory ADS and configured managed preview checks. Scripts use the project's npm/Bun runner; installed dependencies are
730
+ Both script lists default to empty; script names are never inferred. Acceptance
731
+ behavior checks default to false; validation behavior checks default to true.
732
+ Managed previews are built for required behavior checks or requested captures,
733
+ sharing one production graph. Core-only acceptance does not build the whole
734
+ preview graph. Keep standalone preview builds in normal project builds; avoid
735
+ selecting the same build twice. Move the removed `mcp.mutationChecks` field to
736
+ `acceptance.checks` and choose `acceptance.behaviorChecks` explicitly.
737
+
738
+ Every listed script must exist. An empty list still runs mandatory ADS guards; registered tests run only when the policy enables them. Scripts use the project's npm/Bun runner; installed dependencies are
732
739
  shared with the validation copy. These are trusted project commands, not an OS
733
740
  sandbox. An explicit `configuration` patch can change project commands, registered
734
741
  rules and reviewed exceptions; validation runs the proposed configuration and
@@ -907,8 +914,8 @@ Run `ads compile .` for production previews or `ads compile . --watch` for a
907
914
  continuous compiler. Project setup can call `compilePreviews` from
908
915
  `@reqvire-org/ads/scenarios/compile`. Projects can integrate `ads check`,
909
916
  `ads verify` and `ads validate` into their own build/test/CI scripts. ADS acceptance
910
- always runs native gates and selected registered behavior checks; configured
911
- project checks run explicitly. Oxlint is not an ADS gate dependency.
917
+ always runs native gates; `acceptance.checks` and `acceptance.behaviorChecks`
918
+ choose additional scripts and affected registered tests. Oxlint is not an ADS gate dependency.
912
919
 
913
920
  MCP warms the prioritized view first, then compiles the remaining graph in
914
921
  one background build, without delaying service startup. One compiler job runs
@@ -1378,13 +1385,27 @@ storage directory and `ads://guides/reporting`, without listing report contents.
1378
1385
  All five skills include the same portable
1379
1386
  [reporting reference](../skills/ads-designer/references/reporting.md).
1380
1387
 
1388
+ Build errors carry optional `failure: {scope, phase}` metadata. `scope` is
1389
+ `project`, `graph` or `scenario`; `phase` is `validation`, `discovery` or `build`.
1390
+ A failed project gate blocks verification across previews; it does not establish
1391
+ that every component failed compilation. Diagnostics retain their owning source
1392
+ file, line, column and rule code. Explorer labels project validation explicitly
1393
+ and shows errors for the selected preview rather than borrowing an unrelated
1394
+ scenario's failure. A retained earlier view is not current-source evidence.
1395
+
1381
1396
  ## Complete and affected validation
1382
1397
 
1383
1398
  `ads_validate({})` and `ads validate` share the full validation engine.
1384
- `ads_validate({scope:"changed"})` matches `ads validate --changed`. The MCP tool
1399
+ `ads_validate({scope:"changed"})` matches `ads validate --changed`.
1400
+ `ads_validate({policy:"acceptance"})` matches `ads validate --policy acceptance`:
1401
+ it checks the acceptance policy against current source without applying anything.
1402
+ Validation and acceptance keep separate baselines; acceptance cannot establish
1403
+ full validation. Each policy chooses `checks` and `behaviorChecks`; skipped tests
1404
+ are reported as skipped, without a passing label. Draft preview/edit triggers
1405
+ neither policy. Explicit `ads_verify` remains independent of gating choices. The MCP tool
1385
1406
  runs trusted configured project commands with cancellation and bounded output; it
1386
1407
  is available with source mutations disabled and writes only build/evidence output
1387
- when project commands honor their checking contract. Summaries include scope,
1408
+ when project commands honor their checking contract. Summaries include policy, scope,
1388
1409
  requestedScope, fallback reason, sourceRevision, current, elapsedMs and resultId.
1389
1410
  Read diagnostics/checks/outcomes with `ads_results`; progress and the latest
1390
1411
  validation summary are in `ads_status.validation`. Retention is latest per kind:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.3.38",
3
+ "version": "0.3.40",
4
4
  "type": "module",
5
5
  "description": "A design system your agent can see and shape. Your components. Your look. Your code.",
6
6
  "repository": {