@automagik/omni 2.260906.2 → 2.260906.4
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/0057_connector_lifecycle_contract.sql +40 -0
- package/db/drizzle/0058_omni_events_causation_id.sql +24 -0
- package/db/drizzle/meta/_journal.json +14 -0
- package/dist/commands/events.d.ts +14 -0
- package/dist/commands/events.d.ts.map +1 -1
- package/dist/commands/webhooks.d.ts.map +1 -1
- package/dist/index.js +410 -65
- package/dist/sdk/client.d.ts +21 -0
- package/dist/sdk/client.d.ts.map +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +7 -0
- package/dist/sdk/types.generated.d.ts +376 -10
- package/dist/sdk/types.generated.d.ts.map +1 -1
- package/dist/server/index.js +760 -223
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
-- Connector lifecycle contract (#961) — liveness, heartbeat, declared
|
|
2
|
+
-- window/mutation semantics on webhook_sources.
|
|
3
|
+
--
|
|
4
|
+
-- A source that declares expected_interval_seconds promises "≥1 event or
|
|
5
|
+
-- heartbeat per N seconds". The liveness sweeper compares the most recent
|
|
6
|
+
-- signal — GREATEST(last_received_at, last_heartbeat_at, liveness_armed_at) —
|
|
7
|
+
-- against that window and owns every liveness_status transition, so
|
|
8
|
+
-- system.connector.stalled / system.connector.recovered are emitted exactly
|
|
9
|
+
-- once per transition.
|
|
10
|
+
--
|
|
11
|
+
-- expected_interval_seconds integer declared cadence; NULL = unsupervised
|
|
12
|
+
-- last_heartbeat_at timestamptz "I ran, zero events found" — the
|
|
13
|
+
-- heartbeat verb's compacted trace
|
|
14
|
+
-- (no journal event per heartbeat)
|
|
15
|
+
-- heartbeat_count integer total heartbeats received
|
|
16
|
+
-- liveness_status varchar(20) 'healthy' | 'stalled'; NULL = unsupervised
|
|
17
|
+
-- liveness_armed_at timestamptz when the cadence was (re)declared —
|
|
18
|
+
-- a fresh window before a stall can fire
|
|
19
|
+
-- stalled_at timestamptz when the current stall began
|
|
20
|
+
-- window_semantics varchar(40) 'future_only' | 'includes_in_progress'
|
|
21
|
+
-- mutation_policy varchar(20) 'same_id' | 'new_id' (feeds #958's
|
|
22
|
+
-- idempotency key template choice)
|
|
23
|
+
--
|
|
24
|
+
-- Hand-written following the 0044-0055 precedent (snapshot drift keeps
|
|
25
|
+
-- drizzle-kit generate interactive). Additive + idempotent. No explicit
|
|
26
|
+
-- BEGIN/COMMIT — the boot migrator executes this file on a pooled postgres-js
|
|
27
|
+
-- connection, which rejects raw transaction control.
|
|
28
|
+
|
|
29
|
+
ALTER TABLE "webhook_sources" ADD COLUMN IF NOT EXISTS "expected_interval_seconds" integer;
|
|
30
|
+
ALTER TABLE "webhook_sources" ADD COLUMN IF NOT EXISTS "last_heartbeat_at" timestamp with time zone;
|
|
31
|
+
ALTER TABLE "webhook_sources" ADD COLUMN IF NOT EXISTS "heartbeat_count" integer DEFAULT 0 NOT NULL;
|
|
32
|
+
ALTER TABLE "webhook_sources" ADD COLUMN IF NOT EXISTS "liveness_status" varchar(20);
|
|
33
|
+
ALTER TABLE "webhook_sources" ADD COLUMN IF NOT EXISTS "liveness_armed_at" timestamp with time zone;
|
|
34
|
+
ALTER TABLE "webhook_sources" ADD COLUMN IF NOT EXISTS "stalled_at" timestamp with time zone;
|
|
35
|
+
ALTER TABLE "webhook_sources" ADD COLUMN IF NOT EXISTS "window_semantics" varchar(40);
|
|
36
|
+
ALTER TABLE "webhook_sources" ADD COLUMN IF NOT EXISTS "mutation_policy" varchar(20);
|
|
37
|
+
|
|
38
|
+
-- The liveness sweeper's scan: enabled sources with a declared cadence.
|
|
39
|
+
CREATE INDEX IF NOT EXISTS "webhook_sources_supervised_idx"
|
|
40
|
+
ON "webhook_sources" ("enabled") WHERE "expected_interval_seconds" IS NOT NULL;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- causationId in the persisted event journal (#957, RFC #925 G3 feature half).
|
|
2
|
+
--
|
|
3
|
+
-- `metadata->correlationId` groups a flow (the bag of events); `causation_id`
|
|
4
|
+
-- gives the tree — the id of the IMMEDIATE parent event whose consumption
|
|
5
|
+
-- caused this one to be published. NULL for root events (external ingress
|
|
6
|
+
-- mints a fresh correlation, no parent) and for every pre-existing row
|
|
7
|
+
-- (forward-only: the ~349k historical journal events have no derivable
|
|
8
|
+
-- parent, no backfill). Not an FK — the parent may never have been persisted
|
|
9
|
+
-- or may have been pruned.
|
|
10
|
+
--
|
|
11
|
+
-- The index serves the `omni events trace` descendants walk
|
|
12
|
+
-- (children = rows WHERE causation_id = :id).
|
|
13
|
+
--
|
|
14
|
+
-- Hand-written following the 0055_asc_flow_handoff_mode precedent (additive,
|
|
15
|
+
-- idempotent — the snapshot chain stops at 0026 so drizzle-kit generate is
|
|
16
|
+
-- not usable here). No explicit BEGIN/COMMIT — the boot migrator executes
|
|
17
|
+
-- this file on a pooled postgres-js connection, which rejects raw transaction
|
|
18
|
+
-- control. ADD COLUMN with no default does not rewrite the table.
|
|
19
|
+
|
|
20
|
+
ALTER TABLE "omni_events"
|
|
21
|
+
ADD COLUMN IF NOT EXISTS "causation_id" uuid;
|
|
22
|
+
|
|
23
|
+
CREATE INDEX IF NOT EXISTS "omni_events_causation_idx"
|
|
24
|
+
ON "omni_events" ("causation_id");
|
|
@@ -400,6 +400,20 @@
|
|
|
400
400
|
"when": 1785600000000,
|
|
401
401
|
"tag": "0056_event_schema_registry",
|
|
402
402
|
"breakpoints": true
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"idx": 57,
|
|
406
|
+
"version": "7",
|
|
407
|
+
"when": 1785700000000,
|
|
408
|
+
"tag": "0057_connector_lifecycle_contract",
|
|
409
|
+
"breakpoints": true
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"idx": 58,
|
|
413
|
+
"version": "7",
|
|
414
|
+
"when": 1785800000000,
|
|
415
|
+
"tag": "0058_omni_events_causation_id",
|
|
416
|
+
"breakpoints": true
|
|
403
417
|
}
|
|
404
418
|
]
|
|
405
419
|
}
|
|
@@ -3,11 +3,25 @@
|
|
|
3
3
|
*
|
|
4
4
|
* omni events list --instance <id>
|
|
5
5
|
* omni events stream [flags]
|
|
6
|
+
* omni events trace <id>
|
|
6
7
|
* omni events search <query>
|
|
7
8
|
* omni events timeline <person-id>
|
|
8
9
|
*/
|
|
9
10
|
import type { Event } from '@omni/sdk';
|
|
10
11
|
import { Command } from 'commander';
|
|
12
|
+
/** One journal row as returned inside a trace response. */
|
|
13
|
+
interface TraceEvent {
|
|
14
|
+
id: string;
|
|
15
|
+
eventType: string;
|
|
16
|
+
receivedAt: string;
|
|
17
|
+
causationId: string | null;
|
|
18
|
+
metadata?: {
|
|
19
|
+
correlationId?: string;
|
|
20
|
+
} | null;
|
|
21
|
+
textContent?: string | null;
|
|
22
|
+
}
|
|
23
|
+
/** One human-readable trace line: type, short id, time, correlation. */
|
|
24
|
+
export declare function formatTraceLine(event: TraceEvent, marker: string): string;
|
|
11
25
|
/** A registered event schema as returned by the API. */
|
|
12
26
|
interface EventSchemaData {
|
|
13
27
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/commands/events.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/commands/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsMpC,2DAA2D;AAC3D,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE;QAAE,aAAa,CAAC,EA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