openclaw-memory-alibaba-mysql 0.1.0 → 0.1.2
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 +2 -2
- package/db.ts +3 -3
- package/index.ts +9 -9
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -29,10 +29,10 @@ openclaw plugins install openclaw-memory-alibaba-mysql
|
|
|
29
29
|
{
|
|
30
30
|
"plugins": {
|
|
31
31
|
"slots": {
|
|
32
|
-
"memory": "memory-alibaba-mysql"
|
|
32
|
+
"memory": "openclaw-memory-alibaba-mysql"
|
|
33
33
|
},
|
|
34
34
|
"entries": {
|
|
35
|
-
"memory-alibaba-mysql": {
|
|
35
|
+
"openclaw-memory-alibaba-mysql": {
|
|
36
36
|
"enabled": true,
|
|
37
37
|
"config": {
|
|
38
38
|
"mysql": {
|
package/db.ts
CHANGED
|
@@ -111,7 +111,7 @@ export class MemoryDB {
|
|
|
111
111
|
const createdAt = Date.now();
|
|
112
112
|
const vectorStr = JSON.stringify(entry.vector);
|
|
113
113
|
|
|
114
|
-
await this.pool!.
|
|
114
|
+
await this.pool!.query(
|
|
115
115
|
`INSERT INTO \`${this.tableName}\` (id, agent_id, text, embedding, importance, category, created_at)
|
|
116
116
|
VALUES (?, ?, ?, VEC_FROMTEXT(?), ?, ?, ?)`,
|
|
117
117
|
[id, agentId, entry.text, vectorStr, entry.importance, entry.category, createdAt],
|
|
@@ -145,7 +145,7 @@ export class MemoryDB {
|
|
|
145
145
|
await this.ensureInitialized();
|
|
146
146
|
|
|
147
147
|
const vectorStr = JSON.stringify(vector);
|
|
148
|
-
const [rows] = await this.pool!.
|
|
148
|
+
const [rows] = await this.pool!.query(
|
|
149
149
|
`SELECT id, text, importance, category, created_at,
|
|
150
150
|
VEC_DISTANCE_COSINE(embedding, VEC_FROMTEXT(?)) AS distance
|
|
151
151
|
FROM \`${this.tableName}\`
|
|
@@ -184,7 +184,7 @@ export class MemoryDB {
|
|
|
184
184
|
}
|
|
185
185
|
await this.ensureInitialized();
|
|
186
186
|
|
|
187
|
-
const [result] = await this.pool!.
|
|
187
|
+
const [result] = await this.pool!.query(
|
|
188
188
|
`DELETE FROM \`${this.tableName}\` WHERE id = ? AND agent_id = ?`,
|
|
189
189
|
[id, agentId],
|
|
190
190
|
);
|
package/index.ts
CHANGED
|
@@ -152,7 +152,7 @@ function detectCategory(text: string): MemoryCategory {
|
|
|
152
152
|
// ============================================================================
|
|
153
153
|
|
|
154
154
|
const memoryPlugin = {
|
|
155
|
-
id: "memory-alibaba-mysql",
|
|
155
|
+
id: "openclaw-memory-alibaba-mysql",
|
|
156
156
|
name: "Memory (Alibaba Cloud RDS MySQL)",
|
|
157
157
|
description: "Alibaba Cloud RDS MySQL backed long-term memory with auto-recall/capture",
|
|
158
158
|
kind: "memory" as const,
|
|
@@ -167,7 +167,7 @@ const memoryPlugin = {
|
|
|
167
167
|
const embeddings = new Embeddings(apiKey, model, baseUrl, dimensions);
|
|
168
168
|
|
|
169
169
|
api.logger.info(
|
|
170
|
-
`memory-alibaba-mysql: plugin registered (host: ${cfg.mysql.host}, table: ${cfg.tableName}, lazy init)`,
|
|
170
|
+
`openclaw-memory-alibaba-mysql: plugin registered (host: ${cfg.mysql.host}, table: ${cfg.tableName}, lazy init)`,
|
|
171
171
|
);
|
|
172
172
|
|
|
173
173
|
// ========================================================================
|
|
@@ -382,7 +382,7 @@ const memoryPlugin = {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
api.logger.info?.(
|
|
385
|
-
`memory-alibaba-mysql: injecting ${results.length} memories into context`,
|
|
385
|
+
`openclaw-memory-alibaba-mysql: injecting ${results.length} memories into context`,
|
|
386
386
|
);
|
|
387
387
|
|
|
388
388
|
return {
|
|
@@ -391,7 +391,7 @@ const memoryPlugin = {
|
|
|
391
391
|
),
|
|
392
392
|
};
|
|
393
393
|
} catch (err) {
|
|
394
|
-
api.logger.warn(`memory-alibaba-mysql: recall failed: ${String(err)}`);
|
|
394
|
+
api.logger.warn(`openclaw-memory-alibaba-mysql: recall failed: ${String(err)}`);
|
|
395
395
|
}
|
|
396
396
|
});
|
|
397
397
|
}
|
|
@@ -463,10 +463,10 @@ const memoryPlugin = {
|
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
if (stored > 0) {
|
|
466
|
-
api.logger.info(`memory-alibaba-mysql: auto-captured ${stored} memories`);
|
|
466
|
+
api.logger.info(`openclaw-memory-alibaba-mysql: auto-captured ${stored} memories`);
|
|
467
467
|
}
|
|
468
468
|
} catch (err) {
|
|
469
|
-
api.logger.warn(`memory-alibaba-mysql: capture failed: ${String(err)}`);
|
|
469
|
+
api.logger.warn(`openclaw-memory-alibaba-mysql: capture failed: ${String(err)}`);
|
|
470
470
|
}
|
|
471
471
|
});
|
|
472
472
|
}
|
|
@@ -476,15 +476,15 @@ const memoryPlugin = {
|
|
|
476
476
|
// ========================================================================
|
|
477
477
|
|
|
478
478
|
api.registerService({
|
|
479
|
-
id: "memory-alibaba-mysql",
|
|
479
|
+
id: "openclaw-memory-alibaba-mysql",
|
|
480
480
|
start: () => {
|
|
481
481
|
api.logger.info(
|
|
482
|
-
`memory-alibaba-mysql: initialized (host: ${cfg.mysql.host}, model: ${cfg.embedding.model})`,
|
|
482
|
+
`openclaw-memory-alibaba-mysql: initialized (host: ${cfg.mysql.host}, model: ${cfg.embedding.model})`,
|
|
483
483
|
);
|
|
484
484
|
},
|
|
485
485
|
stop: async () => {
|
|
486
486
|
await db.close();
|
|
487
|
-
api.logger.info("memory-alibaba-mysql: stopped, connection pool closed");
|
|
487
|
+
api.logger.info("openclaw-memory-alibaba-mysql: stopped, connection pool closed");
|
|
488
488
|
},
|
|
489
489
|
});
|
|
490
490
|
},
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-memory-alibaba-mysql",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "OpenClaw memory plugin using Alibaba Cloud RDS MySQL vector storage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,5 +36,8 @@
|
|
|
36
36
|
"extensions": [
|
|
37
37
|
"./index.ts"
|
|
38
38
|
]
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"tsx": "^4.21.0"
|
|
39
42
|
}
|
|
40
43
|
}
|