@reqvire-org/ads 0.3.32 → 0.3.33
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/README.md +9 -0
- package/dist/bootstrap-ds/vite.config.ts +2 -1
- package/dist/boundaries.mjs +2 -0
- package/dist/capture.mjs +5 -3
- package/dist/config.mjs +5 -2
- package/dist/draft-boundary.mjs +27 -0
- package/dist/draft-workspace.mjs +10 -0
- package/dist/lint-config.mjs +1 -0
- package/dist/mcp/context.mjs +2 -2
- package/dist/mcp/draft-exports.mjs +40 -0
- package/dist/mcp/drafts.mjs +341 -0
- package/dist/mcp/edit-preparation.mjs +8 -7
- package/dist/mcp/execution-results.mjs +2 -0
- package/dist/mcp/mutations.mjs +6 -2
- package/dist/mcp/preview-watch.mjs +11 -3
- package/dist/mcp/preview-widget.bundle.js +13 -13
- package/dist/mcp/prompts.mjs +3 -2
- package/dist/mcp/server.mjs +75 -18
- package/dist/mcp/widget.bundle.js +1 -1
- package/dist/preview-files.mjs +2 -0
- package/dist/scenarios-compiler.mjs +2 -0
- package/dist/scenarios-vite.d.mts +1 -0
- package/dist/scenarios-vite.mjs +1 -0
- package/dist/showcase/client.bundle.js +43 -43
- package/dist/showcase/comparison.js +21 -0
- package/dist/showcase/index.html +2 -1
- package/dist/showcase/style.css +5 -0
- package/dist/skills/README.md +5 -0
- package/dist/skills/ads-break-ui/SKILL.md +26 -0
- package/dist/skills/ads-break-ui/references/captures.md +7 -0
- package/dist/skills/ads-break-ui/references/drafts.md +107 -0
- package/dist/skills/ads-break-ui/references/guarded-editing.md +6 -0
- package/dist/skills/ads-designer/SKILL.md +26 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/vite.config.ts +2 -1
- package/dist/skills/ads-designer/references/captures.md +7 -0
- package/dist/skills/ads-designer/references/drafts.md +107 -0
- package/dist/skills/ads-designer/references/guarded-editing.md +6 -0
- package/dist/skills/ads-import/SKILL.md +26 -0
- package/dist/skills/ads-import/references/captures.md +7 -0
- package/dist/skills/ads-import/references/drafts.md +107 -0
- package/dist/skills/ads-import/references/guarded-editing.md +6 -0
- package/dist/skills/ads-motion/SKILL.md +26 -0
- package/dist/skills/ads-motion/references/captures.md +7 -0
- package/dist/skills/ads-motion/references/drafts.md +107 -0
- package/dist/skills/ads-motion/references/guarded-editing.md +6 -0
- package/dist/skills/ads-port/SKILL.md +26 -0
- package/dist/skills/ads-port/references/captures.md +7 -0
- package/dist/skills/ads-port/references/drafts.md +107 -0
- package/dist/skills/ads-port/references/guarded-editing.md +6 -0
- package/docs/ADS.md +13 -0
- package/docs/ARCHITECTURE.md +12 -0
- package/docs/CHANGELOG.md +19 -0
- package/docs/CONTRACTS.md +8 -0
- package/docs/GUIDE.md +17 -5
- package/docs/MCP.md +50 -0
- package/package.json +1 -1
|
@@ -9,6 +9,13 @@ import { migrateContractDraft } from "../contract-migration.mjs";
|
|
|
9
9
|
|
|
10
10
|
const hash = value => createHash("sha256").update(value).digest("hex");
|
|
11
11
|
const binary = bytes => bytes?.includes(0) || bytes && !Buffer.from(bytes.toString("utf8")).equals(bytes);
|
|
12
|
+
export function preparedFileDiff(file, left, right, original, next) {
|
|
13
|
+
if (!binary(left) && !binary(right)) return textDiff(file,left?.toString()??null,right?.toString()??null);
|
|
14
|
+
let diff;
|
|
15
|
+
try { diff=execFileSync("git",["diff","--no-index","--binary","--no-ext-diff","--no-textconv","--",left===null?"/dev/null":original,right===null?"/dev/null":next],{encoding:"utf8",maxBuffer:16*1024*1024}); }
|
|
16
|
+
catch(error){if(error.status!==1)throw error;diff=error.stdout;}
|
|
17
|
+
return diff.replace(/^diff --git .+$/m,`diff --git a/${file} b/${file}`);
|
|
18
|
+
}
|
|
12
19
|
function generated(options, relative) {
|
|
13
20
|
const target = path.join(options.root, ".ds", relative);
|
|
14
21
|
mkdirSync(path.dirname(target), {recursive:true});
|
|
@@ -101,13 +108,7 @@ export function prepareUnitPatch(options, {unit, action = "create", draft}) {
|
|
|
101
108
|
if (bytes > 32 * 1024 * 1024) throw new Error("Draft changes exceed 32 MiB.");
|
|
102
109
|
const change = {path:file,originalContent:left === null ? null : binary(left) ? left : left.toString(),content:right === null ? null : binary(right) ? right : right.toString()};
|
|
103
110
|
changes.push(change);
|
|
104
|
-
|
|
105
|
-
else {
|
|
106
|
-
let diff;
|
|
107
|
-
try { diff = execFileSync("git",["diff","--no-index","--binary","--no-ext-diff","--no-textconv","--",left === null ? "/dev/null" : original,right === null ? "/dev/null" : next],{encoding:"utf8",maxBuffer:16*1024*1024}); }
|
|
108
|
-
catch (error) { if (error.status !== 1) throw error; diff=error.stdout; }
|
|
109
|
-
patch += diff.replace(/^diff --git .+$/m,`diff --git a/${file} b/${file}`);
|
|
110
|
-
}
|
|
111
|
+
patch += preparedFileDiff(file,left,right,original,next);
|
|
111
112
|
}
|
|
112
113
|
if (changes.length) checkUnitFiles(options,unit,changes,inventory,true);
|
|
113
114
|
return {unit,draft,changes:changes.map(entry=>entry.path),...storePreparedPatch(options,patch),next:"Apply with ads_apply_patch using this unit and patchFile. Preparation is not validation or publication."};
|
|
@@ -34,6 +34,7 @@ function snapshot(kind, raw) {
|
|
|
34
34
|
return { schemaVersion: 1, resultId, kind, createdAt: new Date().toISOString(), ok: !!raw.ok,
|
|
35
35
|
...(raw.applied !== undefined ? { applied: raw.applied } : {}), ...(raw.unit ? { unit: raw.unit } : {}),
|
|
36
36
|
...(raw.units ? { units: raw.units } : {}), ...(raw.transaction ? { transaction: true } : {}),
|
|
37
|
+
...(raw.draft ? {draft:raw.draft,draftRevision:raw.revision,draftEvent:raw.event?{id:raw.event.id,state:raw.event.state}:null,updatedDependents:raw.updatedDependents??[]} : {}),
|
|
37
38
|
...(kind === "validation" ? {scope:raw.scope,requestedScope:raw.requestedScope,sourceRevision:raw.sourceRevision,current:raw.current,elapsedMs:raw.elapsedMs,...(raw.fallback?{fallback:raw.fallback}:{})} : {}),
|
|
38
39
|
acceptance: raw.acceptance, investigation: raw.investigation,
|
|
39
40
|
sections: Object.fromEntries(Object.entries(sections).map(([key, rows]) => [key, rows.map((row, recordIndex) => ({ recordIndex, ...(row && typeof row === "object" ? row : {message:row}) }))])),
|
|
@@ -49,6 +50,7 @@ function summary(value, storageWarning) {
|
|
|
49
50
|
const section = failedOutcomes.length ? "outcomes" : value.sections.diagnostics.length ? "diagnostics" : value.sections.captures.length ? "captures" : value.sections.outcomes.length ? "outcomes" : "checks";
|
|
50
51
|
const result = { ok, resultId, kind, ...(kind === "validation" ? {scope:value.scope,requestedScope:value.requestedScope,sourceRevision:value.sourceRevision,current:value.current,elapsedMs:value.elapsedMs,...(value.fallback?{fallback:value.fallback}:{})} : {}), ...(applied !== undefined ? { applied } : {}), ...(unit ? { unit } : {}),
|
|
51
52
|
...(units ? { units } : {}), ...(transaction ? { transaction } : {}), createdAt, counts, freshness:"recorded-at-completion",
|
|
53
|
+
...(value.draft?{draft:value.draft,draftRevision:value.draftRevision,draftEvent:value.draftEvent,updatedDependentCount:value.updatedDependents.length}:{}),
|
|
52
54
|
acceptance: compactAcceptance(value.acceptance), failures: value.failurePreview ?? failureRows.slice(0, 3).map(item => compactRow({recordIndex:item.recordIndex,unit:item.unit,check:item.check,status:item.status,rule:item.rule,file:item.file,failure:item.failure,message:item.message},640)),
|
|
53
55
|
failureCount: value.failureCount ?? failureRows.length, resourceUri,
|
|
54
56
|
next: value.detailsUnavailable ? null : { tool: "ads_results", arguments: { resultId, section, ...(section === "outcomes" && failedOutcomes.length ? { status: "not_passed" } : {}) } },
|
package/dist/mcp/mutations.mjs
CHANGED
|
@@ -169,7 +169,7 @@ export function createMutationController(directory, { captures = createCaptureCo
|
|
|
169
169
|
return { ...source, unit, content, offset, nextOffset: end < source.content.length ? end : null, totalChars: source.content.length,
|
|
170
170
|
startLine: source.content.slice(0, offset).split("\n").length };
|
|
171
171
|
},
|
|
172
|
-
async apply({ unit, patch, patchFile, patches, dryRun = false, screenshot = false, captures: selections }, signal, notifyProgress) {
|
|
172
|
+
async apply({ unit, patch, patchFile, patches, dryRun = false, screenshot = false, captures: selections }, signal, notifyProgress, { beforeApply } = {}) {
|
|
173
173
|
if (busy) return mutationEvidence({ ok: false, applied: false, diagnostics: [{ rule: "mutation-busy", message: "Another mutation is validating; retry after it finishes.",failure:evidenceFailure("runner","mutation-execution","ADS_MUTATION_BUSY") }] });
|
|
174
174
|
busy = true;
|
|
175
175
|
active = new AbortController();
|
|
@@ -298,7 +298,10 @@ export function createMutationController(directory, { captures = createCaptureCo
|
|
|
298
298
|
const brand = await generateBrandAssets(candidate);
|
|
299
299
|
verified.push({ name: "brand assets", passed: true, skipped: !!brand.skipped });
|
|
300
300
|
}
|
|
301
|
-
for (const check of extraChecks
|
|
301
|
+
for (const [index,check] of extraChecks.entries()) {
|
|
302
|
+
progress={stage:"project-checks",completed:index,total:extraChecks.length,message:`Checking ${check.command} ${check.args.join(" ")}`};notifyProgress?.(progress);
|
|
303
|
+
verified.push(await checkCommand(check.command, check.args, candidate, signal, undefined, {category:"build",phase:`project-check:${check.args.at(-1)}`}, candidateOptions.config.mcp.mutationCheckTimeoutMs));
|
|
304
|
+
}
|
|
302
305
|
boundary=evidenceFailure("runner","behavior-verification","ADS_BEHAVIOR_SETUP");
|
|
303
306
|
const behaviorUnits = affectedBehaviorUnits(candidateOptions, changes.map(change => change.path));
|
|
304
307
|
if (behaviorUnits.length) {
|
|
@@ -329,6 +332,7 @@ export function createMutationController(directory, { captures = createCaptureCo
|
|
|
329
332
|
screenshots = { ok: true, captures: captures.store.list(inspectScenarios(loadConfig(root)).scenarios, screenshots.baseRevision).captures.filter(record => selected.has(record.key)) };
|
|
330
333
|
}
|
|
331
334
|
if (!dryRun) {
|
|
335
|
+
beforeApply?.();
|
|
332
336
|
const written = [];
|
|
333
337
|
const directories = [];
|
|
334
338
|
function mkdir(directory) { if (!existsSync(directory)) { mkdir(path.dirname(directory)); mkdirSync(directory); directories.push(directory); } }
|
|
@@ -3,6 +3,7 @@ import { randomUUID } from "node:crypto";
|
|
|
3
3
|
import { statSync, mkdirSync, writeFileSync, renameSync, rmSync, realpathSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { Writable } from "node:stream";
|
|
6
7
|
import { buildFailure, inspectBuildStatus } from "./build-status.mjs";
|
|
7
8
|
import { previewSessionDirectories, withPreviewSession } from "../preview-scope.mjs";
|
|
8
9
|
import { developmentExecutable } from "../development-runtime.mjs";
|
|
@@ -32,6 +33,13 @@ export function createPreviewWatch(root, config, { log = process.stderr, buildTi
|
|
|
32
33
|
const baselines = new Map();
|
|
33
34
|
const ready = new Set();
|
|
34
35
|
const requests = new Set();
|
|
36
|
+
function diagnostics(stream){
|
|
37
|
+
// A private writable keeps each pipe's lifecycle/backpressure listeners off
|
|
38
|
+
// the shared stderr socket when several draft/capture compilers are warm.
|
|
39
|
+
const output=new Writable({write(chunk,encoding,done){log.write(chunk,encoding,done);}});
|
|
40
|
+
output.on("error",failure=>{error??=`Preview diagnostics failed: ${failure.message}`;if(state==="running"){state="failed";kill("SIGKILL");}});
|
|
41
|
+
stream.pipe(output);
|
|
42
|
+
}
|
|
35
43
|
let active;
|
|
36
44
|
let invalidation;
|
|
37
45
|
let requestFile = path.join(root, ".ds", `preview-requests-${session}.json`);
|
|
@@ -83,7 +91,7 @@ export function createPreviewWatch(root, config, { log = process.stderr, buildTi
|
|
|
83
91
|
stdio: ["pipe", "ignore", "pipe"], detached: process.platform !== "win32", windowsHide: true,
|
|
84
92
|
});
|
|
85
93
|
guard.stdin.on("error", () => {}); // Owner shutdown can race guard exit.
|
|
86
|
-
guard.stderr
|
|
94
|
+
diagnostics(guard.stderr);
|
|
87
95
|
function guardFailed(failure) {
|
|
88
96
|
if (ownerGuard !== guard || state === "stopping" || childClosed) return;
|
|
89
97
|
error = `Preview ownership guard failed: ${failure.message ?? failure}. Invoke the preview again after fixing the launcher.`;
|
|
@@ -93,8 +101,8 @@ export function createPreviewWatch(root, config, { log = process.stderr, buildTi
|
|
|
93
101
|
guard.once("error", guardFailed);
|
|
94
102
|
guard.once("exit", (code, signal) => guardFailed(signal ?? code));
|
|
95
103
|
}
|
|
96
|
-
child.stdout
|
|
97
|
-
child.stderr
|
|
104
|
+
diagnostics(child.stdout);
|
|
105
|
+
diagnostics(child.stderr);
|
|
98
106
|
closed = new Promise((resolve) => child.once("close", (code, signal) => {
|
|
99
107
|
// Closing the launcher's pipes does not prove every compiler exited.
|
|
100
108
|
// Finish cleanup now, before discarding the owned process-group ID.
|