@elevasis/ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/api/index.d.ts +87 -0
  2. package/dist/api/index.js +3 -0
  3. package/dist/auth/context.d.ts +19 -0
  4. package/dist/auth/context.js +1 -0
  5. package/dist/auth/index.d.ts +85 -0
  6. package/dist/auth/index.js +3 -0
  7. package/dist/chunk-3KMDHCAR.js +52 -0
  8. package/dist/chunk-5UWFGBFM.js +129 -0
  9. package/dist/chunk-6BJOYF6E.js +8 -0
  10. package/dist/chunk-6M6OLGQY.js +36 -0
  11. package/dist/chunk-7AI5ZYJ4.js +202 -0
  12. package/dist/chunk-7PLEQFHO.js +18 -0
  13. package/dist/chunk-GDV44UWF.js +138 -0
  14. package/dist/chunk-GEFB5YIR.js +338 -0
  15. package/dist/chunk-HBRMWW6V.js +43 -0
  16. package/dist/chunk-HUWJXLLF.js +681 -0
  17. package/dist/chunk-J3FALDQE.js +176 -0
  18. package/dist/chunk-JKERRYVS.js +109 -0
  19. package/dist/chunk-KA7LO7U5.js +28 -0
  20. package/dist/chunk-LHQTTUL2.js +27 -0
  21. package/dist/chunk-MAAS6CGR.js +1299 -0
  22. package/dist/chunk-NE36BUGQ.js +146 -0
  23. package/dist/chunk-NGXCFBCS.js +398 -0
  24. package/dist/chunk-OEYU5O27.js +235 -0
  25. package/dist/chunk-OUHGHTE7.js +748 -0
  26. package/dist/chunk-OXVOHOP3.js +661 -0
  27. package/dist/chunk-PSLKGOBZ.js +58 -0
  28. package/dist/chunk-PYL4XW6H.js +107 -0
  29. package/dist/chunk-Q47SPRY7.js +1 -0
  30. package/dist/chunk-Q7DJKLEN.js +18 -0
  31. package/dist/chunk-RJCA5672.js +1664 -0
  32. package/dist/chunk-S66I2PYB.js +748 -0
  33. package/dist/chunk-W7ZBF5AA.js +1 -0
  34. package/dist/chunk-WNWKOCGJ.js +1067 -0
  35. package/dist/chunk-XCYKC6OZ.js +1 -0
  36. package/dist/chunk-YULUKCS6.js +56 -0
  37. package/dist/chunk-YZ6GTZXL.js +48 -0
  38. package/dist/chunk-ZGHDPDTF.js +379 -0
  39. package/dist/components/command-queue/index.css +53 -0
  40. package/dist/components/command-queue/index.d.ts +204 -0
  41. package/dist/components/command-queue/index.js +10 -0
  42. package/dist/components/forms/index.d.ts +56 -0
  43. package/dist/components/forms/index.js +2 -0
  44. package/dist/components/index.css +443 -0
  45. package/dist/components/index.d.ts +1354 -0
  46. package/dist/components/index.js +18 -0
  47. package/dist/components/monitoring/index.d.ts +66 -0
  48. package/dist/components/monitoring/index.js +2 -0
  49. package/dist/components/navigation/index.d.ts +54 -0
  50. package/dist/components/navigation/index.js +91 -0
  51. package/dist/components/notifications/index.d.ts +52 -0
  52. package/dist/components/notifications/index.js +4 -0
  53. package/dist/components/resource-definition/index.css +388 -0
  54. package/dist/components/resource-definition/index.d.ts +301 -0
  55. package/dist/components/resource-definition/index.js +3 -0
  56. package/dist/display/index.css +53 -0
  57. package/dist/display/index.d.ts +606 -0
  58. package/dist/display/index.js +6 -0
  59. package/dist/execution/index.css +388 -0
  60. package/dist/execution/index.d.ts +1090 -0
  61. package/dist/execution/index.js +4 -0
  62. package/dist/graph/index.css +388 -0
  63. package/dist/graph/index.d.ts +429 -0
  64. package/dist/graph/index.js +1 -0
  65. package/dist/hooks/index.d.ts +1927 -0
  66. package/dist/hooks/index.js +6 -0
  67. package/dist/hooks/published.d.ts +1653 -0
  68. package/dist/hooks/published.js +4 -0
  69. package/dist/index.css +505 -0
  70. package/dist/index.d.ts +7284 -0
  71. package/dist/index.js +31 -0
  72. package/dist/initialization/index.d.ts +2325 -0
  73. package/dist/initialization/index.js +4 -0
  74. package/dist/organization/index.d.ts +225 -0
  75. package/dist/organization/index.js +4 -0
  76. package/dist/profile/index.d.ts +2265 -0
  77. package/dist/profile/index.js +3 -0
  78. package/dist/provider/index.css +61 -0
  79. package/dist/provider/index.d.ts +291 -0
  80. package/dist/provider/index.js +7 -0
  81. package/dist/provider/published.d.ts +198 -0
  82. package/dist/provider/published.js +6 -0
  83. package/dist/router/context.d.ts +19 -0
  84. package/dist/router/context.js +1 -0
  85. package/dist/router/index.d.ts +31 -0
  86. package/dist/router/index.js +2 -0
  87. package/dist/sse/index.d.ts +83 -0
  88. package/dist/sse/index.js +185 -0
  89. package/dist/supabase/index.d.ts +4289 -0
  90. package/dist/supabase/index.js +47 -0
  91. package/dist/typeform/index.d.ts +458 -0
  92. package/dist/typeform/index.js +1976 -0
  93. package/dist/typeform/schemas.d.ts +67 -0
  94. package/dist/typeform/schemas.js +1 -0
  95. package/dist/utils/index.d.ts +177 -0
  96. package/dist/utils/index.js +1 -0
  97. package/package.json +88 -0
@@ -0,0 +1,1653 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * Query key factory for executions TanStack Query hooks.
6
+ * Uses organization UUID (not name) for cache isolation.
7
+ */
8
+ declare const executionsKeys: {
9
+ all: readonly ["executions"];
10
+ resources: (orgId: string | null) => readonly ["executions", "resources", string | null];
11
+ resourceDefinition: (orgId: string | null, resourceId: string) => readonly ["executions", "definition", string | null, string];
12
+ executions: (orgId: string | null, resourceId: string) => readonly ["executions", "list", string | null, string];
13
+ execution: (orgId: string | null, resourceId: string, executionId: string) => readonly ["executions", "execution", string | null, string, string];
14
+ };
15
+
16
+ /**
17
+ * Workflow-specific logging types and utilities
18
+ */
19
+
20
+
21
+
22
+ // Workflow start/end log context
23
+ interface WorkflowExecutionContext {
24
+ type: 'workflow'
25
+ contextType: 'workflow-execution'
26
+ executionId: string
27
+ workflowId: string
28
+ workflowName?: string
29
+ organizationId: string
30
+ executionPath?: string[]
31
+ }
32
+
33
+ // Workflow failure log context
34
+ interface WorkflowFailureContext {
35
+ type: 'workflow'
36
+ contextType: 'workflow-failure'
37
+ executionId: string
38
+ workflowId: string
39
+ error: string
40
+ }
41
+
42
+ // Step started log context
43
+ interface StepStartedContext {
44
+ type: 'workflow'
45
+ contextType: 'step-started'
46
+ stepId: string
47
+ stepStatus: 'started'
48
+ input: unknown
49
+ startTime: number // Explicit start timestamp for timeline
50
+ }
51
+
52
+ // Step completed log context
53
+ interface StepCompletedContext {
54
+ type: 'workflow'
55
+ contextType: 'step-completed'
56
+ stepId: string
57
+ stepStatus: 'completed'
58
+ output: unknown
59
+ duration: number
60
+ isTerminal: boolean
61
+ startTime: number // Explicit start timestamp for timeline
62
+ endTime: number // Explicit end timestamp for timeline
63
+ }
64
+
65
+ // Step failed log context
66
+ interface StepFailedContext {
67
+ type: 'workflow'
68
+ contextType: 'step-failed'
69
+ stepId: string
70
+ stepStatus: 'failed'
71
+ error: string
72
+ duration: number
73
+ startTime: number // Explicit start timestamp for timeline
74
+ endTime: number // Explicit end timestamp for timeline
75
+ }
76
+
77
+ // Conditional routing log context
78
+ interface ConditionalRouteContext {
79
+ type: 'workflow'
80
+ contextType: 'conditional-route'
81
+ stepId: string
82
+ target: string
83
+ error?: string
84
+ }
85
+
86
+ // Execution path log context
87
+ interface ExecutionPathContext {
88
+ type: 'workflow'
89
+ contextType: 'execution-path'
90
+ executionPath: string[]
91
+ }
92
+
93
+ // Union of all workflow log contexts
94
+ type WorkflowLogContext =
95
+ | WorkflowExecutionContext
96
+ | WorkflowFailureContext
97
+ | StepStartedContext
98
+ | StepCompletedContext
99
+ | StepFailedContext
100
+ | ConditionalRouteContext
101
+ | ExecutionPathContext
102
+
103
+ /**
104
+ * Agent-specific logging types
105
+ * Simplified 2-event model: lifecycle, iteration
106
+ *
107
+ * Design Philosophy:
108
+ * - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
109
+ * - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
110
+ */
111
+
112
+
113
+
114
+ // ============================================================================
115
+ // FORMAL TYPES
116
+ // ============================================================================
117
+
118
+ /**
119
+ * Agent lifecycle stages
120
+ * Universal checkpoints that apply to all agent executions
121
+ */
122
+ type AgentLifecycle = 'initialization' | 'iteration' | 'completion'
123
+
124
+ /**
125
+ * Iteration event types
126
+ * Activities that occur during agent iterations
127
+ */
128
+ type IterationEventType = 'reasoning' | 'action' | 'tool-call'
129
+
130
+ // ============================================================================
131
+ // LIFECYCLE EVENTS (Structural Checkpoints)
132
+ // ============================================================================
133
+
134
+ /**
135
+ * Base fields shared by all lifecycle events
136
+ */
137
+ interface AgentLifecycleEventBase {
138
+ type: 'agent'
139
+ agentId: string
140
+ lifecycle: AgentLifecycle
141
+ sessionId?: string // Optional: only present when agent runs in session context
142
+ }
143
+
144
+ /**
145
+ * Lifecycle started event - emitted when a phase begins
146
+ * REQUIRED: startTime (phase has started, no end yet)
147
+ */
148
+ interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
149
+ stage: 'started'
150
+ startTime: number // REQUIRED: Phase start timestamp
151
+ iteration?: number // Only for 'iteration' lifecycle
152
+ }
153
+
154
+ /**
155
+ * Lifecycle completed event - emitted when a phase succeeds
156
+ * REQUIRED: startTime, endTime, duration (phase has finished successfully)
157
+ */
158
+ interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
159
+ stage: 'completed'
160
+ startTime: number // REQUIRED: Phase start timestamp
161
+ endTime: number // REQUIRED: Phase end timestamp
162
+ duration: number // REQUIRED: Calculated duration (endTime - startTime)
163
+ iteration?: number // Only for 'iteration' lifecycle
164
+
165
+ // Optional fields specific to certain lifecycles
166
+ attempts?: number // Only for 'completion' lifecycle (tracks output generation attempts: 1 or 2)
167
+ memorySize?: {
168
+ sessionMemoryKeys: number
169
+ historyEntries: number
170
+ } // Only for 'completion' lifecycle (memory snapshot metadata)
171
+ }
172
+
173
+ /**
174
+ * Lifecycle failed event - emitted when a phase fails
175
+ * REQUIRED: startTime, endTime, duration, error (phase has finished with error)
176
+ */
177
+ interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
178
+ stage: 'failed'
179
+ startTime: number // REQUIRED: Phase start timestamp
180
+ endTime: number // REQUIRED: Phase end timestamp
181
+ duration: number // REQUIRED: Calculated duration (endTime - startTime)
182
+ error: string // REQUIRED: Error message
183
+ iteration?: number // Only for 'iteration' lifecycle
184
+ }
185
+
186
+ /**
187
+ * Union type for all lifecycle events
188
+ * Discriminated by 'stage' field for type narrowing
189
+ */
190
+ type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent
191
+
192
+ // ============================================================================
193
+ // ITERATION EVENTS (Execution Activities)
194
+ // ============================================================================
195
+
196
+ /**
197
+ * Placeholder data for MVP
198
+ * Will be typed per actionType in future
199
+ */
200
+ interface ActionPlaceholderData {
201
+ message: string
202
+ }
203
+
204
+ /**
205
+ * Iteration event - captures activities during agent iterations
206
+ * Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
207
+ */
208
+ interface AgentIterationEvent {
209
+ type: 'agent'
210
+ agentId: string
211
+ lifecycle: 'iteration' // Always iteration
212
+ eventType: IterationEventType
213
+ iteration: number
214
+ sessionId?: string // Optional: only present when agent runs in session context
215
+
216
+ // Timeline timing fields (v2 - Clean Break)
217
+ startTime: number // Activity start timestamp
218
+ endTime: number // Activity end timestamp
219
+ duration: number // Calculated duration (endTime - startTime)
220
+
221
+ // Conditional fields based on eventType
222
+ output?: string // For reasoning events
223
+ actionType?: string // For action events (tool-use, delegate, memory-write, etc.)
224
+ data?: ActionPlaceholderData // For action events
225
+ }
226
+
227
+ /**
228
+ * Tool call event - captures individual tool executions during iterations
229
+ * Provides granular timing for each tool invocation
230
+ */
231
+ interface AgentToolCallEvent {
232
+ type: 'agent'
233
+ agentId: string
234
+ lifecycle: 'iteration' // Always iteration
235
+ eventType: 'tool-call' // Specific event type for tool calls
236
+ iteration: number
237
+ sessionId?: string // Optional: only present when agent runs in session context
238
+
239
+ // Tool identification and timing
240
+ toolName: string // Tool identifier
241
+ startTime: number // Tool call start timestamp
242
+ endTime: number // Tool call end timestamp
243
+ duration: number // Calculated duration
244
+
245
+ // Execution results
246
+ success: boolean // Whether tool execution succeeded
247
+ error?: string // Error message if failed
248
+ input?: Record<string, unknown> // Tool input parameters
249
+ output?: unknown // Tool output result
250
+ }
251
+
252
+ // ============================================================================
253
+ // UNION TYPES
254
+ // ============================================================================
255
+
256
+ /**
257
+ * Union type for all agent log contexts
258
+ * 3 event types total (lifecycle, iteration, tool-call)
259
+ */
260
+ type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent
261
+
262
+ /**
263
+ * Base execution logger for Execution Engine
264
+ */
265
+ type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error'
266
+
267
+
268
+ // Union type for all contexts
269
+ type LogContext = WorkflowLogContext | AgentLogContext
270
+
271
+ // Updated interface with consolidated context
272
+ interface ExecutionLogMessage {
273
+ level: ExecutionLogLevel
274
+ message: string
275
+ timestamp: number
276
+ context?: LogContext
277
+ }
278
+
279
+ /**
280
+ * Resource Registry type definitions
281
+ */
282
+
283
+
284
+
285
+ // ============================================================================
286
+ // Core Resource Type Definitions
287
+ // ============================================================================
288
+
289
+ /**
290
+ * Environment/deployment status for resources
291
+ */
292
+ type ResourceStatus$1 = 'dev' | 'prod'
293
+
294
+ /**
295
+ * All resource types in the platform
296
+ * Used as the discriminator field in ResourceDefinition
297
+ */
298
+ type ResourceType$1 = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
299
+
300
+ // Execution status type shared between API and UI
301
+ type ExecutionStatus$1 = 'pending' | 'running' | 'completed' | 'failed' | 'warning'
302
+
303
+ // API execution types
304
+ interface APIExecutionSummary {
305
+ id: string
306
+ status: ExecutionStatus$1
307
+ startTime: number
308
+ endTime?: number
309
+ resourceStatus?: ResourceStatus$1 // 'dev' | 'prod' - optional for backward compatibility
310
+ }
311
+
312
+ interface APIExecutionDetail extends APIExecutionSummary {
313
+ executionLogs: ExecutionLogMessage[]
314
+ input?: unknown
315
+ result?: unknown
316
+ error?: string
317
+ resourceStatus: ResourceStatus$1 // Required in detail view
318
+ apiVersion?: string | null
319
+ resourceVersion?: string | null
320
+ sdkVersion?: string | null
321
+ }
322
+
323
+ // API request/response types
324
+ interface APIExecutionListResponse {
325
+ executions: APIExecutionSummary[]
326
+ }
327
+
328
+ /**
329
+ * Fetch the execution list for a given resource.
330
+ *
331
+ * resourceStatus and limit are intentionally excluded from the query key so that
332
+ * SSE invalidations (which target the unfiltered key) bust all filter variants.
333
+ *
334
+ * @example
335
+ * const { data, isLoading } = useExecutions(resourceId)
336
+ *
337
+ * @example
338
+ * // With status filter and limit
339
+ * const { data } = useExecutions(resourceId, 'running', 20)
340
+ */
341
+ declare function useExecutions(resourceId: string, resourceStatus?: ResourceStatus$1 | 'all', limit?: number): _tanstack_react_query.UseQueryResult<APIExecutionListResponse, Error>;
342
+
343
+ /**
344
+ * Fetch a single execution detail.
345
+ * Automatically polls every 2 seconds while the execution status is 'running'.
346
+ *
347
+ * @example
348
+ * const { data: execution, isLoading } = useExecution(resourceId, executionId)
349
+ */
350
+ declare function useExecution(resourceId: string, executionId: string): _tanstack_react_query.UseQueryResult<APIExecutionDetail, Error>;
351
+
352
+ interface ExecuteAsyncParams {
353
+ resourceId: string;
354
+ resourceType: ResourceType$1;
355
+ input: unknown;
356
+ }
357
+ interface ExecuteAsyncResult {
358
+ executionId: string;
359
+ status: string;
360
+ resourceId: string;
361
+ }
362
+ /**
363
+ * Trigger an async execution for a workflow or agent.
364
+ * Invalidates the executions list on success so the new execution appears immediately.
365
+ *
366
+ * @example
367
+ * const { mutate: execute, isPending } = useExecuteAsync()
368
+ * execute({ resourceId, resourceType: 'workflow', input: { ... } })
369
+ */
370
+ declare function useExecuteAsync(): _tanstack_react_query.UseMutationResult<ExecuteAsyncResult, Error, ExecuteAsyncParams, unknown>;
371
+
372
+ interface RetryExecutionParams {
373
+ resourceId: string;
374
+ resourceType: ResourceType$1;
375
+ input: unknown;
376
+ }
377
+ /**
378
+ * Retry a failed execution by re-triggering it async.
379
+ * Functionally identical to useExecuteAsync but named for intent clarity at call sites.
380
+ */
381
+ declare function useRetryExecution(): _tanstack_react_query.UseMutationResult<{
382
+ resourceId: string;
383
+ executionId: string;
384
+ status: string;
385
+ }, Error, RetryExecutionParams, unknown>;
386
+
387
+ interface CancelExecutionParams {
388
+ resourceId: string;
389
+ executionId: string;
390
+ }
391
+ interface CancelExecutionResult {
392
+ cancelled: boolean;
393
+ method: string;
394
+ resourceId: string;
395
+ executionId: string;
396
+ }
397
+ /**
398
+ * Cancel a running execution.
399
+ * Invalidates both the execution detail and the executions list on success.
400
+ *
401
+ * @example
402
+ * const { mutate: cancel, isPending } = useCancelExecution()
403
+ * cancel({ resourceId, executionId })
404
+ */
405
+ declare function useCancelExecution(): _tanstack_react_query.UseMutationResult<CancelExecutionResult, Error, CancelExecutionParams, unknown>;
406
+
407
+ interface DeleteExecutionParams {
408
+ resourceId: string;
409
+ executionId: string;
410
+ }
411
+ /**
412
+ * Delete a single execution record.
413
+ * Removes the execution from cache immediately and invalidates the list.
414
+ */
415
+ declare function useDeleteExecution(): _tanstack_react_query.UseMutationResult<{
416
+ resourceId: string;
417
+ executionId: string;
418
+ }, Error, DeleteExecutionParams, unknown>;
419
+
420
+ interface BulkDeleteExecutionsParams {
421
+ resourceId: string;
422
+ resourceStatus?: ResourceStatus$1 | 'all';
423
+ }
424
+ interface BulkDeleteExecutionsResult {
425
+ resourceId: string;
426
+ deletedCount: number;
427
+ resourceStatus?: ResourceStatus$1 | 'all';
428
+ }
429
+ /**
430
+ * Bulk delete executions for a resource, optionally filtered by status.
431
+ */
432
+ declare function useBulkDeleteExecutions(): _tanstack_react_query.UseMutationResult<BulkDeleteExecutionsResult, Error, BulkDeleteExecutionsParams, unknown>;
433
+
434
+ /**
435
+ * Error categories for observability grouping and classification.
436
+ * Used to categorize errors in the execution_errors table metadata.
437
+ */
438
+ type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
439
+
440
+ /**
441
+ * Shared form field types for dynamic form generation
442
+ * Used by: Command Queue, Execution Runner UI, future form-based features
443
+ */
444
+ /**
445
+ * Supported form field types for action payloads
446
+ * Maps to Mantine form components
447
+ */
448
+ type FormFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'radio' | 'richtext';
449
+
450
+ /**
451
+ * Serialized Registry Types
452
+ *
453
+ * Pre-computed JSON-safe types for API responses and Command View.
454
+ * Serialization happens once at API startup, enabling instant response times.
455
+ */
456
+
457
+ /**
458
+ * Serialized form field for API responses
459
+ */
460
+ interface SerializedFormField {
461
+ name: string;
462
+ label: string;
463
+ type: FormFieldType;
464
+ defaultValue?: unknown;
465
+ required?: boolean;
466
+ placeholder?: string;
467
+ description?: string;
468
+ options?: Array<{
469
+ label: string;
470
+ value: string | number;
471
+ }>;
472
+ min?: number;
473
+ max?: number;
474
+ }
475
+ /**
476
+ * Serialized form schema for API responses
477
+ */
478
+ interface SerializedFormSchema {
479
+ title?: string;
480
+ description?: string;
481
+ fields: SerializedFormField[];
482
+ layout?: 'vertical' | 'horizontal' | 'grid';
483
+ }
484
+ /**
485
+ * Serialized execution form schema for API responses
486
+ */
487
+ interface SerializedExecutionFormSchema extends SerializedFormSchema {
488
+ fieldMappings?: Record<string, string>;
489
+ submitButton?: {
490
+ label?: string;
491
+ loadingLabel?: string;
492
+ confirmMessage?: string;
493
+ };
494
+ }
495
+ /**
496
+ * Serialized schedule config for API responses
497
+ */
498
+ interface SerializedScheduleConfig {
499
+ enabled: boolean;
500
+ defaultSchedule?: string;
501
+ allowedPatterns?: string[];
502
+ }
503
+ /**
504
+ * Serialized webhook config for API responses
505
+ */
506
+ interface SerializedWebhookConfig {
507
+ enabled: boolean;
508
+ payloadSchema?: unknown;
509
+ }
510
+ /**
511
+ * Serialized execution interface for API responses
512
+ */
513
+ interface SerializedExecutionInterface {
514
+ form: SerializedExecutionFormSchema;
515
+ schedule?: SerializedScheduleConfig;
516
+ webhook?: SerializedWebhookConfig;
517
+ }
518
+ /**
519
+ * Serialized agent definition (JSON-safe)
520
+ * Result of serializeDefinition(AgentDefinition)
521
+ */
522
+ interface SerializedAgentDefinition {
523
+ config: {
524
+ resourceId: string;
525
+ name: string;
526
+ description: string;
527
+ version: string;
528
+ type: 'agent';
529
+ status: 'dev' | 'prod';
530
+ /** Whether this resource is archived and should be excluded from registration and deployment */
531
+ archived?: boolean;
532
+ systemPrompt: string;
533
+ constraints?: {
534
+ maxIterations?: number;
535
+ timeout?: number;
536
+ maxSessionMemoryKeys?: number;
537
+ maxMemoryTokens?: number;
538
+ };
539
+ sessionCapable?: boolean;
540
+ memoryPreferences?: string;
541
+ };
542
+ modelConfig: {
543
+ provider: string;
544
+ model: string;
545
+ apiKey: string;
546
+ temperature: number;
547
+ maxOutputTokens: number;
548
+ topP?: number;
549
+ modelOptions?: Record<string, unknown>;
550
+ };
551
+ contract: {
552
+ inputSchema: object;
553
+ outputSchema?: object;
554
+ };
555
+ tools: Array<{
556
+ name: string;
557
+ description: string;
558
+ inputSchema?: object;
559
+ outputSchema?: object;
560
+ }>;
561
+ knowledgeMap?: {
562
+ nodeCount: number;
563
+ nodes: Array<{
564
+ id: string;
565
+ description: string;
566
+ loaded: boolean;
567
+ hasPrompt: boolean;
568
+ }>;
569
+ };
570
+ metricsConfig?: object;
571
+ interface?: SerializedExecutionInterface;
572
+ }
573
+ /**
574
+ * Serialized workflow definition (JSON-safe)
575
+ * Result of serializeDefinition(WorkflowDefinition)
576
+ */
577
+ interface SerializedWorkflowDefinition {
578
+ config: {
579
+ resourceId: string;
580
+ name: string;
581
+ description: string;
582
+ version: string;
583
+ type: 'workflow';
584
+ status: 'dev' | 'prod';
585
+ /** Whether this resource is archived and should be excluded from registration and deployment */
586
+ archived?: boolean;
587
+ };
588
+ entryPoint: string;
589
+ steps: Array<{
590
+ id: string;
591
+ name: string;
592
+ description: string;
593
+ inputSchema?: object;
594
+ outputSchema?: object;
595
+ next: {
596
+ type: 'linear' | 'conditional';
597
+ target?: string;
598
+ routes?: Array<{
599
+ target: string;
600
+ }>;
601
+ default?: string;
602
+ } | null;
603
+ }>;
604
+ contract: {
605
+ inputSchema: object;
606
+ outputSchema?: object;
607
+ };
608
+ metricsConfig?: object;
609
+ interface?: SerializedExecutionInterface;
610
+ }
611
+
612
+ /**
613
+ * Memory type definitions
614
+ * Types for agent memory management with semantic entry types
615
+ */
616
+ /**
617
+ * Semantic memory entry types
618
+ * Use-case agnostic types that describe the purpose of each entry
619
+ * Memory types mirror action types for clarity and filtering
620
+ */
621
+ type MemoryEntryType = 'context' | 'input' | 'reasoning' | 'tool-result' | 'delegation-result' | 'error';
622
+ /**
623
+ * Memory entry - represents a single entry in agent memory
624
+ * Stored in agent memory, translated by adapters to vendor-specific formats
625
+ */
626
+ interface MemoryEntry {
627
+ type: MemoryEntryType;
628
+ content: string;
629
+ timestamp: number;
630
+ turnNumber: number | null;
631
+ iterationNumber: number | null;
632
+ }
633
+ /**
634
+ * Agent memory - Self-orchestrated memory with session + working storage
635
+ * Agent has full control over what persists, framework handles auto-compaction
636
+ */
637
+ interface AgentMemory {
638
+ /**
639
+ * Session memory - Persists for session/conversation duration
640
+ * Never auto-trimmed by framework
641
+ * Agent-managed key-value store for critical information
642
+ * Agent provides strings, framework wraps in MemoryEntry
643
+ */
644
+ sessionMemory: Record<string, MemoryEntry>;
645
+ /**
646
+ * Working memory - Execution history
647
+ * Automatically compacted by framework when needed
648
+ * Agent doesn't control compaction
649
+ */
650
+ history: MemoryEntry[];
651
+ }
652
+
653
+ /**
654
+ * Origin resource type - where an execution/task originated from.
655
+ * Used for audit trails and tracking execution lineage.
656
+ */
657
+ type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
658
+
659
+ /**
660
+ * Target for schedule execution - identifies what resource to execute.
661
+ * Unlike ExecutionTarget, payload is NOT included here because schedules
662
+ * store payload in the scheduleConfig (varies per step/item).
663
+ */
664
+ interface ScheduleTarget {
665
+ resourceType: 'agent' | 'workflow';
666
+ resourceId: string;
667
+ }
668
+ /**
669
+ * Optional origin tracking for schedules.
670
+ * Unlike OriginTracking (which is required), these fields are all optional
671
+ * for schedules created directly via API (not triggered by another resource).
672
+ */
673
+ interface ScheduleOriginTracking {
674
+ originExecutionId?: string;
675
+ originResourceType?: OriginResourceType;
676
+ originResourceId?: string;
677
+ }
678
+ type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
679
+ interface RecurringScheduleConfig {
680
+ type: 'recurring';
681
+ cron?: string;
682
+ interval?: 'daily' | 'weekly' | 'monthly';
683
+ time?: string;
684
+ timezone: string;
685
+ payload: Record<string, unknown>;
686
+ endAt?: string | null;
687
+ overduePolicy?: 'skip' | 'execute';
688
+ }
689
+ interface RelativeScheduleConfig {
690
+ type: 'relative';
691
+ anchorAt: string;
692
+ anchorLabel?: string;
693
+ items: RelativeScheduleItem[];
694
+ overduePolicy?: 'skip' | 'execute';
695
+ }
696
+ interface RelativeScheduleItem {
697
+ offset: string;
698
+ payload: Record<string, unknown>;
699
+ label?: string;
700
+ }
701
+ interface AbsoluteScheduleConfig {
702
+ type: 'absolute';
703
+ items: AbsoluteScheduleItem[];
704
+ overduePolicy?: 'skip' | 'execute';
705
+ }
706
+ interface AbsoluteScheduleItem {
707
+ runAt: string;
708
+ payload: Record<string, unknown>;
709
+ label?: string;
710
+ }
711
+ interface TaskSchedule extends ScheduleOriginTracking {
712
+ id: string;
713
+ organizationId: string;
714
+ name: string;
715
+ description?: string;
716
+ target: ScheduleTarget;
717
+ scheduleConfig: TaskScheduleConfig;
718
+ nextRunAt?: Date;
719
+ currentStep: number;
720
+ status: 'active' | 'paused' | 'completed' | 'cancelled';
721
+ lastRunAt?: Date;
722
+ lastExecutionId?: string;
723
+ maxRetries: number;
724
+ idempotencyKey?: string;
725
+ createdAt: Date;
726
+ updatedAt: Date;
727
+ }
728
+
729
+ /**
730
+ * Wire-format DTO for notification API responses.
731
+ * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
732
+ * Used by frontend hooks that consume /api/notifications.
733
+ */
734
+ interface NotificationDTO {
735
+ id: string;
736
+ userId: string;
737
+ organizationId: string;
738
+ category: string;
739
+ title: string;
740
+ message: string;
741
+ actionUrl: string | null;
742
+ read: boolean;
743
+ readAt: string | null;
744
+ createdAt: string;
745
+ }
746
+
747
+ /**
748
+ * Session Data Transfer Object (DTO)
749
+ * Transform type for API responses (snake_case DB → camelCase frontend)
750
+ * Used by frontend apps to display session data
751
+ */
752
+ interface SessionDTO {
753
+ sessionId: string;
754
+ resourceId: string;
755
+ organizationId: string;
756
+ userId?: string | null;
757
+ turnCount: number;
758
+ isEnded: boolean;
759
+ title?: string | null;
760
+ memorySnapshot?: AgentMemory;
761
+ metadata?: Record<string, unknown> | null;
762
+ createdAt: Date;
763
+ updatedAt: Date;
764
+ endedAt?: Date | null;
765
+ }
766
+
767
+ /**
768
+ * Time range selector for dashboard metrics
769
+ */
770
+ type TimeRange = '1h' | '24h' | '7d' | '30d';
771
+ /**
772
+ * Execution health metrics response
773
+ * Success rate, P95 duration, execution counts, and trend data
774
+ * trendData includes executionCount for throughput visualization (eliminates separate API call)
775
+ */
776
+ interface ExecutionHealthMetrics {
777
+ successRate: number;
778
+ p95Duration: number;
779
+ totalExecutions: number;
780
+ trendData: Array<{
781
+ time: string;
782
+ rate: number;
783
+ successCount: number;
784
+ errorCount: number;
785
+ warningCount: number;
786
+ executionCount: number;
787
+ }>;
788
+ statusCounts: {
789
+ success: number;
790
+ failed: number;
791
+ pending: number;
792
+ warning: number;
793
+ };
794
+ peakPeriod: string;
795
+ granularity: 'hour' | 'day';
796
+ }
797
+ /**
798
+ * Error analysis metrics response
799
+ * Error categories and top failing resources
800
+ */
801
+ interface ErrorAnalysisMetrics {
802
+ totalErrors: number;
803
+ errorsByCategory: Array<{
804
+ category: string;
805
+ count: number;
806
+ percentage: number;
807
+ }>;
808
+ topFailingResources: Array<{
809
+ resourceId: string;
810
+ name: string;
811
+ errorCount: number;
812
+ failureRate: number;
813
+ }>;
814
+ }
815
+ /**
816
+ * Business impact metrics response
817
+ * ROI, labor savings, and cost analysis
818
+ */
819
+ interface BusinessImpactMetrics$1 {
820
+ totalSavingsUsd: number;
821
+ totalCostUsd: number;
822
+ netSavingsUsd: number;
823
+ roi: number;
824
+ }
825
+ /**
826
+ * Cost breakdown metrics response
827
+ * Per-resource cost analysis
828
+ */
829
+ interface CostBreakdownMetrics {
830
+ resources: Array<{
831
+ resourceId: string;
832
+ totalCostUsd: number;
833
+ executionCount: number;
834
+ avgCostUsd: number;
835
+ }>;
836
+ }
837
+ /**
838
+ * Dashboard metrics response
839
+ * Aggregates core observability metrics in a single response
840
+ * Note: Throughput data is now included in executionHealth.trendData.executionCount
841
+ */
842
+ interface DashboardMetrics {
843
+ executionHealth: ExecutionHealthMetrics;
844
+ costBreakdown: CostBreakdownMetrics;
845
+ businessImpact: BusinessImpactMetrics$1;
846
+ /** ISO timestamp of the currently active deployment, or null if none */
847
+ activeDeploymentDate: string | null;
848
+ /** Deployment version of the active deployment, or null if none */
849
+ activeDeploymentVersion: string | null;
850
+ }
851
+ /**
852
+ * Error record for list view (ErrorBreakdownTable)
853
+ */
854
+ interface ErrorRecord {
855
+ id: string;
856
+ timestamp: string;
857
+ errorType: string;
858
+ message: string;
859
+ executionId: string;
860
+ resourceId: string;
861
+ resourceName: string;
862
+ severity: 'critical' | 'warning' | 'info';
863
+ category: ExecutionErrorCategory;
864
+ resolved: boolean;
865
+ resolvedAt: string | null;
866
+ resolvedBy: string | null;
867
+ }
868
+ /**
869
+ * Full error detail for modal view (ErrorDetailsModal)
870
+ */
871
+ interface ErrorDetailFull extends ErrorRecord {
872
+ stackTrace?: string;
873
+ retryAttempt?: number;
874
+ stepName?: string;
875
+ stepSequence?: number;
876
+ errorContext?: Record<string, unknown>;
877
+ executionContext?: Record<string, unknown>;
878
+ }
879
+ /**
880
+ * Error details API response (paginated)
881
+ */
882
+ interface ErrorDetailResponse {
883
+ errors: ErrorRecord[];
884
+ total: number;
885
+ page: number;
886
+ limit: number;
887
+ }
888
+ /**
889
+ * Error trend data for time-series charts
890
+ */
891
+ interface ErrorTrend {
892
+ time: string;
893
+ errorCount: number;
894
+ criticalCount: number;
895
+ warningCount: number;
896
+ infoCount: number;
897
+ }
898
+ /**
899
+ * Cost trend data point for time-series charts
900
+ * Represents a single time bucket (hour or day)
901
+ */
902
+ interface CostTrendDataPoint {
903
+ time: string;
904
+ totalCostUsd: number;
905
+ executionCount: number;
906
+ avgCostPerExecution: number;
907
+ }
908
+ /**
909
+ * Cost trends response (time-series data)
910
+ */
911
+ interface CostTrendsResponse {
912
+ trendData: CostTrendDataPoint[];
913
+ granularity: 'hour' | 'day';
914
+ totalCostUsd: number;
915
+ totalExecutions: number;
916
+ }
917
+ /**
918
+ * Cost summary response with MTD and projections
919
+ */
920
+ interface CostSummaryResponse {
921
+ current: {
922
+ totalCostUsd: number;
923
+ executionCount: number;
924
+ };
925
+ previous: {
926
+ totalCostUsd: number;
927
+ executionCount: number;
928
+ };
929
+ mtd: {
930
+ totalCostUsd: number;
931
+ daysElapsed: number;
932
+ };
933
+ projection: {
934
+ monthlyCostUsd: number;
935
+ confidence: 'low' | 'medium' | 'high';
936
+ };
937
+ trend: {
938
+ changePercent: number;
939
+ direction: 'up' | 'down' | 'flat';
940
+ };
941
+ }
942
+ /**
943
+ * Cost by model data for model-level breakdown
944
+ */
945
+ interface CostByModelData {
946
+ model: string;
947
+ totalCostUsd: number;
948
+ callCount: number;
949
+ totalInputTokens: number;
950
+ totalOutputTokens: number;
951
+ avgCostPerCall: number;
952
+ }
953
+ /**
954
+ * Cost by model response
955
+ */
956
+ interface CostByModelResponse {
957
+ models: CostByModelData[];
958
+ totalCostUsd: number;
959
+ totalCallCount: number;
960
+ }
961
+
962
+ /**
963
+ * Base Execution Engine type definitions
964
+ * Core types shared across all Execution Engine resources
965
+ */
966
+
967
+ /**
968
+ * NOTE: AIResource interface has been removed and replaced with ResourceDefinition
969
+ * from registry/types.ts. All resources (executable and non-executable) now extend
970
+ * the unified ResourceDefinition base interface.
971
+ *
972
+ * AgentConfig and WorkflowConfig now extend ResourceDefinition directly.
973
+ * See packages/core/src/registry/types.ts for the base interface definition.
974
+ */
975
+ type AIResourceDefinition = SerializedWorkflowDefinition | SerializedAgentDefinition;
976
+
977
+ /**
978
+ * Resource Registry type definitions
979
+ */
980
+
981
+ /**
982
+ * Environment/deployment status for resources
983
+ */
984
+ type ResourceStatus = 'dev' | 'prod';
985
+ /**
986
+ * All resource types in the platform
987
+ * Used as the discriminator field in ResourceDefinition
988
+ */
989
+ type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
990
+ /**
991
+ * Base interface for ALL platform resources
992
+ * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
993
+ */
994
+ interface ResourceDefinition {
995
+ /** Unique resource identifier */
996
+ resourceId: string;
997
+ /** Display name */
998
+ name: string;
999
+ /** Purpose and functionality description */
1000
+ description: string;
1001
+ /** Version for change tracking and evolution */
1002
+ version: string;
1003
+ /** Resource type discriminator */
1004
+ type: ResourceType;
1005
+ /** Environment/deployment status */
1006
+ status: ResourceStatus;
1007
+ /** Domain tags for filtering and organization */
1008
+ domains?: ResourceDomain[];
1009
+ /** Whether the agent supports multi-turn sessions (agents only) */
1010
+ sessionCapable?: boolean;
1011
+ /** Whether the resource is local (monorepo) or remote (externally deployed) */
1012
+ origin?: 'local' | 'remote';
1013
+ /** Whether this resource is archived and should be excluded from registration and deployment */
1014
+ archived?: boolean;
1015
+ }
1016
+
1017
+ /**
1018
+ * Standard Domain Definitions
1019
+ * Centralized domain constants and definitions for all organization resources.
1020
+ */
1021
+
1022
+ declare const DOMAINS: {
1023
+ readonly INBOUND_PIPELINE: "inbound-pipeline";
1024
+ readonly LEAD_GEN_PIPELINE: "lead-gen-pipeline";
1025
+ readonly SUPPORT: "support";
1026
+ readonly CLIENT_SUPPORT: "client-support";
1027
+ readonly DELIVERY: "delivery";
1028
+ readonly OPERATIONS: "operations";
1029
+ readonly FINANCE: "finance";
1030
+ readonly EXECUTIVE: "executive";
1031
+ readonly INSTANTLY: "instantly";
1032
+ readonly TESTING: "testing";
1033
+ readonly INTERNAL: "internal";
1034
+ readonly INTEGRATION: "integration";
1035
+ readonly UTILITY: "utility";
1036
+ readonly DIAGNOSTIC: "diagnostic";
1037
+ };
1038
+ /**
1039
+ * ResourceDomain - Strongly typed domain identifier
1040
+ * Use this type for all domain references to ensure compile-time validation.
1041
+ */
1042
+ type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS];
1043
+
1044
+ type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
1045
+
1046
+ type ActivityType = 'workflow_execution' | 'agent_run' | 'hitl_action' | 'webhook_received' | 'webhook_executed' | 'webhook_failed' | 'credential_change' | 'api_key_change' | 'deployment_change' | 'membership_change';
1047
+ type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed';
1048
+ interface Activity {
1049
+ id: string;
1050
+ organizationId: string;
1051
+ activityType: ActivityType;
1052
+ status: ActivityStatus;
1053
+ title: string;
1054
+ description: string | null;
1055
+ entityType: string;
1056
+ entityId: string;
1057
+ entityName: string | null;
1058
+ metadata: Record<string, unknown> | null;
1059
+ actorId: string | null;
1060
+ actorType: string | null;
1061
+ occurredAt: Date;
1062
+ createdAt: Date;
1063
+ }
1064
+
1065
+ /**
1066
+ * Execution history item.
1067
+ * Represents a single execution triggered by a schedule.
1068
+ */
1069
+ declare const ExecutionHistoryItemSchema: z.ZodObject<{
1070
+ id: z.ZodString;
1071
+ createdAt: z.ZodString;
1072
+ status: z.ZodEnum<{
1073
+ completed: "completed";
1074
+ failed: "failed";
1075
+ running: "running";
1076
+ cancelled: "cancelled";
1077
+ }>;
1078
+ step: z.ZodNullable<z.ZodNumber>;
1079
+ itemLabel: z.ZodNullable<z.ZodString>;
1080
+ duration: z.ZodNullable<z.ZodNumber>;
1081
+ error: z.ZodNullable<z.ZodString>;
1082
+ }, z.core.$strip>;
1083
+ /**
1084
+ * Execution history response.
1085
+ * Returned by GET /schedules/:id/executions with pagination.
1086
+ */
1087
+ declare const ExecutionHistoryResponseSchema: z.ZodObject<{
1088
+ executions: z.ZodArray<z.ZodObject<{
1089
+ id: z.ZodString;
1090
+ createdAt: z.ZodString;
1091
+ status: z.ZodEnum<{
1092
+ completed: "completed";
1093
+ failed: "failed";
1094
+ running: "running";
1095
+ cancelled: "cancelled";
1096
+ }>;
1097
+ step: z.ZodNullable<z.ZodNumber>;
1098
+ itemLabel: z.ZodNullable<z.ZodString>;
1099
+ duration: z.ZodNullable<z.ZodNumber>;
1100
+ error: z.ZodNullable<z.ZodString>;
1101
+ }, z.core.$strip>>;
1102
+ total: z.ZodNumber;
1103
+ limit: z.ZodNumber;
1104
+ offset: z.ZodNumber;
1105
+ }, z.core.$strip>;
1106
+ type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>;
1107
+ type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>;
1108
+
1109
+ /**
1110
+ * Fetch all available Execution Engine resources (workflows, agents, pipelines).
1111
+ *
1112
+ * @example
1113
+ * const { data, isLoading } = useResources()
1114
+ * const workflows = data?.workflows ?? []
1115
+ * const agents = data?.agents ?? []
1116
+ */
1117
+ declare function useResources(): _tanstack_react_query.UseQueryResult<{
1118
+ workflows: ResourceDefinition[];
1119
+ agents: ResourceDefinition[];
1120
+ pipelines: ResourceDefinition[];
1121
+ total: number;
1122
+ }, Error>;
1123
+
1124
+ /**
1125
+ * Fetch a resource definition (workflow steps, agent actions, etc.).
1126
+ *
1127
+ * @param resourceId - The resource ID to fetch
1128
+ * @param enabled - Whether the query should execute (default: true)
1129
+ */
1130
+ declare function useResourceDefinition(resourceId: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<AIResourceDefinition, Error>;
1131
+
1132
+ /**
1133
+ * Query key factory for schedule cache management.
1134
+ * Provides type-safe, hierarchical keys for TanStack Query.
1135
+ * Uses organizationId (UUID) for tenant-scoped cache isolation.
1136
+ */
1137
+ declare const scheduleKeys: {
1138
+ all: (orgId: string | null) => readonly ["schedules", string | null];
1139
+ lists: (orgId: string | null) => readonly ["schedules", string | null, "list"];
1140
+ list: (orgId: string | null, filters?: ListSchedulesFilters) => readonly ["schedules", string | null, "list", ListSchedulesFilters | undefined];
1141
+ details: (orgId: string | null) => readonly ["schedules", string | null, "detail"];
1142
+ detail: (orgId: string | null, id: string) => readonly ["schedules", string | null, "detail", string];
1143
+ executions: (orgId: string | null, id: string) => readonly ["schedules", string | null, "detail", string, "executions"];
1144
+ };
1145
+ /**
1146
+ * Filters for list schedules query.
1147
+ * Mirrors ListSchedulesQuery from @repo/core but typed for UI consumption.
1148
+ */
1149
+ interface ListSchedulesFilters {
1150
+ status?: 'active' | 'paused' | 'completed' | 'cancelled';
1151
+ targetResourceType?: 'agent' | 'workflow';
1152
+ targetResourceId?: string;
1153
+ limit?: number;
1154
+ offset?: number;
1155
+ }
1156
+
1157
+ interface CreateScheduleInput {
1158
+ name: string;
1159
+ description?: string;
1160
+ target: {
1161
+ resourceType: 'agent' | 'workflow';
1162
+ resourceId: string;
1163
+ };
1164
+ scheduleConfig: TaskScheduleConfig;
1165
+ maxRetries?: number;
1166
+ idempotencyKey?: string;
1167
+ originExecutionId?: string;
1168
+ originResourceType?: 'agent' | 'workflow' | 'scheduler' | 'api';
1169
+ originResourceId?: string;
1170
+ }
1171
+ interface UpdateScheduleInput {
1172
+ id: string;
1173
+ name?: string;
1174
+ description?: string | null;
1175
+ scheduleConfig?: TaskScheduleConfig;
1176
+ maxRetries?: number;
1177
+ }
1178
+ /** List response using domain type for CC compatibility. */
1179
+ interface ListSchedulesResponse {
1180
+ schedules: TaskSchedule[];
1181
+ total: number;
1182
+ limit: number;
1183
+ offset: number;
1184
+ }
1185
+ /**
1186
+ * List schedules with optional filters.
1187
+ *
1188
+ * @param filters - Optional filters for status, target resource, and pagination
1189
+ * @returns TanStack Query result with schedules array and pagination info
1190
+ *
1191
+ * @example
1192
+ * ```tsx
1193
+ * const { data, isLoading } = useListSchedules({ status: 'active', limit: 20 })
1194
+ * ```
1195
+ */
1196
+ declare function useListSchedules(filters?: ListSchedulesFilters): _tanstack_react_query.UseQueryResult<ListSchedulesResponse, Error>;
1197
+ /**
1198
+ * Get a single schedule by ID.
1199
+ *
1200
+ * @param id - Schedule UUID (undefined to disable query)
1201
+ * @returns TanStack Query result with schedule data
1202
+ *
1203
+ * @example
1204
+ * ```tsx
1205
+ * const { data: schedule, isLoading } = useGetSchedule(scheduleId)
1206
+ * ```
1207
+ */
1208
+ declare function useGetSchedule(id: string | undefined): _tanstack_react_query.UseQueryResult<TaskSchedule, Error>;
1209
+ /**
1210
+ * Get execution history for a schedule.
1211
+ *
1212
+ * @param scheduleId - Schedule UUID (undefined to disable query)
1213
+ * @param options - Pagination options (limit, offset)
1214
+ * @returns TanStack Query result with execution history and pagination info
1215
+ *
1216
+ * @example
1217
+ * ```tsx
1218
+ * const { data } = useGetExecutionHistory(scheduleId, { limit: 10 })
1219
+ * ```
1220
+ */
1221
+ declare function useGetExecutionHistory(scheduleId: string | undefined, options?: {
1222
+ limit?: number;
1223
+ offset?: number;
1224
+ }): _tanstack_react_query.UseQueryResult<{
1225
+ executions: {
1226
+ id: string;
1227
+ createdAt: string;
1228
+ status: "running" | "completed" | "failed" | "cancelled";
1229
+ step: number | null;
1230
+ itemLabel: string | null;
1231
+ duration: number | null;
1232
+ error: string | null;
1233
+ }[];
1234
+ total: number;
1235
+ limit: number;
1236
+ offset: number;
1237
+ }, Error>;
1238
+ /**
1239
+ * Create a new schedule.
1240
+ *
1241
+ * @returns TanStack Mutation for creating schedules
1242
+ *
1243
+ * @example
1244
+ * ```tsx
1245
+ * const createSchedule = useCreateSchedule()
1246
+ *
1247
+ * createSchedule.mutate({
1248
+ * name: 'Daily Report',
1249
+ * target: { resourceType: 'workflow', resourceId: 'wf-123' },
1250
+ * scheduleConfig: { type: 'recurring', cron: '0 9 * * *', timezone: 'UTC', payload: {} }
1251
+ * })
1252
+ * ```
1253
+ */
1254
+ declare function useCreateSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, CreateScheduleInput, unknown>;
1255
+ /**
1256
+ * Update schedule fields (name, description, scheduleConfig, maxRetries).
1257
+ * Only active or paused schedules can be updated.
1258
+ *
1259
+ * @returns TanStack Mutation for updating schedules
1260
+ *
1261
+ * @example
1262
+ * ```tsx
1263
+ * const updateSchedule = useUpdateSchedule()
1264
+ *
1265
+ * updateSchedule.mutate({ id: 'schedule-123', name: 'Updated Name' })
1266
+ * ```
1267
+ */
1268
+ declare function useUpdateSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, UpdateScheduleInput, unknown>;
1269
+ /**
1270
+ * Update anchor datetime for relative schedules.
1271
+ * Only applicable to schedules with type: 'relative'.
1272
+ *
1273
+ * @returns TanStack Mutation for updating schedule anchor
1274
+ *
1275
+ * @example
1276
+ * ```tsx
1277
+ * const updateAnchor = useUpdateAnchor()
1278
+ *
1279
+ * updateAnchor.mutate({ id: 'schedule-123', anchorAt: '2026-02-01T09:00:00Z' })
1280
+ * ```
1281
+ */
1282
+ declare function useUpdateAnchor(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, {
1283
+ id: string;
1284
+ anchorAt: string;
1285
+ }, unknown>;
1286
+ /**
1287
+ * Pause a schedule.
1288
+ * Paused schedules will not execute until resumed.
1289
+ *
1290
+ * @returns TanStack Mutation for pausing schedules
1291
+ *
1292
+ * @example
1293
+ * ```tsx
1294
+ * const pauseSchedule = usePauseSchedule()
1295
+ * pauseSchedule.mutate('schedule-123')
1296
+ * ```
1297
+ */
1298
+ declare function usePauseSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, string, unknown>;
1299
+ /**
1300
+ * Resume a paused schedule.
1301
+ *
1302
+ * @returns TanStack Mutation for resuming schedules
1303
+ *
1304
+ * @example
1305
+ * ```tsx
1306
+ * const resumeSchedule = useResumeSchedule()
1307
+ * resumeSchedule.mutate('schedule-123')
1308
+ * ```
1309
+ */
1310
+ declare function useResumeSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, string, unknown>;
1311
+ /**
1312
+ * Cancel a schedule permanently (soft delete).
1313
+ * Sets status to 'cancelled' -- schedule remains in DB for history.
1314
+ * Cancelled schedules cannot be resumed.
1315
+ *
1316
+ * @returns TanStack Mutation for cancelling schedules
1317
+ *
1318
+ * @example
1319
+ * ```tsx
1320
+ * const cancelSchedule = useCancelSchedule()
1321
+ * cancelSchedule.mutate('schedule-123')
1322
+ * ```
1323
+ */
1324
+ declare function useCancelSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, string, unknown>;
1325
+ /**
1326
+ * Delete a schedule permanently (hard delete).
1327
+ * Removes schedule from database entirely.
1328
+ *
1329
+ * @returns TanStack Mutation for deleting schedules
1330
+ *
1331
+ * @example
1332
+ * ```tsx
1333
+ * const deleteSchedule = useDeleteSchedule()
1334
+ * deleteSchedule.mutate('schedule-123')
1335
+ * ```
1336
+ */
1337
+ declare function useDeleteSchedule(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
1338
+
1339
+ interface UseActivitiesParams {
1340
+ limit?: number;
1341
+ offset?: number;
1342
+ activityType?: ActivityType;
1343
+ entityType?: string;
1344
+ entityId?: string;
1345
+ startDate?: string;
1346
+ endDate?: string;
1347
+ status?: string;
1348
+ search?: string;
1349
+ }
1350
+ interface ListActivitiesResponse {
1351
+ activities: Activity[];
1352
+ total: number;
1353
+ }
1354
+ /**
1355
+ * Fetch activities with filtering and pagination
1356
+ *
1357
+ * @example
1358
+ * // Basic usage - fetch recent activities
1359
+ * const { data, error, isLoading } = useActivities({ limit: 50 })
1360
+ *
1361
+ * @example
1362
+ * // Filtered by type
1363
+ * const { data } = useActivities({
1364
+ * activityType: 'workflow_execution',
1365
+ * limit: 20
1366
+ * })
1367
+ *
1368
+ * @example
1369
+ * // Filtered by entity
1370
+ * const { data } = useActivities({
1371
+ * entityType: 'workflow',
1372
+ * entityId: 'workflow-123'
1373
+ * })
1374
+ */
1375
+ interface ActivityTrendResponse {
1376
+ timestamps: Date[];
1377
+ total: number;
1378
+ }
1379
+ type UseActivityTrendParams = Omit<UseActivitiesParams, 'limit' | 'offset' | 'search' | 'status'>;
1380
+ /**
1381
+ * Fetch activity timestamps for the Activity Trend chart
1382
+ *
1383
+ * Uses /activities/trend endpoint which returns only occurred_at timestamps
1384
+ * up to ANALYTICS_SAFETY_LIMIT (10,000), bypassing the MAX_PAGE_LIMIT cap.
1385
+ * Provides accurate counts for any time range regardless of activity volume.
1386
+ */
1387
+ declare function useActivityTrend(params?: UseActivityTrendParams): _tanstack_react_query.UseQueryResult<ActivityTrendResponse, Error>;
1388
+ declare function useActivities(params?: UseActivitiesParams): _tanstack_react_query.UseQueryResult<ListActivitiesResponse, Error>;
1389
+
1390
+ interface UseExecutionLogsParams {
1391
+ resourceId?: string;
1392
+ status?: ExecutionStatus | 'all';
1393
+ resourceStatus?: 'dev' | 'prod' | 'all';
1394
+ startDate?: number;
1395
+ endDate?: number;
1396
+ limit?: number;
1397
+ offset?: number;
1398
+ }
1399
+ /**
1400
+ * Response type for cross-resource execution list
1401
+ * Matches backend ExecutionLogsPageResponse in apps/api/src/execution-engine/handlers.ts
1402
+ */
1403
+ interface ExecutionLogsPageResponse {
1404
+ executions: Array<{
1405
+ id: string;
1406
+ resourceId: string;
1407
+ resourceName: string;
1408
+ resourceType: 'workflow' | 'agent' | 'pipeline';
1409
+ status: ExecutionStatus;
1410
+ startTime: number;
1411
+ endTime?: number;
1412
+ duration?: number;
1413
+ resourceStatus: 'dev' | 'prod';
1414
+ resourceVersion?: string | null;
1415
+ apiVersion?: string | null;
1416
+ sdkVersion?: string | null;
1417
+ }>;
1418
+ total: number;
1419
+ hasMore: boolean;
1420
+ }
1421
+ /**
1422
+ * Fetch execution logs across all resources with filtering and pagination
1423
+ *
1424
+ * @example
1425
+ * // Basic usage - fetch recent executions
1426
+ * const { data, error, isLoading } = useExecutionLogs({ limit: 50 })
1427
+ *
1428
+ * @example
1429
+ * // Filtered by status
1430
+ * const { data } = useExecutionLogs({
1431
+ * status: 'failed',
1432
+ * limit: 20
1433
+ * })
1434
+ *
1435
+ * @example
1436
+ * // Filtered by resource and date range
1437
+ * const { data } = useExecutionLogs({
1438
+ * resourceId: 'workflow-123',
1439
+ * startDate: Date.now() - 86400000, // Last 24 hours
1440
+ * endDate: Date.now()
1441
+ * })
1442
+ */
1443
+ declare function useExecutionLogs(params?: UseExecutionLogsParams): _tanstack_react_query.UseQueryResult<ExecutionLogsPageResponse, Error>;
1444
+
1445
+ interface UseNotificationsOptions {
1446
+ limit?: number;
1447
+ offset?: number;
1448
+ }
1449
+ declare function useNotifications({ limit, offset }?: UseNotificationsOptions): _tanstack_react_query.UseQueryResult<{
1450
+ notifications: NotificationDTO[];
1451
+ total: number;
1452
+ }, Error>;
1453
+
1454
+ declare function useCostSummary(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<CostSummaryResponse, Error>;
1455
+
1456
+ interface UseExecutionHealthParams {
1457
+ timeRange: TimeRange;
1458
+ }
1459
+ declare function useExecutionHealth({ timeRange }: UseExecutionHealthParams): _tanstack_react_query.UseQueryResult<DashboardMetrics, Error>;
1460
+
1461
+ /**
1462
+ * Query key factories for observability hooks.
1463
+ * Scoped by organizationId for cache isolation between tenants.
1464
+ */
1465
+ declare const observabilityKeys: {
1466
+ all: readonly ["observability"];
1467
+ errorAnalysis: (organizationId: string | null, timeRange: string) => readonly ["observability", "error-analysis", string | null, string];
1468
+ errorDetails: (organizationId: string | null, filters: object) => readonly ["observability", "error-details", string | null, object];
1469
+ errorDetail: (organizationId: string | null, executionId: string | null) => readonly ["observability", "error-detail", string | null, string | null];
1470
+ errorTrends: (organizationId: string | null, startDate: string, endDate: string, granularity: string) => readonly ["observability", "error-trends", string | null, string, string, string];
1471
+ errorDistribution: (organizationId: string | null, startDate: string, endDate: string, groupBy: string) => readonly ["observability", "error-distribution", string | null, string, string, string];
1472
+ topFailingResources: (organizationId: string | null, startDate: string, endDate: string, limit: number) => readonly ["observability", "top-failing-resources", string | null, string, string, number];
1473
+ costTrends: (organizationId: string | null, timeRange: string, granularity: string) => readonly ["observability", "cost-trends", string | null, string, string];
1474
+ costByModel: (organizationId: string | null, timeRange: string) => readonly ["observability", "cost-by-model", string | null, string];
1475
+ costBreakdown: (organizationId: string | null, timeRange: string) => readonly ["observability", "cost-breakdown", string | null, string];
1476
+ dashboardMetrics: (organizationId: string | null, timeRange: string) => readonly ["observability", "dashboard-metrics", string | null, string];
1477
+ businessImpact: (organizationId: string | null, timeRange: string) => readonly ["observability", "business-impact", string | null, string];
1478
+ };
1479
+
1480
+ declare function useErrorAnalysis(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<ErrorAnalysisMetrics, Error>;
1481
+
1482
+ interface ErrorFilters {
1483
+ errorType?: string;
1484
+ severity?: 'critical' | 'warning' | 'info';
1485
+ search?: string;
1486
+ startDate?: string;
1487
+ endDate?: string;
1488
+ page?: number;
1489
+ limit?: number;
1490
+ /** When true, show only resolved errors. When false, show only unresolved. Omit to show all. */
1491
+ resolved?: boolean;
1492
+ }
1493
+ declare function useErrorDetails(filters: ErrorFilters): _tanstack_react_query.UseQueryResult<ErrorDetailResponse, Error>;
1494
+ declare function useErrorDetail(executionId: string | null): _tanstack_react_query.UseQueryResult<ErrorDetailFull[] | null, Error>;
1495
+
1496
+ interface ErrorTrendsParams {
1497
+ startDate: string;
1498
+ endDate: string;
1499
+ granularity: 'hour' | 'day';
1500
+ }
1501
+ declare function useErrorTrends({ startDate, endDate, granularity }: ErrorTrendsParams): _tanstack_react_query.UseQueryResult<ErrorTrend[], Error>;
1502
+
1503
+ interface ErrorDistributionParams {
1504
+ startDate: string;
1505
+ endDate: string;
1506
+ groupBy: 'errorType' | 'resource' | 'severity';
1507
+ }
1508
+ interface ErrorDistributionItem {
1509
+ label: string;
1510
+ count: number;
1511
+ percentage: number;
1512
+ }
1513
+ declare function useErrorDistribution({ startDate, endDate, groupBy }: ErrorDistributionParams): _tanstack_react_query.UseQueryResult<ErrorDistributionItem[], Error>;
1514
+
1515
+ interface TopFailingResourcesParams {
1516
+ startDate: string;
1517
+ endDate: string;
1518
+ limit?: number;
1519
+ }
1520
+ interface FailingResource {
1521
+ resourceId: string;
1522
+ resourceType: string;
1523
+ errorCount: number;
1524
+ failureRate: number;
1525
+ }
1526
+ declare function useTopFailingResources({ startDate, endDate, limit }: TopFailingResourcesParams): _tanstack_react_query.UseQueryResult<FailingResource[], Error>;
1527
+
1528
+ /**
1529
+ * Resolve a single error by ID.
1530
+ */
1531
+ declare function useResolveError(): _tanstack_react_query.UseMutationResult<unknown, Error, string, unknown>;
1532
+ /**
1533
+ * Unresolve a previously resolved error.
1534
+ */
1535
+ declare function useUnresolveError(): _tanstack_react_query.UseMutationResult<unknown, Error, string, unknown>;
1536
+ /**
1537
+ * Resolve all errors in the organization.
1538
+ */
1539
+ declare function useResolveAllErrors(): _tanstack_react_query.UseMutationResult<unknown, Error, void, unknown>;
1540
+ /**
1541
+ * Resolve all errors for a specific execution.
1542
+ */
1543
+ declare function useResolveErrorsByExecution(): _tanstack_react_query.UseMutationResult<unknown, Error, string, unknown>;
1544
+
1545
+ declare function useCostTrends(timeRange: TimeRange, granularity?: 'hour' | 'day' | 'week'): _tanstack_react_query.UseQueryResult<CostTrendsResponse, Error>;
1546
+
1547
+ declare function useCostByModel(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<CostByModelResponse, Error>;
1548
+
1549
+ interface CostBreakdownItem {
1550
+ resourceId: string;
1551
+ resourceType: string;
1552
+ model: string;
1553
+ totalCost: number;
1554
+ executionCount: number;
1555
+ }
1556
+ declare function useCostBreakdown(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<CostBreakdownItem[], Error>;
1557
+
1558
+ declare function useDashboardMetrics(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<unknown, Error>;
1559
+
1560
+ interface BusinessImpactMetrics {
1561
+ totalExecutions: number;
1562
+ estimatedTimeSavedMinutes: number;
1563
+ estimatedCostSavings: number;
1564
+ automationROI: number;
1565
+ }
1566
+ declare function useBusinessImpact(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<BusinessImpactMetrics, Error>;
1567
+
1568
+ declare function useMarkAsRead(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
1569
+
1570
+ declare function useMarkAllAsRead(): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
1571
+
1572
+ /**
1573
+ * API-only hook for unread notification count.
1574
+ *
1575
+ * For SSE-enhanced real-time counts, consumers should provide
1576
+ * the count via props (e.g., NotificationBell's `unreadCount` prop).
1577
+ */
1578
+ declare function useNotificationCount(): _tanstack_react_query.UseQueryResult<number, Error>;
1579
+
1580
+ interface SessionListItem {
1581
+ sessionId: string;
1582
+ resourceId: string;
1583
+ turnCount: number;
1584
+ isEnded: boolean;
1585
+ createdAt: Date;
1586
+ updatedAt: Date;
1587
+ }
1588
+ interface CreateSessionResponse {
1589
+ sessionId: string;
1590
+ resourceId: string;
1591
+ turnCount: number;
1592
+ createdAt: string;
1593
+ }
1594
+ /**
1595
+ * Response type from the /api/dev/execution-engine/resources endpoint
1596
+ */
1597
+ interface ResourcesResponse {
1598
+ workflows: ResourceDefinition[];
1599
+ agents: ResourceDefinition[];
1600
+ pipelines: ResourceDefinition[];
1601
+ }
1602
+ /**
1603
+ * Operations Service for fetching Execution Engine resources
1604
+ */
1605
+ declare class OperationsService {
1606
+ private apiRequest;
1607
+ constructor(apiRequest: <T>(endpoint: string, options?: RequestInit) => Promise<T>);
1608
+ /**
1609
+ * Fetch all available Execution Engine resources
1610
+ * Uses the unified /list-resources endpoint
1611
+ */
1612
+ getResources(): Promise<ResourcesResponse>;
1613
+ /**
1614
+ * Get detailed workflow information
1615
+ * Optional: For future detailed views
1616
+ */
1617
+ getWorkflowDetails(): Promise<ResourceDefinition[]>;
1618
+ /**
1619
+ * Get detailed agent information
1620
+ * Optional: For future detailed views
1621
+ */
1622
+ getAgentDetails(): Promise<ResourceDefinition[]>;
1623
+ /**
1624
+ * Get detailed pipeline information
1625
+ * Optional: For future detailed views
1626
+ */
1627
+ getPipelineDetails(): Promise<ResourceDefinition[]>;
1628
+ /**
1629
+ * Get resource definition (workflow steps, agent actions, pipeline stages, etc.)
1630
+ */
1631
+ getResourceDefinition(resourceId: string): Promise<AIResourceDefinition>;
1632
+ /**
1633
+ * List sessions with optional filtering
1634
+ */
1635
+ listSessions(params?: {
1636
+ resourceId?: string;
1637
+ }): Promise<SessionListItem[]>;
1638
+ /**
1639
+ * Get session details by ID
1640
+ */
1641
+ getSession(sessionId: string): Promise<SessionDTO>;
1642
+ /**
1643
+ * Create a new session for an agent
1644
+ */
1645
+ createSession(resourceId: string): Promise<CreateSessionResponse>;
1646
+ /**
1647
+ * Archive a session
1648
+ */
1649
+ archiveSession(sessionId: string): Promise<void>;
1650
+ }
1651
+
1652
+ export { OperationsService, executionsKeys, observabilityKeys, scheduleKeys, useActivities, useActivityTrend, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateSchedule, useDashboardMetrics, useDeleteExecution, useDeleteSchedule, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorTrends, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogs, useExecutions, useGetExecutionHistory, useGetSchedule, useListSchedules, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, usePauseSchedule, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResources, useResumeSchedule, useRetryExecution, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule };
1653
+ export type { ActivityTrendResponse, BulkDeleteExecutionsParams, BulkDeleteExecutionsResult, BusinessImpactMetrics, CancelExecutionParams, CancelExecutionResult, CostBreakdownItem, CreateScheduleInput, CreateSessionResponse, DeleteExecutionParams, ErrorDistributionItem, ErrorDistributionParams, ErrorFilters, ErrorTrendsParams, ExecuteAsyncParams, ExecuteAsyncResult, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogsPageResponse, FailingResource, ListActivitiesResponse, ListSchedulesFilters, ListSchedulesResponse, ResourcesResponse, RetryExecutionParams, SessionListItem, TaskSchedule, TopFailingResourcesParams, UpdateScheduleInput, UseActivitiesParams, UseActivityTrendParams, UseExecutionHealthParams, UseExecutionLogsParams };