@elevasis/ui 2.20.0 → 2.22.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 +2 -2
  2. package/dist/app/index.js +5 -5
  3. package/dist/charts/index.js +3 -3
  4. package/dist/{chunk-TO7QXDBX.js → chunk-3HEUGBOT.js} +3 -3
  5. package/dist/chunk-AXXTN44Z.js +26 -0
  6. package/dist/{chunk-FMFX4K6E.js → chunk-B4FHWKEF.js} +3390 -2929
  7. package/dist/{chunk-AL23U6C3.js → chunk-BIWHHWCJ.js} +1 -2
  8. package/dist/{chunk-MZFJWCPH.js → chunk-BSZRKBAW.js} +277 -92
  9. package/dist/{chunk-GP3AFJYG.js → chunk-COG4ABRI.js} +8 -13
  10. package/dist/chunk-DDZOHLHB.js +48 -0
  11. package/dist/{chunk-ZE2KQSHL.js → chunk-GJ7EIABJ.js} +4 -4
  12. package/dist/{chunk-YP6T426C.js → chunk-IBUYJXA3.js} +1326 -1110
  13. package/dist/{chunk-2CFOFSSG.js → chunk-IOTLB6ND.js} +8 -13
  14. package/dist/{chunk-GBMNCNHX.js → chunk-KVJ3LFH2.js} +3 -1
  15. package/dist/chunk-LJWV4TWV.js +335 -0
  16. package/dist/{chunk-PJVG3ISO.js → chunk-LKVBEE63.js} +7 -9
  17. package/dist/{chunk-JR5WNTLA.js → chunk-LVJGPE6H.js} +11 -24
  18. package/dist/{chunk-OUYH2SBS.js → chunk-LVUCBY7X.js} +2 -2
  19. package/dist/{chunk-TIIPYB2Z.js → chunk-QZJM3RYI.js} +1 -1
  20. package/dist/{chunk-OD7GWIZS.js → chunk-SGXXJE52.js} +1 -121
  21. package/dist/{chunk-7YQKVWSD.js → chunk-SQ5JGELM.js} +25 -5
  22. package/dist/{chunk-R7OJCNL3.js → chunk-T6INEVX6.js} +1 -1
  23. package/dist/{chunk-RX4UWZZR.js → chunk-TKAYX2SP.js} +8 -3
  24. package/dist/{chunk-CTTY6FUT.js → chunk-TSSKOQBX.js} +2 -2
  25. package/dist/{chunk-GTYUP7MB.js → chunk-WWJ6S2HQ.js} +10 -22
  26. package/dist/{chunk-Q5HC6ENG.js → chunk-XOTJNW4Q.js} +1 -1
  27. package/dist/{chunk-BHR7IV72.js → chunk-XUYBOO32.js} +1 -1
  28. package/dist/{chunk-M7W7CGPL.js → chunk-Z6FAH4XV.js} +1 -1
  29. package/dist/{chunk-Q4QJOSVS.js → chunk-ZBCTB5CA.js} +1 -1
  30. package/dist/components/index.css +85 -85
  31. package/dist/components/index.d.ts +970 -746
  32. package/dist/components/index.js +246 -39
  33. package/dist/components/navigation/index.css +589 -0
  34. package/dist/components/navigation/index.d.ts +1 -13
  35. package/dist/components/navigation/index.js +11 -1
  36. package/dist/execution/index.d.ts +27 -0
  37. package/dist/features/auth/index.css +2 -2
  38. package/dist/features/auth/index.d.ts +184 -3
  39. package/dist/features/crm/index.css +2 -2
  40. package/dist/features/crm/index.d.ts +201 -38
  41. package/dist/features/crm/index.js +15 -14
  42. package/dist/features/dashboard/index.css +2 -2
  43. package/dist/features/dashboard/index.d.ts +25 -27
  44. package/dist/features/dashboard/index.js +15 -14
  45. package/dist/features/delivery/index.css +85 -85
  46. package/dist/features/delivery/index.d.ts +201 -38
  47. package/dist/features/delivery/index.js +15 -14
  48. package/dist/features/lead-gen/index.css +2 -2
  49. package/dist/features/lead-gen/index.d.ts +19 -37
  50. package/dist/features/lead-gen/index.js +15 -14
  51. package/dist/features/monitoring/index.css +85 -85
  52. package/dist/features/monitoring/index.d.ts +18 -36
  53. package/dist/features/monitoring/index.js +17 -16
  54. package/dist/features/monitoring/requests/index.css +2 -2
  55. package/dist/features/monitoring/requests/index.d.ts +18 -36
  56. package/dist/features/monitoring/requests/index.js +15 -14
  57. package/dist/features/operations/index.css +2 -2
  58. package/dist/features/operations/index.d.ts +49 -67
  59. package/dist/features/operations/index.js +18 -17
  60. package/dist/features/seo/index.d.ts +17 -35
  61. package/dist/features/seo/index.js +1 -1
  62. package/dist/features/settings/index.css +2 -2
  63. package/dist/features/settings/index.d.ts +222 -44
  64. package/dist/features/settings/index.js +16 -15
  65. package/dist/graph/index.css +2 -2
  66. package/dist/hooks/delivery/index.css +2 -2
  67. package/dist/hooks/delivery/index.d.ts +184 -3
  68. package/dist/hooks/delivery/index.js +2 -2
  69. package/dist/hooks/index.css +85 -85
  70. package/dist/hooks/index.d.ts +1862 -1582
  71. package/dist/hooks/index.js +13 -12
  72. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +92 -121
  73. package/dist/hooks/published.css +85 -85
  74. package/dist/hooks/published.d.ts +1862 -1582
  75. package/dist/hooks/published.js +13 -12
  76. package/dist/index.css +12 -12
  77. package/dist/index.d.ts +689 -470
  78. package/dist/index.js +14 -13
  79. package/dist/initialization/index.d.ts +184 -3
  80. package/dist/layout/index.js +2 -2
  81. package/dist/organization/index.css +589 -0
  82. package/dist/organization/index.js +1 -1
  83. package/dist/profile/index.d.ts +184 -3
  84. package/dist/provider/index.css +384 -0
  85. package/dist/provider/index.d.ts +68 -125
  86. package/dist/provider/index.js +11 -10
  87. package/dist/provider/published.css +463 -0
  88. package/dist/provider/published.d.ts +68 -125
  89. package/dist/provider/published.js +8 -7
  90. package/dist/supabase/index.d.ts +359 -6
  91. package/dist/test-utils/index.d.ts +46 -2
  92. package/dist/test-utils/index.js +104 -3
  93. package/dist/theme/index.js +2 -2
  94. package/dist/types/index.d.ts +303 -141
  95. package/dist/utils/index.d.ts +26 -59
  96. package/dist/utils/index.js +1 -1
  97. package/package.json +4 -4
  98. package/dist/chunk-LR5CRY5A.js +0 -514
  99. package/dist/chunk-MG3NF7QL.js +0 -63
  100. /package/dist/{chunk-6GUW5GGF.js → chunk-6Z3G4U2R.js} +0 -0
@@ -7,17 +7,10 @@ import * as zustand from 'zustand';
7
7
  import { Edge } from '@xyflow/react';
8
8
 
9
9
  /**
10
- * Query key factory for executions TanStack Query hooks.
11
- * Uses organization UUID (not name) for cache isolation.
10
+ * Error categories for observability grouping and classification.
11
+ * Used to categorize errors in the execution_errors table metadata.
12
12
  */
13
- declare const executionsKeys: {
14
- all: readonly ["executions"];
15
- resources: (orgId: string | null) => readonly ["executions", "resources", string | null];
16
- resourceDefinition: (orgId: string | null, resourceId: string) => readonly ["executions", "definition", string | null, string];
17
- executionsListBase: (orgId: string | null, resourceId: string) => readonly ["executions", "list", string | null, string];
18
- executions: (orgId: string | null, resourceId: string, resourceStatus?: string, limit?: number, offset?: number) => readonly ["executions", "list", string | null, string, string, number | null, number];
19
- execution: (orgId: string | null, resourceId: string, executionId: string) => readonly ["executions", "execution", string | null, string, string];
20
- };
13
+ type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
21
14
 
22
15
  /**
23
16
  * Workflow-specific logging types and utilities
@@ -267,10 +260,170 @@ interface FormSchema {
267
260
  }
268
261
 
269
262
  /**
270
- * Error categories for observability grouping and classification.
271
- * Used to categorize errors in the execution_errors table metadata.
263
+ * Serialized Registry Types
264
+ *
265
+ * Pre-computed JSON-safe types for API responses and Command View.
266
+ * Serialization happens once at API startup, enabling instant response times.
272
267
  */
273
- type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
268
+
269
+ /**
270
+ * Serialized form field for API responses
271
+ */
272
+ interface SerializedFormField {
273
+ name: string;
274
+ label: string;
275
+ type: FormFieldType;
276
+ defaultValue?: unknown;
277
+ required?: boolean;
278
+ placeholder?: string;
279
+ description?: string;
280
+ options?: Array<{
281
+ label: string;
282
+ value: string | number;
283
+ }>;
284
+ min?: number;
285
+ max?: number;
286
+ }
287
+ /**
288
+ * Serialized form schema for API responses
289
+ */
290
+ interface SerializedFormSchema {
291
+ title?: string;
292
+ description?: string;
293
+ fields: SerializedFormField[];
294
+ layout?: 'vertical' | 'horizontal' | 'grid';
295
+ }
296
+ /**
297
+ * Serialized execution form schema for API responses
298
+ */
299
+ interface SerializedExecutionFormSchema extends SerializedFormSchema {
300
+ fieldMappings?: Record<string, string>;
301
+ submitButton?: {
302
+ label?: string;
303
+ loadingLabel?: string;
304
+ confirmMessage?: string;
305
+ };
306
+ }
307
+ /**
308
+ * Serialized schedule config for API responses
309
+ */
310
+ interface SerializedScheduleConfig {
311
+ enabled: boolean;
312
+ defaultSchedule?: string;
313
+ allowedPatterns?: string[];
314
+ }
315
+ /**
316
+ * Serialized webhook config for API responses
317
+ */
318
+ interface SerializedWebhookConfig {
319
+ enabled: boolean;
320
+ payloadSchema?: unknown;
321
+ }
322
+ /**
323
+ * Serialized execution interface for API responses
324
+ */
325
+ interface SerializedExecutionInterface {
326
+ form: SerializedExecutionFormSchema;
327
+ schedule?: SerializedScheduleConfig;
328
+ webhook?: SerializedWebhookConfig;
329
+ }
330
+ /**
331
+ * Serialized agent definition (JSON-safe)
332
+ * Result of serializeDefinition(AgentDefinition)
333
+ */
334
+ interface SerializedAgentDefinition {
335
+ config: {
336
+ resourceId: string;
337
+ name: string;
338
+ description: string;
339
+ version: string;
340
+ type: 'agent';
341
+ status: 'dev' | 'prod';
342
+ links?: ResourceLink[];
343
+ category?: ResourceCategory;
344
+ /** Whether this resource is archived and should be excluded from registration and deployment */
345
+ archived?: boolean;
346
+ systemPrompt: string;
347
+ constraints?: {
348
+ maxIterations?: number;
349
+ timeout?: number;
350
+ maxSessionMemoryKeys?: number;
351
+ maxMemoryTokens?: number;
352
+ };
353
+ sessionCapable?: boolean;
354
+ memoryPreferences?: string;
355
+ };
356
+ modelConfig: {
357
+ provider: string;
358
+ model: string;
359
+ apiKey: string;
360
+ temperature: number;
361
+ maxOutputTokens: number;
362
+ topP?: number;
363
+ modelOptions?: Record<string, unknown>;
364
+ };
365
+ contract: {
366
+ inputSchema: object;
367
+ outputSchema?: object;
368
+ };
369
+ tools: Array<{
370
+ name: string;
371
+ description: string;
372
+ inputSchema?: object;
373
+ outputSchema?: object;
374
+ }>;
375
+ knowledgeMap?: {
376
+ nodeCount: number;
377
+ nodes: Array<{
378
+ id: string;
379
+ description: string;
380
+ loaded: boolean;
381
+ hasPrompt: boolean;
382
+ }>;
383
+ };
384
+ metricsConfig?: object;
385
+ interface?: SerializedExecutionInterface;
386
+ }
387
+ /**
388
+ * Serialized workflow definition (JSON-safe)
389
+ * Result of serializeDefinition(WorkflowDefinition)
390
+ */
391
+ interface SerializedWorkflowDefinition {
392
+ config: {
393
+ resourceId: string;
394
+ name: string;
395
+ description: string;
396
+ version: string;
397
+ type: 'workflow';
398
+ status: 'dev' | 'prod';
399
+ links?: ResourceLink[];
400
+ category?: ResourceCategory;
401
+ /** Whether this resource is archived and should be excluded from registration and deployment */
402
+ archived?: boolean;
403
+ };
404
+ entryPoint: string;
405
+ steps: Array<{
406
+ id: string;
407
+ name: string;
408
+ description: string;
409
+ inputSchema?: object;
410
+ outputSchema?: object;
411
+ next: {
412
+ type: 'linear' | 'conditional';
413
+ target?: string;
414
+ routes?: Array<{
415
+ target: string;
416
+ }>;
417
+ default?: string;
418
+ } | null;
419
+ }>;
420
+ contract: {
421
+ inputSchema: object;
422
+ outputSchema?: object;
423
+ };
424
+ metricsConfig?: object;
425
+ interface?: SerializedExecutionInterface;
426
+ }
274
427
 
275
428
  /**
276
429
  * Memory type definitions
@@ -1984,6 +2137,7 @@ type Database = {
1984
2137
  Row: {
1985
2138
  config: Json;
1986
2139
  created_at: string | null;
2140
+ effective_permissions: string[];
1987
2141
  id: string;
1988
2142
  membership_status: string | null;
1989
2143
  organization_id: string;
@@ -1995,6 +2149,7 @@ type Database = {
1995
2149
  Insert: {
1996
2150
  config?: Json;
1997
2151
  created_at?: string | null;
2152
+ effective_permissions?: string[];
1998
2153
  id?: string;
1999
2154
  membership_status?: string | null;
2000
2155
  organization_id: string;
@@ -2006,6 +2161,7 @@ type Database = {
2006
2161
  Update: {
2007
2162
  config?: Json;
2008
2163
  created_at?: string | null;
2164
+ effective_permissions?: string[];
2009
2165
  id?: string;
2010
2166
  membership_status?: string | null;
2011
2167
  organization_id?: string;
@@ -2031,96 +2187,237 @@ type Database = {
2031
2187
  }
2032
2188
  ];
2033
2189
  };
2034
- organizations: {
2190
+ org_rol_assignments: {
2035
2191
  Row: {
2036
- config: Json;
2037
- created_at: string;
2038
- id: string;
2039
- is_test: boolean;
2040
- metadata: Json;
2041
- name: string;
2042
- status: string;
2043
- updated_at: string;
2044
- workos_org_id: string;
2192
+ granted_at: string;
2193
+ granted_by: string | null;
2194
+ membership_id: string;
2195
+ role_id: string;
2045
2196
  };
2046
2197
  Insert: {
2047
- config?: Json;
2048
- created_at?: string;
2049
- id?: string;
2050
- is_test?: boolean;
2051
- metadata?: Json;
2052
- name: string;
2053
- status?: string;
2054
- updated_at?: string;
2055
- workos_org_id: string;
2198
+ granted_at?: string;
2199
+ granted_by?: string | null;
2200
+ membership_id: string;
2201
+ role_id: string;
2056
2202
  };
2057
2203
  Update: {
2058
- config?: Json;
2059
- created_at?: string;
2060
- id?: string;
2061
- is_test?: boolean;
2062
- metadata?: Json;
2063
- name?: string;
2064
- status?: string;
2065
- updated_at?: string;
2066
- workos_org_id?: string;
2204
+ granted_at?: string;
2205
+ granted_by?: string | null;
2206
+ membership_id?: string;
2207
+ role_id?: string;
2067
2208
  };
2068
- Relationships: [];
2209
+ Relationships: [
2210
+ {
2211
+ foreignKeyName: "org_rol_assignments_granted_by_fkey";
2212
+ columns: ["granted_by"];
2213
+ isOneToOne: false;
2214
+ referencedRelation: "users";
2215
+ referencedColumns: ["id"];
2216
+ },
2217
+ {
2218
+ foreignKeyName: "org_rol_assignments_membership_id_fkey";
2219
+ columns: ["membership_id"];
2220
+ isOneToOne: false;
2221
+ referencedRelation: "org_memberships";
2222
+ referencedColumns: ["id"];
2223
+ },
2224
+ {
2225
+ foreignKeyName: "org_rol_assignments_role_id_fkey";
2226
+ columns: ["role_id"];
2227
+ isOneToOne: false;
2228
+ referencedRelation: "org_rol_definitions";
2229
+ referencedColumns: ["id"];
2230
+ }
2231
+ ];
2069
2232
  };
2070
- prj_milestones: {
2233
+ org_rol_definitions: {
2071
2234
  Row: {
2072
- checklist: Json | null;
2073
- completed_at: string | null;
2074
2235
  created_at: string;
2075
2236
  description: string | null;
2076
- due_date: string | null;
2077
2237
  id: string;
2078
- metadata: Json | null;
2238
+ is_system: boolean;
2079
2239
  name: string;
2080
- organization_id: string;
2081
- project_id: string;
2082
- sequence: number;
2083
- status: string;
2240
+ organization_id: string | null;
2241
+ slug: string;
2084
2242
  updated_at: string;
2085
2243
  };
2086
2244
  Insert: {
2087
- checklist?: Json | null;
2088
- completed_at?: string | null;
2089
2245
  created_at?: string;
2090
2246
  description?: string | null;
2091
- due_date?: string | null;
2092
2247
  id?: string;
2093
- metadata?: Json | null;
2248
+ is_system?: boolean;
2094
2249
  name: string;
2095
- organization_id: string;
2096
- project_id: string;
2097
- sequence?: number;
2098
- status?: string;
2250
+ organization_id?: string | null;
2251
+ slug: string;
2099
2252
  updated_at?: string;
2100
2253
  };
2101
2254
  Update: {
2102
- checklist?: Json | null;
2103
- completed_at?: string | null;
2104
2255
  created_at?: string;
2105
2256
  description?: string | null;
2106
- due_date?: string | null;
2107
2257
  id?: string;
2108
- metadata?: Json | null;
2258
+ is_system?: boolean;
2109
2259
  name?: string;
2110
- organization_id?: string;
2111
- project_id?: string;
2112
- sequence?: number;
2113
- status?: string;
2260
+ organization_id?: string | null;
2261
+ slug?: string;
2114
2262
  updated_at?: string;
2115
2263
  };
2116
2264
  Relationships: [
2117
2265
  {
2118
- foreignKeyName: "fk_milestones_project";
2119
- columns: ["project_id"];
2266
+ foreignKeyName: "org_rol_definitions_organization_id_fkey";
2267
+ columns: ["organization_id"];
2120
2268
  isOneToOne: false;
2121
- referencedRelation: "prj_projects";
2269
+ referencedRelation: "organizations";
2122
2270
  referencedColumns: ["id"];
2123
- },
2271
+ }
2272
+ ];
2273
+ };
2274
+ org_rol_grants: {
2275
+ Row: {
2276
+ granted_at: string;
2277
+ permission_key: string;
2278
+ role_id: string;
2279
+ };
2280
+ Insert: {
2281
+ granted_at?: string;
2282
+ permission_key: string;
2283
+ role_id: string;
2284
+ };
2285
+ Update: {
2286
+ granted_at?: string;
2287
+ permission_key?: string;
2288
+ role_id?: string;
2289
+ };
2290
+ Relationships: [
2291
+ {
2292
+ foreignKeyName: "org_rol_grants_permission_key_fkey";
2293
+ columns: ["permission_key"];
2294
+ isOneToOne: false;
2295
+ referencedRelation: "org_rol_permissions";
2296
+ referencedColumns: ["key"];
2297
+ },
2298
+ {
2299
+ foreignKeyName: "org_rol_grants_role_id_fkey";
2300
+ columns: ["role_id"];
2301
+ isOneToOne: false;
2302
+ referencedRelation: "org_rol_definitions";
2303
+ referencedColumns: ["id"];
2304
+ }
2305
+ ];
2306
+ };
2307
+ org_rol_permissions: {
2308
+ Row: {
2309
+ created_at: string;
2310
+ description: string;
2311
+ is_org_grantable: boolean;
2312
+ key: string;
2313
+ updated_at: string;
2314
+ };
2315
+ Insert: {
2316
+ created_at?: string;
2317
+ description: string;
2318
+ is_org_grantable?: boolean;
2319
+ key: string;
2320
+ updated_at?: string;
2321
+ };
2322
+ Update: {
2323
+ created_at?: string;
2324
+ description?: string;
2325
+ is_org_grantable?: boolean;
2326
+ key?: string;
2327
+ updated_at?: string;
2328
+ };
2329
+ Relationships: [];
2330
+ };
2331
+ organizations: {
2332
+ Row: {
2333
+ config: Json;
2334
+ created_at: string;
2335
+ id: string;
2336
+ is_test: boolean;
2337
+ metadata: Json;
2338
+ name: string;
2339
+ status: string;
2340
+ updated_at: string;
2341
+ workos_org_id: string;
2342
+ };
2343
+ Insert: {
2344
+ config?: Json;
2345
+ created_at?: string;
2346
+ id?: string;
2347
+ is_test?: boolean;
2348
+ metadata?: Json;
2349
+ name: string;
2350
+ status?: string;
2351
+ updated_at?: string;
2352
+ workos_org_id: string;
2353
+ };
2354
+ Update: {
2355
+ config?: Json;
2356
+ created_at?: string;
2357
+ id?: string;
2358
+ is_test?: boolean;
2359
+ metadata?: Json;
2360
+ name?: string;
2361
+ status?: string;
2362
+ updated_at?: string;
2363
+ workos_org_id?: string;
2364
+ };
2365
+ Relationships: [];
2366
+ };
2367
+ prj_milestones: {
2368
+ Row: {
2369
+ checklist: Json | null;
2370
+ completed_at: string | null;
2371
+ created_at: string;
2372
+ description: string | null;
2373
+ due_date: string | null;
2374
+ id: string;
2375
+ metadata: Json | null;
2376
+ name: string;
2377
+ organization_id: string;
2378
+ project_id: string;
2379
+ sequence: number;
2380
+ status: string;
2381
+ updated_at: string;
2382
+ };
2383
+ Insert: {
2384
+ checklist?: Json | null;
2385
+ completed_at?: string | null;
2386
+ created_at?: string;
2387
+ description?: string | null;
2388
+ due_date?: string | null;
2389
+ id?: string;
2390
+ metadata?: Json | null;
2391
+ name: string;
2392
+ organization_id: string;
2393
+ project_id: string;
2394
+ sequence?: number;
2395
+ status?: string;
2396
+ updated_at?: string;
2397
+ };
2398
+ Update: {
2399
+ checklist?: Json | null;
2400
+ completed_at?: string | null;
2401
+ created_at?: string;
2402
+ description?: string | null;
2403
+ due_date?: string | null;
2404
+ id?: string;
2405
+ metadata?: Json | null;
2406
+ name?: string;
2407
+ organization_id?: string;
2408
+ project_id?: string;
2409
+ sequence?: number;
2410
+ status?: string;
2411
+ updated_at?: string;
2412
+ };
2413
+ Relationships: [
2414
+ {
2415
+ foreignKeyName: "fk_milestones_project";
2416
+ columns: ["project_id"];
2417
+ isOneToOne: false;
2418
+ referencedRelation: "prj_projects";
2419
+ referencedColumns: ["id"];
2420
+ },
2124
2421
  {
2125
2422
  foreignKeyName: "prj_milestones_organization_id_fkey";
2126
2423
  columns: ["organization_id"];
@@ -2788,7 +3085,8 @@ type Database = {
2788
3085
  created_at: string;
2789
3086
  description: string | null;
2790
3087
  id: string;
2791
- key: string;
3088
+ key_hash: string;
3089
+ key_prefix: string | null;
2792
3090
  last_triggered_at: string | null;
2793
3091
  name: string;
2794
3092
  organization_id: string;
@@ -2801,7 +3099,8 @@ type Database = {
2801
3099
  created_at?: string;
2802
3100
  description?: string | null;
2803
3101
  id?: string;
2804
- key: string;
3102
+ key_hash: string;
3103
+ key_prefix?: string | null;
2805
3104
  last_triggered_at?: string | null;
2806
3105
  name: string;
2807
3106
  organization_id: string;
@@ -2814,7 +3113,8 @@ type Database = {
2814
3113
  created_at?: string;
2815
3114
  description?: string | null;
2816
3115
  id?: string;
2817
- key?: string;
3116
+ key_hash?: string;
3117
+ key_prefix?: string | null;
2818
3118
  last_triggered_at?: string | null;
2819
3119
  name?: string;
2820
3120
  organization_id?: string;
@@ -2860,6 +3160,13 @@ type Database = {
2860
3160
  Args: never;
2861
3161
  Returns: string;
2862
3162
  };
3163
+ can_assign_role_in_org: {
3164
+ Args: {
3165
+ p_role_id: string;
3166
+ p_target_membership_id: string;
3167
+ };
3168
+ Returns: boolean;
3169
+ };
2863
3170
  current_user_is_platform_admin: {
2864
3171
  Args: never;
2865
3172
  Returns: boolean;
@@ -2889,6 +3196,10 @@ type Database = {
2889
3196
  user_id: string;
2890
3197
  }[];
2891
3198
  };
3199
+ get_platform_credential_kek: {
3200
+ Args: never;
3201
+ Returns: string;
3202
+ };
2892
3203
  get_storage_org_id: {
2893
3204
  Args: {
2894
3205
  file_path: string;
@@ -2899,6 +3210,13 @@ type Database = {
2899
3210
  Args: never;
2900
3211
  Returns: string;
2901
3212
  };
3213
+ has_org_permission: {
3214
+ Args: {
3215
+ org_id: string;
3216
+ perm_key: string;
3217
+ };
3218
+ Returns: boolean;
3219
+ };
2902
3220
  is_org_admin: {
2903
3221
  Args: {
2904
3222
  org_id: string;
@@ -2931,6 +3249,22 @@ type Database = {
2931
3249
  Args: never;
2932
3250
  Returns: Json;
2933
3251
  };
3252
+ recompute_all_memberships: {
3253
+ Args: never;
3254
+ Returns: undefined;
3255
+ };
3256
+ sync_all_memberships_with_role: {
3257
+ Args: {
3258
+ p_role_id: string;
3259
+ };
3260
+ Returns: undefined;
3261
+ };
3262
+ sync_one_membership: {
3263
+ Args: {
3264
+ p_membership_id: string;
3265
+ };
3266
+ Returns: undefined;
3267
+ };
2934
3268
  upsert_user_profile: {
2935
3269
  Args: never;
2936
3270
  Returns: {
@@ -2963,1565 +3297,1493 @@ type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables
2963
3297
  Row: infer R;
2964
3298
  } ? R : never : never;
2965
3299
 
2966
- /**
2967
- * Time range selector for dashboard metrics
2968
- */
2969
- type TimeRange = '1h' | '24h' | '7d' | '30d';
2970
- /**
2971
- * Execution health metrics response
2972
- * Success rate, P95 duration, execution counts, and trend data
2973
- * trendData includes executionCount for throughput visualization (eliminates separate API call)
2974
- */
2975
- interface ExecutionHealthMetrics {
2976
- successRate: number;
2977
- p95Duration: number;
2978
- totalExecutions: number;
2979
- trendData: Array<{
2980
- time: string;
2981
- rate: number;
2982
- successCount: number;
2983
- errorCount: number;
2984
- warningCount: number;
2985
- executionCount: number;
2986
- }>;
2987
- statusCounts: {
2988
- success: number;
2989
- failed: number;
2990
- pending: number;
2991
- warning: number;
2992
- };
2993
- peakPeriod: string;
2994
- granularity: 'hour' | 'day';
2995
- }
2996
- /**
2997
- * Error analysis metrics response
2998
- * Error categories and top failing resources
2999
- */
3000
- interface ErrorAnalysisMetrics {
3001
- totalErrors: number;
3002
- errorsByCategory: Array<{
3003
- category: string;
3004
- count: number;
3005
- percentage: number;
3006
- }>;
3007
- topFailingResources: Array<{
3008
- resourceId: string;
3300
+ type SupabaseUserProfile = Tables<'users'>;
3301
+ type SupabaseApiKey = Tables<'api_keys'>;
3302
+ /** API response type for API key list items (omits sensitive key_hash) */
3303
+ type ApiKeyListItem = Omit<SupabaseApiKey, 'key_hash'>;
3304
+
3305
+ /** Raw database row type for acq_deals table */
3306
+ type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
3307
+ type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing';
3308
+ interface DealContact {
3309
+ id: string;
3310
+ first_name: string | null;
3311
+ last_name: string | null;
3312
+ email: string;
3313
+ title: string | null;
3314
+ headline: string | null;
3315
+ linkedin_url: string | null;
3316
+ pipeline_status: Record<string, unknown> | null;
3317
+ enrichment_data: Record<string, unknown> | null;
3318
+ company: {
3319
+ id: string;
3009
3320
  name: string;
3010
- errorCount: number;
3011
- failureRate: number;
3012
- }>;
3321
+ domain: string | null;
3322
+ website: string | null;
3323
+ linkedin_url: string | null;
3324
+ segment: string | null;
3325
+ category: string | null;
3326
+ num_employees: number | null;
3327
+ } | null;
3013
3328
  }
3014
- /**
3015
- * Business impact metrics response
3016
- * ROI, labor savings, and cost analysis
3017
- */
3018
- interface BusinessImpactMetrics$1 {
3019
- totalSavingsUsd: number;
3020
- totalCostUsd: number;
3021
- netSavingsUsd: number;
3022
- roi: number;
3329
+ interface DealFilters {
3330
+ stage?: DealStage;
3331
+ search?: string;
3332
+ limit?: number;
3333
+ offset?: number;
3334
+ }
3335
+ /** Deal list item with joined contact and company data */
3336
+ interface DealListItem extends AcqDealRow {
3337
+ contact: DealContact | null;
3023
3338
  }
3339
+ type DealDetail = DealListItem;
3340
+ /** Task kind options for a deal task (human follow-up action type) */
3341
+ type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
3024
3342
  /**
3025
- * Cost breakdown metrics response
3026
- * Per-resource cost analysis
3343
+ * A CRM to-do item attached to a deal representing a human follow-up action.
3344
+ * Transformed from AcqDealTaskRow with camelCase properties.
3027
3345
  */
3028
- interface CostBreakdownMetrics {
3029
- resources: Array<{
3030
- resourceId: string;
3031
- totalCostUsd: number;
3032
- executionCount: number;
3033
- avgCostUsd: number;
3034
- }>;
3346
+ interface AcqDealTask {
3347
+ id: string;
3348
+ organizationId: string;
3349
+ dealId: string;
3350
+ title: string;
3351
+ description: string | null;
3352
+ kind: AcqDealTaskKind;
3353
+ dueAt: string | null;
3354
+ assigneeUserId: string | null;
3355
+ completedAt: string | null;
3356
+ completedByUserId: string | null;
3357
+ createdAt: string;
3358
+ updatedAt: string;
3359
+ createdByUserId: string | null;
3035
3360
  }
3036
3361
  /**
3037
- * Dashboard metrics response
3038
- * Aggregates core observability metrics in a single response
3039
- * Note: Throughput data is now included in executionHealth.trendData.executionCount
3362
+ * Live-scan aggregate telemetry for a single list, computed on demand from
3363
+ * the list junction tables and current contact deliverability state.
3040
3364
  */
3041
- interface DashboardMetrics {
3042
- executionHealth: ExecutionHealthMetrics;
3043
- costBreakdown: CostBreakdownMetrics;
3044
- businessImpact: BusinessImpactMetrics$1;
3045
- /** ISO timestamp of the currently active deployment, or null if none */
3046
- activeDeploymentDate: string | null;
3047
- /** Deployment version of the active deployment, or null if none */
3048
- activeDeploymentVersion: string | null;
3365
+ interface ListTelemetry {
3366
+ listId: string;
3367
+ totalCompanies: number;
3368
+ totalContacts: number;
3369
+ stageCounts: {
3370
+ populated: number;
3371
+ extracted: number;
3372
+ qualified: number;
3373
+ discovered: number;
3374
+ verified: number;
3375
+ personalized: number;
3376
+ uploaded: number;
3377
+ };
3378
+ deliverability: {
3379
+ valid: number;
3380
+ risky: number;
3381
+ invalid: number;
3382
+ unknown: number;
3383
+ bounced: number;
3384
+ };
3385
+ /** Reserved -- active workflow IDs associated with this list. */
3386
+ activeWorkflows?: string[];
3049
3387
  }
3388
+
3050
3389
  /**
3051
- * Error record for list view (ErrorBreakdownTable)
3390
+ * Lead Service Types
3391
+ * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
3392
+ *
3393
+ * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
3052
3394
  */
3053
- interface ErrorRecord {
3395
+
3396
+ interface AcqDealNote {
3054
3397
  id: string;
3055
- timestamp: string;
3056
- errorType: string;
3057
- message: string;
3058
- executionId: string;
3059
- resourceId: string;
3060
- resourceName: string;
3061
- severity: 'critical' | 'warning' | 'info';
3062
- category: ExecutionErrorCategory;
3063
- resolved: boolean;
3064
- resolvedAt: string | null;
3065
- resolvedBy: string | null;
3398
+ dealId: string;
3399
+ organizationId: string;
3400
+ authorUserId: string | null;
3401
+ body: string;
3402
+ createdAt: string;
3403
+ updatedAt: string;
3066
3404
  }
3405
+
3067
3406
  /**
3068
- * Full error detail for modal view (ErrorDetailsModal)
3407
+ * Action configuration for HITL tasks
3408
+ * Defines available user actions and their behavior
3069
3409
  */
3070
- interface ErrorDetailFull extends ErrorRecord {
3071
- stackTrace?: string;
3072
- retryAttempt?: number;
3073
- stepName?: string;
3074
- stepSequence?: number;
3075
- errorContext?: Record<string, unknown>;
3076
- executionContext?: Record<string, unknown>;
3410
+ interface ActionConfig {
3411
+ /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
3412
+ id: string;
3413
+ /** Display label for UI button */
3414
+ label: string;
3415
+ /** Button variant/style */
3416
+ type: 'primary' | 'secondary' | 'danger' | 'outline';
3417
+ /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
3418
+ icon?: string;
3419
+ /** Button color (Mantine theme colors) */
3420
+ color?: string;
3421
+ /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
3422
+ variant?: string;
3423
+ /** Execution target (agent/workflow to invoke) */
3424
+ target?: {
3425
+ resourceType: 'agent' | 'workflow';
3426
+ resourceId: string;
3427
+ /**
3428
+ * Optional session ID for agent continuation.
3429
+ * If provided, invokes a new turn on the existing session instead of standalone execution.
3430
+ * Only valid when resourceType is 'agent'.
3431
+ */
3432
+ sessionId?: string;
3433
+ };
3434
+ /** Form schema for collecting action-specific data */
3435
+ form?: FormSchema;
3436
+ /** Payload template for pre-filling forms */
3437
+ payloadTemplate?: unknown;
3438
+ /** Requires confirmation dialog */
3439
+ requiresConfirmation?: boolean;
3440
+ /** Confirmation message */
3441
+ confirmationMessage?: string;
3442
+ /** Help text / tooltip */
3443
+ description?: string;
3077
3444
  }
3445
+
3078
3446
  /**
3079
- * Error details API response (paginated)
3447
+ * Origin resource type - where an execution/task originated from.
3448
+ * Used for audit trails and tracking execution lineage.
3080
3449
  */
3081
- interface ErrorDetailResponse {
3082
- errors: ErrorRecord[];
3083
- total: number;
3084
- page: number;
3085
- limit: number;
3086
- }
3450
+ type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
3087
3451
  /**
3088
- * Error trend data for time-series charts
3452
+ * Origin tracking metadata - who/what created this execution/task.
3453
+ * Used by both TaskScheduler and CommandQueue for complete audit trails.
3089
3454
  */
3090
- interface ErrorTrend {
3091
- time: string;
3092
- errorCount: number;
3093
- criticalCount: number;
3094
- warningCount: number;
3095
- infoCount: number;
3455
+ interface OriginTracking {
3456
+ originExecutionId: string;
3457
+ originResourceType: OriginResourceType;
3458
+ originResourceId: string;
3096
3459
  }
3460
+
3097
3461
  /**
3098
- * Summary of executions for a single resource
3099
- * Used by RecentExecutionsByResource dashboard component
3462
+ * Command queue task with flexible action system
3100
3463
  */
3101
- interface ResourceExecutionSummary {
3102
- resourceId: string;
3103
- resourceType: string;
3104
- resourceName: string | null;
3105
- lastExecution: string;
3106
- totalExecutions: number;
3107
- successCount: number;
3108
- failureCount: number;
3109
- warningCount: number;
3110
- successRate: number;
3464
+ interface Task extends OriginTracking {
3465
+ id: string;
3466
+ organizationId: string;
3467
+ actions: ActionConfig[];
3468
+ context: unknown;
3469
+ selectedAction?: string;
3470
+ actionPayload?: unknown;
3471
+ description?: string;
3472
+ priority: number;
3473
+ /** Optional checkpoint identifier for grouping related human approval tasks */
3474
+ humanCheckpoint?: string;
3475
+ status: QueueTaskStatus;
3476
+ /**
3477
+ * Target resource tracking — mirrors origin columns.
3478
+ * Set when task is created; patchable to redirect execution to a different resource.
3479
+ */
3480
+ targetResourceId?: string;
3481
+ targetResourceType?: 'agent' | 'workflow';
3482
+ /**
3483
+ * Execution ID for the action that runs AFTER user approval.
3484
+ * NULL until execution starts.
3485
+ *
3486
+ * Naming distinction:
3487
+ * - originExecutionId = Parent execution that CREATED the HITL task
3488
+ * - targetExecutionId = Child execution that RUNS AFTER user approval
3489
+ */
3490
+ targetExecutionId?: string;
3491
+ createdAt: Date;
3492
+ completedAt?: Date;
3493
+ completedBy?: string;
3494
+ expiresAt?: Date;
3495
+ idempotencyKey?: string | null;
3111
3496
  }
3112
3497
  /**
3113
- * Response from getRecentExecutionsByResource endpoint
3498
+ * Task status values
3499
+ * - pending: awaiting action
3500
+ * - processing: execution in progress after user approval
3501
+ * - completed: action was taken and execution succeeded
3502
+ * - failed: execution failed, task can be retried
3503
+ * - expired: timed out before action
3114
3504
  */
3115
- interface RecentExecutionsByResourceResponse {
3116
- resources: ResourceExecutionSummary[];
3117
- }
3118
- /** Resource identifier for health queries */
3119
- interface ResourceIdentifier {
3120
- entityType: string;
3121
- entityId: string;
3122
- }
3123
- /** Time-bucketed health data point */
3124
- interface ResourceHealthDataPoint {
3125
- time: string;
3126
- success: number;
3127
- failure: number;
3128
- warning: number;
3129
- rate: number;
3130
- }
3131
- /** Health data for a single resource */
3132
- interface ResourceHealth {
3133
- entityType: string;
3134
- entityId: string;
3135
- entityName: string | null;
3136
- trendData: ResourceHealthDataPoint[];
3137
- summary: {
3138
- total: number;
3139
- successRate: number;
3140
- };
3505
+ type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
3506
+ /**
3507
+ * Parameters for patching mutable metadata on a task
3508
+ */
3509
+ interface PatchTaskParams {
3510
+ humanCheckpoint?: string | null;
3511
+ description?: string;
3512
+ priority?: number;
3513
+ context?: Record<string, unknown>;
3514
+ actions?: unknown[];
3515
+ targetResourceId?: string | null;
3516
+ targetResourceType?: 'agent' | 'workflow' | null;
3517
+ targetExecutionId?: string;
3518
+ status?: 'pending' | 'failed' | 'completed';
3141
3519
  }
3142
- /** Batch response with all requested resources */
3143
- interface ResourcesHealthResponse {
3144
- resources: ResourceHealth[];
3520
+ interface CommandQueueListResponse {
3521
+ tasks: Task[];
3522
+ total: number;
3145
3523
  }
3524
+
3146
3525
  /**
3147
- * Cost trend data point for time-series charts
3148
- * Represents a single time bucket (hour or day)
3526
+ * Checkpoint list item for sidebar grouping
3527
+ * The id field contains the resourceId of the human checkpoint
3149
3528
  */
3150
- interface CostTrendDataPoint {
3151
- time: string;
3152
- totalCostUsd: number;
3153
- executionCount: number;
3154
- avgCostPerExecution: number;
3155
- }
3156
- /**
3157
- * Cost trends response (time-series data)
3158
- */
3159
- interface CostTrendsResponse {
3160
- trendData: CostTrendDataPoint[];
3161
- granularity: 'hour' | 'day';
3162
- totalCostUsd: number;
3163
- totalExecutions: number;
3529
+ interface CheckpointListItem {
3530
+ /** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
3531
+ id: string;
3532
+ /** Display name (same as id, or "Ungrouped" for null) */
3533
+ name: string;
3534
+ /** Task count for this checkpoint */
3535
+ count: number;
3164
3536
  }
3165
3537
  /**
3166
- * Cost summary response with MTD and projections
3538
+ * Status counts for pie chart display
3167
3539
  */
3168
- interface CostSummaryResponse {
3169
- current: {
3170
- totalCostUsd: number;
3171
- executionCount: number;
3172
- };
3173
- previous: {
3174
- totalCostUsd: number;
3175
- executionCount: number;
3176
- };
3177
- mtd: {
3178
- totalCostUsd: number;
3179
- daysElapsed: number;
3180
- };
3181
- projection: {
3182
- monthlyCostUsd: number;
3183
- confidence: 'low' | 'medium' | 'high';
3184
- };
3185
- trend: {
3186
- changePercent: number;
3187
- direction: 'up' | 'down' | 'flat';
3188
- };
3540
+ interface StatusCounts {
3541
+ pending: number;
3542
+ completed: number;
3543
+ expired: number;
3189
3544
  }
3190
3545
  /**
3191
- * Cost by model data for model-level breakdown
3546
+ * Priority counts for donut chart display
3192
3547
  */
3193
- interface CostByModelData {
3194
- model: string;
3195
- totalCostUsd: number;
3196
- callCount: number;
3197
- totalInputTokens: number;
3198
- totalOutputTokens: number;
3199
- avgCostPerCall: number;
3548
+ interface PriorityCounts {
3549
+ critical: number;
3550
+ high: number;
3551
+ medium: number;
3552
+ low: number;
3200
3553
  }
3201
3554
  /**
3202
- * Cost by model response
3555
+ * Response from GET /command-queue/checkpoints endpoint
3203
3556
  */
3204
- interface CostByModelResponse {
3205
- models: CostByModelData[];
3206
- totalCostUsd: number;
3207
- totalCallCount: number;
3557
+ interface CheckpointListResponse {
3558
+ checkpoints: CheckpointListItem[];
3559
+ /** Total tasks across all checkpoints */
3560
+ total: number;
3561
+ /** Breakdown by status for donut chart */
3562
+ statusCounts: StatusCounts;
3563
+ /** Breakdown by priority for donut chart */
3564
+ priorityCounts: PriorityCounts;
3208
3565
  }
3209
3566
 
3210
3567
  /**
3211
- * Supported integration types
3212
- *
3213
- * These represent the available integration adapters that can be used with tools.
3214
- * Each integration type corresponds to an adapter implementation.
3215
- *
3216
- * Note: Concrete adapter implementations are deferred until needed.
3217
- * This type provides compile-time safety and auto-completion for tool definitions.
3218
- */
3219
- type IntegrationType = 'gmail' | 'google-sheets' | 'slack' | 'github' | 'linear' | 'attio' | 'airtable' | 'salesforce' | 'hubspot' | 'stripe' | 'twilio' | 'sendgrid' | 'mailgun' | 'zapier' | 'webhook' | 'apify' | 'instantly' | 'resend' | 'signature-api' | 'dropbox' | 'anymailfinder' | 'tomba' | 'millionverifier';
3220
-
3221
- /**
3222
- * Standard Domain Definitions
3223
- * Centralized domain constants and definitions for all organization resources.
3224
- */
3225
-
3226
- declare const DOMAINS: {
3227
- readonly INBOUND_PIPELINE: "inbound-pipeline";
3228
- readonly LEAD_GEN_PIPELINE: "lead-gen-pipeline";
3229
- readonly SUPPORT: "support";
3230
- readonly CLIENT_SUPPORT: "client-support";
3231
- readonly DELIVERY: "delivery";
3232
- readonly OPERATIONS: "operations";
3233
- readonly FINANCE: "finance";
3234
- readonly EXECUTIVE: "executive";
3235
- readonly INSTANTLY: "instantly";
3236
- readonly TESTING: "testing";
3237
- readonly INTERNAL: "internal";
3238
- readonly INTEGRATION: "integration";
3239
- readonly UTILITY: "utility";
3240
- readonly DIAGNOSTIC: "diagnostic";
3241
- };
3242
- /**
3243
- * ResourceDomain - Strongly typed domain identifier
3244
- * Use this type for all domain references to ensure compile-time validation.
3245
- */
3246
- type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS];
3247
-
3248
- /**
3249
- * Resource Registry type definitions
3250
- */
3251
-
3252
- /**
3253
- * Environment/deployment status for resources
3254
- */
3255
- type ResourceStatus = 'dev' | 'prod';
3256
- /**
3257
- * All resource types in the platform
3258
- * Used as the discriminator field in ResourceDefinition
3259
- */
3260
- type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
3261
- /**
3262
- * Base interface for ALL platform resources
3263
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
3568
+ * Target for schedule execution - identifies what resource to execute.
3569
+ * Unlike ExecutionTarget, payload is NOT included here because schedules
3570
+ * store payload in the scheduleConfig (varies per step/item).
3264
3571
  */
3265
- interface ResourceDefinition {
3266
- /** Unique resource identifier */
3572
+ interface ScheduleTarget {
3573
+ resourceType: 'agent' | 'workflow';
3267
3574
  resourceId: string;
3268
- /** Display name */
3269
- name: string;
3270
- /** Purpose and functionality description */
3271
- description: string;
3272
- /** Version for change tracking and evolution */
3273
- version: string;
3274
- /** Resource type discriminator */
3275
- type: ResourceType;
3276
- /** Environment/deployment status */
3277
- status: ResourceStatus;
3278
- /** Domain tags for filtering and organization */
3279
- domains?: ResourceDomain[];
3280
- /** Whether the agent supports multi-turn sessions (agents only) */
3281
- sessionCapable?: boolean;
3282
- /** Whether the resource is local (monorepo) or remote (externally deployed) */
3283
- origin?: 'local' | 'remote';
3284
- /** Whether this resource is archived and should be excluded from registration and deployment */
3285
- archived?: boolean;
3286
3575
  }
3287
3576
  /**
3288
- * Domain definition for Command View filtering
3289
- *
3290
- * Domains are organizational metadata for UI filtering/grouping.
3291
- * No execution impact - purely for visualization.
3292
- *
3293
- * @example
3294
- * {
3295
- * id: 'support',
3296
- * name: 'Customer Support',
3297
- * description: 'Ticket triage, knowledge base, escalations',
3298
- * color: 'green',
3299
- * icon: 'IconHeadset'
3300
- * }
3577
+ * Optional origin tracking for schedules.
3578
+ * Unlike OriginTracking (which is required), these fields are all optional
3579
+ * for schedules created directly via API (not triggered by another resource).
3301
3580
  */
3302
- interface DomainDefinition {
3303
- /** Unique identifier (e.g., 'support') */
3304
- id: string;
3305
- /** Display name (e.g., 'Customer Support') */
3306
- name: string;
3307
- /** Purpose description */
3308
- description: string;
3309
- /** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
3310
- color?: string;
3311
- /** Optional Tabler icon name (e.g., 'IconHeadset') */
3312
- icon?: string;
3581
+ interface ScheduleOriginTracking {
3582
+ originExecutionId?: string;
3583
+ originResourceType?: OriginResourceType;
3584
+ originResourceId?: string;
3313
3585
  }
3314
- /** Webhook provider identifiers */
3315
- type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test';
3316
- /** Webhook trigger configuration */
3317
- interface WebhookTriggerConfig {
3318
- /** Provider identifier */
3319
- provider: WebhookProviderType;
3320
- /** Event type for documentation (not used for matching - workflow handles routing) */
3321
- event?: string;
3322
- /** Optional filtering (e.g., specific form ID for Fillout) */
3323
- filter?: Record<string, string>;
3324
- /** References credential in credentials table for per-org webhook secrets */
3325
- credentialName?: string;
3586
+ type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
3587
+ interface RecurringScheduleConfig {
3588
+ type: 'recurring';
3589
+ cron?: string;
3590
+ interval?: 'daily' | 'weekly' | 'monthly';
3591
+ time?: string;
3592
+ timezone: string;
3593
+ payload: Record<string, unknown>;
3594
+ endAt?: string | null;
3595
+ overduePolicy?: 'skip' | 'execute';
3326
3596
  }
3327
- /** Schedule trigger configuration */
3328
- interface ScheduleTriggerConfig {
3329
- /** Cron expression (e.g., '0 6 * * *') */
3330
- cron: string;
3331
- /** Optional timezone (default: UTC) */
3332
- timezone?: string;
3597
+ interface RelativeScheduleConfig {
3598
+ type: 'relative';
3599
+ anchorAt: string;
3600
+ anchorLabel?: string;
3601
+ items: RelativeScheduleItem[];
3602
+ overduePolicy?: 'skip' | 'execute';
3333
3603
  }
3334
- /** Event trigger configuration */
3335
- interface EventTriggerConfig {
3336
- /** Internal event type */
3337
- eventType: string;
3338
- /** Event source */
3339
- source?: string;
3604
+ interface RelativeScheduleItem {
3605
+ offset: string;
3606
+ payload: Record<string, unknown>;
3607
+ label?: string;
3340
3608
  }
3341
- /** Union of all trigger configs */
3342
- type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig;
3609
+ interface AbsoluteScheduleConfig {
3610
+ type: 'absolute';
3611
+ items: AbsoluteScheduleItem[];
3612
+ overduePolicy?: 'skip' | 'execute';
3613
+ }
3614
+ interface AbsoluteScheduleItem {
3615
+ runAt: string;
3616
+ payload: Record<string, unknown>;
3617
+ label?: string;
3618
+ }
3619
+ interface TaskSchedule extends ScheduleOriginTracking {
3620
+ id: string;
3621
+ organizationId: string;
3622
+ name: string;
3623
+ description?: string;
3624
+ target: ScheduleTarget;
3625
+ scheduleConfig: TaskScheduleConfig;
3626
+ nextRunAt?: Date;
3627
+ currentStep: number;
3628
+ status: 'active' | 'paused' | 'completed' | 'cancelled';
3629
+ lastRunAt?: Date;
3630
+ lastExecutionId?: string;
3631
+ maxRetries: number;
3632
+ idempotencyKey?: string;
3633
+ createdAt: Date;
3634
+ updatedAt: Date;
3635
+ }
3636
+
3343
3637
  /**
3344
- * Trigger metadata - entry points that initiate resource execution
3345
- *
3346
- * Triggers represent how executions start: webhooks from external services,
3347
- * scheduled cron jobs, platform events, or manual user actions.
3348
- *
3349
- * BREAKING CHANGES (2025-11-30):
3350
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
3351
- * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
3352
- * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
3353
- * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
3354
- * - triggers object now includes `externalResources` option
3355
- *
3356
- * @example
3357
- * // TriggerDefinition - metadata only
3358
- * {
3359
- * resourceId: 'trigger-new-order',
3360
- * type: 'trigger',
3361
- * triggerType: 'webhook',
3362
- * name: 'New Order',
3363
- * description: 'Webhook from Shopify on new orders',
3364
- * version: '1.0.0',
3365
- * status: 'prod',
3366
- * webhookPath: '/webhooks/shopify/orders'
3367
- * }
3368
- *
3369
- * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
3370
- * // relationships: {
3371
- * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
3372
- * // }
3638
+ * Wire-format DTO for notification API responses.
3639
+ * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
3640
+ * Used by frontend hooks that consume /api/notifications.
3373
3641
  */
3374
- interface TriggerDefinition extends ResourceDefinition {
3375
- /** Resource type discriminator (narrowed from base union) */
3376
- type: 'trigger';
3377
- /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
3378
- triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
3379
- /** Type-specific configuration */
3380
- config?: TriggerConfig;
3381
- /** For webhook triggers: path like '/webhooks/shopify/orders' */
3382
- webhookPath?: string;
3383
- /** For schedule triggers: cron expression like '0 6 * * *' */
3384
- schedule?: string;
3385
- /** For event triggers: event type like 'low-stock-alert' */
3386
- eventType?: string;
3387
- }
3388
- /**
3389
- * Integration metadata - external service connections
3390
- *
3391
- * References credentials table for actual connection. No connection status
3392
- * stored here (queried at runtime from credentials table).
3393
- *
3394
- * BREAKING CHANGES (2025-11-30):
3395
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
3396
- * - Field renames: `id` -> `resourceId` (inherited)
3397
- * - New required field: `status` (inherited) - organizations must add status to all integrations
3398
- * - New required field: `version` (inherited) - organizations must add version to all integrations
3399
- * - New required field: `type: 'integration'` (inherited) - resource type discriminator
3400
- *
3401
- * @example
3402
- * {
3403
- * resourceId: 'integration-shopify-prod',
3404
- * type: 'integration',
3405
- * provider: 'shopify',
3406
- * credentialName: 'shopify-prod',
3407
- * name: 'Shopify Production',
3408
- * description: 'E-commerce platform',
3409
- * version: '1.0.0',
3410
- * status: 'prod'
3411
- * }
3412
- */
3413
- interface IntegrationDefinition extends ResourceDefinition {
3414
- /** Resource type discriminator (narrowed from base union) */
3415
- type: 'integration';
3416
- /** Integration provider type */
3417
- provider: IntegrationType;
3418
- /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
3419
- credentialName: string;
3420
- }
3421
- /**
3422
- * External platform type
3423
- * Supported third-party automation platforms
3424
- */
3425
- type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other';
3426
- /**
3427
- * External automation resource metadata
3428
- *
3429
- * Represents workflows/automations running on third-party platforms
3430
- * (n8n, Make, Zapier, etc.) for visualization in Command View.
3431
- *
3432
- * NOTE: This is metadata ONLY for visualization. No execution logic,
3433
- * no API integration with external platforms, no status syncing.
3434
- *
3435
- * BREAKING CHANGES (2025-11-30):
3436
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
3437
- * - Field renames: `id` -> `resourceId` (inherited)
3438
- * - New required field: `version` (inherited) - organizations must add version to all external resources
3439
- * - New required field: `type: 'external'` (inherited) - resource type discriminator
3440
- * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
3441
- *
3442
- * @example
3443
- * {
3444
- * resourceId: 'external-n8n-order-sync',
3445
- * type: 'external',
3446
- * version: '1.0.0',
3447
- * platform: 'n8n',
3448
- * name: 'Shopify Order Sync',
3449
- * description: 'Legacy n8n workflow for syncing Shopify orders',
3450
- * status: 'prod',
3451
- * platformUrl: 'https://n8n.client.com/workflow/123',
3452
- * triggers: { workflows: ['order-fulfillment-workflow'] },
3453
- * uses: { integrations: ['integration-shopify-prod'] }
3454
- * }
3455
- */
3456
- interface ExternalResourceDefinition extends ResourceDefinition {
3457
- /** Resource type discriminator (narrowed from base union) */
3458
- type: 'external';
3459
- /** Platform type */
3460
- platform: ExternalPlatform;
3461
- /** Link to external platform (e.g., n8n workflow editor URL) */
3462
- platformUrl?: string;
3463
- /** Platform's internal ID/reference */
3464
- externalId?: string;
3465
- /** What this external resource triggers (external -> internal) */
3466
- triggers?: {
3467
- /** Elevasis workflow resourceIds this external automation triggers */
3468
- workflows?: string[];
3469
- /** Elevasis agent resourceIds this external automation triggers */
3470
- agents?: string[];
3471
- };
3472
- /** Integrations this external resource uses (shared credentials) */
3473
- uses?: {
3474
- /** Integration IDs this external automation uses */
3475
- integrations?: string[];
3476
- };
3477
- }
3478
- /**
3479
- * Human Checkpoint definition - human decision points in automation
3480
- *
3481
- * Represents where human judgment is deployed in the automation landscape.
3482
- * Tasks with matching command_queue_group are routed to this checkpoint.
3483
- *
3484
- * BREAKING CHANGES (2025-11-30):
3485
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
3486
- * - Field renames: `id` -> `resourceId` (inherited)
3487
- * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
3488
- * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
3489
- * - New required field: `type: 'human'` (inherited) - resource type discriminator
3490
- *
3491
- * @example
3492
- * {
3493
- * resourceId: 'sales-approval',
3494
- * type: 'human',
3495
- * name: 'Sales Approval Queue',
3496
- * description: 'High-value order approvals for sales team',
3497
- * version: '1.0.0',
3498
- * status: 'prod',
3499
- * requestedBy: { agents: ['order-processor-agent'] },
3500
- * routesTo: { agents: ['order-fulfillment-agent'] }
3501
- * }
3502
- */
3503
- interface HumanCheckpointDefinition extends ResourceDefinition {
3504
- /** Resource type discriminator (narrowed from base union) */
3505
- type: 'human';
3506
- /** Resources that create tasks for this checkpoint */
3507
- requestedBy?: {
3508
- /** Agent resourceIds that request approval here */
3509
- agents?: string[];
3510
- /** Workflow resourceIds that request approval here */
3511
- workflows?: string[];
3512
- };
3513
- /** Resources that receive approved decisions */
3514
- routesTo?: {
3515
- /** Agent resourceIds that handle approved tasks */
3516
- agents?: string[];
3517
- /** Workflow resourceIds that handle approved tasks */
3518
- workflows?: string[];
3519
- };
3520
- }
3521
-
3522
- /**
3523
- * Command View Types
3524
- *
3525
- * Unified type definitions for the Command View graph visualization.
3526
- * These types are used by both backend serialization and frontend rendering.
3527
- *
3528
- * Command View shows the resource graph: agents, workflows, triggers, integrations,
3529
- * external resources, and human checkpoints with their relationships.
3530
- */
3531
-
3532
- /**
3533
- * Extended agent metadata for Command View
3534
- * Includes model and capability information for graph display
3535
- */
3536
- interface CommandViewAgent extends ResourceDefinition {
3537
- type: 'agent';
3538
- modelProvider: string;
3539
- modelId: string;
3540
- toolCount: number;
3541
- hasKnowledgeMap: boolean;
3542
- hasMemory: boolean;
3543
- sessionCapable: boolean;
3544
- }
3545
- /**
3546
- * Extended workflow metadata for Command View
3547
- * Includes step information for graph display
3548
- */
3549
- interface CommandViewWorkflow extends ResourceDefinition {
3550
- type: 'workflow';
3551
- stepCount: number;
3552
- entryPoint: string;
3553
- }
3554
- /**
3555
- * Relationship types between resources
3556
- *
3557
- * - triggers: Resource initiates/starts another resource (orange)
3558
- * - uses: Resource uses an integration (teal)
3559
- * - approval: Resource requires human approval (yellow)
3560
- */
3561
- type RelationshipType$1 = 'triggers' | 'uses' | 'approval';
3562
- /**
3563
- * Command View edge (relationship between resources)
3564
- */
3565
- interface CommandViewEdge$1 {
3642
+ interface NotificationDTO {
3566
3643
  id: string;
3567
- source: string;
3568
- target: string;
3569
- relationship: RelationshipType$1;
3570
- label?: string;
3571
- }
3572
- /**
3573
- * Command View data structure
3574
- * Complete graph data for visualization
3575
- *
3576
- * Backend serializes this once at startup and serves it via /command-view endpoint.
3577
- * Frontend consumes this directly for graph rendering.
3578
- */
3579
- interface CommandViewData {
3580
- workflows: CommandViewWorkflow[];
3581
- agents: CommandViewAgent[];
3582
- triggers: TriggerDefinition[];
3583
- integrations: IntegrationDefinition[];
3584
- externalResources: ExternalResourceDefinition[];
3585
- humanCheckpoints: HumanCheckpointDefinition[];
3586
- edges: CommandViewEdge$1[];
3587
- domainDefinitions?: DomainDefinition[];
3644
+ userId: string;
3645
+ organizationId: string;
3646
+ category: string;
3647
+ title: string;
3648
+ message: string;
3649
+ actionUrl: string | null;
3650
+ read: boolean;
3651
+ readAt: string | null;
3652
+ createdAt: string;
3588
3653
  }
3589
3654
 
3590
- /**
3591
- * Serialized Registry Types
3592
- *
3593
- * Pre-computed JSON-safe types for API responses and Command View.
3594
- * Serialization happens once at API startup, enabling instant response times.
3595
- */
3596
-
3597
- /**
3598
- * Serialized form field for API responses
3599
- */
3600
- interface SerializedFormField {
3601
- name: string;
3602
- label: string;
3603
- type: FormFieldType;
3604
- defaultValue?: unknown;
3605
- required?: boolean;
3606
- placeholder?: string;
3607
- description?: string;
3608
- options?: Array<{
3609
- label: string;
3610
- value: string | number;
3611
- }>;
3612
- min?: number;
3613
- max?: number;
3614
- }
3615
- /**
3616
- * Serialized form schema for API responses
3617
- */
3618
- interface SerializedFormSchema {
3619
- title?: string;
3620
- description?: string;
3621
- fields: SerializedFormField[];
3622
- layout?: 'vertical' | 'horizontal' | 'grid';
3623
- }
3624
- /**
3625
- * Serialized execution form schema for API responses
3626
- */
3627
- interface SerializedExecutionFormSchema extends SerializedFormSchema {
3628
- fieldMappings?: Record<string, string>;
3629
- submitButton?: {
3630
- label?: string;
3631
- loadingLabel?: string;
3632
- confirmMessage?: string;
3633
- };
3655
+ type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
3656
+ type ProjectUpdate = Database['public']['Tables']['prj_projects']['Update'];
3657
+ type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
3658
+ type MilestoneUpdate = Database['public']['Tables']['prj_milestones']['Update'];
3659
+ type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
3660
+ type TaskUpdate = Database['public']['Tables']['prj_tasks']['Update'];
3661
+ type ProjectStatus = 'active' | 'on_track' | 'at_risk' | 'blocked' | 'completed' | 'paused';
3662
+ type ProjectKind = 'client_engagement' | 'internal' | 'research' | 'other';
3663
+ type MilestoneStatus = 'upcoming' | 'in_progress' | 'completed' | 'overdue' | 'blocked';
3664
+ type TaskStatus = 'planned' | 'in_progress' | 'blocked' | 'completed' | 'cancelled' | 'submitted' | 'approved' | 'rejected' | 'revision_requested';
3665
+ type TaskType = 'documentation' | 'code' | 'report' | 'design' | 'other';
3666
+ type NoteType = 'call_note' | 'status_update' | 'issue' | 'blocker' | 'agent_learning';
3667
+ interface ProjectFilters {
3668
+ status?: ProjectStatus;
3669
+ kind?: ProjectKind;
3670
+ companyId?: string;
3671
+ search?: string;
3634
3672
  }
3635
- /**
3636
- * Serialized schedule config for API responses
3637
- */
3638
- interface SerializedScheduleConfig {
3639
- enabled: boolean;
3640
- defaultSchedule?: string;
3641
- allowedPatterns?: string[];
3673
+ interface MilestoneFilters {
3674
+ status?: MilestoneStatus;
3675
+ projectId?: string;
3642
3676
  }
3643
- /**
3644
- * Serialized webhook config for API responses
3645
- */
3646
- interface SerializedWebhookConfig {
3647
- enabled: boolean;
3648
- payloadSchema?: unknown;
3677
+ interface TaskFilters {
3678
+ status?: TaskStatus;
3679
+ type?: TaskType;
3680
+ milestoneId?: string;
3681
+ projectId?: string;
3649
3682
  }
3650
- /**
3651
- * Serialized execution interface for API responses
3652
- */
3653
- interface SerializedExecutionInterface {
3654
- form: SerializedExecutionFormSchema;
3655
- schedule?: SerializedScheduleConfig;
3656
- webhook?: SerializedWebhookConfig;
3683
+ interface NoteFilters {
3684
+ type?: NoteType;
3685
+ projectId?: string;
3657
3686
  }
3658
- /**
3659
- * Serialized agent definition (JSON-safe)
3660
- * Result of serializeDefinition(AgentDefinition)
3661
- */
3662
- interface SerializedAgentDefinition {
3663
- config: {
3664
- resourceId: string;
3665
- name: string;
3666
- description: string;
3667
- version: string;
3668
- type: 'agent';
3669
- status: 'dev' | 'prod';
3670
- /** Whether this resource is archived and should be excluded from registration and deployment */
3671
- archived?: boolean;
3672
- systemPrompt: string;
3673
- constraints?: {
3674
- maxIterations?: number;
3675
- timeout?: number;
3676
- maxSessionMemoryKeys?: number;
3677
- maxMemoryTokens?: number;
3678
- };
3679
- sessionCapable?: boolean;
3680
- memoryPreferences?: string;
3681
- };
3682
- modelConfig: {
3683
- provider: string;
3684
- model: string;
3685
- apiKey: string;
3686
- temperature: number;
3687
- maxOutputTokens: number;
3688
- topP?: number;
3689
- modelOptions?: Record<string, unknown>;
3690
- };
3691
- contract: {
3692
- inputSchema: object;
3693
- outputSchema?: object;
3694
- };
3695
- tools: Array<{
3696
- name: string;
3697
- description: string;
3698
- inputSchema?: object;
3699
- outputSchema?: object;
3700
- }>;
3701
- knowledgeMap?: {
3702
- nodeCount: number;
3703
- nodes: Array<{
3704
- id: string;
3705
- description: string;
3706
- loaded: boolean;
3707
- hasPrompt: boolean;
3708
- }>;
3709
- };
3710
- metricsConfig?: object;
3711
- interface?: SerializedExecutionInterface;
3687
+ interface ProjectWithCounts extends ProjectRow {
3688
+ milestoneCount: number;
3689
+ taskCount: number;
3690
+ completedMilestones?: number;
3691
+ completedTasks?: number;
3712
3692
  }
3713
- /**
3714
- * Serialized workflow definition (JSON-safe)
3715
- * Result of serializeDefinition(WorkflowDefinition)
3716
- */
3717
- interface SerializedWorkflowDefinition {
3718
- config: {
3719
- resourceId: string;
3720
- name: string;
3721
- description: string;
3722
- version: string;
3723
- type: 'workflow';
3724
- status: 'dev' | 'prod';
3725
- /** Whether this resource is archived and should be excluded from registration and deployment */
3726
- archived?: boolean;
3727
- };
3728
- entryPoint: string;
3729
- steps: Array<{
3693
+ interface ProjectDetail extends ProjectRow {
3694
+ milestones: MilestoneRow[];
3695
+ tasks: TaskRow[];
3696
+ company: {
3730
3697
  id: string;
3731
3698
  name: string;
3732
- description: string;
3733
- inputSchema?: object;
3734
- outputSchema?: object;
3735
- next: {
3736
- type: 'linear' | 'conditional';
3737
- target?: string;
3738
- routes?: Array<{
3739
- target: string;
3740
- }>;
3741
- default?: string;
3742
- } | null;
3743
- }>;
3744
- contract: {
3745
- inputSchema: object;
3746
- outputSchema?: object;
3747
- };
3748
- metricsConfig?: object;
3749
- interface?: SerializedExecutionInterface;
3699
+ domain: string | null;
3700
+ } | null;
3750
3701
  }
3751
3702
 
3752
- /**
3753
- * Base Execution Engine type definitions
3754
- * Core types shared across all Execution Engine resources
3755
- */
3703
+ declare const ListCompaniesQuerySchema: z.ZodObject<{
3704
+ search: z.ZodOptional<z.ZodString>;
3705
+ listId: z.ZodOptional<z.ZodString>;
3706
+ domain: z.ZodOptional<z.ZodString>;
3707
+ website: z.ZodOptional<z.ZodString>;
3708
+ segment: z.ZodOptional<z.ZodString>;
3709
+ category: z.ZodOptional<z.ZodString>;
3710
+ batchId: z.ZodOptional<z.ZodString>;
3711
+ status: z.ZodOptional<z.ZodEnum<{
3712
+ active: "active";
3713
+ invalid: "invalid";
3714
+ }>>;
3715
+ includeAll: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
3716
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3717
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3718
+ }, z.core.$strict>;
3719
+ declare const ListContactsQuerySchema: z.ZodObject<{
3720
+ search: z.ZodOptional<z.ZodString>;
3721
+ listId: z.ZodOptional<z.ZodString>;
3722
+ openingLineIsNull: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
3723
+ batchId: z.ZodOptional<z.ZodString>;
3724
+ contactStatus: z.ZodOptional<z.ZodEnum<{
3725
+ active: "active";
3726
+ invalid: "invalid";
3727
+ }>>;
3728
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3729
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3730
+ }, z.core.$strict>;
3731
+ declare const AcqCompanyResponseSchema: z.ZodObject<{
3732
+ id: z.ZodString;
3733
+ organizationId: z.ZodString;
3734
+ name: z.ZodString;
3735
+ domain: z.ZodNullable<z.ZodString>;
3736
+ linkedinUrl: z.ZodNullable<z.ZodString>;
3737
+ website: z.ZodNullable<z.ZodString>;
3738
+ numEmployees: z.ZodNullable<z.ZodNumber>;
3739
+ foundedYear: z.ZodNullable<z.ZodNumber>;
3740
+ locationCity: z.ZodNullable<z.ZodString>;
3741
+ locationState: z.ZodNullable<z.ZodString>;
3742
+ category: z.ZodNullable<z.ZodString>;
3743
+ categoryPain: z.ZodNullable<z.ZodString>;
3744
+ segment: z.ZodNullable<z.ZodString>;
3745
+ pipelineStatus: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3746
+ enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3747
+ source: z.ZodNullable<z.ZodString>;
3748
+ batchId: z.ZodNullable<z.ZodString>;
3749
+ status: z.ZodEnum<{
3750
+ active: "active";
3751
+ invalid: "invalid";
3752
+ }>;
3753
+ contactCount: z.ZodNumber;
3754
+ verticalResearch: z.ZodNullable<z.ZodString>;
3755
+ createdAt: z.ZodString;
3756
+ updatedAt: z.ZodString;
3757
+ }, z.core.$strip>;
3758
+ declare const AcqContactResponseSchema: z.ZodObject<{
3759
+ id: z.ZodString;
3760
+ organizationId: z.ZodString;
3761
+ companyId: z.ZodNullable<z.ZodString>;
3762
+ email: z.ZodString;
3763
+ emailValid: z.ZodNullable<z.ZodEnum<{
3764
+ VALID: "VALID";
3765
+ INVALID: "INVALID";
3766
+ RISKY: "RISKY";
3767
+ UNKNOWN: "UNKNOWN";
3768
+ }>>;
3769
+ firstName: z.ZodNullable<z.ZodString>;
3770
+ lastName: z.ZodNullable<z.ZodString>;
3771
+ linkedinUrl: z.ZodNullable<z.ZodString>;
3772
+ title: z.ZodNullable<z.ZodString>;
3773
+ headline: z.ZodNullable<z.ZodString>;
3774
+ filterReason: z.ZodNullable<z.ZodString>;
3775
+ openingLine: z.ZodNullable<z.ZodString>;
3776
+ source: z.ZodNullable<z.ZodString>;
3777
+ sourceId: z.ZodNullable<z.ZodString>;
3778
+ pipelineStatus: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3779
+ enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3780
+ attioPersonId: z.ZodNullable<z.ZodString>;
3781
+ batchId: z.ZodNullable<z.ZodString>;
3782
+ status: z.ZodEnum<{
3783
+ active: "active";
3784
+ invalid: "invalid";
3785
+ }>;
3786
+ company: z.ZodOptional<z.ZodNullable<z.ZodObject<{
3787
+ id: z.ZodString;
3788
+ name: z.ZodString;
3789
+ domain: z.ZodNullable<z.ZodString>;
3790
+ website: z.ZodNullable<z.ZodString>;
3791
+ linkedinUrl: z.ZodNullable<z.ZodString>;
3792
+ segment: z.ZodNullable<z.ZodString>;
3793
+ category: z.ZodNullable<z.ZodString>;
3794
+ status: z.ZodEnum<{
3795
+ active: "active";
3796
+ invalid: "invalid";
3797
+ }>;
3798
+ }, z.core.$strip>>>;
3799
+ createdAt: z.ZodString;
3800
+ updatedAt: z.ZodString;
3801
+ }, z.core.$strip>;
3802
+ type ListCompaniesQuery = z.infer<typeof ListCompaniesQuerySchema>;
3803
+ type ListContactsQuery = z.infer<typeof ListContactsQuerySchema>;
3804
+ type AcqCompanyResponse = z.infer<typeof AcqCompanyResponseSchema>;
3805
+ type AcqContactResponse = z.infer<typeof AcqContactResponseSchema>;
3756
3806
 
3807
+ type MessageType = MessageEvent['type'];
3757
3808
  /**
3758
- * Unified message event type - covers all message types in sessions
3759
- * Replaces separate SessionTurnMessages and AgentActivityEvent mechanisms
3760
- */
3761
- /**
3762
- * Structured action metadata attached to assistant messages.
3763
- * Frontend reads this instead of parsing text prefixes.
3764
- */
3765
- type AssistantAction = {
3766
- kind: 'navigate';
3767
- path: string;
3768
- reason: string;
3769
- } | {
3770
- kind: 'update_filters';
3771
- timeRange: string | null;
3772
- statusFilter: string | null;
3773
- searchQuery: string | null;
3774
- };
3775
- type MessageEvent = {
3776
- type: 'user_message';
3777
- text: string;
3778
- } | {
3779
- type: 'assistant_message';
3780
- text: string;
3781
- _action?: AssistantAction;
3782
- } | {
3783
- type: 'agent:started';
3784
- } | {
3785
- type: 'agent:completed';
3786
- } | {
3787
- type: 'agent:error';
3788
- error: string;
3789
- } | {
3790
- type: 'agent:reasoning';
3791
- iteration: number;
3792
- reasoning: string;
3793
- } | {
3794
- type: 'agent:tool_call';
3795
- toolName: string;
3796
- args: Record<string, unknown>;
3797
- } | {
3798
- type: 'agent:tool_result';
3799
- toolName: string;
3800
- success: boolean;
3801
- result?: unknown;
3802
- error?: string;
3803
- };
3804
- /**
3805
- * NOTE: AIResource interface has been removed and replaced with ResourceDefinition
3806
- * from registry/types.ts. All resources (executable and non-executable) now extend
3807
- * the unified ResourceDefinition base interface.
3808
- *
3809
- * AgentConfig and WorkflowConfig now extend ResourceDefinition directly.
3810
- * See packages/core/src/registry/types.ts for the base interface definition.
3809
+ * Session Data Transfer Object (DTO)
3810
+ * Transform type for API responses (snake_case DB → camelCase frontend)
3811
+ * Used by frontend apps to display session data
3811
3812
  */
3812
- type AIResourceDefinition = SerializedWorkflowDefinition | SerializedAgentDefinition;
3813
-
3814
- type SupabaseUserProfile = Tables<'users'>;
3815
- type SupabaseApiKey = Tables<'api_keys'>;
3816
- /** API response type for API key list items (omits sensitive key_hash) */
3817
- type ApiKeyListItem = Omit<SupabaseApiKey, 'key_hash'>;
3818
-
3819
- /** Raw database row type for acq_deals table */
3820
- type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
3821
- type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing';
3822
- interface DealContact {
3823
- id: string;
3824
- first_name: string | null;
3825
- last_name: string | null;
3826
- email: string;
3827
- title: string | null;
3828
- headline: string | null;
3829
- linkedin_url: string | null;
3830
- pipeline_status: Record<string, unknown> | null;
3831
- enrichment_data: Record<string, unknown> | null;
3832
- company: {
3833
- id: string;
3834
- name: string;
3835
- domain: string | null;
3836
- website: string | null;
3837
- linkedin_url: string | null;
3838
- segment: string | null;
3839
- category: string | null;
3840
- num_employees: number | null;
3841
- } | null;
3813
+ interface SessionDTO {
3814
+ sessionId: string;
3815
+ resourceId: string;
3816
+ organizationId: string;
3817
+ userId?: string | null;
3818
+ turnCount: number;
3819
+ isEnded: boolean;
3820
+ title?: string | null;
3821
+ memorySnapshot?: AgentMemory;
3822
+ metadata?: Record<string, unknown> | null;
3823
+ createdAt: Date;
3824
+ updatedAt: Date;
3825
+ endedAt?: Date | null;
3842
3826
  }
3843
- interface DealFilters {
3844
- stage?: DealStage;
3845
- search?: string;
3846
- limit?: number;
3847
- offset?: number;
3827
+ interface ChatMessage {
3828
+ id: string;
3829
+ role: 'user' | 'assistant';
3830
+ messageType: MessageType;
3831
+ text: string;
3832
+ metadata?: MessageEvent;
3833
+ turnNumber: number;
3834
+ messageIndex?: number;
3835
+ createdAt: Date;
3848
3836
  }
3849
- /** Deal list item with joined contact and company data */
3850
- interface DealListItem extends AcqDealRow {
3851
- contact: DealContact | null;
3837
+ /** Token usage data sent with turn:complete WebSocket events */
3838
+ interface SessionTokenUsage {
3839
+ /** Tokens consumed by this turn's input */
3840
+ turnInputTokens: number;
3841
+ /** Tokens generated by this turn's output */
3842
+ turnOutputTokens: number;
3843
+ /** Total tokens for this turn (turnInputTokens + turnOutputTokens) */
3844
+ turnTotalTokens: number;
3845
+ /** Cumulative input tokens across all turns in this session */
3846
+ cumulativeInputTokens: number;
3847
+ /** Cumulative output tokens across all turns in this session */
3848
+ cumulativeOutputTokens: number;
3849
+ /** The model's context window size for this session (e.g., 200K) */
3850
+ contextWindowSize: number;
3852
3851
  }
3853
- type DealDetail = DealListItem;
3854
- /** Task kind options for a deal task (human follow-up action type) */
3855
- type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
3852
+
3856
3853
  /**
3857
- * A CRM to-do item attached to a deal representing a human follow-up action.
3858
- * Transformed from AcqDealTaskRow with camelCase properties.
3854
+ * Multi-tenancy configuration types
3855
+ *
3856
+ * Config is stored in dedicated `config` columns (NOT nested in metadata):
3857
+ * - organizations.config: Org-level config (no feature toggles -- all features available by default)
3858
+ * - org_memberships.config: Per-user-per-org feature overrides
3859
+ * - users.config: User-global config
3859
3860
  */
3860
- interface AcqDealTask {
3861
- id: string;
3862
- organizationId: string;
3863
- dealId: string;
3864
- title: string;
3865
- description: string | null;
3866
- kind: AcqDealTaskKind;
3867
- dueAt: string | null;
3868
- assigneeUserId: string | null;
3869
- completedAt: string | null;
3870
- completedByUserId: string | null;
3871
- createdAt: string;
3872
- updatedAt: string;
3873
- createdByUserId: string | null;
3861
+ /**
3862
+ * Per-user-per-org config (stored in org_memberships.config)
3863
+ * Controls which features a specific member can access within their org.
3864
+ * Keys are feature IDs from the organization model (e.g. crm, lead-gen, projects, seo).
3865
+ */
3866
+ interface MembershipFeatureConfig {
3867
+ features?: Record<string, boolean>;
3874
3868
  }
3875
3869
  /**
3876
- * Live-scan aggregate telemetry for a single list, computed on demand from
3877
- * the list junction tables and current contact deliverability state.
3870
+ * User-global config (stored in users.config)
3871
+ * Theme and onboarding are user-specific, NOT org-specific
3878
3872
  */
3879
- interface ListTelemetry {
3880
- listId: string;
3881
- totalCompanies: number;
3882
- totalContacts: number;
3883
- stageCounts: {
3884
- populated: number;
3885
- extracted: number;
3886
- qualified: number;
3887
- discovered: number;
3888
- verified: number;
3889
- personalized: number;
3890
- uploaded: number;
3873
+ interface UserConfig {
3874
+ theme?: {
3875
+ preset?: 'default' | 'tactical' | 'regal' | 'cyber-volt' | 'aurora' | 'rose-gold' | 'midnight' | 'titanium' | 'obsidian' | 'honey' | 'abyss' | 'canopy' | 'slate' | 'cyber-strike' | 'cyber-chrome' | 'cyber-void' | 'nirvana' | 'wave' | 'synapse' | 'cortex' | 'helios' | 'graphite' | 'quarry' | 'canyon' | 'nord' | 'catppuccin' | 'tokyo-night' | 'gruvbox';
3876
+ colorScheme?: 'light' | 'dark' | 'auto';
3891
3877
  };
3892
- deliverability: {
3893
- valid: number;
3894
- risky: number;
3895
- invalid: number;
3896
- unknown: number;
3897
- bounced: number;
3878
+ onboarding?: {
3879
+ completed?: boolean;
3880
+ completedAt?: string;
3881
+ role?: string;
3882
+ primaryUseCase?: string[];
3883
+ experienceLevel?: string;
3884
+ /** Onboarding guide system state (set by checklist/tour system) */
3885
+ guides?: {
3886
+ completedIds?: string[];
3887
+ dismissed?: boolean;
3888
+ completedAt?: string;
3889
+ };
3898
3890
  };
3899
- /** Reserved -- active workflow IDs associated with this list. */
3900
- activeWorkflows?: string[];
3901
3891
  }
3902
3892
 
3903
3893
  /**
3904
- * Lead Service Types
3905
- * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
3894
+ * Memberships Domain - Zod Validation Schemas
3906
3895
  *
3907
- * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
3896
+ * Validation schemas for membership management endpoints.
3897
+ * Includes request bodies, query params, and path params.
3898
+ *
3899
+ * Security:
3900
+ * - All schemas use .strict() to prevent mass assignment attacks
3901
+ * - UUID validation prevents invalid references
3902
+ * - Role enum validation prevents privilege escalation
3903
+ * - organizationId never accepted in body (from JWT when needed)
3908
3904
  */
3909
3905
 
3910
- interface AcqDealNote {
3906
+ /**
3907
+ * Membership status validation
3908
+ * Note: Database constraint only allows 'active' | 'inactive'
3909
+ */
3910
+ declare const MembershipStatusSchema: z.ZodEnum<{
3911
+ active: "active";
3912
+ inactive: "inactive";
3913
+ }>;
3914
+ type MembershipStatus = z.infer<typeof MembershipStatusSchema>;
3915
+
3916
+ /**
3917
+ * Organization Membership types based on WorkOS API
3918
+ */
3919
+ interface OrganizationMembership {
3920
+ object: 'organization_membership';
3911
3921
  id: string;
3912
- dealId: string;
3922
+ userId: string;
3913
3923
  organizationId: string;
3914
- authorUserId: string | null;
3915
- body: string;
3924
+ role: {
3925
+ slug: string;
3926
+ };
3927
+ status: 'active' | 'inactive';
3916
3928
  createdAt: string;
3917
3929
  updatedAt: string;
3918
3930
  }
3919
-
3920
3931
  /**
3921
- * Action configuration for HITL tasks
3922
- * Defines available user actions and their behavior
3932
+ * Request interfaces for membership operations
3923
3933
  */
3924
- interface ActionConfig {
3925
- /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
3926
- id: string;
3927
- /** Display label for UI button */
3928
- label: string;
3929
- /** Button variant/style */
3930
- type: 'primary' | 'secondary' | 'danger' | 'outline';
3931
- /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
3932
- icon?: string;
3933
- /** Button color (Mantine theme colors) */
3934
- color?: string;
3935
- /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
3936
- variant?: string;
3937
- /** Execution target (agent/workflow to invoke) */
3938
- target?: {
3939
- resourceType: 'agent' | 'workflow';
3940
- resourceId: string;
3941
- /**
3942
- * Optional session ID for agent continuation.
3943
- * If provided, invokes a new turn on the existing session instead of standalone execution.
3944
- * Only valid when resourceType is 'agent'.
3945
- */
3946
- sessionId?: string;
3947
- };
3948
- /** Form schema for collecting action-specific data */
3949
- form?: FormSchema;
3950
- /** Payload template for pre-filling forms */
3951
- payloadTemplate?: unknown;
3952
- /** Requires confirmation dialog */
3953
- requiresConfirmation?: boolean;
3954
- /** Confirmation message */
3955
- confirmationMessage?: string;
3956
- /** Help text / tooltip */
3957
- description?: string;
3934
+ interface CreateMembershipRequest {
3935
+ userId: string;
3936
+ organizationId: string;
3937
+ roleSlug?: string;
3938
+ }
3939
+ interface UpdateMembershipRequest {
3940
+ roleSlug: string;
3941
+ }
3942
+ interface ListMembershipsParams {
3943
+ userId?: string;
3944
+ organizationId?: string;
3945
+ statuses?: MembershipStatus[];
3946
+ limit?: number;
3947
+ before?: string;
3948
+ after?: string;
3949
+ order?: 'asc' | 'desc';
3958
3950
  }
3959
-
3960
3951
  /**
3961
- * Origin resource type - where an execution/task originated from.
3962
- * Used for audit trails and tracking execution lineage.
3952
+ * Response interfaces
3963
3953
  */
3964
- type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
3954
+ interface ListMembershipsResponse {
3955
+ data: OrganizationMembership[];
3956
+ listMetadata?: {
3957
+ before?: string | null;
3958
+ after?: string | null;
3959
+ };
3960
+ }
3965
3961
  /**
3966
- * Origin tracking metadata - who/what created this execution/task.
3967
- * Used by both TaskScheduler and CommandQueue for complete audit trails.
3962
+ * Extended membership with user and organization details for UI
3968
3963
  */
3969
- interface OriginTracking {
3970
- originExecutionId: string;
3971
- originResourceType: OriginResourceType;
3972
- originResourceId: string;
3964
+ interface MembershipWithDetails extends OrganizationMembership {
3965
+ user?: {
3966
+ id: string;
3967
+ email: string;
3968
+ firstName?: string;
3969
+ lastName?: string;
3970
+ profilePictureUrl?: string;
3971
+ };
3972
+ organization?: {
3973
+ id: string;
3974
+ name: string;
3975
+ workos_org_id: string;
3976
+ primaryDomain?: string;
3977
+ is_test?: boolean;
3978
+ status?: string;
3979
+ metadata?: Record<string, unknown>;
3980
+ config?: Record<string, unknown>;
3981
+ };
3982
+ config?: MembershipFeatureConfig;
3973
3983
  }
3974
3984
 
3975
3985
  /**
3976
- * Command queue task with flexible action system
3986
+ * Time range selector for dashboard metrics
3977
3987
  */
3978
- interface Task extends OriginTracking {
3979
- id: string;
3980
- organizationId: string;
3981
- actions: ActionConfig[];
3982
- context: unknown;
3983
- selectedAction?: string;
3984
- actionPayload?: unknown;
3985
- description?: string;
3986
- priority: number;
3987
- /** Optional checkpoint identifier for grouping related human approval tasks */
3988
- humanCheckpoint?: string;
3989
- status: QueueTaskStatus;
3990
- /**
3991
- * Target resource tracking — mirrors origin columns.
3992
- * Set when task is created; patchable to redirect execution to a different resource.
3993
- */
3994
- targetResourceId?: string;
3995
- targetResourceType?: 'agent' | 'workflow';
3996
- /**
3997
- * Execution ID for the action that runs AFTER user approval.
3998
- * NULL until execution starts.
3999
- *
4000
- * Naming distinction:
4001
- * - originExecutionId = Parent execution that CREATED the HITL task
4002
- * - targetExecutionId = Child execution that RUNS AFTER user approval
4003
- */
4004
- targetExecutionId?: string;
4005
- createdAt: Date;
4006
- completedAt?: Date;
4007
- completedBy?: string;
4008
- expiresAt?: Date;
4009
- idempotencyKey?: string | null;
3988
+ type TimeRange = '1h' | '24h' | '7d' | '30d';
3989
+ /**
3990
+ * Execution health metrics response
3991
+ * Success rate, P95 duration, execution counts, and trend data
3992
+ * trendData includes executionCount for throughput visualization (eliminates separate API call)
3993
+ */
3994
+ interface ExecutionHealthMetrics {
3995
+ successRate: number;
3996
+ p95Duration: number;
3997
+ totalExecutions: number;
3998
+ trendData: Array<{
3999
+ time: string;
4000
+ rate: number;
4001
+ successCount: number;
4002
+ errorCount: number;
4003
+ warningCount: number;
4004
+ executionCount: number;
4005
+ }>;
4006
+ statusCounts: {
4007
+ success: number;
4008
+ failed: number;
4009
+ pending: number;
4010
+ warning: number;
4011
+ };
4012
+ peakPeriod: string;
4013
+ granularity: 'hour' | 'day';
4010
4014
  }
4011
4015
  /**
4012
- * Task status values
4013
- * - pending: awaiting action
4014
- * - processing: execution in progress after user approval
4015
- * - completed: action was taken and execution succeeded
4016
- * - failed: execution failed, task can be retried
4017
- * - expired: timed out before action
4016
+ * Error analysis metrics response
4017
+ * Error categories and top failing resources
4018
4018
  */
4019
- type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
4019
+ interface ErrorAnalysisMetrics {
4020
+ totalErrors: number;
4021
+ errorsByCategory: Array<{
4022
+ category: string;
4023
+ count: number;
4024
+ percentage: number;
4025
+ }>;
4026
+ topFailingResources: Array<{
4027
+ resourceId: string;
4028
+ name: string;
4029
+ errorCount: number;
4030
+ failureRate: number;
4031
+ }>;
4032
+ }
4020
4033
  /**
4021
- * Parameters for patching mutable metadata on a task
4034
+ * Business impact metrics response
4035
+ * ROI, labor savings, and cost analysis
4022
4036
  */
4023
- interface PatchTaskParams {
4024
- humanCheckpoint?: string | null;
4025
- description?: string;
4026
- priority?: number;
4027
- context?: Record<string, unknown>;
4028
- actions?: unknown[];
4029
- targetResourceId?: string | null;
4030
- targetResourceType?: 'agent' | 'workflow' | null;
4031
- targetExecutionId?: string;
4032
- status?: 'pending' | 'failed' | 'completed';
4037
+ interface BusinessImpactMetrics$1 {
4038
+ totalSavingsUsd: number;
4039
+ totalCostUsd: number;
4040
+ netSavingsUsd: number;
4041
+ roi: number;
4033
4042
  }
4034
- interface CommandQueueListResponse {
4035
- tasks: Task[];
4036
- total: number;
4043
+ /**
4044
+ * Cost breakdown metrics response
4045
+ * Per-resource cost analysis
4046
+ */
4047
+ interface CostBreakdownMetrics {
4048
+ resources: Array<{
4049
+ resourceId: string;
4050
+ totalCostUsd: number;
4051
+ executionCount: number;
4052
+ avgCostUsd: number;
4053
+ }>;
4037
4054
  }
4038
-
4039
4055
  /**
4040
- * Checkpoint list item for sidebar grouping
4041
- * The id field contains the resourceId of the human checkpoint
4056
+ * Dashboard metrics response
4057
+ * Aggregates core observability metrics in a single response
4058
+ * Note: Throughput data is now included in executionHealth.trendData.executionCount
4042
4059
  */
4043
- interface CheckpointListItem {
4044
- /** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
4045
- id: string;
4046
- /** Display name (same as id, or "Ungrouped" for null) */
4047
- name: string;
4048
- /** Task count for this checkpoint */
4049
- count: number;
4060
+ interface DashboardMetrics {
4061
+ executionHealth: ExecutionHealthMetrics;
4062
+ costBreakdown: CostBreakdownMetrics;
4063
+ businessImpact: BusinessImpactMetrics$1;
4064
+ /** ISO timestamp of the currently active deployment, or null if none */
4065
+ activeDeploymentDate: string | null;
4066
+ /** Deployment version of the active deployment, or null if none */
4067
+ activeDeploymentVersion: string | null;
4050
4068
  }
4051
4069
  /**
4052
- * Status counts for pie chart display
4070
+ * Error record for list view (ErrorBreakdownTable)
4053
4071
  */
4054
- interface StatusCounts {
4055
- pending: number;
4056
- completed: number;
4057
- expired: number;
4072
+ interface ErrorRecord {
4073
+ id: string;
4074
+ timestamp: string;
4075
+ errorType: string;
4076
+ message: string;
4077
+ executionId: string;
4078
+ resourceId: string;
4079
+ resourceName: string;
4080
+ severity: 'critical' | 'warning' | 'info';
4081
+ category: ExecutionErrorCategory;
4082
+ resolved: boolean;
4083
+ resolvedAt: string | null;
4084
+ resolvedBy: string | null;
4058
4085
  }
4059
4086
  /**
4060
- * Priority counts for donut chart display
4087
+ * Full error detail for modal view (ErrorDetailsModal)
4061
4088
  */
4062
- interface PriorityCounts {
4063
- critical: number;
4064
- high: number;
4065
- medium: number;
4066
- low: number;
4089
+ interface ErrorDetailFull extends ErrorRecord {
4090
+ stackTrace?: string;
4091
+ retryAttempt?: number;
4092
+ stepName?: string;
4093
+ stepSequence?: number;
4094
+ errorContext?: Record<string, unknown>;
4095
+ executionContext?: Record<string, unknown>;
4067
4096
  }
4068
4097
  /**
4069
- * Response from GET /command-queue/checkpoints endpoint
4098
+ * Error details API response (paginated)
4070
4099
  */
4071
- interface CheckpointListResponse {
4072
- checkpoints: CheckpointListItem[];
4073
- /** Total tasks across all checkpoints */
4100
+ interface ErrorDetailResponse {
4101
+ errors: ErrorRecord[];
4074
4102
  total: number;
4075
- /** Breakdown by status for donut chart */
4076
- statusCounts: StatusCounts;
4077
- /** Breakdown by priority for donut chart */
4078
- priorityCounts: PriorityCounts;
4103
+ page: number;
4104
+ limit: number;
4079
4105
  }
4080
-
4081
4106
  /**
4082
- * Target for schedule execution - identifies what resource to execute.
4083
- * Unlike ExecutionTarget, payload is NOT included here because schedules
4084
- * store payload in the scheduleConfig (varies per step/item).
4107
+ * Error trend data for time-series charts
4085
4108
  */
4086
- interface ScheduleTarget {
4087
- resourceType: 'agent' | 'workflow';
4088
- resourceId: string;
4109
+ interface ErrorTrend {
4110
+ time: string;
4111
+ errorCount: number;
4112
+ criticalCount: number;
4113
+ warningCount: number;
4114
+ infoCount: number;
4089
4115
  }
4090
4116
  /**
4091
- * Optional origin tracking for schedules.
4092
- * Unlike OriginTracking (which is required), these fields are all optional
4093
- * for schedules created directly via API (not triggered by another resource).
4117
+ * Summary of executions for a single resource
4118
+ * Used by RecentExecutionsByResource dashboard component
4094
4119
  */
4095
- interface ScheduleOriginTracking {
4096
- originExecutionId?: string;
4097
- originResourceType?: OriginResourceType;
4098
- originResourceId?: string;
4099
- }
4100
- type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
4101
- interface RecurringScheduleConfig {
4102
- type: 'recurring';
4103
- cron?: string;
4104
- interval?: 'daily' | 'weekly' | 'monthly';
4105
- time?: string;
4106
- timezone: string;
4107
- payload: Record<string, unknown>;
4108
- endAt?: string | null;
4109
- overduePolicy?: 'skip' | 'execute';
4110
- }
4111
- interface RelativeScheduleConfig {
4112
- type: 'relative';
4113
- anchorAt: string;
4114
- anchorLabel?: string;
4115
- items: RelativeScheduleItem[];
4116
- overduePolicy?: 'skip' | 'execute';
4117
- }
4118
- interface RelativeScheduleItem {
4119
- offset: string;
4120
- payload: Record<string, unknown>;
4121
- label?: string;
4120
+ interface ResourceExecutionSummary {
4121
+ resourceId: string;
4122
+ resourceType: string;
4123
+ resourceName: string | null;
4124
+ lastExecution: string;
4125
+ totalExecutions: number;
4126
+ successCount: number;
4127
+ failureCount: number;
4128
+ warningCount: number;
4129
+ successRate: number;
4122
4130
  }
4123
- interface AbsoluteScheduleConfig {
4124
- type: 'absolute';
4125
- items: AbsoluteScheduleItem[];
4126
- overduePolicy?: 'skip' | 'execute';
4131
+ /**
4132
+ * Response from getRecentExecutionsByResource endpoint
4133
+ */
4134
+ interface RecentExecutionsByResourceResponse {
4135
+ resources: ResourceExecutionSummary[];
4127
4136
  }
4128
- interface AbsoluteScheduleItem {
4129
- runAt: string;
4130
- payload: Record<string, unknown>;
4131
- label?: string;
4137
+ /** Resource identifier for health queries */
4138
+ interface ResourceIdentifier {
4139
+ entityType: string;
4140
+ entityId: string;
4132
4141
  }
4133
- interface TaskSchedule extends ScheduleOriginTracking {
4134
- id: string;
4135
- organizationId: string;
4136
- name: string;
4137
- description?: string;
4138
- target: ScheduleTarget;
4139
- scheduleConfig: TaskScheduleConfig;
4140
- nextRunAt?: Date;
4141
- currentStep: number;
4142
- status: 'active' | 'paused' | 'completed' | 'cancelled';
4143
- lastRunAt?: Date;
4144
- lastExecutionId?: string;
4145
- maxRetries: number;
4146
- idempotencyKey?: string;
4147
- createdAt: Date;
4148
- updatedAt: Date;
4142
+ /** Time-bucketed health data point */
4143
+ interface ResourceHealthDataPoint {
4144
+ time: string;
4145
+ success: number;
4146
+ failure: number;
4147
+ warning: number;
4148
+ rate: number;
4149
4149
  }
4150
-
4151
- /**
4152
- * Wire-format DTO for notification API responses.
4153
- * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
4154
- * Used by frontend hooks that consume /api/notifications.
4155
- */
4156
- interface NotificationDTO {
4157
- id: string;
4158
- userId: string;
4159
- organizationId: string;
4160
- category: string;
4161
- title: string;
4162
- message: string;
4163
- actionUrl: string | null;
4164
- read: boolean;
4165
- readAt: string | null;
4166
- createdAt: string;
4150
+ /** Health data for a single resource */
4151
+ interface ResourceHealth {
4152
+ entityType: string;
4153
+ entityId: string;
4154
+ entityName: string | null;
4155
+ trendData: ResourceHealthDataPoint[];
4156
+ summary: {
4157
+ total: number;
4158
+ successRate: number;
4159
+ };
4167
4160
  }
4168
-
4169
- type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
4170
- type ProjectUpdate = Database['public']['Tables']['prj_projects']['Update'];
4171
- type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
4172
- type MilestoneUpdate = Database['public']['Tables']['prj_milestones']['Update'];
4173
- type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
4174
- type TaskUpdate = Database['public']['Tables']['prj_tasks']['Update'];
4175
- type ProjectStatus = 'active' | 'on_track' | 'at_risk' | 'blocked' | 'completed' | 'paused';
4176
- type ProjectKind = 'client_engagement' | 'internal' | 'research' | 'other';
4177
- type MilestoneStatus = 'upcoming' | 'in_progress' | 'completed' | 'overdue' | 'blocked';
4178
- type TaskStatus = 'planned' | 'in_progress' | 'blocked' | 'completed' | 'cancelled' | 'submitted' | 'approved' | 'rejected' | 'revision_requested';
4179
- type TaskType = 'documentation' | 'code' | 'report' | 'design' | 'other';
4180
- type NoteType = 'call_note' | 'status_update' | 'issue' | 'blocker' | 'agent_learning';
4181
- interface ProjectFilters {
4182
- status?: ProjectStatus;
4183
- kind?: ProjectKind;
4184
- companyId?: string;
4185
- search?: string;
4161
+ /** Batch response with all requested resources */
4162
+ interface ResourcesHealthResponse {
4163
+ resources: ResourceHealth[];
4186
4164
  }
4187
- interface MilestoneFilters {
4188
- status?: MilestoneStatus;
4189
- projectId?: string;
4165
+ /**
4166
+ * Cost trend data point for time-series charts
4167
+ * Represents a single time bucket (hour or day)
4168
+ */
4169
+ interface CostTrendDataPoint {
4170
+ time: string;
4171
+ totalCostUsd: number;
4172
+ executionCount: number;
4173
+ avgCostPerExecution: number;
4190
4174
  }
4191
- interface TaskFilters {
4192
- status?: TaskStatus;
4193
- type?: TaskType;
4194
- milestoneId?: string;
4195
- projectId?: string;
4175
+ /**
4176
+ * Cost trends response (time-series data)
4177
+ */
4178
+ interface CostTrendsResponse {
4179
+ trendData: CostTrendDataPoint[];
4180
+ granularity: 'hour' | 'day';
4181
+ totalCostUsd: number;
4182
+ totalExecutions: number;
4196
4183
  }
4197
- interface NoteFilters {
4198
- type?: NoteType;
4199
- projectId?: string;
4184
+ /**
4185
+ * Cost summary response with MTD and projections
4186
+ */
4187
+ interface CostSummaryResponse {
4188
+ current: {
4189
+ totalCostUsd: number;
4190
+ executionCount: number;
4191
+ };
4192
+ previous: {
4193
+ totalCostUsd: number;
4194
+ executionCount: number;
4195
+ };
4196
+ mtd: {
4197
+ totalCostUsd: number;
4198
+ daysElapsed: number;
4199
+ };
4200
+ projection: {
4201
+ monthlyCostUsd: number;
4202
+ confidence: 'low' | 'medium' | 'high';
4203
+ };
4204
+ trend: {
4205
+ changePercent: number;
4206
+ direction: 'up' | 'down' | 'flat';
4207
+ };
4200
4208
  }
4201
- interface ProjectWithCounts extends ProjectRow {
4202
- milestoneCount: number;
4203
- taskCount: number;
4204
- completedMilestones?: number;
4205
- completedTasks?: number;
4209
+ /**
4210
+ * Cost by model data for model-level breakdown
4211
+ */
4212
+ interface CostByModelData {
4213
+ model: string;
4214
+ totalCostUsd: number;
4215
+ callCount: number;
4216
+ totalInputTokens: number;
4217
+ totalOutputTokens: number;
4218
+ avgCostPerCall: number;
4206
4219
  }
4207
- interface ProjectDetail extends ProjectRow {
4208
- milestones: MilestoneRow[];
4209
- tasks: TaskRow[];
4210
- company: {
4211
- id: string;
4212
- name: string;
4213
- domain: string | null;
4214
- } | null;
4220
+ /**
4221
+ * Cost by model response
4222
+ */
4223
+ interface CostByModelResponse {
4224
+ models: CostByModelData[];
4225
+ totalCostUsd: number;
4226
+ totalCallCount: number;
4215
4227
  }
4216
4228
 
4217
- declare const ListCompaniesQuerySchema: z.ZodObject<{
4218
- search: z.ZodOptional<z.ZodString>;
4219
- listId: z.ZodOptional<z.ZodString>;
4220
- domain: z.ZodOptional<z.ZodString>;
4221
- website: z.ZodOptional<z.ZodString>;
4222
- segment: z.ZodOptional<z.ZodString>;
4223
- category: z.ZodOptional<z.ZodString>;
4224
- batchId: z.ZodOptional<z.ZodString>;
4225
- status: z.ZodOptional<z.ZodEnum<{
4226
- active: "active";
4227
- invalid: "invalid";
4228
- }>>;
4229
- includeAll: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
4230
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4231
- offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4232
- }, z.core.$strict>;
4233
- declare const ListContactsQuerySchema: z.ZodObject<{
4234
- search: z.ZodOptional<z.ZodString>;
4235
- listId: z.ZodOptional<z.ZodString>;
4236
- openingLineIsNull: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
4237
- batchId: z.ZodOptional<z.ZodString>;
4238
- contactStatus: z.ZodOptional<z.ZodEnum<{
4239
- active: "active";
4240
- invalid: "invalid";
4241
- }>>;
4242
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4243
- offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4244
- }, z.core.$strict>;
4245
- declare const AcqCompanyResponseSchema: z.ZodObject<{
4246
- id: z.ZodString;
4247
- organizationId: z.ZodString;
4248
- name: z.ZodString;
4249
- domain: z.ZodNullable<z.ZodString>;
4250
- linkedinUrl: z.ZodNullable<z.ZodString>;
4251
- website: z.ZodNullable<z.ZodString>;
4252
- numEmployees: z.ZodNullable<z.ZodNumber>;
4253
- foundedYear: z.ZodNullable<z.ZodNumber>;
4254
- locationCity: z.ZodNullable<z.ZodString>;
4255
- locationState: z.ZodNullable<z.ZodString>;
4256
- category: z.ZodNullable<z.ZodString>;
4257
- categoryPain: z.ZodNullable<z.ZodString>;
4258
- segment: z.ZodNullable<z.ZodString>;
4259
- pipelineStatus: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4260
- enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4261
- source: z.ZodNullable<z.ZodString>;
4262
- batchId: z.ZodNullable<z.ZodString>;
4263
- status: z.ZodEnum<{
4264
- active: "active";
4265
- invalid: "invalid";
4266
- }>;
4267
- contactCount: z.ZodNumber;
4268
- verticalResearch: z.ZodNullable<z.ZodString>;
4269
- createdAt: z.ZodString;
4270
- updatedAt: z.ZodString;
4271
- }, z.core.$strip>;
4272
- declare const AcqContactResponseSchema: z.ZodObject<{
4273
- id: z.ZodString;
4274
- organizationId: z.ZodString;
4275
- companyId: z.ZodNullable<z.ZodString>;
4276
- email: z.ZodString;
4277
- emailValid: z.ZodNullable<z.ZodEnum<{
4278
- VALID: "VALID";
4279
- INVALID: "INVALID";
4280
- RISKY: "RISKY";
4281
- UNKNOWN: "UNKNOWN";
4282
- }>>;
4283
- firstName: z.ZodNullable<z.ZodString>;
4284
- lastName: z.ZodNullable<z.ZodString>;
4285
- linkedinUrl: z.ZodNullable<z.ZodString>;
4286
- title: z.ZodNullable<z.ZodString>;
4287
- headline: z.ZodNullable<z.ZodString>;
4288
- filterReason: z.ZodNullable<z.ZodString>;
4289
- openingLine: z.ZodNullable<z.ZodString>;
4290
- source: z.ZodNullable<z.ZodString>;
4291
- sourceId: z.ZodNullable<z.ZodString>;
4292
- pipelineStatus: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4293
- enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4294
- attioPersonId: z.ZodNullable<z.ZodString>;
4295
- batchId: z.ZodNullable<z.ZodString>;
4296
- status: z.ZodEnum<{
4297
- active: "active";
4298
- invalid: "invalid";
4299
- }>;
4300
- company: z.ZodOptional<z.ZodNullable<z.ZodObject<{
4301
- id: z.ZodString;
4302
- name: z.ZodString;
4303
- domain: z.ZodNullable<z.ZodString>;
4304
- website: z.ZodNullable<z.ZodString>;
4305
- linkedinUrl: z.ZodNullable<z.ZodString>;
4306
- segment: z.ZodNullable<z.ZodString>;
4307
- category: z.ZodNullable<z.ZodString>;
4308
- status: z.ZodEnum<{
4309
- active: "active";
4310
- invalid: "invalid";
4311
- }>;
4312
- }, z.core.$strip>>>;
4313
- createdAt: z.ZodString;
4314
- updatedAt: z.ZodString;
4315
- }, z.core.$strip>;
4316
- type ListCompaniesQuery = z.infer<typeof ListCompaniesQuerySchema>;
4317
- type ListContactsQuery = z.infer<typeof ListContactsQuerySchema>;
4318
- type AcqCompanyResponse = z.infer<typeof AcqCompanyResponseSchema>;
4319
- type AcqContactResponse = z.infer<typeof AcqContactResponseSchema>;
4229
+ /**
4230
+ * Base Execution Engine type definitions
4231
+ * Core types shared across all Execution Engine resources
4232
+ */
4233
+
4234
+ /**
4235
+ * Unified message event type - covers all message types in sessions
4236
+ * Replaces separate SessionTurnMessages and AgentActivityEvent mechanisms
4237
+ */
4238
+ /**
4239
+ * Structured action metadata attached to assistant messages.
4240
+ * Frontend reads this instead of parsing text prefixes.
4241
+ */
4242
+ type AssistantAction = {
4243
+ kind: 'navigate';
4244
+ path: string;
4245
+ reason: string;
4246
+ } | {
4247
+ kind: 'update_filters';
4248
+ timeRange: string | null;
4249
+ statusFilter: string | null;
4250
+ searchQuery: string | null;
4251
+ };
4252
+ type MessageEvent = {
4253
+ type: 'user_message';
4254
+ text: string;
4255
+ } | {
4256
+ type: 'assistant_message';
4257
+ text: string;
4258
+ _action?: AssistantAction;
4259
+ } | {
4260
+ type: 'agent:started';
4261
+ } | {
4262
+ type: 'agent:completed';
4263
+ } | {
4264
+ type: 'agent:error';
4265
+ error: string;
4266
+ } | {
4267
+ type: 'agent:reasoning';
4268
+ iteration: number;
4269
+ reasoning: string;
4270
+ } | {
4271
+ type: 'agent:tool_call';
4272
+ toolName: string;
4273
+ args: Record<string, unknown>;
4274
+ } | {
4275
+ type: 'agent:tool_result';
4276
+ toolName: string;
4277
+ success: boolean;
4278
+ result?: unknown;
4279
+ error?: string;
4280
+ };
4281
+ /**
4282
+ * NOTE: AIResource interface has been removed and replaced with ResourceDefinition
4283
+ * from registry/types.ts. All resources (executable and non-executable) now extend
4284
+ * the unified ResourceDefinition base interface.
4285
+ *
4286
+ * AgentConfig and WorkflowConfig now extend ResourceDefinition directly.
4287
+ * See packages/core/src/registry/types.ts for the base interface definition.
4288
+ */
4289
+ type AIResourceDefinition = SerializedWorkflowDefinition | SerializedAgentDefinition;
4320
4290
 
4321
- type MessageType = MessageEvent['type'];
4322
4291
  /**
4323
- * Session Data Transfer Object (DTO)
4324
- * Transform type for API responses (snake_case DB → camelCase frontend)
4325
- * Used by frontend apps to display session data
4292
+ * Supported integration types
4293
+ *
4294
+ * These represent the available integration adapters that can be used with tools.
4295
+ * Each integration type corresponds to an adapter implementation.
4296
+ *
4297
+ * Note: Concrete adapter implementations are deferred until needed.
4298
+ * This type provides compile-time safety and auto-completion for tool definitions.
4326
4299
  */
4327
- interface SessionDTO {
4328
- sessionId: string;
4300
+ type IntegrationType = 'gmail' | 'google-sheets' | 'slack' | 'github' | 'linear' | 'attio' | 'airtable' | 'salesforce' | 'hubspot' | 'stripe' | 'twilio' | 'sendgrid' | 'mailgun' | 'zapier' | 'webhook' | 'apify' | 'instantly' | 'resend' | 'signature-api' | 'dropbox' | 'anymailfinder' | 'tomba' | 'millionverifier';
4301
+
4302
+ /**
4303
+ * Resource Registry type definitions
4304
+ */
4305
+
4306
+ /**
4307
+ * Environment/deployment status for resources
4308
+ */
4309
+ type ResourceStatus = 'dev' | 'prod';
4310
+ /**
4311
+ * All resource types in the platform
4312
+ * Used as the discriminator field in ResourceDefinition
4313
+ */
4314
+ type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
4315
+ /**
4316
+ * Base interface for ALL platform resources
4317
+ * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
4318
+ */
4319
+ interface ResourceDefinition {
4320
+ /** Unique resource identifier */
4329
4321
  resourceId: string;
4330
- organizationId: string;
4331
- userId?: string | null;
4332
- turnCount: number;
4333
- isEnded: boolean;
4334
- title?: string | null;
4335
- memorySnapshot?: AgentMemory;
4336
- metadata?: Record<string, unknown> | null;
4337
- createdAt: Date;
4338
- updatedAt: Date;
4339
- endedAt?: Date | null;
4322
+ /** Display name */
4323
+ name: string;
4324
+ /** Purpose and functionality description */
4325
+ description: string;
4326
+ /** Version for change tracking and evolution */
4327
+ version: string;
4328
+ /** Resource type discriminator */
4329
+ type: ResourceType;
4330
+ /** Environment/deployment status */
4331
+ status: ResourceStatus;
4332
+ /** Graph links to Organization Model nodes */
4333
+ links?: ResourceLink[];
4334
+ /** Infrastructure category for filtering */
4335
+ category?: ResourceCategory;
4336
+ /** Whether the agent supports multi-turn sessions (agents only) */
4337
+ sessionCapable?: boolean;
4338
+ /** Whether the resource is local (monorepo) or remote (externally deployed) */
4339
+ origin?: 'local' | 'remote';
4340
+ /** Whether this resource is archived and should be excluded from registration and deployment */
4341
+ archived?: boolean;
4340
4342
  }
4341
- interface ChatMessage {
4342
- id: string;
4343
- role: 'user' | 'assistant';
4344
- messageType: MessageType;
4345
- text: string;
4346
- metadata?: MessageEvent;
4347
- turnNumber: number;
4348
- messageIndex?: number;
4349
- createdAt: Date;
4343
+ /** Webhook provider identifiers */
4344
+ type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test';
4345
+ /** Webhook trigger configuration */
4346
+ interface WebhookTriggerConfig {
4347
+ /** Provider identifier */
4348
+ provider: WebhookProviderType;
4349
+ /** Event type for documentation (not used for matching - workflow handles routing) */
4350
+ event?: string;
4351
+ /** Optional filtering (e.g., specific form ID for Fillout) */
4352
+ filter?: Record<string, string>;
4353
+ /** References credential in credentials table for per-org webhook secrets */
4354
+ credentialName?: string;
4350
4355
  }
4351
- /** Token usage data sent with turn:complete WebSocket events */
4352
- interface SessionTokenUsage {
4353
- /** Tokens consumed by this turn's input */
4354
- turnInputTokens: number;
4355
- /** Tokens generated by this turn's output */
4356
- turnOutputTokens: number;
4357
- /** Total tokens for this turn (turnInputTokens + turnOutputTokens) */
4358
- turnTotalTokens: number;
4359
- /** Cumulative input tokens across all turns in this session */
4360
- cumulativeInputTokens: number;
4361
- /** Cumulative output tokens across all turns in this session */
4362
- cumulativeOutputTokens: number;
4363
- /** The model's context window size for this session (e.g., 200K) */
4364
- contextWindowSize: number;
4356
+ /** Schedule trigger configuration */
4357
+ interface ScheduleTriggerConfig {
4358
+ /** Cron expression (e.g., '0 6 * * *') */
4359
+ cron: string;
4360
+ /** Optional timezone (default: UTC) */
4361
+ timezone?: string;
4365
4362
  }
4366
-
4363
+ /** Event trigger configuration */
4364
+ interface EventTriggerConfig {
4365
+ /** Internal event type */
4366
+ eventType: string;
4367
+ /** Event source */
4368
+ source?: string;
4369
+ }
4370
+ /** Union of all trigger configs */
4371
+ type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig;
4367
4372
  /**
4368
- * Multi-tenancy configuration types
4373
+ * Trigger metadata - entry points that initiate resource execution
4369
4374
  *
4370
- * Config is stored in dedicated `config` columns (NOT nested in metadata):
4371
- * - organizations.config: Org-level config (no feature toggles -- all features available by default)
4372
- * - org_memberships.config: Per-user-per-org feature overrides
4373
- * - users.config: User-global config
4375
+ * Triggers represent how executions start: webhooks from external services,
4376
+ * scheduled cron jobs, platform events, or manual user actions.
4377
+ *
4378
+ * BREAKING CHANGES (2025-11-30):
4379
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
4380
+ * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
4381
+ * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
4382
+ * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
4383
+ * - triggers object now includes `externalResources` option
4384
+ *
4385
+ * @example
4386
+ * // TriggerDefinition - metadata only
4387
+ * {
4388
+ * resourceId: 'trigger-new-order',
4389
+ * type: 'trigger',
4390
+ * triggerType: 'webhook',
4391
+ * name: 'New Order',
4392
+ * description: 'Webhook from Shopify on new orders',
4393
+ * version: '1.0.0',
4394
+ * status: 'prod',
4395
+ * webhookPath: '/webhooks/shopify/orders'
4396
+ * }
4397
+ *
4398
+ * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
4399
+ * // relationships: {
4400
+ * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
4401
+ * // }
4374
4402
  */
4403
+ interface TriggerDefinition extends ResourceDefinition {
4404
+ /** Resource type discriminator (narrowed from base union) */
4405
+ type: 'trigger';
4406
+ /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
4407
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
4408
+ /** Type-specific configuration */
4409
+ config?: TriggerConfig;
4410
+ /** For webhook triggers: path like '/webhooks/shopify/orders' */
4411
+ webhookPath?: string;
4412
+ /** For schedule triggers: cron expression like '0 6 * * *' */
4413
+ schedule?: string;
4414
+ /** For event triggers: event type like 'low-stock-alert' */
4415
+ eventType?: string;
4416
+ }
4375
4417
  /**
4376
- * Per-user-per-org config (stored in org_memberships.config)
4377
- * Controls which features a specific member can access within their org.
4378
- * Keys are feature IDs from the organization model (e.g. crm, lead-gen, projects, seo).
4418
+ * Integration metadata - external service connections
4419
+ *
4420
+ * References credentials table for actual connection. No connection status
4421
+ * stored here (queried at runtime from credentials table).
4422
+ *
4423
+ * BREAKING CHANGES (2025-11-30):
4424
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
4425
+ * - Field renames: `id` -> `resourceId` (inherited)
4426
+ * - New required field: `status` (inherited) - organizations must add status to all integrations
4427
+ * - New required field: `version` (inherited) - organizations must add version to all integrations
4428
+ * - New required field: `type: 'integration'` (inherited) - resource type discriminator
4429
+ *
4430
+ * @example
4431
+ * {
4432
+ * resourceId: 'integration-shopify-prod',
4433
+ * type: 'integration',
4434
+ * provider: 'shopify',
4435
+ * credentialName: 'shopify-prod',
4436
+ * name: 'Shopify Production',
4437
+ * description: 'E-commerce platform',
4438
+ * version: '1.0.0',
4439
+ * status: 'prod'
4440
+ * }
4379
4441
  */
4380
- interface MembershipFeatureConfig {
4381
- features?: Record<string, boolean>;
4442
+ interface IntegrationDefinition extends ResourceDefinition {
4443
+ /** Resource type discriminator (narrowed from base union) */
4444
+ type: 'integration';
4445
+ /** Integration provider type */
4446
+ provider: IntegrationType;
4447
+ /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
4448
+ credentialName: string;
4449
+ }
4450
+ /**
4451
+ * External platform type
4452
+ * Supported third-party automation platforms
4453
+ */
4454
+ type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other';
4455
+ /**
4456
+ * External automation resource metadata
4457
+ *
4458
+ * Represents workflows/automations running on third-party platforms
4459
+ * (n8n, Make, Zapier, etc.) for visualization in Command View.
4460
+ *
4461
+ * NOTE: This is metadata ONLY for visualization. No execution logic,
4462
+ * no API integration with external platforms, no status syncing.
4463
+ *
4464
+ * BREAKING CHANGES (2025-11-30):
4465
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
4466
+ * - Field renames: `id` -> `resourceId` (inherited)
4467
+ * - New required field: `version` (inherited) - organizations must add version to all external resources
4468
+ * - New required field: `type: 'external'` (inherited) - resource type discriminator
4469
+ * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
4470
+ *
4471
+ * @example
4472
+ * {
4473
+ * resourceId: 'external-n8n-order-sync',
4474
+ * type: 'external',
4475
+ * version: '1.0.0',
4476
+ * platform: 'n8n',
4477
+ * name: 'Shopify Order Sync',
4478
+ * description: 'Legacy n8n workflow for syncing Shopify orders',
4479
+ * status: 'prod',
4480
+ * platformUrl: 'https://n8n.client.com/workflow/123',
4481
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
4482
+ * uses: { integrations: ['integration-shopify-prod'] }
4483
+ * }
4484
+ */
4485
+ interface ExternalResourceDefinition extends ResourceDefinition {
4486
+ /** Resource type discriminator (narrowed from base union) */
4487
+ type: 'external';
4488
+ /** Platform type */
4489
+ platform: ExternalPlatform;
4490
+ /** Link to external platform (e.g., n8n workflow editor URL) */
4491
+ platformUrl?: string;
4492
+ /** Platform's internal ID/reference */
4493
+ externalId?: string;
4494
+ /** What this external resource triggers (external -> internal) */
4495
+ triggers?: {
4496
+ /** Elevasis workflow resourceIds this external automation triggers */
4497
+ workflows?: string[];
4498
+ /** Elevasis agent resourceIds this external automation triggers */
4499
+ agents?: string[];
4500
+ };
4501
+ /** Integrations this external resource uses (shared credentials) */
4502
+ uses?: {
4503
+ /** Integration IDs this external automation uses */
4504
+ integrations?: string[];
4505
+ };
4382
4506
  }
4383
4507
  /**
4384
- * User-global config (stored in users.config)
4385
- * Theme and onboarding are user-specific, NOT org-specific
4508
+ * Human Checkpoint definition - human decision points in automation
4509
+ *
4510
+ * Represents where human judgment is deployed in the automation landscape.
4511
+ * Tasks with matching command_queue_group are routed to this checkpoint.
4512
+ *
4513
+ * BREAKING CHANGES (2025-11-30):
4514
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
4515
+ * - Field renames: `id` -> `resourceId` (inherited)
4516
+ * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
4517
+ * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
4518
+ * - New required field: `type: 'human'` (inherited) - resource type discriminator
4519
+ *
4520
+ * @example
4521
+ * {
4522
+ * resourceId: 'sales-approval',
4523
+ * type: 'human',
4524
+ * name: 'Sales Approval Queue',
4525
+ * description: 'High-value order approvals for sales team',
4526
+ * version: '1.0.0',
4527
+ * status: 'prod',
4528
+ * requestedBy: { agents: ['order-processor-agent'] },
4529
+ * routesTo: { agents: ['order-fulfillment-agent'] }
4530
+ * }
4386
4531
  */
4387
- interface UserConfig {
4388
- theme?: {
4389
- preset?: 'default' | 'tactical' | 'regal' | 'cyber-volt' | 'aurora' | 'rose-gold' | 'midnight' | 'titanium' | 'obsidian' | 'honey' | 'abyss' | 'canopy' | 'slate' | 'cyber-strike' | 'cyber-chrome' | 'cyber-void' | 'nirvana' | 'wave' | 'synapse' | 'cortex' | 'helios' | 'graphite' | 'quarry' | 'canyon' | 'nord' | 'catppuccin' | 'tokyo-night' | 'gruvbox';
4390
- colorScheme?: 'light' | 'dark' | 'auto';
4532
+ interface HumanCheckpointDefinition extends ResourceDefinition {
4533
+ /** Resource type discriminator (narrowed from base union) */
4534
+ type: 'human';
4535
+ /** Resources that create tasks for this checkpoint */
4536
+ requestedBy?: {
4537
+ /** Agent resourceIds that request approval here */
4538
+ agents?: string[];
4539
+ /** Workflow resourceIds that request approval here */
4540
+ workflows?: string[];
4391
4541
  };
4392
- onboarding?: {
4393
- completed?: boolean;
4394
- completedAt?: string;
4395
- role?: string;
4396
- primaryUseCase?: string[];
4397
- experienceLevel?: string;
4398
- /** Onboarding guide system state (set by checklist/tour system) */
4399
- guides?: {
4400
- completedIds?: string[];
4401
- dismissed?: boolean;
4402
- completedAt?: string;
4403
- };
4542
+ /** Resources that receive approved decisions */
4543
+ routesTo?: {
4544
+ /** Agent resourceIds that handle approved tasks */
4545
+ agents?: string[];
4546
+ /** Workflow resourceIds that handle approved tasks */
4547
+ workflows?: string[];
4404
4548
  };
4405
4549
  }
4406
4550
 
4407
4551
  /**
4408
- * Memberships Domain - Zod Validation Schemas
4552
+ * Command View Types
4409
4553
  *
4410
- * Validation schemas for membership management endpoints.
4411
- * Includes request bodies, query params, and path params.
4554
+ * Unified type definitions for the Command View graph visualization.
4555
+ * These types are used by both backend serialization and frontend rendering.
4412
4556
  *
4413
- * Security:
4414
- * - All schemas use .strict() to prevent mass assignment attacks
4415
- * - UUID validation prevents invalid references
4416
- * - Role enum validation prevents privilege escalation
4417
- * - organizationId never accepted in body (from JWT when needed)
4557
+ * Command View shows the resource graph: agents, workflows, triggers, integrations,
4558
+ * external resources, and human checkpoints with their relationships.
4418
4559
  */
4419
4560
 
4420
4561
  /**
4421
- * Membership status validation
4422
- * Note: Database constraint only allows 'active' | 'inactive'
4562
+ * Extended agent metadata for Command View
4563
+ * Includes model and capability information for graph display
4423
4564
  */
4424
- declare const MembershipStatusSchema: z.ZodEnum<{
4425
- active: "active";
4426
- inactive: "inactive";
4427
- }>;
4428
- type MembershipStatus = z.infer<typeof MembershipStatusSchema>;
4429
-
4565
+ interface CommandViewAgent extends ResourceDefinition {
4566
+ type: 'agent';
4567
+ modelProvider: string;
4568
+ modelId: string;
4569
+ toolCount: number;
4570
+ hasKnowledgeMap: boolean;
4571
+ hasMemory: boolean;
4572
+ sessionCapable: boolean;
4573
+ }
4430
4574
  /**
4431
- * Organization Membership types based on WorkOS API
4575
+ * Extended workflow metadata for Command View
4576
+ * Includes step information for graph display
4432
4577
  */
4433
- interface OrganizationMembership {
4434
- object: 'organization_membership';
4578
+ interface CommandViewWorkflow extends ResourceDefinition {
4579
+ type: 'workflow';
4580
+ stepCount: number;
4581
+ entryPoint: string;
4582
+ }
4583
+ /**
4584
+ * Relationship types between resources
4585
+ *
4586
+ * - triggers: Resource initiates/starts another resource (orange)
4587
+ * - uses: Resource uses an integration (teal)
4588
+ * - approval: Resource requires human approval (yellow)
4589
+ */
4590
+ type RelationshipType$1 = 'triggers' | 'uses' | 'approval';
4591
+ /**
4592
+ * Command View edge (relationship between resources)
4593
+ */
4594
+ interface CommandViewEdge$1 {
4435
4595
  id: string;
4436
- userId: string;
4437
- organizationId: string;
4438
- role: {
4439
- slug: string;
4440
- };
4441
- status: 'active' | 'inactive';
4442
- createdAt: string;
4443
- updatedAt: string;
4596
+ source: string;
4597
+ target: string;
4598
+ relationship: RelationshipType$1;
4599
+ label?: string;
4444
4600
  }
4445
4601
  /**
4446
- * Request interfaces for membership operations
4602
+ * Command View data structure
4603
+ * Complete graph data for visualization
4604
+ *
4605
+ * Backend serializes this once at startup and serves it via /command-view endpoint.
4606
+ * Frontend consumes this directly for graph rendering.
4447
4607
  */
4448
- interface CreateMembershipRequest {
4449
- userId: string;
4450
- organizationId: string;
4451
- roleSlug?: string;
4608
+ interface CommandViewData {
4609
+ workflows: CommandViewWorkflow[];
4610
+ agents: CommandViewAgent[];
4611
+ triggers: TriggerDefinition[];
4612
+ integrations: IntegrationDefinition[];
4613
+ externalResources: ExternalResourceDefinition[];
4614
+ humanCheckpoints: HumanCheckpointDefinition[];
4615
+ edges: CommandViewEdge$1[];
4452
4616
  }
4453
- interface UpdateMembershipRequest {
4454
- roleSlug: string;
4617
+
4618
+ declare const LinkSchema: z.ZodObject<{
4619
+ nodeId: z.ZodString;
4620
+ kind: z.ZodEnum<{
4621
+ contains: "contains";
4622
+ references: "references";
4623
+ exposes: "exposes";
4624
+ maps_to: "maps_to";
4625
+ "operates-on": "operates-on";
4626
+ uses: "uses";
4627
+ }>;
4628
+ }, z.core.$strip>;
4629
+ type Link = z.infer<typeof LinkSchema>;
4630
+
4631
+ declare const ResourceCategorySchema: z.ZodEnum<{
4632
+ production: "production";
4633
+ diagnostic: "diagnostic";
4634
+ internal: "internal";
4635
+ testing: "testing";
4636
+ }>;
4637
+ type ResourceCategory = z.infer<typeof ResourceCategorySchema>;
4638
+ type ResourceLink = Link;
4639
+
4640
+ type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
4641
+ interface APIExecutionSummary {
4642
+ id: string;
4643
+ status: ExecutionStatus;
4644
+ startTime: number;
4645
+ endTime?: number;
4646
+ resourceStatus?: ResourceStatus;
4455
4647
  }
4456
- interface ListMembershipsParams {
4457
- userId?: string;
4458
- organizationId?: string;
4459
- statuses?: MembershipStatus[];
4648
+ interface APIExecutionDetail extends APIExecutionSummary {
4649
+ executionLogs: ExecutionLogMessage[];
4650
+ input?: unknown;
4651
+ result?: unknown;
4652
+ error?: string;
4653
+ resourceStatus: ResourceStatus;
4654
+ apiVersion?: string | null;
4655
+ resourceVersion?: string | null;
4656
+ sdkVersion?: string | null;
4657
+ isArchived?: boolean;
4658
+ archivedLogCount?: number;
4659
+ }
4660
+ interface APIExecutionListResponse {
4661
+ executions: APIExecutionSummary[];
4662
+ total?: number;
4460
4663
  limit?: number;
4461
- before?: string;
4462
- after?: string;
4463
- order?: 'asc' | 'desc';
4664
+ offset?: number;
4665
+ hasMore?: boolean;
4464
4666
  }
4667
+
4465
4668
  /**
4466
- * Response interfaces
4669
+ * @deprecated Use TimeRange from '@repo/core' directly. Kept as alias for backward compatibility.
4467
4670
  */
4468
- interface ListMembershipsResponse {
4469
- data: OrganizationMembership[];
4470
- listMetadata?: {
4471
- before?: string | null;
4472
- after?: string | null;
4473
- };
4671
+ type StatsTimeRange = TimeRange;
4672
+ /** Stats returned by /command-view/stats (counts only, no error details) */
4673
+ interface ResourceStats {
4674
+ resourceId: string;
4675
+ totalRuns: number;
4676
+ successCount: number;
4677
+ failureCount: number;
4678
+ warningCount: number;
4679
+ lastRunAt: string | null;
4474
4680
  }
4475
- /**
4476
- * Extended membership with user and organization details for UI
4477
- */
4478
- interface MembershipWithDetails extends OrganizationMembership {
4479
- user?: {
4480
- id: string;
4481
- email: string;
4482
- firstName?: string;
4483
- lastName?: string;
4484
- profilePictureUrl?: string;
4485
- };
4486
- organization?: {
4487
- id: string;
4488
- name: string;
4489
- workos_org_id: string;
4490
- primaryDomain?: string;
4491
- is_test?: boolean;
4492
- status?: string;
4493
- metadata?: Record<string, unknown>;
4494
- config?: Record<string, unknown>;
4495
- };
4496
- config?: MembershipFeatureConfig;
4681
+ /** Response from /command-view/resource-errors (on-demand) */
4682
+ interface ResourceErrorsResponse {
4683
+ resourceId: string;
4684
+ errors: ErrorSummary[];
4685
+ totalErrors: number;
4686
+ timeRange: StatsTimeRange;
4687
+ }
4688
+ interface ErrorSummary {
4689
+ executionId: string;
4690
+ errorType: string;
4691
+ errorMessage: string;
4692
+ occurredAt: string;
4693
+ }
4694
+ /** Single execution summary for Recent Executions list in command view */
4695
+ interface CommandViewExecution {
4696
+ executionId: string;
4697
+ status: ExecutionStatus;
4698
+ startedAt: string;
4699
+ completedAt: string | null;
4700
+ errorMessage: string | null;
4701
+ }
4702
+ /** Response from /command-view/resource-executions (on-demand) */
4703
+ interface ResourceExecutionsResponse {
4704
+ resourceId: string;
4705
+ executions: CommandViewExecution[];
4706
+ totalExecutions: number;
4707
+ timeRange: StatsTimeRange;
4708
+ page: number;
4709
+ limit: number;
4710
+ }
4711
+ interface HumanCheckpointStats {
4712
+ checkpointId: string;
4713
+ pendingCount: number;
4714
+ completedCount: number;
4715
+ expiredCount: number;
4716
+ lastDecisionAt: string | null;
4717
+ }
4718
+ /** Response from /command-view/stats */
4719
+ interface CommandViewStatsResponse {
4720
+ resources: Record<string, ResourceStats>;
4721
+ humanCheckpoints: Record<string, HumanCheckpointStats>;
4722
+ timeRange: StatsTimeRange;
4723
+ generatedAt: string;
4497
4724
  }
4498
4725
 
4499
- type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
4500
- interface APIExecutionSummary {
4726
+ type ActivityType = 'workflow_execution' | 'agent_run' | 'hitl_action' | 'webhook_received' | 'webhook_executed' | 'webhook_failed' | 'credential_change' | 'credential_read' | 'api_key_change' | 'deployment_change' | 'membership_change';
4727
+ type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed';
4728
+ interface Activity {
4501
4729
  id: string;
4502
- status: ExecutionStatus;
4503
- startTime: number;
4504
- endTime?: number;
4505
- resourceStatus?: ResourceStatus;
4506
- }
4507
- interface APIExecutionDetail extends APIExecutionSummary {
4508
- executionLogs: ExecutionLogMessage[];
4509
- input?: unknown;
4510
- result?: unknown;
4511
- error?: string;
4512
- resourceStatus: ResourceStatus;
4513
- apiVersion?: string | null;
4514
- resourceVersion?: string | null;
4515
- sdkVersion?: string | null;
4516
- isArchived?: boolean;
4517
- archivedLogCount?: number;
4730
+ organizationId: string;
4731
+ activityType: ActivityType;
4732
+ status: ActivityStatus;
4733
+ title: string;
4734
+ description: string | null;
4735
+ entityType: string;
4736
+ entityId: string;
4737
+ entityName: string | null;
4738
+ metadata: Record<string, unknown> | null;
4739
+ actorId: string | null;
4740
+ actorType: string | null;
4741
+ occurredAt: Date;
4742
+ createdAt: Date;
4518
4743
  }
4519
- interface APIExecutionListResponse {
4520
- executions: APIExecutionSummary[];
4521
- total?: number;
4522
- limit?: number;
4523
- offset?: number;
4524
- hasMore?: boolean;
4744
+
4745
+ /**
4746
+ * Canonical permission catalog.
4747
+ *
4748
+ * Source of truth for the permission keys used by:
4749
+ * - RLS policies in Supabase (via has_org_permission(org_id, key))
4750
+ * - API middleware (via requireOrganizationPermission(key))
4751
+ * - UI hooks (via useOrganizationPermissions().hasPermission(key))
4752
+ *
4753
+ * The DB table `org_rol_permissions` mirrors this constant. Reconciliation
4754
+ * runs at API boot (insert-or-update only — never auto-delete; see the
4755
+ * deletion runbook in the auth-role-system-redesign doc).
4756
+ *
4757
+ * Adding a permission:
4758
+ * 1. Add an entry below.
4759
+ * 2. Add a row to the migration / via reconcilePermissionCatalog at boot.
4760
+ * 3. Reference it in RLS / middleware as needed.
4761
+ * 4. Optionally grant it to one or more system roles in org_rol_grants.
4762
+ *
4763
+ * Removing a permission: follow the deletion runbook — never just delete
4764
+ * the entry. Existing role grants and policy references must be cleared first.
4765
+ */
4766
+ declare const PERMISSIONS: {
4767
+ readonly ORG_READ: "org.read";
4768
+ readonly ORG_MANAGE: "org.manage";
4769
+ readonly ORG_DELETE: "org.delete";
4770
+ readonly MEMBERS_MANAGE: "members.manage";
4771
+ readonly ROLES_MANAGE: "roles.manage";
4772
+ readonly SECRETS_MANAGE: "secrets.manage";
4773
+ readonly OPERATIONS_READ: "operations.read";
4774
+ readonly OPERATIONS_MANAGE: "operations.manage";
4775
+ readonly WORK_MANAGE: "work.manage";
4776
+ };
4777
+ type PermissionKey = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
4778
+ /**
4779
+ * Static metadata for each permission. Mirrored into org_rol_permissions on
4780
+ * boot reconciliation. is_org_grantable=false means the permission is reserved
4781
+ * to system roles only — custom roles cannot include it (privilege-escalation guard).
4782
+ */
4783
+ interface PermissionDescriptor {
4784
+ key: PermissionKey;
4785
+ description: string;
4786
+ isOrgGrantable: boolean;
4525
4787
  }
4526
4788
 
4527
4789
  /**
@@ -4533,9 +4795,9 @@ declare const ExecutionHistoryItemSchema: z.ZodObject<{
4533
4795
  createdAt: z.ZodString;
4534
4796
  status: z.ZodEnum<{
4535
4797
  completed: "completed";
4798
+ cancelled: "cancelled";
4536
4799
  failed: "failed";
4537
4800
  running: "running";
4538
- cancelled: "cancelled";
4539
4801
  }>;
4540
4802
  step: z.ZodNullable<z.ZodNumber>;
4541
4803
  itemLabel: z.ZodNullable<z.ZodString>;
@@ -4552,9 +4814,9 @@ declare const ExecutionHistoryResponseSchema: z.ZodObject<{
4552
4814
  createdAt: z.ZodString;
4553
4815
  status: z.ZodEnum<{
4554
4816
  completed: "completed";
4817
+ cancelled: "cancelled";
4555
4818
  failed: "failed";
4556
4819
  running: "running";
4557
- cancelled: "cancelled";
4558
4820
  }>;
4559
4821
  step: z.ZodNullable<z.ZodNumber>;
4560
4822
  itemLabel: z.ZodNullable<z.ZodString>;
@@ -4568,6 +4830,63 @@ declare const ExecutionHistoryResponseSchema: z.ZodObject<{
4568
4830
  type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>;
4569
4831
  type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>;
4570
4832
 
4833
+ /**
4834
+ * Deployment types — browser-safe
4835
+ *
4836
+ * Canonical API response types for the deployment resource.
4837
+ * The API's transformRow converts snake_case DB columns to these camelCase fields.
4838
+ */
4839
+ type DeploymentStatus = 'deploying' | 'active' | 'failed' | 'rolled_back' | 'stopped';
4840
+ interface Deployment {
4841
+ id: string;
4842
+ organizationId: string;
4843
+ status: DeploymentStatus;
4844
+ sdkVersion: string;
4845
+ deploymentVersion: string | null;
4846
+ port: number | null;
4847
+ pid: number | null;
4848
+ tarballPath: string | null;
4849
+ errorMessage: string | null;
4850
+ createdAt: string;
4851
+ updatedAt: string;
4852
+ }
4853
+
4854
+ /**
4855
+ * GET /api/credentials - List credentials
4856
+ */
4857
+ declare const ListCredentialsResponseSchema: z.ZodObject<{
4858
+ credentials: z.ZodArray<z.ZodObject<{
4859
+ id: z.ZodString;
4860
+ name: z.ZodString;
4861
+ type: z.ZodString;
4862
+ provider: z.ZodNullable<z.ZodString>;
4863
+ createdAt: z.ZodString;
4864
+ }, z.core.$strip>>;
4865
+ }, z.core.$strip>;
4866
+ /** API response type for a single credential list item */
4867
+ type CredentialListItem = z.infer<typeof ListCredentialsResponseSchema>['credentials'][number];
4868
+
4869
+ declare function useOrganizationPermissions(): {
4870
+ hasPermission: (key: PermissionKey | string) => boolean;
4871
+ permissions: string[];
4872
+ isPlatformAdmin: boolean;
4873
+ isReady: boolean;
4874
+ };
4875
+ declare function useHasPermission(key: PermissionKey | string): boolean;
4876
+
4877
+ /**
4878
+ * Query key factory for executions TanStack Query hooks.
4879
+ * Uses organization UUID (not name) for cache isolation.
4880
+ */
4881
+ declare const executionsKeys: {
4882
+ all: readonly ["executions"];
4883
+ resources: (orgId: string | null) => readonly ["executions", "resources", string | null];
4884
+ resourceDefinition: (orgId: string | null, resourceId: string) => readonly ["executions", "definition", string | null, string];
4885
+ executionsListBase: (orgId: string | null, resourceId: string) => readonly ["executions", "list", string | null, string];
4886
+ executions: (orgId: string | null, resourceId: string, resourceStatus?: string, limit?: number, offset?: number) => readonly ["executions", "list", string | null, string, string, number | null, number];
4887
+ execution: (orgId: string | null, resourceId: string, executionId: string) => readonly ["executions", "execution", string | null, string, string];
4888
+ };
4889
+
4571
4890
  /**
4572
4891
  * Fetch the execution list for a given resource.
4573
4892
  *
@@ -4671,119 +4990,6 @@ interface BulkDeleteExecutionsResult {
4671
4990
  */
4672
4991
  declare function useBulkDeleteExecutions(): _tanstack_react_query.UseMutationResult<BulkDeleteExecutionsResult, Error, BulkDeleteExecutionsParams, unknown>;
4673
4992
 
4674
- /**
4675
- * @deprecated Use TimeRange from '@repo/core' directly. Kept as alias for backward compatibility.
4676
- */
4677
- type StatsTimeRange = TimeRange;
4678
- /** Stats returned by /command-view/stats (counts only, no error details) */
4679
- interface ResourceStats {
4680
- resourceId: string;
4681
- totalRuns: number;
4682
- successCount: number;
4683
- failureCount: number;
4684
- warningCount: number;
4685
- lastRunAt: string | null;
4686
- }
4687
- /** Response from /command-view/resource-errors (on-demand) */
4688
- interface ResourceErrorsResponse {
4689
- resourceId: string;
4690
- errors: ErrorSummary[];
4691
- totalErrors: number;
4692
- timeRange: StatsTimeRange;
4693
- }
4694
- interface ErrorSummary {
4695
- executionId: string;
4696
- errorType: string;
4697
- errorMessage: string;
4698
- occurredAt: string;
4699
- }
4700
- /** Single execution summary for Recent Executions list in command view */
4701
- interface CommandViewExecution {
4702
- executionId: string;
4703
- status: ExecutionStatus;
4704
- startedAt: string;
4705
- completedAt: string | null;
4706
- errorMessage: string | null;
4707
- }
4708
- /** Response from /command-view/resource-executions (on-demand) */
4709
- interface ResourceExecutionsResponse {
4710
- resourceId: string;
4711
- executions: CommandViewExecution[];
4712
- totalExecutions: number;
4713
- timeRange: StatsTimeRange;
4714
- page: number;
4715
- limit: number;
4716
- }
4717
- interface HumanCheckpointStats {
4718
- checkpointId: string;
4719
- pendingCount: number;
4720
- completedCount: number;
4721
- expiredCount: number;
4722
- lastDecisionAt: string | null;
4723
- }
4724
- /** Response from /command-view/stats */
4725
- interface CommandViewStatsResponse {
4726
- resources: Record<string, ResourceStats>;
4727
- humanCheckpoints: Record<string, HumanCheckpointStats>;
4728
- timeRange: StatsTimeRange;
4729
- generatedAt: string;
4730
- }
4731
-
4732
- type ActivityType = 'workflow_execution' | 'agent_run' | 'hitl_action' | 'webhook_received' | 'webhook_executed' | 'webhook_failed' | 'credential_change' | 'api_key_change' | 'deployment_change' | 'membership_change';
4733
- type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed';
4734
- interface Activity {
4735
- id: string;
4736
- organizationId: string;
4737
- activityType: ActivityType;
4738
- status: ActivityStatus;
4739
- title: string;
4740
- description: string | null;
4741
- entityType: string;
4742
- entityId: string;
4743
- entityName: string | null;
4744
- metadata: Record<string, unknown> | null;
4745
- actorId: string | null;
4746
- actorType: string | null;
4747
- occurredAt: Date;
4748
- createdAt: Date;
4749
- }
4750
-
4751
- /**
4752
- * Deployment types — browser-safe
4753
- *
4754
- * Canonical API response types for the deployment resource.
4755
- * The API's transformRow converts snake_case DB columns to these camelCase fields.
4756
- */
4757
- type DeploymentStatus = 'deploying' | 'active' | 'failed' | 'rolled_back' | 'stopped';
4758
- interface Deployment {
4759
- id: string;
4760
- organizationId: string;
4761
- status: DeploymentStatus;
4762
- sdkVersion: string;
4763
- deploymentVersion: string | null;
4764
- port: number | null;
4765
- pid: number | null;
4766
- tarballPath: string | null;
4767
- errorMessage: string | null;
4768
- createdAt: string;
4769
- updatedAt: string;
4770
- }
4771
-
4772
- /**
4773
- * GET /api/credentials - List credentials
4774
- */
4775
- declare const ListCredentialsResponseSchema: z.ZodObject<{
4776
- credentials: z.ZodArray<z.ZodObject<{
4777
- id: z.ZodString;
4778
- name: z.ZodString;
4779
- type: z.ZodString;
4780
- provider: z.ZodNullable<z.ZodString>;
4781
- createdAt: z.ZodString;
4782
- }, z.core.$strip>>;
4783
- }, z.core.$strip>;
4784
- /** API response type for a single credential list item */
4785
- type CredentialListItem = z.infer<typeof ListCredentialsResponseSchema>['credentials'][number];
4786
-
4787
4993
  /**
4788
4994
  * Fetch all available Execution Engine resources (workflows, agents, pipelines).
4789
4995
  *
@@ -5005,7 +5211,7 @@ declare function useGetExecutionHistory(scheduleId: string | undefined, options?
5005
5211
  executions: {
5006
5212
  id: string;
5007
5213
  createdAt: string;
5008
- status: "completed" | "failed" | "running" | "cancelled";
5214
+ status: "completed" | "cancelled" | "failed" | "running";
5009
5215
  step: number | null;
5010
5216
  itemLabel: string | null;
5011
5217
  duration: number | null;
@@ -5734,10 +5940,6 @@ declare function createFeatureAccessHook({ useInitialization, useOrganization }:
5734
5940
  checkFeature: (featureKey: string) => FeatureAccessResult;
5735
5941
  isReady: boolean;
5736
5942
  };
5737
- /**
5738
- * @deprecated Use `createFeatureAccessHook` instead. This alias will be removed in a future release.
5739
- */
5740
- declare const createUseFeatureAccess: typeof createFeatureAccessHook;
5741
5943
 
5742
5944
  interface UseSSEConnectionOptions {
5743
5945
  manager: SSEConnectionManagerLike;
@@ -5993,8 +6195,8 @@ declare const RequestSourceEnum: z.ZodEnum<{
5993
6195
  cli: "cli";
5994
6196
  }>;
5995
6197
  declare const RequestTypeEnum: z.ZodEnum<{
5996
- other: "other";
5997
6198
  feature: "feature";
6199
+ other: "other";
5998
6200
  bug: "bug";
5999
6201
  question: "question";
6000
6202
  }>;
@@ -6196,6 +6398,8 @@ interface UseCommandViewStatsOptions {
6196
6398
  */
6197
6399
  declare function useCommandViewStats(timeRange?: StatsTimeRange, options?: UseCommandViewStatsOptions): _tanstack_react_query.UseQueryResult<CommandViewStatsResponse, Error>;
6198
6400
 
6401
+ type CommandViewVisualizationMode = 'cluster' | 'swimlane' | 'focus' | 'network' | 'spatial';
6402
+
6199
6403
  /**
6200
6404
  * Command View Types
6201
6405
  *
@@ -6317,15 +6521,28 @@ interface CommandViewStore {
6317
6521
  setShowIntegrations: (v: boolean) => void;
6318
6522
  fitViewOnFilter: boolean;
6319
6523
  setFitViewOnFilter: (v: boolean) => void;
6524
+ visualizationMode: CommandViewVisualizationMode;
6525
+ setVisualizationMode: (v: CommandViewVisualizationMode) => void;
6320
6526
  selectedNodeId: string | null;
6321
6527
  setSelectedNodeId: (id: string | null) => void;
6528
+ resourcesHidden: boolean;
6529
+ setResourcesHidden: (v: boolean) => void;
6530
+ diagnosticsHidden: boolean;
6531
+ setDiagnosticsHidden: (v: boolean) => void;
6532
+ diagnosticCategories: string[];
6533
+ revealedIds: Set<string>;
6534
+ setRevealedIds: (ids: Iterable<string>) => void;
6535
+ clearRevealedIds: () => void;
6536
+ hasVisibilityInteraction: boolean;
6537
+ markVisibilityInteraction: () => void;
6538
+ resetVisibilityInteraction: () => void;
6322
6539
  }
6323
6540
  /**
6324
6541
  * Shared store for Command View filter/settings state.
6325
6542
  * Allows CommandViewPage (graph) and CommandViewSidebarContent (sidebar) to share state.
6326
6543
  *
6327
- * Persisted to localStorage: showIntegrations, fitViewOnFilter
6328
- * Not persisted (reset on reload): statusFilter, selectedNodeId
6544
+ * Persisted to localStorage: showIntegrations, fitViewOnFilter, resource/diagnostic visibility preferences.
6545
+ * Not persisted (reset on reload): statusFilter, selectedNodeId, revealedIds, CTA interaction state.
6329
6546
  */
6330
6547
  declare const useCommandViewStore: zustand.UseBoundStore<Omit<zustand.StoreApi<CommandViewStore>, "setState" | "persist"> & {
6331
6548
  setState(partial: CommandViewStore | Partial<CommandViewStore> | ((state: CommandViewStore) => CommandViewStore | Partial<CommandViewStore>), replace?: false | undefined): unknown;
@@ -6334,6 +6551,9 @@ declare const useCommandViewStore: zustand.UseBoundStore<Omit<zustand.StoreApi<C
6334
6551
  setOptions: (options: Partial<zustand_middleware.PersistOptions<CommandViewStore, {
6335
6552
  showIntegrations: boolean;
6336
6553
  fitViewOnFilter: boolean;
6554
+ visualizationMode: CommandViewVisualizationMode;
6555
+ resourcesHidden: boolean;
6556
+ diagnosticsHidden: boolean;
6337
6557
  }, unknown>>) => void;
6338
6558
  clearStorage: () => void;
6339
6559
  rehydrate: () => Promise<void> | void;
@@ -6343,6 +6563,9 @@ declare const useCommandViewStore: zustand.UseBoundStore<Omit<zustand.StoreApi<C
6343
6563
  getOptions: () => Partial<zustand_middleware.PersistOptions<CommandViewStore, {
6344
6564
  showIntegrations: boolean;
6345
6565
  fitViewOnFilter: boolean;
6566
+ visualizationMode: CommandViewVisualizationMode;
6567
+ resourcesHidden: boolean;
6568
+ diagnosticsHidden: boolean;
6346
6569
  }, unknown>>;
6347
6570
  };
6348
6571
  }>;
@@ -7620,10 +7843,56 @@ declare function useReactivateMembership(): _tanstack_react_query.UseMutationRes
7620
7843
  previousData: unknown;
7621
7844
  }>;
7622
7845
 
7846
+ type OrgRolDefinitionRow = Database['public']['Tables']['org_rol_definitions']['Row'];
7847
+ type OrgRole = OrgRolDefinitionRow & {
7848
+ grants?: string[];
7849
+ memberCount?: number;
7850
+ };
7851
+ type CreateOrgRoleInput = {
7852
+ name: string;
7853
+ slug: string;
7854
+ description?: string;
7855
+ permissionKeys: string[];
7856
+ };
7857
+ type UpdateOrgRoleInput = Partial<CreateOrgRoleInput>;
7858
+ type AssignRoleInput = {
7859
+ membershipId: string;
7860
+ roleId: string;
7861
+ };
7862
+ type RevokeRoleInput = {
7863
+ membershipId: string;
7864
+ roleId: string;
7865
+ };
7866
+
7867
+ declare function useOrgRoles(orgId?: string): _tanstack_react_query.UseQueryResult<{
7868
+ roles: OrgRole[];
7869
+ }, Error>;
7870
+
7871
+ declare function usePermissionCatalog(): _tanstack_react_query.UseQueryResult<{
7872
+ permissions: PermissionDescriptor[];
7873
+ }, Error>;
7874
+
7875
+ declare function useCreateOrgRole(): _tanstack_react_query.UseMutationResult<OrgRole, Error, CreateOrgRoleInput, unknown>;
7876
+
7877
+ interface UpdateOrgRoleParams {
7878
+ roleId: string;
7879
+ input: UpdateOrgRoleInput;
7880
+ }
7881
+ declare function useUpdateOrgRole(): _tanstack_react_query.UseMutationResult<OrgRole, Error, UpdateOrgRoleParams, unknown>;
7882
+
7883
+ declare function useDeleteOrgRole(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
7884
+
7885
+ declare function useAssignRole(): _tanstack_react_query.UseMutationResult<void, Error, AssignRoleInput, unknown>;
7886
+ declare function useRevokeRole(): _tanstack_react_query.UseMutationResult<void, Error, RevokeRoleInput, unknown>;
7887
+
7888
+ declare function useEffectivePermissions(membershipId: string | undefined): _tanstack_react_query.UseQueryResult<{
7889
+ permissions: string[];
7890
+ }, Error>;
7891
+
7623
7892
  declare function useListWebhookEndpoints(): _tanstack_react_query.UseQueryResult<{
7624
7893
  id: string;
7625
7894
  organizationId: string;
7626
- key: string;
7895
+ keyPrefix: string | null;
7627
7896
  name: string;
7628
7897
  description: string | null;
7629
7898
  resourceId: string | null;
@@ -7632,12 +7901,13 @@ declare function useListWebhookEndpoints(): _tanstack_react_query.UseQueryResult
7632
7901
  requestCount: number;
7633
7902
  createdAt: string;
7634
7903
  updatedAt: string;
7904
+ key?: string | undefined;
7635
7905
  }[], Error>;
7636
7906
 
7637
7907
  declare function useCreateWebhookEndpoint(): _tanstack_react_query.UseMutationResult<{
7638
7908
  id: string;
7639
7909
  organizationId: string;
7640
- key: string;
7910
+ keyPrefix: string | null;
7641
7911
  name: string;
7642
7912
  description: string | null;
7643
7913
  resourceId: string | null;
@@ -7646,6 +7916,7 @@ declare function useCreateWebhookEndpoint(): _tanstack_react_query.UseMutationRe
7646
7916
  requestCount: number;
7647
7917
  createdAt: string;
7648
7918
  updatedAt: string;
7919
+ key?: string | undefined;
7649
7920
  }, Error, {
7650
7921
  name: string;
7651
7922
  resourceId?: string | undefined;
@@ -7687,7 +7958,8 @@ type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestS
7687
7958
  declare const WebhookEndpointResponseSchema: z.ZodObject<{
7688
7959
  id: z.ZodString;
7689
7960
  organizationId: z.ZodString;
7690
- key: z.ZodString;
7961
+ key: z.ZodOptional<z.ZodString>;
7962
+ keyPrefix: z.ZodNullable<z.ZodString>;
7691
7963
  name: z.ZodString;
7692
7964
  description: z.ZodNullable<z.ZodString>;
7693
7965
  resourceId: z.ZodNullable<z.ZodString>;
@@ -7705,7 +7977,7 @@ type WebhookEndpointResponse = z.infer<typeof WebhookEndpointResponseSchema>;
7705
7977
  declare function useUpdateWebhookEndpoint(): _tanstack_react_query.UseMutationResult<{
7706
7978
  id: string;
7707
7979
  organizationId: string;
7708
- key: string;
7980
+ keyPrefix: string | null;
7709
7981
  name: string;
7710
7982
  description: string | null;
7711
7983
  resourceId: string | null;
@@ -7714,6 +7986,7 @@ declare function useUpdateWebhookEndpoint(): _tanstack_react_query.UseMutationRe
7714
7986
  requestCount: number;
7715
7987
  createdAt: string;
7716
7988
  updatedAt: string;
7989
+ key?: string | undefined;
7717
7990
  }, Error, {
7718
7991
  endpointId: string;
7719
7992
  data: UpdateWebhookEndpointRequest;
@@ -7790,6 +8063,10 @@ declare function useVisibleResources(): {
7790
8063
  };
7791
8064
 
7792
8065
  type DomainFilterState = 'neutral' | 'include' | 'exclude';
8066
+ type ResourceFilterFacet = {
8067
+ id: string;
8068
+ label: string;
8069
+ };
7793
8070
  interface DomainFiltersStore {
7794
8071
  filters: Record<string, DomainFilterState>;
7795
8072
  cycle: (domainId: string) => void;
@@ -7821,6 +8098,9 @@ declare const useCommandViewDomainFilters: zustand.UseBoundStore<Omit<zustand.St
7821
8098
  getOptions: () => Partial<zustand_middleware.PersistOptions<DomainFiltersStore, DomainFiltersStore, unknown>>;
7822
8099
  };
7823
8100
  }>;
8101
+ declare function getResourceFilterFacetIds(resource: ResourceDefinition): string[];
8102
+ declare function labelResourceFilterFacet(id: string): string;
8103
+ declare function collectResourceFilterFacets(items: ResourceDefinition[]): ResourceFilterFacet[];
7824
8104
  declare function filterByDomainFilters(items: ResourceDefinition[], filters: Record<string, DomainFilterState>): ResourceDefinition[];
7825
8105
 
7826
8106
  /**
@@ -8275,5 +8555,5 @@ declare function useCreateNote(): _tanstack_react_query.UseMutationResult<{
8275
8555
  type?: string;
8276
8556
  }, "organization_id">, unknown>;
8277
8557
 
8278
- export { ApiKeyService, CredentialService, DeploymentService, OperationsService, OrganizationMembershipService, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, WebhookEndpointService, acquisitionListKeys, companyKeys, contactKeys, createFeatureAccessHook, createUseFeatureAccess, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, isSessionCapable, milestoneKeys, noteKeys, observabilityKeys, operationsKeys, projectActivityKeys, projectKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, taskKeys, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useArchiveSession, useArchivedLogs, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateProject as useCreateDeliveryProject, useCreateList, useCreateMilestone, useCreateNote, useCreateSchedule, useCreateSession, useCreateTask, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteApiKey, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteProject as useDeleteDeliveryProject, useDeleteTask as useDeleteDeliveryTask, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteMilestone, useDeleteRequest, useDeleteSchedule, useDeleteSession, useDeleteTask$1 as useDeleteTask, useDeleteWebhookEndpoint, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGraphStats, useList, useListApiKeys, useListDeployments, useListExecutions, useListProgress, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useMergedExecution, useMilestones, useNotificationCount as useNotificationCountSSE, useNotifications, useOrganizationMembers, usePaginationState, usePatchTask, usePauseSchedule, useProject, useProjectActivities, useProjectMilestones, useProjectNotes, useProjectRealtime, useProjectTasks, useProjects, useReactivateMembership, useRecentExecutionsByResource, useRequest, useRequestsList, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useSyncDealStage, useTableSelection, useTableSort, useTasks, useTestNotification, useTimeRangeDates, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateProject as useUpdateDeliveryProject, useUpdateList, useUpdateListConfig, useUpdateMemberConfig, useUpdateMilestone, useUpdateRequestStatus, useUpdateSchedule, useUpdateTask, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
8279
- export type { AcqCompanyWithCount, AcqContactWithCompany, AcqDealNote, AcqDealTask, AcqDealTaskKind, ActivityFilters, ActivityTrendResponse, BulkDeleteExecutionsParams, BulkDeleteExecutionsResult, BusinessImpactMetrics, CancelExecutionParams, CancelExecutionResult, ChatMessage, CreateApiKeyRequest, CreateApiKeyResponse, CreateCredentialRequest, CreateCredentialResponse, CreateScheduleInput, CreateSessionResponse, CredentialListItem, DealDetail, DealLookupFilters, DealLookupItem, DealSummaryStageItem, DealsSummaryResponse, DeleteExecutionParams, Deployment, ErrorDistributionItem, ErrorDistributionParams, ErrorFilters, ErrorTrendsParams, ExecuteAsyncParams, ExecuteAsyncResult, ExecutionErrorDetails, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogsFilters, ExecutionLogsPageResponse, FailingResource, FeatureAccessResult, GetMessagesResponse, ListActivitiesResponse, ListApiKeysResponse, ListCredentialsResponse, ListSchedulesFilters, ListSchedulesResponse, ListWebhookEndpointsResponse, MessageEvent, MessageType, RequestRow, RequestsListFilters, ResourcesResponse, RetryExecutionParams, SessionDTO, SessionExecution, SessionExecutionsResponse, SessionListItem, SessionTokenUsage, SortDirection, SortState, StaleDealSummaryItem, StatusFilter, SubmitActionRequest, SubmitActionResponse, TaskSchedule, TopFailingResourcesParams, UpdateScheduleInput, UseActivitiesParams, UseActivityTrendParams, UseBatchedResourcesHealthParams, UseExecuteResourceOptions, UseExecutionHealthParams, UseExecutionLogsParams, UseExecutionPanelStateOptions, UseExecutionPanelStateReturn, UseNotificationCountArgs, UseResourcesHealthParams, UseSSEConnectionOptions, UseScheduledTasksOptions, WebSocketState };
8558
+ export { ApiKeyService, CredentialService, DeploymentService, OperationsService, OrganizationMembershipService, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, WebhookEndpointService, acquisitionListKeys, collectResourceFilterFacets, companyKeys, contactKeys, createFeatureAccessHook, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, getResourceFilterFacetIds, isSessionCapable, labelResourceFilterFacet, milestoneKeys, noteKeys, observabilityKeys, operationsKeys, projectActivityKeys, projectKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, taskKeys, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useArchiveSession, useArchivedLogs, useAssignRole, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, 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, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteProject as useDeleteDeliveryProject, useDeleteTask as useDeleteDeliveryTask, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteMilestone, useDeleteOrgRole, useDeleteRequest, useDeleteSchedule, useDeleteSession, useDeleteTask$1 as useDeleteTask, useDeleteWebhookEndpoint, useEffectivePermissions, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGraphStats, useHasPermission, useList, useListApiKeys, useListDeployments, useListExecutions, useListProgress, 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, 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, useSyncDealStage, useTableSelection, useTableSort, useTasks, useTestNotification, useTimeRangeDates, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateProject as useUpdateDeliveryProject, useUpdateList, useUpdateListConfig, useUpdateMemberConfig, useUpdateMilestone, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateTask, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
8559
+ export type { AcqCompanyWithCount, AcqContactWithCompany, AcqDealNote, AcqDealTask, AcqDealTaskKind, ActivityFilters, ActivityTrendResponse, AssignRoleInput, BulkDeleteExecutionsParams, BulkDeleteExecutionsResult, BusinessImpactMetrics, CancelExecutionParams, CancelExecutionResult, ChatMessage, CreateApiKeyRequest, CreateApiKeyResponse, CreateCredentialRequest, CreateCredentialResponse, CreateOrgRoleInput, CreateScheduleInput, CreateSessionResponse, CredentialListItem, DealDetail, DealLookupFilters, DealLookupItem, DealSummaryStageItem, DealsSummaryResponse, DeleteExecutionParams, Deployment, ErrorDistributionItem, ErrorDistributionParams, ErrorFilters, ErrorTrendsParams, ExecuteAsyncParams, ExecuteAsyncResult, ExecutionErrorDetails, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogsFilters, ExecutionLogsPageResponse, FailingResource, FeatureAccessResult, GetMessagesResponse, ListActivitiesResponse, ListApiKeysResponse, ListCredentialsResponse, ListSchedulesFilters, ListSchedulesResponse, ListWebhookEndpointsResponse, MessageEvent, MessageType, OrgRole, RequestRow, RequestsListFilters, ResourceFilterFacet, ResourcesResponse, RetryExecutionParams, RevokeRoleInput, SessionDTO, SessionExecution, SessionExecutionsResponse, SessionListItem, SessionTokenUsage, SortDirection, SortState, StaleDealSummaryItem, StatusFilter, SubmitActionRequest, SubmitActionResponse, TaskSchedule, TopFailingResourcesParams, UpdateOrgRoleInput, UpdateScheduleInput, UseActivitiesParams, UseActivityTrendParams, UseBatchedResourcesHealthParams, UseExecuteResourceOptions, UseExecutionHealthParams, UseExecutionLogsParams, UseExecutionPanelStateOptions, UseExecutionPanelStateReturn, UseNotificationCountArgs, UseResourcesHealthParams, UseSSEConnectionOptions, UseScheduledTasksOptions, WebSocketState };