/** * Team activity snapshot assembly for the activity panel. * * Server-side assembly mirrors the Claude Code desktop teamWatcher: read the * durable team files (the truth source) and enrich with live subagent * activity, so the panel always reflects the on-disk state even when a model * skipped a tool "ritual" (e.g. not calling update_task on completion). * @module dsh-agent-teams/snapshot */ import type { Context } from '@deepseek-ai/cordis'; import type { MemberStatus, TeamState } from './types.ts'; /** Visual task state for the activity panel. */ export type VisualTaskState = 'blocked' | 'open' | 'running' | 'completed' | 'failed' | 'cancelled'; /** One member row of the activity snapshot. */ export interface TeamActivityMember { readonly id: string; readonly name: string; readonly role: string; readonly provider: string; readonly model: string; readonly reasoningEffort: string; readonly executionPrompt: string; readonly status: MemberStatus; readonly activity: 'working' | 'idle' | 'unknown'; readonly progress: number; readonly done: number; readonly total: number; readonly currentTask: string; readonly unread: number; } /** One task row of the activity snapshot. */ export interface TeamActivityTask { readonly id: string; readonly subject: string; readonly description: string; readonly status: string; readonly state: VisualTaskState; readonly assignee: string; readonly model: string; readonly dependencies: readonly string[]; readonly depth: number; readonly kind?: string; readonly round?: number; readonly verdict?: string; } /** One captain-inbox preview row. */ export interface TeamActivityMessage { readonly from: string; readonly content: string; } /** The full panel payload for one team. */ export interface TeamActivitySnapshot { readonly workspace: string; readonly teamId: string; readonly name: string; readonly description?: string; readonly captainSessionId: string; readonly phase: 'staged' | 'running'; readonly planReviewState?: 'awaiting_review' | 'awaiting_feedback'; readonly halted?: boolean; readonly members: readonly TeamActivityMember[]; readonly tasks: readonly TeamActivityTask[]; readonly messageCount: number; readonly captainInbox: readonly TeamActivityMessage[]; } /** Snapshot projection switches for live and archived teams. */ export interface TeamSnapshotOptions { /** Historic review must retain members that were marked removed at shutdown. */ readonly includeRemoved?: boolean; /** Archived teams have no meaningful live activity after their sessions stop. */ readonly historic?: boolean; } /** Compact `provider/model` route for the activity panel, or just the model. */ export declare function memberModelRoute(member: { provider?: string; model?: string; } | undefined): string; /** * Assemble one team snapshot from its durable files plus live activity. * @param ctx - the plugin context (injects `subagents`, used for activity). * @param stateRoot - resolved absolute state root of the owning workspace. * @param workspace - display name of the owning workspace. * @param state - the durable team record. * @returns the panel snapshot. */ export declare function assembleTeamSnapshot(ctx: Context, stateRoot: string, workspace: string, state: TeamState, options?: TeamSnapshotOptions): Promise; /** * Collect every team under the given workspace state roots. * @param ctx - the plugin context. * @param roots - `{ workspace, stateRoot }` pairs (resolved absolute roots). * @returns the snapshots in stable order (workspace, then team id). */ export declare function collectTeamsActivity(ctx: Context, roots: readonly { workspace: string; stateRoot: string; }[]): Promise; /** * Collect every archived team under the given workspace state roots (the * `archive/` subdirectory of each state root). Used by the historic panel * path to restore full team detail after deletion. * @param ctx - the plugin context. * @param roots - `{ workspace, stateRoot }` pairs. * @returns the archived snapshots in stable order. */ export declare function collectArchivedTeamsActivity(ctx: Context, roots: readonly { workspace: string; stateRoot: string; }[]): Promise;