@openclaw/irc 2026.9.1-beta.1 → 2026.9.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 +1 -1
- package/dist/{channel-W4DLS5ip.js → channel-BVYDQ8Fk.js} +164 -82
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-runtime-CA62Mbrh.js → channel-runtime-Ywcn0k9_.js} +7 -76
- package/dist/{config-schema-BDXGjxOr.js → config-schema-DcYE4WjJ.js} +5 -4
- package/dist/doctor-contract-api.js +34 -4
- package/openclaw.plugin.json +0 -12
- package/package.json +4 -4
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as listIrcAccountIds, g as listEnabledIrcAccounts, n as ircSetupWizard, r as ircSetupAdapter, t as ircPlugin, v as resolveDefaultIrcAccountId, y as resolveIrcAccount } from "./channel-BVYDQ8Fk.js";
|
|
2
2
|
import { n as setIrcRuntime } from "./runtime-xy-FcjJC.js";
|
|
3
3
|
export { ircPlugin, ircSetupAdapter, ircSetupWizard, listEnabledIrcAccounts, listIrcAccountIds, resolveDefaultIrcAccountId, resolveIrcAccount, setIrcRuntime };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { t as IrcChannelConfigSchema } from "./config-schema-
|
|
1
|
+
import { t as IrcChannelConfigSchema } from "./config-schema-DcYE4WjJ.js";
|
|
2
2
|
import { t as getIrcRuntime } from "./runtime-xy-FcjJC.js";
|
|
3
3
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-D_DC3YWj.js";
|
|
4
4
|
import { createAccountListHelpers, describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
5
5
|
import { formatNormalizedAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
|
6
6
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
7
7
|
import { buildChannelOutboundSessionRoute, createChatChannelPlugin, parseOptionalDelimitedEntries } from "openclaw/plugin-sdk/channel-core";
|
|
8
|
+
import { defineStableChannelIngressIdentity, identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
8
9
|
import { buildMutableAllowEntryDetector, collectStandardAllowlistLists, createAllowlistProviderOpenWarningCollector, createConditionalWarningCollector, createDangerousNameMatchingMutableAllowlistWarningCollector, resolveScopeKeyCaseInsensitive, resolveScopeRequireMention, resolveScopeToolsPolicy } from "openclaw/plugin-sdk/channel-policy";
|
|
9
10
|
import { createChannelDirectoryAdapter, createResolvedDirectoryEntriesLister } from "openclaw/plugin-sdk/directory-runtime";
|
|
10
11
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
@@ -188,9 +189,12 @@ function listEnabledIrcAccounts(cfg) {
|
|
|
188
189
|
accountId
|
|
189
190
|
})).filter((account) => account.enabled);
|
|
190
191
|
}
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region extensions/irc/src/doctor.ts
|
|
194
|
+
const isIrcMutableAllowEntry = buildMutableAllowEntryDetector({ stableIdPattern: /^(?:(?:irc|user):)*[^@]*@/i });
|
|
191
195
|
const collectIrcMutableAllowlistWarnings = createDangerousNameMatchingMutableAllowlistWarningCollector({
|
|
192
196
|
channel: "irc",
|
|
193
|
-
detector:
|
|
197
|
+
detector: isIrcMutableAllowEntry,
|
|
194
198
|
collectLists: (scope) => collectStandardAllowlistLists(scope, {
|
|
195
199
|
includeGroups: true,
|
|
196
200
|
groupField: "allowFrom"
|
|
@@ -198,7 +202,7 @@ const collectIrcMutableAllowlistWarnings = createDangerousNameMatchingMutableAll
|
|
|
198
202
|
});
|
|
199
203
|
//#endregion
|
|
200
204
|
//#region extensions/irc/src/gateway.ts
|
|
201
|
-
const loadIrcChannelRuntime$1 = createLazyRuntimeModule(() => import("./channel-runtime-
|
|
205
|
+
const loadIrcChannelRuntime$1 = createLazyRuntimeModule(() => import("./channel-runtime-Ywcn0k9_.js"));
|
|
202
206
|
async function startIrcGatewayAccount(ctx) {
|
|
203
207
|
const account = ctx.account;
|
|
204
208
|
const statusSink = createAccountStatusSink({
|
|
@@ -223,18 +227,6 @@ async function startIrcGatewayAccount(ctx) {
|
|
|
223
227
|
});
|
|
224
228
|
}
|
|
225
229
|
//#endregion
|
|
226
|
-
//#region extensions/irc/src/outbound-base.ts
|
|
227
|
-
function sanitizeIrcAssistantText(text) {
|
|
228
|
-
return sanitizeForPlainText(sanitizeAssistantVisibleText(text));
|
|
229
|
-
}
|
|
230
|
-
const ircOutboundBaseAdapter = {
|
|
231
|
-
deliveryMode: "direct",
|
|
232
|
-
chunker: chunkTextForOutbound,
|
|
233
|
-
chunkerMode: "markdown",
|
|
234
|
-
textChunkLimit: 350,
|
|
235
|
-
sanitizeText: ({ text }) => sanitizeIrcAssistantText(text)
|
|
236
|
-
};
|
|
237
|
-
//#endregion
|
|
238
230
|
//#region extensions/irc/src/control-chars.ts
|
|
239
231
|
function isIrcControlChar(charCode) {
|
|
240
232
|
return charCode <= 31 || charCode === 127;
|
|
@@ -249,8 +241,158 @@ function stripIrcControlChars(value) {
|
|
|
249
241
|
return out;
|
|
250
242
|
}
|
|
251
243
|
//#endregion
|
|
252
|
-
//#region extensions/irc/src/
|
|
244
|
+
//#region extensions/irc/src/normalize.ts
|
|
253
245
|
const IRC_TARGET_PATTERN$1 = /^[^\s:]+$/u;
|
|
246
|
+
function isChannelTarget(target) {
|
|
247
|
+
return target.startsWith("#") || target.startsWith("&");
|
|
248
|
+
}
|
|
249
|
+
function normalizeIrcMessagingTarget(raw) {
|
|
250
|
+
const trimmed = raw.trim();
|
|
251
|
+
if (!trimmed) return;
|
|
252
|
+
let target = trimmed;
|
|
253
|
+
if (normalizeLowercaseStringOrEmpty(target).startsWith("irc:")) target = target.slice(4).trim();
|
|
254
|
+
if (normalizeLowercaseStringOrEmpty(target).startsWith("channel:")) {
|
|
255
|
+
target = target.slice(8).trim();
|
|
256
|
+
if (!target.startsWith("#") && !target.startsWith("&")) target = `#${target}`;
|
|
257
|
+
}
|
|
258
|
+
if (normalizeLowercaseStringOrEmpty(target).startsWith("user:")) target = target.slice(5).trim();
|
|
259
|
+
if (!target || !looksLikeIrcTargetId(target)) return;
|
|
260
|
+
return target;
|
|
261
|
+
}
|
|
262
|
+
function resolveIrcOutboundSessionRoute(params) {
|
|
263
|
+
const target = normalizeIrcMessagingTarget(params.target);
|
|
264
|
+
if (!target) return null;
|
|
265
|
+
const chatType = isChannelTarget(target) ? "group" : "direct";
|
|
266
|
+
return buildChannelOutboundSessionRoute({
|
|
267
|
+
cfg: params.cfg,
|
|
268
|
+
agentId: params.agentId,
|
|
269
|
+
channel: "irc",
|
|
270
|
+
accountId: params.accountId,
|
|
271
|
+
recipientSessionExact: chatType === "direct" ? "direct-alias" : false,
|
|
272
|
+
peer: {
|
|
273
|
+
kind: chatType,
|
|
274
|
+
id: target
|
|
275
|
+
},
|
|
276
|
+
chatType,
|
|
277
|
+
from: `irc:${target}`,
|
|
278
|
+
to: target
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
function looksLikeIrcTargetId(raw) {
|
|
282
|
+
const trimmed = raw.trim();
|
|
283
|
+
if (!trimmed) return false;
|
|
284
|
+
if (hasIrcControlChars(trimmed)) return false;
|
|
285
|
+
return IRC_TARGET_PATTERN$1.test(trimmed);
|
|
286
|
+
}
|
|
287
|
+
function normalizeIrcAllowEntry(raw) {
|
|
288
|
+
let value = normalizeLowercaseStringOrEmpty(raw);
|
|
289
|
+
if (!value) return "";
|
|
290
|
+
if (value.startsWith("irc:")) value = value.slice(4);
|
|
291
|
+
if (value.startsWith("user:")) value = value.slice(5);
|
|
292
|
+
return value.trim();
|
|
293
|
+
}
|
|
294
|
+
function buildIrcAllowlistCandidates(message, params) {
|
|
295
|
+
const nick = normalizeLowercaseStringOrEmpty(message.senderNick);
|
|
296
|
+
const user = normalizeOptionalLowercaseString(message.senderUser);
|
|
297
|
+
const host = normalizeOptionalLowercaseString(message.senderHost);
|
|
298
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
299
|
+
if (nick && params?.allowNameMatching === true) candidates.add(nick);
|
|
300
|
+
if (nick && user) candidates.add(`${nick}!${user}`);
|
|
301
|
+
if (nick && host) candidates.add(`${nick}@${host}`);
|
|
302
|
+
if (nick && user && host) candidates.add(`${nick}!${user}@${host}`);
|
|
303
|
+
return [...candidates];
|
|
304
|
+
}
|
|
305
|
+
const ircIngressIdentity = defineStableChannelIngressIdentity({
|
|
306
|
+
key: "irc-id",
|
|
307
|
+
authentication: "asserted",
|
|
308
|
+
normalizeEntry: normalizeIrcStableEntry,
|
|
309
|
+
normalizeSubject: normalizeLowercaseStringOrEmpty,
|
|
310
|
+
sensitivity: "pii",
|
|
311
|
+
aliases: [
|
|
312
|
+
{
|
|
313
|
+
key: "irc-id-nick-user",
|
|
314
|
+
kind: "stable-id",
|
|
315
|
+
normalizeEntry: normalizeIrcNickUserEntry,
|
|
316
|
+
normalizeSubject: normalizeLowercaseStringOrEmpty,
|
|
317
|
+
authentication: "mutable",
|
|
318
|
+
sensitivity: "pii"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
key: "irc-id-nick-host",
|
|
322
|
+
kind: "stable-id",
|
|
323
|
+
authentication: "asserted",
|
|
324
|
+
normalizeEntry: normalizeIrcNickHostEntry,
|
|
325
|
+
normalizeSubject: normalizeLowercaseStringOrEmpty,
|
|
326
|
+
sensitivity: "pii"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
key: "irc-nick",
|
|
330
|
+
kind: "plugin:irc-nick",
|
|
331
|
+
normalizeEntry: normalizeIrcNickEntry,
|
|
332
|
+
normalizeSubject: normalizeLowercaseStringOrEmpty,
|
|
333
|
+
authentication: "mutable",
|
|
334
|
+
sensitivity: "pii"
|
|
335
|
+
}
|
|
336
|
+
],
|
|
337
|
+
isWildcardEntry: (entry) => normalizeIrcAllowEntry(entry) === "*",
|
|
338
|
+
resolveEntryId: ({ entryIndex, fieldKey }) => `irc-entry-${entryIndex + 1}:${fieldKey === "irc-nick" ? "nick" : "id"}`
|
|
339
|
+
});
|
|
340
|
+
function isBareNick(value) {
|
|
341
|
+
return !value.includes("!") && !value.includes("@");
|
|
342
|
+
}
|
|
343
|
+
function hasVerifiedHost(value) {
|
|
344
|
+
return value.includes("@");
|
|
345
|
+
}
|
|
346
|
+
function isHostlessNickUser(value) {
|
|
347
|
+
return value.includes("!") && !value.includes("@");
|
|
348
|
+
}
|
|
349
|
+
function normalizeIrcStableEntry(value) {
|
|
350
|
+
const normalized = normalizeIrcAllowEntry(value);
|
|
351
|
+
if (!normalized.includes("!") || !hasVerifiedHost(normalized)) return null;
|
|
352
|
+
return normalized;
|
|
353
|
+
}
|
|
354
|
+
function normalizeIrcNickHostEntry(value) {
|
|
355
|
+
const normalized = normalizeIrcAllowEntry(value);
|
|
356
|
+
return !normalized.includes("!") && hasVerifiedHost(normalized) ? normalized : null;
|
|
357
|
+
}
|
|
358
|
+
function normalizeIrcNickUserEntry(value) {
|
|
359
|
+
const normalized = normalizeIrcAllowEntry(value);
|
|
360
|
+
if (!normalized || normalized === "*" || !isHostlessNickUser(normalized)) return null;
|
|
361
|
+
return normalized;
|
|
362
|
+
}
|
|
363
|
+
function normalizeIrcNickEntry(value) {
|
|
364
|
+
const normalized = normalizeIrcAllowEntry(value);
|
|
365
|
+
if (!normalized || normalized === "*" || !isBareNick(normalized)) return null;
|
|
366
|
+
return normalized;
|
|
367
|
+
}
|
|
368
|
+
function createIrcIngressSubject(message) {
|
|
369
|
+
const candidates = buildIrcAllowlistCandidates(message, { allowNameMatching: true });
|
|
370
|
+
const stableCandidates = candidates.filter((candidate) => hasVerifiedHost(candidate));
|
|
371
|
+
const nick = normalizeLowercaseStringOrEmpty(message.senderNick);
|
|
372
|
+
return {
|
|
373
|
+
stableId: stableCandidates[stableCandidates.length - 1] ?? nick,
|
|
374
|
+
aliases: {
|
|
375
|
+
"irc-id-nick-user": candidates.find((candidate) => isHostlessNickUser(candidate)),
|
|
376
|
+
"irc-id-nick-host": stableCandidates.find((candidate) => !candidate.includes("!") && candidate.includes("@")),
|
|
377
|
+
"irc-nick": nick
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region extensions/irc/src/outbound-base.ts
|
|
383
|
+
function sanitizeIrcAssistantText(text) {
|
|
384
|
+
return sanitizeForPlainText(sanitizeAssistantVisibleText(text));
|
|
385
|
+
}
|
|
386
|
+
const ircOutboundBaseAdapter = {
|
|
387
|
+
deliveryMode: "direct",
|
|
388
|
+
chunker: chunkTextForOutbound,
|
|
389
|
+
chunkerMode: "markdown",
|
|
390
|
+
textChunkLimit: 350,
|
|
391
|
+
sanitizeText: ({ text }) => sanitizeIrcAssistantText(text)
|
|
392
|
+
};
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region extensions/irc/src/protocol.ts
|
|
395
|
+
const IRC_TARGET_PATTERN = /^[^\s:]+$/u;
|
|
254
396
|
function parseIrcLine(line) {
|
|
255
397
|
const raw = line.replace(/[\r\n]+/g, "").trim();
|
|
256
398
|
if (!raw) return null;
|
|
@@ -329,7 +471,7 @@ function sanitizeIrcTarget(raw) {
|
|
|
329
471
|
if (!decoded) throw new Error("IRC target is required");
|
|
330
472
|
if (decoded !== decoded.trim()) throw new Error(`Invalid IRC target: ${raw}`);
|
|
331
473
|
if (hasIrcControlChars(decoded)) throw new Error(`Invalid IRC target: ${raw}`);
|
|
332
|
-
if (!IRC_TARGET_PATTERN
|
|
474
|
+
if (!IRC_TARGET_PATTERN.test(decoded)) throw new Error(`Invalid IRC target: ${raw}`);
|
|
333
475
|
return decoded;
|
|
334
476
|
}
|
|
335
477
|
function makeIrcMessageId() {
|
|
@@ -661,68 +803,6 @@ function buildIrcConnectOptions(account, overrides = {}) {
|
|
|
661
803
|
};
|
|
662
804
|
}
|
|
663
805
|
//#endregion
|
|
664
|
-
//#region extensions/irc/src/normalize.ts
|
|
665
|
-
const IRC_TARGET_PATTERN = /^[^\s:]+$/u;
|
|
666
|
-
function isChannelTarget(target) {
|
|
667
|
-
return target.startsWith("#") || target.startsWith("&");
|
|
668
|
-
}
|
|
669
|
-
function normalizeIrcMessagingTarget(raw) {
|
|
670
|
-
const trimmed = raw.trim();
|
|
671
|
-
if (!trimmed) return;
|
|
672
|
-
let target = trimmed;
|
|
673
|
-
if (normalizeLowercaseStringOrEmpty(target).startsWith("irc:")) target = target.slice(4).trim();
|
|
674
|
-
if (normalizeLowercaseStringOrEmpty(target).startsWith("channel:")) {
|
|
675
|
-
target = target.slice(8).trim();
|
|
676
|
-
if (!target.startsWith("#") && !target.startsWith("&")) target = `#${target}`;
|
|
677
|
-
}
|
|
678
|
-
if (normalizeLowercaseStringOrEmpty(target).startsWith("user:")) target = target.slice(5).trim();
|
|
679
|
-
if (!target || !looksLikeIrcTargetId(target)) return;
|
|
680
|
-
return target;
|
|
681
|
-
}
|
|
682
|
-
function resolveIrcOutboundSessionRoute(params) {
|
|
683
|
-
const target = normalizeIrcMessagingTarget(params.target);
|
|
684
|
-
if (!target) return null;
|
|
685
|
-
const chatType = isChannelTarget(target) ? "group" : "direct";
|
|
686
|
-
return buildChannelOutboundSessionRoute({
|
|
687
|
-
cfg: params.cfg,
|
|
688
|
-
agentId: params.agentId,
|
|
689
|
-
channel: "irc",
|
|
690
|
-
accountId: params.accountId,
|
|
691
|
-
recipientSessionExact: chatType === "direct" ? "direct-alias" : false,
|
|
692
|
-
peer: {
|
|
693
|
-
kind: chatType,
|
|
694
|
-
id: target
|
|
695
|
-
},
|
|
696
|
-
chatType,
|
|
697
|
-
from: `irc:${target}`,
|
|
698
|
-
to: target
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
function looksLikeIrcTargetId(raw) {
|
|
702
|
-
const trimmed = raw.trim();
|
|
703
|
-
if (!trimmed) return false;
|
|
704
|
-
if (hasIrcControlChars(trimmed)) return false;
|
|
705
|
-
return IRC_TARGET_PATTERN.test(trimmed);
|
|
706
|
-
}
|
|
707
|
-
function normalizeIrcAllowEntry(raw) {
|
|
708
|
-
let value = normalizeLowercaseStringOrEmpty(raw);
|
|
709
|
-
if (!value) return "";
|
|
710
|
-
if (value.startsWith("irc:")) value = value.slice(4);
|
|
711
|
-
if (value.startsWith("user:")) value = value.slice(5);
|
|
712
|
-
return value.trim();
|
|
713
|
-
}
|
|
714
|
-
function buildIrcAllowlistCandidates(message, params) {
|
|
715
|
-
const nick = normalizeLowercaseStringOrEmpty(message.senderNick);
|
|
716
|
-
const user = normalizeOptionalLowercaseString(message.senderUser);
|
|
717
|
-
const host = normalizeOptionalLowercaseString(message.senderHost);
|
|
718
|
-
const candidates = /* @__PURE__ */ new Set();
|
|
719
|
-
if (nick && params?.allowNameMatching === true) candidates.add(nick);
|
|
720
|
-
if (nick && user) candidates.add(`${nick}!${user}`);
|
|
721
|
-
if (nick && host) candidates.add(`${nick}@${host}`);
|
|
722
|
-
if (nick && user && host) candidates.add(`${nick}!${user}@${host}`);
|
|
723
|
-
return [...candidates];
|
|
724
|
-
}
|
|
725
|
-
//#endregion
|
|
726
806
|
//#region extensions/irc/src/send.ts
|
|
727
807
|
function recordIrcOutboundActivity(accountId) {
|
|
728
808
|
try {
|
|
@@ -1317,7 +1397,8 @@ const ircSetupWizard = {
|
|
|
1317
1397
|
return String(defaultPort);
|
|
1318
1398
|
},
|
|
1319
1399
|
validate: ({ value }) => {
|
|
1320
|
-
const
|
|
1400
|
+
const raw = normalizeStringifiedOptionalString(value) ?? "";
|
|
1401
|
+
const parsed = parseStrictPositiveInteger(raw);
|
|
1321
1402
|
return parsed !== void 0 && parsed <= 65535 ? void 0 : "Use a port between 1 and 65535";
|
|
1322
1403
|
},
|
|
1323
1404
|
normalizeValue: ({ value }) => String(parsePort(value, 6697)),
|
|
@@ -1489,7 +1570,7 @@ const meta = {
|
|
|
1489
1570
|
systemImage: "number",
|
|
1490
1571
|
markdownCapable: true
|
|
1491
1572
|
};
|
|
1492
|
-
const loadIrcChannelRuntime = createLazyRuntimeModule(() => import("./channel-runtime-
|
|
1573
|
+
const loadIrcChannelRuntime = createLazyRuntimeModule(() => import("./channel-runtime-Ywcn0k9_.js"));
|
|
1493
1574
|
function normalizePairingTarget(raw) {
|
|
1494
1575
|
const normalized = normalizeIrcAllowEntry(raw);
|
|
1495
1576
|
if (!normalized) return "";
|
|
@@ -1543,6 +1624,7 @@ const resolveIrcDmPolicy = createScopedDmSecurityResolver({
|
|
|
1543
1624
|
resolvePolicy: (account) => account.config.dmPolicy,
|
|
1544
1625
|
resolveAllowFrom: (account) => account.config.allowFrom,
|
|
1545
1626
|
policyPathSuffix: "dmPolicy",
|
|
1627
|
+
classifyEntryAuthentication: identityEntryAuthenticationClassifier(ircIngressIdentity),
|
|
1546
1628
|
normalizeEntry: (raw) => normalizeIrcAllowEntry(raw)
|
|
1547
1629
|
});
|
|
1548
1630
|
const collectIrcGroupPolicyWarnings = createAllowlistProviderOpenWarningCollector({
|
|
@@ -1747,4 +1829,4 @@ const ircPlugin = createChatChannelPlugin({
|
|
|
1747
1829
|
}
|
|
1748
1830
|
});
|
|
1749
1831
|
//#endregion
|
|
1750
|
-
export {
|
|
1832
|
+
export { listIrcAccountIds as _, resolveIrcGroupRequireMention as a, connectIrcClient as c, sanitizeIrcAssistantText as d, createIrcIngressSubject as f, listEnabledIrcAccounts as g, normalizeIrcAllowEntry as h, resolveIrcGroupMatch as i, parseIrcLine as l, isChannelTarget as m, ircSetupWizard as n, sendMessageIrc as o, ircIngressIdentity as p, ircSetupAdapter as r, buildIrcConnectOptions as s, ircPlugin as t, parseIrcPrefix as u, resolveDefaultIrcAccountId as v, resolveIrcAccount as y };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as IrcChannelConfigSchema } from "./config-schema-
|
|
1
|
+
import { t as IrcChannelConfigSchema } from "./config-schema-DcYE4WjJ.js";
|
|
2
2
|
export { IrcChannelConfigSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ircPlugin } from "./channel-
|
|
1
|
+
import { t as ircPlugin } from "./channel-BVYDQ8Fk.js";
|
|
2
2
|
export { ircPlugin };
|
|
@@ -1,51 +1,18 @@
|
|
|
1
|
-
import { a as resolveIrcGroupRequireMention, c as
|
|
1
|
+
import { a as resolveIrcGroupRequireMention, c as connectIrcClient, d as sanitizeIrcAssistantText, f as createIrcIngressSubject, h as normalizeIrcAllowEntry, i as resolveIrcGroupMatch, l as parseIrcLine, m as isChannelTarget, o as sendMessageIrc, p as ircIngressIdentity, s as buildIrcConnectOptions, u as parseIrcPrefix, y as resolveIrcAccount } from "./channel-BVYDQ8Fk.js";
|
|
2
2
|
import { t as getIrcRuntime } from "./runtime-xy-FcjJC.js";
|
|
3
|
+
import { channelIngressRoutes, createChannelIngressResolver } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
3
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
import { bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
6
|
import { randomUUID } from "node:crypto";
|
|
6
7
|
import { resolveLoggerBackedRuntime } from "openclaw/plugin-sdk/extension-shared";
|
|
7
8
|
import { channelReadyPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
8
9
|
import { logInboundDrop, resolveChannelInboundRouteEnvelope } from "openclaw/plugin-sdk/channel-inbound";
|
|
9
|
-
import { channelIngressRoutes, createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
10
10
|
import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
|
|
11
11
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
12
12
|
import { deliverFormattedTextWithAttachments } from "openclaw/plugin-sdk/reply-payload";
|
|
13
13
|
import { GROUP_POLICY_BLOCKED_LABEL, resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
14
14
|
//#region extensions/irc/src/inbound.ts
|
|
15
15
|
const CHANNEL_ID = "irc";
|
|
16
|
-
const ircIngressIdentity = defineStableChannelIngressIdentity({
|
|
17
|
-
key: "irc-id",
|
|
18
|
-
normalizeEntry: normalizeIrcStableEntry,
|
|
19
|
-
normalizeSubject: normalizeLowercaseStringOrEmpty,
|
|
20
|
-
sensitivity: "pii",
|
|
21
|
-
aliases: [
|
|
22
|
-
{
|
|
23
|
-
key: "irc-id-nick-user",
|
|
24
|
-
kind: "stable-id",
|
|
25
|
-
normalizeEntry: normalizeIrcNickUserEntry,
|
|
26
|
-
normalizeSubject: normalizeLowercaseStringOrEmpty,
|
|
27
|
-
dangerous: true,
|
|
28
|
-
sensitivity: "pii"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
key: "irc-id-nick-host",
|
|
32
|
-
kind: "stable-id",
|
|
33
|
-
normalizeEntry: () => null,
|
|
34
|
-
normalizeSubject: normalizeLowercaseStringOrEmpty,
|
|
35
|
-
sensitivity: "pii"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
key: "irc-nick",
|
|
39
|
-
kind: "plugin:irc-nick",
|
|
40
|
-
normalizeEntry: normalizeIrcNickEntry,
|
|
41
|
-
normalizeSubject: normalizeLowercaseStringOrEmpty,
|
|
42
|
-
dangerous: true,
|
|
43
|
-
sensitivity: "pii"
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
isWildcardEntry: (entry) => normalizeIrcAllowEntry(entry) === "*",
|
|
47
|
-
resolveEntryId: ({ entryIndex, fieldKey }) => `irc-entry-${entryIndex + 1}:${fieldKey === "irc-nick" ? "nick" : "id"}`
|
|
48
|
-
});
|
|
49
16
|
const escapeIrcRegexLiteral = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
50
17
|
const IRC_NICK_CHARACTER = String.raw`[A-Za-z0-9_\-\[\]\\\x60^{}|~]`;
|
|
51
18
|
const IRC_RFC1459_CASE_EQUIVALENTS = /* @__PURE__ */ new Map([
|
|
@@ -64,46 +31,9 @@ function buildIrcNickMentionPattern(value) {
|
|
|
64
31
|
return equivalent ? `[${escapeIrcRegexLiteral(character)}${escapeIrcRegexLiteral(equivalent)}]` : escapeIrcRegexLiteral(character);
|
|
65
32
|
}).join("");
|
|
66
33
|
}
|
|
67
|
-
function isBareNick(value) {
|
|
68
|
-
return !value.includes("!") && !value.includes("@");
|
|
69
|
-
}
|
|
70
|
-
function hasVerifiedHost(value) {
|
|
71
|
-
return value.includes("@");
|
|
72
|
-
}
|
|
73
|
-
function isHostlessNickUser(value) {
|
|
74
|
-
return value.includes("!") && !value.includes("@");
|
|
75
|
-
}
|
|
76
|
-
function normalizeIrcStableEntry(value) {
|
|
77
|
-
const normalized = normalizeIrcAllowEntry(value);
|
|
78
|
-
if (!normalized || normalized === "*" || !hasVerifiedHost(normalized)) return null;
|
|
79
|
-
return normalized;
|
|
80
|
-
}
|
|
81
|
-
function normalizeIrcNickUserEntry(value) {
|
|
82
|
-
const normalized = normalizeIrcAllowEntry(value);
|
|
83
|
-
if (!normalized || normalized === "*" || !isHostlessNickUser(normalized)) return null;
|
|
84
|
-
return normalized;
|
|
85
|
-
}
|
|
86
|
-
function normalizeIrcNickEntry(value) {
|
|
87
|
-
const normalized = normalizeIrcAllowEntry(value);
|
|
88
|
-
if (!normalized || normalized === "*" || !isBareNick(normalized)) return null;
|
|
89
|
-
return normalized;
|
|
90
|
-
}
|
|
91
34
|
function hasEntries(entries) {
|
|
92
35
|
return normalizeStringEntries(entries).some((entry) => normalizeIrcAllowEntry(entry));
|
|
93
36
|
}
|
|
94
|
-
function createIrcIngressSubject(message) {
|
|
95
|
-
const candidates = buildIrcAllowlistCandidates(message, { allowNameMatching: true });
|
|
96
|
-
const stableCandidates = candidates.filter((candidate) => hasVerifiedHost(candidate));
|
|
97
|
-
const nick = normalizeLowercaseStringOrEmpty(message.senderNick);
|
|
98
|
-
return {
|
|
99
|
-
stableId: stableCandidates[stableCandidates.length - 1] ?? nick,
|
|
100
|
-
aliases: {
|
|
101
|
-
"irc-id-nick-user": candidates.find((candidate) => isHostlessNickUser(candidate)),
|
|
102
|
-
"irc-id-nick-host": stableCandidates.find((candidate) => !candidate.includes("!") && candidate.includes("@")),
|
|
103
|
-
"irc-nick": nick
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
37
|
function routeDescriptorsForIrcGroup(params) {
|
|
108
38
|
if (!params.isGroup) return [];
|
|
109
39
|
return channelIngressRoutes(params.groupPolicy === "allowlist" && {
|
|
@@ -287,10 +217,11 @@ async function handleIrcInbound(params) {
|
|
|
287
217
|
});
|
|
288
218
|
return { kind: "completed" };
|
|
289
219
|
}
|
|
290
|
-
if (message.isGroup)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
220
|
+
if (message.isGroup) {
|
|
221
|
+
if (access.routeAccess.reason === "channel_not_allowlisted") runtime.log?.(`irc: drop channel ${message.target} (not allowlisted)`);
|
|
222
|
+
else if (access.routeAccess.reason === "channel_disabled") runtime.log?.(`irc: drop channel ${message.target} (disabled)`);
|
|
223
|
+
else runtime.log?.(`irc: drop group sender ${senderDisplay} (policy=${groupPolicy})`);
|
|
224
|
+
} else runtime.log?.(`irc: drop DM sender ${senderDisplay} (dmPolicy=${dmPolicy})`);
|
|
294
225
|
return { kind: "completed" };
|
|
295
226
|
}
|
|
296
227
|
if (turnAdoptionLifecycle?.abortSignal.aborted) return {
|
|
@@ -56,7 +56,7 @@ const IrcNickServSchema = z.object({
|
|
|
56
56
|
message: "channels.irc.nickserv.register=true requires channels.irc.nickserv.registerEmail"
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
-
const
|
|
59
|
+
const IrcAccountSchemaBase = z.object({
|
|
60
60
|
name: z.string().optional(),
|
|
61
61
|
enabled: z.boolean().optional(),
|
|
62
62
|
configWrites: z.boolean().optional(),
|
|
@@ -77,10 +77,10 @@ const IrcChannelConfigSchema = buildChannelConfigSchema(buildMultiAccountChannel
|
|
|
77
77
|
groupAllowFrom: z.array(z.union([z.string(), z.number()])).optional(),
|
|
78
78
|
groups: z.record(z.string(), ChannelGroupEntrySchema.optional()).optional(),
|
|
79
79
|
channels: z.array(z.string()).optional(),
|
|
80
|
-
mentionPatterns: z.array(z.string()).optional(),
|
|
81
80
|
markdown: MarkdownConfigSchema,
|
|
82
81
|
...ReplyRuntimeConfigSchemaShape
|
|
83
|
-
}).strict()
|
|
82
|
+
}).strict();
|
|
83
|
+
const IrcConfigSchema = buildMultiAccountChannelSchema(IrcAccountSchemaBase, {
|
|
84
84
|
optionalAccount: true,
|
|
85
85
|
refine: (value, ctx) => {
|
|
86
86
|
requireOpenAllowFrom({
|
|
@@ -91,6 +91,7 @@ const IrcChannelConfigSchema = buildChannelConfigSchema(buildMultiAccountChannel
|
|
|
91
91
|
message: "channels.irc.dmPolicy=\"open\" requires channels.irc.allowFrom to include \"*\""
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
})
|
|
94
|
+
});
|
|
95
|
+
const IrcChannelConfigSchema = buildChannelConfigSchema(IrcConfigSchema, { uiHints: ircChannelConfigUiHints });
|
|
95
96
|
//#endregion
|
|
96
97
|
export { IrcChannelConfigSchema as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineChannelAliasMigration } from "openclaw/plugin-sdk/runtime-doctor-migrations";
|
|
2
|
-
//#region extensions/irc/doctor-
|
|
1
|
+
import { asObjectRecord, defineChannelAliasMigration, stripRetiredChannelKeys } from "openclaw/plugin-sdk/runtime-doctor-migrations";
|
|
2
|
+
//#region extensions/irc/config-doctor-api.ts
|
|
3
3
|
const streamingAliasMigration = defineChannelAliasMigration({
|
|
4
4
|
channelId: "irc",
|
|
5
5
|
streaming: {
|
|
@@ -8,9 +8,39 @@ const streamingAliasMigration = defineChannelAliasMigration({
|
|
|
8
8
|
},
|
|
9
9
|
accountStreamingReplacesRoot: true
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const RETIRED_IRC_KEYS = /* @__PURE__ */ new Set(["mentionPatterns"]);
|
|
12
|
+
const legacyConfigRules = [
|
|
13
|
+
...streamingAliasMigration.legacyConfigRules,
|
|
14
|
+
{
|
|
15
|
+
path: ["channels", "irc"],
|
|
16
|
+
match: (value) => Object.hasOwn(asObjectRecord(value) ?? {}, "mentionPatterns"),
|
|
17
|
+
message: "channels.irc.mentionPatterns was accepted but never read; configure mention patterns with messages.groupChat.mentionPatterns. Run \"openclaw doctor --fix\"."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
path: [
|
|
21
|
+
"channels",
|
|
22
|
+
"irc",
|
|
23
|
+
"accounts"
|
|
24
|
+
],
|
|
25
|
+
match: (value) => Object.values(asObjectRecord(value) ?? {}).some((account) => Object.hasOwn(asObjectRecord(account) ?? {}, "mentionPatterns")),
|
|
26
|
+
message: "channels.irc.accounts.<id>.mentionPatterns was accepted but never read; configure mention patterns with messages.groupChat.mentionPatterns. Run \"openclaw doctor --fix\"."
|
|
27
|
+
}
|
|
28
|
+
];
|
|
12
29
|
function normalizeCompatibilityConfig({ cfg }) {
|
|
13
|
-
|
|
30
|
+
const aliases = streamingAliasMigration.normalizeChannelConfig({ cfg });
|
|
31
|
+
const changes = [...aliases.changes];
|
|
32
|
+
return {
|
|
33
|
+
config: stripRetiredChannelKeys({
|
|
34
|
+
cfg: aliases.config,
|
|
35
|
+
channelId: "irc",
|
|
36
|
+
keys: RETIRED_IRC_KEYS,
|
|
37
|
+
scope: "root-and-accounts",
|
|
38
|
+
onRemove: (removed) => {
|
|
39
|
+
changes.push(`Removed ${removed.pathPrefix}.${removed.key}; it was never read.`);
|
|
40
|
+
}
|
|
41
|
+
}).config,
|
|
42
|
+
changes
|
|
43
|
+
};
|
|
14
44
|
}
|
|
15
45
|
//#endregion
|
|
16
46
|
export { legacyConfigRules, normalizeCompatibilityConfig };
|
package/openclaw.plugin.json
CHANGED
|
@@ -247,12 +247,6 @@
|
|
|
247
247
|
"type": "string"
|
|
248
248
|
}
|
|
249
249
|
},
|
|
250
|
-
"mentionPatterns": {
|
|
251
|
-
"type": "array",
|
|
252
|
-
"items": {
|
|
253
|
-
"type": "string"
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
250
|
"markdown": {
|
|
257
251
|
"type": "object",
|
|
258
252
|
"properties": {
|
|
@@ -593,12 +587,6 @@
|
|
|
593
587
|
"type": "string"
|
|
594
588
|
}
|
|
595
589
|
},
|
|
596
|
-
"mentionPatterns": {
|
|
597
|
-
"type": "array",
|
|
598
|
-
"items": {
|
|
599
|
-
"type": "string"
|
|
600
|
-
}
|
|
601
|
-
},
|
|
602
590
|
"markdown": {
|
|
603
591
|
"type": "object",
|
|
604
592
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/irc",
|
|
3
|
-
"version": "2026.9.1
|
|
3
|
+
"version": "2026.9.1",
|
|
4
4
|
"description": "OpenClaw IRC channel plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"openclaw": {
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"compat": {
|
|
124
|
-
"pluginApi": ">=2026.9.1
|
|
124
|
+
"pluginApi": ">=2026.9.1"
|
|
125
125
|
},
|
|
126
126
|
"build": {
|
|
127
|
-
"openclawVersion": "2026.9.1
|
|
127
|
+
"openclawVersion": "2026.9.1",
|
|
128
128
|
"bundledDist": false
|
|
129
129
|
},
|
|
130
130
|
"release": {
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"README.md"
|
|
150
150
|
],
|
|
151
151
|
"peerDependencies": {
|
|
152
|
-
"openclaw": ">=2026.9.1
|
|
152
|
+
"openclaw": ">=2026.9.1"
|
|
153
153
|
},
|
|
154
154
|
"peerDependenciesMeta": {
|
|
155
155
|
"openclaw": {
|