Skip to content

Pattern v0.3.0

Choose a tag to compare

@benoit-at-makkr benoit-at-makkr released this 02 Jul 10:45
· 25 commits to main since this release
4a77893

Pattern 0.3.0 — Agents, voice, sign-in & email. The whole loop, on the canvas.

This is the biggest Pattern release yet. 0.2 gave the framework its handbook; 0.3 gives it its superpowers: a native AI capability layer over 40+ providers, an agent loop that is Pattern code all the way down, a chat app that listens and talks back, real login methods, and transactional email — all of it visible, traceable, and rewireable in the admin, because in Pattern everything is a workflow.

Five new packages ship today: @pattern-js/mod-ai, @pattern-js/mod-auth-oidc, @pattern-js/mod-email, @pattern-js/mod-email-resend, and @pattern-js/mod-email-smtp.

To taste what that means in practice: an agent that calls a live weather tool, writes a Markdown email about it, and delivers it through Resend is nine nodes on one canvas — request → brief → agent → run → send → response, with the tool call showing up as a linked sub-run in the trace viewer.


🧠 mod-ai — every AI modality as an op

The new AI capability layer, built on the Vercel AI SDK's full provider catalog (40+ providers, lazy-loaded, the AI Gateway built in):

  • Ops for every modality: ai.text.generate / ai.text.stream, ai.object.generate (schema-validated structured output), ai.embed / ai.embed.many, ai.image.generate, ai.speech.generate, ai.transcribe, and ai.video.generate.
  • Models are aliases, not hardcodes. An alias is an admin-configured instance — provider + model id + a vault- or env-sourced key — resolved by name at run time. Re-point default in Settings → AI Providers and every workflow that uses it retargets instantly. No redeploys, no config hunts.
  • An AI Providers settings page in the admin: define aliases per modality, keys stay in the encrypted vault and are masked out of run samples.
  • MCP in both directions: ai.mcp.client pulls tools from any remote MCP server (HTTP or stdio — paste a whole command line, it's tokenized for you) into a toolset value; the ai.mcp.server route exposes your tool workflows to any MCP client. Your workflows become tools; other people's tools become nodes.

🤖 mod-agents — the agent loop is now Pattern code

The agent runtime was rebuilt from the ground up as a native loop — no external agents SDK underneath:

  • agents.agent / agents.run / agents.run.resume, on any provider via mod-ai. No model wired = the configured default alias.
  • Tools are workflows. A tool starts with boundary.tool (name, description, JSON-Schema params — validated by the engine before your graph runs, so a hallucinated argument never reaches it) and ends with boundary.tool.return. Every call is a linked sub-run with sampled I/O in the admin.
  • Guardrails, human-in-the-loop approvals, history compaction — all graph nodes, all visible. Agent name and instructions are runtime inputs, so one agent definition can vary per request.
  • @pattern-js/mod-agents-openai is retired: mod-agents + mod-ai replace it on every provider (see Breaking changes).

🎙️ Chat learns to listen and talk

The bundled chat app (mod-chat) had a full experience overhaul:

  • Voice input — in-browser speech-to-text with Silero VAD and locally-served Whisper assets (no audio leaves the machine until you send), and spoken-style agent instructions on voice turns so replies read like speech.
  • Voice output — text-to-speech playback, and a fullscreen WebGPU particle voice avatar (with a Canvas2D fallback) that breathes with the conversation.
  • Per-turn model switcher backed by language-model aliases: pick a model for this message, the pinned default stays put.
  • Multi-instance serving: one shared chat backend, many branded SPA instances — per-namespace agents by forking the turn pipeline alone; the most specific route wins.
  • A three-way theme (light / dark / system), lucide icons, avatar polish, and image / transcribe / speech tools with conventional aliases.

🔐 Real sign-in: OIDC joins magic links

@pattern-js/mod-auth-oidc — authorization-code + PKCE against any OpenID Connect issuer (Google, Microsoft, Keycloak, …):

  • ID tokens verified with jose; sessions minted by mod-identity, same as magic links.
  • Several providers side by side — each gets its own routes, its own login button, its own state cookie (concurrent flows don't collide).
  • Account linking is by verified email only (configurable), so an IdP can't take over an existing account with an unverified claim.
  • Configured in code via a small app-local wrapper mod (mods/oidc.mjs) — your providers are versioned with your app; only the client secret lives as a vault/env reference.
  • The login page renders every registered method, and every OIDC failure surfaces as a human-readable message.

✉️ Transactional email, in the box

@pattern-js/mod-email is the email contract; drivers plug into it:

  • Accounts (provider + from + secret refs) managed under System → Email, with a real-send Test button. Driver field lists auto-generate the account form.
  • email.send — write the body once in Markdown and it renders to inline-styled HTML plus a plain-text alternative (a paragraph that is exactly one link becomes a button). Attachments from blobs, in-memory media, or literal files.
  • email.deliver-token — the packaged delivery workflow: create the default account and identity's sign-in links send themselves. Console fallback until then and on any failure — you are never locked out of your own app.
  • Two drivers ship today: Resend (plain fetch) and SMTP (nodemailer, pooled digest-keyed transports). Writing a third is a small package.

🧰 create-pattern — more choices, zero staleness

  • Sign-in methods multiselect: magic link, OIDC, or both (--oidc, --magic-link / --no-magic-link). OIDC scaffolds the wrapper mod + .env hints.
  • Sign-in link delivery choice: console, Resend, or SMTP (--email).
  • New studio-ai modpack — the visual studio + the full AI op catalog, no agent loop — and a --providers picker for the AI packs.
  • --help, validated flag values, and notes instead of silence when a flag doesn't apply to your selection.
  • Version-proof scaffolds: every generated project derives its @pattern-js/* ranges from the CLI's own version, so a fresh app always resolves the mods published alongside the create-pattern that made it. Templates can never go stale across a minor again.

📚 Docs, admin & site

  • Four new chapters (OIDC login, Email, Resend, SMTP), identity docs covering both login methods and packaged delivery, and getting-started documenting every scaffold dimension.
  • A focused catalog: plumbing routes can mark themselves internal — chat's CRUD rows now hide behind the "show internal" toggle, so the flagship pipelines stand out. The approval pipeline and MCP server gained descriptions and hand-laid layouts.
  • Honest numbers on the README and the site: 175 base ops (every single one with "when to use" prose) — over 300 with the first-party mods.

⚠️ Breaking changes

  • @pattern-js/mod-agents-openai is retired. Replace it with @pattern-js/mod-agents + @pattern-js/mod-ai: the agent ops keep their shape, and models now come from an ai.model node or a configured alias — on any provider, not just OpenAI.
  • 0.2.x scaffolds pin ^0.2.0, which semver-excludes 0.3.0. Bump your app's @pattern-js/* ranges to ^0.3.0 when upgrading (new scaffolds handle this automatically, forever).

🚀 Get started

npm create pattern@latest my-app
# pick a modpack — try `agent-chat` for the full agent + voice chat experience,
# or `studio-ai` for the visual studio + AI ops

Upgrading an existing app: set every @pattern-js/* dependency to ^0.3.0, then npm install.

The full story, per area, is in the CHANGELOG.


By the numbers: 17 published packages (5 new) · 175 base ops, 300+ with first-party mods, 100% documented · 7 scaffold templates · 456 tests · one canvas.