@effect-agent/storage-cloudflare 0.1.0-beta.6 → 0.1.0-beta.60

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 (72) hide show
  1. package/dist/DoMemoryStore.d.mts +29 -0
  2. package/dist/DoMemoryStore.mjs +55 -0
  3. package/dist/DoMemoryStore.mjs.map +1 -0
  4. package/dist/DoMessageDeliveryStore.d.mts +17 -0
  5. package/dist/DoMessageDeliveryStore.mjs +32 -0
  6. package/dist/DoMessageDeliveryStore.mjs.map +1 -0
  7. package/dist/DoScheduleStore.d.mts +36 -0
  8. package/dist/DoScheduleStore.mjs +388 -0
  9. package/dist/DoScheduleStore.mjs.map +1 -0
  10. package/dist/DoStorageConfig.d.mts +45 -0
  11. package/dist/DoStorageConfig.mjs +52 -0
  12. package/dist/DoStorageConfig.mjs.map +1 -0
  13. package/dist/DoStorageError-UrxrvbnF.d.mts +98 -0
  14. package/dist/DoStorageError.d.mts +2 -0
  15. package/dist/DoStorageError.mjs +162 -0
  16. package/dist/DoStorageError.mjs.map +1 -0
  17. package/dist/DoStorageFailpoint.d.mts +17 -0
  18. package/dist/DoStorageFailpoint.mjs +14 -0
  19. package/dist/DoStorageFailpoint.mjs.map +1 -0
  20. package/dist/DoStorageFailpointTesting.d.mts +34 -0
  21. package/dist/DoStorageFailpointTesting.mjs +35 -0
  22. package/dist/DoStorageFailpointTesting.mjs.map +1 -0
  23. package/dist/DoStorageVersion-Pt3jEHdW.d.mts +10 -0
  24. package/dist/DoStorageVersion.d.mts +2 -0
  25. package/dist/DoStorageVersion.mjs +8 -0
  26. package/dist/DoStorageVersion.mjs.map +1 -0
  27. package/dist/DoSubmissionLedger.d.mts +23 -0
  28. package/dist/DoSubmissionLedger.mjs +1826 -0
  29. package/dist/DoSubmissionLedger.mjs.map +1 -0
  30. package/dist/DoSubscriptionStore.d.mts +25 -0
  31. package/dist/DoSubscriptionStore.mjs +183 -0
  32. package/dist/DoSubscriptionStore.mjs.map +1 -0
  33. package/dist/DoThreadStore.d.mts +59 -0
  34. package/dist/DoThreadStore.mjs +432 -0
  35. package/dist/DoThreadStore.mjs.map +1 -0
  36. package/dist/MemoryProtocol.d.mts +19796 -0
  37. package/dist/MemoryProtocol.mjs +182 -0
  38. package/dist/MemoryProtocol.mjs.map +1 -0
  39. package/dist/PortProtocol.d.mts +2951 -0
  40. package/dist/PortProtocol.mjs +176 -0
  41. package/dist/PortProtocol.mjs.map +1 -0
  42. package/dist/PortRouting.d.mts +82 -0
  43. package/dist/PortRouting.mjs +405 -0
  44. package/dist/PortRouting.mjs.map +1 -0
  45. package/dist/do-journal-Brv7xSH5.mjs +869 -0
  46. package/dist/do-journal-Brv7xSH5.mjs.map +1 -0
  47. package/dist/index.d.mts +14 -1505
  48. package/dist/index.mjs +14 -3695
  49. package/dist/migrations-soC86CQA.mjs +267 -0
  50. package/dist/migrations-soC86CQA.mjs.map +1 -0
  51. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  52. package/package.json +1 -45
  53. package/src/DoMemoryStore.ts +59 -0
  54. package/src/DoMessageDeliveryStore.ts +53 -0
  55. package/src/DoScheduleStore.ts +622 -0
  56. package/src/{errors.ts → DoStorageError.ts} +8 -3
  57. package/src/DoStorageFailpoint.ts +20 -0
  58. package/src/{do-storage-failpoint.ts → DoStorageFailpointTesting.ts} +5 -18
  59. package/src/DoStorageVersion.ts +2 -0
  60. package/src/{do-ledger.ts → DoSubmissionLedger.ts} +757 -123
  61. package/src/DoSubscriptionStore.ts +329 -0
  62. package/src/DoThreadStore.ts +924 -0
  63. package/src/MemoryProtocol.ts +291 -0
  64. package/src/{port-protocol.ts → PortProtocol.ts} +41 -34
  65. package/src/{routing.ts → PortRouting.ts} +266 -259
  66. package/src/index.ts +13 -32
  67. package/src/{do-journal.ts → internal/do-journal.ts} +495 -214
  68. package/src/internal/message-delivery-schema.ts +24 -0
  69. package/src/{migrations.ts → internal/migrations.ts} +40 -35
  70. package/dist/index.mjs.map +0 -1
  71. package/src/do-conversation-store.ts +0 -850
  72. /package/src/{do-storage-config.ts → DoStorageConfig.ts} +0 -0
@@ -0,0 +1,291 @@
1
+ import * as MemoryNamespace from "@effect-agent/core/MemoryNamespace";
2
+ import {
3
+ MemoryLookup,
4
+ MemoryRecallError,
5
+ MemoryRecallLimits,
6
+ } from "@effect-agent/core/MemoryReference";
7
+ import { MemoryAccess, revalidateMemoryLookup } from "@effect-agent/core/MemoryRevalidation";
8
+ import { type MemoryReader } from "@effect-agent/core/MemoryStore";
9
+ import {
10
+ MemoryConflict,
11
+ MemoryDocument,
12
+ MemoryMutationFailure,
13
+ MemoryOperationConflict,
14
+ MemoryStorageError,
15
+ MemoryWithdrawn,
16
+ MemoryWrite,
17
+ MemoryWriter,
18
+ } from "@effect-agent/core/MemoryStore";
19
+ import {
20
+ MemoryIndexSearch,
21
+ MemoryIndexError,
22
+ SemanticMemoryProfile,
23
+ } from "@effect-agent/core/SemanticMemoryIndex";
24
+ import {
25
+ SemanticMemoryError,
26
+ SemanticCandidateLimits,
27
+ SemanticCandidateResult,
28
+ revalidateSemanticMemoryCandidates,
29
+ } from "@effect-agent/core/SemanticMemoryRevalidation";
30
+ import { Principal } from "@effect-agent/thread/SubmissionLedger";
31
+ import { Clock, Context, Effect, Schema } from "effect";
32
+
33
+ export class MemoryRpcError extends Schema.TaggedError<MemoryRpcError>()("MemoryRpcError", {
34
+ reason: Schema.Literals(["denied", "protocol", "budget", "timeout", "unavailable"]),
35
+ }) {}
36
+
37
+ export class MemoryRpcLimits extends Schema.Class<MemoryRpcLimits>(
38
+ "@effect-agent/storage-cloudflare/MemoryRpcLimits",
39
+ )({
40
+ maxRequestBytes: Schema.Int.check(Schema.isBetween({ minimum: 256, maximum: 4_194_304 })),
41
+ maxResponseBytes: Schema.Int.check(Schema.isBetween({ minimum: 256, maximum: 16_777_216 })),
42
+ maxSourceBytes: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 67_108_864 })),
43
+ maxSources: MemoryRecallLimits.fields.maxSources,
44
+ timeoutMillis: MemoryRecallLimits.fields.timeoutMillis,
45
+ }) {}
46
+
47
+ export const defaultMemoryRpcLimits = MemoryRpcLimits.make({
48
+ maxRequestBytes: 1_048_576,
49
+ maxResponseBytes: 4_194_304,
50
+ maxSourceBytes: 16_777_216,
51
+ maxSources: 16,
52
+ timeoutMillis: 10_000,
53
+ });
54
+
55
+ const RequestFields = {
56
+ version: Schema.Literal(1),
57
+ access: MemoryAccess.Wire,
58
+ /** Host-authenticated identity, never copied from model input. The owner still authorizes it. */
59
+ principal: Principal,
60
+ deadlineMillis: Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0)),
61
+ };
62
+
63
+ const RevalidateRequest = Schema.TaggedStruct("Revalidate", {
64
+ ...RequestFields,
65
+ lookup: MemoryLookup,
66
+ limits: MemoryRecallLimits,
67
+ });
68
+
69
+ const ChangeRequest = Schema.TaggedStruct("Change", { ...RequestFields, write: MemoryWrite.Wire });
70
+
71
+ const SemanticRequest: Schema.TaggedStruct<
72
+ "RevalidateSemantic",
73
+ typeof RequestFields & {
74
+ readonly found: typeof MemoryIndexSearch.Wire;
75
+ readonly profile: typeof SemanticMemoryProfile;
76
+ readonly limits: typeof SemanticCandidateLimits;
77
+ }
78
+ > = Schema.TaggedStruct("RevalidateSemantic", {
79
+ ...RequestFields,
80
+ found: MemoryIndexSearch.Wire,
81
+ profile: SemanticMemoryProfile,
82
+ limits: SemanticCandidateLimits,
83
+ });
84
+
85
+ export const MemoryOwnerRequest: Schema.Union<
86
+ [typeof RevalidateRequest, typeof ChangeRequest, typeof SemanticRequest]
87
+ > = Schema.Union([RevalidateRequest, ChangeRequest, SemanticRequest]);
88
+
89
+ export type MemoryOwnerRequest = typeof MemoryOwnerRequest.Type;
90
+
91
+ export const MemoryOwnerFailure = Schema.Union([
92
+ MemoryRpcError,
93
+ MemoryStorageError,
94
+ MemoryRecallError,
95
+ MemoryConflict,
96
+ MemoryWithdrawn,
97
+ MemoryOperationConflict,
98
+ MemoryMutationFailure,
99
+ MemoryIndexError,
100
+ SemanticMemoryError,
101
+ ]);
102
+
103
+ export type MemoryOwnerFailure = typeof MemoryOwnerFailure.Type;
104
+
105
+ export const MemoryOwnerResponse = Schema.Union([
106
+ Schema.TaggedStruct("Lookup", { access: MemoryAccess.Wire, lookup: MemoryLookup }),
107
+ Schema.TaggedStruct("Changed", { access: MemoryAccess.Wire, document: MemoryDocument.Wire }),
108
+ Schema.TaggedStruct("Semantic", { access: MemoryAccess.Wire, result: SemanticCandidateResult }),
109
+ Schema.TaggedStruct("Failed", { failure: MemoryOwnerFailure }),
110
+ ]);
111
+
112
+ export type MemoryOwnerResponse = typeof MemoryOwnerResponse.Type;
113
+
114
+ /** Fail-closed application policy. Authorize the namespace, principal, scope, and full command. */
115
+ export class MemoryOwnerAuthorizer extends Context.Service<
116
+ MemoryOwnerAuthorizer,
117
+ {
118
+ readonly authorize: (request: MemoryOwnerRequest) => Effect.Effect<void, MemoryRpcError>;
119
+ }
120
+ >()("@effect-agent/storage-cloudflare/MemoryOwnerAuthorizer") {}
121
+
122
+ /** Canonical namespace derived from this object's idFromName identity, never its request. */
123
+ export class MemoryOwnerIdentity extends Context.Service<
124
+ MemoryOwnerIdentity,
125
+ {
126
+ readonly namespace: MemoryNamespace.Any;
127
+ }
128
+ >()("@effect-agent/storage-cloudflare/MemoryOwnerIdentity") {}
129
+
130
+ export const memoryWireBytes = (text: string): number => new TextEncoder().encode(text).byteLength;
131
+
132
+ export const decodeMemoryWire = Effect.fn("decodeMemoryWire")(function* <A, I>(
133
+ schema: Schema.Codec<A, I, never>,
134
+ raw: unknown,
135
+ maxBytes: number,
136
+ ) {
137
+ const text = yield* Schema.decodeUnknownEffect(Schema.String)(raw).pipe(
138
+ Effect.mapError(() => MemoryRpcError.make({ reason: "protocol" })),
139
+ );
140
+
141
+ if (text.length > maxBytes || memoryWireBytes(text) > maxBytes)
142
+ return yield* MemoryRpcError.make({ reason: "budget" });
143
+
144
+ return yield* Schema.decodeEffect(Schema.fromJsonString(schema))(text).pipe(
145
+ Effect.mapError(() => MemoryRpcError.make({ reason: "protocol" })),
146
+ );
147
+ });
148
+
149
+ export const encodeMemoryWire = Effect.fn("encodeMemoryWire")(function* <A, I>(
150
+ schema: Schema.Codec<A, I, never, never>,
151
+ value: A,
152
+ maxBytes: number,
153
+ ) {
154
+ const encoded = yield* Schema.encodeEffect(Schema.fromJsonString(schema))(value).pipe(
155
+ Effect.mapError(() => MemoryRpcError.make({ reason: "protocol" })),
156
+ );
157
+
158
+ if (encoded.length > maxBytes || memoryWireBytes(encoded) > maxBytes)
159
+ return yield* MemoryRpcError.make({ reason: "budget" });
160
+
161
+ return encoded;
162
+ });
163
+
164
+ /** One local read per distinct candidate source, with no per-document network calls. */
165
+ export const handleMemoryOwnerRequest = Effect.fn("MemoryOwner.handleRequest")(function* (
166
+ raw: unknown,
167
+ limits: MemoryRpcLimits = defaultMemoryRpcLimits,
168
+ ): Effect.fn.Return<
169
+ string,
170
+ never,
171
+ MemoryOwnerIdentity | MemoryOwnerAuthorizer | MemoryReader | MemoryWriter
172
+ > {
173
+ const result = yield* Effect.gen(function* (): Effect.fn.Return<
174
+ MemoryOwnerResponse,
175
+ MemoryOwnerFailure,
176
+ MemoryOwnerIdentity | MemoryOwnerAuthorizer | MemoryReader | MemoryWriter
177
+ > {
178
+ limits = yield* Schema.decodeUnknownEffect(MemoryRpcLimits)(limits).pipe(
179
+ Effect.mapError(() => MemoryRpcError.make({ reason: "protocol" })),
180
+ );
181
+ const request = yield* decodeMemoryWire(MemoryOwnerRequest, raw, limits.maxRequestBytes);
182
+ const { namespace } = yield* MemoryOwnerIdentity;
183
+
184
+ if (
185
+ !MemoryNamespace.equals(namespace, request.access.namespace) ||
186
+ (request._tag === "Change" &&
187
+ !MemoryNamespace.equals(namespace, request.write.key.namespace)) ||
188
+ (request._tag === "RevalidateSemantic" &&
189
+ request.found.candidates.some(
190
+ (candidate) => !MemoryNamespace.equals(namespace, candidate.key.namespace),
191
+ ))
192
+ )
193
+ return yield* MemoryRpcError.make({ reason: "denied" });
194
+
195
+ const remaining = Math.min(
196
+ limits.timeoutMillis,
197
+ request.deadlineMillis - (yield* Clock.currentTimeMillis),
198
+ );
199
+
200
+ if (remaining <= 0) return yield* MemoryRpcError.make({ reason: "timeout" });
201
+
202
+ return yield* Effect.gen(function* (): Effect.fn.Return<
203
+ MemoryOwnerResponse,
204
+ MemoryOwnerFailure,
205
+ MemoryOwnerAuthorizer | MemoryReader | MemoryWriter
206
+ > {
207
+ const authorizer = yield* MemoryOwnerAuthorizer;
208
+
209
+ yield* authorizer.authorize(request);
210
+ if (request._tag === "Change") {
211
+ const writer = yield* MemoryWriter;
212
+
213
+ return {
214
+ _tag: "Changed",
215
+ access: request.access,
216
+ document: yield* writer.change(request.write),
217
+ };
218
+ }
219
+ if (request._tag === "RevalidateSemantic") {
220
+ if (
221
+ new Set(request.found.candidates.map((candidate) => candidate.key.id)).size >
222
+ limits.maxSources
223
+ )
224
+ return yield* MemoryRpcError.make({ reason: "budget" });
225
+
226
+ const result = yield* revalidateSemanticMemoryCandidates(
227
+ request.found,
228
+ request.access,
229
+ request.profile,
230
+ {
231
+ ...request.limits,
232
+ maxSourceBytes: Math.min(
233
+ limits.maxSourceBytes,
234
+ request.limits.maxSourceBytes ?? 16_777_216,
235
+ ),
236
+ maxOutputBytes: Math.min(
237
+ limits.maxResponseBytes,
238
+ request.limits.maxOutputBytes ?? 16_777_216,
239
+ ),
240
+ },
241
+ );
242
+
243
+ return { _tag: "Semantic", access: request.access, result };
244
+ }
245
+
246
+ const count =
247
+ request.lookup._tag === "Found"
248
+ ? new Set(request.lookup.passages.map((passage) => passage.source.id)).size
249
+ : 0;
250
+
251
+ if (count > Math.min(limits.maxSources, request.limits.maxSources))
252
+ return yield* MemoryRpcError.make({ reason: "budget" });
253
+
254
+ const lookup = yield* revalidateMemoryLookup(request.lookup, request.access, {
255
+ maxSourceBytes: limits.maxSourceBytes,
256
+ maxInputBytes: Math.min(limits.maxSourceBytes, request.limits.maxInputBytes ?? 16_777_216),
257
+ });
258
+
259
+ return { _tag: "Lookup", access: request.access, lookup };
260
+ }).pipe(
261
+ Effect.scoped,
262
+ Effect.timeoutOrElse({
263
+ duration: remaining,
264
+ orElse: () => Effect.fail(MemoryRpcError.make({ reason: "timeout" })),
265
+ }),
266
+ );
267
+ }).pipe(
268
+ Effect.flatMap((response) =>
269
+ encodeMemoryWire(MemoryOwnerResponse, response, limits.maxResponseBytes),
270
+ ),
271
+ Effect.result,
272
+ );
273
+
274
+ if (result._tag === "Success") return result.success;
275
+
276
+ return yield* encodeMemoryWire(
277
+ MemoryOwnerResponse,
278
+ {
279
+ _tag: "Failed",
280
+ failure: result.failure,
281
+ },
282
+ limits.maxResponseBytes,
283
+ ).pipe(
284
+ Effect.catch(() =>
285
+ Schema.encodeEffect(Schema.fromJsonString(MemoryOwnerResponse))({
286
+ _tag: "Failed",
287
+ failure: MemoryRpcError.make({ reason: "budget" }),
288
+ }).pipe(Effect.orDie),
289
+ ),
290
+ );
291
+ });
@@ -1,25 +1,14 @@
1
+ import { CanonicalRecordEnvelope } from "@effect-agent/thread/Records";
1
2
  import {
2
3
  AbortCommand,
3
4
  AbortIntent,
4
5
  AdmissionConflict,
6
+ AdmissionPolicyError,
5
7
  AdmissionRequest,
6
8
  AdmissionResolution,
7
9
  AdmissionResult,
8
- AppendConflict,
9
- AppendResult,
10
- CanonicalRecordEnvelope,
11
10
  ChildSettledNotification,
12
11
  ChildSettledOutcome,
13
- ConversationExport,
14
- ConversationExportRequest,
15
- ConversationMaterialization,
16
- ConversationNotMaterialized,
17
- ConversationRead,
18
- ConversationStoreError,
19
- ConversationTail,
20
- ConversationTailRequest,
21
- FenceRejected,
22
- FencedAppendRequest,
23
12
  JoinedToHost,
24
13
  LedgerError,
25
14
  MarkReadyRequest,
@@ -27,20 +16,34 @@ import {
27
16
  SubmissionLookup,
28
17
  SubmissionLookupByKey,
29
18
  SubmissionSnapshot,
30
- } from "@effect-agent/session";
19
+ } from "@effect-agent/thread/SubmissionLedger";
20
+ import {
21
+ AppendConflict,
22
+ AppendResult,
23
+ ThreadExport,
24
+ ThreadExportRequest,
25
+ ThreadMaterialization,
26
+ ThreadNotMaterialized,
27
+ ThreadRead,
28
+ ThreadStoreError,
29
+ ThreadTail,
30
+ ThreadTailRequest,
31
+ FenceRejected,
32
+ FencedAppendRequest,
33
+ } from "@effect-agent/thread/ThreadStore";
31
34
  import { Schema } from "effect";
32
35
 
33
36
  /**
34
37
  * The cross-Durable-Object port protocol (plan §1.3, D-P6-3): Schema request/response/error
35
- * envelopes for the CLOSED route-capable subset of the session ports. One Conversation's
36
- * Durable Object executes another Conversation's request against its OWN local facets; the
38
+ * envelopes for the CLOSED route-capable subset of the thread ports. One Thread's
39
+ * Durable Object executes another Thread's request against its OWN local facets; the
37
40
  * envelopes here are the only values that cross the Object boundary, and they are
38
41
  * transport-agnostic — native Durable Object JS RPC is the shipped carrier, fetch-with-JSON
39
42
  * the documented fallback, and both move the same Schema-encoded JSON.
40
43
  *
41
44
  * The closed subset is exactly the set of operations the durable coordinator performs against
42
- * a FOREIGN Conversation (parent/child establishment, status checks, abort propagation,
43
- * child-settlement notification, and the child-conversation store operations used by
45
+ * a FOREIGN Thread (parent/child establishment, status checks, abort propagation,
46
+ * child-settlement notification, and the child-thread store operations used by
44
47
  * establishment, `verifySettledChild`, and result projection):
45
48
  *
46
49
  * - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,
@@ -53,7 +56,7 @@ import { Schema } from "effect";
53
56
  *
54
57
  * Failures cross the boundary as the `PortFailure` union and re-decode on the caller side to
55
58
  * the SAME tagged error types the local facet would have produced, so routed calls keep
56
- * error-tag fidelity. `cause` chains inside `LedgerError`/`ConversationStoreError` travel as
59
+ * error-tag fidelity. `cause` chains inside `LedgerError`/`ThreadStoreError` travel as
57
60
  * Schema defects and do not claim instance fidelity across Objects (plan §2.8).
58
61
  */
59
62
 
@@ -71,7 +74,7 @@ export const boundPortDiagnostic = (value: string): string =>
71
74
  /**
72
75
  * The envelope itself could not be honored: the receiving Object could not decode the
73
76
  * request, or a response could not be encoded/decoded. It never carries port semantics —
74
- * callers fold it into the operation's base error (`LedgerError`/`ConversationStoreError`),
77
+ * callers fold it into the operation's base error (`LedgerError`/`ThreadStoreError`),
75
78
  * except `resolveAdmission`, which folds it into `AdmissionIndeterminate` because a
76
79
  * non-answer is never proof of absence (SUB-031).
77
80
  */
@@ -128,39 +131,39 @@ export class LedgerRecordChildSettledCall extends Schema.TaggedClass<LedgerRecor
128
131
  request: ChildSettledNotification,
129
132
  }) {}
130
133
 
131
- /** Routed `ConversationStore.materialize` against the owning Object. */
134
+ /** Routed `ThreadStore.materialize` against the owning Object. */
132
135
  export class StoreMaterializeCall extends Schema.TaggedClass<StoreMaterializeCall>(
133
136
  "@effect-agent/storage-cloudflare/StoreMaterializeCall",
134
137
  )("StoreMaterialize", {
135
- request: ConversationMaterialization,
138
+ request: ThreadMaterialization,
136
139
  }) {}
137
140
 
138
- /** Routed `ConversationStore.append` against the owning Object. */
141
+ /** Routed `ThreadStore.append` against the owning Object. */
139
142
  export class StoreAppendCall extends Schema.TaggedClass<StoreAppendCall>(
140
143
  "@effect-agent/storage-cloudflare/StoreAppendCall",
141
144
  )("StoreAppend", {
142
145
  request: FencedAppendRequest,
143
146
  }) {}
144
147
 
145
- /** Routed one-page `ConversationStore.read`; the page bound is the request's own `limit`. */
148
+ /** Routed one-page `ThreadStore.read`; the page bound is the request's own `limit`. */
146
149
  export class StoreReadPageCall extends Schema.TaggedClass<StoreReadPageCall>(
147
150
  "@effect-agent/storage-cloudflare/StoreReadPageCall",
148
151
  )("StoreReadPage", {
149
- request: ConversationRead,
152
+ request: ThreadRead,
150
153
  }) {}
151
154
 
152
- /** Routed `ConversationStore.inspectTail` against the owning Object. */
155
+ /** Routed `ThreadStore.inspectTail` against the owning Object. */
153
156
  export class StoreInspectTailCall extends Schema.TaggedClass<StoreInspectTailCall>(
154
157
  "@effect-agent/storage-cloudflare/StoreInspectTailCall",
155
158
  )("StoreInspectTail", {
156
- request: ConversationTailRequest,
159
+ request: ThreadTailRequest,
157
160
  }) {}
158
161
 
159
- /** Routed `ConversationStore.export` against the owning Object. */
162
+ /** Routed `ThreadStore.export` against the owning Object. */
160
163
  export class StoreExportCall extends Schema.TaggedClass<StoreExportCall>(
161
164
  "@effect-agent/storage-cloudflare/StoreExportCall",
162
165
  )("StoreExport", {
163
- request: ConversationExportRequest,
166
+ request: ThreadExportRequest,
164
167
  }) {}
165
168
 
166
169
  /** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */
@@ -177,6 +180,7 @@ export const PortRequest = Schema.Union([
177
180
  StoreInspectTailCall,
178
181
  StoreExportCall,
179
182
  ]);
183
+
180
184
  export type PortRequest = typeof PortRequest.Type;
181
185
 
182
186
  /** The wire form of one port request (what a transport actually carries). */
@@ -241,13 +245,13 @@ export class StoreReadPageResult extends Schema.TaggedClass<StoreReadPageResult>
241
245
  export class StoreInspectTailResult extends Schema.TaggedClass<StoreInspectTailResult>(
242
246
  "@effect-agent/storage-cloudflare/StoreInspectTailResult",
243
247
  )("StoreInspectTailResult", {
244
- tail: ConversationTail,
248
+ tail: ThreadTail,
245
249
  }) {}
246
250
 
247
251
  export class StoreExportResult extends Schema.TaggedClass<StoreExportResult>(
248
252
  "@effect-agent/storage-cloudflare/StoreExportResult",
249
253
  )("StoreExportResult", {
250
- export: ConversationExport,
254
+ export: ThreadExport,
251
255
  }) {}
252
256
 
253
257
  /** Every successful routed result. Callers narrow by the tag their request implies. */
@@ -264,6 +268,7 @@ export const PortResult = Schema.Union([
264
268
  StoreInspectTailResult,
265
269
  StoreExportResult,
266
270
  ]);
271
+
267
272
  export type PortResult = typeof PortResult.Type;
268
273
 
269
274
  // ---------------------------------------------------------------------------
@@ -273,19 +278,21 @@ export type PortResult = typeof PortResult.Type;
273
278
  /**
274
279
  * Every typed failure a route-capable operation can produce on its owning Object, plus the
275
280
  * protocol's own `PortProtocolError`. Members re-decode to the SAME tagged classes the
276
- * session ports declare, so a routed caller observes identical error tags and fields.
281
+ * thread ports declare, so a routed caller observes identical error tags and fields.
277
282
  */
278
283
  export const PortFailure = Schema.Union([
279
284
  AdmissionConflict,
285
+ AdmissionPolicyError,
280
286
  SettlementConflict,
281
287
  JoinedToHost,
282
288
  LedgerError,
283
- ConversationStoreError,
284
- ConversationNotMaterialized,
289
+ ThreadStoreError,
290
+ ThreadNotMaterialized,
285
291
  AppendConflict,
286
292
  FenceRejected,
287
293
  PortProtocolError,
288
294
  ]);
295
+
289
296
  export type PortFailure = typeof PortFailure.Type;
290
297
 
291
298
  /** The routed operation succeeded on its owning Object. */