@synap-core/api-types 1.6.2 → 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.
@@ -71,16 +71,38 @@ export interface AgentMetadata {
71
71
  createdByUserId: string;
72
72
  capabilities?: string[];
73
73
  }
74
- declare enum ChatThreadType {
75
- MAIN = "main",
76
- 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"
77
99
  }
78
- declare enum ChatThreadStatus {
100
+ declare enum ChannelStatus {
79
101
  ACTIVE = "active",
80
102
  MERGED = "merged",
81
103
  ARCHIVED = "archived"
82
104
  }
83
- declare enum ChatThreadAgentType {
105
+ declare enum ChannelAgentType {
84
106
  DEFAULT = "default",
85
107
  META = "meta",
86
108
  PROMPTING = "prompting",
@@ -91,13 +113,13 @@ declare enum ChatThreadAgentType {
91
113
  ONBOARDING = "onboarding",
92
114
  WORKSPACE_CREATION = "workspace-creation"
93
115
  }
94
- declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
95
- name: "chat_threads";
116
+ declare const channels: import("drizzle-orm/pg-core").PgTableWithColumns<{
117
+ name: "channels";
96
118
  schema: undefined;
97
119
  columns: {
98
120
  id: import("drizzle-orm/pg-core").PgColumn<{
99
121
  name: "id";
100
- tableName: "chat_threads";
122
+ tableName: "channels";
101
123
  dataType: "string";
102
124
  columnType: "PgUUID";
103
125
  data: string;
@@ -114,7 +136,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
114
136
  }, {}, {}>;
115
137
  userId: import("drizzle-orm/pg-core").PgColumn<{
116
138
  name: "user_id";
117
- tableName: "chat_threads";
139
+ tableName: "channels";
118
140
  dataType: "string";
119
141
  columnType: "PgText";
120
142
  data: string;
@@ -134,7 +156,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
134
156
  }, {}, {}>;
135
157
  workspaceId: import("drizzle-orm/pg-core").PgColumn<{
136
158
  name: "workspace_id";
137
- tableName: "chat_threads";
159
+ tableName: "channels";
138
160
  dataType: "string";
139
161
  columnType: "PgUUID";
140
162
  data: string;
@@ -151,7 +173,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
151
173
  }, {}, {}>;
152
174
  title: import("drizzle-orm/pg-core").PgColumn<{
153
175
  name: "title";
154
- tableName: "chat_threads";
176
+ tableName: "channels";
155
177
  dataType: "string";
156
178
  columnType: "PgText";
157
179
  data: string;
@@ -169,12 +191,12 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
169
191
  identity: undefined;
170
192
  generated: undefined;
171
193
  }, {}, {}>;
172
- threadType: import("drizzle-orm/pg-core").PgColumn<{
173
- name: "thread_type";
174
- tableName: "chat_threads";
194
+ channelType: import("drizzle-orm/pg-core").PgColumn<{
195
+ name: "channel_type";
196
+ tableName: "channels";
175
197
  dataType: "string";
176
198
  columnType: "PgText";
177
- data: ChatThreadType;
199
+ data: ChannelType;
178
200
  driverParam: string;
179
201
  notNull: true;
180
202
  hasDefault: true;
@@ -182,16 +204,58 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
182
204
  isAutoincrement: false;
183
205
  hasRuntimeDefault: false;
184
206
  enumValues: [
185
- ChatThreadType.MAIN,
186
- 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
187
214
  ];
188
215
  baseColumn: never;
189
216
  identity: undefined;
190
217
  generated: undefined;
191
218
  }, {}, {}>;
192
- parentThreadId: import("drizzle-orm/pg-core").PgColumn<{
193
- name: "parent_thread_id";
194
- tableName: "chat_threads";
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[]
234
+ ];
235
+ baseColumn: never;
236
+ identity: undefined;
237
+ generated: undefined;
238
+ }, {}, {}>;
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";
195
259
  dataType: "string";
196
260
  columnType: "PgUUID";
197
261
  data: string;
@@ -208,7 +272,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
208
272
  }, {}, {}>;
209
273
  branchedFromMessageId: import("drizzle-orm/pg-core").PgColumn<{
210
274
  name: "branched_from_message_id";
211
- tableName: "chat_threads";
275
+ tableName: "channels";
212
276
  dataType: "string";
213
277
  columnType: "PgUUID";
214
278
  data: string;
@@ -225,7 +289,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
225
289
  }, {}, {}>;
226
290
  branchPurpose: import("drizzle-orm/pg-core").PgColumn<{
227
291
  name: "branch_purpose";
228
- tableName: "chat_threads";
292
+ tableName: "channels";
229
293
  dataType: "string";
230
294
  columnType: "PgText";
231
295
  data: string;
@@ -245,7 +309,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
245
309
  }, {}, {}>;
246
310
  agentId: import("drizzle-orm/pg-core").PgColumn<{
247
311
  name: "agent_id";
248
- tableName: "chat_threads";
312
+ tableName: "channels";
249
313
  dataType: "string";
250
314
  columnType: "PgText";
251
315
  data: string;
@@ -265,10 +329,10 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
265
329
  }, {}, {}>;
266
330
  status: import("drizzle-orm/pg-core").PgColumn<{
267
331
  name: "status";
268
- tableName: "chat_threads";
332
+ tableName: "channels";
269
333
  dataType: "string";
270
334
  columnType: "PgText";
271
- data: ChatThreadStatus;
335
+ data: ChannelStatus;
272
336
  driverParam: string;
273
337
  notNull: true;
274
338
  hasDefault: true;
@@ -276,9 +340,9 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
276
340
  isAutoincrement: false;
277
341
  hasRuntimeDefault: false;
278
342
  enumValues: [
279
- ChatThreadStatus.ACTIVE,
280
- ChatThreadStatus.MERGED,
281
- ChatThreadStatus.ARCHIVED
343
+ ChannelStatus.ACTIVE,
344
+ ChannelStatus.MERGED,
345
+ ChannelStatus.ARCHIVED
282
346
  ];
283
347
  baseColumn: never;
284
348
  identity: undefined;
@@ -286,10 +350,10 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
286
350
  }, {}, {}>;
287
351
  agentType: import("drizzle-orm/pg-core").PgColumn<{
288
352
  name: "agent_type";
289
- tableName: "chat_threads";
353
+ tableName: "channels";
290
354
  dataType: "string";
291
355
  columnType: "PgText";
292
- data: ChatThreadAgentType;
356
+ data: ChannelAgentType;
293
357
  driverParam: string;
294
358
  notNull: true;
295
359
  hasDefault: true;
@@ -297,15 +361,15 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
297
361
  isAutoincrement: false;
298
362
  hasRuntimeDefault: false;
299
363
  enumValues: [
300
- ChatThreadAgentType.DEFAULT,
301
- ChatThreadAgentType.META,
302
- ChatThreadAgentType.PROMPTING,
303
- ChatThreadAgentType.KNOWLEDGE_SEARCH,
304
- ChatThreadAgentType.CODE,
305
- ChatThreadAgentType.WRITING,
306
- ChatThreadAgentType.ACTION,
307
- ChatThreadAgentType.ONBOARDING,
308
- 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
309
373
  ];
310
374
  baseColumn: never;
311
375
  identity: undefined;
@@ -313,7 +377,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
313
377
  }, {}, {}>;
314
378
  agentConfig: import("drizzle-orm/pg-core").PgColumn<{
315
379
  name: "agent_config";
316
- tableName: "chat_threads";
380
+ tableName: "channels";
317
381
  dataType: "json";
318
382
  columnType: "PgJsonb";
319
383
  data: unknown;
@@ -330,7 +394,47 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
330
394
  }, {}, {}>;
331
395
  contextSummary: import("drizzle-orm/pg-core").PgColumn<{
332
396
  name: "context_summary";
333
- 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";
334
438
  dataType: "string";
335
439
  columnType: "PgText";
336
440
  data: string;
@@ -350,7 +454,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
350
454
  }, {}, {}>;
351
455
  metadata: import("drizzle-orm/pg-core").PgColumn<{
352
456
  name: "metadata";
353
- tableName: "chat_threads";
457
+ tableName: "channels";
354
458
  dataType: "json";
355
459
  columnType: "PgJsonb";
356
460
  data: unknown;
@@ -367,7 +471,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
367
471
  }, {}, {}>;
368
472
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
369
473
  name: "created_at";
370
- tableName: "chat_threads";
474
+ tableName: "channels";
371
475
  dataType: "date";
372
476
  columnType: "PgTimestamp";
373
477
  data: Date;
@@ -384,7 +488,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
384
488
  }, {}, {}>;
385
489
  updatedAt: import("drizzle-orm/pg-core").PgColumn<{
386
490
  name: "updated_at";
387
- tableName: "chat_threads";
491
+ tableName: "channels";
388
492
  dataType: "date";
389
493
  columnType: "PgTimestamp";
390
494
  data: Date;
@@ -401,7 +505,7 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
401
505
  }, {}, {}>;
402
506
  mergedAt: import("drizzle-orm/pg-core").PgColumn<{
403
507
  name: "merged_at";
404
- tableName: "chat_threads";
508
+ tableName: "channels";
405
509
  dataType: "date";
406
510
  columnType: "PgTimestamp";
407
511
  data: Date;
@@ -419,27 +523,22 @@ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
419
523
  };
420
524
  dialect: "pg";
421
525
  }>;
422
- export type ChatThread = typeof chatThreads.$inferSelect;
423
- declare enum ThreadEntityRelationshipType {
424
- USED_AS_CONTEXT = "used_as_context",
425
- CREATED = "created",
426
- UPDATED = "updated",
427
- REFERENCED = "referenced",
428
- INHERITED_FROM_PARENT = "inherited_from_parent"
429
- }
430
- declare enum ThreadEntityConflictStatus {
431
- NONE = "none",
432
- PENDING = "pending",
433
- 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"
434
533
  }
435
- declare enum ThreadDocumentRelationshipType {
534
+ declare enum ChannelContextRelationshipType {
436
535
  USED_AS_CONTEXT = "used_as_context",
437
536
  CREATED = "created",
438
537
  UPDATED = "updated",
439
538
  REFERENCED = "referenced",
440
539
  INHERITED_FROM_PARENT = "inherited_from_parent"
441
540
  }
442
- declare enum ThreadDocumentConflictStatus {
541
+ declare enum ChannelContextConflictStatus {
443
542
  NONE = "none",
444
543
  PENDING = "pending",
445
544
  RESOLVED = "resolved"
@@ -717,6 +816,23 @@ declare enum PropertyValueType {
717
816
  NUMBER = "number",
718
817
  BOOLEAN = "boolean",
719
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
+ */
720
836
  ENTITY_ID = "entity_id",
721
837
  ARRAY = "array",
722
838
  OBJECT = "object",
@@ -763,6 +879,23 @@ declare const propertyDefs: import("drizzle-orm/pg-core").PgTableWithColumns<{
763
879
  identity: undefined;
764
880
  generated: undefined;
765
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
+ }, {}, {}>;
766
899
  valueType: import("drizzle-orm/pg-core").PgColumn<{
767
900
  name: "value_type";
768
901
  tableName: "property_defs";
@@ -889,7 +1022,7 @@ export interface EventRecord {
889
1022
  /** Minimal message fields for list/preview */
890
1023
  export interface LinkedMessagePreview {
891
1024
  id: string;
892
- threadId: string;
1025
+ channelId: string;
893
1026
  role: string;
894
1027
  content: string;
895
1028
  timestamp: Date;
@@ -1056,6 +1189,17 @@ declare enum MessageLinkRelationshipType {
1056
1189
  QUOTES = "quotes",// Message quotes this object
1057
1190
  CONTEXT = "context"
1058
1191
  }
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
+ };
1059
1203
  /**
1060
1204
  * @synap/events - Schema-Driven Event Generator
1061
1205
  *
@@ -1161,7 +1305,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1161
1305
  data: Record<string, unknown>;
1162
1306
  version: number;
1163
1307
  metadata?: Record<string, unknown> | undefined;
1164
- source?: "system" | "sync" | "api" | "automation" | "migration" | undefined;
1308
+ source?: "sync" | "system" | "api" | "automation" | "migration" | undefined;
1165
1309
  causationId?: string | undefined;
1166
1310
  correlationId?: string | undefined;
1167
1311
  };
@@ -1467,15 +1611,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1467
1611
  createdAt: Date;
1468
1612
  metadata: unknown;
1469
1613
  title: string | null;
1470
- status: ChatThreadStatus;
1471
- threadType: ChatThreadType;
1472
- 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;
1473
1620
  branchedFromMessageId: string | null;
1474
1621
  branchPurpose: string | null;
1475
1622
  agentId: string;
1476
- agentType: ChatThreadAgentType;
1623
+ agentType: ChannelAgentType;
1477
1624
  agentConfig: unknown;
1478
1625
  contextSummary: string | null;
1626
+ externalChannelId: string | null;
1479
1627
  mergedAt: Date | null;
1480
1628
  };
1481
1629
  status?: undefined;
@@ -1498,6 +1646,17 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1498
1646
  };
1499
1647
  meta: object;
1500
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
+ }>;
1501
1660
  sendMessage: import("@trpc/server").TRPCMutationProcedure<{
1502
1661
  input: {
1503
1662
  content: string;
@@ -1523,15 +1682,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1523
1682
  createdAt: Date;
1524
1683
  metadata: unknown;
1525
1684
  title: string | null;
1526
- status: ChatThreadStatus;
1527
- threadType: ChatThreadType;
1528
- 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;
1529
1691
  branchedFromMessageId: string | null;
1530
1692
  branchPurpose: string | null;
1531
1693
  agentId: string;
1532
- agentType: ChatThreadAgentType;
1694
+ agentType: ChannelAgentType;
1533
1695
  agentConfig: unknown;
1534
1696
  contextSummary: string | null;
1697
+ externalChannelId: string | null;
1535
1698
  mergedAt: Date | null;
1536
1699
  } | undefined;
1537
1700
  aiSteps: AIStep[];
@@ -1558,7 +1721,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1558
1721
  }[];
1559
1722
  executionSummaries: {
1560
1723
  tool: string;
1561
- status: "error" | "success" | "skipped";
1724
+ status: "error" | "skipped" | "success";
1562
1725
  result?: unknown;
1563
1726
  error?: string | undefined;
1564
1727
  }[];
@@ -1601,9 +1764,13 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1601
1764
  } | null;
1602
1765
  deletedAt: Date | null;
1603
1766
  content: string;
1604
- threadId: string;
1767
+ channelId: string;
1605
1768
  parentId: string | null;
1606
- role: "user" | "system" | "assistant";
1769
+ role: MessageRole;
1770
+ authorType: MessageAuthorType;
1771
+ messageCategory: MessageCategory;
1772
+ externalSource: string | null;
1773
+ inboxItemId: string | null;
1607
1774
  previousHash: string | null;
1608
1775
  hash: string;
1609
1776
  }[];
@@ -1615,11 +1782,13 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1615
1782
  listThreads: import("@trpc/server").TRPCQueryProcedure<{
1616
1783
  input: {
1617
1784
  workspaceId?: string | undefined;
1618
- threadType?: "main" | "branch" | undefined;
1785
+ threadType?: "main" | "branch" | "ai_thread" | undefined;
1619
1786
  limit?: number | undefined;
1620
1787
  };
1621
1788
  output: {
1622
1789
  threads: {
1790
+ hasAssistantMessage: boolean;
1791
+ origin: string;
1623
1792
  workspaceId: string | null;
1624
1793
  userId: string;
1625
1794
  id: string;
@@ -1627,15 +1796,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1627
1796
  createdAt: Date;
1628
1797
  metadata: unknown;
1629
1798
  title: string | null;
1630
- status: ChatThreadStatus;
1631
- threadType: ChatThreadType;
1632
- 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;
1633
1805
  branchedFromMessageId: string | null;
1634
1806
  branchPurpose: string | null;
1635
1807
  agentId: string;
1636
- agentType: ChatThreadAgentType;
1808
+ agentType: ChannelAgentType;
1637
1809
  agentConfig: unknown;
1638
1810
  contextSummary: string | null;
1811
+ externalChannelId: string | null;
1639
1812
  mergedAt: Date | null;
1640
1813
  }[];
1641
1814
  };
@@ -1654,20 +1827,39 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1654
1827
  createdAt: Date;
1655
1828
  metadata: unknown;
1656
1829
  title: string | null;
1657
- status: ChatThreadStatus;
1658
- threadType: ChatThreadType;
1659
- 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;
1660
1836
  branchedFromMessageId: string | null;
1661
1837
  branchPurpose: string | null;
1662
1838
  agentId: string;
1663
- agentType: ChatThreadAgentType;
1839
+ agentType: ChannelAgentType;
1664
1840
  agentConfig: unknown;
1665
1841
  contextSummary: string | null;
1842
+ externalChannelId: string | null;
1666
1843
  mergedAt: Date | null;
1667
1844
  }[];
1668
1845
  };
1669
1846
  meta: object;
1670
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
+ }>;
1671
1863
  mergeBranch: import("@trpc/server").TRPCMutationProcedure<{
1672
1864
  input: {
1673
1865
  branchId: string;
@@ -1694,40 +1886,32 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1694
1886
  createdAt: Date;
1695
1887
  metadata: unknown;
1696
1888
  title: string | null;
1697
- status: ChatThreadStatus;
1698
- threadType: ChatThreadType;
1699
- 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;
1700
1895
  branchedFromMessageId: string | null;
1701
1896
  branchPurpose: string | null;
1702
1897
  agentId: string;
1703
- agentType: ChatThreadAgentType;
1898
+ agentType: ChannelAgentType;
1704
1899
  agentConfig: unknown;
1705
1900
  contextSummary: string | null;
1901
+ externalChannelId: string | null;
1706
1902
  mergedAt: Date | null;
1707
1903
  };
1708
- entities: {
1904
+ contextItems: {
1709
1905
  workspaceId: string;
1710
1906
  userId: string;
1711
1907
  id: string;
1712
1908
  createdAt: Date;
1713
- entityId: string;
1714
- threadId: string;
1909
+ channelId: string;
1715
1910
  sourceMessageId: string | null;
1716
- relationshipType: ThreadEntityRelationshipType;
1717
- conflictStatus: ThreadEntityConflictStatus;
1718
- sourceEventId: string | null;
1719
- }[] | undefined;
1720
- documents: {
1721
- workspaceId: string;
1722
- userId: string;
1723
- id: string;
1724
- createdAt: Date;
1725
- documentId: string;
1726
- threadId: string;
1727
- sourceMessageId: string | null;
1728
- relationshipType: ThreadDocumentRelationshipType;
1729
- conflictStatus: ThreadDocumentConflictStatus;
1730
- sourceEventId: string | null;
1911
+ objectType: ChannelContextObjectType;
1912
+ objectId: string;
1913
+ relationshipType: ChannelContextRelationshipType;
1914
+ conflictStatus: ChannelContextConflictStatus;
1731
1915
  }[] | undefined;
1732
1916
  branchTree: any;
1733
1917
  };
@@ -1763,7 +1947,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1763
1947
  };
1764
1948
  output: {
1765
1949
  tree: {
1766
- thread: ChatThread;
1950
+ channel: Channel;
1767
1951
  children: any[];
1768
1952
  } | null;
1769
1953
  flatBranches: {
@@ -1774,15 +1958,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1774
1958
  createdAt: Date;
1775
1959
  metadata: unknown;
1776
1960
  title: string | null;
1777
- status: ChatThreadStatus;
1778
- threadType: ChatThreadType;
1779
- 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;
1780
1967
  branchedFromMessageId: string | null;
1781
1968
  branchPurpose: string | null;
1782
1969
  agentId: string;
1783
- agentType: ChatThreadAgentType;
1970
+ agentType: ChannelAgentType;
1784
1971
  agentConfig: unknown;
1785
1972
  contextSummary: string | null;
1973
+ externalChannelId: string | null;
1786
1974
  mergedAt: Date | null;
1787
1975
  }[];
1788
1976
  activeBranches: {
@@ -1793,15 +1981,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1793
1981
  createdAt: Date;
1794
1982
  metadata: unknown;
1795
1983
  title: string | null;
1796
- status: ChatThreadStatus;
1797
- threadType: ChatThreadType;
1798
- 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;
1799
1990
  branchedFromMessageId: string | null;
1800
1991
  branchPurpose: string | null;
1801
1992
  agentId: string;
1802
- agentType: ChatThreadAgentType;
1993
+ agentType: ChannelAgentType;
1803
1994
  agentConfig: unknown;
1804
1995
  contextSummary: string | null;
1996
+ externalChannelId: string | null;
1805
1997
  mergedAt: Date | null;
1806
1998
  }[];
1807
1999
  mergedBranches: {
@@ -1812,15 +2004,19 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1812
2004
  createdAt: Date;
1813
2005
  metadata: unknown;
1814
2006
  title: string | null;
1815
- status: ChatThreadStatus;
1816
- threadType: ChatThreadType;
1817
- 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;
1818
2013
  branchedFromMessageId: string | null;
1819
2014
  branchPurpose: string | null;
1820
2015
  agentId: string;
1821
- agentType: ChatThreadAgentType;
2016
+ agentType: ChannelAgentType;
1822
2017
  agentConfig: unknown;
1823
2018
  contextSummary: string | null;
2019
+ externalChannelId: string | null;
1824
2020
  mergedAt: Date | null;
1825
2021
  }[];
1826
2022
  };
@@ -1829,32 +2025,45 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1829
2025
  getThreadContext: import("@trpc/server").TRPCQueryProcedure<{
1830
2026
  input: {
1831
2027
  threadId: string;
2028
+ objectTypes?: ("entity" | "proposal" | "view" | "inbox_item" | "document")[] | undefined;
1832
2029
  relationshipTypes?: ("created" | "updated" | "used_as_context" | "referenced" | "inherited_from_parent")[] | undefined;
1833
2030
  };
1834
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
+ }[];
1835
2044
  entities: {
1836
2045
  workspaceId: string;
1837
2046
  userId: string;
1838
2047
  id: string;
1839
2048
  createdAt: Date;
1840
- entityId: string;
1841
- threadId: string;
2049
+ channelId: string;
1842
2050
  sourceMessageId: string | null;
1843
- relationshipType: ThreadEntityRelationshipType;
1844
- conflictStatus: ThreadEntityConflictStatus;
1845
- sourceEventId: string | null;
2051
+ objectType: ChannelContextObjectType;
2052
+ objectId: string;
2053
+ relationshipType: ChannelContextRelationshipType;
2054
+ conflictStatus: ChannelContextConflictStatus;
1846
2055
  }[];
1847
2056
  documents: {
1848
2057
  workspaceId: string;
1849
2058
  userId: string;
1850
2059
  id: string;
1851
2060
  createdAt: Date;
1852
- documentId: string;
1853
- threadId: string;
2061
+ channelId: string;
1854
2062
  sourceMessageId: string | null;
1855
- relationshipType: ThreadDocumentRelationshipType;
1856
- conflictStatus: ThreadDocumentConflictStatus;
1857
- sourceEventId: string | null;
2063
+ objectType: ChannelContextObjectType;
2064
+ objectId: string;
2065
+ relationshipType: ChannelContextRelationshipType;
2066
+ conflictStatus: ChannelContextConflictStatus;
1858
2067
  }[];
1859
2068
  };
1860
2069
  meta: object;
@@ -1871,6 +2080,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1871
2080
  workspaceId?: string | undefined;
1872
2081
  targetType?: "entity" | "view" | "document" | "profile" | "whiteboard" | undefined;
1873
2082
  targetId?: string | undefined;
2083
+ threadId?: string | undefined;
1874
2084
  status?: "pending" | "validated" | "rejected" | "all" | undefined;
1875
2085
  limit?: number | undefined;
1876
2086
  };
@@ -1881,10 +2091,14 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1881
2091
  data: unknown;
1882
2092
  updatedAt: Date;
1883
2093
  createdAt: Date;
2094
+ sourceMessageId: string | null;
1884
2095
  status: ProposalStatus;
2096
+ createdBy: string | null;
2097
+ threadId: string | null;
1885
2098
  targetType: string;
1886
2099
  targetId: string;
1887
2100
  proposalType: string;
2101
+ commandRunId: string | null;
1888
2102
  reviewedBy: string | null;
1889
2103
  reviewedAt: Date | null;
1890
2104
  rejectionReason: string | null;
@@ -2043,7 +2257,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
2043
2257
  data: Record<string, unknown>;
2044
2258
  userId: string;
2045
2259
  subjectId?: string | undefined;
2046
- source?: "system" | "sync" | "api" | "automation" | "migration" | undefined;
2260
+ source?: "sync" | "system" | "api" | "automation" | "migration" | undefined;
2047
2261
  correlationId?: string | undefined;
2048
2262
  causationId?: string | undefined;
2049
2263
  };
@@ -2775,7 +2989,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
2775
2989
  };
2776
2990
  output: {
2777
2991
  sessionId: string;
2778
- chatThreadId: `${string}-${string}-${string}-${string}-${string}`;
2992
+ channelId: `${string}-${string}-${string}-${string}-${string}`;
2779
2993
  };
2780
2994
  meta: object;
2781
2995
  }>;
@@ -3370,8 +3584,8 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3370
3584
  id: string;
3371
3585
  errorMessage: string | null;
3372
3586
  startedAt: Date;
3373
- threadId: string;
3374
3587
  status: "completed" | "running" | "failed";
3588
+ threadId: string;
3375
3589
  commandId: string;
3376
3590
  permissionsSnapshot: Record<string, unknown> | null;
3377
3591
  inputs: Record<string, unknown> | null;
@@ -3396,8 +3610,8 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3396
3610
  id: string;
3397
3611
  errorMessage: string | null;
3398
3612
  startedAt: Date;
3399
- threadId: string;
3400
3613
  status: "completed" | "running" | "failed";
3614
+ threadId: string;
3401
3615
  commandId: string;
3402
3616
  permissionsSnapshot: Record<string, unknown> | null;
3403
3617
  inputs: Record<string, unknown> | null;
@@ -3421,6 +3635,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3421
3635
  endpoints?: string[];
3422
3636
  authType?: string;
3423
3637
  };
3638
+ intelligenceConfigured: boolean;
3424
3639
  };
3425
3640
  meta: object;
3426
3641
  }>;
@@ -3806,6 +4021,48 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3806
4021
  };
3807
4022
  meta: object;
3808
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
+ }>;
3809
4066
  delete: import("@trpc/server").TRPCMutationProcedure<{
3810
4067
  input: {
3811
4068
  id: string;
@@ -6010,6 +6267,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
6010
6267
  id: string;
6011
6268
  updatedAt: Date;
6012
6269
  createdAt: Date;
6270
+ profileId: string | null;
6013
6271
  slug: string;
6014
6272
  valueType: PropertyValueType;
6015
6273
  constraints: unknown;
@@ -6027,6 +6285,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
6027
6285
  id: string;
6028
6286
  updatedAt: Date;
6029
6287
  createdAt: Date;
6288
+ profileId: string | null;
6030
6289
  slug: string;
6031
6290
  valueType: PropertyValueType;
6032
6291
  constraints: unknown;
@@ -6041,12 +6300,14 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
6041
6300
  valueType: "string" | "number" | "boolean" | "object" | "array" | "date" | "secret" | "entity_id";
6042
6301
  constraints?: Record<string, unknown> | undefined;
6043
6302
  uiHints?: Record<string, unknown> | undefined;
6303
+ profileId?: string | undefined;
6044
6304
  };
6045
6305
  output: {
6046
6306
  propertyDef: {
6047
6307
  id: string;
6048
6308
  updatedAt: Date;
6049
6309
  createdAt: Date;
6310
+ profileId: string | null;
6050
6311
  slug: string;
6051
6312
  valueType: PropertyValueType;
6052
6313
  constraints: unknown;
@@ -6058,6 +6319,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
6058
6319
  id: string;
6059
6320
  updatedAt: Date;
6060
6321
  createdAt: Date;
6322
+ profileId: string | null;
6061
6323
  slug: string;
6062
6324
  valueType: PropertyValueType;
6063
6325
  constraints: unknown;
@@ -6080,6 +6342,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
6080
6342
  id: string;
6081
6343
  updatedAt: Date;
6082
6344
  createdAt: Date;
6345
+ profileId: string | null;
6083
6346
  slug: string;
6084
6347
  valueType: PropertyValueType;
6085
6348
  constraints: unknown;
@@ -6210,6 +6473,30 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
6210
6473
  };
6211
6474
  meta: object;
6212
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
+ }>;
6213
6500
  delete: import("@trpc/server").TRPCMutationProcedure<{
6214
6501
  input: {
6215
6502
  id: string;