sessionname

package
v0.201.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sessionname is THE RULE for what a session is called: one stable, human name for a dispatched agent or a mirrored Claude Code / opencode session, the same on every surface that names it — its sidebar row and switcher pill, its page's header and <title>, the terminal page, a push, an attention item, a dispatch card, and every chief tool that lists or names sessions (docs/focus.md#a-sessions-name).

🔴 ONE RULE, ONE PLACE. Resolve is the only place the precedence below is spelled; Agent and Mirror are its only two entry points, and every surface reaches them through internal/api's two adapters (names.go there), which a ledger test pins (TestTheSessionNameCallerLedger). A surface that reads an agent's DisplayName or a window's Label to NAME it is the bug this package exists to prevent: each such copy drifts from the others.

The precedence, first non-empty wins:

  1. MANUAL — the name the person gave the session: an agent's display name they set (agents.NameManual), a mirrored session's name_manual. Never overwritten by anything automatic.
  2. SYSTEM — a name muster pinned for a role (the chief, an officer: agents.NameSystem). It is what the rest of muster finds the role by, so the auto name never replaces it.
  3. DISPATCH — the name an agent was dispatched with from a task ("#42 · Fix the login bug"). It IS the agent's stable name (operator decision, #504 round 0 Q1): it never changes on its own — the auto name never replaces it — and only a manual rename does.
  4. AUTO — the name frozen from the session's first good focus title (internal/focus names.go). Frozen once, never moved by a later title. A task-dispatched agent's auto name is still frozen and stored; it is simply never shown while the dispatch name ranks above it.
  5. FALLBACK — the session's technical id: an agent's slug, a mirrored window's host label or tmux address. Only a session with nothing above is called by it.

Every level but FALLBACK is plained with the title rule (textplain.Title), and one that plains to nothing falls through to the next. The fallback is an identifier the operator types and is never plained (ui.plainOr's rule).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Name

type Name struct {
	Text      string
	Source    Source
	Technical string
}

Name is a session's resolved name: Text, what every surface calls it, and Source, where it came from. Technical is the session's technical id, for the places that show one — the detail page, a tooltip, a chief tool that needs an address: an agent's slug; a mirrored window's "tmux <session>:<index> @ <host>" (mirror.Where), led by its host label when it has one.

func Agent

func Agent(a agents.Agent, stored focus.Name) Name

Agent is dispatched agent a's name, given its stored name halves (its agent_focus row's; the zero value for none).

a.DisplayName counts as MANUAL or SYSTEM by its DisplayNameSource (migration 0090), as DISPATCH when it was derived from a task, and is otherwise the slug copied — the fallback, as a.Name is.

func Mirror

func Mirror(e mirror.SessionView, stored focus.Name) Name

Mirror is mirrored entry e's name, given its conversation's stored name halves (the agent_focus row keyed by e.SessionKey(); the zero value when it has none, or its host reports no conversation).

🔴 THE HOST'S LABEL IS A FALLBACK, NOT A NAME. A window's Label is the codename its host's operator configured for the tmux SESSION (muster-mirror -labels-file) plus the window's index — "mango:1" — a technical address like the tmux one it stands for, shared by every conversation that window ever holds. So it ranks with the tmux address, below the conversation's own auto name, and is shown only while the conversation has no human name (decision recorded in docs/focus.md).

The fallback is e.DisplayTitle(): the title WITH the list's qualifier when it needs one — how two "mango:1" windows on two hosts are told apart. A human name carries none (its tooltip has the place). The ui draws a fallback name from the view's own fields (Label, Title, Qualifier), never from this text, so it is not qualified twice.

func Resolve

func Resolve(p Parts) Name

Resolve is the precedence (the package comment): the first level whose text plains to something, else the fallback as is.

func (Name) Human

func (n Name) Human() bool

Human reports whether n is a human name rather than a technical id: any source but SourceFallback.

type Parts

type Parts struct {
	Manual, System, Auto, Dispatch string
	// Fallback is the technical name the session is called by when it has no
	// other: never plained.
	Fallback string
	// Technical is the session's technical id (Name.Technical).
	Technical string
}

Parts are a session's candidate names, one per level ("" = none at that level), and its technical id.

type Source

type Source string

Source is which level of the precedence a Name came from.

const (
	SourceManual   Source = "manual"
	SourceSystem   Source = "system"
	SourceAuto     Source = "auto"
	SourceDispatch Source = "dispatch"
	SourceFallback Source = "fallback"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL