@effect-agent/storage-sqlite 0.1.0-beta.84 → 0.1.0-beta.86

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 (36) hide show
  1. package/dist/SqliteActivityStore.d.mts +1 -1
  2. package/dist/SqliteActivityStore.mjs +3 -3
  3. package/dist/SqliteActivityStore.mjs.map +1 -1
  4. package/dist/SqliteMessageDeliveryStore.d.mts +1 -1
  5. package/dist/SqliteMessageDeliveryStore.mjs +3 -3
  6. package/dist/SqliteMessageDeliveryStore.mjs.map +1 -1
  7. package/dist/SqliteScheduleStore.d.mts +1 -1
  8. package/dist/SqliteScheduleStore.mjs +4 -4
  9. package/dist/SqliteScheduleStore.mjs.map +1 -1
  10. package/dist/SqliteStorageConfig.d.mts +1 -1
  11. package/dist/SqliteStorageConfig.mjs +1 -1
  12. package/dist/SqliteStorageConfig.mjs.map +1 -1
  13. package/dist/SqliteStorageError.mjs +1 -1
  14. package/dist/SqliteStorageError.mjs.map +1 -1
  15. package/dist/SqliteSubmissionLedger.d.mts +1 -1
  16. package/dist/SqliteSubmissionLedger.mjs +35 -35
  17. package/dist/SqliteSubmissionLedger.mjs.map +1 -1
  18. package/dist/SqliteSubscriptionStore.d.mts +1 -1
  19. package/dist/SqliteSubscriptionStore.mjs +4 -4
  20. package/dist/SqliteSubscriptionStore.mjs.map +1 -1
  21. package/dist/SqliteThreadStore.d.mts +2 -2
  22. package/dist/SqliteThreadStore.mjs +26 -26
  23. package/dist/SqliteThreadStore.mjs.map +1 -1
  24. package/dist/{sqlite-journal-D9xFxCw-.mjs → sqlite-journal-CBOQDySe.mjs} +9 -9
  25. package/dist/sqlite-journal-CBOQDySe.mjs.map +1 -0
  26. package/package.json +1 -1
  27. package/src/SqliteActivityStore.ts +4 -4
  28. package/src/SqliteMessageDeliveryStore.ts +3 -3
  29. package/src/SqliteScheduleStore.ts +4 -4
  30. package/src/SqliteStorageConfig.ts +1 -1
  31. package/src/SqliteStorageError.ts +1 -1
  32. package/src/SqliteSubmissionLedger.ts +67 -67
  33. package/src/SqliteSubscriptionStore.ts +4 -8
  34. package/src/SqliteThreadStore.ts +51 -53
  35. package/src/internal/sqlite-journal.ts +11 -14
  36. package/dist/sqlite-journal-D9xFxCw-.mjs.map +0 -1
@@ -1,5 +1,8 @@
1
- import { MessageAdmission } from "@effect-agent/core/Messaging";
2
- import { EMPTY_TAIL_DIGEST } from "@effect-agent/thread/Digest";
1
+ import { NodeCrypto } from "@effect/platform-node";
2
+ import { SqliteClient } from "@effect/sql-sqlite-node";
3
+ import { Clock, Context, Crypto, DateTime, Effect, Layer, Option, Schema, Stream } from "effect";
4
+ import { EMPTY_TAIL_DIGEST } from "effect-agent/digest";
5
+ import { InputMessage } from "effect-agent/messaging";
3
6
  import {
4
7
  ApprovalDecision,
5
8
  CanonicalSequence,
@@ -10,7 +13,7 @@ import {
10
13
  ProducerEpoch,
11
14
  RecordEnvelope,
12
15
  SettlementOutcome,
13
- } from "@effect-agent/thread/Records";
16
+ } from "effect-agent/records";
14
17
  import {
15
18
  AbortCommand,
16
19
  AbortIntent,
@@ -82,10 +85,7 @@ import {
82
85
  submissionAbortRecordId,
83
86
  type ChildSettledOutcome,
84
87
  type SuspensionOutcome,
85
- } from "@effect-agent/thread/SubmissionLedger";
86
- import { NodeCrypto } from "@effect/platform-node";
87
- import { SqliteClient } from "@effect/sql-sqlite-node";
88
- import { Clock, Context, Crypto, DateTime, Effect, Layer, Option, Schema, Stream } from "effect";
88
+ } from "effect-agent/submission-ledger";
89
89
  import * as SqlClientService from "effect/unstable/sql/SqlClient";
90
90
  import type { SqlError } from "effect/unstable/sql/SqlError";
91
91
 
@@ -514,9 +514,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
514
514
  if (Option.isNone(ownership) || ownership.value.ownership_token !== ownershipToken) {
515
515
  const actualEpoch = yield* threadEpoch(operation, submission.thread_id);
516
516
 
517
- const submissionId = yield* Schema.decodeUnknownEffect(
518
- SubmissionSnapshot.fields.submissionId,
519
- )(submission.submission_id).pipe(Effect.mapError(internalFailure(operation)));
517
+ const submissionId = yield* Schema.decodeEffect(SubmissionSnapshot.fields.submissionId)(
518
+ submission.submission_id,
519
+ ).pipe(Effect.mapError(internalFailure(operation)));
520
520
 
521
521
  return yield* OwnershipLost.make({ submissionId, actualEpoch });
522
522
  }
@@ -995,9 +995,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
995
995
  function* (request: AdmissionRequest) {
996
996
  const operation = "ledger admit";
997
997
 
998
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AdmissionRequest))(
999
- request,
1000
- ).pipe(Effect.mapError(internalFailure(operation)));
998
+ const validated = yield* Schema.decodeEffect(Schema.toType(AdmissionRequest))(request).pipe(
999
+ Effect.mapError(internalFailure(operation)),
1000
+ );
1001
1001
 
1002
1002
  const inputJson = yield* encodePersistedJsonText(validated.inputPayload).pipe(
1003
1003
  Effect.mapError(internalFailure(operation)),
@@ -1023,7 +1023,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1023
1023
  const messageAdmissionJson =
1024
1024
  validated.messageAdmission === undefined
1025
1025
  ? null
1026
- : yield* Schema.encodeEffect(Schema.fromJsonString(MessageAdmission))(
1026
+ : yield* Schema.encodeEffect(Schema.fromJsonString(InputMessage))(
1027
1027
  validated.messageAdmission,
1028
1028
  ).pipe(Effect.mapError(internalFailure(operation)));
1029
1029
 
@@ -1096,10 +1096,10 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1096
1096
  existing[0].worker_admission_json,
1097
1097
  ).pipe(Effect.mapError(internalFailure(operation)));
1098
1098
 
1099
- const retainedMessageAdmission =
1099
+ const retainedInputMessage =
1100
1100
  existing[0].message_admission_json === null
1101
1101
  ? undefined
1102
- : yield* Schema.decodeEffect(Schema.fromJsonString(MessageAdmission))(
1102
+ : yield* Schema.decodeEffect(Schema.fromJsonString(InputMessage))(
1103
1103
  existing[0].message_admission_json,
1104
1104
  ).pipe(Effect.mapError(internalFailure(operation)));
1105
1105
 
@@ -1116,8 +1116,8 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1116
1116
  retainedWorkerAdmission,
1117
1117
  validated.workerAdmission,
1118
1118
  ) ||
1119
- !Schema.toEquivalence(Schema.optional(MessageAdmission))(
1120
- retainedMessageAdmission,
1119
+ !Schema.toEquivalence(Schema.optional(InputMessage))(
1120
+ retainedInputMessage,
1121
1121
  validated.messageAdmission,
1122
1122
  ) ||
1123
1123
  !Schema.toEquivalence(Schema.optional(AdmissionFence))(
@@ -1275,9 +1275,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1275
1275
  )(function* (request: MarkReadyRequest) {
1276
1276
  const operation = "ledger mark ready";
1277
1277
 
1278
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkReadyRequest))(
1279
- request,
1280
- ).pipe(Effect.mapError(internalFailure(operation)));
1278
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkReadyRequest))(request).pipe(
1279
+ Effect.mapError(internalFailure(operation)),
1280
+ );
1281
1281
 
1282
1282
  yield* hitFailpoint("ledger:mark-ready:before", operation);
1283
1283
  yield* inWriteTransaction(
@@ -1302,9 +1302,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1302
1302
  function* (request: SubmissionLookup) {
1303
1303
  const operation = "ledger lookup";
1304
1304
 
1305
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SubmissionLookup))(
1306
- request,
1307
- ).pipe(Effect.mapError(internalFailure(operation)));
1305
+ const validated = yield* Schema.decodeEffect(Schema.toType(SubmissionLookup))(request).pipe(
1306
+ Effect.mapError(internalFailure(operation)),
1307
+ );
1308
1308
 
1309
1309
  if (validated._tag === "SubmissionLookupById") {
1310
1310
  const row = yield* readSubmission(operation, validated.submissionId);
@@ -1350,7 +1350,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1350
1350
  )(function* (request: SubmissionLookupByKey) {
1351
1351
  const operation = "ledger resolve admission";
1352
1352
 
1353
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SubmissionLookupByKey))(
1353
+ const validated = yield* Schema.decodeEffect(Schema.toType(SubmissionLookupByKey))(
1354
1354
  request,
1355
1355
  ).pipe(Effect.mapError(internalFailure(operation)));
1356
1356
 
@@ -1387,9 +1387,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1387
1387
  function* (request: ClaimRequest) {
1388
1388
  const operation = "ledger claim";
1389
1389
 
1390
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ClaimRequest))(
1391
- request,
1392
- ).pipe(Effect.mapError(internalFailure(operation)));
1390
+ const validated = yield* Schema.decodeEffect(Schema.toType(ClaimRequest))(request).pipe(
1391
+ Effect.mapError(internalFailure(operation)),
1392
+ );
1393
1393
 
1394
1394
  const attemptId = yield* mintIdentifier("attempt", operation);
1395
1395
  const ownershipToken = yield* mintIdentifier("owner", operation);
@@ -1563,7 +1563,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1563
1563
  )(function* (request: RenewOwnershipRequest) {
1564
1564
  const operation = "ledger renew ownership";
1565
1565
 
1566
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(RenewOwnershipRequest))(
1566
+ const validated = yield* Schema.decodeEffect(Schema.toType(RenewOwnershipRequest))(
1567
1567
  request,
1568
1568
  ).pipe(Effect.mapError(internalFailure(operation)));
1569
1569
 
@@ -1601,7 +1601,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1601
1601
  )(function* (request: ReleaseOwnershipRequest) {
1602
1602
  const operation = "ledger release ownership";
1603
1603
 
1604
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ReleaseOwnershipRequest))(
1604
+ const validated = yield* Schema.decodeEffect(Schema.toType(ReleaseOwnershipRequest))(
1605
1605
  request,
1606
1606
  ).pipe(Effect.mapError(internalFailure(operation)));
1607
1607
 
@@ -1633,7 +1633,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1633
1633
  )(function* (request: MarkInputAppliedRequest) {
1634
1634
  const operation = "ledger mark input applied";
1635
1635
 
1636
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkInputAppliedRequest))(
1636
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkInputAppliedRequest))(
1637
1637
  request,
1638
1638
  ).pipe(Effect.mapError(internalFailure(operation)));
1639
1639
 
@@ -1680,7 +1680,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1680
1680
  )(function* (request: SettlementReservation) {
1681
1681
  const operation = "ledger reserve settlement";
1682
1682
 
1683
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SettlementReservation))(
1683
+ const validated = yield* Schema.decodeEffect(Schema.toType(SettlementReservation))(
1684
1684
  request,
1685
1685
  ).pipe(Effect.mapError(internalFailure(operation)));
1686
1686
 
@@ -1891,7 +1891,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1891
1891
  )(function* (request: SettlementFinalization) {
1892
1892
  const operation = "ledger finalize settlement";
1893
1893
 
1894
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SettlementFinalization))(
1894
+ const validated = yield* Schema.decodeEffect(Schema.toType(SettlementFinalization))(
1895
1895
  request,
1896
1896
  ).pipe(Effect.mapError(internalFailure(operation)));
1897
1897
 
@@ -1998,7 +1998,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
1998
1998
  )(function* (request: AbortCommand) {
1999
1999
  const operation = "ledger request abort";
2000
2000
 
2001
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AbortCommand))(request).pipe(
2001
+ const validated = yield* Schema.decodeEffect(Schema.toType(AbortCommand))(request).pipe(
2002
2002
  Effect.mapError(internalFailure(operation)),
2003
2003
  );
2004
2004
 
@@ -2098,9 +2098,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2098
2098
  )(function* (request: ClaimJoiningRequest) {
2099
2099
  const operation = "ledger claim joining";
2100
2100
 
2101
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ClaimJoiningRequest))(
2102
- request,
2103
- ).pipe(Effect.mapError(internalFailure(operation)));
2101
+ const validated = yield* Schema.decodeEffect(Schema.toType(ClaimJoiningRequest))(request).pipe(
2102
+ Effect.mapError(internalFailure(operation)),
2103
+ );
2104
2104
 
2105
2105
  yield* hitFailpoint("ledger:claim-joining:before", operation);
2106
2106
 
@@ -2186,9 +2186,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2186
2186
  )(function* (request: MarkJoinedRequest) {
2187
2187
  const operation = "ledger mark joined";
2188
2188
 
2189
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkJoinedRequest))(
2190
- request,
2191
- ).pipe(Effect.mapError(internalFailure(operation)));
2189
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkJoinedRequest))(request).pipe(
2190
+ Effect.mapError(internalFailure(operation)),
2191
+ );
2192
2192
 
2193
2193
  yield* hitFailpoint("ledger:mark-joined:before", operation);
2194
2194
  yield* inWriteTransaction(
@@ -2246,9 +2246,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2246
2246
  )(function* (request: RevertJoiningRequest) {
2247
2247
  const operation = "ledger revert joining";
2248
2248
 
2249
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(RevertJoiningRequest))(
2250
- request,
2251
- ).pipe(Effect.mapError(internalFailure(operation)));
2249
+ const validated = yield* Schema.decodeEffect(Schema.toType(RevertJoiningRequest))(request).pipe(
2250
+ Effect.mapError(internalFailure(operation)),
2251
+ );
2252
2252
 
2253
2253
  yield* hitFailpoint("ledger:revert-joining:before", operation);
2254
2254
  yield* inWriteTransaction(
@@ -2274,9 +2274,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2274
2274
  )(function* (request: SuspendRequest) {
2275
2275
  const operation = "ledger suspend";
2276
2276
 
2277
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SuspendRequest))(
2278
- request,
2279
- ).pipe(Effect.mapError(internalFailure(operation)));
2277
+ const validated = yield* Schema.decodeEffect(Schema.toType(SuspendRequest))(request).pipe(
2278
+ Effect.mapError(internalFailure(operation)),
2279
+ );
2280
2280
 
2281
2281
  const reasonJson = yield* encodeSuspensionReasonText(validated.reason).pipe(
2282
2282
  Effect.mapError(internalFailure(operation)),
@@ -2410,7 +2410,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2410
2410
  )(function* (command: ApprovalDecisionCommand) {
2411
2411
  const operation = "ledger record approval decision";
2412
2412
 
2413
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ApprovalDecisionCommand))(
2413
+ const validated = yield* Schema.decodeEffect(Schema.toType(ApprovalDecisionCommand))(
2414
2414
  command,
2415
2415
  ).pipe(Effect.mapError(internalFailure(operation)));
2416
2416
 
@@ -2494,9 +2494,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2494
2494
  )(function* (request: MarkUnknownRequest) {
2495
2495
  const operation = "ledger mark unknown";
2496
2496
 
2497
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkUnknownRequest))(
2498
- request,
2499
- ).pipe(Effect.mapError(internalFailure(operation)));
2497
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkUnknownRequest))(request).pipe(
2498
+ Effect.mapError(internalFailure(operation)),
2499
+ );
2500
2500
 
2501
2501
  yield* hitFailpoint("ledger:mark-unknown:before", operation);
2502
2502
  yield* inWriteTransaction(
@@ -2561,7 +2561,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2561
2561
  )(function* (command: UnknownResolutionCommand) {
2562
2562
  const operation = "ledger record unknown resolution";
2563
2563
 
2564
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(UnknownResolutionCommand))(
2564
+ const validated = yield* Schema.decodeEffect(Schema.toType(UnknownResolutionCommand))(
2565
2565
  command,
2566
2566
  ).pipe(Effect.mapError(internalFailure(operation)));
2567
2567
 
@@ -2682,7 +2682,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2682
2682
  )(function* (request: ChildSettledNotification) {
2683
2683
  const operation = "ledger record child settled";
2684
2684
 
2685
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ChildSettledNotification))(
2685
+ const validated = yield* Schema.decodeEffect(Schema.toType(ChildSettledNotification))(
2686
2686
  request,
2687
2687
  ).pipe(Effect.mapError(internalFailure(operation)));
2688
2688
 
@@ -2772,9 +2772,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2772
2772
  )(function* (request: ChildBudgetReservationRequest) {
2773
2773
  const operation = "ledger reserve child budget";
2774
2774
 
2775
- const validated = yield* Schema.decodeUnknownEffect(
2776
- Schema.toType(ChildBudgetReservationRequest),
2777
- )(request).pipe(Effect.mapError(internalFailure(operation)));
2775
+ const validated = yield* Schema.decodeEffect(Schema.toType(ChildBudgetReservationRequest))(
2776
+ request,
2777
+ ).pipe(Effect.mapError(internalFailure(operation)));
2778
2778
 
2779
2779
  const allocationJson = yield* encodePersistedJsonText(validated.allocation).pipe(
2780
2780
  Effect.mapError(internalFailure(operation)),
@@ -2884,9 +2884,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2884
2884
  ) {
2885
2885
  const operation = "ledger attach child to reservation";
2886
2886
 
2887
- const validated = yield* Schema.decodeUnknownEffect(
2888
- Schema.toType(AttachChildToReservationRequest),
2889
- )(request).pipe(Effect.mapError(internalFailure(operation)));
2887
+ const validated = yield* Schema.decodeEffect(Schema.toType(AttachChildToReservationRequest))(
2888
+ request,
2889
+ ).pipe(Effect.mapError(internalFailure(operation)));
2890
2890
 
2891
2891
  yield* hitFailpoint("ledger:child-attach:before", operation);
2892
2892
 
@@ -2963,9 +2963,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
2963
2963
  )(function* (request: BeginChildBudgetReleaseRequest) {
2964
2964
  const operation = "ledger begin child budget release";
2965
2965
 
2966
- const validated = yield* Schema.decodeUnknownEffect(
2967
- Schema.toType(BeginChildBudgetReleaseRequest),
2968
- )(request).pipe(Effect.mapError(internalFailure(operation)));
2966
+ const validated = yield* Schema.decodeEffect(Schema.toType(BeginChildBudgetReleaseRequest))(
2967
+ request,
2968
+ ).pipe(Effect.mapError(internalFailure(operation)));
2969
2969
 
2970
2970
  const accountingJson = yield* encodePersistedJsonText(validated.accounting).pipe(
2971
2971
  Effect.mapError(internalFailure(operation)),
@@ -3040,7 +3040,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
3040
3040
  )(function* (request: ReleaseChildBudgetRequest) {
3041
3041
  const operation = "ledger release child budget";
3042
3042
 
3043
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ReleaseChildBudgetRequest))(
3043
+ const validated = yield* Schema.decodeEffect(Schema.toType(ReleaseChildBudgetRequest))(
3044
3044
  request,
3045
3045
  ).pipe(Effect.mapError(internalFailure(operation)));
3046
3046
 
@@ -3158,9 +3158,9 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
3158
3158
  )(function* (request) {
3159
3159
  const operation = "ledger read abort intent";
3160
3160
 
3161
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AbortIntentRequest))(
3162
- request,
3163
- ).pipe(Effect.mapError(internalFailure(operation)));
3161
+ const validated = yield* Schema.decodeEffect(Schema.toType(AbortIntentRequest))(request).pipe(
3162
+ Effect.mapError(internalFailure(operation)),
3163
+ );
3164
3164
 
3165
3165
  const recordId = submissionAbortRecordId(validated.submissionId);
3166
3166
 
@@ -3229,7 +3229,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
3229
3229
  )(function* (request: RecoverySnapshotRequest) {
3230
3230
  const operation = "ledger load recovery snapshot";
3231
3231
 
3232
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(RecoverySnapshotRequest))(
3232
+ const validated = yield* Schema.decodeEffect(Schema.toType(RecoverySnapshotRequest))(
3233
3233
  request,
3234
3234
  ).pipe(Effect.mapError(internalFailure(operation)));
3235
3235
 
@@ -3278,7 +3278,7 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
3278
3278
  ),
3279
3279
  );
3280
3280
 
3281
- const settlementId = yield* Schema.decodeUnknownEffect(
3281
+ const settlementId = yield* Schema.decodeEffect(
3282
3282
  SettlementReservationSnapshot.fields.settlementId,
3283
3283
  )(reservationRow.value.settlement_id).pipe(Effect.mapError(internalFailure(operation)));
3284
3284
 
@@ -1,13 +1,9 @@
1
+ import { Effect, Layer, Schema } from "effect";
1
2
  import {
2
3
  makeSqlSubscriptionStore,
3
4
  SqlSubscriptionTransaction,
4
- } from "@effect-agent/thread/SqlSubscriptionStore";
5
- import {
6
- SourcePartition,
7
- SubscriptionError,
8
- SubscriptionStore,
9
- } from "@effect-agent/thread/Subscription";
10
- import { Effect, Layer, Schema } from "effect";
5
+ } from "effect-agent/sql-subscription-store";
6
+ import { SourcePartition, SubscriptionError, SubscriptionStore } from "effect-agent/subscription";
11
7
  import * as SqlClientService from "effect/unstable/sql/SqlClient";
12
8
 
13
9
  import { initializeSqliteJournal } from "./internal/sqlite-journal.ts";
@@ -36,7 +32,7 @@ const transactionLayer = Layer.effect(
36
32
  const makeSubscriptionStore = Effect.fn("SqliteSubscriptionStore.make")(function* (
37
33
  owned: SourcePartition,
38
34
  ) {
39
- const partition = yield* Schema.decodeUnknownEffect(SourcePartition)(owned).pipe(
35
+ const partition = yield* Schema.decodeEffect(SourcePartition)(owned).pipe(
40
36
  Effect.mapError(() => SubscriptionError.make({ reason: "validation", code: "partition" })),
41
37
  );
42
38
 
@@ -1,4 +1,18 @@
1
- import { digestCanonicalBatch, EMPTY_TAIL_DIGEST } from "@effect-agent/thread/Digest";
1
+ import { NodeCrypto } from "@effect/platform-node";
2
+ import { SqliteClient } from "@effect/sql-sqlite-node";
3
+ import {
4
+ Clock,
5
+ Context,
6
+ Crypto,
7
+ Duration,
8
+ Effect,
9
+ Layer,
10
+ Option,
11
+ Ref,
12
+ Schema,
13
+ Stream,
14
+ } from "effect";
15
+ import { digestCanonicalBatch, EMPTY_TAIL_DIGEST } from "effect-agent/digest";
2
16
  import {
3
17
  CanonicalBatch,
4
18
  CanonicalRecord,
@@ -6,8 +20,8 @@ import {
6
20
  CanonicalSequence,
7
21
  Digest,
8
22
  ObservationOffset,
9
- } from "@effect-agent/thread/Records";
10
- import { DEFAULT_OWNERSHIP_LEASE_DURATION } from "@effect-agent/thread/SubmissionLedger";
23
+ } from "effect-agent/records";
24
+ import { DEFAULT_OWNERSHIP_LEASE_DURATION } from "effect-agent/submission-ledger";
11
25
  import {
12
26
  AppendConflict,
13
27
  AppendResult,
@@ -31,21 +45,7 @@ import {
31
45
  SaveRecoveryCheckpointRequest,
32
46
  MAX_THREAD_EXPORT_RECORDS,
33
47
  type ThreadRecoveryCheckpoints,
34
- } from "@effect-agent/thread/ThreadStore";
35
- import { NodeCrypto } from "@effect/platform-node";
36
- import { SqliteClient } from "@effect/sql-sqlite-node";
37
- import {
38
- Clock,
39
- Context,
40
- Crypto,
41
- Duration,
42
- Effect,
43
- Layer,
44
- Option,
45
- Ref,
46
- Schema,
47
- Stream,
48
- } from "effect";
48
+ } from "effect-agent/thread-store";
49
49
  import type * as SqlClientService from "effect/unstable/sql/SqlClient";
50
50
 
51
51
  import {
@@ -77,7 +77,7 @@ export interface SqliteStorageOptions {
77
77
  readonly busyTimeout?: number | undefined;
78
78
  /**
79
79
  * Submission ownership lease duration in milliseconds (D5). Defaults to
80
- * `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/thread`.
80
+ * `DEFAULT_OWNERSHIP_LEASE_DURATION` from `effect-agent/submission-ledger`.
81
81
  */
82
82
  readonly ownershipLeaseDuration?: number | undefined;
83
83
  /**
@@ -120,9 +120,9 @@ const makeOffset = Effect.fn("SqliteThreadStore.makeOffset")(function* (
120
120
  threadId: ThreadMaterialization["threadId"],
121
121
  sequence: number,
122
122
  ): Effect.fn.Return<ObservationOffset, ThreadStoreError> {
123
- return yield* Schema.decodeUnknownEffect(CanonicalSequence)(sequence).pipe(
123
+ return yield* Schema.decodeEffect(CanonicalSequence)(sequence).pipe(
124
124
  Effect.flatMap((validatedSequence) =>
125
- Schema.decodeUnknownEffect(ObservationOffset)(
125
+ Schema.decodeEffect(ObservationOffset)(
126
126
  `${SQLITE_OFFSET_PREFIX}${encodeURIComponent(threadId)}:${validatedSequence}`,
127
127
  ),
128
128
  ),
@@ -136,7 +136,7 @@ const parseOffset = Effect.fn("SqliteThreadStore.parseOffset")(function* (
136
136
  ): Effect.fn.Return<CanonicalSequence, ThreadStoreError> {
137
137
  if (offset === undefined) return ZERO_CANONICAL_SEQUENCE;
138
138
 
139
- const text = yield* Schema.decodeUnknownEffect(OffsetText)(offset).pipe(
139
+ const text = yield* Schema.decodeEffect(OffsetText)(offset).pipe(
140
140
  Effect.mapError((error) => schemaStoreError("decode observation offset", error)),
141
141
  );
142
142
 
@@ -157,7 +157,7 @@ const parseOffset = Effect.fn("SqliteThreadStore.parseOffset")(function* (
157
157
  });
158
158
  }
159
159
 
160
- return yield* Schema.decodeUnknownEffect(CanonicalSequence)(Number(sequenceText)).pipe(
160
+ return yield* Schema.decodeEffect(CanonicalSequence)(Number(sequenceText)).pipe(
161
161
  Effect.mapError((error) => schemaStoreError("decode observation offset", error)),
162
162
  );
163
163
  });
@@ -210,13 +210,13 @@ const decodeEnvelope = Effect.fn("SqliteThreadStore.decodeEnvelope")(function* (
210
210
  ),
211
211
  );
212
212
 
213
- const threadId = yield* Schema.decodeUnknownEffect(CanonicalRecordEnvelope.fields.threadId)(
213
+ const threadId = yield* Schema.decodeEffect(CanonicalRecordEnvelope.fields.threadId)(
214
214
  row.thread_id,
215
215
  ).pipe(Effect.mapError((error) => schemaStoreError("decode thread identity", error)));
216
216
 
217
217
  const offset = yield* makeOffset(threadId, row.sequence);
218
218
 
219
- const batchId = yield* Schema.decodeUnknownEffect(CanonicalRecordEnvelope.fields.batchId)(
219
+ const batchId = yield* Schema.decodeEffect(CanonicalRecordEnvelope.fields.batchId)(
220
220
  row.batch_id,
221
221
  ).pipe(Effect.mapError((error) => schemaStoreError("decode batch identity", error)));
222
222
 
@@ -270,7 +270,7 @@ const tailDigestAt = Effect.fn("SqliteThreadStore.tailDigestAt")(function* (
270
270
  });
271
271
  }
272
272
 
273
- return yield* Schema.decodeUnknownEffect(Digest)(digests[0]).pipe(
273
+ return yield* Schema.decodeEffect(Digest)(digests[0]).pipe(
274
274
  Effect.mapError((error) => schemaStoreError("decode checkpoint digest", error)),
275
275
  );
276
276
  });
@@ -511,7 +511,7 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
511
511
  const materialize: ThreadStore["Service"]["materialize"] = Effect.fn(
512
512
  "SqliteThreadStore.materialize",
513
513
  )(function* (request: ThreadMaterialization) {
514
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadMaterialization))(
514
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadMaterialization))(
515
515
  request,
516
516
  ).pipe(Effect.mapError((error) => schemaStoreError("validate materialization", error)));
517
517
 
@@ -538,9 +538,9 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
538
538
  const append: ThreadStore["Service"]["append"] = Effect.fn("SqliteThreadStore.append")(function* (
539
539
  request: FencedAppendRequest,
540
540
  ) {
541
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(FencedAppendRequest))(
542
- request,
543
- ).pipe(Effect.mapError((error) => schemaStoreError("validate canonical append", error)));
541
+ const validated = yield* Schema.decodeEffect(Schema.toType(FencedAppendRequest))(request).pipe(
542
+ Effect.mapError((error) => schemaStoreError("validate canonical append", error)),
543
+ );
544
544
 
545
545
  yield* requireThread(journal, validated.threadId);
546
546
 
@@ -559,7 +559,7 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
559
559
  ),
560
560
  );
561
561
 
562
- const rawRequest = yield* Schema.decodeUnknownEffect(RawAppendRequest)({
562
+ const rawRequest = yield* Schema.decodeEffect(RawAppendRequest)({
563
563
  threadId: validated.threadId,
564
564
  batchId: validated.batch.batchId,
565
565
  batchDigest: tailDigest,
@@ -597,7 +597,7 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
597
597
  return storeError("append canonical batch", error);
598
598
  }),
599
599
  Effect.flatMap((result) =>
600
- Schema.decodeUnknownEffect(AppendResult)(result).pipe(
600
+ Schema.decodeEffect(AppendResult)(result).pipe(
601
601
  Effect.mapError((error) => schemaStoreError("decode append result", error)),
602
602
  ),
603
603
  ),
@@ -619,7 +619,7 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
619
619
  });
620
620
 
621
621
  const readEffect = Effect.fn("SqliteThreadStore.read")(function* (request: ThreadRead) {
622
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadRead))(request).pipe(
622
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadRead))(request).pipe(
623
623
  Effect.mapError((error) => schemaStoreError("validate thread read", error)),
624
624
  );
625
625
 
@@ -641,9 +641,9 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
641
641
  const observeEffect = Effect.fn("SqliteThreadStore.observe")(function* (
642
642
  request: ThreadObservation,
643
643
  ) {
644
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadObservation))(
645
- request,
646
- ).pipe(Effect.mapError((error) => schemaStoreError("validate thread observation", error)));
644
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadObservation))(request).pipe(
645
+ Effect.mapError((error) => schemaStoreError("validate thread observation", error)),
646
+ );
647
647
 
648
648
  yield* requireThread(journal, validated.threadId);
649
649
  const initialSequence = yield* parseOffset(validated.threadId, validated.afterOffset);
@@ -678,7 +678,7 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
678
678
 
679
679
  const exportThread: ThreadStore["Service"]["export"] = Effect.fn("SqliteThreadStore.export")(
680
680
  function* (request: ThreadExportRequest) {
681
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadExportRequest))(
681
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadExportRequest))(
682
682
  request,
683
683
  ).pipe(Effect.mapError((error) => schemaStoreError("validate thread export", error)));
684
684
 
@@ -697,9 +697,9 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
697
697
  });
698
698
  }
699
699
 
700
- const tailDigest = yield* Schema.decodeUnknownEffect(Digest)(
701
- exported.thread.tail_digest,
702
- ).pipe(Effect.mapError((error) => schemaStoreError("decode export tail digest", error)));
700
+ const tailDigest = yield* Schema.decodeEffect(Digest)(exported.thread.tail_digest).pipe(
701
+ Effect.mapError((error) => schemaStoreError("decode export tail digest", error)),
702
+ );
703
703
 
704
704
  return ThreadExport.make({
705
705
  format: "effect-agent/thread@1",
@@ -714,13 +714,13 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
714
714
  const inspectTail: ThreadStore["Service"]["inspectTail"] = Effect.fn(
715
715
  "SqliteThreadStore.inspectTail",
716
716
  )(function* (request: ThreadTailRequest) {
717
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadTailRequest))(
718
- request,
719
- ).pipe(Effect.mapError((error) => schemaStoreError("validate tail inspection", error)));
717
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadTailRequest))(request).pipe(
718
+ Effect.mapError((error) => schemaStoreError("validate tail inspection", error)),
719
+ );
720
720
 
721
721
  const thread = yield* requireThread(journal, validated.threadId);
722
722
 
723
- const tailDigest = yield* Schema.decodeUnknownEffect(Digest)(thread.tail_digest).pipe(
723
+ const tailDigest = yield* Schema.decodeEffect(Digest)(thread.tail_digest).pipe(
724
724
  Effect.mapError((error) => schemaStoreError("decode tail digest", error)),
725
725
  );
726
726
 
@@ -734,7 +734,7 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
734
734
 
735
735
  const saveCheckpoint: ThreadCheckpoints["save"] = Effect.fn("SqliteThreadStore.saveCheckpoint")(
736
736
  function* (request: SaveCheckpointRequest) {
737
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SaveCheckpointRequest))(
737
+ const validated = yield* Schema.decodeEffect(Schema.toType(SaveCheckpointRequest))(
738
738
  request,
739
739
  ).pipe(Effect.mapError((error) => schemaStoreError("validate checkpoint", error)));
740
740
 
@@ -785,7 +785,7 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
785
785
 
786
786
  const loadCheckpoint: ThreadCheckpoints["load"] = Effect.fn("SqliteThreadStore.loadCheckpoint")(
787
787
  function* (request: LoadCheckpointRequest) {
788
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(LoadCheckpointRequest))(
788
+ const validated = yield* Schema.decodeEffect(Schema.toType(LoadCheckpointRequest))(
789
789
  request,
790
790
  ).pipe(Effect.mapError((error) => schemaStoreError("validate checkpoint lookup", error)));
791
791
 
@@ -837,11 +837,9 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
837
837
  const saveRecoveryCheckpoint: ThreadRecoveryCheckpoints["save"] = Effect.fn(
838
838
  "SqliteThreadStore.saveRecoveryCheckpoint",
839
839
  )(function* (request) {
840
- const validated = yield* Schema.decodeUnknownEffect(
841
- Schema.toType(SaveRecoveryCheckpointRequest),
842
- )(request).pipe(
843
- Effect.mapError((error) => schemaStoreError("validate recovery checkpoint", error)),
844
- );
840
+ const validated = yield* Schema.decodeEffect(Schema.toType(SaveRecoveryCheckpointRequest))(
841
+ request,
842
+ ).pipe(Effect.mapError((error) => schemaStoreError("validate recovery checkpoint", error)));
845
843
 
846
844
  const checkpointJson = yield* encodeCheckpoint(validated.checkpoint);
847
845
 
@@ -861,7 +859,7 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
861
859
  const loadRecoveryCheckpoint: ThreadRecoveryCheckpoints["load"] = Effect.fn(
862
860
  "SqliteThreadStore.loadRecoveryCheckpoint",
863
861
  )(function* (request) {
864
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(LoadCheckpointRequest))(
862
+ const validated = yield* Schema.decodeEffect(Schema.toType(LoadCheckpointRequest))(
865
863
  request,
866
864
  ).pipe(
867
865
  Effect.mapError((error) => schemaStoreError("validate recovery checkpoint lookup", error)),
@@ -953,7 +951,7 @@ export const storageConfigLayer = (
953
951
  options: SqliteStorageOptions,
954
952
  ): Layer.Layer<SqliteStorageConfig, SqliteStorageError> =>
955
953
  Layer.effect(SqliteStorageConfig)(
956
- Schema.decodeUnknownEffect(SqliteStorageConfigValue)({
954
+ Schema.decodeEffect(SqliteStorageConfigValue)({
957
955
  observationPollInterval: options.observationPollInterval ?? 25,
958
956
  busyTimeout: options.busyTimeout ?? 5_000,
959
957
  ownershipLeaseDuration: