@openclaw/tlon 2026.10.10-beta.5 → 2026.10.33
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/.setup/{api-b5sNP2yy.mjs → api-BywJShk3.mjs} +1 -1
- package/dist/.setup/{channel-BiTAKY7-.mjs → channel-C2dWMDrp.mjs} +1 -1
- package/dist/.setup/{channel.runtime-Bkx-midT.mjs → channel.runtime-DeZaAXos.mjs} +131 -45
- package/dist/api.js +1 -1
- package/dist/channel-plugin-api.js +2 -1
- package/dist/doctor-contract-api.js +2 -1
- package/dist/setup-entry.js +1 -1
- package/package.json +4 -4
- package/dist/.source-module-urls/219ea9f09fb313a73daa9d49cae583628627d248b038afb8d4cbf4dbf34fd43c.json +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "../runtime-api.js";
|
|
2
|
-
import { t as tlonPlugin } from "./channel-
|
|
2
|
+
import { t as tlonPlugin } from "./channel-C2dWMDrp.mjs";
|
|
3
3
|
import { n as setTlonRuntime } from "./runtime-Ck3lNvST.mjs";
|
|
4
4
|
import "../api.js";
|
|
5
5
|
export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
|
|
@@ -94,7 +94,7 @@ function resolveTlonOutboundSessionRoute(params) {
|
|
|
94
94
|
//#endregion
|
|
95
95
|
//#region extensions/tlon/src/channel.ts
|
|
96
96
|
const TLON_CHANNEL_ID = "tlon";
|
|
97
|
-
const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
97
|
+
const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DeZaAXos.mjs"));
|
|
98
98
|
const tlonSetupWizardProxy = createTlonSetupWizardBase(async (params) => await (await loadTlonChannelRuntime()).tlonSetupWizard.finalize(params));
|
|
99
99
|
const tlonConfigAdapter = createHybridChannelConfigAdapter({
|
|
100
100
|
sectionKey: TLON_CHANNEL_ID,
|
|
@@ -4,7 +4,7 @@ import { c as resolveTlonAccount, d as parseChannelNest, f as parseTlonTarget, l
|
|
|
4
4
|
import { t as getTlonRuntime } from "./runtime-Ck3lNvST.mjs";
|
|
5
5
|
import { t as tlonSetupWizard } from "./setup-surface-Byac6RoF.mjs";
|
|
6
6
|
import { fetchWithSsrFGuard, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
7
|
-
import { bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor, createMessageReceiptFromOutboundResults, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
|
|
7
|
+
import { bindIngressLifecycleToReplyOptions, createArmableStallWatchdog, createChannelIngressError, createChannelIngressMonitor, createMessageReceiptFromOutboundResults, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
|
|
8
8
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
9
9
|
import { asBoolean, asFiniteNumber, asNullableRecord, filterStringEntries, normalizeLowercaseStringOrEmpty, normalizeNullableString, readStringField, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
10
|
import crypto, { randomBytes, randomUUID } from "node:crypto";
|
|
@@ -877,6 +877,7 @@ async function ensureUrbitChannelOpen(deps, params) {
|
|
|
877
877
|
//#region extensions/tlon/src/urbit/sse-client.ts
|
|
878
878
|
const MAX_SSE_PAYLOAD_BYTES = 16777216;
|
|
879
879
|
const MAX_RECONNECT_ATTEMPTS = 10;
|
|
880
|
+
const SSE_STALL_TIMEOUT_MS = 6e4;
|
|
880
881
|
function parseUrbitSsePayload(data) {
|
|
881
882
|
if (Buffer.byteLength(data, "utf8") > MAX_SSE_PAYLOAD_BYTES) throw new Error("Tlon Urbit SSE payload exceeds 16 MiB limit");
|
|
882
883
|
try {
|
|
@@ -1035,6 +1036,17 @@ var UrbitSSEClient = class {
|
|
|
1035
1036
|
async processStream(body) {
|
|
1036
1037
|
if (!body) return;
|
|
1037
1038
|
const stream = body instanceof ReadableStream ? Readable.fromWeb(body) : body;
|
|
1039
|
+
const streamController = this.streamController;
|
|
1040
|
+
const watchdog = createArmableStallWatchdog({
|
|
1041
|
+
label: "tlon-sse",
|
|
1042
|
+
timeoutMs: SSE_STALL_TIMEOUT_MS,
|
|
1043
|
+
onTimeout: ({ idleMs }) => {
|
|
1044
|
+
const error = /* @__PURE__ */ new Error(`Tlon Urbit SSE stream stalled: no data for ${Math.round(idleMs / 1e3)}s`);
|
|
1045
|
+
streamController?.abort(error);
|
|
1046
|
+
if (stream instanceof Readable) stream.destroy(error);
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
watchdog.arm();
|
|
1038
1050
|
const decoder = new TextDecoder();
|
|
1039
1051
|
let buffer = "";
|
|
1040
1052
|
let bufferBytes = 0;
|
|
@@ -1082,13 +1094,16 @@ var UrbitSSEClient = class {
|
|
|
1082
1094
|
try {
|
|
1083
1095
|
for await (const chunk of stream) {
|
|
1084
1096
|
if (this.aborted) break;
|
|
1097
|
+
watchdog.disarm();
|
|
1085
1098
|
if (typeof chunk === "string") {
|
|
1086
1099
|
await consumeText(decoder.decode());
|
|
1087
1100
|
await consumeText(chunk);
|
|
1088
1101
|
} else await consumeText(decoder.decode(chunk, { stream: true }));
|
|
1102
|
+
watchdog.arm();
|
|
1089
1103
|
}
|
|
1090
1104
|
await consumeText(decoder.decode());
|
|
1091
1105
|
} finally {
|
|
1106
|
+
watchdog.stop();
|
|
1092
1107
|
if (this.streamRelease) {
|
|
1093
1108
|
const release = this.streamRelease;
|
|
1094
1109
|
this.streamRelease = null;
|
|
@@ -1149,8 +1164,11 @@ var UrbitSSEClient = class {
|
|
|
1149
1164
|
auditContext: "tlon-urbit-poke"
|
|
1150
1165
|
});
|
|
1151
1166
|
}
|
|
1152
|
-
async scry(path) {
|
|
1153
|
-
return await scryUrbitPath(
|
|
1167
|
+
async scry(path, beforeRequest) {
|
|
1168
|
+
return await scryUrbitPath({
|
|
1169
|
+
...this.channelRequestContext(),
|
|
1170
|
+
beforeRequest
|
|
1171
|
+
}, {
|
|
1154
1172
|
path,
|
|
1155
1173
|
auditContext: "tlon-urbit-scry"
|
|
1156
1174
|
});
|
|
@@ -1290,17 +1308,20 @@ function truncate(text, maxLength) {
|
|
|
1290
1308
|
if (text.length <= maxLength) return text;
|
|
1291
1309
|
return sliceUtf16Safe(text, 0, maxLength - 3) + "...";
|
|
1292
1310
|
}
|
|
1311
|
+
function formatApprovalInstructions(id) {
|
|
1312
|
+
return `Reply "approve", "deny", or "block" if this is the only pending request. If multiple are pending, reply "approve ${id}", "deny ${id}", or "block ${id}".`;
|
|
1313
|
+
}
|
|
1293
1314
|
function formatApprovalRequest(approval) {
|
|
1294
1315
|
const preview = approval.messagePreview ? `\n"${truncate(approval.messagePreview, 100)}"` : "";
|
|
1295
1316
|
switch (approval.type) {
|
|
1296
1317
|
case "dm":
|
|
1297
1318
|
if (approval.clubId !== void 0) {
|
|
1298
1319
|
const replayLine = approval.originalMessage ? `The message is answered as an unverified group DM sender, never as ${approval.requestingShip}.` : `The message is not kept, so it will not be answered; have ${approval.requestingShip} send it again in a normal direct message to get a reply.`;
|
|
1299
|
-
return `New group DM message claiming to be from ${approval.requestingShip} (unverified; group DM ${approval.clubId}):${preview}\n\nApproving adds ${approval.requestingShip} to the DM allowlist. ${replayLine}\
|
|
1320
|
+
return `New group DM message claiming to be from ${approval.requestingShip} (unverified; group DM ${approval.clubId}):${preview}\n\nApproving adds ${approval.requestingShip} to the DM allowlist. ${replayLine}\n` + formatApprovalInstructions(approval.id);
|
|
1300
1321
|
}
|
|
1301
|
-
return `New DM request from ${approval.requestingShip}:${preview}\n\
|
|
1302
|
-
case "channel": return `${approval.requestingShip} mentioned you in ${approval.channelNest}:${preview}\n\
|
|
1303
|
-
case "group": return `Group invite from ${approval.requestingShip} to join ${approval.groupFlag}\n\
|
|
1322
|
+
return `New DM request from ${approval.requestingShip}:${preview}\n\n` + formatApprovalInstructions(approval.id);
|
|
1323
|
+
case "channel": return `${approval.requestingShip} mentioned you in ${approval.channelNest}:${preview}\n\n` + formatApprovalInstructions(approval.id);
|
|
1324
|
+
case "group": return `Group invite from ${approval.requestingShip} to join ${approval.groupFlag}\n\n` + formatApprovalInstructions(approval.id);
|
|
1304
1325
|
}
|
|
1305
1326
|
throw new Error("Unsupported approval type");
|
|
1306
1327
|
}
|
|
@@ -1313,8 +1334,7 @@ function parseApprovalResponse(text) {
|
|
|
1313
1334
|
};
|
|
1314
1335
|
}
|
|
1315
1336
|
function findPendingApproval(pendingApprovals, id) {
|
|
1316
|
-
|
|
1317
|
-
return pendingApprovals[pendingApprovals.length - 1];
|
|
1337
|
+
return id ? pendingApprovals.find((approval) => approval.id === id) : pendingApprovals.length === 1 ? pendingApprovals[0] : void 0;
|
|
1318
1338
|
}
|
|
1319
1339
|
function removePendingApproval(pendingApprovals, id) {
|
|
1320
1340
|
return pendingApprovals.filter((a) => a.id !== id);
|
|
@@ -1495,7 +1515,7 @@ function createTlonApprovalRuntime(params) {
|
|
|
1495
1515
|
runtime.log?.(`[tlon] Pending approval limit reached; ignoring ${approval.type} request from ${approval.requestingShip}`);
|
|
1496
1516
|
if (!approvalOverflowNoticeSent && approvalOverflowNoticeAttempts < 3) {
|
|
1497
1517
|
approvalOverflowNoticeAttempts += 1;
|
|
1498
|
-
approvalOverflowNoticeSent = await sendOwnerNotification(`Pending approval queue is full (${approvals.length}). Resolve existing requests with approve, deny, or block before asking rejected requesters to retry.`);
|
|
1518
|
+
approvalOverflowNoticeSent = await sendOwnerNotification(`Pending approval queue is full (${approvals.length}). Resolve existing requests by replying with approve, deny, or block followed by the request ID before asking rejected requesters to retry.`);
|
|
1499
1519
|
}
|
|
1500
1520
|
return false;
|
|
1501
1521
|
}
|
|
@@ -1512,7 +1532,7 @@ function createTlonApprovalRuntime(params) {
|
|
|
1512
1532
|
if (!parsed) return false;
|
|
1513
1533
|
const approval = findPendingApproval(state.pendingApprovals, parsed.id);
|
|
1514
1534
|
if (!approval) {
|
|
1515
|
-
await sendOwnerNotification(`No pending approval found${parsed.id ? `
|
|
1535
|
+
await sendOwnerNotification(parsed.id ? `No pending approval found for ID: ${parsed.id}` : state.pendingApprovals.length > 1 ? `Multiple approvals are pending. Include an approval ID with your decision.\n\n${formatPendingList(state.pendingApprovals)}` : "No pending approval found.");
|
|
1516
1536
|
return true;
|
|
1517
1537
|
}
|
|
1518
1538
|
if (parsed.action === "approve") switch (approval.type) {
|
|
@@ -1716,7 +1736,8 @@ function isGroupInviteAllowed(inviterShip, allowlist) {
|
|
|
1716
1736
|
}]
|
|
1717
1737
|
}).allowed;
|
|
1718
1738
|
}
|
|
1719
|
-
|
|
1739
|
+
const MAX_INLINE_DEPTH = 100;
|
|
1740
|
+
function renderInlineItem(item, topLevel = false, depth = 0) {
|
|
1720
1741
|
if (typeof item === "string") return item;
|
|
1721
1742
|
const record = asNullableRecord(item);
|
|
1722
1743
|
if (!record) return "";
|
|
@@ -1736,14 +1757,29 @@ function renderInlineItem(item, topLevel = false) {
|
|
|
1736
1757
|
const linkContent = readStringField(link, "content");
|
|
1737
1758
|
return topLevel ? linkHref : linkContent || linkHref;
|
|
1738
1759
|
}
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1760
|
+
const bold = Array.isArray(record.bold) ? record.bold : void 0;
|
|
1761
|
+
const italics = Array.isArray(record.italics) ? record.italics : void 0;
|
|
1762
|
+
const strike = Array.isArray(record.strike) ? record.strike : void 0;
|
|
1763
|
+
const blockquote = topLevel && Array.isArray(record.blockquote) ? record.blockquote : void 0;
|
|
1764
|
+
const nested = bold ?? italics ?? strike ?? blockquote;
|
|
1765
|
+
if (!nested) return "";
|
|
1766
|
+
if (depth >= MAX_INLINE_DEPTH) return "";
|
|
1767
|
+
const inner = extractInlineText(nested, depth + 1);
|
|
1768
|
+
if (bold) return `**${inner}**`;
|
|
1769
|
+
if (italics) return `*${inner}*`;
|
|
1770
|
+
if (strike) return `~~${inner}~~`;
|
|
1771
|
+
return `> ${inner}`;
|
|
1772
|
+
}
|
|
1773
|
+
function extractInlineText(items, depth = 0) {
|
|
1774
|
+
return items.map((item) => renderInlineItem(item, false, depth)).join("");
|
|
1775
|
+
}
|
|
1776
|
+
function extractMessageTextSafely(content, runtime) {
|
|
1777
|
+
try {
|
|
1778
|
+
return extractMessageText(content);
|
|
1779
|
+
} catch (error) {
|
|
1780
|
+
runtime.log?.(`[tlon] Failed to extract message text: ${formatErrorMessage(error)}`);
|
|
1781
|
+
return "";
|
|
1782
|
+
}
|
|
1747
1783
|
}
|
|
1748
1784
|
function extractMessageText(content) {
|
|
1749
1785
|
if (!Array.isArray(content)) return "";
|
|
@@ -1831,6 +1867,8 @@ function formatSummarizationHistoryText(history, cfg) {
|
|
|
1831
1867
|
//#region extensions/tlon/src/monitor/cites.ts
|
|
1832
1868
|
const CITE_PATH_SEGMENT_RE = /^[A-Za-z0-9._~-]+$/;
|
|
1833
1869
|
const CITE_PATH_NORMALIZATION_BASE = "https://tlon.invalid";
|
|
1870
|
+
const CITATION_SCOPE_SKIP_LOG = "[tlon] Skipping cited post: citation is outside explicit channel scope";
|
|
1871
|
+
var CitationScopeChangedError = class extends Error {};
|
|
1834
1872
|
function isSafeCitePathSegment(segment) {
|
|
1835
1873
|
if (segment === "." || segment === "..") return false;
|
|
1836
1874
|
return CITE_PATH_SEGMENT_RE.test(segment);
|
|
@@ -1850,7 +1888,7 @@ function buildCitedPostScryPath(nest, postId) {
|
|
|
1850
1888
|
if (new URL(scryPath, CITE_PATH_NORMALIZATION_BASE).pathname !== scryPath) return null;
|
|
1851
1889
|
return scryPath;
|
|
1852
1890
|
}
|
|
1853
|
-
async function resolveTlonCitations(content, api, runtime) {
|
|
1891
|
+
async function resolveTlonCitations(content, canExpandNest, api, runtime) {
|
|
1854
1892
|
if (!Array.isArray(content)) return "";
|
|
1855
1893
|
const resolved = [];
|
|
1856
1894
|
for (const verse of content) {
|
|
@@ -1860,6 +1898,10 @@ async function resolveTlonCitations(content, api, runtime) {
|
|
|
1860
1898
|
const whereMatch = readStringField(chan, "where")?.match(/\/msg\/(~[a-z-]+)\/(.+)/);
|
|
1861
1899
|
const postId = whereMatch?.[2];
|
|
1862
1900
|
if (!nest || !postId) continue;
|
|
1901
|
+
if (!canExpandNest(nest)) {
|
|
1902
|
+
runtime.log?.(CITATION_SCOPE_SKIP_LOG);
|
|
1903
|
+
continue;
|
|
1904
|
+
}
|
|
1863
1905
|
const scryPath = buildCitedPostScryPath(nest, postId);
|
|
1864
1906
|
if (!scryPath) {
|
|
1865
1907
|
runtime.log?.("[tlon] Skipping cited post: citation does not name a channel post");
|
|
@@ -1867,11 +1909,21 @@ async function resolveTlonCitations(content, api, runtime) {
|
|
|
1867
1909
|
}
|
|
1868
1910
|
try {
|
|
1869
1911
|
runtime.log?.(`[tlon] Fetching cited post: ${scryPath}`);
|
|
1870
|
-
const data = asNullableRecord(await api.scry(scryPath)
|
|
1912
|
+
const data = asNullableRecord(await api.scry(scryPath, () => {
|
|
1913
|
+
if (!canExpandNest(nest)) throw new CitationScopeChangedError();
|
|
1914
|
+
}));
|
|
1915
|
+
if (!canExpandNest(nest)) {
|
|
1916
|
+
runtime.log?.(CITATION_SCOPE_SKIP_LOG);
|
|
1917
|
+
continue;
|
|
1918
|
+
}
|
|
1871
1919
|
const essay = asNullableRecord(data?.essay);
|
|
1872
1920
|
const text = essay?.content ? extractMessageText(essay.content) : "";
|
|
1873
1921
|
if (text) resolved.push(`> ${whereMatch?.[1] || "unknown"} wrote: ${text}`);
|
|
1874
1922
|
} catch (err) {
|
|
1923
|
+
if (err instanceof CitationScopeChangedError) {
|
|
1924
|
+
runtime.log?.(CITATION_SCOPE_SKIP_LOG);
|
|
1925
|
+
continue;
|
|
1926
|
+
}
|
|
1875
1927
|
runtime.log?.(`[tlon] Failed to fetch cited post: ${String(err)}`);
|
|
1876
1928
|
}
|
|
1877
1929
|
}
|
|
@@ -2047,6 +2099,20 @@ async function fetchThreadHistory(api, channelNest, parentId, count = 50, runtim
|
|
|
2047
2099
|
const TLON_INGRESS_PAYLOAD_VERSION = 1;
|
|
2048
2100
|
const TLON_INGRESS_POLL_INTERVAL_MS = 1e3;
|
|
2049
2101
|
const TlonIngressPermanentError = createChannelIngressError("TlonIngressPermanentError", { withReason: true });
|
|
2102
|
+
var TlonIngressUnserializableEventError = class extends Error {
|
|
2103
|
+
constructor(cause) {
|
|
2104
|
+
super("Tlon firehose event is too deeply nested to store.", { cause });
|
|
2105
|
+
this.name = "TlonIngressUnserializableEventError";
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
function serializeTlonIngressEvent(event) {
|
|
2109
|
+
try {
|
|
2110
|
+
return JSON.stringify(event);
|
|
2111
|
+
} catch (error) {
|
|
2112
|
+
if (error instanceof RangeError) throw new TlonIngressUnserializableEventError(error);
|
|
2113
|
+
throw error;
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2050
2116
|
function inspectChannelsEvent(event) {
|
|
2051
2117
|
const envelope = asNullableRecord(event);
|
|
2052
2118
|
const nest = normalizeNullableString(envelope?.nest);
|
|
@@ -2124,7 +2190,7 @@ function createTlonIngressMonitor(options) {
|
|
|
2124
2190
|
serialize: (raw, { receivedAt }) => ({
|
|
2125
2191
|
receivedAt,
|
|
2126
2192
|
source: raw.source,
|
|
2127
|
-
rawEvent:
|
|
2193
|
+
rawEvent: serializeTlonIngressEvent(raw.event)
|
|
2128
2194
|
}),
|
|
2129
2195
|
deserialize: (body, { claim }) => deserializeTlonIngressEvent(body, claim.id),
|
|
2130
2196
|
encode: ({ body }) => ({
|
|
@@ -2153,10 +2219,18 @@ function createTlonIngressMonitor(options) {
|
|
|
2153
2219
|
});
|
|
2154
2220
|
return {
|
|
2155
2221
|
receive: async ({ source, event }) => {
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2222
|
+
try {
|
|
2223
|
+
return { kind: (await monitor.admit({
|
|
2224
|
+
source,
|
|
2225
|
+
event
|
|
2226
|
+
})).kind === "durable" ? "accepted" : "ignored" };
|
|
2227
|
+
} catch (error) {
|
|
2228
|
+
if (error instanceof TlonIngressUnserializableEventError) {
|
|
2229
|
+
options.runtime.log?.(`tlon dropped ${source} event: ${error.message}`);
|
|
2230
|
+
return { kind: "dropped" };
|
|
2231
|
+
}
|
|
2232
|
+
throw error;
|
|
2233
|
+
}
|
|
2160
2234
|
},
|
|
2161
2235
|
start: monitor.start,
|
|
2162
2236
|
stop: monitor.stop,
|
|
@@ -2368,6 +2442,7 @@ function applyTlonSettingsOverrides(params) {
|
|
|
2368
2442
|
effectiveAutoAcceptDmInvites: settings.autoAcceptDmInvites ?? account.autoAcceptDmInvites ?? false,
|
|
2369
2443
|
effectiveAutoAcceptGroupInvites: settings.autoAcceptGroupInvites ?? account.autoAcceptGroupInvites ?? false,
|
|
2370
2444
|
effectiveGroupInviteAllowlist: settings.groupInviteAllowlist ?? account.groupInviteAllowlist,
|
|
2445
|
+
explicitChannels: mergeUniqueStrings(account.groupChannels, settings.groupChannels),
|
|
2371
2446
|
effectiveAutoDiscoverChannels: settings.autoDiscoverChannels ?? account.autoDiscoverChannels ?? false,
|
|
2372
2447
|
effectiveOwnerShip,
|
|
2373
2448
|
pendingApprovals: settings.pendingApprovals?.length ? settings.pendingApprovals : [],
|
|
@@ -2377,6 +2452,21 @@ function applyTlonSettingsOverrides(params) {
|
|
|
2377
2452
|
function mergeUniqueStrings(base, next) {
|
|
2378
2453
|
return uniqueStrings([...base, ...next ?? []]);
|
|
2379
2454
|
}
|
|
2455
|
+
function createTlonSettingsInstaller(state, account, log) {
|
|
2456
|
+
return (currentSettings, preserveApprovalState = false) => {
|
|
2457
|
+
const pendingApprovals = state.pendingApprovals;
|
|
2458
|
+
const effectiveDmAllowlist = state.effectiveDmAllowlist;
|
|
2459
|
+
Object.assign(state, applyTlonSettingsOverrides({
|
|
2460
|
+
account,
|
|
2461
|
+
currentSettings,
|
|
2462
|
+
log
|
|
2463
|
+
}));
|
|
2464
|
+
if (preserveApprovalState) {
|
|
2465
|
+
state.pendingApprovals = pendingApprovals;
|
|
2466
|
+
state.effectiveDmAllowlist = effectiveDmAllowlist;
|
|
2467
|
+
}
|
|
2468
|
+
};
|
|
2469
|
+
}
|
|
2380
2470
|
//#endregion
|
|
2381
2471
|
//#region extensions/tlon/src/monitor/tracking.ts
|
|
2382
2472
|
const TLON_PARTICIPATED_THREAD_LIMIT = 2e3;
|
|
@@ -2478,6 +2568,7 @@ async function monitorTlonProvider(opts) {
|
|
|
2478
2568
|
account,
|
|
2479
2569
|
currentSettings: {}
|
|
2480
2570
|
});
|
|
2571
|
+
const installSettings = createTlonSettingsInstaller(settingsState, account, (message) => runtime.log?.(message));
|
|
2481
2572
|
const participatedThreads = createParticipatedThreadTracker();
|
|
2482
2573
|
const channelHistory = createChannelHistoryCache();
|
|
2483
2574
|
const dmSendersBySession = /* @__PURE__ */ new Map();
|
|
@@ -2501,11 +2592,7 @@ async function monitorTlonProvider(opts) {
|
|
|
2501
2592
|
} catch (err) {
|
|
2502
2593
|
runtime.log?.(`[tlon] Failed to migrate ${key}: ${String(err)}`);
|
|
2503
2594
|
}
|
|
2504
|
-
|
|
2505
|
-
account,
|
|
2506
|
-
currentSettings: settingsState.currentSettings,
|
|
2507
|
-
log: (message) => runtime.log?.(message)
|
|
2508
|
-
}));
|
|
2595
|
+
installSettings(settingsState.currentSettings);
|
|
2509
2596
|
} catch (err) {
|
|
2510
2597
|
runtime.log?.(`[tlon] Settings store not available, using file config: ${String(err)}`);
|
|
2511
2598
|
}
|
|
@@ -2772,6 +2859,7 @@ async function monitorTlonProvider(opts) {
|
|
|
2772
2859
|
});
|
|
2773
2860
|
};
|
|
2774
2861
|
const watchedChannels = new Set(groupChannels);
|
|
2862
|
+
const canExpandCitedNest = (nest) => settingsState.effectiveAutoDiscoverChannels || settingsState.explicitChannels.includes(nest);
|
|
2775
2863
|
const addWatchedChannels = (channels, logPrefix) => {
|
|
2776
2864
|
const previousCount = watchedChannels.size;
|
|
2777
2865
|
for (const channelNest of channels) if (!watchedChannels.has(channelNest)) {
|
|
@@ -2850,7 +2938,7 @@ async function monitorTlonProvider(opts) {
|
|
|
2850
2938
|
if (!messageId) return;
|
|
2851
2939
|
const senderShip = normalizeShip(readStringField(content, "author") ?? "");
|
|
2852
2940
|
if (!senderShip || senderShip === botShipName) return;
|
|
2853
|
-
const rawText =
|
|
2941
|
+
const rawText = extractMessageTextSafely(content.content, runtime);
|
|
2854
2942
|
if (!rawText.trim()) return;
|
|
2855
2943
|
const contentBody = content.content;
|
|
2856
2944
|
const sentAt = asFiniteNumber(content?.sent) ?? Date.now();
|
|
@@ -2897,7 +2985,7 @@ async function monitorTlonProvider(opts) {
|
|
|
2897
2985
|
} else runtime.log?.(`[tlon] Access denied: ${senderShip} in ${nest} (allowed: ${allowedShips.join(", ")})`);
|
|
2898
2986
|
return;
|
|
2899
2987
|
}
|
|
2900
|
-
const messageText = await resolveTlonCitations(contentBody, api, runtime) + rawText;
|
|
2988
|
+
const messageText = await resolveTlonCitations(contentBody, canExpandCitedNest, api, runtime) + rawText;
|
|
2901
2989
|
await processMessage({
|
|
2902
2990
|
messageId,
|
|
2903
2991
|
senderShip,
|
|
@@ -2985,7 +3073,7 @@ async function monitorTlonProvider(opts) {
|
|
|
2985
3073
|
if (authorShip === botShipName) return;
|
|
2986
3074
|
if (!senderShip || senderShip === botShipName) return;
|
|
2987
3075
|
if (authorShip && partnerShip && authorShip !== partnerShip) runtime.log?.(`[tlon] DM ship mismatch (author=${authorShip}, partner=${partnerShip}) - routing to partner`);
|
|
2988
|
-
const rawText =
|
|
3076
|
+
const rawText = extractMessageTextSafely(essay.content, runtime);
|
|
2989
3077
|
if (!rawText.trim()) return;
|
|
2990
3078
|
const messageText = rawText;
|
|
2991
3079
|
const ownerDm = !isClubMessage && isOwner(senderShip);
|
|
@@ -3030,7 +3118,8 @@ async function monitorTlonProvider(opts) {
|
|
|
3030
3118
|
} else runtime.log?.(`[tlon] Blocked DM from ${senderShip}: not in allowlist`);
|
|
3031
3119
|
return;
|
|
3032
3120
|
}
|
|
3033
|
-
const
|
|
3121
|
+
const canExpandDmCitedNest = (nest) => !isClubMessage && isOwner(senderShip) || canExpandCitedNest(nest);
|
|
3122
|
+
const resolvedMessageText = await resolveTlonCitations(essay.content, canExpandDmCitedNest, api, runtime) + rawText;
|
|
3034
3123
|
if (ownerDm) runtime.log?.(`[tlon] Processing DM from owner ${senderShip}`);
|
|
3035
3124
|
await processMessage({
|
|
3036
3125
|
messageText: resolvedMessageText,
|
|
@@ -3125,11 +3214,7 @@ async function monitorTlonProvider(opts) {
|
|
|
3125
3214
|
await settingsManager.startSubscription((newSettings) => {
|
|
3126
3215
|
settingsState.currentSettings = newSettings;
|
|
3127
3216
|
addWatchedChannels(newSettings.groupChannels ?? [], "[tlon] Settings: now watching channel ");
|
|
3128
|
-
|
|
3129
|
-
account,
|
|
3130
|
-
currentSettings: newSettings,
|
|
3131
|
-
log: (message) => runtime.log?.(message)
|
|
3132
|
-
}));
|
|
3217
|
+
installSettings(newSettings);
|
|
3133
3218
|
});
|
|
3134
3219
|
} catch (err) {
|
|
3135
3220
|
runtime.log?.(`[tlon] Settings subscription not available: ${String(err)}`);
|
|
@@ -3147,15 +3232,16 @@ async function monitorTlonProvider(opts) {
|
|
|
3147
3232
|
const discoveredChannels = mergeUniqueStrings(Object.keys(asNullableRecord(eventRecord.channels) ?? {}), joinedChannels.filter((channel) => typeof channel === "string")).filter((channel) => channel.startsWith("chat/"));
|
|
3148
3233
|
addWatchedChannels(discoveredChannels, "[tlon] Auto-detected new channel: ");
|
|
3149
3234
|
if (!settingsState.effectiveAutoAcceptGroupInvites) return;
|
|
3150
|
-
const
|
|
3235
|
+
const settingsSnapshot = settingsState.currentSettings;
|
|
3236
|
+
const currentChannels = settingsSnapshot.groupChannels ?? [];
|
|
3151
3237
|
const unpersistedChannels = discoveredChannels.filter((channel) => !currentChannels.includes(channel));
|
|
3152
3238
|
if (unpersistedChannels.length === 0) return;
|
|
3153
3239
|
const updatedChannels = mergeUniqueStrings(currentChannels, unpersistedChannels);
|
|
3154
3240
|
await putTlonSetting(api, "groupChannels", updatedChannels);
|
|
3155
|
-
settingsState.currentSettings
|
|
3156
|
-
...
|
|
3241
|
+
if (settingsState.currentSettings === settingsSnapshot) installSettings({
|
|
3242
|
+
...settingsSnapshot,
|
|
3157
3243
|
groupChannels: updatedChannels
|
|
3158
|
-
};
|
|
3244
|
+
}, true);
|
|
3159
3245
|
runtime.log?.(`[tlon] Persisted ${unpersistedChannels.join(", ")} to settings store`);
|
|
3160
3246
|
} catch (error) {
|
|
3161
3247
|
runtime.error?.(`[tlon] Error handling groups-ui event: ${formatErrorMessage(error)}`);
|
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "./runtime-api.js";
|
|
2
|
-
import { t as tlonPlugin } from "./.setup/channel-
|
|
2
|
+
import { t as tlonPlugin } from "./.setup/channel-C2dWMDrp.mjs";
|
|
3
3
|
import { n as setTlonRuntime } from "./.setup/runtime-Ck3lNvST.mjs";
|
|
4
4
|
export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as tlonPlugin } from "./.setup/channel-C2dWMDrp.mjs";
|
|
2
|
+
export { tlonPlugin };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-bInPRAQZ.mjs";
|
|
2
|
+
export { legacyConfigRules, normalizeCompatibilityConfig };
|
package/dist/setup-entry.js
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
var setup_entry_default = defineBundledChannelSetupEntry({
|
|
5
5
|
importMetaUrl: import.meta.url,
|
|
6
6
|
plugin: {
|
|
7
|
-
specifier: fileURLToPath(new URL(".setup/api-
|
|
7
|
+
specifier: fileURLToPath(new URL(".setup/api-BywJShk3.mjs", import.meta.url).href),
|
|
8
8
|
exportName: "tlonPlugin"
|
|
9
9
|
}
|
|
10
10
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/tlon",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.33",
|
|
4
4
|
"description": "OpenClaw Tlon/Urbit channel plugin for chat workflows.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"openclaw": "workspace:*"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"openclaw": ">=2026.
|
|
22
|
+
"openclaw": ">=2026.11.4"
|
|
23
23
|
},
|
|
24
24
|
"peerDependenciesMeta": {
|
|
25
25
|
"openclaw": {
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
"minHostVersion": ">=2026.4.10"
|
|
122
122
|
},
|
|
123
123
|
"compat": {
|
|
124
|
-
"pluginApi": ">=2026.
|
|
124
|
+
"pluginApi": ">=2026.11.4"
|
|
125
125
|
},
|
|
126
126
|
"build": {
|
|
127
|
-
"openclawVersion": "2026.10.
|
|
127
|
+
"openclawVersion": "2026.10.33"
|
|
128
128
|
},
|
|
129
129
|
"release": {
|
|
130
130
|
"bundleRuntimeDependencies": false,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"entries":[{"output":"api.js","source":"extensions/tlon/api.ts"},{"output":"channel-plugin-api.js","source":"extensions/tlon/channel-plugin-api.ts"},{"output":"doctor-contract-api.js","source":"extensions/tlon/doctor-contract-api.ts"},{"output":"index.js","source":"extensions/tlon/index.ts"},{"output":"runtime-api.js","source":"extensions/tlon/runtime-api.ts"},{"output":"setup-api.js","source":"extensions/tlon/setup-api.ts"},{"output":"setup-entry.js","source":"extensions/tlon/setup-entry.ts"}],"chunks":[{"output":".setup/api-b5sNP2yy.mjs","sha256":"ccf2072aba27c67ff70da59dcb53a1f9188a2991f5a8ccc1aaa6309a960f9b65","facadeSource":"extensions/tlon/api.ts","sources":[]},{"output":".setup/channel-BiTAKY7-.mjs","sha256":"df5855b264339ffdaa490b89184b7da88bfd19f182e2323d86ff805a81d1471e","facadeSource":null,"sources":["extensions/tlon/src/channel.ts","extensions/tlon/src/config-schema.ts","extensions/tlon/src/doctor.ts","extensions/tlon/src/session-route.ts"]},{"output":".setup/channel.runtime-Bkx-midT.mjs","sha256":"48fa7d5f3a8151e53fc18d8c036ace35be221af52f84ff11b1ff73ac365005fc","facadeSource":"extensions/tlon/src/channel.runtime.ts","sources":["extensions/tlon/src/channel.runtime.ts","extensions/tlon/src/media-fetch-timeouts.ts","extensions/tlon/src/monitor/approval-runtime.ts","extensions/tlon/src/monitor/approval.ts","extensions/tlon/src/monitor/authorization.ts","extensions/tlon/src/monitor/cites.ts","extensions/tlon/src/monitor/discovery.ts","extensions/tlon/src/monitor/history.ts","extensions/tlon/src/monitor/index.ts","extensions/tlon/src/monitor/ingress.ts","extensions/tlon/src/monitor/media.ts","extensions/tlon/src/monitor/mentions.ts","extensions/tlon/src/monitor/settings-helpers.ts","extensions/tlon/src/monitor/tracking.ts","extensions/tlon/src/monitor/utils.ts","extensions/tlon/src/settings.ts","extensions/tlon/src/tlon-api.ts","extensions/tlon/src/urbit/auth.ts","extensions/tlon/src/urbit/channel-ops.ts","extensions/tlon/src/urbit/context.ts","extensions/tlon/src/urbit/errors.ts","extensions/tlon/src/urbit/fetch.ts","extensions/tlon/src/urbit/redact.ts","extensions/tlon/src/urbit/send.ts","extensions/tlon/src/urbit/sse-client.ts","extensions/tlon/src/urbit/story.ts","extensions/tlon/src/urbit/upload.ts","src/channels/mention-gating.ts"]},{"output":".setup/doctor-contract-bInPRAQZ.mjs","sha256":"ba06bce97c984451581c990c9cfebbc69f70f3087e0eae04f07659084b6b16ba","facadeSource":null,"sources":["extensions/tlon/src/doctor-contract.ts","packages/normalization-core/src/record-coerce.ts","src/config/channel-config-normalization.ts","src/plugin-sdk/legacy-webhook-listener-migration.ts"]},{"output":".setup/runtime-Ck3lNvST.mjs","sha256":"b47fecb040ffb94da7eaa7ea1f026897d4b982aad8459b1da6f42878f0af2fcd","facadeSource":null,"sources":["extensions/tlon/src/runtime.ts"]},{"output":".setup/setup-core-kO8u8noA.mjs","sha256":"6a73177e64d17ac8c5ea5b62931c7f4eda0a13ba5d527a9c77500d6a4aa06dde","facadeSource":null,"sources":["extensions/tlon/src/account-fields.ts","extensions/tlon/src/setup-core.ts","extensions/tlon/src/targets.ts","extensions/tlon/src/types.ts","extensions/tlon/src/urbit/base-url.ts"]},{"output":".setup/setup-surface-Byac6RoF.mjs","sha256":"0df0c9298fc374fa1f9a7b2cb25dc9e86a9350ef4490a4a7df595430fc8dff2f","facadeSource":null,"sources":["extensions/tlon/src/setup-surface.ts"]},{"output":"api.js","sha256":"c8d16d4610b40bbe0489f08b7cf120e9a2d6bfd3c1eb7da99a1d20653eb38bf6","facadeSource":"extensions/tlon/api.ts","sources":[]},{"output":"channel-plugin-api.js","sha256":"2143c734055374c939a91e3552d5cb14fee21b50282cef41eea5d83f6cdd42c6","facadeSource":"extensions/tlon/channel-plugin-api.ts","sources":[]},{"output":"doctor-contract-api.js","sha256":"d8bfd31033274b1d661f7320b7d4ccaba6321d47ed309409003928b72403cb2f","facadeSource":"extensions/tlon/doctor-contract-api.ts","sources":[]},{"output":"index.js","sha256":"40ecbe760d30b082e1a5a9eb2590c33ef411f287fa5b655373df7d5126005654","facadeSource":"extensions/tlon/index.ts","sources":["extensions/tlon/index.ts"]},{"output":"runtime-api.js","sha256":"84b5cef46a80daf5dd78edb6afd45310e3877e6d91d56716af7992f38f01e7cb","facadeSource":"extensions/tlon/runtime-api.ts","sources":[]},{"output":"setup-api.js","sha256":"70fece625b2ba840a50e3083004da46aad994368321104bce289df624c5fbb93","facadeSource":"extensions/tlon/setup-api.ts","sources":[]},{"output":"setup-entry.js","sha256":"71729a4bc4dea30ff55e4b569c4f68a61c125b29df2845997f2846dd364e2c1f","facadeSource":"extensions/tlon/setup-entry.ts","sources":["extensions/tlon/setup-entry.ts"]}],"unrenderedSources":["extensions/tlon/api.ts","extensions/tlon/channel-plugin-api.ts","extensions/tlon/config-doctor-api.ts","extensions/tlon/doctor-contract-api.ts","extensions/tlon/runtime-api.ts","extensions/tlon/setup-api.ts"]}
|