@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
@@ -1,3 +1,6 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { executionContext } from "./execution-context.mjs";
3
+ import { createExecutionCoordinator } from "./execution-coordinator.mjs";
1
4
  import { existsSync, readFileSync, statSync, watch } from "node:fs";
2
5
  import path from "node:path";
3
6
  import { Server, ProtocolError, INVALID_PARAMS, ResourceNotFoundError } from "@modelcontextprotocol/server";
@@ -81,7 +84,11 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
81
84
  startPreview: workspace => startAdsMcp(workspace, { stdio: false, mutations: false, previewWork: cache.previewWork }) });
82
85
  const verification = cache.verification ??= createVerificationController(root, { previewWork: cache.previewWork });
83
86
  const validation = cache.validation ??= createValidationController(root, { previewWork: cache.previewWork });
84
- const executionResults = cache.executionResults ??= createExecutionResults(root);
87
+ const executionResults = cache.executionResults ??= createExecutionResults(root,{retention:()=>{try{cache.resultRetention=loadConfig(root).config.mcp.resultRetention;}catch{/* Keep the last valid policy during config edits. */}return cache.resultRetention;}});
88
+ const executionObservers=cache.executionObservers??=new Set();
89
+ const coordinator=cache.coordinator??=createExecutionCoordinator(root,{results:executionResults,onChange:()=>{for(const observer of executionObservers)observer();}});
90
+ const connectionId=randomUUID();
91
+ void coordinator.ready().catch(error=>process.stderr.write(`ads mcp: execution recovery: ${error.message}\n`));
85
92
  const reports = cache.reports ??= createReportStore(root, { context: reportContext, resolveEvidence: reportEvidence });
86
93
  let options = loadConfig(root);
87
94
  const signature = `${root}:${JSON.stringify(options.config)}`;
@@ -296,6 +303,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
296
303
  build: summarizeBuild(builds()),
297
304
  previews: previews(), skills: skills.skills.map(({ uri, frontmatter }) => ({ uri, name: frontmatter.name, description: frontmatter.description })),
298
305
  scenarios: { count: registry.scenarios.length, diagnostics: registry.diagnostics, resourceUri: `${PROJECT_URI}/scenarios`, tool: "ads_show_scenario" },
306
+ execution: coordinator.status(),
299
307
  validation: { ...validation.status(), tool: "ads_validate", lastResult: executionResults.latest("validation") },
300
308
  behaviors: { resourceUri: BEHAVIOR_URI, discoveryTool: "ads_behaviors", verificationTool: "ads_verify", investigationTool: "ads_investigate", investigationResourceUri: INVESTIGATIONS_URI, ...behaviorState, progress: compactProgress(behaviorState.progress), lastResult: executionResults.latest("verification"), resultsTool: "ads_results", resultsResourceUri: RESULTS_URI },
301
309
  captures: { resourceUri: CAPTURES_URI, tool: "ads_capture", clearTool: "ads_capture_clear", ...captures.status() },
@@ -391,12 +399,12 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
391
399
  }
392
400
 
393
401
  async function finishExecution(kind, result) {
402
+ if(executionContext.getStore()?.record.instanceId===coordinator.status().instanceId)return result;
394
403
  const summary = executionResults.save(kind, result);
395
404
  try { await refresh(); } catch (error) { process.stderr.write(`ads mcp: result saved; notification failed: ${error.message}\n`); }
396
405
  return { ...json(summary), ...(!result.ok ? { isError: true } : {}) };
397
406
  }
398
407
  async function applyEdits(args,signal,progress) {
399
- if (validation.status().busy) throw new Error("Wait for the active validation run before editing source.");
400
408
  const result = await edits.apply(args,signal,progress);
401
409
  if (result.screenshots) await refresh();
402
410
  if (result.applied) {
@@ -425,7 +433,6 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
425
433
  { name:"ads_update_draft", description:"Update marked draft source or register new/deleted canonical target paths. Pass the current revision from ads_drafts. Source is UTF-8 unless encoding:base64; content:null proposes deletion. refresh:true rebases onto current accepted source using stored baselines; non-overlapping edits merge and overlapping edits leave the draft unchanged with diagnostics. Use changes with refresh only for explicit resolved contents of existing draft files; refresh separately from dependency changes. Optional dependencies replaces the draft dependency list. Normal local file edits need no iteration tool. Accepted source remains unchanged; ownership and all required checks run at acceptance.",schema:z.object({id:draftIdSchema,revision:draftRevisionSchema,refresh:z.boolean().default(false),dependencies:z.array(draftIdSchema).max(8).optional(),changes:z.array(z.object({unit:z.string().max(256),path:z.string().min(1).max(500),content:z.string().max(256*1024).nullable(),encoding:z.enum(["utf8","base64"]).optional()}).strict()).max(32).default([])}).strict(),_meta:{ui:{visibility:["model"]}},annotations:{...annotations,readOnlyHint:false,idempotentHint:false},call:async args=>{const result=drafts.update(args);if(observeChanges)await refresh();return json(result);} },
426
434
  { name:"ads_drop_draft",description:"Delete an exact tracked draft and its generated preview. This is Drop, not a separate refusal workflow. Accepted source is unchanged. Dependents report a missing dependency until corrected.",schema:z.object({id:draftIdSchema,revision:draftRevisionSchema}).strict(),_meta:{ui:{visibility:["model"]}},annotations:{...annotations,readOnlyHint:false,destructiveHint:true,idempotentHint:false},call:async args=>{const result=await drafts.drop(args);if(observeChanges)await refresh();return json(result);} },
427
435
  { name:"ads_accept",title:"Accept a reviewed draft",description:"Auto-mode acceptance: validate and apply the exact rendered/reviewed draft revision in one operation. Accept dependency drafts first; dependent drafts automatically switch to their final @ds implementations. Mandatory ADS guards and acceptance.checks run once on the candidate; affected registered tests gate acceptance when acceptance.behaviorChecks is true. Draft/source changes invalidate acceptance. On failure retain the draft and inspect ads_results; on success apply normal source, remove the draft and publish an event. No additional human approval or manual Apply step.",schema:z.object({id:draftIdSchema,revision:draftRevisionSchema}).strict(),_meta:{ui:{visibility:["model"]}},annotations:{...annotations,readOnlyHint:false,destructiveHint:true,idempotentHint:false},call:async(args,signal,progress)=>{
428
- if(validation.status().busy||verification.status().running)throw new Error("Wait for validation/verification before acceptance.");
429
436
  const result=await drafts.accept(args,signal,progress);
430
437
  if(result.applied){await previewWatch?.invalidate?.();await refresh(true);}else await refresh();
431
438
  return finishExecution("mutation",result);
@@ -505,16 +512,14 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
505
512
  return json({ widget: { resourceUri: TOKENS_APP_URI }, category: null, tokenCount: inspectTokens(root).tokens.length, dataUri: `${PROJECT_URI}/tokens`, showcaseUrl: getShowcaseUrl() });
506
513
  } },
507
514
  { name: "ads_behaviors", description: "Discover behavior owners, then page an exact unit's checks, guarantees, subjects, demonstrations or profiles. Summary listings never embed runner logs. Default 10/max 20 entries and 8 KiB JSON per page; continue with nextCursor and identical filters. Cursors expire when discovery/evidence changes. Read sourceFile with ads_read_file for a complete contract. Metadata and reachable calls do not prove execution; use ads_verify for registered checks.", schema: z.object({ query: z.string().max(200).optional(), unit: z.string().min(1).max(256).optional(), api: z.string().max(200).optional(), section: z.enum(behaviorSections).optional(), ...paged }).strict(), call: args => json(behaviorPage(options,args)) },
508
- { name: "ads_results", title: "Read execution outcomes", description: "Read saved ads_validate/ads_verify/ads_apply_patch/ads_apply_transaction outcomes without rerunning anything. Pass the returned resultId; select outcomes, checks, diagnostics, advisories, warnings, changes, captures, acceptance, investigation or selection. Default 10/max 20 rows, at most 8 KiB JSON per page. Follow nextCursor with identical section/status. Rows marked detailTruncated can be read in full using recordIndex and offset/chars (max 2000); follow nextOffset. Only the latest validation, verification and mutation snapshots are retained; replaced IDs fail explicitly. For one outcome's browser evidence use ads_investigate with its exact unit/check/runId.", schema: z.object({ resultId: z.string().uuid(), section: z.enum(resultSections).optional(), status: z.enum(["all","passed","not_passed"]).optional(), ...paged, ...recordRange }).strict(), call: args => json(executionResults.page(args)) },
515
+ { name: "ads_results", title: "Read execution outcomes", description: "Read saved ads_validate/ads_verify/ads_apply_patch/ads_apply_transaction outcomes without rerunning anything. Pass the returned resultId; select outcomes, checks, diagnostics, advisories, warnings, changes, captures, acceptance, investigation or selection. Default 10/max 20 rows, at most 8 KiB JSON per page. Follow nextCursor with identical section/status. Rows marked detailTruncated can be read in full using recordIndex and offset/chars (max 2000); follow nextOffset. Results are retained by immutable run ID with bounded age/count/disk retention, including after reconnect or other clients finish. Expired IDs fail with ADS_RESULT_EXPIRED. For one outcome's browser evidence use ads_investigate with its exact unit/check/runId.", schema: z.object({ resultId: z.string().uuid(), section: z.enum(resultSections).optional(), status: z.enum(["all","passed","not_passed"]).optional(), ...paged, ...recordRange }).strict(), call: args => json(executionResults.page(args)) },
509
516
  { name:"ads_report_bug",title:"Report a suspected ADS defect",description:"Record an unexpected ADS guard, preview, build, transport or runner behavior after targeted investigation. Provide expected/observed behavior, minimal steps and frequency; keep suspectedCause separate. Evidence optionally selects a returned resultId or exact unit/check/runId. ADS snapshots compact evidence, version, configured framework and revisions. A report is an untriaged agent claim, not proof of an ADS cause. Returns a small receipt with the report ID and local file path; submitted reports cannot be read through MCP. Stored locally under .ds/reports/ with deduplication, no automatic expiry and no upload. Read ads://guides/reporting; ordinary valid guard rejections should be fixed in their owner.",schema:bugReportSchema,annotations:{readOnlyHint:false,destructiveHint:false,idempotentHint:false,openWorldHint:false},call:args=>submitReport("bug",args) },
510
517
  { name:"ads_request_feature",title:"Request an ADS capability",description:"Record a legitimate workflow that needs a missing ADS capability. Provide workflow, capability and impact; proposal is optional. Preserve valid design/API rather than weakening guards or inventing workaround props. Optional evidence references an existing execution/check, not pasted files/logs. ADS attaches compact context and returns a receipt with the report ID and local file path. Intake is submission-only; no report-reading tools or resources. Shared local report store: deduplicated, untriaged, no automatic expiry or upload. Read ads://guides/reporting; use ads_report_bug for suspected broken existing behavior.",schema:featureRequestSchema,annotations:{readOnlyHint:false,destructiveHint:false,idempotentHint:false,openWorldHint:false},call:args=>submitReport("feature",args) },
511
- { name: "ads_investigate", title: "Inspect check evidence", description: "Read a summary for an exact unit/check, or list latest investigations when no check is selected. Pass the outcome's runId to reject superseded evidence. Summary is at most 4 KiB JSON; details, requests, browserErrors and artifacts are separate paged sections (default 10/max 20 entries, 8 KiB). Read truncated rows with recordIndex/offset/chars and the exact runId. Artifact URIs are read separately. Does not rerun checks or infer root cause. Only the latest bundle per check is retained, including candidate runs.", schema: z.object({unit:z.string().min(1).max(256).optional(),check:z.string().min(1).max(100).optional(),runId:z.string().min(1).max(100).optional(),section:z.enum(investigationSections).optional(),...paged,...recordRange}).strict(), call: args => json(investigationPage(root,args)) },
518
+ { name: "ads_investigate", title: "Inspect check evidence", description: "Read a summary for an exact unit/check, or list latest investigations when no check is selected. Pass the outcome's runId to reject superseded evidence. Summary is at most 4 KiB JSON; details, requests, browserErrors and artifacts are separate paged sections (default 10/max 20 entries, 8 KiB). Read truncated rows with recordIndex/offset/chars and the exact runId. Artifact URIs are read separately. Does not rerun checks or infer root cause. Lists latest checks; an exact runId reads retained historical evidence, including candidate runs.", schema: z.object({unit:z.string().min(1).max(256).optional(),check:z.string().min(1).max(100).optional(),runId:z.string().min(1).max(100).optional(),section:z.enum(investigationSections).optional(),...paged,...recordRange}).strict(), call: args => json(investigationPage(root,args)) },
512
519
  { name: "ads_validate", description: "Run mandatory ADS architecture/freshness guards and the selected project policy. policy defaults to validation: its configured scripts, preview freshness and optional registered behavior checks. policy acceptance runs acceptance.checks and acceptance.behaviorChecks without applying source, for direct editing. No script names are inferred. scope changed selects affected registered checks from this policy's own successful full baseline; broad changes expand to all. Project scripts keep full scope. Draft edit/show never triggers policies. Reports skipped stages honestly and a bounded resultId; use ads_results for details. Read ads://guides/validation. Trusted configured commands run; nothing is installed.", schema: z.object({scope:z.enum(["all","changed"]).default("all"),policy:z.enum(["acceptance","validation"]).default("validation")}).strict(), annotations: {readOnlyHint:false,destructiveHint:false,idempotentHint:false,openWorldHint:false}, call: async (args,signal,progress) => {
513
- if (verification.status().running || edits.status().busy) throw new Error("Wait for the active verification or guarded edit before validating.");
514
520
  return finishExecution("validation",await validation.run(args,signal,progress));
515
521
  } },
516
522
  { name: "ads_verify", description: "Run one owner's registered development behavior checks using its configured runner/profile. Executes trusted project commands with bounded output, cancellation and process-tree cleanup; installs nothing. Progress and per-check timings are available through ads_status; a profile timeout bounds the whole run. Browser profiles use an isolated managed showcase/MCP App. React StrictMode requires a project development harness, not a production widget. Missing/skipped cases, stale inputs and process exit alone cannot produce passing evidence. Replies contain counts, acceptance, at most three failure summaries and a resultId (4 KiB JSON maximum). Page outcomes with ads_results; inspect one exact unit/check/runId with ads_investigate. Discover exact unit/check IDs with ads_behaviors first.", schema: z.object({ unit: z.string().min(1).max(256), checks: z.array(z.string().min(1).max(100)).min(1).max(100).optional() }).strict(), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }, call: async (args, signal, progress) => {
517
- if (validation.status().busy) throw new Error("Wait for the active validation run before verifying separately.");
518
523
  const result = await verification.run(args, signal, progress);
519
524
  return finishExecution("verification", {unit:args.unit,...result});
520
525
  } },
@@ -556,10 +561,26 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
556
561
  let progress = 0;
557
562
  const token = context.mcpReq._meta?.progressToken;
558
563
  const notify = token === undefined ? undefined : value => {
559
- void context.mcpReq.notify({ method: "notifications/progress", params: { progressToken: token, progress: ++progress, message: value.message ?? `${value.profile}: ${value.completed}/${value.total} completed; ${(value.active ?? []).slice(0,3).map(item => `${item.unit}#${item.check}`).join(", ") || "no active check reported"}; ${value.elapsedMs} ms elapsed` } }).catch(() => {});
564
+ void context.mcpReq.notify({ method: "notifications/progress", params: { progressToken: token, progress: ++progress, message: value.message ?? (value.stage?`${value.stage}: ${value.elapsedMs??0} ms elapsed`:`${value.profile}: ${value.completed}/${value.total} completed; ${(value.active ?? []).slice(0,3).map(item => `${item.unit}#${item.check}`).join(", ") || "no active check reported"}; ${value.elapsedMs} ms elapsed`) } }).catch(() => {});
560
565
  };
561
- try { return await tool.call(input.data, context.mcpReq.signal, notify); }
562
- catch (error) { return { isError: true, content: [{ type: "text", text: error.message }], structuredContent: {ok:false,message:error.message,failure:failure(error.build?"build":"runner",error.build?"preview-build":"tool-execution",error.build?.code??"ADS_TOOL_ERROR",{certainty:"observed-boundary"}),...(error.build?{build:error.build}:{})} }; }
566
+ try {
567
+ const kinds={ads_validate:"validation",ads_verify:"verification",ads_apply_patch:"mutation",ads_apply_transaction:"mutation",ads_accept:"mutation"};
568
+ const kind=kinds[name];
569
+ if(!kind)return await tool.call(input.data,context.mcpReq.signal,notify);
570
+ const client=server.getClientVersion?.();
571
+ const label=context.mcpReq._meta?.["ads/clientId"];
572
+ const owner={clientId:typeof label==="string"?label.slice(0,100):null,clientName:client?.name?.slice(0,100)??null,connectionId};
573
+ const args=input.data;
574
+ const selection={...(args.policy?{policy:args.policy}:{}),...(args.scope?{requestedScope:args.scope,scope:args.scope}:{}),units:args.units??args.patches?.map(row=>row.unit)??(args.unit?[args.unit]:[]),...(args.id?{draft:args.id}:{}),...(args.checks?{checks:args.checks}:{})};
575
+ const summary=await coordinator.execute({operation:name,kind,owner,selection,watchSource:kind!=="mutation"},context.mcpReq.signal,notify,(signal,progress)=>{
576
+ if(name==="ads_accept")progress({stage:"selection",policy:"acceptance",scope:"changed",units:drafts.inspect(args.id).manifest.units});
577
+ return tool.call(args,signal,progress);
578
+ });
579
+ const {isError,...value}=summary;
580
+ await refresh();
581
+ return {...json(value),...(isError?{isError:true}:{})};
582
+ }
583
+ catch (error) { return { isError: true, content: [{ type: "text", text: error.message }], structuredContent: {ok:false,message:error.message,...(error.code?{code:error.code}:{}),...(error.lock?{lock:error.lock}:{}),failure:failure(error.build?"build":"runner",error.build?"preview-build":"tool-execution",error.build?.code??error.code??"ADS_TOOL_ERROR",{certainty:"observed-boundary"}),...(error.build?{build:error.build}:{})} }; }
563
584
  });
564
585
  server.setRequestHandler("resources/list", ({ params = {} }) => {
565
586
  previewWatch?.start();
@@ -625,6 +646,12 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
625
646
  const draftBuilds = () => new Map(drafts.previewStatuses().map(build => [build.resourceUri, JSON.stringify(build)]));
626
647
  const investigationFingerprint=()=>fileFingerprint([path.join(root,".ds/investigations.json")]);
627
648
  let previousInvestigations, previousResults, observing=false;
649
+ const executionChanged=()=>{
650
+ const uri=`${PROJECT_URI}/status`;
651
+ if(notifications)notifications.resourceUpdated(uri);
652
+ else if(subscribed.has(uri))void server.sendResourceUpdated({uri}).catch(()=>{});
653
+ };
654
+ executionObservers.add(executionChanged);
628
655
  function initializeObservation() {
629
656
  if (observing) return;
630
657
  previous=fingerprint();previousArtifacts=artifactFingerprint();previousAssets=assetFingerprint();previousBuild=JSON.stringify(builds());
@@ -724,9 +751,9 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
724
751
  const timer = pollInterval > 0 ? setInterval(() => { if (!observationClosed) refresh().catch(error => { if (!observationClosed) process.stderr.write(`ads mcp: ${error.message}\n`); }); }, pollInterval) : null;
725
752
  timer?.unref();
726
753
  if (observeChanges) draftObservers.add(refresh);
727
- const stopObservation = () => { observationClosed = true; draftObservers.delete(refresh); if (timer) clearInterval(timer); };
754
+ const stopObservation = () => { executionObservers.delete(executionChanged);observationClosed = true; draftObservers.delete(refresh); if (timer) clearInterval(timer); };
728
755
  server.oninitialized = () => previewWatch?.start();
729
- server.onclose = stopObservation;
756
+ server.onclose = () => {stopObservation();if(!inspection)void coordinator.close().catch(()=>{});};
730
757
  async function warmScenarios(ids, signal) {
731
758
  if (!previewWatch) return;
732
759
  const apps = allApps(), selected = new Set(ids);
@@ -739,7 +766,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
739
766
  await previewWatch.warm(files);
740
767
  for (const file of files) await previewWatch.ensure(file, signal);
741
768
  }
742
- return { server, refresh, warmScenarios, buildAll(signal, options) { previewWatch.setApps(allApps()); return previewWatch.buildAll(signal, options); }, readResource:read, async callTool(name,args,signal){const tool=tools().find(tool=>tool.name===name);if(!tool)throw new Error("Unknown preview tool.");return tool.call(tool.schema.parse(args),signal);}, async close() { stopObservation(); if (!inspection) { await cache.registryInspector?.close(); await drafts.close(); await validation.close(); await verification.close(); await captures.close(); } await server.close(); } };
769
+ return { server, refresh, warmScenarios, buildAll(signal, options) { previewWatch.setApps(allApps()); return previewWatch.buildAll(signal, options); }, readResource:read, async callTool(name,args,signal){const tool=tools().find(tool=>tool.name===name);if(!tool)throw new Error("Unknown preview tool.");return tool.call(tool.schema.parse(args),signal);}, async close() { executionObservers.delete(executionChanged);stopObservation(); if (!inspection) { await coordinator.close(); await cache.registryInspector?.close(); await drafts.close(); await validation.close(); await verification.close(); await captures.close(); } await server.close(); } };
743
770
  }
744
771
 
745
772
  export async function startAdsMcp(directory = process.cwd(), { stdio = true, showcase = true, port = 0, mutations = false, previewWork = createPreviewWork(), previewBuildTimeoutMs = 30000, prewarm = stdio } = {}) {
@@ -784,8 +811,10 @@ export async function startAdsMcp(directory = process.cwd(), { stdio = true, sho
784
811
  buildListeners.clear();
785
812
  clearTimeout(buildChangeTimer); buildWatcher?.close();
786
813
  inspection.edits?.cancel();
814
+ const executionClosing=inspection.coordinator?.close();
787
815
  // Stop every owned resource even if another close fails or has in-flight RPCs.
788
816
  const results = await Promise.allSettled([
817
+ executionClosing,
789
818
  Promise.resolve().then(() => host?.close()),
790
819
  previewWatch.stop(),
791
820
  Promise.resolve().then(() => inspection.validation?.close()),
@@ -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.
@@ -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.
@@ -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.
@@ -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.