Documentation
¶
Overview ¶
Package ui renders the muster web UI with gomponents. It is dark-first (the document root carries the `dark` class), mobile-first, and driven by htmx + the htmx SSE extension so the pending-request list stays live without a custom client framework.
All request-derived content (commands, context output, project/host names) is treated as untrusted-ish and HTML-escaped by gomponents' Text/Textf nodes. Only the static, author-controlled scaffolding uses Raw.
Index ¶
- Constants
- Variables
- func AgentChatDraftKey(user int64, agent string, session int64) string
- func AgentDetailPage(v AgentDetailView, feat Features) g.Node
- func AgentHeaderPath(id int64) string
- func AgentListHref(name string, sessionID int64) string
- func AgentPath(name string) string
- func AgentSendPath(name string) string
- func AgentSessionHref(name string, sessionID int64) string
- func AgentTerminalDraftKey(user int64, agent string) string
- func AgentTerminalPage(v AgentTerminalView) g.Node
- func AgentTerminalPath(name string) string
- func AskerAsksBlock(inner, src string, viaHTMX bool) g.Node
- func AskerAsksHeading(n string) string
- func AskerAsksLive(src string) g.Node
- func AttentionBadgeHTML(n int) string
- func AttentionLiveScript(listID, src, event string) string
- func AwaitingApprovalBadge() g.Node
- func CCQueued(list []string) g.Node
- func ChatLogBody(v AgentDetailView) ([]byte, string, error)
- func ChiefPanel() g.Node
- func ChiefPanelToggle() g.Node
- func ClampComposeBody(s string) string
- func ComposePage(feat Features, body string) g.Node
- func ComposeURL(body string) string
- func ConnectorForm(f ConnectorFormView) g.Node
- func ConnectorRequests(list []ConnectorRequestView) g.Node
- func ConnectorRotateForm(name, errMsg string) g.Node
- func Connectors(c ConnectorsContent) g.Node
- func ConnectorsPanel(active bool) g.Node
- func DictateControlHTML(path, inputID, noteID, buttonID string) string
- func DictateNoteHTML(path, noteID, class string) string
- func DictateScriptHTML(path string) string
- func DispatchModalBody() g.Node
- func DispatchModalBodyFor(k KindChoices) g.Node
- func DispatchModalTaskBody(v TaskDispatchView) g.Node
- func DispatchUnavailableBody() g.Node
- func FocusHistoryPath(subject, cursor string) string
- func HomeHref(list []AgentCardView, mirrors []MirrorCardView, refs []RecentRef) string
- func HomeLeavingMirrorPath(r MirrorRef) string
- func HomeLeavingPath(name string) string
- func HostIconFor(ranks map[string]int, host string) string
- func IdleSectionAfterLabel(d time.Duration) string
- func InIdleSection(now, activeAt time.Time, pinned bool, after time.Duration) bool
- func KickoffFailedRemedy(resendSafe bool, namespace, name string) string
- func LiveHeartbeat() time.Duration
- func LiveStale(hb time.Duration) time.Duration
- func LiveWakeStale(hb time.Duration) time.Duration
- func MarkIdle(agents []AgentCardView, mirrors []MirrorCardView, now time.Time, ...)
- func MirrorAskCall(rowID string, qs []askq.Question, extra ...g.Node) g.Node
- func MirrorAskLive(v MirrorAskLiveView) g.Node
- func MirrorAskResult(rowID string, qs []askq.Question, answers map[string]string, note string, ...) g.Node
- func MirrorAskRowID(toolID string) string
- func MirrorAsksLive(vs []MirrorAskLiveView) g.Node
- func MirrorAsksSrc(ref MirrorRef) string
- func MirrorCardHref(m MirrorCardView) string
- func MirrorDraftKey(user int64, view, host, session, window string) string
- func MirrorPromptID(line int64) string
- func MirrorTerminalPath(host, session string) string
- func MirrorTerminalWSPath(host, session string) string
- func MirrorViewOnlyNote(kind string) string
- func MirrorViewPage(v MirrorViewView) g.Node
- func MirrorViewPath(host, session string) string
- func MirrorViewWSPath(host, session string) string
- func NavAgentsList(list []AgentCardView, mirrors []MirrorCardView, currentURL string, ...) g.Node
- func NavDocument(v NavDocumentView) g.Node
- func NotesCards(v TasksView) g.Node
- func NotesEditModalBody(v NoteEditView) g.Node
- func NotesModalBody(directories []string, directoriesFailed bool) g.Node
- func NotesModalBodyWith(directories []string, directoriesFailed bool, prefill string) g.Node
- func NotesPanel(active bool, drawn *shellTasks) g.Node
- func Page(activeTab string, feat Features) g.Node
- func PageWith(activeTab string, feat Features, data ShellData) g.Node
- func ParseIdleSectionAfter(v string) (time.Duration, error)
- func ParseLiveHeartbeat(v string) (time.Duration, error)
- func RenderAgentDetail(w io.Writer, v AgentDetailView, feat Features) error
- func RenderAgentHeader(w io.Writer, a AgentCardView) error
- func RenderAgentsHome(w io.Writer, feat Features) error
- func RenderChiefPanelBody(w io.Writer, v ChiefPanelView) error
- func RenderChiefThreadRows(w io.Writer, v ChiefThreadsView) error
- func RenderComposePage(w io.Writer, feat Features, body string) error
- func RenderConnectorForm(w io.Writer, f ConnectorFormView) error
- func RenderConnectorRequests(w io.Writer, list []ConnectorRequestView) error
- func RenderConnectorRotateForm(w io.Writer, name, errMsg string) error
- func RenderConnectors(w io.Writer, c ConnectorsContent) error
- func RenderDispatchModal(w io.Writer, k KindChoices) error
- func RenderDispatchModalTask(w io.Writer, v TaskDispatchView) error
- func RenderDispatchUnavailable(w io.Writer) error
- func RenderFocusHistoryPage(w io.Writer, v FocusHistoryPageView) error
- func RenderNavAgents(w io.Writer, list []AgentCardView, mirrors []MirrorCardView, currentURL string) error
- func RenderNavDocument(w io.Writer, v NavDocumentView) error
- func RenderNoteCard(w io.Writer, v TaskCardView) error
- func RenderNoteOptions(w io.Writer, notes []NoteOption) error
- func RenderNotesCards(w io.Writer, v TasksView) error
- func RenderNotesEditModal(w io.Writer, v NoteEditView) error
- func RenderNotesModal(w io.Writer, directories []string, directoriesFailed bool, prefill string) error
- func RenderNotifications(w io.Writer, active []ActiveRow, unread []NotificationRow) error
- func RenderPage(w io.Writer, activeTab string, feat Features) error
- func RenderPageWith(w io.Writer, activeTab string, feat Features, data ShellData) error
- func RenderRepoOptions(w io.Writer, repos []RepoView) error
- func RenderStatusIcon(w io.Writer, status string, awaitingApproval bool) error
- func RenderSwitcherPin(w io.Writer, pinned bool, fields [][2]string, back string, s *Switcher) error
- func RenderTagDatalist(w io.Writer, vocab []notes.TagCount) error
- func RenderTaskDetail(w io.Writer, v TaskCardView, feat Features) error
- func RenderTaskModal(w io.Writer, v TaskModalView) error
- func RenderTaskNotFound(w io.Writer, id string, feat Features) error
- func SendAgainPage(v SendAgainView) g.Node
- func SendQueueAnsweredText(asker string) string
- func SendQueueCancelPath(id int64) string
- func SendQueueDeletePath(id int64) string
- func SendQueueEditAnsweredText(asker string) string
- func SendQueueEditCancelPath(id int64) string
- func SendQueueEditPath(id int64) string
- func SendQueueEditSavePath(id int64) string
- func SendQueueFullID(id int64) string
- func SendQueueList(v SendQueueListView) g.Node
- func SendQueueRetryConfirmPage(action, field, question, back string) g.Node
- func SendQueueRetryPath(id int64) string
- func SendQueueSendNowPath(id int64) string
- func SetFaroConfig(c FaroSettings)
- func SetHostPreferences(p HostPreferences) error
- func SetLiveHeartbeat(d time.Duration) error
- func ShellTab(tab string, feat Features) string
- func SnapPurgeHTML() string
- func SnapScript(f Features) g.Node
- func SnapScriptNow(f Features) g.Node
- func StatusPollPath(id int64, awaiting bool, work mirror.WindowWork) string
- func StepUpDialog(s *StepUpView) g.Node
- func StepUpFormPage(v StepUpFormView) g.Node
- func StepUpWhy(window string) string
- func SubagentTailFragment(v SubagentTailView) g.Node
- func SwitcherPinToggle(pinned bool, fields [][2]string, back string) g.Node
- func TabKeys() []string
- func TabsScript() g.Node
- func TaskCompletePath(id int64) string
- func TaskDetailPage(v TaskCardView, feat Features) g.Node
- func TaskNotFoundPage(id string, feat Features) g.Node
- func TaskTitle(n notes.Note) string
- func ThemeHead() g.Node
- func ThemeHeadHTML() string
- func UploadFilePath(id string) string
- func UploadRevokePath(id string) string
- func UserMarker(f Features) g.Node
- func WorkPollToken(w mirror.WindowWork) string
- type ActiveRow
- type AgentBrief
- type AgentCardView
- type AgentDetailView
- type AgentTerminalView
- type CardAttention
- type ChatLine
- type ChatSurface
- type ChiefPanelView
- type ChiefThreadsView
- type ComboOption
- type ComposerField
- type ComposerQueue
- type ComposerView
- type ConnectorAuditView
- type ConnectorFormView
- type ConnectorGrantView
- type ConnectorPresetView
- type ConnectorRequestView
- type ConnectorSharedView
- type ConnectorView
- type ConnectorsContent
- type ContextView
- type CuratedModel
- type FaroSettings
- type Features
- type FocusHistoryEntry
- type FocusHistoryPageView
- type FocusView
- type HostPreferences
- type IdentityTint
- type KindChoices
- type MirrorAskLiveView
- type MirrorCardView
- type MirrorComposerView
- type MirrorIndex
- type MirrorIndexItem
- type MirrorOp
- type MirrorRef
- type MirrorTranscript
- func (t *MirrorTranscript) Ledger() cctranscript.ToolContext
- func (t *MirrorTranscript) Ops(events []cctranscript.Event) []MirrorOp
- func (t *MirrorTranscript) QueuedOps(list []string) []MirrorOp
- func (t *MirrorTranscript) Reset()
- func (t *MirrorTranscript) RestoreLedger(l cctranscript.ToolContext)
- func (t *MirrorTranscript) SubagentOps(list []mirror.Subagent) []MirrorOp
- func (t *MirrorTranscript) TakeContext() *ContextView
- type MirrorViewView
- type NavApp
- type NavChrome
- type NavDocumentView
- type NoteEditView
- type NoteOption
- type NotificationRow
- type QuickKey
- type RecentRef
- type RepoView
- type SendAgainView
- type SendQueueItem
- type SendQueueListView
- type SessionRuntimeView
- type SessionView
- type ShellData
- type StepUpFormView
- type StepUpView
- type SubagentTailView
- type Switcher
- type SwitcherCurrent
- type SwitcherItem
- type Tab
- type TabSet
- type TaskCardView
- type TaskDispatchView
- type TaskModalComment
- type TaskModalView
- type TasksView
Constants ¶
const ( AgentStripID = "agent-strip" AgentMenuSlot = "agent-menu-slot" AgentNoticesID = "agent-notices" AgentMenuID = "agent-actions" AgentRenameID = "agent-rename" )
The elements the agent page's actions live in.
const ( FromListParam = "from" FromListValue = "list" )
FromListParam is the query parameter (value FromListValue) a LIST link adds to AgentSessionHref: "this names whatever was the agent's latest session when the list was drawn, not this particular session".
const ( HomeLeaveParam = "leave" HomeLeaveHostParam = "leave_host" HomeLeaveSessionParam = "leave_session" HomeLeaveWindowParam = "leave_window" )
The parameters on HomePath naming the session home must not open: the page the viewer is leaving — an agent by name (HomeLeaveParam, HomeLeavingPath), or a mirrored window by its address (the three below, HomeLeavingMirrorPath).
const ( AttachRemoveLabel = "Remove attachment" AttachRevokeLabel = "Revoke this link" AttachRevoked = "Link revoked" AttachUploading = "Uploading…" AttachFailed = "That file could not be attached." AttachStillUploading = "Wait for the attachment to finish uploading." )
The attach control's and chips' accessible names and inline messages.
const ( // DraftMaxChars is mirror.MaxPaste (16 KiB) in characters: a longer text // cannot be sent anyway. DraftMaxChars = 16384 DraftMaxCount = 50 DraftTTLDays = 7 )
The drafts' bounds.
const ( DictateInsecure = "The microphone needs a secure (https) address. Open muster at its https address to dictate." DictateUnsupported = "This browser cannot record audio, so dictation is not available here." DictateDenied = "Microphone access was blocked. Allow it for this site in the browser's settings, then tap the mic again." // DictateDeniedApp replaces DictateDenied inside the Android app's WebView // (window[AppBridgeName] exists). There the block is Android's RECORD_AUDIO // permission for the app, not a site setting, and the WebView has no // browser settings to point at; the app's own "Open settings" dialog // names the same path. App versions 0.1.0 and 0.1.1 inject the bridge // but declare no RECORD_AUDIO, so they have no Microphone row; the page // cannot see the app's version, so the sentence says to update the app. DictateDeniedApp = "" /* 198-byte string literal not displayed */ DictateNoMic = "No microphone was found." DictateMicBusy = "The microphone is in use by another app." DictateNothing = "Nothing was heard in that recording. Try again, closer to the mic." DictateSignedOut = "You are signed out. Reload the page to sign in again." DictateEmpty = "Nothing was recorded." )
dictateMessages are the inline notes. Spelled once, here, and handed to the script, so a test can read the same sentence the page shows.
const ( MinIdleSectionAfter = time.Hour MaxIdleSectionAfter = 365 * 24 * time.Hour )
Bounds of a configured threshold (ParseIdleSectionAfter); 0 is "off".
const ( MinLiveHeartbeat = 250 * time.Millisecond MaxLiveHeartbeat = 5 * time.Minute )
MinLiveHeartbeat and MaxLiveHeartbeat bound MUSTER_LIVE_HEARTBEAT.
const ( LiveRetryBaseMs = 500 LiveRetryCapMs = 15000 )
LiveRetryBaseMs and LiveRetryCapMs shape a closed socket's backoff: base × 2^attempt, capped, then jittered to between half and all of it.
const ( MirrorAskPath = "/mirror/view/ask" MirrorAsksPath = "/mirror/view/asks" // MirrorAskCancelPath dismisses a card's picker in the terminal with one // Escape (POST). MirrorAskCancelPath = "/mirror/view/ask/cancel" )
MirrorAskPath takes a card's answers (POST); MirrorAsksPath is the window's live region (GET).
const ( AskStatePending = "pending" AskStateTyping = "typing" AskStateFailed = "failed" AskStateAnswered = "answered" AskStateAnsweredTerminal = "answered-terminal" AskStateDeclined = "declined" AskStateExpired = "expired" AskStateSuperseded = "superseded" AskStateHistory = "history" AskStateWaiting = "waiting" )
The states a card can be in, as data-ask-state carries them. AskStateHistory and AskStateWaiting are cards drawn from the transcript.
const ( ViewRendered = "rendered" ViewTerminal = "terminal" )
The two views' names, as data-view-swap and the view frame spell them.
const ( )
The nav entries that are not tabs: each names a sidebar link a document can mark as the one it belongs to (sidebar's activeTab / currentTab).
const ( PinPath = "/agents/pins" UnpinPath = "/agents/pins/delete" )
The pin routes (internal/api pins.go). The one toggle that posts here is the session switcher's (SwitcherPinToggle, the item of the bar's ⋯ menu): a form with hx-post, answered with the item in its new state and the bar's rows out of band. It also carries method/action, and without JavaScript the server sends the browser back to the session's page.
const ( SendQueueHeldText = "Being edited: held, and nothing queued for this window is sent until the edit is saved or cancelled." SendQueueHeldElsewhereText = "" /* 149-byte string literal not displayed */ SendQueueLapsedText = "An edit was not saved in time, so its hold ran out and the message kept its original text." SendQueueEditedText = "Edited." )
What a held, a lapsed and an edited message say under their preview.
const ( SendQueueSavedNote = "Saved." SendQueueEditCancelledNote = "Edit cancelled: the message is unchanged." )
What the list's script says when an edit is saved, and cancelled.
const ( SendQueueMenuLabel = "More actions for this queued message" SendQueueSendNowLabel = "Send now" SendQueueEditLabel = "Edit" SendQueueCopyLabel = "Copy message" SendQueueCancelLabel = "Cancel this queued message" )
The labels of a queued message's ⋯ menu.
const ( SendQueueEditTextLabel = "Edit this queued message" SendQueueEditSaveLabel = "Save" SendQueueEditCancelLabel = "Cancel editing; keep the message as it was" )
The edit form's labels.
const ( SuggestPath = "/mirror/view/suggest" SuggestEventPath = "/mirror/view/suggest/event" )
SuggestPath is the window's current set (JSON); SuggestEventPath where the row reports what happened to it.
const ( SwitcherRecent = "recent" SwitcherWaiting = "waiting" SwitcherPins = "pins" SwitcherAll = "all" )
The switcher's views, as data-switcher-view and the storage value spell them, in the order the view menu lists them.
const ( // ScrollRefusalUnsupported: this host cannot scroll (an older or read-only // muster-mirror). The page unwires the gesture; Reconnect wires it again. ScrollRefusalUnsupported = "unsupported" // ScrollRefusalOffline: the host is not connected now (it is reconnecting). ScrollRefusalOffline = "offline" // ScrollRefusalMode: the pane is in another tmux mode (a menu, choose-tree). ScrollRefusalMode = "mode" // ScrollRefusalGone: the session or window is no longer on the host. ScrollRefusalGone = "gone" // ScrollRefusalRefused: the host refused for another reason. ScrollRefusalRefused = "refused" )
The scroll route's refusal codes (ScrollRefusalHeader).
const ( ScrollOfflineNote = "Host reconnecting. Drag again once it is back." ScrollModeNote = "The pane is in another mode (e.g. a tmux menu). Close it, then drag again." ScrollGoneNote = "This window is no longer on the host." ScrollRefusedNote = "The host refused the scroll. Drag again to retry." )
The notes the page shows for each refusal that keeps the gesture wired.
const ( // StatusConnected is the status of an attach whose keys go straight into // the session — LIVE KEYS ARE ALWAYS ON, so this is the ordinary state. StatusConnected = "Connected" // StatusConfirmToType is a mirrored session's attach while the sign-in is // not fresh: the first key pressed asks "Confirm it's you". StatusConfirmToType = "Connected · confirm it's you to type" // StatusNoKeys is a host that takes no keys (it did not advertise // -interactive). It never says "read-only": what the composer can send is // its own note. StatusNoKeys = "Connected · this host takes no keys" // StatusReconnecting is a socket that closed and is coming back by itself. StatusReconnecting = "Disconnected · reconnecting…" )
The status line's words. Exported so a test pins the page against the same strings rather than a copy of them.
const AgentSendFromTerminal = "terminal"
AgentSendFromTerminal is the `from` field of a send that came from the agent's Terminal page: where its answer returns the browser to. Anything else is the chat page.
const AgentsAwaitingEvent = "agents:awaiting"
AgentsAwaitingEvent is the HX-Trigger the status poll answers with when what an agent page's strip was drawn with is no longer true — its awaiting-approval state, or its work chip (a new report, or one that expired with no POST to announce it); the strip re-fetches on it (agentStripTrigger).
const AppBridgeName = "musterApp"
AppBridgeName is the JavaScript object the Android app's WebView injects (WebViewCompat.addWebMessageListener), on muster's own origin only. Its presence is how a page knows it is inside the app; the page posts the pairing code and "open the app's notification settings" to it, and never receives a credential from it. The app repository uses the same name.
const AskerAsksID = "asker-asks"
AskerAsksID is the element id of a session page's asks block.
const AttentionBadgePath = "/attention/badge"
AttentionBadgePath is the badge fragment's route.
const AwaitingApprovalBadgeID = "awaiting-approval"
AwaitingApprovalBadgeID is the data attribute the badge carries, so tests and scripts find it by STATE, not by its wording.
const ChatLogVersionHeader = "Muster-Chat-Log-Version"
ChatLogVersionHeader carries the #chat-log version both ways: the server's version of the partial it sent (response), and the version the page holds (request). A refetch whose version still matches is answered 204, which htmx does not swap (its default responseHandling), so the page keeps its DOM.
const ChatSurfaceQueryParam = "surface"
ChatSurfaceQueryParam is the query-string name the chat-log partial reads its surface from. Exported because internal/api parses it and a second spelling there would silently answer with the page surface for ever.
const CredentialsPath = "/account/credentials"
CredentialsPath is the page where a user adds their own credentials.
const DefaultIdleSectionAfter = 14 * 24 * time.Hour
DefaultIdleSectionAfter is how long an entry must be idle to be drawn in the section when MUSTER_AGENTS_IDLE_AFTER is unset.
const DefaultLiveHeartbeat = 15 * time.Second
DefaultLiveHeartbeat is how often a live stream's server sends a heartbeat when MUSTER_LIVE_HEARTBEAT is unset.
const DictateIdleEvent = "muster:dictate-idle"
DictateIdleEvent is dispatched (bubbling) on a mic when it returns to idle — recorded and transcribed, refused, or nothing heard. A live refresh the mic held back (askBusyFunc) runs then (AttentionLiveScript): without it, a recording that inserted nothing left the refresh pending until the next focusout, which a mic tap never causes.
const DictateMaxSeconds = 120
DictateMaxSeconds is how long one recording may run; the page stops it there and transcribes what it has.
const DictateRevealEvent = "muster:dictate-reveal"
DictateRevealEvent is the event a page dispatches (bubbling) on content it put on the page by itself — innerHTML, not an htmx swap, so no htmx:load — for dictateScript to show the mics in it. The Asks list's and a mirrored view's asks block's live refresh (AttentionLiveScript) is that case: without it every mic a refresh drew stayed hidden.
const DirectorySearchPath = "/api/directories"
DirectorySearchPath is the route the directory combobox searches against. It is a CONSTANT shared by the renderer and the route table so the two cannot drift — a picker pointed at a path nothing serves degrades to "seed only" with no error anywhere, which is the failure mode this whole component exists to stop happening twice.
const DispatchOffHintAttr = "data-dispatch-off-hint"
DispatchOffHintAttr marks the sidebar's Agents head's note on a server that cannot dispatch (dispatchOffHint).
DispatchUnavailableAttr marks the sheet a server with no agent runtime answers GET /ui/agents/new with, in place of the dispatch form.
const DraftKeyPrefix = "muster.draft.v2:"
DraftKeyPrefix starts every draft's localStorage key.
const FocusHistoryRoute = "/ui/focus/history"
FocusHistoryRoute is the history fragment's route.
const HomeDispatchID = "home-deploy"
HomeDispatchID is the onboarding page's dispatch button (agentsEmptyState).
const HomeEmptyID = "agents-empty"
HomeEmptyID is the onboarding page's content (agentsEmptyState).
const HomeFallbackPath = "/agents"
HomeFallbackPath is the retired Agents list page's URL, GET /agents: home's redirect, or — when home has nothing to open — the onboarding page (RenderAgentsHome).
const HomePath = "/"
HomePath is home: the chief's chat, or the session opened last (internal/api homeTarget). Marking a task complete from an agent's page lands there, on both the htmx and the no-JS path — it used to land on the Agents list page, which is retired.
const InstallGuideURL = "https://github.com/ZacxDev/muster/blob/main/INSTALL.md"
InstallGuideURL is INSTALL.md on GitHub, for a person to read.
const KickoffRemedyResendSafe = "Not retried automatically. The task never reached the agent, so " +
"re-sending cannot pay for the task twice: open this agent's chat and send the task again."
KickoffRemedyResendSafe is the remedy under a failed kickoff whose record proves the task never reached the agent (agents.KickoffResendSafe).
const LiveHeartbeatAttr = "data-heartbeat"
LiveHeartbeatAttr is appScript's tag attribute carrying LiveHeartbeat in milliseconds.
const LiveManualAfter = 3
LiveManualAfter is how many reconnects in a row may fail before a view offers its manual Reconnect (it keeps retrying on its own all the same).
const LivePingEvent = "muster.ping"
LivePingEvent is the /events stream's heartbeat event (its data is "{}").
const LivePingFrame = `{"type":"ping"}`
LivePingFrame is a socket's heartbeat, exactly as its server writes it (a text frame): a page takes it as "alive" and nothing else.
const LiveTickMs = 1000
LiveTickMs is how often a visible page's watchdog looks at its sockets.
const MirrorCompletePath = "/mirror/view/complete"
MirrorCompletePath is the Rendered view composer's menu data: the window's `/` commands and skills and `:` snippets, as JSON (internal/api's handleMirrorComplete), fetched by composerMenuScript.
const (
// MirrorComposeEmpty answers a Send with nothing typed: said, not swallowed.
MirrorComposeEmpty = "Type a message first."
)
The composer's own messages. The script shows them in #mv-note.
const MirrorHermesNoSendNote = "" /* 188-byte string literal not displayed */
MirrorHermesNoSendNote is a Hermes window's rendered view's composer, drawn disabled on a host that does not send to Hermes (docs/design/hermes.md).
const MirrorOfflineText = "The host's muster-mirror is not connected, or the host no longer lists this tmux session."
MirrorOfflineText is what a mirrored window's own page says while its host is not serving it.
const MirrorReadOnlyNote = "This host is read-only — its muster-mirror was not started with -interactive, so nothing can be sent from here."
MirrorReadOnlyNote is what a read-only host's composer says instead of accepting text.
const MirrorSendPath = "/mirror/view/send"
MirrorSendPath is where the rendered view's composer posts a message: into the session's Claude Code pane, and only that.
const MirrorSubagentPath = "/mirror/view/subagent"
MirrorSubagentPath is a subagent's recent steps, as an HTML fragment (?host&session&window&agent).
const MirrorTerminalScrollPath = "/mirror/terminal/scroll"
MirrorTerminalScrollPath is where the Terminal view's drag-to-scroll posts (internal/api's handleMirrorTerminalScroll).
const MirrorTerminalSendPath = "/mirror/terminal/send"
MirrorTerminalSendPath is where the Terminal view's composer posts a message: into the session's active pane, whatever runs in it.
NavAgentsListID is the element the partial is swapped into.
NavAgentsPath is the sidebar list's partial.
NavDeployID is the sidebar's dispatch "+" (navDeployButton).
NavIdleID is the sidebar's Idle group (navIdleGroup).
NavOpenEvent is what appScript's setOpen dispatches on document each time the sidebar opens.
const OnboardingPrompt = "Set up muster for me: read https://raw.githubusercontent.com/ZacxDev/muster/main/INSTALL.md " +
"and follow it step by step. Ask me everything you need in one go up front, then do the rest yourself."
OnboardingPrompt is THE one prompt: what a person pastes into their coding agent to have it set muster up (INSTALL.md), or connect another machine to one that runs.
🔴 IT IS STATED IN FOUR PLACES AND MUST BE BYTE-IDENTICAL IN ALL OF THEM: here (home's onboarding page, agentsEmptyState), the fenced block at the top of INSTALL.md, the one in docs/onboarding.md, and the README's own copy in its Quickstart. TestTheOnePromptIsTheSameEverywhere pins that, so a reword in one place fails until all four agree. Changing it is a public-facing change: people will have copied the old one.
const PasskeyJS = `` /* 2217-byte string literal not displayed */
PasskeyJS is the WebAuthn helpers every passkey script on every page shares: the sign-in and account pages (internal/api) and the confirm dialog here. mpk* names keep them out of any other page script's way.
⚠ THE JSON <-> ArrayBuffer CONVERSION IS DONE BY HAND, not with PublicKeyCredential.parseRequestOptionsFromJSON / credential.toJSON(): those are missing from browsers muster's users still run (Safari before 18.x), and a page that works only where they exist would fail exactly on the phones the passkeys are for. GoTrue's options use base64url for every binary field.
const PasskeyPrefetchJS = `` /* 229-byte string literal not displayed */
PasskeyPrefetchJS: WebAuthn options are fetched BEFORE the tap and kept, so the tap's handler reaches navigator.credentials without a network round trip in between. WebKit grants WebAuthn only within a user gesture, and an await on fetch inside the click handler can outlive it (NotAllowedError on iOS). A prefetched challenge is single-use and GoTrue expires it after 5 minutes, so one older than mpkMaxAge, or one already spent, is fetched again. trigger, when given, is kept on the prefetch: why it was fetched (the confirm dialog's telemetry reports it).
const PostgresPresetKey = "postgres"
PostgresPresetKey is the postgres connector preset's key (connectors.PostgresPreset): the form asks for the database settings instead of naming fixed hosts.
const ProvisionerGuideURL = "https://github.com/ZacxDev/muster/blob/main/docs/provisioner.md"
ProvisionerGuideURL is docs/provisioner.md on GitHub: how to give muster an agent runtime so it can dispatch.
const RestoreChipDelayMs = 1000
RestoreChipDelayMs is how long a restore catches up before its Updating… chip shows.
const RestoreMaxAwayMs = 10 * 60 * 1000
RestoreMaxAwayMs is how long a page may sit in the back/forward cache and still be shown as it was: past it, a restore reloads.
⚠ IN CHROMIUM THIS RULE ALMOST NEVER FIRES; IT IS KEPT FOR THE OTHERS. Chromium drops a cached page at 600 s by itself (kDefaultTimeToLiveInBackForwardCacheInSeconds; measured in Chromium 153: a static page 590 s away was restored, 610 s away it was not, and Back loaded it from the HTTP cache), so a Chromium restore is already under this bound. WebKit keeps an entry for 30 min (Settings.yaml BackForwardCacheExpirationInterval) and Firefox for 30 min (browser.sessionhistory.contentViewerTimeout): there a page away for 10 to 30 minutes IS restored, and this is what reloads it. That covers Safari and every browser on iOS. Not measured here: the WebKit and Firefox builds Playwright drives have their back/forward caches turned off.
const RestoreParticipantsVar = "__musterRestoreParts"
RestoreParticipantsVar is the window property a page's own script pushes its participant onto: {hide(event), show(reason) → optional Promise (caught up), wake(reason, staleMs) — reconnect if its socket is closed, or open but silent for over staleMs since its last heartbeat (live.go), alive() → false once the page's script has torn itself down}. A list rather than a call, so a script that runs before appScript joins all the same.
const RestoreRefreshAttr = "data-restore-refresh"
RestoreRefreshAttr marks a region a restore redraws from the page's own fresh copy: the element of the fresh document with the same value replaces this one's children. Every such region keeps its size (the switcher's rows are a fixed h-11), so the redraw moves nothing.
const ScrollGaveUpNote = "Scrolling is not reaching the host. Drag again to retry."
ScrollGaveUpNote is what the Terminal view says when scrolls stopped reaching the host and the page dropped what it had not sent.
const ScrollRefusalHeader = "X-Muster-Scroll-Refusal"
ScrollRefusalHeader names, on a scroll's refusal, WHICH refusal it is (one of the ScrollRefusal* codes), so the page acts on a code rather than on a status a proxy could also answer. Only ScrollRefusalUnsupported stops the gesture; every other one shows its note, keeps the gesture wired and clears once a scroll lands.
const SendAgainField = "again"
SendAgainField is the form field that says a send IS the person's explicit "Send again" of a message that may already have been delivered: the server refuses the same text to the same place without it (internal/api sendNonces.hold).
const SendAgainHeader = "X-Muster-Send-Again"
mirrorComposerScript sends the composer's text without leaving the page.
A 403 carrying X-Muster-Step-Up means the sign-in is not fresh: "Confirm it's you" is asked (window.musterStepUp, stepup_confirm.go) and on success the SAME text — still in the box, never cleared on a refusal — is sent again. The page never decides freshness; the server does.
What a person sees: sent → the box clears (and the view above shows the text land); not sent → the reason, inline, with the text kept; nothing typed → MirrorComposeEmpty rather than a Send that silently does nothing.
🔴 WHEN THIS SCRIPT'S WAY FAILS, THE BROWSER'S TAKES OVER (native()). Three cases, each of which used to end in nothing visible or in a guess:
- the request got NO ANSWER while the browser believes it is online — a sign-in redirect at an edge that a fetch cannot follow, a proxy's own error. The browser's own form submission CAN follow a redirect, and shows whatever the edge has to say;
- a stale sign-in on a page with no confirm dialog to ask through;
- anything this script throws.
Offline is the one failure it keeps for itself: it says so and keeps the text, because the browser's answer to a submit with no network is an error page in place of the conversation. SendAgainHeader marks a send's answer that MAY have been delivered (the host never confirmed it): the composer offers "Send again", which mints a new nonce; the same nonce is never delivered again (internal/api).
const SendQueueDeleteLabel = "Delete this message"
SendQueueDeleteLabel is a finished message's Delete, as a screen reader names it.
const SendQueueEditHoldMinutes = 10
SendQueueEditHoldMinutes is how long an edit holds its message, in minutes (sendqueue.EditHold; a test in internal/api holds the two together).
const SendQueueEditParam = "edit"
SendQueueEditParam is the query parameter that draws a held row open as its edit form, on the view (a no-script Edit's redirect) and on the list (the script's re-read after an Edit).
const SendQueueFullLabel = "Show the whole message"
SendQueueFullLabel is the start of what a screen reader names a row's preview, which a tap opens whole (sendQueuePreview).
const SendQueueHoldParam = "hold"
SendQueueHoldParam is the hold an Edit gave this device: the form is drawn only under it (a held row named under any other is being edited elsewhere).
const SendQueueLabel = "Queue for when idle"
SendQueueLabel is Queue's text in the caret menu.
const SendQueueMayHaveSentText = "May already have been sent."
SendQueueMayHaveSentText is what a failed message that may already have been sent says beside its Retry.
const SendQueuePath = "/send-queue"
SendQueuePath is the queue's route: POST queues a message, GET is a target's list (SendQueueList), drawn as a fragment.
const SendQueueWaitingFullID = "mv-queue-waiting-full"
SendQueueWaitingFullID is the popover that shows the waiting line whole.
const SidebarSearchID = "sidebar-search"
SidebarSearchID is the sidebar's magnifier (sidebarSearchButton).
const SnapStoreDB = "muster-snap"
SnapStoreDB is the IndexedDB database the store keeps snapshots in. The purge deletes it by this name; mirror-snap.js spells it once too, and TestTheSnapshotPurgeNamesTheStoresDatabase pins the two together.
const SuggestCutoff = 8 * time.Second
SuggestCutoff is how long after a turn ends its suggestions may still appear; past it they never do (and the server stops before spending).
const SuggestPausedText = "Suggested replies are paused: you rarely tapped them."
SuggestPausedText is the composer's line while the viewer's suggested replies are auto-paused.
const SuggestRowLabel = "AI-suggested replies"
SuggestRowLabel names the row (its group's accessible name).
const SwitcherID = "session-switcher"
SwitcherID is the bar's element id.
const (
// SwitcherMoreLabel is the ⋯ button's accessible name.
SwitcherMoreLabel = "More for this session"
)
The ⋯ menu and its button.
const SwitcherPinID = "switcher-pin"
SwitcherPinID is the pin's menu item (a submit button): one per page.
const SwitcherPinView = "switcher"
SwitcherPinView is the form field value that asks the pin routes to answer with the bar's pin item (internal/api pins.go) rather than an empty answer.
const ThemeColorDark = "#110F1C"
ThemeColorDark is the dark theme's background (`--mu-bg` on `.dark`). It is the default theme, so it is also the manifest's theme_color and background_color (internal/api serves the manifest from these values).
const ThemeColorLight = "#F6F4FB"
ThemeColorLight is the light theme's background (`--mu-bg` on `:root:not(.dark)`).
⚠ NOTHING RENDERS IT ANY MORE: the light theme is unreachable (the sidebar's toggle is gone and ThemeHead forces dark). The light tokens in input.css and their contrast tests stay until a later cleanup removes the light palette as a whole; this constant stays with them so TestThemeColorsAreTheBackgroundTokens still pins it to its token.
const TmuxOneLiner = "tmux new -A -s work claude"
TmuxOneLiner is how a coding agent is started so muster shows it: inside tmux, on a machine whose muster-mirror is connected.
const TranscribePath = "/transcribe"
TranscribePath is where a recording is posted.
const UpdatingChipAttr = "data-updating-chip"
UpdatingChipAttr marks a page's Updating… chip (updatingChip). A page with one is a VIEW page, and a restore re-requests it.
const UploadPath = "/uploads"
UploadPath is where the composer posts a file.
const UserMarkerName = "muster-user"
UserMarkerName is the <meta> every VIEW page carries naming its signed-in user (UserMarker).
const ViewFrameAttr = "data-muster-view"
ViewFrameAttr marks the frame that holds the other view; its value is that view's name (ViewRendered, ViewTerminal).
Variables ¶
var AttentionKindIcons = map[string]struct{ Icon, Words string }{
"session": {"🔒", "a session waiting at a prompt"},
"question": {"💬", "a session asking a question"},
"ask": {"❓", "an agent's question"},
"plugin": {"✉️", "a reply draft to approve"},
}
AttentionKindIcons is each attention kind's badge icon and the words a screen reader hears for it. internal/api's TestEveryAttentionKindHasABadgeIcon pins that every kind an entry can count is here.
var QuickKeys = []QuickKey{
{ID: "esc", Label: "Esc", Aria: "Escape", Seq: "\x1b"},
{ID: "tab", Label: "Tab", Aria: "Tab", Seq: "\t"},
{ID: "stab", Label: "⇧Tab", Aria: "Shift Tab", Seq: "\x1b[Z"},
{ID: "ctrlc", Label: "^C", Aria: "Control C", Seq: "\x03"},
{ID: "enter", Label: "⏎", Aria: "Enter", Seq: "\r"},
{ID: "1", Label: "1", Aria: "1", Seq: "1"},
{ID: "up", Label: "↑", Aria: "Up arrow", Seq: "\x1b[A"},
{ID: "down", Label: "↓", Aria: "Down arrow", Seq: "\x1b[B"},
{ID: "left", Label: "←", Aria: "Left arrow", Seq: "\x1b[D"},
{ID: "right", Label: "→", Aria: "Right arrow", Seq: "\x1b[C"},
{ID: "2", Label: "2", Aria: "2", Seq: "2"},
{ID: "3", Label: "3", Aria: "3", Seq: "3"},
}
QuickKeys is the bar, in display order. The sequences are what xterm itself sends for the same keys in normal cursor mode; tmux parses them either way. The digits answer the TUI's numbered permission prompts, and Shift-Tab cycles its permission mode.
Functions ¶
func AgentChatDraftKey ¶
AgentChatDraftKey is the draft key of a dispatched agent's chat box, in chat session id.
func AgentDetailPage ¶
func AgentDetailPage(v AgentDetailView, feat Features) g.Node
AgentDetailPage renders the full agent detail document: live logs (SSE) and a chat box (WebSocket) to inject messages.
func AgentHeaderPath ¶ added in v0.110.0
AgentHeaderPath is the strip's refresh: GET /ui/agents/{id}/header.
func AgentListHref ¶
AgentListHref is a list's link to an agent (a sidebar row, a switcher pill, home's target, a task card's Open chat): AgentSessionHref on the session that was the agent's latest when the list was drawn, marked &from=list.
🔴 THE MARKER IS WHAT KEEPS THE ONE-HOP LINK FROM GOING STALE. The bare URL resolved the latest session at TAP time; a pinned ?session= is the latest at DRAW time, and a list can sit open (or in the back/forward cache) while another session becomes the latest. api.Server.handleAgentDetail sees the marker and, only when the named session is no longer the latest, 303s to the latest — so a fresh link costs one hop and a stale one costs the same two the bare URL always did. A link WITHOUT the marker (the session drawer, a redirect after opening a session) means that session and is never moved.
func AgentSendPath ¶
AgentSendPath is where a message for an agent is posted as a form: the composer on its Terminal page, and its chat form when the page's socket cannot carry the message.
func AgentSessionHref ¶
AgentSessionHref is THE in-app link to an agent session's page: /agents/{name}?session={id}, the exact URL a bare GET /agents/{name} answers with its 303 (api.Server.handleAgentDetail builds its Location with this same function, so the two cannot disagree).
🔴 EVERY IN-APP LINK TO AN AGENT'S PAGE GOES THROUGH HERE, AND IT NAMES THE SESSION WHENEVER THE CALLER KNOWS IT. The bare URL costs one extra round trip on every open: the browser fetches it, gets the 303, and only then fetches the page. Measured with an emulated phone (350 ms RTT, 4x CPU), the first bubble landed at 828/1203 ms through the bare link and 476/488 ms through this one. api.TestEveryAgentPageLinkGoesThroughAgentSessionHref ledgers every caller and fails when a link to the page is built anywhere else.
sessionID <= 0 (the caller has no session: the agent has none yet, or the read failed) gives the bare page, which still redirects — and creates the session — exactly as before. The bare URL itself keeps redirecting for bookmarks and links from outside the app.
func AgentTerminalDraftKey ¶
AgentTerminalDraftKey is the draft key of a dispatched agent's Terminal view message box (it sends to the agent's current chat session).
func AgentTerminalPage ¶
func AgentTerminalPage(v AgentTerminalView) g.Node
AgentTerminalPage is a full-height document: a header, the terminal, the quick-key bar, the message composer (when there is one) and the session switcher.
🔴 THE SWITCHER IS SERVER-RENDERED AT A FIXED HEIGHT, BEFORE THE TERMINAL'S SCRIPT, so the terminal's first measure of its box (agentTerminalScript's proposed()) is already the box with the bar's room taken: its arrival, its pending-until-whole visibility and a view switch in it change no layout, and so send no resize. (And no size the page could send shrinks the far side's window anyway: internal/termsize.)
🔴 LIVE KEYS ARE ALWAYS ON; THERE IS NO SWITCH (operator ask: "make live terminal keys always enabled and hide the button for it"). Keystrokes and the quick keys go straight into the session. ALWAYS-ON BYPASSES NO GATE:
- a mirrored session's live keys still need a FRESH sign-in (internal/stepup). The page attaches with them when it believes the sign-in is fresh; otherwise it attaches without and the first key pressed asks "Confirm it's you" (passkey or password). The server refuses an interactive attach on a stale sign-in whatever the page does;
- a host that did not advertise -interactive takes no keys: they are drawn disabled (ReadOnlyOnly), and the hub refuses an interactive attach to it.
A terminal hidden behind the other view (view_swap.go) keeps its attach as it is — its frame is inert there, so nothing can type into it — rather than re-attaching twice on every swap.
🔴 THE PAGE NEVER CALLS ITSELF "READ-ONLY" — the composer under the terminal sends whatever the keys can do. A host that genuinely cannot be sent to says so ONCE, in its composer's disabled note (MirrorReadOnlyNote).
🔴 IT IS ITS OWN DOCUMENT, NOT A PANEL OF THE AGENT PAGE. The agent page is hx-boost'ed and its chat script tears down and re-creates its socket on every boosted swap; a terminal living inside that lifecycle would be re-attached on every navigation. The links into this page opt out of boost, so it is always a real load with its own scripts. The Rendered | Terminal switch keeps that: it opens this page in a FRAME over the agent page — its own document still — rather than in the agent page's body (view_swap.go).
⚠ THE SERVER DECIDES INDEPENDENTLY: it attaches read-only for anything but mode=rw, and refuses mode=rw where the gates above say no.
🔴 A WIDER FAR SIDE IS SCROLLED, NOT SQUEEZED (internal/termsize). When the session's window is wider (or taller) than this page, the far side keeps its size and says so in-band; the page renders that size inside #term-scroll, which scrolls both ways and can be pinch-zoomed, and offers "Fit width".
func AgentTerminalPath ¶
AgentTerminalPath is the terminal page of an agent.
func AskerAsksBlock ¶
AskerAsksBlock is a session page's block of its asker's OPEN attention asks: inner, the content internal/api renders (the queue's own items and answer forms; "" for none, and then the block takes no room), refreshed from src. viaHTMX: the page is in the shell, whose htmx SSE refreshes it (the agent page); otherwise (the mirrored view, its own document) the page carries internal/api's attentionLiveScript, which refreshes it by its id.
Bounded and scrolling on its own (max-h, overflow-y-auto, flex-none), so on a phone it never pushes the conversation or the pinned composer off screen.
It carries "Hide until next ask" (AskerAsksHeading) and, after it, the chip that reopens it (askerAsksChip) — see HIDE UNTIL NEXT ASK below.
func AskerAsksHeading ¶
AskerAsksHeading is the block's heading row: the count (n, "1 question") and the hide button. internal/api's askerAsksHTML draws it above the items.
func AskerAsksLive ¶
AskerAsksLive is what keeps a block drawn with viaHTMX false live: the queue page's own script, on the block (nothing without a block).
func AttentionBadgeHTML ¶
AttentionBadgeHTML is the badge for n waiting items: hidden at zero. It is the slot's CONTENT and carries no htmx wiring of its own.
func AttentionLiveScript ¶
AttentionLiveScript keeps the element listID live: on the queue's SSE event (event: internal/api's EventAttentionChanged) it re-fetches src into it — unless the owner is typing an answer (askBusyFunc), in which case it waits until they leave the field. The /attention page's list and a mirrored window's asks block use it; each is its own document (no htmx), so it opens its own stream.
func AwaitingApprovalBadge ¶
AwaitingApprovalBadge is the small pill shown while an agent waits on a human to approve a tool call.
func CCQueued ¶ added in v0.129.0
CCQueued is the region with list in it — hidden, and empty, when list is empty. Each message is text (gomponents escapes it), the host's redacted, bounded copy (mirror.NormalizeQueued).
func ChatLogBody ¶
func ChatLogBody(v AgentDetailView) ([]byte, string, error)
ChatLogBody renders #chat-log's inner HTML for v and its version: a hash of exactly those bytes. The page (chatLogVersioned) and the partial (api.Server.handleAgentChatLog) both get theirs from here, so "unchanged" means "the server would draw the same bytes" — new messages, a status move (the provisioning row), the task banner and the surface all change it, with no list of inputs to keep in step.
🔴 WHY THE REFETCH IS CONDITIONAL: every open of an agent page sent its whole transcript TWICE. The document carries it, and then the htmx:sseOpen arm of chatLogTrigger re-fetched all of it (~72 KB at chatHistoryCap's 200 messages) the moment the event stream connected, and swapped it in again. That arm exists to catch a broadcast missed between render and connect, so it cannot simply go; with the version it costs a 204 unless something really did change.
func ChiefPanel ¶
ChiefPanel is the slide-out itself, rendered at BODY level by the shell.
🔴 BODY LEVEL IS WHAT SATISFIES CRITERION 3. #panel-tmux replaces its entire innerHTML every 60s and on every snapshot push; the other four tab panels swap independently. A panel rendered inside <main> would be destroyed by any of them — along with the operator's half-typed message and the live WebSocket — so it is a sibling of the FABs and popovers, which are body-level for exactly this reason.
func ChiefPanelToggle ¶
ChiefPanelToggle is the launcher, rendered by the tmux panel body.
⚠ IT IS RENDERED INSIDE A SWAP TARGET AND THAT IS FINE. It is a plain <button> carrying a data attribute; the handler is delegated on `document`, so a button destroyed and rebuilt on every panel refresh keeps working without a rebind. That is the whole reason constraint 3 is worth obeying.
func ClampComposeBody ¶
ClampComposeBody cuts s to composeMaxBytes without splitting a UTF-8 sequence.
func ComposePage ¶
ComposePage is the tasks shell with the new-task sheet opening itself on load, pre-filled with body. It is what GET /share and the "New task" shortcut (/tasks?new=1) serve.
🔴 IT CREATES NOTHING. Opening the page only fills the form; the task is written by the operator pressing Save, through the SAME POST /tasks every other create uses — one write path, one session check, one broadcast. A GET that wrote would be a create-by-link.
func ComposeURL ¶
ComposeURL is the new-task sheet's body URL with an optional pre-filled body. The value is query-escaped here and attribute-escaped by gomponents.
func ConnectorForm ¶
func ConnectorForm(f ConnectorFormView) g.Node
ConnectorForm is the create / enter-credential form.
func ConnectorRequests ¶
func ConnectorRequests(list []ConnectorRequestView) g.Node
ConnectorRequests renders the pending-request cards (empty when none).
func ConnectorRotateForm ¶
ConnectorRotateForm replaces a connector's secret.
func ConnectorsPanel ¶
ConnectorsPanel is the tab's static shell; it lazy-loads /ui/connectors.
func DictateControlHTML ¶ added in v0.121.0
DictateControlHTML is dictateControl rendered to a string.
func DictateNoteHTML ¶ added in v0.121.0
DictateNoteHTML is dictateNote rendered to a string.
func DictateScriptHTML ¶ added in v0.121.0
DictateScriptHTML is dictateScript rendered to a string: once per page, AFTER every mic the page draws at load (its first run reveals the mics then on the page; a later one is shown by htmx:load or DictateRevealEvent).
func DispatchModalBody ¶
DispatchModalBody is the /ui/agents/new partial (the sidebar's "+"): the full dispatch form. It renders INSTANTLY — the repo + task option lists lazy-load (with animated skeletons) and the model field searches OpenRouter on type, so the form never blocks on a slow upstream. Loaded into #agent-modal-body when the sidebar's "+" is tapped. The Task-card Dispatch button uses the task-scoped variant (DispatchModalTaskBody) instead; this task-less form is unchanged.
func DispatchModalBodyFor ¶
func DispatchModalBodyFor(k KindChoices) g.Node
DispatchModalBodyFor is DispatchModalBody with the deployment's agent kinds; more than one renders the kind picker (see kindPicker).
func DispatchModalTaskBody ¶
func DispatchModalTaskBody(v TaskDispatchView) g.Node
DispatchModalTaskBody is the /ui/agents/new?note=<id> partial: a TASK-SCOPED dispatch confirm. The task is known, so instead of the full form's "Existing task" combobox + ad-hoc textarea, it shows two fixed rows — Model and Repository — each with the task's resolved value as static text plus an inline "Edit" that reveals the corresponding editable control (pre-seeded to the current value). The editable controls carry the same field names the dispatch POST reads (model / repo), and — being present-but-hidden — they submit the resolved values even when never opened, so this is a one-tap confirm. Overrides are THIS-DISPATCH-ONLY (never persisted back to the task). The task is submitted via a hidden note_id; repo_branch rides along as a hidden field.
func DispatchUnavailableBody ¶ added in v0.107.0
DispatchUnavailableBody is the /ui/agents/new partial on a server that cannot dispatch (Features.Dispatch false): what is missing and where to set it up, instead of a form whose submit can only answer 503.
No document drawn by that server offers the sheet (no "+", no card Dispatch button), so this is reached by a page rendered before the server lost its provisioner, or a hand-typed request. It carries no form, so nothing on it can POST /agents.
func FocusHistoryPath ¶
FocusHistoryPath is one page of subject's ("agent:12", "mirror:<sid>") history: the newest page for cursor "", else the page after cursor.
func HomeHref ¶ added in v0.110.0
func HomeHref(list []AgentCardView, mirrors []MirrorCardView, refs []RecentRef) string
HomeHref is where home (`/`, and the retired /agents) opens for a viewer with no chief to open (internal/api homeTarget): the session the viewer opened LAST that is still listed (refs, newest first — the switcher's Recent order), else the sidebar's first row (navOrder: whoever waits on the operator, then the most recently active), else "" — nothing to open, and home draws the onboarding page.
🔴 A CONVERSATION, NOT A PAGE OF CONVERSATIONS (operator decision: "make the default view open to the chief"). Without a chief, an empty page whose only way on is a drawer that starts shut on a phone would be a dead end; the last conversation is what a chat app opens.
func HomeLeavingMirrorPath ¶ added in v0.110.0
HomeLeavingMirrorPath is home, leaving the mirrored window at r out — where that window's Rendered view and terminal send their Home arrow. Opening the view records a visit, so without it home with no chief is this very window.
func HomeLeavingPath ¶ added in v0.110.0
HomeLeavingPath is home, leaving the agent named name out — where a page that sends the viewer away from that agent (Mark complete) sends them. Without it, home with no chief is the session opened last: the very page being left.
func HostIconFor ¶
HostIconFor is the icon key of a mirrored host: its named icon (HostPreferences.Icons) when it has one; else by its registration rank in ranks (mirror.RanksByRegistration) — rank r draws rankedIcons()[r mod N] — or, for a host ranks does not hold, by a hash of its name. A glyph named for a host is never drawn for another. This is the one rule; every surface that draws a host's icon is handed its result.
func IdleSectionAfterLabel ¶
IdleSectionAfterLabel is a threshold as the boot banner says it (the retired Agents list's Idle header said it too): whole days ("14 days"), else whole hours ("36 hours"), else the duration.
func InIdleSection ¶
InIdleSection is the ONE rule: whether an entry last active at activeAt is drawn in the Idle section, as of now. See the file header.
func KickoffFailedRemedy ¶
KickoffFailedRemedy is the remedy line under a failed kickoff. Nothing re-sends automatically: the deliverer stamps kicked_off before the paid turn so a turn is never run twice, and a turn that fails after the stamp is not retried (an operator decision).
🔴 IT TELLS THE OPERATOR TO CHECK BEFORE RE-SENDING UNLESS NOTHING WAS SENT. A shutdown, a timeout or a transport error after the request was written can leave the runtime still running the turn, and an empty reply can hide a turn the runtime retried and finished; re-sending then pays for the task twice. Only a connection that was never opened, or a runtime that refused the turn as not_ready for the whole delivery, proves otherwise (resendSafe).
⚠ ITS ONLY DYNAMIC PARTS ARE THE AGENT'S NAME AND NAMESPACE, which the agent's page and GET /api/agents already show. No part of the note or of kickoff_error is in it; api.TestAnOwedKickoffIsReportedWithoutTheNotesText scans the rendered remedy.
func LiveHeartbeat ¶
LiveHeartbeat is the interval every live stream's server sends a heartbeat at, and the one the page's staleness thresholds are derived from (the page reads it off appScript's tag, data-heartbeat).
func LiveStale ¶
LiveStale is how long a socket that has heard a heartbeat may go silent before the watchdog replaces it: two heartbeats missed, and a margin.
func LiveWakeStale ¶
LiveWakeStale is the same at a wake: one heartbeat missed, and a margin. A page waking from sleep has not been able to hear anything, so the bound is tighter than the watchdog's.
func MarkIdle ¶
func MarkIdle(agents []AgentCardView, mirrors []MirrorCardView, now time.Time, after time.Duration)
MarkIdle sets each view's Idle by InIdleSection over its last activity (listEntry.activeAt), in place. internal/api calls it once per build of the entries, after the pins are marked.
func MirrorAskCall ¶
MirrorAskCall is a call the transcript holds with no result yet: its questions, read-only. Claude Code 2.1.289 writes the call together with its result (measured: neither is in the transcript while the picker shows), so this is drawn only for a transcript cut between the two.
func MirrorAskLive ¶
func MirrorAskLive(v MirrorAskLiveView) g.Node
MirrorAskLive is one card of the live region.
func MirrorAskResult ¶
func MirrorAskResult(rowID string, qs []askq.Question, answers map[string]string, note string, extra ...g.Node) g.Node
MirrorAskResult is a call drawn from its result: read-only, with the answers it was given (none, when the result carries none — the picker was dismissed — and note says what the result said instead).
func MirrorAskRowID ¶
MirrorAskRowID is the element id the conversation gives the call toolID — a tool row's (toolRowID) — which the live region reads to know the conversation has drawn it.
func MirrorAsksLive ¶
func MirrorAsksLive(vs []MirrorAskLiveView) g.Node
MirrorAsksLive is the live region's content: one card per view.
func MirrorAsksSrc ¶
MirrorAsksSrc is the live region's URL for the window ref.
func MirrorCardHref ¶
func MirrorCardHref(m MirrorCardView) string
MirrorCardHref is where a mirrored entry opens: the rendered view for a Claude Code pane or a Hermes one with a known session, the terminal for anything else.
func MirrorDraftKey ¶
MirrorDraftKey is user's draft key of a mirrored window's message box: view is "view" (Rendered) or "terminal", then the host, the tmux session and the window id ("" for a per-session host's session).
func MirrorPromptID ¶
MirrorPromptID is a mirrored prompt's element id, from its Event.Line: the ONE spelling both its bubble (Ops) and its prompt-index entry (NewMirrorIndex) use, so the message index finds the bubble a prompt has.
func MirrorTerminalPath ¶
MirrorTerminalPath is a mirrored session's terminal page (its active window).
func MirrorTerminalWSPath ¶
MirrorTerminalWSPath is that page's socket, before the page adds its mode and size.
func MirrorViewOnlyNote ¶
MirrorViewOnlyNote is the disabled composer of a window of kind, a runtime muster only views (opencode, docs/design/opencode.md).
func MirrorViewPage ¶
func MirrorViewPage(v MirrorViewView) g.Node
MirrorViewPage is the rendered view's document.
⚠ ITS OWN DOCUMENT, like the terminal page: a real load (the links into it opt out of boost), with its own socket and script.
func MirrorViewPath ¶
MirrorViewPath is a mirrored session's rendered view (its active window).
func MirrorViewWSPath ¶
MirrorViewWSPath is that page's transcript socket, before the page adds its resume point.
func NavAgentsList ¶
func NavAgentsList(list []AgentCardView, mirrors []MirrorCardView, currentURL string, now time.Time) g.Node
NavAgentsList is the partial: the entries in navOrder, the page's own session (currentURL, see navCurrent) marked.
func NavDocument ¶
func NavDocument(v NavDocumentView) g.Node
NavDocument is the document every server-authored signed-in page is: the navigation, the shell's header, and the page's own content in the column the bare pages use (max-w-sm), so the content reads as it did before.
🔴 <body> CARRIES NO hx-boost, unlike the shell's. These pages are made of plain forms — sign out, mint a token, revoke a device — whose POST answers with a redirect or a whole document; boosted, each would become an AJAX body swap of a page that was never written for one. The sidebar's links are therefore ordinary navigations here, as their own hx-boost="false" links already were.
func NotesCards ¶
NotesCards is the /ui/tasks partial: the filter chip rows, then ONE flat list of task cards ordered strictly newest-activity-first, then the show-more control — morphed into #tasks-list.
🔴 IT USED TO BE THREE SECTIONS (In progress / Open / a collapsed Done <details>), and losing them is the point rather than a side effect. A section split orders by STATUS FIRST and time second, so the single most useful question a board answers — "what moved most recently?" — could not be read off it at all: a task an agent had been working for an hour sat below a task whose status happened to sort higher. Status is now a per-card attribute plus a filter chip row, which is strictly more information in less vertical space.
🔴 data-task-section IS GONE, AND WHAT REPLACES IT IS NOT A RENAME. The old attribute carried the HUMAN LABEL ("In progress"), which made every assertion over it a SPELLED guard: any feature that spelled those two words satisfied it, and a relabel would have silently emptied its coverage. Each CARD now carries `data-task-status="<raw status>"` — the enum the store persists — which cannot be satisfied by prose and survives any relabelling of the chips. Every assertion site migrated to it (internal/ui, e2e/tests/tasks.spec.ts, tasks-mobile.spec.ts, task-sse-regroup.spec.ts).
🔴 The two empty states are DELIBERATELY different: with a filter active, an empty result means "nothing matches this filter" (+ a Clear control), NOT the generic "no tasks yet" all-clear. Rendering all-clear under a filter is the classic trap — the user reads an empty queue when their work is merely hidden. "A filter is active" now includes a status chip, not only tags: a status-only filter that matched nothing used to fall through to the all-clear.
func NotesEditModalBody ¶
func NotesEditModalBody(v NoteEditView) g.Node
NotesEditModalBody is the /ui/tasks/{id}/edit partial: the EDIT-task form, pre-filled with the task's current directory/body/model/repo/branch, loaded into #task-modal-body when the card's Edit button is tapped. It posts (urlencoded) to /tasks/{id}/edit, morphs the refreshed single card into #task-{id}, and closes the modal on success. Only the EDITABLE fields appear — status, provenance, comments and attachments are not editable here. All values are escaped by g.Text / attribute encoding.
func NotesModalBody ¶
NotesModalBody is the /ui/tasks/new partial: the create-task form, loaded into #task-modal-body when the FAB is tapped. It posts multipart/form-data to /tasks, morphs the result into #tasks-list, and closes the modal on success.
func NotesModalBodyWith ¶
NotesModalBodyWith is NotesModalBody with the task text pre-filled — what a share or the "New task" shortcut opens (ComposePage). The text is a Textarea CHILD, so gomponents escapes it: shared markup arrives as inert characters.
func NotesPanel ¶
NotesPanel is the static shell for the Tasks tab. The + FAB (body-level, in Page) is the sole task-create path; only the inner #tasks-list refreshes. It refreshes from /ui/tasks on tasks:changed (a local create/edit), on sse:task.changed (an agent mutated a task out-of-band), on sse:agent.changed (a linked agent's status moved — so the card's status chip stays live without a reload) and on muster:resync. Its FIRST content is drawn (non-nil drawn: the Tasks tab's own document carries the board, tasks_list_ssr.go) or, on any other tab, the skeleton its own `load` request replaces. 🔴 IT TAKES NO PENDING COUNT, AND THE SEGMENTED CONTROL IS GONE WITH IT. Upstream rendered a [Requests | Tasks] segmented toggle at the top of this panel, carrying a live count of pending permission requests on the Requests half. muster has no permission-request surface, so the control would be a two-position switch with one position — and the count would be a badge permanently reading zero, which reads as "no requests" rather than "not a thing this service does".
func Page ¶
⚠ SEAM — THIS DOCUMENT REFERENCES SIX FILES UNDER /static/ THAT muster DOES NOT YET CARRY, AND EVERY ONE OF THEM FAILS SILENTLY.
WHAT: the head below loads /static/vendor/htmx.min.js, /static/vendor/idiomorph-ext.min.js, /static/vendor/sse.js, the two Faro scripts (conditionally) and /static/icons/icon-192.png. web/static/ holds exactly one file today — app.css, built by `make css` — so the other five are 404s, and /static/ is not even registered as a route yet. WHY IT IS NOT VISIBLE HERE: a missing <script src> does not error the page. It renders, styled, and then does nothing: no htmx means every panel stays a skeleton because no hx-get ever fires, no idiomorph means every `morph:` swap silently degrades to a destructive one, no sse.js means the page is write-only. Nothing in this package can observe that — these renderers emit markup, and the markup is correct. WHY THEY ARE NOT CARRIED IN THIS CHUNK: they are third-party binaries whose home is web/static/vendor/, served by a /static/ route this chunk deliberately does not register, and embedded by a web package that would make `go build ./...` depend on their presence. CLOSING CONDITION: the API carve lands the web package, vendors these five files, registers `GET /static/`, and a test asserts that every `/static/...` path this package emits resolves to a file the embed actually contains — derived by scanning the sources, not by listing the paths a second time. WHO CHECKS IT: the reviewer of the API-carve pull request, against that derived test.
func ParseIdleSectionAfter ¶
ParseIdleSectionAfter reads MUSTER_AGENTS_IDLE_AFTER: "" is the default; "0" or "off" turns the section off; otherwise a whole number of days ("14d") or a Go duration ("336h"), from MinIdleSectionAfter to MaxIdleSectionAfter.
func ParseLiveHeartbeat ¶
ParseLiveHeartbeat parses MUSTER_LIVE_HEARTBEAT: "" is 0 (keep the default), anything else a Go duration within the bounds.
func RenderAgentDetail ¶
func RenderAgentDetail(w io.Writer, v AgentDetailView, feat Features) error
RenderAgentDetail writes the full agent detail page (logs + chat).
func RenderAgentHeader ¶ added in v0.110.0
func RenderAgentHeader(w io.Writer, a AgentCardView) error
RenderAgentHeader writes the strip's refresh (GET AgentHeaderPath): the strip's body (its #agent-status carries the status the ⋯ menu's lifecycle item follows) and — out of band — the notices.
func RenderAgentsHome ¶ added in v0.110.0
RenderAgentsHome writes the page home draws when it has nothing to open (agentsEmptyState), inside the navigation (NavDocument).
func RenderChiefPanelBody ¶
func RenderChiefPanelBody(w io.Writer, v ChiefPanelView) error
RenderChiefPanelBody writes the panel body partial.
func RenderChiefThreadRows ¶
func RenderChiefThreadRows(w io.Writer, v ChiefThreadsView) error
RenderChiefThreadRows writes the thread-row partial the search route answers with.
func RenderComposePage ¶
RenderComposePage writes ComposePage.
func RenderConnectorForm ¶
func RenderConnectorForm(w io.Writer, f ConnectorFormView) error
RenderConnectorForm writes the create / enter-credential form.
func RenderConnectorRequests ¶
func RenderConnectorRequests(w io.Writer, list []ConnectorRequestView) error
RenderConnectorRequests writes the /ui/connector-requests partial.
func RenderConnectorRotateForm ¶
RenderConnectorRotateForm writes the rotate form for one connector.
func RenderConnectors ¶
func RenderConnectors(w io.Writer, c ConnectorsContent) error
RenderConnectors writes the /ui/connectors partial.
func RenderDispatchModal ¶
func RenderDispatchModal(w io.Writer, k KindChoices) error
RenderDispatchModal writes the /ui/agents/new partial (the task-less dispatch form the sidebar's "+" opens body: Model, Repository, Existing task, ad-hoc task).
func RenderDispatchModalTask ¶
func RenderDispatchModalTask(w io.Writer, v TaskDispatchView) error
RenderDispatchModalTask writes the /ui/agents/new?note=<id> partial: the TASK-SCOPED dispatch confirm (fixed Model/Repository rows pre-filled from the task, each with an inline Edit override).
func RenderDispatchUnavailable ¶ added in v0.107.0
RenderDispatchUnavailable writes the /ui/agents/new partial for a server that cannot dispatch (DispatchUnavailableBody).
func RenderFocusHistoryPage ¶
func RenderFocusHistoryPage(w io.Writer, v FocusHistoryPageView) error
RenderFocusHistoryPage writes one page as list rows: what the sentinel it was fetched for is replaced with.
func RenderNavAgents ¶
func RenderNavAgents(w io.Writer, list []AgentCardView, mirrors []MirrorCardView, currentURL string) error
RenderNavAgents writes NavAgentsList.
func RenderNavDocument ¶
func RenderNavDocument(w io.Writer, v NavDocumentView) error
RenderNavDocument writes NavDocument.
func RenderNoteCard ¶
func RenderNoteCard(w io.Writer, v TaskCardView) error
RenderNoteCard writes a single task card, for outerHTML swaps of #task-<id> after a status change or new comment. The view carries the task plus its optional linked agent so the re-rendered card keeps its status chip.
func RenderNoteOptions ¶
func RenderNoteOptions(w io.Writer, notes []NoteOption) error
func RenderNotesCards ¶
RenderNotesCards writes the /ui/tasks partial: the tag filter chip row plus the tasks as ONE flat list ordered by most recent activity, morphed into #tasks-list. The view carries each task with its optional linked agent (for the status chip), the tag vocabulary (the chip row), and the ACTIVE filter — the selection is server-rendered so an SSE-driven refresh preserves it.
func RenderNotesEditModal ¶
func RenderNotesEditModal(w io.Writer, v NoteEditView) error
RenderNotesEditModal writes the /ui/tasks/{id}/edit partial (the edit-task form body, pre-filled with the task's current values).
func RenderNotesModal ¶
func RenderNotesModal(w io.Writer, directories []string, directoriesFailed bool, prefill string) error
RenderNotesModal writes the /ui/notes/new partial (the create-note form body).
func RenderNotifications ¶
func RenderNotifications(w io.Writer, active []ActiveRow, unread []NotificationRow) error
RenderNotifications writes the notifications panel partial: an out-of-band FAB badge update (the total UNREAD count) followed by the panel body — an ACTIVE section (agents thinking/responding now or recently) above the existing UNREAD section. This is the GET /ui/notifications response — the FAB hx-gets it into #notif-list and the OOB #notif-badge updates the button badge in place.
func RenderPage ¶
RenderPage writes muster's full document shell to w. activeTab is the tab to show on first paint, derived from the request path for SPA-style deep-linking and clamped by normalizeTab, so an unknown path lands on the default tab rather than rendering a shell with nothing selected.
🔴 THE SIGNATURE IS NARROWER THAN UPSTREAM'S BY FOUR ARGUMENTS, AND EVERY ONE OF THEM WAS ROUTER-OWNED STATE. Upstream also took the pending permission requests (so the queue could be server-rendered into the first byte) and two auto-approve snapshots (so the banner would not grow mid-load and shove the page down). muster has neither surface: there is no request store here and no auto-approve machinery, so there is no state to render eagerly and nothing to reserve height for. Every panel in muster's shell fetches its own partial on `load`.
This file used to carry four more writers — the request list partial, the header popover's quick list, the post-decision card-removal fragment and a single-card render helper. All four take a store.Request, which is the permission router's type, and all four stay with it.
🔴 feat SAYS WHICH OPTIONAL SUBSYSTEMS THE CALLER BUILT, AND IT IS A PARAMETER SO THE ANSWER IS THE REQUEST'S OWN SERVER'S. See Features: the zero value draws the smallest honest shell, so a caller that forgets it under-draws rather than mounting a panel over nothing.
func RenderPageWith ¶
RenderPageWith is RenderPage with state drawn on the first paint (ShellData).
func RenderRepoOptions ¶
RenderRepoOptions / RenderNoteOptions write the lazy-loaded combobox option lists (swapped in over the skeleton).
func RenderStatusIcon ¶
RenderStatusIcon writes the compact status icon (the colored dot, no label) for a status. It is the exported render entry for the live-status poll endpoint (GET /ui/agents/{id}/status), reusing statusIcon so the polled icon matches the first-paint icon in the agent-detail / operator header exactly.
awaitingApproval adds the "awaiting approval" badge beside the dot: the agent's terminal is blocked on a permission prompt, or it has a request open on the operator's approval queue. 🔴 THE BADGE LIVES IN THIS POLLED RESPONSE ON PURPOSE — it is a live state, so the 10s poll is what both shows and clears it. It is the opposite of the owed-kickoff badge, which must sit OUTSIDE the polling span because this endpoint never rendered it.
func RenderSwitcherPin ¶ added in v0.109.0
func RenderSwitcherPin(w io.Writer, pinned bool, fields [][2]string, back string, s *Switcher) error
RenderSwitcherPin writes the ⋯ menu's pin item in its new state and, when s is not nil, the bar's rows and counts out of band (switcherRefresh).
func RenderTagDatalist ¶
RenderTagDatalist writes the GET /ui/tags partial: a bare <datalist> of the tag vocabulary, used as the tag input's suggestion source in the edit modal.
func RenderTaskDetail ¶
func RenderTaskDetail(w io.Writer, v TaskCardView, feat Features) error
RenderTaskDetail writes the full GET /tasks/{id} document: the task rendered in DETAIL shape (body, attachments, session thread, comments, comment form) inside the app's chrome. The view is the SAME TaskCardView the board renders, so there is exactly one card renderer and no forked view.
func RenderTaskModal ¶
func RenderTaskModal(w io.Writer, v TaskModalView) error
RenderTaskModal renders the task-detail modal fragment (overlay + panel) that the header title's hx-get swaps into #task-modal.
func RenderTaskNotFound ¶
RenderTaskNotFound writes the styled GET /tasks/{id} 404 document (sidebar, one <h1>, an explanation and an unboosted link back to the board).
func SendAgainPage ¶
func SendAgainPage(v SendAgainView) g.Node
SendAgainPage is a whole document with one form: the browser's own answer to a send refused because the same message may already have been delivered, when no script ran. 🔴 WITHOUT IT A PAGE WITH NO SCRIPT IS LOCKED OUT: the refusal says "use Send again", and Send again is a button the composer's script draws (audit #275 round 1, Y2). This is that button, as a form.
func SendQueueAnsweredText ¶
SendQueueAnsweredText is what a queued message that answered asker's question when it was queued says under its preview.
func SendQueueCancelPath ¶
SendQueueCancelPath is where message id's Cancel posts.
func SendQueueDeletePath ¶
SendQueueDeletePath is where message id's Delete posts.
func SendQueueEditAnsweredText ¶
SendQueueEditAnsweredText is what the edit form of a message that answered asker's question when it was queued says before anything is typed: the answer stands, whatever the edit.
func SendQueueEditCancelPath ¶
SendQueueEditCancelPath is where an edit's Cancel posts (hold).
func SendQueueEditPath ¶
SendQueueEditPath is where message id's Edit posts: it HOLDS the message (the dispatcher sends nothing of its window while it is held), and then the row is drawn as its edit form (sendQueueEditRow).
func SendQueueEditSavePath ¶
SendQueueEditSavePath is where an edit's Save posts (hold, text).
func SendQueueFullID ¶ added in v0.125.0
SendQueueFullID is the popover holding message id's whole text.
func SendQueueList ¶
func SendQueueList(v SendQueueListView) g.Node
SendQueueList is the list's markup: what GET SendQueuePath answers, and what a composer draws inside its #mv-queue.
func SendQueueRetryConfirmPage ¶
SendQueueRetryConfirmPage is a whole document asking once before a message that may already have been sent is queued again: the browser's own answer to a Retry posted without the confirm (no script ran). It posts to action with field=1.
func SendQueueRetryPath ¶
SendQueueRetryPath is where message id's Retry posts.
func SendQueueSendNowPath ¶
SendQueueSendNowPath is where message id's Send now posts.
func SetFaroConfig ¶
func SetFaroConfig(c FaroSettings)
SetFaroConfig installs the Faro RUM config read by every page head. Called once from main at startup.
func SetHostPreferences ¶
func SetHostPreferences(p HostPreferences) error
SetHostPreferences installs p (Normalized). A refused p leaves the installed preferences as they were.
func SetLiveHeartbeat ¶
SetLiveHeartbeat sets LiveHeartbeat, process-wide. It refuses a value outside MinLiveHeartbeat–MaxLiveHeartbeat.
func ShellTab ¶
ShellTab is the tab a shell document for the path segment tab draws active — the same clamp the shell applies (`/` is the default tab), so the server builds first-paint state for the tab the reader will actually see.
func SnapPurgeHTML ¶
func SnapPurgeHTML() string
SnapPurgeHTML is the inline script every server-written auth page carries (internal/api writeAuthDocument, /login among them): it deletes every snapshot in this browser. A sign-out always ends there, and so does any sign in, so no user's snapshots outlive their session — even when the sign-out's own page never ran its script. Self-contained: no shared shell, no other script, so the login page stays independent of the rest of the UI.
func SnapScript ¶
SnapScript is the snapshot store's script, for a page that reads or warms snapshots: the rendered view, an agent's page. Deferred, so it runs before DOMContentLoaded and never blocks the parser. Nothing at all without a signed-in user.
func SnapScriptNow ¶
SnapScriptNow is the same tag WITHOUT defer, for the rendered view: placed before mirrorViewScript, it has run when that script is parsed, so the view reads its snapshot (and opens its socket) while the rest of the document is still loading, instead of at DOMContentLoaded. The file is immutable and small, and a parser-blocking script is fetched as early as the deferred one was (the preload scanner finds both).
func StatusPollPath ¶
func StatusPollPath(id int64, awaiting bool, work mirror.WindowWork) string
StatusPollPath is the agent page strip's status poll (agentStripBody): GET /ui/agents/{id}/status, with awaiting=1|0 saying whether the strip was drawn awaiting approval, and work=WorkPollToken saying which work chip it was drawn with.
func StepUpDialog ¶
func StepUpDialog(s *StepUpView) g.Node
StepUpDialog is the dialog and its script (window.musterStepUp) for a page other than the terminal and the rendered view — today /plugins, whose Approve asks before it submits. Nothing for nil.
func StepUpFormPage ¶
func StepUpFormPage(v StepUpFormView) g.Node
StepUpFormPage is a whole document with one form: the password again, and the pending send in hidden fields. No script is needed to use it — it exists for the page whose script did not run. (A passkey needs script; the dialog on a working page offers one.)
func SubagentTailFragment ¶
func SubagentTailFragment(v SubagentTailView) g.Node
SubagentTailFragment is a card's steps, oldest first, as the fragment the page puts in its tail.
func SwitcherPinToggle ¶ added in v0.109.0
SwitcherPinToggle is the ⋯ menu's pin item: a form posting fields (the subject) to PinPath — UnpinPath when pinned — with back, the page to return to without script. Its button is the menu item, named by its words: "Pin this session", or "Unpin this session" (data-pinned="true", in the accent) when pinned.
func TabKeys ¶
func TabKeys() []string
TabKeys returns the ordered tab keys, for a caller that must register one route per tab.
🔴 IT RETURNS A COPY. tabKeys is package state that every nav render reads; handing a caller the backing array would let an append in another package reorder or truncate the navigation. The cost is one small allocation per call, and the only caller calls it once at registration.
🔴 THIS EXISTS SO THE ROUTE TABLE IS DERIVED FROM THE NAV RATHER THAN TYPED BESIDE IT. Upstream those were two hand-written lists and its own comment records what that cost: a "sixth tab registry" no structural test could see, where a tab in the nav and absent from the routes still rendered — from the fallback branch, with the wrong heading, silently. A linked tab whose route does not exist is a 404 in the navigation; deriving one from the other makes that unrepresentable.
func TabsScript ¶
TabsScript is tabsScript for a page drawn outside this package's shell (the Asks page, internal/api): the same once-per-document script.
func TaskCompletePath ¶
TaskCompletePath is the no-JS Mark-complete form's action: a POST that completes the task and redirects to HomePath.
func TaskDetailPage ¶
func TaskDetailPage(v TaskCardView, feat Features) g.Node
TaskDetailPage renders the standalone GET /tasks/{id} document: the task's full body, attachments, session thread, comments and comment form, wrapped in the app's shared chrome.
It is an OFF-SHELL document (its own Doctype/HTML/Head/Body), like AgentDetailPage and sessionDetailPage — the shell's Page() is not reused, because the shell is the multi-panel SPA and this page has no panels.
🔴 hasPanels=false on the sidebar. With no #panel-* elements in this document the sidebar tabs must stay BOOSTED — there is nothing to toggle in place, so a boosted cross-document navigation IS the behaviour. TestSidebarTabBoostIs OwnedByThePanelOwner checks that against the panels actually rendered.
🔴 /tasks/{id} is deliberately NOT in tabFromPath. That switch is exact-match and only feeds handleIndex, which never serves this document — same as /agents/{name} and /suggestions/{id}, neither of which is in it either.
func TaskNotFoundPage ¶
TaskNotFoundPage is the styled 404 for GET /tasks/{id} when the task is dismissed or was never there.
🔴 IT EXISTS BECAUSE OF THE BACK BUTTON, not because a plain 404 is ugly. taskHashScript upgrades every legacy `/tasks#task-N` deeplink — and those are out in ClickUp comments, in ClickHouse activity.events and in several docs — using location.replace(), which CONSUMES the history entry it arrived on. Go's http.NotFound answers with a bare text/plain "404 page not found": no chrome, no sidebar, no link anywhere, and a Back press that leaves muster entirely because the entry the user came from was replaced. The board's old behaviour for the same link was to load and toast "Task #N is not on this board." — this page is that, on a URL that legitimately 404s.
It is an OFF-SHELL document like TaskDetailPage, and deliberately a MINIMAL one: the sidebar (so every other tab is one tap away), a real <h1> (axe page-has-heading-one applies to a 404 too), the explanation, and an unboosted link to the board. No htmx surface at all — there is nothing here to mutate, so there is nothing to keep live and no failure to toast.
func TaskTitle ¶
TaskTitle is the task's DISPLAY label: the explicit `title` (migration 0018) when set, falling back to `directory` — which is what every producer smuggled the title through while POST /api/tasks silently dropped a `title` key (PR #156). One helper so every label site agrees, and so producers can migrate to the real field at their own pace with no behaviour change.
EXPORTED because internal/api needs it too. It previously did not, and both dispatch-picker labels (buildTaskDispatchView, handleAgentNoteOptions) read n.Directory directly — so a producer that correctly sent `title` instead of smuggling it lost its heading in the picker, which is exactly where telling captures apart matters. Any new label site MUST use this, not n.Directory.
func ThemeHead ¶
ThemeHead is the document head's theme block: the theme-color meta that tints the phone's status bar, and the script that keeps the document dark.
🔴 DARK IS THE ONLY THEME. The `dark` class is server-rendered on every <html>; the script re-asserts it and deletes the opt-in the old toggle stored (themeStorageKey), so a device that had chosen light loads dark instead of keeping a preference nothing can change back. Storage access is in a try/catch: a private window or blocked storage must still render, not throw before the page has a body.
⚠ THE SCRIPT IS SYNCHRONOUS ON PURPOSE. It is a parser-blocking <script src> in the head (static_script.go), so it runs before the body is parsed; the sign-in page carries it inline (ThemeHeadHTML). There is no `storage` listener any more: it existed so one document followed a theme another (the view-swap frame, another tab) had set, and nothing sets one now.
func ThemeHeadHTML ¶
func ThemeHeadHTML() string
ThemeHeadHTML is ThemeHead as a raw string, for the sign-in page, which is a hand-written document in internal/api rather than a gomponents tree.
func UploadFilePath ¶
UploadFilePath is the owner's view of upload id (thumbnail, Open).
func UploadRevokePath ¶
UploadRevokePath is where the owner revokes upload id's link.
func UserMarker ¶
UserMarker names the page's signed-in user in its head, so a restored page that re-requests itself can tell an answer drawn for ANOTHER user (one device, another person signed in since) and reload rather than redraw any of it — the check that holds where Clear-Site-Data is not honoured (a plain-HTTP origin). Every view page draws it: the agent page, the Rendered view and both terminals. Nothing when there is no user.
func WorkPollToken ¶
func WorkPollToken(w mirror.WindowWork) string
WorkPollToken is a work chip's state as the status poll carries it: "<subagents>.<shells>", with a trailing "p" for a lower bound ("1+ shell"); "0.0" for no chip. Two reports that draw the same chip have the same token.
Types ¶
type ActiveRow ¶
type ActiveRow struct {
Name string // the agent slug (the route key)
DisplayName string // human-facing label ("" → falls back to Name)
SessionID int64 // the session to deep-link to (0 → link to bare /agents/{name})
Phase string // "thinking" | "responding" — the live phase
Since string // relative label for recently-active rows (e.g. "2m ago"); "" while in-flight
InFlight bool // true → show the live phase pill; false → show the Since label
}
ActiveRow is one agent currently streaming (thinking/responding) or active within the recency window. Distinct from NotificationRow: it carries a live phase + a "since" label instead of an unread count.
type AgentBrief ¶
type AgentBrief struct {
ID int64
Name string // slug — the /agents/{name} detail/chat link target
DisplayName string
Status string // pending|provisioning|running|stopped|error
// SessionID is the agent's latest session (agents.Store.LatestSessionIDs), 0
// when it has none or the read failed: the "Open chat" link names it
// (AgentSessionHref), so a tap skips the bare page's 303.
SessionID int64
}
AgentBrief is the minimal linked-agent info a task card renders: enough to show a status chip and link to the agent's chat, with NO live k8s call (the Status is the STORED agents.status, mirroring how the sidebar's agent list avoids per-agent pod lookups).
type AgentCardView ¶
type AgentCardView struct {
ID int64
// SessionID is the agent's latest session (agents.Store.LatestSessionIDs),
// 0 when it has none or the read failed. Every link drawn to this agent —
// the sidebar's row, the switcher's pill, home's target — names it (PageHref).
SessionID int64
// Kind and CCAccount are the agent's kind and Claude account name.
Kind string
CCAccount string
// WorkerPool is the machine-job worker pool the agent belongs to
// (agents.Agent.WorkerPool); "" for none. Nothing draws it from this view
// now (the retired Agents list's card drew a "pool" chip).
WorkerPool string
Name string
DisplayName string
Repo string
Status string // pending|provisioning|running|stopped|error
KickedOff bool
// KickoffOwed is agents.KickoffOwed for this agent: a kickoff message is
// stored and nothing delivered it. It renders as a badge BESIDE the status
// dot, never as a status value — see kickoffOwedBadge.
//
// 🔴 IT IS NOT DERIVED HERE, AND IT MUST NOT BE. The note text is not on this
// view at all (it is operator-authored instruction text; agents.Agent tags it
// `json:"-"` and this package would put it in HTML), so the boolean is
// composed in internal/api's cardViewIndexed from the stored row and arrives
// already decided.
KickoffOwed bool
// KickoffFailed is agents.KickoffFailed: the first turn was handed to a gateway
// (the row is stamped kicked_off, so KickoffOwed is false) and it did not
// complete. It renders as a "kickoff failed" badge beside the status dot plus the
// failure text and the remedy — see kickoffFailedBadge and kickoffFailureDetail.
// Mutually exclusive with KickoffOwed by construction.
KickoffFailed bool
// KickoffFailure is the text to show for a failed kickoff:
// agents.KickoffFailureText, composed in internal/api's cardViewIndexed with the
// pending note already SCRUBBED out (agents.ScrubNote). This package never sees
// the note and must not be handed raw kickoff_error.
KickoffFailure string
// KickoffResendSafe is agents.KickoffResendSafe: the failure proves nothing was
// sent, so the remedy may say re-sending is safe. Otherwise the remedy says to
// check whether the agent is already working first. See KickoffFailedRemedy.
KickoffResendSafe bool
// KickoffAwaitingGrant is agents.KickoffAwaitingGrant: the first turn is held,
// unsent, until the owner approves this agent's github connector request (its
// repository cannot be checked out before). It renders as a "waiting for your
// github approval" line linking to Connectors — see kickoffAwaitingGrantNotice.
// Composed in internal/api's cardViewIndexed; only the boolean crosses.
KickoffAwaitingGrant bool
// GitHubProblem is why the GitHub App cannot currently serve this agent's
// repository (its credentials refused at the token mint, a rate limit, the
// repository outside the installation), "" when nothing is known to be wrong
// or no App is configured. Composed in internal/api's cardViewIndexed from
// githubapp's operator-facing text, which never carries a token.
GitHubProblem string
// Namespace is the agent's stored namespace, used only to spell the log command
// in the failed-kickoff remedy.
Namespace string
// Model is the agent's configured model slug ("" = cluster default). Nothing
// draws it from this view now (the retired Agents list's card did, as a
// read-only line).
Model string
// NoteID is the source task this agent was dispatched from (nil = none).
// Nothing draws it from this view now (the retired Agents list's card drew a
// "Task #<id>" badge).
NoteID *int64
// CreatedAt is the agent's creation time. Nothing draws it from this view
// now (the retired Agents list's card printed it as a relative "age").
CreatedAt time.Time
UpdatedAt time.Time
// LastActiveAt is agents.LastActivity for this agent — the time the sidebar
// and the switcher order by (list_order.go) — and it is what the sidebar
// row's recency dot reads, so the order and the dot are one number. Composed
// in internal/api's cardViewIndexed; a zero value (a minimal test view) falls
// back to UpdatedAt.
LastActiveAt time.Time
// IsChief marks the fleet's chief agent; its ⋯ menu offers no Delete. It is
// the answer of internal/api's ONE chief predicate (isChiefAmong), composed in
// cardViewIndexed and never re-derived here — the server refuses the delete
// regardless, so this only keeps the UI from offering what it would refuse.
IsChief bool
// DeleteProtected: its ⋯ menu offers no Delete, like the chief's, without it
// being the chief — a declared officer's instance (internal/api's
// deleteProtection). The server refuses the delete regardless.
DeleteProtected bool
// PrimaryChief: this is THE chief the viewer is sent to — where `/` opens,
// and the agent the sidebar pins first (navBefore). internal/api's
// primaryChief decides it, for both; it is never re-derived here. At most
// one entry of a list carries it; IsChief may be true on more than one.
PrimaryChief bool
// Pinned: the viewing user pinned this agent (internal/pins). The switcher
// orders a pinned entry first (orderList) and its pin toggle reads it
// (switcher_pin.go); a pinned entry is never in the Idle section. Composed in
// cardViewIndexed.
Pinned bool
// Focus is what the agent is working on (internal/focus), nil for none.
// Composed in cardViewIndexed; the palette finds the entry by its title
// (switcherItems' Title).
Focus *FocusView
// Attention is the entry's attention count (cards_attention.go), drawn on
// its sidebar row (navAttentionPill), nil for none. Composed in internal/api
// from the attention queue's own read.
Attention *CardAttention
// AwaitingApproval: the agent is blocked on a permission prompt (or has a
// request open on the approval queue) — internal/api's AwaitingApproval,
// the same answer the polled "awaiting approval" badge shows. It is NOT an
// attention item, so it is carried here: the waiting order and words read it
// (waitTokens), and the agent page's status poll asks for a strip refresh
// when it changes (agentStripBody, AgentsAwaitingEvent).
AwaitingApproval bool
// Work is what the agent's pod last reported it has running — subagents and
// background shells — internal/api's AgentWork, already expired when stale.
// It draws the agent page strip's work chip (workChip) and the sidebar row's
// count (navWork), and the status poll carries it (StatusPollPath) so a
// change or an expiry re-renders the strip. Zero: no chip.
Work mirror.WindowWork
// Idle: in the Idle section (idle_section.go's InIdleSection), composed by
// MarkIdle; the sidebar draws it in its Idle group (navIdleGroup).
Idle bool
}
AgentCardView is one agent as internal/api's cardViewIndexed composes it: what the sidebar's row, the session switcher's pill and the agent page's status strip, ⋯ menu and notices draw (agent_actions.go). The name is the retired Agents list's, whose card grid it was built for.
func (AgentCardView) Deletable ¶ added in v0.110.0
func (a AgentCardView) Deletable() bool
Deletable is whether the ⋯ menu offers Delete: not for the chief, not for a declared officer's instance (the server refuses either regardless). ONE predicate: the menu draws by it, and internal/api's tests ask it of the card the page composes.
func (AgentCardView) PageHref ¶
func (a AgentCardView) PageHref() string
PageHref is the link to the agent's page: AgentListHref on the agent's latest session, so a tap loads the page directly instead of the bare URL and its 303 (and is moved to the latest if it went stale). The sidebar's row, the switcher's pill and home's target (HomeHref) all use it.
type AgentDetailView ¶
type AgentDetailView struct {
ID int64
Name string
DisplayName string
Status string
Repo string
Model string // OpenRouter slug; "" = cluster default
// Kind is the agent's kind. A claude-code agent shows its kind and account
// instead of the model picker: it has no per-agent model (the server refuses
// one), so a picker there would be a control that can only fail.
Kind string
CCAccount string
// LastFailover is the agent's latest Claude account failover, one line
// ("from north · rate_limited · resets …"); "" when it has none.
LastFailover string
// WorkerPool is the agent's machine-job worker pool; "" for none.
WorkerPool string
Messages []ChatLine
// Sessions are the agent's chat sessions for the switcher (most-recently-active
// first); ActiveSessionID is the one whose transcript Messages holds.
Sessions []SessionView
ActiveSessionID int64
// DraftUser is the signed-in user, the first part of the chat box's draft
// key (composer_draft.go).
DraftUser int64
// Surface is where this pane is being rendered. See ChatSurface.
Surface ChatSurface
// Source task (Task 6): when this agent was dispatched from a Task, NoteID is
// its task id and TaskStatus its current lifecycle status. Both are populated
// best-effort by the handler; NoteID == nil (or a non-terminal status) means
// no completion banner is rendered.
NoteID *int64
TaskStatus string
// SendNonce names one message for the chat form's FALLBACK post (see
// agentChatPane and ComposerView.Nonce); "" = none. SendNotice is the
// outcome of such a post, drawn above the form when the page was reached by
// the redirect that answered it; SendNoticeOK says it is good news.
SendNonce string
SendNotice string
SendNoticeOK bool
// Dictate is where the chat form's microphone posts a recording
// (TranscribePath), or "" for none. See dictate.go.
Dictate string
// FocusHistory is the agent's focus history, the newest page
// (FocusHistoryPath); "" = no focus store, and no header control for it.
FocusHistory string
// Asks is the agent's OPEN attention asks as the queue draws them, with
// their answer forms (internal/api attention_asker.go), "" for none; AsksSrc
// is that block's fragment URL, "" when the queue is not served (no block).
Asks string
AsksSrc string
// Switcher is the session switcher below the chat form (switcher.go), on
// the page surface only; nil for none.
Switcher *Switcher
// Card is the agent as its card was composed (internal/api's
// cardViewIndexed, the one composer): what the page's status strip, its ⋯
// menu and its notices draw (agent_actions.go). Zero (Card.ID 0) draws
// none of them — the chief panel's pane, and a minimal test view.
Card AgentCardView
}
AgentDetailView is the data the agent detail page renders.
type AgentTerminalView ¶
type AgentTerminalView struct {
Name string
DisplayName string
// overlay — the terminal's width is the far side's geometry, so no rail
// takes from it) and its hamburger, framed by the view swap or not
// (nav_layout.go says why).
Nav NavChrome
// the page says so instead of opening a socket that would be refused.
Unavailable string
// BackHref is where the back arrow goes ("" = the agent's own page). A
// mirrored session has no agent page — its terminal is its page — so it goes
// back to the list.
BackHref string
// Badge is a short label beside the title ("Mirrored · <host>"); "" = none.
Badge string
// BadgeHost and BadgeHostIcon are the mirrored host the badge names and its
// icon key (HostIconFor): the badge leads with the icon its cards draw.
BadgeHost, BadgeHostIcon string
// RawName, when set, is shown small and muted after the title, and as its
// tooltip (mirrorSessionTitle): a mirrored session titled by its host's
// label ("mango:1") keeps its real tmux session name findable. "" = the
// title alone.
RawName string
// TitleQualifier, when set, is drawn right after the title as part of it
// (" · laptop") and added to <title>: a mirrored entry whose name another
// listed entry shares (mirror.SessionView.Qualifier). "" = the title alone.
TitleQualifier string
// WSPath is the socket the page opens, WITHOUT its query ("" = the agent's
// /agents/{name}/terminal/ws). A mirrored session's is
// /mirror/terminal/ws?host=…&session=…, and the page appends mode/cols/rows.
WSPath string
// ReadOnlyOnly turns the keys off: the far side cannot be typed into (a
// mirrored host that did not advertise -interactive). The server refuses an
// interactive attach regardless; this keeps the page from asking for one,
// and its keys are drawn disabled.
ReadOnlyOnly bool
// InteractiveNote, when set, is the tooltip of the status line and of the
// key bar: what typing into this terminal really reaches.
InteractiveNote string
// RenderedHref, when set, draws the Rendered | Terminal switch: the session
// also has a rendered view (a mirrored Claude Code pane), one tap away.
RenderedHref string
// TerminalOnly, when set, is why this session has NO rendered view
// (mirror.SessionView.TerminalOnlyReason), drawn as one line under the
// header: a mirrored window that opens in the terminal says why instead of
// silently falling back. Never set together with RenderedHref.
TerminalOnly string
// LiveCopy is the warning that this window's conversation also runs
// elsewhere under another session id (mirror.SessionView.LiveCopyWarning),
// "" for none: a banner under the header (livecopy.go).
LiveCopy string
// Offline and Note are a mirrored window's host state, as MirrorViewView's
// (mirrorHostBanner). Note is drawn only where TerminalOnly does not
// already say it.
Offline bool
Note string
// Switcher is the session switcher (switcher.go), the page's last row:
// below the composer — or below the key bar where there is no composer —
// spanning the screen, so the operator switches sessions without going
// back to the Rendered view. Its pin toggle is the page's pin: a window
// with no rendered view, whose only page this is, is pinned here too. It
// is drawn whether or not the composer can send. nil: none (no agent
// store, or the list could not be read).
Switcher *Switcher
// StepUp, when set, puts live keys behind a FRESH sign-in
// (internal/stepup): a mirrored session. The page attaches with live keys
// when the sign-in is fresh, and otherwise asks "Confirm it's you" at the
// first key pressed. nil = live keys at once (an agent pod's terminal).
StepUp *StepUpView
// Composer, when set, draws the message composer under the terminal: a
// mirrored session of an -interactive host (mirror_compose.go). It needs
// StepUp — a send refused as stale asks through the same dialog. nil = no
// composer (an agent pod's terminal, a read-only host).
Composer *MirrorComposerView
// ScrollForm, when set, turns on drag-to-scroll: a vertical drag on the
// terminal (and the mouse wheel) scrolls the session's pane through its
// tmux history, by POSTing ScrollForm plus `lines` to
// MirrorTerminalScrollPath. A host that cannot scroll (an older
// muster-mirror, a read-only host) leaves it "", and the page then has no
// gesture handlers at all — touch pans #term-scroll exactly as before.
ScrollForm string
}
AgentTerminalView is the data the terminal page renders.
type CardAttention ¶
type CardAttention struct {
// Count is the entry's items; the row's pill shows only for Count > 0.
Count int
// Kind is the most urgent item's kind ("session", "question", "ask",
// "plugin": internal/api's attention kinds), which picks the icon.
Kind string
// Href opens that item on the queue page (/attention#<its key>). Nothing
// draws it now: the retired card's badge was a link to it, and a sidebar row
// is itself a link, so its pill cannot be one.
Href string
// Keys are the entry's items' keys, newest first: what a test compares
// with the queue's.
Keys []string
// Kinds is every kind among the entry's items, each once, in the order
// first seen: what the waiting predicate reads (waitTokens). Kind alone is
// only the most urgent one.
Kinds []string
}
CardAttention is an entry's ATTENTION: how many items of the attention queue are this entry's (an agent's or a mirrored window's asks, its waiting session, its held question, its reply drafts), the most urgent one's kind, and where that item is on the queue page. The sidebar's row draws it (navAttentionPill); the name is the retired Agents list card's badge's.
🔴 IT IS NOT DERIVED HERE, AND IT MUST NOT BE. internal/api composes it from attentionItems — the ONE read the queue page, the sidebar badge and the chief's attention_list make — so an entry and the queue cannot disagree about what is waiting.
type ChatLine ¶
type ChatLine struct {
Role string // "user" | "assistant"
Content string
Kind string // "" | "text" | "tool_call" | "tool_result"
ToolID string
ToolName string
ToolOK bool
// ToolTarget is a tool_call's one-line summary (the file, the command). ""
// derives it from Content (the args) with cctranscript.ToolTarget — what a
// persisted row does; the mirrored view sets it from the host's own reading.
ToolTarget string
// ID is the persisted message's row id (0 = none): a bubble's
// data-msg-id, the same after the chat-log refresh redraws the transcript,
// so the bubble clamp keeps a message the reader opened open (bubble_clamp.go).
ID int64
}
ChatLine is one persisted chat message rendered in the detail transcript. For a structured assistant turn (0.7.64) a line is one PART: Kind 'text' renders a bubble; 'tool_call'/'tool_result' render the same collapsed tool chip the live stream shows (Content = args / output). Legacy rows carry an EMPTY Kind, or "text".
⚠ THE EMPTY CASE IS SPELLED OUT IN WORDS ON PURPOSE. It used to name the empty string with a pair of adjacent ASCII single quotes, and gofmt's doc-comment reformatting rewrites that pair into a closing curly DOUBLE quote — so the line silently stopped naming the empty string at all. Nothing errors and nothing fails; the comment just quietly means something else, and the only tell is a character that looks almost identical to what was typed.
type ChatSurface ¶
type ChatSurface string
ChatSurface names WHERE a chat pane is being rendered.
🔴 IT EXISTS BECAUSE agentChatPane IS RE-MOUNTED IN A TRANSFORMED ANCESTOR AND ONE OF ITS CHILDREN IS `position: fixed`. sessionDrawer is `fixed inset-y-0 right-0`, which resolves against the nearest ancestor that establishes a containing block — and ChiefPanel carries `translate-x-full` + `transition-transform`, so a transform on it makes the PANEL that ancestor. Inside the panel the drawer therefore sits at the panel's own right edge, and when the panel is shut it is translated off-screen and `inert` along with it: unreachable, with nothing on screen saying so. The panel gets a sub-view of its own column instead (chiefThreadList), which is what this field selects.
⚠ THE ZERO VALUE IS THE PAGE, DELIBERATELY. AgentDetailPage and OperatorPage construct this view in several places and none of them may change behaviour; a surface that had to be set explicitly would silently re-route one of them.
const ( // ChatSurfacePage is a standalone document — AgentDetailPage or OperatorPage. ChatSurfacePage ChatSurface = "" // ChatSurfaceChiefPanel is the chief slide-out inside the home shell. ChatSurfaceChiefPanel ChatSurface = "chief-panel" )
type ChiefPanelView ¶
type ChiefPanelView struct {
// Configured is false when no agent carries the chief display name. The panel
// then renders an honest explanation rather than an empty chat.
Configured bool
// Reason explains a missing chief, shown verbatim.
Reason string
// Chat is the chief's agent-detail view, re-used as-is.
Chat AgentDetailView
// ThreadsFailed says the SESSION-LIST read behind Chat.Sessions broke, so the
// panel's thread list must render the failure state instead of an answer.
//
// 🔴 IT IS ON *THIS* STRUCT AND NOT ON THE SHARED AgentDetailView, AND THAT IS
// WHAT KEEPS THE TWO PAGE SURFACES OUT OF IT. AgentDetailView is built by
// AgentDetailPage and OperatorPage in several places; a failure flag there would
// be a field those renderers could start reading, and the fix for the panel would
// have a surface area of three screens. Only chiefPanelBody constructs a
// ChiefPanelView, so this field can only ever change what the panel draws.
//
// 🔴 AND IT IS THE FREQUENT PATH, WHICH IS WHY IT EXISTS AT ALL. api.resolveSessions
// discarded the ListSessions error, so a failed read reached this renderer as an
// EMPTY list and #chief-panel-body — refetched on EVERY panel open — rendered
// "No threads yet.": the operator was told their whole thread history was gone
// because one read failed. The search route already said so (ChiefThreadsView.Failed);
// the first paint did not, and the first paint is the path the operator takes first
// and most often.
ThreadsFailed bool
// SessionRuntimes are the runtimes a NEW session may be started on, and
// ClaudeModels the Claude Code models offered; none: no picker
// (chief_sessions.go).
SessionRuntimes []SessionRuntimeView
ClaudeModels []string
}
ChiefPanelView is what the panel body needs.
type ChiefThreadsView ¶
type ChiefThreadsView struct {
// Threads are the rows to render, most-recently-active first. Every one of them
// is rendered: the panel applies no cap of its own, and a search answers with
// its own bounded set (agents.SearchSessionsMaxLimit).
//
// 🔴 SO THE FIRST PAINT IS UNCAPPED WHILE SEARCH IS CAPPED AT 50, AND THE
// MEASUREMENT THAT MAKES THAT SAFE BELONGS HERE RATHER THAN IN A SESSION'S HEAD.
// The first paint is the FREQUENT path — #chief-panel-body refetches on every
// open, and each of those renders this list in full — so "the cap only matters for
// search" would have been the wrong way round. MEASURED against a live database
// on the project muster was extracted from: the chief agent carried FOUR
// chat_sessions rows, two of which were empty recap rows deleted in that arc.
// ⚠ THAT IS A MEASUREMENT ON ANOTHER DEPLOYMENT, so it is the ORDER OF
// MAGNITUDE that carries across, not the number. Threads are created by an operator
// tapping New thread or by an agent's first webchat turn, so the row count is
// operator-paced, not fleet-paced — nothing on a loop writes one.
//
// ⚠ IT IS NOT BOUNDED HERE BECAUSE THE LIST IS NOT THIS RENDERER'S TO TRUNCATE.
// The rows come from api.resolveSessions, which also feeds the agent-detail and
// operator drawers; capping it would silently drop threads from three surfaces,
// and a cap with no "older threads" affordance hides history rather than bounding
// a cost. If the count ever does grow, the bound belongs in resolveSessions with
// an affordance beside it — and the search box above is already the way to reach
// an old thread.
Threads []SessionView
// Query is what was searched, echoed so the empty state can name it.
Query string
// Searched distinguishes "no threads at all" from "no MATCHES", which are
// different sentences and the reason this is not derived from Query != "".
Searched bool
// Failed says the server never got an answer — the read itself broke.
//
// 🔴 IT IS A THIRD STATE, NOT A FLAVOUR OF EMPTY, AND CONFLATING THEM IS THE
// DEFECT THIS FIELD EXISTS TO CLOSE. The search route deliberately answers 200
// with rows on every failure (htmx does not swap a non-2xx body, so a 500 leaves
// the PREVIOUS query's matches on screen as though they were the answer) — and
// that correct decision was rendering a Postgres error, a chief-resolution
// failure and a genuinely empty result set as one sentence, "No thread matches
// that.", traced only in a server log. The operator could not tell "nothing
// matched" from "search is broken", and on the blank-query path they were told
// their thread history was EMPTY when the list read had simply failed.
//
// ⚠ IT OUTRANKS Searched. A failed search has no result set to describe, so
// there is no answer to describe and the query text is echoed only to say what was
// being attempted.
//
// 🔴 IT ALSO OUTRANKS THE ROW COUNT, AND chiefThreadRows ENFORCES THAT RATHER THAN
// TRUSTING THE CALLER — which this comment used to do, and which failed. It read
// "Threads must be empty whenever this is set": a PRECONDITION, stated in prose,
// honoured by the search route (it discards the list on every failure) and violated
// by the first paint the moment that call site was added. api.resolveSessions returns
// `views, err` from one read, and agents.PGStore.ListSessions ends `return out, rows.Err()`
// — so a mid-stream failure (connection reset, server-side cancellation) hands the
// panel a TRUNCATED slice AND a non-nil error. That rendered as state="rows" with no
// failure sentence anywhere: a partial thread history presented as the whole of it.
// The renderer now answers the failure state at EVERY row count, so a caller cannot
// reintroduce it by forgetting; see chiefThreadRows for why the rows are dropped
// rather than shown alongside the sentence.
Failed bool
// Reason replaces the failure SENTENCE when the absence of an answer is not a
// transient read at all. Ignored unless Failed is set.
//
// 🔴 IT EXISTS BECAUSE "Try again." WAS A LIE IN ONE STATE. handleChiefThreadSearch
// renders the failure state when s.ext.Agents is nil — a muster booted with no
// database — and that read cannot succeed on a retry, not now and not ever: there is
// no store to ask. Telling the operator to try again is an instruction that can only
// waste their time. The STATE is still `error` (it is the absence of an answer, which
// is exactly what that state means); only the sentence differs.
Reason string
}
ChiefThreadsView is the thread ROWS the panel's list shows.
type ComboOption ¶
ComboOption is one option in a custom type-to-filter combobox. Value is the submitted value (carried by the hidden input); Label is the visible text the user filters against. For repos Value == Label; for notes they differ (Value is the note id, Label is the directory / body preview).
type ComposerField ¶
type ComposerField struct{ Name, Value string }
ComposerField is one hidden field of a composer.
type ComposerQueue ¶
type ComposerQueue struct {
// Src is the list's URL (SendQueuePath with the window's address).
Src string
List SendQueueListView
// Disabled, when set, draws Queue disabled and says why under the list —
// a host whose muster-mirror does not report whether Claude Code is busy,
// a window that is not Claude Code. The server refuses such a queue
// regardless, and sends nothing to such a target.
Disabled string
}
ComposerQueue is a Rendered view composer's queue: the list's URL, and the list as it was when the page was drawn.
type ComposerView ¶
type ComposerView struct {
// SendPath is the route the form posts to.
SendPath string
// Host, Session and Window address a mirrored entry (hidden fields `host`,
// `session`, `window`); Window is "" for the session's active window. All
// empty for a composer that is not a mirrored entry's.
Host string
Session string
Window string
// Extra are further hidden fields, in order: what else the route needs to
// know where the message goes and where to come back to.
Extra []ComposerField
// Placeholder and Aria name what the text reaches ("Message Claude…").
Placeholder string
Aria string
// Disabled, when set, draws the composer disabled and is the reason shown
// under it — a read-only host, a muster-mirror too old to be sent to, an
// agent that is not running. The server refuses the send regardless.
Disabled string
// DisabledPlaceholder is the input's placeholder while Disabled.
DisabledPlaceholder string
// Notice, when set, is drawn in the status line when the page loads: the
// outcome of a send the BROWSER submitted (no script), which came back here
// as a redirect. NoticeOK says it is good news (it is styled as such).
Notice string
NoticeOK bool
// Nonce names ONE message for the server (hidden field `nonce`): a send
// repeated with the same nonce is delivered once. The server mints one per
// page; the script replaces it after each message that was sent.
//
// 🔴 IT IS WHAT MAKES "TRY AGAIN ANOTHER WAY" SAFE. When a send gets no
// answer the script hands the form to the browser, which posts it again —
// and the first post may have been DELIVERED with only its answer lost. A
// prompt typed into an agent twice is run twice. With the nonce the second
// post is recognised and answered as sent, without being pasted. "" = no
// such protection (the server then delivers every post).
Nonce string
// Dictate is where the microphone posts a recording (TranscribePath), or ""
// for no microphone — the server has no speech-to-text service. A disabled
// composer draws none either way: there is nothing its text could be sent
// to. See dictate.go.
Dictate string
// Upload is where the paperclip posts a file (UploadPath), or "" for no
// attachments — uploads are not configured. A disabled composer draws none
// either way. See attach.go.
Upload string
// Pinned draws the composer position:fixed to the bottom of the VISIBLE
// viewport instead of as the last in-flow child of the page's column, and
// adds composerPinScript. The page must reserve the room it takes
// (pinnedShellClass on its body). See composerPinScript for why.
Pinned bool
// Queue, when set, draws the send queue: "Queue for when idle" behind a
// caret beside Send (composer_menu.go's sendSplit) and the window's queue
// above the input (send_queue.go). Only a mirrored window's
// Rendered view sets it; nil — no database, or any other composer — draws
// neither. A disabled composer draws neither either.
Queue *ComposerQueue
// DraftKey is the localStorage key its text is kept under as it is typed
// (composer_draft.go: MirrorDraftKey, AgentTerminalDraftKey); "" keeps no
// draft. A disabled composer keeps none either way.
DraftKey string
// Switcher, when set, draws the session switcher below the input row
// (switcher.go), spanning the screen as the composer's last row; nil draws
// none. The Rendered view sets it, and a Terminal view (AgentTerminalPage)
// on the composer it draws, where the composer is in flow, not Pinned.
Switcher *Switcher
// Suggest, when set, is the window's suggested-replies URL
// (SuggestPath with its address) and draws the chip row above the
// composer (suggest_row.go); "" draws none. Only a Claude Code window's
// Rendered view on an interactive host sets it — never a Terminal view,
// never Hermes. A disabled composer draws none either way.
Suggest string
// SuggestPaused draws one line saying the viewer's suggested replies are
// paused (the auto-pause), with the way back on (Account). Drawn with the
// page, so it moves nothing.
SuggestPaused bool
}
ComposerView is one composer.
type ConnectorAuditView ¶
type ConnectorAuditView struct {
At time.Time
Kind string
AgentName string
Connector string
Method string
Host string
Path string
Status int
Detail string
}
ConnectorAuditView is one audit line.
type ConnectorFormView ¶
type ConnectorFormView struct {
// RequestID, when set, approves that pending request in the same submit.
RequestID int64
AgentName string
Name string
Preset string // a preset key, or "custom"
Presets []ConnectorPresetView
Hosts string
Scheme string
Header string
Username string
Error string
// The postgres preset's fields (PostgresPresetKey): the database host,
// port, name, sslmode, whether TLS is required, and the statement timeout.
// The user is Username.
PGHost string
PGPort string
PGDatabase string
PGSSLMode string
PGRequireTLS bool
PGTimeoutMS string
}
ConnectorFormView is the create / enter-credential form.
type ConnectorGrantView ¶
type ConnectorGrantView struct {
ID int64
AgentName string
Status string // pending | approved
LastUsedAt *time.Time
RequestedAt time.Time
// DecidedFrom, when non-empty, is the mirrored session ("<host>/<session>")
// the operator approved it from over MCP (connector_request_decide,
// migration 0035) rather than on this tab. The host is proven by its mirror
// token; the session is the one the caller named.
DecidedFrom string
// StandingID, when non-zero, is the standing grant (shared approval) that
// approved it automatically: no one decided this request by hand.
StandingID int64
}
ConnectorGrantView is one agent's live grant on a connector.
type ConnectorPresetView ¶
ConnectorPresetView is a preset offered in the form.
type ConnectorRequestView ¶
type ConnectorRequestView struct {
ID int64
AgentName string
Connector string
Reason string
RequestedAt time.Time
// Exists is false when the agent asked for a connector nobody has configured:
// the operator's answer is then the form that creates it.
Exists bool
// Problem, when non-empty, is why the connector cannot currently serve this
// agent (a virtual connector's operator-facing failure, e.g. the GitHub App's
// credentials refused): approving still records the decision, but the agent's
// requests will fail until it is fixed.
Problem string
// other agents (a standing grant, migration 0043).
Shares string
}
ConnectorRequestView is one pending request.
type ConnectorSharedView ¶
type ConnectorSharedView struct {
// Repo is the one repository a GitHub App approval is shared for; "" for a
// stored credential, shared for the connector.
Agents int
}
ConnectorSharedView is one shared approval (a standing grant).
type ConnectorView ¶
type ConnectorView struct {
Name string
Platform string
Hosts []string
Scheme string
HeaderName string
Username string
CreatedAt time.Time
RotatedAt *time.Time
LastUsedAt *time.Time
Grants []ConnectorGrantView
// 0043): approvals that every agent's matching request gets automatically.
Shared []ConnectorSharedView
// Managed, when non-empty, says the connector is provided by the server's
// configuration (a virtual connector: the GitHub App) and why it has no
// Rotate or Delete — the card shows it in their place.
Managed string
// Problem is a managed connector's current operator-facing failure, if any.
Problem string
}
ConnectorView is one connector's public description, with its grants.
type ConnectorsContent ¶
type ConnectorsContent struct {
// Unconfigured, when non-empty, is why this server has no connector store;
// the panel says so instead of rendering empty lists.
Unconfigured string
Notice string
Error string
Requests []ConnectorRequestView
Connectors []ConnectorView
Audit []ConnectorAuditView
// EditorForm, when set, is rendered into #connector-editor — a submit that
// failed validation comes back with its fields (never its secret) and the
// error, rather than losing what the operator typed.
EditorForm *ConnectorFormView
}
ConnectorsContent is the whole /ui/connectors partial.
type ContextView ¶
ContextView is the header's context-usage readout (mirrorViewBatch.Context): the latest turn's context, as a count ("124k context").
type CuratedModel ¶
type CuratedModel struct {
Value string // submitted model slug; empty means "use the server default"
Label string // visible option text
}
CuratedModel is one option in the curated model dropdown.
type FaroSettings ¶
type FaroSettings struct {
// URL is the Faro collect endpoint (MUSTER_FARO_URL). EMPTY DISABLES all
// telemetry — no script tags, no init are rendered (the e2e/local default).
URL string
// Key is the public Faro app API key (MUSTER_FARO_API_KEY); the SDK sends it
// as the x-api-key header.
Key string
// Version is the running build version, used as the Faro app version.
Version string
// Tracing enables the faro-web-tracing bundle + OTEL tracing instrumentation
// (frontend → Tempo spans). Off by default to keep the phone payload lean.
// On, the page's same-origin fetches and XHRs carry a traceparent (their
// server spans join the browser's trace), and each session open is a span
// of its own (musterOpen) parented on the document's server span.
Tracing bool
// Relay: URL is muster's own relay route (api.FaroRelayPath), posted to
// same-origin; the page makes it absolute from location.origin, because
// Faro's tracing ignores its own collector by exact URL and a relative
// one would trace every telemetry post.
Relay bool
}
FaroSettings holds the frontend RUM (Grafana Faro) configuration surfaced into the page head. It is set ONCE at startup from the environment (see main.go) and read by faroHead on every full-document render.
The API key is CLIENT-PUBLIC by design (it is shipped to every browser and only gates the public Faro collect endpoint), so it is a plain value, not a secret.
type Features ¶
type Features struct {
// Connectors is true when the server holds a connector store (an encryption
// key is configured). False removes the Connectors tab and its panel: the
// store is built only with a key.
//
// 🔴 FALSE IS THE SHIPPING DEFAULT, NOT AN EDGE CASE, which is why the zero
// value is the unbuilt state. A caller that forgets to populate this draws
// LESS than it could, which is the safe direction: the opposite default
// draws a tab over nothing.
Connectors bool
// Admin is true when the viewer is an admin and the admin pages are
// served (accounts PR 5). It draws the sidebar's Admin link and nothing
// else: the pages refuse a member on their own (requireAdmin).
Admin bool
// Push is true when the server holds VAPID keys and a subscription store
// (muster-native Web Push). False draws no Enable button, no "on" pill and
// no subscribe script: the routes behind them would only answer 503, and an
// Enable button over a 503 asks for the OS permission and then fails.
Push bool
// Attention is true when the server holds the attention queue's store
// (internal/attention). False draws no Attention link and no badge: the
// routes behind them would only answer 404.
Attention bool
// Dispatch is true when the server holds an agent provisioner
// (MUSTER_AGENT_PROVISIONER is not `none`), i.e. when POST /agents can do
// anything but answer 503. False draws no "+" in the sidebar (navAgentsHead
// draws the "not set up" hint instead) and no Dispatch button on a task card (TaskCardView's
// field of the same name, set from the same server predicate): the docker
// compose install ships with no agent runtime, and a "+" over a 503 is a
// button that can only fail.
Dispatch bool
// SnapUser and SnapBuild are the signed-in user and the running build: the
// key, and the check, of the mirrored view's snapshot store
// (mirror_snap.go). A zero SnapUser draws no snapshot script at all.
SnapUser int64
SnapBuild string
}
Features says which OPTIONAL subsystems the process rendering a document actually built. It is what lets a document show a surface only when there is something behind it.
🔴 IT IS A RENDER PARAMETER, NOT PACKAGE STATE, AND THE DIFFERENCE IS CORRECTNESS RATHER THAN TASTE. faroConfig is process-wide because telemetry is a property of the process; this is a property of the SERVER's extensions, and the only honest place to read it is the handler holding that server. A package global would also have to be written from a request path — every handler races every other one, and a test that renders one shape would decide what a concurrent test renders.
🔴 IT DOES NOT DECIDE WHICH ROUTES EXIST, AND IT MUST NEVER GROW INTO THAT. Route registration in internal/api is unconditional on purpose (see that package's routes.go): the recorded route set is a function of the code and never of a fixture. This type gates what a DOCUMENT draws — a link and a panel — while every route stays registered and answers its own unwired case. The two are independent claims and both are needed: without the handler's answer a stale page still reaches a dead route, and without this a live page mounts a panel whose only possible content is a refusal.
type FocusHistoryEntry ¶
FocusHistoryEntry is one past focus as the list shows it.
type FocusHistoryPageView ¶
type FocusHistoryPageView struct {
Entries []FocusHistoryEntry
Next string
First bool
}
FocusHistoryPageView is one fetched page: its entries, newest first, and the next page's URL ("" = this page reaches the oldest). First is true for the newest page, so an empty one says so instead of ending a list.
type FocusView ¶
type FocusView struct {
Title string
Description string
UpdatedAt time.Time
// Problem is why the focus is missing (Title "") or stale (the latest
// refresh failed after it was written): a short, non-secret reason
// (focus.Reason), at ProblemAt. "" when the focus is current.
Problem string
ProblemAt time.Time
}
FocusView is a session's FOCUS (internal/focus): what the session is working on, and when that was last written. The palette finds an entry by its title (switcher.go focusTitle).
type HostPreferences ¶
HOST PREFERENCES: what the operator calls their own hosts, which this code cannot know. One setting, empty by default:
- Icons: a host's icon BY ITS NAME ("laptop" draws the laptop glyph), whatever its registration rank. No host picked by rank draws a glyph named here, so a named glyph means that host.
It is configuration (MUSTER_HOST_ICONS, read in cmd/muster-server) rather than a list in this file because host names are the operator's own, and a deployment's real ones must not be written into this repository.
func (HostPreferences) Normalized ¶
func (p HostPreferences) Normalized() (HostPreferences, error)
Normalized is p checked, with its host names lower-cased and trimmed: they are matched case-insensitively (the list's host field is lower-cased). It refuses:
- the cluster's own name (it draws clusterIcon);
- a name that is not a host name (hostNamePattern: no space, no separator);
- an icon that is not one of hostIconSet's keys, or one named for two hosts (it would no longer say which host it is).
type IdentityTint ¶
type IdentityTint struct {
BorderDark, BorderLight, TitleDark, TitleLight idRGB
}
IdentityTint is one colour's four variants: border and title, dark and light theme.
type KindChoices ¶
KindChoices is what the dispatch form offers for agent kinds: the kinds the deployment enables (agents.Kinds order) and, for claude-code, the configured Claude account NAMES the operator may pin. Never a token.
⚠ ONE KIND RENDERS NO PICKER AT ALL. A deployment that enables only the gateway kind — every deployment before kinds existed — gets the form it had, and the POST carries no `kind`, which the server reads as the gateway kind.
🔴 Accounts ARE THE CALLER'S OWN. A member's list is the accounts they entered in Account → Credentials; the deployment's environment pool is the admin's and never appears on a member's form.
Unavailable maps a kind the caller has no credential for to the sentence saying what to add. Such a kind renders DISABLED with that sentence beside it; the server refuses it regardless (api.resolveKindAccount).
type MirrorAskLiveView ¶
type MirrorAskLiveView struct {
Ref MirrorRef
ToolID string
// State is one of the AskState* of a live card.
State string
Questions []askq.Question
// Answers is the answers recorded (answered) or being typed (typing).
Answers map[string]string
// Note is why typing failed (failed).
Note string
// Unanswerable, when set, is why this question cannot be answered from
// here (a read-only or older host): the card says it in place of a form.
Unanswerable string
// Error is a refused submit's reason, drawn above the form.
Error string
// Retry (failed) says the answer can be tried again from here: with
// Chosen, that answer is resent as it is (a fixed retry: the picker holds
// part of it, and muster continues it); without, the form is drawn again.
Retry bool
// Chosen is the answer muster typed part of (failed), one choice per
// question, as the picker takes them.
Chosen []askq.Choice
// CanCancel says the card offers "Cancel question" (pending, failed): the
// host is online, -interactive, and advertised it can dismiss a picker.
// WindowName is the window as the confirm dialog names it.
CanCancel bool
WindowName string
// Sent is a dismissal's note, on the card the dismissal answers with
// (not kept: the next poll's card is the server's, and the CLI's record
// of the call ending flips it): the Esc was sent. SentShowing says the
// picker was still on the terminal's screen after it: the card keeps its
// form and Cancel under the note; otherwise the picker went, and the
// card shows the question read-only. Either is data-ask-sent on the card,
// which the page's merge compares with the state, so the next poll's
// card replaces it.
Sent string
SentShowing bool
}
MirrorAskLiveView is one question a window's session is asking (or asked lately), as the server knows it.
type MirrorCardView ¶
type MirrorCardView struct {
Host string
Session string
// Window is the tmux window id the entry is ("@12"); "" = a per-session
// host's session. With Session it is the entry's ADDRESS: what it links,
// keys and ids by. Never the window's index, which tmux renumbers.
Window string
// Title is what the entry is called when the host sent no Label:
// "<session>:<window index>" for a window. "" = the session name.
Title string
// Label is the host's display name for the entry ("mango:1"), "" for
// none. DISPLAY ONLY: the real name stays findable, as the palette finds an
// entry by its raw session name too (switcherItems' Words).
Label string
// Qualifier is what tells this entry apart from another listed entry with
// the same title — its host, and/or its tmux address — "" when the title is
// already unique. Decided in ONE place over the whole list
// (mirror.SessionView.Qualifier); shown as part of the title.
Qualifier string
// Kind is what runs in the pane, as the list names it ("Claude Code",
// "opencode", "shell", or a command); "" = unknown. Searched (mirrorKind);
// Claude decides where the entry opens.
Kind string
// Note is the host's line about the window (mirror.SessionView.AgentNote):
// why it has no rendered view, or what its credential needs. "" for none.
// Nothing draws it from this view now (the retired Agents list's card did).
Note string
// LiveCopy is the warning that the window's conversation also runs
// elsewhere under another session id (mirror.SessionView.LiveCopyWarning),
// "" for none. Nothing draws it from this view now (the retired Agents
// list's card drew it under its title, livecopy.go).
LiveCopy string
// Online: the host is connected and still lists the session.
Online bool
// Interactive: the host ANNOUNCED -interactive, so its terminal page offers
// the Interactive switch (still behind a fresh sign-in: internal/stepup).
// Nothing reads it from this view now (the retired Agents list's filter
// had a mode:interactive field).
Interactive bool
// ActiveAt is when the host last saw the entry active
// (mirror.SessionView.Activity: Unix seconds, floored to a minute); zero =
// the host did not say. The sidebar row's recency dot reads it — the same
// number the entries are ordered by (orderList).
ActiveAt time.Time
// Claude: the host reports Claude Code in the session's pane, so the entry
// opens the RENDERED view by default (MirrorViewPath); otherwise it opens the
// terminal.
Claude bool
// AgentView: the host reports a non-Claude runtime with a view (Hermes)
// in the pane AND names the conversation it shows
// (mirror.SessionView.AgentView), so the entry opens
// its read-only rendered view by default, as a Claude Code entry does.
AgentView bool
// Pinned: the viewing user pinned this entry's address (internal/pins). The
// switcher orders a pinned entry first (orderList) and its pin toggle reads
// it (switcher_pin.go); a pinned entry is never in the Idle section.
Pinned bool
// Focus is what the Claude Code session in the window is working on
// (internal/focus, keyed by its Claude session id), nil for none.
Focus *FocusView
// Repo is the short name of the repository the window works in
// (mirror.SessionView.Repo: its git top level's name, else its cwd's),
// "" when the host did not say (an older muster-mirror). The palette finds
// the entry by it (switcherItems' Words); the entry's NAME is unchanged.
Repo string
// Attention is the entry's attention count (cards_attention.go), drawn on
// its sidebar row (navAttentionPill), nil for none.
Attention *CardAttention
// Work is what the window's Claude Code session has running now
// (mirror.SessionView.Work): its sidebar row's count (navWork), display only. The zero value — nothing running, or a host that did not
// say — draws no count.
Work mirror.WindowWork
// Color is the window's tmux identity colour (mirror.SessionView.Color,
// lowercase #rrggbb), "" for none: the sidebar row's left edge is tinted
// with it (identity_color.go). None — or anything that is not a wire
// colour — draws a transparent edge.
Color string
// HostIcon is the key of Host's icon (HostIconFor, composed in
// internal/api from the host's registration rank); "" draws the hash
// fallback.
HostIcon string
// Idle: in the Idle section (idle_section.go), composed by MarkIdle; the
// sidebar draws it in its Idle group (navIdleGroup).
Idle bool
}
MirrorCardView is one MIRRORED entry of the sidebar and the session switcher: a tmux WINDOW (or, from a muster-mirror that registers per session, a whole session) on one of the operator's own machines, reported live by that machine's muster-mirror (internal/mirror). It is NOT an agent — there is no agents row, no chat, nothing to start, stop or delete — so it is its own view, not an AgentCardView with fields switched off. (The name is the retired Agents list card's.)
type MirrorComposerView ¶
type MirrorComposerView = ComposerView
MirrorComposerView is ComposerView under the name it had while only mirrored sessions had one.
type MirrorIndex ¶
type MirrorIndex struct {
Items []MirrorIndexItem `json:"items"`
More int `json:"more"`
}
MirrorIndex is the prompt index as the view's socket sends it: every prompt the host's transcript holds (the newest it kept), each with its bubble's element id, and how many earlier ones the host left out.
func NewMirrorIndex ¶
func NewMirrorIndex(refs []cctranscript.PromptRef, more int) *MirrorIndex
NewMirrorIndex is refs as the view's index.
type MirrorIndexItem ¶
MirrorIndexItem is one prompt: its bubble's id and its first line.
type MirrorOp ¶
type MirrorOp struct {
Op string `json:"op"` // "append" | "replace" | "wrap" | "attr" | "result" | "patch"
ID string `json:"id,omitempty"`
HTML string `json:"html,omitempty"`
Into string `json:"into,omitempty"`
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
}
MirrorOp is one DOM operation the rendered view's page applies:
- append: add HTML to the conversation — or, with Into, to the element of that id (a tool-call group's body);
- replace: put HTML in place of the element with ID (a running tool row whose result arrived; a group's summary as its count ticks up);
- wrap: put HTML (a tool-call group) in place of the element with ID and move that element into the group's body — the second call of a run;
- attr: set attribute Name to Value on the element with ID (a group's state);
- result: a tool row's result for a call an EARLIER socket drew (Resumed): the row with ID takes HTML's status and output and keeps the rest; with no such row on the page, it is an append;
- patch: put HTML in place of the element with ID when the page has one, and do nothing when it does not (a subagent card's summary: never drawn anywhere but inside its card).
type MirrorRef ¶
MirrorRef addresses one mirrored entry: a host, a tmux session on it, and — for a host that registers per window — the window's tmux id. Every URL of a mirrored entry is built from one, so the pages, their sockets and their composer cannot name different windows.
Window == "" is "the session's ACTIVE window": the only address a per-session host has, and what every URL from before windows were addressable means.
func (MirrorRef) ScrollForm ¶
ScrollForm is the entry's address as the body of a scroll request (MirrorTerminalScrollPath), before the page adds `lines`.
func (MirrorRef) SubagentPath ¶
SubagentPath is MirrorSubagentPath for this entry, before the page adds `agent`.
func (MirrorRef) TerminalPath ¶
TerminalPath is the entry's terminal page.
func (MirrorRef) TerminalWSPath ¶
TerminalWSPath is that page's socket, before the page adds its mode and size.
func (MirrorRef) ViewWSPath ¶
ViewWSPath is that page's transcript socket, before the page adds its resume point.
type MirrorTranscript ¶
type MirrorTranscript struct {
// Resumed says the page this socket draws for already holds a conversation
// drawn by an EARLIER socket (it reconnected with gen and offset, and no
// Reset came). This transcript has none of that page's calls, so a result
// for one of them is not an orphan to draw at the end: it is redrawn where
// the page has it (a `replace`), and no run is started from it.
//
// 🔴 WITHOUT IT A RESUME SCRAMBLED A RUN: calls a, b, c drawn as one group,
// the socket dropped and resumed, then results a, b, c arrived — each taken
// for an orphan and appended by the grouping rule, so b and c were MOVED out
// of the group into a new one at the end (the client's dedupe removes the old
// row before an append) under the SAME group id as the first: a duplicate id
// and a split, reordered run. The page refreshes a redrawn row's group count
// and state itself (toolGroupScript's refresh).
Resumed bool
// Subagents: the host reports subagents (the stream's SubagentList), so
// an Agent call is drawn as a subagent card (subagent_cards.go) — never
// for an older host, whose Agent calls stay plain tool rows. cards are
// the cards drawn, by tool id, and subs the latest summary of each (a
// summary can arrive before its card). Bounded with calls (forget).
Subagents bool
// contains filtered or unexported fields
}
MirrorTranscript is one rendered-view socket's drawing state: the tool calls on screen, so a result can redraw its call's row in place.
🔴 IN MEMORY, PER SOCKET, AND BOUNDED: it is dropped with the socket and reset with the view, and holds at most maxDrawnCalls calls (the oldest are forgotten; a result for one draws as its own row).
func (*MirrorTranscript) Ledger ¶
func (t *MirrorTranscript) Ledger() cctranscript.ToolContext
Ledger is a copy of the tool-context ledger as Ops has left it: a checkpoint a later socket resuming from the same place restores (RestoreLedger), so a call still running across a reconnect is still attributed when its next turn arrives.
func (*MirrorTranscript) Ops ¶
func (t *MirrorTranscript) Ops(events []cctranscript.Event) []MirrorOp
Ops renders events as the page's DOM operations, in order.
func (*MirrorTranscript) QueuedOps ¶ added in v0.129.0
func (t *MirrorTranscript) QueuedOps(list []string) []MirrorOp
QueuedOps is the host's queued-message list (mirror.Msg.Queued) as the page's DOM operation: the region redrawn ("patch") when the list differs from the one this socket drew last — and always the first time, so a list an earlier socket or a snapshot drew is replaced.
func (*MirrorTranscript) Reset ¶
func (t *MirrorTranscript) Reset()
Reset forgets every drawn call (the view starts over).
func (*MirrorTranscript) RestoreLedger ¶
func (t *MirrorTranscript) RestoreLedger(l cctranscript.ToolContext)
RestoreLedger resumes the ledger from a checkpoint (Ledger) taken at the very place this socket resumes from.
func (*MirrorTranscript) SubagentOps ¶
func (t *MirrorTranscript) SubagentOps(list []mirror.Subagent) []MirrorOp
SubagentOps is a subagent list (mirror.Msg.Subagents) as the page's DOM operations: each card whose summary changed is redrawn — its <summary> (a "patch": a page without that card draws nothing), and its state and agent attributes — and nothing else, so an opened card keeps its tail. A summary for a call this socket never drew is drawn only when the page may have it from an earlier socket (Resumed); otherwise it is kept for the card the call will draw.
func (*MirrorTranscript) TakeContext ¶
func (t *MirrorTranscript) TakeContext() *ContextView
TakeContext is the context readout when Ops has drawn a newer one since the last call, else nil — so a batch carries it only when it changed.
type MirrorViewView ¶
type MirrorViewView struct {
// DraftUser is the signed-in user, the first part of the message box's
// draft key (composer_draft.go).
DraftUser int64
Host string
// HostIcon is Host's icon key (HostIconFor), the one its cards draw.
HostIcon string
Session string
// Window is the tmux window id the view is of; "" = the session's active
// window (a per-session host). With Session it is the page's ADDRESS: its
// socket and its composer name the same window.
Window string
// Title is what an entry with no Label is called ("<session>:<window
// index>"); "" = the session name.
Title string
// Label is the host's display name for the session ("mango:1"), "" for
// none: the page's title. Session stays the address.
Label string
// Qualifier is what tells this entry apart from another listed entry of the
// same name ("" = none) — the SAME qualifier its Agents card shows
// (mirror.Qualified): part of the header's title and of <title>.
Qualifier string
// Interactive: the host advertised -interactive, so the composer is offered
// (each send is still gated on a fresh sign-in, server-side). False draws
// it disabled, saying why.
Interactive bool
// Hermes: the window runs Hermes (docs/design/hermes.md). Its composer
// sends only when HermesSend — the host advertised hermesSend and is
// -interactive (Phase 3) — and is drawn disabled saying why
// (MirrorHermesNoSendNote), with no queue, otherwise.
Hermes bool
// HermesSend: a Hermes window whose host sends to Hermes.
HermesSend bool
// ViewOnly is the Kind of a runtime muster VIEWS but never sends to
// (opencode); "" otherwise. Its composer is drawn disabled saying why
// (MirrorViewOnlyNote), with no queue.
ViewOnly string
// StepUp is the "Confirm it's you" wiring (stepup_confirm.go): a send
// refused as stale asks there — passkey or password — and retries. Unused
// (no dialog is drawn) on a read-only host, which cannot be sent to at all.
StepUp *StepUpView
// Notice, NoticeOK and Nonce are the composer's (ComposerView).
Notice string
NoticeOK bool
Nonce string
// Dictate is the composer's (ComposerView.Dictate).
Dictate string
// Upload is the composer's (ComposerView.Upload).
Upload string
// Queue is the composer's send queue (ComposerView.Queue); nil for none.
Queue *ComposerQueue
// FocusHistory is the session's focus history, the newest page
// (FocusHistoryPath); "" when the host reports no Claude session for the
// window, which then has none. The index sheet's second tab.
FocusHistory string
// Asks and AsksSrc are the window's Claude sessions' OPEN attention asks
// and their fragment URL (AgentDetailView.Asks).
Asks string
AsksSrc string
// overlay — this page is sized to the window) and its hamburger, framed
// by the view swap or not (nav_layout.go says why).
Nav NavChrome
// Switcher is the session switcher below the composer (switcher.go); nil
// for none.
Switcher *Switcher
// Suggest is the suggested replies' URL (ComposerView.Suggest); "" for
// none — a Hermes window, a host with suggestions not wired.
Suggest string
// SuggestPaused: the viewer's suggestions are auto-paused here
// (ComposerView.SuggestPaused).
SuggestPaused bool
// LiveCopy is the warning that this conversation also runs elsewhere
// under another session id (mirror.SessionView.LiveCopyWarning), "" for
// none: a banner under the header (livecopy.go).
LiveCopy string
// Offline: the host is not serving the window now (its muster-mirror is
// not connected, or it no longer lists the session). Note is the host's
// line about the window (mirror.SessionView.AgentNote), "" for none. Both
// drawn under the header (mirrorHostBanner).
Offline bool
Note string
}
MirrorViewView is the data the rendered view's page renders.
type NavApp ¶
type NavApp struct {
NavApp is a NavDocument laid out as a PHONE APP SCREEN — the page a notification opens (the ask page, internal/api attention_ask_page.go): a top bar with a back arrow and the screen's name, the content scrolling between it and a composer PINNED to the bottom, above the on-screen keyboard and inside the safe-area insets. The column is one dynamic-viewport-high flex column (h-dvh; the viewport resizes its content when the keyboard opens), so the composer is its last row rather than position:fixed — nothing is laid over the content, and nothing can scroll the page sideways. On a desktop the side nav is beside it, as on every page.
type NavChrome ¶
type NavChrome struct {
}
NavChrome is what a page outside the shell needs to draw the navigation: which optional entries exist.
type NavDocumentView ¶
type NavDocumentView struct {
Title string
// Entry is the nav entry the page belongs to (a tab key, NavAttention,
// NavAccount, NavAdmin), or "" for a page with none (Plugins, Browser
// flows, a notice): no link is then highlighted or marked current.
// every value escaped there. It is placed as it is.
Main string
// invite link) or takes one (an OAuth token or API key typed in, a passkey
// ceremony). It loads no telemetry script — these pages never did, and a
// RUM script on the page a secret is rendered or typed in is a reader of it
// nobody needs. Every other page keeps the shell's (faroHead).
Secret bool
// of the column under the shell's header.
App *NavApp
}
NavDocumentView is a server-authored page drawn inside the navigation.
type NoteEditView ¶
type NoteEditView struct {
Note notes.Note
// Directories is the SEED set only (notes.DefaultDirectoryLimit most-recent
// paths), never the whole archive — the rest is reached through the picker's
// search route. See directoryCombobox.
Directories []string
// DirectoriesFailed reports that the directory READ ERRORED, as distinct from
// "there are no directories". The two used to render identically, which is how
// a picker that had been empty in production since it shipped stayed
// unnoticed. See directoryPickerFailed.
DirectoriesFailed bool
// Vocabulary backs the tag input's <datalist> suggestions, so the human reuses
// existing labels instead of minting near-duplicates.
Vocabulary []notes.TagCount
}
NoteEditView carries everything the edit form needs pre-resolved server-side: the task (its current values) and the directory picker options.
type NoteOption ¶
NoteOption is a selectable existing note for the dispatch modal.
type NotificationRow ¶
type NotificationRow struct {
Name string // the agent slug (the route key)
DisplayName string // human-facing label ("" → falls back to Name)
SessionID int64 // the session to deep-link to
Count int // unread assistant messages for this agent
}
NotificationRow is one agent's unread-replies entry in the notifications panel: the link target session, the agent's name/display name, and the unread count.
type QuickKey ¶
type QuickKey struct {
ID string // data-key, the stable handle a test addresses
Label string
Aria string
Seq string // the bytes sent, as typed by a VT100-style terminal
}
QuickKey is one button on the terminal's quick-key bar: a key a phone's keyboard lacks, and the exact bytes it types.
type RecentRef ¶
RecentRef is one recently opened entry, as the store keys it: an agent by id (Mirror zero), or a mirrored entry by its address (AgentID 0).
type RepoView ¶
RepoView is the minimal repo shape the dispatch dialog's repository picker renders (decoupled from the GitHub API client type).
type SendAgainView ¶
type SendAgainView struct {
// Action is the route the page posts to: the Send, Queue or Send now it
// answers, once more, with SendAgainField=1.
Action string
// Fields are what that post carries besides: the address, the text, a
// fresh nonce. Nothing for a Send now (its route names the message).
Fields []ComposerField
// Why is the refusal, in the server's words.
Why string
// Text is the message, shown so the person can tell which one it is.
Text string
// Button is the button's text ("Send again", "Queue it anyway"…).
Button string
// BackHref is where Cancel goes: the view it came from.
BackHref string
}
SendAgainView is SendAgainPage's content.
type SendQueueItem ¶
type SendQueueItem struct {
ID int64
// State is the sendqueue state: queued, sending, sent, failed, cancelled.
State string
// Preview is the start of the message (the owner's own text).
Preview string
// Body is the whole message: what a tap on the preview shows
// (sendQueuePreview), and a queued one's Copy message. "" draws the
// preview alone, with nothing to open.
Body string
// Detail is the outcome in words, for a finished one.
Detail string
// Cancellable: still queued.
Cancellable bool
// Answered is the asker whose question this message already answered when
// it was queued, "" for none: its Cancel cannot take that answer back.
Answered string
// Retryable: it failed and has not been retried; drawn with a Retry.
Retryable bool
// Deletable: it is finished, so its owner may remove it from the list;
// drawn with a Delete. The list holds only failed ones among the finished
// (sendqueue.PGStore.List). Never a queued message (that is Cancel) or one
// being sent.
Deletable bool
// MayHaveDelivered: muster stopped while sending it, so it may have
// reached the window. Its Retry warns, and asks once before it queues it.
MayHaveDelivered bool
// Editable: queued, and a person's own (a routed message's text is the
// chief's); its menu has Edit.
Editable bool
// Held: held for an edit right now (here or on another device); nothing of
// the window's queue is sent until it is saved, cancelled or runs out.
Held bool
// HoldLapsed: an edit was opened and not saved in time; it kept its text.
HoldLapsed bool
// Edited: its text was changed by a saved edit.
Edited bool
// HeldElsewhere: this page asked for the row open, but its hold is not the
// one this page's Edit was given — another device took the edit over.
HeldElsewhere bool
// Editing: draw the row as its edit form (sendQueueEditRow), under
// HoldToken, the hold its Save and Cancel present. HoldLeftMS is how long
// the hold has left, which the list's script counts down.
Editing bool
HoldToken string
HoldLeftMS int64
}
SendQueueItem is one message of the list.
type SendQueueListView ¶
type SendQueueListView struct {
Items []SendQueueItem
// Waiting is what the next message is waiting for (sendqueue.Decide's
// reason), "" when nothing is queued or it is about to send.
Waiting string
// Held: the queue is held on how the window's latest turn failed — a usage
// limit, or the circuit breaker (sendqueue.Decision.Held). Waiting says
// why; Send now still sends one.
Held bool
// ResumeAt is when a held queue resumes — a usage limit's reset, the
// breaker's next retry — zero when it names none. Drawn after Waiting in
// the READER's zone (a <time data-clock> the list's script formats); the
// server, which does not know that zone, draws it in UTC, saying so.
ResumeAt time.Time
// Now is the server's clock when the view was drawn: whether ResumeAt is
// today decides whether its date is drawn (utcClock).
Now time.Time
// Error is why the list could not be read.
Error string
}
SendQueueListView is a target's queue.
type SessionRuntimeView ¶
SessionRuntimeView names a runtime the picker offers.
type SessionView ¶
type SessionView struct {
ID int64
// Runtime and Model are the session's (chief_sessions.go): Runtime "" is a
// session on the agent's own runtime, and draws no runtime line.
// RuntimeLabel is what the line calls the runtime.
Runtime, RuntimeLabel, Model string
// IsDefault marks the agent's default session; DefaultPath, when set, is
// where a non-default session's "Make default" control posts.
IsDefault bool
DefaultPath string
// Title is the session's name, derived by the store from its first user message.
//
// 🔴 AN EMPTY TITLE RENDERS DIFFERENTLY ON THE TWO SURFACES THAT DRAW THESE ROWS,
// AND THAT IS DELIBERATE RATHER THAN DRIFT: sessionDrawer (the agent-detail and
// operator pages) renders "New chat"; chiefThreadRows (the chief slide-out)
// renders "New thread". Each matches the noun its own surface uses everywhere else
// — the page's control is "New chat", the panel's is "New thread" and its list is
// headed "Threads" — so making them agree would leave one of the two surfaces
// naming a thing its own buttons do not. This comment is the only written answer
// to "what does an untitled session show", so it names both; the pair is pinned
// two-way by ui.TestAnUntitledSessionsPlaceholderIsPerSurfaceAndLedgered.
//
// 🔴 THAT GUARD DERIVES THE RENDERER SET FROM THE PACKAGE'S OWN AST rather than
// enumerating the two it knows about — but its reach is ONE SYNTACTIC SHAPE, and
// this comment is where that limit has to be stated because this is where the
// promise is made. What it matches is exactly the shape both renderers are written
// in: `title := x.Title`, then `if title == "" { title = "<word>" }`, inside a
// FuncDecl of package `ui`. MEASURED to pass it, i.e. NOT caught: a fallback keyed
// on the field directly (`if s.Title == "" { return "…" }`), one assigning a named
// constant instead of a literal, and one testing `len(title) == 0`. So a third
// renderer copying either of these two keeps the sentence honest; a third renderer
// written differently does not, and nothing here would say so.
//
// ⚠ THE EARLIER CLAIM WAS WIDER THAN THE CODE, TWICE OVER. Before round 2 this
// comment credited the guard with catching a third renderer while the test
// hard-coded two surfaces and two literals; round 2 derived the set but the comment
// then said the derivation "is what makes the promise true rather than merely
// intended", which the measurement above does not support. Widening the scan to
// every possible fallback shape is a parser nobody should own — the limit is worth
// naming, not closing.
Title string
Active bool
LastActive time.Time // session's last-active time (UpdatedAt), rendered relative
// Snippet is a short excerpt around a SEARCH match in this thread's message
// bodies. Empty on the plain list, and empty for a result matched by TITLE
// alone — the title is already on screen, so repeating it as a snippet would
// claim a body match that does not exist.
Snippet string
}
SessionView is one chat session in the switcher.
type ShellData ¶
type ShellData struct {
// contains filtered or unexported fields
}
ShellData is state a shell draws on its FIRST PAINT, rather than after the panel's own load, because drawing it later would move what is below it.
Only the Tasks tab draws anything here now (WithTasks). The retired Agents tab's document drew its LIST here (WithList, agents_list_ssr.go), and before that a "Recently viewed" strip, for the same reason — the strip measured 0.011 of layout shift when it arrived late.
type StepUpFormView ¶
type StepUpFormView struct {
// Action is the route the page posts to: it checks the password and, when
// it is right, performs the send that was waiting.
Action string
// Fields are the pending send, carried as hidden inputs — its address, its
// text, its nonce — so confirming completes it rather than asking for the
// message again.
Fields []ComposerField
// BackHref is the view the send came from (Cancel, and where the result is
// shown).
BackHref string
// Window is the freshness window as a person reads it ("12 hours").
Window string
// Error is why the last attempt was not accepted; "" on the first showing.
Error string
}
StepUpFormView is the plain "Confirm it's you" page: the step-up for a send the BROWSER submitted (no script ran), which the dialog above cannot serve.
type StepUpView ¶
type StepUpView struct {
// ConfirmPath is the same-origin route that takes the password again.
ConfirmPath string
// PasskeyPath is the same-origin route PREFIX of the passkey confirm
// (<prefix>/options, <prefix>/verify); "" when this server has no passkeys
// (password mode, or GoTrue's passkeys off), and the dialog is then
// password-only. Whether THIS account has a passkey is asked when the dialog
// opens — never on page load, which would spend a GoTrue call on every view.
PasskeyPath string
// FreshFor is how many milliseconds the current sign-in stays fresh, as
// the SERVER measured it when it rendered the page (0 = not fresh). A
// duration rather than an instant, so the browser's clock does not matter.
FreshFor int64
// Window is the freshness window as a person reads it ("12 hours") —
// stepup.WindowText, passed in so this package states no window of its own.
Window string
// Why, when set, is the dialog's sentence about the gate in place of
// StepUpWhy's (which names typing into a session): a page gating something
// else says what. It should name Window too.
Why string
}
StepUpView is what a page needs to ask "Confirm it's you" before a gated action.
type SubagentTailView ¶
type SubagentTailView struct {
Tail mirror.SubagentTail
// Note replaces the steps when they could not be read: why.
Note string
}
SubagentTailView is one opened card's steps (MirrorSubagentPath).
type Switcher ¶
type Switcher struct {
Recent, Waiting, Pins, All []SwitcherItem
// contains filtered or unexported fields
}
Switcher is the bar's content, resolved on the server: one list per view.
func NewSwitcher ¶
func NewSwitcher(list []AgentCardView, mirrors []MirrorCardView, refs []RecentRef, cur SwitcherCurrent) *Switcher
NewSwitcher resolves the bar against the entries (list, mirrors — internal/api builds them as it builds the sidebar's) and the viewer's recently opened refs (newest first).
type SwitcherCurrent ¶
type SwitcherCurrent struct {
AgentID int64
Mirror MirrorRef
// Back is the page itself, where the bar's pin toggle sends the browser
// back to after a post without script: a Terminal view names its own
// address, so a pin there does not land on the session's other view. ""
// is the session's own page (its sidebar row's link, newSwitcherPin).
Back string
}
SwitcherCurrent names the page's own session: an agent by id, or a mirrored window by its address (AgentID 0). A window addressed by its session alone (Window "") is the current one whichever of that session's windows an entry names.
type SwitcherItem ¶
type SwitcherItem struct {
Href, Label string
// Kind is "agent" or "mirror".
Kind string
// Current: the page's own session (drawn, not linked).
Current bool
// Waiting: the entry waits on the viewer (listEntry.waiting).
Waiting bool
// Host and HostIcon are the entry's host and its icon key — its sidebar row's:
// the cluster for an agent, the window's host's otherwise. HostNamed: the
// label already spells the host (labelNamesHost), so the icon is
// decorative.
Host, HostIcon string
HostNamed bool
// Code and Title are what the search finds the entry by (palette.go's paletteBox):
// Code its tmux codename ("mango:2") for a window — its "<session>:<index>"
// title when the host named none — or its name for an agent; Title what it
// is called beyond that (its display name, its focus), "" for nothing more.
Code, Title string
// Words are what the search finds the entry by AFTER its codename and
// title, as plain words: its repository, its kind and — a window's — its
// raw tmux session name; "" for none. Space-separated, lower-cased.
Words string
}
SwitcherItem is one entry of a view.
type Tab ¶
type Tab struct {
// ID is the tab's name within its tablist: what is stored, and what the
// elements' ids end in. Plain [a-z0-9-].
ID string
Label string
Panel g.Node
}
Tab is one tab and its panel.
type TabSet ¶
TabSet is a tablist and its panels, drawn apart so the list can sit in a header beside other controls. They are tied by ids (aria-controls / aria-labelledby), not by nesting.
func Tabs ¶
Tabs is a tablist over tabs' panels, the first selected. id names the instance (element ids are id+"-tab-"+Tab.ID and id+"-panel-"+Tab.ID); key is what the choice is stored under ("" = not stored); label is the tablist's accessible name. Each panel is the scroll container of its own content.
func TabsSelected ¶
TabsSelected is Tabs with the tab whose ID is selected drawn selected — the first when selected names none of them. It is how a page whose tab is in its URL (the Asks page's ?tab=) draws that tab without a script: a stored choice (key) still wins on load, so such a page passes key "".
type TaskCardView ¶
type TaskCardView struct {
Note notes.Note
Agent *AgentBrief
// Detail switches the card from its BOARD shape (a compact summary whose
// title is a stretched link to /tasks/{id}) to its DETAIL shape (the full
// markdown body, attachments, session thread, comments and the comment form,
// with no navigation link because you are already on that page). It is the
// ONE predicate the two shapes differ on — see internal/api's renderNoteCard,
// which derives it from htmx's HX-Current-URL so every existing mutation
// route (status PATCH, comment POST/DELETE, tag add/remove, edit) re-renders
// the card in the shape of the document that asked, without duplicating a
// single route. It is deliberately NOT read from a header the page's markup
// stamps: internal/api/view.go records why that leaked onto the board.
//
// In detail shape the title is the document's ONE <h1>; on the board it is an
// <h3> inside the list.
Detail bool
// Dispatch is whether this server can dispatch an agent at all
// (Features.Dispatch, from the same server predicate). False draws no
// Dispatch button on an agent-less card: with no agent runtime the
// sheet's submit can only answer 503.
//
// ⚠ THE ZERO VALUE DRAWS LESS, ON PURPOSE — the same polarity as Features.
// A card builder that forgets to set it hides a button that would have
// worked, which is visible and safe; the opposite default is the shipped
// defect this field exists to close (a "Dispatch" over a 503 on every card
// of a docker compose install).
Dispatch bool
}
TaskCardView carries one task plus its (optional) most-recent linked agent, so the card can reflect the dispatch state (status chip + Open chat) instead of a bare Dispatch button. Agent is nil when the task has no linked agent.
type TaskDispatchView ¶
type TaskDispatchView struct {
NoteID int64
Label string // the task's first line / directory (header subtitle)
Model string // resolved OpenRouter slug ("" = cluster default)
Repo string // resolved repo full name ("" = none / not inferred)
RepoBranch string // resolved branch ("" = repo default, resolved server-side)
// Kinds is the deployment's agent kinds; more than one renders the picker.
Kinds KindChoices
}
TaskDispatchView is the resolved dispatch config for a Task-scoped dispatch confirm (the from-card path). Every field is pre-resolved server-side so the modal is a pre-filled confirm: Model/Repo/RepoBranch are the effective values (empty = cluster default / none / repo default).
type TaskModalComment ¶
type TaskModalComment struct {
Author string
Body string // markdown; always empty when Retracted
When string // preformatted timestamp label
// Retracted renders the tombstone instead of Body. This page carries no
// retraction CONTROL (retracting is done from the task card) and that
// asymmetry is deliberate — but it must never render a retracted comment's
// BODY, so the flag is carried here rather than assumed away.
Retracted bool
}
TaskModalComment is one comment in the task-detail modal, oldest-first.
type TaskModalView ¶
type TaskModalView struct {
ID int64
Status string
Body string // markdown
Repo string
Model string
Comments []TaskModalComment
}
TaskModalView is the data the task-detail modal renders (opened from the chat header title). It is a read-only view of the agent's linked task.
type TasksView ¶
type TasksView struct {
Cards []TaskCardView
Vocabulary []notes.TagCount
ActiveTags []string
// Projects is the `project:` vocabulary, rendered as its OWN filter row above
// the general tag chips so a project is not buried among descriptive tags.
Projects []notes.ProjectCount
// ActiveStatus is the selected task STATUS (one of taskstatus.All()), or ""
// for the All chip.
//
// ⚠ IT USED TO BE A "LANE" — a separate, coarser vocabulary in which
// in_progress and ready_for_review shared one bucket. That layer is deleted
// (internal/taskstatus/label.go); the chip's value is the status itself now,
// which is also what travels in ?status= and into the SQL predicate.
ActiveStatus string
// Limit is the cap the server actually applied (0 = unlimited), and Total is
// how many tasks matched BEFORE that cap. `len(Cards) < Total` is the exact
// condition for rendering the show-more control; both come from the same
// query, so they cannot disagree across a concurrent write.
Limit int
Total int
// NextLimit is the limit the show-more control requests, or 0 when there is no
// larger page to ask for (the list is already at maxTaskLimit — see
// nextTaskLimit in internal/api/tags.go). The SERVER computes it rather than
// the browser adding a page size because the server is the only side that
// knows Total and the only side that knows its own clamp.
//
// It lands in #tasks-list's hx-get URL, which — via tagScript's
// htmx:configRequest listener — is what an SSE-triggered refetch then asks
// for. This comment used to call the URL "the one place a value survives
// #tasks-list's SSE-triggered refetch"; that was false until the listener
// existed, and the tag filter had been silently resetting on the same channel
// for as long as it had shipped.
NextLimit int
}
TasksView is everything the /ui/tasks partial renders: the task cards, the tag vocabulary behind the filter chip row, and the ACTIVE filters. Every active filter is server-side state: the server reads it off the REQUEST URL and renders the chips from what it read, so the chips can never disagree with the list beside them.
🔴 THAT IS A CLAIM ABOUT CONSISTENCY, NOT ABOUT SURVIVAL. It used to read "so an SSE-driven list refresh can never silently drop it", which was false: server-rendered state is dropped by any refetch whose URL omits it, and until tagScript's htmx:configRequest listener landed that was EVERY trigger-driven refetch (htmx captures #tasks-list's verb path at process time, so writing hx-get moved the attribute and not the request). What preserves a filter across a refresh is that listener plus the hx-get URL, both in internal/ui/components.go — nothing in this struct.
Source Files
¶
- agent_actions.go
- agent_href.go
- agents.go
- agents_detail.go
- attach.go
- attention.go
- bubble_clamp.go
- cards_attention.go
- cc_queued.go
- chat_index.go
- chief_panel.go
- chief_sessions.go
- components.go
- composer_draft.go
- composer_fit.go
- composer_menu.go
- connectors.go
- dictate.go
- faro.go
- features.go
- floating_menu.go
- focus.go
- focus_history.go
- host_icons.go
- host_prefs.go
- identity_color.go
- idle_section.go
- kinds.go
- list_order.go
- list_signals.go
- live.go
- livecopy.go
- markdown.go
- merge.go
- mirror.go
- mirror_ask.go
- mirror_compose.go
- mirror_snap.go
- mirror_view.go
- nav_agents.go
- nav_layout.go
- notes.go
- notifications.go
- onboarding.go
- palette.go
- pins.go
- pwa.go
- rank_script.go
- recents.go
- render.go
- render_phase2.go
- restore.go
- send_again.go
- send_queue.go
- static_script.go
- stepup_confirm.go
- subagent_cards.go
- suggest_row.go
- swap_inline.go
- switcher.go
- switcher_pin.go
- tabs.go
- tags.go
- task_detail.go
- task_not_found.go
- tasks_list_ssr.go
- terminal.go
- theme.go
- tool_context.go
- tool_groups.go
- view_swap.go
- work_chip.go