@memtensor/memos-local-openclaw-plugin 1.0.2-beta.5 → 1.0.2-beta.7
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/capture/index.js +52 -8
- package/dist/capture/index.js.map +1 -1
- package/dist/embedding/index.d.ts.map +1 -1
- package/dist/embedding/index.js +4 -3
- package/dist/embedding/index.js.map +1 -1
- package/dist/ingest/chunker.d.ts +3 -4
- package/dist/ingest/chunker.d.ts.map +1 -1
- package/dist/ingest/chunker.js +19 -24
- package/dist/ingest/chunker.js.map +1 -1
- package/dist/ingest/providers/anthropic.d.ts +3 -1
- package/dist/ingest/providers/anthropic.d.ts.map +1 -1
- package/dist/ingest/providers/anthropic.js +79 -39
- package/dist/ingest/providers/anthropic.js.map +1 -1
- package/dist/ingest/providers/bedrock.d.ts +3 -1
- package/dist/ingest/providers/bedrock.d.ts.map +1 -1
- package/dist/ingest/providers/bedrock.js +79 -39
- package/dist/ingest/providers/bedrock.js.map +1 -1
- package/dist/ingest/providers/gemini.d.ts +3 -1
- package/dist/ingest/providers/gemini.d.ts.map +1 -1
- package/dist/ingest/providers/gemini.js +77 -39
- package/dist/ingest/providers/gemini.js.map +1 -1
- package/dist/ingest/providers/index.d.ts +3 -1
- package/dist/ingest/providers/index.d.ts.map +1 -1
- package/dist/ingest/providers/index.js +107 -30
- package/dist/ingest/providers/index.js.map +1 -1
- package/dist/ingest/providers/openai.d.ts +3 -1
- package/dist/ingest/providers/openai.d.ts.map +1 -1
- package/dist/ingest/providers/openai.js +80 -39
- package/dist/ingest/providers/openai.js.map +1 -1
- package/dist/ingest/task-processor.d.ts +1 -0
- package/dist/ingest/task-processor.d.ts.map +1 -1
- package/dist/ingest/task-processor.js +33 -9
- package/dist/ingest/task-processor.js.map +1 -1
- package/dist/ingest/worker.d.ts.map +1 -1
- package/dist/ingest/worker.js +29 -13
- package/dist/ingest/worker.js.map +1 -1
- package/dist/recall/engine.d.ts.map +1 -1
- package/dist/recall/engine.js +19 -14
- package/dist/recall/engine.js.map +1 -1
- package/dist/skill/bundled-memory-guide.d.ts +1 -5
- package/dist/skill/bundled-memory-guide.d.ts.map +1 -1
- package/dist/skill/bundled-memory-guide.js +38 -97
- package/dist/skill/bundled-memory-guide.js.map +1 -1
- package/dist/skill/evaluator.js +1 -1
- package/dist/storage/sqlite.d.ts +1 -2
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +90 -17
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/tools/memory-get.d.ts.map +1 -1
- package/dist/tools/memory-get.js +1 -3
- package/dist/tools/memory-get.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/update-check.d.ts +21 -0
- package/dist/update-check.d.ts.map +1 -0
- package/dist/update-check.js +110 -0
- package/dist/update-check.js.map +1 -0
- package/dist/viewer/html.d.ts.map +1 -1
- package/dist/viewer/html.js +487 -189
- package/dist/viewer/html.js.map +1 -1
- package/dist/viewer/server.d.ts +1 -1
- package/dist/viewer/server.d.ts.map +1 -1
- package/dist/viewer/server.js +240 -78
- package/dist/viewer/server.js.map +1 -1
- package/index.ts +205 -197
- package/openclaw.plugin.json +3 -0
- package/package.json +8 -3
- package/scripts/postinstall.cjs +69 -2
- package/skill/memos-memory-guide/SKILL.md +73 -36
- package/src/capture/index.ts +52 -8
- package/src/embedding/index.ts +4 -2
- package/src/ingest/chunker.ts +22 -30
- package/src/ingest/providers/anthropic.ts +89 -41
- package/src/ingest/providers/bedrock.ts +90 -41
- package/src/ingest/providers/gemini.ts +89 -41
- package/src/ingest/providers/index.ts +118 -35
- package/src/ingest/providers/openai.ts +90 -41
- package/src/ingest/task-processor.ts +29 -8
- package/src/ingest/worker.ts +31 -13
- package/src/recall/engine.ts +20 -13
- package/src/skill/bundled-memory-guide.ts +5 -96
- package/src/skill/evaluator.ts +1 -1
- package/src/storage/sqlite.ts +93 -21
- package/src/tools/memory-get.ts +1 -4
- package/src/types.ts +9 -10
- package/src/update-check.ts +95 -0
- package/src/viewer/html.ts +487 -189
- package/src/viewer/server.ts +187 -66
package/dist/viewer/html.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/viewer/html.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/viewer/html.ts"],"names":[],"mappings":";;AAAA,gCA4qJC;AA5qJD,SAAgB,UAAU,CAAC,aAAsB;IACjD,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,gCAAgC,aAAa,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3F,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAg5HpD,CAAC;AACT,CAAC"}
|
package/dist/viewer/server.d.ts
CHANGED
|
@@ -65,7 +65,6 @@ export declare class ViewerServer {
|
|
|
65
65
|
private handleTaskUpdate;
|
|
66
66
|
private handleSkillDelete;
|
|
67
67
|
private handleSkillUpdate;
|
|
68
|
-
private handleCreate;
|
|
69
68
|
private serveMemoryDetail;
|
|
70
69
|
private handleUpdate;
|
|
71
70
|
private handleDelete;
|
|
@@ -79,6 +78,7 @@ export declare class ViewerServer {
|
|
|
79
78
|
private serveFallbackModel;
|
|
80
79
|
private findPluginPackageJson;
|
|
81
80
|
private handleUpdateCheck;
|
|
81
|
+
private handleUpdateInstall;
|
|
82
82
|
private testEmbeddingModel;
|
|
83
83
|
private testChatModel;
|
|
84
84
|
private serveLogs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/viewer/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/viewer/server.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAQ7C,OAAO,KAAK,EAAE,MAAM,EAAS,aAAa,EAAE,MAAM,UAAU,CAAC;AAS7D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAOD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,QAAQ,C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C,uBAAuB;IAU/B,OAAO,CAAC,cAAc;YAOR,cAAc;IAiK5B,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,YAAY;CAIrB"}
|
package/dist/viewer/server.js
CHANGED
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.ViewerServer = void 0;
|
|
7
40
|
const node_http_1 = __importDefault(require("node:http"));
|
|
41
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
8
42
|
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
9
43
|
const node_child_process_1 = require("node:child_process");
|
|
10
44
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
@@ -51,7 +85,7 @@ class ViewerServer {
|
|
|
51
85
|
migrationSSEClients = [];
|
|
52
86
|
ppRunning = false;
|
|
53
87
|
ppAbort = false;
|
|
54
|
-
ppState = { running: false, done: false, stopped: false, processed: 0, total: 0, tasksCreated: 0, skillsCreated: 0, errors: 0 };
|
|
88
|
+
ppState = { running: false, done: false, stopped: false, processed: 0, total: 0, tasksCreated: 0, skillsCreated: 0, errors: 0, skippedSessions: 0, totalSessions: 0 };
|
|
55
89
|
ppSSEClients = [];
|
|
56
90
|
constructor(opts) {
|
|
57
91
|
this.store = opts.store;
|
|
@@ -222,8 +256,6 @@ class ViewerServer {
|
|
|
222
256
|
this.handleSkillUpdate(req, res, p);
|
|
223
257
|
else if (p.startsWith("/api/skill/") && req.method === "GET")
|
|
224
258
|
this.serveSkillDetail(res, p);
|
|
225
|
-
else if (p === "/api/memory" && req.method === "POST")
|
|
226
|
-
this.handleCreate(req, res);
|
|
227
259
|
else if (p.startsWith("/api/memory/") && req.method === "GET")
|
|
228
260
|
this.serveMemoryDetail(res, p);
|
|
229
261
|
else if (p.startsWith("/api/memory/") && req.method === "PUT")
|
|
@@ -250,6 +282,8 @@ class ViewerServer {
|
|
|
250
282
|
this.serveFallbackModel(res);
|
|
251
283
|
else if (p === "/api/update-check" && req.method === "GET")
|
|
252
284
|
this.handleUpdateCheck(res);
|
|
285
|
+
else if (p === "/api/update-install" && req.method === "POST")
|
|
286
|
+
this.handleUpdateInstall(req, res);
|
|
253
287
|
else if (p === "/api/auth/logout" && req.method === "POST")
|
|
254
288
|
this.handleLogout(req, res);
|
|
255
289
|
else if (p === "/api/cleanup-polluted" && req.method === "POST")
|
|
@@ -390,7 +424,6 @@ class ViewerServer {
|
|
|
390
424
|
const offset = (page - 1) * limit;
|
|
391
425
|
const session = url.searchParams.get("session") ?? undefined;
|
|
392
426
|
const role = url.searchParams.get("role") ?? undefined;
|
|
393
|
-
const kind = url.searchParams.get("kind") ?? undefined;
|
|
394
427
|
const dateFrom = url.searchParams.get("dateFrom") ?? undefined;
|
|
395
428
|
const dateTo = url.searchParams.get("dateTo") ?? undefined;
|
|
396
429
|
const owner = url.searchParams.get("owner") ?? undefined;
|
|
@@ -406,10 +439,6 @@ class ViewerServer {
|
|
|
406
439
|
conditions.push("role = ?");
|
|
407
440
|
params.push(role);
|
|
408
441
|
}
|
|
409
|
-
if (kind) {
|
|
410
|
-
conditions.push("kind = ?");
|
|
411
|
-
params.push(kind);
|
|
412
|
-
}
|
|
413
442
|
if (owner) {
|
|
414
443
|
conditions.push("owner = ?");
|
|
415
444
|
params.push(owner);
|
|
@@ -425,9 +454,14 @@ class ViewerServer {
|
|
|
425
454
|
const where = conditions.length > 0 ? " WHERE " + conditions.join(" AND ") : "";
|
|
426
455
|
const totalRow = db.prepare("SELECT COUNT(*) as count FROM chunks" + where).get(...params);
|
|
427
456
|
const rawMemories = db.prepare("SELECT * FROM chunks" + where + ` ORDER BY created_at ${sortBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
457
|
+
const findMergeSources = db.prepare("SELECT id, summary, role FROM chunks WHERE dedup_target = ? AND (dedup_status = 'merged' OR dedup_status = 'duplicate')");
|
|
428
458
|
const memories = rawMemories.map((m) => {
|
|
429
459
|
if (m.role === "user" && m.content) {
|
|
430
|
-
|
|
460
|
+
m = { ...m, content: (0, capture_1.stripInboundMetadata)(m.content) };
|
|
461
|
+
}
|
|
462
|
+
if (m.merge_count > 0) {
|
|
463
|
+
const sources = findMergeSources.all(m.id);
|
|
464
|
+
m.merge_sources = sources;
|
|
431
465
|
}
|
|
432
466
|
return m;
|
|
433
467
|
});
|
|
@@ -460,7 +494,7 @@ class ViewerServer {
|
|
|
460
494
|
id: t.id,
|
|
461
495
|
sessionKey: t.sessionKey,
|
|
462
496
|
title: t.title,
|
|
463
|
-
summary: t.summary
|
|
497
|
+
summary: t.summary ?? "",
|
|
464
498
|
status: t.status,
|
|
465
499
|
startedAt: t.startedAt,
|
|
466
500
|
endedAt: t.endedAt,
|
|
@@ -480,9 +514,7 @@ class ViewerServer {
|
|
|
480
514
|
}
|
|
481
515
|
const chunks = this.store.getChunksByTask(taskId);
|
|
482
516
|
const chunkItems = chunks.map((c) => {
|
|
483
|
-
|
|
484
|
-
if (text.length > 500)
|
|
485
|
-
text = text.slice(0, 497) + "...";
|
|
517
|
+
const text = c.role === "user" ? (0, capture_1.stripInboundMetadata)(c.content) : c.content;
|
|
486
518
|
return { id: c.id, role: c.role, content: text, summary: c.summary, createdAt: c.createdAt };
|
|
487
519
|
});
|
|
488
520
|
const relatedSkills = this.store.getSkillsByTask(taskId);
|
|
@@ -514,7 +546,7 @@ class ViewerServer {
|
|
|
514
546
|
const emptyStats = {
|
|
515
547
|
totalMemories: 0, totalSessions: 0, totalEmbeddings: 0, totalSkills: 0,
|
|
516
548
|
embeddingProvider: this.embedder?.provider ?? "none",
|
|
517
|
-
|
|
549
|
+
dedupBreakdown: {},
|
|
518
550
|
timeRange: { earliest: null, latest: null },
|
|
519
551
|
sessions: [],
|
|
520
552
|
};
|
|
@@ -526,7 +558,6 @@ class ViewerServer {
|
|
|
526
558
|
const db = this.store.db;
|
|
527
559
|
const total = db.prepare("SELECT COUNT(*) as count FROM chunks").get();
|
|
528
560
|
const sessions = db.prepare("SELECT COUNT(DISTINCT session_key) as count FROM chunks").get();
|
|
529
|
-
const roles = db.prepare("SELECT role, COUNT(*) as count FROM chunks GROUP BY role").all();
|
|
530
561
|
const timeRange = db.prepare("SELECT MIN(created_at) as earliest, MAX(created_at) as latest FROM chunks WHERE dedup_status = 'active'").get();
|
|
531
562
|
const MIN_VALID_TS = 1704067200000; // 2024-01-01
|
|
532
563
|
if (timeRange.earliest != null && timeRange.earliest < MIN_VALID_TS) {
|
|
@@ -541,7 +572,6 @@ class ViewerServer {
|
|
|
541
572
|
embCount = db.prepare("SELECT COUNT(*) as count FROM embeddings").get().count;
|
|
542
573
|
}
|
|
543
574
|
catch { /* table may not exist */ }
|
|
544
|
-
const kinds = db.prepare("SELECT kind, COUNT(*) as count FROM chunks GROUP BY kind").all();
|
|
545
575
|
const sessionList = db.prepare("SELECT session_key, COUNT(*) as count, MIN(created_at) as earliest, MAX(created_at) as latest FROM chunks GROUP BY session_key ORDER BY latest DESC").all();
|
|
546
576
|
let skillCount = 0;
|
|
547
577
|
try {
|
|
@@ -564,8 +594,6 @@ class ViewerServer {
|
|
|
564
594
|
totalMemories: total.count, totalSessions: sessions.count, totalEmbeddings: embCount,
|
|
565
595
|
totalSkills: skillCount,
|
|
566
596
|
embeddingProvider: this.embedder.provider,
|
|
567
|
-
roleBreakdown: Object.fromEntries(roles.map((r) => [r.role, r.count])),
|
|
568
|
-
kindBreakdown: Object.fromEntries(kinds.map((k) => [k.kind, k.count])),
|
|
569
597
|
dedupBreakdown,
|
|
570
598
|
timeRange: { earliest: timeRange.earliest, latest: timeRange.latest },
|
|
571
599
|
sessions: sessionList,
|
|
@@ -584,7 +612,6 @@ class ViewerServer {
|
|
|
584
612
|
return;
|
|
585
613
|
}
|
|
586
614
|
const role = url.searchParams.get("role") ?? undefined;
|
|
587
|
-
const kind = url.searchParams.get("kind") ?? undefined;
|
|
588
615
|
const session = url.searchParams.get("session") ?? undefined;
|
|
589
616
|
const owner = url.searchParams.get("owner") ?? undefined;
|
|
590
617
|
const dateFrom = url.searchParams.get("dateFrom") ?? undefined;
|
|
@@ -592,8 +619,6 @@ class ViewerServer {
|
|
|
592
619
|
const passesFilter = (r) => {
|
|
593
620
|
if (role && r.role !== role)
|
|
594
621
|
return false;
|
|
595
|
-
if (kind && r.kind !== kind)
|
|
596
|
-
return false;
|
|
597
622
|
if (session && r.session_key !== session)
|
|
598
623
|
return false;
|
|
599
624
|
if (owner && r.owner !== owner)
|
|
@@ -961,35 +986,6 @@ class ViewerServer {
|
|
|
961
986
|
});
|
|
962
987
|
}
|
|
963
988
|
// ─── CRUD ───
|
|
964
|
-
handleCreate(req, res) {
|
|
965
|
-
this.readBody(req, (body) => {
|
|
966
|
-
try {
|
|
967
|
-
const data = JSON.parse(body);
|
|
968
|
-
if (!data.content || typeof data.content !== "string" || !data.content.trim()) {
|
|
969
|
-
res.writeHead(400, { "Content-Type": "application/json" });
|
|
970
|
-
res.end(JSON.stringify({ error: "content is required and must be a non-empty string" }));
|
|
971
|
-
return;
|
|
972
|
-
}
|
|
973
|
-
const { v4: uuidv4 } = require("uuid");
|
|
974
|
-
const id = uuidv4();
|
|
975
|
-
const now = Date.now();
|
|
976
|
-
this.store.insertChunk({
|
|
977
|
-
id, sessionKey: data.session_key || "manual", turnId: `manual-${now}`, seq: 0,
|
|
978
|
-
role: data.role || "user", content: data.content, kind: data.kind || "paragraph",
|
|
979
|
-
summary: data.summary || data.content.slice(0, 100),
|
|
980
|
-
taskId: null, skillId: null, owner: data.owner || "agent:main",
|
|
981
|
-
dedupStatus: "active", dedupTarget: null, dedupReason: null,
|
|
982
|
-
mergeCount: 0, lastHitAt: null, mergeHistory: "[]",
|
|
983
|
-
createdAt: now, updatedAt: now, embedding: null,
|
|
984
|
-
});
|
|
985
|
-
this.jsonResponse(res, { ok: true, id, message: "Memory created" });
|
|
986
|
-
}
|
|
987
|
-
catch (err) {
|
|
988
|
-
res.writeHead(400, { "Content-Type": "application/json" });
|
|
989
|
-
res.end(JSON.stringify({ error: String(err) }));
|
|
990
|
-
}
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
989
|
serveMemoryDetail(res, urlPath) {
|
|
994
990
|
const chunkId = urlPath.replace("/api/memory/", "");
|
|
995
991
|
const chunk = this.store.getChunk(chunkId);
|
|
@@ -1013,7 +1009,7 @@ class ViewerServer {
|
|
|
1013
1009
|
res.end(JSON.stringify({ error: "content must be a non-empty string" }));
|
|
1014
1010
|
return;
|
|
1015
1011
|
}
|
|
1016
|
-
const ok = this.store.updateChunk(chunkId, { summary: data.summary, content: data.content, role: data.role,
|
|
1012
|
+
const ok = this.store.updateChunk(chunkId, { summary: data.summary, content: data.content, role: data.role, owner: data.owner });
|
|
1017
1013
|
if (ok)
|
|
1018
1014
|
this.jsonResponse(res, { ok: true, message: "Memory updated" });
|
|
1019
1015
|
else {
|
|
@@ -1239,20 +1235,20 @@ class ViewerServer {
|
|
|
1239
1235
|
this.jsonResponse(res, { updateAvailable: false, current });
|
|
1240
1236
|
return;
|
|
1241
1237
|
}
|
|
1242
|
-
const
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
this.jsonResponse(res, { updateAvailable: false, current });
|
|
1238
|
+
const { computeUpdateCheck } = await Promise.resolve().then(() => __importStar(require("../update-check")));
|
|
1239
|
+
const result = await computeUpdateCheck(name, current, fetch, 6_000);
|
|
1240
|
+
if (!result) {
|
|
1241
|
+
this.jsonResponse(res, { updateAvailable: false, current, packageName: name });
|
|
1247
1242
|
return;
|
|
1248
1243
|
}
|
|
1249
|
-
const data = await npmResp.json();
|
|
1250
|
-
const latest = data.version ?? current;
|
|
1251
1244
|
this.jsonResponse(res, {
|
|
1252
|
-
updateAvailable:
|
|
1253
|
-
current,
|
|
1254
|
-
latest,
|
|
1255
|
-
packageName:
|
|
1245
|
+
updateAvailable: result.updateAvailable,
|
|
1246
|
+
current: result.current,
|
|
1247
|
+
latest: result.latest,
|
|
1248
|
+
packageName: result.packageName,
|
|
1249
|
+
channel: result.channel,
|
|
1250
|
+
installCommand: result.installCommand,
|
|
1251
|
+
stableChannel: result.stableChannel,
|
|
1256
1252
|
});
|
|
1257
1253
|
}
|
|
1258
1254
|
catch (e) {
|
|
@@ -1260,6 +1256,146 @@ class ViewerServer {
|
|
|
1260
1256
|
this.jsonResponse(res, { updateAvailable: false, error: String(e) });
|
|
1261
1257
|
}
|
|
1262
1258
|
}
|
|
1259
|
+
handleUpdateInstall(req, res) {
|
|
1260
|
+
let body = "";
|
|
1261
|
+
req.on("data", (chunk) => { body += chunk.toString(); });
|
|
1262
|
+
req.on("end", () => {
|
|
1263
|
+
try {
|
|
1264
|
+
const { packageSpec: rawSpec } = JSON.parse(body);
|
|
1265
|
+
if (!rawSpec || typeof rawSpec !== "string") {
|
|
1266
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
1267
|
+
res.end(JSON.stringify({ ok: false, error: "Missing packageSpec" }));
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
const packageSpec = rawSpec.trim().replace(/^(?:npx\s+)?openclaw\s+plugins\s+install\s+/i, "");
|
|
1271
|
+
const allowed = /^@[\w-]+\/[\w.-]+(@[\w.-]+)?$/;
|
|
1272
|
+
this.log.info(`update-install: received packageSpec="${packageSpec}" (len=${packageSpec.length})`);
|
|
1273
|
+
if (!allowed.test(packageSpec)) {
|
|
1274
|
+
this.log.warn(`update-install: rejected packageSpec="${packageSpec}" — does not match ${allowed}`);
|
|
1275
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
1276
|
+
res.end(JSON.stringify({ ok: false, error: `Invalid package spec: "${packageSpec}"` }));
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
const pkgPath = this.findPluginPackageJson();
|
|
1280
|
+
const pluginName = pkgPath
|
|
1281
|
+
? (() => { try {
|
|
1282
|
+
return JSON.parse(node_fs_1.default.readFileSync(pkgPath, "utf-8")).name;
|
|
1283
|
+
}
|
|
1284
|
+
catch {
|
|
1285
|
+
return null;
|
|
1286
|
+
} })()
|
|
1287
|
+
: null;
|
|
1288
|
+
const shortName = pluginName?.replace(/^@[\w-]+\//, "") ?? "memos-local-openclaw-plugin";
|
|
1289
|
+
const extDir = node_path_1.default.join(node_os_1.default.homedir(), ".openclaw", "extensions", shortName);
|
|
1290
|
+
const tmpDir = node_path_1.default.join(node_os_1.default.tmpdir(), `openclaw-update-${Date.now()}`);
|
|
1291
|
+
// Download via npm pack, extract, and replace extension dir.
|
|
1292
|
+
// Does NOT touch openclaw.json → no config watcher SIGUSR1.
|
|
1293
|
+
this.log.info(`update-install: downloading ${packageSpec} via npm pack...`);
|
|
1294
|
+
node_fs_1.default.mkdirSync(tmpDir, { recursive: true });
|
|
1295
|
+
(0, node_child_process_1.exec)(`npm pack ${packageSpec} --pack-destination ${tmpDir}`, { timeout: 60_000 }, (packErr, packOut) => {
|
|
1296
|
+
if (packErr) {
|
|
1297
|
+
this.log.warn(`update-install: npm pack failed: ${packErr.message}`);
|
|
1298
|
+
this.jsonResponse(res, { ok: false, error: `Download failed: ${packErr.message}` });
|
|
1299
|
+
try {
|
|
1300
|
+
node_fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
1301
|
+
}
|
|
1302
|
+
catch { }
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
const tgzFile = packOut.trim().split("\n").pop();
|
|
1306
|
+
const tgzPath = node_path_1.default.join(tmpDir, tgzFile);
|
|
1307
|
+
this.log.info(`update-install: downloaded ${tgzFile}, extracting...`);
|
|
1308
|
+
const extractDir = node_path_1.default.join(tmpDir, "extract");
|
|
1309
|
+
node_fs_1.default.mkdirSync(extractDir, { recursive: true });
|
|
1310
|
+
(0, node_child_process_1.exec)(`tar -xzf ${tgzPath} -C ${extractDir}`, { timeout: 30_000 }, (tarErr) => {
|
|
1311
|
+
if (tarErr) {
|
|
1312
|
+
this.log.warn(`update-install: tar extract failed: ${tarErr.message}`);
|
|
1313
|
+
this.jsonResponse(res, { ok: false, error: `Extract failed: ${tarErr.message}` });
|
|
1314
|
+
try {
|
|
1315
|
+
node_fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
1316
|
+
}
|
|
1317
|
+
catch { }
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
// npm pack extracts to a "package" subdirectory
|
|
1321
|
+
const srcDir = node_path_1.default.join(extractDir, "package");
|
|
1322
|
+
if (!node_fs_1.default.existsSync(srcDir)) {
|
|
1323
|
+
this.jsonResponse(res, { ok: false, error: "Extracted package has no 'package' dir" });
|
|
1324
|
+
try {
|
|
1325
|
+
node_fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
1326
|
+
}
|
|
1327
|
+
catch { }
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
// Replace extension directory
|
|
1331
|
+
this.log.info(`update-install: replacing ${extDir}...`);
|
|
1332
|
+
try {
|
|
1333
|
+
node_fs_1.default.rmSync(extDir, { recursive: true, force: true });
|
|
1334
|
+
}
|
|
1335
|
+
catch { }
|
|
1336
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(extDir), { recursive: true });
|
|
1337
|
+
node_fs_1.default.renameSync(srcDir, extDir);
|
|
1338
|
+
// Install dependencies
|
|
1339
|
+
this.log.info(`update-install: installing dependencies...`);
|
|
1340
|
+
(0, node_child_process_1.exec)(`cd ${extDir} && npm install --omit=dev --ignore-scripts`, { timeout: 120_000 }, (npmErr, npmOut, npmStderr) => {
|
|
1341
|
+
if (npmErr) {
|
|
1342
|
+
try {
|
|
1343
|
+
node_fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
1344
|
+
}
|
|
1345
|
+
catch { }
|
|
1346
|
+
this.log.warn(`update-install: npm install failed: ${npmErr.message}`);
|
|
1347
|
+
this.jsonResponse(res, { ok: false, error: `Dependency install failed: ${npmStderr || npmErr.message}` });
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1350
|
+
// Rebuild native modules (do not swallow errors)
|
|
1351
|
+
(0, node_child_process_1.exec)(`cd ${extDir} && npm rebuild better-sqlite3`, { timeout: 60_000 }, (rebuildErr, rebuildOut, rebuildStderr) => {
|
|
1352
|
+
if (rebuildErr) {
|
|
1353
|
+
this.log.warn(`update-install: better-sqlite3 rebuild failed: ${rebuildErr.message}`);
|
|
1354
|
+
const stderr = String(rebuildStderr || "").trim();
|
|
1355
|
+
if (stderr)
|
|
1356
|
+
this.log.warn(`update-install: rebuild stderr: ${stderr.slice(0, 500)}`);
|
|
1357
|
+
// Continue so postinstall.cjs can run (it will try rebuild again and show user guidance)
|
|
1358
|
+
}
|
|
1359
|
+
// Run postinstall.cjs: legacy cleanup, skill install, version marker, and optional sqlite re-check
|
|
1360
|
+
this.log.info(`update-install: running postinstall...`);
|
|
1361
|
+
(0, node_child_process_1.exec)(`cd ${extDir} && node scripts/postinstall.cjs`, { timeout: 180_000 }, (postErr, postOut, postStderr) => {
|
|
1362
|
+
try {
|
|
1363
|
+
node_fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
1364
|
+
}
|
|
1365
|
+
catch { }
|
|
1366
|
+
if (postErr) {
|
|
1367
|
+
this.log.warn(`update-install: postinstall failed: ${postErr.message}`);
|
|
1368
|
+
const postStderrStr = String(postStderr || "").trim();
|
|
1369
|
+
if (postStderrStr)
|
|
1370
|
+
this.log.warn(`update-install: postinstall stderr: ${postStderrStr.slice(0, 500)}`);
|
|
1371
|
+
// Still report success; plugin is updated, user can run postinstall manually if needed
|
|
1372
|
+
}
|
|
1373
|
+
// Read new version
|
|
1374
|
+
let newVersion = "unknown";
|
|
1375
|
+
try {
|
|
1376
|
+
const newPkg = JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(extDir, "package.json"), "utf-8"));
|
|
1377
|
+
newVersion = newPkg.version ?? newVersion;
|
|
1378
|
+
}
|
|
1379
|
+
catch { }
|
|
1380
|
+
this.log.info(`update-install: success! Updated to ${newVersion}`);
|
|
1381
|
+
this.jsonResponse(res, { ok: true, version: newVersion });
|
|
1382
|
+
// Trigger Gateway restart after response is sent
|
|
1383
|
+
setTimeout(() => {
|
|
1384
|
+
this.log.info(`update-install: triggering gateway restart...`);
|
|
1385
|
+
process.kill(process.pid, "SIGUSR1");
|
|
1386
|
+
}, 500);
|
|
1387
|
+
});
|
|
1388
|
+
});
|
|
1389
|
+
});
|
|
1390
|
+
});
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
catch (e) {
|
|
1394
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
1395
|
+
res.end(JSON.stringify({ ok: false, error: String(e) }));
|
|
1396
|
+
}
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1263
1399
|
async testEmbeddingModel(provider, model, endpoint, apiKey) {
|
|
1264
1400
|
if (provider === "local") {
|
|
1265
1401
|
return 384;
|
|
@@ -1492,10 +1628,16 @@ class ViewerServer {
|
|
|
1492
1628
|
catch { /* ignore */ }
|
|
1493
1629
|
}
|
|
1494
1630
|
let importedSessions = [];
|
|
1631
|
+
let importedChunkCount = 0;
|
|
1495
1632
|
try {
|
|
1496
1633
|
if (this.store) {
|
|
1497
1634
|
importedSessions = this.store.getDistinctSessionKeys()
|
|
1498
1635
|
.filter((sk) => sk.startsWith("openclaw-import-") || sk.startsWith("openclaw-session-"));
|
|
1636
|
+
if (importedSessions.length > 0) {
|
|
1637
|
+
const placeholders = importedSessions.map(() => "?").join(",");
|
|
1638
|
+
const row = this.store.db.prepare(`SELECT COUNT(*) as cnt FROM chunks WHERE session_key IN (${placeholders})`).get(...importedSessions);
|
|
1639
|
+
importedChunkCount = row?.cnt ?? 0;
|
|
1640
|
+
}
|
|
1499
1641
|
}
|
|
1500
1642
|
}
|
|
1501
1643
|
catch (storeErr) {
|
|
@@ -1510,6 +1652,7 @@ class ViewerServer {
|
|
|
1510
1652
|
hasSummarizer,
|
|
1511
1653
|
hasImportedData: importedSessions.length > 0,
|
|
1512
1654
|
importedSessionCount: importedSessions.length,
|
|
1655
|
+
importedChunkCount,
|
|
1513
1656
|
});
|
|
1514
1657
|
}
|
|
1515
1658
|
catch (e) {
|
|
@@ -1646,14 +1789,17 @@ class ViewerServer {
|
|
|
1646
1789
|
else {
|
|
1647
1790
|
this.broadcastSSE("done", { ok: true });
|
|
1648
1791
|
}
|
|
1649
|
-
for (const c of this.migrationSSEClients) {
|
|
1650
|
-
try {
|
|
1651
|
-
c.end();
|
|
1652
|
-
}
|
|
1653
|
-
catch { /* ignore */ }
|
|
1654
|
-
}
|
|
1655
|
-
this.migrationSSEClients = [];
|
|
1656
1792
|
this.migrationAbort = false;
|
|
1793
|
+
const clientsToClose = [...this.migrationSSEClients];
|
|
1794
|
+
this.migrationSSEClients = [];
|
|
1795
|
+
setTimeout(() => {
|
|
1796
|
+
for (const c of clientsToClose) {
|
|
1797
|
+
try {
|
|
1798
|
+
c.end();
|
|
1799
|
+
}
|
|
1800
|
+
catch { /* ignore */ }
|
|
1801
|
+
}
|
|
1802
|
+
}, 500);
|
|
1657
1803
|
});
|
|
1658
1804
|
});
|
|
1659
1805
|
}
|
|
@@ -2085,7 +2231,7 @@ class ViewerServer {
|
|
|
2085
2231
|
this.ppSSEClients.push(res);
|
|
2086
2232
|
res.on("close", () => { this.ppSSEClients = this.ppSSEClients.filter(c => c !== res); });
|
|
2087
2233
|
this.ppAbort = false;
|
|
2088
|
-
this.ppState = { running: true, done: false, stopped: false, processed: 0, total: 0, tasksCreated: 0, skillsCreated: 0, errors: 0 };
|
|
2234
|
+
this.ppState = { running: true, done: false, stopped: false, processed: 0, total: 0, tasksCreated: 0, skillsCreated: 0, errors: 0, skippedSessions: 0, totalSessions: 0 };
|
|
2089
2235
|
const send = (event, data) => {
|
|
2090
2236
|
this.broadcastPPSSE(event, data);
|
|
2091
2237
|
};
|
|
@@ -2101,14 +2247,17 @@ class ViewerServer {
|
|
|
2101
2247
|
else {
|
|
2102
2248
|
this.broadcastPPSSE("done", { ...this.ppState });
|
|
2103
2249
|
}
|
|
2104
|
-
for (const c of this.ppSSEClients) {
|
|
2105
|
-
try {
|
|
2106
|
-
c.end();
|
|
2107
|
-
}
|
|
2108
|
-
catch { /* */ }
|
|
2109
|
-
}
|
|
2110
|
-
this.ppSSEClients = [];
|
|
2111
2250
|
this.ppAbort = false;
|
|
2251
|
+
const ppClientsToClose = [...this.ppSSEClients];
|
|
2252
|
+
this.ppSSEClients = [];
|
|
2253
|
+
setTimeout(() => {
|
|
2254
|
+
for (const c of ppClientsToClose) {
|
|
2255
|
+
try {
|
|
2256
|
+
c.end();
|
|
2257
|
+
}
|
|
2258
|
+
catch { /* */ }
|
|
2259
|
+
}
|
|
2260
|
+
}, 500);
|
|
2112
2261
|
});
|
|
2113
2262
|
});
|
|
2114
2263
|
}
|
|
@@ -2138,7 +2287,14 @@ class ViewerServer {
|
|
|
2138
2287
|
this.jsonResponse(res, { ok: true });
|
|
2139
2288
|
}
|
|
2140
2289
|
handlePostprocessStatus(res) {
|
|
2141
|
-
|
|
2290
|
+
let existingTasks = 0;
|
|
2291
|
+
let existingSkills = 0;
|
|
2292
|
+
try {
|
|
2293
|
+
existingTasks = this.store.db.prepare("SELECT COUNT(*) as c FROM tasks").get()?.c ?? 0;
|
|
2294
|
+
existingSkills = this.store.countSkills("active");
|
|
2295
|
+
}
|
|
2296
|
+
catch { /* */ }
|
|
2297
|
+
this.jsonResponse(res, { ...this.ppState, existingTasks, existingSkills });
|
|
2142
2298
|
}
|
|
2143
2299
|
broadcastPPSSE(event, data) {
|
|
2144
2300
|
const payload = `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
|
|
@@ -2178,12 +2334,18 @@ class ViewerServer {
|
|
|
2178
2334
|
agentGroups.set(item.owner, group);
|
|
2179
2335
|
}
|
|
2180
2336
|
this.ppState.total = pendingItems.length;
|
|
2337
|
+
this.ppState.skippedSessions = skippedCount;
|
|
2338
|
+
this.ppState.totalSessions = importSessions.length;
|
|
2339
|
+
const existingTaskCount = this.store.db.prepare("SELECT COUNT(*) as c FROM tasks WHERE session_key IN (" + importSessions.map(() => "?").join(",") + ")").get(...importSessions)?.c ?? 0;
|
|
2340
|
+
const existingSkillCount = this.store.countSkills("active");
|
|
2181
2341
|
send("info", {
|
|
2182
2342
|
totalSessions: importSessions.length,
|
|
2183
2343
|
alreadyProcessed: skippedCount,
|
|
2184
2344
|
pending: pendingItems.length,
|
|
2185
2345
|
agents: Array.from(agentGroups.keys()),
|
|
2186
2346
|
concurrency,
|
|
2347
|
+
existingTasks: existingTaskCount,
|
|
2348
|
+
existingSkills: existingSkillCount,
|
|
2187
2349
|
});
|
|
2188
2350
|
send("progress", { processed: 0, total: pendingItems.length });
|
|
2189
2351
|
let globalIdx = 0;
|