/** * Durable AgentTeams session events and their emitter. * * Every team-state mutation appends one event to the captain's Session, so * the web client's Conversation Node mechanism can fold the tree view from * the session log deterministically (same mechanism as `tool-workflow`'s * `tool-workflow/*` record events). Events append to the captain's session * even when a member agent performed the mutation, so the captain's * conversation stream stays the single authoritative monitor surface. * * Types and the `SessionEventMap` merge live in `event-types.ts` (zero * imports) so the browser program can load them without host augmentations. * @module dsh-agent-teams/events */ import type { Context } from '@deepseek-ai/cordis'; import type { Session } from '@deepseek-ai/dsh-session'; import type { SessionEventMap } from '@deepseek-ai/dsh-session/types'; import type { AgentTeamsEventType } from './event-types.ts'; /** * Append one AgentTeams event to a Session, containing failures (a broken * durable record must never break team tool execution). * @param ctx - the plugin context (for logging). * @param session - the session to record into (the captain's, normally). * @param type - the event type. * @param data - the event payload. */ export declare function appendTeamEvent(ctx: Context, session: Session, type: AgentTeamsEventType, data: SessionEventMap[AgentTeamsEventType]): void; /** * Resolve the captain's live Session for event recording. The captain agent * may be offline (its team outlives the session), in which case the caller's * own session is used as the fallback record target. * @param ctx - the plugin context (injects `agents`). * @param captainSessionId - the captain's durable session id. * @param fallback - the calling agent's session, used when the captain is not live. * @returns the session to record into. */ export declare function captainSessionOf(ctx: Context, captainSessionId: string, fallback: Session): Session;