@elevasis/ui 2.35.0 → 2.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/api/index.js +4 -3
  2. package/dist/app/index.css +0 -384
  3. package/dist/app/index.d.ts +45 -18
  4. package/dist/app/index.js +21 -21
  5. package/dist/auth/index.d.ts +91 -28
  6. package/dist/auth/index.js +5 -1
  7. package/dist/charts/index.js +9 -3
  8. package/dist/chunk-5CTJ7TW2.js +111 -0
  9. package/dist/chunk-5EYJ2GIN.js +122 -0
  10. package/dist/{chunk-VDOOGGBA.js → chunk-6NREL3KL.js} +2 -2
  11. package/dist/chunk-6ROXVZ3L.js +9 -0
  12. package/dist/{chunk-YYX7OPZQ.js → chunk-73EWE2EW.js} +1 -1
  13. package/dist/{chunk-SIQ3P4OR.js → chunk-7GQFIWP4.js} +8 -756
  14. package/dist/chunk-A7IG36LB.js +215 -0
  15. package/dist/chunk-CLDCYJQT.js +1 -0
  16. package/dist/{chunk-AKW7KISS.js → chunk-CWYQRM5T.js} +2 -38
  17. package/dist/{chunk-LUYVRATI.js → chunk-DA6I5VEY.js} +5 -213
  18. package/dist/chunk-I53EX4VU.js +734 -0
  19. package/dist/chunk-IIMU5YAJ.js +53 -0
  20. package/dist/{chunk-VKIZUUPM.js → chunk-JPVZRZ3X.js} +31 -14
  21. package/dist/chunk-JXVNHVK7.js +79 -0
  22. package/dist/chunk-JZ2WID2G.js +337 -0
  23. package/dist/chunk-LCJQ6OWC.js +348 -0
  24. package/dist/chunk-LNC6PZAE.js +85 -0
  25. package/dist/{chunk-4U3XAWCN.js → chunk-NWMPBG4U.js} +134 -495
  26. package/dist/chunk-NYNOMAAS.js +422 -0
  27. package/dist/chunk-S3KBYQTI.js +39 -0
  28. package/dist/chunk-S3XR4II4.js +30 -0
  29. package/dist/chunk-SHZT7ULK.js +425 -0
  30. package/dist/{chunk-26HFM4MH.js → chunk-T3NI7DOA.js} +2005 -4106
  31. package/dist/{chunk-GX6XBRRF.js → chunk-TYRUKGGD.js} +2 -1
  32. package/dist/{chunk-R3VCBZDC.js → chunk-X4WBGKJQ.js} +3 -50
  33. package/dist/{chunk-GEFWMU26.js → chunk-X66MVMZT.js} +1 -9
  34. package/dist/{chunk-57OZ3AEG.js → chunk-Y3JQBSKQ.js} +1 -1
  35. package/dist/components/index.d.ts +36 -46
  36. package/dist/components/index.js +33 -19
  37. package/dist/components/navigation/index.js +3 -31
  38. package/dist/execution/index.d.ts +2 -2
  39. package/dist/features/auth/index.d.ts +55 -99
  40. package/dist/features/auth/index.js +36 -99
  41. package/dist/features/clients/index.js +33 -19
  42. package/dist/features/crm/index.d.ts +23 -0
  43. package/dist/features/crm/index.js +33 -19
  44. package/dist/features/dashboard/index.d.ts +3 -3
  45. package/dist/features/dashboard/index.js +33 -19
  46. package/dist/features/delivery/index.d.ts +23 -0
  47. package/dist/features/delivery/index.js +33 -19
  48. package/dist/features/knowledge/index.js +6 -30
  49. package/dist/features/lead-gen/index.d.ts +1373 -48
  50. package/dist/features/lead-gen/index.js +33 -19
  51. package/dist/features/monitoring/index.js +33 -19
  52. package/dist/features/monitoring/requests/index.js +33 -19
  53. package/dist/features/notes/index.d.ts +72 -0
  54. package/dist/features/notes/index.js +621 -0
  55. package/dist/features/operations/index.d.ts +30 -30
  56. package/dist/features/operations/index.js +33 -19
  57. package/dist/features/right-panel-host/index.d.ts +214 -0
  58. package/dist/features/right-panel-host/index.js +640 -0
  59. package/dist/features/seo/index.js +3 -2
  60. package/dist/features/settings/index.d.ts +26 -35
  61. package/dist/features/settings/index.js +33 -19
  62. package/dist/hooks/access/index.d.ts +90 -0
  63. package/dist/hooks/access/index.js +10 -0
  64. package/dist/hooks/delivery/index.d.ts +23 -0
  65. package/dist/hooks/delivery/index.js +33 -19
  66. package/dist/hooks/index.d.ts +1816 -1855
  67. package/dist/hooks/index.js +33 -19
  68. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +13 -13
  69. package/dist/hooks/published.d.ts +1816 -1855
  70. package/dist/hooks/published.js +33 -19
  71. package/dist/hooks/user-notes/index.d.ts +57 -0
  72. package/dist/hooks/user-notes/index.js +3 -0
  73. package/dist/index.d.ts +290 -309
  74. package/dist/index.js +34 -20
  75. package/dist/initialization/index.d.ts +23 -19
  76. package/dist/knowledge/index.d.ts +21 -21
  77. package/dist/knowledge/index.js +12 -9
  78. package/dist/{knowledge-search-index-ORIJCEZX.js → knowledge-search-index-NBCTFIOH.js} +2 -2
  79. package/dist/layout/index.js +5 -3
  80. package/dist/organization/index.d.ts +0 -19
  81. package/dist/organization/index.js +33 -19
  82. package/dist/profile/index.d.ts +23 -0
  83. package/dist/provider/index.css +0 -384
  84. package/dist/provider/index.d.ts +45 -18
  85. package/dist/provider/index.js +15 -21
  86. package/dist/provider/published.css +0 -523
  87. package/dist/provider/published.d.ts +45 -18
  88. package/dist/provider/published.js +11 -21
  89. package/dist/sse/index.js +26 -5
  90. package/dist/supabase/index.d.ts +46 -0
  91. package/dist/test-utils/index.d.ts +2 -21
  92. package/dist/test-utils/index.js +5 -18
  93. package/dist/theme/index.js +2 -1
  94. package/dist/types/index.d.ts +86 -72
  95. package/dist/utils/index.d.ts +3 -3
  96. package/dist/utils/index.js +2 -1
  97. package/package.json +21 -5
  98. package/src/auth/README.md +6 -6
  99. package/dist/components/navigation/index.css +0 -649
  100. package/dist/features/knowledge/index.css +0 -649
@@ -1,632 +1,151 @@
1
- import * as _tanstack_react_query from '@tanstack/react-query';
2
1
  import { z } from 'zod';
2
+ import * as _tanstack_react_query from '@tanstack/react-query';
3
3
  import { EventSourceMessage } from '@microsoft/fetch-event-source';
4
4
  import * as react from 'react';
5
5
  import * as zustand_middleware from 'zustand/middleware';
6
6
  import * as zustand from 'zustand';
7
7
 
8
8
  /**
9
- * Error categories for observability grouping and classification.
10
- * Used to categorize errors in the execution_errors table metadata.
9
+ * Canonical permission catalog.
10
+ *
11
+ * Source of truth for the permission keys used by:
12
+ * - RLS policies in Supabase (via has_org_permission(org_id, key))
13
+ * - API middleware (via requireOrganizationPermission(key))
14
+ * - UI access checks (via useAccess() permission-backed AccessKeys)
15
+ *
16
+ * The DB table `org_rol_permissions` mirrors this constant. There is no
17
+ * runtime reconciler; parity is enforced two ways:
18
+ * 1. Each migration that adds/removes/modifies a permission must INSERT
19
+ * (or UPDATE / DELETE) the corresponding `org_rol_permissions` row in
20
+ * the same transaction.
21
+ * 2. `apps/api/src/auth/multi-tenancy/__tests__/permissions-catalog-sync.integration.test.ts`
22
+ * asserts the TS catalog and the DB rows agree; CI fails on drift.
23
+ *
24
+ * Adding a permission:
25
+ * 1. Add an entry below.
26
+ * 2. Add a row to the migration (INSERT INTO org_rol_permissions ...) in
27
+ * the same transaction as any policies/grants that reference the key.
28
+ * 3. Reference it in RLS / middleware as needed.
29
+ * 4. Optionally grant it to one or more system roles in org_rol_grants.
30
+ *
31
+ * Removing a permission: follow the deletion runbook — never just delete
32
+ * the entry. Existing role grants and policy references must be cleared first.
11
33
  */
12
- type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
13
-
34
+ declare const PERMISSIONS: {
35
+ readonly ORG_READ: "org.read";
36
+ readonly ORG_MANAGE: "org.manage";
37
+ readonly ORG_DELETE: "org.delete";
38
+ readonly MEMBERS_MANAGE: "members.manage";
39
+ readonly ROLES_MANAGE: "roles.manage";
40
+ readonly SECRETS_MANAGE: "secrets.manage";
41
+ readonly OPERATIONS_READ: "operations.read";
42
+ readonly OPERATIONS_MANAGE: "operations.manage";
43
+ readonly ACQUISITION_MANAGE: "acquisition.manage";
44
+ readonly PROJECTS_MANAGE: "projects.manage";
45
+ readonly CLIENTS_MANAGE: "clients.manage";
46
+ };
47
+ type PermissionKey = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
14
48
  /**
15
- * Workflow-specific logging types and utilities
49
+ * Static metadata for each permission. Mirrored into org_rol_permissions by
50
+ * a migration `INSERT` in the same transaction as any change to this catalog.
51
+ * is_org_grantable=false means the permission is reserved to system roles
52
+ * only — custom roles cannot include it (privilege-escalation guard).
16
53
  */
17
-
18
- interface WorkflowExecutionContext {
19
- type: 'workflow';
20
- contextType: 'workflow-execution';
21
- executionId: string;
22
- workflowId: string;
23
- workflowName?: string;
24
- organizationId: string;
25
- executionPath?: string[];
26
- }
27
- interface WorkflowFailureContext {
28
- type: 'workflow';
29
- contextType: 'workflow-failure';
30
- executionId: string;
31
- workflowId: string;
32
- error: string;
33
- }
34
- interface StepStartedContext {
35
- type: 'workflow';
36
- contextType: 'step-started';
37
- stepId: string;
38
- stepStatus: 'started';
39
- input: unknown;
40
- startTime: number;
41
- }
42
- interface StepCompletedContext {
43
- type: 'workflow';
44
- contextType: 'step-completed';
45
- stepId: string;
46
- stepStatus: 'completed';
47
- output: unknown;
48
- duration: number;
49
- isTerminal: boolean;
50
- startTime: number;
51
- endTime: number;
52
- }
53
- interface StepFailedContext {
54
- type: 'workflow';
55
- contextType: 'step-failed';
56
- stepId: string;
57
- stepStatus: 'failed';
58
- error: string;
59
- duration: number;
60
- startTime: number;
61
- endTime: number;
62
- }
63
- interface ConditionalRouteContext {
64
- type: 'workflow';
65
- contextType: 'conditional-route';
66
- stepId: string;
67
- target: string;
68
- error?: string;
69
- }
70
- interface ExecutionPathContext {
71
- type: 'workflow';
72
- contextType: 'execution-path';
73
- executionPath: string[];
54
+ interface PermissionDescriptor {
55
+ key: PermissionKey;
56
+ description: string;
57
+ isOrgGrantable: boolean;
74
58
  }
75
- type WorkflowLogContext = WorkflowExecutionContext | WorkflowFailureContext | StepStartedContext | StepCompletedContext | StepFailedContext | ConditionalRouteContext | ExecutionPathContext;
76
59
 
77
60
  /**
78
- * Agent-specific logging types
79
- * Simplified 2-event model: lifecycle, iteration
61
+ * Memberships Domain - Zod Validation Schemas
80
62
  *
81
- * Design Philosophy:
82
- * - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
83
- * - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
63
+ * Validation schemas for membership management endpoints.
64
+ * Includes request bodies, query params, and path params.
65
+ *
66
+ * Security:
67
+ * - All schemas use .strict() to prevent mass assignment attacks
68
+ * - UUID validation prevents invalid references
69
+ * - Role enum validation prevents privilege escalation
70
+ * - organizationId never accepted in body (from JWT when needed)
84
71
  */
85
72
 
86
73
  /**
87
- * Agent lifecycle stages
88
- * Universal checkpoints that apply to all agent executions
89
- */
90
- type AgentLifecycle = 'initialization' | 'iteration' | 'completion';
91
- /**
92
- * Iteration event types
93
- * Activities that occur during agent iterations
74
+ * Membership status validation
75
+ * Note: Database constraint only allows 'active' | 'inactive'
94
76
  */
95
- type IterationEventType = 'reasoning' | 'action' | 'tool-call';
77
+ declare const MembershipStatusSchema: z.ZodEnum<{
78
+ active: "active";
79
+ inactive: "inactive";
80
+ }>;
81
+ type MembershipStatus = z.infer<typeof MembershipStatusSchema>;
82
+
96
83
  /**
97
- * Base fields shared by all lifecycle events
84
+ * Organization Membership types based on WorkOS API
98
85
  */
99
- interface AgentLifecycleEventBase {
100
- type: 'agent';
101
- agentId: string;
102
- lifecycle: AgentLifecycle;
103
- sessionId?: string;
86
+ interface OrganizationMembership {
87
+ object: 'organization_membership';
88
+ id: string;
89
+ userId: string;
90
+ organizationId: string;
91
+ role: {
92
+ slug: string;
93
+ };
94
+ status: 'active' | 'inactive';
95
+ createdAt: string;
96
+ updatedAt: string;
104
97
  }
105
98
  /**
106
- * Lifecycle started event - emitted when a phase begins
107
- * REQUIRED: startTime (phase has started, no end yet)
99
+ * Request interfaces for membership operations
108
100
  */
109
- interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
110
- stage: 'started';
111
- startTime: number;
112
- iteration?: number;
101
+ interface CreateMembershipRequest {
102
+ userId: string;
103
+ organizationId: string;
104
+ roleSlug?: string;
113
105
  }
114
- /**
115
- * Lifecycle completed event - emitted when a phase succeeds
116
- * REQUIRED: startTime, endTime, duration (phase has finished successfully)
117
- */
118
- interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
119
- stage: 'completed';
120
- startTime: number;
121
- endTime: number;
122
- duration: number;
123
- iteration?: number;
124
- attempts?: number;
125
- memorySize?: {
126
- sessionMemoryKeys: number;
127
- historyEntries: number;
128
- };
106
+ interface UpdateMembershipRequest {
107
+ roleSlug: string;
129
108
  }
130
- /**
131
- * Lifecycle failed event - emitted when a phase fails
132
- * REQUIRED: startTime, endTime, duration, error (phase has finished with error)
133
- */
134
- interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
135
- stage: 'failed';
136
- startTime: number;
137
- endTime: number;
138
- duration: number;
139
- error: string;
140
- iteration?: number;
109
+ interface ListMembershipsParams {
110
+ userId?: string;
111
+ organizationId?: string;
112
+ statuses?: MembershipStatus[];
113
+ limit?: number;
114
+ before?: string;
115
+ after?: string;
116
+ order?: 'asc' | 'desc';
141
117
  }
142
118
  /**
143
- * Union type for all lifecycle events
144
- * Discriminated by 'stage' field for type narrowing
145
- */
146
- type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent;
147
- /**
148
- * Placeholder data for MVP
149
- * Will be typed per actionType in future
119
+ * Response interfaces
150
120
  */
151
- interface ActionPlaceholderData {
152
- message: string;
121
+ interface ListMembershipsResponse {
122
+ data: OrganizationMembership[];
123
+ listMetadata?: {
124
+ before?: string | null;
125
+ after?: string | null;
126
+ };
153
127
  }
154
128
  /**
155
- * Iteration event - captures activities during agent iterations
156
- * Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
129
+ * Extended membership with user and organization details for UI
157
130
  */
158
- interface AgentIterationEvent {
159
- type: 'agent';
160
- agentId: string;
161
- lifecycle: 'iteration';
162
- eventType: IterationEventType;
163
- iteration: number;
164
- sessionId?: string;
165
- startTime: number;
166
- endTime: number;
167
- duration: number;
168
- output?: string;
169
- actionType?: string;
170
- data?: ActionPlaceholderData;
171
- }
172
- /**
173
- * Tool call event - captures individual tool executions during iterations
174
- * Provides granular timing for each tool invocation
175
- */
176
- interface AgentToolCallEvent {
177
- type: 'agent';
178
- agentId: string;
179
- lifecycle: 'iteration';
180
- eventType: 'tool-call';
181
- iteration: number;
182
- sessionId?: string;
183
- toolName: string;
184
- startTime: number;
185
- endTime: number;
186
- duration: number;
187
- success: boolean;
188
- error?: string;
189
- input?: Record<string, unknown>;
190
- output?: unknown;
191
- }
192
- /**
193
- * Union type for all agent log contexts
194
- * 3 event types total (lifecycle, iteration, tool-call)
195
- */
196
- type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent;
197
-
198
- /**
199
- * Base execution logger for Execution Engine
200
- */
201
- type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error';
202
-
203
- type LogContext = WorkflowLogContext | AgentLogContext;
204
- interface ExecutionLogMessage {
205
- level: ExecutionLogLevel;
206
- message: string;
207
- timestamp: number;
208
- context?: LogContext;
209
- }
210
-
211
- /**
212
- * Serialized Registry Types
213
- *
214
- * Pre-computed JSON-safe types for API responses and Command View.
215
- * Serialization happens once at API startup, enabling instant response times.
216
- */
217
-
218
- /**
219
- * Serialized agent definition (JSON-safe)
220
- * Result of serializeDefinition(AgentDefinition)
221
- */
222
- interface SerializedAgentDefinition {
223
- config: {
224
- resourceId: string;
225
- name: string;
226
- description: string;
227
- version: string;
228
- type: 'agent';
229
- kind: 'orchestrator' | 'specialist' | 'utility' | 'system';
230
- status: 'dev' | 'prod';
231
- links?: ResourceLink[];
232
- category?: ResourceCategory;
233
- /** Whether this resource is archived and should be excluded from registration and deployment */
234
- archived?: boolean;
235
- systemPrompt: string;
236
- constraints?: {
237
- maxIterations?: number;
238
- timeout?: number;
239
- maxSessionMemoryKeys?: number;
240
- maxMemoryTokens?: number;
241
- };
242
- sessionCapable?: boolean;
243
- memoryPreferences?: string;
244
- };
245
- modelConfig: {
246
- provider: string;
247
- model: string;
248
- apiKey: string;
249
- temperature: number;
250
- maxOutputTokens: number;
251
- topP?: number;
252
- modelOptions?: Record<string, unknown>;
253
- };
254
- contract: {
255
- inputSchema: object;
256
- outputSchema?: object;
257
- };
258
- tools: Array<{
259
- name: string;
260
- description: string;
261
- inputSchema?: object;
262
- outputSchema?: object;
263
- }>;
264
- knowledgeMap?: {
265
- nodeCount: number;
266
- nodes: Array<{
267
- id: string;
268
- description: string;
269
- loaded: boolean;
270
- hasPrompt: boolean;
271
- }>;
272
- };
273
- metricsConfig?: object;
274
- }
275
- /**
276
- * Serialized workflow definition (JSON-safe)
277
- * Result of serializeDefinition(WorkflowDefinition)
278
- */
279
- interface SerializedWorkflowDefinition {
280
- config: {
281
- resourceId: string;
282
- name: string;
283
- description: string;
284
- version: string;
285
- type: 'workflow';
286
- status: 'dev' | 'prod';
287
- links?: ResourceLink[];
288
- category?: ResourceCategory;
289
- /** Whether this resource is archived and should be excluded from registration and deployment */
290
- archived?: boolean;
291
- };
292
- entryPoint: string;
293
- steps: Array<{
294
- id: string;
295
- name: string;
296
- description: string;
297
- inputSchema?: object;
298
- outputSchema?: object;
299
- next: {
300
- type: 'linear' | 'conditional';
301
- target?: string;
302
- routes?: Array<{
303
- target: string;
304
- }>;
305
- default?: string;
306
- } | null;
307
- }>;
308
- contract: {
309
- inputSchema: object;
310
- outputSchema?: object;
311
- };
312
- metricsConfig?: object;
313
- }
314
-
315
- declare const ResourceGovernanceStatusSchema: z.ZodEnum<{
316
- deprecated: "deprecated";
317
- active: "active";
318
- archived: "archived";
319
- }>;
320
- declare const ResourceEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
321
- id: z.ZodString;
322
- order: z.ZodDefault<z.ZodNumber>;
323
- systemPath: z.ZodString;
324
- title: z.ZodOptional<z.ZodString>;
325
- description: z.ZodOptional<z.ZodString>;
326
- ownerRoleId: z.ZodOptional<z.ZodString>;
327
- status: z.ZodEnum<{
328
- deprecated: "deprecated";
329
- active: "active";
330
- archived: "archived";
331
- }>;
332
- ontology: z.ZodOptional<z.ZodObject<{
333
- actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
334
- primaryAction: z.ZodOptional<z.ZodString>;
335
- reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
336
- writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
337
- usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
338
- emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
339
- contract: z.ZodOptional<z.ZodObject<{
340
- input: z.ZodOptional<z.ZodString>;
341
- output: z.ZodOptional<z.ZodString>;
342
- }, z.core.$strip>>;
343
- }, z.core.$strip>>;
344
- codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
345
- path: z.ZodString;
346
- role: z.ZodEnum<{
347
- config: "config";
348
- entrypoint: "entrypoint";
349
- handler: "handler";
350
- schema: "schema";
351
- test: "test";
352
- docs: "docs";
353
- }>;
354
- symbol: z.ZodOptional<z.ZodString>;
355
- description: z.ZodOptional<z.ZodString>;
356
- }, z.core.$strip>>>;
357
- kind: z.ZodLiteral<"workflow">;
358
- emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
359
- eventKey: z.ZodString;
360
- label: z.ZodString;
361
- payloadSchema: z.ZodOptional<z.ZodString>;
362
- lifecycle: z.ZodOptional<z.ZodEnum<{
363
- deprecated: "deprecated";
364
- draft: "draft";
365
- beta: "beta";
366
- active: "active";
367
- archived: "archived";
368
- }>>;
369
- }, z.core.$strip>>>;
370
- }, z.core.$strip>, z.ZodObject<{
371
- id: z.ZodString;
372
- order: z.ZodDefault<z.ZodNumber>;
373
- systemPath: z.ZodString;
374
- title: z.ZodOptional<z.ZodString>;
375
- description: z.ZodOptional<z.ZodString>;
376
- ownerRoleId: z.ZodOptional<z.ZodString>;
377
- status: z.ZodEnum<{
378
- deprecated: "deprecated";
379
- active: "active";
380
- archived: "archived";
381
- }>;
382
- ontology: z.ZodOptional<z.ZodObject<{
383
- actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
384
- primaryAction: z.ZodOptional<z.ZodString>;
385
- reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
386
- writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
387
- usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
388
- emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
389
- contract: z.ZodOptional<z.ZodObject<{
390
- input: z.ZodOptional<z.ZodString>;
391
- output: z.ZodOptional<z.ZodString>;
392
- }, z.core.$strip>>;
393
- }, z.core.$strip>>;
394
- codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
395
- path: z.ZodString;
396
- role: z.ZodEnum<{
397
- config: "config";
398
- entrypoint: "entrypoint";
399
- handler: "handler";
400
- schema: "schema";
401
- test: "test";
402
- docs: "docs";
403
- }>;
404
- symbol: z.ZodOptional<z.ZodString>;
405
- description: z.ZodOptional<z.ZodString>;
406
- }, z.core.$strip>>>;
407
- kind: z.ZodLiteral<"agent">;
408
- agentKind: z.ZodEnum<{
409
- platform: "platform";
410
- orchestrator: "orchestrator";
411
- specialist: "specialist";
412
- utility: "utility";
413
- }>;
414
- actsAsRoleId: z.ZodOptional<z.ZodString>;
415
- sessionCapable: z.ZodBoolean;
416
- invocations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
417
- kind: z.ZodLiteral<"slash-command">;
418
- command: z.ZodString;
419
- toolFactory: z.ZodOptional<z.ZodString>;
420
- }, z.core.$strip>, z.ZodObject<{
421
- kind: z.ZodLiteral<"mcp-tool">;
422
- server: z.ZodString;
423
- name: z.ZodString;
424
- }, z.core.$strip>, z.ZodObject<{
425
- kind: z.ZodLiteral<"api-endpoint">;
426
- method: z.ZodEnum<{
427
- GET: "GET";
428
- POST: "POST";
429
- PATCH: "PATCH";
430
- DELETE: "DELETE";
431
- }>;
432
- path: z.ZodString;
433
- requestSchema: z.ZodOptional<z.ZodString>;
434
- responseSchema: z.ZodOptional<z.ZodString>;
435
- }, z.core.$strip>, z.ZodObject<{
436
- kind: z.ZodLiteral<"script-execution">;
437
- resourceId: z.ZodString;
438
- }, z.core.$strip>], "kind">>>;
439
- emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
440
- eventKey: z.ZodString;
441
- label: z.ZodString;
442
- payloadSchema: z.ZodOptional<z.ZodString>;
443
- lifecycle: z.ZodOptional<z.ZodEnum<{
444
- deprecated: "deprecated";
445
- draft: "draft";
446
- beta: "beta";
447
- active: "active";
448
- archived: "archived";
449
- }>>;
450
- }, z.core.$strip>>>;
451
- }, z.core.$strip>, z.ZodObject<{
452
- id: z.ZodString;
453
- order: z.ZodDefault<z.ZodNumber>;
454
- systemPath: z.ZodString;
455
- title: z.ZodOptional<z.ZodString>;
456
- description: z.ZodOptional<z.ZodString>;
457
- ownerRoleId: z.ZodOptional<z.ZodString>;
458
- status: z.ZodEnum<{
459
- deprecated: "deprecated";
460
- active: "active";
461
- archived: "archived";
462
- }>;
463
- ontology: z.ZodOptional<z.ZodObject<{
464
- actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
465
- primaryAction: z.ZodOptional<z.ZodString>;
466
- reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
467
- writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
468
- usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
469
- emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
470
- contract: z.ZodOptional<z.ZodObject<{
471
- input: z.ZodOptional<z.ZodString>;
472
- output: z.ZodOptional<z.ZodString>;
473
- }, z.core.$strip>>;
474
- }, z.core.$strip>>;
475
- codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
476
- path: z.ZodString;
477
- role: z.ZodEnum<{
478
- config: "config";
479
- entrypoint: "entrypoint";
480
- handler: "handler";
481
- schema: "schema";
482
- test: "test";
483
- docs: "docs";
484
- }>;
485
- symbol: z.ZodOptional<z.ZodString>;
486
- description: z.ZodOptional<z.ZodString>;
487
- }, z.core.$strip>>>;
488
- kind: z.ZodLiteral<"integration">;
489
- provider: z.ZodString;
490
- }, z.core.$strip>, z.ZodObject<{
491
- id: z.ZodString;
492
- order: z.ZodDefault<z.ZodNumber>;
493
- systemPath: z.ZodString;
494
- title: z.ZodOptional<z.ZodString>;
495
- description: z.ZodOptional<z.ZodString>;
496
- ownerRoleId: z.ZodOptional<z.ZodString>;
497
- status: z.ZodEnum<{
498
- deprecated: "deprecated";
499
- active: "active";
500
- archived: "archived";
501
- }>;
502
- ontology: z.ZodOptional<z.ZodObject<{
503
- actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
504
- primaryAction: z.ZodOptional<z.ZodString>;
505
- reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
506
- writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
507
- usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
508
- emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
509
- contract: z.ZodOptional<z.ZodObject<{
510
- input: z.ZodOptional<z.ZodString>;
511
- output: z.ZodOptional<z.ZodString>;
512
- }, z.core.$strip>>;
513
- }, z.core.$strip>>;
514
- codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
515
- path: z.ZodString;
516
- role: z.ZodEnum<{
517
- config: "config";
518
- entrypoint: "entrypoint";
519
- handler: "handler";
520
- schema: "schema";
521
- test: "test";
522
- docs: "docs";
523
- }>;
524
- symbol: z.ZodOptional<z.ZodString>;
525
- description: z.ZodOptional<z.ZodString>;
526
- }, z.core.$strip>>>;
527
- kind: z.ZodLiteral<"script">;
528
- language: z.ZodEnum<{
529
- shell: "shell";
530
- sql: "sql";
531
- typescript: "typescript";
532
- python: "python";
533
- }>;
534
- source: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
535
- file: z.ZodString;
536
- }, z.core.$strip>]>;
537
- }, z.core.$strip>], "kind">;
538
- type ResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>;
539
- type ResourceEntry = z.infer<typeof ResourceEntrySchema>;
540
-
541
- /**
542
- * Shared form field types for dynamic form generation
543
- * Used by: Command Queue, Execution Runner UI, future form-based features
544
- */
545
- /**
546
- * Supported form field types for action payloads
547
- * Maps to Mantine form components
548
- */
549
- type FormFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'radio' | 'richtext';
550
- /**
551
- * Form field definition
552
- */
553
- interface FormField {
554
- /** Field key in payload object */
555
- name: string;
556
- /** Field label for UI */
557
- label: string;
558
- /** Field type (determines UI component) */
559
- type: FormFieldType;
560
- /** Default value */
561
- defaultValue?: unknown;
562
- /** Required field */
563
- required?: boolean;
564
- /** Placeholder text */
565
- placeholder?: string;
566
- /** Help text */
567
- description?: string;
568
- /** Options for select/radio */
569
- options?: Array<{
570
- label: string;
571
- value: string | number;
572
- }>;
573
- /** Min/max for number */
574
- min?: number;
575
- max?: number;
576
- /** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
577
- defaultValueFromContext?: string;
578
- }
579
- /**
580
- * Form schema for action payload collection
581
- */
582
- interface FormSchema {
583
- /** Form title */
584
- title?: string;
585
- /** Form description */
586
- description?: string;
587
- /** Form fields */
588
- fields: FormField[];
589
- }
590
-
591
- /**
592
- * Memory type definitions
593
- * Types for agent memory management with semantic entry types
594
- */
595
- /**
596
- * Semantic memory entry types
597
- * Use-case agnostic types that describe the purpose of each entry
598
- * Memory types mirror action types for clarity and filtering
599
- */
600
- type MemoryEntryType = 'context' | 'input' | 'reasoning' | 'tool-result' | 'delegation-result' | 'error';
601
- /**
602
- * Memory entry - represents a single entry in agent memory
603
- * Stored in agent memory, translated by adapters to vendor-specific formats
604
- */
605
- interface MemoryEntry {
606
- type: MemoryEntryType;
607
- content: string;
608
- timestamp: number;
609
- turnNumber: number | null;
610
- iterationNumber: number | null;
611
- }
612
- /**
613
- * Agent memory - Self-orchestrated memory with session + working storage
614
- * Agent has full control over what persists, framework handles auto-compaction
615
- */
616
- interface AgentMemory {
617
- /**
618
- * Session memory - Persists for session/conversation duration
619
- * Never auto-trimmed by framework
620
- * Agent-managed key-value store for critical information
621
- * Agent provides strings, framework wraps in MemoryEntry
622
- */
623
- sessionMemory: Record<string, MemoryEntry>;
624
- /**
625
- * Working memory - Execution history
626
- * Automatically compacted by framework when needed
627
- * Agent doesn't control compaction
628
- */
629
- history: MemoryEntry[];
131
+ interface MembershipWithDetails extends OrganizationMembership {
132
+ user?: {
133
+ id: string;
134
+ email: string;
135
+ firstName?: string;
136
+ lastName?: string;
137
+ profilePictureUrl?: string;
138
+ };
139
+ organization?: {
140
+ id: string;
141
+ name: string;
142
+ workos_org_id: string;
143
+ primaryDomain?: string;
144
+ is_test?: boolean;
145
+ status?: string;
146
+ metadata?: Record<string, unknown>;
147
+ config?: Record<string, unknown>;
148
+ };
630
149
  }
631
150
 
632
151
  type Json = string | number | boolean | null | {
@@ -3411,6 +2930,7 @@ type Database = {
3411
2930
  title: string | null;
3412
2931
  updated_at: string;
3413
2932
  user_id: string;
2933
+ visibility: string;
3414
2934
  };
3415
2935
  Insert: {
3416
2936
  content: string;
@@ -3425,6 +2945,7 @@ type Database = {
3425
2945
  title?: string | null;
3426
2946
  updated_at?: string;
3427
2947
  user_id: string;
2948
+ visibility?: string;
3428
2949
  };
3429
2950
  Update: {
3430
2951
  content?: string;
@@ -3439,6 +2960,7 @@ type Database = {
3439
2960
  title?: string | null;
3440
2961
  updated_at?: string;
3441
2962
  user_id?: string;
2963
+ visibility?: string;
3442
2964
  };
3443
2965
  Relationships: [
3444
2966
  {
@@ -3607,6 +3129,12 @@ type Database = {
3607
3129
  Args: never;
3608
3130
  Returns: boolean;
3609
3131
  };
3132
+ current_user_shares_org_with: {
3133
+ Args: {
3134
+ other_user_id: string;
3135
+ };
3136
+ Returns: boolean;
3137
+ };
3610
3138
  current_user_supabase_id: {
3611
3139
  Args: never;
3612
3140
  Returns: string;
@@ -3646,6 +3174,20 @@ type Database = {
3646
3174
  Args: never;
3647
3175
  Returns: string;
3648
3176
  };
3177
+ has_org_access: {
3178
+ Args: {
3179
+ action?: string;
3180
+ org_id: string;
3181
+ system_path: string;
3182
+ };
3183
+ Returns: boolean;
3184
+ } | {
3185
+ Args: {
3186
+ action?: string;
3187
+ system_path: string;
3188
+ };
3189
+ Returns: boolean;
3190
+ };
3649
3191
  has_org_permission: {
3650
3192
  Args: {
3651
3193
  org_id: string;
@@ -3727,1071 +3269,1554 @@ type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables
3727
3269
  Row: infer R;
3728
3270
  } ? R : never : never;
3729
3271
 
3730
- type SupabaseUserProfile = Tables<'users'>;
3731
3272
  type SupabaseApiKey = Tables<'api_keys'>;
3732
3273
  /** API response type for API key list items (omits sensitive key_hash) */
3733
3274
  type ApiKeyListItem = Omit<SupabaseApiKey, 'key_hash'>;
3734
3275
 
3735
- declare const TransitionItemRequestSchema: z.ZodObject<{
3736
- pipelineKey: z.ZodString;
3737
- stageKey: z.ZodString;
3738
- stateKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3739
- reason: z.ZodOptional<z.ZodString>;
3740
- expectedUpdatedAt: z.ZodOptional<z.ZodString>;
3741
- }, z.core.$strict>;
3742
- /**
3743
- * Deal detail shape — currently the same as a list item (full joined record).
3744
- * Additive fields keep existing DealListItem callers compatible.
3745
- */
3746
- declare const DealDetailResponseSchema: z.ZodObject<{
3747
- id: z.ZodString;
3748
- organization_id: z.ZodString;
3749
- client_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3750
- contact_id: z.ZodNullable<z.ZodString>;
3751
- contact_email: z.ZodString;
3752
- pipeline_key: z.ZodString;
3753
- stage_key: z.ZodNullable<z.ZodString>;
3754
- state_key: z.ZodNullable<z.ZodString>;
3755
- activity_log: z.ZodUnknown;
3756
- discovery_data: z.ZodNullable<z.ZodUnknown>;
3757
- discovery_submitted_at: z.ZodNullable<z.ZodString>;
3758
- discovery_submitted_by: z.ZodNullable<z.ZodString>;
3759
- proposal_data: z.ZodNullable<z.ZodUnknown>;
3760
- proposal_sent_at: z.ZodNullable<z.ZodString>;
3761
- proposal_pdf_url: z.ZodNullable<z.ZodString>;
3762
- signature_envelope_id: z.ZodNullable<z.ZodString>;
3763
- source_list_id: z.ZodNullable<z.ZodString>;
3764
- source_type: z.ZodNullable<z.ZodString>;
3765
- initial_fee: z.ZodNullable<z.ZodNumber>;
3766
- monthly_fee: z.ZodNullable<z.ZodNumber>;
3767
- closed_lost_at: z.ZodNullable<z.ZodString>;
3768
- closed_lost_reason: z.ZodNullable<z.ZodString>;
3769
- created_at: z.ZodString;
3770
- updated_at: z.ZodString;
3771
- priority: z.ZodObject<{
3772
- bucketKey: z.ZodEnum<{
3773
- needs_response: "needs_response";
3774
- follow_up_due: "follow_up_due";
3775
- waiting: "waiting";
3776
- stale: "stale";
3777
- closed_low: "closed_low";
3778
- }>;
3779
- rank: z.ZodNumber;
3780
- label: z.ZodString;
3781
- color: z.ZodString;
3782
- reason: z.ZodString;
3783
- latestActivityAt: z.ZodNullable<z.ZodString>;
3784
- nextActionAt: z.ZodNullable<z.ZodString>;
3785
- }, z.core.$strip>;
3786
- ownership: z.ZodNullable<z.ZodEnum<{
3787
- us: "us";
3788
- them: "them";
3789
- }>>;
3790
- nextAction: z.ZodNullable<z.ZodString>;
3791
- contact: z.ZodNullable<z.ZodObject<{
3276
+ declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
3277
+ objectTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3792
3278
  id: z.ZodString;
3793
- first_name: z.ZodNullable<z.ZodString>;
3794
- last_name: z.ZodNullable<z.ZodString>;
3795
- email: z.ZodString;
3796
- title: z.ZodNullable<z.ZodString>;
3797
- headline: z.ZodNullable<z.ZodString>;
3798
- linkedin_url: z.ZodNullable<z.ZodString>;
3799
- processing_state: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
3800
- status: z.ZodEnum<{
3801
- error: "error";
3802
- success: "success";
3803
- no_result: "no_result";
3804
- skipped: "skipped";
3805
- }>;
3806
- data: z.ZodOptional<z.ZodUnknown>;
3807
- }, z.core.$loose>>>;
3808
- enrichment_data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3809
- company: z.ZodNullable<z.ZodObject<{
3810
- id: z.ZodString;
3811
- name: z.ZodString;
3812
- domain: z.ZodNullable<z.ZodString>;
3813
- website: z.ZodNullable<z.ZodString>;
3814
- linkedin_url: z.ZodNullable<z.ZodString>;
3815
- segment: z.ZodNullable<z.ZodString>;
3816
- category: z.ZodNullable<z.ZodString>;
3817
- num_employees: z.ZodNullable<z.ZodNumber>;
3818
- }, z.core.$strip>>;
3819
- }, z.core.$strip>>;
3820
- conversation: z.ZodObject<{
3821
- messages: z.ZodArray<z.ZodObject<{
3822
- id: z.ZodString;
3823
- direction: z.ZodEnum<{
3824
- inbound: "inbound";
3825
- outbound: "outbound";
3826
- }>;
3827
- fromEmail: z.ZodString;
3828
- toEmail: z.ZodString;
3829
- subject: z.ZodNullable<z.ZodString>;
3830
- body: z.ZodString;
3831
- sentAt: z.ZodNullable<z.ZodString>;
3832
- }, z.core.$strip>>;
3833
- }, z.core.$strip>;
3834
- lineage: z.ZodOptional<z.ZodObject<{
3835
- list: z.ZodNullable<z.ZodObject<{
3836
- id: z.ZodString;
3837
- name: z.ZodString;
3838
- status: z.ZodString;
3839
- }, z.core.$strip>>;
3840
- projects: z.ZodArray<z.ZodObject<{
3841
- id: z.ZodString;
3842
- name: z.ZodString;
3843
- kind: z.ZodString;
3844
- status: z.ZodString;
3845
- updatedAt: z.ZodString;
3846
- }, z.core.$strip>>;
3847
- client: z.ZodNullable<z.ZodObject<{
3848
- id: z.ZodString;
3849
- name: z.ZodString;
3850
- status: z.ZodString;
3851
- }, z.core.$strip>>;
3852
- }, z.core.$strip>>;
3853
- }, z.core.$strip>;
3854
- type TransitionItemRequest = z.infer<typeof TransitionItemRequestSchema>;
3855
- type DealDetailResponse = z.infer<typeof DealDetailResponseSchema>;
3856
- /**
3857
- * Lifecycle status enum for `acq_lists.status` (mirrors DB CHECK constraint
3858
- * from migration 20260428000003_lead_gen_acq_lists_status_and_config.sql).
3859
- */
3860
- declare const ListStatusSchema: z.ZodEnum<{
3861
- draft: "draft";
3279
+ label: z.ZodOptional<z.ZodString>;
3280
+ description: z.ZodOptional<z.ZodString>;
3281
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3282
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3283
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3284
+ storage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3285
+ }, z.core.$loose>>>>;
3286
+ linkTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3287
+ id: z.ZodString;
3288
+ label: z.ZodOptional<z.ZodString>;
3289
+ description: z.ZodOptional<z.ZodString>;
3290
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3291
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3292
+ from: z.ZodString;
3293
+ to: z.ZodString;
3294
+ cardinality: z.ZodOptional<z.ZodString>;
3295
+ via: z.ZodOptional<z.ZodString>;
3296
+ }, z.core.$loose>>>>;
3297
+ actionTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3298
+ id: z.ZodString;
3299
+ label: z.ZodOptional<z.ZodString>;
3300
+ description: z.ZodOptional<z.ZodString>;
3301
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3302
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3303
+ actsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
3304
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3305
+ effects: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
3306
+ }, z.core.$loose>>>>;
3307
+ catalogTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3308
+ id: z.ZodString;
3309
+ label: z.ZodOptional<z.ZodString>;
3310
+ description: z.ZodOptional<z.ZodString>;
3311
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3312
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3313
+ kind: z.ZodOptional<z.ZodString>;
3314
+ appliesTo: z.ZodOptional<z.ZodString>;
3315
+ entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3316
+ }, z.core.$loose>>>>;
3317
+ eventTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3318
+ id: z.ZodString;
3319
+ label: z.ZodOptional<z.ZodString>;
3320
+ description: z.ZodOptional<z.ZodString>;
3321
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3322
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3323
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3324
+ }, z.core.$loose>>>>;
3325
+ interfaceTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3326
+ id: z.ZodString;
3327
+ label: z.ZodOptional<z.ZodString>;
3328
+ description: z.ZodOptional<z.ZodString>;
3329
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3330
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3331
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3332
+ }, z.core.$loose>>>>;
3333
+ valueTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3334
+ id: z.ZodString;
3335
+ label: z.ZodOptional<z.ZodString>;
3336
+ description: z.ZodOptional<z.ZodString>;
3337
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3338
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3339
+ primitive: z.ZodOptional<z.ZodString>;
3340
+ }, z.core.$loose>>>>;
3341
+ sharedProperties: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3342
+ id: z.ZodString;
3343
+ label: z.ZodOptional<z.ZodString>;
3344
+ description: z.ZodOptional<z.ZodString>;
3345
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3346
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3347
+ valueType: z.ZodOptional<z.ZodString>;
3348
+ searchable: z.ZodOptional<z.ZodBoolean>;
3349
+ pii: z.ZodOptional<z.ZodBoolean>;
3350
+ }, z.core.$loose>>>>;
3351
+ groups: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3352
+ id: z.ZodString;
3353
+ label: z.ZodOptional<z.ZodString>;
3354
+ description: z.ZodOptional<z.ZodString>;
3355
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3356
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3357
+ members: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
3358
+ }, z.core.$loose>>>>;
3359
+ surfaces: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3360
+ id: z.ZodString;
3361
+ label: z.ZodOptional<z.ZodString>;
3362
+ description: z.ZodOptional<z.ZodString>;
3363
+ ownerSystemId: z.ZodOptional<z.ZodString>;
3364
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
3365
+ route: z.ZodOptional<z.ZodString>;
3366
+ }, z.core.$loose>>>>;
3367
+ }, z.core.$strip>>;
3368
+ type OntologyScope = z.infer<typeof OntologyScopeSchema>;
3369
+
3370
+ type JsonPrimitive = string | number | boolean | null;
3371
+ type JsonValue = JsonPrimitive | JsonValue[] | {
3372
+ [key: string]: JsonValue;
3373
+ };
3374
+ /** Explicit interface needed to annotate the recursive SystemEntrySchema. */
3375
+ interface SystemEntry {
3376
+ id: string;
3377
+ label?: string;
3378
+ title?: string;
3379
+ description?: string;
3380
+ kind?: 'product' | 'operational' | 'platform' | 'diagnostic';
3381
+ parentSystemId?: string;
3382
+ ui?: {
3383
+ path: string;
3384
+ surfaces: string[];
3385
+ icon?: string;
3386
+ order?: number;
3387
+ };
3388
+ lifecycle?: 'draft' | 'beta' | 'active' | 'deprecated' | 'archived';
3389
+ responsibleRoleId?: string;
3390
+ governedByKnowledge?: string[];
3391
+ actions?: {
3392
+ actionId: string;
3393
+ intent: 'exposes' | 'consumes';
3394
+ invocation?: unknown;
3395
+ }[];
3396
+ policies?: string[];
3397
+ drivesGoals?: string[];
3398
+ /** @deprecated Use lifecycle. Accepted for one publish cycle. */
3399
+ status?: 'active' | 'deprecated' | 'archived';
3400
+ path?: string;
3401
+ icon?: string;
3402
+ color?: string;
3403
+ uiPosition?: 'sidebar-primary' | 'sidebar-bottom';
3404
+ enabled?: boolean;
3405
+ devOnly?: boolean;
3406
+ requiresAdmin?: boolean;
3407
+ order: number;
3408
+ config?: Record<string, JsonValue>;
3409
+ ontology?: OntologyScope;
3410
+ systems?: Record<string, SystemEntry>;
3411
+ subsystems?: Record<string, SystemEntry>;
3412
+ }
3413
+
3414
+ declare const ResourceGovernanceStatusSchema: z.ZodEnum<{
3415
+ active: "active";
3416
+ deprecated: "deprecated";
3862
3417
  archived: "archived";
3863
- enriching: "enriching";
3864
- launched: "launched";
3865
- closing: "closing";
3866
3418
  }>;
3867
- declare const ListCompaniesQuerySchema: z.ZodObject<{
3868
- search: z.ZodOptional<z.ZodString>;
3869
- listId: z.ZodOptional<z.ZodString>;
3870
- domain: z.ZodOptional<z.ZodString>;
3871
- website: z.ZodOptional<z.ZodString>;
3872
- segment: z.ZodOptional<z.ZodString>;
3873
- category: z.ZodOptional<z.ZodString>;
3874
- pipelineStatus: z.ZodOptional<z.ZodUnknown>;
3875
- batchId: z.ZodOptional<z.ZodString>;
3876
- status: z.ZodOptional<z.ZodEnum<{
3877
- active: "active";
3878
- invalid: "invalid";
3879
- }>>;
3880
- includeAll: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
3881
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3882
- offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3883
- }, z.core.$strict>;
3884
- declare const ListContactsQuerySchema: z.ZodObject<{
3885
- search: z.ZodOptional<z.ZodString>;
3886
- listId: z.ZodOptional<z.ZodString>;
3887
- openingLineIsNull: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
3888
- batchId: z.ZodOptional<z.ZodString>;
3889
- contactStatus: z.ZodOptional<z.ZodEnum<{
3419
+ declare const ResourceEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3420
+ id: z.ZodString;
3421
+ order: z.ZodDefault<z.ZodNumber>;
3422
+ systemPath: z.ZodString;
3423
+ title: z.ZodOptional<z.ZodString>;
3424
+ description: z.ZodOptional<z.ZodString>;
3425
+ ownerRoleId: z.ZodOptional<z.ZodString>;
3426
+ status: z.ZodEnum<{
3890
3427
  active: "active";
3891
- invalid: "invalid";
3892
- }>>;
3893
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3894
- offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3895
- }, z.core.$strict>;
3896
- declare const AcqCompanyResponseSchema: z.ZodObject<{
3428
+ deprecated: "deprecated";
3429
+ archived: "archived";
3430
+ }>;
3431
+ ontology: z.ZodOptional<z.ZodObject<{
3432
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3433
+ primaryAction: z.ZodOptional<z.ZodString>;
3434
+ reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
3435
+ writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3436
+ usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
3437
+ emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
3438
+ contract: z.ZodOptional<z.ZodObject<{
3439
+ input: z.ZodOptional<z.ZodString>;
3440
+ output: z.ZodOptional<z.ZodString>;
3441
+ }, z.core.$strip>>;
3442
+ }, z.core.$strip>>;
3443
+ codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
3444
+ path: z.ZodString;
3445
+ role: z.ZodEnum<{
3446
+ entrypoint: "entrypoint";
3447
+ handler: "handler";
3448
+ schema: "schema";
3449
+ test: "test";
3450
+ docs: "docs";
3451
+ config: "config";
3452
+ }>;
3453
+ symbol: z.ZodOptional<z.ZodString>;
3454
+ description: z.ZodOptional<z.ZodString>;
3455
+ }, z.core.$strip>>>;
3456
+ kind: z.ZodLiteral<"workflow">;
3457
+ emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
3458
+ eventKey: z.ZodString;
3459
+ label: z.ZodString;
3460
+ payloadSchema: z.ZodOptional<z.ZodString>;
3461
+ lifecycle: z.ZodOptional<z.ZodEnum<{
3462
+ active: "active";
3463
+ deprecated: "deprecated";
3464
+ draft: "draft";
3465
+ beta: "beta";
3466
+ archived: "archived";
3467
+ }>>;
3468
+ }, z.core.$strip>>>;
3469
+ }, z.core.$strip>, z.ZodObject<{
3897
3470
  id: z.ZodString;
3898
- organizationId: z.ZodString;
3899
- clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3900
- name: z.ZodString;
3901
- domain: z.ZodNullable<z.ZodString>;
3902
- linkedinUrl: z.ZodNullable<z.ZodString>;
3903
- website: z.ZodNullable<z.ZodString>;
3904
- numEmployees: z.ZodNullable<z.ZodNumber>;
3905
- foundedYear: z.ZodNullable<z.ZodNumber>;
3906
- locationCity: z.ZodNullable<z.ZodString>;
3907
- locationState: z.ZodNullable<z.ZodString>;
3908
- category: z.ZodNullable<z.ZodString>;
3909
- categoryPain: z.ZodNullable<z.ZodString>;
3910
- segment: z.ZodNullable<z.ZodString>;
3911
- processingState: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
3912
- status: z.ZodEnum<{
3913
- error: "error";
3914
- success: "success";
3915
- no_result: "no_result";
3916
- skipped: "skipped";
3471
+ order: z.ZodDefault<z.ZodNumber>;
3472
+ systemPath: z.ZodString;
3473
+ title: z.ZodOptional<z.ZodString>;
3474
+ description: z.ZodOptional<z.ZodString>;
3475
+ ownerRoleId: z.ZodOptional<z.ZodString>;
3476
+ status: z.ZodEnum<{
3477
+ active: "active";
3478
+ deprecated: "deprecated";
3479
+ archived: "archived";
3480
+ }>;
3481
+ ontology: z.ZodOptional<z.ZodObject<{
3482
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3483
+ primaryAction: z.ZodOptional<z.ZodString>;
3484
+ reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
3485
+ writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3486
+ usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
3487
+ emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
3488
+ contract: z.ZodOptional<z.ZodObject<{
3489
+ input: z.ZodOptional<z.ZodString>;
3490
+ output: z.ZodOptional<z.ZodString>;
3491
+ }, z.core.$strip>>;
3492
+ }, z.core.$strip>>;
3493
+ codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
3494
+ path: z.ZodString;
3495
+ role: z.ZodEnum<{
3496
+ entrypoint: "entrypoint";
3497
+ handler: "handler";
3498
+ schema: "schema";
3499
+ test: "test";
3500
+ docs: "docs";
3501
+ config: "config";
3917
3502
  }>;
3918
- data: z.ZodOptional<z.ZodUnknown>;
3919
- }, z.core.$loose>>>;
3920
- pipelineStatus: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
3921
- enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3922
- source: z.ZodNullable<z.ZodString>;
3923
- batchId: z.ZodNullable<z.ZodString>;
3503
+ symbol: z.ZodOptional<z.ZodString>;
3504
+ description: z.ZodOptional<z.ZodString>;
3505
+ }, z.core.$strip>>>;
3506
+ kind: z.ZodLiteral<"agent">;
3507
+ agentKind: z.ZodEnum<{
3508
+ platform: "platform";
3509
+ orchestrator: "orchestrator";
3510
+ specialist: "specialist";
3511
+ utility: "utility";
3512
+ }>;
3513
+ actsAsRoleId: z.ZodOptional<z.ZodString>;
3514
+ sessionCapable: z.ZodBoolean;
3515
+ invocations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
3516
+ kind: z.ZodLiteral<"slash-command">;
3517
+ command: z.ZodString;
3518
+ toolFactory: z.ZodOptional<z.ZodString>;
3519
+ }, z.core.$strip>, z.ZodObject<{
3520
+ kind: z.ZodLiteral<"mcp-tool">;
3521
+ server: z.ZodString;
3522
+ name: z.ZodString;
3523
+ }, z.core.$strip>, z.ZodObject<{
3524
+ kind: z.ZodLiteral<"api-endpoint">;
3525
+ method: z.ZodEnum<{
3526
+ GET: "GET";
3527
+ POST: "POST";
3528
+ PATCH: "PATCH";
3529
+ DELETE: "DELETE";
3530
+ }>;
3531
+ path: z.ZodString;
3532
+ requestSchema: z.ZodOptional<z.ZodString>;
3533
+ responseSchema: z.ZodOptional<z.ZodString>;
3534
+ }, z.core.$strip>, z.ZodObject<{
3535
+ kind: z.ZodLiteral<"script-execution">;
3536
+ resourceId: z.ZodString;
3537
+ }, z.core.$strip>], "kind">>>;
3538
+ emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
3539
+ eventKey: z.ZodString;
3540
+ label: z.ZodString;
3541
+ payloadSchema: z.ZodOptional<z.ZodString>;
3542
+ lifecycle: z.ZodOptional<z.ZodEnum<{
3543
+ active: "active";
3544
+ deprecated: "deprecated";
3545
+ draft: "draft";
3546
+ beta: "beta";
3547
+ archived: "archived";
3548
+ }>>;
3549
+ }, z.core.$strip>>>;
3550
+ }, z.core.$strip>, z.ZodObject<{
3551
+ id: z.ZodString;
3552
+ order: z.ZodDefault<z.ZodNumber>;
3553
+ systemPath: z.ZodString;
3554
+ title: z.ZodOptional<z.ZodString>;
3555
+ description: z.ZodOptional<z.ZodString>;
3556
+ ownerRoleId: z.ZodOptional<z.ZodString>;
3924
3557
  status: z.ZodEnum<{
3925
3558
  active: "active";
3926
- invalid: "invalid";
3559
+ deprecated: "deprecated";
3560
+ archived: "archived";
3927
3561
  }>;
3928
- contactCount: z.ZodNumber;
3929
- verticalResearch: z.ZodNullable<z.ZodString>;
3930
- createdAt: z.ZodString;
3931
- updatedAt: z.ZodString;
3932
- }, z.core.$strip>;
3933
- declare const AcqContactResponseSchema: z.ZodObject<{
3934
- id: z.ZodString;
3935
- organizationId: z.ZodString;
3936
- clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3937
- companyId: z.ZodNullable<z.ZodString>;
3938
- email: z.ZodString;
3939
- emailValid: z.ZodNullable<z.ZodEnum<{
3940
- VALID: "VALID";
3941
- INVALID: "INVALID";
3942
- RISKY: "RISKY";
3943
- UNKNOWN: "UNKNOWN";
3944
- }>>;
3945
- firstName: z.ZodNullable<z.ZodString>;
3946
- lastName: z.ZodNullable<z.ZodString>;
3947
- linkedinUrl: z.ZodNullable<z.ZodString>;
3948
- title: z.ZodNullable<z.ZodString>;
3949
- headline: z.ZodNullable<z.ZodString>;
3950
- filterReason: z.ZodNullable<z.ZodString>;
3951
- openingLine: z.ZodNullable<z.ZodString>;
3952
- source: z.ZodNullable<z.ZodString>;
3953
- sourceId: z.ZodNullable<z.ZodString>;
3954
- processingState: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
3955
- status: z.ZodEnum<{
3956
- error: "error";
3957
- success: "success";
3958
- no_result: "no_result";
3959
- skipped: "skipped";
3562
+ ontology: z.ZodOptional<z.ZodObject<{
3563
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3564
+ primaryAction: z.ZodOptional<z.ZodString>;
3565
+ reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
3566
+ writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3567
+ usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
3568
+ emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
3569
+ contract: z.ZodOptional<z.ZodObject<{
3570
+ input: z.ZodOptional<z.ZodString>;
3571
+ output: z.ZodOptional<z.ZodString>;
3572
+ }, z.core.$strip>>;
3573
+ }, z.core.$strip>>;
3574
+ codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
3575
+ path: z.ZodString;
3576
+ role: z.ZodEnum<{
3577
+ entrypoint: "entrypoint";
3578
+ handler: "handler";
3579
+ schema: "schema";
3580
+ test: "test";
3581
+ docs: "docs";
3582
+ config: "config";
3960
3583
  }>;
3961
- data: z.ZodOptional<z.ZodUnknown>;
3962
- }, z.core.$loose>>>;
3963
- pipelineStatus: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
3964
- enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3965
- attioPersonId: z.ZodNullable<z.ZodString>;
3966
- batchId: z.ZodNullable<z.ZodString>;
3584
+ symbol: z.ZodOptional<z.ZodString>;
3585
+ description: z.ZodOptional<z.ZodString>;
3586
+ }, z.core.$strip>>>;
3587
+ kind: z.ZodLiteral<"integration">;
3588
+ provider: z.ZodString;
3589
+ }, z.core.$strip>, z.ZodObject<{
3590
+ id: z.ZodString;
3591
+ order: z.ZodDefault<z.ZodNumber>;
3592
+ systemPath: z.ZodString;
3593
+ title: z.ZodOptional<z.ZodString>;
3594
+ description: z.ZodOptional<z.ZodString>;
3595
+ ownerRoleId: z.ZodOptional<z.ZodString>;
3967
3596
  status: z.ZodEnum<{
3968
3597
  active: "active";
3969
- invalid: "invalid";
3598
+ deprecated: "deprecated";
3599
+ archived: "archived";
3970
3600
  }>;
3971
- company: z.ZodOptional<z.ZodNullable<z.ZodObject<{
3972
- id: z.ZodString;
3973
- name: z.ZodString;
3974
- domain: z.ZodNullable<z.ZodString>;
3975
- website: z.ZodNullable<z.ZodString>;
3976
- linkedinUrl: z.ZodNullable<z.ZodString>;
3977
- segment: z.ZodNullable<z.ZodString>;
3978
- category: z.ZodNullable<z.ZodString>;
3979
- status: z.ZodEnum<{
3980
- active: "active";
3981
- invalid: "invalid";
3601
+ ontology: z.ZodOptional<z.ZodObject<{
3602
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3603
+ primaryAction: z.ZodOptional<z.ZodString>;
3604
+ reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
3605
+ writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3606
+ usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
3607
+ emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
3608
+ contract: z.ZodOptional<z.ZodObject<{
3609
+ input: z.ZodOptional<z.ZodString>;
3610
+ output: z.ZodOptional<z.ZodString>;
3611
+ }, z.core.$strip>>;
3612
+ }, z.core.$strip>>;
3613
+ codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
3614
+ path: z.ZodString;
3615
+ role: z.ZodEnum<{
3616
+ entrypoint: "entrypoint";
3617
+ handler: "handler";
3618
+ schema: "schema";
3619
+ test: "test";
3620
+ docs: "docs";
3621
+ config: "config";
3982
3622
  }>;
3623
+ symbol: z.ZodOptional<z.ZodString>;
3624
+ description: z.ZodOptional<z.ZodString>;
3983
3625
  }, z.core.$strip>>>;
3984
- createdAt: z.ZodString;
3985
- updatedAt: z.ZodString;
3986
- }, z.core.$strip>;
3987
- declare const AcqArtifactOwnerKindSchema: z.ZodEnum<{
3988
- list: "list";
3989
- company: "company";
3990
- contact: "contact";
3991
- deal: "deal";
3992
- list_member: "list_member";
3993
- }>;
3994
- declare const ListRecordEntitySchema: z.ZodEnum<{
3995
- company: "company";
3996
- contact: "contact";
3997
- }>;
3998
- type ListCompaniesQuery = z.infer<typeof ListCompaniesQuerySchema>;
3999
- type ListContactsQuery = z.infer<typeof ListContactsQuerySchema>;
4000
- type AcqCompanyResponse = z.infer<typeof AcqCompanyResponseSchema>;
4001
- type AcqContactResponse = z.infer<typeof AcqContactResponseSchema>;
4002
- type AcqArtifactOwnerKind = z.infer<typeof AcqArtifactOwnerKindSchema>;
4003
- type ListRecordEntity = z.infer<typeof ListRecordEntitySchema>;
4004
- type ListStatus = z.infer<typeof ListStatusSchema>;
3626
+ kind: z.ZodLiteral<"script">;
3627
+ language: z.ZodEnum<{
3628
+ shell: "shell";
3629
+ sql: "sql";
3630
+ typescript: "typescript";
3631
+ python: "python";
3632
+ }>;
3633
+ source: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3634
+ file: z.ZodString;
3635
+ }, z.core.$strip>]>;
3636
+ }, z.core.$strip>], "kind">;
3637
+ type ResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>;
3638
+ type ResourceEntry = z.infer<typeof ResourceEntrySchema>;
4005
3639
 
4006
- /** Raw database row type for acq_deals table */
4007
- type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
4008
- type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing';
4009
- type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low';
4010
- interface DealPriority {
4011
- bucketKey: DealPriorityBucketKey;
4012
- rank: number;
4013
- label: string;
4014
- color: string;
4015
- reason: string;
4016
- latestActivityAt: string | null;
4017
- nextActionAt: string | null;
3640
+ /**
3641
+ * Error categories for observability grouping and classification.
3642
+ * Used to categorize errors in the execution_errors table metadata.
3643
+ */
3644
+ type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
3645
+
3646
+ /**
3647
+ * Workflow-specific logging types and utilities
3648
+ */
3649
+
3650
+ interface WorkflowExecutionContext {
3651
+ type: 'workflow';
3652
+ contextType: 'workflow-execution';
3653
+ executionId: string;
3654
+ workflowId: string;
3655
+ workflowName?: string;
3656
+ organizationId: string;
3657
+ executionPath?: string[];
3658
+ }
3659
+ interface WorkflowFailureContext {
3660
+ type: 'workflow';
3661
+ contextType: 'workflow-failure';
3662
+ executionId: string;
3663
+ workflowId: string;
3664
+ error: string;
3665
+ }
3666
+ interface StepStartedContext {
3667
+ type: 'workflow';
3668
+ contextType: 'step-started';
3669
+ stepId: string;
3670
+ stepStatus: 'started';
3671
+ input: unknown;
3672
+ startTime: number;
3673
+ }
3674
+ interface StepCompletedContext {
3675
+ type: 'workflow';
3676
+ contextType: 'step-completed';
3677
+ stepId: string;
3678
+ stepStatus: 'completed';
3679
+ output: unknown;
3680
+ duration: number;
3681
+ isTerminal: boolean;
3682
+ startTime: number;
3683
+ endTime: number;
3684
+ }
3685
+ interface StepFailedContext {
3686
+ type: 'workflow';
3687
+ contextType: 'step-failed';
3688
+ stepId: string;
3689
+ stepStatus: 'failed';
3690
+ error: string;
3691
+ duration: number;
3692
+ startTime: number;
3693
+ endTime: number;
3694
+ }
3695
+ interface ConditionalRouteContext {
3696
+ type: 'workflow';
3697
+ contextType: 'conditional-route';
3698
+ stepId: string;
3699
+ target: string;
3700
+ error?: string;
3701
+ }
3702
+ interface ExecutionPathContext {
3703
+ type: 'workflow';
3704
+ contextType: 'execution-path';
3705
+ executionPath: string[];
3706
+ }
3707
+ type WorkflowLogContext = WorkflowExecutionContext | WorkflowFailureContext | StepStartedContext | StepCompletedContext | StepFailedContext | ConditionalRouteContext | ExecutionPathContext;
3708
+
3709
+ /**
3710
+ * Agent-specific logging types
3711
+ * Simplified 2-event model: lifecycle, iteration
3712
+ *
3713
+ * Design Philosophy:
3714
+ * - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
3715
+ * - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
3716
+ */
3717
+
3718
+ /**
3719
+ * Agent lifecycle stages
3720
+ * Universal checkpoints that apply to all agent executions
3721
+ */
3722
+ type AgentLifecycle = 'initialization' | 'iteration' | 'completion';
3723
+ /**
3724
+ * Iteration event types
3725
+ * Activities that occur during agent iterations
3726
+ */
3727
+ type IterationEventType = 'reasoning' | 'action' | 'tool-call';
3728
+ /**
3729
+ * Base fields shared by all lifecycle events
3730
+ */
3731
+ interface AgentLifecycleEventBase {
3732
+ type: 'agent';
3733
+ agentId: string;
3734
+ lifecycle: AgentLifecycle;
3735
+ sessionId?: string;
4018
3736
  }
4019
- interface DealContact {
4020
- id: string;
4021
- first_name: string | null;
4022
- last_name: string | null;
4023
- email: string;
4024
- title: string | null;
4025
- headline: string | null;
4026
- linkedin_url: string | null;
4027
- processing_state: Record<string, unknown> | null;
4028
- enrichment_data: Record<string, unknown> | null;
4029
- company: {
4030
- id: string;
4031
- name: string;
4032
- domain: string | null;
4033
- website: string | null;
4034
- linkedin_url: string | null;
4035
- segment: string | null;
4036
- category: string | null;
4037
- num_employees: number | null;
4038
- } | null;
3737
+ /**
3738
+ * Lifecycle started event - emitted when a phase begins
3739
+ * REQUIRED: startTime (phase has started, no end yet)
3740
+ */
3741
+ interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
3742
+ stage: 'started';
3743
+ startTime: number;
3744
+ iteration?: number;
4039
3745
  }
4040
- interface DealFilters {
4041
- stage?: DealStage;
4042
- search?: string;
4043
- limit?: number;
4044
- offset?: number;
3746
+ /**
3747
+ * Lifecycle completed event - emitted when a phase succeeds
3748
+ * REQUIRED: startTime, endTime, duration (phase has finished successfully)
3749
+ */
3750
+ interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
3751
+ stage: 'completed';
3752
+ startTime: number;
3753
+ endTime: number;
3754
+ duration: number;
3755
+ iteration?: number;
3756
+ attempts?: number;
3757
+ memorySize?: {
3758
+ sessionMemoryKeys: number;
3759
+ historyEntries: number;
3760
+ };
4045
3761
  }
4046
- /** Deal list item with joined contact and company data */
4047
- interface DealListItem extends AcqDealRow {
4048
- priority: DealPriority;
4049
- ownership: 'us' | 'them' | null;
4050
- nextAction: string | null;
4051
- contact: DealContact | null;
3762
+ /**
3763
+ * Lifecycle failed event - emitted when a phase fails
3764
+ * REQUIRED: startTime, endTime, duration, error (phase has finished with error)
3765
+ */
3766
+ interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
3767
+ stage: 'failed';
3768
+ startTime: number;
3769
+ endTime: number;
3770
+ duration: number;
3771
+ error: string;
3772
+ iteration?: number;
4052
3773
  }
4053
- type DealDetail$1 = DealListItem;
4054
- /** Task kind options for a deal task (human follow-up action type) */
4055
- type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
4056
3774
  /**
4057
- * A CRM to-do item attached to a deal representing a human follow-up action.
4058
- * Transformed from AcqDealTaskRow with camelCase properties.
3775
+ * Union type for all lifecycle events
3776
+ * Discriminated by 'stage' field for type narrowing
4059
3777
  */
4060
- interface AcqDealTask {
4061
- id: string;
4062
- organizationId: string;
4063
- dealId: string;
4064
- title: string;
4065
- description: string | null;
4066
- kind: AcqDealTaskKind;
4067
- dueAt: string | null;
4068
- assigneeUserId: string | null;
4069
- completedAt: string | null;
4070
- completedByUserId: string | null;
4071
- createdAt: string;
4072
- updatedAt: string;
4073
- createdByUserId: string | null;
3778
+ type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent;
3779
+ /**
3780
+ * Placeholder data for MVP
3781
+ * Will be typed per actionType in future
3782
+ */
3783
+ interface ActionPlaceholderData {
3784
+ message: string;
4074
3785
  }
4075
3786
  /**
4076
- * Live-scan aggregate telemetry for a single list, computed on demand from
4077
- * the list junction tables and current contact deliverability state.
4078
- * `stageCounts` are attempted counts from list-row processing_state.
3787
+ * Iteration event - captures activities during agent iterations
3788
+ * Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
4079
3789
  */
4080
- interface ListTelemetry {
4081
- listId: string;
4082
- totalCompanies: number;
4083
- totalContacts: number;
4084
- stageCounts: {
4085
- populated: number;
4086
- extracted: number;
4087
- qualified: number;
4088
- discovered: number;
4089
- verified: number;
4090
- personalized: number;
4091
- uploaded: number;
3790
+ interface AgentIterationEvent {
3791
+ type: 'agent';
3792
+ agentId: string;
3793
+ lifecycle: 'iteration';
3794
+ eventType: IterationEventType;
3795
+ iteration: number;
3796
+ sessionId?: string;
3797
+ startTime: number;
3798
+ endTime: number;
3799
+ duration: number;
3800
+ output?: string;
3801
+ actionType?: string;
3802
+ data?: ActionPlaceholderData;
3803
+ }
3804
+ /**
3805
+ * Tool call event - captures individual tool executions during iterations
3806
+ * Provides granular timing for each tool invocation
3807
+ */
3808
+ interface AgentToolCallEvent {
3809
+ type: 'agent';
3810
+ agentId: string;
3811
+ lifecycle: 'iteration';
3812
+ eventType: 'tool-call';
3813
+ iteration: number;
3814
+ sessionId?: string;
3815
+ toolName: string;
3816
+ startTime: number;
3817
+ endTime: number;
3818
+ duration: number;
3819
+ success: boolean;
3820
+ error?: string;
3821
+ input?: Record<string, unknown>;
3822
+ output?: unknown;
3823
+ }
3824
+ /**
3825
+ * Union type for all agent log contexts
3826
+ * 3 event types total (lifecycle, iteration, tool-call)
3827
+ */
3828
+ type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent;
3829
+
3830
+ /**
3831
+ * Base execution logger for Execution Engine
3832
+ */
3833
+ type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error';
3834
+
3835
+ type LogContext = WorkflowLogContext | AgentLogContext;
3836
+ interface ExecutionLogMessage {
3837
+ level: ExecutionLogLevel;
3838
+ message: string;
3839
+ timestamp: number;
3840
+ context?: LogContext;
3841
+ }
3842
+
3843
+ declare const LinkSchema: z.ZodObject<{
3844
+ nodeId: z.ZodString;
3845
+ kind: z.ZodEnum<{
3846
+ affects: "affects";
3847
+ actions: "actions";
3848
+ effects: "effects";
3849
+ links: "links";
3850
+ reads: "reads";
3851
+ writes: "writes";
3852
+ emits: "emits";
3853
+ triggers: "triggers";
3854
+ uses: "uses";
3855
+ approval: "approval";
3856
+ contains: "contains";
3857
+ references: "references";
3858
+ maps_to: "maps_to";
3859
+ governs: "governs";
3860
+ originates_from: "originates_from";
3861
+ applies_to: "applies_to";
3862
+ uses_catalog: "uses_catalog";
3863
+ }>;
3864
+ }, z.core.$strip>;
3865
+ type Link = z.infer<typeof LinkSchema>;
3866
+
3867
+ declare const ResourceCategorySchema: z.ZodEnum<{
3868
+ diagnostic: "diagnostic";
3869
+ production: "production";
3870
+ internal: "internal";
3871
+ testing: "testing";
3872
+ }>;
3873
+ type ResourceCategory = z.infer<typeof ResourceCategorySchema>;
3874
+ type ResourceLink = Link;
3875
+
3876
+ /**
3877
+ * Serialized Registry Types
3878
+ *
3879
+ * Pre-computed JSON-safe types for API responses and Command View.
3880
+ * Serialization happens once at API startup, enabling instant response times.
3881
+ */
3882
+
3883
+ /**
3884
+ * Serialized agent definition (JSON-safe)
3885
+ * Result of serializeDefinition(AgentDefinition)
3886
+ */
3887
+ interface SerializedAgentDefinition {
3888
+ config: {
3889
+ resourceId: string;
3890
+ name: string;
3891
+ description: string;
3892
+ version: string;
3893
+ type: 'agent';
3894
+ kind: 'orchestrator' | 'specialist' | 'utility' | 'system';
3895
+ status: 'dev' | 'prod';
3896
+ links?: ResourceLink[];
3897
+ category?: ResourceCategory;
3898
+ /** Whether this resource is archived and should be excluded from registration and deployment */
3899
+ archived?: boolean;
3900
+ systemPrompt: string;
3901
+ constraints?: {
3902
+ maxIterations?: number;
3903
+ timeout?: number;
3904
+ maxSessionMemoryKeys?: number;
3905
+ maxMemoryTokens?: number;
3906
+ };
3907
+ sessionCapable?: boolean;
3908
+ memoryPreferences?: string;
4092
3909
  };
4093
- deliverability: {
4094
- valid: number;
4095
- risky: number;
4096
- invalid: number;
4097
- unknown: number;
4098
- bounced: number;
3910
+ modelConfig: {
3911
+ provider: string;
3912
+ model: string;
3913
+ apiKey: string;
3914
+ temperature: number;
3915
+ maxOutputTokens: number;
3916
+ topP?: number;
3917
+ modelOptions?: Record<string, unknown>;
3918
+ };
3919
+ contract: {
3920
+ inputSchema: object;
3921
+ outputSchema?: object;
4099
3922
  };
4100
- /** Reserved -- active workflow IDs associated with this list. */
4101
- activeWorkflows?: string[];
4102
- }
4103
-
4104
- /**
4105
- * Lead Service Types
4106
- * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
4107
- *
4108
- * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
4109
- */
4110
-
4111
- interface AcqDealNote {
4112
- id: string;
4113
- dealId: string;
4114
- organizationId: string;
4115
- authorUserId: string | null;
4116
- body: string;
4117
- createdAt: string;
4118
- updatedAt: string;
3923
+ tools: Array<{
3924
+ name: string;
3925
+ description: string;
3926
+ inputSchema?: object;
3927
+ outputSchema?: object;
3928
+ }>;
3929
+ knowledgeMap?: {
3930
+ nodeCount: number;
3931
+ nodes: Array<{
3932
+ id: string;
3933
+ description: string;
3934
+ loaded: boolean;
3935
+ hasPrompt: boolean;
3936
+ }>;
3937
+ };
3938
+ metricsConfig?: object;
4119
3939
  }
4120
-
4121
3940
  /**
4122
- * Action configuration for HITL tasks
4123
- * Defines available user actions and their behavior
3941
+ * Serialized workflow definition (JSON-safe)
3942
+ * Result of serializeDefinition(WorkflowDefinition)
4124
3943
  */
4125
- interface ActionConfig {
4126
- /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
4127
- id: string;
4128
- /** Display label for UI button */
4129
- label: string;
4130
- /** Button variant/style */
4131
- type: 'primary' | 'secondary' | 'danger' | 'outline';
4132
- /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
4133
- icon?: string;
4134
- /** Button color (Mantine theme colors) */
4135
- color?: string;
4136
- /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
4137
- variant?: string;
4138
- /** Execution target (agent/workflow to invoke) */
4139
- target?: {
4140
- resourceType: 'agent' | 'workflow';
3944
+ interface SerializedWorkflowDefinition {
3945
+ config: {
4141
3946
  resourceId: string;
4142
- /**
4143
- * Optional session ID for agent continuation.
4144
- * If provided, invokes a new turn on the existing session instead of standalone execution.
4145
- * Only valid when resourceType is 'agent'.
4146
- */
4147
- sessionId?: string;
3947
+ name: string;
3948
+ description: string;
3949
+ version: string;
3950
+ type: 'workflow';
3951
+ status: 'dev' | 'prod';
3952
+ links?: ResourceLink[];
3953
+ category?: ResourceCategory;
3954
+ /** Whether this resource is archived and should be excluded from registration and deployment */
3955
+ archived?: boolean;
4148
3956
  };
4149
- /** Form schema for collecting action-specific data */
4150
- form?: FormSchema;
4151
- /** Payload template for pre-filling forms */
4152
- payloadTemplate?: unknown;
4153
- /** Requires confirmation dialog */
4154
- requiresConfirmation?: boolean;
4155
- /** Confirmation message */
4156
- confirmationMessage?: string;
4157
- /** Help text / tooltip */
4158
- description?: string;
3957
+ entryPoint: string;
3958
+ steps: Array<{
3959
+ id: string;
3960
+ name: string;
3961
+ description: string;
3962
+ inputSchema?: object;
3963
+ outputSchema?: object;
3964
+ next: {
3965
+ type: 'linear' | 'conditional';
3966
+ target?: string;
3967
+ routes?: Array<{
3968
+ target: string;
3969
+ }>;
3970
+ default?: string;
3971
+ } | null;
3972
+ }>;
3973
+ contract: {
3974
+ inputSchema: object;
3975
+ outputSchema?: object;
3976
+ };
3977
+ metricsConfig?: object;
4159
3978
  }
4160
3979
 
4161
3980
  /**
4162
- * Origin resource type - where an execution/task originated from.
4163
- * Used for audit trails and tracking execution lineage.
3981
+ * Shared form field types for dynamic form generation
3982
+ * Used by: Command Queue, Execution Runner UI, future form-based features
4164
3983
  */
4165
- type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
4166
3984
  /**
4167
- * Origin tracking metadata - who/what created this execution/task.
4168
- * Used by both TaskScheduler and CommandQueue for complete audit trails.
3985
+ * Supported form field types for action payloads
3986
+ * Maps to Mantine form components
4169
3987
  */
4170
- interface OriginTracking {
4171
- originExecutionId: string;
4172
- originResourceType: OriginResourceType;
4173
- originResourceId: string;
4174
- }
4175
-
3988
+ type FormFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'radio' | 'richtext';
4176
3989
  /**
4177
- * Command queue task with flexible action system
3990
+ * Form field definition
4178
3991
  */
4179
- interface Task extends OriginTracking {
4180
- id: string;
4181
- organizationId: string;
4182
- actions: ActionConfig[];
4183
- context: unknown;
4184
- selectedAction?: string;
4185
- actionPayload?: unknown;
3992
+ interface FormField {
3993
+ /** Field key in payload object */
3994
+ name: string;
3995
+ /** Field label for UI */
3996
+ label: string;
3997
+ /** Field type (determines UI component) */
3998
+ type: FormFieldType;
3999
+ /** Default value */
4000
+ defaultValue?: unknown;
4001
+ /** Required field */
4002
+ required?: boolean;
4003
+ /** Placeholder text */
4004
+ placeholder?: string;
4005
+ /** Help text */
4186
4006
  description?: string;
4187
- priority: number;
4188
- /** Optional checkpoint identifier for grouping related human approval tasks */
4189
- humanCheckpoint?: string;
4190
- status: QueueTaskStatus;
4191
- /**
4192
- * Target resource tracking — mirrors origin columns.
4193
- * Set when task is created; patchable to redirect execution to a different resource.
4194
- */
4195
- targetResourceId?: string;
4196
- targetResourceType?: 'agent' | 'workflow';
4197
- /**
4198
- * Execution ID for the action that runs AFTER user approval.
4199
- * NULL until execution starts.
4200
- *
4201
- * Naming distinction:
4202
- * - originExecutionId = Parent execution that CREATED the HITL task
4203
- * - targetExecutionId = Child execution that RUNS AFTER user approval
4204
- */
4205
- targetExecutionId?: string;
4206
- createdAt: Date;
4207
- completedAt?: Date;
4208
- completedBy?: string;
4209
- expiresAt?: Date;
4210
- idempotencyKey?: string | null;
4007
+ /** Options for select/radio */
4008
+ options?: Array<{
4009
+ label: string;
4010
+ value: string | number;
4011
+ }>;
4012
+ /** Min/max for number */
4013
+ min?: number;
4014
+ max?: number;
4015
+ /** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
4016
+ defaultValueFromContext?: string;
4211
4017
  }
4212
4018
  /**
4213
- * Task status values
4214
- * - pending: awaiting action
4215
- * - processing: execution in progress after user approval
4216
- * - completed: action was taken and execution succeeded
4217
- * - failed: execution failed, task can be retried
4218
- * - expired: timed out before action
4219
- */
4220
- type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
4221
- /**
4222
- * Parameters for patching mutable metadata on a task
4019
+ * Form schema for action payload collection
4223
4020
  */
4224
- interface PatchTaskParams {
4225
- humanCheckpoint?: string | null;
4021
+ interface FormSchema {
4022
+ /** Form title */
4023
+ title?: string;
4024
+ /** Form description */
4226
4025
  description?: string;
4227
- priority?: number;
4228
- context?: Record<string, unknown>;
4229
- actions?: unknown[];
4230
- targetResourceId?: string | null;
4231
- targetResourceType?: 'agent' | 'workflow' | null;
4232
- targetExecutionId?: string;
4233
- status?: 'pending' | 'failed' | 'completed';
4234
- }
4235
- interface CommandQueueListResponse {
4236
- tasks: Task[];
4237
- total: number;
4026
+ /** Form fields */
4027
+ fields: FormField[];
4238
4028
  }
4239
4029
 
4240
4030
  /**
4241
- * Checkpoint list item for sidebar grouping
4242
- * The id field contains the resourceId of the human checkpoint
4031
+ * Memory type definitions
4032
+ * Types for agent memory management with semantic entry types
4243
4033
  */
4244
- interface CheckpointListItem {
4245
- /** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
4246
- id: string;
4247
- /** Display name (same as id, or "Ungrouped" for null) */
4248
- name: string;
4249
- /** Task count for this checkpoint */
4250
- count: number;
4034
+ /**
4035
+ * Semantic memory entry types
4036
+ * Use-case agnostic types that describe the purpose of each entry
4037
+ * Memory types mirror action types for clarity and filtering
4038
+ */
4039
+ type MemoryEntryType = 'context' | 'input' | 'reasoning' | 'tool-result' | 'delegation-result' | 'error';
4040
+ /**
4041
+ * Memory entry - represents a single entry in agent memory
4042
+ * Stored in agent memory, translated by adapters to vendor-specific formats
4043
+ */
4044
+ interface MemoryEntry {
4045
+ type: MemoryEntryType;
4046
+ content: string;
4047
+ timestamp: number;
4048
+ turnNumber: number | null;
4049
+ iterationNumber: number | null;
4251
4050
  }
4252
4051
  /**
4253
- * Status counts for pie chart display
4052
+ * Agent memory - Self-orchestrated memory with session + working storage
4053
+ * Agent has full control over what persists, framework handles auto-compaction
4254
4054
  */
4255
- interface StatusCounts {
4256
- pending: number;
4257
- completed: number;
4258
- expired: number;
4055
+ interface AgentMemory {
4056
+ /**
4057
+ * Session memory - Persists for session/conversation duration
4058
+ * Never auto-trimmed by framework
4059
+ * Agent-managed key-value store for critical information
4060
+ * Agent provides strings, framework wraps in MemoryEntry
4061
+ */
4062
+ sessionMemory: Record<string, MemoryEntry>;
4063
+ /**
4064
+ * Working memory - Execution history
4065
+ * Automatically compacted by framework when needed
4066
+ * Agent doesn't control compaction
4067
+ */
4068
+ history: MemoryEntry[];
4259
4069
  }
4070
+
4071
+ declare const TransitionItemRequestSchema: z.ZodObject<{
4072
+ pipelineKey: z.ZodString;
4073
+ stageKey: z.ZodString;
4074
+ stateKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4075
+ reason: z.ZodOptional<z.ZodString>;
4076
+ expectedUpdatedAt: z.ZodOptional<z.ZodString>;
4077
+ }, z.core.$strict>;
4260
4078
  /**
4261
- * Priority counts for donut chart display
4079
+ * Deal detail shape currently the same as a list item (full joined record).
4080
+ * Additive fields keep existing DealListItem callers compatible.
4262
4081
  */
4263
- interface PriorityCounts {
4264
- critical: number;
4265
- high: number;
4266
- medium: number;
4267
- low: number;
4268
- }
4082
+ declare const DealDetailResponseSchema: z.ZodObject<{
4083
+ id: z.ZodString;
4084
+ organization_id: z.ZodString;
4085
+ client_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4086
+ contact_id: z.ZodNullable<z.ZodString>;
4087
+ contact_email: z.ZodString;
4088
+ pipeline_key: z.ZodString;
4089
+ stage_key: z.ZodNullable<z.ZodString>;
4090
+ state_key: z.ZodNullable<z.ZodString>;
4091
+ activity_log: z.ZodUnknown;
4092
+ discovery_data: z.ZodNullable<z.ZodUnknown>;
4093
+ discovery_submitted_at: z.ZodNullable<z.ZodString>;
4094
+ discovery_submitted_by: z.ZodNullable<z.ZodString>;
4095
+ proposal_data: z.ZodNullable<z.ZodUnknown>;
4096
+ proposal_sent_at: z.ZodNullable<z.ZodString>;
4097
+ proposal_pdf_url: z.ZodNullable<z.ZodString>;
4098
+ signature_envelope_id: z.ZodNullable<z.ZodString>;
4099
+ source_list_id: z.ZodNullable<z.ZodString>;
4100
+ source_type: z.ZodNullable<z.ZodString>;
4101
+ initial_fee: z.ZodNullable<z.ZodNumber>;
4102
+ monthly_fee: z.ZodNullable<z.ZodNumber>;
4103
+ closed_lost_at: z.ZodNullable<z.ZodString>;
4104
+ closed_lost_reason: z.ZodNullable<z.ZodString>;
4105
+ created_at: z.ZodString;
4106
+ updated_at: z.ZodString;
4107
+ priority: z.ZodObject<{
4108
+ bucketKey: z.ZodEnum<{
4109
+ needs_response: "needs_response";
4110
+ follow_up_due: "follow_up_due";
4111
+ waiting: "waiting";
4112
+ stale: "stale";
4113
+ closed_low: "closed_low";
4114
+ }>;
4115
+ rank: z.ZodNumber;
4116
+ label: z.ZodString;
4117
+ color: z.ZodString;
4118
+ reason: z.ZodString;
4119
+ latestActivityAt: z.ZodNullable<z.ZodString>;
4120
+ nextActionAt: z.ZodNullable<z.ZodString>;
4121
+ }, z.core.$strip>;
4122
+ ownership: z.ZodNullable<z.ZodEnum<{
4123
+ us: "us";
4124
+ them: "them";
4125
+ }>>;
4126
+ nextAction: z.ZodNullable<z.ZodString>;
4127
+ contact: z.ZodNullable<z.ZodObject<{
4128
+ id: z.ZodString;
4129
+ first_name: z.ZodNullable<z.ZodString>;
4130
+ last_name: z.ZodNullable<z.ZodString>;
4131
+ email: z.ZodString;
4132
+ title: z.ZodNullable<z.ZodString>;
4133
+ headline: z.ZodNullable<z.ZodString>;
4134
+ linkedin_url: z.ZodNullable<z.ZodString>;
4135
+ processing_state: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
4136
+ status: z.ZodEnum<{
4137
+ error: "error";
4138
+ success: "success";
4139
+ no_result: "no_result";
4140
+ skipped: "skipped";
4141
+ }>;
4142
+ data: z.ZodOptional<z.ZodUnknown>;
4143
+ }, z.core.$loose>>>;
4144
+ enrichment_data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4145
+ company: z.ZodNullable<z.ZodObject<{
4146
+ id: z.ZodString;
4147
+ name: z.ZodString;
4148
+ domain: z.ZodNullable<z.ZodString>;
4149
+ website: z.ZodNullable<z.ZodString>;
4150
+ linkedin_url: z.ZodNullable<z.ZodString>;
4151
+ segment: z.ZodNullable<z.ZodString>;
4152
+ category: z.ZodNullable<z.ZodString>;
4153
+ num_employees: z.ZodNullable<z.ZodNumber>;
4154
+ }, z.core.$strip>>;
4155
+ }, z.core.$strip>>;
4156
+ conversation: z.ZodObject<{
4157
+ messages: z.ZodArray<z.ZodObject<{
4158
+ id: z.ZodString;
4159
+ direction: z.ZodEnum<{
4160
+ inbound: "inbound";
4161
+ outbound: "outbound";
4162
+ }>;
4163
+ fromEmail: z.ZodString;
4164
+ toEmail: z.ZodString;
4165
+ subject: z.ZodNullable<z.ZodString>;
4166
+ body: z.ZodString;
4167
+ sentAt: z.ZodNullable<z.ZodString>;
4168
+ }, z.core.$strip>>;
4169
+ }, z.core.$strip>;
4170
+ lineage: z.ZodOptional<z.ZodObject<{
4171
+ list: z.ZodNullable<z.ZodObject<{
4172
+ id: z.ZodString;
4173
+ name: z.ZodString;
4174
+ status: z.ZodString;
4175
+ }, z.core.$strip>>;
4176
+ projects: z.ZodArray<z.ZodObject<{
4177
+ id: z.ZodString;
4178
+ name: z.ZodString;
4179
+ kind: z.ZodString;
4180
+ status: z.ZodString;
4181
+ updatedAt: z.ZodString;
4182
+ }, z.core.$strip>>;
4183
+ client: z.ZodNullable<z.ZodObject<{
4184
+ id: z.ZodString;
4185
+ name: z.ZodString;
4186
+ status: z.ZodString;
4187
+ }, z.core.$strip>>;
4188
+ }, z.core.$strip>>;
4189
+ }, z.core.$strip>;
4190
+ type TransitionItemRequest = z.infer<typeof TransitionItemRequestSchema>;
4191
+ type DealDetailResponse = z.infer<typeof DealDetailResponseSchema>;
4269
4192
  /**
4270
- * Response from GET /command-queue/checkpoints endpoint
4193
+ * Lifecycle status enum for `acq_lists.status` (mirrors DB CHECK constraint
4194
+ * from migration 20260428000003_lead_gen_acq_lists_status_and_config.sql).
4271
4195
  */
4272
- interface CheckpointListResponse {
4273
- checkpoints: CheckpointListItem[];
4274
- /** Total tasks across all checkpoints */
4275
- total: number;
4276
- /** Breakdown by status for donut chart */
4277
- statusCounts: StatusCounts;
4278
- /** Breakdown by priority for donut chart */
4279
- priorityCounts: PriorityCounts;
4280
- }
4196
+ declare const ListStatusSchema: z.ZodEnum<{
4197
+ draft: "draft";
4198
+ archived: "archived";
4199
+ enriching: "enriching";
4200
+ launched: "launched";
4201
+ closing: "closing";
4202
+ }>;
4203
+ declare const ListCompaniesQuerySchema: z.ZodObject<{
4204
+ search: z.ZodOptional<z.ZodString>;
4205
+ listId: z.ZodOptional<z.ZodString>;
4206
+ domain: z.ZodOptional<z.ZodString>;
4207
+ website: z.ZodOptional<z.ZodString>;
4208
+ segment: z.ZodOptional<z.ZodString>;
4209
+ category: z.ZodOptional<z.ZodString>;
4210
+ pipelineStatus: z.ZodOptional<z.ZodUnknown>;
4211
+ batchId: z.ZodOptional<z.ZodString>;
4212
+ status: z.ZodOptional<z.ZodEnum<{
4213
+ active: "active";
4214
+ invalid: "invalid";
4215
+ }>>;
4216
+ includeAll: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
4217
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4218
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4219
+ }, z.core.$strict>;
4220
+ declare const ListContactsQuerySchema: z.ZodObject<{
4221
+ search: z.ZodOptional<z.ZodString>;
4222
+ listId: z.ZodOptional<z.ZodString>;
4223
+ openingLineIsNull: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
4224
+ batchId: z.ZodOptional<z.ZodString>;
4225
+ contactStatus: z.ZodOptional<z.ZodEnum<{
4226
+ active: "active";
4227
+ invalid: "invalid";
4228
+ }>>;
4229
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4230
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4231
+ }, z.core.$strict>;
4232
+ declare const AcqCompanyResponseSchema: z.ZodObject<{
4233
+ id: z.ZodString;
4234
+ organizationId: z.ZodString;
4235
+ clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4236
+ name: z.ZodString;
4237
+ domain: z.ZodNullable<z.ZodString>;
4238
+ linkedinUrl: z.ZodNullable<z.ZodString>;
4239
+ website: z.ZodNullable<z.ZodString>;
4240
+ numEmployees: z.ZodNullable<z.ZodNumber>;
4241
+ foundedYear: z.ZodNullable<z.ZodNumber>;
4242
+ locationCity: z.ZodNullable<z.ZodString>;
4243
+ locationState: z.ZodNullable<z.ZodString>;
4244
+ category: z.ZodNullable<z.ZodString>;
4245
+ categoryPain: z.ZodNullable<z.ZodString>;
4246
+ segment: z.ZodNullable<z.ZodString>;
4247
+ processingState: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
4248
+ status: z.ZodEnum<{
4249
+ error: "error";
4250
+ success: "success";
4251
+ no_result: "no_result";
4252
+ skipped: "skipped";
4253
+ }>;
4254
+ data: z.ZodOptional<z.ZodUnknown>;
4255
+ }, z.core.$loose>>>;
4256
+ pipelineStatus: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
4257
+ enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4258
+ source: z.ZodNullable<z.ZodString>;
4259
+ batchId: z.ZodNullable<z.ZodString>;
4260
+ status: z.ZodEnum<{
4261
+ active: "active";
4262
+ invalid: "invalid";
4263
+ }>;
4264
+ contactCount: z.ZodNumber;
4265
+ verticalResearch: z.ZodNullable<z.ZodString>;
4266
+ createdAt: z.ZodString;
4267
+ updatedAt: z.ZodString;
4268
+ }, z.core.$strip>;
4269
+ declare const AcqContactResponseSchema: z.ZodObject<{
4270
+ id: z.ZodString;
4271
+ organizationId: z.ZodString;
4272
+ clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4273
+ companyId: z.ZodNullable<z.ZodString>;
4274
+ email: z.ZodString;
4275
+ emailValid: z.ZodNullable<z.ZodEnum<{
4276
+ VALID: "VALID";
4277
+ INVALID: "INVALID";
4278
+ RISKY: "RISKY";
4279
+ UNKNOWN: "UNKNOWN";
4280
+ }>>;
4281
+ firstName: z.ZodNullable<z.ZodString>;
4282
+ lastName: z.ZodNullable<z.ZodString>;
4283
+ linkedinUrl: z.ZodNullable<z.ZodString>;
4284
+ title: z.ZodNullable<z.ZodString>;
4285
+ headline: z.ZodNullable<z.ZodString>;
4286
+ filterReason: z.ZodNullable<z.ZodString>;
4287
+ openingLine: z.ZodNullable<z.ZodString>;
4288
+ source: z.ZodNullable<z.ZodString>;
4289
+ sourceId: z.ZodNullable<z.ZodString>;
4290
+ processingState: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
4291
+ status: z.ZodEnum<{
4292
+ error: "error";
4293
+ success: "success";
4294
+ no_result: "no_result";
4295
+ skipped: "skipped";
4296
+ }>;
4297
+ data: z.ZodOptional<z.ZodUnknown>;
4298
+ }, z.core.$loose>>>;
4299
+ pipelineStatus: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
4300
+ enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4301
+ attioPersonId: z.ZodNullable<z.ZodString>;
4302
+ batchId: z.ZodNullable<z.ZodString>;
4303
+ status: z.ZodEnum<{
4304
+ active: "active";
4305
+ invalid: "invalid";
4306
+ }>;
4307
+ company: z.ZodOptional<z.ZodNullable<z.ZodObject<{
4308
+ id: z.ZodString;
4309
+ name: z.ZodString;
4310
+ domain: z.ZodNullable<z.ZodString>;
4311
+ website: z.ZodNullable<z.ZodString>;
4312
+ linkedinUrl: z.ZodNullable<z.ZodString>;
4313
+ segment: z.ZodNullable<z.ZodString>;
4314
+ category: z.ZodNullable<z.ZodString>;
4315
+ status: z.ZodEnum<{
4316
+ active: "active";
4317
+ invalid: "invalid";
4318
+ }>;
4319
+ }, z.core.$strip>>>;
4320
+ createdAt: z.ZodString;
4321
+ updatedAt: z.ZodString;
4322
+ }, z.core.$strip>;
4323
+ declare const AcqArtifactOwnerKindSchema: z.ZodEnum<{
4324
+ company: "company";
4325
+ contact: "contact";
4326
+ list: "list";
4327
+ deal: "deal";
4328
+ list_member: "list_member";
4329
+ }>;
4330
+ declare const ListRecordEntitySchema: z.ZodEnum<{
4331
+ company: "company";
4332
+ contact: "contact";
4333
+ }>;
4334
+ type ListCompaniesQuery = z.infer<typeof ListCompaniesQuerySchema>;
4335
+ type ListContactsQuery = z.infer<typeof ListContactsQuerySchema>;
4336
+ type AcqCompanyResponse = z.infer<typeof AcqCompanyResponseSchema>;
4337
+ type AcqContactResponse = z.infer<typeof AcqContactResponseSchema>;
4338
+ type AcqArtifactOwnerKind = z.infer<typeof AcqArtifactOwnerKindSchema>;
4339
+ type ListRecordEntity = z.infer<typeof ListRecordEntitySchema>;
4340
+ type ListStatus = z.infer<typeof ListStatusSchema>;
4281
4341
 
4282
- /**
4283
- * Target for schedule execution - identifies what resource to execute.
4284
- * Unlike ExecutionTarget, payload is NOT included here because schedules
4285
- * store payload in the scheduleConfig (varies per step/item).
4286
- */
4287
- interface ScheduleTarget {
4288
- resourceType: 'agent' | 'workflow';
4289
- resourceId: string;
4290
- }
4291
- /**
4292
- * Optional origin tracking for schedules.
4293
- * Unlike OriginTracking (which is required), these fields are all optional
4294
- * for schedules created directly via API (not triggered by another resource).
4295
- */
4296
- interface ScheduleOriginTracking {
4297
- originExecutionId?: string;
4298
- originResourceType?: OriginResourceType;
4299
- originResourceId?: string;
4300
- }
4301
- type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
4302
- interface RecurringScheduleConfig {
4303
- type: 'recurring';
4304
- cron?: string;
4305
- interval?: 'daily' | 'weekly' | 'monthly';
4306
- time?: string;
4307
- timezone: string;
4308
- payload: Record<string, unknown>;
4309
- endAt?: string | null;
4310
- overduePolicy?: 'skip' | 'execute';
4311
- }
4312
- interface RelativeScheduleConfig {
4313
- type: 'relative';
4314
- anchorAt: string;
4315
- anchorLabel?: string;
4316
- items: RelativeScheduleItem[];
4317
- overduePolicy?: 'skip' | 'execute';
4318
- }
4319
- interface RelativeScheduleItem {
4320
- offset: string;
4321
- payload: Record<string, unknown>;
4322
- label?: string;
4342
+ /** Raw database row type for acq_deals table */
4343
+ type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
4344
+ type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing';
4345
+ type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low';
4346
+ interface DealPriority {
4347
+ bucketKey: DealPriorityBucketKey;
4348
+ rank: number;
4349
+ label: string;
4350
+ color: string;
4351
+ reason: string;
4352
+ latestActivityAt: string | null;
4353
+ nextActionAt: string | null;
4323
4354
  }
4324
- interface AbsoluteScheduleConfig {
4325
- type: 'absolute';
4326
- items: AbsoluteScheduleItem[];
4327
- overduePolicy?: 'skip' | 'execute';
4355
+ interface DealContact {
4356
+ id: string;
4357
+ first_name: string | null;
4358
+ last_name: string | null;
4359
+ email: string;
4360
+ title: string | null;
4361
+ headline: string | null;
4362
+ linkedin_url: string | null;
4363
+ processing_state: Record<string, unknown> | null;
4364
+ enrichment_data: Record<string, unknown> | null;
4365
+ company: {
4366
+ id: string;
4367
+ name: string;
4368
+ domain: string | null;
4369
+ website: string | null;
4370
+ linkedin_url: string | null;
4371
+ segment: string | null;
4372
+ category: string | null;
4373
+ num_employees: number | null;
4374
+ } | null;
4328
4375
  }
4329
- interface AbsoluteScheduleItem {
4330
- runAt: string;
4331
- payload: Record<string, unknown>;
4332
- label?: string;
4376
+ interface DealFilters {
4377
+ stage?: DealStage;
4378
+ search?: string;
4379
+ limit?: number;
4380
+ offset?: number;
4333
4381
  }
4334
- interface TaskSchedule extends ScheduleOriginTracking {
4335
- id: string;
4336
- organizationId: string;
4337
- name: string;
4338
- description?: string;
4339
- target: ScheduleTarget;
4340
- scheduleConfig: TaskScheduleConfig;
4341
- nextRunAt?: Date;
4342
- currentStep: number;
4343
- status: 'active' | 'paused' | 'completed' | 'cancelled';
4344
- lastRunAt?: Date;
4345
- lastExecutionId?: string;
4346
- maxRetries: number;
4347
- idempotencyKey?: string;
4348
- createdAt: Date;
4349
- updatedAt: Date;
4382
+ /** Deal list item with joined contact and company data */
4383
+ interface DealListItem extends AcqDealRow {
4384
+ priority: DealPriority;
4385
+ ownership: 'us' | 'them' | null;
4386
+ nextAction: string | null;
4387
+ contact: DealContact | null;
4350
4388
  }
4351
-
4389
+ type DealDetail$1 = DealListItem;
4390
+ /** Task kind options for a deal task (human follow-up action type) */
4391
+ type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
4352
4392
  /**
4353
- * Wire-format DTO for notification API responses.
4354
- * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
4355
- * Used by frontend hooks that consume /api/notifications.
4393
+ * A CRM to-do item attached to a deal representing a human follow-up action.
4394
+ * Transformed from AcqDealTaskRow with camelCase properties.
4356
4395
  */
4357
- interface NotificationDTO {
4396
+ interface AcqDealTask {
4358
4397
  id: string;
4359
- userId: string;
4360
4398
  organizationId: string;
4361
- category: string;
4399
+ dealId: string;
4362
4400
  title: string;
4363
- message: string;
4364
- actionUrl: string | null;
4365
- read: boolean;
4366
- readAt: string | null;
4401
+ description: string | null;
4402
+ kind: AcqDealTaskKind;
4403
+ dueAt: string | null;
4404
+ assigneeUserId: string | null;
4405
+ completedAt: string | null;
4406
+ completedByUserId: string | null;
4367
4407
  createdAt: string;
4368
- }
4369
-
4370
- type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
4371
- type ProjectUpdate = Database['public']['Tables']['prj_projects']['Update'];
4372
- type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
4373
- type MilestoneUpdate = Database['public']['Tables']['prj_milestones']['Update'];
4374
- type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
4375
- type TaskUpdate = Database['public']['Tables']['prj_tasks']['Update'];
4376
- type ProjectStatus = 'active' | 'on_track' | 'at_risk' | 'blocked' | 'completed' | 'paused';
4377
- type ProjectKind = 'client_engagement' | 'internal' | 'research' | 'other';
4378
- type MilestoneStatus = 'upcoming' | 'in_progress' | 'completed' | 'overdue' | 'blocked';
4379
- type TaskStatus = 'planned' | 'in_progress' | 'blocked' | 'completed' | 'cancelled' | 'submitted' | 'approved' | 'rejected' | 'revision_requested';
4380
- type TaskType = 'documentation' | 'code' | 'report' | 'design' | 'other';
4381
- type NoteType = 'call_note' | 'status_update' | 'issue' | 'blocker' | 'agent_learning';
4382
- interface ProjectFilters {
4383
- status?: ProjectStatus;
4384
- kind?: ProjectKind;
4385
- companyId?: string;
4386
- search?: string;
4387
- }
4388
- interface MilestoneFilters {
4389
- status?: MilestoneStatus;
4390
- projectId?: string;
4391
- }
4392
- interface TaskFilters {
4393
- status?: TaskStatus;
4394
- type?: TaskType;
4395
- milestoneId?: string;
4396
- projectId?: string;
4397
- }
4398
- interface NoteFilters {
4399
- type?: NoteType;
4400
- projectId?: string;
4401
- }
4402
- interface ProjectWithCounts extends ProjectRow {
4403
- milestoneCount: number;
4404
- taskCount: number;
4405
- completedMilestones?: number;
4406
- completedTasks?: number;
4407
- }
4408
- interface ProjectDetail extends ProjectRow {
4409
- milestones: MilestoneRow[];
4410
- tasks: TaskRow[];
4411
- company: {
4412
- id: string;
4413
- name: string;
4414
- domain: string | null;
4415
- } | null;
4416
- deal: ProjectSourceDealRef | null;
4417
- client: ProjectClientRef | null;
4418
- }
4419
- interface ProjectSourceDealRef {
4420
- id: string;
4421
- clientId?: string | null;
4422
- contactEmail: string;
4423
- stageKey: string | null;
4424
- stateKey: string | null;
4425
- sourceListId: string | null;
4426
4408
  updatedAt: string;
4409
+ createdByUserId: string | null;
4427
4410
  }
4428
- interface ProjectClientRef {
4429
- id: string;
4430
- name: string;
4431
- status: string;
4411
+ /**
4412
+ * Live-scan aggregate telemetry for a single list, computed on demand from
4413
+ * the list junction tables and current contact deliverability state.
4414
+ * `stageCounts` are attempted counts from list-row processing_state.
4415
+ */
4416
+ interface ListTelemetry {
4417
+ listId: string;
4418
+ totalCompanies: number;
4419
+ totalContacts: number;
4420
+ stageCounts: {
4421
+ populated: number;
4422
+ extracted: number;
4423
+ qualified: number;
4424
+ discovered: number;
4425
+ verified: number;
4426
+ personalized: number;
4427
+ uploaded: number;
4428
+ };
4429
+ deliverability: {
4430
+ valid: number;
4431
+ risky: number;
4432
+ invalid: number;
4433
+ unknown: number;
4434
+ bounced: number;
4435
+ };
4436
+ /** Reserved -- active workflow IDs associated with this list. */
4437
+ activeWorkflows?: string[];
4432
4438
  }
4433
4439
 
4434
- interface Action {
4435
- key: string;
4436
- label: string;
4437
- payloadSchema?: z.ZodTypeAny;
4440
+ /**
4441
+ * Lead Service Types
4442
+ * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
4443
+ *
4444
+ * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
4445
+ */
4446
+
4447
+ interface AcqDealNote {
4448
+ id: string;
4449
+ dealId: string;
4450
+ organizationId: string;
4451
+ authorUserId: string | null;
4452
+ body: string;
4453
+ createdAt: string;
4454
+ updatedAt: string;
4438
4455
  }
4439
4456
 
4440
- declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
4441
- objectTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4442
- id: z.ZodString;
4443
- label: z.ZodOptional<z.ZodString>;
4444
- description: z.ZodOptional<z.ZodString>;
4445
- ownerSystemId: z.ZodOptional<z.ZodString>;
4446
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4447
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4448
- storage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4449
- }, z.core.$loose>>>>;
4450
- linkTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4451
- id: z.ZodString;
4452
- label: z.ZodOptional<z.ZodString>;
4453
- description: z.ZodOptional<z.ZodString>;
4454
- ownerSystemId: z.ZodOptional<z.ZodString>;
4455
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4456
- from: z.ZodString;
4457
- to: z.ZodString;
4458
- cardinality: z.ZodOptional<z.ZodString>;
4459
- via: z.ZodOptional<z.ZodString>;
4460
- }, z.core.$loose>>>>;
4461
- actionTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4462
- id: z.ZodString;
4463
- label: z.ZodOptional<z.ZodString>;
4464
- description: z.ZodOptional<z.ZodString>;
4465
- ownerSystemId: z.ZodOptional<z.ZodString>;
4466
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4467
- actsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
4468
- input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4469
- effects: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4470
- }, z.core.$loose>>>>;
4471
- catalogTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4472
- id: z.ZodString;
4473
- label: z.ZodOptional<z.ZodString>;
4474
- description: z.ZodOptional<z.ZodString>;
4475
- ownerSystemId: z.ZodOptional<z.ZodString>;
4476
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4477
- kind: z.ZodOptional<z.ZodString>;
4478
- appliesTo: z.ZodOptional<z.ZodString>;
4479
- entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4480
- }, z.core.$loose>>>>;
4481
- eventTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4482
- id: z.ZodString;
4483
- label: z.ZodOptional<z.ZodString>;
4484
- description: z.ZodOptional<z.ZodString>;
4485
- ownerSystemId: z.ZodOptional<z.ZodString>;
4486
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4487
- payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4488
- }, z.core.$loose>>>>;
4489
- interfaceTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4490
- id: z.ZodString;
4491
- label: z.ZodOptional<z.ZodString>;
4492
- description: z.ZodOptional<z.ZodString>;
4493
- ownerSystemId: z.ZodOptional<z.ZodString>;
4494
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4495
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4496
- }, z.core.$loose>>>>;
4497
- valueTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4498
- id: z.ZodString;
4499
- label: z.ZodOptional<z.ZodString>;
4500
- description: z.ZodOptional<z.ZodString>;
4501
- ownerSystemId: z.ZodOptional<z.ZodString>;
4502
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4503
- primitive: z.ZodOptional<z.ZodString>;
4504
- }, z.core.$loose>>>>;
4505
- sharedProperties: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4506
- id: z.ZodString;
4507
- label: z.ZodOptional<z.ZodString>;
4508
- description: z.ZodOptional<z.ZodString>;
4509
- ownerSystemId: z.ZodOptional<z.ZodString>;
4510
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4511
- valueType: z.ZodOptional<z.ZodString>;
4512
- searchable: z.ZodOptional<z.ZodBoolean>;
4513
- pii: z.ZodOptional<z.ZodBoolean>;
4514
- }, z.core.$loose>>>>;
4515
- groups: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4516
- id: z.ZodString;
4517
- label: z.ZodOptional<z.ZodString>;
4518
- description: z.ZodOptional<z.ZodString>;
4519
- ownerSystemId: z.ZodOptional<z.ZodString>;
4520
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4521
- members: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
4522
- }, z.core.$loose>>>>;
4523
- surfaces: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4524
- id: z.ZodString;
4525
- label: z.ZodOptional<z.ZodString>;
4526
- description: z.ZodOptional<z.ZodString>;
4527
- ownerSystemId: z.ZodOptional<z.ZodString>;
4528
- aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4529
- route: z.ZodOptional<z.ZodString>;
4530
- }, z.core.$loose>>>>;
4531
- }, z.core.$strip>>;
4532
- type OntologyScope = z.infer<typeof OntologyScopeSchema>;
4533
-
4534
- type JsonPrimitive = string | number | boolean | null;
4535
- type JsonValue = JsonPrimitive | JsonValue[] | {
4536
- [key: string]: JsonValue;
4537
- };
4538
- /** Explicit interface needed to annotate the recursive SystemEntrySchema. */
4539
- interface SystemEntry {
4457
+ /**
4458
+ * Action configuration for HITL tasks
4459
+ * Defines available user actions and their behavior
4460
+ */
4461
+ interface ActionConfig {
4462
+ /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
4540
4463
  id: string;
4541
- label?: string;
4542
- title?: string;
4543
- description?: string;
4544
- kind?: 'product' | 'operational' | 'platform' | 'diagnostic';
4545
- parentSystemId?: string;
4546
- ui?: {
4547
- path: string;
4548
- surfaces: string[];
4549
- icon?: string;
4550
- order?: number;
4551
- };
4552
- lifecycle?: 'draft' | 'beta' | 'active' | 'deprecated' | 'archived';
4553
- responsibleRoleId?: string;
4554
- governedByKnowledge?: string[];
4555
- actions?: {
4556
- actionId: string;
4557
- intent: 'exposes' | 'consumes';
4558
- invocation?: unknown;
4559
- }[];
4560
- policies?: string[];
4561
- drivesGoals?: string[];
4562
- /** @deprecated Use lifecycle. Accepted for one publish cycle. */
4563
- status?: 'active' | 'deprecated' | 'archived';
4564
- path?: string;
4464
+ /** Display label for UI button */
4465
+ label: string;
4466
+ /** Button variant/style */
4467
+ type: 'primary' | 'secondary' | 'danger' | 'outline';
4468
+ /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
4565
4469
  icon?: string;
4470
+ /** Button color (Mantine theme colors) */
4566
4471
  color?: string;
4567
- uiPosition?: 'sidebar-primary' | 'sidebar-bottom';
4568
- enabled?: boolean;
4569
- devOnly?: boolean;
4570
- requiresAdmin?: boolean;
4571
- order: number;
4572
- config?: Record<string, JsonValue>;
4573
- ontology?: OntologyScope;
4574
- systems?: Record<string, SystemEntry>;
4575
- subsystems?: Record<string, SystemEntry>;
4472
+ /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
4473
+ variant?: string;
4474
+ /** Execution target (agent/workflow to invoke) */
4475
+ target?: {
4476
+ resourceType: 'agent' | 'workflow';
4477
+ resourceId: string;
4478
+ /**
4479
+ * Optional session ID for agent continuation.
4480
+ * If provided, invokes a new turn on the existing session instead of standalone execution.
4481
+ * Only valid when resourceType is 'agent'.
4482
+ */
4483
+ sessionId?: string;
4484
+ };
4485
+ /** Form schema for collecting action-specific data */
4486
+ form?: FormSchema;
4487
+ /** Payload template for pre-filling forms */
4488
+ payloadTemplate?: unknown;
4489
+ /** Requires confirmation dialog */
4490
+ requiresConfirmation?: boolean;
4491
+ /** Confirmation message */
4492
+ confirmationMessage?: string;
4493
+ /** Help text / tooltip */
4494
+ description?: string;
4576
4495
  }
4577
4496
 
4578
- declare const LinkSchema: z.ZodObject<{
4579
- nodeId: z.ZodString;
4580
- kind: z.ZodEnum<{
4581
- links: "links";
4582
- affects: "affects";
4583
- effects: "effects";
4584
- actions: "actions";
4585
- reads: "reads";
4586
- writes: "writes";
4587
- emits: "emits";
4588
- triggers: "triggers";
4589
- uses: "uses";
4590
- approval: "approval";
4591
- contains: "contains";
4592
- references: "references";
4593
- maps_to: "maps_to";
4594
- governs: "governs";
4595
- originates_from: "originates_from";
4596
- applies_to: "applies_to";
4597
- uses_catalog: "uses_catalog";
4598
- }>;
4599
- }, z.core.$strip>;
4600
- type Link = z.infer<typeof LinkSchema>;
4497
+ /**
4498
+ * Origin resource type - where an execution/task originated from.
4499
+ * Used for audit trails and tracking execution lineage.
4500
+ */
4501
+ type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
4502
+ /**
4503
+ * Origin tracking metadata - who/what created this execution/task.
4504
+ * Used by both TaskScheduler and CommandQueue for complete audit trails.
4505
+ */
4506
+ interface OriginTracking {
4507
+ originExecutionId: string;
4508
+ originResourceType: OriginResourceType;
4509
+ originResourceId: string;
4510
+ }
4601
4511
 
4602
- type MessageType = MessageEvent['type'];
4603
4512
  /**
4604
- * Session Data Transfer Object (DTO)
4605
- * Transform type for API responses (snake_case DB → camelCase frontend)
4606
- * Used by frontend apps to display session data
4513
+ * Command queue task with flexible action system
4607
4514
  */
4608
- interface SessionDTO {
4609
- sessionId: string;
4610
- resourceId: string;
4515
+ interface Task extends OriginTracking {
4516
+ id: string;
4611
4517
  organizationId: string;
4612
- userId?: string | null;
4613
- turnCount: number;
4614
- isEnded: boolean;
4615
- title?: string | null;
4616
- memorySnapshot?: AgentMemory;
4617
- metadata?: Record<string, unknown> | null;
4518
+ actions: ActionConfig[];
4519
+ context: unknown;
4520
+ selectedAction?: string;
4521
+ actionPayload?: unknown;
4522
+ description?: string;
4523
+ priority: number;
4524
+ /** Optional checkpoint identifier for grouping related human approval tasks */
4525
+ humanCheckpoint?: string;
4526
+ status: QueueTaskStatus;
4527
+ /**
4528
+ * Target resource tracking — mirrors origin columns.
4529
+ * Set when task is created; patchable to redirect execution to a different resource.
4530
+ */
4531
+ targetResourceId?: string;
4532
+ targetResourceType?: 'agent' | 'workflow';
4533
+ /**
4534
+ * Execution ID for the action that runs AFTER user approval.
4535
+ * NULL until execution starts.
4536
+ *
4537
+ * Naming distinction:
4538
+ * - originExecutionId = Parent execution that CREATED the HITL task
4539
+ * - targetExecutionId = Child execution that RUNS AFTER user approval
4540
+ */
4541
+ targetExecutionId?: string;
4618
4542
  createdAt: Date;
4619
- updatedAt: Date;
4620
- endedAt?: Date | null;
4543
+ completedAt?: Date;
4544
+ completedBy?: string;
4545
+ expiresAt?: Date;
4546
+ idempotencyKey?: string | null;
4621
4547
  }
4622
- interface ChatMessage {
4623
- id: string;
4624
- role: 'user' | 'assistant';
4625
- messageType: MessageType;
4626
- text: string;
4627
- metadata?: MessageEvent;
4628
- turnNumber: number;
4629
- messageIndex?: number;
4630
- createdAt: Date;
4548
+ /**
4549
+ * Task status values
4550
+ * - pending: awaiting action
4551
+ * - processing: execution in progress after user approval
4552
+ * - completed: action was taken and execution succeeded
4553
+ * - failed: execution failed, task can be retried
4554
+ * - expired: timed out before action
4555
+ */
4556
+ type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
4557
+ /**
4558
+ * Parameters for patching mutable metadata on a task
4559
+ */
4560
+ interface PatchTaskParams {
4561
+ humanCheckpoint?: string | null;
4562
+ description?: string;
4563
+ priority?: number;
4564
+ context?: Record<string, unknown>;
4565
+ actions?: unknown[];
4566
+ targetResourceId?: string | null;
4567
+ targetResourceType?: 'agent' | 'workflow' | null;
4568
+ targetExecutionId?: string;
4569
+ status?: 'pending' | 'failed' | 'completed';
4631
4570
  }
4632
- /** Token usage data sent with turn:complete WebSocket events */
4633
- interface SessionTokenUsage {
4634
- /** Tokens consumed by this turn's input */
4635
- turnInputTokens: number;
4636
- /** Tokens generated by this turn's output */
4637
- turnOutputTokens: number;
4638
- /** Total tokens for this turn (turnInputTokens + turnOutputTokens) */
4639
- turnTotalTokens: number;
4640
- /** Cumulative input tokens across all turns in this session */
4641
- cumulativeInputTokens: number;
4642
- /** Cumulative output tokens across all turns in this session */
4643
- cumulativeOutputTokens: number;
4644
- /** The model's context window size for this session (e.g., 200K) */
4645
- contextWindowSize: number;
4571
+ interface CommandQueueListResponse {
4572
+ tasks: Task[];
4573
+ total: number;
4646
4574
  }
4647
4575
 
4648
4576
  /**
4649
- * Single source of truth for all active theme preset names.
4650
- *
4651
- * This is the canonical list. To add a preset:
4652
- * 1. Add the name here.
4653
- * 2. Create `packages/ui/src/theme/presets/{name}.ts` exporting `{name}Preset: ThemePreset`.
4654
- * 3. Add to `PRESETS` record in `packages/ui/src/theme/presets/index.ts`.
4655
- * 4. Add to `PresetName` union in `packages/ui/src/theme/presets/types.ts`.
4656
- * 5. Add a card in `apps/command-center/src/features/settings/appearance/components/AppearanceSettings.tsx`.
4657
- *
4658
- * The union type (`ThemePresetName`) and Zod enum (`ThemePresetEnum`) are derived
4659
- * automatically — no other files need updating.
4577
+ * Checkpoint list item for sidebar grouping
4578
+ * The id field contains the resourceId of the human checkpoint
4660
4579
  */
4661
- declare const THEME_PRESETS: readonly ["default", "tactical", "regal", "cyber-volt", "aurora", "rose-gold", "midnight", "titanium", "canopy", "slate", "cyber-strike", "cyber-chrome", "cyber-void", "nirvana", "wave", "synapse", "cortex", "helios", "graphite", "quarry"];
4662
- type ThemePresetName = (typeof THEME_PRESETS)[number];
4663
-
4580
+ interface CheckpointListItem {
4581
+ /** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
4582
+ id: string;
4583
+ /** Display name (same as id, or "Ungrouped" for null) */
4584
+ name: string;
4585
+ /** Task count for this checkpoint */
4586
+ count: number;
4587
+ }
4664
4588
  /**
4665
- * Multi-tenancy configuration types
4666
- *
4667
- * Config is stored in dedicated `config` columns (NOT nested in metadata):
4668
- * - organizations.config: Org-level config (no feature toggles -- all features available by default)
4669
- * - org_memberships.config: Per-user-per-org feature overrides
4670
- * - users.config: User-global config
4589
+ * Status counts for pie chart display
4671
4590
  */
4672
-
4591
+ interface StatusCounts {
4592
+ pending: number;
4593
+ completed: number;
4594
+ expired: number;
4595
+ }
4673
4596
  /**
4674
- * Per-user-per-org config (stored in org_memberships.config)
4675
- * Controls which features a specific member can access within their org.
4676
- * Keys are feature IDs from the organization model (e.g. crm, lead-gen, projects, seo).
4597
+ * Priority counts for donut chart display
4677
4598
  */
4678
- interface MembershipFeatureConfig {
4679
- features?: Record<string, boolean>;
4599
+ interface PriorityCounts {
4600
+ critical: number;
4601
+ high: number;
4602
+ medium: number;
4603
+ low: number;
4680
4604
  }
4681
4605
  /**
4682
- * User-global config (stored in users.config)
4683
- * Theme and onboarding are user-specific, NOT org-specific
4606
+ * Response from GET /command-queue/checkpoints endpoint
4684
4607
  */
4685
- interface UserConfig {
4686
- theme?: {
4687
- preset?: ThemePresetName;
4688
- colorScheme?: 'light' | 'dark' | 'auto';
4689
- };
4690
- onboarding?: {
4691
- completed?: boolean;
4692
- completedAt?: string;
4693
- role?: string;
4694
- primaryUseCase?: string[];
4695
- experienceLevel?: string;
4696
- /** Onboarding guide system state (set by checklist/tour system) */
4697
- guides?: {
4698
- completedIds?: string[];
4699
- dismissed?: boolean;
4700
- completedAt?: string;
4701
- };
4702
- };
4608
+ interface CheckpointListResponse {
4609
+ checkpoints: CheckpointListItem[];
4610
+ /** Total tasks across all checkpoints */
4611
+ total: number;
4612
+ /** Breakdown by status for donut chart */
4613
+ statusCounts: StatusCounts;
4614
+ /** Breakdown by priority for donut chart */
4615
+ priorityCounts: PriorityCounts;
4703
4616
  }
4704
4617
 
4705
4618
  /**
4706
- * Memberships Domain - Zod Validation Schemas
4707
- *
4708
- * Validation schemas for membership management endpoints.
4709
- * Includes request bodies, query params, and path params.
4710
- *
4711
- * Security:
4712
- * - All schemas use .strict() to prevent mass assignment attacks
4713
- * - UUID validation prevents invalid references
4714
- * - Role enum validation prevents privilege escalation
4715
- * - organizationId never accepted in body (from JWT when needed)
4619
+ * Target for schedule execution - identifies what resource to execute.
4620
+ * Unlike ExecutionTarget, payload is NOT included here because schedules
4621
+ * store payload in the scheduleConfig (varies per step/item).
4716
4622
  */
4717
-
4623
+ interface ScheduleTarget {
4624
+ resourceType: 'agent' | 'workflow';
4625
+ resourceId: string;
4626
+ }
4718
4627
  /**
4719
- * Membership status validation
4720
- * Note: Database constraint only allows 'active' | 'inactive'
4628
+ * Optional origin tracking for schedules.
4629
+ * Unlike OriginTracking (which is required), these fields are all optional
4630
+ * for schedules created directly via API (not triggered by another resource).
4721
4631
  */
4722
- declare const MembershipStatusSchema: z.ZodEnum<{
4723
- active: "active";
4724
- inactive: "inactive";
4725
- }>;
4726
- type MembershipStatus = z.infer<typeof MembershipStatusSchema>;
4632
+ interface ScheduleOriginTracking {
4633
+ originExecutionId?: string;
4634
+ originResourceType?: OriginResourceType;
4635
+ originResourceId?: string;
4636
+ }
4637
+ type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
4638
+ interface RecurringScheduleConfig {
4639
+ type: 'recurring';
4640
+ cron?: string;
4641
+ interval?: 'daily' | 'weekly' | 'monthly';
4642
+ time?: string;
4643
+ timezone: string;
4644
+ payload: Record<string, unknown>;
4645
+ endAt?: string | null;
4646
+ overduePolicy?: 'skip' | 'execute';
4647
+ }
4648
+ interface RelativeScheduleConfig {
4649
+ type: 'relative';
4650
+ anchorAt: string;
4651
+ anchorLabel?: string;
4652
+ items: RelativeScheduleItem[];
4653
+ overduePolicy?: 'skip' | 'execute';
4654
+ }
4655
+ interface RelativeScheduleItem {
4656
+ offset: string;
4657
+ payload: Record<string, unknown>;
4658
+ label?: string;
4659
+ }
4660
+ interface AbsoluteScheduleConfig {
4661
+ type: 'absolute';
4662
+ items: AbsoluteScheduleItem[];
4663
+ overduePolicy?: 'skip' | 'execute';
4664
+ }
4665
+ interface AbsoluteScheduleItem {
4666
+ runAt: string;
4667
+ payload: Record<string, unknown>;
4668
+ label?: string;
4669
+ }
4670
+ interface TaskSchedule extends ScheduleOriginTracking {
4671
+ id: string;
4672
+ organizationId: string;
4673
+ name: string;
4674
+ description?: string;
4675
+ target: ScheduleTarget;
4676
+ scheduleConfig: TaskScheduleConfig;
4677
+ nextRunAt?: Date;
4678
+ currentStep: number;
4679
+ status: 'active' | 'paused' | 'completed' | 'cancelled';
4680
+ lastRunAt?: Date;
4681
+ lastExecutionId?: string;
4682
+ maxRetries: number;
4683
+ idempotencyKey?: string;
4684
+ createdAt: Date;
4685
+ updatedAt: Date;
4686
+ }
4727
4687
 
4728
4688
  /**
4729
- * Organization Membership types based on WorkOS API
4689
+ * Wire-format DTO for notification API responses.
4690
+ * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
4691
+ * Used by frontend hooks that consume /api/notifications.
4730
4692
  */
4731
- interface OrganizationMembership {
4732
- object: 'organization_membership';
4693
+ interface NotificationDTO {
4733
4694
  id: string;
4734
4695
  userId: string;
4735
4696
  organizationId: string;
4736
- role: {
4737
- slug: string;
4738
- };
4739
- status: 'active' | 'inactive';
4697
+ category: string;
4698
+ title: string;
4699
+ message: string;
4700
+ actionUrl: string | null;
4701
+ read: boolean;
4702
+ readAt: string | null;
4740
4703
  createdAt: string;
4741
- updatedAt: string;
4742
4704
  }
4743
- /**
4744
- * Request interfaces for membership operations
4745
- */
4746
- interface CreateMembershipRequest {
4747
- userId: string;
4748
- organizationId: string;
4749
- roleSlug?: string;
4705
+
4706
+ type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
4707
+ type ProjectUpdate = Database['public']['Tables']['prj_projects']['Update'];
4708
+ type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
4709
+ type MilestoneUpdate = Database['public']['Tables']['prj_milestones']['Update'];
4710
+ type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
4711
+ type TaskUpdate = Database['public']['Tables']['prj_tasks']['Update'];
4712
+ type ProjectStatus = 'active' | 'on_track' | 'at_risk' | 'blocked' | 'completed' | 'paused';
4713
+ type ProjectKind = 'client_engagement' | 'internal' | 'research' | 'other';
4714
+ type MilestoneStatus = 'upcoming' | 'in_progress' | 'completed' | 'overdue' | 'blocked';
4715
+ type TaskStatus = 'planned' | 'in_progress' | 'blocked' | 'completed' | 'cancelled' | 'submitted' | 'approved' | 'rejected' | 'revision_requested';
4716
+ type TaskType = 'documentation' | 'code' | 'report' | 'design' | 'other';
4717
+ type NoteType = 'call_note' | 'status_update' | 'issue' | 'blocker' | 'agent_learning';
4718
+ interface ProjectFilters {
4719
+ status?: ProjectStatus;
4720
+ kind?: ProjectKind;
4721
+ companyId?: string;
4722
+ search?: string;
4723
+ }
4724
+ interface MilestoneFilters {
4725
+ status?: MilestoneStatus;
4726
+ projectId?: string;
4727
+ }
4728
+ interface TaskFilters {
4729
+ status?: TaskStatus;
4730
+ type?: TaskType;
4731
+ milestoneId?: string;
4732
+ projectId?: string;
4733
+ }
4734
+ interface NoteFilters {
4735
+ type?: NoteType;
4736
+ projectId?: string;
4737
+ }
4738
+ interface ProjectWithCounts extends ProjectRow {
4739
+ milestoneCount: number;
4740
+ taskCount: number;
4741
+ completedMilestones?: number;
4742
+ completedTasks?: number;
4743
+ }
4744
+ interface ProjectDetail extends ProjectRow {
4745
+ milestones: MilestoneRow[];
4746
+ tasks: TaskRow[];
4747
+ company: {
4748
+ id: string;
4749
+ name: string;
4750
+ domain: string | null;
4751
+ } | null;
4752
+ deal: ProjectSourceDealRef | null;
4753
+ client: ProjectClientRef | null;
4754
+ }
4755
+ interface ProjectSourceDealRef {
4756
+ id: string;
4757
+ clientId?: string | null;
4758
+ contactEmail: string;
4759
+ stageKey: string | null;
4760
+ stateKey: string | null;
4761
+ sourceListId: string | null;
4762
+ updatedAt: string;
4750
4763
  }
4751
- interface UpdateMembershipRequest {
4752
- roleSlug: string;
4764
+ interface ProjectClientRef {
4765
+ id: string;
4766
+ name: string;
4767
+ status: string;
4753
4768
  }
4754
- interface ListMembershipsParams {
4755
- userId?: string;
4756
- organizationId?: string;
4757
- statuses?: MembershipStatus[];
4758
- limit?: number;
4759
- before?: string;
4760
- after?: string;
4761
- order?: 'asc' | 'desc';
4769
+
4770
+ interface Action {
4771
+ key: string;
4772
+ label: string;
4773
+ payloadSchema?: z.ZodTypeAny;
4762
4774
  }
4775
+
4776
+ type MessageType = MessageEvent['type'];
4763
4777
  /**
4764
- * Response interfaces
4778
+ * Session Data Transfer Object (DTO)
4779
+ * Transform type for API responses (snake_case DB → camelCase frontend)
4780
+ * Used by frontend apps to display session data
4765
4781
  */
4766
- interface ListMembershipsResponse {
4767
- data: OrganizationMembership[];
4768
- listMetadata?: {
4769
- before?: string | null;
4770
- after?: string | null;
4771
- };
4782
+ interface SessionDTO {
4783
+ sessionId: string;
4784
+ resourceId: string;
4785
+ organizationId: string;
4786
+ userId?: string | null;
4787
+ turnCount: number;
4788
+ isEnded: boolean;
4789
+ title?: string | null;
4790
+ memorySnapshot?: AgentMemory;
4791
+ metadata?: Record<string, unknown> | null;
4792
+ createdAt: Date;
4793
+ updatedAt: Date;
4794
+ endedAt?: Date | null;
4772
4795
  }
4773
- /**
4774
- * Extended membership with user and organization details for UI
4775
- */
4776
- interface MembershipWithDetails extends OrganizationMembership {
4777
- user?: {
4778
- id: string;
4779
- email: string;
4780
- firstName?: string;
4781
- lastName?: string;
4782
- profilePictureUrl?: string;
4783
- };
4784
- organization?: {
4785
- id: string;
4786
- name: string;
4787
- workos_org_id: string;
4788
- primaryDomain?: string;
4789
- is_test?: boolean;
4790
- status?: string;
4791
- metadata?: Record<string, unknown>;
4792
- config?: Record<string, unknown>;
4793
- };
4794
- config?: MembershipFeatureConfig;
4796
+ interface ChatMessage {
4797
+ id: string;
4798
+ role: 'user' | 'assistant';
4799
+ messageType: MessageType;
4800
+ text: string;
4801
+ metadata?: MessageEvent;
4802
+ turnNumber: number;
4803
+ messageIndex?: number;
4804
+ createdAt: Date;
4805
+ }
4806
+ /** Token usage data sent with turn:complete WebSocket events */
4807
+ interface SessionTokenUsage {
4808
+ /** Tokens consumed by this turn's input */
4809
+ turnInputTokens: number;
4810
+ /** Tokens generated by this turn's output */
4811
+ turnOutputTokens: number;
4812
+ /** Total tokens for this turn (turnInputTokens + turnOutputTokens) */
4813
+ turnTotalTokens: number;
4814
+ /** Cumulative input tokens across all turns in this session */
4815
+ cumulativeInputTokens: number;
4816
+ /** Cumulative output tokens across all turns in this session */
4817
+ cumulativeOutputTokens: number;
4818
+ /** The model's context window size for this session (e.g., 200K) */
4819
+ contextWindowSize: number;
4795
4820
  }
4796
4821
 
4797
4822
  /**
@@ -5438,14 +5463,104 @@ interface CommandViewData {
5438
5463
  edges: CommandViewEdge[];
5439
5464
  }
5440
5465
 
5441
- declare const ResourceCategorySchema: z.ZodEnum<{
5442
- diagnostic: "diagnostic";
5443
- production: "production";
5444
- internal: "internal";
5445
- testing: "testing";
5446
- }>;
5447
- type ResourceCategory = z.infer<typeof ResourceCategorySchema>;
5448
- type ResourceLink = Link;
5466
+ declare const AccessKeyInputSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
5467
+ systemPath: z.ZodString;
5468
+ action: z.ZodDefault<z.ZodEnum<{
5469
+ view: "view";
5470
+ manage: "manage";
5471
+ }>>;
5472
+ }, z.core.$strict>]>;
5473
+ type AccessKeyInput = z.input<typeof AccessKeyInputSchema>;
5474
+ declare const AccessKeys: {
5475
+ readonly platformAdmin: {
5476
+ readonly systemPath: "platform.admin";
5477
+ readonly action: "view";
5478
+ };
5479
+ readonly organizationManage: {
5480
+ readonly systemPath: "permission.org";
5481
+ readonly action: "manage";
5482
+ };
5483
+ readonly membersManage: {
5484
+ readonly systemPath: "permission.members";
5485
+ readonly action: "manage";
5486
+ };
5487
+ readonly rolesManage: {
5488
+ readonly systemPath: "permission.roles";
5489
+ readonly action: "manage";
5490
+ };
5491
+ readonly secretsManage: {
5492
+ readonly systemPath: "permission.secrets";
5493
+ readonly action: "manage";
5494
+ };
5495
+ readonly operationsRead: {
5496
+ readonly systemPath: "permission.operations";
5497
+ readonly action: "view";
5498
+ };
5499
+ readonly operationsManage: {
5500
+ readonly systemPath: "permission.operations";
5501
+ readonly action: "manage";
5502
+ };
5503
+ readonly acquisitionManage: {
5504
+ readonly systemPath: "permission.acquisition";
5505
+ readonly action: "manage";
5506
+ };
5507
+ readonly projectsManage: {
5508
+ readonly systemPath: "permission.projects";
5509
+ readonly action: "manage";
5510
+ };
5511
+ readonly clientsManage: {
5512
+ readonly systemPath: "permission.clients";
5513
+ readonly action: "manage";
5514
+ };
5515
+ readonly operationsOverview: {
5516
+ readonly systemPath: "diagnostic.operations.overview";
5517
+ readonly action: "view";
5518
+ };
5519
+ readonly operationsRecentExecutions: {
5520
+ readonly systemPath: "diagnostic.operations.recent-executions";
5521
+ readonly action: "view";
5522
+ };
5523
+ readonly monitoringExecutionLogs: {
5524
+ readonly systemPath: "diagnostic.monitoring.execution-logs";
5525
+ readonly action: "view";
5526
+ };
5527
+ readonly monitoringNotifications: {
5528
+ readonly systemPath: "diagnostic.monitoring.notifications";
5529
+ readonly action: "view";
5530
+ };
5531
+ };
5532
+
5533
+ type AccessRestrictedBy = 'catalog' | 'membership' | 'system-lifecycle' | 'role-permission' | 'diagnostic-allowlist' | null;
5534
+ type AccessReason = 'allowed' | 'platform-admin-bypass' | 'invalid-access-key' | 'unknown-access-key' | 'organization-mismatch' | 'missing-membership' | 'system-not-active' | 'role-permission-denied' | 'diagnostic-key-not-allowed';
5535
+ interface AccessAnswer {
5536
+ allowed: boolean;
5537
+ restrictedBy: AccessRestrictedBy;
5538
+ reason: AccessReason;
5539
+ }
5540
+
5541
+ interface UseAccessResult extends AccessAnswer {
5542
+ isReady: boolean;
5543
+ isPlatformAdmin: boolean;
5544
+ permissions: readonly string[];
5545
+ }
5546
+ /**
5547
+ * Unified access hook for Organization Model system lifecycle, diagnostic keys,
5548
+ * role permissions, organization membership, and platform-admin bypass.
5549
+ */
5550
+ declare function useAccess(key: AccessKeyInput): UseAccessResult;
5551
+
5552
+ /**
5553
+ * Query key factory for executions TanStack Query hooks.
5554
+ * Uses organization UUID (not name) for cache isolation.
5555
+ */
5556
+ declare const executionsKeys: {
5557
+ all: readonly ["executions"];
5558
+ resources: (orgId: string | null) => readonly ["executions", "resources", string | null];
5559
+ resourceDefinition: (orgId: string | null, resourceId: string) => readonly ["executions", "definition", string | null, string];
5560
+ executionsListBase: (orgId: string | null, resourceId: string) => readonly ["executions", "list", string | null, string];
5561
+ executions: (orgId: string | null, resourceId: string, resourceStatus?: string, limit?: number, offset?: number) => readonly ["executions", "list", string | null, string, string, number | null, number];
5562
+ execution: (orgId: string | null, resourceId: string, executionId: string) => readonly ["executions", "execution", string | null, string, string];
5563
+ };
5449
5564
 
5450
5565
  type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
5451
5566
  /**
@@ -5506,25 +5621,147 @@ interface APIExecutionSummary {
5506
5621
  endTime?: number;
5507
5622
  resourceStatus?: ResourceStatus;
5508
5623
  }
5509
- interface APIExecutionDetail extends APIExecutionSummary {
5510
- executionLogs: ExecutionLogMessage[];
5511
- input?: unknown;
5512
- result?: unknown;
5513
- error?: string;
5514
- resourceStatus: ResourceStatus;
5515
- apiVersion?: string | null;
5516
- resourceVersion?: string | null;
5517
- sdkVersion?: string | null;
5518
- isArchived?: boolean;
5519
- archivedLogCount?: number;
5624
+ interface APIExecutionDetail extends APIExecutionSummary {
5625
+ executionLogs: ExecutionLogMessage[];
5626
+ input?: unknown;
5627
+ result?: unknown;
5628
+ error?: string;
5629
+ resourceStatus: ResourceStatus;
5630
+ apiVersion?: string | null;
5631
+ resourceVersion?: string | null;
5632
+ sdkVersion?: string | null;
5633
+ isArchived?: boolean;
5634
+ archivedLogCount?: number;
5635
+ }
5636
+ interface APIExecutionListResponse {
5637
+ executions: APIExecutionSummary[];
5638
+ total?: number;
5639
+ limit?: number;
5640
+ offset?: number;
5641
+ hasMore?: boolean;
5642
+ }
5643
+
5644
+ /**
5645
+ * Execution history item.
5646
+ * Represents a single execution triggered by a schedule.
5647
+ */
5648
+ declare const ExecutionHistoryItemSchema: z.ZodObject<{
5649
+ id: z.ZodString;
5650
+ createdAt: z.ZodString;
5651
+ status: z.ZodEnum<{
5652
+ completed: "completed";
5653
+ failed: "failed";
5654
+ running: "running";
5655
+ cancelled: "cancelled";
5656
+ }>;
5657
+ step: z.ZodNullable<z.ZodNumber>;
5658
+ itemLabel: z.ZodNullable<z.ZodString>;
5659
+ duration: z.ZodNullable<z.ZodNumber>;
5660
+ error: z.ZodNullable<z.ZodString>;
5661
+ }, z.core.$strip>;
5662
+ /**
5663
+ * Execution history response.
5664
+ * Returned by GET /schedules/:id/executions with pagination.
5665
+ */
5666
+ declare const ExecutionHistoryResponseSchema: z.ZodObject<{
5667
+ executions: z.ZodArray<z.ZodObject<{
5668
+ id: z.ZodString;
5669
+ createdAt: z.ZodString;
5670
+ status: z.ZodEnum<{
5671
+ completed: "completed";
5672
+ failed: "failed";
5673
+ running: "running";
5674
+ cancelled: "cancelled";
5675
+ }>;
5676
+ step: z.ZodNullable<z.ZodNumber>;
5677
+ itemLabel: z.ZodNullable<z.ZodString>;
5678
+ duration: z.ZodNullable<z.ZodNumber>;
5679
+ error: z.ZodNullable<z.ZodString>;
5680
+ }, z.core.$strip>>;
5681
+ total: z.ZodNumber;
5682
+ limit: z.ZodNumber;
5683
+ offset: z.ZodNumber;
5684
+ }, z.core.$strip>;
5685
+ type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>;
5686
+ type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>;
5687
+
5688
+ /**
5689
+ * Fetch the execution list for a given resource.
5690
+ *
5691
+ * @example
5692
+ * const { data, isLoading } = useExecutions(resourceId)
5693
+ *
5694
+ * @example
5695
+ * // With status filter and limit
5696
+ * const { data } = useExecutions(resourceId, 'running', 20)
5697
+ */
5698
+ declare function useExecutions(resourceId: string, resourceStatus?: ResourceStatus | 'all', limit?: number, offset?: number): _tanstack_react_query.UseQueryResult<APIExecutionListResponse, Error>;
5699
+
5700
+ interface UseInFlightExecutionsOptions {
5701
+ enabled?: boolean;
5702
+ refetchInterval?: number | false;
5703
+ limit?: number;
5704
+ offset?: number;
5705
+ listId?: string;
5706
+ }
5707
+ declare function useInFlightExecutions(resourceId: string, options?: UseInFlightExecutionsOptions): _tanstack_react_query.UseQueryResult<APIExecutionListResponse, Error>;
5708
+
5709
+ /**
5710
+ * Fetch a single execution detail.
5711
+ * Automatically polls every 2 seconds while the execution status is 'running'.
5712
+ *
5713
+ * @example
5714
+ * const { data: execution, isLoading } = useExecution(resourceId, executionId)
5715
+ */
5716
+ declare function useExecution(resourceId: string, executionId: string): _tanstack_react_query.UseQueryResult<APIExecutionDetail, Error>;
5717
+
5718
+ interface ExecuteAsyncParams {
5719
+ resourceId: string;
5720
+ resourceType: ResourceType;
5721
+ input: unknown;
5722
+ listId?: string;
5723
+ }
5724
+ interface ExecuteAsyncResult {
5725
+ executionId: string;
5726
+ status: string;
5727
+ resourceId: string;
5728
+ }
5729
+ /**
5730
+ * Trigger an async execution for a workflow or agent.
5731
+ * Invalidates the executions list on success so the new execution appears immediately.
5732
+ *
5733
+ * @example
5734
+ * const { mutate: execute, isPending } = useExecuteAsync()
5735
+ * execute({ resourceId, resourceType: 'workflow', input: { ... } })
5736
+ */
5737
+ declare function useExecuteAsync(): _tanstack_react_query.UseMutationResult<ExecuteAsyncResult, Error, ExecuteAsyncParams, unknown>;
5738
+
5739
+ interface UseWorkflowExecutionOptions {
5740
+ workflowId: string;
5741
+ listId?: string;
5742
+ }
5743
+ interface WorkflowExecutionTriggerParams {
5744
+ input: unknown;
5520
5745
  }
5521
- interface APIExecutionListResponse {
5522
- executions: APIExecutionSummary[];
5523
- total?: number;
5524
- limit?: number;
5525
- offset?: number;
5526
- hasMore?: boolean;
5746
+ interface UseWorkflowExecutionResult {
5747
+ execute: (params: WorkflowExecutionTriggerParams) => Promise<ExecuteAsyncResult>;
5748
+ executionId: string | null;
5749
+ status: string | null;
5750
+ isIdle: boolean;
5751
+ isPending: boolean;
5752
+ isSuccess: boolean;
5753
+ isError: boolean;
5754
+ error: Error | null;
5755
+ data: ExecuteAsyncResult | undefined;
5756
+ reset: () => void;
5527
5757
  }
5758
+ /**
5759
+ * List-builder-friendly wrapper around async workflow execution.
5760
+ *
5761
+ * Binds a workflow ID once, exposes a small trigger API, and refreshes both
5762
+ * platform execution lists and list execution history when a list ID is known.
5763
+ */
5764
+ declare function useWorkflowExecution({ workflowId, listId }: UseWorkflowExecutionOptions): UseWorkflowExecutionResult;
5528
5765
 
5529
5766
  /**
5530
5767
  * @deprecated Use TimeRange from '@elevasis/core' directly. Kept as alias for backward compatibility.
@@ -5603,102 +5840,6 @@ interface Activity {
5603
5840
  createdAt: Date;
5604
5841
  }
5605
5842
 
5606
- /**
5607
- * Canonical permission catalog.
5608
- *
5609
- * Source of truth for the permission keys used by:
5610
- * - RLS policies in Supabase (via has_org_permission(org_id, key))
5611
- * - API middleware (via requireOrganizationPermission(key))
5612
- * - UI hooks (via useOrganizationPermissions().hasPermission(key))
5613
- *
5614
- * The DB table `org_rol_permissions` mirrors this constant. There is no
5615
- * runtime reconciler; parity is enforced two ways:
5616
- * 1. Each migration that adds/removes/modifies a permission must INSERT
5617
- * (or UPDATE / DELETE) the corresponding `org_rol_permissions` row in
5618
- * the same transaction.
5619
- * 2. `apps/api/src/auth/multi-tenancy/__tests__/permissions-catalog-sync.integration.test.ts`
5620
- * asserts the TS catalog and the DB rows agree; CI fails on drift.
5621
- *
5622
- * Adding a permission:
5623
- * 1. Add an entry below.
5624
- * 2. Add a row to the migration (INSERT INTO org_rol_permissions ...) in
5625
- * the same transaction as any policies/grants that reference the key.
5626
- * 3. Reference it in RLS / middleware as needed.
5627
- * 4. Optionally grant it to one or more system roles in org_rol_grants.
5628
- *
5629
- * Removing a permission: follow the deletion runbook — never just delete
5630
- * the entry. Existing role grants and policy references must be cleared first.
5631
- */
5632
- declare const PERMISSIONS: {
5633
- readonly ORG_READ: "org.read";
5634
- readonly ORG_MANAGE: "org.manage";
5635
- readonly ORG_DELETE: "org.delete";
5636
- readonly MEMBERS_MANAGE: "members.manage";
5637
- readonly ROLES_MANAGE: "roles.manage";
5638
- readonly SECRETS_MANAGE: "secrets.manage";
5639
- readonly OPERATIONS_READ: "operations.read";
5640
- readonly OPERATIONS_MANAGE: "operations.manage";
5641
- readonly ACQUISITION_MANAGE: "acquisition.manage";
5642
- readonly PROJECTS_MANAGE: "projects.manage";
5643
- readonly CLIENTS_MANAGE: "clients.manage";
5644
- };
5645
- type PermissionKey = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
5646
- /**
5647
- * Static metadata for each permission. Mirrored into org_rol_permissions by
5648
- * a migration `INSERT` in the same transaction as any change to this catalog.
5649
- * is_org_grantable=false means the permission is reserved to system roles
5650
- * only — custom roles cannot include it (privilege-escalation guard).
5651
- */
5652
- interface PermissionDescriptor {
5653
- key: PermissionKey;
5654
- description: string;
5655
- isOrgGrantable: boolean;
5656
- }
5657
-
5658
- /**
5659
- * Execution history item.
5660
- * Represents a single execution triggered by a schedule.
5661
- */
5662
- declare const ExecutionHistoryItemSchema: z.ZodObject<{
5663
- id: z.ZodString;
5664
- createdAt: z.ZodString;
5665
- status: z.ZodEnum<{
5666
- completed: "completed";
5667
- failed: "failed";
5668
- running: "running";
5669
- cancelled: "cancelled";
5670
- }>;
5671
- step: z.ZodNullable<z.ZodNumber>;
5672
- itemLabel: z.ZodNullable<z.ZodString>;
5673
- duration: z.ZodNullable<z.ZodNumber>;
5674
- error: z.ZodNullable<z.ZodString>;
5675
- }, z.core.$strip>;
5676
- /**
5677
- * Execution history response.
5678
- * Returned by GET /schedules/:id/executions with pagination.
5679
- */
5680
- declare const ExecutionHistoryResponseSchema: z.ZodObject<{
5681
- executions: z.ZodArray<z.ZodObject<{
5682
- id: z.ZodString;
5683
- createdAt: z.ZodString;
5684
- status: z.ZodEnum<{
5685
- completed: "completed";
5686
- failed: "failed";
5687
- running: "running";
5688
- cancelled: "cancelled";
5689
- }>;
5690
- step: z.ZodNullable<z.ZodNumber>;
5691
- itemLabel: z.ZodNullable<z.ZodString>;
5692
- duration: z.ZodNullable<z.ZodNumber>;
5693
- error: z.ZodNullable<z.ZodString>;
5694
- }, z.core.$strip>>;
5695
- total: z.ZodNumber;
5696
- limit: z.ZodNumber;
5697
- offset: z.ZodNumber;
5698
- }, z.core.$strip>;
5699
- type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>;
5700
- type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>;
5701
-
5702
5843
  /**
5703
5844
  * Deployment types — browser-safe
5704
5845
  *
@@ -5860,103 +6001,6 @@ declare const ListCredentialsResponseSchema: z.ZodObject<{
5860
6001
  /** API response type for a single credential list item */
5861
6002
  type CredentialListItem = z.infer<typeof ListCredentialsResponseSchema>['credentials'][number];
5862
6003
 
5863
- declare function useOrganizationPermissions(): {
5864
- hasPermission: (key: PermissionKey | string) => boolean;
5865
- permissions: string[];
5866
- isPlatformAdmin: boolean;
5867
- isReady: boolean;
5868
- };
5869
- declare function useHasPermission(key: PermissionKey | string): boolean;
5870
-
5871
- /**
5872
- * Query key factory for executions TanStack Query hooks.
5873
- * Uses organization UUID (not name) for cache isolation.
5874
- */
5875
- declare const executionsKeys: {
5876
- all: readonly ["executions"];
5877
- resources: (orgId: string | null) => readonly ["executions", "resources", string | null];
5878
- resourceDefinition: (orgId: string | null, resourceId: string) => readonly ["executions", "definition", string | null, string];
5879
- executionsListBase: (orgId: string | null, resourceId: string) => readonly ["executions", "list", string | null, string];
5880
- executions: (orgId: string | null, resourceId: string, resourceStatus?: string, limit?: number, offset?: number) => readonly ["executions", "list", string | null, string, string, number | null, number];
5881
- execution: (orgId: string | null, resourceId: string, executionId: string) => readonly ["executions", "execution", string | null, string, string];
5882
- };
5883
-
5884
- /**
5885
- * Fetch the execution list for a given resource.
5886
- *
5887
- * @example
5888
- * const { data, isLoading } = useExecutions(resourceId)
5889
- *
5890
- * @example
5891
- * // With status filter and limit
5892
- * const { data } = useExecutions(resourceId, 'running', 20)
5893
- */
5894
- declare function useExecutions(resourceId: string, resourceStatus?: ResourceStatus | 'all', limit?: number, offset?: number): _tanstack_react_query.UseQueryResult<APIExecutionListResponse, Error>;
5895
-
5896
- interface UseInFlightExecutionsOptions {
5897
- enabled?: boolean;
5898
- refetchInterval?: number | false;
5899
- limit?: number;
5900
- offset?: number;
5901
- }
5902
- declare function useInFlightExecutions(resourceId: string, options?: UseInFlightExecutionsOptions): _tanstack_react_query.UseQueryResult<APIExecutionListResponse, Error>;
5903
-
5904
- /**
5905
- * Fetch a single execution detail.
5906
- * Automatically polls every 2 seconds while the execution status is 'running'.
5907
- *
5908
- * @example
5909
- * const { data: execution, isLoading } = useExecution(resourceId, executionId)
5910
- */
5911
- declare function useExecution(resourceId: string, executionId: string): _tanstack_react_query.UseQueryResult<APIExecutionDetail, Error>;
5912
-
5913
- interface ExecuteAsyncParams {
5914
- resourceId: string;
5915
- resourceType: ResourceType;
5916
- input: unknown;
5917
- }
5918
- interface ExecuteAsyncResult {
5919
- executionId: string;
5920
- status: string;
5921
- resourceId: string;
5922
- }
5923
- /**
5924
- * Trigger an async execution for a workflow or agent.
5925
- * Invalidates the executions list on success so the new execution appears immediately.
5926
- *
5927
- * @example
5928
- * const { mutate: execute, isPending } = useExecuteAsync()
5929
- * execute({ resourceId, resourceType: 'workflow', input: { ... } })
5930
- */
5931
- declare function useExecuteAsync(): _tanstack_react_query.UseMutationResult<ExecuteAsyncResult, Error, ExecuteAsyncParams, unknown>;
5932
-
5933
- interface UseWorkflowExecutionOptions {
5934
- workflowId: string;
5935
- listId?: string;
5936
- }
5937
- interface WorkflowExecutionTriggerParams {
5938
- input: unknown;
5939
- }
5940
- interface UseWorkflowExecutionResult {
5941
- execute: (params: WorkflowExecutionTriggerParams) => Promise<ExecuteAsyncResult>;
5942
- executionId: string | null;
5943
- status: string | null;
5944
- isIdle: boolean;
5945
- isPending: boolean;
5946
- isSuccess: boolean;
5947
- isError: boolean;
5948
- error: Error | null;
5949
- data: ExecuteAsyncResult | undefined;
5950
- reset: () => void;
5951
- }
5952
- /**
5953
- * List-builder-friendly wrapper around async workflow execution.
5954
- *
5955
- * Binds a workflow ID once, exposes a small trigger API, and refreshes both
5956
- * platform execution lists and list execution history when a list ID is known.
5957
- */
5958
- declare function useWorkflowExecution({ workflowId, listId }: UseWorkflowExecutionOptions): UseWorkflowExecutionResult;
5959
-
5960
6004
  interface FetchEventSourceWithTokenRefreshOptions {
5961
6005
  url: string;
5962
6006
  getToken: () => Promise<string | undefined>;
@@ -6958,91 +7002,6 @@ declare function useSortedData<T>(data: T[], defaultColumn: string, accessors: R
6958
7002
  toggleSort: (column: string) => void;
6959
7003
  };
6960
7004
 
6961
- interface InitializationError {
6962
- layer: 'auth' | 'profile' | 'organization';
6963
- message: string;
6964
- originalError?: Error;
6965
- }
6966
- interface AppInitializationState {
6967
- userReady: boolean;
6968
- organizationReady: boolean;
6969
- allReady: boolean;
6970
- isInitializing: boolean;
6971
- error: InitializationError | null;
6972
- retry: () => void;
6973
- profile: SupabaseUserProfile | null;
6974
- }
6975
-
6976
- /**
6977
- * The value exposed by OrganizationProvider to all consumers.
6978
- */
6979
- interface OrganizationContextValue {
6980
- /** WorkOS organization ID of the currently selected organization. */
6981
- currentWorkOSOrganizationId: string | null;
6982
- /** Supabase (UUID) organization ID of the currently selected organization. */
6983
- currentSupabaseOrganizationId: string | null;
6984
- /** Full membership record for the currently selected organization. */
6985
- currentMembership: MembershipWithDetails | null;
6986
- /** All memberships for the authenticated user. */
6987
- memberships: MembershipWithDetails[];
6988
- /** True while the initial membership list is being fetched. */
6989
- isInitializing: boolean;
6990
- /** True while a subsequent org switch / refresh is in flight. */
6991
- isOrgRefreshing: boolean;
6992
- /** Error message if the membership fetch or org switch failed. */
6993
- error: string | null;
6994
- /**
6995
- * Switch the active organization.
6996
- *
6997
- * Persists the selection to `last_visited_org` on the user profile and
6998
- * invalidates all org-scoped TanStack Query cache entries.
6999
- *
7000
- * @param workosOrgId - WorkOS organization ID to switch to.
7001
- */
7002
- switchOrganization: (workosOrgId: string) => void;
7003
- /**
7004
- * Re-fetch memberships and retry org selection after an error.
7005
- */
7006
- retry: () => Promise<void>;
7007
- }
7008
-
7009
- type RestrictionSource = 'membership' | null;
7010
- interface FeatureAccessResult {
7011
- allowed: boolean;
7012
- restrictedBy: RestrictionSource;
7013
- }
7014
- /**
7015
- * Factory that creates a `useFeatureAccess` hook scoped to the consumer's
7016
- * feature configuration.
7017
- *
7018
- * @param useInitialization - Initialization hook providing `profile` and `organizationReady`
7019
- * @param useOrganization - Organization hook providing `currentMembership`
7020
- *
7021
- * @example
7022
- * ```typescript
7023
- * // In your app's feature-access module
7024
- * import { createFeatureAccessHook } from '@repo/ui/hooks'
7025
- * import { useInitialization } from '@repo/ui/initialization'
7026
- * import { useOrganization } from '@repo/ui/organization'
7027
- *
7028
- * export const useFeatureAccess = createFeatureAccessHook({
7029
- * useInitialization,
7030
- * useOrganization,
7031
- * })
7032
- * ```
7033
- */
7034
- declare function createFeatureAccessHook({ useInitialization, useOrganization }: {
7035
- useInitialization: () => Pick<AppInitializationState, 'profile' | 'organizationReady'>;
7036
- useOrganization: () => Pick<OrganizationContextValue, 'currentMembership'>;
7037
- }): () => {
7038
- orgConfig: Record<string, unknown> | undefined;
7039
- membershipConfig: MembershipFeatureConfig | undefined;
7040
- userConfig: UserConfig | undefined;
7041
- hasFeature: (featureKey: string) => boolean;
7042
- checkFeature: (featureKey: string) => FeatureAccessResult;
7043
- isReady: boolean;
7044
- };
7045
-
7046
7005
  interface UseSSEConnectionOptions {
7047
7006
  manager: SSEConnectionManagerLike;
7048
7007
  /** Shared connection key — all subscribers with the same key share ONE connection. */
@@ -8156,6 +8115,7 @@ declare const acquisitionListKeys: {
8156
8115
  detail: (organizationId: string | null, listId: string) => readonly ["acquisition-lists", string | null, string];
8157
8116
  telemetry: (organizationId: string | null) => readonly ["acquisition-lists", "telemetry", string | null];
8158
8117
  progress: (organizationId: string | null, listId: string) => readonly ["acquisition-lists", "progress", string | null, string];
8118
+ executionsBase: (organizationId: string | null, listId: string) => readonly ["acquisition-lists", "executions", string | null, string];
8159
8119
  records: (organizationId: string | null, listId: string, filters: ListRecordsFilters) => readonly ["acquisition-lists", "records", string | null, string, "company" | "contact", string | null, number | null, number | null];
8160
8120
  executions: (organizationId: string | null, listId: string, filters?: ListExecutionsFilters) => readonly ["acquisition-lists", "executions", string | null, string, string | null, number | null];
8161
8121
  };
@@ -8256,6 +8216,7 @@ declare function useLists(): _tanstack_react_query.UseQueryResult<{
8256
8216
  enabled?: boolean | undefined;
8257
8217
  order?: number | undefined;
8258
8218
  }[] | undefined;
8219
+ dataMode?: "mock" | "live" | undefined;
8259
8220
  };
8260
8221
  }[], Error>;
8261
8222
  declare function useList(listId: string): _tanstack_react_query.UseQueryResult<{
@@ -8341,6 +8302,7 @@ declare function useList(listId: string): _tanstack_react_query.UseQueryResult<{
8341
8302
  enabled?: boolean | undefined;
8342
8303
  order?: number | undefined;
8343
8304
  }[] | undefined;
8305
+ dataMode?: "mock" | "live" | undefined;
8344
8306
  };
8345
8307
  }, Error>;
8346
8308
  declare function useListsTelemetry(): _tanstack_react_query.UseQueryResult<ListTelemetry[], Error>;
@@ -8525,6 +8487,7 @@ declare function useCreateList(): _tanstack_react_query.UseMutationResult<{
8525
8487
  enabled?: boolean | undefined;
8526
8488
  order?: number | undefined;
8527
8489
  }[] | undefined;
8490
+ dataMode?: "mock" | "live" | undefined;
8528
8491
  };
8529
8492
  }, Error, {
8530
8493
  name: string;
@@ -8552,6 +8515,7 @@ declare function useCreateList(): _tanstack_react_query.UseMutationResult<{
8552
8515
  enabled?: boolean | undefined;
8553
8516
  order?: number | undefined;
8554
8517
  }[] | undefined;
8518
+ dataMode?: "mock" | "live" | undefined;
8555
8519
  } | undefined;
8556
8520
  }, unknown>;
8557
8521
  declare function useUpdateList(listId: string): _tanstack_react_query.UseMutationResult<{
@@ -8637,6 +8601,7 @@ declare function useUpdateList(listId: string): _tanstack_react_query.UseMutatio
8637
8601
  enabled?: boolean | undefined;
8638
8602
  order?: number | undefined;
8639
8603
  }[] | undefined;
8604
+ dataMode?: "mock" | "live" | undefined;
8640
8605
  };
8641
8606
  }, Error, {
8642
8607
  name?: string | undefined;
@@ -8728,6 +8693,7 @@ declare function useUpdateListConfig(listId: string): _tanstack_react_query.UseM
8728
8693
  enabled?: boolean | undefined;
8729
8694
  order?: number | undefined;
8730
8695
  }[] | undefined;
8696
+ dataMode?: "mock" | "live" | undefined;
8731
8697
  };
8732
8698
  }, Error, {
8733
8699
  scrapingConfig?: {
@@ -8751,6 +8717,7 @@ declare function useUpdateListConfig(listId: string): _tanstack_react_query.UseM
8751
8717
  enabled?: boolean | undefined;
8752
8718
  order?: number | undefined;
8753
8719
  }[] | undefined;
8720
+ dataMode?: "mock" | "live" | undefined;
8754
8721
  } | undefined;
8755
8722
  }, unknown>;
8756
8723
  declare function useDeleteList(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
@@ -9184,7 +9151,7 @@ declare function useDeleteContacts(): _tanstack_react_query.UseMutationResult<vo
9184
9151
 
9185
9152
  declare const leadGenArtifactKeys: {
9186
9153
  all: readonly ["lead-gen-artifacts"];
9187
- list: (organizationId: string | null, ownerKind: AcqArtifactOwnerKind, ownerId: string) => readonly ["lead-gen-artifacts", string | null, "list" | "company" | "contact" | "deal" | "list_member", string];
9154
+ list: (organizationId: string | null, ownerKind: AcqArtifactOwnerKind, ownerId: string) => readonly ["lead-gen-artifacts", string | null, "company" | "contact" | "list" | "deal" | "list_member", string];
9188
9155
  };
9189
9156
  interface UseArtifactsParams {
9190
9157
  ownerKind: AcqArtifactOwnerKind;
@@ -9216,7 +9183,7 @@ declare function useCreateArtifact(): _tanstack_react_query.UseMutationResult<{
9216
9183
  createdAt: string;
9217
9184
  version: number;
9218
9185
  }, Error, {
9219
- ownerKind: "list" | "company" | "contact" | "deal" | "list_member";
9186
+ ownerKind: "company" | "contact" | "list" | "deal" | "list_member";
9220
9187
  ownerId: string;
9221
9188
  kind: string;
9222
9189
  content: Record<string, unknown>;
@@ -9524,12 +9491,6 @@ declare class OrganizationMembershipService {
9524
9491
 
9525
9492
  declare function useUserMemberships(userId: string, params?: Omit<ListMembershipsParams, 'userId'>): _tanstack_react_query.UseQueryResult<MembershipWithDetails[], Error>;
9526
9493
 
9527
- interface UpdateMemberConfigParams {
9528
- membershipId: string;
9529
- config: MembershipFeatureConfig;
9530
- }
9531
- declare function useUpdateMemberConfig(): _tanstack_react_query.UseMutationResult<unknown, Error, UpdateMemberConfigParams, unknown>;
9532
-
9533
9494
  interface DeactivateMembershipMutationData {
9534
9495
  membershipId: string;
9535
9496
  userId?: string;
@@ -10266,5 +10227,5 @@ declare function useCreateNote(): _tanstack_react_query.UseMutationResult<{
10266
10227
  type?: string;
10267
10228
  }, "organization_id">, unknown>;
10268
10229
 
10269
- export { ApiKeyService, CredentialService, DeploymentService, OperationsService, OrganizationMembershipService, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, WebhookEndpointService, acquisitionListKeys, clientsKeys, collectResourceFilterFacets, companyKeys, contactKeys, createFeatureAccessHook, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, getResourceFilterFacetIds, isSessionCapable, labelResourceFilterFacet, leadGenArtifactKeys, leadGenListCompanyKeys, leadGenListMemberKeys, milestoneKeys, noteKeys, observabilityKeys, operationsKeys, projectActivityKeys, projectKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, taskKeys, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useAddCompaniesToList, useAddContactsToList, useArchiveSession, useArchivedLogs, useArtifacts, useAssignRole, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useClient, useClientStatus, useClients, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateArtifact, useCreateClient, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateProject as useCreateDeliveryProject, useCreateList, useCreateMilestone, useCreateNote, useCreateOrgRole, useCreateSchedule, useCreateSession, useCreateTask, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteApiKey, useDeleteClient, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteProject as useDeleteDeliveryProject, useDeleteTask as useDeleteDeliveryTask, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteMilestone, useDeleteOrgRole, useDeleteRequest, useDeleteSchedule, useDeleteSession, useDeleteTask$1 as useDeleteTask, useDeleteWebhookEndpoint, useDeriveActions, useEffectivePermissions, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAction, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutionSSE, useExecutions, useGetExecutionHistory, useGetSchedule, useHasPermission, useInFlightExecutions, useList, useListApiKeys, useListDeployments, useListExecutions, useListMember, useListMembers, useListProgress, useListRecords, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useMergedExecution, useMilestones, useNotificationCount as useNotificationCountSSE, useNotifications, useOrgRoles, useOrganizationMembers, useOrganizationPermissions, usePaginationState, usePatchTask, usePauseSchedule, usePermissionCatalog, useProject, useProjectActivities, useProjectMilestones, useProjectNotes, useProjectRealtime, useProjectTasks, useProjects, useReactivateMembership, useRecentExecutionsByResource, useRemoveCompaniesFromList, useRequest, useRequestsList, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useRevokeRole, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useSystemHealth, useTableSelection, useTableSort, useTasks, useTestNotification, useTimeRangeDates, useTopFailingResources, useTransitionItem, useTransitionListCompany, useTransitionListMember, useTransitionState, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateClient, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateProject as useUpdateDeliveryProject, useUpdateList, useUpdateListConfig, useUpdateListStatus, useUpdateMemberConfig, useUpdateMilestone, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateTask, useUpdateWebhookEndpoint, useUserMemberships, useVerifyCredential, useVisibleResources, useWarningNotification, useWorkflowExecution };
10270
- export type { AcqCompanyWithCount, AcqContactWithCompany, AcqDealNote, AcqDealTask, AcqDealTaskKind, ActivityFilters, ActivityTrendResponse, AddCompaniesToListResult, AddContactsToListResult, AssignRoleInput, BulkDeleteExecutionsParams, BulkDeleteExecutionsResult, BusinessImpactMetrics, CancelExecutionParams, CancelExecutionResult, ChatMessage, ClientDetailResponse, ClientResponse, ClientStatus, ClientStatusResponse, ClientsListFilters, CreateApiKeyRequest, CreateApiKeyResponse, CreateClientRequest, CreateCredentialRequest, CreateCredentialResponse, CreateOrgRoleInput, CreateScheduleInput, CreateSessionResponse, CredentialListItem, DealDetail, DealLookupFilters, DealLookupItem, DealSummaryStageItem, DealsSummaryResponse, DeleteExecutionParams, Deployment, ErrorDistributionItem, ErrorDistributionParams, ErrorFilters, ErrorTrendsParams, ExecuteActionInput, ExecuteAsyncParams, ExecuteAsyncResult, ExecutionErrorDetails, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogsFilters, ExecutionLogsPageResponse, FailingResource, FeatureAccessResult, GetMessagesResponse, ListActivitiesResponse, ListApiKeysResponse, ListCredentialsResponse, ListExecutionsFilters, ListRecordsFilters, ListSchedulesFilters, ListSchedulesResponse, ListWebhookEndpointsResponse, MessageEvent, MessageType, OrgRole, RemoveCompaniesFromListResult, RequestRow, RequestsListFilters, ResourceFilterFacet, ResourcesResponse, RetryExecutionParams, RevokeRoleInput, SessionDTO, SessionExecution, SessionExecutionsResponse, SessionListItem, SessionTokenUsage, SortDirection, SortState, StaleDealSummaryItem, StatefulItem, StatusFilter, SubmitActionRequest, SubmitActionResponse, SystemHealthExecutionSummary, SystemHealthResponse, TaskSchedule, TopFailingResourcesParams, TransitionItemInput, TransitionListCompanyInput, TransitionListMemberInput, TransitionStateInput, UpdateClientRequest, UpdateListStatusInput, UpdateOrgRoleInput, UpdateScheduleInput, UseActivitiesParams, UseActivityTrendParams, UseArtifactsParams, UseBatchedResourcesHealthParams, UseExecuteResourceOptions, UseExecutionHealthParams, UseExecutionLogsParams, UseExecutionPanelStateOptions, UseExecutionPanelStateReturn, UseExecutionSSEOptions, UseExecutionSSEResult, UseInFlightExecutionsOptions, UseListProgressOptions, UseNotificationCountArgs, UseResourcesHealthParams, UseSSEConnectionOptions, UseScheduledTasksOptions, UseSystemHealthParams, UseWorkflowExecutionOptions, UseWorkflowExecutionResult, VerifyCredentialResponse, WebSocketState, WorkflowExecutionTriggerParams };
10230
+ export { AccessKeys, ApiKeyService, CredentialService, DeploymentService, OperationsService, OrganizationMembershipService, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, WebhookEndpointService, acquisitionListKeys, clientsKeys, collectResourceFilterFacets, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, getResourceFilterFacetIds, isSessionCapable, labelResourceFilterFacet, leadGenArtifactKeys, leadGenListCompanyKeys, leadGenListMemberKeys, milestoneKeys, noteKeys, observabilityKeys, operationsKeys, projectActivityKeys, projectKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, taskKeys, useAccess, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useAddCompaniesToList, useAddContactsToList, useArchiveSession, useArchivedLogs, useArtifacts, useAssignRole, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useClient, useClientStatus, useClients, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateArtifact, useCreateClient, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateProject as useCreateDeliveryProject, useCreateList, useCreateMilestone, useCreateNote, useCreateOrgRole, useCreateSchedule, useCreateSession, useCreateTask, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteApiKey, useDeleteClient, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteProject as useDeleteDeliveryProject, useDeleteTask as useDeleteDeliveryTask, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteMilestone, useDeleteOrgRole, useDeleteRequest, useDeleteSchedule, useDeleteSession, useDeleteTask$1 as useDeleteTask, useDeleteWebhookEndpoint, useDeriveActions, useEffectivePermissions, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAction, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutionSSE, useExecutions, useGetExecutionHistory, useGetSchedule, useInFlightExecutions, useList, useListApiKeys, useListDeployments, useListExecutions, useListMember, useListMembers, useListProgress, useListRecords, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useMergedExecution, useMilestones, useNotificationCount as useNotificationCountSSE, useNotifications, useOrgRoles, useOrganizationMembers, usePaginationState, usePatchTask, usePauseSchedule, usePermissionCatalog, useProject, useProjectActivities, useProjectMilestones, useProjectNotes, useProjectRealtime, useProjectTasks, useProjects, useReactivateMembership, useRecentExecutionsByResource, useRemoveCompaniesFromList, useRequest, useRequestsList, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useRevokeRole, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useSystemHealth, useTableSelection, useTableSort, useTasks, useTestNotification, useTimeRangeDates, useTopFailingResources, useTransitionItem, useTransitionListCompany, useTransitionListMember, useTransitionState, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateClient, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateProject as useUpdateDeliveryProject, useUpdateList, useUpdateListConfig, useUpdateListStatus, useUpdateMilestone, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateTask, useUpdateWebhookEndpoint, useUserMemberships, useVerifyCredential, useVisibleResources, useWarningNotification, useWorkflowExecution };
10231
+ export type { AccessKeyInput, AcqCompanyWithCount, AcqContactWithCompany, AcqDealNote, AcqDealTask, AcqDealTaskKind, ActivityFilters, ActivityTrendResponse, AddCompaniesToListResult, AddContactsToListResult, AssignRoleInput, BulkDeleteExecutionsParams, BulkDeleteExecutionsResult, BusinessImpactMetrics, CancelExecutionParams, CancelExecutionResult, ChatMessage, ClientDetailResponse, ClientResponse, ClientStatus, ClientStatusResponse, ClientsListFilters, CreateApiKeyRequest, CreateApiKeyResponse, CreateClientRequest, CreateCredentialRequest, CreateCredentialResponse, CreateOrgRoleInput, CreateScheduleInput, CreateSessionResponse, CredentialListItem, DealDetail, DealLookupFilters, DealLookupItem, DealSummaryStageItem, DealsSummaryResponse, DeleteExecutionParams, Deployment, ErrorDistributionItem, ErrorDistributionParams, ErrorFilters, ErrorTrendsParams, ExecuteActionInput, ExecuteAsyncParams, ExecuteAsyncResult, ExecutionErrorDetails, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogsFilters, ExecutionLogsPageResponse, FailingResource, GetMessagesResponse, ListActivitiesResponse, ListApiKeysResponse, ListCredentialsResponse, ListExecutionsFilters, ListRecordsFilters, ListSchedulesFilters, ListSchedulesResponse, ListWebhookEndpointsResponse, MessageEvent, MessageType, OrgRole, RemoveCompaniesFromListResult, RequestRow, RequestsListFilters, ResourceFilterFacet, ResourcesResponse, RetryExecutionParams, RevokeRoleInput, SessionDTO, SessionExecution, SessionExecutionsResponse, SessionListItem, SessionTokenUsage, SortDirection, SortState, StaleDealSummaryItem, StatefulItem, StatusFilter, SubmitActionRequest, SubmitActionResponse, SystemHealthExecutionSummary, SystemHealthResponse, TaskSchedule, TopFailingResourcesParams, TransitionItemInput, TransitionListCompanyInput, TransitionListMemberInput, TransitionStateInput, UpdateClientRequest, UpdateListStatusInput, UpdateOrgRoleInput, UpdateScheduleInput, UseAccessResult, UseActivitiesParams, UseActivityTrendParams, UseArtifactsParams, UseBatchedResourcesHealthParams, UseExecuteResourceOptions, UseExecutionHealthParams, UseExecutionLogsParams, UseExecutionPanelStateOptions, UseExecutionPanelStateReturn, UseExecutionSSEOptions, UseExecutionSSEResult, UseInFlightExecutionsOptions, UseListProgressOptions, UseNotificationCountArgs, UseResourcesHealthParams, UseSSEConnectionOptions, UseScheduledTasksOptions, UseSystemHealthParams, UseWorkflowExecutionOptions, UseWorkflowExecutionResult, VerifyCredentialResponse, WebSocketState, WorkflowExecutionTriggerParams };