@reqvire-org/ads 0.3.37 → 0.3.39
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 +5 -1
- package/dist/bootstrap-ds/README.md +2 -2
- package/dist/bootstrap-ds/ds.config.json +2 -0
- package/dist/bootstrap-ds/package.json +1 -1
- package/dist/cli.mjs +16 -5
- package/dist/config.mjs +13 -6
- package/dist/mcp/context.mjs +4 -3
- package/dist/mcp/drafts.mjs +126 -10
- package/dist/mcp/execution-results.mjs +2 -2
- package/dist/mcp/mutations.mjs +3 -2
- package/dist/mcp/preview-owner-guard.mjs +7 -4
- package/dist/mcp/preview-widget.bundle.js +46 -47
- package/dist/mcp/project-widget.bundle.js +45 -46
- package/dist/mcp/server.mjs +20 -7
- package/dist/mcp/widget.bundle.js +47 -48
- package/dist/preview-bun.mjs +5 -2
- package/dist/resource-limits.mjs +146 -0
- package/dist/runtime-requirements.mjs +21 -0
- package/dist/scenarios-compiler.mjs +4 -3
- package/dist/showcase/client.bundle.js +56 -57
- package/dist/showcase/sandbox.bundle.js +1 -1
- package/dist/skills/ads-break-ui/SKILL.md +3 -2
- package/dist/skills/ads-break-ui/references/behaviors.md +8 -4
- package/dist/skills/ads-break-ui/references/drafts.md +26 -5
- package/dist/skills/ads-break-ui/references/guarded-editing.md +4 -2
- package/dist/skills/ads-break-ui/references/runtimes.md +89 -4
- package/dist/skills/ads-break-ui/references/validation.md +43 -25
- package/dist/skills/ads-break-ui/references/workflows.md +4 -3
- package/dist/skills/ads-designer/SKILL.md +10 -5
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +2 -2
- package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +2 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +1 -1
- package/dist/skills/ads-designer/references/behaviors.md +8 -4
- package/dist/skills/ads-designer/references/cli.md +3 -3
- package/dist/skills/ads-designer/references/drafts.md +26 -5
- package/dist/skills/ads-designer/references/guarded-editing.md +4 -2
- package/dist/skills/ads-designer/references/runtimes.md +89 -4
- package/dist/skills/ads-designer/references/validation.md +43 -25
- package/dist/skills/ads-designer/references/workflows.md +4 -3
- package/dist/skills/ads-import/SKILL.md +3 -2
- package/dist/skills/ads-import/references/behaviors.md +8 -4
- package/dist/skills/ads-import/references/cli.md +3 -3
- package/dist/skills/ads-import/references/drafts.md +26 -5
- package/dist/skills/ads-import/references/guarded-editing.md +4 -2
- package/dist/skills/ads-import/references/runtimes.md +89 -4
- package/dist/skills/ads-import/references/validation.md +43 -25
- package/dist/skills/ads-import/references/workflows.md +4 -3
- package/dist/skills/ads-motion/SKILL.md +3 -2
- package/dist/skills/ads-motion/references/behaviors.md +8 -4
- package/dist/skills/ads-motion/references/drafts.md +26 -5
- package/dist/skills/ads-motion/references/guarded-editing.md +4 -2
- package/dist/skills/ads-motion/references/runtimes.md +89 -4
- package/dist/skills/ads-motion/references/validation.md +43 -25
- package/dist/skills/ads-motion/references/workflows.md +4 -3
- package/dist/skills/ads-port/SKILL.md +3 -2
- package/dist/skills/ads-port/references/behaviors.md +8 -4
- package/dist/skills/ads-port/references/cli.md +3 -3
- package/dist/skills/ads-port/references/drafts.md +26 -5
- package/dist/skills/ads-port/references/guarded-editing.md +4 -2
- package/dist/skills/ads-port/references/runtimes.md +89 -4
- package/dist/skills/ads-port/references/validation.md +43 -25
- package/dist/skills/ads-port/references/workflows.md +4 -3
- package/dist/units.mjs +1 -1
- package/dist/validation-checks.mjs +10 -5
- package/dist/validation.mjs +16 -31
- package/dist/verification/browser.mjs +8 -8
- package/docs/ARCHITECTURE.md +8 -4
- package/docs/BEHAVIORS.md +6 -3
- package/docs/CHANGELOG.md +70 -13
- package/docs/GUIDE.md +13 -7
- package/docs/MCP.md +49 -17
- package/package.json +2 -2
package/dist/mcp/server.mjs
CHANGED
|
@@ -23,6 +23,8 @@ import { getWorkflowPrompt, promptDefinitions } from "./prompts.mjs";
|
|
|
23
23
|
import { createReconfigurablePreviewWatch } from "./preview-watch.mjs";
|
|
24
24
|
import { BUILD_URI, buildFailure, inspectBuildStatus, summarizeBuild } from "./build-status.mjs";
|
|
25
25
|
import { GUIDE_URI, projectContext, projectGuide, serverInstructions, workflow } from "./context.mjs";
|
|
26
|
+
import { resourceLimitsStatus } from "../resource-limits.mjs";
|
|
27
|
+
import { assertBunRuntime } from "../runtime-requirements.mjs";
|
|
26
28
|
import { createMutationController, mutationLimits } from "./mutations.mjs";
|
|
27
29
|
import { createPreviewWork } from "./preview-work.mjs";
|
|
28
30
|
import { prepareUnitPatch, storePreparedPatch } from "./edit-preparation.mjs";
|
|
@@ -66,6 +68,7 @@ function resourceQuery(uri, allowed) {
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollInterval = 1000, observeChanges = true, previewWatch, showcaseUrl, notifications, inspection, mutations = false, onBuildChange } = {}) {
|
|
71
|
+
if (process.versions.bun) assertBunRuntime();
|
|
69
72
|
const root = path.resolve(directory);
|
|
70
73
|
let observationClosed = false;
|
|
71
74
|
const cache = inspection ?? {};
|
|
@@ -285,6 +288,8 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
285
288
|
components: catalog.filter((item) => item.kind === "components" && item.apiKind === "ui").length,
|
|
286
289
|
patterns: catalog.filter((item) => item.kind === "patterns" && item.apiKind === "ui").length,
|
|
287
290
|
tokenCount: inspectTokens(root).tokens.length, showcaseUrl: getShowcaseUrl(),
|
|
291
|
+
resourceLimits: resourceLimitsStatus(options.config.resources),
|
|
292
|
+
policies:{acceptance:options.config.acceptance,validation:options.config.validation},
|
|
288
293
|
previewWatch: previewWatch?.status() ?? { state: "disabled" },
|
|
289
294
|
mutations: mutations ? { ...mutationState, progress: compactProgress(mutationState.progress), lastResult: executionResults.latest("mutation") } : { enabled: false },
|
|
290
295
|
drafts: { mode:"auto", enabled:mutations, resourceUri:DRAFTS_URI, listTool:"ads_drafts", previewTool:"ads_show_draft", acceptTool:"ads_accept", previewOnly:isDraftPreviewWorkspace(root), events:drafts.events().slice(-3) },
|
|
@@ -408,17 +413,18 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
408
413
|
function tools() {
|
|
409
414
|
return [
|
|
410
415
|
{ name:"ads_drafts", description:"List only tracked ADS drafts, including owner units, exact revisions, conflicts, dependencies and recent acceptance/drop events. Use id for paged file mappings. Drafts survive restart/Git clone; generated previews and execution evidence do not. Read ads://guides/drafts. Finish a coherent design change by accepting its drafts after rendered review; never report a draft-only preview as completed work.", schema:query.extend({id:draftIdSchema.optional(),unit:z.string().max(256).optional(),offset:z.number().int().min(0).default(0)}), call:args=>json(drafts.list(args)) },
|
|
411
|
-
{ name:"ads_show_draft", title:"Draft preview", description:"Prepare/reuse an isolated compiler workspace for a tracked draft and its dependency drafts. Returns a browser showcase URL and available scenarios without running acceptance checks. Existing @ds imports resolve the proposed overlay only here. Inspect the actual rendered result; then accept the exact returned revision. For comparison, open comparisonUrl in DS Explorer and use Split view. New owners have no accepted comparison.", schema:z.object({id:draftIdSchema,scenario:z.string().max(256).optional()}).strict(), _meta:{ui:{resourceUri:scenarioWidget()}}, annotations:{...annotations,readOnlyHint:false,idempotentHint:false}, call:async (args,signal)=>{
|
|
416
|
+
{ name:"ads_show_draft", title:"Draft preview", description:"Prepare/reuse an isolated compiler workspace for a tracked draft and its dependency drafts. Returns a browser showcase URL and available scenarios without running acceptance checks. Registry failures return the draft-private diagnostics and diagnosticsUri, never the accepted registry. Existing @ds imports resolve the proposed overlay only here. Inspect the actual rendered result; then accept the exact returned revision. For comparison, open comparisonUrl in DS Explorer and use Split view. New owners have no accepted comparison.", schema:z.object({id:draftIdSchema,scenario:z.string().max(256).optional()}).strict(), _meta:{ui:{resourceUri:scenarioWidget()}}, annotations:{...annotations,readOnlyHint:false,idempotentHint:false}, call:async (args,signal)=>{
|
|
412
417
|
const value=await drafts.show(args,signal),base=getShowcaseUrl();
|
|
413
418
|
let comparisonUrl=null;
|
|
414
419
|
if(base){const url=new URL(base);url.searchParams.set("draft",args.id);if(value.scenario)url.searchParams.set("scenario",value.scenario);if(value.acceptedExists)url.searchParams.set("split","1");comparisonUrl=url.href;}
|
|
415
|
-
|
|
420
|
+
const response=json({...value,isolatedShowcaseUrl:value.showcaseUrl,showcaseUrl:comparisonUrl??value.showcaseUrl,comparisonUrl});
|
|
421
|
+
return value.ok===false?{...response,isError:true}:response;
|
|
416
422
|
} },
|
|
417
423
|
...(mutations ? [
|
|
418
424
|
{ name:"ads_create_draft", description:"Create a Git-committable proposal under ads-drafts/ for 1–64 coupled ADS owners, copying only their source/companions into non-importable .ads files. New owners are allowed. Optional dependencies name separate unaccepted drafts used by pattern/composition previews. Creation does not change accepted source. Edit the returned files normally; use ads_update_draft to register additions/deletions.", schema:z.object({units:z.array(z.string().min(1).max(256)).min(1).max(mutationLimits.units),title:z.string().min(1).max(160).optional(),id:draftIdSchema.optional(),dependencies:z.array(draftIdSchema).max(8).default([]),tokenGroups:z.array(z.string().min(1).max(160)).max(32).default([])}).strict(),_meta:{ui:{visibility:["model"]}},annotations:{...annotations,readOnlyHint:false,idempotentHint:false},call:async args=>{const result=drafts.create(args);if(observeChanges)await refresh();return json(result);} },
|
|
419
|
-
{ 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. 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,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);} },
|
|
425
|
+
{ 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);} },
|
|
420
426
|
{ 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);} },
|
|
421
|
-
{ 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
|
|
427
|
+
{ 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)=>{
|
|
422
428
|
if(validation.status().busy||verification.status().running)throw new Error("Wait for validation/verification before acceptance.");
|
|
423
429
|
const result=await drafts.accept(args,signal,progress);
|
|
424
430
|
if(result.applied){await previewWatch?.invalidate?.();await refresh(true);}else await refresh();
|
|
@@ -503,7 +509,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
503
509
|
{ 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) },
|
|
504
510
|
{ 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) },
|
|
505
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)) },
|
|
506
|
-
{ name: "ads_validate", description: "Run
|
|
512
|
+
{ 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) => {
|
|
507
513
|
if (verification.status().running || edits.status().busy) throw new Error("Wait for the active verification or guarded edit before validating.");
|
|
508
514
|
return finishExecution("validation",await validation.run(args,signal,progress));
|
|
509
515
|
} },
|
|
@@ -562,6 +568,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
562
568
|
return { resources: listing.items, ...(listing.nextCursor ? { nextCursor: listing.nextCursor } : {}) };
|
|
563
569
|
});
|
|
564
570
|
server.setRequestHandler("resources/templates/list", () => ({ resourceTemplates: [
|
|
571
|
+
{ uriTemplate: "ads://drafts/{id}/resource?uri=ads%3A%2F%2Fproject%2Fscenarios", name:"Draft scenario diagnostics",description:"Draft-private registry and diagnostics; accepted ads://project/scenarios is a separate registry.",mimeType:"application/json" },
|
|
565
572
|
{ uriTemplate: "ads://drafts/{id}/resource?uri=ads%3A%2F%2Fproject%2Fbuild", name: "Draft preview build status", description: "Use preview.resourceUri from ads_drafts or ads://project/build. Available while the draft preview session is active; updates on build completion and failure.", mimeType: "application/json" },
|
|
566
573
|
{ uriTemplate: "ads://captures/{key}/{slot}", name: "Current/candidate screenshot", description: "Exact keys and available slots come from ads://project/captures. Slots are replaced in place, not revision history.", mimeType: "image/png" },
|
|
567
574
|
{ uriTemplate: "ads://results/{resultId}", name: "Saved execution summary", description: "Use resultId from execution or ads://project/results. Query section/status/cursor/limit for pages, or section/recordIndex/offset/chars for exact record ranges. Only the latest result of each kind remains available.", mimeType: "application/json" },
|
|
@@ -695,7 +702,9 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
695
702
|
const targets = discoveryChanged ? (era === "modern" ? resources().map((entry) => entry.uri).filter((uri) => !skills.files.has(uri)) : [...subscribed]).filter(uri => !uri.startsWith("ads://drafts/"))
|
|
696
703
|
: [BUILD_URI, BEHAVIOR_URI, INVESTIGATIONS_URI, DRAFTS_URI, `${PROJECT_URI}/status`, ...(filesChanged ? [`${PROJECT_URI}/tokens`] : []), ...(options.config.mcp.previewManifest ? [PREVIEW_MANIFEST_URI, LIVE_PREVIEW_MANIFEST_URI] : []), ...(artifactsChanged ? allApps(true).map(app => appUri(app.id)) : [])].filter((uri) => era === "modern" || subscribed.has(uri));
|
|
697
704
|
if((discoveryChanged||draftsChanged)&&(era==="modern"||subscribed.has(`${PROJECT_URI}/explorer`)))targets.push(`${PROJECT_URI}/explorer`);
|
|
698
|
-
if(draftsChanged){
|
|
705
|
+
if(draftsChanged){
|
|
706
|
+
targets.push(...[...new Set([...previousDraftBuilds.keys(),...currentDraftBuilds.keys()])].map(uri=>uri.replace(encodeURIComponent(BUILD_URI),encodeURIComponent(`${PROJECT_URI}/scenarios`))).filter(uri=>era==="modern"||subscribed.has(uri)));
|
|
707
|
+
targets.push(...[DRAFTS_URI,`${PROJECT_URI}/catalog`,`${PROJECT_URI}/scenarios`,`${PROJECT_URI}/status`].filter(uri=>era==="modern"||subscribed.has(uri)));previousDrafts=draftFingerprint;}
|
|
699
708
|
targets.push(...changedDraftBuilds.filter(uri=>era==="modern"||subscribed.has(uri)));
|
|
700
709
|
previousDraftBuilds=currentDraftBuilds;
|
|
701
710
|
if(resultsChanged){targets.push(...[RESULTS_URI,...executionResults.index().results.map(entry=>entry.resourceUri),...[...subscribed].filter(uri=>uri.startsWith("ads://results/"))].filter(uri=>era==="modern"||subscribed.has(uri)));previousResults=executionResults.fingerprint();}
|
|
@@ -734,6 +743,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
734
743
|
}
|
|
735
744
|
|
|
736
745
|
export async function startAdsMcp(directory = process.cwd(), { stdio = true, showcase = true, port = 0, mutations = false, previewWork = createPreviewWork(), previewBuildTimeoutMs = 30000, prewarm = stdio } = {}) {
|
|
746
|
+
if (process.versions.bun) assertBunRuntime();
|
|
737
747
|
// Fail before opening the transport for configuration/distribution errors.
|
|
738
748
|
const { root, config } = loadConfig(directory);
|
|
739
749
|
const inspection = { skills: createSkillStore(), previewWork };
|
|
@@ -762,7 +772,10 @@ export async function startAdsMcp(directory = process.cwd(), { stdio = true, sho
|
|
|
762
772
|
});
|
|
763
773
|
buildWatcher.unref(); buildWatcher.on("error", () => { buildWatcher.close(); });
|
|
764
774
|
} catch { /* Periodic observation also covers replaced/missing report directories. */ }
|
|
765
|
-
|
|
775
|
+
// Modern stdio negotiation can spawn a disposable probe process. Its
|
|
776
|
+
// metadata requests must not start a compiler; oninitialized starts the real
|
|
777
|
+
// connection's shared compiler. HTTP-only hosts can warm immediately.
|
|
778
|
+
const warmStart=prewarm&&!stdio?setTimeout(()=>previewWatch.start(),0):undefined;
|
|
766
779
|
warmStart?.unref();
|
|
767
780
|
let closing;
|
|
768
781
|
function close() {
|