@elevasis/ui 1.3.6 → 1.3.7
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/types/index.d.ts +513 -116
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
* Workflow-specific logging types and utilities
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
interface WorkflowExecutionContext {
|
|
7
|
+
interface WorkflowExecutionContext$1 {
|
|
8
8
|
type: 'workflow';
|
|
9
9
|
contextType: 'workflow-execution';
|
|
10
10
|
executionId: string;
|
|
@@ -13,14 +13,14 @@ interface WorkflowExecutionContext {
|
|
|
13
13
|
organizationId: string;
|
|
14
14
|
executionPath?: string[];
|
|
15
15
|
}
|
|
16
|
-
interface WorkflowFailureContext {
|
|
16
|
+
interface WorkflowFailureContext$1 {
|
|
17
17
|
type: 'workflow';
|
|
18
18
|
contextType: 'workflow-failure';
|
|
19
19
|
executionId: string;
|
|
20
20
|
workflowId: string;
|
|
21
21
|
error: string;
|
|
22
22
|
}
|
|
23
|
-
interface StepStartedContext {
|
|
23
|
+
interface StepStartedContext$1 {
|
|
24
24
|
type: 'workflow';
|
|
25
25
|
contextType: 'step-started';
|
|
26
26
|
stepId: string;
|
|
@@ -28,7 +28,7 @@ interface StepStartedContext {
|
|
|
28
28
|
input: unknown;
|
|
29
29
|
startTime: number;
|
|
30
30
|
}
|
|
31
|
-
interface StepCompletedContext {
|
|
31
|
+
interface StepCompletedContext$1 {
|
|
32
32
|
type: 'workflow';
|
|
33
33
|
contextType: 'step-completed';
|
|
34
34
|
stepId: string;
|
|
@@ -39,7 +39,7 @@ interface StepCompletedContext {
|
|
|
39
39
|
startTime: number;
|
|
40
40
|
endTime: number;
|
|
41
41
|
}
|
|
42
|
-
interface StepFailedContext {
|
|
42
|
+
interface StepFailedContext$1 {
|
|
43
43
|
type: 'workflow';
|
|
44
44
|
contextType: 'step-failed';
|
|
45
45
|
stepId: string;
|
|
@@ -49,19 +49,19 @@ interface StepFailedContext {
|
|
|
49
49
|
startTime: number;
|
|
50
50
|
endTime: number;
|
|
51
51
|
}
|
|
52
|
-
interface ConditionalRouteContext {
|
|
52
|
+
interface ConditionalRouteContext$1 {
|
|
53
53
|
type: 'workflow';
|
|
54
54
|
contextType: 'conditional-route';
|
|
55
55
|
stepId: string;
|
|
56
56
|
target: string;
|
|
57
57
|
error?: string;
|
|
58
58
|
}
|
|
59
|
-
interface ExecutionPathContext {
|
|
59
|
+
interface ExecutionPathContext$1 {
|
|
60
60
|
type: 'workflow';
|
|
61
61
|
contextType: 'execution-path';
|
|
62
62
|
executionPath: string[];
|
|
63
63
|
}
|
|
64
|
-
type WorkflowLogContext = WorkflowExecutionContext | WorkflowFailureContext | StepStartedContext | StepCompletedContext | StepFailedContext | ConditionalRouteContext | ExecutionPathContext;
|
|
64
|
+
type WorkflowLogContext$1 = WorkflowExecutionContext$1 | WorkflowFailureContext$1 | StepStartedContext$1 | StepCompletedContext$1 | StepFailedContext$1 | ConditionalRouteContext$1 | ExecutionPathContext$1;
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Agent-specific logging types
|
|
@@ -76,26 +76,26 @@ type WorkflowLogContext = WorkflowExecutionContext | WorkflowFailureContext | St
|
|
|
76
76
|
* Agent lifecycle stages
|
|
77
77
|
* Universal checkpoints that apply to all agent executions
|
|
78
78
|
*/
|
|
79
|
-
type AgentLifecycle = 'initialization' | 'iteration' | 'completion';
|
|
79
|
+
type AgentLifecycle$1 = 'initialization' | 'iteration' | 'completion';
|
|
80
80
|
/**
|
|
81
81
|
* Iteration event types
|
|
82
82
|
* Activities that occur during agent iterations
|
|
83
83
|
*/
|
|
84
|
-
type IterationEventType = 'reasoning' | 'action' | 'tool-call';
|
|
84
|
+
type IterationEventType$1 = 'reasoning' | 'action' | 'tool-call';
|
|
85
85
|
/**
|
|
86
86
|
* Base fields shared by all lifecycle events
|
|
87
87
|
*/
|
|
88
|
-
interface AgentLifecycleEventBase {
|
|
88
|
+
interface AgentLifecycleEventBase$1 {
|
|
89
89
|
type: 'agent';
|
|
90
90
|
agentId: string;
|
|
91
|
-
lifecycle: AgentLifecycle;
|
|
91
|
+
lifecycle: AgentLifecycle$1;
|
|
92
92
|
sessionId?: string;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* Lifecycle started event - emitted when a phase begins
|
|
96
96
|
* REQUIRED: startTime (phase has started, no end yet)
|
|
97
97
|
*/
|
|
98
|
-
interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
|
|
98
|
+
interface AgentLifecycleStartedEvent$1 extends AgentLifecycleEventBase$1 {
|
|
99
99
|
stage: 'started';
|
|
100
100
|
startTime: number;
|
|
101
101
|
iteration?: number;
|
|
@@ -104,7 +104,7 @@ interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
|
|
|
104
104
|
* Lifecycle completed event - emitted when a phase succeeds
|
|
105
105
|
* REQUIRED: startTime, endTime, duration (phase has finished successfully)
|
|
106
106
|
*/
|
|
107
|
-
interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
|
|
107
|
+
interface AgentLifecycleCompletedEvent$1 extends AgentLifecycleEventBase$1 {
|
|
108
108
|
stage: 'completed';
|
|
109
109
|
startTime: number;
|
|
110
110
|
endTime: number;
|
|
@@ -120,7 +120,7 @@ interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
|
|
|
120
120
|
* Lifecycle failed event - emitted when a phase fails
|
|
121
121
|
* REQUIRED: startTime, endTime, duration, error (phase has finished with error)
|
|
122
122
|
*/
|
|
123
|
-
interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
|
|
123
|
+
interface AgentLifecycleFailedEvent$1 extends AgentLifecycleEventBase$1 {
|
|
124
124
|
stage: 'failed';
|
|
125
125
|
startTime: number;
|
|
126
126
|
endTime: number;
|
|
@@ -132,23 +132,23 @@ interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
|
|
|
132
132
|
* Union type for all lifecycle events
|
|
133
133
|
* Discriminated by 'stage' field for type narrowing
|
|
134
134
|
*/
|
|
135
|
-
type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent;
|
|
135
|
+
type AgentLifecycleEvent$1 = AgentLifecycleStartedEvent$1 | AgentLifecycleCompletedEvent$1 | AgentLifecycleFailedEvent$1;
|
|
136
136
|
/**
|
|
137
137
|
* Placeholder data for MVP
|
|
138
138
|
* Will be typed per actionType in future
|
|
139
139
|
*/
|
|
140
|
-
interface ActionPlaceholderData {
|
|
140
|
+
interface ActionPlaceholderData$1 {
|
|
141
141
|
message: string;
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* Iteration event - captures activities during agent iterations
|
|
145
145
|
* Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
|
|
146
146
|
*/
|
|
147
|
-
interface AgentIterationEvent {
|
|
147
|
+
interface AgentIterationEvent$1 {
|
|
148
148
|
type: 'agent';
|
|
149
149
|
agentId: string;
|
|
150
150
|
lifecycle: 'iteration';
|
|
151
|
-
eventType: IterationEventType;
|
|
151
|
+
eventType: IterationEventType$1;
|
|
152
152
|
iteration: number;
|
|
153
153
|
sessionId?: string;
|
|
154
154
|
startTime: number;
|
|
@@ -156,13 +156,13 @@ interface AgentIterationEvent {
|
|
|
156
156
|
duration: number;
|
|
157
157
|
output?: string;
|
|
158
158
|
actionType?: string;
|
|
159
|
-
data?: ActionPlaceholderData;
|
|
159
|
+
data?: ActionPlaceholderData$1;
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* Tool call event - captures individual tool executions during iterations
|
|
163
163
|
* Provides granular timing for each tool invocation
|
|
164
164
|
*/
|
|
165
|
-
interface AgentToolCallEvent {
|
|
165
|
+
interface AgentToolCallEvent$1 {
|
|
166
166
|
type: 'agent';
|
|
167
167
|
agentId: string;
|
|
168
168
|
lifecycle: 'iteration';
|
|
@@ -182,19 +182,19 @@ interface AgentToolCallEvent {
|
|
|
182
182
|
* Union type for all agent log contexts
|
|
183
183
|
* 3 event types total (lifecycle, iteration, tool-call)
|
|
184
184
|
*/
|
|
185
|
-
type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent;
|
|
185
|
+
type AgentLogContext$1 = AgentLifecycleEvent$1 | AgentIterationEvent$1 | AgentToolCallEvent$1;
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
188
|
* Base execution logger for Execution Engine
|
|
189
189
|
*/
|
|
190
|
-
type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
190
|
+
type ExecutionLogLevel$1 = 'debug' | 'info' | 'warn' | 'error';
|
|
191
191
|
|
|
192
|
-
type LogContext = WorkflowLogContext | AgentLogContext;
|
|
193
|
-
interface ExecutionLogMessage {
|
|
194
|
-
level: ExecutionLogLevel;
|
|
192
|
+
type LogContext$1 = WorkflowLogContext$1 | AgentLogContext$1;
|
|
193
|
+
interface ExecutionLogMessage$1 {
|
|
194
|
+
level: ExecutionLogLevel$1;
|
|
195
195
|
message: string;
|
|
196
196
|
timestamp: number;
|
|
197
|
-
context?: LogContext;
|
|
197
|
+
context?: LogContext$1;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/**
|
|
@@ -2825,16 +2825,16 @@ declare const DOMAINS: {
|
|
|
2825
2825
|
*/
|
|
2826
2826
|
type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS];
|
|
2827
2827
|
|
|
2828
|
-
type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
|
|
2828
|
+
type ExecutionStatus$1 = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
|
|
2829
2829
|
interface APIExecutionSummary {
|
|
2830
2830
|
id: string;
|
|
2831
|
-
status: ExecutionStatus;
|
|
2831
|
+
status: ExecutionStatus$1;
|
|
2832
2832
|
startTime: number;
|
|
2833
2833
|
endTime?: number;
|
|
2834
2834
|
resourceStatus?: ResourceStatus;
|
|
2835
2835
|
}
|
|
2836
2836
|
interface APIExecutionDetail extends APIExecutionSummary {
|
|
2837
|
-
executionLogs: ExecutionLogMessage[];
|
|
2837
|
+
executionLogs: ExecutionLogMessage$1[];
|
|
2838
2838
|
input?: unknown;
|
|
2839
2839
|
result?: unknown;
|
|
2840
2840
|
error?: string;
|
|
@@ -2847,6 +2847,269 @@ interface APIExecutionListResponse {
|
|
|
2847
2847
|
executions: APIExecutionSummary[];
|
|
2848
2848
|
}
|
|
2849
2849
|
|
|
2850
|
+
/**
|
|
2851
|
+
* Workflow-specific logging types and utilities
|
|
2852
|
+
*/
|
|
2853
|
+
|
|
2854
|
+
|
|
2855
|
+
|
|
2856
|
+
// Workflow start/end log context
|
|
2857
|
+
interface WorkflowExecutionContext {
|
|
2858
|
+
type: 'workflow'
|
|
2859
|
+
contextType: 'workflow-execution'
|
|
2860
|
+
executionId: string
|
|
2861
|
+
workflowId: string
|
|
2862
|
+
workflowName?: string
|
|
2863
|
+
organizationId: string
|
|
2864
|
+
executionPath?: string[]
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
// Workflow failure log context
|
|
2868
|
+
interface WorkflowFailureContext {
|
|
2869
|
+
type: 'workflow'
|
|
2870
|
+
contextType: 'workflow-failure'
|
|
2871
|
+
executionId: string
|
|
2872
|
+
workflowId: string
|
|
2873
|
+
error: string
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
// Step started log context
|
|
2877
|
+
interface StepStartedContext {
|
|
2878
|
+
type: 'workflow'
|
|
2879
|
+
contextType: 'step-started'
|
|
2880
|
+
stepId: string
|
|
2881
|
+
stepStatus: 'started'
|
|
2882
|
+
input: unknown
|
|
2883
|
+
startTime: number // Explicit start timestamp for timeline
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
// Step completed log context
|
|
2887
|
+
interface StepCompletedContext {
|
|
2888
|
+
type: 'workflow'
|
|
2889
|
+
contextType: 'step-completed'
|
|
2890
|
+
stepId: string
|
|
2891
|
+
stepStatus: 'completed'
|
|
2892
|
+
output: unknown
|
|
2893
|
+
duration: number
|
|
2894
|
+
isTerminal: boolean
|
|
2895
|
+
startTime: number // Explicit start timestamp for timeline
|
|
2896
|
+
endTime: number // Explicit end timestamp for timeline
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
// Step failed log context
|
|
2900
|
+
interface StepFailedContext {
|
|
2901
|
+
type: 'workflow'
|
|
2902
|
+
contextType: 'step-failed'
|
|
2903
|
+
stepId: string
|
|
2904
|
+
stepStatus: 'failed'
|
|
2905
|
+
error: string
|
|
2906
|
+
duration: number
|
|
2907
|
+
startTime: number // Explicit start timestamp for timeline
|
|
2908
|
+
endTime: number // Explicit end timestamp for timeline
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
// Conditional routing log context
|
|
2912
|
+
interface ConditionalRouteContext {
|
|
2913
|
+
type: 'workflow'
|
|
2914
|
+
contextType: 'conditional-route'
|
|
2915
|
+
stepId: string
|
|
2916
|
+
target: string
|
|
2917
|
+
error?: string
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
// Execution path log context
|
|
2921
|
+
interface ExecutionPathContext {
|
|
2922
|
+
type: 'workflow'
|
|
2923
|
+
contextType: 'execution-path'
|
|
2924
|
+
executionPath: string[]
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
// Union of all workflow log contexts
|
|
2928
|
+
type WorkflowLogContext =
|
|
2929
|
+
| WorkflowExecutionContext
|
|
2930
|
+
| WorkflowFailureContext
|
|
2931
|
+
| StepStartedContext
|
|
2932
|
+
| StepCompletedContext
|
|
2933
|
+
| StepFailedContext
|
|
2934
|
+
| ConditionalRouteContext
|
|
2935
|
+
| ExecutionPathContext
|
|
2936
|
+
|
|
2937
|
+
/**
|
|
2938
|
+
* Agent-specific logging types
|
|
2939
|
+
* Simplified 2-event model: lifecycle, iteration
|
|
2940
|
+
*
|
|
2941
|
+
* Design Philosophy:
|
|
2942
|
+
* - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
|
|
2943
|
+
* - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
|
|
2944
|
+
*/
|
|
2945
|
+
|
|
2946
|
+
|
|
2947
|
+
|
|
2948
|
+
// ============================================================================
|
|
2949
|
+
// FORMAL TYPES
|
|
2950
|
+
// ============================================================================
|
|
2951
|
+
|
|
2952
|
+
/**
|
|
2953
|
+
* Agent lifecycle stages
|
|
2954
|
+
* Universal checkpoints that apply to all agent executions
|
|
2955
|
+
*/
|
|
2956
|
+
type AgentLifecycle = 'initialization' | 'iteration' | 'completion'
|
|
2957
|
+
|
|
2958
|
+
/**
|
|
2959
|
+
* Iteration event types
|
|
2960
|
+
* Activities that occur during agent iterations
|
|
2961
|
+
*/
|
|
2962
|
+
type IterationEventType = 'reasoning' | 'action' | 'tool-call'
|
|
2963
|
+
|
|
2964
|
+
// ============================================================================
|
|
2965
|
+
// LIFECYCLE EVENTS (Structural Checkpoints)
|
|
2966
|
+
// ============================================================================
|
|
2967
|
+
|
|
2968
|
+
/**
|
|
2969
|
+
* Base fields shared by all lifecycle events
|
|
2970
|
+
*/
|
|
2971
|
+
interface AgentLifecycleEventBase {
|
|
2972
|
+
type: 'agent'
|
|
2973
|
+
agentId: string
|
|
2974
|
+
lifecycle: AgentLifecycle
|
|
2975
|
+
sessionId?: string // Optional: only present when agent runs in session context
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
/**
|
|
2979
|
+
* Lifecycle started event - emitted when a phase begins
|
|
2980
|
+
* REQUIRED: startTime (phase has started, no end yet)
|
|
2981
|
+
*/
|
|
2982
|
+
interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
|
|
2983
|
+
stage: 'started'
|
|
2984
|
+
startTime: number // REQUIRED: Phase start timestamp
|
|
2985
|
+
iteration?: number // Only for 'iteration' lifecycle
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
/**
|
|
2989
|
+
* Lifecycle completed event - emitted when a phase succeeds
|
|
2990
|
+
* REQUIRED: startTime, endTime, duration (phase has finished successfully)
|
|
2991
|
+
*/
|
|
2992
|
+
interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
|
|
2993
|
+
stage: 'completed'
|
|
2994
|
+
startTime: number // REQUIRED: Phase start timestamp
|
|
2995
|
+
endTime: number // REQUIRED: Phase end timestamp
|
|
2996
|
+
duration: number // REQUIRED: Calculated duration (endTime - startTime)
|
|
2997
|
+
iteration?: number // Only for 'iteration' lifecycle
|
|
2998
|
+
|
|
2999
|
+
// Optional fields specific to certain lifecycles
|
|
3000
|
+
attempts?: number // Only for 'completion' lifecycle (tracks output generation attempts: 1 or 2)
|
|
3001
|
+
memorySize?: {
|
|
3002
|
+
sessionMemoryKeys: number
|
|
3003
|
+
historyEntries: number
|
|
3004
|
+
} // Only for 'completion' lifecycle (memory snapshot metadata)
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
/**
|
|
3008
|
+
* Lifecycle failed event - emitted when a phase fails
|
|
3009
|
+
* REQUIRED: startTime, endTime, duration, error (phase has finished with error)
|
|
3010
|
+
*/
|
|
3011
|
+
interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
|
|
3012
|
+
stage: 'failed'
|
|
3013
|
+
startTime: number // REQUIRED: Phase start timestamp
|
|
3014
|
+
endTime: number // REQUIRED: Phase end timestamp
|
|
3015
|
+
duration: number // REQUIRED: Calculated duration (endTime - startTime)
|
|
3016
|
+
error: string // REQUIRED: Error message
|
|
3017
|
+
iteration?: number // Only for 'iteration' lifecycle
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
/**
|
|
3021
|
+
* Union type for all lifecycle events
|
|
3022
|
+
* Discriminated by 'stage' field for type narrowing
|
|
3023
|
+
*/
|
|
3024
|
+
type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent
|
|
3025
|
+
|
|
3026
|
+
// ============================================================================
|
|
3027
|
+
// ITERATION EVENTS (Execution Activities)
|
|
3028
|
+
// ============================================================================
|
|
3029
|
+
|
|
3030
|
+
/**
|
|
3031
|
+
* Placeholder data for MVP
|
|
3032
|
+
* Will be typed per actionType in future
|
|
3033
|
+
*/
|
|
3034
|
+
interface ActionPlaceholderData {
|
|
3035
|
+
message: string
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
/**
|
|
3039
|
+
* Iteration event - captures activities during agent iterations
|
|
3040
|
+
* Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
|
|
3041
|
+
*/
|
|
3042
|
+
interface AgentIterationEvent {
|
|
3043
|
+
type: 'agent'
|
|
3044
|
+
agentId: string
|
|
3045
|
+
lifecycle: 'iteration' // Always iteration
|
|
3046
|
+
eventType: IterationEventType
|
|
3047
|
+
iteration: number
|
|
3048
|
+
sessionId?: string // Optional: only present when agent runs in session context
|
|
3049
|
+
|
|
3050
|
+
// Timeline timing fields (v2 - Clean Break)
|
|
3051
|
+
startTime: number // Activity start timestamp
|
|
3052
|
+
endTime: number // Activity end timestamp
|
|
3053
|
+
duration: number // Calculated duration (endTime - startTime)
|
|
3054
|
+
|
|
3055
|
+
// Conditional fields based on eventType
|
|
3056
|
+
output?: string // For reasoning events
|
|
3057
|
+
actionType?: string // For action events (tool-use, delegate, memory-write, etc.)
|
|
3058
|
+
data?: ActionPlaceholderData // For action events
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
/**
|
|
3062
|
+
* Tool call event - captures individual tool executions during iterations
|
|
3063
|
+
* Provides granular timing for each tool invocation
|
|
3064
|
+
*/
|
|
3065
|
+
interface AgentToolCallEvent {
|
|
3066
|
+
type: 'agent'
|
|
3067
|
+
agentId: string
|
|
3068
|
+
lifecycle: 'iteration' // Always iteration
|
|
3069
|
+
eventType: 'tool-call' // Specific event type for tool calls
|
|
3070
|
+
iteration: number
|
|
3071
|
+
sessionId?: string // Optional: only present when agent runs in session context
|
|
3072
|
+
|
|
3073
|
+
// Tool identification and timing
|
|
3074
|
+
toolName: string // Tool identifier
|
|
3075
|
+
startTime: number // Tool call start timestamp
|
|
3076
|
+
endTime: number // Tool call end timestamp
|
|
3077
|
+
duration: number // Calculated duration
|
|
3078
|
+
|
|
3079
|
+
// Execution results
|
|
3080
|
+
success: boolean // Whether tool execution succeeded
|
|
3081
|
+
error?: string // Error message if failed
|
|
3082
|
+
input?: Record<string, unknown> // Tool input parameters
|
|
3083
|
+
output?: unknown // Tool output result
|
|
3084
|
+
}
|
|
3085
|
+
|
|
3086
|
+
// ============================================================================
|
|
3087
|
+
// UNION TYPES
|
|
3088
|
+
// ============================================================================
|
|
3089
|
+
|
|
3090
|
+
/**
|
|
3091
|
+
* Union type for all agent log contexts
|
|
3092
|
+
* 3 event types total (lifecycle, iteration, tool-call)
|
|
3093
|
+
*/
|
|
3094
|
+
type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent
|
|
3095
|
+
|
|
3096
|
+
/**
|
|
3097
|
+
* Base execution logger for Execution Engine
|
|
3098
|
+
*/
|
|
3099
|
+
type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error'
|
|
3100
|
+
|
|
3101
|
+
|
|
3102
|
+
// Union type for all contexts
|
|
3103
|
+
type LogContext = WorkflowLogContext | AgentLogContext
|
|
3104
|
+
|
|
3105
|
+
// Updated interface with consolidated context
|
|
3106
|
+
interface ExecutionLogMessage {
|
|
3107
|
+
level: ExecutionLogLevel
|
|
3108
|
+
message: string
|
|
3109
|
+
timestamp: number
|
|
3110
|
+
context?: LogContext
|
|
3111
|
+
}
|
|
3112
|
+
|
|
2850
3113
|
/**
|
|
2851
3114
|
* Shared form field types for dynamic form generation
|
|
2852
3115
|
* Used by: Command Queue, Execution Runner UI, future form-based features
|
|
@@ -2918,97 +3181,12 @@ interface FormSchema {
|
|
|
2918
3181
|
fields: FormField[]
|
|
2919
3182
|
}
|
|
2920
3183
|
|
|
2921
|
-
/**
|
|
2922
|
-
* Action configuration for HITL tasks
|
|
2923
|
-
* Defines available user actions and their behavior
|
|
2924
|
-
*/
|
|
2925
|
-
interface ActionConfig {
|
|
2926
|
-
/** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
|
|
2927
|
-
id: string
|
|
2928
|
-
|
|
2929
|
-
/** Display label for UI button */
|
|
2930
|
-
label: string
|
|
2931
|
-
|
|
2932
|
-
/** Button variant/style */
|
|
2933
|
-
type: 'primary' | 'secondary' | 'danger' | 'outline'
|
|
2934
|
-
|
|
2935
|
-
/** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
|
|
2936
|
-
icon?: string
|
|
2937
|
-
|
|
2938
|
-
/** Button color (Mantine theme colors) */
|
|
2939
|
-
color?: string
|
|
2940
|
-
|
|
2941
|
-
/** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
|
|
2942
|
-
variant?: string
|
|
2943
|
-
|
|
2944
|
-
/** Execution target (agent/workflow to invoke) */
|
|
2945
|
-
target?: {
|
|
2946
|
-
resourceType: 'agent' | 'workflow'
|
|
2947
|
-
resourceId: string
|
|
2948
|
-
/**
|
|
2949
|
-
* Optional session ID for agent continuation.
|
|
2950
|
-
* If provided, invokes a new turn on the existing session instead of standalone execution.
|
|
2951
|
-
* Only valid when resourceType is 'agent'.
|
|
2952
|
-
*/
|
|
2953
|
-
sessionId?: string
|
|
2954
|
-
}
|
|
2955
|
-
|
|
2956
|
-
/** Form schema for collecting action-specific data */
|
|
2957
|
-
form?: FormSchema
|
|
2958
|
-
|
|
2959
|
-
/** Payload template for pre-filling forms */
|
|
2960
|
-
payloadTemplate?: unknown
|
|
2961
|
-
|
|
2962
|
-
/** Requires confirmation dialog */
|
|
2963
|
-
requiresConfirmation?: boolean
|
|
2964
|
-
|
|
2965
|
-
/** Confirmation message */
|
|
2966
|
-
confirmationMessage?: string
|
|
2967
|
-
|
|
2968
|
-
/** Help text / tooltip */
|
|
2969
|
-
description?: string
|
|
2970
|
-
}
|
|
2971
|
-
|
|
2972
|
-
/**
|
|
2973
|
-
* Origin resource type - where an execution/task originated from.
|
|
2974
|
-
* Used for audit trails and tracking execution lineage.
|
|
2975
|
-
*/
|
|
2976
|
-
type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api'
|
|
2977
|
-
|
|
2978
|
-
/**
|
|
2979
|
-
* Origin tracking metadata - who/what created this execution/task.
|
|
2980
|
-
* Used by both TaskScheduler and CommandQueue for complete audit trails.
|
|
2981
|
-
*/
|
|
2982
|
-
interface OriginTracking {
|
|
2983
|
-
originExecutionId: string
|
|
2984
|
-
originResourceType: OriginResourceType
|
|
2985
|
-
originResourceId: string
|
|
2986
|
-
}
|
|
2987
|
-
|
|
2988
3184
|
/**
|
|
2989
3185
|
* Error categories for observability grouping and classification.
|
|
2990
3186
|
* Used to categorize errors in the execution_errors table metadata.
|
|
2991
3187
|
*/
|
|
2992
3188
|
type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system'
|
|
2993
3189
|
|
|
2994
|
-
/**
|
|
2995
|
-
* Wire-format DTO for notification API responses.
|
|
2996
|
-
* Dates are ISO 8601 strings (not Date objects like the domain Notification type).
|
|
2997
|
-
* Used by frontend hooks that consume /api/notifications.
|
|
2998
|
-
*/
|
|
2999
|
-
interface NotificationDTO {
|
|
3000
|
-
id: string
|
|
3001
|
-
userId: string
|
|
3002
|
-
organizationId: string
|
|
3003
|
-
category: string
|
|
3004
|
-
title: string
|
|
3005
|
-
message: string
|
|
3006
|
-
actionUrl: string | null
|
|
3007
|
-
read: boolean
|
|
3008
|
-
readAt: string | null
|
|
3009
|
-
createdAt: string
|
|
3010
|
-
}
|
|
3011
|
-
|
|
3012
3190
|
// ============================================================================
|
|
3013
3191
|
// API Request/Response Types (Dashboard Observability)
|
|
3014
3192
|
// ============================================================================
|
|
@@ -3225,6 +3403,73 @@ interface CostByModelResponse {
|
|
|
3225
3403
|
totalCallCount: number
|
|
3226
3404
|
}
|
|
3227
3405
|
|
|
3406
|
+
/**
|
|
3407
|
+
* Action configuration for HITL tasks
|
|
3408
|
+
* Defines available user actions and their behavior
|
|
3409
|
+
*/
|
|
3410
|
+
interface ActionConfig {
|
|
3411
|
+
/** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
|
|
3412
|
+
id: string
|
|
3413
|
+
|
|
3414
|
+
/** Display label for UI button */
|
|
3415
|
+
label: string
|
|
3416
|
+
|
|
3417
|
+
/** Button variant/style */
|
|
3418
|
+
type: 'primary' | 'secondary' | 'danger' | 'outline'
|
|
3419
|
+
|
|
3420
|
+
/** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
|
|
3421
|
+
icon?: string
|
|
3422
|
+
|
|
3423
|
+
/** Button color (Mantine theme colors) */
|
|
3424
|
+
color?: string
|
|
3425
|
+
|
|
3426
|
+
/** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
|
|
3427
|
+
variant?: string
|
|
3428
|
+
|
|
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
|
+
|
|
3441
|
+
/** Form schema for collecting action-specific data */
|
|
3442
|
+
form?: FormSchema
|
|
3443
|
+
|
|
3444
|
+
/** Payload template for pre-filling forms */
|
|
3445
|
+
payloadTemplate?: unknown
|
|
3446
|
+
|
|
3447
|
+
/** Requires confirmation dialog */
|
|
3448
|
+
requiresConfirmation?: boolean
|
|
3449
|
+
|
|
3450
|
+
/** Confirmation message */
|
|
3451
|
+
confirmationMessage?: string
|
|
3452
|
+
|
|
3453
|
+
/** Help text / tooltip */
|
|
3454
|
+
description?: string
|
|
3455
|
+
}
|
|
3456
|
+
|
|
3457
|
+
/**
|
|
3458
|
+
* Origin resource type - where an execution/task originated from.
|
|
3459
|
+
* Used for audit trails and tracking execution lineage.
|
|
3460
|
+
*/
|
|
3461
|
+
type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api'
|
|
3462
|
+
|
|
3463
|
+
/**
|
|
3464
|
+
* Origin tracking metadata - who/what created this execution/task.
|
|
3465
|
+
* Used by both TaskScheduler and CommandQueue for complete audit trails.
|
|
3466
|
+
*/
|
|
3467
|
+
interface OriginTracking {
|
|
3468
|
+
originExecutionId: string
|
|
3469
|
+
originResourceType: OriginResourceType
|
|
3470
|
+
originResourceId: string
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3228
3473
|
/**
|
|
3229
3474
|
* Command queue task with flexible action system
|
|
3230
3475
|
*/
|
|
@@ -3342,6 +3587,64 @@ interface CheckpointListResponse {
|
|
|
3342
3587
|
priorityCounts: PriorityCounts
|
|
3343
3588
|
}
|
|
3344
3589
|
|
|
3590
|
+
/**
|
|
3591
|
+
* Wire-format DTO for notification API responses.
|
|
3592
|
+
* Dates are ISO 8601 strings (not Date objects like the domain Notification type).
|
|
3593
|
+
* Used by frontend hooks that consume /api/notifications.
|
|
3594
|
+
*/
|
|
3595
|
+
interface NotificationDTO {
|
|
3596
|
+
id: string
|
|
3597
|
+
userId: string
|
|
3598
|
+
organizationId: string
|
|
3599
|
+
category: string
|
|
3600
|
+
title: string
|
|
3601
|
+
message: string
|
|
3602
|
+
actionUrl: string | null
|
|
3603
|
+
read: boolean
|
|
3604
|
+
readAt: string | null
|
|
3605
|
+
createdAt: string
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3608
|
+
// Execution status type shared between API and UI
|
|
3609
|
+
type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning'
|
|
3610
|
+
|
|
3611
|
+
/**
|
|
3612
|
+
* Execution Runner Types
|
|
3613
|
+
*
|
|
3614
|
+
* Shared types for the Execution Runner UI feature.
|
|
3615
|
+
* Used by both API (apps/api) and frontend (apps/command-center).
|
|
3616
|
+
*/
|
|
3617
|
+
|
|
3618
|
+
|
|
3619
|
+
|
|
3620
|
+
// ============================================================================
|
|
3621
|
+
// EXECUTION METRICS
|
|
3622
|
+
// ============================================================================
|
|
3623
|
+
|
|
3624
|
+
interface ExecutionMetrics {
|
|
3625
|
+
tokenCount?: number
|
|
3626
|
+
stepCount?: number
|
|
3627
|
+
toolCallCount?: number
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
// ============================================================================
|
|
3631
|
+
// EXECUTION HISTORY TYPES
|
|
3632
|
+
// ============================================================================
|
|
3633
|
+
|
|
3634
|
+
interface ExecutionSummary {
|
|
3635
|
+
id: string
|
|
3636
|
+
resourceId: string
|
|
3637
|
+
resourceName: string
|
|
3638
|
+
status: ExecutionStatus
|
|
3639
|
+
startedAt: string
|
|
3640
|
+
completedAt?: string
|
|
3641
|
+
durationMs?: number
|
|
3642
|
+
metrics?: ExecutionMetrics
|
|
3643
|
+
input?: unknown
|
|
3644
|
+
output?: unknown
|
|
3645
|
+
error?: { message: string }
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3345
3648
|
/**
|
|
3346
3649
|
* Execution history item.
|
|
3347
3650
|
* Represents a single execution triggered by a schedule.
|
|
@@ -3400,4 +3703,98 @@ interface Activity {
|
|
|
3400
3703
|
createdAt: Date
|
|
3401
3704
|
}
|
|
3402
3705
|
|
|
3403
|
-
|
|
3706
|
+
/**
|
|
3707
|
+
* Webhook Endpoint Domain Types
|
|
3708
|
+
*
|
|
3709
|
+
* Browser-safe domain types for generic inbound webhook endpoints.
|
|
3710
|
+
* These are camelCase representations of the `webhook_endpoints` DB table.
|
|
3711
|
+
*
|
|
3712
|
+
* Transform from snake_case DB rows happens in the API service layer,
|
|
3713
|
+
* not here (per core-package.md conventions).
|
|
3714
|
+
*/
|
|
3715
|
+
|
|
3716
|
+
/**
|
|
3717
|
+
* Lifecycle status of a webhook endpoint.
|
|
3718
|
+
* - `active`: Endpoint accepts inbound requests and triggers the target workflow
|
|
3719
|
+
* - `paused`: Endpoint exists but rejects inbound requests with 404
|
|
3720
|
+
*/
|
|
3721
|
+
type WebhookEndpointStatus = 'active' | 'paused'
|
|
3722
|
+
|
|
3723
|
+
/**
|
|
3724
|
+
* Generic inbound webhook endpoint domain type.
|
|
3725
|
+
*
|
|
3726
|
+
* Each endpoint gets a unique opaque URL (`/api/webhooks/inbound/:key`)
|
|
3727
|
+
* that maps to a target workflow resource within an organization.
|
|
3728
|
+
*/
|
|
3729
|
+
interface WebhookEndpoint {
|
|
3730
|
+
/** UUID primary key */
|
|
3731
|
+
id: string
|
|
3732
|
+
/** Organization this endpoint belongs to */
|
|
3733
|
+
organizationId: string
|
|
3734
|
+
/**
|
|
3735
|
+
* Unique opaque key used in the inbound URL.
|
|
3736
|
+
* Format: `wh_` + 32 crypto-random hex chars (128 bits of entropy).
|
|
3737
|
+
* This key IS the credential — it must be kept secret.
|
|
3738
|
+
*/
|
|
3739
|
+
key: string
|
|
3740
|
+
/** User-facing label (e.g., "Zapier → Lead Intake") */
|
|
3741
|
+
name: string
|
|
3742
|
+
/** Optional description for the endpoint */
|
|
3743
|
+
description: string | null
|
|
3744
|
+
/** Target workflow resourceId to invoke on inbound request, or null if not yet assigned */
|
|
3745
|
+
resourceId: string | null
|
|
3746
|
+
/** Whether the endpoint is accepting requests */
|
|
3747
|
+
status: WebhookEndpointStatus
|
|
3748
|
+
/** Timestamp of the most recent successful inbound request, or null */
|
|
3749
|
+
lastTriggeredAt: string | null
|
|
3750
|
+
/** Running total of inbound requests received */
|
|
3751
|
+
requestCount: number
|
|
3752
|
+
/** ISO 8601 creation timestamp */
|
|
3753
|
+
createdAt: string
|
|
3754
|
+
/** ISO 8601 last-updated timestamp */
|
|
3755
|
+
updatedAt: string
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
/**
|
|
3759
|
+
* POST /api/webhook-endpoints - Create a new webhook endpoint
|
|
3760
|
+
*
|
|
3761
|
+
* The `key` and `id` are generated server-side and not accepted in the request.
|
|
3762
|
+
*/
|
|
3763
|
+
declare const CreateWebhookEndpointRequestSchema = z
|
|
3764
|
+
.object({
|
|
3765
|
+
/** User-facing label for the endpoint */
|
|
3766
|
+
name: NonEmptyStringSchema,
|
|
3767
|
+
/** Target workflow resourceId to invoke on inbound requests (can be set later) */
|
|
3768
|
+
resourceId: NonEmptyStringSchema.optional(),
|
|
3769
|
+
/** Optional description */
|
|
3770
|
+
description: z.string().optional()
|
|
3771
|
+
})
|
|
3772
|
+
.strict()
|
|
3773
|
+
|
|
3774
|
+
type CreateWebhookEndpointRequest = z.infer<typeof CreateWebhookEndpointRequestSchema>
|
|
3775
|
+
|
|
3776
|
+
/**
|
|
3777
|
+
* PATCH /api/webhook-endpoints/:id - Update an existing webhook endpoint
|
|
3778
|
+
*
|
|
3779
|
+
* At least one field must be provided.
|
|
3780
|
+
*/
|
|
3781
|
+
declare const UpdateWebhookEndpointRequestSchema = z
|
|
3782
|
+
.object({
|
|
3783
|
+
name: NonEmptyStringSchema.optional(),
|
|
3784
|
+
description: z.string().optional(),
|
|
3785
|
+
resourceId: NonEmptyStringSchema.optional(),
|
|
3786
|
+
status: WebhookEndpointStatusSchema.optional()
|
|
3787
|
+
})
|
|
3788
|
+
.strict()
|
|
3789
|
+
.refine(
|
|
3790
|
+
(data) =>
|
|
3791
|
+
data.name !== undefined ||
|
|
3792
|
+
data.description !== undefined ||
|
|
3793
|
+
data.resourceId !== undefined ||
|
|
3794
|
+
data.status !== undefined,
|
|
3795
|
+
{ message: 'At least one field (name, description, resourceId, or status) must be provided' }
|
|
3796
|
+
)
|
|
3797
|
+
|
|
3798
|
+
type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestSchema>
|
|
3799
|
+
|
|
3800
|
+
export type { AIResourceDefinition, APIExecutionDetail, APIExecutionListResponse, Activity, ActivityType, ChatMessage, CheckpointListResponse, CostByModelResponse, CostSummaryResponse, CostTrendsResponse, CreateWebhookEndpointRequest, DashboardMetrics, ErrorAnalysisMetrics, ErrorDetailFull, ErrorDetailResponse, ErrorTrend, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogMessage, ExecutionStatus$1 as ExecutionStatus, ExecutionSummary, MembershipFeatureConfig, MembershipWithDetails, MessageEvent, NotificationDTO, OrgFeatureConfig, PatchTaskParams, ResourceDefinition, ResourceStatus, ResourceType, SessionDTO, SessionTokenUsage, SupabaseUserProfile, Task, TaskSchedule, TaskScheduleConfig, TaskStatus, TimeRange, UpdateWebhookEndpointRequest, UserConfig, WebhookEndpoint };
|