@effect-agent/storage-cloudflare 0.1.0-beta.111 → 0.1.0-beta.113

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.
@@ -1,4 +1,4 @@
1
- import { a as DoStorageCompatibilityError, o as DoStorageCorruptionError, s as DoStorageError } from "./DoStorageError-Cmhvl4TQ.mjs";
1
+ import { a as DoStorageCompatibilityError, o as DoStorageCorruptionError, s as DoStorageError } from "./DoStorageError-DjpuLHmX.mjs";
2
2
  import { DoStorageConfig } from "./DoStorageConfig.mjs";
3
3
  import { DoStorageFailpoint } from "./DoStorageFailpoint.mjs";
4
4
  import { Layer } from "effect";
@@ -1,7 +1,7 @@
1
1
  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
- import { a as initializeDoJournal } from "./do-journal-THW8-ZeP.mjs";
4
+ import { a as initializeDoJournal } from "./do-journal-BeHu8_Bh.mjs";
5
5
  import { Effect, Layer } from "effect";
6
6
  import { MessageDeliveryError, MessageDeliveryStore } from "effect-agent/message-delivery";
7
7
  import { SqlMessageDeliveryTransaction, makeSqlMessageDeliveryStore } from "effect-agent/sql-message-delivery-store";
@@ -1,4 +1,5 @@
1
1
  import { Schema } from "effect";
2
+ import { ThreadStoreDiagnostic } from "effect-agent/thread-store";
2
3
  declare namespace DoStorageError_d_exports {
3
4
  export { DoAppendConflict, DoCheckpointConflict, DoFenceRejected, DoLedgerError, DoStorageCompatibilityError, DoStorageCorruptionError, DoStorageError, DoStorageFailpointError, DoStorageFailpointLocation, DoValueBoundExceeded };
4
5
  }
@@ -13,6 +14,7 @@ declare const DoStorageCorruptionError_base: Schema.Class<DoStorageCorruptionErr
13
14
  readonly message: Schema.String;
14
15
  readonly rowKey: Schema.String;
15
16
  readonly table: Schema.String;
17
+ readonly diagnostic: Schema.optionalKey<typeof ThreadStoreDiagnostic>;
16
18
  }>, import("effect/Cause").YieldableError>;
17
19
  /** Stored bytes failed the current Schema and cannot be used as recovery truth. */
18
20
  declare class DoStorageCorruptionError extends DoStorageCorruptionError_base {}
@@ -20,6 +22,7 @@ declare const DoStorageError_base: Schema.Class<DoStorageError, Schema.TaggedStr
20
22
  readonly cause: Schema.optionalKey<Schema.Defect>;
21
23
  readonly message: Schema.String;
22
24
  readonly operation: Schema.String;
25
+ readonly diagnostic: Schema.optionalKey<typeof ThreadStoreDiagnostic>;
23
26
  }>, import("effect/Cause").YieldableError>;
24
27
  /** Durable Object SQLite infrastructure failed while opening or operating the store. */
25
28
  declare class DoStorageError extends DoStorageError_base {}
@@ -95,4 +98,4 @@ declare class DoStorageFailpointError extends DoStorageFailpointError_base {
95
98
  }
96
99
  //#endregion
97
100
  export { DoStorageCompatibilityError as a, DoStorageError_d_exports as c, DoValueBoundExceeded as d, DoLedgerError as i, DoStorageFailpointError as l, DoCheckpointConflict as n, DoStorageCorruptionError as o, DoFenceRejected as r, DoStorageError as s, DoAppendConflict as t, DoStorageFailpointLocation as u };
98
- //# sourceMappingURL=DoStorageError-Cmhvl4TQ.d.mts.map
101
+ //# sourceMappingURL=DoStorageError-DjpuLHmX.d.mts.map
@@ -1,2 +1,2 @@
1
- import { a as DoStorageCompatibilityError, d as DoValueBoundExceeded, i as DoLedgerError, l as DoStorageFailpointError, n as DoCheckpointConflict, o as DoStorageCorruptionError, r as DoFenceRejected, s as DoStorageError, t as DoAppendConflict, u as DoStorageFailpointLocation } from "./DoStorageError-Cmhvl4TQ.mjs";
1
+ import { a as DoStorageCompatibilityError, d as DoValueBoundExceeded, i as DoLedgerError, l as DoStorageFailpointError, n as DoCheckpointConflict, o as DoStorageCorruptionError, r as DoFenceRejected, s as DoStorageError, t as DoAppendConflict, u as DoStorageFailpointLocation } from "./DoStorageError-DjpuLHmX.mjs";
2
2
  export { DoAppendConflict, DoCheckpointConflict, DoFenceRejected, DoLedgerError, DoStorageCompatibilityError, DoStorageCorruptionError, DoStorageError, DoStorageFailpointError, DoStorageFailpointLocation, DoValueBoundExceeded };
@@ -1,6 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  import { Schema } from "effect";
3
3
  import { CanonicalSequence, ProducerEpoch } from "effect-agent/records";
4
+ import { ThreadStoreDiagnostic } from "effect-agent/thread-store";
4
5
  //#region src/DoStorageError.ts
5
6
  var DoStorageError_exports = /* @__PURE__ */ __exportAll({
6
7
  DoAppendConflict: () => DoAppendConflict,
@@ -24,13 +25,15 @@ var DoStorageCompatibilityError = class extends Schema.TaggedError()("DoStorageC
24
25
  var DoStorageCorruptionError = class extends Schema.TaggedError()("DoStorageCorruptionError", {
25
26
  message: Schema.String,
26
27
  rowKey: Schema.String,
27
- table: Schema.String
28
+ table: Schema.String,
29
+ diagnostic: Schema.optionalKey(ThreadStoreDiagnostic)
28
30
  }) {};
29
31
  /** Durable Object SQLite infrastructure failed while opening or operating the store. */
30
32
  var DoStorageError = class extends Schema.TaggedError()("DoStorageError", {
31
33
  cause: Schema.optionalKey(Schema.Defect()),
32
34
  message: Schema.String,
33
- operation: Schema.String
35
+ operation: Schema.String,
36
+ diagnostic: Schema.optionalKey(ThreadStoreDiagnostic)
34
37
  }) {};
35
38
  /**
36
39
  * Durable Object SQLite infrastructure failed while operating the Submission Ledger. Surfaces
@@ -1 +1 @@
1
- {"version":3,"file":"DoStorageError.mjs","names":[],"sources":["../src/DoStorageError.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { CanonicalSequence, ProducerEpoch } from \"effect-agent/records\";\n\n/** The Durable Object's SQLite storage uses a private-development format this adapter cannot read. */\nexport class DoStorageCompatibilityError extends Schema.TaggedError<DoStorageCompatibilityError>()(\n \"DoStorageCompatibilityError\",\n {\n actualVersion: Schema.Int,\n message: Schema.String,\n supportedVersion: Schema.Int,\n },\n) {}\n\n/** Stored bytes failed the current Schema and cannot be used as recovery truth. */\nexport class DoStorageCorruptionError extends Schema.TaggedError<DoStorageCorruptionError>()(\n \"DoStorageCorruptionError\",\n {\n message: Schema.String,\n rowKey: Schema.String,\n table: Schema.String,\n },\n) {}\n\n/** Durable Object SQLite infrastructure failed while opening or operating the store. */\nexport class DoStorageError extends Schema.TaggedError<DoStorageError>()(\"DoStorageError\", {\n cause: Schema.optionalKey(Schema.Defect()),\n message: Schema.String,\n operation: Schema.String,\n}) {}\n\n/**\n * Durable Object SQLite infrastructure failed while operating the Submission Ledger. Surfaces\n * at the SubmissionLedger port as the typed `LedgerError` with this error preserved as its\n * cause, so the adapter-level tag is never erased.\n */\nexport class DoLedgerError extends Schema.TaggedError<DoLedgerError>()(\"DoLedgerError\", {\n cause: Schema.optionalKey(Schema.Defect()),\n message: Schema.String,\n operation: Schema.String,\n}) {}\n\n/**\n * A value to be stored exceeds the configured Durable Object per-value bound\n * (`DoStorageConfigValue.maxStoredValueBytes`, kept under the platform's 2 MB SQLite value\n * limit). The refusal happens typed BEFORE any durable mutation; no partial state is written.\n * Payloads of this size are the designed overflow case for a future R2-backed AttachmentStore\n * (deployment spec §3.1, deferred until a real attachment requirement exists).\n */\nexport class DoValueBoundExceeded extends Schema.TaggedError<DoValueBoundExceeded>()(\n \"DoValueBoundExceeded\",\n {\n actualBytes: Schema.Int,\n maxBytes: Schema.Int,\n operation: Schema.String,\n },\n) {\n override get message() {\n return (\n `A stored value of ${this.actualBytes} bytes exceeds the Durable Object per-value bound ` +\n `of ${this.maxBytes} bytes during ${this.operation}. Nothing was written. Values of this ` +\n \"size are the designed R2 AttachmentStore overflow path (deferred, deployment spec §3.1).\"\n );\n }\n}\n\n/**\n * A canonical batch retry conflicts with existing append state. Tail conflicts carry the\n * actual committed tail as a diagnostic resume hint.\n */\nexport class DoAppendConflict extends Schema.TaggedError<DoAppendConflict>()(\"DoAppendConflict\", {\n message: Schema.String,\n reason: Schema.Literals([\"batch-digest\", \"record-identity\", \"tail\"]),\n actualTailSequence: Schema.optionalKey(CanonicalSequence),\n actualTailDigest: Schema.optionalKey(Schema.String),\n}) {}\n\n/**\n * A producer epoch does not match the Thread's current writer registration. Appends\n * require the exact registered epoch, so both older and newer unregistered epochs are fenced;\n * a newer epoch takes over by materializing first.\n */\nexport class DoFenceRejected extends Schema.TaggedError<DoFenceRejected>()(\"DoFenceRejected\", {\n actualEpoch: ProducerEpoch,\n message: Schema.String,\n producerEpoch: ProducerEpoch,\n}) {}\n\n/** A checkpoint conflicts with a previously stored checkpoint at the same offset. */\nexport class DoCheckpointConflict extends Schema.TaggedError<DoCheckpointConflict>()(\n \"DoCheckpointConflict\",\n {\n message: Schema.String,\n },\n) {}\n\n/**\n * Deterministic fault-injection locations at Durable Object storage operation boundaries.\n *\n * The string list is copied VERBATIM from `SqliteStorageFailpointLocation`\n * (`packages/storage-sqlite/src/errors.ts`) so every crash-matrix row keeps the same name on\n * both platforms — the DN process-kill evidence and the DC eviction evidence address identical\n * locations. There is intentionally no Cloudflare-only location.\n */\nexport const DoStorageFailpointLocation = Schema.Literals([\n \"upgrade:before-mutation\",\n \"upgrade:after-mutation\",\n \"upgrade:before-version\",\n \"upgrade:after-version\",\n \"materialize:before\",\n \"materialize:after\",\n \"append:before\",\n \"append:after-batch-insert\",\n \"append:after-record-insert\",\n \"append:after-tail-update\",\n \"append:after\",\n \"export:after-thread-read\",\n \"save-checkpoint:before\",\n \"save-checkpoint:after\",\n \"save-recovery-checkpoint:before\",\n \"save-recovery-checkpoint:after\",\n \"ledger:admit:before\",\n \"ledger:admit:after\",\n \"ledger:mark-ready:before\",\n \"ledger:mark-ready:after\",\n \"ledger:claim:before\",\n \"ledger:claim:after\",\n \"ledger:mark-input-applied:before\",\n \"ledger:mark-input-applied:after\",\n \"ledger:renew:before\",\n \"ledger:renew:after\",\n \"ledger:reserve-settlement:before\",\n \"ledger:reserve-settlement:after\",\n \"ledger:finalize-settlement:before\",\n \"ledger:finalize-settlement:after\",\n \"ledger:request-abort:before\",\n \"ledger:request-abort:after\",\n \"ledger:release:before\",\n \"ledger:release:after\",\n \"ledger:claim-joining:before\",\n \"ledger:claim-joining:after\",\n \"ledger:mark-joined:before\",\n \"ledger:mark-joined:after\",\n \"ledger:revert-joining:before\",\n \"ledger:revert-joining:after\",\n \"ledger:suspend:before\",\n \"ledger:suspend:after\",\n \"ledger:approval-decision:before\",\n \"ledger:approval-decision:after\",\n \"ledger:mark-unknown:before\",\n \"ledger:mark-unknown:after\",\n \"ledger:unknown-resolution:before\",\n \"ledger:unknown-resolution:after\",\n \"ledger:child-reservation:before\",\n \"ledger:child-reservation:after\",\n \"ledger:child-attach:before\",\n \"ledger:child-attach:after\",\n \"ledger:child-release-pending:before\",\n \"ledger:child-release-pending:after\",\n \"ledger:child-release:before\",\n \"ledger:child-release:after\",\n \"ledger:child-settled:before\",\n \"ledger:child-settled:after\",\n]);\n\nexport type DoStorageFailpointLocation = typeof DoStorageFailpointLocation.Type;\n\n/** Deterministic test-only fault or pause injected at a Durable Object storage boundary. */\nexport class DoStorageFailpointError extends Schema.TaggedError<DoStorageFailpointError>()(\n \"DoStorageFailpointError\",\n {\n location: DoStorageFailpointLocation,\n },\n) {\n override get message() {\n return `Injected Durable Object storage failure at ${this.location}.`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA,IAAa,8BAAb,cAAiD,OAAO,YAAyC,CAAC,CAChG,+BACA;CACE,eAAe,OAAO;CACtB,SAAS,OAAO;CAChB,kBAAkB,OAAO;AAC3B,CACF,CAAC,CAAC,CAAC;;AAGH,IAAa,2BAAb,cAA8C,OAAO,YAAsC,CAAC,CAC1F,4BACA;CACE,SAAS,OAAO;CAChB,QAAQ,OAAO;CACf,OAAO,OAAO;AAChB,CACF,CAAC,CAAC,CAAC;;AAGH,IAAa,iBAAb,cAAoC,OAAO,YAA4B,CAAC,CAAC,kBAAkB;CACzF,OAAO,OAAO,YAAY,OAAO,OAAO,CAAC;CACzC,SAAS,OAAO;CAChB,WAAW,OAAO;AACpB,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CAAC,iBAAiB;CACtF,OAAO,OAAO,YAAY,OAAO,OAAO,CAAC;CACzC,SAAS,OAAO;CAChB,WAAW,OAAO;AACpB,CAAC,CAAC,CAAC,CAAC;;;;;;;;AASJ,IAAa,uBAAb,cAA0C,OAAO,YAAkC,CAAC,CAClF,wBACA;CACE,aAAa,OAAO;CACpB,UAAU,OAAO;CACjB,WAAW,OAAO;AACpB,CACF,CAAC,CAAC;CACA,IAAa,UAAU;EACrB,OACE,qBAAqB,KAAK,YAAY,uDAChC,KAAK,SAAS,gBAAgB,KAAK,UAAU;CAGvD;AACF;;;;;AAMA,IAAa,mBAAb,cAAsC,OAAO,YAA8B,CAAC,CAAC,oBAAoB;CAC/F,SAAS,OAAO;CAChB,QAAQ,OAAO,SAAS;EAAC;EAAgB;EAAmB;CAAM,CAAC;CACnE,oBAAoB,OAAO,YAAY,iBAAiB;CACxD,kBAAkB,OAAO,YAAY,OAAO,MAAM;AACpD,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,kBAAb,cAAqC,OAAO,YAA6B,CAAC,CAAC,mBAAmB;CAC5F,aAAa;CACb,SAAS,OAAO;CAChB,eAAe;AACjB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,uBAAb,cAA0C,OAAO,YAAkC,CAAC,CAClF,wBACA,EACE,SAAS,OAAO,OAClB,CACF,CAAC,CAAC,CAAC;;;;;;;;;AAUH,MAAa,6BAA6B,OAAO,SAAS;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAKD,IAAa,0BAAb,cAA6C,OAAO,YAAqC,CAAC,CACxF,2BACA,EACE,UAAU,2BACZ,CACF,CAAC,CAAC;CACA,IAAa,UAAU;EACrB,OAAO,8CAA8C,KAAK,SAAS;CACrE;AACF"}
1
+ {"version":3,"file":"DoStorageError.mjs","names":[],"sources":["../src/DoStorageError.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { CanonicalSequence, ProducerEpoch } from \"effect-agent/records\";\nimport { ThreadStoreDiagnostic } from \"effect-agent/thread-store\";\n\n/** The Durable Object's SQLite storage uses a private-development format this adapter cannot read. */\nexport class DoStorageCompatibilityError extends Schema.TaggedError<DoStorageCompatibilityError>()(\n \"DoStorageCompatibilityError\",\n {\n actualVersion: Schema.Int,\n message: Schema.String,\n supportedVersion: Schema.Int,\n },\n) {}\n\n/** Stored bytes failed the current Schema and cannot be used as recovery truth. */\nexport class DoStorageCorruptionError extends Schema.TaggedError<DoStorageCorruptionError>()(\n \"DoStorageCorruptionError\",\n {\n message: Schema.String,\n rowKey: Schema.String,\n table: Schema.String,\n diagnostic: Schema.optionalKey(ThreadStoreDiagnostic),\n },\n) {}\n\n/** Durable Object SQLite infrastructure failed while opening or operating the store. */\nexport class DoStorageError extends Schema.TaggedError<DoStorageError>()(\"DoStorageError\", {\n cause: Schema.optionalKey(Schema.Defect()),\n message: Schema.String,\n operation: Schema.String,\n diagnostic: Schema.optionalKey(ThreadStoreDiagnostic),\n}) {}\n\n/**\n * Durable Object SQLite infrastructure failed while operating the Submission Ledger. Surfaces\n * at the SubmissionLedger port as the typed `LedgerError` with this error preserved as its\n * cause, so the adapter-level tag is never erased.\n */\nexport class DoLedgerError extends Schema.TaggedError<DoLedgerError>()(\"DoLedgerError\", {\n cause: Schema.optionalKey(Schema.Defect()),\n message: Schema.String,\n operation: Schema.String,\n}) {}\n\n/**\n * A value to be stored exceeds the configured Durable Object per-value bound\n * (`DoStorageConfigValue.maxStoredValueBytes`, kept under the platform's 2 MB SQLite value\n * limit). The refusal happens typed BEFORE any durable mutation; no partial state is written.\n * Payloads of this size are the designed overflow case for a future R2-backed AttachmentStore\n * (deployment spec §3.1, deferred until a real attachment requirement exists).\n */\nexport class DoValueBoundExceeded extends Schema.TaggedError<DoValueBoundExceeded>()(\n \"DoValueBoundExceeded\",\n {\n actualBytes: Schema.Int,\n maxBytes: Schema.Int,\n operation: Schema.String,\n },\n) {\n override get message() {\n return (\n `A stored value of ${this.actualBytes} bytes exceeds the Durable Object per-value bound ` +\n `of ${this.maxBytes} bytes during ${this.operation}. Nothing was written. Values of this ` +\n \"size are the designed R2 AttachmentStore overflow path (deferred, deployment spec §3.1).\"\n );\n }\n}\n\n/**\n * A canonical batch retry conflicts with existing append state. Tail conflicts carry the\n * actual committed tail as a diagnostic resume hint.\n */\nexport class DoAppendConflict extends Schema.TaggedError<DoAppendConflict>()(\"DoAppendConflict\", {\n message: Schema.String,\n reason: Schema.Literals([\"batch-digest\", \"record-identity\", \"tail\"]),\n actualTailSequence: Schema.optionalKey(CanonicalSequence),\n actualTailDigest: Schema.optionalKey(Schema.String),\n}) {}\n\n/**\n * A producer epoch does not match the Thread's current writer registration. Appends\n * require the exact registered epoch, so both older and newer unregistered epochs are fenced;\n * a newer epoch takes over by materializing first.\n */\nexport class DoFenceRejected extends Schema.TaggedError<DoFenceRejected>()(\"DoFenceRejected\", {\n actualEpoch: ProducerEpoch,\n message: Schema.String,\n producerEpoch: ProducerEpoch,\n}) {}\n\n/** A checkpoint conflicts with a previously stored checkpoint at the same offset. */\nexport class DoCheckpointConflict extends Schema.TaggedError<DoCheckpointConflict>()(\n \"DoCheckpointConflict\",\n {\n message: Schema.String,\n },\n) {}\n\n/**\n * Deterministic fault-injection locations at Durable Object storage operation boundaries.\n *\n * The string list is copied VERBATIM from `SqliteStorageFailpointLocation`\n * (`packages/storage-sqlite/src/errors.ts`) so every crash-matrix row keeps the same name on\n * both platforms — the DN process-kill evidence and the DC eviction evidence address identical\n * locations. There is intentionally no Cloudflare-only location.\n */\nexport const DoStorageFailpointLocation = Schema.Literals([\n \"upgrade:before-mutation\",\n \"upgrade:after-mutation\",\n \"upgrade:before-version\",\n \"upgrade:after-version\",\n \"materialize:before\",\n \"materialize:after\",\n \"append:before\",\n \"append:after-batch-insert\",\n \"append:after-record-insert\",\n \"append:after-tail-update\",\n \"append:after\",\n \"export:after-thread-read\",\n \"save-checkpoint:before\",\n \"save-checkpoint:after\",\n \"save-recovery-checkpoint:before\",\n \"save-recovery-checkpoint:after\",\n \"ledger:admit:before\",\n \"ledger:admit:after\",\n \"ledger:mark-ready:before\",\n \"ledger:mark-ready:after\",\n \"ledger:claim:before\",\n \"ledger:claim:after\",\n \"ledger:mark-input-applied:before\",\n \"ledger:mark-input-applied:after\",\n \"ledger:renew:before\",\n \"ledger:renew:after\",\n \"ledger:reserve-settlement:before\",\n \"ledger:reserve-settlement:after\",\n \"ledger:finalize-settlement:before\",\n \"ledger:finalize-settlement:after\",\n \"ledger:request-abort:before\",\n \"ledger:request-abort:after\",\n \"ledger:release:before\",\n \"ledger:release:after\",\n \"ledger:claim-joining:before\",\n \"ledger:claim-joining:after\",\n \"ledger:mark-joined:before\",\n \"ledger:mark-joined:after\",\n \"ledger:revert-joining:before\",\n \"ledger:revert-joining:after\",\n \"ledger:suspend:before\",\n \"ledger:suspend:after\",\n \"ledger:approval-decision:before\",\n \"ledger:approval-decision:after\",\n \"ledger:mark-unknown:before\",\n \"ledger:mark-unknown:after\",\n \"ledger:unknown-resolution:before\",\n \"ledger:unknown-resolution:after\",\n \"ledger:child-reservation:before\",\n \"ledger:child-reservation:after\",\n \"ledger:child-attach:before\",\n \"ledger:child-attach:after\",\n \"ledger:child-release-pending:before\",\n \"ledger:child-release-pending:after\",\n \"ledger:child-release:before\",\n \"ledger:child-release:after\",\n \"ledger:child-settled:before\",\n \"ledger:child-settled:after\",\n]);\n\nexport type DoStorageFailpointLocation = typeof DoStorageFailpointLocation.Type;\n\n/** Deterministic test-only fault or pause injected at a Durable Object storage boundary. */\nexport class DoStorageFailpointError extends Schema.TaggedError<DoStorageFailpointError>()(\n \"DoStorageFailpointError\",\n {\n location: DoStorageFailpointLocation,\n },\n) {\n override get message() {\n return `Injected Durable Object storage failure at ${this.location}.`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,IAAa,8BAAb,cAAiD,OAAO,YAAyC,CAAC,CAChG,+BACA;CACE,eAAe,OAAO;CACtB,SAAS,OAAO;CAChB,kBAAkB,OAAO;AAC3B,CACF,CAAC,CAAC,CAAC;;AAGH,IAAa,2BAAb,cAA8C,OAAO,YAAsC,CAAC,CAC1F,4BACA;CACE,SAAS,OAAO;CAChB,QAAQ,OAAO;CACf,OAAO,OAAO;CACd,YAAY,OAAO,YAAY,qBAAqB;AACtD,CACF,CAAC,CAAC,CAAC;;AAGH,IAAa,iBAAb,cAAoC,OAAO,YAA4B,CAAC,CAAC,kBAAkB;CACzF,OAAO,OAAO,YAAY,OAAO,OAAO,CAAC;CACzC,SAAS,OAAO;CAChB,WAAW,OAAO;CAClB,YAAY,OAAO,YAAY,qBAAqB;AACtD,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CAAC,iBAAiB;CACtF,OAAO,OAAO,YAAY,OAAO,OAAO,CAAC;CACzC,SAAS,OAAO;CAChB,WAAW,OAAO;AACpB,CAAC,CAAC,CAAC,CAAC;;;;;;;;AASJ,IAAa,uBAAb,cAA0C,OAAO,YAAkC,CAAC,CAClF,wBACA;CACE,aAAa,OAAO;CACpB,UAAU,OAAO;CACjB,WAAW,OAAO;AACpB,CACF,CAAC,CAAC;CACA,IAAa,UAAU;EACrB,OACE,qBAAqB,KAAK,YAAY,uDAChC,KAAK,SAAS,gBAAgB,KAAK,UAAU;CAGvD;AACF;;;;;AAMA,IAAa,mBAAb,cAAsC,OAAO,YAA8B,CAAC,CAAC,oBAAoB;CAC/F,SAAS,OAAO;CAChB,QAAQ,OAAO,SAAS;EAAC;EAAgB;EAAmB;CAAM,CAAC;CACnE,oBAAoB,OAAO,YAAY,iBAAiB;CACxD,kBAAkB,OAAO,YAAY,OAAO,MAAM;AACpD,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,kBAAb,cAAqC,OAAO,YAA6B,CAAC,CAAC,mBAAmB;CAC5F,aAAa;CACb,SAAS,OAAO;CAChB,eAAe;AACjB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,uBAAb,cAA0C,OAAO,YAAkC,CAAC,CAClF,wBACA,EACE,SAAS,OAAO,OAClB,CACF,CAAC,CAAC,CAAC;;;;;;;;;AAUH,MAAa,6BAA6B,OAAO,SAAS;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAKD,IAAa,0BAAb,cAA6C,OAAO,YAAqC,CAAC,CACxF,2BACA,EACE,UAAU,2BACZ,CACF,CAAC,CAAC;CACA,IAAa,UAAU;EACrB,OAAO,8CAA8C,KAAK,SAAS;CACrE;AACF"}
@@ -1,4 +1,4 @@
1
- import { l as DoStorageFailpointError, u as DoStorageFailpointLocation } from "./DoStorageError-Cmhvl4TQ.mjs";
1
+ import { l as DoStorageFailpointError, u as DoStorageFailpointLocation } from "./DoStorageError-DjpuLHmX.mjs";
2
2
  import { Context, Effect, Layer } from "effect";
3
3
  declare namespace DoStorageFailpoint_d_exports {
4
4
  export { DoStorageFailpoint, DoStorageFailpointHandler };
@@ -1,4 +1,4 @@
1
- import { u as DoStorageFailpointLocation } from "./DoStorageError-Cmhvl4TQ.mjs";
1
+ import { u as DoStorageFailpointLocation } from "./DoStorageError-DjpuLHmX.mjs";
2
2
  import { DoStorageFailpoint, DoStorageFailpointHandler } from "./DoStorageFailpoint.mjs";
3
3
  import { Context, Effect, Layer } from "effect";
4
4
  //#region src/DoStorageFailpointTesting.d.ts
@@ -2,16 +2,17 @@ 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-THW8-ZeP.mjs";
5
+ import { a as initializeDoJournal, i as decodeRows } from "./do-journal-BeHu8_Bh.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
9
  import { SqliteClient } from "@effect/sql-sqlite-do";
10
10
  import { EMPTY_TAIL_DIGEST } from "effect-agent/digest";
11
11
  import { ApprovalDecision, CanonicalSequence, DefinitionDigests, Digest, PersistedJson, ProducerEpoch, RecordEnvelope, SettlementOutcome, WorkerAdmission } from "effect-agent/records";
12
+ import { ThreadStoreDiagnostic } from "effect-agent/thread-store";
12
13
  import { BrowserCrypto } from "@effect/platform-browser";
13
14
  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
+ 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, SubmissionWorkItem, SuspendRequest, SuspensionReason, SuspensionSnapshot, UnknownResolution, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, settlementFailureFromRecord, submissionAbortRecordId } from "effect-agent/submission-ledger";
15
16
  //#region src/DoSubmissionLedger.ts
16
17
  var DoSubmissionLedger_exports = /* @__PURE__ */ __exportAll({
17
18
  ledgerLayer: () => ledgerLayer,
@@ -307,8 +308,19 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
307
308
  return ownership.value;
308
309
  });
309
310
  const decodeSubmissionSnapshot = Effect.fn("DoSubmissionLedger.decodeSubmissionSnapshot")(function* (operation, row) {
310
- const agentDigests = yield* parseStoredJsonText(row.agent_digests_json).pipe(Effect.mapError((error) => corruptionFailure(operation, "effect_agent_submissions", row.submission_id, error.message)));
311
- const inputPayload = yield* parseStoredJsonText(row.input_json).pipe(Effect.mapError((error) => corruptionFailure(operation, "effect_agent_submissions", row.submission_id, error.message)));
311
+ const decodeFailure = (error) => internalFailure(operation)(DoStorageCorruptionError.make({
312
+ table: "effect_agent_submissions",
313
+ rowKey: row.submission_id,
314
+ message: "Stored submission does not satisfy the ledger schema",
315
+ diagnostic: ThreadStoreDiagnostic.make({
316
+ causeTag: error._tag,
317
+ operation,
318
+ decoder: "SubmissionSnapshot",
319
+ issueTag: error.issue._tag
320
+ })
321
+ }));
322
+ const agentDigests = yield* parseStoredJsonText(row.agent_digests_json).pipe(Effect.mapError(decodeFailure));
323
+ const inputPayload = yield* parseStoredJsonText(row.input_json).pipe(Effect.mapError(decodeFailure));
312
324
  if (row.parent_submission_id === null !== (row.parent_tool_call_id === null)) return yield* corruptionFailure(operation, "effect_agent_submissions", row.submission_id, "A parent linkage must record both the parent Submission and the parent Tool Call.");
313
325
  return yield* decodeSubmissionSnapshotUnknown({
314
326
  submissionId: row.submission_id,
@@ -325,16 +337,16 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
325
337
  state: row.state,
326
338
  createdAt: row.created_at,
327
339
  ...row.admission_group === null ? {} : { admissionGroup: row.admission_group },
328
- ...row.worker_admission_json === null ? {} : { workerAdmission: yield* parseStoredJsonText(row.worker_admission_json).pipe(Effect.mapError(internalFailure(operation))) },
329
- ...row.message_admission_json === null ? {} : { messageAdmission: yield* parseStoredJsonText(row.message_admission_json).pipe(Effect.mapError(internalFailure(operation))) },
330
- ...row.admission_fence_json === null ? {} : { admissionFence: yield* parseStoredJsonText(row.admission_fence_json).pipe(Effect.mapError(internalFailure(operation))) },
340
+ ...row.worker_admission_json === null ? {} : { workerAdmission: yield* parseStoredJsonText(row.worker_admission_json).pipe(Effect.mapError(decodeFailure)) },
341
+ ...row.message_admission_json === null ? {} : { messageAdmission: yield* parseStoredJsonText(row.message_admission_json).pipe(Effect.mapError(decodeFailure)) },
342
+ ...row.admission_fence_json === null ? {} : { admissionFence: yield* parseStoredJsonText(row.admission_fence_json).pipe(Effect.mapError(decodeFailure)) },
331
343
  ...row.settled_outcome === null ? {} : { settledOutcome: row.settled_outcome },
332
344
  ...row.ready_at === null ? {} : { readyAt: row.ready_at },
333
345
  ...row.parent_submission_id === null || row.parent_tool_call_id === null ? {} : { parentLinkage: {
334
346
  parentSubmissionId: row.parent_submission_id,
335
347
  parentToolCallId: row.parent_tool_call_id
336
348
  } }
337
- }).pipe(Effect.mapError((error) => corruptionFailure(operation, "effect_agent_submissions", row.submission_id, error.message)));
349
+ }).pipe(Effect.mapError(decodeFailure));
338
350
  });
339
351
  const readReservation = Effect.fn("DoSubmissionLedger.readReservation")(function* (operation, submissionId) {
340
352
  const rows = yield* sql`
@@ -1644,25 +1656,28 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1644
1656
  const scanPage = Effect.fn("DoSubmissionLedger.scanPage")(function* (cursor) {
1645
1657
  const operation = "ledger scan nonterminal";
1646
1658
  const rows = yield* (cursor === void 0 ? sql`
1647
- SELECT ${sql.literal(SUBMISSION_COLUMNS)}
1659
+ SELECT submission_id AS "submissionId", thread_id AS "threadId",
1660
+ queue_sequence AS "queueSequence", principal, idempotency_key AS "idempotencyKey",
1661
+ deployment_id AS "deploymentId", receipt_id AS "receiptId", state
1648
1662
  FROM effect_agent_submissions
1649
1663
  WHERE state <> 'settled'
1650
1664
  ORDER BY thread_id ASC, queue_sequence ASC
1651
1665
  LIMIT ${SCAN_PAGE_SIZE}
1652
1666
  ` : sql`
1653
- SELECT ${sql.literal(SUBMISSION_COLUMNS)}
1667
+ SELECT submission_id AS "submissionId", thread_id AS "threadId",
1668
+ queue_sequence AS "queueSequence", principal, idempotency_key AS "idempotencyKey",
1669
+ deployment_id AS "deploymentId", receipt_id AS "receiptId", state
1654
1670
  FROM effect_agent_submissions
1655
1671
  WHERE state <> 'settled'
1656
1672
  AND (thread_id, queue_sequence) > (${cursor.threadId}, ${cursor.queueSequence})
1657
1673
  ORDER BY thread_id ASC, queue_sequence ASC
1658
1674
  LIMIT ${SCAN_PAGE_SIZE}
1659
1675
  `).pipe(Effect.mapError(sqlFailure(operation)));
1660
- const decoded = yield* decodeSubmissionRows(operation, "nonterminal_scan", rows);
1661
- const snapshots = yield* Effect.forEach(decoded, (row) => decodeSubmissionSnapshot(operation, row));
1676
+ const decoded = yield* decodeRows(Schema.Array(SubmissionWorkItem), "effect_agent_submissions", "nonterminal_scan", rows, "SubmissionWorkItem").pipe(Effect.mapError(internalFailure(operation)));
1662
1677
  const last = decoded[decoded.length - 1];
1663
- return [snapshots, last === void 0 || decoded.length < SCAN_PAGE_SIZE ? Option.none() : Option.some({
1664
- threadId: last.thread_id,
1665
- queueSequence: last.queue_sequence
1678
+ return [decoded, last === void 0 || decoded.length < SCAN_PAGE_SIZE ? Option.none() : Option.some({
1679
+ threadId: last.threadId,
1680
+ queueSequence: last.queueSequence
1666
1681
  })];
1667
1682
  });
1668
1683
  const scanNonterminal = Stream.paginate(void 0, scanPage);