0.3.0: execution AbortSignals + document.modelContext consumer API - #48
Closed
kashishhora wants to merge 12 commits into
Closed
0.3.0: execution AbortSignals + document.modelContext consumer API#48kashishhora wants to merge 12 commits into
kashishhora wants to merge 12 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).
handler(args, { signal })(Chrome 153.0.8007.0+ shape; never-aborting substitute on ≤152). Abort is treated as cancellation, not error (nostate.error, noonError).document.modelContext.getTools()/executeTool()matching native Chrome (objectinputSchemaper Chrome 154.0.8014.0,UnknownErrorfailures, signal forwarding, in-flight executions survive unregistration per 153.0.8008.0). A single execution engine (src/polyfill/execute.ts) backs bothexecuteTool()and the shim.navigator.modelContextTestingis 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.tsconfig.test.jsonwired intopnpm typecheck); Biome at 0 warnings.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.