@openclaw/twitch 2026.10.10 → 2026.11.5-beta.1
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-OlDdzwhV.mjs → monitor-DfA87gBg.mjs} +92 -181
- package/dist/.setup/plugin-B2l8TCND.mjs +1023 -0
- package/dist/.setup/setup-plugin-api-EN3PbyIC.mjs +2 -0
- package/dist/.setup/{setup-surface-8f7RsuJw.mjs → setup-surface-mdCyd7g7.mjs} +78 -91
- package/dist/.source-module-urls/e92ae748f4a308f6cf1a5ef62518f7ba0627945de435d928747fa07ea1b4421f.json +1 -1
- package/dist/api.js +1 -3
- package/dist/channel-plugin-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/package.json +5 -5
- package/dist/.setup/plugin-CnPNkPhc.mjs +0 -851
- package/dist/.setup/runtime-DrwVh6hF.mjs +0 -7
- package/dist/.setup/setup-plugin-api-DCp5heMU.mjs +0 -2
|
@@ -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
|
// extensions/twitch/src/utils/twitch.ts
|
|
39
30
|
function normalizeTwitchChannel(channel) {
|
|
@@ -94,11 +85,10 @@ function getAccountConfig(coreConfig, accountId) {
|
|
|
94
85
|
function resolveTwitchAccountContext(cfg, accountId) {
|
|
95
86
|
const resolvedAccountId = accountId?.trim() ? normalizeAccountId(accountId) : resolveDefaultTwitchAccountId(cfg);
|
|
96
87
|
const account = getAccountConfig(cfg, resolvedAccountId);
|
|
97
|
-
const tokenResolution = resolveTwitchToken(cfg,
|
|
88
|
+
const tokenResolution = resolveTwitchToken(cfg, resolvedAccountId);
|
|
98
89
|
return {
|
|
99
90
|
accountId: resolvedAccountId,
|
|
100
91
|
account,
|
|
101
|
-
tokenResolution,
|
|
102
92
|
configured: account ? isAccountConfigured(account, tokenResolution.token) : false,
|
|
103
93
|
availableAccountIds: listAccountIds(cfg)
|
|
104
94
|
};
|
|
@@ -175,35 +165,6 @@ function setTwitchAccount(cfg, account, accountId = resolveSetupAccountId(cfg))
|
|
|
175
165
|
} }
|
|
176
166
|
});
|
|
177
167
|
}
|
|
178
|
-
async function noteTwitchSetupHelp(prompter) {
|
|
179
|
-
await prompter.note([
|
|
180
|
-
t("wizard.twitch.helpRequiresBot"),
|
|
181
|
-
t("wizard.twitch.helpCreateApp"),
|
|
182
|
-
t("wizard.twitch.helpGenerateToken"),
|
|
183
|
-
t("wizard.twitch.helpTokenTools"),
|
|
184
|
-
t("wizard.twitch.helpCopyToken"),
|
|
185
|
-
t("wizard.twitch.helpEnvVars"),
|
|
186
|
-
`Docs: ${formatDocsLink("/channels/twitch", "channels/twitch")}`
|
|
187
|
-
].join("\n"), t("wizard.twitch.setupTitle"));
|
|
188
|
-
}
|
|
189
|
-
async function promptToken(prompter, account) {
|
|
190
|
-
const existingToken = account?.accessToken ?? "";
|
|
191
|
-
if (existingToken) {
|
|
192
|
-
if (await prompter.confirm({
|
|
193
|
-
message: t("wizard.twitch.accessTokenKeep"),
|
|
194
|
-
initialValue: true
|
|
195
|
-
})) return existingToken;
|
|
196
|
-
}
|
|
197
|
-
return (await prompter.text({
|
|
198
|
-
message: t("wizard.twitch.oauthTokenPrompt"),
|
|
199
|
-
sensitive: true,
|
|
200
|
-
validate: (value) => {
|
|
201
|
-
const raw = value?.trim() ?? "";
|
|
202
|
-
if (!raw) return "Required";
|
|
203
|
-
if (!raw.startsWith("oauth:")) return "Token should start with 'oauth:'";
|
|
204
|
-
}
|
|
205
|
-
})).trim();
|
|
206
|
-
}
|
|
207
168
|
async function promptRequiredTwitchAccountValue(prompter, account, key) {
|
|
208
169
|
return (await prompter.text({
|
|
209
170
|
message: t(requiredAccountPrompts[key]),
|
|
@@ -225,46 +186,6 @@ async function promptRefreshCredential(params) {
|
|
|
225
186
|
validate: (input) => input?.trim() ? void 0 : "Required"
|
|
226
187
|
})).trim() || void 0;
|
|
227
188
|
}
|
|
228
|
-
async function promptRefreshTokenSetup(prompter, account) {
|
|
229
|
-
if (!await prompter.confirm({
|
|
230
|
-
message: t("wizard.twitch.refreshTokenPrompt"),
|
|
231
|
-
initialValue: Boolean(account?.clientSecret && account?.refreshToken)
|
|
232
|
-
})) return {};
|
|
233
|
-
return {
|
|
234
|
-
clientSecret: await promptRefreshCredential({
|
|
235
|
-
prompter,
|
|
236
|
-
existingValue: account?.clientSecret,
|
|
237
|
-
keepMessage: t("wizard.twitch.clientSecretKeep"),
|
|
238
|
-
inputMessage: t("wizard.twitch.clientSecretPrompt")
|
|
239
|
-
}),
|
|
240
|
-
refreshToken: await promptRefreshCredential({
|
|
241
|
-
prompter,
|
|
242
|
-
existingValue: account?.refreshToken,
|
|
243
|
-
keepMessage: t("wizard.twitch.refreshTokenKeep"),
|
|
244
|
-
inputMessage: t("wizard.twitch.refreshTokenInputPrompt")
|
|
245
|
-
})
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
async function configureWithEnvToken(cfg, prompter, account, envToken, forceAllowFrom, dmPolicy, accountId = resolveSetupAccountId(cfg)) {
|
|
249
|
-
const resolvedAccountId = resolveSetupAccountId(cfg, accountId);
|
|
250
|
-
if (resolvedAccountId !== DEFAULT_ACCOUNT_ID$1) return null;
|
|
251
|
-
if (!await prompter.confirm({
|
|
252
|
-
message: t("wizard.twitch.envPrompt"),
|
|
253
|
-
initialValue: true
|
|
254
|
-
})) return null;
|
|
255
|
-
const cfgWithAccount = setTwitchAccount(cfg, {
|
|
256
|
-
username: await promptRequiredTwitchAccountValue(prompter, account, "username"),
|
|
257
|
-
clientId: await promptRequiredTwitchAccountValue(prompter, account, "clientId"),
|
|
258
|
-
accessToken: envToken,
|
|
259
|
-
enabled: true
|
|
260
|
-
}, resolvedAccountId);
|
|
261
|
-
if (forceAllowFrom && dmPolicy.promptAllowFrom) return { cfg: await dmPolicy.promptAllowFrom({
|
|
262
|
-
cfg: cfgWithAccount,
|
|
263
|
-
prompter,
|
|
264
|
-
accountId: resolvedAccountId
|
|
265
|
-
}) };
|
|
266
|
-
return { cfg: cfgWithAccount };
|
|
267
|
-
}
|
|
268
189
|
function resolveTwitchGroupPolicy(cfg, accountId) {
|
|
269
190
|
const account = getAccountConfig(cfg, resolveSetupAccountId(cfg, accountId));
|
|
270
191
|
if (!account) return "disabled";
|
|
@@ -350,7 +271,7 @@ const twitchDmPolicy = createChannelDmPolicy({
|
|
|
350
271
|
});
|
|
351
272
|
const allowFrom = splitSetupEntries(entry ?? "");
|
|
352
273
|
return setTwitchAccount(cfg, {
|
|
353
|
-
...account
|
|
274
|
+
...account,
|
|
354
275
|
allowFrom
|
|
355
276
|
}, resolvedAccountId);
|
|
356
277
|
}
|
|
@@ -401,17 +322,83 @@ const twitchSetupWizard = {
|
|
|
401
322
|
finalize: async ({ cfg, accountId: requestedAccountId, prompter, forceAllowFrom }) => {
|
|
402
323
|
const accountId = resolveSetupAccountId(cfg, requestedAccountId);
|
|
403
324
|
const account = getAccountConfig(cfg, accountId);
|
|
404
|
-
if (!account || !isAccountConfigured(account)) await
|
|
325
|
+
if (!account || !isAccountConfigured(account)) await prompter.note([
|
|
326
|
+
t("wizard.twitch.helpRequiresBot"),
|
|
327
|
+
t("wizard.twitch.helpCreateApp"),
|
|
328
|
+
t("wizard.twitch.helpGenerateToken"),
|
|
329
|
+
t("wizard.twitch.helpTokenTools"),
|
|
330
|
+
t("wizard.twitch.helpCopyToken"),
|
|
331
|
+
t("wizard.twitch.helpEnvVars"),
|
|
332
|
+
`Docs: ${formatDocsLink("/channels/twitch", "channels/twitch")}`
|
|
333
|
+
].join("\n"), t("wizard.twitch.setupTitle"));
|
|
405
334
|
const envToken = process.env.OPENCLAW_TWITCH_ACCESS_TOKEN?.trim();
|
|
406
335
|
if (accountId === DEFAULT_ACCOUNT_ID$1 && envToken && !account?.accessToken) {
|
|
407
|
-
|
|
336
|
+
async function configureWithEnvToken() {
|
|
337
|
+
const resolvedAccountId = resolveSetupAccountId(cfg, accountId);
|
|
338
|
+
if (resolvedAccountId !== DEFAULT_ACCOUNT_ID$1) return null;
|
|
339
|
+
if (!await prompter.confirm({
|
|
340
|
+
message: t("wizard.twitch.envPrompt"),
|
|
341
|
+
initialValue: true
|
|
342
|
+
})) return null;
|
|
343
|
+
const cfgWithAccount = setTwitchAccount(cfg, {
|
|
344
|
+
username: await promptRequiredTwitchAccountValue(prompter, account, "username"),
|
|
345
|
+
clientId: await promptRequiredTwitchAccountValue(prompter, account, "clientId"),
|
|
346
|
+
accessToken: envToken,
|
|
347
|
+
enabled: true
|
|
348
|
+
}, resolvedAccountId);
|
|
349
|
+
if (forceAllowFrom && twitchDmPolicy.promptAllowFrom) return { cfg: await twitchDmPolicy.promptAllowFrom({
|
|
350
|
+
cfg: cfgWithAccount,
|
|
351
|
+
prompter,
|
|
352
|
+
accountId: resolvedAccountId
|
|
353
|
+
}) };
|
|
354
|
+
return { cfg: cfgWithAccount };
|
|
355
|
+
}
|
|
356
|
+
const envResult = await configureWithEnvToken();
|
|
408
357
|
if (envResult) return envResult;
|
|
409
358
|
}
|
|
359
|
+
async function promptToken() {
|
|
360
|
+
const existingToken = account?.accessToken ?? "";
|
|
361
|
+
if (existingToken) {
|
|
362
|
+
if (await prompter.confirm({
|
|
363
|
+
message: t("wizard.twitch.accessTokenKeep"),
|
|
364
|
+
initialValue: true
|
|
365
|
+
})) return existingToken;
|
|
366
|
+
}
|
|
367
|
+
return (await prompter.text({
|
|
368
|
+
message: t("wizard.twitch.oauthTokenPrompt"),
|
|
369
|
+
sensitive: true,
|
|
370
|
+
validate: (value) => {
|
|
371
|
+
const raw = value?.trim() ?? "";
|
|
372
|
+
if (!raw) return "Required";
|
|
373
|
+
if (!raw.startsWith("oauth:")) return "Token should start with 'oauth:'";
|
|
374
|
+
}
|
|
375
|
+
})).trim();
|
|
376
|
+
}
|
|
377
|
+
async function promptRefreshTokenSetup() {
|
|
378
|
+
if (!await prompter.confirm({
|
|
379
|
+
message: t("wizard.twitch.refreshTokenPrompt"),
|
|
380
|
+
initialValue: Boolean(account?.clientSecret && account?.refreshToken)
|
|
381
|
+
})) return {};
|
|
382
|
+
return {
|
|
383
|
+
clientSecret: await promptRefreshCredential({
|
|
384
|
+
prompter,
|
|
385
|
+
existingValue: account?.clientSecret,
|
|
386
|
+
keepMessage: t("wizard.twitch.clientSecretKeep"),
|
|
387
|
+
inputMessage: t("wizard.twitch.clientSecretPrompt")
|
|
388
|
+
}),
|
|
389
|
+
refreshToken: await promptRefreshCredential({
|
|
390
|
+
prompter,
|
|
391
|
+
existingValue: account?.refreshToken,
|
|
392
|
+
keepMessage: t("wizard.twitch.refreshTokenKeep"),
|
|
393
|
+
inputMessage: t("wizard.twitch.refreshTokenInputPrompt")
|
|
394
|
+
})
|
|
395
|
+
};
|
|
396
|
+
}
|
|
410
397
|
const username = await promptRequiredTwitchAccountValue(prompter, account, "username");
|
|
411
|
-
const token = await promptToken(
|
|
398
|
+
const token = await promptToken();
|
|
412
399
|
const clientId = await promptRequiredTwitchAccountValue(prompter, account, "clientId");
|
|
413
400
|
const channelName = await promptRequiredTwitchAccountValue(prompter, account, "channel");
|
|
414
|
-
const { clientSecret, refreshToken } = await promptRefreshTokenSetup(
|
|
401
|
+
const { clientSecret, refreshToken } = await promptRefreshTokenSetup();
|
|
415
402
|
const cfgWithAccount = setTwitchAccount(cfg, {
|
|
416
403
|
username,
|
|
417
404
|
accessToken: token,
|
|
@@ -1 +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-
|
|
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-DfA87gBg.mjs","sha256":"28bbe69f10993056749d7c92f370a2511a62a9a7666a8fb107c76c4764bab063","facadeSource":"extensions/twitch/src/monitor.ts","sources":["extensions/twitch/src/monitor.ts","extensions/twitch/src/twitch-ingress.ts"]},{"output":".setup/plugin-B2l8TCND.mjs","sha256":"5e1d7403adb3255e206948c15af4b9b2bddb507a081673615772b946670c918e","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-EN3PbyIC.mjs","sha256":"837b4fa3de7efa3b714647fb5ad9040341d149f1f3d8d14aee6d46131d1a92ea","facadeSource":"extensions/twitch/setup-plugin-api.ts","sources":[]},{"output":".setup/setup-surface-mdCyd7g7.mjs","sha256":"cb37314653ba1c4f98ce194c18045ed4c8b586c8c6c8bc1f3bc89beb5f0c3154","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":"79b63b1f8d3f518b9d673902d59b69a5c7c38b5b9d4805f1bdd622e6327cb262","facadeSource":"extensions/twitch/api.ts","sources":[]},{"output":"channel-plugin-api.js","sha256":"19c33464582bcfddd646a89fbb4907c9bf7468a8cbf5653b2b3fc9099fb2a1d1","facadeSource":"extensions/twitch/channel-plugin-api.ts","sources":[]},{"output":"index.js","sha256":"ae12fa88716486195f5e255ab8bd0824c67979d83593c2be4f4c3a423bfc8307","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":"0ffb6b00dfc6c7e3b7aef0dcbd2e1227a7e41cb6221bc9d9f39a89799e3d9fc9","facadeSource":"extensions/twitch/setup-entry.ts","sources":["extensions/twitch/setup-entry.ts"]},{"output":"setup-plugin-api.js","sha256":"dadde5bc1583d4f26e558d07d0a73da68803bfe0e8093c12da539f2768fcc854","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 +1 @@
|
|
|
1
|
-
export { t as twitchPlugin } from "./.setup/plugin-
|
|
1
|
+
export { t as twitchPlugin } from "./.setup/plugin-B2l8TCND.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-EN3PbyIC.mjs", import.meta.url).href),
|
|
8
8
|
exportName: "twitchSetupPlugin"
|
|
9
9
|
}
|
|
10
10
|
});
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as twitchSetupPlugin } from "./.setup/setup-surface-
|
|
1
|
+
export { t as twitchSetupPlugin } from "./.setup/setup-surface-mdCyd7g7.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/twitch",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.11.5-beta.1",
|
|
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.
|
|
34
|
+
"pluginApi": ">=2026.11.5-beta.1"
|
|
35
35
|
},
|
|
36
36
|
"build": {
|
|
37
|
-
"openclawVersion": "2026.
|
|
37
|
+
"openclawVersion": "2026.11.5-beta.1"
|
|
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.
|
|
77
|
+
"openclaw": ">=2026.11.5-beta.1"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"openclaw": {
|