@fabric-harness/channels 0.18.2 → 0.20.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 CHANGED
@@ -54,7 +54,7 @@ pubkey. Requires `nostr-tools` (declared dependency; the only non-Fetch/WebCrypt
54
54
  ```ts
55
55
  // .fabricharness/channels/buzz.ts
56
56
  import { buzzPublicKey, createBuzzChannel } from '@fabric-harness/channels/buzz';
57
- import { receiptStore } from '../state/buzz-receipts.js';
57
+ import { buzzState } from '../state/buzz.js';
58
58
 
59
59
  const channels = ['gtm-pipeline'];
60
60
 
@@ -64,13 +64,14 @@ export const channel = createBuzzChannel({
64
64
  selfPubkey: buzzPublicKey(process.env.BUZZ_PRIVATE_KEY!),
65
65
  community: 'acme',
66
66
  channels,
67
- decisionReceiptStore: receiptStore,
67
+ decisionReceiptStore: buzzState.deliveryStore,
68
68
  });
69
69
  ```
70
70
 
71
71
  ```ts
72
72
  // tail process (Node >= 22), co-deployed with the app
73
73
  import { startBuzzTail } from '@fabric-harness/channels/buzz-tail';
74
+ import { buzzState } from '../state/buzz.js';
74
75
 
75
76
  const channels = ['gtm-pipeline'];
76
77
 
@@ -81,19 +82,45 @@ startBuzzTail({
81
82
  channels, // same server-owned channel allowlist used by createBuzzChannel
82
83
  forwardUrl: 'https://app/channels/buzz/events',
83
84
  sharedSecret: process.env.BUZZ_ENVELOPE_SECRET!,
84
- cursorStore, // REQUIRED and must be durable (file/db) — plan D15; a ~5-line
85
- // file-backed implementation of BuzzCursorStore suffices on Node
86
- onDeadLetter: (event, reason, status) => reconcileLater(event, reason, status),
85
+ cursorStore: buzzState.cursorStore,
86
+ deadLetterStore: buzzState.deadLetterStore,
87
87
  });
88
88
  ```
89
89
 
90
+ For PostgreSQL or Databricks Lakebase, inject the application's existing `pg.Pool` into
91
+ the dependency-free structural client boundary. One scoped state object supplies all
92
+ three production stores:
93
+
94
+ ```ts
95
+ import { createPostgresBuzzPersistence } from '@fabric-harness/channels/buzz-postgres';
96
+ import { Pool } from 'pg';
97
+
98
+ export const buzzState = createPostgresBuzzPersistence({
99
+ client: new Pool({ connectionString: process.env.DATABASE_URL }),
100
+ consumerId: 'gtm-primary', // stable and unique per deployed consumer
101
+ });
102
+ ```
103
+
104
+ `createPostgresBuzzPersistence()` initializes isolated cursor, dead-letter, and
105
+ decision-card-delivery tables. Pass `initialize: false` when migrations own DDL and call
106
+ `ensurePostgresBuzzTables()` from the migration boundary instead. The same contract works
107
+ with Lakebase clients that implement the structural `query()` method; no Databricks or
108
+ PostgreSQL dependency is loaded by the core channel adapter.
109
+
110
+ `inspectPostgresBuzzHealth()` is the read-only certification surface for one consumer. It
111
+ returns only cursor lag/age, unresolved dead-letter depth, and prepared/published card counts;
112
+ it never selects event, dead-letter, or decision-card payloads.
113
+
90
114
  The tail is a durable consumer, not a best-effort reconnect loop: it persists a
91
- cursor (advanced only after a 2xx forward or recorded dead-letter), backfills
92
- over HTTP `POST /query` from `cursor - overlap` on every (re)start, forwards in
93
- order with retry classification (408/429/5xx/network retry with bounded
94
- backoff; other 4xx dead-letter to `onDeadLetter` for reconciliation), answers
115
+ cursor (advanced only after a 2xx forward or durably recorded dead-letter), pages a
116
+ complete bounded `POST /query` snapshot backward and forwards it oldest-first on every
117
+ (re)start, forwards in order with retry classification (408/429/5xx/network retry with bounded
118
+ backoff; other 4xx go to `deadLetterStore` for reconciliation), answers
95
119
  NIP-42 challenges including `OK` acknowledgement and `CLOSED` re-subscription,
96
- and drains + persists on `close()`. The channel route derives the tenant from
120
+ enforces NIP-11 limits, and propagates cancellation and per-request timeouts. It fails
121
+ closed when the cursor, backfill, or dead-letter store is unavailable. Use
122
+ `reconcileBuzzDeadLetters()` from a bounded scheduled worker to replay unresolved records
123
+ through the ordinary verified/governed ingress path. The channel route derives the tenant from
97
124
  its own `community` option (server-owned configuration) and refuses envelopes
98
125
  claiming any other community with 403 — the tenant is never taken from the
99
126
  event or envelope.
@@ -104,7 +131,10 @@ that do not advertise them; `probeBuzzRelay` is exported for standalone detectio
104
131
 
105
132
  **Decisions are deterministic and model-free** (`@fabric-harness/channels/buzz-decisions`,
106
133
  plan D14): `postBuzzDecisionCard` renders the canonical card from request data (never
107
- agent prose) and stores a **card receipt** binding `(community, channel, cardEventId)` to
134
+ agent prose), signs it, and persists the exact immutable event plus its **card receipt**
135
+ before relay I/O. A retry reuses the same Nostr event id, queries that id after an
136
+ ambiguous response, and only then marks publication. The receipt binds
137
+ `(community, channel, cardEventId)` to
108
138
  `(approvalRequestId, requestVersion, parametersHash, options, expiry)`. The
109
139
  `createBuzzDecisionBridge` resolves a signed reaction through the receipt store and a
110
140
  fixed emoji table (`👍/✅/+ → approve`, `👎/❌/- → reject`) into exactly one
@@ -121,6 +151,12 @@ that allowlist. Missing, malformed, cross-channel, and ambiguous matches are ign
121
151
  receipt-store failures fail the forward so the durable tail retries. Receipt correlation
122
152
  only recovers transport scope: the normal governed identity, membership, expiry,
123
153
  request-version, parameter-hash, and compare-and-swap checks remain mandatory downstream.
154
+
155
+ Migration from channels 0.18.x: `postBuzzDecisionCard()` now requires
156
+ `deliveryStore: BuzzDecisionCardDeliveryStore` instead of a write-only `receiptStore`.
157
+ The route still consumes its lookup-only `decisionReceiptStore`; in production both must
158
+ be views over the same durable store (`buzzState.deliveryStore`). This closes the
159
+ post-succeeded/receipt-write-failed split-brain window.
124
160
  Vendored kind constants are guarded by `scripts/sync-buzz-kinds.mjs` against a Buzz
125
161
  checkout's `buzz-core/src/kind.rs`.
126
162
 
@@ -1,5 +1,5 @@
1
- import type { ToolDef } from '@fabric-harness/sdk/channel';
2
- import type { BuzzPostConfig, BuzzThreadRef } from './buzz.js';
1
+ import type { ToolDef } from "@fabric-harness/sdk/channel";
2
+ import type { BuzzEvent, BuzzPostConfig, BuzzThreadRef } from "./buzz.js";
3
3
  /**
4
4
  * Deterministic, model-free decision surface for Buzz (Fabric Buzz
5
5
  * Collaboration Plan D14; B1-H items 5–6).
@@ -28,7 +28,7 @@ export interface BuzzDecisionCardInput {
28
28
  title: string;
29
29
  /** Canonical summary derived from action/evidence data — not agent prose. */
30
30
  summary: string;
31
- options: ReadonlyArray<'approve' | 'reject' | 'approve-with-edits'>;
31
+ options: ReadonlyArray<"approve" | "reject" | "approve-with-edits">;
32
32
  /** ISO-8601 expiry of the request. */
33
33
  expiresAt: string;
34
34
  /**
@@ -59,28 +59,54 @@ export interface BuzzCardReceipt {
59
59
  relayUrl: string;
60
60
  community: string;
61
61
  channelId: string;
62
- /** Relay-assigned id of the posted card event. */
62
+ /** Stable id of the exact client-signed card event. */
63
63
  cardEventId: string;
64
- options: BuzzDecisionCardInput['options'];
64
+ options: BuzzDecisionCardInput["options"];
65
65
  expiresAt: string;
66
66
  postedAt: string;
67
67
  }
68
- /** Durable receipt persistence — implement on the vertical's store. */
68
+ /** Receipt lookup shared by ingress correlation and the deterministic bridge. */
69
69
  export interface BuzzCardReceiptStore {
70
- save(receipt: BuzzCardReceipt): Promise<void>;
71
70
  findByCardEvent(community: string, channelId: string, cardEventId: string): Promise<BuzzCardReceipt | undefined>;
72
71
  }
72
+ export type BuzzDecisionCardDeliveryStatus = "prepared" | "published";
73
+ /**
74
+ * Durable outbox record for one canonical decision card. The exact signed
75
+ * event is persisted before relay I/O, making its Nostr id stable across
76
+ * retries and ambiguous network outcomes.
77
+ */
78
+ export interface BuzzDecisionCardDelivery {
79
+ deliveryKey: string;
80
+ event: BuzzEvent;
81
+ receipt: BuzzCardReceipt;
82
+ status: BuzzDecisionCardDeliveryStatus;
83
+ preparedAt: string;
84
+ publishedAt?: string;
85
+ }
86
+ /**
87
+ * Production decision-card store. Implement this beside the vertical's
88
+ * ApprovalRequest. `prepareDelivery` is an immutable put-if-absent by
89
+ * deliveryKey and returns the existing record on retry. Publication marking
90
+ * must be idempotent.
91
+ */
92
+ export interface BuzzDecisionCardDeliveryStore extends BuzzCardReceiptStore {
93
+ prepareDelivery(delivery: BuzzDecisionCardDelivery): Promise<BuzzDecisionCardDelivery>;
94
+ markDeliveryPublished(deliveryKey: string, publishedAt: string): Promise<void>;
95
+ }
96
+ /** Stable logical identity for one request version on one Buzz surface. */
97
+ export declare function buzzDecisionCardDeliveryKey(community: string, channelId: string, approvalRequestId: string, requestVersion: number): string;
73
98
  /** Test/development receipt store. Not durable — never use in production. */
74
- export declare function inMemoryBuzzCardReceiptStore(): BuzzCardReceiptStore & {
99
+ export declare function inMemoryBuzzCardReceiptStore(): BuzzDecisionCardDeliveryStore & {
75
100
  all(): BuzzCardReceipt[];
101
+ deliveries(): BuzzDecisionCardDelivery[];
76
102
  };
77
103
  /**
78
- * Outbound tool: render and post the canonical decision card, then persist the
79
- * card receipt. Returns the receipt. Posting a card grants nothing by itself.
80
- * Supersedes `postBuzzDecisionRequest` (deprecated).
104
+ * Outbound tool: durably prepare the exact signed event + receipt, submit it,
105
+ * reconcile an ambiguous response by exact event id, then checkpoint
106
+ * publication. Returns the receipt. Posting a card grants nothing by itself.
81
107
  */
82
108
  export declare function postBuzzDecisionCard(ref: BuzzThreadRef, config: BuzzPostConfig & {
83
- receiptStore: BuzzCardReceiptStore;
109
+ deliveryStore: BuzzDecisionCardDeliveryStore;
84
110
  now?: () => number;
85
111
  }): ToolDef<BuzzDecisionCardInput, BuzzCardReceipt>;
86
112
  /**
@@ -88,10 +114,10 @@ export declare function postBuzzDecisionCard(ref: BuzzThreadRef, config: BuzzPos
88
114
  * the emoji the card legend shows. Anything else on a card is `unmapped` —
89
115
  * surfaced for audit, never guessed.
90
116
  */
91
- export declare const BUZZ_DECISION_EMOJI: Readonly<Record<string, 'approve' | 'reject'>>;
117
+ export declare const BUZZ_DECISION_EMOJI: Readonly<Record<string, "approve" | "reject">>;
92
118
  /** Normalized reaction input as dispatched by the Buzz channel route. */
93
119
  export interface BuzzReactionInput {
94
- type: 'buzz.reaction';
120
+ type: "buzz.reaction";
95
121
  emoji: string;
96
122
  targetEventId?: string;
97
123
  eventId: string;
@@ -100,7 +126,7 @@ export interface BuzzReactionInput {
100
126
  }
101
127
  /** Normalized message input as dispatched by the Buzz channel route. */
102
128
  export interface BuzzMessageInput {
103
- type: 'buzz.message';
129
+ type: "buzz.message";
104
130
  text: string;
105
131
  eventId: string;
106
132
  pubkey: string;
@@ -112,7 +138,7 @@ export interface BuzzDecisionCandidate {
112
138
  approvalRequestId: string;
113
139
  requestVersion: number;
114
140
  proposedParametersHash: string;
115
- choice: 'approve' | 'reject';
141
+ choice: "approve" | "reject";
116
142
  community: string;
117
143
  channelId: string;
118
144
  cardEventId: string;
@@ -120,7 +146,7 @@ export interface BuzzDecisionCandidate {
120
146
  reactionEventId: string;
121
147
  /** Candidate identity — the governed action resolves the binding (D7). */
122
148
  attestedIdentity: {
123
- namespace: 'nostr';
149
+ namespace: "nostr";
124
150
  externalId: string;
125
151
  signatureRef: string;
126
152
  };
@@ -135,32 +161,32 @@ export interface BuzzEditProposal {
135
161
  /** Free-form text — a PROPOSAL only; never an approval (D14). */
136
162
  text: string;
137
163
  attestedIdentity: {
138
- namespace: 'nostr';
164
+ namespace: "nostr";
139
165
  externalId: string;
140
166
  signatureRef: string;
141
167
  };
142
168
  }
143
169
  export type BuzzDecisionResolution = {
144
- kind: 'decision-candidate';
170
+ kind: "decision-candidate";
145
171
  candidate: BuzzDecisionCandidate;
146
172
  } | {
147
- kind: 'edit-proposal';
173
+ kind: "edit-proposal";
148
174
  proposal: BuzzEditProposal;
149
175
  } | {
150
- kind: 'unmapped-emoji';
176
+ kind: "unmapped-emoji";
151
177
  emoji: string;
152
178
  cardEventId: string;
153
179
  approvalRequestId: string;
154
180
  pubkey: string;
155
181
  } | {
156
- kind: 'not-a-decision';
182
+ kind: "not-a-decision";
157
183
  };
158
184
  export interface BuzzDecisionBridgeOptions {
159
185
  /** Server-owned community — must equal the channel's (plan D7). */
160
186
  community: string;
161
187
  receiptStore: BuzzCardReceiptStore;
162
188
  /** Override the fixed emoji table (still a fixed table — never a model). */
163
- emojiMap?: Readonly<Record<string, 'approve' | 'reject'>>;
189
+ emojiMap?: Readonly<Record<string, "approve" | "reject">>;
164
190
  }
165
191
  /**
166
192
  * The deterministic decision bridge (plan §4 steps 4–5). Pure lookup + fixed
@@ -1 +1 @@
1
- {"version":3,"file":"buzz-decisions.d.ts","sourceRoot":"","sources":["../src/buzz-decisions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAI3D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/D;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,aAAa,CAAC,SAAS,GAAG,QAAQ,GAAG,oBAAoB,CAAC,CAAC;IACpE,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAQD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;CAClB,CAiCA;AAID;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,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C,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC;CAC3D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB;gCAGhC,iBAAiB,KAAG,OAAO,CAAC,sBAAsB,CAAC;4BAsCvD,gBAAgB,KAAG,OAAO,CAAC,sBAAsB,CAAC;EAmCxF"}
@@ -1,10 +1,10 @@
1
- import { defineTool } from '@fabric-harness/sdk/channel';
2
- import { BUZZ_KINDS } from './buzz-kinds.js';
3
- import { postSignedBuzzEvent } from './buzz.js';
1
+ import { defineTool } from "@fabric-harness/sdk/channel";
2
+ import { BUZZ_KINDS } from "./buzz-kinds.js";
3
+ import { createSignedBuzzEvent, queryBuzzEvents, submitSignedBuzzEvent } from "./buzz.js";
4
4
  const OPTION_LEGEND = {
5
- approve: 'approve 👍',
6
- reject: 'reject 👎',
7
- 'approve-with-edits': 'reply with edits (proposal — requires confirmation)',
5
+ approve: "approve 👍",
6
+ reject: "reject 👎",
7
+ "approve-with-edits": "reply with edits (proposal — requires confirmation)",
8
8
  };
9
9
  /**
10
10
  * Render the canonical decision card. Pure and deterministic: identical input
@@ -17,99 +17,118 @@ export function renderBuzzDecisionCard(input) {
17
17
  // carry. Canonical fields that smuggle links (a compromised upstream, a
18
18
  // template injection) are refused outright rather than rendered.
19
19
  for (const [field, value] of [
20
- ['title', input.title],
21
- ['summary', input.summary],
22
- ['proposedActionId', input.proposedActionId],
20
+ ["title", input.title],
21
+ ["summary", input.summary],
22
+ ["proposedActionId", input.proposedActionId],
23
23
  ]) {
24
24
  if (/[a-z][a-z0-9+.-]*:\/\//i.test(value)) {
25
25
  throw new Error(`decision card ${field} must not contain URLs; use detailsUrl`);
26
26
  }
27
27
  }
28
- const legend = input.options.map((option) => OPTION_LEGEND[option]).join(' · ');
28
+ const legend = input.options.map((option) => OPTION_LEGEND[option]).join(" · ");
29
29
  const content = [
30
30
  `**${input.title}**`,
31
- '',
31
+ "",
32
32
  input.summary,
33
- '',
33
+ "",
34
34
  `action: \`${input.proposedActionId}\``,
35
35
  `parameters: \`${input.proposedParametersHash}\``,
36
36
  `expires: ${input.expiresAt}`,
37
- ...(input.detailsUrl ? ['', `details: ${input.detailsUrl}`] : []),
38
- '',
37
+ ...(input.detailsUrl ? ["", `details: ${input.detailsUrl}`] : []),
38
+ "",
39
39
  `_${legend}_`,
40
- ].join('\n');
40
+ ].join("\n");
41
41
  const tags = [
42
- ['decision', input.approvalRequestId],
43
- ['decision-version', String(input.requestVersion)],
44
- ['decision-params', input.proposedParametersHash],
45
- ['decision-expires', input.expiresAt],
42
+ ["decision", input.approvalRequestId],
43
+ ["decision-version", String(input.requestVersion)],
44
+ ["decision-params", input.proposedParametersHash],
45
+ ["decision-expires", input.expiresAt],
46
46
  ];
47
47
  return { content, tags };
48
48
  }
49
+ /** Stable logical identity for one request version on one Buzz surface. */
50
+ export function buzzDecisionCardDeliveryKey(community, channelId, approvalRequestId, requestVersion) {
51
+ return JSON.stringify(["buzz-card", 1, community, channelId, approvalRequestId, requestVersion]);
52
+ }
49
53
  /** Test/development receipt store. Not durable — never use in production. */
50
54
  export function inMemoryBuzzCardReceiptStore() {
51
- const receipts = [];
55
+ const records = new Map();
52
56
  return {
53
- async save(receipt) {
54
- receipts.push(receipt);
57
+ async prepareDelivery(delivery) {
58
+ const existing = records.get(delivery.deliveryKey);
59
+ if (existing)
60
+ return structuredClone(existing);
61
+ records.set(delivery.deliveryKey, structuredClone(delivery));
62
+ return structuredClone(delivery);
63
+ },
64
+ async markDeliveryPublished(deliveryKey, publishedAt) {
65
+ const delivery = records.get(deliveryKey);
66
+ if (!delivery)
67
+ throw new Error(`Unknown Buzz decision-card delivery: ${deliveryKey}`);
68
+ delivery.status = "published";
69
+ delivery.publishedAt ??= publishedAt;
55
70
  },
56
71
  async findByCardEvent(community, channelId, cardEventId) {
57
- return receipts.find((receipt) => receipt.community === community && receipt.channelId === channelId && receipt.cardEventId === cardEventId);
72
+ const delivery = [...records.values()].find(({ receipt }) => receipt.community === community &&
73
+ receipt.channelId === channelId &&
74
+ receipt.cardEventId === cardEventId);
75
+ return delivery ? structuredClone(delivery.receipt) : undefined;
58
76
  },
59
77
  all() {
60
- return receipts;
78
+ return [...records.values()].map(({ receipt }) => structuredClone(receipt));
79
+ },
80
+ deliveries() {
81
+ return [...records.values()].map((delivery) => structuredClone(delivery));
61
82
  },
62
83
  };
63
84
  }
64
85
  /**
65
- * Outbound tool: render and post the canonical decision card, then persist the
66
- * card receipt. Returns the receipt. Posting a card grants nothing by itself.
67
- * Supersedes `postBuzzDecisionRequest` (deprecated).
86
+ * Outbound tool: durably prepare the exact signed event + receipt, submit it,
87
+ * reconcile an ambiguous response by exact event id, then checkpoint
88
+ * publication. Returns the receipt. Posting a card grants nothing by itself.
68
89
  */
69
90
  export function postBuzzDecisionCard(ref, config) {
70
91
  return defineTool({
71
- name: 'post_buzz_decision_card',
72
- description: 'Post the canonical decision card for an ApprovalRequest into the Buzz channel and store its card receipt.',
92
+ name: "post_buzz_decision_card",
93
+ description: "Post the canonical decision card for an ApprovalRequest into the Buzz channel and store its card receipt.",
73
94
  inputSchema: {
74
- type: 'object',
95
+ type: "object",
75
96
  additionalProperties: false,
76
97
  properties: {
77
- approvalRequestId: { type: 'string', minLength: 1 },
78
- requestVersion: { type: 'integer', minimum: 0 },
79
- proposedActionId: { type: 'string', minLength: 1 },
80
- proposedParametersHash: { type: 'string', pattern: '^sha256:[a-f0-9]{64}$' },
81
- title: { type: 'string', minLength: 1 },
82
- summary: { type: 'string', minLength: 1 },
98
+ approvalRequestId: { type: "string", minLength: 1 },
99
+ requestVersion: { type: "integer", minimum: 0 },
100
+ proposedActionId: { type: "string", minLength: 1 },
101
+ proposedParametersHash: { type: "string", pattern: "^sha256:[a-f0-9]{64}$" },
102
+ title: { type: "string", minLength: 1 },
103
+ summary: { type: "string", minLength: 1 },
83
104
  options: {
84
- type: 'array',
105
+ type: "array",
85
106
  minItems: 1,
86
- items: { enum: ['approve', 'reject', 'approve-with-edits'] },
107
+ items: { enum: ["approve", "reject", "approve-with-edits"] },
87
108
  },
88
- expiresAt: { type: 'string', minLength: 1 },
89
- detailsUrl: { type: 'string', minLength: 1 },
109
+ expiresAt: { type: "string", minLength: 1 },
110
+ detailsUrl: { type: "string", minLength: 1 },
90
111
  },
91
112
  required: [
92
- 'approvalRequestId',
93
- 'requestVersion',
94
- 'proposedActionId',
95
- 'proposedParametersHash',
96
- 'title',
97
- 'summary',
98
- 'options',
99
- 'expiresAt',
113
+ "approvalRequestId",
114
+ "requestVersion",
115
+ "proposedActionId",
116
+ "proposedParametersHash",
117
+ "title",
118
+ "summary",
119
+ "options",
120
+ "expiresAt",
100
121
  ],
101
122
  },
102
- metadata: { effect: 'write', provider: 'buzz', channel: 'buzz' },
123
+ metadata: { effect: "write", provider: "buzz", channel: "buzz" },
103
124
  execute: async (input) => {
104
125
  const rendered = renderBuzzDecisionCard(input);
105
- const result = await postSignedBuzzEvent(config, {
126
+ const event = createSignedBuzzEvent(config, {
106
127
  kind: BUZZ_KINDS.STREAM_MESSAGE,
107
128
  content: rendered.content,
108
- tags: [['h', ref.channelId], ...rendered.tags],
129
+ tags: [["h", ref.channelId], ...rendered.tags],
109
130
  });
110
- if (!result.event_id || result.accepted === false) {
111
- throw new Error(`decision card post rejected: ${result.message ?? 'no event id returned'}`);
112
- }
131
+ const preparedAt = new Date(event.created_at * 1_000).toISOString();
113
132
  const receipt = {
114
133
  approvalRequestId: input.approvalRequestId,
115
134
  requestVersion: input.requestVersion,
@@ -117,16 +136,80 @@ export function postBuzzDecisionCard(ref, config) {
117
136
  relayUrl: config.relayUrl,
118
137
  community: ref.community,
119
138
  channelId: ref.channelId,
120
- cardEventId: result.event_id,
139
+ cardEventId: event.id,
121
140
  options: input.options,
122
141
  expiresAt: input.expiresAt,
123
- postedAt: new Date((config.now ?? (() => Date.now()))()).toISOString(),
142
+ postedAt: preparedAt,
124
143
  };
125
- await config.receiptStore.save(receipt);
126
- return receipt;
144
+ const deliveryKey = buzzDecisionCardDeliveryKey(ref.community, ref.channelId, input.approvalRequestId, input.requestVersion);
145
+ const delivery = await config.deliveryStore.prepareDelivery({
146
+ deliveryKey,
147
+ event,
148
+ receipt,
149
+ status: "prepared",
150
+ preparedAt,
151
+ });
152
+ assertPreparedDelivery(delivery, {
153
+ deliveryKey,
154
+ input,
155
+ ref,
156
+ rendered,
157
+ signerPubkey: event.pubkey,
158
+ relayUrl: config.relayUrl,
159
+ });
160
+ if (delivery.status !== "published") {
161
+ let present = false;
162
+ let resultMessage;
163
+ try {
164
+ const result = await submitSignedBuzzEvent(config, delivery.event);
165
+ resultMessage = result.message;
166
+ if (result.event_id && result.event_id !== delivery.event.id) {
167
+ throw new Error(`relay returned mismatched event id ${result.event_id}`);
168
+ }
169
+ present = result.accepted !== false;
170
+ }
171
+ catch (error) {
172
+ if (config.signal?.aborted || (error instanceof Error && error.name === "AbortError")) {
173
+ throw error;
174
+ }
175
+ resultMessage = error instanceof Error ? error.message : String(error);
176
+ }
177
+ if (!present) {
178
+ // Submission may have committed before a timeout/disconnect. Query by
179
+ // the immutable event id instead of minting a second card.
180
+ const matches = await queryBuzzEvents(config, [
181
+ { ids: [delivery.event.id], kinds: [delivery.event.kind], limit: 1 },
182
+ ]).catch(() => []);
183
+ present = matches.some((candidate) => candidate.id === delivery.event.id);
184
+ }
185
+ if (!present)
186
+ throw new Error(`decision card post not confirmed: ${resultMessage ?? "relay rejected event"}`);
187
+ await config.deliveryStore.markDeliveryPublished(delivery.deliveryKey, new Date((config.now ?? (() => Date.now()))()).toISOString());
188
+ }
189
+ return delivery.receipt;
127
190
  },
128
191
  });
129
192
  }
193
+ function assertPreparedDelivery(delivery, expected) {
194
+ const receipt = delivery.receipt;
195
+ const expectedTags = [["h", expected.ref.channelId], ...expected.rendered.tags];
196
+ if (delivery.deliveryKey !== expected.deliveryKey ||
197
+ delivery.event.id !== receipt.cardEventId ||
198
+ delivery.event.pubkey !== expected.signerPubkey ||
199
+ delivery.event.kind !== BUZZ_KINDS.STREAM_MESSAGE ||
200
+ delivery.event.content !== expected.rendered.content ||
201
+ JSON.stringify(delivery.event.tags) !== JSON.stringify(expectedTags) ||
202
+ receipt.approvalRequestId !== expected.input.approvalRequestId ||
203
+ receipt.requestVersion !== expected.input.requestVersion ||
204
+ receipt.proposedParametersHash !== expected.input.proposedParametersHash ||
205
+ receipt.relayUrl !== expected.relayUrl ||
206
+ receipt.community !== expected.ref.community ||
207
+ receipt.channelId !== expected.ref.channelId ||
208
+ JSON.stringify(receipt.options) !== JSON.stringify(expected.input.options) ||
209
+ receipt.expiresAt !== expected.input.expiresAt) {
210
+ throw new Error(`Buzz decision-card delivery ${expected.deliveryKey} conflicts with its immutable request.`);
211
+ }
212
+ }
130
213
  // ── Deterministic bridge ──
131
214
  /**
132
215
  * Fixed reaction→choice table (D14). NIP-25 `+`/`-` are included alongside
@@ -134,12 +217,12 @@ export function postBuzzDecisionCard(ref, config) {
134
217
  * surfaced for audit, never guessed.
135
218
  */
136
219
  export const BUZZ_DECISION_EMOJI = Object.freeze({
137
- '👍': 'approve',
138
- '✅': 'approve',
139
- '+': 'approve',
140
- '👎': 'reject',
141
- '❌': 'reject',
142
- '-': 'reject',
220
+ "👍": "approve",
221
+ "✅": "approve",
222
+ "+": "approve",
223
+ "👎": "reject",
224
+ "❌": "reject",
225
+ "-": "reject",
143
226
  });
144
227
  /**
145
228
  * The deterministic decision bridge (plan §4 steps 4–5). Pure lookup + fixed
@@ -150,14 +233,14 @@ export function createBuzzDecisionBridge(options) {
150
233
  const emojiMap = options.emojiMap ?? BUZZ_DECISION_EMOJI;
151
234
  async function resolveReaction(reaction) {
152
235
  if (!reaction.targetEventId)
153
- return { kind: 'not-a-decision' };
236
+ return { kind: "not-a-decision" };
154
237
  const receipt = await options.receiptStore.findByCardEvent(options.community, reaction.channelId, reaction.targetEventId);
155
238
  if (!receipt)
156
- return { kind: 'not-a-decision' };
239
+ return { kind: "not-a-decision" };
157
240
  const choice = emojiMap[reaction.emoji.trim()];
158
241
  if (!choice) {
159
242
  return {
160
- kind: 'unmapped-emoji',
243
+ kind: "unmapped-emoji",
161
244
  emoji: reaction.emoji,
162
245
  cardEventId: receipt.cardEventId,
163
246
  approvalRequestId: receipt.approvalRequestId,
@@ -165,7 +248,7 @@ export function createBuzzDecisionBridge(options) {
165
248
  };
166
249
  }
167
250
  return {
168
- kind: 'decision-candidate',
251
+ kind: "decision-candidate",
169
252
  candidate: {
170
253
  approvalRequestId: receipt.approvalRequestId,
171
254
  requestVersion: receipt.requestVersion,
@@ -175,20 +258,24 @@ export function createBuzzDecisionBridge(options) {
175
258
  channelId: receipt.channelId,
176
259
  cardEventId: receipt.cardEventId,
177
260
  reactionEventId: reaction.eventId,
178
- attestedIdentity: { namespace: 'nostr', externalId: reaction.pubkey, signatureRef: reaction.eventId },
261
+ attestedIdentity: {
262
+ namespace: "nostr",
263
+ externalId: reaction.pubkey,
264
+ signatureRef: reaction.eventId,
265
+ },
179
266
  },
180
267
  };
181
268
  }
182
269
  async function resolveReply(message) {
183
270
  // A reply targets a card when any `e` tag references the card event.
184
271
  const referenced = (message.tags ?? [])
185
- .filter((tag) => tag[0] === 'e' && typeof tag[1] === 'string')
272
+ .filter((tag) => tag[0] === "e" && typeof tag[1] === "string")
186
273
  .map((tag) => tag[1]);
187
274
  for (const eventId of referenced) {
188
275
  const receipt = await options.receiptStore.findByCardEvent(options.community, message.channelId, eventId);
189
276
  if (receipt) {
190
277
  return {
191
- kind: 'edit-proposal',
278
+ kind: "edit-proposal",
192
279
  proposal: {
193
280
  approvalRequestId: receipt.approvalRequestId,
194
281
  requestVersion: receipt.requestVersion,
@@ -197,12 +284,16 @@ export function createBuzzDecisionBridge(options) {
197
284
  cardEventId: receipt.cardEventId,
198
285
  proposalEventId: message.eventId,
199
286
  text: message.text,
200
- attestedIdentity: { namespace: 'nostr', externalId: message.pubkey, signatureRef: message.eventId },
287
+ attestedIdentity: {
288
+ namespace: "nostr",
289
+ externalId: message.pubkey,
290
+ signatureRef: message.eventId,
291
+ },
201
292
  },
202
293
  };
203
294
  }
204
295
  }
205
- return { kind: 'not-a-decision' };
296
+ return { kind: "not-a-decision" };
206
297
  }
207
298
  return { resolveReaction, resolveReply };
208
299
  }