/** One conversation in the sidebar list. */ export interface IChatSummary { /** QwenPaw chat id (history lookup). */ id: string; /** QwenPaw auto-generated conversation title. */ name: string; /** The session this app used for the conversation. */ sessionId: string; updatedAt: string; /** QwenPaw chat status — 'idle' when the agent is not mid-run. */ status?: string; /** QwenPaw conversation group this chat belongs to. */ groupId?: string; } /** Sidebar grouping label for conversations. */ export interface IChatGroup { id: string; name: string; order: number; kind: string; } /** One display turn of a conversation (user or assistant text). */ export interface ICodingTurn { id: string; role: 'user' | 'assistant'; text: string; /** Epoch ms — client clock for live turns, QwenPaw metadata for * restored history. */ ts?: number; streaming?: boolean; error?: string; /** Files attached to a user turn (display only). */ files?: Array<{ name: string; size?: number; }>; } /** Widget connection lifecycle — mirrors the exchange action outcomes. */ export type AiConnectState = 'connecting' | 'connected' | 'no-agent' | 'not-configured' | 'error'; /** Typed failure `code` from the exchange action (server `data.code`). */ export type AiConnectErrorCode = 'AI_NOT_AUTHENTICATED' | 'AI_AGENT_NOT_ASSIGNED' | 'AI_CREDENTIAL_NOT_CONFIGURED' | 'AI_SESSION_EXCHANGE_FAILED'; /** Status probe result (no secrets). */ export interface IQwenpawSessionStatus { configured: boolean; baseUrl: string; agentId: string; } /** Exchange outcome after POST session. */ export interface IQwenpawConnectResult { ok: boolean; baseUrl: string; agentId: string; } /** One file attached to a message — `url` is the server-side path * returned by POST /api/console/upload. */ export interface IQwenpawFileRef { url: string; name: string; size?: number; } /** Documented console-chat request body (matches the console UI capture). */ export interface IQwenpawChatRequest { input: Array<{ role: 'user'; type: 'message'; content: Array<{ type: 'text'; text: string; status: 'created'; } | { type: 'file'; file_url: string; file_name: string; file_size?: number; status: 'created'; }>; metadata: { qwenpaw_client_message_id: string; }; }>; session_id: string; user_id: string; channel: string; request_context: { source: 'console_chat'; agent_id: string; chat_id: string; sdk_session_id: string; approval_level: 'AUTO'; }; stream: boolean; } /** Where a chat call runs — resolved per request server-side. */ export interface IQwenpawTarget { baseUrl: string; agentId: string; sessionId: string; userId: string; } export interface IQwenpawChatOptions { /** Server default resolved from runtimeConfig (ops fallback). */ config: IQwenpawServerConfig; target: IQwenpawTarget; text: string; files?: IQwenpawFileRef[]; /** Client disconnect propagation. */ signal?: AbortSignal; /** Wall-clock budget for establishing the upstream response. */ timeoutMs?: number; } /** SSE wire event (mixed shapes — see stream.ts for the parsing rules). */ export interface IQwenpawContentPart { type?: string; text?: string; delta?: boolean; } export interface IQwenpawSseEvent { id?: string; type?: string; status?: string; delta?: boolean; text?: string; object?: string; msg_id?: string; output?: Array<{ id?: string; role?: string; type?: string; content?: IQwenpawContentPart[]; }>; error?: { message?: string; } | string; } /** A normalized stream unit for the UI. */ export interface IQwenpawStreamChunk { /** Action to apply to the rendered answer text. */ action: 'append' | 'replace'; text: string; done: boolean; /** Raw wire status when present. */ status?: string; } /** Per-stream mutable state shared across events. */ export interface IQwenpawParseState { /** msg_ids that belong to reasoning messages — their deltas are skipped. */ reasoningMsgIds: Set; } export type QwenpawTextMode = 'replace' | 'append'; /** QwenPaw chat summary as returned by GET /api/chats. */ export interface IQwenpawChatSummary { id: string; name: string; session_id: string; user_id: string; status: string; updated_at: string; group_id?: string; } /** QwenPaw conversation group as returned by GET /api/chats/groups. */ export interface IQwenpawGroup { id: string; name: string; order: number; kind: string; source: string; pinned: boolean; } /** QwenPaw chat message as returned by GET /api/chats/{id}. */ export interface IQwenpawChatMessage { id?: string; type?: string; role?: string; status?: string; content?: Array<{ type?: string; text?: string; }>; metadata?: { timestamp?: string; qwenpaw_turn_usage?: { usage?: { model_name?: string; }; }; }; } /** Upload response from POST /api/console/upload. */ export interface IQwenpawUploadResult { url: string; file_name: string; size: number; } /** Connection resolved server-side (cookies → env). Agents are reached * pod-to-pod with web-auth disabled — no credential is carried. */ export interface IQwenpawResolvedConnection { baseUrl: string; agentId: string; } /** Server runtime config: `runtimeConfig.qwenpaw.baseUrl` — the agent id * is the constant, never configured. */ export interface IQwenpawServerConfig { baseUrl: string; } /** The action's own contract — arrives WRAPPED in the engine's * `output` field (ActionExecutor → ActionResponse.output). * Casing: the engine's response middleware rewrites action output to * camelCase, while the pack contract is snake — both key shapes are * accepted (see `exchangeQwenpawSession`). */ export interface IQwenpawExchangeResult { success: boolean; error?: string; code?: string; agent?: { agent_id?: string; agentId?: string; base_url?: string; baseUrl?: string; mode?: string; status?: string; }; session?: { authorization?: string; expires_at?: number; expiresAt?: number; }; } /** Envelope returned by POST /api/v1/content/types/{type}/actions/{action} * (ActionResponse). The `session.authorization` value is ignored — * in-cluster traffic needs no auth; only the TTL matters for cookies. */ export interface IQwenpawExchangeEnvelope { success: boolean; output?: IQwenpawExchangeResult | null; error?: string | null; } /** Agent mode instruction hints. */ export type QwenpawAppMode = 'chat' | 'ask' | 'edit' | 'agent'; /** Wire event statuses emitted by the console-chat SSE stream. */ export type QwenpawWireStatus = 'created' | 'in_progress' | 'completed' | 'failed'; /** Build the verified request body for one user message. */ export declare const buildConsoleChatBody: (target: IQwenpawTarget, text: string, files?: IQwenpawFileRef[]) => IQwenpawChatRequest; //# sourceMappingURL=qwenpaw.type.d.ts.map