/** * 语音识别音频帧。后端(socketio_handlers.py)两种都收: * 裸二进制,或带 request_id 的对象——一条连接上并发多个识别会话时, * 只有带 request_id 才能区分是哪一路的音频。 */ export type AsrAudioPayload = ArrayBuffer | Uint8Array | { pcm: ArrayBuffer | Uint8Array; request_id?: string; }; export declare namespace ChatSendPayloadSchema { type SessionId = string; type ClientRequestId = (string | null); type Mode = (("planning" | "executing") | null); type AskuserAnswer = ({ [k: string]: unknown; } | null); type Model = (string | null); type ThinkingOverride = (boolean | null); type ReasoningLevel = (("off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max") | null); type Headless = boolean; type OutputSchema = ({ [k: string]: unknown; } | null); type FromStep = (number | string | null); type Quotes = (unknown[] | null); type DeprecateEntryIds = (string[] | null); type ReplayDecision = (string | null); type RuntimeEnv = ({ [k: string]: string; } | null); type AppContext = ({ [k: string]: unknown; } | null); type CompactionRatio = (number | null); type NativeApprovalPolicy = (("unlessTrusted" | "never") | null); type KbIds = (number[] | null); type QueueWhenRunning = boolean; interface ChatSendPayload { session_id: SessionId; message: Message; client_request_id?: ClientRequestId; mode?: Mode; askuser_answer?: AskuserAnswer; model?: Model; thinking_override?: ThinkingOverride; reasoning_level?: ReasoningLevel; headless?: Headless; output_schema?: OutputSchema; whatif?: (WhatIfPayload | null); replay_decision?: ReplayDecision; runtime_env?: RuntimeEnv; app_context?: AppContext; compaction_ratio?: CompactionRatio; native_approval_policy?: NativeApprovalPolicy; kb_ids?: KbIds; queue_when_running?: QueueWhenRunning; [k: string]: unknown; } interface Message { [k: string]: unknown; } interface WhatIfPayload { from_step?: FromStep; quotes?: Quotes; deprecate_entry_ids?: DeprecateEntryIds; [k: string]: unknown; } } export type ChatSendPayload = ChatSendPayloadSchema.ChatSendPayload; export declare namespace ChatStopPayloadSchema { type SessionId = string; interface ChatStopPayload { session_id: SessionId; [k: string]: unknown; } } export type ChatStopPayload = ChatStopPayloadSchema.ChatStopPayload; export declare namespace ChatAppendPayloadSchema { type SessionId = string; type Message = string; type ClientRequestId = (string | null); interface ChatAppendPayload { session_id: SessionId; message: Message; client_request_id?: ClientRequestId; [k: string]: unknown; } } export type ChatAppendPayload = ChatAppendPayloadSchema.ChatAppendPayload; export declare namespace ChatCompactPayloadSchema { type SessionId = string; interface ChatCompactPayload { session_id: SessionId; [k: string]: unknown; } } export type ChatCompactPayload = ChatCompactPayloadSchema.ChatCompactPayload; export declare namespace ChatQueueListPayloadSchema { type SessionId = string; interface ChatQueueListPayload { session_id: SessionId; [k: string]: unknown; } } export type ChatQueueListPayload = ChatQueueListPayloadSchema.ChatQueueListPayload; export declare namespace ChatQueueUpdatePayloadSchema { type SessionId = string; type ItemId = string; type ExpectedVersion = number; type Message = string; interface ChatQueueUpdatePayload { session_id: SessionId; item_id: ItemId; expected_version: ExpectedVersion; message: Message; [k: string]: unknown; } } export type ChatQueueUpdatePayload = ChatQueueUpdatePayloadSchema.ChatQueueUpdatePayload; export declare namespace ChatQueueReorderPayloadSchema { type SessionId = string; type ExpectedRevision = number; type OrderedIds = string[]; interface ChatQueueReorderPayload { session_id: SessionId; expected_revision: ExpectedRevision; ordered_ids: OrderedIds; [k: string]: unknown; } } export type ChatQueueReorderPayload = ChatQueueReorderPayloadSchema.ChatQueueReorderPayload; export declare namespace ChatQueueCancelPayloadSchema { type SessionId = string; type ItemId = string; type ExpectedVersion = (number | null); interface ChatQueueCancelPayload { session_id: SessionId; item_id: ItemId; expected_version?: ExpectedVersion; [k: string]: unknown; } } export type ChatQueueCancelPayload = ChatQueueCancelPayloadSchema.ChatQueueCancelPayload; export declare namespace ChatQueueDeliverPayloadSchema { type SessionId = string; type ItemId = string; type ExpectedVersion = number; interface ChatQueueDeliverPayload { session_id: SessionId; item_id: ItemId; expected_version: ExpectedVersion; [k: string]: unknown; } } export type ChatQueueDeliverPayload = ChatQueueDeliverPayloadSchema.ChatQueueDeliverPayload; export declare namespace ChatQueueResumePayloadSchema { type SessionId = string; interface ChatQueueResumePayload { session_id: SessionId; [k: string]: unknown; } } export type ChatQueueResumePayload = ChatQueueResumePayloadSchema.ChatQueueResumePayload; export declare namespace SessionSubscribePayloadSchema { type SessionId = string; type Mode = string; type EventFormat = "raw"; type AfterSequence = number; type Resume = boolean; interface SessionSubscribePayload { session_id: SessionId; mode?: Mode; event_format?: EventFormat; after_sequence?: AfterSequence; resume?: Resume; [k: string]: unknown; } } export type SessionSubscribePayload = SessionSubscribePayloadSchema.SessionSubscribePayload; export declare namespace SessionSubscribeBatchPayloadSchema { /** * @minItems 1 * @maxItems 200 */ type Sessions = [SessionSubscribe, ...(SessionSubscribe)[]]; type SessionId = string; type Mode = string; type EventFormat = "raw"; type AfterSequence = number; type Resume = boolean; interface SessionSubscribeBatchPayload { sessions: Sessions; [k: string]: unknown; } interface SessionSubscribe { session_id: SessionId; mode?: Mode; event_format?: EventFormat; after_sequence?: AfterSequence; resume?: Resume; [k: string]: unknown; } } export type SessionSubscribeBatchPayload = SessionSubscribeBatchPayloadSchema.SessionSubscribeBatchPayload; export declare namespace SessionUnsubscribePayloadSchema { type SessionId = string; interface SessionUnsubscribePayload { session_id: SessionId; [k: string]: unknown; } } export type SessionUnsubscribePayload = SessionUnsubscribePayloadSchema.SessionUnsubscribePayload; export declare namespace AgentBoardProjectSubscribePayloadSchema { type ProjectId = number; interface AgentBoardProjectSubscribePayload { project_id: ProjectId; [k: string]: unknown; } } export type AgentBoardProjectSubscribePayload = AgentBoardProjectSubscribePayloadSchema.AgentBoardProjectSubscribePayload; export declare namespace AgentBoardProjectUnsubscribePayloadSchema { type ProjectId = number; interface AgentBoardProjectUnsubscribePayload { project_id: ProjectId; [k: string]: unknown; } } export type AgentBoardProjectUnsubscribePayload = AgentBoardProjectUnsubscribePayloadSchema.AgentBoardProjectUnsubscribePayload; export declare namespace ChatStartPayloadSchema { type SessionId = (string | null); type ChatRunId = (string | null); type StartedAt = (string | null); interface ChatStartPayload { session_id?: SessionId; chat_run_id?: ChatRunId; started_at?: StartedAt; [k: string]: unknown; } } export type ChatStartPayload = ChatStartPayloadSchema.ChatStartPayload; export declare namespace ChatEndPayloadSchema { type SessionId = (string | null); type Status = (string | null); type CancelledClientRequestIds = (string[] | null); type FinishReason = (string | null); type ChatRunId = (string | null); type StartedAt = (string | null); type DurationMs = (number | null); interface ChatEndPayload { session_id?: SessionId; status?: Status; cancelled_client_request_ids?: CancelledClientRequestIds; result?: unknown; finish_reason?: FinishReason; chat_run_id?: ChatRunId; started_at?: StartedAt; duration_ms?: DurationMs; [k: string]: unknown; } } export type ChatEndPayload = ChatEndPayloadSchema.ChatEndPayload; export declare namespace ChatQueueUpdatedPayloadSchema { type SessionId = string; type Revision = number; type Paused = boolean; type PauseReason = (string | null); type Id = string; type Content = string; type Position = number; type Version = number; type Status = string; type CreatedAt = string; type UpdatedAt = string; type TargetRunId = (string | null); type Error = (string | null); type Items = ChatQueueItem[]; interface ChatQueueUpdatedPayload { session_id: SessionId; revision: Revision; paused?: Paused; pause_reason?: PauseReason; items?: Items; [k: string]: unknown; } interface ChatQueueItem { id: Id; content: Content; position: Position; version: Version; status: Status; created_at: CreatedAt; updated_at: UpdatedAt; target_run_id?: TargetRunId; error?: Error; [k: string]: unknown; } } export type ChatQueueUpdatedPayload = ChatQueueUpdatedPayloadSchema.ChatQueueUpdatedPayload; export declare namespace SessionCreatedPayloadSchema { type SessionId = string; interface SessionCreatedPayload { session_id: SessionId; [k: string]: unknown; } } export type SessionCreatedPayload = SessionCreatedPayloadSchema.SessionCreatedPayload; export declare namespace SessionUpdatedPayloadSchema { type WorkspacePath = (string | null); type ChatGroupId = (string | null); type SessionId = string; type Model = (string | null); type ReplayState = ({ [k: string]: unknown; } | null); type Intent = (string | null); type ProjectId = (number | null); type ProjectName = (string | null); interface SessionUpdatedPayload { workspace_path?: WorkspacePath; chat_group_id?: ChatGroupId; session_id: SessionId; model?: Model; replay_state?: ReplayState; intent?: Intent; project_id?: ProjectId; project_name?: ProjectName; [k: string]: unknown; } } export type SessionUpdatedPayload = SessionUpdatedPayloadSchema.SessionUpdatedPayload; export declare namespace WorkspaceFilesChangedPayloadSchema { type SessionId = string; type FilePath = (string | null); interface WorkspaceFilesChangedPayload { session_id: SessionId; file_path?: FilePath; [k: string]: unknown; } } export type WorkspaceFilesChangedPayload = WorkspaceFilesChangedPayloadSchema.WorkspaceFilesChangedPayload; export declare namespace MCPAppChangedPayloadSchema { type SessionId = string; type SourceId = string; interface MCPAppChangedPayload { session_id: SessionId; source_id: SourceId; [k: string]: unknown; } } export type MCPAppChangedPayload = MCPAppChangedPayloadSchema.MCPAppChangedPayload; export declare namespace SystemErrorPayloadSchema { type Message = string; type SessionId = (string | null); type Code = (string | number | null); interface SystemErrorPayload { message: Message; session_id?: SessionId; code?: Code; detail?: Detail; [k: string]: unknown; } interface Detail { [k: string]: unknown; } } export type SystemErrorPayload = SystemErrorPayloadSchema.SystemErrorPayload; export declare namespace SystemNotificationPayloadSchema { type SessionId = (string | null); type NotificationType = string; type Title = string; type Detail = (string | null); type Status = (string | null); type Metadata = ({ [k: string]: unknown; } | null); interface SystemNotificationPayload { session_id?: SessionId; notification_type: NotificationType; title: Title; detail?: Detail; status?: Status; metadata?: Metadata; [k: string]: unknown; } } export type SystemNotificationPayload = SystemNotificationPayloadSchema.SystemNotificationPayload; export declare namespace TurnEventsPayloadSchema { type ServerTime = (string | null); type SessionId = string; type Type = string; type StreamSequence = (number | null); type Events = RawWireEvent[]; interface TurnEventsPayload { server_time?: ServerTime; session_id: SessionId; events: Events; [k: string]: unknown; } interface RawWireEvent { type: Type; payload: Payload; stream_sequence?: StreamSequence; [k: string]: unknown; } interface Payload { [k: string]: unknown; } } export type TurnEventsPayload = TurnEventsPayloadSchema.TurnEventsPayload; export declare namespace TurnTimingPayloadSchema { type SessionId = string; type LoopName = string; type TurnId = string; type FirstTokenDeliveryMs = number; interface TurnTimingPayload { session_id: SessionId; loop_name: LoopName; turn_id: TurnId; first_token_delivery_ms: FirstTokenDeliveryMs; [k: string]: unknown; } } export type TurnTimingPayload = TurnTimingPayloadSchema.TurnTimingPayload; export declare namespace AsrReadyPayloadSchema { type RequestId = string; type Provider = string; interface AsrReadyPayload { request_id: RequestId; provider: Provider; [k: string]: unknown; } } export type AsrReadyPayload = AsrReadyPayloadSchema.AsrReadyPayload; export declare namespace AsrTextPayloadSchema { type Text = string; type RequestId = (string | null); interface AsrTextPayload { text: Text; request_id?: RequestId; [k: string]: unknown; } } export type AsrTextPayload = AsrTextPayloadSchema.AsrTextPayload; export declare namespace AsrClosedPayloadSchema { type RequestId = string; interface AsrClosedPayload { request_id: RequestId; [k: string]: unknown; } } export type AsrClosedPayload = AsrClosedPayloadSchema.AsrClosedPayload; export declare namespace AsrErrorPayloadSchema { type Message = string; type RequestId = (string | null); interface AsrErrorPayload { message: Message; request_id?: RequestId; [k: string]: unknown; } } export type AsrErrorPayload = AsrErrorPayloadSchema.AsrErrorPayload; export declare namespace AgentBoardBoardTaskChangedPayloadSchema { type ProjectId = number; type Action = ("created" | "updated" | "deleted"); interface AgentBoardBoardTaskChangedPayload { project_id: ProjectId; action: Action; task: Task; [k: string]: unknown; } interface Task { [k: string]: unknown; } } export type AgentBoardBoardTaskChangedPayload = AgentBoardBoardTaskChangedPayloadSchema.AgentBoardBoardTaskChangedPayload; export declare namespace AgentBoardFileOpPayloadSchema { type ProjectId = number; type SessionId = string; type ToolCallId = (string | null); type Action = string; type FilePath = string; type Description = (string | null); type ContentPreview = (string | null); type FinalContent = (string | null); type ContentDelta = (boolean | null); type IsFinal = (boolean | null); type CreatedAt = string; interface AgentBoardFileOpPayload { project_id: ProjectId; session_id: SessionId; tool_call_id?: ToolCallId; action: Action; file_path: FilePath; description?: Description; content_preview?: ContentPreview; final_content?: FinalContent; content_delta?: ContentDelta; is_final?: IsFinal; created_at: CreatedAt; [k: string]: unknown; } } export type AgentBoardFileOpPayload = AgentBoardFileOpPayloadSchema.AgentBoardFileOpPayload; export declare namespace ChatSendAckSchema { type Status = string; type Message = (string | null); type Code = (string | number | null); interface ChatSendAck { status: Status; message?: Message; code?: Code; [k: string]: unknown; } } export type ChatSendAck = ChatSendAckSchema.ChatSendAck; export declare namespace ChatStopAckSchema { type Status = string; type Message = (string | null); type Code = (string | number | null); interface ChatStopAck { status: Status; message?: Message; code?: Code; [k: string]: unknown; } } export type ChatStopAck = ChatStopAckSchema.ChatStopAck; export declare namespace ChatCompactAckSchema { type Status = string; type Message = (string | null); type Code = (string | number | null); interface ChatCompactAck { status: Status; message?: Message; code?: Code; [k: string]: unknown; } } export type ChatCompactAck = ChatCompactAckSchema.ChatCompactAck; export declare namespace ChatQueueAckSchema { type SessionId = string; type Revision = number; type Paused = boolean; type PauseReason = (string | null); type Id = string; type Content = string; type Position = number; type Version = number; type Status = string; type CreatedAt = string; type UpdatedAt = string; type TargetRunId = (string | null); type Error = (string | null); type Items = ChatQueueItem[]; type Status1 = string; type Message = (string | null); interface ChatQueueAck { session_id: SessionId; revision: Revision; paused?: Paused; pause_reason?: PauseReason; items?: Items; status?: Status1; message?: Message; [k: string]: unknown; } interface ChatQueueItem { id: Id; content: Content; position: Position; version: Version; status: Status; created_at: CreatedAt; updated_at: UpdatedAt; target_run_id?: TargetRunId; error?: Error; [k: string]: unknown; } } export type ChatQueueAck = ChatQueueAckSchema.ChatQueueAck; export interface ClientToServerEvents { "chat:send": (payload: ChatSendPayload, ack: (response: ChatSendAck) => void) => void; "chat:stop": (payload: ChatStopPayload, ack: (response: ChatStopAck) => void) => void; "chat:append": (payload: ChatAppendPayload, ack: (response: ChatQueueAck) => void) => void; "chat:compact": (payload: ChatCompactPayload, ack: (response: ChatCompactAck) => void) => void; "chat:queue:list": (payload: ChatQueueListPayload, ack: (response: ChatQueueAck) => void) => void; "chat:queue:update": (payload: ChatQueueUpdatePayload, ack: (response: ChatQueueAck) => void) => void; "chat:queue:reorder": (payload: ChatQueueReorderPayload, ack: (response: ChatQueueAck) => void) => void; "chat:queue:cancel": (payload: ChatQueueCancelPayload, ack: (response: ChatQueueAck) => void) => void; "chat:queue:deliver": (payload: ChatQueueDeliverPayload, ack: (response: ChatQueueAck) => void) => void; "chat:queue:resume": (payload: ChatQueueResumePayload, ack: (response: ChatQueueAck) => void) => void; "session:subscribe": (payload: SessionSubscribePayload) => void; "session:subscribe_batch": (payload: SessionSubscribeBatchPayload) => void; "session:unsubscribe": (payload: SessionUnsubscribePayload) => void; "agent-board:project:subscribe": (payload: AgentBoardProjectSubscribePayload) => void; "agent-board:project:unsubscribe": (payload: AgentBoardProjectUnsubscribePayload) => void; "asr:start": (payload: unknown) => void; "asr:audio": (payload: AsrAudioPayload) => void; "asr:stop": (payload: unknown) => void; "gis.event.analysis.request": (payload: unknown, ack: (response: unknown) => void) => void; } export interface ServerToClientEvents { "chat:start": (payload: ChatStartPayload) => void; "chat:end": (payload: ChatEndPayload) => void; "chat:queue:updated": (payload: ChatQueueUpdatedPayload) => void; "session:created": (payload: SessionCreatedPayload) => void; "session:updated": (payload: SessionUpdatedPayload) => void; "workspace:files_changed": (payload: WorkspaceFilesChangedPayload) => void; "mcp-app:changed": (payload: MCPAppChangedPayload) => void; "system:error": (payload: SystemErrorPayload) => void; "system:notification": (payload: SystemNotificationPayload) => void; "turn:events": (payload: TurnEventsPayload) => void; "turn:timing": (payload: TurnTimingPayload) => void; "task:updated": (payload: unknown) => void; "task:synced": (payload: unknown) => void; "artifact:created": (payload: unknown) => void; "artifact:updated": (payload: unknown) => void; "bg:started": (payload: unknown) => void; "bg:tasks_completed": (payload: unknown) => void; "skills:changed": (payload: unknown) => void; "session:rewind": (payload: unknown) => void; "asr:ready": (payload: AsrReadyPayload) => void; "asr:partial": (payload: AsrTextPayload) => void; "asr:final": (payload: AsrTextPayload) => void; "asr:closed": (payload: AsrClosedPayload) => void; "asr:error": (payload: AsrErrorPayload) => void; "replay:input_mismatch": (payload: unknown) => void; "agent-board:board-task:changed": (payload: AgentBoardBoardTaskChangedPayload) => void; "agent-board:file-op": (payload: AgentBoardFileOpPayload) => void; }