@yielded/agent-storage-cloudflare 0.1.0-beta.173 → 0.1.0-beta.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DoMemoryStore.mjs +1 -1
- package/dist/DoMessageDeliveryStore.mjs +1 -1
- package/dist/DoStorageFailpointTesting.mjs +1 -4
- package/dist/DoStorageFailpointTesting.mjs.map +1 -1
- package/dist/DoSubmissionLedger.mjs +8 -5
- package/dist/DoSubmissionLedger.mjs.map +1 -1
- package/dist/DoSubscriptionStore.mjs.map +1 -1
- package/dist/{DoThreadStore-CtyahRTW.mjs → DoThreadStore-DyzOZDXK.mjs} +9 -9
- package/dist/DoThreadStore-DyzOZDXK.mjs.map +1 -0
- package/dist/DoThreadStore.mjs +1 -1
- package/dist/PortProtocol.d.mts +7553 -7541
- package/dist/{do-journal-_MdLGTd3.mjs → do-journal-ZMAzzENZ.mjs} +12 -25
- package/dist/do-journal-ZMAzzENZ.mjs.map +1 -0
- package/dist/index.mjs +1 -1
- package/dist/migrations-C3N9GN6A.mjs.map +1 -1
- package/dist/{owned-state-BHzUi0eb.mjs → owned-state-DcFh0YNo.mjs} +7 -6
- package/dist/owned-state-DcFh0YNo.mjs.map +1 -0
- package/package.json +1 -1
- package/src/DoStorageFailpointTesting.ts +9 -7
- package/src/DoSubmissionLedger.ts +9 -1
- package/src/DoSubscriptionStore.ts +1 -0
- package/src/DoThreadStore.ts +9 -6
- package/src/internal/canonical-append.ts +1 -1
- package/src/internal/do-journal.ts +774 -807
- package/src/internal/migrations.ts +1 -0
- package/src/internal/owned-state.ts +9 -6
- package/src/internal/prompt-checkpoint.ts +13 -10
- package/src/internal/storage-span.ts +9 -4
- package/dist/DoThreadStore-CtyahRTW.mjs.map +0 -1
- package/dist/do-journal-_MdLGTd3.mjs.map +0 -1
- package/dist/owned-state-BHzUi0eb.mjs.map +0 -1
package/dist/DoMemoryStore.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { r as ownedState } from "./owned-state-
|
|
2
|
+
import { r as ownedState } from "./owned-state-DcFh0YNo.mjs";
|
|
3
3
|
import { SqlMemoryLimits, SqlStorageOwner, memoryStoreLayerWithFailpoints } from "@yielded/agent/sql-memory-store";
|
|
4
4
|
import { Effect, Layer, Schema } from "effect";
|
|
5
5
|
import * as SqlClientService from "effect/sql/SqlClient";
|
|
@@ -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 { i as initializeDoJournal } from "./do-journal-
|
|
4
|
+
import { i as initializeDoJournal } from "./do-journal-ZMAzzENZ.mjs";
|
|
5
5
|
import { BrowserCrypto } from "@effect/platform-browser";
|
|
6
6
|
import { SqlLifecycleSource } from "@yielded/agent-storage-sql/sql-lifecycle-publication";
|
|
7
7
|
import { makeSqlMessageDeliveryStore } from "@yielded/agent-storage-sql/sql-message-delivery-store";
|
|
@@ -12,10 +12,7 @@ import { Effect } from "effect";
|
|
|
12
12
|
* The handles stay injected: this package never imports `cloudflare:workers`, so the harness
|
|
13
13
|
* that owns a `DurableObjectState` supplies the thunk.
|
|
14
14
|
*/
|
|
15
|
-
const evictionFailpointHandler = (options) => (location) => options.isArmed(location).pipe(Effect.flatMap((armed) => armed ? Effect.sync(() => {
|
|
16
|
-
options.evict(location);
|
|
17
|
-
throw new Error(`Durable Object eviction did not interrupt execution at ${location}.`);
|
|
18
|
-
}) : Effect.void));
|
|
15
|
+
const evictionFailpointHandler = (options) => (location) => options.isArmed(location).pipe(Effect.flatMap((armed) => armed ? Effect.sync(() => options.evict(location)).pipe(Effect.andThen(Effect.die(/* @__PURE__ */ new Error(`Durable Object eviction did not interrupt execution at ${location}.`)))) : Effect.void));
|
|
19
16
|
//#endregion
|
|
20
17
|
export { evictionFailpointHandler };
|
|
21
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoStorageFailpointTesting.mjs","names":[],"sources":["../src/DoStorageFailpointTesting.ts"],"sourcesContent":["import { Effect } from \"effect\";\n\nimport type { DoStorageFailpointLocation } from \"./DoStorageError.ts\";\nimport type { DoStorageFailpointHandler } from \"./DoStorageFailpoint.ts\";\n\n/**\n * The DC-specific eviction failpoint mode: instead of failing typed, an armed hit evicts the\n * Durable Object through an injected `evict` thunk — in production-shaped harnesses that thunk\n * is `() => ctx.abort()`, the platform's real failure mode. `ctx.abort()` never returns (it\n * throws while destroying the in-memory instance and every in-flight implicit or explicit\n * storage transaction rolls back), so an armed hit ends the current Attempt exactly like an\n * unannounced platform eviction; DO storage — the only correctness-critical state — survives\n * for the next incarnation, which the persisted alarm wakes without any incoming request.\n *\n * The handles stay injected: this package never imports `cloudflare:workers`, so the harness\n * that owns a `DurableObjectState` supplies the thunk.\n */\nexport const evictionFailpointHandler =\n (options: {\n readonly isArmed: (location: DoStorageFailpointLocation) => Effect.Effect<boolean>;\n /** Kills the incarnation — e.g. `() => ctx.abort()`. Typed `void` because the platform\n * declares `abort` as returning, but it throws while destroying the instance. */\n readonly evict: (location: DoStorageFailpointLocation) => void;\n }): DoStorageFailpointHandler =>\n (location) =>\n options.isArmed(location).pipe(\n Effect.flatMap((armed) =>\n armed\n ? // `ctx.abort()` throws while destroying the instance; that throw surfaces as a\n // defect in the (already dying) incarnation. The defensive
|
|
1
|
+
{"version":3,"file":"DoStorageFailpointTesting.mjs","names":[],"sources":["../src/DoStorageFailpointTesting.ts"],"sourcesContent":["import { Effect } from \"effect\";\n\nimport type { DoStorageFailpointLocation } from \"./DoStorageError.ts\";\nimport type { DoStorageFailpointHandler } from \"./DoStorageFailpoint.ts\";\n\n/**\n * The DC-specific eviction failpoint mode: instead of failing typed, an armed hit evicts the\n * Durable Object through an injected `evict` thunk — in production-shaped harnesses that thunk\n * is `() => ctx.abort()`, the platform's real failure mode. `ctx.abort()` never returns (it\n * throws while destroying the in-memory instance and every in-flight implicit or explicit\n * storage transaction rolls back), so an armed hit ends the current Attempt exactly like an\n * unannounced platform eviction; DO storage — the only correctness-critical state — survives\n * for the next incarnation, which the persisted alarm wakes without any incoming request.\n *\n * The handles stay injected: this package never imports `cloudflare:workers`, so the harness\n * that owns a `DurableObjectState` supplies the thunk.\n */\nexport const evictionFailpointHandler =\n (options: {\n readonly isArmed: (location: DoStorageFailpointLocation) => Effect.Effect<boolean>;\n /** Kills the incarnation — e.g. `() => ctx.abort()`. Typed `void` because the platform\n * declares `abort` as returning, but it throws while destroying the instance. */\n readonly evict: (location: DoStorageFailpointLocation) => void;\n }): DoStorageFailpointHandler =>\n (location) =>\n options.isArmed(location).pipe(\n Effect.flatMap((armed) =>\n armed\n ? // `ctx.abort()` throws while destroying the instance; that throw surfaces as a\n // defect in the (already dying) incarnation. The defensive defect below keeps the\n // guarantee — nothing after an armed hit may observe in-memory state — even if a\n // harness supplies an evict thunk that returns.\n Effect.sync(() => options.evict(location)).pipe(\n Effect.andThen(\n Effect.die(\n // oxlint-disable-next-line effect/no-native-error -- A returning native eviction callback violates the host contract and must remain a defect.\n new Error(`Durable Object eviction did not interrupt execution at ${location}.`),\n ),\n ),\n )\n : Effect.void,\n ),\n );\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAa,4BACV,aAMA,aACC,QAAQ,QAAQ,QAAQ,CAAC,CAAC,KACxB,OAAO,SAAS,UACd,QAKI,OAAO,WAAW,QAAQ,MAAM,QAAQ,CAAC,CAAC,CAAC,KACzC,OAAO,QACL,OAAO,oBAEL,IAAI,MAAM,0DAA0D,SAAS,EAAE,CACjF,CACF,CACF,IACA,OAAO,IACb,CACF"}
|
|
@@ -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 { n as ownedRows } from "./owned-state-
|
|
6
|
-
import { i as initializeDoJournal, r as decodeRows } from "./do-journal-
|
|
7
|
-
import { l as prepareCanonicalAppend, o as storageConfigLayer, s as storageFailpointLayer } from "./DoThreadStore-
|
|
5
|
+
import { n as ownedRows } from "./owned-state-DcFh0YNo.mjs";
|
|
6
|
+
import { i as initializeDoJournal, r as decodeRows } from "./do-journal-ZMAzzENZ.mjs";
|
|
7
|
+
import { l as prepareCanonicalAppend, o as storageConfigLayer, s as storageFailpointLayer } from "./DoThreadStore-DyzOZDXK.mjs";
|
|
8
8
|
import { BrowserCrypto } from "@effect/platform-browser";
|
|
9
9
|
import { Cause, Clock, Context, Crypto, DateTime, Effect, Layer, Option, Schema, Stream } from "effect";
|
|
10
10
|
import * as SqlClientService from "effect/sql/SqlClient";
|
|
11
11
|
import { definitionJson, makeCanonicalStorage, recordBatchId, runKey } from "@yielded/agent-storage-sql/sql-canonical-storage";
|
|
12
12
|
import { SqlStorageProgress } from "@yielded/agent-storage-sql/sql-storage-progress";
|
|
13
13
|
import { canonicalRecordJson } from "@yielded/agent-storage-sql/sql-thread-archive-range";
|
|
14
|
-
import { ApprovalDecision, CanonicalSequence, DefinitionDigests, Digest, PersistedJson, RecordEnvelope, SettlementOutcome, WorkerAdmission } from "@yielded/agent/records";
|
|
14
|
+
import { ApprovalDecision, CanonicalSequence, DefinitionDigests, Digest, PersistedJson, RecordEnvelope, RecordId, SettlementOutcome, WorkerAdmission } from "@yielded/agent/records";
|
|
15
15
|
import { AppendConflict, ThreadNotMaterialized, ThreadStoreDiagnostic, ThreadStoreError, makeTransferFactCheck } from "@yielded/agent/thread-store";
|
|
16
16
|
import { SqliteClient } from "@effect/sql-sqlite-do";
|
|
17
17
|
import { StorageOwner } from "@yielded/agent/run-storage";
|
|
@@ -55,7 +55,7 @@ var SubmissionRow = class extends Schema.Class("SubmissionRow")({
|
|
|
55
55
|
receipt_id: BoundedIdentifier,
|
|
56
56
|
state: SubmissionState,
|
|
57
57
|
settled_outcome: Schema.NullOr(SettlementOutcome),
|
|
58
|
-
settled_record_id: Schema.NullOr(BoundedIdentifier),
|
|
58
|
+
settled_record_id: Schema.NullOr(BoundedIdentifier.pipe(Schema.decodeTo(RecordId))),
|
|
59
59
|
finalized_at: Schema.NullOr(BoundedTimestamp),
|
|
60
60
|
created_at: BoundedTimestamp,
|
|
61
61
|
ready_at: Schema.NullOr(BoundedTimestamp),
|
|
@@ -354,11 +354,14 @@ const makeServices = Effect.fnUntraced(function* () {
|
|
|
354
354
|
}));
|
|
355
355
|
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.");
|
|
356
356
|
const admission = yield* decodeAdmissionFact(row).pipe(Effect.mapError(decodeFailure));
|
|
357
|
+
const settledAt = row.finalized_at === null ? void 0 : yield* decodeUtcInstant(row.finalized_at).pipe(Effect.mapError(decodeFailure));
|
|
357
358
|
const readyAt = row.ready_at === null ? void 0 : yield* decodeUtcInstant(row.ready_at).pipe(Effect.mapError(decodeFailure));
|
|
358
359
|
const snapshot = yield* decodeSubmissionSnapshotType({
|
|
359
360
|
...admission,
|
|
360
361
|
state: row.state,
|
|
361
362
|
...row.settled_outcome === null ? {} : { settledOutcome: row.settled_outcome },
|
|
363
|
+
...settledAt === void 0 ? {} : { settledAt },
|
|
364
|
+
...row.settled_record_id === null ? {} : { settledRecordId: row.settled_record_id },
|
|
362
365
|
...readyAt === void 0 ? {} : { readyAt }
|
|
363
366
|
}).pipe(Effect.mapError(decodeFailure));
|
|
364
367
|
submissions.set(row, snapshot);
|