@reqvire-org/ads 0.4.6 → 0.4.7

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.
@@ -0,0 +1,46 @@
1
+ # ADS 0.4.6 → 0.4.7
2
+
3
+ Confirm the target version in the installed package or registry. This guide also
4
+ accompanies a local release candidate and does not establish publication.
5
+ 0.4.5 → 0.4.6 needs no project change; apply this guide from either version.
6
+
7
+ ## Pin package versions in `ds.config.json`
8
+
9
+ ADS now decides preview freshness and compiled-preview reuse from the files it owns:
10
+ `ds.config.json`, the design-system folder and the public folders it declares. It no
11
+ longer reads the project's lockfiles, `tsconfig.json`, `src/` or `node_modules` to
12
+ notice a dependency upgrade. The configuration pins are how an upgrade reaches previews.
13
+
14
+ 1. Read the installed version of the framework package (`react` or `preact`) and of
15
+ every `behaviorLibraries` entry from the project's own dependency manifest or
16
+ lockfile.
17
+ 2. Write each as `name@version` with the exact version:
18
+
19
+ ```json
20
+ {
21
+ "framework": "preact@10.27.2",
22
+ "behaviorLibraries": ["elkjs@0.9.3", "minisearch@7.1.2"]
23
+ }
24
+ ```
25
+
26
+ Only exact versions are accepted (no ranges, tags or wildcards). Unpinned names
27
+ keep working, but then an upgrade of that package does not invalidate previews.
28
+ 3. Run `ads check`. `behavior-library-version` reports a pin that differs from the
29
+ installed version. When the project later upgrades a pinned package, update its
30
+ pin in the same change.
31
+
32
+ ## Keep preview inputs inside the design system
33
+
34
+ A change outside the owned folders no longer marks previews stale. If a scenario,
35
+ fixture or owner imports a file from `src/` or another project folder, move that
36
+ code into the design system (or a declared public folder). Otherwise edits there
37
+ reach previews only when the compiler rebuilds for another reason.
38
+
39
+ ## What else changes
40
+
41
+ - Repeated preview, explorer and build reads, and an idle showcase, read no project
42
+ files: watched sessions keep an in-memory digest of the owned inputs and re-read only
43
+ files that an event names. A periodic full walk remains the safety net.
44
+ - On macOS the automatic memory limit counts memory the system can reclaim, and the
45
+ automatic limit is never below min(3 GiB, half of RAM). An explicit
46
+ `resources.memoryLimitMb` still replaces it.
@@ -23,8 +23,10 @@ style writes retain the exact properties declared in the owner contract's
23
23
  `styles.writes`; they do not allow
24
24
  shared-token overrides or an extra styling layer.
25
25
  Projects explicitly approve installed runtime packages through
26
- `behaviorLibraries` in `ds.config.json`; each must also be a `package.json`
27
- dependency. Components, patterns and controllers may use them directly, including
26
+ `behaviorLibraries` in `ds.config.json`, pinned to the exact installed version
27
+ (`"tabbable@6.2.0"`); each must also be a `package.json` dependency. Pin the
28
+ `framework` the same way (`"preact@10.27.2"`) and update a pin together with the
29
+ upgrade; `ads check` reports a pin that differs from the installed version. Components, patterns and controllers may use them directly, including
28
30
  package subpaths. Extract a shared controller when behavior is shared. Type-only
29
31
  and development-role imports retain their existing rules. An empty/missing list
30
32
  allows no additional runtime packages beyond the configured framework and Linaria.
@@ -5,10 +5,10 @@ import path from "node:path";
5
5
  import ts, { withModuleResolutionScope } from "./analysis/syntax.mjs";
6
6
  import postcss from "postcss";
7
7
  import valueParser from "postcss-value-parser";
8
- import { defaultConfig, fixedLayout, isInside, isTestFile } from "./config.mjs";
8
+ import { defaultConfig, fixedLayout, isInside, isTestFile, loadConfig } from "./config.mjs";
9
9
  import { importResolver } from "./boundaries.mjs";
10
10
  import { configurationFiles } from "./units.mjs";
11
- import { createPreviewFileFilter } from "./preview-files.mjs";
11
+ import { createPreviewFileFilter, previewWatchDirectories } from "./preview-files.mjs";
12
12
  import { projectNoticeFiles } from "./project-documents.mjs";
13
13
  import timing from "./stage-timing.cjs";
14
14
  import { inInputRequestScope, inputRequestScopeId, inputScopeKey, scopedInputs } from "./input-scope.mjs";
@@ -55,17 +55,78 @@ async function references(file, content, revision) {
55
55
  return result;
56
56
  }
57
57
 
58
- /** Mandatory UI/guard inputs, real local dependencies and declared opaque inputs.
59
- * Inside a read-only request scope, unbounded captures share one walk; `fresh`
60
- * re-walks (a content fence) and `observed` re-walks when paired evidence changed. */
61
- export function validationInputFiles(options, extraFiles = [], { fresh, observed, ...limits } = {}) {
62
- const capture = (bounds) =>
63
- timing.timeStage("input-capture", () => withModuleResolutionScope(() => captureInputs(options, extraFiles, bounds)), () => ({ scope: inputRequestScopeId() }));
64
- if (!inInputRequestScope() || extraFiles.length || limits.maxFiles !== undefined || limits.maxBytes !== undefined) return capture(limits);
58
+ /** Local URLs a stylesheet or HTML page references, in visiting order. */
59
+ async function localReferences(file, content) {
60
+ const found = [];
61
+ if (file.endsWith(".css")) {
62
+ const css = postcss.parse(content.toString("utf8"), { from: file });
63
+ await walkAsync(css, "walkAtRules", "import", async (rule) => {
64
+ const first = valueParser(rule.params).nodes.find((node) => !["space", "comment"].includes(node.type));
65
+ if (first?.type === "string") found.push(first.value);
66
+ });
67
+ await walkAsync(css, "walk", async (node) => {
68
+ if (node.type === "decl" || node.type === "atrule")
69
+ await walkValuesAsync(valueParser(node.type === "decl" ? node.value : node.params), async (value) => {
70
+ if (value.type === "function" && value.value.toLowerCase() === "url")
71
+ found.push(
72
+ value.nodes
73
+ .filter((part) => part.type !== "space")
74
+ .map((part) => part.value)
75
+ .join(""),
76
+ );
77
+ });
78
+ });
79
+ } else if (file.endsWith(".html")) for (const match of content.toString("utf8").matchAll(/\b(?:src|href)\s*=\s*["']([^"']+)["']/g)) found.push(match[1]);
80
+ return found;
81
+ }
82
+
83
+ /** Everything a file's content contributes to input membership. A content edit
84
+ * that keeps this signature cannot change which files are inputs. */
85
+ export async function referenceSignature(file, content, revision) {
86
+ if (script.test(file)) {
87
+ const { imports, assets } = await references(file, content, revision);
88
+ return JSON.stringify([imports, assets]);
89
+ }
90
+ return file.endsWith(".css") || file.endsWith(".html") ? JSON.stringify(await localReferences(file, content)) : "";
91
+ }
92
+
93
+ const digestMaps = new Map();
94
+ /** Let one process answer digest reads of an input set from an incrementally
95
+ * maintained map. `unscoped`: also outside request scopes (a compiler process
96
+ * whose every read follows its own watcher); otherwise only read-only request
97
+ * scopes use it. */
98
+ export function registerInputDigests(map, { set = "validation", unscoped = false } = {}) {
99
+ const id = `${set}:${path.resolve(map.root)}`;
100
+ digestMaps.set(id, { map, unscoped });
101
+ return () => {
102
+ if (digestMaps.get(id)?.map === map) digestMaps.delete(id);
103
+ };
104
+ }
105
+
106
+ /** One read path for every input set: a registered digest map (digest-only
107
+ * reads of the current configuration), then the request's shared walk, then a
108
+ * walk. Fresh fences and byte consumers always walk. */
109
+ function readInputSet(set, options, capture, { fresh, observed, limits = {}, unbounded = true }) {
110
+ const tracked = (contents) => {
111
+ if (contents || fresh || !unbounded) return undefined;
112
+ const registration = digestMaps.get(`${set}:${path.resolve(options.root)}`);
113
+ if (!registration || (!registration.unscoped && !inInputRequestScope())) return undefined;
114
+ const { map } = registration;
115
+ try {
116
+ if (map.key(options) !== map.key(loadConfig(options.root))) return undefined;
117
+ } catch {
118
+ return undefined;
119
+ }
120
+ // A map may decline (null): a published map whose publisher is not running.
121
+ return timing.timeStage("input-digests", () => map.current(), () => ({ scope: inputRequestScopeId(), set })).then((digests) => digests ?? capture(limits));
122
+ };
123
+ if (!inInputRequestScope() || !unbounded) return tracked(!!limits.onFile) ?? capture(limits);
65
124
  const { onFile } = limits;
66
125
  return scopedInputs(
67
- inputScopeKey(options),
126
+ `${set}:${inputScopeKey(options)}`,
68
127
  async (contents) => {
128
+ const fromMap = tracked(contents);
129
+ if (fromMap) return { digests: await fromMap };
69
130
  const files = contents ? new Map() : undefined;
70
131
  const digests = await capture(files ? { onFile: (file, content, revision) => files.set(file, [content, revision]) } : {});
71
132
  return { digests, files };
@@ -76,6 +137,131 @@ export function validationInputFiles(options, extraFiles = [], { fresh, observed
76
137
  return { ...digests };
77
138
  });
78
139
  }
140
+
141
+ /** The validation inputs as an input set for createInputDigests. */
142
+ export function validationInputSet(root) {
143
+ root = path.resolve(root);
144
+ const filters = new WeakMap();
145
+ const filter = (options) => {
146
+ if (!filters.has(options)) filters.set(options, createPreviewFileFilter(options));
147
+ return filters.get(options);
148
+ };
149
+ return {
150
+ load: () => loadConfig(root),
151
+ key: (options) => JSON.stringify([path.resolve(options.root), options.config, options.dsRoot ?? null, options.sourceRoot ?? null]),
152
+ capture: (options, hooks) =>
153
+ timing.timeStage("input-capture", () => withModuleResolutionScope(() => captureInputs(options, [], hooks)), () => ({ scope: inputRequestScopeId(), mode: "digest-map" })),
154
+ signature: referenceSignature,
155
+ // Manifests, root files (configuration, lockfiles, notices) and installed
156
+ // dependencies change membership or resolution, not just one digest.
157
+ structural: (relative) =>
158
+ !relative.includes("/") || path.posix.basename(relative) === "package.json" || relative === "node_modules/.package-lock.json",
159
+ ignored: (relative, options) =>
160
+ filter(options)(path.join(root, relative)) ||
161
+ relative.split("/").some((name) => ignored.has(name)) ||
162
+ [".gitkeep", ".keep"].includes(path.posix.basename(relative)) ||
163
+ relative.endsWith(".tsbuildinfo"),
164
+ directories: (options) => previewWatchDirectories(options),
165
+ };
166
+ }
167
+
168
+ /** Mandatory UI/guard inputs, real local dependencies and declared opaque inputs.
169
+ * Inside a read-only request scope, unbounded captures share one walk; `fresh`
170
+ * re-walks (a content fence) and `observed` re-walks when paired evidence changed. */
171
+ export function validationInputFiles(options, extraFiles = [], { fresh, observed, ...limits } = {}) {
172
+ const capture = (bounds) =>
173
+ timing.timeStage("input-capture", () => withModuleResolutionScope(() => captureInputs(options, extraFiles, bounds)), () => ({ scope: inputRequestScopeId(), set: "validation" }));
174
+ const unbounded = !extraFiles.length && limits.maxFiles === undefined && limits.maxBytes === undefined;
175
+ return readInputSet("validation", options, capture, { fresh, observed, limits, unbounded });
176
+ }
177
+
178
+ // ADS-owned inputs: its configuration, the design-system folder and the public
179
+ // folders that configuration declares. Preview freshness, discovery caches and
180
+ // captures depend on these alone; ADS reads no project-owned file to decide
181
+ // them. (Validation and acceptance keep the full set above because they run
182
+ // the project's own scripts; narrowing those is V3 Phase 2.)
183
+ function ownedRoots(options) {
184
+ const config = { ...defaultConfig, ...options.config, assets: { ...defaultConfig.assets, ...options.config.assets } };
185
+ const root = path.resolve(options.root);
186
+ return {
187
+ root,
188
+ config: path.join(root, "ds.config.json"),
189
+ directories: [options.dsRoot ?? path.resolve(root, config.dsDir), ...config.assets.publicDirs.map((directory) => path.resolve(root, directory))],
190
+ };
191
+ }
192
+ async function captureOwnedInputs(options, { onFile } = {}) {
193
+ const { root, config, directories } = ownedRoots(options);
194
+ const previewIgnored = createPreviewFileFilter({ ...options, config: { ...defaultConfig, ...options.config, ...fixedLayout, assets: { ...defaultConfig.assets, ...options.config.assets } } });
195
+ const files = new Map();
196
+ let slice = performance.now();
197
+ async function visit(file) {
198
+ if (performance.now() - slice > 8) {
199
+ await new Promise((resolve) => setImmediate(resolve));
200
+ slice = performance.now();
201
+ }
202
+ const relative = slash(path.relative(root, file));
203
+ if (files.has(relative) || previewIgnored(file) || relative.split("/").some((name) => ignored.has(name))) return;
204
+ let stat;
205
+ try {
206
+ stat = lstatSync(file);
207
+ } catch (error) {
208
+ if (error.code !== "ENOENT" && error.code !== "ENOTDIR") throw error;
209
+ files.set(relative, null);
210
+ return;
211
+ }
212
+ if (stat.isSymbolicLink()) throw new Error(`Validation input cannot resolve through a symlink: ${relative}`);
213
+ if (stat.isDirectory()) {
214
+ for (const entry of readdirSync(file).sort()) await visit(path.join(file, entry));
215
+ return;
216
+ }
217
+ if (!stat.isFile() || [".gitkeep", ".keep"].includes(path.basename(file)) || file.endsWith(".tsbuildinfo")) return;
218
+ const content = readFileSync(file),
219
+ revision = `sha256:${createHash("sha256").update(content).digest("hex")}`;
220
+ files.set(relative, revision);
221
+ onFile?.(relative, content, revision);
222
+ }
223
+ await visit(config);
224
+ for (const directory of directories) if (isInside(root, directory)) await visit(directory);
225
+ return Object.fromEntries([...files].sort(([a], [b]) => a.localeCompare(b)));
226
+ }
227
+
228
+ /** Digests of the ADS-owned inputs (see ownedRoots). */
229
+ export function ownedInputFiles(options, { fresh, observed, onFile } = {}) {
230
+ const capture = (bounds) => timing.timeStage("input-capture", () => captureOwnedInputs(options, bounds), () => ({ scope: inputRequestScopeId(), set: "owned" }));
231
+ return readInputSet("owned", options, capture, { fresh, observed, limits: onFile ? { onFile } : {} });
232
+ }
233
+
234
+ /** The ADS-owned inputs as an input set for createInputDigests: membership is
235
+ * directory-based, so only additions, removals and ds.config.json change it. */
236
+ export function ownedInputSet(root) {
237
+ root = path.resolve(root);
238
+ return {
239
+ load: () => loadConfig(root),
240
+ key: (options) => JSON.stringify([path.resolve(options.root), options.config, options.dsRoot ?? null]),
241
+ capture: (options, hooks) => timing.timeStage("input-capture", () => captureOwnedInputs(options, hooks), () => ({ scope: inputRequestScopeId(), set: "owned", mode: "digest-map" })),
242
+ signature: () => "",
243
+ structural: (relative) => relative === "ds.config.json",
244
+ ignored: (relative, options) => {
245
+ const file = path.join(root, relative),
246
+ { config, directories } = ownedRoots(options);
247
+ return file !== config && !directories.some((directory) => isInside(directory, file));
248
+ },
249
+ // ds.config.json itself and the folders it declares; nothing else in the project is watched.
250
+ directories: (options) => {
251
+ const { config, directories } = ownedRoots(options),
252
+ previewIgnored = createPreviewFileFilter({ ...options, config: { ...defaultConfig, ...options.config, ...fixedLayout, assets: { ...defaultConfig.assets, ...options.config.assets } } }),
253
+ found = existsSync(config) ? [config] : [];
254
+ const visit = (directory) => {
255
+ found.push(directory);
256
+ for (const entry of readdirSync(directory, { withFileTypes: true }))
257
+ if (entry.isDirectory() && !entry.isSymbolicLink() && !previewIgnored(path.join(directory, entry.name))) visit(path.join(directory, entry.name));
258
+ };
259
+ for (const directory of directories) if (existsSync(directory) && !previewIgnored(directory)) visit(directory);
260
+ return [...new Set(found)];
261
+ },
262
+ };
263
+ }
264
+
79
265
  async function captureInputs(options, extraFiles, { maxFiles = Infinity, maxBytes = Infinity, onFile }) {
80
266
  const supplied = options.config;
81
267
  const normalized = {
@@ -124,7 +310,14 @@ async function captureInputs(options, extraFiles, { maxFiles = Infinity, maxByte
124
310
  }
125
311
  for (const file of config.validation?.inputs ?? [])
126
312
  if (excluded(path.resolve(root, file))) throw new Error(`validation.inputs must name source inputs, not generated output or metadata: ${file}`);
313
+ // The walk reads synchronously; yield regularly so a slow file system delays
314
+ // other requests instead of blocking the process for the whole walk.
315
+ let slice = performance.now();
127
316
  async function visit(file) {
317
+ if (performance.now() - slice > 8) {
318
+ await new Promise((resolve) => setImmediate(resolve));
319
+ slice = performance.now();
320
+ }
128
321
  file = path.resolve(file);
129
322
  if (!isInside(root, file) || (!forced.has(file) && excluded(file))) return;
130
323
  const relative = slash(path.relative(root, file));
@@ -207,27 +400,7 @@ async function captureInputs(options, extraFiles, { maxFiles = Infinity, maxByte
207
400
  }
208
401
  }
209
402
  for (const asset of refs.assets) await local(asset);
210
- } else if (file.endsWith(".css")) {
211
- const css = postcss.parse(content.toString("utf8"), { from: file });
212
- await walkAsync(css, "walkAtRules", "import", async (rule) => {
213
- const first = valueParser(rule.params).nodes.find((node) => !["space", "comment"].includes(node.type));
214
- if (first?.type === "string") await local(first.value);
215
- });
216
- await walkAsync(css, "walk", async (node) => {
217
- if (node.type === "decl" || node.type === "atrule")
218
- await walkValuesAsync(valueParser(node.type === "decl" ? node.value : node.params), async (value) => {
219
- if (value.type === "function" && value.value.toLowerCase() === "url")
220
- await local(
221
- value.nodes
222
- .filter((part) => part.type !== "space")
223
- .map((part) => part.value)
224
- .join(""),
225
- );
226
- });
227
- });
228
- } else if (file.endsWith(".html")) {
229
- for (const match of content.toString("utf8").matchAll(/\b(?:src|href)\s*=\s*["']([^"']+)["']/g)) await local(match[1]);
230
- }
403
+ } else for (const specifier of await localReferences(file, content)) await local(specifier);
231
404
  }
232
405
  // These roots cannot be excluded through optional declarations.
233
406
  for (const file of [
@@ -430,8 +430,12 @@ import styled consumers or introduce another skin layer. Existing measurement an
430
430
  style-write boundaries still apply.
431
431
 
432
432
  Projects can explicitly allow installed runtime packages with
433
- `"behaviorLibraries": ["@floating-ui/dom", "tabbable"]` in `ds.config.json`.
433
+ `"behaviorLibraries": ["@floating-ui/dom@1.7.4", "tabbable@6.2.0"]` in `ds.config.json`.
434
434
  Each name must also appear in `package.json` dependencies and be installed.
435
+ Pin each package, and the framework (`"framework": "preact@10.27.2"`), to its exact
436
+ installed version: compiled previews are keyed by ADS-owned inputs only, so the pin
437
+ is how a dependency upgrade invalidates them. `ads check` reports
438
+ `behavior-library-version` when the installed version differs from the pin.
435
439
  Production ADS code may import those packages and their subpaths directly from
436
440
  components, patterns or controllers; extract a shared controller only when the
437
441
  behavior is shared. Other external runtime imports fail
@@ -935,19 +939,53 @@ failures stay in the watcher's recoverable diagnostic path. Fixing source trigge
935
939
  If the compiler process exits, the next preview request starts one fresh child;
936
940
  MCP inspection remains available. Each child generation has its own status report,
937
941
  so independent MCP clients do not overwrite each other's build state.
938
- Standalone compilation writes `.ds/build-status.json`. Managed compilation uses
939
- `.ds/build-status-<session>.json`, selected through the internal
940
- `ADS_MCP_BUILD_STATUS` and `ADS_MCP_BUILD_SESSION` launch variables. Session identity
942
+ Standalone compilation writes `.ds/build-status.json`. A compiler managed by MCP
943
+ coordinates with its watcher over direct IPC (`src/mcp/compiler-channel.mjs`): a
944
+ private local socket (a Unix socket in a 0700 temporary directory, or a named pipe on
945
+ Windows) named with a per-launch token in the compiler's environment, so it works
946
+ through any configured compiler command. Requests and draft control go to the
947
+ compiler; build reports, full-build results and input digests come back, keyed by
948
+ session and held in the MCP process. The latest request and draft list are replayed
949
+ when a compiler (re)connects. Nothing is exchanged through `.ds/` status files;
950
+ preview artifacts and resources keep their own transport. Session identity
941
951
  separates revisions across restarts; source and artifact digests establish
942
952
  freshness independently of process state.
943
- Those source digests come from one content walk per read-only request: a tool
944
- call such as `ads_show_scenario` or `ads_status`, an accepted-project resource read
945
- (including the showcase's HTTP reads), one observation pass, or one preview wait.
946
- Discovery, the registry and build status within that request share it. While a
947
- request waits for a build, it walks again only after the compiler's status report
948
- changes. Discovery and capture fence long work with a fresh walk. Mutations, acceptance,
949
- validation, captures and draft resources keep their own fresh reads. Compiler
950
- children, timers and shared discovery tasks start outside any request's revision.
953
+ Those source digests cover only ADS-owned inputs: `ds.config.json`, the
954
+ design-system folder and the public folders it declares. Package versions are
955
+ pinned in `ds.config.json` (`name@version`), so compiled-preview cache keys need no
956
+ project lockfile, `tsconfig.json`, `src/` or `node_modules` read either. The managed
957
+ compiler is the one owner of the digest map of these inputs (`src/input-digests.mjs`)
958
+ and the only process that watches them. One full walk seeds it, and file events on
959
+ the owned folders and `ds.config.json` name the files to read again; equal size or
960
+ modification time never counts as unchanged. Additions, removals, renames, unnamed
961
+ events, watcher errors and configuration changes force a full walk before the next
962
+ answer, and a periodic full walk (at most every 30 s) is the safety net. The compiler
963
+ sends each changed map to MCP and marks it pending the moment an event arrives.
964
+ Before a request answers from the map, MCP asks the compiler to flush: it processes
965
+ every file event already delivered, re-reads those files and replies with its map, so
966
+ an edit made before a status read is never reported as built. Without a reply within
967
+ one second the request walks the owned inputs. MCP's
968
+ status, discovery and capture reads use that map; without a running managed
969
+ compiler (CLI commands, a stopped or parked compiler) they walk the owned inputs.
970
+ Draft workspaces change only through MCP: the draft controller sends each written or
971
+ removed file to the draft's hosted compiler instance over the same channel, and
972
+ neither the controller nor the draft instances watch files. Accepted-source changes
973
+ reach open draft previews through the project map.
974
+ Within one read-only request (a tool call such as `ads_show_scenario`, an
975
+ accepted-project resource read, an observation pass, a build-report change or a
976
+ preview wait), every reader shares one revision. A wait reads it again only after
977
+ the compiler's status report changes. Discovery and capture fence long work with a
978
+ fresh walk. Compiler children, timers and shared discovery tasks start outside any
979
+ request's revision.
980
+
981
+ Validation evidence and draft acceptance still use the full project input set
982
+ (`validationInputFiles`), because they run the project's own scripts and copy what
983
+ those scripts need into candidate workspaces; draft preview workspaces are still
984
+ full copies for the same reason. Planned for V3 Phase 2: narrow those to ADS-owned
985
+ inputs (the digest map is keyed by an input-set definition, so the narrower set
986
+ reuses the same map and fallbacks), serve draft bytes to the compiler without a
987
+ workspace copy, and measure whether one compiler graph per draft still costs enough
988
+ to justify a deliberate multi-root graph.
951
989
  Compilation remains necessary for TSX and Linaria;
952
990
  there is one preview pipeline with automatic updates.
953
991
 
package/docs/CHANGELOG.md CHANGED
@@ -2,23 +2,23 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## 0.4.6
5
+ ## 0.4.7
6
6
 
7
7
  <!-- ads-local-tests:start -->
8
- Local verification: **883/883 passed** with `bun run test`.
9
- Tested commit: `bb29264bf42ad07748f8c70097d76715af87b113`; Bun 1.4.4.
10
- Completed 2026-11-11T15:06:17.009Z (619 seconds).
8
+ Local verification: **893/893 passed** with `bun run test`.
9
+ Tested commit: `7b4583975a30f3c1fd78999081fe84d335466d22`; Bun 1.4.4.
10
+ Completed 2026-11-11T19:14:36.355Z (629 seconds).
11
11
 
12
12
  <!-- ads-local-test-proof
13
13
  {
14
14
  "schema": 3,
15
- "version": "0.4.6",
16
- "commit": "bb29264bf42ad07748f8c70097d76715af87b113",
17
- "sourceSha256": "4a6b98cb086f3ede9f1986b9dece7e997a04c747dfc27a63d70c2af2b94c18a4",
15
+ "version": "0.4.7",
16
+ "commit": "7b4583975a30f3c1fd78999081fe84d335466d22",
17
+ "sourceSha256": "4f436f35a843caf921da08e9451ea0220e6483d230fc0a8b11a420b404d4dcad",
18
18
  "command": "bun run test",
19
19
  "result": "pass",
20
- "tests": 883,
21
- "pass": 883,
20
+ "tests": 893,
21
+ "pass": 893,
22
22
  "fail": 0,
23
23
  "skipped": 0,
24
24
  "groups": [
@@ -28,15 +28,15 @@ Completed 2026-11-11T15:06:17.009Z (619 seconds).
28
28
  "pass": 94,
29
29
  "fail": 0,
30
30
  "skipped": 0,
31
- "reportSha256": "6f9b3efeb096563dc697bf3205eb1900da7bbe7a19a57ba7cdd4b59aa8ab9664"
31
+ "reportSha256": "86a12e2f6faddc13bc74d1a11afa2c339fc019691ebf951a627479cb74ad9129"
32
32
  },
33
33
  {
34
34
  "name": "integration",
35
- "tests": 628,
36
- "pass": 628,
35
+ "tests": 638,
36
+ "pass": 638,
37
37
  "fail": 0,
38
38
  "skipped": 0,
39
- "reportSha256": "ebfd00b27d810cf0490cfb6f56001be00b04452cf3ed67ccf6c862f4102fe538"
39
+ "reportSha256": "de3874cbe0845264489bc81e9226d19d6501a55ffe5b94e3d3c367be0f2688eb"
40
40
  },
41
41
  {
42
42
  "name": "browser",
@@ -44,18 +44,52 @@ Completed 2026-11-11T15:06:17.009Z (619 seconds).
44
44
  "pass": 161,
45
45
  "fail": 0,
46
46
  "skipped": 0,
47
- "reportSha256": "cd13d1dcd9d666e6f3e8121f91685413029d371f14ee07186067ef0e872f35e2"
47
+ "reportSha256": "195886ed64acd4d6b9ffdaca0f0130a1d7aa501af38a7fbcf7976ecdbc059554"
48
48
  }
49
49
  ],
50
50
  "testOverrides": {},
51
51
  "bun": "1.4.4",
52
- "completedAt": "2026-11-11T15:06:17.009Z",
53
- "durationMs": 618512,
54
- "logSha256": "a471ffb30a031272bca4f20fd6a919a77fd341ee6e721cd1e2b8b8dc5fdb8c29"
52
+ "completedAt": "2026-11-11T19:14:36.355Z",
53
+ "durationMs": 628934,
54
+ "logSha256": "958b12ab656608e179916bfeea8cde01a802fd7869f519775f355618f6b60b4d"
55
55
  }
56
56
  -->
57
57
  <!-- ads-local-tests:end -->
58
58
 
59
+ - Watched sessions keep an in-memory digest map of their inputs. Warm preview,
60
+ explorer and build reads and an idle showcase no longer walk the project: on
61
+ graphenedb a warm verified preview takes about 30 ms (0.4.6: 310 ms; 0.4.5: 1.9 s),
62
+ and with nothing changing neither the MCP server nor the compiler reads project
63
+ files. File events name what to read again; equal size or modification time never
64
+ counts as unchanged. Structural changes and lost or unnamed events walk again
65
+ before answering, and a periodic full walk remains the safety net.
66
+ - Preview freshness, discovery caches, captures and compiled-preview cache keys use
67
+ ADS-owned inputs only: `ds.config.json`, the design-system folder and its declared
68
+ public folders. ADS no longer reads project lockfiles, `tsconfig.json`, `src/` or
69
+ `node_modules` for them, and watches only those owned paths. Validation evidence
70
+ and acceptance snapshots keep the full input set until V3 Phase 2.
71
+ - `ds.config.json` pins exact package versions: `"framework": "preact@10.27.2"`,
72
+ `"behaviorLibraries": ["elkjs@0.9.3"]`. `ads check` reports
73
+ `behavior-library-version` when the installed version differs. Pins are how a
74
+ dependency upgrade invalidates compiled previews; unpinned names still work.
75
+ - Full walks yield to other requests every few milliseconds instead of holding the
76
+ process for the whole walk.
77
+ - The automatic memory limit no longer fails ordinary sessions on a busy Mac. On
78
+ macOS it counts reclaimable memory (from `vm_stat`) rather than `os.freemem()`
79
+ alone, and it is never below min(3 GiB, half of RAM). An explicit
80
+ `resources.memoryLimitMb` still replaces it.
81
+ - MCP and its managed compiler coordinate over direct IPC (a private local socket)
82
+ instead of `.ds/` files: preview requests, draft control and change notices go
83
+ out; build reports, full-build results and the compiler's input digests come
84
+ back. The compiler is the one owner of the digest map and the only watcher; it
85
+ marks the map pending as soon as an event arrives, and before answering from it
86
+ MCP asks the compiler to process every event already delivered, so a build is
87
+ never called current for an edit made before the status read. Draft workspaces are no longer
88
+ watched: MCP sends each written file to the draft's compiler instance.
89
+ - Migration: pin the framework and behavior libraries (see the 0.4.6 → 0.4.7 guide).
90
+
91
+ ## 0.4.6
92
+
59
93
  - Preview and explorer requests reuse one content revision. A verified
60
94
  `ads_show_scenario` (and the showcase's `/api/previews`) used to walk and hash
61
95
  the project's inputs six to eight times; it now walks them once. Explorer and
package/docs/GUIDE.md CHANGED
@@ -856,7 +856,8 @@ Configure the framework; ADS compiles every scenario into one shared preview gra
856
856
 
857
857
  ```json
858
858
  {
859
- "framework": "react",
859
+ "framework": "react@19.1.0",
860
+ "behaviorLibraries": ["tabbable@6.2.0"],
860
861
  "mcp": {
861
862
  "showcaseTitle": "My Project Design System"
862
863
  }
@@ -864,7 +865,12 @@ Configure the framework; ADS compiles every scenario into one shared preview gra
864
865
  ```
865
866
 
866
867
  Keep the saved `framework` (`react` or `preact`), JSX transform and mount adapter
867
- consistent. The optional title defaults to the project package name followed by
868
+ consistent. Pin the framework and every `behaviorLibraries` package to the exact
869
+ installed version (`name@1.2.3`). ADS keys preview freshness and compiled previews
870
+ by the files it owns: `ds.config.json`, the design-system folder and the declared
871
+ public folders. It does not read the project's lockfiles, `tsconfig.json` or `src/`
872
+ for this. The pins are how a dependency upgrade reaches previews: update the pin
873
+ with the upgrade, and `ads check` reports a pin that no longer matches what is installed. The optional title defaults to the project package name followed by
868
874
  ` · Design System`. The browser shell stays the same for both frameworks. There is
869
875
  one managed compiler per runtime, shared by stdio and HTTP clients. It builds
870
876
  a shared multi-entry graph on first demand and after source changes; the App
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
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": {