@reqvire-org/ads 0.3.37 → 0.3.39

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 (72) hide show
  1. package/README.md +5 -1
  2. package/dist/bootstrap-ds/README.md +2 -2
  3. package/dist/bootstrap-ds/ds.config.json +2 -0
  4. package/dist/bootstrap-ds/package.json +1 -1
  5. package/dist/cli.mjs +16 -5
  6. package/dist/config.mjs +13 -6
  7. package/dist/mcp/context.mjs +4 -3
  8. package/dist/mcp/drafts.mjs +126 -10
  9. package/dist/mcp/execution-results.mjs +2 -2
  10. package/dist/mcp/mutations.mjs +3 -2
  11. package/dist/mcp/preview-owner-guard.mjs +7 -4
  12. package/dist/mcp/preview-widget.bundle.js +46 -47
  13. package/dist/mcp/project-widget.bundle.js +45 -46
  14. package/dist/mcp/server.mjs +20 -7
  15. package/dist/mcp/widget.bundle.js +47 -48
  16. package/dist/preview-bun.mjs +5 -2
  17. package/dist/resource-limits.mjs +146 -0
  18. package/dist/runtime-requirements.mjs +21 -0
  19. package/dist/scenarios-compiler.mjs +4 -3
  20. package/dist/showcase/client.bundle.js +56 -57
  21. package/dist/showcase/sandbox.bundle.js +1 -1
  22. package/dist/skills/ads-break-ui/SKILL.md +3 -2
  23. package/dist/skills/ads-break-ui/references/behaviors.md +8 -4
  24. package/dist/skills/ads-break-ui/references/drafts.md +26 -5
  25. package/dist/skills/ads-break-ui/references/guarded-editing.md +4 -2
  26. package/dist/skills/ads-break-ui/references/runtimes.md +89 -4
  27. package/dist/skills/ads-break-ui/references/validation.md +43 -25
  28. package/dist/skills/ads-break-ui/references/workflows.md +4 -3
  29. package/dist/skills/ads-designer/SKILL.md +10 -5
  30. package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +2 -2
  31. package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +2 -0
  32. package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +1 -1
  33. package/dist/skills/ads-designer/references/behaviors.md +8 -4
  34. package/dist/skills/ads-designer/references/cli.md +3 -3
  35. package/dist/skills/ads-designer/references/drafts.md +26 -5
  36. package/dist/skills/ads-designer/references/guarded-editing.md +4 -2
  37. package/dist/skills/ads-designer/references/runtimes.md +89 -4
  38. package/dist/skills/ads-designer/references/validation.md +43 -25
  39. package/dist/skills/ads-designer/references/workflows.md +4 -3
  40. package/dist/skills/ads-import/SKILL.md +3 -2
  41. package/dist/skills/ads-import/references/behaviors.md +8 -4
  42. package/dist/skills/ads-import/references/cli.md +3 -3
  43. package/dist/skills/ads-import/references/drafts.md +26 -5
  44. package/dist/skills/ads-import/references/guarded-editing.md +4 -2
  45. package/dist/skills/ads-import/references/runtimes.md +89 -4
  46. package/dist/skills/ads-import/references/validation.md +43 -25
  47. package/dist/skills/ads-import/references/workflows.md +4 -3
  48. package/dist/skills/ads-motion/SKILL.md +3 -2
  49. package/dist/skills/ads-motion/references/behaviors.md +8 -4
  50. package/dist/skills/ads-motion/references/drafts.md +26 -5
  51. package/dist/skills/ads-motion/references/guarded-editing.md +4 -2
  52. package/dist/skills/ads-motion/references/runtimes.md +89 -4
  53. package/dist/skills/ads-motion/references/validation.md +43 -25
  54. package/dist/skills/ads-motion/references/workflows.md +4 -3
  55. package/dist/skills/ads-port/SKILL.md +3 -2
  56. package/dist/skills/ads-port/references/behaviors.md +8 -4
  57. package/dist/skills/ads-port/references/cli.md +3 -3
  58. package/dist/skills/ads-port/references/drafts.md +26 -5
  59. package/dist/skills/ads-port/references/guarded-editing.md +4 -2
  60. package/dist/skills/ads-port/references/runtimes.md +89 -4
  61. package/dist/skills/ads-port/references/validation.md +43 -25
  62. package/dist/skills/ads-port/references/workflows.md +4 -3
  63. package/dist/units.mjs +1 -1
  64. package/dist/validation-checks.mjs +10 -5
  65. package/dist/validation.mjs +16 -31
  66. package/dist/verification/browser.mjs +8 -8
  67. package/docs/ARCHITECTURE.md +8 -4
  68. package/docs/BEHAVIORS.md +6 -3
  69. package/docs/CHANGELOG.md +70 -13
  70. package/docs/GUIDE.md +13 -7
  71. package/docs/MCP.md +49 -17
  72. package/package.json +2 -2
@@ -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
  };
@@ -131,7 +131,7 @@ function verificationRequest() {
131
131
  }
132
132
  async function openBehaviorScenario(page, checkId, { timeout = 30000 } = {}) {
133
133
  const request = verificationRequest();
134
- const check = request.checks.find((check2) => check2.id === checkId);
134
+ const check = request.checks.find((check) => check.id === checkId);
135
135
  const url = check && request.scenarios[check.scenario];
136
136
  if (!url)
137
137
  throw new Error("This check has no managed browser scenario. StrictMode profiles must supply a project development harness; production preview bundles do not replay React development effects.");
@@ -156,9 +156,9 @@ async function openPreviewScenario(page, url, scenario, { timeout = 30000 } = {}
156
156
  failures.push(`${request.method()} ${request.url().slice(0, 300)}: ${request.failure()?.errorText ?? "request failed"}`);
157
157
  record(request, { error: request.failure()?.errorText ?? "request failed" });
158
158
  };
159
- const response = (response2) => {
160
- if (response2.status() >= 400)
161
- record(response2.request(), { status: response2.status() });
159
+ const response = (response) => {
160
+ if (response.status() >= 400)
161
+ record(response.request(), { status: response.status() });
162
162
  };
163
163
  const pageError = (error) => {
164
164
  if (errors.length < 3)
@@ -174,7 +174,7 @@ async function openPreviewScenario(page, url, scenario, { timeout = 30000 } = {}
174
174
  await page.goto(verified.href, { waitUntil: "load", timeout });
175
175
  const end = Date.now() + timeout;
176
176
  while (Date.now() < end) {
177
- for (const frame of page.frames().filter((frame2) => frame2 !== page.mainFrame())) {
177
+ for (const frame of page.frames().filter((frame) => frame !== page.mainFrame())) {
178
178
  const state = await frame.evaluate(() => {
179
179
  const data = document.documentElement.dataset;
180
180
  return { state: data.adsPreviewState, id: data.adsScenario, revision: data.adsPreviewRevision, category: data.adsPreviewErrorCategory, code: data.adsPreviewErrorCode, resourceUri: data.adsPreviewResourceUri, message: document.getElementById("ads-preview-status")?.textContent };
@@ -216,8 +216,8 @@ ${failures.join(`
216
216
  }
217
217
  }
218
218
  export {
219
- verificationRequest,
220
- openPreviewScenario,
219
+ auditBehaviorPaints,
221
220
  openBehaviorScenario,
222
- auditBehaviorPaints
221
+ openPreviewScenario,
222
+ verificationRequest
223
223
  };
@@ -595,7 +595,7 @@ Warming an already-current selection does not restart or wait for that compiler.
595
595
  Production reuse requires a successful production build of the exact inputs,
596
596
  not merely a previously compiled development graph. Project-owned additional
597
597
  commands still run as configured. Remove the standalone preview-build command
598
- from `mcp.mutationChecks`; keep it in the ordinary project build.
598
+ from `acceptance.checks`; keep it in the ordinary project build.
599
599
 
600
600
  Candidate architecture inspection runs in a short-lived owned process, releasing
601
601
  its TypeScript heap after completion or cancellation. Semantic preview workers
@@ -779,9 +779,13 @@ candidate files locally and validates a temporary project copy with architecture
779
779
  checks, registered lint rules and project validation scripts.
780
780
  The temporary copy contains the relevant input graph and patched files, with room
781
781
  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;
782
+ inputs support project commands that read data outside the UI graph. When
783
+ `acceptance.behaviorChecks` is true, affected registered behavior checks, including
784
+ consumers of a changed shared controller, run in the isolated candidate project.
785
+ `acceptance.checks` and `validation.checks` explicitly select project scripts; no
786
+ names are inferred. Validation selects its own `behaviorChecks` flag. Direct
787
+ edits can invoke `ads validate --policy acceptance`; separate baselines prevent
788
+ acceptance evidence from satisfying a complete validation audit. The project owns its test code and runner policy;
785
789
  ADS owns affected-check selection, candidate hosting, progress, evidence freshness
786
790
  and process cleanup. One profile timeout bounds its entire runner process. Parallel
787
791
  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,91 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.37
3
+ ## 0.3.39
4
4
 
5
5
  <!-- ads-local-tests:start -->
6
- Local verification: **574/574 passed** with `ADS_TEST_BUN=1 npm test`.
7
- Tested commit: `e0e0d53da1b29fdaa1b20735e0726937d5a19dcf`; Node v24.13.0, Bun 1.3.13.
8
- Completed 2026-10-23T18:18:16.960Z (808 seconds).
6
+ Local verification: **594/594 passed** with `ADS_TEST_BUN=1 npm test`.
7
+ Evidence adopted from the completed working-tree run of package 0.3.38; Node v24.13.0, Bun 1.4.1.
8
+ Release source commit: `37bb8f1436d717b451dfe04546e582fc6c61cc99`. This commit was not the execution HEAD.
9
+ Runtime code and tests match the completed run. Only release version metadata and policy documentation changed afterward.
10
+ The release owner explicitly approved reusing this completed run; no new full run is claimed.
11
+ Completed 2026-10-23T23:00:40.992Z (799 seconds).
9
12
 
10
13
  <!-- ads-local-test-proof
11
14
  {
12
15
  "schema": 1,
13
- "version": "0.3.37",
14
- "commit": "e0e0d53da1b29fdaa1b20735e0726937d5a19dcf",
15
- "sourceSha256": "c71441655e5c8a14242842dbbec17b92608f367396f4645f73dcbaa2eb475cb4",
16
+ "version": "0.3.39",
17
+ "commit": "37bb8f1436d717b451dfe04546e582fc6c61cc99",
18
+ "sourceSha256": "c44e5946aa23eb9a440e6d6e97dbecb413be4941fb56c51b5bdc4fde0f909e1c",
16
19
  "command": "ADS_TEST_BUN=1 npm test",
17
20
  "result": "pass",
18
- "tests": 574,
19
- "pass": 574,
21
+ "tests": 594,
22
+ "pass": 594,
20
23
  "fail": 0,
21
24
  "cancelled": 0,
22
25
  "skipped": 0,
23
26
  "node": "v24.13.0",
24
- "bun": "1.3.13",
25
- "completedAt": "2026-10-23T18:18:16.960Z",
26
- "durationMs": 807676,
27
- "logSha256": "ef20374b0910acea995128abc9ec590f5e73afafe9d529c43dba8d41f51ba907"
27
+ "bun": "1.4.1",
28
+ "completedAt": "2026-10-23T23:00:40.992Z",
29
+ "durationMs": 798977.027594,
30
+ "logSha256": "75ea7b860945aeb06837fdb2d43a22c27553d48c847cd910de52a9036690e2ba",
31
+ "evidenceOrigin": {
32
+ "kind": "adopted-completed-working-tree-run",
33
+ "testedVersion": "0.3.38",
34
+ "executionSource": "Uncommitted working tree before release commit",
35
+ "releaseSourceCommit": "37bb8f1436d717b451dfe04546e582fc6c61cc99",
36
+ "postRunChanges": [
37
+ "Package and lockfile version: 0.3.38 to 0.3.39",
38
+ "Changelog release heading",
39
+ "README and portable behavior-policy documentation"
40
+ ],
41
+ "runtimeAndTests": "Unchanged from the completed 594-test run",
42
+ "authorization": "Release owner explicitly approved reuse of the completed verification instead of rerunning solely for the release proof."
43
+ }
28
44
  }
29
45
  -->
30
46
  <!-- ads-local-tests:end -->
31
47
 
48
+ - Start stdio prewarming only on the real initialized connection, preventing
49
+ disposable MCP negotiation probes from launching competing compilers. HTTP-only
50
+ hosts can still prewarm immediately.
51
+
52
+ - Separate developer-owned acceptance and validation policies. Each explicitly
53
+ lists project scripts and chooses whether registered behavior tests gate it.
54
+ Core ADS architecture, ownership and freshness guards remain mandatory.
55
+ Direct edits can run `ads validate --policy acceptance` or MCP
56
+ `ads_validate({policy:"acceptance"})`. Draft editing/show remains preview-only.
57
+ Remove script-name inference; migrate `mcp.mutationChecks` to `acceptance.checks`.
58
+ Defaults: empty script lists, acceptance behavior checks off, validation on.
59
+ Separate baselines and policy-labelled results keep scopes distinct.
60
+ - Reconcile restarted draft preview workspaces against current project inputs,
61
+ including deletions; recover missing workspaces and remove finished orphan
62
+ workspaces. Return draft-private scenario diagnostics and a scoped resource
63
+ even when preview startup fails. Add explicit `ads_update_draft` refresh using
64
+ durable baselines to merge non-overlapping changes without altering accepted
65
+ source; overlaps leave the proposal intact for resolution.
66
+
67
+ ## 0.3.38
68
+
69
+ - Require Bun 1.4.1+ for ADS's Bun runtime and native compiler. Reject older Bun
70
+ before work starts and invalidate preview caches when its version changes.
71
+ Bun 1.3.13 emitted invalid split modules for Reqvire's graph previews; keep
72
+ production minification/tree shaking and use the corrected compiler. Consuming
73
+ applications retain their own runtimes and build pipelines.
74
+ - Disable Bun's HTTP modulepreload helper in MCP bundles. ADS already loads
75
+ dependencies through its resource bridge; preload self-references must not
76
+ become cyclic blob dependencies or fetch unopened lazy branches.
77
+ - Retain actionable Explorer timeout errors across pending build notifications.
78
+ Retry on request or when new compiled output is available, without silently
79
+ restarting the same failed selection on every status update.
80
+ - Add default process-tree memory budgets to ADS CLI commands, configured through
81
+ `resources.memoryLimitMb`. Use Linux kernel scopes where available, preserve
82
+ inherited envelopes, and report watchdog/host-managed limits honestly in MCP.
83
+ - Teach all five skills to save project worker/heap/OS budgets, validate actual
84
+ runtimes and reject Bun's Node shim for Node-only tooling. Keep package-manager
85
+ choice independent from compiler/test runtime requirements.
86
+
87
+ ## 0.3.37
88
+
32
89
  - Compile ADS tooling/browser bundles and MCP previews with Bun, independently of
33
90
  the application bundler. Native React/Preact JSX, Linaria, static assets and
34
91
  self-contained workers share the existing immutable MCP resource boundary.
package/docs/GUIDE.md CHANGED
@@ -183,7 +183,7 @@ contexts, and exclusion of JavaScript and generated outputs.
183
183
 
184
184
  ## Set up an existing project
185
185
 
186
- Install Bun 1.3.13+ for ADS tooling and previews. The application keeps its own
186
+ Install Bun 1.4.1+ for ADS tooling and previews. The application keeps its own
187
187
  Node/npm or Bun pipeline. Run inside the project containing `package.json`:
188
188
 
189
189
  ```sh
@@ -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
@@ -52,6 +52,26 @@ starting a compiler. Existing views may remain visible during compilation, but
52
52
  changed-source evidence is stale until verified updated artifacts are published.
53
53
  Both editing routes require current ADS/project checks and rendered review.
54
54
 
55
+ ## Command memory budgets (ADS 0.3.38+)
56
+
57
+ ADS 0.3.38 adds `resources.memoryLimitMb` in `ds.config.json`. Missing/null
58
+ selects an automatic process-tree budget of at most 6 GiB and one quarter of
59
+ physical RAM, with 1 GiB of available-memory headroom and inherited Linux limits
60
+ respected. A positive MiB value sets the project budget explicitly. Changing it
61
+ requires restarting ADS. This field is unavailable in published 0.3.37.
62
+
63
+ CLI MCP/Explorer, compile and check/verification commands share the envelope with
64
+ their descendants. Linux uses a user systemd memory scope where available,
65
+ without additional swap, or keeps a finite parent envelope. A separate watchdog
66
+ is the fallback; its sampling is not a hard kernel bound. `ads_status.resourceLimits`
67
+ reports `memoryLimitMb`, `enforcement`, `scope` and `hardLimit`. Embedded APIs
68
+ report `host-managed`, and standalone project scripts need their own limits.
69
+ See [project budgets and runtime selection](../skills/ads-designer/references/runtimes.md).
70
+
71
+ An exceeded command fails with `ADS_MEMORY_LIMIT` on stderr without contaminating
72
+ MCP stdout. Retained source/results must be inspected before retrying. No passing
73
+ result is implied by a timeout, killed worker or disconnected MCP transport.
74
+
55
75
  ## Built-in showcase client
56
76
 
57
77
  ### Auto-mode tracked drafts
@@ -235,7 +255,7 @@ MCP startup. For this `npx` setup, Node and npm must be available to the client.
235
255
 
236
256
  For **Bun**, use `command = "bunx"` and
237
257
  `args = ["@reqvire-org/ads", "mcp"]` in Codex, or these equivalent
238
- `command`/`args` values in Claude's JSON. Bun 1.3.13+ is sufficient; Node and npm
258
+ `command`/`args` values in Claude's JSON. Bun 1.4.1+ is sufficient; Node and npm
239
259
  are unnecessary for ADS itself. The CLI has a Bun shebang. Generated local
240
260
  launchers use the installed CLI while preserving interpreters selected by
241
261
  application check/build scripts.
@@ -503,7 +523,7 @@ the selected candidate's sources. StrictMode profiles need a project React
503
523
  development harness. Profiles describe the execution environment, not a proof
504
524
  that every possible interaction or lifecycle has been tested.
505
525
 
506
- Guarded mutations also run affected registered behavior checks, including contracts
526
+ When `acceptance.behaviorChecks` is true, guarded mutations also run affected registered behavior checks, including contracts
507
527
  that depend on changed shared controllers. Failures reject the candidate before
508
528
  writing real source. Projects without contracts retain their existing checks.
509
529
 
@@ -695,20 +715,26 @@ placeholder. For coupled owners use the bounded transaction; a rejection still
695
715
  requires correcting its owner/policy, never a direct-write bypass.
696
716
 
697
717
  Set `dryRun` to `false` to apply. ADS reconstructs complete candidate files locally
698
- and validates a temporary project copy with native ADS guards, including warnings. By default it also runs available `lint:project`
699
- (or `lint`) and `typecheck` scripts. For managed resource previews,
700
- ADS also requests a full production preview build from the managed compiler and
701
- uses that same host and checked graph for registered browser verification. Keep
702
- `build:mcp-previews` for standalone builds; remove it from `mutationChecks` to
703
- avoid a redundant command. Explicit scripts still run exactly as configured.
704
- Projects without managed resource previews retain the standalone script default.
705
- Override the additional script list through project-owned configuration:
718
+ and validates a temporary project copy with mandatory native ADS guards. The
719
+ project's acceptance policy selects additional scripts and registered tests:
706
720
 
707
721
  ```json
708
- { "mcp": { "mutationChecks": ["lint", "typecheck"], "mutationCheckTimeoutMs": 120000 } }
722
+ {
723
+ "acceptance": { "checks": ["typecheck"], "behaviorChecks": true },
724
+ "validation": { "checks": ["typecheck", "test", "build:app"], "behaviorChecks": true },
725
+ "mcp": { "mutationCheckTimeoutMs": 120000 }
726
+ }
709
727
  ```
710
728
 
711
- 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
729
+ Both script lists default to empty; script names are never inferred. Acceptance
730
+ behavior checks default to false; validation behavior checks default to true.
731
+ Managed previews are built for required behavior checks or requested captures,
732
+ sharing one production graph. Core-only acceptance does not build the whole
733
+ preview graph. Keep standalone preview builds in normal project builds; avoid
734
+ selecting the same build twice. Move the removed `mcp.mutationChecks` field to
735
+ `acceptance.checks` and choose `acceptance.behaviorChecks` explicitly.
736
+
737
+ 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
712
738
  shared with the validation copy. These are trusted project commands, not an OS
713
739
  sandbox. An explicit `configuration` patch can change project commands, registered
714
740
  rules and reviewed exceptions; validation runs the proposed configuration and
@@ -868,7 +894,7 @@ area. Other Apps hosts retain the in-App status fallback.
868
894
 
869
895
  ### ADS-owned Bun compiler
870
896
 
871
- Bun 1.3.13+ compiles ADS browser bundles and MCP previews independently of the
897
+ Bun 1.4.1+ compiles ADS browser bundles and MCP previews independently of the
872
898
  application's bundler. Configure `framework` and `mcp.previewManifest`; ADS
873
899
  supplies its compiler when no explicit project watcher is configured:
874
900
 
@@ -887,8 +913,8 @@ Run `ads compile .` for production previews or `ads compile . --watch` for a
887
913
  continuous compiler. Project setup can call `compilePreviews` from
888
914
  `@reqvire-org/ads/scenarios/compile`. Projects can integrate `ads check`,
889
915
  `ads verify` and `ads validate` into their own build/test/CI scripts. ADS acceptance
890
- always runs native gates and selected registered behavior checks; configured
891
- project checks run explicitly. Oxlint is not an ADS gate dependency.
916
+ always runs native gates; `acceptance.checks` and `acceptance.behaviorChecks`
917
+ choose additional scripts and affected registered tests. Oxlint is not an ADS gate dependency.
892
918
 
893
919
  MCP warms the prioritized view first, then compiles the remaining graph in
894
920
  one background build, without delaying service startup. One compiler job runs
@@ -1361,10 +1387,16 @@ All five skills include the same portable
1361
1387
  ## Complete and affected validation
1362
1388
 
1363
1389
  `ads_validate({})` and `ads validate` share the full validation engine.
1364
- `ads_validate({scope:"changed"})` matches `ads validate --changed`. The MCP tool
1390
+ `ads_validate({scope:"changed"})` matches `ads validate --changed`.
1391
+ `ads_validate({policy:"acceptance"})` matches `ads validate --policy acceptance`:
1392
+ it checks the acceptance policy against current source without applying anything.
1393
+ Validation and acceptance keep separate baselines; acceptance cannot establish
1394
+ full validation. Each policy chooses `checks` and `behaviorChecks`; skipped tests
1395
+ are reported as skipped, without a passing label. Draft preview/edit triggers
1396
+ neither policy. Explicit `ads_verify` remains independent of gating choices. The MCP tool
1365
1397
  runs trusted configured project commands with cancellation and bounded output; it
1366
1398
  is available with source mutations disabled and writes only build/evidence output
1367
- when project commands honor their checking contract. Summaries include scope,
1399
+ when project commands honor their checking contract. Summaries include policy, scope,
1368
1400
  requestedScope, fallback reason, sourceRevision, current, elapsedMs and resultId.
1369
1401
  Read diagnostics/checks/outcomes with `ads_results`; progress and the latest
1370
1402
  validation summary are in `ads_status.validation`. Retention is latest per kind: