@automagik/omni 2.260422.7 → 2.260422.9
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/_journal.json +7 -0
- package/dist/index.js +21 -6
- package/dist/server/index.js +568 -510
- 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");
|
|
@@ -204,6 +204,13 @@
|
|
|
204
204
|
"when": 1777000000000,
|
|
205
205
|
"tag": "0028_drop_trigger_rate_limit",
|
|
206
206
|
"breakpoints": true
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"idx": 29,
|
|
210
|
+
"version": "7",
|
|
211
|
+
"when": 1777200000000,
|
|
212
|
+
"tag": "0029_processed_events",
|
|
213
|
+
"breakpoints": true
|
|
207
214
|
}
|
|
208
215
|
]
|
|
209
216
|
}
|
package/dist/index.js
CHANGED
|
@@ -56024,6 +56024,12 @@ var init_table2 = __esm(() => {
|
|
|
56024
56024
|
});
|
|
56025
56025
|
|
|
56026
56026
|
// ../../node_modules/.bun/drizzle-orm@0.38.4+328b604dc2ea497f/node_modules/drizzle-orm/pg-core/primary-keys.js
|
|
56027
|
+
function primaryKey(...config2) {
|
|
56028
|
+
if (config2[0].columns) {
|
|
56029
|
+
return new PrimaryKeyBuilder(config2[0].columns, config2[0].name);
|
|
56030
|
+
}
|
|
56031
|
+
return new PrimaryKeyBuilder(config2);
|
|
56032
|
+
}
|
|
56027
56033
|
var PrimaryKeyBuilder, PrimaryKey;
|
|
56028
56034
|
var init_primary_keys = __esm(() => {
|
|
56029
56035
|
init_entity();
|
|
@@ -56126,19 +56132,19 @@ function extractTablesRelationalConfig(schema, configHelpers) {
|
|
|
56126
56132
|
const dbName = getTableUniqueName(value.table);
|
|
56127
56133
|
const tableName = tableNamesMap[dbName];
|
|
56128
56134
|
const relations2 = value.config(configHelpers(value.table));
|
|
56129
|
-
let
|
|
56135
|
+
let primaryKey2;
|
|
56130
56136
|
for (const [relationName, relation] of Object.entries(relations2)) {
|
|
56131
56137
|
if (tableName) {
|
|
56132
56138
|
const tableConfig = tablesConfig[tableName];
|
|
56133
56139
|
tableConfig.relations[relationName] = relation;
|
|
56134
|
-
if (
|
|
56135
|
-
tableConfig.primaryKey.push(...
|
|
56140
|
+
if (primaryKey2) {
|
|
56141
|
+
tableConfig.primaryKey.push(...primaryKey2);
|
|
56136
56142
|
}
|
|
56137
56143
|
} else {
|
|
56138
56144
|
if (!(dbName in relationsBuffer)) {
|
|
56139
56145
|
relationsBuffer[dbName] = {
|
|
56140
56146
|
relations: {},
|
|
56141
|
-
primaryKey
|
|
56147
|
+
primaryKey: primaryKey2
|
|
56142
56148
|
};
|
|
56143
56149
|
}
|
|
56144
56150
|
relationsBuffer[dbName].relations[relationName] = relation;
|
|
@@ -58438,6 +58444,7 @@ __export(exports_schema, {
|
|
|
58438
58444
|
ruleTypes: () => ruleTypes,
|
|
58439
58445
|
replyFilterMode: () => replyFilterMode,
|
|
58440
58446
|
providerSchemas: () => providerSchemas,
|
|
58447
|
+
processedEvents: () => processedEvents,
|
|
58441
58448
|
pluginStorage: () => pluginStorage,
|
|
58442
58449
|
platformIdentitiesRelations: () => platformIdentitiesRelations,
|
|
58443
58450
|
platformIdentities: () => platformIdentities,
|
|
@@ -58516,7 +58523,7 @@ __export(exports_schema, {
|
|
|
58516
58523
|
accessRules: () => accessRules,
|
|
58517
58524
|
accessModes: () => accessModes
|
|
58518
58525
|
});
|
|
58519
|
-
var channelTypes, agentTypes, agentSystems, agentEntityTypes, debounceMode, splitDelayMode, replyFilterMode, agentSessionStrategies, ruleTypes, accessModes, settingValueTypes, apiKeyStatuses, apiKeyProfiles, eventTypes, contentTypes, chatTypes, messageSources, messageTypes, messageStatuses, deliveryStatuses, jobStatuses, providerSchemas, agentProviders, agents, agentRoutes, agentSessions, apiKeys, apiKeyAuditLogs, apiKeysRelations, apiKeyAuditLogsRelations, instances, persons, platformIdentities, conversations, chats, chatParticipants, omniGroups, messages, omniEvents, handoffLogs, accessRules, globalSettings, settingChangeHistory, batchJobs, syncJobTypes, syncJobs, mediaContent, chatIdMappings, pluginStorage, agentProvidersRelations, agentsRelations, instancesRelations, syncJobsRelations, personsRelations, platformIdentitiesRelations, conversationsRelations, chatsRelations, chatParticipantsRelations, messagesRelations, omniEventsRelations, accessRulesRelations, globalSettingsRelations, settingChangeHistoryRelations, batchJobsRelations, mediaContentRelations, chatIdMappingsRelations, deadLetterStatuses, deadLetterEvents, payloadStorageConfig, payloadStages, eventPayloads, webhookSources, conditionOperators, actionTypes, automationDebounceModes, automations2, automationLogStatuses, automationLogs, consumerOffsets, automationsRelations, automationLogsRelations, triggerLogs, triggerLogsRelations, agentRoutesRelations, agentTaskStatuses, agentTasks, agentTasksRelations, turnStatuses, turnActions, turns, turnsRelations, followUpDisarmReasons, chatFollowUpState, chatFollowUpStateRelations;
|
|
58526
|
+
var channelTypes, agentTypes, agentSystems, agentEntityTypes, debounceMode, splitDelayMode, replyFilterMode, agentSessionStrategies, ruleTypes, accessModes, settingValueTypes, apiKeyStatuses, apiKeyProfiles, eventTypes, contentTypes, chatTypes, messageSources, messageTypes, messageStatuses, deliveryStatuses, jobStatuses, providerSchemas, agentProviders, agents, agentRoutes, agentSessions, apiKeys, apiKeyAuditLogs, apiKeysRelations, apiKeyAuditLogsRelations, instances, persons, platformIdentities, conversations, chats, chatParticipants, omniGroups, messages, omniEvents, handoffLogs, accessRules, globalSettings, settingChangeHistory, batchJobs, syncJobTypes, syncJobs, mediaContent, chatIdMappings, pluginStorage, agentProvidersRelations, agentsRelations, instancesRelations, syncJobsRelations, personsRelations, platformIdentitiesRelations, conversationsRelations, chatsRelations, chatParticipantsRelations, messagesRelations, omniEventsRelations, accessRulesRelations, globalSettingsRelations, settingChangeHistoryRelations, batchJobsRelations, mediaContentRelations, chatIdMappingsRelations, deadLetterStatuses, deadLetterEvents, payloadStorageConfig, payloadStages, eventPayloads, webhookSources, conditionOperators, actionTypes, automationDebounceModes, automations2, automationLogStatuses, automationLogs, consumerOffsets, automationsRelations, automationLogsRelations, triggerLogs, triggerLogsRelations, agentRoutesRelations, agentTaskStatuses, agentTasks, agentTasksRelations, turnStatuses, turnActions, turns, turnsRelations, followUpDisarmReasons, chatFollowUpState, chatFollowUpStateRelations, processedEvents;
|
|
58520
58527
|
var init_schema2 = __esm(() => {
|
|
58521
58528
|
init_events();
|
|
58522
58529
|
init_drizzle_orm();
|
|
@@ -59804,6 +59811,14 @@ var init_schema2 = __esm(() => {
|
|
|
59804
59811
|
references: [agents.id]
|
|
59805
59812
|
})
|
|
59806
59813
|
}));
|
|
59814
|
+
processedEvents = pgTable("processed_events", {
|
|
59815
|
+
eventId: varchar("event_id", { length: 255 }).notNull(),
|
|
59816
|
+
handler: varchar("handler", { length: 100 }).notNull(),
|
|
59817
|
+
processedAt: timestamp("processed_at").notNull().defaultNow()
|
|
59818
|
+
}, (table3) => ({
|
|
59819
|
+
pk: primaryKey({ columns: [table3.eventId, table3.handler], name: "processed_events_pk" }),
|
|
59820
|
+
processedAtIdx: index("processed_events_processed_at_idx").on(table3.processedAt)
|
|
59821
|
+
}));
|
|
59807
59822
|
});
|
|
59808
59823
|
|
|
59809
59824
|
// ../../node_modules/.bun/postgres@3.4.8/node_modules/postgres/src/query.js
|
|
@@ -113803,7 +113818,7 @@ import { fileURLToPath } from "url";
|
|
|
113803
113818
|
// package.json
|
|
113804
113819
|
var package_default = {
|
|
113805
113820
|
name: "@automagik/omni",
|
|
113806
|
-
version: "2.260422.
|
|
113821
|
+
version: "2.260422.9",
|
|
113807
113822
|
description: "LLM-optimized CLI for Omni",
|
|
113808
113823
|
type: "module",
|
|
113809
113824
|
bin: {
|