@reqvire-org/ads 0.3.40 → 0.3.41

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 (31) hide show
  1. package/dist/config.mjs +4 -1
  2. package/dist/investigations.mjs +27 -8
  3. package/dist/mcp/context.mjs +1 -1
  4. package/dist/mcp/execution-context.mjs +38 -0
  5. package/dist/mcp/execution-coordinator.mjs +220 -0
  6. package/dist/mcp/execution-results.mjs +107 -48
  7. package/dist/mcp/mutations.mjs +2 -0
  8. package/dist/mcp/server.mjs +42 -13
  9. package/dist/skills/ads-break-ui/references/behaviors.md +4 -5
  10. package/dist/skills/ads-break-ui/references/evidence.md +12 -8
  11. package/dist/skills/ads-break-ui/references/validation.md +33 -0
  12. package/dist/skills/ads-designer/references/behaviors.md +4 -5
  13. package/dist/skills/ads-designer/references/evidence.md +12 -8
  14. package/dist/skills/ads-designer/references/validation.md +33 -0
  15. package/dist/skills/ads-import/references/behaviors.md +4 -5
  16. package/dist/skills/ads-import/references/evidence.md +12 -8
  17. package/dist/skills/ads-import/references/validation.md +33 -0
  18. package/dist/skills/ads-motion/references/behaviors.md +4 -5
  19. package/dist/skills/ads-motion/references/evidence.md +12 -8
  20. package/dist/skills/ads-motion/references/validation.md +33 -0
  21. package/dist/skills/ads-port/references/behaviors.md +4 -5
  22. package/dist/skills/ads-port/references/evidence.md +12 -8
  23. package/dist/skills/ads-port/references/validation.md +33 -0
  24. package/dist/validation-checks.mjs +6 -2
  25. package/dist/validation.mjs +8 -2
  26. package/dist/verification.mjs +7 -3
  27. package/docs/ARCHITECTURE.md +14 -3
  28. package/docs/CHANGELOG.md +25 -12
  29. package/docs/MCP.md +54 -9
  30. package/docs/plans/execution-coordination.md +57 -0
  31. package/package.json +1 -1
@@ -346,9 +346,8 @@ previews and a `resultId` (4 KiB UTF-8 JSON maximum). Use `ads_results` to read
346
346
  selected `outcomes`, `checks`, `diagnostics` or other sections without execution.
347
347
  Pages default to 10 rows, allow at most 20 and stay within 8 KiB; follow
348
348
  `nextCursor` with identical selection/status. Truncated records provide
349
- `recordIndex` for exact `offset`/`chars` ranges. Only the latest verification and
350
- mutation snapshots are retained, independently, at most 8 MiB each. Replaced IDs
351
- fail explicitly. Validation still uses complete internal outcomes.
349
+ `recordIndex` for exact `offset`/`chars` ranges. Immutable run snapshots remain readable across other executions and reconnects,
350
+ within configurable retention, at most 8 MiB each. Expired IDs fail explicitly. Validation still uses complete internal outcomes.
352
351
 
353
352
  Use `ads_investigate({unit,check,runId})` with an outcome's exact IDs for its compact
354
353
  summary (4 KiB maximum); details, requests, browser errors and artifact metadata are separate
@@ -358,8 +357,8 @@ the recorded run ID. Saved outcomes describe completion time; compare current
358
357
  input and observed preview revisions, failing step/source, startup viewport,
359
358
  failed startup requests and available project-recorded artifacts keep diagnosis
360
359
  separate from an inferred component defect. No artifact is invented or test
361
- retried. Each check retains one latest bundle; old artifact resource access is
362
- superseded. Candidate bundles remain distinct from passing live-source evidence.
360
+ retried. Latest-check listings are indexes; exact run IDs retain their historical bundles
361
+ and artifacts until collection. Candidate bundles remain distinct from passing live-source evidence.
363
362
  Read the portable [evidence reference](evidence.md)
364
363
  for category meanings, collection limits and artifact policy.
365
364
 
@@ -45,10 +45,13 @@ characters); follow `nextOffset`. Do not combine ranges with a cursor/status fil
45
45
  Read only the relevant log range. Reading pages or ranges never executes checks.
46
46
 
47
47
  `ads://project/results` lists the latest IDs. `ads://results/<resultId>` reads a
48
- summary; matching query parameters read pages/ranges. Only the latest verification
49
- and latest mutation snapshots are retained, independently, up to 8 MiB each.
50
- A superseded ID fails explicitly. An oversized report retains only its summary
51
- with a warning; disk failure retains details in server memory until shutdown.
48
+ summary; matching query parameters read pages/ranges. Immutable snapshots remain
49
+ readable across subsequent runs and reconnects, within `mcp.resultRetention`.
50
+ Defaults are 50 runs, seven days and 256 MiB including owned browser evidence;
51
+ individual snapshots remain limited to 8 MiB. `ADS_RESULT_EXPIRED` identifies a
52
+ recently collected ID; older/unknown IDs are unavailable. An oversized report
53
+ retains only its summary with a warning; disk failure retains latest details in
54
+ server memory until shutdown.
52
55
  Neither changes actual acceptance or applied state. These are logical JSON byte
53
56
  budgets, not token estimates; compatibility text can duplicate structured JSON.
54
57
  Saved outcomes describe completion-time evidence, not current source freshness;
@@ -68,7 +71,7 @@ Take an outcome's exact owner/check/run IDs from `ads_results`, then:
68
71
  ```
69
72
 
70
73
  Send this to `ads_investigate`. It reads a summary within 4096 JSON bytes, without
71
- running code. The run ID rejects evidence superseded by another execution.
74
+ running code. The exact run ID selects retained historical evidence from that execution.
72
75
  `section: "details"`, `"requests"`, `"browserErrors"` or `"artifacts"` reads separate pages
73
76
  (default 10/max 20 rows, at most 8192 JSON bytes); artifacts themselves require
74
77
  explicit resource reads. Truncated investigation records also support
@@ -93,9 +96,10 @@ artifacts exist; ADS does not turn on expensive recording or rerun a failed case
93
96
  Protocol runners may provide structured failure/step/location/artifact fields;
94
97
  older reports remain valid and their unclassified errors stay explicit.
95
98
 
96
- Only the latest bundle per registered check is exposed, including dry runs.
97
- Another verification replaces it and removes old artifacts from resource access;
98
- old runner output directories follow project cleanup policy. Artifact resources
99
+ Listings show the latest bundle per registered check, including dry runs.
100
+ An exact `runId` reads the retained historical bundle and artifacts. Collection
101
+ expires a result and its owned evidence together; another verification alone does
102
+ not revoke earlier evidence. Artifact resources
99
103
  are restricted to registered ordinary files under that run's output directory,
100
104
  bounded to 20 MiB each and checked against their recorded digest on read.
101
105
  Metadata is bounded to 2 MiB. Removed registrations are pruned on verification.
@@ -101,3 +101,36 @@ before browser workers open their pages. They share one candidate graph and
101
101
  keep independent App state. This avoids compiling a growing graph per page.
102
102
  A graph revision changing during startup keeps the preview pending until a
103
103
  coherent current build mounts; it does not establish passing case evidence.
104
+
105
+ ## Shared-server execution
106
+
107
+ ADS serializes validation, acceptance, verification and guarded source application
108
+ across all MCP clients served by one process. This includes changed scope and
109
+ unit checks. A conflicting call returns `ADS_VALIDATION_LOCKED` immediately with
110
+ its holder, run ID, operation, selection, progress and approximate ETA (null when
111
+ unknown). Read `ads_status.execution`, keep previewing/reading, and retry after the
112
+ lease clears. Do not repeatedly retry, start another ADS process to bypass it,
113
+ or interrupt another client's work. There is no wait mode or parallel-unit lane.
114
+
115
+ Coordinate direct editor changes before starting a full audit. Relevant external
116
+ source edits stop a run with `ADS_SOURCE_CHANGED_DURING_RUN`; inspect its diagnostic
117
+ files and attribution, then retry against current source. Direct edits have unknown
118
+ authorship. Generated output is excluded. A stopped run never advances a baseline.
119
+ Ordinary preview viewing and draft editing remain available; accepted-source writes
120
+ are refused while checking, including writes from the lease holder.
121
+
122
+ The run ID is its eventual result ID and survives response loss or reconnection.
123
+ Cancellation/disconnection holds the lease through runner cleanup and saves the
124
+ terminal outcome. After a restart, abandoned runs become interrupted; they are
125
+ never resumed automatically. Completed evidence and successful baselines persist.
126
+ Use `ads_results` to inspect retained completion-time evidence, and `ads_behaviors`
127
+ for whether registered results still match current source.
128
+
129
+ Retention defaults to 50 completed runs, seven days and 256 MiB of owned result
130
+ and browser evidence. Configure `mcp.resultRetention` (`maxRuns`, `maxAgeDays`,
131
+ `maxBytesMb`) for the project. Active work and the newly returned result are
132
+ protected, so status may temporarily report `overBudget`. Cleanup runs at startup
133
+ and after execution, independently of client disconnects. Expired IDs return
134
+ `ADS_RESULT_EXPIRED` (recent expiry tombstones are bounded); copy evidence needed
135
+ for long-term release/audit records before it expires. Separate ADS processes are
136
+ not coordinated by this process-local lease.
@@ -1,3 +1,4 @@
1
+ import { finishExecutionGuard, trackExecutionChild, trackExecutionWorkspace } from "./mcp/execution-context.mjs";
1
2
  import { spawn } from "node:child_process";
2
3
  import { mkdtempSync, readFileSync, rmSync, statSync } from "node:fs";
3
4
  import { tmpdir } from "node:os";
@@ -10,6 +11,7 @@ const fail = (rule, message, file, failure) => Object.assign(new Error(message),
10
11
 
11
12
  export async function checkCandidate(root, signal, trackingRoot = root) {
12
13
  const directory = mkdtempSync(path.join(tmpdir(), "ads-architecture-"));
14
+ trackExecutionWorkspace(directory);
13
15
  const report = path.join(directory, "report.json");
14
16
  try {
15
17
  await checkCommand(process.execPath, [fileURLToPath(new URL("./check-runner.mjs", import.meta.url)), root, report, trackingRoot], root, signal, undefined, {category:"architecture",phase:"ads-check"});
@@ -33,6 +35,7 @@ export function checkCommand(command, args, cwd, signal, input, gate = {category
33
35
  stop.on("error", () => child.kill("SIGKILL"));
34
36
  } else { try { process.kill(-child.pid, "SIGKILL"); } catch (error) { if (error.code !== "ESRCH") failure ??= error; } }
35
37
  }
38
+ trackExecutionChild(child);
36
39
  if (child.pid) {
37
40
  guard = spawn(process.execPath, [fileURLToPath(new URL("./mcp/preview-owner-guard.mjs", import.meta.url)), String(child.pid), "--tree"], {stdio:["pipe","ignore","ignore"],windowsHide:true});
38
41
  guard.stdin.on("error",()=>{});
@@ -45,9 +48,10 @@ export function checkCommand(command, args, cwd, signal, input, gate = {category
45
48
  for (const stream of [child.stdout, child.stderr]) stream.on("data", chunk => { output = (output + chunk.toString()).slice(-12000); });
46
49
  child.once("error", error => { failure = error; });
47
50
  child.once("exit", kill); // Also clean up descendants of a finished launcher.
48
- child.once("close", code => {
49
- done = true; guard?.stdin.end("cleanup\n");
51
+ child.once("close", async code => {
52
+ done = true;
50
53
  clearTimeout(timer); signal?.removeEventListener("abort", abort);
54
+ try{await finishExecutionGuard(guard);}catch(error){failure??=error;}
51
55
  const detail={command:path.basename(command),args,timeoutMs,elapsedMs:Date.now()-startedAt,exitCode:code};
52
56
  if (failure || code !== 0) {
53
57
  const error=failure??fail("mutation-check", `${path.basename(command)} ${args.join(" ")} failed (${code}).\n${output}`);
@@ -1,3 +1,4 @@
1
+ import { executionContext } from "./mcp/execution-context.mjs";
1
2
  import { createHash, randomUUID } from "node:crypto";
2
3
  import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
4
  import path from "node:path";
@@ -74,6 +75,7 @@ export function createValidationController(directory, { previewWork } = {}) {
74
75
  }
75
76
  if (fallback) scope = "all";
76
77
  }
78
+ onProgress?.({stage:"selection",scope,requestedScope,units,elapsedMs:Date.now()-startedAt});
77
79
  stage("architecture");
78
80
  const core = await checkCandidate(root, signal);
79
81
  diagnostics.push(...core.diagnostics); advisories.push(...(core.advisories ?? []));
@@ -83,6 +85,7 @@ export function createValidationController(directory, { previewWork } = {}) {
83
85
  for (const launch of scripts) await command(`project:${launch.args.at(-1)}`,launch,options);
84
86
  const behaviors = inspectBehaviors(options);
85
87
  units = options.config[policy].behaviorChecks ? (scope === "all" ? behaviors.contracts.map(contract=>contract.unit) : affectedBehaviorUnits(options,changed)) : [];
88
+ onProgress?.({stage:"selection",scope,requestedScope,units,elapsedMs:Date.now()-startedAt});
86
89
  const requirePreviews=policy === "validation" || units.length>0;
87
90
  if (requirePreviews && options.config.mcp.previewManifest && options.config.mcp.previewWatch) {
88
91
  stage("preview-build");
@@ -128,9 +131,12 @@ export function createValidationController(directory, { previewWork } = {}) {
128
131
  let ok = current && !signal.aborted && !diagnostics.length && checks.every(check=>check.skipped || check.passed);
129
132
  if (ok && scope === "all") {
130
133
  const file = outputFile(root,`${policy}-baseline.json`), temporary = `${file}.${randomUUID()}.tmp`;
131
- try { writeFileSync(temporary,JSON.stringify({schemaVersion:1,root,toolRevision,...inputs})); renameSync(temporary,file); }
134
+ const publish=()=>{
135
+ try { writeFileSync(temporary,JSON.stringify({schemaVersion:1,root,toolRevision,...inputs})); renameSync(temporary,file); }
136
+ finally { rmSync(temporary,{force:true}); }
137
+ };
138
+ try { const execution=executionContext.getStore();if(execution)execution.commits.push({file,value:{schemaVersion:1,root,toolRevision,...inputs}});else publish(); }
132
139
  catch (error) { ok=false;diagnostics.push({rule:"validation-baseline",message:error.message}); }
133
- finally { rmSync(temporary,{force:true}); }
134
140
  }
135
141
  return {ok,policy,scope,requestedScope,...(fallback?{fallback}:{}),sourceRevision:inputs?.revision,current,elapsedMs:Date.now()-startedAt,selection:{files:changed,units},checks,diagnostics,advisories,results,
136
142
  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"])};
@@ -1,3 +1,4 @@
1
+ import { finishExecutionGuard, trackExecutionArtifact, trackExecutionChild } from "./mcp/execution-context.mjs";
1
2
  import { createHash, randomUUID } from "node:crypto";
2
3
  import { spawn } from "node:child_process";
3
4
  import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -184,8 +185,9 @@ export function executeDevelopmentCommand(profile, args, root, env, signal) {
184
185
  };
185
186
  child = spawn(developmentExecutable(profile.command), args, { cwd: root, detached: process.platform !== "win32", shell: false, stdio: ["ignore", "pipe", "pipe"], windowsHide: true,
186
187
  env: { ...process.env, ...env, PATH: [path.join(root, "node_modules/.bin"), path.dirname(process.execPath), process.env.PATH ?? ""].join(path.delimiter) } });
188
+ trackExecutionChild(child);
187
189
  if (child.pid) {
188
- guard = spawn(process.execPath, [fileURLToPath(new URL("./mcp/preview-owner-guard.mjs", import.meta.url)), String(child.pid)], { detached: process.platform !== "win32", stdio: ["pipe", "ignore", "ignore"], windowsHide: true });
190
+ guard = spawn(process.execPath, [fileURLToPath(new URL("./mcp/preview-owner-guard.mjs", import.meta.url)), String(child.pid), "--tree"], { detached: process.platform !== "win32", stdio: ["pipe", "ignore", "ignore"], windowsHide: true });
189
191
  guard.stdin.on("error", () => {});
190
192
  guard.once("error", error => { failure = error; kill(); });
191
193
  guard.once("exit", () => { if (!done) { failure ??= new Error("Verification ownership guard exited unexpectedly."); kill(); } });
@@ -196,8 +198,9 @@ export function executeDevelopmentCommand(profile, args, root, env, signal) {
196
198
  for (const stream of [child.stdout, child.stderr]) stream.on("data", chunk => { output = (output + chunk.toString()).slice(-12000); });
197
199
  child.once("error", error => { failure = error; });
198
200
  child.once("exit", kill);
199
- child.once("close", code => {
200
- done = true; kill(); guard?.stdin.end("disarm\n"); clearTimeout(timeout); signal.removeEventListener("abort", abort);
201
+ child.once("close", async code => {
202
+ done = true; kill(); clearTimeout(timeout); signal.removeEventListener("abort", abort);
203
+ try{await finishExecutionGuard(guard);}catch(error){failure??=error;}
201
204
  const elapsedMs = Date.now() - startedAt;
202
205
  if (failure) reject(Object.assign(failure, { output, elapsedMs }));
203
206
  else resolve({ code, output, elapsedMs });
@@ -253,6 +256,7 @@ export function createVerificationController(root, { reportRoot = root, onProgre
253
256
  const group = selection.filter(check => check.profile === profileName);
254
257
  const directory = path.join(reportRoot, ".ds/verification", randomUUID());
255
258
  mkdirSync(directory, { recursive: true });
259
+ trackExecutionArtifact(reportRoot,directory);
256
260
  if (realpathSync(directory) !== directory) throw new Error("Verification output cannot resolve through a symlink.");
257
261
  const runId = randomUUID(), report = path.join(directory, "report.json"), request = path.join(directory, "request.json");
258
262
  const scenarios = {};
@@ -729,6 +729,17 @@ and behavior contracts. Full audits establish a content baseline. Changed audits
729
729
  select affected behavior owners from that baseline; broad or unclassified changes
730
730
  expand to full. Opaque project commands retain their declared scope.
731
731
 
732
+ MCP executions share a process-wide exclusive lease spanning checks, guarded
733
+ mutations, child cleanup and durable result publication. Conflicting requests get
734
+ a structured `ADS_VALIDATION_LOCKED` response; Explorer and preview serving keep
735
+ their independent lane. Relevant source edits abort working-tree runs early,
736
+ recording changed paths and known/unknown attribution. Source-change interruption
737
+ cannot publish a successful baseline. A small run journal supports crash recovery;
738
+ immutable run results and exact-run investigations survive reconnects and subsequent
739
+ runs under bounded age/count/disk retention. Collection protects active work and
740
+ expires owned evidence with its result. See [execution coordination](MCP.md#shared-process-execution-coordination)
741
+ and the [implementation plan](plans/execution-coordination.md).
742
+
732
743
  Only a successful full audit against unchanged source advances the baseline.
733
744
  This works without Git history and does not cache individual test results. Skills
734
745
  guide agents toward affected checks during editing and full audits after ownership
@@ -817,9 +828,9 @@ bounded acceptance, at most three failure previews and a result ID in at most
817
828
  sections without rerunning checks. Pages have at most 20 rows and 8 KiB of JSON;
818
829
  truncated records support bounded text ranges. Discovery and investigation
819
830
  sections use the same paging budget. Cursors bind the query and result/revision;
820
- superseded IDs fail explicitly instead of silently returning another run.
821
- Only the latest validation, verification and mutation snapshots are retained, each at most
822
- 8 MiB under `.ds/tool-results/`. Oversized reports retain a summary with an
831
+ expired IDs fail explicitly instead of silently returning another run.
832
+ Immutable run snapshots persist under `.ds/tool-results/`, each at most 8 MiB,
833
+ with configurable age/count/disk retention and associated evidence collection. Oversized reports retain a summary with an
823
834
  explicit unavailable-details warning. Storage/notification failure cannot change
824
835
  an accepted edit's applied state. These are payload byte budgets, not tokenizer
825
836
  estimates; MCP compatibility text may duplicate structured JSON on the wire.
package/docs/CHANGELOG.md CHANGED
@@ -1,34 +1,47 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.40
3
+ ## 0.3.41
4
4
 
5
5
  <!-- ads-local-tests:start -->
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).
6
+ Local verification: **618/618 passed** with `ADS_TEST_BUN=1 npm test`.
7
+ Tested commit: `05760c51a94bd84b2d298837b9dbba09edb875f2`; Node v24.13.0, Bun 1.4.1.
8
+ Completed 2026-10-26T13:40:29.074Z (793 seconds).
9
9
 
10
10
  <!-- ads-local-test-proof
11
11
  {
12
12
  "schema": 1,
13
- "version": "0.3.40",
14
- "commit": "eb5d277c1f5198d54318ca0a3fa836e1eb7ee2a3",
15
- "sourceSha256": "597fe2f9983e64fac21e3d4584e5bae7068a24fde7f00bde9a57c89ea41fa597",
13
+ "version": "0.3.41",
14
+ "commit": "05760c51a94bd84b2d298837b9dbba09edb875f2",
15
+ "sourceSha256": "d890df59a6cdcd1b7e3082a7801fc4dcf2e37e417d2194c0142d4ea778851ecc",
16
16
  "command": "ADS_TEST_BUN=1 npm test",
17
17
  "result": "pass",
18
- "tests": 602,
19
- "pass": 602,
18
+ "tests": 618,
19
+ "pass": 618,
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-24T18:24:27.888Z",
26
- "durationMs": 829113,
27
- "logSha256": "810783acb0791a199a1e773d8da6779ed537f8a632971b851da40446ebe6fd97"
25
+ "completedAt": "2026-10-26T13:40:29.074Z",
26
+ "durationMs": 792714,
27
+ "logSha256": "cdb07ccccde9de440b321252e99252bc69c8cedd64b63d52eb36670d8d19b912"
28
28
  }
29
29
  -->
30
30
  <!-- ads-local-tests:end -->
31
31
 
32
+ - Coordinate validation, verification, draft acceptance and guarded edits across all
33
+ clients of one ADS process. Return structured lock/holder/progress responses;
34
+ keep Explorer and preview serving available.
35
+ - Abort working-tree checks early on relevant source edits and report changed
36
+ paths and observed attribution without advancing acceptance baselines.
37
+ - Retain immutable run results and exact-run investigation evidence across other
38
+ executions, reconnects and restarts. Journal interrupted runs and finish runner
39
+ ownership cleanup before releasing the execution lease.
40
+ - Add configurable age/count/disk retention with protected active runs and explicit
41
+ expiry errors. Update portable skills and shared-server workflow guidance.
42
+
43
+ ## 0.3.40
44
+
32
45
  - Fix immutable preview resource collisions when a compiler keeps dependency
33
46
  filenames stable. Resource identities include transitive dependencies, with
34
47
  cycle-aware hashing; unrelated preview branches retain their cached identities.
package/docs/MCP.md CHANGED
@@ -495,16 +495,16 @@ the latest IDs. Status embeds summaries, not complete runner reports. Saved
495
495
  outcomes are completion-time evidence; compare revisions with `ads_behaviors`
496
496
  before claiming current source passed.
497
497
 
498
- Only the latest verification snapshot and latest mutation snapshot are retained,
499
- independently, each up to 8 MiB in `.ds/tool-results/`. Replacing a snapshot makes
500
- its old ID unavailable; do not mix pages across runs. An oversized report retains
501
- only its summary and an explicit unavailable-details warning. A failed disk write
502
- keeps details in server memory until shutdown. Neither condition changes guard
503
- acceptance or whether source was applied. These are logical payload byte limits;
504
- compatibility text can duplicate structured JSON in the MCP response.
498
+ Execution snapshots are immutable by run/result ID. They survive other clients'
499
+ runs, reconnects and ADS restarts within `mcp.resultRetention`: by default 50 runs,
500
+ seven days and 256 MiB of result/evidence data. Each snapshot is limited to 8 MiB;
501
+ oversized reports retain a summary with an explicit warning. Storage failure keeps
502
+ latest details in memory with a warning. `ADS_RESULT_EXPIRED` identifies recently
503
+ collected results; the expiry tombstone index is bounded to 4096 IDs. Older unknown
504
+ IDs are unavailable. These limits do not change actual acceptance/applied state.
505
505
 
506
506
  For diagnosis, take one outcome's exact `unit`, `check` and `runId` and call
507
- `ads_investigate`. The run ID rejects superseded evidence. Without a check, it
507
+ `ads_investigate`. The exact run ID selects retained evidence from that execution. Without a check, it
508
508
  lists available investigations with paging. An exact check returns a summary
509
509
  within 4096 JSON bytes; `section: "details"`, `"requests"`, `"browserErrors"` or `"artifacts"`
510
510
  returns detail pages with the same 10/20-row and 8192-byte limits. Truncated records support
@@ -515,7 +515,7 @@ artifacts. Exact input/observed preview revisions, source/failing step, startup
515
515
  viewport and failed requests separate evidence from a suspected cause.
516
516
  The summary's `details.failure.category` distinguishes architecture, build,
517
517
  transport, runner and assertion boundaries; `acceptance` names established and unverified scope.
518
- Only the latest bundle per check remains resource-accessible. Read the portable
518
+ Latest-check listings are convenience indexes; exact retained run IDs and their registered artifacts remain resource-accessible. Read the portable
519
519
  [evidence guide](../skills/ads-designer/references/evidence.md) for collection
520
520
  limits and project-controlled trace/screenshot recording.
521
521
 
@@ -1443,3 +1443,48 @@ so later creation invalidates evidence. Dependencies, metadata and generated out
1443
1443
  are not source inputs. The setting defaults to an empty list and accepts up to 200
1444
1444
  unique canonical paths below the project root. Declare data read dynamically by
1445
1445
  selected commands; ADS cannot infer arbitrary filesystem access inside a command.
1446
+
1447
+ ## Shared-process execution coordination
1448
+
1449
+ One ADS process has an exclusive execution lease shared by its HTTP and stdio
1450
+ clients. `ads_validate` (both policies/scopes), `ads_verify`, `ads_accept`,
1451
+ `ads_apply_patch` and `ads_apply_transaction` acquire it before work and retain it
1452
+ through child/ownership-guard cleanup and result publication. Changed scope still
1453
+ runs full project scripts. Parallel units and `wait: true` are not supported.
1454
+
1455
+ A conflicting call is a tool error with `code: "ADS_VALIDATION_LOCKED"` and `lock`:
1456
+ run ID, instance ID, operation, owner/client label where known, policy, requested
1457
+ and effective scope, units, start time, progress and nullable estimated remaining
1458
+ milliseconds. Client labels (including optional request `_meta["ads/clientId"]`)
1459
+ are advisory metadata, not authentication. Stateless HTTP requests do not define
1460
+ persistent client sessions. The run ID is the result ID; any connected project
1461
+ client can read retained evidence by ID after reconnecting.
1462
+
1463
+ `ads_status.execution` exposes the lock, server instance and retention state.
1464
+ Status resource subscriptions receive acquisition, progress, stopping and release
1465
+ updates. Read-only discovery, Explorer and preview delivery stay available.
1466
+ Accepted-source writes from every client, including the holder, contend for the
1467
+ same lease. Draft creation/editing affects separate proposals and remains usable.
1468
+
1469
+ Relevant source changes during working-tree validation/verification initiate early
1470
+ shutdown with `ADS_SOURCE_CHANGED_DURING_RUN`. Results name changed paths,
1471
+ added/modified/deleted classification and observed attribution; external editors
1472
+ have unknown authorship. While stopping, contention responses include these details.
1473
+ Generated outputs are excluded. Completed observations remain inspectable, and a
1474
+ stopped run cannot establish acceptance or publish a full-policy baseline. Guarded
1475
+ candidate edits retain their existing source-conflict checks before publication.
1476
+
1477
+ The durable journal under `.ds/execution-runs/` records work before it starts.
1478
+ Cancellation and request disconnect initiate cleanup and save a terminal result
1479
+ even when its response cannot be delivered. On restart, orphaned recorded process
1480
+ identities are checked before cleanup; PID reuse is not authority. Active work in
1481
+ another live process is not recovered. Unfinished abandoned runs become interrupted
1482
+ and never auto-resume. Existing EOF ownership guards also terminate child trees.
1483
+
1484
+ Collection runs at startup and after executions. Results, retained investigations
1485
+ and owned verification folders expire together; baselines are independent. Active
1486
+ runs and the just-returned result are protected (temporary over-budget state is
1487
+ reported). Abandoned known mutation workspaces are removed during recovery;
1488
+ unreferenced old verification folders are removed after the configured age.
1489
+ No cleanup is triggered solely by a client disconnect. Independent ADS processes
1490
+ on the same project are outside this process-local coordination guarantee.
@@ -0,0 +1,57 @@
1
+ # Execution coordination and retained evidence
2
+
3
+ Implement in ADS 0.3.41. One running ADS process coordinates all its MCP
4
+ connections. Independent ADS processes on the same project are outside this
5
+ lease's scope; startup must never recover or delete another live process's work.
6
+
7
+ ## Agreed behavior
8
+
9
+ - One exclusive execution lease covers validation (both policies and scopes),
10
+ verification, guarded patches/transactions and draft acceptance. Acquisition is
11
+ immediate, before checks, and release follows process cleanup and durable result
12
+ publication. A caller cannot mutate accepted source while its own lease is held.
13
+ - Reject contention with `ADS_VALIDATION_LOCKED`, holder/run ID, operation, client
14
+ label where available, policy, requested/effective scope, units, start time,
15
+ progress and nullable approximate ETA. Read-only discovery, Explorer and preview
16
+ serving remain usable. Neither waiting nor parallel unit runs are in this version.
17
+ - Scope changed retains full project scripts and may expand to all. Disjoint owner
18
+ names do not establish independent dependencies or outputs.
19
+ - Journal the run before starting work. The run ID is also its execution result ID.
20
+ HTTP requests can be stateless: ownership is a run identity, with advisory client
21
+ metadata, not a socket lifetime or authorization inferred from a client name.
22
+ - Cancellation/disconnection initiates cleanup, holds the lease until cleanup is
23
+ finished and records the terminal outcome independently of response delivery.
24
+ No run is automatically resumed or replayed.
25
+ - Watch relevant inputs during validation/verification. A detected source change
26
+ stops work with `ADS_SOURCE_CHANGED_DURING_RUN`, added/modified/deleted paths and
27
+ observed attribution. Direct editor/shell changes have unknown authorship;
28
+ never infer an author. Generated output changes do not stop runs. Preserve
29
+ observations already reported and never advance baselines on an interrupted run.
30
+ - Persist completed results by immutable run ID and retain exact-run investigations
31
+ and their artifacts. Latest indexes are convenience views, not retention limits.
32
+ Reconnection and another client's completion do not invalidate a retained ID.
33
+ - A new server instance recovers abandoned journal entries as interrupted after
34
+ checking/cleaning recorded owned process identities. Existing ownership guards
35
+ also clean children on parent death. Do not signal a reused PID. Finished results
36
+ and successful baselines survive; current source freshness is checked separately.
37
+ - Garbage collection runs at startup and after executions, never on client
38
+ disconnect. Configurable age/count/disk limits bound completed results and owned
39
+ evidence together. Protect active work and the newly returned result. Baselines
40
+ are independent. Remove abandoned temporaries only when unowned. An expired ID
41
+ reports `ADS_RESULT_EXPIRED`; unknown IDs are unavailable. Limits are soft only
42
+ for protected active/newly completed work and the over-budget state is visible.
43
+ - Status and supported resource subscriptions expose lease acquisition, progress,
44
+ stopping and release. ETA is null without a defensible estimate.
45
+
46
+ ## Proof and delivery
47
+
48
+ Test two real MCP clients for refusal without spawning/replacing work; own
49
+ cancellation and disconnect; completion racing disconnect; persisted run lookup
50
+ on reconnect; source-change paths/unknown attribution and unchanged baselines;
51
+ restart recovery and reused/live-process protection; bounded collection and
52
+ historical investigation lookup; preview responsiveness while busy. Test known
53
+ MCP write attribution separately from external changes.
54
+
55
+ Update configuration, architecture, MCP guides and portable skill references.
56
+ Sync skill copies, run targeted regressions then the complete local release suite,
57
+ commit its proof, publish 0.3.41 and update local consumers to the published version.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.3.40",
3
+ "version": "0.3.41",
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": {