@memtensor/memos-local-openclaw-plugin 1.0.4-beta.6 → 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.
Files changed (143) hide show
  1. package/README.md +38 -21
  2. package/dist/capture/index.d.ts +1 -1
  3. package/dist/capture/index.d.ts.map +1 -1
  4. package/dist/capture/index.js +29 -3
  5. package/dist/capture/index.js.map +1 -1
  6. package/dist/client/connector.d.ts +29 -0
  7. package/dist/client/connector.d.ts.map +1 -0
  8. package/dist/client/connector.js +231 -0
  9. package/dist/client/connector.js.map +1 -0
  10. package/dist/client/hub.d.ts +61 -0
  11. package/dist/client/hub.d.ts.map +1 -0
  12. package/dist/client/hub.js +170 -0
  13. package/dist/client/hub.js.map +1 -0
  14. package/dist/client/skill-sync.d.ts +36 -0
  15. package/dist/client/skill-sync.d.ts.map +1 -0
  16. package/dist/client/skill-sync.js +226 -0
  17. package/dist/client/skill-sync.js.map +1 -0
  18. package/dist/config.d.ts +2 -1
  19. package/dist/config.d.ts.map +1 -1
  20. package/dist/config.js +70 -3
  21. package/dist/config.js.map +1 -1
  22. package/dist/embedding/index.d.ts +4 -2
  23. package/dist/embedding/index.d.ts.map +1 -1
  24. package/dist/embedding/index.js +17 -1
  25. package/dist/embedding/index.js.map +1 -1
  26. package/dist/hub/auth.d.ts +19 -0
  27. package/dist/hub/auth.d.ts.map +1 -0
  28. package/dist/hub/auth.js +70 -0
  29. package/dist/hub/auth.js.map +1 -0
  30. package/dist/hub/server.d.ts +48 -0
  31. package/dist/hub/server.d.ts.map +1 -0
  32. package/dist/hub/server.js +922 -0
  33. package/dist/hub/server.js.map +1 -0
  34. package/dist/hub/user-manager.d.ts +31 -0
  35. package/dist/hub/user-manager.d.ts.map +1 -0
  36. package/dist/hub/user-manager.js +129 -0
  37. package/dist/hub/user-manager.js.map +1 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +8 -4
  41. package/dist/index.js.map +1 -1
  42. package/dist/ingest/providers/index.d.ts +10 -2
  43. package/dist/ingest/providers/index.d.ts.map +1 -1
  44. package/dist/ingest/providers/index.js +203 -6
  45. package/dist/ingest/providers/index.js.map +1 -1
  46. package/dist/ingest/providers/openai.d.ts +1 -0
  47. package/dist/ingest/providers/openai.d.ts.map +1 -1
  48. package/dist/ingest/providers/openai.js +1 -0
  49. package/dist/ingest/providers/openai.js.map +1 -1
  50. package/dist/ingest/task-processor.js +1 -1
  51. package/dist/ingest/task-processor.js.map +1 -1
  52. package/dist/openclaw-api.d.ts +53 -0
  53. package/dist/openclaw-api.d.ts.map +1 -0
  54. package/dist/openclaw-api.js +189 -0
  55. package/dist/openclaw-api.js.map +1 -0
  56. package/dist/recall/engine.js +1 -1
  57. package/dist/recall/engine.js.map +1 -1
  58. package/dist/shared/llm-call.d.ts +4 -1
  59. package/dist/shared/llm-call.d.ts.map +1 -1
  60. package/dist/shared/llm-call.js +14 -1
  61. package/dist/shared/llm-call.js.map +1 -1
  62. package/dist/sharing/types.contract.d.ts +2 -0
  63. package/dist/sharing/types.contract.d.ts.map +1 -0
  64. package/dist/sharing/types.contract.js +3 -0
  65. package/dist/sharing/types.contract.js.map +1 -0
  66. package/dist/sharing/types.d.ts +80 -0
  67. package/dist/sharing/types.d.ts.map +1 -0
  68. package/dist/sharing/types.js +3 -0
  69. package/dist/sharing/types.js.map +1 -0
  70. package/dist/skill/evaluator.d.ts.map +1 -1
  71. package/dist/skill/evaluator.js +2 -2
  72. package/dist/skill/evaluator.js.map +1 -1
  73. package/dist/skill/generator.d.ts.map +1 -1
  74. package/dist/skill/generator.js +4 -4
  75. package/dist/skill/generator.js.map +1 -1
  76. package/dist/skill/upgrader.js +1 -1
  77. package/dist/skill/upgrader.js.map +1 -1
  78. package/dist/skill/validator.js +1 -1
  79. package/dist/skill/validator.js.map +1 -1
  80. package/dist/storage/ensure-binding.d.ts.map +1 -1
  81. package/dist/storage/ensure-binding.js +3 -1
  82. package/dist/storage/ensure-binding.js.map +1 -1
  83. package/dist/storage/sqlite.d.ts +332 -1
  84. package/dist/storage/sqlite.d.ts.map +1 -1
  85. package/dist/storage/sqlite.js +913 -4
  86. package/dist/storage/sqlite.js.map +1 -1
  87. package/dist/tools/index.d.ts +1 -0
  88. package/dist/tools/index.d.ts.map +1 -1
  89. package/dist/tools/index.js +3 -1
  90. package/dist/tools/index.js.map +1 -1
  91. package/dist/tools/memory-search.d.ts +5 -2
  92. package/dist/tools/memory-search.d.ts.map +1 -1
  93. package/dist/tools/memory-search.js +50 -7
  94. package/dist/tools/memory-search.js.map +1 -1
  95. package/dist/tools/network-memory-detail.d.ts +4 -0
  96. package/dist/tools/network-memory-detail.d.ts.map +1 -0
  97. package/dist/tools/network-memory-detail.js +34 -0
  98. package/dist/tools/network-memory-detail.js.map +1 -0
  99. package/dist/types.d.ts +48 -2
  100. package/dist/types.d.ts.map +1 -1
  101. package/dist/types.js.map +1 -1
  102. package/dist/viewer/html.d.ts.map +1 -1
  103. package/dist/viewer/html.js +4299 -511
  104. package/dist/viewer/html.js.map +1 -1
  105. package/dist/viewer/server.d.ts +65 -0
  106. package/dist/viewer/server.d.ts.map +1 -1
  107. package/dist/viewer/server.js +1844 -90
  108. package/dist/viewer/server.js.map +1 -1
  109. package/index.ts +767 -41
  110. package/openclaw.plugin.json +3 -2
  111. package/package.json +3 -3
  112. package/scripts/postinstall.cjs +282 -45
  113. package/skill/memos-memory-guide/SKILL.md +82 -20
  114. package/src/capture/index.ts +30 -2
  115. package/src/client/connector.ts +225 -0
  116. package/src/client/hub.ts +207 -0
  117. package/src/client/skill-sync.ts +216 -0
  118. package/src/config.ts +92 -3
  119. package/src/embedding/index.ts +21 -1
  120. package/src/hub/auth.ts +78 -0
  121. package/src/hub/server.ts +906 -0
  122. package/src/hub/user-manager.ts +143 -0
  123. package/src/index.ts +13 -5
  124. package/src/ingest/providers/index.ts +240 -6
  125. package/src/ingest/providers/openai.ts +1 -1
  126. package/src/ingest/task-processor.ts +1 -1
  127. package/src/openclaw-api.ts +287 -0
  128. package/src/recall/engine.ts +1 -1
  129. package/src/shared/llm-call.ts +18 -2
  130. package/src/sharing/types.contract.ts +40 -0
  131. package/src/sharing/types.ts +102 -0
  132. package/src/skill/evaluator.ts +3 -2
  133. package/src/skill/generator.ts +6 -4
  134. package/src/skill/upgrader.ts +1 -1
  135. package/src/skill/validator.ts +1 -1
  136. package/src/storage/ensure-binding.ts +3 -1
  137. package/src/storage/sqlite.ts +1164 -4
  138. package/src/tools/index.ts +1 -0
  139. package/src/tools/memory-search.ts +58 -8
  140. package/src/tools/network-memory-detail.ts +34 -0
  141. package/src/types.ts +43 -2
  142. package/src/viewer/html.ts +4299 -511
  143. package/src/viewer/server.ts +1688 -73
@@ -1,3 +1,4 @@
1
1
  export { createMemorySearchTool } from "./memory-search";
2
2
  export { createMemoryTimelineTool } from "./memory-timeline";
3
3
  export { createMemoryGetTool } from "./memory-get";
4
+ export { createNetworkMemoryDetailTool } from "./network-memory-detail";
@@ -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
- export function createMemorySearchTool(engine: RecallEngine): ToolDefinition {
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, sharedState?: { lastSearchTime: number }): ToolDefinition {
10
28
  return {
11
29
  name: "memory_search",
12
30
  description:
@@ -27,16 +45,48 @@ 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 result = await engine.search({
34
- query: (input.query as string) ?? "",
35
- maxResults: input.maxResults as number | undefined,
36
- minScore: input.minScore as number | undefined,
37
- ownerFilter: resolveOwnerFilter(input.owner),
63
+ if (sharedState) sharedState.lastSearchTime = Date.now();
64
+ const query = (input.query as string) ?? "";
65
+ const maxResults = input.maxResults as number | undefined;
66
+ const minScore = input.minScore as number | undefined;
67
+ const ownerFilter = resolveOwnerFilter(input.owner);
68
+ const scope = resolveScope(input.scope);
69
+
70
+ const localSearch = engine.search({
71
+ query,
72
+ maxResults,
73
+ minScore,
74
+ ownerFilter,
38
75
  });
39
- return result;
76
+
77
+ if (scope === "local" || !store || !ctx) {
78
+ return localSearch;
79
+ }
80
+
81
+ const [local, hub] = await Promise.all([
82
+ localSearch,
83
+ hubSearchMemories(store, ctx, { query, maxResults, scope, hubAddress: input.hubAddress as string | undefined, userToken: input.userToken as string | undefined }).catch((err) => {
84
+ ctx.log.warn(`Hub search failed, using local-only results: ${err}`);
85
+ return emptyHubResult(scope);
86
+ }),
87
+ ]);
88
+
89
+ return { local, hub };
40
90
  },
41
91
  };
42
92
  }
@@ -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
@@ -150,7 +150,8 @@ export type SummaryProvider =
150
150
  | "bailian"
151
151
  | "cohere"
152
152
  | "mistral"
153
- | "voyage";
153
+ | "voyage"
154
+ | "openclaw";
154
155
 
155
156
  export type EmbeddingProvider =
156
157
  | "openai"
@@ -160,7 +161,8 @@ export type EmbeddingProvider =
160
161
  | "cohere"
161
162
  | "mistral"
162
163
  | "voyage"
163
- | "local";
164
+ | "local"
165
+ | "openclaw";
164
166
 
165
167
  export interface ProviderConfig {
166
168
  provider: string;
@@ -170,6 +172,7 @@ export interface ProviderConfig {
170
172
  headers?: Record<string, string>;
171
173
  timeoutMs?: number;
172
174
  temperature?: number;
175
+ capabilities?: SharingCapabilities;
173
176
  }
174
177
 
175
178
  export interface SummarizerConfig extends ProviderConfig {
@@ -246,6 +249,7 @@ export interface SkillEvolutionConfig {
246
249
  minConfidence?: number;
247
250
  maxSkillLines?: number;
248
251
  autoInstall?: boolean;
252
+ /** Optional independent LLM config for skill evaluation/validation. Falls back to main summarizer if not set. */
249
253
  summarizer?: SummarizerConfig;
250
254
  }
251
255
 
@@ -253,6 +257,36 @@ export interface TelemetryConfig {
253
257
  enabled?: boolean;
254
258
  }
255
259
 
260
+ export type SharingRole = "hub" | "client";
261
+
262
+ export interface SharingCapabilities {
263
+ hostEmbedding?: boolean;
264
+ hostCompletion?: boolean;
265
+ hostSkill?: boolean;
266
+ }
267
+
268
+ export interface HubModeConfig {
269
+ port?: number;
270
+ teamName?: string;
271
+ teamToken?: string;
272
+ }
273
+
274
+ export interface ClientModeConfig {
275
+ hubAddress?: string;
276
+ userToken?: string;
277
+ teamToken?: string;
278
+ nickname?: string;
279
+ pendingUserId?: string;
280
+ }
281
+
282
+ export interface SharingConfig {
283
+ enabled?: boolean;
284
+ role?: SharingRole;
285
+ hub?: HubModeConfig;
286
+ client?: ClientModeConfig;
287
+ capabilities?: SharingCapabilities;
288
+ }
289
+
256
290
  export interface MemosLocalConfig {
257
291
  summarizer?: SummarizerConfig;
258
292
  embedding?: EmbeddingConfig;
@@ -278,6 +312,7 @@ export interface MemosLocalConfig {
278
312
  };
279
313
  skillEvolution?: SkillEvolutionConfig;
280
314
  telemetry?: TelemetryConfig;
315
+ sharing?: SharingConfig;
281
316
  }
282
317
 
283
318
  // ─── Defaults ───
@@ -318,6 +353,12 @@ export interface PluginContext {
318
353
  workspaceDir: string;
319
354
  config: MemosLocalConfig;
320
355
  log: Logger;
356
+ openclawAPI?: OpenClawAPI;
357
+ }
358
+
359
+ export interface OpenClawAPI {
360
+ embed(request: { texts: string[]; model?: string }): Promise<{ embeddings: number[][]; dimensions: number }>;
361
+ complete(request: { prompt: string; maxTokens?: number; temperature?: number; model?: string }): Promise<{ text: string }>;
321
362
  }
322
363
 
323
364
  export interface Logger {