@openclaw/tlon 2026.11.10-beta.3 → 2026.12.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.
@@ -1,5 +1,5 @@
1
1
  import { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "../runtime-api.js";
2
- import { t as tlonPlugin } from "./channel-BlmR93dV.mjs";
2
+ import { t as tlonPlugin } from "./channel-CXwKoHzW.mjs";
3
3
  import { n as setTlonRuntime } from "./runtime-ReERXJF_.mjs";
4
4
  import "../api.js";
5
5
  export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
@@ -1,5 +1,5 @@
1
1
  import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CfYeTj9o.mjs";
2
- import { c as resolveTlonAccount, f as parseTlonTarget, i as tlonSetupContract, l as formatTargetHint, n as createTlonSetupWizardBase, p as resolveTlonOutboundTarget, s as listTlonAccountIds, u as normalizeShip } from "./setup-core-BPDMrrMz.mjs";
2
+ import { c as resolveTlonAccount, d as normalizeShip, i as tlonSetupContract, l as TLON_CLUB_ID_RE, m as resolveTlonOutboundTarget, n as createTlonSetupWizardBase, p as parseTlonTarget, s as listTlonAccountIds, u as formatTargetHint } from "./setup-core-B5UNhQkj.mjs";
3
3
  import { buildChannelOutboundSessionRoute } from "openclaw/plugin-sdk/core";
4
4
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
5
5
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
@@ -12,6 +12,12 @@ import { chunkTextForOutbound, sanitizeAssistantVisibleText } from "openclaw/plu
12
12
  import { ChannelImplicitMentionsSchema, buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
13
13
  import { z } from "zod";
14
14
  // extensions/tlon/src/config-schema.ts
15
+ const TlonClubPolicySchema = z.enum([
16
+ "approve-once",
17
+ "approve-each",
18
+ "disabled"
19
+ ]);
20
+ const TlonClubRulesSchema = z.record(z.string().regex(TLON_CLUB_ID_RE), z.enum(["allow", "deny"]));
15
21
  const ShipSchema = z.string().min(1);
16
22
  const ChannelNestSchema = z.string().min(1);
17
23
  const TlonChannelRuleSchema = z.object({
@@ -32,6 +38,8 @@ const tlonCommonConfigFields = {
32
38
  network: TlonNetworkSchema,
33
39
  groupChannels: z.array(ChannelNestSchema).optional(),
34
40
  dmAllowlist: z.array(ShipSchema).optional(),
41
+ clubPolicy: TlonClubPolicySchema.optional(),
42
+ clubRules: TlonClubRulesSchema.optional(),
35
43
  groupInviteAllowlist: z.array(ShipSchema).optional(),
36
44
  autoDiscoverChannels: z.boolean().optional(),
37
45
  crossChannelCitations: z.boolean().optional(),
@@ -59,6 +67,14 @@ const crossChannelCitationsHint = {
59
67
  label: "Tlon Cross-Channel Citations",
60
68
  help: "Expand citations of posts from other channels into agent context. False expands only citations of the channel a message was posted in; the owner's 1:1 DMs are exempt. Default: true."
61
69
  };
70
+ const clubPolicyHint = {
71
+ label: "Tlon Group DM Policy",
72
+ help: "Default: approve-once. Enable each club once for automatic replies, require approval for every message with approve-each, or disable group DMs. Club authors and participants are unverified."
73
+ };
74
+ const clubRulesHint = {
75
+ label: "Tlon Group DM Rules",
76
+ help: "Club IDs mapped to allow or deny. Allow accepts unverified input delivered under that club ID with the agent's normal permitted tools; it does not authenticate participants or grant owner authority. Deny blocks the club, not a claimed ship. Approve-each still requires each message; disabled overrides all rules."
77
+ };
62
78
  const tlonChannelConfigSchema = buildChannelConfigSchema(TlonConfigSchema, { uiHints: {
63
79
  ...createChannelConfigUiHints({
64
80
  channelLabel: "Tlon",
@@ -67,6 +83,10 @@ const tlonChannelConfigSchema = buildChannelConfigSchema(TlonConfigSchema, { uiH
67
83
  requireMentionInBotThreads: botThreadMentionHint,
68
84
  "accounts.*.requireMentionInBotThreads": botThreadMentionHint,
69
85
  "authorization.channelRules.*.requireMentionInBotThreads": botThreadMentionHint,
86
+ clubPolicy: clubPolicyHint,
87
+ "accounts.*.clubPolicy": clubPolicyHint,
88
+ clubRules: clubRulesHint,
89
+ "accounts.*.clubRules": clubRulesHint,
70
90
  crossChannelCitations: crossChannelCitationsHint,
71
91
  "accounts.*.crossChannelCitations": crossChannelCitationsHint
72
92
  } });
@@ -80,8 +100,8 @@ const TLON_CHANNEL_ID = "tlon";
80
100
  function resolveTlonOutboundSessionRoute(params) {
81
101
  const parsed = parseTlonTarget(params.target);
82
102
  if (!parsed) return null;
83
- const isGroup = parsed.kind === "group";
84
- const peerId = isGroup ? parsed.nest : parsed.ship;
103
+ const isGroup = parsed.kind !== "dm";
104
+ const peerId = parsed.kind === "dm" ? parsed.ship : parsed.kind === "club" ? `club:${parsed.clubId}` : parsed.nest;
85
105
  return buildChannelOutboundSessionRoute({
86
106
  cfg: params.cfg,
87
107
  agentId: params.agentId,
@@ -93,11 +113,11 @@ function resolveTlonOutboundSessionRoute(params) {
93
113
  id: peerId
94
114
  },
95
115
  chatType: isGroup ? "group" : "direct",
96
- from: isGroup ? `tlon:group:${peerId}` : `tlon:${peerId}`,
116
+ from: parsed.kind === "group" ? `tlon:group:${peerId}` : `tlon:${peerId}`,
97
117
  to: `tlon:${peerId}`
98
118
  });
99
119
  }
100
- const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DFFKdLkd.mjs"));
120
+ const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-_Z0oICD6.mjs"));
101
121
  const tlonSetupWizardProxy = createTlonSetupWizardBase(async (params) => await (await loadTlonChannelRuntime()).tlonSetupWizard.finalize(params));
102
122
  const tlonConfigAdapter = createHybridChannelConfigAdapter({
103
123
  sectionKey: TLON_CHANNEL_ID,
@@ -184,6 +204,7 @@ const tlonPlugin = createChatChannelPlugin({
184
204
  const parsed = parseTlonTarget(target);
185
205
  if (!parsed) return target.trim();
186
206
  if (parsed.kind === "dm") return parsed.ship;
207
+ if (parsed.kind === "club") return `club:${parsed.clubId}`;
187
208
  return parsed.nest;
188
209
  },
189
210
  inferTargetChatType: ({ to }) => {
@@ -243,4 +264,4 @@ const tlonPlugin = createChatChannelPlugin({
243
264
  },
244
265
  outbound: tlonChannelOutbound
245
266
  });
246
- export { tlonPlugin as t };
267
+ export { TlonClubPolicySchema as n, TlonClubRulesSchema as r, tlonPlugin as t };
@@ -1,12 +1,13 @@
1
1
  import { i as __reExport, r as __exportAll } from "./doctor-contract-CfYeTj9o.mjs";
2
2
  import { createDedupeCache, createLoggerBackedRuntime } from "../runtime-api.js";
3
- import { c as resolveTlonAccount, d as parseChannelNest, f as parseTlonTarget, l as formatTargetHint, o as validateUrbitBaseUrl, u as normalizeShip } from "./setup-core-BPDMrrMz.mjs";
3
+ import { c as resolveTlonAccount, d as normalizeShip, f as parseChannelNest, l as TLON_CLUB_ID_RE, o as validateUrbitBaseUrl, p as parseTlonTarget, u as formatTargetHint } from "./setup-core-B5UNhQkj.mjs";
4
+ import { n as TlonClubPolicySchema, r as TlonClubRulesSchema } from "./channel-CXwKoHzW.mjs";
4
5
  import { t as getTlonRuntime } from "./runtime-ReERXJF_.mjs";
5
- import { t as tlonSetupWizard } from "./setup-surface-loD2Z-9W.mjs";
6
+ import { t as tlonSetupWizard } from "./setup-surface-DI-cEHqR.mjs";
6
7
  import { fetchWithSsrFGuard, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
7
8
  import { bindIngressLifecycleToReplyOptions, createArmableStallWatchdog, createChannelIngressError, createChannelIngressMonitor, createMessageReceiptFromOutboundResults, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
8
- import { asBoolean, asFiniteNumber, asNullableRecord, filterStringEntries, normalizeLowercaseStringOrEmpty, normalizeNullableString, readStringField, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
9
9
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
10
+ import { asBoolean, asFiniteNumber, asNullableRecord, filterStringEntries, normalizeLowercaseStringOrEmpty, normalizeNullableString, readStringField, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
10
11
  import crypto, { randomBytes, randomUUID } from "node:crypto";
11
12
  import { escapeRegExp, runChannelProbe, sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
12
13
  import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
@@ -52,6 +53,8 @@ function parseSettingsResponse(raw) {
52
53
  return {
53
54
  groupChannels: Array.isArray(settings.groupChannels) ? filterStringEntries(settings.groupChannels) : void 0,
54
55
  dmAllowlist: Array.isArray(settings.dmAllowlist) ? filterStringEntries(settings.dmAllowlist) : void 0,
56
+ clubPolicy: TlonClubPolicySchema.safeParse(settings.clubPolicy).data,
57
+ clubRules: TlonClubRulesSchema.safeParse(parseJsonSetting(settings.clubRules)).data,
55
58
  autoDiscoverChannels: asBoolean(settings.autoDiscoverChannels),
56
59
  showModelSig: asBoolean(settings.showModelSig),
57
60
  autoAcceptDmInvites: asBoolean(settings.autoAcceptDmInvites),
@@ -73,14 +76,15 @@ function parsePendingApprovals(value) {
73
76
  return parsed.filter((item) => {
74
77
  if (!item || typeof item !== "object") return false;
75
78
  const obj = item;
76
- return typeof obj.id === "string" && (obj.type === "dm" || obj.type === "channel" || obj.type === "group") && typeof obj.requestingShip === "string" && typeof obj.timestamp === "number" && (obj.clubId === void 0 || typeof obj.clubId === "string") && (obj.verifiedDirect === void 0 || typeof obj.verifiedDirect === "boolean");
79
+ return typeof obj.id === "string" && (obj.type === "dm" || obj.type === "channel" || obj.type === "group" || obj.type === "club" && typeof obj.clubId === "string" && TLON_CLUB_ID_RE.test(obj.clubId) && (obj.clubMode === "once" || obj.clubMode === "message")) && typeof obj.requestingShip === "string" && typeof obj.timestamp === "number" && (obj.clubId === void 0 || typeof obj.clubId === "string") && (obj.verifiedDirect === void 0 || typeof obj.verifiedDirect === "boolean");
77
80
  });
78
81
  }
79
82
  function parseSettingsEvent(event) {
80
- if (!event || typeof event !== "object") return null;
81
- const evt = event;
83
+ const record = asNullableRecord(event);
84
+ if (!record) return null;
85
+ const evt = asNullableRecord(record["settings-event"]) ?? record;
82
86
  const operation = evt["put-entry"] ? "put-entry" : "del-entry";
83
- const entry = evt[operation];
87
+ const entry = asNullableRecord(evt[operation]);
84
88
  if (!entry || entry.desk !== SETTINGS_DESK || entry["bucket-key"] !== SETTINGS_BUCKET) return null;
85
89
  return {
86
90
  key: typeof entry["entry-key"] === "string" ? entry["entry-key"] : "",
@@ -645,35 +649,67 @@ async function sendDm({ text, ...params }) {
645
649
  kind: "text"
646
650
  });
647
651
  }
648
- async function sendDmWithStory({ api, fromShip, toShip, story, kind = "unknown" }) {
652
+ async function sendDmWithStory({ toShip, ...params }) {
653
+ return sendChatWithStory({
654
+ ...params,
655
+ target: {
656
+ kind: "dm",
657
+ ship: toShip
658
+ }
659
+ });
660
+ }
661
+ async function sendClubMessage({ text, ...params }) {
662
+ return sendClubMessageWithStory({
663
+ ...params,
664
+ story: markdownToStory(text),
665
+ kind: "text"
666
+ });
667
+ }
668
+ async function sendClubMessageWithStory({ clubId, ...params }) {
669
+ return sendChatWithStory({
670
+ ...params,
671
+ target: {
672
+ kind: "club",
673
+ clubId
674
+ }
675
+ });
676
+ }
677
+ async function sendChatWithStory({ api, fromShip, target, story, kind = "unknown" }) {
649
678
  const sentAt = Date.now();
650
679
  const id = `${fromShip}/${scot("ud", da.fromUnix(sentAt))}`;
651
- const action = {
652
- ship: toShip,
653
- diff: {
654
- id,
655
- delta: { add: {
656
- memo: {
657
- content: story,
658
- author: fromShip,
659
- sent: sentAt
660
- },
661
- kind: null,
662
- time: null
663
- } }
664
- }
680
+ const diff = {
681
+ id,
682
+ delta: { add: {
683
+ memo: {
684
+ content: story,
685
+ author: fromShip,
686
+ sent: sentAt
687
+ },
688
+ kind: null,
689
+ time: null
690
+ } }
665
691
  };
692
+ const conversationId = target.kind === "dm" ? target.ship : `club:${target.clubId}`;
666
693
  await api.poke({
667
694
  app: "chat",
668
- mark: "chat-dm-action",
669
- json: action
695
+ mark: target.kind === "dm" ? "chat-dm-action" : "chat-club-action",
696
+ json: target.kind === "dm" ? {
697
+ ship: target.ship,
698
+ diff
699
+ } : {
700
+ id: target.clubId,
701
+ diff: {
702
+ uid: "0v0",
703
+ delta: { writ: diff }
704
+ }
705
+ }
670
706
  });
671
707
  return {
672
708
  channel: "tlon",
673
709
  messageId: id,
674
710
  receipt: createTlonSendReceipt({
675
711
  messageId: id,
676
- conversationId: toShip,
712
+ conversationId,
677
713
  kind
678
714
  })
679
715
  };
@@ -1239,6 +1275,7 @@ function createPendingApproval(params) {
1239
1275
  type: params.type,
1240
1276
  requestingShip: params.requestingShip,
1241
1277
  ...params.clubId !== void 0 ? { clubId: params.clubId } : {},
1278
+ ...params.clubMode !== void 0 ? { clubMode: params.clubMode } : {},
1242
1279
  ...params.verifiedDirect === true ? { verifiedDirect: true } : {},
1243
1280
  channelNest: params.channelNest,
1244
1281
  groupFlag: params.groupFlag,
@@ -1257,10 +1294,12 @@ function formatApprovalInstructions(id) {
1257
1294
  function formatApprovalRequest(approval) {
1258
1295
  const preview = approval.messagePreview ? `\n"${truncate(approval.messagePreview, 100)}"` : "";
1259
1296
  switch (approval.type) {
1297
+ case "club":
1260
1298
  case "dm":
1261
1299
  if (approval.clubId !== void 0) {
1262
- const replayLine = approval.originalMessage ? `The message is answered as an unverified group DM sender, never as ${approval.requestingShip}.` : `The message is not kept, so it will not be answered; have ${approval.requestingShip} send it again in a normal direct message to get a reply.`;
1263
- return `New group DM message claiming to be from ${approval.requestingShip} (unverified; group DM ${approval.clubId}):${preview}\n\nApproving adds ${approval.requestingShip} to the DM allowlist. ${replayLine}\n` + formatApprovalInstructions(approval.id);
1300
+ const permission = approval.type === "club" && approval.clubMode === "once" ? "Approving enables this club for automatic replies, including future messages. Ships invited to this club later may also trigger the agent." : "Approving permits this saved message only; it does not enable future messages.";
1301
+ const replayLine = approval.originalMessage ? "The reply goes to the club, using its own conversation." : "No message was saved; approval only dismisses this request.";
1302
+ return `Group DM ${approval.clubId}: claimed author ${approval.requestingShip} (unverified).${preview}\n\n${permission} Tlon does not authenticate club authors or participants. Input delivered under this club ID can use the agent's normal permitted tools.\n${replayLine} No direct-DM access or owner authority is granted. ` + (approval.type === "club" ? "Deny or block disables this club; no ship is blocked.\n" : "Blocking only dismisses this legacy request; no ship is blocked.\n") + formatApprovalInstructions(approval.id);
1264
1303
  }
1265
1304
  return `New DM request from ${approval.requestingShip}:${preview}\n\n` + formatApprovalInstructions(approval.id);
1266
1305
  case "channel": return `${approval.requestingShip} mentioned you in ${approval.channelNest}:${preview}\n\n` + formatApprovalInstructions(approval.id);
@@ -1290,9 +1329,15 @@ function requiresResendAfterApproval(approval) {
1290
1329
  return approval.type === "dm" && approval.originalMessage !== void 0 && approval.clubId === void 0 && approval.verifiedDirect !== true;
1291
1330
  }
1292
1331
  function formatApprovalConfirmation(approval, action) {
1332
+ if (approval.clubId !== void 0) {
1333
+ if (approval.type !== "club") return `Resolved legacy group DM request ${approval.id}. No standing club or direct-DM access was granted; no ship was blocked.`;
1334
+ if (action !== "approve") return `Disabled group DM ${approval.clubId}. No ship was blocked. Set its clubRules entry to "allow" to enable it again.`;
1335
+ return approval.clubMode === "once" ? `Enabled group DM ${approval.clubId} for automatic replies from unverified input. No direct-DM access or owner authority was granted.` : `Approved this group DM message only. No standing club or direct-DM access was granted.`;
1336
+ }
1293
1337
  if (action === "block") return `Blocked ${approval.requestingShip}. They will no longer be able to contact the bot.`;
1294
1338
  const actionText = action === "approve" ? "Approved" : "Denied";
1295
1339
  switch (approval.type) {
1340
+ case "club":
1296
1341
  case "dm":
1297
1342
  if (action === "approve") {
1298
1343
  if (requiresResendAfterApproval(approval)) return `${actionText} DM access for ${approval.requestingShip}. They can now message the bot.\nTheir earlier message was saved before this version and its sender cannot be verified, so it was not processed. Ask ${approval.requestingShip} to send it again.`;
@@ -1325,7 +1370,7 @@ function formatBlockedList(ships) {
1325
1370
  }
1326
1371
  function formatPendingList(approvals) {
1327
1372
  if (approvals.length === 0) return "No pending approval requests.";
1328
- return `Pending approvals (${approvals.length}):\n${approvals.map((a) => `• ${a.id}: ${a.type} from ${a.requestingShip}`).join("\n")}`;
1373
+ return `Pending approvals (${approvals.length}):\n${approvals.map((a) => a.clubId !== void 0 ? `• ${a.id}: group DM ${a.clubId} (unverified)` : `• ${a.id}: ${a.type} from ${a.requestingShip}`).join("\n")}`;
1329
1374
  }
1330
1375
  // extensions/tlon/src/monitor/approval-runtime.ts
1331
1376
  function createTlonApprovalRuntime(params) {
@@ -1379,6 +1424,18 @@ function createTlonApprovalRuntime(params) {
1379
1424
  runtime.error?.(`[tlon] Failed to update channelRules: ${String(err)}`);
1380
1425
  }
1381
1426
  };
1427
+ const setClubRule = async (clubId, rule) => {
1428
+ const clubRules = {
1429
+ ...state.effectiveClubRules,
1430
+ [clubId]: rule
1431
+ };
1432
+ await putTlonSetting(api, "clubRules", JSON.stringify(clubRules));
1433
+ state.effectiveClubRules = clubRules;
1434
+ state.currentSettings = {
1435
+ ...state.currentSettings,
1436
+ clubRules
1437
+ };
1438
+ };
1382
1439
  const setShipBlocked = async (ship, blocked) => {
1383
1440
  const normalizedShip = normalizeShip(ship);
1384
1441
  const action = blocked ? "block" : "unblock";
@@ -1434,14 +1491,18 @@ function createTlonApprovalRuntime(params) {
1434
1491
  return false;
1435
1492
  }
1436
1493
  };
1437
- const queueApprovalRequest = async (approval) => {
1438
- if (await isShipBlocked(approval.requestingShip)) {
1494
+ const queueApprovalRequestUnqueued = async (approval) => {
1495
+ if (approval.clubId === void 0 && await isShipBlocked(approval.requestingShip)) {
1439
1496
  runtime.log?.(`[tlon] Ignoring request from blocked ship ${approval.requestingShip}`);
1440
1497
  return false;
1441
1498
  }
1442
1499
  const approvals = state.pendingApprovals;
1443
- const existing = approvals.find((item) => item.type === approval.type && item.requestingShip === approval.requestingShip && item.clubId === approval.clubId && (approval.type !== "channel" || item.channelNest === approval.channelNest) && (approval.type !== "group" || item.groupFlag === approval.groupFlag));
1500
+ const existing = approvals.find((item) => {
1501
+ if (approval.type === "club") return item.type === "club" && item.clubId === approval.clubId && item.clubMode === approval.clubMode && (approval.clubMode === "once" || item.originalMessage?.messageId === approval.originalMessage?.messageId);
1502
+ return item.type === approval.type && item.requestingShip === approval.requestingShip && item.clubId === approval.clubId && (approval.type !== "channel" || item.channelNest === approval.channelNest) && (approval.type !== "group" || item.groupFlag === approval.groupFlag);
1503
+ });
1444
1504
  if (existing) {
1505
+ if (approval.type === "club") return true;
1445
1506
  if (approval.originalMessage) {
1446
1507
  existing.originalMessage = approval.originalMessage;
1447
1508
  existing.messagePreview = approval.messagePreview;
@@ -1463,12 +1524,19 @@ function createTlonApprovalRuntime(params) {
1463
1524
  }
1464
1525
  approvalOverflowNoticeSent = false;
1465
1526
  approvalOverflowNoticeAttempts = 0;
1466
- state.pendingApprovals = [...approvals, approval];
1467
- await savePendingApprovals(true);
1527
+ const nextApprovals = [...approvals, approval];
1528
+ await putTlonSetting(api, "pendingApprovals", JSON.stringify(nextApprovals));
1529
+ state.pendingApprovals = nextApprovals;
1468
1530
  await sendOwnerNotification(formatApprovalRequest(approval));
1469
1531
  runtime.log?.(`[tlon] Queued approval request: ${approval.id} (${approval.type} from ${approval.requestingShip})`);
1470
1532
  return true;
1471
1533
  };
1534
+ let pendingRequestWrite = Promise.resolve();
1535
+ const queueApprovalRequest = (approval) => {
1536
+ const result = pendingRequestWrite.then(() => queueApprovalRequestUnqueued(approval));
1537
+ pendingRequestWrite = result.then(() => {}, () => {});
1538
+ return result;
1539
+ };
1472
1540
  const handleApprovalResponse = async (text) => {
1473
1541
  const parsed = parseApprovalResponse(text);
1474
1542
  if (!parsed) return false;
@@ -1477,9 +1545,25 @@ function createTlonApprovalRuntime(params) {
1477
1545
  await sendOwnerNotification(parsed.id ? `No pending approval found for ID: ${parsed.id}` : state.pendingApprovals.length > 1 ? `Multiple approvals are pending. Include an approval ID with your decision.\n\n${formatPendingList(state.pendingApprovals)}` : "No pending approval found.");
1478
1546
  return true;
1479
1547
  }
1548
+ if (approval.clubId !== void 0 && (state.effectiveClubPolicy === "disabled" || state.effectiveClubRules[approval.clubId] === "deny")) {
1549
+ await sendOwnerNotification(`Group DM ${approval.clubId} is disabled. No message was processed.`);
1550
+ state.pendingApprovals = removePendingApproval(state.pendingApprovals, approval.id);
1551
+ await savePendingApprovals();
1552
+ return true;
1553
+ }
1480
1554
  if (parsed.action === "approve") switch (approval.type) {
1555
+ case "club":
1556
+ if (approval.clubId && approval.clubMode === "once" && state.effectiveClubPolicy === "approve-once") await setClubRule(approval.clubId, "allow");
1557
+ else if (approval.clubMode === "once") {
1558
+ await sendOwnerNotification("The club policy changed. Send a new club message to request approval under the current policy.");
1559
+ state.pendingApprovals = removePendingApproval(state.pendingApprovals, approval.id);
1560
+ await savePendingApprovals();
1561
+ return true;
1562
+ }
1563
+ if (approval.originalMessage) await processApprovedMessage(approval);
1564
+ break;
1481
1565
  case "dm":
1482
- await addToDmAllowlist(approval.requestingShip);
1566
+ if (approval.clubId === void 0) await addToDmAllowlist(approval.requestingShip);
1483
1567
  if (requiresResendAfterApproval(approval)) runtime.log?.(`[tlon] Not replaying pre-upgrade DM request from ${approval.requestingShip}: sender provenance unknown; owner told to request a resend`);
1484
1568
  else if (approval.originalMessage) {
1485
1569
  runtime.log?.(`[tlon] Processing original message from ${approval.requestingShip} after approval`);
@@ -1519,7 +1603,8 @@ function createTlonApprovalRuntime(params) {
1519
1603
  runtime.error?.(`[tlon] Failed to join group ${approval.groupFlag}: ${String(err)}`);
1520
1604
  }
1521
1605
  }
1522
- else if (parsed.action === "block") await setShipBlocked(approval.requestingShip, true);
1606
+ else if (approval.type === "club" && approval.clubId) await setClubRule(approval.clubId, "deny");
1607
+ else if (parsed.action === "block" && approval.clubId === void 0) await setShipBlocked(approval.requestingShip, true);
1523
1608
  await sendOwnerNotification(formatApprovalConfirmation(approval, parsed.action));
1524
1609
  state.pendingApprovals = removePendingApproval(state.pendingApprovals, approval.id);
1525
1610
  await savePendingApprovals();
@@ -2191,6 +2276,7 @@ function createTlonIngressMonitor(options) {
2191
2276
  }
2192
2277
  // extensions/tlon/src/media-fetch-timeouts.ts
2193
2278
  const TLON_MEDIA_FETCH_TIMEOUTS = {
2279
+ timeoutMs: 18e4,
2194
2280
  responseHeaderTimeoutMs: 12e4,
2195
2281
  readIdleTimeoutMs: 3e4
2196
2282
  };
@@ -2207,7 +2293,7 @@ function buildTlonInboundMediaPrompt(messageText, media) {
2207
2293
  media
2208
2294
  };
2209
2295
  }
2210
- async function downloadMessageImages(content, maxBytes) {
2296
+ async function downloadMessageImages(content, maxBytes, abortSignal) {
2211
2297
  const images = [];
2212
2298
  const attachments = [];
2213
2299
  let unavailableCount = 0;
@@ -2232,7 +2318,10 @@ async function downloadMessageImages(content, maxBytes) {
2232
2318
  maxBytes: Math.min(maxBytes ?? MAX_IMAGE_BYTES, MAX_IMAGE_BYTES),
2233
2319
  ...TLON_MEDIA_FETCH_TIMEOUTS,
2234
2320
  ssrfPolicy: void 0,
2235
- requestInit: { method: "GET" }
2321
+ requestInit: {
2322
+ method: "GET",
2323
+ ...abortSignal ? { signal: abortSignal } : {}
2324
+ }
2236
2325
  });
2237
2326
  attachments.push({
2238
2327
  path: saved.path,
@@ -2320,8 +2409,11 @@ async function prepareTlonGroupAdmission(params) {
2320
2409
  }
2321
2410
  // extensions/tlon/src/monitor/settings-helpers.ts
2322
2411
  function buildTlonSettingsMigrations(account, currentSettings) {
2412
+ const configuredClubRules = Object.keys(account.clubRules).length > 0 ? JSON.stringify(account.clubRules) : void 0;
2323
2413
  return [...[
2324
2414
  "dmAllowlist",
2415
+ "clubPolicy",
2416
+ "clubRules",
2325
2417
  "groupInviteAllowlist",
2326
2418
  "groupChannels",
2327
2419
  "defaultAuthorizedShips",
@@ -2330,7 +2422,7 @@ function buildTlonSettingsMigrations(account, currentSettings) {
2330
2422
  "autoAcceptGroupInvites"
2331
2423
  ].map((key) => ({
2332
2424
  key,
2333
- fileValue: account[key],
2425
+ fileValue: key === "clubRules" ? configuredClubRules : account[key],
2334
2426
  settingsValue: currentSettings[key]
2335
2427
  })), {
2336
2428
  key: "showModelSig",
@@ -2359,6 +2451,8 @@ function applyTlonSettingsOverrides(params) {
2359
2451
  if (settings.pendingApprovals?.length) log?.(`[tlon] Loaded ${settings.pendingApprovals.length} pending approval(s) from settings`);
2360
2452
  return {
2361
2453
  effectiveDmAllowlist: settings.dmAllowlist ?? account.dmAllowlist,
2454
+ effectiveClubPolicy: settings.clubPolicy ?? account.clubPolicy ?? "approve-once",
2455
+ effectiveClubRules: settings.clubRules ?? account.clubRules,
2362
2456
  effectiveShowModelSig: settings.showModelSig ?? account.showModelSignature ?? false,
2363
2457
  effectiveAutoAcceptDmInvites: settings.autoAcceptDmInvites ?? account.autoAcceptDmInvites ?? false,
2364
2458
  effectiveAutoAcceptGroupInvites: settings.autoAcceptGroupInvites ?? account.autoAcceptGroupInvites ?? false,
@@ -2377,6 +2471,7 @@ function createTlonSettingsInstaller(state, account, log) {
2377
2471
  return (currentSettings, preserveApprovalState = false) => {
2378
2472
  const pendingApprovals = state.pendingApprovals;
2379
2473
  const effectiveDmAllowlist = state.effectiveDmAllowlist;
2474
+ const effectiveClubRules = state.effectiveClubRules;
2380
2475
  Object.assign(state, applyTlonSettingsOverrides({
2381
2476
  account,
2382
2477
  currentSettings,
@@ -2385,6 +2480,7 @@ function createTlonSettingsInstaller(state, account, log) {
2385
2480
  if (preserveApprovalState) {
2386
2481
  state.pendingApprovals = pendingApprovals;
2387
2482
  state.effectiveDmAllowlist = effectiveDmAllowlist;
2483
+ state.effectiveClubRules = effectiveClubRules;
2388
2484
  }
2389
2485
  };
2390
2486
  }
@@ -2510,6 +2606,7 @@ async function monitorTlonProvider(opts) {
2510
2606
  runtime.log?.(`[tlon] Failed to migrate ${key}: ${String(err)}`);
2511
2607
  }
2512
2608
  installSettings(settingsState.currentSettings);
2609
+ runtime.log?.("[tlon] Group DMs require club enablement; dmAllowlist applies only to verified 1:1 DMs. Approve an enablement request or configure clubRules.");
2513
2610
  if (settingsState.effectiveAutoDiscoverChannels) {
2514
2611
  const initData = await fetchInitData(api, runtime);
2515
2612
  if (initData.channels.length > 0) groupChannels = initData.channels;
@@ -2526,23 +2623,15 @@ async function monitorTlonProvider(opts) {
2526
2623
  if (!settingsState.effectiveOwnerShip) return false;
2527
2624
  return normalizeShip(ship) === settingsState.effectiveOwnerShip;
2528
2625
  }
2529
- /** DM ingress allowlist for one chat event; club claims only match as their club-scoped id. */
2530
- function resolveChatAllowFrom(params) {
2531
- if (params.ownerDm) return [params.senderShip];
2532
- if (!params.isClubMessage) return settingsState.effectiveDmAllowlist;
2533
- return settingsState.effectiveDmAllowlist.some((ship) => normalizeShip(ship) === params.senderShip) ? [params.senderId] : [];
2534
- }
2535
2626
  const processMessage = async (params) => {
2536
2627
  const { messageId, senderShip, isGroup, channelNest, timestamp, parentId, isThreadReply, isAdmissionAllowed, messageContent, turnAdoptionLifecycle, resolveChannelIngress } = params;
2537
2628
  let messageText = params.messageText;
2538
2629
  const clubId = params.clubId;
2539
2630
  const senderId = clubId === void 0 ? senderShip : clubSenderId(clubId, senderShip);
2540
- let attachments = [];
2541
- let unavailableMediaCount = 0;
2542
- if (messageContent) {
2543
- ({attachments, unavailableCount: unavailableMediaCount} = await downloadMessageImages(messageContent, account.mediaMaxBytes));
2544
- if (attachments.length > 0) runtime.log?.(`[tlon] Downloaded ${attachments.length} image(s) from message`);
2545
- }
2631
+ const groupConversation = isGroup || clubId !== void 0;
2632
+ const conversationId = isGroup ? channelNest ?? senderShip : clubId !== void 0 ? `club:${clubId}` : senderShip;
2633
+ const { attachments, unavailableCount: unavailableMediaCount } = await downloadMessageImages(messageContent, account.mediaMaxBytes, turnAdoptionLifecycle?.abortSignal);
2634
+ if (attachments.length > 0) runtime.log?.(`[tlon] Downloaded ${attachments.length} image(s) from message`);
2546
2635
  if (isThreadReply && parentId && channelNest) {
2547
2636
  const threadHistory = await fetchThreadHistory(api, channelNest, parentId, runtime);
2548
2637
  if (threadHistory.length > 0) {
@@ -2586,8 +2675,8 @@ async function monitorTlonProvider(opts) {
2586
2675
  channel: "tlon",
2587
2676
  accountId: opts.accountId,
2588
2677
  peer: {
2589
- kind: isGroup ? "group" : "direct",
2590
- id: isGroup ? channelNest ?? senderShip : senderShip
2678
+ kind: groupConversation ? "group" : "direct",
2679
+ id: conversationId
2591
2680
  }
2592
2681
  });
2593
2682
  const channelIngress = await resolveChannelIngress({
@@ -2600,7 +2689,7 @@ async function monitorTlonProvider(opts) {
2600
2689
  runtime.log?.(`[tlon] Authorization changed before dispatch for ${senderShip}`);
2601
2690
  return;
2602
2691
  }
2603
- if (!isGroup) {
2692
+ if (!groupConversation) {
2604
2693
  const sessionKey = route.sessionKey;
2605
2694
  if (!dmSendersBySession.has(sessionKey)) dmSendersBySession.set(sessionKey, /* @__PURE__ */ new Set());
2606
2695
  const senders = dmSendersBySession.get(sessionKey);
@@ -2622,7 +2711,7 @@ async function monitorTlonProvider(opts) {
2622
2711
  const fromLabel = isGroup ? `${senderShip} [${senderRole}] in ${channelNest}` : clubId !== void 0 ? `${senderShip} (unverified) [${senderRole}] in group DM ${clubId}` : `${senderShip} [${senderRole}]`;
2623
2712
  const shouldComputeAuth = core.channel.commands.shouldComputeCommandAuthorized(messageText, cfg);
2624
2713
  let commandAuthorized = false;
2625
- if (shouldComputeAuth) {
2714
+ if (shouldComputeAuth && clubId === void 0) {
2626
2715
  commandAuthorized = (await resolveTlonCommandAuthorizationWithIngress({
2627
2716
  senderShip: senderId,
2628
2717
  ownerShip: settingsState.effectiveOwnerShip
@@ -2649,15 +2738,15 @@ async function monitorTlonProvider(opts) {
2649
2738
  accountId: route.accountId,
2650
2739
  messageId,
2651
2740
  timestamp,
2652
- from: isGroup ? `tlon:group:${channelNest}` : `tlon:${senderId}`,
2741
+ from: isGroup ? `tlon:group:${channelNest}` : clubId !== void 0 ? `tlon:club:${clubId}` : `tlon:${senderId}`,
2653
2742
  sender: {
2654
2743
  id: senderId,
2655
2744
  name: clubId === void 0 ? senderShip : senderId,
2656
2745
  roles: [senderRole]
2657
2746
  },
2658
2747
  conversation: {
2659
- kind: isGroup ? "group" : "direct",
2660
- id: isGroup ? channelNest ?? senderShip : senderShip,
2748
+ kind: groupConversation ? "group" : "direct",
2749
+ id: conversationId,
2661
2750
  label: fromLabel
2662
2751
  },
2663
2752
  route: {
@@ -2668,7 +2757,7 @@ async function monitorTlonProvider(opts) {
2668
2757
  },
2669
2758
  reply: {
2670
2759
  to: `tlon:${botShipName}`,
2671
- originatingTo: `tlon:${isGroup ? channelNest : botShipName}`,
2760
+ originatingTo: `tlon:${groupConversation ? conversationId : botShipName}`,
2672
2761
  replyToId: parentId ?? void 0
2673
2762
  },
2674
2763
  message: {
@@ -2684,13 +2773,13 @@ async function monitorTlonProvider(opts) {
2684
2773
  CommandAuthorized: commandAuthorized,
2685
2774
  CommandSource: "text",
2686
2775
  ...attachments.length > 0 && { Attachments: attachments },
2687
- ...isGroup && { ReplyThreading: { implicitCurrentMessage: "deny" } },
2776
+ ...groupConversation && { ReplyThreading: { implicitCurrentMessage: "deny" } },
2688
2777
  ...parentId && { ThreadId: parentId }
2689
2778
  }
2690
2779
  });
2691
2780
  const dispatchStartTime = Date.now();
2692
2781
  const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
2693
- const deliveryTarget = isGroup ? channelNest : senderShip;
2782
+ const deliveryTarget = conversationId;
2694
2783
  const prepareReplyPayload = (payload) => {
2695
2784
  const replyText = payload.text;
2696
2785
  if (!replyText || !settingsState.effectiveShowModelSig) return payload;
@@ -2740,7 +2829,13 @@ async function monitorTlonProvider(opts) {
2740
2829
  replyToId: parentId ?? void 0
2741
2830
  };
2742
2831
  }
2743
- await sendDm({
2832
+ if (clubId !== void 0) await sendClubMessage({
2833
+ api,
2834
+ fromShip: botShipName,
2835
+ clubId,
2836
+ text: replyText
2837
+ });
2838
+ else await sendDm({
2744
2839
  api,
2745
2840
  fromShip: botShipName,
2746
2841
  toShip: senderShip,
@@ -2783,7 +2878,7 @@ async function monitorTlonProvider(opts) {
2783
2878
  processApprovedMessage: async (approval) => {
2784
2879
  if (!approval.originalMessage || approval.type === "group") return;
2785
2880
  const isGroup = approval.type === "channel";
2786
- const conversationId = isGroup ? approval.channelNest ?? "" : approval.requestingShip;
2881
+ const conversationId = isGroup ? approval.channelNest ?? "" : approval.clubId !== void 0 ? `club:${approval.clubId}` : approval.requestingShip;
2787
2882
  if (isGroup && !conversationId) return;
2788
2883
  const clubId = !isGroup ? approval.clubId : void 0;
2789
2884
  if (!isGroup && clubId === void 0 && approval.verifiedDirect !== true) {
@@ -2808,11 +2903,11 @@ async function monitorTlonProvider(opts) {
2808
2903
  senderShip: replaySenderId,
2809
2904
  accountId: account.accountId,
2810
2905
  conversation: {
2811
- kind: isGroup ? "group" : "direct",
2906
+ kind: isGroup || clubId !== void 0 ? "group" : "direct",
2812
2907
  id: conversationId
2813
2908
  },
2814
2909
  allowFrom: [replaySenderId],
2815
- ...isGroup ? { groupPolicy: "allowlist" } : {},
2910
+ ...isGroup || clubId !== void 0 ? { groupPolicy: "allowlist" } : {},
2816
2911
  contextBinding
2817
2912
  })
2818
2913
  });
@@ -2952,9 +3047,12 @@ async function monitorTlonProvider(opts) {
2952
3047
  const authorShip = normalizeShip(readStringField(essay, "author") ?? "");
2953
3048
  const partnerShip = extractDmPartnerShip(whom);
2954
3049
  const senderShip = partnerShip || authorShip;
2955
- const clubId = partnerShip ? void 0 : typeof whom === "string" && whom ? whom : "unknown";
2956
- const isClubMessage = clubId !== void 0;
2957
- const senderId = isClubMessage ? clubSenderId(clubId, senderShip) : senderShip;
3050
+ const clubId = partnerShip ? void 0 : typeof whom === "string" && TLON_CLUB_ID_RE.test(whom) ? whom : void 0;
3051
+ if (!partnerShip && clubId === void 0) {
3052
+ runtime.log?.("[tlon] Dropped chat event without a valid DM peer or club ID");
3053
+ return;
3054
+ }
3055
+ const senderId = clubId !== void 0 ? clubSenderId(clubId, senderShip) : senderShip;
2958
3056
  if (authorShip === botShipName) return;
2959
3057
  if (!senderShip || senderShip === botShipName) return;
2960
3058
  if (authorShip && partnerShip && authorShip !== partnerShip) runtime.log?.(`[tlon] DM ship mismatch (author=${authorShip}, partner=${partnerShip}) - routing to partner`);
@@ -2966,7 +3064,54 @@ async function monitorTlonProvider(opts) {
2966
3064
  return;
2967
3065
  }
2968
3066
  if (!rawText.trim()) return;
2969
- const ownerDm = !isClubMessage && isOwner(senderShip);
3067
+ if (clubId !== void 0) {
3068
+ const policy = settingsState.effectiveClubPolicy;
3069
+ const rule = settingsState.effectiveClubRules[clubId];
3070
+ if (policy === "disabled" || rule === "deny") {
3071
+ runtime.log?.(`[tlon] Dropped disabled group DM ${clubId}`);
3072
+ return;
3073
+ }
3074
+ if (policy === "approve-each" || rule !== "allow") {
3075
+ if (settingsState.effectiveOwnerShip) await queueApprovalRequest(createPendingApproval({
3076
+ type: "club",
3077
+ clubId,
3078
+ clubMode: policy === "approve-each" ? "message" : "once",
3079
+ requestingShip: senderShip,
3080
+ messagePreview: rawText,
3081
+ originalMessage: {
3082
+ messageId,
3083
+ messageText: rawText,
3084
+ messageContent: essay.content,
3085
+ timestamp: asFiniteNumber(essay.sent) ?? Date.now()
3086
+ }
3087
+ }));
3088
+ else runtime.log?.(`[tlon] Group DM ${clubId} needs enablement: set channels.tlon.clubRules["${clubId}"] to "allow", or configure ownerShip for approval`);
3089
+ return;
3090
+ }
3091
+ await processMessage({
3092
+ messageId,
3093
+ senderShip,
3094
+ clubId,
3095
+ messageText: await resolveTlonCitations(essay.content, citationScope(), api, runtime) + rawText,
3096
+ messageContent: essay.content,
3097
+ timestamp: asFiniteNumber(essay.sent) ?? Date.now(),
3098
+ isGroup: false,
3099
+ turnAdoptionLifecycle,
3100
+ resolveChannelIngress: async (contextBinding) => resolveTlonMessageIngress({
3101
+ senderShip: senderId,
3102
+ accountId: account.accountId,
3103
+ conversation: {
3104
+ kind: "group",
3105
+ id: `club:${clubId}`
3106
+ },
3107
+ allowFrom: [],
3108
+ groupPolicy: "open",
3109
+ contextBinding
3110
+ })
3111
+ });
3112
+ return;
3113
+ }
3114
+ const ownerDm = isOwner(senderShip);
2970
3115
  if (ownerDm && await handleApprovalResponse(rawText)) {
2971
3116
  runtime.log?.("[tlon] Processed approval response from owner");
2972
3117
  return;
@@ -2982,12 +3127,7 @@ async function monitorTlonProvider(opts) {
2982
3127
  kind: "direct",
2983
3128
  id: senderShip
2984
3129
  },
2985
- allowFrom: resolveChatAllowFrom({
2986
- ownerDm,
2987
- isClubMessage,
2988
- senderShip,
2989
- senderId
2990
- }),
3130
+ allowFrom: ownerDm ? [senderShip] : settingsState.effectiveDmAllowlist,
2991
3131
  contextBinding
2992
3132
  });
2993
3133
  if (!ownerDm && !(await resolveChannelIngress()).senderAccess.allowed) {
@@ -2996,19 +3136,19 @@ async function monitorTlonProvider(opts) {
2996
3136
  type: "dm",
2997
3137
  requestingShip: senderShip,
2998
3138
  messagePreview: rawText,
2999
- ...isClubMessage ? { clubId } : { verifiedDirect: true },
3000
- ...isClubMessage && isOwner(senderShip) ? {} : { originalMessage: {
3139
+ verifiedDirect: true,
3140
+ originalMessage: {
3001
3141
  messageId,
3002
3142
  messageText: rawText,
3003
3143
  messageContent: essay.content,
3004
- timestamp: asFiniteNumber(essay?.sent) ?? Date.now()
3005
- } }
3144
+ timestamp: asFiniteNumber(essay.sent) ?? Date.now()
3145
+ }
3006
3146
  });
3007
3147
  await queueApprovalRequest(approval);
3008
3148
  } else runtime.log?.(`[tlon] Blocked DM from ${senderShip}: not in allowlist`);
3009
3149
  return;
3010
3150
  }
3011
- const can = (nest) => !isClubMessage && isOwner(senderShip) || citationScope()(nest), agentText = await resolveTlonCitations(essay.content, can, api, runtime) + rawText;
3151
+ const can = (nest) => isOwner(senderShip) || citationScope()(nest), agentText = await resolveTlonCitations(essay.content, can, api, runtime) + rawText;
3012
3152
  if (ownerDm) runtime.log?.(`[tlon] Processing DM from owner ${senderShip}`);
3013
3153
  await processMessage({
3014
3154
  messageText: agentText,
@@ -3562,6 +3702,13 @@ async function sendTlonOutbound(params, kind) {
3562
3702
  story,
3563
3703
  kind
3564
3704
  });
3705
+ if (parsed.kind === "club") return await sendClubMessageWithStory({
3706
+ api,
3707
+ fromShip,
3708
+ clubId: parsed.clubId,
3709
+ story,
3710
+ kind
3711
+ });
3565
3712
  return await sendGroupMessageWithStory({
3566
3713
  api,
3567
3714
  fromShip,
@@ -1,13 +1,14 @@
1
1
  import { isBlockedHostnameOrIp } from "openclaw/plugin-sdk/ssrf-runtime";
2
2
  import { createAccountListHelpers, resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
3
+ import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
3
4
  import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
4
5
  import { DEFAULT_ACCOUNT_ID, createSetupInputPresenceValidator, createSetupTranslator, formatDocsLink, normalizeAccountId, patchScopedAccountConfig, prepareScopedSetupConfig } from "openclaw/plugin-sdk/setup";
5
6
  import { normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
7
7
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/account-resolution";
8
8
  // extensions/tlon/src/targets.ts
9
9
  const SHIP_RE = /^~?[a-z-]+$/i;
10
10
  const NEST_RE = /^chat\/([^/]+)\/([^/]+)$/i;
11
+ const TLON_CLUB_ID_RE = /^0v(?:0|[1-9a-v][0-9a-v]{0,4}(?:\.[0-9a-v]{5})*)$/;
11
12
  function normalizeShip(raw) {
12
13
  const trimmed = raw.trim();
13
14
  if (!trimmed) return trimmed;
@@ -33,6 +34,13 @@ function parseTlonTarget(raw) {
33
34
  const trimmed = raw?.trim();
34
35
  if (!trimmed) return null;
35
36
  const withoutPrefix = trimmed.replace(/^tlon:/i, "");
37
+ if (withoutPrefix.startsWith("club:")) {
38
+ const clubId = withoutPrefix.slice(5);
39
+ return TLON_CLUB_ID_RE.test(clubId) ? {
40
+ kind: "club",
41
+ clubId
42
+ } : null;
43
+ }
36
44
  const dmPrefix = withoutPrefix.match(/^dm[/:](.+)$/i);
37
45
  if (dmPrefix) return {
38
46
  kind: "dm",
@@ -74,13 +82,17 @@ function resolveTlonOutboundTarget(to) {
74
82
  ok: true,
75
83
  to: parsed.ship
76
84
  };
85
+ if (parsed.kind === "club") return {
86
+ ok: true,
87
+ to: `club:${parsed.clubId}`
88
+ };
77
89
  return {
78
90
  ok: true,
79
91
  to: parsed.nest
80
92
  };
81
93
  }
82
94
  function formatTargetHint() {
83
- return "dm/~sampel-palnet | ~sampel-palnet | chat/~host-ship/channel | group:~host-ship/channel";
95
+ return "dm/~sampel-palnet | ~sampel-palnet | club:0v1.abcde | chat/~host-ship/channel | group:~host-ship/channel";
84
96
  }
85
97
  // extensions/tlon/src/types.ts
86
98
  function resolveTlonChannelConfig(cfg) {
@@ -122,6 +134,8 @@ function resolveTlonAccount(cfg, accountId) {
122
134
  dangerouslyAllowPrivateNetwork: merged.network?.dangerouslyAllowPrivateNetwork ?? null,
123
135
  groupChannels: merged.groupChannels ?? [],
124
136
  dmAllowlist: merged.dmAllowlist ?? [],
137
+ clubPolicy: merged.clubPolicy ?? null,
138
+ clubRules: merged.clubRules ?? {},
125
139
  groupInviteAllowlist: merged.groupInviteAllowlist ?? [],
126
140
  autoDiscoverChannels: merged.autoDiscoverChannels ?? null,
127
141
  crossChannelCitations: merged.crossChannelCitations ?? null,
@@ -393,4 +407,4 @@ const tlonSetupContract = defineChannelSetupContract({
393
407
  },
394
408
  legacyAdapter: tlonSetupAdapter
395
409
  });
396
- export { isBlockedUrbitHostname as a, resolveTlonAccount as c, parseChannelNest as d, parseTlonTarget as f, tlonSetupContract as i, formatTargetHint as l, createTlonSetupWizardBase as n, validateUrbitBaseUrl as o, resolveTlonOutboundTarget as p, tlonSetupAdapter as r, listTlonAccountIds as s, applyTlonSetupConfig as t, normalizeShip as u };
410
+ export { isBlockedUrbitHostname as a, resolveTlonAccount as c, normalizeShip as d, parseChannelNest as f, tlonSetupContract as i, TLON_CLUB_ID_RE as l, resolveTlonOutboundTarget as m, createTlonSetupWizardBase as n, validateUrbitBaseUrl as o, parseTlonTarget as p, tlonSetupAdapter as r, listTlonAccountIds as s, applyTlonSetupConfig as t, formatTargetHint as u };
@@ -1,4 +1,4 @@
1
- import { a as isBlockedUrbitHostname, c as resolveTlonAccount, n as createTlonSetupWizardBase, o as validateUrbitBaseUrl, t as applyTlonSetupConfig, u as normalizeShip } from "./setup-core-BPDMrrMz.mjs";
1
+ import { a as isBlockedUrbitHostname, c as resolveTlonAccount, d as normalizeShip, n as createTlonSetupWizardBase, o as validateUrbitBaseUrl, t as applyTlonSetupConfig } from "./setup-core-B5UNhQkj.mjs";
2
2
  import { createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup-runtime";
3
3
  // extensions/tlon/src/setup-surface.ts
4
4
  const t = createSetupTranslator();
@@ -1 +1 @@
1
- {"version":3,"entries":[{"output":"api.js","source":"extensions/tlon/api.ts"},{"output":"channel-plugin-api.js","source":"extensions/tlon/channel-plugin-api.ts"},{"output":"doctor-contract-api.js","source":"extensions/tlon/doctor-contract-api.ts"},{"output":"index.js","source":"extensions/tlon/index.ts"},{"output":"runtime-api.js","source":"extensions/tlon/runtime-api.ts"},{"output":"setup-api.js","source":"extensions/tlon/setup-api.ts"},{"output":"setup-entry.js","source":"extensions/tlon/setup-entry.ts"}],"chunks":[{"output":".setup/api-ta2_lGfo.mjs","sha256":"afab805c745e6c5be884a0e30560203fb70e641de67b32faac4ebd5e12d5cee9","facadeSource":"extensions/tlon/api.ts","sources":[]},{"output":".setup/channel-BlmR93dV.mjs","sha256":"5a2a33a95b4d2d990f8f1b8224024b3ce4cd291e4a83af7180d0ff2547f5532b","facadeSource":null,"sources":["extensions/tlon/src/channel.ts","extensions/tlon/src/config-schema.ts","extensions/tlon/src/doctor.ts"]},{"output":".setup/channel.runtime-DFFKdLkd.mjs","sha256":"6bc1e4257c9ba3eb21390ae5c5c2c0b948d8c731738ac998845d045c3c0e6adb","facadeSource":"extensions/tlon/src/channel.runtime.ts","sources":["extensions/tlon/src/channel.runtime.ts","extensions/tlon/src/media-fetch-timeouts.ts","extensions/tlon/src/monitor/approval-runtime.ts","extensions/tlon/src/monitor/approval.ts","extensions/tlon/src/monitor/authorization.ts","extensions/tlon/src/monitor/cites.ts","extensions/tlon/src/monitor/discovery.ts","extensions/tlon/src/monitor/history.ts","extensions/tlon/src/monitor/index.ts","extensions/tlon/src/monitor/ingress.ts","extensions/tlon/src/monitor/media.ts","extensions/tlon/src/monitor/mentions.ts","extensions/tlon/src/monitor/settings-helpers.ts","extensions/tlon/src/monitor/tracking.ts","extensions/tlon/src/monitor/utils.ts","extensions/tlon/src/settings.ts","extensions/tlon/src/tlon-api.ts","extensions/tlon/src/urbit/auth.ts","extensions/tlon/src/urbit/channel-ops.ts","extensions/tlon/src/urbit/context.ts","extensions/tlon/src/urbit/errors.ts","extensions/tlon/src/urbit/fetch.ts","extensions/tlon/src/urbit/redact.ts","extensions/tlon/src/urbit/send.ts","extensions/tlon/src/urbit/sse-client.ts","extensions/tlon/src/urbit/story.ts","extensions/tlon/src/urbit/upload.ts","src/channels/mention-gating.ts"]},{"output":".setup/doctor-contract-CfYeTj9o.mjs","sha256":"cd414672cef0faa7cc964028ec840a10c720f80b8c416ea4695a16931c249e63","facadeSource":null,"sources":["extensions/tlon/src/doctor-contract.ts","packages/normalization-core/src/record-coerce.ts","src/config/channel-config-normalization.ts","src/plugin-sdk/legacy-webhook-listener-migration.ts"]},{"output":".setup/runtime-ReERXJF_.mjs","sha256":"23ea20b9a79e00a2a761e2c1ee5753526019a34f8a5c9caa26b7f9fed435292e","facadeSource":null,"sources":["extensions/tlon/src/runtime.ts"]},{"output":".setup/setup-core-BPDMrrMz.mjs","sha256":"ecc630f7e3c437a67b032ad270189b39e3b3dc40db0b0a80abe85d2075f9a582","facadeSource":null,"sources":["extensions/tlon/src/setup-core.ts","extensions/tlon/src/targets.ts","extensions/tlon/src/types.ts","extensions/tlon/src/urbit/base-url.ts"]},{"output":".setup/setup-surface-loD2Z-9W.mjs","sha256":"e45857ecc559b15021356f109aad6e81e9ecadd21e69d4cbc5b36c7d0f10805f","facadeSource":null,"sources":["extensions/tlon/src/setup-surface.ts"]},{"output":"api.js","sha256":"77657929508a20a80c37db455c597cd0c7ed9d3a765e3a9174ee1049e00aa72a","facadeSource":"extensions/tlon/api.ts","sources":[]},{"output":"channel-plugin-api.js","sha256":"0ffe51f1930c08658dc3f352a234322fd15e1a97f0e617850a4eeeb428b2db3e","facadeSource":"extensions/tlon/channel-plugin-api.ts","sources":[]},{"output":"doctor-contract-api.js","sha256":"269771e05b29fb710fa0c235a6c197e7bdae2550a2607fae3dcb5befd600a040","facadeSource":"extensions/tlon/doctor-contract-api.ts","sources":[]},{"output":"index.js","sha256":"71964a841ad9ec38d0abc3cbbb090b3d19f452a5070009a62ced5883999abd41","facadeSource":"extensions/tlon/index.ts","sources":["extensions/tlon/index.ts"]},{"output":"runtime-api.js","sha256":"84b5cef46a80daf5dd78edb6afd45310e3877e6d91d56716af7992f38f01e7cb","facadeSource":"extensions/tlon/runtime-api.ts","sources":[]},{"output":"setup-api.js","sha256":"97cbc77df6079083383569a53fc424b8c6084bede52c44987fc475b66f2fae0f","facadeSource":"extensions/tlon/setup-api.ts","sources":[]},{"output":"setup-entry.js","sha256":"900a08f923f9286edefba54637b9a124372b1444aeb471b32721af8fe911ab0f","facadeSource":"extensions/tlon/setup-entry.ts","sources":["extensions/tlon/setup-entry.ts"]}],"unrenderedSources":["extensions/tlon/api.ts","extensions/tlon/channel-plugin-api.ts","extensions/tlon/config-doctor-api.ts","extensions/tlon/doctor-contract-api.ts","extensions/tlon/runtime-api.ts","extensions/tlon/setup-api.ts"]}
1
+ {"version":3,"entries":[{"output":"api.js","source":"extensions/tlon/api.ts"},{"output":"channel-plugin-api.js","source":"extensions/tlon/channel-plugin-api.ts"},{"output":"doctor-contract-api.js","source":"extensions/tlon/doctor-contract-api.ts"},{"output":"index.js","source":"extensions/tlon/index.ts"},{"output":"runtime-api.js","source":"extensions/tlon/runtime-api.ts"},{"output":"setup-api.js","source":"extensions/tlon/setup-api.ts"},{"output":"setup-entry.js","source":"extensions/tlon/setup-entry.ts"}],"chunks":[{"output":".setup/api-CF9xyz6W.mjs","sha256":"6db5c5450b33cadaa75663f0f20fd93182ba61239571dac9a327b38e62f83758","facadeSource":"extensions/tlon/api.ts","sources":[]},{"output":".setup/channel-CXwKoHzW.mjs","sha256":"ab546e4e67dfcba8fdf375c81bf4262e7a596dd0300bcba038dc8dbe183cf873","facadeSource":null,"sources":["extensions/tlon/src/channel.ts","extensions/tlon/src/config-schema.ts","extensions/tlon/src/doctor.ts"]},{"output":".setup/channel.runtime-_Z0oICD6.mjs","sha256":"7ae3219404fe31edfe6f484996514e7b98b25fa66df1d4a9a37b17ac9602f7bc","facadeSource":"extensions/tlon/src/channel.runtime.ts","sources":["extensions/tlon/src/channel.runtime.ts","extensions/tlon/src/media-fetch-timeouts.ts","extensions/tlon/src/monitor/approval-runtime.ts","extensions/tlon/src/monitor/approval.ts","extensions/tlon/src/monitor/authorization.ts","extensions/tlon/src/monitor/cites.ts","extensions/tlon/src/monitor/discovery.ts","extensions/tlon/src/monitor/history.ts","extensions/tlon/src/monitor/index.ts","extensions/tlon/src/monitor/ingress.ts","extensions/tlon/src/monitor/media.ts","extensions/tlon/src/monitor/mentions.ts","extensions/tlon/src/monitor/settings-helpers.ts","extensions/tlon/src/monitor/tracking.ts","extensions/tlon/src/monitor/utils.ts","extensions/tlon/src/settings.ts","extensions/tlon/src/tlon-api.ts","extensions/tlon/src/urbit/auth.ts","extensions/tlon/src/urbit/channel-ops.ts","extensions/tlon/src/urbit/context.ts","extensions/tlon/src/urbit/errors.ts","extensions/tlon/src/urbit/fetch.ts","extensions/tlon/src/urbit/redact.ts","extensions/tlon/src/urbit/send.ts","extensions/tlon/src/urbit/sse-client.ts","extensions/tlon/src/urbit/story.ts","extensions/tlon/src/urbit/upload.ts","src/channels/mention-gating.ts"]},{"output":".setup/doctor-contract-CfYeTj9o.mjs","sha256":"cd414672cef0faa7cc964028ec840a10c720f80b8c416ea4695a16931c249e63","facadeSource":null,"sources":["extensions/tlon/src/doctor-contract.ts","packages/normalization-core/src/record-coerce.ts","src/config/channel-config-normalization.ts","src/plugin-sdk/legacy-webhook-listener-migration.ts"]},{"output":".setup/runtime-ReERXJF_.mjs","sha256":"23ea20b9a79e00a2a761e2c1ee5753526019a34f8a5c9caa26b7f9fed435292e","facadeSource":null,"sources":["extensions/tlon/src/runtime.ts"]},{"output":".setup/setup-core-B5UNhQkj.mjs","sha256":"4af122abfefd61b15d223d851547b947d5f69aab9db88d21db29bf03e6ca1a07","facadeSource":null,"sources":["extensions/tlon/src/setup-core.ts","extensions/tlon/src/targets.ts","extensions/tlon/src/types.ts","extensions/tlon/src/urbit/base-url.ts"]},{"output":".setup/setup-surface-DI-cEHqR.mjs","sha256":"512146391a551018e4bec00f580fcd2a9329c7f674a8ef3ea0e1e6e54a025199","facadeSource":null,"sources":["extensions/tlon/src/setup-surface.ts"]},{"output":"api.js","sha256":"4cc9afcbe1535a57646e141e1586a09f7e40c466bf882ffad802b43964d87188","facadeSource":"extensions/tlon/api.ts","sources":[]},{"output":"channel-plugin-api.js","sha256":"3d2c2c4f7c46b48bbf52049bf370206af7f345522b214dcb3771a9f47db45536","facadeSource":"extensions/tlon/channel-plugin-api.ts","sources":[]},{"output":"doctor-contract-api.js","sha256":"269771e05b29fb710fa0c235a6c197e7bdae2550a2607fae3dcb5befd600a040","facadeSource":"extensions/tlon/doctor-contract-api.ts","sources":[]},{"output":"index.js","sha256":"71964a841ad9ec38d0abc3cbbb090b3d19f452a5070009a62ced5883999abd41","facadeSource":"extensions/tlon/index.ts","sources":["extensions/tlon/index.ts"]},{"output":"runtime-api.js","sha256":"84b5cef46a80daf5dd78edb6afd45310e3877e6d91d56716af7992f38f01e7cb","facadeSource":"extensions/tlon/runtime-api.ts","sources":[]},{"output":"setup-api.js","sha256":"c85cadf1919052b3bf00398d7cd0f8629e663c54ac65864ac3a37b6707f80a0c","facadeSource":"extensions/tlon/setup-api.ts","sources":[]},{"output":"setup-entry.js","sha256":"58bae992685d707c7f4f8e75e190bbaf35998c4214bd19ac07eb06d23df9ff6d","facadeSource":"extensions/tlon/setup-entry.ts","sources":["extensions/tlon/setup-entry.ts"]}],"unrenderedSources":["extensions/tlon/api.ts","extensions/tlon/channel-plugin-api.ts","extensions/tlon/config-doctor-api.ts","extensions/tlon/doctor-contract-api.ts","extensions/tlon/runtime-api.ts","extensions/tlon/setup-api.ts"]}
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "./runtime-api.js";
2
- import { t as tlonPlugin } from "./.setup/channel-BlmR93dV.mjs";
2
+ import { t as tlonPlugin } from "./.setup/channel-CXwKoHzW.mjs";
3
3
  import { n as setTlonRuntime } from "./.setup/runtime-ReERXJF_.mjs";
4
4
  export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
@@ -1 +1 @@
1
- export { t as tlonPlugin } from "./.setup/channel-BlmR93dV.mjs";
1
+ export { t as tlonPlugin } from "./.setup/channel-CXwKoHzW.mjs";
package/dist/setup-api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { r as tlonSetupAdapter } from "./.setup/setup-core-BPDMrrMz.mjs";
2
- import { t as tlonSetupWizard } from "./.setup/setup-surface-loD2Z-9W.mjs";
1
+ import { r as tlonSetupAdapter } from "./.setup/setup-core-B5UNhQkj.mjs";
2
+ import { t as tlonSetupWizard } from "./.setup/setup-surface-DI-cEHqR.mjs";
3
3
  export { tlonSetupAdapter, tlonSetupWizard };
@@ -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/api-ta2_lGfo.mjs", import.meta.url).href),
7
+ specifier: fileURLToPath(new URL(".setup/api-CF9xyz6W.mjs", import.meta.url).href),
8
8
  exportName: "tlonPlugin"
9
9
  }
10
10
  });
@@ -74,6 +74,28 @@
74
74
  "minLength": 1
75
75
  }
76
76
  },
77
+ "clubPolicy": {
78
+ "type": "string",
79
+ "enum": [
80
+ "approve-once",
81
+ "approve-each",
82
+ "disabled"
83
+ ]
84
+ },
85
+ "clubRules": {
86
+ "type": "object",
87
+ "propertyNames": {
88
+ "type": "string",
89
+ "pattern": "^0v(?:0|[1-9a-v][0-9a-v]{0,4}(?:\\.[0-9a-v]{5})*)$"
90
+ },
91
+ "additionalProperties": {
92
+ "type": "string",
93
+ "enum": [
94
+ "allow",
95
+ "deny"
96
+ ]
97
+ }
98
+ },
77
99
  "groupInviteAllowlist": {
78
100
  "type": "array",
79
101
  "items": {
@@ -222,6 +244,28 @@
222
244
  "minLength": 1
223
245
  }
224
246
  },
247
+ "clubPolicy": {
248
+ "type": "string",
249
+ "enum": [
250
+ "approve-once",
251
+ "approve-each",
252
+ "disabled"
253
+ ]
254
+ },
255
+ "clubRules": {
256
+ "type": "object",
257
+ "propertyNames": {
258
+ "type": "string",
259
+ "pattern": "^0v(?:0|[1-9a-v][0-9a-v]{0,4}(?:\\.[0-9a-v]{5})*)$"
260
+ },
261
+ "additionalProperties": {
262
+ "type": "string",
263
+ "enum": [
264
+ "allow",
265
+ "deny"
266
+ ]
267
+ }
268
+ },
225
269
  "groupInviteAllowlist": {
226
270
  "type": "array",
227
271
  "items": {
@@ -307,6 +351,22 @@
307
351
  "label": "Require Mention in Bot Threads",
308
352
  "help": "Override mention gating when this account's ship authored the thread root. False allows unmentioned replies; true requires a mention even after the bot participates. Omit to preserve existing behavior. Sender authorization still applies."
309
353
  },
354
+ "clubPolicy": {
355
+ "label": "Tlon Group DM Policy",
356
+ "help": "Default: approve-once. Enable each club once for automatic replies, require approval for every message with approve-each, or disable group DMs. Club authors and participants are unverified."
357
+ },
358
+ "accounts.*.clubPolicy": {
359
+ "label": "Tlon Group DM Policy",
360
+ "help": "Default: approve-once. Enable each club once for automatic replies, require approval for every message with approve-each, or disable group DMs. Club authors and participants are unverified."
361
+ },
362
+ "clubRules": {
363
+ "label": "Tlon Group DM Rules",
364
+ "help": "Club IDs mapped to allow or deny. Allow accepts unverified input delivered under that club ID with the agent's normal permitted tools; it does not authenticate participants or grant owner authority. Deny blocks the club, not a claimed ship. Approve-each still requires each message; disabled overrides all rules."
365
+ },
366
+ "accounts.*.clubRules": {
367
+ "label": "Tlon Group DM Rules",
368
+ "help": "Club IDs mapped to allow or deny. Allow accepts unverified input delivered under that club ID with the agent's normal permitted tools; it does not authenticate participants or grant owner authority. Deny blocks the club, not a claimed ship. Approve-each still requires each message; disabled overrides all rules."
369
+ },
310
370
  "crossChannelCitations": {
311
371
  "label": "Tlon Cross-Channel Citations",
312
372
  "help": "Expand citations of posts from other channels into agent context. False expands only citations of the channel a message was posted in; the owner's 1:1 DMs are exempt. Default: true."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/tlon",
3
- "version": "2026.11.10-beta.3",
3
+ "version": "2026.12.1-beta.1",
4
4
  "description": "OpenClaw Tlon/Urbit channel plugin for chat workflows.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "openclaw": "workspace:*"
20
20
  },
21
21
  "peerDependencies": {
22
- "openclaw": ">=2026.11.10-beta.3"
22
+ "openclaw": ">=2026.12.1-beta.1"
23
23
  },
24
24
  "peerDependenciesMeta": {
25
25
  "openclaw": {
@@ -121,10 +121,10 @@
121
121
  "minHostVersion": ">=2026.4.10"
122
122
  },
123
123
  "compat": {
124
- "pluginApi": ">=2026.11.10-beta.3"
124
+ "pluginApi": ">=2026.12.1-beta.1"
125
125
  },
126
126
  "build": {
127
- "openclawVersion": "2026.11.10-beta.3"
127
+ "openclawVersion": "2026.12.1-beta.1"
128
128
  },
129
129
  "release": {
130
130
  "bundleRuntimeDependencies": false,