@yhc3577/memory-new 0.1.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 +42 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +7 -0
- package/dist/openclaw.plugin.json +19 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @openclaw/memory-new
|
|
2
|
+
|
|
3
|
+
A new memory extension for OpenClaw.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @openclaw/memory-new
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
After installation, add to your `openclaw.json`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"plugins": {
|
|
18
|
+
"entries": {
|
|
19
|
+
"memory_new": {
|
|
20
|
+
"enabled": true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
- `memory_new status` - Show plugin status
|
|
30
|
+
- `memory_new help` - Show help
|
|
31
|
+
|
|
32
|
+
## Development
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install
|
|
36
|
+
npm run build
|
|
37
|
+
npm publish
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
MIT
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
|
+
var index_default = definePluginEntry({
|
|
4
|
+
id: "memory_new",
|
|
5
|
+
name: "Memory New",
|
|
6
|
+
description: "A new memory extension for OpenClaw.",
|
|
7
|
+
register(api) {
|
|
8
|
+
const config = api.pluginConfig ?? { enabled: true };
|
|
9
|
+
api.registerCommand({
|
|
10
|
+
name: "memory_new",
|
|
11
|
+
description: "Interact with Memory New extension.",
|
|
12
|
+
acceptsArgs: true,
|
|
13
|
+
exposeSenderIsOwner: true,
|
|
14
|
+
handler: async (ctx) => {
|
|
15
|
+
const tokens = ctx.args?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
16
|
+
const action = (tokens[0] ?? "status").toLowerCase();
|
|
17
|
+
if (action === "status") {
|
|
18
|
+
return {
|
|
19
|
+
text: `Memory New: ${config.enabled ? "enabled" : "disabled"}`
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (action === "help") {
|
|
23
|
+
return {
|
|
24
|
+
text: `Memory New Commands:
|
|
25
|
+
status - Show current status
|
|
26
|
+
help - Show this help`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
text: `Unknown action: ${action}
|
|
31
|
+
|
|
32
|
+
Type "memory_new help" for available commands.`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
api.on("before_prompt_build", async (event, ctx) => {
|
|
37
|
+
if (!config.enabled) {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
api.logger.info?.("memory_new: before_prompt_build triggered");
|
|
41
|
+
return {
|
|
42
|
+
prependContext: "[Memory New Plugin] Memory New plugin is active."
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
api.on("agent_end", (event, ctx) => {
|
|
46
|
+
const runId = event.runId ?? ctx.runId;
|
|
47
|
+
api.logger.debug?.(`memory_new: agent_end for run ${runId}`);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
var testing = {};
|
|
52
|
+
export {
|
|
53
|
+
index_default as default,
|
|
54
|
+
testing
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Memory New plugin entry.\n */\nimport { definePluginEntry, type OpenClawPluginApi } from \"openclaw/plugin-sdk/plugin-entry\";\n\ninterface MemoryNewConfig {\n enabled: boolean;\n}\n\n/** Plugin entry registering memory_new hooks, tools, config schema, and doctor cleanup. */\nexport default definePluginEntry({\n id: \"memory_new\",\n name: \"Memory New\",\n description: \"A new memory extension for OpenClaw.\",\n register(api: OpenClawPluginApi) {\n const config = (api.pluginConfig ?? { enabled: true }) as MemoryNewConfig;\n\n api.registerCommand({\n name: \"memory_new\",\n description: \"Interact with Memory New extension.\",\n acceptsArgs: true,\n exposeSenderIsOwner: true,\n handler: async (ctx) => {\n const tokens = ctx.args?.trim().split(/\\s+/).filter(Boolean) ?? [];\n const action = (tokens[0] ?? \"status\").toLowerCase();\n\n if (action === \"status\") {\n return {\n text: `Memory New: ${config.enabled ? \"enabled\" : \"disabled\"}`,\n };\n }\n\n if (action === \"help\") {\n return {\n text: `Memory New Commands:\\n status - Show current status\\n help - Show this help`,\n };\n }\n\n return {\n text: `Unknown action: ${action}\\n\\nType \"memory_new help\" for available commands.`,\n };\n },\n });\n\n api.on(\"before_prompt_build\", async (event, ctx) => {\n if (!config.enabled) {\n return undefined;\n }\n\n api.logger.info?.(\"memory_new: before_prompt_build triggered\");\n\n // Example: add a prefix to the prompt\n return {\n prependContext: \"[Memory New Plugin] Memory New plugin is active.\",\n };\n });\n\n api.on(\"agent_end\", (event, ctx) => {\n const runId = event.runId ?? ctx.runId;\n api.logger.debug?.(`memory_new: agent_end for run ${runId}`);\n });\n },\n});\n\nexport const testing = {};\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,yBAAiD;AAO1D,IAAO,gBAAQ,kBAAkB;AAAA,EAC/B,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS,KAAwB;AAC/B,UAAM,SAAU,IAAI,gBAAgB,EAAE,SAAS,KAAK;AAEpD,QAAI,gBAAgB;AAAA,MAClB,MAAM;AAAA,MACN,aAAa;AAAA,MACb,aAAa;AAAA,MACb,qBAAqB;AAAA,MACrB,SAAS,OAAO,QAAQ;AACtB,cAAM,SAAS,IAAI,MAAM,KAAK,EAAE,MAAM,KAAK,EAAE,OAAO,OAAO,KAAK,CAAC;AACjE,cAAM,UAAU,OAAO,CAAC,KAAK,UAAU,YAAY;AAEnD,YAAI,WAAW,UAAU;AACvB,iBAAO;AAAA,YACL,MAAM,eAAe,OAAO,UAAU,YAAY,UAAU;AAAA,UAC9D;AAAA,QACF;AAEA,YAAI,WAAW,QAAQ;AACrB,iBAAO;AAAA,YACL,MAAM;AAAA;AAAA;AAAA,UACR;AAAA,QACF;AAEA,eAAO;AAAA,UACL,MAAM,mBAAmB,MAAM;AAAA;AAAA;AAAA,QACjC;AAAA,MACF;AAAA,IACF,CAAC;AAED,QAAI,GAAG,uBAAuB,OAAO,OAAO,QAAQ;AAClD,UAAI,CAAC,OAAO,SAAS;AACnB,eAAO;AAAA,MACT;AAEA,UAAI,OAAO,OAAO,2CAA2C;AAG7D,aAAO;AAAA,QACL,gBAAgB;AAAA,MAClB;AAAA,IACF,CAAC;AAED,QAAI,GAAG,aAAa,CAAC,OAAO,QAAQ;AAClC,YAAM,QAAQ,MAAM,SAAS,IAAI;AACjC,UAAI,OAAO,QAAQ,iCAAiC,KAAK,EAAE;AAAA,IAC7D,CAAC;AAAA,EACH;AACF,CAAC;AAEM,IAAM,UAAU,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "memory_new",
|
|
3
|
+
"doctorContract": {
|
|
4
|
+
"configRepair": true,
|
|
5
|
+
"stateMigrations": true
|
|
6
|
+
},
|
|
7
|
+
"activation": {
|
|
8
|
+
"onStartup": true
|
|
9
|
+
},
|
|
10
|
+
"name": "Memory New",
|
|
11
|
+
"description": "A new memory extension for OpenClaw.",
|
|
12
|
+
"configSchema": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": false,
|
|
15
|
+
"properties": {
|
|
16
|
+
"enabled": { "type": "boolean" }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yhc3577/memory-new",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Memory New - A new memory extension for OpenClaw",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"openclaw": {
|
|
18
|
+
"extensions": [
|
|
19
|
+
"./dist/index.js"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"esbuild": "^0.24.2"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"openclaw": ">=2026.7.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependenciesMeta": {
|
|
29
|
+
"openclaw": {
|
|
30
|
+
"optional": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"registry": "https://registry.npmjs.org/"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "node scripts/build.mjs"
|
|
38
|
+
}
|
|
39
|
+
}
|