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