@relayfx/sdk 0.2.15 → 0.3.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.
Files changed (109) hide show
  1. package/dist/ai.js +2 -2
  2. package/dist/{index-z9xk02sv.js → index-c2skef55.js} +1898 -1556
  3. package/dist/{index-d8q4kfjy.js → index-d3dme13d.js} +12 -8
  4. package/dist/{index-xbbfagnb.js → index-pn652eef.js} +166 -105
  5. package/dist/{index-gxskhyra.js → index-vwbatywf.js} +8 -8
  6. package/dist/index.js +5 -5
  7. package/dist/mysql.js +24 -9
  8. package/dist/postgres.js +18 -13
  9. package/dist/sqlite.js +26 -29
  10. package/dist/types/ai/embedding-model/embedding-model-registration.d.ts +2 -2
  11. package/dist/types/relay/adapter-outbox.d.ts +1 -1
  12. package/dist/types/relay/client.d.ts +32 -30
  13. package/dist/types/relay/command.d.ts +10 -4
  14. package/dist/types/relay/database.d.ts +4 -4
  15. package/dist/types/relay/migration-errors.d.ts +8 -2
  16. package/dist/types/relay/mysql.d.ts +2 -2
  17. package/dist/types/relay/operation.d.ts +211 -126
  18. package/dist/types/relay/postgres.d.ts +2 -2
  19. package/dist/types/relay/runtime-capability-policy.d.ts +11 -5
  20. package/dist/types/relay/runtime-database.d.ts +1 -1
  21. package/dist/types/relay/runtime.d.ts +4 -4
  22. package/dist/types/relay/sqlite-migrations.d.ts +1 -1
  23. package/dist/types/relay/sqlite-runtime.d.ts +10 -5
  24. package/dist/types/relay/tool-worker.d.ts +6 -5
  25. package/dist/types/runtime/address/address-book-service.d.ts +3 -3
  26. package/dist/types/runtime/address/address-resolution-service.d.ts +41 -41
  27. package/dist/types/runtime/agent/agent-loop-service.d.ts +14 -5
  28. package/dist/types/runtime/agent/agent-registry-service.d.ts +2 -2
  29. package/dist/types/runtime/agent/prompt-assembler-service.d.ts +1 -1
  30. package/dist/types/runtime/agent/relay-tool-output.d.ts +4 -1
  31. package/dist/types/runtime/child/child-fan-out-admission-service.d.ts +1 -1
  32. package/dist/types/runtime/child/child-fan-out-runtime.d.ts +12 -8
  33. package/dist/types/runtime/child/child-fan-out-transition-service.d.ts +1 -1
  34. package/dist/types/runtime/child/child-run-service.d.ts +7 -4
  35. package/dist/types/runtime/child/parent-notifier-service.d.ts +4 -2
  36. package/dist/types/runtime/child/spawn-child-run-tool.d.ts +5 -4
  37. package/dist/types/runtime/cluster/execution-entity.d.ts +2 -2
  38. package/dist/types/runtime/content/artifact-store-service.d.ts +2 -2
  39. package/dist/types/runtime/content/blob-store-service.d.ts +1 -1
  40. package/dist/types/runtime/entity/entity-instance-service.d.ts +14 -5
  41. package/dist/types/runtime/entity/entity-registry-service.d.ts +2 -2
  42. package/dist/types/runtime/envelope/envelope-service.d.ts +2 -2
  43. package/dist/types/runtime/execution/active-execution-registry.d.ts +1 -1
  44. package/dist/types/runtime/execution/event-log-service.d.ts +28 -3
  45. package/dist/types/runtime/execution/execution-service.d.ts +1 -1
  46. package/dist/types/runtime/execution/execution-watch-service.d.ts +1 -1
  47. package/dist/types/runtime/execution/session-stream-service.d.ts +1 -1
  48. package/dist/types/runtime/inbox/inbox-service.d.ts +1 -1
  49. package/dist/types/runtime/memory/memory-service.d.ts +1 -1
  50. package/dist/types/runtime/model/embedding-model-service.d.ts +23 -10
  51. package/dist/types/runtime/model/language-model-service.d.ts +19 -6
  52. package/dist/types/runtime/model/model-call-policy.d.ts +1 -1
  53. package/dist/types/runtime/observability/runtime-metrics.d.ts +12 -3
  54. package/dist/types/runtime/presence/presence-service.d.ts +1 -1
  55. package/dist/types/runtime/presence/presence-tool.d.ts +1 -1
  56. package/dist/types/runtime/runner/runner-runtime-service.d.ts +19 -19
  57. package/dist/types/runtime/schedule/scheduler-service.d.ts +3 -3
  58. package/dist/types/runtime/schema-registry/schema-registry-service.d.ts +2 -2
  59. package/dist/types/runtime/session/session-store-service.d.ts +13 -4
  60. package/dist/types/runtime/skill/skill-registry-service.d.ts +2 -2
  61. package/dist/types/runtime/state/execution-state-service.d.ts +5 -2
  62. package/dist/types/runtime/tool/tool-runtime-service.d.ts +42 -19
  63. package/dist/types/runtime/tool/tool-transition-coordinator.d.ts +2 -2
  64. package/dist/types/runtime/topic/topic-service.d.ts +1 -1
  65. package/dist/types/runtime/wait/wait-service.d.ts +1 -1
  66. package/dist/types/runtime/wait/wait-signal.d.ts +12 -3
  67. package/dist/types/runtime/workflow/activity-version-registry.d.ts +7 -3
  68. package/dist/types/runtime/workflow/definition-runtime.d.ts +37 -22
  69. package/dist/types/runtime/workflow/execution-workflow.d.ts +105 -110
  70. package/dist/types/runtime/workspace/workspace-planner-service.d.ts +6 -6
  71. package/dist/types/runtime/workspace/workspace-provider-service.d.ts +11 -7
  72. package/dist/types/runtime/workspace/workspace-runtime-service.d.ts +1 -1
  73. package/dist/types/schema/agent-schema.d.ts +246 -246
  74. package/dist/types/schema/child-orchestration-schema.d.ts +64 -64
  75. package/dist/types/schema/execution-schema.d.ts +57 -57
  76. package/dist/types/schema/workflow-schema.d.ts +243 -243
  77. package/dist/types/schema/workspace-schema.d.ts +1 -1
  78. package/dist/types/store-sql/address/address-book-repository.d.ts +5 -5
  79. package/dist/types/store-sql/agent/agent-definition-repository.d.ts +7 -7
  80. package/dist/types/store-sql/chat/agent-chat-repository.d.ts +2 -2
  81. package/dist/types/store-sql/child/child-execution-repository.d.ts +4 -4
  82. package/dist/types/store-sql/child/child-fan-out-repository.d.ts +2 -2
  83. package/dist/types/store-sql/cluster/cluster-registry-repository.d.ts +5 -5
  84. package/dist/types/store-sql/compaction/compaction-repository.d.ts +3 -3
  85. package/dist/types/store-sql/database/database-service.d.ts +3 -3
  86. package/dist/types/store-sql/database/notification-bus.d.ts +1 -1
  87. package/dist/types/store-sql/database/sql-dialect.d.ts +4 -1
  88. package/dist/types/store-sql/entity/entity-repository.d.ts +2 -2
  89. package/dist/types/store-sql/envelope/envelope-repository.d.ts +13 -13
  90. package/dist/types/store-sql/execution/execution-event-repository.d.ts +27 -5
  91. package/dist/types/store-sql/execution/execution-repository.d.ts +8 -8
  92. package/dist/types/store-sql/idempotency/idempotency-repository.d.ts +5 -5
  93. package/dist/types/store-sql/inbox/inbox-repository.d.ts +1 -1
  94. package/dist/types/store-sql/memory/memory-repository.d.ts +3 -3
  95. package/dist/types/store-sql/permission/permission-rule-repository.d.ts +2 -2
  96. package/dist/types/store-sql/presence/presence-repository.d.ts +2 -2
  97. package/dist/types/store-sql/schedule/schedule-repository.d.ts +9 -9
  98. package/dist/types/store-sql/schema/relay-schema.d.ts +257 -257
  99. package/dist/types/store-sql/session/context-epoch-repository.d.ts +2 -2
  100. package/dist/types/store-sql/session/session-repository.d.ts +5 -5
  101. package/dist/types/store-sql/skill/skill-definition-repository.d.ts +9 -9
  102. package/dist/types/store-sql/state/execution-state-repository.d.ts +2 -2
  103. package/dist/types/store-sql/steering/steering-repository.d.ts +5 -5
  104. package/dist/types/store-sql/tenant/tenant-id.d.ts +2 -2
  105. package/dist/types/store-sql/tool/tool-call-repository.d.ts +19 -16
  106. package/dist/types/store-sql/topic/topic-repository.d.ts +1 -1
  107. package/dist/types/store-sql/workflow/workflow-definition-repository.d.ts +16 -14
  108. package/dist/types/store-sql/workspace/workspace-lease-repository.d.ts +11 -11
  109. package/package.json +3 -3
@@ -7,29 +7,29 @@ import {
7
7
  RuntimeMigrationError,
8
8
  SqlFailure,
9
9
  exports_runtime_database
10
- } from "./index-xbbfagnb.js";
10
+ } from "./index-pn652eef.js";
11
11
 
12
12
  // src/migration-errors.ts
13
- import { Cause, Effect } from "effect";
13
+ import { Cause, Effect, Function } from "effect";
14
14
  var retain = (value, cause) => {
15
15
  Object.defineProperty(value, "originalCause", { value: cause, enumerable: false });
16
16
  return value;
17
17
  };
18
- var migrationFailure = (dialect, phase, cause) => retain(new RuntimeMigrationError({
18
+ var migrationFailure = Function.dual(3, (dialect, phase, cause) => retain(RuntimeMigrationError.make({
19
19
  dialect,
20
20
  phase,
21
21
  nextAction: phase === "apply" ? "retry" : "inspect-schema",
22
- cause: retain(phase === "apply" ? new MigratorError({ reason: `packaged ${dialect} migration failed` }) : new SqlFailure({ category: "statement", operation: "verify", retryable: false }), cause)
23
- }), cause);
24
- var normalizeMigrationCause = (effect, dialect, phase) => effect.pipe(Effect.catchCause((cause) => Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.fail(migrationFailure(dialect, phase, cause))));
22
+ cause: retain(phase === "apply" ? MigratorError.make({ reason: `packaged ${dialect} migration failed` }) : SqlFailure.make({ category: "statement", operation: "verify", retryable: false }), cause)
23
+ }), cause));
24
+ var normalizeMigrationCause = Function.dual(3, (effect, dialect, phase) => effect.pipe(Effect.catchCause((cause) => Cause.hasInterrupts(cause) ? Effect.interrupt : Effect.fail(migrationFailure(dialect, phase, cause)))));
25
25
 
26
26
  // src/runtime-database-adapter.ts
27
27
  import { Cause as Cause2, Effect as Effect2, Layer } from "effect";
28
28
  import { SqlClient } from "effect/unstable/sql/SqlClient";
29
29
  var configurationFailure = (cause) => {
30
- const configFailure = new ConfigFailure({ reason: "database client layer acquisition failed" });
30
+ const configFailure = ConfigFailure.make({ reason: "database client layer acquisition failed" });
31
31
  Object.defineProperty(configFailure, "originalCause", { value: cause, enumerable: false });
32
- return new RuntimeConfigurationError({
32
+ return RuntimeConfigurationError.make({
33
33
  setting: "databaseLayer",
34
34
  nextAction: "provide-setting",
35
35
  cause: configFailure
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  exports_language_model_registration
4
- } from "./index-d8q4kfjy.js";
4
+ } from "./index-d3dme13d.js";
5
5
  import {
6
6
  Service,
7
7
  exports_client,
@@ -9,7 +9,7 @@ import {
9
9
  exports_operation,
10
10
  exports_runtime,
11
11
  makeDatabaseIdentity
12
- } from "./index-xbbfagnb.js";
12
+ } from "./index-pn652eef.js";
13
13
  import {
14
14
  Dialect,
15
15
  __export,
@@ -62,7 +62,7 @@ import {
62
62
  fromDbTimestamp,
63
63
  fromNullableDbTimestamp,
64
64
  timestampParam
65
- } from "./index-z9xk02sv.js";
65
+ } from "./index-c2skef55.js";
66
66
 
67
67
  // src/adapter-outbox.ts
68
68
  var exports_adapter_outbox = {};
@@ -76,7 +76,7 @@ __export(exports_adapter_outbox, {
76
76
  Service: () => Service2
77
77
  });
78
78
  import { Context, Effect, Layer } from "effect";
79
- class Service2 extends Context.Service()("@relayfx/sdk/AdapterOutbox") {
79
+ class Service2 extends Context.Service()("@relayfx/sdk/adapter-outbox/Service") {
80
80
  }
81
81
  var layer = Layer.effect(Service2, Effect.gen(function* () {
82
82
  const client = yield* Service;
@@ -151,7 +151,7 @@ import { sql } from "drizzle-orm";
151
151
  import { Config, Context as Context2, Effect as Effect2, Layer as Layer2, Redacted } from "effect";
152
152
  import { types } from "pg";
153
153
 
154
- class Service3 extends Context2.Service()("@relayfx/store-sql/Database") {
154
+ class Service3 extends Context2.Service()("@relayfx/store-sql/database/database-service/Service") {
155
155
  }
156
156
  var pgTypeParsers = {
157
157
  getTypeParser: (typeId, format) => {
package/dist/mysql.js CHANGED
@@ -3,12 +3,16 @@ import {
3
3
  normalizeClientLayer,
4
4
  normalizeMigrationCause,
5
5
  runtimeDatabaseLayer
6
- } from "./index-gxskhyra.js";
7
- import"./index-xbbfagnb.js";
8
- import"./index-z9xk02sv.js";
6
+ } from "./index-vwbatywf.js";
7
+ import {
8
+ MigratorError,
9
+ RuntimeMigrationError,
10
+ SqlFailure
11
+ } from "./index-pn652eef.js";
12
+ import"./index-c2skef55.js";
9
13
 
10
14
  // src/mysql.ts
11
- import { Effect } from "effect";
15
+ import { Effect, Layer } from "effect";
12
16
  import { SqlClient } from "effect/unstable/sql/SqlClient";
13
17
 
14
18
  // ../../migrations/mysql/0001_baseline.sql
@@ -94,8 +98,14 @@ var verifySchema = Effect.gen(function* () {
94
98
  const rows = yield* sql`SELECT migration_id, name FROM relay_migrations ORDER BY migration_id`;
95
99
  const actual = rows.map((row) => `${row.migration_id}:${row.name}`).join(",");
96
100
  const expected = migrations.map(([id, name]) => `${id}:${name}`).join(",");
97
- if (actual !== expected)
98
- return yield* Effect.fail(new Error(`expected ${expected}; actual ${actual}`));
101
+ if (actual !== expected) {
102
+ return yield* RuntimeMigrationError.make({
103
+ dialect: "mysql",
104
+ phase: "verify",
105
+ nextAction: "inspect-schema",
106
+ cause: SqlFailure.make({ category: "statement", operation: "verify", retryable: false })
107
+ });
108
+ }
99
109
  }).pipe((effect) => normalizeMigrationCause(effect, "mysql", "verify"));
100
110
  var runMigrations = Effect.gen(function* () {
101
111
  const sql = yield* SqlClient;
@@ -103,8 +113,13 @@ var runMigrations = Effect.gen(function* () {
103
113
  const rows = yield* sql`SELECT migration_id, name FROM relay_migrations ORDER BY migration_id`;
104
114
  const current = rows.map((row) => [Number(row.migration_id), row.name]);
105
115
  const expectedPrefix = migrations.slice(0, current.length).map(([id, name]) => [id, name]);
106
- if (JSON.stringify(current) !== JSON.stringify(expectedPrefix)) {
107
- return yield* Effect.fail(new Error(`migration history is not a packaged manifest prefix`));
116
+ if (current.length !== expectedPrefix.length || current.some(([id, name], index) => expectedPrefix[index]?.[0] !== id || expectedPrefix[index]?.[1] !== name)) {
117
+ return yield* RuntimeMigrationError.make({
118
+ dialect: "mysql",
119
+ phase: "apply",
120
+ nextAction: "inspect-schema",
121
+ cause: MigratorError.make({ reason: "migration history is not a packaged manifest prefix" })
122
+ });
108
123
  }
109
124
  for (const [id, name, source] of migrations.slice(current.length)) {
110
125
  for (const statement of source.split("--> statement-breakpoint").map((value) => value.trim()).filter(Boolean)) {
@@ -113,7 +128,7 @@ var runMigrations = Effect.gen(function* () {
113
128
  yield* sql`INSERT INTO relay_migrations (migration_id, name) VALUES (${id}, ${name})`;
114
129
  }
115
130
  });
116
- var migrate = (options) => normalizeMigrationCause(runMigrations, "mysql", "apply").pipe(Effect.andThen(normalizeMigrationCause(verifySchema, "mysql", "verify")), Effect.provide(normalizeClientLayer(options.clientLayer)), Effect.asVoid);
131
+ var migrate = (options) => Effect.scoped(Layer.build(normalizeClientLayer(options.clientLayer)).pipe(Effect.flatMap((context) => Effect.provide(normalizeMigrationCause(runMigrations, "mysql", "apply").pipe(Effect.andThen(normalizeMigrationCause(verifySchema, "mysql", "verify"))), context)))).pipe(Effect.asVoid);
117
132
  var MySQL = { runtimeDatabaseLayer: runtimeDatabaseLayer2, migrate };
118
133
  export {
119
134
  runtimeDatabaseLayer2 as runtimeDatabaseLayer,
package/dist/postgres.js CHANGED
@@ -3,17 +3,19 @@ import {
3
3
  normalizeClientLayer,
4
4
  normalizeMigrationCause,
5
5
  runtimeDatabaseLayer
6
- } from "./index-gxskhyra.js";
7
- import"./index-xbbfagnb.js";
8
- import"./index-z9xk02sv.js";
6
+ } from "./index-vwbatywf.js";
7
+ import {
8
+ RuntimeMigrationError,
9
+ SqlFailure
10
+ } from "./index-pn652eef.js";
11
+ import"./index-c2skef55.js";
9
12
 
10
13
  // src/postgres.ts
11
14
  import { PgClient } from "@effect/sql-pg/PgClient";
12
15
  import { makeWithDefaults } from "drizzle-orm/effect-postgres";
13
16
  import { migrate as runDrizzleMigrator } from "drizzle-orm/effect-postgres/migrator";
14
- import { Effect } from "effect";
17
+ import { Effect, Layer } from "effect";
15
18
  import { SqlClient } from "effect/unstable/sql/SqlClient";
16
- import { existsSync } from "fs";
17
19
  import { fileURLToPath } from "url";
18
20
  var schemaHead = "20260712200000_workflow_runtime";
19
21
  var migrationNames = [
@@ -43,17 +45,20 @@ var migrationNames = [
43
45
  "20260712190000_workflow_definitions",
44
46
  schemaHead
45
47
  ];
46
- var migrationsFolder = () => {
47
- const packaged = fileURLToPath(new URL("./migrations/pg", import.meta.url));
48
- return existsSync(packaged) ? packaged : fileURLToPath(new URL("../../../migrations/pg", import.meta.url));
49
- };
48
+ var migrationsFolderUrl = import.meta.url.endsWith("/src/postgres.ts") ? new URL("../../../migrations/pg", import.meta.url) : new URL("./migrations/pg", import.meta.url);
49
+ var migrationsFolder = fileURLToPath(migrationsFolderUrl);
50
50
  var verifySchema = Effect.gen(function* () {
51
51
  const sql = yield* SqlClient;
52
52
  const rows = yield* sql`SELECT name FROM drizzle.__drizzle_migrations ORDER BY id`;
53
53
  const actual = rows.map((row) => row.name).join(",");
54
54
  const expected = migrationNames.join(",");
55
55
  if (actual !== expected) {
56
- return yield* Effect.fail(new Error(`expected ${expected}; actual ${actual}`));
56
+ return yield* RuntimeMigrationError.make({
57
+ dialect: "pg",
58
+ phase: "verify",
59
+ nextAction: "inspect-schema",
60
+ cause: SqlFailure.make({ category: "statement", operation: "verify", retryable: false })
61
+ });
57
62
  }
58
63
  }).pipe((effect) => normalizeMigrationCause(effect, "pg", "verify"));
59
64
  var runtimeDatabaseLayer2 = (options) => runtimeDatabaseLayer({
@@ -63,12 +68,12 @@ var runtimeDatabaseLayer2 = (options) => runtimeDatabaseLayer({
63
68
  schemaHead,
64
69
  schema: verifySchema
65
70
  });
66
- var migrate = (options) => normalizeMigrationCause(Effect.gen(function* () {
71
+ var migrate = (options) => Effect.scoped(Layer.build(normalizeClientLayer(options.clientLayer)).pipe(Effect.flatMap((context) => Effect.provide(normalizeMigrationCause(Effect.gen(function* () {
67
72
  const sql = yield* SqlClient;
68
73
  const pg = sql;
69
74
  const database = yield* makeWithDefaults().pipe(Effect.provideService(PgClient, pg));
70
- yield* runDrizzleMigrator(database, { migrationsFolder: migrationsFolder() });
71
- }), "pg", "apply").pipe(Effect.andThen(normalizeMigrationCause(verifySchema, "pg", "verify")), Effect.provide(normalizeClientLayer(options.clientLayer)), Effect.asVoid);
75
+ yield* runDrizzleMigrator(database, { migrationsFolder });
76
+ }), "pg", "apply").pipe(Effect.andThen(normalizeMigrationCause(verifySchema, "pg", "verify"))), context)))).pipe(Effect.asVoid);
72
77
  var Postgres = { runtimeDatabaseLayer: runtimeDatabaseLayer2, migrate };
73
78
  export {
74
79
  runtimeDatabaseLayer2 as runtimeDatabaseLayer,
package/dist/sqlite.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  normalizeMigrationCause,
4
4
  runtimeDatabaseLayer
5
- } from "./index-gxskhyra.js";
5
+ } from "./index-vwbatywf.js";
6
6
  import {
7
7
  DatabaseAlreadyOwned,
8
8
  DatabaseDialect,
@@ -14,7 +14,7 @@ import {
14
14
  exports_operation,
15
15
  exports_runtime,
16
16
  makeDatabaseIdentity
17
- } from "./index-xbbfagnb.js";
17
+ } from "./index-pn652eef.js";
18
18
  import {
19
19
  __export,
20
20
  exports_activity_version_registry,
@@ -59,7 +59,7 @@ import {
59
59
  exports_wait_service,
60
60
  exports_workflow_definition_repository,
61
61
  exports_workflow_schema
62
- } from "./index-z9xk02sv.js";
62
+ } from "./index-c2skef55.js";
63
63
  // src/sqlite-runtime.ts
64
64
  var exports_sqlite_runtime = {};
65
65
  __export(exports_sqlite_runtime, {
@@ -72,10 +72,9 @@ __export(exports_sqlite_runtime, {
72
72
  });
73
73
  import { layer as sqliteClientLayer } from "@effect/sql-sqlite-bun/SqliteClient";
74
74
  import { layer as sqliteMigratorLayer, run as runSqliteMigrator } from "@effect/sql-sqlite-bun/SqliteMigrator";
75
- import { Effect as Effect2, Layer } from "effect";
75
+ import { layer as bunServicesLayer } from "@effect/platform-bun/BunServices";
76
+ import { Effect as Effect2, FileSystem, Function, Layer, Path } from "effect";
76
77
  import { SqlClient as SqlClient2 } from "effect/unstable/sql/SqlClient";
77
- import { dirname, resolve } from "path";
78
- import { realpathSync } from "fs";
79
78
 
80
79
  // ../../migrations/sqlite/0001_baseline.sql
81
80
  var _0001_baseline_default = `CREATE TABLE "relay_address_book_entries" (
@@ -683,27 +682,25 @@ var loader = Effect.succeed(migrations.map(({ id, name, source }) => [id, name,
683
682
  var clientLayer = (options) => sqliteClientLayer(options);
684
683
  var memoryIdentity = 0;
685
684
  var ownedDatabases = new Set;
686
- var canonicalFilename = (filename) => {
687
- const absolute = resolve(filename);
688
- try {
689
- return realpathSync(absolute);
690
- } catch {
691
- try {
692
- return resolve(realpathSync(dirname(absolute)), absolute.slice(dirname(absolute).length + 1));
693
- } catch {
694
- return absolute;
695
- }
696
- }
697
- };
685
+ var canonicalFilename = Effect2.fn("SQLite.canonicalFilename")(function* (filename) {
686
+ const fs = yield* FileSystem.FileSystem;
687
+ const path = yield* Path.Path;
688
+ const absolute = path.resolve(filename);
689
+ return yield* fs.realPath(absolute).pipe(Effect2.catch(() => fs.realPath(path.dirname(absolute)).pipe(Effect2.map((parent) => path.resolve(parent, path.basename(absolute))), Effect2.orElseSucceed(() => absolute))));
690
+ });
698
691
  var runtimeDatabaseLayer2 = (options) => {
699
692
  if (options.filename.length === 0) {
700
- return Object.assign(Layer.effectContext(Effect2.fail(new RuntimeConfigurationError({
693
+ return Object.assign(Layer.effectContext(Effect2.fail(RuntimeConfigurationError.make({
701
694
  setting: "filename",
702
695
  nextAction: "provide-setting",
703
696
  cause: { _tag: "ConfigFailure", reason: "SQLite Runtime requires a non-empty filename" }
704
697
  }))), { [DatabaseDialect]: "sqlite" });
705
698
  }
706
- const filename = options.filename === ":memory:" ? options.filename : canonicalFilename(options.filename);
699
+ const resolvedFilename = options.filename === ":memory:" ? Effect2.succeed(options.filename) : Effect2.scoped(Layer.build(bunServicesLayer).pipe(Effect2.flatMap((context) => Effect2.provide(canonicalFilename(options.filename), context))));
700
+ const database = Layer.unwrap(resolvedFilename.pipe(Effect2.map((filename) => makeSqliteDatabaseLayer(options, filename))));
701
+ return Object.assign(database, { [DatabaseDialect]: "sqlite" });
702
+ };
703
+ var makeSqliteDatabaseLayer = (options, filename) => {
707
704
  const identity = options.filename === ":memory:" ? `sqlite:memory:${memoryIdentity++}` : `sqlite:file:${filename}`;
708
705
  const databaseIdentity = makeDatabaseIdentity(identity);
709
706
  const acquireSchema = Effect2.gen(function* () {
@@ -713,11 +710,11 @@ var runtimeDatabaseLayer2 = (options) => {
713
710
  const actual = rows.map((row) => `${row.migration_id}:${row.name}`).join(",");
714
711
  const expected = migrations.map((migration) => `${migration.id}:${migration.name}`).join(",");
715
712
  if (actual !== expected) {
716
- return yield* new RuntimeMigrationError({
713
+ return yield* RuntimeMigrationError.make({
717
714
  dialect: "sqlite",
718
715
  phase: "verify",
719
716
  nextAction: "run-compatible-release",
720
- cause: new SchemaHeadMismatch({ expected, actual })
717
+ cause: SchemaHeadMismatch.make({ expected, actual })
721
718
  });
722
719
  }
723
720
  });
@@ -731,18 +728,18 @@ var runtimeDatabaseLayer2 = (options) => {
731
728
  });
732
729
  const ownership = Layer.effectDiscard(Effect2.acquireRelease(Effect2.suspend(() => {
733
730
  if (ownedDatabases.has(identity)) {
734
- return Effect2.fail(new RuntimeTopologyError({
731
+ return Effect2.fail(RuntimeTopologyError.make({
735
732
  dialect: "sqlite",
736
733
  role: "embedded",
737
734
  nextAction: "reuse-runtime",
738
- cause: new DatabaseAlreadyOwned({ databaseIdentity })
735
+ cause: DatabaseAlreadyOwned.make({ databaseIdentity })
739
736
  }));
740
737
  }
741
738
  ownedDatabases.add(identity);
742
739
  return Effect2.void;
743
740
  }), () => Effect2.sync(() => ownedDatabases.delete(identity))));
744
741
  const ownedDatabase = database.pipe(Layer.provideMerge(ownership));
745
- return Object.assign(ownedDatabase, { [DatabaseDialect]: "sqlite" });
742
+ return ownedDatabase;
746
743
  };
747
744
  var migrationOptions = {
748
745
  loader,
@@ -757,18 +754,18 @@ var layer = (options) => {
757
754
  return sql;
758
755
  })).pipe(Layer.provide(client));
759
756
  };
760
- var workflowLayer = (options, handlersLayer) => {
757
+ var workflowLayer = Function.dual(2, (options, handlersLayer) => {
761
758
  const sqlite = layer(options);
762
759
  const repository = exports_workflow_definition_repository.layer.pipe(Layer.provideMerge(sqlite));
763
760
  return exports_definition_runtime.layer.pipe(Layer.provideMerge(handlersLayer), Layer.provideMerge(repository));
764
- };
765
- var childFanOutLayer = (options, handlersLayer) => {
761
+ });
762
+ var childFanOutLayer = Function.dual(2, (options, handlersLayer) => {
766
763
  const sqlite = layer(options);
767
764
  const repository = exports_child_fan_out_repository.layer.pipe(Layer.provideMerge(sqlite));
768
765
  const events = exports_event_log_service.layerFromRepository.pipe(Layer.provide(exports_execution_event_repository.layer.pipe(Layer.provide(exports_notification_bus.inProcessLayer))), Layer.provideMerge(sqlite));
769
766
  const transitions = exports_child_fan_out_transition_service.layer.pipe(Layer.provide(repository), Layer.provide(events));
770
767
  return exports_child_fan_out_runtime.layer.pipe(Layer.provide(handlersLayer), Layer.provide(repository), Layer.provide(transitions));
771
- };
768
+ });
772
769
 
773
770
  // src/sqlite.ts
774
771
  var relaySqlitePackage = "@relayfx/sdk/sqlite";
@@ -3,7 +3,7 @@ import { OpenAiClient as OpenAiCompatibleClient, OpenAiEmbeddingModel as OpenAiC
3
3
  import { EmbeddingModelService } from "../../runtime/index";
4
4
  export interface OpenAiEmbeddingInput {
5
5
  readonly model: OpenAiEmbeddingModel.Model | (string & {});
6
- readonly dimensions?: number | undefined;
6
+ readonly dimensions: number;
7
7
  readonly config?: Omit<typeof OpenAiEmbeddingModel.Config.Service, "model" | "dimensions"> | undefined;
8
8
  readonly registrationKey?: string | undefined;
9
9
  readonly provider?: string | undefined;
@@ -11,7 +11,7 @@ export interface OpenAiEmbeddingInput {
11
11
  }
12
12
  export interface OpenAiCompatibleEmbeddingInput {
13
13
  readonly model: string;
14
- readonly dimensions?: number | undefined;
14
+ readonly dimensions: number;
15
15
  readonly config?: Omit<typeof OpenAiCompatibleEmbeddingModel.Config.Service, "model" | "dimensions"> | undefined;
16
16
  readonly registrationKey?: string | undefined;
17
17
  readonly provider?: string | undefined;
@@ -7,7 +7,7 @@ export interface Interface {
7
7
  readonly release: (input: ReleaseEnvelopeReadyInput) => Effect.Effect<EnvelopeReadyReleased, ClientError>;
8
8
  readonly submitInbound: (input: SubmitInboundEnvelopeInput) => Effect.Effect<SubmitInboundEnvelopeAccepted, WaitKindMismatch | ClientError>;
9
9
  }
10
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/sdk/AdapterOutbox", Interface>;
10
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/sdk/adapter-outbox/Service", Interface>;
11
11
  export declare class Service extends Service_base {
12
12
  }
13
13
  export declare const layer: Layer.Layer<Service, never, ClientService>;
@@ -4,7 +4,7 @@ import { Address, Agent, ChildOrchestration, Content, Entity, Envelope, Executio
4
4
  import { ChildExecutionRepository, ChildFanOutRepository, ClusterRegistryRepository, EnvelopeRepository, ExecutionRepository, InboxRepository, ScheduleRepository, SessionRepository, SteeringRepository, ToolCallRepository, WorkflowDefinitionRepository } from "../store-sql/portable";
5
5
  import { Context, Effect, Layer, Schema, Stream } from "effect";
6
6
  import { Sharding, ShardingConfig } from "effect/unstable/cluster";
7
- import type { AckEnvelopeReadyInput, CancelExecutionAccepted, CancelExecutionInput, CancelScheduleInput, CancelScheduleResult, ClaimEnvelopeReadyInput, CreateScheduleInput, CreateScheduleResult, EnvelopeReadyAcked, EnvelopeReadyLease, EnvelopeReadyReleased, ExecutionInspection, ExecutionListChange, GetSessionInput, GetSessionResult, GetEntityStateInput, PutEntityStateInput, DeleteEntityStateInput, ListEntityStateInput, GetOrCreateEntityInput, GetEntityInput, DestroyEntityInput, ListEntitiesInput, ListExecutionsInput, ListExecutionsResult, ListInboxMessagesInput, ListTopicSubscriptionsInput, PublishTopicInput, SubscribeTopicInput, TopicPublishAccepted, TopicSubscription, UnsubscribeTopicInput, ListPendingApprovalsInput, SessionStreamItem, StreamSessionInput, WatchExecutionsInput, ListRunnersResult, ListSchedulesInput, ListSchedulesResult, ListSessionsInput, ListSessionsResult, ListWaitsInput, PendingToolApprovalList, PendingToolCallList, ListPendingToolCallsInput, FulfillToolCallInput, ClaimToolWorkInput, CompleteToolWorkInput, ReleaseToolWorkInput, ListToolAttemptsInput, ToolAttemptList, ToolOutcomeAccepted, ToolWorkLease, ToolWorkReleased, ReleaseEnvelopeReadyInput, ReplayExecutionInput, ReplayExecutionResult, ResolvePermissionInput, ResolveToolApprovalInput, RouteExecutionResult, StartExecutionInput, StartExecutionResult, SpawnChildRunInput, CancelChildFanOutInput, CancelChildFanOutResult, CreateChildFanOutInput, InspectChildFanOutInput, InspectChildFanOutResult, SteerAccepted, SteerInput, StreamExecutionInput, SubmitInboundEnvelopeAccepted, SubmitInboundEnvelopeInput, WaitView, WakeAccepted, WakeInput } from "./operation";
7
+ import type { AckEnvelopeReadyInput, CancelExecutionAccepted, CancelExecutionInput, CancelScheduleInput, CancelScheduleResult, ClaimEnvelopeReadyInput, CreateScheduleInput, CreateScheduleResult, EnvelopeReadyAcked, EnvelopeReadyLease, EnvelopeReadyReleased, ExecutionInspection, ExecutionListChange, GetSessionInput, GetSessionResult, GetEntityStateInput, PutEntityStateInput, DeleteEntityStateInput, ListEntityStateInput, GetOrCreateEntityInput, GetEntityInput, DestroyEntityInput, ListEntitiesInput, ListExecutionsInput, ListExecutionsResult, ListInboxMessagesInput, ListTopicSubscriptionsInput, PublishTopicInput, SubscribeTopicInput, TopicPublishAccepted, TopicSubscription, UnsubscribeTopicInput, ListPendingApprovalsInput, SessionStreamItem, StreamSessionInput, WatchExecutionsInput, ListRunnersResult, ListSchedulesInput, ListSchedulesResult, ListSessionsInput, ListSessionsResult, ListWaitsInput, PendingToolApprovalList, PendingToolCallList, ListPendingToolCallsInput, FulfillToolCallInput, ClaimToolWorkInput, CompleteToolWorkInput, ReleaseToolWorkInput, ListToolAttemptsInput, ToolAttemptList, ToolOutcomeAccepted, ToolWorkLease, ToolWorkReleased, ReleaseEnvelopeReadyInput, PageExecutionEventsInput, PageExecutionEventsResult, ReplayExecutionInput, ReplayExecutionResult, ResolvePermissionInput, ResolveToolApprovalInput, RouteExecutionResult, StartExecutionInput, StartExecutionResult, SpawnChildRunInput, CancelChildFanOutInput, CancelChildFanOutResult, CreateChildFanOutInput, InspectChildFanOutInput, InspectChildFanOutResult, SteerAccepted, SteerInput, StreamExecutionInput, SubmitInboundEnvelopeAccepted, SubmitInboundEnvelopeInput, WaitView, WakeAccepted, WakeInput } from "./operation";
8
8
  import { EventLogCursorNotFound } from "./operation";
9
9
  export { EventLogCursorNotFound } from "./operation";
10
10
  import { AwaitWaitInput, WaitOutcome } from "./operation";
@@ -112,14 +112,14 @@ export interface Interface {
112
112
  readonly registerAgent: (input: RegisterAgentInput) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
113
113
  readonly registerAgentDefinition: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
114
114
  readonly getAgentDefinition: (id: Ids.AgentId) => Effect.Effect<Agent.DefinitionRecord | undefined, ClientError>;
115
- readonly listAgentDefinitions: () => Effect.Effect<Agent.DefinitionList, ClientError>;
115
+ readonly listAgentDefinitions: (_?: void) => Effect.Effect<Agent.DefinitionList, ClientError>;
116
116
  readonly listAgentDefinitionRevisions: (id: Ids.AgentId) => Effect.Effect<Agent.DefinitionRevisionList, ClientError>;
117
117
  readonly getSkillDefinition: (id: Ids.SkillDefinitionId) => Effect.Effect<Skill.DefinitionRecord | undefined, ClientError>;
118
- readonly listSkillDefinitions: () => Effect.Effect<Skill.DefinitionList, ClientError>;
118
+ readonly listSkillDefinitions: (_?: void) => Effect.Effect<Skill.DefinitionList, ClientError>;
119
119
  readonly listSkillDefinitionRevisions: (id: Ids.SkillDefinitionId) => Effect.Effect<Skill.DefinitionRevisionList, ClientError>;
120
120
  readonly registerAddressBookRoute: (input: Address.RegisterRoutePayload) => Effect.Effect<Address.RouteRegistered, EntityNamespaceReserved | ClientError>;
121
121
  readonly getAddressBookRoute: (id: Ids.AddressId) => Effect.Effect<Address.RouteRecord | undefined, ClientError>;
122
- readonly listAddressBookRoutes: () => Effect.Effect<Address.RouteList, ClientError>;
122
+ readonly listAddressBookRoutes: (_?: void) => Effect.Effect<Address.RouteList, ClientError>;
123
123
  readonly startExecution: (input: StartExecutionInput) => Effect.Effect<StartExecutionResult, EntityNamespaceReserved | ClientError>;
124
124
  readonly startExecutionByAddress: (input: StartExecutionByAddressInput) => Effect.Effect<StartExecutionResult, EntityNamespaceReserved | ClientError>;
125
125
  readonly startExecutionByAgentDefinition: (input: StartExecutionByAgentDefinitionInput) => Effect.Effect<StartExecutionResult, EntityNamespaceReserved | ClientError>;
@@ -137,7 +137,8 @@ export interface Interface {
137
137
  readonly getSession: (input: GetSessionInput) => Effect.Effect<GetSessionResult, ClientError>;
138
138
  readonly listWaits: (input: ListWaitsInput) => Effect.Effect<ReadonlyArray<WaitView>, ClientError>;
139
139
  readonly replayExecution: (input: ReplayExecutionInput) => Effect.Effect<ReplayExecutionResult, ClientError>;
140
- readonly listRunners: () => Effect.Effect<ListRunnersResult, ClientError>;
140
+ readonly pageExecutionEvents: (input: PageExecutionEventsInput) => Effect.Effect<PageExecutionEventsResult, EventLogCursorNotFound | ClientError>;
141
+ readonly listRunners: (_?: void) => Effect.Effect<ListRunnersResult, ClientError>;
141
142
  readonly routeExecution: (executionId: Ids.ExecutionId) => Effect.Effect<RouteExecutionResult, ClientError>;
142
143
  readonly send: (input: Envelope.SendInput) => Effect.Effect<Envelope.EnvelopeAccepted, ClientError>;
143
144
  readonly askEntity: <Name extends string, I extends Schema.Top, O extends Schema.Top>(input: AskEntityInput<Name, I, O>) => Effect.Effect<O["Type"], CommandTimedOut | CommandReplyInvalid | EntityNotFound | ClientError, I["EncodingServices"] | O["DecodingServices"]>;
@@ -174,7 +175,7 @@ export interface Interface {
174
175
  readonly cancelSchedule: (input: CancelScheduleInput) => Effect.Effect<CancelScheduleResult, ClientError>;
175
176
  readonly listSchedules: (input: ListSchedulesInput) => Effect.Effect<ListSchedulesResult, ClientError>;
176
177
  }
177
- declare const Service_base: Context.ServiceClass<Service, "@relayfx/sdk/Client", Interface>;
178
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/sdk/client/Service", Interface>;
178
179
  export declare class Service extends Service_base {
179
180
  }
180
181
  export interface FollowExecutionDependencies {
@@ -185,7 +186,7 @@ export interface FollowExecutionDependencies {
185
186
  export declare const followExecutionFrom: (dependencies: FollowExecutionDependencies) => (input: FollowExecutionInput) => Stream.Stream<FollowExecutionItem, EventLogCursorNotFound | ClientError>;
186
187
  export type RuntimeRequirements = AgentRegistry.Service | EntityRegistry.Service | EntityInstanceService.Service | AddressBook.Service | ExecutionService.Service | EnvelopeService.Service | WaitService.Service | EventLog.Service | SessionStream.Service | ExecutionWatch.Service | ExecutionState.Service | PresenceService.Service | EnvelopeRepository.Service | ExecutionRepository.Service | InboxRepository.Service | TopicService.Service | ToolCallRepository.Service | ChildExecutionRepository.Service | ChildFanOutRepository.Service | SessionRepository.Service | SteeringRepository.Service | ClusterRegistryRepository.Service | ScheduleRepository.Service | SkillRegistry.Service | ToolTransitionCoordinator.Service | WorkflowDefinitionRepository.Service | Sharding.Sharding | ShardingConfig.ShardingConfig;
187
188
  export declare const layerFromRuntime: Layer.Layer<Service, never, RuntimeRequirements>;
188
- export declare const testLayer: (implementation: Omit<Interface, "registerWorkflowDefinition" | "getWorkflowDefinitionRevision" | "listWorkflowDefinitionRevisions" | "startWorkflowRun" | "inspectWorkflowRun" | "replayWorkflowRun" | "cancelWorkflowRun" | "streamSession" | "watchExecutions" | "getPresence" | "watchPresence" | "registerEntityKind" | "getOrCreateEntity" | "getEntity" | "destroyEntity" | "listEntities" | "followExecution"> & Partial<Interface>) => Layer.Layer<Service, never, never>;
189
+ export declare const testLayer: (implementation: Omit<Interface, "registerWorkflowDefinition" | "getWorkflowDefinitionRevision" | "listWorkflowDefinitionRevisions" | "startWorkflowRun" | "inspectWorkflowRun" | "replayWorkflowRun" | "cancelWorkflowRun" | "streamSession" | "watchExecutions" | "getPresence" | "watchPresence" | "registerEntityKind" | "getOrCreateEntity" | "getEntity" | "destroyEntity" | "listEntities" | "followExecution" | "pageExecutionEvents"> & Partial<Interface>) => Layer.Layer<Service, never, never>;
189
190
  export declare const registerAgentDefinition: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, ClientError, Service>;
190
191
  export declare const registerEntityKind: (input: Entity.KindDefinition) => Effect.Effect<Entity.KindDefinition, ClientError, Service>;
191
192
  export declare const getOrCreateEntity: (input: GetOrCreateEntityInput) => Effect.Effect<Entity.Instance, ClientError, Service>;
@@ -213,6 +214,7 @@ export declare const listSessions: (input: ListSessionsInput) => Effect.Effect<L
213
214
  export declare const getSession: (input: GetSessionInput) => Effect.Effect<GetSessionResult, ClientError, Service>;
214
215
  export declare const listWaits: (input: ListWaitsInput) => Effect.Effect<readonly WaitView[], ClientError, Service>;
215
216
  export declare const replayExecution: (input: ReplayExecutionInput) => Effect.Effect<ReplayExecutionResult, ClientError, Service>;
217
+ export declare const pageExecutionEvents: (input: PageExecutionEventsInput) => Effect.Effect<PageExecutionEventsResult, ClientError | EventLogCursorNotFound, Service>;
216
218
  export declare const listRunners: () => Effect.Effect<ListRunnersResult, ClientError, Service>;
217
219
  export declare const routeExecution: (executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">) => Effect.Effect<RouteExecutionResult, ClientError, Service>;
218
220
  export declare const subscribeTopic: (input: SubscribeTopicInput) => Effect.Effect<TopicSubscription, ClientError, Service>;
@@ -222,7 +224,7 @@ export declare const listTopicSubscriptions: (input: ListTopicSubscriptionsInput
222
224
  export declare const listInboxMessages: (input: ListInboxMessagesInput) => Effect.Effect<readonly Inbox.Message[], ClientError, Service>;
223
225
  export declare const inspectExecution: (executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">) => Effect.Effect<ExecutionInspection, ClientError | ExecutionNotFound, Service>;
224
226
  export declare const send: (input: Envelope.SendInput) => Effect.Effect<Envelope.EnvelopeAccepted, ClientError, Service>;
225
- export declare const streamExecution: (input: StreamExecutionInput) => Stream.Stream<Execution.ExecutionEvent, EventLogCursorNotFound | ClientError, Service>;
227
+ export declare const streamExecution: (input: StreamExecutionInput) => Stream.Stream<Execution.ExecutionEvent, ClientError | EventLogCursorNotFound, Service>;
226
228
  export declare const followExecution: (input: FollowExecutionInput) => Stream.Stream<Schema.Struct.ReadonlySide<{
227
229
  readonly _tag: Schema.tag<"event">;
228
230
  readonly event: Schema.Struct<{
@@ -321,7 +323,7 @@ export declare const followExecution: (input: FollowExecutionInput) => Stream.St
321
323
  }>;
322
324
  }>]>;
323
325
  readonly cursor: Schema.NullOr<Schema.String>;
324
- }, "Type">, EventLogCursorNotFound | ClientError, Service>;
326
+ }, "Type">, ClientError | EventLogCursorNotFound, Service>;
325
327
  export declare const streamSession: (input: StreamSessionInput) => Stream.Stream<Schema.Struct.ReadonlySide<{
326
328
  readonly _tag: Schema.tag<"execution_joined">;
327
329
  readonly execution: Schema.Struct<{
@@ -410,24 +412,8 @@ export declare const streamSession: (input: StreamSessionInput) => Stream.Stream
410
412
  readonly data: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
411
413
  readonly created_at: Schema.Int;
412
414
  }>;
413
- }, "Type">, EventLogCursorNotFound | ClientError, Service>;
414
- export declare const watchExecutions: (input: WatchExecutionsInput) => Stream.Stream<{
415
- readonly records: readonly {
416
- readonly metadata: {
417
- readonly [x: string]: Schema.Json;
418
- };
419
- readonly kind: "user-agent" | "agent-agent";
420
- readonly created_at: number;
421
- readonly updated_at: number;
422
- readonly root_address_id: string & import("effect/Brand").Brand<"Relay.AddressId">;
423
- readonly status: "waiting" | "running" | "completed" | "failed" | "queued" | "cancelled";
424
- readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
425
- readonly session_id?: string & import("effect/Brand").Brand<"Relay.SessionId">;
426
- readonly agent_id?: string & import("effect/Brand").Brand<"Relay.AgentId">;
427
- }[];
428
- readonly _tag: "snapshot";
429
- readonly next_cursor?: string;
430
- } | Schema.Struct.ReadonlySide<{
415
+ }, "Type">, ClientError | EventLogCursorNotFound, Service>;
416
+ export declare const watchExecutions: (input: WatchExecutionsInput) => Stream.Stream<Schema.Struct.ReadonlySide<{
431
417
  readonly _tag: Schema.tag<"upsert">;
432
418
  readonly record: Schema.Struct<{
433
419
  readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
@@ -448,7 +434,23 @@ export declare const watchExecutions: (input: WatchExecutionsInput) => Stream.St
448
434
  readonly created_at: Schema.Int;
449
435
  readonly updated_at: Schema.Int;
450
436
  }>;
451
- }, "Type">, ClientError, Service>;
437
+ }, "Type"> | {
438
+ readonly _tag: "snapshot";
439
+ readonly records: readonly {
440
+ readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
441
+ readonly root_address_id: string & import("effect/Brand").Brand<"Relay.AddressId">;
442
+ readonly session_id?: string & import("effect/Brand").Brand<"Relay.SessionId">;
443
+ readonly status: "cancelled" | "completed" | "failed" | "queued" | "running" | "waiting";
444
+ readonly kind: "agent-agent" | "user-agent";
445
+ readonly agent_id?: string & import("effect/Brand").Brand<"Relay.AgentId">;
446
+ readonly metadata: {
447
+ readonly [x: string]: Schema.Json;
448
+ };
449
+ readonly created_at: number;
450
+ readonly updated_at: number;
451
+ }[];
452
+ readonly next_cursor?: string;
453
+ }, ClientError, Service>;
452
454
  export declare const getPresence: (scope: Presence.Scope) => Effect.Effect<Presence.View, ClientError, Service>;
453
455
  export declare const watchPresence: (scope: Presence.Scope) => Stream.Stream<Presence.View, ClientError, Service>;
454
456
  export declare const wake: (input: WakeInput) => Effect.Effect<WakeAccepted, ClientError | WaitKindMismatch, Service>;
@@ -463,7 +465,7 @@ export declare const releaseToolWork: (input: ReleaseToolWorkInput) => Effect.Ef
463
465
  export declare const listToolAttempts: (input: ListToolAttemptsInput) => Effect.Effect<ToolAttemptList, ClientError, Service>;
464
466
  export declare const submitInboundEnvelope: (input: SubmitInboundEnvelopeInput) => Effect.Effect<SubmitInboundEnvelopeAccepted, ClientError | WaitKindMismatch, Service>;
465
467
  export declare const spawnChildRun: (input: SpawnChildRunInput) => Effect.Effect<Execution.ChildRunAccepted, ClientError, Service>;
466
- export declare const createChildFanOut: (input: CreateChildFanOutInput) => Effect.Effect<ChildOrchestration.FanOutState, RuntimeCapabilityUnavailable | ClientError, Service>;
468
+ export declare const createChildFanOut: (input: CreateChildFanOutInput) => Effect.Effect<ChildOrchestration.FanOutState, ClientError | RuntimeCapabilityUnavailable, Service>;
467
469
  export declare const cancelChildFanOut: (input: CancelChildFanOutInput) => Effect.Effect<CancelChildFanOutResult, ClientError, Service>;
468
470
  export declare const inspectChildFanOut: (input: InspectChildFanOutInput) => Effect.Effect<InspectChildFanOutResult, ClientError, Service>;
469
471
  export declare const claimEnvelopeReady: (input: ClaimEnvelopeReadyInput) => Effect.Effect<EnvelopeReadyLease | null, ClientError, Service>;
@@ -472,5 +474,5 @@ export declare const releaseEnvelopeReady: (input: ReleaseEnvelopeReadyInput) =>
472
474
  export declare const createSchedule: (input: CreateScheduleInput) => Effect.Effect<CreateScheduleResult, ClientError, Service>;
473
475
  export declare const cancelSchedule: (input: CancelScheduleInput) => Effect.Effect<CancelScheduleResult, ClientError, Service>;
474
476
  export declare const listSchedules: (input: ListSchedulesInput) => Effect.Effect<ListSchedulesResult, ClientError, Service>;
475
- export declare const askEntity: <Name extends string, I extends Schema.Top, O extends Schema.Top>(input: AskEntityInput<Name, I, O>) => Effect.Effect<O["Type"], CommandTimedOut | CommandReplyInvalid | EntityNotFound | ClientError, Service | I["EncodingServices"] | O["DecodingServices"]>;
477
+ export declare const askEntity: <Name extends string, I extends Schema.Top, O extends Schema.Top>(input: AskEntityInput<Name, I, O>) => Effect.Effect<O["Type"], ClientError | CommandReplyInvalid | CommandTimedOut | EntityNotFound, Service | I["EncodingServices"] | O["DecodingServices"]>;
476
478
  export declare const awaitWait: (input: AwaitWaitInput) => Effect.Effect<WaitOutcome, ClientError, Service>;
@@ -4,10 +4,16 @@ export interface Command<Name extends string, Input extends Schema.Top, Output e
4
4
  readonly input: Input;
5
5
  readonly output: Output;
6
6
  }
7
- export declare const make: <Name extends string, Input extends Schema.Top, Output extends Schema.Top>(name: Name, options: {
8
- readonly input: Input;
9
- readonly output: Output;
10
- }) => Command<Name, Input, Output>;
7
+ export declare const make: {
8
+ <Input extends Schema.Top, Output extends Schema.Top>(options: {
9
+ readonly input: Input;
10
+ readonly output: Output;
11
+ }): <Name extends string>(name: Name) => Command<Name, Input, Output>;
12
+ <Name extends string, Input extends Schema.Top, Output extends Schema.Top>(name: Name, options: {
13
+ readonly input: Input;
14
+ readonly output: Output;
15
+ }): Command<Name, Input, Output>;
16
+ };
11
17
  export declare const inputSchemaRef: (name: string) => string;
12
18
  export declare const outputSchemaRef: (name: string) => string;
13
19
  declare const CommandTimedOut_base: Schema.Class<CommandTimedOut, Schema.TaggedStruct<"CommandTimedOut", {
@@ -3,14 +3,14 @@ import type { Context, Effect } from "effect";
3
3
  export type Drizzle = Context.Service.Shape<typeof Database.Service>;
4
4
  export type PgTimestamp = Parameters<typeof Database.fromPgDate>[0];
5
5
  export type DatabaseError = Effect.Error<ReturnType<typeof Database.check>>;
6
- export type Dialect = typeof Database.Dialect.Type;
6
+ export type Dialect = Database.Dialect;
7
7
  export declare const Service: typeof Database.Service;
8
- export declare const PgClientLive: import("effect/Layer").Layer<import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-pg/PgClient").PgClient, import("effect/unstable/sql/SqlError").SqlError | import("effect/Config").ConfigError, never>;
8
+ export declare const PgClientLive: import("effect/Layer").Layer<import("@effect/sql-pg/PgClient").PgClient | import("effect/unstable/sql/SqlClient").SqlClient, import("effect/Config").ConfigError | import("effect/unstable/sql/SqlError").SqlError, never>;
9
9
  export declare const layerFromPgClient: import("effect/Layer").Layer<Database.Service, never, import("@effect/sql-pg/PgClient").PgClient>;
10
- export declare const testLayer: (db: Database.Drizzle) => import("effect/Layer").Layer<Database.Service, never, never>;
10
+ export declare const testLayer: typeof Database.testLayer;
11
11
  export declare const check: () => Effect.Effect<void, import("drizzle-orm/effect-core").EffectDrizzleQueryError, Database.Service>;
12
12
  export declare const pgTypeParsers: {
13
13
  getTypeParser: (typeId: number, format?: "text" | "binary") => any;
14
14
  };
15
15
  export declare const Dialect: import("effect/Schema").Literals<readonly ["pg", "mysql", "sqlite"]>;
16
- export declare const dialect: Effect.Effect<"pg" | "mysql" | "sqlite", never, import("effect/unstable/sql/SqlClient").SqlClient>;
16
+ export declare const dialect: Effect.Effect<"mysql" | "pg" | "sqlite", never, import("effect/unstable/sql/SqlClient").SqlClient>;
@@ -1,4 +1,10 @@
1
1
  import { Effect } from "effect";
2
2
  import { RuntimeMigrationError, type Dialect } from "./runtime";
3
- export declare const migrationFailure: (dialect: Dialect, phase: "apply" | "verify", cause: unknown) => RuntimeMigrationError;
4
- export declare const normalizeMigrationCause: <A, E, R>(effect: Effect.Effect<A, E, R>, dialect: Dialect, phase: "apply" | "verify") => Effect.Effect<A, RuntimeMigrationError, R>;
3
+ export declare const migrationFailure: {
4
+ (phase: "apply" | "verify", cause: unknown): (dialect: Dialect) => RuntimeMigrationError;
5
+ (dialect: Dialect, phase: "apply" | "verify", cause: unknown): RuntimeMigrationError;
6
+ };
7
+ export declare const normalizeMigrationCause: {
8
+ (dialect: Dialect, phase: "apply" | "verify"): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, RuntimeMigrationError, R>;
9
+ <A, E, R>(effect: Effect.Effect<A, E, R>, dialect: Dialect, phase: "apply" | "verify"): Effect.Effect<A, RuntimeMigrationError, R>;
10
+ };
@@ -1,6 +1,6 @@
1
- import { Effect, type Layer } from "effect";
1
+ import { Effect, Layer } from "effect";
2
2
  import { SqlClient } from "effect/unstable/sql/SqlClient";
3
- import type { DatabaseIdentity, DatabaseLayer, RuntimeConfigurationError, RuntimeMigrationError } from "./runtime";
3
+ import { RuntimeMigrationError, type DatabaseIdentity, type DatabaseLayer, type RuntimeConfigurationError } from "./runtime";
4
4
  export interface MySQLRuntimeDatabaseOptions<E, R> {
5
5
  readonly clientLayer: Layer.Layer<SqlClient, E, R>;
6
6
  readonly databaseIdentity: DatabaseIdentity;