@synap-core/types 0.3.2 → 0.4.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.
File without changes
@@ -42,6 +42,46 @@ var ENTITY_SCHEMAS = {
42
42
  extension: z.string(),
43
43
  thumbnailUrl: z.string().url().optional(),
44
44
  downloadUrl: z.string().url().optional()
45
+ }),
46
+ // NEW: Company/Organization entity
47
+ company: z.object({
48
+ website: z.string().url().optional(),
49
+ industry: z.string().optional(),
50
+ size: z.enum(["startup", "small", "medium", "large", "enterprise"]).optional(),
51
+ location: z.string().optional(),
52
+ linkedInUrl: z.string().url().optional(),
53
+ description: z.string().optional(),
54
+ foundedYear: z.number().int().optional(),
55
+ // Linked employee person entities
56
+ employees: z.array(z.string().uuid()).default([])
57
+ }),
58
+ // NEW: Bookmark/Web clip entity
59
+ bookmark: z.object({
60
+ url: z.string().url(),
61
+ favicon: z.string().url().optional(),
62
+ excerpt: z.string().optional(),
63
+ siteName: z.string().optional(),
64
+ author: z.string().optional(),
65
+ publishedDate: z.string().datetime().optional(),
66
+ tags: z.array(z.string()).default([]),
67
+ // For local archiving
68
+ archiveUrl: z.string().url().optional(),
69
+ isRead: z.boolean().default(false)
70
+ }),
71
+ // NEW: Code snippet entity
72
+ code: z.object({
73
+ language: z.string(),
74
+ // 'typescript', 'python', 'rust', etc.
75
+ runtime: z.string().optional(),
76
+ // 'node', 'browser', 'python3', etc.
77
+ framework: z.string().optional(),
78
+ // 'react', 'express', 'django', etc.
79
+ dependencies: z.array(z.string()).default([]),
80
+ isExecutable: z.boolean().default(false),
81
+ sourceUrl: z.string().url().optional(),
82
+ // GitHub gist, CodeSandbox, etc.
83
+ version: z.string().optional()
84
+ // Code version/revision
45
85
  })
46
86
  };
47
87
  function validateEntityMetadata(type, metadata) {
@@ -1,14 +1,64 @@
1
- import { Document } from '@synap/database/schema';
2
- export { Document, DocumentSession, DocumentVersion, NewDocument, NewDocumentSession, NewDocumentVersion } from '@synap/database/schema';
3
-
4
1
  /**
5
2
  * Document Types
6
3
  *
7
- * Re-exports document types from database schema (single source of truth).
8
- *
9
- * @see {@link file:///.../packages/database/src/schema/documents.ts}
4
+ * Standalone type definitions for documents.
5
+ * Compatible with @synap/database schema but works independently.
6
+ */
7
+ /**
8
+ * Document - Rich text document with version history
9
+ */
10
+ interface Document {
11
+ id: string;
12
+ userId: string;
13
+ title: string | null;
14
+ type: 'note' | 'whiteboard' | 'canvas' | 'code' | 'other';
15
+ content?: string;
16
+ yjsState?: Uint8Array;
17
+ contentFormat: 'markdown' | 'prosemirror' | 'tiptap' | 'yjs' | 'raw';
18
+ version: number;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ deletedAt?: Date;
22
+ }
23
+ /**
24
+ * NewDocument - For creating a new document
25
+ */
26
+ type NewDocument = Omit<Document, 'id' | 'version' | 'createdAt' | 'updatedAt' | 'deletedAt'>;
27
+ /**
28
+ * UpdateDocument - For updating a document
10
29
  */
11
-
12
30
  type UpdateDocument = Partial<Omit<Document, 'id' | 'userId' | 'createdAt' | 'updatedAt'>>;
31
+ /**
32
+ * DocumentVersion - Version history entry
33
+ */
34
+ interface DocumentVersion {
35
+ id: string;
36
+ documentId: string;
37
+ userId: string;
38
+ version: number;
39
+ content?: string;
40
+ yjsState?: Uint8Array;
41
+ message?: string;
42
+ createdAt: Date;
43
+ }
44
+ /**
45
+ * NewDocumentVersion - For creating a version
46
+ */
47
+ type NewDocumentVersion = Omit<DocumentVersion, 'id' | 'createdAt'>;
48
+ /**
49
+ * DocumentSession - Collaboration session
50
+ */
51
+ interface DocumentSession {
52
+ id: string;
53
+ documentId: string;
54
+ userId: string;
55
+ cursorPosition?: string;
56
+ lastActivity: Date;
57
+ createdAt: Date;
58
+ }
59
+ /**
60
+ * NewDocumentSession - For creating a session
61
+ */
62
+ type NewDocumentSession = Omit<DocumentSession, 'id' | 'createdAt' | 'lastActivity'>;
13
63
 
14
- export type { UpdateDocument };
64
+ export type { Document, DocumentSession, DocumentVersion, NewDocument, NewDocumentSession, NewDocumentVersion, UpdateDocument };
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- export { Entity as DBEntity, NewEntity as NewEntityDB } from '@synap/database/schema';
3
2
 
4
3
  /**
5
4
  * Entity Metadata Schemas
@@ -129,6 +128,90 @@ declare const ENTITY_SCHEMAS: {
129
128
  thumbnailUrl?: string | undefined;
130
129
  downloadUrl?: string | undefined;
131
130
  }>;
131
+ readonly company: z.ZodObject<{
132
+ website: z.ZodOptional<z.ZodString>;
133
+ industry: z.ZodOptional<z.ZodString>;
134
+ size: z.ZodOptional<z.ZodEnum<["startup", "small", "medium", "large", "enterprise"]>>;
135
+ location: z.ZodOptional<z.ZodString>;
136
+ linkedInUrl: z.ZodOptional<z.ZodString>;
137
+ description: z.ZodOptional<z.ZodString>;
138
+ foundedYear: z.ZodOptional<z.ZodNumber>;
139
+ employees: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
140
+ }, "strip", z.ZodTypeAny, {
141
+ employees: string[];
142
+ linkedInUrl?: string | undefined;
143
+ location?: string | undefined;
144
+ website?: string | undefined;
145
+ industry?: string | undefined;
146
+ size?: "medium" | "startup" | "small" | "large" | "enterprise" | undefined;
147
+ description?: string | undefined;
148
+ foundedYear?: number | undefined;
149
+ }, {
150
+ linkedInUrl?: string | undefined;
151
+ location?: string | undefined;
152
+ website?: string | undefined;
153
+ industry?: string | undefined;
154
+ size?: "medium" | "startup" | "small" | "large" | "enterprise" | undefined;
155
+ description?: string | undefined;
156
+ foundedYear?: number | undefined;
157
+ employees?: string[] | undefined;
158
+ }>;
159
+ readonly bookmark: z.ZodObject<{
160
+ url: z.ZodString;
161
+ favicon: z.ZodOptional<z.ZodString>;
162
+ excerpt: z.ZodOptional<z.ZodString>;
163
+ siteName: z.ZodOptional<z.ZodString>;
164
+ author: z.ZodOptional<z.ZodString>;
165
+ publishedDate: z.ZodOptional<z.ZodString>;
166
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
167
+ archiveUrl: z.ZodOptional<z.ZodString>;
168
+ isRead: z.ZodDefault<z.ZodBoolean>;
169
+ }, "strip", z.ZodTypeAny, {
170
+ tags: string[];
171
+ url: string;
172
+ isRead: boolean;
173
+ favicon?: string | undefined;
174
+ excerpt?: string | undefined;
175
+ siteName?: string | undefined;
176
+ author?: string | undefined;
177
+ publishedDate?: string | undefined;
178
+ archiveUrl?: string | undefined;
179
+ }, {
180
+ url: string;
181
+ tags?: string[] | undefined;
182
+ favicon?: string | undefined;
183
+ excerpt?: string | undefined;
184
+ siteName?: string | undefined;
185
+ author?: string | undefined;
186
+ publishedDate?: string | undefined;
187
+ archiveUrl?: string | undefined;
188
+ isRead?: boolean | undefined;
189
+ }>;
190
+ readonly code: z.ZodObject<{
191
+ language: z.ZodString;
192
+ runtime: z.ZodOptional<z.ZodString>;
193
+ framework: z.ZodOptional<z.ZodString>;
194
+ dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
195
+ isExecutable: z.ZodDefault<z.ZodBoolean>;
196
+ sourceUrl: z.ZodOptional<z.ZodString>;
197
+ version: z.ZodOptional<z.ZodString>;
198
+ }, "strip", z.ZodTypeAny, {
199
+ language: string;
200
+ dependencies: string[];
201
+ isExecutable: boolean;
202
+ runtime?: string | undefined;
203
+ framework?: string | undefined;
204
+ sourceUrl?: string | undefined;
205
+ version?: string | undefined;
206
+ }, {
207
+ language: string;
208
+ runtime?: string | undefined;
209
+ framework?: string | undefined;
210
+ dependencies?: string[] | undefined;
211
+ isExecutable?: boolean | undefined;
212
+ sourceUrl?: string | undefined;
213
+ version?: string | undefined;
214
+ }>;
132
215
  };
133
216
  /**
134
217
  * Entity type enum - auto-generated from schema keys
@@ -220,14 +303,67 @@ declare function safeValidateEntityMetadata<T extends EntityType>(type: T, metad
220
303
  extension: string;
221
304
  thumbnailUrl?: string | undefined;
222
305
  downloadUrl?: string | undefined;
306
+ }> | z.SafeParseReturnType<{
307
+ linkedInUrl?: string | undefined;
308
+ location?: string | undefined;
309
+ website?: string | undefined;
310
+ industry?: string | undefined;
311
+ size?: "medium" | "startup" | "small" | "large" | "enterprise" | undefined;
312
+ description?: string | undefined;
313
+ foundedYear?: number | undefined;
314
+ employees?: string[] | undefined;
315
+ }, {
316
+ employees: string[];
317
+ linkedInUrl?: string | undefined;
318
+ location?: string | undefined;
319
+ website?: string | undefined;
320
+ industry?: string | undefined;
321
+ size?: "medium" | "startup" | "small" | "large" | "enterprise" | undefined;
322
+ description?: string | undefined;
323
+ foundedYear?: number | undefined;
324
+ }> | z.SafeParseReturnType<{
325
+ url: string;
326
+ tags?: string[] | undefined;
327
+ favicon?: string | undefined;
328
+ excerpt?: string | undefined;
329
+ siteName?: string | undefined;
330
+ author?: string | undefined;
331
+ publishedDate?: string | undefined;
332
+ archiveUrl?: string | undefined;
333
+ isRead?: boolean | undefined;
334
+ }, {
335
+ tags: string[];
336
+ url: string;
337
+ isRead: boolean;
338
+ favicon?: string | undefined;
339
+ excerpt?: string | undefined;
340
+ siteName?: string | undefined;
341
+ author?: string | undefined;
342
+ publishedDate?: string | undefined;
343
+ archiveUrl?: string | undefined;
344
+ }> | z.SafeParseReturnType<{
345
+ language: string;
346
+ runtime?: string | undefined;
347
+ framework?: string | undefined;
348
+ dependencies?: string[] | undefined;
349
+ isExecutable?: boolean | undefined;
350
+ sourceUrl?: string | undefined;
351
+ version?: string | undefined;
352
+ }, {
353
+ language: string;
354
+ dependencies: string[];
355
+ isExecutable: boolean;
356
+ runtime?: string | undefined;
357
+ framework?: string | undefined;
358
+ sourceUrl?: string | undefined;
359
+ version?: string | undefined;
223
360
  }>;
224
361
 
225
362
  /**
226
363
  * Entity Types
227
364
  *
228
- * Re-exports base entity types from database and adds discriminated unions.
229
- *
230
- * @see {@link file:///.../packages/database/src/schema/entities.ts}
365
+ * Standalone entity type definitions with discriminated unions.
366
+ * Works independently without @synap/database.
231
367
  */
232
368
 
233
369
  /**
@@ -8,7 +8,7 @@ import {
8
8
  isTask,
9
9
  safeValidateEntityMetadata,
10
10
  validateEntityMetadata
11
- } from "../chunk-OPLFDITK.js";
11
+ } from "../chunk-RIUK6OEK.js";
12
12
  export {
13
13
  ENTITY_SCHEMAS,
14
14
  isEntityOfType,
@@ -1,12 +1,10 @@
1
1
  import { z } from 'zod';
2
- export { InboxItem as DBInboxItem, NewInboxItem } from '@synap/database/schema';
3
2
 
4
3
  /**
5
4
  * Inbox Item Schemas & Types
6
5
  *
7
- * Re-exports inbox types from database and adds provider-specific schemas.
8
- *
9
- * @see {@link file:///.../packages/database/src/schema/inbox-items.ts}
6
+ * Standalone inbox type definitions.
7
+ * Works independently without @synap/database.
10
8
  */
11
9
 
12
10
  /**
@@ -88,8 +86,8 @@ declare const INBOX_SCHEMAS: {
88
86
  count: number;
89
87
  }>, "many">>;
90
88
  }, "strip", z.ZodTypeAny, {
91
- channel: string;
92
89
  user: string;
90
+ channel: string;
93
91
  text: string;
94
92
  threadTs?: string | undefined;
95
93
  reactions?: {
@@ -97,8 +95,8 @@ declare const INBOX_SCHEMAS: {
97
95
  count: number;
98
96
  }[] | undefined;
99
97
  }, {
100
- channel: string;
101
98
  user: string;
99
+ channel: string;
102
100
  text: string;
103
101
  threadTs?: string | undefined;
104
102
  reactions?: {
@@ -142,6 +140,10 @@ type InboxItem = {
142
140
  data: InboxItemData[K];
143
141
  };
144
142
  }[InboxItemType];
143
+ /**
144
+ * NewInboxItem - For creating new inbox items
145
+ */
146
+ type NewInboxItem = Omit<InboxItem, 'id' | 'createdAt' | 'updatedAt'>;
145
147
  /**
146
148
  * Specific inbox item types
147
149
  */
@@ -161,4 +163,4 @@ declare function isEmailInboxItem(item: InboxItem): item is EmailInboxItem;
161
163
  declare function isCalendarInboxItem(item: InboxItem): item is CalendarInboxItem;
162
164
  declare function isSlackInboxItem(item: InboxItem): item is SlackInboxItem;
163
165
 
164
- export { type CalendarInboxItem, type EmailInboxItem, INBOX_SCHEMAS, type InboxItem, type InboxItemType, type SlackInboxItem, isCalendarInboxItem, isEmailInboxItem, isSlackInboxItem };
166
+ export { type CalendarInboxItem, type EmailInboxItem, INBOX_SCHEMAS, type InboxItem, type InboxItemType, type NewInboxItem, type SlackInboxItem, isCalendarInboxItem, isEmailInboxItem, isSlackInboxItem };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  export { BaseEntity, ENTITY_SCHEMAS, Entity, EntityMetadata, EntityType, Event, File, NewEntity, Note, Person, Task, UpdateEntity, isEntityOfType, isEvent, isFile, isNote, isPerson, isTask, safeValidateEntityMetadata, validateEntityMetadata } from './entities/index.js';
2
- export { UpdateDocument } from './documents/index.js';
3
- export { Entity as DBEntity, InboxItem as DBInboxItem, Document, DocumentSession, DocumentVersion, EntityEnrichment, EntityRelationship, NewDocument, NewDocumentSession, NewDocumentVersion, NewEntity as NewEntityDB, NewEntityEnrichment, NewEntityRelationship, NewInboxItem, NewReasoningTrace, NewUserEntityState, NewUserPreference as NewUserPreferences, NewView, NewWorkspace, NewWorkspaceInvite, NewWorkspaceMember, ReasoningTrace, UserEntityState, UserPreference as UserPreferences, View, Workspace, WorkspaceInvite, WorkspaceMember } from '@synap/database/schema';
4
- export { CalendarInboxItem, EmailInboxItem, INBOX_SCHEMAS, InboxItem, InboxItemType, SlackInboxItem, isCalendarInboxItem, isEmailInboxItem, isSlackInboxItem } from './inbox/index.js';
5
- export { CreateWorkspaceInput, InviteMemberInput, UpdateWorkspaceInput, WorkspaceRole, WorkspaceType } from './workspaces/index.js';
6
- export { CreateViewInput, SaveViewInput, UpdateViewInput, ViewType } from './views/index.js';
7
- export { Theme, UpdatePreferencesInput } from './preferences/index.js';
2
+ export { Document, DocumentSession, DocumentVersion, NewDocument, NewDocumentSession, NewDocumentVersion, UpdateDocument } from './documents/index.js';
3
+ export { EntityEnrichment, EntityRelationship, NewEntityEnrichment, NewEntityRelationship, NewReasoningTrace, NewUserEntityState, ReasoningTrace, UserEntityState } from './users/index.js';
4
+ export { CalendarInboxItem, EmailInboxItem, INBOX_SCHEMAS, InboxItem, InboxItemType, NewInboxItem, SlackInboxItem, isCalendarInboxItem, isEmailInboxItem, isSlackInboxItem } from './inbox/index.js';
5
+ export { CreateWorkspaceInput, InviteMemberInput, NewWorkspace, NewWorkspaceInvite, NewWorkspaceMember, UpdateWorkspaceInput, Workspace, WorkspaceInvite, WorkspaceMember, WorkspaceRole, WorkspaceType } from './workspaces/index.js';
6
+ export { CalendarConfig, ColumnDefinition, CreateViewInput, FilterRule, GanttConfig, GridConfig, KanbanConfig, ListConfig, NewView, SaveViewInput, SortRule, SwitchViewLayoutInput, TableViewConfig, UpdateViewInput, View, ViewType } from './views/index.js';
7
+ export { CreateRelationInput, NewRelation, Relation, RelationType, RelationWithEntities } from './relations/index.js';
8
+ export { NewUserPreferences, Theme, UpdatePreferencesInput, UserPreferences } from './preferences/index.js';
8
9
  export { CollaborationEvent, CursorUpdate, PresenceInit, PresenceStatus, UserJoinedEvent, UserLeftEvent, UserPresence } from './realtime/index.js';
9
10
  export { AIProposalEvent, AIProposalStatusEvent, ChatMessageEvent, ChatStreamEvent, DocumentUpdatedEvent, DocumentVersionCreatedEvent, DomainClientToServerEvents, DomainEventName, DomainEventNames, DomainServerToClientEvents, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent } from './events/index.js';
10
11
  export { Array as YArray, Doc as YDoc, Map as YMap, Text as YText } from 'yjs';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-QAWJ6GM3.js";
1
2
  import "./chunk-ZTGPGYVX.js";
2
3
  import "./chunk-IZA3UKBT.js";
3
4
  import "./chunk-7LKCNZXD.js";
@@ -11,19 +12,19 @@ import {
11
12
  isTask,
12
13
  safeValidateEntityMetadata,
13
14
  validateEntityMetadata
14
- } from "./chunk-OPLFDITK.js";
15
- import {
16
- DomainEventNames
17
- } from "./chunk-6OHYLFUB.js";
15
+ } from "./chunk-RIUK6OEK.js";
18
16
  import {
19
17
  INBOX_SCHEMAS,
20
18
  isCalendarInboxItem,
21
19
  isEmailInboxItem,
22
20
  isSlackInboxItem
23
21
  } from "./chunk-ZFFMXKF2.js";
24
- import "./chunk-2BEUWD3P.js";
22
+ import {
23
+ DomainEventNames
24
+ } from "./chunk-6OHYLFUB.js";
25
25
  import "./chunk-X5L3VJJZ.js";
26
26
  import "./chunk-2N5ZC5EB.js";
27
+ import "./chunk-2BEUWD3P.js";
27
28
  export {
28
29
  DomainEventNames,
29
30
  ENTITY_SCHEMAS,
@@ -1,17 +1,25 @@
1
- import { UserPreference } from '@synap/database/schema';
2
- export { NewUserPreference as NewUserPreferences, UserPreference as UserPreferences } from '@synap/database/schema';
3
-
4
1
  /**
5
2
  * User Preferences Types
6
3
  *
7
- * Re-exports user preferences types from database schema (single source of truth).
8
- *
9
- * Note: Database exports `UserPreference` (singular), we alias to `UserPreferences` for API consistency.
10
- *
11
- * @see {@link file:///.../packages/database/src/schema/user-preferences.ts}
4
+ * Standalone type definitions for user preferences.
5
+ * Works independently without @synap/database.
12
6
  */
13
-
14
- type Theme = UserPreference['theme'];
7
+ type Theme = 'light' | 'dark' | 'system';
8
+ /**
9
+ * UserPreferences - User's app preferences
10
+ */
11
+ interface UserPreferences {
12
+ id: string;
13
+ userId: string;
14
+ theme: Theme;
15
+ uiPreferences?: Record<string, unknown>;
16
+ graphPreferences?: Record<string, unknown>;
17
+ onboardingCompleted: boolean;
18
+ onboardingStep?: string;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+ type NewUserPreferences = Omit<UserPreferences, 'id' | 'createdAt' | 'updatedAt'>;
15
23
  interface UpdatePreferencesInput {
16
24
  theme?: Theme;
17
25
  uiPreferences?: Record<string, unknown>;
@@ -20,4 +28,4 @@ interface UpdatePreferencesInput {
20
28
  onboardingStep?: string;
21
29
  }
22
30
 
23
- export type { Theme, UpdatePreferencesInput };
31
+ export type { NewUserPreferences, Theme, UpdatePreferencesInput, UserPreferences };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Relation Types
3
+ *
4
+ * Standalone type definitions for relations.
5
+ * Compatible with @synap/database schema but works independently.
6
+ */
7
+ type RelationType = 'related_to' | 'parent_of' | 'child_of' | 'blocks' | 'depends_on' | 'mentioned_in' | 'mentions' | 'linked_to' | 'assigned_to' | 'attended_by' | 'links_to';
8
+ /**
9
+ * Relation - Edge in the knowledge graph
10
+ */
11
+ interface Relation {
12
+ id: string;
13
+ userId: string;
14
+ sourceEntityId: string;
15
+ targetEntityId: string;
16
+ type: RelationType;
17
+ metadata?: Record<string, unknown>;
18
+ createdAt: Date;
19
+ updatedAt?: Date;
20
+ }
21
+ /**
22
+ * NewRelation - For creating a new relation
23
+ */
24
+ type NewRelation = Omit<Relation, 'id' | 'createdAt' | 'updatedAt'>;
25
+ interface CreateRelationInput {
26
+ sourceEntityId: string;
27
+ targetEntityId: string;
28
+ type: RelationType;
29
+ metadata?: Record<string, unknown>;
30
+ }
31
+ interface RelationWithEntities {
32
+ id: string;
33
+ sourceEntityId: string;
34
+ targetEntityId: string;
35
+ type: RelationType;
36
+ createdAt: Date;
37
+ sourceEntity?: {
38
+ id: string;
39
+ title: string | null;
40
+ type: string;
41
+ };
42
+ targetEntity?: {
43
+ id: string;
44
+ title: string | null;
45
+ type: string;
46
+ };
47
+ }
48
+
49
+ export type { CreateRelationInput, NewRelation, Relation, RelationType, RelationWithEntities };
@@ -0,0 +1 @@
1
+ import "../chunk-QAWJ6GM3.js";
@@ -1 +1,67 @@
1
- export { EntityEnrichment, EntityRelationship, NewEntityEnrichment, NewEntityRelationship, NewReasoningTrace, NewUserEntityState, ReasoningTrace, UserEntityState } from '@synap/database/schema';
1
+ /**
2
+ * User Types
3
+ *
4
+ * Standalone type definitions for user-related entities.
5
+ * Works independently without @synap/database.
6
+ */
7
+ /**
8
+ * UserEntityState - Tracks user-specific entity state
9
+ */
10
+ interface UserEntityState {
11
+ id: string;
12
+ userId: string;
13
+ entityId: string;
14
+ isFavorite: boolean;
15
+ isArchived: boolean;
16
+ lastViewedAt?: Date;
17
+ customTags?: string[];
18
+ notes?: string;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+ type NewUserEntityState = Omit<UserEntityState, 'id' | 'createdAt' | 'updatedAt'>;
23
+ /**
24
+ * EntityEnrichment - AI-generated entity enhancements
25
+ */
26
+ interface EntityEnrichment {
27
+ id: string;
28
+ entityId: string;
29
+ enrichmentType: 'summary' | 'keywords' | 'sentiment' | 'category' | 'suggestions';
30
+ content: Record<string, unknown>;
31
+ confidence: number;
32
+ source: 'ai' | 'user' | 'system';
33
+ createdAt: Date;
34
+ expiresAt?: Date;
35
+ }
36
+ type NewEntityEnrichment = Omit<EntityEnrichment, 'id' | 'createdAt'>;
37
+ /**
38
+ * EntityRelationship - User-defined relationships between entities
39
+ */
40
+ interface EntityRelationship {
41
+ id: string;
42
+ userId: string;
43
+ sourceEntityId: string;
44
+ targetEntityId: string;
45
+ relationshipType: string;
46
+ metadata?: Record<string, unknown>;
47
+ createdAt: Date;
48
+ }
49
+ type NewEntityRelationship = Omit<EntityRelationship, 'id' | 'createdAt'>;
50
+ /**
51
+ * ReasoningTrace - AI reasoning logs
52
+ */
53
+ interface ReasoningTrace {
54
+ id: string;
55
+ entityId?: string;
56
+ requestId: string;
57
+ step: number;
58
+ thought: string;
59
+ action?: string;
60
+ observation?: string;
61
+ model: string;
62
+ tokensUsed: number;
63
+ createdAt: Date;
64
+ }
65
+ type NewReasoningTrace = Omit<ReasoningTrace, 'id' | 'createdAt'>;
66
+
67
+ export type { EntityEnrichment, EntityRelationship, NewEntityEnrichment, NewEntityRelationship, NewReasoningTrace, NewUserEntityState, ReasoningTrace, UserEntityState };