/** GroupSession:一次 Group 群聊上下文的运行时实现。 */ import type { Agent } from "../agent/Agent.js"; import type { GroupMessage } from "../types/group/Group.js"; import type { GroupEventSubscriber, GroupEventUnsubscribe, GroupPromptInput, GroupPromptResult, GroupSessionContract } from "../types/group/GroupSession.js"; import type { DispatchStrategy } from "../types/group/DispatchStrategy.js"; import type { WorkspaceBase } from "@downcity/workspace"; import type { GroupSessionDataStore } from "../types/group/GroupSessionStore.js"; import type { RespondSessionInteractionInput } from "../types/session/SessionInteraction.js"; /** GroupSession 的创建依赖。 */ export interface GroupSessionOptions { /** 当前群聊上下文的稳定标识。 */ readonly id: string; /** 所属 Group 的稳定标识。 */ readonly group_id: string; /** Group 展示名称。 */ readonly group_name: string; /** Group 协作说明。 */ readonly instruction?: string; /** Group 成员。 */ readonly members: readonly Agent[]; /** Group 消息调度策略。 */ readonly dispatch_strategy: DispatchStrategy; /** Group 为成员执行提供的共享 Workspace。 */ readonly workspace?: WorkspaceBase; } /** Group 的一个独立群聊上下文。 */ export declare class GroupSession implements GroupSessionContract { readonly id: string; readonly group_id: string; readonly workspace_id?: string; private readonly group_name; private readonly instruction?; private readonly members; private readonly dispatch_session; private readonly workspace?; private readonly messages_by_id; private readonly subscribers; private readonly member_sessions; private readonly member_session_ids; private readonly member_session_promises; private readonly member_session_unsubscribes; private readonly interaction_sessions; private readonly member_running_counts; private readonly pending_deliveries; private readonly active_member_deliveries; private readonly group_turns_by_id; private readonly consumed_auto_message_ids; private readonly auto_dispatch_path_keys; private auto_frontier_messages; private store?; private auto_dispatch_promise; private auto_dispatch_requested; private stop_requested; private disposed; constructor(options: GroupSessionOptions); /** 从持久化 Store 初始化当前 GroupSession 的消息历史。 */ initialize(store: GroupSessionDataStore): Promise; /** 立即追加用户消息,并异步触发本条消息的初始调度。 */ prompt(input: GroupPromptInput): Promise; /** 读取共享消息快照。 */ messages(): Promise; /** 订阅未来共享消息。 */ subscribe(subscriber: GroupEventSubscriber): GroupEventUnsubscribe; respond_interaction(input: RespondSessionInteractionInput): Promise; /** 读取成员运行态快照;成员是否回复由成员自身决定。 */ private member_statuses; /** 停止当前传播和成员执行。 */ stop(): Promise; /** 释放当前上下文及其成员 Session 引用。 */ dispose(): Promise; private run_user_dispatch; /** 登记一次用户调度运行;新建和恢复必须经过同一个生命周期入口。 */ private start_user_dispatch; /** GroupSession 唯一的自动调度循环,统一消费已完成成员产生的新消息。 */ private request_auto_dispatch; private run_auto_dispatch; private decide_dispatch; /** 执行当前响应图;节点依赖只影响投递顺序,不创建额外的调度循环。 */ private run_dispatch_plan; private execute_dispatch_node; /** 将消息提交给成员 Session,并返回已经接受的 Turn 句柄。 */ private prepare_member_delivery; /** 等待成员 Turn 完成,并把有效回复写回 Group。 */ private execute_member_delivery; private append_dispatch_failure; /** 把成员自身的投递或执行失败记录为共享事实,避免群聊静默。 */ private append_member_failure; /** 获取或创建一个成员专属的 AgentSession。 */ private ensure_member_session; /** 创建并登记一个成员专属的 AgentSession。 */ private create_member_session; private subscribe_member_session; private build_member_context; private get_member; /** 更新成员运行计数,并在可见状态发生变化时通知订阅者。 */ private set_member_running; private append_message; /** 持久化当前调度检查点;只记录可由消息事实安全恢复的状态。 */ private persist_dispatch_checkpoint; /** 发布 Group 阶段和成员运行态;所有状态与消息共用同一订阅流。 */ private publish_status; private publish_event; private assert_available; } //# sourceMappingURL=GroupSession.d.ts.map