opencode-haimati 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/README.md +4 -4
- package/dist/index.js +9 -4
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ bun add -g opencode-haimati
|
|
|
71
71
|
```typescript
|
|
72
72
|
// 写入新记忆
|
|
73
73
|
haimati_write({
|
|
74
|
-
category: "
|
|
74
|
+
category: "xxx项目/签章",
|
|
75
75
|
title: "签章服务WS通信机制",
|
|
76
76
|
content: "WebSocket通信采用base64编码..."
|
|
77
77
|
})
|
|
@@ -94,7 +94,7 @@ haimati_edit({
|
|
|
94
94
|
// 移动记忆到新分类
|
|
95
95
|
haimati_move({
|
|
96
96
|
query: "086",
|
|
97
|
-
newCategory: "
|
|
97
|
+
newCategory: "xxx项目/客户端"
|
|
98
98
|
})
|
|
99
99
|
|
|
100
100
|
// 删除记忆
|
|
@@ -104,13 +104,13 @@ haimati_delete({ query: "086" })
|
|
|
104
104
|
haimati_list({})
|
|
105
105
|
|
|
106
106
|
// 列出指定分类下的记忆
|
|
107
|
-
haimati_list({ category: "
|
|
107
|
+
haimati_list({ category: "xxx项目", recursive: true })
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
## 索引格式示例
|
|
111
111
|
|
|
112
112
|
```
|
|
113
|
-
|
|
113
|
+
xxx项目/
|
|
114
114
|
├── 签章/
|
|
115
115
|
│ └── 签章服务WS通信机制 - 086
|
|
116
116
|
└── 通用/
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var HAIMATI_CONFIG_FILE = "opencode-haimati.conf";
|
|
|
20
20
|
var HAIMATI_PATH_KEY = "haimati-path";
|
|
21
21
|
var VERSION_SEPARATOR = "\n---\nversion:";
|
|
22
22
|
var DEFAULT_VERSION = 1;
|
|
23
|
+
var AUTO_INJECT_CONTEXT = false;
|
|
23
24
|
async function getConfigHaimatiPath(directory) {
|
|
24
25
|
const configPath = path.join(directory, HAIMATI_CONFIG_FILE);
|
|
25
26
|
if (!await fsExists(configPath)) {
|
|
@@ -535,9 +536,9 @@ ${truncateForLog(result)}`);
|
|
|
535
536
|
* 会自动分配新的序号并存储到文件
|
|
536
537
|
*/
|
|
537
538
|
haimati_write: tool({
|
|
538
|
-
description: "\u5C06\u65B0\u4FE1\u606F\u5199\u5165\u6D77\u9A6C\u4F53\u8BB0\u5FC6\u7CFB\u7EDF\u3002\u9700\u8981\u63D0\u4F9B\u5206\u7C7B\u8DEF\u5F84\uFF08\u5982 '\
|
|
539
|
+
description: "\u5C06\u65B0\u4FE1\u606F\u5199\u5165\u6D77\u9A6C\u4F53\u8BB0\u5FC6\u7CFB\u7EDF\u3002\u9700\u8981\u63D0\u4F9B\u5206\u7C7B\u8DEF\u5F84\uFF08\u5982 'xxx\u9879\u76EE/\u7B7E\u7AE0'\uFF09\u3001\u6807\u9898\u548C\u5185\u5BB9\u3002",
|
|
539
540
|
args: {
|
|
540
|
-
category: tool.schema.string().describe("\u5206\u7C7B\u8DEF\u5F84\uFF0C\u5982 '\
|
|
541
|
+
category: tool.schema.string().describe("\u5206\u7C7B\u8DEF\u5F84\uFF0C\u5982 'xxx\u9879\u76EE/\u7B7E\u7AE0' \u6216 '\u901A\u7528'"),
|
|
541
542
|
title: tool.schema.string().describe("\u8BB0\u5FC6\u6807\u9898\uFF0C\u5982 '\u7B7E\u7AE0\u670D\u52A1WS\u901A\u4FE1\u673A\u5236'"),
|
|
542
543
|
content: tool.schema.string().describe("\u8981\u5199\u5165\u7684\u8BE6\u7EC6\u5185\u5BB9")
|
|
543
544
|
},
|
|
@@ -765,7 +766,7 @@ ${truncateForLog(result)}`);
|
|
|
765
766
|
* haimati_delete - 删除海马体中的记忆
|
|
766
767
|
*/
|
|
767
768
|
haimati_delete: tool({
|
|
768
|
-
description: "\u5220\u9664\u6D77\u9A6C\u4F53\u4E2D\u7684\u8BB0\u5FC6\u3002\u901A\u8FC7\u5E8F\u53F7\uFF08\u5982 '086'\uFF09\u6216\u5B8C\u6574\u8DEF\u5F84\uFF08\u5982 '\
|
|
769
|
+
description: "\u5220\u9664\u6D77\u9A6C\u4F53\u4E2D\u7684\u8BB0\u5FC6\u3002\u901A\u8FC7\u5E8F\u53F7\uFF08\u5982 '086'\uFF09\u6216\u5B8C\u6574\u8DEF\u5F84\uFF08\u5982 'xxx\u9879\u76EE/\u7B7E\u7AE0/\u7B7E\u7AE0\u670D\u52A1WS\u901A\u4FE1\u673A\u5236'\uFF09\u6765\u5B9A\u4F4D\u8981\u5220\u9664\u7684\u8BB0\u5FC6\u3002",
|
|
769
770
|
args: {
|
|
770
771
|
query: tool.schema.string().describe("\u5E8F\u53F7\u6216\u5B8C\u6574\u8DEF\u5F84\uFF0C\u7528\u4E8E\u5B9A\u4F4D\u8981\u5220\u9664\u7684\u8BB0\u5FC6")
|
|
771
772
|
},
|
|
@@ -833,7 +834,7 @@ ${truncateForLog(result)}`);
|
|
|
833
834
|
description: "\u4FEE\u6539\u6D77\u9A6C\u4F53\u8BB0\u5FC6\u7684\u5206\u7C7B\u8DEF\u5F84\u3002\u901A\u8FC7\u5E8F\u53F7\u6216\u5B8C\u6574\u8DEF\u5F84\u5B9A\u4F4D\u8BB0\u5FC6\uFF0C\u7136\u540E\u5C06\u5176\u79FB\u52A8\u5230\u65B0\u7684\u5206\u7C7B\u3002",
|
|
834
835
|
args: {
|
|
835
836
|
query: tool.schema.string().describe("\u5E8F\u53F7\u6216\u5B8C\u6574\u8DEF\u5F84\uFF0C\u7528\u4E8E\u5B9A\u4F4D\u8981\u79FB\u52A8\u7684\u8BB0\u5FC6"),
|
|
836
|
-
newCategory: tool.schema.string().describe("\u65B0\u7684\u5206\u7C7B\u8DEF\u5F84\uFF0C\u5982 '\
|
|
837
|
+
newCategory: tool.schema.string().describe("\u65B0\u7684\u5206\u7C7B\u8DEF\u5F84\uFF0C\u5982 'xxx\u9879\u76EE/\u5BA2\u6237\u7AEF' \u6216 '\u901A\u7528'")
|
|
837
838
|
},
|
|
838
839
|
async execute(args, context) {
|
|
839
840
|
const { directory } = context;
|
|
@@ -1044,6 +1045,10 @@ ${truncateForLog(result)}`);
|
|
|
1044
1045
|
await log("warn", "[session.created] \u65E0\u6CD5\u83B7\u53D6 sessionID\uFF0C\u8DF3\u8FC7\u6CE8\u5165");
|
|
1045
1046
|
return;
|
|
1046
1047
|
}
|
|
1048
|
+
if (!AUTO_INJECT_CONTEXT) {
|
|
1049
|
+
await log("info", "[session.created] \u81EA\u52A8\u6CE8\u5165\u5DF2\u5173\u95ED\uFF0C\u8DF3\u8FC7\u6CE8\u5165 (AUTO_INJECT_CONTEXT=false)");
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1047
1052
|
await ctx.client.session.prompt({
|
|
1048
1053
|
path: { id: sessionId },
|
|
1049
1054
|
body: {
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-haimati",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "OpenCode plugin for a file-based memory system inspired by the hippocampus, providing long-term memory storage and retrieval across sessions.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"files": [
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
9
11
|
"scripts": {
|
|
10
12
|
"build": "npx esbuild index.ts --bundle --platform=node --outdir=dist --format=esm --external:@opencode-ai/plugin && cp package.json dist/",
|
|
11
13
|
"prepublishOnly": "npm run build",
|
|
@@ -20,4 +22,4 @@
|
|
|
20
22
|
"@types/bun": "^1.3.1",
|
|
21
23
|
"typescript": "^5.9.3"
|
|
22
24
|
}
|
|
23
|
-
}
|
|
25
|
+
}
|