@relayfx/sdk 0.7.10 → 0.7.12

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 (71) hide show
  1. package/dist/http-server.js +1 -1
  2. package/dist/{index-m7dpw880.js → index-agr4t5nk.js} +1 -1
  3. package/dist/{index-gwgea1te.js → index-chbsjf5d.js} +4123 -3788
  4. package/dist/{index-nb078xsy.js → index-j8k41y47.js} +26 -4
  5. package/dist/index.js +2 -2
  6. package/dist/migrations/20260723190000_transactional_event_head/migration.sql +22 -0
  7. package/dist/migrations/20260724010000_execution_event_archive_manifests/migration.sql +66 -0
  8. package/dist/migrations/20260724120000_execution_event_identity_directory/migration.sql +15 -0
  9. package/dist/migrations/20260724230000_idempotent_steering/migration.sql +7 -0
  10. package/dist/migrations/mysql/0015_transactional_event_head.sql +32 -0
  11. package/dist/migrations/mysql/0016_execution_event_archive_manifests.sql +65 -0
  12. package/dist/migrations/mysql/0017_execution_event_identity_directory.sql +20 -0
  13. package/dist/migrations/mysql/0018_idempotent_steering.sql +7 -0
  14. package/dist/migrations/pg/20260723190000_transactional_event_head/migration.sql +22 -0
  15. package/dist/migrations/pg/20260724010000_execution_event_archive_manifests/migration.sql +66 -0
  16. package/dist/migrations/pg/20260724120000_execution_event_identity_directory/migration.sql +15 -0
  17. package/dist/migrations/pg/20260724230000_idempotent_steering/migration.sql +7 -0
  18. package/dist/migrations/sqlite/0015_transactional_event_head.sql +22 -0
  19. package/dist/migrations/sqlite/0016_execution_event_archive_manifests.sql +45 -0
  20. package/dist/migrations/sqlite/0017_execution_event_identity_directory.sql +13 -0
  21. package/dist/migrations/sqlite/0018_idempotent_steering.sql +5 -0
  22. package/dist/mysql.js +49 -8
  23. package/dist/postgres.js +135 -13
  24. package/dist/sqlite.js +115 -4
  25. package/dist/types/relay/client-public-executions.d.ts +1 -1
  26. package/dist/types/relay/client-public.d.ts +2 -2
  27. package/dist/types/relay/http-server.d.ts +2 -2
  28. package/dist/types/relay/mysql-migrations.d.ts +1 -1
  29. package/dist/types/relay/operation.d.ts +9 -0
  30. package/dist/types/relay/sqlite-migrations.d.ts +21 -1
  31. package/dist/types/runtime/agent/agent-loop-events.d.ts +10 -9
  32. package/dist/types/runtime/agent/agent-loop-service.d.ts +1 -0
  33. package/dist/types/runtime/agent/emission-ordinal-allocator.d.ts +7 -0
  34. package/dist/types/runtime/agent/relay-permissions.d.ts +4 -7
  35. package/dist/types/runtime/agent/relay-steering.d.ts +5 -5
  36. package/dist/types/runtime/agent/relay-tool-executor.d.ts +3 -2
  37. package/dist/types/runtime/envelope/envelope-service.d.ts +2 -1
  38. package/dist/types/runtime/execution/event-log-service.d.ts +5 -4
  39. package/dist/types/runtime/execution/execution-service.d.ts +1 -1
  40. package/dist/types/runtime/inbox/inbox-service.d.ts +6 -6
  41. package/dist/types/runtime/schedule/scheduler-service.d.ts +3 -4
  42. package/dist/types/runtime/state/execution-state-service.d.ts +2 -2
  43. package/dist/types/runtime/tool/tool-runtime-contract.d.ts +2 -0
  44. package/dist/types/runtime/tool/tool-runtime-identifiers.d.ts +6 -0
  45. package/dist/types/runtime/wait/wait-service.d.ts +5 -5
  46. package/dist/types/runtime/workflow/execution-workflow.d.ts +2 -3
  47. package/dist/types/runtime/workspace/workspace-planner-service.d.ts +2 -0
  48. package/dist/types/schema/workflow-schema.d.ts +1 -0
  49. package/dist/types/store-sql/execution/archive-compression.d.ts +11 -0
  50. package/dist/types/store-sql/execution/event-history-file-system.d.ts +7 -0
  51. package/dist/types/store-sql/execution/event-history-store.d.ts +93 -0
  52. package/dist/types/store-sql/execution/execution-event-archive-codec.d.ts +69 -0
  53. package/dist/types/store-sql/execution/execution-event-archive-repository-memory.d.ts +28 -0
  54. package/dist/types/store-sql/execution/execution-event-archive-repository-sql.d.ts +19 -0
  55. package/dist/types/store-sql/execution/execution-event-archive-repository.d.ts +175 -0
  56. package/dist/types/store-sql/execution/execution-event-head-memory.d.ts +13 -0
  57. package/dist/types/store-sql/execution/execution-event-head.d.ts +40 -0
  58. package/dist/types/store-sql/execution/execution-event-identity-directory.d.ts +26 -0
  59. package/dist/types/store-sql/execution/execution-event-repository-archive-aware.d.ts +7 -0
  60. package/dist/types/store-sql/execution/execution-event-repository-memory.d.ts +6 -1
  61. package/dist/types/store-sql/execution/execution-event-repository.d.ts +6 -4
  62. package/dist/types/store-sql/inbox/inbox-repository.d.ts +6 -2
  63. package/dist/types/store-sql/schema/communication-schema.d.ts +15 -0
  64. package/dist/types/store-sql/schema/execution-schema.d.ts +583 -0
  65. package/dist/types/store-sql/schema/relay-schema.d.ts +1 -1
  66. package/dist/types/store-sql/state/execution-state-repository.d.ts +2 -1
  67. package/dist/types/store-sql/steering/steering-model.d.ts +60 -0
  68. package/dist/types/store-sql/steering/steering-repository.d.ts +5 -50
  69. package/package.json +3 -3
  70. package/dist/types/relay/client-event-sequence.d.ts +0 -3
  71. package/dist/types/runtime/agent/sequence-allocator.d.ts +0 -9
@@ -0,0 +1,175 @@
1
+ import { Ids } from "../../schema/index";
2
+ import { Context, Effect, Layer, Schema } from "effect";
3
+ import { Service as EventHistoryStore } from "./event-history-store";
4
+ import { makeMemoryLayer } from "./execution-event-archive-repository-memory";
5
+ export declare const ArchiveBlockDescriptor: Schema.Struct<{
6
+ readonly firstSequence: Schema.Int;
7
+ readonly lastSequence: Schema.Int;
8
+ readonly eventCount: Schema.Int;
9
+ readonly object: Schema.Struct<{
10
+ readonly key: Schema.String;
11
+ readonly checksum: Schema.String;
12
+ readonly size: Schema.Int;
13
+ }>;
14
+ readonly codecVersion: Schema.Literals<readonly [1, 2]>;
15
+ readonly encoding: Schema.Literal<"json">;
16
+ readonly compression: Schema.Literals<readonly ["none", "gzip"]>;
17
+ readonly payloadChecksum: Schema.String;
18
+ readonly storedPayloadBytes: Schema.Int;
19
+ readonly uncompressedBytes: Schema.Int;
20
+ }>;
21
+ export interface ArchiveBlockDescriptor extends Schema.Schema.Type<typeof ArchiveBlockDescriptor> {
22
+ }
23
+ export declare const PublicationInput: Schema.Struct<{
24
+ readonly executionId: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
25
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
26
+ };
27
+ readonly generation: Schema.Int;
28
+ readonly archivedThrough: Schema.Int;
29
+ readonly eventCount: Schema.Int;
30
+ readonly maxSequence: Schema.Int;
31
+ readonly usageTokens: Schema.Int;
32
+ readonly schemaVersion: Schema.Literal<1>;
33
+ readonly blocks: Schema.$Array<Schema.Struct<{
34
+ readonly firstSequence: Schema.Int;
35
+ readonly lastSequence: Schema.Int;
36
+ readonly eventCount: Schema.Int;
37
+ readonly object: Schema.Struct<{
38
+ readonly key: Schema.String;
39
+ readonly checksum: Schema.String;
40
+ readonly size: Schema.Int;
41
+ }>;
42
+ readonly codecVersion: Schema.Literals<readonly [1, 2]>;
43
+ readonly encoding: Schema.Literal<"json">;
44
+ readonly compression: Schema.Literals<readonly ["none", "gzip"]>;
45
+ readonly payloadChecksum: Schema.String;
46
+ readonly storedPayloadBytes: Schema.Int;
47
+ readonly uncompressedBytes: Schema.Int;
48
+ }>>;
49
+ }>;
50
+ export interface PublicationInput extends Schema.Schema.Type<typeof PublicationInput> {
51
+ }
52
+ export declare const Manifest: Schema.Struct<{
53
+ readonly executionId: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
54
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
55
+ };
56
+ readonly generation: Schema.Int;
57
+ readonly archivedThrough: Schema.Int;
58
+ readonly eventCount: Schema.Int;
59
+ readonly maxSequence: Schema.Int;
60
+ readonly usageTokens: Schema.Int;
61
+ readonly schemaVersion: Schema.Literal<1>;
62
+ readonly blocks: Schema.$Array<Schema.Struct<{
63
+ readonly firstSequence: Schema.Int;
64
+ readonly lastSequence: Schema.Int;
65
+ readonly eventCount: Schema.Int;
66
+ readonly object: Schema.Struct<{
67
+ readonly key: Schema.String;
68
+ readonly checksum: Schema.String;
69
+ readonly size: Schema.Int;
70
+ }>;
71
+ readonly codecVersion: Schema.Literals<readonly [1, 2]>;
72
+ readonly encoding: Schema.Literal<"json">;
73
+ readonly compression: Schema.Literals<readonly ["none", "gzip"]>;
74
+ readonly payloadChecksum: Schema.String;
75
+ readonly storedPayloadBytes: Schema.Int;
76
+ readonly uncompressedBytes: Schema.Int;
77
+ }>>;
78
+ readonly tenantId: Schema.brand<Schema.String, "Relay.TenantId"> & {
79
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.TenantId">;
80
+ };
81
+ }>;
82
+ export interface Manifest extends Schema.Schema.Type<typeof Manifest> {
83
+ }
84
+ declare const ArchiveManifestInvalid_base: Schema.Class<ArchiveManifestInvalid, Schema.TaggedStruct<"ArchiveManifestInvalid", {
85
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
86
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
87
+ };
88
+ readonly generation: Schema.Int;
89
+ readonly reason: Schema.Literals<readonly ["invalid-schema", "invalid-bounds", "invalid-block-order", "invalid-block-count", "invalid-object-size", "prefix-mismatch", "exceeds-head"]>;
90
+ readonly message: Schema.String;
91
+ }>, import("effect/Cause").YieldableError>;
92
+ export declare class ArchiveManifestInvalid extends ArchiveManifestInvalid_base {
93
+ }
94
+ declare const ArchiveGenerationConflict_base: Schema.Class<ArchiveGenerationConflict, Schema.TaggedStruct<"ArchiveGenerationConflict", {
95
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
96
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
97
+ };
98
+ readonly generation: Schema.Int;
99
+ }>, import("effect/Cause").YieldableError>;
100
+ export declare class ArchiveGenerationConflict extends ArchiveGenerationConflict_base {
101
+ }
102
+ declare const ArchivePublicationStale_base: Schema.Class<ArchivePublicationStale, Schema.TaggedStruct<"ArchivePublicationStale", {
103
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
104
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
105
+ };
106
+ readonly generation: Schema.Int;
107
+ readonly current_generation: Schema.Int;
108
+ readonly current_archived_through: Schema.Int;
109
+ }>, import("effect/Cause").YieldableError>;
110
+ export declare class ArchivePublicationStale extends ArchivePublicationStale_base {
111
+ }
112
+ declare const ArchiveHeadNotFound_base: Schema.Class<ArchiveHeadNotFound, Schema.TaggedStruct<"ArchiveHeadNotFound", {
113
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
114
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
115
+ };
116
+ }>, import("effect/Cause").YieldableError>;
117
+ export declare class ArchiveHeadNotFound extends ArchiveHeadNotFound_base {
118
+ }
119
+ declare const ArchiveRepositoryError_base: Schema.Class<ArchiveRepositoryError, Schema.TaggedStruct<"ArchiveRepositoryError", {
120
+ readonly message: Schema.String;
121
+ }>, import("effect/Cause").YieldableError>;
122
+ export declare class ArchiveRepositoryError extends ArchiveRepositoryError_base {
123
+ }
124
+ declare const ArchiveIntegrityError_base: Schema.Class<ArchiveIntegrityError, Schema.TaggedStruct<"ArchiveIntegrityError", {
125
+ readonly execution_id: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
126
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
127
+ };
128
+ readonly message: Schema.String;
129
+ }>, import("effect/Cause").YieldableError>;
130
+ export declare class ArchiveIntegrityError extends ArchiveIntegrityError_base {
131
+ }
132
+ export type PublicationFailure = ArchiveManifestInvalid | ArchiveGenerationConflict | ArchivePublicationStale | ArchiveHeadNotFound | ArchiveIntegrityError | ArchiveRepositoryError;
133
+ export interface Interface {
134
+ readonly publish: (input: PublicationInput) => Effect.Effect<Manifest, PublicationFailure>;
135
+ readonly getCurrent: (executionId: Ids.ExecutionId) => Effect.Effect<Manifest | undefined, ArchiveRepositoryError | ArchiveIntegrityError>;
136
+ readonly getGeneration: (executionId: Ids.ExecutionId, generation: number) => Effect.Effect<Manifest | undefined, ArchiveRepositoryError | ArchiveIntegrityError>;
137
+ }
138
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/execution/execution-event-archive-repository/Service", Interface>;
139
+ export declare class Service extends Service_base {
140
+ }
141
+ export declare const validatePublication: (candidate: PublicationInput) => Effect.Effect<Schema.Struct.ReadonlySide<{
142
+ readonly executionId: Schema.brand<Schema.String, "Relay.ExecutionId"> & {
143
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ExecutionId">;
144
+ };
145
+ readonly generation: Schema.Int;
146
+ readonly archivedThrough: Schema.Int;
147
+ readonly eventCount: Schema.Int;
148
+ readonly maxSequence: Schema.Int;
149
+ readonly usageTokens: Schema.Int;
150
+ readonly schemaVersion: Schema.Literal<1>;
151
+ readonly blocks: Schema.$Array<Schema.Struct<{
152
+ readonly firstSequence: Schema.Int;
153
+ readonly lastSequence: Schema.Int;
154
+ readonly eventCount: Schema.Int;
155
+ readonly object: Schema.Struct<{
156
+ readonly key: Schema.String;
157
+ readonly checksum: Schema.String;
158
+ readonly size: Schema.Int;
159
+ }>;
160
+ readonly codecVersion: Schema.Literals<readonly [1, 2]>;
161
+ readonly encoding: Schema.Literal<"json">;
162
+ readonly compression: Schema.Literals<readonly ["none", "gzip"]>;
163
+ readonly payloadChecksum: Schema.String;
164
+ readonly storedPayloadBytes: Schema.Int;
165
+ readonly uncompressedBytes: Schema.Int;
166
+ }>>;
167
+ }, "Type">, ArchiveManifestInvalid, never>;
168
+ export declare const layer: Layer.Layer<Service, never, import("effect/Crypto").Crypto | EventHistoryStore | import("effect/unstable/sql/SqlClient").SqlClient>;
169
+ export declare const memoryLayer: Layer.Layer<Service, never, import("effect/Crypto").Crypto | import("./execution-event-head-memory").Service | import("./execution-event-repository").Service | EventHistoryStore>;
170
+ export declare const memoryLayerWithRestoredState: (restored: Parameters<typeof makeMemoryLayer>[1]) => Layer.Layer<Service, never, import("effect/Crypto").Crypto | import("./execution-event-head-memory").Service | import("./execution-event-repository").Service | EventHistoryStore>;
171
+ export declare const testLayer: (implementation: Interface) => Layer.Layer<Service>;
172
+ export declare const publish: (input: PublicationInput) => Effect.Effect<Manifest, PublicationFailure, Service>;
173
+ export declare const getCurrent: (executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">) => Effect.Effect<Manifest | undefined, ArchiveIntegrityError | ArchiveRepositoryError, Service>;
174
+ export declare const getGeneration: (executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">, generation: number) => Effect.Effect<Manifest | undefined, ArchiveIntegrityError | ArchiveRepositoryError, Service>;
175
+ export {};
@@ -0,0 +1,13 @@
1
+ import { Ids } from "../../schema/index";
2
+ import { Context, Effect, Layer } from "effect";
3
+ type TransactionAction = Effect.Effect<void, never>;
4
+ export interface Interface {
5
+ readonly transaction: <A, E, R>(executionId: Ids.ExecutionId, effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
6
+ readonly registerRollback: (action: TransactionAction) => Effect.Effect<void>;
7
+ readonly registerAfterCommit: (action: TransactionAction) => Effect.Effect<void>;
8
+ }
9
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/execution/execution-event-head-memory/Service", Interface>;
10
+ export declare class Service extends Service_base {
11
+ }
12
+ export declare const layer: Layer.Layer<Service, never, never>;
13
+ export {};
@@ -0,0 +1,40 @@
1
+ import { Execution, Ids } from "../../schema/index";
2
+ import { Effect, Schema } from "effect";
3
+ import type { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ declare const ExecutionEventHeadError_base: Schema.Class<ExecutionEventHeadError, Schema.TaggedStruct<"ExecutionEventHeadError", {
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 reason: Schema.Literals<readonly ["not-found", "integrity"]>;
9
+ readonly message: Schema.String;
10
+ }>, import("effect/Cause").YieldableError>;
11
+ export declare class ExecutionEventHeadError extends ExecutionEventHeadError_base {
12
+ }
13
+ export interface LockedHead {
14
+ readonly nextSequence: number;
15
+ readonly maxSequence: number | undefined;
16
+ readonly eventCount: number;
17
+ readonly usageTokens: number;
18
+ readonly archivedThrough: number | undefined;
19
+ readonly archiveGeneration: number | undefined;
20
+ }
21
+ export interface HeadResult<A> {
22
+ readonly value: A;
23
+ readonly appended: boolean;
24
+ }
25
+ declare const withLockedHead: <A, E, R>(sql: SqlClient, input: {
26
+ readonly tenantId: Ids.TenantId;
27
+ readonly executionId: Ids.ExecutionId;
28
+ readonly use: (head: LockedHead) => Effect.Effect<A, E, R>;
29
+ }) => Effect.Effect<A, E | ExecutionEventHeadError | import("effect/unstable/sql/SqlError").SqlError, R>;
30
+ declare const withEventHead: <A, E, R>(sql: SqlClient, input: {
31
+ readonly tenantId: Ids.TenantId;
32
+ readonly executionId: Ids.ExecutionId;
33
+ readonly usageTokens: number;
34
+ readonly use: (sequence: Execution.ExecutionEventSequence) => Effect.Effect<HeadResult<A>, E, R>;
35
+ }) => Effect.Effect<A, E | ExecutionEventHeadError | import("effect/unstable/sql/SqlError").SqlError, R>;
36
+ export declare const ExecutionEventHead: {
37
+ withEventHead: typeof withEventHead;
38
+ withLockedHead: typeof withLockedHead;
39
+ };
40
+ export {};
@@ -0,0 +1,26 @@
1
+ import { Execution, Ids } from "../../schema/index";
2
+ import { Context, Effect, Layer, Schema } from "effect";
3
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ export interface EventIdentity {
5
+ readonly cursor: string;
6
+ readonly eventId: Ids.EventId;
7
+ readonly executionId: Ids.ExecutionId;
8
+ readonly sequence: Execution.ExecutionEventSequence;
9
+ }
10
+ declare const EventIdentityDirectoryError_base: Schema.Class<EventIdentityDirectoryError, Schema.TaggedStruct<"EventIdentityDirectoryError", {
11
+ readonly message: Schema.String;
12
+ }>, import("effect/Cause").YieldableError>;
13
+ export declare class EventIdentityDirectoryError extends EventIdentityDirectoryError_base {
14
+ }
15
+ export interface Interface {
16
+ readonly findByCursor: (cursor: string) => Effect.Effect<EventIdentity | undefined, EventIdentityDirectoryError>;
17
+ readonly findByEventId: (eventId: Ids.EventId) => Effect.Effect<EventIdentity | undefined, EventIdentityDirectoryError>;
18
+ readonly findBySequence: (executionId: Ids.ExecutionId, sequence: Execution.ExecutionEventSequence) => Effect.Effect<EventIdentity | undefined, EventIdentityDirectoryError>;
19
+ readonly listRange: (executionId: Ids.ExecutionId, firstSequence: Execution.ExecutionEventSequence, lastSequence: Execution.ExecutionEventSequence) => Effect.Effect<ReadonlyArray<EventIdentity>, EventIdentityDirectoryError>;
20
+ }
21
+ declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/execution/execution-event-identity-directory/Service", Interface>;
22
+ export declare class Service extends Service_base {
23
+ }
24
+ export declare const layer: Layer.Layer<Service, never, SqlClient>;
25
+ export declare const testLayer: (identities: ReadonlyArray<EventIdentity>) => Layer.Layer<Service>;
26
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Crypto, Layer } from "effect";
2
+ import { Service as ArchiveRepository } from "./execution-event-archive-repository";
3
+ import { Service as HistoryStore } from "./event-history-store";
4
+ import { Service as IdentityDirectory } from "./execution-event-identity-directory";
5
+ import { Service, type Interface } from "./execution-event-repository";
6
+ /** Package-private composition seam. Public runtime wiring remains SQL-only until the configuration slice. */
7
+ export declare const layerForHotRepository: (hot: Interface) => Layer.Layer<Service, never, ArchiveRepository | HistoryStore | IdentityDirectory | Crypto.Crypto>;
@@ -1,8 +1,13 @@
1
1
  import { Layer } from "effect";
2
+ import { Service as MemoryEventHeadService } from "./execution-event-head-memory";
2
3
  import type { DuplicateExecutionEvent, ExecutionEventCursorNotFound, ExecutionEventOrderViolation, Service } from "./execution-event-repository";
3
4
  export declare const makeMemoryLayer: (repository: {
4
5
  readonly DuplicateExecutionEvent: typeof DuplicateExecutionEvent;
5
6
  readonly ExecutionEventOrderViolation: typeof ExecutionEventOrderViolation;
6
7
  readonly ExecutionEventCursorNotFound: typeof ExecutionEventCursorNotFound;
7
8
  readonly Service: typeof Service;
8
- }) => Layer.Layer<Service, never, never>;
9
+ }) => {
10
+ layer: Layer.Layer<MemoryEventHeadService | Service, never, never>;
11
+ layerWithoutEventHead: Layer.Layer<Service, never, MemoryEventHeadService>;
12
+ eventHeadLayer: Layer.Layer<MemoryEventHeadService, never, never>;
13
+ };
@@ -38,8 +38,8 @@ export interface ListInput {
38
38
  readonly afterCursor?: string;
39
39
  readonly limit?: number;
40
40
  }
41
- export interface AppendNextInput extends Omit<Execution.ExecutionEvent, "sequence"> {
42
- readonly minimumSequence?: Execution.ExecutionEventSequence;
41
+ export type ExecutionEventDraft = Omit<Execution.ExecutionEvent, "sequence">;
42
+ export interface AppendNextInput extends ExecutionEventDraft {
43
43
  }
44
44
  export interface AppendNextResult {
45
45
  readonly event: Execution.ExecutionEvent;
@@ -119,8 +119,10 @@ export declare const ExecutionEventRow: Schema.Struct<{
119
119
  }>;
120
120
  export declare const layer: Layer.Layer<Service, never, import("../database/notification-bus").Service | import("effect/unstable/sql/SqlClient").SqlClient>;
121
121
  export declare const layerWithBus: Layer.Layer<Service, never, import("effect/unstable/sql/SqlClient").SqlClient>;
122
- export declare const memoryLayer: Layer.Layer<Service, never, never>;
123
- export type TestImplementation = Omit<Interface, "appendNext" | "page"> & Partial<Pick<Interface, "appendNext" | "page">>;
122
+ export declare const memoryLayer: Layer.Layer<import("./execution-event-head-memory").Service | Service, never, never>;
123
+ export declare const memoryLayerWithoutEventHead: Layer.Layer<Service, never, import("./execution-event-head-memory").Service>;
124
+ export declare const memoryEventHeadLayer: Layer.Layer<import("./execution-event-head-memory").Service, never, never>;
125
+ export type TestImplementation = Omit<Interface, "page"> & Partial<Pick<Interface, "page">>;
124
126
  export declare const testLayer: (implementation: TestImplementation) => Layer.Layer<Service, never, never>;
125
127
  export declare const append: (input: Execution.ExecutionEvent) => Effect.Effect<Execution.ExecutionEvent, DuplicateExecutionEvent | ExecutionEventOrderViolation | ExecutionEventRepositoryError, Service>;
126
128
  export declare const appendNext: (input: AppendNextInput) => Effect.Effect<AppendNextResult, DuplicateExecutionEvent | ExecutionEventRepositoryError, Service>;
@@ -2,12 +2,16 @@ import { Ids, Inbox, Shared } from "../../schema/index";
2
2
  import { Context, Effect, Layer, Schema } from "effect";
3
3
  import { SqlClient } from "effect/unstable/sql/SqlClient";
4
4
  import type { AcceptEnvelopeInput } from "../envelope/envelope-repository";
5
+ import { Service as ExecutionEventRepositoryService } from "../execution/execution-event-repository";
6
+ import { Service as MemoryEventHeadService } from "../execution/execution-event-head-memory";
5
7
  declare const InboxRepositoryError_base: Schema.Class<InboxRepositoryError, Schema.TaggedStruct<"InboxRepositoryError", {
6
8
  readonly message: Schema.String;
7
9
  }>, import("effect/Cause").YieldableError>;
8
10
  export declare class InboxRepositoryError extends InboxRepositoryError_base {
9
11
  }
10
12
  export interface DeliverInput {
13
+ /** Stable coordinate for deliveries that have neither an envelope nor an idempotency key. */
14
+ readonly operationId?: string;
11
15
  readonly acceptance?: AcceptEnvelopeInput;
12
16
  readonly executionId: Ids.ExecutionId;
13
17
  readonly from: Ids.AddressId;
@@ -46,8 +50,8 @@ export interface Interface {
46
50
  declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/inbox/inbox-repository/Service", Interface>;
47
51
  export declare class Service extends Service_base {
48
52
  }
49
- export declare const layer: Layer.Layer<Service, never, SqlClient>;
50
- export declare const memoryLayer: Layer.Layer<Service, never, never>;
53
+ export declare const layer: Layer.Layer<Service, never, ExecutionEventRepositoryService | SqlClient>;
54
+ export declare const memoryLayer: Layer.Layer<Service, never, MemoryEventHeadService>;
51
55
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
52
56
  export declare const deliver: (input: DeliverInput) => Effect.Effect<DeliverResult, InboxRepositoryError, Service>;
53
57
  export declare const drain: (input: DrainInput) => Effect.Effect<readonly Inbox.Message[], InboxRepositoryError, Service>;
@@ -33,6 +33,21 @@ export declare const relaySteeringMessages: import("drizzle-orm/pg-core").PgTabl
33
33
  identity: undefined;
34
34
  generated: undefined;
35
35
  }>;
36
+ idempotencyKey: import("drizzle-orm/pg-core").PgBuildColumn<"relay_steering_messages", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>>, {
37
+ name: string;
38
+ tableName: "relay_steering_messages";
39
+ dataType: "string";
40
+ data: string;
41
+ driverParam: string;
42
+ notNull: true;
43
+ hasDefault: false;
44
+ isPrimaryKey: false;
45
+ isAutoincrement: false;
46
+ hasRuntimeDefault: false;
47
+ enumValues: undefined;
48
+ identity: undefined;
49
+ generated: undefined;
50
+ }>;
36
51
  kind: import("drizzle-orm/pg-core").PgBuildColumn<"relay_steering_messages", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>>, {
37
52
  name: string;
38
53
  tableName: "relay_steering_messages";