@synap-core/api-types 1.1.4 → 1.2.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.
@@ -1,5 +1,7 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
+ import { Column, SQL } from 'drizzle-orm';
4
+
3
5
  /**
4
6
  * Context Types
5
7
  *
@@ -53,6 +55,333 @@ export interface Context {
53
55
  req?: Request;
54
56
  socketIO?: any;
55
57
  }
58
+ declare const chatThreads: import("drizzle-orm/pg-core").PgTableWithColumns<{
59
+ name: "chat_threads";
60
+ schema: undefined;
61
+ columns: {
62
+ id: import("drizzle-orm/pg-core").PgColumn<{
63
+ name: "id";
64
+ tableName: "chat_threads";
65
+ dataType: "string";
66
+ columnType: "PgUUID";
67
+ data: string;
68
+ driverParam: string;
69
+ notNull: true;
70
+ hasDefault: true;
71
+ isPrimaryKey: true;
72
+ isAutoincrement: false;
73
+ hasRuntimeDefault: false;
74
+ enumValues: undefined;
75
+ baseColumn: never;
76
+ identity: undefined;
77
+ generated: undefined;
78
+ }, {}, {}>;
79
+ userId: import("drizzle-orm/pg-core").PgColumn<{
80
+ name: "user_id";
81
+ tableName: "chat_threads";
82
+ dataType: "string";
83
+ columnType: "PgText";
84
+ data: string;
85
+ driverParam: string;
86
+ notNull: true;
87
+ hasDefault: false;
88
+ isPrimaryKey: false;
89
+ isAutoincrement: false;
90
+ hasRuntimeDefault: false;
91
+ enumValues: [
92
+ string,
93
+ ...string[]
94
+ ];
95
+ baseColumn: never;
96
+ identity: undefined;
97
+ generated: undefined;
98
+ }, {}, {}>;
99
+ projectId: import("drizzle-orm/pg-core").PgColumn<{
100
+ name: "project_id";
101
+ tableName: "chat_threads";
102
+ dataType: "string";
103
+ columnType: "PgUUID";
104
+ data: string;
105
+ driverParam: string;
106
+ notNull: false;
107
+ hasDefault: false;
108
+ isPrimaryKey: false;
109
+ isAutoincrement: false;
110
+ hasRuntimeDefault: false;
111
+ enumValues: undefined;
112
+ baseColumn: never;
113
+ identity: undefined;
114
+ generated: undefined;
115
+ }, {}, {}>;
116
+ title: import("drizzle-orm/pg-core").PgColumn<{
117
+ name: "title";
118
+ tableName: "chat_threads";
119
+ dataType: "string";
120
+ columnType: "PgText";
121
+ data: string;
122
+ driverParam: string;
123
+ notNull: false;
124
+ hasDefault: false;
125
+ isPrimaryKey: false;
126
+ isAutoincrement: false;
127
+ hasRuntimeDefault: false;
128
+ enumValues: [
129
+ string,
130
+ ...string[]
131
+ ];
132
+ baseColumn: never;
133
+ identity: undefined;
134
+ generated: undefined;
135
+ }, {}, {}>;
136
+ threadType: import("drizzle-orm/pg-core").PgColumn<{
137
+ name: "thread_type";
138
+ tableName: "chat_threads";
139
+ dataType: "string";
140
+ columnType: "PgText";
141
+ data: "main" | "branch";
142
+ driverParam: string;
143
+ notNull: true;
144
+ hasDefault: true;
145
+ isPrimaryKey: false;
146
+ isAutoincrement: false;
147
+ hasRuntimeDefault: false;
148
+ enumValues: [
149
+ "main",
150
+ "branch"
151
+ ];
152
+ baseColumn: never;
153
+ identity: undefined;
154
+ generated: undefined;
155
+ }, {}, {}>;
156
+ parentThreadId: import("drizzle-orm/pg-core").PgColumn<{
157
+ name: "parent_thread_id";
158
+ tableName: "chat_threads";
159
+ dataType: "string";
160
+ columnType: "PgUUID";
161
+ data: string;
162
+ driverParam: string;
163
+ notNull: false;
164
+ hasDefault: false;
165
+ isPrimaryKey: false;
166
+ isAutoincrement: false;
167
+ hasRuntimeDefault: false;
168
+ enumValues: undefined;
169
+ baseColumn: never;
170
+ identity: undefined;
171
+ generated: undefined;
172
+ }, {}, {}>;
173
+ branchedFromMessageId: import("drizzle-orm/pg-core").PgColumn<{
174
+ name: "branched_from_message_id";
175
+ tableName: "chat_threads";
176
+ dataType: "string";
177
+ columnType: "PgUUID";
178
+ data: string;
179
+ driverParam: string;
180
+ notNull: false;
181
+ hasDefault: false;
182
+ isPrimaryKey: false;
183
+ isAutoincrement: false;
184
+ hasRuntimeDefault: false;
185
+ enumValues: undefined;
186
+ baseColumn: never;
187
+ identity: undefined;
188
+ generated: undefined;
189
+ }, {}, {}>;
190
+ branchPurpose: import("drizzle-orm/pg-core").PgColumn<{
191
+ name: "branch_purpose";
192
+ tableName: "chat_threads";
193
+ dataType: "string";
194
+ columnType: "PgText";
195
+ data: string;
196
+ driverParam: string;
197
+ notNull: false;
198
+ hasDefault: false;
199
+ isPrimaryKey: false;
200
+ isAutoincrement: false;
201
+ hasRuntimeDefault: false;
202
+ enumValues: [
203
+ string,
204
+ ...string[]
205
+ ];
206
+ baseColumn: never;
207
+ identity: undefined;
208
+ generated: undefined;
209
+ }, {}, {}>;
210
+ agentId: import("drizzle-orm/pg-core").PgColumn<{
211
+ name: "agent_id";
212
+ tableName: "chat_threads";
213
+ dataType: "string";
214
+ columnType: "PgText";
215
+ data: string;
216
+ driverParam: string;
217
+ notNull: true;
218
+ hasDefault: true;
219
+ isPrimaryKey: false;
220
+ isAutoincrement: false;
221
+ hasRuntimeDefault: false;
222
+ enumValues: [
223
+ string,
224
+ ...string[]
225
+ ];
226
+ baseColumn: never;
227
+ identity: undefined;
228
+ generated: undefined;
229
+ }, {}, {}>;
230
+ status: import("drizzle-orm/pg-core").PgColumn<{
231
+ name: "status";
232
+ tableName: "chat_threads";
233
+ dataType: "string";
234
+ columnType: "PgText";
235
+ data: "active" | "archived" | "merged";
236
+ driverParam: string;
237
+ notNull: true;
238
+ hasDefault: true;
239
+ isPrimaryKey: false;
240
+ isAutoincrement: false;
241
+ hasRuntimeDefault: false;
242
+ enumValues: [
243
+ "active",
244
+ "merged",
245
+ "archived"
246
+ ];
247
+ baseColumn: never;
248
+ identity: undefined;
249
+ generated: undefined;
250
+ }, {}, {}>;
251
+ agentType: import("drizzle-orm/pg-core").PgColumn<{
252
+ name: "agent_type";
253
+ tableName: "chat_threads";
254
+ dataType: "string";
255
+ columnType: "PgText";
256
+ data: "default" | "meta" | "prompting" | "knowledge-search" | "code" | "writing" | "action";
257
+ driverParam: string;
258
+ notNull: true;
259
+ hasDefault: true;
260
+ isPrimaryKey: false;
261
+ isAutoincrement: false;
262
+ hasRuntimeDefault: false;
263
+ enumValues: [
264
+ "default",
265
+ "meta",
266
+ "prompting",
267
+ "knowledge-search",
268
+ "code",
269
+ "writing",
270
+ "action"
271
+ ];
272
+ baseColumn: never;
273
+ identity: undefined;
274
+ generated: undefined;
275
+ }, {}, {}>;
276
+ agentConfig: import("drizzle-orm/pg-core").PgColumn<{
277
+ name: "agent_config";
278
+ tableName: "chat_threads";
279
+ dataType: "json";
280
+ columnType: "PgJsonb";
281
+ data: unknown;
282
+ driverParam: unknown;
283
+ notNull: false;
284
+ hasDefault: false;
285
+ isPrimaryKey: false;
286
+ isAutoincrement: false;
287
+ hasRuntimeDefault: false;
288
+ enumValues: undefined;
289
+ baseColumn: never;
290
+ identity: undefined;
291
+ generated: undefined;
292
+ }, {}, {}>;
293
+ contextSummary: import("drizzle-orm/pg-core").PgColumn<{
294
+ name: "context_summary";
295
+ tableName: "chat_threads";
296
+ dataType: "string";
297
+ columnType: "PgText";
298
+ data: string;
299
+ driverParam: string;
300
+ notNull: false;
301
+ hasDefault: false;
302
+ isPrimaryKey: false;
303
+ isAutoincrement: false;
304
+ hasRuntimeDefault: false;
305
+ enumValues: [
306
+ string,
307
+ ...string[]
308
+ ];
309
+ baseColumn: never;
310
+ identity: undefined;
311
+ generated: undefined;
312
+ }, {}, {}>;
313
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
314
+ name: "metadata";
315
+ tableName: "chat_threads";
316
+ dataType: "json";
317
+ columnType: "PgJsonb";
318
+ data: unknown;
319
+ driverParam: unknown;
320
+ notNull: false;
321
+ hasDefault: false;
322
+ isPrimaryKey: false;
323
+ isAutoincrement: false;
324
+ hasRuntimeDefault: false;
325
+ enumValues: undefined;
326
+ baseColumn: never;
327
+ identity: undefined;
328
+ generated: undefined;
329
+ }, {}, {}>;
330
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
331
+ name: "created_at";
332
+ tableName: "chat_threads";
333
+ dataType: "date";
334
+ columnType: "PgTimestamp";
335
+ data: Date;
336
+ driverParam: string;
337
+ notNull: true;
338
+ hasDefault: true;
339
+ isPrimaryKey: false;
340
+ isAutoincrement: false;
341
+ hasRuntimeDefault: false;
342
+ enumValues: undefined;
343
+ baseColumn: never;
344
+ identity: undefined;
345
+ generated: undefined;
346
+ }, {}, {}>;
347
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
348
+ name: "updated_at";
349
+ tableName: "chat_threads";
350
+ dataType: "date";
351
+ columnType: "PgTimestamp";
352
+ data: Date;
353
+ driverParam: string;
354
+ notNull: true;
355
+ hasDefault: true;
356
+ isPrimaryKey: false;
357
+ isAutoincrement: false;
358
+ hasRuntimeDefault: false;
359
+ enumValues: undefined;
360
+ baseColumn: never;
361
+ identity: undefined;
362
+ generated: undefined;
363
+ }, {}, {}>;
364
+ mergedAt: import("drizzle-orm/pg-core").PgColumn<{
365
+ name: "merged_at";
366
+ tableName: "chat_threads";
367
+ dataType: "date";
368
+ columnType: "PgTimestamp";
369
+ data: Date;
370
+ driverParam: string;
371
+ notNull: false;
372
+ hasDefault: false;
373
+ isPrimaryKey: false;
374
+ isAutoincrement: false;
375
+ hasRuntimeDefault: false;
376
+ enumValues: undefined;
377
+ baseColumn: never;
378
+ identity: undefined;
379
+ generated: undefined;
380
+ }, {}, {}>;
381
+ };
382
+ dialect: "pg";
383
+ }>;
384
+ export type ChatThread = typeof chatThreads.$inferSelect;
56
385
  /**
57
386
  * Workspaces Schema - Multi-user workspace support
58
387
  *
@@ -115,73 +444,6 @@ export interface EventRecord {
115
444
  correlationId?: string;
116
445
  source: string;
117
446
  }
118
- /**
119
- * @synap/events - Schema-Driven Event Generator
120
- *
121
- * This module generates event types and payload schemas from Drizzle database tables.
122
- *
123
- * V2.0 CONSOLIDATED PATTERN: {table}.{action}.{modifier}
124
- *
125
- * Actions: create | update | delete
126
- * Modifiers: requested | validated
127
- *
128
- * Examples:
129
- * entities.create.requested ← Intent submitted (by user or AI)
130
- * entities.create.validated ← Change confirmed and applied
131
- * entities.update.requested ← Update intent
132
- * entities.update.validated ← Update confirmed
133
- *
134
- * No direct actions (e.g., entities.create) - all changes go through requested→validated flow.
135
- */
136
- /**
137
- * Standard CRUD actions with modifiers for table events
138
- *
139
- * V2.1: Added 'approved' modifier for 3-phase flow
140
- *
141
- * Flow:
142
- * 1. requested: Intent (user/AI wants to do something)
143
- * 2. approved: Validated (permissions checked, user approved if needed)
144
- * 3. validated: Completed (DB operation done, entity exists)
145
- */
146
- export type TableAction = "create.requested" | "create.approved" | "create.validated" | "update.requested" | "update.approved" | "update.validated" | "delete.requested" | "delete.approved" | "delete.validated";
147
- declare const CORE_TABLES: readonly [
148
- "entities",
149
- "documents",
150
- "documentVersions",
151
- "chatThreads",
152
- "conversationMessages",
153
- "webhookSubscriptions",
154
- "apiKeys",
155
- "tags",
156
- "agents",
157
- "workspaces",
158
- "workspaceMembers",
159
- "views",
160
- "userPreferences"
161
- ];
162
- export type CoreTable = (typeof CORE_TABLES)[number];
163
- /**
164
- * Flat list of all generated event types (for type checking)
165
- *
166
- * V2.1: Added .approved phase for 3-phase flow
167
- */
168
- 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`;
169
- /**
170
- * Worker Registry - Static worker metadata for Admin UI
171
- *
172
- * V2.0: Simplified registry with only active workers
173
- *
174
- * Pattern: Table workers handle {table}.{crud}.requested events
175
- * and emit {table}.{crud}.completed events.
176
- */
177
- export interface WorkerMetadata {
178
- id: string;
179
- name: string;
180
- description: string;
181
- triggers: string[];
182
- outputs?: string[];
183
- category: "table" | "shared" | "ai";
184
- }
185
447
  /**
186
448
  * View Query Types
187
449
  *
@@ -305,6 +567,127 @@ export interface StructuredViewConfig {
305
567
  query: EntityQuery;
306
568
  render?: RenderSettings;
307
569
  }
570
+ declare enum AgentType {
571
+ DEFAULT = "default",
572
+ META = "meta",
573
+ PROMPTING = "prompting",
574
+ KNOWLEDGE_SEARCH = "knowledge-search",
575
+ CODE = "code",
576
+ WRITING = "writing",
577
+ ACTION = "action"
578
+ }
579
+ /**
580
+ * Agent type as string literal union (for flexibility)
581
+ */
582
+ export type AgentTypeString = `${AgentType}` | (string & {});
583
+ declare enum AIStepType {
584
+ THINKING = "thinking",
585
+ TOOL_CALL = "tool_call",
586
+ TOOL_RESULT = "tool_result",
587
+ DECISION = "decision",
588
+ ERROR = "error"
589
+ }
590
+ /**
591
+ * AI step - shows what the AI is doing
592
+ *
593
+ * Represents any step in the AI's reasoning/execution process:
594
+ * - thinking: General analysis and reasoning
595
+ * - tool_call: When AI calls a tool
596
+ * - tool_result: Result from tool execution
597
+ * - decision: AI making a decision
598
+ * - error: Error during processing
599
+ */
600
+ export interface AIStep {
601
+ id: string;
602
+ type: AIStepType | string;
603
+ content: string;
604
+ toolName?: string;
605
+ toolInput?: unknown;
606
+ toolOutput?: unknown;
607
+ timestamp: string;
608
+ duration?: number;
609
+ error?: string;
610
+ title?: string;
611
+ description?: string;
612
+ status?: "pending" | "running" | "complete" | "error";
613
+ }
614
+ /**
615
+ * Branch decision from meta-agent
616
+ */
617
+ export interface BranchDecision {
618
+ shouldBranch: boolean;
619
+ reason: string;
620
+ suggestedAgentType?: AgentTypeString;
621
+ suggestedTitle?: string;
622
+ suggestedPurpose?: string;
623
+ }
624
+ /**
625
+ * @synap/events - Schema-Driven Event Generator
626
+ *
627
+ * This module generates event types and payload schemas from Drizzle database tables.
628
+ *
629
+ * V2.0 CONSOLIDATED PATTERN: {table}.{action}.{modifier}
630
+ *
631
+ * Actions: create | update | delete
632
+ * Modifiers: requested | validated
633
+ *
634
+ * Examples:
635
+ * entities.create.requested ← Intent submitted (by user or AI)
636
+ * entities.create.validated ← Change confirmed and applied
637
+ * entities.update.requested ← Update intent
638
+ * entities.update.validated ← Update confirmed
639
+ *
640
+ * No direct actions (e.g., entities.create) - all changes go through requested→validated flow.
641
+ */
642
+ /**
643
+ * Standard CRUD actions with modifiers for table events
644
+ *
645
+ * V2.1: Added 'approved' modifier for 3-phase flow
646
+ *
647
+ * Flow:
648
+ * 1. requested: Intent (user/AI wants to do something)
649
+ * 2. approved: Validated (permissions checked, user approved if needed)
650
+ * 3. validated: Completed (DB operation done, entity exists)
651
+ */
652
+ export type TableAction = "create.requested" | "create.approved" | "create.validated" | "update.requested" | "update.approved" | "update.validated" | "delete.requested" | "delete.approved" | "delete.validated";
653
+ declare const CORE_TABLES: readonly [
654
+ "entities",
655
+ "documents",
656
+ "documentVersions",
657
+ "chatThreads",
658
+ "conversationMessages",
659
+ "webhookSubscriptions",
660
+ "apiKeys",
661
+ "tags",
662
+ "agents",
663
+ "workspaces",
664
+ "workspaceMembers",
665
+ "views",
666
+ "userPreferences"
667
+ ];
668
+ export type CoreTable = (typeof CORE_TABLES)[number];
669
+ /**
670
+ * Flat list of all generated event types (for type checking)
671
+ *
672
+ * V2.1: Added .approved phase for 3-phase flow
673
+ */
674
+ 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`;
675
+ /**
676
+ * Worker Registry - Static worker metadata for Admin UI
677
+ *
678
+ * V2.0: Simplified registry with only active workers
679
+ *
680
+ * Pattern: Table workers handle {table}.{crud}.requested events
681
+ * and emit {table}.{crud}.completed events.
682
+ */
683
+ export interface WorkerMetadata {
684
+ id: string;
685
+ name: string;
686
+ description: string;
687
+ triggers: string[];
688
+ outputs?: string[];
689
+ category: "table" | "shared" | "ai";
690
+ }
308
691
  /**
309
692
  * Core API Router
310
693
  */
@@ -392,7 +775,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
392
775
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
393
776
  create: import("@trpc/server").TRPCMutationProcedure<{
394
777
  input: {
395
- type: "project" | "task" | "contact" | "meeting" | "idea" | "note";
778
+ type: "event" | "file" | "project" | "task" | "contact" | "meeting" | "idea" | "note" | "person" | "code" | "bookmark" | "company";
396
779
  title?: string | undefined;
397
780
  description?: string | undefined;
398
781
  workspaceId?: string | undefined;
@@ -709,7 +1092,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
709
1092
  }>;
710
1093
  list: import("@trpc/server").TRPCQueryProcedure<{
711
1094
  input: {
712
- type?: "project" | "task" | "contact" | "meeting" | "idea" | "note" | undefined;
1095
+ type?: "event" | "file" | "project" | "task" | "contact" | "meeting" | "idea" | "note" | "person" | "code" | "bookmark" | "company" | undefined;
713
1096
  workspaceId?: string | undefined;
714
1097
  limit?: number | undefined;
715
1098
  };
@@ -1022,7 +1405,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1022
1405
  search: import("@trpc/server").TRPCQueryProcedure<{
1023
1406
  input: {
1024
1407
  query: string;
1025
- type?: "project" | "task" | "contact" | "meeting" | "idea" | "note" | undefined;
1408
+ type?: "event" | "file" | "project" | "task" | "contact" | "meeting" | "idea" | "note" | "person" | "code" | "bookmark" | "company" | undefined;
1026
1409
  limit?: number | undefined;
1027
1410
  };
1028
1411
  output: {
@@ -1672,7 +2055,349 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
1672
2055
  meta: object;
1673
2056
  errorShape: import("@trpc/server").TRPCDefaultErrorShape;
1674
2057
  transformer: true;
1675
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<import("@trpc/server").TRPCCreateRouterOptions>>;
2058
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
2059
+ createThread: import("@trpc/server").TRPCMutationProcedure<{
2060
+ input: {
2061
+ projectId?: string | undefined;
2062
+ parentThreadId?: string | undefined;
2063
+ branchPurpose?: string | undefined;
2064
+ agentId?: string | undefined;
2065
+ agentType?: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action" | undefined;
2066
+ agentConfig?: Record<string, any> | undefined;
2067
+ inheritContext?: boolean | undefined;
2068
+ };
2069
+ output: {
2070
+ threadId: `${string}-${string}-${string}-${string}-${string}`;
2071
+ thread: {
2072
+ userId: string;
2073
+ id: string;
2074
+ status: "archived" | "active" | "merged";
2075
+ createdAt: Date;
2076
+ updatedAt: Date;
2077
+ metadata: unknown;
2078
+ title: string | null;
2079
+ projectId: string | null;
2080
+ threadType: "main" | "branch";
2081
+ parentThreadId: string | null;
2082
+ branchedFromMessageId: string | null;
2083
+ branchPurpose: string | null;
2084
+ agentId: string;
2085
+ agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
2086
+ agentConfig: unknown;
2087
+ contextSummary: string | null;
2088
+ mergedAt: Date | null;
2089
+ };
2090
+ };
2091
+ meta: object;
2092
+ }>;
2093
+ sendMessage: import("@trpc/server").TRPCMutationProcedure<{
2094
+ input: {
2095
+ threadId: string;
2096
+ content: string;
2097
+ };
2098
+ output: {
2099
+ messageId: `${string}-${string}-${string}-${string}-${string}`;
2100
+ content: string;
2101
+ entities: {
2102
+ type: string;
2103
+ title: string;
2104
+ status: string;
2105
+ }[];
2106
+ branchDecision: BranchDecision | undefined;
2107
+ branchThread: {
2108
+ userId: string;
2109
+ id: string;
2110
+ status: "archived" | "active" | "merged";
2111
+ createdAt: Date;
2112
+ updatedAt: Date;
2113
+ metadata: unknown;
2114
+ title: string | null;
2115
+ projectId: string | null;
2116
+ threadType: "main" | "branch";
2117
+ parentThreadId: string | null;
2118
+ branchedFromMessageId: string | null;
2119
+ branchPurpose: string | null;
2120
+ agentId: string;
2121
+ agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
2122
+ agentConfig: unknown;
2123
+ contextSummary: string | null;
2124
+ mergedAt: Date | null;
2125
+ } | undefined;
2126
+ aiSteps: AIStep[];
2127
+ };
2128
+ meta: object;
2129
+ }>;
2130
+ getMessages: import("@trpc/server").TRPCQueryProcedure<{
2131
+ input: {
2132
+ threadId: string;
2133
+ cursor?: string | undefined;
2134
+ limit?: number | undefined;
2135
+ };
2136
+ output: {
2137
+ messages: {
2138
+ userId: string;
2139
+ id: string;
2140
+ metadata: any;
2141
+ timestamp: Date;
2142
+ content: string;
2143
+ role: "user" | "system" | "assistant";
2144
+ deletedAt: Date | null;
2145
+ threadId: string;
2146
+ parentId: string | null;
2147
+ previousHash: string | null;
2148
+ hash: string;
2149
+ }[];
2150
+ nextCursor: string | undefined;
2151
+ hasMore: boolean;
2152
+ };
2153
+ meta: object;
2154
+ }>;
2155
+ listThreads: import("@trpc/server").TRPCQueryProcedure<{
2156
+ input: {
2157
+ projectId?: string | undefined;
2158
+ threadType?: "main" | "branch" | undefined;
2159
+ limit?: number | undefined;
2160
+ };
2161
+ output: {
2162
+ threads: {
2163
+ userId: string;
2164
+ id: string;
2165
+ status: "archived" | "active" | "merged";
2166
+ createdAt: Date;
2167
+ updatedAt: Date;
2168
+ metadata: unknown;
2169
+ title: string | null;
2170
+ projectId: string | null;
2171
+ threadType: "main" | "branch";
2172
+ parentThreadId: string | null;
2173
+ branchedFromMessageId: string | null;
2174
+ branchPurpose: string | null;
2175
+ agentId: string;
2176
+ agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
2177
+ agentConfig: unknown;
2178
+ contextSummary: string | null;
2179
+ mergedAt: Date | null;
2180
+ }[];
2181
+ };
2182
+ meta: object;
2183
+ }>;
2184
+ getBranches: import("@trpc/server").TRPCQueryProcedure<{
2185
+ input: {
2186
+ parentThreadId: string;
2187
+ };
2188
+ output: {
2189
+ branches: {
2190
+ userId: string;
2191
+ id: string;
2192
+ status: "archived" | "active" | "merged";
2193
+ createdAt: Date;
2194
+ updatedAt: Date;
2195
+ metadata: unknown;
2196
+ title: string | null;
2197
+ projectId: string | null;
2198
+ threadType: "main" | "branch";
2199
+ parentThreadId: string | null;
2200
+ branchedFromMessageId: string | null;
2201
+ branchPurpose: string | null;
2202
+ agentId: string;
2203
+ agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
2204
+ agentConfig: unknown;
2205
+ contextSummary: string | null;
2206
+ mergedAt: Date | null;
2207
+ }[];
2208
+ };
2209
+ meta: object;
2210
+ }>;
2211
+ mergeBranch: import("@trpc/server").TRPCMutationProcedure<{
2212
+ input: {
2213
+ branchId: string;
2214
+ };
2215
+ output: {
2216
+ summary: string;
2217
+ };
2218
+ meta: object;
2219
+ }>;
2220
+ getThread: import("@trpc/server").TRPCQueryProcedure<{
2221
+ input: {
2222
+ threadId: string;
2223
+ includeContext?: boolean | undefined;
2224
+ includeBranches?: boolean | undefined;
2225
+ };
2226
+ output: {
2227
+ thread: {
2228
+ userId: string;
2229
+ id: string;
2230
+ status: "archived" | "active" | "merged";
2231
+ createdAt: Date;
2232
+ updatedAt: Date;
2233
+ metadata: unknown;
2234
+ title: string | null;
2235
+ projectId: string | null;
2236
+ threadType: "main" | "branch";
2237
+ parentThreadId: string | null;
2238
+ branchedFromMessageId: string | null;
2239
+ branchPurpose: string | null;
2240
+ agentId: string;
2241
+ agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
2242
+ agentConfig: unknown;
2243
+ contextSummary: string | null;
2244
+ mergedAt: Date | null;
2245
+ };
2246
+ entities: {
2247
+ userId: string;
2248
+ id: string;
2249
+ createdAt: Date;
2250
+ workspaceId: string;
2251
+ entityId: string;
2252
+ threadId: string;
2253
+ sourceMessageId: string | null;
2254
+ relationshipType: "used_as_context" | "created" | "updated" | "referenced" | "inherited_from_parent";
2255
+ conflictStatus: "none" | "pending" | "resolved";
2256
+ sourceEventId: string | null;
2257
+ }[] | undefined;
2258
+ documents: {
2259
+ userId: string;
2260
+ id: string;
2261
+ createdAt: Date;
2262
+ workspaceId: string;
2263
+ documentId: string;
2264
+ threadId: string;
2265
+ sourceMessageId: string | null;
2266
+ relationshipType: "used_as_context" | "created" | "updated" | "referenced" | "inherited_from_parent";
2267
+ conflictStatus: "none" | "pending" | "resolved";
2268
+ sourceEventId: string | null;
2269
+ }[] | undefined;
2270
+ branchTree: any;
2271
+ };
2272
+ meta: object;
2273
+ }>;
2274
+ updateThread: import("@trpc/server").TRPCMutationProcedure<{
2275
+ input: {
2276
+ threadId: string;
2277
+ title?: string | undefined;
2278
+ agentId?: string | undefined;
2279
+ agentType?: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action" | undefined;
2280
+ agentConfig?: Record<string, unknown> | undefined;
2281
+ };
2282
+ output: {
2283
+ status: string;
2284
+ threadId: string;
2285
+ };
2286
+ meta: object;
2287
+ }>;
2288
+ archiveThread: import("@trpc/server").TRPCMutationProcedure<{
2289
+ input: {
2290
+ threadId: string;
2291
+ };
2292
+ output: {
2293
+ status: string;
2294
+ threadId: string;
2295
+ };
2296
+ meta: object;
2297
+ }>;
2298
+ getBranchTree: import("@trpc/server").TRPCQueryProcedure<{
2299
+ input: {
2300
+ rootThreadId: string;
2301
+ };
2302
+ output: {
2303
+ tree: {
2304
+ thread: ChatThread;
2305
+ children: any[];
2306
+ } | null;
2307
+ flatBranches: {
2308
+ userId: string;
2309
+ id: string;
2310
+ status: "archived" | "active" | "merged";
2311
+ createdAt: Date;
2312
+ updatedAt: Date;
2313
+ metadata: unknown;
2314
+ title: string | null;
2315
+ projectId: string | null;
2316
+ threadType: "main" | "branch";
2317
+ parentThreadId: string | null;
2318
+ branchedFromMessageId: string | null;
2319
+ branchPurpose: string | null;
2320
+ agentId: string;
2321
+ agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
2322
+ agentConfig: unknown;
2323
+ contextSummary: string | null;
2324
+ mergedAt: Date | null;
2325
+ }[];
2326
+ activeBranches: {
2327
+ userId: string;
2328
+ id: string;
2329
+ status: "archived" | "active" | "merged";
2330
+ createdAt: Date;
2331
+ updatedAt: Date;
2332
+ metadata: unknown;
2333
+ title: string | null;
2334
+ projectId: string | null;
2335
+ threadType: "main" | "branch";
2336
+ parentThreadId: string | null;
2337
+ branchedFromMessageId: string | null;
2338
+ branchPurpose: string | null;
2339
+ agentId: string;
2340
+ agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
2341
+ agentConfig: unknown;
2342
+ contextSummary: string | null;
2343
+ mergedAt: Date | null;
2344
+ }[];
2345
+ mergedBranches: {
2346
+ userId: string;
2347
+ id: string;
2348
+ status: "archived" | "active" | "merged";
2349
+ createdAt: Date;
2350
+ updatedAt: Date;
2351
+ metadata: unknown;
2352
+ title: string | null;
2353
+ projectId: string | null;
2354
+ threadType: "main" | "branch";
2355
+ parentThreadId: string | null;
2356
+ branchedFromMessageId: string | null;
2357
+ branchPurpose: string | null;
2358
+ agentId: string;
2359
+ agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
2360
+ agentConfig: unknown;
2361
+ contextSummary: string | null;
2362
+ mergedAt: Date | null;
2363
+ }[];
2364
+ };
2365
+ meta: object;
2366
+ }>;
2367
+ getThreadContext: import("@trpc/server").TRPCQueryProcedure<{
2368
+ input: {
2369
+ threadId: string;
2370
+ relationshipTypes?: ("used_as_context" | "created" | "updated" | "referenced" | "inherited_from_parent")[] | undefined;
2371
+ };
2372
+ output: {
2373
+ entities: {
2374
+ userId: string;
2375
+ id: string;
2376
+ createdAt: Date;
2377
+ workspaceId: string;
2378
+ entityId: string;
2379
+ threadId: string;
2380
+ sourceMessageId: string | null;
2381
+ relationshipType: "used_as_context" | "created" | "updated" | "referenced" | "inherited_from_parent";
2382
+ conflictStatus: "none" | "pending" | "resolved";
2383
+ sourceEventId: string | null;
2384
+ }[];
2385
+ documents: {
2386
+ userId: string;
2387
+ id: string;
2388
+ createdAt: Date;
2389
+ workspaceId: string;
2390
+ documentId: string;
2391
+ threadId: string;
2392
+ sourceMessageId: string | null;
2393
+ relationshipType: "used_as_context" | "created" | "updated" | "referenced" | "inherited_from_parent";
2394
+ conflictStatus: "none" | "pending" | "resolved";
2395
+ sourceEventId: string | null;
2396
+ }[];
2397
+ };
2398
+ meta: object;
2399
+ }>;
2400
+ }>>;
1676
2401
  proposals: import("@trpc/server").TRPCBuiltRouter<{
1677
2402
  ctx: Context;
1678
2403
  meta: object;