@effect-agent/storage-cloudflare 0.1.0-beta.33 → 0.1.0-beta.34
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/index.d.mts +16 -0
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -10
- package/src/do-conversation-store.ts +8 -8
- package/src/do-journal.ts +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -524,6 +524,10 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
524
524
|
readonly kind: "follow-up" | "steering" | "user";
|
|
525
525
|
readonly runId?: string | undefined;
|
|
526
526
|
readonly input: Schema.Json;
|
|
527
|
+
} | {
|
|
528
|
+
readonly _tag: "RunStarted";
|
|
529
|
+
readonly runId: string;
|
|
530
|
+
readonly maxDurationMillis: number;
|
|
527
531
|
} | {
|
|
528
532
|
readonly _tag: "ModelCompleted";
|
|
529
533
|
readonly runId: string;
|
|
@@ -769,6 +773,10 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
769
773
|
readonly kind: "follow-up" | "steering" | "user";
|
|
770
774
|
readonly runId?: string | undefined;
|
|
771
775
|
readonly input: Schema.Json;
|
|
776
|
+
} | {
|
|
777
|
+
readonly _tag: "RunStarted";
|
|
778
|
+
readonly runId: string;
|
|
779
|
+
readonly maxDurationMillis: number;
|
|
772
780
|
} | {
|
|
773
781
|
readonly _tag: "ModelCompleted";
|
|
774
782
|
readonly runId: string;
|
|
@@ -1143,6 +1151,10 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1143
1151
|
readonly kind: "follow-up" | "steering" | "user";
|
|
1144
1152
|
readonly runId?: string | undefined;
|
|
1145
1153
|
readonly input: Schema.Json;
|
|
1154
|
+
} | {
|
|
1155
|
+
readonly _tag: "RunStarted";
|
|
1156
|
+
readonly runId: string;
|
|
1157
|
+
readonly maxDurationMillis: number;
|
|
1146
1158
|
} | {
|
|
1147
1159
|
readonly _tag: "ModelCompleted";
|
|
1148
1160
|
readonly runId: string;
|
|
@@ -1410,6 +1422,10 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1410
1422
|
readonly kind: "follow-up" | "steering" | "user";
|
|
1411
1423
|
readonly runId?: string | undefined;
|
|
1412
1424
|
readonly input: Schema.Json;
|
|
1425
|
+
} | {
|
|
1426
|
+
readonly _tag: "RunStarted";
|
|
1427
|
+
readonly runId: string;
|
|
1428
|
+
readonly maxDurationMillis: number;
|
|
1413
1429
|
} | {
|
|
1414
1430
|
readonly _tag: "ModelCompleted";
|
|
1415
1431
|
readonly runId: string;
|
package/dist/index.mjs
CHANGED
|
@@ -477,13 +477,13 @@ const storageError = (operation) => (error) => DoStorageError.make({
|
|
|
477
477
|
message: error.message
|
|
478
478
|
});
|
|
479
479
|
/** Decode raw Durable Object SQLite rows against a Schema, reporting failures as typed corruption. */
|
|
480
|
-
const decodeRows = Effect.fn(
|
|
480
|
+
const decodeRows = Effect.fn((schema, table, rowKey, rows) => Schema.decodeUnknownEffect(schema)(rows).pipe(Effect.mapError((error) => DoStorageCorruptionError.make({
|
|
481
481
|
table,
|
|
482
482
|
rowKey,
|
|
483
483
|
message: String(error)
|
|
484
484
|
}))));
|
|
485
485
|
/** Decode exactly one raw row against a Schema, reporting failures as typed corruption. */
|
|
486
|
-
const decodeSingleRow = Effect.fn(
|
|
486
|
+
const decodeSingleRow = Effect.fn((schema, table, rowKey, rows) => decodeRows(schema, table, rowKey, rows).pipe(Effect.flatMap((decoded) => decoded.length === 1 ? Effect.succeed(decoded[0]) : Effect.fail(DoStorageCorruptionError.make({
|
|
487
487
|
table,
|
|
488
488
|
rowKey,
|
|
489
489
|
message: `Expected exactly one row but found ${decoded.length}.`
|
|
@@ -1133,10 +1133,10 @@ const schemaStoreError = (operation, error) => ConversationStoreError.make({
|
|
|
1133
1133
|
operation,
|
|
1134
1134
|
message: error.message
|
|
1135
1135
|
});
|
|
1136
|
-
const makeOffset = Effect.fn(
|
|
1136
|
+
const makeOffset = Effect.fn(function* (conversationId, sequence) {
|
|
1137
1137
|
return yield* Schema.decodeUnknownEffect(CanonicalSequence)(sequence).pipe(Effect.flatMap((validatedSequence) => Schema.decodeUnknownEffect(ObservationOffset)(`${DO_OFFSET_PREFIX}${encodeURIComponent(conversationId)}:${validatedSequence}`)), Effect.mapError((error) => schemaStoreError("encode observation offset", error)));
|
|
1138
1138
|
});
|
|
1139
|
-
const parseOffset = Effect.fn(
|
|
1139
|
+
const parseOffset = Effect.fn(function* (conversationId, offset) {
|
|
1140
1140
|
if (offset === void 0) return ZERO_CANONICAL_SEQUENCE;
|
|
1141
1141
|
const text = yield* Schema.decodeUnknownEffect(OffsetText)(offset).pipe(Effect.mapError((error) => schemaStoreError("decode observation offset", error)));
|
|
1142
1142
|
const conversationPrefix = `${DO_OFFSET_PREFIX}${encodeURIComponent(conversationId)}:`;
|
|
@@ -1156,16 +1156,16 @@ const mapFence = (conversationId, error) => FenceRejected.make({
|
|
|
1156
1156
|
actualEpoch: error.actualEpoch,
|
|
1157
1157
|
attemptedEpoch: error.producerEpoch
|
|
1158
1158
|
});
|
|
1159
|
-
const encodeCanonicalRecord = Effect.fn(
|
|
1159
|
+
const encodeCanonicalRecord = Effect.fn(function* (record) {
|
|
1160
1160
|
return yield* Schema.encodeEffect(Schema.fromJsonString(CanonicalRecord))(record).pipe(Effect.mapError((error) => schemaStoreError("encode canonical record", error)));
|
|
1161
1161
|
});
|
|
1162
|
-
const encodeCanonicalBatch = Effect.fn(
|
|
1162
|
+
const encodeCanonicalBatch = Effect.fn(function* (batch) {
|
|
1163
1163
|
return yield* Schema.encodeEffect(Schema.fromJsonString(CanonicalBatch))(batch).pipe(Effect.mapError((error) => schemaStoreError("encode canonical batch", error)));
|
|
1164
1164
|
});
|
|
1165
|
-
const encodeCheckpoint = Effect.fn(
|
|
1165
|
+
const encodeCheckpoint = Effect.fn(function* (checkpoint) {
|
|
1166
1166
|
return yield* Schema.encodeEffect(Schema.fromJsonString(ConversationCheckpoint))(checkpoint).pipe(Effect.mapError((error) => schemaStoreError("encode checkpoint", error)));
|
|
1167
1167
|
});
|
|
1168
|
-
const decodeEnvelope = Effect.fn(
|
|
1168
|
+
const decodeEnvelope = Effect.fn(function* (row) {
|
|
1169
1169
|
const record = yield* Schema.decodeEffect(Schema.fromJsonString(CanonicalRecord))(row.record_json).pipe(Effect.mapError((error) => ConversationStoreError.make({
|
|
1170
1170
|
operation: "decode canonical record",
|
|
1171
1171
|
message: error.message
|
|
@@ -1181,7 +1181,7 @@ const decodeEnvelope = Effect.fn("DoConversationStore.decodeEnvelope")(function*
|
|
|
1181
1181
|
record
|
|
1182
1182
|
});
|
|
1183
1183
|
});
|
|
1184
|
-
const decodeCheckpoint = Effect.fn(
|
|
1184
|
+
const decodeCheckpoint = Effect.fn(function* (checkpointJson) {
|
|
1185
1185
|
return yield* Schema.decodeEffect(Schema.fromJsonString(ConversationCheckpoint))(checkpointJson).pipe(Effect.mapError((error) => schemaStoreError("decode checkpoint", error)));
|
|
1186
1186
|
});
|
|
1187
1187
|
const requireConversation = Effect.fn("DoConversationStore.requireConversation")(function* (journal, conversationId) {
|
|
@@ -1321,7 +1321,7 @@ const makeServices$1 = Effect.fn("DoConversationStore.makeServices")(function* (
|
|
|
1321
1321
|
const journal = yield* initializeDoJournal(sql, failpoint.hit, config.maxStoredValueBytes);
|
|
1322
1322
|
if (config.verifyOnOpen) yield* decodeStartupPayloads(journal, crypto);
|
|
1323
1323
|
const provideCrypto = (effect) => Effect.provideService(effect, Crypto.Crypto, crypto);
|
|
1324
|
-
const hitFailpoint = Effect.fn(
|
|
1324
|
+
const hitFailpoint = Effect.fn((location) => failpoint.hit(location).pipe(Effect.mapError((error) => storeError(`storage failpoint ${location}`, error))));
|
|
1325
1325
|
const materialize = Effect.fn("DoConversationStore.materialize")(function* (request) {
|
|
1326
1326
|
const validated = yield* Schema.decodeUnknownEffect(Schema.toType(ConversationMaterialization))(request).pipe(Effect.mapError((error) => schemaStoreError("validate materialization", error)));
|
|
1327
1327
|
const now = yield* Clock.currentTimeMillis;
|