@elevasis/ui 2.21.0 → 2.23.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 (81) hide show
  1. package/dist/app/index.js +2 -2
  2. package/dist/{chunk-DMYELNGA.js → chunk-3HEUGBOT.js} +1 -1
  3. package/dist/{chunk-EGKNRM6P.js → chunk-7PGEGSUM.js} +2 -2
  4. package/dist/{chunk-KVW56ERD.js → chunk-AXXTN44Z.js} +5 -3
  5. package/dist/{chunk-I5WRKH25.js → chunk-D3KQAABP.js} +1 -1
  6. package/dist/{chunk-S7RL77QS.js → chunk-DDZOHLHB.js} +1 -1
  7. package/dist/{chunk-EDX6WIN3.js → chunk-EPV7NU2E.js} +24 -10
  8. package/dist/{chunk-ATEHYDL3.js → chunk-FXWETLEB.js} +6 -2
  9. package/dist/{chunk-7GG6OSD7.js → chunk-GUJUK6EH.js} +2830 -2381
  10. package/dist/{chunk-GBMNCNHX.js → chunk-KVJ3LFH2.js} +3 -1
  11. package/dist/{chunk-VQESMHQV.js → chunk-LJWV4TWV.js} +1 -2
  12. package/dist/{chunk-BJWIKEQG.js → chunk-N6WLOWOD.js} +6 -14
  13. package/dist/{chunk-XLZZOFGM.js → chunk-PTUOINQ2.js} +275 -76
  14. package/dist/{chunk-CZK67OHH.js → chunk-PXGSJNBH.js} +3 -3
  15. package/dist/{chunk-TIIPYB2Z.js → chunk-QZJM3RYI.js} +1 -1
  16. package/dist/{chunk-7YQKVWSD.js → chunk-SQ5JGELM.js} +25 -5
  17. package/dist/{chunk-RX4UWZZR.js → chunk-TKAYX2SP.js} +8 -3
  18. package/dist/{chunk-Q5HC6ENG.js → chunk-XOTJNW4Q.js} +1 -1
  19. package/dist/{chunk-LQU62KHD.js → chunk-YU6MBDVO.js} +1993 -870
  20. package/dist/{chunk-ULZ2B3NC.js → chunk-ZBCTB5CA.js} +1 -1
  21. package/dist/components/index.css +85 -85
  22. package/dist/components/index.d.ts +1651 -1388
  23. package/dist/components/index.js +253 -40
  24. package/dist/components/navigation/index.css +589 -0
  25. package/dist/components/navigation/index.js +3 -3
  26. package/dist/features/auth/index.css +2 -2
  27. package/dist/features/auth/index.d.ts +188 -10
  28. package/dist/features/crm/index.css +2 -2
  29. package/dist/features/crm/index.d.ts +193 -10
  30. package/dist/features/crm/index.js +10 -10
  31. package/dist/features/dashboard/index.css +2 -2
  32. package/dist/features/dashboard/index.js +9 -9
  33. package/dist/features/delivery/index.css +85 -85
  34. package/dist/features/delivery/index.d.ts +193 -10
  35. package/dist/features/delivery/index.js +10 -10
  36. package/dist/features/lead-gen/index.css +2 -2
  37. package/dist/features/lead-gen/index.d.ts +5 -0
  38. package/dist/features/lead-gen/index.js +10 -10
  39. package/dist/features/monitoring/index.css +85 -85
  40. package/dist/features/monitoring/index.d.ts +6 -1
  41. package/dist/features/monitoring/index.js +11 -11
  42. package/dist/features/monitoring/requests/index.css +2 -2
  43. package/dist/features/monitoring/requests/index.d.ts +5 -0
  44. package/dist/features/monitoring/requests/index.js +9 -9
  45. package/dist/features/operations/index.css +2 -2
  46. package/dist/features/operations/index.d.ts +7 -4
  47. package/dist/features/operations/index.js +12 -12
  48. package/dist/features/seo/index.d.ts +5 -0
  49. package/dist/features/settings/index.css +2 -2
  50. package/dist/features/settings/index.d.ts +214 -16
  51. package/dist/features/settings/index.js +11 -11
  52. package/dist/graph/index.css +2 -2
  53. package/dist/hooks/delivery/index.css +2 -2
  54. package/dist/hooks/delivery/index.d.ts +188 -10
  55. package/dist/hooks/index.css +85 -85
  56. package/dist/hooks/index.d.ts +1843 -1538
  57. package/dist/hooks/index.js +8 -8
  58. package/dist/hooks/published.css +85 -85
  59. package/dist/hooks/published.d.ts +1843 -1538
  60. package/dist/hooks/published.js +8 -8
  61. package/dist/index.css +12 -12
  62. package/dist/index.d.ts +346 -35
  63. package/dist/index.js +9 -9
  64. package/dist/initialization/index.d.ts +188 -10
  65. package/dist/layout/index.js +2 -2
  66. package/dist/organization/index.css +589 -0
  67. package/dist/organization/index.js +1 -1
  68. package/dist/profile/index.d.ts +188 -10
  69. package/dist/provider/index.css +384 -0
  70. package/dist/provider/index.d.ts +6 -0
  71. package/dist/provider/index.js +7 -7
  72. package/dist/provider/published.css +463 -0
  73. package/dist/provider/published.d.ts +6 -0
  74. package/dist/provider/published.js +4 -4
  75. package/dist/supabase/index.d.ts +367 -20
  76. package/dist/test-utils/index.d.ts +46 -2
  77. package/dist/test-utils/index.js +102 -1
  78. package/dist/theme/index.js +2 -2
  79. package/dist/types/index.d.ts +199 -13
  80. package/package.json +4 -4
  81. /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
@@ -722,7 +875,6 @@ type Database = {
722
875
  acq_deals: {
723
876
  Row: {
724
877
  activity_log: Json;
725
- cached_stage: string | null;
726
878
  closed_lost_at: string | null;
727
879
  closed_lost_reason: string | null;
728
880
  contact_email: string;
@@ -737,6 +889,7 @@ type Database = {
737
889
  organization_id: string;
738
890
  payment_link_sent_at: string | null;
739
891
  payment_received_at: string | null;
892
+ pipeline_key: string;
740
893
  proposal_data: Json | null;
741
894
  proposal_generated_at: string | null;
742
895
  proposal_pdf_url: string | null;
@@ -744,10 +897,11 @@ type Database = {
744
897
  proposal_reviewed_by: string | null;
745
898
  proposal_sent_at: string | null;
746
899
  proposal_signed_at: string | null;
747
- proposal_status: string | null;
748
900
  signature_envelope_id: string | null;
749
901
  source_list_id: string | null;
750
902
  source_type: string | null;
903
+ stage_key: string | null;
904
+ state_key: string | null;
751
905
  stripe_payment_id: string | null;
752
906
  stripe_payment_link: string | null;
753
907
  stripe_payment_link_id: string | null;
@@ -756,7 +910,6 @@ type Database = {
756
910
  };
757
911
  Insert: {
758
912
  activity_log?: Json;
759
- cached_stage?: string | null;
760
913
  closed_lost_at?: string | null;
761
914
  closed_lost_reason?: string | null;
762
915
  contact_email: string;
@@ -771,6 +924,7 @@ type Database = {
771
924
  organization_id: string;
772
925
  payment_link_sent_at?: string | null;
773
926
  payment_received_at?: string | null;
927
+ pipeline_key?: string;
774
928
  proposal_data?: Json | null;
775
929
  proposal_generated_at?: string | null;
776
930
  proposal_pdf_url?: string | null;
@@ -778,10 +932,11 @@ type Database = {
778
932
  proposal_reviewed_by?: string | null;
779
933
  proposal_sent_at?: string | null;
780
934
  proposal_signed_at?: string | null;
781
- proposal_status?: string | null;
782
935
  signature_envelope_id?: string | null;
783
936
  source_list_id?: string | null;
784
937
  source_type?: string | null;
938
+ stage_key?: string | null;
939
+ state_key?: string | null;
785
940
  stripe_payment_id?: string | null;
786
941
  stripe_payment_link?: string | null;
787
942
  stripe_payment_link_id?: string | null;
@@ -790,7 +945,6 @@ type Database = {
790
945
  };
791
946
  Update: {
792
947
  activity_log?: Json;
793
- cached_stage?: string | null;
794
948
  closed_lost_at?: string | null;
795
949
  closed_lost_reason?: string | null;
796
950
  contact_email?: string;
@@ -805,6 +959,7 @@ type Database = {
805
959
  organization_id?: string;
806
960
  payment_link_sent_at?: string | null;
807
961
  payment_received_at?: string | null;
962
+ pipeline_key?: string;
808
963
  proposal_data?: Json | null;
809
964
  proposal_generated_at?: string | null;
810
965
  proposal_pdf_url?: string | null;
@@ -812,10 +967,11 @@ type Database = {
812
967
  proposal_reviewed_by?: string | null;
813
968
  proposal_sent_at?: string | null;
814
969
  proposal_signed_at?: string | null;
815
- proposal_status?: string | null;
816
970
  signature_envelope_id?: string | null;
817
971
  source_list_id?: string | null;
818
972
  source_type?: string | null;
973
+ stage_key?: string | null;
974
+ state_key?: string | null;
819
975
  stripe_payment_id?: string | null;
820
976
  stripe_payment_link?: string | null;
821
977
  stripe_payment_link_id?: string | null;
@@ -1984,6 +2140,7 @@ type Database = {
1984
2140
  Row: {
1985
2141
  config: Json;
1986
2142
  created_at: string | null;
2143
+ effective_permissions: string[];
1987
2144
  id: string;
1988
2145
  membership_status: string | null;
1989
2146
  organization_id: string;
@@ -1995,6 +2152,7 @@ type Database = {
1995
2152
  Insert: {
1996
2153
  config?: Json;
1997
2154
  created_at?: string | null;
2155
+ effective_permissions?: string[];
1998
2156
  id?: string;
1999
2157
  membership_status?: string | null;
2000
2158
  organization_id: string;
@@ -2006,6 +2164,7 @@ type Database = {
2006
2164
  Update: {
2007
2165
  config?: Json;
2008
2166
  created_at?: string | null;
2167
+ effective_permissions?: string[];
2009
2168
  id?: string;
2010
2169
  membership_status?: string | null;
2011
2170
  organization_id?: string;
@@ -2031,92 +2190,233 @@ type Database = {
2031
2190
  }
2032
2191
  ];
2033
2192
  };
2034
- organizations: {
2193
+ org_rol_assignments: {
2035
2194
  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;
2195
+ granted_at: string;
2196
+ granted_by: string | null;
2197
+ membership_id: string;
2198
+ role_id: string;
2045
2199
  };
2046
2200
  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;
2201
+ granted_at?: string;
2202
+ granted_by?: string | null;
2203
+ membership_id: string;
2204
+ role_id: string;
2056
2205
  };
2057
2206
  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;
2207
+ granted_at?: string;
2208
+ granted_by?: string | null;
2209
+ membership_id?: string;
2210
+ role_id?: string;
2067
2211
  };
2068
- Relationships: [];
2212
+ Relationships: [
2213
+ {
2214
+ foreignKeyName: "org_rol_assignments_granted_by_fkey";
2215
+ columns: ["granted_by"];
2216
+ isOneToOne: false;
2217
+ referencedRelation: "users";
2218
+ referencedColumns: ["id"];
2219
+ },
2220
+ {
2221
+ foreignKeyName: "org_rol_assignments_membership_id_fkey";
2222
+ columns: ["membership_id"];
2223
+ isOneToOne: false;
2224
+ referencedRelation: "org_memberships";
2225
+ referencedColumns: ["id"];
2226
+ },
2227
+ {
2228
+ foreignKeyName: "org_rol_assignments_role_id_fkey";
2229
+ columns: ["role_id"];
2230
+ isOneToOne: false;
2231
+ referencedRelation: "org_rol_definitions";
2232
+ referencedColumns: ["id"];
2233
+ }
2234
+ ];
2069
2235
  };
2070
- prj_milestones: {
2236
+ org_rol_definitions: {
2071
2237
  Row: {
2072
- checklist: Json | null;
2073
- completed_at: string | null;
2074
2238
  created_at: string;
2075
2239
  description: string | null;
2076
- due_date: string | null;
2077
2240
  id: string;
2078
- metadata: Json | null;
2241
+ is_system: boolean;
2079
2242
  name: string;
2080
- organization_id: string;
2081
- project_id: string;
2082
- sequence: number;
2083
- status: string;
2243
+ organization_id: string | null;
2244
+ slug: string;
2084
2245
  updated_at: string;
2085
2246
  };
2086
2247
  Insert: {
2087
- checklist?: Json | null;
2088
- completed_at?: string | null;
2089
2248
  created_at?: string;
2090
2249
  description?: string | null;
2091
- due_date?: string | null;
2092
2250
  id?: string;
2093
- metadata?: Json | null;
2251
+ is_system?: boolean;
2094
2252
  name: string;
2095
- organization_id: string;
2096
- project_id: string;
2097
- sequence?: number;
2098
- status?: string;
2253
+ organization_id?: string | null;
2254
+ slug: string;
2099
2255
  updated_at?: string;
2100
2256
  };
2101
2257
  Update: {
2102
- checklist?: Json | null;
2103
- completed_at?: string | null;
2104
2258
  created_at?: string;
2105
2259
  description?: string | null;
2106
- due_date?: string | null;
2107
2260
  id?: string;
2108
- metadata?: Json | null;
2261
+ is_system?: boolean;
2109
2262
  name?: string;
2110
- organization_id?: string;
2111
- project_id?: string;
2112
- sequence?: number;
2113
- status?: string;
2263
+ organization_id?: string | null;
2264
+ slug?: string;
2114
2265
  updated_at?: string;
2115
2266
  };
2116
2267
  Relationships: [
2117
2268
  {
2118
- foreignKeyName: "fk_milestones_project";
2119
- columns: ["project_id"];
2269
+ foreignKeyName: "org_rol_definitions_organization_id_fkey";
2270
+ columns: ["organization_id"];
2271
+ isOneToOne: false;
2272
+ referencedRelation: "organizations";
2273
+ referencedColumns: ["id"];
2274
+ }
2275
+ ];
2276
+ };
2277
+ org_rol_grants: {
2278
+ Row: {
2279
+ granted_at: string;
2280
+ permission_key: string;
2281
+ role_id: string;
2282
+ };
2283
+ Insert: {
2284
+ granted_at?: string;
2285
+ permission_key: string;
2286
+ role_id: string;
2287
+ };
2288
+ Update: {
2289
+ granted_at?: string;
2290
+ permission_key?: string;
2291
+ role_id?: string;
2292
+ };
2293
+ Relationships: [
2294
+ {
2295
+ foreignKeyName: "org_rol_grants_permission_key_fkey";
2296
+ columns: ["permission_key"];
2297
+ isOneToOne: false;
2298
+ referencedRelation: "org_rol_permissions";
2299
+ referencedColumns: ["key"];
2300
+ },
2301
+ {
2302
+ foreignKeyName: "org_rol_grants_role_id_fkey";
2303
+ columns: ["role_id"];
2304
+ isOneToOne: false;
2305
+ referencedRelation: "org_rol_definitions";
2306
+ referencedColumns: ["id"];
2307
+ }
2308
+ ];
2309
+ };
2310
+ org_rol_permissions: {
2311
+ Row: {
2312
+ created_at: string;
2313
+ description: string;
2314
+ is_org_grantable: boolean;
2315
+ key: string;
2316
+ updated_at: string;
2317
+ };
2318
+ Insert: {
2319
+ created_at?: string;
2320
+ description: string;
2321
+ is_org_grantable?: boolean;
2322
+ key: string;
2323
+ updated_at?: string;
2324
+ };
2325
+ Update: {
2326
+ created_at?: string;
2327
+ description?: string;
2328
+ is_org_grantable?: boolean;
2329
+ key?: string;
2330
+ updated_at?: string;
2331
+ };
2332
+ Relationships: [];
2333
+ };
2334
+ organizations: {
2335
+ Row: {
2336
+ config: Json;
2337
+ created_at: string;
2338
+ id: string;
2339
+ is_test: boolean;
2340
+ metadata: Json;
2341
+ name: string;
2342
+ status: string;
2343
+ updated_at: string;
2344
+ workos_org_id: string;
2345
+ };
2346
+ Insert: {
2347
+ config?: Json;
2348
+ created_at?: string;
2349
+ id?: string;
2350
+ is_test?: boolean;
2351
+ metadata?: Json;
2352
+ name: string;
2353
+ status?: string;
2354
+ updated_at?: string;
2355
+ workos_org_id: string;
2356
+ };
2357
+ Update: {
2358
+ config?: Json;
2359
+ created_at?: string;
2360
+ id?: string;
2361
+ is_test?: boolean;
2362
+ metadata?: Json;
2363
+ name?: string;
2364
+ status?: string;
2365
+ updated_at?: string;
2366
+ workos_org_id?: string;
2367
+ };
2368
+ Relationships: [];
2369
+ };
2370
+ prj_milestones: {
2371
+ Row: {
2372
+ checklist: Json | null;
2373
+ completed_at: string | null;
2374
+ created_at: string;
2375
+ description: string | null;
2376
+ due_date: string | null;
2377
+ id: string;
2378
+ metadata: Json | null;
2379
+ name: string;
2380
+ organization_id: string;
2381
+ project_id: string;
2382
+ sequence: number;
2383
+ status: string;
2384
+ updated_at: string;
2385
+ };
2386
+ Insert: {
2387
+ checklist?: Json | null;
2388
+ completed_at?: string | null;
2389
+ created_at?: string;
2390
+ description?: string | null;
2391
+ due_date?: string | null;
2392
+ id?: string;
2393
+ metadata?: Json | null;
2394
+ name: string;
2395
+ organization_id: string;
2396
+ project_id: string;
2397
+ sequence?: number;
2398
+ status?: string;
2399
+ updated_at?: string;
2400
+ };
2401
+ Update: {
2402
+ checklist?: Json | null;
2403
+ completed_at?: string | null;
2404
+ created_at?: string;
2405
+ description?: string | null;
2406
+ due_date?: string | null;
2407
+ id?: string;
2408
+ metadata?: Json | null;
2409
+ name?: string;
2410
+ organization_id?: string;
2411
+ project_id?: string;
2412
+ sequence?: number;
2413
+ status?: string;
2414
+ updated_at?: string;
2415
+ };
2416
+ Relationships: [
2417
+ {
2418
+ foreignKeyName: "fk_milestones_project";
2419
+ columns: ["project_id"];
2120
2420
  isOneToOne: false;
2121
2421
  referencedRelation: "prj_projects";
2122
2422
  referencedColumns: ["id"];
@@ -2788,7 +3088,8 @@ type Database = {
2788
3088
  created_at: string;
2789
3089
  description: string | null;
2790
3090
  id: string;
2791
- key: string;
3091
+ key_hash: string;
3092
+ key_prefix: string | null;
2792
3093
  last_triggered_at: string | null;
2793
3094
  name: string;
2794
3095
  organization_id: string;
@@ -2801,7 +3102,8 @@ type Database = {
2801
3102
  created_at?: string;
2802
3103
  description?: string | null;
2803
3104
  id?: string;
2804
- key: string;
3105
+ key_hash: string;
3106
+ key_prefix?: string | null;
2805
3107
  last_triggered_at?: string | null;
2806
3108
  name: string;
2807
3109
  organization_id: string;
@@ -2814,7 +3116,8 @@ type Database = {
2814
3116
  created_at?: string;
2815
3117
  description?: string | null;
2816
3118
  id?: string;
2817
- key?: string;
3119
+ key_hash?: string;
3120
+ key_prefix?: string | null;
2818
3121
  last_triggered_at?: string | null;
2819
3122
  name?: string;
2820
3123
  organization_id?: string;
@@ -2860,6 +3163,13 @@ type Database = {
2860
3163
  Args: never;
2861
3164
  Returns: string;
2862
3165
  };
3166
+ can_assign_role_in_org: {
3167
+ Args: {
3168
+ p_role_id: string;
3169
+ p_target_membership_id: string;
3170
+ };
3171
+ Returns: boolean;
3172
+ };
2863
3173
  current_user_is_platform_admin: {
2864
3174
  Args: never;
2865
3175
  Returns: boolean;
@@ -2889,6 +3199,10 @@ type Database = {
2889
3199
  user_id: string;
2890
3200
  }[];
2891
3201
  };
3202
+ get_platform_credential_kek: {
3203
+ Args: never;
3204
+ Returns: string;
3205
+ };
2892
3206
  get_storage_org_id: {
2893
3207
  Args: {
2894
3208
  file_path: string;
@@ -2899,9 +3213,10 @@ type Database = {
2899
3213
  Args: never;
2900
3214
  Returns: string;
2901
3215
  };
2902
- is_org_admin: {
3216
+ has_org_permission: {
2903
3217
  Args: {
2904
3218
  org_id: string;
3219
+ perm_key: string;
2905
3220
  };
2906
3221
  Returns: boolean;
2907
3222
  };
@@ -2931,6 +3246,22 @@ type Database = {
2931
3246
  Args: never;
2932
3247
  Returns: Json;
2933
3248
  };
3249
+ recompute_all_memberships: {
3250
+ Args: never;
3251
+ Returns: undefined;
3252
+ };
3253
+ sync_all_memberships_with_role: {
3254
+ Args: {
3255
+ p_role_id: string;
3256
+ };
3257
+ Returns: undefined;
3258
+ };
3259
+ sync_one_membership: {
3260
+ Args: {
3261
+ p_membership_id: string;
3262
+ };
3263
+ Returns: undefined;
3264
+ };
2934
3265
  upsert_user_profile: {
2935
3266
  Args: never;
2936
3267
  Returns: {
@@ -2963,793 +3294,963 @@ type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables
2963
3294
  Row: infer R;
2964
3295
  } ? R : never : never;
2965
3296
 
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;
3297
+ type SupabaseUserProfile = Tables<'users'>;
3298
+ type SupabaseApiKey = Tables<'api_keys'>;
3299
+ /** API response type for API key list items (omits sensitive key_hash) */
3300
+ type ApiKeyListItem = Omit<SupabaseApiKey, 'key_hash'>;
3301
+
3302
+ /** Raw database row type for acq_deals table */
3303
+ type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
3304
+ type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing';
3305
+ interface DealContact {
3306
+ id: string;
3307
+ first_name: string | null;
3308
+ last_name: string | null;
3309
+ email: string;
3310
+ title: string | null;
3311
+ headline: string | null;
3312
+ linkedin_url: string | null;
3313
+ pipeline_status: Record<string, unknown> | null;
3314
+ enrichment_data: Record<string, unknown> | null;
3315
+ company: {
3316
+ id: string;
3009
3317
  name: string;
3010
- errorCount: number;
3011
- failureRate: number;
3012
- }>;
3318
+ domain: string | null;
3319
+ website: string | null;
3320
+ linkedin_url: string | null;
3321
+ segment: string | null;
3322
+ category: string | null;
3323
+ num_employees: number | null;
3324
+ } | null;
3013
3325
  }
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;
3326
+ interface DealFilters {
3327
+ stage?: DealStage;
3328
+ search?: string;
3329
+ limit?: number;
3330
+ offset?: number;
3023
3331
  }
3332
+ /** Deal list item with joined contact and company data */
3333
+ interface DealListItem extends AcqDealRow {
3334
+ contact: DealContact | null;
3335
+ }
3336
+ type DealDetail = DealListItem;
3337
+ /** Task kind options for a deal task (human follow-up action type) */
3338
+ type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
3024
3339
  /**
3025
- * Cost breakdown metrics response
3026
- * Per-resource cost analysis
3340
+ * A CRM to-do item attached to a deal representing a human follow-up action.
3341
+ * Transformed from AcqDealTaskRow with camelCase properties.
3027
3342
  */
3028
- interface CostBreakdownMetrics {
3029
- resources: Array<{
3030
- resourceId: string;
3031
- totalCostUsd: number;
3032
- executionCount: number;
3033
- avgCostUsd: number;
3034
- }>;
3343
+ interface AcqDealTask {
3344
+ id: string;
3345
+ organizationId: string;
3346
+ dealId: string;
3347
+ title: string;
3348
+ description: string | null;
3349
+ kind: AcqDealTaskKind;
3350
+ dueAt: string | null;
3351
+ assigneeUserId: string | null;
3352
+ completedAt: string | null;
3353
+ completedByUserId: string | null;
3354
+ createdAt: string;
3355
+ updatedAt: string;
3356
+ createdByUserId: string | null;
3035
3357
  }
3036
3358
  /**
3037
- * Dashboard metrics response
3038
- * Aggregates core observability metrics in a single response
3039
- * Note: Throughput data is now included in executionHealth.trendData.executionCount
3359
+ * Live-scan aggregate telemetry for a single list, computed on demand from
3360
+ * the list junction tables and current contact deliverability state.
3040
3361
  */
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;
3362
+ interface ListTelemetry {
3363
+ listId: string;
3364
+ totalCompanies: number;
3365
+ totalContacts: number;
3366
+ stageCounts: {
3367
+ populated: number;
3368
+ extracted: number;
3369
+ qualified: number;
3370
+ discovered: number;
3371
+ verified: number;
3372
+ personalized: number;
3373
+ uploaded: number;
3374
+ };
3375
+ deliverability: {
3376
+ valid: number;
3377
+ risky: number;
3378
+ invalid: number;
3379
+ unknown: number;
3380
+ bounced: number;
3381
+ };
3382
+ /** Reserved -- active workflow IDs associated with this list. */
3383
+ activeWorkflows?: string[];
3049
3384
  }
3385
+
3050
3386
  /**
3051
- * Error record for list view (ErrorBreakdownTable)
3387
+ * Lead Service Types
3388
+ * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
3389
+ *
3390
+ * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
3052
3391
  */
3053
- interface ErrorRecord {
3392
+
3393
+ interface AcqDealNote {
3054
3394
  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;
3395
+ dealId: string;
3396
+ organizationId: string;
3397
+ authorUserId: string | null;
3398
+ body: string;
3399
+ createdAt: string;
3400
+ updatedAt: string;
3066
3401
  }
3402
+
3067
3403
  /**
3068
- * Full error detail for modal view (ErrorDetailsModal)
3404
+ * Action configuration for HITL tasks
3405
+ * Defines available user actions and their behavior
3069
3406
  */
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>;
3407
+ interface ActionConfig {
3408
+ /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
3409
+ id: string;
3410
+ /** Display label for UI button */
3411
+ label: string;
3412
+ /** Button variant/style */
3413
+ type: 'primary' | 'secondary' | 'danger' | 'outline';
3414
+ /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
3415
+ icon?: string;
3416
+ /** Button color (Mantine theme colors) */
3417
+ color?: string;
3418
+ /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
3419
+ variant?: string;
3420
+ /** Execution target (agent/workflow to invoke) */
3421
+ target?: {
3422
+ resourceType: 'agent' | 'workflow';
3423
+ resourceId: string;
3424
+ /**
3425
+ * Optional session ID for agent continuation.
3426
+ * If provided, invokes a new turn on the existing session instead of standalone execution.
3427
+ * Only valid when resourceType is 'agent'.
3428
+ */
3429
+ sessionId?: string;
3430
+ };
3431
+ /** Form schema for collecting action-specific data */
3432
+ form?: FormSchema;
3433
+ /** Payload template for pre-filling forms */
3434
+ payloadTemplate?: unknown;
3435
+ /** Requires confirmation dialog */
3436
+ requiresConfirmation?: boolean;
3437
+ /** Confirmation message */
3438
+ confirmationMessage?: string;
3439
+ /** Help text / tooltip */
3440
+ description?: string;
3077
3441
  }
3442
+
3078
3443
  /**
3079
- * Error details API response (paginated)
3444
+ * Origin resource type - where an execution/task originated from.
3445
+ * Used for audit trails and tracking execution lineage.
3080
3446
  */
3081
- interface ErrorDetailResponse {
3082
- errors: ErrorRecord[];
3083
- total: number;
3084
- page: number;
3085
- limit: number;
3086
- }
3447
+ type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
3087
3448
  /**
3088
- * Error trend data for time-series charts
3449
+ * Origin tracking metadata - who/what created this execution/task.
3450
+ * Used by both TaskScheduler and CommandQueue for complete audit trails.
3089
3451
  */
3090
- interface ErrorTrend {
3091
- time: string;
3092
- errorCount: number;
3093
- criticalCount: number;
3094
- warningCount: number;
3095
- infoCount: number;
3452
+ interface OriginTracking {
3453
+ originExecutionId: string;
3454
+ originResourceType: OriginResourceType;
3455
+ originResourceId: string;
3096
3456
  }
3457
+
3097
3458
  /**
3098
- * Summary of executions for a single resource
3099
- * Used by RecentExecutionsByResource dashboard component
3459
+ * Command queue task with flexible action system
3100
3460
  */
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;
3461
+ interface Task extends OriginTracking {
3462
+ id: string;
3463
+ organizationId: string;
3464
+ actions: ActionConfig[];
3465
+ context: unknown;
3466
+ selectedAction?: string;
3467
+ actionPayload?: unknown;
3468
+ description?: string;
3469
+ priority: number;
3470
+ /** Optional checkpoint identifier for grouping related human approval tasks */
3471
+ humanCheckpoint?: string;
3472
+ status: QueueTaskStatus;
3473
+ /**
3474
+ * Target resource tracking — mirrors origin columns.
3475
+ * Set when task is created; patchable to redirect execution to a different resource.
3476
+ */
3477
+ targetResourceId?: string;
3478
+ targetResourceType?: 'agent' | 'workflow';
3479
+ /**
3480
+ * Execution ID for the action that runs AFTER user approval.
3481
+ * NULL until execution starts.
3482
+ *
3483
+ * Naming distinction:
3484
+ * - originExecutionId = Parent execution that CREATED the HITL task
3485
+ * - targetExecutionId = Child execution that RUNS AFTER user approval
3486
+ */
3487
+ targetExecutionId?: string;
3488
+ createdAt: Date;
3489
+ completedAt?: Date;
3490
+ completedBy?: string;
3491
+ expiresAt?: Date;
3492
+ idempotencyKey?: string | null;
3111
3493
  }
3112
3494
  /**
3113
- * Response from getRecentExecutionsByResource endpoint
3495
+ * Task status values
3496
+ * - pending: awaiting action
3497
+ * - processing: execution in progress after user approval
3498
+ * - completed: action was taken and execution succeeded
3499
+ * - failed: execution failed, task can be retried
3500
+ * - expired: timed out before action
3114
3501
  */
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
- };
3141
- }
3142
- /** Batch response with all requested resources */
3143
- interface ResourcesHealthResponse {
3144
- resources: ResourceHealth[];
3145
- }
3502
+ type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
3146
3503
  /**
3147
- * Cost trend data point for time-series charts
3148
- * Represents a single time bucket (hour or day)
3504
+ * Parameters for patching mutable metadata on a task
3149
3505
  */
3150
- interface CostTrendDataPoint {
3151
- time: string;
3152
- totalCostUsd: number;
3153
- executionCount: number;
3154
- avgCostPerExecution: number;
3506
+ interface PatchTaskParams {
3507
+ humanCheckpoint?: string | null;
3508
+ description?: string;
3509
+ priority?: number;
3510
+ context?: Record<string, unknown>;
3511
+ actions?: unknown[];
3512
+ targetResourceId?: string | null;
3513
+ targetResourceType?: 'agent' | 'workflow' | null;
3514
+ targetExecutionId?: string;
3515
+ status?: 'pending' | 'failed' | 'completed';
3516
+ }
3517
+ interface CommandQueueListResponse {
3518
+ tasks: Task[];
3519
+ total: number;
3155
3520
  }
3521
+
3156
3522
  /**
3157
- * Cost trends response (time-series data)
3158
- */
3159
- interface CostTrendsResponse {
3160
- trendData: CostTrendDataPoint[];
3161
- granularity: 'hour' | 'day';
3162
- totalCostUsd: number;
3163
- totalExecutions: number;
3523
+ * Checkpoint list item for sidebar grouping
3524
+ * The id field contains the resourceId of the human checkpoint
3525
+ */
3526
+ interface CheckpointListItem {
3527
+ /** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
3528
+ id: string;
3529
+ /** Display name (same as id, or "Ungrouped" for null) */
3530
+ name: string;
3531
+ /** Task count for this checkpoint */
3532
+ count: number;
3164
3533
  }
3165
3534
  /**
3166
- * Cost summary response with MTD and projections
3535
+ * Status counts for pie chart display
3167
3536
  */
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
- };
3537
+ interface StatusCounts {
3538
+ pending: number;
3539
+ completed: number;
3540
+ expired: number;
3189
3541
  }
3190
3542
  /**
3191
- * Cost by model data for model-level breakdown
3543
+ * Priority counts for donut chart display
3192
3544
  */
3193
- interface CostByModelData {
3194
- model: string;
3195
- totalCostUsd: number;
3196
- callCount: number;
3197
- totalInputTokens: number;
3198
- totalOutputTokens: number;
3199
- avgCostPerCall: number;
3545
+ interface PriorityCounts {
3546
+ critical: number;
3547
+ high: number;
3548
+ medium: number;
3549
+ low: number;
3200
3550
  }
3201
3551
  /**
3202
- * Cost by model response
3552
+ * Response from GET /command-queue/checkpoints endpoint
3203
3553
  */
3204
- interface CostByModelResponse {
3205
- models: CostByModelData[];
3206
- totalCostUsd: number;
3207
- totalCallCount: number;
3554
+ interface CheckpointListResponse {
3555
+ checkpoints: CheckpointListItem[];
3556
+ /** Total tasks across all checkpoints */
3557
+ total: number;
3558
+ /** Breakdown by status for donut chart */
3559
+ statusCounts: StatusCounts;
3560
+ /** Breakdown by priority for donut chart */
3561
+ priorityCounts: PriorityCounts;
3208
3562
  }
3209
3563
 
3210
3564
  /**
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.
3565
+ * Target for schedule execution - identifies what resource to execute.
3566
+ * Unlike ExecutionTarget, payload is NOT included here because schedules
3567
+ * store payload in the scheduleConfig (varies per step/item).
3218
3568
  */
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
- declare const LinkSchema: z.ZodObject<{
3222
- nodeId: z.ZodString;
3223
- kind: z.ZodEnum<{
3224
- contains: "contains";
3225
- references: "references";
3226
- exposes: "exposes";
3227
- maps_to: "maps_to";
3228
- "operates-on": "operates-on";
3229
- uses: "uses";
3230
- }>;
3231
- }, z.core.$strip>;
3232
- type Link = z.infer<typeof LinkSchema>;
3233
-
3234
- declare const ResourceCategorySchema: z.ZodEnum<{
3235
- production: "production";
3236
- diagnostic: "diagnostic";
3237
- internal: "internal";
3238
- testing: "testing";
3239
- }>;
3240
- type ResourceCategory = z.infer<typeof ResourceCategorySchema>;
3241
- type ResourceLink = Link;
3242
-
3569
+ interface ScheduleTarget {
3570
+ resourceType: 'agent' | 'workflow';
3571
+ resourceId: string;
3572
+ }
3243
3573
  /**
3244
- * Resource Registry type definitions
3574
+ * Optional origin tracking for schedules.
3575
+ * Unlike OriginTracking (which is required), these fields are all optional
3576
+ * for schedules created directly via API (not triggered by another resource).
3245
3577
  */
3578
+ interface ScheduleOriginTracking {
3579
+ originExecutionId?: string;
3580
+ originResourceType?: OriginResourceType;
3581
+ originResourceId?: string;
3582
+ }
3583
+ type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
3584
+ interface RecurringScheduleConfig {
3585
+ type: 'recurring';
3586
+ cron?: string;
3587
+ interval?: 'daily' | 'weekly' | 'monthly';
3588
+ time?: string;
3589
+ timezone: string;
3590
+ payload: Record<string, unknown>;
3591
+ endAt?: string | null;
3592
+ overduePolicy?: 'skip' | 'execute';
3593
+ }
3594
+ interface RelativeScheduleConfig {
3595
+ type: 'relative';
3596
+ anchorAt: string;
3597
+ anchorLabel?: string;
3598
+ items: RelativeScheduleItem[];
3599
+ overduePolicy?: 'skip' | 'execute';
3600
+ }
3601
+ interface RelativeScheduleItem {
3602
+ offset: string;
3603
+ payload: Record<string, unknown>;
3604
+ label?: string;
3605
+ }
3606
+ interface AbsoluteScheduleConfig {
3607
+ type: 'absolute';
3608
+ items: AbsoluteScheduleItem[];
3609
+ overduePolicy?: 'skip' | 'execute';
3610
+ }
3611
+ interface AbsoluteScheduleItem {
3612
+ runAt: string;
3613
+ payload: Record<string, unknown>;
3614
+ label?: string;
3615
+ }
3616
+ interface TaskSchedule extends ScheduleOriginTracking {
3617
+ id: string;
3618
+ organizationId: string;
3619
+ name: string;
3620
+ description?: string;
3621
+ target: ScheduleTarget;
3622
+ scheduleConfig: TaskScheduleConfig;
3623
+ nextRunAt?: Date;
3624
+ currentStep: number;
3625
+ status: 'active' | 'paused' | 'completed' | 'cancelled';
3626
+ lastRunAt?: Date;
3627
+ lastExecutionId?: string;
3628
+ maxRetries: number;
3629
+ idempotencyKey?: string;
3630
+ createdAt: Date;
3631
+ updatedAt: Date;
3632
+ }
3246
3633
 
3247
3634
  /**
3248
- * Environment/deployment status for resources
3249
- */
3250
- type ResourceStatus = 'dev' | 'prod';
3251
- /**
3252
- * All resource types in the platform
3253
- * Used as the discriminator field in ResourceDefinition
3254
- */
3255
- type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
3256
- /**
3257
- * Base interface for ALL platform resources
3258
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
3635
+ * Wire-format DTO for notification API responses.
3636
+ * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
3637
+ * Used by frontend hooks that consume /api/notifications.
3259
3638
  */
3260
- interface ResourceDefinition {
3261
- /** Unique resource identifier */
3262
- resourceId: string;
3263
- /** Display name */
3264
- name: string;
3265
- /** Purpose and functionality description */
3266
- description: string;
3267
- /** Version for change tracking and evolution */
3268
- version: string;
3269
- /** Resource type discriminator */
3270
- type: ResourceType;
3271
- /** Environment/deployment status */
3272
- status: ResourceStatus;
3273
- /** Graph links to Organization Model nodes */
3274
- links?: ResourceLink[];
3275
- /** Infrastructure category for filtering */
3276
- category?: ResourceCategory;
3277
- /** Whether the agent supports multi-turn sessions (agents only) */
3278
- sessionCapable?: boolean;
3279
- /** Whether the resource is local (monorepo) or remote (externally deployed) */
3280
- origin?: 'local' | 'remote';
3281
- /** Whether this resource is archived and should be excluded from registration and deployment */
3282
- archived?: boolean;
3639
+ interface NotificationDTO {
3640
+ id: string;
3641
+ userId: string;
3642
+ organizationId: string;
3643
+ category: string;
3644
+ title: string;
3645
+ message: string;
3646
+ actionUrl: string | null;
3647
+ read: boolean;
3648
+ readAt: string | null;
3649
+ createdAt: string;
3283
3650
  }
3284
- /** Webhook provider identifiers */
3285
- type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test';
3286
- /** Webhook trigger configuration */
3287
- interface WebhookTriggerConfig {
3288
- /** Provider identifier */
3289
- provider: WebhookProviderType;
3290
- /** Event type for documentation (not used for matching - workflow handles routing) */
3291
- event?: string;
3292
- /** Optional filtering (e.g., specific form ID for Fillout) */
3293
- filter?: Record<string, string>;
3294
- /** References credential in credentials table for per-org webhook secrets */
3295
- credentialName?: string;
3651
+
3652
+ type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
3653
+ type ProjectUpdate = Database['public']['Tables']['prj_projects']['Update'];
3654
+ type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
3655
+ type MilestoneUpdate = Database['public']['Tables']['prj_milestones']['Update'];
3656
+ type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
3657
+ type TaskUpdate = Database['public']['Tables']['prj_tasks']['Update'];
3658
+ type ProjectStatus = 'active' | 'on_track' | 'at_risk' | 'blocked' | 'completed' | 'paused';
3659
+ type ProjectKind = 'client_engagement' | 'internal' | 'research' | 'other';
3660
+ type MilestoneStatus = 'upcoming' | 'in_progress' | 'completed' | 'overdue' | 'blocked';
3661
+ type TaskStatus = 'planned' | 'in_progress' | 'blocked' | 'completed' | 'cancelled' | 'submitted' | 'approved' | 'rejected' | 'revision_requested';
3662
+ type TaskType = 'documentation' | 'code' | 'report' | 'design' | 'other';
3663
+ type NoteType = 'call_note' | 'status_update' | 'issue' | 'blocker' | 'agent_learning';
3664
+ interface ProjectFilters {
3665
+ status?: ProjectStatus;
3666
+ kind?: ProjectKind;
3667
+ companyId?: string;
3668
+ search?: string;
3296
3669
  }
3297
- /** Schedule trigger configuration */
3298
- interface ScheduleTriggerConfig {
3299
- /** Cron expression (e.g., '0 6 * * *') */
3300
- cron: string;
3301
- /** Optional timezone (default: UTC) */
3302
- timezone?: string;
3670
+ interface MilestoneFilters {
3671
+ status?: MilestoneStatus;
3672
+ projectId?: string;
3303
3673
  }
3304
- /** Event trigger configuration */
3305
- interface EventTriggerConfig {
3306
- /** Internal event type */
3307
- eventType: string;
3308
- /** Event source */
3309
- source?: string;
3674
+ interface TaskFilters {
3675
+ status?: TaskStatus;
3676
+ type?: TaskType;
3677
+ milestoneId?: string;
3678
+ projectId?: string;
3310
3679
  }
3311
- /** Union of all trigger configs */
3312
- type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig;
3680
+ interface NoteFilters {
3681
+ type?: NoteType;
3682
+ projectId?: string;
3683
+ }
3684
+ interface ProjectWithCounts extends ProjectRow {
3685
+ milestoneCount: number;
3686
+ taskCount: number;
3687
+ completedMilestones?: number;
3688
+ completedTasks?: number;
3689
+ }
3690
+ interface ProjectDetail extends ProjectRow {
3691
+ milestones: MilestoneRow[];
3692
+ tasks: TaskRow[];
3693
+ company: {
3694
+ id: string;
3695
+ name: string;
3696
+ domain: string | null;
3697
+ } | null;
3698
+ }
3699
+
3700
+ declare const ListCompaniesQuerySchema: z.ZodObject<{
3701
+ search: z.ZodOptional<z.ZodString>;
3702
+ listId: z.ZodOptional<z.ZodString>;
3703
+ domain: z.ZodOptional<z.ZodString>;
3704
+ website: z.ZodOptional<z.ZodString>;
3705
+ segment: z.ZodOptional<z.ZodString>;
3706
+ category: z.ZodOptional<z.ZodString>;
3707
+ batchId: z.ZodOptional<z.ZodString>;
3708
+ status: z.ZodOptional<z.ZodEnum<{
3709
+ active: "active";
3710
+ invalid: "invalid";
3711
+ }>>;
3712
+ includeAll: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
3713
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3714
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3715
+ }, z.core.$strict>;
3716
+ declare const ListContactsQuerySchema: z.ZodObject<{
3717
+ search: z.ZodOptional<z.ZodString>;
3718
+ listId: z.ZodOptional<z.ZodString>;
3719
+ openingLineIsNull: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
3720
+ batchId: z.ZodOptional<z.ZodString>;
3721
+ contactStatus: z.ZodOptional<z.ZodEnum<{
3722
+ active: "active";
3723
+ invalid: "invalid";
3724
+ }>>;
3725
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3726
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3727
+ }, z.core.$strict>;
3728
+ declare const AcqCompanyResponseSchema: z.ZodObject<{
3729
+ id: z.ZodString;
3730
+ organizationId: z.ZodString;
3731
+ name: z.ZodString;
3732
+ domain: z.ZodNullable<z.ZodString>;
3733
+ linkedinUrl: z.ZodNullable<z.ZodString>;
3734
+ website: z.ZodNullable<z.ZodString>;
3735
+ numEmployees: z.ZodNullable<z.ZodNumber>;
3736
+ foundedYear: z.ZodNullable<z.ZodNumber>;
3737
+ locationCity: z.ZodNullable<z.ZodString>;
3738
+ locationState: z.ZodNullable<z.ZodString>;
3739
+ category: z.ZodNullable<z.ZodString>;
3740
+ categoryPain: z.ZodNullable<z.ZodString>;
3741
+ segment: z.ZodNullable<z.ZodString>;
3742
+ pipelineStatus: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3743
+ enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3744
+ source: z.ZodNullable<z.ZodString>;
3745
+ batchId: z.ZodNullable<z.ZodString>;
3746
+ status: z.ZodEnum<{
3747
+ active: "active";
3748
+ invalid: "invalid";
3749
+ }>;
3750
+ contactCount: z.ZodNumber;
3751
+ verticalResearch: z.ZodNullable<z.ZodString>;
3752
+ createdAt: z.ZodString;
3753
+ updatedAt: z.ZodString;
3754
+ }, z.core.$strip>;
3755
+ declare const AcqContactResponseSchema: z.ZodObject<{
3756
+ id: z.ZodString;
3757
+ organizationId: z.ZodString;
3758
+ companyId: z.ZodNullable<z.ZodString>;
3759
+ email: z.ZodString;
3760
+ emailValid: z.ZodNullable<z.ZodEnum<{
3761
+ VALID: "VALID";
3762
+ INVALID: "INVALID";
3763
+ RISKY: "RISKY";
3764
+ UNKNOWN: "UNKNOWN";
3765
+ }>>;
3766
+ firstName: z.ZodNullable<z.ZodString>;
3767
+ lastName: z.ZodNullable<z.ZodString>;
3768
+ linkedinUrl: z.ZodNullable<z.ZodString>;
3769
+ title: z.ZodNullable<z.ZodString>;
3770
+ headline: z.ZodNullable<z.ZodString>;
3771
+ filterReason: z.ZodNullable<z.ZodString>;
3772
+ openingLine: z.ZodNullable<z.ZodString>;
3773
+ source: z.ZodNullable<z.ZodString>;
3774
+ sourceId: z.ZodNullable<z.ZodString>;
3775
+ pipelineStatus: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3776
+ enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3777
+ attioPersonId: z.ZodNullable<z.ZodString>;
3778
+ batchId: z.ZodNullable<z.ZodString>;
3779
+ status: z.ZodEnum<{
3780
+ active: "active";
3781
+ invalid: "invalid";
3782
+ }>;
3783
+ company: z.ZodOptional<z.ZodNullable<z.ZodObject<{
3784
+ id: z.ZodString;
3785
+ name: z.ZodString;
3786
+ domain: z.ZodNullable<z.ZodString>;
3787
+ website: z.ZodNullable<z.ZodString>;
3788
+ linkedinUrl: z.ZodNullable<z.ZodString>;
3789
+ segment: z.ZodNullable<z.ZodString>;
3790
+ category: z.ZodNullable<z.ZodString>;
3791
+ status: z.ZodEnum<{
3792
+ active: "active";
3793
+ invalid: "invalid";
3794
+ }>;
3795
+ }, z.core.$strip>>>;
3796
+ createdAt: z.ZodString;
3797
+ updatedAt: z.ZodString;
3798
+ }, z.core.$strip>;
3799
+ type ListCompaniesQuery = z.infer<typeof ListCompaniesQuerySchema>;
3800
+ type ListContactsQuery = z.infer<typeof ListContactsQuerySchema>;
3801
+ type AcqCompanyResponse = z.infer<typeof AcqCompanyResponseSchema>;
3802
+ type AcqContactResponse = z.infer<typeof AcqContactResponseSchema>;
3803
+
3804
+ type MessageType = MessageEvent['type'];
3313
3805
  /**
3314
- * Trigger metadata - entry points that initiate resource execution
3315
- *
3316
- * Triggers represent how executions start: webhooks from external services,
3317
- * scheduled cron jobs, platform events, or manual user actions.
3318
- *
3319
- * BREAKING CHANGES (2025-11-30):
3320
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
3321
- * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
3322
- * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
3323
- * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
3324
- * - triggers object now includes `externalResources` option
3325
- *
3326
- * @example
3327
- * // TriggerDefinition - metadata only
3328
- * {
3329
- * resourceId: 'trigger-new-order',
3330
- * type: 'trigger',
3331
- * triggerType: 'webhook',
3332
- * name: 'New Order',
3333
- * description: 'Webhook from Shopify on new orders',
3334
- * version: '1.0.0',
3335
- * status: 'prod',
3336
- * webhookPath: '/webhooks/shopify/orders'
3337
- * }
3338
- *
3339
- * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
3340
- * // relationships: {
3341
- * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
3342
- * // }
3806
+ * Session Data Transfer Object (DTO)
3807
+ * Transform type for API responses (snake_case DB → camelCase frontend)
3808
+ * Used by frontend apps to display session data
3343
3809
  */
3344
- interface TriggerDefinition extends ResourceDefinition {
3345
- /** Resource type discriminator (narrowed from base union) */
3346
- type: 'trigger';
3347
- /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
3348
- triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
3349
- /** Type-specific configuration */
3350
- config?: TriggerConfig;
3351
- /** For webhook triggers: path like '/webhooks/shopify/orders' */
3352
- webhookPath?: string;
3353
- /** For schedule triggers: cron expression like '0 6 * * *' */
3354
- schedule?: string;
3355
- /** For event triggers: event type like 'low-stock-alert' */
3356
- eventType?: string;
3810
+ interface SessionDTO {
3811
+ sessionId: string;
3812
+ resourceId: string;
3813
+ organizationId: string;
3814
+ userId?: string | null;
3815
+ turnCount: number;
3816
+ isEnded: boolean;
3817
+ title?: string | null;
3818
+ memorySnapshot?: AgentMemory;
3819
+ metadata?: Record<string, unknown> | null;
3820
+ createdAt: Date;
3821
+ updatedAt: Date;
3822
+ endedAt?: Date | null;
3823
+ }
3824
+ interface ChatMessage {
3825
+ id: string;
3826
+ role: 'user' | 'assistant';
3827
+ messageType: MessageType;
3828
+ text: string;
3829
+ metadata?: MessageEvent;
3830
+ turnNumber: number;
3831
+ messageIndex?: number;
3832
+ createdAt: Date;
3833
+ }
3834
+ /** Token usage data sent with turn:complete WebSocket events */
3835
+ interface SessionTokenUsage {
3836
+ /** Tokens consumed by this turn's input */
3837
+ turnInputTokens: number;
3838
+ /** Tokens generated by this turn's output */
3839
+ turnOutputTokens: number;
3840
+ /** Total tokens for this turn (turnInputTokens + turnOutputTokens) */
3841
+ turnTotalTokens: number;
3842
+ /** Cumulative input tokens across all turns in this session */
3843
+ cumulativeInputTokens: number;
3844
+ /** Cumulative output tokens across all turns in this session */
3845
+ cumulativeOutputTokens: number;
3846
+ /** The model's context window size for this session (e.g., 200K) */
3847
+ contextWindowSize: number;
3357
3848
  }
3849
+
3358
3850
  /**
3359
- * Integration metadata - external service connections
3360
- *
3361
- * References credentials table for actual connection. No connection status
3362
- * stored here (queried at runtime from credentials table).
3363
- *
3364
- * BREAKING CHANGES (2025-11-30):
3365
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
3366
- * - Field renames: `id` -> `resourceId` (inherited)
3367
- * - New required field: `status` (inherited) - organizations must add status to all integrations
3368
- * - New required field: `version` (inherited) - organizations must add version to all integrations
3369
- * - New required field: `type: 'integration'` (inherited) - resource type discriminator
3851
+ * Multi-tenancy configuration types
3370
3852
  *
3371
- * @example
3372
- * {
3373
- * resourceId: 'integration-shopify-prod',
3374
- * type: 'integration',
3375
- * provider: 'shopify',
3376
- * credentialName: 'shopify-prod',
3377
- * name: 'Shopify Production',
3378
- * description: 'E-commerce platform',
3379
- * version: '1.0.0',
3380
- * status: 'prod'
3381
- * }
3853
+ * Config is stored in dedicated `config` columns (NOT nested in metadata):
3854
+ * - organizations.config: Org-level config (no feature toggles -- all features available by default)
3855
+ * - org_memberships.config: Per-user-per-org feature overrides
3856
+ * - users.config: User-global config
3382
3857
  */
3383
- interface IntegrationDefinition extends ResourceDefinition {
3384
- /** Resource type discriminator (narrowed from base union) */
3385
- type: 'integration';
3386
- /** Integration provider type */
3387
- provider: IntegrationType;
3388
- /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
3389
- credentialName: string;
3390
- }
3391
3858
  /**
3392
- * External platform type
3393
- * Supported third-party automation platforms
3394
- */
3395
- type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other';
3396
- /**
3397
- * External automation resource metadata
3398
- *
3399
- * Represents workflows/automations running on third-party platforms
3400
- * (n8n, Make, Zapier, etc.) for visualization in Command View.
3401
- *
3402
- * NOTE: This is metadata ONLY for visualization. No execution logic,
3403
- * no API integration with external platforms, no status syncing.
3404
- *
3405
- * BREAKING CHANGES (2025-11-30):
3406
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
3407
- * - Field renames: `id` -> `resourceId` (inherited)
3408
- * - New required field: `version` (inherited) - organizations must add version to all external resources
3409
- * - New required field: `type: 'external'` (inherited) - resource type discriminator
3410
- * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
3411
- *
3412
- * @example
3413
- * {
3414
- * resourceId: 'external-n8n-order-sync',
3415
- * type: 'external',
3416
- * version: '1.0.0',
3417
- * platform: 'n8n',
3418
- * name: 'Shopify Order Sync',
3419
- * description: 'Legacy n8n workflow for syncing Shopify orders',
3420
- * status: 'prod',
3421
- * platformUrl: 'https://n8n.client.com/workflow/123',
3422
- * triggers: { workflows: ['order-fulfillment-workflow'] },
3423
- * uses: { integrations: ['integration-shopify-prod'] }
3424
- * }
3859
+ * Per-user-per-org config (stored in org_memberships.config)
3860
+ * Controls which features a specific member can access within their org.
3861
+ * Keys are feature IDs from the organization model (e.g. crm, lead-gen, projects, seo).
3425
3862
  */
3426
- interface ExternalResourceDefinition extends ResourceDefinition {
3427
- /** Resource type discriminator (narrowed from base union) */
3428
- type: 'external';
3429
- /** Platform type */
3430
- platform: ExternalPlatform;
3431
- /** Link to external platform (e.g., n8n workflow editor URL) */
3432
- platformUrl?: string;
3433
- /** Platform's internal ID/reference */
3434
- externalId?: string;
3435
- /** What this external resource triggers (external -> internal) */
3436
- triggers?: {
3437
- /** Elevasis workflow resourceIds this external automation triggers */
3438
- workflows?: string[];
3439
- /** Elevasis agent resourceIds this external automation triggers */
3440
- agents?: string[];
3441
- };
3442
- /** Integrations this external resource uses (shared credentials) */
3443
- uses?: {
3444
- /** Integration IDs this external automation uses */
3445
- integrations?: string[];
3446
- };
3863
+ interface MembershipFeatureConfig {
3864
+ features?: Record<string, boolean>;
3447
3865
  }
3448
3866
  /**
3449
- * Human Checkpoint definition - human decision points in automation
3450
- *
3451
- * Represents where human judgment is deployed in the automation landscape.
3452
- * Tasks with matching command_queue_group are routed to this checkpoint.
3453
- *
3454
- * BREAKING CHANGES (2025-11-30):
3455
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
3456
- * - Field renames: `id` -> `resourceId` (inherited)
3457
- * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
3458
- * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
3459
- * - New required field: `type: 'human'` (inherited) - resource type discriminator
3460
- *
3461
- * @example
3462
- * {
3463
- * resourceId: 'sales-approval',
3464
- * type: 'human',
3465
- * name: 'Sales Approval Queue',
3466
- * description: 'High-value order approvals for sales team',
3467
- * version: '1.0.0',
3468
- * status: 'prod',
3469
- * requestedBy: { agents: ['order-processor-agent'] },
3470
- * routesTo: { agents: ['order-fulfillment-agent'] }
3471
- * }
3867
+ * User-global config (stored in users.config)
3868
+ * Theme and onboarding are user-specific, NOT org-specific
3472
3869
  */
3473
- interface HumanCheckpointDefinition extends ResourceDefinition {
3474
- /** Resource type discriminator (narrowed from base union) */
3475
- type: 'human';
3476
- /** Resources that create tasks for this checkpoint */
3477
- requestedBy?: {
3478
- /** Agent resourceIds that request approval here */
3479
- agents?: string[];
3480
- /** Workflow resourceIds that request approval here */
3481
- workflows?: string[];
3870
+ interface UserConfig {
3871
+ theme?: {
3872
+ 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';
3873
+ colorScheme?: 'light' | 'dark' | 'auto';
3482
3874
  };
3483
- /** Resources that receive approved decisions */
3484
- routesTo?: {
3485
- /** Agent resourceIds that handle approved tasks */
3486
- agents?: string[];
3487
- /** Workflow resourceIds that handle approved tasks */
3488
- workflows?: string[];
3875
+ onboarding?: {
3876
+ completed?: boolean;
3877
+ completedAt?: string;
3878
+ role?: string;
3879
+ primaryUseCase?: string[];
3880
+ experienceLevel?: string;
3881
+ /** Onboarding guide system state (set by checklist/tour system) */
3882
+ guides?: {
3883
+ completedIds?: string[];
3884
+ dismissed?: boolean;
3885
+ completedAt?: string;
3886
+ };
3489
3887
  };
3490
3888
  }
3491
3889
 
3492
3890
  /**
3493
- * Command View Types
3891
+ * Memberships Domain - Zod Validation Schemas
3494
3892
  *
3495
- * Unified type definitions for the Command View graph visualization.
3496
- * These types are used by both backend serialization and frontend rendering.
3893
+ * Validation schemas for membership management endpoints.
3894
+ * Includes request bodies, query params, and path params.
3497
3895
  *
3498
- * Command View shows the resource graph: agents, workflows, triggers, integrations,
3499
- * external resources, and human checkpoints with their relationships.
3896
+ * Security:
3897
+ * - All schemas use .strict() to prevent mass assignment attacks
3898
+ * - UUID validation prevents invalid references
3899
+ * - Role enum validation prevents privilege escalation
3900
+ * - organizationId never accepted in body (from JWT when needed)
3500
3901
  */
3501
3902
 
3502
3903
  /**
3503
- * Extended agent metadata for Command View
3504
- * Includes model and capability information for graph display
3904
+ * Membership status validation
3905
+ * Note: Database constraint only allows 'active' | 'inactive'
3505
3906
  */
3506
- interface CommandViewAgent extends ResourceDefinition {
3507
- type: 'agent';
3508
- modelProvider: string;
3509
- modelId: string;
3510
- toolCount: number;
3511
- hasKnowledgeMap: boolean;
3512
- hasMemory: boolean;
3513
- sessionCapable: boolean;
3514
- }
3907
+ declare const MembershipStatusSchema: z.ZodEnum<{
3908
+ active: "active";
3909
+ inactive: "inactive";
3910
+ }>;
3911
+ type MembershipStatus = z.infer<typeof MembershipStatusSchema>;
3912
+
3515
3913
  /**
3516
- * Extended workflow metadata for Command View
3517
- * Includes step information for graph display
3914
+ * Organization Membership types based on WorkOS API
3518
3915
  */
3519
- interface CommandViewWorkflow extends ResourceDefinition {
3520
- type: 'workflow';
3521
- stepCount: number;
3522
- entryPoint: string;
3916
+ interface OrganizationMembership {
3917
+ object: 'organization_membership';
3918
+ id: string;
3919
+ userId: string;
3920
+ organizationId: string;
3921
+ role: {
3922
+ slug: string;
3923
+ };
3924
+ status: 'active' | 'inactive';
3925
+ createdAt: string;
3926
+ updatedAt: string;
3523
3927
  }
3524
3928
  /**
3525
- * Relationship types between resources
3526
- *
3527
- * - triggers: Resource initiates/starts another resource (orange)
3528
- * - uses: Resource uses an integration (teal)
3529
- * - approval: Resource requires human approval (yellow)
3929
+ * Request interfaces for membership operations
3530
3930
  */
3531
- type RelationshipType$1 = 'triggers' | 'uses' | 'approval';
3931
+ interface CreateMembershipRequest {
3932
+ userId: string;
3933
+ organizationId: string;
3934
+ roleSlug?: string;
3935
+ }
3936
+ interface UpdateMembershipRequest {
3937
+ roleSlug: string;
3938
+ }
3939
+ interface ListMembershipsParams {
3940
+ userId?: string;
3941
+ organizationId?: string;
3942
+ statuses?: MembershipStatus[];
3943
+ limit?: number;
3944
+ before?: string;
3945
+ after?: string;
3946
+ order?: 'asc' | 'desc';
3947
+ }
3532
3948
  /**
3533
- * Command View edge (relationship between resources)
3949
+ * Response interfaces
3534
3950
  */
3535
- interface CommandViewEdge$1 {
3536
- id: string;
3537
- source: string;
3538
- target: string;
3539
- relationship: RelationshipType$1;
3540
- label?: string;
3951
+ interface ListMembershipsResponse {
3952
+ data: OrganizationMembership[];
3953
+ listMetadata?: {
3954
+ before?: string | null;
3955
+ after?: string | null;
3956
+ };
3541
3957
  }
3542
3958
  /**
3543
- * Command View data structure
3544
- * Complete graph data for visualization
3545
- *
3546
- * Backend serializes this once at startup and serves it via /command-view endpoint.
3547
- * Frontend consumes this directly for graph rendering.
3959
+ * Extended membership with user and organization details for UI
3548
3960
  */
3549
- interface CommandViewData {
3550
- workflows: CommandViewWorkflow[];
3551
- agents: CommandViewAgent[];
3552
- triggers: TriggerDefinition[];
3553
- integrations: IntegrationDefinition[];
3554
- externalResources: ExternalResourceDefinition[];
3555
- humanCheckpoints: HumanCheckpointDefinition[];
3556
- edges: CommandViewEdge$1[];
3961
+ interface MembershipWithDetails extends OrganizationMembership {
3962
+ user?: {
3963
+ id: string;
3964
+ email: string;
3965
+ firstName?: string;
3966
+ lastName?: string;
3967
+ profilePictureUrl?: string;
3968
+ };
3969
+ organization?: {
3970
+ id: string;
3971
+ name: string;
3972
+ workos_org_id: string;
3973
+ primaryDomain?: string;
3974
+ is_test?: boolean;
3975
+ status?: string;
3976
+ metadata?: Record<string, unknown>;
3977
+ config?: Record<string, unknown>;
3978
+ };
3979
+ config?: MembershipFeatureConfig;
3557
3980
  }
3558
3981
 
3559
3982
  /**
3560
- * Serialized Registry Types
3561
- *
3562
- * Pre-computed JSON-safe types for API responses and Command View.
3563
- * Serialization happens once at API startup, enabling instant response times.
3983
+ * Time range selector for dashboard metrics
3564
3984
  */
3565
-
3985
+ type TimeRange = '1h' | '24h' | '7d' | '30d';
3566
3986
  /**
3567
- * Serialized form field for API responses
3987
+ * Execution health metrics response
3988
+ * Success rate, P95 duration, execution counts, and trend data
3989
+ * trendData includes executionCount for throughput visualization (eliminates separate API call)
3568
3990
  */
3569
- interface SerializedFormField {
3570
- name: string;
3571
- label: string;
3572
- type: FormFieldType;
3573
- defaultValue?: unknown;
3574
- required?: boolean;
3575
- placeholder?: string;
3576
- description?: string;
3577
- options?: Array<{
3578
- label: string;
3579
- value: string | number;
3991
+ interface ExecutionHealthMetrics {
3992
+ successRate: number;
3993
+ p95Duration: number;
3994
+ totalExecutions: number;
3995
+ trendData: Array<{
3996
+ time: string;
3997
+ rate: number;
3998
+ successCount: number;
3999
+ errorCount: number;
4000
+ warningCount: number;
4001
+ executionCount: number;
3580
4002
  }>;
3581
- min?: number;
3582
- max?: number;
4003
+ statusCounts: {
4004
+ success: number;
4005
+ failed: number;
4006
+ pending: number;
4007
+ warning: number;
4008
+ };
4009
+ peakPeriod: string;
4010
+ granularity: 'hour' | 'day';
3583
4011
  }
3584
4012
  /**
3585
- * Serialized form schema for API responses
4013
+ * Error analysis metrics response
4014
+ * Error categories and top failing resources
3586
4015
  */
3587
- interface SerializedFormSchema {
3588
- title?: string;
3589
- description?: string;
3590
- fields: SerializedFormField[];
3591
- layout?: 'vertical' | 'horizontal' | 'grid';
4016
+ interface ErrorAnalysisMetrics {
4017
+ totalErrors: number;
4018
+ errorsByCategory: Array<{
4019
+ category: string;
4020
+ count: number;
4021
+ percentage: number;
4022
+ }>;
4023
+ topFailingResources: Array<{
4024
+ resourceId: string;
4025
+ name: string;
4026
+ errorCount: number;
4027
+ failureRate: number;
4028
+ }>;
3592
4029
  }
3593
4030
  /**
3594
- * Serialized execution form schema for API responses
4031
+ * Business impact metrics response
4032
+ * ROI, labor savings, and cost analysis
3595
4033
  */
3596
- interface SerializedExecutionFormSchema extends SerializedFormSchema {
3597
- fieldMappings?: Record<string, string>;
3598
- submitButton?: {
3599
- label?: string;
3600
- loadingLabel?: string;
3601
- confirmMessage?: string;
3602
- };
4034
+ interface BusinessImpactMetrics$1 {
4035
+ totalSavingsUsd: number;
4036
+ totalCostUsd: number;
4037
+ netSavingsUsd: number;
4038
+ roi: number;
3603
4039
  }
3604
4040
  /**
3605
- * Serialized schedule config for API responses
4041
+ * Cost breakdown metrics response
4042
+ * Per-resource cost analysis
3606
4043
  */
3607
- interface SerializedScheduleConfig {
3608
- enabled: boolean;
3609
- defaultSchedule?: string;
3610
- allowedPatterns?: string[];
4044
+ interface CostBreakdownMetrics {
4045
+ resources: Array<{
4046
+ resourceId: string;
4047
+ totalCostUsd: number;
4048
+ executionCount: number;
4049
+ avgCostUsd: number;
4050
+ }>;
3611
4051
  }
3612
4052
  /**
3613
- * Serialized webhook config for API responses
4053
+ * Dashboard metrics response
4054
+ * Aggregates core observability metrics in a single response
4055
+ * Note: Throughput data is now included in executionHealth.trendData.executionCount
3614
4056
  */
3615
- interface SerializedWebhookConfig {
3616
- enabled: boolean;
3617
- payloadSchema?: unknown;
4057
+ interface DashboardMetrics {
4058
+ executionHealth: ExecutionHealthMetrics;
4059
+ costBreakdown: CostBreakdownMetrics;
4060
+ businessImpact: BusinessImpactMetrics$1;
4061
+ /** ISO timestamp of the currently active deployment, or null if none */
4062
+ activeDeploymentDate: string | null;
4063
+ /** Deployment version of the active deployment, or null if none */
4064
+ activeDeploymentVersion: string | null;
3618
4065
  }
3619
4066
  /**
3620
- * Serialized execution interface for API responses
4067
+ * Error record for list view (ErrorBreakdownTable)
3621
4068
  */
3622
- interface SerializedExecutionInterface {
3623
- form: SerializedExecutionFormSchema;
3624
- schedule?: SerializedScheduleConfig;
3625
- webhook?: SerializedWebhookConfig;
4069
+ interface ErrorRecord {
4070
+ id: string;
4071
+ timestamp: string;
4072
+ errorType: string;
4073
+ message: string;
4074
+ executionId: string;
4075
+ resourceId: string;
4076
+ resourceName: string;
4077
+ severity: 'critical' | 'warning' | 'info';
4078
+ category: ExecutionErrorCategory;
4079
+ resolved: boolean;
4080
+ resolvedAt: string | null;
4081
+ resolvedBy: string | null;
3626
4082
  }
3627
4083
  /**
3628
- * Serialized agent definition (JSON-safe)
3629
- * Result of serializeDefinition(AgentDefinition)
4084
+ * Full error detail for modal view (ErrorDetailsModal)
3630
4085
  */
3631
- interface SerializedAgentDefinition {
3632
- config: {
3633
- resourceId: string;
3634
- name: string;
3635
- description: string;
3636
- version: string;
3637
- type: 'agent';
3638
- status: 'dev' | 'prod';
3639
- links?: ResourceLink[];
3640
- category?: ResourceCategory;
3641
- /** Whether this resource is archived and should be excluded from registration and deployment */
3642
- archived?: boolean;
3643
- systemPrompt: string;
3644
- constraints?: {
3645
- maxIterations?: number;
3646
- timeout?: number;
3647
- maxSessionMemoryKeys?: number;
3648
- maxMemoryTokens?: number;
3649
- };
3650
- sessionCapable?: boolean;
3651
- memoryPreferences?: string;
3652
- };
3653
- modelConfig: {
3654
- provider: string;
3655
- model: string;
3656
- apiKey: string;
3657
- temperature: number;
3658
- maxOutputTokens: number;
3659
- topP?: number;
3660
- modelOptions?: Record<string, unknown>;
3661
- };
3662
- contract: {
3663
- inputSchema: object;
3664
- outputSchema?: object;
3665
- };
3666
- tools: Array<{
3667
- name: string;
3668
- description: string;
3669
- inputSchema?: object;
3670
- outputSchema?: object;
3671
- }>;
3672
- knowledgeMap?: {
3673
- nodeCount: number;
3674
- nodes: Array<{
3675
- id: string;
3676
- description: string;
3677
- loaded: boolean;
3678
- hasPrompt: boolean;
3679
- }>;
3680
- };
3681
- metricsConfig?: object;
3682
- interface?: SerializedExecutionInterface;
4086
+ interface ErrorDetailFull extends ErrorRecord {
4087
+ stackTrace?: string;
4088
+ retryAttempt?: number;
4089
+ stepName?: string;
4090
+ stepSequence?: number;
4091
+ errorContext?: Record<string, unknown>;
4092
+ executionContext?: Record<string, unknown>;
3683
4093
  }
3684
4094
  /**
3685
- * Serialized workflow definition (JSON-safe)
3686
- * Result of serializeDefinition(WorkflowDefinition)
4095
+ * Error details API response (paginated)
3687
4096
  */
3688
- interface SerializedWorkflowDefinition {
3689
- config: {
3690
- resourceId: string;
3691
- name: string;
3692
- description: string;
3693
- version: string;
3694
- type: 'workflow';
3695
- status: 'dev' | 'prod';
3696
- links?: ResourceLink[];
3697
- category?: ResourceCategory;
3698
- /** Whether this resource is archived and should be excluded from registration and deployment */
3699
- archived?: boolean;
3700
- };
3701
- entryPoint: string;
3702
- steps: Array<{
3703
- id: string;
3704
- name: string;
3705
- description: string;
3706
- inputSchema?: object;
3707
- outputSchema?: object;
3708
- next: {
3709
- type: 'linear' | 'conditional';
3710
- target?: string;
3711
- routes?: Array<{
3712
- target: string;
3713
- }>;
3714
- default?: string;
3715
- } | null;
3716
- }>;
3717
- contract: {
3718
- inputSchema: object;
3719
- outputSchema?: object;
3720
- };
3721
- metricsConfig?: object;
3722
- interface?: SerializedExecutionInterface;
4097
+ interface ErrorDetailResponse {
4098
+ errors: ErrorRecord[];
4099
+ total: number;
4100
+ page: number;
4101
+ limit: number;
3723
4102
  }
3724
-
3725
4103
  /**
3726
- * Base Execution Engine type definitions
3727
- * Core types shared across all Execution Engine resources
4104
+ * Error trend data for time-series charts
3728
4105
  */
3729
-
4106
+ interface ErrorTrend {
4107
+ time: string;
4108
+ errorCount: number;
4109
+ criticalCount: number;
4110
+ warningCount: number;
4111
+ infoCount: number;
4112
+ }
3730
4113
  /**
3731
- * Unified message event type - covers all message types in sessions
3732
- * Replaces separate SessionTurnMessages and AgentActivityEvent mechanisms
4114
+ * Summary of executions for a single resource
4115
+ * Used by RecentExecutionsByResource dashboard component
3733
4116
  */
4117
+ interface ResourceExecutionSummary {
4118
+ resourceId: string;
4119
+ resourceType: string;
4120
+ resourceName: string | null;
4121
+ lastExecution: string;
4122
+ totalExecutions: number;
4123
+ successCount: number;
4124
+ failureCount: number;
4125
+ warningCount: number;
4126
+ successRate: number;
4127
+ }
3734
4128
  /**
3735
- * Structured action metadata attached to assistant messages.
3736
- * Frontend reads this instead of parsing text prefixes.
4129
+ * Response from getRecentExecutionsByResource endpoint
3737
4130
  */
3738
- type AssistantAction = {
3739
- kind: 'navigate';
3740
- path: string;
3741
- reason: string;
3742
- } | {
3743
- kind: 'update_filters';
3744
- timeRange: string | null;
3745
- statusFilter: string | null;
3746
- searchQuery: string | null;
3747
- };
3748
- type MessageEvent = {
3749
- type: 'user_message';
3750
- text: string;
3751
- } | {
3752
- type: 'assistant_message';
4131
+ interface RecentExecutionsByResourceResponse {
4132
+ resources: ResourceExecutionSummary[];
4133
+ }
4134
+ /** Resource identifier for health queries */
4135
+ interface ResourceIdentifier {
4136
+ entityType: string;
4137
+ entityId: string;
4138
+ }
4139
+ /** Time-bucketed health data point */
4140
+ interface ResourceHealthDataPoint {
4141
+ time: string;
4142
+ success: number;
4143
+ failure: number;
4144
+ warning: number;
4145
+ rate: number;
4146
+ }
4147
+ /** Health data for a single resource */
4148
+ interface ResourceHealth {
4149
+ entityType: string;
4150
+ entityId: string;
4151
+ entityName: string | null;
4152
+ trendData: ResourceHealthDataPoint[];
4153
+ summary: {
4154
+ total: number;
4155
+ successRate: number;
4156
+ };
4157
+ }
4158
+ /** Batch response with all requested resources */
4159
+ interface ResourcesHealthResponse {
4160
+ resources: ResourceHealth[];
4161
+ }
4162
+ /**
4163
+ * Cost trend data point for time-series charts
4164
+ * Represents a single time bucket (hour or day)
4165
+ */
4166
+ interface CostTrendDataPoint {
4167
+ time: string;
4168
+ totalCostUsd: number;
4169
+ executionCount: number;
4170
+ avgCostPerExecution: number;
4171
+ }
4172
+ /**
4173
+ * Cost trends response (time-series data)
4174
+ */
4175
+ interface CostTrendsResponse {
4176
+ trendData: CostTrendDataPoint[];
4177
+ granularity: 'hour' | 'day';
4178
+ totalCostUsd: number;
4179
+ totalExecutions: number;
4180
+ }
4181
+ /**
4182
+ * Cost summary response with MTD and projections
4183
+ */
4184
+ interface CostSummaryResponse {
4185
+ current: {
4186
+ totalCostUsd: number;
4187
+ executionCount: number;
4188
+ };
4189
+ previous: {
4190
+ totalCostUsd: number;
4191
+ executionCount: number;
4192
+ };
4193
+ mtd: {
4194
+ totalCostUsd: number;
4195
+ daysElapsed: number;
4196
+ };
4197
+ projection: {
4198
+ monthlyCostUsd: number;
4199
+ confidence: 'low' | 'medium' | 'high';
4200
+ };
4201
+ trend: {
4202
+ changePercent: number;
4203
+ direction: 'up' | 'down' | 'flat';
4204
+ };
4205
+ }
4206
+ /**
4207
+ * Cost by model data for model-level breakdown
4208
+ */
4209
+ interface CostByModelData {
4210
+ model: string;
4211
+ totalCostUsd: number;
4212
+ callCount: number;
4213
+ totalInputTokens: number;
4214
+ totalOutputTokens: number;
4215
+ avgCostPerCall: number;
4216
+ }
4217
+ /**
4218
+ * Cost by model response
4219
+ */
4220
+ interface CostByModelResponse {
4221
+ models: CostByModelData[];
4222
+ totalCostUsd: number;
4223
+ totalCallCount: number;
4224
+ }
4225
+
4226
+ /**
4227
+ * Base Execution Engine type definitions
4228
+ * Core types shared across all Execution Engine resources
4229
+ */
4230
+
4231
+ /**
4232
+ * Unified message event type - covers all message types in sessions
4233
+ * Replaces separate SessionTurnMessages and AgentActivityEvent mechanisms
4234
+ */
4235
+ /**
4236
+ * Structured action metadata attached to assistant messages.
4237
+ * Frontend reads this instead of parsing text prefixes.
4238
+ */
4239
+ type AssistantAction = {
4240
+ kind: 'navigate';
4241
+ path: string;
4242
+ reason: string;
4243
+ } | {
4244
+ kind: 'update_filters';
4245
+ timeRange: string | null;
4246
+ statusFilter: string | null;
4247
+ searchQuery: string | null;
4248
+ };
4249
+ type MessageEvent = {
4250
+ type: 'user_message';
4251
+ text: string;
4252
+ } | {
4253
+ type: 'assistant_message';
3753
4254
  text: string;
3754
4255
  _action?: AssistantAction;
3755
4256
  } | {
@@ -3784,717 +4285,503 @@ type MessageEvent = {
3784
4285
  */
3785
4286
  type AIResourceDefinition = SerializedWorkflowDefinition | SerializedAgentDefinition;
3786
4287
 
3787
- type SupabaseUserProfile = Tables<'users'>;
3788
- type SupabaseApiKey = Tables<'api_keys'>;
3789
- /** API response type for API key list items (omits sensitive key_hash) */
3790
- type ApiKeyListItem = Omit<SupabaseApiKey, 'key_hash'>;
3791
-
3792
- /** Raw database row type for acq_deals table */
3793
- type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
3794
- type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing';
3795
- interface DealContact {
3796
- id: string;
3797
- first_name: string | null;
3798
- last_name: string | null;
3799
- email: string;
3800
- title: string | null;
3801
- headline: string | null;
3802
- linkedin_url: string | null;
3803
- pipeline_status: Record<string, unknown> | null;
3804
- enrichment_data: Record<string, unknown> | null;
3805
- company: {
3806
- id: string;
3807
- name: string;
3808
- domain: string | null;
3809
- website: string | null;
3810
- linkedin_url: string | null;
3811
- segment: string | null;
3812
- category: string | null;
3813
- num_employees: number | null;
3814
- } | null;
3815
- }
3816
- interface DealFilters {
3817
- stage?: DealStage;
3818
- search?: string;
3819
- limit?: number;
3820
- offset?: number;
3821
- }
3822
- /** Deal list item with joined contact and company data */
3823
- interface DealListItem extends AcqDealRow {
3824
- contact: DealContact | null;
3825
- }
3826
- type DealDetail = DealListItem;
3827
- /** Task kind options for a deal task (human follow-up action type) */
3828
- type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
3829
4288
  /**
3830
- * A CRM to-do item attached to a deal representing a human follow-up action.
3831
- * Transformed from AcqDealTaskRow with camelCase properties.
4289
+ * Supported integration types
4290
+ *
4291
+ * These represent the available integration adapters that can be used with tools.
4292
+ * Each integration type corresponds to an adapter implementation.
4293
+ *
4294
+ * Note: Concrete adapter implementations are deferred until needed.
4295
+ * This type provides compile-time safety and auto-completion for tool definitions.
3832
4296
  */
3833
- interface AcqDealTask {
3834
- id: string;
3835
- organizationId: string;
3836
- dealId: string;
3837
- title: string;
3838
- description: string | null;
3839
- kind: AcqDealTaskKind;
3840
- dueAt: string | null;
3841
- assigneeUserId: string | null;
3842
- completedAt: string | null;
3843
- completedByUserId: string | null;
3844
- createdAt: string;
3845
- updatedAt: string;
3846
- createdByUserId: string | null;
3847
- }
4297
+ 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';
4298
+
3848
4299
  /**
3849
- * Live-scan aggregate telemetry for a single list, computed on demand from
3850
- * the list junction tables and current contact deliverability state.
4300
+ * Resource Registry type definitions
3851
4301
  */
3852
- interface ListTelemetry {
3853
- listId: string;
3854
- totalCompanies: number;
3855
- totalContacts: number;
3856
- stageCounts: {
3857
- populated: number;
3858
- extracted: number;
3859
- qualified: number;
3860
- discovered: number;
3861
- verified: number;
3862
- personalized: number;
3863
- uploaded: number;
3864
- };
3865
- deliverability: {
3866
- valid: number;
3867
- risky: number;
3868
- invalid: number;
3869
- unknown: number;
3870
- bounced: number;
3871
- };
3872
- /** Reserved -- active workflow IDs associated with this list. */
3873
- activeWorkflows?: string[];
3874
- }
3875
4302
 
3876
4303
  /**
3877
- * Lead Service Types
3878
- * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
3879
- *
3880
- * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
4304
+ * Environment/deployment status for resources
3881
4305
  */
3882
-
3883
- interface AcqDealNote {
3884
- id: string;
3885
- dealId: string;
3886
- organizationId: string;
3887
- authorUserId: string | null;
3888
- body: string;
3889
- createdAt: string;
3890
- updatedAt: string;
3891
- }
3892
-
4306
+ type ResourceStatus = 'dev' | 'prod';
3893
4307
  /**
3894
- * Action configuration for HITL tasks
3895
- * Defines available user actions and their behavior
4308
+ * All resource types in the platform
4309
+ * Used as the discriminator field in ResourceDefinition
3896
4310
  */
3897
- interface ActionConfig {
3898
- /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
3899
- id: string;
3900
- /** Display label for UI button */
3901
- label: string;
3902
- /** Button variant/style */
3903
- type: 'primary' | 'secondary' | 'danger' | 'outline';
3904
- /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
3905
- icon?: string;
3906
- /** Button color (Mantine theme colors) */
3907
- color?: string;
3908
- /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
3909
- variant?: string;
3910
- /** Execution target (agent/workflow to invoke) */
3911
- target?: {
3912
- resourceType: 'agent' | 'workflow';
3913
- resourceId: string;
3914
- /**
3915
- * Optional session ID for agent continuation.
3916
- * If provided, invokes a new turn on the existing session instead of standalone execution.
3917
- * Only valid when resourceType is 'agent'.
3918
- */
3919
- sessionId?: string;
3920
- };
3921
- /** Form schema for collecting action-specific data */
3922
- form?: FormSchema;
3923
- /** Payload template for pre-filling forms */
3924
- payloadTemplate?: unknown;
3925
- /** Requires confirmation dialog */
3926
- requiresConfirmation?: boolean;
3927
- /** Confirmation message */
3928
- confirmationMessage?: string;
3929
- /** Help text / tooltip */
3930
- description?: string;
3931
- }
3932
-
3933
- /**
3934
- * Origin resource type - where an execution/task originated from.
3935
- * Used for audit trails and tracking execution lineage.
3936
- */
3937
- type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
3938
- /**
3939
- * Origin tracking metadata - who/what created this execution/task.
3940
- * Used by both TaskScheduler and CommandQueue for complete audit trails.
3941
- */
3942
- interface OriginTracking {
3943
- originExecutionId: string;
3944
- originResourceType: OriginResourceType;
3945
- originResourceId: string;
3946
- }
3947
-
4311
+ type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
3948
4312
  /**
3949
- * Command queue task with flexible action system
4313
+ * Base interface for ALL platform resources
4314
+ * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
3950
4315
  */
3951
- interface Task extends OriginTracking {
3952
- id: string;
3953
- organizationId: string;
3954
- actions: ActionConfig[];
3955
- context: unknown;
3956
- selectedAction?: string;
3957
- actionPayload?: unknown;
3958
- description?: string;
3959
- priority: number;
3960
- /** Optional checkpoint identifier for grouping related human approval tasks */
3961
- humanCheckpoint?: string;
3962
- status: QueueTaskStatus;
3963
- /**
3964
- * Target resource tracking mirrors origin columns.
3965
- * Set when task is created; patchable to redirect execution to a different resource.
3966
- */
3967
- targetResourceId?: string;
3968
- targetResourceType?: 'agent' | 'workflow';
3969
- /**
3970
- * Execution ID for the action that runs AFTER user approval.
3971
- * NULL until execution starts.
3972
- *
3973
- * Naming distinction:
3974
- * - originExecutionId = Parent execution that CREATED the HITL task
3975
- * - targetExecutionId = Child execution that RUNS AFTER user approval
3976
- */
3977
- targetExecutionId?: string;
3978
- createdAt: Date;
3979
- completedAt?: Date;
3980
- completedBy?: string;
3981
- expiresAt?: Date;
3982
- idempotencyKey?: string | null;
4316
+ interface ResourceDefinition {
4317
+ /** Unique resource identifier */
4318
+ resourceId: string;
4319
+ /** Display name */
4320
+ name: string;
4321
+ /** Purpose and functionality description */
4322
+ description: string;
4323
+ /** Version for change tracking and evolution */
4324
+ version: string;
4325
+ /** Resource type discriminator */
4326
+ type: ResourceType;
4327
+ /** Environment/deployment status */
4328
+ status: ResourceStatus;
4329
+ /** Graph links to Organization Model nodes */
4330
+ links?: ResourceLink[];
4331
+ /** Infrastructure category for filtering */
4332
+ category?: ResourceCategory;
4333
+ /** Whether the agent supports multi-turn sessions (agents only) */
4334
+ sessionCapable?: boolean;
4335
+ /** Whether the resource is local (monorepo) or remote (externally deployed) */
4336
+ origin?: 'local' | 'remote';
4337
+ /** Whether this resource is archived and should be excluded from registration and deployment */
4338
+ archived?: boolean;
3983
4339
  }
3984
- /**
3985
- * Task status values
3986
- * - pending: awaiting action
3987
- * - processing: execution in progress after user approval
3988
- * - completed: action was taken and execution succeeded
3989
- * - failed: execution failed, task can be retried
3990
- * - expired: timed out before action
3991
- */
3992
- type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
3993
- /**
3994
- * Parameters for patching mutable metadata on a task
3995
- */
3996
- interface PatchTaskParams {
3997
- humanCheckpoint?: string | null;
3998
- description?: string;
3999
- priority?: number;
4000
- context?: Record<string, unknown>;
4001
- actions?: unknown[];
4002
- targetResourceId?: string | null;
4003
- targetResourceType?: 'agent' | 'workflow' | null;
4004
- targetExecutionId?: string;
4005
- status?: 'pending' | 'failed' | 'completed';
4340
+ /** Webhook provider identifiers */
4341
+ type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test';
4342
+ /** Webhook trigger configuration */
4343
+ interface WebhookTriggerConfig {
4344
+ /** Provider identifier */
4345
+ provider: WebhookProviderType;
4346
+ /** Event type for documentation (not used for matching - workflow handles routing) */
4347
+ event?: string;
4348
+ /** Optional filtering (e.g., specific form ID for Fillout) */
4349
+ filter?: Record<string, string>;
4350
+ /** References credential in credentials table for per-org webhook secrets */
4351
+ credentialName?: string;
4006
4352
  }
4007
- interface CommandQueueListResponse {
4008
- tasks: Task[];
4009
- total: number;
4353
+ /** Schedule trigger configuration */
4354
+ interface ScheduleTriggerConfig {
4355
+ /** Cron expression (e.g., '0 6 * * *') */
4356
+ cron: string;
4357
+ /** Optional timezone (default: UTC) */
4358
+ timezone?: string;
4010
4359
  }
4011
-
4012
- /**
4013
- * Checkpoint list item for sidebar grouping
4014
- * The id field contains the resourceId of the human checkpoint
4015
- */
4016
- interface CheckpointListItem {
4017
- /** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
4018
- id: string;
4019
- /** Display name (same as id, or "Ungrouped" for null) */
4020
- name: string;
4021
- /** Task count for this checkpoint */
4022
- count: number;
4360
+ /** Event trigger configuration */
4361
+ interface EventTriggerConfig {
4362
+ /** Internal event type */
4363
+ eventType: string;
4364
+ /** Event source */
4365
+ source?: string;
4023
4366
  }
4367
+ /** Union of all trigger configs */
4368
+ type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig;
4024
4369
  /**
4025
- * Status counts for pie chart display
4370
+ * Trigger metadata - entry points that initiate resource execution
4371
+ *
4372
+ * Triggers represent how executions start: webhooks from external services,
4373
+ * scheduled cron jobs, platform events, or manual user actions.
4374
+ *
4375
+ * BREAKING CHANGES (2025-11-30):
4376
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
4377
+ * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
4378
+ * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
4379
+ * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
4380
+ * - triggers object now includes `externalResources` option
4381
+ *
4382
+ * @example
4383
+ * // TriggerDefinition - metadata only
4384
+ * {
4385
+ * resourceId: 'trigger-new-order',
4386
+ * type: 'trigger',
4387
+ * triggerType: 'webhook',
4388
+ * name: 'New Order',
4389
+ * description: 'Webhook from Shopify on new orders',
4390
+ * version: '1.0.0',
4391
+ * status: 'prod',
4392
+ * webhookPath: '/webhooks/shopify/orders'
4393
+ * }
4394
+ *
4395
+ * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
4396
+ * // relationships: {
4397
+ * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
4398
+ * // }
4026
4399
  */
4027
- interface StatusCounts {
4028
- pending: number;
4029
- completed: number;
4030
- expired: number;
4400
+ interface TriggerDefinition extends ResourceDefinition {
4401
+ /** Resource type discriminator (narrowed from base union) */
4402
+ type: 'trigger';
4403
+ /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
4404
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
4405
+ /** Type-specific configuration */
4406
+ config?: TriggerConfig;
4407
+ /** For webhook triggers: path like '/webhooks/shopify/orders' */
4408
+ webhookPath?: string;
4409
+ /** For schedule triggers: cron expression like '0 6 * * *' */
4410
+ schedule?: string;
4411
+ /** For event triggers: event type like 'low-stock-alert' */
4412
+ eventType?: string;
4031
4413
  }
4032
4414
  /**
4033
- * Priority counts for donut chart display
4415
+ * Integration metadata - external service connections
4416
+ *
4417
+ * References credentials table for actual connection. No connection status
4418
+ * stored here (queried at runtime from credentials table).
4419
+ *
4420
+ * BREAKING CHANGES (2025-11-30):
4421
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
4422
+ * - Field renames: `id` -> `resourceId` (inherited)
4423
+ * - New required field: `status` (inherited) - organizations must add status to all integrations
4424
+ * - New required field: `version` (inherited) - organizations must add version to all integrations
4425
+ * - New required field: `type: 'integration'` (inherited) - resource type discriminator
4426
+ *
4427
+ * @example
4428
+ * {
4429
+ * resourceId: 'integration-shopify-prod',
4430
+ * type: 'integration',
4431
+ * provider: 'shopify',
4432
+ * credentialName: 'shopify-prod',
4433
+ * name: 'Shopify Production',
4434
+ * description: 'E-commerce platform',
4435
+ * version: '1.0.0',
4436
+ * status: 'prod'
4437
+ * }
4034
4438
  */
4035
- interface PriorityCounts {
4036
- critical: number;
4037
- high: number;
4038
- medium: number;
4039
- low: number;
4439
+ interface IntegrationDefinition extends ResourceDefinition {
4440
+ /** Resource type discriminator (narrowed from base union) */
4441
+ type: 'integration';
4442
+ /** Integration provider type */
4443
+ provider: IntegrationType;
4444
+ /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
4445
+ credentialName: string;
4040
4446
  }
4041
4447
  /**
4042
- * Response from GET /command-queue/checkpoints endpoint
4448
+ * External platform type
4449
+ * Supported third-party automation platforms
4043
4450
  */
4044
- interface CheckpointListResponse {
4045
- checkpoints: CheckpointListItem[];
4046
- /** Total tasks across all checkpoints */
4047
- total: number;
4048
- /** Breakdown by status for donut chart */
4049
- statusCounts: StatusCounts;
4050
- /** Breakdown by priority for donut chart */
4051
- priorityCounts: PriorityCounts;
4052
- }
4053
-
4451
+ type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other';
4054
4452
  /**
4055
- * Target for schedule execution - identifies what resource to execute.
4056
- * Unlike ExecutionTarget, payload is NOT included here because schedules
4057
- * store payload in the scheduleConfig (varies per step/item).
4058
- */
4059
- interface ScheduleTarget {
4060
- resourceType: 'agent' | 'workflow';
4061
- resourceId: string;
4062
- }
4063
- /**
4064
- * Optional origin tracking for schedules.
4065
- * Unlike OriginTracking (which is required), these fields are all optional
4066
- * for schedules created directly via API (not triggered by another resource).
4067
- */
4068
- interface ScheduleOriginTracking {
4069
- originExecutionId?: string;
4070
- originResourceType?: OriginResourceType;
4071
- originResourceId?: string;
4072
- }
4073
- type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
4074
- interface RecurringScheduleConfig {
4075
- type: 'recurring';
4076
- cron?: string;
4077
- interval?: 'daily' | 'weekly' | 'monthly';
4078
- time?: string;
4079
- timezone: string;
4080
- payload: Record<string, unknown>;
4081
- endAt?: string | null;
4082
- overduePolicy?: 'skip' | 'execute';
4083
- }
4084
- interface RelativeScheduleConfig {
4085
- type: 'relative';
4086
- anchorAt: string;
4087
- anchorLabel?: string;
4088
- items: RelativeScheduleItem[];
4089
- overduePolicy?: 'skip' | 'execute';
4090
- }
4091
- interface RelativeScheduleItem {
4092
- offset: string;
4093
- payload: Record<string, unknown>;
4094
- label?: string;
4095
- }
4096
- interface AbsoluteScheduleConfig {
4097
- type: 'absolute';
4098
- items: AbsoluteScheduleItem[];
4099
- overduePolicy?: 'skip' | 'execute';
4100
- }
4101
- interface AbsoluteScheduleItem {
4102
- runAt: string;
4103
- payload: Record<string, unknown>;
4104
- label?: string;
4105
- }
4106
- interface TaskSchedule extends ScheduleOriginTracking {
4107
- id: string;
4108
- organizationId: string;
4109
- name: string;
4110
- description?: string;
4111
- target: ScheduleTarget;
4112
- scheduleConfig: TaskScheduleConfig;
4113
- nextRunAt?: Date;
4114
- currentStep: number;
4115
- status: 'active' | 'paused' | 'completed' | 'cancelled';
4116
- lastRunAt?: Date;
4117
- lastExecutionId?: string;
4118
- maxRetries: number;
4119
- idempotencyKey?: string;
4120
- createdAt: Date;
4121
- updatedAt: Date;
4122
- }
4123
-
4124
- /**
4125
- * Wire-format DTO for notification API responses.
4126
- * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
4127
- * Used by frontend hooks that consume /api/notifications.
4453
+ * External automation resource metadata
4454
+ *
4455
+ * Represents workflows/automations running on third-party platforms
4456
+ * (n8n, Make, Zapier, etc.) for visualization in Command View.
4457
+ *
4458
+ * NOTE: This is metadata ONLY for visualization. No execution logic,
4459
+ * no API integration with external platforms, no status syncing.
4460
+ *
4461
+ * BREAKING CHANGES (2025-11-30):
4462
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
4463
+ * - Field renames: `id` -> `resourceId` (inherited)
4464
+ * - New required field: `version` (inherited) - organizations must add version to all external resources
4465
+ * - New required field: `type: 'external'` (inherited) - resource type discriminator
4466
+ * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
4467
+ *
4468
+ * @example
4469
+ * {
4470
+ * resourceId: 'external-n8n-order-sync',
4471
+ * type: 'external',
4472
+ * version: '1.0.0',
4473
+ * platform: 'n8n',
4474
+ * name: 'Shopify Order Sync',
4475
+ * description: 'Legacy n8n workflow for syncing Shopify orders',
4476
+ * status: 'prod',
4477
+ * platformUrl: 'https://n8n.client.com/workflow/123',
4478
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
4479
+ * uses: { integrations: ['integration-shopify-prod'] }
4480
+ * }
4128
4481
  */
4129
- interface NotificationDTO {
4130
- id: string;
4131
- userId: string;
4132
- organizationId: string;
4133
- category: string;
4134
- title: string;
4135
- message: string;
4136
- actionUrl: string | null;
4137
- read: boolean;
4138
- readAt: string | null;
4139
- createdAt: string;
4140
- }
4141
-
4142
- type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
4143
- type ProjectUpdate = Database['public']['Tables']['prj_projects']['Update'];
4144
- type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
4145
- type MilestoneUpdate = Database['public']['Tables']['prj_milestones']['Update'];
4146
- type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
4147
- type TaskUpdate = Database['public']['Tables']['prj_tasks']['Update'];
4148
- type ProjectStatus = 'active' | 'on_track' | 'at_risk' | 'blocked' | 'completed' | 'paused';
4149
- type ProjectKind = 'client_engagement' | 'internal' | 'research' | 'other';
4150
- type MilestoneStatus = 'upcoming' | 'in_progress' | 'completed' | 'overdue' | 'blocked';
4151
- type TaskStatus = 'planned' | 'in_progress' | 'blocked' | 'completed' | 'cancelled' | 'submitted' | 'approved' | 'rejected' | 'revision_requested';
4152
- type TaskType = 'documentation' | 'code' | 'report' | 'design' | 'other';
4153
- type NoteType = 'call_note' | 'status_update' | 'issue' | 'blocker' | 'agent_learning';
4154
- interface ProjectFilters {
4155
- status?: ProjectStatus;
4156
- kind?: ProjectKind;
4157
- companyId?: string;
4158
- search?: string;
4159
- }
4160
- interface MilestoneFilters {
4161
- status?: MilestoneStatus;
4162
- projectId?: string;
4163
- }
4164
- interface TaskFilters {
4165
- status?: TaskStatus;
4166
- type?: TaskType;
4167
- milestoneId?: string;
4168
- projectId?: string;
4169
- }
4170
- interface NoteFilters {
4171
- type?: NoteType;
4172
- projectId?: string;
4173
- }
4174
- interface ProjectWithCounts extends ProjectRow {
4175
- milestoneCount: number;
4176
- taskCount: number;
4177
- completedMilestones?: number;
4178
- completedTasks?: number;
4179
- }
4180
- interface ProjectDetail extends ProjectRow {
4181
- milestones: MilestoneRow[];
4182
- tasks: TaskRow[];
4183
- company: {
4184
- id: string;
4185
- name: string;
4186
- domain: string | null;
4187
- } | null;
4482
+ interface ExternalResourceDefinition extends ResourceDefinition {
4483
+ /** Resource type discriminator (narrowed from base union) */
4484
+ type: 'external';
4485
+ /** Platform type */
4486
+ platform: ExternalPlatform;
4487
+ /** Link to external platform (e.g., n8n workflow editor URL) */
4488
+ platformUrl?: string;
4489
+ /** Platform's internal ID/reference */
4490
+ externalId?: string;
4491
+ /** What this external resource triggers (external -> internal) */
4492
+ triggers?: {
4493
+ /** Elevasis workflow resourceIds this external automation triggers */
4494
+ workflows?: string[];
4495
+ /** Elevasis agent resourceIds this external automation triggers */
4496
+ agents?: string[];
4497
+ };
4498
+ /** Integrations this external resource uses (shared credentials) */
4499
+ uses?: {
4500
+ /** Integration IDs this external automation uses */
4501
+ integrations?: string[];
4502
+ };
4188
4503
  }
4189
-
4190
- declare const ListCompaniesQuerySchema: z.ZodObject<{
4191
- search: z.ZodOptional<z.ZodString>;
4192
- listId: z.ZodOptional<z.ZodString>;
4193
- domain: z.ZodOptional<z.ZodString>;
4194
- website: z.ZodOptional<z.ZodString>;
4195
- segment: z.ZodOptional<z.ZodString>;
4196
- category: z.ZodOptional<z.ZodString>;
4197
- batchId: z.ZodOptional<z.ZodString>;
4198
- status: z.ZodOptional<z.ZodEnum<{
4199
- active: "active";
4200
- invalid: "invalid";
4201
- }>>;
4202
- includeAll: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
4203
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4204
- offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4205
- }, z.core.$strict>;
4206
- declare const ListContactsQuerySchema: z.ZodObject<{
4207
- search: z.ZodOptional<z.ZodString>;
4208
- listId: z.ZodOptional<z.ZodString>;
4209
- openingLineIsNull: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
4210
- batchId: z.ZodOptional<z.ZodString>;
4211
- contactStatus: z.ZodOptional<z.ZodEnum<{
4212
- active: "active";
4213
- invalid: "invalid";
4214
- }>>;
4215
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4216
- offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4217
- }, z.core.$strict>;
4218
- declare const AcqCompanyResponseSchema: z.ZodObject<{
4219
- id: z.ZodString;
4220
- organizationId: z.ZodString;
4221
- name: z.ZodString;
4222
- domain: z.ZodNullable<z.ZodString>;
4223
- linkedinUrl: z.ZodNullable<z.ZodString>;
4224
- website: z.ZodNullable<z.ZodString>;
4225
- numEmployees: z.ZodNullable<z.ZodNumber>;
4226
- foundedYear: z.ZodNullable<z.ZodNumber>;
4227
- locationCity: z.ZodNullable<z.ZodString>;
4228
- locationState: z.ZodNullable<z.ZodString>;
4229
- category: z.ZodNullable<z.ZodString>;
4230
- categoryPain: z.ZodNullable<z.ZodString>;
4231
- segment: z.ZodNullable<z.ZodString>;
4232
- pipelineStatus: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4233
- enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4234
- source: z.ZodNullable<z.ZodString>;
4235
- batchId: z.ZodNullable<z.ZodString>;
4236
- status: z.ZodEnum<{
4237
- active: "active";
4238
- invalid: "invalid";
4239
- }>;
4240
- contactCount: z.ZodNumber;
4241
- verticalResearch: z.ZodNullable<z.ZodString>;
4242
- createdAt: z.ZodString;
4243
- updatedAt: z.ZodString;
4244
- }, z.core.$strip>;
4245
- declare const AcqContactResponseSchema: z.ZodObject<{
4246
- id: z.ZodString;
4247
- organizationId: z.ZodString;
4248
- companyId: z.ZodNullable<z.ZodString>;
4249
- email: z.ZodString;
4250
- emailValid: z.ZodNullable<z.ZodEnum<{
4251
- VALID: "VALID";
4252
- INVALID: "INVALID";
4253
- RISKY: "RISKY";
4254
- UNKNOWN: "UNKNOWN";
4255
- }>>;
4256
- firstName: z.ZodNullable<z.ZodString>;
4257
- lastName: z.ZodNullable<z.ZodString>;
4258
- linkedinUrl: z.ZodNullable<z.ZodString>;
4259
- title: z.ZodNullable<z.ZodString>;
4260
- headline: z.ZodNullable<z.ZodString>;
4261
- filterReason: z.ZodNullable<z.ZodString>;
4262
- openingLine: z.ZodNullable<z.ZodString>;
4263
- source: z.ZodNullable<z.ZodString>;
4264
- sourceId: z.ZodNullable<z.ZodString>;
4265
- pipelineStatus: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4266
- enrichmentData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4267
- attioPersonId: z.ZodNullable<z.ZodString>;
4268
- batchId: z.ZodNullable<z.ZodString>;
4269
- status: z.ZodEnum<{
4270
- active: "active";
4271
- invalid: "invalid";
4272
- }>;
4273
- company: z.ZodOptional<z.ZodNullable<z.ZodObject<{
4274
- id: z.ZodString;
4275
- name: z.ZodString;
4276
- domain: z.ZodNullable<z.ZodString>;
4277
- website: z.ZodNullable<z.ZodString>;
4278
- linkedinUrl: z.ZodNullable<z.ZodString>;
4279
- segment: z.ZodNullable<z.ZodString>;
4280
- category: z.ZodNullable<z.ZodString>;
4281
- status: z.ZodEnum<{
4282
- active: "active";
4283
- invalid: "invalid";
4284
- }>;
4285
- }, z.core.$strip>>>;
4286
- createdAt: z.ZodString;
4287
- updatedAt: z.ZodString;
4288
- }, z.core.$strip>;
4289
- type ListCompaniesQuery = z.infer<typeof ListCompaniesQuerySchema>;
4290
- type ListContactsQuery = z.infer<typeof ListContactsQuerySchema>;
4291
- type AcqCompanyResponse = z.infer<typeof AcqCompanyResponseSchema>;
4292
- type AcqContactResponse = z.infer<typeof AcqContactResponseSchema>;
4293
-
4294
- type MessageType = MessageEvent['type'];
4295
4504
  /**
4296
- * Session Data Transfer Object (DTO)
4297
- * Transform type for API responses (snake_case DB → camelCase frontend)
4298
- * Used by frontend apps to display session data
4505
+ * Human Checkpoint definition - human decision points in automation
4506
+ *
4507
+ * Represents where human judgment is deployed in the automation landscape.
4508
+ * Tasks with matching command_queue_group are routed to this checkpoint.
4509
+ *
4510
+ * BREAKING CHANGES (2025-11-30):
4511
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
4512
+ * - Field renames: `id` -> `resourceId` (inherited)
4513
+ * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
4514
+ * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
4515
+ * - New required field: `type: 'human'` (inherited) - resource type discriminator
4516
+ *
4517
+ * @example
4518
+ * {
4519
+ * resourceId: 'sales-approval',
4520
+ * type: 'human',
4521
+ * name: 'Sales Approval Queue',
4522
+ * description: 'High-value order approvals for sales team',
4523
+ * version: '1.0.0',
4524
+ * status: 'prod',
4525
+ * requestedBy: { agents: ['order-processor-agent'] },
4526
+ * routesTo: { agents: ['order-fulfillment-agent'] }
4527
+ * }
4299
4528
  */
4300
- interface SessionDTO {
4301
- sessionId: string;
4302
- resourceId: string;
4303
- organizationId: string;
4304
- userId?: string | null;
4305
- turnCount: number;
4306
- isEnded: boolean;
4307
- title?: string | null;
4308
- memorySnapshot?: AgentMemory;
4309
- metadata?: Record<string, unknown> | null;
4310
- createdAt: Date;
4311
- updatedAt: Date;
4312
- endedAt?: Date | null;
4313
- }
4314
- interface ChatMessage {
4315
- id: string;
4316
- role: 'user' | 'assistant';
4317
- messageType: MessageType;
4318
- text: string;
4319
- metadata?: MessageEvent;
4320
- turnNumber: number;
4321
- messageIndex?: number;
4322
- createdAt: Date;
4323
- }
4324
- /** Token usage data sent with turn:complete WebSocket events */
4325
- interface SessionTokenUsage {
4326
- /** Tokens consumed by this turn's input */
4327
- turnInputTokens: number;
4328
- /** Tokens generated by this turn's output */
4329
- turnOutputTokens: number;
4330
- /** Total tokens for this turn (turnInputTokens + turnOutputTokens) */
4331
- turnTotalTokens: number;
4332
- /** Cumulative input tokens across all turns in this session */
4333
- cumulativeInputTokens: number;
4334
- /** Cumulative output tokens across all turns in this session */
4335
- cumulativeOutputTokens: number;
4336
- /** The model's context window size for this session (e.g., 200K) */
4337
- contextWindowSize: number;
4529
+ interface HumanCheckpointDefinition extends ResourceDefinition {
4530
+ /** Resource type discriminator (narrowed from base union) */
4531
+ type: 'human';
4532
+ /** Resources that create tasks for this checkpoint */
4533
+ requestedBy?: {
4534
+ /** Agent resourceIds that request approval here */
4535
+ agents?: string[];
4536
+ /** Workflow resourceIds that request approval here */
4537
+ workflows?: string[];
4538
+ };
4539
+ /** Resources that receive approved decisions */
4540
+ routesTo?: {
4541
+ /** Agent resourceIds that handle approved tasks */
4542
+ agents?: string[];
4543
+ /** Workflow resourceIds that handle approved tasks */
4544
+ workflows?: string[];
4545
+ };
4338
4546
  }
4339
4547
 
4340
4548
  /**
4341
- * Multi-tenancy configuration types
4549
+ * Command View Types
4342
4550
  *
4343
- * Config is stored in dedicated `config` columns (NOT nested in metadata):
4344
- * - organizations.config: Org-level config (no feature toggles -- all features available by default)
4345
- * - org_memberships.config: Per-user-per-org feature overrides
4346
- * - users.config: User-global config
4551
+ * Unified type definitions for the Command View graph visualization.
4552
+ * These types are used by both backend serialization and frontend rendering.
4553
+ *
4554
+ * Command View shows the resource graph: agents, workflows, triggers, integrations,
4555
+ * external resources, and human checkpoints with their relationships.
4347
4556
  */
4557
+
4348
4558
  /**
4349
- * Per-user-per-org config (stored in org_memberships.config)
4350
- * Controls which features a specific member can access within their org.
4351
- * Keys are feature IDs from the organization model (e.g. crm, lead-gen, projects, seo).
4559
+ * Extended agent metadata for Command View
4560
+ * Includes model and capability information for graph display
4352
4561
  */
4353
- interface MembershipFeatureConfig {
4354
- features?: Record<string, boolean>;
4562
+ interface CommandViewAgent extends ResourceDefinition {
4563
+ type: 'agent';
4564
+ modelProvider: string;
4565
+ modelId: string;
4566
+ toolCount: number;
4567
+ hasKnowledgeMap: boolean;
4568
+ hasMemory: boolean;
4569
+ sessionCapable: boolean;
4355
4570
  }
4356
4571
  /**
4357
- * User-global config (stored in users.config)
4358
- * Theme and onboarding are user-specific, NOT org-specific
4572
+ * Extended workflow metadata for Command View
4573
+ * Includes step information for graph display
4359
4574
  */
4360
- interface UserConfig {
4361
- theme?: {
4362
- 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';
4363
- colorScheme?: 'light' | 'dark' | 'auto';
4364
- };
4365
- onboarding?: {
4366
- completed?: boolean;
4367
- completedAt?: string;
4368
- role?: string;
4369
- primaryUseCase?: string[];
4370
- experienceLevel?: string;
4371
- /** Onboarding guide system state (set by checklist/tour system) */
4372
- guides?: {
4373
- completedIds?: string[];
4374
- dismissed?: boolean;
4375
- completedAt?: string;
4376
- };
4377
- };
4575
+ interface CommandViewWorkflow extends ResourceDefinition {
4576
+ type: 'workflow';
4577
+ stepCount: number;
4578
+ entryPoint: string;
4378
4579
  }
4379
-
4380
4580
  /**
4381
- * Memberships Domain - Zod Validation Schemas
4382
- *
4383
- * Validation schemas for membership management endpoints.
4384
- * Includes request bodies, query params, and path params.
4581
+ * Relationship types between resources
4385
4582
  *
4386
- * Security:
4387
- * - All schemas use .strict() to prevent mass assignment attacks
4388
- * - UUID validation prevents invalid references
4389
- * - Role enum validation prevents privilege escalation
4390
- * - organizationId never accepted in body (from JWT when needed)
4583
+ * - triggers: Resource initiates/starts another resource (orange)
4584
+ * - uses: Resource uses an integration (teal)
4585
+ * - approval: Resource requires human approval (yellow)
4391
4586
  */
4392
-
4587
+ type RelationshipType$1 = 'triggers' | 'uses' | 'approval';
4393
4588
  /**
4394
- * Membership status validation
4395
- * Note: Database constraint only allows 'active' | 'inactive'
4589
+ * Command View edge (relationship between resources)
4396
4590
  */
4397
- declare const MembershipStatusSchema: z.ZodEnum<{
4398
- active: "active";
4399
- inactive: "inactive";
4400
- }>;
4401
- type MembershipStatus = z.infer<typeof MembershipStatusSchema>;
4402
-
4591
+ interface CommandViewEdge$1 {
4592
+ id: string;
4593
+ source: string;
4594
+ target: string;
4595
+ relationship: RelationshipType$1;
4596
+ label?: string;
4597
+ }
4403
4598
  /**
4404
- * Organization Membership types based on WorkOS API
4599
+ * Command View data structure
4600
+ * Complete graph data for visualization
4601
+ *
4602
+ * Backend serializes this once at startup and serves it via /command-view endpoint.
4603
+ * Frontend consumes this directly for graph rendering.
4405
4604
  */
4406
- interface OrganizationMembership {
4407
- object: 'organization_membership';
4605
+ interface CommandViewData {
4606
+ workflows: CommandViewWorkflow[];
4607
+ agents: CommandViewAgent[];
4608
+ triggers: TriggerDefinition[];
4609
+ integrations: IntegrationDefinition[];
4610
+ externalResources: ExternalResourceDefinition[];
4611
+ humanCheckpoints: HumanCheckpointDefinition[];
4612
+ edges: CommandViewEdge$1[];
4613
+ }
4614
+
4615
+ declare const LinkSchema: z.ZodObject<{
4616
+ nodeId: z.ZodString;
4617
+ kind: z.ZodEnum<{
4618
+ contains: "contains";
4619
+ references: "references";
4620
+ exposes: "exposes";
4621
+ maps_to: "maps_to";
4622
+ "operates-on": "operates-on";
4623
+ uses: "uses";
4624
+ }>;
4625
+ }, z.core.$strip>;
4626
+ type Link = z.infer<typeof LinkSchema>;
4627
+
4628
+ declare const ResourceCategorySchema: z.ZodEnum<{
4629
+ production: "production";
4630
+ diagnostic: "diagnostic";
4631
+ internal: "internal";
4632
+ testing: "testing";
4633
+ }>;
4634
+ type ResourceCategory = z.infer<typeof ResourceCategorySchema>;
4635
+ type ResourceLink = Link;
4636
+
4637
+ type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
4638
+ interface APIExecutionSummary {
4408
4639
  id: string;
4409
- userId: string;
4410
- organizationId: string;
4411
- role: {
4412
- slug: string;
4413
- };
4414
- status: 'active' | 'inactive';
4415
- createdAt: string;
4416
- updatedAt: string;
4640
+ status: ExecutionStatus;
4641
+ startTime: number;
4642
+ endTime?: number;
4643
+ resourceStatus?: ResourceStatus;
4644
+ }
4645
+ interface APIExecutionDetail extends APIExecutionSummary {
4646
+ executionLogs: ExecutionLogMessage[];
4647
+ input?: unknown;
4648
+ result?: unknown;
4649
+ error?: string;
4650
+ resourceStatus: ResourceStatus;
4651
+ apiVersion?: string | null;
4652
+ resourceVersion?: string | null;
4653
+ sdkVersion?: string | null;
4654
+ isArchived?: boolean;
4655
+ archivedLogCount?: number;
4656
+ }
4657
+ interface APIExecutionListResponse {
4658
+ executions: APIExecutionSummary[];
4659
+ total?: number;
4660
+ limit?: number;
4661
+ offset?: number;
4662
+ hasMore?: boolean;
4417
4663
  }
4664
+
4418
4665
  /**
4419
- * Request interfaces for membership operations
4666
+ * @deprecated Use TimeRange from '@repo/core' directly. Kept as alias for backward compatibility.
4420
4667
  */
4421
- interface CreateMembershipRequest {
4422
- userId: string;
4423
- organizationId: string;
4424
- roleSlug?: string;
4668
+ type StatsTimeRange = TimeRange;
4669
+ /** Stats returned by /command-view/stats (counts only, no error details) */
4670
+ interface ResourceStats {
4671
+ resourceId: string;
4672
+ totalRuns: number;
4673
+ successCount: number;
4674
+ failureCount: number;
4675
+ warningCount: number;
4676
+ lastRunAt: string | null;
4425
4677
  }
4426
- interface UpdateMembershipRequest {
4427
- roleSlug: string;
4678
+ /** Response from /command-view/resource-errors (on-demand) */
4679
+ interface ResourceErrorsResponse {
4680
+ resourceId: string;
4681
+ errors: ErrorSummary[];
4682
+ totalErrors: number;
4683
+ timeRange: StatsTimeRange;
4428
4684
  }
4429
- interface ListMembershipsParams {
4430
- userId?: string;
4431
- organizationId?: string;
4432
- statuses?: MembershipStatus[];
4433
- limit?: number;
4434
- before?: string;
4435
- after?: string;
4436
- order?: 'asc' | 'desc';
4685
+ interface ErrorSummary {
4686
+ executionId: string;
4687
+ errorType: string;
4688
+ errorMessage: string;
4689
+ occurredAt: string;
4690
+ }
4691
+ /** Single execution summary for Recent Executions list in command view */
4692
+ interface CommandViewExecution {
4693
+ executionId: string;
4694
+ status: ExecutionStatus;
4695
+ startedAt: string;
4696
+ completedAt: string | null;
4697
+ errorMessage: string | null;
4698
+ }
4699
+ /** Response from /command-view/resource-executions (on-demand) */
4700
+ interface ResourceExecutionsResponse {
4701
+ resourceId: string;
4702
+ executions: CommandViewExecution[];
4703
+ totalExecutions: number;
4704
+ timeRange: StatsTimeRange;
4705
+ page: number;
4706
+ limit: number;
4707
+ }
4708
+ interface HumanCheckpointStats {
4709
+ checkpointId: string;
4710
+ pendingCount: number;
4711
+ completedCount: number;
4712
+ expiredCount: number;
4713
+ lastDecisionAt: string | null;
4714
+ }
4715
+ /** Response from /command-view/stats */
4716
+ interface CommandViewStatsResponse {
4717
+ resources: Record<string, ResourceStats>;
4718
+ humanCheckpoints: Record<string, HumanCheckpointStats>;
4719
+ timeRange: StatsTimeRange;
4720
+ generatedAt: string;
4721
+ }
4722
+
4723
+ 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';
4724
+ type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed';
4725
+ interface Activity {
4726
+ id: string;
4727
+ organizationId: string;
4728
+ activityType: ActivityType;
4729
+ status: ActivityStatus;
4730
+ title: string;
4731
+ description: string | null;
4732
+ entityType: string;
4733
+ entityId: string;
4734
+ entityName: string | null;
4735
+ metadata: Record<string, unknown> | null;
4736
+ actorId: string | null;
4737
+ actorType: string | null;
4738
+ occurredAt: Date;
4739
+ createdAt: Date;
4437
4740
  }
4741
+
4438
4742
  /**
4439
- * Response interfaces
4743
+ * Canonical permission catalog.
4744
+ *
4745
+ * Source of truth for the permission keys used by:
4746
+ * - RLS policies in Supabase (via has_org_permission(org_id, key))
4747
+ * - API middleware (via requireOrganizationPermission(key))
4748
+ * - UI hooks (via useOrganizationPermissions().hasPermission(key))
4749
+ *
4750
+ * The DB table `org_rol_permissions` mirrors this constant. Reconciliation
4751
+ * runs at API boot (insert-or-update only — never auto-delete; see the
4752
+ * deletion runbook in the auth-role-system doc -- review/auth-role-system/).
4753
+ *
4754
+ * Adding a permission:
4755
+ * 1. Add an entry below.
4756
+ * 2. Add a row to the migration / via reconcilePermissionCatalog at boot.
4757
+ * 3. Reference it in RLS / middleware as needed.
4758
+ * 4. Optionally grant it to one or more system roles in org_rol_grants.
4759
+ *
4760
+ * Removing a permission: follow the deletion runbook — never just delete
4761
+ * the entry. Existing role grants and policy references must be cleared first.
4440
4762
  */
4441
- interface ListMembershipsResponse {
4442
- data: OrganizationMembership[];
4443
- listMetadata?: {
4444
- before?: string | null;
4445
- after?: string | null;
4446
- };
4447
- }
4763
+ declare const PERMISSIONS: {
4764
+ readonly ORG_READ: "org.read";
4765
+ readonly ORG_MANAGE: "org.manage";
4766
+ readonly ORG_DELETE: "org.delete";
4767
+ readonly MEMBERS_MANAGE: "members.manage";
4768
+ readonly ROLES_MANAGE: "roles.manage";
4769
+ readonly SECRETS_MANAGE: "secrets.manage";
4770
+ readonly OPERATIONS_READ: "operations.read";
4771
+ readonly OPERATIONS_MANAGE: "operations.manage";
4772
+ readonly ACQUISITION_MANAGE: "acquisition.manage";
4773
+ readonly PROJECTS_MANAGE: "projects.manage";
4774
+ };
4775
+ type PermissionKey = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
4448
4776
  /**
4449
- * Extended membership with user and organization details for UI
4777
+ * Static metadata for each permission. Mirrored into org_rol_permissions on
4778
+ * boot reconciliation. is_org_grantable=false means the permission is reserved
4779
+ * to system roles only — custom roles cannot include it (privilege-escalation guard).
4450
4780
  */
4451
- interface MembershipWithDetails extends OrganizationMembership {
4452
- user?: {
4453
- id: string;
4454
- email: string;
4455
- firstName?: string;
4456
- lastName?: string;
4457
- profilePictureUrl?: string;
4458
- };
4459
- organization?: {
4460
- id: string;
4461
- name: string;
4462
- workos_org_id: string;
4463
- primaryDomain?: string;
4464
- is_test?: boolean;
4465
- status?: string;
4466
- metadata?: Record<string, unknown>;
4467
- config?: Record<string, unknown>;
4468
- };
4469
- config?: MembershipFeatureConfig;
4470
- }
4471
-
4472
- type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning';
4473
- interface APIExecutionSummary {
4474
- id: string;
4475
- status: ExecutionStatus;
4476
- startTime: number;
4477
- endTime?: number;
4478
- resourceStatus?: ResourceStatus;
4479
- }
4480
- interface APIExecutionDetail extends APIExecutionSummary {
4481
- executionLogs: ExecutionLogMessage[];
4482
- input?: unknown;
4483
- result?: unknown;
4484
- error?: string;
4485
- resourceStatus: ResourceStatus;
4486
- apiVersion?: string | null;
4487
- resourceVersion?: string | null;
4488
- sdkVersion?: string | null;
4489
- isArchived?: boolean;
4490
- archivedLogCount?: number;
4491
- }
4492
- interface APIExecutionListResponse {
4493
- executions: APIExecutionSummary[];
4494
- total?: number;
4495
- limit?: number;
4496
- offset?: number;
4497
- hasMore?: boolean;
4781
+ interface PermissionDescriptor {
4782
+ key: PermissionKey;
4783
+ description: string;
4784
+ isOrgGrantable: boolean;
4498
4785
  }
4499
4786
 
4500
4787
  /**
@@ -4541,6 +4828,63 @@ declare const ExecutionHistoryResponseSchema: z.ZodObject<{
4541
4828
  type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>;
4542
4829
  type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>;
4543
4830
 
4831
+ /**
4832
+ * Deployment types — browser-safe
4833
+ *
4834
+ * Canonical API response types for the deployment resource.
4835
+ * The API's transformRow converts snake_case DB columns to these camelCase fields.
4836
+ */
4837
+ type DeploymentStatus = 'deploying' | 'active' | 'failed' | 'rolled_back' | 'stopped';
4838
+ interface Deployment {
4839
+ id: string;
4840
+ organizationId: string;
4841
+ status: DeploymentStatus;
4842
+ sdkVersion: string;
4843
+ deploymentVersion: string | null;
4844
+ port: number | null;
4845
+ pid: number | null;
4846
+ tarballPath: string | null;
4847
+ errorMessage: string | null;
4848
+ createdAt: string;
4849
+ updatedAt: string;
4850
+ }
4851
+
4852
+ /**
4853
+ * GET /api/credentials - List credentials
4854
+ */
4855
+ declare const ListCredentialsResponseSchema: z.ZodObject<{
4856
+ credentials: z.ZodArray<z.ZodObject<{
4857
+ id: z.ZodString;
4858
+ name: z.ZodString;
4859
+ type: z.ZodString;
4860
+ provider: z.ZodNullable<z.ZodString>;
4861
+ createdAt: z.ZodString;
4862
+ }, z.core.$strip>>;
4863
+ }, z.core.$strip>;
4864
+ /** API response type for a single credential list item */
4865
+ type CredentialListItem = z.infer<typeof ListCredentialsResponseSchema>['credentials'][number];
4866
+
4867
+ declare function useOrganizationPermissions(): {
4868
+ hasPermission: (key: PermissionKey | string) => boolean;
4869
+ permissions: string[];
4870
+ isPlatformAdmin: boolean;
4871
+ isReady: boolean;
4872
+ };
4873
+ declare function useHasPermission(key: PermissionKey | string): boolean;
4874
+
4875
+ /**
4876
+ * Query key factory for executions TanStack Query hooks.
4877
+ * Uses organization UUID (not name) for cache isolation.
4878
+ */
4879
+ declare const executionsKeys: {
4880
+ all: readonly ["executions"];
4881
+ resources: (orgId: string | null) => readonly ["executions", "resources", string | null];
4882
+ resourceDefinition: (orgId: string | null, resourceId: string) => readonly ["executions", "definition", string | null, string];
4883
+ executionsListBase: (orgId: string | null, resourceId: string) => readonly ["executions", "list", string | null, string];
4884
+ executions: (orgId: string | null, resourceId: string, resourceStatus?: string, limit?: number, offset?: number) => readonly ["executions", "list", string | null, string, string, number | null, number];
4885
+ execution: (orgId: string | null, resourceId: string, executionId: string) => readonly ["executions", "execution", string | null, string, string];
4886
+ };
4887
+
4544
4888
  /**
4545
4889
  * Fetch the execution list for a given resource.
4546
4890
  *
@@ -4644,119 +4988,6 @@ interface BulkDeleteExecutionsResult {
4644
4988
  */
4645
4989
  declare function useBulkDeleteExecutions(): _tanstack_react_query.UseMutationResult<BulkDeleteExecutionsResult, Error, BulkDeleteExecutionsParams, unknown>;
4646
4990
 
4647
- /**
4648
- * @deprecated Use TimeRange from '@repo/core' directly. Kept as alias for backward compatibility.
4649
- */
4650
- type StatsTimeRange = TimeRange;
4651
- /** Stats returned by /command-view/stats (counts only, no error details) */
4652
- interface ResourceStats {
4653
- resourceId: string;
4654
- totalRuns: number;
4655
- successCount: number;
4656
- failureCount: number;
4657
- warningCount: number;
4658
- lastRunAt: string | null;
4659
- }
4660
- /** Response from /command-view/resource-errors (on-demand) */
4661
- interface ResourceErrorsResponse {
4662
- resourceId: string;
4663
- errors: ErrorSummary[];
4664
- totalErrors: number;
4665
- timeRange: StatsTimeRange;
4666
- }
4667
- interface ErrorSummary {
4668
- executionId: string;
4669
- errorType: string;
4670
- errorMessage: string;
4671
- occurredAt: string;
4672
- }
4673
- /** Single execution summary for Recent Executions list in command view */
4674
- interface CommandViewExecution {
4675
- executionId: string;
4676
- status: ExecutionStatus;
4677
- startedAt: string;
4678
- completedAt: string | null;
4679
- errorMessage: string | null;
4680
- }
4681
- /** Response from /command-view/resource-executions (on-demand) */
4682
- interface ResourceExecutionsResponse {
4683
- resourceId: string;
4684
- executions: CommandViewExecution[];
4685
- totalExecutions: number;
4686
- timeRange: StatsTimeRange;
4687
- page: number;
4688
- limit: number;
4689
- }
4690
- interface HumanCheckpointStats {
4691
- checkpointId: string;
4692
- pendingCount: number;
4693
- completedCount: number;
4694
- expiredCount: number;
4695
- lastDecisionAt: string | null;
4696
- }
4697
- /** Response from /command-view/stats */
4698
- interface CommandViewStatsResponse {
4699
- resources: Record<string, ResourceStats>;
4700
- humanCheckpoints: Record<string, HumanCheckpointStats>;
4701
- timeRange: StatsTimeRange;
4702
- generatedAt: string;
4703
- }
4704
-
4705
- type ActivityType = 'workflow_execution' | 'agent_run' | 'hitl_action' | 'webhook_received' | 'webhook_executed' | 'webhook_failed' | 'credential_change' | 'api_key_change' | 'deployment_change' | 'membership_change';
4706
- type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed';
4707
- interface Activity {
4708
- id: string;
4709
- organizationId: string;
4710
- activityType: ActivityType;
4711
- status: ActivityStatus;
4712
- title: string;
4713
- description: string | null;
4714
- entityType: string;
4715
- entityId: string;
4716
- entityName: string | null;
4717
- metadata: Record<string, unknown> | null;
4718
- actorId: string | null;
4719
- actorType: string | null;
4720
- occurredAt: Date;
4721
- createdAt: Date;
4722
- }
4723
-
4724
- /**
4725
- * Deployment types — browser-safe
4726
- *
4727
- * Canonical API response types for the deployment resource.
4728
- * The API's transformRow converts snake_case DB columns to these camelCase fields.
4729
- */
4730
- type DeploymentStatus = 'deploying' | 'active' | 'failed' | 'rolled_back' | 'stopped';
4731
- interface Deployment {
4732
- id: string;
4733
- organizationId: string;
4734
- status: DeploymentStatus;
4735
- sdkVersion: string;
4736
- deploymentVersion: string | null;
4737
- port: number | null;
4738
- pid: number | null;
4739
- tarballPath: string | null;
4740
- errorMessage: string | null;
4741
- createdAt: string;
4742
- updatedAt: string;
4743
- }
4744
-
4745
- /**
4746
- * GET /api/credentials - List credentials
4747
- */
4748
- declare const ListCredentialsResponseSchema: z.ZodObject<{
4749
- credentials: z.ZodArray<z.ZodObject<{
4750
- id: z.ZodString;
4751
- name: z.ZodString;
4752
- type: z.ZodString;
4753
- provider: z.ZodNullable<z.ZodString>;
4754
- createdAt: z.ZodString;
4755
- }, z.core.$strip>>;
4756
- }, z.core.$strip>;
4757
- /** API response type for a single credential list item */
4758
- type CredentialListItem = z.infer<typeof ListCredentialsResponseSchema>['credentials'][number];
4759
-
4760
4991
  /**
4761
4992
  * Fetch all available Execution Engine resources (workflows, agents, pipelines).
4762
4993
  *
@@ -5707,10 +5938,6 @@ declare function createFeatureAccessHook({ useInitialization, useOrganization }:
5707
5938
  checkFeature: (featureKey: string) => FeatureAccessResult;
5708
5939
  isReady: boolean;
5709
5940
  };
5710
- /**
5711
- * @deprecated Use `createFeatureAccessHook` instead. This alias will be removed in a future release.
5712
- */
5713
- declare const createUseFeatureAccess: typeof createFeatureAccessHook;
5714
5941
 
5715
5942
  interface UseSSEConnectionOptions {
5716
5943
  manager: SSEConnectionManagerLike;
@@ -6169,6 +6396,8 @@ interface UseCommandViewStatsOptions {
6169
6396
  */
6170
6397
  declare function useCommandViewStats(timeRange?: StatsTimeRange, options?: UseCommandViewStatsOptions): _tanstack_react_query.UseQueryResult<CommandViewStatsResponse, Error>;
6171
6398
 
6399
+ type CommandViewVisualizationMode = 'cluster' | 'swimlane' | 'focus' | 'network' | 'spatial';
6400
+
6172
6401
  /**
6173
6402
  * Command View Types
6174
6403
  *
@@ -6290,15 +6519,28 @@ interface CommandViewStore {
6290
6519
  setShowIntegrations: (v: boolean) => void;
6291
6520
  fitViewOnFilter: boolean;
6292
6521
  setFitViewOnFilter: (v: boolean) => void;
6522
+ visualizationMode: CommandViewVisualizationMode;
6523
+ setVisualizationMode: (v: CommandViewVisualizationMode) => void;
6293
6524
  selectedNodeId: string | null;
6294
6525
  setSelectedNodeId: (id: string | null) => void;
6526
+ resourcesHidden: boolean;
6527
+ setResourcesHidden: (v: boolean) => void;
6528
+ diagnosticsHidden: boolean;
6529
+ setDiagnosticsHidden: (v: boolean) => void;
6530
+ diagnosticCategories: string[];
6531
+ revealedIds: Set<string>;
6532
+ setRevealedIds: (ids: Iterable<string>) => void;
6533
+ clearRevealedIds: () => void;
6534
+ hasVisibilityInteraction: boolean;
6535
+ markVisibilityInteraction: () => void;
6536
+ resetVisibilityInteraction: () => void;
6295
6537
  }
6296
6538
  /**
6297
6539
  * Shared store for Command View filter/settings state.
6298
6540
  * Allows CommandViewPage (graph) and CommandViewSidebarContent (sidebar) to share state.
6299
6541
  *
6300
- * Persisted to localStorage: showIntegrations, fitViewOnFilter
6301
- * Not persisted (reset on reload): statusFilter, selectedNodeId
6542
+ * Persisted to localStorage: showIntegrations, fitViewOnFilter, resource/diagnostic visibility preferences.
6543
+ * Not persisted (reset on reload): statusFilter, selectedNodeId, revealedIds, CTA interaction state.
6302
6544
  */
6303
6545
  declare const useCommandViewStore: zustand.UseBoundStore<Omit<zustand.StoreApi<CommandViewStore>, "setState" | "persist"> & {
6304
6546
  setState(partial: CommandViewStore | Partial<CommandViewStore> | ((state: CommandViewStore) => CommandViewStore | Partial<CommandViewStore>), replace?: false | undefined): unknown;
@@ -6307,6 +6549,9 @@ declare const useCommandViewStore: zustand.UseBoundStore<Omit<zustand.StoreApi<C
6307
6549
  setOptions: (options: Partial<zustand_middleware.PersistOptions<CommandViewStore, {
6308
6550
  showIntegrations: boolean;
6309
6551
  fitViewOnFilter: boolean;
6552
+ visualizationMode: CommandViewVisualizationMode;
6553
+ resourcesHidden: boolean;
6554
+ diagnosticsHidden: boolean;
6310
6555
  }, unknown>>) => void;
6311
6556
  clearStorage: () => void;
6312
6557
  rehydrate: () => Promise<void> | void;
@@ -6316,6 +6561,9 @@ declare const useCommandViewStore: zustand.UseBoundStore<Omit<zustand.StoreApi<C
6316
6561
  getOptions: () => Partial<zustand_middleware.PersistOptions<CommandViewStore, {
6317
6562
  showIntegrations: boolean;
6318
6563
  fitViewOnFilter: boolean;
6564
+ visualizationMode: CommandViewVisualizationMode;
6565
+ resourcesHidden: boolean;
6566
+ diagnosticsHidden: boolean;
6319
6567
  }, unknown>>;
6320
6568
  };
6321
6569
  }>;
@@ -6437,7 +6685,7 @@ interface DealSummaryStageItem {
6437
6685
  interface StaleDealSummaryItem {
6438
6686
  id: string;
6439
6687
  contactEmail: string;
6440
- cachedStage: string;
6688
+ stageKey: string;
6441
6689
  updatedAt: string;
6442
6690
  daysStale: number;
6443
6691
  }
@@ -6455,7 +6703,7 @@ interface DealsSummaryResponse {
6455
6703
  interface DealLookupItem {
6456
6704
  id: string;
6457
6705
  contactEmail: string;
6458
- cachedStage: string | null;
6706
+ stageKey: string | null;
6459
6707
  updatedAt: string;
6460
6708
  contactName: string | null;
6461
6709
  companyName: string | null;
@@ -6512,13 +6760,14 @@ declare function useDeals(filters?: DealFilters): {
6512
6760
  organization_id: string;
6513
6761
  contact_id: string | null;
6514
6762
  contact_email: string;
6515
- cached_stage: string | null;
6763
+ pipeline_key: string;
6764
+ stage_key: string | null;
6765
+ state_key: string | null;
6516
6766
  activity_log: unknown;
6517
6767
  discovery_data: unknown;
6518
6768
  discovery_submitted_at: string | null;
6519
6769
  discovery_submitted_by: string | null;
6520
6770
  proposal_data: unknown;
6521
- proposal_status: string | null;
6522
6771
  proposal_sent_at: string | null;
6523
6772
  proposal_pdf_url: string | null;
6524
6773
  signature_envelope_id: string | null;
@@ -6564,13 +6813,14 @@ declare function useDeals(filters?: DealFilters): {
6564
6813
  organization_id: string;
6565
6814
  contact_id: string | null;
6566
6815
  contact_email: string;
6567
- cached_stage: string | null;
6816
+ pipeline_key: string;
6817
+ stage_key: string | null;
6818
+ state_key: string | null;
6568
6819
  activity_log: unknown;
6569
6820
  discovery_data: unknown;
6570
6821
  discovery_submitted_at: string | null;
6571
6822
  discovery_submitted_by: string | null;
6572
6823
  proposal_data: unknown;
6573
- proposal_status: string | null;
6574
6824
  proposal_sent_at: string | null;
6575
6825
  proposal_pdf_url: string | null;
6576
6826
  signature_envelope_id: string | null;
@@ -6629,17 +6879,22 @@ declare function useDeleteDeal(): _tanstack_react_query.UseMutationResult<void,
6629
6879
 
6630
6880
  declare function useDealDetail(acqDealId: string): _tanstack_react_query.UseQueryResult<DealListItem | null, Error>;
6631
6881
 
6632
- interface SyncDealStageParams {
6882
+ interface TransitionItemInput {
6633
6883
  dealId: string;
6634
- stage: DealStage;
6884
+ pipelineKey: string;
6885
+ stageKey: string;
6886
+ stateKey?: string | null;
6887
+ reason?: string;
6888
+ expectedUpdatedAt?: string;
6635
6889
  }
6636
6890
  /**
6637
- * Sync a deal's cached_stage via the API.
6891
+ * Transition a deal's stage/state via the PATCH /deals/:dealId/transition endpoint.
6638
6892
  *
6639
- * The backend syncDealStage method additionally logs a stage_change activity entry.
6640
- * On success invalidates the deals list and the specific deal detail query.
6893
+ * The backend transitionItem handler logs a stage_change activity entry and enforces
6894
+ * optimistic-concurrency via expectedUpdatedAt (optional).
6895
+ * On success invalidates the deals list, summaries, and the specific deal detail query.
6641
6896
  */
6642
- declare function useSyncDealStage(): _tanstack_react_query.UseMutationResult<void, Error, SyncDealStageParams, unknown>;
6897
+ declare function useTransitionItem(): _tanstack_react_query.UseMutationResult<void, Error, TransitionItemInput, unknown>;
6643
6898
 
6644
6899
  /**
6645
6900
  * Query keys for deal notes
@@ -7593,10 +7848,56 @@ declare function useReactivateMembership(): _tanstack_react_query.UseMutationRes
7593
7848
  previousData: unknown;
7594
7849
  }>;
7595
7850
 
7851
+ type OrgRolDefinitionRow = Database['public']['Tables']['org_rol_definitions']['Row'];
7852
+ type OrgRole = OrgRolDefinitionRow & {
7853
+ grants?: string[];
7854
+ memberCount?: number;
7855
+ };
7856
+ type CreateOrgRoleInput = {
7857
+ name: string;
7858
+ slug: string;
7859
+ description?: string;
7860
+ permissionKeys: string[];
7861
+ };
7862
+ type UpdateOrgRoleInput = Partial<CreateOrgRoleInput>;
7863
+ type AssignRoleInput = {
7864
+ membershipId: string;
7865
+ roleId: string;
7866
+ };
7867
+ type RevokeRoleInput = {
7868
+ membershipId: string;
7869
+ roleId: string;
7870
+ };
7871
+
7872
+ declare function useOrgRoles(orgId?: string): _tanstack_react_query.UseQueryResult<{
7873
+ roles: OrgRole[];
7874
+ }, Error>;
7875
+
7876
+ declare function usePermissionCatalog(): _tanstack_react_query.UseQueryResult<{
7877
+ permissions: PermissionDescriptor[];
7878
+ }, Error>;
7879
+
7880
+ declare function useCreateOrgRole(): _tanstack_react_query.UseMutationResult<OrgRole, Error, CreateOrgRoleInput, unknown>;
7881
+
7882
+ interface UpdateOrgRoleParams {
7883
+ roleId: string;
7884
+ input: UpdateOrgRoleInput;
7885
+ }
7886
+ declare function useUpdateOrgRole(): _tanstack_react_query.UseMutationResult<OrgRole, Error, UpdateOrgRoleParams, unknown>;
7887
+
7888
+ declare function useDeleteOrgRole(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
7889
+
7890
+ declare function useAssignRole(): _tanstack_react_query.UseMutationResult<void, Error, AssignRoleInput, unknown>;
7891
+ declare function useRevokeRole(): _tanstack_react_query.UseMutationResult<void, Error, RevokeRoleInput, unknown>;
7892
+
7893
+ declare function useEffectivePermissions(membershipId: string | undefined): _tanstack_react_query.UseQueryResult<{
7894
+ permissions: string[];
7895
+ }, Error>;
7896
+
7596
7897
  declare function useListWebhookEndpoints(): _tanstack_react_query.UseQueryResult<{
7597
7898
  id: string;
7598
7899
  organizationId: string;
7599
- key: string;
7900
+ keyPrefix: string | null;
7600
7901
  name: string;
7601
7902
  description: string | null;
7602
7903
  resourceId: string | null;
@@ -7605,12 +7906,13 @@ declare function useListWebhookEndpoints(): _tanstack_react_query.UseQueryResult
7605
7906
  requestCount: number;
7606
7907
  createdAt: string;
7607
7908
  updatedAt: string;
7909
+ key?: string | undefined;
7608
7910
  }[], Error>;
7609
7911
 
7610
7912
  declare function useCreateWebhookEndpoint(): _tanstack_react_query.UseMutationResult<{
7611
7913
  id: string;
7612
7914
  organizationId: string;
7613
- key: string;
7915
+ keyPrefix: string | null;
7614
7916
  name: string;
7615
7917
  description: string | null;
7616
7918
  resourceId: string | null;
@@ -7619,6 +7921,7 @@ declare function useCreateWebhookEndpoint(): _tanstack_react_query.UseMutationRe
7619
7921
  requestCount: number;
7620
7922
  createdAt: string;
7621
7923
  updatedAt: string;
7924
+ key?: string | undefined;
7622
7925
  }, Error, {
7623
7926
  name: string;
7624
7927
  resourceId?: string | undefined;
@@ -7660,7 +7963,8 @@ type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestS
7660
7963
  declare const WebhookEndpointResponseSchema: z.ZodObject<{
7661
7964
  id: z.ZodString;
7662
7965
  organizationId: z.ZodString;
7663
- key: z.ZodString;
7966
+ key: z.ZodOptional<z.ZodString>;
7967
+ keyPrefix: z.ZodNullable<z.ZodString>;
7664
7968
  name: z.ZodString;
7665
7969
  description: z.ZodNullable<z.ZodString>;
7666
7970
  resourceId: z.ZodNullable<z.ZodString>;
@@ -7678,7 +7982,7 @@ type WebhookEndpointResponse = z.infer<typeof WebhookEndpointResponseSchema>;
7678
7982
  declare function useUpdateWebhookEndpoint(): _tanstack_react_query.UseMutationResult<{
7679
7983
  id: string;
7680
7984
  organizationId: string;
7681
- key: string;
7985
+ keyPrefix: string | null;
7682
7986
  name: string;
7683
7987
  description: string | null;
7684
7988
  resourceId: string | null;
@@ -7687,6 +7991,7 @@ declare function useUpdateWebhookEndpoint(): _tanstack_react_query.UseMutationRe
7687
7991
  requestCount: number;
7688
7992
  createdAt: string;
7689
7993
  updatedAt: string;
7994
+ key?: string | undefined;
7690
7995
  }, Error, {
7691
7996
  endpointId: string;
7692
7997
  data: UpdateWebhookEndpointRequest;
@@ -8255,5 +8560,5 @@ declare function useCreateNote(): _tanstack_react_query.UseMutationResult<{
8255
8560
  type?: string;
8256
8561
  }, "organization_id">, unknown>;
8257
8562
 
8258
- 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, createUseFeatureAccess, 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, 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 };
8259
- 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, ResourceFilterFacet, 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 };
8563
+ 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, useTableSelection, useTableSort, useTasks, useTestNotification, useTimeRangeDates, useTopFailingResources, useTransitionItem, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateProject as useUpdateDeliveryProject, useUpdateList, useUpdateListConfig, useUpdateMemberConfig, useUpdateMilestone, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateTask, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
8564
+ 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, TransitionItemInput, UpdateOrgRoleInput, UpdateScheduleInput, UseActivitiesParams, UseActivityTrendParams, UseBatchedResourcesHealthParams, UseExecuteResourceOptions, UseExecutionHealthParams, UseExecutionLogsParams, UseExecutionPanelStateOptions, UseExecutionPanelStateReturn, UseNotificationCountArgs, UseResourcesHealthParams, UseSSEConnectionOptions, UseScheduledTasksOptions, WebSocketState };