@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
@@ -2,16 +2,16 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  import { DoStorageConfig } from "./DoStorageConfig.mjs";
3
3
  import { DoStorageFailpoint } from "./DoStorageFailpoint.mjs";
4
4
  import { DoLedgerError, DoStorageCorruptionError, DoStorageError } from "./DoStorageError.mjs";
5
- import { a as initializeDoJournal, i as decodeRows } from "./do-journal-DHqCQeBU.mjs";
5
+ import { a as initializeDoJournal, i as decodeRows } from "./do-journal-dJ01KSKf.mjs";
6
6
  import { storageConfigLayer, storageFailpointLayer } from "./DoThreadStore.mjs";
7
7
  import { Clock, Context, Crypto, DateTime, Effect, Layer, Option, Schema, Stream } from "effect";
8
8
  import * as SqlClientService from "effect/unstable/sql/SqlClient";
9
- import { EMPTY_TAIL_DIGEST } from "@effect-agent/thread/Digest";
10
- import { ApprovalDecision, CanonicalSequence, DefinitionDigests, Digest, PersistedJson, ProducerEpoch, RecordEnvelope, SettlementOutcome, WorkerAdmission } from "@effect-agent/thread/Records";
11
9
  import { SqliteClient } from "@effect/sql-sqlite-do";
12
- import { MessageAdmission } from "@effect-agent/core/Messaging";
13
- import { AbortCommand, AbortIntent, AbortIntentRequest, AdmissionAdmitted, AdmissionConflict, AdmissionFence, AdmissionGroup, AdmissionNotAdmitted, AdmissionPolicyError, AdmissionRequest, AdmissionResult, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, AttachChildToReservationRequest, BeginChildBudgetReleaseRequest, ChildAttachmentSnapshot, ChildBudgetReservationRequest, ChildBudgetReservationSnapshot, ChildReservationConflict, ChildReservationStatus, ChildSettledNotification, Claim, ClaimJoiningRequest, ClaimRequest, InputAppliedMarker, JoinSnapshot, JoinedToHost, JoiningClaim, LedgerCapabilities, LedgerError, MarkInputAppliedRequest, MarkJoinedRequest, MarkReadyRequest, MarkUnknownRequest, OwnershipLost, OwnershipRenewal, OwnershipSnapshot, ParentLinkage, QueueSequence, RecoverySnapshot, RecoverySnapshotRequest, ReleaseChildBudgetRequest, ReleaseOwnershipRequest, RenewOwnershipRequest, ReservedChildBudget, ReservedSettlement, RevertJoiningRequest, Settlement, SettlementConflict, SettlementFinalization, SettlementReservation, SettlementReservationSnapshot, SubmissionAdmissionFence, SubmissionLedger, SubmissionLookup, SubmissionLookupByKey, SubmissionSnapshot, SubmissionState, SuspendRequest, SuspensionReason, SuspensionSnapshot, UnknownResolution, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, settlementFailureFromRecord, submissionAbortRecordId } from "@effect-agent/thread/SubmissionLedger";
10
+ import { EMPTY_TAIL_DIGEST } from "effect-agent/digest";
11
+ import { ApprovalDecision, CanonicalSequence, DefinitionDigests, Digest, PersistedJson, ProducerEpoch, RecordEnvelope, SettlementOutcome, WorkerAdmission } from "effect-agent/records";
14
12
  import { BrowserCrypto } from "@effect/platform-browser";
13
+ import { InputMessage } from "effect-agent/messaging";
14
+ import { AbortCommand, AbortIntent, AbortIntentRequest, AdmissionAdmitted, AdmissionConflict, AdmissionFence, AdmissionGroup, AdmissionNotAdmitted, AdmissionPolicyError, AdmissionRequest, AdmissionResult, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, AttachChildToReservationRequest, BeginChildBudgetReleaseRequest, ChildAttachmentSnapshot, ChildBudgetReservationRequest, ChildBudgetReservationSnapshot, ChildReservationConflict, ChildReservationStatus, ChildSettledNotification, Claim, ClaimJoiningRequest, ClaimRequest, InputAppliedMarker, JoinSnapshot, JoinedToHost, JoiningClaim, LedgerCapabilities, LedgerError, MarkInputAppliedRequest, MarkJoinedRequest, MarkReadyRequest, MarkUnknownRequest, OwnershipLost, OwnershipRenewal, OwnershipSnapshot, ParentLinkage, QueueSequence, RecoverySnapshot, RecoverySnapshotRequest, ReleaseChildBudgetRequest, ReleaseOwnershipRequest, RenewOwnershipRequest, ReservedChildBudget, ReservedSettlement, RevertJoiningRequest, Settlement, SettlementConflict, SettlementFinalization, SettlementReservation, SettlementReservationSnapshot, SubmissionAdmissionFence, SubmissionLedger, SubmissionLookup, SubmissionLookupByKey, SubmissionSnapshot, SubmissionState, SuspendRequest, SuspensionReason, SuspensionSnapshot, UnknownResolution, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, settlementFailureFromRecord, submissionAbortRecordId } from "effect-agent/submission-ledger";
15
15
  //#region src/DoSubmissionLedger.ts
16
16
  var DoSubmissionLedger_exports = /* @__PURE__ */ __exportAll({
17
17
  ledgerLayer: () => ledgerLayer,
@@ -298,7 +298,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
298
298
  const ownership = yield* readOwnership(operation, submission.submission_id);
299
299
  if (Option.isNone(ownership) || ownership.value.ownership_token !== ownershipToken) {
300
300
  const actualEpoch = yield* threadEpoch(operation, submission.thread_id);
301
- const submissionId = yield* Schema.decodeUnknownEffect(SubmissionSnapshot.fields.submissionId)(submission.submission_id).pipe(Effect.mapError(internalFailure(operation)));
301
+ const submissionId = yield* Schema.decodeEffect(SubmissionSnapshot.fields.submissionId)(submission.submission_id).pipe(Effect.mapError(internalFailure(operation)));
302
302
  return yield* OwnershipLost.make({
303
303
  submissionId,
304
304
  actualEpoch
@@ -522,7 +522,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
522
522
  const capabilities = Effect.succeed(LedgerCapabilities.make({ durability: "durable-cloudflare" }));
523
523
  const admit = Effect.fn("DoSubmissionLedger.admit")(function* (request) {
524
524
  const operation = "ledger admit";
525
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AdmissionRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
525
+ const validated = yield* Schema.decodeEffect(Schema.toType(AdmissionRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
526
526
  const inputJson = yield* encodePersistedJsonText(validated.inputPayload).pipe(Effect.mapError(internalFailure(operation)));
527
527
  yield* journal.checkValueBound(operation, inputJson).pipe(Effect.mapError(internalFailure(operation)));
528
528
  const workerAdmissionJson = validated.workerAdmission === void 0 ? null : yield* Schema.encodeEffect(Schema.fromJsonString(WorkerAdmission))(validated.workerAdmission).pipe(Effect.mapError(internalFailure(operation)));
@@ -530,7 +530,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
530
530
  operation,
531
531
  message: "Worker admission metadata exceeds the stored value bound"
532
532
  });
533
- const messageAdmissionJson = validated.messageAdmission === void 0 ? null : yield* Schema.encodeEffect(Schema.fromJsonString(MessageAdmission))(validated.messageAdmission).pipe(Effect.mapError(internalFailure(operation)));
533
+ const messageAdmissionJson = validated.messageAdmission === void 0 ? null : yield* Schema.encodeEffect(Schema.fromJsonString(InputMessage))(validated.messageAdmission).pipe(Effect.mapError(internalFailure(operation)));
534
534
  if (messageAdmissionJson !== null && new TextEncoder().encode(messageAdmissionJson).byteLength > config.maxStoredValueBytes) return yield* LedgerError.make({
535
535
  operation,
536
536
  message: "Message admission metadata exceeds the stored value bound"
@@ -564,9 +564,9 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
564
564
  attemptedInputDigest: validated.inputDigest
565
565
  });
566
566
  const retainedWorkerAdmission = existing[0].worker_admission_json === null ? void 0 : yield* Schema.decodeEffect(Schema.fromJsonString(WorkerAdmission))(existing[0].worker_admission_json).pipe(Effect.mapError(internalFailure(operation)));
567
- const retainedMessageAdmission = existing[0].message_admission_json === null ? void 0 : yield* Schema.decodeEffect(Schema.fromJsonString(MessageAdmission))(existing[0].message_admission_json).pipe(Effect.mapError(internalFailure(operation)));
567
+ const retainedInputMessage = existing[0].message_admission_json === null ? void 0 : yield* Schema.decodeEffect(Schema.fromJsonString(InputMessage))(existing[0].message_admission_json).pipe(Effect.mapError(internalFailure(operation)));
568
568
  const retainedFence = existing[0].admission_fence_json === null ? void 0 : yield* Schema.decodeEffect(Schema.fromJsonString(AdmissionFence))(existing[0].admission_fence_json).pipe(Effect.mapError(internalFailure(operation)));
569
- if ((existing[0].admission_group ?? void 0) !== validated.admissionGroup || !Schema.toEquivalence(Schema.optional(WorkerAdmission))(retainedWorkerAdmission, validated.workerAdmission) || !Schema.toEquivalence(Schema.optional(MessageAdmission))(retainedMessageAdmission, validated.messageAdmission) || !Schema.toEquivalence(Schema.optional(AdmissionFence))(retainedFence, validated.admissionFence)) return yield* AdmissionConflict.make({
569
+ if ((existing[0].admission_group ?? void 0) !== validated.admissionGroup || !Schema.toEquivalence(Schema.optional(WorkerAdmission))(retainedWorkerAdmission, validated.workerAdmission) || !Schema.toEquivalence(Schema.optional(InputMessage))(retainedInputMessage, validated.messageAdmission) || !Schema.toEquivalence(Schema.optional(AdmissionFence))(retainedFence, validated.admissionFence)) return yield* AdmissionConflict.make({
570
570
  threadId: validated.threadId,
571
571
  principal: validated.principal,
572
572
  idempotencyKey: validated.idempotencyKey,
@@ -667,7 +667,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
667
667
  });
668
668
  const markReady = Effect.fn("DoSubmissionLedger.markReady")(function* (request) {
669
669
  const operation = "ledger mark ready";
670
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkReadyRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
670
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkReadyRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
671
671
  yield* hitFailpoint("ledger:mark-ready:before", operation);
672
672
  yield* inWriteTransaction(operation, Effect.gen(function* () {
673
673
  if ((yield* requireSubmission(operation, validated.submissionId)).state !== "admitted") return;
@@ -682,7 +682,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
682
682
  });
683
683
  const lookup = Effect.fn("DoSubmissionLedger.lookup")(function* (request) {
684
684
  const operation = "ledger lookup";
685
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SubmissionLookup))(request).pipe(Effect.mapError(internalFailure(operation)));
685
+ const validated = yield* Schema.decodeEffect(Schema.toType(SubmissionLookup))(request).pipe(Effect.mapError(internalFailure(operation)));
686
686
  if (validated._tag === "SubmissionLookupById") {
687
687
  const row = yield* readSubmission(operation, validated.submissionId);
688
688
  if (Option.isNone(row)) return Option.none();
@@ -702,7 +702,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
702
702
  });
703
703
  const resolveAdmission = Effect.fn("DoSubmissionLedger.resolveAdmission")(function* (request) {
704
704
  const operation = "ledger resolve admission";
705
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SubmissionLookupByKey))(request).pipe(Effect.mapError(internalFailure(operation)));
705
+ const validated = yield* Schema.decodeEffect(Schema.toType(SubmissionLookupByKey))(request).pipe(Effect.mapError(internalFailure(operation)));
706
706
  const rows = yield* sql`
707
707
  SELECT ${sql.literal(SUBMISSION_COLUMNS)}
708
708
  FROM effect_agent_submissions
@@ -717,7 +717,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
717
717
  });
718
718
  const claim = Effect.fn("DoSubmissionLedger.claim")(function* (request) {
719
719
  const operation = "ledger claim";
720
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ClaimRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
720
+ const validated = yield* Schema.decodeEffect(Schema.toType(ClaimRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
721
721
  const attemptId = `attempt-${yield* mintUuid(operation)}`;
722
722
  const ownershipToken = `owner-${yield* mintUuid(operation)}`;
723
723
  yield* hitFailpoint("ledger:claim:before", operation);
@@ -827,7 +827,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
827
827
  });
828
828
  const renewOwnership = Effect.fn("DoSubmissionLedger.renewOwnership")(function* (request) {
829
829
  const operation = "ledger renew ownership";
830
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(RenewOwnershipRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
830
+ const validated = yield* Schema.decodeEffect(Schema.toType(RenewOwnershipRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
831
831
  yield* hitFailpoint("ledger:renew:before", operation);
832
832
  const renewal = yield* inWriteTransaction(operation, Effect.gen(function* () {
833
833
  const submission = yield* requireSubmission(operation, validated.submissionId);
@@ -849,7 +849,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
849
849
  });
850
850
  const releaseOwnership = Effect.fn("DoSubmissionLedger.releaseOwnership")(function* (request) {
851
851
  const operation = "ledger release ownership";
852
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ReleaseOwnershipRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
852
+ const validated = yield* Schema.decodeEffect(Schema.toType(ReleaseOwnershipRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
853
853
  yield* hitFailpoint("ledger:release:before", operation);
854
854
  yield* inWriteTransaction(operation, Effect.gen(function* () {
855
855
  const submission = yield* requireSubmission(operation, validated.submissionId);
@@ -868,7 +868,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
868
868
  });
869
869
  const markInputApplied = Effect.fn("DoSubmissionLedger.markInputApplied")(function* (request) {
870
870
  const operation = "ledger mark input applied";
871
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkInputAppliedRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
871
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkInputAppliedRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
872
872
  yield* hitFailpoint("ledger:mark-input-applied:before", operation);
873
873
  yield* inWriteTransaction(operation, Effect.gen(function* () {
874
874
  const submission = yield* requireSubmission(operation, validated.submissionId);
@@ -893,7 +893,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
893
893
  });
894
894
  const reserveSettlement = Effect.fn("DoSubmissionLedger.reserveSettlement")(function* (request) {
895
895
  const operation = "ledger reserve settlement";
896
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SettlementReservation))(request).pipe(Effect.mapError(internalFailure(operation)));
896
+ const validated = yield* Schema.decodeEffect(Schema.toType(SettlementReservation))(request).pipe(Effect.mapError(internalFailure(operation)));
897
897
  const recordJson = yield* encodeRecordEnvelopeText(validated.record).pipe(Effect.mapError(internalFailure(operation)));
898
898
  yield* journal.checkValueBound(operation, recordJson).pipe(Effect.mapError(internalFailure(operation)));
899
899
  yield* hitFailpoint("ledger:reserve-settlement:before", operation);
@@ -1002,7 +1002,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1002
1002
  });
1003
1003
  const finalizeSettlement = Effect.fn("DoSubmissionLedger.finalizeSettlement")(function* (request) {
1004
1004
  const operation = "ledger finalize settlement";
1005
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SettlementFinalization))(request).pipe(Effect.mapError(internalFailure(operation)));
1005
+ const validated = yield* Schema.decodeEffect(Schema.toType(SettlementFinalization))(request).pipe(Effect.mapError(internalFailure(operation)));
1006
1006
  yield* hitFailpoint("ledger:finalize-settlement:before", operation);
1007
1007
  const replayRows = yield* sql`
1008
1008
  SELECT submission.*, reservation.settlement_id, reservation.outcome,
@@ -1057,7 +1057,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1057
1057
  });
1058
1058
  const requestAbort = Effect.fn("DoSubmissionLedger.requestAbort")(function* (request) {
1059
1059
  const operation = "ledger request abort";
1060
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AbortCommand))(request).pipe(Effect.mapError(internalFailure(operation)));
1060
+ const validated = yield* Schema.decodeEffect(Schema.toType(AbortCommand))(request).pipe(Effect.mapError(internalFailure(operation)));
1061
1061
  yield* hitFailpoint("ledger:request-abort:before", operation);
1062
1062
  const intent = yield* inWriteTransaction(operation, Effect.gen(function* () {
1063
1063
  const submission = yield* requireSubmission(operation, validated.submissionId);
@@ -1106,7 +1106,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1106
1106
  });
1107
1107
  const claimJoining = Effect.fn("DoSubmissionLedger.claimJoining")(function* (request) {
1108
1108
  const operation = "ledger claim joining";
1109
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ClaimJoiningRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1109
+ const validated = yield* Schema.decodeEffect(Schema.toType(ClaimJoiningRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1110
1110
  yield* hitFailpoint("ledger:claim-joining:before", operation);
1111
1111
  const claims = yield* inWriteTransaction(operation, Effect.gen(function* () {
1112
1112
  const host = yield* requireSubmission(operation, validated.hostSubmissionId);
@@ -1148,7 +1148,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1148
1148
  });
1149
1149
  const markJoined = Effect.fn("DoSubmissionLedger.markJoined")(function* (request) {
1150
1150
  const operation = "ledger mark joined";
1151
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkJoinedRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1151
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkJoinedRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1152
1152
  yield* hitFailpoint("ledger:mark-joined:before", operation);
1153
1153
  yield* inWriteTransaction(operation, Effect.gen(function* () {
1154
1154
  const submission = yield* requireSubmission(operation, validated.submissionId);
@@ -1179,7 +1179,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1179
1179
  });
1180
1180
  const revertJoining = Effect.fn("DoSubmissionLedger.revertJoining")(function* (request) {
1181
1181
  const operation = "ledger revert joining";
1182
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(RevertJoiningRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1182
+ const validated = yield* Schema.decodeEffect(Schema.toType(RevertJoiningRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1183
1183
  yield* hitFailpoint("ledger:revert-joining:before", operation);
1184
1184
  yield* inWriteTransaction(operation, Effect.gen(function* () {
1185
1185
  if ((yield* requireSubmission(operation, validated.submissionId)).state !== "joining") return;
@@ -1193,7 +1193,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1193
1193
  });
1194
1194
  const suspend = Effect.fn("DoSubmissionLedger.suspend")(function* (request) {
1195
1195
  const operation = "ledger suspend";
1196
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(SuspendRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1196
+ const validated = yield* Schema.decodeEffect(Schema.toType(SuspendRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1197
1197
  const reasonJson = yield* encodeSuspensionReasonText(validated.reason).pipe(Effect.mapError(internalFailure(operation)));
1198
1198
  yield* hitFailpoint("ledger:suspend:before", operation);
1199
1199
  const outcome = yield* inWriteTransaction(operation, Effect.gen(function* () {
@@ -1267,7 +1267,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1267
1267
  });
1268
1268
  const recordApprovalDecision = Effect.fn("DoSubmissionLedger.recordApprovalDecision")(function* (command) {
1269
1269
  const operation = "ledger record approval decision";
1270
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ApprovalDecisionCommand))(command).pipe(Effect.mapError(internalFailure(operation)));
1270
+ const validated = yield* Schema.decodeEffect(Schema.toType(ApprovalDecisionCommand))(command).pipe(Effect.mapError(internalFailure(operation)));
1271
1271
  yield* hitFailpoint("ledger:approval-decision:before", operation);
1272
1272
  const intent = yield* inWriteTransaction(operation, Effect.gen(function* () {
1273
1273
  const submission = yield* requireSubmission(operation, validated.submissionId);
@@ -1320,7 +1320,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1320
1320
  });
1321
1321
  const markUnknown = Effect.fn("DoSubmissionLedger.markUnknown")(function* (request) {
1322
1322
  const operation = "ledger mark unknown";
1323
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(MarkUnknownRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1323
+ const validated = yield* Schema.decodeEffect(Schema.toType(MarkUnknownRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1324
1324
  yield* hitFailpoint("ledger:mark-unknown:before", operation);
1325
1325
  yield* inWriteTransaction(operation, Effect.gen(function* () {
1326
1326
  const submission = yield* requireSubmission(operation, validated.submissionId);
@@ -1353,7 +1353,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1353
1353
  });
1354
1354
  const recordUnknownResolution = Effect.fn("DoSubmissionLedger.recordUnknownResolution")(function* (command) {
1355
1355
  const operation = "ledger record unknown resolution";
1356
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(UnknownResolutionCommand))(command).pipe(Effect.mapError(internalFailure(operation)));
1356
+ const validated = yield* Schema.decodeEffect(Schema.toType(UnknownResolutionCommand))(command).pipe(Effect.mapError(internalFailure(operation)));
1357
1357
  const resolutionJson = yield* encodeUnknownResolutionText(validated.resolution).pipe(Effect.mapError(internalFailure(operation)));
1358
1358
  yield* hitFailpoint("ledger:unknown-resolution:before", operation);
1359
1359
  const intent = yield* inWriteTransaction(operation, Effect.gen(function* () {
@@ -1422,7 +1422,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1422
1422
  });
1423
1423
  const recordChildSettled = Effect.fn("DoSubmissionLedger.recordChildSettled")(function* (request) {
1424
1424
  const operation = "ledger record child settled";
1425
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ChildSettledNotification))(request).pipe(Effect.mapError(internalFailure(operation)));
1425
+ const validated = yield* Schema.decodeEffect(Schema.toType(ChildSettledNotification))(request).pipe(Effect.mapError(internalFailure(operation)));
1426
1426
  yield* hitFailpoint("ledger:child-settled:before", operation);
1427
1427
  const outcome = yield* inWriteTransaction(operation, Effect.gen(function* () {
1428
1428
  const parent = yield* requireSubmission(operation, validated.parentSubmissionId);
@@ -1469,7 +1469,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1469
1469
  });
1470
1470
  const reserveChildBudget = Effect.fn("DoSubmissionLedger.reserveChildBudget")(function* (request) {
1471
1471
  const operation = "ledger reserve child budget";
1472
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ChildBudgetReservationRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1472
+ const validated = yield* Schema.decodeEffect(Schema.toType(ChildBudgetReservationRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1473
1473
  const allocationJson = yield* encodePersistedJsonText(validated.allocation).pipe(Effect.mapError(internalFailure(operation)));
1474
1474
  yield* hitFailpoint("ledger:child-reservation:before", operation);
1475
1475
  const reserved = yield* inWriteTransaction(operation, Effect.gen(function* () {
@@ -1526,7 +1526,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1526
1526
  });
1527
1527
  const attachChildToReservation = Effect.fn("DoSubmissionLedger.attachChildToReservation")(function* (request) {
1528
1528
  const operation = "ledger attach child to reservation";
1529
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AttachChildToReservationRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1529
+ const validated = yield* Schema.decodeEffect(Schema.toType(AttachChildToReservationRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1530
1530
  yield* hitFailpoint("ledger:child-attach:before", operation);
1531
1531
  const attached = yield* inWriteTransaction(operation, Effect.gen(function* () {
1532
1532
  const existing = yield* readChildReservation(operation, validated.reservationId);
@@ -1563,7 +1563,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1563
1563
  });
1564
1564
  const beginChildBudgetRelease = Effect.fn("DoSubmissionLedger.beginChildBudgetRelease")(function* (request) {
1565
1565
  const operation = "ledger begin child budget release";
1566
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(BeginChildBudgetReleaseRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1566
+ const validated = yield* Schema.decodeEffect(Schema.toType(BeginChildBudgetReleaseRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1567
1567
  const accountingJson = yield* encodePersistedJsonText(validated.accounting).pipe(Effect.mapError(internalFailure(operation)));
1568
1568
  yield* hitFailpoint("ledger:child-release-pending:before", operation);
1569
1569
  const frozen = yield* inWriteTransaction(operation, Effect.gen(function* () {
@@ -1599,7 +1599,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1599
1599
  });
1600
1600
  const releaseChildBudget = Effect.fn("DoSubmissionLedger.releaseChildBudget")(function* (request) {
1601
1601
  const operation = "ledger release child budget";
1602
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ReleaseChildBudgetRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1602
+ const validated = yield* Schema.decodeEffect(Schema.toType(ReleaseChildBudgetRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1603
1603
  yield* hitFailpoint("ledger:child-release:before", operation);
1604
1604
  const released = yield* inWriteTransaction(operation, Effect.gen(function* () {
1605
1605
  const existing = yield* readChildReservation(operation, validated.reservationId);
@@ -1653,7 +1653,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1653
1653
  const scanNonterminal = Stream.paginate(void 0, scanPage);
1654
1654
  const readAbortIntentForSubmission = Effect.fn("DoSubmissionLedger.readAbortIntentForSubmission")(function* (request) {
1655
1655
  const operation = "ledger read abort intent";
1656
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(AbortIntentRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1656
+ const validated = yield* Schema.decodeEffect(Schema.toType(AbortIntentRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1657
1657
  const recordId = submissionAbortRecordId(validated.submissionId);
1658
1658
  const rows = yield* sql`
1659
1659
  SELECT
@@ -1689,7 +1689,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1689
1689
  });
1690
1690
  const loadRecoverySnapshot = Effect.fn("DoSubmissionLedger.loadRecoverySnapshot")(function* (request) {
1691
1691
  const operation = "ledger load recovery snapshot";
1692
- const validated = yield* Schema.decodeUnknownEffect(Schema.toType(RecoverySnapshotRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1692
+ const validated = yield* Schema.decodeEffect(Schema.toType(RecoverySnapshotRequest))(request).pipe(Effect.mapError(internalFailure(operation)));
1693
1693
  return yield* sql.withTransaction(Effect.gen(function* () {
1694
1694
  const submissionRow = yield* requireSubmission(operation, validated.submissionId);
1695
1695
  const submission = yield* decodeSubmissionSnapshot(operation, submissionRow);
@@ -1710,7 +1710,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1710
1710
  const reservationRow = yield* readReservation(operation, validated.submissionId);
1711
1711
  if (Option.isSome(reservationRow)) {
1712
1712
  const record = yield* decodeRecordEnvelopeText(reservationRow.value.record_json).pipe(Effect.mapError((error) => corruptionFailure(operation, "effect_agent_settlement_reservations", validated.submissionId, error.message)));
1713
- const settlementId = yield* Schema.decodeUnknownEffect(SettlementReservationSnapshot.fields.settlementId)(reservationRow.value.settlement_id).pipe(Effect.mapError(internalFailure(operation)));
1713
+ const settlementId = yield* Schema.decodeEffect(SettlementReservationSnapshot.fields.settlementId)(reservationRow.value.settlement_id).pipe(Effect.mapError(internalFailure(operation)));
1714
1714
  reservation = SettlementReservationSnapshot.make({
1715
1715
  settlementId,
1716
1716
  outcome: reservationRow.value.outcome,