@openclaw/tlon 2026.7.1 → 2026.7.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as ssrfPolicyFromAllowPrivateNetwork, i as isBlockedHostnameOrIp, n as createDedupeCache, o as ssrfPolicyFromDangerouslyAllowPrivateNetwork, r as fetchWithSsrFGuard, s as createLoggerBackedRuntime, t as SsrFBlockedError } from "./runtime-api-C5wXFh-q.js";
2
- import { t as tlonPlugin } from "./channel-DEy-ysbN.js";
2
+ import { t as tlonPlugin } from "./channel-Czb0L98O.js";
3
3
  import { n as setTlonRuntime } from "./runtime-Ck3lNvST.js";
4
4
  export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromAllowPrivateNetwork, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
@@ -1,5 +1,5 @@
1
1
  import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-DhzowRcD.js";
2
- import { a as tlonSetupAdapter, d as formatTargetHint, f as normalizeShip, h as resolveTlonOutboundTarget, l as listTlonAccountIds, m as parseTlonTarget, n as createTlonSetupWizardBase, u as resolveTlonAccount } from "./setup-core-C373Z5Vo.js";
2
+ import { a as tlonSetupAdapter, d as formatTargetHint, f as normalizeShip, h as resolveTlonOutboundTarget, l as listTlonAccountIds, m as parseTlonTarget, n as createTlonSetupWizardBase, u as resolveTlonAccount } from "./setup-core-BgykzCYT.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";
@@ -8,6 +8,7 @@ import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
8
8
  import { createChannelMessageAdapterFromOutbound, createRuntimeOutboundDelegates } from "openclaw/plugin-sdk/channel-outbound";
9
9
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
10
10
  import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
11
+ import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
11
12
  import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
12
13
  import { z } from "zod";
13
14
  //#region extensions/tlon/src/config-schema.ts
@@ -86,7 +87,7 @@ function resolveTlonOutboundSessionRoute(params) {
86
87
  //#endregion
87
88
  //#region extensions/tlon/src/channel.ts
88
89
  const TLON_CHANNEL_ID = "tlon";
89
- const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-jkmzax9d.js"));
90
+ const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-BlqhnFR6.js"));
90
91
  const tlonSetupWizardProxy = createTlonSetupWizardBase({
91
92
  resolveConfigured: async ({ cfg, accountId }) => await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveConfigured({
92
93
  cfg,
@@ -117,6 +118,7 @@ const tlonConfigAdapter = createHybridChannelConfigAdapter({
117
118
  const tlonChannelOutbound = {
118
119
  deliveryMode: "direct",
119
120
  textChunkLimit: 1e4,
121
+ sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text),
120
122
  resolveTarget: ({ to }) => resolveTlonOutboundTarget(to),
121
123
  deliveryCapabilities: { durableFinal: {
122
124
  text: true,
@@ -1,2 +1,2 @@
1
- import { t as tlonPlugin } from "./channel-DEy-ysbN.js";
1
+ import { t as tlonPlugin } from "./channel-Czb0L98O.js";
2
2
  export { tlonPlugin };
@@ -1,16 +1,18 @@
1
1
  import { n as createDedupeCache, s as createLoggerBackedRuntime } from "./runtime-api-C5wXFh-q.js";
2
- import { c as validateUrbitBaseUrl, d as formatTargetHint, f as normalizeShip, h as resolveTlonOutboundTarget, m as parseTlonTarget, p as parseChannelNest, s as normalizeUrbitHostname, u as resolveTlonAccount } from "./setup-core-C373Z5Vo.js";
2
+ import { c as validateUrbitBaseUrl, d as formatTargetHint, f as normalizeShip, h as resolveTlonOutboundTarget, m as parseTlonTarget, p as parseChannelNest, s as normalizeUrbitHostname, u as resolveTlonAccount } from "./setup-core-BgykzCYT.js";
3
3
  import { t as getTlonRuntime } from "./runtime-Ck3lNvST.js";
4
- import { t as tlonSetupWizard } from "./setup-surface-B0C8wpts.js";
4
+ import { t as tlonSetupWizard } from "./setup-surface-j5Hrbts7.js";
5
5
  import { fetchWithSsrFGuard, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
6
6
  import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
7
+ import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
7
8
  import { asFiniteNumber, normalizeLowercaseStringOrEmpty, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
8
9
  import crypto, { randomBytes, randomUUID } from "node:crypto";
10
+ import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
11
+ import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
9
12
  import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
10
13
  import { da, scot } from "@urbit/aura";
11
14
  import { Readable } from "node:stream";
12
15
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
13
- import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
14
16
  import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
15
17
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
16
18
  import { mkdir, writeFile } from "node:fs/promises";
@@ -335,6 +337,11 @@ function getUrbitContext(url, ship) {
335
337
  //#endregion
336
338
  //#region extensions/tlon/src/urbit/story.ts
337
339
  /**
340
+ * Tlon Story Format - Rich text converter
341
+ *
342
+ * Converts markdown-like text to Tlon's story format.
343
+ */
344
+ /**
338
345
  * Parse inline markdown formatting (bold, italic, code, links, mentions)
339
346
  */
340
347
  function parseInlineMarkdown(text) {
@@ -343,41 +350,41 @@ function parseInlineMarkdown(text) {
343
350
  while (remaining.length > 0) {
344
351
  const shipMatch = remaining.match(/^(~[a-z][-a-z0-9]*)/);
345
352
  if (shipMatch) {
346
- result.push({ ship: shipMatch[1] });
353
+ result.push({ ship: expectDefined(shipMatch[1], "ship mention capture") });
347
354
  remaining = remaining.slice(shipMatch[0].length);
348
355
  continue;
349
356
  }
350
357
  const boldMatch = remaining.match(/^\*\*(.+?)\*\*|^__(.+?)__/);
351
358
  if (boldMatch) {
352
- const content = boldMatch[1] || boldMatch[2];
359
+ const content = expectDefined(boldMatch[1] ?? boldMatch[2], "bold body capture");
353
360
  result.push({ bold: parseInlineMarkdown(content) });
354
361
  remaining = remaining.slice(boldMatch[0].length);
355
362
  continue;
356
363
  }
357
364
  const italicsMatch = remaining.match(/^\*([^*]+?)\*|^_([^_]+?)_(?![a-zA-Z0-9])/);
358
365
  if (italicsMatch) {
359
- const content = italicsMatch[1] || italicsMatch[2];
366
+ const content = expectDefined(italicsMatch[1] ?? italicsMatch[2], "italic body capture");
360
367
  result.push({ italics: parseInlineMarkdown(content) });
361
368
  remaining = remaining.slice(italicsMatch[0].length);
362
369
  continue;
363
370
  }
364
371
  const strikeMatch = remaining.match(/^~~(.+?)~~/);
365
372
  if (strikeMatch) {
366
- result.push({ strike: parseInlineMarkdown(strikeMatch[1]) });
373
+ result.push({ strike: parseInlineMarkdown(expectDefined(strikeMatch[1], "strikethrough body capture")) });
367
374
  remaining = remaining.slice(strikeMatch[0].length);
368
375
  continue;
369
376
  }
370
377
  const codeMatch = remaining.match(/^`([^`]+)`/);
371
378
  if (codeMatch) {
372
- result.push({ "inline-code": codeMatch[1] });
379
+ result.push({ "inline-code": expectDefined(codeMatch[1], "inline code capture") });
373
380
  remaining = remaining.slice(codeMatch[0].length);
374
381
  continue;
375
382
  }
376
383
  const linkMatch = remaining.match(/^\[([^\]]+)\]\(([^)]+)\)/);
377
384
  if (linkMatch) {
378
385
  result.push({ link: {
379
- href: linkMatch[2],
380
- content: linkMatch[1]
386
+ href: expectDefined(linkMatch[2], "link URL capture"),
387
+ content: expectDefined(linkMatch[1], "link text capture")
381
388
  } });
382
389
  remaining = remaining.slice(linkMatch[0].length);
383
390
  continue;
@@ -385,39 +392,53 @@ function parseInlineMarkdown(text) {
385
392
  const imageMatch = remaining.match(/^!\[([^\]]*)\]\(([^)]+)\)/);
386
393
  if (imageMatch) {
387
394
  result.push({ __image: {
388
- src: imageMatch[2],
389
- alt: imageMatch[1]
395
+ src: expectDefined(imageMatch[2], "image URL capture"),
396
+ alt: expectDefined(imageMatch[1], "image alt capture")
390
397
  } });
391
398
  remaining = remaining.slice(imageMatch[0].length);
392
399
  continue;
393
400
  }
394
401
  const urlMatch = remaining.match(/^(https?:\/\/[^\s<>"\]]+)/);
395
402
  if (urlMatch) {
403
+ const url = expectDefined(urlMatch[1], "plain URL capture");
396
404
  result.push({ link: {
397
- href: urlMatch[1],
398
- content: urlMatch[1]
405
+ href: url,
406
+ content: url
399
407
  } });
400
408
  remaining = remaining.slice(urlMatch[0].length);
401
409
  continue;
402
410
  }
403
411
  const plainMatch = remaining.match(/^[^*_`~[#\n:/]+/);
404
412
  if (plainMatch) {
405
- result.push(plainMatch[0]);
413
+ result.push(expectDefined(plainMatch[0], "plain text match"));
406
414
  remaining = remaining.slice(plainMatch[0].length);
407
415
  continue;
408
416
  }
409
- result.push(remaining[0]);
417
+ result.push(remaining.charAt(0));
410
418
  remaining = remaining.slice(1);
411
419
  }
412
420
  return mergeAdjacentStrings(result);
413
421
  }
422
+ function headingTag(marker) {
423
+ switch (marker.length) {
424
+ case 1: return "h1";
425
+ case 2: return "h2";
426
+ case 3: return "h3";
427
+ case 4: return "h4";
428
+ case 5: return "h5";
429
+ default: return "h6";
430
+ }
431
+ }
414
432
  /**
415
433
  * Merge adjacent string elements in an inline array
416
434
  */
417
435
  function mergeAdjacentStrings(inlines) {
418
436
  const result = [];
419
- for (const item of inlines) if (typeof item === "string" && typeof result[result.length - 1] === "string") result[result.length - 1] = result[result.length - 1] + item;
420
- else result.push(item);
437
+ for (const item of inlines) {
438
+ const last = result.at(-1);
439
+ if (typeof item === "string" && typeof last === "string") result.splice(-1, 1, last + item);
440
+ else result.push(item);
441
+ }
421
442
  return result;
422
443
  }
423
444
  /**
@@ -460,13 +481,15 @@ function markdownToStory(markdown) {
460
481
  const lines = markdown.split("\n");
461
482
  let i = 0;
462
483
  while (i < lines.length) {
463
- const line = lines[i];
484
+ const line = expectDefined(lines[i], "Markdown line index is in bounds");
464
485
  if (line.startsWith("```")) {
465
486
  const lang = line.slice(3).trim() || "plaintext";
466
487
  const codeLines = [];
467
488
  i++;
468
- while (i < lines.length && !lines[i].startsWith("```")) {
469
- codeLines.push(lines[i]);
489
+ while (true) {
490
+ const codeLine = lines.at(i);
491
+ if (codeLine === void 0 || codeLine.startsWith("```")) break;
492
+ codeLines.push(codeLine);
470
493
  i++;
471
494
  }
472
495
  story.push({ block: { code: {
@@ -478,10 +501,10 @@ function markdownToStory(markdown) {
478
501
  }
479
502
  const headerMatch = line.match(/^(#{1,6})\s+(.+)$/);
480
503
  if (headerMatch) {
481
- const tag = `h${headerMatch[1].length}`;
504
+ const tag = headingTag(expectDefined(headerMatch[1], "header marker capture"));
482
505
  story.push({ block: { header: {
483
506
  tag,
484
- content: parseInlineMarkdown(headerMatch[2])
507
+ content: parseInlineMarkdown(expectDefined(headerMatch[2], "header body capture"))
485
508
  } } });
486
509
  i++;
487
510
  continue;
@@ -493,8 +516,10 @@ function markdownToStory(markdown) {
493
516
  }
494
517
  if (line.startsWith("> ")) {
495
518
  const quoteLines = [];
496
- while (i < lines.length && lines[i].startsWith("> ")) {
497
- quoteLines.push(lines[i].slice(2));
519
+ while (true) {
520
+ const quoteLine = lines.at(i);
521
+ if (quoteLine === void 0 || !quoteLine.startsWith("> ")) break;
522
+ quoteLines.push(quoteLine.slice(2));
498
523
  i++;
499
524
  }
500
525
  const quoteText = quoteLines.join("\n");
@@ -506,8 +531,10 @@ function markdownToStory(markdown) {
506
531
  continue;
507
532
  }
508
533
  const paragraphLines = [];
509
- while (i < lines.length && lines[i].trim() !== "" && !lines[i].startsWith("#") && !lines[i].startsWith("```") && !lines[i].startsWith("> ") && !/^(-{3,}|\*{3,})$/.test(lines[i].trim())) {
510
- paragraphLines.push(lines[i]);
534
+ while (true) {
535
+ const paragraphLine = lines.at(i);
536
+ if (paragraphLine === void 0 || paragraphLine.trim() === "" || paragraphLine.startsWith("#") || paragraphLine.startsWith("```") || paragraphLine.startsWith("> ") || /^(-{3,}|\*{3,})$/.test(paragraphLine.trim())) break;
537
+ paragraphLines.push(paragraphLine);
511
538
  i++;
512
539
  }
513
540
  if (paragraphLines.length > 0) {
@@ -515,8 +542,8 @@ function markdownToStory(markdown) {
515
542
  const withBreaks = [];
516
543
  for (const inline of inlines) if (typeof inline === "string" && inline.includes("\n")) {
517
544
  const parts = inline.split("\n");
518
- for (let j = 0; j < parts.length; j++) {
519
- if (parts[j]) withBreaks.push(parts[j]);
545
+ for (const [j, part] of parts.entries()) {
546
+ if (part) withBreaks.push(part);
520
547
  if (j < parts.length - 1) withBreaks.push({ break: null });
521
548
  }
522
549
  } else withBreaks.push(inline);
@@ -756,7 +783,9 @@ async function ensureUrbitChannelOpen(deps, params) {
756
783
  }
757
784
  //#endregion
758
785
  //#region extensions/tlon/src/urbit/sse-client.ts
786
+ const MAX_SSE_PAYLOAD_BYTES = 16 * 1024 * 1024;
759
787
  function parseUrbitSsePayload(data) {
788
+ if (Buffer.byteLength(data, "utf8") > MAX_SSE_PAYLOAD_BYTES) throw new Error("Tlon Urbit SSE payload exceeds 16 MiB limit");
760
789
  try {
761
790
  return JSON.parse(data);
762
791
  } catch (cause) {
@@ -890,18 +919,54 @@ var UrbitSSEClient = class {
890
919
  async processStream(body) {
891
920
  if (!body) return;
892
921
  const stream = body instanceof ReadableStream ? Readable.fromWeb(body) : body;
922
+ const decoder = new TextDecoder();
893
923
  let buffer = "";
924
+ let bufferBytes = 0;
925
+ let pendingDelimiterNewline = false;
926
+ const appendPending = (text) => {
927
+ const previousCodeUnit = buffer.charCodeAt(buffer.length - 1);
928
+ const firstCodeUnit = text.charCodeAt(0);
929
+ const joinsSurrogatePair = previousCodeUnit >= 55296 && previousCodeUnit <= 56319 && firstCodeUnit >= 56320 && firstCodeUnit <= 57343;
930
+ const nextBytes = bufferBytes + Buffer.byteLength(text, "utf8") - (joinsSurrogatePair ? 2 : 0);
931
+ if (nextBytes > MAX_SSE_PAYLOAD_BYTES) throw new Error("Tlon Urbit SSE stream buffer exceeded 16 MiB limit");
932
+ buffer += text;
933
+ bufferBytes = nextBytes;
934
+ };
935
+ const consumeText = (text) => {
936
+ let offset = 0;
937
+ if (pendingDelimiterNewline && text.length > 0) {
938
+ pendingDelimiterNewline = false;
939
+ if (text.startsWith("\n")) {
940
+ this.processEvent(buffer);
941
+ buffer = "";
942
+ bufferBytes = 0;
943
+ offset = 1;
944
+ } else appendPending("\n");
945
+ }
946
+ while (offset < text.length) {
947
+ const eventEnd = text.indexOf("\n\n", offset);
948
+ if (eventEnd === -1) {
949
+ const endsWithNewline = text.endsWith("\n");
950
+ appendPending(text.slice(offset, endsWithNewline ? -1 : void 0));
951
+ pendingDelimiterNewline = endsWithNewline;
952
+ return;
953
+ }
954
+ appendPending(text.slice(offset, eventEnd));
955
+ this.processEvent(buffer);
956
+ buffer = "";
957
+ bufferBytes = 0;
958
+ offset = eventEnd + 2;
959
+ }
960
+ };
894
961
  try {
895
962
  for await (const chunk of stream) {
896
963
  if (this.aborted) break;
897
- buffer += chunk.toString();
898
- let eventEnd;
899
- while ((eventEnd = buffer.indexOf("\n\n")) !== -1) {
900
- const eventData = buffer.slice(0, eventEnd);
901
- buffer = buffer.slice(eventEnd + 2);
902
- this.processEvent(eventData);
903
- }
964
+ if (typeof chunk === "string") {
965
+ consumeText(decoder.decode());
966
+ consumeText(chunk);
967
+ } else consumeText(decoder.decode(chunk, { stream: true }));
904
968
  }
969
+ consumeText(decoder.decode());
905
970
  } finally {
906
971
  if (this.streamRelease) {
907
972
  const release = this.streamRelease;
@@ -1215,7 +1280,7 @@ function parseAdminCommand(text) {
1215
1280
  const unblockMatch = trimmed.match(/^unblock\s+(~[\w-]+)$/);
1216
1281
  if (unblockMatch) return {
1217
1282
  type: "unblock",
1218
- ship: unblockMatch[1]
1283
+ ship: expectDefined(unblockMatch[1], "unblock ship capture")
1219
1284
  };
1220
1285
  return null;
1221
1286
  }
@@ -1389,7 +1454,7 @@ function createTlonApprovalRuntime(params) {
1389
1454
  const approvals = getPendingApprovals();
1390
1455
  const existingIndex = approvals.findIndex((item) => item.type === approval.type && item.requestingShip === approval.requestingShip && (approval.type !== "channel" || item.channelNest === approval.channelNest) && (approval.type !== "group" || item.groupFlag === approval.groupFlag));
1391
1456
  if (existingIndex !== -1) {
1392
- const existing = approvals[existingIndex];
1457
+ const existing = expectDefined(approvals[existingIndex], "located pending approval index");
1393
1458
  if (approval.originalMessage) {
1394
1459
  existing.originalMessage = approval.originalMessage;
1395
1460
  existing.messagePreview = approval.messagePreview;
@@ -1547,8 +1612,8 @@ function extractCites(content) {
1547
1612
  }
1548
1613
  function formatModelName(modelString) {
1549
1614
  if (!modelString) return "AI";
1550
- const modelName = modelString.includes("/") ? modelString.split("/")[1] : modelString;
1551
- const modelMappings = {
1615
+ const modelName = modelString.includes("/") ? expectDefined(modelString.split("/").at(1), "provider/model second segment") : modelString;
1616
+ const mappedName = {
1552
1617
  "claude-opus-4-5": "Claude Opus 4.5",
1553
1618
  "claude-sonnet-4-5": "Claude Sonnet 4.5",
1554
1619
  "claude-sonnet-3-5": "Claude Sonnet 3.5",
@@ -1557,8 +1622,8 @@ function formatModelName(modelString) {
1557
1622
  "gpt-4": "GPT-4",
1558
1623
  "gemini-2.0-flash": "Gemini 2.0 Flash",
1559
1624
  "gemini-pro": "Gemini Pro"
1560
- };
1561
- if (modelMappings[modelName]) return modelMappings[modelName];
1625
+ }[modelName];
1626
+ if (mappedName !== void 0) return mappedName;
1562
1627
  return modelName.replace(/-/g, " ").split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
1563
1628
  }
1564
1629
  function isBotMentioned(messageText, botShipName, nickname) {
@@ -1941,9 +2006,14 @@ async function fetchThreadHistory(api, channelNest, parentId, count = 50, runtim
1941
2006
  }
1942
2007
  }
1943
2008
  //#endregion
2009
+ //#region extensions/tlon/src/media-fetch-timeouts.ts
2010
+ const TLON_MEDIA_FETCH_TIMEOUTS = {
2011
+ responseHeaderTimeoutMs: 12e4,
2012
+ readIdleTimeoutMs: 3e4
2013
+ };
2014
+ //#endregion
1944
2015
  //#region extensions/tlon/src/monitor/media.ts
1945
2016
  const MAX_IMAGES_PER_MESSAGE = 8;
1946
- const TLON_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS = 3e4;
1947
2017
  /**
1948
2018
  * Extract image blocks from Tlon message content.
1949
2019
  * Returns array of image URLs found in the message.
@@ -1974,7 +2044,7 @@ async function downloadMedia(url, mediaDir) {
1974
2044
  const fetchOptions = {
1975
2045
  url,
1976
2046
  maxBytes: MAX_IMAGE_BYTES,
1977
- readIdleTimeoutMs: TLON_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS,
2047
+ ...TLON_MEDIA_FETCH_TIMEOUTS,
1978
2048
  ssrfPolicy: void 0,
1979
2049
  requestInit: { method: "GET" }
1980
2050
  };
@@ -2226,16 +2296,7 @@ async function monitorTlonProvider(opts = {}) {
2226
2296
  if (attempt >= maxAttempts) throw error;
2227
2297
  const delay = Math.min(3e4, 1e3 * 2 ** (attempt - 1));
2228
2298
  runtime.log?.(`[tlon] Retrying authentication in ${delay}ms...`);
2229
- await new Promise((resolve, reject) => {
2230
- const timer = setTimeout(resolve, delay);
2231
- if (opts.abortSignal) {
2232
- const onAbort = () => {
2233
- clearTimeout(timer);
2234
- reject(/* @__PURE__ */ new Error("Aborted"));
2235
- };
2236
- opts.abortSignal.addEventListener("abort", onAbort, { once: true });
2237
- }
2238
- });
2299
+ await sleepWithAbort(delay, opts.abortSignal);
2239
2300
  }
2240
2301
  }
2241
2302
  throw new Error("unreachable Tlon authentication retry loop exit");
@@ -3360,13 +3421,8 @@ async function uploadFile(params) {
3360
3421
  return { url: assertTrustedMemexUploadUrl(hostedUrl, "Memex hosted URL") };
3361
3422
  }
3362
3423
  if (!hasCustomS3Creds(credentials)) throw new Error("No storage credentials configured");
3363
- const endpoint = new URL(prefixEndpoint(credentials.endpoint));
3364
3424
  const client = new S3Client({
3365
- endpoint: {
3366
- protocol: endpoint.protocol.slice(0, -1),
3367
- hostname: endpoint.host,
3368
- path: endpoint.pathname || "/"
3369
- },
3425
+ endpoint: prefixEndpoint(credentials.endpoint),
3370
3426
  region: storageConfig.region || "us-east-1",
3371
3427
  credentials: {
3372
3428
  accessKeyId: credentials.accessKeyId,
@@ -3385,10 +3441,7 @@ async function uploadFile(params) {
3385
3441
  ContentType: headers["Content-Type"],
3386
3442
  CacheControl: headers["Cache-Control"],
3387
3443
  ACL: "public-read"
3388
- }), {
3389
- expiresIn: 3600,
3390
- signableHeaders: new Set(Object.keys(headers))
3391
- });
3444
+ }), { expiresIn: 3600 });
3392
3445
  let release;
3393
3446
  try {
3394
3447
  const guarded = await fetchWithSsrFGuard({
@@ -3408,14 +3461,13 @@ async function uploadFile(params) {
3408
3461
  } finally {
3409
3462
  await release?.();
3410
3463
  }
3411
- return { url: assertSafeUploadResultUrl(storageConfig.publicUrlBase ? new URL(fileKey, storageConfig.publicUrlBase).toString() : signedUrl.split("?")[0], "Upload result URL") };
3464
+ return { url: assertSafeUploadResultUrl(storageConfig.publicUrlBase ? new URL(fileKey, storageConfig.publicUrlBase).toString() : expectDefined(signedUrl.split("?").at(0), "signed URL base segment"), "Upload result URL") };
3412
3465
  }
3413
3466
  //#endregion
3414
3467
  //#region extensions/tlon/src/urbit/upload.ts
3415
3468
  /**
3416
3469
  * Upload an image from a URL to Tlon storage.
3417
3470
  */
3418
- const TLON_UPLOAD_IMAGE_IDLE_TIMEOUT_MS = 3e4;
3419
3471
  /**
3420
3472
  * Fetch an image from a URL and upload it to Tlon storage.
3421
3473
  * Returns the uploaded URL, or falls back to the original URL on error.
@@ -3432,7 +3484,7 @@ async function uploadImageFromUrl(imageUrl) {
3432
3484
  const fetched = await readRemoteMediaBuffer({
3433
3485
  url: imageUrl,
3434
3486
  maxBytes: MAX_IMAGE_BYTES,
3435
- readIdleTimeoutMs: TLON_UPLOAD_IMAGE_IDLE_TIMEOUT_MS,
3487
+ ...TLON_MEDIA_FETCH_TIMEOUTS,
3436
3488
  ssrfPolicy: void 0,
3437
3489
  requestInit: { method: "GET" }
3438
3490
  });
@@ -3472,7 +3524,7 @@ async function createHttpPokeApi(params) {
3472
3524
  method: "PUT",
3473
3525
  headers: {
3474
3526
  "Content-Type": "application/json",
3475
- Cookie: cookie.split(";")[0]
3527
+ Cookie: expectDefined(cookie.split(";").at(0), "cookie first segment")
3476
3528
  },
3477
3529
  body: JSON.stringify([pokeData])
3478
3530
  },
package/dist/setup-api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as tlonSetupAdapter } from "./setup-core-C373Z5Vo.js";
2
- import { t as tlonSetupWizard } from "./setup-surface-B0C8wpts.js";
1
+ import { a as tlonSetupAdapter } from "./setup-core-BgykzCYT.js";
2
+ import { t as tlonSetupWizard } from "./setup-surface-j5Hrbts7.js";
3
3
  export { tlonSetupAdapter, tlonSetupWizard };
@@ -1,4 +1,5 @@
1
1
  import { hasLegacyFlatAllowPrivateNetworkAlias, isBlockedHostnameOrIp, isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
2
+ import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
2
3
  import { DEFAULT_ACCOUNT_ID, createSetupInputPresenceValidator, createSetupTranslator, formatDocsLink, normalizeAccountId, patchScopedAccountConfig, prepareScopedSetupConfig } from "openclaw/plugin-sdk/setup";
3
4
  import { normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
5
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, listCombinedAccountIds, normalizeAccountId as normalizeAccountId$1, resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-resolution";
@@ -14,8 +15,8 @@ function parseChannelNest(raw) {
14
15
  const match = NEST_RE.exec(raw.trim());
15
16
  if (!match) return null;
16
17
  return {
17
- hostShip: normalizeShip(match[1]),
18
- channelName: match[2]
18
+ hostShip: normalizeShip(expectDefined(match[1], "channel host capture")),
19
+ channelName: expectDefined(match[2], "channel name capture")
19
20
  };
20
21
  }
21
22
  function makeGroupTarget(parsed) {
@@ -33,11 +34,11 @@ function parseTlonTarget(raw) {
33
34
  const dmPrefix = withoutPrefix.match(/^dm[/:](.+)$/i);
34
35
  if (dmPrefix) return {
35
36
  kind: "dm",
36
- ship: normalizeShip(dmPrefix[1])
37
+ ship: normalizeShip(expectDefined(dmPrefix[1], "DM ship capture"))
37
38
  };
38
39
  const groupPrefix = withoutPrefix.match(/^(group|room)[/:](.+)$/i);
39
40
  if (groupPrefix) {
40
- const groupTarget = groupPrefix[2].trim();
41
+ const groupTarget = expectDefined(groupPrefix[2], "group target capture").trim();
41
42
  if (groupTarget.startsWith("chat/")) {
42
43
  const parsed = parseChannelNest(groupTarget);
43
44
  if (!parsed) return null;
@@ -45,8 +46,8 @@ function parseTlonTarget(raw) {
45
46
  }
46
47
  const parts = groupTarget.split("/");
47
48
  if (parts.length === 2) {
48
- const hostShip = normalizeShip(parts[0]);
49
- const channelName = parts[1];
49
+ const hostShip = normalizeShip(expectDefined(parts[0], "two-part group host"));
50
+ const channelName = expectDefined(parts[1], "two-part group channel");
50
51
  return {
51
52
  kind: "group",
52
53
  nest: `chat/${hostShip}/${channelName}`,
@@ -1,4 +1,4 @@
1
- import { c as validateUrbitBaseUrl, f as normalizeShip, i as resolveTlonSetupStatusLines, n as createTlonSetupWizardBase, o as isBlockedUrbitHostname, r as resolveTlonSetupConfigured, t as applyTlonSetupConfig, u as resolveTlonAccount } from "./setup-core-C373Z5Vo.js";
1
+ import { c as validateUrbitBaseUrl, f as normalizeShip, i as resolveTlonSetupStatusLines, n as createTlonSetupWizardBase, o as isBlockedUrbitHostname, r as resolveTlonSetupConfigured, t as applyTlonSetupConfig, u as resolveTlonAccount } from "./setup-core-BgykzCYT.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
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/tlon",
3
- "version": "2026.7.1",
3
+ "version": "2026.7.2-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/tlon",
9
- "version": "2026.7.1",
9
+ "version": "2026.7.2-beta.1",
10
10
  "dependencies": {
11
11
  "@aws-sdk/client-s3": "3.1078.0",
12
12
  "@aws-sdk/s3-request-presigner": "3.1078.0",
@@ -15,7 +15,7 @@
15
15
  "zod": "4.4.3"
16
16
  },
17
17
  "peerDependencies": {
18
- "openclaw": ">=2026.7.1"
18
+ "openclaw": ">=2026.7.2-beta.1"
19
19
  },
20
20
  "peerDependenciesMeta": {
21
21
  "openclaw": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/tlon",
3
- "version": "2026.7.1",
3
+ "version": "2026.7.2-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.7.1"
22
+ "openclaw": ">=2026.7.2-beta.1"
23
23
  },
24
24
  "peerDependenciesMeta": {
25
25
  "openclaw": {
@@ -73,10 +73,10 @@
73
73
  "minHostVersion": ">=2026.4.10"
74
74
  },
75
75
  "compat": {
76
- "pluginApi": ">=2026.7.1"
76
+ "pluginApi": ">=2026.7.2-beta.1"
77
77
  },
78
78
  "build": {
79
- "openclawVersion": "2026.7.1"
79
+ "openclawVersion": "2026.7.2-beta.1"
80
80
  },
81
81
  "release": {
82
82
  "bundleRuntimeDependencies": false,