diff --git a/.changeset/enable-webmcp.md b/.changeset/enable-webmcp.md deleted file mode 100644 index f64ca3a..0000000 --- a/.changeset/enable-webmcp.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@simplepdf/embed': minor -'@simplepdf/react-embed-pdf': minor ---- - -Add `webMCP`: register the editor operations as WebMCP tools on the host page. - -An in-browser agent (ChatGPT's browser, Chrome with WebMCP) discovers tools on the page it is looking at, not inside iframes. `createEmbed({ webMCP: { enabled: true } })` and `` register every operation (`loadDocument` included) on the page's model context and forward each call to the editor over the bridge. Each tool is the record the editor publishes in its manifest and registers on its own page (the `simplepdf_embed_*` name, description, snake_case input schema and behavior hints), so a page gets the same tools whether the editor is embedded or opened directly. `exclude: ['submit', ...]` withholds operations by SDK method name so a person keeps the decision; a malformed value, an unknown key or an unknown name throws `EmbedConfigError`. Every operation runs in the browser and nothing the agent reads is computed server-side; document storage follows your account's configuration exactly as it does without WebMCP. Each call resolves with an MCP tool result carrying the editor's wire-shaped Result (`isError` on failure; the annotated page render as an `image` block); a call aborted before it ran rejects; `dispose()` unregisters everything. Off by default (`{ enabled: false }` and omitting the option are the same): the WebMCP module loads lazily, once the editor is ready and only when the page exposes a model context. One WebMCP-enabled embed per page (tool names are page-level). diff --git a/.changeset/get-annotated-page.md b/.changeset/get-annotated-page.md deleted file mode 100644 index 9383822..0000000 --- a/.changeset/get-annotated-page.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@simplepdf/embed': minor -'@simplepdf/react-embed-pdf': minor ---- - -Add `getAnnotatedPage({ page })` (the editor's `GET_ANNOTATED_PAGE`): a PNG render of one page with every field outlined and numbered, plus a `badges` map from each number to its `field_id`, so a vision model can label fields by looking at the printed form. Available as `embed.actions.getAnnotatedPage` / `useEmbed().actions.getAnnotatedPage`, as the `getAnnotatedPage` agentic tool on every tool subpath, and as a WebMCP tool (a reader: `readOnlyHint` + `untrustedContentHint`). - -The contract pin follows the live manifest: `loadDocument` also accepts an http(s) URL the editor fetches and its description states that it discards the current document and every edit in it; `getFields` points agents at `get_annotated_page`. diff --git a/.changeset/lifecycle-events-in-manifest.md b/.changeset/lifecycle-events-in-manifest.md deleted file mode 100644 index a59e197..0000000 --- a/.changeset/lifecycle-events-in-manifest.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@simplepdf/embed': minor ---- - -`EDITOR_READY` and `DOCUMENT_LOADED` now come from the editor manifest (`/embed/json` `events`), like `PAGE_FOCUSED` and `SUBMISSION_SENT`: `OUTBOUND_EVENTS` / `OutboundEventType` on `@simplepdf/embed/protocol` list all four (a widening: exhaustive consumers of `OutboundEventType` gain two members), and the root exports the `EditorReadyPayload` / `DocumentLoadedPayload` types. The `EditorEvent` shapes are unchanged. diff --git a/embed/CHANGELOG.md b/embed/CHANGELOG.md index c994bcc..37e75fd 100644 --- a/embed/CHANGELOG.md +++ b/embed/CHANGELOG.md @@ -1,5 +1,19 @@ # @simplepdf/embed +## 0.7.0 + +### Minor Changes + +- 06a5946: Add `webMCP`: register the editor operations as WebMCP tools on the host page. + + An in-browser agent (ChatGPT's browser, Chrome with WebMCP) discovers tools on the page it is looking at, not inside iframes. `createEmbed({ webMCP: { enabled: true } })` and `` register every operation (`loadDocument` included) on the page's model context and forward each call to the editor over the bridge. Each tool is the record the editor publishes in its manifest and registers on its own page (the `simplepdf_embed_*` name, description, snake_case input schema and behavior hints), so a page gets the same tools whether the editor is embedded or opened directly. `exclude: ['submit', ...]` withholds operations by SDK method name so a person keeps the decision; a malformed value, an unknown key or an unknown name throws `EmbedConfigError`. Every operation runs in the browser and nothing the agent reads is computed server-side; document storage follows your account's configuration exactly as it does without WebMCP. Each call resolves with an MCP tool result carrying the editor's wire-shaped Result (`isError` on failure; the annotated page render as an `image` block); a call aborted before it ran rejects; `dispose()` unregisters everything. Off by default (`{ enabled: false }` and omitting the option are the same): the WebMCP module loads lazily, once the editor is ready and only when the page exposes a model context. One WebMCP-enabled embed per page (tool names are page-level). + +- 06a5946: Add `getAnnotatedPage({ page })` (the editor's `GET_ANNOTATED_PAGE`): a PNG render of one page with every field outlined and numbered, plus a `badges` map from each number to its `field_id`, so a vision model can label fields by looking at the printed form. Available as `embed.actions.getAnnotatedPage` / `useEmbed().actions.getAnnotatedPage`, as the `getAnnotatedPage` agentic tool on every tool subpath, and as a WebMCP tool (a reader: `readOnlyHint` + `untrustedContentHint`). + + The contract pin follows the live manifest: `loadDocument` also accepts an http(s) URL the editor fetches and its description states that it discards the current document and every edit in it; `getFields` points agents at `get_annotated_page`. + +- 06a5946: `EDITOR_READY` and `DOCUMENT_LOADED` now come from the editor manifest (`/embed/json` `events`), like `PAGE_FOCUSED` and `SUBMISSION_SENT`: `OUTBOUND_EVENTS` / `OutboundEventType` on `@simplepdf/embed/protocol` list all four (a widening: exhaustive consumers of `OutboundEventType` gain two members), and the root exports the `EditorReadyPayload` / `DocumentLoadedPayload` types. The `EditorEvent` shapes are unchanged. + ## 0.6.0 ### Minor Changes diff --git a/embed/package.json b/embed/package.json index fe5ef9d..53298dd 100644 --- a/embed/package.json +++ b/embed/package.json @@ -1,6 +1,6 @@ { "name": "@simplepdf/embed", - "version": "0.6.0", + "version": "0.7.0", "description": "Embed and programmatically drive the SimplePDF editor over its iframe bridge", "type": "module", "private": false, diff --git a/react/CHANGELOG.md b/react/CHANGELOG.md index 9508b14..68563c2 100644 --- a/react/CHANGELOG.md +++ b/react/CHANGELOG.md @@ -1,5 +1,24 @@ # @simplepdf/react-embed-pdf +## 1.13.0 + +### Minor Changes + +- 06a5946: Add `webMCP`: register the editor operations as WebMCP tools on the host page. + + An in-browser agent (ChatGPT's browser, Chrome with WebMCP) discovers tools on the page it is looking at, not inside iframes. `createEmbed({ webMCP: { enabled: true } })` and `` register every operation (`loadDocument` included) on the page's model context and forward each call to the editor over the bridge. Each tool is the record the editor publishes in its manifest and registers on its own page (the `simplepdf_embed_*` name, description, snake_case input schema and behavior hints), so a page gets the same tools whether the editor is embedded or opened directly. `exclude: ['submit', ...]` withholds operations by SDK method name so a person keeps the decision; a malformed value, an unknown key or an unknown name throws `EmbedConfigError`. Every operation runs in the browser and nothing the agent reads is computed server-side; document storage follows your account's configuration exactly as it does without WebMCP. Each call resolves with an MCP tool result carrying the editor's wire-shaped Result (`isError` on failure; the annotated page render as an `image` block); a call aborted before it ran rejects; `dispose()` unregisters everything. Off by default (`{ enabled: false }` and omitting the option are the same): the WebMCP module loads lazily, once the editor is ready and only when the page exposes a model context. One WebMCP-enabled embed per page (tool names are page-level). + +- 06a5946: Add `getAnnotatedPage({ page })` (the editor's `GET_ANNOTATED_PAGE`): a PNG render of one page with every field outlined and numbered, plus a `badges` map from each number to its `field_id`, so a vision model can label fields by looking at the printed form. Available as `embed.actions.getAnnotatedPage` / `useEmbed().actions.getAnnotatedPage`, as the `getAnnotatedPage` agentic tool on every tool subpath, and as a WebMCP tool (a reader: `readOnlyHint` + `untrustedContentHint`). + + The contract pin follows the live manifest: `loadDocument` also accepts an http(s) URL the editor fetches and its description states that it discards the current document and every edit in it; `getFields` points agents at `get_annotated_page`. + +### Patch Changes + +- Updated dependencies [06a5946] +- Updated dependencies [06a5946] +- Updated dependencies [06a5946] + - @simplepdf/embed@0.7.0 + ## 1.12.1 ### Patch Changes diff --git a/react/package.json b/react/package.json index 9ff1705..a70a149 100644 --- a/react/package.json +++ b/react/package.json @@ -1,6 +1,6 @@ { "name": "@simplepdf/react-embed-pdf", - "version": "1.12.1", + "version": "1.13.0", "description": "SimplePDF straight into your React app", "repository": { "type": "git", @@ -49,7 +49,7 @@ "check:api": "node ../scripts/check-api.mjs ." }, "dependencies": { - "@simplepdf/embed": "0.6.0" + "@simplepdf/embed": "0.7.0" }, "peerDependencies": { "@tanstack/ai": "^0.38.0",