@openclaw/tlon 2026.6.33 → 2026.6.35

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-BVGTPvoo.js";
2
+ import { t as tlonPlugin } from "./channel-DzVK1Zdw.js";
3
3
  import { n as setTlonRuntime } from "./runtime-Ck3lNvST.js";
4
4
  export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromAllowPrivateNetwork, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
@@ -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
@@ -84,7 +85,7 @@ function resolveTlonOutboundSessionRoute(params) {
84
85
  //#endregion
85
86
  //#region extensions/tlon/src/channel.ts
86
87
  const TLON_CHANNEL_ID = "tlon";
87
- const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DVgx3HzG.js"));
88
+ const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-BGFC9yyH.js"));
88
89
  const tlonSetupWizardProxy = createTlonSetupWizardBase({
89
90
  resolveConfigured: async ({ cfg, accountId }) => await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveConfigured({
90
91
  cfg,
@@ -115,6 +116,7 @@ const tlonConfigAdapter = createHybridChannelConfigAdapter({
115
116
  const tlonChannelOutbound = {
116
117
  deliveryMode: "direct",
117
118
  textChunkLimit: 1e4,
119
+ sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text),
118
120
  resolveTarget: ({ to }) => resolveTlonOutboundTarget(to),
119
121
  deliveryCapabilities: { durableFinal: {
120
122
  text: true,
@@ -1,2 +1,2 @@
1
- import { t as tlonPlugin } from "./channel-BVGTPvoo.js";
1
+ import { t as tlonPlugin } from "./channel-DzVK1Zdw.js";
2
2
  export { tlonPlugin };
@@ -7,6 +7,7 @@ import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/cha
7
7
  import { asFiniteNumber, normalizeLowercaseStringOrEmpty, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import crypto, { randomBytes, randomUUID } from "node:crypto";
9
9
  import { readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
10
+ import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
10
11
  import { da, scot } from "@urbit/aura";
11
12
  import { Readable } from "node:stream";
12
13
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
@@ -282,6 +283,7 @@ async function urbitFetch(params) {
282
283
  }
283
284
  //#endregion
284
285
  //#region extensions/tlon/src/urbit/auth.ts
286
+ const MAX_AUTH_BODY_DRAIN_BYTES = 64 * 1024;
285
287
  async function authenticate(url, code, options = {}) {
286
288
  const { response, release } = await urbitFetch({
287
289
  baseUrl: url,
@@ -299,8 +301,11 @@ async function authenticate(url, code, options = {}) {
299
301
  auditContext: "tlon-urbit-login"
300
302
  });
301
303
  try {
302
- if (!response.ok) throw new UrbitAuthError("auth_failed", `Login failed with status ${response.status}`);
303
- await response.text().catch(() => {});
304
+ if (!response.ok) {
305
+ await response.body?.cancel().catch(() => void 0);
306
+ throw new UrbitAuthError("auth_failed", `Login failed with status ${response.status}`);
307
+ }
308
+ await readResponseTextLimited(response, MAX_AUTH_BODY_DRAIN_BYTES).catch(() => void 0);
304
309
  const cookie = response.headers.get("set-cookie");
305
310
  if (!cookie) throw new UrbitAuthError("missing_cookie", "No authentication cookie received");
306
311
  return cookie;
@@ -759,7 +764,9 @@ async function ensureUrbitChannelOpen(deps, params) {
759
764
  }
760
765
  //#endregion
761
766
  //#region extensions/tlon/src/urbit/sse-client.ts
767
+ const MAX_SSE_PAYLOAD_BYTES = 16 * 1024 * 1024;
762
768
  function parseUrbitSsePayload(data) {
769
+ if (Buffer.byteLength(data, "utf8") > MAX_SSE_PAYLOAD_BYTES) throw new Error("Tlon Urbit SSE payload exceeds 16 MiB limit");
763
770
  try {
764
771
  return JSON.parse(data);
765
772
  } catch (cause) {
@@ -893,18 +900,54 @@ var UrbitSSEClient = class {
893
900
  async processStream(body) {
894
901
  if (!body) return;
895
902
  const stream = body instanceof ReadableStream ? Readable.fromWeb(body) : body;
903
+ const decoder = new TextDecoder();
896
904
  let buffer = "";
905
+ let bufferBytes = 0;
906
+ let pendingDelimiterNewline = false;
907
+ const appendPending = (text) => {
908
+ const previousCodeUnit = buffer.charCodeAt(buffer.length - 1);
909
+ const firstCodeUnit = text.charCodeAt(0);
910
+ const joinsSurrogatePair = previousCodeUnit >= 55296 && previousCodeUnit <= 56319 && firstCodeUnit >= 56320 && firstCodeUnit <= 57343;
911
+ const nextBytes = bufferBytes + Buffer.byteLength(text, "utf8") - (joinsSurrogatePair ? 2 : 0);
912
+ if (nextBytes > MAX_SSE_PAYLOAD_BYTES) throw new Error("Tlon Urbit SSE stream buffer exceeded 16 MiB limit");
913
+ buffer += text;
914
+ bufferBytes = nextBytes;
915
+ };
916
+ const consumeText = (text) => {
917
+ let offset = 0;
918
+ if (pendingDelimiterNewline && text.length > 0) {
919
+ pendingDelimiterNewline = false;
920
+ if (text.startsWith("\n")) {
921
+ this.processEvent(buffer);
922
+ buffer = "";
923
+ bufferBytes = 0;
924
+ offset = 1;
925
+ } else appendPending("\n");
926
+ }
927
+ while (offset < text.length) {
928
+ const eventEnd = text.indexOf("\n\n", offset);
929
+ if (eventEnd === -1) {
930
+ const endsWithNewline = text.endsWith("\n");
931
+ appendPending(text.slice(offset, endsWithNewline ? -1 : void 0));
932
+ pendingDelimiterNewline = endsWithNewline;
933
+ return;
934
+ }
935
+ appendPending(text.slice(offset, eventEnd));
936
+ this.processEvent(buffer);
937
+ buffer = "";
938
+ bufferBytes = 0;
939
+ offset = eventEnd + 2;
940
+ }
941
+ };
897
942
  try {
898
943
  for await (const chunk of stream) {
899
944
  if (this.aborted) break;
900
- buffer += chunk.toString();
901
- let eventEnd;
902
- while ((eventEnd = buffer.indexOf("\n\n")) !== -1) {
903
- const eventData = buffer.slice(0, eventEnd);
904
- buffer = buffer.slice(eventEnd + 2);
905
- this.processEvent(eventData);
906
- }
945
+ if (typeof chunk === "string") {
946
+ consumeText(decoder.decode());
947
+ consumeText(chunk);
948
+ } else consumeText(decoder.decode(chunk, { stream: true }));
907
949
  }
950
+ consumeText(decoder.decode());
908
951
  } finally {
909
952
  if (this.streamRelease) {
910
953
  const release = this.streamRelease;
@@ -1047,7 +1090,7 @@ var UrbitSSEClient = class {
1047
1090
  auditContext: "tlon-urbit-unsubscribe"
1048
1091
  });
1049
1092
  try {
1050
- response.body?.cancel();
1093
+ response.body?.cancel().catch(() => void 0);
1051
1094
  } finally {
1052
1095
  await release();
1053
1096
  }
@@ -1067,7 +1110,7 @@ var UrbitSSEClient = class {
1067
1110
  auditContext: "tlon-urbit-channel-close"
1068
1111
  });
1069
1112
  try {
1070
- response.body?.cancel();
1113
+ response.body?.cancel().catch(() => void 0);
1071
1114
  } finally {
1072
1115
  await release();
1073
1116
  }
@@ -1943,9 +1986,14 @@ async function fetchThreadHistory(api, channelNest, parentId, count = 50, runtim
1943
1986
  }
1944
1987
  }
1945
1988
  //#endregion
1989
+ //#region extensions/tlon/src/media-fetch-timeouts.ts
1990
+ const TLON_MEDIA_FETCH_TIMEOUTS = {
1991
+ timeoutMs: 12e4,
1992
+ readIdleTimeoutMs: 3e4
1993
+ };
1994
+ //#endregion
1946
1995
  //#region extensions/tlon/src/monitor/media.ts
1947
1996
  const MAX_IMAGES_PER_MESSAGE = 8;
1948
- const TLON_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS = 3e4;
1949
1997
  /**
1950
1998
  * Extract image blocks from Tlon message content.
1951
1999
  * Returns array of image URLs found in the message.
@@ -1976,7 +2024,7 @@ async function downloadMedia(url, mediaDir) {
1976
2024
  const fetchOptions = {
1977
2025
  url,
1978
2026
  maxBytes: MAX_IMAGE_BYTES,
1979
- readIdleTimeoutMs: TLON_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS,
2027
+ ...TLON_MEDIA_FETCH_TIMEOUTS,
1980
2028
  ssrfPolicy: void 0,
1981
2029
  requestInit: { method: "GET" }
1982
2030
  };
@@ -2228,16 +2276,7 @@ async function monitorTlonProvider(opts = {}) {
2228
2276
  if (attempt >= maxAttempts) throw error;
2229
2277
  const delay = Math.min(3e4, 1e3 * 2 ** (attempt - 1));
2230
2278
  runtime.log?.(`[tlon] Retrying authentication in ${delay}ms...`);
2231
- await new Promise((resolve, reject) => {
2232
- const timer = setTimeout(resolve, delay);
2233
- if (opts.abortSignal) {
2234
- const onAbort = () => {
2235
- clearTimeout(timer);
2236
- reject(/* @__PURE__ */ new Error("Aborted"));
2237
- };
2238
- opts.abortSignal.addEventListener("abort", onAbort, { once: true });
2239
- }
2240
- });
2279
+ await sleepWithAbort(delay, opts.abortSignal);
2241
2280
  }
2242
2281
  }
2243
2282
  throw new Error("unreachable Tlon authentication retry loop exit");
@@ -3421,26 +3460,19 @@ async function uploadImageFromUrl(imageUrl) {
3421
3460
  console.warn(`[tlon] Rejected non-http(s) URL: ${imageUrl}`);
3422
3461
  return imageUrl;
3423
3462
  }
3424
- const { response, release } = await fetchWithSsrFGuard({
3463
+ const fetched = await readRemoteMediaBuffer({
3425
3464
  url: imageUrl,
3426
- init: { method: "GET" },
3427
- policy: void 0,
3428
- auditContext: "tlon-upload-image"
3465
+ maxBytes: MAX_IMAGE_BYTES,
3466
+ ...TLON_MEDIA_FETCH_TIMEOUTS,
3467
+ ssrfPolicy: void 0,
3468
+ requestInit: { method: "GET" }
3429
3469
  });
3430
- try {
3431
- if (!response.ok) {
3432
- console.warn(`[tlon] Failed to fetch image from ${imageUrl}: ${response.status}`);
3433
- return imageUrl;
3434
- }
3435
- const contentType = response.headers.get("content-type") || "image/png";
3436
- return (await uploadFile({
3437
- blob: await response.blob(),
3438
- fileName: new URL(imageUrl).pathname.split("/").pop() || `upload-${Date.now()}.png`,
3439
- contentType
3440
- })).url;
3441
- } finally {
3442
- await release();
3443
- }
3470
+ const contentType = fetched.contentType || "image/png";
3471
+ return (await uploadFile({
3472
+ blob: new Blob([new Uint8Array(fetched.buffer)], { type: contentType }),
3473
+ fileName: new URL(imageUrl).pathname.split("/").pop() || `upload-${Date.now()}.png`,
3474
+ contentType
3475
+ })).url;
3444
3476
  } catch (err) {
3445
3477
  console.warn(`[tlon] Failed to upload image, using original URL: ${String(err)}`);
3446
3478
  return imageUrl;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/tlon",
3
- "version": "2026.6.33",
3
+ "version": "2026.6.35",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/tlon",
9
- "version": "2026.6.33",
9
+ "version": "2026.6.35",
10
10
  "dependencies": {
11
11
  "@aws-sdk/client-s3": "3.1056.0",
12
12
  "@aws-sdk/s3-request-presigner": "3.1056.0",
@@ -15,7 +15,7 @@
15
15
  "zod": "4.4.3"
16
16
  },
17
17
  "peerDependencies": {
18
- "openclaw": ">=2026.6.33"
18
+ "openclaw": ">=2026.6.35"
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.6.33",
3
+ "version": "2026.6.35",
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.6.33"
22
+ "openclaw": ">=2026.6.35"
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.6.33"
76
+ "pluginApi": ">=2026.6.35"
77
77
  },
78
78
  "build": {
79
- "openclawVersion": "2026.6.33"
79
+ "openclawVersion": "2026.6.35"
80
80
  },
81
81
  "release": {
82
82
  "bundleRuntimeDependencies": false,