@cored-im/openclaw-plugin 0.1.15 → 0.1.16
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.cjs +31 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -24
- package/dist/index.js.map +1 -1
- package/dist/setup-entry.cjs +31 -24
- package/dist/setup-entry.cjs.map +1 -1
- package/dist/setup-entry.js +31 -24
- package/dist/setup-entry.js.map +1 -1
- package/openclaw.plugin.json +8 -8
- package/package.json +1 -1
- package/src/channel.ts +36 -25
package/src/channel.ts
CHANGED
|
@@ -5,12 +5,15 @@ import {
|
|
|
5
5
|
createChatChannelPlugin,
|
|
6
6
|
createChannelPluginBase,
|
|
7
7
|
} from "openclaw/plugin-sdk/core";
|
|
8
|
+
import { createHybridChannelConfigBase } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
8
9
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/core";
|
|
9
10
|
import { listAccountIds, resolveAccountConfig } from "./config.js";
|
|
10
11
|
import { sendText } from "./messaging/outbound.js";
|
|
11
12
|
import { parseTarget } from "./targets.js";
|
|
12
13
|
import type { CoredAccountConfig } from "./types.js";
|
|
13
14
|
|
|
15
|
+
const BASE_FIELDS = ["appId", "appSecret", "backendUrl", "enabled", "enableEncryption", "requestTimeout"];
|
|
16
|
+
|
|
14
17
|
export const base = createChannelPluginBase<CoredAccountConfig>({
|
|
15
18
|
id: "cored",
|
|
16
19
|
|
|
@@ -28,37 +31,42 @@ export const base = createChannelPluginBase<CoredAccountConfig>({
|
|
|
28
31
|
},
|
|
29
32
|
|
|
30
33
|
config: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
...createHybridChannelConfigBase<CoredAccountConfig>({
|
|
35
|
+
sectionKey: "cored",
|
|
36
|
+
listAccountIds: (cfg) => listAccountIds(cfg),
|
|
37
|
+
resolveAccount: (cfg, accountId) =>
|
|
38
|
+
resolveAccountConfig(cfg, accountId ?? undefined),
|
|
39
|
+
defaultAccountId: () => "default",
|
|
40
|
+
inspectAccount(cfg, accountId) {
|
|
41
|
+
const resolved = resolveAccountConfig(cfg, accountId ?? undefined);
|
|
42
|
+
const hasConfig = Boolean(
|
|
43
|
+
resolved.appId && resolved.appSecret && resolved.backendUrl,
|
|
44
|
+
);
|
|
45
|
+
return {
|
|
46
|
+
enabled: resolved.enabled,
|
|
47
|
+
configured: hasConfig,
|
|
48
|
+
tokenStatus: hasConfig ? "available" : "missing",
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
clearBaseFields: BASE_FIELDS,
|
|
52
|
+
}),
|
|
45
53
|
},
|
|
46
54
|
|
|
47
55
|
setup: {
|
|
48
56
|
validateInput: ({ input }) => {
|
|
49
57
|
const missing: string[] = [];
|
|
50
|
-
if (!input.appToken) missing.push("--app-token (App ID)");
|
|
51
|
-
if (!input.token) missing.push("--token (App Secret)");
|
|
52
|
-
if (!input.url) missing.push("--url (
|
|
58
|
+
if (!input.appToken) missing.push("--app-token (App ID from Admin Console)");
|
|
59
|
+
if (!input.token) missing.push("--token (App Secret from Admin Console)");
|
|
60
|
+
if (!input.url) missing.push("--url (your Cored server address)");
|
|
53
61
|
if (missing.length > 0) {
|
|
54
62
|
return [
|
|
55
63
|
`Missing required flags: ${missing.join(", ")}`,
|
|
56
64
|
"",
|
|
57
|
-
"
|
|
65
|
+
"Usage:",
|
|
58
66
|
` openclaw channels add --channel cored --app-token <APP_ID> --token <APP_SECRET> --url <BACKEND_URL>`,
|
|
59
67
|
"",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
68
|
+
"You can find App ID and App Secret in:",
|
|
69
|
+
" Cored Admin Console → Workplace → App Management → App Details",
|
|
62
70
|
].join("\n");
|
|
63
71
|
}
|
|
64
72
|
return null;
|
|
@@ -117,7 +125,8 @@ export const base = createChannelPluginBase<CoredAccountConfig>({
|
|
|
117
125
|
preferredEnvVar: "CORED_APP_ID",
|
|
118
126
|
envPrompt: "Use CORED_APP_ID from environment?",
|
|
119
127
|
keepPrompt: "Keep current App ID?",
|
|
120
|
-
inputPrompt:
|
|
128
|
+
inputPrompt:
|
|
129
|
+
"Enter App ID (from Cored Admin Console → Workplace → App Management → App Details):",
|
|
121
130
|
inspect: ({ cfg, accountId }) => {
|
|
122
131
|
const resolved = resolveAccountConfig(cfg, accountId ?? undefined);
|
|
123
132
|
return {
|
|
@@ -133,7 +142,8 @@ export const base = createChannelPluginBase<CoredAccountConfig>({
|
|
|
133
142
|
preferredEnvVar: "CORED_APP_SECRET",
|
|
134
143
|
envPrompt: "Use CORED_APP_SECRET from environment?",
|
|
135
144
|
keepPrompt: "Keep current App Secret?",
|
|
136
|
-
inputPrompt:
|
|
145
|
+
inputPrompt:
|
|
146
|
+
"Enter App Secret (from the same App Details page, keep this value confidential):",
|
|
137
147
|
inspect: ({ cfg, accountId }) => {
|
|
138
148
|
const resolved = resolveAccountConfig(cfg, accountId ?? undefined);
|
|
139
149
|
return {
|
|
@@ -145,11 +155,12 @@ export const base = createChannelPluginBase<CoredAccountConfig>({
|
|
|
145
155
|
{
|
|
146
156
|
inputKey: "url",
|
|
147
157
|
providerHint: "cored",
|
|
148
|
-
credentialLabel: "
|
|
158
|
+
credentialLabel: "Cored Server URL",
|
|
149
159
|
preferredEnvVar: "CORED_BACKEND_URL",
|
|
150
160
|
envPrompt: "Use CORED_BACKEND_URL from environment?",
|
|
151
|
-
keepPrompt: "Keep current
|
|
152
|
-
inputPrompt:
|
|
161
|
+
keepPrompt: "Keep current Cored Server URL?",
|
|
162
|
+
inputPrompt:
|
|
163
|
+
"Enter your Cored server address (e.g. http://192.168.10.10:21000):",
|
|
153
164
|
inspect: ({ cfg, accountId }) => {
|
|
154
165
|
const resolved = resolveAccountConfig(cfg, accountId ?? undefined);
|
|
155
166
|
return {
|