@elevasis/ui 1.3.1 → 1.3.2

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 (261) hide show
  1. package/dist/api/index.js +1 -1
  2. package/dist/auth/guards/AdminGuard.d.ts +32 -0
  3. package/dist/auth/guards/AdminGuard.d.ts.map +1 -0
  4. package/dist/auth/guards/ProtectedRoute.d.ts +60 -0
  5. package/dist/auth/guards/ProtectedRoute.d.ts.map +1 -0
  6. package/dist/auth/guards/__tests__/AdminGuard.test.d.ts +12 -0
  7. package/dist/auth/guards/__tests__/AdminGuard.test.d.ts.map +1 -0
  8. package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts +14 -0
  9. package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts.map +1 -0
  10. package/dist/auth/index.d.ts +14 -174
  11. package/dist/auth/index.d.ts.map +1 -0
  12. package/dist/auth/index.js +1 -1
  13. package/dist/{chunk-A3MCANC6.js → chunk-6IX5JZEH.js} +110 -50
  14. package/dist/chunk-GIFAF5ZS.js +313 -0
  15. package/dist/chunk-JQLT6HBI.js +850 -0
  16. package/dist/chunk-LFYO3MDC.js +58 -0
  17. package/dist/{chunk-72HOBFMP.js → chunk-LTQAAIGE.js} +3 -3
  18. package/dist/{chunk-JBFFCZI4.js → chunk-U34YGJQB.js} +1 -93
  19. package/dist/components/index.d.ts +1 -1353
  20. package/dist/components/index.js +1 -20
  21. package/dist/components/navigation/index.d.ts +2 -32
  22. package/dist/components/navigation/index.js +1 -29
  23. package/dist/execution/index.d.ts +63 -231
  24. package/dist/execution/index.js +1 -4
  25. package/dist/graph/index.css +0 -1
  26. package/dist/graph/index.d.ts +4 -203
  27. package/dist/graph/index.js +1 -1
  28. package/dist/hooks/command-queue/index.d.ts +7 -0
  29. package/dist/hooks/command-queue/index.d.ts.map +1 -0
  30. package/dist/hooks/command-queue/useCommandQueue.d.ts +33 -0
  31. package/dist/hooks/command-queue/useCommandQueue.d.ts.map +1 -0
  32. package/dist/hooks/command-queue/useCommandQueueTotals.d.ts +17 -0
  33. package/dist/hooks/command-queue/useCommandQueueTotals.d.ts.map +1 -0
  34. package/dist/hooks/command-queue/useDeleteTask.d.ts +5 -0
  35. package/dist/hooks/command-queue/useDeleteTask.d.ts.map +1 -0
  36. package/dist/hooks/command-queue/usePatchTask.d.ts +6 -0
  37. package/dist/hooks/command-queue/usePatchTask.d.ts.map +1 -0
  38. package/dist/hooks/command-queue/useSubmitAction.d.ts +29 -0
  39. package/dist/hooks/command-queue/useSubmitAction.d.ts.map +1 -0
  40. package/dist/hooks/executions/index.d.ts +16 -0
  41. package/dist/hooks/executions/index.d.ts.map +1 -0
  42. package/dist/hooks/executions/useBulkDeleteExecutions.d.ts +15 -0
  43. package/dist/hooks/executions/useBulkDeleteExecutions.d.ts.map +1 -0
  44. package/dist/hooks/executions/useCancelExecution.d.ts +20 -0
  45. package/dist/hooks/executions/useCancelExecution.d.ts.map +1 -0
  46. package/dist/hooks/executions/useDeleteExecution.d.ts +13 -0
  47. package/dist/hooks/executions/useDeleteExecution.d.ts.map +1 -0
  48. package/dist/hooks/executions/useExecuteAsync.d.ts +21 -0
  49. package/dist/hooks/executions/useExecuteAsync.d.ts.map +1 -0
  50. package/dist/hooks/executions/useExecution.d.ts +10 -0
  51. package/dist/hooks/executions/useExecution.d.ts.map +1 -0
  52. package/dist/hooks/executions/useExecutions.d.ts +16 -0
  53. package/dist/hooks/executions/useExecutions.d.ts.map +1 -0
  54. package/dist/hooks/executions/useResourceDefinition.d.ts +9 -0
  55. package/dist/hooks/executions/useResourceDefinition.d.ts.map +1 -0
  56. package/dist/hooks/executions/useResources.d.ts +15 -0
  57. package/dist/hooks/executions/useResources.d.ts.map +1 -0
  58. package/dist/hooks/executions/useRetryExecution.d.ts +16 -0
  59. package/dist/hooks/executions/useRetryExecution.d.ts.map +1 -0
  60. package/dist/hooks/feature-access/createUseFeatureAccess.d.ts +44 -0
  61. package/dist/hooks/feature-access/createUseFeatureAccess.d.ts.map +1 -0
  62. package/dist/hooks/feature-access/index.d.ts +2 -0
  63. package/dist/hooks/feature-access/index.d.ts.map +1 -0
  64. package/dist/hooks/index.d.ts +11 -4554
  65. package/dist/hooks/index.d.ts.map +1 -0
  66. package/dist/hooks/index.js +2 -4
  67. package/dist/hooks/monitoring/index.d.ts +9 -0
  68. package/dist/hooks/monitoring/index.d.ts.map +1 -0
  69. package/dist/hooks/monitoring/useActivities.d.ts +52 -0
  70. package/dist/hooks/monitoring/useActivities.d.ts.map +1 -0
  71. package/dist/hooks/monitoring/useCostSummary.d.ts +7 -0
  72. package/dist/hooks/monitoring/useCostSummary.d.ts.map +1 -0
  73. package/dist/hooks/monitoring/useExecutionHealth.d.ts +10 -0
  74. package/dist/hooks/monitoring/useExecutionHealth.d.ts.map +1 -0
  75. package/dist/hooks/monitoring/useExecutionLogs.d.ts +56 -0
  76. package/dist/hooks/monitoring/useExecutionLogs.d.ts.map +1 -0
  77. package/dist/hooks/monitoring/useNotifications.d.ts +11 -0
  78. package/dist/hooks/monitoring/useNotifications.d.ts.map +1 -0
  79. package/dist/hooks/notifications/index.d.ts +8 -0
  80. package/dist/hooks/notifications/index.d.ts.map +1 -0
  81. package/dist/hooks/notifications/useMarkAllAsRead.d.ts +2 -0
  82. package/dist/hooks/notifications/useMarkAllAsRead.d.ts.map +1 -0
  83. package/dist/hooks/notifications/useMarkAsRead.d.ts +2 -0
  84. package/dist/hooks/notifications/useMarkAsRead.d.ts.map +1 -0
  85. package/dist/hooks/notifications/useNotificationCount.d.ts +8 -0
  86. package/dist/hooks/notifications/useNotificationCount.d.ts.map +1 -0
  87. package/dist/hooks/observability/index.d.ts +19 -0
  88. package/dist/hooks/observability/index.d.ts.map +1 -0
  89. package/dist/hooks/observability/useBusinessImpact.d.ts +9 -0
  90. package/dist/hooks/observability/useBusinessImpact.d.ts.map +1 -0
  91. package/dist/hooks/observability/useCostBreakdown.d.ts +10 -0
  92. package/dist/hooks/observability/useCostBreakdown.d.ts.map +1 -0
  93. package/dist/hooks/observability/useCostByModel.d.ts +3 -0
  94. package/dist/hooks/observability/useCostByModel.d.ts.map +1 -0
  95. package/dist/hooks/observability/useCostTrends.d.ts +3 -0
  96. package/dist/hooks/observability/useCostTrends.d.ts.map +1 -0
  97. package/dist/hooks/observability/useDashboardMetrics.d.ts +3 -0
  98. package/dist/hooks/observability/useDashboardMetrics.d.ts.map +1 -0
  99. package/dist/hooks/observability/useErrorAnalysis.d.ts +7 -0
  100. package/dist/hooks/observability/useErrorAnalysis.d.ts.map +1 -0
  101. package/dist/hooks/observability/useErrorDetails.d.ts +20 -0
  102. package/dist/hooks/observability/useErrorDetails.d.ts.map +1 -0
  103. package/dist/hooks/observability/useErrorDistribution.d.ts +12 -0
  104. package/dist/hooks/observability/useErrorDistribution.d.ts.map +1 -0
  105. package/dist/hooks/observability/useErrorTrends.d.ts +12 -0
  106. package/dist/hooks/observability/useErrorTrends.d.ts.map +1 -0
  107. package/dist/hooks/observability/useResolveError.d.ts +17 -0
  108. package/dist/hooks/observability/useResolveError.d.ts.map +1 -0
  109. package/dist/hooks/observability/useTopFailingResources.d.ts +13 -0
  110. package/dist/hooks/observability/useTopFailingResources.d.ts.map +1 -0
  111. package/dist/hooks/published.d.ts +19 -4279
  112. package/dist/hooks/published.d.ts.map +1 -0
  113. package/dist/hooks/published.js +367 -4
  114. package/dist/hooks/scheduling/index.d.ts +5 -0
  115. package/dist/hooks/scheduling/index.d.ts.map +1 -0
  116. package/dist/hooks/scheduling/useSchedules.d.ts +185 -0
  117. package/dist/hooks/scheduling/useSchedules.d.ts.map +1 -0
  118. package/dist/hooks/sessions/index.d.ts +8 -0
  119. package/dist/hooks/sessions/index.d.ts.map +1 -0
  120. package/dist/hooks/sessions/useSessionExecutions.d.ts +13 -0
  121. package/dist/hooks/sessions/useSessionExecutions.d.ts.map +1 -0
  122. package/dist/hooks/sessions/useSessionMessages.d.ts +7 -0
  123. package/dist/hooks/sessions/useSessionMessages.d.ts.map +1 -0
  124. package/dist/hooks/sessions/useSessions.d.ts +26 -0
  125. package/dist/hooks/sessions/useSessions.d.ts.map +1 -0
  126. package/dist/index.css +0 -118
  127. package/dist/index.d.ts +15 -7889
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +1119 -24
  130. package/dist/initialization/InitializationProvider.d.ts +48 -0
  131. package/dist/initialization/InitializationProvider.d.ts.map +1 -0
  132. package/dist/initialization/hooks/useAppInitialization.d.ts +32 -0
  133. package/dist/initialization/hooks/useAppInitialization.d.ts.map +1 -0
  134. package/dist/initialization/index.d.ts +22 -2361
  135. package/dist/initialization/index.d.ts.map +1 -0
  136. package/dist/initialization/index.js +1 -1
  137. package/dist/organization/context/OrganizationProvider.d.ts +20 -0
  138. package/dist/organization/context/OrganizationProvider.d.ts.map +1 -0
  139. package/dist/organization/hooks/useOrgInitialization.d.ts +56 -0
  140. package/dist/organization/hooks/useOrgInitialization.d.ts.map +1 -0
  141. package/dist/organization/index.d.ts +21 -283
  142. package/dist/organization/index.d.ts.map +1 -0
  143. package/dist/organization/index.js +3 -3
  144. package/dist/profile/context/ProfileProvider.d.ts +27 -0
  145. package/dist/profile/context/ProfileProvider.d.ts.map +1 -0
  146. package/dist/profile/hooks/useUserProfile.d.ts +31 -0
  147. package/dist/profile/hooks/useUserProfile.d.ts.map +1 -0
  148. package/dist/profile/index.d.ts +14 -2290
  149. package/dist/profile/index.d.ts.map +1 -0
  150. package/dist/provider/CoreAuthKitInner.d.ts +12 -0
  151. package/dist/provider/CoreAuthKitInner.d.ts.map +1 -0
  152. package/dist/provider/ElevasisCoreProvider.d.ts +39 -0
  153. package/dist/provider/ElevasisCoreProvider.d.ts.map +1 -0
  154. package/dist/provider/ElevasisServiceContext.d.ts +31 -0
  155. package/dist/provider/ElevasisServiceContext.d.ts.map +1 -0
  156. package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts +2 -0
  157. package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts.map +1 -0
  158. package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts +2 -0
  159. package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts.map +1 -0
  160. package/dist/provider/index.d.ts +7 -372
  161. package/dist/provider/index.d.ts.map +1 -0
  162. package/dist/provider/index.js +6 -6
  163. package/dist/provider/published.d.ts +9 -263
  164. package/dist/provider/published.d.ts.map +1 -0
  165. package/dist/provider/published.js +5 -5
  166. package/dist/provider/types.d.ts +190 -0
  167. package/dist/provider/types.d.ts.map +1 -0
  168. package/dist/sdk-barrel.d.ts +20 -0
  169. package/dist/sdk-barrel.d.ts.map +1 -0
  170. package/dist/supabase/index.d.ts +0 -255
  171. package/dist/theme/cssVariables.d.ts +12 -0
  172. package/dist/theme/cssVariables.d.ts.map +1 -0
  173. package/dist/theme/index.d.ts +4 -0
  174. package/dist/theme/index.d.ts.map +1 -0
  175. package/dist/theme/presets/__tests__/getPreset.test.d.ts +2 -0
  176. package/dist/theme/presets/__tests__/getPreset.test.d.ts.map +1 -0
  177. package/dist/theme/presets/abyss.d.ts +3 -0
  178. package/dist/theme/presets/abyss.d.ts.map +1 -0
  179. package/dist/theme/presets/abyss.js +54 -0
  180. package/dist/theme/presets/aurora.d.ts +8 -0
  181. package/dist/theme/presets/aurora.d.ts.map +1 -0
  182. package/dist/theme/presets/aurora.js +59 -0
  183. package/dist/theme/presets/canopy.d.ts +3 -0
  184. package/dist/theme/presets/canopy.d.ts.map +1 -0
  185. package/dist/theme/presets/canopy.js +58 -0
  186. package/dist/theme/presets/cyber-flux.d.ts +8 -0
  187. package/dist/theme/presets/cyber-flux.d.ts.map +1 -0
  188. package/dist/theme/presets/cyber-strike.d.ts +9 -0
  189. package/dist/theme/presets/cyber-strike.d.ts.map +1 -0
  190. package/dist/theme/presets/cyber-void.d.ts +8 -0
  191. package/dist/theme/presets/cyber-void.d.ts.map +1 -0
  192. package/dist/theme/presets/cyber-volt.d.ts +8 -0
  193. package/dist/theme/presets/cyber-volt.d.ts.map +1 -0
  194. package/dist/theme/presets/default.d.ts +4 -0
  195. package/dist/theme/presets/default.d.ts.map +1 -0
  196. package/dist/theme/presets/ember.d.ts +8 -0
  197. package/dist/theme/presets/ember.d.ts.map +1 -0
  198. package/dist/theme/presets/ember.js +63 -0
  199. package/dist/theme/presets/honey.d.ts +3 -0
  200. package/dist/theme/presets/honey.d.ts.map +1 -0
  201. package/dist/theme/presets/honey.js +62 -0
  202. package/dist/theme/presets/index.d.ts +6 -0
  203. package/dist/theme/presets/index.d.ts.map +1 -0
  204. package/dist/theme/presets/midnight.d.ts +8 -0
  205. package/dist/theme/presets/midnight.d.ts.map +1 -0
  206. package/dist/theme/presets/midnight.js +68 -0
  207. package/dist/theme/presets/obsidian.d.ts +3 -0
  208. package/dist/theme/presets/obsidian.d.ts.map +1 -0
  209. package/dist/theme/presets/obsidian.js +56 -0
  210. package/dist/theme/presets/regal.d.ts +8 -0
  211. package/dist/theme/presets/regal.d.ts.map +1 -0
  212. package/dist/theme/presets/rose-gold.d.ts +8 -0
  213. package/dist/theme/presets/rose-gold.d.ts.map +1 -0
  214. package/dist/theme/presets/slate.d.ts +3 -0
  215. package/dist/theme/presets/slate.d.ts.map +1 -0
  216. package/dist/theme/presets/slate.js +56 -0
  217. package/dist/theme/presets/tactical.d.ts +8 -0
  218. package/dist/theme/presets/tactical.d.ts.map +1 -0
  219. package/dist/theme/presets/types.d.ts +26 -0
  220. package/dist/theme/presets/types.d.ts.map +1 -0
  221. package/dist/theme/presets/types.js +1 -0
  222. package/dist/utils/index.d.ts +1 -22
  223. package/dist/utils/index.js +1 -1
  224. package/package.json +67 -51
  225. package/dist/chunk-3KMDHCAR.js +0 -52
  226. package/dist/chunk-6BJOYF6E.js +0 -8
  227. package/dist/chunk-BLO4SISK.js +0 -113
  228. package/dist/chunk-HUWJXLLF.js +0 -681
  229. package/dist/chunk-JVAZHVNV.js +0 -110
  230. package/dist/chunk-JYSYHVLU.js +0 -379
  231. package/dist/chunk-NE36BUGQ.js +0 -146
  232. package/dist/chunk-O3PY6B6E.js +0 -749
  233. package/dist/chunk-OXVOHOP3.js +0 -661
  234. package/dist/chunk-PSLKGOBZ.js +0 -58
  235. package/dist/chunk-RJCA5672.js +0 -1664
  236. package/dist/chunk-TMFCNFLW.js +0 -107
  237. package/dist/chunk-TN3PU2WK.js +0 -748
  238. package/dist/chunk-TZPAA4RC.js +0 -1461
  239. package/dist/chunk-W7ZBF5AA.js +0 -1
  240. package/dist/chunk-YZ6GTZXL.js +0 -48
  241. package/dist/components/command-queue/index.css +0 -53
  242. package/dist/components/command-queue/index.d.ts +0 -204
  243. package/dist/components/command-queue/index.js +0 -12
  244. package/dist/components/forms/index.d.ts +0 -56
  245. package/dist/components/forms/index.js +0 -2
  246. package/dist/components/index.css +0 -443
  247. package/dist/components/monitoring/index.d.ts +0 -66
  248. package/dist/components/monitoring/index.js +0 -2
  249. package/dist/components/notifications/index.d.ts +0 -52
  250. package/dist/components/notifications/index.js +0 -5
  251. package/dist/components/resource-definition/index.css +0 -388
  252. package/dist/components/resource-definition/index.d.ts +0 -301
  253. package/dist/components/resource-definition/index.js +0 -3
  254. package/dist/display/index.css +0 -53
  255. package/dist/display/index.d.ts +0 -606
  256. package/dist/display/index.js +0 -7
  257. package/dist/execution/index.css +0 -388
  258. package/dist/provider/index.css +0 -61
  259. package/dist/{chunk-TYV5NJV2.js → chunk-BUZONXAW.js} +0 -0
  260. package/dist/{chunk-UMXDDEAG.js → chunk-SFF5MJEI.js} +1 -1
  261. /package/dist/{chunk-NXHL23JW.js → chunk-XXDDMASA.js} +0 -0
@@ -1,4554 +1,11 @@
1
- import * as _tanstack_react_query from '@tanstack/react-query';
2
- import * as react from 'react';
3
- import { z } from 'zod';
4
-
5
- /**
6
- * Error categories for observability grouping and classification.
7
- * Used to categorize errors in the execution_errors table metadata.
8
- */
9
- type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
10
-
11
- /**
12
- * Shared form field types for dynamic form generation
13
- * Used by: Command Queue, Execution Runner UI, future form-based features
14
- */
15
- /**
16
- * Supported form field types for action payloads
17
- * Maps to Mantine form components
18
- */
19
- type FormFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'radio' | 'richtext';
20
- /**
21
- * Form field definition
22
- */
23
- interface FormField {
24
- /** Field key in payload object */
25
- name: string;
26
- /** Field label for UI */
27
- label: string;
28
- /** Field type (determines UI component) */
29
- type: FormFieldType;
30
- /** Default value */
31
- defaultValue?: unknown;
32
- /** Required field */
33
- required?: boolean;
34
- /** Placeholder text */
35
- placeholder?: string;
36
- /** Help text */
37
- description?: string;
38
- /** Options for select/radio */
39
- options?: Array<{
40
- label: string;
41
- value: string | number;
42
- }>;
43
- /** Min/max for number */
44
- min?: number;
45
- max?: number;
46
- /** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
47
- defaultValueFromContext?: string;
48
- }
49
- /**
50
- * Form schema for action payload collection
51
- */
52
- interface FormSchema {
53
- /** Form title */
54
- title?: string;
55
- /** Form description */
56
- description?: string;
57
- /** Form fields */
58
- fields: FormField[];
59
- }
60
-
61
- /**
62
- * Serialized Registry Types
63
- *
64
- * Pre-computed JSON-safe types for API responses and Command View.
65
- * Serialization happens once at API startup, enabling instant response times.
66
- */
67
-
68
- /**
69
- * Serialized form field for API responses
70
- */
71
- interface SerializedFormField {
72
- name: string;
73
- label: string;
74
- type: FormFieldType;
75
- defaultValue?: unknown;
76
- required?: boolean;
77
- placeholder?: string;
78
- description?: string;
79
- options?: Array<{
80
- label: string;
81
- value: string | number;
82
- }>;
83
- min?: number;
84
- max?: number;
85
- }
86
- /**
87
- * Serialized form schema for API responses
88
- */
89
- interface SerializedFormSchema {
90
- title?: string;
91
- description?: string;
92
- fields: SerializedFormField[];
93
- layout?: 'vertical' | 'horizontal' | 'grid';
94
- }
95
- /**
96
- * Serialized execution form schema for API responses
97
- */
98
- interface SerializedExecutionFormSchema extends SerializedFormSchema {
99
- fieldMappings?: Record<string, string>;
100
- submitButton?: {
101
- label?: string;
102
- loadingLabel?: string;
103
- confirmMessage?: string;
104
- };
105
- }
106
- /**
107
- * Serialized schedule config for API responses
108
- */
109
- interface SerializedScheduleConfig {
110
- enabled: boolean;
111
- defaultSchedule?: string;
112
- allowedPatterns?: string[];
113
- }
114
- /**
115
- * Serialized webhook config for API responses
116
- */
117
- interface SerializedWebhookConfig {
118
- enabled: boolean;
119
- payloadSchema?: unknown;
120
- }
121
- /**
122
- * Serialized execution interface for API responses
123
- */
124
- interface SerializedExecutionInterface {
125
- form: SerializedExecutionFormSchema;
126
- schedule?: SerializedScheduleConfig;
127
- webhook?: SerializedWebhookConfig;
128
- }
129
- /**
130
- * Serialized agent definition (JSON-safe)
131
- * Result of serializeDefinition(AgentDefinition)
132
- */
133
- interface SerializedAgentDefinition {
134
- config: {
135
- resourceId: string;
136
- name: string;
137
- description: string;
138
- version: string;
139
- type: 'agent';
140
- status: 'dev' | 'prod';
141
- /** Whether this resource is archived and should be excluded from registration and deployment */
142
- archived?: boolean;
143
- systemPrompt: string;
144
- constraints?: {
145
- maxIterations?: number;
146
- timeout?: number;
147
- maxSessionMemoryKeys?: number;
148
- maxMemoryTokens?: number;
149
- };
150
- sessionCapable?: boolean;
151
- memoryPreferences?: string;
152
- };
153
- modelConfig: {
154
- provider: string;
155
- model: string;
156
- apiKey: string;
157
- temperature: number;
158
- maxOutputTokens: number;
159
- topP?: number;
160
- modelOptions?: Record<string, unknown>;
161
- };
162
- contract: {
163
- inputSchema: object;
164
- outputSchema?: object;
165
- };
166
- tools: Array<{
167
- name: string;
168
- description: string;
169
- inputSchema?: object;
170
- outputSchema?: object;
171
- }>;
172
- knowledgeMap?: {
173
- nodeCount: number;
174
- nodes: Array<{
175
- id: string;
176
- description: string;
177
- loaded: boolean;
178
- hasPrompt: boolean;
179
- }>;
180
- };
181
- metricsConfig?: object;
182
- interface?: SerializedExecutionInterface;
183
- }
184
- /**
185
- * Serialized workflow definition (JSON-safe)
186
- * Result of serializeDefinition(WorkflowDefinition)
187
- */
188
- interface SerializedWorkflowDefinition {
189
- config: {
190
- resourceId: string;
191
- name: string;
192
- description: string;
193
- version: string;
194
- type: 'workflow';
195
- status: 'dev' | 'prod';
196
- /** Whether this resource is archived and should be excluded from registration and deployment */
197
- archived?: boolean;
198
- };
199
- entryPoint: string;
200
- steps: Array<{
201
- id: string;
202
- name: string;
203
- description: string;
204
- inputSchema?: object;
205
- outputSchema?: object;
206
- next: {
207
- type: 'linear' | 'conditional';
208
- target?: string;
209
- routes?: Array<{
210
- target: string;
211
- }>;
212
- default?: string;
213
- } | null;
214
- }>;
215
- contract: {
216
- inputSchema: object;
217
- outputSchema?: object;
218
- };
219
- metricsConfig?: object;
220
- interface?: SerializedExecutionInterface;
221
- }
222
-
223
- /**
224
- * Memory type definitions
225
- * Types for agent memory management with semantic entry types
226
- */
227
- /**
228
- * Semantic memory entry types
229
- * Use-case agnostic types that describe the purpose of each entry
230
- * Memory types mirror action types for clarity and filtering
231
- */
232
- type MemoryEntryType = 'context' | 'input' | 'reasoning' | 'tool-result' | 'delegation-result' | 'error';
233
- /**
234
- * Memory entry - represents a single entry in agent memory
235
- * Stored in agent memory, translated by adapters to vendor-specific formats
236
- */
237
- interface MemoryEntry {
238
- type: MemoryEntryType;
239
- content: string;
240
- timestamp: number;
241
- turnNumber: number | null;
242
- iterationNumber: number | null;
243
- }
244
- /**
245
- * Agent memory - Self-orchestrated memory with session + working storage
246
- * Agent has full control over what persists, framework handles auto-compaction
247
- */
248
- interface AgentMemory {
249
- /**
250
- * Session memory - Persists for session/conversation duration
251
- * Never auto-trimmed by framework
252
- * Agent-managed key-value store for critical information
253
- * Agent provides strings, framework wraps in MemoryEntry
254
- */
255
- sessionMemory: Record<string, MemoryEntry>;
256
- /**
257
- * Working memory - Execution history
258
- * Automatically compacted by framework when needed
259
- * Agent doesn't control compaction
260
- */
261
- history: MemoryEntry[];
262
- }
263
-
264
- type Json = string | number | boolean | null | {
265
- [key: string]: Json | undefined;
266
- } | Json[];
267
- type Database = {
268
- __InternalSupabase: {
269
- PostgrestVersion: "12.2.3 (519615d)";
270
- };
271
- public: {
272
- Tables: {
273
- acq_companies: {
274
- Row: {
275
- attio_company_id: string | null;
276
- batch_id: string | null;
277
- category: string | null;
278
- category_pain: string | null;
279
- created_at: string;
280
- domain: string | null;
281
- enrichment_data: Json | null;
282
- filter_reason: string | null;
283
- founded_year: number | null;
284
- id: string;
285
- linkedin_url: string | null;
286
- location_city: string | null;
287
- location_state: string | null;
288
- name: string;
289
- num_employees: number | null;
290
- organization_id: string;
291
- pipeline_status: Json;
292
- segment: string | null;
293
- source: string | null;
294
- status: string;
295
- updated_at: string;
296
- website: string | null;
297
- };
298
- Insert: {
299
- attio_company_id?: string | null;
300
- batch_id?: string | null;
301
- category?: string | null;
302
- category_pain?: string | null;
303
- created_at?: string;
304
- domain?: string | null;
305
- enrichment_data?: Json | null;
306
- filter_reason?: string | null;
307
- founded_year?: number | null;
308
- id?: string;
309
- linkedin_url?: string | null;
310
- location_city?: string | null;
311
- location_state?: string | null;
312
- name: string;
313
- num_employees?: number | null;
314
- organization_id: string;
315
- pipeline_status?: Json;
316
- segment?: string | null;
317
- source?: string | null;
318
- status?: string;
319
- updated_at?: string;
320
- website?: string | null;
321
- };
322
- Update: {
323
- attio_company_id?: string | null;
324
- batch_id?: string | null;
325
- category?: string | null;
326
- category_pain?: string | null;
327
- created_at?: string;
328
- domain?: string | null;
329
- enrichment_data?: Json | null;
330
- filter_reason?: string | null;
331
- founded_year?: number | null;
332
- id?: string;
333
- linkedin_url?: string | null;
334
- location_city?: string | null;
335
- location_state?: string | null;
336
- name?: string;
337
- num_employees?: number | null;
338
- organization_id?: string;
339
- pipeline_status?: Json;
340
- segment?: string | null;
341
- source?: string | null;
342
- status?: string;
343
- updated_at?: string;
344
- website?: string | null;
345
- };
346
- Relationships: [
347
- {
348
- foreignKeyName: "acq_companies_organization_id_fkey";
349
- columns: ["organization_id"];
350
- isOneToOne: false;
351
- referencedRelation: "organizations";
352
- referencedColumns: ["id"];
353
- }
354
- ];
355
- };
356
- acq_contacts: {
357
- Row: {
358
- attio_person_id: string | null;
359
- batch_id: string | null;
360
- brochure_first_viewed_at: string | null;
361
- brochure_view_count: number;
362
- company_id: string | null;
363
- created_at: string;
364
- email: string;
365
- email_valid: string | null;
366
- enrichment_data: Json;
367
- filter_reason: string | null;
368
- first_name: string | null;
369
- headline: string | null;
370
- id: string;
371
- last_name: string | null;
372
- linkedin_url: string | null;
373
- nurture: boolean;
374
- opening_line: string | null;
375
- organization_id: string;
376
- pipeline_status: Json;
377
- source: string | null;
378
- source_id: string | null;
379
- status: string;
380
- title: string | null;
381
- updated_at: string;
382
- };
383
- Insert: {
384
- attio_person_id?: string | null;
385
- batch_id?: string | null;
386
- brochure_first_viewed_at?: string | null;
387
- brochure_view_count?: number;
388
- company_id?: string | null;
389
- created_at?: string;
390
- email: string;
391
- email_valid?: string | null;
392
- enrichment_data?: Json;
393
- filter_reason?: string | null;
394
- first_name?: string | null;
395
- headline?: string | null;
396
- id?: string;
397
- last_name?: string | null;
398
- linkedin_url?: string | null;
399
- nurture?: boolean;
400
- opening_line?: string | null;
401
- organization_id: string;
402
- pipeline_status?: Json;
403
- source?: string | null;
404
- source_id?: string | null;
405
- status?: string;
406
- title?: string | null;
407
- updated_at?: string;
408
- };
409
- Update: {
410
- attio_person_id?: string | null;
411
- batch_id?: string | null;
412
- brochure_first_viewed_at?: string | null;
413
- brochure_view_count?: number;
414
- company_id?: string | null;
415
- created_at?: string;
416
- email?: string;
417
- email_valid?: string | null;
418
- enrichment_data?: Json;
419
- filter_reason?: string | null;
420
- first_name?: string | null;
421
- headline?: string | null;
422
- id?: string;
423
- last_name?: string | null;
424
- linkedin_url?: string | null;
425
- nurture?: boolean;
426
- opening_line?: string | null;
427
- organization_id?: string;
428
- pipeline_status?: Json;
429
- source?: string | null;
430
- source_id?: string | null;
431
- status?: string;
432
- title?: string | null;
433
- updated_at?: string;
434
- };
435
- Relationships: [
436
- {
437
- foreignKeyName: "acq_contacts_company_id_fkey";
438
- columns: ["company_id"];
439
- isOneToOne: false;
440
- referencedRelation: "acq_companies";
441
- referencedColumns: ["id"];
442
- },
443
- {
444
- foreignKeyName: "acq_contacts_organization_id_fkey";
445
- columns: ["organization_id"];
446
- isOneToOne: false;
447
- referencedRelation: "organizations";
448
- referencedColumns: ["id"];
449
- }
450
- ];
451
- };
452
- acq_content: {
453
- Row: {
454
- body: string | null;
455
- created_at: string;
456
- id: string;
457
- organization_id: string;
458
- pillar: string;
459
- status: string;
460
- title: string;
461
- updated_at: string;
462
- };
463
- Insert: {
464
- body?: string | null;
465
- created_at?: string;
466
- id?: string;
467
- organization_id: string;
468
- pillar: string;
469
- status?: string;
470
- title: string;
471
- updated_at?: string;
472
- };
473
- Update: {
474
- body?: string | null;
475
- created_at?: string;
476
- id?: string;
477
- organization_id?: string;
478
- pillar?: string;
479
- status?: string;
480
- title?: string;
481
- updated_at?: string;
482
- };
483
- Relationships: [
484
- {
485
- foreignKeyName: "acq_content_organization_id_fkey";
486
- columns: ["organization_id"];
487
- isOneToOne: false;
488
- referencedRelation: "organizations";
489
- referencedColumns: ["id"];
490
- }
491
- ];
492
- };
493
- acq_content_distributions: {
494
- Row: {
495
- adapted_body: string | null;
496
- checklist: Json | null;
497
- content_id: string;
498
- created_at: string;
499
- format: string;
500
- id: string;
501
- media_urls: Json;
502
- metrics: Json;
503
- metrics_updated_at: string | null;
504
- organization_id: string;
505
- platform: string;
506
- platform_content: Json | null;
507
- platform_post_id: string | null;
508
- platform_url: string | null;
509
- published_at: string | null;
510
- status: string;
511
- updated_at: string;
512
- };
513
- Insert: {
514
- adapted_body?: string | null;
515
- checklist?: Json | null;
516
- content_id: string;
517
- created_at?: string;
518
- format: string;
519
- id?: string;
520
- media_urls?: Json;
521
- metrics?: Json;
522
- metrics_updated_at?: string | null;
523
- organization_id: string;
524
- platform: string;
525
- platform_content?: Json | null;
526
- platform_post_id?: string | null;
527
- platform_url?: string | null;
528
- published_at?: string | null;
529
- status?: string;
530
- updated_at?: string;
531
- };
532
- Update: {
533
- adapted_body?: string | null;
534
- checklist?: Json | null;
535
- content_id?: string;
536
- created_at?: string;
537
- format?: string;
538
- id?: string;
539
- media_urls?: Json;
540
- metrics?: Json;
541
- metrics_updated_at?: string | null;
542
- organization_id?: string;
543
- platform?: string;
544
- platform_content?: Json | null;
545
- platform_post_id?: string | null;
546
- platform_url?: string | null;
547
- published_at?: string | null;
548
- status?: string;
549
- updated_at?: string;
550
- };
551
- Relationships: [
552
- {
553
- foreignKeyName: "acq_content_distributions_content_id_fkey";
554
- columns: ["content_id"];
555
- isOneToOne: false;
556
- referencedRelation: "acq_content";
557
- referencedColumns: ["id"];
558
- },
559
- {
560
- foreignKeyName: "acq_content_distributions_organization_id_fkey";
561
- columns: ["organization_id"];
562
- isOneToOne: false;
563
- referencedRelation: "organizations";
564
- referencedColumns: ["id"];
565
- }
566
- ];
567
- };
568
- acq_deals: {
569
- Row: {
570
- activity_log: Json;
571
- attio_deal_id: string;
572
- cached_stage: string | null;
573
- closed_lost_at: string | null;
574
- closed_lost_reason: string | null;
575
- contact_email: string;
576
- contact_id: string | null;
577
- created_at: string;
578
- discovery_data: Json | null;
579
- discovery_submitted_at: string | null;
580
- discovery_submitted_by: string | null;
581
- id: string;
582
- initial_fee: number | null;
583
- monthly_fee: number | null;
584
- organization_id: string;
585
- payment_link_sent_at: string | null;
586
- payment_received_at: string | null;
587
- proposal_data: Json | null;
588
- proposal_generated_at: string | null;
589
- proposal_pdf_url: string | null;
590
- proposal_reviewed_at: string | null;
591
- proposal_reviewed_by: string | null;
592
- proposal_sent_at: string | null;
593
- proposal_signed_at: string | null;
594
- proposal_status: string | null;
595
- signature_envelope_id: string | null;
596
- source_list_id: string | null;
597
- source_type: string | null;
598
- stripe_payment_id: string | null;
599
- stripe_payment_link: string | null;
600
- stripe_payment_link_id: string | null;
601
- stripe_subscription_id: string | null;
602
- updated_at: string;
603
- };
604
- Insert: {
605
- activity_log?: Json;
606
- attio_deal_id: string;
607
- cached_stage?: string | null;
608
- closed_lost_at?: string | null;
609
- closed_lost_reason?: string | null;
610
- contact_email: string;
611
- contact_id?: string | null;
612
- created_at?: string;
613
- discovery_data?: Json | null;
614
- discovery_submitted_at?: string | null;
615
- discovery_submitted_by?: string | null;
616
- id?: string;
617
- initial_fee?: number | null;
618
- monthly_fee?: number | null;
619
- organization_id: string;
620
- payment_link_sent_at?: string | null;
621
- payment_received_at?: string | null;
622
- proposal_data?: Json | null;
623
- proposal_generated_at?: string | null;
624
- proposal_pdf_url?: string | null;
625
- proposal_reviewed_at?: string | null;
626
- proposal_reviewed_by?: string | null;
627
- proposal_sent_at?: string | null;
628
- proposal_signed_at?: string | null;
629
- proposal_status?: string | null;
630
- signature_envelope_id?: string | null;
631
- source_list_id?: string | null;
632
- source_type?: string | null;
633
- stripe_payment_id?: string | null;
634
- stripe_payment_link?: string | null;
635
- stripe_payment_link_id?: string | null;
636
- stripe_subscription_id?: string | null;
637
- updated_at?: string;
638
- };
639
- Update: {
640
- activity_log?: Json;
641
- attio_deal_id?: string;
642
- cached_stage?: string | null;
643
- closed_lost_at?: string | null;
644
- closed_lost_reason?: string | null;
645
- contact_email?: string;
646
- contact_id?: string | null;
647
- created_at?: string;
648
- discovery_data?: Json | null;
649
- discovery_submitted_at?: string | null;
650
- discovery_submitted_by?: string | null;
651
- id?: string;
652
- initial_fee?: number | null;
653
- monthly_fee?: number | null;
654
- organization_id?: string;
655
- payment_link_sent_at?: string | null;
656
- payment_received_at?: string | null;
657
- proposal_data?: Json | null;
658
- proposal_generated_at?: string | null;
659
- proposal_pdf_url?: string | null;
660
- proposal_reviewed_at?: string | null;
661
- proposal_reviewed_by?: string | null;
662
- proposal_sent_at?: string | null;
663
- proposal_signed_at?: string | null;
664
- proposal_status?: string | null;
665
- signature_envelope_id?: string | null;
666
- source_list_id?: string | null;
667
- source_type?: string | null;
668
- stripe_payment_id?: string | null;
669
- stripe_payment_link?: string | null;
670
- stripe_payment_link_id?: string | null;
671
- stripe_subscription_id?: string | null;
672
- updated_at?: string;
673
- };
674
- Relationships: [
675
- {
676
- foreignKeyName: "acq_deals_contact_id_fkey";
677
- columns: ["contact_id"];
678
- isOneToOne: false;
679
- referencedRelation: "acq_contacts";
680
- referencedColumns: ["id"];
681
- },
682
- {
683
- foreignKeyName: "acq_deals_organization_id_fkey";
684
- columns: ["organization_id"];
685
- isOneToOne: false;
686
- referencedRelation: "organizations";
687
- referencedColumns: ["id"];
688
- },
689
- {
690
- foreignKeyName: "acq_deals_source_list_id_fkey";
691
- columns: ["source_list_id"];
692
- isOneToOne: false;
693
- referencedRelation: "acq_lists";
694
- referencedColumns: ["id"];
695
- }
696
- ];
697
- };
698
- acq_list_members: {
699
- Row: {
700
- added_at: string;
701
- added_by: string | null;
702
- contact_id: string;
703
- id: string;
704
- list_id: string;
705
- };
706
- Insert: {
707
- added_at?: string;
708
- added_by?: string | null;
709
- contact_id: string;
710
- id?: string;
711
- list_id: string;
712
- };
713
- Update: {
714
- added_at?: string;
715
- added_by?: string | null;
716
- contact_id?: string;
717
- id?: string;
718
- list_id?: string;
719
- };
720
- Relationships: [
721
- {
722
- foreignKeyName: "acq_list_members_contact_id_fkey";
723
- columns: ["contact_id"];
724
- isOneToOne: false;
725
- referencedRelation: "acq_contacts";
726
- referencedColumns: ["id"];
727
- },
728
- {
729
- foreignKeyName: "acq_list_members_list_id_fkey";
730
- columns: ["list_id"];
731
- isOneToOne: false;
732
- referencedRelation: "acq_lists";
733
- referencedColumns: ["id"];
734
- }
735
- ];
736
- };
737
- acq_lists: {
738
- Row: {
739
- batch_ids: string[];
740
- completed_at: string | null;
741
- created_at: string;
742
- description: string | null;
743
- id: string;
744
- instantly_campaign_id: string | null;
745
- launched_at: string | null;
746
- metadata: Json;
747
- name: string;
748
- organization_id: string;
749
- status: string;
750
- type: string;
751
- };
752
- Insert: {
753
- batch_ids?: string[];
754
- completed_at?: string | null;
755
- created_at?: string;
756
- description?: string | null;
757
- id?: string;
758
- instantly_campaign_id?: string | null;
759
- launched_at?: string | null;
760
- metadata?: Json;
761
- name: string;
762
- organization_id: string;
763
- status?: string;
764
- type?: string;
765
- };
766
- Update: {
767
- batch_ids?: string[];
768
- completed_at?: string | null;
769
- created_at?: string;
770
- description?: string | null;
771
- id?: string;
772
- instantly_campaign_id?: string | null;
773
- launched_at?: string | null;
774
- metadata?: Json;
775
- name?: string;
776
- organization_id?: string;
777
- status?: string;
778
- type?: string;
779
- };
780
- Relationships: [
781
- {
782
- foreignKeyName: "acq_lists_organization_id_fkey";
783
- columns: ["organization_id"];
784
- isOneToOne: false;
785
- referencedRelation: "organizations";
786
- referencedColumns: ["id"];
787
- }
788
- ];
789
- };
790
- acq_seo_metrics: {
791
- Row: {
792
- ai_citations: Json | null;
793
- avg_position: number | null;
794
- clicks: number | null;
795
- created_at: string;
796
- cta_clicks: number | null;
797
- ctr: number | null;
798
- data_point_count: number | null;
799
- faq_count: number | null;
800
- form_submissions: number | null;
801
- id: string;
802
- impressions: number | null;
803
- organization_id: string;
804
- period: string;
805
- quality_score: number | null;
806
- readability: number | null;
807
- scroll_100: number | null;
808
- scroll_25: number | null;
809
- scroll_50: number | null;
810
- scroll_75: number | null;
811
- seo_page_id: string;
812
- word_count: number | null;
813
- };
814
- Insert: {
815
- ai_citations?: Json | null;
816
- avg_position?: number | null;
817
- clicks?: number | null;
818
- created_at?: string;
819
- cta_clicks?: number | null;
820
- ctr?: number | null;
821
- data_point_count?: number | null;
822
- faq_count?: number | null;
823
- form_submissions?: number | null;
824
- id?: string;
825
- impressions?: number | null;
826
- organization_id: string;
827
- period: string;
828
- quality_score?: number | null;
829
- readability?: number | null;
830
- scroll_100?: number | null;
831
- scroll_25?: number | null;
832
- scroll_50?: number | null;
833
- scroll_75?: number | null;
834
- seo_page_id: string;
835
- word_count?: number | null;
836
- };
837
- Update: {
838
- ai_citations?: Json | null;
839
- avg_position?: number | null;
840
- clicks?: number | null;
841
- created_at?: string;
842
- cta_clicks?: number | null;
843
- ctr?: number | null;
844
- data_point_count?: number | null;
845
- faq_count?: number | null;
846
- form_submissions?: number | null;
847
- id?: string;
848
- impressions?: number | null;
849
- organization_id?: string;
850
- period?: string;
851
- quality_score?: number | null;
852
- readability?: number | null;
853
- scroll_100?: number | null;
854
- scroll_25?: number | null;
855
- scroll_50?: number | null;
856
- scroll_75?: number | null;
857
- seo_page_id?: string;
858
- word_count?: number | null;
859
- };
860
- Relationships: [
861
- {
862
- foreignKeyName: "acq_seo_metrics_organization_id_fkey";
863
- columns: ["organization_id"];
864
- isOneToOne: false;
865
- referencedRelation: "organizations";
866
- referencedColumns: ["id"];
867
- },
868
- {
869
- foreignKeyName: "acq_seo_metrics_seo_page_id_fkey";
870
- columns: ["seo_page_id"];
871
- isOneToOne: false;
872
- referencedRelation: "acq_seo_pages";
873
- referencedColumns: ["id"];
874
- }
875
- ];
876
- };
877
- acq_seo_pages: {
878
- Row: {
879
- city: string | null;
880
- content: Json | null;
881
- created_at: string;
882
- faq_items: Json | null;
883
- hero_image_url: string | null;
884
- id: string;
885
- internal_links: Json | null;
886
- local_data: Json | null;
887
- meta_description: string | null;
888
- organization_id: string;
889
- page_type: string;
890
- published_at: string | null;
891
- refreshed_at: string | null;
892
- schema_markup: Json | null;
893
- slug: string;
894
- state: string | null;
895
- status: string;
896
- title: string;
897
- updated_at: string;
898
- use_case: string | null;
899
- vertical: string;
900
- };
901
- Insert: {
902
- city?: string | null;
903
- content?: Json | null;
904
- created_at?: string;
905
- faq_items?: Json | null;
906
- hero_image_url?: string | null;
907
- id?: string;
908
- internal_links?: Json | null;
909
- local_data?: Json | null;
910
- meta_description?: string | null;
911
- organization_id: string;
912
- page_type: string;
913
- published_at?: string | null;
914
- refreshed_at?: string | null;
915
- schema_markup?: Json | null;
916
- slug: string;
917
- state?: string | null;
918
- status?: string;
919
- title: string;
920
- updated_at?: string;
921
- use_case?: string | null;
922
- vertical: string;
923
- };
924
- Update: {
925
- city?: string | null;
926
- content?: Json | null;
927
- created_at?: string;
928
- faq_items?: Json | null;
929
- hero_image_url?: string | null;
930
- id?: string;
931
- internal_links?: Json | null;
932
- local_data?: Json | null;
933
- meta_description?: string | null;
934
- organization_id?: string;
935
- page_type?: string;
936
- published_at?: string | null;
937
- refreshed_at?: string | null;
938
- schema_markup?: Json | null;
939
- slug?: string;
940
- state?: string | null;
941
- status?: string;
942
- title?: string;
943
- updated_at?: string;
944
- use_case?: string | null;
945
- vertical?: string;
946
- };
947
- Relationships: [
948
- {
949
- foreignKeyName: "acq_seo_pages_organization_id_fkey";
950
- columns: ["organization_id"];
951
- isOneToOne: false;
952
- referencedRelation: "organizations";
953
- referencedColumns: ["id"];
954
- }
955
- ];
956
- };
957
- acq_social_posts: {
958
- Row: {
959
- author_name: string;
960
- author_url: string | null;
961
- comments_count: number;
962
- created_at: string;
963
- discovered_at: string;
964
- engagement_count: number;
965
- feedback: string | null;
966
- final_response: string | null;
967
- fully_reviewed: boolean;
968
- id: string;
969
- initial_draft: string | null;
970
- matched_keywords: string[];
971
- matched_query: string | null;
972
- metadata: Json;
973
- organization_id: string;
974
- platform: string;
975
- platform_post_id: string;
976
- post_text: string;
977
- post_title: string;
978
- post_url: string;
979
- posted_at: string;
980
- relevance_score: number;
981
- responded_at: string | null;
982
- reviewed_at: string | null;
983
- skip_reason: string | null;
984
- source_category: string | null;
985
- status: string;
986
- updated_at: string;
987
- };
988
- Insert: {
989
- author_name: string;
990
- author_url?: string | null;
991
- comments_count?: number;
992
- created_at?: string;
993
- discovered_at?: string;
994
- engagement_count?: number;
995
- feedback?: string | null;
996
- final_response?: string | null;
997
- fully_reviewed?: boolean;
998
- id?: string;
999
- initial_draft?: string | null;
1000
- matched_keywords?: string[];
1001
- matched_query?: string | null;
1002
- metadata?: Json;
1003
- organization_id: string;
1004
- platform: string;
1005
- platform_post_id: string;
1006
- post_text: string;
1007
- post_title: string;
1008
- post_url: string;
1009
- posted_at: string;
1010
- relevance_score?: number;
1011
- responded_at?: string | null;
1012
- reviewed_at?: string | null;
1013
- skip_reason?: string | null;
1014
- source_category?: string | null;
1015
- status?: string;
1016
- updated_at?: string;
1017
- };
1018
- Update: {
1019
- author_name?: string;
1020
- author_url?: string | null;
1021
- comments_count?: number;
1022
- created_at?: string;
1023
- discovered_at?: string;
1024
- engagement_count?: number;
1025
- feedback?: string | null;
1026
- final_response?: string | null;
1027
- fully_reviewed?: boolean;
1028
- id?: string;
1029
- initial_draft?: string | null;
1030
- matched_keywords?: string[];
1031
- matched_query?: string | null;
1032
- metadata?: Json;
1033
- organization_id?: string;
1034
- platform?: string;
1035
- platform_post_id?: string;
1036
- post_text?: string;
1037
- post_title?: string;
1038
- post_url?: string;
1039
- posted_at?: string;
1040
- relevance_score?: number;
1041
- responded_at?: string | null;
1042
- reviewed_at?: string | null;
1043
- skip_reason?: string | null;
1044
- source_category?: string | null;
1045
- status?: string;
1046
- updated_at?: string;
1047
- };
1048
- Relationships: [
1049
- {
1050
- foreignKeyName: "acq_social_posts_organization_id_fkey";
1051
- columns: ["organization_id"];
1052
- isOneToOne: false;
1053
- referencedRelation: "organizations";
1054
- referencedColumns: ["id"];
1055
- }
1056
- ];
1057
- };
1058
- activities: {
1059
- Row: {
1060
- activity_type: string;
1061
- actor_id: string | null;
1062
- actor_type: string | null;
1063
- created_at: string;
1064
- description: string | null;
1065
- entity_id: string;
1066
- entity_name: string | null;
1067
- entity_type: string;
1068
- id: string;
1069
- metadata: Json | null;
1070
- occurred_at: string;
1071
- organization_id: string;
1072
- status: string;
1073
- title: string;
1074
- };
1075
- Insert: {
1076
- activity_type: string;
1077
- actor_id?: string | null;
1078
- actor_type?: string | null;
1079
- created_at?: string;
1080
- description?: string | null;
1081
- entity_id: string;
1082
- entity_name?: string | null;
1083
- entity_type: string;
1084
- id?: string;
1085
- metadata?: Json | null;
1086
- occurred_at?: string;
1087
- organization_id: string;
1088
- status: string;
1089
- title: string;
1090
- };
1091
- Update: {
1092
- activity_type?: string;
1093
- actor_id?: string | null;
1094
- actor_type?: string | null;
1095
- created_at?: string;
1096
- description?: string | null;
1097
- entity_id?: string;
1098
- entity_name?: string | null;
1099
- entity_type?: string;
1100
- id?: string;
1101
- metadata?: Json | null;
1102
- occurred_at?: string;
1103
- organization_id?: string;
1104
- status?: string;
1105
- title?: string;
1106
- };
1107
- Relationships: [
1108
- {
1109
- foreignKeyName: "activities_organization_id_fkey";
1110
- columns: ["organization_id"];
1111
- isOneToOne: false;
1112
- referencedRelation: "organizations";
1113
- referencedColumns: ["id"];
1114
- }
1115
- ];
1116
- };
1117
- api_keys: {
1118
- Row: {
1119
- created_at: string | null;
1120
- id: string;
1121
- key_hash: string;
1122
- last_used_at: string | null;
1123
- name: string;
1124
- organization_id: string;
1125
- };
1126
- Insert: {
1127
- created_at?: string | null;
1128
- id?: string;
1129
- key_hash: string;
1130
- last_used_at?: string | null;
1131
- name: string;
1132
- organization_id: string;
1133
- };
1134
- Update: {
1135
- created_at?: string | null;
1136
- id?: string;
1137
- key_hash?: string;
1138
- last_used_at?: string | null;
1139
- name?: string;
1140
- organization_id?: string;
1141
- };
1142
- Relationships: [
1143
- {
1144
- foreignKeyName: "api_keys_organization_id_fkey";
1145
- columns: ["organization_id"];
1146
- isOneToOne: false;
1147
- referencedRelation: "organizations";
1148
- referencedColumns: ["id"];
1149
- }
1150
- ];
1151
- };
1152
- calibration_projects: {
1153
- Row: {
1154
- created_at: string | null;
1155
- description: string | null;
1156
- id: string;
1157
- name: string;
1158
- organization_id: string;
1159
- resource_id: string;
1160
- resource_type: string;
1161
- updated_at: string | null;
1162
- };
1163
- Insert: {
1164
- created_at?: string | null;
1165
- description?: string | null;
1166
- id?: string;
1167
- name: string;
1168
- organization_id: string;
1169
- resource_id: string;
1170
- resource_type: string;
1171
- updated_at?: string | null;
1172
- };
1173
- Update: {
1174
- created_at?: string | null;
1175
- description?: string | null;
1176
- id?: string;
1177
- name?: string;
1178
- organization_id?: string;
1179
- resource_id?: string;
1180
- resource_type?: string;
1181
- updated_at?: string | null;
1182
- };
1183
- Relationships: [
1184
- {
1185
- foreignKeyName: "calibration_projects_organization_id_fkey";
1186
- columns: ["organization_id"];
1187
- isOneToOne: false;
1188
- referencedRelation: "organizations";
1189
- referencedColumns: ["id"];
1190
- }
1191
- ];
1192
- };
1193
- calibration_runs: {
1194
- Row: {
1195
- completed_at: string | null;
1196
- config_variants: Json;
1197
- created_at: string | null;
1198
- description: string | null;
1199
- execution_mode: string;
1200
- grader_model: string | null;
1201
- grading_rubric: Json | null;
1202
- id: string;
1203
- name: string;
1204
- organization_id: string;
1205
- project_id: string;
1206
- results: Json;
1207
- status: string;
1208
- test_inputs: Json;
1209
- };
1210
- Insert: {
1211
- completed_at?: string | null;
1212
- config_variants: Json;
1213
- created_at?: string | null;
1214
- description?: string | null;
1215
- execution_mode?: string;
1216
- grader_model?: string | null;
1217
- grading_rubric?: Json | null;
1218
- id?: string;
1219
- name: string;
1220
- organization_id: string;
1221
- project_id: string;
1222
- results?: Json;
1223
- status?: string;
1224
- test_inputs: Json;
1225
- };
1226
- Update: {
1227
- completed_at?: string | null;
1228
- config_variants?: Json;
1229
- created_at?: string | null;
1230
- description?: string | null;
1231
- execution_mode?: string;
1232
- grader_model?: string | null;
1233
- grading_rubric?: Json | null;
1234
- id?: string;
1235
- name?: string;
1236
- organization_id?: string;
1237
- project_id?: string;
1238
- results?: Json;
1239
- status?: string;
1240
- test_inputs?: Json;
1241
- };
1242
- Relationships: [
1243
- {
1244
- foreignKeyName: "calibration_runs_organization_id_fkey";
1245
- columns: ["organization_id"];
1246
- isOneToOne: false;
1247
- referencedRelation: "organizations";
1248
- referencedColumns: ["id"];
1249
- },
1250
- {
1251
- foreignKeyName: "calibration_runs_project_id_fkey";
1252
- columns: ["project_id"];
1253
- isOneToOne: false;
1254
- referencedRelation: "calibration_projects";
1255
- referencedColumns: ["id"];
1256
- }
1257
- ];
1258
- };
1259
- command_queue: {
1260
- Row: {
1261
- action_payload: Json | null;
1262
- actions: Json;
1263
- completed_at: string | null;
1264
- completed_by: string | null;
1265
- context: Json;
1266
- created_at: string;
1267
- description: string | null;
1268
- expires_at: string | null;
1269
- human_checkpoint: string | null;
1270
- id: string;
1271
- idempotency_key: string | null;
1272
- metadata: Json | null;
1273
- organization_id: string;
1274
- origin_execution_id: string;
1275
- origin_resource_id: string;
1276
- origin_resource_type: string;
1277
- priority: number;
1278
- selected_action: string | null;
1279
- status: string;
1280
- target_execution_id: string | null;
1281
- target_resource_id: string | null;
1282
- target_resource_type: string | null;
1283
- };
1284
- Insert: {
1285
- action_payload?: Json | null;
1286
- actions: Json;
1287
- completed_at?: string | null;
1288
- completed_by?: string | null;
1289
- context: Json;
1290
- created_at?: string;
1291
- description?: string | null;
1292
- expires_at?: string | null;
1293
- human_checkpoint?: string | null;
1294
- id?: string;
1295
- idempotency_key?: string | null;
1296
- metadata?: Json | null;
1297
- organization_id: string;
1298
- origin_execution_id: string;
1299
- origin_resource_id: string;
1300
- origin_resource_type: string;
1301
- priority?: number;
1302
- selected_action?: string | null;
1303
- status?: string;
1304
- target_execution_id?: string | null;
1305
- target_resource_id?: string | null;
1306
- target_resource_type?: string | null;
1307
- };
1308
- Update: {
1309
- action_payload?: Json | null;
1310
- actions?: Json;
1311
- completed_at?: string | null;
1312
- completed_by?: string | null;
1313
- context?: Json;
1314
- created_at?: string;
1315
- description?: string | null;
1316
- expires_at?: string | null;
1317
- human_checkpoint?: string | null;
1318
- id?: string;
1319
- idempotency_key?: string | null;
1320
- metadata?: Json | null;
1321
- organization_id?: string;
1322
- origin_execution_id?: string;
1323
- origin_resource_id?: string;
1324
- origin_resource_type?: string;
1325
- priority?: number;
1326
- selected_action?: string | null;
1327
- status?: string;
1328
- target_execution_id?: string | null;
1329
- target_resource_id?: string | null;
1330
- target_resource_type?: string | null;
1331
- };
1332
- Relationships: [
1333
- {
1334
- foreignKeyName: "command_queue_completed_by_fkey";
1335
- columns: ["completed_by"];
1336
- isOneToOne: false;
1337
- referencedRelation: "users";
1338
- referencedColumns: ["id"];
1339
- },
1340
- {
1341
- foreignKeyName: "command_queue_organization_id_fkey";
1342
- columns: ["organization_id"];
1343
- isOneToOne: false;
1344
- referencedRelation: "organizations";
1345
- referencedColumns: ["id"];
1346
- },
1347
- {
1348
- foreignKeyName: "command_queue_target_execution_id_fkey";
1349
- columns: ["target_execution_id"];
1350
- isOneToOne: false;
1351
- referencedRelation: "execution_logs";
1352
- referencedColumns: ["execution_id"];
1353
- }
1354
- ];
1355
- };
1356
- credentials: {
1357
- Row: {
1358
- created_at: string;
1359
- created_by: string | null;
1360
- encrypted_value: string;
1361
- id: string;
1362
- name: string;
1363
- organization_id: string;
1364
- provider: string | null;
1365
- type: string;
1366
- updated_at: string;
1367
- };
1368
- Insert: {
1369
- created_at?: string;
1370
- created_by?: string | null;
1371
- encrypted_value: string;
1372
- id?: string;
1373
- name: string;
1374
- organization_id: string;
1375
- provider?: string | null;
1376
- type?: string;
1377
- updated_at?: string;
1378
- };
1379
- Update: {
1380
- created_at?: string;
1381
- created_by?: string | null;
1382
- encrypted_value?: string;
1383
- id?: string;
1384
- name?: string;
1385
- organization_id?: string;
1386
- provider?: string | null;
1387
- type?: string;
1388
- updated_at?: string;
1389
- };
1390
- Relationships: [
1391
- {
1392
- foreignKeyName: "credentials_created_by_fkey";
1393
- columns: ["created_by"];
1394
- isOneToOne: false;
1395
- referencedRelation: "users";
1396
- referencedColumns: ["id"];
1397
- },
1398
- {
1399
- foreignKeyName: "credentials_organization_id_fkey";
1400
- columns: ["organization_id"];
1401
- isOneToOne: false;
1402
- referencedRelation: "organizations";
1403
- referencedColumns: ["id"];
1404
- }
1405
- ];
1406
- };
1407
- deployments: {
1408
- Row: {
1409
- compiled_docs: Json | null;
1410
- created_at: string;
1411
- deployment_version: string | null;
1412
- documentation: Json | null;
1413
- error_message: string | null;
1414
- id: string;
1415
- organization_id: string;
1416
- pid: number | null;
1417
- port: number | null;
1418
- sdk_version: string;
1419
- status: string;
1420
- tarball_path: string | null;
1421
- updated_at: string;
1422
- };
1423
- Insert: {
1424
- compiled_docs?: Json | null;
1425
- created_at?: string;
1426
- deployment_version?: string | null;
1427
- documentation?: Json | null;
1428
- error_message?: string | null;
1429
- id?: string;
1430
- organization_id: string;
1431
- pid?: number | null;
1432
- port?: number | null;
1433
- sdk_version: string;
1434
- status?: string;
1435
- tarball_path?: string | null;
1436
- updated_at?: string;
1437
- };
1438
- Update: {
1439
- compiled_docs?: Json | null;
1440
- created_at?: string;
1441
- deployment_version?: string | null;
1442
- documentation?: Json | null;
1443
- error_message?: string | null;
1444
- id?: string;
1445
- organization_id?: string;
1446
- pid?: number | null;
1447
- port?: number | null;
1448
- sdk_version?: string;
1449
- status?: string;
1450
- tarball_path?: string | null;
1451
- updated_at?: string;
1452
- };
1453
- Relationships: [
1454
- {
1455
- foreignKeyName: "deployments_organization_id_fkey";
1456
- columns: ["organization_id"];
1457
- isOneToOne: false;
1458
- referencedRelation: "organizations";
1459
- referencedColumns: ["id"];
1460
- }
1461
- ];
1462
- };
1463
- execution_errors: {
1464
- Row: {
1465
- created_at: string | null;
1466
- error_category: string;
1467
- error_message: string;
1468
- error_severity: string;
1469
- error_stack_trace: string | null;
1470
- error_type: string;
1471
- execution_id: string;
1472
- id: string;
1473
- metadata: Json | null;
1474
- occurred_at: string;
1475
- organization_id: string;
1476
- resolved: boolean;
1477
- resolved_at: string | null;
1478
- resolved_by: string | null;
1479
- };
1480
- Insert: {
1481
- created_at?: string | null;
1482
- error_category: string;
1483
- error_message: string;
1484
- error_severity: string;
1485
- error_stack_trace?: string | null;
1486
- error_type: string;
1487
- execution_id: string;
1488
- id?: string;
1489
- metadata?: Json | null;
1490
- occurred_at?: string;
1491
- organization_id: string;
1492
- resolved?: boolean;
1493
- resolved_at?: string | null;
1494
- resolved_by?: string | null;
1495
- };
1496
- Update: {
1497
- created_at?: string | null;
1498
- error_category?: string;
1499
- error_message?: string;
1500
- error_severity?: string;
1501
- error_stack_trace?: string | null;
1502
- error_type?: string;
1503
- execution_id?: string;
1504
- id?: string;
1505
- metadata?: Json | null;
1506
- occurred_at?: string;
1507
- organization_id?: string;
1508
- resolved?: boolean;
1509
- resolved_at?: string | null;
1510
- resolved_by?: string | null;
1511
- };
1512
- Relationships: [
1513
- {
1514
- foreignKeyName: "execution_errors_execution_id_fkey";
1515
- columns: ["execution_id"];
1516
- isOneToOne: false;
1517
- referencedRelation: "execution_logs";
1518
- referencedColumns: ["execution_id"];
1519
- },
1520
- {
1521
- foreignKeyName: "execution_errors_organization_id_fkey";
1522
- columns: ["organization_id"];
1523
- isOneToOne: false;
1524
- referencedRelation: "organizations";
1525
- referencedColumns: ["id"];
1526
- },
1527
- {
1528
- foreignKeyName: "execution_errors_resolved_by_fkey";
1529
- columns: ["resolved_by"];
1530
- isOneToOne: false;
1531
- referencedRelation: "users";
1532
- referencedColumns: ["id"];
1533
- }
1534
- ];
1535
- };
1536
- execution_logs: {
1537
- Row: {
1538
- api_version: string | null;
1539
- completed_at: string | null;
1540
- created_at: string | null;
1541
- error: string | null;
1542
- execution_id: string;
1543
- input: Json | null;
1544
- last_heartbeat_at: string | null;
1545
- logs: Json | null;
1546
- organization_id: string;
1547
- origin_execution_id: string | null;
1548
- output: Json | null;
1549
- resource_id: string;
1550
- resource_status: string;
1551
- resource_type: string;
1552
- resource_version: string | null;
1553
- sdk_version: string | null;
1554
- session_id: string | null;
1555
- session_turn_number: number | null;
1556
- started_at: string;
1557
- status: string;
1558
- trigger_type: string | null;
1559
- updated_at: string | null;
1560
- user_id: string | null;
1561
- };
1562
- Insert: {
1563
- api_version?: string | null;
1564
- completed_at?: string | null;
1565
- created_at?: string | null;
1566
- error?: string | null;
1567
- execution_id?: string;
1568
- input?: Json | null;
1569
- last_heartbeat_at?: string | null;
1570
- logs?: Json | null;
1571
- organization_id: string;
1572
- origin_execution_id?: string | null;
1573
- output?: Json | null;
1574
- resource_id: string;
1575
- resource_status?: string;
1576
- resource_type?: string;
1577
- resource_version?: string | null;
1578
- sdk_version?: string | null;
1579
- session_id?: string | null;
1580
- session_turn_number?: number | null;
1581
- started_at?: string;
1582
- status: string;
1583
- trigger_type?: string | null;
1584
- updated_at?: string | null;
1585
- user_id?: string | null;
1586
- };
1587
- Update: {
1588
- api_version?: string | null;
1589
- completed_at?: string | null;
1590
- created_at?: string | null;
1591
- error?: string | null;
1592
- execution_id?: string;
1593
- input?: Json | null;
1594
- last_heartbeat_at?: string | null;
1595
- logs?: Json | null;
1596
- organization_id?: string;
1597
- origin_execution_id?: string | null;
1598
- output?: Json | null;
1599
- resource_id?: string;
1600
- resource_status?: string;
1601
- resource_type?: string;
1602
- resource_version?: string | null;
1603
- sdk_version?: string | null;
1604
- session_id?: string | null;
1605
- session_turn_number?: number | null;
1606
- started_at?: string;
1607
- status?: string;
1608
- trigger_type?: string | null;
1609
- updated_at?: string | null;
1610
- user_id?: string | null;
1611
- };
1612
- Relationships: [
1613
- {
1614
- foreignKeyName: "execution_history_organization_id_fkey";
1615
- columns: ["organization_id"];
1616
- isOneToOne: false;
1617
- referencedRelation: "organizations";
1618
- referencedColumns: ["id"];
1619
- },
1620
- {
1621
- foreignKeyName: "execution_logs_origin_execution_id_fkey";
1622
- columns: ["origin_execution_id"];
1623
- isOneToOne: false;
1624
- referencedRelation: "execution_logs";
1625
- referencedColumns: ["execution_id"];
1626
- },
1627
- {
1628
- foreignKeyName: "execution_logs_session_id_fkey";
1629
- columns: ["session_id"];
1630
- isOneToOne: false;
1631
- referencedRelation: "sessions";
1632
- referencedColumns: ["session_id"];
1633
- },
1634
- {
1635
- foreignKeyName: "execution_logs_user_id_fkey";
1636
- columns: ["user_id"];
1637
- isOneToOne: false;
1638
- referencedRelation: "users";
1639
- referencedColumns: ["id"];
1640
- }
1641
- ];
1642
- };
1643
- execution_metrics: {
1644
- Row: {
1645
- ai_call_count: number;
1646
- ai_calls: Json | null;
1647
- automation_savings_usd: number | null;
1648
- created_at: string | null;
1649
- duration_ms: number | null;
1650
- execution_id: string;
1651
- organization_id: string;
1652
- resource_id: string;
1653
- total_cost_usd: number;
1654
- total_input_tokens: number;
1655
- total_output_tokens: number;
1656
- };
1657
- Insert: {
1658
- ai_call_count: number;
1659
- ai_calls?: Json | null;
1660
- automation_savings_usd?: number | null;
1661
- created_at?: string | null;
1662
- duration_ms?: number | null;
1663
- execution_id: string;
1664
- organization_id: string;
1665
- resource_id: string;
1666
- total_cost_usd: number;
1667
- total_input_tokens: number;
1668
- total_output_tokens: number;
1669
- };
1670
- Update: {
1671
- ai_call_count?: number;
1672
- ai_calls?: Json | null;
1673
- automation_savings_usd?: number | null;
1674
- created_at?: string | null;
1675
- duration_ms?: number | null;
1676
- execution_id?: string;
1677
- organization_id?: string;
1678
- resource_id?: string;
1679
- total_cost_usd?: number;
1680
- total_input_tokens?: number;
1681
- total_output_tokens?: number;
1682
- };
1683
- Relationships: [
1684
- {
1685
- foreignKeyName: "execution_metrics_execution_id_fkey";
1686
- columns: ["execution_id"];
1687
- isOneToOne: true;
1688
- referencedRelation: "execution_logs";
1689
- referencedColumns: ["execution_id"];
1690
- },
1691
- {
1692
- foreignKeyName: "execution_metrics_organization_id_fkey";
1693
- columns: ["organization_id"];
1694
- isOneToOne: false;
1695
- referencedRelation: "organizations";
1696
- referencedColumns: ["id"];
1697
- }
1698
- ];
1699
- };
1700
- notifications: {
1701
- Row: {
1702
- action_url: string | null;
1703
- category: string;
1704
- created_at: string | null;
1705
- id: string;
1706
- message: string;
1707
- organization_id: string;
1708
- read: boolean | null;
1709
- read_at: string | null;
1710
- title: string;
1711
- user_id: string;
1712
- };
1713
- Insert: {
1714
- action_url?: string | null;
1715
- category: string;
1716
- created_at?: string | null;
1717
- id?: string;
1718
- message: string;
1719
- organization_id: string;
1720
- read?: boolean | null;
1721
- read_at?: string | null;
1722
- title: string;
1723
- user_id: string;
1724
- };
1725
- Update: {
1726
- action_url?: string | null;
1727
- category?: string;
1728
- created_at?: string | null;
1729
- id?: string;
1730
- message?: string;
1731
- organization_id?: string;
1732
- read?: boolean | null;
1733
- read_at?: string | null;
1734
- title?: string;
1735
- user_id?: string;
1736
- };
1737
- Relationships: [
1738
- {
1739
- foreignKeyName: "notifications_organization_id_fkey";
1740
- columns: ["organization_id"];
1741
- isOneToOne: false;
1742
- referencedRelation: "organizations";
1743
- referencedColumns: ["id"];
1744
- },
1745
- {
1746
- foreignKeyName: "notifications_user_id_fkey";
1747
- columns: ["user_id"];
1748
- isOneToOne: false;
1749
- referencedRelation: "users";
1750
- referencedColumns: ["id"];
1751
- }
1752
- ];
1753
- };
1754
- org_invitations: {
1755
- Row: {
1756
- accept_invitation_url: string | null;
1757
- accepted_at: string | null;
1758
- created_at: string | null;
1759
- email: string;
1760
- expires_at: string;
1761
- id: string;
1762
- invitation_state: string | null;
1763
- invitation_token: string | null;
1764
- inviter_user_id: string | null;
1765
- organization_id: string | null;
1766
- revoked_at: string | null;
1767
- role_slug: string | null;
1768
- updated_at: string | null;
1769
- workos_invitation_id: string;
1770
- };
1771
- Insert: {
1772
- accept_invitation_url?: string | null;
1773
- accepted_at?: string | null;
1774
- created_at?: string | null;
1775
- email: string;
1776
- expires_at: string;
1777
- id?: string;
1778
- invitation_state?: string | null;
1779
- invitation_token?: string | null;
1780
- inviter_user_id?: string | null;
1781
- organization_id?: string | null;
1782
- revoked_at?: string | null;
1783
- role_slug?: string | null;
1784
- updated_at?: string | null;
1785
- workos_invitation_id: string;
1786
- };
1787
- Update: {
1788
- accept_invitation_url?: string | null;
1789
- accepted_at?: string | null;
1790
- created_at?: string | null;
1791
- email?: string;
1792
- expires_at?: string;
1793
- id?: string;
1794
- invitation_state?: string | null;
1795
- invitation_token?: string | null;
1796
- inviter_user_id?: string | null;
1797
- organization_id?: string | null;
1798
- revoked_at?: string | null;
1799
- role_slug?: string | null;
1800
- updated_at?: string | null;
1801
- workos_invitation_id?: string;
1802
- };
1803
- Relationships: [
1804
- {
1805
- foreignKeyName: "org_invitations_inviter_user_id_fkey";
1806
- columns: ["inviter_user_id"];
1807
- isOneToOne: false;
1808
- referencedRelation: "users";
1809
- referencedColumns: ["id"];
1810
- },
1811
- {
1812
- foreignKeyName: "org_invitations_organization_id_fkey";
1813
- columns: ["organization_id"];
1814
- isOneToOne: false;
1815
- referencedRelation: "organizations";
1816
- referencedColumns: ["id"];
1817
- }
1818
- ];
1819
- };
1820
- org_memberships: {
1821
- Row: {
1822
- config: Json;
1823
- created_at: string | null;
1824
- id: string;
1825
- membership_status: string | null;
1826
- organization_id: string;
1827
- role_slug: string | null;
1828
- updated_at: string | null;
1829
- user_id: string;
1830
- workos_membership_id: string | null;
1831
- };
1832
- Insert: {
1833
- config?: Json;
1834
- created_at?: string | null;
1835
- id?: string;
1836
- membership_status?: string | null;
1837
- organization_id: string;
1838
- role_slug?: string | null;
1839
- updated_at?: string | null;
1840
- user_id: string;
1841
- workos_membership_id?: string | null;
1842
- };
1843
- Update: {
1844
- config?: Json;
1845
- created_at?: string | null;
1846
- id?: string;
1847
- membership_status?: string | null;
1848
- organization_id?: string;
1849
- role_slug?: string | null;
1850
- updated_at?: string | null;
1851
- user_id?: string;
1852
- workos_membership_id?: string | null;
1853
- };
1854
- Relationships: [
1855
- {
1856
- foreignKeyName: "org_memberships_organization_id_fkey";
1857
- columns: ["organization_id"];
1858
- isOneToOne: false;
1859
- referencedRelation: "organizations";
1860
- referencedColumns: ["id"];
1861
- },
1862
- {
1863
- foreignKeyName: "org_memberships_user_id_fkey";
1864
- columns: ["user_id"];
1865
- isOneToOne: false;
1866
- referencedRelation: "users";
1867
- referencedColumns: ["id"];
1868
- }
1869
- ];
1870
- };
1871
- organizations: {
1872
- Row: {
1873
- config: Json;
1874
- created_at: string;
1875
- id: string;
1876
- is_test: boolean;
1877
- metadata: Json;
1878
- name: string;
1879
- status: string;
1880
- updated_at: string;
1881
- workos_org_id: string;
1882
- };
1883
- Insert: {
1884
- config?: Json;
1885
- created_at?: string;
1886
- id?: string;
1887
- is_test?: boolean;
1888
- metadata?: Json;
1889
- name: string;
1890
- status?: string;
1891
- updated_at?: string;
1892
- workos_org_id: string;
1893
- };
1894
- Update: {
1895
- config?: Json;
1896
- created_at?: string;
1897
- id?: string;
1898
- is_test?: boolean;
1899
- metadata?: Json;
1900
- name?: string;
1901
- status?: string;
1902
- updated_at?: string;
1903
- workos_org_id?: string;
1904
- };
1905
- Relationships: [];
1906
- };
1907
- session_messages: {
1908
- Row: {
1909
- created_at: string | null;
1910
- id: string;
1911
- message: string;
1912
- message_index: number | null;
1913
- message_type: string | null;
1914
- metadata: Json | null;
1915
- role: string;
1916
- session_id: string;
1917
- session_turn_number: number;
1918
- };
1919
- Insert: {
1920
- created_at?: string | null;
1921
- id: string;
1922
- message: string;
1923
- message_index?: number | null;
1924
- message_type?: string | null;
1925
- metadata?: Json | null;
1926
- role: string;
1927
- session_id: string;
1928
- session_turn_number: number;
1929
- };
1930
- Update: {
1931
- created_at?: string | null;
1932
- id?: string;
1933
- message?: string;
1934
- message_index?: number | null;
1935
- message_type?: string | null;
1936
- metadata?: Json | null;
1937
- role?: string;
1938
- session_id?: string;
1939
- session_turn_number?: number;
1940
- };
1941
- Relationships: [
1942
- {
1943
- foreignKeyName: "session_messages_session_id_fkey";
1944
- columns: ["session_id"];
1945
- isOneToOne: false;
1946
- referencedRelation: "sessions";
1947
- referencedColumns: ["session_id"];
1948
- }
1949
- ];
1950
- };
1951
- sessions: {
1952
- Row: {
1953
- context_window_size: number;
1954
- created_at: string | null;
1955
- cumulative_input_tokens: number;
1956
- cumulative_output_tokens: number;
1957
- deleted_at: string | null;
1958
- ended_at: string | null;
1959
- memory_snapshot: Json;
1960
- metadata: Json | null;
1961
- organization_id: string;
1962
- resource_id: string;
1963
- session_id: string;
1964
- session_total_turns: number | null;
1965
- updated_at: string | null;
1966
- user_id: string | null;
1967
- };
1968
- Insert: {
1969
- context_window_size?: number;
1970
- created_at?: string | null;
1971
- cumulative_input_tokens?: number;
1972
- cumulative_output_tokens?: number;
1973
- deleted_at?: string | null;
1974
- ended_at?: string | null;
1975
- memory_snapshot: Json;
1976
- metadata?: Json | null;
1977
- organization_id: string;
1978
- resource_id: string;
1979
- session_id?: string;
1980
- session_total_turns?: number | null;
1981
- updated_at?: string | null;
1982
- user_id?: string | null;
1983
- };
1984
- Update: {
1985
- context_window_size?: number;
1986
- created_at?: string | null;
1987
- cumulative_input_tokens?: number;
1988
- cumulative_output_tokens?: number;
1989
- deleted_at?: string | null;
1990
- ended_at?: string | null;
1991
- memory_snapshot?: Json;
1992
- metadata?: Json | null;
1993
- organization_id?: string;
1994
- resource_id?: string;
1995
- session_id?: string;
1996
- session_total_turns?: number | null;
1997
- updated_at?: string | null;
1998
- user_id?: string | null;
1999
- };
2000
- Relationships: [
2001
- {
2002
- foreignKeyName: "fk_organization";
2003
- columns: ["organization_id"];
2004
- isOneToOne: false;
2005
- referencedRelation: "organizations";
2006
- referencedColumns: ["id"];
2007
- },
2008
- {
2009
- foreignKeyName: "fk_user";
2010
- columns: ["user_id"];
2011
- isOneToOne: false;
2012
- referencedRelation: "users";
2013
- referencedColumns: ["id"];
2014
- }
2015
- ];
2016
- };
2017
- task_schedules: {
2018
- Row: {
2019
- created_at: string;
2020
- current_step: number;
2021
- description: string | null;
2022
- id: string;
2023
- idempotency_key: string | null;
2024
- last_execution_id: string | null;
2025
- last_run_at: string | null;
2026
- max_retries: number;
2027
- metadata: Json | null;
2028
- name: string;
2029
- next_run_at: string | null;
2030
- organization_id: string;
2031
- origin_execution_id: string | null;
2032
- origin_resource_id: string | null;
2033
- origin_resource_type: string | null;
2034
- retry_count: number;
2035
- schedule_config: Json;
2036
- status: string;
2037
- target_resource_id: string;
2038
- target_resource_type: string;
2039
- updated_at: string;
2040
- };
2041
- Insert: {
2042
- created_at?: string;
2043
- current_step?: number;
2044
- description?: string | null;
2045
- id?: string;
2046
- idempotency_key?: string | null;
2047
- last_execution_id?: string | null;
2048
- last_run_at?: string | null;
2049
- max_retries?: number;
2050
- metadata?: Json | null;
2051
- name: string;
2052
- next_run_at?: string | null;
2053
- organization_id: string;
2054
- origin_execution_id?: string | null;
2055
- origin_resource_id?: string | null;
2056
- origin_resource_type?: string | null;
2057
- retry_count?: number;
2058
- schedule_config: Json;
2059
- status?: string;
2060
- target_resource_id: string;
2061
- target_resource_type: string;
2062
- updated_at?: string;
2063
- };
2064
- Update: {
2065
- created_at?: string;
2066
- current_step?: number;
2067
- description?: string | null;
2068
- id?: string;
2069
- idempotency_key?: string | null;
2070
- last_execution_id?: string | null;
2071
- last_run_at?: string | null;
2072
- max_retries?: number;
2073
- metadata?: Json | null;
2074
- name?: string;
2075
- next_run_at?: string | null;
2076
- organization_id?: string;
2077
- origin_execution_id?: string | null;
2078
- origin_resource_id?: string | null;
2079
- origin_resource_type?: string | null;
2080
- retry_count?: number;
2081
- schedule_config?: Json;
2082
- status?: string;
2083
- target_resource_id?: string;
2084
- target_resource_type?: string;
2085
- updated_at?: string;
2086
- };
2087
- Relationships: [
2088
- {
2089
- foreignKeyName: "task_schedules_organization_id_fkey";
2090
- columns: ["organization_id"];
2091
- isOneToOne: false;
2092
- referencedRelation: "organizations";
2093
- referencedColumns: ["id"];
2094
- }
2095
- ];
2096
- };
2097
- training_assessments: {
2098
- Row: {
2099
- answers: Json | null;
2100
- assessment_slug: string;
2101
- attempted_at: string;
2102
- course_slug: string;
2103
- id: string;
2104
- organization_id: string;
2105
- passed: boolean;
2106
- score: number;
2107
- user_id: string;
2108
- };
2109
- Insert: {
2110
- answers?: Json | null;
2111
- assessment_slug: string;
2112
- attempted_at?: string;
2113
- course_slug: string;
2114
- id?: string;
2115
- organization_id: string;
2116
- passed: boolean;
2117
- score: number;
2118
- user_id: string;
2119
- };
2120
- Update: {
2121
- answers?: Json | null;
2122
- assessment_slug?: string;
2123
- attempted_at?: string;
2124
- course_slug?: string;
2125
- id?: string;
2126
- organization_id?: string;
2127
- passed?: boolean;
2128
- score?: number;
2129
- user_id?: string;
2130
- };
2131
- Relationships: [
2132
- {
2133
- foreignKeyName: "training_assessments_organization_id_fkey";
2134
- columns: ["organization_id"];
2135
- isOneToOne: false;
2136
- referencedRelation: "organizations";
2137
- referencedColumns: ["id"];
2138
- },
2139
- {
2140
- foreignKeyName: "training_assessments_user_id_fkey";
2141
- columns: ["user_id"];
2142
- isOneToOne: false;
2143
- referencedRelation: "users";
2144
- referencedColumns: ["id"];
2145
- }
2146
- ];
2147
- };
2148
- training_certifications: {
2149
- Row: {
2150
- awarded_at: string;
2151
- certification_slug: string;
2152
- id: string;
2153
- organization_id: string;
2154
- user_id: string;
2155
- };
2156
- Insert: {
2157
- awarded_at?: string;
2158
- certification_slug: string;
2159
- id?: string;
2160
- organization_id: string;
2161
- user_id: string;
2162
- };
2163
- Update: {
2164
- awarded_at?: string;
2165
- certification_slug?: string;
2166
- id?: string;
2167
- organization_id?: string;
2168
- user_id?: string;
2169
- };
2170
- Relationships: [
2171
- {
2172
- foreignKeyName: "training_certifications_organization_id_fkey";
2173
- columns: ["organization_id"];
2174
- isOneToOne: false;
2175
- referencedRelation: "organizations";
2176
- referencedColumns: ["id"];
2177
- },
2178
- {
2179
- foreignKeyName: "training_certifications_user_id_fkey";
2180
- columns: ["user_id"];
2181
- isOneToOne: false;
2182
- referencedRelation: "users";
2183
- referencedColumns: ["id"];
2184
- }
2185
- ];
2186
- };
2187
- training_progress: {
2188
- Row: {
2189
- completed_at: string;
2190
- course_slug: string;
2191
- id: string;
2192
- lesson_slug: string;
2193
- organization_id: string;
2194
- user_id: string;
2195
- };
2196
- Insert: {
2197
- completed_at?: string;
2198
- course_slug: string;
2199
- id?: string;
2200
- lesson_slug: string;
2201
- organization_id: string;
2202
- user_id: string;
2203
- };
2204
- Update: {
2205
- completed_at?: string;
2206
- course_slug?: string;
2207
- id?: string;
2208
- lesson_slug?: string;
2209
- organization_id?: string;
2210
- user_id?: string;
2211
- };
2212
- Relationships: [
2213
- {
2214
- foreignKeyName: "training_progress_organization_id_fkey";
2215
- columns: ["organization_id"];
2216
- isOneToOne: false;
2217
- referencedRelation: "organizations";
2218
- referencedColumns: ["id"];
2219
- },
2220
- {
2221
- foreignKeyName: "training_progress_user_id_fkey";
2222
- columns: ["user_id"];
2223
- isOneToOne: false;
2224
- referencedRelation: "users";
2225
- referencedColumns: ["id"];
2226
- }
2227
- ];
2228
- };
2229
- users: {
2230
- Row: {
2231
- config: Json;
2232
- created_at: string;
2233
- display_name: string | null;
2234
- email: string;
2235
- first_name: string | null;
2236
- id: string;
2237
- is_active: boolean;
2238
- is_platform_admin: boolean | null;
2239
- last_login_at: string | null;
2240
- last_name: string | null;
2241
- last_visited_org: string | null;
2242
- profile_picture_url: string | null;
2243
- updated_at: string;
2244
- workos_user_id: string | null;
2245
- };
2246
- Insert: {
2247
- config?: Json;
2248
- created_at?: string;
2249
- display_name?: string | null;
2250
- email: string;
2251
- first_name?: string | null;
2252
- id?: string;
2253
- is_active?: boolean;
2254
- is_platform_admin?: boolean | null;
2255
- last_login_at?: string | null;
2256
- last_name?: string | null;
2257
- last_visited_org?: string | null;
2258
- profile_picture_url?: string | null;
2259
- updated_at?: string;
2260
- workos_user_id?: string | null;
2261
- };
2262
- Update: {
2263
- config?: Json;
2264
- created_at?: string;
2265
- display_name?: string | null;
2266
- email?: string;
2267
- first_name?: string | null;
2268
- id?: string;
2269
- is_active?: boolean;
2270
- is_platform_admin?: boolean | null;
2271
- last_login_at?: string | null;
2272
- last_name?: string | null;
2273
- last_visited_org?: string | null;
2274
- profile_picture_url?: string | null;
2275
- updated_at?: string;
2276
- workos_user_id?: string | null;
2277
- };
2278
- Relationships: [
2279
- {
2280
- foreignKeyName: "user_profiles_last_visited_org_fkey";
2281
- columns: ["last_visited_org"];
2282
- isOneToOne: false;
2283
- referencedRelation: "organizations";
2284
- referencedColumns: ["id"];
2285
- }
2286
- ];
2287
- };
2288
- webhook_endpoints: {
2289
- Row: {
2290
- created_at: string;
2291
- description: string | null;
2292
- id: string;
2293
- key: string;
2294
- last_triggered_at: string | null;
2295
- name: string;
2296
- organization_id: string;
2297
- request_count: number;
2298
- resource_id: string | null;
2299
- status: string;
2300
- updated_at: string;
2301
- };
2302
- Insert: {
2303
- created_at?: string;
2304
- description?: string | null;
2305
- id?: string;
2306
- key: string;
2307
- last_triggered_at?: string | null;
2308
- name: string;
2309
- organization_id: string;
2310
- request_count?: number;
2311
- resource_id?: string | null;
2312
- status?: string;
2313
- updated_at?: string;
2314
- };
2315
- Update: {
2316
- created_at?: string;
2317
- description?: string | null;
2318
- id?: string;
2319
- key?: string;
2320
- last_triggered_at?: string | null;
2321
- name?: string;
2322
- organization_id?: string;
2323
- request_count?: number;
2324
- resource_id?: string | null;
2325
- status?: string;
2326
- updated_at?: string;
2327
- };
2328
- Relationships: [
2329
- {
2330
- foreignKeyName: "webhook_endpoints_organization_id_fkey";
2331
- columns: ["organization_id"];
2332
- isOneToOne: false;
2333
- referencedRelation: "organizations";
2334
- referencedColumns: ["id"];
2335
- }
2336
- ];
2337
- };
2338
- };
2339
- Views: {
2340
- [_ in never]: never;
2341
- };
2342
- Functions: {
2343
- acq_default_checklist: {
2344
- Args: {
2345
- p_platform: string;
2346
- };
2347
- Returns: Json;
2348
- };
2349
- append_deal_activity: {
2350
- Args: {
2351
- p_activity: Json;
2352
- p_deal_id: string;
2353
- p_organization_id: string;
2354
- };
2355
- Returns: undefined;
2356
- };
2357
- auth_jwt_claims: {
2358
- Args: never;
2359
- Returns: Json;
2360
- };
2361
- auth_uid_safe: {
2362
- Args: never;
2363
- Returns: string;
2364
- };
2365
- current_user_is_platform_admin: {
2366
- Args: never;
2367
- Returns: boolean;
2368
- };
2369
- current_user_supabase_id: {
2370
- Args: never;
2371
- Returns: string;
2372
- };
2373
- detect_stalled_executions: {
2374
- Args: never;
2375
- Returns: undefined;
2376
- };
2377
- execute_session_turn: {
2378
- Args: {
2379
- p_session_id: string;
2380
- };
2381
- Returns: {
2382
- created_at: string;
2383
- ended_at: string;
2384
- memory_snapshot: Json;
2385
- metadata: Json;
2386
- organization_id: string;
2387
- resource_id: string;
2388
- session_id: string;
2389
- session_total_turns: number;
2390
- updated_at: string;
2391
- user_id: string;
2392
- }[];
2393
- };
2394
- get_storage_org_id: {
2395
- Args: {
2396
- file_path: string;
2397
- };
2398
- Returns: string;
2399
- };
2400
- get_workos_user_id: {
2401
- Args: never;
2402
- Returns: string;
2403
- };
2404
- is_org_admin: {
2405
- Args: {
2406
- org_id: string;
2407
- };
2408
- Returns: boolean;
2409
- };
2410
- is_org_member: {
2411
- Args: {
2412
- org_id: string;
2413
- };
2414
- Returns: boolean;
2415
- };
2416
- link_workos_membership_on_accept: {
2417
- Args: {
2418
- p_email: string;
2419
- p_organization_id: string;
2420
- p_workos_membership_id: string;
2421
- };
2422
- Returns: boolean;
2423
- };
2424
- pre_provision_invited_user: {
2425
- Args: {
2426
- p_email: string;
2427
- p_organization_id: string;
2428
- p_role_slug?: string;
2429
- };
2430
- Returns: Json;
2431
- };
2432
- process_due_schedules: {
2433
- Args: never;
2434
- Returns: Json;
2435
- };
2436
- upsert_user_profile: {
2437
- Args: never;
2438
- Returns: {
2439
- profile_display_name: string;
2440
- profile_email: string;
2441
- profile_id: string;
2442
- profile_workos_user_id: string;
2443
- }[];
2444
- };
2445
- };
2446
- Enums: {
2447
- [_ in never]: never;
2448
- };
2449
- CompositeTypes: {
2450
- [_ in never]: never;
2451
- };
2452
- };
2453
- };
2454
- type DatabaseWithoutInternals = Omit<Database, "__InternalSupabase">;
2455
- type DefaultSchema = DatabaseWithoutInternals[Extract<keyof Database, "public">];
2456
- type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) | {
2457
- schema: keyof DatabaseWithoutInternals;
2458
- }, TableName extends DefaultSchemaTableNameOrOptions extends {
2459
- schema: keyof DatabaseWithoutInternals;
2460
- } ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) : never = never> = DefaultSchemaTableNameOrOptions extends {
2461
- schema: keyof DatabaseWithoutInternals;
2462
- } ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends {
2463
- Row: infer R;
2464
- } ? R : never : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) ? (DefaultSchema["Tables"] & DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends {
2465
- Row: infer R;
2466
- } ? R : never : never;
2467
-
2468
- type SupabaseUserProfile = Tables<'users'>;
2469
-
2470
- /**
2471
- * Action configuration for HITL tasks
2472
- * Defines available user actions and their behavior
2473
- */
2474
- interface ActionConfig {
2475
- /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
2476
- id: string;
2477
- /** Display label for UI button */
2478
- label: string;
2479
- /** Button variant/style */
2480
- type: 'primary' | 'secondary' | 'danger' | 'outline';
2481
- /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
2482
- icon?: string;
2483
- /** Button color (Mantine theme colors) */
2484
- color?: string;
2485
- /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
2486
- variant?: string;
2487
- /** Execution target (agent/workflow to invoke) */
2488
- target?: {
2489
- resourceType: 'agent' | 'workflow';
2490
- resourceId: string;
2491
- /**
2492
- * Optional session ID for agent continuation.
2493
- * If provided, invokes a new turn on the existing session instead of standalone execution.
2494
- * Only valid when resourceType is 'agent'.
2495
- */
2496
- sessionId?: string;
2497
- };
2498
- /** Form schema for collecting action-specific data */
2499
- form?: FormSchema;
2500
- /** Payload template for pre-filling forms */
2501
- payloadTemplate?: unknown;
2502
- /** Requires confirmation dialog */
2503
- requiresConfirmation?: boolean;
2504
- /** Confirmation message */
2505
- confirmationMessage?: string;
2506
- /** Help text / tooltip */
2507
- description?: string;
2508
- }
2509
-
2510
- /**
2511
- * Origin resource type - where an execution/task originated from.
2512
- * Used for audit trails and tracking execution lineage.
2513
- */
2514
- type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
2515
- /**
2516
- * Origin tracking metadata - who/what created this execution/task.
2517
- * Used by both TaskScheduler and CommandQueue for complete audit trails.
2518
- */
2519
- interface OriginTracking {
2520
- originExecutionId: string;
2521
- originResourceType: OriginResourceType;
2522
- originResourceId: string;
2523
- }
2524
-
2525
- /**
2526
- * Command queue task with flexible action system
2527
- */
2528
- interface Task extends OriginTracking {
2529
- id: string;
2530
- organizationId: string;
2531
- actions: ActionConfig[];
2532
- context: unknown;
2533
- selectedAction?: string;
2534
- actionPayload?: unknown;
2535
- description?: string;
2536
- priority: number;
2537
- /** Optional checkpoint identifier for grouping related human approval tasks */
2538
- humanCheckpoint?: string;
2539
- status: TaskStatus;
2540
- /**
2541
- * Target resource tracking — mirrors origin columns.
2542
- * Set when task is created; patchable to redirect execution to a different resource.
2543
- */
2544
- targetResourceId?: string;
2545
- targetResourceType?: 'agent' | 'workflow';
2546
- /**
2547
- * Execution ID for the action that runs AFTER user approval.
2548
- * NULL until execution starts.
2549
- *
2550
- * Naming distinction:
2551
- * - originExecutionId = Parent execution that CREATED the HITL task
2552
- * - targetExecutionId = Child execution that RUNS AFTER user approval
2553
- */
2554
- targetExecutionId?: string;
2555
- createdAt: Date;
2556
- completedAt?: Date;
2557
- completedBy?: string;
2558
- expiresAt?: Date;
2559
- idempotencyKey?: string | null;
2560
- }
2561
- /**
2562
- * Task status values
2563
- * - pending: awaiting action
2564
- * - processing: execution in progress after user approval
2565
- * - completed: action was taken and execution succeeded
2566
- * - failed: execution failed, task can be retried
2567
- * - expired: timed out before action
2568
- */
2569
- type TaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
2570
- /**
2571
- * Parameters for patching mutable metadata on a task
2572
- */
2573
- interface PatchTaskParams {
2574
- humanCheckpoint?: string | null;
2575
- description?: string;
2576
- priority?: number;
2577
- context?: Record<string, unknown>;
2578
- actions?: unknown[];
2579
- targetResourceId?: string | null;
2580
- targetResourceType?: 'agent' | 'workflow' | null;
2581
- targetExecutionId?: string;
2582
- status?: 'pending' | 'failed' | 'completed';
2583
- }
2584
-
2585
- /**
2586
- * Checkpoint list item for sidebar grouping
2587
- * The id field contains the resourceId of the human checkpoint
2588
- */
2589
- interface CheckpointListItem {
2590
- /** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
2591
- id: string;
2592
- /** Display name (same as id, or "Ungrouped" for null) */
2593
- name: string;
2594
- /** Task count for this checkpoint */
2595
- count: number;
2596
- }
2597
- /**
2598
- * Status counts for pie chart display
2599
- */
2600
- interface StatusCounts {
2601
- pending: number;
2602
- completed: number;
2603
- expired: number;
2604
- }
2605
- /**
2606
- * Priority counts for donut chart display
2607
- */
2608
- interface PriorityCounts {
2609
- critical: number;
2610
- high: number;
2611
- medium: number;
2612
- low: number;
2613
- }
2614
- /**
2615
- * Response from GET /command-queue/checkpoints endpoint
2616
- */
2617
- interface CheckpointListResponse {
2618
- checkpoints: CheckpointListItem[];
2619
- /** Total tasks across all checkpoints */
2620
- total: number;
2621
- /** Breakdown by status for donut chart */
2622
- statusCounts: StatusCounts;
2623
- /** Breakdown by priority for donut chart */
2624
- priorityCounts: PriorityCounts;
2625
- }
2626
-
2627
- /**
2628
- * Target for schedule execution - identifies what resource to execute.
2629
- * Unlike ExecutionTarget, payload is NOT included here because schedules
2630
- * store payload in the scheduleConfig (varies per step/item).
2631
- */
2632
- interface ScheduleTarget {
2633
- resourceType: 'agent' | 'workflow';
2634
- resourceId: string;
2635
- }
2636
- /**
2637
- * Optional origin tracking for schedules.
2638
- * Unlike OriginTracking (which is required), these fields are all optional
2639
- * for schedules created directly via API (not triggered by another resource).
2640
- */
2641
- interface ScheduleOriginTracking {
2642
- originExecutionId?: string;
2643
- originResourceType?: OriginResourceType;
2644
- originResourceId?: string;
2645
- }
2646
- type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
2647
- interface RecurringScheduleConfig {
2648
- type: 'recurring';
2649
- cron?: string;
2650
- interval?: 'daily' | 'weekly' | 'monthly';
2651
- time?: string;
2652
- timezone: string;
2653
- payload: Record<string, unknown>;
2654
- endAt?: string | null;
2655
- overduePolicy?: 'skip' | 'execute';
2656
- }
2657
- interface RelativeScheduleConfig {
2658
- type: 'relative';
2659
- anchorAt: string;
2660
- anchorLabel?: string;
2661
- items: RelativeScheduleItem[];
2662
- overduePolicy?: 'skip' | 'execute';
2663
- }
2664
- interface RelativeScheduleItem {
2665
- offset: string;
2666
- payload: Record<string, unknown>;
2667
- label?: string;
2668
- }
2669
- interface AbsoluteScheduleConfig {
2670
- type: 'absolute';
2671
- items: AbsoluteScheduleItem[];
2672
- overduePolicy?: 'skip' | 'execute';
2673
- }
2674
- interface AbsoluteScheduleItem {
2675
- runAt: string;
2676
- payload: Record<string, unknown>;
2677
- label?: string;
2678
- }
2679
- interface TaskSchedule extends ScheduleOriginTracking {
2680
- id: string;
2681
- organizationId: string;
2682
- name: string;
2683
- description?: string;
2684
- target: ScheduleTarget;
2685
- scheduleConfig: TaskScheduleConfig;
2686
- nextRunAt?: Date;
2687
- currentStep: number;
2688
- status: 'active' | 'paused' | 'completed' | 'cancelled';
2689
- lastRunAt?: Date;
2690
- lastExecutionId?: string;
2691
- maxRetries: number;
2692
- idempotencyKey?: string;
2693
- createdAt: Date;
2694
- updatedAt: Date;
2695
- }
2696
-
2697
- /**
2698
- * Wire-format DTO for notification API responses.
2699
- * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
2700
- * Used by frontend hooks that consume /api/notifications.
2701
- */
2702
- interface NotificationDTO {
2703
- id: string;
2704
- userId: string;
2705
- organizationId: string;
2706
- category: string;
2707
- title: string;
2708
- message: string;
2709
- actionUrl: string | null;
2710
- read: boolean;
2711
- readAt: string | null;
2712
- createdAt: string;
2713
- }
2714
-
2715
- /**
2716
- * Session Data Transfer Object (DTO)
2717
- * Transform type for API responses (snake_case DB → camelCase frontend)
2718
- * Used by frontend apps to display session data
2719
- */
2720
- interface SessionDTO {
2721
- sessionId: string;
2722
- resourceId: string;
2723
- organizationId: string;
2724
- userId?: string | null;
2725
- turnCount: number;
2726
- isEnded: boolean;
2727
- title?: string | null;
2728
- memorySnapshot?: AgentMemory;
2729
- metadata?: Record<string, unknown> | null;
2730
- createdAt: Date;
2731
- updatedAt: Date;
2732
- endedAt?: Date | null;
2733
- }
2734
-
2735
- /**
2736
- * Multi-tenancy configuration types
2737
- *
2738
- * Config is stored in dedicated `config` columns (NOT nested in metadata):
2739
- * - organizations.config: Org-level feature config
2740
- * - org_memberships.config: Per-user-per-org feature overrides
2741
- * - users.config: User-global config (training)
2742
- */
2743
- /**
2744
- * Valid course groups (matches Category type from training)
2745
- */
2746
- type CourseGroup = 'foundation' | 'sales' | 'technical';
2747
- /**
2748
- * Org-level feature config (stored in organizations.config)
2749
- * Controls which features are available to all org members
2750
- * Valid feature keys: operations, monitoring, acquisition, calibration, seo
2751
- */
2752
- interface OrgFeatureConfig {
2753
- features?: {
2754
- operations?: boolean;
2755
- monitoring?: boolean;
2756
- acquisition?: boolean;
2757
- calibration?: boolean;
2758
- seo?: boolean;
2759
- };
2760
- training?: {
2761
- allowed_course_groups?: CourseGroup[];
2762
- };
2763
- }
2764
- /**
2765
- * Per-user-per-org config (stored in org_memberships.config)
2766
- * Overrides org-level feature config for specific users
2767
- */
2768
- type MembershipFeatureConfig = OrgFeatureConfig;
2769
- /**
2770
- * User-global config (stored in users.config)
2771
- * Training and theme are user-specific, NOT org-specific
2772
- */
2773
- interface UserConfig {
2774
- training?: {
2775
- enabled?: boolean;
2776
- allowed_courses?: string[];
2777
- allowed_course_groups?: CourseGroup[];
2778
- };
2779
- theme?: {
2780
- preset?: 'default' | 'tactical' | 'regal' | 'cyber-volt' | 'aurora' | 'rose-gold' | 'midnight' | 'ember' | 'obsidian' | 'honey' | 'abyss' | 'canopy' | 'slate' | 'cyber-strike' | 'cyber-flux' | 'cyber-void';
2781
- colorScheme?: 'light' | 'dark' | 'auto';
2782
- };
2783
- onboarding?: {
2784
- completed?: boolean;
2785
- completedAt?: string;
2786
- role?: string;
2787
- primaryUseCase?: string[];
2788
- experienceLevel?: string;
2789
- /** Onboarding guide system state (set by checklist/tour system) */
2790
- guides?: {
2791
- completedIds?: string[];
2792
- dismissed?: boolean;
2793
- completedAt?: string;
2794
- };
2795
- };
2796
- }
2797
-
2798
- /**
2799
- * Organization Membership types based on WorkOS API
2800
- */
2801
- interface OrganizationMembership {
2802
- object: 'organization_membership';
2803
- id: string;
2804
- userId: string;
2805
- organizationId: string;
2806
- role: {
2807
- slug: string;
2808
- };
2809
- status: 'active' | 'inactive';
2810
- createdAt: string;
2811
- updatedAt: string;
2812
- }
2813
- /**
2814
- * Extended membership with user and organization details for UI
2815
- */
2816
- interface MembershipWithDetails extends OrganizationMembership {
2817
- user?: {
2818
- id: string;
2819
- email: string;
2820
- firstName?: string;
2821
- lastName?: string;
2822
- profilePictureUrl?: string;
2823
- };
2824
- organization?: {
2825
- id: string;
2826
- name: string;
2827
- workos_org_id: string;
2828
- primaryDomain?: string;
2829
- is_test?: boolean;
2830
- status?: string;
2831
- metadata?: Record<string, unknown>;
2832
- config?: OrgFeatureConfig;
2833
- };
2834
- config?: MembershipFeatureConfig;
2835
- }
2836
-
2837
- /**
2838
- * Time range selector for dashboard metrics
2839
- */
2840
- type TimeRange = '1h' | '24h' | '7d' | '30d';
2841
- /**
2842
- * Execution health metrics response
2843
- * Success rate, P95 duration, execution counts, and trend data
2844
- * trendData includes executionCount for throughput visualization (eliminates separate API call)
2845
- */
2846
- interface ExecutionHealthMetrics {
2847
- successRate: number;
2848
- p95Duration: number;
2849
- totalExecutions: number;
2850
- trendData: Array<{
2851
- time: string;
2852
- rate: number;
2853
- successCount: number;
2854
- errorCount: number;
2855
- warningCount: number;
2856
- executionCount: number;
2857
- }>;
2858
- statusCounts: {
2859
- success: number;
2860
- failed: number;
2861
- pending: number;
2862
- warning: number;
2863
- };
2864
- peakPeriod: string;
2865
- granularity: 'hour' | 'day';
2866
- }
2867
- /**
2868
- * Error analysis metrics response
2869
- * Error categories and top failing resources
2870
- */
2871
- interface ErrorAnalysisMetrics {
2872
- totalErrors: number;
2873
- errorsByCategory: Array<{
2874
- category: string;
2875
- count: number;
2876
- percentage: number;
2877
- }>;
2878
- topFailingResources: Array<{
2879
- resourceId: string;
2880
- name: string;
2881
- errorCount: number;
2882
- failureRate: number;
2883
- }>;
2884
- }
2885
- /**
2886
- * Business impact metrics response
2887
- * ROI, labor savings, and cost analysis
2888
- */
2889
- interface BusinessImpactMetrics$1 {
2890
- totalSavingsUsd: number;
2891
- totalCostUsd: number;
2892
- netSavingsUsd: number;
2893
- roi: number;
2894
- }
2895
- /**
2896
- * Cost breakdown metrics response
2897
- * Per-resource cost analysis
2898
- */
2899
- interface CostBreakdownMetrics {
2900
- resources: Array<{
2901
- resourceId: string;
2902
- totalCostUsd: number;
2903
- executionCount: number;
2904
- avgCostUsd: number;
2905
- }>;
2906
- }
2907
- /**
2908
- * Dashboard metrics response
2909
- * Aggregates core observability metrics in a single response
2910
- * Note: Throughput data is now included in executionHealth.trendData.executionCount
2911
- */
2912
- interface DashboardMetrics {
2913
- executionHealth: ExecutionHealthMetrics;
2914
- costBreakdown: CostBreakdownMetrics;
2915
- businessImpact: BusinessImpactMetrics$1;
2916
- /** ISO timestamp of the currently active deployment, or null if none */
2917
- activeDeploymentDate: string | null;
2918
- /** Deployment version of the active deployment, or null if none */
2919
- activeDeploymentVersion: string | null;
2920
- }
2921
- /**
2922
- * Error record for list view (ErrorBreakdownTable)
2923
- */
2924
- interface ErrorRecord {
2925
- id: string;
2926
- timestamp: string;
2927
- errorType: string;
2928
- message: string;
2929
- executionId: string;
2930
- resourceId: string;
2931
- resourceName: string;
2932
- severity: 'critical' | 'warning' | 'info';
2933
- category: ExecutionErrorCategory;
2934
- resolved: boolean;
2935
- resolvedAt: string | null;
2936
- resolvedBy: string | null;
2937
- }
2938
- /**
2939
- * Full error detail for modal view (ErrorDetailsModal)
2940
- */
2941
- interface ErrorDetailFull extends ErrorRecord {
2942
- stackTrace?: string;
2943
- retryAttempt?: number;
2944
- stepName?: string;
2945
- stepSequence?: number;
2946
- errorContext?: Record<string, unknown>;
2947
- executionContext?: Record<string, unknown>;
2948
- }
2949
- /**
2950
- * Error details API response (paginated)
2951
- */
2952
- interface ErrorDetailResponse {
2953
- errors: ErrorRecord[];
2954
- total: number;
2955
- page: number;
2956
- limit: number;
2957
- }
2958
- /**
2959
- * Error trend data for time-series charts
2960
- */
2961
- interface ErrorTrend {
2962
- time: string;
2963
- errorCount: number;
2964
- criticalCount: number;
2965
- warningCount: number;
2966
- infoCount: number;
2967
- }
2968
- /**
2969
- * Cost trend data point for time-series charts
2970
- * Represents a single time bucket (hour or day)
2971
- */
2972
- interface CostTrendDataPoint {
2973
- time: string;
2974
- totalCostUsd: number;
2975
- executionCount: number;
2976
- avgCostPerExecution: number;
2977
- }
2978
- /**
2979
- * Cost trends response (time-series data)
2980
- */
2981
- interface CostTrendsResponse {
2982
- trendData: CostTrendDataPoint[];
2983
- granularity: 'hour' | 'day';
2984
- totalCostUsd: number;
2985
- totalExecutions: number;
2986
- }
2987
- /**
2988
- * Cost summary response with MTD and projections
2989
- */
2990
- interface CostSummaryResponse {
2991
- current: {
2992
- totalCostUsd: number;
2993
- executionCount: number;
2994
- };
2995
- previous: {
2996
- totalCostUsd: number;
2997
- executionCount: number;
2998
- };
2999
- mtd: {
3000
- totalCostUsd: number;
3001
- daysElapsed: number;
3002
- };
3003
- projection: {
3004
- monthlyCostUsd: number;
3005
- confidence: 'low' | 'medium' | 'high';
3006
- };
3007
- trend: {
3008
- changePercent: number;
3009
- direction: 'up' | 'down' | 'flat';
3010
- };
3011
- }
3012
- /**
3013
- * Cost by model data for model-level breakdown
3014
- */
3015
- interface CostByModelData {
3016
- model: string;
3017
- totalCostUsd: number;
3018
- callCount: number;
3019
- totalInputTokens: number;
3020
- totalOutputTokens: number;
3021
- avgCostPerCall: number;
3022
- }
3023
- /**
3024
- * Cost by model response
3025
- */
3026
- interface CostByModelResponse {
3027
- models: CostByModelData[];
3028
- totalCostUsd: number;
3029
- totalCallCount: number;
3030
- }
3031
-
3032
- /**
3033
- * Base Execution Engine type definitions
3034
- * Core types shared across all Execution Engine resources
3035
- */
3036
-
3037
- /**
3038
- * NOTE: AIResource interface has been removed and replaced with ResourceDefinition
3039
- * from registry/types.ts. All resources (executable and non-executable) now extend
3040
- * the unified ResourceDefinition base interface.
3041
- *
3042
- * AgentConfig and WorkflowConfig now extend ResourceDefinition directly.
3043
- * See packages/core/src/registry/types.ts for the base interface definition.
3044
- */
3045
- type AIResourceDefinition = SerializedWorkflowDefinition | SerializedAgentDefinition;
3046
-
3047
- /**
3048
- * Resource Registry type definitions
3049
- */
3050
-
3051
- /**
3052
- * Environment/deployment status for resources
3053
- */
3054
- type ResourceStatus$1 = 'dev' | 'prod';
3055
- /**
3056
- * All resource types in the platform
3057
- * Used as the discriminator field in ResourceDefinition
3058
- */
3059
- type ResourceType$1 = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
3060
- /**
3061
- * Base interface for ALL platform resources
3062
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
3063
- */
3064
- interface ResourceDefinition {
3065
- /** Unique resource identifier */
3066
- resourceId: string;
3067
- /** Display name */
3068
- name: string;
3069
- /** Purpose and functionality description */
3070
- description: string;
3071
- /** Version for change tracking and evolution */
3072
- version: string;
3073
- /** Resource type discriminator */
3074
- type: ResourceType$1;
3075
- /** Environment/deployment status */
3076
- status: ResourceStatus$1;
3077
- /** Domain tags for filtering and organization */
3078
- domains?: ResourceDomain[];
3079
- /** Whether the agent supports multi-turn sessions (agents only) */
3080
- sessionCapable?: boolean;
3081
- /** Whether the resource is local (monorepo) or remote (externally deployed) */
3082
- origin?: 'local' | 'remote';
3083
- /** Whether this resource is archived and should be excluded from registration and deployment */
3084
- archived?: boolean;
3085
- }
3086
-
3087
- /**
3088
- * Standard Domain Definitions
3089
- * Centralized domain constants and definitions for all organization resources.
3090
- */
3091
-
3092
- declare const DOMAINS: {
3093
- readonly INBOUND_PIPELINE: "inbound-pipeline";
3094
- readonly LEAD_GEN_PIPELINE: "lead-gen-pipeline";
3095
- readonly SUPPORT: "support";
3096
- readonly CLIENT_SUPPORT: "client-support";
3097
- readonly DELIVERY: "delivery";
3098
- readonly OPERATIONS: "operations";
3099
- readonly FINANCE: "finance";
3100
- readonly EXECUTIVE: "executive";
3101
- readonly INSTANTLY: "instantly";
3102
- readonly TESTING: "testing";
3103
- readonly INTERNAL: "internal";
3104
- readonly INTEGRATION: "integration";
3105
- readonly UTILITY: "utility";
3106
- readonly DIAGNOSTIC: "diagnostic";
3107
- };
3108
- /**
3109
- * ResourceDomain - Strongly typed domain identifier
3110
- * Use this type for all domain references to ensure compile-time validation.
3111
- */
3112
- type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS];
3113
-
3114
- type ExecutionStatus$1 = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
3115
-
3116
- type ActivityType = 'workflow_execution' | 'agent_run' | 'hitl_action' | 'webhook_received' | 'webhook_executed' | 'webhook_failed' | 'credential_change' | 'api_key_change' | 'deployment_change' | 'membership_change';
3117
- type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed';
3118
- interface Activity {
3119
- id: string;
3120
- organizationId: string;
3121
- activityType: ActivityType;
3122
- status: ActivityStatus;
3123
- title: string;
3124
- description: string | null;
3125
- entityType: string;
3126
- entityId: string;
3127
- entityName: string | null;
3128
- metadata: Record<string, unknown> | null;
3129
- actorId: string | null;
3130
- actorType: string | null;
3131
- occurredAt: Date;
3132
- createdAt: Date;
3133
- }
3134
-
3135
- /**
3136
- * Execution history item.
3137
- * Represents a single execution triggered by a schedule.
3138
- */
3139
- declare const ExecutionHistoryItemSchema: z.ZodObject<{
3140
- id: z.ZodString;
3141
- createdAt: z.ZodString;
3142
- status: z.ZodEnum<{
3143
- completed: "completed";
3144
- failed: "failed";
3145
- running: "running";
3146
- cancelled: "cancelled";
3147
- }>;
3148
- step: z.ZodNullable<z.ZodNumber>;
3149
- itemLabel: z.ZodNullable<z.ZodString>;
3150
- duration: z.ZodNullable<z.ZodNumber>;
3151
- error: z.ZodNullable<z.ZodString>;
3152
- }, z.core.$strip>;
3153
- /**
3154
- * Execution history response.
3155
- * Returned by GET /schedules/:id/executions with pagination.
3156
- */
3157
- declare const ExecutionHistoryResponseSchema: z.ZodObject<{
3158
- executions: z.ZodArray<z.ZodObject<{
3159
- id: z.ZodString;
3160
- createdAt: z.ZodString;
3161
- status: z.ZodEnum<{
3162
- completed: "completed";
3163
- failed: "failed";
3164
- running: "running";
3165
- cancelled: "cancelled";
3166
- }>;
3167
- step: z.ZodNullable<z.ZodNumber>;
3168
- itemLabel: z.ZodNullable<z.ZodString>;
3169
- duration: z.ZodNullable<z.ZodNumber>;
3170
- error: z.ZodNullable<z.ZodString>;
3171
- }, z.core.$strip>>;
3172
- total: z.ZodNumber;
3173
- limit: z.ZodNumber;
3174
- offset: z.ZodNumber;
3175
- }, z.core.$strip>;
3176
- type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>;
3177
- type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>;
3178
-
3179
- declare function useCommandQueue({ status, limit, offset, humanCheckpoint, timeRange, priorityMin, priorityMax, }?: {
3180
- status?: TaskStatus;
3181
- limit?: number;
3182
- offset?: number;
3183
- humanCheckpoint?: string;
3184
- timeRange?: TimeRange;
3185
- priorityMin?: number;
3186
- priorityMax?: number;
3187
- }): _tanstack_react_query.UseQueryResult<{
3188
- createdAt: Date;
3189
- completedAt: Date | undefined;
3190
- expiresAt: Date | undefined;
3191
- id: string;
3192
- organizationId: string;
3193
- actions: ActionConfig[];
3194
- context: unknown;
3195
- selectedAction?: string;
3196
- actionPayload?: unknown;
3197
- description?: string;
3198
- priority: number;
3199
- humanCheckpoint?: string;
3200
- status: TaskStatus;
3201
- targetResourceId?: string;
3202
- targetResourceType?: "agent" | "workflow";
3203
- targetExecutionId?: string;
3204
- completedBy?: string;
3205
- idempotencyKey?: string | null;
3206
- originExecutionId: string;
3207
- originResourceType: OriginResourceType;
3208
- originResourceId: string;
3209
- }[], Error>;
3210
-
3211
- interface SubmitActionRequest {
3212
- taskId: string;
3213
- actionId: string;
3214
- payload?: unknown;
3215
- notes?: string;
3216
- }
3217
- interface OptimisticContext {
3218
- previousData: Map<readonly unknown[], Task[] | undefined>;
3219
- }
3220
- interface ExecutionErrorDetails {
3221
- message: string;
3222
- type: string;
3223
- severity: 'critical' | 'warning' | 'info';
3224
- category: 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
3225
- details?: string;
3226
- }
3227
- interface SubmitActionResponse {
3228
- task: unknown;
3229
- execution?: {
3230
- executionId: string;
3231
- success: boolean;
3232
- data?: unknown;
3233
- error?: ExecutionErrorDetails;
3234
- };
3235
- }
3236
- declare function useSubmitAction(): _tanstack_react_query.UseMutationResult<SubmitActionResponse, Error, SubmitActionRequest, OptimisticContext>;
3237
-
3238
- declare function useDeleteTask(): _tanstack_react_query.UseMutationResult<void, Error, string, {
3239
- previousData: Map<readonly unknown[], Task[] | undefined>;
3240
- }>;
3241
-
3242
- interface UseCommandQueueTotalsOptions {
3243
- timeRange?: TimeRange;
3244
- priorityMin?: number;
3245
- priorityMax?: number;
3246
- /** When set, priorityCounts are scoped to this status only */
3247
- status?: 'pending' | 'completed' | 'expired';
3248
- }
3249
- /**
3250
- * Fetches command queue totals and checkpoint groupings
3251
- *
3252
- * Returns distinct human checkpoints with task counts and status breakdown.
3253
- * Used for sidebar grouping and donut charts (true totals, not paginated).
3254
- */
3255
- declare function useCommandQueueTotals({ timeRange, priorityMin, priorityMax, status }?: UseCommandQueueTotalsOptions): _tanstack_react_query.UseQueryResult<CheckpointListResponse, Error>;
3256
-
3257
- declare function usePatchTask(): _tanstack_react_query.UseMutationResult<Task, Error, {
3258
- taskId: string;
3259
- params: PatchTaskParams;
3260
- }, unknown>;
3261
-
3262
- /**
3263
- * Query key factory for executions TanStack Query hooks.
3264
- * Uses organization UUID (not name) for cache isolation.
3265
- */
3266
- declare const executionsKeys: {
3267
- all: readonly ["executions"];
3268
- resources: (orgId: string | null) => readonly ["executions", "resources", string | null];
3269
- resourceDefinition: (orgId: string | null, resourceId: string) => readonly ["executions", "definition", string | null, string];
3270
- executions: (orgId: string | null, resourceId: string) => readonly ["executions", "list", string | null, string];
3271
- execution: (orgId: string | null, resourceId: string, executionId: string) => readonly ["executions", "execution", string | null, string, string];
3272
- };
3273
-
3274
- /**
3275
- * Workflow-specific logging types and utilities
3276
- */
3277
-
3278
-
3279
-
3280
- // Workflow start/end log context
3281
- interface WorkflowExecutionContext {
3282
- type: 'workflow'
3283
- contextType: 'workflow-execution'
3284
- executionId: string
3285
- workflowId: string
3286
- workflowName?: string
3287
- organizationId: string
3288
- executionPath?: string[]
3289
- }
3290
-
3291
- // Workflow failure log context
3292
- interface WorkflowFailureContext {
3293
- type: 'workflow'
3294
- contextType: 'workflow-failure'
3295
- executionId: string
3296
- workflowId: string
3297
- error: string
3298
- }
3299
-
3300
- // Step started log context
3301
- interface StepStartedContext {
3302
- type: 'workflow'
3303
- contextType: 'step-started'
3304
- stepId: string
3305
- stepStatus: 'started'
3306
- input: unknown
3307
- startTime: number // Explicit start timestamp for timeline
3308
- }
3309
-
3310
- // Step completed log context
3311
- interface StepCompletedContext {
3312
- type: 'workflow'
3313
- contextType: 'step-completed'
3314
- stepId: string
3315
- stepStatus: 'completed'
3316
- output: unknown
3317
- duration: number
3318
- isTerminal: boolean
3319
- startTime: number // Explicit start timestamp for timeline
3320
- endTime: number // Explicit end timestamp for timeline
3321
- }
3322
-
3323
- // Step failed log context
3324
- interface StepFailedContext {
3325
- type: 'workflow'
3326
- contextType: 'step-failed'
3327
- stepId: string
3328
- stepStatus: 'failed'
3329
- error: string
3330
- duration: number
3331
- startTime: number // Explicit start timestamp for timeline
3332
- endTime: number // Explicit end timestamp for timeline
3333
- }
3334
-
3335
- // Conditional routing log context
3336
- interface ConditionalRouteContext {
3337
- type: 'workflow'
3338
- contextType: 'conditional-route'
3339
- stepId: string
3340
- target: string
3341
- error?: string
3342
- }
3343
-
3344
- // Execution path log context
3345
- interface ExecutionPathContext {
3346
- type: 'workflow'
3347
- contextType: 'execution-path'
3348
- executionPath: string[]
3349
- }
3350
-
3351
- // Union of all workflow log contexts
3352
- type WorkflowLogContext =
3353
- | WorkflowExecutionContext
3354
- | WorkflowFailureContext
3355
- | StepStartedContext
3356
- | StepCompletedContext
3357
- | StepFailedContext
3358
- | ConditionalRouteContext
3359
- | ExecutionPathContext
3360
-
3361
- /**
3362
- * Agent-specific logging types
3363
- * Simplified 2-event model: lifecycle, iteration
3364
- *
3365
- * Design Philosophy:
3366
- * - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
3367
- * - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
3368
- */
3369
-
3370
-
3371
-
3372
- // ============================================================================
3373
- // FORMAL TYPES
3374
- // ============================================================================
3375
-
3376
- /**
3377
- * Agent lifecycle stages
3378
- * Universal checkpoints that apply to all agent executions
3379
- */
3380
- type AgentLifecycle = 'initialization' | 'iteration' | 'completion'
3381
-
3382
- /**
3383
- * Iteration event types
3384
- * Activities that occur during agent iterations
3385
- */
3386
- type IterationEventType = 'reasoning' | 'action' | 'tool-call'
3387
-
3388
- // ============================================================================
3389
- // LIFECYCLE EVENTS (Structural Checkpoints)
3390
- // ============================================================================
3391
-
3392
- /**
3393
- * Base fields shared by all lifecycle events
3394
- */
3395
- interface AgentLifecycleEventBase {
3396
- type: 'agent'
3397
- agentId: string
3398
- lifecycle: AgentLifecycle
3399
- sessionId?: string // Optional: only present when agent runs in session context
3400
- }
3401
-
3402
- /**
3403
- * Lifecycle started event - emitted when a phase begins
3404
- * REQUIRED: startTime (phase has started, no end yet)
3405
- */
3406
- interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
3407
- stage: 'started'
3408
- startTime: number // REQUIRED: Phase start timestamp
3409
- iteration?: number // Only for 'iteration' lifecycle
3410
- }
3411
-
3412
- /**
3413
- * Lifecycle completed event - emitted when a phase succeeds
3414
- * REQUIRED: startTime, endTime, duration (phase has finished successfully)
3415
- */
3416
- interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
3417
- stage: 'completed'
3418
- startTime: number // REQUIRED: Phase start timestamp
3419
- endTime: number // REQUIRED: Phase end timestamp
3420
- duration: number // REQUIRED: Calculated duration (endTime - startTime)
3421
- iteration?: number // Only for 'iteration' lifecycle
3422
-
3423
- // Optional fields specific to certain lifecycles
3424
- attempts?: number // Only for 'completion' lifecycle (tracks output generation attempts: 1 or 2)
3425
- memorySize?: {
3426
- sessionMemoryKeys: number
3427
- historyEntries: number
3428
- } // Only for 'completion' lifecycle (memory snapshot metadata)
3429
- }
3430
-
3431
- /**
3432
- * Lifecycle failed event - emitted when a phase fails
3433
- * REQUIRED: startTime, endTime, duration, error (phase has finished with error)
3434
- */
3435
- interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
3436
- stage: 'failed'
3437
- startTime: number // REQUIRED: Phase start timestamp
3438
- endTime: number // REQUIRED: Phase end timestamp
3439
- duration: number // REQUIRED: Calculated duration (endTime - startTime)
3440
- error: string // REQUIRED: Error message
3441
- iteration?: number // Only for 'iteration' lifecycle
3442
- }
3443
-
3444
- /**
3445
- * Union type for all lifecycle events
3446
- * Discriminated by 'stage' field for type narrowing
3447
- */
3448
- type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent
3449
-
3450
- // ============================================================================
3451
- // ITERATION EVENTS (Execution Activities)
3452
- // ============================================================================
3453
-
3454
- /**
3455
- * Placeholder data for MVP
3456
- * Will be typed per actionType in future
3457
- */
3458
- interface ActionPlaceholderData {
3459
- message: string
3460
- }
3461
-
3462
- /**
3463
- * Iteration event - captures activities during agent iterations
3464
- * Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
3465
- */
3466
- interface AgentIterationEvent {
3467
- type: 'agent'
3468
- agentId: string
3469
- lifecycle: 'iteration' // Always iteration
3470
- eventType: IterationEventType
3471
- iteration: number
3472
- sessionId?: string // Optional: only present when agent runs in session context
3473
-
3474
- // Timeline timing fields (v2 - Clean Break)
3475
- startTime: number // Activity start timestamp
3476
- endTime: number // Activity end timestamp
3477
- duration: number // Calculated duration (endTime - startTime)
3478
-
3479
- // Conditional fields based on eventType
3480
- output?: string // For reasoning events
3481
- actionType?: string // For action events (tool-use, delegate, memory-write, etc.)
3482
- data?: ActionPlaceholderData // For action events
3483
- }
3484
-
3485
- /**
3486
- * Tool call event - captures individual tool executions during iterations
3487
- * Provides granular timing for each tool invocation
3488
- */
3489
- interface AgentToolCallEvent {
3490
- type: 'agent'
3491
- agentId: string
3492
- lifecycle: 'iteration' // Always iteration
3493
- eventType: 'tool-call' // Specific event type for tool calls
3494
- iteration: number
3495
- sessionId?: string // Optional: only present when agent runs in session context
3496
-
3497
- // Tool identification and timing
3498
- toolName: string // Tool identifier
3499
- startTime: number // Tool call start timestamp
3500
- endTime: number // Tool call end timestamp
3501
- duration: number // Calculated duration
3502
-
3503
- // Execution results
3504
- success: boolean // Whether tool execution succeeded
3505
- error?: string // Error message if failed
3506
- input?: Record<string, unknown> // Tool input parameters
3507
- output?: unknown // Tool output result
3508
- }
3509
-
3510
- // ============================================================================
3511
- // UNION TYPES
3512
- // ============================================================================
3513
-
3514
- /**
3515
- * Union type for all agent log contexts
3516
- * 3 event types total (lifecycle, iteration, tool-call)
3517
- */
3518
- type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent
3519
-
3520
- /**
3521
- * Base execution logger for Execution Engine
3522
- */
3523
- type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error'
3524
-
3525
-
3526
- // Union type for all contexts
3527
- type LogContext = WorkflowLogContext | AgentLogContext
3528
-
3529
- // Updated interface with consolidated context
3530
- interface ExecutionLogMessage {
3531
- level: ExecutionLogLevel
3532
- message: string
3533
- timestamp: number
3534
- context?: LogContext
3535
- }
3536
-
3537
- /**
3538
- * Resource Registry type definitions
3539
- */
3540
-
3541
-
3542
-
3543
- // ============================================================================
3544
- // Core Resource Type Definitions
3545
- // ============================================================================
3546
-
3547
- /**
3548
- * Environment/deployment status for resources
3549
- */
3550
- type ResourceStatus = 'dev' | 'prod'
3551
-
3552
- /**
3553
- * All resource types in the platform
3554
- * Used as the discriminator field in ResourceDefinition
3555
- */
3556
- type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
3557
-
3558
- // Execution status type shared between API and UI
3559
- type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning'
3560
-
3561
- // API execution types
3562
- interface APIExecutionSummary {
3563
- id: string
3564
- status: ExecutionStatus
3565
- startTime: number
3566
- endTime?: number
3567
- resourceStatus?: ResourceStatus // 'dev' | 'prod' - optional for backward compatibility
3568
- }
3569
-
3570
- interface APIExecutionDetail extends APIExecutionSummary {
3571
- executionLogs: ExecutionLogMessage[]
3572
- input?: unknown
3573
- result?: unknown
3574
- error?: string
3575
- resourceStatus: ResourceStatus // Required in detail view
3576
- apiVersion?: string | null
3577
- resourceVersion?: string | null
3578
- sdkVersion?: string | null
3579
- }
3580
-
3581
- // API request/response types
3582
- interface APIExecutionListResponse {
3583
- executions: APIExecutionSummary[]
3584
- }
3585
-
3586
- /**
3587
- * Fetch the execution list for a given resource.
3588
- *
3589
- * resourceStatus and limit are intentionally excluded from the query key so that
3590
- * SSE invalidations (which target the unfiltered key) bust all filter variants.
3591
- *
3592
- * @example
3593
- * const { data, isLoading } = useExecutions(resourceId)
3594
- *
3595
- * @example
3596
- * // With status filter and limit
3597
- * const { data } = useExecutions(resourceId, 'running', 20)
3598
- */
3599
- declare function useExecutions(resourceId: string, resourceStatus?: ResourceStatus | 'all', limit?: number): _tanstack_react_query.UseQueryResult<APIExecutionListResponse, Error>;
3600
-
3601
- /**
3602
- * Fetch a single execution detail.
3603
- * Automatically polls every 2 seconds while the execution status is 'running'.
3604
- *
3605
- * @example
3606
- * const { data: execution, isLoading } = useExecution(resourceId, executionId)
3607
- */
3608
- declare function useExecution(resourceId: string, executionId: string): _tanstack_react_query.UseQueryResult<APIExecutionDetail, Error>;
3609
-
3610
- interface ExecuteAsyncParams {
3611
- resourceId: string;
3612
- resourceType: ResourceType;
3613
- input: unknown;
3614
- }
3615
- interface ExecuteAsyncResult {
3616
- executionId: string;
3617
- status: string;
3618
- resourceId: string;
3619
- }
3620
- /**
3621
- * Trigger an async execution for a workflow or agent.
3622
- * Invalidates the executions list on success so the new execution appears immediately.
3623
- *
3624
- * @example
3625
- * const { mutate: execute, isPending } = useExecuteAsync()
3626
- * execute({ resourceId, resourceType: 'workflow', input: { ... } })
3627
- */
3628
- declare function useExecuteAsync(): _tanstack_react_query.UseMutationResult<ExecuteAsyncResult, Error, ExecuteAsyncParams, unknown>;
3629
-
3630
- interface RetryExecutionParams {
3631
- resourceId: string;
3632
- resourceType: ResourceType;
3633
- input: unknown;
3634
- }
3635
- /**
3636
- * Retry a failed execution by re-triggering it async.
3637
- * Functionally identical to useExecuteAsync but named for intent clarity at call sites.
3638
- */
3639
- declare function useRetryExecution(): _tanstack_react_query.UseMutationResult<{
3640
- resourceId: string;
3641
- executionId: string;
3642
- status: string;
3643
- }, Error, RetryExecutionParams, unknown>;
3644
-
3645
- interface CancelExecutionParams {
3646
- resourceId: string;
3647
- executionId: string;
3648
- }
3649
- interface CancelExecutionResult {
3650
- cancelled: boolean;
3651
- method: string;
3652
- resourceId: string;
3653
- executionId: string;
3654
- }
3655
- /**
3656
- * Cancel a running execution.
3657
- * Invalidates both the execution detail and the executions list on success.
3658
- *
3659
- * @example
3660
- * const { mutate: cancel, isPending } = useCancelExecution()
3661
- * cancel({ resourceId, executionId })
3662
- */
3663
- declare function useCancelExecution(): _tanstack_react_query.UseMutationResult<CancelExecutionResult, Error, CancelExecutionParams, unknown>;
3664
-
3665
- interface DeleteExecutionParams {
3666
- resourceId: string;
3667
- executionId: string;
3668
- }
3669
- /**
3670
- * Delete a single execution record.
3671
- * Removes the execution from cache immediately and invalidates the list.
3672
- */
3673
- declare function useDeleteExecution(): _tanstack_react_query.UseMutationResult<{
3674
- resourceId: string;
3675
- executionId: string;
3676
- }, Error, DeleteExecutionParams, unknown>;
3677
-
3678
- interface BulkDeleteExecutionsParams {
3679
- resourceId: string;
3680
- resourceStatus?: ResourceStatus | 'all';
3681
- }
3682
- interface BulkDeleteExecutionsResult {
3683
- resourceId: string;
3684
- deletedCount: number;
3685
- resourceStatus?: ResourceStatus | 'all';
3686
- }
3687
- /**
3688
- * Bulk delete executions for a resource, optionally filtered by status.
3689
- */
3690
- declare function useBulkDeleteExecutions(): _tanstack_react_query.UseMutationResult<BulkDeleteExecutionsResult, Error, BulkDeleteExecutionsParams, unknown>;
3691
-
3692
- /**
3693
- * Fetch all available Execution Engine resources (workflows, agents, pipelines).
3694
- *
3695
- * @example
3696
- * const { data, isLoading } = useResources()
3697
- * const workflows = data?.workflows ?? []
3698
- * const agents = data?.agents ?? []
3699
- */
3700
- declare function useResources(): _tanstack_react_query.UseQueryResult<{
3701
- workflows: ResourceDefinition[];
3702
- agents: ResourceDefinition[];
3703
- pipelines: ResourceDefinition[];
3704
- total: number;
3705
- }, Error>;
3706
-
3707
- /**
3708
- * Fetch a resource definition (workflow steps, agent actions, etc.).
3709
- *
3710
- * @param resourceId - The resource ID to fetch
3711
- * @param enabled - Whether the query should execute (default: true)
3712
- */
3713
- declare function useResourceDefinition(resourceId: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<AIResourceDefinition, Error>;
3714
-
3715
- interface UseActivitiesParams {
3716
- limit?: number;
3717
- offset?: number;
3718
- activityType?: ActivityType;
3719
- entityType?: string;
3720
- entityId?: string;
3721
- startDate?: string;
3722
- endDate?: string;
3723
- status?: string;
3724
- search?: string;
3725
- }
3726
- interface ListActivitiesResponse {
3727
- activities: Activity[];
3728
- total: number;
3729
- }
3730
- /**
3731
- * Fetch activities with filtering and pagination
3732
- *
3733
- * @example
3734
- * // Basic usage - fetch recent activities
3735
- * const { data, error, isLoading } = useActivities({ limit: 50 })
3736
- *
3737
- * @example
3738
- * // Filtered by type
3739
- * const { data } = useActivities({
3740
- * activityType: 'workflow_execution',
3741
- * limit: 20
3742
- * })
3743
- *
3744
- * @example
3745
- * // Filtered by entity
3746
- * const { data } = useActivities({
3747
- * entityType: 'workflow',
3748
- * entityId: 'workflow-123'
3749
- * })
3750
- */
3751
- interface ActivityTrendResponse {
3752
- timestamps: Date[];
3753
- total: number;
3754
- }
3755
- type UseActivityTrendParams = Omit<UseActivitiesParams, 'limit' | 'offset' | 'search' | 'status'>;
3756
- /**
3757
- * Fetch activity timestamps for the Activity Trend chart
3758
- *
3759
- * Uses /activities/trend endpoint which returns only occurred_at timestamps
3760
- * up to ANALYTICS_SAFETY_LIMIT (10,000), bypassing the MAX_PAGE_LIMIT cap.
3761
- * Provides accurate counts for any time range regardless of activity volume.
3762
- */
3763
- declare function useActivityTrend(params?: UseActivityTrendParams): _tanstack_react_query.UseQueryResult<ActivityTrendResponse, Error>;
3764
- declare function useActivities(params?: UseActivitiesParams): _tanstack_react_query.UseQueryResult<ListActivitiesResponse, Error>;
3765
-
3766
- interface UseExecutionLogsParams {
3767
- resourceId?: string;
3768
- status?: ExecutionStatus$1 | 'all';
3769
- resourceStatus?: 'dev' | 'prod' | 'all';
3770
- startDate?: number;
3771
- endDate?: number;
3772
- limit?: number;
3773
- offset?: number;
3774
- }
3775
- /**
3776
- * Response type for cross-resource execution list
3777
- * Matches backend ExecutionLogsPageResponse in apps/api/src/execution-engine/handlers.ts
3778
- */
3779
- interface ExecutionLogsPageResponse {
3780
- executions: Array<{
3781
- id: string;
3782
- resourceId: string;
3783
- resourceName: string;
3784
- resourceType: 'workflow' | 'agent' | 'pipeline';
3785
- status: ExecutionStatus$1;
3786
- startTime: number;
3787
- endTime?: number;
3788
- duration?: number;
3789
- resourceStatus: 'dev' | 'prod';
3790
- resourceVersion?: string | null;
3791
- apiVersion?: string | null;
3792
- sdkVersion?: string | null;
3793
- }>;
3794
- total: number;
3795
- hasMore: boolean;
3796
- }
3797
- /**
3798
- * Fetch execution logs across all resources with filtering and pagination
3799
- *
3800
- * @example
3801
- * // Basic usage - fetch recent executions
3802
- * const { data, error, isLoading } = useExecutionLogs({ limit: 50 })
3803
- *
3804
- * @example
3805
- * // Filtered by status
3806
- * const { data } = useExecutionLogs({
3807
- * status: 'failed',
3808
- * limit: 20
3809
- * })
3810
- *
3811
- * @example
3812
- * // Filtered by resource and date range
3813
- * const { data } = useExecutionLogs({
3814
- * resourceId: 'workflow-123',
3815
- * startDate: Date.now() - 86400000, // Last 24 hours
3816
- * endDate: Date.now()
3817
- * })
3818
- */
3819
- declare function useExecutionLogs(params?: UseExecutionLogsParams): _tanstack_react_query.UseQueryResult<ExecutionLogsPageResponse, Error>;
3820
-
3821
- interface UseNotificationsOptions {
3822
- limit?: number;
3823
- offset?: number;
3824
- }
3825
- declare function useNotifications({ limit, offset }?: UseNotificationsOptions): _tanstack_react_query.UseQueryResult<{
3826
- notifications: NotificationDTO[];
3827
- total: number;
3828
- }, Error>;
3829
-
3830
- declare function useCostSummary(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<CostSummaryResponse, Error>;
3831
-
3832
- interface UseExecutionHealthParams {
3833
- timeRange: TimeRange;
3834
- }
3835
- declare function useExecutionHealth({ timeRange }: UseExecutionHealthParams): _tanstack_react_query.UseQueryResult<DashboardMetrics, Error>;
3836
-
3837
- declare function useMarkAsRead(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
3838
-
3839
- declare function useMarkAllAsRead(): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
3840
-
3841
- /**
3842
- * API-only hook for unread notification count.
3843
- *
3844
- * For SSE-enhanced real-time counts, consumers should provide
3845
- * the count via props (e.g., NotificationBell's `unreadCount` prop).
3846
- */
3847
- declare function useNotificationCount(): _tanstack_react_query.UseQueryResult<number, Error>;
3848
-
3849
- /**
3850
- * Hook that provides a standardized error notification handler
3851
- * for use in React Query mutation hooks.
3852
- *
3853
- * Delegates to the active NotificationAdapter so it works in any
3854
- * consumer (Mantine, Sonner, console fallback, etc.)
3855
- *
3856
- * @example
3857
- * ```typescript
3858
- * const mutation = useMutation({
3859
- * mutationFn: deleteApiKey,
3860
- * onError: useErrorNotification()
3861
- * })
3862
- * ```
3863
- */
3864
- declare function useErrorNotification(): (error: unknown) => void;
3865
-
3866
- /**
3867
- * Hook that provides a standardized success notification handler.
3868
- * Delegates to the active NotificationAdapter.
3869
- */
3870
- declare function useSuccessNotification(): (title: string, message: string) => void;
3871
-
3872
- /**
3873
- * Hook that provides a standardized warning notification handler.
3874
- * Delegates to the active NotificationAdapter.
3875
- */
3876
- declare function useWarningNotification(): (title: string, message: string) => void;
3877
-
3878
- /**
3879
- * Generic batch delete hook. Deletes multiple rows from a Supabase table by ID.
3880
- *
3881
- * @param tableName - Supabase table name (e.g. 'acq_social_posts')
3882
- * @param invalidateQueryKeys - Array of query key prefixes to invalidate on success
3883
- */
3884
- declare function useBatchDelete(tableName: string, invalidateQueryKeys: readonly (readonly unknown[])[]): _tanstack_react_query.UseMutationResult<void, Error, string[], unknown>;
3885
-
3886
- /**
3887
- * Query key factories for observability hooks.
3888
- * Scoped by organizationId for cache isolation between tenants.
3889
- */
3890
- declare const observabilityKeys: {
3891
- all: readonly ["observability"];
3892
- errorAnalysis: (organizationId: string | null, timeRange: string) => readonly ["observability", "error-analysis", string | null, string];
3893
- errorDetails: (organizationId: string | null, filters: object) => readonly ["observability", "error-details", string | null, object];
3894
- errorDetail: (organizationId: string | null, executionId: string | null) => readonly ["observability", "error-detail", string | null, string | null];
3895
- errorTrends: (organizationId: string | null, startDate: string, endDate: string, granularity: string) => readonly ["observability", "error-trends", string | null, string, string, string];
3896
- errorDistribution: (organizationId: string | null, startDate: string, endDate: string, groupBy: string) => readonly ["observability", "error-distribution", string | null, string, string, string];
3897
- topFailingResources: (organizationId: string | null, startDate: string, endDate: string, limit: number) => readonly ["observability", "top-failing-resources", string | null, string, string, number];
3898
- costTrends: (organizationId: string | null, timeRange: string, granularity: string) => readonly ["observability", "cost-trends", string | null, string, string];
3899
- costByModel: (organizationId: string | null, timeRange: string) => readonly ["observability", "cost-by-model", string | null, string];
3900
- costBreakdown: (organizationId: string | null, timeRange: string) => readonly ["observability", "cost-breakdown", string | null, string];
3901
- dashboardMetrics: (organizationId: string | null, timeRange: string) => readonly ["observability", "dashboard-metrics", string | null, string];
3902
- businessImpact: (organizationId: string | null, timeRange: string) => readonly ["observability", "business-impact", string | null, string];
3903
- };
3904
-
3905
- declare function useErrorAnalysis(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<ErrorAnalysisMetrics, Error>;
3906
-
3907
- interface ErrorFilters {
3908
- errorType?: string;
3909
- severity?: 'critical' | 'warning' | 'info';
3910
- search?: string;
3911
- startDate?: string;
3912
- endDate?: string;
3913
- page?: number;
3914
- limit?: number;
3915
- /** When true, show only resolved errors. When false, show only unresolved. Omit to show all. */
3916
- resolved?: boolean;
3917
- }
3918
- declare function useErrorDetails(filters: ErrorFilters): _tanstack_react_query.UseQueryResult<ErrorDetailResponse, Error>;
3919
- declare function useErrorDetail(executionId: string | null): _tanstack_react_query.UseQueryResult<ErrorDetailFull[] | null, Error>;
3920
-
3921
- interface ErrorTrendsParams {
3922
- startDate: string;
3923
- endDate: string;
3924
- granularity: 'hour' | 'day';
3925
- }
3926
- declare function useErrorTrends({ startDate, endDate, granularity }: ErrorTrendsParams): _tanstack_react_query.UseQueryResult<ErrorTrend[], Error>;
3927
-
3928
- interface ErrorDistributionParams {
3929
- startDate: string;
3930
- endDate: string;
3931
- groupBy: 'errorType' | 'resource' | 'severity';
3932
- }
3933
- interface ErrorDistributionItem {
3934
- label: string;
3935
- count: number;
3936
- percentage: number;
3937
- }
3938
- declare function useErrorDistribution({ startDate, endDate, groupBy }: ErrorDistributionParams): _tanstack_react_query.UseQueryResult<ErrorDistributionItem[], Error>;
3939
-
3940
- interface TopFailingResourcesParams {
3941
- startDate: string;
3942
- endDate: string;
3943
- limit?: number;
3944
- }
3945
- interface FailingResource {
3946
- resourceId: string;
3947
- resourceType: string;
3948
- errorCount: number;
3949
- failureRate: number;
3950
- }
3951
- declare function useTopFailingResources({ startDate, endDate, limit }: TopFailingResourcesParams): _tanstack_react_query.UseQueryResult<FailingResource[], Error>;
3952
-
3953
- /**
3954
- * Resolve a single error by ID.
3955
- */
3956
- declare function useResolveError(): _tanstack_react_query.UseMutationResult<unknown, Error, string, unknown>;
3957
- /**
3958
- * Unresolve a previously resolved error.
3959
- */
3960
- declare function useUnresolveError(): _tanstack_react_query.UseMutationResult<unknown, Error, string, unknown>;
3961
- /**
3962
- * Resolve all errors in the organization.
3963
- */
3964
- declare function useResolveAllErrors(): _tanstack_react_query.UseMutationResult<unknown, Error, void, unknown>;
3965
- /**
3966
- * Resolve all errors for a specific execution.
3967
- */
3968
- declare function useResolveErrorsByExecution(): _tanstack_react_query.UseMutationResult<unknown, Error, string, unknown>;
3969
-
3970
- declare function useCostTrends(timeRange: TimeRange, granularity?: 'hour' | 'day' | 'week'): _tanstack_react_query.UseQueryResult<CostTrendsResponse, Error>;
3971
-
3972
- declare function useCostByModel(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<CostByModelResponse, Error>;
3973
-
3974
- interface CostBreakdownItem {
3975
- resourceId: string;
3976
- resourceType: string;
3977
- model: string;
3978
- totalCost: number;
3979
- executionCount: number;
3980
- }
3981
- declare function useCostBreakdown(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<CostBreakdownItem[], Error>;
3982
-
3983
- declare function useDashboardMetrics(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<unknown, Error>;
3984
-
3985
- interface BusinessImpactMetrics {
3986
- totalExecutions: number;
3987
- estimatedTimeSavedMinutes: number;
3988
- estimatedCostSavings: number;
3989
- automationROI: number;
3990
- }
3991
- declare function useBusinessImpact(timeRange: TimeRange): _tanstack_react_query.UseQueryResult<BusinessImpactMetrics, Error>;
3992
-
3993
- /**
3994
- * Query key factory for schedule cache management.
3995
- * Provides type-safe, hierarchical keys for TanStack Query.
3996
- * Uses organizationId (UUID) for tenant-scoped cache isolation.
3997
- */
3998
- declare const scheduleKeys: {
3999
- all: (orgId: string | null) => readonly ["schedules", string | null];
4000
- lists: (orgId: string | null) => readonly ["schedules", string | null, "list"];
4001
- list: (orgId: string | null, filters?: ListSchedulesFilters) => readonly ["schedules", string | null, "list", ListSchedulesFilters | undefined];
4002
- details: (orgId: string | null) => readonly ["schedules", string | null, "detail"];
4003
- detail: (orgId: string | null, id: string) => readonly ["schedules", string | null, "detail", string];
4004
- executions: (orgId: string | null, id: string) => readonly ["schedules", string | null, "detail", string, "executions"];
4005
- };
4006
- /**
4007
- * Filters for list schedules query.
4008
- * Mirrors ListSchedulesQuery from @repo/core but typed for UI consumption.
4009
- */
4010
- interface ListSchedulesFilters {
4011
- status?: 'active' | 'paused' | 'completed' | 'cancelled';
4012
- targetResourceType?: 'agent' | 'workflow';
4013
- targetResourceId?: string;
4014
- limit?: number;
4015
- offset?: number;
4016
- }
4017
-
4018
- interface CreateScheduleInput {
4019
- name: string;
4020
- description?: string;
4021
- target: {
4022
- resourceType: 'agent' | 'workflow';
4023
- resourceId: string;
4024
- };
4025
- scheduleConfig: TaskScheduleConfig;
4026
- maxRetries?: number;
4027
- idempotencyKey?: string;
4028
- originExecutionId?: string;
4029
- originResourceType?: 'agent' | 'workflow' | 'scheduler' | 'api';
4030
- originResourceId?: string;
4031
- }
4032
- interface UpdateScheduleInput {
4033
- id: string;
4034
- name?: string;
4035
- description?: string | null;
4036
- scheduleConfig?: TaskScheduleConfig;
4037
- maxRetries?: number;
4038
- }
4039
- /** List response using domain type for CC compatibility. */
4040
- interface ListSchedulesResponse {
4041
- schedules: TaskSchedule[];
4042
- total: number;
4043
- limit: number;
4044
- offset: number;
4045
- }
4046
- /**
4047
- * List schedules with optional filters.
4048
- *
4049
- * @param filters - Optional filters for status, target resource, and pagination
4050
- * @returns TanStack Query result with schedules array and pagination info
4051
- *
4052
- * @example
4053
- * ```tsx
4054
- * const { data, isLoading } = useListSchedules({ status: 'active', limit: 20 })
4055
- * ```
4056
- */
4057
- declare function useListSchedules(filters?: ListSchedulesFilters): _tanstack_react_query.UseQueryResult<ListSchedulesResponse, Error>;
4058
- /**
4059
- * Get a single schedule by ID.
4060
- *
4061
- * @param id - Schedule UUID (undefined to disable query)
4062
- * @returns TanStack Query result with schedule data
4063
- *
4064
- * @example
4065
- * ```tsx
4066
- * const { data: schedule, isLoading } = useGetSchedule(scheduleId)
4067
- * ```
4068
- */
4069
- declare function useGetSchedule(id: string | undefined): _tanstack_react_query.UseQueryResult<TaskSchedule, Error>;
4070
- /**
4071
- * Get execution history for a schedule.
4072
- *
4073
- * @param scheduleId - Schedule UUID (undefined to disable query)
4074
- * @param options - Pagination options (limit, offset)
4075
- * @returns TanStack Query result with execution history and pagination info
4076
- *
4077
- * @example
4078
- * ```tsx
4079
- * const { data } = useGetExecutionHistory(scheduleId, { limit: 10 })
4080
- * ```
4081
- */
4082
- declare function useGetExecutionHistory(scheduleId: string | undefined, options?: {
4083
- limit?: number;
4084
- offset?: number;
4085
- }): _tanstack_react_query.UseQueryResult<{
4086
- executions: {
4087
- id: string;
4088
- createdAt: string;
4089
- status: "completed" | "failed" | "running" | "cancelled";
4090
- step: number | null;
4091
- itemLabel: string | null;
4092
- duration: number | null;
4093
- error: string | null;
4094
- }[];
4095
- total: number;
4096
- limit: number;
4097
- offset: number;
4098
- }, Error>;
4099
- /**
4100
- * Create a new schedule.
4101
- *
4102
- * @returns TanStack Mutation for creating schedules
4103
- *
4104
- * @example
4105
- * ```tsx
4106
- * const createSchedule = useCreateSchedule()
4107
- *
4108
- * createSchedule.mutate({
4109
- * name: 'Daily Report',
4110
- * target: { resourceType: 'workflow', resourceId: 'wf-123' },
4111
- * scheduleConfig: { type: 'recurring', cron: '0 9 * * *', timezone: 'UTC', payload: {} }
4112
- * })
4113
- * ```
4114
- */
4115
- declare function useCreateSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, CreateScheduleInput, unknown>;
4116
- /**
4117
- * Update schedule fields (name, description, scheduleConfig, maxRetries).
4118
- * Only active or paused schedules can be updated.
4119
- *
4120
- * @returns TanStack Mutation for updating schedules
4121
- *
4122
- * @example
4123
- * ```tsx
4124
- * const updateSchedule = useUpdateSchedule()
4125
- *
4126
- * updateSchedule.mutate({ id: 'schedule-123', name: 'Updated Name' })
4127
- * ```
4128
- */
4129
- declare function useUpdateSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, UpdateScheduleInput, unknown>;
4130
- /**
4131
- * Update anchor datetime for relative schedules.
4132
- * Only applicable to schedules with type: 'relative'.
4133
- *
4134
- * @returns TanStack Mutation for updating schedule anchor
4135
- *
4136
- * @example
4137
- * ```tsx
4138
- * const updateAnchor = useUpdateAnchor()
4139
- *
4140
- * updateAnchor.mutate({ id: 'schedule-123', anchorAt: '2026-02-01T09:00:00Z' })
4141
- * ```
4142
- */
4143
- declare function useUpdateAnchor(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, {
4144
- id: string;
4145
- anchorAt: string;
4146
- }, unknown>;
4147
- /**
4148
- * Pause a schedule.
4149
- * Paused schedules will not execute until resumed.
4150
- *
4151
- * @returns TanStack Mutation for pausing schedules
4152
- *
4153
- * @example
4154
- * ```tsx
4155
- * const pauseSchedule = usePauseSchedule()
4156
- * pauseSchedule.mutate('schedule-123')
4157
- * ```
4158
- */
4159
- declare function usePauseSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, string, unknown>;
4160
- /**
4161
- * Resume a paused schedule.
4162
- *
4163
- * @returns TanStack Mutation for resuming schedules
4164
- *
4165
- * @example
4166
- * ```tsx
4167
- * const resumeSchedule = useResumeSchedule()
4168
- * resumeSchedule.mutate('schedule-123')
4169
- * ```
4170
- */
4171
- declare function useResumeSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, string, unknown>;
4172
- /**
4173
- * Cancel a schedule permanently (soft delete).
4174
- * Sets status to 'cancelled' -- schedule remains in DB for history.
4175
- * Cancelled schedules cannot be resumed.
4176
- *
4177
- * @returns TanStack Mutation for cancelling schedules
4178
- *
4179
- * @example
4180
- * ```tsx
4181
- * const cancelSchedule = useCancelSchedule()
4182
- * cancelSchedule.mutate('schedule-123')
4183
- * ```
4184
- */
4185
- declare function useCancelSchedule(): _tanstack_react_query.UseMutationResult<TaskSchedule, Error, string, unknown>;
4186
- /**
4187
- * Delete a schedule permanently (hard delete).
4188
- * Removes schedule from database entirely.
4189
- *
4190
- * @returns TanStack Mutation for deleting schedules
4191
- *
4192
- * @example
4193
- * ```tsx
4194
- * const deleteSchedule = useDeleteSchedule()
4195
- * deleteSchedule.mutate('schedule-123')
4196
- * ```
4197
- */
4198
- declare function useDeleteSchedule(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
4199
-
4200
- interface SessionListItem {
4201
- sessionId: string;
4202
- resourceId: string;
4203
- turnCount: number;
4204
- isEnded: boolean;
4205
- createdAt: Date;
4206
- updatedAt: Date;
4207
- }
4208
- interface CreateSessionResponse {
4209
- sessionId: string;
4210
- resourceId: string;
4211
- turnCount: number;
4212
- createdAt: string;
4213
- }
4214
- /**
4215
- * Response type from the /api/dev/execution-engine/resources endpoint
4216
- */
4217
- interface ResourcesResponse {
4218
- workflows: ResourceDefinition[];
4219
- agents: ResourceDefinition[];
4220
- pipelines: ResourceDefinition[];
4221
- }
4222
- /**
4223
- * Operations Service for fetching Execution Engine resources
4224
- */
4225
- declare class OperationsService {
4226
- private apiRequest;
4227
- constructor(apiRequest: <T>(endpoint: string, options?: RequestInit) => Promise<T>);
4228
- /**
4229
- * Fetch all available Execution Engine resources
4230
- * Uses the unified /list-resources endpoint
4231
- */
4232
- getResources(): Promise<ResourcesResponse>;
4233
- /**
4234
- * Get detailed workflow information
4235
- * Optional: For future detailed views
4236
- */
4237
- getWorkflowDetails(): Promise<ResourceDefinition[]>;
4238
- /**
4239
- * Get detailed agent information
4240
- * Optional: For future detailed views
4241
- */
4242
- getAgentDetails(): Promise<ResourceDefinition[]>;
4243
- /**
4244
- * Get detailed pipeline information
4245
- * Optional: For future detailed views
4246
- */
4247
- getPipelineDetails(): Promise<ResourceDefinition[]>;
4248
- /**
4249
- * Get resource definition (workflow steps, agent actions, pipeline stages, etc.)
4250
- */
4251
- getResourceDefinition(resourceId: string): Promise<AIResourceDefinition>;
4252
- /**
4253
- * List sessions with optional filtering
4254
- */
4255
- listSessions(params?: {
4256
- resourceId?: string;
4257
- }): Promise<SessionListItem[]>;
4258
- /**
4259
- * Get session details by ID
4260
- */
4261
- getSession(sessionId: string): Promise<SessionDTO>;
4262
- /**
4263
- * Create a new session for an agent
4264
- */
4265
- createSession(resourceId: string): Promise<CreateSessionResponse>;
4266
- /**
4267
- * Archive a session
4268
- */
4269
- archiveSession(sessionId: string): Promise<void>;
4270
- }
4271
-
4272
- /**
4273
- * Shared hook for pagination state management.
4274
- * Encapsulates page state, offset calculation, and reset-on-filter-change.
4275
- *
4276
- * @param pageSize - Number of items per page
4277
- * @param resetDeps - When any dependency changes, page resets to 1. Omit to disable auto-reset.
4278
- * @param total - When provided, automatically retreats to the last valid page if the current page becomes empty (e.g., after bulk deletion).
4279
- */
4280
- declare function usePaginationState(pageSize: number, resetDeps?: unknown[], total?: number): {
4281
- page: number;
4282
- setPage: react.Dispatch<react.SetStateAction<number>>;
4283
- offset: number;
4284
- totalPages: (total: number) => number;
4285
- };
4286
-
4287
- /**
4288
- * Generic table row selection hook.
4289
- * Tracks selected IDs, provides toggle/toggleAll/clear, and computes selection state.
4290
- *
4291
- * @param items - Current page items (must have `id: string`)
4292
- * @param allItems - All items across all pages (for "select all" to work across pages). Defaults to `items`.
4293
- */
4294
- declare function useTableSelection<T extends {
4295
- id: string;
4296
- }>(items: T[], allItems?: T[]): {
4297
- selectedIds: Set<string>;
4298
- toggle: (id: string) => void;
4299
- togglePage: () => void;
4300
- clear: () => void;
4301
- isPageAllSelected: boolean;
4302
- isPagePartiallySelected: boolean;
4303
- selectedCount: number;
4304
- isSelected: (id: string) => boolean;
4305
- };
4306
-
4307
- type SortDirection = 'asc' | 'desc';
4308
- interface SortState {
4309
- column: string;
4310
- direction: SortDirection;
4311
- }
4312
- /**
4313
- * Generic table sorting hook.
4314
- * Manages sort column + direction, and provides a sort utility for client-side data.
4315
- */
4316
- declare function useTableSort(defaultColumn: string, defaultDirection?: SortDirection): {
4317
- sort: SortState;
4318
- toggleSort: (column: string) => void;
4319
- };
4320
- /**
4321
- * Sort an array of items by a column using accessor functions.
4322
- *
4323
- * @param data - Array to sort (not mutated)
4324
- * @param sort - Current sort state
4325
- * @param accessors - Map of column name → accessor function
4326
- */
4327
- declare function sortData<T>(data: T[], sort: SortState, accessors: Record<string, (item: T) => string | number | boolean | null | undefined>): T[];
4328
- /**
4329
- * Hook that combines useTableSort with memoized sortData.
4330
- * Returns the sort state, toggle function, and a memoized sort function.
4331
- */
4332
- declare function useSortedData<T>(data: T[], defaultColumn: string, accessors: Record<string, (item: T) => string | number | boolean | null | undefined>, defaultDirection?: SortDirection): {
4333
- sorted: T[];
4334
- sort: SortState;
4335
- toggleSort: (column: string) => void;
4336
- };
4337
-
4338
- interface InitializationError {
4339
- layer: 'auth' | 'profile' | 'organization';
4340
- message: string;
4341
- originalError?: Error;
4342
- }
4343
- interface AppInitializationState {
4344
- userReady: boolean;
4345
- organizationReady: boolean;
4346
- allReady: boolean;
4347
- isInitializing: boolean;
4348
- error: InitializationError | null;
4349
- retry: () => void;
4350
- profile: SupabaseUserProfile | null;
4351
- }
4352
-
4353
- /**
4354
- * The value exposed by OrganizationProvider to all consumers.
4355
- */
4356
- interface OrganizationContextValue {
4357
- /** WorkOS organization ID of the currently selected organization. */
4358
- currentWorkOSOrganizationId: string | null;
4359
- /** Supabase (UUID) organization ID of the currently selected organization. */
4360
- currentSupabaseOrganizationId: string | null;
4361
- /** Full membership record for the currently selected organization. */
4362
- currentMembership: MembershipWithDetails | null;
4363
- /** All memberships for the authenticated user. */
4364
- memberships: MembershipWithDetails[];
4365
- /** True while the initial membership list is being fetched. */
4366
- isInitializing: boolean;
4367
- /** True while a subsequent org switch / refresh is in flight. */
4368
- isOrgRefreshing: boolean;
4369
- /** Error message if the membership fetch or org switch failed. */
4370
- error: string | null;
4371
- /**
4372
- * Switch the active organization.
4373
- *
4374
- * Persists the selection to `last_visited_org` on the user profile and
4375
- * invalidates all org-scoped TanStack Query cache entries.
4376
- *
4377
- * @param workosOrgId - WorkOS organization ID to switch to.
4378
- */
4379
- switchOrganization: (workosOrgId: string) => void;
4380
- /**
4381
- * Re-fetch memberships and retry org selection after an error.
4382
- */
4383
- retry: () => Promise<void>;
4384
- }
4385
-
4386
- type RestrictionSource = 'org' | 'membership' | null;
4387
- interface FeatureAccessResult {
4388
- allowed: boolean;
4389
- restrictedBy: RestrictionSource;
4390
- }
4391
- /**
4392
- * Factory that creates a `useFeatureAccess` hook scoped to the consumer's
4393
- * feature configuration.
4394
- *
4395
- * @param useInitialization - Initialization hook providing `profile` and `organizationReady`
4396
- * @param useOrganization - Organization hook providing `currentMembership`
4397
- * @param optInFeatures - Feature keys that are disabled by default (must be explicitly enabled)
4398
- * @param getCoursesByGroup - Resolver that maps a course group name to its course slugs
4399
- *
4400
- * @example
4401
- * ```typescript
4402
- * // In your app's feature-access module
4403
- * import { createUseFeatureAccess } from '@repo/ui/hooks'
4404
- * import { useInitialization } from '@repo/ui/initialization'
4405
- * import { useOrganization } from '@repo/ui/organization'
4406
- * import { getCoursesByGroup } from './training/registry'
4407
- *
4408
- * export const useFeatureAccess = createUseFeatureAccess({
4409
- * useInitialization,
4410
- * useOrganization,
4411
- * optInFeatures: ['acquisition', 'calibration'],
4412
- * getCoursesByGroup,
4413
- * })
4414
- * ```
4415
- */
4416
- declare function createUseFeatureAccess({ useInitialization, useOrganization, optInFeatures, getCoursesByGroup }: {
4417
- useInitialization: () => Pick<AppInitializationState, 'profile' | 'organizationReady'>;
4418
- useOrganization: () => Pick<OrganizationContextValue, 'currentMembership'>;
4419
- optInFeatures?: string[];
4420
- getCoursesByGroup?: (group: CourseGroup) => string[];
4421
- }): () => {
4422
- orgConfig: OrgFeatureConfig | undefined;
4423
- membershipConfig: OrgFeatureConfig | undefined;
4424
- userConfig: UserConfig | undefined;
4425
- hasFeature: (featureKey: string) => boolean;
4426
- checkFeature: (featureKey: string) => FeatureAccessResult;
4427
- hasTrainingAccess: () => boolean;
4428
- getAllowedCourses: () => string[] | null;
4429
- getResolvedCourseAccess: () => string[] | null;
4430
- hasAccessToCourse: (courseSlug: string) => boolean;
4431
- getEnabledGroups: () => CourseGroup[];
4432
- isReady: boolean;
4433
- };
4434
-
4435
- interface EventSourceMessage {
4436
- id: string;
4437
- event: string;
4438
- data: string;
4439
- retry?: number;
4440
- }
4441
-
4442
- interface FetchEventSourceWithTokenRefreshOptions {
4443
- url: string;
4444
- getToken: () => Promise<string | undefined>;
4445
- headers?: Record<string, string>;
4446
- signal: AbortSignal;
4447
- /** Delay in ms before reconnecting after token refresh. Defaults to 2000. */
4448
- tokenRefreshDelayMs?: number;
4449
- onopen?: (response: Response) => void | Promise<void>;
4450
- onmessage?: (event: EventSourceMessage) => void;
4451
- onerror?: (error: unknown) => void;
4452
- onclose?: () => void;
4453
- }
4454
-
4455
- interface SSEConnectionManagerOptions {
4456
- /** Grace period in ms before closing idle connections. Defaults to 5000. */
4457
- closeGracePeriodMs?: number;
4458
- }
4459
- /**
4460
- * SSE Connection Manager
4461
- *
4462
- * Ensures only ONE SSE connection exists per endpoint, preventing duplicate
4463
- * connections when components re-render or remount.
4464
- *
4465
- * Benefits:
4466
- * - Prevents resource waste from duplicate connections
4467
- * - Eliminates race conditions from overlapping connections
4468
- * - Automatically manages connection lifecycle
4469
- * - Shares single connection across multiple subscribers
4470
- */
4471
- declare class SSEConnectionManager {
4472
- private connections;
4473
- private closeGracePeriodMs;
4474
- constructor(options?: SSEConnectionManagerOptions);
4475
- /**
4476
- * Subscribe to an SSE endpoint
4477
- *
4478
- * If a connection already exists for this endpoint, reuses it.
4479
- * Otherwise, creates a new connection.
4480
- *
4481
- * @param key - Unique identifier for the connection (e.g., 'notifications', 'resource-executive-agent')
4482
- * @param subscriberId - Unique identifier for this subscriber (usually component instance)
4483
- * @param options - SSE connection options
4484
- * @returns Unsubscribe function to call when component unmounts
4485
- */
4486
- subscribe(key: string, subscriberId: string, options: Omit<FetchEventSourceWithTokenRefreshOptions, 'signal'>): () => void;
4487
- /**
4488
- * Unsubscribe from an SSE endpoint
4489
- *
4490
- * If this is the last subscriber, closes the connection after grace period.
4491
- */
4492
- private unsubscribe;
4493
- /**
4494
- * Force close a connection and all its subscribers
4495
- */
4496
- closeConnection(key: string): void;
4497
- /**
4498
- * Get current connection status
4499
- */
4500
- getConnectionInfo(): Map<string, {
4501
- url: string;
4502
- subscribers: number;
4503
- }>;
4504
- }
4505
-
4506
- interface UseSSEConnectionOptions {
4507
- manager: SSEConnectionManager;
4508
- /** Shared connection key — all subscribers with the same key share ONE connection. */
4509
- connectionKey: string;
4510
- url: string;
4511
- /** When false the subscription is skipped. Defaults to true. */
4512
- enabled?: boolean;
4513
- headers?: Record<string, string>;
4514
- /** Called for each non-empty SSE message with the raw `event.data` string. */
4515
- onmessage: (data: string) => void;
4516
- /**
4517
- * Called when the connection opens. Return a non-empty string to set it as
4518
- * the error state (e.g. `response.status === 403 ? 'Access denied' : undefined`).
4519
- */
4520
- onopen?: (response: Response) => string | void;
4521
- onerror?: (err: Error) => void;
4522
- onclose?: () => void;
4523
- }
4524
- /**
4525
- * Generic SSE subscription hook.
4526
- *
4527
- * Handles token refresh, connection state, subscriber ID generation, and
4528
- * subscribe/cleanup lifecycle via the shared SSEConnectionManager.
4529
- *
4530
- * Domain-specific event parsing (e.g. `ExecutionSSEEvent`) stays in the
4531
- * caller's `onmessage` handler.
4532
- *
4533
- * @example
4534
- * ```typescript
4535
- * const { connected, error } = useSSEConnection({
4536
- * manager: sseConnectionManager,
4537
- * connectionKey: `resource-${resourceId}`,
4538
- * url: `${API_URL}/api/execution-engine/sse/${resourceId}`,
4539
- * enabled: isOrganizationReady,
4540
- * headers: { [HTTP_HEADERS.WORKOS_ORGANIZATION_ID]: orgId },
4541
- * onmessage: (data) => {
4542
- * const event = JSON.parse(data)
4543
- * // handle domain-specific event
4544
- * },
4545
- * })
4546
- * ```
4547
- */
4548
- declare function useSSEConnection({ manager, connectionKey, url, enabled, headers, onmessage, onopen, onerror, onclose }: UseSSEConnectionOptions): {
4549
- connected: boolean;
4550
- error: string | null;
4551
- };
4552
-
4553
- export { OperationsService, createUseFeatureAccess, executionsKeys, observabilityKeys, scheduleKeys, sortData, useActivities, useActivityTrend, useBatchDelete, 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, useResumeSchedule, useRetryExecution, useSSEConnection, useSortedData, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule, useWarningNotification };
4554
- 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, UseExecutionHealthParams, UseExecutionLogsParams, UseSSEConnectionOptions };
1
+ export * from './command-queue';
2
+ export * from './executions';
3
+ export * from './monitoring';
4
+ export * from './notifications';
5
+ export * from './observability';
6
+ export * from './scheduling';
7
+ export * from './services';
8
+ export * from './table';
9
+ export * from './feature-access';
10
+ export * from './sse';
11
+ //# sourceMappingURL=index.d.ts.map