@effect-agent/storage-sqlite 0.1.0-beta.38 → 0.1.0-beta.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,91 +1,18 @@
1
- import { ConversationStore, ConversationStoreError, ScheduleStore, SubmissionLedger } from "@effect-agent/session";
1
+ import { a as SqliteFenceRejected, c as SqliteStorageCorruptionError, d as SqliteStorageFailpointLocation, f as SqliteWriteContention, i as SqliteCheckpointConflict, l as SqliteStorageError, n as SqliteStorageFailpointHandler, o as SqliteLedgerError, r as SqliteAppendConflict, s as SqliteStorageCompatibilityError, t as SqliteStorageFailpoint, u as SqliteStorageFailpointError } from "./sqlite-storage-failpoint-Cr0SXflP.mjs";
2
+ import { ActivityMutationFailpoint, ActivityMutationFailure, ActivityProcessorStore, ActivityStoreError, ScheduleStore, SourcePartition, SubmissionLedger, SubscriptionError, SubscriptionStore, ThreadStore, ThreadStoreError } from "@effect-agent/thread";
2
3
  import { Context, Crypto, Effect, Layer, Schema } from "effect";
3
4
  import { SqliteMigrator } from "@effect/sql-sqlite-node";
4
5
  import * as SqlClientService from "effect/unstable/sql/SqlClient";
5
- //#region src/errors.d.ts
6
- declare const SqliteStorageCompatibilityError_base: Schema.Class<SqliteStorageCompatibilityError, Schema.TaggedStruct<"SqliteStorageCompatibilityError", {
7
- readonly actualVersion: Schema.Int;
8
- readonly message: Schema.String;
9
- readonly supportedVersion: Schema.Int;
10
- }>, import("effect/Cause").YieldableError>;
11
- /** The SQLite file uses a private-development format this adapter cannot read. */
12
- declare class SqliteStorageCompatibilityError extends SqliteStorageCompatibilityError_base {}
13
- declare const SqliteStorageCorruptionError_base: Schema.Class<SqliteStorageCorruptionError, Schema.TaggedStruct<"SqliteStorageCorruptionError", {
14
- readonly message: Schema.String;
15
- readonly rowKey: Schema.String;
16
- readonly table: Schema.String;
17
- }>, import("effect/Cause").YieldableError>;
18
- /** Stored bytes failed the current Schema and cannot be used as recovery truth. */
19
- declare class SqliteStorageCorruptionError extends SqliteStorageCorruptionError_base {}
20
- declare const SqliteStorageError_base: Schema.Class<SqliteStorageError, Schema.TaggedStruct<"SqliteStorageError", {
21
- readonly cause: Schema.optionalKey<Schema.Defect>;
22
- readonly message: Schema.String;
23
- readonly operation: Schema.String;
24
- }>, import("effect/Cause").YieldableError>;
25
- /** SQLite infrastructure failed while opening or operating the store. */
26
- declare class SqliteStorageError extends SqliteStorageError_base {}
27
- declare const SqliteLedgerError_base: Schema.Class<SqliteLedgerError, Schema.TaggedStruct<"SqliteLedgerError", {
28
- readonly cause: Schema.optionalKey<Schema.Defect>;
29
- readonly message: Schema.String;
30
- readonly operation: Schema.String;
31
- }>, import("effect/Cause").YieldableError>;
32
- /**
33
- * SQLite infrastructure failed while operating the Submission Ledger. Surfaces at the
34
- * SubmissionLedger port as the typed `LedgerError` with this error preserved as its cause,
35
- * so the adapter-level tag is never erased.
36
- */
37
- declare class SqliteLedgerError extends SqliteLedgerError_base {}
38
- declare const SqliteAppendConflict_base: Schema.Class<SqliteAppendConflict, Schema.TaggedStruct<"SqliteAppendConflict", {
39
- readonly message: Schema.String;
40
- readonly reason: Schema.Literals<readonly ["batch-digest", "record-identity", "tail"]>;
41
- readonly actualTailSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/session/CanonicalSequence">>;
42
- readonly actualTailDigest: Schema.optionalKey<Schema.String>;
43
- }>, import("effect/Cause").YieldableError>;
44
- /**
45
- * A canonical batch retry conflicts with existing append state. Tail conflicts carry the
46
- * actual committed tail as a diagnostic resume hint.
47
- */
48
- declare class SqliteAppendConflict extends SqliteAppendConflict_base {}
49
- declare const SqliteFenceRejected_base: Schema.Class<SqliteFenceRejected, Schema.TaggedStruct<"SqliteFenceRejected", {
50
- readonly actualEpoch: Schema.brand<Schema.Natural, "@effect-agent/session/ProducerEpoch">;
51
- readonly message: Schema.String;
52
- readonly producerEpoch: Schema.brand<Schema.Natural, "@effect-agent/session/ProducerEpoch">;
53
- }>, import("effect/Cause").YieldableError>;
54
- /**
55
- * A producer epoch does not match the Conversation's current writer registration. Appends
56
- * require the exact registered epoch, so both older and newer unregistered epochs are fenced;
57
- * a newer epoch takes over by materializing first.
58
- */
59
- declare class SqliteFenceRejected extends SqliteFenceRejected_base {}
60
- declare const SqliteWriteContention_base: Schema.Class<SqliteWriteContention, Schema.TaggedStruct<"SqliteWriteContention", {
61
- readonly cause: Schema.optionalKey<Schema.Defect>;
62
- readonly message: Schema.String;
63
- readonly operation: Schema.String;
64
- }>, import("effect/Cause").YieldableError>;
65
- /**
66
- * A write transaction could not acquire the SQLite write lock within the configured busy
67
- * timeout (SQLITE_BUSY / SQLITE_LOCKED). Another transiently coexisting owner is writing;
68
- * the operation did not mutate canonical state and is safe to retry.
69
- */
70
- declare class SqliteWriteContention extends SqliteWriteContention_base {}
71
- declare const SqliteCheckpointConflict_base: Schema.Class<SqliteCheckpointConflict, Schema.TaggedStruct<"SqliteCheckpointConflict", {
72
- readonly message: Schema.String;
73
- }>, import("effect/Cause").YieldableError>;
74
- /** A checkpoint conflicts with a previously stored checkpoint at the same offset. */
75
- declare class SqliteCheckpointConflict extends SqliteCheckpointConflict_base {}
76
- declare const SqliteStorageFailpointLocation: Schema.Literals<readonly ["materialize:before", "materialize:after", "append:before", "append:after-batch-insert", "append:after-record-insert", "append:after-tail-update", "append:after", "export:after-conversation-read", "save-checkpoint:before", "save-checkpoint:after", "ledger:admit:before", "ledger:admit:after", "ledger:mark-ready:before", "ledger:mark-ready:after", "ledger:claim:before", "ledger:claim:after", "ledger:mark-input-applied:before", "ledger:mark-input-applied:after", "ledger:renew:before", "ledger:renew:after", "ledger:reserve-settlement:before", "ledger:reserve-settlement:after", "ledger:finalize-settlement:before", "ledger:finalize-settlement:after", "ledger:request-abort:before", "ledger:request-abort:after", "ledger:release:before", "ledger:release:after", "ledger:claim-joining:before", "ledger:claim-joining:after", "ledger:mark-joined:before", "ledger:mark-joined:after", "ledger:revert-joining:before", "ledger:revert-joining:after", "ledger:suspend:before", "ledger:suspend:after", "ledger:approval-decision:before", "ledger:approval-decision:after", "ledger:mark-unknown:before", "ledger:mark-unknown:after", "ledger:unknown-resolution:before", "ledger:unknown-resolution:after", "ledger:child-reservation:before", "ledger:child-reservation:after", "ledger:child-attach:before", "ledger:child-attach:after", "ledger:child-release-pending:before", "ledger:child-release-pending:after", "ledger:child-release:before", "ledger:child-release:after", "ledger:child-settled:before", "ledger:child-settled:after"]>;
77
- type SqliteStorageFailpointLocation = typeof SqliteStorageFailpointLocation.Type;
78
- declare const SqliteStorageFailpointError_base: Schema.Class<SqliteStorageFailpointError, Schema.TaggedStruct<"SqliteStorageFailpointError", {
79
- readonly location: Schema.Literals<readonly ["materialize:before", "materialize:after", "append:before", "append:after-batch-insert", "append:after-record-insert", "append:after-tail-update", "append:after", "export:after-conversation-read", "save-checkpoint:before", "save-checkpoint:after", "ledger:admit:before", "ledger:admit:after", "ledger:mark-ready:before", "ledger:mark-ready:after", "ledger:claim:before", "ledger:claim:after", "ledger:mark-input-applied:before", "ledger:mark-input-applied:after", "ledger:renew:before", "ledger:renew:after", "ledger:reserve-settlement:before", "ledger:reserve-settlement:after", "ledger:finalize-settlement:before", "ledger:finalize-settlement:after", "ledger:request-abort:before", "ledger:request-abort:after", "ledger:release:before", "ledger:release:after", "ledger:claim-joining:before", "ledger:claim-joining:after", "ledger:mark-joined:before", "ledger:mark-joined:after", "ledger:revert-joining:before", "ledger:revert-joining:after", "ledger:suspend:before", "ledger:suspend:after", "ledger:approval-decision:before", "ledger:approval-decision:after", "ledger:mark-unknown:before", "ledger:mark-unknown:after", "ledger:unknown-resolution:before", "ledger:unknown-resolution:after", "ledger:child-reservation:before", "ledger:child-reservation:after", "ledger:child-attach:before", "ledger:child-attach:after", "ledger:child-release-pending:before", "ledger:child-release-pending:after", "ledger:child-release:before", "ledger:child-release:after", "ledger:child-settled:before", "ledger:child-settled:after"]>;
80
- }>, import("effect/Cause").YieldableError>;
81
- /** Deterministic test-only fault or pause injected at a SQLite operation boundary. */
82
- declare class SqliteStorageFailpointError extends SqliteStorageFailpointError_base {
83
- get message(): string;
84
- }
85
- //#endregion
6
+ import { MemoryMutationFailpoint, MemoryMutationFailure, MemoryReader, MemoryStorageError, MemoryWriter } from "@effect-agent/core";
86
7
  //#region src/migrations.d.ts
87
- declare const CurrentSqliteStorageVersion = 5;
88
- declare const sqliteMigrations: SqliteMigrator.Loader<never>;
8
+ declare const CurrentSqliteStorageVersion = 7;
9
+ //#endregion
10
+ //#region src/sqlite-activity-store.d.ts
11
+ type SqliteActivityInitializationError = ActivityStoreError | ActivityMutationFailure;
12
+ /** SQLite activity progress with mutation failpoints kept injectable for recovery tests. */
13
+ declare const activityProcessorStoreLayerWithFailpoints: Layer.Layer<ActivityProcessorStore, SqliteActivityInitializationError, SqlClientService.SqlClient | ActivityMutationFailpoint>;
14
+ /** SQLite activity progress with the production no-op mutation failpoint. */
15
+ declare const activityProcessorStoreLayer: Layer.Layer<ActivityProcessorStore, SqliteActivityInitializationError, SqlClientService.SqlClient>;
89
16
  //#endregion
90
17
  //#region src/sqlite-storage-config.d.ts
91
18
  declare const SqliteStorageConfigValue_base: Schema.Class<SqliteStorageConfigValue, Schema.Struct<{
@@ -96,7 +23,7 @@ declare const SqliteStorageConfigValue_base: Schema.Class<SqliteStorageConfigVal
96
23
  * Submission ownership lease duration in milliseconds (D5). The lease is a liveness hint
97
24
  * that makes an abandoned claim reclaimable; correctness never depends on it because every
98
25
  * canonical append is fenced by producer epoch. Convenience layers default this to
99
- * `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/session`.
26
+ * `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/thread`.
100
27
  */
101
28
  readonly ownershipLeaseDuration: Schema.Int;
102
29
  /**
@@ -116,26 +43,7 @@ declare const SqliteStorageConfig_base: Context.ServiceClass<SqliteStorageConfig
116
43
  /** Explicit SQLite storage configuration authority. */
117
44
  declare class SqliteStorageConfig extends SqliteStorageConfig_base {}
118
45
  //#endregion
119
- //#region src/sqlite-storage-failpoint.d.ts
120
- type SqliteStorageFailpointHandler = (location: SqliteStorageFailpointLocation) => Effect.Effect<void, SqliteStorageFailpointError>;
121
- declare const SqliteStorageFailpointTestControl_base: Context.ServiceClass<SqliteStorageFailpointTestControl, "@effect-agent/storage-sqlite/SqliteStorageFailpointTestControl", {
122
- readonly clear: Effect.Effect<void>;
123
- readonly setHandler: (handler: SqliteStorageFailpointHandler) => Effect.Effect<void>;
124
- }>;
125
- /** Test-only control for replacing the active SQLite failpoint handler. */
126
- declare class SqliteStorageFailpointTestControl extends SqliteStorageFailpointTestControl_base {}
127
- declare const SqliteStorageFailpoint_base: Context.ServiceClass<SqliteStorageFailpoint, "@effect-agent/storage-sqlite/SqliteStorageFailpoint", {
128
- readonly hit: SqliteStorageFailpointHandler;
129
- }>;
130
- /** Explicit fault-injection authority used at SQLite operation boundaries. */
131
- declare class SqliteStorageFailpoint extends SqliteStorageFailpoint_base {
132
- /** Production default: no fault injection. */
133
- static readonly layer: Layer.Layer<SqliteStorageFailpoint, never, never>;
134
- /** Reusable test Layer with a control service backed by the same handler Ref. */
135
- static readonly layerTest: Layer.Layer<SqliteStorageFailpoint | SqliteStorageFailpointTestControl, never, never>;
136
- }
137
- //#endregion
138
- //#region src/sqlite-conversation-store.d.ts
46
+ //#region src/sqlite-thread-store.d.ts
139
47
  interface SqliteStorageOptions {
140
48
  readonly filename: string;
141
49
  readonly observationPollInterval?: number | undefined;
@@ -143,7 +51,7 @@ interface SqliteStorageOptions {
143
51
  readonly busyTimeout?: number | undefined;
144
52
  /**
145
53
  * Submission ownership lease duration in milliseconds (D5). Defaults to
146
- * `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/session`.
54
+ * `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/thread`.
147
55
  */
148
56
  readonly ownershipLeaseDuration?: number | undefined;
149
57
  /**
@@ -156,25 +64,25 @@ interface SqliteStorageOptions {
156
64
  }
157
65
  type SqliteStorageInitializationError = SqliteStorageCompatibilityError | SqliteStorageCorruptionError | SqliteStorageError;
158
66
  /**
159
- * SQLite Conversation Store implementation with configuration, failpoint, SQL, and Crypto
67
+ * SQLite Thread Store implementation with configuration, failpoint, SQL, and Crypto
160
68
  * authority kept visible in its input channel.
161
69
  */
162
- declare const conversationStoreLayer: Layer.Layer<ConversationStore, SqliteStorageInitializationError, SqliteStorageConfig | SqliteStorageFailpoint | SqlClientService.SqlClient | Crypto.Crypto>;
70
+ declare const threadStoreLayer: Layer.Layer<ThreadStore, SqliteStorageInitializationError, SqliteStorageConfig | SqliteStorageFailpoint | SqlClientService.SqlClient | Crypto.Crypto>;
163
71
  /**
164
72
  * Validated SQLite storage configuration Layer with the documented defaults applied. Shared
165
- * by the ConversationStore and SubmissionLedger convenience layers so their defaults cannot
73
+ * by the ThreadStore and SubmissionLedger convenience layers so their defaults cannot
166
74
  * drift.
167
75
  */
168
76
  declare const storageConfigLayer: (options: SqliteStorageOptions) => Layer.Layer<SqliteStorageConfig, SqliteStorageError>;
169
77
  /** The failpoint Layer selected by convenience options: explicit handler or the no-op default. */
170
78
  declare const storageFailpointLayer: (options: SqliteStorageOptions) => Layer.Layer<SqliteStorageFailpoint>;
171
79
  /**
172
- * A composition-root convenience Layer for canonical Conversations. Durable accepted work is
80
+ * A composition-root convenience Layer for canonical Threads. Durable accepted work is
173
81
  * served by the separate SubmissionLedger port.
174
82
  */
175
- declare const layer: (options: SqliteStorageOptions) => Layer.Layer<ConversationStore, SqliteStorageInitializationError>;
83
+ declare const layer: (options: SqliteStorageOptions) => Layer.Layer<ThreadStore, SqliteStorageInitializationError>;
176
84
  /** Create an adapter-owned resumable observation offset for a known canonical sequence. */
177
- declare const observationOffsetAt: (conversationId: string & import("effect/Brand").Brand<"@effect-agent/core/ConversationId">, sequence: number) => Effect.Effect<string & import("effect/Brand").Brand<"@effect-agent/session/ObservationOffset">, ConversationStoreError, never>;
85
+ declare const observationOffsetAt: (threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">, sequence: number) => Effect.Effect<string & import("effect/Brand").Brand<"@effect-agent/thread/ObservationOffset">, ThreadStoreError, never>;
178
86
  //#endregion
179
87
  //#region src/sqlite-ledger.d.ts
180
88
  /**
@@ -185,13 +93,25 @@ declare const observationOffsetAt: (conversationId: string & import("effect/Bran
185
93
  declare const submissionLedgerLayer: Layer.Layer<SubmissionLedger, SqliteStorageInitializationError, SqliteStorageConfig | SqliteStorageFailpoint | SqlClientService.SqlClient | Crypto.Crypto>;
186
94
  /**
187
95
  * A composition-root convenience Layer for the durable Submission Ledger. Point it at the
188
- * same database file as the ConversationStore so claims fence the same producer epochs.
96
+ * same database file as the ThreadStore so claims fence the same producer epochs.
189
97
  */
190
98
  declare const ledgerLayer: (options: SqliteStorageOptions) => Layer.Layer<SubmissionLedger, SqliteStorageInitializationError>;
191
99
  //#endregion
100
+ //#region src/sqlite-memory-store.d.ts
101
+ type SqliteMemoryInitializationError = MemoryStorageError | MemoryMutationFailure;
102
+ /** SQLite memory ports with the mutation failpoint kept injectable for recovery tests. */
103
+ declare const memoryStoreLayerWithFailpoints: Layer.Layer<MemoryReader | MemoryWriter, SqliteMemoryInitializationError, SqlClientService.SqlClient | MemoryMutationFailpoint>;
104
+ /** SQLite memory reader and writer with the production no-op mutation failpoint. */
105
+ declare const memoryStoreLayer: Layer.Layer<MemoryReader | MemoryWriter, SqliteMemoryInitializationError, SqlClientService.SqlClient>;
106
+ /** Reads an existing memory schema without writes, transactions, or mutation failpoints. */
107
+ declare const memoryReaderLayer: Layer.Layer<MemoryReader, MemoryStorageError, SqlClientService.SqlClient>;
108
+ //#endregion
192
109
  //#region src/sqlite-schedule-store.d.ts
193
110
  /** SQLite implementation of the atomic ScheduleStore port. */
194
111
  declare const scheduleStoreLayer: Layer.Layer<ScheduleStore, SqliteStorageInitializationError, SqliteStorageConfig | SqliteStorageFailpoint | SqlClientService.SqlClient>;
195
112
  //#endregion
196
- export { CurrentSqliteStorageVersion, SqliteAppendConflict, SqliteCheckpointConflict, SqliteFenceRejected, SqliteLedgerError, SqliteStorageCompatibilityError, SqliteStorageConfig, SqliteStorageConfigValue, SqliteStorageCorruptionError, SqliteStorageError, SqliteStorageFailpoint, SqliteStorageFailpointError, SqliteStorageFailpointHandler, SqliteStorageFailpointLocation, SqliteStorageFailpointTestControl, SqliteStorageInitializationError, SqliteStorageOptions, SqliteWriteContention, conversationStoreLayer, layer, ledgerLayer, observationOffsetAt, scheduleStoreLayer, sqliteMigrations, storageConfigLayer, storageFailpointLayer, submissionLedgerLayer };
113
+ //#region src/sqlite-subscription-store.d.ts
114
+ declare const subscriptionStoreLayer: (partition: SourcePartition) => Layer.Layer<SubscriptionStore, SqliteStorageInitializationError | SubscriptionError, SqliteStorageConfig | SqliteStorageFailpoint | SqlClientService.SqlClient>;
115
+ //#endregion
116
+ export { CurrentSqliteStorageVersion, SqliteActivityInitializationError, SqliteAppendConflict, SqliteCheckpointConflict, SqliteFenceRejected, SqliteLedgerError, SqliteMemoryInitializationError, SqliteStorageCompatibilityError, SqliteStorageConfig, SqliteStorageConfigValue, SqliteStorageCorruptionError, SqliteStorageError, SqliteStorageFailpoint, SqliteStorageFailpointError, SqliteStorageFailpointHandler, SqliteStorageFailpointLocation, SqliteStorageInitializationError, SqliteStorageOptions, SqliteWriteContention, activityProcessorStoreLayer, activityProcessorStoreLayerWithFailpoints, layer, ledgerLayer, memoryReaderLayer, memoryStoreLayer, memoryStoreLayerWithFailpoints, observationOffsetAt, scheduleStoreLayer, storageConfigLayer, storageFailpointLayer, submissionLedgerLayer, subscriptionStoreLayer, threadStoreLayer };
197
117
  //# sourceMappingURL=index.d.mts.map