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