@synap-core/api-types 1.1.3 → 1.1.5
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.
- package/dist/generated.d.ts +284 -71
- package/package.json +2 -2
- package/src/generated.d.ts +284 -71
package/dist/generated.d.ts
CHANGED
|
@@ -115,73 +115,6 @@ export interface EventRecord {
|
|
|
115
115
|
correlationId?: string;
|
|
116
116
|
source: string;
|
|
117
117
|
}
|
|
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
118
|
/**
|
|
186
119
|
* View Query Types
|
|
187
120
|
*
|
|
@@ -305,6 +238,127 @@ export interface StructuredViewConfig {
|
|
|
305
238
|
query: EntityQuery;
|
|
306
239
|
render?: RenderSettings;
|
|
307
240
|
}
|
|
241
|
+
declare enum AgentType {
|
|
242
|
+
DEFAULT = "default",
|
|
243
|
+
META = "meta",
|
|
244
|
+
PROMPTING = "prompting",
|
|
245
|
+
KNOWLEDGE_SEARCH = "knowledge-search",
|
|
246
|
+
CODE = "code",
|
|
247
|
+
WRITING = "writing",
|
|
248
|
+
ACTION = "action"
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Agent type as string literal union (for flexibility)
|
|
252
|
+
*/
|
|
253
|
+
export type AgentTypeString = `${AgentType}` | (string & {});
|
|
254
|
+
declare enum AIStepType {
|
|
255
|
+
THINKING = "thinking",
|
|
256
|
+
TOOL_CALL = "tool_call",
|
|
257
|
+
TOOL_RESULT = "tool_result",
|
|
258
|
+
DECISION = "decision",
|
|
259
|
+
ERROR = "error"
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* AI step - shows what the AI is doing
|
|
263
|
+
*
|
|
264
|
+
* Represents any step in the AI's reasoning/execution process:
|
|
265
|
+
* - thinking: General analysis and reasoning
|
|
266
|
+
* - tool_call: When AI calls a tool
|
|
267
|
+
* - tool_result: Result from tool execution
|
|
268
|
+
* - decision: AI making a decision
|
|
269
|
+
* - error: Error during processing
|
|
270
|
+
*/
|
|
271
|
+
export interface AIStep {
|
|
272
|
+
id: string;
|
|
273
|
+
type: AIStepType | string;
|
|
274
|
+
content: string;
|
|
275
|
+
toolName?: string;
|
|
276
|
+
toolInput?: unknown;
|
|
277
|
+
toolOutput?: unknown;
|
|
278
|
+
timestamp: string;
|
|
279
|
+
duration?: number;
|
|
280
|
+
error?: string;
|
|
281
|
+
title?: string;
|
|
282
|
+
description?: string;
|
|
283
|
+
status?: "pending" | "running" | "complete" | "error";
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Branch decision from meta-agent
|
|
287
|
+
*/
|
|
288
|
+
export interface BranchDecision {
|
|
289
|
+
shouldBranch: boolean;
|
|
290
|
+
reason: string;
|
|
291
|
+
suggestedAgentType?: AgentTypeString;
|
|
292
|
+
suggestedTitle?: string;
|
|
293
|
+
suggestedPurpose?: string;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @synap/events - Schema-Driven Event Generator
|
|
297
|
+
*
|
|
298
|
+
* This module generates event types and payload schemas from Drizzle database tables.
|
|
299
|
+
*
|
|
300
|
+
* V2.0 CONSOLIDATED PATTERN: {table}.{action}.{modifier}
|
|
301
|
+
*
|
|
302
|
+
* Actions: create | update | delete
|
|
303
|
+
* Modifiers: requested | validated
|
|
304
|
+
*
|
|
305
|
+
* Examples:
|
|
306
|
+
* entities.create.requested ← Intent submitted (by user or AI)
|
|
307
|
+
* entities.create.validated ← Change confirmed and applied
|
|
308
|
+
* entities.update.requested ← Update intent
|
|
309
|
+
* entities.update.validated ← Update confirmed
|
|
310
|
+
*
|
|
311
|
+
* No direct actions (e.g., entities.create) - all changes go through requested→validated flow.
|
|
312
|
+
*/
|
|
313
|
+
/**
|
|
314
|
+
* Standard CRUD actions with modifiers for table events
|
|
315
|
+
*
|
|
316
|
+
* V2.1: Added 'approved' modifier for 3-phase flow
|
|
317
|
+
*
|
|
318
|
+
* Flow:
|
|
319
|
+
* 1. requested: Intent (user/AI wants to do something)
|
|
320
|
+
* 2. approved: Validated (permissions checked, user approved if needed)
|
|
321
|
+
* 3. validated: Completed (DB operation done, entity exists)
|
|
322
|
+
*/
|
|
323
|
+
export type TableAction = "create.requested" | "create.approved" | "create.validated" | "update.requested" | "update.approved" | "update.validated" | "delete.requested" | "delete.approved" | "delete.validated";
|
|
324
|
+
declare const CORE_TABLES: readonly [
|
|
325
|
+
"entities",
|
|
326
|
+
"documents",
|
|
327
|
+
"documentVersions",
|
|
328
|
+
"chatThreads",
|
|
329
|
+
"conversationMessages",
|
|
330
|
+
"webhookSubscriptions",
|
|
331
|
+
"apiKeys",
|
|
332
|
+
"tags",
|
|
333
|
+
"agents",
|
|
334
|
+
"workspaces",
|
|
335
|
+
"workspaceMembers",
|
|
336
|
+
"views",
|
|
337
|
+
"userPreferences"
|
|
338
|
+
];
|
|
339
|
+
export type CoreTable = (typeof CORE_TABLES)[number];
|
|
340
|
+
/**
|
|
341
|
+
* Flat list of all generated event types (for type checking)
|
|
342
|
+
*
|
|
343
|
+
* V2.1: Added .approved phase for 3-phase flow
|
|
344
|
+
*/
|
|
345
|
+
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`;
|
|
346
|
+
/**
|
|
347
|
+
* Worker Registry - Static worker metadata for Admin UI
|
|
348
|
+
*
|
|
349
|
+
* V2.0: Simplified registry with only active workers
|
|
350
|
+
*
|
|
351
|
+
* Pattern: Table workers handle {table}.{crud}.requested events
|
|
352
|
+
* and emit {table}.{crud}.completed events.
|
|
353
|
+
*/
|
|
354
|
+
export interface WorkerMetadata {
|
|
355
|
+
id: string;
|
|
356
|
+
name: string;
|
|
357
|
+
description: string;
|
|
358
|
+
triggers: string[];
|
|
359
|
+
outputs?: string[];
|
|
360
|
+
category: "table" | "shared" | "ai";
|
|
361
|
+
}
|
|
308
362
|
/**
|
|
309
363
|
* Core API Router
|
|
310
364
|
*/
|
|
@@ -392,7 +446,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
392
446
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
393
447
|
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
394
448
|
input: {
|
|
395
|
-
type: "project" | "task" | "contact" | "meeting" | "idea" | "note";
|
|
449
|
+
type: "event" | "file" | "project" | "task" | "contact" | "meeting" | "idea" | "note" | "person" | "code" | "bookmark" | "company";
|
|
396
450
|
title?: string | undefined;
|
|
397
451
|
description?: string | undefined;
|
|
398
452
|
workspaceId?: string | undefined;
|
|
@@ -709,7 +763,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
709
763
|
}>;
|
|
710
764
|
list: import("@trpc/server").TRPCQueryProcedure<{
|
|
711
765
|
input: {
|
|
712
|
-
type?: "project" | "task" | "contact" | "meeting" | "idea" | "note" | undefined;
|
|
766
|
+
type?: "event" | "file" | "project" | "task" | "contact" | "meeting" | "idea" | "note" | "person" | "code" | "bookmark" | "company" | undefined;
|
|
713
767
|
workspaceId?: string | undefined;
|
|
714
768
|
limit?: number | undefined;
|
|
715
769
|
};
|
|
@@ -1022,7 +1076,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1022
1076
|
search: import("@trpc/server").TRPCQueryProcedure<{
|
|
1023
1077
|
input: {
|
|
1024
1078
|
query: string;
|
|
1025
|
-
type?: "project" | "task" | "contact" | "meeting" | "idea" | "note" | undefined;
|
|
1079
|
+
type?: "event" | "file" | "project" | "task" | "contact" | "meeting" | "idea" | "note" | "person" | "code" | "bookmark" | "company" | undefined;
|
|
1026
1080
|
limit?: number | undefined;
|
|
1027
1081
|
};
|
|
1028
1082
|
output: {
|
|
@@ -1672,7 +1726,166 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1672
1726
|
meta: object;
|
|
1673
1727
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
1674
1728
|
transformer: true;
|
|
1675
|
-
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<
|
|
1729
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
1730
|
+
createThread: import("@trpc/server").TRPCMutationProcedure<{
|
|
1731
|
+
input: {
|
|
1732
|
+
projectId?: string | undefined;
|
|
1733
|
+
parentThreadId?: string | undefined;
|
|
1734
|
+
branchPurpose?: string | undefined;
|
|
1735
|
+
agentId?: string | undefined;
|
|
1736
|
+
agentType?: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action" | undefined;
|
|
1737
|
+
agentConfig?: Record<string, any> | undefined;
|
|
1738
|
+
};
|
|
1739
|
+
output: {
|
|
1740
|
+
threadId: `${string}-${string}-${string}-${string}-${string}`;
|
|
1741
|
+
thread: {
|
|
1742
|
+
userId: string;
|
|
1743
|
+
id: string;
|
|
1744
|
+
status: "archived" | "active" | "merged";
|
|
1745
|
+
createdAt: Date;
|
|
1746
|
+
updatedAt: Date;
|
|
1747
|
+
metadata: unknown;
|
|
1748
|
+
title: string | null;
|
|
1749
|
+
projectId: string | null;
|
|
1750
|
+
threadType: "main" | "branch";
|
|
1751
|
+
parentThreadId: string | null;
|
|
1752
|
+
branchedFromMessageId: string | null;
|
|
1753
|
+
branchPurpose: string | null;
|
|
1754
|
+
agentId: string;
|
|
1755
|
+
agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
|
|
1756
|
+
agentConfig: unknown;
|
|
1757
|
+
contextSummary: string | null;
|
|
1758
|
+
mergedAt: Date | null;
|
|
1759
|
+
};
|
|
1760
|
+
};
|
|
1761
|
+
meta: object;
|
|
1762
|
+
}>;
|
|
1763
|
+
sendMessage: import("@trpc/server").TRPCMutationProcedure<{
|
|
1764
|
+
input: {
|
|
1765
|
+
threadId: string;
|
|
1766
|
+
content: string;
|
|
1767
|
+
};
|
|
1768
|
+
output: {
|
|
1769
|
+
messageId: `${string}-${string}-${string}-${string}-${string}`;
|
|
1770
|
+
content: string;
|
|
1771
|
+
entities: {
|
|
1772
|
+
type: string;
|
|
1773
|
+
title: string;
|
|
1774
|
+
status: string;
|
|
1775
|
+
}[];
|
|
1776
|
+
branchDecision: BranchDecision | undefined;
|
|
1777
|
+
branchThread: {
|
|
1778
|
+
userId: string;
|
|
1779
|
+
id: string;
|
|
1780
|
+
status: "archived" | "active" | "merged";
|
|
1781
|
+
createdAt: Date;
|
|
1782
|
+
updatedAt: Date;
|
|
1783
|
+
metadata: unknown;
|
|
1784
|
+
title: string | null;
|
|
1785
|
+
projectId: string | null;
|
|
1786
|
+
threadType: "main" | "branch";
|
|
1787
|
+
parentThreadId: string | null;
|
|
1788
|
+
branchedFromMessageId: string | null;
|
|
1789
|
+
branchPurpose: string | null;
|
|
1790
|
+
agentId: string;
|
|
1791
|
+
agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
|
|
1792
|
+
agentConfig: unknown;
|
|
1793
|
+
contextSummary: string | null;
|
|
1794
|
+
mergedAt: Date | null;
|
|
1795
|
+
} | undefined;
|
|
1796
|
+
aiSteps: AIStep[];
|
|
1797
|
+
};
|
|
1798
|
+
meta: object;
|
|
1799
|
+
}>;
|
|
1800
|
+
getMessages: import("@trpc/server").TRPCQueryProcedure<{
|
|
1801
|
+
input: {
|
|
1802
|
+
threadId: string;
|
|
1803
|
+
limit?: number | undefined;
|
|
1804
|
+
};
|
|
1805
|
+
output: {
|
|
1806
|
+
messages: {
|
|
1807
|
+
userId: string;
|
|
1808
|
+
id: string;
|
|
1809
|
+
metadata: any;
|
|
1810
|
+
timestamp: Date;
|
|
1811
|
+
content: string;
|
|
1812
|
+
role: "user" | "system" | "assistant";
|
|
1813
|
+
deletedAt: Date | null;
|
|
1814
|
+
threadId: string;
|
|
1815
|
+
parentId: string | null;
|
|
1816
|
+
previousHash: string | null;
|
|
1817
|
+
hash: string;
|
|
1818
|
+
}[];
|
|
1819
|
+
hasMore: boolean;
|
|
1820
|
+
};
|
|
1821
|
+
meta: object;
|
|
1822
|
+
}>;
|
|
1823
|
+
listThreads: import("@trpc/server").TRPCQueryProcedure<{
|
|
1824
|
+
input: {
|
|
1825
|
+
projectId?: string | undefined;
|
|
1826
|
+
threadType?: "main" | "branch" | undefined;
|
|
1827
|
+
limit?: number | undefined;
|
|
1828
|
+
};
|
|
1829
|
+
output: {
|
|
1830
|
+
threads: {
|
|
1831
|
+
userId: string;
|
|
1832
|
+
id: string;
|
|
1833
|
+
status: "archived" | "active" | "merged";
|
|
1834
|
+
createdAt: Date;
|
|
1835
|
+
updatedAt: Date;
|
|
1836
|
+
metadata: unknown;
|
|
1837
|
+
title: string | null;
|
|
1838
|
+
projectId: string | null;
|
|
1839
|
+
threadType: "main" | "branch";
|
|
1840
|
+
parentThreadId: string | null;
|
|
1841
|
+
branchedFromMessageId: string | null;
|
|
1842
|
+
branchPurpose: string | null;
|
|
1843
|
+
agentId: string;
|
|
1844
|
+
agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
|
|
1845
|
+
agentConfig: unknown;
|
|
1846
|
+
contextSummary: string | null;
|
|
1847
|
+
mergedAt: Date | null;
|
|
1848
|
+
}[];
|
|
1849
|
+
};
|
|
1850
|
+
meta: object;
|
|
1851
|
+
}>;
|
|
1852
|
+
getBranches: import("@trpc/server").TRPCQueryProcedure<{
|
|
1853
|
+
input: {
|
|
1854
|
+
parentThreadId: string;
|
|
1855
|
+
};
|
|
1856
|
+
output: {
|
|
1857
|
+
branches: {
|
|
1858
|
+
userId: string;
|
|
1859
|
+
id: string;
|
|
1860
|
+
status: "archived" | "active" | "merged";
|
|
1861
|
+
createdAt: Date;
|
|
1862
|
+
updatedAt: Date;
|
|
1863
|
+
metadata: unknown;
|
|
1864
|
+
title: string | null;
|
|
1865
|
+
projectId: string | null;
|
|
1866
|
+
threadType: "main" | "branch";
|
|
1867
|
+
parentThreadId: string | null;
|
|
1868
|
+
branchedFromMessageId: string | null;
|
|
1869
|
+
branchPurpose: string | null;
|
|
1870
|
+
agentId: string;
|
|
1871
|
+
agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
|
|
1872
|
+
agentConfig: unknown;
|
|
1873
|
+
contextSummary: string | null;
|
|
1874
|
+
mergedAt: Date | null;
|
|
1875
|
+
}[];
|
|
1876
|
+
};
|
|
1877
|
+
meta: object;
|
|
1878
|
+
}>;
|
|
1879
|
+
mergeBranch: import("@trpc/server").TRPCMutationProcedure<{
|
|
1880
|
+
input: {
|
|
1881
|
+
branchId: string;
|
|
1882
|
+
};
|
|
1883
|
+
output: {
|
|
1884
|
+
summary: string;
|
|
1885
|
+
};
|
|
1886
|
+
meta: object;
|
|
1887
|
+
}>;
|
|
1888
|
+
}>>;
|
|
1676
1889
|
proposals: import("@trpc/server").TRPCBuiltRouter<{
|
|
1677
1890
|
ctx: Context;
|
|
1678
1891
|
meta: object;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synap-core/api-types",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Type definitions for Synap API Router - tRPC types for frontend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -49,4 +49,4 @@
|
|
|
49
49
|
"router"
|
|
50
50
|
],
|
|
51
51
|
"license": "MIT"
|
|
52
|
-
}
|
|
52
|
+
}
|
package/src/generated.d.ts
CHANGED
|
@@ -115,73 +115,6 @@ export interface EventRecord {
|
|
|
115
115
|
correlationId?: string;
|
|
116
116
|
source: string;
|
|
117
117
|
}
|
|
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
118
|
/**
|
|
186
119
|
* View Query Types
|
|
187
120
|
*
|
|
@@ -305,6 +238,127 @@ export interface StructuredViewConfig {
|
|
|
305
238
|
query: EntityQuery;
|
|
306
239
|
render?: RenderSettings;
|
|
307
240
|
}
|
|
241
|
+
declare enum AgentType {
|
|
242
|
+
DEFAULT = "default",
|
|
243
|
+
META = "meta",
|
|
244
|
+
PROMPTING = "prompting",
|
|
245
|
+
KNOWLEDGE_SEARCH = "knowledge-search",
|
|
246
|
+
CODE = "code",
|
|
247
|
+
WRITING = "writing",
|
|
248
|
+
ACTION = "action"
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Agent type as string literal union (for flexibility)
|
|
252
|
+
*/
|
|
253
|
+
export type AgentTypeString = `${AgentType}` | (string & {});
|
|
254
|
+
declare enum AIStepType {
|
|
255
|
+
THINKING = "thinking",
|
|
256
|
+
TOOL_CALL = "tool_call",
|
|
257
|
+
TOOL_RESULT = "tool_result",
|
|
258
|
+
DECISION = "decision",
|
|
259
|
+
ERROR = "error"
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* AI step - shows what the AI is doing
|
|
263
|
+
*
|
|
264
|
+
* Represents any step in the AI's reasoning/execution process:
|
|
265
|
+
* - thinking: General analysis and reasoning
|
|
266
|
+
* - tool_call: When AI calls a tool
|
|
267
|
+
* - tool_result: Result from tool execution
|
|
268
|
+
* - decision: AI making a decision
|
|
269
|
+
* - error: Error during processing
|
|
270
|
+
*/
|
|
271
|
+
export interface AIStep {
|
|
272
|
+
id: string;
|
|
273
|
+
type: AIStepType | string;
|
|
274
|
+
content: string;
|
|
275
|
+
toolName?: string;
|
|
276
|
+
toolInput?: unknown;
|
|
277
|
+
toolOutput?: unknown;
|
|
278
|
+
timestamp: string;
|
|
279
|
+
duration?: number;
|
|
280
|
+
error?: string;
|
|
281
|
+
title?: string;
|
|
282
|
+
description?: string;
|
|
283
|
+
status?: "pending" | "running" | "complete" | "error";
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Branch decision from meta-agent
|
|
287
|
+
*/
|
|
288
|
+
export interface BranchDecision {
|
|
289
|
+
shouldBranch: boolean;
|
|
290
|
+
reason: string;
|
|
291
|
+
suggestedAgentType?: AgentTypeString;
|
|
292
|
+
suggestedTitle?: string;
|
|
293
|
+
suggestedPurpose?: string;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @synap/events - Schema-Driven Event Generator
|
|
297
|
+
*
|
|
298
|
+
* This module generates event types and payload schemas from Drizzle database tables.
|
|
299
|
+
*
|
|
300
|
+
* V2.0 CONSOLIDATED PATTERN: {table}.{action}.{modifier}
|
|
301
|
+
*
|
|
302
|
+
* Actions: create | update | delete
|
|
303
|
+
* Modifiers: requested | validated
|
|
304
|
+
*
|
|
305
|
+
* Examples:
|
|
306
|
+
* entities.create.requested ← Intent submitted (by user or AI)
|
|
307
|
+
* entities.create.validated ← Change confirmed and applied
|
|
308
|
+
* entities.update.requested ← Update intent
|
|
309
|
+
* entities.update.validated ← Update confirmed
|
|
310
|
+
*
|
|
311
|
+
* No direct actions (e.g., entities.create) - all changes go through requested→validated flow.
|
|
312
|
+
*/
|
|
313
|
+
/**
|
|
314
|
+
* Standard CRUD actions with modifiers for table events
|
|
315
|
+
*
|
|
316
|
+
* V2.1: Added 'approved' modifier for 3-phase flow
|
|
317
|
+
*
|
|
318
|
+
* Flow:
|
|
319
|
+
* 1. requested: Intent (user/AI wants to do something)
|
|
320
|
+
* 2. approved: Validated (permissions checked, user approved if needed)
|
|
321
|
+
* 3. validated: Completed (DB operation done, entity exists)
|
|
322
|
+
*/
|
|
323
|
+
export type TableAction = "create.requested" | "create.approved" | "create.validated" | "update.requested" | "update.approved" | "update.validated" | "delete.requested" | "delete.approved" | "delete.validated";
|
|
324
|
+
declare const CORE_TABLES: readonly [
|
|
325
|
+
"entities",
|
|
326
|
+
"documents",
|
|
327
|
+
"documentVersions",
|
|
328
|
+
"chatThreads",
|
|
329
|
+
"conversationMessages",
|
|
330
|
+
"webhookSubscriptions",
|
|
331
|
+
"apiKeys",
|
|
332
|
+
"tags",
|
|
333
|
+
"agents",
|
|
334
|
+
"workspaces",
|
|
335
|
+
"workspaceMembers",
|
|
336
|
+
"views",
|
|
337
|
+
"userPreferences"
|
|
338
|
+
];
|
|
339
|
+
export type CoreTable = (typeof CORE_TABLES)[number];
|
|
340
|
+
/**
|
|
341
|
+
* Flat list of all generated event types (for type checking)
|
|
342
|
+
*
|
|
343
|
+
* V2.1: Added .approved phase for 3-phase flow
|
|
344
|
+
*/
|
|
345
|
+
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`;
|
|
346
|
+
/**
|
|
347
|
+
* Worker Registry - Static worker metadata for Admin UI
|
|
348
|
+
*
|
|
349
|
+
* V2.0: Simplified registry with only active workers
|
|
350
|
+
*
|
|
351
|
+
* Pattern: Table workers handle {table}.{crud}.requested events
|
|
352
|
+
* and emit {table}.{crud}.completed events.
|
|
353
|
+
*/
|
|
354
|
+
export interface WorkerMetadata {
|
|
355
|
+
id: string;
|
|
356
|
+
name: string;
|
|
357
|
+
description: string;
|
|
358
|
+
triggers: string[];
|
|
359
|
+
outputs?: string[];
|
|
360
|
+
category: "table" | "shared" | "ai";
|
|
361
|
+
}
|
|
308
362
|
/**
|
|
309
363
|
* Core API Router
|
|
310
364
|
*/
|
|
@@ -392,7 +446,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
392
446
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
393
447
|
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
394
448
|
input: {
|
|
395
|
-
type: "project" | "task" | "contact" | "meeting" | "idea" | "note";
|
|
449
|
+
type: "event" | "file" | "project" | "task" | "contact" | "meeting" | "idea" | "note" | "person" | "code" | "bookmark" | "company";
|
|
396
450
|
title?: string | undefined;
|
|
397
451
|
description?: string | undefined;
|
|
398
452
|
workspaceId?: string | undefined;
|
|
@@ -709,7 +763,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
709
763
|
}>;
|
|
710
764
|
list: import("@trpc/server").TRPCQueryProcedure<{
|
|
711
765
|
input: {
|
|
712
|
-
type?: "project" | "task" | "contact" | "meeting" | "idea" | "note" | undefined;
|
|
766
|
+
type?: "event" | "file" | "project" | "task" | "contact" | "meeting" | "idea" | "note" | "person" | "code" | "bookmark" | "company" | undefined;
|
|
713
767
|
workspaceId?: string | undefined;
|
|
714
768
|
limit?: number | undefined;
|
|
715
769
|
};
|
|
@@ -1022,7 +1076,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1022
1076
|
search: import("@trpc/server").TRPCQueryProcedure<{
|
|
1023
1077
|
input: {
|
|
1024
1078
|
query: string;
|
|
1025
|
-
type?: "project" | "task" | "contact" | "meeting" | "idea" | "note" | undefined;
|
|
1079
|
+
type?: "event" | "file" | "project" | "task" | "contact" | "meeting" | "idea" | "note" | "person" | "code" | "bookmark" | "company" | undefined;
|
|
1026
1080
|
limit?: number | undefined;
|
|
1027
1081
|
};
|
|
1028
1082
|
output: {
|
|
@@ -1672,7 +1726,166 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1672
1726
|
meta: object;
|
|
1673
1727
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
1674
1728
|
transformer: true;
|
|
1675
|
-
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<
|
|
1729
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
1730
|
+
createThread: import("@trpc/server").TRPCMutationProcedure<{
|
|
1731
|
+
input: {
|
|
1732
|
+
projectId?: string | undefined;
|
|
1733
|
+
parentThreadId?: string | undefined;
|
|
1734
|
+
branchPurpose?: string | undefined;
|
|
1735
|
+
agentId?: string | undefined;
|
|
1736
|
+
agentType?: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action" | undefined;
|
|
1737
|
+
agentConfig?: Record<string, any> | undefined;
|
|
1738
|
+
};
|
|
1739
|
+
output: {
|
|
1740
|
+
threadId: `${string}-${string}-${string}-${string}-${string}`;
|
|
1741
|
+
thread: {
|
|
1742
|
+
userId: string;
|
|
1743
|
+
id: string;
|
|
1744
|
+
status: "archived" | "active" | "merged";
|
|
1745
|
+
createdAt: Date;
|
|
1746
|
+
updatedAt: Date;
|
|
1747
|
+
metadata: unknown;
|
|
1748
|
+
title: string | null;
|
|
1749
|
+
projectId: string | null;
|
|
1750
|
+
threadType: "main" | "branch";
|
|
1751
|
+
parentThreadId: string | null;
|
|
1752
|
+
branchedFromMessageId: string | null;
|
|
1753
|
+
branchPurpose: string | null;
|
|
1754
|
+
agentId: string;
|
|
1755
|
+
agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
|
|
1756
|
+
agentConfig: unknown;
|
|
1757
|
+
contextSummary: string | null;
|
|
1758
|
+
mergedAt: Date | null;
|
|
1759
|
+
};
|
|
1760
|
+
};
|
|
1761
|
+
meta: object;
|
|
1762
|
+
}>;
|
|
1763
|
+
sendMessage: import("@trpc/server").TRPCMutationProcedure<{
|
|
1764
|
+
input: {
|
|
1765
|
+
threadId: string;
|
|
1766
|
+
content: string;
|
|
1767
|
+
};
|
|
1768
|
+
output: {
|
|
1769
|
+
messageId: `${string}-${string}-${string}-${string}-${string}`;
|
|
1770
|
+
content: string;
|
|
1771
|
+
entities: {
|
|
1772
|
+
type: string;
|
|
1773
|
+
title: string;
|
|
1774
|
+
status: string;
|
|
1775
|
+
}[];
|
|
1776
|
+
branchDecision: BranchDecision | undefined;
|
|
1777
|
+
branchThread: {
|
|
1778
|
+
userId: string;
|
|
1779
|
+
id: string;
|
|
1780
|
+
status: "archived" | "active" | "merged";
|
|
1781
|
+
createdAt: Date;
|
|
1782
|
+
updatedAt: Date;
|
|
1783
|
+
metadata: unknown;
|
|
1784
|
+
title: string | null;
|
|
1785
|
+
projectId: string | null;
|
|
1786
|
+
threadType: "main" | "branch";
|
|
1787
|
+
parentThreadId: string | null;
|
|
1788
|
+
branchedFromMessageId: string | null;
|
|
1789
|
+
branchPurpose: string | null;
|
|
1790
|
+
agentId: string;
|
|
1791
|
+
agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
|
|
1792
|
+
agentConfig: unknown;
|
|
1793
|
+
contextSummary: string | null;
|
|
1794
|
+
mergedAt: Date | null;
|
|
1795
|
+
} | undefined;
|
|
1796
|
+
aiSteps: AIStep[];
|
|
1797
|
+
};
|
|
1798
|
+
meta: object;
|
|
1799
|
+
}>;
|
|
1800
|
+
getMessages: import("@trpc/server").TRPCQueryProcedure<{
|
|
1801
|
+
input: {
|
|
1802
|
+
threadId: string;
|
|
1803
|
+
limit?: number | undefined;
|
|
1804
|
+
};
|
|
1805
|
+
output: {
|
|
1806
|
+
messages: {
|
|
1807
|
+
userId: string;
|
|
1808
|
+
id: string;
|
|
1809
|
+
metadata: any;
|
|
1810
|
+
timestamp: Date;
|
|
1811
|
+
content: string;
|
|
1812
|
+
role: "user" | "system" | "assistant";
|
|
1813
|
+
deletedAt: Date | null;
|
|
1814
|
+
threadId: string;
|
|
1815
|
+
parentId: string | null;
|
|
1816
|
+
previousHash: string | null;
|
|
1817
|
+
hash: string;
|
|
1818
|
+
}[];
|
|
1819
|
+
hasMore: boolean;
|
|
1820
|
+
};
|
|
1821
|
+
meta: object;
|
|
1822
|
+
}>;
|
|
1823
|
+
listThreads: import("@trpc/server").TRPCQueryProcedure<{
|
|
1824
|
+
input: {
|
|
1825
|
+
projectId?: string | undefined;
|
|
1826
|
+
threadType?: "main" | "branch" | undefined;
|
|
1827
|
+
limit?: number | undefined;
|
|
1828
|
+
};
|
|
1829
|
+
output: {
|
|
1830
|
+
threads: {
|
|
1831
|
+
userId: string;
|
|
1832
|
+
id: string;
|
|
1833
|
+
status: "archived" | "active" | "merged";
|
|
1834
|
+
createdAt: Date;
|
|
1835
|
+
updatedAt: Date;
|
|
1836
|
+
metadata: unknown;
|
|
1837
|
+
title: string | null;
|
|
1838
|
+
projectId: string | null;
|
|
1839
|
+
threadType: "main" | "branch";
|
|
1840
|
+
parentThreadId: string | null;
|
|
1841
|
+
branchedFromMessageId: string | null;
|
|
1842
|
+
branchPurpose: string | null;
|
|
1843
|
+
agentId: string;
|
|
1844
|
+
agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
|
|
1845
|
+
agentConfig: unknown;
|
|
1846
|
+
contextSummary: string | null;
|
|
1847
|
+
mergedAt: Date | null;
|
|
1848
|
+
}[];
|
|
1849
|
+
};
|
|
1850
|
+
meta: object;
|
|
1851
|
+
}>;
|
|
1852
|
+
getBranches: import("@trpc/server").TRPCQueryProcedure<{
|
|
1853
|
+
input: {
|
|
1854
|
+
parentThreadId: string;
|
|
1855
|
+
};
|
|
1856
|
+
output: {
|
|
1857
|
+
branches: {
|
|
1858
|
+
userId: string;
|
|
1859
|
+
id: string;
|
|
1860
|
+
status: "archived" | "active" | "merged";
|
|
1861
|
+
createdAt: Date;
|
|
1862
|
+
updatedAt: Date;
|
|
1863
|
+
metadata: unknown;
|
|
1864
|
+
title: string | null;
|
|
1865
|
+
projectId: string | null;
|
|
1866
|
+
threadType: "main" | "branch";
|
|
1867
|
+
parentThreadId: string | null;
|
|
1868
|
+
branchedFromMessageId: string | null;
|
|
1869
|
+
branchPurpose: string | null;
|
|
1870
|
+
agentId: string;
|
|
1871
|
+
agentType: "meta" | "default" | "code" | "prompting" | "knowledge-search" | "writing" | "action";
|
|
1872
|
+
agentConfig: unknown;
|
|
1873
|
+
contextSummary: string | null;
|
|
1874
|
+
mergedAt: Date | null;
|
|
1875
|
+
}[];
|
|
1876
|
+
};
|
|
1877
|
+
meta: object;
|
|
1878
|
+
}>;
|
|
1879
|
+
mergeBranch: import("@trpc/server").TRPCMutationProcedure<{
|
|
1880
|
+
input: {
|
|
1881
|
+
branchId: string;
|
|
1882
|
+
};
|
|
1883
|
+
output: {
|
|
1884
|
+
summary: string;
|
|
1885
|
+
};
|
|
1886
|
+
meta: object;
|
|
1887
|
+
}>;
|
|
1888
|
+
}>>;
|
|
1676
1889
|
proposals: import("@trpc/server").TRPCBuiltRouter<{
|
|
1677
1890
|
ctx: Context;
|
|
1678
1891
|
meta: object;
|