@modelstudio/modelstudio-memory-for-openclaw 1.0.5 → 1.0.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.
package/index.ts CHANGED
@@ -78,7 +78,6 @@ const ALLOWED_KEYS = [
78
78
  "captureMaxMessages",
79
79
  "recallMinPromptLength",
80
80
  "recallCacheTtlMs",
81
- "enabled",
82
81
  ];
83
82
 
84
83
  function assertAllowedKeys(
@@ -93,14 +92,10 @@ function assertAllowedKeys(
93
92
 
94
93
  const modelstudioMemoryConfigSchema = {
95
94
  parse(value: unknown): BailianMemoryConfig {
96
- let raw =
97
- value && typeof value === "object" && !Array.isArray(value)
98
- ? (value as Record<string, unknown>)
99
- : {};
100
- const cfg =
101
- "config" in raw && raw.config && typeof raw.config === "object" && !Array.isArray(raw.config)
102
- ? (raw.config as Record<string, unknown>)
103
- : raw;
95
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
96
+ throw new Error("modelstudio-memory-for-openclaw config required");
97
+ }
98
+ const cfg = value as Record<string, unknown>;
104
99
  assertAllowedKeys(cfg, ALLOWED_KEYS, "modelstudio-memory-for-openclaw config");
105
100
 
106
101
  // apiKey: allow empty at parse time; tools return config prompt when missing
@@ -363,7 +358,7 @@ function stripInjectedContext(text: string): string {
363
358
  }
364
359
 
365
360
  const CONFIG_REQUIRED_MESSAGE =
366
- "Memory plugin is not configured. Please add apiKey and userId to ~/.openclaw/openclaw.json under plugins.entries.modelstudio-memory-for-openclaw.config";
361
+ "Memory plugin is not configured. Please add apiKey to ~/.openclaw/openclaw.json under plugins.entries.modelstudio-memory-for-openclaw.config.apiKey, then restart the gateway. ";
367
362
 
368
363
  // ============================================================================
369
364
  // Plugin Definition
@@ -729,9 +724,38 @@ const modelstudioMemoryPlugin = {
729
724
  if (cfg.autoRecall) {
730
725
  api.on("before_agent_start", async (event) => {
731
726
  if (!cfg.apiKey) {
727
+ api.logger.warn("modelstudio-memory: injecting config-required system prompt");
732
728
  return {
733
- prependSystemContext:
734
- "IMPORTANT: The memory plugin (modelstudio-memory-for-openclaw) is NOT configured. apiKey is required. Long-term memory is completely disabled until configured. You MUST proactively inform the user: add apiKey to ~/.openclaw/openclaw.json under plugins.entries.modelstudio-memory-for-openclaw.config, then restart the gateway. Get API Key: https://help.aliyun.com/zh/model-studio/get-api-key",
729
+ prependSystemContext: [
730
+ "<memory-plugin-config-required>",
731
+ "CRITICAL INSTRUCTION — YOU MUST FOLLOW THIS BEFORE ANYTHING ELSE:",
732
+ "",
733
+ "The long-term memory plugin is installed but NOT configured. All memory features are COMPLETELY DISABLED.",
734
+ "",
735
+ "YOUR FIRST MESSAGE to the user MUST address this. Tell the user:",
736
+ "",
737
+ "1. 记忆插件已安装,但还未配置 API Key,记忆功能暂时无法使用。",
738
+ "2. 配置方法:编辑 ~/.openclaw/openclaw.json,添加以下内容:",
739
+ "",
740
+ ' {',
741
+ ' "plugins": {',
742
+ ' "entries": {',
743
+ ' "modelstudio-memory-for-openclaw": {',
744
+ ' "config": {',
745
+ ' "apiKey": "sk-你的API Key"',
746
+ ' "userId": "您的用户名称,用于记忆隔离"',
747
+ ' }',
748
+ ' }',
749
+ ' }',
750
+ ' }',
751
+ ' }',
752
+ "",
753
+ "您也可以告诉我apiKey和用户名,我来为您配置",
754
+ "3. 配置完成后,重启 OpenClaw 网关即可启用记忆功能。",
755
+ "",
756
+ "DO NOT ignore this. DO NOT wait for the user to ask about memory. Proactively inform them NOW.",
757
+ "</memory-plugin-config-required>",
758
+ ].join("\n"),
735
759
  };
736
760
  }
737
761
  const prompt = extractTextContent(event.prompt);
@@ -3,7 +3,7 @@
3
3
  "name": "modelstudio-memory-for-openclaw",
4
4
  "description": "阿里云百炼长期记忆服务,提供自动记忆捕获和召回能力",
5
5
  "kind": "memory",
6
- "version": "1.0.5",
6
+ "version": "1.0.6",
7
7
  "configSchema": {
8
8
  "type": "object",
9
9
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelstudio/modelstudio-memory-for-openclaw",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "description": "阿里云百炼长期记忆服务 OpenClaw 插件",
6
6
  "license": "Apache-2.0",