9 file(s), +523 / -112 lines
| Path | Role | + | - |
|---|---|---|---|
| messages/en.json | Config | +8 | -0 |
| messages/hi.json | Config | +8 | -0 |
| src/components/agents/agent-dock-mount.tsx | Component | +11 | -0 |
| src/components/agents/agent-dock.stories.tsx | Component | +32 | -3 |
| src/components/agents/session-menu.stories.tsx | Component | +99 | -42 |
| src/components/agents/session-menu.tsx | Component | +146 | -19 |
| src/lib/agents/__tests__/agent-session-store.test.ts | Library | +59 | -6 |
| src/lib/agents/agent-session-store.ts | Library | +145 | -39 |
| src/lib/agents/use-agent-sessions.ts | Library | +15 | -3 |
The Agent Chat Panel's session dropdown grows from four verbs to the full
lifecycle the Memory Engine defines. Per
pramaan-functions docs/notes/rfd-memory-engine.md
(RFD-MEM-001) §4.3 and §8, a counsel keeps several parallel conversations
per agent and manages each one — new · load · rename · compact ·
clear · archive/restore · delete — with the auto-resolved default
session pinned first and the rest ordered by most-recent activity.
"Return to the thread where we discussed limitation." — the session is the conversation container; the dropdown is how counsel moves between them.
The functions-side session routes are ME-2 (pramaan-spec #2096). Their
OpenAPI snapshot is not yet in this repo's src/gen
mirror — the mirror carries only
/app/agents/session-context/resolve, not the
agent-sessions lifecycle routes. Per the story's own guardrail,
pnpm codegen was not run here. So ME-3 ships the
dropdown against the existing client-side session cache
(agent-session-store.ts, Story-1721), and the verbs whose truth
is server-side attach at a named seam:
POST …/compact|clear routes. SessionMenu
renders them only when the caller passes onCompact/
onClear; the live Atlas dock omits both today (a commented
seam in agent-dock-mount.tsx). The moment the codegen-sync
chore lands the ME-2 contract, those callbacks pass the generated
mutations — no component change.
src/lib/agents/agent-session-store.ts — AgentSessionMeta
gains four fields the dropdown reads: availability
("live" | "archived"), isDefault (the pinned
default_agent_chat, RFD §4.1), lastActiveAt
(ordering), and compactedTurns (the display-only fold marker,
populated by ME-2 — the client never fabricates a turn count).
lastActiveAt DESC (RFD §8). New verbs
archiveSession/restoreSession; the default can
never archive or delete (it is the dock's guaranteed home thread), and
archiving or deleting the active session re-homes the binding to a live
session. switchSession stamps lastActiveAt and
refuses an archived target. The persisted envelope bumps to v: 2
so an old client's rows are discarded safely (HR-23).
use-agent-sessions.ts splits the snapshot into
sessions (live) and archivedSessions and exposes
archive/restore.
SessionMenusrc/components/agents/session-menu.tsx — the live list shows a
pin on the default row and a condensed N
marker on a compacted session; the active session's verbs are Rename ·
Compact · Clear · Archive · Delete (Archive/Delete disabled for the
default). An "Archived sessions (N)" item reveals the
restorable archived view inline (RFD §8's archive-management-list doctrine).
Clear and Delete each confirm; Archive is one-tap (restorable). Purely
presentational — all state lives in the store.
A Mira session and an Atlas session on the same matter are different rows,
different dropdowns, different memory scopes (RFD §4.1). This is
structural: the session scope key carries the
agent_key axis (buildSessionScopeKey), so the two
agents' lists can never collide — proven by a store test asserting an
Atlas scope and a mira:<matterId> scope stay independent.
Atlas's dock drives the dropdown fully today; Mira's dock adopts the same
control once ME-2 session-keys her conversation rail (that rail is
matter-keyed today — a separate ME-2 seam).
Agents.* keys (sessionDefault,
sessionCompacted, compactSession,
clearSession, clearSessionConfirm,
archiveSession, restoreSession,
archivedHeading) added to both
messages/en.json and messages/hi.json.
session-menu.stories.tsx covers the dropdown states: Default
(pinned + ordered), SingleDefaultSession (archive/delete disabled),
Compacted (the fold marker), FullVerbsAndArchived (compact + clear wired,
archived view), and an interactive Live harness.
pnpm test — 1024 passed (store lifecycle/ordering/archive/isolation cases added to __tests__/agent-session-store.test.ts).pnpm exec tsc --noEmit, pnpm lint, pnpm build — clean.