crbro-memory 1.1.0 → 1.2.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/bin/crbro.js +280 -41
- package/dist/engine/license.d.ts +22 -6
- package/dist/engine/license.d.ts.map +1 -1
- package/dist/engine/license.js +133 -50
- package/dist/engine/license.js.map +1 -1
- package/dist/miner/extractor.d.ts +12 -0
- package/dist/miner/extractor.d.ts.map +1 -0
- package/dist/miner/extractor.js +167 -0
- package/dist/miner/extractor.js.map +1 -0
- package/dist/miner/index.d.ts +60 -0
- package/dist/miner/index.d.ts.map +1 -0
- package/dist/miner/index.js +285 -0
- package/dist/miner/index.js.map +1 -0
- package/dist/miner/scheduler.d.ts +30 -0
- package/dist/miner/scheduler.d.ts.map +1 -0
- package/dist/miner/scheduler.js +293 -0
- package/dist/miner/scheduler.js.map +1 -0
- package/dist/miner/types.d.ts +11 -0
- package/dist/miner/types.d.ts.map +1 -0
- package/dist/miner/types.js +4 -0
- package/dist/miner/types.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +17 -8
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─── CRBRO Miner: Main Engine ─────────────────────────────────
|
|
3
|
+
// Scans directories for conversation artifacts and feeds
|
|
4
|
+
// extracted knowledge into CRBRO's cortex.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Miner = void 0;
|
|
7
|
+
exports.detectScanDirs = detectScanDirs;
|
|
8
|
+
const promises_1 = require("fs/promises");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const os_1 = require("os");
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const extractor_js_1 = require("./extractor.js");
|
|
13
|
+
const brain_js_1 = require("../engine/brain.js");
|
|
14
|
+
const cortex_js_1 = require("../engine/cortex.js");
|
|
15
|
+
const DEFAULT_CONFIG = {
|
|
16
|
+
scanDirs: [],
|
|
17
|
+
minFileSize: 200,
|
|
18
|
+
extensions: ['.md', '.txt'],
|
|
19
|
+
excludePatterns: [
|
|
20
|
+
'.metadata.',
|
|
21
|
+
'.resolved',
|
|
22
|
+
'.tmp',
|
|
23
|
+
'node_modules',
|
|
24
|
+
'.git',
|
|
25
|
+
'tempmediaStorage',
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Auto-detect IDE conversation directories on the system.
|
|
30
|
+
*/
|
|
31
|
+
function detectScanDirs() {
|
|
32
|
+
const home = (0, os_1.homedir)();
|
|
33
|
+
const dirs = [];
|
|
34
|
+
const candidates = [
|
|
35
|
+
// Antigravity (Google Gemini)
|
|
36
|
+
(0, path_1.join)(home, '.gemini', 'antigravity', 'brain'),
|
|
37
|
+
// Cursor
|
|
38
|
+
(0, path_1.join)(home, '.cursor', 'conversations'),
|
|
39
|
+
// Windsurf
|
|
40
|
+
(0, path_1.join)(home, '.windsurf', 'conversations'),
|
|
41
|
+
// Claude Desktop (Windows)
|
|
42
|
+
(0, path_1.join)(process.env.APPDATA || '', 'Claude', 'conversations'),
|
|
43
|
+
// Claude Desktop (macOS)
|
|
44
|
+
(0, path_1.join)(home, 'Library', 'Application Support', 'Claude', 'conversations'),
|
|
45
|
+
// VS Code + Continue
|
|
46
|
+
(0, path_1.join)(home, '.continue', 'sessions'),
|
|
47
|
+
];
|
|
48
|
+
for (const dir of candidates) {
|
|
49
|
+
if (dir && (0, fs_1.existsSync)(dir)) {
|
|
50
|
+
dirs.push(dir);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return dirs;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Main miner class — scans directories and feeds CRBRO.
|
|
57
|
+
*/
|
|
58
|
+
class Miner {
|
|
59
|
+
brain;
|
|
60
|
+
cortex;
|
|
61
|
+
config;
|
|
62
|
+
statePath;
|
|
63
|
+
constructor(config) {
|
|
64
|
+
this.brain = new brain_js_1.Brain();
|
|
65
|
+
this.cortex = new cortex_js_1.Cortex(this.brain);
|
|
66
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
67
|
+
this.statePath = (0, path_1.join)(this.brain.paths.root, 'miner_state.json');
|
|
68
|
+
// Auto-detect scan dirs if none provided
|
|
69
|
+
if (this.config.scanDirs.length === 0) {
|
|
70
|
+
this.config.scanDirs = detectScanDirs();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Run the miner on all configured directories.
|
|
75
|
+
*/
|
|
76
|
+
async mine(targetDir) {
|
|
77
|
+
const result = {
|
|
78
|
+
scanned: 0,
|
|
79
|
+
new_files: 0,
|
|
80
|
+
neurons_created: 0,
|
|
81
|
+
neurons_updated: 0,
|
|
82
|
+
facts_added: 0,
|
|
83
|
+
decisions_added: 0,
|
|
84
|
+
technologies_found: [],
|
|
85
|
+
errors: [],
|
|
86
|
+
};
|
|
87
|
+
// Load state
|
|
88
|
+
const state = await this.loadState();
|
|
89
|
+
// Determine which directories to scan
|
|
90
|
+
const dirs = targetDir ? [targetDir] : this.config.scanDirs;
|
|
91
|
+
if (dirs.length === 0) {
|
|
92
|
+
result.errors.push('No scan directories found. Run `npx crbro-memory setup-miner` to configure.');
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
const allTechs = new Set();
|
|
96
|
+
for (const dir of dirs) {
|
|
97
|
+
if (!(0, fs_1.existsSync)(dir)) {
|
|
98
|
+
result.errors.push(`Directory not found: ${dir}`);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const files = await this.collectFiles(dir);
|
|
103
|
+
for (const filePath of files) {
|
|
104
|
+
result.scanned++;
|
|
105
|
+
// Check if already mined (unchanged)
|
|
106
|
+
const fileStat = await (0, promises_1.stat)(filePath);
|
|
107
|
+
const hash = `${fileStat.mtime.toISOString()}_${fileStat.size}`;
|
|
108
|
+
if (state.mined_files[filePath] === hash) {
|
|
109
|
+
continue; // Already mined, skip
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const content = await (0, promises_1.readFile)(filePath, 'utf-8');
|
|
113
|
+
const extracted = (0, extractor_js_1.extractContent)(content, (0, path_1.basename)(filePath));
|
|
114
|
+
// Feed into CRBRO
|
|
115
|
+
const feedResult = await this.feedCortex(extracted, filePath);
|
|
116
|
+
result.new_files++;
|
|
117
|
+
result.neurons_created += feedResult.created;
|
|
118
|
+
result.neurons_updated += feedResult.updated;
|
|
119
|
+
result.facts_added += feedResult.facts;
|
|
120
|
+
result.decisions_added += feedResult.decisions;
|
|
121
|
+
for (const tech of extracted.technologies) {
|
|
122
|
+
allTechs.add(tech);
|
|
123
|
+
}
|
|
124
|
+
// Mark as mined
|
|
125
|
+
state.mined_files[filePath] = hash;
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
result.errors.push(`Error processing ${filePath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
result.errors.push(`Error scanning ${dir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
result.technologies_found = [...allTechs];
|
|
137
|
+
// Save state
|
|
138
|
+
state.last_run = new Date().toISOString();
|
|
139
|
+
state.total_mined += result.new_files;
|
|
140
|
+
await this.saveState(state);
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Recursively collect files matching the config criteria.
|
|
145
|
+
*/
|
|
146
|
+
async collectFiles(dir) {
|
|
147
|
+
const results = [];
|
|
148
|
+
try {
|
|
149
|
+
const entries = await (0, promises_1.readdir)(dir, { withFileTypes: true });
|
|
150
|
+
for (const entry of entries) {
|
|
151
|
+
const fullPath = (0, path_1.join)(dir, entry.name);
|
|
152
|
+
// Check exclusion patterns
|
|
153
|
+
if (this.config.excludePatterns.some(p => entry.name.includes(p))) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (entry.isDirectory()) {
|
|
157
|
+
const subFiles = await this.collectFiles(fullPath);
|
|
158
|
+
results.push(...subFiles);
|
|
159
|
+
}
|
|
160
|
+
else if (entry.isFile()) {
|
|
161
|
+
const ext = (0, path_1.extname)(entry.name).toLowerCase();
|
|
162
|
+
if (!this.config.extensions.includes(ext))
|
|
163
|
+
continue;
|
|
164
|
+
const fileStat = await (0, promises_1.stat)(fullPath);
|
|
165
|
+
if (fileStat.size < this.config.minFileSize)
|
|
166
|
+
continue;
|
|
167
|
+
results.push(fullPath);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
// Permission errors, etc. — skip silently
|
|
173
|
+
}
|
|
174
|
+
return results;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Feed extracted content into CRBRO's cortex.
|
|
178
|
+
*/
|
|
179
|
+
async feedCortex(extracted, sourcePath) {
|
|
180
|
+
let created = 0;
|
|
181
|
+
let updated = 0;
|
|
182
|
+
let factsAdded = 0;
|
|
183
|
+
let decisionsAdded = 0;
|
|
184
|
+
// Create/update neurons for each detected technology
|
|
185
|
+
for (const tech of extracted.technologies) {
|
|
186
|
+
const neuronId = `tech_${tech.replace(/[^a-z0-9]/gi, '_').toLowerCase()}`;
|
|
187
|
+
try {
|
|
188
|
+
const existing = await this.cortex.get(neuronId);
|
|
189
|
+
if (!existing) {
|
|
190
|
+
await this.cortex.learn(tech, 'fact', `Referenced in: ${(0, path_1.basename)(sourcePath)}`, {
|
|
191
|
+
domain: 'conocimiento',
|
|
192
|
+
});
|
|
193
|
+
created++;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
// Neuron might not exist yet
|
|
198
|
+
try {
|
|
199
|
+
await this.cortex.learn(tech, 'fact', `Referenced in: ${(0, path_1.basename)(sourcePath)}`, {
|
|
200
|
+
domain: 'conocimiento',
|
|
201
|
+
});
|
|
202
|
+
created++;
|
|
203
|
+
}
|
|
204
|
+
catch { /* skip */ }
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Create neurons from extracted topics (if substantial)
|
|
208
|
+
for (const topic of extracted.topics.slice(0, 3)) {
|
|
209
|
+
if (topic.length < 5)
|
|
210
|
+
continue;
|
|
211
|
+
try {
|
|
212
|
+
const result = await this.cortex.learn(topic, 'fact', extracted.summary || `Mined from ${(0, path_1.basename)(sourcePath)}`, {
|
|
213
|
+
domain: 'general',
|
|
214
|
+
});
|
|
215
|
+
if (result.action === 'created')
|
|
216
|
+
created++;
|
|
217
|
+
else
|
|
218
|
+
updated++;
|
|
219
|
+
}
|
|
220
|
+
catch { /* skip duplicates */ }
|
|
221
|
+
}
|
|
222
|
+
// Add facts to first topic neuron
|
|
223
|
+
if (extracted.topics.length > 0) {
|
|
224
|
+
const primaryTopic = extracted.topics[0];
|
|
225
|
+
for (const fact of extracted.facts.slice(0, 5)) {
|
|
226
|
+
try {
|
|
227
|
+
await this.cortex.learn(primaryTopic, 'fact', fact, {
|
|
228
|
+
confidence: 0.7, // Lower confidence for auto-mined data
|
|
229
|
+
});
|
|
230
|
+
factsAdded++;
|
|
231
|
+
}
|
|
232
|
+
catch { /* skip */ }
|
|
233
|
+
}
|
|
234
|
+
for (const decision of extracted.decisions.slice(0, 3)) {
|
|
235
|
+
try {
|
|
236
|
+
await this.cortex.learn(primaryTopic, 'decision', decision, {
|
|
237
|
+
rationale: `Auto-mined from ${(0, path_1.basename)(sourcePath)}`,
|
|
238
|
+
});
|
|
239
|
+
decisionsAdded++;
|
|
240
|
+
}
|
|
241
|
+
catch { /* skip */ }
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return { created, updated, facts: factsAdded, decisions: decisionsAdded };
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Load miner state from disk.
|
|
248
|
+
*/
|
|
249
|
+
async loadState() {
|
|
250
|
+
try {
|
|
251
|
+
if ((0, fs_1.existsSync)(this.statePath)) {
|
|
252
|
+
const raw = await (0, promises_1.readFile)(this.statePath, 'utf-8');
|
|
253
|
+
return JSON.parse(raw);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch { /* corrupt state — start fresh */ }
|
|
257
|
+
return {
|
|
258
|
+
mined_files: {},
|
|
259
|
+
last_run: null,
|
|
260
|
+
total_mined: 0,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Save miner state to disk.
|
|
265
|
+
*/
|
|
266
|
+
async saveState(state) {
|
|
267
|
+
const dir = this.brain.paths.root;
|
|
268
|
+
if (!(0, fs_1.existsSync)(dir)) {
|
|
269
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
270
|
+
}
|
|
271
|
+
await (0, promises_1.writeFile)(this.statePath, JSON.stringify(state, null, 2), 'utf-8');
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Get miner status info.
|
|
275
|
+
*/
|
|
276
|
+
async getStatus() {
|
|
277
|
+
return {
|
|
278
|
+
configured_dirs: this.config.scanDirs,
|
|
279
|
+
detected_dirs: detectScanDirs(),
|
|
280
|
+
state: await this.loadState(),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
exports.Miner = Miner;
|
|
285
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/miner/index.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,yDAAyD;AACzD,2CAA2C;;;AA+C3C,wCA0BC;AAvED,0CAAwE;AACxE,+BAA+C;AAC/C,2BAA6B;AAC7B,2BAAgC;AAChC,iDAAuE;AACvE,iDAA2C;AAC3C,mDAA6C;AAsB7C,MAAM,cAAc,GAAgB;IAClC,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,GAAG;IAChB,UAAU,EAAE,C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IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC/B,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBACpD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,iCAAiC,CAAC,CAAC;QAE7C,OAAO;YACL,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,CAAC;SACf,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,SAAS,CAAC,KAAiB;QACvC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,IAAA,eAAU,EAAC,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAA,gBAAK,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC;QACD,MAAM,IAAA,oBAAS,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS;QAKb,OAAO;YACL,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YACrC,aAAa,EAAE,cAAc,EAAE;YAC/B,KAAK,EAAE,MAAM,IAAI,CAAC,SAAS,EAAE;SAC9B,CAAC;IACJ,CAAC;CACF;AAjQD,sBAiQC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SchedulerResult {
|
|
2
|
+
success: boolean;
|
|
3
|
+
platform: string;
|
|
4
|
+
method: string;
|
|
5
|
+
frequency: string;
|
|
6
|
+
message: string;
|
|
7
|
+
uninstall_command?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Detect the platform and set up the appropriate scheduler.
|
|
11
|
+
*/
|
|
12
|
+
export declare function setupScheduler(): Promise<SchedulerResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Check if the scheduler is already installed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getSchedulerStatus(): Promise<{
|
|
17
|
+
installed: boolean;
|
|
18
|
+
platform: string;
|
|
19
|
+
last_run: string | null;
|
|
20
|
+
next_run: string | null;
|
|
21
|
+
details: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Remove the scheduled task.
|
|
25
|
+
*/
|
|
26
|
+
export declare function removeScheduler(): Promise<{
|
|
27
|
+
success: boolean;
|
|
28
|
+
message: string;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../src/miner/scheduler.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAKD;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC,CAmB/D;AAED;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,CAmBD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BtF"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─── CRBRO Miner: Cross-Platform Scheduler ───────────────────
|
|
3
|
+
// Sets up automatic mining as a scheduled task on any OS.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.setupScheduler = setupScheduler;
|
|
6
|
+
exports.getSchedulerStatus = getSchedulerStatus;
|
|
7
|
+
exports.removeScheduler = removeScheduler;
|
|
8
|
+
const promises_1 = require("fs/promises");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const os_1 = require("os");
|
|
11
|
+
const child_process_1 = require("child_process");
|
|
12
|
+
const fs_1 = require("fs");
|
|
13
|
+
const TASK_NAME = 'CRBRO-AutoMiner';
|
|
14
|
+
const FREQUENCY_HOURS = 2;
|
|
15
|
+
/**
|
|
16
|
+
* Detect the platform and set up the appropriate scheduler.
|
|
17
|
+
*/
|
|
18
|
+
async function setupScheduler() {
|
|
19
|
+
const os = (0, os_1.platform)();
|
|
20
|
+
switch (os) {
|
|
21
|
+
case 'win32':
|
|
22
|
+
return setupWindows();
|
|
23
|
+
case 'darwin':
|
|
24
|
+
return setupMacOS();
|
|
25
|
+
case 'linux':
|
|
26
|
+
return setupLinux();
|
|
27
|
+
default:
|
|
28
|
+
return {
|
|
29
|
+
success: false,
|
|
30
|
+
platform: os,
|
|
31
|
+
method: 'unsupported',
|
|
32
|
+
frequency: `${FREQUENCY_HOURS}h`,
|
|
33
|
+
message: `Unsupported platform: ${os}. Please set up a cron job manually to run: npx crbro-memory mine`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check if the scheduler is already installed.
|
|
39
|
+
*/
|
|
40
|
+
async function getSchedulerStatus() {
|
|
41
|
+
const os = (0, os_1.platform)();
|
|
42
|
+
switch (os) {
|
|
43
|
+
case 'win32':
|
|
44
|
+
return getWindowsStatus();
|
|
45
|
+
case 'darwin':
|
|
46
|
+
return getMacOSStatus();
|
|
47
|
+
case 'linux':
|
|
48
|
+
return getLinuxStatus();
|
|
49
|
+
default:
|
|
50
|
+
return {
|
|
51
|
+
installed: false,
|
|
52
|
+
platform: os,
|
|
53
|
+
last_run: null,
|
|
54
|
+
next_run: null,
|
|
55
|
+
details: 'Unsupported platform',
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Remove the scheduled task.
|
|
61
|
+
*/
|
|
62
|
+
async function removeScheduler() {
|
|
63
|
+
const os = (0, os_1.platform)();
|
|
64
|
+
try {
|
|
65
|
+
switch (os) {
|
|
66
|
+
case 'win32':
|
|
67
|
+
(0, child_process_1.execSync)(`schtasks /Delete /TN "${TASK_NAME}" /F`, { stdio: 'pipe' });
|
|
68
|
+
return { success: true, message: `Removed Windows Task Scheduler entry: ${TASK_NAME}` };
|
|
69
|
+
case 'darwin': {
|
|
70
|
+
const plistPath = (0, path_1.join)((0, os_1.homedir)(), 'Library', 'LaunchAgents', `com.crbro.miner.plist`);
|
|
71
|
+
(0, child_process_1.execSync)(`launchctl unload "${plistPath}"`, { stdio: 'pipe' });
|
|
72
|
+
(0, child_process_1.execSync)(`rm "${plistPath}"`, { stdio: 'pipe' });
|
|
73
|
+
return { success: true, message: `Removed macOS LaunchAgent: ${plistPath}` };
|
|
74
|
+
}
|
|
75
|
+
case 'linux': {
|
|
76
|
+
const currentCron = (0, child_process_1.execSync)('crontab -l 2>/dev/null || echo ""', { encoding: 'utf-8' });
|
|
77
|
+
const filtered = currentCron.split('\n').filter(l => !l.includes('crbro-memory mine')).join('\n');
|
|
78
|
+
(0, child_process_1.execSync)(`echo "${filtered}" | crontab -`, { stdio: 'pipe' });
|
|
79
|
+
return { success: true, message: 'Removed crontab entry for CRBRO miner' };
|
|
80
|
+
}
|
|
81
|
+
default:
|
|
82
|
+
return { success: false, message: `Unsupported platform: ${os}` };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
return { success: false, message: `Error removing scheduler: ${err instanceof Error ? err.message : String(err)}` };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// ─── Windows: Task Scheduler ──────────────────────────────────
|
|
90
|
+
function setupWindows() {
|
|
91
|
+
try {
|
|
92
|
+
// Remove existing task if present
|
|
93
|
+
try {
|
|
94
|
+
(0, child_process_1.execSync)(`schtasks /Delete /TN "${TASK_NAME}" /F`, { stdio: 'pipe' });
|
|
95
|
+
}
|
|
96
|
+
catch { /* doesn't exist yet */ }
|
|
97
|
+
// Find npx path
|
|
98
|
+
const npxPath = findNpxPath();
|
|
99
|
+
// Create the task
|
|
100
|
+
(0, child_process_1.execSync)(`schtasks /Create /TN "${TASK_NAME}" ` +
|
|
101
|
+
`/TR "\"${npxPath}\" -y crbro-memory mine" ` +
|
|
102
|
+
`/SC HOURLY /MO ${FREQUENCY_HOURS} ` +
|
|
103
|
+
`/F /RL LIMITED`, { stdio: 'pipe' });
|
|
104
|
+
return {
|
|
105
|
+
success: true,
|
|
106
|
+
platform: 'windows',
|
|
107
|
+
method: 'Task Scheduler (schtasks)',
|
|
108
|
+
frequency: `Every ${FREQUENCY_HOURS} hours`,
|
|
109
|
+
message: `✅ CRBRO Auto-Miner scheduled!\n\n` +
|
|
110
|
+
` Task Name: ${TASK_NAME}\n` +
|
|
111
|
+
` Frequency: Every ${FREQUENCY_HOURS} hours\n` +
|
|
112
|
+
` Command: npx crbro-memory mine\n\n` +
|
|
113
|
+
` To check status: npx crbro-memory miner-status\n` +
|
|
114
|
+
` To remove: npx crbro-memory remove-miner`,
|
|
115
|
+
uninstall_command: `schtasks /Delete /TN "${TASK_NAME}" /F`,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
return {
|
|
120
|
+
success: false,
|
|
121
|
+
platform: 'windows',
|
|
122
|
+
method: 'Task Scheduler (schtasks)',
|
|
123
|
+
frequency: `${FREQUENCY_HOURS}h`,
|
|
124
|
+
message: `Failed to create scheduled task: ${err instanceof Error ? err.message : String(err)}.\n\nTry running as Administrator, or create the task manually:\n schtasks /Create /TN "${TASK_NAME}" /TR "npx -y crbro-memory mine" /SC HOURLY /MO ${FREQUENCY_HOURS}`,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function getWindowsStatus() {
|
|
129
|
+
try {
|
|
130
|
+
const output = (0, child_process_1.execSync)(`schtasks /Query /TN "${TASK_NAME}" /FO CSV /NH`, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
131
|
+
const parts = output.trim().split(',').map(s => s.replace(/"/g, ''));
|
|
132
|
+
return {
|
|
133
|
+
installed: true,
|
|
134
|
+
platform: 'windows',
|
|
135
|
+
last_run: null, // schtasks CSV doesn't give this easily
|
|
136
|
+
next_run: parts[2] || null,
|
|
137
|
+
details: `Task "${TASK_NAME}" is ${parts[3] || 'Ready'}`,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return {
|
|
142
|
+
installed: false,
|
|
143
|
+
platform: 'windows',
|
|
144
|
+
last_run: null,
|
|
145
|
+
next_run: null,
|
|
146
|
+
details: `Task "${TASK_NAME}" not found. Run: npx crbro-memory setup-miner`,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// ─── macOS: LaunchAgent ───────────────────────────────────────
|
|
151
|
+
async function setupMacOS() {
|
|
152
|
+
const plistPath = (0, path_1.join)((0, os_1.homedir)(), 'Library', 'LaunchAgents', 'com.crbro.miner.plist');
|
|
153
|
+
const npxPath = findNpxPath();
|
|
154
|
+
const plistContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
155
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
156
|
+
<plist version="1.0">
|
|
157
|
+
<dict>
|
|
158
|
+
<key>Label</key>
|
|
159
|
+
<string>com.crbro.miner</string>
|
|
160
|
+
<key>ProgramArguments</key>
|
|
161
|
+
<array>
|
|
162
|
+
<string>${npxPath}</string>
|
|
163
|
+
<string>-y</string>
|
|
164
|
+
<string>crbro-memory</string>
|
|
165
|
+
<string>mine</string>
|
|
166
|
+
</array>
|
|
167
|
+
<key>StartInterval</key>
|
|
168
|
+
<integer>${FREQUENCY_HOURS * 3600}</integer>
|
|
169
|
+
<key>RunAtLoad</key>
|
|
170
|
+
<true/>
|
|
171
|
+
<key>StandardOutPath</key>
|
|
172
|
+
<string>${(0, path_1.join)((0, os_1.homedir)(), '.crbro', 'miner.log')}</string>
|
|
173
|
+
<key>StandardErrorPath</key>
|
|
174
|
+
<string>${(0, path_1.join)((0, os_1.homedir)(), '.crbro', 'miner_error.log')}</string>
|
|
175
|
+
</dict>
|
|
176
|
+
</plist>`;
|
|
177
|
+
try {
|
|
178
|
+
await (0, promises_1.writeFile)(plistPath, plistContent, 'utf-8');
|
|
179
|
+
(0, child_process_1.execSync)(`launchctl load "${plistPath}"`, { stdio: 'pipe' });
|
|
180
|
+
return {
|
|
181
|
+
success: true,
|
|
182
|
+
platform: 'macos',
|
|
183
|
+
method: 'LaunchAgent (launchd)',
|
|
184
|
+
frequency: `Every ${FREQUENCY_HOURS} hours`,
|
|
185
|
+
message: `✅ CRBRO Auto-Miner scheduled!\n\n` +
|
|
186
|
+
` Plist: ${plistPath}\n` +
|
|
187
|
+
` Frequency: Every ${FREQUENCY_HOURS} hours\n` +
|
|
188
|
+
` Log: ~/.crbro/miner.log\n\n` +
|
|
189
|
+
` To check: npx crbro-memory miner-status\n` +
|
|
190
|
+
` To remove: npx crbro-memory remove-miner`,
|
|
191
|
+
uninstall_command: `launchctl unload "${plistPath}" && rm "${plistPath}"`,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
return {
|
|
196
|
+
success: false,
|
|
197
|
+
platform: 'macos',
|
|
198
|
+
method: 'LaunchAgent (launchd)',
|
|
199
|
+
frequency: `${FREQUENCY_HOURS}h`,
|
|
200
|
+
message: `Failed to create LaunchAgent: ${err instanceof Error ? err.message : String(err)}`,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function getMacOSStatus() {
|
|
205
|
+
const plistPath = (0, path_1.join)((0, os_1.homedir)(), 'Library', 'LaunchAgents', 'com.crbro.miner.plist');
|
|
206
|
+
const installed = (0, fs_1.existsSync)(plistPath);
|
|
207
|
+
return {
|
|
208
|
+
installed,
|
|
209
|
+
platform: 'macos',
|
|
210
|
+
last_run: null,
|
|
211
|
+
next_run: null,
|
|
212
|
+
details: installed
|
|
213
|
+
? `LaunchAgent installed at ${plistPath}`
|
|
214
|
+
: 'LaunchAgent not found. Run: npx crbro-memory setup-miner',
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
// ─── Linux: Crontab ───────────────────────────────────────────
|
|
218
|
+
function setupLinux() {
|
|
219
|
+
try {
|
|
220
|
+
const npxPath = findNpxPath();
|
|
221
|
+
const cronLine = `0 */${FREQUENCY_HOURS} * * * ${npxPath} -y crbro-memory mine >> ${(0, path_1.join)((0, os_1.homedir)(), '.crbro', 'miner.log')} 2>&1`;
|
|
222
|
+
// Get current crontab, filter out old CRBRO entries, add new one
|
|
223
|
+
let currentCron = '';
|
|
224
|
+
try {
|
|
225
|
+
currentCron = (0, child_process_1.execSync)('crontab -l 2>/dev/null', { encoding: 'utf-8' });
|
|
226
|
+
}
|
|
227
|
+
catch { /* no existing crontab */ }
|
|
228
|
+
const filtered = currentCron.split('\n').filter(l => !l.includes('crbro-memory mine'));
|
|
229
|
+
filtered.push(cronLine);
|
|
230
|
+
const newCron = filtered.filter(l => l.trim()).join('\n') + '\n';
|
|
231
|
+
(0, child_process_1.execSync)(`echo "${newCron}" | crontab -`, { stdio: 'pipe' });
|
|
232
|
+
return {
|
|
233
|
+
success: true,
|
|
234
|
+
platform: 'linux',
|
|
235
|
+
method: 'Crontab',
|
|
236
|
+
frequency: `Every ${FREQUENCY_HOURS} hours`,
|
|
237
|
+
message: `✅ CRBRO Auto-Miner scheduled!\n\n` +
|
|
238
|
+
` Cron: ${cronLine}\n` +
|
|
239
|
+
` Frequency: Every ${FREQUENCY_HOURS} hours\n` +
|
|
240
|
+
` Log: ~/.crbro/miner.log\n\n` +
|
|
241
|
+
` To check: npx crbro-memory miner-status\n` +
|
|
242
|
+
` To remove: npx crbro-memory remove-miner`,
|
|
243
|
+
uninstall_command: 'npx crbro-memory remove-miner',
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
return {
|
|
248
|
+
success: false,
|
|
249
|
+
platform: 'linux',
|
|
250
|
+
method: 'Crontab',
|
|
251
|
+
frequency: `${FREQUENCY_HOURS}h`,
|
|
252
|
+
message: `Failed to create crontab entry: ${err instanceof Error ? err.message : String(err)}`,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function getLinuxStatus() {
|
|
257
|
+
try {
|
|
258
|
+
const cron = (0, child_process_1.execSync)('crontab -l 2>/dev/null', { encoding: 'utf-8' });
|
|
259
|
+
const hasCrbro = cron.includes('crbro-memory mine');
|
|
260
|
+
return {
|
|
261
|
+
installed: hasCrbro,
|
|
262
|
+
platform: 'linux',
|
|
263
|
+
last_run: null,
|
|
264
|
+
next_run: null,
|
|
265
|
+
details: hasCrbro
|
|
266
|
+
? `Crontab entry found for CRBRO miner`
|
|
267
|
+
: 'No crontab entry found. Run: npx crbro-memory setup-miner',
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
return {
|
|
272
|
+
installed: false,
|
|
273
|
+
platform: 'linux',
|
|
274
|
+
last_run: null,
|
|
275
|
+
next_run: null,
|
|
276
|
+
details: 'Could not read crontab. Run: npx crbro-memory setup-miner',
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
// ─── Utilities ────────────────────────────────────────────────
|
|
281
|
+
function findNpxPath() {
|
|
282
|
+
try {
|
|
283
|
+
const os = (0, os_1.platform)();
|
|
284
|
+
if (os === 'win32') {
|
|
285
|
+
return (0, child_process_1.execSync)('where npx', { encoding: 'utf-8' }).trim().split('\n')[0].trim();
|
|
286
|
+
}
|
|
287
|
+
return (0, child_process_1.execSync)('which npx', { encoding: 'utf-8' }).trim();
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
return 'npx'; // Fallback to PATH
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../src/miner/scheduler.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,0DAA0D;;AAuB1D,wCAmBC;AAKD,gDAyBC;AAKD,0CA0BC;AArGD,0CAAwC;AACxC,+BAA4B;AAC5B,2BAA+C;AAC/C,iDAAyC;AACzC,2BAAgC;AAWhC,MAAM,SAAS,GAAG,iBAAiB,CAAC;AACpC,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B;;GAEG;AACI,KAAK,UAAU,cAAc;IAClC,MAAM,EAAE,GAAG,IAAA,aAAQ,GAAE,CAAC;IAEtB,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,OAAO;YACV,OAAO,YAAY,EAAE,CAAC;QACxB,KAAK,QAAQ;YACX,OAAO,UAAU,EAAE,CAAC;QACtB,KAAK,OAAO;YACV,OAAO,UAAU,EAAE,CAAC;QACtB;YACE,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,aAAa;gBACrB,SAAS,EAAE,GAAG,eAAe,GAAG;gBAChC,OAAO,EAAE,yBAAyB,EAAE,mEAAmE;aACxG,CAAC;IACN,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,kBAAkB;IAOtC,M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,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QACpD,OAAO;YACL,SAAS,EAAE,QAAQ;YACnB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,QAAQ;gBACf,CAAC,CAAC,qCAAqC;gBACvC,CAAC,CAAC,2DAA2D;SAChE,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,2DAA2D;SACrE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,iEAAiE;AAEjE,SAAS,WAAW;IAClB,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,IAAA,aAAQ,GAAE,CAAC;QACtB,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC;YACnB,OAAO,IAAA,wBAAQ,EAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACnF,CAAC;QACD,OAAO,IAAA,wBAAQ,EAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC,CAAC,mBAAmB;IACnC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface MineResult {
|
|
2
|
+
scanned: number;
|
|
3
|
+
new_files: number;
|
|
4
|
+
neurons_created: number;
|
|
5
|
+
neurons_updated: number;
|
|
6
|
+
facts_added: number;
|
|
7
|
+
decisions_added: number;
|
|
8
|
+
technologies_found: string[];
|
|
9
|
+
errors: string[];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/miner/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/miner/types.ts"],"names":[],"mappings":";AAAA,iEAAiE"}
|