@relayfx/sdk 0.0.29 → 0.0.30

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.
Files changed (31) hide show
  1. package/dist/index.js +23 -5
  2. package/dist/migrations/20260701002839_sour_cerebro/migration.sql +160 -0
  3. package/dist/migrations/20260701002839_sour_cerebro/snapshot.json +1971 -0
  4. package/dist/migrations/20260701041134_acoustic_hulk/migration.sql +30 -0
  5. package/dist/migrations/20260701041134_acoustic_hulk/snapshot.json +2372 -0
  6. package/dist/migrations/20260701160543_condemned_stryfe/migration.sql +2 -0
  7. package/dist/migrations/20260701160543_condemned_stryfe/snapshot.json +2442 -0
  8. package/dist/migrations/20260701220315_heavy_gorgon/migration.sql +5 -0
  9. package/dist/migrations/20260701220315_heavy_gorgon/snapshot.json +2495 -0
  10. package/dist/migrations/20260701225444_polite_lord_hawal/migration.sql +24 -0
  11. package/dist/migrations/20260701225444_polite_lord_hawal/snapshot.json +2821 -0
  12. package/dist/migrations/20260702030128_flaky_misty_knight/migration.sql +1 -0
  13. package/dist/migrations/20260702030128_flaky_misty_knight/snapshot.json +2821 -0
  14. package/dist/migrations/20260705003847_nervous_banshee/migration.sql +11 -0
  15. package/dist/migrations/20260705003847_nervous_banshee/snapshot.json +2954 -0
  16. package/dist/migrations/20260705012626_common_stryfe/migration.sql +31 -0
  17. package/dist/migrations/20260705012626_common_stryfe/snapshot.json +3378 -0
  18. package/dist/migrations/20260705015420_sweet_captain_marvel/migration.sql +10 -0
  19. package/dist/migrations/20260705015420_sweet_captain_marvel/snapshot.json +3485 -0
  20. package/dist/migrations/20260705023041_chunky_scalphunter/migration.sql +22 -0
  21. package/dist/migrations/20260705023041_chunky_scalphunter/snapshot.json +3753 -0
  22. package/dist/migrations/20260705030344_short_patriot/migration.sql +11 -0
  23. package/dist/migrations/20260705030344_short_patriot/snapshot.json +3873 -0
  24. package/dist/migrations/20260705045546_heavy_ben_grimm/migration.sql +30 -0
  25. package/dist/migrations/20260705045546_heavy_ben_grimm/snapshot.json +4193 -0
  26. package/dist/migrations/20260706185931_regular_shadow_king/migration.sql +166 -0
  27. package/dist/migrations/20260706185931_regular_shadow_king/snapshot.json +4844 -0
  28. package/dist/migrations/20260706233300_equal_cyclops/migration.sql +3 -0
  29. package/dist/migrations/20260706233300_equal_cyclops/snapshot.json +4883 -0
  30. package/dist/types/runtime/runner/runner-runtime-service.d.ts +10 -9
  31. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14080,6 +14080,7 @@ import {
14080
14080
  SqlRunnerStorage
14081
14081
  } from "effect/unstable/cluster";
14082
14082
  import { FetchHttpClient } from "effect/unstable/http";
14083
+ import * as SqlClient43 from "effect/unstable/sql/SqlClient";
14083
14084
  import { RpcSerialization } from "effect/unstable/rpc";
14084
14085
  import { WorkflowEngine } from "effect/unstable/workflow";
14085
14086
  import * as Ai18 from "effect/unstable/ai";
@@ -14280,7 +14281,7 @@ var runOnce = Effect76.fn("SchedulerService.runOnce.call")(function* () {
14280
14281
  });
14281
14282
 
14282
14283
  // ../runtime/src/runner/runner-runtime-service.ts
14283
- var DatabaseMode = Schema70.Literals(["sql", "memory"]).annotate({
14284
+ var DatabaseMode = Schema70.Literals(["sql", "pg", "mysql", "sqlite", "memory"]).annotate({
14284
14285
  identifier: "Relay.RunnerRuntime.DatabaseMode"
14285
14286
  });
14286
14287
  var ReadinessStatus = Schema70.Struct({
@@ -14452,10 +14453,20 @@ var makeService = (database, checkDatabase) => Effect77.gen(function* () {
14452
14453
  });
14453
14454
  var checkLayer = (database, checkDatabase) => Layer69.effect(Service49, makeService(database, checkDatabase));
14454
14455
  var memoryCheckLayer = checkLayer("memory", Effect77.void);
14456
+ var detectDialect = Effect77.serviceOption(SqlClient43.SqlClient).pipe(Effect77.map(Option27.match({
14457
+ onNone: () => "sql",
14458
+ onSome: (client2) => client2.onDialectOrElse({
14459
+ pg: () => "pg",
14460
+ mysql: () => "mysql",
14461
+ sqlite: () => "sqlite",
14462
+ orElse: () => "sql"
14463
+ })
14464
+ })));
14455
14465
  var sqlCheckLayer = Layer69.effect(Service49, Effect77.gen(function* () {
14456
14466
  const database = yield* exports_database_service.Service;
14467
+ const dialect2 = yield* detectDialect;
14457
14468
  const checkDatabase = exports_database_service.check().pipe(Effect77.mapError((error) => new RunnerRuntimeError({ message: String(error) })), Effect77.provideService(exports_database_service.Service, database));
14458
- return yield* makeService("sql", checkDatabase);
14469
+ return yield* makeService(dialect2, checkDatabase);
14459
14470
  }));
14460
14471
  var makeClientService = (database, checkDatabase) => Effect77.gen(function* () {
14461
14472
  const sharding = yield* Sharding.Sharding;
@@ -14477,10 +14488,17 @@ var makeClientService = (database, checkDatabase) => Effect77.gen(function* () {
14477
14488
  });
14478
14489
  });
14479
14490
  var memoryClientCheckLayer = Layer69.effect(Service49, makeClientService("memory", Effect77.void));
14491
+ var multiNodeDialectGuard = Layer69.effectDiscard(Effect77.gen(function* () {
14492
+ const dialect2 = yield* detectDialect;
14493
+ if (dialect2 === "sqlite") {
14494
+ return yield* Effect77.die(new Error("SQLite supports single-process topologies only; multi-node cluster composition requires Postgres or MySQL"));
14495
+ }
14496
+ }));
14480
14497
  var sqlClientCheckLayer = Layer69.effect(Service49, Effect77.gen(function* () {
14481
14498
  const database = yield* exports_database_service.Service;
14499
+ const dialect2 = yield* detectDialect;
14482
14500
  const checkDatabase = exports_database_service.check().pipe(Effect77.mapError((error) => new RunnerRuntimeError({ message: String(error) })), Effect77.provideService(exports_database_service.Service, database));
14483
- return yield* makeClientService("sql", checkDatabase);
14501
+ return yield* makeClientService(dialect2, checkDatabase);
14484
14502
  }));
14485
14503
  var deterministicTestModelLayer = Layer69.effect(Ai18.LanguageModel.LanguageModel, Ai18.LanguageModel.make({
14486
14504
  generateText: () => Effect77.succeed([{ type: "text", text: "deterministic test response" }]),
@@ -14529,7 +14547,7 @@ var layerWithServices = (options) => layerWith({
14529
14547
  schemaRegistryLayer: options.schemaRegistryLayer
14530
14548
  });
14531
14549
  var layerWithServicesMultiNode = (options) => layerWith({
14532
- checkLayer: sqlCheckLayer,
14550
+ checkLayer: Layer69.mergeAll(sqlCheckLayer, multiNodeDialectGuard),
14533
14551
  clusterLayer: clusterLayerHttp(options.cluster),
14534
14552
  repositoryLayer: sqlRepositoryLayer.pipe(Layer69.provideMerge(options.databaseLayer)),
14535
14553
  languageModelLayer: options.languageModelLayer,
@@ -14542,7 +14560,7 @@ var layerWithServicesMultiNode = (options) => layerWith({
14542
14560
  schemaRegistryLayer: options.schemaRegistryLayer
14543
14561
  });
14544
14562
  var layerWithServicesMultiNodeClientOnly = (options) => layerWithClient({
14545
- checkLayer: sqlClientCheckLayer,
14563
+ checkLayer: Layer69.mergeAll(sqlClientCheckLayer, multiNodeDialectGuard),
14546
14564
  clusterLayer: clusterLayerHttpClientOnly(options.cluster ?? {}),
14547
14565
  repositoryLayer: sqlRepositoryLayer.pipe(Layer69.provideMerge(options.databaseLayer)),
14548
14566
  languageModelLayer: options.languageModelLayer,
@@ -0,0 +1,160 @@
1
+ CREATE TABLE "relay_address_book_entries" (
2
+ "id" text PRIMARY KEY,
3
+ "address_id" text NOT NULL,
4
+ "route_kind" text NOT NULL,
5
+ "route_key" text NOT NULL,
6
+ "metadata_json" jsonb DEFAULT '{}' NOT NULL,
7
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
8
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
9
+ );
10
+ --> statement-breakpoint
11
+ CREATE TABLE "relay_agent_definition_revisions" (
12
+ "agent_definition_id" text,
13
+ "revision" integer,
14
+ "name" text NOT NULL,
15
+ "definition_json" jsonb NOT NULL,
16
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
17
+ CONSTRAINT "pk_relay_agent_definition_revisions" PRIMARY KEY("agent_definition_id","revision")
18
+ );
19
+ --> statement-breakpoint
20
+ CREATE TABLE "relay_agent_definitions" (
21
+ "id" text PRIMARY KEY,
22
+ "name" text NOT NULL,
23
+ "current_revision" integer NOT NULL,
24
+ "definition_json" jsonb NOT NULL,
25
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
26
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
27
+ );
28
+ --> statement-breakpoint
29
+ CREATE TABLE "relay_child_executions" (
30
+ "id" text PRIMARY KEY,
31
+ "execution_id" text NOT NULL,
32
+ "address_id" text NOT NULL,
33
+ "status" text NOT NULL,
34
+ "metadata_json" jsonb DEFAULT '{}' NOT NULL,
35
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
36
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
37
+ );
38
+ --> statement-breakpoint
39
+ CREATE TABLE "relay_envelope_ready" (
40
+ "id" text PRIMARY KEY,
41
+ "envelope_id" text NOT NULL,
42
+ "route_type" text NOT NULL,
43
+ "route_key" text NOT NULL,
44
+ "state" text DEFAULT 'ready' NOT NULL,
45
+ "available_at" timestamp with time zone DEFAULT now() NOT NULL,
46
+ "attempt" integer DEFAULT 0 NOT NULL,
47
+ "claim_owner" text,
48
+ "claim_expires_at" timestamp with time zone,
49
+ "last_error" text,
50
+ "idempotency_key" text,
51
+ "metadata_json" jsonb DEFAULT '{}' NOT NULL,
52
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
53
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
54
+ "claimed_at" timestamp with time zone,
55
+ "acknowledged_at" timestamp with time zone
56
+ );
57
+ --> statement-breakpoint
58
+ CREATE TABLE "relay_envelopes" (
59
+ "id" text PRIMARY KEY,
60
+ "execution_id" text NOT NULL,
61
+ "from_address_id" text NOT NULL,
62
+ "to_address_id" text NOT NULL,
63
+ "content_json" jsonb NOT NULL,
64
+ "wait_json" jsonb,
65
+ "correlation_key" text,
66
+ "metadata_json" jsonb DEFAULT '{}' NOT NULL,
67
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
68
+ );
69
+ --> statement-breakpoint
70
+ CREATE TABLE "relay_execution_events" (
71
+ "id" text PRIMARY KEY,
72
+ "execution_id" text NOT NULL,
73
+ "child_execution_id" text,
74
+ "type" text NOT NULL,
75
+ "sequence" integer NOT NULL,
76
+ "cursor" text NOT NULL,
77
+ "content_json" jsonb,
78
+ "data_json" jsonb DEFAULT '{}' NOT NULL,
79
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
80
+ );
81
+ --> statement-breakpoint
82
+ CREATE TABLE "relay_executions" (
83
+ "id" text PRIMARY KEY,
84
+ "root_address_id" text NOT NULL,
85
+ "status" text NOT NULL,
86
+ "agent_definition_id" text,
87
+ "agent_definition_revision" integer,
88
+ "agent_definition_snapshot_json" jsonb,
89
+ "metadata_json" jsonb DEFAULT '{}' NOT NULL,
90
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
91
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
92
+ );
93
+ --> statement-breakpoint
94
+ CREATE TABLE "relay_idempotency_keys" (
95
+ "id" text PRIMARY KEY,
96
+ "scope" text NOT NULL,
97
+ "operation" text NOT NULL,
98
+ "key" text NOT NULL,
99
+ "result_json" jsonb,
100
+ "metadata_json" jsonb DEFAULT '{}' NOT NULL,
101
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
102
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
103
+ "expires_at" timestamp with time zone
104
+ );
105
+ --> statement-breakpoint
106
+ CREATE TABLE "relay_route_attempts" (
107
+ "id" text PRIMARY KEY,
108
+ "envelope_ready_id" text NOT NULL,
109
+ "route_key" text NOT NULL,
110
+ "state" text NOT NULL,
111
+ "detail" text,
112
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
113
+ );
114
+ --> statement-breakpoint
115
+ CREATE TABLE "relay_tool_calls" (
116
+ "id" text PRIMARY KEY,
117
+ "execution_id" text NOT NULL,
118
+ "name" text NOT NULL,
119
+ "input_json" jsonb NOT NULL,
120
+ "metadata_json" jsonb DEFAULT '{}' NOT NULL,
121
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
122
+ );
123
+ --> statement-breakpoint
124
+ CREATE TABLE "relay_tool_results" (
125
+ "tool_call_id" text PRIMARY KEY,
126
+ "output_json" jsonb NOT NULL,
127
+ "error" text,
128
+ "metadata_json" jsonb DEFAULT '{}' NOT NULL,
129
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
130
+ );
131
+ --> statement-breakpoint
132
+ CREATE TABLE "relay_waits" (
133
+ "id" text PRIMARY KEY,
134
+ "execution_id" text NOT NULL,
135
+ "envelope_id" text NOT NULL,
136
+ "mode" text NOT NULL,
137
+ "correlation_key" text,
138
+ "state" text DEFAULT 'open' NOT NULL,
139
+ "metadata_json" jsonb DEFAULT '{}' NOT NULL,
140
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
141
+ "resolved_at" timestamp with time zone
142
+ );
143
+ --> statement-breakpoint
144
+ CREATE UNIQUE INDEX "uq_relay_address_book_address" ON "relay_address_book_entries" ("address_id");--> statement-breakpoint
145
+ CREATE INDEX "idx_relay_agent_definition_revisions_definition" ON "relay_agent_definition_revisions" ("agent_definition_id","revision");--> statement-breakpoint
146
+ CREATE INDEX "idx_relay_agent_definitions_name" ON "relay_agent_definitions" ("name");--> statement-breakpoint
147
+ CREATE INDEX "idx_relay_child_executions_parent" ON "relay_child_executions" ("execution_id");--> statement-breakpoint
148
+ CREATE INDEX "idx_relay_envelope_ready_state_available" ON "relay_envelope_ready" ("state","available_at");--> statement-breakpoint
149
+ CREATE INDEX "idx_relay_envelope_ready_claim_expires" ON "relay_envelope_ready" ("claim_expires_at");--> statement-breakpoint
150
+ CREATE UNIQUE INDEX "uq_relay_envelope_ready_idempotency" ON "relay_envelope_ready" ("idempotency_key");--> statement-breakpoint
151
+ CREATE INDEX "idx_relay_envelopes_execution" ON "relay_envelopes" ("execution_id","created_at");--> statement-breakpoint
152
+ CREATE INDEX "idx_relay_envelopes_to_address" ON "relay_envelopes" ("to_address_id","created_at");--> statement-breakpoint
153
+ CREATE INDEX "idx_relay_execution_events_execution" ON "relay_execution_events" ("execution_id","created_at");--> statement-breakpoint
154
+ CREATE UNIQUE INDEX "uq_relay_execution_events_sequence" ON "relay_execution_events" ("execution_id","sequence");--> statement-breakpoint
155
+ CREATE UNIQUE INDEX "uq_relay_execution_events_cursor" ON "relay_execution_events" ("cursor");--> statement-breakpoint
156
+ CREATE INDEX "idx_relay_executions_root_status" ON "relay_executions" ("root_address_id","status");--> statement-breakpoint
157
+ CREATE UNIQUE INDEX "uq_relay_idempotency_scope_operation_key" ON "relay_idempotency_keys" ("scope","operation","key");--> statement-breakpoint
158
+ CREATE INDEX "idx_relay_route_attempts_ready" ON "relay_route_attempts" ("envelope_ready_id","created_at");--> statement-breakpoint
159
+ CREATE INDEX "idx_relay_tool_calls_execution" ON "relay_tool_calls" ("execution_id","created_at");--> statement-breakpoint
160
+ CREATE INDEX "idx_relay_waits_execution_state" ON "relay_waits" ("execution_id","state");