@claw-manager/openclaw-api-channel 2026.6.27 → 2026.6.28
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/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/index.ts +29 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
import { apiChannelPlugin } from "./src/channel.js";
|
|
1
|
+
import { apiChannelPlugin, dispatchApiMessage } from "./src/channel.js";
|
|
2
|
+
export const API_GATEWAY_METHOD = "claw-manager-api.sendMessage";
|
|
2
3
|
export default {
|
|
3
4
|
id: "claw-manager-api",
|
|
4
5
|
name: "Claw Manager API",
|
|
5
6
|
description: "External API channel for Claw Manager",
|
|
6
7
|
register(api) {
|
|
7
8
|
api.registerChannel({ plugin: apiChannelPlugin });
|
|
9
|
+
api.registerGatewayMethod(API_GATEWAY_METHOD, async ({ params, context, respond }) => {
|
|
10
|
+
try {
|
|
11
|
+
const result = await dispatchApiMessage({
|
|
12
|
+
...(params ?? {}),
|
|
13
|
+
cfg: context.getRuntimeConfig(),
|
|
14
|
+
channelRuntime: api.runtime.channel,
|
|
15
|
+
});
|
|
16
|
+
respond(true, result);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
respond(false, undefined, {
|
|
20
|
+
code: "INVALID_REQUEST",
|
|
21
|
+
message: errorMessage(error),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}, { scope: "operator.admin" });
|
|
8
25
|
},
|
|
9
26
|
};
|
|
27
|
+
function errorMessage(error) {
|
|
28
|
+
if (error instanceof Error && error.message.trim()) {
|
|
29
|
+
return error.message;
|
|
30
|
+
}
|
|
31
|
+
return String(error);
|
|
32
|
+
}
|
|
10
33
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAExE,MAAM,CAAC,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AAEjE,eAAe;IACb,EAAE,EAAE,kBAAkB;IACtB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,uCAAuC;IACpD,QAAQ,CAAC,GAAsB;QAC7B,GAAG,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;QAClD,GAAG,CAAC,qBAAqB,CACvB,kBAAkB,EAClB,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YACrC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC;oBACtC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;oBACjB,GAAG,EAAE,OAAO,CAAC,gBAAgB,EAAE;oBAC/B,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO;iBACpC,CAAC,CAAC;gBACH,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACxB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE;oBACxB,IAAI,EAAE,iBAAiB;oBACvB,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;iBAC7B,CAAC,CAAC;YACL,CAAC;QACH,CAAC,EACD,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAC5B,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
package/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";
|
|
2
2
|
|
|
3
|
-
import { apiChannelPlugin } from "./src/channel.js";
|
|
3
|
+
import { apiChannelPlugin, dispatchApiMessage } from "./src/channel.js";
|
|
4
|
+
|
|
5
|
+
export const API_GATEWAY_METHOD = "claw-manager-api.sendMessage";
|
|
4
6
|
|
|
5
7
|
export default {
|
|
6
8
|
id: "claw-manager-api",
|
|
@@ -8,5 +10,31 @@ export default {
|
|
|
8
10
|
description: "External API channel for Claw Manager",
|
|
9
11
|
register(api: OpenClawPluginApi) {
|
|
10
12
|
api.registerChannel({ plugin: apiChannelPlugin });
|
|
13
|
+
api.registerGatewayMethod(
|
|
14
|
+
API_GATEWAY_METHOD,
|
|
15
|
+
async ({ params, context, respond }) => {
|
|
16
|
+
try {
|
|
17
|
+
const result = await dispatchApiMessage({
|
|
18
|
+
...(params ?? {}),
|
|
19
|
+
cfg: context.getRuntimeConfig(),
|
|
20
|
+
channelRuntime: api.runtime.channel,
|
|
21
|
+
});
|
|
22
|
+
respond(true, result);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
respond(false, undefined, {
|
|
25
|
+
code: "INVALID_REQUEST",
|
|
26
|
+
message: errorMessage(error),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{ scope: "operator.admin" },
|
|
31
|
+
);
|
|
11
32
|
},
|
|
12
33
|
};
|
|
34
|
+
|
|
35
|
+
function errorMessage(error: unknown): string {
|
|
36
|
+
if (error instanceof Error && error.message.trim()) {
|
|
37
|
+
return error.message;
|
|
38
|
+
}
|
|
39
|
+
return String(error);
|
|
40
|
+
}
|
package/openclaw.plugin.json
CHANGED