@synap-core/api-types 1.6.1 → 1.7.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.
@@ -2,8 +2,23 @@
2
2
 
3
3
  import { Column, SQL } from 'drizzle-orm';
4
4
 
5
- type DatabaseClient = any;
6
- interface KratosIdentity {
5
+ /**
6
+ * Context Types
7
+ *
8
+ * Proper type definitions for tRPC context to avoid `any` types.
9
+ */
10
+ /**
11
+ * Database client type
12
+ *
13
+ * Note: Using `any` here to preserve Drizzle's schema inference.
14
+ * Attempting to use PostgresJsDatabase<any> loses the schema generic
15
+ * and breaks db.query.tableName access patterns.
16
+ */
17
+ export type DatabaseClient = any;
18
+ /**
19
+ * Ory Kratos identity
20
+ */
21
+ export interface KratosIdentity {
7
22
  id: string;
8
23
  traits: {
9
24
  email: string;
@@ -11,18 +26,27 @@ interface KratosIdentity {
11
26
  [key: string]: unknown;
12
27
  };
13
28
  }
14
- interface KratosSession {
29
+ /**
30
+ * Ory Kratos session
31
+ */
32
+ export interface KratosSession {
15
33
  identity: KratosIdentity;
16
34
  active: boolean;
17
35
  expires_at?: string;
18
36
  authenticated_at?: string;
19
37
  }
20
- interface User {
38
+ /**
39
+ * User object (simplified from Kratos identity)
40
+ */
41
+ export interface User {
21
42
  id: string;
22
43
  email: string;
23
44
  name?: string;
24
45
  }
25
- interface Context {
46
+ /**
47
+ * Full tRPC context
48
+ */
49
+ export interface Context {
26
50
  db: DatabaseClient;
27
51
  authenticated: boolean;
28
52
  userId?: string | null;
@@ -33,22 +57,52 @@ interface Context {
33
57
  workspaceId?: string | null;
34
58
  workspaceRole?: string | null;
35
59
  }
36
- interface AgentMetadata {
60
+ /**
61
+ * Users Table - Cache for Kratos Identity Data
62
+ *
63
+ * Purpose: Store Kratos identity data in Synap DB for performance
64
+ * - Allows JOINs without calling Kratos API
65
+ * - Can add Synap-specific fields (avatar, timezone)
66
+ * - Kratos remains source of truth for authentication
67
+ */
68
+ export interface AgentMetadata {
37
69
  agentType: string;
38
70
  description?: string;
39
71
  createdByUserId: string;
40
72
  capabilities?: string[];
41
73
  }
42
- declare enum ChatThreadType {
43
- MAIN = "main",
44
- BRANCH = "branch"
74
+ declare enum MessageRole {
75
+ USER = "user",
76
+ ASSISTANT = "assistant",
77
+ SYSTEM = "system"
78
+ }
79
+ declare enum MessageAuthorType {
80
+ HUMAN = "human",
81
+ AI_AGENT = "ai_agent",
82
+ EXTERNAL = "external",// message imported from external platform
83
+ BOT = "bot"
84
+ }
85
+ declare enum MessageCategory {
86
+ CHAT = "chat",// standard conversational message
87
+ COMMENT = "comment",// comment on an entity/document/view
88
+ SYSTEM_NOTIFICATION = "system_notification",// cross-channel update, conflict alerts, etc.
89
+ REVIEW = "review"
90
+ }
91
+ declare enum ChannelType {
92
+ AI_THREAD = "ai_thread",
93
+ BRANCH = "branch",
94
+ ENTITY_COMMENTS = "entity_comments",
95
+ DOCUMENT_REVIEW = "document_review",
96
+ VIEW_DISCUSSION = "view_discussion",
97
+ DIRECT = "direct",
98
+ EXTERNAL_IMPORT = "external_import"
45
99
  }
46
- declare enum ChatThreadStatus {
100
+ declare enum ChannelStatus {
47
101
  ACTIVE = "active",
48
102
  MERGED = "merged",
49
103
  ARCHIVED = "archived"
50
104
  }
51
- declare enum ChatThreadAgentType {
105
+ declare enum ChannelAgentType {
52
106
  DEFAULT = "default",
53
107
  META = "meta",
54
108
  PROMPTING = "prompting",
@@ -59,13 +113,13 @@ declare enum ChatThreadAgentType {
59
113
  ONBOARDING = "onboarding",
60
114
  WORKSPACE_CREATION = "workspace-creation"
61
115
  }
62
- declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
63
- name: "chat_threads";
116
+ declare const channels: import("drizzle-orm/pg-core").PgTableWithColumns<{
117
+ name: "channels";
64
118
  schema: undefined;
65
119
  columns: {
66
120
  id: import("drizzle-orm/pg-core").PgColumn<{
67
121
  name: "id";
68
- tableName: "chat_threads";
122
+ tableName: "channels";
69
123
  dataType: "string";
70
124
  columnType: "PgUUID";
71
125
  data: string;
@@ -82,7 +136,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
82
136
  }, {}, {}>;
83
137
  userId: import("drizzle-orm/pg-core").PgColumn<{
84
138
  name: "user_id";
85
- tableName: "chat_threads";
139
+ tableName: "channels";
86
140
  dataType: "string";
87
141
  columnType: "PgText";
88
142
  data: string;
@@ -102,7 +156,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
102
156
  }, {}, {}>;
103
157
  workspaceId: import("drizzle-orm/pg-core").PgColumn<{
104
158
  name: "workspace_id";
105
- tableName: "chat_threads";
159
+ tableName: "channels";
106
160
  dataType: "string";
107
161
  columnType: "PgUUID";
108
162
  data: string;
@@ -119,7 +173,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
119
173
  }, {}, {}>;
120
174
  title: import("drizzle-orm/pg-core").PgColumn<{
121
175
  name: "title";
122
- tableName: "chat_threads";
176
+ tableName: "channels";
123
177
  dataType: "string";
124
178
  columnType: "PgText";
125
179
  data: string;
@@ -137,12 +191,12 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
137
191
  identity: undefined;
138
192
  generated: undefined;
139
193
  }, {}, {}>;
140
- threadType: import("drizzle-orm/pg-core").PgColumn<{
141
- name: "thread_type";
142
- tableName: "chat_threads";
194
+ channelType: import("drizzle-orm/pg-core").PgColumn<{
195
+ name: "channel_type";
196
+ tableName: "channels";
143
197
  dataType: "string";
144
198
  columnType: "PgText";
145
- data: ChatThreadType;
199
+ data: ChannelType;
146
200
  driverParam: string;
147
201
  notNull: true;
148
202
  hasDefault: true;
@@ -150,16 +204,58 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
150
204
  isAutoincrement: false;
151
205
  hasRuntimeDefault: false;
152
206
  enumValues: [
153
- ChatThreadType.MAIN,
154
- ChatThreadType.BRANCH
207
+ ChannelType.AI_THREAD,
208
+ ChannelType.BRANCH,
209
+ ChannelType.ENTITY_COMMENTS,
210
+ ChannelType.DOCUMENT_REVIEW,
211
+ ChannelType.VIEW_DISCUSSION,
212
+ ChannelType.DIRECT,
213
+ ChannelType.EXTERNAL_IMPORT
214
+ ];
215
+ baseColumn: never;
216
+ identity: undefined;
217
+ generated: undefined;
218
+ }, {}, {}>;
219
+ contextObjectType: import("drizzle-orm/pg-core").PgColumn<{
220
+ name: "context_object_type";
221
+ tableName: "channels";
222
+ dataType: "string";
223
+ columnType: "PgText";
224
+ data: string;
225
+ driverParam: string;
226
+ notNull: false;
227
+ hasDefault: false;
228
+ isPrimaryKey: false;
229
+ isAutoincrement: false;
230
+ hasRuntimeDefault: false;
231
+ enumValues: [
232
+ string,
233
+ ...string[]
155
234
  ];
156
235
  baseColumn: never;
157
236
  identity: undefined;
158
237
  generated: undefined;
159
238
  }, {}, {}>;
160
- parentThreadId: import("drizzle-orm/pg-core").PgColumn<{
161
- name: "parent_thread_id";
162
- tableName: "chat_threads";
239
+ contextObjectId: import("drizzle-orm/pg-core").PgColumn<{
240
+ name: "context_object_id";
241
+ tableName: "channels";
242
+ dataType: "string";
243
+ columnType: "PgUUID";
244
+ data: string;
245
+ driverParam: string;
246
+ notNull: false;
247
+ hasDefault: false;
248
+ isPrimaryKey: false;
249
+ isAutoincrement: false;
250
+ hasRuntimeDefault: false;
251
+ enumValues: undefined;
252
+ baseColumn: never;
253
+ identity: undefined;
254
+ generated: undefined;
255
+ }, {}, {}>;
256
+ parentChannelId: import("drizzle-orm/pg-core").PgColumn<{
257
+ name: "parent_channel_id";
258
+ tableName: "channels";
163
259
  dataType: "string";
164
260
  columnType: "PgUUID";
165
261
  data: string;
@@ -176,7 +272,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
176
272
  }, {}, {}>;
177
273
  branchedFromMessageId: import("drizzle-orm/pg-core").PgColumn<{
178
274
  name: "branched_from_message_id";
179
- tableName: "chat_threads";
275
+ tableName: "channels";
180
276
  dataType: "string";
181
277
  columnType: "PgUUID";
182
278
  data: string;
@@ -193,7 +289,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
193
289
  }, {}, {}>;
194
290
  branchPurpose: import("drizzle-orm/pg-core").PgColumn<{
195
291
  name: "branch_purpose";
196
- tableName: "chat_threads";
292
+ tableName: "channels";
197
293
  dataType: "string";
198
294
  columnType: "PgText";
199
295
  data: string;
@@ -213,7 +309,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
213
309
  }, {}, {}>;
214
310
  agentId: import("drizzle-orm/pg-core").PgColumn<{
215
311
  name: "agent_id";
216
- tableName: "chat_threads";
312
+ tableName: "channels";
217
313
  dataType: "string";
218
314
  columnType: "PgText";
219
315
  data: string;
@@ -233,10 +329,10 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
233
329
  }, {}, {}>;
234
330
  status: import("drizzle-orm/pg-core").PgColumn<{
235
331
  name: "status";
236
- tableName: "chat_threads";
332
+ tableName: "channels";
237
333
  dataType: "string";
238
334
  columnType: "PgText";
239
- data: ChatThreadStatus;
335
+ data: ChannelStatus;
240
336
  driverParam: string;
241
337
  notNull: true;
242
338
  hasDefault: true;
@@ -244,9 +340,9 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
244
340
  isAutoincrement: false;
245
341
  hasRuntimeDefault: false;
246
342
  enumValues: [
247
- ChatThreadStatus.ACTIVE,
248
- ChatThreadStatus.MERGED,
249
- ChatThreadStatus.ARCHIVED
343
+ ChannelStatus.ACTIVE,
344
+ ChannelStatus.MERGED,
345
+ ChannelStatus.ARCHIVED
250
346
  ];
251
347
  baseColumn: never;
252
348
  identity: undefined;
@@ -254,10 +350,10 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
254
350
  }, {}, {}>;
255
351
  agentType: import("drizzle-orm/pg-core").PgColumn<{
256
352
  name: "agent_type";
257
- tableName: "chat_threads";
353
+ tableName: "channels";
258
354
  dataType: "string";
259
355
  columnType: "PgText";
260
- data: ChatThreadAgentType;
356
+ data: ChannelAgentType;
261
357
  driverParam: string;
262
358
  notNull: true;
263
359
  hasDefault: true;
@@ -265,15 +361,15 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
265
361
  isAutoincrement: false;
266
362
  hasRuntimeDefault: false;
267
363
  enumValues: [
268
- ChatThreadAgentType.DEFAULT,
269
- ChatThreadAgentType.META,
270
- ChatThreadAgentType.PROMPTING,
271
- ChatThreadAgentType.KNOWLEDGE_SEARCH,
272
- ChatThreadAgentType.CODE,
273
- ChatThreadAgentType.WRITING,
274
- ChatThreadAgentType.ACTION,
275
- ChatThreadAgentType.ONBOARDING,
276
- ChatThreadAgentType.WORKSPACE_CREATION
364
+ ChannelAgentType.DEFAULT,
365
+ ChannelAgentType.META,
366
+ ChannelAgentType.PROMPTING,
367
+ ChannelAgentType.KNOWLEDGE_SEARCH,
368
+ ChannelAgentType.CODE,
369
+ ChannelAgentType.WRITING,
370
+ ChannelAgentType.ACTION,
371
+ ChannelAgentType.ONBOARDING,
372
+ ChannelAgentType.WORKSPACE_CREATION
277
373
  ];
278
374
  baseColumn: never;
279
375
  identity: undefined;
@@ -281,7 +377,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
281
377
  }, {}, {}>;
282
378
  agentConfig: import("drizzle-orm/pg-core").PgColumn<{
283
379
  name: "agent_config";
284
- tableName: "chat_threads";
380
+ tableName: "channels";
285
381
  dataType: "json";
286
382
  columnType: "PgJsonb";
287
383
  data: unknown;
@@ -298,7 +394,47 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
298
394
  }, {}, {}>;
299
395
  contextSummary: import("drizzle-orm/pg-core").PgColumn<{
300
396
  name: "context_summary";
301
- tableName: "chat_threads";
397
+ tableName: "channels";
398
+ dataType: "string";
399
+ columnType: "PgText";
400
+ data: string;
401
+ driverParam: string;
402
+ notNull: false;
403
+ hasDefault: false;
404
+ isPrimaryKey: false;
405
+ isAutoincrement: false;
406
+ hasRuntimeDefault: false;
407
+ enumValues: [
408
+ string,
409
+ ...string[]
410
+ ];
411
+ baseColumn: never;
412
+ identity: undefined;
413
+ generated: undefined;
414
+ }, {}, {}>;
415
+ externalSource: import("drizzle-orm/pg-core").PgColumn<{
416
+ name: "external_source";
417
+ tableName: "channels";
418
+ dataType: "string";
419
+ columnType: "PgText";
420
+ data: string;
421
+ driverParam: string;
422
+ notNull: false;
423
+ hasDefault: false;
424
+ isPrimaryKey: false;
425
+ isAutoincrement: false;
426
+ hasRuntimeDefault: false;
427
+ enumValues: [
428
+ string,
429
+ ...string[]
430
+ ];
431
+ baseColumn: never;
432
+ identity: undefined;
433
+ generated: undefined;
434
+ }, {}, {}>;
435
+ externalChannelId: import("drizzle-orm/pg-core").PgColumn<{
436
+ name: "external_channel_id";
437
+ tableName: "channels";
302
438
  dataType: "string";
303
439
  columnType: "PgText";
304
440
  data: string;
@@ -318,7 +454,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
318
454
  }, {}, {}>;
319
455
  metadata: import("drizzle-orm/pg-core").PgColumn<{
320
456
  name: "metadata";
321
- tableName: "chat_threads";
457
+ tableName: "channels";
322
458
  dataType: "json";
323
459
  columnType: "PgJsonb";
324
460
  data: unknown;
@@ -335,7 +471,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
335
471
  }, {}, {}>;
336
472
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
337
473
  name: "created_at";
338
- tableName: "chat_threads";
474
+ tableName: "channels";
339
475
  dataType: "date";
340
476
  columnType: "PgTimestamp";
341
477
  data: Date;
@@ -352,7 +488,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
352
488
  }, {}, {}>;
353
489
  updatedAt: import("drizzle-orm/pg-core").PgColumn<{
354
490
  name: "updated_at";
355
- tableName: "chat_threads";
491
+ tableName: "channels";
356
492
  dataType: "date";
357
493
  columnType: "PgTimestamp";
358
494
  data: Date;
@@ -369,7 +505,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
369
505
  }, {}, {}>;
370
506
  mergedAt: import("drizzle-orm/pg-core").PgColumn<{
371
507
  name: "merged_at";
372
- tableName: "chat_threads";
508
+ tableName: "channels";
373
509
  dataType: "date";
374
510
  columnType: "PgTimestamp";
375
511
  data: Date;
@@ -387,50 +523,53 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
387
523
  };
388
524
  dialect: "pg";
389
525
  }>;
390
- type ChatThread = typeof chatThreads.$inferSelect;
391
- declare enum ThreadEntityRelationshipType {
392
- USED_AS_CONTEXT = "used_as_context",
393
- CREATED = "created",
394
- UPDATED = "updated",
395
- REFERENCED = "referenced",
396
- INHERITED_FROM_PARENT = "inherited_from_parent"
397
- }
398
- declare enum ThreadEntityConflictStatus {
399
- NONE = "none",
400
- PENDING = "pending",
401
- RESOLVED = "resolved"
526
+ export type Channel = typeof channels.$inferSelect;
527
+ declare enum ChannelContextObjectType {
528
+ ENTITY = "entity",
529
+ DOCUMENT = "document",
530
+ VIEW = "view",
531
+ PROPOSAL = "proposal",
532
+ INBOX_ITEM = "inbox_item"
402
533
  }
403
- declare enum ThreadDocumentRelationshipType {
534
+ declare enum ChannelContextRelationshipType {
404
535
  USED_AS_CONTEXT = "used_as_context",
405
536
  CREATED = "created",
406
537
  UPDATED = "updated",
407
538
  REFERENCED = "referenced",
408
539
  INHERITED_FROM_PARENT = "inherited_from_parent"
409
540
  }
410
- declare enum ThreadDocumentConflictStatus {
541
+ declare enum ChannelContextConflictStatus {
411
542
  NONE = "none",
412
543
  PENDING = "pending",
413
544
  RESOLVED = "resolved"
414
545
  }
415
- interface DerivedInput {
546
+ export interface DerivedInput {
416
547
  name: string;
417
548
  label?: string;
418
549
  type?: string;
419
550
  options?: string[];
420
551
  default?: string;
421
552
  }
422
- interface InputOverride {
553
+ export interface InputOverride {
423
554
  label?: string;
424
555
  default?: string;
425
556
  options?: string[];
426
557
  }
427
- interface WorkspaceLayoutConfig {
558
+ /**
559
+ * Workspaces Schema - Multi-user workspace support
560
+ *
561
+ * A workspace can be:
562
+ * - Personal (single user)
563
+ * - Team (multiple users with roles)
564
+ * - Enterprise (advanced features)
565
+ */
566
+ export interface WorkspaceLayoutConfig {
428
567
  pinnedApps?: string[];
429
568
  sidebarApps?: string[];
430
569
  defaultView?: string;
431
570
  theme?: string;
432
571
  }
433
- interface WorkspaceSettings {
572
+ export interface WorkspaceSettings {
434
573
  defaultEntityTypes?: string[];
435
574
  theme?: string;
436
575
  aiEnabled?: boolean;
@@ -671,12 +810,29 @@ declare const messageLinks: import("drizzle-orm/pg-core").PgTableWithColumns<{
671
810
  };
672
811
  dialect: "pg";
673
812
  }>;
674
- type MessageLink = typeof messageLinks.$inferSelect;
813
+ export type MessageLink = typeof messageLinks.$inferSelect;
675
814
  declare enum PropertyValueType {
676
815
  STRING = "string",
677
816
  NUMBER = "number",
678
817
  BOOLEAN = "boolean",
679
818
  DATE = "date",
819
+ /**
820
+ * A UUID reference to another entity in the same workspace.
821
+ *
822
+ * This is a STRUCTURAL LINK — part of the profile schema, not the graph.
823
+ * When a property has this type, the value stored is the UUID of another entity.
824
+ * It represents a modelled, schema-defined relationship (e.g. "this task's project",
825
+ * "this deal's primary contact").
826
+ *
827
+ * These differ from semantic graph relations (`relations` table):
828
+ * - Structural links (entity_id props) are schema-defined, form-based, one-directional
829
+ * - Semantic relations are schema-free, emergent, bi-directional
830
+ *
831
+ * Use `entity_property_index.value_entity_id` for fast reverse-lookup:
832
+ * "find all entities whose [property] points to entity X"
833
+ *
834
+ * @see /docs/docs/concepts/entity-connections.md — architecture decision doc
835
+ */
680
836
  ENTITY_ID = "entity_id",
681
837
  ARRAY = "array",
682
838
  OBJECT = "object",
@@ -723,6 +879,23 @@ declare const propertyDefs: import("drizzle-orm/pg-core").PgTableWithColumns<{
723
879
  identity: undefined;
724
880
  generated: undefined;
725
881
  }, {}, {}>;
882
+ profileId: import("drizzle-orm/pg-core").PgColumn<{
883
+ name: "profile_id";
884
+ tableName: "property_defs";
885
+ dataType: "string";
886
+ columnType: "PgUUID";
887
+ data: string;
888
+ driverParam: string;
889
+ notNull: false;
890
+ hasDefault: false;
891
+ isPrimaryKey: false;
892
+ isAutoincrement: false;
893
+ hasRuntimeDefault: false;
894
+ enumValues: undefined;
895
+ baseColumn: never;
896
+ identity: undefined;
897
+ generated: undefined;
898
+ }, {}, {}>;
726
899
  valueType: import("drizzle-orm/pg-core").PgColumn<{
727
900
  name: "value_type";
728
901
  tableName: "property_defs";
@@ -820,13 +993,19 @@ declare const propertyDefs: import("drizzle-orm/pg-core").PgTableWithColumns<{
820
993
  };
821
994
  dialect: "pg";
822
995
  }>;
823
- type PropertyDef = typeof propertyDefs.$inferSelect;
996
+ export type PropertyDef = typeof propertyDefs.$inferSelect;
824
997
  declare enum ProfileScope {
825
998
  SYSTEM = "system",// Available to all users
826
999
  WORKSPACE = "workspace",// Shared within workspace
827
1000
  USER = "user"
828
1001
  }
829
- interface EventRecord {
1002
+ /**
1003
+ * EventRecord - Database representation of an event
1004
+ *
1005
+ * This is the format returned from the database.
1006
+ * It maps directly to the events table structure.
1007
+ */
1008
+ export interface EventRecord {
830
1009
  id: string;
831
1010
  timestamp: Date;
832
1011
  subjectId: string;
@@ -840,24 +1019,28 @@ interface EventRecord {
840
1019
  correlationId?: string;
841
1020
  source: string;
842
1021
  }
843
- interface LinkedMessagePreview {
1022
+ /** Minimal message fields for list/preview */
1023
+ export interface LinkedMessagePreview {
844
1024
  id: string;
845
- threadId: string;
1025
+ channelId: string;
846
1026
  role: string;
847
1027
  content: string;
848
1028
  timestamp: Date;
849
1029
  userId: string;
850
1030
  }
851
- interface LinkedMessageItem {
1031
+ export interface LinkedMessageItem {
852
1032
  link: MessageLink;
853
1033
  message: LinkedMessagePreview;
854
1034
  }
855
- interface EffectiveProperty extends PropertyDef {
1035
+ export interface EffectiveProperty extends PropertyDef {
856
1036
  required: boolean;
857
1037
  defaultValue: unknown;
858
1038
  displayOrder: number;
859
1039
  }
860
- interface ViewColumn {
1040
+ /**
1041
+ * Column definition for views
1042
+ */
1043
+ export interface ViewColumn {
861
1044
  id: string;
862
1045
  field: string;
863
1046
  title?: string;
@@ -866,17 +1049,38 @@ interface ViewColumn {
866
1049
  visible?: boolean;
867
1050
  width?: number;
868
1051
  }
869
- type FilterOperator = "equals" | "not_equals" | "contains" | "not_contains" | "in" | "not_in" | "is_empty" | "is_not_empty" | "greater_than" | "less_than" | "greater_than_or_equal" | "less_than_or_equal";
870
- interface EntityFilter {
1052
+ /**
1053
+ * View Query Types
1054
+ *
1055
+ * Single source of truth for all view query and filter types.
1056
+ */
1057
+ /**
1058
+ * Filter operator types
1059
+ */
1060
+ export type FilterOperator = "equals" | "not_equals" | "contains" | "not_contains" | "in" | "not_in" | "is_empty" | "is_not_empty" | "greater_than" | "less_than" | "greater_than_or_equal" | "less_than_or_equal";
1061
+ /**
1062
+ * Filter definition for entity queries
1063
+ */
1064
+ export interface EntityFilter {
871
1065
  field: string;
872
1066
  operator: FilterOperator;
873
1067
  value?: unknown;
874
1068
  }
875
- interface SortRule {
1069
+ /**
1070
+ * Sort rule for entity queries
1071
+ */
1072
+ export interface SortRule {
876
1073
  field: string;
877
1074
  direction: "asc" | "desc";
878
1075
  }
879
- interface EntityQuery {
1076
+ /**
1077
+ * Query definition for structured views
1078
+ * Defines which entities to show and how to filter them
1079
+ *
1080
+ * NOTE: profileIds/profileSlugs are now stored in views.scopeProfileIds
1081
+ * This query structure only contains filters, sorts, search, pagination, and groupBy
1082
+ */
1083
+ export interface EntityQuery {
880
1084
  /** @deprecated - Profile IDs now stored in views.scopeProfileIds */
881
1085
  profileIds?: string[];
882
1086
  /** @deprecated - Profile slugs now stored in views.scopeProfileIds (resolved to IDs) */
@@ -907,7 +1111,10 @@ declare enum AgentType {
907
1111
  WRITING = "writing",
908
1112
  ACTION = "action"
909
1113
  }
910
- type AgentTypeString = `${AgentType}` | (string & {});
1114
+ /**
1115
+ * Agent type as string literal union (for flexibility)
1116
+ */
1117
+ export type AgentTypeString = `${AgentType}` | (string & {});
911
1118
  declare enum AIStepType {
912
1119
  THINKING = "thinking",
913
1120
  TOOL_CALL = "tool_call",
@@ -915,7 +1122,17 @@ declare enum AIStepType {
915
1122
  DECISION = "decision",
916
1123
  ERROR = "error"
917
1124
  }
918
- interface AIStep {
1125
+ /**
1126
+ * AI step - shows what the AI is doing
1127
+ *
1128
+ * Represents any step in the AI's reasoning/execution process:
1129
+ * - thinking: General analysis and reasoning
1130
+ * - tool_call: When AI calls a tool
1131
+ * - tool_result: Result from tool execution
1132
+ * - decision: AI making a decision
1133
+ * - error: Error during processing
1134
+ */
1135
+ export interface AIStep {
919
1136
  id: string;
920
1137
  type: AIStepType | string;
921
1138
  content: string;
@@ -929,7 +1146,10 @@ interface AIStep {
929
1146
  description?: string;
930
1147
  status?: "pending" | "running" | "complete" | "error";
931
1148
  }
932
- interface BranchDecision {
1149
+ /**
1150
+ * Branch decision from meta-agent
1151
+ */
1152
+ export interface BranchDecision {
933
1153
  shouldBranch: boolean;
934
1154
  reason: string;
935
1155
  suggestedAgentType?: AgentTypeString;
@@ -969,7 +1189,46 @@ declare enum MessageLinkRelationshipType {
969
1189
  QUOTES = "quotes",// Message quotes this object
970
1190
  CONTEXT = "context"
971
1191
  }
972
- type TableAction = "create.requested" | "create.approved" | "create.validated" | "update.requested" | "update.approved" | "update.validated" | "delete.requested" | "delete.approved" | "delete.validated";
1192
+ /**
1193
+ * Node shape for the workspace branch tree response.
1194
+ * Defined at module scope so tsc can include it in declaration output.
1195
+ */
1196
+ export type BranchNodeResult = {
1197
+ channel: Channel;
1198
+ children: BranchNodeResult[];
1199
+ messageCount: number;
1200
+ lastActivity: Date;
1201
+ depth: number;
1202
+ };
1203
+ /**
1204
+ * @synap/events - Schema-Driven Event Generator
1205
+ *
1206
+ * This module generates event types and payload schemas from Drizzle database tables.
1207
+ *
1208
+ * V2.0 CONSOLIDATED PATTERN: {table}.{action}.{modifier}
1209
+ *
1210
+ * Actions: create | update | delete
1211
+ * Modifiers: requested | validated
1212
+ *
1213
+ * Examples:
1214
+ * entities.create.requested ← Intent submitted (by user or AI)
1215
+ * entities.create.validated ← Change confirmed and applied
1216
+ * entities.update.requested ← Update intent
1217
+ * entities.update.validated ← Update confirmed
1218
+ *
1219
+ * No direct actions (e.g., entities.create) - all changes go through requested→validated flow.
1220
+ */
1221
+ /**
1222
+ * Standard CRUD actions with modifiers for table events
1223
+ *
1224
+ * V2.1: Added 'approved' modifier for 3-phase flow
1225
+ *
1226
+ * Flow:
1227
+ * 1. requested: Intent (user/AI wants to do something)
1228
+ * 2. approved: Validated (permissions checked, user approved if needed)
1229
+ * 3. validated: Completed (DB operation done, entity exists)
1230
+ */
1231
+ export type TableAction = "create.requested" | "create.approved" | "create.validated" | "update.requested" | "update.approved" | "update.validated" | "delete.requested" | "delete.approved" | "delete.validated";
973
1232
  declare const CORE_TABLES: readonly [
974
1233
  "entities",
975
1234
  "documents",
@@ -985,9 +1244,22 @@ declare const CORE_TABLES: readonly [
985
1244
  "views",
986
1245
  "userPreferences"
987
1246
  ];
988
- type CoreTable = (typeof CORE_TABLES)[number];
989
- type GeneratedEventType = `${CoreTable}.create.requested` | `${CoreTable}.create.approved` | `${CoreTable}.create.validated` | `${CoreTable}.update.requested` | `${CoreTable}.update.approved` | `${CoreTable}.update.validated` | `${CoreTable}.delete.requested` | `${CoreTable}.delete.approved` | `${CoreTable}.delete.validated`;
990
- interface WorkerMetadata {
1247
+ export type CoreTable = (typeof CORE_TABLES)[number];
1248
+ /**
1249
+ * Flat list of all generated event types (for type checking)
1250
+ *
1251
+ * V2.1: Added .approved phase for 3-phase flow
1252
+ */
1253
+ export type GeneratedEventType = `${CoreTable}.create.requested` | `${CoreTable}.create.approved` | `${CoreTable}.create.validated` | `${CoreTable}.update.requested` | `${CoreTable}.update.approved` | `${CoreTable}.update.validated` | `${CoreTable}.delete.requested` | `${CoreTable}.delete.approved` | `${CoreTable}.delete.validated`;
1254
+ /**
1255
+ * Worker Registry - Static worker metadata for Admin UI
1256
+ *
1257
+ * V2.0: Simplified registry with only active workers
1258
+ *
1259
+ * Pattern: Table workers handle {table}.{crud}.requested events
1260
+ * and emit {table}.{crud}.completed events.
1261
+ */
1262
+ export interface WorkerMetadata {
991
1263
  id: string;
992
1264
  name: string;
993
1265
  description: string;
@@ -1033,7 +1305,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1033
1305
  data: Record<string, unknown>;
1034
1306
  version: number;
1035
1307
  metadata?: Record<string, unknown> | undefined;
1036
- source?: "system" | "sync" | "api" | "automation" | "migration" | undefined;
1308
+ source?: "sync" | "system" | "api" | "automation" | "migration" | undefined;
1037
1309
  causationId?: string | undefined;
1038
1310
  correlationId?: string | undefined;
1039
1311
  };
@@ -1339,15 +1611,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1339
1611
  createdAt: Date;
1340
1612
  metadata: unknown;
1341
1613
  title: string | null;
1342
- status: ChatThreadStatus;
1343
- threadType: ChatThreadType;
1344
- parentThreadId: string | null;
1614
+ externalSource: string | null;
1615
+ status: ChannelStatus;
1616
+ channelType: ChannelType;
1617
+ contextObjectType: string | null;
1618
+ contextObjectId: string | null;
1619
+ parentChannelId: string | null;
1345
1620
  branchedFromMessageId: string | null;
1346
1621
  branchPurpose: string | null;
1347
1622
  agentId: string;
1348
- agentType: ChatThreadAgentType;
1623
+ agentType: ChannelAgentType;
1349
1624
  agentConfig: unknown;
1350
1625
  contextSummary: string | null;
1626
+ externalChannelId: string | null;
1351
1627
  mergedAt: Date | null;
1352
1628
  };
1353
1629
  status?: undefined;
@@ -1370,6 +1646,17 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1370
1646
  };
1371
1647
  meta: object;
1372
1648
  }>;
1649
+ createEntityComment: import("@trpc/server").TRPCMutationProcedure<{
1650
+ input: {
1651
+ entityId: string;
1652
+ content: string;
1653
+ };
1654
+ output: {
1655
+ threadId: `${string}-${string}-${string}-${string}-${string}`;
1656
+ messageId: `${string}-${string}-${string}-${string}-${string}`;
1657
+ };
1658
+ meta: object;
1659
+ }>;
1373
1660
  sendMessage: import("@trpc/server").TRPCMutationProcedure<{
1374
1661
  input: {
1375
1662
  content: string;
@@ -1395,15 +1682,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1395
1682
  createdAt: Date;
1396
1683
  metadata: unknown;
1397
1684
  title: string | null;
1398
- status: ChatThreadStatus;
1399
- threadType: ChatThreadType;
1400
- parentThreadId: string | null;
1685
+ externalSource: string | null;
1686
+ status: ChannelStatus;
1687
+ channelType: ChannelType;
1688
+ contextObjectType: string | null;
1689
+ contextObjectId: string | null;
1690
+ parentChannelId: string | null;
1401
1691
  branchedFromMessageId: string | null;
1402
1692
  branchPurpose: string | null;
1403
1693
  agentId: string;
1404
- agentType: ChatThreadAgentType;
1694
+ agentType: ChannelAgentType;
1405
1695
  agentConfig: unknown;
1406
1696
  contextSummary: string | null;
1697
+ externalChannelId: string | null;
1407
1698
  mergedAt: Date | null;
1408
1699
  } | undefined;
1409
1700
  aiSteps: AIStep[];
@@ -1430,7 +1721,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1430
1721
  }[];
1431
1722
  executionSummaries: {
1432
1723
  tool: string;
1433
- status: "error" | "success" | "skipped";
1724
+ status: "error" | "skipped" | "success";
1434
1725
  result?: unknown;
1435
1726
  error?: string | undefined;
1436
1727
  }[];
@@ -1473,9 +1764,13 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1473
1764
  } | null;
1474
1765
  deletedAt: Date | null;
1475
1766
  content: string;
1476
- threadId: string;
1767
+ channelId: string;
1477
1768
  parentId: string | null;
1478
- role: "user" | "system" | "assistant";
1769
+ role: MessageRole;
1770
+ authorType: MessageAuthorType;
1771
+ messageCategory: MessageCategory;
1772
+ externalSource: string | null;
1773
+ inboxItemId: string | null;
1479
1774
  previousHash: string | null;
1480
1775
  hash: string;
1481
1776
  }[];
@@ -1487,11 +1782,13 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1487
1782
  listThreads: import("@trpc/server").TRPCQueryProcedure<{
1488
1783
  input: {
1489
1784
  workspaceId?: string | undefined;
1490
- threadType?: "main" | "branch" | undefined;
1785
+ threadType?: "main" | "branch" | "ai_thread" | undefined;
1491
1786
  limit?: number | undefined;
1492
1787
  };
1493
1788
  output: {
1494
1789
  threads: {
1790
+ hasAssistantMessage: boolean;
1791
+ origin: string;
1495
1792
  workspaceId: string | null;
1496
1793
  userId: string;
1497
1794
  id: string;
@@ -1499,15 +1796,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1499
1796
  createdAt: Date;
1500
1797
  metadata: unknown;
1501
1798
  title: string | null;
1502
- status: ChatThreadStatus;
1503
- threadType: ChatThreadType;
1504
- parentThreadId: string | null;
1799
+ externalSource: string | null;
1800
+ status: ChannelStatus;
1801
+ channelType: ChannelType;
1802
+ contextObjectType: string | null;
1803
+ contextObjectId: string | null;
1804
+ parentChannelId: string | null;
1505
1805
  branchedFromMessageId: string | null;
1506
1806
  branchPurpose: string | null;
1507
1807
  agentId: string;
1508
- agentType: ChatThreadAgentType;
1808
+ agentType: ChannelAgentType;
1509
1809
  agentConfig: unknown;
1510
1810
  contextSummary: string | null;
1811
+ externalChannelId: string | null;
1511
1812
  mergedAt: Date | null;
1512
1813
  }[];
1513
1814
  };
@@ -1526,20 +1827,39 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1526
1827
  createdAt: Date;
1527
1828
  metadata: unknown;
1528
1829
  title: string | null;
1529
- status: ChatThreadStatus;
1530
- threadType: ChatThreadType;
1531
- parentThreadId: string | null;
1830
+ externalSource: string | null;
1831
+ status: ChannelStatus;
1832
+ channelType: ChannelType;
1833
+ contextObjectType: string | null;
1834
+ contextObjectId: string | null;
1835
+ parentChannelId: string | null;
1532
1836
  branchedFromMessageId: string | null;
1533
1837
  branchPurpose: string | null;
1534
1838
  agentId: string;
1535
- agentType: ChatThreadAgentType;
1839
+ agentType: ChannelAgentType;
1536
1840
  agentConfig: unknown;
1537
1841
  contextSummary: string | null;
1842
+ externalChannelId: string | null;
1538
1843
  mergedAt: Date | null;
1539
1844
  }[];
1540
1845
  };
1541
1846
  meta: object;
1542
1847
  }>;
1848
+ getWorkspaceBranchTree: import("@trpc/server").TRPCQueryProcedure<{
1849
+ input: {
1850
+ workspaceId: string;
1851
+ };
1852
+ output: {
1853
+ roots: BranchNodeResult[];
1854
+ stats: {
1855
+ totalThreads: number;
1856
+ activeThreads: number;
1857
+ pendingProposalsTotal: number;
1858
+ };
1859
+ proposalCounts: Record<string, number>;
1860
+ };
1861
+ meta: object;
1862
+ }>;
1543
1863
  mergeBranch: import("@trpc/server").TRPCMutationProcedure<{
1544
1864
  input: {
1545
1865
  branchId: string;
@@ -1566,40 +1886,32 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1566
1886
  createdAt: Date;
1567
1887
  metadata: unknown;
1568
1888
  title: string | null;
1569
- status: ChatThreadStatus;
1570
- threadType: ChatThreadType;
1571
- parentThreadId: string | null;
1889
+ externalSource: string | null;
1890
+ status: ChannelStatus;
1891
+ channelType: ChannelType;
1892
+ contextObjectType: string | null;
1893
+ contextObjectId: string | null;
1894
+ parentChannelId: string | null;
1572
1895
  branchedFromMessageId: string | null;
1573
1896
  branchPurpose: string | null;
1574
1897
  agentId: string;
1575
- agentType: ChatThreadAgentType;
1898
+ agentType: ChannelAgentType;
1576
1899
  agentConfig: unknown;
1577
1900
  contextSummary: string | null;
1901
+ externalChannelId: string | null;
1578
1902
  mergedAt: Date | null;
1579
1903
  };
1580
- entities: {
1904
+ contextItems: {
1581
1905
  workspaceId: string;
1582
1906
  userId: string;
1583
1907
  id: string;
1584
1908
  createdAt: Date;
1585
- entityId: string;
1586
- threadId: string;
1909
+ channelId: string;
1587
1910
  sourceMessageId: string | null;
1588
- relationshipType: ThreadEntityRelationshipType;
1589
- conflictStatus: ThreadEntityConflictStatus;
1590
- sourceEventId: string | null;
1591
- }[] | undefined;
1592
- documents: {
1593
- workspaceId: string;
1594
- userId: string;
1595
- id: string;
1596
- createdAt: Date;
1597
- documentId: string;
1598
- threadId: string;
1599
- sourceMessageId: string | null;
1600
- relationshipType: ThreadDocumentRelationshipType;
1601
- conflictStatus: ThreadDocumentConflictStatus;
1602
- sourceEventId: string | null;
1911
+ objectType: ChannelContextObjectType;
1912
+ objectId: string;
1913
+ relationshipType: ChannelContextRelationshipType;
1914
+ conflictStatus: ChannelContextConflictStatus;
1603
1915
  }[] | undefined;
1604
1916
  branchTree: any;
1605
1917
  };
@@ -1635,7 +1947,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1635
1947
  };
1636
1948
  output: {
1637
1949
  tree: {
1638
- thread: ChatThread;
1950
+ channel: Channel;
1639
1951
  children: any[];
1640
1952
  } | null;
1641
1953
  flatBranches: {
@@ -1646,15 +1958,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1646
1958
  createdAt: Date;
1647
1959
  metadata: unknown;
1648
1960
  title: string | null;
1649
- status: ChatThreadStatus;
1650
- threadType: ChatThreadType;
1651
- parentThreadId: string | null;
1961
+ externalSource: string | null;
1962
+ status: ChannelStatus;
1963
+ channelType: ChannelType;
1964
+ contextObjectType: string | null;
1965
+ contextObjectId: string | null;
1966
+ parentChannelId: string | null;
1652
1967
  branchedFromMessageId: string | null;
1653
1968
  branchPurpose: string | null;
1654
1969
  agentId: string;
1655
- agentType: ChatThreadAgentType;
1970
+ agentType: ChannelAgentType;
1656
1971
  agentConfig: unknown;
1657
1972
  contextSummary: string | null;
1973
+ externalChannelId: string | null;
1658
1974
  mergedAt: Date | null;
1659
1975
  }[];
1660
1976
  activeBranches: {
@@ -1665,15 +1981,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1665
1981
  createdAt: Date;
1666
1982
  metadata: unknown;
1667
1983
  title: string | null;
1668
- status: ChatThreadStatus;
1669
- threadType: ChatThreadType;
1670
- parentThreadId: string | null;
1984
+ externalSource: string | null;
1985
+ status: ChannelStatus;
1986
+ channelType: ChannelType;
1987
+ contextObjectType: string | null;
1988
+ contextObjectId: string | null;
1989
+ parentChannelId: string | null;
1671
1990
  branchedFromMessageId: string | null;
1672
1991
  branchPurpose: string | null;
1673
1992
  agentId: string;
1674
- agentType: ChatThreadAgentType;
1993
+ agentType: ChannelAgentType;
1675
1994
  agentConfig: unknown;
1676
1995
  contextSummary: string | null;
1996
+ externalChannelId: string | null;
1677
1997
  mergedAt: Date | null;
1678
1998
  }[];
1679
1999
  mergedBranches: {
@@ -1684,15 +2004,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1684
2004
  createdAt: Date;
1685
2005
  metadata: unknown;
1686
2006
  title: string | null;
1687
- status: ChatThreadStatus;
1688
- threadType: ChatThreadType;
1689
- parentThreadId: string | null;
2007
+ externalSource: string | null;
2008
+ status: ChannelStatus;
2009
+ channelType: ChannelType;
2010
+ contextObjectType: string | null;
2011
+ contextObjectId: string | null;
2012
+ parentChannelId: string | null;
1690
2013
  branchedFromMessageId: string | null;
1691
2014
  branchPurpose: string | null;
1692
2015
  agentId: string;
1693
- agentType: ChatThreadAgentType;
2016
+ agentType: ChannelAgentType;
1694
2017
  agentConfig: unknown;
1695
2018
  contextSummary: string | null;
2019
+ externalChannelId: string | null;
1696
2020
  mergedAt: Date | null;
1697
2021
  }[];
1698
2022
  };
@@ -1701,32 +2025,45 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1701
2025
  getThreadContext: import("@trpc/server").TRPCQueryProcedure<{
1702
2026
  input: {
1703
2027
  threadId: string;
2028
+ objectTypes?: ("entity" | "proposal" | "view" | "inbox_item" | "document")[] | undefined;
1704
2029
  relationshipTypes?: ("created" | "updated" | "used_as_context" | "referenced" | "inherited_from_parent")[] | undefined;
1705
2030
  };
1706
2031
  output: {
2032
+ items: {
2033
+ workspaceId: string;
2034
+ userId: string;
2035
+ id: string;
2036
+ createdAt: Date;
2037
+ channelId: string;
2038
+ sourceMessageId: string | null;
2039
+ objectType: ChannelContextObjectType;
2040
+ objectId: string;
2041
+ relationshipType: ChannelContextRelationshipType;
2042
+ conflictStatus: ChannelContextConflictStatus;
2043
+ }[];
1707
2044
  entities: {
1708
2045
  workspaceId: string;
1709
2046
  userId: string;
1710
2047
  id: string;
1711
2048
  createdAt: Date;
1712
- entityId: string;
1713
- threadId: string;
2049
+ channelId: string;
1714
2050
  sourceMessageId: string | null;
1715
- relationshipType: ThreadEntityRelationshipType;
1716
- conflictStatus: ThreadEntityConflictStatus;
1717
- sourceEventId: string | null;
2051
+ objectType: ChannelContextObjectType;
2052
+ objectId: string;
2053
+ relationshipType: ChannelContextRelationshipType;
2054
+ conflictStatus: ChannelContextConflictStatus;
1718
2055
  }[];
1719
2056
  documents: {
1720
2057
  workspaceId: string;
1721
2058
  userId: string;
1722
2059
  id: string;
1723
2060
  createdAt: Date;
1724
- documentId: string;
1725
- threadId: string;
2061
+ channelId: string;
1726
2062
  sourceMessageId: string | null;
1727
- relationshipType: ThreadDocumentRelationshipType;
1728
- conflictStatus: ThreadDocumentConflictStatus;
1729
- sourceEventId: string | null;
2063
+ objectType: ChannelContextObjectType;
2064
+ objectId: string;
2065
+ relationshipType: ChannelContextRelationshipType;
2066
+ conflictStatus: ChannelContextConflictStatus;
1730
2067
  }[];
1731
2068
  };
1732
2069
  meta: object;
@@ -1743,6 +2080,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1743
2080
  workspaceId?: string | undefined;
1744
2081
  targetType?: "entity" | "view" | "document" | "profile" | "whiteboard" | undefined;
1745
2082
  targetId?: string | undefined;
2083
+ threadId?: string | undefined;
1746
2084
  status?: "pending" | "validated" | "rejected" | "all" | undefined;
1747
2085
  limit?: number | undefined;
1748
2086
  };
@@ -1753,10 +2091,14 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1753
2091
  data: unknown;
1754
2092
  updatedAt: Date;
1755
2093
  createdAt: Date;
2094
+ sourceMessageId: string | null;
1756
2095
  status: ProposalStatus;
2096
+ createdBy: string | null;
2097
+ threadId: string | null;
1757
2098
  targetType: string;
1758
2099
  targetId: string;
1759
2100
  proposalType: string;
2101
+ commandRunId: string | null;
1760
2102
  reviewedBy: string | null;
1761
2103
  reviewedAt: Date | null;
1762
2104
  rejectionReason: string | null;
@@ -1915,7 +2257,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1915
2257
  data: Record<string, unknown>;
1916
2258
  userId: string;
1917
2259
  subjectId?: string | undefined;
1918
- source?: "system" | "sync" | "api" | "automation" | "migration" | undefined;
2260
+ source?: "sync" | "system" | "api" | "automation" | "migration" | undefined;
1919
2261
  correlationId?: string | undefined;
1920
2262
  causationId?: string | undefined;
1921
2263
  };
@@ -2647,7 +2989,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
2647
2989
  };
2648
2990
  output: {
2649
2991
  sessionId: string;
2650
- chatThreadId: `${string}-${string}-${string}-${string}-${string}`;
2992
+ channelId: `${string}-${string}-${string}-${string}-${string}`;
2651
2993
  };
2652
2994
  meta: object;
2653
2995
  }>;
@@ -3242,8 +3584,8 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3242
3584
  id: string;
3243
3585
  errorMessage: string | null;
3244
3586
  startedAt: Date;
3587
+ status: "completed" | "running" | "failed";
3245
3588
  threadId: string;
3246
- status: "completed" | "failed" | "running";
3247
3589
  commandId: string;
3248
3590
  permissionsSnapshot: Record<string, unknown> | null;
3249
3591
  inputs: Record<string, unknown> | null;
@@ -3268,8 +3610,8 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3268
3610
  id: string;
3269
3611
  errorMessage: string | null;
3270
3612
  startedAt: Date;
3613
+ status: "completed" | "running" | "failed";
3271
3614
  threadId: string;
3272
- status: "completed" | "failed" | "running";
3273
3615
  commandId: string;
3274
3616
  permissionsSnapshot: Record<string, unknown> | null;
3275
3617
  inputs: Record<string, unknown> | null;
@@ -3293,9 +3635,189 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3293
3635
  endpoints?: string[];
3294
3636
  authType?: string;
3295
3637
  };
3638
+ intelligenceConfigured: boolean;
3639
+ };
3640
+ meta: object;
3641
+ }>;
3642
+ agentDefinitions: import("@trpc/server").TRPCQueryProcedure<{
3643
+ input: Record<string, never>;
3644
+ output: {
3645
+ agents: unknown[];
3646
+ };
3647
+ meta: object;
3648
+ }>;
3649
+ toolDefinitions: import("@trpc/server").TRPCQueryProcedure<{
3650
+ input: Record<string, never>;
3651
+ output: {
3652
+ tools: unknown[];
3653
+ };
3654
+ meta: object;
3655
+ }>;
3656
+ agentConfig: import("@trpc/server").TRPCQueryProcedure<{
3657
+ input: {
3658
+ agentType: string;
3659
+ };
3660
+ output: {
3661
+ config: unknown;
3662
+ };
3663
+ meta: object;
3664
+ }>;
3665
+ saveAgentConfig: import("@trpc/server").TRPCMutationProcedure<{
3666
+ input: {
3667
+ agentType: string;
3668
+ promptAppend?: string | null | undefined;
3669
+ extraToolIds?: string[] | undefined;
3670
+ disabledToolIds?: string[] | undefined;
3671
+ maxStepsOverride?: number | null | undefined;
3672
+ };
3673
+ output: {
3674
+ config: unknown;
3675
+ };
3676
+ meta: object;
3677
+ }>;
3678
+ deleteAgentConfig: import("@trpc/server").TRPCMutationProcedure<{
3679
+ input: {
3680
+ agentType: string;
3681
+ };
3682
+ output: {
3683
+ success: boolean;
3684
+ };
3685
+ meta: object;
3686
+ }>;
3687
+ memoryFacts: import("@trpc/server").TRPCQueryProcedure<{
3688
+ input: {
3689
+ limit?: number | undefined;
3690
+ };
3691
+ output: {
3692
+ facts: any[];
3693
+ };
3694
+ meta: object;
3695
+ }>;
3696
+ searchMemory: import("@trpc/server").TRPCQueryProcedure<{
3697
+ input: {
3698
+ query: string;
3699
+ limit?: number | undefined;
3700
+ };
3701
+ output: {
3702
+ facts: any[];
3703
+ };
3704
+ meta: object;
3705
+ }>;
3706
+ createMemoryFact: import("@trpc/server").TRPCMutationProcedure<{
3707
+ input: {
3708
+ fact: string;
3709
+ confidence?: number | undefined;
3710
+ };
3711
+ output: {
3712
+ fact: any;
3713
+ };
3714
+ meta: object;
3715
+ }>;
3716
+ deleteMemoryFact: import("@trpc/server").TRPCMutationProcedure<{
3717
+ input: {
3718
+ id: string;
3719
+ };
3720
+ output: {
3721
+ success: boolean;
3722
+ };
3723
+ meta: object;
3724
+ }>;
3725
+ skills: import("@trpc/server").TRPCQueryProcedure<{
3726
+ input: Record<string, never>;
3727
+ output: {
3728
+ skills: any[];
3729
+ };
3730
+ meta: object;
3731
+ }>;
3732
+ createSkill: import("@trpc/server").TRPCMutationProcedure<{
3733
+ input: {
3734
+ name: string;
3735
+ description: string;
3736
+ parameters?: Record<string, string> | undefined;
3737
+ category?: "context" | "action" | undefined;
3738
+ };
3739
+ output: {
3740
+ skill: any;
3296
3741
  };
3297
3742
  meta: object;
3298
3743
  }>;
3744
+ executionStats: import("@trpc/server").TRPCQueryProcedure<{
3745
+ input: {
3746
+ since?: string | undefined;
3747
+ };
3748
+ output: {
3749
+ stats: unknown;
3750
+ };
3751
+ meta: object;
3752
+ }>;
3753
+ executions: import("@trpc/server").TRPCQueryProcedure<{
3754
+ input: {
3755
+ limit?: number | undefined;
3756
+ offset?: number | undefined;
3757
+ agentType?: string | undefined;
3758
+ };
3759
+ output: {
3760
+ executions: unknown[];
3761
+ };
3762
+ meta: object;
3763
+ }>;
3764
+ executionDetail: import("@trpc/server").TRPCQueryProcedure<{
3765
+ input: {
3766
+ id: string;
3767
+ };
3768
+ output: {
3769
+ execution: unknown;
3770
+ toolLogs: unknown[];
3771
+ };
3772
+ meta: object;
3773
+ }>;
3774
+ proposals: import("@trpc/server").TRPCQueryProcedure<{
3775
+ input: {
3776
+ status?: "denied" | "pending" | "approved" | undefined;
3777
+ };
3778
+ output: {
3779
+ proposals: any[];
3780
+ };
3781
+ meta: object;
3782
+ }>;
3783
+ approveProposal: import("@trpc/server").TRPCMutationProcedure<{
3784
+ input: {
3785
+ id: string;
3786
+ };
3787
+ output: {
3788
+ success: boolean;
3789
+ };
3790
+ meta: object;
3791
+ }>;
3792
+ denyProposal: import("@trpc/server").TRPCMutationProcedure<{
3793
+ input: {
3794
+ id: string;
3795
+ };
3796
+ output: {
3797
+ success: boolean;
3798
+ };
3799
+ meta: object;
3800
+ }>;
3801
+ startAIChannel: import("@trpc/server").TRPCMutationProcedure<{
3802
+ input: {
3803
+ topic: string;
3804
+ mode?: "debate" | "collaborate" | "critique" | undefined;
3805
+ maxTurns?: number | undefined;
3806
+ personaA?: {
3807
+ name?: string | undefined;
3808
+ agentType?: string | undefined;
3809
+ systemPrompt?: string | undefined;
3810
+ } | undefined;
3811
+ personaB?: {
3812
+ name?: string | undefined;
3813
+ agentType?: string | undefined;
3814
+ systemPrompt?: string | undefined;
3815
+ } | undefined;
3816
+ initialMessage?: string | undefined;
3817
+ };
3818
+ output: any;
3819
+ meta: object;
3820
+ }>;
3299
3821
  }>>;
3300
3822
  capabilities: import("@trpc/server").TRPCBuiltRouter<{
3301
3823
  ctx: Context;
@@ -3411,11 +3933,12 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3411
3933
  input: void;
3412
3934
  output: {
3413
3935
  types: {
3936
+ type: string;
3414
3937
  label: string;
3415
3938
  description: string;
3416
3939
  directionality: "unidirectional" | "bidirectional";
3417
- category: "workflow" | "social" | "reference" | "hierarchy";
3418
- type: string;
3940
+ category: string;
3941
+ source: "workspace";
3419
3942
  }[];
3420
3943
  };
3421
3944
  meta: object;
@@ -3423,7 +3946,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3423
3946
  get: import("@trpc/server").TRPCQueryProcedure<{
3424
3947
  input: {
3425
3948
  entityId: string;
3426
- type?: "created_by" | "depends_on" | "assigned_to" | "mentions" | "links_to" | "parent_of" | "relates_to" | "tagged_with" | "attended_by" | "blocks" | "belongs_to_project" | "embedded_in" | "visualized_in" | "references" | undefined;
3949
+ type?: string | undefined;
3427
3950
  direction?: "source" | "target" | "both" | undefined;
3428
3951
  limit?: number | undefined;
3429
3952
  };
@@ -3444,7 +3967,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3444
3967
  getRelated: import("@trpc/server").TRPCQueryProcedure<{
3445
3968
  input: {
3446
3969
  entityId: string;
3447
- type?: "created_by" | "depends_on" | "assigned_to" | "mentions" | "links_to" | "parent_of" | "relates_to" | "tagged_with" | "attended_by" | "blocks" | "belongs_to_project" | "embedded_in" | "visualized_in" | "references" | undefined;
3970
+ type?: string | undefined;
3448
3971
  direction?: "source" | "target" | "both" | undefined;
3449
3972
  limit?: number | undefined;
3450
3973
  };
@@ -3498,6 +4021,48 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3498
4021
  };
3499
4022
  meta: object;
3500
4023
  }>;
4024
+ getConnections: import("@trpc/server").TRPCQueryProcedure<{
4025
+ input: {
4026
+ entityId: string;
4027
+ limit?: number | undefined;
4028
+ };
4029
+ output: {
4030
+ connections: {
4031
+ entityId: string;
4032
+ entity: {
4033
+ workspaceId: string | null;
4034
+ userId: string;
4035
+ id: string;
4036
+ updatedAt: Date;
4037
+ createdAt: Date;
4038
+ type: string;
4039
+ profileId: string | null;
4040
+ title: string | null;
4041
+ preview: string | null;
4042
+ documentId: string | null;
4043
+ properties: unknown;
4044
+ version: number;
4045
+ deletedAt: Date | null;
4046
+ } | null;
4047
+ label: string;
4048
+ direction: "outgoing" | "incoming" | "structural";
4049
+ source: "graph" | "property" | "thread";
4050
+ relationType?: string;
4051
+ propertySlug?: string;
4052
+ propertyLabel?: string;
4053
+ channelId?: string;
4054
+ channelRelationshipType?: string;
4055
+ createdAt?: Date | null;
4056
+ }[];
4057
+ counts: {
4058
+ total: number;
4059
+ graph: number;
4060
+ structural: number;
4061
+ threads: number;
4062
+ };
4063
+ };
4064
+ meta: object;
4065
+ }>;
3501
4066
  delete: import("@trpc/server").TRPCMutationProcedure<{
3502
4067
  input: {
3503
4068
  id: string;
@@ -5702,6 +6267,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
5702
6267
  id: string;
5703
6268
  updatedAt: Date;
5704
6269
  createdAt: Date;
6270
+ profileId: string | null;
5705
6271
  slug: string;
5706
6272
  valueType: PropertyValueType;
5707
6273
  constraints: unknown;
@@ -5719,6 +6285,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
5719
6285
  id: string;
5720
6286
  updatedAt: Date;
5721
6287
  createdAt: Date;
6288
+ profileId: string | null;
5722
6289
  slug: string;
5723
6290
  valueType: PropertyValueType;
5724
6291
  constraints: unknown;
@@ -5733,12 +6300,14 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
5733
6300
  valueType: "string" | "number" | "boolean" | "object" | "array" | "date" | "secret" | "entity_id";
5734
6301
  constraints?: Record<string, unknown> | undefined;
5735
6302
  uiHints?: Record<string, unknown> | undefined;
6303
+ profileId?: string | undefined;
5736
6304
  };
5737
6305
  output: {
5738
6306
  propertyDef: {
5739
6307
  id: string;
5740
6308
  updatedAt: Date;
5741
6309
  createdAt: Date;
6310
+ profileId: string | null;
5742
6311
  slug: string;
5743
6312
  valueType: PropertyValueType;
5744
6313
  constraints: unknown;
@@ -5750,6 +6319,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
5750
6319
  id: string;
5751
6320
  updatedAt: Date;
5752
6321
  createdAt: Date;
6322
+ profileId: string | null;
5753
6323
  slug: string;
5754
6324
  valueType: PropertyValueType;
5755
6325
  constraints: unknown;
@@ -5772,6 +6342,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
5772
6342
  id: string;
5773
6343
  updatedAt: Date;
5774
6344
  createdAt: Date;
6345
+ profileId: string | null;
5775
6346
  slug: string;
5776
6347
  valueType: PropertyValueType;
5777
6348
  constraints: unknown;
@@ -5902,6 +6473,30 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
5902
6473
  };
5903
6474
  meta: object;
5904
6475
  }>;
6476
+ update: import("@trpc/server").TRPCMutationProcedure<{
6477
+ input: {
6478
+ id: string;
6479
+ displayName?: string | undefined;
6480
+ description?: string | undefined;
6481
+ uiHints?: Record<string, unknown> | undefined;
6482
+ isDirectional?: boolean | undefined;
6483
+ };
6484
+ output: {
6485
+ relationDef: {
6486
+ workspaceId: string;
6487
+ userId: string;
6488
+ id: string;
6489
+ updatedAt: Date;
6490
+ createdAt: Date;
6491
+ description: string | null;
6492
+ slug: string;
6493
+ uiHints: unknown;
6494
+ displayName: string;
6495
+ isDirectional: boolean;
6496
+ };
6497
+ };
6498
+ meta: object;
6499
+ }>;
5905
6500
  delete: import("@trpc/server").TRPCMutationProcedure<{
5906
6501
  input: {
5907
6502
  id: string;