refactor: serve canvas host on gateway port
This commit is contained in:
@@ -16,9 +16,10 @@ Status: Implemented · Date: 2025-12-20
|
||||
- A2UI renders only when the **Gateway is reachable** (acceptable failure mode).
|
||||
|
||||
## Decision
|
||||
All A2UI HTML/JS assets are **served by the Gateway’s Canvas host** over HTTP.
|
||||
Nodes (mac/iOS/Android) **navigate to the Gateway URL** before applying A2UI
|
||||
messages. No local custom-scheme or bundled fallback remains.
|
||||
All A2UI HTML/JS assets are **served by the Gateway HTTP server** (single port,
|
||||
same as the Gateway WebSocket). Nodes (mac/iOS/Android) **navigate to the
|
||||
Gateway URL** before applying A2UI messages. No local custom-scheme or bundled
|
||||
fallback remains.
|
||||
|
||||
## Why
|
||||
- One source of truth (TS) for A2UI rendering.
|
||||
@@ -36,14 +37,16 @@ messages. No local custom-scheme or bundled fallback remains.
|
||||
## Gateway changes
|
||||
|
||||
### Serve A2UI assets
|
||||
Add A2UI HTML/JS to the Gateway Canvas host, e.g.:
|
||||
Add A2UI HTML/JS to the Gateway Canvas host (same HTTP server as the Gateway
|
||||
WS), e.g.:
|
||||
|
||||
```
|
||||
/__clawdis__/a2ui/ -> index.html
|
||||
/__clawdis__/a2ui/a2ui.bundle.js -> bundled A2UI runtime
|
||||
```
|
||||
|
||||
Use the existing Canvas host server (`src/canvas-host/server.ts`) to serve these
|
||||
Serve Canvas files at `/__clawdis__/canvas/` and A2UI at `/__clawdis__/a2ui/`.
|
||||
Use the shared Canvas host handler (`src/canvas-host/server.ts`) to serve these
|
||||
assets and inject the action bridge + live reload if desired.
|
||||
|
||||
### Derive HTTP host from WebSocket
|
||||
@@ -81,6 +84,7 @@ If `canvasHostUrl` is missing or unreachable:
|
||||
1) Gateway
|
||||
- Add A2UI assets under `src/canvas-host/`.
|
||||
- Serve them at `/__clawdis__/a2ui/` (align with existing naming).
|
||||
- Serve Canvas files at `/__clawdis__/canvas/` on the Gateway port.
|
||||
- Expose `canvasHostUrl` in handshake + bridge hello payloads.
|
||||
2) Node runtimes
|
||||
- Update `canvas.a2ui.*` to navigate to `canvasHostUrl`.
|
||||
|
||||
Reference in New Issue
Block a user