@effect-agent/storage-cloudflare 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 (44) hide show
  1. package/dist/DoMemoryStore.d.mts +3 -3
  2. package/dist/DoMemoryStore.mjs +3 -3
  3. package/dist/DoMemoryStore.mjs.map +1 -1
  4. package/dist/DoMessageDeliveryStore.d.mts +1 -1
  5. package/dist/DoMessageDeliveryStore.mjs +3 -3
  6. package/dist/DoMessageDeliveryStore.mjs.map +1 -1
  7. package/dist/DoScheduleStore.d.mts +1 -1
  8. package/dist/DoScheduleStore.mjs +5 -5
  9. package/dist/DoScheduleStore.mjs.map +1 -1
  10. package/dist/DoStorageError.mjs +1 -1
  11. package/dist/DoStorageError.mjs.map +1 -1
  12. package/dist/DoSubmissionLedger.d.mts +1 -1
  13. package/dist/DoSubmissionLedger.mjs +35 -35
  14. package/dist/DoSubmissionLedger.mjs.map +1 -1
  15. package/dist/DoSubscriptionStore.d.mts +1 -1
  16. package/dist/DoSubscriptionStore.mjs +4 -4
  17. package/dist/DoSubscriptionStore.mjs.map +1 -1
  18. package/dist/DoThreadStore.d.mts +2 -2
  19. package/dist/DoThreadStore.mjs +26 -26
  20. package/dist/DoThreadStore.mjs.map +1 -1
  21. package/dist/MemoryProtocol.d.mts +272 -272
  22. package/dist/MemoryProtocol.mjs +8 -8
  23. package/dist/MemoryProtocol.mjs.map +1 -1
  24. package/dist/PortProtocol.d.mts +645 -48
  25. package/dist/PortProtocol.mjs +3 -3
  26. package/dist/PortProtocol.mjs.map +1 -1
  27. package/dist/PortRouting.d.mts +2 -2
  28. package/dist/PortRouting.mjs +2 -2
  29. package/dist/PortRouting.mjs.map +1 -1
  30. package/dist/{do-journal-DHqCQeBU.mjs → do-journal-dJ01KSKf.mjs} +7 -7
  31. package/dist/do-journal-dJ01KSKf.mjs.map +1 -0
  32. package/package.json +1 -1
  33. package/src/DoMemoryStore.ts +3 -6
  34. package/src/DoMessageDeliveryStore.ts +3 -3
  35. package/src/DoScheduleStore.ts +6 -6
  36. package/src/DoStorageError.ts +1 -1
  37. package/src/DoSubmissionLedger.ts +67 -67
  38. package/src/DoSubscriptionStore.ts +6 -6
  39. package/src/DoThreadStore.ts +51 -53
  40. package/src/MemoryProtocol.ts +9 -13
  41. package/src/PortProtocol.ts +4 -4
  42. package/src/PortRouting.ts +3 -3
  43. package/src/internal/do-journal.ts +8 -8
  44. package/dist/do-journal-DHqCQeBU.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 { BrowserCrypto } from "@effect/platform-browser";
2
+ import { SqliteClient } from "@effect/sql-sqlite-do";
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 { BrowserCrypto } from "@effect/platform-browser";
87
- import { SqliteClient } from "@effect/sql-sqlite-do";
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
 
@@ -516,9 +516,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
516
516
  if (Option.isNone(ownership) || ownership.value.ownership_token !== ownershipToken) {
517
517
  const actualEpoch = yield* threadEpoch(operation, submission.thread_id);
518
518
 
519
- const submissionId = yield* Schema.decodeUnknownEffect(
520
- SubmissionSnapshot.fields.submissionId,
521
- )(submission.submission_id).pipe(Effect.mapError(internalFailure(operation)));
519
+ const submissionId = yield* Schema.decodeEffect(SubmissionSnapshot.fields.submissionId)(
520
+ submission.submission_id,
521
+ ).pipe(Effect.mapError(internalFailure(operation)));
522
522
 
523
523
  return yield* OwnershipLost.make({ submissionId, actualEpoch });
524
524
  }
@@ -1041,9 +1041,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1041
1041
  function* (request: AdmissionRequest) {
1042
1042
  const operation = "ledger admit";
1043
1043
 
1044
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AdmissionRequest))(
1045
- request,
1046
- ).pipe(Effect.mapError(internalFailure(operation)));
1044
+ const validated = yield* Schema.decodeEffect(Schema.toType(AdmissionRequest))(request).pipe(
1045
+ Effect.mapError(internalFailure(operation)),
1046
+ );
1047
1047
 
1048
1048
  const inputJson = yield* encodePersistedJsonText(validated.inputPayload).pipe(
1049
1049
  Effect.mapError(internalFailure(operation)),
@@ -1075,7 +1075,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1075
1075
  const messageAdmissionJson =
1076
1076
  validated.messageAdmission === undefined
1077
1077
  ? null
1078
- : yield* Schema.encodeEffect(Schema.fromJsonString(MessageAdmission))(
1078
+ : yield* Schema.encodeEffect(Schema.fromJsonString(InputMessage))(
1079
1079
  validated.messageAdmission,
1080
1080
  ).pipe(Effect.mapError(internalFailure(operation)));
1081
1081
 
@@ -1161,10 +1161,10 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1161
1161
  existing[0].worker_admission_json,
1162
1162
  ).pipe(Effect.mapError(internalFailure(operation)));
1163
1163
 
1164
- const retainedMessageAdmission =
1164
+ const retainedInputMessage =
1165
1165
  existing[0].message_admission_json === null
1166
1166
  ? undefined
1167
- : yield* Schema.decodeEffect(Schema.fromJsonString(MessageAdmission))(
1167
+ : yield* Schema.decodeEffect(Schema.fromJsonString(InputMessage))(
1168
1168
  existing[0].message_admission_json,
1169
1169
  ).pipe(Effect.mapError(internalFailure(operation)));
1170
1170
 
@@ -1181,8 +1181,8 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1181
1181
  retainedWorkerAdmission,
1182
1182
  validated.workerAdmission,
1183
1183
  ) ||
1184
- !Schema.toEquivalence(Schema.optional(MessageAdmission))(
1185
- retainedMessageAdmission,
1184
+ !Schema.toEquivalence(Schema.optional(InputMessage))(
1185
+ retainedInputMessage,
1186
1186
  validated.messageAdmission,
1187
1187
  ) ||
1188
1188
  !Schema.toEquivalence(Schema.optional(AdmissionFence))(
@@ -1340,9 +1340,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1340
1340
  )(function* (request: MarkReadyRequest) {
1341
1341
  const operation = "ledger mark ready";
1342
1342
 
1343
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkReadyRequest))(
1344
- request,
1345
- ).pipe(Effect.mapError(internalFailure(operation)));
1343
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkReadyRequest))(request).pipe(
1344
+ Effect.mapError(internalFailure(operation)),
1345
+ );
1346
1346
 
1347
1347
  yield* hitFailpoint("ledger:mark-ready:before", operation);
1348
1348
  yield* inWriteTransaction(
@@ -1367,9 +1367,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1367
1367
  function* (request: SubmissionLookup) {
1368
1368
  const operation = "ledger lookup";
1369
1369
 
1370
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SubmissionLookup))(
1371
- request,
1372
- ).pipe(Effect.mapError(internalFailure(operation)));
1370
+ const validated = yield* Schema.decodeEffect(Schema.toType(SubmissionLookup))(request).pipe(
1371
+ Effect.mapError(internalFailure(operation)),
1372
+ );
1373
1373
 
1374
1374
  if (validated._tag === "SubmissionLookupById") {
1375
1375
  const row = yield* readSubmission(operation, validated.submissionId);
@@ -1416,7 +1416,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1416
1416
  )(function* (request: SubmissionLookupByKey) {
1417
1417
  const operation = "ledger resolve admission";
1418
1418
 
1419
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SubmissionLookupByKey))(
1419
+ const validated = yield* Schema.decodeEffect(Schema.toType(SubmissionLookupByKey))(
1420
1420
  request,
1421
1421
  ).pipe(Effect.mapError(internalFailure(operation)));
1422
1422
 
@@ -1453,9 +1453,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1453
1453
  function* (request: ClaimRequest) {
1454
1454
  const operation = "ledger claim";
1455
1455
 
1456
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ClaimRequest))(
1457
- request,
1458
- ).pipe(Effect.mapError(internalFailure(operation)));
1456
+ const validated = yield* Schema.decodeEffect(Schema.toType(ClaimRequest))(request).pipe(
1457
+ Effect.mapError(internalFailure(operation)),
1458
+ );
1459
1459
 
1460
1460
  const attemptId = `attempt-${yield* mintUuid(operation)}`;
1461
1461
  const ownershipToken = `owner-${yield* mintUuid(operation)}`;
@@ -1630,7 +1630,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1630
1630
  )(function* (request: RenewOwnershipRequest) {
1631
1631
  const operation = "ledger renew ownership";
1632
1632
 
1633
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(RenewOwnershipRequest))(
1633
+ const validated = yield* Schema.decodeEffect(Schema.toType(RenewOwnershipRequest))(
1634
1634
  request,
1635
1635
  ).pipe(Effect.mapError(internalFailure(operation)));
1636
1636
 
@@ -1668,7 +1668,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1668
1668
  )(function* (request: ReleaseOwnershipRequest) {
1669
1669
  const operation = "ledger release ownership";
1670
1670
 
1671
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ReleaseOwnershipRequest))(
1671
+ const validated = yield* Schema.decodeEffect(Schema.toType(ReleaseOwnershipRequest))(
1672
1672
  request,
1673
1673
  ).pipe(Effect.mapError(internalFailure(operation)));
1674
1674
 
@@ -1700,7 +1700,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1700
1700
  )(function* (request: MarkInputAppliedRequest) {
1701
1701
  const operation = "ledger mark input applied";
1702
1702
 
1703
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkInputAppliedRequest))(
1703
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkInputAppliedRequest))(
1704
1704
  request,
1705
1705
  ).pipe(Effect.mapError(internalFailure(operation)));
1706
1706
 
@@ -1747,7 +1747,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1747
1747
  )(function* (request: SettlementReservation) {
1748
1748
  const operation = "ledger reserve settlement";
1749
1749
 
1750
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SettlementReservation))(
1750
+ const validated = yield* Schema.decodeEffect(Schema.toType(SettlementReservation))(
1751
1751
  request,
1752
1752
  ).pipe(Effect.mapError(internalFailure(operation)));
1753
1753
 
@@ -1963,7 +1963,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1963
1963
  )(function* (request: SettlementFinalization) {
1964
1964
  const operation = "ledger finalize settlement";
1965
1965
 
1966
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SettlementFinalization))(
1966
+ const validated = yield* Schema.decodeEffect(Schema.toType(SettlementFinalization))(
1967
1967
  request,
1968
1968
  ).pipe(Effect.mapError(internalFailure(operation)));
1969
1969
 
@@ -2070,7 +2070,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2070
2070
  )(function* (request: AbortCommand) {
2071
2071
  const operation = "ledger request abort";
2072
2072
 
2073
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AbortCommand))(request).pipe(
2073
+ const validated = yield* Schema.decodeEffect(Schema.toType(AbortCommand))(request).pipe(
2074
2074
  Effect.mapError(internalFailure(operation)),
2075
2075
  );
2076
2076
 
@@ -2170,9 +2170,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2170
2170
  )(function* (request: ClaimJoiningRequest) {
2171
2171
  const operation = "ledger claim joining";
2172
2172
 
2173
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ClaimJoiningRequest))(
2174
- request,
2175
- ).pipe(Effect.mapError(internalFailure(operation)));
2173
+ const validated = yield* Schema.decodeEffect(Schema.toType(ClaimJoiningRequest))(request).pipe(
2174
+ Effect.mapError(internalFailure(operation)),
2175
+ );
2176
2176
 
2177
2177
  yield* hitFailpoint("ledger:claim-joining:before", operation);
2178
2178
 
@@ -2258,9 +2258,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2258
2258
  )(function* (request: MarkJoinedRequest) {
2259
2259
  const operation = "ledger mark joined";
2260
2260
 
2261
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkJoinedRequest))(
2262
- request,
2263
- ).pipe(Effect.mapError(internalFailure(operation)));
2261
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkJoinedRequest))(request).pipe(
2262
+ Effect.mapError(internalFailure(operation)),
2263
+ );
2264
2264
 
2265
2265
  yield* hitFailpoint("ledger:mark-joined:before", operation);
2266
2266
  yield* inWriteTransaction(
@@ -2318,9 +2318,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2318
2318
  )(function* (request: RevertJoiningRequest) {
2319
2319
  const operation = "ledger revert joining";
2320
2320
 
2321
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(RevertJoiningRequest))(
2322
- request,
2323
- ).pipe(Effect.mapError(internalFailure(operation)));
2321
+ const validated = yield* Schema.decodeEffect(Schema.toType(RevertJoiningRequest))(request).pipe(
2322
+ Effect.mapError(internalFailure(operation)),
2323
+ );
2324
2324
 
2325
2325
  yield* hitFailpoint("ledger:revert-joining:before", operation);
2326
2326
  yield* inWriteTransaction(
@@ -2345,9 +2345,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2345
2345
  function* (request: SuspendRequest) {
2346
2346
  const operation = "ledger suspend";
2347
2347
 
2348
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SuspendRequest))(
2349
- request,
2350
- ).pipe(Effect.mapError(internalFailure(operation)));
2348
+ const validated = yield* Schema.decodeEffect(Schema.toType(SuspendRequest))(request).pipe(
2349
+ Effect.mapError(internalFailure(operation)),
2350
+ );
2351
2351
 
2352
2352
  const reasonJson = yield* encodeSuspensionReasonText(validated.reason).pipe(
2353
2353
  Effect.mapError(internalFailure(operation)),
@@ -2492,7 +2492,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2492
2492
  )(function* (command: ApprovalDecisionCommand) {
2493
2493
  const operation = "ledger record approval decision";
2494
2494
 
2495
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ApprovalDecisionCommand))(
2495
+ const validated = yield* Schema.decodeEffect(Schema.toType(ApprovalDecisionCommand))(
2496
2496
  command,
2497
2497
  ).pipe(Effect.mapError(internalFailure(operation)));
2498
2498
 
@@ -2576,9 +2576,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2576
2576
  )(function* (request: MarkUnknownRequest) {
2577
2577
  const operation = "ledger mark unknown";
2578
2578
 
2579
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkUnknownRequest))(
2580
- request,
2581
- ).pipe(Effect.mapError(internalFailure(operation)));
2579
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkUnknownRequest))(request).pipe(
2580
+ Effect.mapError(internalFailure(operation)),
2581
+ );
2582
2582
 
2583
2583
  yield* hitFailpoint("ledger:mark-unknown:before", operation);
2584
2584
  yield* inWriteTransaction(
@@ -2643,7 +2643,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2643
2643
  )(function* (command: UnknownResolutionCommand) {
2644
2644
  const operation = "ledger record unknown resolution";
2645
2645
 
2646
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(UnknownResolutionCommand))(
2646
+ const validated = yield* Schema.decodeEffect(Schema.toType(UnknownResolutionCommand))(
2647
2647
  command,
2648
2648
  ).pipe(Effect.mapError(internalFailure(operation)));
2649
2649
 
@@ -2764,7 +2764,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2764
2764
  )(function* (request: ChildSettledNotification) {
2765
2765
  const operation = "ledger record child settled";
2766
2766
 
2767
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ChildSettledNotification))(
2767
+ const validated = yield* Schema.decodeEffect(Schema.toType(ChildSettledNotification))(
2768
2768
  request,
2769
2769
  ).pipe(Effect.mapError(internalFailure(operation)));
2770
2770
 
@@ -2885,9 +2885,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2885
2885
  )(function* (request: ChildBudgetReservationRequest) {
2886
2886
  const operation = "ledger reserve child budget";
2887
2887
 
2888
- const validated = yield* Schema.decodeUnknownEffect(
2889
- Schema.toType(ChildBudgetReservationRequest),
2890
- )(request).pipe(Effect.mapError(internalFailure(operation)));
2888
+ const validated = yield* Schema.decodeEffect(Schema.toType(ChildBudgetReservationRequest))(
2889
+ request,
2890
+ ).pipe(Effect.mapError(internalFailure(operation)));
2891
2891
 
2892
2892
  const allocationJson = yield* encodePersistedJsonText(validated.allocation).pipe(
2893
2893
  Effect.mapError(internalFailure(operation)),
@@ -2997,9 +2997,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2997
2997
  ) {
2998
2998
  const operation = "ledger attach child to reservation";
2999
2999
 
3000
- const validated = yield* Schema.decodeUnknownEffect(
3001
- Schema.toType(AttachChildToReservationRequest),
3002
- )(request).pipe(Effect.mapError(internalFailure(operation)));
3000
+ const validated = yield* Schema.decodeEffect(Schema.toType(AttachChildToReservationRequest))(
3001
+ request,
3002
+ ).pipe(Effect.mapError(internalFailure(operation)));
3003
3003
 
3004
3004
  yield* hitFailpoint("ledger:child-attach:before", operation);
3005
3005
 
@@ -3070,9 +3070,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
3070
3070
  )(function* (request: BeginChildBudgetReleaseRequest) {
3071
3071
  const operation = "ledger begin child budget release";
3072
3072
 
3073
- const validated = yield* Schema.decodeUnknownEffect(
3074
- Schema.toType(BeginChildBudgetReleaseRequest),
3075
- )(request).pipe(Effect.mapError(internalFailure(operation)));
3073
+ const validated = yield* Schema.decodeEffect(Schema.toType(BeginChildBudgetReleaseRequest))(
3074
+ request,
3075
+ ).pipe(Effect.mapError(internalFailure(operation)));
3076
3076
 
3077
3077
  const accountingJson = yield* encodePersistedJsonText(validated.accounting).pipe(
3078
3078
  Effect.mapError(internalFailure(operation)),
@@ -3147,7 +3147,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
3147
3147
  )(function* (request: ReleaseChildBudgetRequest) {
3148
3148
  const operation = "ledger release child budget";
3149
3149
 
3150
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ReleaseChildBudgetRequest))(
3150
+ const validated = yield* Schema.decodeEffect(Schema.toType(ReleaseChildBudgetRequest))(
3151
3151
  request,
3152
3152
  ).pipe(Effect.mapError(internalFailure(operation)));
3153
3153
 
@@ -3265,9 +3265,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
3265
3265
  )(function* (request) {
3266
3266
  const operation = "ledger read abort intent";
3267
3267
 
3268
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AbortIntentRequest))(
3269
- request,
3270
- ).pipe(Effect.mapError(internalFailure(operation)));
3268
+ const validated = yield* Schema.decodeEffect(Schema.toType(AbortIntentRequest))(request).pipe(
3269
+ Effect.mapError(internalFailure(operation)),
3270
+ );
3271
3271
 
3272
3272
  const recordId = submissionAbortRecordId(validated.submissionId);
3273
3273
 
@@ -3336,7 +3336,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
3336
3336
  )(function* (request: RecoverySnapshotRequest) {
3337
3337
  const operation = "ledger load recovery snapshot";
3338
3338
 
3339
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(RecoverySnapshotRequest))(
3339
+ const validated = yield* Schema.decodeEffect(Schema.toType(RecoverySnapshotRequest))(
3340
3340
  request,
3341
3341
  ).pipe(Effect.mapError(internalFailure(operation)));
3342
3342
 
@@ -3385,7 +3385,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
3385
3385
  ),
3386
3386
  );
3387
3387
 
3388
- const settlementId = yield* Schema.decodeUnknownEffect(
3388
+ const settlementId = yield* Schema.decodeEffect(
3389
3389
  SettlementReservationSnapshot.fields.settlementId,
3390
3390
  )(reservationRow.value.settlement_id).pipe(Effect.mapError(internalFailure(operation)));
3391
3391
 
@@ -1,17 +1,17 @@
1
- import { upgradeV2Subscriptions } from "@effect-agent/thread/SqlStorageV2Upgrade";
1
+ import { BrowserCrypto } from "@effect/platform-browser";
2
+ import { Context, Effect, Layer, Schema } from "effect";
3
+ import { upgradeV2Subscriptions } from "effect-agent/sql-storage-v2-upgrade";
2
4
  import {
3
5
  makeSqlSubscriptionStore,
4
6
  SqlSubscriptionTransaction,
5
- } from "@effect-agent/thread/SqlSubscriptionStore";
7
+ } from "effect-agent/sql-subscription-store";
6
8
  import {
7
9
  SourcePartition,
8
10
  SubscriptionError,
9
11
  SubscriptionFailpoint,
10
12
  type SubscriptionFailpointError,
11
13
  SubscriptionStore,
12
- } from "@effect-agent/thread/Subscription";
13
- import { BrowserCrypto } from "@effect/platform-browser";
14
- import { Context, Effect, Layer, Schema } from "effect";
14
+ } from "effect-agent/subscription";
15
15
  import * as SqlClientService from "effect/unstable/sql/SqlClient";
16
16
  import type { SqlError } from "effect/unstable/sql/SqlError";
17
17
 
@@ -299,7 +299,7 @@ const makeSubscriptionStore = Effect.fn("DoSubscriptionStore.make")(function* (
299
299
 
300
300
  const store = yield* makeSqlSubscriptionStore(partition, {
301
301
  maxStoredJsonLength: 1_900_000,
302
- }).pipe(Effect.provide(Layer.succeed(SqlSubscriptionTransaction)({ run: transact })));
302
+ }).pipe(Effect.provideService(SqlSubscriptionTransaction, { run: transact }));
303
303
 
304
304
  const prearm = Effect.fn("DoSubscriptionStore.prearm")(function* (deadlineAtMillis: number) {
305
305
  yield* transactions.run((replace) => replaceAlarm(replace, deadlineAtMillis));
@@ -1,4 +1,18 @@
1
- import { digestCanonicalBatch, EMPTY_TAIL_DIGEST } from "@effect-agent/thread/Digest";
1
+ import { BrowserCrypto } from "@effect/platform-browser";
2
+ import { SqliteClient } from "@effect/sql-sqlite-do";
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 { BrowserCrypto } from "@effect/platform-browser";
36
- import { SqliteClient } from "@effect/sql-sqlite-do";
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 * as SqlClientService from "effect/unstable/sql/SqlClient";
50
50
 
51
51
  import {
@@ -81,7 +81,7 @@ export interface DoStorageOptions {
81
81
  readonly observationPollInterval?: number | undefined;
82
82
  /**
83
83
  * Submission ownership lease duration in milliseconds (D5). Defaults to
84
- * `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/thread`.
84
+ * `DEFAULT_OWNERSHIP_LEASE_DURATION` from `effect-agent/submission-ledger`.
85
85
  */
86
86
  readonly ownershipLeaseDuration?: number | undefined;
87
87
  /**
@@ -129,9 +129,9 @@ const makeOffset = Effect.fn(function* (
129
129
  threadId: ThreadMaterialization["threadId"],
130
130
  sequence: number,
131
131
  ): Effect.fn.Return<ObservationOffset, ThreadStoreError> {
132
- return yield* Schema.decodeUnknownEffect(CanonicalSequence)(sequence).pipe(
132
+ return yield* Schema.decodeEffect(CanonicalSequence)(sequence).pipe(
133
133
  Effect.flatMap((validatedSequence) =>
134
- Schema.decodeUnknownEffect(ObservationOffset)(
134
+ Schema.decodeEffect(ObservationOffset)(
135
135
  `${DO_OFFSET_PREFIX}${encodeURIComponent(threadId)}:${validatedSequence}`,
136
136
  ),
137
137
  ),
@@ -145,7 +145,7 @@ const parseOffset = Effect.fn(function* (
145
145
  ): Effect.fn.Return<CanonicalSequence, ThreadStoreError> {
146
146
  if (offset === undefined) return ZERO_CANONICAL_SEQUENCE;
147
147
 
148
- const text = yield* Schema.decodeUnknownEffect(OffsetText)(offset).pipe(
148
+ const text = yield* Schema.decodeEffect(OffsetText)(offset).pipe(
149
149
  Effect.mapError((error) => schemaStoreError("decode observation offset", error)),
150
150
  );
151
151
 
@@ -166,7 +166,7 @@ const parseOffset = Effect.fn(function* (
166
166
  });
167
167
  }
168
168
 
169
- return yield* Schema.decodeUnknownEffect(CanonicalSequence)(Number(sequenceText)).pipe(
169
+ return yield* Schema.decodeEffect(CanonicalSequence)(Number(sequenceText)).pipe(
170
170
  Effect.mapError((error) => schemaStoreError("decode observation offset", error)),
171
171
  );
172
172
  });
@@ -219,13 +219,13 @@ const decodeEnvelope = Effect.fn(function* (row: {
219
219
  ),
220
220
  );
221
221
 
222
- const threadId = yield* Schema.decodeUnknownEffect(CanonicalRecordEnvelope.fields.threadId)(
222
+ const threadId = yield* Schema.decodeEffect(CanonicalRecordEnvelope.fields.threadId)(
223
223
  row.thread_id,
224
224
  ).pipe(Effect.mapError((error) => schemaStoreError("decode thread identity", error)));
225
225
 
226
226
  const offset = yield* makeOffset(threadId, row.sequence);
227
227
 
228
- const batchId = yield* Schema.decodeUnknownEffect(CanonicalRecordEnvelope.fields.batchId)(
228
+ const batchId = yield* Schema.decodeEffect(CanonicalRecordEnvelope.fields.batchId)(
229
229
  row.batch_id,
230
230
  ).pipe(Effect.mapError((error) => schemaStoreError("decode batch identity", error)));
231
231
 
@@ -279,7 +279,7 @@ const tailDigestAt = Effect.fn("DoThreadStore.tailDigestAt")(function* (
279
279
  });
280
280
  }
281
281
 
282
- return yield* Schema.decodeUnknownEffect(Digest)(digests[0]).pipe(
282
+ return yield* Schema.decodeEffect(Digest)(digests[0]).pipe(
283
283
  Effect.mapError((error) => schemaStoreError("decode checkpoint digest", error)),
284
284
  );
285
285
  });
@@ -520,7 +520,7 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
520
520
 
521
521
  const materialize: ThreadStore["Service"]["materialize"] = Effect.fn("DoThreadStore.materialize")(
522
522
  function* (request: ThreadMaterialization) {
523
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadMaterialization))(
523
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadMaterialization))(
524
524
  request,
525
525
  ).pipe(Effect.mapError((error) => schemaStoreError("validate materialization", error)));
526
526
 
@@ -548,9 +548,9 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
548
548
  const append: ThreadStore["Service"]["append"] = Effect.fn("DoThreadStore.append")(function* (
549
549
  request: FencedAppendRequest,
550
550
  ) {
551
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(FencedAppendRequest))(
552
- request,
553
- ).pipe(Effect.mapError((error) => schemaStoreError("validate canonical append", error)));
551
+ const validated = yield* Schema.decodeEffect(Schema.toType(FencedAppendRequest))(request).pipe(
552
+ Effect.mapError((error) => schemaStoreError("validate canonical append", error)),
553
+ );
554
554
 
555
555
  yield* requireThread(journal, validated.threadId);
556
556
 
@@ -569,7 +569,7 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
569
569
  ),
570
570
  );
571
571
 
572
- const rawRequest = yield* Schema.decodeUnknownEffect(RawAppendRequest)({
572
+ const rawRequest = yield* Schema.decodeEffect(RawAppendRequest)({
573
573
  threadId: validated.threadId,
574
574
  batchId: validated.batch.batchId,
575
575
  batchDigest: tailDigest,
@@ -607,7 +607,7 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
607
607
  return storeError("append canonical batch", error);
608
608
  }),
609
609
  Effect.flatMap((result) =>
610
- Schema.decodeUnknownEffect(AppendResult)(result).pipe(
610
+ Schema.decodeEffect(AppendResult)(result).pipe(
611
611
  Effect.mapError((error) => schemaStoreError("decode append result", error)),
612
612
  ),
613
613
  ),
@@ -633,7 +633,7 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
633
633
  });
634
634
 
635
635
  const readEffect = Effect.fn("DoThreadStore.read")(function* (request: ThreadRead) {
636
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadRead))(request).pipe(
636
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadRead))(request).pipe(
637
637
  Effect.mapError((error) => schemaStoreError("validate thread read", error)),
638
638
  );
639
639
 
@@ -653,9 +653,9 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
653
653
  const read: ThreadStore["Service"]["read"] = (request) => Stream.unwrap(readEffect(request));
654
654
 
655
655
  const observeEffect = Effect.fn("DoThreadStore.observe")(function* (request: ThreadObservation) {
656
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadObservation))(
657
- request,
658
- ).pipe(Effect.mapError((error) => schemaStoreError("validate thread observation", error)));
656
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadObservation))(request).pipe(
657
+ Effect.mapError((error) => schemaStoreError("validate thread observation", error)),
658
+ );
659
659
 
660
660
  yield* requireThread(journal, validated.threadId);
661
661
  const initialSequence = yield* parseOffset(validated.threadId, validated.afterOffset);
@@ -689,7 +689,7 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
689
689
 
690
690
  const exportThread: ThreadStore["Service"]["export"] = Effect.fn("DoThreadStore.export")(
691
691
  function* (request: ThreadExportRequest) {
692
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadExportRequest))(
692
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadExportRequest))(
693
693
  request,
694
694
  ).pipe(Effect.mapError((error) => schemaStoreError("validate thread export", error)));
695
695
 
@@ -708,9 +708,9 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
708
708
  });
709
709
  }
710
710
 
711
- const tailDigest = yield* Schema.decodeUnknownEffect(Digest)(
712
- exported.thread.tail_digest,
713
- ).pipe(Effect.mapError((error) => schemaStoreError("decode export tail digest", error)));
711
+ const tailDigest = yield* Schema.decodeEffect(Digest)(exported.thread.tail_digest).pipe(
712
+ Effect.mapError((error) => schemaStoreError("decode export tail digest", error)),
713
+ );
714
714
 
715
715
  return ThreadExport.make({
716
716
  format: "effect-agent/thread@1",
@@ -724,13 +724,13 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
724
724
 
725
725
  const inspectTail: ThreadStore["Service"]["inspectTail"] = Effect.fn("DoThreadStore.inspectTail")(
726
726
  function* (request: ThreadTailRequest) {
727
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ThreadTailRequest))(
728
- request,
729
- ).pipe(Effect.mapError((error) => schemaStoreError("validate tail inspection", error)));
727
+ const validated = yield* Schema.decodeEffect(Schema.toType(ThreadTailRequest))(request).pipe(
728
+ Effect.mapError((error) => schemaStoreError("validate tail inspection", error)),
729
+ );
730
730
 
731
731
  const thread = yield* requireThread(journal, validated.threadId);
732
732
 
733
- const tailDigest = yield* Schema.decodeUnknownEffect(Digest)(thread.tail_digest).pipe(
733
+ const tailDigest = yield* Schema.decodeEffect(Digest)(thread.tail_digest).pipe(
734
734
  Effect.mapError((error) => schemaStoreError("decode tail digest", error)),
735
735
  );
736
736
 
@@ -745,7 +745,7 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
745
745
 
746
746
  const saveCheckpoint: ThreadCheckpoints["save"] = Effect.fn("DoThreadStore.saveCheckpoint")(
747
747
  function* (request: SaveCheckpointRequest) {
748
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SaveCheckpointRequest))(
748
+ const validated = yield* Schema.decodeEffect(Schema.toType(SaveCheckpointRequest))(
749
749
  request,
750
750
  ).pipe(Effect.mapError((error) => schemaStoreError("validate checkpoint", error)));
751
751
 
@@ -796,7 +796,7 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
796
796
 
797
797
  const loadCheckpoint: ThreadCheckpoints["load"] = Effect.fn("DoThreadStore.loadCheckpoint")(
798
798
  function* (request: LoadCheckpointRequest) {
799
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(LoadCheckpointRequest))(
799
+ const validated = yield* Schema.decodeEffect(Schema.toType(LoadCheckpointRequest))(
800
800
  request,
801
801
  ).pipe(Effect.mapError((error) => schemaStoreError("validate checkpoint lookup", error)));
802
802
 
@@ -848,11 +848,9 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
848
848
  const saveRecoveryCheckpoint: ThreadRecoveryCheckpoints["save"] = Effect.fn(
849
849
  "DoThreadStore.saveRecoveryCheckpoint",
850
850
  )(function* (request) {
851
- const validated = yield* Schema.decodeUnknownEffect(
852
- Schema.toType(SaveRecoveryCheckpointRequest),
853
- )(request).pipe(
854
- Effect.mapError((error) => schemaStoreError("validate recovery checkpoint", error)),
855
- );
851
+ const validated = yield* Schema.decodeEffect(Schema.toType(SaveRecoveryCheckpointRequest))(
852
+ request,
853
+ ).pipe(Effect.mapError((error) => schemaStoreError("validate recovery checkpoint", error)));
856
854
 
857
855
  const checkpointJson = yield* encodeCheckpoint(validated.checkpoint);
858
856
 
@@ -872,7 +870,7 @@ const makeServices = Effect.fn("DoThreadStore.makeServices")(function* () {
872
870
  const loadRecoveryCheckpoint: ThreadRecoveryCheckpoints["load"] = Effect.fn(
873
871
  "DoThreadStore.loadRecoveryCheckpoint",
874
872
  )(function* (request) {
875
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(LoadCheckpointRequest))(
873
+ const validated = yield* Schema.decodeEffect(Schema.toType(LoadCheckpointRequest))(
876
874
  request,
877
875
  ).pipe(
878
876
  Effect.mapError((error) => schemaStoreError("validate recovery checkpoint lookup", error)),
@@ -964,7 +962,7 @@ export const storageConfigLayer = (
964
962
  options: DoStorageOptions,
965
963
  ): Layer.Layer<DoStorageConfig, DoStorageError> =>
966
964
  Layer.effect(DoStorageConfig)(
967
- Schema.decodeUnknownEffect(DoStorageConfigValue)({
965
+ Schema.decodeEffect(DoStorageConfigValue)({
968
966
  observationPollInterval: options.observationPollInterval ?? 25,
969
967
  ownershipLeaseDuration:
970
968
  options.ownershipLeaseDuration ?? Duration.toMillis(DEFAULT_OWNERSHIP_LEASE_DURATION),