Type Reference
This page contains the complete TypeScript type definitions exported by devteam-sdk.
Core Types
Task
interface Task {
id: string;
status: TaskStatus;
model: string;
queue: string;
priority: number;
prompt: string;
systemPrompt?: string;
context?: Record<string, unknown>;
tags: string[];
createdAt: string;
startedAt?: string;
completedAt?: string;
output?: string;
error?: string;
usage?: TokenUsage;
metadata?: Record<string, unknown>;
planExecutionId?: string;
stepId?: string;
workerId?: string;
retryCount: number;
callbackUrl?: string;
}
type TaskStatus =
| 'pending'
| 'queued'
| 'running'
| 'completed'
| 'failed'
| 'cancelled'
| 'awaiting_approval'
| 'rejected';Plan
interface Plan {
id: string;
name: string;
description?: string;
steps: PlanStep[];
tags: string[];
createdAt: string;
updatedAt: string;
createdBy: string;
isTemplate: boolean;
}
interface PlanStep {
id: string;
prompt: string;
model?: string;
queue?: string;
dependsOn?: string[];
timeoutMs?: number;
retry?: RetryConfig;
requiresApproval?: boolean;
condition?: string;
maxTokens?: number;
temperature?: number;
}Plan Execution
interface PlanExecution {
id: string;
planId: string;
status: PlanExecutionStatus;
progress: ExecutionProgress;
steps: Record<string, StepResult>;
input: Record<string, unknown>;
startedAt: string;
completedAt?: string;
usage: TokenUsage;
hitlConfig?: HitlConfig;
}
type PlanExecutionStatus =
| 'pending'
| 'running'
| 'completed'
| 'failed'
| 'cancelled'
| 'paused';
interface ExecutionProgress {
total: number;
completed: number;
running: number;
pending: number;
failed: number;
}
interface StepResult {
id: string;
status: TaskStatus;
output?: string;
error?: string;
model: string;
startedAt?: string;
completedAt?: string;
durationMs?: number;
usage?: TokenUsage;
retryCount: number;
}Template
interface Template {
id: string;
name: string;
description: string;
version: string;
industry: TemplateIndustry;
tags: string[];
author: string;
steps: PlanStep[];
inputSchema: JSONSchema;
outputSchema?: JSONSchema;
estimatedCost: number;
estimatedDurationMs: number;
hitlSteps: string[];
visibility: 'private' | 'organization' | 'public';
createdAt: string;
updatedAt: string;
}
type TemplateIndustry =
| 'legal'
| 'finance'
| 'devops'
| 'marketing'
| 'healthcare'
| 'custom';Configuration Types
Client Options
interface DevTeamClientOptions {
apiUrl?: string;
apiKey?: string;
token?: string;
timeout?: number;
maxRetries?: number;
logLevel?: LogLevel;
defaultQueue?: string;
defaultModel?: string;
headers?: Record<string, string>;
modelConfig?: ModelConfig;
websocket?: WebSocketOptions;
logger?: Logger;
}
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
interface WebSocketOptions {
enabled?: boolean;
autoReconnect?: boolean;
reconnectInterval?: number;
}
interface ModelConfig {
costOptimized?: ModelRoute;
qualityOptimized?: ModelRoute;
routing?: Record<string, string>;
}
interface ModelRoute {
primary: string;
fallback: string;
}HITL Types
interface HitlConfig {
requiredFor?: string[];
confidenceThreshold?: number;
timeoutMs?: number;
notifyChannels?: NotifyChannel[];
escalation?: EscalationConfig;
}
type NotifyChannel = 'email' | 'dashboard' | 'slack' | 'webhook';
interface EscalationConfig {
afterMs: number;
to: string;
}
interface PendingApproval {
taskId: string;
planExecutionId?: string;
stepId?: string;
model: string;
queue: string;
confidence: number;
summary: string;
output: string;
prompt: string;
tags: string[];
createdAt: string;
waitingMs: number;
timeoutAt?: string;
assignedTo?: string;
escalatedFrom?: string;
}Utility Types
Token Usage
interface TokenUsage {
input: number;
output: number;
total: number;
totalCost?: number;
}Retry Configuration
interface RetryConfig {
maxAttempts: number;
backoffMs: number;
backoffMultiplier?: number;
maxBackoffMs?: number;
}Wait Options
interface WaitOptions {
timeoutMs?: number;
pollIntervalMs?: number;
onProgress?: (status: any) => void;
}Pagination
interface PaginatedList<T> {
data: T[];
total: number;
limit: number;
offset: number;
hasMore: boolean;
}
type TaskList = PaginatedList<Task>;
type TemplateList = PaginatedList<Template>;
type PendingApprovalList = PaginatedList<PendingApproval>;Error Types
class DevTeamError extends Error {
code: string;
statusCode: number;
requestId: string;
}
class AuthError extends DevTeamError {
code: 'AUTH_FAILED' | 'TOKEN_EXPIRED' | 'INSUFFICIENT_PERMISSIONS';
}
class TimeoutError extends DevTeamError {
code: 'REQUEST_TIMEOUT' | 'TASK_TIMEOUT' | 'PLAN_TIMEOUT';
timeoutMs: number;
}
class ValidationError extends DevTeamError {
code: 'VALIDATION_ERROR';
fields: Record<string, string>;
}
class RateLimitError extends DevTeamError {
code: 'RATE_LIMIT_EXCEEDED';
retryAfterMs: number;
}
class NotFoundError extends DevTeamError {
code: 'NOT_FOUND';
resource: string;
resourceId: string;
}WebSocket Event Types
type WebSocketEvent =
| TaskEvent
| PlanEvent
| HitlEvent
| WorkerEvent;
interface TaskEvent {
type: 'task:created' | 'task:started' | 'task:completed' | 'task:failed' | 'task:cancelled';
taskId: string;
status: TaskStatus;
output?: string;
error?: string;
timestamp: string;
}
interface PlanEvent {
type: 'plan:started' | 'plan:step_completed' | 'plan:completed' | 'plan:failed';
executionId: string;
planId: string;
stepId?: string;
status: PlanExecutionStatus;
progress?: ExecutionProgress;
timestamp: string;
}
interface HitlEvent {
type: 'hitl:pending' | 'hitl:approved' | 'hitl:rejected' | 'hitl:escalated' | 'hitl:expired';
taskId: string;
confidence?: number;
summary?: string;
reviewerId?: string;
reason?: string;
timestamp: string;
}
interface WorkerEvent {
type: 'worker:connected' | 'worker:disconnected' | 'worker:heartbeat';
workerId: string;
queue: string;
activeTaskCount: number;
timestamp: string;
}