@reqvire-org/ads 0.4.5 → 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.
- package/dist/behavior-libraries.mjs +13 -1
- package/dist/capture.mjs +1 -1
- package/dist/config.mjs +22 -8
- package/dist/init.mjs +3 -1
- package/dist/input-digests.mjs +270 -0
- package/dist/input-scope.mjs +57 -0
- package/dist/mcp/build-status.mjs +36 -5
- package/dist/mcp/compiler-channel.mjs +145 -0
- package/dist/mcp/drafts.mjs +49 -94
- package/dist/mcp/mutations.mjs +1 -1
- package/dist/mcp/preview-watch.mjs +140 -53
- package/dist/mcp/server.mjs +78 -43
- package/dist/mcp/showcase-host.mjs +2 -1
- package/dist/preview-bun.mjs +2 -2
- package/dist/preview-inputs.mjs +18 -4
- package/dist/resource-limits.mjs +25 -3
- package/dist/scenario-registry.mjs +2 -2
- package/dist/scenarios-compiler.mjs +119 -73
- package/dist/skills/ads-designer/references/behaviors.md +4 -2
- package/dist/skills/ads-import/references/behaviors.md +4 -2
- package/dist/skills/ads-migrate/SKILL.md +1 -0
- package/dist/skills/ads-migrate/references/0.4.6-to-0.4.7.md +46 -0
- package/dist/skills/ads-port/references/behaviors.md +4 -2
- package/dist/stage-timing.cjs +3 -2
- package/dist/validation-inputs.mjs +217 -26
- package/docs/ARCHITECTURE.md +50 -4
- package/docs/CHANGELOG.md +65 -76
- package/docs/GUIDE.md +8 -2
- package/package.json +1 -1
|
@@ -5,12 +5,13 @@ 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
|
+
import { inInputRequestScope, inputRequestScopeId, inputScopeKey, scopedInputs } from "./input-scope.mjs";
|
|
14
15
|
|
|
15
16
|
const digest = (file) => `sha256:${createHash("sha256").update(readFileSync(file)).digest("hex")}`;
|
|
16
17
|
const ignored = new Set(["output", "test-results", "playwright-report", ".playwright-cli"]);
|
|
@@ -54,10 +55,213 @@ async function references(file, content, revision) {
|
|
|
54
55
|
return result;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
|
|
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;
|
|
60
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);
|
|
124
|
+
const { onFile } = limits;
|
|
125
|
+
return scopedInputs(
|
|
126
|
+
`${set}:${inputScopeKey(options)}`,
|
|
127
|
+
async (contents) => {
|
|
128
|
+
const fromMap = tracked(contents);
|
|
129
|
+
if (fromMap) return { digests: await fromMap };
|
|
130
|
+
const files = contents ? new Map() : undefined;
|
|
131
|
+
const digests = await capture(files ? { onFile: (file, content, revision) => files.set(file, [content, revision]) } : {});
|
|
132
|
+
return { digests, files };
|
|
133
|
+
},
|
|
134
|
+
{ fresh, observed, contents: !!onFile },
|
|
135
|
+
).then(({ digests, files }) => {
|
|
136
|
+
if (onFile) for (const [file, [content, revision]] of files) onFile(file, content, revision);
|
|
137
|
+
return { ...digests };
|
|
138
|
+
});
|
|
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
|
+
|
|
61
265
|
async function captureInputs(options, extraFiles, { maxFiles = Infinity, maxBytes = Infinity, onFile }) {
|
|
62
266
|
const supplied = options.config;
|
|
63
267
|
const normalized = {
|
|
@@ -106,7 +310,14 @@ async function captureInputs(options, extraFiles, { maxFiles = Infinity, maxByte
|
|
|
106
310
|
}
|
|
107
311
|
for (const file of config.validation?.inputs ?? [])
|
|
108
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();
|
|
109
316
|
async function visit(file) {
|
|
317
|
+
if (performance.now() - slice > 8) {
|
|
318
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
319
|
+
slice = performance.now();
|
|
320
|
+
}
|
|
110
321
|
file = path.resolve(file);
|
|
111
322
|
if (!isInside(root, file) || (!forced.has(file) && excluded(file))) return;
|
|
112
323
|
const relative = slash(path.relative(root, file));
|
|
@@ -189,27 +400,7 @@ async function captureInputs(options, extraFiles, { maxFiles = Infinity, maxByte
|
|
|
189
400
|
}
|
|
190
401
|
}
|
|
191
402
|
for (const asset of refs.assets) await local(asset);
|
|
192
|
-
} else
|
|
193
|
-
const css = postcss.parse(content.toString("utf8"), { from: file });
|
|
194
|
-
await walkAsync(css, "walkAtRules", "import", async (rule) => {
|
|
195
|
-
const first = valueParser(rule.params).nodes.find((node) => !["space", "comment"].includes(node.type));
|
|
196
|
-
if (first?.type === "string") await local(first.value);
|
|
197
|
-
});
|
|
198
|
-
await walkAsync(css, "walk", async (node) => {
|
|
199
|
-
if (node.type === "decl" || node.type === "atrule")
|
|
200
|
-
await walkValuesAsync(valueParser(node.type === "decl" ? node.value : node.params), async (value) => {
|
|
201
|
-
if (value.type === "function" && value.value.toLowerCase() === "url")
|
|
202
|
-
await local(
|
|
203
|
-
value.nodes
|
|
204
|
-
.filter((part) => part.type !== "space")
|
|
205
|
-
.map((part) => part.value)
|
|
206
|
-
.join(""),
|
|
207
|
-
);
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
} else if (file.endsWith(".html")) {
|
|
211
|
-
for (const match of content.toString("utf8").matchAll(/\b(?:src|href)\s*=\s*["']([^"']+)["']/g)) await local(match[1]);
|
|
212
|
-
}
|
|
403
|
+
} else for (const specifier of await localReferences(file, content)) await local(specifier);
|
|
213
404
|
}
|
|
214
405
|
// These roots cannot be excluded through optional declarations.
|
|
215
406
|
for (const file of [
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -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,11 +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`.
|
|
939
|
-
|
|
940
|
-
|
|
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.
|
|
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.
|
|
943
989
|
Compilation remains necessary for TSX and Linaria;
|
|
944
990
|
there is one preview pipeline with automatic updates.
|
|
945
991
|
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
## 0.4.
|
|
5
|
+
## 0.4.7
|
|
6
6
|
|
|
7
7
|
<!-- ads-local-tests:start -->
|
|
8
|
-
Local verification: **
|
|
9
|
-
Tested commit: `
|
|
10
|
-
Completed 2026-11-
|
|
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.
|
|
16
|
-
"commit": "
|
|
17
|
-
"sourceSha256": "
|
|
15
|
+
"version": "0.4.7",
|
|
16
|
+
"commit": "7b4583975a30f3c1fd78999081fe84d335466d22",
|
|
17
|
+
"sourceSha256": "4f436f35a843caf921da08e9451ea0220e6483d230fc0a8b11a420b404d4dcad",
|
|
18
18
|
"command": "bun run test",
|
|
19
19
|
"result": "pass",
|
|
20
|
-
"tests":
|
|
21
|
-
"pass":
|
|
20
|
+
"tests": 893,
|
|
21
|
+
"pass": 893,
|
|
22
22
|
"fail": 0,
|
|
23
23
|
"skipped": 0,
|
|
24
24
|
"groups": [
|
|
@@ -28,15 +28,15 @@ Completed 2026-11-11T07:40:07.975Z (1184 seconds).
|
|
|
28
28
|
"pass": 94,
|
|
29
29
|
"fail": 0,
|
|
30
30
|
"skipped": 0,
|
|
31
|
-
"reportSha256": "
|
|
31
|
+
"reportSha256": "86a12e2f6faddc13bc74d1a11afa2c339fc019691ebf951a627479cb74ad9129"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "integration",
|
|
35
|
-
"tests":
|
|
36
|
-
"pass":
|
|
35
|
+
"tests": 638,
|
|
36
|
+
"pass": 638,
|
|
37
37
|
"fail": 0,
|
|
38
38
|
"skipped": 0,
|
|
39
|
-
"reportSha256": "
|
|
39
|
+
"reportSha256": "de3874cbe0845264489bc81e9226d19d6501a55ffe5b94e3d3c367be0f2688eb"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"name": "browser",
|
|
@@ -44,21 +44,65 @@ Completed 2026-11-11T07:40:07.975Z (1184 seconds).
|
|
|
44
44
|
"pass": 161,
|
|
45
45
|
"fail": 0,
|
|
46
46
|
"skipped": 0,
|
|
47
|
-
"reportSha256": "
|
|
47
|
+
"reportSha256": "195886ed64acd4d6b9ffdaca0f0130a1d7aa501af38a7fbcf7976ecdbc059554"
|
|
48
48
|
}
|
|
49
49
|
],
|
|
50
|
-
"testOverrides": {
|
|
51
|
-
"ADS_INTEGRATION_WORKERS": "1",
|
|
52
|
-
"ADS_BROWSER_WORKERS": "1"
|
|
53
|
-
},
|
|
50
|
+
"testOverrides": {},
|
|
54
51
|
"bun": "1.4.4",
|
|
55
|
-
"completedAt": "2026-11-
|
|
56
|
-
"durationMs":
|
|
57
|
-
"logSha256": "
|
|
52
|
+
"completedAt": "2026-11-11T19:14:36.355Z",
|
|
53
|
+
"durationMs": 628934,
|
|
54
|
+
"logSha256": "958b12ab656608e179916bfeea8cde01a802fd7869f519775f355618f6b60b4d"
|
|
58
55
|
}
|
|
59
56
|
-->
|
|
60
57
|
<!-- ads-local-tests:end -->
|
|
61
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
|
+
|
|
93
|
+
- Preview and explorer requests reuse one content revision. A verified
|
|
94
|
+
`ads_show_scenario` (and the showcase's `/api/previews`) used to walk and hash
|
|
95
|
+
the project's inputs six to eight times; it now walks them once. Explorer and
|
|
96
|
+
build reads, and each one-second observation pass, also walk once. Freshness
|
|
97
|
+
stays content-based: a wait walks again when the compiler reports a new build,
|
|
98
|
+
and discovery/capture fence long work with a fresh walk.
|
|
99
|
+
- `ADS_PROFILE_STAGES` also records `build-status`, `preview-source-revision`,
|
|
100
|
+
`preview-ensure` and `showcase-api:*` stages, and labels each input walk with
|
|
101
|
+
its request scope.
|
|
102
|
+
- Projects need no migration: components, tokens, scenarios and configuration are unchanged.
|
|
103
|
+
|
|
104
|
+
## 0.4.5
|
|
105
|
+
|
|
62
106
|
- Make the local showcase use HTTP by default for discovery, scoped preview actions and checked assets. Keep MCP tools, resources and embedded Apps supported by the same engine; remove the experimental activation requirement.
|
|
63
107
|
- Deliver build reports through SSE, reconnect and reconcile missed updates, and refresh current state when a tab becomes visible. Retained previews show a stale-connection warning; no periodic HTTP browser status polling is required.
|
|
64
108
|
- Combine checked manifest preparation with bounded asset publication, reuse known revisions and pin asset reads to the authorized graph. Keep persistent opaque preview frames and verified Blob loading for worker dependencies.
|
|
@@ -69,61 +113,6 @@ Completed 2026-11-11T07:40:07.975Z (1184 seconds).
|
|
|
69
113
|
|
|
70
114
|
## 0.4.4
|
|
71
115
|
|
|
72
|
-
<!-- ads-local-tests:start -->
|
|
73
|
-
Local verification: **860/860 passed** with `bun run test`.
|
|
74
|
-
Tested commit: `d8d9b2d093ce26d140c037f90e5c9087b8fed46d`; Bun 1.4.4.
|
|
75
|
-
Completed 2026-11-10T14:37:34.287Z (1344 seconds).
|
|
76
|
-
|
|
77
|
-
<!-- ads-local-test-proof
|
|
78
|
-
{
|
|
79
|
-
"schema": 3,
|
|
80
|
-
"version": "0.4.4",
|
|
81
|
-
"commit": "d8d9b2d093ce26d140c037f90e5c9087b8fed46d",
|
|
82
|
-
"sourceSha256": "2ff7cc61caabd96b928581e79ddbc1c6df459145c0039023c2f3400947d46131",
|
|
83
|
-
"command": "bun run test",
|
|
84
|
-
"result": "pass",
|
|
85
|
-
"tests": 860,
|
|
86
|
-
"pass": 860,
|
|
87
|
-
"fail": 0,
|
|
88
|
-
"skipped": 0,
|
|
89
|
-
"groups": [
|
|
90
|
-
{
|
|
91
|
-
"name": "unit",
|
|
92
|
-
"tests": 91,
|
|
93
|
-
"pass": 91,
|
|
94
|
-
"fail": 0,
|
|
95
|
-
"skipped": 0,
|
|
96
|
-
"reportSha256": "896a8879bc0071d3bc822a9a5ee6b32ba78f47c69ac81045534c39bb2e9533c5"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"name": "integration",
|
|
100
|
-
"tests": 617,
|
|
101
|
-
"pass": 617,
|
|
102
|
-
"fail": 0,
|
|
103
|
-
"skipped": 0,
|
|
104
|
-
"reportSha256": "6ad851727bd92ee38143505e045d8cc7ee3624c0861510efde7beb8f7480d528"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"name": "browser",
|
|
108
|
-
"tests": 152,
|
|
109
|
-
"pass": 152,
|
|
110
|
-
"fail": 0,
|
|
111
|
-
"skipped": 0,
|
|
112
|
-
"reportSha256": "af3bcf2d9aeb6d80d073763ff346ec142c476c327c9e12b4827e3964c28b841d"
|
|
113
|
-
}
|
|
114
|
-
],
|
|
115
|
-
"testOverrides": {
|
|
116
|
-
"ADS_INTEGRATION_WORKERS": "1",
|
|
117
|
-
"ADS_BROWSER_WORKERS": "1"
|
|
118
|
-
},
|
|
119
|
-
"bun": "1.4.4",
|
|
120
|
-
"completedAt": "2026-11-10T14:37:34.287Z",
|
|
121
|
-
"durationMs": 1343621,
|
|
122
|
-
"logSha256": "dba1d323e6a2d4da20f000f86d75d8955c490d61c55f18765656f5d5bee8ae82"
|
|
123
|
-
}
|
|
124
|
-
-->
|
|
125
|
-
<!-- ads-local-tests:end -->
|
|
126
|
-
|
|
127
116
|
- Load the configured project stylesheet in generated Token and Brand previews. Track inlined CSS import dependencies by contents so same-size/same-time token edits refresh correctly; include Preact refresh helpers in the private compiler graph.
|
|
128
117
|
- Stop draft watcher reconciliation when its controller closes, and skip previews retired while another draft refreshes.
|
|
129
118
|
- Update watched previews through a private incremental module graph inside the existing isolated iframe. Preserve state and focus for compatible React/Preact edits, refresh styles and lazy branches, and reopen safely for incompatible updates or rejected revisions. Keep full Bun builds and native acceptance gates.
|
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.
|
|
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
|