@gamaze/hicortex 0.3.0 → 0.3.1
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/dist/mcp-server.js +35 -2
- package/dist/nightly.js +14 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/mcp-server.js
CHANGED
|
@@ -177,8 +177,14 @@ async function startServer(options = {}) {
|
|
|
177
177
|
const llmConfig = (0, llm_js_1.resolveLlmConfigForCC)();
|
|
178
178
|
llm = new llm_js_1.LlmClient(llmConfig);
|
|
179
179
|
console.log(`[hicortex] LLM: ${llmConfig.provider}/${llmConfig.model} (reflect: ${llmConfig.reflectModel})`);
|
|
180
|
-
// License
|
|
181
|
-
|
|
180
|
+
// License: read from options, config file, or env var
|
|
181
|
+
const licenseKey = options.licenseKey
|
|
182
|
+
?? readConfigLicenseKey(stateDir)
|
|
183
|
+
?? process.env.HICORTEX_LICENSE_KEY;
|
|
184
|
+
(0, license_js_1.validateLicense)(licenseKey, stateDir).catch((err) => console.log(`[hicortex] License validation failed: ${err}`));
|
|
185
|
+
if (licenseKey) {
|
|
186
|
+
console.log(`[hicortex] License key configured`);
|
|
187
|
+
}
|
|
182
188
|
// Schedule nightly consolidation
|
|
183
189
|
const consolidateHour = options.consolidateHour ?? 2;
|
|
184
190
|
cancelConsolidation = (0, consolidate_js_1.scheduleConsolidation)(db, llm, embedder_js_1.embed, consolidateHour);
|
|
@@ -231,6 +237,16 @@ async function startServer(options = {}) {
|
|
|
231
237
|
console.log(`[hicortex] SSE endpoint: http://${host}:${port}/sse`);
|
|
232
238
|
console.log(`[hicortex] Health: http://${host}:${port}/health`);
|
|
233
239
|
});
|
|
240
|
+
server.on("error", (err) => {
|
|
241
|
+
if (err.code === "EADDRINUSE") {
|
|
242
|
+
console.error(`[hicortex] Port ${port} is already in use. ` +
|
|
243
|
+
`Another Hicortex server or service may be running.\n` +
|
|
244
|
+
` Check: lsof -i :${port}\n` +
|
|
245
|
+
` Use a different port: npx @gamaze/hicortex server --port ${port + 1}`);
|
|
246
|
+
process.exit(1);
|
|
247
|
+
}
|
|
248
|
+
throw err;
|
|
249
|
+
});
|
|
234
250
|
// Graceful shutdown
|
|
235
251
|
const shutdown = () => {
|
|
236
252
|
console.log("[hicortex] Shutting down...");
|
|
@@ -257,6 +273,23 @@ async function startServer(options = {}) {
|
|
|
257
273
|
// ---------------------------------------------------------------------------
|
|
258
274
|
// Helpers
|
|
259
275
|
// ---------------------------------------------------------------------------
|
|
276
|
+
/**
|
|
277
|
+
* Read license key from ~/.hicortex/config.json.
|
|
278
|
+
* Written by /hicortex-activate CC command.
|
|
279
|
+
*/
|
|
280
|
+
function readConfigLicenseKey(stateDir) {
|
|
281
|
+
try {
|
|
282
|
+
const { readFileSync } = require("node:fs");
|
|
283
|
+
const { join } = require("node:path");
|
|
284
|
+
const configPath = join(stateDir, "config.json");
|
|
285
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
286
|
+
const config = JSON.parse(raw);
|
|
287
|
+
return config.licenseKey || undefined;
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
260
293
|
function formatResults(results) {
|
|
261
294
|
if (results.length === 0)
|
|
262
295
|
return "No memories found.";
|
package/dist/nightly.js
CHANGED
|
@@ -58,6 +58,17 @@ const claude_md_js_1 = require("./claude-md.js");
|
|
|
58
58
|
const license_js_1 = require("./license.js");
|
|
59
59
|
const HICORTEX_HOME = (0, node_path_1.join)((0, node_os_1.homedir)(), ".hicortex");
|
|
60
60
|
const LAST_RUN_PATH = (0, node_path_1.join)(HICORTEX_HOME, "nightly-last-run.txt");
|
|
61
|
+
function readConfigLicenseKey(stateDir) {
|
|
62
|
+
try {
|
|
63
|
+
const configPath = (0, node_path_1.join)(stateDir, "config.json");
|
|
64
|
+
const raw = (0, node_fs_1.readFileSync)(configPath, "utf-8");
|
|
65
|
+
const config = JSON.parse(raw);
|
|
66
|
+
return config.licenseKey || undefined;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
61
72
|
function readLastRun() {
|
|
62
73
|
try {
|
|
63
74
|
const ts = (0, node_fs_1.readFileSync)(LAST_RUN_PATH, "utf-8").trim();
|
|
@@ -83,6 +94,9 @@ async function runNightly(options = {}) {
|
|
|
83
94
|
// Init DB
|
|
84
95
|
const db = (0, db_js_1.initDb)(dbPath);
|
|
85
96
|
try {
|
|
97
|
+
// License: read from config file or env var
|
|
98
|
+
const licenseKey = readConfigLicenseKey(stateDir) ?? process.env.HICORTEX_LICENSE_KEY;
|
|
99
|
+
await (0, license_js_1.validateLicense)(licenseKey, stateDir);
|
|
86
100
|
// Init LLM
|
|
87
101
|
const llmConfig = (0, llm_js_1.resolveLlmConfigForCC)();
|
|
88
102
|
const llm = new llm_js_1.LlmClient(llmConfig);
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "hicortex",
|
|
3
3
|
"name": "Hicortex — Long-term Memory That Learns",
|
|
4
4
|
"description": "Your agents remember past decisions, avoid repeated mistakes, and get smarter every day. Nightly reflection generates actionable lessons that automatically update agent behavior.",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.1",
|
|
6
6
|
"kind": "lifecycle",
|
|
7
7
|
"skills": ["./skills/hicortex-memory", "./skills/hicortex-learn", "./skills/hicortex-activate"],
|
|
8
8
|
"configSchema": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamaze/hicortex",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Human-like memory for self-improving AI agents. Automatic capturing, nightly reflection, and cross-agent learning. Works with Claude Code and OpenClaw.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|