@cadraos/sdk 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -176,13 +176,15 @@ interface ExecuteInput {
176
176
  task: string;
177
177
  /** Additional context for the execution */
178
178
  context?: Record<string, unknown>;
179
+ /** Attachment UUIDs to include with the message (for images, documents, etc.) */
180
+ attachmentIds?: string[];
179
181
  /** Execution options */
180
182
  options?: ExecuteOptions;
181
183
  }
182
184
  /**
183
185
  * Execution status
184
186
  */
185
- type ExecutionStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
187
+ type ExecutionStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled' | 'paused' | 'waiting_user_input';
186
188
  /**
187
189
  * Token usage information
188
190
  */
@@ -250,6 +252,11 @@ interface AgentListOptions extends ListOptions {
250
252
  /** Filter by type */
251
253
  type?: AgentType;
252
254
  }
255
+ /**
256
+ * Log types that can be generated during execution
257
+ * Matches the LogType from cadra-api's log-collector service
258
+ */
259
+ type LogType = 'info' | 'llm_request' | 'llm_response' | 'tool_call' | 'tool_result' | 'error' | 'system' | 'think' | 'rag' | 'skill' | 'delegation' | 'plan' | 'message';
253
260
  /**
254
261
  * Execution log entry
255
262
  */
@@ -257,7 +264,7 @@ interface ExecutionLog {
257
264
  /** Unique identifier */
258
265
  uuid: string;
259
266
  /** Log type */
260
- type: 'info' | 'think' | 'tool_call' | 'tool_result' | 'error' | 'system';
267
+ type: LogType;
261
268
  /** Log title/summary */
262
269
  title: string;
263
270
  /** Log content/details */
@@ -277,6 +284,8 @@ interface AgentExecution {
277
284
  uuid: string;
278
285
  /** Agent ID */
279
286
  agentUuid: string;
287
+ /** Session ID for conversation continuity */
288
+ sessionId?: string;
280
289
  /** Execution status */
281
290
  status: ExecutionStatus;
282
291
  /** Input provided */
@@ -335,6 +344,8 @@ interface AgentConfigUpdateInput {
335
344
  interface ExecuteResponse {
336
345
  /** Execution ID */
337
346
  executionId: string;
347
+ /** Session ID for conversation continuity */
348
+ sessionId?: string;
338
349
  /** Initial status */
339
350
  status: ExecutionStatus;
340
351
  }
@@ -685,6 +696,8 @@ interface SendMessageInput {
685
696
  message: string;
686
697
  /** Additional context */
687
698
  context?: Record<string, unknown>;
699
+ /** Attachment UUIDs to include with the message (for images, documents, etc.) */
700
+ attachmentIds?: string[];
688
701
  }
689
702
  /**
690
703
  * Session artifact type
@@ -804,6 +817,126 @@ interface ConnectionChangeEvent {
804
817
  /** Whether using fallback polling */
805
818
  usingFallback?: boolean;
806
819
  }
820
+ /**
821
+ * Paused event (ask_user waiting for user input)
822
+ */
823
+ interface PausedEvent {
824
+ /** The question to ask the user */
825
+ question: string;
826
+ /** Optional predefined choices */
827
+ options?: string[];
828
+ /** Reason for pausing */
829
+ reason: 'waiting_user_input';
830
+ }
831
+ /**
832
+ * Delegation started event (handoff_to_agent initiated)
833
+ */
834
+ interface DelegationStartedEvent {
835
+ /** Event type */
836
+ type: 'delegation_started';
837
+ /** Unique handoff ID */
838
+ handoffId: string;
839
+ /** Target agent UUID */
840
+ targetAgentUuid: string;
841
+ /** Target agent name */
842
+ targetAgentName?: string;
843
+ /** Preview of the delegated task */
844
+ taskPreview: string;
845
+ /** Event timestamp */
846
+ timestamp: string;
847
+ }
848
+ /**
849
+ * Delegation completed event (handoff_to_agent finished)
850
+ */
851
+ interface DelegationCompletedEvent {
852
+ /** Event type */
853
+ type: 'delegation_completed';
854
+ /** Unique handoff ID */
855
+ handoffId: string;
856
+ /** Completion status */
857
+ status: 'completed' | 'failed';
858
+ /** Preview of the result (if completed) */
859
+ resultPreview?: string;
860
+ /** Error message (if failed) */
861
+ error?: string;
862
+ /** Duration in milliseconds */
863
+ durationMs: number;
864
+ /** Event timestamp */
865
+ timestamp: string;
866
+ }
867
+ /**
868
+ * Text delta event - token-by-token streaming text
869
+ */
870
+ interface TextDeltaEvent {
871
+ /** Text delta chunk */
872
+ delta: string;
873
+ /** Execution ID */
874
+ executionId: string;
875
+ /** Event timestamp */
876
+ timestamp: string;
877
+ }
878
+ /**
879
+ * Started event - execution has begun
880
+ */
881
+ interface StartedEvent {
882
+ /** Execution ID */
883
+ executionId: string;
884
+ /** Agent UUID */
885
+ agentUuid: string;
886
+ /** Initial status */
887
+ status: 'initializing';
888
+ /** Current step description */
889
+ currentStep?: string;
890
+ }
891
+ /**
892
+ * Progress event - execution status update
893
+ */
894
+ interface ProgressEvent {
895
+ /** Current status */
896
+ status: 'initializing' | 'thinking' | 'acting' | 'observing' | 'planning' | 'paused';
897
+ /** Current iteration number */
898
+ iteration: number;
899
+ /** Description of current step */
900
+ currentStep?: string;
901
+ /** Current token usage */
902
+ tokenUsage?: {
903
+ prompt: number;
904
+ completion: number;
905
+ total: number;
906
+ };
907
+ /** Current cost */
908
+ cost?: number;
909
+ /** Number of tool calls made */
910
+ toolCalls?: number;
911
+ }
912
+ /**
913
+ * Task status for task list updates
914
+ */
915
+ type TaskStatus = 'pending' | 'in_progress' | 'completed';
916
+ /**
917
+ * Task item in task list
918
+ */
919
+ interface TaskItem {
920
+ /** Unique task ID */
921
+ id: string;
922
+ /** Task content/description */
923
+ content: string;
924
+ /** Active form text shown during in_progress */
925
+ activeForm?: string | null;
926
+ /** Task status */
927
+ status: TaskStatus;
928
+ }
929
+ /**
930
+ * Task list update event - agent creating/updating task list
931
+ */
932
+ interface TaskListUpdateEvent {
933
+ /** Execution ID */
934
+ executionId: string;
935
+ /** Current task list */
936
+ tasks: TaskItem[];
937
+ /** Timestamp */
938
+ timestamp: string;
939
+ }
807
940
  /**
808
941
  * Stream event map for type-safe event handlers
809
942
  */
@@ -812,6 +945,13 @@ interface StreamEventMap {
812
945
  toolCall: ToolCallEvent;
813
946
  toolResult: ToolResultEvent;
814
947
  plan: PlanEvent;
948
+ paused: PausedEvent;
949
+ started: StartedEvent;
950
+ progress: ProgressEvent;
951
+ taskListUpdate: TaskListUpdateEvent;
952
+ delegationStarted: DelegationStartedEvent;
953
+ delegationCompleted: DelegationCompletedEvent;
954
+ textDelta: TextDeltaEvent;
815
955
  complete: CompleteEvent;
816
956
  error: ErrorEvent;
817
957
  connectionChange: ConnectionChangeEvent;
@@ -828,6 +968,20 @@ interface StreamController {
828
968
  on(event: 'toolResult', callback: (data: ToolResultEvent) => void): void;
829
969
  /** Listen for plan updates */
830
970
  on(event: 'plan', callback: (data: PlanEvent) => void): void;
971
+ /** Listen for paused events (ask_user waiting for input) */
972
+ on(event: 'paused', callback: (data: PausedEvent) => void): void;
973
+ /** Listen for execution started (immediate feedback) */
974
+ on(event: 'started', callback: (data: StartedEvent) => void): void;
975
+ /** Listen for progress updates (status changes during execution) */
976
+ on(event: 'progress', callback: (data: ProgressEvent) => void): void;
977
+ /** Listen for task list updates */
978
+ on(event: 'taskListUpdate', callback: (data: TaskListUpdateEvent) => void): void;
979
+ /** Listen for delegation started events */
980
+ on(event: 'delegationStarted', callback: (data: DelegationStartedEvent) => void): void;
981
+ /** Listen for delegation completed events */
982
+ on(event: 'delegationCompleted', callback: (data: DelegationCompletedEvent) => void): void;
983
+ /** Listen for text delta events (token-by-token streaming) */
984
+ on(event: 'textDelta', callback: (data: TextDeltaEvent) => void): void;
831
985
  /** Listen for completion */
832
986
  on(event: 'complete', callback: (data: CompleteEvent) => void): void;
833
987
  /** Listen for errors */
@@ -913,6 +1067,8 @@ declare abstract class BaseResourceAPI {
913
1067
  interface ExecutionStreamControllerOptions {
914
1068
  /** Execution ID to stream */
915
1069
  executionId: string;
1070
+ /** Session ID for conversation continuity */
1071
+ sessionId?: string;
916
1072
  /** Base URL for API */
917
1073
  baseUrl: string;
918
1074
  /** API key or token */
@@ -936,6 +1092,10 @@ interface ExecutionStreamControllerOptions {
936
1092
  interface ExecutionStreamController extends StreamController {
937
1093
  /** Connect to the stream */
938
1094
  connect(): Promise<void>;
1095
+ /** Get the execution ID */
1096
+ readonly executionId: string;
1097
+ /** Get the session ID (if available) */
1098
+ readonly sessionId: string | undefined;
939
1099
  }
940
1100
 
941
1101
  /**
@@ -1039,6 +1199,33 @@ declare class AgentsAPI extends BaseResourceAPI {
1039
1199
  * ```
1040
1200
  */
1041
1201
  stream(uuid: string, input: ExecuteInput): Promise<ExecutionStreamController>;
1202
+ /**
1203
+ * Connect to an existing execution's stream
1204
+ *
1205
+ * Use this when the execution was started externally (e.g., via tRPC for team executions)
1206
+ * and you need to connect to its SSE stream for real-time updates.
1207
+ *
1208
+ * @param executionId - Execution UUID (already running)
1209
+ * @param sessionId - Optional session ID for conversation continuity
1210
+ * @returns Stream controller for the execution
1211
+ *
1212
+ * @example
1213
+ * ```typescript
1214
+ * // Execution started via tRPC
1215
+ * const executionId = await trpc.executions.start.mutate({ teamUuid, task });
1216
+ *
1217
+ * // Connect to SSE stream for real-time updates
1218
+ * const stream = client.agents.streamExecution(executionId);
1219
+ *
1220
+ * stream.on('log', (log) => console.log(log.title));
1221
+ * stream.on('delegationStarted', (data) => console.log('Subagent:', data.targetAgentName));
1222
+ * stream.on('complete', ({ execution }) => console.log(execution.output));
1223
+ *
1224
+ * await stream.connect();
1225
+ * const result = await stream.wait();
1226
+ * ```
1227
+ */
1228
+ streamExecution(executionId: string, sessionId?: string): ExecutionStreamController;
1042
1229
  /**
1043
1230
  * Get execution result by ID
1044
1231
  *
@@ -1901,4 +2088,4 @@ declare class NetworkError extends AISaaSError {
1901
2088
  constructor(message?: string, details?: Record<string, unknown>);
1902
2089
  }
1903
2090
 
1904
- export { AISaaSClient, type AISaaSClientOptions, AISaaSError, type Agent, type AgentConfig, type AgentConfigUpdateInput, type AgentExecution, type AgentListOptions, type AgentStatus, type AgentType, type AgentUpdateInput, type Artifact, type ArtifactDownloadOptions, type ArtifactListOptions, type ArtifactType, type ArtifactUploadInput, AuthenticationError, AuthorizationError, type CompleteEvent, ConflictError, type ConnectionChangeEvent, type ErrorEvent, type ExecuteInput, type ExecuteOptions, type ExecuteResponse, type ExecutionLog, type ExecutionStatus, type ExecutionStreamController, type ExecutionStreamControllerOptions, type JSONSchema, type ListOptions, NetworkError, NotFoundError, type PaginatedResponse, type PaginationInfo, type PlanEvent, RateLimitError, type SendMessageInput, ServerError, type Session, type SessionArtifact, type SessionArtifactListOptions, type SessionArtifactType, type SessionArtifactVariantType, type SessionCreateInput, type SessionHistory, type SessionListOptions, type SessionMessage, type SignedUrlResponse, type Skill, type SkillDetails, type SkillExecuteInput, type SkillExecution, type SkillListOptions, type SkillTool, type SkillUpdateInput, type SkillVariable, type StreamController, type StreamEventMap, TimeoutError, type TokenUsage, type Tool, type ToolCallEvent, type ToolConfigUpdateInput, type ToolExecution, type ToolListOptions, type ToolResultEvent, type ToolUpdateInput, type ToolValidationResult, ValidationError };
2091
+ export { AISaaSClient, type AISaaSClientOptions, AISaaSError, type Agent, type AgentConfig, type AgentConfigUpdateInput, type AgentExecution, type AgentListOptions, type AgentStatus, type AgentType, type AgentUpdateInput, type Artifact, type ArtifactDownloadOptions, type ArtifactListOptions, type ArtifactType, type ArtifactUploadInput, AuthenticationError, AuthorizationError, type CompleteEvent, ConflictError, type ConnectionChangeEvent, type DelegationCompletedEvent, type DelegationStartedEvent, type ErrorEvent, type ExecuteInput, type ExecuteOptions, type ExecuteResponse, type ExecutionLog, type ExecutionStatus, type ExecutionStreamController, type ExecutionStreamControllerOptions, type JSONSchema, type ListOptions, NetworkError, NotFoundError, type PaginatedResponse, type PaginationInfo, type PausedEvent, type PlanEvent, type ProgressEvent, RateLimitError, type SendMessageInput, ServerError, type Session, type SessionArtifact, type SessionArtifactListOptions, type SessionArtifactType, type SessionArtifactVariantType, type SessionCreateInput, type SessionHistory, type SessionListOptions, type SessionMessage, type SignedUrlResponse, type Skill, type SkillDetails, type SkillExecuteInput, type SkillExecution, type SkillListOptions, type SkillTool, type SkillUpdateInput, type SkillVariable, type StartedEvent, type StreamController, type StreamEventMap, type TextDeltaEvent, TimeoutError, type TokenUsage, type Tool, type ToolCallEvent, type ToolConfigUpdateInput, type ToolExecution, type ToolListOptions, type ToolResultEvent, type ToolUpdateInput, type ToolValidationResult, ValidationError };
package/dist/index.d.ts CHANGED
@@ -176,13 +176,15 @@ interface ExecuteInput {
176
176
  task: string;
177
177
  /** Additional context for the execution */
178
178
  context?: Record<string, unknown>;
179
+ /** Attachment UUIDs to include with the message (for images, documents, etc.) */
180
+ attachmentIds?: string[];
179
181
  /** Execution options */
180
182
  options?: ExecuteOptions;
181
183
  }
182
184
  /**
183
185
  * Execution status
184
186
  */
185
- type ExecutionStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
187
+ type ExecutionStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled' | 'paused' | 'waiting_user_input';
186
188
  /**
187
189
  * Token usage information
188
190
  */
@@ -250,6 +252,11 @@ interface AgentListOptions extends ListOptions {
250
252
  /** Filter by type */
251
253
  type?: AgentType;
252
254
  }
255
+ /**
256
+ * Log types that can be generated during execution
257
+ * Matches the LogType from cadra-api's log-collector service
258
+ */
259
+ type LogType = 'info' | 'llm_request' | 'llm_response' | 'tool_call' | 'tool_result' | 'error' | 'system' | 'think' | 'rag' | 'skill' | 'delegation' | 'plan' | 'message';
253
260
  /**
254
261
  * Execution log entry
255
262
  */
@@ -257,7 +264,7 @@ interface ExecutionLog {
257
264
  /** Unique identifier */
258
265
  uuid: string;
259
266
  /** Log type */
260
- type: 'info' | 'think' | 'tool_call' | 'tool_result' | 'error' | 'system';
267
+ type: LogType;
261
268
  /** Log title/summary */
262
269
  title: string;
263
270
  /** Log content/details */
@@ -277,6 +284,8 @@ interface AgentExecution {
277
284
  uuid: string;
278
285
  /** Agent ID */
279
286
  agentUuid: string;
287
+ /** Session ID for conversation continuity */
288
+ sessionId?: string;
280
289
  /** Execution status */
281
290
  status: ExecutionStatus;
282
291
  /** Input provided */
@@ -335,6 +344,8 @@ interface AgentConfigUpdateInput {
335
344
  interface ExecuteResponse {
336
345
  /** Execution ID */
337
346
  executionId: string;
347
+ /** Session ID for conversation continuity */
348
+ sessionId?: string;
338
349
  /** Initial status */
339
350
  status: ExecutionStatus;
340
351
  }
@@ -685,6 +696,8 @@ interface SendMessageInput {
685
696
  message: string;
686
697
  /** Additional context */
687
698
  context?: Record<string, unknown>;
699
+ /** Attachment UUIDs to include with the message (for images, documents, etc.) */
700
+ attachmentIds?: string[];
688
701
  }
689
702
  /**
690
703
  * Session artifact type
@@ -804,6 +817,126 @@ interface ConnectionChangeEvent {
804
817
  /** Whether using fallback polling */
805
818
  usingFallback?: boolean;
806
819
  }
820
+ /**
821
+ * Paused event (ask_user waiting for user input)
822
+ */
823
+ interface PausedEvent {
824
+ /** The question to ask the user */
825
+ question: string;
826
+ /** Optional predefined choices */
827
+ options?: string[];
828
+ /** Reason for pausing */
829
+ reason: 'waiting_user_input';
830
+ }
831
+ /**
832
+ * Delegation started event (handoff_to_agent initiated)
833
+ */
834
+ interface DelegationStartedEvent {
835
+ /** Event type */
836
+ type: 'delegation_started';
837
+ /** Unique handoff ID */
838
+ handoffId: string;
839
+ /** Target agent UUID */
840
+ targetAgentUuid: string;
841
+ /** Target agent name */
842
+ targetAgentName?: string;
843
+ /** Preview of the delegated task */
844
+ taskPreview: string;
845
+ /** Event timestamp */
846
+ timestamp: string;
847
+ }
848
+ /**
849
+ * Delegation completed event (handoff_to_agent finished)
850
+ */
851
+ interface DelegationCompletedEvent {
852
+ /** Event type */
853
+ type: 'delegation_completed';
854
+ /** Unique handoff ID */
855
+ handoffId: string;
856
+ /** Completion status */
857
+ status: 'completed' | 'failed';
858
+ /** Preview of the result (if completed) */
859
+ resultPreview?: string;
860
+ /** Error message (if failed) */
861
+ error?: string;
862
+ /** Duration in milliseconds */
863
+ durationMs: number;
864
+ /** Event timestamp */
865
+ timestamp: string;
866
+ }
867
+ /**
868
+ * Text delta event - token-by-token streaming text
869
+ */
870
+ interface TextDeltaEvent {
871
+ /** Text delta chunk */
872
+ delta: string;
873
+ /** Execution ID */
874
+ executionId: string;
875
+ /** Event timestamp */
876
+ timestamp: string;
877
+ }
878
+ /**
879
+ * Started event - execution has begun
880
+ */
881
+ interface StartedEvent {
882
+ /** Execution ID */
883
+ executionId: string;
884
+ /** Agent UUID */
885
+ agentUuid: string;
886
+ /** Initial status */
887
+ status: 'initializing';
888
+ /** Current step description */
889
+ currentStep?: string;
890
+ }
891
+ /**
892
+ * Progress event - execution status update
893
+ */
894
+ interface ProgressEvent {
895
+ /** Current status */
896
+ status: 'initializing' | 'thinking' | 'acting' | 'observing' | 'planning' | 'paused';
897
+ /** Current iteration number */
898
+ iteration: number;
899
+ /** Description of current step */
900
+ currentStep?: string;
901
+ /** Current token usage */
902
+ tokenUsage?: {
903
+ prompt: number;
904
+ completion: number;
905
+ total: number;
906
+ };
907
+ /** Current cost */
908
+ cost?: number;
909
+ /** Number of tool calls made */
910
+ toolCalls?: number;
911
+ }
912
+ /**
913
+ * Task status for task list updates
914
+ */
915
+ type TaskStatus = 'pending' | 'in_progress' | 'completed';
916
+ /**
917
+ * Task item in task list
918
+ */
919
+ interface TaskItem {
920
+ /** Unique task ID */
921
+ id: string;
922
+ /** Task content/description */
923
+ content: string;
924
+ /** Active form text shown during in_progress */
925
+ activeForm?: string | null;
926
+ /** Task status */
927
+ status: TaskStatus;
928
+ }
929
+ /**
930
+ * Task list update event - agent creating/updating task list
931
+ */
932
+ interface TaskListUpdateEvent {
933
+ /** Execution ID */
934
+ executionId: string;
935
+ /** Current task list */
936
+ tasks: TaskItem[];
937
+ /** Timestamp */
938
+ timestamp: string;
939
+ }
807
940
  /**
808
941
  * Stream event map for type-safe event handlers
809
942
  */
@@ -812,6 +945,13 @@ interface StreamEventMap {
812
945
  toolCall: ToolCallEvent;
813
946
  toolResult: ToolResultEvent;
814
947
  plan: PlanEvent;
948
+ paused: PausedEvent;
949
+ started: StartedEvent;
950
+ progress: ProgressEvent;
951
+ taskListUpdate: TaskListUpdateEvent;
952
+ delegationStarted: DelegationStartedEvent;
953
+ delegationCompleted: DelegationCompletedEvent;
954
+ textDelta: TextDeltaEvent;
815
955
  complete: CompleteEvent;
816
956
  error: ErrorEvent;
817
957
  connectionChange: ConnectionChangeEvent;
@@ -828,6 +968,20 @@ interface StreamController {
828
968
  on(event: 'toolResult', callback: (data: ToolResultEvent) => void): void;
829
969
  /** Listen for plan updates */
830
970
  on(event: 'plan', callback: (data: PlanEvent) => void): void;
971
+ /** Listen for paused events (ask_user waiting for input) */
972
+ on(event: 'paused', callback: (data: PausedEvent) => void): void;
973
+ /** Listen for execution started (immediate feedback) */
974
+ on(event: 'started', callback: (data: StartedEvent) => void): void;
975
+ /** Listen for progress updates (status changes during execution) */
976
+ on(event: 'progress', callback: (data: ProgressEvent) => void): void;
977
+ /** Listen for task list updates */
978
+ on(event: 'taskListUpdate', callback: (data: TaskListUpdateEvent) => void): void;
979
+ /** Listen for delegation started events */
980
+ on(event: 'delegationStarted', callback: (data: DelegationStartedEvent) => void): void;
981
+ /** Listen for delegation completed events */
982
+ on(event: 'delegationCompleted', callback: (data: DelegationCompletedEvent) => void): void;
983
+ /** Listen for text delta events (token-by-token streaming) */
984
+ on(event: 'textDelta', callback: (data: TextDeltaEvent) => void): void;
831
985
  /** Listen for completion */
832
986
  on(event: 'complete', callback: (data: CompleteEvent) => void): void;
833
987
  /** Listen for errors */
@@ -913,6 +1067,8 @@ declare abstract class BaseResourceAPI {
913
1067
  interface ExecutionStreamControllerOptions {
914
1068
  /** Execution ID to stream */
915
1069
  executionId: string;
1070
+ /** Session ID for conversation continuity */
1071
+ sessionId?: string;
916
1072
  /** Base URL for API */
917
1073
  baseUrl: string;
918
1074
  /** API key or token */
@@ -936,6 +1092,10 @@ interface ExecutionStreamControllerOptions {
936
1092
  interface ExecutionStreamController extends StreamController {
937
1093
  /** Connect to the stream */
938
1094
  connect(): Promise<void>;
1095
+ /** Get the execution ID */
1096
+ readonly executionId: string;
1097
+ /** Get the session ID (if available) */
1098
+ readonly sessionId: string | undefined;
939
1099
  }
940
1100
 
941
1101
  /**
@@ -1039,6 +1199,33 @@ declare class AgentsAPI extends BaseResourceAPI {
1039
1199
  * ```
1040
1200
  */
1041
1201
  stream(uuid: string, input: ExecuteInput): Promise<ExecutionStreamController>;
1202
+ /**
1203
+ * Connect to an existing execution's stream
1204
+ *
1205
+ * Use this when the execution was started externally (e.g., via tRPC for team executions)
1206
+ * and you need to connect to its SSE stream for real-time updates.
1207
+ *
1208
+ * @param executionId - Execution UUID (already running)
1209
+ * @param sessionId - Optional session ID for conversation continuity
1210
+ * @returns Stream controller for the execution
1211
+ *
1212
+ * @example
1213
+ * ```typescript
1214
+ * // Execution started via tRPC
1215
+ * const executionId = await trpc.executions.start.mutate({ teamUuid, task });
1216
+ *
1217
+ * // Connect to SSE stream for real-time updates
1218
+ * const stream = client.agents.streamExecution(executionId);
1219
+ *
1220
+ * stream.on('log', (log) => console.log(log.title));
1221
+ * stream.on('delegationStarted', (data) => console.log('Subagent:', data.targetAgentName));
1222
+ * stream.on('complete', ({ execution }) => console.log(execution.output));
1223
+ *
1224
+ * await stream.connect();
1225
+ * const result = await stream.wait();
1226
+ * ```
1227
+ */
1228
+ streamExecution(executionId: string, sessionId?: string): ExecutionStreamController;
1042
1229
  /**
1043
1230
  * Get execution result by ID
1044
1231
  *
@@ -1901,4 +2088,4 @@ declare class NetworkError extends AISaaSError {
1901
2088
  constructor(message?: string, details?: Record<string, unknown>);
1902
2089
  }
1903
2090
 
1904
- export { AISaaSClient, type AISaaSClientOptions, AISaaSError, type Agent, type AgentConfig, type AgentConfigUpdateInput, type AgentExecution, type AgentListOptions, type AgentStatus, type AgentType, type AgentUpdateInput, type Artifact, type ArtifactDownloadOptions, type ArtifactListOptions, type ArtifactType, type ArtifactUploadInput, AuthenticationError, AuthorizationError, type CompleteEvent, ConflictError, type ConnectionChangeEvent, type ErrorEvent, type ExecuteInput, type ExecuteOptions, type ExecuteResponse, type ExecutionLog, type ExecutionStatus, type ExecutionStreamController, type ExecutionStreamControllerOptions, type JSONSchema, type ListOptions, NetworkError, NotFoundError, type PaginatedResponse, type PaginationInfo, type PlanEvent, RateLimitError, type SendMessageInput, ServerError, type Session, type SessionArtifact, type SessionArtifactListOptions, type SessionArtifactType, type SessionArtifactVariantType, type SessionCreateInput, type SessionHistory, type SessionListOptions, type SessionMessage, type SignedUrlResponse, type Skill, type SkillDetails, type SkillExecuteInput, type SkillExecution, type SkillListOptions, type SkillTool, type SkillUpdateInput, type SkillVariable, type StreamController, type StreamEventMap, TimeoutError, type TokenUsage, type Tool, type ToolCallEvent, type ToolConfigUpdateInput, type ToolExecution, type ToolListOptions, type ToolResultEvent, type ToolUpdateInput, type ToolValidationResult, ValidationError };
2091
+ export { AISaaSClient, type AISaaSClientOptions, AISaaSError, type Agent, type AgentConfig, type AgentConfigUpdateInput, type AgentExecution, type AgentListOptions, type AgentStatus, type AgentType, type AgentUpdateInput, type Artifact, type ArtifactDownloadOptions, type ArtifactListOptions, type ArtifactType, type ArtifactUploadInput, AuthenticationError, AuthorizationError, type CompleteEvent, ConflictError, type ConnectionChangeEvent, type DelegationCompletedEvent, type DelegationStartedEvent, type ErrorEvent, type ExecuteInput, type ExecuteOptions, type ExecuteResponse, type ExecutionLog, type ExecutionStatus, type ExecutionStreamController, type ExecutionStreamControllerOptions, type JSONSchema, type ListOptions, NetworkError, NotFoundError, type PaginatedResponse, type PaginationInfo, type PausedEvent, type PlanEvent, type ProgressEvent, RateLimitError, type SendMessageInput, ServerError, type Session, type SessionArtifact, type SessionArtifactListOptions, type SessionArtifactType, type SessionArtifactVariantType, type SessionCreateInput, type SessionHistory, type SessionListOptions, type SessionMessage, type SignedUrlResponse, type Skill, type SkillDetails, type SkillExecuteInput, type SkillExecution, type SkillListOptions, type SkillTool, type SkillUpdateInput, type SkillVariable, type StartedEvent, type StreamController, type StreamEventMap, type TextDeltaEvent, TimeoutError, type TokenUsage, type Tool, type ToolCallEvent, type ToolConfigUpdateInput, type ToolExecution, type ToolListOptions, type ToolResultEvent, type ToolUpdateInput, type ToolValidationResult, ValidationError };