Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | import type { ZoneId } from "./zones";
export type AgentKind = "main" | "subagent";
// Derived so adding a zone in `zones.ts` automatically yields the matching
// `work-<zone>` animation. Prevents typos from slipping past a stringly-typed cast.
export type WorkAnimation = `work-${ZoneId}`;
export type AnimationState = "idle" | "walk" | WorkAnimation | "ghost";
export interface AgentEvent {
sessionId: string;
agentId: string;
parentAgentId?: string;
kind: AgentKind;
timestamp: number;
type:
| "session-start"
| "session-end"
| "subagent-start"
| "subagent-end"
| "user-message"
| "assistant-message"
| "pre-tool-use"
| "post-tool-use"
| "session-title";
toolName?: string;
toolArgsSummary?: string;
resultSummary?: string;
messageExcerpt?: string;
sessionTitle?: string;
rawLine?: string;
}
export interface AgentAction {
timestamp: number;
zone: ZoneId;
summary: string; // ready-to-render label (pre-truncated upstream)
}
export interface AgentState {
id: string;
kind: AgentKind;
parentId?: string;
currentZone: ZoneId;
targetZone: ZoneId;
animation: AnimationState;
recentActions: AgentAction[]; // ring buffer, max 5
ghostExpiresAt?: number; // epoch ms
/**
* Last time we observed any event for this agent (session-start,
* subagent-start, pre/post-tool-use, user-message, assistant-message, or a
* session-end affecting the mayor). Drives the idle-to-ghost transition
* inside `SessionStore.expireGhosts`.
*/
lastSeenAt?: number;
skinColor: string; // hex, derived from hash(id)
/**
* True when the agent has finished its last turn and is waiting for input
* (from the user for the mayor, from the orchestrator for a subagent).
* Drives a 3D yellow "!" indicator in the renderer. Cleared the moment any
* new activity (tool-use, user-message, assistant-message) arrives.
* Optional and defaults to undefined so existing serialized state stays
* backwards compatible.
*/
waitingForInput?: boolean;
}
export interface SessionState {
sessionId: string;
projectPath: string;
startedAt: number;
lastActivityAt: number;
status: "active" | "idle" | "ended";
title?: string;
agents: Map<string, AgentState>; // main-process only; serialized to AgentState[] across IPC
timeline: TimelineLine[]; // ring buffer, max 500
}
export interface TimelineLine {
id: string; // event hash, stable across re-renders
timestamp: number;
agentId: string;
agentKind: AgentKind;
kind: "user" | "assistant" | "tool-call" | "tool-result";
text: string; // condensed, already truncated for display
}
export interface Classification {
zone: ZoneId;
animation: AnimationState;
tooltip: string;
timelineText: string;
}
|