/** * Core types for mcp-subagents-opencode. * Core types for mcp-subagents-opencode. */ import type { ServerNotification } from '@modelcontextprotocol/sdk/types.js'; export type Provider = 'opencode'; export declare enum TaskStatus { PENDING = "pending", WAITING = "waiting", RUNNING = "running", COMPLETED = "completed", FAILED = "failed", CANCELLED = "cancelled", RATE_LIMITED = "rate_limited", TIMED_OUT = "timed_out" } export declare const TERMINAL_STATUSES: ReadonlySet; export declare function isTerminalStatus(status: TaskStatus): boolean; /** HTTP status codes that trigger retry/rotation. */ export declare const ROTATABLE_STATUS_CODES: ReadonlySet; export declare const RATE_LIMIT_STATUS_CODE = 429; export interface RetryInfo { reason: string; retryCount: number; nextRetryTime: string; maxRetries: number; originalTaskId?: string; } export interface PendingQuestion { question: string; choices?: string[]; allowFreeform: boolean; askedAt: string; sessionId: string; } export interface FailureContext { errorType?: string; statusCode?: number; errorContext?: string; recoverable?: boolean; message?: string; } export interface QuotaInfo { remainingPercentage?: number; resetDate?: string; } export interface TaskState { id: string; status: TaskStatus; prompt: string; output: string[]; startTime: string; endTime?: string; lastHeartbeatAt?: string; lastOutputAt?: string; cwd?: string; model?: string; autonomous?: boolean; isResume?: boolean; retryInfo?: RetryInfo; dependsOn?: string[]; labels?: string[]; provider?: Provider; fallbackAttempted?: boolean; switchAttempted?: boolean; timeout?: number; timeoutAt?: string; timeoutReason?: string; timeoutContext?: Record; sessionId?: string; exitCode?: number; error?: string; pendingQuestion?: PendingQuestion; outputFilePath?: string; failureContext?: FailureContext; quotaInfo?: QuotaInfo; /** Runtime session reference (not serialized) */ session?: { abort: () => void | Promise; }; } export interface SpawnOptions { prompt: string; timeout?: number; cwd?: string; model?: string; taskType?: string; autonomous?: boolean; resumeSessionId?: string; dependsOn?: string[]; labels?: string[]; provider?: Provider; fallbackAttempted?: boolean; switchAttempted?: boolean; retryInfo?: RetryInfo; } export interface ToolContext { progressToken?: string | number; sendNotification: (notification: ServerNotification) => Promise; } //# sourceMappingURL=types.d.ts.map