@openclaw/tlon 2026.8.1-beta.3 → 2026.8.2
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-CoKm1n5s.js → channel-DNfdPgst.js} +7 -4
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-BShnsKnQ.js → channel.runtime-B9iTxLl0.js} +145 -208
- 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-DNfdPgst.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(),
|
|
@@ -40,12 +41,14 @@ const tlonCommonConfigFields = {
|
|
|
40
41
|
ownerShip: ShipSchema.optional()
|
|
41
42
|
};
|
|
42
43
|
const TlonAccountSchema = z.object({ ...tlonCommonConfigFields });
|
|
43
|
-
const
|
|
44
|
+
const TlonConfigSchema = 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()
|
|
48
|
-
})
|
|
50
|
+
});
|
|
51
|
+
const tlonChannelConfigSchema = buildChannelConfigSchema(TlonConfigSchema, { uiHints: createChannelConfigUiHints({
|
|
49
52
|
channelLabel: "Tlon",
|
|
50
53
|
implicitMentions: true
|
|
51
54
|
}) });
|
|
@@ -92,7 +95,7 @@ function resolveTlonOutboundSessionRoute(params) {
|
|
|
92
95
|
//#endregion
|
|
93
96
|
//#region extensions/tlon/src/channel.ts
|
|
94
97
|
const TLON_CHANNEL_ID = "tlon";
|
|
95
|
-
const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
98
|
+
const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-B9iTxLl0.js"));
|
|
96
99
|
const tlonSetupWizardProxy = createTlonSetupWizardBase({
|
|
97
100
|
resolveConfigured: async ({ cfg, accountId }) => await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveConfigured({
|
|
98
101
|
cfg,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as tlonPlugin } from "./channel-
|
|
1
|
+
import { t as tlonPlugin } from "./channel-DNfdPgst.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";
|
|
@@ -161,9 +161,7 @@ function applySettingsUpdate(current, key, value) {
|
|
|
161
161
|
case "ownerShip":
|
|
162
162
|
next.ownerShip = typeof value === "string" ? value : void 0;
|
|
163
163
|
break;
|
|
164
|
-
case "pendingApprovals":
|
|
165
|
-
next.pendingApprovals = parsePendingApprovals(value);
|
|
166
|
-
break;
|
|
164
|
+
case "pendingApprovals": next.pendingApprovals = parsePendingApprovals(value);
|
|
167
165
|
}
|
|
168
166
|
return next;
|
|
169
167
|
}
|
|
@@ -286,8 +284,9 @@ var UrbitAuthError = class extends UrbitError {
|
|
|
286
284
|
async function urbitFetch(params) {
|
|
287
285
|
const validated = validateUrbitBaseUrl(params.baseUrl);
|
|
288
286
|
if (!validated.ok) throw new UrbitUrlError(validated.error);
|
|
287
|
+
const url = new URL(params.path, validated.baseUrl).toString();
|
|
289
288
|
const guarded = await fetchWithSsrFGuard({
|
|
290
|
-
url
|
|
289
|
+
url,
|
|
291
290
|
fetchImpl: params.fetchImpl,
|
|
292
291
|
init: params.init,
|
|
293
292
|
timeoutMs: params.timeoutMs,
|
|
@@ -308,7 +307,7 @@ async function urbitFetch(params) {
|
|
|
308
307
|
}
|
|
309
308
|
//#endregion
|
|
310
309
|
//#region extensions/tlon/src/urbit/auth.ts
|
|
311
|
-
const MAX_AUTH_BODY_DRAIN_BYTES =
|
|
310
|
+
const MAX_AUTH_BODY_DRAIN_BYTES = 65536;
|
|
312
311
|
async function authenticate(url, code, options = {}) {
|
|
313
312
|
const { response, release } = await urbitFetch({
|
|
314
313
|
baseUrl: url,
|
|
@@ -888,7 +887,7 @@ async function putUrbitChannel(deps, params) {
|
|
|
888
887
|
auditContext: params.auditContext
|
|
889
888
|
});
|
|
890
889
|
}
|
|
891
|
-
const TLON_ERROR_BODY_LIMIT_BYTES =
|
|
890
|
+
const TLON_ERROR_BODY_LIMIT_BYTES = 16384;
|
|
892
891
|
async function pokeUrbitChannel(deps, params) {
|
|
893
892
|
const pokeId = Date.now();
|
|
894
893
|
const { response, release } = await putUrbitChannel(deps, {
|
|
@@ -982,7 +981,7 @@ async function ensureUrbitChannelOpen(deps, params) {
|
|
|
982
981
|
}
|
|
983
982
|
//#endregion
|
|
984
983
|
//#region extensions/tlon/src/urbit/sse-client.ts
|
|
985
|
-
const MAX_SSE_PAYLOAD_BYTES =
|
|
984
|
+
const MAX_SSE_PAYLOAD_BYTES = 16777216;
|
|
986
985
|
function parseUrbitSsePayload(data) {
|
|
987
986
|
if (Buffer.byteLength(data, "utf8") > MAX_SSE_PAYLOAD_BYTES) throw new Error("Tlon Urbit SSE payload exceeds 16 MiB limit");
|
|
988
987
|
try {
|
|
@@ -1078,7 +1077,7 @@ var UrbitSSEClient = class {
|
|
|
1078
1077
|
});
|
|
1079
1078
|
try {
|
|
1080
1079
|
if (!response.ok && response.status !== 204) {
|
|
1081
|
-
const errorText = await readResponseTextLimited(response,
|
|
1080
|
+
const errorText = await readResponseTextLimited(response, 16384).catch(() => "");
|
|
1082
1081
|
throw new Error(`Subscribe failed: ${response.status}${errorText ? ` - ${errorText}` : ""}`);
|
|
1083
1082
|
}
|
|
1084
1083
|
} finally {
|
|
@@ -1205,8 +1204,8 @@ var UrbitSSEClient = class {
|
|
|
1205
1204
|
let data = null;
|
|
1206
1205
|
let eventId = null;
|
|
1207
1206
|
for (const line of lines) {
|
|
1208
|
-
if (line.startsWith("id:
|
|
1209
|
-
if (line.startsWith("data:
|
|
1207
|
+
if (line.startsWith("id:")) eventId = parseUrbitSseEventId(line.slice(3).trim());
|
|
1208
|
+
if (line.startsWith("data:")) data = line.slice(5).trim();
|
|
1210
1209
|
}
|
|
1211
1210
|
if (!data) return;
|
|
1212
1211
|
let parsed;
|
|
@@ -1532,7 +1531,7 @@ function formatPendingList(approvals) {
|
|
|
1532
1531
|
//#region extensions/tlon/src/monitor/approval-runtime.ts
|
|
1533
1532
|
function createTlonApprovalRuntime(params) {
|
|
1534
1533
|
const { api, runtime, botShipName, getPendingApprovals, setPendingApprovals, getCurrentSettings, setCurrentSettings, getEffectiveDmAllowlist, setEffectiveDmAllowlist, getEffectiveOwnerShip, processApprovedMessage, refreshWatchedChannels } = params;
|
|
1535
|
-
const savePendingApprovals = async () => {
|
|
1534
|
+
const savePendingApprovals = async (required = false) => {
|
|
1536
1535
|
try {
|
|
1537
1536
|
await api.poke({
|
|
1538
1537
|
app: "settings",
|
|
@@ -1546,6 +1545,7 @@ function createTlonApprovalRuntime(params) {
|
|
|
1546
1545
|
});
|
|
1547
1546
|
} catch (err) {
|
|
1548
1547
|
runtime.error?.(`[tlon] Failed to save pending approvals: ${String(err)}`);
|
|
1548
|
+
if (required) throw err;
|
|
1549
1549
|
}
|
|
1550
1550
|
};
|
|
1551
1551
|
const addToDmAllowlist = async (ship) => {
|
|
@@ -1684,12 +1684,12 @@ function createTlonApprovalRuntime(params) {
|
|
|
1684
1684
|
existing.messagePreview = approval.messagePreview;
|
|
1685
1685
|
}
|
|
1686
1686
|
runtime.log?.(`[tlon] Updated existing approval for ${approval.requestingShip} (${approval.type}) - re-sending notification`);
|
|
1687
|
-
await savePendingApprovals();
|
|
1687
|
+
await savePendingApprovals(true);
|
|
1688
1688
|
await sendOwnerNotification(formatApprovalRequest(existing));
|
|
1689
1689
|
return;
|
|
1690
1690
|
}
|
|
1691
1691
|
setPendingApprovals([...approvals, approval]);
|
|
1692
|
-
await savePendingApprovals();
|
|
1692
|
+
await savePendingApprovals(true);
|
|
1693
1693
|
await sendOwnerNotification(formatApprovalRequest(approval));
|
|
1694
1694
|
runtime.log?.(`[tlon] Queued approval request: ${approval.id} (${approval.type} from ${approval.requestingShip})`);
|
|
1695
1695
|
};
|
|
@@ -1719,31 +1719,29 @@ function createTlonApprovalRuntime(params) {
|
|
|
1719
1719
|
}
|
|
1720
1720
|
}
|
|
1721
1721
|
break;
|
|
1722
|
-
case "group":
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1722
|
+
case "group": if (approval.groupFlag) try {
|
|
1723
|
+
await api.poke({
|
|
1724
|
+
app: "groups",
|
|
1725
|
+
mark: "group-join",
|
|
1726
|
+
json: {
|
|
1727
|
+
flag: approval.groupFlag,
|
|
1728
|
+
"join-all": true
|
|
1729
|
+
}
|
|
1730
|
+
});
|
|
1731
|
+
runtime.log?.(`[tlon] Joined group ${approval.groupFlag} after approval`);
|
|
1732
|
+
setTimeout(() => {
|
|
1733
|
+
(async () => {
|
|
1734
|
+
try {
|
|
1735
|
+
const newCount = await refreshWatchedChannels();
|
|
1736
|
+
if (newCount > 0) runtime.log?.(`[tlon] Discovered ${newCount} new channel(s) after joining group`);
|
|
1737
|
+
} catch (err) {
|
|
1738
|
+
runtime.log?.(`[tlon] Channel discovery after group join failed: ${String(err)}`);
|
|
1730
1739
|
}
|
|
1731
|
-
});
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
const newCount = await refreshWatchedChannels();
|
|
1737
|
-
if (newCount > 0) runtime.log?.(`[tlon] Discovered ${newCount} new channel(s) after joining group`);
|
|
1738
|
-
} catch (err) {
|
|
1739
|
-
runtime.log?.(`[tlon] Channel discovery after group join failed: ${String(err)}`);
|
|
1740
|
-
}
|
|
1741
|
-
})();
|
|
1742
|
-
}, 2e3);
|
|
1743
|
-
} catch (err) {
|
|
1744
|
-
runtime.error?.(`[tlon] Failed to join group ${approval.groupFlag}: ${String(err)}`);
|
|
1745
|
-
}
|
|
1746
|
-
break;
|
|
1740
|
+
})();
|
|
1741
|
+
}, 2e3);
|
|
1742
|
+
} catch (err) {
|
|
1743
|
+
runtime.error?.(`[tlon] Failed to join group ${approval.groupFlag}: ${String(err)}`);
|
|
1744
|
+
}
|
|
1747
1745
|
}
|
|
1748
1746
|
await sendOwnerNotification(formatApprovalConfirmation(approval, "approve"));
|
|
1749
1747
|
} else if (parsed.action === "block") {
|
|
@@ -2075,7 +2073,8 @@ function createTlonCitationResolver(params) {
|
|
|
2075
2073
|
try {
|
|
2076
2074
|
const scryPath = `/channels/v4/${cite.nest}/posts/post/${cite.postId}.json`;
|
|
2077
2075
|
runtime.log?.(`[tlon] Fetching cited post: ${scryPath}`);
|
|
2078
|
-
const
|
|
2076
|
+
const data = asNullableRecord(await api.scry(scryPath));
|
|
2077
|
+
const essay = asNullableRecord(data?.essay);
|
|
2079
2078
|
if (essay?.content) return extractMessageText(essay.content) || null;
|
|
2080
2079
|
return null;
|
|
2081
2080
|
} catch (err) {
|
|
@@ -2111,7 +2110,8 @@ async function fetchInitData(api, runtime) {
|
|
|
2111
2110
|
const channels = [];
|
|
2112
2111
|
const groups = asNullableRecord(initData?.groups);
|
|
2113
2112
|
if (groups) for (const groupData of Object.values(groups)) {
|
|
2114
|
-
const
|
|
2113
|
+
const typedGroupData = asNullableRecord(groupData);
|
|
2114
|
+
const groupChannels = asNullableRecord(typedGroupData?.channels);
|
|
2115
2115
|
if (groupChannels) {
|
|
2116
2116
|
for (const channelNest of Object.keys(groupChannels)) if (channelNest.startsWith("chat/")) channels.push(channelNest);
|
|
2117
2117
|
}
|
|
@@ -2186,7 +2186,8 @@ async function fetchChannelHistory(api, channelNest, count = 50, runtime) {
|
|
|
2186
2186
|
}
|
|
2187
2187
|
const messages = posts.map((item) => {
|
|
2188
2188
|
const itemRecord = asNullableRecord(item);
|
|
2189
|
-
const
|
|
2189
|
+
const replyPost = asNullableRecord(itemRecord?.["r-post"]);
|
|
2190
|
+
const replyPostSet = asNullableRecord(replyPost?.set);
|
|
2190
2191
|
const essay = asNullableRecord(itemRecord?.essay) ?? asNullableRecord(replyPostSet?.essay);
|
|
2191
2192
|
const seal = asNullableRecord(itemRecord?.seal) ?? asNullableRecord(replyPostSet?.seal);
|
|
2192
2193
|
return {
|
|
@@ -2238,7 +2239,8 @@ async function fetchThreadHistory(api, channelNest, parentId, count = 50, runtim
|
|
|
2238
2239
|
}
|
|
2239
2240
|
const messages = replies.map((item) => {
|
|
2240
2241
|
const itemRecord = asNullableRecord(item);
|
|
2241
|
-
const
|
|
2242
|
+
const replyRecord = asNullableRecord(itemRecord?.["r-reply"]);
|
|
2243
|
+
const replySet = asNullableRecord(replyRecord?.set);
|
|
2242
2244
|
return createHistoryEntryFromMemo({
|
|
2243
2245
|
memo: asNullableRecord(itemRecord?.memo) ?? asNullableRecord(replySet?.memo) ?? itemRecord,
|
|
2244
2246
|
seal: asNullableRecord(itemRecord?.seal) ?? asNullableRecord(replySet?.seal),
|
|
@@ -2253,7 +2255,8 @@ async function fetchThreadHistory(api, channelNest, parentId, count = 50, runtim
|
|
|
2253
2255
|
const altPath = `/channels/v4/${channelNest}/posts/post/id/${formatUd(parentId)}.json`;
|
|
2254
2256
|
runtime?.log?.(`[tlon] Trying alternate path: ${altPath}`);
|
|
2255
2257
|
const data = asNullableRecord(await api.scry(altPath));
|
|
2256
|
-
const
|
|
2258
|
+
const dataSeal = asNullableRecord(data?.seal);
|
|
2259
|
+
const dataMeta = asNullableRecord(dataSeal?.meta);
|
|
2257
2260
|
const repliesValue = data?.replies;
|
|
2258
2261
|
if (typeof dataMeta?.replyCount === "number" && dataMeta.replyCount > 0 && repliesValue) {
|
|
2259
2262
|
const messages = (Array.isArray(repliesValue) ? repliesValue : Object.values(repliesValue)).map((reply) => {
|
|
@@ -2441,7 +2444,7 @@ function extractImageBlocks(content) {
|
|
|
2441
2444
|
* Download a media file from URL to local storage.
|
|
2442
2445
|
* Returns the local path where the file was saved.
|
|
2443
2446
|
*/
|
|
2444
|
-
async function downloadMedia(url, mediaDir) {
|
|
2447
|
+
async function downloadMedia(url, mediaDir, maxBytes) {
|
|
2445
2448
|
try {
|
|
2446
2449
|
const parsedUrl = new URL(url);
|
|
2447
2450
|
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
|
|
@@ -2450,7 +2453,7 @@ async function downloadMedia(url, mediaDir) {
|
|
|
2450
2453
|
}
|
|
2451
2454
|
const fetchOptions = {
|
|
2452
2455
|
url,
|
|
2453
|
-
maxBytes: MAX_IMAGE_BYTES,
|
|
2456
|
+
maxBytes: Math.min(maxBytes ?? MAX_IMAGE_BYTES, MAX_IMAGE_BYTES),
|
|
2454
2457
|
...TLON_MEDIA_FETCH_TIMEOUTS,
|
|
2455
2458
|
ssrfPolicy: void 0,
|
|
2456
2459
|
requestInit: { method: "GET" }
|
|
@@ -2495,12 +2498,12 @@ function getExtensionFromUrl(url) {
|
|
|
2495
2498
|
* Download all images from a message and return attachment metadata.
|
|
2496
2499
|
* Format matches OpenClaw's expected attachment structure.
|
|
2497
2500
|
*/
|
|
2498
|
-
async function downloadMessageImages(content, mediaDir) {
|
|
2501
|
+
async function downloadMessageImages(content, mediaDir, maxBytes) {
|
|
2499
2502
|
const { images, unavailableCount: overCapCount } = extractImageBlocks(content);
|
|
2500
2503
|
const attachments = [];
|
|
2501
2504
|
let unavailableCount = overCapCount;
|
|
2502
2505
|
for (const image of images) {
|
|
2503
|
-
const downloaded = await downloadMedia(image.url, mediaDir);
|
|
2506
|
+
const downloaded = await downloadMedia(image.url, mediaDir, maxBytes);
|
|
2504
2507
|
if (downloaded) attachments.push({
|
|
2505
2508
|
path: downloaded.localPath,
|
|
2506
2509
|
contentType: downloaded.contentType
|
|
@@ -2782,7 +2785,8 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2782
2785
|
* Returns empty string if whom doesn't contain a valid patp-like value.
|
|
2783
2786
|
*/
|
|
2784
2787
|
function extractDmPartnerShip(whom) {
|
|
2785
|
-
const
|
|
2788
|
+
const raw = typeof whom === "string" ? whom : whom && typeof whom === "object" && "ship" in whom && typeof whom.ship === "string" ? whom.ship : "";
|
|
2789
|
+
const normalized = normalizeShip(raw);
|
|
2786
2790
|
return /^~?[a-z-]+$/i.test(normalized) ? normalized : "";
|
|
2787
2791
|
}
|
|
2788
2792
|
const processMessage = async (params) => {
|
|
@@ -2792,7 +2796,7 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2792
2796
|
let attachments = [];
|
|
2793
2797
|
let unavailableMediaCount = 0;
|
|
2794
2798
|
if (messageContent) try {
|
|
2795
|
-
({attachments, unavailableCount: unavailableMediaCount} = await downloadMessageImages(messageContent));
|
|
2799
|
+
({attachments, unavailableCount: unavailableMediaCount} = await downloadMessageImages(messageContent, void 0, account.mediaMaxBytes));
|
|
2796
2800
|
if (attachments.length > 0) runtime.log?.(`[tlon] Downloaded ${attachments.length} image(s) from message`);
|
|
2797
2801
|
} catch (error) {
|
|
2798
2802
|
runtime.log?.(`[tlon] Failed to download images: ${formatErrorMessage(error)}`);
|
|
@@ -2962,7 +2966,6 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2962
2966
|
}
|
|
2963
2967
|
});
|
|
2964
2968
|
const dispatchStartTime = Date.now();
|
|
2965
|
-
const responsePrefix = core.channel.reply.resolveEffectiveMessagesConfig(cfg, route.agentId).responsePrefix;
|
|
2966
2969
|
const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
|
|
2967
2970
|
const deliveryTarget = isGroup ? groupChannel : senderShip;
|
|
2968
2971
|
const prepareReplyPayload = (payload) => {
|
|
@@ -2996,6 +2999,7 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
2996
2999
|
sessionKey: route.sessionKey
|
|
2997
3000
|
},
|
|
2998
3001
|
ctxPayload,
|
|
3002
|
+
replyPipeline: {},
|
|
2999
3003
|
delivery: {
|
|
3000
3004
|
preparePayload: prepareReplyPayload,
|
|
3001
3005
|
durable: deliveryTarget ? () => ({
|
|
@@ -3038,10 +3042,7 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3038
3042
|
runtime.error?.(`[tlon] ${info.kind} reply failed after ${dispatchDuration}ms: ${String(err)}`);
|
|
3039
3043
|
}
|
|
3040
3044
|
},
|
|
3041
|
-
dispatcherOptions: {
|
|
3042
|
-
responsePrefix,
|
|
3043
|
-
humanDelay
|
|
3044
|
-
},
|
|
3045
|
+
dispatcherOptions: { humanDelay },
|
|
3045
3046
|
...turnAdoptionLifecycle || promptMedia.media.length > 0 ? { replyOptions } : {},
|
|
3046
3047
|
record: { onRecordError: (err) => {
|
|
3047
3048
|
runtime.error?.(`[tlon] failed updating session meta: ${String(err)}`);
|
|
@@ -3148,7 +3149,8 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3148
3149
|
const rPost = asNullableRecord(post?.["r-post"]);
|
|
3149
3150
|
const set = asNullableRecord(rPost?.set);
|
|
3150
3151
|
const reply = asNullableRecord(rPost?.reply);
|
|
3151
|
-
const
|
|
3152
|
+
const replyPayload = asNullableRecord(reply?.["r-reply"]);
|
|
3153
|
+
const replySet = asNullableRecord(replyPayload?.set);
|
|
3152
3154
|
const essay = asNullableRecord(set?.essay);
|
|
3153
3155
|
const memo = asNullableRecord(replySet?.memo);
|
|
3154
3156
|
if (!essay && !memo) return;
|
|
@@ -3249,7 +3251,9 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3249
3251
|
const ships = processedDmInvites.beginSnapshot(event.map((invite) => normalizeShip(invite.ship || "")).filter(Boolean));
|
|
3250
3252
|
for (const ship of ships) {
|
|
3251
3253
|
if (processedDmInvites.has(ship)) continue;
|
|
3252
|
-
|
|
3254
|
+
const ownerInvite = isOwner(ship);
|
|
3255
|
+
const allowed = ownerInvite || await isDmAllowedWithIngress(ship, effectiveDmAllowlist);
|
|
3256
|
+
if (ownerInvite || effectiveAutoAcceptDmInvites && allowed) {
|
|
3253
3257
|
try {
|
|
3254
3258
|
await api.poke({
|
|
3255
3259
|
app: "chat",
|
|
@@ -3260,27 +3264,10 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3260
3264
|
}
|
|
3261
3265
|
});
|
|
3262
3266
|
processedDmInvites.add(ship);
|
|
3263
|
-
runtime.log?.(`[tlon] Auto-accepted DM invite from owner ${ship}`);
|
|
3267
|
+
runtime.log?.(ownerInvite ? `[tlon] Auto-accepted DM invite from owner ${ship}` : `[tlon] Auto-accepted DM invite from ${ship}`);
|
|
3264
3268
|
} catch (err) {
|
|
3265
|
-
runtime.error?.(`[tlon] Failed to auto-accept DM from owner: ${String(err)}`);
|
|
3266
|
-
|
|
3267
|
-
continue;
|
|
3268
|
-
}
|
|
3269
|
-
const allowed = await isDmAllowedWithIngress(ship, effectiveDmAllowlist);
|
|
3270
|
-
if (effectiveAutoAcceptDmInvites && allowed) {
|
|
3271
|
-
try {
|
|
3272
|
-
await api.poke({
|
|
3273
|
-
app: "chat",
|
|
3274
|
-
mark: "chat-dm-rsvp",
|
|
3275
|
-
json: {
|
|
3276
|
-
ship,
|
|
3277
|
-
ok: true
|
|
3278
|
-
}
|
|
3279
|
-
});
|
|
3280
|
-
processedDmInvites.add(ship);
|
|
3281
|
-
runtime.log?.(`[tlon] Auto-accepted DM invite from ${ship}`);
|
|
3282
|
-
} catch (err) {
|
|
3283
|
-
runtime.error?.(`[tlon] Failed to auto-accept DM from ${ship}: ${String(err)}`);
|
|
3269
|
+
runtime.error?.(ownerInvite ? `[tlon] Failed to auto-accept DM from owner: ${String(err)}` : `[tlon] Failed to auto-accept DM from ${ship}: ${String(err)}`);
|
|
3270
|
+
throw err;
|
|
3284
3271
|
}
|
|
3285
3272
|
continue;
|
|
3286
3273
|
}
|
|
@@ -3458,7 +3445,9 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3458
3445
|
try {
|
|
3459
3446
|
const eventRecord = asNullableRecord(event);
|
|
3460
3447
|
if (eventRecord?.self) {
|
|
3461
|
-
const
|
|
3448
|
+
const selfUpdate = asNullableRecord(eventRecord.self);
|
|
3449
|
+
const contact = asNullableRecord(selfUpdate?.contact);
|
|
3450
|
+
const nickname = asNullableRecord(contact?.nickname);
|
|
3462
3451
|
if (nickname && "value" in nickname) {
|
|
3463
3452
|
const newNickname = readStringField(nickname, "value") ?? null;
|
|
3464
3453
|
if (newNickname !== botNickname) {
|
|
@@ -3503,74 +3492,41 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3503
3492
|
await api.subscribe({
|
|
3504
3493
|
app: "groups",
|
|
3505
3494
|
path: "/groups/ui",
|
|
3506
|
-
event: (event) => {
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
runtime.log?.(`[tlon] Auto-detected new channel (invite accepted): ${channelNest}`);
|
|
3517
|
-
if (effectiveAutoAcceptGroupInvites) try {
|
|
3518
|
-
const currentChannels = currentSettings.groupChannels || [];
|
|
3519
|
-
if (!currentChannels.includes(channelNest)) {
|
|
3520
|
-
const updatedChannels = [...currentChannels, channelNest];
|
|
3521
|
-
await api.poke({
|
|
3522
|
-
app: "settings",
|
|
3523
|
-
mark: "settings-event",
|
|
3524
|
-
json: { "put-entry": {
|
|
3525
|
-
"bucket-key": "tlon",
|
|
3526
|
-
"entry-key": "groupChannels",
|
|
3527
|
-
value: updatedChannels,
|
|
3528
|
-
desk: "moltbot"
|
|
3529
|
-
} }
|
|
3530
|
-
});
|
|
3531
|
-
runtime.log?.(`[tlon] Persisted ${channelNest} to settings store`);
|
|
3532
|
-
}
|
|
3533
|
-
} catch (err) {
|
|
3534
|
-
runtime.error?.(`[tlon] Failed to persist channel to settings: ${String(err)}`);
|
|
3535
|
-
}
|
|
3536
|
-
}
|
|
3537
|
-
}
|
|
3538
|
-
const join = asNullableRecord(eventRecord.join);
|
|
3539
|
-
if (join) {
|
|
3540
|
-
const joinChannels = Array.isArray(join.channels) ? join.channels : [];
|
|
3541
|
-
if (joinChannels.length > 0) for (const channelNest of joinChannels) {
|
|
3542
|
-
if (typeof channelNest !== "string") continue;
|
|
3543
|
-
if (!channelNest.startsWith("chat/")) continue;
|
|
3544
|
-
if (!watchedChannels.has(channelNest)) {
|
|
3545
|
-
watchedChannels.add(channelNest);
|
|
3546
|
-
runtime.log?.(`[tlon] Auto-detected joined channel: ${channelNest}`);
|
|
3547
|
-
if (effectiveAutoAcceptGroupInvites) try {
|
|
3548
|
-
const currentChannels = currentSettings.groupChannels || [];
|
|
3549
|
-
if (!currentChannels.includes(channelNest)) {
|
|
3550
|
-
const updatedChannels = [...currentChannels, channelNest];
|
|
3551
|
-
await api.poke({
|
|
3552
|
-
app: "settings",
|
|
3553
|
-
mark: "settings-event",
|
|
3554
|
-
json: { "put-entry": {
|
|
3555
|
-
"bucket-key": "tlon",
|
|
3556
|
-
"entry-key": "groupChannels",
|
|
3557
|
-
value: updatedChannels,
|
|
3558
|
-
desk: "moltbot"
|
|
3559
|
-
} }
|
|
3560
|
-
});
|
|
3561
|
-
runtime.log?.(`[tlon] Persisted ${channelNest} to settings store`);
|
|
3562
|
-
}
|
|
3563
|
-
} catch (err) {
|
|
3564
|
-
runtime.error?.(`[tlon] Failed to persist channel to settings: ${String(err)}`);
|
|
3565
|
-
}
|
|
3566
|
-
}
|
|
3567
|
-
}
|
|
3568
|
-
}
|
|
3569
|
-
}
|
|
3570
|
-
} catch (error) {
|
|
3571
|
-
runtime.error?.(`[tlon] Error handling groups-ui event: ${formatErrorMessage(error)}`);
|
|
3495
|
+
event: async (event) => {
|
|
3496
|
+
try {
|
|
3497
|
+
const eventRecord = asNullableRecord(event);
|
|
3498
|
+
if (!eventRecord) return;
|
|
3499
|
+
const join = asNullableRecord(eventRecord.join);
|
|
3500
|
+
const joinedChannels = Array.isArray(join?.channels) ? join.channels : [];
|
|
3501
|
+
const discoveredChannels = mergeUniqueStrings(Object.keys(asNullableRecord(eventRecord.channels) ?? {}), joinedChannels.filter((channel) => typeof channel === "string")).filter((channel) => channel.startsWith("chat/"));
|
|
3502
|
+
for (const channelNest of discoveredChannels) if (!watchedChannels.has(channelNest)) {
|
|
3503
|
+
watchedChannels.add(channelNest);
|
|
3504
|
+
runtime.log?.(`[tlon] Auto-detected new channel: ${channelNest}`);
|
|
3572
3505
|
}
|
|
3573
|
-
|
|
3506
|
+
if (!effectiveAutoAcceptGroupInvites) return;
|
|
3507
|
+
const currentChannels = currentSettings.groupChannels ?? [];
|
|
3508
|
+
const unpersistedChannels = discoveredChannels.filter((channel) => !currentChannels.includes(channel));
|
|
3509
|
+
if (unpersistedChannels.length === 0) return;
|
|
3510
|
+
const updatedChannels = mergeUniqueStrings(currentChannels, unpersistedChannels);
|
|
3511
|
+
await api.poke({
|
|
3512
|
+
app: "settings",
|
|
3513
|
+
mark: "settings-event",
|
|
3514
|
+
json: { "put-entry": {
|
|
3515
|
+
"bucket-key": "tlon",
|
|
3516
|
+
"entry-key": "groupChannels",
|
|
3517
|
+
value: updatedChannels,
|
|
3518
|
+
desk: "moltbot"
|
|
3519
|
+
} }
|
|
3520
|
+
});
|
|
3521
|
+
currentSettings = {
|
|
3522
|
+
...currentSettings,
|
|
3523
|
+
groupChannels: updatedChannels
|
|
3524
|
+
};
|
|
3525
|
+
runtime.log?.(`[tlon] Persisted ${unpersistedChannels.join(", ")} to settings store`);
|
|
3526
|
+
} catch (error) {
|
|
3527
|
+
runtime.error?.(`[tlon] Error handling groups-ui event: ${formatErrorMessage(error)}`);
|
|
3528
|
+
throw error;
|
|
3529
|
+
}
|
|
3574
3530
|
},
|
|
3575
3531
|
err: (error) => {
|
|
3576
3532
|
runtime.error?.(`[tlon] Groups-ui subscription error: ${String(error)}`);
|
|
@@ -3585,15 +3541,17 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3585
3541
|
}
|
|
3586
3542
|
{
|
|
3587
3543
|
const processedGroupInvites = /* @__PURE__ */ new Set();
|
|
3588
|
-
const processPendingInvites = async (foreigns) => {
|
|
3544
|
+
const processPendingInvites = async (foreigns, propagateWriteFailures = false) => {
|
|
3589
3545
|
if (!foreigns || typeof foreigns !== "object") return;
|
|
3546
|
+
let firstWriteError;
|
|
3590
3547
|
for (const [groupFlag, foreign] of Object.entries(foreigns)) {
|
|
3591
3548
|
if (processedGroupInvites.has(groupFlag)) continue;
|
|
3592
3549
|
if (!foreign.invites || foreign.invites.length === 0) continue;
|
|
3593
3550
|
const validInvite = foreign.invites.find((inv) => inv.valid);
|
|
3594
3551
|
if (!validInvite) continue;
|
|
3595
3552
|
const inviterShip = validInvite.from;
|
|
3596
|
-
|
|
3553
|
+
const ownerInvite = isOwner(inviterShip);
|
|
3554
|
+
if (ownerInvite || effectiveAutoAcceptGroupInvites && isGroupInviteAllowed(inviterShip, effectiveGroupInviteAllowlist)) {
|
|
3597
3555
|
try {
|
|
3598
3556
|
await api.poke({
|
|
3599
3557
|
app: "groups",
|
|
@@ -3604,68 +3562,46 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3604
3562
|
}
|
|
3605
3563
|
});
|
|
3606
3564
|
processedGroupInvites.add(groupFlag);
|
|
3607
|
-
runtime.log?.(`[tlon] Auto-accepted group invite from owner: ${groupFlag}`);
|
|
3565
|
+
runtime.log?.(ownerInvite ? `[tlon] Auto-accepted group invite from owner: ${groupFlag}` : `[tlon] Auto-accepted group invite: ${groupFlag} (from ${inviterShip})`);
|
|
3608
3566
|
} catch (err) {
|
|
3609
|
-
runtime.error?.(`[tlon] Failed to accept group invite from owner: ${String(err)}`);
|
|
3610
|
-
|
|
3611
|
-
continue;
|
|
3612
|
-
}
|
|
3613
|
-
if (!effectiveAutoAcceptGroupInvites) {
|
|
3614
|
-
if (effectiveOwnerShip) {
|
|
3615
|
-
const approval = createPendingApproval({
|
|
3616
|
-
type: "group",
|
|
3617
|
-
requestingShip: inviterShip,
|
|
3618
|
-
groupFlag
|
|
3619
|
-
});
|
|
3620
|
-
await queueApprovalRequest(approval);
|
|
3621
|
-
processedGroupInvites.add(groupFlag);
|
|
3567
|
+
runtime.error?.(ownerInvite ? `[tlon] Failed to accept group invite from owner: ${String(err)}` : `[tlon] Failed to auto-accept group ${groupFlag}: ${String(err)}`);
|
|
3568
|
+
if (propagateWriteFailures && firstWriteError === void 0) firstWriteError = err instanceof Error ? err : new Error(formatErrorMessage(err));
|
|
3622
3569
|
}
|
|
3623
3570
|
continue;
|
|
3624
3571
|
}
|
|
3625
|
-
if (
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
processedGroupInvites.add(groupFlag);
|
|
3634
|
-
} else {
|
|
3635
|
-
runtime.log?.(`[tlon] Rejected group invite from ${inviterShip} (not in groupInviteAllowlist): ${groupFlag}`);
|
|
3636
|
-
processedGroupInvites.add(groupFlag);
|
|
3637
|
-
}
|
|
3572
|
+
if (effectiveOwnerShip) {
|
|
3573
|
+
const approval = createPendingApproval({
|
|
3574
|
+
type: "group",
|
|
3575
|
+
requestingShip: inviterShip,
|
|
3576
|
+
groupFlag
|
|
3577
|
+
});
|
|
3578
|
+
await queueApprovalRequest(approval);
|
|
3579
|
+
processedGroupInvites.add(groupFlag);
|
|
3638
3580
|
continue;
|
|
3639
3581
|
}
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
app: "groups",
|
|
3643
|
-
mark: "group-join",
|
|
3644
|
-
json: {
|
|
3645
|
-
flag: groupFlag,
|
|
3646
|
-
"join-all": true
|
|
3647
|
-
}
|
|
3648
|
-
});
|
|
3582
|
+
if (effectiveAutoAcceptGroupInvites) {
|
|
3583
|
+
runtime.log?.(`[tlon] Rejected group invite from ${inviterShip} (not in groupInviteAllowlist): ${groupFlag}`);
|
|
3649
3584
|
processedGroupInvites.add(groupFlag);
|
|
3650
|
-
runtime.log?.(`[tlon] Auto-accepted group invite: ${groupFlag} (from ${validInvite.from})`);
|
|
3651
|
-
} catch (err) {
|
|
3652
|
-
runtime.error?.(`[tlon] Failed to auto-accept group ${groupFlag}: ${String(err)}`);
|
|
3653
3585
|
}
|
|
3654
3586
|
}
|
|
3587
|
+
if (firstWriteError !== void 0) throw firstWriteError;
|
|
3655
3588
|
};
|
|
3656
|
-
if (initForeigns)
|
|
3589
|
+
if (initForeigns) try {
|
|
3590
|
+
await processPendingInvites(initForeigns);
|
|
3591
|
+
} catch (error) {
|
|
3592
|
+
runtime.error?.(`[tlon] Error handling initial foreigns: ${formatErrorMessage(error)}`);
|
|
3593
|
+
}
|
|
3657
3594
|
try {
|
|
3658
3595
|
await api.subscribe({
|
|
3659
3596
|
app: "groups",
|
|
3660
3597
|
path: "/v1/foreigns",
|
|
3661
|
-
event: (data) => {
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
})();
|
|
3598
|
+
event: async (data) => {
|
|
3599
|
+
try {
|
|
3600
|
+
await processPendingInvites(data, true);
|
|
3601
|
+
} catch (error) {
|
|
3602
|
+
runtime.error?.(`[tlon] Error handling foreigns event: ${formatErrorMessage(error)}`);
|
|
3603
|
+
throw error;
|
|
3604
|
+
}
|
|
3669
3605
|
},
|
|
3670
3606
|
err: (error) => {
|
|
3671
3607
|
runtime.error?.(`[tlon] Foreigns subscription error: ${String(error)}`);
|
|
@@ -3703,7 +3639,7 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3703
3639
|
runtime.error?.(`[tlon] Channel refresh error: ${formatErrorMessage(error)}`);
|
|
3704
3640
|
}
|
|
3705
3641
|
})();
|
|
3706
|
-
},
|
|
3642
|
+
}, 12e4);
|
|
3707
3643
|
await waitUntilAbort(opts.abortSignal, () => {
|
|
3708
3644
|
clearInterval(pollInterval);
|
|
3709
3645
|
});
|
|
@@ -3721,7 +3657,7 @@ async function monitorTlonProvider(opts = {}) {
|
|
|
3721
3657
|
//#region extensions/tlon/src/tlon-api.ts
|
|
3722
3658
|
const MEMEX_BASE_URL = "https://memex.tlon.network";
|
|
3723
3659
|
/** Max bytes to read from the Memex upload JSON response. */
|
|
3724
|
-
const MEMEX_UPLOAD_RESPONSE_MAX_BYTES =
|
|
3660
|
+
const MEMEX_UPLOAD_RESPONSE_MAX_BYTES = 65536;
|
|
3725
3661
|
/** Total deadline for the Memex upload URL lookup, including DNS and response reading. */
|
|
3726
3662
|
const TLON_MEMEX_UPLOAD_URL_TIMEOUT_MS = 3e4;
|
|
3727
3663
|
/** Total deadline for Memex and custom S3 PUTs, including DNS and the full upload. */
|
|
@@ -3921,13 +3857,14 @@ async function uploadFile(params) {
|
|
|
3921
3857
|
"Content-Type": contentType,
|
|
3922
3858
|
"x-amz-acl": "public-read"
|
|
3923
3859
|
};
|
|
3924
|
-
const
|
|
3860
|
+
const command = new PutObjectCommand({
|
|
3925
3861
|
Bucket: storageConfig.currentBucket,
|
|
3926
3862
|
Key: fileKey,
|
|
3927
3863
|
ContentType: headers["Content-Type"],
|
|
3928
3864
|
CacheControl: headers["Cache-Control"],
|
|
3929
3865
|
ACL: "public-read"
|
|
3930
|
-
})
|
|
3866
|
+
});
|
|
3867
|
+
const signedUrl = await getSignedUrl(client, command, { expiresIn: 3600 });
|
|
3931
3868
|
let guarded;
|
|
3932
3869
|
try {
|
|
3933
3870
|
guarded = await fetchWithSsrFGuard({
|
|
@@ -3956,24 +3893,23 @@ async function uploadFile(params) {
|
|
|
3956
3893
|
*/
|
|
3957
3894
|
/**
|
|
3958
3895
|
* Fetch an image from a URL and upload it to Tlon storage.
|
|
3959
|
-
*
|
|
3896
|
+
* Falls back to the original URL on error, but only after a bounded download when a cap is set.
|
|
3960
3897
|
*
|
|
3961
3898
|
* Note: configureClient must be called before using this function.
|
|
3962
3899
|
*/
|
|
3963
|
-
async function uploadImageFromUrl(imageUrl) {
|
|
3900
|
+
async function uploadImageFromUrl(imageUrl, maxBytes) {
|
|
3901
|
+
let sourceSizeVerified = false;
|
|
3964
3902
|
try {
|
|
3965
3903
|
const url = new URL(imageUrl);
|
|
3966
|
-
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
3967
|
-
console.warn(`[tlon] Rejected non-http(s) URL: ${imageUrl}`);
|
|
3968
|
-
return imageUrl;
|
|
3969
|
-
}
|
|
3904
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("Tlon image URL must use HTTP or HTTPS");
|
|
3970
3905
|
const fetched = await readRemoteMediaBuffer({
|
|
3971
3906
|
url: imageUrl,
|
|
3972
|
-
maxBytes: MAX_IMAGE_BYTES,
|
|
3907
|
+
maxBytes: Math.min(maxBytes ?? MAX_IMAGE_BYTES, MAX_IMAGE_BYTES),
|
|
3973
3908
|
...TLON_MEDIA_FETCH_TIMEOUTS,
|
|
3974
3909
|
ssrfPolicy: void 0,
|
|
3975
3910
|
requestInit: { method: "GET" }
|
|
3976
3911
|
});
|
|
3912
|
+
sourceSizeVerified = true;
|
|
3977
3913
|
const contentType = fetched.contentType || "image/png";
|
|
3978
3914
|
return (await uploadFile({
|
|
3979
3915
|
blob: new Blob([new Uint8Array(fetched.buffer)], { type: contentType }),
|
|
@@ -3981,6 +3917,7 @@ async function uploadImageFromUrl(imageUrl) {
|
|
|
3981
3917
|
contentType
|
|
3982
3918
|
})).url;
|
|
3983
3919
|
} catch (err) {
|
|
3920
|
+
if (maxBytes !== void 0 && !sourceSizeVerified) throw err;
|
|
3984
3921
|
console.warn(`[tlon] Failed to upload image, using original URL: ${String(err)}`);
|
|
3985
3922
|
return imageUrl;
|
|
3986
3923
|
}
|
|
@@ -4019,7 +3956,7 @@ async function createHttpPokeApi(params) {
|
|
|
4019
3956
|
});
|
|
4020
3957
|
try {
|
|
4021
3958
|
if (!response.ok && response.status !== 204) {
|
|
4022
|
-
const errorText = await readResponseTextLimited(response,
|
|
3959
|
+
const errorText = await readResponseTextLimited(response, 16384);
|
|
4023
3960
|
throw new Error(`Poke failed: ${response.status} - ${errorText}`);
|
|
4024
3961
|
}
|
|
4025
3962
|
return pokeId;
|
|
@@ -4108,7 +4045,7 @@ const tlonRuntimeOutbound = {
|
|
|
4108
4045
|
getCode: async () => account.code,
|
|
4109
4046
|
dangerouslyAllowPrivateNetwork: account.dangerouslyAllowPrivateNetwork ?? void 0
|
|
4110
4047
|
});
|
|
4111
|
-
const uploadedUrl = mediaUrl ? await uploadImageFromUrl(mediaUrl) : void 0;
|
|
4048
|
+
const uploadedUrl = mediaUrl ? await uploadImageFromUrl(mediaUrl, account.mediaMaxBytes) : void 0;
|
|
4112
4049
|
return withHttpPokeAccountApi(account, async (api) => {
|
|
4113
4050
|
const fromShip = normalizeShip(account.ship);
|
|
4114
4051
|
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.
|
|
3
|
+
"version": "2026.8.2",
|
|
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.
|
|
22
|
+
"openclaw": ">=2026.8.2"
|
|
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.
|
|
123
|
+
"pluginApi": ">=2026.8.2"
|
|
124
124
|
},
|
|
125
125
|
"build": {
|
|
126
|
-
"openclawVersion": "2026.8.
|
|
126
|
+
"openclawVersion": "2026.8.2"
|
|
127
127
|
},
|
|
128
128
|
"release": {
|
|
129
129
|
"bundleRuntimeDependencies": false,
|