exomind 0.8.0 → 0.9.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/dist/cli.js +45 -1
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3119,7 +3119,7 @@ var {
|
|
|
3119
3119
|
// package.json
|
|
3120
3120
|
var package_default = {
|
|
3121
3121
|
name: "exomind",
|
|
3122
|
-
version: "0.
|
|
3122
|
+
version: "0.9.0",
|
|
3123
3123
|
description: "ExoMind \u8DE8\u5E73\u53F0\u547D\u4EE4\u884C\u5BA2\u6237\u7AEF \u2014 \u901A\u8FC7 REST \u4E0E ExoMind \u77E5\u8BC6\u5E93\u4EA4\u4E92(ingest/query/search/review),\u66FF\u4EE3 Windows \u4E0D\u53EF\u7528\u7684 MCP \u5BA2\u6237\u7AEF\u3002",
|
|
3124
3124
|
bin: {
|
|
3125
3125
|
exomind: "dist/cli.js"
|
|
@@ -3465,6 +3465,45 @@ function sessionKey() {
|
|
|
3465
3465
|
function dedupPath() {
|
|
3466
3466
|
return path2.join(CACHE_DIR, `dedup-${sessionKey()}.json`);
|
|
3467
3467
|
}
|
|
3468
|
+
var DISCOVER_STATE = path2.join(CACHE_DIR, "discover-state.json");
|
|
3469
|
+
var DISCOVER_FAIL_COOLDOWN_MS = 30 * 60 * 1e3;
|
|
3470
|
+
function buildDiscoverInjection(cards) {
|
|
3471
|
+
if (!cards || !cards.length) return "";
|
|
3472
|
+
const labels = { recap: "\u627E\u56DE", bridge: "\u65B0\u8FDE\u63A5", stub: "\u5F85\u8865\u5168", theme: "\u672C\u5468\u4E3B\u7EBF" };
|
|
3473
|
+
const c = cards[0];
|
|
3474
|
+
return `[ExoMind \u4ECA\u65E5\u53D1\u73B0\xB7${labels[c.type] || c.type}] ${c.reason}
|
|
3475
|
+
\u4ECA\u65E5\u5171 ${cards.length} \u5F20\u5361:\u8FD0\u884C \`exomind entity "${c.name}"\` \u67E5\u770B\u7B2C\u4E00\u6761,\u6216\u6253\u5F00 youhuale.cn/ui/discover \u9010\u5F20\u5904\u7406\u3002\u4E0E\u5F53\u524D\u8BDD\u9898\u65E0\u5173\u5219\u5FFD\u7565\u3002`;
|
|
3476
|
+
}
|
|
3477
|
+
function readDiscoverState() {
|
|
3478
|
+
try {
|
|
3479
|
+
return JSON.parse(fs3.readFileSync(DISCOVER_STATE, "utf-8"));
|
|
3480
|
+
} catch {
|
|
3481
|
+
return {};
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
function saveDiscoverState(st) {
|
|
3485
|
+
try {
|
|
3486
|
+
fs3.mkdirSync(CACHE_DIR, { recursive: true });
|
|
3487
|
+
fs3.writeFileSync(DISCOVER_STATE, JSON.stringify(st));
|
|
3488
|
+
} catch {
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
async function dailyDiscoverInjection(client) {
|
|
3492
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
3493
|
+
const st = readDiscoverState();
|
|
3494
|
+
if (st.date === today && st.done) return "";
|
|
3495
|
+
if (st.date === today && st.failed && Date.now() - st.failed < DISCOVER_FAIL_COOLDOWN_MS) {
|
|
3496
|
+
return "";
|
|
3497
|
+
}
|
|
3498
|
+
try {
|
|
3499
|
+
const data = await client.get("/daily-discovery", void 0, { timeoutMs: 8e3 });
|
|
3500
|
+
saveDiscoverState({ date: today, done: true, ts: Date.now() });
|
|
3501
|
+
return buildDiscoverInjection(data.discoveries || []);
|
|
3502
|
+
} catch {
|
|
3503
|
+
saveDiscoverState({ date: today, failed: Date.now() });
|
|
3504
|
+
return "";
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3468
3507
|
function safe(s) {
|
|
3469
3508
|
return s.replace(/[^a-zA-Z0-9一-龥._-]/g, "_").slice(0, 64);
|
|
3470
3509
|
}
|
|
@@ -3634,6 +3673,11 @@ async function runHook(client) {
|
|
|
3634
3673
|
if (ctx) outputs.push(ctx);
|
|
3635
3674
|
} catch {
|
|
3636
3675
|
}
|
|
3676
|
+
try {
|
|
3677
|
+
const discover = await dailyDiscoverInjection(client);
|
|
3678
|
+
if (discover) outputs.push(discover);
|
|
3679
|
+
} catch {
|
|
3680
|
+
}
|
|
3637
3681
|
saveDedup(dedup);
|
|
3638
3682
|
if (outputs.length) {
|
|
3639
3683
|
process.stdout.write(outputs.join("\n\n") + "\n");
|