@relayfx/sdk 0.0.49 → 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.
Files changed (132) hide show
  1. package/README.md +5 -0
  2. package/dist/ai.js +42 -17218
  3. package/dist/index-q0z11q9m.js +18726 -0
  4. package/dist/index-sms8x6cq.js +137 -0
  5. package/dist/index-vbf5hcw8.js +2156 -0
  6. package/dist/index.js +741 -18835
  7. package/dist/migrations/20260712120000_durable_inbox/migration.sql +9 -0
  8. package/dist/migrations/20260712140000_execution_state/migration.sql +5 -0
  9. package/dist/migrations/20260712150000_durable_entities/migration.sql +15 -0
  10. package/dist/migrations/20260712160000_ephemeral_presence/migration.sql +13 -0
  11. package/dist/migrations/20260712170000_topic_subscriptions/migration.sql +3 -0
  12. package/dist/migrations/mysql/0003_durable_inbox.sql +3 -0
  13. package/dist/migrations/mysql/0004_execution_state.sql +3 -0
  14. package/dist/migrations/mysql/0005_durable_entities.sql +13 -0
  15. package/dist/migrations/mysql/0006_ephemeral_presence.sql +12 -0
  16. package/dist/migrations/mysql/0007_topic_subscriptions.sql +1 -0
  17. package/dist/migrations/pg/20260712120000_durable_inbox/migration.sql +9 -0
  18. package/dist/migrations/pg/20260712140000_execution_state/migration.sql +5 -0
  19. package/dist/migrations/pg/20260712150000_durable_entities/migration.sql +15 -0
  20. package/dist/migrations/pg/20260712160000_ephemeral_presence/migration.sql +13 -0
  21. package/dist/migrations/pg/20260712170000_topic_subscriptions/migration.sql +3 -0
  22. package/dist/migrations/sqlite/0003_durable_inbox.sql +9 -0
  23. package/dist/migrations/sqlite/0004_execution_state.sql +3 -0
  24. package/dist/migrations/sqlite/0005_durable_entities.sql +15 -0
  25. package/dist/migrations/sqlite/0006_ephemeral_presence.sql +12 -0
  26. package/dist/migrations/sqlite/0007_topic_subscriptions.sql +3 -0
  27. package/dist/sqlite.js +688 -0
  28. package/dist/types/relay/client.d.ts +197 -17
  29. package/dist/types/relay/command.d.ts +41 -0
  30. package/dist/types/relay/database.d.ts +1 -0
  31. package/dist/types/relay/index.d.ts +3 -2
  32. package/dist/types/relay/operation.d.ts +520 -2
  33. package/dist/types/relay/sqlite-migrations.d.ts +39 -0
  34. package/dist/types/relay/sqlite-runtime.d.ts +5 -0
  35. package/dist/types/relay/sqlite.d.ts +27 -0
  36. package/dist/types/runtime/address/address-book-service.d.ts +4 -4
  37. package/dist/types/runtime/address/address-resolution-service.d.ts +1 -1
  38. package/dist/types/runtime/agent/agent-loop-service.d.ts +2 -2
  39. package/dist/types/runtime/agent/agent-registry-service.d.ts +1 -1
  40. package/dist/types/runtime/agent/relay-compaction.d.ts +1 -1
  41. package/dist/types/runtime/agent/relay-permissions.d.ts +1 -1
  42. package/dist/types/runtime/agent/relay-steering.d.ts +1 -1
  43. package/dist/types/runtime/child/child-run-service.d.ts +1 -1
  44. package/dist/types/runtime/child/parent-notifier-service.d.ts +1 -1
  45. package/dist/types/runtime/cluster/execution-entity.d.ts +1 -1
  46. package/dist/types/runtime/entity/entity-instance-service.d.ts +67 -0
  47. package/dist/types/runtime/entity/entity-registry-service.d.ts +35 -0
  48. package/dist/types/runtime/envelope/envelope-service.d.ts +7 -3
  49. package/dist/types/runtime/execution/event-log-service.d.ts +1 -1
  50. package/dist/types/runtime/execution/execution-service.d.ts +1 -1
  51. package/dist/types/runtime/execution/execution-watch-service.d.ts +32 -0
  52. package/dist/types/runtime/execution/session-stream-service.d.ts +33 -0
  53. package/dist/types/runtime/inbox/inbox-service.d.ts +76 -0
  54. package/dist/types/runtime/inbox/send-message-tool.d.ts +27 -0
  55. package/dist/types/runtime/inbox/wait-for-messages-tool.d.ts +34 -0
  56. package/dist/types/runtime/index.d.ts +13 -0
  57. package/dist/types/runtime/memory/memory-service.d.ts +1 -1
  58. package/dist/types/runtime/presence/presence-service.d.ts +30 -0
  59. package/dist/types/runtime/presence/presence-tool.d.ts +20 -0
  60. package/dist/types/runtime/runner/runner-runtime-service.d.ts +18 -18
  61. package/dist/types/runtime/schedule/scheduler-service.d.ts +1 -1
  62. package/dist/types/runtime/session/session-store-service.d.ts +1 -1
  63. package/dist/types/runtime/skill/skill-registry-service.d.ts +1 -1
  64. package/dist/types/runtime/state/execution-state-service.d.ts +57 -0
  65. package/dist/types/runtime/state/state-tools.d.ts +5 -0
  66. package/dist/types/runtime/tool/tool-runtime-service.d.ts +1 -1
  67. package/dist/types/runtime/topic/publish-to-topic-tool.d.ts +24 -0
  68. package/dist/types/runtime/topic/topic-service.d.ts +50 -0
  69. package/dist/types/runtime/wait/wait-service.d.ts +2 -1
  70. package/dist/types/runtime/wait/wait-signal.d.ts +1 -1
  71. package/dist/types/runtime/workflow/execution-workflow.d.ts +2 -2
  72. package/dist/types/runtime/workspace/workspace-planner-service.d.ts +1 -1
  73. package/dist/types/schema/address-schema.d.ts +6 -6
  74. package/dist/types/schema/entity-schema.d.ts +40 -0
  75. package/dist/types/schema/envelope-schema.d.ts +1 -0
  76. package/dist/types/schema/execution-schema.d.ts +2 -2
  77. package/dist/types/schema/ids-schema.d.ts +8 -0
  78. package/dist/types/schema/inbox-schema.d.ts +81 -0
  79. package/dist/types/schema/index.d.ts +4 -0
  80. package/dist/types/schema/presence-schema.d.ts +28 -0
  81. package/dist/types/schema/state-schema.d.ts +35 -0
  82. package/dist/types/store-sql/address/address-book-repository.d.ts +1 -1
  83. package/dist/types/store-sql/database/database-service.d.ts +4 -18
  84. package/dist/types/store-sql/database/notification-bus.d.ts +2 -0
  85. package/dist/types/store-sql/database/sql-dialect.d.ts +13 -0
  86. package/dist/types/store-sql/entity/entity-repository.d.ts +36 -0
  87. package/dist/types/store-sql/envelope/envelope-repository.d.ts +1 -0
  88. package/dist/types/store-sql/execution/execution-event-repository.d.ts +2 -1
  89. package/dist/types/store-sql/execution/execution-repository.d.ts +12 -2
  90. package/dist/types/store-sql/inbox/inbox-repository.d.ts +56 -0
  91. package/dist/types/store-sql/index.d.ts +6 -0
  92. package/dist/types/store-sql/portable.d.ts +27 -0
  93. package/dist/types/store-sql/presence/presence-repository.d.ts +51 -0
  94. package/dist/types/store-sql/schema/relay-schema.d.ts +1352 -140
  95. package/dist/types/store-sql/state/execution-state-repository.d.ts +80 -0
  96. package/dist/types/store-sql/tenant/tenant-id.d.ts +0 -2
  97. package/dist/types/store-sql/topic/topic-repository.d.ts +44 -0
  98. package/package.json +26 -4
  99. package/dist/migrations/20260701002839_sour_cerebro/snapshot.json +0 -1971
  100. package/dist/migrations/20260701041134_acoustic_hulk/snapshot.json +0 -2372
  101. package/dist/migrations/20260701160543_condemned_stryfe/snapshot.json +0 -2442
  102. package/dist/migrations/20260701220315_heavy_gorgon/snapshot.json +0 -2495
  103. package/dist/migrations/20260701225444_polite_lord_hawal/snapshot.json +0 -2821
  104. package/dist/migrations/20260702030128_flaky_misty_knight/snapshot.json +0 -2821
  105. package/dist/migrations/20260705003847_nervous_banshee/snapshot.json +0 -2954
  106. package/dist/migrations/20260705012626_common_stryfe/snapshot.json +0 -3378
  107. package/dist/migrations/20260705015420_sweet_captain_marvel/snapshot.json +0 -3485
  108. package/dist/migrations/20260705023041_chunky_scalphunter/snapshot.json +0 -3753
  109. package/dist/migrations/20260705030344_short_patriot/snapshot.json +0 -3873
  110. package/dist/migrations/20260705045546_heavy_ben_grimm/snapshot.json +0 -4193
  111. package/dist/migrations/20260706185931_regular_shadow_king/snapshot.json +0 -4844
  112. package/dist/migrations/20260706233300_equal_cyclops/snapshot.json +0 -4883
  113. package/dist/migrations/20260709030349_agent_id_rename/snapshot.json +0 -4883
  114. package/dist/migrations/20260709214238_faithful_black_widow/snapshot.json +0 -5426
  115. package/dist/migrations/20260709220016_fearless_aaron_stack/snapshot.json +0 -5426
  116. package/dist/migrations/pg/20260701002839_sour_cerebro/snapshot.json +0 -1971
  117. package/dist/migrations/pg/20260701041134_acoustic_hulk/snapshot.json +0 -2372
  118. package/dist/migrations/pg/20260701160543_condemned_stryfe/snapshot.json +0 -2442
  119. package/dist/migrations/pg/20260701220315_heavy_gorgon/snapshot.json +0 -2495
  120. package/dist/migrations/pg/20260701225444_polite_lord_hawal/snapshot.json +0 -2821
  121. package/dist/migrations/pg/20260702030128_flaky_misty_knight/snapshot.json +0 -2821
  122. package/dist/migrations/pg/20260705003847_nervous_banshee/snapshot.json +0 -2954
  123. package/dist/migrations/pg/20260705012626_common_stryfe/snapshot.json +0 -3378
  124. package/dist/migrations/pg/20260705015420_sweet_captain_marvel/snapshot.json +0 -3485
  125. package/dist/migrations/pg/20260705023041_chunky_scalphunter/snapshot.json +0 -3753
  126. package/dist/migrations/pg/20260705030344_short_patriot/snapshot.json +0 -3873
  127. package/dist/migrations/pg/20260705045546_heavy_ben_grimm/snapshot.json +0 -4193
  128. package/dist/migrations/pg/20260706185931_regular_shadow_king/snapshot.json +0 -4844
  129. package/dist/migrations/pg/20260706233300_equal_cyclops/snapshot.json +0 -4883
  130. package/dist/migrations/pg/20260709030349_agent_id_rename/snapshot.json +0 -4883
  131. package/dist/migrations/pg/20260709214238_faithful_black_widow/snapshot.json +0 -5426
  132. package/dist/migrations/pg/20260709220016_fearless_aaron_stack/snapshot.json +0 -5426
@@ -1,5 +1,5 @@
1
1
  import { Agent, Ids, Shared, Tool, Workspace } from "../../schema/index";
2
- import { WorkspaceLeaseRepository } from "../../store-sql/index";
2
+ import { WorkspaceLeaseRepository } from "../../store-sql/portable";
3
3
  import { Context, Effect, Layer, Schema } from "effect";
4
4
  import { Service as EventLogService } from "../execution/event-log-service";
5
5
  import { WorkspaceCapabilityUnsupported } from "./workspace-provider-service";
@@ -1,8 +1,8 @@
1
1
  import { Schema } from "effect";
2
- export declare const RouteKind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
2
+ export declare const RouteKind: Schema.Literals<readonly ["local-agent", "local-execution", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
3
3
  export type RouteKind = typeof RouteKind.Type;
4
4
  export declare const Route: Schema.Struct<{
5
- readonly kind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
5
+ readonly kind: Schema.Literals<readonly ["local-agent", "local-execution", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
6
6
  readonly route_key: Schema.String;
7
7
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
8
8
  }>;
@@ -16,7 +16,7 @@ export declare const RouteRecord: Schema.Struct<{
16
16
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
17
17
  };
18
18
  readonly route: Schema.Struct<{
19
- readonly kind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
19
+ readonly kind: Schema.Literals<readonly ["local-agent", "local-execution", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
20
20
  readonly route_key: Schema.String;
21
21
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
22
22
  }>;
@@ -30,7 +30,7 @@ export declare const RegisterRoutePayload: Schema.Struct<{
30
30
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
31
31
  };
32
32
  readonly route: Schema.Struct<{
33
- readonly kind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
33
+ readonly kind: Schema.Literals<readonly ["local-agent", "local-execution", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
34
34
  readonly route_key: Schema.String;
35
35
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
36
36
  }>;
@@ -46,7 +46,7 @@ export declare const RouteRegistered: Schema.Struct<{
46
46
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
47
47
  };
48
48
  readonly route: Schema.Struct<{
49
- readonly kind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
49
+ readonly kind: Schema.Literals<readonly ["local-agent", "local-execution", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
50
50
  readonly route_key: Schema.String;
51
51
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
52
52
  }>;
@@ -65,7 +65,7 @@ export declare const RouteList: Schema.Struct<{
65
65
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
66
66
  };
67
67
  readonly route: Schema.Struct<{
68
- readonly kind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
68
+ readonly kind: Schema.Literals<readonly ["local-agent", "local-execution", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
69
69
  readonly route_key: Schema.String;
70
70
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
71
71
  }>;
@@ -0,0 +1,40 @@
1
+ import { Schema } from "effect";
2
+ export declare const KindDefinition: Schema.Struct<{
3
+ readonly kind: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
4
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
5
+ };
6
+ readonly agent_id: Schema.brand<Schema.String, "Relay.AgentId"> & {
7
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
8
+ };
9
+ readonly inbox: Schema.optionalKey<Schema.Struct<{
10
+ readonly drain: Schema.Literals<readonly ["all", "one"]>;
11
+ readonly max_batch: Schema.optionalKey<Schema.Int>;
12
+ }>>;
13
+ readonly state_enabled: Schema.optionalKey<Schema.Boolean>;
14
+ readonly continue_as_new_after_turns: Schema.optionalKey<Schema.Int>;
15
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
16
+ }>;
17
+ export interface KindDefinition extends Schema.Schema.Type<typeof KindDefinition> {
18
+ }
19
+ export declare const InstanceStatus: Schema.Literals<readonly ["active", "destroyed"]>;
20
+ export type InstanceStatus = typeof InstanceStatus.Type;
21
+ export declare const Instance: Schema.Struct<{
22
+ readonly kind: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
23
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
24
+ };
25
+ readonly key: Schema.brand<Schema.String, "Relay.EntityKey"> & {
26
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKey">;
27
+ };
28
+ readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
29
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
30
+ };
31
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
32
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
33
+ };
34
+ readonly generation: Schema.Int;
35
+ readonly status: Schema.Literals<readonly ["active", "destroyed"]>;
36
+ readonly created_at: Schema.Int;
37
+ readonly destroyed_at: Schema.optionalKey<Schema.Int>;
38
+ }>;
39
+ export interface Instance extends Schema.Schema.Type<typeof Instance> {
40
+ }
@@ -139,6 +139,7 @@ export declare const SendInput: Schema.Struct<{
139
139
  readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
140
140
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
141
141
  }>]>>;
142
+ readonly idempotency_key: Schema.optionalKey<Schema.String>;
142
143
  readonly wait: Schema.optionalKey<Schema.Struct<{
143
144
  readonly mode: Schema.Literals<readonly ["reply", "event", "until", "child"]>;
144
145
  readonly timeout: Schema.optionalKey<Schema.String>;
@@ -276,7 +276,7 @@ export declare const ChildRunAccepted: Schema.Struct<{
276
276
  }>;
277
277
  export interface ChildRunAccepted extends Schema.Schema.Type<typeof ChildRunAccepted> {
278
278
  }
279
- export declare const ExecutionEventType: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
279
+ export declare const ExecutionEventType: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
280
280
  export type ExecutionEventType = typeof ExecutionEventType.Type;
281
281
  export declare const ExecutionEvent: Schema.Struct<{
282
282
  readonly id: Schema.brand<Schema.String, "Relay.EventId"> & {
@@ -288,7 +288,7 @@ export declare const ExecutionEvent: Schema.Struct<{
288
288
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
289
289
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
290
290
  }>;
291
- readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
291
+ readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
292
292
  readonly sequence: Schema.Int;
293
293
  readonly cursor: Schema.String;
294
294
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -16,6 +16,14 @@ export declare const AgentId: Schema.brand<Schema.String, "Relay.AgentId"> & {
16
16
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
17
17
  };
18
18
  export type AgentId = typeof AgentId.Type;
19
+ export declare const EntityKindName: Schema.brand<Schema.String, "Relay.EntityKindName"> & {
20
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKindName">;
21
+ };
22
+ export type EntityKindName = typeof EntityKindName.Type;
23
+ export declare const EntityKey: Schema.brand<Schema.String, "Relay.EntityKey"> & {
24
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EntityKey">;
25
+ };
26
+ export type EntityKey = typeof EntityKey.Type;
19
27
  export declare const SkillDefinitionId: Schema.brand<Schema.String, "Relay.SkillDefinitionId"> & {
20
28
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.SkillDefinitionId">;
21
29
  };
@@ -0,0 +1,81 @@
1
+ import { Schema } from "effect";
2
+ export declare const MessageSequence: Schema.Int;
3
+ export type MessageSequence = typeof MessageSequence.Type;
4
+ export declare const Message: Schema.Struct<{
5
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
6
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
7
+ };
8
+ readonly sequence: Schema.Int;
9
+ readonly from: Schema.brand<Schema.String, "Relay.AddressId"> & {
10
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
11
+ };
12
+ readonly envelope_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.EnvelopeId"> & {
13
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.EnvelopeId">;
14
+ }>;
15
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
16
+ readonly type: Schema.Literal<"text">;
17
+ readonly text: Schema.String;
18
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
19
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
20
+ }>, Schema.Struct<{
21
+ readonly type: Schema.Literal<"structured">;
22
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
23
+ readonly schema_ref: Schema.optionalKey<Schema.String>;
24
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
25
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
26
+ }>, Schema.Struct<{
27
+ readonly type: Schema.Literal<"blob-reference">;
28
+ readonly uri: Schema.String;
29
+ readonly media_type: Schema.String;
30
+ readonly filename: Schema.optionalKey<Schema.String>;
31
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
32
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
33
+ }>, Schema.Struct<{
34
+ readonly type: Schema.Literal<"artifact-reference">;
35
+ readonly artifact_id: Schema.String;
36
+ readonly media_type: Schema.optionalKey<Schema.String>;
37
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
38
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
39
+ }>, Schema.Struct<{
40
+ readonly type: Schema.Literal<"tool-call">;
41
+ readonly call: Schema.Struct<{
42
+ readonly id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
43
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
44
+ };
45
+ readonly name: Schema.String;
46
+ readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
47
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
48
+ }>;
49
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
50
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
51
+ }>, Schema.Struct<{
52
+ readonly type: Schema.Literal<"tool-result">;
53
+ readonly result: Schema.Struct<{
54
+ readonly call_id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
55
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
56
+ };
57
+ readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
58
+ readonly error: Schema.optionalKey<Schema.String>;
59
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
60
+ }>;
61
+ readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
62
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
63
+ }>]>>;
64
+ readonly reply_wait_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.WaitId"> & {
65
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
66
+ }>;
67
+ readonly correlation_key: Schema.optionalKey<Schema.String>;
68
+ readonly idempotency_key: Schema.optionalKey<Schema.String>;
69
+ readonly drain_id: Schema.optionalKey<Schema.String>;
70
+ readonly consumed_at: Schema.optionalKey<Schema.Int>;
71
+ readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
72
+ readonly created_at: Schema.Int;
73
+ }>;
74
+ export interface Message extends Schema.Schema.Type<typeof Message> {
75
+ }
76
+ export declare const InboxPolicy: Schema.Struct<{
77
+ readonly drain: Schema.Literals<readonly ["all", "one"]>;
78
+ readonly max_batch: Schema.optionalKey<Schema.Int>;
79
+ }>;
80
+ export interface InboxPolicy extends Schema.Schema.Type<typeof InboxPolicy> {
81
+ }
@@ -2,11 +2,15 @@ export * as Address from "./address-schema";
2
2
  export * as Agent from "./agent-schema";
3
3
  export * as Content from "./content-schema";
4
4
  export * as Envelope from "./envelope-schema";
5
+ export * as Entity from "./entity-schema";
5
6
  export * as Execution from "./execution-schema";
6
7
  export * as Ids from "./ids-schema";
8
+ export * as Inbox from "./inbox-schema";
9
+ export * as Presence from "./presence-schema";
7
10
  export * as Schedule from "./schedule-schema";
8
11
  export * as Shared from "./shared-schema";
9
12
  export * as Skill from "./skill-schema";
13
+ export * as State from "./state-schema";
10
14
  export * as Tool from "./tool-schema";
11
15
  export * as Workspace from "./workspace-schema";
12
16
  export declare const schemaPackage = "./index";
@@ -0,0 +1,28 @@
1
+ import { Schema } from "effect";
2
+ export declare const Scope: Schema.Struct<{
3
+ readonly kind: Schema.Literals<readonly ["execution", "session"]>;
4
+ readonly id: Schema.String;
5
+ }>;
6
+ export interface Scope extends Schema.Schema.Type<typeof Scope> {
7
+ }
8
+ export declare const Entry: Schema.Struct<{
9
+ readonly id: Schema.String;
10
+ readonly metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
11
+ readonly connected_at: Schema.Int;
12
+ }>;
13
+ export interface Entry extends Schema.Schema.Type<typeof Entry> {
14
+ }
15
+ export declare const View: Schema.Struct<{
16
+ readonly scope: Schema.Struct<{
17
+ readonly kind: Schema.Literals<readonly ["execution", "session"]>;
18
+ readonly id: Schema.String;
19
+ }>;
20
+ readonly entries: Schema.$Array<Schema.Struct<{
21
+ readonly id: Schema.String;
22
+ readonly metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
23
+ readonly connected_at: Schema.Int;
24
+ }>>;
25
+ readonly observed_at: Schema.Int;
26
+ }>;
27
+ export interface View extends Schema.Schema.Type<typeof View> {
28
+ }
@@ -0,0 +1,35 @@
1
+ import { Schema } from "effect";
2
+ export declare const StateKey: Schema.String;
3
+ export type StateKey = typeof StateKey.Type;
4
+ export declare const StateIdempotencyKey: Schema.String;
5
+ export type StateIdempotencyKey = typeof StateIdempotencyKey.Type;
6
+ export declare const StateVersion: Schema.Int;
7
+ export type StateVersion = typeof StateVersion.Type;
8
+ export declare const StateRecordView: Schema.Struct<{
9
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
10
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
11
+ };
12
+ readonly key: Schema.String;
13
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
14
+ readonly version: Schema.Int;
15
+ readonly created_at: Schema.Int;
16
+ readonly updated_at: Schema.Int;
17
+ }>;
18
+ export interface StateRecordView extends Schema.Schema.Type<typeof StateRecordView> {
19
+ }
20
+ export declare const StateUpdatedEventData: Schema.Union<readonly [Schema.Struct<{
21
+ readonly key: Schema.String;
22
+ readonly version: Schema.Int;
23
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
24
+ }>, Schema.Struct<{
25
+ readonly key: Schema.String;
26
+ readonly version: Schema.Int;
27
+ readonly blob_ref: Schema.String;
28
+ }>]>;
29
+ export type StateUpdatedEventData = typeof StateUpdatedEventData.Type;
30
+ export declare const StateDeletedEventData: Schema.Struct<{
31
+ readonly key: Schema.String;
32
+ readonly version: Schema.Int;
33
+ }>;
34
+ export interface StateDeletedEventData extends Schema.Schema.Type<typeof StateDeletedEventData> {
35
+ }
@@ -1,7 +1,7 @@
1
1
  import { Ids, Shared } from "../../schema/index";
2
2
  import { Context, Effect, Layer, Schema } from "effect";
3
3
  import { SqlClient } from "effect/unstable/sql/SqlClient";
4
- export declare const RouteKind: Schema.Literals<readonly ["local-agent", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
4
+ export declare const RouteKind: Schema.Literals<readonly ["local-agent", "local-execution", "remote-relay", "local-adapter", "unavailable", "deferred-retry"]>;
5
5
  export type RouteKind = typeof RouteKind.Type;
6
6
  declare const AddressNotFound_base: Schema.Class<AddressNotFound, Schema.TaggedStruct<"AddressNotFound", {
7
7
  readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
@@ -1,8 +1,7 @@
1
1
  import { PgClient } from "@effect/sql-pg/PgClient";
2
2
  import { EffectPgDatabase } from "drizzle-orm/effect-postgres";
3
3
  import type { EffectDrizzleQueryError } from "drizzle-orm/effect-core/errors";
4
- import { Config, Context, Effect, Layer, Schema } from "effect";
5
- import { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ import { Config, Context, Effect, Layer } from "effect";
6
5
  import type { SqlError } from "effect/unstable/sql/SqlError";
7
6
  export type Drizzle = EffectPgDatabase & {
8
7
  readonly $client: PgClient;
@@ -12,26 +11,13 @@ export type DatabaseError = EffectDrizzleQueryError | SqlError;
12
11
  declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/Database", Drizzle>;
13
12
  export declare class Service extends Service_base {
14
13
  }
15
- export declare const toPgDate: (timestamp: number) => Date;
16
- export declare const fromPgDate: (timestamp: PgTimestamp) => number;
17
- export declare const fromNullablePgDate: (timestamp: PgTimestamp | null | undefined) => number | undefined;
14
+ export { fromDbTimestamp as fromPgDate, fromNullableDbTimestamp as fromNullablePgDate } from "./sql-dialect";
18
15
  export declare const pgTypeParsers: {
19
16
  getTypeParser: (typeId: number, format?: "text" | "binary") => any;
20
17
  };
21
- export declare const PgClientLive: Layer.Layer<PgClient | SqlClient, SqlError | Config.ConfigError, never>;
18
+ export declare const PgClientLive: Layer.Layer<import("effect/unstable/sql/SqlClient").SqlClient | PgClient, SqlError | Config.ConfigError, never>;
22
19
  export declare const layerFromPgClient: Layer.Layer<Service, never, PgClient>;
23
20
  export declare const layer: Layer.Layer<Service, SqlError | Config.ConfigError, never>;
24
21
  export declare const testLayer: (db: Drizzle) => Layer.Layer<Service, never, never>;
25
22
  export declare const check: () => Effect.Effect<void, EffectDrizzleQueryError, Service>;
26
- export declare const Dialect: Schema.Literals<readonly ["pg", "mysql", "sqlite"]>;
27
- export type Dialect = typeof Dialect.Type;
28
- export declare const dialect: Effect.Effect<Dialect, never, SqlClient>;
29
- export declare const MysqlClientLive: Layer.Layer<SqlClient | import("@effect/sql-mysql2/MysqlClient").MysqlClient, SqlError | Config.ConfigError, never>;
30
- export declare const SqliteClientLive: Layer.Layer<SqlClient | import("@effect/sql-sqlite-bun/SqliteClient").SqliteClient, Config.ConfigError, never>;
31
- export declare const timestampParam: (client: SqlClient, millis: number) => Date | number;
32
- export declare const fromDbTimestamp: (timestamp: PgTimestamp) => number;
33
- export declare const fromNullableDbTimestamp: (timestamp: PgTimestamp | null | undefined) => number | undefined;
34
- export declare const encodeJson: (value: unknown) => string;
35
- export declare const decodeJson: (value: unknown) => unknown;
36
- export declare const decodeBool: (value: unknown) => boolean;
37
- export {};
23
+ export { Dialect, decodeBool, decodeJson, dialect, encodeJson, fromDbTimestamp, fromNullableDbTimestamp, timestampParam, } from "./sql-dialect";
@@ -1,7 +1,9 @@
1
1
  import { Context, Effect, Layer, Stream } from "effect";
2
2
  import { SqlClient } from "effect/unstable/sql/SqlClient";
3
3
  import type { SqlError } from "effect/unstable/sql/SqlError";
4
+ export type Transport = "pg" | "in-process";
4
5
  export interface Interface {
6
+ readonly transport: Transport;
5
7
  readonly publish: (channel: string, payload: string) => Effect.Effect<void, SqlError>;
6
8
  readonly subscribe: (channel: string) => Stream.Stream<string, SqlError>;
7
9
  }
@@ -0,0 +1,13 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
3
+ export type DbTimestamp = Date | string | number;
4
+ export declare const Dialect: Schema.Literals<readonly ["pg", "mysql", "sqlite"]>;
5
+ export type Dialect = typeof Dialect.Type;
6
+ export declare const dialect: Effect.Effect<Dialect, never, SqlClient>;
7
+ export declare const toDbDate: (timestamp: number) => Date;
8
+ export declare const fromDbTimestamp: (timestamp: DbTimestamp) => number;
9
+ export declare const fromNullableDbTimestamp: (timestamp: DbTimestamp | null | undefined) => number | undefined;
10
+ export declare const timestampParam: (client: SqlClient, millis: number) => Date | number;
11
+ export declare const encodeJson: (value: unknown) => string;
12
+ export declare const decodeJson: (value: unknown) => unknown;
13
+ export declare const decodeBool: (value: unknown) => boolean;
@@ -0,0 +1,36 @@
1
+ import { Entity, Ids } from "../../schema/index";
2
+ import { Context, Effect, Layer, Schema } from "effect";
3
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ declare const EntityRepositoryError_base: Schema.Class<EntityRepositoryError, Schema.TaggedStruct<"EntityRepositoryError", {
5
+ readonly message: Schema.String;
6
+ }>, import("effect/Cause").YieldableError>;
7
+ export declare class EntityRepositoryError extends EntityRepositoryError_base {
8
+ }
9
+ export interface CreateInstanceInput {
10
+ readonly kind: Ids.EntityKindName;
11
+ readonly key: Ids.EntityKey;
12
+ readonly addressId: Ids.AddressId;
13
+ readonly executionId: (generation: number) => Ids.ExecutionId;
14
+ readonly createdAt: number;
15
+ }
16
+ export interface Interface {
17
+ readonly putKind: (definition: Entity.KindDefinition) => Effect.Effect<Entity.KindDefinition, EntityRepositoryError>;
18
+ readonly getKind: (kind: Ids.EntityKindName) => Effect.Effect<Entity.KindDefinition | undefined, EntityRepositoryError>;
19
+ readonly listKinds: () => Effect.Effect<ReadonlyArray<Entity.KindDefinition>, EntityRepositoryError>;
20
+ readonly getOrCreate: (input: CreateInstanceInput) => Effect.Effect<Entity.Instance, EntityRepositoryError>;
21
+ readonly get: (kind: Ids.EntityKindName, key: Ids.EntityKey) => Effect.Effect<Entity.Instance | undefined, EntityRepositoryError>;
22
+ readonly destroy: (kind: Ids.EntityKindName, key: Ids.EntityKey, destroyedAt: number) => Effect.Effect<Entity.Instance | undefined, EntityRepositoryError>;
23
+ readonly list: (input: {
24
+ readonly kind?: Ids.EntityKindName;
25
+ readonly afterKind?: Ids.EntityKindName;
26
+ readonly afterKey?: string;
27
+ readonly limit?: number;
28
+ }) => Effect.Effect<ReadonlyArray<Entity.Instance>, EntityRepositoryError>;
29
+ }
30
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/EntityRepository", Interface>;
31
+ export declare class Service extends Service_base {
32
+ }
33
+ export declare const layer: Layer.Layer<Service, never, SqlClient>;
34
+ export declare const memoryLayer: Layer.Layer<Service, never, never>;
35
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
36
+ export {};
@@ -135,6 +135,7 @@ export interface Interface {
135
135
  readonly acceptEnvelope: (input: AcceptEnvelopeInput) => Effect.Effect<Envelope.EnvelopeAccepted, EnvelopeRepositoryError>;
136
136
  readonly getEnvelope: (id: Ids.EnvelopeId) => Effect.Effect<Envelope.Envelope | undefined, EnvelopeRepositoryError>;
137
137
  readonly getWait: (id: Ids.WaitId) => Effect.Effect<WaitRecord | undefined, EnvelopeRepositoryError>;
138
+ readonly findOpenByCorrelation?: (executionId: Ids.ExecutionId, correlationKey: string) => Effect.Effect<WaitRecord | undefined, EnvelopeRepositoryError>;
138
139
  readonly createWait: (input: CreateWaitInput) => Effect.Effect<WaitRecord, EnvelopeRepositoryError>;
139
140
  readonly listWaits: (input: ListWaitsInput) => Effect.Effect<ReadonlyArray<WaitRecord>, EnvelopeRepositoryError>;
140
141
  readonly listAllWaits: (input: ListAllWaitsInput) => Effect.Effect<ReadonlyArray<WaitRecord>, EnvelopeRepositoryError>;
@@ -1,7 +1,7 @@
1
1
  import { Execution, Ids } from "../../schema/index";
2
2
  import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
3
3
  import { SqlClient } from "effect/unstable/sql/SqlClient";
4
- import { Service as NotificationBusService } from "../database/notification-bus";
4
+ import { Service as NotificationBusService, type Transport } from "../database/notification-bus";
5
5
  export declare const executionEventsChannel = "relay_execution_events";
6
6
  declare const DuplicateExecutionEvent_base: Schema.Class<DuplicateExecutionEvent, Schema.TaggedStruct<"DuplicateExecutionEvent", {
7
7
  readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
@@ -63,6 +63,7 @@ export interface ListAfterSequenceInput {
63
63
  readonly limit: number;
64
64
  }
65
65
  export interface Interface {
66
+ readonly signalTransport: Transport;
66
67
  readonly append: (input: Execution.ExecutionEvent) => Effect.Effect<Execution.ExecutionEvent, DuplicateExecutionEvent | ExecutionEventOrderViolation | ExecutionEventRepositoryError>;
67
68
  readonly list: (input: ListInput) => Effect.Effect<ReadonlyArray<Execution.ExecutionEvent>, ExecutionEventCursorNotFound | ExecutionEventRepositoryError>;
68
69
  readonly findBySequenceOrCursor: (input: FindBySequenceOrCursorInput) => Effect.Effect<Option.Option<Execution.ExecutionEvent>, ExecutionEventRepositoryError>;
@@ -1,6 +1,7 @@
1
1
  import { Agent, Execution, Ids, Shared } from "../../schema/index";
2
- import { Context, Effect, Layer, Schema } from "effect";
2
+ import { Context, Effect, Layer, Schema, Stream } from "effect";
3
3
  import { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ import { Service as NotificationBusService } from "../database/notification-bus";
4
5
  declare const ExecutionRepositoryError_base: Schema.Class<ExecutionRepositoryError, Schema.TaggedStruct<"ExecutionRepositoryError", {
5
6
  readonly message: Schema.String;
6
7
  }>, import("effect/Cause").YieldableError>;
@@ -66,11 +67,19 @@ export interface ListExecutionsResult {
66
67
  readonly records: ReadonlyArray<ExecutionRecord>;
67
68
  readonly nextCursor?: ExecutionCursor;
68
69
  }
70
+ export declare const executionsChangedChannel = "relay_executions_changed";
71
+ export interface ListChangedSinceInput {
72
+ readonly updatedAtAfter: number;
73
+ readonly limit?: number;
74
+ }
69
75
  export interface Interface {
70
76
  readonly create: (input: CreateExecutionInput) => Effect.Effect<ExecutionRecord, DuplicateExecution | ExecutionRepositoryError>;
71
77
  readonly get: (id: Ids.ExecutionId) => Effect.Effect<ExecutionRecord | undefined, ExecutionRepositoryError>;
72
78
  readonly list: (input: ListExecutionsInput) => Effect.Effect<ListExecutionsResult, ExecutionRepositoryError>;
73
79
  readonly transition: (input: TransitionExecutionInput) => Effect.Effect<ExecutionRecord, ExecutionNotFound | ExecutionRepositoryError>;
80
+ readonly notifyChanged: (record: ExecutionRecord) => Effect.Effect<void, ExecutionRepositoryError>;
81
+ readonly changedSignals: () => Stream.Stream<Ids.ExecutionId, ExecutionRepositoryError>;
82
+ readonly listChangedSince: (input: ListChangedSinceInput) => Effect.Effect<ReadonlyArray<ExecutionRecord>, ExecutionRepositoryError>;
74
83
  }
75
84
  declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/ExecutionRepository", Interface>;
76
85
  export declare class Service extends Service_base {
@@ -88,9 +97,10 @@ export declare const ExecutionRow: Schema.Struct<{
88
97
  readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Number]>;
89
98
  readonly updated_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Number]>;
90
99
  }>;
100
+ export declare const layerWithoutBus: Layer.Layer<Service, never, SqlClient | NotificationBusService>;
91
101
  export declare const layer: Layer.Layer<Service, never, SqlClient>;
92
102
  export declare const memoryLayer: Layer.Layer<Service, never, never>;
93
- export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
103
+ export declare const testLayer: (implementation: Omit<Interface, "notifyChanged" | "changedSignals" | "listChangedSince"> & Partial<Pick<Interface, "notifyChanged" | "changedSignals" | "listChangedSince">>) => Layer.Layer<Service, never, never>;
94
104
  export declare const create: (input: CreateExecutionInput) => Effect.Effect<ExecutionRecord, ExecutionRepositoryError | DuplicateExecution, Service>;
95
105
  export declare const get: (id: string & import("effect/Brand").Brand<"Relay.ExecutionId">) => Effect.Effect<ExecutionRecord | undefined, ExecutionRepositoryError, Service>;
96
106
  export declare const list: (input: ListExecutionsInput) => Effect.Effect<ListExecutionsResult, ExecutionRepositoryError, Service>;
@@ -0,0 +1,56 @@
1
+ import { Ids, Inbox, Shared } from "../../schema/index";
2
+ import { Context, Effect, Layer, Schema } from "effect";
3
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ import type { AcceptEnvelopeInput } from "../envelope/envelope-repository";
5
+ declare const InboxRepositoryError_base: Schema.Class<InboxRepositoryError, Schema.TaggedStruct<"InboxRepositoryError", {
6
+ readonly message: Schema.String;
7
+ }>, import("effect/Cause").YieldableError>;
8
+ export declare class InboxRepositoryError extends InboxRepositoryError_base {
9
+ }
10
+ export interface DeliverInput {
11
+ readonly acceptance?: AcceptEnvelopeInput;
12
+ readonly executionId: Ids.ExecutionId;
13
+ readonly from: Ids.AddressId;
14
+ readonly envelopeId?: Ids.EnvelopeId;
15
+ readonly content: Inbox.Message["content"];
16
+ readonly replyWaitId?: Ids.WaitId;
17
+ readonly correlationKey?: string;
18
+ readonly idempotencyKey?: string;
19
+ readonly metadata?: Shared.Metadata;
20
+ readonly createdAt: number;
21
+ }
22
+ export interface DeliverResult {
23
+ readonly message: Inbox.Message;
24
+ readonly deduplicated: boolean;
25
+ readonly eventSequence?: number;
26
+ }
27
+ export interface DrainInput {
28
+ readonly executionId: Ids.ExecutionId;
29
+ readonly drainId: string;
30
+ readonly maxBatch?: number;
31
+ readonly consumedAt: number;
32
+ readonly createdAt: number;
33
+ }
34
+ export interface ListInput {
35
+ readonly executionId: Ids.ExecutionId;
36
+ readonly includeConsumed?: boolean;
37
+ readonly afterSequence?: number;
38
+ readonly limit?: number;
39
+ }
40
+ export interface Interface {
41
+ readonly deliver: (input: DeliverInput) => Effect.Effect<DeliverResult, InboxRepositoryError>;
42
+ readonly drain: (input: DrainInput) => Effect.Effect<ReadonlyArray<Inbox.Message>, InboxRepositoryError>;
43
+ readonly countUndrained: (executionId: Ids.ExecutionId) => Effect.Effect<number, InboxRepositoryError>;
44
+ readonly list: (input: ListInput) => Effect.Effect<ReadonlyArray<Inbox.Message>, InboxRepositoryError>;
45
+ }
46
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/InboxRepository", Interface>;
47
+ export declare class Service extends Service_base {
48
+ }
49
+ export declare const layer: Layer.Layer<Service, never, SqlClient>;
50
+ export declare const memoryLayer: Layer.Layer<Service, never, never>;
51
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
52
+ export declare const deliver: (input: DeliverInput) => Effect.Effect<DeliverResult, InboxRepositoryError, Service>;
53
+ export declare const drain: (input: DrainInput) => Effect.Effect<readonly Inbox.Message[], InboxRepositoryError, Service>;
54
+ export declare const countUndrained: (id: Ids.ExecutionId) => Effect.Effect<number, InboxRepositoryError, Service>;
55
+ export declare const list: (input: ListInput) => Effect.Effect<readonly Inbox.Message[], InboxRepositoryError, Service>;
56
+ export {};
@@ -5,13 +5,19 @@ export * as ChildExecutionRepository from "./child/child-execution-repository";
5
5
  export * as ClusterRegistryRepository from "./cluster/cluster-registry-repository";
6
6
  export * as CompactionRepository from "./compaction/compaction-repository";
7
7
  export * as Database from "./database/database-service";
8
+ export * as SqlDialect from "./database/sql-dialect";
8
9
  export * as EnvelopeRepository from "./envelope/envelope-repository";
10
+ export * as EntityRepository from "./entity/entity-repository";
9
11
  export * as ExecutionEventRepository from "./execution/execution-event-repository";
10
12
  export * as ExecutionRepository from "./execution/execution-repository";
13
+ export * as ExecutionStateRepository from "./state/execution-state-repository";
11
14
  export * as IdempotencyRepository from "./idempotency/idempotency-repository";
15
+ export * as InboxRepository from "./inbox/inbox-repository";
16
+ export * as TopicRepository from "./topic/topic-repository";
12
17
  export * as MemoryRepository from "./memory/memory-repository";
13
18
  export * as NotificationBus from "./database/notification-bus";
14
19
  export * as PermissionRuleRepository from "./permission/permission-rule-repository";
20
+ export * as PresenceRepository from "./presence/presence-repository";
15
21
  export * as ContextEpochRepository from "./session/context-epoch-repository";
16
22
  export * as RelaySchema from "./schema/relay-schema";
17
23
  export * as ScheduleRepository from "./schedule/schedule-repository";
@@ -0,0 +1,27 @@
1
+ export * as AddressBookRepository from "./address/address-book-repository";
2
+ export * as AgentChatRepository from "./chat/agent-chat-repository";
3
+ export * as AgentDefinitionRepository from "./agent/agent-definition-repository";
4
+ export * as ChildExecutionRepository from "./child/child-execution-repository";
5
+ export * as ClusterRegistryRepository from "./cluster/cluster-registry-repository";
6
+ export * as CompactionRepository from "./compaction/compaction-repository";
7
+ export * as ContextEpochRepository from "./session/context-epoch-repository";
8
+ export * as EnvelopeRepository from "./envelope/envelope-repository";
9
+ export * as EntityRepository from "./entity/entity-repository";
10
+ export * as ExecutionEventRepository from "./execution/execution-event-repository";
11
+ export * as ExecutionRepository from "./execution/execution-repository";
12
+ export * as ExecutionStateRepository from "./state/execution-state-repository";
13
+ export * as IdempotencyRepository from "./idempotency/idempotency-repository";
14
+ export * as InboxRepository from "./inbox/inbox-repository";
15
+ export * as TopicRepository from "./topic/topic-repository";
16
+ export * as MemoryRepository from "./memory/memory-repository";
17
+ export * as NotificationBus from "./database/notification-bus";
18
+ export * as PermissionRuleRepository from "./permission/permission-rule-repository";
19
+ export * as PresenceRepository from "./presence/presence-repository";
20
+ export * as ScheduleRepository from "./schedule/schedule-repository";
21
+ export * as SessionRepository from "./session/session-repository";
22
+ export * as SkillDefinitionRepository from "./skill/skill-definition-repository";
23
+ export * as SqlDialect from "./database/sql-dialect";
24
+ export * as SteeringRepository from "./steering/steering-repository";
25
+ export * as TenantId from "./tenant/tenant-id";
26
+ export * as ToolCallRepository from "./tool/tool-call-repository";
27
+ export * as WorkspaceLeaseRepository from "./workspace/workspace-lease-repository";