@openclaw/tlon 2026.10.5-beta.4 → 2026.10.10-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-Dfri5oOT.mjs";
2
+ import { t as tlonPlugin } from "./channel-BiTAKY7-.mjs";
3
3
  import { n as setTlonRuntime } from "./runtime-Ck3lNvST.mjs";
4
4
  import "../api.js";
5
5
  export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
@@ -94,7 +94,7 @@ function resolveTlonOutboundSessionRoute(params) {
94
94
  //#endregion
95
95
  //#region extensions/tlon/src/channel.ts
96
96
  const TLON_CHANNEL_ID = "tlon";
97
- const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-U0WASXdh.mjs"));
97
+ const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-Bkx-midT.mjs"));
98
98
  const tlonSetupWizardProxy = createTlonSetupWizardBase(async (params) => await (await loadTlonChannelRuntime()).tlonSetupWizard.finalize(params));
99
99
  const tlonConfigAdapter = createHybridChannelConfigAdapter({
100
100
  sectionKey: TLON_CHANNEL_ID,
@@ -113,7 +113,7 @@ function createSettingsManager(api, logger) {
113
113
  try {
114
114
  const deskData = (await api.scry("/settings/all.json"))?.all?.[SETTINGS_DESK];
115
115
  current = parseSettingsResponse(deskData ?? {});
116
- logger?.log?.(`[settings] Loaded: ${JSON.stringify(current)}`);
116
+ logger?.log?.("[settings] Loaded");
117
117
  return current;
118
118
  } catch (err) {
119
119
  logger?.log?.(`[settings] No settings found (using defaults): ${String(err)}`);
@@ -128,7 +128,7 @@ function createSettingsManager(api, logger) {
128
128
  event: (event) => {
129
129
  const update = parseSettingsEvent(event);
130
130
  if (!update) return;
131
- logger?.log?.(`[settings] Update: ${update.key} = ${JSON.stringify(update.value)}`);
131
+ logger?.log?.(`[settings] Update: ${update.key}`);
132
132
  current = applySettingsUpdate(current, update.key, update.value);
133
133
  try {
134
134
  onChange(current);
@@ -715,9 +715,7 @@ async function sendGroupMessage({ text, ...params }) {
715
715
  async function sendGroupMessageWithStory({ api, fromShip, hostShip, channelName, story, replyToId, kind = "unknown" }) {
716
716
  const sentAt = Date.now();
717
717
  let formattedReplyId = replyToId;
718
- if (replyToId && /^\d+$/.test(replyToId)) try {
719
- formattedReplyId = scot("ud", BigInt(replyToId));
720
- } catch {}
718
+ if (replyToId && /^\d+$/.test(replyToId)) formattedReplyId = scot("ud", BigInt(replyToId));
721
719
  const memo = {
722
720
  content: story,
723
721
  author: fromShip,
@@ -858,7 +856,8 @@ async function ensureUrbitChannelOpen(deps, params) {
858
856
  await openUrbitChannelStep(deps, {
859
857
  body: params.createBody,
860
858
  auditContext: params.createAuditContext,
861
- operation: "Channel creation"
859
+ operation: "Channel creation",
860
+ beforeRequest: params.beforeRequest
862
861
  });
863
862
  await openUrbitChannelStep(deps, {
864
863
  body: [{
@@ -870,7 +869,8 @@ async function ensureUrbitChannelOpen(deps, params) {
870
869
  json: "Opening API channel"
871
870
  }],
872
871
  auditContext: "tlon-urbit-channel-wake",
873
- operation: "Channel activation"
872
+ operation: "Channel activation",
873
+ beforeRequest: params.beforeRequest
874
874
  });
875
875
  }
876
876
  //#endregion
@@ -934,7 +934,8 @@ var UrbitSSEClient = class {
934
934
  async createCurrentChannel() {
935
935
  await ensureUrbitChannelOpen(this.channelRequestContext(), {
936
936
  createBody: this.subscriptions,
937
- createAuditContext: "tlon-urbit-channel-create"
937
+ createAuditContext: "tlon-urbit-channel-create",
938
+ beforeRequest: () => this.reconnectAbortController.signal.throwIfAborted()
938
939
  });
939
940
  }
940
941
  async subscribe(params) {
@@ -1002,21 +1003,27 @@ var UrbitSSEClient = class {
1002
1003
  ssrfPolicy: this.ssrfPolicy,
1003
1004
  lookupFn: this.lookupFn,
1004
1005
  fetchImpl: this.fetchImpl,
1005
- signal: controller.signal,
1006
+ signal: AbortSignal.any([controller.signal, this.reconnectAbortController.signal]),
1007
+ beforeRequest: () => this.reconnectAbortController.signal.throwIfAborted(),
1006
1008
  auditContext: "tlon-urbit-sse-stream"
1007
1009
  });
1008
1010
  } finally {
1009
1011
  clearTimeout(timeoutId);
1010
1012
  }
1011
1013
  const { response, release } = stream;
1014
+ if (this.reconnectAbortController.signal.aborted) {
1015
+ await release();
1016
+ this.reconnectAbortController.signal.throwIfAborted();
1017
+ }
1012
1018
  this.streamRelease = release;
1013
- if (!response.ok) {
1019
+ if (!response.ok || !response.body) {
1014
1020
  this.streamRelease = null;
1015
1021
  await release();
1016
- throw new UrbitHttpError({
1022
+ if (!response.ok) throw new UrbitHttpError({
1017
1023
  operation: "Stream connection",
1018
1024
  status: response.status
1019
1025
  });
1026
+ return;
1020
1027
  }
1021
1028
  this.processStream(response.body).catch((error) => {
1022
1029
  if (!this.aborted) {
@@ -1032,6 +1039,7 @@ var UrbitSSEClient = class {
1032
1039
  let buffer = "";
1033
1040
  let bufferBytes = 0;
1034
1041
  let pendingDelimiterNewline = false;
1042
+ let pendingCarriageReturn = false;
1035
1043
  const appendPending = (text) => {
1036
1044
  const previousCodeUnit = buffer.charCodeAt(buffer.length - 1);
1037
1045
  const firstCodeUnit = text.charCodeAt(0);
@@ -1041,7 +1049,11 @@ var UrbitSSEClient = class {
1041
1049
  buffer += text;
1042
1050
  bufferBytes = nextBytes;
1043
1051
  };
1044
- const consumeText = async (text) => {
1052
+ const consumeText = async (rawText) => {
1053
+ if (rawText.length === 0) return;
1054
+ const startsWithPendingLineFeed = pendingCarriageReturn && rawText.startsWith("\n");
1055
+ pendingCarriageReturn = rawText.endsWith("\r");
1056
+ const text = (startsWithPendingLineFeed ? rawText.slice(1) : rawText).replace(/\r\n?/g, "\n");
1045
1057
  let offset = 0;
1046
1058
  if (pendingDelimiterNewline && text.length > 0) {
1047
1059
  pendingDelimiterNewline = false;
@@ -1091,13 +1103,17 @@ var UrbitSSEClient = class {
1091
1103
  }
1092
1104
  }
1093
1105
  async processEvent(eventData) {
1094
- const lines = eventData.split("\n");
1095
- let data = null;
1106
+ const lines = eventData.split(/\r\n|\r|\n/);
1107
+ const dataLines = [];
1096
1108
  let eventId = null;
1097
1109
  for (const line of lines) {
1098
1110
  if (line.startsWith("id:")) eventId = parseUrbitSseEventId(line.slice(3).trim());
1099
- if (line.startsWith("data:")) data = line.slice(5).trim();
1111
+ if (line.startsWith("data:")) {
1112
+ const value = line.slice(5);
1113
+ dataLines.push(value.startsWith(" ") ? value.slice(1) : value);
1114
+ }
1100
1115
  }
1116
+ const data = dataLines.join("\n");
1101
1117
  if (!data) return;
1102
1118
  let parsed;
1103
1119
  try {
@@ -1189,6 +1205,7 @@ var UrbitSSEClient = class {
1189
1205
  this.reconnectAttempts = 0;
1190
1206
  this.logger.log?.("[SSE] Reconnection successful!");
1191
1207
  } catch (error) {
1208
+ if (this.aborted) return;
1192
1209
  this.logger.error?.(`[SSE] Reconnection failed: ${String(error)}`);
1193
1210
  await this.attemptReconnect();
1194
1211
  }
@@ -1745,7 +1762,14 @@ function extractMessageText(content) {
1745
1762
  }
1746
1763
  }
1747
1764
  const codeBlock = asNullableRecord(block.code);
1748
- if (codeBlock) return `\n\`\`\`${readStringField(codeBlock, "lang") ?? ""}\n${readStringField(codeBlock, "code") ?? ""}\n\`\`\`\n`;
1765
+ if (codeBlock) {
1766
+ const lang = readStringField(codeBlock, "lang") ?? "";
1767
+ const code = readStringField(codeBlock, "code") ?? "";
1768
+ let fenceLength = 3;
1769
+ for (const match of code.matchAll(/`+/g)) fenceLength = Math.max(fenceLength, match[0].length + 1);
1770
+ const fence = "`".repeat(fenceLength);
1771
+ return `\n${fence}${lang}\n${code}\n${fence}\n`;
1772
+ }
1749
1773
  const header = asNullableRecord(block.header);
1750
1774
  if (header) return `\n## ${(Array.isArray(header.content) ? header.content : []).map((item) => typeof item === "string" ? item : "").join("")}\n`;
1751
1775
  const cite = asNullableRecord(block.cite);
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-Dfri5oOT.mjs";
2
+ import { t as tlonPlugin } from "./.setup/channel-BiTAKY7-.mjs";
3
3
  import { n as setTlonRuntime } from "./.setup/runtime-Ck3lNvST.mjs";
4
4
  export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
@@ -1,2 +1 @@
1
- import { t as tlonPlugin } from "./.setup/channel-Dfri5oOT.mjs";
2
- export { tlonPlugin };
1
+ export { t as tlonPlugin } from "./.setup/channel-BiTAKY7-.mjs";
@@ -1,2 +1 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-bInPRAQZ.mjs";
2
- export { legacyConfigRules, normalizeCompatibilityConfig };
1
+ export { t as legacyConfigRules, n as normalizeCompatibilityConfig } from "./.setup/doctor-contract-bInPRAQZ.mjs";
@@ -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-B17eS900.mjs", import.meta.url).href),
7
+ specifier: fileURLToPath(new URL(".setup/api-b5sNP2yy.mjs", import.meta.url).href),
8
8
  exportName: "tlonPlugin"
9
9
  }
10
10
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/tlon",
3
- "version": "2026.10.5-beta.4",
3
+ "version": "2026.10.10-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.10.5-beta.4"
22
+ "openclaw": ">=2026.10.10-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.10.5-beta.4"
124
+ "pluginApi": ">=2026.10.10-beta.1"
125
125
  },
126
126
  "build": {
127
- "openclawVersion": "2026.10.5-beta.4"
127
+ "openclawVersion": "2026.10.10-beta.1"
128
128
  },
129
129
  "release": {
130
130
  "bundleRuntimeDependencies": false,