/** * @license * Copyright 2026 Qwen * SPDX-License-Identifier: Apache-2.0 */ export declare const SUBAGENT_STATUSES: readonly ["queued", "starting", "running", "monitoring", "waiting", "delivering", "completed", "failed", "cancelled", "interrupted"]; export type SubagentStatus = (typeof SUBAGENT_STATUSES)[number]; export declare const SUBAGENT_FILTERS: readonly ["all", "running", "completed", "needsAttention"]; export type SubagentFilter = (typeof SUBAGENT_FILTERS)[number]; export type SubagentActivity = { at: number; kind: 'status' | 'message' | 'plan' | 'tool' | 'observation' | 'notification'; text: string; }; export type SubagentPermission = { requestHandle: string; title: string; titleTruncated?: boolean; backend?: string; sessionId?: string; details?: string; alwaysScope?: string; choices: Array<{ decision: 'allow' | 'deny'; scope?: 'once' | 'always'; }>; }; export declare const SUBAGENT_STOP_REASONS: readonly ["stopping", "unsupported", "untracked", "ended"]; export type SubagentTask = { id: string; kind: 'harness' | 'proactive' | 'search' | 'visual'; title: string; status: SubagentStatus; createdAt: number; updatedAt: number; backend?: string; sessionId?: string; source?: string; request: string; activity: string; output: string; /** Optional application-owned display message; output remains verbatim task data. */ outputMessage?: string; outputTruncated?: boolean; events: SubagentActivity[]; triggerCount?: number; pendingNotifications?: number; notification?: 'queued' | 'preparing' | 'speaking' | 'delivered' | 'undelivered'; remainingSec?: number; canStop?: boolean; stopReason?: (typeof SUBAGENT_STOP_REASONS)[number]; permissions?: SubagentPermission[]; permissionsOmitted?: number; }; export type SubagentsSnapshot = { revision: number; /** Changes to instruction receipts do not change task revisions or counts. */ deliveryRevision?: number; /** Report and announcement changes do not imply task progress or delivery. */ reportRevision?: number; pendingUnassignedPermissions?: number; counts: { running: number; completed: number; needsAttention: number; failed: number; cancelled: number; interrupted: number; }; tasks: SubagentTask[]; omitted: number; }; export declare const MAX_SUBAGENTS_SNAPSHOT_BYTES: number; export declare const MAX_SUBAGENT_TASKS = 32; export declare const MAX_SUBAGENT_PERMISSIONS = 8; export declare const MAX_SUBAGENTS_REQUEST_BYTES: number; export declare const MAX_SUBAGENTS_CONTROL_BYTES: number; export declare const MAX_DISCOVERED_SESSIONS = 32; export declare const MAX_INSTRUCTION_DELIVERIES = 100; export declare const INSTRUCTION_DELIVERY_STATUSES: readonly ["pending", "held", "delivered", "denied", "refused", "expired", "misaddressed", "dropped", "unknown", "failed"]; export type InstructionDelivery = { id: string; session: string; backend: string; status: (typeof INSTRUCTION_DELIVERY_STATUSES)[number]; tracking: boolean; createdAt: number; updatedAt: number; note?: string; }; export declare const MAX_SESSION_REPORTS = 100; export declare const SESSION_REPORT_CATEGORIES: readonly ["progress", "blocked", "result", "info"]; export declare const SESSION_REPORT_ANNOUNCEMENTS: readonly ["queued", "submitted", "speaking", "announced", "interrupted", "unspoken", "suppressed"]; export type SessionReport = { id: string; backend: string; source: string; sourceStatus: 'matched' | 'unconfirmed'; session?: string; category: (typeof SESSION_REPORT_CATEGORIES)[number]; text: string; receivedAt: number; updatedAt: number; announcement: (typeof SESSION_REPORT_ANNOUNCEMENTS)[number]; note?: string; }; /** Session discovery is separate from tasks and does not imply execution. */ export type DiscoveredSession = { id: string; backend: string; sessionId: string; title: string; cwd?: string; source: 'terminal'; status: 'unknown'; readOnly: boolean; }; export type SubagentsPage = { snapshot: SubagentsSnapshot; offset: number; total: number; filter?: SubagentFilter; selected?: SubagentTask; unassignedPermissions?: SubagentPermission[]; unassignedPermissionsOmitted?: number; discoveredSessions?: DiscoveredSession[]; discoveredSessionsOmitted?: number; instructionDeliveries?: InstructionDelivery[]; instructionDeliveriesOmitted?: number; sessionReports?: SessionReport[]; sessionReportsOmitted?: number; }; export type SubagentsControlRequest = { action: 'list'; offset?: number; selectedId?: string; filter?: SubagentFilter; } | { action: 'stop'; taskId: string; } | { action: 'permission'; requestHandle: string; decision: 'allow' | 'deny'; scope?: 'once' | 'always'; }; export declare const SUBAGENTS_CONTROL_ERROR_CODES: readonly ["unsupported", "unavailable", "invalid_request", "not_found", "not_stoppable", "permission_unavailable", "action_failed", "stale_instance"]; export type SubagentsControlErrorCode = (typeof SUBAGENTS_CONTROL_ERROR_CODES)[number]; export type SubagentsControlResult = { type: 'page'; page: SubagentsPage; } | { type: 'outcome'; outcome: 'stopping' | 'stopped' | 'already_ended' | 'allowed' | 'denied'; taskId?: string; requestHandle?: string; scope?: 'once' | 'always'; message?: string; } | { type: 'error'; code: SubagentsControlErrorCode; }; export declare function parseSubagentsSnapshot(value: unknown): SubagentsSnapshot | undefined; export declare function parseSubagentsControlRequest(value: unknown): SubagentsControlRequest | undefined; export declare function parseSubagentsControlResult(value: unknown): SubagentsControlResult | undefined;