@yielded/agent-storage-memory 0.1.0-beta.190 → 0.1.0-beta.192
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/MemorySubmissionLedger.d.mts +4 -4
- package/dist/MemorySubmissionLedger.mjs +4 -4
- package/dist/MemorySubmissionLedger.mjs.map +1 -1
- package/dist/MemoryThreadStore.d.mts +3 -3
- package/dist/MemoryThreadStore.mjs +10 -10
- package/dist/MemoryThreadStore.mjs.map +1 -1
- package/package.json +1 -1
- package/src/MemorySubmissionLedger.ts +6 -6
- package/src/MemoryThreadStore.ts +10 -10
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@yielded/agent-storage-memory","version":"0.1.0-beta.
|
|
1
|
+
{"name":"@yielded/agent-storage-memory","version":"0.1.0-beta.192","dependencies":{"@yielded/agent":"0.1.0-beta.192"},"devDependencies":{"@effect/platform-node":"4.1.2","@effect/vitest":"4.1.2","effect":"4.1.2","typescript":"7.0.2","vite":"npm:@voidzero-dev/vite-plus-core@1.1.0","vite-plus":"1.1.0","vitest":"5.0.3"},"peerDependencies":{"effect":"^4.1.0"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./memory-message-delivery-store":{"types":"./dist/MemoryMessageDeliveryStore.d.mts","default":"./dist/MemoryMessageDeliveryStore.mjs"},"./memory-schedule-store":{"types":"./dist/MemoryScheduleStore.d.mts","default":"./dist/MemoryScheduleStore.mjs"},"./memory-semantic-index":{"types":"./dist/MemorySemanticIndex.d.mts","default":"./dist/MemorySemanticIndex.mjs"},"./memory-submission-ledger":{"types":"./dist/MemorySubmissionLedger.d.mts","default":"./dist/MemorySubmissionLedger.mjs"},"./memory-subscription-store":{"types":"./dist/MemorySubscriptionStore.d.mts","default":"./dist/MemorySubscriptionStore.mjs"},"./memory-thread-store":{"types":"./dist/MemoryThreadStore.d.mts","default":"./dist/MemoryThreadStore.mjs"}},"description":"In-memory Thread store and submission ledger reference adapters for Effect Agent tests and conformance suites.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/yielded-dev/agent.git","directory":"packages/storage-memory"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"effect-tsrs diagnostics --type-check --project tsconfig.json","test":"vp test --passWithNoTests"}}
|
|
@@ -124,7 +124,7 @@ import { admissionWork } from "@yielded/agent/thread-work";
|
|
|
124
124
|
import * as Cause from "effect/Cause";
|
|
125
125
|
import * as Clock from "effect/Clock";
|
|
126
126
|
import * as Context from "effect/Context";
|
|
127
|
-
import * as
|
|
127
|
+
import * as SecureRandom from "effect/crypto/SecureRandom";
|
|
128
128
|
import * as DateTime from "effect/DateTime";
|
|
129
129
|
import * as Effect from "effect/Effect";
|
|
130
130
|
import * as Exit from "effect/Exit";
|
|
@@ -675,10 +675,10 @@ const makeSubmissionLedger = Effect.fnUntraced(
|
|
|
675
675
|
*/
|
|
676
676
|
function* (options: MemorySubmissionLedgerOptions = {}) {
|
|
677
677
|
const journal = yield* MemoryThreadStoreKernel;
|
|
678
|
-
const crypto = yield*
|
|
678
|
+
const crypto = yield* SecureRandom.SecureRandom;
|
|
679
679
|
|
|
680
680
|
const mintIdentity = (operation: string) =>
|
|
681
|
-
crypto.
|
|
681
|
+
crypto.uuidV4().pipe(
|
|
682
682
|
Effect.flatMap(Schema.decodeEffect(MemoryIdentityNonce)),
|
|
683
683
|
Effect.mapError((cause) => ledgerError(operation, "Cannot mint a Memory identity", cause)),
|
|
684
684
|
);
|
|
@@ -3532,7 +3532,7 @@ export interface MemorySubmissionLedgerOptions {
|
|
|
3532
3532
|
|
|
3533
3533
|
/**
|
|
3534
3534
|
* In-memory reference SubmissionLedger Layer (durability `non-durable`). All state lives in one
|
|
3535
|
-
* `Ref` owned by the Layer's Scope. Fresh identities use the supplied `
|
|
3535
|
+
* `Ref` owned by the Layer's Scope. Fresh identities use the supplied `SecureRandom` service;
|
|
3536
3536
|
* imported identities remain unchanged. No daemon fibers are spawned and no wall clock is consulted.
|
|
3537
3537
|
*/
|
|
3538
3538
|
export const memorySubmissionLedgerLayer = (
|
|
@@ -3540,11 +3540,11 @@ export const memorySubmissionLedgerLayer = (
|
|
|
3540
3540
|
): Layer.Layer<
|
|
3541
3541
|
SubmissionLedger | SettlementPublisher,
|
|
3542
3542
|
never,
|
|
3543
|
-
MemoryThreadStoreKernel |
|
|
3543
|
+
MemoryThreadStoreKernel | SecureRandom.SecureRandom
|
|
3544
3544
|
> => Layer.effectContext(makeSubmissionLedger(options));
|
|
3545
3545
|
|
|
3546
3546
|
export const MemorySubmissionLedgerLive: Layer.Layer<
|
|
3547
3547
|
SubmissionLedger | SettlementPublisher,
|
|
3548
3548
|
never,
|
|
3549
|
-
MemoryThreadStoreKernel |
|
|
3549
|
+
MemoryThreadStoreKernel | SecureRandom.SecureRandom
|
|
3550
3550
|
> = memorySubmissionLedgerLayer();
|
package/src/MemoryThreadStore.ts
CHANGED
|
@@ -133,7 +133,7 @@ import {
|
|
|
133
133
|
type ThreadWorkStorage,
|
|
134
134
|
} from "@yielded/agent/thread-work";
|
|
135
135
|
import * as Context from "effect/Context";
|
|
136
|
-
import * as
|
|
136
|
+
import * as CryptoDigest from "effect/crypto/Digest";
|
|
137
137
|
import * as Effect from "effect/Effect";
|
|
138
138
|
import * as Base64 from "effect/encoding/Base64";
|
|
139
139
|
import * as Layer from "effect/Layer";
|
|
@@ -758,7 +758,7 @@ const findThread = Effect.fnUntraced(function* (
|
|
|
758
758
|
|
|
759
759
|
const makeThreadStore = Effect.gen(function* () {
|
|
760
760
|
const maxThreads = yield* ThreadCapacity;
|
|
761
|
-
const crypto = yield*
|
|
761
|
+
const crypto = yield* CryptoDigest.Digest;
|
|
762
762
|
const state = yield* Ref.make<MemoryState>({ threads: new Map() });
|
|
763
763
|
const gate = yield* Semaphore.make(1);
|
|
764
764
|
const owner = yield* makeStorageOwner(gate.withPermits(1));
|
|
@@ -840,7 +840,7 @@ const makeThreadStore = Effect.gen(function* () {
|
|
|
840
840
|
const request = yield* validate(ThreadWorkRequest, "work page", unvalidated);
|
|
841
841
|
|
|
842
842
|
const cursor = yield* decodeWorkCursor(request).pipe(
|
|
843
|
-
Effect.provideService(
|
|
843
|
+
Effect.provideService(CryptoDigest.Digest, crypto),
|
|
844
844
|
);
|
|
845
845
|
|
|
846
846
|
const thread = (yield* Ref.get(state)).threads.get(request.threadId);
|
|
@@ -962,7 +962,7 @@ const makeThreadStore = Effect.gen(function* () {
|
|
|
962
962
|
);
|
|
963
963
|
|
|
964
964
|
const commitWork = yield* prepareWork(index, records).pipe(
|
|
965
|
-
Effect.provideService(
|
|
965
|
+
Effect.provideService(CryptoDigest.Digest, crypto),
|
|
966
966
|
);
|
|
967
967
|
|
|
968
968
|
// Shared writer gate fences the current tail; publish native locators and catalogue together.
|
|
@@ -1105,7 +1105,7 @@ const makeThreadStore = Effect.gen(function* () {
|
|
|
1105
1105
|
request.threadId,
|
|
1106
1106
|
request.batch.records,
|
|
1107
1107
|
).pipe(
|
|
1108
|
-
Effect.provideService(
|
|
1108
|
+
Effect.provideService(CryptoDigest.Digest, crypto),
|
|
1109
1109
|
Effect.mapError((cause) => deliveryError("Invalid canonical delivery", cause)),
|
|
1110
1110
|
);
|
|
1111
1111
|
|
|
@@ -1235,7 +1235,7 @@ const makeThreadStore = Effect.gen(function* () {
|
|
|
1235
1235
|
request.batch,
|
|
1236
1236
|
decodeCanonicalSequence(thread.tailSequence + 1),
|
|
1237
1237
|
),
|
|
1238
|
-
).pipe(Effect.provideService(
|
|
1238
|
+
).pipe(Effect.provideService(CryptoDigest.Digest, crypto))
|
|
1239
1239
|
: undefined;
|
|
1240
1240
|
|
|
1241
1241
|
let commitDeliveries: (() => void) | undefined;
|
|
@@ -2038,7 +2038,7 @@ const makeThreadStore = Effect.gen(function* () {
|
|
|
2038
2038
|
yield* Stream.runForEach(captured, (input) =>
|
|
2039
2039
|
Effect.gen(function* () {
|
|
2040
2040
|
const page = yield* prepareImportPage(progress, input).pipe(
|
|
2041
|
-
Effect.provideService(
|
|
2041
|
+
Effect.provideService(CryptoDigest.Digest, crypto),
|
|
2042
2042
|
);
|
|
2043
2043
|
|
|
2044
2044
|
const id = page.archive.threadId;
|
|
@@ -2131,7 +2131,7 @@ const makeThreadStore = Effect.gen(function* () {
|
|
|
2131
2131
|
const native = prepareIndexes(staged, records);
|
|
2132
2132
|
|
|
2133
2133
|
const commitWork = yield* prepareWork(stagedWork, records).pipe(
|
|
2134
|
-
Effect.provideService(
|
|
2134
|
+
Effect.provideService(CryptoDigest.Digest, crypto),
|
|
2135
2135
|
);
|
|
2136
2136
|
|
|
2137
2137
|
retainRecords(staged, records);
|
|
@@ -2272,7 +2272,7 @@ const makeThreadStore = Effect.gen(function* () {
|
|
|
2272
2272
|
),
|
|
2273
2273
|
}),
|
|
2274
2274
|
);
|
|
2275
|
-
}).pipe(Effect.provideService(
|
|
2275
|
+
}).pipe(Effect.provideService(CryptoDigest.Digest, crypto)),
|
|
2276
2276
|
),
|
|
2277
2277
|
);
|
|
2278
2278
|
|
|
@@ -2612,7 +2612,7 @@ const makeThreadStore = Effect.gen(function* () {
|
|
|
2612
2612
|
: { requireAllSettled: request.requireAllSettled }),
|
|
2613
2613
|
}).pipe(
|
|
2614
2614
|
Effect.provide(ThreadImportReader.layer(reader)),
|
|
2615
|
-
Effect.provideService(
|
|
2615
|
+
Effect.provideService(CryptoDigest.Digest, crypto),
|
|
2616
2616
|
);
|
|
2617
2617
|
}),
|
|
2618
2618
|
),
|