@openclaw/buzz 2026.9.1-beta.1 → 2026.9.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/{adapter.runtime-DA6guOQ_.js → adapter.runtime-CaDdxQ2C.js} +4 -4
- package/dist/api.js +2 -2
- package/dist/{channel-BulZqShF.js → channel-Czma0_CC.js} +200 -66
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{directory-config-BesCse0q.js → directory-config-B0shiBa4.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{message-event-CFw7gGLi.js → message-event-X_aBiM1X.js} +5 -8
- package/dist/qa-runner-api.js +1 -1
- package/dist/{room-membership-DSAkyE0a.js → room-membership-a8IHfdgL.js} +7 -5
- package/dist/secret-contract-DNuqbK64.js +50 -0
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +6 -3
- package/dist/{setup-surface-BvQgEJ7O.js → setup-surface-DDUmAluL.js} +197 -170
- package/dist/types-CeupBG0P.js +160 -0
- package/node_modules/nostr-tools/lib/cjs/index.js +21 -5
- package/node_modules/nostr-tools/lib/cjs/index.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip17.js +19 -3
- package/node_modules/nostr-tools/lib/cjs/nip17.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip46.js +7 -3
- package/node_modules/nostr-tools/lib/cjs/nip46.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip59.js +19 -3
- package/node_modules/nostr-tools/lib/cjs/nip59.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip98.js +1 -1
- package/node_modules/nostr-tools/lib/cjs/nip98.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nipad.js +55 -0
- package/node_modules/nostr-tools/lib/cjs/nipad.js.map +7 -0
- package/node_modules/nostr-tools/lib/cjs/nipb7.js +1003 -98
- package/node_modules/nostr-tools/lib/cjs/nipb7.js.map +4 -4
- package/node_modules/nostr-tools/lib/cjs/relay.js +1 -1
- package/node_modules/nostr-tools/lib/cjs/relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/index.js +21 -5
- package/node_modules/nostr-tools/lib/esm/index.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip17.js +19 -3
- package/node_modules/nostr-tools/lib/esm/nip17.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip46.js +7 -3
- package/node_modules/nostr-tools/lib/esm/nip46.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip59.js +19 -3
- package/node_modules/nostr-tools/lib/esm/nip59.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip98.js +1 -1
- package/node_modules/nostr-tools/lib/esm/nip98.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nipad.js +34 -0
- package/node_modules/nostr-tools/lib/esm/nipad.js.map +7 -0
- package/node_modules/nostr-tools/lib/esm/nipb7.js +1009 -98
- package/node_modules/nostr-tools/lib/esm/nipb7.js.map +4 -4
- package/node_modules/nostr-tools/lib/esm/relay.js +1 -1
- package/node_modules/nostr-tools/lib/esm/relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/nostr.bundle.js +21 -5
- package/node_modules/nostr-tools/lib/nostr.bundle.js.map +2 -2
- package/node_modules/nostr-tools/lib/types/nip98.d.ts +1 -1
- package/node_modules/nostr-tools/lib/types/nipad.d.ts +16 -0
- package/node_modules/nostr-tools/lib/types/nipb7.d.ts +112 -5
- package/node_modules/nostr-tools/lib/types/relay.d.ts +1 -1
- package/node_modules/nostr-tools/package.json +7 -7
- package/openclaw.plugin.json +346 -0
- package/package.json +8 -5
- package/dist/secret-contract-D19RiJv_.js +0 -12
- package/dist/types-BN_HOsnq.js +0 -101
- package/node_modules/nostr-tools/lib/cjs/nipb0.js +0 -1087
- package/node_modules/nostr-tools/lib/cjs/nipb0.js.map +0 -7
- package/node_modules/nostr-tools/lib/esm/nipb0.js +0 -1072
- package/node_modules/nostr-tools/lib/esm/nipb0.js.map +0 -7
- package/node_modules/nostr-tools/lib/types/nipb0.d.ts +0 -128
- /package/node_modules/nostr-tools/lib/types/{nipb0.test.d.ts → nip46.test.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { i as buildBuzzMessageTags, s as parseBuzzMessageEvent } from "./message-event-
|
|
1
|
+
import { m as parseBuzzTarget, n as decodeBuzzPrivateKey, o as resolveBuzzPublicKey, u as buildBuzzTarget } from "./types-CeupBG0P.js";
|
|
2
|
+
import { c as openBuzzRelaySubscription, i as parseBuzzRoomMembershipEvent, o as connectAuthenticatedBuzzRelaySession, s as parseBuzzAuthTag, t as BUZZ_ROOM_MEMBERSHIP_KIND, u as isNewerBuzzRevision } from "./room-membership-a8IHfdgL.js";
|
|
3
|
+
import { i as buildBuzzMessageTags, s as parseBuzzMessageEvent } from "./message-event-X_aBiM1X.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { finalizeEvent } from "nostr-tools";
|
|
6
6
|
import { isLoopbackHost } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
@@ -96,7 +96,7 @@ async function loadBuzzQaRoomMembership(params) {
|
|
|
96
96
|
}], {
|
|
97
97
|
onevent: (event) => {
|
|
98
98
|
const membership = parseBuzzRoomMembershipEvent(event, params.relayPublicKey);
|
|
99
|
-
if (membership?.roomId === params.roomId &&
|
|
99
|
+
if (membership?.roomId === params.roomId && isNewerBuzzRevision(membership, latest)) latest = membership;
|
|
100
100
|
},
|
|
101
101
|
oneose: () => {
|
|
102
102
|
receivedEose = true;
|
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as resolveBuzzAccount,
|
|
2
|
-
import { n as getBuzzRuntime, r as setBuzzRuntime, t as buzzPlugin } from "./channel-
|
|
1
|
+
import { i as resolveBuzzAccount, r as listBuzzAccountIds, s as resolveDefaultBuzzAccountId } from "./types-CeupBG0P.js";
|
|
2
|
+
import { n as getBuzzRuntime, r as setBuzzRuntime, t as buzzPlugin } from "./channel-Czma0_CC.js";
|
|
3
3
|
export { buzzPlugin, getBuzzRuntime, listBuzzAccountIds, resolveBuzzAccount, resolveDefaultBuzzAccountId, setBuzzRuntime };
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-
|
|
1
|
+
import { a as resolveBuzzAccountConfig, c as BuzzConfigSchema, d as isConfiguredBuzzChannel, f as looksLikeBuzzTarget, i as resolveBuzzAccount, m as parseBuzzTarget, n as decodeBuzzPrivateKey, o as resolveBuzzPublicKey, p as normalizeBuzzTarget, r as listBuzzAccountIds, s as resolveDefaultBuzzAccountId, t as assertBuzzAccountAvailable, u as buildBuzzTarget } from "./types-CeupBG0P.js";
|
|
2
|
+
import { n as listBuzzDirectoryPeersFromConfig, t as listBuzzDirectoryGroupsFromConfig } from "./directory-config-B0shiBa4.js";
|
|
3
|
+
import { a as connectAuthenticatedBuzzRelay, c as openBuzzRelaySubscription, i as parseBuzzRoomMembershipEvent, l as queryBuzzRelaySnapshot, n as BUZZ_ROOM_SYSTEM_KIND, o as connectAuthenticatedBuzzRelaySession, r as parseBuzzRoomMembershipChangeEvent, s as parseBuzzAuthTag, t as BUZZ_ROOM_MEMBERSHIP_KIND, u as isNewerBuzzRevision } from "./room-membership-a8IHfdgL.js";
|
|
4
|
+
import { a as formatBuzzMessageForAgent, c as inspectBuzzMentionSyntax, i as buildBuzzMessageTags, l as resolveBuzzMessageMentions, n as BUZZ_INBOUND_MESSAGE_KINDS, o as isBuzzInboundMessageKind, r as BUZZ_TYPING_INDICATOR_KIND, s as parseBuzzMessageEvent, t as BUZZ_DIFF_MESSAGE_KIND } from "./message-event-X_aBiM1X.js";
|
|
5
|
+
import { i as startBuzzRoomMembershipNotifications, n as buzzSetupContract, r as discoverBuzzRooms, t as buzzSetupWizard } from "./setup-surface-DDUmAluL.js";
|
|
6
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-DNuqbK64.js";
|
|
7
7
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
8
8
|
import { buildChannelOutboundSessionRoute, buildThreadAwareOutboundSessionRoute, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
9
9
|
import { createChannelMessageAdapterFromOutbound, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
10
|
import { createChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime";
|
|
11
11
|
import { parseThreadSessionSuffix } from "openclaw/plugin-sdk/routing";
|
|
12
12
|
import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
13
|
-
import { finalizeEvent } from "nostr-tools";
|
|
13
|
+
import { compareEvents, finalizeEvent } from "nostr-tools";
|
|
14
14
|
import { chunkItems } from "openclaw/plugin-sdk/text-chunking";
|
|
15
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
15
|
+
import { truncateUtf16Safe, truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
16
16
|
import { attachChannelToResult } from "openclaw/plugin-sdk/channel-send-result";
|
|
17
17
|
import { channelReadyPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
18
18
|
import { computeBackoff, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
19
19
|
import { createChannelReplayGuard } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
20
|
-
import {
|
|
20
|
+
import { normalizeURL } from "nostr-tools/utils";
|
|
21
|
+
import { buildChannelInboundEventContext, logInboundDrop, recordDroppedChannelInboundHistory, resolveChannelInboundRouteEnvelope } from "openclaw/plugin-sdk/channel-inbound";
|
|
21
22
|
import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
22
23
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/logging-core";
|
|
24
|
+
import { buildHistoryContext, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
23
25
|
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
24
26
|
import { createHash } from "node:crypto";
|
|
25
27
|
const BUZZ_ROOM_METADATA_KIND = 39e3;
|
|
@@ -38,9 +40,6 @@ function readPreferredString(params) {
|
|
|
38
40
|
if (Object.hasOwn(params.content, params.primary)) return normalizeBoundedString(params.content[params.primary], params.maxChars);
|
|
39
41
|
return normalizeBoundedString(params.content[params.fallback], params.maxChars);
|
|
40
42
|
}
|
|
41
|
-
function isNewerEvent(candidate, current) {
|
|
42
|
-
return !current || candidate.createdAt > current.createdAt || candidate.createdAt === current.createdAt && candidate.eventId < current.eventId;
|
|
43
|
-
}
|
|
44
43
|
function fallbackPublicKeyLabel(publicKey) {
|
|
45
44
|
return `${publicKey.slice(0, 8)}...${publicKey.slice(-6)}`;
|
|
46
45
|
}
|
|
@@ -153,15 +152,22 @@ var BuzzDirectoryState = class {
|
|
|
153
152
|
isRoomArchived(roomId) {
|
|
154
153
|
return this.#rooms.get(parseBuzzTarget(roomId))?.archived === true;
|
|
155
154
|
}
|
|
155
|
+
isBotMember(roomId, publicKey) {
|
|
156
|
+
return this.isMember(roomId, publicKey) && this.#memberships.get(parseBuzzTarget(roomId))?.roles.get(publicKey) === "bot";
|
|
157
|
+
}
|
|
158
|
+
isMember(roomId, publicKey) {
|
|
159
|
+
const normalizedRoomId = parseBuzzTarget(roomId);
|
|
160
|
+
return !this.#rooms.get(normalizedRoomId)?.archived && this.#memberships.get(normalizedRoomId)?.members.has(publicKey) === true;
|
|
161
|
+
}
|
|
156
162
|
applyProfileEvent(event) {
|
|
157
163
|
const profile = parseBuzzDirectoryProfileEvent(event);
|
|
158
|
-
if (!profile || !this.#profilePublicKeys.has(profile.publicKey) || !
|
|
164
|
+
if (!profile || !this.#profilePublicKeys.has(profile.publicKey) || !isNewerBuzzRevision(profile, this.#profiles.get(profile.publicKey))) return false;
|
|
159
165
|
this.#profiles.set(profile.publicKey, profile);
|
|
160
166
|
return true;
|
|
161
167
|
}
|
|
162
168
|
applyRoomEvent(event) {
|
|
163
169
|
const room = parseBuzzDirectoryRoomEvent(event);
|
|
164
|
-
if (!room || !this.#configuredRoomIds.has(room.roomId) || !
|
|
170
|
+
if (!room || !this.#configuredRoomIds.has(room.roomId) || !isNewerBuzzRevision(room, this.#rooms.get(room.roomId))) return false;
|
|
165
171
|
this.#rooms.set(room.roomId, room);
|
|
166
172
|
return true;
|
|
167
173
|
}
|
|
@@ -489,7 +495,7 @@ async function queryCurrentProfiles(params) {
|
|
|
489
495
|
closeMessage: (reason) => `Buzz profile query closed: ${reason}`,
|
|
490
496
|
onEvent: (event) => {
|
|
491
497
|
const current = latestByKind.get(event.kind);
|
|
492
|
-
if (!current || event
|
|
498
|
+
if (!current || compareEvents(event, current) < 0) latestByKind.set(event.kind, event);
|
|
493
499
|
},
|
|
494
500
|
result: () => latestByKind,
|
|
495
501
|
onTimeout: params.onTimeout
|
|
@@ -511,6 +517,7 @@ async function syncBuzzProfile(params) {
|
|
|
511
517
|
...params,
|
|
512
518
|
onTimeout: params.onFatalError
|
|
513
519
|
});
|
|
520
|
+
params.signal?.throwIfAborted();
|
|
514
521
|
const currentMetadata = currentProfiles.get(PROFILE_KIND);
|
|
515
522
|
const currentAgentProfile = currentProfiles.get(AGENT_PROFILE_KIND);
|
|
516
523
|
const metadataContent = parseProfileContent(currentMetadata);
|
|
@@ -547,13 +554,17 @@ async function syncBuzzProfile(params) {
|
|
|
547
554
|
tags: currentAgentProfile?.tags.map((tag) => tag.slice()) ?? [],
|
|
548
555
|
secretKey: params.secretKey
|
|
549
556
|
}));
|
|
550
|
-
if (events.length === 0) return { status: "unchanged" };
|
|
551
|
-
for (const event of events) await params.relay.publish(event);
|
|
552
557
|
const lastEvent = events.at(-1);
|
|
553
|
-
|
|
558
|
+
if (!lastEvent) return { status: "unchanged" };
|
|
559
|
+
for (const event of events) {
|
|
560
|
+
params.signal?.throwIfAborted();
|
|
561
|
+
await params.relay.publish(event);
|
|
562
|
+
}
|
|
563
|
+
params.signal?.throwIfAborted();
|
|
564
|
+
return {
|
|
554
565
|
status: "published",
|
|
555
566
|
eventId: lastEvent.id
|
|
556
|
-
}
|
|
567
|
+
};
|
|
557
568
|
}
|
|
558
569
|
//#endregion
|
|
559
570
|
//#region extensions/buzz/src/replay-dispatch.ts
|
|
@@ -697,7 +708,7 @@ async function queryBuzzRoomMembershipBatch(params) {
|
|
|
697
708
|
closeMessage: (reason) => `Buzz room membership query closed: ${reason}`,
|
|
698
709
|
onEvent: (event) => {
|
|
699
710
|
const membership = parseBuzzRoomMembershipEvent(event, params.relayPublicKey);
|
|
700
|
-
if (membership && configuredRooms.has(membership.roomId) &&
|
|
711
|
+
if (membership && configuredRooms.has(membership.roomId) && isNewerBuzzRevision(membership, memberships.get(membership.roomId))) memberships.set(membership.roomId, membership);
|
|
701
712
|
},
|
|
702
713
|
result: () => memberships,
|
|
703
714
|
checkAbortAfterSubscribe: true
|
|
@@ -710,7 +721,7 @@ async function queryBuzzRoomMemberships(params) {
|
|
|
710
721
|
...params,
|
|
711
722
|
channelIds: params.channelIds.slice(index, index + RELAY_QUERY_EVENT_LIMIT)
|
|
712
723
|
});
|
|
713
|
-
for (const [roomId, membership] of batch) if (
|
|
724
|
+
for (const [roomId, membership] of batch) if (isNewerBuzzRevision(membership, memberships.get(roomId))) memberships.set(roomId, membership);
|
|
714
725
|
}
|
|
715
726
|
return memberships;
|
|
716
727
|
}
|
|
@@ -951,7 +962,7 @@ async function createBuzzRoomMembershipTracker(params) {
|
|
|
951
962
|
}
|
|
952
963
|
if (state.generation !== generation || !refreshed) continue;
|
|
953
964
|
const current = memberships.get(channelId);
|
|
954
|
-
if (current &&
|
|
965
|
+
if (current && isNewerBuzzRevision(current, refreshed)) refreshed = current;
|
|
955
966
|
const pending = pendingMemberships.get(channelId);
|
|
956
967
|
if (!(!pending || [...pending].every(([publicKey, expected]) => refreshed.members.has(publicKey) === (expected === "present")))) continue;
|
|
957
968
|
pendingMemberships.delete(channelId);
|
|
@@ -1010,7 +1021,7 @@ async function createBuzzRoomMembershipTracker(params) {
|
|
|
1010
1021
|
const handleRoomEvent = (event, reservation) => {
|
|
1011
1022
|
if (event.kind === 39002) {
|
|
1012
1023
|
const membership = parseBuzzRoomMembershipEvent(event, params.relayPublicKey);
|
|
1013
|
-
if (membership && memberships.has(membership.roomId) &&
|
|
1024
|
+
if (membership && memberships.has(membership.roomId) && isNewerBuzzRevision(membership, memberships.get(membership.roomId))) try {
|
|
1014
1025
|
replaceMembership(membership);
|
|
1015
1026
|
} catch (error) {
|
|
1016
1027
|
reportSystemEventError(error);
|
|
@@ -1118,13 +1129,11 @@ async function createBuzzRoomMembershipTracker(params) {
|
|
|
1118
1129
|
}
|
|
1119
1130
|
//#endregion
|
|
1120
1131
|
//#region extensions/buzz/src/subscription-budget.ts
|
|
1121
|
-
const BUZZ_RELAY_MAX_SUBSCRIPTIONS = 1024;
|
|
1122
|
-
const BUZZ_RELAY_NON_ROOM_PROFILE_SUBSCRIPTION_RESERVE = 4;
|
|
1123
1132
|
const BUZZ_DIRECTORY_MAX_PROFILE_SUBSCRIPTIONS = 10;
|
|
1124
|
-
const BUZZ_MAX_CONFIGURED_ROOMS =
|
|
1133
|
+
const BUZZ_MAX_CONFIGURED_ROOMS = 1020;
|
|
1125
1134
|
function resolveBuzzSubscriptionBudget(roomCount) {
|
|
1126
1135
|
if (!Number.isSafeInteger(roomCount) || roomCount < 0) throw new Error("Buzz configured room count must be a non-negative integer");
|
|
1127
|
-
const availableProfileSubscriptions =
|
|
1136
|
+
const availableProfileSubscriptions = 1020 - roomCount;
|
|
1128
1137
|
if (availableProfileSubscriptions < 0) throw new Error(`Buzz supports at most ${BUZZ_MAX_CONFIGURED_ROOMS} configured rooms per account`);
|
|
1129
1138
|
return { profileLimit: Math.min(BUZZ_DIRECTORY_MAX_PROFILE_SUBSCRIPTIONS, availableProfileSubscriptions) * 200 };
|
|
1130
1139
|
}
|
|
@@ -1132,7 +1141,7 @@ function resolveBuzzSubscriptionBudget(roomCount) {
|
|
|
1132
1141
|
//#region extensions/buzz/src/buzz-bus.ts
|
|
1133
1142
|
const PRESENCE_KIND = 20001;
|
|
1134
1143
|
const PRESENCE_HEARTBEAT_INTERVAL_MS = 3e4;
|
|
1135
|
-
const REPLAY_TTL_MS =
|
|
1144
|
+
const REPLAY_TTL_MS = 2592e6;
|
|
1136
1145
|
const REPLAY_MAX_ENTRIES = 1e4;
|
|
1137
1146
|
const REPLAY_STATE_MAX_ENTRIES = 5e4;
|
|
1138
1147
|
const REPLAY_NAMESPACE_PREFIX = "buzz.inbound-dedupe";
|
|
@@ -1297,6 +1306,7 @@ async function startBuzzBus(options) {
|
|
|
1297
1306
|
});
|
|
1298
1307
|
let directoryRelay;
|
|
1299
1308
|
let stopPresenceHeartbeat = () => {};
|
|
1309
|
+
let profileTask;
|
|
1300
1310
|
const bus = {
|
|
1301
1311
|
publicKey,
|
|
1302
1312
|
directory,
|
|
@@ -1337,6 +1347,7 @@ async function startBuzzBus(options) {
|
|
|
1337
1347
|
directoryRelay?.close();
|
|
1338
1348
|
replayGuard.clearMemory();
|
|
1339
1349
|
relay.close();
|
|
1350
|
+
await profileTask;
|
|
1340
1351
|
}
|
|
1341
1352
|
};
|
|
1342
1353
|
try {
|
|
@@ -1418,7 +1429,7 @@ async function startBuzzBus(options) {
|
|
|
1418
1429
|
onError: options.onPresenceError,
|
|
1419
1430
|
onFatalError: reportFatalError
|
|
1420
1431
|
});
|
|
1421
|
-
if (options.profileName?.trim()) syncBuzzProfile({
|
|
1432
|
+
if (options.profileName?.trim()) profileTask = syncBuzzProfile({
|
|
1422
1433
|
relay,
|
|
1423
1434
|
secretKey,
|
|
1424
1435
|
publicKey,
|
|
@@ -1427,7 +1438,7 @@ async function startBuzzBus(options) {
|
|
|
1427
1438
|
onFatalError: reportFatalError,
|
|
1428
1439
|
signal
|
|
1429
1440
|
}).then((result) => {
|
|
1430
|
-
if (result.status === "published") options.onProfilePublished?.(result.eventId);
|
|
1441
|
+
if (!signal.aborted && result.status === "published") options.onProfilePublished?.(result.eventId);
|
|
1431
1442
|
}).catch((error) => {
|
|
1432
1443
|
if (signal.aborted) return;
|
|
1433
1444
|
options.onProfileError?.(error instanceof Error ? error : new Error("Buzz profile sync failed", { cause: error }));
|
|
@@ -1442,6 +1453,66 @@ async function startBuzzBus(options) {
|
|
|
1442
1453
|
}
|
|
1443
1454
|
}
|
|
1444
1455
|
//#endregion
|
|
1456
|
+
//#region extensions/buzz/src/pending-history.ts
|
|
1457
|
+
const ENTRY_BYTES = 512;
|
|
1458
|
+
const CONTEXT_BYTES = 1024;
|
|
1459
|
+
async function recordBuzzPendingHistory(params) {
|
|
1460
|
+
await recordDroppedChannelInboundHistory({
|
|
1461
|
+
input: {
|
|
1462
|
+
id: params.message.id,
|
|
1463
|
+
timestamp: params.message.createdAt * 1e3,
|
|
1464
|
+
rawText: truncateUtf8Prefix(params.text, ENTRY_BYTES)
|
|
1465
|
+
},
|
|
1466
|
+
preflight: {
|
|
1467
|
+
admission: {
|
|
1468
|
+
kind: "drop",
|
|
1469
|
+
reason: "missing-mention",
|
|
1470
|
+
recordHistory: true
|
|
1471
|
+
},
|
|
1472
|
+
message: { senderLabel: params.message.senderPubkey },
|
|
1473
|
+
history: {
|
|
1474
|
+
historyMap: params.historyMap,
|
|
1475
|
+
key: params.key,
|
|
1476
|
+
limit: params.limit,
|
|
1477
|
+
shouldRecord: params.shouldRecord
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
function snapshotBuzzPendingHistory(params) {
|
|
1483
|
+
const { historyMap, key, directory } = params;
|
|
1484
|
+
const pending = createChannelHistoryWindow({ historyMap }).buildInboundHistory({
|
|
1485
|
+
historyKey: key,
|
|
1486
|
+
limit: params.limit
|
|
1487
|
+
}) ?? [];
|
|
1488
|
+
const entries = [];
|
|
1489
|
+
let historyText = "";
|
|
1490
|
+
for (const entry of pending.toReversed()) {
|
|
1491
|
+
if (!directory.isMember(params.channelId, entry.sender)) continue;
|
|
1492
|
+
const nextText = [`${truncateUtf8Prefix(directory.resolveSenderName(entry.sender), 128)}: ${entry.body}`, historyText].filter(Boolean).join("\n");
|
|
1493
|
+
if (Buffer.byteLength(buildHistoryContext({
|
|
1494
|
+
historyText: nextText,
|
|
1495
|
+
currentMessage: ""
|
|
1496
|
+
})) > CONTEXT_BYTES) break;
|
|
1497
|
+
entries.unshift(entry);
|
|
1498
|
+
historyText = nextText;
|
|
1499
|
+
}
|
|
1500
|
+
if (entries.length) historyMap.set(key, entries);
|
|
1501
|
+
else historyMap.delete(key);
|
|
1502
|
+
const consumedIds = new Set(entries.map((entry) => entry.messageId));
|
|
1503
|
+
return {
|
|
1504
|
+
bodyForAgent: buildHistoryContext({
|
|
1505
|
+
historyText,
|
|
1506
|
+
currentMessage: params.currentMessage
|
|
1507
|
+
}),
|
|
1508
|
+
consume: () => {
|
|
1509
|
+
const remaining = historyMap.get(key)?.filter((entry) => !consumedIds.has(entry.messageId));
|
|
1510
|
+
if (remaining?.length) historyMap.set(key, remaining);
|
|
1511
|
+
else historyMap.delete(key);
|
|
1512
|
+
}
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
//#endregion
|
|
1445
1516
|
//#region extensions/buzz/src/runtime.ts
|
|
1446
1517
|
const { setRuntime: setBuzzRuntime, getRuntime: getBuzzRuntime } = createPluginRuntimeStore({
|
|
1447
1518
|
pluginId: "buzz",
|
|
@@ -1506,7 +1577,38 @@ async function handleBuzzInbound(params) {
|
|
|
1506
1577
|
} : void 0
|
|
1507
1578
|
});
|
|
1508
1579
|
params.assertCurrent();
|
|
1509
|
-
|
|
1580
|
+
const historyKey = JSON.stringify([channelId, message.threadId ?? null]);
|
|
1581
|
+
const historyLimit = account.config.historyLimit ?? 0;
|
|
1582
|
+
if (access.ingress.admission !== "dispatch") {
|
|
1583
|
+
if (access.ingress.reasonCode === "activation_skipped") {
|
|
1584
|
+
const groupsPath = (cfg.channels?.buzz)?.accounts?.[account.accountId] ? `channels.buzz.accounts[${JSON.stringify(account.accountId)}].groups` : "channels.buzz.groups";
|
|
1585
|
+
logInboundDrop({
|
|
1586
|
+
log: log.info,
|
|
1587
|
+
channel: "buzz",
|
|
1588
|
+
reason: "no mention",
|
|
1589
|
+
target: channelId,
|
|
1590
|
+
onceKey: JSON.stringify([account.accountId, channelId]),
|
|
1591
|
+
hint: `Mention patterns can be derived from the agent identity name. Set ${groupsPath}[${JSON.stringify(channelId)}].requireMention=false to process messages without a mention.`
|
|
1592
|
+
});
|
|
1593
|
+
await recordBuzzPendingHistory({
|
|
1594
|
+
historyMap: params.historyMap,
|
|
1595
|
+
key: historyKey,
|
|
1596
|
+
limit: historyLimit,
|
|
1597
|
+
message,
|
|
1598
|
+
text: textForAgent,
|
|
1599
|
+
shouldRecord: () => !signal.aborted && bus.directory.isMember(channelId, message.senderPubkey)
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
return;
|
|
1603
|
+
}
|
|
1604
|
+
const history = snapshotBuzzPendingHistory({
|
|
1605
|
+
historyMap: params.historyMap,
|
|
1606
|
+
key: historyKey,
|
|
1607
|
+
limit: historyLimit,
|
|
1608
|
+
channelId,
|
|
1609
|
+
directory: bus.directory,
|
|
1610
|
+
currentMessage: textForAgent
|
|
1611
|
+
});
|
|
1510
1612
|
const senderName = bus.directory.resolveSenderName(message.senderPubkey);
|
|
1511
1613
|
const roomName = bus.directory.resolveRoomName(channelId);
|
|
1512
1614
|
const body = buildEnvelope({
|
|
@@ -1549,7 +1651,7 @@ async function handleBuzzInbound(params) {
|
|
|
1549
1651
|
},
|
|
1550
1652
|
message: {
|
|
1551
1653
|
body,
|
|
1552
|
-
bodyForAgent:
|
|
1654
|
+
bodyForAgent: history.bodyForAgent,
|
|
1553
1655
|
rawBody: message.text,
|
|
1554
1656
|
commandBody: supportsTextInterpretation ? message.text : ""
|
|
1555
1657
|
},
|
|
@@ -1567,10 +1669,10 @@ async function handleBuzzInbound(params) {
|
|
|
1567
1669
|
});
|
|
1568
1670
|
const replyTarget = {
|
|
1569
1671
|
channelId,
|
|
1570
|
-
threadId: message.threadId,
|
|
1571
|
-
replyToId: message.threadId ?? message.id
|
|
1672
|
+
threadId: account.config.replyToMode === "off" ? void 0 : message.threadId,
|
|
1673
|
+
replyToId: account.config.replyToMode === "off" ? void 0 : message.threadId ?? message.id
|
|
1572
1674
|
};
|
|
1573
|
-
await runtime.channel.inbound.dispatch({
|
|
1675
|
+
if ((await runtime.channel.inbound.dispatch({
|
|
1574
1676
|
cfg,
|
|
1575
1677
|
channel: "buzz",
|
|
1576
1678
|
accountId: account.accountId,
|
|
@@ -1580,6 +1682,18 @@ async function handleBuzzInbound(params) {
|
|
|
1580
1682
|
sessionKey: route.sessionKey
|
|
1581
1683
|
},
|
|
1582
1684
|
ctxPayload,
|
|
1685
|
+
botLoopProtection: bus.directory.isBotMember(channelId, message.senderPubkey) ? {
|
|
1686
|
+
scopeId: `buzz:${normalizeURL(account.relayUrl)}`,
|
|
1687
|
+
conversationId: channelId,
|
|
1688
|
+
senderId: message.senderPubkey,
|
|
1689
|
+
receiverId: bus.publicKey,
|
|
1690
|
+
eventId: message.id,
|
|
1691
|
+
defaultsConfig: cfg.channels?.defaults?.botLoopProtection,
|
|
1692
|
+
defaultEnabled: true
|
|
1693
|
+
} : void 0,
|
|
1694
|
+
log: (event) => {
|
|
1695
|
+
if (event.reason === "bot-loop-protection") log.warn(`[${account.accountId}] Buzz bot-pair loop suppressed in ${channelId}`);
|
|
1696
|
+
},
|
|
1583
1697
|
delivery: {
|
|
1584
1698
|
deliver: async (payload) => {
|
|
1585
1699
|
const text = payload && typeof payload === "object" && "text" in payload ? payload.text ?? "" : "";
|
|
@@ -1606,7 +1720,7 @@ async function handleBuzzInbound(params) {
|
|
|
1606
1720
|
record: { onRecordError: (error) => {
|
|
1607
1721
|
throw error instanceof Error ? error : /* @__PURE__ */ new Error(`Buzz session record failed: ${String(error)}`);
|
|
1608
1722
|
} }
|
|
1609
|
-
});
|
|
1723
|
+
})).dispatched) history.consume();
|
|
1610
1724
|
}
|
|
1611
1725
|
//#endregion
|
|
1612
1726
|
//#region extensions/buzz/src/recovery-watermark.ts
|
|
@@ -1650,7 +1764,7 @@ const RECONNECT_BACKOFF = {
|
|
|
1650
1764
|
jitter: .2
|
|
1651
1765
|
};
|
|
1652
1766
|
const RECONNECT_STABLE_MS = 6e4;
|
|
1653
|
-
const RECONNECT_LOOKBACK_SECONDS =
|
|
1767
|
+
const RECONNECT_LOOKBACK_SECONDS = 86400;
|
|
1654
1768
|
function getActiveBuzzBus(accountId) {
|
|
1655
1769
|
return activeBuses.get(accountId);
|
|
1656
1770
|
}
|
|
@@ -1677,7 +1791,13 @@ async function startBuzzGatewayAccount(ctx) {
|
|
|
1677
1791
|
assertBuzzAccountAvailable(account);
|
|
1678
1792
|
if (!account.configured) throw new Error(`Buzz is not configured for account "${account.accountId}"`);
|
|
1679
1793
|
const channelIds = Object.entries(account.config.groups ?? {}).filter(([, config]) => config.enabled !== false).map(([channelId]) => parseBuzzTarget(channelId));
|
|
1680
|
-
if (channelIds.length === 0)
|
|
1794
|
+
if (channelIds.length === 0) {
|
|
1795
|
+
const { configPath } = resolveBuzzAccountConfig({
|
|
1796
|
+
cfg: ctx.cfg,
|
|
1797
|
+
accountId: account.accountId
|
|
1798
|
+
});
|
|
1799
|
+
throw new Error(`Buzz requires at least one enabled ${configPath}.groups entry`);
|
|
1800
|
+
}
|
|
1681
1801
|
const configuredChannelIds = new Set(channelIds);
|
|
1682
1802
|
const profileName = resolveBuzzProfileName({
|
|
1683
1803
|
cfg: ctx.cfg,
|
|
@@ -1687,6 +1807,7 @@ async function startBuzzGatewayAccount(ctx) {
|
|
|
1687
1807
|
const watermarkStore = openBuzzRecoveryWatermarkStore({ accountId: account.accountId });
|
|
1688
1808
|
let reconnectAttempt = 0;
|
|
1689
1809
|
while (!ctx.abortSignal.aborted) {
|
|
1810
|
+
const historyMap = /* @__PURE__ */ new Map();
|
|
1690
1811
|
let bus;
|
|
1691
1812
|
let cycleError;
|
|
1692
1813
|
let connectedAt;
|
|
@@ -1720,6 +1841,7 @@ async function startBuzzGatewayAccount(ctx) {
|
|
|
1720
1841
|
message,
|
|
1721
1842
|
signal,
|
|
1722
1843
|
assertCurrent,
|
|
1844
|
+
historyMap,
|
|
1723
1845
|
buildContext
|
|
1724
1846
|
});
|
|
1725
1847
|
},
|
|
@@ -1769,6 +1891,7 @@ async function startBuzzGatewayAccount(ctx) {
|
|
|
1769
1891
|
} finally {
|
|
1770
1892
|
if (activeBuses.get(account.accountId) === bus) activeBuses.delete(account.accountId);
|
|
1771
1893
|
await bus?.close();
|
|
1894
|
+
historyMap.clear();
|
|
1772
1895
|
ctx.setStatus({
|
|
1773
1896
|
accountId: account.accountId,
|
|
1774
1897
|
running: false,
|
|
@@ -1799,11 +1922,11 @@ const buzzOutboundAdapter = {
|
|
|
1799
1922
|
} },
|
|
1800
1923
|
sendText: async ({ cfg, to, text, accountId, threadId, replyToId }) => {
|
|
1801
1924
|
const runtime = getBuzzRuntime();
|
|
1802
|
-
const resolvedAccountId = accountId ?? resolveDefaultBuzzAccountId(cfg);
|
|
1803
1925
|
const account = resolveBuzzAccount({
|
|
1804
1926
|
cfg,
|
|
1805
|
-
accountId
|
|
1927
|
+
accountId
|
|
1806
1928
|
});
|
|
1929
|
+
const resolvedAccountId = account.accountId;
|
|
1807
1930
|
assertBuzzAccountAvailable(account);
|
|
1808
1931
|
if (!account.enabled) throw new Error(`Buzz is disabled for account ${resolvedAccountId}`);
|
|
1809
1932
|
if (!account.configured) throw new Error(`Buzz is not configured for account ${resolvedAccountId}`);
|
|
@@ -1820,24 +1943,26 @@ const buzzOutboundAdapter = {
|
|
|
1820
1943
|
threadId: threadId == null ? void 0 : String(threadId),
|
|
1821
1944
|
replyToId: replyToId == null ? void 0 : String(replyToId)
|
|
1822
1945
|
};
|
|
1946
|
+
const messageId = bus ? await bus.sendText(outboundMessage) : await sendBuzzTextOneShot({
|
|
1947
|
+
relayUrl: account.relayUrl,
|
|
1948
|
+
privateKey: account.privateKey,
|
|
1949
|
+
authTag: account.authTag,
|
|
1950
|
+
...outboundMessage
|
|
1951
|
+
});
|
|
1823
1952
|
return attachChannelToResult("buzz", {
|
|
1824
1953
|
to: channelId,
|
|
1825
|
-
messageId
|
|
1826
|
-
relayUrl: account.relayUrl,
|
|
1827
|
-
privateKey: account.privateKey,
|
|
1828
|
-
authTag: account.authTag,
|
|
1829
|
-
...outboundMessage
|
|
1830
|
-
})
|
|
1954
|
+
messageId
|
|
1831
1955
|
});
|
|
1832
1956
|
}
|
|
1833
1957
|
};
|
|
1834
1958
|
async function sendBuzzTyping(params) {
|
|
1835
|
-
const
|
|
1836
|
-
|
|
1959
|
+
const account = resolveBuzzAccountConfig(params);
|
|
1960
|
+
if (!account.config.enabled) return;
|
|
1961
|
+
const bus = activeBuses.get(account.accountId);
|
|
1837
1962
|
if (!bus) return;
|
|
1838
1963
|
await bus.sendTyping({
|
|
1839
1964
|
channelId: parseBuzzTarget(params.to),
|
|
1840
|
-
threadId: params.threadId == null ? void 0 : String(params.threadId)
|
|
1965
|
+
threadId: account.config.replyToMode === "off" || params.threadId == null ? void 0 : String(params.threadId)
|
|
1841
1966
|
});
|
|
1842
1967
|
}
|
|
1843
1968
|
//#endregion
|
|
@@ -1851,7 +1976,7 @@ function createConfiguredDirectoryState(params) {
|
|
|
1851
1976
|
cfg: params.cfg,
|
|
1852
1977
|
accountId: params.accountId
|
|
1853
1978
|
});
|
|
1854
|
-
assertBuzzAccountAvailable(account);
|
|
1979
|
+
if (account.enabled) assertBuzzAccountAvailable(account);
|
|
1855
1980
|
if (!account.publicKey) return null;
|
|
1856
1981
|
const channelIds = resolveConfiguredRoomIds(account);
|
|
1857
1982
|
return {
|
|
@@ -1866,7 +1991,7 @@ function createConfiguredDirectoryState(params) {
|
|
|
1866
1991
|
}
|
|
1867
1992
|
async function loadBuzzDirectoryState(params, options) {
|
|
1868
1993
|
const configured = createConfiguredDirectoryState(params);
|
|
1869
|
-
if (!configured || !configured.account.configured || configured.channelIds.length === 0) return configured?.state ?? null;
|
|
1994
|
+
if (!configured || !configured.account.enabled || !configured.account.configured || configured.channelIds.length === 0) return configured?.state ?? null;
|
|
1870
1995
|
const activeBus = getActiveBuzzBus(configured.account.accountId);
|
|
1871
1996
|
if (activeBus) {
|
|
1872
1997
|
if (options.refreshRooms) try {
|
|
@@ -1917,6 +2042,7 @@ async function listBuzzDirectoryPeersLive(params) {
|
|
|
1917
2042
|
}) ?? [];
|
|
1918
2043
|
}
|
|
1919
2044
|
async function listBuzzDirectoryGroupsLive(params) {
|
|
2045
|
+
if (!resolveBuzzAccountConfig(params).config.enabled) return listBuzzDirectoryGroupsFromConfig(params);
|
|
1920
2046
|
return (await loadBuzzDirectoryState(params, { refreshRooms: true }))?.listGroups({
|
|
1921
2047
|
query: params.query,
|
|
1922
2048
|
limit: params.limit
|
|
@@ -1951,8 +2077,15 @@ const buzzPlugin = createChatChannelPlugin({
|
|
|
1951
2077
|
chatTypes: ["group"],
|
|
1952
2078
|
threads: true
|
|
1953
2079
|
},
|
|
2080
|
+
threading: { resolveReplyTransport: ({ replyDelivery }) => replyDelivery?.replyToMode === "off" ? {
|
|
2081
|
+
threadId: null,
|
|
2082
|
+
replyToId: null
|
|
2083
|
+
} : null },
|
|
1954
2084
|
agentPrompt: { messageToolHints: () => ["- Buzz targets: use a configured room UUID, `buzz:<ROOM_UUID>`, or a unique current room name. Use the UUID when room names are ambiguous.", "- Buzz mentions: write a unique current room member as `@Display Name`. For an explicit identity, include `nostr:npub...`; the public key must belong to the target room. Any unresolved or ambiguous label needs an explicit identity for every intended member."] },
|
|
1955
|
-
reload: {
|
|
2085
|
+
reload: {
|
|
2086
|
+
configPrefixes: ["channels.buzz"],
|
|
2087
|
+
accountScopedRestart: true
|
|
2088
|
+
},
|
|
1956
2089
|
configSchema: BuzzConfigSchema,
|
|
1957
2090
|
setupContract: buzzSetupContract,
|
|
1958
2091
|
setupWizard: buzzSetupWizard,
|
|
@@ -1996,21 +2129,22 @@ const buzzPlugin = createChatChannelPlugin({
|
|
|
1996
2129
|
},
|
|
1997
2130
|
resolveOutboundSessionRoute: ({ cfg, agentId, accountId, target, replyToId, threadId, currentSessionKey }) => {
|
|
1998
2131
|
const normalized = buildBuzzTarget(parseBuzzTarget(target));
|
|
2132
|
+
const baseRoute = buildChannelOutboundSessionRoute({
|
|
2133
|
+
cfg,
|
|
2134
|
+
agentId,
|
|
2135
|
+
channel: "buzz",
|
|
2136
|
+
accountId,
|
|
2137
|
+
recipientSessionExact: true,
|
|
2138
|
+
peer: {
|
|
2139
|
+
kind: "group",
|
|
2140
|
+
id: normalized
|
|
2141
|
+
},
|
|
2142
|
+
chatType: "group",
|
|
2143
|
+
from: `buzz:${accountId ?? "default"}`,
|
|
2144
|
+
to: normalized
|
|
2145
|
+
});
|
|
1999
2146
|
return buildThreadAwareOutboundSessionRoute({
|
|
2000
|
-
route:
|
|
2001
|
-
cfg,
|
|
2002
|
-
agentId,
|
|
2003
|
-
channel: "buzz",
|
|
2004
|
-
accountId,
|
|
2005
|
-
recipientSessionExact: true,
|
|
2006
|
-
peer: {
|
|
2007
|
-
kind: "group",
|
|
2008
|
-
id: normalized
|
|
2009
|
-
},
|
|
2010
|
-
chatType: "group",
|
|
2011
|
-
from: `buzz:${accountId ?? "default"}`,
|
|
2012
|
-
to: normalized
|
|
2013
|
-
}),
|
|
2147
|
+
route: baseRoute,
|
|
2014
2148
|
replyToId,
|
|
2015
2149
|
threadId,
|
|
2016
2150
|
currentSessionKey,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as buzzPlugin } from "./channel-
|
|
1
|
+
import { t as buzzPlugin } from "./channel-Czma0_CC.js";
|
|
2
2
|
export { buzzPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as resolveBuzzAccount, m as parseBuzzTarget, u as buildBuzzTarget } from "./types-CeupBG0P.js";
|
|
2
2
|
//#region extensions/buzz/src/directory-config.ts
|
|
3
3
|
function applyQueryAndLimit(entries, params) {
|
|
4
4
|
const query = params.query?.trim().toLowerCase() ?? "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as listBuzzDirectoryPeersFromConfig, t as listBuzzDirectoryGroupsFromConfig } from "./directory-config-
|
|
1
|
+
import { n as listBuzzDirectoryPeersFromConfig, t as listBuzzDirectoryGroupsFromConfig } from "./directory-config-B0shiBa4.js";
|
|
2
2
|
//#region extensions/buzz/directory-contract-api.ts
|
|
3
3
|
const buzzDirectoryContractPlugin = {
|
|
4
4
|
id: "buzz",
|
|
@@ -177,8 +177,8 @@ const BUZZ_INBOUND_MESSAGE_KINDS = [
|
|
|
177
177
|
BUZZ_RICH_MESSAGE_KIND,
|
|
178
178
|
BUZZ_DIFF_MESSAGE_KIND
|
|
179
179
|
];
|
|
180
|
-
const BUZZ_MESSAGE_CONTENT_MAX_BYTES =
|
|
181
|
-
const BUZZ_DIFF_CONTENT_MAX_BYTES =
|
|
180
|
+
const BUZZ_MESSAGE_CONTENT_MAX_BYTES = 262144;
|
|
181
|
+
const BUZZ_DIFF_CONTENT_MAX_BYTES = 61440;
|
|
182
182
|
const HEX_PUBLIC_KEY_PATTERN = /^[0-9a-f]{64}$/u;
|
|
183
183
|
const BUZZ_DIFF_CONTEXT_FIELD_MAX_CHARS = 256;
|
|
184
184
|
const BUZZ_DIFF_AGENT_CONTEXT_MAX_CHARS = 4e3;
|
|
@@ -251,10 +251,7 @@ function parseBuzzDiffMetadata(event) {
|
|
|
251
251
|
case "truncated":
|
|
252
252
|
truncated ||= value === "true";
|
|
253
253
|
break;
|
|
254
|
-
case "alt":
|
|
255
|
-
altText ??= value;
|
|
256
|
-
break;
|
|
257
|
-
default: break;
|
|
254
|
+
case "alt": altText ??= value;
|
|
258
255
|
}
|
|
259
256
|
}
|
|
260
257
|
if (!repoUrl || !commitSha) return null;
|
|
@@ -275,7 +272,7 @@ function parseBuzzDiffMetadata(event) {
|
|
|
275
272
|
function boundedDiffContextValue(value) {
|
|
276
273
|
const singleLine = value.replace(/\s+/gu, " ").trim();
|
|
277
274
|
if (singleLine.length <= BUZZ_DIFF_CONTEXT_FIELD_MAX_CHARS) return singleLine;
|
|
278
|
-
return `${truncateUtf16Safe(singleLine,
|
|
275
|
+
return `${truncateUtf16Safe(singleLine, 253)}...`;
|
|
279
276
|
}
|
|
280
277
|
function formatBuzzMessageForAgent(message) {
|
|
281
278
|
if (message.kind !== 40008 || !message.diff) return message.text;
|
|
@@ -300,7 +297,7 @@ function formatBuzzMessageForAgent(message) {
|
|
|
300
297
|
const fullContext = `${prefix}\n${message.text}`;
|
|
301
298
|
if (fullContext.length <= BUZZ_DIFF_AGENT_CONTEXT_MAX_CHARS) return fullContext;
|
|
302
299
|
const bodyBudget = BUZZ_DIFF_AGENT_CONTEXT_MAX_CHARS - prefix.length - 1 - 43;
|
|
303
|
-
if (bodyBudget <= 0) return `${truncateUtf16Safe(prefix,
|
|
300
|
+
if (bodyBudget <= 0) return `${truncateUtf16Safe(prefix, 3957).trimEnd()}${BUZZ_DIFF_AGENT_CONTEXT_TRUNCATED_SUFFIX}`;
|
|
304
301
|
return `${prefix}\n${truncateUtf16Safe(message.text, bodyBudget).trimEnd()}${BUZZ_DIFF_AGENT_CONTEXT_TRUNCATED_SUFFIX}`;
|
|
305
302
|
}
|
|
306
303
|
function parseBuzzMessageEvent(event) {
|
package/dist/qa-runner-api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLazyCliRuntimeLoader, createLiveTransportQaCliRegistration, runLiveTransportQaSuiteCommand } from "openclaw/plugin-sdk/qa-runner-runtime";
|
|
2
2
|
//#region extensions/buzz/src/qa/cli.ts
|
|
3
3
|
const DEFAULT_BUZZ_QA_SCENARIOS = ["channel-canary", "channel-mention-gating"];
|
|
4
|
-
const loadBuzzQaAdapterRuntime = createLazyCliRuntimeLoader(() => import("./adapter.runtime-
|
|
4
|
+
const loadBuzzQaAdapterRuntime = createLazyCliRuntimeLoader(() => import("./adapter.runtime-CaDdxQ2C.js"));
|
|
5
5
|
async function runQaBuzz(options) {
|
|
6
6
|
await runLiveTransportQaSuiteCommand({
|
|
7
7
|
channelId: "buzz",
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as BUZZ_CHANNEL_ID_PATTERN } from "./types-CeupBG0P.js";
|
|
2
2
|
import { Relay, finalizeEvent } from "nostr-tools";
|
|
3
3
|
import { readProviderJsonObjectResponse } from "openclaw/plugin-sdk/provider-http";
|
|
4
4
|
import { fetchWithSsrFGuard, ssrfPolicyFromHttpBaseUrlAllowedOrigin } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
5
|
+
//#region extensions/buzz/src/event-order.ts
|
|
6
|
+
function isNewerBuzzRevision(candidate, current) {
|
|
7
|
+
return !current || candidate.createdAt > current.createdAt || candidate.createdAt === current.createdAt && candidate.eventId < current.eventId;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
5
10
|
//#region extensions/buzz/src/relay-subscription.ts
|
|
6
11
|
function openBuzzRelaySubscription(relay, filters, params, requestFilters = filters) {
|
|
7
12
|
relay.idleSince = void 0;
|
|
@@ -252,9 +257,6 @@ function parseBuzzRoomMembershipEvent(event, relayPublicKey) {
|
|
|
252
257
|
roles
|
|
253
258
|
};
|
|
254
259
|
}
|
|
255
|
-
function isNewerBuzzRoomMembership(candidate, current) {
|
|
256
|
-
return !current || candidate.createdAt > current.createdAt || candidate.createdAt === current.createdAt && candidate.eventId < current.eventId;
|
|
257
|
-
}
|
|
258
260
|
function parseBuzzRoomMembershipChangeEvent(event, membership) {
|
|
259
261
|
if (event.kind !== 40099 || event.pubkey.toLowerCase() !== membership.publisherPublicKey || !event.tags.some((tag) => tag[0] === "h" && tag[1]?.toLowerCase() === membership.roomId)) return;
|
|
260
262
|
try {
|
|
@@ -271,4 +273,4 @@ function parseBuzzRoomMembershipChangeEvent(event, membership) {
|
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
275
|
//#endregion
|
|
274
|
-
export {
|
|
276
|
+
export { connectAuthenticatedBuzzRelay as a, openBuzzRelaySubscription as c, parseBuzzRoomMembershipEvent as i, queryBuzzRelaySnapshot as l, BUZZ_ROOM_SYSTEM_KIND as n, connectAuthenticatedBuzzRelaySession as o, parseBuzzRoomMembershipChangeEvent as r, parseBuzzAuthTag as s, BUZZ_ROOM_MEMBERSHIP_KIND as t, isNewerBuzzRevision as u };
|