@openclaw/twitch 2026.11.3 → 2026.11.5-beta.2
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/.setup/{monitor-B-jILw-H.mjs → monitor-BStOwZKj.mjs} +92 -182
- package/dist/.setup/{plugin-CkRhClVg.mjs → plugin-D_NszQlS.mjs} +495 -340
- package/dist/.setup/setup-plugin-api-Czqbbgip.mjs +2 -0
- package/dist/.setup/{setup-surface-BHuTmMZL.mjs → setup-surface-DuCk_ZHo.mjs} +78 -91
- package/dist/.source-module-urls/e92ae748f4a308f6cf1a5ef62518f7ba0627945de435d928747fa07ea1b4421f.json +1 -0
- package/dist/api.js +1 -3
- package/dist/channel-plugin-api.js +1 -2
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -2
- package/package.json +5 -5
- package/dist/.setup/runtime-B5If4b0g.mjs +0 -8
- package/dist/.setup/setup-plugin-api-BC-Kt0o_.mjs +0 -3
|
@@ -13,27 +13,18 @@ function normalizeTwitchToken(raw) {
|
|
|
13
13
|
if (!trimmed) return;
|
|
14
14
|
return trimmed.startsWith("oauth:") ? trimmed : `oauth:${trimmed}`;
|
|
15
15
|
}
|
|
16
|
-
function resolveTwitchToken(cfg,
|
|
17
|
-
const accountId = normalizeAccountId(
|
|
16
|
+
function resolveTwitchToken(cfg, accountIdInput) {
|
|
17
|
+
const accountId = normalizeAccountId(accountIdInput);
|
|
18
18
|
const twitchCfg = cfg?.channels?.twitch;
|
|
19
19
|
const accounts = twitchCfg?.accounts;
|
|
20
20
|
const accountCfg = resolveNormalizedAccountEntry(accounts, accountId, normalizeAccountId);
|
|
21
21
|
let token;
|
|
22
22
|
if (accountId === DEFAULT_ACCOUNT_ID) token = normalizeTwitchToken((typeof twitchCfg?.accessToken === "string" ? twitchCfg.accessToken : void 0) || accountCfg?.accessToken);
|
|
23
23
|
else token = normalizeTwitchToken(accountCfg?.accessToken);
|
|
24
|
-
if (token) return {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
const envToken = accountId === DEFAULT_ACCOUNT_ID ? normalizeTwitchToken(opts.envToken ?? process.env.OPENCLAW_TWITCH_ACCESS_TOKEN) : void 0;
|
|
29
|
-
if (envToken) return {
|
|
30
|
-
token: envToken,
|
|
31
|
-
source: "env"
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
token: "",
|
|
35
|
-
source: "none"
|
|
36
|
-
};
|
|
24
|
+
if (token) return { token };
|
|
25
|
+
const envToken = accountId === DEFAULT_ACCOUNT_ID ? normalizeTwitchToken(process.env.OPENCLAW_TWITCH_ACCESS_TOKEN) : void 0;
|
|
26
|
+
if (envToken) return { token: envToken };
|
|
27
|
+
return { token: "" };
|
|
37
28
|
}
|
|
38
29
|
//#endregion
|
|
39
30
|
//#region extensions/twitch/src/utils/twitch.ts
|
|
@@ -96,11 +87,10 @@ function getAccountConfig(coreConfig, accountId) {
|
|
|
96
87
|
function resolveTwitchAccountContext(cfg, accountId) {
|
|
97
88
|
const resolvedAccountId = accountId?.trim() ? normalizeAccountId(accountId) : resolveDefaultTwitchAccountId(cfg);
|
|
98
89
|
const account = getAccountConfig(cfg, resolvedAccountId);
|
|
99
|
-
const tokenResolution = resolveTwitchToken(cfg,
|
|
90
|
+
const tokenResolution = resolveTwitchToken(cfg, resolvedAccountId);
|
|
100
91
|
return {
|
|
101
92
|
accountId: resolvedAccountId,
|
|
102
93
|
account,
|
|
103
|
-
tokenResolution,
|
|
104
94
|
configured: account ? isAccountConfigured(account, tokenResolution.token) : false,
|
|
105
95
|
availableAccountIds: listAccountIds(cfg)
|
|
106
96
|
};
|
|
@@ -178,35 +168,6 @@ function setTwitchAccount(cfg, account, accountId = resolveSetupAccountId(cfg))
|
|
|
178
168
|
} }
|
|
179
169
|
});
|
|
180
170
|
}
|
|
181
|
-
async function noteTwitchSetupHelp(prompter) {
|
|
182
|
-
await prompter.note([
|
|
183
|
-
t("wizard.twitch.helpRequiresBot"),
|
|
184
|
-
t("wizard.twitch.helpCreateApp"),
|
|
185
|
-
t("wizard.twitch.helpGenerateToken"),
|
|
186
|
-
t("wizard.twitch.helpTokenTools"),
|
|
187
|
-
t("wizard.twitch.helpCopyToken"),
|
|
188
|
-
t("wizard.twitch.helpEnvVars"),
|
|
189
|
-
`Docs: ${formatDocsLink("/channels/twitch", "channels/twitch")}`
|
|
190
|
-
].join("\n"), t("wizard.twitch.setupTitle"));
|
|
191
|
-
}
|
|
192
|
-
async function promptToken(prompter, account) {
|
|
193
|
-
const existingToken = account?.accessToken ?? "";
|
|
194
|
-
if (existingToken) {
|
|
195
|
-
if (await prompter.confirm({
|
|
196
|
-
message: t("wizard.twitch.accessTokenKeep"),
|
|
197
|
-
initialValue: true
|
|
198
|
-
})) return existingToken;
|
|
199
|
-
}
|
|
200
|
-
return (await prompter.text({
|
|
201
|
-
message: t("wizard.twitch.oauthTokenPrompt"),
|
|
202
|
-
sensitive: true,
|
|
203
|
-
validate: (value) => {
|
|
204
|
-
const raw = value?.trim() ?? "";
|
|
205
|
-
if (!raw) return "Required";
|
|
206
|
-
if (!raw.startsWith("oauth:")) return "Token should start with 'oauth:'";
|
|
207
|
-
}
|
|
208
|
-
})).trim();
|
|
209
|
-
}
|
|
210
171
|
async function promptRequiredTwitchAccountValue(prompter, account, key) {
|
|
211
172
|
return (await prompter.text({
|
|
212
173
|
message: t(requiredAccountPrompts[key]),
|
|
@@ -228,46 +189,6 @@ async function promptRefreshCredential(params) {
|
|
|
228
189
|
validate: (input) => input?.trim() ? void 0 : "Required"
|
|
229
190
|
})).trim() || void 0;
|
|
230
191
|
}
|
|
231
|
-
async function promptRefreshTokenSetup(prompter, account) {
|
|
232
|
-
if (!await prompter.confirm({
|
|
233
|
-
message: t("wizard.twitch.refreshTokenPrompt"),
|
|
234
|
-
initialValue: Boolean(account?.clientSecret && account?.refreshToken)
|
|
235
|
-
})) return {};
|
|
236
|
-
return {
|
|
237
|
-
clientSecret: await promptRefreshCredential({
|
|
238
|
-
prompter,
|
|
239
|
-
existingValue: account?.clientSecret,
|
|
240
|
-
keepMessage: t("wizard.twitch.clientSecretKeep"),
|
|
241
|
-
inputMessage: t("wizard.twitch.clientSecretPrompt")
|
|
242
|
-
}),
|
|
243
|
-
refreshToken: await promptRefreshCredential({
|
|
244
|
-
prompter,
|
|
245
|
-
existingValue: account?.refreshToken,
|
|
246
|
-
keepMessage: t("wizard.twitch.refreshTokenKeep"),
|
|
247
|
-
inputMessage: t("wizard.twitch.refreshTokenInputPrompt")
|
|
248
|
-
})
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
async function configureWithEnvToken(cfg, prompter, account, envToken, forceAllowFrom, dmPolicy, accountId = resolveSetupAccountId(cfg)) {
|
|
252
|
-
const resolvedAccountId = resolveSetupAccountId(cfg, accountId);
|
|
253
|
-
if (resolvedAccountId !== DEFAULT_ACCOUNT_ID$1) return null;
|
|
254
|
-
if (!await prompter.confirm({
|
|
255
|
-
message: t("wizard.twitch.envPrompt"),
|
|
256
|
-
initialValue: true
|
|
257
|
-
})) return null;
|
|
258
|
-
const cfgWithAccount = setTwitchAccount(cfg, {
|
|
259
|
-
username: await promptRequiredTwitchAccountValue(prompter, account, "username"),
|
|
260
|
-
clientId: await promptRequiredTwitchAccountValue(prompter, account, "clientId"),
|
|
261
|
-
accessToken: envToken,
|
|
262
|
-
enabled: true
|
|
263
|
-
}, resolvedAccountId);
|
|
264
|
-
if (forceAllowFrom && dmPolicy.promptAllowFrom) return { cfg: await dmPolicy.promptAllowFrom({
|
|
265
|
-
cfg: cfgWithAccount,
|
|
266
|
-
prompter,
|
|
267
|
-
accountId: resolvedAccountId
|
|
268
|
-
}) };
|
|
269
|
-
return { cfg: cfgWithAccount };
|
|
270
|
-
}
|
|
271
192
|
function resolveTwitchGroupPolicy(cfg, accountId) {
|
|
272
193
|
const account = getAccountConfig(cfg, resolveSetupAccountId(cfg, accountId));
|
|
273
194
|
if (!account) return "disabled";
|
|
@@ -353,7 +274,7 @@ const twitchDmPolicy = createChannelDmPolicy({
|
|
|
353
274
|
});
|
|
354
275
|
const allowFrom = splitSetupEntries(entry ?? "");
|
|
355
276
|
return setTwitchAccount(cfg, {
|
|
356
|
-
...account
|
|
277
|
+
...account,
|
|
357
278
|
allowFrom
|
|
358
279
|
}, resolvedAccountId);
|
|
359
280
|
}
|
|
@@ -404,17 +325,83 @@ const twitchSetupWizard = {
|
|
|
404
325
|
finalize: async ({ cfg, accountId: requestedAccountId, prompter, forceAllowFrom }) => {
|
|
405
326
|
const accountId = resolveSetupAccountId(cfg, requestedAccountId);
|
|
406
327
|
const account = getAccountConfig(cfg, accountId);
|
|
407
|
-
if (!account || !isAccountConfigured(account)) await
|
|
328
|
+
if (!account || !isAccountConfigured(account)) await prompter.note([
|
|
329
|
+
t("wizard.twitch.helpRequiresBot"),
|
|
330
|
+
t("wizard.twitch.helpCreateApp"),
|
|
331
|
+
t("wizard.twitch.helpGenerateToken"),
|
|
332
|
+
t("wizard.twitch.helpTokenTools"),
|
|
333
|
+
t("wizard.twitch.helpCopyToken"),
|
|
334
|
+
t("wizard.twitch.helpEnvVars"),
|
|
335
|
+
`Docs: ${formatDocsLink("/channels/twitch", "channels/twitch")}`
|
|
336
|
+
].join("\n"), t("wizard.twitch.setupTitle"));
|
|
408
337
|
const envToken = process.env.OPENCLAW_TWITCH_ACCESS_TOKEN?.trim();
|
|
409
338
|
if (accountId === DEFAULT_ACCOUNT_ID$1 && envToken && !account?.accessToken) {
|
|
410
|
-
|
|
339
|
+
async function configureWithEnvToken() {
|
|
340
|
+
const resolvedAccountId = resolveSetupAccountId(cfg, accountId);
|
|
341
|
+
if (resolvedAccountId !== DEFAULT_ACCOUNT_ID$1) return null;
|
|
342
|
+
if (!await prompter.confirm({
|
|
343
|
+
message: t("wizard.twitch.envPrompt"),
|
|
344
|
+
initialValue: true
|
|
345
|
+
})) return null;
|
|
346
|
+
const cfgWithAccount = setTwitchAccount(cfg, {
|
|
347
|
+
username: await promptRequiredTwitchAccountValue(prompter, account, "username"),
|
|
348
|
+
clientId: await promptRequiredTwitchAccountValue(prompter, account, "clientId"),
|
|
349
|
+
accessToken: envToken,
|
|
350
|
+
enabled: true
|
|
351
|
+
}, resolvedAccountId);
|
|
352
|
+
if (forceAllowFrom && twitchDmPolicy.promptAllowFrom) return { cfg: await twitchDmPolicy.promptAllowFrom({
|
|
353
|
+
cfg: cfgWithAccount,
|
|
354
|
+
prompter,
|
|
355
|
+
accountId: resolvedAccountId
|
|
356
|
+
}) };
|
|
357
|
+
return { cfg: cfgWithAccount };
|
|
358
|
+
}
|
|
359
|
+
const envResult = await configureWithEnvToken();
|
|
411
360
|
if (envResult) return envResult;
|
|
412
361
|
}
|
|
362
|
+
async function promptToken() {
|
|
363
|
+
const existingToken = account?.accessToken ?? "";
|
|
364
|
+
if (existingToken) {
|
|
365
|
+
if (await prompter.confirm({
|
|
366
|
+
message: t("wizard.twitch.accessTokenKeep"),
|
|
367
|
+
initialValue: true
|
|
368
|
+
})) return existingToken;
|
|
369
|
+
}
|
|
370
|
+
return (await prompter.text({
|
|
371
|
+
message: t("wizard.twitch.oauthTokenPrompt"),
|
|
372
|
+
sensitive: true,
|
|
373
|
+
validate: (value) => {
|
|
374
|
+
const raw = value?.trim() ?? "";
|
|
375
|
+
if (!raw) return "Required";
|
|
376
|
+
if (!raw.startsWith("oauth:")) return "Token should start with 'oauth:'";
|
|
377
|
+
}
|
|
378
|
+
})).trim();
|
|
379
|
+
}
|
|
380
|
+
async function promptRefreshTokenSetup() {
|
|
381
|
+
if (!await prompter.confirm({
|
|
382
|
+
message: t("wizard.twitch.refreshTokenPrompt"),
|
|
383
|
+
initialValue: Boolean(account?.clientSecret && account?.refreshToken)
|
|
384
|
+
})) return {};
|
|
385
|
+
return {
|
|
386
|
+
clientSecret: await promptRefreshCredential({
|
|
387
|
+
prompter,
|
|
388
|
+
existingValue: account?.clientSecret,
|
|
389
|
+
keepMessage: t("wizard.twitch.clientSecretKeep"),
|
|
390
|
+
inputMessage: t("wizard.twitch.clientSecretPrompt")
|
|
391
|
+
}),
|
|
392
|
+
refreshToken: await promptRefreshCredential({
|
|
393
|
+
prompter,
|
|
394
|
+
existingValue: account?.refreshToken,
|
|
395
|
+
keepMessage: t("wizard.twitch.refreshTokenKeep"),
|
|
396
|
+
inputMessage: t("wizard.twitch.refreshTokenInputPrompt")
|
|
397
|
+
})
|
|
398
|
+
};
|
|
399
|
+
}
|
|
413
400
|
const username = await promptRequiredTwitchAccountValue(prompter, account, "username");
|
|
414
|
-
const token = await promptToken(
|
|
401
|
+
const token = await promptToken();
|
|
415
402
|
const clientId = await promptRequiredTwitchAccountValue(prompter, account, "clientId");
|
|
416
403
|
const channelName = await promptRequiredTwitchAccountValue(prompter, account, "channel");
|
|
417
|
-
const { clientSecret, refreshToken } = await promptRefreshTokenSetup(
|
|
404
|
+
const { clientSecret, refreshToken } = await promptRefreshTokenSetup();
|
|
418
405
|
const cfgWithAccount = setTwitchAccount(cfg, {
|
|
419
406
|
username,
|
|
420
407
|
accessToken: token,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"entries":[{"output":"api.js","source":"extensions/twitch/api.ts"},{"output":"channel-plugin-api.js","source":"extensions/twitch/channel-plugin-api.ts"},{"output":"index.js","source":"extensions/twitch/index.ts"},{"output":"runtime-api.js","source":"extensions/twitch/runtime-api.ts"},{"output":"setup-entry.js","source":"extensions/twitch/setup-entry.ts"},{"output":"setup-plugin-api.js","source":"extensions/twitch/setup-plugin-api.ts"}],"chunks":[{"output":".setup/monitor-BStOwZKj.mjs","sha256":"8f64ae037a7ee5da4158b0d63f710d2a5131aa74314faabc8566b7bc382a4137","facadeSource":"extensions/twitch/src/monitor.ts","sources":["extensions/twitch/src/monitor.ts","extensions/twitch/src/twitch-ingress.ts"]},{"output":".setup/plugin-D_NszQlS.mjs","sha256":"1d772eddf1dc22fa6ea49ec031f34c3f9a345a7fb8bfa8988be8e0df7664bed2","facadeSource":null,"sources":["extensions/twitch/src/client-manager-registry.ts","extensions/twitch/src/config-schema.ts","extensions/twitch/src/oauth-owner.ts","extensions/twitch/src/outbound.ts","extensions/twitch/src/plugin.ts","extensions/twitch/src/resolver.ts","extensions/twitch/src/runtime.ts","extensions/twitch/src/send.ts","extensions/twitch/src/target.ts","extensions/twitch/src/twitch-client.ts"]},{"output":".setup/setup-plugin-api-Czqbbgip.mjs","sha256":"d471b6390dee2d3ff328ac697116b6bce9427c7ea69b4faae11bdd8ed10651ad","facadeSource":"extensions/twitch/setup-plugin-api.ts","sources":[]},{"output":".setup/setup-surface-DuCk_ZHo.mjs","sha256":"33f824642cd537e09539446677e5be5bfbc2b793f19e370f53a9a1a44719ac16","facadeSource":null,"sources":["extensions/twitch/src/config.ts","extensions/twitch/src/setup-surface.ts","extensions/twitch/src/token.ts","extensions/twitch/src/utils/twitch.ts"]},{"output":"api.js","sha256":"32083b4a8c33ce0fbd9e8746e2fd48f37dacbb1cd63cc2cbb9ff5f61dd021645","facadeSource":"extensions/twitch/api.ts","sources":[]},{"output":"channel-plugin-api.js","sha256":"ad746544a10a1ed0cc457557c52ec8d000c86f3a5ca0a24116d4886fe231d588","facadeSource":"extensions/twitch/channel-plugin-api.ts","sources":[]},{"output":"index.js","sha256":"4abcaf190b4f945d2c7547c73893858486037a13c2a40ae97a3d59688ca41527","facadeSource":"extensions/twitch/index.ts","sources":["extensions/twitch/index.ts"]},{"output":"runtime-api.js","sha256":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","facadeSource":"extensions/twitch/runtime-api.ts","sources":[]},{"output":"setup-entry.js","sha256":"2362c29a61500c56756e77adb1b9a0c719d90c7a85731d4fbefaa49a9ac23a09","facadeSource":"extensions/twitch/setup-entry.ts","sources":["extensions/twitch/setup-entry.ts"]},{"output":"setup-plugin-api.js","sha256":"8e06c5e1fbee06c13643bda4064253b7f71e715b43e47a1a5330cef79cbe896b","facadeSource":"extensions/twitch/setup-plugin-api.ts","sources":[]}],"unrenderedSources":["extensions/twitch/api.ts","extensions/twitch/channel-plugin-api.ts","extensions/twitch/runtime-api.ts","extensions/twitch/setup-plugin-api.ts","extensions/twitch/src/constants.ts"]}
|
package/dist/api.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { twitchPlugin };
|
|
1
|
+
export { t as twitchPlugin } from "./.setup/plugin-D_NszQlS.mjs";
|
package/dist/setup-entry.js
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
var setup_entry_default = defineBundledChannelSetupEntry({
|
|
5
5
|
importMetaUrl: import.meta.url,
|
|
6
6
|
plugin: {
|
|
7
|
-
specifier: fileURLToPath(new URL(".setup/setup-plugin-api-
|
|
7
|
+
specifier: fileURLToPath(new URL(".setup/setup-plugin-api-Czqbbgip.mjs", import.meta.url).href),
|
|
8
8
|
exportName: "twitchSetupPlugin"
|
|
9
9
|
}
|
|
10
10
|
});
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { twitchSetupPlugin };
|
|
1
|
+
export { t as twitchSetupPlugin } from "./.setup/setup-surface-DuCk_ZHo.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/twitch",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.5-beta.2",
|
|
4
4
|
"description": "OpenClaw Twitch channel plugin for chat and moderation workflows.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@twurple/api-call": "8.2.0",
|
|
12
12
|
"@twurple/auth": "8.2.0",
|
|
13
13
|
"@twurple/chat": "8.2.0",
|
|
14
|
-
"zod": "4.6.
|
|
14
|
+
"zod": "4.6.7"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@openclaw/plugin-sdk": "workspace:*"
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"minHostVersion": ">=2026.4.10"
|
|
32
32
|
},
|
|
33
33
|
"compat": {
|
|
34
|
-
"pluginApi": ">=2026.11.
|
|
34
|
+
"pluginApi": ">=2026.11.5-beta.2"
|
|
35
35
|
},
|
|
36
36
|
"build": {
|
|
37
|
-
"openclawVersion": "2026.11.
|
|
37
|
+
"openclawVersion": "2026.11.5-beta.2"
|
|
38
38
|
},
|
|
39
39
|
"channel": {
|
|
40
40
|
"id": "twitch",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"assets/activity.svg"
|
|
75
75
|
],
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"openclaw": ">=2026.11.
|
|
77
|
+
"openclaw": ">=2026.11.5-beta.2"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"openclaw": {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
2
|
-
//#region extensions/twitch/src/runtime.ts
|
|
3
|
-
const { setRuntime: setTwitchRuntime, getRuntime: getTwitchRuntime } = createPluginRuntimeStore({
|
|
4
|
-
pluginId: "twitch",
|
|
5
|
-
errorMessage: "Twitch runtime not initialized"
|
|
6
|
-
});
|
|
7
|
-
//#endregion
|
|
8
|
-
export { setTwitchRuntime as n, getTwitchRuntime as t };
|