@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,140 @@
1
+ /**
2
+ * Model Control Protocol (MCP) Types
3
+ *
4
+ * This file defines the types and interfaces for the Model Control Protocol (MCP)
5
+ * implementation in Brainy. MCP allows external models to access Brainy data and
6
+ * use the augmentation pipeline as tools.
7
+ */
8
+ /**
9
+ * MCP version information
10
+ */
11
+ export declare const MCP_VERSION = "1.0.0";
12
+ /**
13
+ * MCP request types
14
+ */
15
+ export declare enum MCPRequestType {
16
+ DATA_ACCESS = "data_access",
17
+ TOOL_EXECUTION = "tool_execution",
18
+ SYSTEM_INFO = "system_info",
19
+ AUTHENTICATION = "authentication"
20
+ }
21
+ /**
22
+ * Base interface for all MCP requests
23
+ */
24
+ export interface MCPRequest {
25
+ /** The type of request */
26
+ type: MCPRequestType;
27
+ /** Request ID for tracking and correlation */
28
+ requestId: string;
29
+ /** API version */
30
+ version: string;
31
+ /** Authentication token (if required) */
32
+ authToken?: string;
33
+ }
34
+ /**
35
+ * Interface for data access requests
36
+ */
37
+ export interface MCPDataAccessRequest extends MCPRequest {
38
+ type: MCPRequestType.DATA_ACCESS;
39
+ /** The data access operation to perform */
40
+ operation: 'get' | 'search' | 'add' | 'getRelationships';
41
+ /** Parameters for the operation */
42
+ parameters: Record<string, any>;
43
+ }
44
+ /**
45
+ * Interface for tool execution requests
46
+ */
47
+ export interface MCPToolExecutionRequest extends MCPRequest {
48
+ type: MCPRequestType.TOOL_EXECUTION;
49
+ /** The name of the tool to execute */
50
+ toolName: string;
51
+ /** Parameters for the tool */
52
+ parameters: Record<string, any>;
53
+ }
54
+ /**
55
+ * Interface for system info requests
56
+ */
57
+ export interface MCPSystemInfoRequest extends MCPRequest {
58
+ type: MCPRequestType.SYSTEM_INFO;
59
+ /** The type of information to retrieve */
60
+ infoType: 'status' | 'availableTools' | 'version';
61
+ }
62
+ /**
63
+ * Interface for authentication requests
64
+ */
65
+ export interface MCPAuthenticationRequest extends MCPRequest {
66
+ type: MCPRequestType.AUTHENTICATION;
67
+ /** The authentication credentials */
68
+ credentials: {
69
+ apiKey?: string;
70
+ username?: string;
71
+ password?: string;
72
+ };
73
+ }
74
+ /**
75
+ * Base interface for all MCP responses
76
+ */
77
+ export interface MCPResponse {
78
+ /** Whether the request was successful */
79
+ success: boolean;
80
+ /** The request ID from the original request */
81
+ requestId: string;
82
+ /** API version */
83
+ version: string;
84
+ /** Response data (if successful) */
85
+ data?: any;
86
+ /** Error information (if unsuccessful) */
87
+ error?: {
88
+ code: string;
89
+ message: string;
90
+ details?: any;
91
+ };
92
+ }
93
+ /**
94
+ * Interface for MCP tool definitions
95
+ */
96
+ export interface MCPTool {
97
+ /** The name of the tool */
98
+ name: string;
99
+ /** A description of what the tool does */
100
+ description: string;
101
+ /** The parameters the tool accepts */
102
+ parameters: {
103
+ type: 'object';
104
+ properties: Record<string, {
105
+ type: string;
106
+ description: string;
107
+ enum?: string[];
108
+ required?: boolean;
109
+ }>;
110
+ required: string[];
111
+ };
112
+ }
113
+ /**
114
+ * Configuration options for MCP services
115
+ */
116
+ export interface MCPServiceOptions {
117
+ /** Port for the WebSocket server */
118
+ wsPort?: number;
119
+ /** Port for the REST server */
120
+ restPort?: number;
121
+ /** Whether to enable authentication */
122
+ enableAuth?: boolean;
123
+ /** API keys for authentication */
124
+ apiKeys?: string[];
125
+ /** Rate limiting configuration */
126
+ rateLimit?: {
127
+ /** Maximum number of requests per window */
128
+ maxRequests: number;
129
+ /** Time window in milliseconds */
130
+ windowMs: number;
131
+ };
132
+ /** CORS configuration for REST API */
133
+ cors?: {
134
+ /** Allowed origins */
135
+ origin: string | string[];
136
+ /** Whether to allow credentials */
137
+ credentials: boolean;
138
+ };
139
+ }
140
+ //# sourceMappingURL=mcpTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpTypes.d.ts","sourceRoot":"","sources":["../../src/types/mcpTypes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,UAAU,CAAA;AAElC;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,0BAA0B;IAC1B,IAAI,EAAE,cAAc,CAAA;IACpB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAA;IACjB,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACtD,IAAI,EAAE,cAAc,CAAC,WAAW,CAAA;IAChC,2CAA2C;IAC3C,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,kBAAkB,CAAA;IACxD,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,UAAU;IACzD,IAAI,EAAE,cAAc,CAA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AAI,CAAC,EAAE,MAAM,EAAE,CAAA;YACf,QAAQ,CAAC,EAAE,OAAO,CAAA;SACnB,CAAC,CAAA;QACF,QAAQ,EAAE,MAAM,EAAE,CAAA;KACnB,CAAA;CACF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,kCAAkC;IAClC,SAAS,CAAC,EAAE;QACV,4CAA4C;QAC5C,WAAW,EAAE,MAAM,CAAA;QACnB,kCAAkC;QAClC,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,sCAAsC;IACtC,IAAI,CAAC,EAAE;QACL,sBAAsB;QACtB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;QACzB,mCAAmC;QACnC,WAAW,EAAE,OAAO,CAAA;KACrB,CAAA;CACF"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Pipeline Types
3
+ *
4
+ * This module provides shared types for the pipeline system to avoid circular dependencies.
5
+ */
6
+ import { BrainyAugmentations, IWebSocketSupport, IAugmentation } from './augmentations.js';
7
+ /**
8
+ * Type definitions for the augmentation registry
9
+ */
10
+ export type AugmentationRegistry = {
11
+ sense: BrainyAugmentations.ISenseAugmentation[];
12
+ conduit: BrainyAugmentations.IConduitAugmentation[];
13
+ cognition: BrainyAugmentations.ICognitionAugmentation[];
14
+ memory: BrainyAugmentations.IMemoryAugmentation[];
15
+ perception: BrainyAugmentations.IPerceptionAugmentation[];
16
+ dialog: BrainyAugmentations.IDialogAugmentation[];
17
+ activation: BrainyAugmentations.IActivationAugmentation[];
18
+ webSocket: IWebSocketSupport[];
19
+ };
20
+ /**
21
+ * Interface for the Pipeline class
22
+ * This is used to break circular dependencies between pipeline.ts and augmentationRegistry.ts
23
+ */
24
+ export interface IPipeline {
25
+ register<T extends IAugmentation>(augmentation: T): IPipeline;
26
+ }
27
+ //# sourceMappingURL=pipelineTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipelineTypes.d.ts","sourceRoot":"","sources":["../../src/types/pipelineTypes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACd,MAAM,oBAAoB,CAAA;AAE3B;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,mBAAmB,CAAC,kBAAkB,EAAE,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,oBAAoB,EAAE,CAAC;IACpD,SAAS,EAAE,mBAAmB,CAAC,sBAAsB,EAAE,CAAC;IACxD,MAAM,EAAE,mBAAmB,CAAC,mBAAmB,EAAE,CAAC;IAClD,UAAU,EAAE,mBAAmB,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,mBAAmB,CAAC,mBAAmB,EAAE,CAAC;IAClD,UAAU,EAAE,mBAAmB,CAAC,uBAAuB,EAAE,CAAC;IAC1D,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,CAAC,SAAS,aAAa,EAAE,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;CAC/D"}
@@ -0,0 +1,7 @@
1
+ export interface TensorflowModel {
2
+ load(): Promise<any>;
3
+ embed(data: string[]): any;
4
+ dispose(): void;
5
+ }
6
+ export declare const tensorflowModelsLoaded = true;
7
+ //# sourceMappingURL=tensorflowTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tensorflowTypes.d.ts","sourceRoot":"","sources":["../../src/types/tensorflowTypes.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IACrB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAC3B,OAAO,IAAI,IAAI,CAAC;CACjB;AAGD,eAAO,MAAM,sBAAsB,OAAO,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Unified entry point for Brainy
3
+ * This file exports everything from index.ts
4
+ * Environment detection is handled here and made available to all components
5
+ */
6
+ export declare const environment: {
7
+ isBrowser: boolean;
8
+ isNode: string | false;
9
+ isServerless: boolean;
10
+ };
11
+ export * from './index.js';
12
+ //# sourceMappingURL=unified.d.ts.map