@google/stitch-sdk v0.4.0-canary.1
This is a preview canary release of @google/stitch-sdk (v0.4.0-canary.1), packaged directly as an installable npm tarball. It includes the complete unified 0.4.0 architecture, compatibility bridge, isolated subpath exports, runtime hardening, and all Tier 2 & Tier 3 fixes (#149, #361, #365, #138).
📦 Installation via npm
Install directly into your Node.js or TypeScript project using npm, bun, yarn, or pnpm:
# Using npm
npm install https://github.com/google-labs-code/stitch-sdk/releases/download/v0.4.0-canary.1/google-stitch-sdk-0.4.0-canary.1.tgz
# Or using the canary alias URL
npm install https://github.com/google-labs-code/stitch-sdk/releases/download/v0.4.0-canary.1/google-stitch-sdk-canary.tgzOr add directly to your package.json:
{
"dependencies": {
"@google/stitch-sdk": "https://github.com/google-labs-code/stitch-sdk/releases/download/v0.4.0-canary.1/google-stitch-sdk-0.4.0-canary.1.tgz"
}
}🚀 Key Highlights in this Canary
1. Canvas Layout & Screen Metadata (#365, #138)
project.getCanvasLayout(): Retrieves canvas coordinate layout (x,y), screen dimensions (width,height),deviceType,label, andhiddenstatus for all screens in the project.project.get(): Hydrates project details directly from theget_projectMCP tool.- Typed Metadata on
Screen: Full accessors forscreen.width,screen.height,screen.deviceType,screen.screenType, andscreen.screenMetadata.
2. Screen Freshness & Cache Invalidation (#361)
screen.edit()&designSystem.apply(): Automatically invalidates stale cachedhtmlCodeandscreenshotURLs inEntityManager.- Prioritizes newly minted revision screens over original input screens in return envelopes, ensuring
await screen.edit(...)always yields the updated screen asset.
3. Screen Recovery Fallback (#149)
- When the backend
list_screenstool returns an empty response for existing projects,project.screens()automatically falls back toget_project'sscreenInstancesand local entity caches. - Merges newly generated in-session screens not yet indexed by
list_screens.
4. 0.4.0 Compatibility Bridge & Architecture
- Unified Client: Consolidated proxy and client architecture with zero circular dependencies.
- Lightweight Subpaths:
@google/stitch-sdk: Core domain models and client.@google/stitch-sdk/ai: Vercel AI SDK adapter (stitchTools).@google/stitch-sdk/adk: Google ADK adapter (stitchTools).@google/stitch-sdk/tools: Static MCP tool catalog (toolDefinitions,toolMap).
- Runtime Hardening: Idempotent read retries with exponential backoff on HTTP 429/503 and network resets, lifecycle hygiene (
stitch.close()), download path traversal containment, and typed error envelopes (StitchError).
🔍 Verification
- Tarball SHA256:
fba59af65aef689d76fc33c6e779b163a712b5feb2cebc94a9e7dab405e48b14 - Tested across Node 18, Node 20, Node 24, and Bun 1.3+.