@openclaw/twitch 2026.7.2-beta.5 → 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/dist/api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{monitor-D9sSDntu.js → monitor-BoEAKAWR.js} +15 -51
- package/dist/{plugin-CNFX3B8N.js → plugin-BFfcWmGY.js} +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-Dh9kVN1p.js → setup-surface-BzftVkdX.js} +10 -23
- package/package.json +4 -4
package/dist/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as twitchPlugin } from "./plugin-
|
|
1
|
+
import { t as twitchPlugin } from "./plugin-BFfcWmGY.js";
|
|
2
2
|
export { twitchPlugin };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { h as normalizeTwitchChannel } from "./setup-surface-
|
|
2
|
-
import { n as stripMarkdownForTwitch, r as getOrCreateClientManager } from "./plugin-
|
|
1
|
+
import { h as normalizeTwitchChannel } from "./setup-surface-BzftVkdX.js";
|
|
2
|
+
import { n as stripMarkdownForTwitch, r as getOrCreateClientManager } from "./plugin-BFfcWmGY.js";
|
|
3
3
|
import { t as getTwitchRuntime } from "./runtime-B5If4b0g.js";
|
|
4
|
-
import { createChannelIngressMonitor } from "openclaw/plugin-sdk/channel-outbound";
|
|
4
|
+
import { createChannelIngressError, createChannelIngressMonitor } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
5
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
6
|
-
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
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
9
|
import { createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
@@ -132,26 +132,13 @@ function mentionsBot(message, botUsername) {
|
|
|
132
132
|
//#region extensions/twitch/src/twitch-ingress.ts
|
|
133
133
|
const TWITCH_INGRESS_PAYLOAD_VERSION = 1;
|
|
134
134
|
const TWITCH_INGRESS_DRAIN_INTERVAL_MS = 1e3;
|
|
135
|
-
const
|
|
136
|
-
const TWITCH_INGRESS_COMPLETED_TTL_MS = 720 * 60 * 60 * 1e3;
|
|
137
|
-
const TWITCH_INGRESS_COMPLETED_MAX_ENTRIES = 1e3;
|
|
138
|
-
const TWITCH_INGRESS_FAILED_TTL_MS = 720 * 60 * 60 * 1e3;
|
|
139
|
-
const TWITCH_INGRESS_FAILED_MAX_ENTRIES = 1e3;
|
|
140
|
-
var TwitchIngressPermanentError = class extends Error {
|
|
141
|
-
constructor(message, options) {
|
|
142
|
-
super(message, options);
|
|
143
|
-
this.name = "TwitchIngressPermanentError";
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
function nonEmptyString(value) {
|
|
147
|
-
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
148
|
-
}
|
|
135
|
+
const TwitchIngressPermanentError = createChannelIngressError("TwitchIngressPermanentError");
|
|
149
136
|
function inspectTwitchIngressEvent(event) {
|
|
150
137
|
if (!event || typeof event !== "object" || Array.isArray(event)) throw new TwitchIngressPermanentError("Twitch ingress event must be an object.");
|
|
151
138
|
const candidate = event;
|
|
152
|
-
const eventId =
|
|
139
|
+
const eventId = normalizeNullableString(candidate.id);
|
|
153
140
|
if (!eventId) throw new TwitchIngressPermanentError("Twitch ingress event is missing its message id.");
|
|
154
|
-
const rawChannel =
|
|
141
|
+
const rawChannel = normalizeNullableString(candidate.channel);
|
|
155
142
|
const channel = rawChannel ? normalizeTwitchChannel(rawChannel) : "";
|
|
156
143
|
if (!channel) throw new TwitchIngressPermanentError("Twitch ingress event is missing its channel.");
|
|
157
144
|
return {
|
|
@@ -170,8 +157,8 @@ function deserializeTwitchIngressEvent(rawEvent) {
|
|
|
170
157
|
}
|
|
171
158
|
function normalizeClaimedTwitchMessage(event, claimedId) {
|
|
172
159
|
const candidate = event;
|
|
173
|
-
const username =
|
|
174
|
-
const rawChannel =
|
|
160
|
+
const username = normalizeNullableString(candidate.username);
|
|
161
|
+
const rawChannel = normalizeNullableString(candidate.channel);
|
|
175
162
|
if (!username || typeof candidate.message !== "string" || !rawChannel) throw new TwitchIngressPermanentError("Twitch ingress event shape is invalid.");
|
|
176
163
|
return {
|
|
177
164
|
...candidate,
|
|
@@ -196,7 +183,6 @@ function createTwitchIngress(options) {
|
|
|
196
183
|
const queue = options.queue ?? getTwitchRuntime().state.openChannelIngressQueue({ accountId: options.accountId });
|
|
197
184
|
const shutdown = new AbortController();
|
|
198
185
|
let stopped = false;
|
|
199
|
-
const deferredClaims = /* @__PURE__ */ new Map();
|
|
200
186
|
const monitor = createChannelIngressMonitor({
|
|
201
187
|
queue,
|
|
202
188
|
inspect: (message) => inspectTwitchIngressEvent(message),
|
|
@@ -210,17 +196,6 @@ function createTwitchIngress(options) {
|
|
|
210
196
|
deliver: async (rawEvent, lifecycle, claim) => {
|
|
211
197
|
const message = normalizeClaimedTwitchMessage(rawEvent, claim.id);
|
|
212
198
|
let handedOff = false;
|
|
213
|
-
let resolveDeferredClaim;
|
|
214
|
-
const deferredClaim = new Promise((resolve) => {
|
|
215
|
-
resolveDeferredClaim = resolve;
|
|
216
|
-
});
|
|
217
|
-
let deferredClaimSettled = false;
|
|
218
|
-
const settleDeferredClaim = () => {
|
|
219
|
-
if (deferredClaimSettled) return;
|
|
220
|
-
deferredClaimSettled = true;
|
|
221
|
-
if (deferredClaims.get(claim.id) === deferredClaim) deferredClaims.delete(claim.id);
|
|
222
|
-
resolveDeferredClaim();
|
|
223
|
-
};
|
|
224
199
|
const deliveryAbortSignal = AbortSignal.any([lifecycle.abortSignal, shutdown.signal]);
|
|
225
200
|
try {
|
|
226
201
|
await options.deliver(message, {
|
|
@@ -228,24 +203,15 @@ function createTwitchIngress(options) {
|
|
|
228
203
|
abortSignal: deliveryAbortSignal,
|
|
229
204
|
onAdopted: async () => {
|
|
230
205
|
handedOff = true;
|
|
231
|
-
|
|
232
|
-
await lifecycle.onAdopted();
|
|
233
|
-
} finally {
|
|
234
|
-
settleDeferredClaim();
|
|
235
|
-
}
|
|
206
|
+
await lifecycle.onAdopted();
|
|
236
207
|
},
|
|
237
208
|
onDeferred: () => {
|
|
238
209
|
handedOff = true;
|
|
239
|
-
if (!deferredClaimSettled) deferredClaims.set(claim.id, deferredClaim);
|
|
240
210
|
lifecycle.onDeferred();
|
|
241
211
|
},
|
|
242
212
|
onAbandoned: async () => {
|
|
243
213
|
handedOff = true;
|
|
244
|
-
|
|
245
|
-
await lifecycle.onAbandoned();
|
|
246
|
-
} finally {
|
|
247
|
-
settleDeferredClaim();
|
|
248
|
-
}
|
|
214
|
+
await lifecycle.onAbandoned();
|
|
249
215
|
}
|
|
250
216
|
});
|
|
251
217
|
} catch (error) {
|
|
@@ -260,13 +226,11 @@ function createTwitchIngress(options) {
|
|
|
260
226
|
error: stoppedError()
|
|
261
227
|
};
|
|
262
228
|
},
|
|
229
|
+
deferredClaims: "manual",
|
|
263
230
|
pollIntervalMs: options.pollIntervalMs ?? TWITCH_INGRESS_DRAIN_INTERVAL_MS,
|
|
264
231
|
retention: {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
completedMaxEntries: TWITCH_INGRESS_COMPLETED_MAX_ENTRIES,
|
|
268
|
-
failedTtlMs: TWITCH_INGRESS_FAILED_TTL_MS,
|
|
269
|
-
failedMaxEntries: TWITCH_INGRESS_FAILED_MAX_ENTRIES
|
|
232
|
+
completedMaxEntries: 1e3,
|
|
233
|
+
failedMaxEntries: 1e3
|
|
270
234
|
},
|
|
271
235
|
drain: {
|
|
272
236
|
resolveNonRetryableFailure: (error) => {
|
|
@@ -301,7 +265,7 @@ function createTwitchIngress(options) {
|
|
|
301
265
|
shutdown.abort(stoppedError());
|
|
302
266
|
await monitor.pause();
|
|
303
267
|
await monitor.waitForIdle();
|
|
304
|
-
await
|
|
268
|
+
await monitor.waitForDeferredClaims();
|
|
305
269
|
await monitor.stop();
|
|
306
270
|
})();
|
|
307
271
|
return stopTask;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DEFAULT_ACCOUNT_ID, c as resolveTwitchAccountContext, d as generateMessageId, f as isAccountConfigured, g as resolveTwitchToken, h as normalizeTwitchChannel, i as twitchSetupWizard, l as resolveTwitchSnapshotAccountId, m as normalizeToken, n as twitchSetupContract, o as getAccountConfig, p as missingTargetError, s as resolveDefaultTwitchAccountId, t as twitchSetupAdapter, u as twitchConfigAdapter } from "./setup-surface-
|
|
1
|
+
import { a as DEFAULT_ACCOUNT_ID, c as resolveTwitchAccountContext, d as generateMessageId, f as isAccountConfigured, g as resolveTwitchToken, h as normalizeTwitchChannel, i as twitchSetupWizard, l as resolveTwitchSnapshotAccountId, m as normalizeToken, n as twitchSetupContract, o as getAccountConfig, p as missingTargetError, s as resolveDefaultTwitchAccountId, t as twitchSetupAdapter, u as twitchConfigAdapter } from "./setup-surface-BzftVkdX.js";
|
|
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";
|
|
@@ -1374,7 +1374,7 @@ const twitchPlugin = createChatChannelPlugin({
|
|
|
1374
1374
|
await runPassiveAccountLifecycle({
|
|
1375
1375
|
abortSignal: ctx.abortSignal,
|
|
1376
1376
|
start: async () => {
|
|
1377
|
-
const { monitorTwitchProvider } = await import("./monitor-
|
|
1377
|
+
const { monitorTwitchProvider } = await import("./monitor-BoEAKAWR.js");
|
|
1378
1378
|
return monitorTwitchProvider({
|
|
1379
1379
|
account,
|
|
1380
1380
|
accountId,
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as twitchSetupPlugin } from "./setup-surface-
|
|
1
|
+
import { r as twitchSetupPlugin } from "./setup-surface-BzftVkdX.js";
|
|
2
2
|
export { twitchSetupPlugin };
|
|
@@ -305,26 +305,21 @@ async function promptToken(prompter, account, envToken) {
|
|
|
305
305
|
}
|
|
306
306
|
})).trim();
|
|
307
307
|
}
|
|
308
|
-
async function
|
|
308
|
+
async function promptRequiredTwitchAccountValue(prompter, message, initialValue) {
|
|
309
309
|
return (await prompter.text({
|
|
310
|
-
message
|
|
311
|
-
initialValue:
|
|
310
|
+
message,
|
|
311
|
+
initialValue: initialValue ?? "",
|
|
312
312
|
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
313
313
|
})).trim();
|
|
314
314
|
}
|
|
315
|
+
async function promptUsername(prompter, account) {
|
|
316
|
+
return await promptRequiredTwitchAccountValue(prompter, t("wizard.twitch.botUsernamePrompt"), account?.username);
|
|
317
|
+
}
|
|
315
318
|
async function promptClientId(prompter, account) {
|
|
316
|
-
return
|
|
317
|
-
message: t("wizard.twitch.clientIdPrompt"),
|
|
318
|
-
initialValue: account?.clientId ?? "",
|
|
319
|
-
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
320
|
-
})).trim();
|
|
319
|
+
return await promptRequiredTwitchAccountValue(prompter, t("wizard.twitch.clientIdPrompt"), account?.clientId);
|
|
321
320
|
}
|
|
322
321
|
async function promptChannelName(prompter, account) {
|
|
323
|
-
return
|
|
324
|
-
message: t("wizard.twitch.channelJoinPrompt"),
|
|
325
|
-
initialValue: account?.channel ?? "",
|
|
326
|
-
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
327
|
-
})).trim();
|
|
322
|
+
return await promptRequiredTwitchAccountValue(prompter, t("wizard.twitch.channelJoinPrompt"), account?.channel);
|
|
328
323
|
}
|
|
329
324
|
async function promptRefreshTokenSetup(prompter, account) {
|
|
330
325
|
if (!await prompter.confirm({
|
|
@@ -332,16 +327,8 @@ async function promptRefreshTokenSetup(prompter, account) {
|
|
|
332
327
|
initialValue: Boolean(account?.clientSecret && account?.refreshToken)
|
|
333
328
|
})) return {};
|
|
334
329
|
return {
|
|
335
|
-
clientSecret:
|
|
336
|
-
|
|
337
|
-
initialValue: account?.clientSecret ?? "",
|
|
338
|
-
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
339
|
-
})).trim() || void 0,
|
|
340
|
-
refreshToken: (await prompter.text({
|
|
341
|
-
message: t("wizard.twitch.refreshTokenInputPrompt"),
|
|
342
|
-
initialValue: account?.refreshToken ?? "",
|
|
343
|
-
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
344
|
-
})).trim() || void 0
|
|
330
|
+
clientSecret: await promptRequiredTwitchAccountValue(prompter, t("wizard.twitch.clientSecretPrompt"), account?.clientSecret) || void 0,
|
|
331
|
+
refreshToken: await promptRequiredTwitchAccountValue(prompter, t("wizard.twitch.refreshTokenInputPrompt"), account?.refreshToken) || void 0
|
|
345
332
|
};
|
|
346
333
|
}
|
|
347
334
|
async function configureWithEnvToken(cfg, prompter, account, envToken, forceAllowFrom, dmPolicy, accountId = resolveSetupAccountId(cfg)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/twitch",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.7",
|
|
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.7.2-beta.
|
|
33
|
+
"pluginApi": ">=2026.7.2-beta.7"
|
|
34
34
|
},
|
|
35
35
|
"build": {
|
|
36
|
-
"openclawVersion": "2026.7.2-beta.
|
|
36
|
+
"openclawVersion": "2026.7.2-beta.7"
|
|
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.7.2-beta.
|
|
74
|
+
"openclaw": ">=2026.7.2-beta.7"
|
|
75
75
|
},
|
|
76
76
|
"peerDependenciesMeta": {
|
|
77
77
|
"openclaw": {
|