@elevasis/ui 2.18.0 → 2.19.0

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.
Files changed (61) hide show
  1. package/dist/api/index.js +2 -2
  2. package/dist/app/index.js +5 -5
  3. package/dist/charts/index.js +3 -3
  4. package/dist/chunk-3JCMO7SD.js +14 -0
  5. package/dist/{chunk-P6TC4K7I.js → chunk-46Z2VHY3.js} +4 -4
  6. package/dist/{chunk-B6FIIEFO.js → chunk-5SCVXZPM.js} +128 -117
  7. package/dist/{chunk-SQPM2QDH.js → chunk-BHR7IV72.js} +3 -2
  8. package/dist/{chunk-DDZMBNTY.js → chunk-CTTY6FUT.js} +2 -2
  9. package/dist/{chunk-P3TFNFZS.js → chunk-EUWBY43Z.js} +2 -2
  10. package/dist/{chunk-LT33DSMO.js → chunk-IBOX2M24.js} +4 -4
  11. package/dist/{chunk-WP3IYOVJ.js → chunk-JEQM67SO.js} +107 -56
  12. package/dist/{chunk-A2AZY5SF.js → chunk-LR5CRY5A.js} +1 -1
  13. package/dist/{chunk-FM6LSZ45.js → chunk-LVCJ2H2T.js} +4 -4
  14. package/dist/{chunk-GRGRBWIO.js → chunk-M7W7CGPL.js} +1 -1
  15. package/dist/{chunk-34NQLV2W.js → chunk-MJAKU2WA.js} +3 -3
  16. package/dist/{chunk-I3LQGLUC.js → chunk-Q4QJOSVS.js} +1 -1
  17. package/dist/{chunk-R73EHHPN.js → chunk-Q5HC6ENG.js} +18 -2
  18. package/dist/{chunk-VDM6DQES.js → chunk-R7OJCNL3.js} +1 -1
  19. package/dist/{chunk-6RWMRQN5.js → chunk-TIIPYB2Z.js} +1 -1
  20. package/dist/{chunk-66VY5EMV.js → chunk-TKEKYPZA.js} +5 -5
  21. package/dist/{chunk-EY322HXF.js → chunk-UU6PJ4EJ.js} +19 -6
  22. package/dist/{chunk-UA36WILN.js → chunk-Y7TDUZEH.js} +145 -211
  23. package/dist/{chunk-SS2UVUSG.js → chunk-YVAXWM3W.js} +73 -121
  24. package/dist/components/index.d.ts +218 -2808
  25. package/dist/components/index.js +25 -25
  26. package/dist/features/crm/index.d.ts +54 -53
  27. package/dist/features/crm/index.js +11 -11
  28. package/dist/features/dashboard/index.js +12 -12
  29. package/dist/features/delivery/index.d.ts +2642 -2605
  30. package/dist/features/delivery/index.js +11 -11
  31. package/dist/features/lead-gen/index.js +11 -22
  32. package/dist/features/monitoring/index.js +13 -13
  33. package/dist/features/monitoring/requests/index.d.ts +38 -27
  34. package/dist/features/monitoring/requests/index.js +212 -106
  35. package/dist/features/operations/index.d.ts +8 -26
  36. package/dist/features/operations/index.js +15 -15
  37. package/dist/features/settings/index.d.ts +36 -37
  38. package/dist/features/settings/index.js +12 -12
  39. package/dist/hooks/delivery/index.d.ts +2712 -2699
  40. package/dist/hooks/delivery/index.js +2 -2
  41. package/dist/hooks/index.d.ts +1674 -4617
  42. package/dist/hooks/index.js +10 -10
  43. package/dist/hooks/published.d.ts +1674 -4617
  44. package/dist/hooks/published.js +10 -10
  45. package/dist/index.d.ts +773 -3635
  46. package/dist/index.js +11 -11
  47. package/dist/layout/index.d.ts +14 -2
  48. package/dist/layout/index.js +1 -1
  49. package/dist/provider/index.d.ts +320 -249
  50. package/dist/provider/index.js +8 -8
  51. package/dist/provider/published.d.ts +320 -249
  52. package/dist/provider/published.js +5 -5
  53. package/dist/sse/index.d.ts +1 -6
  54. package/dist/theme/index.js +2 -2
  55. package/dist/types/index.d.ts +1604 -2489
  56. package/dist/utils/index.d.ts +32 -1
  57. package/dist/utils/index.js +1 -1
  58. package/dist/zustand/index.d.ts +4 -8
  59. package/package.json +2 -2
  60. package/dist/chunk-ADSSLKKP.js +0 -10
  61. /package/dist/{chunk-GCBWGGI6.js → chunk-OD7GWIZS.js} +0 -0
@@ -1,10 +1,16 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ /**
4
+ * Error categories for observability grouping and classification.
5
+ * Used to categorize errors in the execution_errors table metadata.
6
+ */
7
+ type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
8
+
3
9
  /**
4
10
  * Workflow-specific logging types and utilities
5
11
  */
6
12
 
7
- interface WorkflowExecutionContext$1 {
13
+ interface WorkflowExecutionContext {
8
14
  type: 'workflow';
9
15
  contextType: 'workflow-execution';
10
16
  executionId: string;
@@ -13,14 +19,14 @@ interface WorkflowExecutionContext$1 {
13
19
  organizationId: string;
14
20
  executionPath?: string[];
15
21
  }
16
- interface WorkflowFailureContext$1 {
22
+ interface WorkflowFailureContext {
17
23
  type: 'workflow';
18
24
  contextType: 'workflow-failure';
19
25
  executionId: string;
20
26
  workflowId: string;
21
27
  error: string;
22
28
  }
23
- interface StepStartedContext$1 {
29
+ interface StepStartedContext {
24
30
  type: 'workflow';
25
31
  contextType: 'step-started';
26
32
  stepId: string;
@@ -28,7 +34,7 @@ interface StepStartedContext$1 {
28
34
  input: unknown;
29
35
  startTime: number;
30
36
  }
31
- interface StepCompletedContext$1 {
37
+ interface StepCompletedContext {
32
38
  type: 'workflow';
33
39
  contextType: 'step-completed';
34
40
  stepId: string;
@@ -39,7 +45,7 @@ interface StepCompletedContext$1 {
39
45
  startTime: number;
40
46
  endTime: number;
41
47
  }
42
- interface StepFailedContext$1 {
48
+ interface StepFailedContext {
43
49
  type: 'workflow';
44
50
  contextType: 'step-failed';
45
51
  stepId: string;
@@ -49,24 +55,24 @@ interface StepFailedContext$1 {
49
55
  startTime: number;
50
56
  endTime: number;
51
57
  }
52
- interface ConditionalRouteContext$1 {
58
+ interface ConditionalRouteContext {
53
59
  type: 'workflow';
54
60
  contextType: 'conditional-route';
55
61
  stepId: string;
56
62
  target: string;
57
63
  error?: string;
58
64
  }
59
- interface ExecutionPathContext$1 {
65
+ interface ExecutionPathContext {
60
66
  type: 'workflow';
61
67
  contextType: 'execution-path';
62
68
  executionPath: string[];
63
69
  }
64
- type WorkflowLogContext$1 = WorkflowExecutionContext$1 | WorkflowFailureContext$1 | StepStartedContext$1 | StepCompletedContext$1 | StepFailedContext$1 | ConditionalRouteContext$1 | ExecutionPathContext$1;
70
+ type WorkflowLogContext = WorkflowExecutionContext | WorkflowFailureContext | StepStartedContext | StepCompletedContext | StepFailedContext | ConditionalRouteContext | ExecutionPathContext;
65
71
  interface WorkflowLogMessage {
66
- level: ExecutionLogLevel$1;
72
+ level: ExecutionLogLevel;
67
73
  message: string;
68
74
  timestamp: number;
69
- context?: WorkflowLogContext$1;
75
+ context?: WorkflowLogContext;
70
76
  }
71
77
 
72
78
  /**
@@ -82,26 +88,26 @@ interface WorkflowLogMessage {
82
88
  * Agent lifecycle stages
83
89
  * Universal checkpoints that apply to all agent executions
84
90
  */
85
- type AgentLifecycle$1 = 'initialization' | 'iteration' | 'completion';
91
+ type AgentLifecycle = 'initialization' | 'iteration' | 'completion';
86
92
  /**
87
93
  * Iteration event types
88
94
  * Activities that occur during agent iterations
89
95
  */
90
- type IterationEventType$1 = 'reasoning' | 'action' | 'tool-call';
96
+ type IterationEventType = 'reasoning' | 'action' | 'tool-call';
91
97
  /**
92
98
  * Base fields shared by all lifecycle events
93
99
  */
94
- interface AgentLifecycleEventBase$1 {
100
+ interface AgentLifecycleEventBase {
95
101
  type: 'agent';
96
102
  agentId: string;
97
- lifecycle: AgentLifecycle$1;
103
+ lifecycle: AgentLifecycle;
98
104
  sessionId?: string;
99
105
  }
100
106
  /**
101
107
  * Lifecycle started event - emitted when a phase begins
102
108
  * REQUIRED: startTime (phase has started, no end yet)
103
109
  */
104
- interface AgentLifecycleStartedEvent$1 extends AgentLifecycleEventBase$1 {
110
+ interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
105
111
  stage: 'started';
106
112
  startTime: number;
107
113
  iteration?: number;
@@ -110,7 +116,7 @@ interface AgentLifecycleStartedEvent$1 extends AgentLifecycleEventBase$1 {
110
116
  * Lifecycle completed event - emitted when a phase succeeds
111
117
  * REQUIRED: startTime, endTime, duration (phase has finished successfully)
112
118
  */
113
- interface AgentLifecycleCompletedEvent$1 extends AgentLifecycleEventBase$1 {
119
+ interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
114
120
  stage: 'completed';
115
121
  startTime: number;
116
122
  endTime: number;
@@ -126,7 +132,7 @@ interface AgentLifecycleCompletedEvent$1 extends AgentLifecycleEventBase$1 {
126
132
  * Lifecycle failed event - emitted when a phase fails
127
133
  * REQUIRED: startTime, endTime, duration, error (phase has finished with error)
128
134
  */
129
- interface AgentLifecycleFailedEvent$1 extends AgentLifecycleEventBase$1 {
135
+ interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
130
136
  stage: 'failed';
131
137
  startTime: number;
132
138
  endTime: number;
@@ -138,23 +144,23 @@ interface AgentLifecycleFailedEvent$1 extends AgentLifecycleEventBase$1 {
138
144
  * Union type for all lifecycle events
139
145
  * Discriminated by 'stage' field for type narrowing
140
146
  */
141
- type AgentLifecycleEvent$1 = AgentLifecycleStartedEvent$1 | AgentLifecycleCompletedEvent$1 | AgentLifecycleFailedEvent$1;
147
+ type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent;
142
148
  /**
143
149
  * Placeholder data for MVP
144
150
  * Will be typed per actionType in future
145
151
  */
146
- interface ActionPlaceholderData$1 {
152
+ interface ActionPlaceholderData {
147
153
  message: string;
148
154
  }
149
155
  /**
150
156
  * Iteration event - captures activities during agent iterations
151
157
  * Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
152
158
  */
153
- interface AgentIterationEvent$1 {
159
+ interface AgentIterationEvent {
154
160
  type: 'agent';
155
161
  agentId: string;
156
162
  lifecycle: 'iteration';
157
- eventType: IterationEventType$1;
163
+ eventType: IterationEventType;
158
164
  iteration: number;
159
165
  sessionId?: string;
160
166
  startTime: number;
@@ -162,13 +168,13 @@ interface AgentIterationEvent$1 {
162
168
  duration: number;
163
169
  output?: string;
164
170
  actionType?: string;
165
- data?: ActionPlaceholderData$1;
171
+ data?: ActionPlaceholderData;
166
172
  }
167
173
  /**
168
174
  * Tool call event - captures individual tool executions during iterations
169
175
  * Provides granular timing for each tool invocation
170
176
  */
171
- interface AgentToolCallEvent$1 {
177
+ interface AgentToolCallEvent {
172
178
  type: 'agent';
173
179
  agentId: string;
174
180
  lifecycle: 'iteration';
@@ -188,19 +194,19 @@ interface AgentToolCallEvent$1 {
188
194
  * Union type for all agent log contexts
189
195
  * 3 event types total (lifecycle, iteration, tool-call)
190
196
  */
191
- type AgentLogContext$1 = AgentLifecycleEvent$1 | AgentIterationEvent$1 | AgentToolCallEvent$1;
197
+ type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent;
192
198
 
193
199
  /**
194
200
  * Base execution logger for Execution Engine
195
201
  */
196
- type ExecutionLogLevel$1 = 'debug' | 'info' | 'warn' | 'error';
202
+ type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error';
197
203
 
198
- type LogContext$1 = WorkflowLogContext$1 | AgentLogContext$1;
199
- interface ExecutionLogMessage$1 {
200
- level: ExecutionLogLevel$1;
204
+ type LogContext = WorkflowLogContext | AgentLogContext;
205
+ interface ExecutionLogMessage {
206
+ level: ExecutionLogLevel;
201
207
  message: string;
202
208
  timestamp: number;
203
- context?: LogContext$1;
209
+ context?: LogContext;
204
210
  }
205
211
 
206
212
  /**
@@ -211,7 +217,125 @@ interface ExecutionLogMessage$1 {
211
217
  * Supported form field types for action payloads
212
218
  * Maps to Mantine form components
213
219
  */
214
- type FormFieldType$1 = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'radio' | 'richtext';
220
+ type FormFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'radio' | 'richtext';
221
+ /**
222
+ * Form field definition
223
+ */
224
+ interface FormField {
225
+ /** Field key in payload object */
226
+ name: string;
227
+ /** Field label for UI */
228
+ label: string;
229
+ /** Field type (determines UI component) */
230
+ type: FormFieldType;
231
+ /** Default value */
232
+ defaultValue?: unknown;
233
+ /** Required field */
234
+ required?: boolean;
235
+ /** Placeholder text */
236
+ placeholder?: string;
237
+ /** Help text */
238
+ description?: string;
239
+ /** Options for select/radio */
240
+ options?: Array<{
241
+ label: string;
242
+ value: string | number;
243
+ }>;
244
+ /** Min/max for number */
245
+ min?: number;
246
+ max?: number;
247
+ /** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
248
+ defaultValueFromContext?: string;
249
+ }
250
+ /**
251
+ * Form schema for action payload collection
252
+ */
253
+ interface FormSchema {
254
+ /** Form title */
255
+ title?: string;
256
+ /** Form description */
257
+ description?: string;
258
+ /** Form fields */
259
+ fields: FormField[];
260
+ }
261
+
262
+ /**
263
+ * Command View Types
264
+ *
265
+ * Unified type definitions for the Command View graph visualization.
266
+ * These types are used by both backend serialization and frontend rendering.
267
+ *
268
+ * Command View shows the resource graph: agents, workflows, triggers, integrations,
269
+ * external resources, and human checkpoints with their relationships.
270
+ */
271
+
272
+ /**
273
+ * Extended agent metadata for Command View
274
+ * Includes model and capability information for graph display
275
+ */
276
+ interface CommandViewAgent extends ResourceDefinition {
277
+ type: 'agent';
278
+ modelProvider: string;
279
+ modelId: string;
280
+ toolCount: number;
281
+ hasKnowledgeMap: boolean;
282
+ hasMemory: boolean;
283
+ sessionCapable: boolean;
284
+ }
285
+ /**
286
+ * Extended workflow metadata for Command View
287
+ * Includes step information for graph display
288
+ */
289
+ interface CommandViewWorkflow extends ResourceDefinition {
290
+ type: 'workflow';
291
+ stepCount: number;
292
+ entryPoint: string;
293
+ }
294
+ /**
295
+ * Node type categories for Command View
296
+ * Simplified categorization for UI rendering and layout
297
+ */
298
+ type CommandViewNodeType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
299
+ /**
300
+ * Union type for all node types in Command View
301
+ * Frontend can use this for type-safe node handling
302
+ */
303
+ type CommandViewNode = CommandViewAgent | CommandViewWorkflow | TriggerDefinition | IntegrationDefinition | ExternalResourceDefinition | HumanCheckpointDefinition;
304
+ /**
305
+ * Relationship types between resources
306
+ *
307
+ * - triggers: Resource initiates/starts another resource (orange)
308
+ * - uses: Resource uses an integration (teal)
309
+ * - approval: Resource requires human approval (yellow)
310
+ */
311
+ type RelationshipType = 'triggers' | 'uses' | 'approval';
312
+ /**
313
+ * Command View edge (relationship between resources)
314
+ */
315
+ interface CommandViewEdge {
316
+ id: string;
317
+ source: string;
318
+ target: string;
319
+ relationship: RelationshipType;
320
+ label?: string;
321
+ }
322
+ /**
323
+ * Command View data structure
324
+ * Complete graph data for visualization
325
+ *
326
+ * Backend serializes this once at startup and serves it via /command-view endpoint.
327
+ * Frontend consumes this directly for graph rendering.
328
+ */
329
+ interface CommandViewData {
330
+ workflows: CommandViewWorkflow[];
331
+ agents: CommandViewAgent[];
332
+ triggers: TriggerDefinition[];
333
+ integrations: IntegrationDefinition[];
334
+ externalResources: ExternalResourceDefinition[];
335
+ humanCheckpoints: HumanCheckpointDefinition[];
336
+ edges: CommandViewEdge[];
337
+ domainDefinitions?: DomainDefinition[];
338
+ }
215
339
 
216
340
  /**
217
341
  * Serialized Registry Types
@@ -223,10 +347,10 @@ type FormFieldType$1 = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' |
223
347
  /**
224
348
  * Serialized form field for API responses
225
349
  */
226
- interface SerializedFormField$1 {
350
+ interface SerializedFormField {
227
351
  name: string;
228
352
  label: string;
229
- type: FormFieldType$1;
353
+ type: FormFieldType;
230
354
  defaultValue?: unknown;
231
355
  required?: boolean;
232
356
  placeholder?: string;
@@ -241,16 +365,16 @@ interface SerializedFormField$1 {
241
365
  /**
242
366
  * Serialized form schema for API responses
243
367
  */
244
- interface SerializedFormSchema$1 {
368
+ interface SerializedFormSchema {
245
369
  title?: string;
246
370
  description?: string;
247
- fields: SerializedFormField$1[];
371
+ fields: SerializedFormField[];
248
372
  layout?: 'vertical' | 'horizontal' | 'grid';
249
373
  }
250
374
  /**
251
375
  * Serialized execution form schema for API responses
252
376
  */
253
- interface SerializedExecutionFormSchema$1 extends SerializedFormSchema$1 {
377
+ interface SerializedExecutionFormSchema extends SerializedFormSchema {
254
378
  fieldMappings?: Record<string, string>;
255
379
  submitButton?: {
256
380
  label?: string;
@@ -261,7 +385,7 @@ interface SerializedExecutionFormSchema$1 extends SerializedFormSchema$1 {
261
385
  /**
262
386
  * Serialized schedule config for API responses
263
387
  */
264
- interface SerializedScheduleConfig$1 {
388
+ interface SerializedScheduleConfig {
265
389
  enabled: boolean;
266
390
  defaultSchedule?: string;
267
391
  allowedPatterns?: string[];
@@ -269,23 +393,23 @@ interface SerializedScheduleConfig$1 {
269
393
  /**
270
394
  * Serialized webhook config for API responses
271
395
  */
272
- interface SerializedWebhookConfig$1 {
396
+ interface SerializedWebhookConfig {
273
397
  enabled: boolean;
274
398
  payloadSchema?: unknown;
275
399
  }
276
400
  /**
277
401
  * Serialized execution interface for API responses
278
402
  */
279
- interface SerializedExecutionInterface$1 {
280
- form: SerializedExecutionFormSchema$1;
281
- schedule?: SerializedScheduleConfig$1;
282
- webhook?: SerializedWebhookConfig$1;
403
+ interface SerializedExecutionInterface {
404
+ form: SerializedExecutionFormSchema;
405
+ schedule?: SerializedScheduleConfig;
406
+ webhook?: SerializedWebhookConfig;
283
407
  }
284
408
  /**
285
409
  * Serialized agent definition (JSON-safe)
286
410
  * Result of serializeDefinition(AgentDefinition)
287
411
  */
288
- interface SerializedAgentDefinition$1 {
412
+ interface SerializedAgentDefinition {
289
413
  config: {
290
414
  resourceId: string;
291
415
  name: string;
@@ -334,13 +458,13 @@ interface SerializedAgentDefinition$1 {
334
458
  }>;
335
459
  };
336
460
  metricsConfig?: object;
337
- interface?: SerializedExecutionInterface$1;
461
+ interface?: SerializedExecutionInterface;
338
462
  }
339
463
  /**
340
464
  * Serialized workflow definition (JSON-safe)
341
465
  * Result of serializeDefinition(WorkflowDefinition)
342
466
  */
343
- interface SerializedWorkflowDefinition$1 {
467
+ interface SerializedWorkflowDefinition {
344
468
  config: {
345
469
  resourceId: string;
346
470
  name: string;
@@ -372,7 +496,105 @@ interface SerializedWorkflowDefinition$1 {
372
496
  outputSchema?: object;
373
497
  };
374
498
  metricsConfig?: object;
375
- interface?: SerializedExecutionInterface$1;
499
+ interface?: SerializedExecutionInterface;
500
+ }
501
+
502
+ /**
503
+ * Model Configuration
504
+ * Centralized model information, configuration, options, constraints, and validation
505
+ * Single source of truth for all model-related definitions
506
+ * Update manually when pricing changes or new models are added
507
+ */
508
+
509
+ /**
510
+ * Supported Open AI models (direct SDK access)
511
+ */
512
+ type OpenAIModel = 'gpt-5' | 'gpt-5.4-mini' | 'gpt-5.4-nano';
513
+ /**
514
+ * Supported OpenRouter models (explicit union for type safety)
515
+ */
516
+ type OpenRouterModel = 'openrouter/z-ai/glm-5';
517
+ /**
518
+ * Supported Google models (direct SDK access)
519
+ */
520
+ type GoogleModel = 'gemini-3-flash-preview' | 'gemini-3.1-flash-lite-preview';
521
+ /**
522
+ * Supported Anthropic models (direct SDK access via @anthropic-ai/sdk)
523
+ */
524
+ type AnthropicModel = 'claude-sonnet-4-5';
525
+ /** Supported LLM models */
526
+ type LLMModel = OpenAIModel | OpenRouterModel | GoogleModel | AnthropicModel | 'mock';
527
+ /**
528
+ * GPT-5 model options schema
529
+ */
530
+ declare const GPT5OptionsSchema: z.ZodObject<{
531
+ reasoning_effort: z.ZodOptional<z.ZodEnum<{
532
+ minimal: "minimal";
533
+ low: "low";
534
+ medium: "medium";
535
+ high: "high";
536
+ }>>;
537
+ verbosity: z.ZodOptional<z.ZodEnum<{
538
+ low: "low";
539
+ medium: "medium";
540
+ high: "high";
541
+ }>>;
542
+ }, z.core.$strip>;
543
+ /**
544
+ * OpenRouter model options schema
545
+ * OpenRouter-specific options for routing and transforms
546
+ */
547
+ declare const OpenRouterOptionsSchema: z.ZodObject<{
548
+ transforms: z.ZodOptional<z.ZodArray<z.ZodString>>;
549
+ route: z.ZodOptional<z.ZodEnum<{
550
+ fallback: "fallback";
551
+ }>>;
552
+ }, z.core.$strip>;
553
+ /**
554
+ * Google model options schema
555
+ * Gemini 3 specific options for thinking depth control
556
+ */
557
+ declare const GoogleOptionsSchema: z.ZodObject<{
558
+ thinkingLevel: z.ZodOptional<z.ZodEnum<{
559
+ minimal: "minimal";
560
+ low: "low";
561
+ medium: "medium";
562
+ high: "high";
563
+ }>>;
564
+ }, z.core.$strip>;
565
+ /**
566
+ * Anthropic model options schema
567
+ * Currently empty - future options: budget_tokens for extended thinking
568
+ */
569
+ declare const AnthropicOptionsSchema: z.ZodObject<{}, z.core.$strip>;
570
+ /**
571
+ * Infer TypeScript types from schemas
572
+ */
573
+ type GPT5Options = z.infer<typeof GPT5OptionsSchema>;
574
+ type MockOptions = Record<string, never>;
575
+ type OpenRouterOptions = z.infer<typeof OpenRouterOptionsSchema>;
576
+ type GoogleOptions = z.infer<typeof GoogleOptionsSchema>;
577
+ type AnthropicOptions = z.infer<typeof AnthropicOptionsSchema>;
578
+ type ModelSpecificOptions = GPT5Options | MockOptions | OpenRouterOptions | GoogleOptions | AnthropicOptions;
579
+ /**
580
+ * Model configuration for LLM execution
581
+ * Belongs in resource definition (AgentDefinition, WorkflowDefinition, etc.)
582
+ */
583
+ interface ModelConfig {
584
+ model: LLMModel;
585
+ provider: 'openai' | 'anthropic' | 'openrouter' | 'google' | 'mock';
586
+ apiKey: string;
587
+ temperature?: number;
588
+ /** Maximum output tokens per LLM call. NOT the model's context window — see ModelInfo.maxTokens for that. */
589
+ maxOutputTokens?: number;
590
+ topP?: number;
591
+ /**
592
+ * Model-specific options (flat structure)
593
+ * Options are model-specific, not vendor-specific
594
+ * Available options defined in MODEL_INFO per model
595
+ * Validated at build time via validateModelOptions()
596
+ */
597
+ modelOptions?: ModelSpecificOptions;
376
598
  }
377
599
 
378
600
  /**
@@ -410,13 +632,13 @@ interface WorkflowNodeVisualizerData {
410
632
  * Use-case agnostic types that describe the purpose of each entry
411
633
  * Memory types mirror action types for clarity and filtering
412
634
  */
413
- type MemoryEntryType$1 = 'context' | 'input' | 'reasoning' | 'tool-result' | 'delegation-result' | 'error';
635
+ type MemoryEntryType = 'context' | 'input' | 'reasoning' | 'tool-result' | 'delegation-result' | 'error';
414
636
  /**
415
637
  * Memory entry - represents a single entry in agent memory
416
638
  * Stored in agent memory, translated by adapters to vendor-specific formats
417
639
  */
418
- interface MemoryEntry$1 {
419
- type: MemoryEntryType$1;
640
+ interface MemoryEntry {
641
+ type: MemoryEntryType;
420
642
  content: string;
421
643
  timestamp: number;
422
644
  turnNumber: number | null;
@@ -426,20 +648,20 @@ interface MemoryEntry$1 {
426
648
  * Agent memory - Self-orchestrated memory with session + working storage
427
649
  * Agent has full control over what persists, framework handles auto-compaction
428
650
  */
429
- interface AgentMemory$1 {
651
+ interface AgentMemory {
430
652
  /**
431
653
  * Session memory - Persists for session/conversation duration
432
654
  * Never auto-trimmed by framework
433
655
  * Agent-managed key-value store for critical information
434
656
  * Agent provides strings, framework wraps in MemoryEntry
435
657
  */
436
- sessionMemory: Record<string, MemoryEntry$1>;
658
+ sessionMemory: Record<string, MemoryEntry>;
437
659
  /**
438
660
  * Working memory - Execution history
439
661
  * Automatically compacted by framework when needed
440
662
  * Agent doesn't control compaction
441
663
  */
442
- history: MemoryEntry$1[];
664
+ history: MemoryEntry[];
443
665
  }
444
666
 
445
667
  type Json = string | number | boolean | null | {
@@ -3097,6 +3319,62 @@ type SupabaseApiKey = Tables<'api_keys'>;
3097
3319
  /** API response type for API key list items (omits sensitive key_hash) */
3098
3320
  type ApiKeyListItem = Omit<SupabaseApiKey, 'key_hash'>;
3099
3321
 
3322
+ /**
3323
+ * Agent timeline and observability types
3324
+ * Used for UI timeline visualization and backend processing
3325
+ */
3326
+
3327
+ /**
3328
+ * Sub-activity within an iteration
3329
+ * Represents reasoning, actions, or tool calls with timing
3330
+ */
3331
+ interface SubActivity {
3332
+ type: 'reasoning' | 'action' | 'tool-call';
3333
+ startTime: number;
3334
+ endTime: number;
3335
+ duration: number;
3336
+ details: AgentIterationEvent | AgentToolCallEvent;
3337
+ }
3338
+ /**
3339
+ * Agent iteration state
3340
+ * Aggregates lifecycle events and sub-activities for a single iteration
3341
+ */
3342
+ interface AgentIteration {
3343
+ iterationNumber: number;
3344
+ status: 'running' | 'completed' | 'failed' | 'pending';
3345
+ iterationEvents: AgentIterationEvent[];
3346
+ duration?: number;
3347
+ timestamp: number;
3348
+ subActivities: SubActivity[];
3349
+ startTime?: number;
3350
+ endTime?: number;
3351
+ }
3352
+ /**
3353
+ * Agent lifecycle node state
3354
+ * Represents initialization or completion phase
3355
+ */
3356
+ interface AgentLifecycleNode {
3357
+ type: 'initialization' | 'completion';
3358
+ status: 'running' | 'completed' | 'failed' | 'pending';
3359
+ duration?: number;
3360
+ timestamp?: number;
3361
+ startTime?: number;
3362
+ endTime?: number;
3363
+ }
3364
+ /**
3365
+ * Complete agent execution data for timeline visualization
3366
+ * Parsed from execution logs
3367
+ */
3368
+ interface AgentIterationData {
3369
+ initialization: AgentLifecycleNode;
3370
+ iterations: AgentIteration[];
3371
+ completion: AgentLifecycleNode;
3372
+ currentIteration: number | null;
3373
+ totalIterations: number;
3374
+ totalDuration?: number;
3375
+ status: 'running' | 'completed' | 'failed' | 'warning';
3376
+ }
3377
+
3100
3378
  /** Raw database row type for acq_deals table */
3101
3379
  type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
3102
3380
  type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing';
@@ -3131,11 +3409,162 @@ interface DealListItem extends AcqDealRow {
3131
3409
  contact: DealContact | null;
3132
3410
  }
3133
3411
 
3412
+ /**
3413
+ * Action configuration for HITL tasks
3414
+ * Defines available user actions and their behavior
3415
+ */
3416
+ interface ActionConfig {
3417
+ /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
3418
+ id: string;
3419
+ /** Display label for UI button */
3420
+ label: string;
3421
+ /** Button variant/style */
3422
+ type: 'primary' | 'secondary' | 'danger' | 'outline';
3423
+ /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
3424
+ icon?: string;
3425
+ /** Button color (Mantine theme colors) */
3426
+ color?: string;
3427
+ /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
3428
+ variant?: string;
3429
+ /** Execution target (agent/workflow to invoke) */
3430
+ target?: {
3431
+ resourceType: 'agent' | 'workflow';
3432
+ resourceId: string;
3433
+ /**
3434
+ * Optional session ID for agent continuation.
3435
+ * If provided, invokes a new turn on the existing session instead of standalone execution.
3436
+ * Only valid when resourceType is 'agent'.
3437
+ */
3438
+ sessionId?: string;
3439
+ };
3440
+ /** Form schema for collecting action-specific data */
3441
+ form?: FormSchema;
3442
+ /** Payload template for pre-filling forms */
3443
+ payloadTemplate?: unknown;
3444
+ /** Requires confirmation dialog */
3445
+ requiresConfirmation?: boolean;
3446
+ /** Confirmation message */
3447
+ confirmationMessage?: string;
3448
+ /** Help text / tooltip */
3449
+ description?: string;
3450
+ }
3451
+
3134
3452
  /**
3135
3453
  * Origin resource type - where an execution/task originated from.
3136
3454
  * Used for audit trails and tracking execution lineage.
3137
3455
  */
3138
- type OriginResourceType$1 = 'agent' | 'workflow' | 'scheduler' | 'api';
3456
+ type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
3457
+ /**
3458
+ * Origin tracking metadata - who/what created this execution/task.
3459
+ * Used by both TaskScheduler and CommandQueue for complete audit trails.
3460
+ */
3461
+ interface OriginTracking {
3462
+ originExecutionId: string;
3463
+ originResourceType: OriginResourceType;
3464
+ originResourceId: string;
3465
+ }
3466
+
3467
+ /**
3468
+ * Command queue task with flexible action system
3469
+ */
3470
+ interface Task extends OriginTracking {
3471
+ id: string;
3472
+ organizationId: string;
3473
+ actions: ActionConfig[];
3474
+ context: unknown;
3475
+ selectedAction?: string;
3476
+ actionPayload?: unknown;
3477
+ description?: string;
3478
+ priority: number;
3479
+ /** Optional checkpoint identifier for grouping related human approval tasks */
3480
+ humanCheckpoint?: string;
3481
+ status: QueueTaskStatus;
3482
+ /**
3483
+ * Target resource tracking — mirrors origin columns.
3484
+ * Set when task is created; patchable to redirect execution to a different resource.
3485
+ */
3486
+ targetResourceId?: string;
3487
+ targetResourceType?: 'agent' | 'workflow';
3488
+ /**
3489
+ * Execution ID for the action that runs AFTER user approval.
3490
+ * NULL until execution starts.
3491
+ *
3492
+ * Naming distinction:
3493
+ * - originExecutionId = Parent execution that CREATED the HITL task
3494
+ * - targetExecutionId = Child execution that RUNS AFTER user approval
3495
+ */
3496
+ targetExecutionId?: string;
3497
+ createdAt: Date;
3498
+ completedAt?: Date;
3499
+ completedBy?: string;
3500
+ expiresAt?: Date;
3501
+ idempotencyKey?: string | null;
3502
+ }
3503
+ /**
3504
+ * Task status values
3505
+ * - pending: awaiting action
3506
+ * - processing: execution in progress after user approval
3507
+ * - completed: action was taken and execution succeeded
3508
+ * - failed: execution failed, task can be retried
3509
+ * - expired: timed out before action
3510
+ */
3511
+ type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
3512
+ /**
3513
+ * Parameters for patching mutable metadata on a task
3514
+ */
3515
+ interface PatchTaskParams {
3516
+ humanCheckpoint?: string | null;
3517
+ description?: string;
3518
+ priority?: number;
3519
+ context?: Record<string, unknown>;
3520
+ actions?: unknown[];
3521
+ targetResourceId?: string | null;
3522
+ targetResourceType?: 'agent' | 'workflow' | null;
3523
+ targetExecutionId?: string;
3524
+ status?: 'pending' | 'failed' | 'completed';
3525
+ }
3526
+
3527
+ /**
3528
+ * Checkpoint list item for sidebar grouping
3529
+ * The id field contains the resourceId of the human checkpoint
3530
+ */
3531
+ interface CheckpointListItem {
3532
+ /** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
3533
+ id: string;
3534
+ /** Display name (same as id, or "Ungrouped" for null) */
3535
+ name: string;
3536
+ /** Task count for this checkpoint */
3537
+ count: number;
3538
+ }
3539
+ /**
3540
+ * Status counts for pie chart display
3541
+ */
3542
+ interface StatusCounts {
3543
+ pending: number;
3544
+ completed: number;
3545
+ expired: number;
3546
+ }
3547
+ /**
3548
+ * Priority counts for donut chart display
3549
+ */
3550
+ interface PriorityCounts {
3551
+ critical: number;
3552
+ high: number;
3553
+ medium: number;
3554
+ low: number;
3555
+ }
3556
+ /**
3557
+ * Response from GET /command-queue/checkpoints endpoint
3558
+ */
3559
+ interface CheckpointListResponse {
3560
+ checkpoints: CheckpointListItem[];
3561
+ /** Total tasks across all checkpoints */
3562
+ total: number;
3563
+ /** Breakdown by status for donut chart */
3564
+ statusCounts: StatusCounts;
3565
+ /** Breakdown by priority for donut chart */
3566
+ priorityCounts: PriorityCounts;
3567
+ }
3139
3568
 
3140
3569
  /**
3141
3570
  * Target for schedule execution - identifies what resource to execute.
@@ -3153,11 +3582,11 @@ interface ScheduleTarget {
3153
3582
  */
3154
3583
  interface ScheduleOriginTracking {
3155
3584
  originExecutionId?: string;
3156
- originResourceType?: OriginResourceType$1;
3585
+ originResourceType?: OriginResourceType;
3157
3586
  originResourceId?: string;
3158
3587
  }
3159
- type TaskScheduleConfig = RecurringScheduleConfig$1 | RelativeScheduleConfig$1 | AbsoluteScheduleConfig$1;
3160
- interface RecurringScheduleConfig$1 {
3588
+ type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
3589
+ interface RecurringScheduleConfig {
3161
3590
  type: 'recurring';
3162
3591
  cron?: string;
3163
3592
  interval?: 'daily' | 'weekly' | 'monthly';
@@ -3167,24 +3596,24 @@ interface RecurringScheduleConfig$1 {
3167
3596
  endAt?: string | null;
3168
3597
  overduePolicy?: 'skip' | 'execute';
3169
3598
  }
3170
- interface RelativeScheduleConfig$1 {
3599
+ interface RelativeScheduleConfig {
3171
3600
  type: 'relative';
3172
3601
  anchorAt: string;
3173
3602
  anchorLabel?: string;
3174
- items: RelativeScheduleItem$1[];
3603
+ items: RelativeScheduleItem[];
3175
3604
  overduePolicy?: 'skip' | 'execute';
3176
3605
  }
3177
- interface RelativeScheduleItem$1 {
3606
+ interface RelativeScheduleItem {
3178
3607
  offset: string;
3179
3608
  payload: Record<string, unknown>;
3180
3609
  label?: string;
3181
3610
  }
3182
- interface AbsoluteScheduleConfig$1 {
3611
+ interface AbsoluteScheduleConfig {
3183
3612
  type: 'absolute';
3184
- items: AbsoluteScheduleItem$1[];
3613
+ items: AbsoluteScheduleItem[];
3185
3614
  overduePolicy?: 'skip' | 'execute';
3186
3615
  }
3187
- interface AbsoluteScheduleItem$1 {
3616
+ interface AbsoluteScheduleItem {
3188
3617
  runAt: string;
3189
3618
  payload: Record<string, unknown>;
3190
3619
  label?: string;
@@ -3207,6 +3636,24 @@ interface TaskSchedule extends ScheduleOriginTracking {
3207
3636
  updatedAt: Date;
3208
3637
  }
3209
3638
 
3639
+ /**
3640
+ * Wire-format DTO for notification API responses.
3641
+ * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
3642
+ * Used by frontend hooks that consume /api/notifications.
3643
+ */
3644
+ interface NotificationDTO {
3645
+ id: string;
3646
+ userId: string;
3647
+ organizationId: string;
3648
+ category: string;
3649
+ title: string;
3650
+ message: string;
3651
+ actionUrl: string | null;
3652
+ read: boolean;
3653
+ readAt: string | null;
3654
+ createdAt: string;
3655
+ }
3656
+
3210
3657
  type MessageType = MessageEvent['type'];
3211
3658
  /**
3212
3659
  * Session Data Transfer Object (DTO)
@@ -3221,7 +3668,7 @@ interface SessionDTO {
3221
3668
  turnCount: number;
3222
3669
  isEnded: boolean;
3223
3670
  title?: string | null;
3224
- memorySnapshot?: AgentMemory$1;
3671
+ memorySnapshot?: AgentMemory;
3225
3672
  metadata?: Record<string, unknown> | null;
3226
3673
  createdAt: Date;
3227
3674
  updatedAt: Date;
@@ -3364,100 +3811,454 @@ interface MembershipWithDetails extends OrganizationMembership {
3364
3811
  config?: MembershipFeatureConfig;
3365
3812
  }
3366
3813
 
3367
- /**
3368
- * Base Execution Engine type definitions
3369
- * Core types shared across all Execution Engine resources
3370
- */
3814
+ interface OAuthToken extends Record<string, unknown> {
3815
+ provider: string;
3816
+ accessToken: string;
3817
+ refreshToken: string;
3818
+ expiresAt: string;
3819
+ tokenType: 'Bearer';
3820
+ scope?: string;
3821
+ }
3822
+ interface OAuthProviderConfig {
3823
+ id: string;
3824
+ name: string;
3825
+ authUrl: string;
3826
+ tokenUrl: string;
3827
+ scopes?: string[];
3828
+ authParams?: Record<string, string>;
3829
+ tokenExchange: 'basic-auth' | 'form-encoded' | 'json-body';
3830
+ usePKCE?: boolean;
3831
+ customAuthFlow?: (config: OAuthProviderConfig, state: OAuthState) => URL;
3832
+ customTokenExchange?: (code: string, config: OAuthProviderConfig) => Promise<OAuthToken>;
3833
+ }
3834
+ interface OAuthState {
3835
+ organizationId: string;
3836
+ nonce: string;
3837
+ timestamp: number;
3838
+ credentialName: string;
3839
+ provider: string;
3840
+ }
3371
3841
 
3372
- /**
3373
- * Unified message event type - covers all message types in sessions
3374
- * Replaces separate SessionTurnMessages and AgentActivityEvent mechanisms
3375
- */
3376
- /**
3377
- * Structured action metadata attached to assistant messages.
3378
- * Frontend reads this instead of parsing text prefixes.
3379
- */
3380
- type AssistantAction = {
3381
- kind: 'navigate';
3382
- path: string;
3383
- reason: string;
3384
- } | {
3385
- kind: 'update_filters';
3386
- timeRange: string | null;
3387
- statusFilter: string | null;
3388
- searchQuery: string | null;
3389
- };
3390
- type MessageEvent = {
3391
- type: 'user_message';
3392
- text: string;
3393
- } | {
3394
- type: 'assistant_message';
3395
- text: string;
3396
- _action?: AssistantAction;
3397
- } | {
3398
- type: 'agent:started';
3399
- } | {
3400
- type: 'agent:completed';
3401
- } | {
3402
- type: 'agent:error';
3403
- error: string;
3404
- } | {
3405
- type: 'agent:reasoning';
3842
+ interface BaseAICall {
3843
+ callSequence: number;
3844
+ callType: 'agent-reasoning' | 'agent-completion' | 'workflow-step' | 'tool' | 'other';
3845
+ model: LLMModel;
3846
+ inputTokens: number;
3847
+ outputTokens: number;
3848
+ costUsd: number;
3849
+ latencyMs: number;
3850
+ context?: AICallContext;
3851
+ }
3852
+ type AICallContext = AgentReasoningContext | AgentCompletionContext | WorkflowStepContext | ToolCallContext | OtherCallContext;
3853
+ interface AgentReasoningContext {
3854
+ type: 'agent-reasoning';
3406
3855
  iteration: number;
3407
- reasoning: string;
3408
- } | {
3409
- type: 'agent:tool_call';
3410
- toolName: string;
3411
- args: Record<string, unknown>;
3412
- } | {
3413
- type: 'agent:tool_result';
3856
+ actionsPlanned?: string[];
3857
+ sessionId?: string;
3858
+ turnNumber?: number;
3859
+ }
3860
+ interface AgentCompletionContext {
3861
+ type: 'agent-completion';
3862
+ attempt: 1 | 2;
3863
+ validationFailed?: boolean;
3864
+ sessionId?: string;
3865
+ turnNumber?: number;
3866
+ }
3867
+ interface WorkflowStepContext {
3868
+ type: 'workflow-step';
3869
+ stepId: string;
3870
+ stepName?: string;
3871
+ stepSequence?: number;
3872
+ }
3873
+ interface ToolCallContext {
3874
+ type: 'tool';
3414
3875
  toolName: string;
3415
- success: boolean;
3416
- result?: unknown;
3417
- error?: string;
3418
- };
3876
+ parentIteration?: number;
3877
+ parentStepId?: string;
3878
+ }
3879
+ interface OtherCallContext {
3880
+ type: 'other';
3881
+ description?: string;
3882
+ metadata?: Record<string, unknown>;
3883
+ }
3884
+ type AICallRecord = BaseAICall;
3419
3885
  /**
3420
- * NOTE: AIResource interface has been removed and replaced with ResourceDefinition
3421
- * from registry/types.ts. All resources (executable and non-executable) now extend
3422
- * the unified ResourceDefinition base interface.
3423
- *
3424
- * AgentConfig and WorkflowConfig now extend ResourceDefinition directly.
3425
- * See packages/core/src/registry/types.ts for the base interface definition.
3886
+ * Time range selector for dashboard metrics
3426
3887
  */
3427
- type AIResourceDefinition = SerializedWorkflowDefinition$1 | SerializedAgentDefinition$1;
3428
-
3888
+ type TimeRange = '1h' | '24h' | '7d' | '30d';
3429
3889
  /**
3430
- * Resource Registry type definitions
3890
+ * Execution health metrics response
3891
+ * Success rate, P95 duration, execution counts, and trend data
3892
+ * trendData includes executionCount for throughput visualization (eliminates separate API call)
3431
3893
  */
3432
-
3894
+ interface ExecutionHealthMetrics {
3895
+ successRate: number;
3896
+ p95Duration: number;
3897
+ totalExecutions: number;
3898
+ trendData: Array<{
3899
+ time: string;
3900
+ rate: number;
3901
+ successCount: number;
3902
+ errorCount: number;
3903
+ warningCount: number;
3904
+ executionCount: number;
3905
+ }>;
3906
+ statusCounts: {
3907
+ success: number;
3908
+ failed: number;
3909
+ pending: number;
3910
+ warning: number;
3911
+ };
3912
+ peakPeriod: string;
3913
+ granularity: 'hour' | 'day';
3914
+ }
3433
3915
  /**
3434
- * Environment/deployment status for resources
3916
+ * Error analysis metrics response
3917
+ * Error categories and top failing resources
3435
3918
  */
3436
- type ResourceStatus$1 = 'dev' | 'prod';
3919
+ interface ErrorAnalysisMetrics {
3920
+ totalErrors: number;
3921
+ errorsByCategory: Array<{
3922
+ category: string;
3923
+ count: number;
3924
+ percentage: number;
3925
+ }>;
3926
+ topFailingResources: Array<{
3927
+ resourceId: string;
3928
+ name: string;
3929
+ errorCount: number;
3930
+ failureRate: number;
3931
+ }>;
3932
+ }
3437
3933
  /**
3438
- * All resource types in the platform
3439
- * Used as the discriminator field in ResourceDefinition
3934
+ * Business impact metrics response
3935
+ * ROI, labor savings, and cost analysis
3440
3936
  */
3441
- type ResourceType$1 = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
3937
+ interface BusinessImpactMetrics {
3938
+ totalSavingsUsd: number;
3939
+ totalCostUsd: number;
3940
+ netSavingsUsd: number;
3941
+ roi: number;
3942
+ }
3442
3943
  /**
3443
- * Base interface for ALL platform resources
3444
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
3944
+ * Cost breakdown metrics response
3945
+ * Per-resource cost analysis
3445
3946
  */
3446
- interface ResourceDefinition$1 {
3447
- /** Unique resource identifier */
3448
- resourceId: string;
3449
- /** Display name */
3450
- name: string;
3947
+ interface CostBreakdownMetrics {
3948
+ resources: Array<{
3949
+ resourceId: string;
3950
+ totalCostUsd: number;
3951
+ executionCount: number;
3952
+ avgCostUsd: number;
3953
+ }>;
3954
+ }
3955
+ /**
3956
+ * Detailed execution metrics response
3957
+ * Full execution metrics with AI call breakdown
3958
+ */
3959
+ interface ExecutionMetricsDetail {
3960
+ executionId: string;
3961
+ organizationId: string;
3962
+ resourceId: string;
3963
+ totalInputTokens: number;
3964
+ totalOutputTokens: number;
3965
+ totalCostUsd: number;
3966
+ aiCallCount: number;
3967
+ aiCalls: AICallRecord[];
3968
+ durationMs?: number;
3969
+ automationSavingsUsd?: number;
3970
+ createdAt: string;
3971
+ }
3972
+ /**
3973
+ * Dashboard metrics response
3974
+ * Aggregates core observability metrics in a single response
3975
+ * Note: Throughput data is now included in executionHealth.trendData.executionCount
3976
+ */
3977
+ interface DashboardMetrics {
3978
+ executionHealth: ExecutionHealthMetrics;
3979
+ costBreakdown: CostBreakdownMetrics;
3980
+ businessImpact: BusinessImpactMetrics;
3981
+ /** ISO timestamp of the currently active deployment, or null if none */
3982
+ activeDeploymentDate: string | null;
3983
+ /** Deployment version of the active deployment, or null if none */
3984
+ activeDeploymentVersion: string | null;
3985
+ }
3986
+ /**
3987
+ * Error record for list view (ErrorBreakdownTable)
3988
+ */
3989
+ interface ErrorRecord {
3990
+ id: string;
3991
+ timestamp: string;
3992
+ errorType: string;
3993
+ message: string;
3994
+ executionId: string;
3995
+ resourceId: string;
3996
+ resourceName: string;
3997
+ severity: 'critical' | 'warning' | 'info';
3998
+ category: ExecutionErrorCategory;
3999
+ resolved: boolean;
4000
+ resolvedAt: string | null;
4001
+ resolvedBy: string | null;
4002
+ }
4003
+ /**
4004
+ * Full error detail for modal view (ErrorDetailsModal)
4005
+ */
4006
+ interface ErrorDetailFull extends ErrorRecord {
4007
+ stackTrace?: string;
4008
+ retryAttempt?: number;
4009
+ stepName?: string;
4010
+ stepSequence?: number;
4011
+ errorContext?: Record<string, unknown>;
4012
+ executionContext?: Record<string, unknown>;
4013
+ }
4014
+ /**
4015
+ * Error details API response (paginated)
4016
+ */
4017
+ interface ErrorDetailResponse {
4018
+ errors: ErrorRecord[];
4019
+ total: number;
4020
+ page: number;
4021
+ limit: number;
4022
+ }
4023
+ /**
4024
+ * Error trend data for time-series charts
4025
+ */
4026
+ interface ErrorTrend {
4027
+ time: string;
4028
+ errorCount: number;
4029
+ criticalCount: number;
4030
+ warningCount: number;
4031
+ infoCount: number;
4032
+ }
4033
+ /**
4034
+ * Failing resource data for health monitoring
4035
+ */
4036
+ interface FailingResource {
4037
+ resourceId: string;
4038
+ resourceName: string;
4039
+ errorCount: number;
4040
+ criticalCount: number;
4041
+ warningCount: number;
4042
+ mostCommonError: string;
4043
+ }
4044
+ /**
4045
+ * Summary of executions for a single resource
4046
+ * Used by RecentExecutionsByResource dashboard component
4047
+ */
4048
+ interface ResourceExecutionSummary {
4049
+ resourceId: string;
4050
+ resourceType: string;
4051
+ resourceName: string | null;
4052
+ lastExecution: string;
4053
+ totalExecutions: number;
4054
+ successCount: number;
4055
+ failureCount: number;
4056
+ warningCount: number;
4057
+ successRate: number;
4058
+ }
4059
+ /**
4060
+ * Response from getRecentExecutionsByResource endpoint
4061
+ */
4062
+ interface RecentExecutionsByResourceResponse {
4063
+ resources: ResourceExecutionSummary[];
4064
+ }
4065
+ /** Resource identifier for health queries */
4066
+ interface ResourceIdentifier {
4067
+ entityType: string;
4068
+ entityId: string;
4069
+ }
4070
+ /** Time-bucketed health data point */
4071
+ interface ResourceHealthDataPoint {
4072
+ time: string;
4073
+ success: number;
4074
+ failure: number;
4075
+ warning: number;
4076
+ rate: number;
4077
+ }
4078
+ /** Health data for a single resource */
4079
+ interface ResourceHealth {
4080
+ entityType: string;
4081
+ entityId: string;
4082
+ entityName: string | null;
4083
+ trendData: ResourceHealthDataPoint[];
4084
+ summary: {
4085
+ total: number;
4086
+ successRate: number;
4087
+ };
4088
+ }
4089
+ /** Batch response with all requested resources */
4090
+ interface ResourcesHealthResponse {
4091
+ resources: ResourceHealth[];
4092
+ }
4093
+ /**
4094
+ * Cost trend data point for time-series charts
4095
+ * Represents a single time bucket (hour or day)
4096
+ */
4097
+ interface CostTrendDataPoint {
4098
+ time: string;
4099
+ totalCostUsd: number;
4100
+ executionCount: number;
4101
+ avgCostPerExecution: number;
4102
+ }
4103
+ /**
4104
+ * Cost trends response (time-series data)
4105
+ */
4106
+ interface CostTrendsResponse {
4107
+ trendData: CostTrendDataPoint[];
4108
+ granularity: 'hour' | 'day';
4109
+ totalCostUsd: number;
4110
+ totalExecutions: number;
4111
+ }
4112
+ /**
4113
+ * Cost summary response with MTD and projections
4114
+ */
4115
+ interface CostSummaryResponse {
4116
+ current: {
4117
+ totalCostUsd: number;
4118
+ executionCount: number;
4119
+ };
4120
+ previous: {
4121
+ totalCostUsd: number;
4122
+ executionCount: number;
4123
+ };
4124
+ mtd: {
4125
+ totalCostUsd: number;
4126
+ daysElapsed: number;
4127
+ };
4128
+ projection: {
4129
+ monthlyCostUsd: number;
4130
+ confidence: 'low' | 'medium' | 'high';
4131
+ };
4132
+ trend: {
4133
+ changePercent: number;
4134
+ direction: 'up' | 'down' | 'flat';
4135
+ };
4136
+ }
4137
+ /**
4138
+ * Cost by model data for model-level breakdown
4139
+ */
4140
+ interface CostByModelData {
4141
+ model: string;
4142
+ totalCostUsd: number;
4143
+ callCount: number;
4144
+ totalInputTokens: number;
4145
+ totalOutputTokens: number;
4146
+ avgCostPerCall: number;
4147
+ }
4148
+ /**
4149
+ * Cost by model response
4150
+ */
4151
+ interface CostByModelResponse {
4152
+ models: CostByModelData[];
4153
+ totalCostUsd: number;
4154
+ totalCallCount: number;
4155
+ }
4156
+
4157
+ /**
4158
+ * Base Execution Engine type definitions
4159
+ * Core types shared across all Execution Engine resources
4160
+ */
4161
+
4162
+ /**
4163
+ * Unified message event type - covers all message types in sessions
4164
+ * Replaces separate SessionTurnMessages and AgentActivityEvent mechanisms
4165
+ */
4166
+ /**
4167
+ * Structured action metadata attached to assistant messages.
4168
+ * Frontend reads this instead of parsing text prefixes.
4169
+ */
4170
+ type AssistantAction = {
4171
+ kind: 'navigate';
4172
+ path: string;
4173
+ reason: string;
4174
+ } | {
4175
+ kind: 'update_filters';
4176
+ timeRange: string | null;
4177
+ statusFilter: string | null;
4178
+ searchQuery: string | null;
4179
+ };
4180
+ type MessageEvent = {
4181
+ type: 'user_message';
4182
+ text: string;
4183
+ } | {
4184
+ type: 'assistant_message';
4185
+ text: string;
4186
+ _action?: AssistantAction;
4187
+ } | {
4188
+ type: 'agent:started';
4189
+ } | {
4190
+ type: 'agent:completed';
4191
+ } | {
4192
+ type: 'agent:error';
4193
+ error: string;
4194
+ } | {
4195
+ type: 'agent:reasoning';
4196
+ iteration: number;
4197
+ reasoning: string;
4198
+ } | {
4199
+ type: 'agent:tool_call';
4200
+ toolName: string;
4201
+ args: Record<string, unknown>;
4202
+ } | {
4203
+ type: 'agent:tool_result';
4204
+ toolName: string;
4205
+ success: boolean;
4206
+ result?: unknown;
4207
+ error?: string;
4208
+ };
4209
+ /**
4210
+ * NOTE: AIResource interface has been removed and replaced with ResourceDefinition
4211
+ * from registry/types.ts. All resources (executable and non-executable) now extend
4212
+ * the unified ResourceDefinition base interface.
4213
+ *
4214
+ * AgentConfig and WorkflowConfig now extend ResourceDefinition directly.
4215
+ * See packages/core/src/registry/types.ts for the base interface definition.
4216
+ */
4217
+ type AIResourceDefinition = SerializedWorkflowDefinition | SerializedAgentDefinition;
4218
+
4219
+ /**
4220
+ * Supported integration types
4221
+ *
4222
+ * These represent the available integration adapters that can be used with tools.
4223
+ * Each integration type corresponds to an adapter implementation.
4224
+ *
4225
+ * Note: Concrete adapter implementations are deferred until needed.
4226
+ * This type provides compile-time safety and auto-completion for tool definitions.
4227
+ */
4228
+ type IntegrationType = 'gmail' | 'google-sheets' | 'slack' | 'github' | 'linear' | 'attio' | 'airtable' | 'salesforce' | 'hubspot' | 'stripe' | 'twilio' | 'sendgrid' | 'mailgun' | 'zapier' | 'webhook' | 'apify' | 'instantly' | 'resend' | 'signature-api' | 'dropbox' | 'anymailfinder' | 'tomba' | 'millionverifier';
4229
+
4230
+ /**
4231
+ * Resource Registry type definitions
4232
+ */
4233
+
4234
+ /**
4235
+ * Environment/deployment status for resources
4236
+ */
4237
+ type ResourceStatus = 'dev' | 'prod';
4238
+ /**
4239
+ * All resource types in the platform
4240
+ * Used as the discriminator field in ResourceDefinition
4241
+ */
4242
+ type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
4243
+ /**
4244
+ * Base interface for ALL platform resources
4245
+ * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
4246
+ */
4247
+ interface ResourceDefinition {
4248
+ /** Unique resource identifier */
4249
+ resourceId: string;
4250
+ /** Display name */
4251
+ name: string;
3451
4252
  /** Purpose and functionality description */
3452
4253
  description: string;
3453
4254
  /** Version for change tracking and evolution */
3454
4255
  version: string;
3455
4256
  /** Resource type discriminator */
3456
- type: ResourceType$1;
4257
+ type: ResourceType;
3457
4258
  /** Environment/deployment status */
3458
- status: ResourceStatus$1;
4259
+ status: ResourceStatus;
3459
4260
  /** Domain tags for filtering and organization */
3460
- domains?: ResourceDomain$1[];
4261
+ domains?: ResourceDomain[];
3461
4262
  /** Whether the agent supports multi-turn sessions (agents only) */
3462
4263
  sessionCapable?: boolean;
3463
4264
  /** Whether the resource is local (monorepo) or remote (externally deployed) */
@@ -3465,13 +4266,247 @@ interface ResourceDefinition$1 {
3465
4266
  /** Whether this resource is archived and should be excluded from registration and deployment */
3466
4267
  archived?: boolean;
3467
4268
  }
4269
+ /**
4270
+ * Domain definition for Command View filtering
4271
+ *
4272
+ * Domains are organizational metadata for UI filtering/grouping.
4273
+ * No execution impact - purely for visualization.
4274
+ *
4275
+ * @example
4276
+ * {
4277
+ * id: 'support',
4278
+ * name: 'Customer Support',
4279
+ * description: 'Ticket triage, knowledge base, escalations',
4280
+ * color: 'green',
4281
+ * icon: 'IconHeadset'
4282
+ * }
4283
+ */
4284
+ interface DomainDefinition {
4285
+ /** Unique identifier (e.g., 'support') */
4286
+ id: string;
4287
+ /** Display name (e.g., 'Customer Support') */
4288
+ name: string;
4289
+ /** Purpose description */
4290
+ description: string;
4291
+ /** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
4292
+ color?: string;
4293
+ /** Optional Tabler icon name (e.g., 'IconHeadset') */
4294
+ icon?: string;
4295
+ }
4296
+ /** Webhook provider identifiers */
4297
+ type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test';
4298
+ /** Webhook trigger configuration */
4299
+ interface WebhookTriggerConfig {
4300
+ /** Provider identifier */
4301
+ provider: WebhookProviderType;
4302
+ /** Event type for documentation (not used for matching - workflow handles routing) */
4303
+ event?: string;
4304
+ /** Optional filtering (e.g., specific form ID for Fillout) */
4305
+ filter?: Record<string, string>;
4306
+ /** References credential in credentials table for per-org webhook secrets */
4307
+ credentialName?: string;
4308
+ }
4309
+ /** Schedule trigger configuration */
4310
+ interface ScheduleTriggerConfig {
4311
+ /** Cron expression (e.g., '0 6 * * *') */
4312
+ cron: string;
4313
+ /** Optional timezone (default: UTC) */
4314
+ timezone?: string;
4315
+ }
4316
+ /** Event trigger configuration */
4317
+ interface EventTriggerConfig {
4318
+ /** Internal event type */
4319
+ eventType: string;
4320
+ /** Event source */
4321
+ source?: string;
4322
+ }
4323
+ /** Union of all trigger configs */
4324
+ type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig;
4325
+ /**
4326
+ * Trigger metadata - entry points that initiate resource execution
4327
+ *
4328
+ * Triggers represent how executions start: webhooks from external services,
4329
+ * scheduled cron jobs, platform events, or manual user actions.
4330
+ *
4331
+ * BREAKING CHANGES (2025-11-30):
4332
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
4333
+ * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
4334
+ * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
4335
+ * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
4336
+ * - triggers object now includes `externalResources` option
4337
+ *
4338
+ * @example
4339
+ * // TriggerDefinition - metadata only
4340
+ * {
4341
+ * resourceId: 'trigger-new-order',
4342
+ * type: 'trigger',
4343
+ * triggerType: 'webhook',
4344
+ * name: 'New Order',
4345
+ * description: 'Webhook from Shopify on new orders',
4346
+ * version: '1.0.0',
4347
+ * status: 'prod',
4348
+ * webhookPath: '/webhooks/shopify/orders'
4349
+ * }
4350
+ *
4351
+ * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
4352
+ * // relationships: {
4353
+ * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
4354
+ * // }
4355
+ */
4356
+ interface TriggerDefinition extends ResourceDefinition {
4357
+ /** Resource type discriminator (narrowed from base union) */
4358
+ type: 'trigger';
4359
+ /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
4360
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
4361
+ /** Type-specific configuration */
4362
+ config?: TriggerConfig;
4363
+ /** For webhook triggers: path like '/webhooks/shopify/orders' */
4364
+ webhookPath?: string;
4365
+ /** For schedule triggers: cron expression like '0 6 * * *' */
4366
+ schedule?: string;
4367
+ /** For event triggers: event type like 'low-stock-alert' */
4368
+ eventType?: string;
4369
+ }
4370
+ /**
4371
+ * Integration metadata - external service connections
4372
+ *
4373
+ * References credentials table for actual connection. No connection status
4374
+ * stored here (queried at runtime from credentials table).
4375
+ *
4376
+ * BREAKING CHANGES (2025-11-30):
4377
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
4378
+ * - Field renames: `id` -> `resourceId` (inherited)
4379
+ * - New required field: `status` (inherited) - organizations must add status to all integrations
4380
+ * - New required field: `version` (inherited) - organizations must add version to all integrations
4381
+ * - New required field: `type: 'integration'` (inherited) - resource type discriminator
4382
+ *
4383
+ * @example
4384
+ * {
4385
+ * resourceId: 'integration-shopify-prod',
4386
+ * type: 'integration',
4387
+ * provider: 'shopify',
4388
+ * credentialName: 'shopify-prod',
4389
+ * name: 'Shopify Production',
4390
+ * description: 'E-commerce platform',
4391
+ * version: '1.0.0',
4392
+ * status: 'prod'
4393
+ * }
4394
+ */
4395
+ interface IntegrationDefinition extends ResourceDefinition {
4396
+ /** Resource type discriminator (narrowed from base union) */
4397
+ type: 'integration';
4398
+ /** Integration provider type */
4399
+ provider: IntegrationType;
4400
+ /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
4401
+ credentialName: string;
4402
+ }
4403
+ /**
4404
+ * External platform type
4405
+ * Supported third-party automation platforms
4406
+ */
4407
+ type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other';
4408
+ /**
4409
+ * External automation resource metadata
4410
+ *
4411
+ * Represents workflows/automations running on third-party platforms
4412
+ * (n8n, Make, Zapier, etc.) for visualization in Command View.
4413
+ *
4414
+ * NOTE: This is metadata ONLY for visualization. No execution logic,
4415
+ * no API integration with external platforms, no status syncing.
4416
+ *
4417
+ * BREAKING CHANGES (2025-11-30):
4418
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
4419
+ * - Field renames: `id` -> `resourceId` (inherited)
4420
+ * - New required field: `version` (inherited) - organizations must add version to all external resources
4421
+ * - New required field: `type: 'external'` (inherited) - resource type discriminator
4422
+ * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
4423
+ *
4424
+ * @example
4425
+ * {
4426
+ * resourceId: 'external-n8n-order-sync',
4427
+ * type: 'external',
4428
+ * version: '1.0.0',
4429
+ * platform: 'n8n',
4430
+ * name: 'Shopify Order Sync',
4431
+ * description: 'Legacy n8n workflow for syncing Shopify orders',
4432
+ * status: 'prod',
4433
+ * platformUrl: 'https://n8n.client.com/workflow/123',
4434
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
4435
+ * uses: { integrations: ['integration-shopify-prod'] }
4436
+ * }
4437
+ */
4438
+ interface ExternalResourceDefinition extends ResourceDefinition {
4439
+ /** Resource type discriminator (narrowed from base union) */
4440
+ type: 'external';
4441
+ /** Platform type */
4442
+ platform: ExternalPlatform;
4443
+ /** Link to external platform (e.g., n8n workflow editor URL) */
4444
+ platformUrl?: string;
4445
+ /** Platform's internal ID/reference */
4446
+ externalId?: string;
4447
+ /** What this external resource triggers (external -> internal) */
4448
+ triggers?: {
4449
+ /** Elevasis workflow resourceIds this external automation triggers */
4450
+ workflows?: string[];
4451
+ /** Elevasis agent resourceIds this external automation triggers */
4452
+ agents?: string[];
4453
+ };
4454
+ /** Integrations this external resource uses (shared credentials) */
4455
+ uses?: {
4456
+ /** Integration IDs this external automation uses */
4457
+ integrations?: string[];
4458
+ };
4459
+ }
4460
+ /**
4461
+ * Human Checkpoint definition - human decision points in automation
4462
+ *
4463
+ * Represents where human judgment is deployed in the automation landscape.
4464
+ * Tasks with matching command_queue_group are routed to this checkpoint.
4465
+ *
4466
+ * BREAKING CHANGES (2025-11-30):
4467
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
4468
+ * - Field renames: `id` -> `resourceId` (inherited)
4469
+ * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
4470
+ * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
4471
+ * - New required field: `type: 'human'` (inherited) - resource type discriminator
4472
+ *
4473
+ * @example
4474
+ * {
4475
+ * resourceId: 'sales-approval',
4476
+ * type: 'human',
4477
+ * name: 'Sales Approval Queue',
4478
+ * description: 'High-value order approvals for sales team',
4479
+ * version: '1.0.0',
4480
+ * status: 'prod',
4481
+ * requestedBy: { agents: ['order-processor-agent'] },
4482
+ * routesTo: { agents: ['order-fulfillment-agent'] }
4483
+ * }
4484
+ */
4485
+ interface HumanCheckpointDefinition extends ResourceDefinition {
4486
+ /** Resource type discriminator (narrowed from base union) */
4487
+ type: 'human';
4488
+ /** Resources that create tasks for this checkpoint */
4489
+ requestedBy?: {
4490
+ /** Agent resourceIds that request approval here */
4491
+ agents?: string[];
4492
+ /** Workflow resourceIds that request approval here */
4493
+ workflows?: string[];
4494
+ };
4495
+ /** Resources that receive approved decisions */
4496
+ routesTo?: {
4497
+ /** Agent resourceIds that handle approved tasks */
4498
+ agents?: string[];
4499
+ /** Workflow resourceIds that handle approved tasks */
4500
+ workflows?: string[];
4501
+ };
4502
+ }
3468
4503
 
3469
4504
  /**
3470
4505
  * Standard Domain Definitions
3471
4506
  * Centralized domain constants and definitions for all organization resources.
3472
4507
  */
3473
4508
 
3474
- declare const DOMAINS$1: {
4509
+ declare const DOMAINS: {
3475
4510
  readonly INBOUND_PIPELINE: "inbound-pipeline";
3476
4511
  readonly LEAD_GEN_PIPELINE: "lead-gen-pipeline";
3477
4512
  readonly SUPPORT: "support";
@@ -3491,22 +4526,73 @@ declare const DOMAINS$1: {
3491
4526
  * ResourceDomain - Strongly typed domain identifier
3492
4527
  * Use this type for all domain references to ensure compile-time validation.
3493
4528
  */
3494
- type ResourceDomain$1 = (typeof DOMAINS$1)[keyof typeof DOMAINS$1];
4529
+ type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS];
3495
4530
 
3496
- type ExecutionStatus$1 = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
3497
- interface APIExecutionSummary$1 {
4531
+ type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
4532
+ /**
4533
+ * Event sent when new execution starts
4534
+ */
4535
+ interface ExecutionStartedEvent {
4536
+ type: 'new-execution';
4537
+ resourceId: string;
4538
+ executionId: string;
4539
+ timestamp: number;
4540
+ data?: undefined;
4541
+ }
4542
+ /**
4543
+ * Event sent when execution log message is emitted
4544
+ */
4545
+ interface ExecutionLogEvent {
4546
+ type: 'log';
4547
+ resourceId: string;
4548
+ executionId: string;
4549
+ timestamp: number;
4550
+ data: {
4551
+ log: ExecutionLogMessage;
4552
+ };
4553
+ }
4554
+ /**
4555
+ * Event sent when execution completes (success or failure)
4556
+ */
4557
+ interface ExecutionCompleteEvent {
4558
+ type: 'execution-complete';
4559
+ resourceId: string;
4560
+ executionId: string;
4561
+ timestamp: number;
4562
+ data: {
4563
+ success: boolean;
4564
+ status?: ExecutionStatus;
4565
+ result?: unknown;
4566
+ error?: string;
4567
+ };
4568
+ }
4569
+ /**
4570
+ * Connection confirmation event
4571
+ */
4572
+ interface ExecutionConnectedEvent {
4573
+ type: 'connected';
4574
+ resourceId: string;
4575
+ executionId?: undefined;
4576
+ timestamp: number;
4577
+ data?: undefined;
4578
+ }
4579
+ /**
4580
+ * Union of all execution SSE events
4581
+ */
4582
+ type ExecutionSSEEvent = ExecutionStartedEvent | ExecutionLogEvent | ExecutionCompleteEvent | ExecutionConnectedEvent;
4583
+ interface APIExecutionSummary {
3498
4584
  id: string;
3499
- status: ExecutionStatus$1;
4585
+ status: ExecutionStatus;
3500
4586
  startTime: number;
3501
4587
  endTime?: number;
3502
- resourceStatus?: ResourceStatus$1;
4588
+ resourceStatus?: ResourceStatus;
3503
4589
  }
3504
- interface APIExecutionDetail extends APIExecutionSummary$1 {
3505
- executionLogs: ExecutionLogMessage$1[];
4590
+ interface APIExecutionDetail extends APIExecutionSummary {
4591
+ executionLogs: ExecutionLogMessage[];
3506
4592
  input?: unknown;
3507
4593
  result?: unknown;
3508
4594
  error?: string;
3509
- resourceStatus: ResourceStatus$1;
4595
+ resourceStatus: ResourceStatus;
3510
4596
  apiVersion?: string | null;
3511
4597
  resourceVersion?: string | null;
3512
4598
  sdkVersion?: string | null;
@@ -3514,13 +4600,189 @@ interface APIExecutionDetail extends APIExecutionSummary$1 {
3514
4600
  archivedLogCount?: number;
3515
4601
  }
3516
4602
  interface APIExecutionListResponse {
3517
- executions: APIExecutionSummary$1[];
4603
+ executions: APIExecutionSummary[];
3518
4604
  total?: number;
3519
4605
  limit?: number;
3520
4606
  offset?: number;
3521
4607
  hasMore?: boolean;
3522
4608
  }
3523
4609
 
4610
+ /**
4611
+ * @deprecated Use TimeRange from '@repo/core' directly. Kept as alias for backward compatibility.
4612
+ */
4613
+ type StatsTimeRange = TimeRange;
4614
+ /** Stats returned by /command-view/stats (counts only, no error details) */
4615
+ interface ResourceStats {
4616
+ resourceId: string;
4617
+ totalRuns: number;
4618
+ successCount: number;
4619
+ failureCount: number;
4620
+ warningCount: number;
4621
+ lastRunAt: string | null;
4622
+ }
4623
+ /** Response from /command-view/resource-errors (on-demand) */
4624
+ interface ResourceErrorsResponse {
4625
+ resourceId: string;
4626
+ errors: ErrorSummary[];
4627
+ totalErrors: number;
4628
+ timeRange: StatsTimeRange;
4629
+ }
4630
+ interface ErrorSummary {
4631
+ executionId: string;
4632
+ errorType: string;
4633
+ errorMessage: string;
4634
+ occurredAt: string;
4635
+ }
4636
+ /** Single execution summary for Recent Executions list in command view */
4637
+ interface CommandViewExecution {
4638
+ executionId: string;
4639
+ status: ExecutionStatus;
4640
+ startedAt: string;
4641
+ completedAt: string | null;
4642
+ errorMessage: string | null;
4643
+ }
4644
+ /** Response from /command-view/resource-executions (on-demand) */
4645
+ interface ResourceExecutionsResponse {
4646
+ resourceId: string;
4647
+ executions: CommandViewExecution[];
4648
+ totalExecutions: number;
4649
+ timeRange: StatsTimeRange;
4650
+ page: number;
4651
+ limit: number;
4652
+ }
4653
+ interface HumanCheckpointStats {
4654
+ checkpointId: string;
4655
+ pendingCount: number;
4656
+ completedCount: number;
4657
+ expiredCount: number;
4658
+ lastDecisionAt: string | null;
4659
+ }
4660
+ /** Response from /command-view/stats */
4661
+ interface CommandViewStatsResponse {
4662
+ resources: Record<string, ResourceStats>;
4663
+ humanCheckpoints: Record<string, HumanCheckpointStats>;
4664
+ timeRange: StatsTimeRange;
4665
+ generatedAt: string;
4666
+ }
4667
+
4668
+ /**
4669
+ * Notification SSE Event Types
4670
+ *
4671
+ * Type-safe definitions for notification-related SSE events
4672
+ */
4673
+ /**
4674
+ * Event sent when notification unread count changes
4675
+ */
4676
+ interface NotificationCountUpdatedEvent {
4677
+ type: 'unread_count_updated';
4678
+ timestamp: number;
4679
+ data: {
4680
+ count: number;
4681
+ };
4682
+ }
4683
+ /**
4684
+ * Union of all notification SSE events
4685
+ */
4686
+ type NotificationSSEEvent = NotificationCountUpdatedEvent;
4687
+
4688
+ type ActivityType = 'workflow_execution' | 'agent_run' | 'hitl_action' | 'webhook_received' | 'webhook_executed' | 'webhook_failed' | 'credential_change' | 'api_key_change' | 'deployment_change' | 'membership_change';
4689
+ type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed';
4690
+ interface Activity {
4691
+ id: string;
4692
+ organizationId: string;
4693
+ activityType: ActivityType;
4694
+ status: ActivityStatus;
4695
+ title: string;
4696
+ description: string | null;
4697
+ entityType: string;
4698
+ entityId: string;
4699
+ entityName: string | null;
4700
+ metadata: Record<string, unknown> | null;
4701
+ actorId: string | null;
4702
+ actorType: string | null;
4703
+ occurredAt: Date;
4704
+ createdAt: Date;
4705
+ }
4706
+
4707
+ /**
4708
+ * Activity SSE Event Types
4709
+ *
4710
+ * Type-safe definitions for activity-related SSE events
4711
+ */
4712
+
4713
+ /**
4714
+ * Event sent when new activity is created
4715
+ */
4716
+ interface ActivityCreatedEvent {
4717
+ type: 'activity';
4718
+ timestamp: number;
4719
+ data: Activity;
4720
+ }
4721
+ /**
4722
+ * Connection confirmation event
4723
+ */
4724
+ interface ActivityConnectedEvent {
4725
+ type: 'connected';
4726
+ timestamp: number;
4727
+ data?: undefined;
4728
+ }
4729
+ /**
4730
+ * Union of all activity SSE events
4731
+ */
4732
+ type ActivitySSEEvent = ActivityCreatedEvent | ActivityConnectedEvent;
4733
+
4734
+ /**
4735
+ * Command Queue SSE Event Types
4736
+ *
4737
+ * Type-safe definitions for command queue related SSE events
4738
+ */
4739
+
4740
+ /**
4741
+ * Event sent when command queue task is updated
4742
+ */
4743
+ interface CommandQueueTaskUpdatedEvent {
4744
+ type: 'task_updated';
4745
+ timestamp: number;
4746
+ data: {
4747
+ task: Task;
4748
+ };
4749
+ }
4750
+ /**
4751
+ * Connection confirmation event
4752
+ */
4753
+ interface CommandQueueConnectedEvent {
4754
+ type: 'connected';
4755
+ timestamp: number;
4756
+ data?: undefined;
4757
+ }
4758
+ /**
4759
+ * Event sent when action execution completes successfully
4760
+ */
4761
+ interface CommandQueueExecutionCompletedEvent {
4762
+ type: 'execution_completed';
4763
+ timestamp: number;
4764
+ data: {
4765
+ taskId: string;
4766
+ targetExecutionId: string;
4767
+ };
4768
+ }
4769
+ /**
4770
+ * Event sent when action execution fails
4771
+ */
4772
+ interface CommandQueueExecutionFailedEvent {
4773
+ type: 'execution_failed';
4774
+ timestamp: number;
4775
+ data: {
4776
+ taskId: string;
4777
+ targetExecutionId?: string;
4778
+ error: string;
4779
+ };
4780
+ }
4781
+ /**
4782
+ * Union of all command queue SSE events
4783
+ */
4784
+ type CommandQueueSSEEvent = CommandQueueTaskUpdatedEvent | CommandQueueConnectedEvent | CommandQueueExecutionCompletedEvent | CommandQueueExecutionFailedEvent;
4785
+
3524
4786
  /**
3525
4787
  * Execution Runner Types
3526
4788
  *
@@ -3528,6 +4790,11 @@ interface APIExecutionListResponse {
3528
4790
  * Used by both API (apps/api) and frontend (apps/command-center).
3529
4791
  */
3530
4792
 
4793
+ interface ExecutionMetrics {
4794
+ tokenCount?: number;
4795
+ stepCount?: number;
4796
+ toolCallCount?: number;
4797
+ }
3531
4798
  interface ExecutionRunnerCatalogItem {
3532
4799
  resourceId: string;
3533
4800
  resourceName: string;
@@ -3535,9 +4802,68 @@ interface ExecutionRunnerCatalogItem {
3535
4802
  description?: string;
3536
4803
  status: 'dev' | 'prod';
3537
4804
  version: string;
3538
- interface: SerializedExecutionInterface$1;
4805
+ interface: SerializedExecutionInterface;
4806
+ }
4807
+ interface ExecutionSummary {
4808
+ id: string;
4809
+ resourceId: string;
4810
+ resourceName: string;
4811
+ status: ExecutionStatus;
4812
+ startedAt: string;
4813
+ completedAt?: string;
4814
+ durationMs?: number;
4815
+ metrics?: ExecutionMetrics;
4816
+ input?: unknown;
4817
+ output?: unknown;
4818
+ error?: {
4819
+ message: string;
4820
+ };
3539
4821
  }
3540
4822
 
4823
+ /**
4824
+ * Execution history item.
4825
+ * Represents a single execution triggered by a schedule.
4826
+ */
4827
+ declare const ExecutionHistoryItemSchema: z.ZodObject<{
4828
+ id: z.ZodString;
4829
+ createdAt: z.ZodString;
4830
+ status: z.ZodEnum<{
4831
+ completed: "completed";
4832
+ failed: "failed";
4833
+ running: "running";
4834
+ cancelled: "cancelled";
4835
+ }>;
4836
+ step: z.ZodNullable<z.ZodNumber>;
4837
+ itemLabel: z.ZodNullable<z.ZodString>;
4838
+ duration: z.ZodNullable<z.ZodNumber>;
4839
+ error: z.ZodNullable<z.ZodString>;
4840
+ }, z.core.$strip>;
4841
+ /**
4842
+ * Execution history response.
4843
+ * Returned by GET /schedules/:id/executions with pagination.
4844
+ */
4845
+ declare const ExecutionHistoryResponseSchema: z.ZodObject<{
4846
+ executions: z.ZodArray<z.ZodObject<{
4847
+ id: z.ZodString;
4848
+ createdAt: z.ZodString;
4849
+ status: z.ZodEnum<{
4850
+ completed: "completed";
4851
+ failed: "failed";
4852
+ running: "running";
4853
+ cancelled: "cancelled";
4854
+ }>;
4855
+ step: z.ZodNullable<z.ZodNumber>;
4856
+ itemLabel: z.ZodNullable<z.ZodString>;
4857
+ duration: z.ZodNullable<z.ZodNumber>;
4858
+ error: z.ZodNullable<z.ZodString>;
4859
+ }, z.core.$strip>>;
4860
+ total: z.ZodNumber;
4861
+ limit: z.ZodNumber;
4862
+ offset: z.ZodNumber;
4863
+ }, z.core.$strip>;
4864
+ type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>;
4865
+ type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>;
4866
+
3541
4867
  /**
3542
4868
  * Deployment types — browser-safe
3543
4869
  *
@@ -3559,2352 +4885,141 @@ interface Deployment {
3559
4885
  updatedAt: string;
3560
4886
  }
3561
4887
 
3562
- /**
3563
- * Workflow-specific logging types and utilities
3564
- */
3565
-
3566
-
3567
-
3568
- // Workflow start/end log context
3569
- interface WorkflowExecutionContext {
3570
- type: 'workflow'
3571
- contextType: 'workflow-execution'
3572
- executionId: string
3573
- workflowId: string
3574
- workflowName?: string
3575
- organizationId: string
3576
- executionPath?: string[]
3577
- }
3578
-
3579
- // Workflow failure log context
3580
- interface WorkflowFailureContext {
3581
- type: 'workflow'
3582
- contextType: 'workflow-failure'
3583
- executionId: string
3584
- workflowId: string
3585
- error: string
3586
- }
3587
-
3588
- // Step started log context
3589
- interface StepStartedContext {
3590
- type: 'workflow'
3591
- contextType: 'step-started'
3592
- stepId: string
3593
- stepStatus: 'started'
3594
- input: unknown
3595
- startTime: number // Explicit start timestamp for timeline
3596
- }
3597
-
3598
- // Step completed log context
3599
- interface StepCompletedContext {
3600
- type: 'workflow'
3601
- contextType: 'step-completed'
3602
- stepId: string
3603
- stepStatus: 'completed'
3604
- output: unknown
3605
- duration: number
3606
- isTerminal: boolean
3607
- startTime: number // Explicit start timestamp for timeline
3608
- endTime: number // Explicit end timestamp for timeline
3609
- }
3610
-
3611
- // Step failed log context
3612
- interface StepFailedContext {
3613
- type: 'workflow'
3614
- contextType: 'step-failed'
3615
- stepId: string
3616
- stepStatus: 'failed'
3617
- error: string
3618
- duration: number
3619
- startTime: number // Explicit start timestamp for timeline
3620
- endTime: number // Explicit end timestamp for timeline
3621
- }
3622
-
3623
- // Conditional routing log context
3624
- interface ConditionalRouteContext {
3625
- type: 'workflow'
3626
- contextType: 'conditional-route'
3627
- stepId: string
3628
- target: string
3629
- error?: string
3630
- }
3631
-
3632
- // Execution path log context
3633
- interface ExecutionPathContext {
3634
- type: 'workflow'
3635
- contextType: 'execution-path'
3636
- executionPath: string[]
3637
- }
3638
-
3639
- // Union of all workflow log contexts
3640
- type WorkflowLogContext =
3641
- | WorkflowExecutionContext
3642
- | WorkflowFailureContext
3643
- | StepStartedContext
3644
- | StepCompletedContext
3645
- | StepFailedContext
3646
- | ConditionalRouteContext
3647
- | ExecutionPathContext
3648
-
3649
- /**
3650
- * Agent-specific logging types
3651
- * Simplified 2-event model: lifecycle, iteration
3652
- *
3653
- * Design Philosophy:
3654
- * - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
3655
- * - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
3656
- */
3657
-
3658
-
3659
-
3660
- // ============================================================================
3661
- // FORMAL TYPES
3662
- // ============================================================================
3663
-
3664
- /**
3665
- * Agent lifecycle stages
3666
- * Universal checkpoints that apply to all agent executions
3667
- */
3668
- type AgentLifecycle = 'initialization' | 'iteration' | 'completion'
3669
-
3670
- /**
3671
- * Iteration event types
3672
- * Activities that occur during agent iterations
3673
- */
3674
- type IterationEventType = 'reasoning' | 'action' | 'tool-call'
3675
-
3676
- // ============================================================================
3677
- // LIFECYCLE EVENTS (Structural Checkpoints)
3678
- // ============================================================================
3679
-
3680
- /**
3681
- * Base fields shared by all lifecycle events
3682
- */
3683
- interface AgentLifecycleEventBase {
3684
- type: 'agent'
3685
- agentId: string
3686
- lifecycle: AgentLifecycle
3687
- sessionId?: string // Optional: only present when agent runs in session context
3688
- }
3689
-
3690
- /**
3691
- * Lifecycle started event - emitted when a phase begins
3692
- * REQUIRED: startTime (phase has started, no end yet)
3693
- */
3694
- interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
3695
- stage: 'started'
3696
- startTime: number // REQUIRED: Phase start timestamp
3697
- iteration?: number // Only for 'iteration' lifecycle
3698
- }
3699
-
3700
- /**
3701
- * Lifecycle completed event - emitted when a phase succeeds
3702
- * REQUIRED: startTime, endTime, duration (phase has finished successfully)
3703
- */
3704
- interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
3705
- stage: 'completed'
3706
- startTime: number // REQUIRED: Phase start timestamp
3707
- endTime: number // REQUIRED: Phase end timestamp
3708
- duration: number // REQUIRED: Calculated duration (endTime - startTime)
3709
- iteration?: number // Only for 'iteration' lifecycle
3710
-
3711
- // Optional fields specific to certain lifecycles
3712
- attempts?: number // Only for 'completion' lifecycle (tracks output generation attempts: 1 or 2)
3713
- memorySize?: {
3714
- sessionMemoryKeys: number
3715
- historyEntries: number
3716
- } // Only for 'completion' lifecycle (memory snapshot metadata)
3717
- }
3718
-
3719
- /**
3720
- * Lifecycle failed event - emitted when a phase fails
3721
- * REQUIRED: startTime, endTime, duration, error (phase has finished with error)
3722
- */
3723
- interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
3724
- stage: 'failed'
3725
- startTime: number // REQUIRED: Phase start timestamp
3726
- endTime: number // REQUIRED: Phase end timestamp
3727
- duration: number // REQUIRED: Calculated duration (endTime - startTime)
3728
- error: string // REQUIRED: Error message
3729
- iteration?: number // Only for 'iteration' lifecycle
3730
- }
3731
-
3732
- /**
3733
- * Union type for all lifecycle events
3734
- * Discriminated by 'stage' field for type narrowing
3735
- */
3736
- type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent
3737
-
3738
- // ============================================================================
3739
- // ITERATION EVENTS (Execution Activities)
3740
- // ============================================================================
3741
-
3742
- /**
3743
- * Placeholder data for MVP
3744
- * Will be typed per actionType in future
3745
- */
3746
- interface ActionPlaceholderData {
3747
- message: string
3748
- }
3749
-
3750
- /**
3751
- * Iteration event - captures activities during agent iterations
3752
- * Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
3753
- */
3754
- interface AgentIterationEvent {
3755
- type: 'agent'
3756
- agentId: string
3757
- lifecycle: 'iteration' // Always iteration
3758
- eventType: IterationEventType
3759
- iteration: number
3760
- sessionId?: string // Optional: only present when agent runs in session context
3761
-
3762
- // Timeline timing fields (v2 - Clean Break)
3763
- startTime: number // Activity start timestamp
3764
- endTime: number // Activity end timestamp
3765
- duration: number // Calculated duration (endTime - startTime)
3766
-
3767
- // Conditional fields based on eventType
3768
- output?: string // For reasoning events
3769
- actionType?: string // For action events (tool-use, delegate, memory-write, etc.)
3770
- data?: ActionPlaceholderData // For action events
3771
- }
3772
-
3773
- /**
3774
- * Tool call event - captures individual tool executions during iterations
3775
- * Provides granular timing for each tool invocation
3776
- */
3777
- interface AgentToolCallEvent {
3778
- type: 'agent'
3779
- agentId: string
3780
- lifecycle: 'iteration' // Always iteration
3781
- eventType: 'tool-call' // Specific event type for tool calls
3782
- iteration: number
3783
- sessionId?: string // Optional: only present when agent runs in session context
3784
-
3785
- // Tool identification and timing
3786
- toolName: string // Tool identifier
3787
- startTime: number // Tool call start timestamp
3788
- endTime: number // Tool call end timestamp
3789
- duration: number // Calculated duration
3790
-
3791
- // Execution results
3792
- success: boolean // Whether tool execution succeeded
3793
- error?: string // Error message if failed
3794
- input?: Record<string, unknown> // Tool input parameters
3795
- output?: unknown // Tool output result
3796
- }
3797
-
3798
- // ============================================================================
3799
- // UNION TYPES
3800
- // ============================================================================
3801
-
3802
- /**
3803
- * Union type for all agent log contexts
3804
- * 3 event types total (lifecycle, iteration, tool-call)
3805
- */
3806
- type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent
3807
-
3808
- /**
3809
- * Base execution logger for Execution Engine
3810
- */
3811
- type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error'
3812
-
3813
-
3814
- // Union type for all contexts
3815
- type LogContext = WorkflowLogContext | AgentLogContext
3816
-
3817
- // Updated interface with consolidated context
3818
- interface ExecutionLogMessage {
3819
- level: ExecutionLogLevel
3820
- message: string
3821
- timestamp: number
3822
- context?: LogContext
3823
- }
3824
-
3825
- /**
3826
- * Shared form field types for dynamic form generation
3827
- * Used by: Command Queue, Execution Runner UI, future form-based features
3828
- */
3829
-
3830
- /**
3831
- * Supported form field types for action payloads
3832
- * Maps to Mantine form components
3833
- */
3834
- type FormFieldType =
3835
- | 'text' // TextInput
3836
- | 'textarea' // Textarea
3837
- | 'number' // NumberInput
3838
- | 'select' // Select dropdown
3839
- | 'checkbox' // Checkbox
3840
- | 'radio' // Radio group
3841
- | 'richtext' // Rich text editor (TipTap)
3842
-
3843
- /**
3844
- * Form field definition
3845
- */
3846
- interface FormField {
3847
- /** Field key in payload object */
3848
- name: string
3849
-
3850
- /** Field label for UI */
3851
- label: string
3852
-
3853
- /** Field type (determines UI component) */
3854
- type: FormFieldType
3855
-
3856
- /** Default value */
3857
- defaultValue?: unknown
3858
-
3859
- /** Required field */
3860
- required?: boolean
3861
-
3862
- /** Placeholder text */
3863
- placeholder?: string
3864
-
3865
- /** Help text */
3866
- description?: string
3867
-
3868
- /** Options for select/radio */
3869
- options?: Array<{
3870
- label: string
3871
- value: string | number
3872
- }>
3873
-
3874
- /** Min/max for number */
3875
- min?: number
3876
- max?: number
3877
-
3878
- /** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
3879
- defaultValueFromContext?: string
3880
- }
3881
-
3882
- /**
3883
- * Form schema for action payload collection
3884
- */
3885
- interface FormSchema {
3886
- /** Form title */
3887
- title?: string
3888
-
3889
- /** Form description */
3890
- description?: string
3891
-
3892
- /** Form fields */
3893
- fields: FormField[]
3894
- }
3895
-
3896
- /**
3897
- * Error categories for observability grouping and classification.
3898
- * Used to categorize errors in the execution_errors table metadata.
3899
- */
3900
- type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system'
3901
-
3902
- /**
3903
- * Memory type definitions
3904
- * Types for agent memory management with semantic entry types
3905
- */
3906
-
3907
- /**
3908
- * Semantic memory entry types
3909
- * Use-case agnostic types that describe the purpose of each entry
3910
- * Memory types mirror action types for clarity and filtering
3911
- */
3912
- type MemoryEntryType =
3913
- | 'context' // Pre-loaded context entry (before execution)
3914
- | 'input' // User request or event payload
3915
- | 'reasoning' // LLM thought process
3916
- | 'tool-result' // Result from tool execution
3917
- | 'delegation-result' // Result from sub-agent delegation (future)
3918
- | 'error' // Error from failed action (tool error, validation error, etc.)
3919
-
3920
- /**
3921
- * Memory entry - represents a single entry in agent memory
3922
- * Stored in agent memory, translated by adapters to vendor-specific formats
3923
- */
3924
- interface MemoryEntry {
3925
- type: MemoryEntryType
3926
- content: string
3927
- timestamp: number
3928
- turnNumber: number | null // Which turn/execution created this entry (1, 2, 3... for session turns, null for session memory or one-off executions)
3929
- iterationNumber: number | null // Which iteration created this entry (0 = pre-iteration input, null = session memory/non-iteration-specific)
3930
- }
3931
-
3932
- /**
3933
- * Agent memory - Self-orchestrated memory with session + working storage
3934
- * Agent has full control over what persists, framework handles auto-compaction
3935
- */
3936
- interface AgentMemory {
3937
- /**
3938
- * Session memory - Persists for session/conversation duration
3939
- * Never auto-trimmed by framework
3940
- * Agent-managed key-value store for critical information
3941
- * Agent provides strings, framework wraps in MemoryEntry
3942
- */
3943
- sessionMemory: Record<string, MemoryEntry>
3944
-
3945
- /**
3946
- * Working memory - Execution history
3947
- * Automatically compacted by framework when needed
3948
- * Agent doesn't control compaction
3949
- */
3950
- history: MemoryEntry[]
3951
- }
3952
-
3953
- /**
3954
- * Model Configuration
3955
- * Centralized model information, configuration, options, constraints, and validation
3956
- * Single source of truth for all model-related definitions
3957
- * Update manually when pricing changes or new models are added
3958
- */
3959
-
3960
-
3961
-
3962
- // ============================================================================
3963
- // Model Types
3964
- // ============================================================================
3965
-
3966
- /**
3967
- * Supported Open AI models (direct SDK access)
3968
- */
3969
- type OpenAIModel = 'gpt-5' | 'gpt-5.4-mini' | 'gpt-5.4-nano'
3970
-
3971
- /**
3972
- * Supported OpenRouter models (explicit union for type safety)
3973
- */
3974
- type OpenRouterModel = 'openrouter/z-ai/glm-5'
3975
-
3976
- /**
3977
- * Supported Google models (direct SDK access)
3978
- */
3979
- type GoogleModel = 'gemini-3-flash-preview' | 'gemini-3.1-flash-lite-preview'
3980
-
3981
- /**
3982
- * Supported Anthropic models (direct SDK access via @anthropic-ai/sdk)
3983
- */
3984
- type AnthropicModel = 'claude-sonnet-4-5'
3985
-
3986
- /** Supported LLM models */
3987
- type LLMModel = OpenAIModel | OpenRouterModel | GoogleModel | AnthropicModel | 'mock'
3988
-
3989
- // ============================================================================
3990
- // Model Configuration Schemas (Schema-First - Single Source of Truth)
3991
- // ============================================================================
3992
-
3993
- /**
3994
- * GPT-5 model options schema
3995
- */
3996
- declare const GPT5OptionsSchema = z.object({
3997
- reasoning_effort: z.enum(['minimal', 'low', 'medium', 'high']).optional(),
3998
- verbosity: z.enum(['low', 'medium', 'high']).optional()
3999
- })
4000
-
4001
- /**
4002
- * OpenRouter model options schema
4003
- * OpenRouter-specific options for routing and transforms
4004
- */
4005
- declare const OpenRouterOptionsSchema = z.object({
4006
- /** Optional transforms to apply (e.g., 'middle-out' for long context) */
4007
- transforms: z.array(z.string()).optional(),
4008
- /** Routing strategy (e.g., 'fallback' for automatic provider failover) */
4009
- route: z.enum(['fallback']).optional()
4010
- })
4011
-
4012
- /**
4013
- * Google model options schema
4014
- * Gemini 3 specific options for thinking depth control
4015
- */
4016
- declare const GoogleOptionsSchema = z.object({
4017
- /** Thinking level for Gemini 3 models (controls reasoning depth) */
4018
- thinkingLevel: z.enum(['minimal', 'low', 'medium', 'high']).optional()
4019
- })
4020
-
4021
- /**
4022
- * Anthropic model options schema
4023
- * Currently empty - future options: budget_tokens for extended thinking
4024
- */
4025
- declare const AnthropicOptionsSchema = z.object({})
4026
-
4027
- /**
4028
- * Infer TypeScript types from schemas
4029
- */
4030
- type GPT5Options = z.infer<typeof GPT5OptionsSchema>
4031
- type MockOptions = Record<string, never>
4032
- type OpenRouterOptions = z.infer<typeof OpenRouterOptionsSchema>
4033
- type GoogleOptions = z.infer<typeof GoogleOptionsSchema>
4034
- type AnthropicOptions = z.infer<typeof AnthropicOptionsSchema>
4035
- type ModelSpecificOptions = GPT5Options | MockOptions | OpenRouterOptions | GoogleOptions | AnthropicOptions
4036
-
4037
- // ============================================================================
4038
- // Model Configuration
4039
- // ============================================================================
4040
-
4041
- /**
4042
- * Model configuration for LLM execution
4043
- * Belongs in resource definition (AgentDefinition, WorkflowDefinition, etc.)
4044
- */
4045
- interface ModelConfig {
4046
- model: LLMModel
4047
- provider: 'openai' | 'anthropic' | 'openrouter' | 'google' | 'mock'
4048
- apiKey: string
4049
- temperature?: number
4050
- /** Maximum output tokens per LLM call. NOT the model's context window — see ModelInfo.maxTokens for that. */
4051
- maxOutputTokens?: number
4052
- topP?: number
4053
-
4054
- /**
4055
- * Model-specific options (flat structure)
4056
- * Options are model-specific, not vendor-specific
4057
- * Available options defined in MODEL_INFO per model
4058
- * Validated at build time via validateModelOptions()
4059
- */
4060
- modelOptions?: ModelSpecificOptions
4061
- }
4062
-
4063
- // ============================================================================
4064
- // AI Call Tracking Types (SSOT)
4065
- // ============================================================================
4066
-
4067
- interface BaseAICall {
4068
- callSequence: number // 1, 2, 3... (execution-wide universal counter)
4069
- callType: 'agent-reasoning' | 'agent-completion' | 'workflow-step' | 'tool' | 'other'
4070
- model: LLMModel
4071
- inputTokens: number
4072
- outputTokens: number
4073
- costUsd: number // Cost in USD with full decimal precision
4074
- latencyMs: number
4075
- context?: AICallContext
4076
- }
4077
-
4078
- type AICallContext =
4079
- | AgentReasoningContext
4080
- | AgentCompletionContext
4081
- | WorkflowStepContext
4082
- | ToolCallContext
4083
- | OtherCallContext
4084
-
4085
- interface AgentReasoningContext {
4086
- type: 'agent-reasoning'
4087
- iteration: number
4088
- actionsPlanned?: string[]
4089
- sessionId?: string
4090
- turnNumber?: number
4091
- }
4092
-
4093
- interface AgentCompletionContext {
4094
- type: 'agent-completion'
4095
- attempt: 1 | 2
4096
- validationFailed?: boolean
4097
- sessionId?: string
4098
- turnNumber?: number
4099
- }
4100
-
4101
- interface WorkflowStepContext {
4102
- type: 'workflow-step'
4103
- stepId: string
4104
- stepName?: string
4105
- stepSequence?: number
4106
- }
4107
-
4108
- interface ToolCallContext {
4109
- type: 'tool'
4110
- toolName: string
4111
- parentIteration?: number
4112
- parentStepId?: string
4113
- }
4114
-
4115
- interface OtherCallContext {
4116
- type: 'other'
4117
- description?: string
4118
- metadata?: Record<string, unknown>
4119
- }
4120
-
4121
- type AICallRecord = BaseAICall
4122
-
4123
- // ============================================================================
4124
- // API Request/Response Types (Dashboard Observability)
4125
- // ============================================================================
4126
-
4127
- /**
4128
- * Time range selector for dashboard metrics
4129
- */
4130
- type TimeRange = '1h' | '24h' | '7d' | '30d'
4131
-
4132
- /**
4133
- * Execution health metrics response
4134
- * Success rate, P95 duration, execution counts, and trend data
4135
- * trendData includes executionCount for throughput visualization (eliminates separate API call)
4136
- */
4137
- interface ExecutionHealthMetrics {
4138
- successRate: number
4139
- p95Duration: number
4140
- totalExecutions: number
4141
- trendData: Array<{
4142
- time: string
4143
- rate: number
4144
- successCount: number
4145
- errorCount: number
4146
- warningCount: number
4147
- executionCount: number
4148
- }>
4149
- statusCounts: { success: number; failed: number; pending: number; warning: number }
4150
- peakPeriod: string
4151
- granularity: 'hour' | 'day'
4152
- }
4153
-
4154
- /**
4155
- * Error analysis metrics response
4156
- * Error categories and top failing resources
4157
- */
4158
- interface ErrorAnalysisMetrics {
4159
- totalErrors: number
4160
- errorsByCategory: Array<{
4161
- category: string
4162
- count: number
4163
- percentage: number
4164
- }>
4165
- topFailingResources: Array<{
4166
- resourceId: string
4167
- name: string
4168
- errorCount: number
4169
- failureRate: number
4170
- }>
4171
- }
4172
-
4173
- /**
4174
- * Business impact metrics response
4175
- * ROI, labor savings, and cost analysis
4176
- */
4177
- interface BusinessImpactMetrics {
4178
- totalSavingsUsd: number
4179
- totalCostUsd: number
4180
- netSavingsUsd: number
4181
- roi: number
4182
- }
4183
-
4184
- /**
4185
- * Cost breakdown metrics response
4186
- * Per-resource cost analysis
4187
- */
4188
- interface CostBreakdownMetrics {
4189
- resources: Array<{
4190
- resourceId: string
4191
- totalCostUsd: number
4192
- executionCount: number
4193
- avgCostUsd: number
4194
- }>
4195
- }
4196
-
4197
- /**
4198
- * Detailed execution metrics response
4199
- * Full execution metrics with AI call breakdown
4200
- */
4201
- interface ExecutionMetricsDetail {
4202
- executionId: string
4203
- organizationId: string
4204
- resourceId: string
4205
- totalInputTokens: number
4206
- totalOutputTokens: number
4207
- totalCostUsd: number
4208
- aiCallCount: number
4209
- aiCalls: AICallRecord[]
4210
- durationMs?: number
4211
- automationSavingsUsd?: number
4212
- createdAt: string
4213
- }
4214
-
4215
- /**
4216
- * Dashboard metrics response
4217
- * Aggregates core observability metrics in a single response
4218
- * Note: Throughput data is now included in executionHealth.trendData.executionCount
4219
- */
4220
- interface DashboardMetrics {
4221
- executionHealth: ExecutionHealthMetrics
4222
- costBreakdown: CostBreakdownMetrics
4223
- businessImpact: BusinessImpactMetrics
4224
- /** ISO timestamp of the currently active deployment, or null if none */
4225
- activeDeploymentDate: string | null
4226
- /** Deployment version of the active deployment, or null if none */
4227
- activeDeploymentVersion: string | null
4228
- }
4229
-
4230
- // ============================================================================
4231
- // Error Tracking Types
4232
- // ============================================================================
4233
-
4234
- /**
4235
- * Error record for list view (ErrorBreakdownTable)
4236
- */
4237
- interface ErrorRecord {
4238
- id: string // execution_errors.id
4239
- timestamp: string // occurred_at
4240
- errorType: string // error_type
4241
- message: string // error_message
4242
- executionId: string // execution_id
4243
- resourceId: string // execution_logs.resource_id (via JOIN)
4244
- resourceName: string // execution_logs.resource_id (TODO: resolve via registry)
4245
- severity: 'critical' | 'warning' | 'info'
4246
- category: ExecutionErrorCategory // error_category (moved from metadata to dedicated column)
4247
- resolved: boolean // resolved flag (human acknowledgment, does not affect execution status)
4248
- resolvedAt: string | null // timestamp when resolved
4249
- resolvedBy: string | null // user ID who resolved
4250
- }
4251
-
4252
- /**
4253
- * Full error detail for modal view (ErrorDetailsModal)
4254
- */
4255
- interface ErrorDetailFull extends ErrorRecord {
4256
- stackTrace?: string // error_stack_trace
4257
- retryAttempt?: number // metadata.retryAttempt
4258
- stepName?: string // metadata.stepName
4259
- stepSequence?: number // metadata.stepSequence
4260
- errorContext?: Record<string, unknown> // metadata.errorContext
4261
- executionContext?: Record<string, unknown> // metadata.executionContext
4262
- }
4263
-
4264
- /**
4265
- * Error details API response (paginated)
4266
- */
4267
- interface ErrorDetailResponse {
4268
- errors: ErrorRecord[]
4269
- total: number
4270
- page: number
4271
- limit: number
4272
- }
4273
-
4274
- /**
4275
- * Error trend data for time-series charts
4276
- */
4277
- interface ErrorTrend {
4278
- time: string // Time bucket (ISO timestamp)
4279
- errorCount: number // Total errors in bucket
4280
- criticalCount: number // Critical errors in bucket
4281
- warningCount: number // Warning errors in bucket
4282
- infoCount: number // Info errors in bucket
4283
- }
4284
-
4285
- /**
4286
- * Failing resource data for health monitoring
4287
- */
4288
- interface FailingResource {
4289
- resourceId: string
4290
- resourceName: string // TODO: Resolve via registry
4291
- errorCount: number
4292
- criticalCount: number
4293
- warningCount: number
4294
- mostCommonError: string
4295
- }
4296
-
4297
- // ============================================================================
4298
- // Recent Executions by Resource Types (Dashboard)
4299
- // ============================================================================
4300
-
4301
- /**
4302
- * Summary of executions for a single resource
4303
- * Used by RecentExecutionsByResource dashboard component
4304
- */
4305
- interface ResourceExecutionSummary {
4306
- resourceId: string // resource_id from execution_logs
4307
- resourceType: string // Inferred from resource definitions (resolved by frontend)
4308
- resourceName: string | null // From resource registry lookup (resolved by frontend)
4309
- lastExecution: string // ISO timestamp (MAX started_at)
4310
- totalExecutions: number // COUNT(*)
4311
- successCount: number // COUNT WHERE status='completed' OR status='warning'
4312
- failureCount: number // COUNT WHERE status='failed'
4313
- warningCount: number // COUNT WHERE status='warning' (subset of success)
4314
- successRate: number // (successCount / totalExecutions) * 100
4315
- }
4316
-
4317
- /**
4318
- * Response from getRecentExecutionsByResource endpoint
4319
- */
4320
- interface RecentExecutionsByResourceResponse {
4321
- resources: ResourceExecutionSummary[]
4322
- }
4323
-
4324
- // ============================================================================
4325
- // Per-Resource Health Types (Dashboard Recent Activity)
4326
- // ============================================================================
4327
-
4328
- /** Resource identifier for health queries */
4329
- interface ResourceIdentifier {
4330
- entityType: string // 'workflow' | 'agent'
4331
- entityId: string // Resource ID
4332
- }
4333
-
4334
- /** Time-bucketed health data point */
4335
- interface ResourceHealthDataPoint {
4336
- time: string // ISO timestamp (bucket start)
4337
- success: number // Success count in bucket (completed + warning)
4338
- failure: number // Failure count in bucket
4339
- warning: number // Warning count in bucket (subset of success)
4340
- rate: number // Success rate (0-100)
4341
- }
4342
-
4343
- /** Health data for a single resource */
4344
- interface ResourceHealth {
4345
- entityType: string
4346
- entityId: string
4347
- entityName: string | null
4348
- trendData: ResourceHealthDataPoint[]
4349
- summary: {
4350
- total: number
4351
- successRate: number
4352
- }
4353
- }
4354
-
4355
- /** Batch response with all requested resources */
4356
- interface ResourcesHealthResponse {
4357
- resources: ResourceHealth[]
4358
- }
4359
-
4360
- // ============================================================================
4361
- // Cost Analytics Types (Time-Series)
4362
- // ============================================================================
4363
-
4364
- /**
4365
- * Cost trend data point for time-series charts
4366
- * Represents a single time bucket (hour or day)
4367
- */
4368
- interface CostTrendDataPoint {
4369
- time: string // ISO timestamp (bucket start)
4370
- totalCostUsd: number
4371
- executionCount: number
4372
- avgCostPerExecution: number
4373
- }
4374
-
4375
- /**
4376
- * Cost trends response (time-series data)
4377
- */
4378
- interface CostTrendsResponse {
4379
- trendData: CostTrendDataPoint[]
4380
- granularity: 'hour' | 'day'
4381
- totalCostUsd: number
4382
- totalExecutions: number
4383
- }
4384
-
4385
- /**
4386
- * Cost summary response with MTD and projections
4387
- */
4388
- interface CostSummaryResponse {
4389
- current: {
4390
- totalCostUsd: number
4391
- executionCount: number
4392
- }
4393
- previous: {
4394
- totalCostUsd: number
4395
- executionCount: number
4396
- }
4397
- mtd: {
4398
- totalCostUsd: number
4399
- daysElapsed: number
4400
- }
4401
- projection: {
4402
- monthlyCostUsd: number
4403
- confidence: 'low' | 'medium' | 'high'
4404
- }
4405
- trend: {
4406
- changePercent: number
4407
- direction: 'up' | 'down' | 'flat'
4408
- }
4409
- }
4410
-
4411
- /**
4412
- * Cost by model data for model-level breakdown
4413
- */
4414
- interface CostByModelData {
4415
- model: string
4416
- totalCostUsd: number
4417
- callCount: number
4418
- totalInputTokens: number
4419
- totalOutputTokens: number
4420
- avgCostPerCall: number
4421
- }
4422
-
4423
- /**
4424
- * Cost by model response
4425
- */
4426
- interface CostByModelResponse {
4427
- models: CostByModelData[]
4428
- totalCostUsd: number
4429
- totalCallCount: number
4430
- }
4431
-
4432
- /**
4433
- * Action configuration for HITL tasks
4434
- * Defines available user actions and their behavior
4435
- */
4436
- interface ActionConfig {
4437
- /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
4438
- id: string
4439
-
4440
- /** Display label for UI button */
4441
- label: string
4442
-
4443
- /** Button variant/style */
4444
- type: 'primary' | 'secondary' | 'danger' | 'outline'
4445
-
4446
- /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
4447
- icon?: string
4448
-
4449
- /** Button color (Mantine theme colors) */
4450
- color?: string
4451
-
4452
- /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
4453
- variant?: string
4454
-
4455
- /** Execution target (agent/workflow to invoke) */
4456
- target?: {
4457
- resourceType: 'agent' | 'workflow'
4458
- resourceId: string
4459
- /**
4460
- * Optional session ID for agent continuation.
4461
- * If provided, invokes a new turn on the existing session instead of standalone execution.
4462
- * Only valid when resourceType is 'agent'.
4463
- */
4464
- sessionId?: string
4465
- }
4466
-
4467
- /** Form schema for collecting action-specific data */
4468
- form?: FormSchema
4469
-
4470
- /** Payload template for pre-filling forms */
4471
- payloadTemplate?: unknown
4472
-
4473
- /** Requires confirmation dialog */
4474
- requiresConfirmation?: boolean
4475
-
4476
- /** Confirmation message */
4477
- confirmationMessage?: string
4478
-
4479
- /** Help text / tooltip */
4480
- description?: string
4481
- }
4482
-
4483
- /**
4484
- * Origin resource type - where an execution/task originated from.
4485
- * Used for audit trails and tracking execution lineage.
4486
- */
4487
- type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api'
4488
-
4489
- /**
4490
- * Origin tracking metadata - who/what created this execution/task.
4491
- * Used by both TaskScheduler and CommandQueue for complete audit trails.
4492
- */
4493
- interface OriginTracking {
4494
- originExecutionId: string
4495
- originResourceType: OriginResourceType
4496
- originResourceId: string
4497
- }
4498
-
4499
- /**
4500
- * Command queue task with flexible action system
4501
- */
4502
- interface Task extends OriginTracking {
4503
- id: string
4504
- organizationId: string
4505
-
4506
- // NEW: Flexible action system
4507
- actions: ActionConfig[]
4508
- context: unknown
4509
- selectedAction?: string
4510
- actionPayload?: unknown
4511
-
4512
- // Task metadata
4513
- description?: string
4514
- priority: number
4515
-
4516
- /** Optional checkpoint identifier for grouping related human approval tasks */
4517
- humanCheckpoint?: string
4518
-
4519
- // Status (updated to include 'completed')
4520
- status: QueueTaskStatus
4521
-
4522
- /**
4523
- * Target resource tracking — mirrors origin columns.
4524
- * Set when task is created; patchable to redirect execution to a different resource.
4525
- */
4526
- targetResourceId?: string
4527
- targetResourceType?: 'agent' | 'workflow'
4528
-
4529
- /**
4530
- * Execution ID for the action that runs AFTER user approval.
4531
- * NULL until execution starts.
4532
- *
4533
- * Naming distinction:
4534
- * - originExecutionId = Parent execution that CREATED the HITL task
4535
- * - targetExecutionId = Child execution that RUNS AFTER user approval
4536
- */
4537
- targetExecutionId?: string
4538
-
4539
- createdAt: Date
4540
- completedAt?: Date
4541
- completedBy?: string
4542
- expiresAt?: Date
4543
- idempotencyKey?: string | null
4544
- }
4545
-
4546
- /**
4547
- * Task status values
4548
- * - pending: awaiting action
4549
- * - processing: execution in progress after user approval
4550
- * - completed: action was taken and execution succeeded
4551
- * - failed: execution failed, task can be retried
4552
- * - expired: timed out before action
4553
- */
4554
- type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired'
4555
-
4556
- /**
4557
- * Parameters for patching mutable metadata on a task
4558
- */
4559
- interface PatchTaskParams {
4560
- humanCheckpoint?: string | null
4561
- description?: string
4562
- priority?: number
4563
- context?: Record<string, unknown>
4564
- actions?: unknown[]
4565
- targetResourceId?: string | null
4566
- targetResourceType?: 'agent' | 'workflow' | null
4567
- targetExecutionId?: string
4568
- status?: 'pending' | 'failed' | 'completed'
4569
- }
4570
-
4571
- /**
4572
- * Checkpoint list item for sidebar grouping
4573
- * The id field contains the resourceId of the human checkpoint
4574
- */
4575
- interface CheckpointListItem {
4576
- /** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
4577
- id: string
4578
- /** Display name (same as id, or "Ungrouped" for null) */
4579
- name: string
4580
- /** Task count for this checkpoint */
4581
- count: number
4582
- }
4583
-
4584
- /**
4585
- * Status counts for pie chart display
4586
- */
4587
- interface StatusCounts {
4588
- pending: number
4589
- completed: number
4590
- expired: number
4591
- }
4592
-
4593
- /**
4594
- * Priority counts for donut chart display
4595
- */
4596
- interface PriorityCounts {
4597
- critical: number
4598
- high: number
4599
- medium: number
4600
- low: number
4601
- }
4602
-
4603
- /**
4604
- * Response from GET /command-queue/checkpoints endpoint
4605
- */
4606
- interface CheckpointListResponse {
4607
- checkpoints: CheckpointListItem[]
4608
- /** Total tasks across all checkpoints */
4609
- total: number
4610
- /** Breakdown by status for donut chart */
4611
- statusCounts: StatusCounts
4612
- /** Breakdown by priority for donut chart */
4613
- priorityCounts: PriorityCounts
4614
- }
4615
-
4616
- interface RecurringScheduleConfig {
4617
- type: 'recurring'
4618
- cron?: string
4619
- interval?: 'daily' | 'weekly' | 'monthly'
4620
- time?: string
4621
- timezone: string
4622
- payload: Record<string, unknown>
4623
- endAt?: string | null
4624
- overduePolicy?: 'skip' | 'execute' // Default: 'skip'
4625
- }
4626
-
4627
- interface RelativeScheduleConfig {
4628
- type: 'relative'
4629
- anchorAt: string
4630
- anchorLabel?: string
4631
- items: RelativeScheduleItem[]
4632
- overduePolicy?: 'skip' | 'execute' // Default: 'skip'
4633
- }
4634
-
4635
- interface RelativeScheduleItem {
4636
- offset: string // '-7d', '+3d', '-2h', '+1h'
4637
- payload: Record<string, unknown>
4638
- label?: string
4639
- }
4640
-
4641
- interface AbsoluteScheduleConfig {
4642
- type: 'absolute'
4643
- items: AbsoluteScheduleItem[]
4644
- overduePolicy?: 'skip' | 'execute' // Default: 'skip'
4645
- }
4646
-
4647
- interface AbsoluteScheduleItem {
4648
- runAt: string
4649
- payload: Record<string, unknown>
4650
- label?: string
4651
- }
4652
-
4653
- /**
4654
- * Wire-format DTO for notification API responses.
4655
- * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
4656
- * Used by frontend hooks that consume /api/notifications.
4657
- */
4658
- interface NotificationDTO {
4659
- id: string
4660
- userId: string
4661
- organizationId: string
4662
- category: string
4663
- title: string
4664
- message: string
4665
- actionUrl: string | null
4666
- read: boolean
4667
- readAt: string | null
4668
- createdAt: string
4669
- }
4670
-
4671
- /**
4672
- * Supported integration types
4673
- *
4674
- * These represent the available integration adapters that can be used with tools.
4675
- * Each integration type corresponds to an adapter implementation.
4676
- *
4677
- * Note: Concrete adapter implementations are deferred until needed.
4678
- * This type provides compile-time safety and auto-completion for tool definitions.
4679
- */
4680
- type IntegrationType =
4681
- | 'gmail' // Google Gmail API
4682
- | 'google-sheets' // Google Sheets API
4683
- | 'slack' // Slack API
4684
- | 'github' // GitHub API
4685
- | 'linear' // Linear API
4686
- | 'attio' // Attio CRM API
4687
- | 'airtable' // Airtable API
4688
- | 'salesforce' // Salesforce API
4689
- | 'hubspot' // HubSpot API
4690
- | 'stripe' // Stripe API
4691
- | 'twilio' // Twilio API
4692
- | 'sendgrid' // SendGrid API
4693
- | 'mailgun' // Mailgun API
4694
- | 'zapier' // Zapier Webhooks
4695
- | 'webhook' // Generic webhook
4696
- | 'apify' // Apify actor automation
4697
- | 'instantly' // Instantly.ai email automation
4698
- | 'resend' // Resend transactional email API
4699
- | 'signature-api' // SignatureAPI eSignature service
4700
- | 'dropbox' // Dropbox file storage API
4701
- | 'anymailfinder' // Anymailfinder email finder API
4702
- | 'tomba' // Tomba email discovery API
4703
- | 'millionverifier'
4704
-
4705
- /**
4706
- * Standard Domain Definitions
4707
- * Centralized domain constants and definitions for all organization resources.
4708
- */
4709
-
4710
-
4711
-
4712
- // ============================================================================
4713
- // Standard Domain IDs
4714
- // ============================================================================
4715
-
4716
- declare const DOMAINS = {
4717
- // Business domains
4718
- INBOUND_PIPELINE: 'inbound-pipeline',
4719
- LEAD_GEN_PIPELINE: 'lead-gen-pipeline',
4720
- SUPPORT: 'support',
4721
- CLIENT_SUPPORT: 'client-support',
4722
- DELIVERY: 'delivery',
4723
- OPERATIONS: 'operations',
4724
- FINANCE: 'finance',
4725
- EXECUTIVE: 'executive',
4726
- INSTANTLY: 'instantly',
4727
-
4728
- // Technical domains
4729
- TESTING: 'testing',
4730
- INTERNAL: 'internal',
4731
- INTEGRATION: 'integration',
4732
- UTILITY: 'utility',
4733
- DIAGNOSTIC: 'diagnostic'
4734
- } as const
4735
-
4736
- /**
4737
- * ResourceDomain - Strongly typed domain identifier
4738
- * Use this type for all domain references to ensure compile-time validation.
4739
- */
4740
- type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS]
4741
-
4742
- /**
4743
- * Resource Registry type definitions
4744
- */
4745
-
4746
-
4747
-
4748
- // ============================================================================
4749
- // Core Resource Type Definitions
4750
- // ============================================================================
4751
-
4752
- /**
4753
- * Environment/deployment status for resources
4754
- */
4755
- type ResourceStatus = 'dev' | 'prod'
4756
-
4757
- /**
4758
- * All resource types in the platform
4759
- * Used as the discriminator field in ResourceDefinition
4760
- */
4761
- type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
4762
-
4763
- // ============================================================================
4764
- // Base Resource Interface
4765
- // ============================================================================
4766
-
4767
- /**
4768
- * Base interface for ALL platform resources
4769
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
4770
- */
4771
- interface ResourceDefinition {
4772
- /** Unique resource identifier */
4773
- resourceId: string
4774
-
4775
- /** Display name */
4776
- name: string
4777
-
4778
- /** Purpose and functionality description */
4779
- description: string
4780
-
4781
- /** Version for change tracking and evolution */
4782
- version: string
4783
-
4784
- /** Resource type discriminator */
4785
- type: ResourceType
4786
-
4787
- /** Environment/deployment status */
4788
- status: ResourceStatus
4789
-
4790
- /** Domain tags for filtering and organization */
4791
- domains?: ResourceDomain[]
4792
-
4793
- /** Whether the agent supports multi-turn sessions (agents only) */
4794
- sessionCapable?: boolean
4795
-
4796
- /** Whether the resource is local (monorepo) or remote (externally deployed) */
4797
- origin?: 'local' | 'remote'
4798
-
4799
- /** Whether this resource is archived and should be excluded from registration and deployment */
4800
- archived?: boolean
4801
- }
4802
-
4803
- // ============================================================================
4804
- // Domain Definition Types
4805
- // ============================================================================
4806
-
4807
- /**
4808
- * Domain definition for Command View filtering
4809
- *
4810
- * Domains are organizational metadata for UI filtering/grouping.
4811
- * No execution impact - purely for visualization.
4812
- *
4813
- * @example
4814
- * {
4815
- * id: 'support',
4816
- * name: 'Customer Support',
4817
- * description: 'Ticket triage, knowledge base, escalations',
4818
- * color: 'green',
4819
- * icon: 'IconHeadset'
4820
- * }
4821
- */
4822
- interface DomainDefinition {
4823
- /** Unique identifier (e.g., 'support') */
4824
- id: string
4825
- /** Display name (e.g., 'Customer Support') */
4826
- name: string
4827
- /** Purpose description */
4828
- description: string
4829
- /** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
4830
- color?: string
4831
- /** Optional Tabler icon name (e.g., 'IconHeadset') */
4832
- icon?: string
4833
- }
4834
-
4835
- // ============================================================================
4836
- // Resource Manifest Types
4837
- // ============================================================================
4838
-
4839
- // ============================================================================
4840
- // Trigger Configuration Types
4841
- // ============================================================================
4842
-
4843
- /** Webhook provider identifiers */
4844
- type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
4845
-
4846
- /** Webhook trigger configuration */
4847
- interface WebhookTriggerConfig {
4848
- /** Provider identifier */
4849
- provider: WebhookProviderType
4850
- /** Event type for documentation (not used for matching - workflow handles routing) */
4851
- event?: string
4852
- /** Optional filtering (e.g., specific form ID for Fillout) */
4853
- filter?: Record<string, string>
4854
- /** References credential in credentials table for per-org webhook secrets */
4855
- credentialName?: string
4856
- }
4857
-
4858
- /** Schedule trigger configuration */
4859
- interface ScheduleTriggerConfig {
4860
- /** Cron expression (e.g., '0 6 * * *') */
4861
- cron: string
4862
- /** Optional timezone (default: UTC) */
4863
- timezone?: string
4864
- }
4865
-
4866
- /** Event trigger configuration */
4867
- interface EventTriggerConfig {
4868
- /** Internal event type */
4869
- eventType: string
4870
- /** Event source */
4871
- source?: string
4872
- }
4873
-
4874
- /** Union of all trigger configs */
4875
- type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig
4876
-
4877
- // ============================================================================
4878
- // Trigger Definition
4879
- // ============================================================================
4880
-
4881
- /**
4882
- * Trigger metadata - entry points that initiate resource execution
4883
- *
4884
- * Triggers represent how executions start: webhooks from external services,
4885
- * scheduled cron jobs, platform events, or manual user actions.
4886
- *
4887
- * BREAKING CHANGES (2025-11-30):
4888
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
4889
- * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
4890
- * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
4891
- * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
4892
- * - triggers object now includes `externalResources` option
4893
- *
4894
- * @example
4895
- * // TriggerDefinition - metadata only
4896
- * {
4897
- * resourceId: 'trigger-new-order',
4898
- * type: 'trigger',
4899
- * triggerType: 'webhook',
4900
- * name: 'New Order',
4901
- * description: 'Webhook from Shopify on new orders',
4902
- * version: '1.0.0',
4903
- * status: 'prod',
4904
- * webhookPath: '/webhooks/shopify/orders'
4905
- * }
4906
- *
4907
- * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
4908
- * // relationships: {
4909
- * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
4910
- * // }
4911
- */
4912
- interface TriggerDefinition extends ResourceDefinition {
4913
- /** Resource type discriminator (narrowed from base union) */
4914
- type: 'trigger'
4915
-
4916
- /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
4917
- triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
4918
-
4919
- /** Type-specific configuration */
4920
- config?: TriggerConfig
4921
-
4922
- // Legacy fields (deprecated, use config instead)
4923
- /** For webhook triggers: path like '/webhooks/shopify/orders' */
4924
- webhookPath?: string
4925
- /** For schedule triggers: cron expression like '0 6 * * *' */
4926
- schedule?: string
4927
- /** For event triggers: event type like 'low-stock-alert' */
4928
- eventType?: string
4929
-
4930
- // NOTE: What this trigger starts is declared in ResourceRelationships, not here
4931
- // This prevents duplication - triggers are forward-declared in relationships
4932
- }
4933
-
4934
- /**
4935
- * Integration metadata - external service connections
4936
- *
4937
- * References credentials table for actual connection. No connection status
4938
- * stored here (queried at runtime from credentials table).
4939
- *
4940
- * BREAKING CHANGES (2025-11-30):
4941
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
4942
- * - Field renames: `id` -> `resourceId` (inherited)
4943
- * - New required field: `status` (inherited) - organizations must add status to all integrations
4944
- * - New required field: `version` (inherited) - organizations must add version to all integrations
4945
- * - New required field: `type: 'integration'` (inherited) - resource type discriminator
4946
- *
4947
- * @example
4948
- * {
4949
- * resourceId: 'integration-shopify-prod',
4950
- * type: 'integration',
4951
- * provider: 'shopify',
4952
- * credentialName: 'shopify-prod',
4953
- * name: 'Shopify Production',
4954
- * description: 'E-commerce platform',
4955
- * version: '1.0.0',
4956
- * status: 'prod'
4957
- * }
4958
- */
4959
- interface IntegrationDefinition extends ResourceDefinition {
4960
- /** Resource type discriminator (narrowed from base union) */
4961
- type: 'integration'
4962
-
4963
- /** Integration provider type */
4964
- provider: IntegrationType
4965
- /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
4966
- credentialName: string
4967
- }
4968
-
4969
- // ============================================================================
4970
- // External Resource Types
4971
- // ============================================================================
4972
-
4973
- /**
4974
- * External platform type
4975
- * Supported third-party automation platforms
4976
- */
4977
- type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other'
4978
-
4979
- /**
4980
- * External automation resource metadata
4981
- *
4982
- * Represents workflows/automations running on third-party platforms
4983
- * (n8n, Make, Zapier, etc.) for visualization in Command View.
4984
- *
4985
- * NOTE: This is metadata ONLY for visualization. No execution logic,
4986
- * no API integration with external platforms, no status syncing.
4987
- *
4988
- * BREAKING CHANGES (2025-11-30):
4989
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
4990
- * - Field renames: `id` -> `resourceId` (inherited)
4991
- * - New required field: `version` (inherited) - organizations must add version to all external resources
4992
- * - New required field: `type: 'external'` (inherited) - resource type discriminator
4993
- * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
4994
- *
4995
- * @example
4996
- * {
4997
- * resourceId: 'external-n8n-order-sync',
4998
- * type: 'external',
4999
- * version: '1.0.0',
5000
- * platform: 'n8n',
5001
- * name: 'Shopify Order Sync',
5002
- * description: 'Legacy n8n workflow for syncing Shopify orders',
5003
- * status: 'prod',
5004
- * platformUrl: 'https://n8n.client.com/workflow/123',
5005
- * triggers: { workflows: ['order-fulfillment-workflow'] },
5006
- * uses: { integrations: ['integration-shopify-prod'] }
5007
- * }
5008
- */
5009
- interface ExternalResourceDefinition extends ResourceDefinition {
5010
- /** Resource type discriminator (narrowed from base union) */
5011
- type: 'external'
5012
-
5013
- /** Platform type */
5014
- platform: ExternalPlatform
5015
-
5016
- // Optional platform-specific metadata
5017
- /** Link to external platform (e.g., n8n workflow editor URL) */
5018
- platformUrl?: string
5019
- /** Platform's internal ID/reference */
5020
- externalId?: string
5021
-
5022
- /** What this external resource triggers (external -> internal) */
5023
- triggers?: {
5024
- /** Elevasis workflow resourceIds this external automation triggers */
5025
- workflows?: string[]
5026
- /** Elevasis agent resourceIds this external automation triggers */
5027
- agents?: string[]
5028
- }
5029
-
5030
- /** Integrations this external resource uses (shared credentials) */
5031
- uses?: {
5032
- /** Integration IDs this external automation uses */
5033
- integrations?: string[]
5034
- }
5035
-
5036
- // NOTE: triggeredBy field removed - per relationship-consolidation design,
5037
- // all relationships are forward-only declarations. Graph edges are built
5038
- // from forward declarations only.
5039
- }
5040
-
5041
- /**
5042
- * Human Checkpoint definition - human decision points in automation
5043
- *
5044
- * Represents where human judgment is deployed in the automation landscape.
5045
- * Tasks with matching command_queue_group are routed to this checkpoint.
5046
- *
5047
- * BREAKING CHANGES (2025-11-30):
5048
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
5049
- * - Field renames: `id` -> `resourceId` (inherited)
5050
- * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
5051
- * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
5052
- * - New required field: `type: 'human'` (inherited) - resource type discriminator
5053
- *
5054
- * @example
5055
- * {
5056
- * resourceId: 'sales-approval',
5057
- * type: 'human',
5058
- * name: 'Sales Approval Queue',
5059
- * description: 'High-value order approvals for sales team',
5060
- * version: '1.0.0',
5061
- * status: 'prod',
5062
- * requestedBy: { agents: ['order-processor-agent'] },
5063
- * routesTo: { agents: ['order-fulfillment-agent'] }
5064
- * }
5065
- */
5066
- interface HumanCheckpointDefinition extends ResourceDefinition {
5067
- /** Resource type discriminator (narrowed from base union) */
5068
- type: 'human'
5069
-
5070
- /** Resources that create tasks for this checkpoint */
5071
- requestedBy?: {
5072
- /** Agent resourceIds that request approval here */
5073
- agents?: string[]
5074
- /** Workflow resourceIds that request approval here */
5075
- workflows?: string[]
5076
- }
5077
-
5078
- /** Resources that receive approved decisions */
5079
- routesTo?: {
5080
- /** Agent resourceIds that handle approved tasks */
5081
- agents?: string[]
5082
- /** Workflow resourceIds that handle approved tasks */
5083
- workflows?: string[]
5084
- }
5085
- }
5086
-
5087
- /**
5088
- * Command View Types
5089
- *
5090
- * Unified type definitions for the Command View graph visualization.
5091
- * These types are used by both backend serialization and frontend rendering.
5092
- *
5093
- * Command View shows the resource graph: agents, workflows, triggers, integrations,
5094
- * external resources, and human checkpoints with their relationships.
5095
- */
5096
-
5097
-
5098
-
5099
- // ============================================================================
5100
- // Node Types - Resources that appear in the graph
5101
- // ============================================================================
5102
-
5103
- /**
5104
- * Extended agent metadata for Command View
5105
- * Includes model and capability information for graph display
5106
- */
5107
- interface CommandViewAgent extends ResourceDefinition {
5108
- type: 'agent'
5109
- modelProvider: string // e.g., 'anthropic', 'openai'
5110
- modelId: string // e.g., 'claude-sonnet-4-20250514'
5111
- toolCount: number
5112
- hasKnowledgeMap: boolean
5113
- hasMemory: boolean
5114
- sessionCapable: boolean // Explicit session capability declaration
5115
- }
5116
-
5117
- /**
5118
- * Extended workflow metadata for Command View
5119
- * Includes step information for graph display
5120
- */
5121
- interface CommandViewWorkflow extends ResourceDefinition {
5122
- type: 'workflow'
5123
- stepCount: number
5124
- entryPoint: string
5125
- }
5126
-
5127
- /**
5128
- * Node type categories for Command View
5129
- * Simplified categorization for UI rendering and layout
5130
- */
5131
- type CommandViewNodeType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
5132
-
5133
- /**
5134
- * Union type for all node types in Command View
5135
- * Frontend can use this for type-safe node handling
5136
- */
5137
- type CommandViewNode =
5138
- | CommandViewAgent
5139
- | CommandViewWorkflow
5140
- | TriggerDefinition
5141
- | IntegrationDefinition
5142
- | ExternalResourceDefinition
5143
- | HumanCheckpointDefinition
5144
-
5145
- // ============================================================================
5146
- // Edge Types - Relationships between resources
5147
- // ============================================================================
5148
-
5149
- /**
5150
- * Relationship types between resources
5151
- *
5152
- * - triggers: Resource initiates/starts another resource (orange)
5153
- * - uses: Resource uses an integration (teal)
5154
- * - approval: Resource requires human approval (yellow)
5155
- */
5156
- type RelationshipType = 'triggers' | 'uses' | 'approval'
5157
-
5158
- /**
5159
- * Command View edge (relationship between resources)
5160
- */
5161
- interface CommandViewEdge {
5162
- id: string
5163
- source: string // Source node ID
5164
- target: string // Target node ID
5165
- relationship: RelationshipType
5166
- label?: string // Optional label for the edge
5167
- }
5168
-
5169
- // ============================================================================
5170
- // Graph Data Structure
5171
- // ============================================================================
5172
-
5173
- /**
5174
- * Command View data structure
5175
- * Complete graph data for visualization
5176
- *
5177
- * Backend serializes this once at startup and serves it via /command-view endpoint.
5178
- * Frontend consumes this directly for graph rendering.
5179
- */
5180
- interface CommandViewData {
5181
- workflows: CommandViewWorkflow[]
5182
- agents: CommandViewAgent[]
5183
- triggers: TriggerDefinition[]
5184
- integrations: IntegrationDefinition[]
5185
- externalResources: ExternalResourceDefinition[]
5186
- humanCheckpoints: HumanCheckpointDefinition[]
5187
- edges: CommandViewEdge[]
5188
- domainDefinitions?: DomainDefinition[]
5189
- }
5190
-
5191
- /**
5192
- * Serialized Registry Types
5193
- *
5194
- * Pre-computed JSON-safe types for API responses and Command View.
5195
- * Serialization happens once at API startup, enabling instant response times.
5196
- */
5197
-
5198
-
5199
-
5200
- // ============================================================================
5201
- // Serialized Interface Types (for Execution Runner UI)
5202
- // ============================================================================
5203
-
5204
- /**
5205
- * Serialized form field for API responses
5206
- */
5207
- interface SerializedFormField {
5208
- name: string
5209
- label: string
5210
- type: FormFieldType
5211
- defaultValue?: unknown
5212
- required?: boolean
5213
- placeholder?: string
5214
- description?: string
5215
- options?: Array<{ label: string; value: string | number }>
5216
- min?: number
5217
- max?: number
5218
- }
5219
-
5220
- /**
5221
- * Serialized form schema for API responses
5222
- */
5223
- interface SerializedFormSchema {
5224
- title?: string
5225
- description?: string
5226
- fields: SerializedFormField[]
5227
- layout?: 'vertical' | 'horizontal' | 'grid'
5228
- }
5229
-
5230
- /**
5231
- * Serialized execution form schema for API responses
5232
- */
5233
- interface SerializedExecutionFormSchema extends SerializedFormSchema {
5234
- fieldMappings?: Record<string, string>
5235
- submitButton?: {
5236
- label?: string
5237
- loadingLabel?: string
5238
- confirmMessage?: string
5239
- }
5240
- }
5241
-
5242
- /**
5243
- * Serialized schedule config for API responses
5244
- */
5245
- interface SerializedScheduleConfig {
5246
- enabled: boolean
5247
- defaultSchedule?: string
5248
- allowedPatterns?: string[]
5249
- }
5250
-
5251
- /**
5252
- * Serialized webhook config for API responses
5253
- */
5254
- interface SerializedWebhookConfig {
5255
- enabled: boolean
5256
- payloadSchema?: unknown
5257
- }
5258
-
5259
- /**
5260
- * Serialized execution interface for API responses
5261
- */
5262
- interface SerializedExecutionInterface {
5263
- form: SerializedExecutionFormSchema
5264
- schedule?: SerializedScheduleConfig
5265
- webhook?: SerializedWebhookConfig
5266
- }
5267
-
5268
- // ============================================================================
5269
- // Serialized Definition Types
5270
- // ============================================================================
5271
-
5272
- /**
5273
- * Serialized agent definition (JSON-safe)
5274
- * Result of serializeDefinition(AgentDefinition)
5275
- */
5276
- interface SerializedAgentDefinition {
5277
- config: {
5278
- resourceId: string
5279
- name: string
5280
- description: string
5281
- version: string
5282
- type: 'agent'
5283
- status: 'dev' | 'prod'
5284
- /** Whether this resource is archived and should be excluded from registration and deployment */
5285
- archived?: boolean
5286
- systemPrompt: string
5287
- constraints?: {
5288
- maxIterations?: number
5289
- timeout?: number
5290
- maxSessionMemoryKeys?: number
5291
- maxMemoryTokens?: number
5292
- }
5293
- sessionCapable?: boolean
5294
- memoryPreferences?: string
5295
- }
5296
- modelConfig: {
5297
- provider: string
5298
- model: string
5299
- apiKey: string // Redacted: "sk-proj..."
5300
- temperature: number
5301
- maxOutputTokens: number
5302
- topP?: number
5303
- modelOptions?: Record<string, unknown>
5304
- }
5305
- contract: {
5306
- inputSchema: object // JSON Schema
5307
- outputSchema?: object // JSON Schema
5308
- }
5309
- tools: Array<{
5310
- name: string
5311
- description: string
5312
- inputSchema?: object // JSON Schema
5313
- outputSchema?: object // JSON Schema
5314
- }>
5315
- knowledgeMap?: {
5316
- nodeCount: number
5317
- nodes: Array<{
5318
- id: string
5319
- description: string
5320
- loaded: boolean
5321
- hasPrompt: boolean
5322
- }>
5323
- }
5324
- metricsConfig?: object
5325
- interface?: SerializedExecutionInterface
5326
- }
5327
-
5328
- /**
5329
- * Serialized workflow definition (JSON-safe)
5330
- * Result of serializeDefinition(WorkflowDefinition)
5331
- */
5332
- interface SerializedWorkflowDefinition {
5333
- config: {
5334
- resourceId: string
5335
- name: string
5336
- description: string
5337
- version: string
5338
- type: 'workflow'
5339
- status: 'dev' | 'prod'
5340
- /** Whether this resource is archived and should be excluded from registration and deployment */
5341
- archived?: boolean
5342
- }
5343
- entryPoint: string
5344
- steps: Array<{
5345
- id: string
5346
- name: string
5347
- description: string
5348
- inputSchema?: object // JSON Schema
5349
- outputSchema?: object // JSON Schema
5350
- next: {
5351
- type: 'linear' | 'conditional'
5352
- target?: string
5353
- routes?: Array<{ target: string }>
5354
- default?: string
5355
- } | null
5356
- }>
5357
- contract: {
5358
- inputSchema: object // JSON Schema
5359
- outputSchema?: object // JSON Schema
5360
- }
5361
- metricsConfig?: object
5362
- interface?: SerializedExecutionInterface
5363
- }
5364
-
5365
- /**
5366
- * Agent timeline and observability types
5367
- * Used for UI timeline visualization and backend processing
5368
- */
5369
-
5370
-
5371
-
5372
- /**
5373
- * Sub-activity within an iteration
5374
- * Represents reasoning, actions, or tool calls with timing
5375
- */
5376
- interface SubActivity {
5377
- type: 'reasoning' | 'action' | 'tool-call'
5378
- startTime: number
5379
- endTime: number
5380
- duration: number
5381
- details: AgentIterationEvent | AgentToolCallEvent
5382
- }
5383
-
5384
- /**
5385
- * Agent iteration state
5386
- * Aggregates lifecycle events and sub-activities for a single iteration
5387
- */
5388
- interface AgentIteration {
5389
- iterationNumber: number
5390
- status: 'running' | 'completed' | 'failed' | 'pending'
5391
- iterationEvents: AgentIterationEvent[]
5392
- duration?: number
5393
- timestamp: number
5394
- subActivities: SubActivity[]
5395
-
5396
- // Timeline visualization timing (Phase 2 - optional for backward compatibility)
5397
- startTime?: number // From lifecycle 'started' event
5398
- endTime?: number // From lifecycle 'completed'/'failed' event
5399
- }
5400
-
5401
- /**
5402
- * Agent lifecycle node state
5403
- * Represents initialization or completion phase
5404
- */
5405
- interface AgentLifecycleNode {
5406
- type: 'initialization' | 'completion'
5407
- status: 'running' | 'completed' | 'failed' | 'pending'
5408
- duration?: number
5409
- timestamp?: number
5410
-
5411
- // Timeline visualization timing (Phase 2 - optional for backward compatibility)
5412
- startTime?: number // From lifecycle 'started' event
5413
- endTime?: number // From lifecycle 'completed'/'failed' event
5414
- }
5415
-
5416
- /**
5417
- * Complete agent execution data for timeline visualization
5418
- * Parsed from execution logs
5419
- */
5420
- interface AgentIterationData {
5421
- initialization: AgentLifecycleNode
5422
- iterations: AgentIteration[]
5423
- completion: AgentLifecycleNode
5424
- currentIteration: number | null
5425
- totalIterations: number
5426
- totalDuration?: number
5427
- status: 'running' | 'completed' | 'failed' | 'warning'
5428
- }
5429
-
5430
- // Execution status type shared between API and UI
5431
- type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning'
5432
-
5433
- /**
5434
- * Event sent when new execution starts
5435
- */
5436
- interface ExecutionStartedEvent {
5437
- type: 'new-execution'
5438
- resourceId: string
5439
- executionId: string
5440
- timestamp: number
5441
- data?: undefined
5442
- }
5443
-
5444
- /**
5445
- * Event sent when execution log message is emitted
5446
- */
5447
- interface ExecutionLogEvent {
5448
- type: 'log'
5449
- resourceId: string
5450
- executionId: string
5451
- timestamp: number
5452
- data: {
5453
- log: ExecutionLogMessage
5454
- }
5455
- }
5456
-
5457
- /**
5458
- * Event sent when execution completes (success or failure)
5459
- */
5460
- interface ExecutionCompleteEvent {
5461
- type: 'execution-complete'
5462
- resourceId: string
5463
- executionId: string
5464
- timestamp: number
5465
- data: {
5466
- success: boolean
5467
- status?: ExecutionStatus
5468
- result?: unknown
5469
- error?: string
5470
- }
5471
- }
5472
-
5473
- /**
5474
- * Connection confirmation event
5475
- */
5476
- interface ExecutionConnectedEvent {
5477
- type: 'connected'
5478
- resourceId: string
5479
- executionId?: undefined
5480
- timestamp: number
5481
- data?: undefined
5482
- }
5483
-
5484
- /**
5485
- * Union of all execution SSE events
5486
- */
5487
- type ExecutionSSEEvent =
5488
- | ExecutionStartedEvent
5489
- | ExecutionLogEvent
5490
- | ExecutionCompleteEvent
5491
- | ExecutionConnectedEvent
5492
-
5493
- // API execution types
5494
- interface APIExecutionSummary {
5495
- id: string
5496
- status: ExecutionStatus
5497
- startTime: number
5498
- endTime?: number
5499
- resourceStatus?: ResourceStatus // 'dev' | 'prod' - optional for backward compatibility
5500
- }
5501
-
5502
- /**
5503
- * Execution Runner Types
5504
- *
5505
- * Shared types for the Execution Runner UI feature.
5506
- * Used by both API (apps/api) and frontend (apps/command-center).
5507
- */
5508
-
5509
-
5510
-
5511
- // ============================================================================
5512
- // EXECUTION METRICS
5513
- // ============================================================================
5514
-
5515
- interface ExecutionMetrics {
5516
- tokenCount?: number
5517
- stepCount?: number
5518
- toolCallCount?: number
5519
- }
5520
-
5521
- // ============================================================================
5522
- // EXECUTION HISTORY TYPES
5523
- // ============================================================================
5524
-
5525
- interface ExecutionSummary {
5526
- id: string
5527
- resourceId: string
5528
- resourceName: string
5529
- status: ExecutionStatus
5530
- startedAt: string
5531
- completedAt?: string
5532
- durationMs?: number
5533
- metrics?: ExecutionMetrics
5534
- input?: unknown
5535
- output?: unknown
5536
- error?: { message: string }
4888
+ /**
4889
+ * Credential field definition
4890
+ */
4891
+ interface CredentialField {
4892
+ key: string;
4893
+ label: string;
4894
+ type: 'password' | 'text';
4895
+ required: boolean;
4896
+ placeholder?: string;
4897
+ description?: string;
5537
4898
  }
5538
-
5539
- /**
5540
- * Execution history item.
5541
- * Represents a single execution triggered by a schedule.
5542
- */
5543
- declare const ExecutionHistoryItemSchema = z.object({
5544
- id: z.string().uuid(),
5545
- createdAt: z.string().datetime(),
5546
- status: z.enum(['running', 'completed', 'failed', 'cancelled']),
5547
- step: z.number().int().nullable(),
5548
- itemLabel: z.string().nullable(),
5549
- duration: z.number().nullable(), // milliseconds
5550
- error: z.string().nullable()
5551
- })
5552
-
5553
- /**
5554
- * Execution history response.
5555
- * Returned by GET /schedules/:id/executions with pagination.
5556
- */
5557
- declare const ExecutionHistoryResponseSchema = z.object({
5558
- executions: z.array(ExecutionHistoryItemSchema),
5559
- total: z.number().int(),
5560
- limit: z.number().int(),
5561
- offset: z.number().int()
5562
- })
5563
- type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>
5564
- type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>
5565
-
5566
- /**
5567
- * Command Queue SSE Event Types
5568
- *
5569
- * Type-safe definitions for command queue related SSE events
5570
- */
5571
-
5572
-
5573
-
5574
- /**
5575
- * Event sent when command queue task is updated
5576
- */
5577
- interface CommandQueueTaskUpdatedEvent {
5578
- type: 'task_updated'
5579
- timestamp: number
5580
- data: {
5581
- task: Task
5582
- }
5583
- }
5584
-
5585
- /**
5586
- * Connection confirmation event
5587
- */
5588
- interface CommandQueueConnectedEvent {
5589
- type: 'connected'
5590
- timestamp: number
5591
- data?: undefined
5592
- }
5593
-
5594
- /**
5595
- * Event sent when action execution completes successfully
5596
- */
5597
- interface CommandQueueExecutionCompletedEvent {
5598
- type: 'execution_completed'
5599
- timestamp: number
5600
- data: {
5601
- taskId: string
5602
- targetExecutionId: string
5603
- }
5604
- }
5605
-
5606
- /**
5607
- * Event sent when action execution fails
5608
- */
5609
- interface CommandQueueExecutionFailedEvent {
5610
- type: 'execution_failed'
5611
- timestamp: number
5612
- data: {
5613
- taskId: string
5614
- targetExecutionId?: string
5615
- error: string
5616
- }
5617
- }
5618
-
5619
- /**
5620
- * Union of all command queue SSE events
5621
- */
5622
- type CommandQueueSSEEvent =
5623
- | CommandQueueTaskUpdatedEvent
5624
- | CommandQueueConnectedEvent
5625
- | CommandQueueExecutionCompletedEvent
5626
- | CommandQueueExecutionFailedEvent
5627
-
5628
- /**
5629
- * Notification SSE Event Types
5630
- *
5631
- * Type-safe definitions for notification-related SSE events
5632
- */
5633
-
5634
- /**
5635
- * Event sent when notification unread count changes
5636
- */
5637
- interface NotificationCountUpdatedEvent {
5638
- type: 'unread_count_updated'
5639
- timestamp: number
5640
- data: {
5641
- count: number
5642
- }
5643
- }
5644
-
5645
- /**
5646
- * Union of all notification SSE events
5647
- */
5648
- type NotificationSSEEvent = NotificationCountUpdatedEvent
5649
-
5650
- type ActivityType =
5651
- | 'workflow_execution'
5652
- | 'agent_run'
5653
- | 'hitl_action'
5654
- | 'webhook_received'
5655
- | 'webhook_executed'
5656
- | 'webhook_failed'
5657
- | 'credential_change'
5658
- | 'api_key_change'
5659
- | 'deployment_change'
5660
- | 'membership_change'
5661
-
5662
- type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed'
5663
-
5664
- interface Activity {
5665
- id: string
5666
- organizationId: string
5667
- activityType: ActivityType
5668
- status: ActivityStatus
5669
- title: string
5670
- description: string | null
5671
- entityType: string
5672
- entityId: string
5673
- entityName: string | null
5674
- metadata: Record<string, unknown> | null
5675
- actorId: string | null
5676
- actorType: string | null
5677
- occurredAt: Date
5678
- createdAt: Date
4899
+ /**
4900
+ * Credential schema definition
4901
+ */
4902
+ interface CredentialSchema {
4903
+ type: string;
4904
+ label: string;
4905
+ description: string;
4906
+ fields?: CredentialField[];
4907
+ docsUrl?: string;
4908
+ nameSuggestions: string[];
4909
+ oauthProvider?: string;
5679
4910
  }
5680
4911
 
5681
- /**
5682
- * Activity SSE Event Types
5683
- *
5684
- * Type-safe definitions for activity-related SSE events
5685
- */
5686
-
5687
-
5688
-
5689
- /**
5690
- * Event sent when new activity is created
5691
- */
5692
- interface ActivityCreatedEvent {
5693
- type: 'activity'
5694
- timestamp: number
5695
- data: Activity
5696
- }
5697
-
5698
- /**
5699
- * Connection confirmation event
5700
- */
5701
- interface ActivityConnectedEvent {
5702
- type: 'connected'
5703
- timestamp: number
5704
- data?: undefined
5705
- }
5706
-
5707
- /**
5708
- * Union of all activity SSE events
5709
- */
5710
- type ActivitySSEEvent = ActivityCreatedEvent | ActivityConnectedEvent
4912
+ /**
4913
+ * GET /api/credentials - List credentials
4914
+ */
4915
+ declare const ListCredentialsResponseSchema: z.ZodObject<{
4916
+ credentials: z.ZodArray<z.ZodObject<{
4917
+ id: z.ZodString;
4918
+ name: z.ZodString;
4919
+ type: z.ZodString;
4920
+ provider: z.ZodNullable<z.ZodString>;
4921
+ createdAt: z.ZodString;
4922
+ }, z.core.$strip>>;
4923
+ }, z.core.$strip>;
4924
+ /** API response type for a single credential list item */
4925
+ type CredentialListItem = z.infer<typeof ListCredentialsResponseSchema>['credentials'][number];
5711
4926
 
5712
- /**
5713
- * Webhook Endpoint Domain Types
5714
- *
5715
- * Browser-safe domain types for generic inbound webhook endpoints.
5716
- * These are camelCase representations of the `webhook_endpoints` DB table.
5717
- *
5718
- * Transform from snake_case DB rows happens in the API service layer,
5719
- * not here (per core-package.md conventions).
5720
- */
5721
-
5722
- /**
5723
- * Lifecycle status of a webhook endpoint.
5724
- * - `active`: Endpoint accepts inbound requests and triggers the target workflow
5725
- * - `paused`: Endpoint exists but rejects inbound requests with 404
5726
- */
5727
- type WebhookEndpointStatus = 'active' | 'paused'
5728
-
5729
- /**
5730
- * Generic inbound webhook endpoint domain type.
5731
- *
5732
- * Each endpoint gets a unique opaque URL (`/api/webhooks/inbound/:key`)
5733
- * that maps to a target workflow resource within an organization.
5734
- */
5735
- interface WebhookEndpoint {
5736
- /** UUID primary key */
5737
- id: string
5738
- /** Organization this endpoint belongs to */
5739
- organizationId: string
5740
- /**
5741
- * Unique opaque key used in the inbound URL.
5742
- * Format: `wh_` + 32 crypto-random hex chars (128 bits of entropy).
5743
- * This key IS the credential — it must be kept secret.
5744
- */
5745
- key: string
5746
- /** User-facing label (e.g., "Zapier Lead Intake") */
5747
- name: string
5748
- /** Optional description for the endpoint */
5749
- description: string | null
5750
- /** Target workflow resourceId to invoke on inbound request, or null if not yet assigned */
5751
- resourceId: string | null
5752
- /** Whether the endpoint is accepting requests */
5753
- status: WebhookEndpointStatus
5754
- /** Timestamp of the most recent successful inbound request, or null */
5755
- lastTriggeredAt: string | null
5756
- /** Running total of inbound requests received */
5757
- requestCount: number
5758
- /** ISO 8601 creation timestamp */
5759
- createdAt: string
5760
- /** ISO 8601 last-updated timestamp */
5761
- updatedAt: string
4927
+ /**
4928
+ * Webhook Endpoint Domain Types
4929
+ *
4930
+ * Browser-safe domain types for generic inbound webhook endpoints.
4931
+ * These are camelCase representations of the `webhook_endpoints` DB table.
4932
+ *
4933
+ * Transform from snake_case DB rows happens in the API service layer,
4934
+ * not here (per core-package.md conventions).
4935
+ */
4936
+ /**
4937
+ * Lifecycle status of a webhook endpoint.
4938
+ * - `active`: Endpoint accepts inbound requests and triggers the target workflow
4939
+ * - `paused`: Endpoint exists but rejects inbound requests with 404
4940
+ */
4941
+ type WebhookEndpointStatus = 'active' | 'paused';
4942
+ /**
4943
+ * Generic inbound webhook endpoint domain type.
4944
+ *
4945
+ * Each endpoint gets a unique opaque URL (`/api/webhooks/inbound/:key`)
4946
+ * that maps to a target workflow resource within an organization.
4947
+ */
4948
+ interface WebhookEndpoint {
4949
+ /** UUID primary key */
4950
+ id: string;
4951
+ /** Organization this endpoint belongs to */
4952
+ organizationId: string;
4953
+ /**
4954
+ * Unique opaque key used in the inbound URL.
4955
+ * Format: `wh_` + 32 crypto-random hex chars (128 bits of entropy).
4956
+ * This key IS the credential — it must be kept secret.
4957
+ */
4958
+ key: string;
4959
+ /** User-facing label (e.g., "Zapier → Lead Intake") */
4960
+ name: string;
4961
+ /** Optional description for the endpoint */
4962
+ description: string | null;
4963
+ /** Target workflow resourceId to invoke on inbound request, or null if not yet assigned */
4964
+ resourceId: string | null;
4965
+ /** Whether the endpoint is accepting requests */
4966
+ status: WebhookEndpointStatus;
4967
+ /** Timestamp of the most recent successful inbound request, or null */
4968
+ lastTriggeredAt: string | null;
4969
+ /** Running total of inbound requests received */
4970
+ requestCount: number;
4971
+ /** ISO 8601 creation timestamp */
4972
+ createdAt: string;
4973
+ /** ISO 8601 last-updated timestamp */
4974
+ updatedAt: string;
5762
4975
  }
5763
4976
 
5764
- /**
5765
- * POST /api/webhook-endpoints - Create a new webhook endpoint
5766
- *
5767
- * The `key` and `id` are generated server-side and not accepted in the request.
5768
- */
5769
- declare const CreateWebhookEndpointRequestSchema = z
5770
- .object({
5771
- /** User-facing label for the endpoint */
5772
- name: NonEmptyStringSchema,
5773
- /** Target workflow resourceId to invoke on inbound requests (can be set later) */
5774
- resourceId: NonEmptyStringSchema.optional(),
5775
- /** Optional description */
5776
- description: z.string().optional()
5777
- })
5778
- .strict()
5779
-
5780
- type CreateWebhookEndpointRequest = z.infer<typeof CreateWebhookEndpointRequestSchema>
5781
-
5782
- /**
5783
- * PATCH /api/webhook-endpoints/:id - Update an existing webhook endpoint
5784
- *
5785
- * At least one field must be provided.
5786
- */
5787
- declare const UpdateWebhookEndpointRequestSchema = z
5788
- .object({
5789
- name: NonEmptyStringSchema.optional(),
5790
- description: z.string().optional(),
5791
- resourceId: NonEmptyStringSchema.optional(),
5792
- status: WebhookEndpointStatusSchema.optional()
5793
- })
5794
- .strict()
5795
- .refine(
5796
- (data) =>
5797
- data.name !== undefined ||
5798
- data.description !== undefined ||
5799
- data.resourceId !== undefined ||
5800
- data.status !== undefined,
5801
- { message: 'At least one field (name, description, resourceId, or status) must be provided' }
5802
- )
5803
-
5804
- type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestSchema>
5805
-
5806
- /**
5807
- * Response shape for a single webhook endpoint.
5808
- * NOT strict — response schemas allow extra fields for forward compatibility.
5809
- */
5810
- declare const WebhookEndpointResponseSchema = z.object({
5811
- id: UuidSchema,
5812
- organizationId: UuidSchema,
5813
- key: z.string(),
5814
- name: z.string(),
5815
- description: z.string().nullable(),
5816
- resourceId: z.string().nullable(),
5817
- status: WebhookEndpointStatusSchema,
5818
- lastTriggeredAt: z.string().datetime().nullable(),
5819
- requestCount: z.number().int().min(0),
5820
- createdAt: z.string().datetime(),
5821
- updatedAt: z.string().datetime()
5822
- })
5823
-
5824
- type WebhookEndpointResponse = z.infer<typeof WebhookEndpointResponseSchema>
5825
-
5826
- /**
5827
- * GET /api/credentials - List credentials
5828
- */
5829
- declare const ListCredentialsResponseSchema = z.object({
5830
- credentials: z.array(
5831
- z.object({
5832
- id: UuidSchema,
5833
- name: z.string(),
5834
- type: z.string(),
5835
- provider: z.string().nullable(), // OAuth provider or null for non-OAuth
5836
- createdAt: z.string().datetime()
5837
- })
5838
- )
5839
- })
5840
-
5841
- /** API response type for a single credential list item */
5842
- type CredentialListItem = z.infer<typeof ListCredentialsResponseSchema>['credentials'][number]
5843
-
5844
- /**
5845
- * @deprecated Use TimeRange from '@repo/core' directly. Kept as alias for backward compatibility.
5846
- */
5847
- type StatsTimeRange = TimeRange
5848
-
5849
- /** Stats returned by /command-view/stats (counts only, no error details) */
5850
- interface ResourceStats {
5851
- resourceId: string
5852
- totalRuns: number
5853
- successCount: number
5854
- failureCount: number // Used for badge: "X failed"
5855
- warningCount: number // Completed with warnings (counts toward success)
5856
- lastRunAt: string | null
5857
- // NO recentErrors or totalErrors - fetched on-demand via /resource-errors
5858
- }
5859
-
5860
- /** Response from /command-view/resource-errors (on-demand) */
5861
- interface ResourceErrorsResponse {
5862
- resourceId: string
5863
- errors: ErrorSummary[]
5864
- totalErrors: number // Total count for "showing 10 of X" display
5865
- timeRange: StatsTimeRange
5866
- }
5867
-
5868
- interface ErrorSummary {
5869
- executionId: string
5870
- errorType: string
5871
- errorMessage: string
5872
- occurredAt: string
5873
- }
5874
-
5875
- /** Single execution summary for Recent Executions list in command view */
5876
- interface CommandViewExecution {
5877
- executionId: string
5878
- status: ExecutionStatus
5879
- startedAt: string
5880
- completedAt: string | null
5881
- errorMessage: string | null // Only present if failed
5882
- }
5883
-
5884
- /** Response from /command-view/resource-executions (on-demand) */
5885
- interface ResourceExecutionsResponse {
5886
- resourceId: string
5887
- executions: CommandViewExecution[]
5888
- totalExecutions: number // Total count for "showing 10 of X" display
5889
- timeRange: StatsTimeRange
5890
- page: number
5891
- limit: number
5892
- }
5893
-
5894
- interface HumanCheckpointStats {
5895
- checkpointId: string
5896
- pendingCount: number
5897
- completedCount: number
5898
- expiredCount: number
5899
- lastDecisionAt: string | null
5900
- }
5901
-
5902
- /** Response from /command-view/stats */
5903
- interface CommandViewStatsResponse {
5904
- resources: Record<string, ResourceStats>
5905
- humanCheckpoints: Record<string, HumanCheckpointStats>
5906
- timeRange: StatsTimeRange
5907
- generatedAt: string
5908
- }
4977
+ /**
4978
+ * POST /api/webhook-endpoints - Create a new webhook endpoint
4979
+ *
4980
+ * The `key` and `id` are generated server-side and not accepted in the request.
4981
+ */
4982
+ declare const CreateWebhookEndpointRequestSchema: z.ZodObject<{
4983
+ name: z.ZodString;
4984
+ resourceId: z.ZodOptional<z.ZodString>;
4985
+ description: z.ZodOptional<z.ZodString>;
4986
+ }, z.core.$strict>;
4987
+ type CreateWebhookEndpointRequest = z.infer<typeof CreateWebhookEndpointRequestSchema>;
4988
+ /**
4989
+ * PATCH /api/webhook-endpoints/:id - Update an existing webhook endpoint
4990
+ *
4991
+ * At least one field must be provided.
4992
+ */
4993
+ declare const UpdateWebhookEndpointRequestSchema: z.ZodObject<{
4994
+ name: z.ZodOptional<z.ZodString>;
4995
+ description: z.ZodOptional<z.ZodString>;
4996
+ resourceId: z.ZodOptional<z.ZodString>;
4997
+ status: z.ZodOptional<z.ZodEnum<{
4998
+ active: "active";
4999
+ paused: "paused";
5000
+ }>>;
5001
+ }, z.core.$strict>;
5002
+ type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestSchema>;
5003
+ /**
5004
+ * Response shape for a single webhook endpoint.
5005
+ * NOT strict — response schemas allow extra fields for forward compatibility.
5006
+ */
5007
+ declare const WebhookEndpointResponseSchema: z.ZodObject<{
5008
+ id: z.ZodString;
5009
+ organizationId: z.ZodString;
5010
+ key: z.ZodString;
5011
+ name: z.ZodString;
5012
+ description: z.ZodNullable<z.ZodString>;
5013
+ resourceId: z.ZodNullable<z.ZodString>;
5014
+ status: z.ZodEnum<{
5015
+ active: "active";
5016
+ paused: "paused";
5017
+ }>;
5018
+ lastTriggeredAt: z.ZodNullable<z.ZodString>;
5019
+ requestCount: z.ZodNumber;
5020
+ createdAt: z.ZodString;
5021
+ updatedAt: z.ZodString;
5022
+ }, z.core.$strip>;
5023
+ type WebhookEndpointResponse = z.infer<typeof WebhookEndpointResponseSchema>;
5909
5024
 
5910
- export type { AIResourceDefinition, APIExecutionDetail, APIExecutionListResponse, APIExecutionSummary, AbsoluteScheduleConfig, AbsoluteScheduleItem, ActionConfig, Activity, ActivitySSEEvent, ActivityStatus, ActivityType, AgentIterationData, AgentMemory, ApiKeyListItem, BusinessImpactMetrics, ChatMessage, CheckpointListResponse, CommandQueueSSEEvent, CommandViewAgent, CommandViewData, CommandViewNode, CommandViewNodeType, CommandViewStatsResponse, CommandViewWorkflow, CostBreakdownMetrics, CostByModelResponse, CostSummaryResponse, CostTrendsResponse, CreateWebhookEndpointRequest, CredentialListItem, DashboardMetrics, DealListItem, DealStage, Deployment, DeploymentStatus, DomainDefinition, ErrorAnalysisMetrics, ErrorDetailFull, ErrorDetailResponse, ErrorTrend, ExecutionHealthMetrics, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogMessage, ExecutionMetricsDetail, ExecutionRunnerCatalogItem, ExecutionSSEEvent, ExecutionStatus$1 as ExecutionStatus, ExecutionSummary, FailingResource, HumanCheckpointDefinition, HumanCheckpointStats, KanbanBoardConfig, ListMembershipsParams, MembershipFeatureConfig, MembershipStatus, MembershipWithDetails, MessageEvent, MessageType, ModelConfig, NotificationDTO, NotificationSSEEvent, PatchTaskParams, QueueTaskStatus, RecentExecutionsByResourceResponse, RecurringScheduleConfig, RelativeScheduleConfig, RelativeScheduleItem, ResourceDefinition$1 as ResourceDefinition, ResourceDomain, ResourceErrorsResponse, ResourceExecutionSummary, ResourceExecutionsResponse, ResourceHealth, ResourceIdentifier, ResourceStats, ResourceStatus$1 as ResourceStatus, ResourceType$1 as ResourceType, ResourcesHealthResponse, SerializedAgentDefinition, SerializedExecutionInterface, SerializedWorkflowDefinition, SessionDTO, SessionTokenUsage, StatsTimeRange, SupabaseUserProfile, Task, TaskSchedule, TaskScheduleConfig, TimeRange, WorkflowNodeVisualizerData as TimelineData, UpdateWebhookEndpointRequest, UserConfig, WebhookEndpoint, WebhookEndpointResponse };
5025
+ export type { AIResourceDefinition, APIExecutionDetail, APIExecutionListResponse, APIExecutionSummary, AbsoluteScheduleConfig, AbsoluteScheduleItem, ActionConfig, Activity, ActivitySSEEvent, ActivityStatus, ActivityType, AgentIterationData, AgentMemory, ApiKeyListItem, BusinessImpactMetrics, ChatMessage, CheckpointListResponse, CommandQueueSSEEvent, CommandViewAgent, CommandViewData, CommandViewNode, CommandViewNodeType, CommandViewStatsResponse, CommandViewWorkflow, CostBreakdownMetrics, CostByModelResponse, CostSummaryResponse, CostTrendsResponse, CreateWebhookEndpointRequest, CredentialField, CredentialListItem, CredentialSchema, DashboardMetrics, DealListItem, DealStage, Deployment, DeploymentStatus, DomainDefinition, ErrorAnalysisMetrics, ErrorDetailFull, ErrorDetailResponse, ErrorTrend, ExecutionHealthMetrics, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogMessage, ExecutionMetricsDetail, ExecutionRunnerCatalogItem, ExecutionSSEEvent, ExecutionStatus, ExecutionSummary, FailingResource, HumanCheckpointDefinition, HumanCheckpointStats, KanbanBoardConfig, ListMembershipsParams, MembershipFeatureConfig, MembershipStatus, MembershipWithDetails, MessageEvent, MessageType, ModelConfig, NotificationDTO, NotificationSSEEvent, OAuthProviderConfig, PatchTaskParams, QueueTaskStatus, RecentExecutionsByResourceResponse, RecurringScheduleConfig, RelativeScheduleConfig, RelativeScheduleItem, ResourceDefinition, ResourceDomain, ResourceErrorsResponse, ResourceExecutionSummary, ResourceExecutionsResponse, ResourceHealth, ResourceIdentifier, ResourceStats, ResourceStatus, ResourceType, ResourcesHealthResponse, SerializedAgentDefinition, SerializedExecutionInterface, SerializedWorkflowDefinition, SessionDTO, SessionTokenUsage, StatsTimeRange, SupabaseUserProfile, Task, TaskSchedule, TaskScheduleConfig, TimeRange, WorkflowNodeVisualizerData as TimelineData, UpdateWebhookEndpointRequest, UserConfig, WebhookEndpoint, WebhookEndpointResponse };