@openclaw/line 2026.7.2-beta.4 → 2026.7.2-beta.7
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 +1 -1
- package/dist/accounts-BqEVsDoB.js +103 -0
- package/dist/api.js +2 -2
- package/dist/{card-command-Ch0TwcDW.js → card-command-ty11OJNt.js} +1 -2
- package/dist/{channel-CNcv74n2.js → channel-D4i_K4fQ.js} +9 -9
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-BdhK8Xw7.js +4 -0
- package/dist/contract-api.js +1 -1
- package/dist/flex-templates-iKJsyCq-.js +1339 -0
- package/dist/index.js +1 -1
- package/dist/{markdown-to-line-DWIdzBfy.js → markdown-to-line-DMDQTMhx.js} +27 -12
- package/dist/{monitor-BinAXvIY.js → monitor-DXEodYFJ.js} +63 -106
- package/dist/monitor.runtime-CZquR7jI.js +2 -0
- package/dist/{outbound.runtime-DRyoVa81.js → outbound.runtime-BS0IhU_M.js} +1 -1
- package/dist/{probe-BslD77tJ.js → probe-CM03wo6r.js} +7 -9
- package/dist/probe.runtime-D13ZtXsd.js +2 -0
- package/dist/{reply-payload-transform-d57WYHFm.js → reply-payload-transform-D5-dHB8b.js} +1 -1
- package/dist/runtime-api.js +9 -9
- package/dist/setup-api.js +1 -1
- package/dist/{setup-surface-Bili5gWy.js → setup-surface-DRQ7n0En.js} +93 -129
- package/package.json +4 -5
- package/dist/accounts-BUBOoW5Q.js +0 -169
- package/dist/basic-cards-Rb-Ow7LN.js +0 -307
- package/dist/channel.runtime-BBCZvRa_.js +0 -4
- package/dist/flex-templates-KiKaVYgi.js +0 -813
- package/dist/monitor.runtime-DKj4FHkA.js +0 -2
- package/dist/probe.runtime-CRhVGqwl.js +0 -2
- package/npm-shrinkwrap.json +0 -60
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/LICENSE +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/README.md +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/assert/strict.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/assert.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/async_hooks.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/buffer.buffer.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/buffer.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/child_process.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/cluster.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/compatibility/iterators.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/console.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/constants.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/crypto.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/dgram.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/diagnostics_channel.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/dns/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/dns.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/domain.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/events.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/fs/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/fs.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/globals.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/globals.typedarray.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/http.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/http2.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/https.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/index.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/inspector.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/inspector.generated.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/module.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/net.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/os.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/package.json +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/path.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/perf_hooks.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/process.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/punycode.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/querystring.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/readline/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/readline.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/repl.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/sea.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/sqlite.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream/consumers.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream/web.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/string_decoder.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/test.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/timers/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/timers.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/tls.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/trace_events.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/buffer.buffer.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/compatibility/float16array.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/globals.typedarray.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/index.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.7/compatibility/float16array.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.7/index.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/tty.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/url.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/util.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/v8.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/vm.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/wasi.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/abortcontroller.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/crypto.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/domexception.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/events.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/fetch.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/navigator.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/storage.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/streams.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/worker_threads.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/zlib.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/LICENSE +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/README.md +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/api.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/balanced-pool.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/cache-interceptor.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/cache.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/client-stats.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/client.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/connector.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/content-type.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/cookies.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/diagnostics-channel.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/dispatcher.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/env-http-proxy-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/errors.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/eventsource.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/fetch.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/formdata.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/global-dispatcher.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/global-origin.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/h2c-client.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/handlers.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/header.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/index.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/interceptors.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-call-history.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-client.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-errors.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-interceptor.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-pool.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/package.json +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/patch.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/pool-stats.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/pool.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/proxy-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/readable.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/retry-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/retry-handler.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/round-robin-pool.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/snapshot-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/util.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/utility.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/webidl.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/websocket.d.ts +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-
|
|
1
|
+
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-BqEVsDoB.js";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
4
|
-
import { DEFAULT_ACCOUNT_ID, createAllowFromSection, createSetupInputPresenceValidator, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, formatDocsLink,
|
|
4
|
+
import { DEFAULT_ACCOUNT_ID, createAllowFromSection, createPromptParsedAllowFromForAccount, createSetupInputPresenceValidator, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, formatDocsLink, parseSetupEntriesWithParser, patchScopedAccountConfig, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
5
|
+
import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
|
|
5
6
|
//#region extensions/line/src/account-helpers.ts
|
|
6
7
|
function hasLineCredentials(account) {
|
|
7
8
|
if (account.tokenStatus && account.signingSecretStatus) return account.tokenStatus !== "missing" && account.signingSecretStatus !== "missing";
|
|
@@ -15,44 +16,19 @@ function parseLineAllowFromId(raw) {
|
|
|
15
16
|
//#endregion
|
|
16
17
|
//#region extensions/line/src/setup-core.ts
|
|
17
18
|
function patchLineAccountConfig(params) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
...params.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...params.patch
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
const nextAccount = { ...lineConfig.accounts?.[accountId] };
|
|
37
|
-
for (const field of clearFields) delete nextAccount[field];
|
|
38
|
-
return {
|
|
39
|
-
...params.cfg,
|
|
40
|
-
channels: {
|
|
41
|
-
...params.cfg.channels,
|
|
42
|
-
line: {
|
|
43
|
-
...lineConfig,
|
|
44
|
-
...params.enabled ? { enabled: true } : {},
|
|
45
|
-
accounts: {
|
|
46
|
-
...lineConfig.accounts,
|
|
47
|
-
[accountId]: {
|
|
48
|
-
...nextAccount,
|
|
49
|
-
...params.enabled ? { enabled: true } : {},
|
|
50
|
-
...params.patch
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
19
|
+
return patchScopedAccountConfig({
|
|
20
|
+
cfg: params.cfg,
|
|
21
|
+
channelKey: "line",
|
|
22
|
+
accountId: params.accountId,
|
|
23
|
+
patch: params.patch,
|
|
24
|
+
accountPatch: {
|
|
25
|
+
...params.enabled ? { enabled: true } : {},
|
|
26
|
+
...params.patch
|
|
27
|
+
},
|
|
28
|
+
...params.clearFields ? { clearFields: params.clearFields } : {},
|
|
29
|
+
ensureChannelEnabled: Boolean(params.enabled),
|
|
30
|
+
ensureAccountEnabled: false
|
|
31
|
+
});
|
|
56
32
|
}
|
|
57
33
|
function isLineConfigured(cfg, accountId) {
|
|
58
34
|
return hasLineCredentials(resolveLineAccount({
|
|
@@ -85,26 +61,18 @@ const lineSetupAdapter = {
|
|
|
85
61
|
const typedInput = input;
|
|
86
62
|
const accessToken = typedInput.channelAccessToken ?? typedInput.token;
|
|
87
63
|
const normalizedAccountId = normalizeAccountId(accountId);
|
|
88
|
-
|
|
64
|
+
const useEnv = normalizedAccountId === DEFAULT_ACCOUNT_ID && Boolean(typedInput.useEnv);
|
|
65
|
+
return patchLineAccountConfig({
|
|
89
66
|
cfg,
|
|
90
67
|
accountId: normalizedAccountId,
|
|
91
68
|
enabled: true,
|
|
92
|
-
clearFields:
|
|
69
|
+
clearFields: useEnv ? [
|
|
93
70
|
"channelAccessToken",
|
|
94
71
|
"channelSecret",
|
|
95
72
|
"tokenFile",
|
|
96
73
|
"secretFile"
|
|
97
74
|
] : void 0,
|
|
98
|
-
patch:
|
|
99
|
-
...typedInput.tokenFile ? { tokenFile: typedInput.tokenFile } : accessToken ? { channelAccessToken: accessToken } : {},
|
|
100
|
-
...typedInput.secretFile ? { secretFile: typedInput.secretFile } : typedInput.channelSecret ? { channelSecret: typedInput.channelSecret } : {}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
return patchLineAccountConfig({
|
|
104
|
-
cfg,
|
|
105
|
-
accountId: normalizedAccountId,
|
|
106
|
-
enabled: true,
|
|
107
|
-
patch: {
|
|
75
|
+
patch: useEnv ? {} : {
|
|
108
76
|
...typedInput.tokenFile ? { tokenFile: typedInput.tokenFile } : accessToken ? { channelAccessToken: accessToken } : {},
|
|
109
77
|
...typedInput.secretFile ? { secretFile: typedInput.secretFile } : typedInput.channelSecret ? { channelSecret: typedInput.channelSecret } : {}
|
|
110
78
|
}
|
|
@@ -183,36 +151,78 @@ const LINE_ALLOW_FROM_HELP_LINES = [
|
|
|
183
151
|
t("wizard.line.multipleEntries"),
|
|
184
152
|
t("wizard.channels.docs", { link: formatDocsLink("/channels/line", "channels/line") })
|
|
185
153
|
];
|
|
186
|
-
const lineDmPolicy = {
|
|
154
|
+
const lineDmPolicy = createChannelDmPolicy({
|
|
187
155
|
label: "LINE",
|
|
188
156
|
channel,
|
|
189
|
-
|
|
190
|
-
allowFromKey: "channels.line.allowFrom",
|
|
191
|
-
resolveConfigKeys: (cfg, accountId) => (accountId ?? resolveDefaultLineAccountId(cfg)) !== DEFAULT_ACCOUNT_ID ? {
|
|
192
|
-
policyKey: `channels.line.accounts.${accountId ?? resolveDefaultLineAccountId(cfg)}.dmPolicy`,
|
|
193
|
-
allowFromKey: `channels.line.accounts.${accountId ?? resolveDefaultLineAccountId(cfg)}.allowFrom`
|
|
194
|
-
} : {
|
|
195
|
-
policyKey: "channels.line.dmPolicy",
|
|
196
|
-
allowFromKey: "channels.line.allowFrom"
|
|
197
|
-
},
|
|
198
|
-
getCurrent: (cfg, accountId) => resolveLineAccount({
|
|
157
|
+
resolveAccount: (cfg, accountId) => resolveLineAccount({
|
|
199
158
|
cfg,
|
|
200
159
|
accountId: accountId ?? resolveDefaultLineAccountId(cfg)
|
|
201
|
-
})
|
|
202
|
-
|
|
160
|
+
}),
|
|
161
|
+
applyPatch: ({ cfg, account, patch }) => patchLineAccountConfig({
|
|
203
162
|
cfg,
|
|
204
|
-
accountId: accountId
|
|
163
|
+
accountId: account.accountId,
|
|
205
164
|
enabled: true,
|
|
206
|
-
patch
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
165
|
+
patch,
|
|
166
|
+
clearFields: patch.dmPolicy === "pairing" || patch.dmPolicy === "disabled" ? ["allowFrom"] : void 0
|
|
167
|
+
}),
|
|
168
|
+
promptAllowFrom: createPromptParsedAllowFromForAccount({
|
|
169
|
+
defaultAccountId: resolveDefaultLineAccountId,
|
|
170
|
+
noteTitle: t("wizard.line.allowlistTitle"),
|
|
171
|
+
noteLines: LINE_ALLOW_FROM_HELP_LINES,
|
|
172
|
+
message: t("wizard.line.allowFromPrompt"),
|
|
173
|
+
placeholder: "U1234567890abcdef1234567890abcdef",
|
|
174
|
+
parseEntries: (raw) => parseSetupEntriesWithParser(raw, (entry) => {
|
|
175
|
+
const id = parseLineAllowFromId(entry);
|
|
176
|
+
return id ? { value: id } : { error: t("wizard.line.allowFromInvalid") };
|
|
177
|
+
}),
|
|
178
|
+
getExistingAllowFrom: ({ cfg, accountId }) => resolveLineAccount({
|
|
179
|
+
cfg,
|
|
180
|
+
accountId
|
|
181
|
+
}).config.allowFrom ?? [],
|
|
182
|
+
applyAllowFrom: ({ cfg, accountId, allowFrom }) => patchLineAccountConfig({
|
|
183
|
+
cfg,
|
|
184
|
+
accountId,
|
|
185
|
+
enabled: true,
|
|
186
|
+
patch: { allowFrom }
|
|
187
|
+
})
|
|
214
188
|
})
|
|
215
|
-
};
|
|
189
|
+
});
|
|
190
|
+
function createLineTokenCredential(params) {
|
|
191
|
+
return defineTokenCredential({
|
|
192
|
+
inputKey: params.inputKey,
|
|
193
|
+
configKey: params.configKey,
|
|
194
|
+
configuredFields: [params.configKey, params.fileKey],
|
|
195
|
+
providerHint: params.providerHint,
|
|
196
|
+
credentialLabel: params.credentialLabel,
|
|
197
|
+
preferredEnvVar: params.envVar,
|
|
198
|
+
helpTitle: t("wizard.line.messagingApiTitle"),
|
|
199
|
+
helpLines: LINE_SETUP_HELP_LINES,
|
|
200
|
+
envPrompt: params.envPrompt,
|
|
201
|
+
keepPrompt: params.keepPrompt,
|
|
202
|
+
inputPrompt: params.inputPrompt,
|
|
203
|
+
allowEnv: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID,
|
|
204
|
+
resolveAccount: ({ cfg, accountId }) => resolveLineAccount({
|
|
205
|
+
cfg,
|
|
206
|
+
accountId
|
|
207
|
+
}),
|
|
208
|
+
accountConfigured: (account) => Boolean(normalizeOptionalString(account.channelAccessToken) && normalizeOptionalString(account.channelSecret)),
|
|
209
|
+
hasConfiguredValue: (account) => Boolean(normalizeOptionalString(account.config[params.configKey]) ?? normalizeOptionalString(account.config[params.fileKey])),
|
|
210
|
+
resolvedValue: (account) => normalizeOptionalString(account[params.configKey]),
|
|
211
|
+
envValue: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID ? normalizeOptionalString(process.env[params.envVar]) : void 0,
|
|
212
|
+
patchAccount: ({ cfg, accountId, patch, clearFields }) => patchLineAccountConfig({
|
|
213
|
+
cfg,
|
|
214
|
+
accountId,
|
|
215
|
+
enabled: true,
|
|
216
|
+
clearFields,
|
|
217
|
+
patch
|
|
218
|
+
}),
|
|
219
|
+
useEnv: { clearFields: [params.configKey, params.fileKey] },
|
|
220
|
+
set: {
|
|
221
|
+
clearFields: [params.fileKey],
|
|
222
|
+
value: "resolved"
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
216
226
|
const lineSetupWizard = {
|
|
217
227
|
channel,
|
|
218
228
|
status: createStandardChannelSetupStatus({
|
|
@@ -232,72 +242,26 @@ const lineSetupWizard = {
|
|
|
232
242
|
lines: LINE_SETUP_HELP_LINES,
|
|
233
243
|
shouldShow: ({ cfg, accountId }) => !isLineConfigured(cfg, accountId ?? resolveDefaultLineAccountId(cfg))
|
|
234
244
|
},
|
|
235
|
-
credentials: [
|
|
245
|
+
credentials: [createLineTokenCredential({
|
|
236
246
|
inputKey: "token",
|
|
237
247
|
configKey: "channelAccessToken",
|
|
238
|
-
|
|
248
|
+
fileKey: "tokenFile",
|
|
239
249
|
providerHint: channel,
|
|
240
250
|
credentialLabel: t("wizard.line.channelAccessToken"),
|
|
241
|
-
|
|
242
|
-
helpTitle: t("wizard.line.messagingApiTitle"),
|
|
243
|
-
helpLines: LINE_SETUP_HELP_LINES,
|
|
251
|
+
envVar: "LINE_CHANNEL_ACCESS_TOKEN",
|
|
244
252
|
envPrompt: t("wizard.line.tokenEnvPrompt"),
|
|
245
253
|
keepPrompt: t("wizard.line.tokenKeepPrompt"),
|
|
246
|
-
inputPrompt: t("wizard.line.tokenInputPrompt")
|
|
247
|
-
|
|
248
|
-
resolveAccount: ({ cfg, accountId }) => resolveLineAccount({
|
|
249
|
-
cfg,
|
|
250
|
-
accountId
|
|
251
|
-
}),
|
|
252
|
-
accountConfigured: (account) => Boolean(normalizeOptionalString(account.channelAccessToken) && normalizeOptionalString(account.channelSecret)),
|
|
253
|
-
hasConfiguredValue: (account) => Boolean(normalizeOptionalString(account.config.channelAccessToken) ?? normalizeOptionalString(account.config.tokenFile)),
|
|
254
|
-
resolvedValue: (account) => normalizeOptionalString(account.channelAccessToken),
|
|
255
|
-
envValue: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID ? normalizeOptionalString(process.env.LINE_CHANNEL_ACCESS_TOKEN) : void 0,
|
|
256
|
-
patchAccount: ({ cfg, accountId, patch, clearFields }) => patchLineAccountConfig({
|
|
257
|
-
cfg,
|
|
258
|
-
accountId,
|
|
259
|
-
enabled: true,
|
|
260
|
-
clearFields,
|
|
261
|
-
patch
|
|
262
|
-
}),
|
|
263
|
-
useEnv: { clearFields: ["channelAccessToken", "tokenFile"] },
|
|
264
|
-
set: {
|
|
265
|
-
clearFields: ["tokenFile"],
|
|
266
|
-
value: "resolved"
|
|
267
|
-
}
|
|
268
|
-
}), defineTokenCredential({
|
|
254
|
+
inputPrompt: t("wizard.line.tokenInputPrompt")
|
|
255
|
+
}), createLineTokenCredential({
|
|
269
256
|
inputKey: "password",
|
|
270
257
|
configKey: "channelSecret",
|
|
271
|
-
|
|
258
|
+
fileKey: "secretFile",
|
|
272
259
|
providerHint: "line-secret",
|
|
273
260
|
credentialLabel: t("wizard.line.channelSecret"),
|
|
274
|
-
|
|
275
|
-
helpTitle: t("wizard.line.messagingApiTitle"),
|
|
276
|
-
helpLines: LINE_SETUP_HELP_LINES,
|
|
261
|
+
envVar: "LINE_CHANNEL_SECRET",
|
|
277
262
|
envPrompt: t("wizard.line.secretEnvPrompt"),
|
|
278
263
|
keepPrompt: t("wizard.line.secretKeepPrompt"),
|
|
279
|
-
inputPrompt: t("wizard.line.secretInputPrompt")
|
|
280
|
-
allowEnv: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID,
|
|
281
|
-
resolveAccount: ({ cfg, accountId }) => resolveLineAccount({
|
|
282
|
-
cfg,
|
|
283
|
-
accountId
|
|
284
|
-
}),
|
|
285
|
-
accountConfigured: (account) => Boolean(normalizeOptionalString(account.channelAccessToken) && normalizeOptionalString(account.channelSecret)),
|
|
286
|
-
hasConfiguredValue: (account) => Boolean(normalizeOptionalString(account.config.channelSecret) ?? normalizeOptionalString(account.config.secretFile)),
|
|
287
|
-
resolvedValue: (account) => normalizeOptionalString(account.channelSecret),
|
|
288
|
-
envValue: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID ? normalizeOptionalString(process.env.LINE_CHANNEL_SECRET) : void 0,
|
|
289
|
-
patchAccount: ({ cfg, accountId, patch, clearFields }) => patchLineAccountConfig({
|
|
290
|
-
cfg,
|
|
291
|
-
accountId,
|
|
292
|
-
enabled: true,
|
|
293
|
-
clearFields,
|
|
294
|
-
patch
|
|
295
|
-
}),
|
|
296
|
-
useEnv: { clearFields: ["channelSecret", "secretFile"] },
|
|
297
|
-
set: {
|
|
298
|
-
clearFields: ["secretFile"],
|
|
299
|
-
value: "resolved"
|
|
300
|
-
}
|
|
264
|
+
inputPrompt: t("wizard.line.secretInputPrompt")
|
|
301
265
|
})],
|
|
302
266
|
allowFrom: createAllowFromSection({
|
|
303
267
|
helpTitle: t("wizard.line.allowlistTitle"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/line",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.7",
|
|
4
4
|
"description": "OpenClaw LINE channel plugin for LINE Bot API chats.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.7.2-beta.
|
|
15
|
+
"openclaw": ">=2026.7.2-beta.7"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
"minHostVersion": ">=2026.4.10"
|
|
108
108
|
},
|
|
109
109
|
"compat": {
|
|
110
|
-
"pluginApi": ">=2026.7.2-beta.
|
|
110
|
+
"pluginApi": ">=2026.7.2-beta.7"
|
|
111
111
|
},
|
|
112
112
|
"build": {
|
|
113
|
-
"openclawVersion": "2026.7.2-beta.
|
|
113
|
+
"openclawVersion": "2026.7.2-beta.7"
|
|
114
114
|
},
|
|
115
115
|
"release": {
|
|
116
116
|
"publishToClawHub": true,
|
|
@@ -124,7 +124,6 @@
|
|
|
124
124
|
"files": [
|
|
125
125
|
"dist/**",
|
|
126
126
|
"openclaw.plugin.json",
|
|
127
|
-
"npm-shrinkwrap.json",
|
|
128
127
|
"README.md"
|
|
129
128
|
],
|
|
130
129
|
"bundledDependencies": [
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
2
|
-
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-resolution";
|
|
3
|
-
import { tryReadSecretFileSync } from "openclaw/plugin-sdk/secret-file-runtime";
|
|
4
|
-
//#region extensions/line/src/accounts.ts
|
|
5
|
-
function readCredentialFile(filePath, configPath) {
|
|
6
|
-
return tryReadSecretFileSync(filePath, "LINE credential file", { rejectSymlink: true }, { configPath });
|
|
7
|
-
}
|
|
8
|
-
function resolveToken(params) {
|
|
9
|
-
const { accountId, baseConfig, accountConfig } = params;
|
|
10
|
-
if (accountConfig?.channelAccessToken?.trim()) return {
|
|
11
|
-
value: accountConfig.channelAccessToken.trim(),
|
|
12
|
-
source: "config",
|
|
13
|
-
status: "available"
|
|
14
|
-
};
|
|
15
|
-
if (accountConfig?.tokenFile?.trim()) {
|
|
16
|
-
const result = readCredentialFile(accountConfig.tokenFile, `channels.line.accounts.${accountId}.tokenFile`);
|
|
17
|
-
return result.status === "available" ? {
|
|
18
|
-
value: result.value,
|
|
19
|
-
source: "file",
|
|
20
|
-
status: "available"
|
|
21
|
-
} : {
|
|
22
|
-
value: "",
|
|
23
|
-
source: "file",
|
|
24
|
-
status: "configured_unavailable",
|
|
25
|
-
diagnostic: result.diagnostic
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
29
|
-
if (baseConfig?.channelAccessToken?.trim()) return {
|
|
30
|
-
value: baseConfig.channelAccessToken.trim(),
|
|
31
|
-
source: "config",
|
|
32
|
-
status: "available"
|
|
33
|
-
};
|
|
34
|
-
if (baseConfig?.tokenFile?.trim()) {
|
|
35
|
-
const result = readCredentialFile(baseConfig.tokenFile, "channels.line.tokenFile");
|
|
36
|
-
return result.status === "available" ? {
|
|
37
|
-
value: result.value,
|
|
38
|
-
source: "file",
|
|
39
|
-
status: "available"
|
|
40
|
-
} : {
|
|
41
|
-
value: "",
|
|
42
|
-
source: "file",
|
|
43
|
-
status: "configured_unavailable",
|
|
44
|
-
diagnostic: result.diagnostic
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const envToken = process.env.LINE_CHANNEL_ACCESS_TOKEN?.trim();
|
|
48
|
-
if (envToken) return {
|
|
49
|
-
value: envToken,
|
|
50
|
-
source: "env",
|
|
51
|
-
status: "available"
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
value: "",
|
|
56
|
-
source: "none",
|
|
57
|
-
status: "missing"
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function resolveSecret(params) {
|
|
61
|
-
const { accountId, baseConfig, accountConfig } = params;
|
|
62
|
-
if (accountConfig?.channelSecret?.trim()) return {
|
|
63
|
-
value: accountConfig.channelSecret.trim(),
|
|
64
|
-
source: "config",
|
|
65
|
-
status: "available"
|
|
66
|
-
};
|
|
67
|
-
if (accountConfig?.secretFile?.trim()) {
|
|
68
|
-
const result = readCredentialFile(accountConfig.secretFile, `channels.line.accounts.${accountId}.secretFile`);
|
|
69
|
-
return result.status === "available" ? {
|
|
70
|
-
value: result.value,
|
|
71
|
-
source: "file",
|
|
72
|
-
status: "available"
|
|
73
|
-
} : {
|
|
74
|
-
value: "",
|
|
75
|
-
source: "file",
|
|
76
|
-
status: "configured_unavailable",
|
|
77
|
-
diagnostic: result.diagnostic
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
81
|
-
if (baseConfig?.channelSecret?.trim()) return {
|
|
82
|
-
value: baseConfig.channelSecret.trim(),
|
|
83
|
-
source: "config",
|
|
84
|
-
status: "available"
|
|
85
|
-
};
|
|
86
|
-
if (baseConfig?.secretFile?.trim()) {
|
|
87
|
-
const result = readCredentialFile(baseConfig.secretFile, "channels.line.secretFile");
|
|
88
|
-
return result.status === "available" ? {
|
|
89
|
-
value: result.value,
|
|
90
|
-
source: "file",
|
|
91
|
-
status: "available"
|
|
92
|
-
} : {
|
|
93
|
-
value: "",
|
|
94
|
-
source: "file",
|
|
95
|
-
status: "configured_unavailable",
|
|
96
|
-
diagnostic: result.diagnostic
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
const envSecret = process.env.LINE_CHANNEL_SECRET?.trim();
|
|
100
|
-
if (envSecret) return {
|
|
101
|
-
value: envSecret,
|
|
102
|
-
source: "env",
|
|
103
|
-
status: "available"
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
value: "",
|
|
108
|
-
source: "none",
|
|
109
|
-
status: "missing"
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
function resolveLineAccount(params) {
|
|
113
|
-
const cfg = params.cfg;
|
|
114
|
-
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultLineAccountId(cfg));
|
|
115
|
-
const lineConfig = cfg.channels?.line;
|
|
116
|
-
const accounts = lineConfig?.accounts;
|
|
117
|
-
const accountConfig = resolveAccountEntry(accounts, accountId);
|
|
118
|
-
const token = resolveToken({
|
|
119
|
-
accountId,
|
|
120
|
-
baseConfig: lineConfig,
|
|
121
|
-
accountConfig
|
|
122
|
-
});
|
|
123
|
-
const secret = resolveSecret({
|
|
124
|
-
accountId,
|
|
125
|
-
baseConfig: lineConfig,
|
|
126
|
-
accountConfig
|
|
127
|
-
});
|
|
128
|
-
const { accounts: _ignoredAccounts, defaultAccount: _ignoredDefaultAccount, ...lineBase } = lineConfig ?? {};
|
|
129
|
-
const mergedConfig = {
|
|
130
|
-
...lineBase,
|
|
131
|
-
...accountConfig
|
|
132
|
-
};
|
|
133
|
-
const baseEnabled = lineConfig?.enabled !== false;
|
|
134
|
-
const accountEnabled = accountConfig?.enabled !== false;
|
|
135
|
-
const enabled = baseEnabled && accountEnabled;
|
|
136
|
-
return {
|
|
137
|
-
accountId,
|
|
138
|
-
name: accountConfig?.name ?? (accountId === DEFAULT_ACCOUNT_ID ? lineConfig?.name : void 0),
|
|
139
|
-
enabled,
|
|
140
|
-
channelAccessToken: token.value,
|
|
141
|
-
channelSecret: secret.value,
|
|
142
|
-
tokenSource: token.source,
|
|
143
|
-
signingSecretSource: secret.source,
|
|
144
|
-
tokenStatus: token.status,
|
|
145
|
-
signingSecretStatus: secret.status,
|
|
146
|
-
...[token.diagnostic, secret.diagnostic].some(Boolean) ? { credentialDiagnostics: [token.diagnostic, secret.diagnostic].filter((diagnostic) => Boolean(diagnostic)) } : {},
|
|
147
|
-
config: mergedConfig
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
function listLineAccountIds(cfg) {
|
|
151
|
-
const lineConfig = cfg.channels?.line;
|
|
152
|
-
const accounts = lineConfig?.accounts;
|
|
153
|
-
const ids = /* @__PURE__ */ new Set();
|
|
154
|
-
if (lineConfig?.channelAccessToken?.trim() || lineConfig?.tokenFile || process.env.LINE_CHANNEL_ACCESS_TOKEN?.trim()) ids.add(DEFAULT_ACCOUNT_ID);
|
|
155
|
-
if (accounts) for (const id of Object.keys(accounts)) ids.add(id);
|
|
156
|
-
return Array.from(ids);
|
|
157
|
-
}
|
|
158
|
-
function resolveDefaultLineAccountId(cfg) {
|
|
159
|
-
const preferred = normalizeOptionalAccountId((cfg.channels?.line)?.defaultAccount);
|
|
160
|
-
if (preferred && listLineAccountIds(cfg).some((accountId) => normalizeAccountId(accountId) === preferred)) return preferred;
|
|
161
|
-
const ids = listLineAccountIds(cfg);
|
|
162
|
-
if (ids.includes(DEFAULT_ACCOUNT_ID)) return DEFAULT_ACCOUNT_ID;
|
|
163
|
-
return ids[0] ?? DEFAULT_ACCOUNT_ID;
|
|
164
|
-
}
|
|
165
|
-
function normalizeAccountId$1(accountId) {
|
|
166
|
-
return normalizeAccountId(accountId);
|
|
167
|
-
}
|
|
168
|
-
//#endregion
|
|
169
|
-
export { resolveLineAccount as i, normalizeAccountId$1 as n, resolveDefaultLineAccountId as r, listLineAccountIds as t };
|