agents.contract holds the Agents tab's shapes and views: six screens and five smaller components, 853 lines. It declares no data. Its state, resources, tasks and actions are the pkg:agents blocks of the root contract, which pass everything in as props.
Shapes
Declared at lines 7-137. Each matches what a source returns.
Shape | Returned by | Notes |
|---|---|---|
|
| Contains |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| built in the view |
|
An atom agentDocument link="hm:" makes hm: links inside rendered Markdown tappable; the session screen's openDocument action forwards the tapped href to follow.
Screens
Component | Route | Presentation | Main testIds |
|---|---|---|---|
| tab root |
| |
| pushed |
| |
| pushed |
| |
| modal |
| |
| modal |
| |
| modal |
|
The agents-test route has no component: its fixture screen with the agents-test-key button is inline in app.contract.
Smaller components
Component | Draws | testIds |
|---|---|---|
A red message with Retry, only when the message is not empty |
| |
A tool call card with local |
| |
A child run link, disabled when it has no session |
| |
An expandable row for |
| |
A run card: title, |
|
agentDuration(ms) formats Xh Ym, Xm Ys or Xs. agentProviderOption looks up a provider type's form metadata with a safe default.
The session screen in detail
The transcript is one virtualized list with scroll-start="end" and scrollFollowEnd=true. Its rows are computed by derives (lines 497-506):
messageRows: every thread.rows entry.
pendingRows: the optimistic bubble, with at just below the maximum safe integer so it sorts last.
streamingRows: the partial assistant text thread.text, sorted after the optimistic bubble.
unpinned runs, at their own at.
timeline sorts all of those by at. tailRows then appends pinned runs, a tail-error row, and while thread.status == "streaming" a tail-status row reading "Replyingโฆ", "Running a toolโฆ" or "Thinkingโฆ" with a Stop button.
The comment explains the tail: "Runs and status belong in the transcript so they remain reachable with the keyboard open". Each row is drawn by kind (see chat rows): tool rows, context rows, continuation, system text, errors with "Retry reply" on the last row only, and bubbles, mine right on brand.fill, the agent's left on the secondary background. A session with a parentId shows "Driven by a parent conversation. Open it to intervene." in place of the composer. The composer is a growing textarea (max height 140) with a filled Send button that keeps focus.
Root state, tasks and actions
The full declaration table is in Root declarations: Activity and Agents. The actions (lines 416-550):
Action | Effect |
|---|---|
| Restamps clocks, clears draft and error, then routes: |
| Clock stamps; the visit stamp also resets backoff |
| One more page of sessions |
| Backoff and full refresh. See streams |
| Server sheet: normalise, then store |
| Test identity: set the account and mock URL, replace the route with |
| New agent form |
|
|
| Composer. Send sets the optimistic bubble and refocuses |
| Session and run commands |
| Clears the optimistic text. On success: |
| Provider sheet |
The default system prompt is the initial value of agentsPrompt: "You are a helpful assistant working inside Seed Hypermedia."
Contract tests
agents.test.contract starts every test at "/agents-test" with epoch now, taps agents-test-key, and waits for agentsData.health == "Online". Most tests first request POST "/dev/reset" on the mock agents server. The 15 tests:
Agents list, configuration, providers and validated creation.
Session opens newest and streams Markdown, tool results and run status.
Agent server validates the URL before saving.
A waiting run can be answered and a subsequent run can be stopped.
Failed sends keep the draft and recover without duplicate user bubbles.
A completed plan freezes before the closing reply.
A provider can be configured with a fixture-only API key.
Older conversations load through the server cursor.
Nested runs group by stable plan step and child conversations navigate both ways.
Trigger context, structured parts and source chips retain the message story.
RetrySession recovers the failed assistant reply without duplicating the user message.
A dropped stream reconnects and recovers the offline message once.
Read clocks advance on an idle session without reopening any stream.
Provider labels and default URLs follow metadata for hosted and local providers.
Timer waits show a countdown and budget pauses resume through SignalRun.
app.test.contract adds one: the Me tab's agent server row opens this package's server sheet. See Contract UI tests.
Related
Shared components and visual design: Avatar, Badge, EmptyState, tokens
Me: screens and components: the agent server row
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime