feat(workflows): sign delivery verification receipts

Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
Logan Johnson
2026-08-26 12:04:20 -04:00
committed by Larry
parent aa73cf53d0
commit 557c6a355b
9 changed files with 583 additions and 4 deletions

View File

@@ -536,6 +536,24 @@ CREATE INDEX idx_workflow_agent_deliveries_lease
ON workflow_agent_deliveries (lease_until)
WHERE status = 'claimed';
-- ── Workflow webhook invocations ─────────────────────────────────────────────
-- Payload-free durable authority linking an opaque webhook call to its run.
CREATE TABLE workflow_webhook_invocations (
community_id UUID NOT NULL REFERENCES communities(id),
invocation_id UUID NOT NULL,
workflow_id UUID NOT NULL,
workflow_run_id UUID,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
PRIMARY KEY (community_id, invocation_id),
FOREIGN KEY (community_id, workflow_id)
REFERENCES workflows (community_id, id) ON DELETE CASCADE,
FOREIGN KEY (community_id, workflow_run_id)
REFERENCES workflow_runs (community_id, id) ON DELETE NO ACTION
);
CREATE INDEX idx_workflow_webhook_invocations_created_at
ON workflow_webhook_invocations (created_at);
-- ── API tokens ────────────────────────────────────────────────────────────────
-- Conformance: "API tokens and NIP-98 replay". token_hash uniqueness scoped to
-- (community_id, token_hash); channel claims reference channels in same community.
@@ -1810,6 +1828,7 @@ SELECT attach_community_write_fence('reactions');
SELECT attach_community_write_fence('relay_invites');
SELECT attach_community_write_fence('relay_members');
SELECT attach_community_write_fence('scheduled_workflow_fires');
SELECT attach_community_write_fence('workflow_webhook_invocations');
SELECT attach_community_write_fence('subscriptions');
SELECT attach_community_write_fence('thread_metadata');
SELECT attach_community_write_fence('users');