crbro-memory 1.0.1 β 1.1.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.
- package/README.md +121 -122
- package/dist/engine/license.d.ts +18 -9
- package/dist/engine/license.d.ts.map +1 -1
- package/dist/engine/license.js +160 -50
- package/dist/engine/license.js.map +1 -1
- package/package.json +52 -52
package/README.md
CHANGED
|
@@ -1,122 +1,121 @@
|
|
|
1
|
-
# π§ CRBRO β Persistent Neural Memory for AI
|
|
2
|
-
|
|
3
|
-
**CRBRO** is a local MCP (Model Context Protocol) server that gives your AI assistant **persistent long-term memory** across sessions. It uses a biological neural architecture β cortex, synapses, hippocampus β to store, connect, and retrieve knowledge automatically.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
| `
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
βββ
|
|
87
|
-
βββ
|
|
88
|
-
β
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
βββ
|
|
95
|
-
β βββ
|
|
96
|
-
β
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
βββ .
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
- **
|
|
108
|
-
- **
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
npx crbro-memory
|
|
115
|
-
npx crbro-memory
|
|
116
|
-
npx crbro-memory
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
MIT β Part of [Synthetica Decks](https://synthetica-decks.web.app) by Octonove Agency.
|
|
1
|
+
# π§ CRBRO β Persistent Neural Memory for AI
|
|
2
|
+
|
|
3
|
+
**CRBRO** is a local MCP (Model Context Protocol) server that gives your AI assistant **persistent long-term memory** across sessions. It uses a biological neural architecture β cortex, synapses, hippocampus β to store, connect, and retrieve knowledge automatically.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **𧬠Biological Architecture** β Knowledge organized as neurons (cortex), connections (synapses), and session memory (hippocampus)
|
|
9
|
+
- **π Hybrid Search** β Powered by [Orama](https://orama.com/) for fast BM25 + fuzzy text search
|
|
10
|
+
- **π₯ Heat Scores** β Automatic relevance tracking based on frequency, recency, and connectivity
|
|
11
|
+
- **πΊοΈ Global Map** β Cluster detection and cross-domain bridge identification *(premium)*
|
|
12
|
+
- **π¦ Zero Dependencies** β Pure Node.js, no Python, no Docker, no external databases
|
|
13
|
+
- **πΎ File-Based** β All data stored as readable JSON files in `~/.crbro/`
|
|
14
|
+
- **π MCP Native** β Works with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### 1. Initialize
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx crbro-memory init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 2. Add to your MCP config
|
|
25
|
+
|
|
26
|
+
**Claude Desktop** (`~/AppData/Roaming/Claude/claude_desktop_config.json`):
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"crbro": {
|
|
31
|
+
"command": "npx",
|
|
32
|
+
"args": ["-y", "crbro-memory"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Cursor** (`.cursor/mcp.json`):
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"mcpServers": {
|
|
42
|
+
"crbro": {
|
|
43
|
+
"command": "npx",
|
|
44
|
+
"args": ["-y", "crbro-memory"]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Start using it
|
|
51
|
+
|
|
52
|
+
Your AI will now have access to 15 memory tools. Start any session with `crbro_boot`.
|
|
53
|
+
|
|
54
|
+
## Tools
|
|
55
|
+
|
|
56
|
+
### Free (always available)
|
|
57
|
+
|
|
58
|
+
| Tool | Description |
|
|
59
|
+
|------|-------------|
|
|
60
|
+
| `crbro_boot` | Boot the brain at session start β loads hot topics and context |
|
|
61
|
+
| `crbro_status` | Brain status β neurons, synapses, sessions count |
|
|
62
|
+
| `crbro_learn` | Store a fact, decision, pattern, or preference |
|
|
63
|
+
| `crbro_neuron` | Read a specific neuron (topic) with all its knowledge |
|
|
64
|
+
| `crbro_neurons` | List neurons with optional filters (domain, type, heat) |
|
|
65
|
+
| `crbro_recall` | Search the brain using hybrid text search |
|
|
66
|
+
| `crbro_connect` | Create or strengthen a connection between neurons |
|
|
67
|
+
| `crbro_connections` | Get all connections for a neuron |
|
|
68
|
+
| `crbro_session_log` | Log a session summary |
|
|
69
|
+
| `crbro_sessions` | List recent sessions |
|
|
70
|
+
| `crbro_context` | Read/update active working context |
|
|
71
|
+
| `crbro_hot_topics` | Get the most active topics by heat score |
|
|
72
|
+
| `crbro_consolidate` | End-of-session consolidation |
|
|
73
|
+
|
|
74
|
+
### Premium (requires Synthetica Zero Deck license)
|
|
75
|
+
|
|
76
|
+
| Tool | Description |
|
|
77
|
+
|------|-------------|
|
|
78
|
+
| `crbro_global_map` | View the neural network β clusters and cross-domain bridges |
|
|
79
|
+
| `crbro_maintenance` | Full brain maintenance β archive, prune, rebuild |
|
|
80
|
+
|
|
81
|
+
## Architecture
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
~/.crbro/
|
|
85
|
+
βββ manifest.json β Brain metadata
|
|
86
|
+
βββ cortex/ β One JSON per neuron (topic)
|
|
87
|
+
β βββ project_octochat.json
|
|
88
|
+
β βββ tech_firebase.json
|
|
89
|
+
βββ synapses/ β One JSON per connection
|
|
90
|
+
β βββ syn_octochat__firebase.json
|
|
91
|
+
βββ hippocampus/ β One JSON per session
|
|
92
|
+
β βββ session_2026-05-06.json
|
|
93
|
+
βββ prefrontal/ β Working memory
|
|
94
|
+
β βββ active_context.json
|
|
95
|
+
β βββ hot_topics.json
|
|
96
|
+
β βββ global_map.json
|
|
97
|
+
βββ archives/ β Cold neurons
|
|
98
|
+
βββ .search/ β Orama search index
|
|
99
|
+
βββ orama.index.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Heat Score Algorithm
|
|
103
|
+
|
|
104
|
+
Each neuron has a heat score (0.0 - 1.0) calculated from:
|
|
105
|
+
|
|
106
|
+
- **Frequency (35%)** β How often the neuron is accessed
|
|
107
|
+
- **Recency (40%)** β When it was last accessed (today = 1.0, >3 months = 0.05)
|
|
108
|
+
- **Connectivity (25%)** β How many synapses connect to it
|
|
109
|
+
|
|
110
|
+
## CLI Commands
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx crbro-memory # Start MCP server
|
|
114
|
+
npx crbro-memory init # Initialize brain
|
|
115
|
+
npx crbro-memory status # Show brain status
|
|
116
|
+
npx crbro-memory --help # Help
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
MIT β Part of Octonove Agency.
|
package/dist/engine/license.d.ts
CHANGED
|
@@ -2,28 +2,37 @@ import type { Brain } from './brain.js';
|
|
|
2
2
|
import type { LicenseInfo } from '../types/index.js';
|
|
3
3
|
export declare class LicenseEngine {
|
|
4
4
|
private brain;
|
|
5
|
+
private cacheFile;
|
|
5
6
|
constructor(brain: Brain);
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Check if the license is valid (server-verified).
|
|
9
|
+
* Uses local cache if verified within 7 days.
|
|
8
10
|
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Check if a specific tool is available.
|
|
12
|
-
*/
|
|
13
|
-
canUse(toolName: string): Promise<boolean>;
|
|
11
|
+
isPremium(): Promise<boolean>;
|
|
14
12
|
/**
|
|
15
13
|
* Get current license info.
|
|
16
14
|
*/
|
|
17
15
|
getLicenseInfo(): Promise<LicenseInfo>;
|
|
18
16
|
/**
|
|
19
|
-
*
|
|
17
|
+
* Legacy compatibility β canUse now just checks isPremium for everything.
|
|
20
18
|
*/
|
|
21
|
-
|
|
19
|
+
canUse(_toolName: string): Promise<boolean>;
|
|
22
20
|
/**
|
|
23
21
|
* Resolve the license key β env var takes priority over manifest.
|
|
24
22
|
*/
|
|
25
23
|
private resolveKey;
|
|
26
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Basic format validation β prefix + length + characters.
|
|
26
|
+
* Does NOT verify the key is real. Use verifyWithServer() for that.
|
|
27
|
+
*/
|
|
28
|
+
private validateFormat;
|
|
29
|
+
/**
|
|
30
|
+
* Verify license key against Firestore REST API.
|
|
31
|
+
* Checks if document exists in license-checks/{key} with status 'active'.
|
|
32
|
+
*/
|
|
33
|
+
private verifyWithServer;
|
|
34
|
+
private readCache;
|
|
35
|
+
private writeCache;
|
|
27
36
|
private getInfo;
|
|
28
37
|
}
|
|
29
38
|
//# sourceMappingURL=license.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../src/engine/license.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../src/engine/license.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsBrD,qBAAa,aAAa;IAGZ,OAAO,CAAC,KAAK;IAFzB,OAAO,CAAC,SAAS,CAAS;gBAEN,KAAK,EAAE,KAAK;IAIhC;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IA8BnC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IAM5C;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMjD;;OAEG;YACW,UAAU;IAUxB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAStB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;YAuDV,SAAS;YAUT,UAAU;IAQxB,OAAO,CAAC,OAAO;CAUhB"}
|
package/dist/engine/license.js
CHANGED
|
@@ -1,70 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// βββ CRBRO License Engine ββββββββββββββββββββββββββββββββββββββββ
|
|
3
|
-
//
|
|
3
|
+
// Server-side license validation against Firestore + local cache
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
4
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
38
|
exports.LicenseEngine = void 0;
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'crbro_connect',
|
|
15
|
-
'crbro_connections',
|
|
16
|
-
'crbro_session_log',
|
|
17
|
-
'crbro_sessions',
|
|
18
|
-
'crbro_context',
|
|
19
|
-
'crbro_hot_topics',
|
|
20
|
-
'crbro_consolidate',
|
|
21
|
-
]);
|
|
22
|
-
// Premium features requiring license
|
|
23
|
-
const PREMIUM_FEATURES = new Set([
|
|
24
|
-
'crbro_global_map',
|
|
25
|
-
'crbro_maintenance',
|
|
26
|
-
]);
|
|
39
|
+
const https = __importStar(require("https"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
// Firestore project for license validation
|
|
43
|
+
const FIRESTORE_PROJECT = 'synthetica-decks';
|
|
44
|
+
const COLLECTION = 'license-checks';
|
|
45
|
+
// Cache duration: 7 days in milliseconds
|
|
46
|
+
const CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
27
47
|
// Valid license key prefix β Synthetica Zero Deck keys
|
|
28
48
|
const LICENSE_PREFIX = 'SYNTH-ZERO-';
|
|
29
49
|
class LicenseEngine {
|
|
30
50
|
brain;
|
|
51
|
+
cacheFile;
|
|
31
52
|
constructor(brain) {
|
|
32
53
|
this.brain = brain;
|
|
54
|
+
this.cacheFile = path.join(brain.paths.root, '.license-cache.json');
|
|
33
55
|
}
|
|
34
56
|
/**
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
async setLicense(key) {
|
|
38
|
-
const isValid = this.validateKey(key);
|
|
39
|
-
if (isValid) {
|
|
40
|
-
await this.brain.updateManifest({ license_key: key });
|
|
41
|
-
}
|
|
42
|
-
return this.getInfo(isValid ? key : null);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Check if a specific tool is available.
|
|
57
|
+
* Check if the license is valid (server-verified).
|
|
58
|
+
* Uses local cache if verified within 7 days.
|
|
46
59
|
*/
|
|
47
|
-
async
|
|
48
|
-
if (FREE_FEATURES.has(toolName))
|
|
49
|
-
return true;
|
|
50
|
-
if (!PREMIUM_FEATURES.has(toolName))
|
|
51
|
-
return true; // Unknown tools default to allowed
|
|
60
|
+
async isPremium() {
|
|
52
61
|
const key = await this.resolveKey();
|
|
53
|
-
|
|
62
|
+
if (!key)
|
|
63
|
+
return false;
|
|
64
|
+
// Quick format check before wasting a network call
|
|
65
|
+
if (!this.validateFormat(key))
|
|
66
|
+
return false;
|
|
67
|
+
// Check local cache first
|
|
68
|
+
const cached = await this.readCache();
|
|
69
|
+
if (cached && cached.key === key && cached.valid) {
|
|
70
|
+
const age = Date.now() - cached.verifiedAt;
|
|
71
|
+
if (age < CACHE_TTL_MS) {
|
|
72
|
+
return true; // Cache still valid
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Cache expired or missing β verify against Firestore
|
|
76
|
+
const serverResult = await this.verifyWithServer(key);
|
|
77
|
+
// Save result to cache
|
|
78
|
+
await this.writeCache({
|
|
79
|
+
key,
|
|
80
|
+
valid: serverResult,
|
|
81
|
+
verifiedAt: Date.now(),
|
|
82
|
+
status: serverResult ? 'active' : 'invalid',
|
|
83
|
+
});
|
|
84
|
+
return serverResult;
|
|
54
85
|
}
|
|
55
86
|
/**
|
|
56
87
|
* Get current license info.
|
|
57
88
|
*/
|
|
58
89
|
async getLicenseInfo() {
|
|
59
90
|
const key = await this.resolveKey();
|
|
60
|
-
|
|
91
|
+
const valid = await this.isPremium();
|
|
92
|
+
return this.getInfo(valid ? key : null);
|
|
61
93
|
}
|
|
62
94
|
/**
|
|
63
|
-
*
|
|
95
|
+
* Legacy compatibility β canUse now just checks isPremium for everything.
|
|
64
96
|
*/
|
|
65
|
-
async
|
|
66
|
-
|
|
67
|
-
return this.validateKey(key);
|
|
97
|
+
async canUse(_toolName) {
|
|
98
|
+
return this.isPremium();
|
|
68
99
|
}
|
|
69
100
|
// βββ Private βββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
70
101
|
/**
|
|
@@ -73,29 +104,108 @@ class LicenseEngine {
|
|
|
73
104
|
async resolveKey() {
|
|
74
105
|
// 1. Check environment variable first (set in mcp_config.json env block)
|
|
75
106
|
const envKey = process.env.CRBRO_LICENSE_KEY || null;
|
|
76
|
-
if (envKey && this.
|
|
107
|
+
if (envKey && this.validateFormat(envKey))
|
|
77
108
|
return envKey;
|
|
78
109
|
// 2. Fall back to manifest (set via CLI activate)
|
|
79
110
|
const manifest = await this.brain.getManifest();
|
|
80
111
|
return manifest.license_key || null;
|
|
81
112
|
}
|
|
82
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Basic format validation β prefix + length + characters.
|
|
115
|
+
* Does NOT verify the key is real. Use verifyWithServer() for that.
|
|
116
|
+
*/
|
|
117
|
+
validateFormat(key) {
|
|
83
118
|
if (!key)
|
|
84
119
|
return false;
|
|
85
|
-
// Basic validation β prefix check + length
|
|
86
120
|
if (!key.startsWith(LICENSE_PREFIX))
|
|
87
121
|
return false;
|
|
88
122
|
if (key.length < 20)
|
|
89
123
|
return false;
|
|
90
|
-
// Checksum validation (simple)
|
|
91
124
|
const payload = key.substring(LICENSE_PREFIX.length);
|
|
92
|
-
// Must be alphanumeric + hyphens
|
|
93
125
|
if (!/^[A-Z0-9-]+$/.test(payload))
|
|
94
126
|
return false;
|
|
95
127
|
return true;
|
|
96
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Verify license key against Firestore REST API.
|
|
131
|
+
* Checks if document exists in license-checks/{key} with status 'active'.
|
|
132
|
+
*/
|
|
133
|
+
verifyWithServer(key) {
|
|
134
|
+
return new Promise((resolve) => {
|
|
135
|
+
const encodedKey = encodeURIComponent(key);
|
|
136
|
+
const url = `https://firestore.googleapis.com/v1/projects/${FIRESTORE_PROJECT}/databases/(default)/documents/${COLLECTION}/${encodedKey}`;
|
|
137
|
+
const req = https.get(url, { timeout: 10000 }, (res) => {
|
|
138
|
+
let data = '';
|
|
139
|
+
res.on('data', (chunk) => { data += chunk.toString(); });
|
|
140
|
+
res.on('end', () => {
|
|
141
|
+
try {
|
|
142
|
+
if (res.statusCode === 200) {
|
|
143
|
+
const doc = JSON.parse(data);
|
|
144
|
+
// Check that the document has status = 'active'
|
|
145
|
+
const status = doc?.fields?.status?.stringValue;
|
|
146
|
+
resolve(status === 'active');
|
|
147
|
+
}
|
|
148
|
+
else if (res.statusCode === 404) {
|
|
149
|
+
// Document doesn't exist β key is not valid
|
|
150
|
+
resolve(false);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
// Server error or unexpected response β fail closed
|
|
154
|
+
resolve(false);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
resolve(false);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
req.on('error', () => {
|
|
163
|
+
// Network error β check cache as fallback
|
|
164
|
+
this.readCache().then((cached) => {
|
|
165
|
+
if (cached && cached.key === key && cached.valid) {
|
|
166
|
+
resolve(true); // Trust cache if offline
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
resolve(false);
|
|
170
|
+
}
|
|
171
|
+
}).catch(() => resolve(false));
|
|
172
|
+
});
|
|
173
|
+
req.on('timeout', () => {
|
|
174
|
+
req.destroy();
|
|
175
|
+
// Timeout β same fallback as network error
|
|
176
|
+
this.readCache().then((cached) => {
|
|
177
|
+
if (cached && cached.key === key && cached.valid) {
|
|
178
|
+
resolve(true);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
resolve(false);
|
|
182
|
+
}
|
|
183
|
+
}).catch(() => resolve(false));
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
// βββ Cache management ββββββββββββββββββββββββββββββββββββββββββ
|
|
188
|
+
async readCache() {
|
|
189
|
+
try {
|
|
190
|
+
if (!fs.existsSync(this.cacheFile))
|
|
191
|
+
return null;
|
|
192
|
+
const raw = fs.readFileSync(this.cacheFile, 'utf-8');
|
|
193
|
+
return JSON.parse(raw);
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async writeCache(cache) {
|
|
200
|
+
try {
|
|
201
|
+
fs.writeFileSync(this.cacheFile, JSON.stringify(cache, null, 2), 'utf-8');
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
// Silent fail β cache is a convenience, not critical
|
|
205
|
+
}
|
|
206
|
+
}
|
|
97
207
|
getInfo(key) {
|
|
98
|
-
const valid =
|
|
208
|
+
const valid = !!key;
|
|
99
209
|
return {
|
|
100
210
|
valid,
|
|
101
211
|
tier: valid ? 'premium' : 'free',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license.js","sourceRoot":"","sources":["../../src/engine/license.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"license.js","sourceRoot":"","sources":["../../src/engine/license.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,iEAAiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKjE,6CAA+B;AAC/B,2CAA6B;AAC7B,uCAAyB;AAEzB,2CAA2C;AAC3C,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAC7C,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC,yCAAyC;AACzC,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7C,uDAAuD;AACvD,MAAM,cAAc,GAAG,aAAa,CAAC;AASrC,MAAa,aAAa;IAGJ;IAFZ,SAAS,CAAS;IAE1B,YAAoB,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;QAC9B,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CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAC5E,CAAC;QAAC,MAAM,CAAC;YACP,qDAAqD;QACvD,CAAC;IACH,CAAC;IAEO,OAAO,CAAC,GAAkB;QAChC,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC;QACpB,OAAO;YACL,KAAK;YACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;YAChC,QAAQ,EAAE,KAAK;gBACb,CAAC,CAAC,CAAC,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,CAAC;gBACtE,CAAC,CAAC,EAAE;SACP,CAAC;IACJ,CAAC;CACF;AA5KD,sCA4KC"}
|
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "crbro-memory",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "CRBRO β Persistent neural memory for AI. A biological file-based MCP server that gives your AI long-term memory across sessions.",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"crbro-memory": "./bin/crbro.js"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"dev": "tsc --watch",
|
|
13
|
-
"start": "node dist/index.js",
|
|
14
|
-
"test": "vitest run",
|
|
15
|
-
"test:watch": "vitest",
|
|
16
|
-
"prepublishOnly": "npm run build"
|
|
17
|
-
},
|
|
18
|
-
"keywords": [
|
|
19
|
-
"mcp",
|
|
20
|
-
"memory",
|
|
21
|
-
"ai",
|
|
22
|
-
"persistent-memory",
|
|
23
|
-
"model-context-protocol",
|
|
24
|
-
"llm",
|
|
25
|
-
"synthetica"
|
|
26
|
-
],
|
|
27
|
-
"author": "Synthetica Decks",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "https://github.com/Octonove/crbro-memory"
|
|
32
|
-
},
|
|
33
|
-
"engines": {
|
|
34
|
-
"node": ">=18.0.0"
|
|
35
|
-
},
|
|
36
|
-
"files": [
|
|
37
|
-
"dist/",
|
|
38
|
-
"bin/",
|
|
39
|
-
"README.md",
|
|
40
|
-
"LICENSE"
|
|
41
|
-
],
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
44
|
-
"@orama/orama": "^3.1.18",
|
|
45
|
-
"zod": "^4.4.3"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@types/node": "^25.6.0",
|
|
49
|
-
"typescript": "^6.0.3",
|
|
50
|
-
"vitest": "^4.1.5"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "crbro-memory",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "CRBRO β Persistent neural memory for AI. A biological file-based MCP server that gives your AI long-term memory across sessions.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"crbro-memory": "./bin/crbro.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch",
|
|
13
|
+
"start": "node dist/index.js",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest",
|
|
16
|
+
"prepublishOnly": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"mcp",
|
|
20
|
+
"memory",
|
|
21
|
+
"ai",
|
|
22
|
+
"persistent-memory",
|
|
23
|
+
"model-context-protocol",
|
|
24
|
+
"llm",
|
|
25
|
+
"synthetica"
|
|
26
|
+
],
|
|
27
|
+
"author": "Synthetica Decks",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/Octonove/crbro-memory"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18.0.0"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist/",
|
|
38
|
+
"bin/",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
44
|
+
"@orama/orama": "^3.1.18",
|
|
45
|
+
"zod": "^4.4.3"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^25.6.0",
|
|
49
|
+
"typescript": "^6.0.3",
|
|
50
|
+
"vitest": "^4.1.5"
|
|
51
|
+
}
|
|
52
|
+
}
|