export type OnboardingStatus = 'idle' | 'starting' | 'awaiting_browser_auth' | 'pairing' | 'connected' | 'error' | 'manual_key'; export type OnboardingNextAction = 'connect' | 'wait_for_browser' | 'open_dashboard' | 'retry' | 'start_pairing' | 'open_browser' | 'poll' | 'enter_manual_key' | 'reconnect' | 'none'; export type OnboardingKeySource = 'config' | 'environment' | 'persisted' | 'openclaw-config-file' | 'none'; export interface OnboardingState { status: OnboardingStatus; hasApiKey: boolean; connectionVerified: boolean; workspaceName: string | null; lastError: string | null; nextAction: OnboardingNextAction; docsUrl: string; keySource?: OnboardingKeySource; installationId?: string | null; connectUrl: string | null; pairingId?: string | null; expiresAt: string | null; pollIntervalMs: number | null; } export type RunPhase = 'intent' | 'execution' | 'blocked' | 'review' | 'handoff' | 'completed'; export type RuntimeSourceClient = 'openclaw' | 'codex' | 'claude-code' | 'api' | 'unknown'; export type RuntimeProviderLogo = 'codex' | 'openai' | 'anthropic' | 'openclaw' | 'orgx' | 'unknown'; export type RuntimeInstanceState = 'active' | 'stale' | 'stopped' | 'error'; export interface RuntimeInstance { id: string; sourceClient: RuntimeSourceClient; displayName: string; providerLogo: RuntimeProviderLogo; state: RuntimeInstanceState; runId: string | null; correlationId: string | null; initiativeId: string | null; workstreamId: string | null; taskId: string | null; agentId: string | null; agentName: string | null; phase: string | null; progressPct: number | null; currentTask: string | null; lastHeartbeatAt: string | null; lastEventAt: string; lastMessage: string | null; metadata: Record | null; } export type LiveActivityType = 'run_started' | 'run_completed' | 'run_failed' | 'artifact_created' | 'decision_requested' | 'decision_resolved' | 'handoff_requested' | 'handoff_claimed' | 'handoff_fulfilled' | 'blocker_created' | 'milestone_completed' | 'delegation'; /** * Canonical event names set in `metadata.event` on activity items. * Keep in sync with emitters in auto-continue-engine.ts, autopilot-operations.ts, * dispatch-lifecycle.ts, and http/index.ts. */ export type ActivityEventName = 'autopilot_slice_dispatched' | 'autopilot_slice_started' | 'autopilot_slice_heartbeat' | 'autopilot_slice_finished' | 'autopilot_slice_result' | 'autopilot_slice_handoff' | 'autopilot_slice_mcp_handshake_failed' | 'autopilot_slice_timeout' | 'autopilot_slice_log_stall' | 'autopilot_slice_artifact_buffered' | 'autopilot_slice_status_updates_buffered' | 'auto_continue_started' | 'auto_continue_stopped' | 'auto_continue_spawn_guard_blocked' | 'auto_continue_spawn_guard_rate_limited' | 'auto_continue_spawn_guard_rate_limit_overridden' | 'auto_continue_behavior_config_drift_detected' | 'auto_continue_behavior_config_approval_required' | 'auto_continue_behavior_automation_manual_blocked' | 'auto_continue_behavior_automation_supervised_one_shot' | 'autopilot_autofix_scheduled' | 'autopilot_autofix_executed' | 'autopilot_autofix_skipped' | 'orchestrator_dispatch' | 'autopilot_transition' | 'next_up_manual_dispatch_started' | 'scope_completed' | 'session_start' | 'session_stop' | 'heartbeat' | 'decision_buffered' | 'decision_resolved' | 'question_asked' | 'question_timeout_started' | 'question_auto_answered' | 'question_answer_applied' | 'question_answer_failed' | 'review_item_created' | 'review_item_resolved' | 'decision_auto_answer_scheduled' | 'decision_auto_answer_timeout' | 'decision_auto_answer_applied' | 'decision_auto_answer_skipped' | 'spawn_guard_degraded' | 'dashboard_run_mark_completed' | 'proof_gate_warning' | 'artifact_registered'; export interface LiveActivityItem { id: string; type: LiveActivityType; title: string; description: string | null; agentId: string | null; agentName: string | null; requesterAgentId: string | null; requesterAgentName: string | null; executorAgentId: string | null; executorAgentName: string | null; runId: string | null; initiativeId: string | null; timestamp: string; phase?: RunPhase | null; state?: string | null; kind?: string | null; summary?: string | null; decisionRequired?: boolean; costDelta?: number | null; runtimeClient?: RuntimeSourceClient | null; runtimeLabel?: string | null; runtimeProvider?: RuntimeProviderLogo | null; instanceId?: string | null; lastHeartbeatAt?: string | null; metadata?: Record; } export declare const KNOWN_ACTIVITY_ACTION_TYPES: readonly ["orchestrator_dispatch", "dispatch_slice", "spawn_worker", "run_heartbeat", "run_state_transition", "run_started", "run_completed", "run_failed", "slice_handoff", "question_asked", "question_timeout_started", "question_auto_answered", "question_answer_applied", "question_answer_failed", "decision_requested", "decision_resolved", "review_item_created", "review_item_resolved", "status_updates_applied", "status_updates_buffered", "artifact_registered", "spawn_guard_blocked", "spawn_guard_rate_limited", "behavior_config_review", "auto_fix", "auto_continue_started", "auto_continue_stopped", "autopilot_resumed", "autopilot_paused", "autopilot_blocked", "milestone_completed", "workflow_error"]; export type KnownActivityActionType = (typeof KNOWN_ACTIVITY_ACTION_TYPES)[number]; export type ActivityActionType = KnownActivityActionType | (string & {}); export declare const KNOWN_ACTIVITY_ACTION_PHASES: readonly ["intent", "dispatch", "execution", "handoff", "review", "completed", "blocked", "error"]; export type ActivityActionPhase = (typeof KNOWN_ACTIVITY_ACTION_PHASES)[number]; export declare function normalizeActivityActionType(value: unknown): ActivityActionType | null; export declare function isKnownActivityActionType(value: unknown): value is KnownActivityActionType; export declare function normalizeActivityActionPhase(value: unknown): ActivityActionPhase | null; export declare const KNOWN_DECISION_ACTION_TYPES: readonly ["approve", "reject", "provide_context", "request_info", "confirm_scope", "retry", "resume", "start", "pause", "defer", "cancel", "queue_top", "queue_bottom", "remove_from_queue", "reassign", "assign", "notify", "escalate", "handoff", "spawn", "execute_task", "review_blocker", "review_decision", "open_artifact", "open_logs", "open_session", "open_run", "open_workstream", "open_task", "open_initiative", "open_pr", "open_diff", "open_branch", "open_deal", "update_deal", "open_settings", "open_workspace", "connect_provider", "refresh_credentials", "auto_fix", "ignore_once"]; export type KnownDecisionActionType = (typeof KNOWN_DECISION_ACTION_TYPES)[number]; export type DecisionActionType = KnownDecisionActionType | (string & {}); export declare function normalizeDecisionActionType(value: unknown): DecisionActionType | null; export declare function isKnownDecisionActionType(value: unknown): value is KnownDecisionActionType; export type LiveDecisionOptionStatus = 'approved' | 'declined' | 'cancelled'; export interface LiveDecisionOption { id: string; label: string; description: string | null; consequences?: string | null; impliedStatus: LiveDecisionOptionStatus | null; actionType: DecisionActionType | null; requiresNote: boolean; } export interface LiveDecisionEvidenceRef { evidenceType: string | null; title: string | null; summary: string | null; sourceUrl: string | null; sourcePointer: string | null; freshness: string | null; confidence: number | null; payload: Record | null; } export interface LiveDecision { id: string; title: string; context: string | null; status: string; priority?: string | null; decisionType?: string | null; agentName: string | null; agentId?: string | null; initiativeId?: string | null; workstreamId?: string | null; dueAt?: string | null; requestedAt: string | null; updatedAt: string | null; sourceSystem?: string | null; conflictSource?: string | null; dedupeKey?: string | null; recommendedAction?: string | null; occurrenceCount?: number | null; firstSeenAt?: string | null; lastSeenAt?: string | null; sourceRunId?: string | null; sourceSessionId?: string | null; sourceStreamId?: string | null; evidenceRefs?: LiveDecisionEvidenceRef[]; waitingMinutes: number; metadata?: Record; options?: LiveDecisionOption[]; selectedOptionId?: string | null; } export interface SessionBlockerContext { initiativeId: string | null; initiativeIds?: string[]; workstreamId: string | null; workstreamIds?: string[]; workstreamTitle: string | null; taskIds: string[]; milestoneIds: string[]; iwmtId?: string | null; iwmtIds?: string[]; sliceRunId: string | null; parallelMode: string | null; logPath: string | null; outputPath: string | null; } export interface SessionBlockerDiagnostics { reason: string | null; source: string | null; errorCode: string | null; errorCategory: string | null; retryable: boolean | null; suggestedActions: string[]; eventId: string | null; eventType: string | null; eventTimestamp: string | null; context: SessionBlockerContext; } export interface SessionTreeNode { id: string; parentId: string | null; runId: string; title: string; agentId: string | null; agentName: string | null; status: string; progress: number | null; initiativeId: string | null; workstreamId: string | null; groupId: string; groupLabel: string; startedAt: string | null; updatedAt: string | null; lastEventAt: string | null; lastEventSummary: string | null; blockers: string[]; phase?: RunPhase | null; state?: string | null; eta?: string | null; cost?: number | null; checkpointCount?: number | null; blockerReason?: string | null; runtimeClient?: RuntimeSourceClient | null; runtimeLabel?: string | null; runtimeProvider?: RuntimeProviderLogo | null; instanceId?: string | null; lastHeartbeatAt?: string | null; blockerDiagnostics?: SessionBlockerDiagnostics | null; } export interface SessionTreeEdge { parentId: string; childId: string; } export interface SessionTreeGroup { id: string; label: string; status: string | null; } export interface SessionTreeResponse { nodes: SessionTreeNode[]; edges: SessionTreeEdge[]; groups: SessionTreeGroup[]; } export interface HandoffEvent { id: string; handoffId: string; eventType: string; actorType: string | null; actorId: string | null; payload: Record | null; createdAt: string; } export interface HandoffSummary { id: string; title: string; status: string; priority: string | null; summary: string | null; currentActorType: string | null; currentActorId: string | null; createdAt: string; updatedAt: string; events: HandoffEvent[]; } export type TriageItemKind = 'decision_required' | 'blocked_intervention' | 'review_required' | 'failure_diagnostic'; export type TriageItemStatus = 'open' | 'snoozed' | 'resolved' | 'dismissed'; export type TriageSeverity = 'critical' | 'high' | 'medium' | 'low'; export type TriageActionType = 'approve' | 'reject' | 'retry' | 'autofix' | 'defer' | 'snooze' | 'dismiss'; export interface TriageAction { action: TriageActionType; label: string; description: string; consequences: string; requiresNote: boolean; available: boolean; optionId?: string | null; } export interface ProofBundle { artifactRefs: string[]; fileChanges: string[]; prRefs: string[]; logRefs: string[]; decisionRefs: string[]; } export interface TriageImpact { initiativeCount: number; workstreamCount: number; downstreamBlockedCount: number; } export interface TriageDecisionOptionSummary { id?: string | null; label: string; description?: string | null; consequences?: string | null; actionType?: string | null; impliedStatus?: string | null; requiresNote?: boolean; recommended?: boolean; } export interface TriageEvidenceSummary { title: string; summary?: string | null; url?: string | null; pointer?: string | null; evidenceType?: string | null; confidence?: number | null; } export interface TriageInterventionContext { blockerReason?: string | null; waitingOn?: string | null; requiredAction?: string | null; requiredActor?: string | null; retryable?: boolean | null; errorCode?: string | null; errorCategory?: string | null; suggestedActions?: string[]; nextActions?: string[]; decisionIds?: string[]; taskUpdateCount?: number; milestoneUpdateCount?: number; decisionPrompt?: string | null; decisionSummary?: string | null; decisionOptions?: TriageDecisionOptionSummary[]; recommendedAction?: string | null; scopeHierarchy?: string[]; currentRunState?: string | null; impactIfDelayed?: string | null; artifacts?: string[]; evidence?: TriageEvidenceSummary[]; updatesApplied?: string[]; } export interface LiveTriageItem { id: string; kind: TriageItemKind; status: TriageItemStatus; title: string; summary: string; initiativeId: string | null; initiativeTitle: string | null; workstreamId: string | null; workstreamTitle: string | null; taskId: string | null; taskTitle: string | null; sourceSystem: string | null; conflictSource: string | null; dedupeKey: string | null; occurrenceCount: number; severity: TriageSeverity; blocking: boolean; recommendedAction: string | null; agentId: string | null; intervention?: TriageInterventionContext | null; impact: TriageImpact; proofBundle: ProofBundle; actionContract: TriageAction[]; createdAt: string; updatedAt: string; firstSeenAt: string; lastSeenAt: string; snoozedUntil: string | null; sourceDecisionId: string | null; sourceActivityId: string | null; } export interface TriageActionRequest { action: string; note?: string; optionId?: string; snoozeDurationMinutes?: number; } export interface TriageActionResponse { ok: boolean; itemStatus: TriageItemStatus; continuationPlan: string | null; sideEffects: string[]; } export interface TriageListResponse { ok: boolean; items: LiveTriageItem[]; total: number; generatedAt: string; degraded?: string[]; }