@modelstudio/modelstudio-memory-for-openclaw 1.0.9 → 1.0.11
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 +12 -8
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -92,10 +92,14 @@ function assertAllowedKeys(
|
|
|
92
92
|
|
|
93
93
|
const modelstudioMemoryConfigSchema = {
|
|
94
94
|
parse(value: unknown): BailianMemoryConfig {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
const raw =
|
|
96
|
+
value && typeof value === "object" && !Array.isArray(value)
|
|
97
|
+
? (value as Record<string, unknown>)
|
|
98
|
+
: {};
|
|
99
|
+
const cfg =
|
|
100
|
+
"config" in raw && raw.config && typeof raw.config === "object" && !Array.isArray(raw.config)
|
|
101
|
+
? (raw.config as Record<string, unknown>)
|
|
102
|
+
: raw;
|
|
99
103
|
assertAllowedKeys(cfg, ALLOWED_KEYS, "modelstudio-memory-for-openclaw config");
|
|
100
104
|
|
|
101
105
|
// apiKey: allow empty at parse time; tools return config prompt when missing
|
|
@@ -372,7 +376,7 @@ const modelstudioMemoryPlugin = {
|
|
|
372
376
|
configSchema: modelstudioMemoryConfigSchema,
|
|
373
377
|
|
|
374
378
|
register(api: OpenClawPluginApi) {
|
|
375
|
-
const cfg = modelstudioMemoryConfigSchema.parse(api.
|
|
379
|
+
const cfg = modelstudioMemoryConfigSchema.parse(api.plugini shnConfig);
|
|
376
380
|
const client = new BailianMemoryClient(
|
|
377
381
|
cfg.baseUrl,
|
|
378
382
|
cfg.apiKey,
|
|
@@ -722,11 +726,11 @@ const modelstudioMemoryPlugin = {
|
|
|
722
726
|
|
|
723
727
|
// ========== autoRecall ==========
|
|
724
728
|
if (cfg.autoRecall) {
|
|
725
|
-
api.on("
|
|
729
|
+
api.on("before_prompt_build", async (event) => {
|
|
726
730
|
if (!cfg.apiKey) {
|
|
727
731
|
api.logger.warn("modelstudio-memory: injecting config-required system prompt");
|
|
728
732
|
return {
|
|
729
|
-
|
|
733
|
+
appendSystemContext: [
|
|
730
734
|
"<memory-plugin-config-required>",
|
|
731
735
|
"CRITICAL INSTRUCTION — YOU MUST FOLLOW THIS BEFORE ANYTHING ELSE:",
|
|
732
736
|
"",
|
|
@@ -779,7 +783,7 @@ const modelstudioMemoryPlugin = {
|
|
|
779
783
|
`modelstudio-memory: recalled ${memories.length} memories`
|
|
780
784
|
);
|
|
781
785
|
return {
|
|
782
|
-
|
|
786
|
+
appendSystemContext: formatMemoriesContext(memories),
|
|
783
787
|
};
|
|
784
788
|
}
|
|
785
789
|
} catch (err) {
|
package/openclaw.plugin.json
CHANGED