@openclaw/twitch 2026.8.1-beta.2 → 2026.9.1-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/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as twitchPlugin } from "./plugin-
|
|
1
|
+
import { t as twitchPlugin } from "./plugin-BkpBoc94.js";
|
|
2
2
|
export { twitchPlugin };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { m as normalizeTwitchChannel } from "./setup-surface-1wrrTKpx.js";
|
|
2
|
-
import { n as stripMarkdownForTwitch, r as getOrCreateClientManager } from "./plugin-
|
|
2
|
+
import { n as stripMarkdownForTwitch, r as getOrCreateClientManager } from "./plugin-BkpBoc94.js";
|
|
3
3
|
import { t as getTwitchRuntime } from "./runtime-B5If4b0g.js";
|
|
4
4
|
import { createChannelIngressError, createChannelIngressMonitor } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
5
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty, normalizeNullableString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { HttpStatusCodeError } from "@twurple/api-call";
|
|
8
8
|
import { createChannelInboundEnvelopeBuilder } from "openclaw/plugin-sdk/channel-inbound";
|
|
9
|
+
import { resolveOutboundMediaUrls } from "openclaw/plugin-sdk/reply-payload";
|
|
9
10
|
import { createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
10
11
|
//#region extensions/twitch/src/access-control.ts
|
|
11
12
|
const twitchUserIdentity = defineStableChannelIngressIdentity({
|
|
@@ -421,12 +422,11 @@ async function deliverTwitchReply(params) {
|
|
|
421
422
|
error: (msg) => runtime.error?.(msg),
|
|
422
423
|
debug: (msg) => runtime.log?.(msg)
|
|
423
424
|
});
|
|
424
|
-
|
|
425
|
+
const textToSend = stripMarkdownForTwitch([payload.text, ...resolveOutboundMediaUrls(payload)].filter(Boolean).join(" "));
|
|
426
|
+
if (!textToSend) {
|
|
425
427
|
runtime.error?.(`No text to send in reply payload`);
|
|
426
428
|
return { visibleReplySent: false };
|
|
427
429
|
}
|
|
428
|
-
const textToSend = stripMarkdownForTwitch(payload.text);
|
|
429
|
-
if (!textToSend) return { visibleReplySent: false };
|
|
430
430
|
const result = await clientManager.sendMessage(account, channel, textToSend, config, accountId);
|
|
431
431
|
if (!result.ok) throw new Error(result.error ?? "Send failed");
|
|
432
432
|
return { visibleReplySent: true };
|
|
@@ -86,7 +86,7 @@ var TwitchClientManager = class {
|
|
|
86
86
|
if (existing) return existing;
|
|
87
87
|
const pending = this.connectionPromises.get(key);
|
|
88
88
|
if (pending) return pending;
|
|
89
|
-
const connection = this.createConnectedClient(key, account, cfg, accountId);
|
|
89
|
+
const connection = this.createConnectedClient(key, account, () => this.connectionPromises.get(key) === connection, cfg, accountId);
|
|
90
90
|
this.connectionPromises.set(key, connection);
|
|
91
91
|
try {
|
|
92
92
|
return await connection;
|
|
@@ -94,7 +94,7 @@ var TwitchClientManager = class {
|
|
|
94
94
|
if (this.connectionPromises.get(key) === connection) this.connectionPromises.delete(key);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
async createConnectedClient(key, account, cfg, accountId) {
|
|
97
|
+
async createConnectedClient(key, account, ownsConnection, cfg, accountId) {
|
|
98
98
|
const tokenResolution = resolveTwitchToken(cfg, { accountId });
|
|
99
99
|
if (!tokenResolution.token) {
|
|
100
100
|
this.logger.error(`Missing Twitch token for account ${account.username} (set channels.twitch.accounts.${account.username}.token or OPENCLAW_TWITCH_ACCESS_TOKEN for default)`);
|
|
@@ -106,8 +106,10 @@ var TwitchClientManager = class {
|
|
|
106
106
|
throw new Error("Missing Twitch client ID");
|
|
107
107
|
}
|
|
108
108
|
const normalizedToken = normalizeToken(tokenResolution.token);
|
|
109
|
+
const authProvider = await this.createAuthProvider(account, normalizedToken);
|
|
110
|
+
if (!ownsConnection()) throw new Error(`Twitch connection cancelled for ${account.username}`);
|
|
109
111
|
const client = new ChatClient({
|
|
110
|
-
authProvider
|
|
112
|
+
authProvider,
|
|
111
113
|
channels: [account.channel],
|
|
112
114
|
rejoinChannelsOnReconnect: true,
|
|
113
115
|
requestMembershipEvents: true,
|
|
@@ -261,18 +263,17 @@ var TwitchClientManager = class {
|
|
|
261
263
|
const key = this.getAccountKey(account);
|
|
262
264
|
const client = this.clients.get(key);
|
|
263
265
|
const pendingClient = this.pendingClients.get(key);
|
|
266
|
+
const pendingConnection = this.connectionPromises.delete(key);
|
|
264
267
|
if (pendingClient) {
|
|
265
268
|
pendingClient.quit();
|
|
266
269
|
this.pendingClients.delete(key);
|
|
267
|
-
this.connectionPromises.delete(key);
|
|
268
|
-
this.clearMessageHandler(key);
|
|
269
270
|
}
|
|
270
271
|
if (client) {
|
|
271
272
|
client.quit();
|
|
272
273
|
this.clients.delete(key);
|
|
273
|
-
this.clearMessageHandler(key);
|
|
274
274
|
this.logger.info(`Disconnected ${key}`);
|
|
275
275
|
}
|
|
276
|
+
if (pendingConnection || pendingClient || client) this.clearMessageHandler(key);
|
|
276
277
|
}
|
|
277
278
|
/**
|
|
278
279
|
* Disconnect all clients
|
|
@@ -377,10 +378,10 @@ function getClientManager(accountId) {
|
|
|
377
378
|
async function removeClientManager(accountId) {
|
|
378
379
|
const entry = registry.get(accountId);
|
|
379
380
|
if (!entry) return;
|
|
381
|
+
registry.delete(accountId);
|
|
380
382
|
try {
|
|
381
383
|
await entry.manager.disconnectAll();
|
|
382
384
|
} finally {
|
|
383
|
-
registry.delete(accountId);
|
|
384
385
|
entry.logger.info(`Unregistered client manager for account: ${accountId}`);
|
|
385
386
|
}
|
|
386
387
|
}
|
|
@@ -918,7 +919,9 @@ const TwitchConfigBaseShape = {
|
|
|
918
919
|
enabled: z.boolean().optional(),
|
|
919
920
|
configWrites: z.boolean().optional(),
|
|
920
921
|
markdown: MarkdownConfigSchema.optional(),
|
|
921
|
-
defaultAccount: z.string().optional()
|
|
922
|
+
defaultAccount: z.string().optional(),
|
|
923
|
+
historyLimit: z.number().int().min(0).optional(),
|
|
924
|
+
responsePrefix: z.string().optional()
|
|
922
925
|
};
|
|
923
926
|
/**
|
|
924
927
|
* Simplified single-account configuration schema
|
|
@@ -1409,7 +1412,7 @@ const twitchPlugin = createChatChannelPlugin({
|
|
|
1409
1412
|
await runPassiveAccountLifecycle({
|
|
1410
1413
|
abortSignal: ctx.abortSignal,
|
|
1411
1414
|
start: async () => {
|
|
1412
|
-
const { monitorTwitchProvider } = await import("./monitor-
|
|
1415
|
+
const { monitorTwitchProvider } = await import("./monitor-iY6U867S.js");
|
|
1413
1416
|
return monitorTwitchProvider({
|
|
1414
1417
|
account,
|
|
1415
1418
|
accountId,
|
package/openclaw.plugin.json
CHANGED
|
@@ -49,6 +49,14 @@
|
|
|
49
49
|
"defaultAccount": {
|
|
50
50
|
"type": "string"
|
|
51
51
|
},
|
|
52
|
+
"historyLimit": {
|
|
53
|
+
"type": "integer",
|
|
54
|
+
"minimum": 0,
|
|
55
|
+
"maximum": 9007199254740991
|
|
56
|
+
},
|
|
57
|
+
"responsePrefix": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
},
|
|
52
60
|
"username": {
|
|
53
61
|
"type": "string"
|
|
54
62
|
},
|
|
@@ -84,9 +92,6 @@
|
|
|
84
92
|
"requireMention": {
|
|
85
93
|
"type": "boolean"
|
|
86
94
|
},
|
|
87
|
-
"responsePrefix": {
|
|
88
|
-
"type": "string"
|
|
89
|
-
},
|
|
90
95
|
"clientSecret": {
|
|
91
96
|
"type": "string"
|
|
92
97
|
},
|
|
@@ -144,6 +149,14 @@
|
|
|
144
149
|
"defaultAccount": {
|
|
145
150
|
"type": "string"
|
|
146
151
|
},
|
|
152
|
+
"historyLimit": {
|
|
153
|
+
"type": "integer",
|
|
154
|
+
"minimum": 0,
|
|
155
|
+
"maximum": 9007199254740991
|
|
156
|
+
},
|
|
157
|
+
"responsePrefix": {
|
|
158
|
+
"type": "string"
|
|
159
|
+
},
|
|
147
160
|
"accounts": {
|
|
148
161
|
"type": "object",
|
|
149
162
|
"propertyNames": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/twitch",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.9.1-beta.1",
|
|
4
4
|
"description": "OpenClaw Twitch channel plugin for chat and moderation workflows.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"minHostVersion": ">=2026.4.10"
|
|
31
31
|
},
|
|
32
32
|
"compat": {
|
|
33
|
-
"pluginApi": ">=2026.
|
|
33
|
+
"pluginApi": ">=2026.9.1-beta.1"
|
|
34
34
|
},
|
|
35
35
|
"build": {
|
|
36
|
-
"openclawVersion": "2026.
|
|
36
|
+
"openclawVersion": "2026.9.1-beta.1"
|
|
37
37
|
},
|
|
38
38
|
"channel": {
|
|
39
39
|
"id": "twitch",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"README.md"
|
|
72
72
|
],
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"openclaw": ">=2026.
|
|
74
|
+
"openclaw": ">=2026.9.1-beta.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependenciesMeta": {
|
|
77
77
|
"openclaw": {
|