Skip to content

0.3.0: execution AbortSignals + document.modelContext consumer API - #48

Closed
kashishhora wants to merge 12 commits into
mainfrom
kashish/package-email-support-922aa3
Closed

0.3.0: execution AbortSignals + document.modelContext consumer API#48
kashishhora wants to merge 12 commits into
mainfrom
kashish/package-email-support-922aa3

Conversation

@kashishhora

Copy link
Copy Markdown
Member

Tracks Chrome 152–154 WebMCP changes (spec: docs/superpowers/specs/2026-08-21-webmcp-signal-and-consumer-api-design.md; plan: docs/superpowers/plans/2026-08-21-webmcp-signal-and-consumer-api.md).

  • Handlers now receive the execution AbortSignal: handler(args, { signal }) (Chrome 153.0.8007.0+ shape; never-aborting substitute on ≤152). Abort is treated as cancellation, not error (no state.error, no onError).
  • Polyfill gains document.modelContext.getTools() / executeTool() matching native Chrome (object inputSchema per Chrome 154.0.8014.0, UnknownError failures, signal forwarding, in-flight executions survive unregistration per 153.0.8008.0). A single execution engine (src/polyfill/execute.ts) backs both executeTool() and the shim.
  • navigator.modelContextTesting is deprecated (removed from native Chrome in 152.0.7940.0); the shim now wraps the same engine and warns once. Removal planned for 0.4.0.
  • Test files are now type-checked (tsconfig.test.json wired into pnpm typecheck); Biome at 0 warnings.
  • Version 0.3.0.

Verification: pnpm build && pnpm typecheck && pnpm lint && pnpm test (206/206). Every task had an independent review plus a whole-branch final review; all must-fix findings were addressed.

Extension/examples migration follows in the stacked PR from kashish/webmcp-extension-modelcontext.

tsconfig.json excludes src/**/__tests__, so the compile-time assertions in
src/__tests__/type-compat.test.ts were never checked by any gate. Add
tsconfig.test.json (extends the root config, includes all of src, wider lib
for Array.prototype.at, vitest globals, noEmit) and run it from `pnpm
typecheck` alongside the emit-shaped root check.

Fix the nine type errors the new gate surfaces: type the vi.fn() mocks whose
mock.calls[0][0] was a zero-length tuple, annotate the three handler
destructures that lose Zod inference through the widened test-component prop,
and route the ToolDescriptor -> Record cast through unknown.

Replace the two `executeRef.current!` non-null assertions with a hoisted
`const exec = executeRef.current as ExecuteFn` so `pnpm lint` is back to zero
warnings; `?.` there would make `promise` possibly undefined.
AGENTS.md still named navigator.modelContextTesting as the external-call path
in the architecture note and the Testing section, which would steer new tests
at a surface that is removed in 0.4.0. Name document.modelContext.getTools() /
executeTool() instead and mention the shim only as deprecated.

Drop the unused `{ signal }` destructure from the README quick start — it
trips noUnusedParameters for anyone copying the first snippet. The 0.3.0
section still shows the two-argument handler.
@kashishhora
kashishhora deleted the kashish/package-email-support-922aa3 branch August 24, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant