@openclaw/tlon 2026.8.1-beta.3 → 2026.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as ssrfPolicyFromDangerouslyAllowPrivateNetwork, i as isBlockedHostnameOrIp, n as createDedupeCache, o as createLoggerBackedRuntime, r as fetchWithSsrFGuard, t as SsrFBlockedError } from "./runtime-api-BXVe40nS.js";
2
- import { t as tlonPlugin } from "./channel-CoKm1n5s.js";
2
+ import { t as tlonPlugin } from "./channel-CfQ-5CaO.js";
3
3
  import { n as setTlonRuntime } from "./runtime-Ck3lNvST.js";
4
4
  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-CZ8OWBXt.js";
2
- import { d as resolveTlonAccount, f as formatTargetHint, g as resolveTlonOutboundTarget, h as parseTlonTarget, n as createTlonSetupWizardBase, o as tlonSetupContract, p as normalizeShip, u as listTlonAccountIds } from "./setup-core-QCmS9Gmh.js";
2
+ import { d as resolveTlonAccount, f as formatTargetHint, g as resolveTlonOutboundTarget, h as parseTlonTarget, n as createTlonSetupWizardBase, o as tlonSetupContract, p as normalizeShip, u as listTlonAccountIds } from "./setup-core-CYiZjoTI.js";
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";
@@ -24,6 +24,7 @@ const tlonCommonConfigFields = {
24
24
  name: z.string().optional(),
25
25
  enabled: z.boolean().optional(),
26
26
  configWrites: z.boolean().optional(),
27
+ mediaMaxMb: z.number().positive().optional(),
27
28
  ship: ShipSchema.optional(),
28
29
  url: z.string().optional(),
29
30
  code: z.string().optional(),
@@ -42,6 +43,7 @@ const tlonCommonConfigFields = {
42
43
  const TlonAccountSchema = z.object({ ...tlonCommonConfigFields });
43
44
  const tlonChannelConfigSchema = buildChannelConfigSchema(z.object({
44
45
  ...tlonCommonConfigFields,
46
+ historyLimit: z.number().int().min(0).optional(),
45
47
  authorization: TlonAuthorizationSchema.optional(),
46
48
  defaultAuthorizedShips: z.array(ShipSchema).optional(),
47
49
  accounts: z.record(z.string(), TlonAccountSchema).optional()
@@ -92,7 +94,7 @@ function resolveTlonOutboundSessionRoute(params) {
92
94
  //#endregion
93
95
  //#region extensions/tlon/src/channel.ts
94
96
  const TLON_CHANNEL_ID = "tlon";
95
- const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-BShnsKnQ.js"));
97
+ const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-wL0vCIES.js"));
96
98
  const tlonSetupWizardProxy = createTlonSetupWizardBase({
97
99
  resolveConfigured: async ({ cfg, accountId }) => await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveConfigured({
98
100
  cfg,
@@ -1,2 +1,2 @@
1
- import { t as tlonPlugin } from "./channel-CoKm1n5s.js";
1
+ import { t as tlonPlugin } from "./channel-CfQ-5CaO.js";
2
2
  export { tlonPlugin };
@@ -1,7 +1,7 @@
1
1
  import { n as createDedupeCache, o as createLoggerBackedRuntime } from "./runtime-api-BXVe40nS.js";
2
- import { c as normalizeUrbitHostname, d as resolveTlonAccount, f as formatTargetHint, g as resolveTlonOutboundTarget, h as parseTlonTarget, l as validateUrbitBaseUrl, m as parseChannelNest, p as normalizeShip } from "./setup-core-QCmS9Gmh.js";
2
+ import { c as normalizeUrbitHostname, d as resolveTlonAccount, f as formatTargetHint, g as resolveTlonOutboundTarget, h as parseTlonTarget, l as validateUrbitBaseUrl, m as parseChannelNest, p as normalizeShip } from "./setup-core-CYiZjoTI.js";
3
3
  import { t as getTlonRuntime } from "./runtime-Ck3lNvST.js";
4
- import { t as tlonSetupWizard } from "./setup-surface-UgXzT7Tg.js";
4
+ import { t as tlonSetupWizard } from "./setup-surface-35N3bJMh.js";
5
5
  import { fetchWithSsrFGuard, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
6
6
  import { bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor, createMessageReceiptFromOutboundResults, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
7
7
  import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
@@ -1205,8 +1205,8 @@ var UrbitSSEClient = class {
1205
1205
  let data = null;
1206
1206
  let eventId = null;
1207
1207
  for (const line of lines) {
1208
- if (line.startsWith("id: ")) eventId = parseUrbitSseEventId(line.slice(4));
1209
- if (line.startsWith("data: ")) data = line.slice(6);
1208
+ if (line.startsWith("id:")) eventId = parseUrbitSseEventId(line.slice(3).trim());
1209
+ if (line.startsWith("data:")) data = line.slice(5).trim();
1210
1210
  }
1211
1211
  if (!data) return;
1212
1212
  let parsed;
@@ -1532,7 +1532,7 @@ function formatPendingList(approvals) {
1532
1532
  //#region extensions/tlon/src/monitor/approval-runtime.ts
1533
1533
  function createTlonApprovalRuntime(params) {
1534
1534
  const { api, runtime, botShipName, getPendingApprovals, setPendingApprovals, getCurrentSettings, setCurrentSettings, getEffectiveDmAllowlist, setEffectiveDmAllowlist, getEffectiveOwnerShip, processApprovedMessage, refreshWatchedChannels } = params;
1535
- const savePendingApprovals = async () => {
1535
+ const savePendingApprovals = async (required = false) => {
1536
1536
  try {
1537
1537
  await api.poke({
1538
1538
  app: "settings",
@@ -1546,6 +1546,7 @@ function createTlonApprovalRuntime(params) {
1546
1546
  });
1547
1547
  } catch (err) {
1548
1548
  runtime.error?.(`[tlon] Failed to save pending approvals: ${String(err)}`);
1549
+ if (required) throw err;
1549
1550
  }
1550
1551
  };
1551
1552
  const addToDmAllowlist = async (ship) => {
@@ -1684,12 +1685,12 @@ function createTlonApprovalRuntime(params) {
1684
1685
  existing.messagePreview = approval.messagePreview;
1685
1686
  }
1686
1687
  runtime.log?.(`[tlon] Updated existing approval for ${approval.requestingShip} (${approval.type}) - re-sending notification`);
1687
- await savePendingApprovals();
1688
+ await savePendingApprovals(true);
1688
1689
  await sendOwnerNotification(formatApprovalRequest(existing));
1689
1690
  return;
1690
1691
  }
1691
1692
  setPendingApprovals([...approvals, approval]);
1692
- await savePendingApprovals();
1693
+ await savePendingApprovals(true);
1693
1694
  await sendOwnerNotification(formatApprovalRequest(approval));
1694
1695
  runtime.log?.(`[tlon] Queued approval request: ${approval.id} (${approval.type} from ${approval.requestingShip})`);
1695
1696
  };
@@ -2441,7 +2442,7 @@ function extractImageBlocks(content) {
2441
2442
  * Download a media file from URL to local storage.
2442
2443
  * Returns the local path where the file was saved.
2443
2444
  */
2444
- async function downloadMedia(url, mediaDir) {
2445
+ async function downloadMedia(url, mediaDir, maxBytes) {
2445
2446
  try {
2446
2447
  const parsedUrl = new URL(url);
2447
2448
  if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
@@ -2450,7 +2451,7 @@ async function downloadMedia(url, mediaDir) {
2450
2451
  }
2451
2452
  const fetchOptions = {
2452
2453
  url,
2453
- maxBytes: MAX_IMAGE_BYTES,
2454
+ maxBytes: Math.min(maxBytes ?? MAX_IMAGE_BYTES, MAX_IMAGE_BYTES),
2454
2455
  ...TLON_MEDIA_FETCH_TIMEOUTS,
2455
2456
  ssrfPolicy: void 0,
2456
2457
  requestInit: { method: "GET" }
@@ -2495,12 +2496,12 @@ function getExtensionFromUrl(url) {
2495
2496
  * Download all images from a message and return attachment metadata.
2496
2497
  * Format matches OpenClaw's expected attachment structure.
2497
2498
  */
2498
- async function downloadMessageImages(content, mediaDir) {
2499
+ async function downloadMessageImages(content, mediaDir, maxBytes) {
2499
2500
  const { images, unavailableCount: overCapCount } = extractImageBlocks(content);
2500
2501
  const attachments = [];
2501
2502
  let unavailableCount = overCapCount;
2502
2503
  for (const image of images) {
2503
- const downloaded = await downloadMedia(image.url, mediaDir);
2504
+ const downloaded = await downloadMedia(image.url, mediaDir, maxBytes);
2504
2505
  if (downloaded) attachments.push({
2505
2506
  path: downloaded.localPath,
2506
2507
  contentType: downloaded.contentType
@@ -2792,7 +2793,7 @@ async function monitorTlonProvider(opts = {}) {
2792
2793
  let attachments = [];
2793
2794
  let unavailableMediaCount = 0;
2794
2795
  if (messageContent) try {
2795
- ({attachments, unavailableCount: unavailableMediaCount} = await downloadMessageImages(messageContent));
2796
+ ({attachments, unavailableCount: unavailableMediaCount} = await downloadMessageImages(messageContent, void 0, account.mediaMaxBytes));
2796
2797
  if (attachments.length > 0) runtime.log?.(`[tlon] Downloaded ${attachments.length} image(s) from message`);
2797
2798
  } catch (error) {
2798
2799
  runtime.log?.(`[tlon] Failed to download images: ${formatErrorMessage(error)}`);
@@ -2962,7 +2963,6 @@ async function monitorTlonProvider(opts = {}) {
2962
2963
  }
2963
2964
  });
2964
2965
  const dispatchStartTime = Date.now();
2965
- const responsePrefix = core.channel.reply.resolveEffectiveMessagesConfig(cfg, route.agentId).responsePrefix;
2966
2966
  const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
2967
2967
  const deliveryTarget = isGroup ? groupChannel : senderShip;
2968
2968
  const prepareReplyPayload = (payload) => {
@@ -2996,6 +2996,7 @@ async function monitorTlonProvider(opts = {}) {
2996
2996
  sessionKey: route.sessionKey
2997
2997
  },
2998
2998
  ctxPayload,
2999
+ replyPipeline: {},
2999
3000
  delivery: {
3000
3001
  preparePayload: prepareReplyPayload,
3001
3002
  durable: deliveryTarget ? () => ({
@@ -3038,10 +3039,7 @@ async function monitorTlonProvider(opts = {}) {
3038
3039
  runtime.error?.(`[tlon] ${info.kind} reply failed after ${dispatchDuration}ms: ${String(err)}`);
3039
3040
  }
3040
3041
  },
3041
- dispatcherOptions: {
3042
- responsePrefix,
3043
- humanDelay
3044
- },
3042
+ dispatcherOptions: { humanDelay },
3045
3043
  ...turnAdoptionLifecycle || promptMedia.media.length > 0 ? { replyOptions } : {},
3046
3044
  record: { onRecordError: (err) => {
3047
3045
  runtime.error?.(`[tlon] failed updating session meta: ${String(err)}`);
@@ -3249,25 +3247,9 @@ async function monitorTlonProvider(opts = {}) {
3249
3247
  const ships = processedDmInvites.beginSnapshot(event.map((invite) => normalizeShip(invite.ship || "")).filter(Boolean));
3250
3248
  for (const ship of ships) {
3251
3249
  if (processedDmInvites.has(ship)) continue;
3252
- if (isOwner(ship)) {
3253
- try {
3254
- await api.poke({
3255
- app: "chat",
3256
- mark: "chat-dm-rsvp",
3257
- json: {
3258
- ship,
3259
- ok: true
3260
- }
3261
- });
3262
- processedDmInvites.add(ship);
3263
- runtime.log?.(`[tlon] Auto-accepted DM invite from owner ${ship}`);
3264
- } catch (err) {
3265
- runtime.error?.(`[tlon] Failed to auto-accept DM from owner: ${String(err)}`);
3266
- }
3267
- continue;
3268
- }
3269
- const allowed = await isDmAllowedWithIngress(ship, effectiveDmAllowlist);
3270
- if (effectiveAutoAcceptDmInvites && allowed) {
3250
+ const ownerInvite = isOwner(ship);
3251
+ const allowed = ownerInvite || await isDmAllowedWithIngress(ship, effectiveDmAllowlist);
3252
+ if (ownerInvite || effectiveAutoAcceptDmInvites && allowed) {
3271
3253
  try {
3272
3254
  await api.poke({
3273
3255
  app: "chat",
@@ -3278,9 +3260,10 @@ async function monitorTlonProvider(opts = {}) {
3278
3260
  }
3279
3261
  });
3280
3262
  processedDmInvites.add(ship);
3281
- runtime.log?.(`[tlon] Auto-accepted DM invite from ${ship}`);
3263
+ runtime.log?.(ownerInvite ? `[tlon] Auto-accepted DM invite from owner ${ship}` : `[tlon] Auto-accepted DM invite from ${ship}`);
3282
3264
  } catch (err) {
3283
- runtime.error?.(`[tlon] Failed to auto-accept DM from ${ship}: ${String(err)}`);
3265
+ runtime.error?.(ownerInvite ? `[tlon] Failed to auto-accept DM from owner: ${String(err)}` : `[tlon] Failed to auto-accept DM from ${ship}: ${String(err)}`);
3266
+ throw err;
3284
3267
  }
3285
3268
  continue;
3286
3269
  }
@@ -3503,74 +3486,41 @@ async function monitorTlonProvider(opts = {}) {
3503
3486
  await api.subscribe({
3504
3487
  app: "groups",
3505
3488
  path: "/groups/ui",
3506
- event: (event) => {
3507
- (async () => {
3508
- try {
3509
- const eventRecord = asNullableRecord(event);
3510
- if (eventRecord) {
3511
- const channels = asNullableRecord(eventRecord.channels);
3512
- if (channels) for (const [channelNest, _channelData] of Object.entries(channels)) {
3513
- if (!channelNest.startsWith("chat/")) continue;
3514
- if (!watchedChannels.has(channelNest)) {
3515
- watchedChannels.add(channelNest);
3516
- runtime.log?.(`[tlon] Auto-detected new channel (invite accepted): ${channelNest}`);
3517
- if (effectiveAutoAcceptGroupInvites) try {
3518
- const currentChannels = currentSettings.groupChannels || [];
3519
- if (!currentChannels.includes(channelNest)) {
3520
- const updatedChannels = [...currentChannels, channelNest];
3521
- await api.poke({
3522
- app: "settings",
3523
- mark: "settings-event",
3524
- json: { "put-entry": {
3525
- "bucket-key": "tlon",
3526
- "entry-key": "groupChannels",
3527
- value: updatedChannels,
3528
- desk: "moltbot"
3529
- } }
3530
- });
3531
- runtime.log?.(`[tlon] Persisted ${channelNest} to settings store`);
3532
- }
3533
- } catch (err) {
3534
- runtime.error?.(`[tlon] Failed to persist channel to settings: ${String(err)}`);
3535
- }
3536
- }
3537
- }
3538
- const join = asNullableRecord(eventRecord.join);
3539
- if (join) {
3540
- const joinChannels = Array.isArray(join.channels) ? join.channels : [];
3541
- if (joinChannels.length > 0) for (const channelNest of joinChannels) {
3542
- if (typeof channelNest !== "string") continue;
3543
- if (!channelNest.startsWith("chat/")) continue;
3544
- if (!watchedChannels.has(channelNest)) {
3545
- watchedChannels.add(channelNest);
3546
- runtime.log?.(`[tlon] Auto-detected joined channel: ${channelNest}`);
3547
- if (effectiveAutoAcceptGroupInvites) try {
3548
- const currentChannels = currentSettings.groupChannels || [];
3549
- if (!currentChannels.includes(channelNest)) {
3550
- const updatedChannels = [...currentChannels, channelNest];
3551
- await api.poke({
3552
- app: "settings",
3553
- mark: "settings-event",
3554
- json: { "put-entry": {
3555
- "bucket-key": "tlon",
3556
- "entry-key": "groupChannels",
3557
- value: updatedChannels,
3558
- desk: "moltbot"
3559
- } }
3560
- });
3561
- runtime.log?.(`[tlon] Persisted ${channelNest} to settings store`);
3562
- }
3563
- } catch (err) {
3564
- runtime.error?.(`[tlon] Failed to persist channel to settings: ${String(err)}`);
3565
- }
3566
- }
3567
- }
3568
- }
3569
- }
3570
- } catch (error) {
3571
- runtime.error?.(`[tlon] Error handling groups-ui event: ${formatErrorMessage(error)}`);
3489
+ event: async (event) => {
3490
+ try {
3491
+ const eventRecord = asNullableRecord(event);
3492
+ if (!eventRecord) return;
3493
+ const join = asNullableRecord(eventRecord.join);
3494
+ const joinedChannels = Array.isArray(join?.channels) ? join.channels : [];
3495
+ const discoveredChannels = mergeUniqueStrings(Object.keys(asNullableRecord(eventRecord.channels) ?? {}), joinedChannels.filter((channel) => typeof channel === "string")).filter((channel) => channel.startsWith("chat/"));
3496
+ for (const channelNest of discoveredChannels) if (!watchedChannels.has(channelNest)) {
3497
+ watchedChannels.add(channelNest);
3498
+ runtime.log?.(`[tlon] Auto-detected new channel: ${channelNest}`);
3572
3499
  }
3573
- })();
3500
+ if (!effectiveAutoAcceptGroupInvites) return;
3501
+ const currentChannels = currentSettings.groupChannels ?? [];
3502
+ const unpersistedChannels = discoveredChannels.filter((channel) => !currentChannels.includes(channel));
3503
+ if (unpersistedChannels.length === 0) return;
3504
+ const updatedChannels = mergeUniqueStrings(currentChannels, unpersistedChannels);
3505
+ await api.poke({
3506
+ app: "settings",
3507
+ mark: "settings-event",
3508
+ json: { "put-entry": {
3509
+ "bucket-key": "tlon",
3510
+ "entry-key": "groupChannels",
3511
+ value: updatedChannels,
3512
+ desk: "moltbot"
3513
+ } }
3514
+ });
3515
+ currentSettings = {
3516
+ ...currentSettings,
3517
+ groupChannels: updatedChannels
3518
+ };
3519
+ runtime.log?.(`[tlon] Persisted ${unpersistedChannels.join(", ")} to settings store`);
3520
+ } catch (error) {
3521
+ runtime.error?.(`[tlon] Error handling groups-ui event: ${formatErrorMessage(error)}`);
3522
+ throw error;
3523
+ }
3574
3524
  },
3575
3525
  err: (error) => {
3576
3526
  runtime.error?.(`[tlon] Groups-ui subscription error: ${String(error)}`);
@@ -3585,15 +3535,17 @@ async function monitorTlonProvider(opts = {}) {
3585
3535
  }
3586
3536
  {
3587
3537
  const processedGroupInvites = /* @__PURE__ */ new Set();
3588
- const processPendingInvites = async (foreigns) => {
3538
+ const processPendingInvites = async (foreigns, propagateWriteFailures = false) => {
3589
3539
  if (!foreigns || typeof foreigns !== "object") return;
3540
+ let firstWriteError;
3590
3541
  for (const [groupFlag, foreign] of Object.entries(foreigns)) {
3591
3542
  if (processedGroupInvites.has(groupFlag)) continue;
3592
3543
  if (!foreign.invites || foreign.invites.length === 0) continue;
3593
3544
  const validInvite = foreign.invites.find((inv) => inv.valid);
3594
3545
  if (!validInvite) continue;
3595
3546
  const inviterShip = validInvite.from;
3596
- if (isOwner(inviterShip)) {
3547
+ const ownerInvite = isOwner(inviterShip);
3548
+ if (ownerInvite || effectiveAutoAcceptGroupInvites && isGroupInviteAllowed(inviterShip, effectiveGroupInviteAllowlist)) {
3597
3549
  try {
3598
3550
  await api.poke({
3599
3551
  app: "groups",
@@ -3604,68 +3556,46 @@ async function monitorTlonProvider(opts = {}) {
3604
3556
  }
3605
3557
  });
3606
3558
  processedGroupInvites.add(groupFlag);
3607
- runtime.log?.(`[tlon] Auto-accepted group invite from owner: ${groupFlag}`);
3559
+ runtime.log?.(ownerInvite ? `[tlon] Auto-accepted group invite from owner: ${groupFlag}` : `[tlon] Auto-accepted group invite: ${groupFlag} (from ${inviterShip})`);
3608
3560
  } catch (err) {
3609
- runtime.error?.(`[tlon] Failed to accept group invite from owner: ${String(err)}`);
3561
+ runtime.error?.(ownerInvite ? `[tlon] Failed to accept group invite from owner: ${String(err)}` : `[tlon] Failed to auto-accept group ${groupFlag}: ${String(err)}`);
3562
+ if (propagateWriteFailures && firstWriteError === void 0) firstWriteError = err instanceof Error ? err : new Error(formatErrorMessage(err));
3610
3563
  }
3611
3564
  continue;
3612
3565
  }
3613
- if (!effectiveAutoAcceptGroupInvites) {
3614
- if (effectiveOwnerShip) {
3615
- const approval = createPendingApproval({
3616
- type: "group",
3617
- requestingShip: inviterShip,
3618
- groupFlag
3619
- });
3620
- await queueApprovalRequest(approval);
3621
- processedGroupInvites.add(groupFlag);
3622
- }
3623
- continue;
3624
- }
3625
- if (!isGroupInviteAllowed(inviterShip, effectiveGroupInviteAllowlist)) {
3626
- if (effectiveOwnerShip) {
3627
- const approval = createPendingApproval({
3628
- type: "group",
3629
- requestingShip: inviterShip,
3630
- groupFlag
3631
- });
3632
- await queueApprovalRequest(approval);
3633
- processedGroupInvites.add(groupFlag);
3634
- } else {
3635
- runtime.log?.(`[tlon] Rejected group invite from ${inviterShip} (not in groupInviteAllowlist): ${groupFlag}`);
3636
- processedGroupInvites.add(groupFlag);
3637
- }
3566
+ if (effectiveOwnerShip) {
3567
+ const approval = createPendingApproval({
3568
+ type: "group",
3569
+ requestingShip: inviterShip,
3570
+ groupFlag
3571
+ });
3572
+ await queueApprovalRequest(approval);
3573
+ processedGroupInvites.add(groupFlag);
3638
3574
  continue;
3639
3575
  }
3640
- try {
3641
- await api.poke({
3642
- app: "groups",
3643
- mark: "group-join",
3644
- json: {
3645
- flag: groupFlag,
3646
- "join-all": true
3647
- }
3648
- });
3576
+ if (effectiveAutoAcceptGroupInvites) {
3577
+ runtime.log?.(`[tlon] Rejected group invite from ${inviterShip} (not in groupInviteAllowlist): ${groupFlag}`);
3649
3578
  processedGroupInvites.add(groupFlag);
3650
- runtime.log?.(`[tlon] Auto-accepted group invite: ${groupFlag} (from ${validInvite.from})`);
3651
- } catch (err) {
3652
- runtime.error?.(`[tlon] Failed to auto-accept group ${groupFlag}: ${String(err)}`);
3653
3579
  }
3654
3580
  }
3581
+ if (firstWriteError !== void 0) throw firstWriteError;
3655
3582
  };
3656
- if (initForeigns) await processPendingInvites(initForeigns);
3583
+ if (initForeigns) try {
3584
+ await processPendingInvites(initForeigns);
3585
+ } catch (error) {
3586
+ runtime.error?.(`[tlon] Error handling initial foreigns: ${formatErrorMessage(error)}`);
3587
+ }
3657
3588
  try {
3658
3589
  await api.subscribe({
3659
3590
  app: "groups",
3660
3591
  path: "/v1/foreigns",
3661
- event: (data) => {
3662
- (async () => {
3663
- try {
3664
- await processPendingInvites(data);
3665
- } catch (error) {
3666
- runtime.error?.(`[tlon] Error handling foreigns event: ${formatErrorMessage(error)}`);
3667
- }
3668
- })();
3592
+ event: async (data) => {
3593
+ try {
3594
+ await processPendingInvites(data, true);
3595
+ } catch (error) {
3596
+ runtime.error?.(`[tlon] Error handling foreigns event: ${formatErrorMessage(error)}`);
3597
+ throw error;
3598
+ }
3669
3599
  },
3670
3600
  err: (error) => {
3671
3601
  runtime.error?.(`[tlon] Foreigns subscription error: ${String(error)}`);
@@ -3956,24 +3886,23 @@ async function uploadFile(params) {
3956
3886
  */
3957
3887
  /**
3958
3888
  * Fetch an image from a URL and upload it to Tlon storage.
3959
- * Returns the uploaded URL, or falls back to the original URL on error.
3889
+ * Falls back to the original URL on error, but only after a bounded download when a cap is set.
3960
3890
  *
3961
3891
  * Note: configureClient must be called before using this function.
3962
3892
  */
3963
- async function uploadImageFromUrl(imageUrl) {
3893
+ async function uploadImageFromUrl(imageUrl, maxBytes) {
3894
+ let sourceSizeVerified = false;
3964
3895
  try {
3965
3896
  const url = new URL(imageUrl);
3966
- if (url.protocol !== "http:" && url.protocol !== "https:") {
3967
- console.warn(`[tlon] Rejected non-http(s) URL: ${imageUrl}`);
3968
- return imageUrl;
3969
- }
3897
+ if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("Tlon image URL must use HTTP or HTTPS");
3970
3898
  const fetched = await readRemoteMediaBuffer({
3971
3899
  url: imageUrl,
3972
- maxBytes: MAX_IMAGE_BYTES,
3900
+ maxBytes: Math.min(maxBytes ?? MAX_IMAGE_BYTES, MAX_IMAGE_BYTES),
3973
3901
  ...TLON_MEDIA_FETCH_TIMEOUTS,
3974
3902
  ssrfPolicy: void 0,
3975
3903
  requestInit: { method: "GET" }
3976
3904
  });
3905
+ sourceSizeVerified = true;
3977
3906
  const contentType = fetched.contentType || "image/png";
3978
3907
  return (await uploadFile({
3979
3908
  blob: new Blob([new Uint8Array(fetched.buffer)], { type: contentType }),
@@ -3981,6 +3910,7 @@ async function uploadImageFromUrl(imageUrl) {
3981
3910
  contentType
3982
3911
  })).url;
3983
3912
  } catch (err) {
3913
+ if (maxBytes !== void 0 && !sourceSizeVerified) throw err;
3984
3914
  console.warn(`[tlon] Failed to upload image, using original URL: ${String(err)}`);
3985
3915
  return imageUrl;
3986
3916
  }
@@ -4108,7 +4038,7 @@ const tlonRuntimeOutbound = {
4108
4038
  getCode: async () => account.code,
4109
4039
  dangerouslyAllowPrivateNetwork: account.dangerouslyAllowPrivateNetwork ?? void 0
4110
4040
  });
4111
- const uploadedUrl = mediaUrl ? await uploadImageFromUrl(mediaUrl) : void 0;
4041
+ const uploadedUrl = mediaUrl ? await uploadImageFromUrl(mediaUrl, account.mediaMaxBytes) : void 0;
4112
4042
  return withHttpPokeAccountApi(account, async (api) => {
4113
4043
  const fromShip = normalizeShip(account.ship);
4114
4044
  const story = buildMediaStory(text, uploadedUrl);
package/dist/setup-api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as tlonSetupAdapter } from "./setup-core-QCmS9Gmh.js";
2
- import { t as tlonSetupWizard } from "./setup-surface-UgXzT7Tg.js";
1
+ import { a as tlonSetupAdapter } from "./setup-core-CYiZjoTI.js";
2
+ import { t as tlonSetupWizard } from "./setup-surface-35N3bJMh.js";
3
3
  export { tlonSetupAdapter, tlonSetupWizard };
@@ -1,5 +1,5 @@
1
1
  import { hasLegacyFlatAllowPrivateNetworkAlias, isBlockedHostnameOrIp, isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
2
- import { createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers";
2
+ import { createAccountListHelpers, resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
3
3
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
4
4
  import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
5
5
  import { DEFAULT_ACCOUNT_ID, createSetupInputPresenceValidator, createSetupTranslator, formatDocsLink, normalizeAccountId, patchScopedAccountConfig, prepareScopedSetupConfig } from "openclaw/plugin-sdk/setup";
@@ -158,6 +158,11 @@ function resolveTlonAccount(cfg, accountId) {
158
158
  name: merged.name ?? null,
159
159
  enabled: merged.enabled !== false,
160
160
  configured,
161
+ mediaMaxBytes: resolveChannelMediaMaxBytes({
162
+ cfg,
163
+ accountId: resolvedAccountId,
164
+ resolveChannelLimitMb: () => merged.mediaMaxMb
165
+ }),
161
166
  ship,
162
167
  url,
163
168
  code,
@@ -1,4 +1,4 @@
1
- import { d as resolveTlonAccount, i as resolveTlonSetupStatusLines, l as validateUrbitBaseUrl, n as createTlonSetupWizardBase, p as normalizeShip, r as resolveTlonSetupConfigured, s as isBlockedUrbitHostname, t as applyTlonSetupConfig } from "./setup-core-QCmS9Gmh.js";
1
+ import { d as resolveTlonAccount, i as resolveTlonSetupStatusLines, l as validateUrbitBaseUrl, n as createTlonSetupWizardBase, p as normalizeShip, r as resolveTlonSetupConfigured, s as isBlockedUrbitHostname, t as applyTlonSetupConfig } from "./setup-core-CYiZjoTI.js";
2
2
  import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { createSetupTranslator } from "openclaw/plugin-sdk/setup-runtime";
4
4
  //#region extensions/tlon/src/setup-surface.ts
@@ -34,6 +34,10 @@
34
34
  "configWrites": {
35
35
  "type": "boolean"
36
36
  },
37
+ "mediaMaxMb": {
38
+ "type": "number",
39
+ "exclusiveMinimum": 0
40
+ },
37
41
  "ship": {
38
42
  "type": "string",
39
43
  "minLength": 1
@@ -108,6 +112,11 @@
108
112
  "type": "string",
109
113
  "minLength": 1
110
114
  },
115
+ "historyLimit": {
116
+ "type": "integer",
117
+ "minimum": 0,
118
+ "maximum": 9007199254740991
119
+ },
111
120
  "authorization": {
112
121
  "type": "object",
113
122
  "properties": {
@@ -164,6 +173,10 @@
164
173
  "configWrites": {
165
174
  "type": "boolean"
166
175
  },
176
+ "mediaMaxMb": {
177
+ "type": "number",
178
+ "exclusiveMinimum": 0
179
+ },
167
180
  "ship": {
168
181
  "type": "string",
169
182
  "minLength": 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/tlon",
3
- "version": "2026.8.1-beta.3",
3
+ "version": "2026.8.1",
4
4
  "description": "OpenClaw Tlon/Urbit channel plugin for chat workflows.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,9 +8,9 @@
8
8
  },
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "@aws-sdk/client-s3": "3.1095.0",
12
- "@aws-sdk/s3-request-presigner": "3.1095.0",
13
- "@tloncorp/tlon-skill": "0.4.5",
11
+ "@aws-sdk/client-s3": "3.1116.0",
12
+ "@aws-sdk/s3-request-presigner": "3.1116.0",
13
+ "@tloncorp/tlon-skill": "0.5.0",
14
14
  "@urbit/aura": "3.0.0",
15
15
  "zod": "4.4.3"
16
16
  },
@@ -19,7 +19,7 @@
19
19
  "openclaw": "workspace:*"
20
20
  },
21
21
  "peerDependencies": {
22
- "openclaw": ">=2026.8.1-beta.3"
22
+ "openclaw": ">=2026.8.1"
23
23
  },
24
24
  "peerDependenciesMeta": {
25
25
  "openclaw": {
@@ -120,10 +120,10 @@
120
120
  "minHostVersion": ">=2026.4.10"
121
121
  },
122
122
  "compat": {
123
- "pluginApi": ">=2026.8.1-beta.3"
123
+ "pluginApi": ">=2026.8.1"
124
124
  },
125
125
  "build": {
126
- "openclawVersion": "2026.8.1-beta.3"
126
+ "openclawVersion": "2026.8.1"
127
127
  },
128
128
  "release": {
129
129
  "bundleRuntimeDependencies": false,