;
diff --git a/packages/schema/test/api-validation.test.ts b/packages/schema/test/api-validation.test.ts
index 98164f7..f766ac1 100644
--- a/packages/schema/test/api-validation.test.ts
+++ b/packages/schema/test/api-validation.test.ts
@@ -565,13 +565,13 @@ describe("apiAuthSourceSchema pattern validation", () => {
});
});
-describe("apiBlockSchema endpoints requirement", () => {
- it("rejects an empty endpoints object", () => {
+describe("apiBlockSchema endpoints", () => {
+ it("allows an empty endpoints object for DOM-only packages", () => {
const result = apiBlockSchema.safeParse({
baseUrl: "https://acme.com",
endpoints: {},
});
- expect(result.success).toBe(false);
+ expect(result.success).toBe(true);
});
it("accepts a single endpoint", () => {
diff --git a/packages/schema/test/dom-validation.test.ts b/packages/schema/test/dom-validation.test.ts
new file mode 100644
index 0000000..5d53461
--- /dev/null
+++ b/packages/schema/test/dom-validation.test.ts
@@ -0,0 +1,145 @@
+import { describe, expect, it } from "vitest";
+import {
+ createPackageSchema,
+ executionDescriptorSchema,
+ publishVersionSchema,
+ publishVersionSchemaForDomain,
+ webMcpPackageSchema,
+} from "../src/index.js";
+
+const domTool = {
+ name: "checkout_status",
+ description: "Check whether checkout is ready.",
+ inputSchema: { type: "object", properties: {}, additionalProperties: false },
+ annotations: { readOnlyHint: true, untrustedContentHint: true },
+ execution: {
+ mode: "dom",
+ observations: {
+ pay_button: { role: "button", name: "Pay now", read: "disabled" },
+ terms: { role: "checkbox", name: "Accept terms", read: "checked" },
+ },
+ },
+};
+
+function domPackage() {
+ return {
+ version: 1,
+ domain: "en.wikipedia.org",
+ urlPatterns: ["*://en.wikipedia.org/*"],
+ title: "Checkout status",
+ description: "Read-only checkout structure.",
+ minEngine: 2,
+ tools: [structuredClone(domTool)],
+ api: { baseUrl: "https://en.wikipedia.org", endpoints: {} },
+ };
+}
+
+describe("DOM execution descriptor", () => {
+ it("accepts bounded semantic observations and an inert api block", () => {
+ expect(executionDescriptorSchema.safeParse(domTool.execution).success).toBe(true);
+ expect(createPackageSchema.safeParse(domPackage()).success).toBe(true);
+ });
+
+ it("requires normalized exact names and valid role/read combinations", () => {
+ const decomposed = structuredClone(domTool.execution);
+ decomposed.observations.pay_button.name = "Pay now";
+ expect(executionDescriptorSchema.safeParse(decomposed).success).toBe(false);
+
+ const invalidRead = structuredClone(domTool.execution);
+ invalidRead.observations.pay_button.read = "checked";
+ expect(executionDescriptorSchema.safeParse(invalidRead).success).toBe(false);
+
+ const overBytes = structuredClone(domTool.execution);
+ overBytes.observations.pay_button.name = "界".repeat(200);
+ expect(executionDescriptorSchema.safeParse(overBytes).success).toBe(false);
+
+ const withinBytes = structuredClone(domTool.execution);
+ withinBytes.observations.pay_button.name = "é".repeat(200);
+ expect(executionDescriptorSchema.safeParse(withinBytes).success).toBe(true);
+ });
+
+ it("rejects mutation vocabulary and selectors in strict descriptors", () => {
+ expect(
+ executionDescriptorSchema.safeParse({ ...domTool.execution, action: "click" }).success,
+ ).toBe(false);
+ expect(
+ executionDescriptorSchema.safeParse({ ...domTool.execution, selector: "button" }).success,
+ ).toBe(false);
+ expect(
+ executionDescriptorSchema.safeParse({ ...domTool.execution, value: "secret" }).success,
+ ).toBe(false);
+ expect(
+ executionDescriptorSchema.safeParse({ ...domTool.execution, submit: true }).success,
+ ).toBe(false);
+ });
+
+ it("requires empty read-only, untrusted DOM tool inputs and engine level 2", () => {
+ const nonEmptyInput = {
+ ...domPackage(),
+ tools: [
+ {
+ ...structuredClone(domTool),
+ inputSchema: {
+ type: "object",
+ properties: { submit: { type: "string" } },
+ additionalProperties: false,
+ },
+ },
+ ],
+ };
+ expect(createPackageSchema.safeParse(nonEmptyInput).success).toBe(false);
+
+ const destructive = {
+ ...domPackage(),
+ tools: [
+ {
+ ...structuredClone(domTool),
+ annotations: { ...domTool.annotations, destructiveHint: true },
+ },
+ ],
+ };
+ expect(createPackageSchema.safeParse(destructive).success).toBe(false);
+
+ const oldEngine = domPackage();
+ oldEngine.minEngine = 1;
+ expect(createPackageSchema.safeParse(oldEngine).success).toBe(false);
+ });
+
+ it("continues to reject API tools with a missing endpoint", () => {
+ const invalid = {
+ ...domPackage(),
+ tools: [
+ {
+ ...structuredClone(domTool),
+ execution: { mode: "api", endpoint: "missing" },
+ },
+ ],
+ };
+ expect(createPackageSchema.safeParse(invalid).success).toBe(false);
+ });
+
+ it("enforces the DOM engine floor across every package envelope", () => {
+ const body = domPackage();
+ body.minEngine = 1;
+ expect(createPackageSchema.safeParse(body).success).toBe(false);
+ const version = {
+ version: body.version,
+ urlPatterns: body.urlPatterns,
+ tools: body.tools,
+ api: body.api,
+ minEngine: body.minEngine,
+ };
+ expect(publishVersionSchema.safeParse(version).success).toBe(false);
+ expect(publishVersionSchemaForDomain(body.domain).safeParse(version).success).toBe(false);
+ expect(
+ webMcpPackageSchema.safeParse({
+ ...body,
+ id: "pkg-dom",
+ versionId: "ver-dom",
+ contributor: "fixture",
+ createdAt: "2026-09-02T00:00:00.000Z",
+ updatedAt: "2026-09-02T00:00:00.000Z",
+ }).success,
+ ).toBe(false);
+ });
+});
From 5c466a3b33cfcbb6adf7c2373cbb74fa833ed32b Mon Sep 17 00:00:00 2001
From: robertn702 <8119609+robertn702@users.noreply.github.com>
Date: Wed, 2 Sep 2026 22:25:48 +0000
Subject: [PATCH 2/2] fix(engine): repair DOM package contract
---
ARCHITECTURE.md | 6 +-
apps/extension/AGENTS.md | 6 +-
apps/extension/src/lib/register-tools.ts | 2 +-
.../(registry)/docs/package-format/page.tsx | 7 +-
bun.lock | 14 ++--
docs/api-execution-model.md | 2 +-
docs/release-security.md | 33 +++++----
packages/engine/package.json | 4 +-
packages/engine/src/dom-executor.ts | 3 +-
packages/engine/test/dom-executor.test.ts | 8 ++-
packages/schema/package.json | 2 +-
scripts/check-engine-package.mjs | 72 +++++++++++++++----
12 files changed, 108 insertions(+), 51 deletions(-)
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 6c13682..69a102a 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -175,8 +175,10 @@ Two execution modes are selected per tool:
- **API mode (tier 1)** — the package declares the site's own HTTP API as data
(`api.endpoints`, `auth` token sources, `returns` projections); the executor derives
and performs the call. Ships zero code. The load-bearing invariant: **`api.baseUrl`
- must use the package domain or a subdomain, and every derived request is pinned to
- that exact origin after interpolation**. `urlPatterns` select pages for tool
+ must normally use the package domain or a subdomain, and every derived request is
+ pinned to that exact origin after interpolation**. The sole cross-origin exception is
+ anonymous `GET` reads from `https://hacker-news.firebaseio.com`, with no auth,
+ omitted cookies, and rejected redirects. `urlPatterns` select pages for tool
registration; they do not constrain `api.baseUrl` or need to cover it. Tiers 2–3 (scoped script slots, full `evaluate`) are designed
but not shipped — see `docs/api-execution-model.md`.
- **DOM mode (level 2)** — reads only a bounded, top-level light-DOM set of exact
diff --git a/apps/extension/AGENTS.md b/apps/extension/AGENTS.md
index e6dcecd..79df277 100644
--- a/apps/extension/AGENTS.md
+++ b/apps/extension/AGENTS.md
@@ -170,8 +170,10 @@ package(s) matched this URL` → bridge `list_webmcp_tools` shows the tools.
- The executors live in `packages/engine` (`@webmcp-today/engine`, MIT) —
extracted from `src/lib/` for license separation (docs/DECISIONS.md 2026-07-30):
`api-executor.ts` binds `{{param}}` templates, acquires auth
- tokens from `api.auth` sources, performs the same-origin fetch, checks
- `errorPath`, applies the `returns` JMESPath projection. `destructiveHint`
+ tokens from `api.auth` sources, performs the origin-pinned fetch, checks
+ `errorPath`, applies the `returns` JMESPath projection. The sole cross-origin
+ exception is anonymous `GET` reads from `https://hacker-news.firebaseio.com`,
+ with no auth, omitted cookies, and rejected redirects. `destructiveHint`
tools gate on a blocking `window.confirm`. The fetch MUST run in the
content-script (page) context — the SameSite-cookie rationale is the header
comment in `packages/engine/src/api-executor.ts`. `dom-executor.ts` is a separate
diff --git a/apps/extension/src/lib/register-tools.ts b/apps/extension/src/lib/register-tools.ts
index c89c287..43d7397 100644
--- a/apps/extension/src/lib/register-tools.ts
+++ b/apps/extension/src/lib/register-tools.ts
@@ -96,7 +96,7 @@ export async function runRegistrationPass(
execute = (params) => executeApiTool({ ...tool, execution }, api, params);
} else {
execute = (params) =>
- executeDomTool(tool, params, {
+ executeDomTool({ ...tool, execution }, params, {
document: deps.getDocument(),
registrationUrl: url,
signal,
diff --git a/apps/web/app/(registry)/docs/package-format/page.tsx b/apps/web/app/(registry)/docs/package-format/page.tsx
index 0806dd7..4a0678c 100644
--- a/apps/web/app/(registry)/docs/package-format/page.tsx
+++ b/apps/web/app/(registry)/docs/package-format/page.tsx
@@ -21,9 +21,10 @@ export default function PackageFormatPage() {
The package format
A package is one JSON document. It names the site it targets, the tools it registers there,
- and the site's own HTTP endpoints those tools call. Nothing in it can run arbitrary
- code in the page: a tool is a declared request, not a script. This page covers every field.
- When you're ready,{" "}
+ and the API metadata they use, which is an inert same-site block for DOM-only packages. Each
+ tool declares either an HTTP request or a bounded read-only DOM observation. Nothing in it
+ can run arbitrary code in the page: tools are declarations, not scripts. This page covers
+ every field. When you're ready,{" "}
paste it into the form
diff --git a/bun.lock b/bun.lock
index 3433026..24de3e1 100644
--- a/bun.lock
+++ b/bun.lock
@@ -108,10 +108,10 @@
},
"packages/engine": {
"name": "@webmcp-today/engine",
- "version": "0.1.0",
+ "version": "0.2.0",
"dependencies": {
"@jmespath-community/jmespath": "1.3.0",
- "@webmcp-today/schema": "0.3.0",
+ "@webmcp-today/schema": "0.4.0",
},
"devDependencies": {
"linkedom": "0.18.13",
@@ -121,13 +121,13 @@
},
"packages/mcp": {
"name": "@webmcp-today/mcp-bridge",
- "version": "0.3.0",
+ "version": "0.3.1",
"bin": {
- "webmcp-today-mcp": "./dist/index.js",
+ "webmcp-today-mcp": "dist/index.js",
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.17.0",
- "@webmcp-today/schema": "workspace:*",
+ "@webmcp-today/schema": "0.3.0",
"zod": "^4.0.0",
},
"devDependencies": {
@@ -139,7 +139,7 @@
},
"packages/schema": {
"name": "@webmcp-today/schema",
- "version": "0.3.0",
+ "version": "0.4.0",
"dependencies": {
"@jmespath-community/jmespath": "1.3.0",
"tldts": "7.4.10",
@@ -2366,6 +2366,8 @@
"@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@5.0.1", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],
+ "@webmcp-today/mcp-bridge/@webmcp-today/schema": ["@webmcp-today/schema@0.3.0", "", { "dependencies": { "@jmespath-community/jmespath": "1.3.0", "tldts": "7.4.10", "zod": "^4.0.0" } }, "sha512-nGC0WmeV7QjLpT3hh79y+T3MFy34Ab1wX9PvjzUzVL2hY/hB8qVUHC6rBaJf/PEFZP49aPUe6FHSy3d/15rEOw=="],
+
"@wxt-dev/storage/@wxt-dev/browser": ["@wxt-dev/browser@0.1.43", "", { "dependencies": { "@types/filesystem": "*", "@types/har-format": "*" } }, "sha512-RMB0zgfe7uuiTp18s9taLeKXoOCLBV418797dnEggiMWmM1JDJekiLtlvrNc6QeZg+amDBy2/KKYuQB2kh/K9A=="],
"ajv-formats/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
diff --git a/docs/api-execution-model.md b/docs/api-execution-model.md
index f92df39..c406b0a 100644
--- a/docs/api-execution-model.md
+++ b/docs/api-execution-model.md
@@ -28,7 +28,7 @@ Flagship target: a **read + write Reddit package** backed by its JSON API — re
threads, plus posting comments — controllable from a terminal LLM through WebMCP. That
requires authenticated writes, which forces the token-acquisition design below.
-API execution remains the general execution model. Engine level 2 also supports a deliberately narrow DOM read mode: exact semantic role/name observations with only `exists`, `disabled`, `checked`, or `required` boolean output. It cannot use selectors, values, HTML, frames, shadow roots, or mutation operations. DOM-only packages currently carry an inert same-site `api` block with `endpoints: {}`; publishing this format requires schema and engine minor releases and `minEngine: 2`.
+API execution remains the general execution model. Engine level 2 also supports a deliberately narrow DOM read mode: exact semantic role/name observations with `matched` and only `disabled`, `checked`, or `required` boolean output. It cannot use selectors, values, HTML, frames, shadow roots, or mutation operations. DOM-only packages currently carry an inert same-site `api` block with `endpoints: {}`; publishing this format requires schema and engine minor releases and `minEngine: 2`.
## Tiered execution model
diff --git a/docs/release-security.md b/docs/release-security.md
index a43b908..7f771a5 100644
--- a/docs/release-security.md
+++ b/docs/release-security.md
@@ -16,10 +16,10 @@ exists anywhere in the repository or environment, and npm records publish
provenance automatically. The publish job holds only `contents: read` and
`id-token: write`, and every action is pinned to a full commit SHA.
-The first `@webmcp-today/engine` publication is a one-time human-run bootstrap
-using the maintainer's npm credentials and the reviewed commands below. It does
-not use the OIDC workflow, so the publisher must verify the exact checkout and
-tarball contents before approving the command.
+`@webmcp-today/engine` releases are human-run using the maintainer's npm
+credentials and the reviewed commands below. They do not use the OIDC workflow,
+so the publisher must verify the exact checkout and tarball contents before
+approving the command.
## Checksum scope
@@ -78,21 +78,27 @@ environment, and the required reviewer is the last line of defense for a
legitimate tag run. Review the exact workflow file being executed before
approving any run.
-## First engine publication
+## Engine publication
-The proposed first version is `@webmcp-today/engine@0.1.0`. This first bootstrap
-is a human-run npm publication; do not add the engine to the automated OIDC
-workflow until a later, separately reviewed release process requires it.
+Engine releases remain human-run npm publications; do not add the engine to the
+automated OIDC workflow until a later, separately reviewed release process
+requires it.
-Before publishing, confirm that `@webmcp-today/schema@0.3.0` is public (the
-engine's exact runtime dependency), the reviewed commit is checked out, and the
-package gate passes:
+For the DOM execution release, publish `@webmcp-today/schema@0.4.0` first, then
+confirm it is public before publishing `@webmcp-today/engine@0.2.0` (which pins
+that exact runtime dependency). The reviewed commit must be checked out and the
+package gate must pass:
```bash
-bun run check:engine-package
+bun run check:engine-package --published-schema
(cd packages/engine && npm publish --dry-run --access public)
```
+CI runs the same gate without `--published-schema`, installing locally packed
+schema and engine tarballs so an unpublished release pair can be reviewed. The
+release-mode flag installs only the engine tarball and requires npm to supply
+the pinned schema version that was published first.
+
The human publisher must be authenticated to npm with permission to publish the
`@webmcp-today` scope and must inspect the dry-run tarball before running this
exact command from `packages/engine`:
@@ -101,9 +107,6 @@ exact command from `packages/engine`:
npm publish --access public
```
-ROB-216 prepares this command only. It does not publish, release, merge, or
-deploy `@webmcp-today/engine`.
-
### One-time npm Trusted Publisher configuration
Configure a Trusted Publisher per package on npmjs.com (the `npm trust` flow if
diff --git a/packages/engine/package.json b/packages/engine/package.json
index 6927ce8..3853b82 100644
--- a/packages/engine/package.json
+++ b/packages/engine/package.json
@@ -1,6 +1,6 @@
{
"name": "@webmcp-today/engine",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Execution engine for WebMCP Today — runs declarative API calls and bounded read-only DOM observations",
"type": "module",
"license": "MIT",
@@ -30,7 +30,7 @@
},
"dependencies": {
"@jmespath-community/jmespath": "1.3.0",
- "@webmcp-today/schema": "0.3.0"
+ "@webmcp-today/schema": "0.4.0"
},
"devDependencies": {
"linkedom": "0.18.13",
diff --git a/packages/engine/src/dom-executor.ts b/packages/engine/src/dom-executor.ts
index 4f1516b..bccd678 100644
--- a/packages/engine/src/dom-executor.ts
+++ b/packages/engine/src/dom-executor.ts
@@ -1,6 +1,7 @@
import {
toolDescriptorSchema,
validateToolInput,
+ type DomExecution,
type DomObservation,
type ToolDescriptor,
} from "@webmcp-today/schema";
@@ -28,7 +29,7 @@ const PRUNED_TAGS = new Set([
]);
const TEXT_EXCLUDED_TAGS = new Set(["INPUT", "TEXTAREA", ...PRUNED_TAGS]);
-export type DomToolDescriptor = ToolDescriptor;
+export type DomToolDescriptor = Omit & { execution: DomExecution };
export interface DomExecutionContext {
document: Document;
diff --git a/packages/engine/test/dom-executor.test.ts b/packages/engine/test/dom-executor.test.ts
index d813558..b4c06d5 100644
--- a/packages/engine/test/dom-executor.test.ts
+++ b/packages/engine/test/dom-executor.test.ts
@@ -1,18 +1,20 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { parseHTML } from "linkedom";
import { toolDescriptorSchema } from "@webmcp-today/schema";
-import { executeDomTool } from "../src/dom-executor.js";
+import { executeDomTool, type DomToolDescriptor } from "../src/dom-executor.js";
const URL = "https://example.com/checkout";
-function tool(observations: Record) {
- return toolDescriptorSchema.parse({
+function tool(observations: Record): DomToolDescriptor {
+ const parsed = toolDescriptorSchema.parse({
name: "checkout_status",
description: "Read checkout status.",
inputSchema: { type: "object", properties: {}, additionalProperties: false },
annotations: { readOnlyHint: true, untrustedContentHint: true },
execution: { mode: "dom", observations },
});
+ if (parsed.execution.mode !== "dom") throw new Error("expected DOM tool descriptor");
+ return { ...parsed, execution: parsed.execution };
}
function page(html: string, url = URL) {
diff --git a/packages/schema/package.json b/packages/schema/package.json
index 5db435a..2a637c0 100644
--- a/packages/schema/package.json
+++ b/packages/schema/package.json
@@ -1,6 +1,6 @@
{
"name": "@webmcp-today/schema",
- "version": "0.3.0",
+ "version": "0.4.0",
"description": "Config format for WebMCP Today — zod schemas for community WebMCP tool configs",
"type": "module",
"license": "MIT",
diff --git a/scripts/check-engine-package.mjs b/scripts/check-engine-package.mjs
index bbaedd6..3ad287a 100644
--- a/scripts/check-engine-package.mjs
+++ b/scripts/check-engine-package.mjs
@@ -1,12 +1,18 @@
#!/usr/bin/env bun
-/* global console */
+/* global console, process */
import { spawnSync } from "node:child_process";
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { join, resolve } from "node:path";
const repoRoot = resolve(import.meta.dirname, "..");
const engineDir = join(repoRoot, "packages/engine");
+const schemaDir = join(repoRoot, "packages/schema");
const scratchDir = join(repoRoot, ".scratch");
+const usePublishedSchema = process.argv.includes("--published-schema");
+
+if (process.argv.slice(2).some((argument) => argument !== "--published-schema")) {
+ throw new Error("usage: bun scripts/check-engine-package.mjs [--published-schema]");
+}
function fail(message) {
throw new Error(message);
@@ -21,6 +27,15 @@ function run(command, args, cwd) {
return result.stdout;
}
+function packPackage(packageDir, packDir) {
+ const output = run("npm", ["pack", "--json", "--pack-destination", packDir], packageDir);
+ const jsonStart = output.lastIndexOf("\n[");
+ const [packed] = JSON.parse(output.slice(jsonStart === -1 ? 0 : jsonStart));
+ if (!packed?.filename || !Array.isArray(packed.files))
+ fail(`npm pack did not report a tarball file list for ${packageDir}`);
+ return packed;
+}
+
let tempDir;
try {
@@ -29,14 +44,13 @@ try {
const packDir = join(tempDir, "pack");
mkdirSync(packDir);
- const packOutput = run("npm", ["pack", "--json", "--pack-destination", packDir], engineDir);
- const packJsonStart = packOutput.lastIndexOf("\n[");
- const [packed] = JSON.parse(packOutput.slice(packJsonStart === -1 ? 0 : packJsonStart));
- if (!packed?.filename || !Array.isArray(packed.files))
- fail("npm pack did not report a tarball file list");
+ const schemaPackage = JSON.parse(readFileSync(join(schemaDir, "package.json"), "utf8"));
+ if (typeof schemaPackage.version !== "string") fail("schema package has no version");
+ const packedSchema = usePublishedSchema ? null : packPackage(schemaDir, packDir);
+ const packed = packPackage(engineDir, packDir);
const packedFiles = new Set(packed.files.map((file) => file.path));
- const modules = ["index", "api-executor", "engine-gate", "mcp-result", "result"];
+ const modules = ["index", "api-executor", "dom-executor", "engine-gate", "mcp-result", "result"];
const requiredFiles = [
"package.json",
"LICENSE",
@@ -53,24 +67,37 @@ try {
const consumerDir = join(tempDir, "consumer");
mkdirSync(consumerDir);
writeFileSync(join(consumerDir, "package.json"), '{"private":true,"type":"module"}\n');
- const tarball = join(packDir, packed.filename);
- run("npm", ["install", "--ignore-scripts", "--no-audit", "--no-fund", tarball], consumerDir);
+ const engineTarball = join(packDir, packed.filename);
+ const installTargets = [engineTarball];
+ if (packedSchema !== null) installTargets.unshift(join(packDir, packedSchema.filename));
+ run(
+ "npm",
+ ["install", "--ignore-scripts", "--no-audit", "--no-fund", ...installTargets],
+ consumerDir,
+ );
const installedPackage = JSON.parse(
readFileSync(join(consumerDir, "node_modules/@webmcp-today/engine/package.json"), "utf8"),
);
- if (installedPackage.dependencies?.["@webmcp-today/schema"] !== "0.3.0") {
- fail("packed engine must pin @webmcp-today/schema to 0.3.0");
+ const installedSchema = JSON.parse(
+ readFileSync(join(consumerDir, "node_modules/@webmcp-today/schema/package.json"), "utf8"),
+ );
+ if (installedPackage.dependencies?.["@webmcp-today/schema"] !== schemaPackage.version) {
+ fail(`packed engine must pin @webmcp-today/schema to ${schemaPackage.version}`);
+ }
+ if (installedSchema.version !== schemaPackage.version) {
+ fail(`consumer installed schema ${installedSchema.version}, expected ${schemaPackage.version}`);
}
const testFile = join(consumerDir, "engine.test.mjs");
writeFileSync(
testFile,
`import { expect, test } from "bun:test";
-import { buildRequest, executeApiTool, handleResponse } from "@webmcp-today/engine";
+import { buildRequest, executeApiTool, executeDomTool, handleResponse } from "@webmcp-today/engine";
test("exposes the engine package API", () => {
expect(typeof executeApiTool).toBe("function");
+ expect(typeof executeDomTool).toBe("function");
expect(typeof buildRequest).toBe("function");
expect(typeof handleResponse).toBe("function");
});
@@ -85,9 +112,12 @@ test("exposes the engine package API", () => {
`import {
buildRequest,
executeApiTool,
+ executeDomTool,
handleResponse,
type ApiToolDescriptor,
type DerivedRequest,
+ type DomExecutionContext,
+ type DomToolDescriptor,
type FetchOutcome,
type McpResult,
type McpTextContent,
@@ -95,10 +125,24 @@ test("exposes the engine package API", () => {
declare const tool: ApiToolDescriptor;
declare const request: DerivedRequest;
+declare const domContext: DomExecutionContext;
+declare const domTool: DomToolDescriptor;
declare const outcome: FetchOutcome;
declare const result: McpResult;
declare const content: McpTextContent;
-void [buildRequest, executeApiTool, handleResponse, tool, request, outcome, result, content];
+void [
+ buildRequest,
+ executeApiTool,
+ executeDomTool,
+ handleResponse,
+ tool,
+ request,
+ domContext,
+ domTool,
+ outcome,
+ result,
+ content,
+];
`,
);
writeFileSync(
@@ -126,7 +170,7 @@ void [buildRequest, executeApiTool, handleResponse, tool, request, outcome, resu
const metafile = join(consumerDir, "meta.json");
writeFileSync(
entryPoint,
- 'import { executeApiTool } from "@webmcp-today/engine";\nexport { executeApiTool };\n',
+ 'import { executeApiTool, executeDomTool } from "@webmcp-today/engine";\nexport { executeApiTool, executeDomTool };\n',
);
run(
"bun",