Build Verse: a poem-quote app on the agent-native chat template
CI / build (push) Successful in 4m26s
CI / build (push) Successful in 4m26s
Adds a Postgres-backed quotes domain (poems/quotes/favorites) exposed as five agent-native actions (list-quotes, get-random-quote, create-quote, toggle-favorite, list-favorites) callable from both chat and the React UI via useActionQuery/useActionMutation. Moves the primary UI from chat to a mobile-first Quotes/Favorites experience (chat moves to /chat), adds manual OpenTelemetry instrumentation exporting traces/metrics/logs over OTLP, and wires a local Docker Postgres for shared state.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
# Chat — Agent Guide
|
||||
# Verse — Agent Guide
|
||||
|
||||
Chat is the minimal chat-first agent-native app template. Keep chat as the
|
||||
primary surface, add actions for real capabilities, and add screens only when a
|
||||
workflow needs durable UI around the conversation.
|
||||
Verse is a quote app built on poems: browse, search, and favorite quotes drawn
|
||||
from poems, or submit new ones. It started from the agent-native chat template,
|
||||
but the primary surface is the quotes UI at `/` — chat lives at `/chat` and is
|
||||
a secondary way to reach the same actions (see "Domain & Actions" below).
|
||||
|
||||
## Core Rules
|
||||
|
||||
@@ -35,10 +36,40 @@ workflow needs durable UI around the conversation.
|
||||
- For new features, update UI, actions, skills/instructions, and application
|
||||
state when applicable.
|
||||
|
||||
## Domain & Actions
|
||||
|
||||
Data model: `poems` (author, title, source, year) → `quotes` (text, tags,
|
||||
is_user_submitted) → `favorites` (quote_id, visitor_id). `visitor_id` is an
|
||||
anonymous per-browser id (localStorage), not a login — there is no user
|
||||
account system in this app; `AUTH_DISABLED=true` by default since no Zitadel
|
||||
client is configured for this instance.
|
||||
|
||||
- **list-quotes** (GET) — browse/search quotes. Optional `tag`, `author`,
|
||||
`search` (free text over quote + poem title), `visitorId` (marks
|
||||
`isFavorited` on each result), `favoritesOnly`, `limit`. Use this for any
|
||||
"show me quotes about X" / "quotes by Y" request.
|
||||
- **get-random-quote** (GET) — one random quote, optionally filtered by `tag`.
|
||||
Use for "quote of the day" / "surprise me" requests.
|
||||
- **create-quote** (POST) — submit a new quote. Requires `text`, `author`,
|
||||
`poemTitle`; optional `source`, `year`, `tags`. Creates the poem record if
|
||||
author+title doesn't already exist (case-sensitive exact match). Marks the
|
||||
quote `is_user_submitted: true`.
|
||||
- **toggle-favorite** (POST) — favorite/unfavorite a quote for a `visitorId`
|
||||
(toggles based on current state, no separate favorite/unfavorite actions).
|
||||
Returns `{ favorited, favoriteCount }`.
|
||||
- **list-favorites** (GET) — all quotes a `visitorId` has favorited, most
|
||||
recent first. Requires `visitorId`.
|
||||
|
||||
All five are callable from chat and from the React UI via
|
||||
`useActionQuery`/`useActionMutation` — there is no separate `/api/*` REST
|
||||
layer. Every action call emits an OpenTelemetry span, a structured log line,
|
||||
and increments a call counter, exported over OTLP to the shared Grafana LGTM
|
||||
stack (see `server/otel.ts`).
|
||||
|
||||
## Application State
|
||||
|
||||
- `navigation` should describe the current view and selected entity ids. The
|
||||
default chat view is `chat` at `/`.
|
||||
quotes home view is `quotes` at `/`; chat is a secondary view at `/chat`.
|
||||
- `navigate` may be used to move the UI when the app supports it.
|
||||
- `view-screen` is the first tool to call when the user's visible context
|
||||
matters.
|
||||
|
||||
Reference in New Issue
Block a user