@memtensor/memos-local-openclaw-plugin 1.0.2-beta.4 → 1.0.2-beta.6

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.
Files changed (87) hide show
  1. package/dist/capture/index.js +52 -8
  2. package/dist/capture/index.js.map +1 -1
  3. package/dist/ingest/chunker.d.ts +3 -4
  4. package/dist/ingest/chunker.d.ts.map +1 -1
  5. package/dist/ingest/chunker.js +19 -24
  6. package/dist/ingest/chunker.js.map +1 -1
  7. package/dist/ingest/providers/anthropic.d.ts +3 -1
  8. package/dist/ingest/providers/anthropic.d.ts.map +1 -1
  9. package/dist/ingest/providers/anthropic.js +90 -51
  10. package/dist/ingest/providers/anthropic.js.map +1 -1
  11. package/dist/ingest/providers/bedrock.d.ts +3 -1
  12. package/dist/ingest/providers/bedrock.d.ts.map +1 -1
  13. package/dist/ingest/providers/bedrock.js +90 -51
  14. package/dist/ingest/providers/bedrock.js.map +1 -1
  15. package/dist/ingest/providers/gemini.d.ts +3 -1
  16. package/dist/ingest/providers/gemini.d.ts.map +1 -1
  17. package/dist/ingest/providers/gemini.js +88 -51
  18. package/dist/ingest/providers/gemini.js.map +1 -1
  19. package/dist/ingest/providers/index.d.ts +3 -1
  20. package/dist/ingest/providers/index.d.ts.map +1 -1
  21. package/dist/ingest/providers/index.js +70 -30
  22. package/dist/ingest/providers/index.js.map +1 -1
  23. package/dist/ingest/providers/openai.d.ts +3 -1
  24. package/dist/ingest/providers/openai.d.ts.map +1 -1
  25. package/dist/ingest/providers/openai.js +91 -51
  26. package/dist/ingest/providers/openai.js.map +1 -1
  27. package/dist/ingest/task-processor.d.ts +1 -0
  28. package/dist/ingest/task-processor.d.ts.map +1 -1
  29. package/dist/ingest/task-processor.js +33 -9
  30. package/dist/ingest/task-processor.js.map +1 -1
  31. package/dist/ingest/worker.d.ts.map +1 -1
  32. package/dist/ingest/worker.js +29 -13
  33. package/dist/ingest/worker.js.map +1 -1
  34. package/dist/recall/engine.d.ts.map +1 -1
  35. package/dist/recall/engine.js +19 -14
  36. package/dist/recall/engine.js.map +1 -1
  37. package/dist/skill/bundled-memory-guide.d.ts +1 -5
  38. package/dist/skill/bundled-memory-guide.d.ts.map +1 -1
  39. package/dist/skill/bundled-memory-guide.js +38 -88
  40. package/dist/skill/bundled-memory-guide.js.map +1 -1
  41. package/dist/skill/evaluator.js +1 -1
  42. package/dist/storage/sqlite.d.ts +1 -2
  43. package/dist/storage/sqlite.d.ts.map +1 -1
  44. package/dist/storage/sqlite.js +90 -17
  45. package/dist/storage/sqlite.js.map +1 -1
  46. package/dist/tools/memory-get.d.ts.map +1 -1
  47. package/dist/tools/memory-get.js +1 -3
  48. package/dist/tools/memory-get.js.map +1 -1
  49. package/dist/types.d.ts +2 -2
  50. package/dist/types.d.ts.map +1 -1
  51. package/dist/types.js +1 -1
  52. package/dist/types.js.map +1 -1
  53. package/dist/update-check.d.ts +21 -0
  54. package/dist/update-check.d.ts.map +1 -0
  55. package/dist/update-check.js +111 -0
  56. package/dist/update-check.js.map +1 -0
  57. package/dist/viewer/html.d.ts +1 -1
  58. package/dist/viewer/html.d.ts.map +1 -1
  59. package/dist/viewer/html.js +608 -234
  60. package/dist/viewer/html.js.map +1 -1
  61. package/dist/viewer/server.d.ts +2 -1
  62. package/dist/viewer/server.d.ts.map +1 -1
  63. package/dist/viewer/server.js +201 -90
  64. package/dist/viewer/server.js.map +1 -1
  65. package/index.ts +206 -198
  66. package/openclaw.plugin.json +3 -0
  67. package/package.json +6 -1
  68. package/scripts/postinstall.cjs +69 -2
  69. package/skill/memos-memory-guide/SKILL.md +73 -36
  70. package/src/capture/index.ts +52 -8
  71. package/src/ingest/chunker.ts +22 -30
  72. package/src/ingest/providers/anthropic.ts +100 -53
  73. package/src/ingest/providers/bedrock.ts +101 -53
  74. package/src/ingest/providers/gemini.ts +100 -53
  75. package/src/ingest/providers/index.ts +81 -35
  76. package/src/ingest/providers/openai.ts +101 -53
  77. package/src/ingest/task-processor.ts +29 -8
  78. package/src/ingest/worker.ts +31 -13
  79. package/src/recall/engine.ts +20 -13
  80. package/src/skill/bundled-memory-guide.ts +5 -87
  81. package/src/skill/evaluator.ts +1 -1
  82. package/src/storage/sqlite.ts +93 -21
  83. package/src/tools/memory-get.ts +1 -4
  84. package/src/types.ts +2 -9
  85. package/src/update-check.ts +96 -0
  86. package/src/viewer/html.ts +607 -233
  87. package/src/viewer/server.ts +152 -82
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/viewer/html.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA62HpD,CAAC;AACT,CAAC"}
@@ -20,6 +20,7 @@ export declare class ViewerServer {
20
20
  private readonly auth;
21
21
  private readonly ctx?;
22
22
  private static readonly SESSION_TTL;
23
+ private static readonly PLUGIN_VERSION;
23
24
  private resetToken;
24
25
  private migrationRunning;
25
26
  private migrationAbort;
@@ -64,7 +65,6 @@ export declare class ViewerServer {
64
65
  private handleTaskUpdate;
65
66
  private handleSkillDelete;
66
67
  private handleSkillUpdate;
67
- private handleCreate;
68
68
  private serveMemoryDetail;
69
69
  private handleUpdate;
70
70
  private handleDelete;
@@ -78,6 +78,7 @@ export declare class ViewerServer {
78
78
  private serveFallbackModel;
79
79
  private findPluginPackageJson;
80
80
  private handleUpdateCheck;
81
+ private handleUpdateInstall;
81
82
  private testEmbeddingModel;
82
83
  private testChatModel;
83
84
  private serveLogs;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/viewer/server.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AA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AAkB;IAyC1B,OAAO,CAAC,qBAAqB;IA+B7B,OAAO,CAAC,oBAAoB;IAyB5B,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,eAAe;IA0BvB,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,WAAW;IA8BnB,OAAO,CAAC,gBAAgB;IA0CxB,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,kBAAkB;IA6B1B,OAAO,CAAC,qBAAqB;YAef,iBAAiB;IAmC/B,OAAO,CAAC,mBAAmB;YAyCb,kBAAkB;YAsElB,aAAa;IAkD3B,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,iBAAiB;IAmHzB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,kBAAkB;YA6EZ,YAAY;IA6Y1B,OAAO,CAAC,iBAAiB;IAwDzB,OAAO,CAAC,uBAAuB;IAqB/B,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,cAAc;YAOR,cAAc;IAiK5B,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,YAAY;CAIrB"}
@@ -1,4 +1,37 @@
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
  };
@@ -35,6 +68,15 @@ class ViewerServer {
35
68
  auth;
36
69
  ctx;
37
70
  static SESSION_TTL = 24 * 60 * 60 * 1000;
71
+ static PLUGIN_VERSION = (() => {
72
+ try {
73
+ const pkgPath = node_path_1.default.resolve(__dirname, "../../package.json");
74
+ return JSON.parse(node_fs_1.default.readFileSync(pkgPath, "utf-8")).version ?? "unknown";
75
+ }
76
+ catch {
77
+ return "unknown";
78
+ }
79
+ })();
38
80
  resetToken;
39
81
  migrationRunning = false;
40
82
  migrationAbort = false;
@@ -42,7 +84,7 @@ class ViewerServer {
42
84
  migrationSSEClients = [];
43
85
  ppRunning = false;
44
86
  ppAbort = false;
45
- ppState = { running: false, done: false, stopped: false, processed: 0, total: 0, tasksCreated: 0, skillsCreated: 0, errors: 0 };
87
+ ppState = { running: false, done: false, stopped: false, processed: 0, total: 0, tasksCreated: 0, skillsCreated: 0, errors: 0, skippedSessions: 0, totalSessions: 0 };
46
88
  ppSSEClients = [];
47
89
  constructor(opts) {
48
90
  this.store = opts.store;
@@ -213,8 +255,6 @@ class ViewerServer {
213
255
  this.handleSkillUpdate(req, res, p);
214
256
  else if (p.startsWith("/api/skill/") && req.method === "GET")
215
257
  this.serveSkillDetail(res, p);
216
- else if (p === "/api/memory" && req.method === "POST")
217
- this.handleCreate(req, res);
218
258
  else if (p.startsWith("/api/memory/") && req.method === "GET")
219
259
  this.serveMemoryDetail(res, p);
220
260
  else if (p.startsWith("/api/memory/") && req.method === "PUT")
@@ -241,6 +281,8 @@ class ViewerServer {
241
281
  this.serveFallbackModel(res);
242
282
  else if (p === "/api/update-check" && req.method === "GET")
243
283
  this.handleUpdateCheck(res);
284
+ else if (p === "/api/update-install" && req.method === "POST")
285
+ this.handleUpdateInstall(req, res);
244
286
  else if (p === "/api/auth/logout" && req.method === "POST")
245
287
  this.handleLogout(req, res);
246
288
  else if (p === "/api/cleanup-polluted" && req.method === "POST")
@@ -372,7 +414,7 @@ class ViewerServer {
372
414
  // ─── Pages ───
373
415
  serveViewer(res) {
374
416
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store, no-cache, must-revalidate, max-age=0", "Pragma": "no-cache", "Expires": "0" });
375
- res.end(html_1.viewerHTML);
417
+ res.end((0, html_1.viewerHTML)(ViewerServer.PLUGIN_VERSION));
376
418
  }
377
419
  // ─── Data APIs ───
378
420
  serveMemories(res, url) {
@@ -381,7 +423,6 @@ class ViewerServer {
381
423
  const offset = (page - 1) * limit;
382
424
  const session = url.searchParams.get("session") ?? undefined;
383
425
  const role = url.searchParams.get("role") ?? undefined;
384
- const kind = url.searchParams.get("kind") ?? undefined;
385
426
  const dateFrom = url.searchParams.get("dateFrom") ?? undefined;
386
427
  const dateTo = url.searchParams.get("dateTo") ?? undefined;
387
428
  const owner = url.searchParams.get("owner") ?? undefined;
@@ -397,10 +438,6 @@ class ViewerServer {
397
438
  conditions.push("role = ?");
398
439
  params.push(role);
399
440
  }
400
- if (kind) {
401
- conditions.push("kind = ?");
402
- params.push(kind);
403
- }
404
441
  if (owner) {
405
442
  conditions.push("owner = ?");
406
443
  params.push(owner);
@@ -416,9 +453,14 @@ class ViewerServer {
416
453
  const where = conditions.length > 0 ? " WHERE " + conditions.join(" AND ") : "";
417
454
  const totalRow = db.prepare("SELECT COUNT(*) as count FROM chunks" + where).get(...params);
418
455
  const rawMemories = db.prepare("SELECT * FROM chunks" + where + ` ORDER BY created_at ${sortBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
456
+ const findMergeSources = db.prepare("SELECT id, summary, role FROM chunks WHERE dedup_target = ? AND (dedup_status = 'merged' OR dedup_status = 'duplicate')");
419
457
  const memories = rawMemories.map((m) => {
420
458
  if (m.role === "user" && m.content) {
421
- return { ...m, content: (0, capture_1.stripInboundMetadata)(m.content) };
459
+ m = { ...m, content: (0, capture_1.stripInboundMetadata)(m.content) };
460
+ }
461
+ if (m.merge_count > 0) {
462
+ const sources = findMergeSources.all(m.id);
463
+ m.merge_sources = sources;
422
464
  }
423
465
  return m;
424
466
  });
@@ -451,7 +493,7 @@ class ViewerServer {
451
493
  id: t.id,
452
494
  sessionKey: t.sessionKey,
453
495
  title: t.title,
454
- summary: t.summary ? (t.summary.length > 300 ? t.summary.slice(0, 297) + "..." : t.summary) : "",
496
+ summary: t.summary ?? "",
455
497
  status: t.status,
456
498
  startedAt: t.startedAt,
457
499
  endedAt: t.endedAt,
@@ -471,9 +513,7 @@ class ViewerServer {
471
513
  }
472
514
  const chunks = this.store.getChunksByTask(taskId);
473
515
  const chunkItems = chunks.map((c) => {
474
- let text = c.role === "user" ? (0, capture_1.stripInboundMetadata)(c.content) : c.content;
475
- if (text.length > 500)
476
- text = text.slice(0, 497) + "...";
516
+ const text = c.role === "user" ? (0, capture_1.stripInboundMetadata)(c.content) : c.content;
477
517
  return { id: c.id, role: c.role, content: text, summary: c.summary, createdAt: c.createdAt };
478
518
  });
479
519
  const relatedSkills = this.store.getSkillsByTask(taskId);
@@ -505,7 +545,7 @@ class ViewerServer {
505
545
  const emptyStats = {
506
546
  totalMemories: 0, totalSessions: 0, totalEmbeddings: 0, totalSkills: 0,
507
547
  embeddingProvider: this.embedder?.provider ?? "none",
508
- roleBreakdown: {}, kindBreakdown: {}, dedupBreakdown: {},
548
+ dedupBreakdown: {},
509
549
  timeRange: { earliest: null, latest: null },
510
550
  sessions: [],
511
551
  };
@@ -517,7 +557,6 @@ class ViewerServer {
517
557
  const db = this.store.db;
518
558
  const total = db.prepare("SELECT COUNT(*) as count FROM chunks").get();
519
559
  const sessions = db.prepare("SELECT COUNT(DISTINCT session_key) as count FROM chunks").get();
520
- const roles = db.prepare("SELECT role, COUNT(*) as count FROM chunks GROUP BY role").all();
521
560
  const timeRange = db.prepare("SELECT MIN(created_at) as earliest, MAX(created_at) as latest FROM chunks WHERE dedup_status = 'active'").get();
522
561
  const MIN_VALID_TS = 1704067200000; // 2024-01-01
523
562
  if (timeRange.earliest != null && timeRange.earliest < MIN_VALID_TS) {
@@ -532,7 +571,6 @@ class ViewerServer {
532
571
  embCount = db.prepare("SELECT COUNT(*) as count FROM embeddings").get().count;
533
572
  }
534
573
  catch { /* table may not exist */ }
535
- const kinds = db.prepare("SELECT kind, COUNT(*) as count FROM chunks GROUP BY kind").all();
536
574
  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();
537
575
  let skillCount = 0;
538
576
  try {
@@ -555,8 +593,6 @@ class ViewerServer {
555
593
  totalMemories: total.count, totalSessions: sessions.count, totalEmbeddings: embCount,
556
594
  totalSkills: skillCount,
557
595
  embeddingProvider: this.embedder.provider,
558
- roleBreakdown: Object.fromEntries(roles.map((r) => [r.role, r.count])),
559
- kindBreakdown: Object.fromEntries(kinds.map((k) => [k.kind, k.count])),
560
596
  dedupBreakdown,
561
597
  timeRange: { earliest: timeRange.earliest, latest: timeRange.latest },
562
598
  sessions: sessionList,
@@ -575,13 +611,16 @@ class ViewerServer {
575
611
  return;
576
612
  }
577
613
  const role = url.searchParams.get("role") ?? undefined;
578
- const kind = url.searchParams.get("kind") ?? undefined;
614
+ const session = url.searchParams.get("session") ?? undefined;
615
+ const owner = url.searchParams.get("owner") ?? undefined;
579
616
  const dateFrom = url.searchParams.get("dateFrom") ?? undefined;
580
617
  const dateTo = url.searchParams.get("dateTo") ?? undefined;
581
618
  const passesFilter = (r) => {
582
619
  if (role && r.role !== role)
583
620
  return false;
584
- if (kind && r.kind !== kind)
621
+ if (session && r.session_key !== session)
622
+ return false;
623
+ if (owner && r.owner !== owner)
585
624
  return false;
586
625
  if (dateFrom && r.created_at < new Date(dateFrom).getTime())
587
626
  return false;
@@ -589,29 +628,61 @@ class ViewerServer {
589
628
  return false;
590
629
  return true;
591
630
  };
631
+ const ftsFilters = [];
632
+ const likeFilters = [];
633
+ const sqlParams = [];
634
+ if (session) {
635
+ ftsFilters.push("c.session_key = ?");
636
+ likeFilters.push("session_key = ?");
637
+ sqlParams.push(session);
638
+ }
639
+ if (owner) {
640
+ ftsFilters.push("c.owner = ?");
641
+ likeFilters.push("owner = ?");
642
+ sqlParams.push(owner);
643
+ }
644
+ const ftsWhere = ftsFilters.length > 0 ? " AND " + ftsFilters.join(" AND ") : "";
645
+ const likeWhere = likeFilters.length > 0 ? " AND " + likeFilters.join(" AND ") : "";
592
646
  const db = this.store.db;
593
647
  let ftsResults = [];
594
648
  try {
595
- ftsResults = db.prepare("SELECT c.* FROM chunks_fts f JOIN chunks c ON f.rowid = c.rowid WHERE chunks_fts MATCH ? ORDER BY rank LIMIT 100").all(q).filter(passesFilter);
649
+ ftsResults = db.prepare(`SELECT c.* FROM chunks_fts f JOIN chunks c ON f.rowid = c.rowid WHERE chunks_fts MATCH ?${ftsWhere} ORDER BY rank LIMIT 100`).all(q, ...sqlParams).filter(passesFilter);
596
650
  }
597
651
  catch { /* FTS syntax error, fall through */ }
598
652
  if (ftsResults.length === 0) {
599
- ftsResults = db.prepare("SELECT * FROM chunks WHERE content LIKE ? OR summary LIKE ? ORDER BY created_at DESC LIMIT 100").all(`%${q}%`, `%${q}%`).filter(passesFilter);
653
+ try {
654
+ ftsResults = db.prepare(`SELECT * FROM chunks WHERE (content LIKE ? OR summary LIKE ?)${likeWhere} ORDER BY created_at DESC LIMIT 100`).all(`%${q}%`, `%${q}%`, ...sqlParams).filter(passesFilter);
655
+ }
656
+ catch (err) {
657
+ this.log.warn(`LIKE search failed: ${err}`);
658
+ }
600
659
  }
601
660
  const SEMANTIC_THRESHOLD = 0.64;
661
+ const VECTOR_TIMEOUT_MS = 8000;
602
662
  let vectorResults = [];
603
663
  let scoreMap = new Map();
604
664
  try {
605
- const queryVec = await this.embedder.embedQuery(q);
606
- const hits = (0, vector_1.vectorSearch)(this.store, queryVec, 40);
607
- scoreMap = new Map(hits.map(h => [h.chunkId, h.score]));
608
- const hitIds = new Set(hits.filter(h => h.score >= SEMANTIC_THRESHOLD).map(h => h.chunkId));
609
- if (hitIds.size > 0) {
610
- const placeholders = [...hitIds].map(() => "?").join(",");
611
- const rows = db.prepare(`SELECT * FROM chunks WHERE id IN (${placeholders})`).all(...hitIds).filter(passesFilter);
612
- rows.forEach((r) => { r._vscore = scoreMap.get(r.id) ?? 0; });
613
- rows.sort((a, b) => (b._vscore ?? 0) - (a._vscore ?? 0));
614
- vectorResults = rows;
665
+ const vecPromise = (async () => {
666
+ const queryVec = await this.embedder.embedQuery(q);
667
+ return (0, vector_1.vectorSearch)(this.store, queryVec, 40);
668
+ })();
669
+ const hits = await Promise.race([
670
+ vecPromise,
671
+ new Promise((resolve) => setTimeout(() => resolve(null), VECTOR_TIMEOUT_MS)),
672
+ ]);
673
+ if (hits) {
674
+ scoreMap = new Map(hits.map(h => [h.chunkId, h.score]));
675
+ const hitIds = new Set(hits.filter(h => h.score >= SEMANTIC_THRESHOLD).map(h => h.chunkId));
676
+ if (hitIds.size > 0) {
677
+ const placeholders = [...hitIds].map(() => "?").join(",");
678
+ const rows = db.prepare(`SELECT * FROM chunks WHERE id IN (${placeholders})${likeWhere}`).all(...hitIds, ...sqlParams).filter(passesFilter);
679
+ rows.forEach((r) => { r._vscore = scoreMap.get(r.id) ?? 0; });
680
+ rows.sort((a, b) => (b._vscore ?? 0) - (a._vscore ?? 0));
681
+ vectorResults = rows;
682
+ }
683
+ }
684
+ else {
685
+ this.log.warn("Vector search timed out, returning FTS results only");
615
686
  }
616
687
  }
617
688
  catch (err) {
@@ -914,35 +985,6 @@ class ViewerServer {
914
985
  });
915
986
  }
916
987
  // ─── CRUD ───
917
- handleCreate(req, res) {
918
- this.readBody(req, (body) => {
919
- try {
920
- const data = JSON.parse(body);
921
- if (!data.content || typeof data.content !== "string" || !data.content.trim()) {
922
- res.writeHead(400, { "Content-Type": "application/json" });
923
- res.end(JSON.stringify({ error: "content is required and must be a non-empty string" }));
924
- return;
925
- }
926
- const { v4: uuidv4 } = require("uuid");
927
- const id = uuidv4();
928
- const now = Date.now();
929
- this.store.insertChunk({
930
- id, sessionKey: data.session_key || "manual", turnId: `manual-${now}`, seq: 0,
931
- role: data.role || "user", content: data.content, kind: data.kind || "paragraph",
932
- summary: data.summary || data.content.slice(0, 100),
933
- taskId: null, skillId: null, owner: data.owner || "agent:main",
934
- dedupStatus: "active", dedupTarget: null, dedupReason: null,
935
- mergeCount: 0, lastHitAt: null, mergeHistory: "[]",
936
- createdAt: now, updatedAt: now, embedding: null,
937
- });
938
- this.jsonResponse(res, { ok: true, id, message: "Memory created" });
939
- }
940
- catch (err) {
941
- res.writeHead(400, { "Content-Type": "application/json" });
942
- res.end(JSON.stringify({ error: String(err) }));
943
- }
944
- });
945
- }
946
988
  serveMemoryDetail(res, urlPath) {
947
989
  const chunkId = urlPath.replace("/api/memory/", "");
948
990
  const chunk = this.store.getChunk(chunkId);
@@ -966,7 +1008,7 @@ class ViewerServer {
966
1008
  res.end(JSON.stringify({ error: "content must be a non-empty string" }));
967
1009
  return;
968
1010
  }
969
- const ok = this.store.updateChunk(chunkId, { summary: data.summary, content: data.content, role: data.role, kind: data.kind, owner: data.owner });
1011
+ const ok = this.store.updateChunk(chunkId, { summary: data.summary, content: data.content, role: data.role, owner: data.owner });
970
1012
  if (ok)
971
1013
  this.jsonResponse(res, { ok: true, message: "Memory updated" });
972
1014
  else {
@@ -1192,20 +1234,20 @@ class ViewerServer {
1192
1234
  this.jsonResponse(res, { updateAvailable: false, current });
1193
1235
  return;
1194
1236
  }
1195
- const npmResp = await fetch(`https://registry.npmjs.org/${name}/latest`, {
1196
- signal: AbortSignal.timeout(6_000),
1197
- });
1198
- if (!npmResp.ok) {
1199
- this.jsonResponse(res, { updateAvailable: false, current });
1237
+ const { computeUpdateCheck } = await Promise.resolve().then(() => __importStar(require("../update-check")));
1238
+ const result = await computeUpdateCheck(name, current, fetch, 6_000);
1239
+ if (!result) {
1240
+ this.jsonResponse(res, { updateAvailable: false, current, packageName: name });
1200
1241
  return;
1201
1242
  }
1202
- const data = await npmResp.json();
1203
- const latest = data.version ?? current;
1204
1243
  this.jsonResponse(res, {
1205
- updateAvailable: latest !== current,
1206
- current,
1207
- latest,
1208
- packageName: name,
1244
+ updateAvailable: result.updateAvailable,
1245
+ current: result.current,
1246
+ latest: result.latest,
1247
+ packageName: result.packageName,
1248
+ channel: result.channel,
1249
+ installCommand: result.installCommand,
1250
+ stableChannel: result.stableChannel,
1209
1251
  });
1210
1252
  }
1211
1253
  catch (e) {
@@ -1213,6 +1255,49 @@ class ViewerServer {
1213
1255
  this.jsonResponse(res, { updateAvailable: false, error: String(e) });
1214
1256
  }
1215
1257
  }
1258
+ handleUpdateInstall(req, res) {
1259
+ let body = "";
1260
+ req.on("data", (chunk) => { body += chunk.toString(); });
1261
+ req.on("end", () => {
1262
+ try {
1263
+ const { packageSpec } = JSON.parse(body);
1264
+ if (!packageSpec || typeof packageSpec !== "string") {
1265
+ res.writeHead(400, { "Content-Type": "application/json" });
1266
+ res.end(JSON.stringify({ ok: false, error: "Missing packageSpec" }));
1267
+ return;
1268
+ }
1269
+ const allowed = /^@[\w-]+\/[\w.-]+(@[\w.-]+)?$/;
1270
+ if (!allowed.test(packageSpec)) {
1271
+ res.writeHead(400, { "Content-Type": "application/json" });
1272
+ res.end(JSON.stringify({ ok: false, error: "Invalid package spec" }));
1273
+ return;
1274
+ }
1275
+ this.log.info(`update-install: installing ${packageSpec}...`);
1276
+ (0, node_child_process_1.exec)(`npx openclaw plugins install ${packageSpec}`, { timeout: 120_000 }, (err, stdout, stderr) => {
1277
+ if (err) {
1278
+ this.log.warn(`update-install failed: ${err.message}\n${stderr}`);
1279
+ this.jsonResponse(res, { ok: false, error: stderr || err.message });
1280
+ return;
1281
+ }
1282
+ this.log.info(`update-install success: ${stdout}`);
1283
+ this.jsonResponse(res, { ok: true, output: stdout });
1284
+ this.log.info(`update-install: restarting gateway...`);
1285
+ setTimeout(() => {
1286
+ (0, node_child_process_1.exec)("npx openclaw gateway restart", { timeout: 30_000 }, (restartErr) => {
1287
+ if (restartErr)
1288
+ this.log.warn(`gateway restart failed: ${restartErr.message}`);
1289
+ else
1290
+ this.log.info("gateway restart initiated");
1291
+ });
1292
+ }, 1000);
1293
+ });
1294
+ }
1295
+ catch (e) {
1296
+ res.writeHead(400, { "Content-Type": "application/json" });
1297
+ res.end(JSON.stringify({ ok: false, error: String(e) }));
1298
+ }
1299
+ });
1300
+ }
1216
1301
  async testEmbeddingModel(provider, model, endpoint, apiKey) {
1217
1302
  if (provider === "local") {
1218
1303
  return 384;
@@ -1445,10 +1530,16 @@ class ViewerServer {
1445
1530
  catch { /* ignore */ }
1446
1531
  }
1447
1532
  let importedSessions = [];
1533
+ let importedChunkCount = 0;
1448
1534
  try {
1449
1535
  if (this.store) {
1450
1536
  importedSessions = this.store.getDistinctSessionKeys()
1451
1537
  .filter((sk) => sk.startsWith("openclaw-import-") || sk.startsWith("openclaw-session-"));
1538
+ if (importedSessions.length > 0) {
1539
+ const placeholders = importedSessions.map(() => "?").join(",");
1540
+ const row = this.store.db.prepare(`SELECT COUNT(*) as cnt FROM chunks WHERE session_key IN (${placeholders})`).get(...importedSessions);
1541
+ importedChunkCount = row?.cnt ?? 0;
1542
+ }
1452
1543
  }
1453
1544
  }
1454
1545
  catch (storeErr) {
@@ -1463,6 +1554,7 @@ class ViewerServer {
1463
1554
  hasSummarizer,
1464
1555
  hasImportedData: importedSessions.length > 0,
1465
1556
  importedSessionCount: importedSessions.length,
1557
+ importedChunkCount,
1466
1558
  });
1467
1559
  }
1468
1560
  catch (e) {
@@ -1599,14 +1691,17 @@ class ViewerServer {
1599
1691
  else {
1600
1692
  this.broadcastSSE("done", { ok: true });
1601
1693
  }
1602
- for (const c of this.migrationSSEClients) {
1603
- try {
1604
- c.end();
1605
- }
1606
- catch { /* ignore */ }
1607
- }
1608
- this.migrationSSEClients = [];
1609
1694
  this.migrationAbort = false;
1695
+ const clientsToClose = [...this.migrationSSEClients];
1696
+ this.migrationSSEClients = [];
1697
+ setTimeout(() => {
1698
+ for (const c of clientsToClose) {
1699
+ try {
1700
+ c.end();
1701
+ }
1702
+ catch { /* ignore */ }
1703
+ }
1704
+ }, 500);
1610
1705
  });
1611
1706
  });
1612
1707
  }
@@ -2038,7 +2133,7 @@ class ViewerServer {
2038
2133
  this.ppSSEClients.push(res);
2039
2134
  res.on("close", () => { this.ppSSEClients = this.ppSSEClients.filter(c => c !== res); });
2040
2135
  this.ppAbort = false;
2041
- this.ppState = { running: true, done: false, stopped: false, processed: 0, total: 0, tasksCreated: 0, skillsCreated: 0, errors: 0 };
2136
+ this.ppState = { running: true, done: false, stopped: false, processed: 0, total: 0, tasksCreated: 0, skillsCreated: 0, errors: 0, skippedSessions: 0, totalSessions: 0 };
2042
2137
  const send = (event, data) => {
2043
2138
  this.broadcastPPSSE(event, data);
2044
2139
  };
@@ -2054,14 +2149,17 @@ class ViewerServer {
2054
2149
  else {
2055
2150
  this.broadcastPPSSE("done", { ...this.ppState });
2056
2151
  }
2057
- for (const c of this.ppSSEClients) {
2058
- try {
2059
- c.end();
2060
- }
2061
- catch { /* */ }
2062
- }
2063
- this.ppSSEClients = [];
2064
2152
  this.ppAbort = false;
2153
+ const ppClientsToClose = [...this.ppSSEClients];
2154
+ this.ppSSEClients = [];
2155
+ setTimeout(() => {
2156
+ for (const c of ppClientsToClose) {
2157
+ try {
2158
+ c.end();
2159
+ }
2160
+ catch { /* */ }
2161
+ }
2162
+ }, 500);
2065
2163
  });
2066
2164
  });
2067
2165
  }
@@ -2091,7 +2189,14 @@ class ViewerServer {
2091
2189
  this.jsonResponse(res, { ok: true });
2092
2190
  }
2093
2191
  handlePostprocessStatus(res) {
2094
- this.jsonResponse(res, this.ppState);
2192
+ let existingTasks = 0;
2193
+ let existingSkills = 0;
2194
+ try {
2195
+ existingTasks = this.store.db.prepare("SELECT COUNT(*) as c FROM tasks").get()?.c ?? 0;
2196
+ existingSkills = this.store.countSkills("active");
2197
+ }
2198
+ catch { /* */ }
2199
+ this.jsonResponse(res, { ...this.ppState, existingTasks, existingSkills });
2095
2200
  }
2096
2201
  broadcastPPSSE(event, data) {
2097
2202
  const payload = `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
@@ -2131,12 +2236,18 @@ class ViewerServer {
2131
2236
  agentGroups.set(item.owner, group);
2132
2237
  }
2133
2238
  this.ppState.total = pendingItems.length;
2239
+ this.ppState.skippedSessions = skippedCount;
2240
+ this.ppState.totalSessions = importSessions.length;
2241
+ const existingTaskCount = this.store.db.prepare("SELECT COUNT(*) as c FROM tasks WHERE session_key IN (" + importSessions.map(() => "?").join(",") + ")").get(...importSessions)?.c ?? 0;
2242
+ const existingSkillCount = this.store.countSkills("active");
2134
2243
  send("info", {
2135
2244
  totalSessions: importSessions.length,
2136
2245
  alreadyProcessed: skippedCount,
2137
2246
  pending: pendingItems.length,
2138
2247
  agents: Array.from(agentGroups.keys()),
2139
2248
  concurrency,
2249
+ existingTasks: existingTaskCount,
2250
+ existingSkills: existingSkillCount,
2140
2251
  });
2141
2252
  send("progress", { processed: 0, total: pendingItems.length });
2142
2253
  let globalIdx = 0;