@openclaw/tlon 2026.9.3 → 2026.9.5

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.
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 5h16M8 5v14M16 5v14M4 19h16M5 10h14M5 14h14" />
3
+ </svg>
Binary file
@@ -0,0 +1,5 @@
1
+ import { a as ssrfPolicyFromDangerouslyAllowPrivateNetwork, i as isBlockedHostnameOrIp, n as createDedupeCache, o as createLoggerBackedRuntime, r as fetchWithSsrFGuard, t as SsrFBlockedError } from "./runtime-api-BXVe40nS.mjs";
2
+ import { t as tlonPlugin } from "./channel-Be-mBRh3.mjs";
3
+ import { n as setTlonRuntime } from "./runtime-Ck3lNvST.mjs";
4
+ import "../api.js";
5
+ export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
@@ -1,5 +1,5 @@
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-CYiZjoTI.js";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CZ8OWBXt.mjs";
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-Ny4-ZMK0.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";
@@ -95,7 +95,7 @@ function resolveTlonOutboundSessionRoute(params) {
95
95
  //#endregion
96
96
  //#region extensions/tlon/src/channel.ts
97
97
  const TLON_CHANNEL_ID = "tlon";
98
- const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-D5Rie0uM.js"));
98
+ const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DUlwDRmR.mjs"));
99
99
  const tlonSetupWizardProxy = createTlonSetupWizardBase({
100
100
  resolveConfigured: async ({ cfg, accountId }) => await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveConfigured({
101
101
  cfg,
@@ -1,7 +1,7 @@
1
- import { n as createDedupeCache, o as createLoggerBackedRuntime } from "./runtime-api-BXVe40nS.js";
2
- import { c as normalizeUrbitHostname, d as resolveTlonAccount, f as formatTargetHint, h as parseTlonTarget, l as validateUrbitBaseUrl, m as parseChannelNest, p as normalizeShip } from "./setup-core-CYiZjoTI.js";
3
- import { t as getTlonRuntime } from "./runtime-Ck3lNvST.js";
4
- import { t as tlonSetupWizard } from "./setup-surface-35N3bJMh.js";
1
+ import { n as createDedupeCache, o as createLoggerBackedRuntime } from "./runtime-api-BXVe40nS.mjs";
2
+ import { c as normalizeUrbitHostname, d as resolveTlonAccount, f as formatTargetHint, h as parseTlonTarget, l as validateUrbitBaseUrl, m as parseChannelNest, p as normalizeShip } from "./setup-core-Ny4-ZMK0.mjs";
3
+ import { t as getTlonRuntime } from "./runtime-Ck3lNvST.mjs";
4
+ import { t as tlonSetupWizard } from "./setup-surface-C4uWCLAo.mjs";
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 { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
@@ -20,13 +20,11 @@ import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
20
20
  import { resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
21
21
  import { resolveChannelImplicitMentions, resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
22
22
  import { isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
23
- import { mkdir, writeFile } from "node:fs/promises";
24
- import * as path from "node:path";
25
- import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
26
23
  import { MAX_IMAGE_BYTES, readRemoteMediaBuffer, saveRemoteMedia } from "openclaw/plugin-sdk/media-runtime";
24
+ import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
27
25
  import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
28
26
  import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
29
- import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
27
+ import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
30
28
  //#region extensions/tlon/src/settings.ts
31
29
  /**
32
30
  * Settings Store integration for hot-reloading Tlon plugin config.
@@ -288,6 +286,7 @@ async function urbitFetch(params) {
288
286
  const guarded = await fetchWithSsrFGuard({
289
287
  url,
290
288
  fetchImpl: params.fetchImpl,
289
+ beforeRequest: params.beforeRequest,
291
290
  init: params.init,
292
291
  timeoutMs: params.timeoutMs,
293
292
  maxRedirects: params.maxRedirects,
@@ -320,6 +319,7 @@ async function authenticate(url, code, options = {}) {
320
319
  ssrfPolicy: options.ssrfPolicy,
321
320
  lookupFn: options.lookupFn,
322
321
  fetchImpl: options.fetchImpl,
322
+ beforeRequest: options.beforeRequest,
323
323
  timeoutMs: options.timeoutMs ?? 15e3,
324
324
  maxRedirects: 3,
325
325
  auditContext: "tlon-urbit-login"
@@ -927,6 +927,7 @@ async function scryUrbitPath(deps, params) {
927
927
  ssrfPolicy: deps.ssrfPolicy,
928
928
  lookupFn: deps.lookupFn,
929
929
  fetchImpl: deps.fetchImpl,
930
+ beforeRequest: deps.beforeRequest,
930
931
  timeoutMs: 3e4,
931
932
  auditContext: params.auditContext
932
933
  });
@@ -1802,33 +1803,42 @@ function resolveChannelAuthorization(cfg, channelNest, settings) {
1802
1803
  function extractCites(content) {
1803
1804
  if (!content || !Array.isArray(content)) return [];
1804
1805
  const cites = [];
1805
- for (const verse of content) if (verse?.block?.cite && typeof verse.block.cite === "object") {
1806
- const cite = verse.block.cite;
1807
- if (cite.chan && typeof cite.chan === "object") {
1808
- const { nest, where } = cite.chan;
1809
- const whereMatch = where?.match(/\/msg\/(~[a-z-]+)\/(.+)/);
1810
- cites.push({
1811
- type: "chan",
1812
- nest,
1813
- where,
1814
- author: whereMatch?.[1],
1815
- postId: whereMatch?.[2]
1806
+ for (const verse of content) {
1807
+ const verseRecord = asNullableRecord(verse);
1808
+ const block = asNullableRecord(verseRecord?.block);
1809
+ const cite = asNullableRecord(block?.cite);
1810
+ if (cite) {
1811
+ const chan = asNullableRecord(cite.chan);
1812
+ const group = readStringField(cite, "group");
1813
+ const desk = asNullableRecord(cite.desk);
1814
+ const bait = asNullableRecord(cite.bait);
1815
+ if (chan) {
1816
+ const nest = readStringField(chan, "nest");
1817
+ const where = readStringField(chan, "where");
1818
+ const whereMatch = where?.match(/\/msg\/(~[a-z-]+)\/(.+)/);
1819
+ cites.push({
1820
+ type: "chan",
1821
+ nest,
1822
+ where,
1823
+ author: whereMatch?.[1],
1824
+ postId: whereMatch?.[2]
1825
+ });
1826
+ } else if (group) cites.push({
1827
+ type: "group",
1828
+ group
1816
1829
  });
1817
- } else if (cite.group && typeof cite.group === "string") cites.push({
1818
- type: "group",
1819
- group: cite.group
1820
- });
1821
- else if (cite.desk && typeof cite.desk === "object") cites.push({
1822
- type: "desk",
1823
- flag: cite.desk.flag,
1824
- where: cite.desk.where
1825
- });
1826
- else if (cite.bait && typeof cite.bait === "object") cites.push({
1827
- type: "bait",
1828
- group: cite.bait.group,
1829
- nest: cite.bait.graph,
1830
- where: cite.bait.where
1831
- });
1830
+ else if (desk) cites.push({
1831
+ type: "desk",
1832
+ flag: readStringField(desk, "flag"),
1833
+ where: readStringField(desk, "where")
1834
+ });
1835
+ else if (bait) cites.push({
1836
+ type: "bait",
1837
+ group: readStringField(bait, "group"),
1838
+ nest: readStringField(bait, "graph"),
1839
+ where: readStringField(bait, "where")
1840
+ });
1841
+ }
1832
1842
  }
1833
1843
  return cites;
1834
1844
  }
@@ -2066,12 +2076,37 @@ function formatSummarizationHistoryText(history, cfg) {
2066
2076
  }
2067
2077
  //#endregion
2068
2078
  //#region extensions/tlon/src/monitor/cites.ts
2079
+ const CITE_PATH_SEGMENT_RE = /^[A-Za-z0-9._~-]+$/;
2080
+ const CITE_PATH_NORMALIZATION_BASE = "https://tlon.invalid";
2081
+ function isSafeCitePathSegment(segment) {
2082
+ if (segment === "." || segment === "..") return false;
2083
+ return CITE_PATH_SEGMENT_RE.test(segment);
2084
+ }
2085
+ /**
2086
+ * Build the channel-post scry path for a citation, or return null when the cited
2087
+ * identifiers cannot address exactly that resource. The normalization check is the
2088
+ * boundary guarantee: `scryUrbitPath` prefixes `/~/scry` and `urbitFetch` resolves the
2089
+ * result through `new URL`, so a path that changes under normalization would leave the
2090
+ * channel-post namespace while still carrying the Urbit auth cookie.
2091
+ */
2092
+ function buildCitedPostScryPath(nest, postId) {
2093
+ const nestSegments = nest.split("/");
2094
+ if (nestSegments.length !== 3 || !nestSegments.every(isSafeCitePathSegment)) return null;
2095
+ if (!isSafeCitePathSegment(postId)) return null;
2096
+ const scryPath = `/channels/v4/${nest}/posts/post/${postId}.json`;
2097
+ if (new URL(scryPath, CITE_PATH_NORMALIZATION_BASE).pathname !== scryPath) return null;
2098
+ return scryPath;
2099
+ }
2069
2100
  function createTlonCitationResolver(params) {
2070
2101
  const { api, runtime } = params;
2071
2102
  const resolveCiteContent = async (cite) => {
2072
2103
  if (cite.type !== "chan" || !cite.nest || !cite.postId) return null;
2104
+ const scryPath = buildCitedPostScryPath(cite.nest, cite.postId);
2105
+ if (!scryPath) {
2106
+ runtime.log?.("[tlon] Skipping cited post: citation does not name a channel post");
2107
+ return null;
2108
+ }
2073
2109
  try {
2074
- const scryPath = `/channels/v4/${cite.nest}/posts/post/${cite.postId}.json`;
2075
2110
  runtime.log?.(`[tlon] Fetching cited post: ${scryPath}`);
2076
2111
  const data = asNullableRecord(await api.scry(scryPath));
2077
2112
  const essay = asNullableRecord(data?.essay);
@@ -2447,66 +2482,39 @@ function extractImageBlocks(content) {
2447
2482
  * Download a media file from URL to local storage.
2448
2483
  * Returns the local path where the file was saved.
2449
2484
  */
2450
- async function downloadMedia(url, mediaDir, maxBytes) {
2485
+ async function downloadMedia(url, maxBytes) {
2451
2486
  try {
2452
2487
  const parsedUrl = new URL(url);
2453
2488
  if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
2454
2489
  console.warn(`[tlon-media] Rejected non-http(s) URL: ${url}`);
2455
2490
  return null;
2456
2491
  }
2457
- const fetchOptions = {
2492
+ const saved = await saveRemoteMedia({
2458
2493
  url,
2459
2494
  maxBytes: Math.min(maxBytes ?? MAX_IMAGE_BYTES, MAX_IMAGE_BYTES),
2460
2495
  ...TLON_MEDIA_FETCH_TIMEOUTS,
2461
2496
  ssrfPolicy: void 0,
2462
2497
  requestInit: { method: "GET" }
2463
- };
2464
- if (!mediaDir) {
2465
- const saved = await saveRemoteMedia(fetchOptions);
2466
- return {
2467
- localPath: saved.path,
2468
- contentType: saved.contentType ?? "application/octet-stream"
2469
- };
2470
- }
2471
- const fetched = await readRemoteMediaBuffer(fetchOptions);
2472
- await mkdir(mediaDir, { recursive: true });
2473
- const ext = getExtensionFromFileName(fetched.fileName) || getExtensionFromContentType(fetched.contentType ?? "") || getExtensionFromUrl(url) || "bin";
2474
- const localPath = path.join(mediaDir, `${randomUUID()}.${ext}`);
2475
- await writeFile(localPath, fetched.buffer);
2498
+ });
2476
2499
  return {
2477
- localPath,
2478
- contentType: fetched.contentType ?? "application/octet-stream"
2500
+ localPath: saved.path,
2501
+ contentType: saved.contentType ?? "application/octet-stream"
2479
2502
  };
2480
2503
  } catch (error) {
2481
2504
  console.error(`[tlon-media] Error downloading ${url}: ${formatErrorMessage(error)}`);
2482
2505
  return null;
2483
2506
  }
2484
2507
  }
2485
- function getExtensionFromFileName(fileName) {
2486
- if (!fileName) return null;
2487
- return path.extname(fileName).replace(/^\./, "") || null;
2488
- }
2489
- function getExtensionFromContentType(contentType) {
2490
- return extensionForMime(contentType)?.replace(/^\./u, "") ?? null;
2491
- }
2492
- function getExtensionFromUrl(url) {
2493
- try {
2494
- const match = new URL(url).pathname.match(/\.([a-z0-9]+)$/i);
2495
- return match ? normalizeLowercaseStringOrEmpty(match[1]) : null;
2496
- } catch {
2497
- return null;
2498
- }
2499
- }
2500
2508
  /**
2501
2509
  * Download all images from a message and return attachment metadata.
2502
2510
  * Format matches OpenClaw's expected attachment structure.
2503
2511
  */
2504
- async function downloadMessageImages(content, mediaDir, maxBytes) {
2512
+ async function downloadMessageImages(content, maxBytes) {
2505
2513
  const { images, unavailableCount: overCapCount } = extractImageBlocks(content);
2506
2514
  const attachments = [];
2507
2515
  let unavailableCount = overCapCount;
2508
2516
  for (const image of images) {
2509
- const downloaded = await downloadMedia(image.url, mediaDir, maxBytes);
2517
+ const downloaded = await downloadMedia(image.url, maxBytes);
2510
2518
  if (downloaded) attachments.push({
2511
2519
  path: downloaded.localPath,
2512
2520
  contentType: downloaded.contentType
@@ -2800,7 +2808,7 @@ async function monitorTlonProvider(opts = {}) {
2800
2808
  let attachments = [];
2801
2809
  let unavailableMediaCount = 0;
2802
2810
  if (messageContent) try {
2803
- ({attachments, unavailableCount: unavailableMediaCount} = await downloadMessageImages(messageContent, void 0, account.mediaMaxBytes));
2811
+ ({attachments, unavailableCount: unavailableMediaCount} = await downloadMessageImages(messageContent, account.mediaMaxBytes));
2804
2812
  if (attachments.length > 0) runtime.log?.(`[tlon] Downloaded ${attachments.length} image(s) from message`);
2805
2813
  } catch (error) {
2806
2814
  runtime.log?.(`[tlon] Failed to download images: ${formatErrorMessage(error)}`);
@@ -2892,7 +2900,7 @@ async function monitorTlonProvider(opts = {}) {
2892
2900
  api,
2893
2901
  fromShip: botShipName,
2894
2902
  toShip: effectiveOwnerShip,
2895
- text: "⚠️ Security Warning: Multiple users are sharing a DM session with this bot. This can leak conversation context between users.\n\nFix: Add to your OpenClaw config:\nsession:\n dmScope: \"per-channel-peer\"\n\nDocs: https://docs.openclaw.ai/concepts/session#secure-dm-mode"
2903
+ text: "⚠️ Security Warning: Multiple users are sharing a DM session with this bot. This can leak conversation context between users.\n\nFix: Add to your OpenClaw config:\nsession:\n dmScope: \"per-channel-peer\"\n\nDocs: https://docs.openclaw.ai/concepts/session#dm-isolation"
2896
2904
  }).catch((err) => runtime.error?.(`[tlon] Failed to send security warning to owner: ${formatErrorMessage(err)}`));
2897
2905
  }
2898
2906
  }
@@ -3666,7 +3674,6 @@ const MEMEX_UPLOAD_RESPONSE_MAX_BYTES = 65536;
3666
3674
  const TLON_MEMEX_UPLOAD_URL_TIMEOUT_MS = 3e4;
3667
3675
  /** Total deadline for Memex and custom S3 PUTs, including DNS and the full upload. */
3668
3676
  const TLON_UPLOAD_TIMEOUT_MS = 3e5;
3669
- let currentClientConfig = null;
3670
3677
  async function releaseUploadResponse(guarded) {
3671
3678
  if (!guarded) return;
3672
3679
  try {
@@ -3675,16 +3682,6 @@ async function releaseUploadResponse(guarded) {
3675
3682
  await guarded.release();
3676
3683
  }
3677
3684
  }
3678
- function configureClient(params) {
3679
- currentClientConfig = {
3680
- ...params,
3681
- shipName: params.shipName.replace(/^~/, "")
3682
- };
3683
- }
3684
- function requireClientConfig() {
3685
- if (!currentClientConfig) throw new Error("Tlon client not configured");
3686
- return currentClientConfig;
3687
- }
3688
3685
  function getExtensionFromMimeType(mimeType) {
3689
3686
  return extensionForMime(mimeType) || ".jpg";
3690
3687
  }
@@ -3745,13 +3742,17 @@ function sanitizeFileName(fileName) {
3745
3742
  return fileName.split(/[/\\]/).pop() || fileName;
3746
3743
  }
3747
3744
  async function getAuthCookie(config) {
3748
- return await authenticate(config.shipUrl, await config.getCode(), { ssrfPolicy: ssrfPolicyFromDangerouslyAllowPrivateNetwork(config.dangerouslyAllowPrivateNetwork) });
3745
+ return await authenticate(config.shipUrl, await config.getCode(), {
3746
+ ssrfPolicy: ssrfPolicyFromDangerouslyAllowPrivateNetwork(config.dangerouslyAllowPrivateNetwork),
3747
+ beforeRequest: config.assertDirectAdapterHandoff
3748
+ });
3749
3749
  }
3750
3750
  async function scryJson(config, cookie, path) {
3751
3751
  return await scryUrbitPath({
3752
3752
  baseUrl: config.shipUrl,
3753
3753
  cookie,
3754
- ssrfPolicy: ssrfPolicyFromDangerouslyAllowPrivateNetwork(config.dangerouslyAllowPrivateNetwork)
3754
+ ssrfPolicy: ssrfPolicyFromDangerouslyAllowPrivateNetwork(config.dangerouslyAllowPrivateNetwork),
3755
+ beforeRequest: config.assertDirectAdapterHandoff
3755
3756
  }, {
3756
3757
  path,
3757
3758
  auditContext: "tlon-storage-scry"
@@ -3791,7 +3792,8 @@ async function getMemexUploadUrl(params) {
3791
3792
  auditContext: "tlon-memex-upload-url",
3792
3793
  capture: false,
3793
3794
  maxRedirects: 0,
3794
- timeoutMs: TLON_MEMEX_UPLOAD_URL_TIMEOUT_MS
3795
+ timeoutMs: TLON_MEMEX_UPLOAD_URL_TIMEOUT_MS,
3796
+ beforeRequest: params.config.assertDirectAdapterHandoff
3795
3797
  });
3796
3798
  if (!guarded.response.ok) throw new Error(`Memex upload request failed: ${guarded.response.status}`);
3797
3799
  const data = await readProviderJsonResponse(guarded.response, "Memex upload", { maxBytes: MEMEX_UPLOAD_RESPONSE_MAX_BYTES });
@@ -3804,8 +3806,11 @@ async function getMemexUploadUrl(params) {
3804
3806
  await releaseUploadResponse(guarded);
3805
3807
  }
3806
3808
  }
3807
- async function uploadFile(params) {
3808
- const config = requireClientConfig();
3809
+ async function uploadFile(params, clientConfig) {
3810
+ const config = {
3811
+ ...clientConfig,
3812
+ shipName: clientConfig.shipName.replace(/^~/, "")
3813
+ };
3809
3814
  const cookie = await getAuthCookie(config);
3810
3815
  const privateNetworkPolicy = ssrfPolicyFromDangerouslyAllowPrivateNetwork(config.dangerouslyAllowPrivateNetwork);
3811
3816
  const [storageConfig, credentials] = await Promise.all([getStorageConfiguration(config, cookie), getStorageCredentials(config, cookie)]);
@@ -3837,7 +3842,8 @@ async function uploadFile(params) {
3837
3842
  auditContext: "tlon-memex-upload",
3838
3843
  capture: false,
3839
3844
  maxRedirects: 0,
3840
- timeoutMs: TLON_UPLOAD_TIMEOUT_MS
3845
+ timeoutMs: TLON_UPLOAD_TIMEOUT_MS,
3846
+ beforeRequest: config.assertDirectAdapterHandoff
3841
3847
  });
3842
3848
  assertTrustedMemexUploadUrl(guarded.finalUrl, "Memex final upload URL");
3843
3849
  if (!guarded.response.ok) throw new Error(`Upload failed: ${guarded.response.status}`);
@@ -3882,7 +3888,8 @@ async function uploadFile(params) {
3882
3888
  capture: false,
3883
3889
  maxRedirects: 0,
3884
3890
  policy: privateNetworkPolicy,
3885
- timeoutMs: TLON_UPLOAD_TIMEOUT_MS
3891
+ timeoutMs: TLON_UPLOAD_TIMEOUT_MS,
3892
+ beforeRequest: config.assertDirectAdapterHandoff
3886
3893
  });
3887
3894
  if (!guarded.response.ok) throw new Error(`Upload failed: ${guarded.response.status}`);
3888
3895
  } finally {
@@ -3898,11 +3905,19 @@ async function uploadFile(params) {
3898
3905
  /**
3899
3906
  * Fetch an image from a URL and upload it to Tlon storage.
3900
3907
  * Falls back to the original URL on error, but only after a bounded download when a cap is set.
3901
- *
3902
- * Note: configureClient must be called before using this function.
3903
3908
  */
3904
- async function uploadImageFromUrl(imageUrl, maxBytes) {
3909
+ async function uploadImageFromUrl(imageUrl, clientConfig, maxBytes) {
3905
3910
  let sourceSizeVerified = false;
3911
+ const assertCurrent = clientConfig.assertDirectAdapterHandoff;
3912
+ let authorityRejection;
3913
+ const beforeRequest = assertCurrent ? () => {
3914
+ try {
3915
+ return assertCurrent();
3916
+ } catch (error) {
3917
+ authorityRejection ??= { error };
3918
+ throw error;
3919
+ }
3920
+ } : void 0;
3906
3921
  try {
3907
3922
  const url = new URL(imageUrl);
3908
3923
  if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("Tlon image URL must use HTTP or HTTPS");
@@ -3911,6 +3926,7 @@ async function uploadImageFromUrl(imageUrl, maxBytes) {
3911
3926
  maxBytes: Math.min(maxBytes ?? MAX_IMAGE_BYTES, MAX_IMAGE_BYTES),
3912
3927
  ...TLON_MEDIA_FETCH_TIMEOUTS,
3913
3928
  ssrfPolicy: void 0,
3929
+ beforeRequest,
3914
3930
  requestInit: { method: "GET" }
3915
3931
  });
3916
3932
  sourceSizeVerified = true;
@@ -3919,8 +3935,13 @@ async function uploadImageFromUrl(imageUrl, maxBytes) {
3919
3935
  blob: new Blob([bufferToBlobPart(fetched.buffer)], { type: contentType }),
3920
3936
  fileName: new URL(imageUrl).pathname.split("/").pop() || `upload-${Date.now()}.png`,
3921
3937
  contentType
3938
+ }, {
3939
+ ...clientConfig,
3940
+ assertDirectAdapterHandoff: beforeRequest
3922
3941
  })).url;
3923
3942
  } catch (err) {
3943
+ if (authorityRejection) throw authorityRejection.error;
3944
+ assertCurrent?.();
3924
3945
  if (maxBytes !== void 0 && !sourceSizeVerified) throw err;
3925
3946
  console.warn(`[tlon] Failed to upload image, using original URL: ${String(err)}`);
3926
3947
  return imageUrl;
@@ -3930,7 +3951,10 @@ async function uploadImageFromUrl(imageUrl, maxBytes) {
3930
3951
  //#region extensions/tlon/src/channel.runtime.ts
3931
3952
  async function createHttpPokeApi(params) {
3932
3953
  const ssrfPolicy = ssrfPolicyFromDangerouslyAllowPrivateNetwork(params.dangerouslyAllowPrivateNetwork);
3933
- const cookie = await authenticate(params.url, params.code, { ssrfPolicy });
3954
+ const cookie = await authenticate(params.url, params.code, {
3955
+ ssrfPolicy,
3956
+ beforeRequest: params.assertDirectAdapterHandoff
3957
+ });
3934
3958
  const channelPath = `/~/channel/${`${Math.floor(Date.now() / 1e3)}-${crypto.randomUUID()}`}`;
3935
3959
  const shipName = params.ship.replace(/^~/, "");
3936
3960
  return { poke: async (pokeParams) => {
@@ -3943,6 +3967,8 @@ async function createHttpPokeApi(params) {
3943
3967
  mark: pokeParams.mark,
3944
3968
  json: pokeParams.json
3945
3969
  };
3970
+ params.assertDirectAdapterHandoff?.();
3971
+ await params.onPlatformSendDispatch?.();
3946
3972
  const { response, release } = await urbitFetch({
3947
3973
  baseUrl: params.url,
3948
3974
  path: channelPath,
@@ -3955,7 +3981,8 @@ async function createHttpPokeApi(params) {
3955
3981
  body: JSON.stringify([pokeData])
3956
3982
  },
3957
3983
  ssrfPolicy,
3958
- auditContext: "tlon-poke"
3984
+ auditContext: "tlon-poke",
3985
+ beforeRequest: params.assertDirectAdapterHandoff
3959
3986
  });
3960
3987
  try {
3961
3988
  if (!response.ok && response.status !== 204) {
@@ -3970,7 +3997,14 @@ async function createHttpPokeApi(params) {
3970
3997
  }
3971
3998
  function resolveOutboundContext(params) {
3972
3999
  const account = resolveTlonAccount(params.cfg, params.accountId ?? void 0);
3973
- if (!account.configured || !account.ship || !account.url || !account.code) throw new Error("Tlon account not configured");
4000
+ if (!account.configured || !account.ship || !account.url || !account.code) {
4001
+ const missingFields = [
4002
+ account.ship ? void 0 : "ship",
4003
+ account.url ? void 0 : "url",
4004
+ account.code ? void 0 : "code"
4005
+ ].filter((field) => field !== void 0);
4006
+ throw new Error(`Tlon account ${account.accountId} not configured (missing ${missingFields.join(", ")})`);
4007
+ }
3974
4008
  const parsed = parseTlonTarget(params.to);
3975
4009
  if (!parsed) throw new Error(`Invalid Tlon target. Use ${formatTargetHint()}`);
3976
4010
  return {
@@ -3982,7 +4016,7 @@ function resolveReplyId(replyToId, threadId) {
3982
4016
  return replyToId ?? threadId ? String(replyToId ?? threadId) : void 0;
3983
4017
  }
3984
4018
  async function sendTlonOutbound(params, kind) {
3985
- const { cfg, to, text, accountId, replyToId, threadId } = params;
4019
+ const { cfg, to, text, accountId, replyToId, threadId, assertDirectAdapterHandoff } = params;
3986
4020
  const { account, parsed } = resolveOutboundContext({
3987
4021
  cfg,
3988
4022
  accountId,
@@ -3991,20 +4025,22 @@ async function sendTlonOutbound(params, kind) {
3991
4025
  let uploadedUrl;
3992
4026
  if (kind === "media") {
3993
4027
  const { mediaUrl } = params;
3994
- configureClient({
4028
+ uploadedUrl = mediaUrl ? await uploadImageFromUrl(mediaUrl, {
3995
4029
  shipUrl: account.url,
3996
- shipName: account.ship.replace(/^~/, ""),
4030
+ shipName: account.ship,
3997
4031
  verbose: false,
3998
4032
  getCode: async () => account.code,
3999
- dangerouslyAllowPrivateNetwork: account.dangerouslyAllowPrivateNetwork ?? void 0
4000
- });
4001
- uploadedUrl = mediaUrl ? await uploadImageFromUrl(mediaUrl, account.mediaMaxBytes) : void 0;
4033
+ dangerouslyAllowPrivateNetwork: account.dangerouslyAllowPrivateNetwork ?? void 0,
4034
+ assertDirectAdapterHandoff
4035
+ }, account.mediaMaxBytes) : void 0;
4002
4036
  }
4003
4037
  const api = await createHttpPokeApi({
4004
4038
  url: account.url,
4005
4039
  ship: account.ship,
4006
4040
  code: account.code,
4007
- dangerouslyAllowPrivateNetwork: account.dangerouslyAllowPrivateNetwork ?? void 0
4041
+ dangerouslyAllowPrivateNetwork: account.dangerouslyAllowPrivateNetwork ?? void 0,
4042
+ assertDirectAdapterHandoff,
4043
+ onPlatformSendDispatch: params.onPlatformSendDispatch
4008
4044
  });
4009
4045
  const fromShip = normalizeShip(account.ship);
4010
4046
  const story = kind === "media" ? buildMediaStory(text, uploadedUrl) : markdownToStory(text);
@@ -337,22 +337,14 @@ function applyTlonSetupConfig(params) {
337
337
  });
338
338
  const base = namedConfig.channels?.tlon ?? {};
339
339
  const payload = buildTlonAccountFields(input);
340
- if (useDefault) return {
341
- ...namedConfig,
342
- channels: {
343
- ...namedConfig.channels,
344
- tlon: {
345
- ...base,
346
- enabled: true,
347
- ...payload
348
- }
349
- }
350
- };
351
340
  return patchScopedAccountConfig({
352
341
  cfg: namedConfig,
353
342
  channelKey: tlonChannelId(),
354
343
  accountId,
355
- patch: { enabled: base.enabled ?? true },
344
+ patch: useDefault ? {
345
+ enabled: true,
346
+ ...payload
347
+ } : { enabled: base.enabled ?? true },
356
348
  accountPatch: {
357
349
  enabled: true,
358
350
  ...payload
@@ -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-CYiZjoTI.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-Ny4-ZMK0.mjs";
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
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
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-Dx1jbpJ1.js";
3
- import { n as setTlonRuntime } from "./runtime-Ck3lNvST.js";
1
+ import { a as ssrfPolicyFromDangerouslyAllowPrivateNetwork, i as isBlockedHostnameOrIp, n as createDedupeCache, o as createLoggerBackedRuntime, r as fetchWithSsrFGuard, t as SsrFBlockedError } from "./.setup/runtime-api-BXVe40nS.mjs";
2
+ import { t as tlonPlugin } from "./.setup/channel-Be-mBRh3.mjs";
3
+ import { n as setTlonRuntime } from "./.setup/runtime-Ck3lNvST.mjs";
4
4
  export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
@@ -1,2 +1,2 @@
1
- import { t as tlonPlugin } from "./channel-Dx1jbpJ1.js";
1
+ import { t as tlonPlugin } from "./.setup/channel-Be-mBRh3.mjs";
2
2
  export { tlonPlugin };
@@ -1,2 +1,2 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CZ8OWBXt.js";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-CZ8OWBXt.mjs";
2
2
  export { legacyConfigRules, normalizeCompatibilityConfig };
@@ -1,2 +1,2 @@
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";
1
+ import { a as ssrfPolicyFromDangerouslyAllowPrivateNetwork, i as isBlockedHostnameOrIp, n as createDedupeCache, o as createLoggerBackedRuntime, r as fetchWithSsrFGuard, t as SsrFBlockedError } from "./.setup/runtime-api-BXVe40nS.mjs";
2
2
  export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, ssrfPolicyFromDangerouslyAllowPrivateNetwork };
package/dist/setup-api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as tlonSetupAdapter } from "./setup-core-CYiZjoTI.js";
2
- import { t as tlonSetupWizard } from "./setup-surface-35N3bJMh.js";
1
+ import { a as tlonSetupAdapter } from "./.setup/setup-core-Ny4-ZMK0.mjs";
2
+ import { t as tlonSetupWizard } from "./.setup/setup-surface-C4uWCLAo.mjs";
3
3
  export { tlonSetupAdapter, tlonSetupWizard };
@@ -1,9 +1,10 @@
1
1
  import { defineBundledChannelSetupEntry } from "openclaw/plugin-sdk/channel-entry-contract";
2
+ import { fileURLToPath } from "node:url";
2
3
  //#region extensions/tlon/setup-entry.ts
3
4
  var setup_entry_default = defineBundledChannelSetupEntry({
4
5
  importMetaUrl: import.meta.url,
5
6
  plugin: {
6
- specifier: "./api.js",
7
+ specifier: fileURLToPath(new URL(".setup/api-EriBxR0s.mjs", import.meta.url).href),
7
8
  exportName: "tlonPlugin"
8
9
  }
9
10
  });
@@ -1,5 +1,8 @@
1
1
  {
2
2
  "id": "tlon",
3
+ "categories": [
4
+ "channels"
5
+ ],
3
6
  "doctorContract": {
4
7
  "configRepair": true
5
8
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/tlon",
3
- "version": "2026.9.3",
3
+ "version": "2026.9.5",
4
4
  "description": "OpenClaw Tlon/Urbit channel plugin for chat workflows.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,18 +8,18 @@
8
8
  },
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "@aws-sdk/client-s3": "3.1121.0",
12
- "@aws-sdk/s3-request-presigner": "3.1121.0",
11
+ "@aws-sdk/client-s3": "3.1128.0",
12
+ "@aws-sdk/s3-request-presigner": "3.1128.0",
13
13
  "@tloncorp/tlon-skill": "0.5.0",
14
14
  "@urbit/aura": "3.0.0",
15
- "zod": "4.4.3"
15
+ "zod": "4.5.4"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@openclaw/plugin-sdk": "workspace:*",
19
19
  "openclaw": "workspace:*"
20
20
  },
21
21
  "peerDependencies": {
22
- "openclaw": ">=2026.9.3"
22
+ "openclaw": ">=2026.9.5"
23
23
  },
24
24
  "peerDependenciesMeta": {
25
25
  "openclaw": {
@@ -115,15 +115,16 @@
115
115
  }
116
116
  },
117
117
  "install": {
118
+ "clawhubSpec": "clawhub:@openclaw/tlon",
118
119
  "npmSpec": "@openclaw/tlon",
119
120
  "defaultChoice": "npm",
120
121
  "minHostVersion": ">=2026.4.10"
121
122
  },
122
123
  "compat": {
123
- "pluginApi": ">=2026.9.3"
124
+ "pluginApi": ">=2026.9.5"
124
125
  },
125
126
  "build": {
126
- "openclawVersion": "2026.9.3"
127
+ "openclawVersion": "2026.9.5"
127
128
  },
128
129
  "release": {
129
130
  "bundleRuntimeDependencies": false,
@@ -138,6 +139,8 @@
138
139
  "files": [
139
140
  "dist/**",
140
141
  "openclaw.plugin.json",
141
- "README.md"
142
+ "README.md",
143
+ "assets/icon.png",
144
+ "assets/activity.svg"
142
145
  ]
143
146
  }