@automagik/omni 2.260422.8 → 2.260422.12
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/db/drizzle/0029_processed_events.sql +22 -0
- package/db/drizzle/meta/0013_snapshot.json +6926 -0
- package/db/drizzle/meta/0014_snapshot.json +6938 -0
- package/db/drizzle/meta/_journal.json +7 -0
- package/dist/index.js +21 -6
- package/dist/server/index.js +588 -503
- package/package.json +9 -9
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- Idempotency ledger for durable NATS subscribers (#411).
|
|
2
|
+
--
|
|
3
|
+
-- Background: durable consumers re-deliver messages on PM2 restart / SIGKILL
|
|
4
|
+
-- when the handler hadn't ACKed before death (ack_wait = 30s). Handlers with
|
|
5
|
+
-- non-idempotent side-effects (send WhatsApp message, delete Agno session,
|
|
6
|
+
-- dispatch agent turn) re-fired the side-effect, leading to customer-visible
|
|
7
|
+
-- duplicates (issue #411 — Gustavo received "✅ Conversa limpa!" up to 5x).
|
|
8
|
+
--
|
|
9
|
+
-- The (event_id, handler) row is claimed BEFORE the side-effect runs.
|
|
10
|
+
-- On replay the claim hits the PK constraint and the side-effect is skipped.
|
|
11
|
+
-- Composite key lets multiple handlers (session-cleaner, agent-dispatcher,
|
|
12
|
+
-- agent-responder) independently mark the same event id.
|
|
13
|
+
|
|
14
|
+
CREATE TABLE IF NOT EXISTS "processed_events" (
|
|
15
|
+
"event_id" varchar(255) NOT NULL,
|
|
16
|
+
"handler" varchar(100) NOT NULL,
|
|
17
|
+
"processed_at" timestamp DEFAULT now() NOT NULL,
|
|
18
|
+
CONSTRAINT "processed_events_pk" PRIMARY KEY("event_id", "handler")
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
CREATE INDEX IF NOT EXISTS "processed_events_processed_at_idx"
|
|
22
|
+
ON "processed_events" USING btree ("processed_at");
|