@t0ken.ai/memoryx-openclaw-plugin 1.0.3 → 1.0.4

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/index.d.ts CHANGED
@@ -93,10 +93,13 @@ declare class MemoryXPlugin {
93
93
  };
94
94
  };
95
95
  }
96
- export declare function onMessage(message: string, context: Record<string, any>): Promise<{
97
- context: Record<string, any>;
98
- }>;
99
- export declare function onResponse(response: string, context: Record<string, any>): string;
100
- export declare function register(api: any, pluginConfig?: PluginConfig): void;
96
+ declare const _default: {
97
+ id: string;
98
+ name: string;
99
+ version: string;
100
+ description: string;
101
+ register(api: any, pluginConfig?: PluginConfig): void;
102
+ };
103
+ export default _default;
101
104
  export { MemoryXPlugin, ConversationBuffer };
102
105
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAWH,UAAU,YAAY;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAUD,UAAU,OAAO;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,cAAM,kBAAkB;IACpB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B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Aa;IAC/B,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,YAAY,CAA6B;gBAErC,YAAY,CAAC,EAAE,YAAY;IAQvC,OAAO,KAAK,OAAO,GAElB;YAEa,IAAI;YAWJ,UAAU;IAgBxB,OAAO,CAAC,UAAU;YAQJ,YAAY;YAgCZ,qBAAqB;IAkBnC,OAAO,CAAC,eAAe;YAQT,iBAAiB;IAqClB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAyB1D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAoD/D,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtC,SAAS,IAAI;QAChB,WAAW,EAAE,OAAO,CAAC;QACrB,SAAS,EAAE,OAAO,CAAC;QACnB,YAAY,EAAE;YAAE,YAAY,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,CAAA;KAC7D;CAOJ;;;;;;kBAUiB,GAAG,iBAAiB,YAAY,GAAG,IAAI;;AANzD,wBAwEE;AAEF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -320,64 +320,65 @@ class MemoryXPlugin {
320
320
  }
321
321
  }
322
322
  let plugin;
323
- export async function onMessage(message, context) {
324
- if (message && plugin) {
325
- await plugin.onMessage("user", message);
326
- }
327
- return { context };
328
- }
329
- export function onResponse(response, context) {
330
- return response;
331
- }
332
- export function register(api, pluginConfig) {
333
- api.logger.info("[MemoryX] Plugin registering (Phase 1 - Cloud with Buffer)...");
334
- if (pluginConfig?.apiBaseUrl) {
335
- api.logger.info(`[MemoryX] Using custom API base URL: ${pluginConfig.apiBaseUrl}`);
336
- }
337
- plugin = new MemoryXPlugin(pluginConfig);
338
- api.on("message_received", async (event, ctx) => {
339
- const { content, from, timestamp } = event;
340
- if (content && plugin) {
341
- await plugin.onMessage("user", content);
323
+ export default {
324
+ id: "@t0ken.ai/memoryx-openclaw-plugin",
325
+ name: "MemoryX Real-time Plugin",
326
+ version: "1.0.4",
327
+ description: "Real-time memory capture and recall for OpenClaw",
328
+ register(api, pluginConfig) {
329
+ api.logger.info("[MemoryX] Plugin registering...");
330
+ if (pluginConfig?.apiBaseUrl) {
331
+ api.logger.info(`[MemoryX] API Base: \`${pluginConfig.apiBaseUrl}\``);
342
332
  }
343
- });
344
- api.on("assistant_response", async (event, ctx) => {
345
- const { content } = event;
346
- if (content && plugin) {
347
- await plugin.onMessage("assistant", content);
333
+ const storedConfig = localStorage.getItem("memoryx_config");
334
+ if (storedConfig) {
335
+ api.logger.info(`[MemoryX] Database: ${storedConfig.split('"apiBaseUrl"')[0].match(/"([^"]+)"/)?.[1] || 'unknown'}`);
348
336
  }
349
- });
350
- api.on("before_agent_start", async (event, ctx) => {
351
- const { prompt } = event;
352
- if (!prompt || prompt.length < 2 || !plugin)
353
- return;
354
- try {
355
- const result = await plugin.recall(prompt, 5);
356
- if (result.isLimited) {
357
- api.logger.warn(`[MemoryX] ${result.upgradeHint}`);
337
+ plugin = new MemoryXPlugin(pluginConfig);
338
+ api.on("message_received", async (event, ctx) => {
339
+ const { content, from, timestamp } = event;
340
+ if (content && plugin) {
341
+ await plugin.onMessage("user", content);
342
+ }
343
+ });
344
+ api.on("assistant_response", async (event, ctx) => {
345
+ const { content } = event;
346
+ if (content && plugin) {
347
+ await plugin.onMessage("assistant", content);
348
+ }
349
+ });
350
+ api.on("before_agent_start", async (event, ctx) => {
351
+ const { prompt } = event;
352
+ if (!prompt || prompt.length < 2 || !plugin)
353
+ return;
354
+ try {
355
+ const result = await plugin.recall(prompt, 5);
356
+ if (result.isLimited) {
357
+ api.logger.warn(`[MemoryX] ${result.upgradeHint}`);
358
+ return {
359
+ prependContext: `[系统提示] ${result.upgradeHint}\n`
360
+ };
361
+ }
362
+ if (result.memories.length === 0)
363
+ return;
364
+ const memories = result.memories
365
+ .map(m => `- [${m.category}] ${m.content}`)
366
+ .join("\n");
367
+ api.logger.info(`[MemoryX] Recalled ${result.memories.length} memories from cloud`);
358
368
  return {
359
- prependContext: `[系统提示] ${result.upgradeHint}\n`
369
+ prependContext: `[相关记忆]\n${memories}\n[End of memories]\n`
360
370
  };
361
371
  }
362
- if (result.memories.length === 0)
363
- return;
364
- const memories = result.memories
365
- .map(m => `- [${m.category}] ${m.content}`)
366
- .join("\n");
367
- api.logger.info(`[MemoryX] Recalled ${result.memories.length} memories from cloud`);
368
- return {
369
- prependContext: `[相关记忆]\n${memories}\n[End of memories]\n`
370
- };
371
- }
372
- catch (error) {
373
- api.logger.warn(`[MemoryX] Recall failed: ${error}`);
374
- }
375
- });
376
- api.on("conversation_end", async (event, ctx) => {
377
- if (plugin) {
378
- await plugin.endConversation();
379
- }
380
- });
381
- api.logger.info("[MemoryX] Plugin registered successfully");
382
- }
372
+ catch (error) {
373
+ api.logger.warn(`[MemoryX] Recall failed: ${error}`);
374
+ }
375
+ });
376
+ api.on("conversation_end", async (event, ctx) => {
377
+ if (plugin) {
378
+ await plugin.endConversation();
379
+ }
380
+ });
381
+ api.logger.info("[MemoryX] Plugin registered successfully");
382
+ }
383
+ };
383
384
  export { MemoryXPlugin, ConversationBuffer };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "@t0ken.ai/memoryx-openclaw-plugin",
3
3
  "name": "MemoryX Real-time Plugin",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "description": "Real-time memory capture and recall for OpenClaw",
6
6
  "entry": "./dist/index.js",
7
7
  "kind": "memory",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t0ken.ai/memoryx-openclaw-plugin",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "MemoryX real-time memory capture and recall plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",