Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7d6be9f
feat: add A2H×A2UI Prototype 1 — Approval Card (AUTHORIZE intent)
Mar 4, 2026
e16ba51
feat(samples): add A2H prototype 2 — escalation/handoff (ESCALATE)
Mar 4, 2026
1be83fb
P3: Guided input/form collection (COLLECT) prototype
Mar 4, 2026
85148f0
feat: P4 progress+intervention prototype (INFORM→AUTHORIZE pipeline)
Mar 4, 2026
25a5c54
feat(a2h): P5 multi-step expense wizard prototype
Mar 4, 2026
09cb091
feat: A2H×A2UI helper library, demo, and prototype fixes
Mar 4, 2026
99e1c41
refactor: rename prototypes to v0.9.0, prep for v0.9.1 comparisons
Mar 4, 2026
58e8375
fix: P1 approval v0.9.0 — critical review fixes
Mar 4, 2026
2c7bec5
feat: P1 approval v0.9.1-with-helper — proposed spec improvements
Mar 4, 2026
858f806
fix: P2 escalation v0.9.0 — critical review fixes
Mar 4, 2026
351bbf0
feat: P2 escalation v0.9.1-with-helper
Mar 4, 2026
cadd34f
fix: P3 guided-input v0.9.0 — critical review fixes
Mar 4, 2026
0185b5f
feat: P3 guided-input v0.9.1-with-helper
Mar 4, 2026
c4e2f15
fix: P4 progress-intervention v0.9.0 — critical review fixes
Mar 4, 2026
d843a79
feat: P4 progress-intervention v0.9.1-with-helper
Mar 4, 2026
5e43dcc
fix: P5 wizard v0.9.0 — critical review fixes
Mar 4, 2026
c10bcbb
feat: P5 wizard v0.9.1-with-helper
Mar 4, 2026
07bad64
docs: add v0.9.0 vs v0.9.1 comparison to DESIGN.md
Mar 4, 2026
a8d2cb9
docs: update DESIGN.md with critical review findings, fix stale ratings
Mar 4, 2026
b51b6b2
fix: address 8 review issues in A2H prototypes
Mar 5, 2026
542fd75
Update README.md
ghchinoy Mar 6, 2026
fba8b68
Update README.md
ghchinoy Mar 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
416 changes: 416 additions & 0 deletions samples/a2h-prototypes/DESIGN.md

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions samples/a2h-prototypes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# A2H × A2UI Prototypes

Exploration of rendering [A2H](https://github.com/twilio/a2h) (Agent-to-Human) intents using the A2UI v0.9 protocol. Five working prototypes validate the mapping between A2H's five intent types and A2UI's component model.

## Quick Start

Open the all-in-one demo:

```bash
cd demo && npx serve .
# Or just open demo/index.html in your browser
```

## Contents

| Path | Description |
|------|-------------|
| [DESIGN.md](./DESIGN.md) | Full design document — intent mapping, conventions, proposed enhancements |
| [demo/](./demo/) | **All 5 intents on one page**, generated via the helper library |
| [lib/a2h-a2ui.js](./lib/a2h-a2ui.js) | Helper library — generates A2UI v0.9 messages from A2H intent descriptions |
| [p1-approval/](./p1-approval/) | **AUTHORIZE** — Financial transfer approval card |
| [p2-escalation/](./p2-escalation/) | **ESCALATE** — Customer service handoff |
| [p3-guided-input/](./p3-guided-input/) | **COLLECT** — Shipping address form (⭐ cleanest prototype) |
| [p4-progress-intervention/](./p4-progress-intervention/) | **INFORM → AUTHORIZE** — Deploy pipeline with progressive updates |
| [p5-wizard/](./p5-wizard/) | **COLLECT → COLLECT → INFORM → AUTHORIZE** — Expense report wizard |

## Helper Library API

```js
import {
createAuthorizeSurface,
createCollectSurface,
createInformSurface,
createEscalateSurface,
createResultSurface,
} from './lib/a2h-a2ui.js';

const messages = createAuthorizeSurface({
surfaceId: 'a2h:authorize:001',
title: 'Authorization Required',
description: 'Agent wants to book a flight.',
details: [{ label: 'Amount', path: '/amount' }],
dataModel: { amount: '$450.00' },
});
// Returns: [createSurface, updateDataModel, updateComponents] — valid A2UI v0.9
```

Each function returns an array of A2UI v0.9 messages with valid component IDs, `catalogId: "basic"`, proper data bindings, and `sendDataModel: true` on interactive surfaces.

## Key Findings

- **`sendDataModel: true`** is the key enabler — eliminates per-field wiring for forms and approvals
- **Data binding** (`{path: "/foo"}`) provides clean two-way binding
- **Incremental updates** via `updateComponents` merge enables real-time progress UIs
- **A2UI v0.9 covers ~80%** of A2H rendering needs today

## Proposed A2UI Enhancements

1. **`visible` binding** — Conditional rendering (eliminates tree-swap workarounds)
2. **Button `label` prop** — Kills 2-component-per-button boilerplate (~15-20% reduction)
3. **ProgressIndicator** — Proper loading/progress states
4. **KeyValue component** — Eliminates 3-component-per-detail-row pattern

See [DESIGN.md](./DESIGN.md) for full analysis.

## Status

**Exploration / proof-of-concept.** Prototypes are static HTML+JS with inline renderers. The helper library generates valid A2UI v0.9 but is not yet published as an npm package. Next steps: propose enhancements to the A2UI spec, port to real renderers (Lit/Angular/Flutter).
31 changes: 31 additions & 0 deletions samples/a2h-prototypes/demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# A2H × A2UI Demo

Single-page demo showing all five A2H intents rendered as A2UI v0.9 surfaces, generated by the `a2h-a2ui` helper library.

## How to Run

Open `index.html` in any modern browser (requires ES module support):

```bash
# From this directory:
npx serve .
# Or simply open index.html directly (works in Chrome/Firefox/Safari)
```

## What It Shows

| Intent | Surface | Interactive |
|--------|---------|-------------|
| **AUTHORIZE** | Transfer approval card with details and Approve/Reject buttons | ✅ Click buttons |
| **COLLECT** | Shipping address form with text fields and dropdown | ✅ Fill & submit |
| **INFORM** | Order shipped notification with tracking details | View only |
| **ESCALATE** | Support handoff with context and connection options | ✅ Click buttons |
| **RESULT** | Flight booking confirmation with summary | View only |

Click any button to see the emitted A2UI event in the event log at the bottom.

## Architecture

- **`../lib/a2h-a2ui.js`** — Generates A2UI v0.9 message arrays from high-level intent descriptions
- **Inline renderer** — Minimal vanilla JS A2UI v0.9 renderer (same approach as the individual prototypes)
- **No build step** — Pure ES modules, no bundler needed
Loading
Loading