@relayfx/sdk 0.0.50 → 0.1.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 +5 -0
- package/dist/ai.js +42 -17222
- package/dist/index-q0z11q9m.js +18726 -0
- package/dist/index-sms8x6cq.js +137 -0
- package/dist/index-vbf5hcw8.js +2156 -0
- package/dist/index.js +741 -18839
- package/dist/migrations/20260712120000_durable_inbox/migration.sql +9 -0
- package/dist/migrations/20260712140000_execution_state/migration.sql +5 -0
- package/dist/migrations/20260712150000_durable_entities/migration.sql +15 -0
- package/dist/migrations/20260712160000_ephemeral_presence/migration.sql +13 -0
- package/dist/migrations/20260712170000_topic_subscriptions/migration.sql +3 -0
- package/dist/migrations/mysql/0003_durable_inbox.sql +3 -0
- package/dist/migrations/mysql/0004_execution_state.sql +3 -0
- package/dist/migrations/mysql/0005_durable_entities.sql +13 -0
- package/dist/migrations/mysql/0006_ephemeral_presence.sql +12 -0
- package/dist/migrations/mysql/0007_topic_subscriptions.sql +1 -0
- package/dist/migrations/pg/20260712120000_durable_inbox/migration.sql +9 -0
- package/dist/migrations/pg/20260712140000_execution_state/migration.sql +5 -0
- package/dist/migrations/pg/20260712150000_durable_entities/migration.sql +15 -0
- package/dist/migrations/pg/20260712160000_ephemeral_presence/migration.sql +13 -0
- package/dist/migrations/pg/20260712170000_topic_subscriptions/migration.sql +3 -0
- package/dist/migrations/sqlite/0003_durable_inbox.sql +9 -0
- package/dist/migrations/sqlite/0004_execution_state.sql +3 -0
- package/dist/migrations/sqlite/0005_durable_entities.sql +15 -0
- package/dist/migrations/sqlite/0006_ephemeral_presence.sql +12 -0
- package/dist/migrations/sqlite/0007_topic_subscriptions.sql +3 -0
- package/dist/sqlite.js +688 -0
- package/dist/types/relay/client.d.ts +197 -17
- package/dist/types/relay/command.d.ts +41 -0
- package/dist/types/relay/database.d.ts +1 -0
- package/dist/types/relay/index.d.ts +3 -2
- package/dist/types/relay/operation.d.ts +520 -2
- package/dist/types/relay/sqlite-migrations.d.ts +39 -0
- package/dist/types/relay/sqlite-runtime.d.ts +5 -0
- package/dist/types/relay/sqlite.d.ts +27 -0
- package/dist/types/runtime/address/address-book-service.d.ts +4 -4
- package/dist/types/runtime/address/address-resolution-service.d.ts +1 -1
- package/dist/types/runtime/agent/agent-loop-service.d.ts +2 -2
- package/dist/types/runtime/agent/agent-registry-service.d.ts +1 -1
- package/dist/types/runtime/agent/relay-compaction.d.ts +1 -1
- package/dist/types/runtime/agent/relay-permissions.d.ts +1 -1
- package/dist/types/runtime/agent/relay-steering.d.ts +1 -1
- package/dist/types/runtime/child/child-run-service.d.ts +1 -1
- package/dist/types/runtime/child/parent-notifier-service.d.ts +1 -1
- package/dist/types/runtime/cluster/execution-entity.d.ts +1 -1
- package/dist/types/runtime/entity/entity-instance-service.d.ts +67 -0
- package/dist/types/runtime/entity/entity-registry-service.d.ts +35 -0
- package/dist/types/runtime/envelope/envelope-service.d.ts +7 -3
- package/dist/types/runtime/execution/event-log-service.d.ts +1 -1
- package/dist/types/runtime/execution/execution-service.d.ts +1 -1
- package/dist/types/runtime/execution/execution-watch-service.d.ts +32 -0
- package/dist/types/runtime/execution/session-stream-service.d.ts +33 -0
- package/dist/types/runtime/inbox/inbox-service.d.ts +76 -0
- package/dist/types/runtime/inbox/send-message-tool.d.ts +27 -0
- package/dist/types/runtime/inbox/wait-for-messages-tool.d.ts +34 -0
- package/dist/types/runtime/index.d.ts +13 -0
- package/dist/types/runtime/memory/memory-service.d.ts +1 -1
- package/dist/types/runtime/presence/presence-service.d.ts +30 -0
- package/dist/types/runtime/presence/presence-tool.d.ts +20 -0
- package/dist/types/runtime/runner/runner-runtime-service.d.ts +18 -18
- package/dist/types/runtime/schedule/scheduler-service.d.ts +1 -1
- package/dist/types/runtime/session/session-store-service.d.ts +1 -1
- package/dist/types/runtime/skill/skill-registry-service.d.ts +1 -1
- package/dist/types/runtime/state/execution-state-service.d.ts +57 -0
- package/dist/types/runtime/state/state-tools.d.ts +5 -0
- package/dist/types/runtime/tool/tool-runtime-service.d.ts +1 -1
- package/dist/types/runtime/topic/publish-to-topic-tool.d.ts +24 -0
- package/dist/types/runtime/topic/topic-service.d.ts +50 -0
- package/dist/types/runtime/wait/wait-service.d.ts +2 -1
- package/dist/types/runtime/wait/wait-signal.d.ts +1 -1
- package/dist/types/runtime/workflow/execution-workflow.d.ts +2 -2
- package/dist/types/runtime/workspace/workspace-planner-service.d.ts +1 -1
- package/dist/types/schema/address-schema.d.ts +6 -6
- package/dist/types/schema/entity-schema.d.ts +40 -0
- package/dist/types/schema/envelope-schema.d.ts +1 -0
- package/dist/types/schema/execution-schema.d.ts +2 -2
- package/dist/types/schema/ids-schema.d.ts +8 -0
- package/dist/types/schema/inbox-schema.d.ts +81 -0
- package/dist/types/schema/index.d.ts +4 -0
- package/dist/types/schema/presence-schema.d.ts +28 -0
- package/dist/types/schema/state-schema.d.ts +35 -0
- package/dist/types/store-sql/address/address-book-repository.d.ts +1 -1
- package/dist/types/store-sql/database/database-service.d.ts +4 -18
- package/dist/types/store-sql/database/notification-bus.d.ts +2 -0
- package/dist/types/store-sql/database/sql-dialect.d.ts +13 -0
- package/dist/types/store-sql/entity/entity-repository.d.ts +36 -0
- package/dist/types/store-sql/envelope/envelope-repository.d.ts +1 -0
- package/dist/types/store-sql/execution/execution-event-repository.d.ts +2 -1
- package/dist/types/store-sql/execution/execution-repository.d.ts +12 -2
- package/dist/types/store-sql/inbox/inbox-repository.d.ts +56 -0
- package/dist/types/store-sql/index.d.ts +6 -0
- package/dist/types/store-sql/portable.d.ts +27 -0
- package/dist/types/store-sql/presence/presence-repository.d.ts +51 -0
- package/dist/types/store-sql/schema/relay-schema.d.ts +1352 -140
- package/dist/types/store-sql/state/execution-state-repository.d.ts +80 -0
- package/dist/types/store-sql/tenant/tenant-id.d.ts +0 -2
- package/dist/types/store-sql/topic/topic-repository.d.ts +44 -0
- package/package.json +26 -4
- package/dist/migrations/20260701002839_sour_cerebro/snapshot.json +0 -1971
- package/dist/migrations/20260701041134_acoustic_hulk/snapshot.json +0 -2372
- package/dist/migrations/20260701160543_condemned_stryfe/snapshot.json +0 -2442
- package/dist/migrations/20260701220315_heavy_gorgon/snapshot.json +0 -2495
- package/dist/migrations/20260701225444_polite_lord_hawal/snapshot.json +0 -2821
- package/dist/migrations/20260702030128_flaky_misty_knight/snapshot.json +0 -2821
- package/dist/migrations/20260705003847_nervous_banshee/snapshot.json +0 -2954
- package/dist/migrations/20260705012626_common_stryfe/snapshot.json +0 -3378
- package/dist/migrations/20260705015420_sweet_captain_marvel/snapshot.json +0 -3485
- package/dist/migrations/20260705023041_chunky_scalphunter/snapshot.json +0 -3753
- package/dist/migrations/20260705030344_short_patriot/snapshot.json +0 -3873
- package/dist/migrations/20260705045546_heavy_ben_grimm/snapshot.json +0 -4193
- package/dist/migrations/20260706185931_regular_shadow_king/snapshot.json +0 -4844
- package/dist/migrations/20260706233300_equal_cyclops/snapshot.json +0 -4883
- package/dist/migrations/20260709030349_agent_id_rename/snapshot.json +0 -4883
- package/dist/migrations/20260709214238_faithful_black_widow/snapshot.json +0 -5426
- package/dist/migrations/20260709220016_fearless_aaron_stack/snapshot.json +0 -5426
- package/dist/migrations/pg/20260701002839_sour_cerebro/snapshot.json +0 -1971
- package/dist/migrations/pg/20260701041134_acoustic_hulk/snapshot.json +0 -2372
- package/dist/migrations/pg/20260701160543_condemned_stryfe/snapshot.json +0 -2442
- package/dist/migrations/pg/20260701220315_heavy_gorgon/snapshot.json +0 -2495
- package/dist/migrations/pg/20260701225444_polite_lord_hawal/snapshot.json +0 -2821
- package/dist/migrations/pg/20260702030128_flaky_misty_knight/snapshot.json +0 -2821
- package/dist/migrations/pg/20260705003847_nervous_banshee/snapshot.json +0 -2954
- package/dist/migrations/pg/20260705012626_common_stryfe/snapshot.json +0 -3378
- package/dist/migrations/pg/20260705015420_sweet_captain_marvel/snapshot.json +0 -3485
- package/dist/migrations/pg/20260705023041_chunky_scalphunter/snapshot.json +0 -3753
- package/dist/migrations/pg/20260705030344_short_patriot/snapshot.json +0 -3873
- package/dist/migrations/pg/20260705045546_heavy_ben_grimm/snapshot.json +0 -4193
- package/dist/migrations/pg/20260706185931_regular_shadow_king/snapshot.json +0 -4844
- package/dist/migrations/pg/20260706233300_equal_cyclops/snapshot.json +0 -4883
- package/dist/migrations/pg/20260709030349_agent_id_rename/snapshot.json +0 -4883
- package/dist/migrations/pg/20260709214238_faithful_black_widow/snapshot.json +0 -5426
- package/dist/migrations/pg/20260709220016_fearless_aaron_stack/snapshot.json +0 -5426
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
CREATE TABLE "relay_inbox_messages" ("tenant_id" text DEFAULT 'tenant:system' NOT NULL, "execution_id" text NOT NULL, "sequence" integer NOT NULL, "from_address_id" text NOT NULL, "envelope_id" text, "content_json" jsonb NOT NULL, "reply_wait_id" text, "correlation_key" text, "idempotency_key" text, "drain_id" text, "consumed_at" timestamp with time zone, "metadata_json" jsonb, "created_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "pk_relay_inbox_messages" PRIMARY KEY("tenant_id","execution_id","sequence"));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE UNIQUE INDEX "uq_relay_inbox_messages_idempotency" ON "relay_inbox_messages" ("tenant_id","execution_id","idempotency_key");
|
|
4
|
+
--> statement-breakpoint
|
|
5
|
+
CREATE INDEX "idx_relay_inbox_messages_unconsumed" ON "relay_inbox_messages" ("tenant_id","execution_id","consumed_at","sequence");
|
|
6
|
+
--> statement-breakpoint
|
|
7
|
+
CREATE INDEX "idx_relay_inbox_messages_drain" ON "relay_inbox_messages" ("tenant_id","execution_id","drain_id","sequence");
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
CREATE TABLE "relay_inbox_drains" ("tenant_id" text DEFAULT 'tenant:system' NOT NULL, "execution_id" text NOT NULL, "drain_id" text NOT NULL, "message_sequences_json" jsonb DEFAULT '[]'::jsonb NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "pk_relay_inbox_drains" PRIMARY KEY("tenant_id","execution_id","drain_id"));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
CREATE TABLE "relay_execution_state" ("tenant_id" text NOT NULL, "execution_id" text NOT NULL, "state_key" text NOT NULL, "value_json" jsonb NOT NULL, "version" integer NOT NULL, "created_at" timestamptz NOT NULL, "updated_at" timestamptz NOT NULL, CONSTRAINT "pk_relay_execution_state" PRIMARY KEY("tenant_id","execution_id","state_key"));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE TABLE "relay_execution_state_ops" ("tenant_id" text NOT NULL, "execution_id" text NOT NULL, "idempotency_key" text NOT NULL, "state_key" text NOT NULL, "version" integer NOT NULL, "op" text NOT NULL CHECK ("op" IN ('put','delete')), "result_present" boolean NOT NULL, "result_value_json" jsonb, "result_created_at" timestamptz, "result_updated_at" timestamptz, "created_at" timestamptz NOT NULL, CONSTRAINT "pk_relay_execution_state_ops" PRIMARY KEY("tenant_id","execution_id","idempotency_key"));
|
|
4
|
+
--> statement-breakpoint
|
|
5
|
+
CREATE INDEX "idx_relay_execution_state_ops_version" ON "relay_execution_state_ops" ("tenant_id","execution_id","state_key","version");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
CREATE TABLE relay_entity_kinds (
|
|
2
|
+
tenant_id text NOT NULL DEFAULT 'tenant:system', kind text NOT NULL, agent_id text NOT NULL,
|
|
3
|
+
inbox_policy_json jsonb, state_enabled integer, continue_as_new_after_turns integer,
|
|
4
|
+
metadata_json jsonb NOT NULL DEFAULT '{}', created_at timestamptz NOT NULL DEFAULT now(),
|
|
5
|
+
updated_at timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (tenant_id, kind)
|
|
6
|
+
);
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
CREATE TABLE relay_entity_instances (
|
|
9
|
+
tenant_id text NOT NULL DEFAULT 'tenant:system', kind text NOT NULL, "key" text NOT NULL,
|
|
10
|
+
address_id text NOT NULL, execution_id text NOT NULL, generation integer NOT NULL,
|
|
11
|
+
status text NOT NULL, created_at timestamptz NOT NULL DEFAULT now(), destroyed_at timestamptz,
|
|
12
|
+
PRIMARY KEY (tenant_id, kind, "key")
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
CREATE INDEX idx_relay_entity_instances_kind_status ON relay_entity_instances (tenant_id, kind, status);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE UNLOGGED TABLE "relay_presence" (
|
|
2
|
+
"tenant_id" text DEFAULT 'system' NOT NULL,
|
|
3
|
+
"id" text NOT NULL,
|
|
4
|
+
"scope_kind" text NOT NULL,
|
|
5
|
+
"scope_id" text NOT NULL,
|
|
6
|
+
"metadata_json" jsonb DEFAULT '{}' NOT NULL,
|
|
7
|
+
"connected_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
8
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
9
|
+
CONSTRAINT "pk_relay_presence" PRIMARY KEY("tenant_id","id","scope_kind","scope_id"),
|
|
10
|
+
CONSTRAINT "chk_relay_presence_scope_kind" CHECK ("scope_kind" IN ('execution', 'session'))
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
CREATE INDEX "idx_relay_presence_scope_expires" ON "relay_presence" ("tenant_id","scope_kind","scope_id","expires_at");
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CREATE TABLE "relay_topic_subscriptions" ("tenant_id" text DEFAULT 'tenant:system' NOT NULL, "topic_address_id" text NOT NULL, "subscriber_execution_id" text NOT NULL, "metadata_json" jsonb, "created_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "pk_relay_topic_subscriptions" PRIMARY KEY("tenant_id","topic_address_id","subscriber_execution_id"));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE INDEX "idx_relay_topic_subscriptions_subscriber" ON "relay_topic_subscriptions" ("tenant_id","subscriber_execution_id");
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CREATE TABLE relay_inbox_messages (tenant_id varchar(191) NOT NULL, execution_id varchar(191) NOT NULL, sequence integer NOT NULL, from_address_id varchar(191) NOT NULL, envelope_id varchar(191), content_json json NOT NULL, reply_wait_id varchar(191), correlation_key text, idempotency_key varchar(191), drain_id varchar(191), consumed_at DATETIME(3), metadata_json json, created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), PRIMARY KEY (tenant_id, execution_id, sequence), UNIQUE KEY uq_relay_inbox_messages_idempotency (tenant_id, execution_id, idempotency_key), KEY idx_relay_inbox_messages_unconsumed (tenant_id, execution_id, consumed_at, sequence), KEY idx_relay_inbox_messages_drain (tenant_id, execution_id, drain_id, sequence));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE TABLE relay_inbox_drains (tenant_id varchar(191) NOT NULL, execution_id varchar(191) NOT NULL, drain_id varchar(191) NOT NULL, message_sequences_json json NOT NULL, created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), PRIMARY KEY (tenant_id, execution_id, drain_id));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CREATE TABLE relay_execution_state (tenant_id varchar(191) NOT NULL, execution_id varchar(191) NOT NULL, state_key varchar(191) NOT NULL, value_json json NOT NULL, version integer NOT NULL, created_at DATETIME(3) NOT NULL, updated_at DATETIME(3) NOT NULL, PRIMARY KEY (tenant_id, execution_id, state_key));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE TABLE relay_execution_state_ops (tenant_id varchar(191) NOT NULL, execution_id varchar(191) NOT NULL, idempotency_key varchar(191) NOT NULL, state_key varchar(191) NOT NULL, version integer NOT NULL, op varchar(10) NOT NULL, result_present boolean NOT NULL, result_value_json json NULL, result_created_at DATETIME(3) NULL, result_updated_at DATETIME(3) NULL, created_at DATETIME(3) NOT NULL, PRIMARY KEY (tenant_id, execution_id, idempotency_key), INDEX idx_relay_execution_state_ops_version (tenant_id, execution_id, state_key, version));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE relay_entity_kinds (
|
|
2
|
+
tenant_id varchar(255) NOT NULL DEFAULT 'tenant:system', kind varchar(255) NOT NULL, agent_id varchar(255) NOT NULL,
|
|
3
|
+
inbox_policy_json json, state_enabled integer, continue_as_new_after_turns integer,
|
|
4
|
+
metadata_json json NOT NULL, created_at timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
5
|
+
updated_at timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), PRIMARY KEY (tenant_id, kind)
|
|
6
|
+
);
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
CREATE TABLE relay_entity_instances (
|
|
9
|
+
tenant_id varchar(255) NOT NULL DEFAULT 'tenant:system', kind varchar(255) NOT NULL, `key` varchar(255) NOT NULL,
|
|
10
|
+
address_id varchar(255) NOT NULL, execution_id varchar(255) NOT NULL, generation integer NOT NULL,
|
|
11
|
+
status varchar(32) NOT NULL, created_at timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), destroyed_at timestamp(3),
|
|
12
|
+
PRIMARY KEY (tenant_id, kind, `key`), INDEX idx_relay_entity_instances_kind_status (tenant_id, kind, status)
|
|
13
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
CREATE TABLE `relay_presence` (
|
|
2
|
+
`tenant_id` VARCHAR(191) NOT NULL DEFAULT 'system',
|
|
3
|
+
`id` VARCHAR(191) NOT NULL,
|
|
4
|
+
`scope_kind` VARCHAR(16) NOT NULL,
|
|
5
|
+
`scope_id` VARCHAR(191) NOT NULL,
|
|
6
|
+
`metadata_json` JSON NOT NULL,
|
|
7
|
+
`connected_at` DATETIME(3) NOT NULL,
|
|
8
|
+
`expires_at` DATETIME(3) NOT NULL,
|
|
9
|
+
CONSTRAINT `pk_relay_presence` PRIMARY KEY (`tenant_id`, `id`, `scope_kind`, `scope_id`),
|
|
10
|
+
CONSTRAINT `chk_relay_presence_scope_kind` CHECK (`scope_kind` IN ('execution', 'session')),
|
|
11
|
+
INDEX `idx_relay_presence_scope_expires` (`tenant_id`, `scope_kind`, `scope_id`, `expires_at`)
|
|
12
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE TABLE relay_topic_subscriptions (tenant_id varchar(191) NOT NULL, topic_address_id varchar(191) NOT NULL, subscriber_execution_id varchar(191) NOT NULL, metadata_json json, created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), PRIMARY KEY (tenant_id, topic_address_id, subscriber_execution_id), KEY idx_relay_topic_subscriptions_subscriber (tenant_id, subscriber_execution_id));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
CREATE TABLE "relay_inbox_messages" ("tenant_id" text DEFAULT 'tenant:system' NOT NULL, "execution_id" text NOT NULL, "sequence" integer NOT NULL, "from_address_id" text NOT NULL, "envelope_id" text, "content_json" jsonb NOT NULL, "reply_wait_id" text, "correlation_key" text, "idempotency_key" text, "drain_id" text, "consumed_at" timestamp with time zone, "metadata_json" jsonb, "created_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "pk_relay_inbox_messages" PRIMARY KEY("tenant_id","execution_id","sequence"));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE UNIQUE INDEX "uq_relay_inbox_messages_idempotency" ON "relay_inbox_messages" ("tenant_id","execution_id","idempotency_key");
|
|
4
|
+
--> statement-breakpoint
|
|
5
|
+
CREATE INDEX "idx_relay_inbox_messages_unconsumed" ON "relay_inbox_messages" ("tenant_id","execution_id","consumed_at","sequence");
|
|
6
|
+
--> statement-breakpoint
|
|
7
|
+
CREATE INDEX "idx_relay_inbox_messages_drain" ON "relay_inbox_messages" ("tenant_id","execution_id","drain_id","sequence");
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
CREATE TABLE "relay_inbox_drains" ("tenant_id" text DEFAULT 'tenant:system' NOT NULL, "execution_id" text NOT NULL, "drain_id" text NOT NULL, "message_sequences_json" jsonb DEFAULT '[]'::jsonb NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "pk_relay_inbox_drains" PRIMARY KEY("tenant_id","execution_id","drain_id"));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
CREATE TABLE "relay_execution_state" ("tenant_id" text NOT NULL, "execution_id" text NOT NULL, "state_key" text NOT NULL, "value_json" jsonb NOT NULL, "version" integer NOT NULL, "created_at" timestamptz NOT NULL, "updated_at" timestamptz NOT NULL, CONSTRAINT "pk_relay_execution_state" PRIMARY KEY("tenant_id","execution_id","state_key"));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE TABLE "relay_execution_state_ops" ("tenant_id" text NOT NULL, "execution_id" text NOT NULL, "idempotency_key" text NOT NULL, "state_key" text NOT NULL, "version" integer NOT NULL, "op" text NOT NULL CHECK ("op" IN ('put','delete')), "result_present" boolean NOT NULL, "result_value_json" jsonb, "result_created_at" timestamptz, "result_updated_at" timestamptz, "created_at" timestamptz NOT NULL, CONSTRAINT "pk_relay_execution_state_ops" PRIMARY KEY("tenant_id","execution_id","idempotency_key"));
|
|
4
|
+
--> statement-breakpoint
|
|
5
|
+
CREATE INDEX "idx_relay_execution_state_ops_version" ON "relay_execution_state_ops" ("tenant_id","execution_id","state_key","version");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
CREATE TABLE relay_entity_kinds (
|
|
2
|
+
tenant_id text NOT NULL DEFAULT 'tenant:system', kind text NOT NULL, agent_id text NOT NULL,
|
|
3
|
+
inbox_policy_json jsonb, state_enabled integer, continue_as_new_after_turns integer,
|
|
4
|
+
metadata_json jsonb NOT NULL DEFAULT '{}', created_at timestamptz NOT NULL DEFAULT now(),
|
|
5
|
+
updated_at timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (tenant_id, kind)
|
|
6
|
+
);
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
CREATE TABLE relay_entity_instances (
|
|
9
|
+
tenant_id text NOT NULL DEFAULT 'tenant:system', kind text NOT NULL, "key" text NOT NULL,
|
|
10
|
+
address_id text NOT NULL, execution_id text NOT NULL, generation integer NOT NULL,
|
|
11
|
+
status text NOT NULL, created_at timestamptz NOT NULL DEFAULT now(), destroyed_at timestamptz,
|
|
12
|
+
PRIMARY KEY (tenant_id, kind, "key")
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
CREATE INDEX idx_relay_entity_instances_kind_status ON relay_entity_instances (tenant_id, kind, status);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE UNLOGGED TABLE "relay_presence" (
|
|
2
|
+
"tenant_id" text DEFAULT 'system' NOT NULL,
|
|
3
|
+
"id" text NOT NULL,
|
|
4
|
+
"scope_kind" text NOT NULL,
|
|
5
|
+
"scope_id" text NOT NULL,
|
|
6
|
+
"metadata_json" jsonb DEFAULT '{}' NOT NULL,
|
|
7
|
+
"connected_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
8
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
9
|
+
CONSTRAINT "pk_relay_presence" PRIMARY KEY("tenant_id","id","scope_kind","scope_id"),
|
|
10
|
+
CONSTRAINT "chk_relay_presence_scope_kind" CHECK ("scope_kind" IN ('execution', 'session'))
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
CREATE INDEX "idx_relay_presence_scope_expires" ON "relay_presence" ("tenant_id","scope_kind","scope_id","expires_at");
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CREATE TABLE "relay_topic_subscriptions" ("tenant_id" text DEFAULT 'tenant:system' NOT NULL, "topic_address_id" text NOT NULL, "subscriber_execution_id" text NOT NULL, "metadata_json" jsonb, "created_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "pk_relay_topic_subscriptions" PRIMARY KEY("tenant_id","topic_address_id","subscriber_execution_id"));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE INDEX "idx_relay_topic_subscriptions_subscriber" ON "relay_topic_subscriptions" ("tenant_id","subscriber_execution_id");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
CREATE TABLE relay_inbox_messages (tenant_id text NOT NULL, execution_id text NOT NULL, sequence integer NOT NULL, from_address_id text NOT NULL, envelope_id text, content_json text NOT NULL, reply_wait_id text, correlation_key text, idempotency_key text, drain_id text, consumed_at text, metadata_json text, created_at text NOT NULL DEFAULT CURRENT_TIMESTAMP, CONSTRAINT pk_relay_inbox_messages PRIMARY KEY (tenant_id, execution_id, sequence));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE UNIQUE INDEX uq_relay_inbox_messages_idempotency ON relay_inbox_messages (tenant_id, execution_id, idempotency_key);
|
|
4
|
+
--> statement-breakpoint
|
|
5
|
+
CREATE INDEX idx_relay_inbox_messages_unconsumed ON relay_inbox_messages (tenant_id, execution_id, consumed_at, sequence);
|
|
6
|
+
--> statement-breakpoint
|
|
7
|
+
CREATE INDEX idx_relay_inbox_messages_drain ON relay_inbox_messages (tenant_id, execution_id, drain_id, sequence);
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
CREATE TABLE relay_inbox_drains (tenant_id text NOT NULL, execution_id text NOT NULL, drain_id text NOT NULL, message_sequences_json text NOT NULL, created_at text NOT NULL DEFAULT CURRENT_TIMESTAMP, CONSTRAINT pk_relay_inbox_drains PRIMARY KEY (tenant_id, execution_id, drain_id));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CREATE TABLE relay_execution_state (tenant_id text NOT NULL, execution_id text NOT NULL, state_key text NOT NULL, value_json text NOT NULL, version integer NOT NULL, created_at text NOT NULL, updated_at text NOT NULL, PRIMARY KEY (tenant_id, execution_id, state_key));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE TABLE relay_execution_state_ops (tenant_id text NOT NULL, execution_id text NOT NULL, idempotency_key text NOT NULL, state_key text NOT NULL, version integer NOT NULL, op text NOT NULL CHECK (op IN ('put','delete')), result_present integer NOT NULL, result_value_json text, result_created_at text, result_updated_at text, created_at text NOT NULL, PRIMARY KEY (tenant_id, execution_id, idempotency_key));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
CREATE TABLE relay_entity_kinds (
|
|
2
|
+
tenant_id text NOT NULL DEFAULT 'tenant:system', kind text NOT NULL, agent_id text NOT NULL,
|
|
3
|
+
inbox_policy_json text, state_enabled integer, continue_as_new_after_turns integer,
|
|
4
|
+
metadata_json text NOT NULL DEFAULT '{}', created_at text NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
5
|
+
updated_at text NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (tenant_id, kind)
|
|
6
|
+
);
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
CREATE TABLE relay_entity_instances (
|
|
9
|
+
tenant_id text NOT NULL DEFAULT 'tenant:system', kind text NOT NULL, "key" text NOT NULL,
|
|
10
|
+
address_id text NOT NULL, execution_id text NOT NULL, generation integer NOT NULL,
|
|
11
|
+
status text NOT NULL, created_at text NOT NULL DEFAULT CURRENT_TIMESTAMP, destroyed_at text,
|
|
12
|
+
PRIMARY KEY (tenant_id, kind, "key")
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
CREATE INDEX idx_relay_entity_instances_kind_status ON relay_entity_instances (tenant_id, kind, status);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
CREATE TABLE "relay_presence" (
|
|
2
|
+
"tenant_id" TEXT NOT NULL DEFAULT 'system',
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"scope_kind" TEXT NOT NULL CHECK ("scope_kind" IN ('execution', 'session')),
|
|
5
|
+
"scope_id" TEXT NOT NULL,
|
|
6
|
+
"metadata_json" TEXT NOT NULL DEFAULT '{}',
|
|
7
|
+
"connected_at" INTEGER NOT NULL,
|
|
8
|
+
"expires_at" INTEGER NOT NULL,
|
|
9
|
+
CONSTRAINT "pk_relay_presence" PRIMARY KEY ("tenant_id", "id", "scope_kind", "scope_id")
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE INDEX "idx_relay_presence_scope_expires" ON "relay_presence" ("tenant_id", "scope_kind", "scope_id", "expires_at");
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CREATE TABLE relay_topic_subscriptions (tenant_id text NOT NULL, topic_address_id text NOT NULL, subscriber_execution_id text NOT NULL, metadata_json text, created_at text NOT NULL DEFAULT CURRENT_TIMESTAMP, CONSTRAINT pk_relay_topic_subscriptions PRIMARY KEY (tenant_id, topic_address_id, subscriber_execution_id));
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE INDEX idx_relay_topic_subscriptions_subscriber ON relay_topic_subscriptions (tenant_id, subscriber_execution_id);
|