@openclaw/tlon 2026.8.1-beta.2 → 2026.8.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 +1 -1
- package/dist/{channel-CcNtsFWE.js → channel-CfQ-5CaO.js} +4 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-BrjZMX8z.js → channel.runtime-wL0vCIES.js} +112 -174
- package/dist/setup-api.js +2 -2
- package/dist/{setup-core-QCmS9Gmh.js → setup-core-CYiZjoTI.js} +6 -1
- package/dist/{setup-surface-UgXzT7Tg.js → setup-surface-35N3bJMh.js} +1 -1
- package/openclaw.plugin.json +13 -0
- package/package.json +7 -7
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
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-
|
|
2
|
+
import { t as tlonPlugin } from "./channel-CfQ-5CaO.js";
|
|
3
3
|
import { n as setTlonRuntime } from "./runtime-Ck3lNvST.js";
|
|
4
4
|
export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
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";
|
|
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";
|
|
@@ -24,6 +24,7 @@ const tlonCommonConfigFields = {
|
|
|
24
24
|
name: z.string().optional(),
|
|
25
25
|
enabled: z.boolean().optional(),
|
|
26
26
|
configWrites: z.boolean().optional(),
|
|
27
|
+
mediaMaxMb: z.number().positive().optional(),
|
|
27
28
|
ship: ShipSchema.optional(),
|
|
28
29
|
url: z.string().optional(),
|
|
29
30
|
code: z.string().optional(),
|
|
@@ -42,6 +43,7 @@ const tlonCommonConfigFields = {
|
|
|
42
43
|
const TlonAccountSchema = z.object({ ...tlonCommonConfigFields });
|
|
43
44
|
const tlonChannelConfigSchema = buildChannelConfigSchema(z.object({
|
|
44
45
|
...tlonCommonConfigFields,
|
|
46
|
+
historyLimit: z.number().int().min(0).optional(),
|
|
45
47
|
authorization: TlonAuthorizationSchema.optional(),
|
|
46
48
|
defaultAuthorizedShips: z.array(ShipSchema).optional(),
|
|
47
49
|
accounts: z.record(z.string(), TlonAccountSchema).optional()
|
|
@@ -92,7 +94,7 @@ function resolveTlonOutboundSessionRoute(params) {
|
|
|
92
94
|
//#endregion
|
|
93
95
|
//#region extensions/tlon/src/channel.ts
|
|
94
96
|
const TLON_CHANNEL_ID = "tlon";
|
|
95
|
-
const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
97
|
+
const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-wL0vCIES.js"));
|
|
96
98
|
const tlonSetupWizardProxy = createTlonSetupWizardBase({
|
|
97
99
|
resolveConfigured: async ({ cfg, accountId }) => await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveConfigured({
|
|
98
100
|
cfg,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as tlonPlugin } from "./channel-
|
|
1
|
+
import { t as tlonPlugin } from "./channel-CfQ-5CaO.js";
|
|
2
2
|
export { tlonPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as createDedupeCache, o as createLoggerBackedRuntime } from "./runtime-api-BXVe40nS.js";
|
|
2
|
-
import { c as normalizeUrbitHostname, d as resolveTlonAccount, f as formatTargetHint, g as resolveTlonOutboundTarget, h as parseTlonTarget, l as validateUrbitBaseUrl, m as parseChannelNest, p as normalizeShip } from "./setup-core-
|
|
2
|
+
import { c as normalizeUrbitHostname, d as resolveTlonAccount, f as formatTargetHint, g as resolveTlonOutboundTarget, h as parseTlonTarget, l as validateUrbitBaseUrl, m as parseChannelNest, p as normalizeShip } from "./setup-core-CYiZjoTI.js";
|
|
3
3
|
import { t as getTlonRuntime } from "./runtime-Ck3lNvST.js";
|
|
4
|
-
import { t as tlonSetupWizard } from "./setup-surface-
|
|
4
|
+
import { t as tlonSetupWizard } from "./setup-surface-35N3bJMh.js";
|
|
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 { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
|
@@ -13,6 +13,7 @@ import { runChannelProbe, sliceUtf16Safe } from "openclaw/plugin-sdk/text-utilit
|
|
|
13
13
|
import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
14
14
|
import { createChannelInboundEnvelopeBuilder, formatAgentEnvelope, formatInboundMediaUnavailableText, implicitMentionKindWhen, resolveEnvelopeFormatOptions, resolveInboundMentionDecision } from "openclaw/plugin-sdk/channel-inbound";
|
|
15
15
|
import { collectErrorGraphCandidates, formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
16
|
+
import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
16
17
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
17
18
|
import { da, scot } from "@urbit/aura";
|
|
18
19
|
import { Readable } from "node:stream";
|
|
@@ -414,7 +415,7 @@ function parseInlineMarkdown(text) {
|
|
|
414
415
|
}
|
|
415
416
|
const imageMatch = remaining.match(/^!\[([^\]]*)\]\(([^)]+)\)/);
|
|
416
417
|
if (imageMatch) {
|
|
417
|
-
result.push({
|
|
418
|
+
result.push({ imageBlock: {
|
|
418
419
|
src: expectDefined(imageMatch[2], "image URL capture"),
|
|
419
420
|
alt: expectDefined(imageMatch[1], "image alt capture")
|
|
420
421
|
} });
|
|
@@ -492,8 +493,8 @@ function isImageUrl(url) {
|
|
|
492
493
|
function processInlinesForImages(inlines) {
|
|
493
494
|
const cleanInlines = [];
|
|
494
495
|
const imageBlocks = [];
|
|
495
|
-
for (const inline of inlines) if (typeof inline === "object" && "
|
|
496
|
-
const img = inline
|
|
496
|
+
for (const inline of inlines) if (typeof inline === "object" && "imageBlock" in inline) {
|
|
497
|
+
const img = inline.imageBlock;
|
|
497
498
|
imageBlocks.push(createImageBlock(img.src, img.alt));
|
|
498
499
|
} else cleanInlines.push(inline);
|
|
499
500
|
return {
|
|
@@ -1204,8 +1205,8 @@ var UrbitSSEClient = class {
|
|
|
1204
1205
|
let data = null;
|
|
1205
1206
|
let eventId = null;
|
|
1206
1207
|
for (const line of lines) {
|
|
1207
|
-
if (line.startsWith("id:
|
|
1208
|
-
if (line.startsWith("data:
|
|
1208
|
+
if (line.startsWith("id:")) eventId = parseUrbitSseEventId(line.slice(3).trim());
|
|
1209
|
+
if (line.startsWith("data:")) data = line.slice(5).trim();
|
|
1209
1210
|
}
|
|
1210
1211
|
if (!data) return;
|
|
1211
1212
|
let parsed;
|
|
@@ -1531,7 +1532,7 @@ function formatPendingList(approvals) {
|
|
|
1531
1532
|
//#region extensions/tlon/src/monitor/approval-runtime.ts
|
|
1532
1533
|
function createTlonApprovalRuntime(params) {
|
|
1533
1534
|
const { api, runtime, botShipName, getPendingApprovals, setPendingApprovals, getCurrentSettings, setCurrentSettings, getEffectiveDmAllowlist, setEffectiveDmAllowlist, getEffectiveOwnerShip, processApprovedMessage, refreshWatchedChannels } = params;
|
|
1534
|
-
const savePendingApprovals = async () => {
|
|
1535
|
+
const savePendingApprovals = async (required = false) => {
|
|
1535
1536
|
try {
|
|
1536
1537
|
await api.poke({
|
|
1537
1538
|
app: "settings",
|
|
@@ -1545,6 +1546,7 @@ function createTlonApprovalRuntime(params) {
|
|
|
1545
1546
|
});
|
|
1546
1547
|
} catch (err) {
|
|
1547
1548
|
runtime.error?.(`[tlon] Failed to save pending approvals: ${String(err)}`);
|
|
1549
|
+
if (required) throw err;
|
|
1548
1550
|
}
|
|
1549
1551
|
};
|
|
1550
1552
|
const addToDmAllowlist = async (ship) => {
|
|
@@ -1683,12 +1685,12 @@ function createTlonApprovalRuntime(params) {
|
|
|
1683
1685
|
existing.messagePreview = approval.messagePreview;
|
|
1684
1686
|
}
|
|
1685
1687
|
runtime.log?.(`[tlon] Updated existing approval for ${approval.requestingShip} (${approval.type}) - re-sending notification`);
|
|
1686
|
-
await savePendingApprovals();
|
|
1688
|
+
await savePendingApprovals(true);
|
|
1687
1689
|
await sendOwnerNotification(formatApprovalRequest(existing));
|
|
1688
1690
|
return;
|
|
1689
1691
|
}
|
|
1690
1692
|
setPendingApprovals([...approvals, approval]);
|
|
1691
|
-
await savePendingApprovals();
|
|
1693
|
+
await savePendingApprovals(true);
|
|
1692
1694
|
await sendOwnerNotification(formatApprovalRequest(approval));
|
|
1693
1695
|
runtime.log?.(`[tlon] Queued approval request: ${approval.id} (${approval.type} from ${approval.requestingShip})`);
|
|
1694
1696
|
};
|
|
@@ -2440,7 +2442,7 @@ function extractImageBlocks(content) {
|
|
|
2440
2442
|
* Download a media file from URL to local storage.
|
|
2441
2443
|
* Returns the local path where the file was saved.
|
|
2442
2444
|
*/
|
|
2443
|
-
async function downloadMedia(url, mediaDir) {
|
|
2445
|
+
async function downloadMedia(url, mediaDir, maxBytes) {
|
|
2444
2446
|
try {
|
|
2445
2447
|
const parsedUrl = new URL(url);
|
|
2446
2448
|
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
|
|
@@ -2449,7 +2451,7 @@ async function downloadMedia(url, mediaDir) {
|
|
|
2449
2451
|
}
|
|
2450
2452
|
const fetchOptions = {
|
|
2451
2453
|
url,
|
|
2452
|
-
maxBytes: MAX_IMAGE_BYTES,
|
|
2454
|
+
maxBytes: Math.min(maxBytes ?? MAX_IMAGE_BYTES, MAX_IMAGE_BYTES),
|
|
2453
2455
|
...TLON_MEDIA_FETCH_TIMEOUTS,
|
|
2454
2456
|
ssrfPolicy: void 0,
|
|
2455
2457
|
requestInit: { method: "GET" }
|
|
@@ -2494,12 +2496,12 @@ function getExtensionFromUrl(url) {
|
|
|
2494
2496
|
* Download all images from a message and return attachment metadata.
|
|
2495
2497
|
* Format matches OpenClaw's expected attachment structure.
|
|
2496
2498
|
*/
|
|
2497
|
-
async function downloadMessageImages(content, mediaDir) {
|
|
2499
|
+
async function downloadMessageImages(content, mediaDir, maxBytes) {
|
|
2498
2500
|
const { images, unavailableCount: overCapCount } = extractImageBlocks(content);
|
|
2499
2501
|
const attachments = [];
|
|
2500
2502
|
let unavailableCount = overCapCount;
|
|
2501
2503
|
for (const image of images) {
|
|
2502
|
-
const downloaded = await downloadMedia(image.url, mediaDir);
|
|
2504
|
+
const downloaded = await downloadMedia(image.url, mediaDir, maxBytes);
|
|
2503
2505
|
if (downloaded) attachments.push({
|
|
2504
2506
|
path: downloaded.localPath,
|
|
2505
2507
|
contentType: downloaded.contentType
|
|
@@ -2662,20 +2664,27 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2662
2664
|
const accountUrl = account.url;
|
|
2663
2665
|
const accountCode = account.code;
|
|
2664
2666
|
async function authenticateWithRetry(maxAttempts = 10) {
|
|
2665
|
-
|
|
2667
|
+
let authAttempt = 0;
|
|
2668
|
+
return await retryAsync(async () => {
|
|
2669
|
+
authAttempt += 1;
|
|
2666
2670
|
if (opts.abortSignal?.aborted) throw new Error("Aborted while waiting to authenticate");
|
|
2667
2671
|
try {
|
|
2668
2672
|
runtime.log?.(`[tlon] Attempting authentication to ${accountUrl}...`);
|
|
2669
2673
|
return await authenticate(accountUrl, accountCode, { ssrfPolicy });
|
|
2670
2674
|
} catch (error) {
|
|
2671
|
-
runtime.error?.(`[tlon] Failed to authenticate (attempt ${
|
|
2672
|
-
|
|
2673
|
-
const delay = Math.min(3e4, 1e3 * 2 ** (attempt - 1));
|
|
2674
|
-
runtime.log?.(`[tlon] Retrying authentication in ${delay}ms...`);
|
|
2675
|
-
await sleepWithAbort(delay, opts.abortSignal);
|
|
2675
|
+
runtime.error?.(`[tlon] Failed to authenticate (attempt ${authAttempt}): ${formatErrorMessage(error)}`);
|
|
2676
|
+
throw error;
|
|
2676
2677
|
}
|
|
2677
|
-
}
|
|
2678
|
-
|
|
2678
|
+
}, {
|
|
2679
|
+
attempts: Math.max(1, maxAttempts),
|
|
2680
|
+
minDelayMs: 0,
|
|
2681
|
+
shouldRetry: () => !opts.abortSignal?.aborted,
|
|
2682
|
+
delayMs: ({ attempt }) => Math.min(3e4, 1e3 * 2 ** (attempt - 1)),
|
|
2683
|
+
onRetry: ({ delayMs }) => {
|
|
2684
|
+
runtime.log?.(`[tlon] Retrying authentication in ${delayMs}ms...`);
|
|
2685
|
+
},
|
|
2686
|
+
sleep: (delayMs) => sleepWithAbort(delayMs, opts.abortSignal)
|
|
2687
|
+
});
|
|
2679
2688
|
}
|
|
2680
2689
|
let api = null;
|
|
2681
2690
|
const cookie = await authenticateWithRetry();
|
|
@@ -2784,7 +2793,7 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2784
2793
|
let attachments = [];
|
|
2785
2794
|
let unavailableMediaCount = 0;
|
|
2786
2795
|
if (messageContent) try {
|
|
2787
|
-
({attachments, unavailableCount: unavailableMediaCount} = await downloadMessageImages(messageContent));
|
|
2796
|
+
({attachments, unavailableCount: unavailableMediaCount} = await downloadMessageImages(messageContent, void 0, account.mediaMaxBytes));
|
|
2788
2797
|
if (attachments.length > 0) runtime.log?.(`[tlon] Downloaded ${attachments.length} image(s) from message`);
|
|
2789
2798
|
} catch (error) {
|
|
2790
2799
|
runtime.log?.(`[tlon] Failed to download images: ${formatErrorMessage(error)}`);
|
|
@@ -2954,7 +2963,6 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2954
2963
|
}
|
|
2955
2964
|
});
|
|
2956
2965
|
const dispatchStartTime = Date.now();
|
|
2957
|
-
const responsePrefix = core.channel.reply.resolveEffectiveMessagesConfig(cfg, route.agentId).responsePrefix;
|
|
2958
2966
|
const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
|
|
2959
2967
|
const deliveryTarget = isGroup ? groupChannel : senderShip;
|
|
2960
2968
|
const prepareReplyPayload = (payload) => {
|
|
@@ -2988,6 +2996,7 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2988
2996
|
sessionKey: route.sessionKey
|
|
2989
2997
|
},
|
|
2990
2998
|
ctxPayload,
|
|
2999
|
+
replyPipeline: {},
|
|
2991
3000
|
delivery: {
|
|
2992
3001
|
preparePayload: prepareReplyPayload,
|
|
2993
3002
|
durable: deliveryTarget ? () => ({
|
|
@@ -3030,10 +3039,7 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3030
3039
|
runtime.error?.(`[tlon] ${info.kind} reply failed after ${dispatchDuration}ms: ${String(err)}`);
|
|
3031
3040
|
}
|
|
3032
3041
|
},
|
|
3033
|
-
dispatcherOptions: {
|
|
3034
|
-
responsePrefix,
|
|
3035
|
-
humanDelay
|
|
3036
|
-
},
|
|
3042
|
+
dispatcherOptions: { humanDelay },
|
|
3037
3043
|
...turnAdoptionLifecycle || promptMedia.media.length > 0 ? { replyOptions } : {},
|
|
3038
3044
|
record: { onRecordError: (err) => {
|
|
3039
3045
|
runtime.error?.(`[tlon] failed updating session meta: ${String(err)}`);
|
|
@@ -3241,25 +3247,9 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3241
3247
|
const ships = processedDmInvites.beginSnapshot(event.map((invite) => normalizeShip(invite.ship || "")).filter(Boolean));
|
|
3242
3248
|
for (const ship of ships) {
|
|
3243
3249
|
if (processedDmInvites.has(ship)) continue;
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
app: "chat",
|
|
3248
|
-
mark: "chat-dm-rsvp",
|
|
3249
|
-
json: {
|
|
3250
|
-
ship,
|
|
3251
|
-
ok: true
|
|
3252
|
-
}
|
|
3253
|
-
});
|
|
3254
|
-
processedDmInvites.add(ship);
|
|
3255
|
-
runtime.log?.(`[tlon] Auto-accepted DM invite from owner ${ship}`);
|
|
3256
|
-
} catch (err) {
|
|
3257
|
-
runtime.error?.(`[tlon] Failed to auto-accept DM from owner: ${String(err)}`);
|
|
3258
|
-
}
|
|
3259
|
-
continue;
|
|
3260
|
-
}
|
|
3261
|
-
const allowed = await isDmAllowedWithIngress(ship, effectiveDmAllowlist);
|
|
3262
|
-
if (effectiveAutoAcceptDmInvites && allowed) {
|
|
3250
|
+
const ownerInvite = isOwner(ship);
|
|
3251
|
+
const allowed = ownerInvite || await isDmAllowedWithIngress(ship, effectiveDmAllowlist);
|
|
3252
|
+
if (ownerInvite || effectiveAutoAcceptDmInvites && allowed) {
|
|
3263
3253
|
try {
|
|
3264
3254
|
await api.poke({
|
|
3265
3255
|
app: "chat",
|
|
@@ -3270,9 +3260,10 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3270
3260
|
}
|
|
3271
3261
|
});
|
|
3272
3262
|
processedDmInvites.add(ship);
|
|
3273
|
-
runtime.log?.(`[tlon] Auto-accepted DM invite from ${ship}`);
|
|
3263
|
+
runtime.log?.(ownerInvite ? `[tlon] Auto-accepted DM invite from owner ${ship}` : `[tlon] Auto-accepted DM invite from ${ship}`);
|
|
3274
3264
|
} catch (err) {
|
|
3275
|
-
runtime.error?.(`[tlon] Failed to auto-accept DM from ${ship}: ${String(err)}`);
|
|
3265
|
+
runtime.error?.(ownerInvite ? `[tlon] Failed to auto-accept DM from owner: ${String(err)}` : `[tlon] Failed to auto-accept DM from ${ship}: ${String(err)}`);
|
|
3266
|
+
throw err;
|
|
3276
3267
|
}
|
|
3277
3268
|
continue;
|
|
3278
3269
|
}
|
|
@@ -3495,74 +3486,41 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3495
3486
|
await api.subscribe({
|
|
3496
3487
|
app: "groups",
|
|
3497
3488
|
path: "/groups/ui",
|
|
3498
|
-
event: (event) => {
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
runtime.log?.(`[tlon] Auto-detected new channel (invite accepted): ${channelNest}`);
|
|
3509
|
-
if (effectiveAutoAcceptGroupInvites) try {
|
|
3510
|
-
const currentChannels = currentSettings.groupChannels || [];
|
|
3511
|
-
if (!currentChannels.includes(channelNest)) {
|
|
3512
|
-
const updatedChannels = [...currentChannels, channelNest];
|
|
3513
|
-
await api.poke({
|
|
3514
|
-
app: "settings",
|
|
3515
|
-
mark: "settings-event",
|
|
3516
|
-
json: { "put-entry": {
|
|
3517
|
-
"bucket-key": "tlon",
|
|
3518
|
-
"entry-key": "groupChannels",
|
|
3519
|
-
value: updatedChannels,
|
|
3520
|
-
desk: "moltbot"
|
|
3521
|
-
} }
|
|
3522
|
-
});
|
|
3523
|
-
runtime.log?.(`[tlon] Persisted ${channelNest} to settings store`);
|
|
3524
|
-
}
|
|
3525
|
-
} catch (err) {
|
|
3526
|
-
runtime.error?.(`[tlon] Failed to persist channel to settings: ${String(err)}`);
|
|
3527
|
-
}
|
|
3528
|
-
}
|
|
3529
|
-
}
|
|
3530
|
-
const join = asNullableRecord(eventRecord.join);
|
|
3531
|
-
if (join) {
|
|
3532
|
-
const joinChannels = Array.isArray(join.channels) ? join.channels : [];
|
|
3533
|
-
if (joinChannels.length > 0) for (const channelNest of joinChannels) {
|
|
3534
|
-
if (typeof channelNest !== "string") continue;
|
|
3535
|
-
if (!channelNest.startsWith("chat/")) continue;
|
|
3536
|
-
if (!watchedChannels.has(channelNest)) {
|
|
3537
|
-
watchedChannels.add(channelNest);
|
|
3538
|
-
runtime.log?.(`[tlon] Auto-detected joined channel: ${channelNest}`);
|
|
3539
|
-
if (effectiveAutoAcceptGroupInvites) try {
|
|
3540
|
-
const currentChannels = currentSettings.groupChannels || [];
|
|
3541
|
-
if (!currentChannels.includes(channelNest)) {
|
|
3542
|
-
const updatedChannels = [...currentChannels, channelNest];
|
|
3543
|
-
await api.poke({
|
|
3544
|
-
app: "settings",
|
|
3545
|
-
mark: "settings-event",
|
|
3546
|
-
json: { "put-entry": {
|
|
3547
|
-
"bucket-key": "tlon",
|
|
3548
|
-
"entry-key": "groupChannels",
|
|
3549
|
-
value: updatedChannels,
|
|
3550
|
-
desk: "moltbot"
|
|
3551
|
-
} }
|
|
3552
|
-
});
|
|
3553
|
-
runtime.log?.(`[tlon] Persisted ${channelNest} to settings store`);
|
|
3554
|
-
}
|
|
3555
|
-
} catch (err) {
|
|
3556
|
-
runtime.error?.(`[tlon] Failed to persist channel to settings: ${String(err)}`);
|
|
3557
|
-
}
|
|
3558
|
-
}
|
|
3559
|
-
}
|
|
3560
|
-
}
|
|
3561
|
-
}
|
|
3562
|
-
} catch (error) {
|
|
3563
|
-
runtime.error?.(`[tlon] Error handling groups-ui event: ${formatErrorMessage(error)}`);
|
|
3489
|
+
event: async (event) => {
|
|
3490
|
+
try {
|
|
3491
|
+
const eventRecord = asNullableRecord(event);
|
|
3492
|
+
if (!eventRecord) return;
|
|
3493
|
+
const join = asNullableRecord(eventRecord.join);
|
|
3494
|
+
const joinedChannels = Array.isArray(join?.channels) ? join.channels : [];
|
|
3495
|
+
const discoveredChannels = mergeUniqueStrings(Object.keys(asNullableRecord(eventRecord.channels) ?? {}), joinedChannels.filter((channel) => typeof channel === "string")).filter((channel) => channel.startsWith("chat/"));
|
|
3496
|
+
for (const channelNest of discoveredChannels) if (!watchedChannels.has(channelNest)) {
|
|
3497
|
+
watchedChannels.add(channelNest);
|
|
3498
|
+
runtime.log?.(`[tlon] Auto-detected new channel: ${channelNest}`);
|
|
3564
3499
|
}
|
|
3565
|
-
|
|
3500
|
+
if (!effectiveAutoAcceptGroupInvites) return;
|
|
3501
|
+
const currentChannels = currentSettings.groupChannels ?? [];
|
|
3502
|
+
const unpersistedChannels = discoveredChannels.filter((channel) => !currentChannels.includes(channel));
|
|
3503
|
+
if (unpersistedChannels.length === 0) return;
|
|
3504
|
+
const updatedChannels = mergeUniqueStrings(currentChannels, unpersistedChannels);
|
|
3505
|
+
await api.poke({
|
|
3506
|
+
app: "settings",
|
|
3507
|
+
mark: "settings-event",
|
|
3508
|
+
json: { "put-entry": {
|
|
3509
|
+
"bucket-key": "tlon",
|
|
3510
|
+
"entry-key": "groupChannels",
|
|
3511
|
+
value: updatedChannels,
|
|
3512
|
+
desk: "moltbot"
|
|
3513
|
+
} }
|
|
3514
|
+
});
|
|
3515
|
+
currentSettings = {
|
|
3516
|
+
...currentSettings,
|
|
3517
|
+
groupChannels: updatedChannels
|
|
3518
|
+
};
|
|
3519
|
+
runtime.log?.(`[tlon] Persisted ${unpersistedChannels.join(", ")} to settings store`);
|
|
3520
|
+
} catch (error) {
|
|
3521
|
+
runtime.error?.(`[tlon] Error handling groups-ui event: ${formatErrorMessage(error)}`);
|
|
3522
|
+
throw error;
|
|
3523
|
+
}
|
|
3566
3524
|
},
|
|
3567
3525
|
err: (error) => {
|
|
3568
3526
|
runtime.error?.(`[tlon] Groups-ui subscription error: ${String(error)}`);
|
|
@@ -3577,15 +3535,17 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3577
3535
|
}
|
|
3578
3536
|
{
|
|
3579
3537
|
const processedGroupInvites = /* @__PURE__ */ new Set();
|
|
3580
|
-
const processPendingInvites = async (foreigns) => {
|
|
3538
|
+
const processPendingInvites = async (foreigns, propagateWriteFailures = false) => {
|
|
3581
3539
|
if (!foreigns || typeof foreigns !== "object") return;
|
|
3540
|
+
let firstWriteError;
|
|
3582
3541
|
for (const [groupFlag, foreign] of Object.entries(foreigns)) {
|
|
3583
3542
|
if (processedGroupInvites.has(groupFlag)) continue;
|
|
3584
3543
|
if (!foreign.invites || foreign.invites.length === 0) continue;
|
|
3585
3544
|
const validInvite = foreign.invites.find((inv) => inv.valid);
|
|
3586
3545
|
if (!validInvite) continue;
|
|
3587
3546
|
const inviterShip = validInvite.from;
|
|
3588
|
-
|
|
3547
|
+
const ownerInvite = isOwner(inviterShip);
|
|
3548
|
+
if (ownerInvite || effectiveAutoAcceptGroupInvites && isGroupInviteAllowed(inviterShip, effectiveGroupInviteAllowlist)) {
|
|
3589
3549
|
try {
|
|
3590
3550
|
await api.poke({
|
|
3591
3551
|
app: "groups",
|
|
@@ -3596,68 +3556,46 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3596
3556
|
}
|
|
3597
3557
|
});
|
|
3598
3558
|
processedGroupInvites.add(groupFlag);
|
|
3599
|
-
runtime.log?.(`[tlon] Auto-accepted group invite from owner: ${groupFlag}`);
|
|
3559
|
+
runtime.log?.(ownerInvite ? `[tlon] Auto-accepted group invite from owner: ${groupFlag}` : `[tlon] Auto-accepted group invite: ${groupFlag} (from ${inviterShip})`);
|
|
3600
3560
|
} catch (err) {
|
|
3601
|
-
runtime.error?.(`[tlon] Failed to accept group invite from owner: ${String(err)}`);
|
|
3602
|
-
|
|
3603
|
-
continue;
|
|
3604
|
-
}
|
|
3605
|
-
if (!effectiveAutoAcceptGroupInvites) {
|
|
3606
|
-
if (effectiveOwnerShip) {
|
|
3607
|
-
const approval = createPendingApproval({
|
|
3608
|
-
type: "group",
|
|
3609
|
-
requestingShip: inviterShip,
|
|
3610
|
-
groupFlag
|
|
3611
|
-
});
|
|
3612
|
-
await queueApprovalRequest(approval);
|
|
3613
|
-
processedGroupInvites.add(groupFlag);
|
|
3561
|
+
runtime.error?.(ownerInvite ? `[tlon] Failed to accept group invite from owner: ${String(err)}` : `[tlon] Failed to auto-accept group ${groupFlag}: ${String(err)}`);
|
|
3562
|
+
if (propagateWriteFailures && firstWriteError === void 0) firstWriteError = err instanceof Error ? err : new Error(formatErrorMessage(err));
|
|
3614
3563
|
}
|
|
3615
3564
|
continue;
|
|
3616
3565
|
}
|
|
3617
|
-
if (
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
processedGroupInvites.add(groupFlag);
|
|
3626
|
-
} else {
|
|
3627
|
-
runtime.log?.(`[tlon] Rejected group invite from ${inviterShip} (not in groupInviteAllowlist): ${groupFlag}`);
|
|
3628
|
-
processedGroupInvites.add(groupFlag);
|
|
3629
|
-
}
|
|
3566
|
+
if (effectiveOwnerShip) {
|
|
3567
|
+
const approval = createPendingApproval({
|
|
3568
|
+
type: "group",
|
|
3569
|
+
requestingShip: inviterShip,
|
|
3570
|
+
groupFlag
|
|
3571
|
+
});
|
|
3572
|
+
await queueApprovalRequest(approval);
|
|
3573
|
+
processedGroupInvites.add(groupFlag);
|
|
3630
3574
|
continue;
|
|
3631
3575
|
}
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
app: "groups",
|
|
3635
|
-
mark: "group-join",
|
|
3636
|
-
json: {
|
|
3637
|
-
flag: groupFlag,
|
|
3638
|
-
"join-all": true
|
|
3639
|
-
}
|
|
3640
|
-
});
|
|
3576
|
+
if (effectiveAutoAcceptGroupInvites) {
|
|
3577
|
+
runtime.log?.(`[tlon] Rejected group invite from ${inviterShip} (not in groupInviteAllowlist): ${groupFlag}`);
|
|
3641
3578
|
processedGroupInvites.add(groupFlag);
|
|
3642
|
-
runtime.log?.(`[tlon] Auto-accepted group invite: ${groupFlag} (from ${validInvite.from})`);
|
|
3643
|
-
} catch (err) {
|
|
3644
|
-
runtime.error?.(`[tlon] Failed to auto-accept group ${groupFlag}: ${String(err)}`);
|
|
3645
3579
|
}
|
|
3646
3580
|
}
|
|
3581
|
+
if (firstWriteError !== void 0) throw firstWriteError;
|
|
3647
3582
|
};
|
|
3648
|
-
if (initForeigns)
|
|
3583
|
+
if (initForeigns) try {
|
|
3584
|
+
await processPendingInvites(initForeigns);
|
|
3585
|
+
} catch (error) {
|
|
3586
|
+
runtime.error?.(`[tlon] Error handling initial foreigns: ${formatErrorMessage(error)}`);
|
|
3587
|
+
}
|
|
3649
3588
|
try {
|
|
3650
3589
|
await api.subscribe({
|
|
3651
3590
|
app: "groups",
|
|
3652
3591
|
path: "/v1/foreigns",
|
|
3653
|
-
event: (data) => {
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
})();
|
|
3592
|
+
event: async (data) => {
|
|
3593
|
+
try {
|
|
3594
|
+
await processPendingInvites(data, true);
|
|
3595
|
+
} catch (error) {
|
|
3596
|
+
runtime.error?.(`[tlon] Error handling foreigns event: ${formatErrorMessage(error)}`);
|
|
3597
|
+
throw error;
|
|
3598
|
+
}
|
|
3661
3599
|
},
|
|
3662
3600
|
err: (error) => {
|
|
3663
3601
|
runtime.error?.(`[tlon] Foreigns subscription error: ${String(error)}`);
|
|
@@ -3948,24 +3886,23 @@ async function uploadFile(params) {
|
|
|
3948
3886
|
*/
|
|
3949
3887
|
/**
|
|
3950
3888
|
* Fetch an image from a URL and upload it to Tlon storage.
|
|
3951
|
-
*
|
|
3889
|
+
* Falls back to the original URL on error, but only after a bounded download when a cap is set.
|
|
3952
3890
|
*
|
|
3953
3891
|
* Note: configureClient must be called before using this function.
|
|
3954
3892
|
*/
|
|
3955
|
-
async function uploadImageFromUrl(imageUrl) {
|
|
3893
|
+
async function uploadImageFromUrl(imageUrl, maxBytes) {
|
|
3894
|
+
let sourceSizeVerified = false;
|
|
3956
3895
|
try {
|
|
3957
3896
|
const url = new URL(imageUrl);
|
|
3958
|
-
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
3959
|
-
console.warn(`[tlon] Rejected non-http(s) URL: ${imageUrl}`);
|
|
3960
|
-
return imageUrl;
|
|
3961
|
-
}
|
|
3897
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("Tlon image URL must use HTTP or HTTPS");
|
|
3962
3898
|
const fetched = await readRemoteMediaBuffer({
|
|
3963
3899
|
url: imageUrl,
|
|
3964
|
-
maxBytes: MAX_IMAGE_BYTES,
|
|
3900
|
+
maxBytes: Math.min(maxBytes ?? MAX_IMAGE_BYTES, MAX_IMAGE_BYTES),
|
|
3965
3901
|
...TLON_MEDIA_FETCH_TIMEOUTS,
|
|
3966
3902
|
ssrfPolicy: void 0,
|
|
3967
3903
|
requestInit: { method: "GET" }
|
|
3968
3904
|
});
|
|
3905
|
+
sourceSizeVerified = true;
|
|
3969
3906
|
const contentType = fetched.contentType || "image/png";
|
|
3970
3907
|
return (await uploadFile({
|
|
3971
3908
|
blob: new Blob([new Uint8Array(fetched.buffer)], { type: contentType }),
|
|
@@ -3973,6 +3910,7 @@ async function uploadImageFromUrl(imageUrl) {
|
|
|
3973
3910
|
contentType
|
|
3974
3911
|
})).url;
|
|
3975
3912
|
} catch (err) {
|
|
3913
|
+
if (maxBytes !== void 0 && !sourceSizeVerified) throw err;
|
|
3976
3914
|
console.warn(`[tlon] Failed to upload image, using original URL: ${String(err)}`);
|
|
3977
3915
|
return imageUrl;
|
|
3978
3916
|
}
|
|
@@ -4100,7 +4038,7 @@ const tlonRuntimeOutbound = {
|
|
|
4100
4038
|
getCode: async () => account.code,
|
|
4101
4039
|
dangerouslyAllowPrivateNetwork: account.dangerouslyAllowPrivateNetwork ?? void 0
|
|
4102
4040
|
});
|
|
4103
|
-
const uploadedUrl = mediaUrl ? await uploadImageFromUrl(mediaUrl) : void 0;
|
|
4041
|
+
const uploadedUrl = mediaUrl ? await uploadImageFromUrl(mediaUrl, account.mediaMaxBytes) : void 0;
|
|
4104
4042
|
return withHttpPokeAccountApi(account, async (api) => {
|
|
4105
4043
|
const fromShip = normalizeShip(account.ship);
|
|
4106
4044
|
const story = buildMediaStory(text, uploadedUrl);
|
package/dist/setup-api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as tlonSetupAdapter } from "./setup-core-
|
|
2
|
-
import { t as tlonSetupWizard } from "./setup-surface-
|
|
1
|
+
import { a as tlonSetupAdapter } from "./setup-core-CYiZjoTI.js";
|
|
2
|
+
import { t as tlonSetupWizard } from "./setup-surface-35N3bJMh.js";
|
|
3
3
|
export { tlonSetupAdapter, tlonSetupWizard };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hasLegacyFlatAllowPrivateNetworkAlias, isBlockedHostnameOrIp, isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
2
|
-
import { createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers";
|
|
2
|
+
import { createAccountListHelpers, resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
|
|
3
3
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
4
4
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
5
5
|
import { DEFAULT_ACCOUNT_ID, createSetupInputPresenceValidator, createSetupTranslator, formatDocsLink, normalizeAccountId, patchScopedAccountConfig, prepareScopedSetupConfig } from "openclaw/plugin-sdk/setup";
|
|
@@ -158,6 +158,11 @@ function resolveTlonAccount(cfg, accountId) {
|
|
|
158
158
|
name: merged.name ?? null,
|
|
159
159
|
enabled: merged.enabled !== false,
|
|
160
160
|
configured,
|
|
161
|
+
mediaMaxBytes: resolveChannelMediaMaxBytes({
|
|
162
|
+
cfg,
|
|
163
|
+
accountId: resolvedAccountId,
|
|
164
|
+
resolveChannelLimitMb: () => merged.mediaMaxMb
|
|
165
|
+
}),
|
|
161
166
|
ship,
|
|
162
167
|
url,
|
|
163
168
|
code,
|
|
@@ -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-
|
|
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";
|
|
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/openclaw.plugin.json
CHANGED
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"configWrites": {
|
|
35
35
|
"type": "boolean"
|
|
36
36
|
},
|
|
37
|
+
"mediaMaxMb": {
|
|
38
|
+
"type": "number",
|
|
39
|
+
"exclusiveMinimum": 0
|
|
40
|
+
},
|
|
37
41
|
"ship": {
|
|
38
42
|
"type": "string",
|
|
39
43
|
"minLength": 1
|
|
@@ -108,6 +112,11 @@
|
|
|
108
112
|
"type": "string",
|
|
109
113
|
"minLength": 1
|
|
110
114
|
},
|
|
115
|
+
"historyLimit": {
|
|
116
|
+
"type": "integer",
|
|
117
|
+
"minimum": 0,
|
|
118
|
+
"maximum": 9007199254740991
|
|
119
|
+
},
|
|
111
120
|
"authorization": {
|
|
112
121
|
"type": "object",
|
|
113
122
|
"properties": {
|
|
@@ -164,6 +173,10 @@
|
|
|
164
173
|
"configWrites": {
|
|
165
174
|
"type": "boolean"
|
|
166
175
|
},
|
|
176
|
+
"mediaMaxMb": {
|
|
177
|
+
"type": "number",
|
|
178
|
+
"exclusiveMinimum": 0
|
|
179
|
+
},
|
|
167
180
|
"ship": {
|
|
168
181
|
"type": "string",
|
|
169
182
|
"minLength": 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/tlon",
|
|
3
|
-
"version": "2026.8.1
|
|
3
|
+
"version": "2026.8.1",
|
|
4
4
|
"description": "OpenClaw Tlon/Urbit channel plugin for chat workflows.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@aws-sdk/client-s3": "3.
|
|
12
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
13
|
-
"@tloncorp/tlon-skill": "0.
|
|
11
|
+
"@aws-sdk/client-s3": "3.1116.0",
|
|
12
|
+
"@aws-sdk/s3-request-presigner": "3.1116.0",
|
|
13
|
+
"@tloncorp/tlon-skill": "0.5.0",
|
|
14
14
|
"@urbit/aura": "3.0.0",
|
|
15
15
|
"zod": "4.4.3"
|
|
16
16
|
},
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"openclaw": "workspace:*"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"openclaw": ">=2026.8.1
|
|
22
|
+
"openclaw": ">=2026.8.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependenciesMeta": {
|
|
25
25
|
"openclaw": {
|
|
@@ -120,10 +120,10 @@
|
|
|
120
120
|
"minHostVersion": ">=2026.4.10"
|
|
121
121
|
},
|
|
122
122
|
"compat": {
|
|
123
|
-
"pluginApi": ">=2026.8.1
|
|
123
|
+
"pluginApi": ">=2026.8.1"
|
|
124
124
|
},
|
|
125
125
|
"build": {
|
|
126
|
-
"openclawVersion": "2026.8.1
|
|
126
|
+
"openclawVersion": "2026.8.1"
|
|
127
127
|
},
|
|
128
128
|
"release": {
|
|
129
129
|
"bundleRuntimeDependencies": false,
|