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