@alfe.ai/openclaw-database 0.0.1 → 0.0.3
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/dist/plugin.d.ts +0 -7
- package/dist/plugin2.js +10 -7
- package/openclaw.plugin.json +12 -0
- package/package.json +5 -3
package/dist/plugin.d.ts
CHANGED
|
@@ -5,13 +5,6 @@ interface PluginApi {
|
|
|
5
5
|
error: (...args: unknown[]) => void;
|
|
6
6
|
debug: (...args: unknown[]) => void;
|
|
7
7
|
};
|
|
8
|
-
config?: {
|
|
9
|
-
plugins?: {
|
|
10
|
-
entries?: Record<string, {
|
|
11
|
-
config?: Record<string, string>;
|
|
12
|
-
}>;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
8
|
registerTool(tool: unknown): void;
|
|
16
9
|
}
|
|
17
10
|
declare const plugin: {
|
package/dist/plugin2.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MongoClient } from "mongodb";
|
|
2
|
+
import { resolveConfig } from "@alfe.ai/config";
|
|
2
3
|
//#region src/tools.ts
|
|
3
4
|
const DEFAULT_DB = "org_default";
|
|
4
5
|
function str(required = true) {
|
|
@@ -418,7 +419,6 @@ function registerTools(api, client, databases, audit) {
|
|
|
418
419
|
}
|
|
419
420
|
//#endregion
|
|
420
421
|
//#region src/plugin.ts
|
|
421
|
-
const PLUGIN_ID = "@alfe.ai/openclaw-database";
|
|
422
422
|
let mongoClient = null;
|
|
423
423
|
async function fetchCredentials(apiUrl, apiKey) {
|
|
424
424
|
const res = await fetch(`${apiUrl}/agents/database/register`, {
|
|
@@ -442,17 +442,20 @@ function reportAudit(apiUrl, apiKey, entry) {
|
|
|
442
442
|
}).catch(() => {});
|
|
443
443
|
}
|
|
444
444
|
const plugin = {
|
|
445
|
-
id:
|
|
445
|
+
id: "@alfe.ai/openclaw-database",
|
|
446
446
|
name: "Database",
|
|
447
447
|
version: "0.0.1",
|
|
448
448
|
async activate(api) {
|
|
449
449
|
const log = api.logger;
|
|
450
450
|
log.info("Database plugin activating...");
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
451
|
+
let apiUrl;
|
|
452
|
+
let apiKey;
|
|
453
|
+
try {
|
|
454
|
+
const config = await resolveConfig();
|
|
455
|
+
apiUrl = config.apiUrl;
|
|
456
|
+
apiKey = config.apiKey;
|
|
457
|
+
} catch (err) {
|
|
458
|
+
log.error(`Database plugin: failed to resolve config — ${err instanceof Error ? err.message : String(err)}`);
|
|
456
459
|
return;
|
|
457
460
|
}
|
|
458
461
|
const credentials = await fetchCredentials(apiUrl, apiKey);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "@alfe.ai/openclaw-database",
|
|
3
|
+
"name": "Database",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"description": "MongoDB database access for agents — query, insert, update, delete, and manage collections",
|
|
6
|
+
"entry": "./dist/plugin.js",
|
|
7
|
+
"configSchema": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {}
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/openclaw-database",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "OpenClaw database plugin — MongoDB access for agents via MCP tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin.js",
|
|
@@ -21,10 +21,12 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
|
-
"dist"
|
|
24
|
+
"dist",
|
|
25
|
+
"openclaw.plugin.json"
|
|
25
26
|
],
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"mongodb": "^6.12.0"
|
|
28
|
+
"mongodb": "^6.12.0",
|
|
29
|
+
"@alfe.ai/config": "0.0.5"
|
|
28
30
|
},
|
|
29
31
|
"license": "UNLICENSED",
|
|
30
32
|
"scripts": {
|