@soulcraft/brainy 0.9.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.demo.md +59 -0
  3. package/README.md +1257 -0
  4. package/brainy.png +0 -0
  5. package/cli-wrapper.js +56 -0
  6. package/dist/augmentationFactory.d.ts +87 -0
  7. package/dist/augmentationPipeline.d.ts +205 -0
  8. package/dist/augmentationRegistry.d.ts +48 -0
  9. package/dist/augmentationRegistryLoader.d.ts +147 -0
  10. package/dist/augmentations/conduitAugmentations.d.ts +173 -0
  11. package/dist/augmentations/memoryAugmentations.d.ts +71 -0
  12. package/dist/augmentations/serverSearchAugmentations.d.ts +168 -0
  13. package/dist/brainy.js +116929 -0
  14. package/dist/brainy.min.js +16107 -0
  15. package/dist/brainyData.d.ts +507 -0
  16. package/dist/cli.d.ts +7 -0
  17. package/dist/coreTypes.d.ts +131 -0
  18. package/dist/examples/basicUsage.d.ts +5 -0
  19. package/dist/hnsw/hnswIndex.d.ts +96 -0
  20. package/dist/hnsw/hnswIndexOptimized.d.ts +167 -0
  21. package/dist/index.d.ts +49 -0
  22. package/dist/mcp/brainyMCPAdapter.d.ts +69 -0
  23. package/dist/mcp/brainyMCPService.d.ts +99 -0
  24. package/dist/mcp/index.d.ts +14 -0
  25. package/dist/mcp/mcpAugmentationToolset.d.ts +68 -0
  26. package/dist/pipeline.d.ts +281 -0
  27. package/dist/sequentialPipeline.d.ts +114 -0
  28. package/dist/storage/fileSystemStorage.d.ts +123 -0
  29. package/dist/storage/opfsStorage.d.ts +244 -0
  30. package/dist/storage/s3CompatibleStorage.d.ts +158 -0
  31. package/dist/types/augmentations.d.ts +324 -0
  32. package/dist/types/augmentations.d.ts.map +1 -0
  33. package/dist/types/brainyDataInterface.d.ts +51 -0
  34. package/dist/types/brainyDataInterface.d.ts.map +1 -0
  35. package/dist/types/fileSystemTypes.d.ts +6 -0
  36. package/dist/types/fileSystemTypes.d.ts.map +1 -0
  37. package/dist/types/graphTypes.d.ts +134 -0
  38. package/dist/types/graphTypes.d.ts.map +1 -0
  39. package/dist/types/mcpTypes.d.ts +140 -0
  40. package/dist/types/mcpTypes.d.ts.map +1 -0
  41. package/dist/types/pipelineTypes.d.ts +27 -0
  42. package/dist/types/pipelineTypes.d.ts.map +1 -0
  43. package/dist/types/tensorflowTypes.d.ts +7 -0
  44. package/dist/types/tensorflowTypes.d.ts.map +1 -0
  45. package/dist/unified.d.ts +12 -0
  46. package/dist/unified.js +117122 -0
  47. package/dist/unified.min.js +16107 -0
  48. package/dist/utils/distance.d.ts +32 -0
  49. package/dist/utils/embedding.d.ts +55 -0
  50. package/dist/utils/environment.d.ts +28 -0
  51. package/dist/utils/index.d.ts +3 -0
  52. package/dist/utils/version.d.ts +6 -0
  53. package/dist/utils/workerUtils.d.ts +28 -0
  54. package/package.json +156 -0
@@ -0,0 +1,324 @@
1
+ /** Common types for the augmentation system */
2
+ /**
3
+ * Enum representing all types of augmentations available in the Brainy system.
4
+ */
5
+ export declare enum AugmentationType {
6
+ SENSE = "sense",
7
+ CONDUIT = "conduit",
8
+ COGNITION = "cognition",
9
+ MEMORY = "memory",
10
+ PERCEPTION = "perception",
11
+ DIALOG = "dialog",
12
+ ACTIVATION = "activation",
13
+ WEBSOCKET = "webSocket"
14
+ }
15
+ export type WebSocketConnection = {
16
+ connectionId: string;
17
+ url: string;
18
+ status: 'connected' | 'disconnected' | 'error';
19
+ send?: (data: string | ArrayBufferLike | Blob | ArrayBufferView) => Promise<void>;
20
+ close?: () => Promise<void>;
21
+ _streamMessageHandler?: (event: {
22
+ data: unknown;
23
+ }) => void;
24
+ _messageHandlerWrapper?: (data: unknown) => void;
25
+ };
26
+ type DataCallback<T> = (data: T) => void;
27
+ export type AugmentationResponse<T> = {
28
+ success: boolean;
29
+ data: T;
30
+ error?: string;
31
+ };
32
+ /**
33
+ * Base interface for all Brainy augmentations.
34
+ * All augmentations must implement these core properties.
35
+ */
36
+ export interface IAugmentation {
37
+ /** A unique identifier for the augmentation (e.g., "my-reasoner-v1") */
38
+ readonly name: string;
39
+ /** A human-readable description of the augmentation's purpose */
40
+ readonly description: string;
41
+ /** Whether this augmentation is enabled */
42
+ enabled: boolean;
43
+ /**
44
+ * Initializes the augmentation. This method is called when Brainy starts up.
45
+ * @returns A Promise that resolves when initialization is complete
46
+ */
47
+ initialize(): Promise<void>;
48
+ shutDown(): Promise<void>;
49
+ getStatus(): Promise<'active' | 'inactive' | 'error'>;
50
+ [key: string]: any;
51
+ }
52
+ /**
53
+ * Interface for WebSocket support.
54
+ * Augmentations that implement this interface can communicate via WebSockets.
55
+ */
56
+ export interface IWebSocketSupport extends IAugmentation {
57
+ /**
58
+ * Establishes a WebSocket connection.
59
+ * @param url The WebSocket server URL to connect to
60
+ * @param protocols Optional subprotocols
61
+ * @returns A Promise resolving to a connection handle or status
62
+ */
63
+ connectWebSocket(url: string, protocols?: string | string[]): Promise<WebSocketConnection>;
64
+ /**
65
+ * Sends data through an established WebSocket connection.
66
+ * @param connectionId The identifier of the established connection
67
+ * @param data The data to send (will be serialized if not a string)
68
+ */
69
+ sendWebSocketMessage(connectionId: string, data: unknown): Promise<void>;
70
+ /**
71
+ * Registers a callback for incoming WebSocket messages.
72
+ * @param connectionId The identifier of the established connection
73
+ * @param callback The function to call when a message is received
74
+ */
75
+ onWebSocketMessage(connectionId: string, callback: DataCallback<unknown>): Promise<void>;
76
+ /**
77
+ * Removes a callback for incoming WebSocket messages.
78
+ * @param connectionId The identifier of the established connection
79
+ * @param callback The function to remove from the callbacks
80
+ */
81
+ offWebSocketMessage(connectionId: string, callback: DataCallback<unknown>): Promise<void>;
82
+ /**
83
+ * Closes an established WebSocket connection.
84
+ * @param connectionId The identifier of the established connection
85
+ * @param code Optional close code
86
+ * @param reason Optional close reason
87
+ */
88
+ closeWebSocket(connectionId: string, code?: number, reason?: string): Promise<void>;
89
+ }
90
+ export declare namespace BrainyAugmentations {
91
+ /**
92
+ * Interface for Senses augmentations.
93
+ * These augmentations ingest and process raw, unstructured data into nouns and verbs.
94
+ */
95
+ interface ISenseAugmentation extends IAugmentation {
96
+ /**
97
+ * Processes raw input data into structured nouns and verbs.
98
+ * @param rawData The raw, unstructured data (e.g., text, image buffer, audio stream)
99
+ * @param dataType The type of raw data (e.g., 'text', 'image', 'audio')
100
+ */
101
+ processRawData(rawData: Buffer | string, dataType: string): Promise<AugmentationResponse<{
102
+ nouns: string[];
103
+ verbs: string[];
104
+ }>>;
105
+ /**
106
+ * Registers a listener for real-time data feeds.
107
+ * @param feedUrl The URL or identifier of the real-time feed
108
+ * @param callback A function to call with processed data
109
+ */
110
+ listenToFeed(feedUrl: string, callback: DataCallback<{
111
+ nouns: string[];
112
+ verbs: string[];
113
+ }>): Promise<void>;
114
+ }
115
+ /**
116
+ * Interface for Conduits augmentations.
117
+ * These augmentations establish and manage high-bandwidth, dedicated channels for structured, programmatic two-way data exchange.
118
+ */
119
+ interface IConduitAugmentation extends IAugmentation {
120
+ /**
121
+ * Establishes a connection for programmatic data exchange.
122
+ * @param targetSystemId The identifier of the external system to connect to
123
+ * @param config Configuration details for the connection (e.g., API keys, endpoints)
124
+ */
125
+ establishConnection(targetSystemId: string, config: Record<string, unknown>): Promise<AugmentationResponse<WebSocketConnection>>;
126
+ /**
127
+ * Reads structured data directly from Brainy's knowledge graph.
128
+ * @param query A structured query (e.g., graph query language, object path)
129
+ * @param options Optional query options (e.g., depth, filters)
130
+ */
131
+ readData(query: Record<string, unknown>, options?: Record<string, unknown>): Promise<AugmentationResponse<unknown>>;
132
+ /**
133
+ * Writes or updates structured data directly into Brainy's knowledge graph.
134
+ * @param data The structured data to write/update
135
+ * @param options Optional write options (e.g., merge, overwrite)
136
+ */
137
+ writeData(data: Record<string, unknown>, options?: Record<string, unknown>): Promise<AugmentationResponse<unknown>>;
138
+ /**
139
+ * Monitors a specific data stream or event within Brainy for external systems.
140
+ * @param streamId The identifier of the data stream or event
141
+ * @param callback A function to call when new data/events occur
142
+ */
143
+ monitorStream(streamId: string, callback: DataCallback<unknown>): Promise<void>;
144
+ }
145
+ /**
146
+ * Interface for Cognitions augmentations.
147
+ * These augmentations enable advanced reasoning, inference, and logical operations.
148
+ */
149
+ interface ICognitionAugmentation extends IAugmentation {
150
+ /**
151
+ * Performs a reasoning operation based on current knowledge.
152
+ * @param query The specific reasoning task or question
153
+ * @param context Optional additional context for the reasoning
154
+ */
155
+ reason(query: string, context?: Record<string, unknown>): AugmentationResponse<{
156
+ inference: string;
157
+ confidence: number;
158
+ }>;
159
+ /**
160
+ * Infers relationships or new facts from existing data.
161
+ * @param dataSubset A subset of data to infer from
162
+ */
163
+ infer(dataSubset: Record<string, unknown>): AugmentationResponse<Record<string, unknown>>;
164
+ /**
165
+ * Executes a logical operation or rule set.
166
+ * @param ruleId The identifier of the rule or logic to apply
167
+ * @param input Data to apply the logic to
168
+ */
169
+ executeLogic(ruleId: string, input: Record<string, unknown>): AugmentationResponse<boolean>;
170
+ }
171
+ /**
172
+ * Interface for Memory augmentations.
173
+ * These augmentations provide storage capabilities for data in different formats (e.g., fileSystem, in-memory).
174
+ */
175
+ interface IMemoryAugmentation extends IAugmentation {
176
+ /**
177
+ * Stores data in the memory system.
178
+ * @param key The unique identifier for the data
179
+ * @param data The data to store
180
+ * @param options Optional storage options (e.g., expiration, format)
181
+ */
182
+ storeData(key: string, data: unknown, options?: Record<string, unknown>): Promise<AugmentationResponse<boolean>>;
183
+ /**
184
+ * Retrieves data from the memory system.
185
+ * @param key The unique identifier for the data
186
+ * @param options Optional retrieval options (e.g., format, version)
187
+ */
188
+ retrieveData(key: string, options?: Record<string, unknown>): Promise<AugmentationResponse<unknown>>;
189
+ /**
190
+ * Updates existing data in the memory system.
191
+ * @param key The unique identifier for the data
192
+ * @param data The updated data
193
+ * @param options Optional update options (e.g., merge, overwrite)
194
+ */
195
+ updateData(key: string, data: unknown, options?: Record<string, unknown>): Promise<AugmentationResponse<boolean>>;
196
+ /**
197
+ * Deletes data from the memory system.
198
+ * @param key The unique identifier for the data
199
+ * @param options Optional deletion options
200
+ */
201
+ deleteData(key: string, options?: Record<string, unknown>): Promise<AugmentationResponse<boolean>>;
202
+ /**
203
+ * Lists available data keys in the memory system.
204
+ * @param pattern Optional pattern to filter keys (e.g., prefix, regex)
205
+ * @param options Optional listing options (e.g., limit, offset)
206
+ */
207
+ listDataKeys(pattern?: string, options?: Record<string, unknown>): Promise<AugmentationResponse<string[]>>;
208
+ /**
209
+ * Searches for data in the memory system using vector similarity.
210
+ * @param query The query vector or data to search for
211
+ * @param k Number of results to return
212
+ * @param options Optional search options
213
+ */
214
+ search(query: unknown, k?: number, options?: Record<string, unknown>): Promise<AugmentationResponse<Array<{
215
+ id: string;
216
+ score: number;
217
+ data: unknown;
218
+ }>>>;
219
+ }
220
+ /**
221
+ * Interface for Perceptions augmentations.
222
+ * These augmentations interpret, contextualize, and visualize identified nouns and verbs.
223
+ */
224
+ interface IPerceptionAugmentation extends IAugmentation {
225
+ /**
226
+ * Interprets and contextualizes processed nouns and verbs.
227
+ * @param nouns The list of identified nouns
228
+ * @param verbs The list of identified verbs
229
+ * @param context Optional additional context for interpretation
230
+ */
231
+ interpret(nouns: string[], verbs: string[], context?: Record<string, unknown>): AugmentationResponse<Record<string, unknown>>;
232
+ /**
233
+ * Organizes and filters information.
234
+ * @param data The data to organize (e.g., interpreted perceptions)
235
+ * @param criteria Optional criteria for filtering/prioritization
236
+ */
237
+ organize(data: Record<string, unknown>, criteria?: Record<string, unknown>): AugmentationResponse<Record<string, unknown>>;
238
+ /**
239
+ * Generates a visualization based on the provided data.
240
+ * @param data The data to visualize (e.g., interpreted patterns)
241
+ * @param visualizationType The desired type of visualization (e.g., 'graph', 'chart')
242
+ */
243
+ generateVisualization(data: Record<string, unknown>, visualizationType: string): AugmentationResponse<string | Buffer | Record<string, unknown>>;
244
+ }
245
+ /**
246
+ * Interface for Dialogs augmentations.
247
+ * These augmentations facilitate natural language understanding and generation for conversational interaction.
248
+ */
249
+ interface IDialogAugmentation extends IAugmentation {
250
+ /**
251
+ * Processes a user's natural language input (query).
252
+ * @param naturalLanguageQuery The raw text query from the user
253
+ * @param sessionId An optional session ID for conversational context
254
+ */
255
+ processUserInput(naturalLanguageQuery: string, sessionId?: string): AugmentationResponse<{
256
+ intent: string;
257
+ nouns: string[];
258
+ verbs: string[];
259
+ context: Record<string, unknown>;
260
+ }>;
261
+ /**
262
+ * Generates a natural language response based on Brainy's knowledge and interpreted input.
263
+ * @param interpretedInput The output from `processUserInput` or similar
264
+ * @param knowledgeContext Relevant knowledge retrieved from Brainy
265
+ * @param sessionId An optional session ID for conversational context
266
+ */
267
+ generateResponse(interpretedInput: Record<string, unknown>, knowledgeContext: Record<string, unknown>, sessionId?: string): AugmentationResponse<string>;
268
+ /**
269
+ * Manages and updates conversational context.
270
+ * @param sessionId The session ID
271
+ * @param contextUpdate The data to update the context with
272
+ */
273
+ manageContext(sessionId: string, contextUpdate: Record<string, unknown>): Promise<void>;
274
+ }
275
+ /**
276
+ * Interface for Activations augmentations.
277
+ * These augmentations dictate how Brainy initiates actions, responses, or data manipulations.
278
+ */
279
+ interface IActivationAugmentation extends IAugmentation {
280
+ /**
281
+ * Triggers an action based on a processed command or internal state.
282
+ * @param actionName The name of the action to trigger
283
+ * @param parameters Optional parameters for the action
284
+ */
285
+ triggerAction(actionName: string, parameters?: Record<string, unknown>): AugmentationResponse<unknown>;
286
+ /**
287
+ * Generates an expressive output or response from Brainy.
288
+ * @param knowledgeId The identifier of the knowledge to express
289
+ * @param format The desired output format (e.g., 'text', 'json')
290
+ */
291
+ generateOutput(knowledgeId: string, format: string): AugmentationResponse<string | Record<string, unknown>>;
292
+ /**
293
+ * Interacts with an external system or API.
294
+ * @param systemId The identifier of the external system
295
+ * @param payload The data to send to the external system
296
+ */
297
+ interactExternal(systemId: string, payload: Record<string, unknown>): AugmentationResponse<unknown>;
298
+ }
299
+ }
300
+ /** Direct exports of augmentation interfaces for easier imports */
301
+ export interface ISenseAugmentation extends BrainyAugmentations.ISenseAugmentation {
302
+ }
303
+ export interface IConduitAugmentation extends BrainyAugmentations.IConduitAugmentation {
304
+ }
305
+ export interface ICognitionAugmentation extends BrainyAugmentations.ICognitionAugmentation {
306
+ }
307
+ export interface IMemoryAugmentation extends BrainyAugmentations.IMemoryAugmentation {
308
+ }
309
+ export interface IPerceptionAugmentation extends BrainyAugmentations.IPerceptionAugmentation {
310
+ }
311
+ export interface IDialogAugmentation extends BrainyAugmentations.IDialogAugmentation {
312
+ }
313
+ export interface IActivationAugmentation extends BrainyAugmentations.IActivationAugmentation {
314
+ }
315
+ /** WebSocket-enabled augmentation interfaces */
316
+ export type IWebSocketSenseAugmentation = BrainyAugmentations.ISenseAugmentation & IWebSocketSupport;
317
+ export type IWebSocketConduitAugmentation = BrainyAugmentations.IConduitAugmentation & IWebSocketSupport;
318
+ export type IWebSocketCognitionAugmentation = BrainyAugmentations.ICognitionAugmentation & IWebSocketSupport;
319
+ export type IWebSocketMemoryAugmentation = BrainyAugmentations.IMemoryAugmentation & IWebSocketSupport;
320
+ export type IWebSocketPerceptionAugmentation = BrainyAugmentations.IPerceptionAugmentation & IWebSocketSupport;
321
+ export type IWebSocketDialogAugmentation = BrainyAugmentations.IDialogAugmentation & IWebSocketSupport;
322
+ export type IWebSocketActivationAugmentation = BrainyAugmentations.IActivationAugmentation & IWebSocketSupport;
323
+ export {};
324
+ //# sourceMappingURL=augmentations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"augmentations.d.ts","sourceRoot":"","sources":["../../src/types/augmentations.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,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iBAAiB,CAAA;AACxG,MAAM,MAAM,+BAA+B,GAAG,mBAAmB,CAAC,sBAAsB,GAAG,iBAAiB,CAAA;AAC5G,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC,mBAAmB,GAAG,iBAAiB,CAAA;AACtG,MAAM,MAAM,gCAAgC,GAAG,mBAAmB,CAAC,uBAAuB,GAAG,iBAAiB,CAAA;AAC9G,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC,mBAAmB,GAAG,iBAAiB,CAAA;AACtG,MAAM,MAAM,gCAAgC,GAAG,mBAAmB,CAAC,uBAAuB,GAAG,iBAAiB,CAAA"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * BrainyDataInterface
3
+ *
4
+ * This interface defines the methods from BrainyData that are used by serverSearchAugmentations.ts.
5
+ * It's used to break the circular dependency between brainyData.ts and serverSearchAugmentations.ts.
6
+ */
7
+ import { Vector } from '../coreTypes.js';
8
+ export interface BrainyDataInterface<T = unknown> {
9
+ /**
10
+ * Initialize the database
11
+ */
12
+ init(): Promise<void>;
13
+ /**
14
+ * Get a noun by ID
15
+ * @param id The ID of the noun to get
16
+ */
17
+ get(id: string): Promise<unknown>;
18
+ /**
19
+ * Add a vector or data to the database
20
+ * @param vectorOrData Vector or data to add
21
+ * @param metadata Optional metadata to associate with the vector
22
+ * @returns The ID of the added vector
23
+ */
24
+ add(vectorOrData: Vector | unknown, metadata?: T): Promise<string>;
25
+ /**
26
+ * Search for text in the database
27
+ * @param text The text to search for
28
+ * @param limit Maximum number of results to return
29
+ * @returns Search results
30
+ */
31
+ searchText(text: string, limit?: number): Promise<unknown[]>;
32
+ /**
33
+ * Create a relationship between two entities
34
+ * @param sourceId The ID of the source entity
35
+ * @param targetId The ID of the target entity
36
+ * @param relationType The type of relationship
37
+ * @param metadata Optional metadata about the relationship
38
+ * @returns The ID of the created relationship
39
+ */
40
+ relate(sourceId: string, targetId: string, relationType: string, metadata?: unknown): Promise<string>;
41
+ /**
42
+ * Find entities similar to a given entity ID
43
+ * @param id ID of the entity to find similar entities for
44
+ * @param options Additional options
45
+ * @returns Array of search results with similarity scores
46
+ */
47
+ findSimilar(id: string, options?: {
48
+ limit?: number;
49
+ }): Promise<unknown[]>;
50
+ }
51
+ //# sourceMappingURL=brainyDataInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brainyDataInterface.d.ts","sourceRoot":"","sources":["../../src/types/brainyDataInterface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAC9C;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAErB;;;OAGG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEjC;;;;;OAKG;IACH,GAAG,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAElE;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;IAE5D;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAErG;;;;;OAKG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;CAC1E"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Type declarations for the File System Access API
3
+ * Extends the FileSystemDirectoryHandle interface to include the [Symbol.asyncIterator] method
4
+ */
5
+ export declare const fileSystemTypesLoaded = true;
6
+ //# sourceMappingURL=fileSystemTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileSystemTypes.d.ts","sourceRoot":"","sources":["../../src/types/fileSystemTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,eAAO,MAAM,qBAAqB,OAAO,CAAC"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Represents a high-precision timestamp with seconds and nanoseconds
3
+ * Used for tracking creation and update times of graph elements
4
+ */
5
+ interface Timestamp {
6
+ seconds: number;
7
+ nanoseconds: number;
8
+ }
9
+ /**
10
+ * Metadata about the creator/source of a graph noun
11
+ * Tracks which augmentation and model created the element
12
+ */
13
+ interface CreatorMetadata {
14
+ augmentation: string;
15
+ version: string;
16
+ }
17
+ /**
18
+ * Base interface for nodes (nouns) in the graph
19
+ * Represents entities like people, places, things, etc.
20
+ */
21
+ export interface GraphNoun {
22
+ id: string;
23
+ createdBy: CreatorMetadata;
24
+ noun: NounType;
25
+ createdAt: Timestamp;
26
+ updatedAt: Timestamp;
27
+ label?: string;
28
+ data?: Record<string, any>;
29
+ embeddedVerbs?: EmbeddedGraphVerb[];
30
+ embedding?: number[];
31
+ }
32
+ /**
33
+ * Base interface for edges (verbs) in the graph
34
+ * Represents relationships between nouns
35
+ */
36
+ export interface GraphVerb {
37
+ id: string;
38
+ source: string;
39
+ target: string;
40
+ label?: string;
41
+ verb: VerbType;
42
+ createdAt: Timestamp;
43
+ updatedAt: Timestamp;
44
+ data?: Record<string, any>;
45
+ embedding?: number[];
46
+ confidence?: number;
47
+ weight?: number;
48
+ }
49
+ /**
50
+ * Version of GraphVerb for embedded relationships
51
+ * Used when the source is implicit from the parent document
52
+ */
53
+ export type EmbeddedGraphVerb = Omit<GraphVerb, 'source'>;
54
+ /**
55
+ * Represents a person entity in the graph
56
+ */
57
+ export interface Person extends GraphNoun {
58
+ noun: typeof NounType.Person;
59
+ }
60
+ /**
61
+ * Represents a physical location in the graph
62
+ */
63
+ export interface Place extends GraphNoun {
64
+ noun: typeof NounType.Place;
65
+ }
66
+ /**
67
+ * Represents a physical or virtual object in the graph
68
+ */
69
+ export interface Thing extends GraphNoun {
70
+ noun: typeof NounType.Thing;
71
+ }
72
+ /**
73
+ * Represents an event or occurrence in the graph
74
+ */
75
+ export interface Event extends GraphNoun {
76
+ noun: typeof NounType.Event;
77
+ }
78
+ /**
79
+ * Represents an abstract concept or idea in the graph
80
+ */
81
+ export interface Concept extends GraphNoun {
82
+ noun: typeof NounType.Concept;
83
+ }
84
+ export interface Group extends GraphNoun {
85
+ noun: typeof NounType.Group;
86
+ }
87
+ export interface List extends GraphNoun {
88
+ noun: typeof NounType.List;
89
+ }
90
+ /**
91
+ * Represents content (text, media, etc.) in the graph
92
+ */
93
+ export interface Content extends GraphNoun {
94
+ noun: typeof NounType.Content;
95
+ }
96
+ /**
97
+ * Defines valid noun types for graph entities
98
+ * Used for categorizing different types of nodes
99
+ */
100
+ export declare const NounType: {
101
+ readonly Person: "person";
102
+ readonly Place: "place";
103
+ readonly Thing: "thing";
104
+ readonly Event: "event";
105
+ readonly Concept: "concept";
106
+ readonly Content: "content";
107
+ readonly Group: "group";
108
+ readonly List: "list";
109
+ readonly Category: "category";
110
+ };
111
+ export type NounType = (typeof NounType)[keyof typeof NounType];
112
+ /**
113
+ * Defines valid verb types for relationships
114
+ * Used for categorizing different types of connections
115
+ */
116
+ export declare const VerbType: {
117
+ readonly AttributedTo: "attributedTo";
118
+ readonly Controls: "controls";
119
+ readonly Created: "created";
120
+ readonly Earned: "earned";
121
+ readonly Owns: "owns";
122
+ readonly MemberOf: "memberOf";
123
+ readonly RelatedTo: "relatedTo";
124
+ readonly WorksWith: "worksWith";
125
+ readonly FriendOf: "friendOf";
126
+ readonly ReportsTo: "reportsTo";
127
+ readonly Supervises: "supervises";
128
+ readonly Mentors: "mentors";
129
+ readonly Follows: "follows";
130
+ readonly Likes: "likes";
131
+ };
132
+ export type VerbType = (typeof VerbType)[keyof typeof VerbType];
133
+ export {};
134
+ //# sourceMappingURL=graphTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphTypes.d.ts","sourceRoot":"","sources":["../../src/types/graphTypes.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,UAAU,SAAS;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;GAGG;AACH,UAAU,eAAe;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,eAAe,CAAA;IAC1B,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,aAAa,CAAC,EAAE,iBAAiB,EAAE,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,EAAE,SAAS,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,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