openclaw-channel-dmwork 0.5.19-dev.891496ab → 0.5.19
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 +21 -69
- package/dist/index.js +0 -166
- package/dist/index.js.map +1 -1
- package/dist/package.json +0 -6
- package/package.json +1 -7
- package/bin/dmwork.js +0 -2
- package/dist/cli/doctor.d.ts +0 -33
- package/dist/cli/doctor.js +0 -346
- package/dist/cli/doctor.js.map +0 -1
- package/dist/cli/index.d.ts +0 -4
- package/dist/cli/index.js +0 -114
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/install.d.ts +0 -15
- package/dist/cli/install.js +0 -151
- package/dist/cli/install.js.map +0 -1
- package/dist/cli/openclaw-cli.d.ts +0 -58
- package/dist/cli/openclaw-cli.js +0 -276
- package/dist/cli/openclaw-cli.js.map +0 -1
- package/dist/cli/remove-account.d.ts +0 -8
- package/dist/cli/remove-account.js +0 -52
- package/dist/cli/remove-account.js.map +0 -1
- package/dist/cli/uninstall.d.ts +0 -8
- package/dist/cli/uninstall.js +0 -33
- package/dist/cli/uninstall.js.map +0 -1
- package/dist/cli/update.d.ts +0 -11
- package/dist/cli/update.js +0 -79
- package/dist/cli/update.js.map +0 -1
- package/dist/cli/utils.d.ts +0 -21
- package/dist/cli/utils.js +0 -98
- package/dist/cli/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -7,89 +7,42 @@ Repository: https://github.com/yujiawei/dmwork-adapters
|
|
|
7
7
|
## Prerequisites
|
|
8
8
|
|
|
9
9
|
- Node.js >= 18
|
|
10
|
-
- OpenClaw installed and configured
|
|
10
|
+
- OpenClaw installed and configured
|
|
11
11
|
- A bot created via BotFather in DMWork (send `/newbot` to BotFather)
|
|
12
12
|
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
One-command install via npx (BotFather will provide the exact command):
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npx -y openclaw-channel-dmwork install \
|
|
19
|
-
--bot-token bf_your_token_here \
|
|
20
|
-
--api-url http://your-server:8090 \
|
|
21
|
-
--account-id my_bot
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
This will:
|
|
25
|
-
1. Install the plugin via `openclaw plugins install`
|
|
26
|
-
2. Configure the bot account in `channels.dmwork.accounts.<account-id>`
|
|
27
|
-
3. Restart the OpenClaw gateway
|
|
28
|
-
|
|
29
|
-
### Interactive install
|
|
30
|
-
|
|
31
|
-
Run without arguments to be prompted for each value:
|
|
13
|
+
## Install as OpenClaw Extension
|
|
32
14
|
|
|
33
15
|
```bash
|
|
34
|
-
|
|
16
|
+
git clone https://github.com/yujiawei/dmwork-adapters.git
|
|
17
|
+
cp -r dmwork-adapters/openclaw-channel-dmwork ~/.openclaw/extensions/dmwork
|
|
18
|
+
cd ~/.openclaw/extensions/dmwork && npm install
|
|
35
19
|
```
|
|
36
20
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
# Update the plugin to the latest version
|
|
41
|
-
npx -y openclaw-channel-dmwork update
|
|
42
|
-
|
|
43
|
-
# Diagnose plugin health
|
|
44
|
-
npx -y openclaw-channel-dmwork doctor
|
|
21
|
+
## Configure
|
|
45
22
|
|
|
46
|
-
|
|
47
|
-
npx -y openclaw-channel-dmwork uninstall
|
|
23
|
+
Add to your `~/.openclaw/config.yaml`:
|
|
48
24
|
|
|
49
|
-
|
|
50
|
-
|
|
25
|
+
```yaml
|
|
26
|
+
channels:
|
|
27
|
+
dmwork:
|
|
28
|
+
botToken: "bf_your_token_here" # Bot token from BotFather
|
|
29
|
+
apiUrl: "http://your-server:8090" # DMWork server API URL
|
|
30
|
+
# wsUrl: "ws://your-server:5200" # Optional — auto-detected from register if omitted
|
|
51
31
|
```
|
|
52
32
|
|
|
53
|
-
|
|
33
|
+
Configuration fields:
|
|
54
34
|
|
|
55
|
-
|
|
35
|
+
- `botToken` (required): Bot token from BotFather (`bf_` prefix)
|
|
36
|
+
- `apiUrl` (required): DMWork server API URL, e.g. `http://192.168.1.100:8090`
|
|
37
|
+
- `wsUrl` (optional): DMWORK WebSocket URL. Auto-detected from register if omitted.
|
|
56
38
|
|
|
57
|
-
|
|
58
|
-
/dmwork_doctor # Check plugin status and connectivity
|
|
59
|
-
/dmwork_doctor my_bot # Check a specific account
|
|
60
|
-
```
|
|
39
|
+
## Run
|
|
61
40
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Bot accounts are stored in `~/.openclaw/openclaw.json` under `channels.dmwork.accounts`:
|
|
65
|
-
|
|
66
|
-
```json
|
|
67
|
-
{
|
|
68
|
-
"channels": {
|
|
69
|
-
"dmwork": {
|
|
70
|
-
"apiUrl": "http://your-server:8090",
|
|
71
|
-
"accounts": {
|
|
72
|
-
"my_bot": {
|
|
73
|
-
"botToken": "bf_your_token_here",
|
|
74
|
-
"apiUrl": "http://your-server:8090"
|
|
75
|
-
},
|
|
76
|
-
"another_bot": {
|
|
77
|
-
"botToken": "bf_another_token",
|
|
78
|
-
"apiUrl": "https://im.example.com/api"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
41
|
+
```bash
|
|
42
|
+
openclaw gateway restart
|
|
84
43
|
```
|
|
85
44
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- `botToken` (required): Bot token from BotFather (`bf_` prefix)
|
|
89
|
-
- `apiUrl` (required): DMWork server API URL
|
|
90
|
-
- `wsUrl` (optional): DMWORK WebSocket URL. Auto-detected if omitted.
|
|
91
|
-
- `requireMention` (optional): Only respond when @mentioned in groups
|
|
92
|
-
- `historyLimit` (optional): Group chat history message limit (default: 20)
|
|
45
|
+
The plugin is loaded automatically by OpenClaw when the gateway starts.
|
|
93
46
|
|
|
94
47
|
## What it does
|
|
95
48
|
|
|
@@ -107,7 +60,6 @@ The `index.ts` exports a standard OpenClaw plugin object. When loaded by OpenCla
|
|
|
107
60
|
- `register(api)` is called automatically
|
|
108
61
|
- `api.runtime` is injected for logging and lifecycle management
|
|
109
62
|
- `api.registerChannel()` registers the DMWork channel plugin
|
|
110
|
-
- `api.registerCommand()` registers `/dmwork_doctor`
|
|
111
63
|
- Configuration is read from `channels.dmwork` in OpenClaw's config
|
|
112
64
|
|
|
113
65
|
The plugin uses the `ChannelPlugin` SDK interface with support for:
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
* OpenClaw channel plugin for DMWork messaging platform.
|
|
5
5
|
* Connects via WuKongIM WebSocket for real-time messaging.
|
|
6
6
|
*/
|
|
7
|
-
import { execFileSync } from "node:child_process";
|
|
8
7
|
import { dmworkPlugin } from "./src/channel.js";
|
|
9
8
|
import { setDmworkRuntime } from "./src/runtime.js";
|
|
10
9
|
import { getGroupMdForPrompt } from "./src/group-md.js";
|
|
11
|
-
import { inProcessConfigReader, runDoctorChecks, formatDoctorResult, } from "./cli/doctor.js";
|
|
12
|
-
import { getOpenClawVersion, pluginsInspect, configGet, configGetJson, configSet, configUnset, gatewayRestart, pluginsInstall, pluginsUninstall, removeChannelConfigFromFile, } from "./cli/openclaw-cli.js";
|
|
13
|
-
import { PLUGIN_ID, RECOMMENDED_DM_SCOPE, validateAccountId } from "./cli/utils.js";
|
|
14
10
|
const plugin = {
|
|
15
11
|
id: "openclaw-channel-dmwork",
|
|
16
12
|
name: "DMWork",
|
|
@@ -18,168 +14,6 @@ const plugin = {
|
|
|
18
14
|
register(api) {
|
|
19
15
|
setDmworkRuntime(api.runtime);
|
|
20
16
|
api.registerChannel({ plugin: dmworkPlugin });
|
|
21
|
-
api.registerCommand({
|
|
22
|
-
name: "dmwork_doctor",
|
|
23
|
-
description: "Check DMWork plugin status and connectivity",
|
|
24
|
-
acceptsArgs: true,
|
|
25
|
-
async handler(ctx) {
|
|
26
|
-
const reader = inProcessConfigReader(ctx.config);
|
|
27
|
-
const result = await runDoctorChecks({
|
|
28
|
-
reader,
|
|
29
|
-
accountId: ctx.args?.trim() || undefined,
|
|
30
|
-
inProcess: true,
|
|
31
|
-
});
|
|
32
|
-
return { text: formatDoctorResult(result) };
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
// /dmwork_info
|
|
36
|
-
api.registerCommand({
|
|
37
|
-
name: "dmwork_info",
|
|
38
|
-
description: "Show DMWork plugin version info",
|
|
39
|
-
acceptsArgs: false,
|
|
40
|
-
async handler() {
|
|
41
|
-
const openclawVersion = getOpenClawVersion() ?? "not found";
|
|
42
|
-
const inspect = pluginsInspect(PLUGIN_ID);
|
|
43
|
-
const installedVersion = inspect?.plugin?.version ?? "not installed";
|
|
44
|
-
return {
|
|
45
|
-
text: [
|
|
46
|
-
`openclaw-channel-dmwork: ${installedVersion}`,
|
|
47
|
-
`openclaw: ${openclawVersion}`,
|
|
48
|
-
`plugin package: ${PLUGIN_ID}`,
|
|
49
|
-
].join("\n"),
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
// /dmwork_install
|
|
54
|
-
api.registerCommand({
|
|
55
|
-
name: "dmwork_install",
|
|
56
|
-
description: "Install or reinstall the DMWork plugin",
|
|
57
|
-
acceptsArgs: true,
|
|
58
|
-
async handler(ctx) {
|
|
59
|
-
const args = ctx.args?.trim() ?? "";
|
|
60
|
-
// Parse: --force or empty
|
|
61
|
-
const force = args.includes("--force");
|
|
62
|
-
try {
|
|
63
|
-
const inspect = pluginsInspect(PLUGIN_ID);
|
|
64
|
-
if (inspect?.plugin && !force) {
|
|
65
|
-
return { text: `DMWork plugin already installed (v${inspect.plugin.version}). Use --force to reinstall.` };
|
|
66
|
-
}
|
|
67
|
-
pluginsInstall(PLUGIN_ID, true, force);
|
|
68
|
-
gatewayRestart(true);
|
|
69
|
-
const after = pluginsInspect(PLUGIN_ID);
|
|
70
|
-
return { text: `DMWork plugin installed (v${after?.plugin?.version ?? "unknown"}). Gateway restarted.` };
|
|
71
|
-
}
|
|
72
|
-
catch (e) {
|
|
73
|
-
return { text: `Install failed: ${e instanceof Error ? e.message : String(e)}`, isError: true };
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
// /dmwork_update
|
|
78
|
-
api.registerCommand({
|
|
79
|
-
name: "dmwork_update",
|
|
80
|
-
description: "Update DMWork plugin to latest version",
|
|
81
|
-
acceptsArgs: false,
|
|
82
|
-
async handler() {
|
|
83
|
-
try {
|
|
84
|
-
const inspect = pluginsInspect(PLUGIN_ID);
|
|
85
|
-
if (!inspect?.plugin) {
|
|
86
|
-
return { text: "DMWork plugin is not installed. Use /dmwork_install first.", isError: true };
|
|
87
|
-
}
|
|
88
|
-
const currentVersion = inspect.plugin.version;
|
|
89
|
-
const targetVersion = execFileSync("npm", ["view", `${PLUGIN_ID}@latest`, "version"], {
|
|
90
|
-
encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"],
|
|
91
|
-
}).trim();
|
|
92
|
-
if (currentVersion === targetVersion) {
|
|
93
|
-
return { text: `Already up to date (v${currentVersion}).` };
|
|
94
|
-
}
|
|
95
|
-
pluginsInstall(`${PLUGIN_ID}@latest`, true, true);
|
|
96
|
-
gatewayRestart(true);
|
|
97
|
-
return { text: `Updated: v${currentVersion} -> v${targetVersion}. Gateway restarted.` };
|
|
98
|
-
}
|
|
99
|
-
catch (e) {
|
|
100
|
-
return { text: `Update failed: ${e instanceof Error ? e.message : String(e)}`, isError: true };
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
// /dmwork_uninstall
|
|
105
|
-
api.registerCommand({
|
|
106
|
-
name: "dmwork_uninstall",
|
|
107
|
-
description: "Uninstall DMWork plugin and remove all bot configs",
|
|
108
|
-
acceptsArgs: false,
|
|
109
|
-
async handler() {
|
|
110
|
-
try {
|
|
111
|
-
removeChannelConfigFromFile();
|
|
112
|
-
pluginsUninstall(PLUGIN_ID, true);
|
|
113
|
-
gatewayRestart(true);
|
|
114
|
-
return { text: "DMWork plugin uninstalled. All bot configs removed." };
|
|
115
|
-
}
|
|
116
|
-
catch (e) {
|
|
117
|
-
return { text: `Uninstall failed: ${e instanceof Error ? e.message : String(e)}`, isError: true };
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
// /dmwork_add_account <account_id> <bot_token> <api_url>
|
|
122
|
-
api.registerCommand({
|
|
123
|
-
name: "dmwork_add_account",
|
|
124
|
-
description: "Add or update a DMWork bot account. Args: <account_id> <bot_token> <api_url>",
|
|
125
|
-
acceptsArgs: true,
|
|
126
|
-
async handler(ctx) {
|
|
127
|
-
const parts = ctx.args?.trim().split(/\s+/) ?? [];
|
|
128
|
-
if (parts.length < 3) {
|
|
129
|
-
return { text: "Usage: /dmwork_add_account <account_id> <bot_token> <api_url>", isError: true };
|
|
130
|
-
}
|
|
131
|
-
const [accountId, botToken, apiUrl] = parts;
|
|
132
|
-
if (!validateAccountId(accountId)) {
|
|
133
|
-
return { text: `Invalid account ID "${accountId}". Only letters, digits, and underscores allowed.`, isError: true };
|
|
134
|
-
}
|
|
135
|
-
if (!botToken.startsWith("bf_")) {
|
|
136
|
-
return { text: "Bot token must start with 'bf_'.", isError: true };
|
|
137
|
-
}
|
|
138
|
-
try {
|
|
139
|
-
const existed = Boolean(configGet(`channels.dmwork.accounts.${accountId}.botToken`));
|
|
140
|
-
configSet(`channels.dmwork.accounts.${accountId}.botToken`, botToken);
|
|
141
|
-
configSet(`channels.dmwork.accounts.${accountId}.apiUrl`, apiUrl);
|
|
142
|
-
const dmScope = configGet("session.dmScope");
|
|
143
|
-
if (!dmScope) {
|
|
144
|
-
configSet("session.dmScope", RECOMMENDED_DM_SCOPE);
|
|
145
|
-
}
|
|
146
|
-
gatewayRestart(true);
|
|
147
|
-
return { text: `${existed ? "Updated" : "Added"} bot account: ${accountId} (API: ${apiUrl}). Gateway restarted.` };
|
|
148
|
-
}
|
|
149
|
-
catch (e) {
|
|
150
|
-
return { text: `Failed: ${e instanceof Error ? e.message : String(e)}`, isError: true };
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
});
|
|
154
|
-
// /dmwork_remove_account <account_id>
|
|
155
|
-
api.registerCommand({
|
|
156
|
-
name: "dmwork_remove_account",
|
|
157
|
-
description: "Remove a DMWork bot account. Args: <account_id>",
|
|
158
|
-
acceptsArgs: true,
|
|
159
|
-
async handler(ctx) {
|
|
160
|
-
const accountId = ctx.args?.trim();
|
|
161
|
-
if (!accountId) {
|
|
162
|
-
return { text: "Usage: /dmwork_remove_account <account_id>", isError: true };
|
|
163
|
-
}
|
|
164
|
-
if (!validateAccountId(accountId)) {
|
|
165
|
-
return { text: `Invalid account ID "${accountId}". Only letters, digits, and underscores allowed.`, isError: true };
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
const token = configGet(`channels.dmwork.accounts.${accountId}.botToken`);
|
|
169
|
-
if (!token) {
|
|
170
|
-
return { text: `Account "${accountId}" does not exist.`, isError: true };
|
|
171
|
-
}
|
|
172
|
-
configUnset(`channels.dmwork.accounts.${accountId}`);
|
|
173
|
-
gatewayRestart(true);
|
|
174
|
-
const remaining = configGetJson("channels.dmwork.accounts");
|
|
175
|
-
const count = remaining ? Object.keys(remaining).length : 0;
|
|
176
|
-
return { text: `Removed account: ${accountId}. ${count} account(s) remaining. Gateway restarted.` };
|
|
177
|
-
}
|
|
178
|
-
catch (e) {
|
|
179
|
-
return { text: `Failed: ${e instanceof Error ? e.message : String(e)}`, isError: true };
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
17
|
console.log('[dmwork] registering before_prompt_build hook');
|
|
184
18
|
api.on('before_prompt_build', (_event, ctx) => {
|
|
185
19
|
const content = getGroupMdForPrompt(ctx);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,MAAM,GAKR;IACF,EAAE,EAAE,yBAAyB;IAC7B,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uDAAuD;IACpE,QAAQ,CAAC,GAAG;QACV,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9B,GAAG,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;QAE9C,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;QAC7D,GAAG,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;YAC5C,MAAM,OAAO,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,CAAC,OAAO;gBAAE,OAAO;YACrB,MAAM,MAAM,GAAG,EAAE,cAAc,EAAE,oBAAoB,OAAO,oBAAoB,EAAE,CAAC;YACnF,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -3,18 +3,13 @@
|
|
|
3
3
|
"version": "0.5.19",
|
|
4
4
|
"description": "DMWork channel plugin for OpenClaw via WuKongIM WebSocket",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"openclaw-channel-dmwork": "bin/dmwork.js"
|
|
8
|
-
},
|
|
9
6
|
"types": "dist/index.d.ts",
|
|
10
7
|
"type": "module",
|
|
11
8
|
"files": [
|
|
12
|
-
"bin",
|
|
13
9
|
"dist",
|
|
14
10
|
"openclaw.plugin.json"
|
|
15
11
|
],
|
|
16
12
|
"scripts": {
|
|
17
|
-
"prebuild": "rm -rf dist",
|
|
18
13
|
"build": "tsc",
|
|
19
14
|
"type-check": "tsc --noEmit",
|
|
20
15
|
"test": "vitest run",
|
|
@@ -22,7 +17,6 @@
|
|
|
22
17
|
},
|
|
23
18
|
"dependencies": {
|
|
24
19
|
"axios": "^1.7.0",
|
|
25
|
-
"commander": "^12.1.0",
|
|
26
20
|
"cos-nodejs-sdk-v5": "^2.15.4",
|
|
27
21
|
"crypto-js": "^4.2.0",
|
|
28
22
|
"curve25519-js": "^0.0.4",
|
package/package.json
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-channel-dmwork",
|
|
3
|
-
"version": "0.5.19
|
|
3
|
+
"version": "0.5.19",
|
|
4
4
|
"description": "DMWork channel plugin for OpenClaw via WuKongIM WebSocket",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"openclaw-channel-dmwork": "bin/dmwork.js"
|
|
8
|
-
},
|
|
9
6
|
"types": "dist/index.d.ts",
|
|
10
7
|
"type": "module",
|
|
11
8
|
"files": [
|
|
12
|
-
"bin",
|
|
13
9
|
"dist",
|
|
14
10
|
"openclaw.plugin.json"
|
|
15
11
|
],
|
|
16
12
|
"scripts": {
|
|
17
|
-
"prebuild": "rm -rf dist",
|
|
18
13
|
"build": "tsc",
|
|
19
14
|
"type-check": "tsc --noEmit",
|
|
20
15
|
"test": "vitest run",
|
|
@@ -22,7 +17,6 @@
|
|
|
22
17
|
},
|
|
23
18
|
"dependencies": {
|
|
24
19
|
"axios": "^1.7.0",
|
|
25
|
-
"commander": "^12.1.0",
|
|
26
20
|
"cos-nodejs-sdk-v5": "^2.15.4",
|
|
27
21
|
"crypto-js": "^4.2.0",
|
|
28
22
|
"curve25519-js": "^0.0.4",
|
package/bin/dmwork.js
DELETED
package/dist/cli/doctor.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* doctor command: diagnose and optionally fix DMWork plugin health.
|
|
3
|
-
*
|
|
4
|
-
* Exports a pure check function reusable from both CLI mode
|
|
5
|
-
* (using openclaw config get) and in-process mode (using ctx.config).
|
|
6
|
-
*/
|
|
7
|
-
export type CheckStatus = "PASS" | "FAIL" | "WARN" | "FIXED";
|
|
8
|
-
export interface CheckResult {
|
|
9
|
-
name: string;
|
|
10
|
-
status: CheckStatus;
|
|
11
|
-
detail: string;
|
|
12
|
-
}
|
|
13
|
-
export interface DoctorResult {
|
|
14
|
-
checks: CheckResult[];
|
|
15
|
-
errors: number;
|
|
16
|
-
warnings: number;
|
|
17
|
-
fixed: number;
|
|
18
|
-
}
|
|
19
|
-
export interface ConfigReader {
|
|
20
|
-
get(path: string): string | null;
|
|
21
|
-
getJson(path: string): any;
|
|
22
|
-
}
|
|
23
|
-
/** CLI mode: reads via openclaw config get */
|
|
24
|
-
export declare const cliConfigReader: ConfigReader;
|
|
25
|
-
/** In-process mode: reads from a config object */
|
|
26
|
-
export declare function inProcessConfigReader(config: any): ConfigReader;
|
|
27
|
-
export declare function runDoctorChecks(params: {
|
|
28
|
-
reader?: ConfigReader;
|
|
29
|
-
accountId?: string;
|
|
30
|
-
inProcess?: boolean;
|
|
31
|
-
fix?: boolean;
|
|
32
|
-
}): Promise<DoctorResult>;
|
|
33
|
-
export declare function formatDoctorResult(result: DoctorResult): string;
|