/**
 * Session data model.
 *
 * Normalized types that unify the different session storage formats used by
 * Claude (JSONL), Codex (JSONL events), Gemini (single JSON), and OpenCode.
 * Everything in the session pipeline -- discovery, parsing, rendering --
 * speaks these types.
 */
/** All agents with session discovery support, in display order. */
export const SESSION_AGENTS = ['claude', 'codex', 'gemini', 'antigravity', 'opencode', 'openclaw', 'rush', 'hermes', 'grok', 'kimi', 'droid', 'cursor', 'muse'];
/**
 * True when `agent` stores session data `agents sessions` can discover (a member
 * of {@link SESSION_AGENTS}). The single predicate every session-index writer
 * gates on, so "is this a trackable agent?" is decided in exactly one place.
 */
/**
 * The tmux session name the CLI mints for an agent run: `ag-<agent>-<shortid>`.
 *
 * ONE definition. This shape was independently re-written as a regex literal in
 * five places (focus's selector test, sessions-resume's direct-selector test,
 * active's name parsers, actor-sidecar, and the deeplink parser); they drifted —
 * focus accepted a 6+ hex suffix while the others required exactly 8 — which is
 * how the same alias could be an "identity" to one code path and a keyword query
 * to the next.
 */
export const AG_TMUX_NAME_RE = /^ag-([a-z][a-z0-9-]*?)-([0-9a-f]{8})$/i;
/** Whether `name` is an `ag-<agent>-<shortid>` tmux session name. */
export function isAgentTmuxAlias(name) {
    return AG_TMUX_NAME_RE.test(name);
}
export function isSessionTrackedAgent(agent) {
    return SESSION_AGENTS.includes(agent);
}
/**
 * The name `agents sessions` shows for a run. A custom harness launched via a
 * profile (`agents run deepseek`) keeps its host agent for transcript discovery
 * and parsing (`claude`) and stamps the profile name on `harness`. Display
 * prefers that stamp so a deepseek run is not listed as claude (PHNX-2935).
 */
export function sessionDisplayAgent(session) {
    const harness = session.harness?.trim();
    return harness || session.agent;
}
