@openclaw/twitch 2026.9.8 → 2026.10.1-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-CnvhK43s.mjs → monitor-DXLeJigj.mjs} +3 -5
- package/dist/.setup/{plugin-BbtWQOSW.mjs → plugin-BXWHdWMb.mjs} +16 -65
- package/dist/.setup/{setup-plugin-api-B1c86Vpi.mjs → setup-plugin-api-f4_tNl5M.mjs} +1 -1
- package/dist/.setup/{setup-surface-KNOOeRU6.mjs → setup-surface-CUV7j7dX.mjs} +3 -3
- package/dist/api.js +1 -1
- 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 +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as sendMessageTwitchInternal, r as getOrCreateClientManager } from "./plugin-
|
|
2
|
-
import { l as normalizeTwitchChannel } from "./setup-surface-
|
|
1
|
+
import { n as sendMessageTwitchInternal, r as getOrCreateClientManager } from "./plugin-BXWHdWMb.mjs";
|
|
2
|
+
import { l as normalizeTwitchChannel } from "./setup-surface-CUV7j7dX.mjs";
|
|
3
3
|
import { t as getTwitchRuntime } from "./runtime-B5If4b0g.mjs";
|
|
4
4
|
import { createChannelIngressError, createChannelIngressMonitor } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
5
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -153,13 +153,11 @@ function inspectTwitchIngressEvent(event) {
|
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
function deserializeTwitchIngressEvent(rawEvent) {
|
|
156
|
-
let parsed;
|
|
157
156
|
try {
|
|
158
|
-
|
|
157
|
+
return JSON.parse(rawEvent);
|
|
159
158
|
} catch (error) {
|
|
160
159
|
throw new TwitchIngressPermanentError("Twitch ingress event JSON is invalid.", { cause: error });
|
|
161
160
|
}
|
|
162
|
-
return parsed;
|
|
163
161
|
}
|
|
164
162
|
function normalizeClaimedTwitchMessage(event, claimedId) {
|
|
165
163
|
const candidate = event;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveTwitchAccountContext, c as normalizeToken, i as resolveDefaultTwitchAccountId, l as normalizeTwitchChannel, n as DEFAULT_ACCOUNT_ID$1, o as twitchConfigAdapter, r as getAccountConfig, s as isAccountConfigured, t as twitchSetupPlugin, u as resolveTwitchToken } from "./setup-surface-
|
|
1
|
+
import { a as resolveTwitchAccountContext, c as normalizeToken, i as resolveDefaultTwitchAccountId, l as normalizeTwitchChannel, n as DEFAULT_ACCOUNT_ID$1, o as twitchConfigAdapter, r as getAccountConfig, s as isAccountConfigured, t as twitchSetupPlugin, u as resolveTwitchToken } from "./setup-surface-CUV7j7dX.mjs";
|
|
2
2
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
3
3
|
import { MarkdownConfigSchema, buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
|
|
4
4
|
import { buildChannelOutboundSessionRoute, createChatChannelPlugin, stripChannelTargetPrefix } from "openclaw/plugin-sdk/channel-core";
|
|
@@ -15,6 +15,7 @@ import { chunkTextForOutbound, sanitizeAssistantVisibleText, stripMarkdown } fro
|
|
|
15
15
|
import { runChannelProbe, sliceUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
16
16
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
17
17
|
import { z } from "zod";
|
|
18
|
+
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
18
19
|
import { HttpStatusCodeError, callTwitchApi } from "@twurple/api-call";
|
|
19
20
|
//#region extensions/twitch/src/actions.ts
|
|
20
21
|
function readSendValue(value) {
|
|
@@ -61,11 +62,10 @@ var TwitchClientManager = class {
|
|
|
61
62
|
lastError
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
|
-
async createAuthProvider(account, normalizedToken) {
|
|
65
|
-
if (!account.clientId) throw new Error("Missing Twitch client ID");
|
|
65
|
+
async createAuthProvider(account, normalizedToken, clientId) {
|
|
66
66
|
if (account.clientSecret) {
|
|
67
67
|
const authProvider = new RefreshingAuthProvider({
|
|
68
|
-
clientId
|
|
68
|
+
clientId,
|
|
69
69
|
clientSecret: account.clientSecret
|
|
70
70
|
});
|
|
71
71
|
try {
|
|
@@ -90,7 +90,7 @@ var TwitchClientManager = class {
|
|
|
90
90
|
return authProvider;
|
|
91
91
|
}
|
|
92
92
|
this.logger.info(`Using StaticAuthProvider for ${account.username} (no clientSecret provided)`);
|
|
93
|
-
return new StaticAuthProvider(
|
|
93
|
+
return new StaticAuthProvider(clientId, normalizedToken);
|
|
94
94
|
}
|
|
95
95
|
async getClient(account, cfg, accountId) {
|
|
96
96
|
const key = this.getAccountKey(account);
|
|
@@ -119,7 +119,7 @@ var TwitchClientManager = class {
|
|
|
119
119
|
throw new Error("Missing Twitch client ID");
|
|
120
120
|
}
|
|
121
121
|
const normalizedToken = normalizeToken(tokenResolution.token);
|
|
122
|
-
const authProvider = await this.createAuthProvider(account, normalizedToken);
|
|
122
|
+
const authProvider = await this.createAuthProvider(account, normalizedToken, account.clientId);
|
|
123
123
|
if (!ownsConnection()) throw new Error(`Twitch connection cancelled for ${account.username}`);
|
|
124
124
|
const client = new ChatClient({
|
|
125
125
|
authProvider,
|
|
@@ -170,7 +170,7 @@ var TwitchClientManager = class {
|
|
|
170
170
|
const finish = (error) => {
|
|
171
171
|
if (settled) return;
|
|
172
172
|
settled = true;
|
|
173
|
-
|
|
173
|
+
clearTimeout(timeout);
|
|
174
174
|
for (const listener of listeners) listener.unbind();
|
|
175
175
|
if (error) {
|
|
176
176
|
try {
|
|
@@ -483,12 +483,6 @@ const twitchMessageAdapter = createChannelMessageAdapterFromOutbound({
|
|
|
483
483
|
});
|
|
484
484
|
//#endregion
|
|
485
485
|
//#region extensions/twitch/src/probe.ts
|
|
486
|
-
/**
|
|
487
|
-
* Probe a Twitch account to verify the connection is working
|
|
488
|
-
*
|
|
489
|
-
* This tests the Twitch OAuth token by attempting to connect
|
|
490
|
-
* to the chat server and verify the bot's username.
|
|
491
|
-
*/
|
|
492
486
|
async function probeTwitch(account, timeoutMs) {
|
|
493
487
|
let client;
|
|
494
488
|
try {
|
|
@@ -500,7 +494,8 @@ async function probeTwitch(account, timeoutMs) {
|
|
|
500
494
|
};
|
|
501
495
|
const rawToken = normalizeToken(account.accessToken.trim());
|
|
502
496
|
const authProvider = new StaticAuthProvider(account.clientId ?? "", rawToken);
|
|
503
|
-
|
|
497
|
+
const probeClient = new ChatClient({ authProvider });
|
|
498
|
+
client = probeClient;
|
|
504
499
|
const connectionPromise = new Promise((resolve, reject) => {
|
|
505
500
|
let settled = false;
|
|
506
501
|
const cleanup = () => {
|
|
@@ -523,16 +518,12 @@ async function probeTwitch(account, timeoutMs) {
|
|
|
523
518
|
reject(/* @__PURE__ */ new Error("Authentication failed"));
|
|
524
519
|
});
|
|
525
520
|
});
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
521
|
+
await raceWithTimeout(() => {
|
|
522
|
+
probeClient.connect();
|
|
523
|
+
return connectionPromise;
|
|
524
|
+
}, timeoutMs, () => {
|
|
525
|
+
throw new Error(`timeout after ${timeoutMs}ms`);
|
|
529
526
|
});
|
|
530
|
-
client.connect();
|
|
531
|
-
try {
|
|
532
|
-
await Promise.race([connectionPromise, timeout]);
|
|
533
|
-
} finally {
|
|
534
|
-
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
535
|
-
}
|
|
536
527
|
client.quit();
|
|
537
528
|
client = void 0;
|
|
538
529
|
return {
|
|
@@ -650,17 +641,11 @@ async function resolveTwitchTargets(inputs, account, _kind, log) {
|
|
|
650
641
|
}
|
|
651
642
|
//#endregion
|
|
652
643
|
//#region extensions/twitch/src/status.ts
|
|
653
|
-
function collectTwitchStatusIssues(accounts
|
|
644
|
+
function collectTwitchStatusIssues(accounts) {
|
|
654
645
|
const issues = [];
|
|
655
646
|
for (const entry of accounts) {
|
|
656
647
|
const accountId = entry.accountId;
|
|
657
648
|
if (!accountId) continue;
|
|
658
|
-
let account = null;
|
|
659
|
-
let cfg;
|
|
660
|
-
if (getCfg) try {
|
|
661
|
-
cfg = getCfg();
|
|
662
|
-
account = getAccountConfig(cfg, accountId);
|
|
663
|
-
} catch {}
|
|
664
649
|
if (!entry.configured) {
|
|
665
650
|
issues.push({
|
|
666
651
|
channel: "twitch",
|
|
@@ -681,40 +666,6 @@ function collectTwitchStatusIssues(accounts, getCfg) {
|
|
|
681
666
|
});
|
|
682
667
|
continue;
|
|
683
668
|
}
|
|
684
|
-
if (account && account.username && account.accessToken && !account.clientId) issues.push({
|
|
685
|
-
channel: "twitch",
|
|
686
|
-
accountId,
|
|
687
|
-
kind: "config",
|
|
688
|
-
message: "Twitch client ID is required",
|
|
689
|
-
fix: "Add clientId to your Twitch account configuration (from Twitch Developer Portal)"
|
|
690
|
-
});
|
|
691
|
-
const tokenResolution = cfg ? resolveTwitchToken(cfg, { accountId }) : {
|
|
692
|
-
token: "",
|
|
693
|
-
source: "none"
|
|
694
|
-
};
|
|
695
|
-
if (account && isAccountConfigured(account, tokenResolution.token)) {
|
|
696
|
-
if (account.accessToken?.startsWith("oauth:")) issues.push({
|
|
697
|
-
channel: "twitch",
|
|
698
|
-
accountId,
|
|
699
|
-
kind: "config",
|
|
700
|
-
message: "Token contains 'oauth:' prefix (will be stripped)",
|
|
701
|
-
fix: "The 'oauth:' prefix is optional. You can use just the token value, or keep it as-is (it will be normalized automatically)."
|
|
702
|
-
});
|
|
703
|
-
if (account.clientSecret && !account.refreshToken) issues.push({
|
|
704
|
-
channel: "twitch",
|
|
705
|
-
accountId,
|
|
706
|
-
kind: "config",
|
|
707
|
-
message: "clientSecret provided without refreshToken",
|
|
708
|
-
fix: "For automatic token refresh, provide both clientSecret and refreshToken. Otherwise, clientSecret is not needed."
|
|
709
|
-
});
|
|
710
|
-
if (account.allowedRoles?.includes("all") && account.allowFrom && account.allowFrom.length > 0) issues.push({
|
|
711
|
-
channel: "twitch",
|
|
712
|
-
accountId,
|
|
713
|
-
kind: "intent",
|
|
714
|
-
message: "allowedRoles is set to 'all' but allowFrom is also configured",
|
|
715
|
-
fix: "When allowedRoles is 'all', the allowFrom list is not needed. Remove allowFrom or set allowedRoles to specific roles."
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
669
|
if (entry.lastError) issues.push({
|
|
719
670
|
channel: "twitch",
|
|
720
671
|
accountId,
|
|
@@ -866,7 +817,7 @@ const twitchPlugin = createChatChannelPlugin({
|
|
|
866
817
|
await runPassiveAccountLifecycle({
|
|
867
818
|
abortSignal: ctx.abortSignal,
|
|
868
819
|
start: async () => {
|
|
869
|
-
const { monitorTwitchProvider } = await import("./monitor-
|
|
820
|
+
const { monitorTwitchProvider } = await import("./monitor-DXLeJigj.mjs");
|
|
870
821
|
return monitorTwitchProvider({
|
|
871
822
|
account,
|
|
872
823
|
accountId,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID, DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId, resolveNormalizedAccountEntry } from "openclaw/plugin-sdk/account-resolution";
|
|
3
|
-
import { normalizeLowercaseStringOrEmpty
|
|
3
|
+
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
5
|
import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
|
|
6
6
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
7
7
|
import { getChatChannelMeta } from "openclaw/plugin-sdk/core";
|
|
8
|
-
import { createSetupTranslator, formatDocsLink, normalizeAccountId as normalizeAccountId$1, patchTopLevelChannelConfigSection, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
8
|
+
import { createSetupTranslator, formatDocsLink, normalizeAccountId as normalizeAccountId$1, patchTopLevelChannelConfigSection, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
9
9
|
//#region extensions/twitch/src/token.ts
|
|
10
10
|
function normalizeTwitchToken(raw) {
|
|
11
11
|
if (!raw) return;
|
|
@@ -353,7 +353,7 @@ const twitchDmPolicy = createChannelDmPolicy({
|
|
|
353
353
|
placeholder: "123456789",
|
|
354
354
|
initialValue: existingAllowFrom[0] || void 0
|
|
355
355
|
});
|
|
356
|
-
const allowFrom =
|
|
356
|
+
const allowFrom = splitSetupEntries(entry ?? "");
|
|
357
357
|
return setTwitchAccount(cfg, {
|
|
358
358
|
...account ?? void 0,
|
|
359
359
|
allowFrom
|
package/dist/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as twitchPlugin } from "./.setup/plugin-
|
|
1
|
+
import { t as twitchPlugin } from "./.setup/plugin-BXWHdWMb.mjs";
|
|
2
2
|
export { twitchPlugin };
|
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-f4_tNl5M.mjs", import.meta.url).href),
|
|
8
8
|
exportName: "twitchSetupPlugin"
|
|
9
9
|
}
|
|
10
10
|
});
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as twitchSetupPlugin } from "./.setup/setup-surface-
|
|
1
|
+
import { t as twitchSetupPlugin } from "./.setup/setup-surface-CUV7j7dX.mjs";
|
|
2
2
|
export { twitchSetupPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/twitch",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.10.1-beta.2",
|
|
4
4
|
"description": "OpenClaw Twitch channel plugin for chat and moderation workflows.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"minHostVersion": ">=2026.4.10"
|
|
32
32
|
},
|
|
33
33
|
"compat": {
|
|
34
|
-
"pluginApi": ">=2026.
|
|
34
|
+
"pluginApi": ">=2026.10.1-beta.2"
|
|
35
35
|
},
|
|
36
36
|
"build": {
|
|
37
|
-
"openclawVersion": "2026.
|
|
37
|
+
"openclawVersion": "2026.10.1-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.
|
|
77
|
+
"openclaw": ">=2026.10.1-beta.2"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"openclaw": {
|