@openclaw/tlon 2026.7.1-beta.2 → 2026.7.1-beta.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.
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-
|
|
2
|
+
import { t as tlonPlugin } from "./channel-DEy-ysbN.js";
|
|
3
3
|
import { n as setTlonRuntime } from "./runtime-Ck3lNvST.js";
|
|
4
4
|
export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromAllowPrivateNetwork, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
|
|
@@ -59,6 +59,7 @@ function resolveTlonOutboundSessionRoute(params) {
|
|
|
59
59
|
agentId: params.agentId,
|
|
60
60
|
channel: "tlon",
|
|
61
61
|
accountId: params.accountId,
|
|
62
|
+
recipientSessionExact: true,
|
|
62
63
|
peer: {
|
|
63
64
|
kind: "group",
|
|
64
65
|
id: parsed.nest
|
|
@@ -72,6 +73,7 @@ function resolveTlonOutboundSessionRoute(params) {
|
|
|
72
73
|
agentId: params.agentId,
|
|
73
74
|
channel: "tlon",
|
|
74
75
|
accountId: params.accountId,
|
|
76
|
+
recipientSessionExact: true,
|
|
75
77
|
peer: {
|
|
76
78
|
kind: "direct",
|
|
77
79
|
id: parsed.ship
|
|
@@ -84,7 +86,7 @@ function resolveTlonOutboundSessionRoute(params) {
|
|
|
84
86
|
//#endregion
|
|
85
87
|
//#region extensions/tlon/src/channel.ts
|
|
86
88
|
const TLON_CHANNEL_ID = "tlon";
|
|
87
|
-
const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
89
|
+
const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-jkmzax9d.js"));
|
|
88
90
|
const tlonSetupWizardProxy = createTlonSetupWizardBase({
|
|
89
91
|
resolveConfigured: async ({ cfg, accountId }) => await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveConfigured({
|
|
90
92
|
cfg,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as tlonPlugin } from "./channel-
|
|
1
|
+
import { t as tlonPlugin } from "./channel-DEy-ysbN.js";
|
|
2
2
|
export { tlonPlugin };
|
|
@@ -10,7 +10,7 @@ import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
|
10
10
|
import { da, scot } from "@urbit/aura";
|
|
11
11
|
import { Readable } from "node:stream";
|
|
12
12
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
13
|
-
import { readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
13
|
+
import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
14
14
|
import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
15
15
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
16
16
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
@@ -710,11 +710,7 @@ async function scryUrbitPath(deps, params) {
|
|
|
710
710
|
});
|
|
711
711
|
try {
|
|
712
712
|
if (!response.ok) throw new Error(`Scry failed: ${response.status} for path ${params.path}`);
|
|
713
|
-
|
|
714
|
-
return await response.json();
|
|
715
|
-
} catch (cause) {
|
|
716
|
-
throw new Error(`Urbit scry response was malformed JSON for path ${params.path}`, { cause });
|
|
717
|
-
}
|
|
713
|
+
return await readProviderJsonResponse(response, `Tlon scry response for path ${params.path}`);
|
|
718
714
|
} finally {
|
|
719
715
|
await release();
|
|
720
716
|
}
|
|
@@ -1489,7 +1485,8 @@ function createTlonApprovalRuntime(params) {
|
|
|
1489
1485
|
await sendOwnerNotification(`${shipToUnblock} is not blocked.`);
|
|
1490
1486
|
return true;
|
|
1491
1487
|
}
|
|
1492
|
-
|
|
1488
|
+
const success = await unblockShip(shipToUnblock);
|
|
1489
|
+
await sendOwnerNotification(success ? `Unblocked ${shipToUnblock}.` : `Failed to unblock ${shipToUnblock}.`);
|
|
1493
1490
|
return true;
|
|
1494
1491
|
}
|
|
1495
1492
|
}
|
|
@@ -2699,21 +2696,23 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2699
2696
|
const { mode, allowedShips } = resolveChannelAuthorization(cfg, nest, currentSettings);
|
|
2700
2697
|
if (mode === "restricted") {
|
|
2701
2698
|
if (!allowedShips.map(normalizeShip).includes(senderShip)) {
|
|
2702
|
-
if (effectiveOwnerShip)
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2699
|
+
if (effectiveOwnerShip) {
|
|
2700
|
+
const approval = createPendingApproval({
|
|
2701
|
+
type: "channel",
|
|
2702
|
+
requestingShip: senderShip,
|
|
2703
|
+
channelNest: nest,
|
|
2704
|
+
messagePreview: sliceUtf16Safe(rawText, 0, 100),
|
|
2705
|
+
originalMessage: {
|
|
2706
|
+
messageId: messageId ?? "",
|
|
2707
|
+
messageText: rawText,
|
|
2708
|
+
messageContent: contentBody,
|
|
2709
|
+
timestamp: sentAt,
|
|
2710
|
+
parentId: parentId ?? void 0,
|
|
2711
|
+
isThreadReply
|
|
2712
|
+
}
|
|
2713
|
+
});
|
|
2714
|
+
await queueApprovalRequest(approval);
|
|
2715
|
+
} else runtime.log?.(`[tlon] Access denied: ${senderShip} in ${nest} (allowed: ${allowedShips.join(", ")})`);
|
|
2717
2716
|
return;
|
|
2718
2717
|
}
|
|
2719
2718
|
}
|
|
@@ -2786,11 +2785,12 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2786
2785
|
continue;
|
|
2787
2786
|
}
|
|
2788
2787
|
if (effectiveOwnerShip && !await isDmAllowedWithIngress(ship, effectiveDmAllowlist)) {
|
|
2789
|
-
|
|
2788
|
+
const approval = createPendingApproval({
|
|
2790
2789
|
type: "dm",
|
|
2791
2790
|
requestingShip: ship,
|
|
2792
2791
|
messagePreview: "(DM invite - no message yet)"
|
|
2793
|
-
})
|
|
2792
|
+
});
|
|
2793
|
+
await queueApprovalRequest(approval);
|
|
2794
2794
|
processedDmInvites.add(ship);
|
|
2795
2795
|
}
|
|
2796
2796
|
}
|
|
@@ -2848,18 +2848,20 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2848
2848
|
return;
|
|
2849
2849
|
}
|
|
2850
2850
|
if (!await isDmAllowedWithIngress(senderShip, effectiveDmAllowlist)) {
|
|
2851
|
-
if (effectiveOwnerShip)
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2851
|
+
if (effectiveOwnerShip) {
|
|
2852
|
+
const approval = createPendingApproval({
|
|
2853
|
+
type: "dm",
|
|
2854
|
+
requestingShip: senderShip,
|
|
2855
|
+
messagePreview: sliceUtf16Safe(messageText, 0, 100),
|
|
2856
|
+
originalMessage: {
|
|
2857
|
+
messageId: messageId ?? "",
|
|
2858
|
+
messageText,
|
|
2859
|
+
messageContent: essay.content,
|
|
2860
|
+
timestamp: readNumber(essay, "sent") ?? Date.now()
|
|
2861
|
+
}
|
|
2862
|
+
});
|
|
2863
|
+
await queueApprovalRequest(approval);
|
|
2864
|
+
} else runtime.log?.(`[tlon] Blocked DM from ${senderShip}: not in allowlist`);
|
|
2863
2865
|
return;
|
|
2864
2866
|
}
|
|
2865
2867
|
await processMessage({
|
|
@@ -3072,22 +3074,24 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3072
3074
|
}
|
|
3073
3075
|
if (!effectiveAutoAcceptGroupInvites) {
|
|
3074
3076
|
if (effectiveOwnerShip) {
|
|
3075
|
-
|
|
3077
|
+
const approval = createPendingApproval({
|
|
3076
3078
|
type: "group",
|
|
3077
3079
|
requestingShip: inviterShip,
|
|
3078
3080
|
groupFlag
|
|
3079
|
-
})
|
|
3081
|
+
});
|
|
3082
|
+
await queueApprovalRequest(approval);
|
|
3080
3083
|
processedGroupInvites.add(groupFlag);
|
|
3081
3084
|
}
|
|
3082
3085
|
continue;
|
|
3083
3086
|
}
|
|
3084
3087
|
if (!isGroupInviteAllowed(inviterShip, effectiveGroupInviteAllowlist)) {
|
|
3085
3088
|
if (effectiveOwnerShip) {
|
|
3086
|
-
|
|
3089
|
+
const approval = createPendingApproval({
|
|
3087
3090
|
type: "group",
|
|
3088
3091
|
requestingShip: inviterShip,
|
|
3089
3092
|
groupFlag
|
|
3090
|
-
})
|
|
3093
|
+
});
|
|
3094
|
+
await queueApprovalRequest(approval);
|
|
3091
3095
|
processedGroupInvites.add(groupFlag);
|
|
3092
3096
|
} else {
|
|
3093
3097
|
runtime.log?.(`[tlon] Rejected group invite from ${inviterShip} (not in groupInviteAllowlist): ${groupFlag}`);
|
|
@@ -3181,6 +3185,8 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3181
3185
|
//#endregion
|
|
3182
3186
|
//#region extensions/tlon/src/tlon-api.ts
|
|
3183
3187
|
const MEMEX_BASE_URL = "https://memex.tlon.network";
|
|
3188
|
+
/** Max bytes to read from the Memex upload JSON response. */
|
|
3189
|
+
const MEMEX_UPLOAD_RESPONSE_MAX_BYTES = 64 * 1024;
|
|
3184
3190
|
let currentClientConfig = null;
|
|
3185
3191
|
function configureClient(params) {
|
|
3186
3192
|
currentClientConfig = {
|
|
@@ -3301,7 +3307,7 @@ async function getMemexUploadUrl(params) {
|
|
|
3301
3307
|
});
|
|
3302
3308
|
release = guarded.release;
|
|
3303
3309
|
if (!guarded.response.ok) throw new Error(`Memex upload request failed: ${guarded.response.status}`);
|
|
3304
|
-
const data = await guarded.response
|
|
3310
|
+
const data = await readProviderJsonResponse(guarded.response, "Memex upload", { maxBytes: MEMEX_UPLOAD_RESPONSE_MAX_BYTES });
|
|
3305
3311
|
if (!data?.url || !data.filePath) throw new Error("Invalid response from Memex");
|
|
3306
3312
|
return {
|
|
3307
3313
|
hostedUrl: data.filePath,
|
|
@@ -3409,6 +3415,7 @@ async function uploadFile(params) {
|
|
|
3409
3415
|
/**
|
|
3410
3416
|
* Upload an image from a URL to Tlon storage.
|
|
3411
3417
|
*/
|
|
3418
|
+
const TLON_UPLOAD_IMAGE_IDLE_TIMEOUT_MS = 3e4;
|
|
3412
3419
|
/**
|
|
3413
3420
|
* Fetch an image from a URL and upload it to Tlon storage.
|
|
3414
3421
|
* Returns the uploaded URL, or falls back to the original URL on error.
|
|
@@ -3422,26 +3429,19 @@ async function uploadImageFromUrl(imageUrl) {
|
|
|
3422
3429
|
console.warn(`[tlon] Rejected non-http(s) URL: ${imageUrl}`);
|
|
3423
3430
|
return imageUrl;
|
|
3424
3431
|
}
|
|
3425
|
-
const
|
|
3432
|
+
const fetched = await readRemoteMediaBuffer({
|
|
3426
3433
|
url: imageUrl,
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3434
|
+
maxBytes: MAX_IMAGE_BYTES,
|
|
3435
|
+
readIdleTimeoutMs: TLON_UPLOAD_IMAGE_IDLE_TIMEOUT_MS,
|
|
3436
|
+
ssrfPolicy: void 0,
|
|
3437
|
+
requestInit: { method: "GET" }
|
|
3430
3438
|
});
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
return (await uploadFile({
|
|
3438
|
-
blob: await response.blob(),
|
|
3439
|
-
fileName: new URL(imageUrl).pathname.split("/").pop() || `upload-${Date.now()}.png`,
|
|
3440
|
-
contentType
|
|
3441
|
-
})).url;
|
|
3442
|
-
} finally {
|
|
3443
|
-
await release();
|
|
3444
|
-
}
|
|
3439
|
+
const contentType = fetched.contentType || "image/png";
|
|
3440
|
+
return (await uploadFile({
|
|
3441
|
+
blob: new Blob([new Uint8Array(fetched.buffer)], { type: contentType }),
|
|
3442
|
+
fileName: new URL(imageUrl).pathname.split("/").pop() || `upload-${Date.now()}.png`,
|
|
3443
|
+
contentType
|
|
3444
|
+
})).url;
|
|
3445
3445
|
} catch (err) {
|
|
3446
3446
|
console.warn(`[tlon] Failed to upload image, using original URL: ${String(err)}`);
|
|
3447
3447
|
return imageUrl;
|