/**
 * Human-readable labels and tooltips for agent and taskboard log fields (stored server-side).
 * Raw strings are written server-side (e.g. AgentOrchestrator, ProjectPlannerManager, AgentDialogFunction).
 */
function wordsFromSlug(s) {
    return s
        .split(/[-_]/)
        .filter(Boolean)
        .map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
        .join(" ");
}
const EVENT_TYPE_LABELS = {
    run: "Agent run",
    "taskboard-orchestration": "Taskboard orchestration",
};
const STAGE_LABELS = {
    requested: "Run requested",
    skipped: "Skipped (already active)",
    "startup-race": "Startup race",
    "startup-skipped": "Startup skipped",
    started: "Started",
    executing: "Executing",
    completed: "Completed",
    cancelled: "Cancelled",
    failed: "Failed",
    "cancellation-requested": "Cancellation requested",
    shown: "Dialog shown",
    answered: "Dialog answered",
    "timed-out": "Timed out",
    error: "Error",
    "planner-reused": "Planner reused",
    "planner-created": "Planner created",
    "planning-skipped": "Planning skipped",
    "planning-kickoff-queued": "Planning kickoff queued",
    "planning-run-triggered": "Planning run triggered",
    "planner-trigger-subscription": "Planner trigger subscription",
};
const STATUS_LABELS = {
    queued: "Queued",
    running: "Running",
    completed: "Completed",
    failed: "Failed",
    cancelled: "Cancelled",
    waiting: "Waiting for input",
    error: "Error",
};
/** What each event type means (Type column). */
const EVENT_TYPE_TOOLTIPS = {
    run: "Category: agent run lifecycle. These rows come from the agent orchestrator when an agent execution is requested, started, runs tools/LLM, completes, fails, or is cancelled.",
    "taskboard-orchestration": "Category: taskboard orchestration. These rows come from project planner / taskboard flows (planner agents, planning kickoff, triggers).",
};
/** What each stage means (Step column). */
const STAGE_TOOLTIPS = {
    requested: "The orchestrator accepted a request to run this agent; a new execution was queued or will start. This is the earliest step after a run is asked for.",
    skipped: "No new run was started because an execution for this agent was already running or queued; the duplicate request was ignored.",
    "startup-race": "Concurrent startup paths raced; this row records that situation (only one run should proceed).",
    "startup-skipped": "Startup was skipped (another path already took ownership or conditions were not met).",
    started: "The runner has begun executing this agent run (work has started after queueing).",
    executing: "The agent run is actively executing (model/tool loop in progress).",
    completed: "The agent run finished successfully.",
    cancelled: "The agent run was cancelled (stopped before or during execution).",
    failed: "The agent run ended with an error.",
    "cancellation-requested": "A request to cancel this run was recorded (shutdown may still be in progress).",
    shown: "A dialog was shown to the user and the agent is waiting for input.",
    answered: "The user answered the dialog (or a result was returned).",
    "timed-out": "The dialog or wait timed out before a response was received.",
    error: "An error was reported for this step (see summary or error field).",
    "planner-reused": "An existing planner agent was reused instead of creating a new one.",
    "planner-created": "A new planner agent was created for this project.",
    "planning-skipped": "Planning was skipped (for example conditions were not met or already done).",
    "planning-kickoff-queued": "Planning kickoff was queued to run asynchronously.",
    "planning-run-triggered": "A planning run was triggered (orchestration continued).",
    "planner-trigger-subscription": "Planner trigger subscription was registered or updated.",
};
/** What each status means (State column). */
const STATUS_TOOLTIPS = {
    queued: "Execution status: queued — the run is waiting to start; the orchestrator has not begun the main loop yet.",
    running: "Execution status: running — the agent run is active.",
    completed: "Execution status: completed — finished successfully.",
    failed: "Execution status: failed — ended with an error.",
    cancelled: "Execution status: cancelled — stopped by user or system.",
    waiting: "Execution status: waiting — typically waiting for user input (e.g. dialog).",
    error: "Execution status: error — an error state was recorded for this step.",
};
function appendStoredValue(description, raw) {
    return `${description} Stored value: "${raw}".`;
}
export function formatPersistentLogEventType(raw) {
    if (!raw?.trim())
        return "—";
    const key = raw.trim();
    return EVENT_TYPE_LABELS[key] ?? wordsFromSlug(key);
}
export function formatPersistentLogStage(raw) {
    if (!raw?.trim())
        return "—";
    const key = raw.trim();
    return STAGE_LABELS[key] ?? wordsFromSlug(key);
}
export function formatPersistentLogStatus(raw) {
    if (!raw?.trim())
        return "—";
    const key = raw.trim();
    const lower = key.toLowerCase();
    return STATUS_LABELS[lower] ?? wordsFromSlug(key);
}
/** Full tooltip for the Type badge. */
export function persistentLogEventTypeTooltip(raw) {
    if (!raw?.trim()) {
        return "No event type was stored. This column groups log lines by kind of activity (agent run, taskboard orchestration, etc.).";
    }
    const key = raw.trim();
    const base = EVENT_TYPE_TOOLTIPS[key] ??
        `Server-defined event type. Label shown: "${formatPersistentLogEventType(key)}".`;
    return appendStoredValue(base, key);
}
/** Full tooltip for the Step badge. */
export function persistentLogStageTooltip(raw) {
    if (!raw?.trim()) {
        return "No step was stored. This column is the point in the flow for this category (for example requested, executing, completed).";
    }
    const key = raw.trim();
    const base = STAGE_TOOLTIPS[key] ??
        `Server-defined step in the flow. Label shown: "${formatPersistentLogStage(key)}".`;
    return appendStoredValue(base, key);
}
/** Full tooltip for the State badge. */
export function persistentLogStatusTooltip(raw) {
    if (!raw?.trim()) {
        return "No status was stored. This column is the execution or dialog state at the time of the log line.";
    }
    const key = raw.trim();
    const lower = key.toLowerCase();
    const base = STATUS_TOOLTIPS[lower] ??
        `Server-defined status. Label shown: "${formatPersistentLogStatus(key)}".`;
    return appendStoredValue(base, key);
}
/** Tooltip for the Source line (code origin). */
export function persistentLogSourceTooltip(source) {
    return `Where this log line was emitted in the server code (class or method). Use it to find the exact logging call. Value: ${source}`;
}
/** Tooltip for sequence number in the summary row. */
export function persistentLogSeqTooltip(seq) {
    return `Sequence number for ordering related log lines within a run or scope. Seq ${seq}.`;
}
/** Tooltip for duration in the summary row. */
export function persistentLogDurationTooltip(duration) {
    return `Approximate time spent on this step or operation, when the server recorded it. ${duration}`;
}
/** Tooltip for tool call id in the summary row. */
export function persistentLogToolCallTooltip(toolCallId) {
    return `Identifier linking this row to a specific tool invocation in the agent run. Tool call id: ${toolCallId}.`;
}
/** Tooltip for the log row timestamp. */
export function persistentLogCreatedAtTooltip(params) {
    if (params.hasValidDate && params.isoUtc) {
        return `When this log row was written. Shown in your locale: ${params.localDisplay}. UTC (ISO): ${params.isoUtc}.`;
    }
    return `Timestamp from the server (could not parse as a date): ${params.raw}`;
}
/** Tooltip for the shortened agent id shown in taskboard meta lines (`agent xxxx…`). */
export function persistentLogAgentIdSnippetTooltip(agentId) {
    return `Parhelia agent this log line belongs to. Short prefix: ${agentId.slice(0, 8)}…. Full agent id: ${agentId}.`;
}
/** Tooltip for user id / display name in meta lines. */
export function persistentLogUserIdTooltip(userId) {
    return `User name or account id associated with this log line when the server recorded it. Value: ${userId}.`;
}
/** Tooltip for a single context column fragment (Agent …, Project …, etc.). */
export function persistentLogContextPartTooltip(part) {
    if (part.startsWith("Agent ")) {
        return `Parhelia agent instance this log line belongs to (short id prefix). ${part}`;
    }
    if (part.startsWith("Project ")) {
        return `Taskboard project this log line is associated with (short id prefix). ${part}`;
    }
    if (part.startsWith("Task ")) {
        return `Taskboard task this log line is associated with (short id prefix). ${part}`;
    }
    if (part.startsWith("Run ")) {
        return `Agent execution run this log line belongs to (short id prefix). ${part}`;
    }
    return `User name or id associated with this log line, when recorded. ${part}`;
}
/** Explanatory text for the agent and taskboard log table (settings page). */
export const PERSISTENT_LOG_FIELD_HINT = "Type = category of activity. Step = point in that flow. State = execution or dialog status. Hover any badge for a full explanation. Hover Source, Seq, duration, Tool, and context for details.";
/** One-line legend for compact UIs (e.g. taskboard popover). */
export const PERSISTENT_LOG_FIELD_HINT_COMPACT = "Hover Type, Step, and State badges for what each value means. Hover other labels for details.";
//# sourceMappingURL=persistentLogLabels.js.map