@fabric-harness/channels 0.17.4 → 0.19.0
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/README.md +116 -0
- package/dist/buzz-decisions.d.ts +200 -0
- package/dist/buzz-decisions.d.ts.map +1 -0
- package/dist/buzz-decisions.js +300 -0
- package/dist/buzz-decisions.js.map +1 -0
- package/dist/buzz-kinds.d.ts +34 -0
- package/dist/buzz-kinds.d.ts.map +1 -0
- package/dist/buzz-kinds.js +34 -0
- package/dist/buzz-kinds.js.map +1 -0
- package/dist/buzz-postgres.d.ts +33 -0
- package/dist/buzz-postgres.d.ts.map +1 -0
- package/dist/buzz-postgres.js +163 -0
- package/dist/buzz-postgres.js.map +1 -0
- package/dist/buzz-tail.d.ts +162 -0
- package/dist/buzz-tail.d.ts.map +1 -0
- package/dist/buzz-tail.js +487 -0
- package/dist/buzz-tail.js.map +1 -0
- package/dist/buzz.d.ts +183 -0
- package/dist/buzz.d.ts.map +1 -0
- package/dist/buzz.js +423 -0
- package/dist/buzz.js.map +1 -0
- package/dist/compatibility.d.ts +7 -0
- package/dist/compatibility.d.ts.map +1 -1
- package/dist/compatibility.js +1 -0
- package/dist/compatibility.js.map +1 -1
- package/package.json +26 -9
package/dist/buzz.d.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { Channel, ToolDef } from "@fabric-harness/sdk/channel";
|
|
2
|
+
import type { BuzzCardReceiptStore } from "./buzz-decisions.js";
|
|
3
|
+
/**
|
|
4
|
+
* Buzz channel — event ingress from a Buzz relay (block/buzz) and outbound
|
|
5
|
+
* posting tools.
|
|
6
|
+
*
|
|
7
|
+
* Buzz pushes over WebSocket (Nostr NIP-01), not webhooks, so ingress arrives
|
|
8
|
+
* via the `buzz-tail` transport shim (`./buzz-tail`), which holds a NIP-42
|
|
9
|
+
* authenticated subscription and forwards each event to this channel's
|
|
10
|
+
* `/events` route inside an `X-Fabric-Signature: v1=` HMAC envelope. A future
|
|
11
|
+
* Buzz workflow `call_webhook` egress can target the same route — one
|
|
12
|
+
* normalizer, two transports.
|
|
13
|
+
*
|
|
14
|
+
* Governance boundaries (Fabric Buzz Collaboration Plan D7/D11): this adapter
|
|
15
|
+
* performs no authorization and never talks to Temporal. It stamps the Nostr
|
|
16
|
+
* pubkey as the acting `actor` (candidate identity); binding resolution and
|
|
17
|
+
* capability checks happen in the vertical's governed decision-ingress action.
|
|
18
|
+
* Stock Buzz Desktop reactions omit the NIP-29 channel tag, so the adapter may
|
|
19
|
+
* derive that transport scope from one exact, persisted decision-card receipt;
|
|
20
|
+
* the receipt grants no decision authority.
|
|
21
|
+
*/
|
|
22
|
+
/** Nostr event shape (NIP-01). Kept local so the handler path stays SDK-only. */
|
|
23
|
+
export interface BuzzEvent {
|
|
24
|
+
id: string;
|
|
25
|
+
pubkey: string;
|
|
26
|
+
created_at: number;
|
|
27
|
+
kind: number;
|
|
28
|
+
tags: string[][];
|
|
29
|
+
content: string;
|
|
30
|
+
sig: string;
|
|
31
|
+
}
|
|
32
|
+
export interface BuzzEnvelope {
|
|
33
|
+
/** Community identifier (relay-host-derived tenant boundary). */
|
|
34
|
+
community?: string;
|
|
35
|
+
/** Source relay URL (informational). */
|
|
36
|
+
relayUrl?: string;
|
|
37
|
+
event?: BuzzEvent;
|
|
38
|
+
}
|
|
39
|
+
export interface BuzzThreadRef {
|
|
40
|
+
community: string;
|
|
41
|
+
channelId: string;
|
|
42
|
+
rootEventId: string;
|
|
43
|
+
}
|
|
44
|
+
export interface BuzzChannelOptions {
|
|
45
|
+
/** Persistent agent that inbound Buzz events dispatch to. */
|
|
46
|
+
agent: string;
|
|
47
|
+
/** Shared secret for the tail→route envelope (`X-Fabric-Signature: v1=`). */
|
|
48
|
+
sharedSecret: string;
|
|
49
|
+
/**
|
|
50
|
+
* The adapter identity's public key (64-char hex). Events authored by this
|
|
51
|
+
* key are ignored (loop suppression). Derive with `buzzPublicKey(secretKey)`.
|
|
52
|
+
*/
|
|
53
|
+
selfPubkey: string;
|
|
54
|
+
/**
|
|
55
|
+
* Server-owned tenant for this relay deployment (plan D7). The Fabric
|
|
56
|
+
* tenant is configuration, never taken from the event or envelope; an
|
|
57
|
+
* envelope claiming a different community is refused with 403.
|
|
58
|
+
*/
|
|
59
|
+
community: string;
|
|
60
|
+
/**
|
|
61
|
+
* Server-owned channel allowlist for this deployment. When present,
|
|
62
|
+
* channel-tagged events outside this list are ignored. This list is also
|
|
63
|
+
* required for receipt-aware correlation of stock Buzz Desktop reactions,
|
|
64
|
+
* whose NIP-25 events carry an `e` target but no `h` channel tag.
|
|
65
|
+
*/
|
|
66
|
+
channels?: readonly string[];
|
|
67
|
+
/**
|
|
68
|
+
* Durable decision-card receipt lookup. When this and `channels` are set, an
|
|
69
|
+
* `h`-less reaction is admitted only if its sole `e` target exactly matches
|
|
70
|
+
* one receipt in one configured channel. The channel is derived from that
|
|
71
|
+
* receipt; the adapter still performs no identity or decision authorization.
|
|
72
|
+
*/
|
|
73
|
+
decisionReceiptStore?: Pick<BuzzCardReceiptStore, "findByCardEvent">;
|
|
74
|
+
/** Max clock skew (seconds) tolerated on the envelope timestamp. Default 300. */
|
|
75
|
+
maxSkewSeconds?: number;
|
|
76
|
+
/** Clock injection for tests. */
|
|
77
|
+
now?: () => number;
|
|
78
|
+
}
|
|
79
|
+
export interface BuzzChannel extends Channel {
|
|
80
|
+
conversationKey(ref: BuzzThreadRef): string;
|
|
81
|
+
parseConversationKey(id: string): BuzzThreadRef;
|
|
82
|
+
}
|
|
83
|
+
/** Derive the adapter identity's public key from its secret key (64-char hex). */
|
|
84
|
+
export declare function buzzPublicKey(secretKeyHex: string): string;
|
|
85
|
+
/** Serialize a Buzz thread into the stable instance id used by `createBuzzChannel`. */
|
|
86
|
+
export declare function buzzConversationKey(ref: BuzzThreadRef): string;
|
|
87
|
+
/** Parse a Buzz instance id back into the thread ref. */
|
|
88
|
+
export declare function parseBuzzConversationKey(id: string): BuzzThreadRef;
|
|
89
|
+
/** Family signed-envelope standard: `v1=hex(hmac-sha256(secret, "<ts>.<body>"))`. */
|
|
90
|
+
export declare function signBuzzEnvelope(secret: string, timestampSeconds: number, rawBody: string): Promise<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Buzz events channel. Verifies the tail envelope HMAC (timestamped, replay
|
|
93
|
+
* bounded), verifies the inner event's Schnorr signature, normalizes stream
|
|
94
|
+
* messages / forum posts / reactions, and dispatches to a persistent agent
|
|
95
|
+
* keyed by (community, channel, thread root) — with the Nostr event id as the
|
|
96
|
+
* dedupe key (exactly-once), the community as tenant, and the author pubkey as
|
|
97
|
+
* the acting `actor`.
|
|
98
|
+
*/
|
|
99
|
+
export declare function createBuzzChannel(options: BuzzChannelOptions): BuzzChannel;
|
|
100
|
+
/** Convert a relay WebSocket URL to its HTTP origin (Buzz serves both on one port). */
|
|
101
|
+
export declare function buzzHttpUrl(relayUrl: string): string;
|
|
102
|
+
export interface BuzzPostConfig {
|
|
103
|
+
/** Relay URL (`ws://` or `http://` form both accepted). */
|
|
104
|
+
relayUrl: string;
|
|
105
|
+
/** Adapter identity secret key (64-char hex). */
|
|
106
|
+
secretKey: string;
|
|
107
|
+
fetchImpl?: typeof fetch;
|
|
108
|
+
/** Clock injection for tests (event `created_at`). */
|
|
109
|
+
now?: () => number;
|
|
110
|
+
/** Cancels signing submission while the caller remains in control. */
|
|
111
|
+
signal?: AbortSignal;
|
|
112
|
+
/** Relay HTTP timeout in milliseconds. Default 30_000. */
|
|
113
|
+
requestTimeoutMs?: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Build the `Authorization: Nostr <base64(kind-27235)>` header for a Buzz
|
|
117
|
+
* HTTP-bridge request. Includes the `payload` sha256 tag when a body is given
|
|
118
|
+
* (NIP-98 SHOULD for POST; Buzz verifies it when present). Each call mints a
|
|
119
|
+
* fresh single-use event — the relay replay-guards by event id.
|
|
120
|
+
*/
|
|
121
|
+
export declare function buzzNip98AuthHeader(secretKeyHex: string, url: string, method: string, bodyText?: string, now?: () => number): Promise<string>;
|
|
122
|
+
export interface BuzzPostResult {
|
|
123
|
+
event_id?: string;
|
|
124
|
+
accepted?: boolean;
|
|
125
|
+
message?: string;
|
|
126
|
+
}
|
|
127
|
+
/** Build the exact signed event that will be submitted to Buzz. */
|
|
128
|
+
export declare function createSignedBuzzEvent(config: BuzzPostConfig, template: {
|
|
129
|
+
kind: number;
|
|
130
|
+
content: string;
|
|
131
|
+
tags: string[][];
|
|
132
|
+
}): BuzzEvent;
|
|
133
|
+
/** Submit one already-signed event without changing its stable event id. */
|
|
134
|
+
export declare function submitSignedBuzzEvent(config: BuzzPostConfig, event: BuzzEvent): Promise<BuzzPostResult>;
|
|
135
|
+
/** Sign a Buzz event with the adapter identity and submit it over the relay HTTP bridge. */
|
|
136
|
+
export declare function postSignedBuzzEvent(config: BuzzPostConfig, template: {
|
|
137
|
+
kind: number;
|
|
138
|
+
content: string;
|
|
139
|
+
tags: string[][];
|
|
140
|
+
}): Promise<BuzzPostResult>;
|
|
141
|
+
/** Authenticated HTTP-bridge query used by recovery and reconciliation paths. */
|
|
142
|
+
export declare function queryBuzzEvents(config: BuzzPostConfig, filters: ReadonlyArray<Record<string, unknown>>): Promise<BuzzEvent[]>;
|
|
143
|
+
/** Outbound tool: post a message in the Buzz channel this agent is handling. */
|
|
144
|
+
export declare function postInBuzzChannel(ref: BuzzThreadRef, config: BuzzPostConfig): ToolDef<{
|
|
145
|
+
text: string;
|
|
146
|
+
}, BuzzPostResult>;
|
|
147
|
+
/** Outbound tool: reply in the Buzz thread this agent is handling. */
|
|
148
|
+
export declare function replyInBuzzThread(ref: BuzzThreadRef, config: BuzzPostConfig): ToolDef<{
|
|
149
|
+
text: string;
|
|
150
|
+
}, BuzzPostResult>;
|
|
151
|
+
/** Outbound tool: add an emoji reaction to an event in the handled channel. */
|
|
152
|
+
export declare function addBuzzReaction(ref: BuzzThreadRef, config: BuzzPostConfig): ToolDef<{
|
|
153
|
+
emoji: string;
|
|
154
|
+
targetEventId: string;
|
|
155
|
+
}, BuzzPostResult>;
|
|
156
|
+
/**
|
|
157
|
+
* Outbound tool: post a decision-request card.
|
|
158
|
+
*
|
|
159
|
+
* @deprecated Use `postBuzzDecisionCard` from `@fabric-harness/channels/buzz-decisions`
|
|
160
|
+
* — it renders the canonical card AND stores the card receipt the
|
|
161
|
+
* deterministic bridge requires (plan D14). This tool posts a tagged card but
|
|
162
|
+
* records no receipt, so reactions on it cannot resolve to a decision.
|
|
163
|
+
*/
|
|
164
|
+
export declare function postBuzzDecisionRequest(ref: BuzzThreadRef, config: BuzzPostConfig): ToolDef<{
|
|
165
|
+
approvalRequestId: string;
|
|
166
|
+
title: string;
|
|
167
|
+
body: string;
|
|
168
|
+
options?: string[];
|
|
169
|
+
}, BuzzPostResult>;
|
|
170
|
+
/** NIP-11 relay information document (feature detection — plan §5.5). */
|
|
171
|
+
export interface BuzzRelayInfo {
|
|
172
|
+
name?: string;
|
|
173
|
+
supported_nips?: number[];
|
|
174
|
+
supported_extensions?: string[];
|
|
175
|
+
limitation?: Record<string, unknown>;
|
|
176
|
+
[key: string]: unknown;
|
|
177
|
+
}
|
|
178
|
+
/** Probe a Buzz relay's NIP-11 document. Detect features; never assume them. */
|
|
179
|
+
export declare function probeBuzzRelay(relayUrl: string, fetchImpl?: typeof fetch, options?: {
|
|
180
|
+
signal?: AbortSignal;
|
|
181
|
+
requestTimeoutMs?: number;
|
|
182
|
+
}): Promise<BuzzRelayInfo>;
|
|
183
|
+
//# sourceMappingURL=buzz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buzz.d.ts","sourceRoot":"","sources":["../src/buzz.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAkB,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEpF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGhE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iFAAiF;A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GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,cAAc,GACrB,OAAO,CACR;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EAC9E,cAAc,CACf,CAgCA;AAED,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,gFAAgF;AAChF,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,OAAO,KAAa,EAC/B,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAO,GAChE,OAAO,CAAC,aAAa,CAAC,CAYxB"}
|
package/dist/buzz.js
ADDED
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { bytesToHex, conversationKey, defineChannel, defineTool, hexToBytes, hmacSha256, parseConversationKey, readJsonBody, verifyHmacSha256, } from "@fabric-harness/sdk/channel";
|
|
2
|
+
import { finalizeEvent, getPublicKey, verifyEvent } from "nostr-tools/pure";
|
|
3
|
+
import { BUZZ_KINDS } from "./buzz-kinds.js";
|
|
4
|
+
const encoder = new TextEncoder();
|
|
5
|
+
const HEX_64 = /^[0-9a-f]{64}$/;
|
|
6
|
+
/** Derive the adapter identity's public key from its secret key (64-char hex). */
|
|
7
|
+
export function buzzPublicKey(secretKeyHex) {
|
|
8
|
+
return getPublicKey(hexToBytes(secretKeyHex));
|
|
9
|
+
}
|
|
10
|
+
/** Serialize a Buzz thread into the stable instance id used by `createBuzzChannel`. */
|
|
11
|
+
export function buzzConversationKey(ref) {
|
|
12
|
+
return conversationKey("buzz", "v1", ref.community, ref.channelId, ref.rootEventId);
|
|
13
|
+
}
|
|
14
|
+
/** Parse a Buzz instance id back into the thread ref. */
|
|
15
|
+
export function parseBuzzConversationKey(id) {
|
|
16
|
+
const parsed = parseConversationKey(id);
|
|
17
|
+
if (parsed.provider !== "buzz" || parsed.version !== "v1" || parsed.segments.length !== 3) {
|
|
18
|
+
throw new Error(`Invalid Buzz conversation key: "${id}".`);
|
|
19
|
+
}
|
|
20
|
+
const [community, channelId, rootEventId] = parsed.segments;
|
|
21
|
+
return { community, channelId, rootEventId };
|
|
22
|
+
}
|
|
23
|
+
/** Family signed-envelope standard: `v1=hex(hmac-sha256(secret, "<ts>.<body>"))`. */
|
|
24
|
+
export async function signBuzzEnvelope(secret, timestampSeconds, rawBody) {
|
|
25
|
+
return `v1=${bytesToHex(await hmacSha256(secret, encoder.encode(`${timestampSeconds}.${rawBody}`)))}`;
|
|
26
|
+
}
|
|
27
|
+
function tagValue(event, name, marker) {
|
|
28
|
+
for (const tag of event.tags) {
|
|
29
|
+
if (tag[0] !== name)
|
|
30
|
+
continue;
|
|
31
|
+
if (marker !== undefined && tag[3] !== marker)
|
|
32
|
+
continue;
|
|
33
|
+
if (typeof tag[1] === "string" && tag[1].length > 0)
|
|
34
|
+
return tag[1];
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
/** Root of the thread an event belongs to: `e` root marker, else first `e`, else the event itself. */
|
|
39
|
+
function rootEventId(event) {
|
|
40
|
+
return tagValue(event, "e", "root") ?? tagValue(event, "e") ?? event.id;
|
|
41
|
+
}
|
|
42
|
+
function tagValues(event, name) {
|
|
43
|
+
return event.tags
|
|
44
|
+
.filter((tag) => tag[0] === name && typeof tag[1] === "string" && tag[1].length > 0)
|
|
45
|
+
.map((tag) => tag[1]);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Buzz events channel. Verifies the tail envelope HMAC (timestamped, replay
|
|
49
|
+
* bounded), verifies the inner event's Schnorr signature, normalizes stream
|
|
50
|
+
* messages / forum posts / reactions, and dispatches to a persistent agent
|
|
51
|
+
* keyed by (community, channel, thread root) — with the Nostr event id as the
|
|
52
|
+
* dedupe key (exactly-once), the community as tenant, and the author pubkey as
|
|
53
|
+
* the acting `actor`.
|
|
54
|
+
*/
|
|
55
|
+
export function createBuzzChannel(options) {
|
|
56
|
+
const maxSkew = options.maxSkewSeconds ?? 300;
|
|
57
|
+
const now = options.now ?? (() => Date.now());
|
|
58
|
+
if (!HEX_64.test(options.selfPubkey))
|
|
59
|
+
throw new Error("selfPubkey must be 64-char lowercase hex (see buzzPublicKey()).");
|
|
60
|
+
if (options.channels?.some((channelId) => channelId.length === 0)) {
|
|
61
|
+
throw new Error("channels must contain only non-empty channel ids.");
|
|
62
|
+
}
|
|
63
|
+
const configuredChannels = options.channels ? new Set(options.channels) : undefined;
|
|
64
|
+
if (options.decisionReceiptStore && (!configuredChannels || configuredChannels.size === 0)) {
|
|
65
|
+
throw new Error("decisionReceiptStore requires at least one configured channel.");
|
|
66
|
+
}
|
|
67
|
+
const channel = defineChannel({
|
|
68
|
+
name: "buzz",
|
|
69
|
+
routes: [{ method: "POST", path: "/events", handler: events }],
|
|
70
|
+
conversationKey: (ref) => buzzConversationKey(ref),
|
|
71
|
+
parseConversationKey: (id) => parseBuzzConversationKey(id),
|
|
72
|
+
});
|
|
73
|
+
async function events(request, ctx) {
|
|
74
|
+
const body = await readJsonBody(request);
|
|
75
|
+
if (!body)
|
|
76
|
+
return new Response(null, { status: 413 });
|
|
77
|
+
const timestamp = request.headers.get("x-fabric-timestamp");
|
|
78
|
+
const signature = request.headers.get("x-fabric-signature");
|
|
79
|
+
if (!timestamp || !signature || !signature.startsWith("v1="))
|
|
80
|
+
return new Response(null, { status: 401 });
|
|
81
|
+
const timestampSeconds = Number(timestamp);
|
|
82
|
+
if (!Number.isFinite(timestampSeconds) ||
|
|
83
|
+
Math.abs(Math.floor(now() / 1000) - timestampSeconds) > maxSkew) {
|
|
84
|
+
return new Response(null, { status: 401 });
|
|
85
|
+
}
|
|
86
|
+
let signatureBytes;
|
|
87
|
+
try {
|
|
88
|
+
signatureBytes = hexToBytes(signature.slice(3));
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return new Response(null, { status: 401 });
|
|
92
|
+
}
|
|
93
|
+
const message = encoder.encode(`${timestampSeconds}.${body.text}`);
|
|
94
|
+
if (!(await verifyHmacSha256(options.sharedSecret, message, signatureBytes)))
|
|
95
|
+
return new Response(null, { status: 401 });
|
|
96
|
+
const envelope = body.json && typeof body.json === "object" ? body.json : undefined;
|
|
97
|
+
const event = envelope?.event;
|
|
98
|
+
if (!event || typeof event.id !== "string" || !Array.isArray(event.tags))
|
|
99
|
+
return new Response(null, { status: 400 });
|
|
100
|
+
// The envelope authenticates the tail; the Schnorr signature authenticates
|
|
101
|
+
// the author. A forged inner event is an authentication failure, not bad input.
|
|
102
|
+
if (!verifyEvent(event))
|
|
103
|
+
return new Response(null, { status: 401 });
|
|
104
|
+
// Tenant guard (plan D7 / CI guard §7.10): the tenant is server-owned
|
|
105
|
+
// deployment configuration. An envelope that claims a different community
|
|
106
|
+
// is refused outright — before loop suppression, before any dispatch.
|
|
107
|
+
if (envelope.community !== undefined && envelope.community !== options.community) {
|
|
108
|
+
return new Response(null, { status: 403 });
|
|
109
|
+
}
|
|
110
|
+
const community = options.community;
|
|
111
|
+
// Loop suppression: never dispatch our own posts.
|
|
112
|
+
if (event.pubkey === options.selfPubkey)
|
|
113
|
+
return new Response(null, { status: 200 });
|
|
114
|
+
const kind = event.kind;
|
|
115
|
+
const isMessage = kind === BUZZ_KINDS.STREAM_MESSAGE ||
|
|
116
|
+
kind === BUZZ_KINDS.FORUM_POST ||
|
|
117
|
+
kind === BUZZ_KINDS.FORUM_COMMENT;
|
|
118
|
+
const isReaction = kind === BUZZ_KINDS.REACTION;
|
|
119
|
+
if (!isMessage && !isReaction)
|
|
120
|
+
return new Response(null, { status: 200 });
|
|
121
|
+
let channelId = tagValue(event, "h");
|
|
122
|
+
if (channelId && configuredChannels && !configuredChannels.has(channelId)) {
|
|
123
|
+
return new Response(null, { status: 200 });
|
|
124
|
+
}
|
|
125
|
+
if (!channelId && isReaction) {
|
|
126
|
+
channelId = await resolveReceiptChannel(event, community);
|
|
127
|
+
}
|
|
128
|
+
// Events without a channel scope (DMs, metadata, unknown messages, or
|
|
129
|
+
// reactions without one exact configured receipt match) are acknowledged
|
|
130
|
+
// but not dispatched. Receipt correlation is deliberately reaction-only.
|
|
131
|
+
if (!channelId)
|
|
132
|
+
return new Response(null, { status: 200 });
|
|
133
|
+
const ref = { community, channelId, rootEventId: rootEventId(event) };
|
|
134
|
+
await ctx.dispatch(options.agent, {
|
|
135
|
+
instanceId: buzzConversationKey(ref),
|
|
136
|
+
input: isReaction
|
|
137
|
+
? {
|
|
138
|
+
type: "buzz.reaction",
|
|
139
|
+
emoji: event.content,
|
|
140
|
+
targetEventId: tagValue(event, "e"),
|
|
141
|
+
eventId: event.id,
|
|
142
|
+
pubkey: event.pubkey,
|
|
143
|
+
channelId,
|
|
144
|
+
tags: event.tags,
|
|
145
|
+
}
|
|
146
|
+
: {
|
|
147
|
+
type: "buzz.message",
|
|
148
|
+
text: event.content,
|
|
149
|
+
eventId: event.id,
|
|
150
|
+
pubkey: event.pubkey,
|
|
151
|
+
channelId,
|
|
152
|
+
rootEventId: ref.rootEventId,
|
|
153
|
+
kind,
|
|
154
|
+
tags: event.tags,
|
|
155
|
+
},
|
|
156
|
+
dedupeKey: event.id,
|
|
157
|
+
tenantId: community,
|
|
158
|
+
actor: { onBehalfOf: event.pubkey },
|
|
159
|
+
});
|
|
160
|
+
return new Response(null, { status: 200 });
|
|
161
|
+
}
|
|
162
|
+
async function resolveReceiptChannel(event, community) {
|
|
163
|
+
const receiptStore = options.decisionReceiptStore;
|
|
164
|
+
if (!receiptStore || !configuredChannels)
|
|
165
|
+
return undefined;
|
|
166
|
+
// Stock Buzz Desktop emits NIP-25 reactions with one `e` target and no
|
|
167
|
+
// NIP-29 `h` tag. Multiple targets are ambiguous and fail closed.
|
|
168
|
+
const targets = tagValues(event, "e");
|
|
169
|
+
if (targets.length !== 1)
|
|
170
|
+
return undefined;
|
|
171
|
+
const targetEventId = targets[0];
|
|
172
|
+
const matches = await Promise.all([...configuredChannels].map(async (configuredChannelId) => {
|
|
173
|
+
const receipt = await receiptStore.findByCardEvent(community, configuredChannelId, targetEventId);
|
|
174
|
+
if (receipt?.community !== community ||
|
|
175
|
+
receipt.channelId !== configuredChannelId ||
|
|
176
|
+
receipt.cardEventId !== targetEventId) {
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
return configuredChannelId;
|
|
180
|
+
}));
|
|
181
|
+
const exactMatches = matches.filter((match) => match !== undefined);
|
|
182
|
+
return exactMatches.length === 1 ? exactMatches[0] : undefined;
|
|
183
|
+
}
|
|
184
|
+
return channel;
|
|
185
|
+
}
|
|
186
|
+
/** Convert a relay WebSocket URL to its HTTP origin (Buzz serves both on one port). */
|
|
187
|
+
export function buzzHttpUrl(relayUrl) {
|
|
188
|
+
return relayUrl.replace(/^ws:/, "http:").replace(/^wss:/, "https:").replace(/\/+$/, "");
|
|
189
|
+
}
|
|
190
|
+
async function boundedBuzzFetch(fetchImpl, input, init, timeoutMs, signal) {
|
|
191
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
|
|
192
|
+
throw new Error("requestTimeoutMs must be greater than zero.");
|
|
193
|
+
const controller = new AbortController();
|
|
194
|
+
const abort = () => controller.abort(signal?.reason ?? new Error("Buzz HTTP request cancelled."));
|
|
195
|
+
if (signal?.aborted)
|
|
196
|
+
abort();
|
|
197
|
+
else
|
|
198
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
199
|
+
const timer = setTimeout(() => controller.abort(new Error(`Buzz HTTP request timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
200
|
+
try {
|
|
201
|
+
return await fetchImpl(input, { ...init, signal: controller.signal });
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
clearTimeout(timer);
|
|
205
|
+
signal?.removeEventListener("abort", abort);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* NIP-98 HTTP Auth (kind 27235) — required by Buzz's HTTP bridge
|
|
210
|
+
* (`POST /events`, `/query`, `/count`). This is the standard NIP-98 kind, not
|
|
211
|
+
* a Buzz-registry kind, so it is deliberately not part of `BUZZ_KINDS` (the
|
|
212
|
+
* sync script tracks only `buzz-core` constants). Verified live 2026-08-02:
|
|
213
|
+
* unauthenticated bridge writes return `401 {"error":"missing Nostr auth"}`.
|
|
214
|
+
*/
|
|
215
|
+
const NIP98_HTTP_AUTH_KIND = 27235;
|
|
216
|
+
function bytesToBase64(bytes) {
|
|
217
|
+
let binary = "";
|
|
218
|
+
for (const byte of bytes)
|
|
219
|
+
binary += String.fromCharCode(byte);
|
|
220
|
+
return btoa(binary);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Build the `Authorization: Nostr <base64(kind-27235)>` header for a Buzz
|
|
224
|
+
* HTTP-bridge request. Includes the `payload` sha256 tag when a body is given
|
|
225
|
+
* (NIP-98 SHOULD for POST; Buzz verifies it when present). Each call mints a
|
|
226
|
+
* fresh single-use event — the relay replay-guards by event id.
|
|
227
|
+
*/
|
|
228
|
+
export async function buzzNip98AuthHeader(secretKeyHex, url, method, bodyText, now = () => Date.now()) {
|
|
229
|
+
const tags = [
|
|
230
|
+
["u", url],
|
|
231
|
+
["method", method],
|
|
232
|
+
// Buzz replay-guards NIP-98 by event id; two same-second requests with an
|
|
233
|
+
// identical body would collide without a nonce (verified live 2026-08-02:
|
|
234
|
+
// 401 "NIP-98: replay detected").
|
|
235
|
+
["nonce", crypto.randomUUID()],
|
|
236
|
+
];
|
|
237
|
+
if (bodyText !== undefined) {
|
|
238
|
+
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", encoder.encode(bodyText)));
|
|
239
|
+
tags.push(["payload", bytesToHex(digest)]);
|
|
240
|
+
}
|
|
241
|
+
const event = finalizeEvent({ kind: NIP98_HTTP_AUTH_KIND, created_at: Math.floor(now() / 1000), tags, content: "" }, hexToBytes(secretKeyHex));
|
|
242
|
+
return `Nostr ${bytesToBase64(encoder.encode(JSON.stringify(event)))}`;
|
|
243
|
+
}
|
|
244
|
+
/** Build the exact signed event that will be submitted to Buzz. */
|
|
245
|
+
export function createSignedBuzzEvent(config, template) {
|
|
246
|
+
const now = config.now ?? (() => Date.now());
|
|
247
|
+
const created_at = Math.floor(now() / 1000);
|
|
248
|
+
return finalizeEvent({ ...template, created_at }, hexToBytes(config.secretKey));
|
|
249
|
+
}
|
|
250
|
+
/** Submit one already-signed event without changing its stable event id. */
|
|
251
|
+
export async function submitSignedBuzzEvent(config, event) {
|
|
252
|
+
const fetchImpl = config.fetchImpl ?? fetch;
|
|
253
|
+
const now = config.now ?? (() => Date.now());
|
|
254
|
+
const requestTimeoutMs = config.requestTimeoutMs ?? 30_000;
|
|
255
|
+
const url = `${buzzHttpUrl(config.relayUrl)}/events`;
|
|
256
|
+
const body = JSON.stringify(event);
|
|
257
|
+
const response = await boundedBuzzFetch(fetchImpl, url, {
|
|
258
|
+
method: "POST",
|
|
259
|
+
headers: {
|
|
260
|
+
"content-type": "application/json",
|
|
261
|
+
authorization: await buzzNip98AuthHeader(config.secretKey, url, "POST", body, now),
|
|
262
|
+
},
|
|
263
|
+
body,
|
|
264
|
+
}, requestTimeoutMs, config.signal);
|
|
265
|
+
let result;
|
|
266
|
+
try {
|
|
267
|
+
result = (await response.json());
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
result = {
|
|
271
|
+
accepted: false,
|
|
272
|
+
message: `relay returned HTTP ${response.status} without a JSON result`,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
if (!response.ok) {
|
|
276
|
+
return {
|
|
277
|
+
...result,
|
|
278
|
+
accepted: false,
|
|
279
|
+
message: result.message
|
|
280
|
+
? `HTTP ${response.status}: ${result.message}`
|
|
281
|
+
: `relay returned HTTP ${response.status}`,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
286
|
+
/** Sign a Buzz event with the adapter identity and submit it over the relay HTTP bridge. */
|
|
287
|
+
export async function postSignedBuzzEvent(config, template) {
|
|
288
|
+
return submitSignedBuzzEvent(config, createSignedBuzzEvent(config, template));
|
|
289
|
+
}
|
|
290
|
+
/** Authenticated HTTP-bridge query used by recovery and reconciliation paths. */
|
|
291
|
+
export async function queryBuzzEvents(config, filters) {
|
|
292
|
+
const fetchImpl = config.fetchImpl ?? fetch;
|
|
293
|
+
const now = config.now ?? (() => Date.now());
|
|
294
|
+
const url = `${buzzHttpUrl(config.relayUrl)}/query`;
|
|
295
|
+
const body = JSON.stringify(filters);
|
|
296
|
+
const response = await boundedBuzzFetch(fetchImpl, url, {
|
|
297
|
+
method: "POST",
|
|
298
|
+
headers: {
|
|
299
|
+
"content-type": "application/json",
|
|
300
|
+
authorization: await buzzNip98AuthHeader(config.secretKey, url, "POST", body, now),
|
|
301
|
+
},
|
|
302
|
+
body,
|
|
303
|
+
}, config.requestTimeoutMs ?? 30_000, config.signal);
|
|
304
|
+
if (!response.ok)
|
|
305
|
+
throw new Error(`Buzz query failed: HTTP ${response.status}`);
|
|
306
|
+
const result = (await response.json());
|
|
307
|
+
if (!Array.isArray(result))
|
|
308
|
+
throw new Error("Buzz query did not return an event array.");
|
|
309
|
+
return result;
|
|
310
|
+
}
|
|
311
|
+
/** Outbound tool: post a message in the Buzz channel this agent is handling. */
|
|
312
|
+
export function postInBuzzChannel(ref, config) {
|
|
313
|
+
return defineTool({
|
|
314
|
+
name: "post_in_buzz_channel",
|
|
315
|
+
description: "Post a message in the Buzz channel this agent is handling.",
|
|
316
|
+
inputSchema: {
|
|
317
|
+
type: "object",
|
|
318
|
+
additionalProperties: false,
|
|
319
|
+
properties: { text: { type: "string", minLength: 1 } },
|
|
320
|
+
required: ["text"],
|
|
321
|
+
},
|
|
322
|
+
metadata: { effect: "write", provider: "buzz", channel: "buzz" },
|
|
323
|
+
execute: async ({ text }) => postSignedBuzzEvent(config, {
|
|
324
|
+
kind: BUZZ_KINDS.STREAM_MESSAGE,
|
|
325
|
+
content: text,
|
|
326
|
+
tags: [["h", ref.channelId]],
|
|
327
|
+
}),
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
/** Outbound tool: reply in the Buzz thread this agent is handling. */
|
|
331
|
+
export function replyInBuzzThread(ref, config) {
|
|
332
|
+
return defineTool({
|
|
333
|
+
name: "reply_in_buzz_thread",
|
|
334
|
+
description: "Reply in the Buzz thread this agent is handling.",
|
|
335
|
+
inputSchema: {
|
|
336
|
+
type: "object",
|
|
337
|
+
additionalProperties: false,
|
|
338
|
+
properties: { text: { type: "string", minLength: 1 } },
|
|
339
|
+
required: ["text"],
|
|
340
|
+
},
|
|
341
|
+
metadata: { effect: "write", provider: "buzz", channel: "buzz" },
|
|
342
|
+
execute: async ({ text }) => postSignedBuzzEvent(config, {
|
|
343
|
+
kind: BUZZ_KINDS.STREAM_MESSAGE,
|
|
344
|
+
content: text,
|
|
345
|
+
tags: [
|
|
346
|
+
["h", ref.channelId],
|
|
347
|
+
["e", ref.rootEventId, "", "root"],
|
|
348
|
+
],
|
|
349
|
+
}),
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
/** Outbound tool: add an emoji reaction to an event in the handled channel. */
|
|
353
|
+
export function addBuzzReaction(ref, config) {
|
|
354
|
+
return defineTool({
|
|
355
|
+
name: "add_buzz_reaction",
|
|
356
|
+
description: "Add an emoji reaction to a message in the Buzz channel this agent is handling.",
|
|
357
|
+
inputSchema: {
|
|
358
|
+
type: "object",
|
|
359
|
+
additionalProperties: false,
|
|
360
|
+
properties: {
|
|
361
|
+
emoji: { type: "string", minLength: 1 },
|
|
362
|
+
targetEventId: { type: "string", minLength: 1 },
|
|
363
|
+
},
|
|
364
|
+
required: ["emoji", "targetEventId"],
|
|
365
|
+
},
|
|
366
|
+
metadata: { effect: "write", provider: "buzz", channel: "buzz" },
|
|
367
|
+
execute: async ({ emoji, targetEventId }) => postSignedBuzzEvent(config, {
|
|
368
|
+
kind: BUZZ_KINDS.REACTION,
|
|
369
|
+
content: emoji,
|
|
370
|
+
tags: [
|
|
371
|
+
["h", ref.channelId],
|
|
372
|
+
["e", targetEventId],
|
|
373
|
+
],
|
|
374
|
+
}),
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Outbound tool: post a decision-request card.
|
|
379
|
+
*
|
|
380
|
+
* @deprecated Use `postBuzzDecisionCard` from `@fabric-harness/channels/buzz-decisions`
|
|
381
|
+
* — it renders the canonical card AND stores the card receipt the
|
|
382
|
+
* deterministic bridge requires (plan D14). This tool posts a tagged card but
|
|
383
|
+
* records no receipt, so reactions on it cannot resolve to a decision.
|
|
384
|
+
*/
|
|
385
|
+
export function postBuzzDecisionRequest(ref, config) {
|
|
386
|
+
return defineTool({
|
|
387
|
+
name: "post_buzz_decision_request",
|
|
388
|
+
description: "Post a decision-request card into the Buzz channel; reactions on it feed the governed decision ingress.",
|
|
389
|
+
inputSchema: {
|
|
390
|
+
type: "object",
|
|
391
|
+
additionalProperties: false,
|
|
392
|
+
properties: {
|
|
393
|
+
approvalRequestId: { type: "string", minLength: 1 },
|
|
394
|
+
title: { type: "string", minLength: 1 },
|
|
395
|
+
body: { type: "string", minLength: 1 },
|
|
396
|
+
options: { type: "array", items: { type: "string", minLength: 1 } },
|
|
397
|
+
},
|
|
398
|
+
required: ["approvalRequestId", "title", "body"],
|
|
399
|
+
},
|
|
400
|
+
metadata: { effect: "write", provider: "buzz", channel: "buzz" },
|
|
401
|
+
execute: async ({ approvalRequestId, title, body, options: choices }) => {
|
|
402
|
+
const footer = (choices ?? ["approve 👍", "reject 👎"]).join(" · ");
|
|
403
|
+
return postSignedBuzzEvent(config, {
|
|
404
|
+
kind: BUZZ_KINDS.STREAM_MESSAGE,
|
|
405
|
+
content: `**${title}**\n\n${body}\n\n_${footer}_`,
|
|
406
|
+
tags: [
|
|
407
|
+
["h", ref.channelId],
|
|
408
|
+
["decision", approvalRequestId],
|
|
409
|
+
],
|
|
410
|
+
});
|
|
411
|
+
},
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/** Probe a Buzz relay's NIP-11 document. Detect features; never assume them. */
|
|
415
|
+
export async function probeBuzzRelay(relayUrl, fetchImpl = fetch, options = {}) {
|
|
416
|
+
const response = await boundedBuzzFetch(fetchImpl, buzzHttpUrl(relayUrl), {
|
|
417
|
+
headers: { accept: "application/nostr+json" },
|
|
418
|
+
}, options.requestTimeoutMs ?? 30_000, options.signal);
|
|
419
|
+
if (!response.ok)
|
|
420
|
+
throw new Error(`NIP-11 probe failed: ${response.status}`);
|
|
421
|
+
return (await response.json());
|
|
422
|
+
}
|
|
423
|
+
//# sourceMappingURL=buzz.js.map
|
package/dist/buzz.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buzz.js","sourceRoot":"","sources":["../src/buzz.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EACf,aAAa,EACb,UAAU,EACV,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAwF7C,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,MAAM,MAAM,GAAG,gBAAgB,CAAC;AAEhC,kFAAkF;AAClF,MAAM,UAAU,aAAa,CAAC,YAAoB;IAChD,OAAO,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,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,OAAO,EAAE,MAAM,EAAE;QAChE,OAAO,EAAE,KAAK,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YACtE,MAAM,MAAM,GAAG,CAAC,OAAO,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACpE,OAAO,mBAAmB,CAAC,MAAM,EAAE;gBACjC,IAAI,EAAE,UAAU,CAAC,cAAc;gBAC/B,OAAO,EAAE,KAAK,KAAK,SAAS,IAAI,QAAQ,MAAM,GAAG;gBACjD,IAAI,EAAE;oBACJ,CAAC,GAAG,EAAE,GAAG,CAAC,SAAS,CAAC;oBACpB,CAAC,UAAU,EAAE,iBAAiB,CAAC;iBAChC;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAWD,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,YAA0B,KAAK,EAC/B,UAA+D,EAAE;IAEjE,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CACrC,SAAS,EACT,WAAW,CAAC,QAAQ,CAAC,EACrB;QACE,OAAO,EAAE,EAAE,MAAM,EAAE,wBAAwB,EAAE;KAC9C,EACD,OAAO,CAAC,gBAAgB,IAAI,MAAM,EAClC,OAAO,CAAC,MAAM,CACf,CAAC;IACF,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAkB,CAAC;AAClD,CAAC"}
|
package/dist/compatibility.d.ts
CHANGED
|
@@ -133,6 +133,13 @@ export declare const channelCompatibility: {
|
|
|
133
133
|
readonly outboundApi: "Marketing Cloud REST";
|
|
134
134
|
readonly sdk: "none";
|
|
135
135
|
};
|
|
136
|
+
readonly buzz: {
|
|
137
|
+
readonly subpath: "buzz";
|
|
138
|
+
readonly status: "preview";
|
|
139
|
+
readonly inboundApi: "Buzz relay Nostr NIP-01 events (via buzz-tail shim)";
|
|
140
|
+
readonly outboundApi: "Buzz relay HTTP POST /events (signed Nostr events)";
|
|
141
|
+
readonly sdk: "nostr-tools";
|
|
142
|
+
};
|
|
136
143
|
};
|
|
137
144
|
export type FirstPartyChannelName = keyof typeof channelCompatibility;
|
|
138
145
|
export declare const channelCompatibilityPolicy: {
|