@effect-agent/storage-cloudflare 0.1.0-beta.9 → 0.1.0-beta.90
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.d.mts +29 -0
- package/dist/DoMemoryStore.mjs +55 -0
- package/dist/DoMemoryStore.mjs.map +1 -0
- package/dist/DoMessageDeliveryStore.d.mts +17 -0
- package/dist/DoMessageDeliveryStore.mjs +32 -0
- package/dist/DoMessageDeliveryStore.mjs.map +1 -0
- package/dist/DoScheduleStore.d.mts +36 -0
- package/dist/DoScheduleStore.mjs +388 -0
- package/dist/DoScheduleStore.mjs.map +1 -0
- package/dist/DoStorageConfig.d.mts +45 -0
- package/dist/DoStorageConfig.mjs +52 -0
- package/dist/DoStorageConfig.mjs.map +1 -0
- package/dist/DoStorageError-Cmhvl4TQ.d.mts +98 -0
- package/dist/DoStorageError.d.mts +2 -0
- package/dist/DoStorageError.mjs +164 -0
- package/dist/DoStorageError.mjs.map +1 -0
- package/dist/DoStorageFailpoint.d.mts +17 -0
- package/dist/DoStorageFailpoint.mjs +14 -0
- package/dist/DoStorageFailpoint.mjs.map +1 -0
- package/dist/DoStorageFailpointTesting.d.mts +34 -0
- package/dist/DoStorageFailpointTesting.mjs +35 -0
- package/dist/DoStorageFailpointTesting.mjs.map +1 -0
- package/dist/DoStorageVersion-x5OOurvZ.d.mts +12 -0
- package/dist/DoStorageVersion.d.mts +2 -0
- package/dist/DoStorageVersion.mjs +8 -0
- package/dist/DoStorageVersion.mjs.map +1 -0
- package/dist/DoSubmissionLedger.d.mts +23 -0
- package/dist/DoSubmissionLedger.mjs +1849 -0
- package/dist/DoSubmissionLedger.mjs.map +1 -0
- package/dist/DoSubscriptionStore.d.mts +25 -0
- package/dist/DoSubscriptionStore.mjs +183 -0
- package/dist/DoSubscriptionStore.mjs.map +1 -0
- package/dist/DoThreadStore.d.mts +59 -0
- package/dist/DoThreadStore.mjs +465 -0
- package/dist/DoThreadStore.mjs.map +1 -0
- package/dist/MemoryProtocol.d.mts +38160 -0
- package/dist/MemoryProtocol.mjs +219 -0
- package/dist/MemoryProtocol.mjs.map +1 -0
- package/dist/PortProtocol.d.mts +3804 -0
- package/dist/PortProtocol.mjs +176 -0
- package/dist/PortProtocol.mjs.map +1 -0
- package/dist/PortRouting.d.mts +83 -0
- package/dist/PortRouting.mjs +410 -0
- package/dist/PortRouting.mjs.map +1 -0
- package/dist/do-journal-dJ01KSKf.mjs +991 -0
- package/dist/do-journal-dJ01KSKf.mjs.map +1 -0
- package/dist/index.d.mts +14 -1525
- package/dist/index.mjs +14 -3695
- package/dist/migrations-Ba_kOrSx.mjs +287 -0
- package/dist/migrations-Ba_kOrSx.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +1 -45
- package/src/DoMemoryStore.ts +56 -0
- package/src/DoMessageDeliveryStore.ts +53 -0
- package/src/DoScheduleStore.ts +622 -0
- package/src/{errors.ts → DoStorageError.ts} +10 -3
- package/src/DoStorageFailpoint.ts +20 -0
- package/src/{do-storage-failpoint.ts → DoStorageFailpointTesting.ts} +5 -18
- package/src/DoStorageVersion.ts +2 -0
- package/src/{do-ledger.ts → DoSubmissionLedger.ts} +924 -225
- package/src/DoSubscriptionStore.ts +329 -0
- package/src/DoThreadStore.ts +1012 -0
- package/src/MemoryProtocol.ts +351 -0
- package/src/{port-protocol.ts → PortProtocol.ts} +45 -38
- package/src/{routing.ts → PortRouting.ts} +292 -264
- package/src/index.ts +13 -32
- package/src/{do-journal.ts → internal/do-journal.ts} +718 -234
- package/src/internal/message-delivery-schema.ts +24 -0
- package/src/{migrations.ts → internal/migrations.ts} +51 -35
- package/src/internal/recovery-checkpoint-schema.ts +17 -0
- package/dist/index.mjs.map +0 -1
- package/src/do-conversation-store.ts +0 -850
- /package/src/{do-storage-config.ts → DoStorageConfig.ts} +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { CanonicalRecordEnvelope } from "effect-agent/records";
|
|
4
|
+
import { AppendConflict, AppendResult, FenceRejected, FencedAppendRequest, ThreadExport, ThreadExportRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadRead, ThreadStoreError, ThreadTail, ThreadTailRequest } from "effect-agent/thread-store";
|
|
5
|
+
import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionPolicyError, AdmissionRequest, AdmissionResolution, AdmissionResult, ChildSettledNotification, ChildSettledOutcome, JoinedToHost, LedgerError, MarkReadyRequest, SettlementConflict, SubmissionLookup, SubmissionLookupByKey, SubmissionSnapshot } from "effect-agent/submission-ledger";
|
|
6
|
+
//#region src/PortProtocol.ts
|
|
7
|
+
var PortProtocol_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
LedgerAdmitCall: () => LedgerAdmitCall,
|
|
9
|
+
LedgerAdmitResult: () => LedgerAdmitResult,
|
|
10
|
+
LedgerLookupCall: () => LedgerLookupCall,
|
|
11
|
+
LedgerLookupResult: () => LedgerLookupResult,
|
|
12
|
+
LedgerMarkReadyCall: () => LedgerMarkReadyCall,
|
|
13
|
+
LedgerMarkReadyResult: () => LedgerMarkReadyResult,
|
|
14
|
+
LedgerRecordChildSettledCall: () => LedgerRecordChildSettledCall,
|
|
15
|
+
LedgerRecordChildSettledResult: () => LedgerRecordChildSettledResult,
|
|
16
|
+
LedgerRequestAbortCall: () => LedgerRequestAbortCall,
|
|
17
|
+
LedgerRequestAbortResult: () => LedgerRequestAbortResult,
|
|
18
|
+
LedgerResolveAdmissionCall: () => LedgerResolveAdmissionCall,
|
|
19
|
+
LedgerResolveAdmissionResult: () => LedgerResolveAdmissionResult,
|
|
20
|
+
MAX_PORT_DIAGNOSTIC_LENGTH: () => MAX_PORT_DIAGNOSTIC_LENGTH,
|
|
21
|
+
PortFailed: () => PortFailed,
|
|
22
|
+
PortFailure: () => PortFailure,
|
|
23
|
+
PortProtocolError: () => PortProtocolError,
|
|
24
|
+
PortRequest: () => PortRequest,
|
|
25
|
+
PortResponse: () => PortResponse,
|
|
26
|
+
PortResult: () => PortResult,
|
|
27
|
+
PortSucceeded: () => PortSucceeded,
|
|
28
|
+
StoreAppendCall: () => StoreAppendCall,
|
|
29
|
+
StoreAppendResult: () => StoreAppendResult,
|
|
30
|
+
StoreExportCall: () => StoreExportCall,
|
|
31
|
+
StoreExportResult: () => StoreExportResult,
|
|
32
|
+
StoreInspectTailCall: () => StoreInspectTailCall,
|
|
33
|
+
StoreInspectTailResult: () => StoreInspectTailResult,
|
|
34
|
+
StoreMaterializeCall: () => StoreMaterializeCall,
|
|
35
|
+
StoreMaterializeResult: () => StoreMaterializeResult,
|
|
36
|
+
StoreReadPageCall: () => StoreReadPageCall,
|
|
37
|
+
StoreReadPageResult: () => StoreReadPageResult,
|
|
38
|
+
boundPortDiagnostic: () => boundPortDiagnostic,
|
|
39
|
+
decodePortRequest: () => decodePortRequest,
|
|
40
|
+
decodePortResponse: () => decodePortResponse,
|
|
41
|
+
encodePortRequest: () => encodePortRequest,
|
|
42
|
+
encodePortResponse: () => encodePortResponse
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* The cross-Durable-Object port protocol (plan §1.3, D-P6-3): Schema request/response/error
|
|
46
|
+
* envelopes for the CLOSED route-capable subset of the thread ports. One Thread's
|
|
47
|
+
* Durable Object executes another Thread's request against its OWN local facets; the
|
|
48
|
+
* envelopes here are the only values that cross the Object boundary, and they are
|
|
49
|
+
* transport-agnostic — native Durable Object JS RPC is the shipped carrier, fetch-with-JSON
|
|
50
|
+
* the documented fallback, and both move the same Schema-encoded JSON.
|
|
51
|
+
*
|
|
52
|
+
* The closed subset is exactly the set of operations the durable coordinator performs against
|
|
53
|
+
* a FOREIGN Thread (parent/child establishment, status checks, abort propagation,
|
|
54
|
+
* child-settlement notification, and the child-thread store operations used by
|
|
55
|
+
* establishment, `verifySettledChild`, and result projection):
|
|
56
|
+
*
|
|
57
|
+
* - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,
|
|
58
|
+
* `recordChildSettled`;
|
|
59
|
+
* - store: `materialize`, `append`, `read` (one page), `inspectTail`, `export`.
|
|
60
|
+
*
|
|
61
|
+
* Every other port operation is lane-local and has no envelope. A foreign disposable
|
|
62
|
+
* recovery-cache load returns a miss so the caller can replay canonical history. Other
|
|
63
|
+
* foreign operations fail fast and typed instead of widening the distributed surface.
|
|
64
|
+
*
|
|
65
|
+
* Failures cross the boundary as the `PortFailure` union and re-decode on the caller side to
|
|
66
|
+
* the SAME tagged error types the local facet would have produced, so routed calls keep
|
|
67
|
+
* error-tag fidelity. `cause` chains inside `LedgerError`/`ThreadStoreError` travel as
|
|
68
|
+
* Schema defects and do not claim instance fidelity across Objects (plan §2.8).
|
|
69
|
+
*/
|
|
70
|
+
/** Ceiling for protocol diagnostic strings; matches `AdmissionIndeterminate.reason`. */
|
|
71
|
+
const MAX_PORT_DIAGNOSTIC_LENGTH = 4096;
|
|
72
|
+
const BoundedDiagnostic = Schema.String.check(Schema.isMaxLength(MAX_PORT_DIAGNOSTIC_LENGTH));
|
|
73
|
+
/** Truncate a diagnostic string to the protocol's bounded diagnostic length. */
|
|
74
|
+
const boundPortDiagnostic = (value) => value.length > 4096 ? `${value.slice(0, 4093)}...` : value;
|
|
75
|
+
/**
|
|
76
|
+
* The envelope itself could not be honored: the receiving Object could not decode the
|
|
77
|
+
* request, or a response could not be encoded/decoded. It never carries port semantics —
|
|
78
|
+
* callers fold it into the operation's base error (`LedgerError`/`ThreadStoreError`),
|
|
79
|
+
* except `resolveAdmission`, which folds it into `AdmissionIndeterminate` because a
|
|
80
|
+
* non-answer is never proof of absence (SUB-031).
|
|
81
|
+
*/
|
|
82
|
+
var PortProtocolError = class extends Schema.TaggedError()("PortProtocolError", { message: BoundedDiagnostic }) {};
|
|
83
|
+
/** Routed `SubmissionLedger.admit` — child establishment admits INTO the owning Object. */
|
|
84
|
+
var LedgerAdmitCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerAdmitCall")("LedgerAdmit", { request: AdmissionRequest }) {};
|
|
85
|
+
/** Routed `SubmissionLedger.markReady` for a Submission owned by another Object. */
|
|
86
|
+
var LedgerMarkReadyCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerMarkReadyCall")("LedgerMarkReady", { request: MarkReadyRequest }) {};
|
|
87
|
+
/** Routed `SubmissionLedger.lookup` (by identity or scoped idempotency key). */
|
|
88
|
+
var LedgerLookupCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerLookupCall")("LedgerLookup", { request: SubmissionLookup }) {};
|
|
89
|
+
/** Routed `SubmissionLedger.resolveAdmission` — the SUB-031 tri-state authority call. */
|
|
90
|
+
var LedgerResolveAdmissionCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerResolveAdmissionCall")("LedgerResolveAdmission", { request: SubmissionLookupByKey }) {};
|
|
91
|
+
/** Routed `SubmissionLedger.requestAbort` — abort propagation across Objects. */
|
|
92
|
+
var LedgerRequestAbortCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerRequestAbortCall")("LedgerRequestAbort", { request: AbortCommand }) {};
|
|
93
|
+
/** Routed `SubmissionLedger.recordChildSettled` — the child→parent durable notification. */
|
|
94
|
+
var LedgerRecordChildSettledCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerRecordChildSettledCall")("LedgerRecordChildSettled", { request: ChildSettledNotification }) {};
|
|
95
|
+
/** Routed `ThreadStore.materialize` against the owning Object. */
|
|
96
|
+
var StoreMaterializeCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreMaterializeCall")("StoreMaterialize", { request: ThreadMaterialization }) {};
|
|
97
|
+
/** Routed `ThreadStore.append` against the owning Object. */
|
|
98
|
+
var StoreAppendCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreAppendCall")("StoreAppend", { request: FencedAppendRequest }) {};
|
|
99
|
+
/** Routed one-page `ThreadStore.read`; the page bound is the request's own `limit`. */
|
|
100
|
+
var StoreReadPageCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreReadPageCall")("StoreReadPage", { request: ThreadRead }) {};
|
|
101
|
+
/** Routed `ThreadStore.inspectTail` against the owning Object. */
|
|
102
|
+
var StoreInspectTailCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreInspectTailCall")("StoreInspectTail", { request: ThreadTailRequest }) {};
|
|
103
|
+
/** Routed `ThreadStore.export` against the owning Object. */
|
|
104
|
+
var StoreExportCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreExportCall")("StoreExport", { request: ThreadExportRequest }) {};
|
|
105
|
+
/** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */
|
|
106
|
+
const PortRequest = Schema.Union([
|
|
107
|
+
LedgerAdmitCall,
|
|
108
|
+
LedgerMarkReadyCall,
|
|
109
|
+
LedgerLookupCall,
|
|
110
|
+
LedgerResolveAdmissionCall,
|
|
111
|
+
LedgerRequestAbortCall,
|
|
112
|
+
LedgerRecordChildSettledCall,
|
|
113
|
+
StoreMaterializeCall,
|
|
114
|
+
StoreAppendCall,
|
|
115
|
+
StoreReadPageCall,
|
|
116
|
+
StoreInspectTailCall,
|
|
117
|
+
StoreExportCall
|
|
118
|
+
]);
|
|
119
|
+
var LedgerAdmitResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerAdmitResult")("LedgerAdmitResult", { result: AdmissionResult }) {};
|
|
120
|
+
var LedgerMarkReadyResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerMarkReadyResult")("LedgerMarkReadyResult", {}) {};
|
|
121
|
+
/** `submission` is absent exactly when the lookup answered `Option.none`. */
|
|
122
|
+
var LedgerLookupResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerLookupResult")("LedgerLookupResult", { submission: Schema.optionalKey(SubmissionSnapshot) }) {};
|
|
123
|
+
var LedgerResolveAdmissionResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerResolveAdmissionResult")("LedgerResolveAdmissionResult", { resolution: AdmissionResolution }) {};
|
|
124
|
+
var LedgerRequestAbortResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerRequestAbortResult")("LedgerRequestAbortResult", { intent: AbortIntent }) {};
|
|
125
|
+
var LedgerRecordChildSettledResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerRecordChildSettledResult")("LedgerRecordChildSettledResult", { outcome: ChildSettledOutcome }) {};
|
|
126
|
+
var StoreMaterializeResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreMaterializeResult")("StoreMaterializeResult", {}) {};
|
|
127
|
+
var StoreAppendResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreAppendResult")("StoreAppendResult", { result: AppendResult }) {};
|
|
128
|
+
/** One page of canonical records, bounded by the request's `limit` (≤ 1,024). */
|
|
129
|
+
var StoreReadPageResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreReadPageResult")("StoreReadPageResult", { records: Schema.Array(CanonicalRecordEnvelope).check(Schema.isMaxLength(1024)) }) {};
|
|
130
|
+
var StoreInspectTailResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreInspectTailResult")("StoreInspectTailResult", { tail: ThreadTail }) {};
|
|
131
|
+
var StoreExportResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreExportResult")("StoreExportResult", { export: ThreadExport }) {};
|
|
132
|
+
/** Every successful routed result. Callers narrow by the tag their request implies. */
|
|
133
|
+
const PortResult = Schema.Union([
|
|
134
|
+
LedgerAdmitResult,
|
|
135
|
+
LedgerMarkReadyResult,
|
|
136
|
+
LedgerLookupResult,
|
|
137
|
+
LedgerResolveAdmissionResult,
|
|
138
|
+
LedgerRequestAbortResult,
|
|
139
|
+
LedgerRecordChildSettledResult,
|
|
140
|
+
StoreMaterializeResult,
|
|
141
|
+
StoreAppendResult,
|
|
142
|
+
StoreReadPageResult,
|
|
143
|
+
StoreInspectTailResult,
|
|
144
|
+
StoreExportResult
|
|
145
|
+
]);
|
|
146
|
+
/**
|
|
147
|
+
* Every typed failure a route-capable operation can produce on its owning Object, plus the
|
|
148
|
+
* protocol's own `PortProtocolError`. Members re-decode to the SAME tagged classes the
|
|
149
|
+
* thread ports declare, so a routed caller observes identical error tags and fields.
|
|
150
|
+
*/
|
|
151
|
+
const PortFailure = Schema.Union([
|
|
152
|
+
AdmissionConflict,
|
|
153
|
+
AdmissionPolicyError,
|
|
154
|
+
SettlementConflict,
|
|
155
|
+
JoinedToHost,
|
|
156
|
+
LedgerError,
|
|
157
|
+
ThreadStoreError,
|
|
158
|
+
ThreadNotMaterialized,
|
|
159
|
+
AppendConflict,
|
|
160
|
+
FenceRejected,
|
|
161
|
+
PortProtocolError
|
|
162
|
+
]);
|
|
163
|
+
/** The routed operation succeeded on its owning Object. */
|
|
164
|
+
var PortSucceeded = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/PortSucceeded")("PortSucceeded", { result: PortResult }) {};
|
|
165
|
+
/** The routed operation failed TYPED on its owning Object; the failure re-decodes verbatim. */
|
|
166
|
+
var PortFailed = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/PortFailed")("PortFailed", { failure: PortFailure }) {};
|
|
167
|
+
/** The uniform answer of one `portCall`: op-specific success or a re-decodable typed failure. */
|
|
168
|
+
const PortResponse = Schema.Union([PortSucceeded, PortFailed]);
|
|
169
|
+
const encodePortRequest = Schema.encodeEffect(PortRequest);
|
|
170
|
+
const decodePortRequest = Schema.decodeUnknownEffect(PortRequest);
|
|
171
|
+
const encodePortResponse = Schema.encodeEffect(PortResponse);
|
|
172
|
+
const decodePortResponse = Schema.decodeUnknownEffect(PortResponse);
|
|
173
|
+
//#endregion
|
|
174
|
+
export { LedgerAdmitCall, LedgerAdmitResult, LedgerLookupCall, LedgerLookupResult, LedgerMarkReadyCall, LedgerMarkReadyResult, LedgerRecordChildSettledCall, LedgerRecordChildSettledResult, LedgerRequestAbortCall, LedgerRequestAbortResult, LedgerResolveAdmissionCall, LedgerResolveAdmissionResult, MAX_PORT_DIAGNOSTIC_LENGTH, PortFailed, PortFailure, PortProtocolError, PortRequest, PortResponse, PortResult, PortSucceeded, StoreAppendCall, StoreAppendResult, StoreExportCall, StoreExportResult, StoreInspectTailCall, StoreInspectTailResult, StoreMaterializeCall, StoreMaterializeResult, StoreReadPageCall, StoreReadPageResult, boundPortDiagnostic, decodePortRequest, decodePortResponse, encodePortRequest, encodePortResponse, PortProtocol_exports as t };
|
|
175
|
+
|
|
176
|
+
//# sourceMappingURL=PortProtocol.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortProtocol.mjs","names":[],"sources":["../src/PortProtocol.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { CanonicalRecordEnvelope } from \"effect-agent/records\";\nimport {\n AbortCommand,\n AbortIntent,\n AdmissionConflict,\n AdmissionPolicyError,\n AdmissionRequest,\n AdmissionResolution,\n AdmissionResult,\n ChildSettledNotification,\n ChildSettledOutcome,\n JoinedToHost,\n LedgerError,\n MarkReadyRequest,\n SettlementConflict,\n SubmissionLookup,\n SubmissionLookupByKey,\n SubmissionSnapshot,\n} from \"effect-agent/submission-ledger\";\nimport {\n AppendConflict,\n AppendResult,\n ThreadExport,\n ThreadExportRequest,\n ThreadMaterialization,\n ThreadNotMaterialized,\n ThreadRead,\n ThreadStoreError,\n ThreadTail,\n ThreadTailRequest,\n FenceRejected,\n FencedAppendRequest,\n} from \"effect-agent/thread-store\";\n\n/**\n * The cross-Durable-Object port protocol (plan §1.3, D-P6-3): Schema request/response/error\n * envelopes for the CLOSED route-capable subset of the thread ports. One Thread's\n * Durable Object executes another Thread's request against its OWN local facets; the\n * envelopes here are the only values that cross the Object boundary, and they are\n * transport-agnostic — native Durable Object JS RPC is the shipped carrier, fetch-with-JSON\n * the documented fallback, and both move the same Schema-encoded JSON.\n *\n * The closed subset is exactly the set of operations the durable coordinator performs against\n * a FOREIGN Thread (parent/child establishment, status checks, abort propagation,\n * child-settlement notification, and the child-thread store operations used by\n * establishment, `verifySettledChild`, and result projection):\n *\n * - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,\n * `recordChildSettled`;\n * - store: `materialize`, `append`, `read` (one page), `inspectTail`, `export`.\n *\n * Every other port operation is lane-local and has no envelope. A foreign disposable\n * recovery-cache load returns a miss so the caller can replay canonical history. Other\n * foreign operations fail fast and typed instead of widening the distributed surface.\n *\n * Failures cross the boundary as the `PortFailure` union and re-decode on the caller side to\n * the SAME tagged error types the local facet would have produced, so routed calls keep\n * error-tag fidelity. `cause` chains inside `LedgerError`/`ThreadStoreError` travel as\n * Schema defects and do not claim instance fidelity across Objects (plan §2.8).\n */\n\n/** Ceiling for protocol diagnostic strings; matches `AdmissionIndeterminate.reason`. */\nexport const MAX_PORT_DIAGNOSTIC_LENGTH = 4_096;\n\nconst BoundedDiagnostic = Schema.String.check(Schema.isMaxLength(MAX_PORT_DIAGNOSTIC_LENGTH));\n\n/** Truncate a diagnostic string to the protocol's bounded diagnostic length. */\nexport const boundPortDiagnostic = (value: string): string =>\n value.length > MAX_PORT_DIAGNOSTIC_LENGTH\n ? `${value.slice(0, MAX_PORT_DIAGNOSTIC_LENGTH - 3)}...`\n : value;\n\n/**\n * The envelope itself could not be honored: the receiving Object could not decode the\n * request, or a response could not be encoded/decoded. It never carries port semantics —\n * callers fold it into the operation's base error (`LedgerError`/`ThreadStoreError`),\n * except `resolveAdmission`, which folds it into `AdmissionIndeterminate` because a\n * non-answer is never proof of absence (SUB-031).\n */\nexport class PortProtocolError extends Schema.TaggedError<PortProtocolError>()(\n \"PortProtocolError\",\n {\n message: BoundedDiagnostic,\n },\n) {}\n\n// ---------------------------------------------------------------------------\n// Requests\n// ---------------------------------------------------------------------------\n\n/** Routed `SubmissionLedger.admit` — child establishment admits INTO the owning Object. */\nexport class LedgerAdmitCall extends Schema.TaggedClass<LedgerAdmitCall>(\n \"@effect-agent/storage-cloudflare/LedgerAdmitCall\",\n)(\"LedgerAdmit\", {\n request: AdmissionRequest,\n}) {}\n\n/** Routed `SubmissionLedger.markReady` for a Submission owned by another Object. */\nexport class LedgerMarkReadyCall extends Schema.TaggedClass<LedgerMarkReadyCall>(\n \"@effect-agent/storage-cloudflare/LedgerMarkReadyCall\",\n)(\"LedgerMarkReady\", {\n request: MarkReadyRequest,\n}) {}\n\n/** Routed `SubmissionLedger.lookup` (by identity or scoped idempotency key). */\nexport class LedgerLookupCall extends Schema.TaggedClass<LedgerLookupCall>(\n \"@effect-agent/storage-cloudflare/LedgerLookupCall\",\n)(\"LedgerLookup\", {\n request: SubmissionLookup,\n}) {}\n\n/** Routed `SubmissionLedger.resolveAdmission` — the SUB-031 tri-state authority call. */\nexport class LedgerResolveAdmissionCall extends Schema.TaggedClass<LedgerResolveAdmissionCall>(\n \"@effect-agent/storage-cloudflare/LedgerResolveAdmissionCall\",\n)(\"LedgerResolveAdmission\", {\n request: SubmissionLookupByKey,\n}) {}\n\n/** Routed `SubmissionLedger.requestAbort` — abort propagation across Objects. */\nexport class LedgerRequestAbortCall extends Schema.TaggedClass<LedgerRequestAbortCall>(\n \"@effect-agent/storage-cloudflare/LedgerRequestAbortCall\",\n)(\"LedgerRequestAbort\", {\n request: AbortCommand,\n}) {}\n\n/** Routed `SubmissionLedger.recordChildSettled` — the child→parent durable notification. */\nexport class LedgerRecordChildSettledCall extends Schema.TaggedClass<LedgerRecordChildSettledCall>(\n \"@effect-agent/storage-cloudflare/LedgerRecordChildSettledCall\",\n)(\"LedgerRecordChildSettled\", {\n request: ChildSettledNotification,\n}) {}\n\n/** Routed `ThreadStore.materialize` against the owning Object. */\nexport class StoreMaterializeCall extends Schema.TaggedClass<StoreMaterializeCall>(\n \"@effect-agent/storage-cloudflare/StoreMaterializeCall\",\n)(\"StoreMaterialize\", {\n request: ThreadMaterialization,\n}) {}\n\n/** Routed `ThreadStore.append` against the owning Object. */\nexport class StoreAppendCall extends Schema.TaggedClass<StoreAppendCall>(\n \"@effect-agent/storage-cloudflare/StoreAppendCall\",\n)(\"StoreAppend\", {\n request: FencedAppendRequest,\n}) {}\n\n/** Routed one-page `ThreadStore.read`; the page bound is the request's own `limit`. */\nexport class StoreReadPageCall extends Schema.TaggedClass<StoreReadPageCall>(\n \"@effect-agent/storage-cloudflare/StoreReadPageCall\",\n)(\"StoreReadPage\", {\n request: ThreadRead,\n}) {}\n\n/** Routed `ThreadStore.inspectTail` against the owning Object. */\nexport class StoreInspectTailCall extends Schema.TaggedClass<StoreInspectTailCall>(\n \"@effect-agent/storage-cloudflare/StoreInspectTailCall\",\n)(\"StoreInspectTail\", {\n request: ThreadTailRequest,\n}) {}\n\n/** Routed `ThreadStore.export` against the owning Object. */\nexport class StoreExportCall extends Schema.TaggedClass<StoreExportCall>(\n \"@effect-agent/storage-cloudflare/StoreExportCall\",\n)(\"StoreExport\", {\n request: ThreadExportRequest,\n}) {}\n\n/** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */\nexport const PortRequest = Schema.Union([\n LedgerAdmitCall,\n LedgerMarkReadyCall,\n LedgerLookupCall,\n LedgerResolveAdmissionCall,\n LedgerRequestAbortCall,\n LedgerRecordChildSettledCall,\n StoreMaterializeCall,\n StoreAppendCall,\n StoreReadPageCall,\n StoreInspectTailCall,\n StoreExportCall,\n]);\n\nexport type PortRequest = typeof PortRequest.Type;\n\n/** The wire form of one port request (what a transport actually carries). */\nexport type PortRequestEnvelope = typeof PortRequest.Encoded;\n\n// ---------------------------------------------------------------------------\n// Results\n// ---------------------------------------------------------------------------\n\nexport class LedgerAdmitResult extends Schema.TaggedClass<LedgerAdmitResult>(\n \"@effect-agent/storage-cloudflare/LedgerAdmitResult\",\n)(\"LedgerAdmitResult\", {\n result: AdmissionResult,\n}) {}\n\nexport class LedgerMarkReadyResult extends Schema.TaggedClass<LedgerMarkReadyResult>(\n \"@effect-agent/storage-cloudflare/LedgerMarkReadyResult\",\n)(\"LedgerMarkReadyResult\", {}) {}\n\n/** `submission` is absent exactly when the lookup answered `Option.none`. */\nexport class LedgerLookupResult extends Schema.TaggedClass<LedgerLookupResult>(\n \"@effect-agent/storage-cloudflare/LedgerLookupResult\",\n)(\"LedgerLookupResult\", {\n submission: Schema.optionalKey(SubmissionSnapshot),\n}) {}\n\nexport class LedgerResolveAdmissionResult extends Schema.TaggedClass<LedgerResolveAdmissionResult>(\n \"@effect-agent/storage-cloudflare/LedgerResolveAdmissionResult\",\n)(\"LedgerResolveAdmissionResult\", {\n resolution: AdmissionResolution,\n}) {}\n\nexport class LedgerRequestAbortResult extends Schema.TaggedClass<LedgerRequestAbortResult>(\n \"@effect-agent/storage-cloudflare/LedgerRequestAbortResult\",\n)(\"LedgerRequestAbortResult\", {\n intent: AbortIntent,\n}) {}\n\nexport class LedgerRecordChildSettledResult extends Schema.TaggedClass<LedgerRecordChildSettledResult>(\n \"@effect-agent/storage-cloudflare/LedgerRecordChildSettledResult\",\n)(\"LedgerRecordChildSettledResult\", {\n outcome: ChildSettledOutcome,\n}) {}\n\nexport class StoreMaterializeResult extends Schema.TaggedClass<StoreMaterializeResult>(\n \"@effect-agent/storage-cloudflare/StoreMaterializeResult\",\n)(\"StoreMaterializeResult\", {}) {}\n\nexport class StoreAppendResult extends Schema.TaggedClass<StoreAppendResult>(\n \"@effect-agent/storage-cloudflare/StoreAppendResult\",\n)(\"StoreAppendResult\", {\n result: AppendResult,\n}) {}\n\n/** One page of canonical records, bounded by the request's `limit` (≤ 1,024). */\nexport class StoreReadPageResult extends Schema.TaggedClass<StoreReadPageResult>(\n \"@effect-agent/storage-cloudflare/StoreReadPageResult\",\n)(\"StoreReadPageResult\", {\n records: Schema.Array(CanonicalRecordEnvelope).check(Schema.isMaxLength(1_024)),\n}) {}\n\nexport class StoreInspectTailResult extends Schema.TaggedClass<StoreInspectTailResult>(\n \"@effect-agent/storage-cloudflare/StoreInspectTailResult\",\n)(\"StoreInspectTailResult\", {\n tail: ThreadTail,\n}) {}\n\nexport class StoreExportResult extends Schema.TaggedClass<StoreExportResult>(\n \"@effect-agent/storage-cloudflare/StoreExportResult\",\n)(\"StoreExportResult\", {\n export: ThreadExport,\n}) {}\n\n/** Every successful routed result. Callers narrow by the tag their request implies. */\nexport const PortResult = Schema.Union([\n LedgerAdmitResult,\n LedgerMarkReadyResult,\n LedgerLookupResult,\n LedgerResolveAdmissionResult,\n LedgerRequestAbortResult,\n LedgerRecordChildSettledResult,\n StoreMaterializeResult,\n StoreAppendResult,\n StoreReadPageResult,\n StoreInspectTailResult,\n StoreExportResult,\n]);\n\nexport type PortResult = typeof PortResult.Type;\n\n// ---------------------------------------------------------------------------\n// Failures and the response envelope\n// ---------------------------------------------------------------------------\n\n/**\n * Every typed failure a route-capable operation can produce on its owning Object, plus the\n * protocol's own `PortProtocolError`. Members re-decode to the SAME tagged classes the\n * thread ports declare, so a routed caller observes identical error tags and fields.\n */\nexport const PortFailure = Schema.Union([\n AdmissionConflict,\n AdmissionPolicyError,\n SettlementConflict,\n JoinedToHost,\n LedgerError,\n ThreadStoreError,\n ThreadNotMaterialized,\n AppendConflict,\n FenceRejected,\n PortProtocolError,\n]);\n\nexport type PortFailure = typeof PortFailure.Type;\n\n/** The routed operation succeeded on its owning Object. */\nexport class PortSucceeded extends Schema.TaggedClass<PortSucceeded>(\n \"@effect-agent/storage-cloudflare/PortSucceeded\",\n)(\"PortSucceeded\", {\n result: PortResult,\n}) {}\n\n/** The routed operation failed TYPED on its owning Object; the failure re-decodes verbatim. */\nexport class PortFailed extends Schema.TaggedClass<PortFailed>(\n \"@effect-agent/storage-cloudflare/PortFailed\",\n)(\"PortFailed\", {\n failure: PortFailure,\n}) {}\n\n/** The uniform answer of one `portCall`: op-specific success or a re-decodable typed failure. */\nexport const PortResponse = Schema.Union([PortSucceeded, PortFailed]);\nexport type PortResponse = typeof PortResponse.Type;\n\n/** The wire form of one port response (what a transport actually carries). */\nexport type PortResponseEnvelope = typeof PortResponse.Encoded;\n\n// ---------------------------------------------------------------------------\n// Codecs\n// ---------------------------------------------------------------------------\n\nexport const encodePortRequest = Schema.encodeEffect(PortRequest);\nexport const decodePortRequest = Schema.decodeUnknownEffect(PortRequest);\nexport const encodePortResponse = Schema.encodeEffect(PortResponse);\nexport const decodePortResponse = Schema.decodeUnknownEffect(PortResponse);\n"],"mappings":"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"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { LedgerAdmitCall, LedgerLookupCall, LedgerMarkReadyCall, LedgerRecordChildSettledCall, LedgerRequestAbortCall, LedgerResolveAdmissionCall, PortFailed, PortRequestEnvelope, PortSucceeded, StoreAppendCall, StoreExportCall, StoreInspectTailCall, StoreMaterializeCall, StoreReadPageCall } from "./PortProtocol.mjs";
|
|
2
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
+
import { ThreadMaterialization, ThreadStore } from "effect-agent/thread-store";
|
|
4
|
+
import { SubmissionLedger } from "effect-agent/submission-ledger";
|
|
5
|
+
declare namespace PortRouting_d_exports {
|
|
6
|
+
export { PortTransportError, RoutedPortOptions, ThreadPortTransport, executePortRequest, handleEncodedPortRequest, portTransportFailure, routedSubmissionLedgerLayer, routedThreadStoreLayer };
|
|
7
|
+
}
|
|
8
|
+
type ThreadId = ThreadMaterialization["threadId"];
|
|
9
|
+
declare const PortTransportError_base: Schema.Class<PortTransportError, Schema.TaggedStruct<"PortTransportError", {
|
|
10
|
+
readonly target: Schema.String;
|
|
11
|
+
readonly message: Schema.String;
|
|
12
|
+
readonly retryable: Schema.optionalKey<Schema.Boolean>;
|
|
13
|
+
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
14
|
+
}>, import("effect/Cause").YieldableError>;
|
|
15
|
+
/**
|
|
16
|
+
* A transport could not deliver a port request to (or an answer from) the owning
|
|
17
|
+
* Thread's Durable Object. `retryable` carries the platform's own stub signal when one
|
|
18
|
+
* exists. This error never crosses the wire — it is the CALLER-side evidence that the
|
|
19
|
+
* authority was unreachable, which is exactly the case `AdmissionIndeterminate` was
|
|
20
|
+
* specified for (SUB-031).
|
|
21
|
+
*/
|
|
22
|
+
declare class PortTransportError extends PortTransportError_base {}
|
|
23
|
+
/**
|
|
24
|
+
* Build a `PortTransportError` from an arbitrary thrown transport cause, preserving the
|
|
25
|
+
* platform stub's own `retryable` signal when present.
|
|
26
|
+
*/
|
|
27
|
+
declare const portTransportFailure: (target: string, cause: unknown) => PortTransportError;
|
|
28
|
+
declare const ThreadPortTransport_base: Context.ServiceClass<ThreadPortTransport, "@effect-agent/storage-cloudflare/ThreadPortTransport", {
|
|
29
|
+
readonly call: (threadId: ThreadId, request: PortRequestEnvelope) => Effect.Effect<unknown, PortTransportError>;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Delivery of Schema-encoded port envelopes to the Durable Object that owns a FOREIGN
|
|
33
|
+
* Thread (plan §1.3, D-P6-3). The shipped implementation (platform-cloudflare, WP3)
|
|
34
|
+
* calls the owner's `portCall` over native Durable Object JS RPC via
|
|
35
|
+
* `namespace.idFromName(threadId)`; the protocol is transport-agnostic and any carrier
|
|
36
|
+
* that moves the encoded envelopes verbatim satisfies this service. Implementations MUST
|
|
37
|
+
* surface every delivery problem as `PortTransportError` and must never fabricate an answer.
|
|
38
|
+
*/
|
|
39
|
+
declare class ThreadPortTransport extends ThreadPortTransport_base {}
|
|
40
|
+
/** Construction options shared by both routed port Layers. */
|
|
41
|
+
interface RoutedPortOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Decide whether this physical owner stores the addressed logical Thread. Local
|
|
44
|
+
* requests use the same SQLite facets; foreign requests use the transport or fail
|
|
45
|
+
* fast typed. The predicate determines placement, never caller authorization.
|
|
46
|
+
*/
|
|
47
|
+
readonly ownsThread: (threadId: ThreadId) => boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Routing decorator over the LOCAL `SubmissionLedger` facet (plan §1.3): a request addressing
|
|
51
|
+
* this Object's Thread executes locally; a route-capable request addressing another
|
|
52
|
+
* Thread is Schema-encoded onto the `ThreadPortTransport` and executed by the
|
|
53
|
+
* owning Object's local facet; any other foreign request fails fast typed. Provide the WP1
|
|
54
|
+
* local facet (`submissionLedgerLayer`/`ledgerLayer`) and a transport to close it.
|
|
55
|
+
*/
|
|
56
|
+
declare const routedSubmissionLedgerLayer: (options: RoutedPortOptions) => Layer.Layer<SubmissionLedger, never, SubmissionLedger | ThreadPortTransport>;
|
|
57
|
+
/**
|
|
58
|
+
* Routing decorator over the LOCAL `ThreadStore` facet (plan §1.3): this-thread
|
|
59
|
+
* requests execute locally; foreign materialize/append/read/inspectTail/export travel the
|
|
60
|
+
* transport. Foreign recovery-cache loads return none for canonical replay; other foreign
|
|
61
|
+
* checkpoint operations and observation fail fast typed.
|
|
62
|
+
*/
|
|
63
|
+
declare const routedThreadStoreLayer: (options: RoutedPortOptions) => Layer.Layer<ThreadStore, never, ThreadStore | ThreadPortTransport>;
|
|
64
|
+
/**
|
|
65
|
+
* Execute one decoded port request against THIS Object's LOCAL facets — the owner-side half
|
|
66
|
+
* of the routed ports (plan §1.3). Callers must provide the WP1 local facets, never the
|
|
67
|
+
* routed decorators: the routing layer already established that this Object owns the
|
|
68
|
+
* addressed Thread, and re-routing here could bounce a request between Objects.
|
|
69
|
+
* Failures never escape — every typed port failure becomes a `PortFailed` envelope that
|
|
70
|
+
* re-decodes on the caller side.
|
|
71
|
+
*/
|
|
72
|
+
declare const executePortRequest: (request: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall) => Effect.Effect<PortFailed | PortSucceeded, never, SubmissionLedger | ThreadStore>;
|
|
73
|
+
/**
|
|
74
|
+
* The complete owner-side endpoint body for `portCall` (D-P6-3): decode the wire request,
|
|
75
|
+
* execute it against this Object's LOCAL facets, and answer with the encoded response
|
|
76
|
+
* envelope. Total by construction — a request that cannot be decoded, or a response that
|
|
77
|
+
* cannot be encoded, answers `PortFailed(PortProtocolError)` instead of throwing, so the
|
|
78
|
+
* transport never has to interpret exceptions as protocol answers.
|
|
79
|
+
*/
|
|
80
|
+
declare const handleEncodedPortRequest: (encoded: unknown) => Effect.Effect<unknown, never, SubmissionLedger | ThreadStore>;
|
|
81
|
+
//#endregion
|
|
82
|
+
export { PortTransportError, RoutedPortOptions, ThreadPortTransport, executePortRequest, handleEncodedPortRequest, portTransportFailure, routedSubmissionLedgerLayer, routedThreadStoreLayer, PortRouting_d_exports as t };
|
|
83
|
+
//# sourceMappingURL=PortRouting.d.mts.map
|