Documentation
¶
Overview ¶
Command mkchat gives a browser spec an agent of its OWN with a persisted chat, so the spec can drive real server-rendered bubbles (chatBubble's data-md and data-msg-id) without adding rows to the seeded agents other specs count. With MUSTER_E2E_DELETE=1 it deletes that agent (and, by the foreign keys, its sessions and messages) instead.
DATABASE_URL=…_e2e MUSTER_E2E_AGENT=<name> go run ./e2e/mkchat < messages.json DATABASE_URL=…_e2e MUSTER_E2E_AGENT=<name> MUSTER_E2E_DELETE=1 go run ./e2e/mkchat
messages.json is a JSON array of {"role":"user"|"assistant","content":"…"}, persisted in order into the agent's chat session. Every value a spec sends is invented fixture data.
With MUSTER_E2E_FOCUS set to a JSON array of {"subject","title","description"} (or {"subject","error"}: a failed refresh's reason, and no focus) it also writes session FOCUS (internal/focus) after the agent is committed: subject "self" is the agent it made, "mirror:<claude session id>" a mirrored session. Deleting deletes the agent (its focus goes with it) and every mirror focus named there.
THREADS. With MUSTER_E2E_THREADS=1 stdin is instead a JSON array of {"title":"…","hoursAgo":N,"messages":[…]}: one chat session per entry, its title and its last-activity time set as given (so a spec can draw a thread list whose recency it knows). MUSTER_E2E_DISPLAY_NAME sets the agent's display name — "chief" makes it the chief panel's agent.
DATABASE_URL=…_e2e MUSTER_E2E_AGENT=<name> MUSTER_E2E_DISPLAY_NAME=chief MUSTER_E2E_THREADS=1 go run ./e2e/mkchat < threads.json
MUSTER_E2E_ACTIVE_MINUTES_AGO=<n> backdates the agent's whole activity — its row's created_at and updated_at and every message it was given — to n minutes ago, so a spec can place it in the Agents list's activity order (agents.LastActivity) at a time it knows.
MUSTER_E2E_TASK=<title> also creates a task with that title, in ready_for_review, and makes it the agent's source task (agents.note_id), so the agent's page draws the completion banner's Mark complete. Deleting with MUSTER_E2E_TASK set deletes that task too.
MUSTER_E2E_APPEND=1 instead APPENDS stdin's messages to the latest session of the EXISTING agent MUSTER_E2E_AGENT (a message stored while a page is open).
MUSTER_E2E_KIND=claude-code with MUSTER_E2E_CC_ACCOUNT=<name> makes the agent that kind (its account is only a name: nothing is provisioned).
🔴 IT REFUSES ANY DATABASE WHOSE NAME DOES NOT END IN "_e2e" (e2edb.Check).
🔴 THE AGENT, ITS SESSION AND EVERY MESSAGE ARE ONE TRANSACTION. A message Postgres refuses (a NUL byte, say) leaves NO agent behind, so a failed run cannot leak a fixture agent into the shared e2e database for later specs to count. Deleting is idempotent: an agent already gone is success.