@elevasis/ui 1.7.5 → 1.8.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 (43) hide show
  1. package/dist/api/index.js +2 -3
  2. package/dist/auth/index.js +3 -4
  3. package/dist/charts/index.js +6 -8
  4. package/dist/{chunk-SFF5MJEI.js → chunk-2YBPRE6H.js} +1 -2
  5. package/dist/{chunk-U34YGJQB.js → chunk-3I2LOKQU.js} +1 -1
  6. package/dist/{chunk-PVVQTENF.js → chunk-3PURTICE.js} +1 -1
  7. package/dist/{chunk-2JBWPFHF.js → chunk-6TMW6VQ2.js} +1 -1
  8. package/dist/{chunk-6HZAMY6T.js → chunk-ARZM3OTI.js} +6 -2
  9. package/dist/{chunk-OK3XFSJJ.js → chunk-BWZMI4KP.js} +963 -10
  10. package/dist/{chunk-4KPI7YCY.js → chunk-EHXOR5LA.js} +2 -3
  11. package/dist/{chunk-Y7UY3HI4.js → chunk-ESOQEOOX.js} +2 -2
  12. package/dist/{chunk-L2CM2CUA.js → chunk-GZVH423C.js} +26 -3
  13. package/dist/{chunk-Y6DNK5ZD.js → chunk-JRJW2H57.js} +35 -9
  14. package/dist/{chunk-LBPALY25.js → chunk-JUPCUF77.js} +2 -2
  15. package/dist/chunk-QWYJHM3S.js +1068 -0
  16. package/dist/{chunk-NEK6JKPW.js → chunk-WUQWCUCB.js} +1 -1
  17. package/dist/chunk-Z4TPHMRD.js +231 -0
  18. package/dist/components/index.css +65 -0
  19. package/dist/components/index.d.ts +261 -2
  20. package/dist/components/index.js +1136 -80
  21. package/dist/hooks/index.css +452 -0
  22. package/dist/hooks/index.d.ts +1831 -13
  23. package/dist/hooks/index.js +15 -6
  24. package/dist/hooks/published.css +452 -0
  25. package/dist/hooks/published.d.ts +866 -6
  26. package/dist/hooks/published.js +15 -370
  27. package/dist/index.css +3 -0
  28. package/dist/index.d.ts +1665 -2
  29. package/dist/index.js +14 -17
  30. package/dist/initialization/index.js +3 -4
  31. package/dist/organization/index.js +3 -4
  32. package/dist/profile/index.js +1 -2
  33. package/dist/provider/index.css +3 -0
  34. package/dist/provider/index.js +7 -10
  35. package/dist/provider/published.js +6 -9
  36. package/dist/utils/index.d.ts +92 -1
  37. package/dist/utils/index.js +1 -2
  38. package/package.json +7 -3
  39. package/dist/chunk-4VGWQ5AN.js +0 -91
  40. package/dist/chunk-KA7LO7U5.js +0 -28
  41. package/dist/chunk-LFYO3MDC.js +0 -58
  42. package/dist/chunk-TIRMFDM4.js +0 -33
  43. package/dist/chunk-TYV5NJV2.js +0 -1
@@ -1,6 +1,9 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import * as react from 'react';
3
3
  import { z } from 'zod';
4
+ import * as zustand from 'zustand';
5
+ import * as zustand_middleware from 'zustand/middleware';
6
+ import { Edge } from '@xyflow/react';
4
7
 
5
8
  /**
6
9
  * Error categories for observability grouping and classification.
@@ -8,6 +11,203 @@ import { z } from 'zod';
8
11
  */
9
12
  type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
10
13
 
14
+ /**
15
+ * Workflow-specific logging types and utilities
16
+ */
17
+
18
+ interface WorkflowExecutionContext$1 {
19
+ type: 'workflow';
20
+ contextType: 'workflow-execution';
21
+ executionId: string;
22
+ workflowId: string;
23
+ workflowName?: string;
24
+ organizationId: string;
25
+ executionPath?: string[];
26
+ }
27
+ interface WorkflowFailureContext$1 {
28
+ type: 'workflow';
29
+ contextType: 'workflow-failure';
30
+ executionId: string;
31
+ workflowId: string;
32
+ error: string;
33
+ }
34
+ interface StepStartedContext$1 {
35
+ type: 'workflow';
36
+ contextType: 'step-started';
37
+ stepId: string;
38
+ stepStatus: 'started';
39
+ input: unknown;
40
+ startTime: number;
41
+ }
42
+ interface StepCompletedContext$1 {
43
+ type: 'workflow';
44
+ contextType: 'step-completed';
45
+ stepId: string;
46
+ stepStatus: 'completed';
47
+ output: unknown;
48
+ duration: number;
49
+ isTerminal: boolean;
50
+ startTime: number;
51
+ endTime: number;
52
+ }
53
+ interface StepFailedContext$1 {
54
+ type: 'workflow';
55
+ contextType: 'step-failed';
56
+ stepId: string;
57
+ stepStatus: 'failed';
58
+ error: string;
59
+ duration: number;
60
+ startTime: number;
61
+ endTime: number;
62
+ }
63
+ interface ConditionalRouteContext$1 {
64
+ type: 'workflow';
65
+ contextType: 'conditional-route';
66
+ stepId: string;
67
+ target: string;
68
+ error?: string;
69
+ }
70
+ interface ExecutionPathContext$1 {
71
+ type: 'workflow';
72
+ contextType: 'execution-path';
73
+ executionPath: string[];
74
+ }
75
+ type WorkflowLogContext$1 = WorkflowExecutionContext$1 | WorkflowFailureContext$1 | StepStartedContext$1 | StepCompletedContext$1 | StepFailedContext$1 | ConditionalRouteContext$1 | ExecutionPathContext$1;
76
+
77
+ /**
78
+ * Agent-specific logging types
79
+ * Simplified 2-event model: lifecycle, iteration
80
+ *
81
+ * Design Philosophy:
82
+ * - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
83
+ * - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
84
+ */
85
+
86
+ /**
87
+ * Agent lifecycle stages
88
+ * Universal checkpoints that apply to all agent executions
89
+ */
90
+ type AgentLifecycle$1 = 'initialization' | 'iteration' | 'completion';
91
+ /**
92
+ * Iteration event types
93
+ * Activities that occur during agent iterations
94
+ */
95
+ type IterationEventType$1 = 'reasoning' | 'action' | 'tool-call';
96
+ /**
97
+ * Base fields shared by all lifecycle events
98
+ */
99
+ interface AgentLifecycleEventBase$1 {
100
+ type: 'agent';
101
+ agentId: string;
102
+ lifecycle: AgentLifecycle$1;
103
+ sessionId?: string;
104
+ }
105
+ /**
106
+ * Lifecycle started event - emitted when a phase begins
107
+ * REQUIRED: startTime (phase has started, no end yet)
108
+ */
109
+ interface AgentLifecycleStartedEvent$1 extends AgentLifecycleEventBase$1 {
110
+ stage: 'started';
111
+ startTime: number;
112
+ iteration?: number;
113
+ }
114
+ /**
115
+ * Lifecycle completed event - emitted when a phase succeeds
116
+ * REQUIRED: startTime, endTime, duration (phase has finished successfully)
117
+ */
118
+ interface AgentLifecycleCompletedEvent$1 extends AgentLifecycleEventBase$1 {
119
+ stage: 'completed';
120
+ startTime: number;
121
+ endTime: number;
122
+ duration: number;
123
+ iteration?: number;
124
+ attempts?: number;
125
+ memorySize?: {
126
+ sessionMemoryKeys: number;
127
+ historyEntries: number;
128
+ };
129
+ }
130
+ /**
131
+ * Lifecycle failed event - emitted when a phase fails
132
+ * REQUIRED: startTime, endTime, duration, error (phase has finished with error)
133
+ */
134
+ interface AgentLifecycleFailedEvent$1 extends AgentLifecycleEventBase$1 {
135
+ stage: 'failed';
136
+ startTime: number;
137
+ endTime: number;
138
+ duration: number;
139
+ error: string;
140
+ iteration?: number;
141
+ }
142
+ /**
143
+ * Union type for all lifecycle events
144
+ * Discriminated by 'stage' field for type narrowing
145
+ */
146
+ type AgentLifecycleEvent$1 = AgentLifecycleStartedEvent$1 | AgentLifecycleCompletedEvent$1 | AgentLifecycleFailedEvent$1;
147
+ /**
148
+ * Placeholder data for MVP
149
+ * Will be typed per actionType in future
150
+ */
151
+ interface ActionPlaceholderData$1 {
152
+ message: string;
153
+ }
154
+ /**
155
+ * Iteration event - captures activities during agent iterations
156
+ * Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
157
+ */
158
+ interface AgentIterationEvent$1 {
159
+ type: 'agent';
160
+ agentId: string;
161
+ lifecycle: 'iteration';
162
+ eventType: IterationEventType$1;
163
+ iteration: number;
164
+ sessionId?: string;
165
+ startTime: number;
166
+ endTime: number;
167
+ duration: number;
168
+ output?: string;
169
+ actionType?: string;
170
+ data?: ActionPlaceholderData$1;
171
+ }
172
+ /**
173
+ * Tool call event - captures individual tool executions during iterations
174
+ * Provides granular timing for each tool invocation
175
+ */
176
+ interface AgentToolCallEvent$1 {
177
+ type: 'agent';
178
+ agentId: string;
179
+ lifecycle: 'iteration';
180
+ eventType: 'tool-call';
181
+ iteration: number;
182
+ sessionId?: string;
183
+ toolName: string;
184
+ startTime: number;
185
+ endTime: number;
186
+ duration: number;
187
+ success: boolean;
188
+ error?: string;
189
+ input?: Record<string, unknown>;
190
+ output?: unknown;
191
+ }
192
+ /**
193
+ * Union type for all agent log contexts
194
+ * 3 event types total (lifecycle, iteration, tool-call)
195
+ */
196
+ type AgentLogContext$1 = AgentLifecycleEvent$1 | AgentIterationEvent$1 | AgentToolCallEvent$1;
197
+
198
+ /**
199
+ * Base execution logger for Execution Engine
200
+ */
201
+ type ExecutionLogLevel$1 = 'debug' | 'info' | 'warn' | 'error';
202
+
203
+ type LogContext$1 = WorkflowLogContext$1 | AgentLogContext$1;
204
+ interface ExecutionLogMessage$1 {
205
+ level: ExecutionLogLevel$1;
206
+ message: string;
207
+ timestamp: number;
208
+ context?: LogContext$1;
209
+ }
210
+
11
211
  /**
12
212
  * Shared form field types for dynamic form generation
13
213
  * Used by: Command Queue, Execution Runner UI, future form-based features
@@ -58,6 +258,74 @@ interface FormSchema {
58
258
  fields: FormField[];
59
259
  }
60
260
 
261
+ /**
262
+ * Command View Types
263
+ *
264
+ * Unified type definitions for the Command View graph visualization.
265
+ * These types are used by both backend serialization and frontend rendering.
266
+ *
267
+ * Command View shows the resource graph: agents, workflows, triggers, integrations,
268
+ * external resources, and human checkpoints with their relationships.
269
+ */
270
+
271
+ /**
272
+ * Extended agent metadata for Command View
273
+ * Includes model and capability information for graph display
274
+ */
275
+ interface CommandViewAgent extends ResourceDefinition {
276
+ type: 'agent';
277
+ modelProvider: string;
278
+ modelId: string;
279
+ toolCount: number;
280
+ hasKnowledgeMap: boolean;
281
+ hasMemory: boolean;
282
+ sessionCapable: boolean;
283
+ }
284
+ /**
285
+ * Extended workflow metadata for Command View
286
+ * Includes step information for graph display
287
+ */
288
+ interface CommandViewWorkflow extends ResourceDefinition {
289
+ type: 'workflow';
290
+ stepCount: number;
291
+ entryPoint: string;
292
+ }
293
+ /**
294
+ * Relationship types between resources
295
+ *
296
+ * - triggers: Resource initiates/starts another resource (orange)
297
+ * - uses: Resource uses an integration (teal)
298
+ * - approval: Resource requires human approval (yellow)
299
+ */
300
+ type RelationshipType$1 = 'triggers' | 'uses' | 'approval';
301
+ /**
302
+ * Command View edge (relationship between resources)
303
+ */
304
+ interface CommandViewEdge$1 {
305
+ id: string;
306
+ source: string;
307
+ target: string;
308
+ relationship: RelationshipType$1;
309
+ label?: string;
310
+ }
311
+ /**
312
+ * Command View data structure
313
+ * Complete graph data for visualization
314
+ *
315
+ * Backend serializes this once at startup and serves it via /command-view endpoint.
316
+ * Frontend consumes this directly for graph rendering.
317
+ */
318
+ interface CommandViewData {
319
+ workflows: CommandViewWorkflow[];
320
+ agents: CommandViewAgent[];
321
+ triggers: TriggerDefinition[];
322
+ integrations: IntegrationDefinition[];
323
+ externalResources: ExternalResourceDefinition[];
324
+ humanCheckpoints: HumanCheckpointDefinition[];
325
+ edges: CommandViewEdge$1[];
326
+ domainDefinitions?: DomainDefinition[];
327
+ }
328
+
61
329
  /**
62
330
  * Serialized Registry Types
63
331
  *
@@ -2604,6 +2872,9 @@ type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables
2604
2872
  } ? R : never : never;
2605
2873
 
2606
2874
  type SupabaseUserProfile = Tables<'users'>;
2875
+ type SupabaseApiKey = Tables<'api_keys'>;
2876
+ /** API response type for API key list items (omits sensitive key_hash) */
2877
+ type ApiKeyListItem = Omit<SupabaseApiKey, 'key_hash'>;
2607
2878
 
2608
2879
  /**
2609
2880
  * Action configuration for HITL tasks
@@ -2850,6 +3121,7 @@ interface NotificationDTO {
2850
3121
  createdAt: string;
2851
3122
  }
2852
3123
 
3124
+ type MessageType = MessageEvent['type'];
2853
3125
  /**
2854
3126
  * Session Data Transfer Object (DTO)
2855
3127
  * Transform type for API responses (snake_case DB → camelCase frontend)
@@ -2869,6 +3141,31 @@ interface SessionDTO {
2869
3141
  updatedAt: Date;
2870
3142
  endedAt?: Date | null;
2871
3143
  }
3144
+ interface ChatMessage {
3145
+ id: string;
3146
+ role: 'user' | 'assistant';
3147
+ messageType: MessageType;
3148
+ text: string;
3149
+ metadata?: MessageEvent;
3150
+ turnNumber: number;
3151
+ messageIndex?: number;
3152
+ createdAt: Date;
3153
+ }
3154
+ /** Token usage data sent with turn:complete WebSocket events */
3155
+ interface SessionTokenUsage {
3156
+ /** Tokens consumed by this turn's input */
3157
+ turnInputTokens: number;
3158
+ /** Tokens generated by this turn's output */
3159
+ turnOutputTokens: number;
3160
+ /** Total tokens for this turn (turnInputTokens + turnOutputTokens) */
3161
+ turnTotalTokens: number;
3162
+ /** Cumulative input tokens across all turns in this session */
3163
+ cumulativeInputTokens: number;
3164
+ /** Cumulative output tokens across all turns in this session */
3165
+ cumulativeOutputTokens: number;
3166
+ /** The model's context window size for this session (e.g., 200K) */
3167
+ contextWindowSize: number;
3168
+ }
2872
3169
 
2873
3170
  /**
2874
3171
  * Multi-tenancy configuration types
@@ -2921,6 +3218,29 @@ interface UserConfig {
2921
3218
  };
2922
3219
  }
2923
3220
 
3221
+ /**
3222
+ * Memberships Domain - Zod Validation Schemas
3223
+ *
3224
+ * Validation schemas for membership management endpoints.
3225
+ * Includes request bodies, query params, and path params.
3226
+ *
3227
+ * Security:
3228
+ * - All schemas use .strict() to prevent mass assignment attacks
3229
+ * - UUID validation prevents invalid references
3230
+ * - Role enum validation prevents privilege escalation
3231
+ * - organizationId never accepted in body (from JWT when needed)
3232
+ */
3233
+
3234
+ /**
3235
+ * Membership status validation
3236
+ * Note: Database constraint only allows 'active' | 'inactive'
3237
+ */
3238
+ declare const MembershipStatusSchema: z.ZodEnum<{
3239
+ active: "active";
3240
+ inactive: "inactive";
3241
+ }>;
3242
+ type MembershipStatus = z.infer<typeof MembershipStatusSchema>;
3243
+
2924
3244
  /**
2925
3245
  * Organization Membership types based on WorkOS API
2926
3246
  */
@@ -2936,6 +3256,36 @@ interface OrganizationMembership {
2936
3256
  createdAt: string;
2937
3257
  updatedAt: string;
2938
3258
  }
3259
+ /**
3260
+ * Request interfaces for membership operations
3261
+ */
3262
+ interface CreateMembershipRequest {
3263
+ userId: string;
3264
+ organizationId: string;
3265
+ roleSlug?: string;
3266
+ }
3267
+ interface UpdateMembershipRequest {
3268
+ roleSlug: string;
3269
+ }
3270
+ interface ListMembershipsParams {
3271
+ userId?: string;
3272
+ organizationId?: string;
3273
+ statuses?: MembershipStatus[];
3274
+ limit?: number;
3275
+ before?: string;
3276
+ after?: string;
3277
+ order?: 'asc' | 'desc';
3278
+ }
3279
+ /**
3280
+ * Response interfaces
3281
+ */
3282
+ interface ListMembershipsResponse {
3283
+ data: OrganizationMembership[];
3284
+ listMetadata?: {
3285
+ before?: string | null;
3286
+ after?: string | null;
3287
+ };
3288
+ }
2939
3289
  /**
2940
3290
  * Extended membership with user and organization details for UI
2941
3291
  */
@@ -3091,6 +3441,27 @@ interface ErrorTrend {
3091
3441
  warningCount: number;
3092
3442
  infoCount: number;
3093
3443
  }
3444
+ /**
3445
+ * Summary of executions for a single resource
3446
+ * Used by RecentExecutionsByResource dashboard component
3447
+ */
3448
+ interface ResourceExecutionSummary {
3449
+ resourceId: string;
3450
+ resourceType: string;
3451
+ resourceName: string | null;
3452
+ lastExecution: string;
3453
+ totalExecutions: number;
3454
+ successCount: number;
3455
+ failureCount: number;
3456
+ warningCount: number;
3457
+ successRate: number;
3458
+ }
3459
+ /**
3460
+ * Response from getRecentExecutionsByResource endpoint
3461
+ */
3462
+ interface RecentExecutionsByResourceResponse {
3463
+ resources: ResourceExecutionSummary[];
3464
+ }
3094
3465
  /** Resource identifier for health queries */
3095
3466
  interface ResourceIdentifier {
3096
3467
  entityType: string;
@@ -3188,6 +3559,53 @@ interface CostByModelResponse {
3188
3559
  * Core types shared across all Execution Engine resources
3189
3560
  */
3190
3561
 
3562
+ /**
3563
+ * Unified message event type - covers all message types in sessions
3564
+ * Replaces separate SessionTurnMessages and AgentActivityEvent mechanisms
3565
+ */
3566
+ /**
3567
+ * Structured action metadata attached to assistant messages.
3568
+ * Frontend reads this instead of parsing text prefixes.
3569
+ */
3570
+ type AssistantAction = {
3571
+ kind: 'navigate';
3572
+ path: string;
3573
+ reason: string;
3574
+ } | {
3575
+ kind: 'update_filters';
3576
+ timeRange: string | null;
3577
+ statusFilter: string | null;
3578
+ searchQuery: string | null;
3579
+ };
3580
+ type MessageEvent = {
3581
+ type: 'user_message';
3582
+ text: string;
3583
+ } | {
3584
+ type: 'assistant_message';
3585
+ text: string;
3586
+ _action?: AssistantAction;
3587
+ } | {
3588
+ type: 'agent:started';
3589
+ } | {
3590
+ type: 'agent:completed';
3591
+ } | {
3592
+ type: 'agent:error';
3593
+ error: string;
3594
+ } | {
3595
+ type: 'agent:reasoning';
3596
+ iteration: number;
3597
+ reasoning: string;
3598
+ } | {
3599
+ type: 'agent:tool_call';
3600
+ toolName: string;
3601
+ args: Record<string, unknown>;
3602
+ } | {
3603
+ type: 'agent:tool_result';
3604
+ toolName: string;
3605
+ success: boolean;
3606
+ result?: unknown;
3607
+ error?: string;
3608
+ };
3191
3609
  /**
3192
3610
  * NOTE: AIResource interface has been removed and replaced with ResourceDefinition
3193
3611
  * from registry/types.ts. All resources (executable and non-executable) now extend
@@ -3198,6 +3616,17 @@ interface CostByModelResponse {
3198
3616
  */
3199
3617
  type AIResourceDefinition = SerializedWorkflowDefinition | SerializedAgentDefinition;
3200
3618
 
3619
+ /**
3620
+ * Supported integration types
3621
+ *
3622
+ * These represent the available integration adapters that can be used with tools.
3623
+ * Each integration type corresponds to an adapter implementation.
3624
+ *
3625
+ * Note: Concrete adapter implementations are deferred until needed.
3626
+ * This type provides compile-time safety and auto-completion for tool definitions.
3627
+ */
3628
+ type IntegrationType = 'gmail' | 'google-sheets' | 'slack' | 'github' | 'linear' | 'attio' | 'airtable' | 'salesforce' | 'hubspot' | 'stripe' | 'twilio' | 'sendgrid' | 'mailgun' | 'zapier' | 'webhook' | 'apify' | 'instantly' | 'resend' | 'signature-api' | 'dropbox' | 'anymailfinder' | 'tomba' | 'millionverifier';
3629
+
3201
3630
  /**
3202
3631
  * Resource Registry type definitions
3203
3632
  */
@@ -3237,6 +3666,240 @@ interface ResourceDefinition {
3237
3666
  /** Whether this resource is archived and should be excluded from registration and deployment */
3238
3667
  archived?: boolean;
3239
3668
  }
3669
+ /**
3670
+ * Domain definition for Command View filtering
3671
+ *
3672
+ * Domains are organizational metadata for UI filtering/grouping.
3673
+ * No execution impact - purely for visualization.
3674
+ *
3675
+ * @example
3676
+ * {
3677
+ * id: 'support',
3678
+ * name: 'Customer Support',
3679
+ * description: 'Ticket triage, knowledge base, escalations',
3680
+ * color: 'green',
3681
+ * icon: 'IconHeadset'
3682
+ * }
3683
+ */
3684
+ interface DomainDefinition {
3685
+ /** Unique identifier (e.g., 'support') */
3686
+ id: string;
3687
+ /** Display name (e.g., 'Customer Support') */
3688
+ name: string;
3689
+ /** Purpose description */
3690
+ description: string;
3691
+ /** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
3692
+ color?: string;
3693
+ /** Optional Tabler icon name (e.g., 'IconHeadset') */
3694
+ icon?: string;
3695
+ }
3696
+ /** Webhook provider identifiers */
3697
+ type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify';
3698
+ /** Webhook trigger configuration */
3699
+ interface WebhookTriggerConfig {
3700
+ /** Provider identifier */
3701
+ provider: WebhookProviderType;
3702
+ /** Event type for documentation (not used for matching - workflow handles routing) */
3703
+ event?: string;
3704
+ /** Optional filtering (e.g., specific form ID for Fillout) */
3705
+ filter?: Record<string, string>;
3706
+ /** References credential in credentials table for per-org webhook secrets */
3707
+ credentialName?: string;
3708
+ }
3709
+ /** Schedule trigger configuration */
3710
+ interface ScheduleTriggerConfig {
3711
+ /** Cron expression (e.g., '0 6 * * *') */
3712
+ cron: string;
3713
+ /** Optional timezone (default: UTC) */
3714
+ timezone?: string;
3715
+ }
3716
+ /** Event trigger configuration */
3717
+ interface EventTriggerConfig {
3718
+ /** Internal event type */
3719
+ eventType: string;
3720
+ /** Event source */
3721
+ source?: string;
3722
+ }
3723
+ /** Union of all trigger configs */
3724
+ type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig;
3725
+ /**
3726
+ * Trigger metadata - entry points that initiate resource execution
3727
+ *
3728
+ * Triggers represent how executions start: webhooks from external services,
3729
+ * scheduled cron jobs, platform events, or manual user actions.
3730
+ *
3731
+ * BREAKING CHANGES (2025-11-30):
3732
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
3733
+ * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
3734
+ * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
3735
+ * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
3736
+ * - triggers object now includes `externalResources` option
3737
+ *
3738
+ * @example
3739
+ * // TriggerDefinition - metadata only
3740
+ * {
3741
+ * resourceId: 'trigger-new-order',
3742
+ * type: 'trigger',
3743
+ * triggerType: 'webhook',
3744
+ * name: 'New Order',
3745
+ * description: 'Webhook from Shopify on new orders',
3746
+ * version: '1.0.0',
3747
+ * status: 'prod',
3748
+ * webhookPath: '/webhooks/shopify/orders'
3749
+ * }
3750
+ *
3751
+ * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
3752
+ * // relationships: {
3753
+ * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
3754
+ * // }
3755
+ */
3756
+ interface TriggerDefinition extends ResourceDefinition {
3757
+ /** Resource type discriminator (narrowed from base union) */
3758
+ type: 'trigger';
3759
+ /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
3760
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
3761
+ /** Type-specific configuration */
3762
+ config?: TriggerConfig;
3763
+ /** For webhook triggers: path like '/webhooks/shopify/orders' */
3764
+ webhookPath?: string;
3765
+ /** For schedule triggers: cron expression like '0 6 * * *' */
3766
+ schedule?: string;
3767
+ /** For event triggers: event type like 'low-stock-alert' */
3768
+ eventType?: string;
3769
+ }
3770
+ /**
3771
+ * Integration metadata - external service connections
3772
+ *
3773
+ * References credentials table for actual connection. No connection status
3774
+ * stored here (queried at runtime from credentials table).
3775
+ *
3776
+ * BREAKING CHANGES (2025-11-30):
3777
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
3778
+ * - Field renames: `id` -> `resourceId` (inherited)
3779
+ * - New required field: `status` (inherited) - organizations must add status to all integrations
3780
+ * - New required field: `version` (inherited) - organizations must add version to all integrations
3781
+ * - New required field: `type: 'integration'` (inherited) - resource type discriminator
3782
+ *
3783
+ * @example
3784
+ * {
3785
+ * resourceId: 'integration-shopify-prod',
3786
+ * type: 'integration',
3787
+ * provider: 'shopify',
3788
+ * credentialName: 'shopify-prod',
3789
+ * name: 'Shopify Production',
3790
+ * description: 'E-commerce platform',
3791
+ * version: '1.0.0',
3792
+ * status: 'prod'
3793
+ * }
3794
+ */
3795
+ interface IntegrationDefinition extends ResourceDefinition {
3796
+ /** Resource type discriminator (narrowed from base union) */
3797
+ type: 'integration';
3798
+ /** Integration provider type */
3799
+ provider: IntegrationType;
3800
+ /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
3801
+ credentialName: string;
3802
+ }
3803
+ /**
3804
+ * External platform type
3805
+ * Supported third-party automation platforms
3806
+ */
3807
+ type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other';
3808
+ /**
3809
+ * External automation resource metadata
3810
+ *
3811
+ * Represents workflows/automations running on third-party platforms
3812
+ * (n8n, Make, Zapier, etc.) for visualization in Command View.
3813
+ *
3814
+ * NOTE: This is metadata ONLY for visualization. No execution logic,
3815
+ * no API integration with external platforms, no status syncing.
3816
+ *
3817
+ * BREAKING CHANGES (2025-11-30):
3818
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
3819
+ * - Field renames: `id` -> `resourceId` (inherited)
3820
+ * - New required field: `version` (inherited) - organizations must add version to all external resources
3821
+ * - New required field: `type: 'external'` (inherited) - resource type discriminator
3822
+ * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
3823
+ *
3824
+ * @example
3825
+ * {
3826
+ * resourceId: 'external-n8n-order-sync',
3827
+ * type: 'external',
3828
+ * version: '1.0.0',
3829
+ * platform: 'n8n',
3830
+ * name: 'Shopify Order Sync',
3831
+ * description: 'Legacy n8n workflow for syncing Shopify orders',
3832
+ * status: 'prod',
3833
+ * platformUrl: 'https://n8n.client.com/workflow/123',
3834
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
3835
+ * uses: { integrations: ['integration-shopify-prod'] }
3836
+ * }
3837
+ */
3838
+ interface ExternalResourceDefinition extends ResourceDefinition {
3839
+ /** Resource type discriminator (narrowed from base union) */
3840
+ type: 'external';
3841
+ /** Platform type */
3842
+ platform: ExternalPlatform;
3843
+ /** Link to external platform (e.g., n8n workflow editor URL) */
3844
+ platformUrl?: string;
3845
+ /** Platform's internal ID/reference */
3846
+ externalId?: string;
3847
+ /** What this external resource triggers (external -> internal) */
3848
+ triggers?: {
3849
+ /** Elevasis workflow resourceIds this external automation triggers */
3850
+ workflows?: string[];
3851
+ /** Elevasis agent resourceIds this external automation triggers */
3852
+ agents?: string[];
3853
+ };
3854
+ /** Integrations this external resource uses (shared credentials) */
3855
+ uses?: {
3856
+ /** Integration IDs this external automation uses */
3857
+ integrations?: string[];
3858
+ };
3859
+ }
3860
+ /**
3861
+ * Human Checkpoint definition - human decision points in automation
3862
+ *
3863
+ * Represents where human judgment is deployed in the automation landscape.
3864
+ * Tasks with matching command_queue_group are routed to this checkpoint.
3865
+ *
3866
+ * BREAKING CHANGES (2025-11-30):
3867
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
3868
+ * - Field renames: `id` -> `resourceId` (inherited)
3869
+ * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
3870
+ * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
3871
+ * - New required field: `type: 'human'` (inherited) - resource type discriminator
3872
+ *
3873
+ * @example
3874
+ * {
3875
+ * resourceId: 'sales-approval',
3876
+ * type: 'human',
3877
+ * name: 'Sales Approval Queue',
3878
+ * description: 'High-value order approvals for sales team',
3879
+ * version: '1.0.0',
3880
+ * status: 'prod',
3881
+ * requestedBy: { agents: ['order-processor-agent'] },
3882
+ * routesTo: { agents: ['order-fulfillment-agent'] }
3883
+ * }
3884
+ */
3885
+ interface HumanCheckpointDefinition extends ResourceDefinition {
3886
+ /** Resource type discriminator (narrowed from base union) */
3887
+ type: 'human';
3888
+ /** Resources that create tasks for this checkpoint */
3889
+ requestedBy?: {
3890
+ /** Agent resourceIds that request approval here */
3891
+ agents?: string[];
3892
+ /** Workflow resourceIds that request approval here */
3893
+ workflows?: string[];
3894
+ };
3895
+ /** Resources that receive approved decisions */
3896
+ routesTo?: {
3897
+ /** Agent resourceIds that handle approved tasks */
3898
+ agents?: string[];
3899
+ /** Workflow resourceIds that handle approved tasks */
3900
+ workflows?: string[];
3901
+ };
3902
+ }
3240
3903
 
3241
3904
  /**
3242
3905
  * Standard Domain Definitions
@@ -3266,6 +3929,79 @@ declare const DOMAINS: {
3266
3929
  type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS];
3267
3930
 
3268
3931
  type ExecutionStatus$1 = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
3932
+ interface APIExecutionSummary$1 {
3933
+ id: string;
3934
+ status: ExecutionStatus$1;
3935
+ startTime: number;
3936
+ endTime?: number;
3937
+ resourceStatus?: ResourceStatus$1;
3938
+ }
3939
+ interface APIExecutionDetail$1 extends APIExecutionSummary$1 {
3940
+ executionLogs: ExecutionLogMessage$1[];
3941
+ input?: unknown;
3942
+ result?: unknown;
3943
+ error?: string;
3944
+ resourceStatus: ResourceStatus$1;
3945
+ apiVersion?: string | null;
3946
+ resourceVersion?: string | null;
3947
+ sdkVersion?: string | null;
3948
+ }
3949
+
3950
+ /**
3951
+ * @deprecated Use TimeRange from '@repo/core' directly. Kept as alias for backward compatibility.
3952
+ */
3953
+ type StatsTimeRange = TimeRange;
3954
+ /** Stats returned by /command-view/stats (counts only, no error details) */
3955
+ interface ResourceStats {
3956
+ resourceId: string;
3957
+ totalRuns: number;
3958
+ successCount: number;
3959
+ failureCount: number;
3960
+ warningCount: number;
3961
+ lastRunAt: string | null;
3962
+ }
3963
+ /** Response from /command-view/resource-errors (on-demand) */
3964
+ interface ResourceErrorsResponse {
3965
+ resourceId: string;
3966
+ errors: ErrorSummary[];
3967
+ totalErrors: number;
3968
+ timeRange: StatsTimeRange;
3969
+ }
3970
+ interface ErrorSummary {
3971
+ executionId: string;
3972
+ errorType: string;
3973
+ errorMessage: string;
3974
+ occurredAt: string;
3975
+ }
3976
+ /** Single execution summary for Recent Executions list in command view */
3977
+ interface CommandViewExecution {
3978
+ executionId: string;
3979
+ status: ExecutionStatus$1;
3980
+ startedAt: string;
3981
+ completedAt: string | null;
3982
+ errorMessage: string | null;
3983
+ }
3984
+ /** Response from /command-view/resource-executions (on-demand) */
3985
+ interface ResourceExecutionsResponse {
3986
+ resourceId: string;
3987
+ executions: CommandViewExecution[];
3988
+ totalExecutions: number;
3989
+ timeRange: StatsTimeRange;
3990
+ }
3991
+ interface HumanCheckpointStats {
3992
+ checkpointId: string;
3993
+ pendingCount: number;
3994
+ completedCount: number;
3995
+ expiredCount: number;
3996
+ lastDecisionAt: string | null;
3997
+ }
3998
+ /** Response from /command-view/stats */
3999
+ interface CommandViewStatsResponse {
4000
+ resources: Record<string, ResourceStats>;
4001
+ humanCheckpoints: Record<string, HumanCheckpointStats>;
4002
+ timeRange: StatsTimeRange;
4003
+ generatedAt: string;
4004
+ }
3269
4005
 
3270
4006
  type ActivityType = 'workflow_execution' | 'agent_run' | 'hitl_action' | 'webhook_received' | 'webhook_executed' | 'webhook_failed' | 'credential_change' | 'api_key_change' | 'deployment_change' | 'membership_change';
3271
4007
  type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed';
@@ -3330,6 +4066,27 @@ declare const ExecutionHistoryResponseSchema: z.ZodObject<{
3330
4066
  type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>;
3331
4067
  type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>;
3332
4068
 
4069
+ /**
4070
+ * Deployment types — browser-safe
4071
+ *
4072
+ * Canonical API response types for the deployment resource.
4073
+ * The API's transformRow converts snake_case DB columns to these camelCase fields.
4074
+ */
4075
+ type DeploymentStatus = 'deploying' | 'active' | 'failed' | 'rolled_back' | 'stopped';
4076
+ interface Deployment {
4077
+ id: string;
4078
+ organizationId: string;
4079
+ status: DeploymentStatus;
4080
+ sdkVersion: string;
4081
+ deploymentVersion: string | null;
4082
+ port: number | null;
4083
+ pid: number | null;
4084
+ tarballPath: string | null;
4085
+ errorMessage: string | null;
4086
+ createdAt: string;
4087
+ updatedAt: string;
4088
+ }
4089
+
3333
4090
  declare function useCommandQueue({ status, limit, offset, humanCheckpoint, timeRange, priorityMin, priorityMax, }?: {
3334
4091
  status?: TaskStatus;
3335
4092
  limit?: number;
@@ -4037,6 +4794,22 @@ declare function useWarningNotification(): (title: string, message: string) => v
4037
4794
  */
4038
4795
  declare function useBatchDelete(tableName: string, invalidateQueryKeys: readonly (readonly unknown[])[]): _tanstack_react_query.UseMutationResult<void, Error, string[], unknown>;
4039
4796
 
4797
+ /**
4798
+ * Mutation hook to send a test notification.
4799
+ * On success, invalidates the notifications query cache.
4800
+ * On error, shows an API error notification via the notification adapter.
4801
+ *
4802
+ * @returns TanStack Mutation for triggering test notifications
4803
+ *
4804
+ * @example
4805
+ * ```tsx
4806
+ * const testNotification = useTestNotification()
4807
+ *
4808
+ * testNotification.mutate()
4809
+ * ```
4810
+ */
4811
+ declare function useTestNotification(): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
4812
+
4040
4813
  /**
4041
4814
  * Query key factories for observability hooks.
4042
4815
  * Scoped by organizationId for cache isolation between tenants.
@@ -4055,6 +4828,8 @@ declare const observabilityKeys: {
4055
4828
  dashboardMetrics: (organizationId: string | null, timeRange: string) => readonly ["observability", "dashboard-metrics", string | null, string];
4056
4829
  businessImpact: (organizationId: string | null, timeRange: string) => readonly ["observability", "business-impact", string | null, string];
4057
4830
  resourcesHealth: (organizationId: string | null, resources: string, startDate: string, endDate: string, granularity: string) => readonly ["observability", "resources-health", string | null, string, string, string, string];
4831
+ unresolvedErrors: (organizationId: string | null, startDate: string, endDate: string) => readonly ["observability", "unresolved-errors", string | null, string, string];
4832
+ recentExecutionsByResource: (organizationId: string | null, timeRange: string, limit: number | undefined) => readonly ["observability", "recent-executions-by-resource", string | null, string, number | undefined];
4058
4833
  };
4059
4834
 
4060
4835
  declare function useErrorAnalysis(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<ErrorAnalysisMetrics, Error>;
@@ -4168,19 +4943,62 @@ declare function useBatchedResourcesHealth(params: UseBatchedResourcesHealthPara
4168
4943
  healthLookup: Map<string, ResourceHealth>;
4169
4944
  };
4170
4945
 
4946
+ interface UseUnresolvedErrorsParams {
4947
+ startDate: string;
4948
+ endDate: string;
4949
+ }
4171
4950
  /**
4172
- * Query key factory for schedule cache management.
4173
- * Provides type-safe, hierarchical keys for TanStack Query.
4174
- * Uses organizationId (UUID) for tenant-scoped cache isolation.
4951
+ * Fetches the most recent unresolved errors for the dashboard operational overview.
4175
4952
  */
4176
- declare const scheduleKeys: {
4177
- all: (orgId: string | null) => readonly ["schedules", string | null];
4178
- lists: (orgId: string | null) => readonly ["schedules", string | null, "list"];
4179
- list: (orgId: string | null, filters?: ListSchedulesFilters) => readonly ["schedules", string | null, "list", ListSchedulesFilters | undefined];
4180
- details: (orgId: string | null) => readonly ["schedules", string | null, "detail"];
4181
- detail: (orgId: string | null, id: string) => readonly ["schedules", string | null, "detail", string];
4182
- executions: (orgId: string | null, id: string) => readonly ["schedules", string | null, "detail", string, "executions"];
4183
- };
4953
+ declare function useUnresolvedErrors({ startDate, endDate }: UseUnresolvedErrorsParams): _tanstack_react_query.UseQueryResult<ErrorDetailResponse, Error>;
4954
+
4955
+ interface UseRecentExecutionsByResourceParams {
4956
+ timeRange: TimeRange;
4957
+ limit?: number;
4958
+ }
4959
+ /**
4960
+ * Fetch recent executions grouped by resource.
4961
+ * Single source of truth from execution_logs (includes session-based executions).
4962
+ *
4963
+ * @example
4964
+ * const { data, isLoading } = useRecentExecutionsByResource({
4965
+ * timeRange: '24h',
4966
+ * limit: 5
4967
+ * })
4968
+ */
4969
+ declare function useRecentExecutionsByResource({ timeRange, limit }: UseRecentExecutionsByResourceParams): _tanstack_react_query.UseQueryResult<RecentExecutionsByResourceResponse, Error>;
4970
+
4971
+ interface UseScheduledTasksOptions {
4972
+ status?: 'active' | 'paused' | 'completed' | 'cancelled';
4973
+ targetResourceType?: 'agent' | 'workflow';
4974
+ }
4975
+ /**
4976
+ * Dashboard hook for fetching scheduled tasks.
4977
+ * Simplified read-only hook that returns the schedules array directly.
4978
+ *
4979
+ * @param options - Optional filters for status and target resource type
4980
+ * @returns TanStack Query result with schedules array
4981
+ *
4982
+ * @example
4983
+ * ```tsx
4984
+ * const { data: schedules, isLoading } = useScheduledTasks({ status: 'active' })
4985
+ * ```
4986
+ */
4987
+ declare function useScheduledTasks(options?: UseScheduledTasksOptions): _tanstack_react_query.UseQueryResult<TaskSchedule[], Error>;
4988
+
4989
+ /**
4990
+ * Query key factory for schedule cache management.
4991
+ * Provides type-safe, hierarchical keys for TanStack Query.
4992
+ * Uses organizationId (UUID) for tenant-scoped cache isolation.
4993
+ */
4994
+ declare const scheduleKeys: {
4995
+ all: (orgId: string | null) => readonly ["schedules", string | null];
4996
+ lists: (orgId: string | null) => readonly ["schedules", string | null, "list"];
4997
+ list: (orgId: string | null, filters?: ListSchedulesFilters) => readonly ["schedules", string | null, "list", ListSchedulesFilters | undefined];
4998
+ details: (orgId: string | null) => readonly ["schedules", string | null, "detail"];
4999
+ detail: (orgId: string | null, id: string) => readonly ["schedules", string | null, "detail", string];
5000
+ executions: (orgId: string | null, id: string) => readonly ["schedules", string | null, "detail", string, "executions"];
5001
+ };
4184
5002
  /**
4185
5003
  * Filters for list schedules query.
4186
5004
  * Mirrors ListSchedulesQuery from @repo/core but typed for UI consumption.
@@ -4447,6 +5265,123 @@ declare class OperationsService {
4447
5265
  archiveSession(sessionId: string): Promise<void>;
4448
5266
  }
4449
5267
 
5268
+ /**
5269
+ * Session-scoped query key factory.
5270
+ * Organization identifier is always included for cache isolation.
5271
+ */
5272
+ declare const sessionsKeys: {
5273
+ all: readonly ["sessions"];
5274
+ sessions: (org: string, params?: {
5275
+ resourceId?: string;
5276
+ }) => readonly ["sessions", "list", string, {
5277
+ resourceId?: string;
5278
+ } | undefined];
5279
+ session: (org: string, sessionId: string) => readonly ["sessions", "detail", string, string];
5280
+ executions: (org: string, sessionId: string) => readonly ["sessions", string, string, "executions"];
5281
+ execution: (org: string, sessionId: string, executionId: string) => readonly ["sessions", string, string, "executions", string];
5282
+ messages: (org: string, sessionId: string) => readonly ["sessions", string, string, "messages"];
5283
+ };
5284
+
5285
+ interface SessionExecution {
5286
+ executionId: string;
5287
+ turnNumber: number;
5288
+ status: string;
5289
+ startedAt: string;
5290
+ completedAt?: string;
5291
+ duration?: number;
5292
+ }
5293
+ interface SessionExecutionsResponse {
5294
+ sessionId: string;
5295
+ executions: SessionExecution[];
5296
+ }
5297
+ interface GetMessagesResponse {
5298
+ sessionId: string;
5299
+ messages: Array<{
5300
+ id: string;
5301
+ role: 'user' | 'assistant';
5302
+ messageType: MessageType;
5303
+ text: string;
5304
+ metadata?: MessageEvent;
5305
+ turnNumber: number;
5306
+ messageIndex?: number;
5307
+ createdAt: string;
5308
+ }>;
5309
+ }
5310
+ interface WebSocketState {
5311
+ isConnected: boolean;
5312
+ isProcessing: boolean;
5313
+ error: string | null;
5314
+ }
5315
+
5316
+ /** Active execution detail polling when status is 'running' (2s). */
5317
+ declare const REFETCH_INTERVAL_RUNNING = 2000;
5318
+
5319
+ /** WebSocket exponential backoff base delay (1s). */
5320
+ declare const WS_RECONNECT_BASE_DELAY = 1000;
5321
+ /** WebSocket reconnect delay cap (30s). */
5322
+ declare const WS_RECONNECT_MAX_DELAY = 30000;
5323
+ /** WebSocket retries before showing error state. */
5324
+ declare const WS_MAX_RETRIES_BEFORE_ERROR = 3;
5325
+
5326
+ /**
5327
+ * Hook to fetch sessions list with optional filtering.
5328
+ */
5329
+ declare function useSessions(params?: {
5330
+ resourceId?: string;
5331
+ }, options?: {
5332
+ enabled?: boolean;
5333
+ }): _tanstack_react_query.UseQueryResult<SessionListItem[], Error>;
5334
+ /**
5335
+ * Hook to fetch a single session by ID.
5336
+ */
5337
+ declare function useSession(sessionId: string): _tanstack_react_query.UseQueryResult<SessionDTO, Error>;
5338
+ /**
5339
+ * Hook to create a new session.
5340
+ */
5341
+ declare function useCreateSession(): _tanstack_react_query.UseMutationResult<CreateSessionResponse, Error, string, unknown>;
5342
+ /**
5343
+ * Hook to delete a session.
5344
+ */
5345
+ declare function useDeleteSession(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
5346
+ /**
5347
+ * Hook to archive a session.
5348
+ */
5349
+ declare function useArchiveSession(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
5350
+
5351
+ /**
5352
+ * Hook to fetch all executions for a session, grouped by turn.
5353
+ * Each turn creates one execution.
5354
+ */
5355
+ declare function useSessionExecutions(sessionId: string): _tanstack_react_query.UseQueryResult<SessionExecutionsResponse, Error>;
5356
+ /**
5357
+ * Hook to fetch a single execution detail for a session turn.
5358
+ * Auto-refetches every 2 seconds while the execution is still running.
5359
+ */
5360
+ declare function useSessionExecution(sessionId: string, executionId: string): _tanstack_react_query.UseQueryResult<APIExecutionDetail$1, Error>;
5361
+
5362
+ /**
5363
+ * Hook to fetch message history for a session.
5364
+ * Transforms ISO date strings to Date objects on the returned messages.
5365
+ */
5366
+ declare function useSessionMessages(sessionId: string): _tanstack_react_query.UseQueryResult<ChatMessage[], Error>;
5367
+
5368
+ /**
5369
+ * WebSocket hook for real-time agent chat sessions.
5370
+ * Connects to backend WebSocket endpoint with authentication.
5371
+ * Auto-reconnects with exponential backoff.
5372
+ *
5373
+ * @param sessionId - The session to connect to.
5374
+ * @param apiUrl - Base URL of the API server (e.g. "https://api.example.com").
5375
+ * Callers typically obtain this from their service configuration.
5376
+ */
5377
+ declare function useSessionWebSocket(sessionId: string, apiUrl: string): {
5378
+ messages: ChatMessage[];
5379
+ state: WebSocketState;
5380
+ sendMessage: (text: string, pageContext?: Record<string, unknown>) => void;
5381
+ clearError: () => void;
5382
+ lastTokenUsage: SessionTokenUsage | null;
5383
+ };
5384
+
4450
5385
  /**
4451
5386
  * Shared hook for pagination state management.
4452
5387
  * Encapsulates page state, offset calculation, and reset-on-filter-change.
@@ -4719,5 +5654,888 @@ declare function useSSEConnection({ manager, connectionKey, url, enabled, header
4719
5654
  error: string | null;
4720
5655
  };
4721
5656
 
4722
- export { OperationsService, createUseFeatureAccess, executionsKeys, observabilityKeys, scheduleKeys, sortData, useActivities, useActivityTrend, useBatchDelete, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCommandQueue, useCommandQueueTotals, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateSchedule, useDashboardMetrics, useDeleteExecution, useDeleteSchedule, useDeleteTask, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogs, useExecutions, useGetExecutionHistory, useGetSchedule, useListSchedules, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, usePaginationState, usePatchTask, usePauseSchedule, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResources, useResourcesHealth, useResumeSchedule, useRetryExecution, useSSEConnection, useSortedData, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule, useWarningNotification };
4723
- 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, SortDirection, SortState, SubmitActionRequest, SubmitActionResponse, TaskSchedule, TopFailingResourcesParams, UpdateScheduleInput, UseActivitiesParams, UseActivityTrendParams, UseBatchedResourcesHealthParams, UseExecutionHealthParams, UseExecutionLogsParams, UseResourcesHealthParams, UseSSEConnectionOptions };
5657
+ interface ResourceSearchStore {
5658
+ query: string;
5659
+ set: (query: string) => void;
5660
+ }
5661
+ declare const useResourceSearch: zustand.UseBoundStore<zustand.StoreApi<ResourceSearchStore>>;
5662
+
5663
+ type StatusFilter$1 = 'all' | 'dev' | 'prod';
5664
+ interface StatusFilterStore {
5665
+ value: StatusFilter$1;
5666
+ set: (value: StatusFilter$1) => void;
5667
+ }
5668
+ declare const useStatusFilter: zustand.UseBoundStore<zustand.StoreApi<StatusFilterStore>>;
5669
+
5670
+ /**
5671
+ * Tracks which resource cards are visible in the viewport using Intersection Observer.
5672
+ * Returns a Set of visible resource IDs and a ref callback to attach to card elements.
5673
+ *
5674
+ * Cards must have a `data-resource-id` attribute to be tracked.
5675
+ */
5676
+ declare function useVisibleResources(): {
5677
+ visibleIds: Set<string>;
5678
+ setContainerRef: (node: HTMLDivElement | null) => void;
5679
+ };
5680
+
5681
+ type DomainFilterState = 'neutral' | 'include' | 'exclude';
5682
+ interface DomainFiltersStore {
5683
+ filters: Record<string, DomainFilterState>;
5684
+ cycle: (domainId: string) => void;
5685
+ reset: () => void;
5686
+ }
5687
+ declare const useResourcesDomainFilters: zustand.UseBoundStore<Omit<zustand.StoreApi<DomainFiltersStore>, "setState" | "persist"> & {
5688
+ setState(partial: DomainFiltersStore | Partial<DomainFiltersStore> | ((state: DomainFiltersStore) => DomainFiltersStore | Partial<DomainFiltersStore>), replace?: false | undefined): unknown;
5689
+ setState(state: DomainFiltersStore | ((state: DomainFiltersStore) => DomainFiltersStore), replace: true): unknown;
5690
+ persist: {
5691
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<DomainFiltersStore, DomainFiltersStore, unknown>>) => void;
5692
+ clearStorage: () => void;
5693
+ rehydrate: () => Promise<void> | void;
5694
+ hasHydrated: () => boolean;
5695
+ onHydrate: (fn: (state: DomainFiltersStore) => void) => () => void;
5696
+ onFinishHydration: (fn: (state: DomainFiltersStore) => void) => () => void;
5697
+ getOptions: () => Partial<zustand_middleware.PersistOptions<DomainFiltersStore, DomainFiltersStore, unknown>>;
5698
+ };
5699
+ }>;
5700
+ declare const useCommandViewDomainFilters: zustand.UseBoundStore<Omit<zustand.StoreApi<DomainFiltersStore>, "setState" | "persist"> & {
5701
+ setState(partial: DomainFiltersStore | Partial<DomainFiltersStore> | ((state: DomainFiltersStore) => DomainFiltersStore | Partial<DomainFiltersStore>), replace?: false | undefined): unknown;
5702
+ setState(state: DomainFiltersStore | ((state: DomainFiltersStore) => DomainFiltersStore), replace: true): unknown;
5703
+ persist: {
5704
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<DomainFiltersStore, DomainFiltersStore, unknown>>) => void;
5705
+ clearStorage: () => void;
5706
+ rehydrate: () => Promise<void> | void;
5707
+ hasHydrated: () => boolean;
5708
+ onHydrate: (fn: (state: DomainFiltersStore) => void) => () => void;
5709
+ onFinishHydration: (fn: (state: DomainFiltersStore) => void) => () => void;
5710
+ getOptions: () => Partial<zustand_middleware.PersistOptions<DomainFiltersStore, DomainFiltersStore, unknown>>;
5711
+ };
5712
+ }>;
5713
+ declare function filterByDomainFilters(items: ResourceDefinition[], filters: Record<string, DomainFilterState>): ResourceDefinition[];
5714
+
5715
+ /**
5716
+ * Converts the global time range setting into startDate/endDate strings
5717
+ * for use in data guide suggested params.
5718
+ */
5719
+ declare function useTimeRangeDates(timeRange: TimeRange): {
5720
+ startDate: string;
5721
+ endDate: string;
5722
+ };
5723
+
5724
+ interface ActivityFilters {
5725
+ activityType?: ActivityType | 'all';
5726
+ status?: ActivityStatus | 'all';
5727
+ search?: string;
5728
+ }
5729
+ declare function useActivityFilters(timeRange: TimeRange): {
5730
+ filters: ActivityFilters;
5731
+ updateFilter: <K extends keyof ActivityFilters>(key: K, value: ActivityFilters[K]) => void;
5732
+ resetFilters: () => void;
5733
+ getApiParams: () => {
5734
+ activityType?: ActivityType;
5735
+ startDate?: string;
5736
+ status?: string;
5737
+ search?: string;
5738
+ };
5739
+ };
5740
+
5741
+ interface ExecutionLogsFilters {
5742
+ resourceId: string | undefined;
5743
+ status: 'all' | ExecutionStatus$1;
5744
+ resourceStatus: 'all' | 'dev' | 'prod';
5745
+ }
5746
+ /**
5747
+ * Pure client-side state hook for execution log filtering.
5748
+ * No data fetching -- manages filter state with reset capability.
5749
+ *
5750
+ * @param _timeRange - Time range context (reserved for future use)
5751
+ * @returns filters state, updateFilter setter, and resetFilters utility
5752
+ *
5753
+ * @example
5754
+ * ```tsx
5755
+ * const { filters, updateFilter, resetFilters } = useExecutionLogsFilters(timeRange)
5756
+ *
5757
+ * updateFilter('status', 'failed')
5758
+ * updateFilter('resourceId', 'wf-123')
5759
+ * resetFilters()
5760
+ * ```
5761
+ */
5762
+ declare function useExecutionLogsFilters(_timeRange: TimeRange): {
5763
+ filters: ExecutionLogsFilters;
5764
+ updateFilter: <K extends keyof ExecutionLogsFilters>(key: K, value: ExecutionLogsFilters[K]) => void;
5765
+ resetFilters: () => void;
5766
+ };
5767
+
5768
+ /**
5769
+ * Fetch organization members with membership details.
5770
+ *
5771
+ * Note: `organizationId` is passed as a parameter (not read from context)
5772
+ * so consumers can query for a specific organization independently.
5773
+ *
5774
+ * @param organizationId - The organization to fetch members for
5775
+ * @param params - Optional additional filters (reserved for future use)
5776
+ * @returns TanStack Query result with MembershipWithDetails array
5777
+ *
5778
+ * @example
5779
+ * ```tsx
5780
+ * const { data: members, isLoading } = useOrganizationMembers(organizationId)
5781
+ * ```
5782
+ */
5783
+ declare function useOrganizationMembers(organizationId: string, params?: Omit<ListMembershipsParams, 'organizationId'>): _tanstack_react_query.UseQueryResult<MembershipWithDetails[], Error>;
5784
+
5785
+ interface CreateApiKeyRequest {
5786
+ name: string;
5787
+ }
5788
+ interface CreateApiKeyResponse {
5789
+ id: string;
5790
+ key: string;
5791
+ message: string;
5792
+ }
5793
+ interface ListApiKeysResponse {
5794
+ keys: ApiKeyListItem[];
5795
+ }
5796
+ type ApiRequest$3 = <T>(endpoint: string, options?: RequestInit) => Promise<T>;
5797
+ declare class ApiKeyService {
5798
+ private apiRequest;
5799
+ constructor(apiRequest: ApiRequest$3);
5800
+ /**
5801
+ * List API keys for the current organization
5802
+ */
5803
+ listApiKeys(): Promise<ApiKeyListItem[]>;
5804
+ /**
5805
+ * Create a new API key
5806
+ */
5807
+ createApiKey(data: CreateApiKeyRequest): Promise<CreateApiKeyResponse>;
5808
+ /**
5809
+ * Update an API key's name
5810
+ */
5811
+ updateApiKey(keyId: string, data: {
5812
+ name: string;
5813
+ }): Promise<void>;
5814
+ /**
5815
+ * Delete an API key
5816
+ */
5817
+ deleteApiKey(keyId: string): Promise<void>;
5818
+ }
5819
+
5820
+ declare function useListApiKeys(): _tanstack_react_query.UseQueryResult<ApiKeyListItem[], Error>;
5821
+
5822
+ declare function useCreateApiKey(): _tanstack_react_query.UseMutationResult<CreateApiKeyResponse, Error, CreateApiKeyRequest, unknown>;
5823
+
5824
+ declare function useDeleteApiKey(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
5825
+
5826
+ declare function useUpdateApiKey(): _tanstack_react_query.UseMutationResult<void, Error, {
5827
+ keyId: string;
5828
+ name: string;
5829
+ }, unknown>;
5830
+
5831
+ /**
5832
+ * GET /api/credentials - List credentials
5833
+ */
5834
+ declare const ListCredentialsResponseSchema = z.object({
5835
+ credentials: z.array(
5836
+ z.object({
5837
+ id: UuidSchema,
5838
+ name: z.string(),
5839
+ type: z.string(),
5840
+ provider: z.string().nullable(), // OAuth provider or null for non-OAuth
5841
+ createdAt: z.string().datetime()
5842
+ })
5843
+ )
5844
+ })
5845
+
5846
+ /** API response type for a single credential list item */
5847
+ type CredentialListItem = z.infer<typeof ListCredentialsResponseSchema>['credentials'][number]
5848
+
5849
+ interface CreateCredentialRequest {
5850
+ name: string;
5851
+ type: string;
5852
+ value: Record<string, unknown>;
5853
+ }
5854
+ interface CreateCredentialResponse {
5855
+ id: string;
5856
+ name: string;
5857
+ type: string;
5858
+ }
5859
+ interface ListCredentialsResponse {
5860
+ credentials: CredentialListItem[];
5861
+ }
5862
+ type ApiRequest$2 = <T>(endpoint: string, options?: RequestInit) => Promise<T>;
5863
+ declare class CredentialService {
5864
+ private apiRequest;
5865
+ constructor(apiRequest: ApiRequest$2);
5866
+ /**
5867
+ * List credentials for the current organization
5868
+ * Organization context is provided via workos-organization-id header
5869
+ */
5870
+ listCredentials(): Promise<CredentialListItem[]>;
5871
+ /**
5872
+ * Create a new credential
5873
+ * Organization context is provided via workos-organization-id header
5874
+ */
5875
+ createCredential(data: CreateCredentialRequest): Promise<CreateCredentialResponse>;
5876
+ /**
5877
+ * Update a credential value or metadata
5878
+ * Organization context is provided via workos-organization-id header
5879
+ */
5880
+ updateCredential(credentialId: string, updates: {
5881
+ value?: Record<string, unknown>;
5882
+ name?: string;
5883
+ }): Promise<void>;
5884
+ /**
5885
+ * Delete a credential
5886
+ * Organization context is provided via workos-organization-id header
5887
+ */
5888
+ deleteCredential(credentialId: string): Promise<void>;
5889
+ }
5890
+
5891
+ declare function useCredentials(): _tanstack_react_query.UseQueryResult<{
5892
+ id: string;
5893
+ name: string;
5894
+ type: string;
5895
+ provider: string | null;
5896
+ createdAt: string;
5897
+ }[], Error>;
5898
+
5899
+ declare function useCreateCredential(): _tanstack_react_query.UseMutationResult<CreateCredentialResponse, Error, CreateCredentialRequest, unknown>;
5900
+
5901
+ declare function useDeleteCredential(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
5902
+
5903
+ interface UpdateCredentialParams {
5904
+ credentialId: string;
5905
+ updates: {
5906
+ value?: Record<string, unknown>;
5907
+ name?: string;
5908
+ };
5909
+ }
5910
+ declare function useUpdateCredential(): _tanstack_react_query.UseMutationResult<void, Error, UpdateCredentialParams, unknown>;
5911
+
5912
+ type ApiRequest$1 = <T>(endpoint: string, options?: RequestInit) => Promise<T>;
5913
+ declare class DeploymentService {
5914
+ private apiRequest;
5915
+ constructor(apiRequest: ApiRequest$1);
5916
+ listDeployments(): Promise<Deployment[]>;
5917
+ getDeployment(id: string): Promise<Deployment>;
5918
+ activateDeployment(id: string): Promise<Deployment>;
5919
+ deactivateDeployment(id: string): Promise<Deployment>;
5920
+ deleteDeployment(id: string): Promise<void>;
5921
+ }
5922
+
5923
+ declare function useListDeployments(): _tanstack_react_query.UseQueryResult<Deployment[], Error>;
5924
+
5925
+ declare function useActivateDeployment(): _tanstack_react_query.UseMutationResult<Deployment, Error, string, unknown>;
5926
+ declare function useDeactivateDeployment(): _tanstack_react_query.UseMutationResult<Deployment, Error, string, unknown>;
5927
+ declare function useDeleteDeployment(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
5928
+
5929
+ type ApiRequest = <T>(endpoint: string, options?: RequestInit) => Promise<T>;
5930
+ declare class OrganizationMembershipService {
5931
+ private apiRequest;
5932
+ constructor(apiRequest: ApiRequest);
5933
+ /**
5934
+ * Get user's organization memberships
5935
+ */
5936
+ getUserMemberships(userId: string): Promise<MembershipWithDetails[]>;
5937
+ /**
5938
+ * Get organization members
5939
+ */
5940
+ getOrganizationMembers(organizationId: string): Promise<MembershipWithDetails[]>;
5941
+ /**
5942
+ * List memberships with filtering
5943
+ */
5944
+ listMemberships(params?: ListMembershipsParams): Promise<ListMembershipsResponse>;
5945
+ /**
5946
+ * Get a single membership by ID
5947
+ */
5948
+ getMembership(membershipId: string): Promise<MembershipWithDetails>;
5949
+ /**
5950
+ * Create a new organization membership
5951
+ */
5952
+ createMembership(data: CreateMembershipRequest): Promise<MembershipWithDetails>;
5953
+ /**
5954
+ * Update an existing membership
5955
+ */
5956
+ updateMembership(membershipId: string, data: UpdateMembershipRequest): Promise<MembershipWithDetails>;
5957
+ /**
5958
+ * Delete a membership
5959
+ */
5960
+ deleteMembership(membershipId: string): Promise<void>;
5961
+ /**
5962
+ * Deactivate a membership (soft delete)
5963
+ */
5964
+ deactivateMembership(membershipId: string): Promise<MembershipWithDetails>;
5965
+ /**
5966
+ * Reactivate a membership
5967
+ */
5968
+ reactivateMembership(membershipId: string): Promise<MembershipWithDetails>;
5969
+ }
5970
+
5971
+ declare function useUserMemberships(userId: string, params?: Omit<ListMembershipsParams, 'userId'>): _tanstack_react_query.UseQueryResult<MembershipWithDetails[], Error>;
5972
+
5973
+ interface UpdateMemberConfigParams {
5974
+ membershipId: string;
5975
+ config: MembershipFeatureConfig;
5976
+ }
5977
+ declare function useUpdateMemberConfig(): _tanstack_react_query.UseMutationResult<unknown, Error, UpdateMemberConfigParams, unknown>;
5978
+
5979
+ interface DeactivateMembershipMutationData {
5980
+ membershipId: string;
5981
+ userId?: string;
5982
+ organizationId?: string;
5983
+ }
5984
+ declare function useDeactivateMembership(): _tanstack_react_query.UseMutationResult<MembershipWithDetails, Error, DeactivateMembershipMutationData, {
5985
+ previousData: unknown;
5986
+ }>;
5987
+
5988
+ interface ReactivateMembershipMutationData {
5989
+ membershipId: string;
5990
+ userId?: string;
5991
+ organizationId?: string;
5992
+ }
5993
+ declare function useReactivateMembership(): _tanstack_react_query.UseMutationResult<MembershipWithDetails, Error, ReactivateMembershipMutationData, {
5994
+ previousData: unknown;
5995
+ }>;
5996
+
5997
+ declare function useListWebhookEndpoints(): _tanstack_react_query.UseQueryResult<{
5998
+ id: string;
5999
+ organizationId: string;
6000
+ key: string;
6001
+ name: string;
6002
+ description: string | null;
6003
+ resourceId: string | null;
6004
+ status: "active" | "paused";
6005
+ lastTriggeredAt: string | null;
6006
+ requestCount: number;
6007
+ createdAt: string;
6008
+ updatedAt: string;
6009
+ }[], Error>;
6010
+
6011
+ declare function useCreateWebhookEndpoint(): _tanstack_react_query.UseMutationResult<{
6012
+ id: string;
6013
+ organizationId: string;
6014
+ key: string;
6015
+ name: string;
6016
+ description: string | null;
6017
+ resourceId: string | null;
6018
+ status: "active" | "paused";
6019
+ lastTriggeredAt: string | null;
6020
+ requestCount: number;
6021
+ createdAt: string;
6022
+ updatedAt: string;
6023
+ }, Error, {
6024
+ name: string;
6025
+ resourceId?: string | undefined;
6026
+ description?: string | undefined;
6027
+ }, unknown>;
6028
+
6029
+ declare function useDeleteWebhookEndpoint(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
6030
+
6031
+ /**
6032
+ * POST /api/webhook-endpoints - Create a new webhook endpoint
6033
+ *
6034
+ * The `key` and `id` are generated server-side and not accepted in the request.
6035
+ */
6036
+ declare const CreateWebhookEndpointRequestSchema = z
6037
+ .object({
6038
+ /** User-facing label for the endpoint */
6039
+ name: NonEmptyStringSchema,
6040
+ /** Target workflow resourceId to invoke on inbound requests (can be set later) */
6041
+ resourceId: NonEmptyStringSchema.optional(),
6042
+ /** Optional description */
6043
+ description: z.string().optional()
6044
+ })
6045
+ .strict()
6046
+
6047
+ type CreateWebhookEndpointRequest = z.infer<typeof CreateWebhookEndpointRequestSchema>
6048
+
6049
+ /**
6050
+ * PATCH /api/webhook-endpoints/:id - Update an existing webhook endpoint
6051
+ *
6052
+ * At least one field must be provided.
6053
+ */
6054
+ declare const UpdateWebhookEndpointRequestSchema = z
6055
+ .object({
6056
+ name: NonEmptyStringSchema.optional(),
6057
+ description: z.string().optional(),
6058
+ resourceId: NonEmptyStringSchema.optional(),
6059
+ status: WebhookEndpointStatusSchema.optional()
6060
+ })
6061
+ .strict()
6062
+ .refine(
6063
+ (data) =>
6064
+ data.name !== undefined ||
6065
+ data.description !== undefined ||
6066
+ data.resourceId !== undefined ||
6067
+ data.status !== undefined,
6068
+ { message: 'At least one field (name, description, resourceId, or status) must be provided' }
6069
+ )
6070
+
6071
+ type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestSchema>
6072
+
6073
+ /**
6074
+ * Response shape for a single webhook endpoint.
6075
+ * NOT strict — response schemas allow extra fields for forward compatibility.
6076
+ */
6077
+ declare const WebhookEndpointResponseSchema = z.object({
6078
+ id: UuidSchema,
6079
+ organizationId: UuidSchema,
6080
+ key: z.string(),
6081
+ name: z.string(),
6082
+ description: z.string().nullable(),
6083
+ resourceId: z.string().nullable(),
6084
+ status: WebhookEndpointStatusSchema,
6085
+ lastTriggeredAt: z.string().datetime().nullable(),
6086
+ requestCount: z.number().int().min(0),
6087
+ createdAt: z.string().datetime(),
6088
+ updatedAt: z.string().datetime()
6089
+ })
6090
+
6091
+ type WebhookEndpointResponse = z.infer<typeof WebhookEndpointResponseSchema>
6092
+
6093
+ declare function useUpdateWebhookEndpoint(): _tanstack_react_query.UseMutationResult<{
6094
+ id: string;
6095
+ organizationId: string;
6096
+ key: string;
6097
+ name: string;
6098
+ description: string | null;
6099
+ resourceId: string | null;
6100
+ status: "active" | "paused";
6101
+ lastTriggeredAt: string | null;
6102
+ requestCount: number;
6103
+ createdAt: string;
6104
+ updatedAt: string;
6105
+ }, Error, {
6106
+ endpointId: string;
6107
+ data: UpdateWebhookEndpointRequest;
6108
+ }, unknown>;
6109
+
6110
+ /**
6111
+ * Service context value exposed by ElevasisServiceProvider.
6112
+ * Provides a ready-to-use apiRequest function and organization state.
6113
+ *
6114
+ * For standalone usage (testing, embedding), use ElevasisServiceProvider directly.
6115
+ * For standard SDK usage, ElevasisProvider composes this automatically when apiUrl is provided.
6116
+ */
6117
+ interface ElevasisServiceContextValue {
6118
+ apiRequest: <T>(endpoint: string, options?: RequestInit) => Promise<T>;
6119
+ organizationId: string | null;
6120
+ isReady: boolean;
6121
+ }
6122
+
6123
+ /**
6124
+ * Hook to access the ElevasisServiceProvider context.
6125
+ * Provides apiRequest, organizationId, and isReady.
6126
+ *
6127
+ * Throws if used outside of an ElevasisServiceProvider or ElevasisProvider (with apiUrl).
6128
+ */
6129
+ declare function useElevasisServices(): ElevasisServiceContextValue;
6130
+
6131
+ interface ListWebhookEndpointsResponse {
6132
+ data: WebhookEndpointResponse[];
6133
+ count: number;
6134
+ }
6135
+ declare class WebhookEndpointService {
6136
+ private apiRequest;
6137
+ constructor(apiRequest: ReturnType<typeof useElevasisServices>['apiRequest']);
6138
+ /**
6139
+ * List webhook endpoints for the current organization
6140
+ */
6141
+ listEndpoints(): Promise<WebhookEndpointResponse[]>;
6142
+ /**
6143
+ * Create a new webhook endpoint
6144
+ */
6145
+ createEndpoint(data: CreateWebhookEndpointRequest): Promise<WebhookEndpointResponse>;
6146
+ /**
6147
+ * Update an existing webhook endpoint (e.g., toggle status, rename)
6148
+ */
6149
+ updateEndpoint(endpointId: string, data: UpdateWebhookEndpointRequest): Promise<WebhookEndpointResponse>;
6150
+ /**
6151
+ * Delete a webhook endpoint
6152
+ */
6153
+ deleteEndpoint(endpointId: string): Promise<void>;
6154
+ }
6155
+
6156
+ /**
6157
+ * Query key factories for Operations TanStack Query hooks.
6158
+ *
6159
+ * Execution-related keys (executions, resources, definitions) use executionsKeys from @repo/ui.
6160
+ * Non-execution keys (workflows, agents, sessions) stay local in operationsKeys.
6161
+ */
6162
+
6163
+ declare const operationsKeys: {
6164
+ all: readonly ["operations"];
6165
+ workflows: (org?: string) => readonly ["operations", "workflows", string | undefined];
6166
+ workflowDetails: (org?: string) => readonly ["operations", "workflows", string | undefined, "details"];
6167
+ workflow: (id: string, org?: string) => readonly ["operations", "workflows", string | undefined, string];
6168
+ agents: (org?: string) => readonly ["operations", "agents", string | undefined];
6169
+ agentDetails: (org?: string) => readonly ["operations", "agents", string | undefined, "details"];
6170
+ agent: (id: string, org?: string) => readonly ["operations", "agents", string | undefined, string];
6171
+ sessions: (org: string, params?: {
6172
+ resourceId?: string;
6173
+ }) => readonly ["operations", "sessions", string, {
6174
+ resourceId?: string;
6175
+ } | undefined];
6176
+ session: (org: string, sessionId: string) => readonly ["operations", "session", string, string];
6177
+ };
6178
+
6179
+ declare function useExecutionLogSSE(resourceId: string, manager: SSEConnectionManager): {
6180
+ liveExecutions: Set<string>;
6181
+ connected: boolean;
6182
+ error: string | null;
6183
+ runningCount: number;
6184
+ isLive: (executionId: string) => boolean;
6185
+ streamingLogs: Map<string, ExecutionLogMessage$1[]>;
6186
+ };
6187
+
6188
+ interface UseExecutionPanelStateOptions {
6189
+ resourceId: string;
6190
+ manager: SSEConnectionManager;
6191
+ limit?: number;
6192
+ onConnectionStatus?: (connected: boolean, runningCount: number) => void;
6193
+ }
6194
+ interface UseExecutionPanelStateReturn {
6195
+ executions: APIExecutionSummary$1[];
6196
+ isLoading: boolean;
6197
+ isFetched: boolean;
6198
+ selectedId: string | undefined;
6199
+ setSelectedId: (id: string | undefined) => void;
6200
+ resourceStatusFilter: ResourceStatus$1 | 'all';
6201
+ setResourceStatusFilter: (filter: ResourceStatus$1 | 'all') => void;
6202
+ liveExecutions: Set<string>;
6203
+ connected: boolean;
6204
+ runningCount: number;
6205
+ streamingLogs: Map<string, ExecutionLogMessage$1[]>;
6206
+ }
6207
+ /**
6208
+ * Shared execution panel state management hook
6209
+ * Handles execution list fetching, selection, auto-selection logic, and SSE integration
6210
+ *
6211
+ * @param options - Hook configuration options
6212
+ * @returns Execution panel state and controls
6213
+ *
6214
+ * @example
6215
+ * ```tsx
6216
+ * const {
6217
+ * executions,
6218
+ * selectedId,
6219
+ * setSelectedId,
6220
+ * liveExecutions,
6221
+ * connected
6222
+ * } = useExecutionPanelState({ resourceId, manager, onConnectionStatus })
6223
+ * ```
6224
+ */
6225
+ declare function useExecutionPanelState({ resourceId, manager, limit, onConnectionStatus }: UseExecutionPanelStateOptions): UseExecutionPanelStateReturn;
6226
+
6227
+ /**
6228
+ * Utilities for extracting typed properties from resource definitions
6229
+ */
6230
+
6231
+ /**
6232
+ * Extract sessionCapable from agent definition config
6233
+ * Returns true only for agents with explicit sessionCapable: true
6234
+ */
6235
+ declare function isSessionCapable(type: ResourceType$1, resourceDefinition: AIResourceDefinition | undefined): boolean;
6236
+
6237
+ interface DocFile {
6238
+ path: string;
6239
+ frontmatter: {
6240
+ title: string;
6241
+ order?: number;
6242
+ [key: string]: unknown;
6243
+ };
6244
+ compiledSource: string;
6245
+ }
6246
+ /**
6247
+ * Fetches deployment documentation for the current organization.
6248
+ *
6249
+ * 1. Fetches all deployments via GET /api/deployments
6250
+ * 2. Auto-selects the latest active deployment (most recent by createdAt)
6251
+ * 3. Fetches docs for the selected deployment via GET /api/deployments/:id/docs
6252
+ *
6253
+ * @returns { files, isLoading, error, activeDeployment, activeDeployments }
6254
+ */
6255
+ declare function useDeploymentDocs(selectedDeploymentId?: string): {
6256
+ files: DocFile[];
6257
+ isLoading: boolean;
6258
+ error: Error | null;
6259
+ activeDeployment: Deployment;
6260
+ activeDeployments: Deployment[];
6261
+ };
6262
+
6263
+ /**
6264
+ * Fetches Command View data for the current organization
6265
+ *
6266
+ * Uses pre-serialized data from the backend for instant responses.
6267
+ * Data includes workflows, agents, triggers, integrations, and relationship edges.
6268
+ *
6269
+ * @returns TanStack Query result with CommandViewData
6270
+ */
6271
+ declare function useCommandViewData(): _tanstack_react_query.UseQueryResult<CommandViewData, Error>;
6272
+
6273
+ /**
6274
+ * Fetches Command View stats for the current organization
6275
+ *
6276
+ * Returns execution statistics (counts only, no error details) for all resources
6277
+ * within the specified time range. Error details are fetched on-demand via useResourceErrors.
6278
+ *
6279
+ * @param timeRange - Time range for stats aggregation ('24h' or '7d')
6280
+ * @returns TanStack Query result with CommandViewStatsResponse
6281
+ */
6282
+ declare function useCommandViewStats(timeRange?: StatsTimeRange): _tanstack_react_query.UseQueryResult<CommandViewStatsResponse, Error>;
6283
+
6284
+ /**
6285
+ * Command View Types
6286
+ *
6287
+ * Frontend graph types for React Flow rendering.
6288
+ *
6289
+ * Backend API returns CommandViewData with separate arrays (workflows[], agents[], etc.)
6290
+ * Frontend transforms this to CommandViewGraph with unified nodes[] array.
6291
+ *
6292
+ * @see transformCommandViewData for the mapping logic
6293
+ * @see CommandViewData from @repo/core for backend type
6294
+ */
6295
+
6296
+ /**
6297
+ * Base resource node - common fields for all resources
6298
+ */
6299
+ interface BaseResourceNode {
6300
+ id: string;
6301
+ name: string;
6302
+ description: string;
6303
+ status: ResourceStatus$1;
6304
+ stats?: {
6305
+ totalRuns: number;
6306
+ successCount: number;
6307
+ failureCount: number;
6308
+ warningCount: number;
6309
+ lastRunAt: string | null;
6310
+ } | null;
6311
+ }
6312
+ /**
6313
+ * Agent node - autonomous AI agents
6314
+ */
6315
+ interface AgentNode extends BaseResourceNode {
6316
+ type: 'agent';
6317
+ modelProvider: string;
6318
+ modelId: string;
6319
+ toolCount: number;
6320
+ hasKnowledgeMap: boolean;
6321
+ hasMemory: boolean;
6322
+ }
6323
+ /**
6324
+ * Workflow node - multi-step orchestrations
6325
+ */
6326
+ interface WorkflowNode extends BaseResourceNode {
6327
+ type: 'workflow';
6328
+ stepCount: number;
6329
+ entryPoint: string;
6330
+ }
6331
+ /**
6332
+ * Integration node - external service connections
6333
+ */
6334
+ interface IntegrationNode extends BaseResourceNode {
6335
+ type: 'integration';
6336
+ provider: string;
6337
+ connectionStatus: 'connected' | 'disconnected' | 'error';
6338
+ credentialName?: string;
6339
+ }
6340
+ /**
6341
+ * Trigger node - what initiates executions
6342
+ */
6343
+ interface TriggerNode extends BaseResourceNode {
6344
+ type: 'trigger';
6345
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
6346
+ schedule?: string;
6347
+ webhookPath?: string;
6348
+ }
6349
+ /**
6350
+ * External resource node - third-party automation platforms
6351
+ */
6352
+ interface ExternalResourceNode extends BaseResourceNode {
6353
+ type: 'external';
6354
+ platform: 'n8n' | 'make' | 'zapier' | 'other';
6355
+ platformUrl?: string;
6356
+ externalId?: string;
6357
+ }
6358
+ /**
6359
+ * Human node - approval points requiring human decisions
6360
+ */
6361
+ interface HumanNode extends Omit<BaseResourceNode, 'stats'> {
6362
+ type: 'human';
6363
+ stats?: {
6364
+ pendingCount: number;
6365
+ completedCount: number;
6366
+ expiredCount: number;
6367
+ lastDecisionAt: string | null;
6368
+ } | null;
6369
+ }
6370
+ /**
6371
+ * Union type for all node types
6372
+ */
6373
+ type CommandViewNode = AgentNode | WorkflowNode | IntegrationNode | TriggerNode | ExternalResourceNode | HumanNode;
6374
+ /**
6375
+ * Relationship types between resources
6376
+ */
6377
+ type RelationshipType = 'triggers' | 'uses' | 'approval';
6378
+ /**
6379
+ * Edge representing a relationship
6380
+ */
6381
+ interface CommandViewEdge {
6382
+ id: string;
6383
+ source: string;
6384
+ target: string;
6385
+ relationship: RelationshipType;
6386
+ label?: string;
6387
+ }
6388
+ /**
6389
+ * Complete graph data for visualization
6390
+ */
6391
+ interface CommandViewGraph {
6392
+ nodes: CommandViewNode[];
6393
+ edges: CommandViewEdge[];
6394
+ }
6395
+
6396
+ type StatusFilter = ResourceStatus$1 | 'all';
6397
+
6398
+ interface CommandViewStore {
6399
+ statusFilter: StatusFilter;
6400
+ setStatusFilter: (v: StatusFilter) => void;
6401
+ showIntegrations: boolean;
6402
+ setShowIntegrations: (v: boolean) => void;
6403
+ fitViewOnFilter: boolean;
6404
+ setFitViewOnFilter: (v: boolean) => void;
6405
+ selectedNodeId: string | null;
6406
+ setSelectedNodeId: (id: string | null) => void;
6407
+ }
6408
+ /**
6409
+ * Shared store for Command View filter/settings state.
6410
+ * Allows CommandViewPage (graph) and CommandViewSidebarContent (sidebar) to share state.
6411
+ *
6412
+ * Persisted to localStorage: showIntegrations, fitViewOnFilter
6413
+ * Not persisted (reset on reload): statusFilter, selectedNodeId
6414
+ */
6415
+ declare const useCommandViewStore: zustand.UseBoundStore<Omit<zustand.StoreApi<CommandViewStore>, "setState" | "persist"> & {
6416
+ setState(partial: CommandViewStore | Partial<CommandViewStore> | ((state: CommandViewStore) => CommandViewStore | Partial<CommandViewStore>), replace?: false | undefined): unknown;
6417
+ setState(state: CommandViewStore | ((state: CommandViewStore) => CommandViewStore), replace: true): unknown;
6418
+ persist: {
6419
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<CommandViewStore, {
6420
+ showIntegrations: boolean;
6421
+ fitViewOnFilter: boolean;
6422
+ }, unknown>>) => void;
6423
+ clearStorage: () => void;
6424
+ rehydrate: () => Promise<void> | void;
6425
+ hasHydrated: () => boolean;
6426
+ onHydrate: (fn: (state: CommandViewStore) => void) => () => void;
6427
+ onFinishHydration: (fn: (state: CommandViewStore) => void) => () => void;
6428
+ getOptions: () => Partial<zustand_middleware.PersistOptions<CommandViewStore, {
6429
+ showIntegrations: boolean;
6430
+ fitViewOnFilter: boolean;
6431
+ }, unknown>>;
6432
+ };
6433
+ }>;
6434
+
6435
+ /**
6436
+ * useCommandViewLayout - Hook to convert CommandViewGraph to ReactFlow nodes/edges
6437
+ *
6438
+ * Uses Dagre for automatic graph layout:
6439
+ * - Left-to-right flow (LR)
6440
+ * - Minimizes edge crossings
6441
+ * - Keeps connected nodes closer together
6442
+ *
6443
+ * Post-processes Dagre output to sort workflow chains by their minimum name prefix
6444
+ * (e.g., INB-01 chain above INB-02 chain, above INB-04 chain). Uses Union-Find
6445
+ * to identify connected components based on 'triggers' and 'approval' edges
6446
+ * (not 'uses' edges, which would connect everything through shared integrations).
6447
+ */
6448
+
6449
+ /**
6450
+ * Convert CommandViewGraph to ReactFlow nodes and edges with Dagre layout
6451
+ */
6452
+ declare function useCommandViewLayout(graph: CommandViewGraph): {
6453
+ nodes: {
6454
+ id: string;
6455
+ type: string;
6456
+ position: {
6457
+ x: number;
6458
+ y: number;
6459
+ };
6460
+ data: Record<string, unknown>;
6461
+ }[];
6462
+ edges: Edge[];
6463
+ };
6464
+ /**
6465
+ * Get graph statistics
6466
+ */
6467
+ declare function useGraphStats(graph: CommandViewGraph): {
6468
+ agents: number;
6469
+ workflows: number;
6470
+ integrations: number;
6471
+ triggers: number;
6472
+ prodResources: number;
6473
+ devResources: number;
6474
+ connectedIntegrations: number;
6475
+ errorIntegrations: number;
6476
+ };
6477
+
6478
+ interface UseCheckpointTasksOptions {
6479
+ checkpointId: string | null;
6480
+ enabled?: boolean;
6481
+ }
6482
+ interface CheckpointTasksResponse {
6483
+ tasks: Task[];
6484
+ }
6485
+ /**
6486
+ * Fetches pending tasks for a specific human checkpoint (on-demand)
6487
+ *
6488
+ * Only fetches when:
6489
+ * - Organization is ready
6490
+ * - Checkpoint is selected
6491
+ * - enabled is true (default: true when checkpointId is set)
6492
+ *
6493
+ * Returns top 10 pending tasks ordered by priority and creation date
6494
+ *
6495
+ * @param options - Checkpoint ID and enabled flag
6496
+ * @returns TanStack Query result with pending tasks
6497
+ */
6498
+ declare function useCheckpointTasks({ checkpointId, enabled }: UseCheckpointTasksOptions): _tanstack_react_query.UseQueryResult<CheckpointTasksResponse, Error>;
6499
+
6500
+ interface UseResourceErrorsOptions {
6501
+ resourceId: string | null;
6502
+ timeRange: StatsTimeRange;
6503
+ hasFailures: boolean;
6504
+ }
6505
+ /**
6506
+ * Fetches error details for a specific resource (on-demand)
6507
+ *
6508
+ * Only fetches when:
6509
+ * - Organization is ready
6510
+ * - Resource is selected
6511
+ * - Resource has failures (lazy loading pattern)
6512
+ *
6513
+ * Returns top 10 errors + total count for "showing X of Y" display
6514
+ *
6515
+ * @param options - Resource ID, time range, and failure flag
6516
+ * @returns TanStack Query result with ResourceErrorsResponse
6517
+ */
6518
+ declare function useResourceErrors({ resourceId, timeRange, hasFailures }: UseResourceErrorsOptions): _tanstack_react_query.UseQueryResult<ResourceErrorsResponse, Error>;
6519
+
6520
+ interface UseResourceExecutionsOptions {
6521
+ resourceId: string | null;
6522
+ timeRange: StatsTimeRange;
6523
+ enabled?: boolean;
6524
+ }
6525
+ /**
6526
+ * Fetches recent executions for a specific resource (on-demand)
6527
+ *
6528
+ * Only fetches when:
6529
+ * - Organization is ready
6530
+ * - Resource is selected
6531
+ * - enabled is true (default: true when resourceId is set)
6532
+ *
6533
+ * Returns top 10 executions + total count for "showing X of Y" display
6534
+ *
6535
+ * @param options - Resource ID, time range, and enabled flag
6536
+ * @returns TanStack Query result with ResourceExecutionsResponse
6537
+ */
6538
+ declare function useResourceExecutions({ resourceId, timeRange, enabled }: UseResourceExecutionsOptions): _tanstack_react_query.UseQueryResult<ResourceExecutionsResponse, Error>;
6539
+
6540
+ export { ApiKeyService, CredentialService, DeploymentService, OperationsService, OrganizationMembershipService, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, WebhookEndpointService, createUseFeatureAccess, executionsKeys, filterByDomainFilters, isSessionCapable, observabilityKeys, operationsKeys, scheduleKeys, sessionsKeys, sortData, useActivateDeployment, useActivities, useActivityFilters, useActivityTrend, useArchiveSession, useBatchDelete, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateCredential, useCreateSchedule, useCreateSession, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDeleteApiKey, useDeleteCredential, useDeleteDeployment, useDeleteExecution, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeleteWebhookEndpoint, useDeploymentDocs, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGraphStats, useListApiKeys, useListDeployments, useListSchedules, useListWebhookEndpoints, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, useOrganizationMembers, usePaginationState, usePatchTask, usePauseSchedule, useReactivateMembership, useRecentExecutionsByResource, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTestNotification, useTimeRangeDates, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCredential, useUpdateMemberConfig, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
6541
+ export type { ActivityFilters, ActivityTrendResponse, BulkDeleteExecutionsParams, BulkDeleteExecutionsResult, BusinessImpactMetrics, CancelExecutionParams, CancelExecutionResult, ChatMessage, CostBreakdownItem, CreateApiKeyRequest, CreateApiKeyResponse, CreateCredentialRequest, CreateCredentialResponse, CreateScheduleInput, CreateSessionResponse, CredentialListItem, DeleteExecutionParams, Deployment, DocFile, ErrorDistributionItem, ErrorDistributionParams, ErrorFilters, ErrorTrendsParams, ExecuteAsyncParams, ExecuteAsyncResult, ExecutionErrorDetails, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogsFilters, ExecutionLogsPageResponse, FailingResource, GetMessagesResponse, ListActivitiesResponse, ListApiKeysResponse, ListCredentialsResponse, ListSchedulesFilters, ListSchedulesResponse, ListWebhookEndpointsResponse, MessageEvent, MessageType, ResourcesResponse, RetryExecutionParams, SessionDTO, SessionExecution, SessionExecutionsResponse, SessionListItem, SessionTokenUsage, SortDirection, SortState, StatusFilter$1 as StatusFilter, SubmitActionRequest, SubmitActionResponse, TaskSchedule, TopFailingResourcesParams, UpdateScheduleInput, UseActivitiesParams, UseActivityTrendParams, UseBatchedResourcesHealthParams, UseExecutionHealthParams, UseExecutionLogsParams, UseExecutionPanelStateOptions, UseExecutionPanelStateReturn, UseResourcesHealthParams, UseSSEConnectionOptions, UseScheduledTasksOptions, WebSocketState };