@memtensor/memos-local-openclaw-plugin 1.0.2 → 1.0.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -21
- package/dist/client/connector.d.ts +26 -0
- package/dist/client/connector.d.ts.map +1 -0
- package/dist/client/connector.js +127 -0
- package/dist/client/connector.js.map +1 -0
- package/dist/client/hub.d.ts +61 -0
- package/dist/client/hub.d.ts.map +1 -0
- package/dist/client/hub.js +148 -0
- package/dist/client/hub.js.map +1 -0
- package/dist/client/skill-sync.d.ts +29 -0
- package/dist/client/skill-sync.d.ts.map +1 -0
- package/dist/client/skill-sync.js +216 -0
- package/dist/client/skill-sync.js.map +1 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +70 -3
- package/dist/config.js.map +1 -1
- package/dist/embedding/index.d.ts +4 -2
- package/dist/embedding/index.d.ts.map +1 -1
- package/dist/embedding/index.js +21 -4
- package/dist/embedding/index.js.map +1 -1
- package/dist/hub/auth.d.ts +19 -0
- package/dist/hub/auth.d.ts.map +1 -0
- package/dist/hub/auth.js +70 -0
- package/dist/hub/auth.js.map +1 -0
- package/dist/hub/server.d.ts +41 -0
- package/dist/hub/server.d.ts.map +1 -0
- package/dist/hub/server.js +742 -0
- package/dist/hub/server.js.map +1 -0
- package/dist/hub/user-manager.d.ts +28 -0
- package/dist/hub/user-manager.d.ts.map +1 -0
- package/dist/hub/user-manager.js +112 -0
- package/dist/hub/user-manager.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/ingest/providers/index.d.ts +10 -2
- package/dist/ingest/providers/index.d.ts.map +1 -1
- package/dist/ingest/providers/index.js +242 -8
- package/dist/ingest/providers/index.js.map +1 -1
- package/dist/ingest/providers/openai.d.ts +1 -0
- package/dist/ingest/providers/openai.d.ts.map +1 -1
- package/dist/ingest/providers/openai.js +1 -0
- package/dist/ingest/providers/openai.js.map +1 -1
- package/dist/ingest/task-processor.js +1 -1
- package/dist/ingest/task-processor.js.map +1 -1
- package/dist/openclaw-api.d.ts +53 -0
- package/dist/openclaw-api.d.ts.map +1 -0
- package/dist/openclaw-api.js +189 -0
- package/dist/openclaw-api.js.map +1 -0
- package/dist/recall/engine.js +2 -2
- package/dist/recall/engine.js.map +1 -1
- package/dist/shared/llm-call.d.ts +4 -1
- package/dist/shared/llm-call.d.ts.map +1 -1
- package/dist/shared/llm-call.js +15 -0
- package/dist/shared/llm-call.js.map +1 -1
- package/dist/sharing/types.contract.d.ts +2 -0
- package/dist/sharing/types.contract.d.ts.map +1 -0
- package/dist/sharing/types.contract.js +3 -0
- package/dist/sharing/types.contract.js.map +1 -0
- package/dist/sharing/types.d.ts +80 -0
- package/dist/sharing/types.d.ts.map +1 -0
- package/dist/sharing/types.js +3 -0
- package/dist/sharing/types.js.map +1 -0
- package/dist/skill/evaluator.d.ts.map +1 -1
- package/dist/skill/evaluator.js +2 -2
- package/dist/skill/evaluator.js.map +1 -1
- package/dist/skill/generator.d.ts.map +1 -1
- package/dist/skill/generator.js +4 -4
- package/dist/skill/generator.js.map +1 -1
- package/dist/skill/upgrader.js +1 -1
- package/dist/skill/upgrader.js.map +1 -1
- package/dist/skill/validator.js +1 -1
- package/dist/skill/validator.js.map +1 -1
- package/dist/storage/sqlite.d.ts +294 -0
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +902 -8
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/memory-search.d.ts +3 -2
- package/dist/tools/memory-search.d.ts.map +1 -1
- package/dist/tools/memory-search.js +48 -7
- package/dist/tools/memory-search.js.map +1 -1
- package/dist/tools/network-memory-detail.d.ts +4 -0
- package/dist/tools/network-memory-detail.d.ts.map +1 -0
- package/dist/tools/network-memory-detail.js +34 -0
- package/dist/tools/network-memory-detail.js.map +1 -0
- package/dist/types.d.ts +47 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/update-check.d.ts.map +1 -1
- package/dist/update-check.js +0 -1
- package/dist/update-check.js.map +1 -1
- package/dist/viewer/html.d.ts.map +1 -1
- package/dist/viewer/html.js +2396 -289
- package/dist/viewer/html.js.map +1 -1
- package/dist/viewer/server.d.ts +43 -0
- package/dist/viewer/server.d.ts.map +1 -1
- package/dist/viewer/server.js +1180 -33
- package/dist/viewer/server.js.map +1 -1
- package/index.ts +445 -25
- package/openclaw.plugin.json +2 -1
- package/package.json +2 -1
- package/scripts/postinstall.cjs +282 -45
- package/skill/memos-memory-guide/SKILL.md +26 -2
- package/src/client/connector.ts +124 -0
- package/src/client/hub.ts +189 -0
- package/src/client/skill-sync.ts +202 -0
- package/src/config.ts +92 -3
- package/src/embedding/index.ts +25 -3
- package/src/hub/auth.ts +78 -0
- package/src/hub/server.ts +734 -0
- package/src/hub/user-manager.ts +126 -0
- package/src/index.ts +7 -4
- package/src/ingest/providers/index.ts +279 -8
- package/src/ingest/providers/openai.ts +1 -1
- package/src/ingest/task-processor.ts +1 -1
- package/src/openclaw-api.ts +287 -0
- package/src/recall/engine.ts +2 -2
- package/src/shared/llm-call.ts +19 -1
- package/src/sharing/types.contract.ts +40 -0
- package/src/sharing/types.ts +102 -0
- package/src/skill/evaluator.ts +3 -2
- package/src/skill/generator.ts +6 -4
- package/src/skill/upgrader.ts +1 -1
- package/src/skill/validator.ts +1 -1
- package/src/storage/sqlite.ts +1167 -7
- package/src/tools/index.ts +1 -0
- package/src/tools/memory-search.ts +57 -8
- package/src/tools/network-memory-detail.ts +34 -0
- package/src/types.ts +48 -2
- package/src/update-check.ts +0 -1
- package/src/viewer/html.ts +2396 -289
- package/src/viewer/server.ts +1087 -34
package/src/tools/index.ts
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
|
+
import { hubSearchMemories } from "../client/hub";
|
|
2
|
+
import type { HubScope, HubSearchResult } from "../sharing/types";
|
|
1
3
|
import type { RecallEngine } from "../recall/engine";
|
|
2
|
-
import type { ToolDefinition } from "../types";
|
|
4
|
+
import type { PluginContext, ToolDefinition } from "../types";
|
|
5
|
+
import type { SqliteStore } from "../storage/sqlite";
|
|
3
6
|
|
|
4
7
|
function resolveOwnerFilter(owner: unknown): string[] {
|
|
5
8
|
const resolvedOwner = typeof owner === "string" && owner.trim().length > 0 ? owner : "agent:main";
|
|
6
9
|
return resolvedOwner === "public" ? ["public"] : [resolvedOwner, "public"];
|
|
7
10
|
}
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
function resolveScope(scope: unknown): HubScope {
|
|
13
|
+
return scope === "group" || scope === "all" ? scope : "local";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function emptyHubResult(scope: HubScope): HubSearchResult {
|
|
17
|
+
return {
|
|
18
|
+
hits: [],
|
|
19
|
+
meta: {
|
|
20
|
+
totalCandidates: 0,
|
|
21
|
+
searchedGroups: [],
|
|
22
|
+
includedPublic: scope === "all",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createMemorySearchTool(engine: RecallEngine, store?: SqliteStore, ctx?: PluginContext): ToolDefinition {
|
|
10
28
|
return {
|
|
11
29
|
name: "memory_search",
|
|
12
30
|
description:
|
|
@@ -27,16 +45,47 @@ export function createMemorySearchTool(engine: RecallEngine): ToolDefinition {
|
|
|
27
45
|
type: "number",
|
|
28
46
|
description: "Minimum relevance score threshold 0-1 (default 0.45, floor 0.35).",
|
|
29
47
|
},
|
|
48
|
+
scope: {
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "Search scope: local (default), group, or all. Group/all return split local and hub sections.",
|
|
51
|
+
},
|
|
52
|
+
hubAddress: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "Optional hub address override for group/all search, integration tests, or manual routing.",
|
|
55
|
+
},
|
|
56
|
+
userToken: {
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "Optional hub bearer token override for group/all search or integration tests.",
|
|
59
|
+
},
|
|
30
60
|
},
|
|
31
61
|
},
|
|
32
62
|
handler: async (input) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
63
|
+
const query = (input.query as string) ?? "";
|
|
64
|
+
const maxResults = input.maxResults as number | undefined;
|
|
65
|
+
const minScore = input.minScore as number | undefined;
|
|
66
|
+
const ownerFilter = resolveOwnerFilter(input.owner);
|
|
67
|
+
const scope = resolveScope(input.scope);
|
|
68
|
+
|
|
69
|
+
const localSearch = engine.search({
|
|
70
|
+
query,
|
|
71
|
+
maxResults,
|
|
72
|
+
minScore,
|
|
73
|
+
ownerFilter,
|
|
38
74
|
});
|
|
39
|
-
|
|
75
|
+
|
|
76
|
+
if (scope === "local" || !store || !ctx) {
|
|
77
|
+
return localSearch;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const [local, hub] = await Promise.all([
|
|
81
|
+
localSearch,
|
|
82
|
+
hubSearchMemories(store, ctx, { query, maxResults, scope, hubAddress: input.hubAddress as string | undefined, userToken: input.userToken as string | undefined }).catch((err) => {
|
|
83
|
+
ctx.log.warn(`Hub search failed, using local-only results: ${err}`);
|
|
84
|
+
return emptyHubResult(scope);
|
|
85
|
+
}),
|
|
86
|
+
]);
|
|
87
|
+
|
|
88
|
+
return { local, hub };
|
|
40
89
|
},
|
|
41
90
|
};
|
|
42
91
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { hubGetMemoryDetail } from "../client/hub";
|
|
2
|
+
import type { PluginContext, ToolDefinition } from "../types";
|
|
3
|
+
import type { SqliteStore } from "../storage/sqlite";
|
|
4
|
+
|
|
5
|
+
export function createNetworkMemoryDetailTool(store: SqliteStore, ctx: PluginContext): ToolDefinition {
|
|
6
|
+
return {
|
|
7
|
+
name: "network_memory_detail",
|
|
8
|
+
description:
|
|
9
|
+
"Fetch the full detail for one Hub search hit using its remoteHitId. Use this after memory_search(scope=group|all) when you need the full shared content.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
remoteHitId: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "The remoteHitId returned by memory_search hub results.",
|
|
16
|
+
},
|
|
17
|
+
hubAddress: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Optional hub address override for integration tests or manual routing.",
|
|
20
|
+
},
|
|
21
|
+
userToken: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "Optional hub bearer token override for integration tests.",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
required: ["remoteHitId"],
|
|
27
|
+
},
|
|
28
|
+
handler: async (input) => hubGetMemoryDetail(store, ctx, {
|
|
29
|
+
remoteHitId: String(input.remoteHitId ?? ""),
|
|
30
|
+
hubAddress: input.hubAddress as string | undefined,
|
|
31
|
+
userToken: input.userToken as string | undefined,
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -144,7 +144,14 @@ export type SummaryProvider =
|
|
|
144
144
|
| "anthropic"
|
|
145
145
|
| "gemini"
|
|
146
146
|
| "azure_openai"
|
|
147
|
-
| "bedrock"
|
|
147
|
+
| "bedrock"
|
|
148
|
+
| "zhipu"
|
|
149
|
+
| "siliconflow"
|
|
150
|
+
| "bailian"
|
|
151
|
+
| "cohere"
|
|
152
|
+
| "mistral"
|
|
153
|
+
| "voyage"
|
|
154
|
+
| "openclaw";
|
|
148
155
|
|
|
149
156
|
export type EmbeddingProvider =
|
|
150
157
|
| "openai"
|
|
@@ -154,7 +161,8 @@ export type EmbeddingProvider =
|
|
|
154
161
|
| "cohere"
|
|
155
162
|
| "mistral"
|
|
156
163
|
| "voyage"
|
|
157
|
-
| "local"
|
|
164
|
+
| "local"
|
|
165
|
+
| "openclaw";
|
|
158
166
|
|
|
159
167
|
export interface ProviderConfig {
|
|
160
168
|
provider: string;
|
|
@@ -164,6 +172,7 @@ export interface ProviderConfig {
|
|
|
164
172
|
headers?: Record<string, string>;
|
|
165
173
|
timeoutMs?: number;
|
|
166
174
|
temperature?: number;
|
|
175
|
+
capabilities?: SharingCapabilities;
|
|
167
176
|
}
|
|
168
177
|
|
|
169
178
|
export interface SummarizerConfig extends ProviderConfig {
|
|
@@ -240,6 +249,7 @@ export interface SkillEvolutionConfig {
|
|
|
240
249
|
minConfidence?: number;
|
|
241
250
|
maxSkillLines?: number;
|
|
242
251
|
autoInstall?: boolean;
|
|
252
|
+
/** Optional independent LLM config for skill evaluation/validation. Falls back to main summarizer if not set. */
|
|
243
253
|
summarizer?: SummarizerConfig;
|
|
244
254
|
}
|
|
245
255
|
|
|
@@ -249,6 +259,35 @@ export interface TelemetryConfig {
|
|
|
249
259
|
posthogHost?: string;
|
|
250
260
|
}
|
|
251
261
|
|
|
262
|
+
export type SharingRole = "hub" | "client";
|
|
263
|
+
|
|
264
|
+
export interface SharingCapabilities {
|
|
265
|
+
hostEmbedding?: boolean;
|
|
266
|
+
hostCompletion?: boolean;
|
|
267
|
+
hostSkill?: boolean;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface HubModeConfig {
|
|
271
|
+
port?: number;
|
|
272
|
+
teamName?: string;
|
|
273
|
+
teamToken?: string;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface ClientModeConfig {
|
|
277
|
+
hubAddress?: string;
|
|
278
|
+
userToken?: string;
|
|
279
|
+
teamToken?: string;
|
|
280
|
+
pendingUserId?: string;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface SharingConfig {
|
|
284
|
+
enabled?: boolean;
|
|
285
|
+
role?: SharingRole;
|
|
286
|
+
hub?: HubModeConfig;
|
|
287
|
+
client?: ClientModeConfig;
|
|
288
|
+
capabilities?: SharingCapabilities;
|
|
289
|
+
}
|
|
290
|
+
|
|
252
291
|
export interface MemosLocalConfig {
|
|
253
292
|
summarizer?: SummarizerConfig;
|
|
254
293
|
embedding?: EmbeddingConfig;
|
|
@@ -274,6 +313,7 @@ export interface MemosLocalConfig {
|
|
|
274
313
|
};
|
|
275
314
|
skillEvolution?: SkillEvolutionConfig;
|
|
276
315
|
telemetry?: TelemetryConfig;
|
|
316
|
+
sharing?: SharingConfig;
|
|
277
317
|
}
|
|
278
318
|
|
|
279
319
|
// ─── Defaults ───
|
|
@@ -314,6 +354,12 @@ export interface PluginContext {
|
|
|
314
354
|
workspaceDir: string;
|
|
315
355
|
config: MemosLocalConfig;
|
|
316
356
|
log: Logger;
|
|
357
|
+
openclawAPI?: OpenClawAPI;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface OpenClawAPI {
|
|
361
|
+
embed(request: { texts: string[]; model?: string }): Promise<{ embeddings: number[][]; dimensions: number }>;
|
|
362
|
+
complete(request: { prompt: string; maxTokens?: number; temperature?: number; model?: string }): Promise<{ text: string }>;
|
|
317
363
|
}
|
|
318
364
|
|
|
319
365
|
export interface Logger {
|
package/src/update-check.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* - Stable users compare against latest tag only (semver gt).
|
|
5
5
|
* - Beta users get optional stableChannel hint to install @latest when stable exists.
|
|
6
6
|
*/
|
|
7
|
-
// @ts-ignore — semver has no bundled types
|
|
8
7
|
import * as semver from "semver";
|
|
9
8
|
|
|
10
9
|
export interface UpdateCheckResult {
|