@memtensor/memos-local-openclaw-plugin 1.0.4-beta.7 → 1.0.4-beta.8
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/README.md +1 -1
- package/dist/capture/index.d.ts.map +1 -1
- package/dist/capture/index.js +6 -0
- package/dist/capture/index.js.map +1 -1
- package/dist/client/connector.d.ts.map +1 -1
- package/dist/client/connector.js +17 -4
- package/dist/client/connector.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -2
- package/dist/config.js.map +1 -1
- package/dist/hub/server.d.ts +7 -0
- package/dist/hub/server.d.ts.map +1 -1
- package/dist/hub/server.js +160 -5
- package/dist/hub/server.js.map +1 -1
- package/dist/ingest/providers/index.d.ts.map +1 -1
- package/dist/ingest/providers/index.js +37 -6
- package/dist/ingest/providers/index.js.map +1 -1
- package/dist/shared/llm-call.d.ts +1 -0
- package/dist/shared/llm-call.d.ts.map +1 -1
- package/dist/shared/llm-call.js +82 -8
- package/dist/shared/llm-call.js.map +1 -1
- package/dist/skill/evolver.d.ts +2 -0
- package/dist/skill/evolver.d.ts.map +1 -1
- package/dist/skill/evolver.js +3 -0
- package/dist/skill/evolver.js.map +1 -1
- package/dist/storage/sqlite.d.ts +4 -1
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +8 -4
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/telemetry.d.ts +12 -5
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +135 -38
- package/dist/telemetry.js.map +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/viewer/html.d.ts.map +1 -1
- package/dist/viewer/html.js +473 -191
- package/dist/viewer/html.js.map +1 -1
- package/dist/viewer/server.d.ts +14 -0
- package/dist/viewer/server.d.ts.map +1 -1
- package/dist/viewer/server.js +233 -20
- package/dist/viewer/server.js.map +1 -1
- package/index.ts +26 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -2
- package/scripts/postinstall.cjs +1 -1
- package/src/capture/index.ts +8 -0
- package/src/client/connector.ts +17 -4
- package/src/config.ts +0 -2
- package/src/hub/server.ts +157 -5
- package/src/ingest/providers/index.ts +41 -7
- package/src/shared/llm-call.ts +97 -9
- package/src/skill/evolver.ts +5 -0
- package/src/storage/sqlite.ts +11 -6
- package/src/telemetry.ts +152 -39
- package/src/types.ts +1 -2
- package/src/viewer/html.ts +473 -191
- package/src/viewer/server.ts +208 -20
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,gCAw3QC;AAx3QD,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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@ -30,6 +30,11 @@ export declare class ViewerServer {
|
|
|
30
30
|
private ppAbort;
|
|
31
31
|
private ppState;
|
|
32
32
|
private ppSSEClients;
|
|
33
|
+
private notifSSEClients;
|
|
34
|
+
private notifPollTimer?;
|
|
35
|
+
private lastKnownNotifCount;
|
|
36
|
+
private hubHeartbeatTimer?;
|
|
37
|
+
private static readonly HUB_HEARTBEAT_INTERVAL_MS;
|
|
33
38
|
constructor(opts: ViewerServerOptions);
|
|
34
39
|
start(): Promise<string>;
|
|
35
40
|
private autoCleanupPolluted;
|
|
@@ -111,6 +116,8 @@ export declare class ViewerServer {
|
|
|
111
116
|
private serveSharingUsers;
|
|
112
117
|
private serveAdminSharedTasks;
|
|
113
118
|
private handleAdminDeleteTask;
|
|
119
|
+
private serveHubTaskDetail;
|
|
120
|
+
private serveHubSkillDetail;
|
|
114
121
|
private serveAdminSharedSkills;
|
|
115
122
|
private handleAdminDeleteSkill;
|
|
116
123
|
private serveAdminSharedMemories;
|
|
@@ -118,10 +125,17 @@ export declare class ViewerServer {
|
|
|
118
125
|
private serveSharingNotifications;
|
|
119
126
|
private handleSharingNotificationsRead;
|
|
120
127
|
private handleSharingNotificationsClear;
|
|
128
|
+
private handleNotifSSE;
|
|
129
|
+
private broadcastNotifSSE;
|
|
130
|
+
private startNotifPoll;
|
|
131
|
+
private stopNotifPoll;
|
|
132
|
+
private startHubHeartbeat;
|
|
133
|
+
private stopHubHeartbeat;
|
|
121
134
|
private getLocalIPs;
|
|
122
135
|
private serveLocalIPs;
|
|
123
136
|
private serveConfig;
|
|
124
137
|
private handleSaveConfig;
|
|
138
|
+
private notifyHubLeave;
|
|
125
139
|
private handleUpdateUsername;
|
|
126
140
|
private handleTestHubConnection;
|
|
127
141
|
private handleTestModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/viewer/server.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,m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IAcvC,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,WAAW;IAgCnB,OAAO,CAAC,gBAAgB;YAiFV,cAAc;IAkB5B,OAAO,CAAC,oBAAoB;IAgD5B,OAAO,CAAC,uBAAuB;IAkC/B,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,kBAAkB;IA6B1B,OAAO,CAAC,qBAAqB;YAef,iBAAiB;IAmC/B,OAAO,CAAC,mBAAmB;YA8Hb,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"}
|
package/dist/viewer/server.js
CHANGED
|
@@ -91,6 +91,11 @@ class ViewerServer {
|
|
|
91
91
|
ppAbort = false;
|
|
92
92
|
ppState = { running: false, done: false, stopped: false, processed: 0, total: 0, tasksCreated: 0, skillsCreated: 0, errors: 0, skippedSessions: 0, totalSessions: 0 };
|
|
93
93
|
ppSSEClients = [];
|
|
94
|
+
notifSSEClients = [];
|
|
95
|
+
notifPollTimer;
|
|
96
|
+
lastKnownNotifCount = 0;
|
|
97
|
+
hubHeartbeatTimer;
|
|
98
|
+
static HUB_HEARTBEAT_INTERVAL_MS = 45_000;
|
|
94
99
|
constructor(opts) {
|
|
95
100
|
this.store = opts.store;
|
|
96
101
|
this.embedder = opts.embedder;
|
|
@@ -109,16 +114,17 @@ class ViewerServer {
|
|
|
109
114
|
this.server.on("error", (err) => {
|
|
110
115
|
if (err.code === "EADDRINUSE") {
|
|
111
116
|
this.log.warn(`Viewer port ${this.port} in use, trying ${this.port + 1}`);
|
|
112
|
-
this.server.listen(this.port + 1, "
|
|
117
|
+
this.server.listen(this.port + 1, "0.0.0.0");
|
|
113
118
|
}
|
|
114
119
|
else {
|
|
115
120
|
reject(err);
|
|
116
121
|
}
|
|
117
122
|
});
|
|
118
|
-
this.server.listen(this.port, "
|
|
123
|
+
this.server.listen(this.port, "0.0.0.0", () => {
|
|
119
124
|
const addr = this.server.address();
|
|
120
125
|
const actualPort = typeof addr === "object" && addr ? addr.port : this.port;
|
|
121
126
|
this.autoCleanupPolluted();
|
|
127
|
+
this.startHubHeartbeat();
|
|
122
128
|
resolve(`http://127.0.0.1:${actualPort}`);
|
|
123
129
|
});
|
|
124
130
|
});
|
|
@@ -141,6 +147,15 @@ class ViewerServer {
|
|
|
141
147
|
}
|
|
142
148
|
}
|
|
143
149
|
stop() {
|
|
150
|
+
this.stopHubHeartbeat();
|
|
151
|
+
this.stopNotifPoll();
|
|
152
|
+
for (const c of this.notifSSEClients) {
|
|
153
|
+
try {
|
|
154
|
+
c.end();
|
|
155
|
+
}
|
|
156
|
+
catch { }
|
|
157
|
+
}
|
|
158
|
+
this.notifSSEClients = [];
|
|
144
159
|
this.server?.close();
|
|
145
160
|
this.server = null;
|
|
146
161
|
}
|
|
@@ -338,12 +353,18 @@ class ViewerServer {
|
|
|
338
353
|
this.handleSharingNotificationsRead(req, res);
|
|
339
354
|
else if (p === "/api/sharing/notifications/clear" && req.method === "POST")
|
|
340
355
|
this.handleSharingNotificationsClear(req, res);
|
|
356
|
+
else if (p === "/api/notifications/stream" && req.method === "GET")
|
|
357
|
+
this.handleNotifSSE(req, res);
|
|
341
358
|
else if (p === "/api/admin/shared-tasks" && req.method === "GET")
|
|
342
359
|
this.serveAdminSharedTasks(res);
|
|
360
|
+
else if (p.match(/^\/api\/admin\/shared-tasks\/[^/]+\/detail$/) && req.method === "GET")
|
|
361
|
+
this.serveHubTaskDetail(res, p);
|
|
343
362
|
else if (p.match(/^\/api\/admin\/shared-tasks\/[^/]+$/) && req.method === "DELETE")
|
|
344
363
|
this.handleAdminDeleteTask(res, p);
|
|
345
364
|
else if (p === "/api/admin/shared-skills" && req.method === "GET")
|
|
346
365
|
this.serveAdminSharedSkills(res);
|
|
366
|
+
else if (p.match(/^\/api\/admin\/shared-skills\/[^/]+\/detail$/) && req.method === "GET")
|
|
367
|
+
this.serveHubSkillDetail(res, p);
|
|
347
368
|
else if (p.match(/^\/api\/admin\/shared-skills\/[^/]+$/) && req.method === "DELETE")
|
|
348
369
|
this.handleAdminDeleteSkill(res, p);
|
|
349
370
|
else if (p === "/api/admin/shared-memories" && req.method === "GET")
|
|
@@ -521,7 +542,12 @@ class ViewerServer {
|
|
|
521
542
|
conditions.push("role = ?");
|
|
522
543
|
params.push(role);
|
|
523
544
|
}
|
|
524
|
-
if (owner) {
|
|
545
|
+
if (owner && owner.startsWith("agent:")) {
|
|
546
|
+
const agentPrefix = owner + ":";
|
|
547
|
+
conditions.push("(owner = ? OR (owner = 'public' AND session_key LIKE ?))");
|
|
548
|
+
params.push(owner, agentPrefix + "%");
|
|
549
|
+
}
|
|
550
|
+
else if (owner) {
|
|
525
551
|
conditions.push("owner = ?");
|
|
526
552
|
params.push(owner);
|
|
527
553
|
}
|
|
@@ -601,9 +627,10 @@ class ViewerServer {
|
|
|
601
627
|
serveTasks(res, url) {
|
|
602
628
|
this.store.recordViewerEvent("tasks_list");
|
|
603
629
|
const status = url.searchParams.get("status") ?? undefined;
|
|
630
|
+
const owner = url.searchParams.get("owner") ?? undefined;
|
|
604
631
|
const limit = Math.min(100, Math.max(1, Number(url.searchParams.get("limit")) || 50));
|
|
605
632
|
const offset = Math.max(0, Number(url.searchParams.get("offset")) || 0);
|
|
606
|
-
const { tasks, total } = this.store.listTasks({ status, limit, offset });
|
|
633
|
+
const { tasks, total } = this.store.listTasks({ status, limit, offset, owner });
|
|
607
634
|
const db = this.store.db;
|
|
608
635
|
const items = tasks.map((t) => {
|
|
609
636
|
const meta = db.prepare("SELECT skill_status, owner FROM tasks WHERE id = ?").get(t.id);
|
|
@@ -698,12 +725,22 @@ class ViewerServer {
|
|
|
698
725
|
embCount = db.prepare("SELECT COUNT(*) as count FROM embeddings").get().count;
|
|
699
726
|
}
|
|
700
727
|
catch { /* table may not exist */ }
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
728
|
+
let sessionQuery;
|
|
729
|
+
let sessionParams;
|
|
730
|
+
if (ownerFilter && ownerFilter.startsWith("agent:")) {
|
|
731
|
+
const agentPrefix = ownerFilter + ":";
|
|
732
|
+
sessionQuery = "SELECT session_key, COUNT(*) as count, MIN(created_at) as earliest, MAX(created_at) as latest FROM chunks WHERE (owner = ? OR (owner = 'public' AND session_key LIKE ?)) GROUP BY session_key ORDER BY latest DESC";
|
|
733
|
+
sessionParams = [ownerFilter, agentPrefix + "%"];
|
|
734
|
+
}
|
|
735
|
+
else if (ownerFilter) {
|
|
736
|
+
sessionQuery = "SELECT session_key, COUNT(*) as count, MIN(created_at) as earliest, MAX(created_at) as latest FROM chunks WHERE owner = ? GROUP BY session_key ORDER BY latest DESC";
|
|
737
|
+
sessionParams = [ownerFilter];
|
|
738
|
+
}
|
|
739
|
+
else {
|
|
740
|
+
sessionQuery = "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";
|
|
741
|
+
sessionParams = [];
|
|
742
|
+
}
|
|
743
|
+
const sessionList = db.prepare(sessionQuery).all(...sessionParams);
|
|
707
744
|
let skillCount = 0;
|
|
708
745
|
try {
|
|
709
746
|
skillCount = db.prepare("SELECT COUNT(*) as count FROM skills").get().count;
|
|
@@ -717,7 +754,7 @@ class ViewerServer {
|
|
|
717
754
|
catch { /* column may not exist yet */ }
|
|
718
755
|
let owners = [];
|
|
719
756
|
try {
|
|
720
|
-
const ownerRows = db.prepare("SELECT DISTINCT owner FROM chunks WHERE owner IS NOT NULL ORDER BY owner").all();
|
|
757
|
+
const ownerRows = db.prepare("SELECT DISTINCT owner FROM chunks WHERE owner IS NOT NULL AND owner LIKE 'agent:%' ORDER BY owner").all();
|
|
721
758
|
owners = ownerRows.map((o) => o.owner);
|
|
722
759
|
}
|
|
723
760
|
catch { /* column may not exist yet */ }
|
|
@@ -1597,7 +1634,8 @@ class ViewerServer {
|
|
|
1597
1634
|
// ─── Config API ───
|
|
1598
1635
|
getOpenClawConfigPath() {
|
|
1599
1636
|
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
1600
|
-
|
|
1637
|
+
const ocHome = process.env.OPENCLAW_STATE_DIR || node_path_1.default.join(home, ".openclaw");
|
|
1638
|
+
return node_path_1.default.join(ocHome, "openclaw.json");
|
|
1601
1639
|
}
|
|
1602
1640
|
getPluginEntryConfig(raw) {
|
|
1603
1641
|
const entries = raw?.plugins?.entries ?? {};
|
|
@@ -1847,7 +1885,8 @@ class ViewerServer {
|
|
|
1847
1885
|
try {
|
|
1848
1886
|
const hubUrl = (0, hub_1.normalizeHubUrl)(hubAddress);
|
|
1849
1887
|
const os = await Promise.resolve().then(() => __importStar(require("os")));
|
|
1850
|
-
const
|
|
1888
|
+
const nickname = sharing.client?.nickname;
|
|
1889
|
+
const username = nickname || os.userInfo().username || "user";
|
|
1851
1890
|
const hostname = os.hostname() || "unknown";
|
|
1852
1891
|
const result = await (0, hub_1.hubRequestJson)(hubUrl, "", "/api/v1/hub/join", {
|
|
1853
1892
|
method: "POST",
|
|
@@ -1873,7 +1912,14 @@ class ViewerServer {
|
|
|
1873
1912
|
return this.jsonResponse(res, { memories: [], error: "sharing_unavailable" });
|
|
1874
1913
|
try {
|
|
1875
1914
|
const limit = Number(url.searchParams.get("limit") || 40);
|
|
1876
|
-
const
|
|
1915
|
+
const hub = this.resolveHubConnection();
|
|
1916
|
+
let data;
|
|
1917
|
+
if (hub) {
|
|
1918
|
+
data = await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, `/api/v1/hub/memories?limit=${limit}`);
|
|
1919
|
+
}
|
|
1920
|
+
else {
|
|
1921
|
+
data = await (0, hub_1.hubListMemories)(this.store, this.ctx, { limit });
|
|
1922
|
+
}
|
|
1877
1923
|
this.jsonResponse(res, { memories: Array.isArray(data?.memories) ? data.memories : [] });
|
|
1878
1924
|
}
|
|
1879
1925
|
catch (err) {
|
|
@@ -1885,7 +1931,14 @@ class ViewerServer {
|
|
|
1885
1931
|
return this.jsonResponse(res, { tasks: [], error: "sharing_unavailable" });
|
|
1886
1932
|
try {
|
|
1887
1933
|
const limit = Number(url.searchParams.get("limit") || 40);
|
|
1888
|
-
const
|
|
1934
|
+
const hub = this.resolveHubConnection();
|
|
1935
|
+
let data;
|
|
1936
|
+
if (hub) {
|
|
1937
|
+
data = await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, `/api/v1/hub/tasks?limit=${limit}`);
|
|
1938
|
+
}
|
|
1939
|
+
else {
|
|
1940
|
+
data = await (0, hub_1.hubListTasks)(this.store, this.ctx, { limit });
|
|
1941
|
+
}
|
|
1889
1942
|
this.jsonResponse(res, { tasks: Array.isArray(data?.tasks) ? data.tasks : [] });
|
|
1890
1943
|
}
|
|
1891
1944
|
catch (err) {
|
|
@@ -1897,7 +1950,14 @@ class ViewerServer {
|
|
|
1897
1950
|
return this.jsonResponse(res, { skills: [], error: "sharing_unavailable" });
|
|
1898
1951
|
try {
|
|
1899
1952
|
const limit = Number(url.searchParams.get("limit") || 40);
|
|
1900
|
-
const
|
|
1953
|
+
const hub = this.resolveHubConnection();
|
|
1954
|
+
let data;
|
|
1955
|
+
if (hub) {
|
|
1956
|
+
data = await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, `/api/v1/hub/skills/list?limit=${limit}`);
|
|
1957
|
+
}
|
|
1958
|
+
else {
|
|
1959
|
+
data = await (0, hub_1.hubListSkills)(this.store, this.ctx, { limit });
|
|
1960
|
+
}
|
|
1901
1961
|
this.jsonResponse(res, { skills: Array.isArray(data?.skills) ? data.skills : [] });
|
|
1902
1962
|
}
|
|
1903
1963
|
catch (err) {
|
|
@@ -1914,13 +1974,22 @@ class ViewerServer {
|
|
|
1914
1974
|
const query = String(parsed.query || "");
|
|
1915
1975
|
const role = typeof parsed.role === "string" ? parsed.role : undefined;
|
|
1916
1976
|
const maxResults = typeof parsed.maxResults === "number" ? parsed.maxResults : 10;
|
|
1917
|
-
const scope = parsed.scope === "group" || parsed.scope === "all" ? parsed.scope : "local";
|
|
1977
|
+
const scope = parsed.scope === "group" || parsed.scope === "all" || parsed.scope === "hub" ? (parsed.scope === "hub" ? "all" : parsed.scope) : "local";
|
|
1918
1978
|
const local = this.searchLocalViewerMemories(query, { role, maxResults });
|
|
1919
1979
|
if (scope === "local") {
|
|
1920
1980
|
return this.jsonResponse(res, { local: { hits: local.hits, meta: local.meta }, hub: emptyHub });
|
|
1921
1981
|
}
|
|
1922
1982
|
try {
|
|
1923
|
-
const
|
|
1983
|
+
const conn = this.resolveHubConnection();
|
|
1984
|
+
let hub;
|
|
1985
|
+
if (conn) {
|
|
1986
|
+
hub = await (0, hub_1.hubRequestJson)(conn.hubUrl, conn.userToken, "/api/v1/hub/search", {
|
|
1987
|
+
method: "POST", body: JSON.stringify({ query, maxResults, scope }),
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
else {
|
|
1991
|
+
hub = await (0, hub_1.hubSearchMemories)(this.store, this.ctx, { query, maxResults, scope });
|
|
1992
|
+
}
|
|
1924
1993
|
this.jsonResponse(res, { local: { hits: local.hits, meta: local.meta }, hub });
|
|
1925
1994
|
}
|
|
1926
1995
|
catch (err) {
|
|
@@ -2356,6 +2425,38 @@ class ViewerServer {
|
|
|
2356
2425
|
this.jsonResponse(res, { ok: false, error: String(err) });
|
|
2357
2426
|
}
|
|
2358
2427
|
}
|
|
2428
|
+
async serveHubTaskDetail(res, p) {
|
|
2429
|
+
const hub = this.resolveHubConnection();
|
|
2430
|
+
if (!hub)
|
|
2431
|
+
return this.jsonResponse(res, { error: "not_configured" }, 500);
|
|
2432
|
+
const m = p.match(/^\/api\/admin\/shared-tasks\/([^/]+)\/detail$/);
|
|
2433
|
+
if (!m)
|
|
2434
|
+
return this.jsonResponse(res, { error: "bad_request" }, 400);
|
|
2435
|
+
const taskId = decodeURIComponent(m[1]);
|
|
2436
|
+
try {
|
|
2437
|
+
const data = await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, `/api/v1/hub/shared-tasks/${encodeURIComponent(taskId)}/detail`, { method: "GET" });
|
|
2438
|
+
this.jsonResponse(res, data);
|
|
2439
|
+
}
|
|
2440
|
+
catch (err) {
|
|
2441
|
+
this.jsonResponse(res, { error: String(err) }, 500);
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
async serveHubSkillDetail(res, p) {
|
|
2445
|
+
const hub = this.resolveHubConnection();
|
|
2446
|
+
if (!hub)
|
|
2447
|
+
return this.jsonResponse(res, { error: "not_configured" }, 500);
|
|
2448
|
+
const m = p.match(/^\/api\/admin\/shared-skills\/([^/]+)\/detail$/);
|
|
2449
|
+
if (!m)
|
|
2450
|
+
return this.jsonResponse(res, { error: "bad_request" }, 400);
|
|
2451
|
+
const skillId = decodeURIComponent(m[1]);
|
|
2452
|
+
try {
|
|
2453
|
+
const data = await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, `/api/v1/hub/shared-skills/${encodeURIComponent(skillId)}/detail`, { method: "GET" });
|
|
2454
|
+
this.jsonResponse(res, data);
|
|
2455
|
+
}
|
|
2456
|
+
catch (err) {
|
|
2457
|
+
this.jsonResponse(res, { error: String(err) }, 500);
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2359
2460
|
async serveAdminSharedSkills(res) {
|
|
2360
2461
|
const hub = this.resolveHubConnection();
|
|
2361
2462
|
if (!hub)
|
|
@@ -2449,6 +2550,13 @@ class ViewerServer {
|
|
|
2449
2550
|
const body = JSON.parse(raw || "{}");
|
|
2450
2551
|
await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, "/api/v1/hub/notifications/read", { method: "POST", body: JSON.stringify(body) });
|
|
2451
2552
|
this.jsonResponse(res, { ok: true });
|
|
2553
|
+
try {
|
|
2554
|
+
const data = (await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, "/api/v1/hub/notifications?unread=1"));
|
|
2555
|
+
const count = data?.unreadCount ?? 0;
|
|
2556
|
+
this.lastKnownNotifCount = count;
|
|
2557
|
+
this.broadcastNotifSSE({ type: "update", unreadCount: count });
|
|
2558
|
+
}
|
|
2559
|
+
catch { /* best effort */ }
|
|
2452
2560
|
}
|
|
2453
2561
|
catch (err) {
|
|
2454
2562
|
this.jsonResponse(res, { ok: false, error: String(err) });
|
|
@@ -2463,12 +2571,92 @@ class ViewerServer {
|
|
|
2463
2571
|
try {
|
|
2464
2572
|
await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, "/api/v1/hub/notifications/clear", { method: "POST", body: "{}" });
|
|
2465
2573
|
this.jsonResponse(res, { ok: true });
|
|
2574
|
+
this.broadcastNotifSSE({ type: "cleared", unreadCount: 0 });
|
|
2466
2575
|
}
|
|
2467
2576
|
catch (err) {
|
|
2468
2577
|
this.jsonResponse(res, { ok: false, error: String(err) });
|
|
2469
2578
|
}
|
|
2470
2579
|
});
|
|
2471
2580
|
}
|
|
2581
|
+
handleNotifSSE(req, res) {
|
|
2582
|
+
res.writeHead(200, {
|
|
2583
|
+
"Content-Type": "text/event-stream",
|
|
2584
|
+
"Cache-Control": "no-cache",
|
|
2585
|
+
Connection: "keep-alive",
|
|
2586
|
+
"Access-Control-Allow-Origin": "*",
|
|
2587
|
+
});
|
|
2588
|
+
res.write("data: {\"type\":\"connected\"}\n\n");
|
|
2589
|
+
this.notifSSEClients.push(res);
|
|
2590
|
+
if (!this.notifPollTimer)
|
|
2591
|
+
this.startNotifPoll();
|
|
2592
|
+
req.on("close", () => {
|
|
2593
|
+
this.notifSSEClients = this.notifSSEClients.filter((c) => c !== res);
|
|
2594
|
+
if (this.notifSSEClients.length === 0)
|
|
2595
|
+
this.stopNotifPoll();
|
|
2596
|
+
});
|
|
2597
|
+
}
|
|
2598
|
+
broadcastNotifSSE(data) {
|
|
2599
|
+
const msg = `data: ${JSON.stringify(data)}\n\n`;
|
|
2600
|
+
this.notifSSEClients = this.notifSSEClients.filter((c) => {
|
|
2601
|
+
try {
|
|
2602
|
+
c.write(msg);
|
|
2603
|
+
return true;
|
|
2604
|
+
}
|
|
2605
|
+
catch {
|
|
2606
|
+
return false;
|
|
2607
|
+
}
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
startNotifPoll() {
|
|
2611
|
+
this.stopNotifPoll();
|
|
2612
|
+
const tick = async () => {
|
|
2613
|
+
const hub = this.resolveHubConnection();
|
|
2614
|
+
if (!hub)
|
|
2615
|
+
return;
|
|
2616
|
+
try {
|
|
2617
|
+
const data = (await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, "/api/v1/hub/notifications?unread=1"));
|
|
2618
|
+
const count = data?.unreadCount ?? 0;
|
|
2619
|
+
if (count !== this.lastKnownNotifCount) {
|
|
2620
|
+
this.lastKnownNotifCount = count;
|
|
2621
|
+
this.broadcastNotifSSE({ type: "update", unreadCount: count });
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
catch { /* ignore */ }
|
|
2625
|
+
};
|
|
2626
|
+
tick();
|
|
2627
|
+
this.notifPollTimer = setInterval(tick, 3000);
|
|
2628
|
+
}
|
|
2629
|
+
stopNotifPoll() {
|
|
2630
|
+
if (this.notifPollTimer) {
|
|
2631
|
+
clearInterval(this.notifPollTimer);
|
|
2632
|
+
this.notifPollTimer = undefined;
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
startHubHeartbeat() {
|
|
2636
|
+
this.stopHubHeartbeat();
|
|
2637
|
+
const sendHeartbeat = async () => {
|
|
2638
|
+
try {
|
|
2639
|
+
const hub = this.resolveHubConnection();
|
|
2640
|
+
if (!hub) {
|
|
2641
|
+
const persisted = this.store.getClientHubConnection();
|
|
2642
|
+
if (persisted?.hubUrl && persisted?.userToken) {
|
|
2643
|
+
await (0, hub_1.hubRequestJson)(persisted.hubUrl, persisted.userToken, "/api/v1/hub/heartbeat", { method: "POST" });
|
|
2644
|
+
}
|
|
2645
|
+
return;
|
|
2646
|
+
}
|
|
2647
|
+
await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, "/api/v1/hub/heartbeat", { method: "POST" });
|
|
2648
|
+
}
|
|
2649
|
+
catch { /* best-effort */ }
|
|
2650
|
+
};
|
|
2651
|
+
sendHeartbeat();
|
|
2652
|
+
this.hubHeartbeatTimer = setInterval(sendHeartbeat, ViewerServer.HUB_HEARTBEAT_INTERVAL_MS);
|
|
2653
|
+
}
|
|
2654
|
+
stopHubHeartbeat() {
|
|
2655
|
+
if (this.hubHeartbeatTimer) {
|
|
2656
|
+
clearInterval(this.hubHeartbeatTimer);
|
|
2657
|
+
this.hubHeartbeatTimer = undefined;
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2472
2660
|
getLocalIPs() {
|
|
2473
2661
|
const nets = node_os_1.default.networkInterfaces();
|
|
2474
2662
|
const ips = [];
|
|
@@ -2520,7 +2708,7 @@ class ViewerServer {
|
|
|
2520
2708
|
}
|
|
2521
2709
|
}
|
|
2522
2710
|
handleSaveConfig(req, res) {
|
|
2523
|
-
this.readBody(req, (body) => {
|
|
2711
|
+
this.readBody(req, async (body) => {
|
|
2524
2712
|
try {
|
|
2525
2713
|
const newCfg = JSON.parse(body);
|
|
2526
2714
|
const cfgPath = this.getOpenClawConfigPath();
|
|
@@ -2545,6 +2733,7 @@ class ViewerServer {
|
|
|
2545
2733
|
if (!entry.config)
|
|
2546
2734
|
entry.config = {};
|
|
2547
2735
|
const config = entry.config;
|
|
2736
|
+
const oldSharingRole = config.sharing?.role;
|
|
2548
2737
|
if (newCfg.embedding)
|
|
2549
2738
|
config.embedding = newCfg.embedding;
|
|
2550
2739
|
if (newCfg.summarizer)
|
|
@@ -2578,6 +2767,11 @@ class ViewerServer {
|
|
|
2578
2767
|
catch { }
|
|
2579
2768
|
}
|
|
2580
2769
|
}
|
|
2770
|
+
// When switching away from client mode, notify Hub that we're leaving
|
|
2771
|
+
const newRole = merged.role;
|
|
2772
|
+
if (oldSharingRole === "client" && newRole !== "client") {
|
|
2773
|
+
this.notifyHubLeave();
|
|
2774
|
+
}
|
|
2581
2775
|
if (merged.role === "hub") {
|
|
2582
2776
|
merged.client = { hubAddress: "", userToken: "", teamToken: "" };
|
|
2583
2777
|
}
|
|
@@ -2589,6 +2783,7 @@ class ViewerServer {
|
|
|
2589
2783
|
node_fs_1.default.mkdirSync(node_path_1.default.dirname(cfgPath), { recursive: true });
|
|
2590
2784
|
node_fs_1.default.writeFileSync(cfgPath, JSON.stringify(raw, null, 2), "utf-8");
|
|
2591
2785
|
this.log.info("Plugin config updated via Viewer");
|
|
2786
|
+
this.stopHubHeartbeat();
|
|
2592
2787
|
this.jsonResponse(res, { ok: true });
|
|
2593
2788
|
}
|
|
2594
2789
|
catch (e) {
|
|
@@ -2598,6 +2793,24 @@ class ViewerServer {
|
|
|
2598
2793
|
}
|
|
2599
2794
|
});
|
|
2600
2795
|
}
|
|
2796
|
+
async notifyHubLeave() {
|
|
2797
|
+
try {
|
|
2798
|
+
const hub = this.resolveHubConnection();
|
|
2799
|
+
if (hub) {
|
|
2800
|
+
await (0, hub_1.hubRequestJson)(hub.hubUrl, hub.userToken, "/api/v1/hub/leave", { method: "POST" });
|
|
2801
|
+
this.log.info("Notified Hub of voluntary leave");
|
|
2802
|
+
return;
|
|
2803
|
+
}
|
|
2804
|
+
const persisted = this.store.getClientHubConnection();
|
|
2805
|
+
if (persisted?.hubUrl && persisted?.userToken) {
|
|
2806
|
+
await (0, hub_1.hubRequestJson)(persisted.hubUrl, persisted.userToken, "/api/v1/hub/leave", { method: "POST" });
|
|
2807
|
+
this.log.info("Notified Hub of voluntary leave (persisted connection)");
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
catch (e) {
|
|
2811
|
+
this.log.warn(`Failed to notify Hub of leave: ${e}`);
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2601
2814
|
handleUpdateUsername(req, res) {
|
|
2602
2815
|
this.readBody(req, async (body) => {
|
|
2603
2816
|
if (!this.ctx)
|
|
@@ -3072,7 +3285,7 @@ class ViewerServer {
|
|
|
3072
3285
|
// ─── Migration: scan OpenClaw built-in memory ───
|
|
3073
3286
|
getOpenClawHome() {
|
|
3074
3287
|
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
3075
|
-
return node_path_1.default.join(home, ".openclaw");
|
|
3288
|
+
return process.env.OPENCLAW_STATE_DIR || node_path_1.default.join(home, ".openclaw");
|
|
3076
3289
|
}
|
|
3077
3290
|
handleCleanupPolluted(res) {
|
|
3078
3291
|
try {
|