@soulcraft/brainy 3.20.1 → 3.20.3

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 (91) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bin/brainy-interactive.js +2 -2
  3. package/dist/brainy.d.ts +1 -1
  4. package/dist/mcp/brainyMCPAdapter.d.ts +1 -1
  5. package/dist/mcp/brainyMCPService.d.ts +1 -1
  6. package/dist/neural/embeddedPatterns.d.ts +1 -1
  7. package/dist/neural/embeddedPatterns.js +1 -1
  8. package/dist/shared/default-augmentations.d.ts +1 -1
  9. package/dist/types/{brainyDataInterface.js → brainyInterface.js} +1 -1
  10. package/dist/vfs/VirtualFileSystem.d.ts +1 -0
  11. package/dist/vfs/VirtualFileSystem.js +108 -69
  12. package/package.json +1 -1
  13. package/dist/augmentationFactory.d.ts +0 -86
  14. package/dist/augmentationFactory.js +0 -342
  15. package/dist/augmentationRegistry.d.ts +0 -38
  16. package/dist/augmentationRegistry.js +0 -54
  17. package/dist/augmentationRegistryLoader.d.ts +0 -146
  18. package/dist/augmentationRegistryLoader.js +0 -213
  19. package/dist/augmentations/KnowledgeAugmentation.d.ts +0 -40
  20. package/dist/augmentations/KnowledgeAugmentation.js +0 -251
  21. package/dist/augmentations/intelligentVerbScoring.d.ts +0 -158
  22. package/dist/augmentations/intelligentVerbScoring.js +0 -377
  23. package/dist/augmentations/marketplace/AugmentationMarketplace.d.ts +0 -168
  24. package/dist/augmentations/marketplace/AugmentationMarketplace.js +0 -329
  25. package/dist/augmentations/marketplace/cli.d.ts +0 -47
  26. package/dist/augmentations/marketplace/cli.js +0 -265
  27. package/dist/augmentations/memoryAugmentations.d.ts +0 -72
  28. package/dist/augmentations/memoryAugmentations.js +0 -280
  29. package/dist/augmentations/serverSearchAugmentations.d.ts +0 -190
  30. package/dist/augmentations/serverSearchAugmentations.js +0 -586
  31. package/dist/brainy-unified.d.ts +0 -106
  32. package/dist/brainy-unified.js +0 -327
  33. package/dist/brainyData.d.ts +0 -1832
  34. package/dist/brainyData.js +0 -6443
  35. package/dist/brainyDataV3.d.ts +0 -186
  36. package/dist/brainyDataV3.js +0 -337
  37. package/dist/config/distributedPresets-new.d.ts +0 -118
  38. package/dist/config/distributedPresets-new.js +0 -318
  39. package/dist/config/modelPrecisionManager.d.ts +0 -42
  40. package/dist/config/modelPrecisionManager.js +0 -98
  41. package/dist/connectors/interfaces/IConnector.d.ts +0 -143
  42. package/dist/connectors/interfaces/IConnector.js +0 -8
  43. package/dist/demo.d.ts +0 -106
  44. package/dist/demo.js +0 -201
  45. package/dist/embeddings/SingletonModelManager.d.ts +0 -95
  46. package/dist/embeddings/SingletonModelManager.js +0 -220
  47. package/dist/embeddings/lightweight-embedder.d.ts +0 -22
  48. package/dist/embeddings/lightweight-embedder.js +0 -128
  49. package/dist/embeddings/model-manager.d.ts +0 -39
  50. package/dist/embeddings/model-manager.js +0 -245
  51. package/dist/embeddings/universal-memory-manager.d.ts +0 -38
  52. package/dist/embeddings/universal-memory-manager.js +0 -166
  53. package/dist/embeddings/worker-embedding.d.ts +0 -7
  54. package/dist/embeddings/worker-embedding.js +0 -73
  55. package/dist/embeddings/worker-manager.d.ts +0 -28
  56. package/dist/embeddings/worker-manager.js +0 -162
  57. package/dist/examples/basicUsage.d.ts +0 -4
  58. package/dist/examples/basicUsage.js +0 -121
  59. package/dist/indices/fieldIndex.d.ts +0 -76
  60. package/dist/indices/fieldIndex.js +0 -357
  61. package/dist/mcp/brainyMCPBroadcast.d.ts +0 -82
  62. package/dist/mcp/brainyMCPBroadcast.js +0 -303
  63. package/dist/mcp/brainyMCPClient.d.ts +0 -92
  64. package/dist/mcp/brainyMCPClient.js +0 -258
  65. package/dist/scripts/precomputePatternEmbeddings.d.ts +0 -19
  66. package/dist/scripts/precomputePatternEmbeddings.js +0 -100
  67. package/dist/utils/cacheAutoConfig.d.ts +0 -63
  68. package/dist/utils/cacheAutoConfig.js +0 -261
  69. package/dist/utils/hybridModelManager.d.ts +0 -64
  70. package/dist/utils/hybridModelManager.js +0 -95
  71. package/dist/utils/statistics.d.ts +0 -28
  72. package/dist/utils/statistics.js +0 -25
  73. package/dist/vfs/ConceptSystem.d.ts +0 -203
  74. package/dist/vfs/ConceptSystem.js +0 -545
  75. package/dist/vfs/EntityManager.d.ts +0 -75
  76. package/dist/vfs/EntityManager.js +0 -216
  77. package/dist/vfs/EventRecorder.d.ts +0 -84
  78. package/dist/vfs/EventRecorder.js +0 -269
  79. package/dist/vfs/GitBridge.d.ts +0 -167
  80. package/dist/vfs/GitBridge.js +0 -537
  81. package/dist/vfs/KnowledgeAugmentation.d.ts +0 -104
  82. package/dist/vfs/KnowledgeAugmentation.js +0 -146
  83. package/dist/vfs/KnowledgeLayer.d.ts +0 -35
  84. package/dist/vfs/KnowledgeLayer.js +0 -443
  85. package/dist/vfs/PersistentEntitySystem.d.ts +0 -165
  86. package/dist/vfs/PersistentEntitySystem.js +0 -503
  87. package/dist/vfs/SemanticVersioning.d.ts +0 -105
  88. package/dist/vfs/SemanticVersioning.js +0 -309
  89. package/dist/vfs/VFSHealthCheck.d.ts +0 -78
  90. package/dist/vfs/VFSHealthCheck.js +0 -299
  91. /package/dist/types/{brainyDataInterface.d.ts → brainyInterface.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [3.20.2](https://github.com/soulcraftlabs/brainy/compare/v3.20.1...v3.20.2) (2025-09-30)
6
+
7
+ ### Bug Fixes
8
+
9
+ * **vfs**: resolve VFS race conditions and decompression errors ([1a2661f](https://github.com/soulcraftlabs/brainy/commit/1a2661f))
10
+ - Fixes duplicate directory nodes caused by concurrent writes
11
+ - Fixes file read decompression errors caused by rawData compression state mismatch
12
+ - Adds mutex-based concurrency control for mkdir operations
13
+ - Adds explicit compression tracking for file reads
14
+
15
+ ### BREAKING CHANGES (Deprecated API Removal)
16
+
17
+ * **removed BrainyData**: The deprecated `BrainyData` class has been completely removed
18
+ - `BrainyData` was never part of the official Brainy 3.0 API
19
+ - All users should migrate to the `Brainy` class
20
+ - Migration is simple: Replace `new BrainyData()` with `new Brainy()` and add `await brain.init()`
21
+ - See `.strategy/NEURAL_API_RESPONSE.md` for complete migration guide
22
+ - Renamed `brainyDataInterface.ts` to `brainyInterface.ts` for clarity
23
+
5
24
  ### [3.19.1](https://github.com/soulcraftlabs/brainy/compare/v3.19.0...v3.19.1) (2025-09-29)
6
25
 
7
26
  ## [3.19.0](https://github.com/soulcraftlabs/brainy/compare/v3.18.0...v3.19.0) (2025-09-29)
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { program } from 'commander'
10
- import { BrainyData } from '../dist/brainyData.js'
10
+ import { Brainy } from '../dist/index.js'
11
11
  import chalk from 'chalk'
12
12
  import inquirer from 'inquirer'
13
13
  import ora from 'ora'
@@ -61,7 +61,7 @@ async function getBrainy() {
61
61
  if (!brainyInstance) {
62
62
  const spinner = ora('Initializing Brainy...').start()
63
63
  try {
64
- brainyInstance = new BrainyData()
64
+ brainyInstance = new Brainy()
65
65
  await brainyInstance.init()
66
66
  spinner.succeed('Brainy initialized')
67
67
  } catch (error) {
package/dist/brainy.d.ts CHANGED
@@ -12,7 +12,7 @@ import { TripleIntelligenceSystem } from './triple/TripleIntelligenceSystem.js';
12
12
  import { VirtualFileSystem } from './vfs/VirtualFileSystem.js';
13
13
  import { Entity, Relation, Result, AddParams, UpdateParams, RelateParams, FindParams, SimilarParams, GetRelationsParams, AddManyParams, DeleteManyParams, RelateManyParams, BatchResult, BrainyConfig } from './types/brainy.types.js';
14
14
  import { NounType } from './types/graphTypes.js';
15
- import { BrainyInterface } from './types/brainyDataInterface.js';
15
+ import { BrainyInterface } from './types/brainyInterface.js';
16
16
  /**
17
17
  * The main Brainy class - Clean, Beautiful, Powerful
18
18
  * REAL IMPLEMENTATION - No stubs, no mocks
@@ -5,7 +5,7 @@
5
5
  * It wraps a Brainy instance and exposes methods for getting vectors, searching similar items,
6
6
  * and getting relationships.
7
7
  */
8
- import { BrainyInterface } from '../types/brainyDataInterface.js';
8
+ import { BrainyInterface } from '../types/brainyInterface.js';
9
9
  import { MCPResponse, MCPDataAccessRequest } from '../types/mcpTypes.js';
10
10
  export declare class BrainyMCPAdapter {
11
11
  private brainyData;
@@ -6,7 +6,7 @@
6
6
  * MCPAugmentationToolset classes and provides WebSocket and REST server implementations
7
7
  * for external model access.
8
8
  */
9
- import { BrainyInterface } from '../types/brainyDataInterface.js';
9
+ import { BrainyInterface } from '../types/brainyInterface.js';
10
10
  import { MCPRequest, MCPResponse, MCPServiceOptions } from '../types/mcpTypes.js';
11
11
  export declare class BrainyMCPService {
12
12
  private dataAdapter;
@@ -2,7 +2,7 @@
2
2
  * 🧠 BRAINY EMBEDDED PATTERNS
3
3
  *
4
4
  * AUTO-GENERATED - DO NOT EDIT
5
- * Generated: 2025-09-29T17:05:30.153Z
5
+ * Generated: 2025-09-30T23:01:33.167Z
6
6
  * Patterns: 220
7
7
  * Coverage: 94-98% of all queries
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * 🧠 BRAINY EMBEDDED PATTERNS
3
3
  *
4
4
  * AUTO-GENERATED - DO NOT EDIT
5
- * Generated: 2025-09-29T17:05:30.153Z
5
+ * Generated: 2025-09-30T23:01:33.167Z
6
6
  * Patterns: 220
7
7
  * Coverage: 94-98% of all queries
8
8
  *
@@ -4,7 +4,7 @@
4
4
  * 🧠⚛️ Pre-installed augmentations that come with every Brainy installation
5
5
  * These are the core "sensory organs" of the atomic age brain-in-jar system
6
6
  */
7
- import { BrainyInterface } from '../types/brainyDataInterface.js';
7
+ import { BrainyInterface } from '../types/brainyInterface.js';
8
8
  /**
9
9
  * Default augmentations that ship with Brainy
10
10
  * These are automatically registered on startup
@@ -7,4 +7,4 @@
7
7
  * NO DEPRECATED METHODS - Only clean, modern API patterns.
8
8
  */
9
9
  export {};
10
- //# sourceMappingURL=brainyDataInterface.js.map
10
+ //# sourceMappingURL=brainyInterface.js.map
@@ -28,6 +28,7 @@ export declare class VirtualFileSystem implements IVirtualFileSystem {
28
28
  private statCache;
29
29
  private watchers;
30
30
  private backgroundTimer;
31
+ private mkdirLocks;
31
32
  constructor(brain?: Brainy);
32
33
  /**
33
34
  * Initialize the VFS
@@ -25,6 +25,8 @@ export class VirtualFileSystem {
25
25
  this.currentUser = 'system'; // Track current user for collaboration
26
26
  // Background task timer
27
27
  this.backgroundTimer = null;
28
+ // Mutex for preventing race conditions in directory creation
29
+ this.mkdirLocks = new Map();
28
30
  this.brain = brain || new Brainy();
29
31
  this.contentCache = new Map();
30
32
  this.statCache = new Map();
@@ -159,16 +161,20 @@ export class VirtualFileSystem {
159
161
  }
160
162
  // Get content based on storage type
161
163
  let content;
164
+ let isCompressed = false;
162
165
  if (!entity.metadata.storage || entity.metadata.storage.type === 'inline') {
163
166
  // Content stored in metadata for new files, or try entity data for compatibility
164
167
  if (entity.metadata.rawData) {
168
+ // rawData is ALWAYS stored uncompressed as base64
165
169
  content = Buffer.from(entity.metadata.rawData, 'base64');
170
+ isCompressed = false; // rawData is never compressed
166
171
  }
167
172
  else if (!entity.data) {
168
173
  content = Buffer.alloc(0);
169
174
  }
170
175
  else if (Buffer.isBuffer(entity.data)) {
171
176
  content = entity.data;
177
+ isCompressed = entity.metadata.storage?.compressed || false;
172
178
  }
173
179
  else if (typeof entity.data === 'string') {
174
180
  content = Buffer.from(entity.data);
@@ -180,16 +186,18 @@ export class VirtualFileSystem {
180
186
  else if (entity.metadata.storage.type === 'reference') {
181
187
  // Content stored in external storage
182
188
  content = await this.readExternalContent(entity.metadata.storage.key);
189
+ isCompressed = entity.metadata.storage.compressed || false;
183
190
  }
184
191
  else if (entity.metadata.storage.type === 'chunked') {
185
192
  // Content stored in chunks
186
193
  content = await this.readChunkedContent(entity.metadata.storage.chunks);
194
+ isCompressed = entity.metadata.storage.compressed || false;
187
195
  }
188
196
  else {
189
197
  throw new VFSError(VFSErrorCode.EIO, `Unknown storage type: ${entity.metadata.storage.type}`, path, 'readFile');
190
198
  }
191
- // Decompress if needed
192
- if (entity.metadata.storage?.compressed && options?.decompress !== false) {
199
+ // Decompress if needed (but NOT for rawData which is never compressed)
200
+ if (isCompressed && options?.decompress !== false) {
193
201
  content = await this.decompress(content);
194
202
  }
195
203
  // Update access time
@@ -317,7 +325,7 @@ export class VirtualFileSystem {
317
325
  type: this.getFileNounType(mimeType),
318
326
  metadata
319
327
  });
320
- // Create parent-child relationship
328
+ // Create parent-child relationship (no need to check for duplicates on new entities)
321
329
  await this.brain.relate({
322
330
  from: parentId,
323
331
  to: entity,
@@ -498,78 +506,106 @@ export class VirtualFileSystem {
498
506
  */
499
507
  async mkdir(path, options) {
500
508
  await this.ensureInitialized();
501
- // Check if already exists
502
- try {
503
- const existing = await this.pathResolver.resolve(path);
504
- const entity = await this.getEntityById(existing);
505
- if (entity.metadata.vfsType === 'directory') {
506
- if (!options?.recursive) {
507
- throw new VFSError(VFSErrorCode.EEXIST, `Directory exists: ${path}`, path, 'mkdir');
509
+ // Use mutex to prevent race conditions when creating the same directory concurrently
510
+ // If another call is already creating this directory, wait for it to complete
511
+ const existingLock = this.mkdirLocks.get(path);
512
+ if (existingLock) {
513
+ await existingLock;
514
+ // After waiting, check if directory now exists
515
+ try {
516
+ const existing = await this.pathResolver.resolve(path);
517
+ const entity = await this.getEntityById(existing);
518
+ if (entity.metadata.vfsType === 'directory') {
519
+ return; // Directory was created by the other call
508
520
  }
509
- return; // Already exists and recursive is true
510
521
  }
511
- else {
512
- // Path exists but it's not a directory
513
- throw new VFSError(VFSErrorCode.EEXIST, `File exists: ${path}`, path, 'mkdir');
514
- }
515
- }
516
- catch (err) {
517
- // Only proceed if it's a ENOENT error (path doesn't exist)
518
- if (err instanceof VFSError && err.code !== VFSErrorCode.ENOENT) {
519
- throw err; // Re-throw non-ENOENT errors
522
+ catch (err) {
523
+ // Still doesn't exist, proceed to create
520
524
  }
521
- // Doesn't exist, proceed to create
522
525
  }
523
- // Parse path
524
- const parentPath = this.getParentPath(path);
525
- const name = this.getBasename(path);
526
- // Ensure parent exists (recursive mkdir if needed)
527
- let parentId;
528
- if (parentPath === '/' || parentPath === null) {
529
- parentId = this.rootEntityId;
530
- }
531
- else if (options?.recursive) {
532
- parentId = await this.ensureDirectory(parentPath);
533
- }
534
- else {
526
+ // Create a lock promise for this path
527
+ let resolveLock;
528
+ const lockPromise = new Promise(resolve => { resolveLock = resolve; });
529
+ this.mkdirLocks.set(path, lockPromise);
530
+ try {
531
+ // Check if already exists
535
532
  try {
536
- parentId = await this.pathResolver.resolve(parentPath);
533
+ const existing = await this.pathResolver.resolve(path);
534
+ const entity = await this.getEntityById(existing);
535
+ if (entity.metadata.vfsType === 'directory') {
536
+ if (!options?.recursive) {
537
+ throw new VFSError(VFSErrorCode.EEXIST, `Directory exists: ${path}`, path, 'mkdir');
538
+ }
539
+ return; // Already exists and recursive is true
540
+ }
541
+ else {
542
+ // Path exists but it's not a directory
543
+ throw new VFSError(VFSErrorCode.EEXIST, `File exists: ${path}`, path, 'mkdir');
544
+ }
537
545
  }
538
546
  catch (err) {
539
- throw new VFSError(VFSErrorCode.ENOENT, `Parent directory not found: ${parentPath}`, path, 'mkdir');
547
+ // Only proceed if it's a ENOENT error (path doesn't exist)
548
+ if (err instanceof VFSError && err.code !== VFSErrorCode.ENOENT) {
549
+ throw err; // Re-throw non-ENOENT errors
550
+ }
551
+ // Doesn't exist, proceed to create
540
552
  }
541
- }
542
- // Create directory entity
543
- const metadata = {
544
- path,
545
- name,
546
- parent: parentId,
547
- vfsType: 'directory',
548
- size: 0,
549
- permissions: options?.mode || this.config.permissions?.defaultDirectory || 0o755,
550
- owner: 'user',
551
- group: 'users',
552
- accessed: Date.now(),
553
- modified: Date.now(),
554
- ...options?.metadata
555
- };
556
- const entity = await this.brain.add({
557
- data: path, // Directory path as string content
558
- type: NounType.Collection,
559
- metadata
560
- });
561
- // Create parent-child relationship
562
- if (parentId !== entity) { // Don't relate to self (root)
563
- await this.brain.relate({
564
- from: parentId,
565
- to: entity,
566
- type: VerbType.Contains
553
+ // Parse path
554
+ const parentPath = this.getParentPath(path);
555
+ const name = this.getBasename(path);
556
+ // Ensure parent exists (recursive mkdir if needed)
557
+ let parentId;
558
+ if (parentPath === '/' || parentPath === null) {
559
+ parentId = this.rootEntityId;
560
+ }
561
+ else if (options?.recursive) {
562
+ parentId = await this.ensureDirectory(parentPath);
563
+ }
564
+ else {
565
+ try {
566
+ parentId = await this.pathResolver.resolve(parentPath);
567
+ }
568
+ catch (err) {
569
+ throw new VFSError(VFSErrorCode.ENOENT, `Parent directory not found: ${parentPath}`, path, 'mkdir');
570
+ }
571
+ }
572
+ // Create directory entity
573
+ const metadata = {
574
+ path,
575
+ name,
576
+ parent: parentId,
577
+ vfsType: 'directory',
578
+ size: 0,
579
+ permissions: options?.mode || this.config.permissions?.defaultDirectory || 0o755,
580
+ owner: 'user',
581
+ group: 'users',
582
+ accessed: Date.now(),
583
+ modified: Date.now(),
584
+ ...options?.metadata
585
+ };
586
+ const entity = await this.brain.add({
587
+ data: path, // Directory path as string content
588
+ type: NounType.Collection,
589
+ metadata
567
590
  });
591
+ // Create parent-child relationship (no need to check for duplicates on new entities)
592
+ if (parentId !== entity) { // Don't relate to self (root)
593
+ await this.brain.relate({
594
+ from: parentId,
595
+ to: entity,
596
+ type: VerbType.Contains
597
+ });
598
+ }
599
+ // Update path resolver cache
600
+ await this.pathResolver.createPath(path, entity);
601
+ // Trigger watchers
602
+ this.triggerWatchers(path, 'rename');
603
+ }
604
+ finally {
605
+ // Release the lock
606
+ resolveLock();
607
+ this.mkdirLocks.delete(path);
568
608
  }
569
- // Update path resolver cache
570
- await this.pathResolver.createPath(path, entity);
571
- // Trigger watchers
572
- this.triggerWatchers(path, 'rename');
573
609
  }
574
610
  /**
575
611
  * Remove a directory
@@ -1964,17 +2000,20 @@ export class VirtualFileSystem {
1964
2000
  };
1965
2001
  let earliestModified = null;
1966
2002
  let latestModified = null;
1967
- const traverse = async (currentPath) => {
2003
+ const traverse = async (currentPath, isRoot = false) => {
1968
2004
  try {
1969
2005
  const entityId = await this.pathResolver.resolve(currentPath);
1970
2006
  const entity = await this.getEntityById(entityId);
1971
2007
  if (entity.metadata.vfsType === 'directory') {
1972
- stats.directoryCount++;
2008
+ // Don't count the root/starting directory itself
2009
+ if (!isRoot) {
2010
+ stats.directoryCount++;
2011
+ }
1973
2012
  // Traverse children
1974
2013
  const children = await this.readdir(currentPath);
1975
2014
  for (const child of children) {
1976
2015
  const childPath = currentPath === '/' ? `/${child}` : `${currentPath}/${child}`;
1977
- await traverse(childPath);
2016
+ await traverse(childPath, false);
1978
2017
  }
1979
2018
  }
1980
2019
  else if (entity.metadata.vfsType === 'file') {
@@ -2005,7 +2044,7 @@ export class VirtualFileSystem {
2005
2044
  // Skip if path doesn't exist
2006
2045
  }
2007
2046
  };
2008
- await traverse(path);
2047
+ await traverse(path, true);
2009
2048
  // Calculate averages
2010
2049
  if (stats.fileCount > 0) {
2011
2050
  stats.averageFileSize = Math.round(stats.totalSize / stats.fileCount);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "3.20.1",
3
+ "version": "3.20.3",
4
4
  "description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,86 +0,0 @@
1
- /**
2
- * Augmentation Factory
3
- *
4
- * This module provides a simplified factory for creating augmentations with minimal boilerplate.
5
- * It reduces the complexity of creating and using augmentations by providing a fluent API
6
- * and handling common patterns automatically.
7
- */
8
- import { IAugmentation, AugmentationResponse, ISenseAugmentation, IConduitAugmentation, IMemoryAugmentation, IWebSocketSupport, WebSocketConnection } from './types/augmentations.js';
9
- /**
10
- * Options for creating an augmentation
11
- */
12
- export interface AugmentationOptions {
13
- name: string;
14
- description?: string;
15
- enabled?: boolean;
16
- autoRegister?: boolean;
17
- autoInitialize?: boolean;
18
- }
19
- /**
20
- * Factory for creating sense augmentations
21
- */
22
- export declare function createSenseAugmentation(options: AugmentationOptions & {
23
- processRawData?: (rawData: Buffer | string, dataType: string) => Promise<AugmentationResponse<{
24
- nouns: string[];
25
- verbs: string[];
26
- }>> | AugmentationResponse<{
27
- nouns: string[];
28
- verbs: string[];
29
- }>;
30
- listenToFeed?: (feedUrl: string, callback: (data: {
31
- nouns: string[];
32
- verbs: string[];
33
- }) => void) => Promise<void>;
34
- }): ISenseAugmentation;
35
- /**
36
- * Factory for creating conduit augmentations
37
- */
38
- export declare function createConduitAugmentation(options: AugmentationOptions & {
39
- establishConnection?: (targetSystemId: string, config: Record<string, unknown>) => Promise<AugmentationResponse<WebSocketConnection>> | AugmentationResponse<WebSocketConnection>;
40
- readData?: (query: Record<string, unknown>, options?: Record<string, unknown>) => Promise<AugmentationResponse<unknown>> | AugmentationResponse<unknown>;
41
- writeData?: (data: Record<string, unknown>, options?: Record<string, unknown>) => Promise<AugmentationResponse<unknown>> | AugmentationResponse<unknown>;
42
- monitorStream?: (streamId: string, callback: (data: unknown) => void) => Promise<void>;
43
- }): IConduitAugmentation;
44
- /**
45
- * Factory for creating memory augmentations
46
- */
47
- export declare function createMemoryAugmentation(options: AugmentationOptions & {
48
- storeData?: (key: string, data: unknown, options?: Record<string, unknown>) => Promise<AugmentationResponse<boolean>> | AugmentationResponse<boolean>;
49
- retrieveData?: (key: string, options?: Record<string, unknown>) => Promise<AugmentationResponse<unknown>> | AugmentationResponse<unknown>;
50
- updateData?: (key: string, data: unknown, options?: Record<string, unknown>) => Promise<AugmentationResponse<boolean>> | AugmentationResponse<boolean>;
51
- deleteData?: (key: string, options?: Record<string, unknown>) => Promise<AugmentationResponse<boolean>> | AugmentationResponse<boolean>;
52
- listDataKeys?: (pattern?: string, options?: Record<string, unknown>) => Promise<AugmentationResponse<string[]>> | AugmentationResponse<string[]>;
53
- search?: (query: unknown, k?: number, options?: Record<string, unknown>) => Promise<AugmentationResponse<Array<{
54
- id: string;
55
- score: number;
56
- data: unknown;
57
- }>>> | AugmentationResponse<Array<{
58
- id: string;
59
- score: number;
60
- data: unknown;
61
- }>>;
62
- }): IMemoryAugmentation;
63
- /**
64
- * Factory for creating WebSocket-enabled augmentations
65
- * This can be combined with other augmentation factories to create WebSocket-enabled versions
66
- */
67
- export declare function addWebSocketSupport<T extends IAugmentation>(augmentation: T, options: {
68
- connectWebSocket?: (url: string, protocols?: string | string[]) => Promise<WebSocketConnection>;
69
- sendWebSocketMessage?: (connectionId: string, data: unknown) => Promise<void>;
70
- onWebSocketMessage?: (connectionId: string, callback: (data: unknown) => void) => Promise<void>;
71
- offWebSocketMessage?: (connectionId: string, callback: (data: unknown) => void) => Promise<void>;
72
- closeWebSocket?: (connectionId: string, code?: number, reason?: string) => Promise<void>;
73
- }): T & IWebSocketSupport;
74
- /**
75
- * Simplified function to execute an augmentation method with automatic error handling
76
- * This provides a more concise way to execute augmentation methods compared to the full pipeline
77
- */
78
- export declare function executeAugmentation<T, R>(augmentation: IAugmentation, method: string, ...args: any[]): Promise<AugmentationResponse<R>>;
79
- /**
80
- * Dynamically load augmentations from a module at runtime
81
- * This allows for lazy-loading augmentations when needed instead of at build time
82
- */
83
- export declare function loadAugmentationModule(modulePromise: Promise<any>, options?: {
84
- autoRegister?: boolean;
85
- autoInitialize?: boolean;
86
- }): Promise<IAugmentation[]>;