Skip to content

feat(a2ui): client-side functions (Phase 2 of the v0.9 migration) - #818

Merged
blove merged 3 commits into
mainfrom
blove/a2ui-v09-phase2
Aug 17, 2026
Merged

feat(a2ui): client-side functions (Phase 2 of the v0.9 migration)#818
blove merged 3 commits into
mainfrom
blove/a2ui-v09-phase2

Conversation

@blove

@blove blove commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase 2 of the A2UI v0.9.1 migration (follows #817): client-side function execution per the official basic-catalog function schemas.

  • @threadplane/a2ui: new createA2uiFunctionRegistry() with the standard set — formatString (full ${...} interpolation: absolute/relative JSON-pointer paths, nested named-arg calls like ${formatDate(value:${/d}, format:'yyyy-MM-dd')}, \${ escape; single-pass scanner, no backtracking regexes), formatNumber, formatCurrency, formatDate (TR35 pattern subset), pluralize (Intl.PluralRules), and/or/not. resolveDynamic gains an optional registry parameter; function args resolve recursively (bindings and nested calls); unknown names resolve to undefined with a one-time warning. Registry is extensible via overrides.
  • @threadplane/chat: surfaceToSpec resolves every dynamic value through the standard registry, and action.functionCall now wires to the existing a2ui:localAction handler (consumer handlers take priority; built-in openUrl opens a new tab with noopener).
  • Prompts/docs: schema prompt (both example apps, byte-identical) advertises the functions; a2ui/chat docs updated from "typed, ships later" to shipped semantics; api-docs regenerated.

Additive and non-breaking. Plan: docs/superpowers/plans/2026-08-17-a2ui-v09-phase2-functions.md.

Verification

  • libs/a2ui 86 unit tests (26 new for functions), libs/chat 1128 — green; both libs build + lint clean
  • Python suites: 56 + 23 passed; schema-prompt twins byte-identical
  • nx affected -t lint test build: green except the pre-existing cockpit-telemetry:lint worktree-environment failure (untouched project, posthog-js specifier vs local install)
  • Live Chrome smoke (real gpt-5-mini): prompted for a receipt card using formatCurrency + formatString; the surface rendered $1,234.50 and Thanks, Ada! — both values computed client-side by the registry from the LLM's {call} emissions.

🤖 Generated with Claude Code

blove and others added 3 commits August 17, 2026 09:29
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
formatString/formatNumber/formatCurrency/formatDate/pluralize/and/or/not
resolve through createA2uiFunctionRegistry(); functionCall actions route to
a2ui:localAction (openUrl opens with noopener).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview Aug 17, 2026 4:40pm

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

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