@yielded/agent-storage-cloudflare 0.1.0-beta.166 → 0.1.0-beta.168
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.d.mts +1 -1
- package/dist/DoMessageDeliveryStore.mjs +3 -2
- package/dist/DoMessageDeliveryStore.mjs.map +1 -1
- package/dist/DoScheduleStore.mjs +16 -37
- package/dist/DoScheduleStore.mjs.map +1 -1
- package/dist/DoStorageConfig.d.mts +2 -10
- package/dist/DoStorageConfig.mjs +2 -11
- package/dist/DoStorageConfig.mjs.map +1 -1
- package/dist/{DoStorageError-CGuAfSwF.d.mts → DoStorageError-CxjMnzUA.d.mts} +7 -18
- package/dist/DoStorageError.d.mts +2 -2
- package/dist/DoStorageError.mjs +14 -30
- package/dist/DoStorageError.mjs.map +1 -1
- package/dist/DoStorageFailpoint.d.mts +1 -1
- package/dist/DoStorageFailpointTesting.d.mts +1 -1
- package/dist/{DoStorageVersion-iNSyi3cJ.d.mts → DoStorageVersion-DTFoLglB.d.mts} +3 -4
- package/dist/DoStorageVersion.d.mts +1 -1
- package/dist/DoStorageVersion.mjs +2 -2
- package/dist/DoStorageVersion.mjs.map +1 -1
- package/dist/DoSubmissionLedger.d.mts +7 -5
- package/dist/DoSubmissionLedger.mjs +378 -528
- package/dist/DoSubmissionLedger.mjs.map +1 -1
- package/dist/DoSubscriptionStore.mjs +5 -24
- package/dist/DoSubscriptionStore.mjs.map +1 -1
- package/dist/{DoThreadStore-D_83OjCH.d.mts → DoThreadStore-Bd4fTns3.d.mts} +17 -18
- package/dist/DoThreadStore-CwBvTLoq.mjs +468 -0
- package/dist/DoThreadStore-CwBvTLoq.mjs.map +1 -0
- package/dist/DoThreadStore.d.mts +2 -2
- package/dist/DoThreadStore.mjs +4 -529
- package/dist/MemoryProtocol.mjs +3 -3
- package/dist/MemoryProtocol.mjs.map +1 -1
- package/dist/PortProtocol.d.mts +11727 -3410
- package/dist/PortProtocol.mjs +103 -15
- package/dist/PortProtocol.mjs.map +1 -1
- package/dist/PortRouting.d.mts +14 -9
- package/dist/PortRouting.mjs +155 -29
- package/dist/PortRouting.mjs.map +1 -1
- package/dist/do-journal-Cawnsetj.mjs +761 -0
- package/dist/do-journal-Cawnsetj.mjs.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/migrations-D_EP3KYf.mjs +148 -0
- package/dist/migrations-D_EP3KYf.mjs.map +1 -0
- package/dist/{owned-state-DHm2aRXx.mjs → owned-state-BHzUi0eb.mjs} +50 -19
- package/dist/owned-state-BHzUi0eb.mjs.map +1 -0
- package/package.json +1 -1
- package/src/DoMessageDeliveryStore.ts +2 -1
- package/src/DoScheduleStore.ts +19 -59
- package/src/DoStorageConfig.ts +2 -11
- package/src/DoStorageError.ts +3 -26
- package/src/DoStorageVersion.ts +1 -1
- package/src/DoSubmissionLedger.ts +1806 -2030
- package/src/DoSubscriptionStore.ts +5 -47
- package/src/DoThreadStore.ts +276 -622
- package/src/MemoryProtocol.ts +3 -3
- package/src/PortProtocol.ts +198 -12
- package/src/PortRouting.ts +527 -108
- package/src/internal/canonical-append.ts +15 -0
- package/src/internal/do-journal.ts +548 -1440
- package/src/internal/migrations.ts +184 -287
- package/src/internal/owned-state.ts +81 -30
- package/src/internal/prompt-checkpoint.ts +158 -0
- package/src/internal/storage-span.ts +2 -5
- package/dist/DoThreadStore.mjs.map +0 -1
- package/dist/do-journal-DUhjZkOf.mjs +0 -1352
- package/dist/do-journal-DUhjZkOf.mjs.map +0 -1
- package/dist/migrations-DtKz_Gxr.mjs +0 -306
- package/dist/migrations-DtKz_Gxr.mjs.map +0 -1
- package/dist/owned-state-DHm2aRXx.mjs.map +0 -1
- package/src/internal/message-delivery-schema.ts +0 -24
- package/src/internal/recovery-checkpoint-schema.ts +0 -17
package/dist/PortProtocol.mjs
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { MessageDeliveryCompletion, MessageDeliveryError, MessageDeliveryFailpointError, MessageDeliveryKey, MessageDeliveryPage, MessageDeliveryPageRequest, MessageDeliveryRecord } from "@yielded/agent/message-delivery";
|
|
3
|
-
import { Schema } from "effect";
|
|
3
|
+
import { Schema, SchemaGetter } from "effect";
|
|
4
4
|
import { ThreadId } from "@yielded/agent/identifiers";
|
|
5
|
-
import {
|
|
6
|
-
import { AppendConflict, AppendResult,
|
|
7
|
-
import {
|
|
5
|
+
import { PromptRecordEnvelope } from "@yielded/agent/records";
|
|
6
|
+
import { AppendConflict, AppendRequest, AppendResult, ExecutionCheckpoint, ExecutionRead, ThreadExport, ThreadExportRejected, ThreadExportRequest, ThreadIdentity, ThreadIdentityRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadPeerCountRequest, ThreadPromptRead, ThreadReadRequest, ThreadStoreError, ThreadTail, ThreadTailRequest, ThreadVerificationRequest, ThreadWorkerCapacity, ThreadWorkerCapacityRequest } from "@yielded/agent/thread-store";
|
|
7
|
+
import { SettlementPublication, SettlementPublicationResult } from "@yielded/agent/settlement-publisher";
|
|
8
|
+
import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionPolicyError, AdmissionRequest, AdmissionResolution, AdmissionResult, ChildSettledNotification, ChildSettledOutcome, FundingOwner, FundingOwnerRequest, JoinedToHost, LedgerError, MarkReadyRequest, OwnershipLost, SettlementConflict, SubmissionLookup, SubmissionLookupByKey, SubmissionSnapshot, WorkerLedgerState, WorkerStopCommand } from "@yielded/agent/submission-ledger";
|
|
9
|
+
import { ReadEnvelope } from "@yielded/agent/record-format";
|
|
10
|
+
import { ThreadArchiveRange, ThreadArchiveRangePage, ThreadArchiveRangePublish, ThreadArchiveRangeRead, ThreadArchiveRangeRequest, ThreadArchiveRangeSeal } from "@yielded/agent/thread-archive-range";
|
|
11
|
+
import { IntegrityReport } from "@yielded/agent/admin";
|
|
8
12
|
import { DurableRuntimeFailpointError } from "@yielded/agent/durable-failpoint";
|
|
13
|
+
import { ThreadWorkPage, ThreadWorkRequest, WorkDiscoveryUnavailable, WorkIndexProgress, WorkIndexRebuildRequest } from "@yielded/agent/thread-work";
|
|
9
14
|
import { WorkerAdmissionRequest } from "@yielded/agent/worker-admission";
|
|
10
15
|
//#region src/PortProtocol.ts
|
|
11
16
|
var PortProtocol_exports = /* @__PURE__ */ __exportAll({
|
|
12
17
|
LedgerAdmitCall: () => LedgerAdmitCall,
|
|
13
18
|
LedgerAdmitResult: () => LedgerAdmitResult,
|
|
19
|
+
LedgerFundingOwnerCall: () => LedgerFundingOwnerCall,
|
|
20
|
+
LedgerFundingOwnerResult: () => LedgerFundingOwnerResult,
|
|
14
21
|
LedgerInspectWorkerCall: () => LedgerInspectWorkerCall,
|
|
15
22
|
LedgerInspectWorkerResult: () => LedgerInspectWorkerResult,
|
|
16
23
|
LedgerLookupCall: () => LedgerLookupCall,
|
|
@@ -37,6 +44,8 @@ var PortProtocol_exports = /* @__PURE__ */ __exportAll({
|
|
|
37
44
|
PortResponse: () => PortResponse,
|
|
38
45
|
PortResult: () => PortResult,
|
|
39
46
|
PortSucceeded: () => PortSucceeded,
|
|
47
|
+
SettlementPublishCall: () => SettlementPublishCall,
|
|
48
|
+
SettlementPublishResult: () => SettlementPublishResult,
|
|
40
49
|
StoreAppendCall: () => StoreAppendCall,
|
|
41
50
|
StoreAppendResult: () => StoreAppendResult,
|
|
42
51
|
StoreCountPeerMessagesCall: () => StoreCountPeerMessagesCall,
|
|
@@ -47,10 +56,30 @@ var PortProtocol_exports = /* @__PURE__ */ __exportAll({
|
|
|
47
56
|
StoreInspectTailResult: () => StoreInspectTailResult,
|
|
48
57
|
StoreMaterializeCall: () => StoreMaterializeCall,
|
|
49
58
|
StoreMaterializeResult: () => StoreMaterializeResult,
|
|
59
|
+
StoreRangeArchiveCall: () => StoreRangeArchiveCall,
|
|
60
|
+
StoreRangeArchiveResult: () => StoreRangeArchiveResult,
|
|
61
|
+
StoreRangePageCall: () => StoreRangePageCall,
|
|
62
|
+
StoreRangePageResult: () => StoreRangePageResult,
|
|
63
|
+
StoreRangeSealCall: () => StoreRangeSealCall,
|
|
64
|
+
StoreRangeSealResult: () => StoreRangeSealResult,
|
|
65
|
+
StoreRangeVerifyCall: () => StoreRangeVerifyCall,
|
|
66
|
+
StoreRangeVerifyResult: () => StoreRangeVerifyResult,
|
|
67
|
+
StoreReadExecutionCall: () => StoreReadExecutionCall,
|
|
68
|
+
StoreReadExecutionResult: () => StoreReadExecutionResult,
|
|
50
69
|
StoreReadIdentityCall: () => StoreReadIdentityCall,
|
|
51
70
|
StoreReadIdentityResult: () => StoreReadIdentityResult,
|
|
52
71
|
StoreReadPageCall: () => StoreReadPageCall,
|
|
53
72
|
StoreReadPageResult: () => StoreReadPageResult,
|
|
73
|
+
StoreReadPromptCall: () => StoreReadPromptCall,
|
|
74
|
+
StoreReadPromptResult: () => StoreReadPromptResult,
|
|
75
|
+
StoreVerificationCall: () => StoreVerificationCall,
|
|
76
|
+
StoreVerificationResult: () => StoreVerificationResult,
|
|
77
|
+
StoreWorkPageCall: () => StoreWorkPageCall,
|
|
78
|
+
StoreWorkPageResult: () => StoreWorkPageResult,
|
|
79
|
+
StoreWorkRebuildCall: () => StoreWorkRebuildCall,
|
|
80
|
+
StoreWorkRebuildResult: () => StoreWorkRebuildResult,
|
|
81
|
+
StoreWorkerCapacityCall: () => StoreWorkerCapacityCall,
|
|
82
|
+
StoreWorkerCapacityResult: () => StoreWorkerCapacityResult,
|
|
54
83
|
WorkerAdmitCall: () => WorkerAdmitCall,
|
|
55
84
|
WorkerAdmitResult: () => WorkerAdmitResult,
|
|
56
85
|
boundPortDiagnostic: () => boundPortDiagnostic,
|
|
@@ -75,11 +104,12 @@ var PortProtocol_exports = /* @__PURE__ */ __exportAll({
|
|
|
75
104
|
* - worker: `admitWorker` (ledger admission, materialization, creation, origin, readiness);
|
|
76
105
|
* - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,
|
|
77
106
|
* `recordChildSettled`;
|
|
78
|
-
* -
|
|
107
|
+
* - publisher: `publish`;
|
|
108
|
+
* - store: `materialize`, `append`, `read` and `readPrompt` (one page), `readIdentity`,
|
|
109
|
+
* `inspectTail`, `export`, `countPeerMessages`, `work.page`, `work.rebuild`.
|
|
79
110
|
*
|
|
80
|
-
* Every other port operation is lane-local and has no envelope.
|
|
81
|
-
*
|
|
82
|
-
* foreign operations fail fast and typed instead of widening the distributed surface.
|
|
111
|
+
* Every other port operation is lane-local and has no envelope. Foreign operations
|
|
112
|
+
* fail fast and typed instead of widening the distributed surface.
|
|
83
113
|
*
|
|
84
114
|
* Failures cross the boundary as the `PortFailure` union and re-decode on the caller side to
|
|
85
115
|
* the SAME tagged error types the local facet would have produced, so routed calls keep
|
|
@@ -107,6 +137,7 @@ var LedgerAdmitCall = class extends Schema.TaggedClass("@effect-agent/storage-cl
|
|
|
107
137
|
var LedgerMarkReadyCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerMarkReadyCall")("LedgerMarkReady", { request: MarkReadyRequest }) {};
|
|
108
138
|
/** Routed `SubmissionLedger.lookup` (by identity or scoped idempotency key). */
|
|
109
139
|
var LedgerLookupCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerLookupCall")("LedgerLookup", { request: SubmissionLookup }) {};
|
|
140
|
+
var LedgerFundingOwnerCall = class extends Schema.TaggedClass()("LedgerFundingOwner", { request: FundingOwnerRequest }) {};
|
|
110
141
|
/** Routed `SubmissionLedger.resolveAdmission` — the SUB-031 tri-state authority call. */
|
|
111
142
|
var LedgerResolveAdmissionCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerResolveAdmissionCall")("LedgerResolveAdmission", { request: SubmissionLookupByKey }) {};
|
|
112
143
|
var LedgerInspectWorkerCall = class extends Schema.TaggedClass()("LedgerInspectWorker", { request: Schema.Struct({ threadId: ThreadId }) }) {};
|
|
@@ -117,44 +148,70 @@ var LedgerStopWorkerResult = class extends Schema.TaggedClass()("LedgerStopWorke
|
|
|
117
148
|
var LedgerRequestAbortCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerRequestAbortCall")("LedgerRequestAbort", { request: AbortCommand }) {};
|
|
118
149
|
/** Routed `SubmissionLedger.recordChildSettled` — the child→parent durable notification. */
|
|
119
150
|
var LedgerRecordChildSettledCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerRecordChildSettledCall")("LedgerRecordChildSettled", { request: ChildSettledNotification }) {};
|
|
151
|
+
/** Publish canonical settlement intent at the owning Thread. */
|
|
152
|
+
var SettlementPublishCall = class extends Schema.TaggedClass()("SettlementPublish", { request: SettlementPublication }) {};
|
|
153
|
+
var SettlementPublishResult = class extends Schema.TaggedClass()("SettlementPublishResult", { result: SettlementPublicationResult }) {};
|
|
120
154
|
/** Routed `ThreadStore.materialize` against the owning Object. */
|
|
121
155
|
var StoreMaterializeCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreMaterializeCall")("StoreMaterialize", { request: ThreadMaterialization }) {};
|
|
122
156
|
/** Routed `ThreadStore.append` against the owning Object. */
|
|
123
|
-
var StoreAppendCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreAppendCall")("StoreAppend", { request:
|
|
157
|
+
var StoreAppendCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreAppendCall")("StoreAppend", { request: AppendRequest }) {};
|
|
124
158
|
/** Routed one-page `ThreadStore.read`; the page bound is the request's own `limit`. */
|
|
125
159
|
var StoreReadPageCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreReadPageCall")("StoreReadPage", { request: ThreadReadRequest }) {};
|
|
160
|
+
var StoreReadPromptCall = class extends Schema.TaggedClass()("StoreReadPrompt", { request: ThreadPromptRead }) {};
|
|
126
161
|
/** Routed `ThreadStore.inspectTail` against the owning Object. */
|
|
127
162
|
var StoreInspectTailCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreInspectTailCall")("StoreInspectTail", { request: ThreadTailRequest }) {};
|
|
128
163
|
/** Routed bounded `ThreadStore.readIdentity` against the owning Object. */
|
|
129
164
|
var StoreReadIdentityCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreReadIdentityCall")("StoreReadIdentity", { request: ThreadIdentityRequest }) {};
|
|
165
|
+
var StoreReadExecutionCall = class extends Schema.TaggedClass()("StoreReadExecution", { request: ExecutionRead }) {};
|
|
166
|
+
var StoreWorkerCapacityCall = class extends Schema.TaggedClass()("StoreWorkerCapacity", { request: ThreadWorkerCapacityRequest }) {};
|
|
167
|
+
var StoreVerificationCall = class extends Schema.TaggedClass()("StoreVerification", { request: ThreadVerificationRequest }) {};
|
|
130
168
|
/** Routed `ThreadStore.export` against the owning Object. */
|
|
131
169
|
var StoreExportCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreExportCall")("StoreExport", { request: ThreadExportRequest }) {};
|
|
132
170
|
var StoreCountPeerMessagesCall = class extends Schema.TaggedClass()("StoreCountPeerMessages", { request: ThreadPeerCountRequest }) {};
|
|
171
|
+
/** Work maintenance is routed to the exact Thread's authoritative owner. */
|
|
172
|
+
var StoreWorkPageCall = class extends Schema.TaggedClass()("StoreWorkPage", { request: ThreadWorkRequest }) {};
|
|
173
|
+
var StoreWorkRebuildCall = class extends Schema.TaggedClass()("StoreWorkRebuild", { request: WorkIndexRebuildRequest }) {};
|
|
133
174
|
var MessageDeliveryListCall = class extends Schema.TaggedClass()("MessageDeliveryList", { request: MessageDeliveryPageRequest }) {};
|
|
134
175
|
var MessageDeliveryCompleteCall = class extends Schema.TaggedClass()("MessageDeliveryComplete", {
|
|
135
176
|
key: MessageDeliveryKey,
|
|
136
177
|
completion: MessageDeliveryCompletion
|
|
137
178
|
}) {};
|
|
179
|
+
var StoreRangePageCall = class extends Schema.TaggedClass()("StoreRangePage", { request: ThreadArchiveRangeRead }) {};
|
|
180
|
+
var StoreRangeSealCall = class extends Schema.TaggedClass()("StoreRangeSeal", { request: ThreadArchiveRangeSeal }) {};
|
|
181
|
+
var StoreRangeArchiveCall = class extends Schema.TaggedClass()("StoreRangeArchive", { request: ThreadArchiveRangePublish }) {};
|
|
182
|
+
var StoreRangeVerifyCall = class extends Schema.TaggedClass()("StoreRangeVerify", { request: ThreadArchiveRangeRequest }) {};
|
|
138
183
|
/** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */
|
|
139
184
|
const PortRequest = Schema.Union([
|
|
185
|
+
SettlementPublishCall,
|
|
140
186
|
WorkerAdmitCall,
|
|
141
187
|
MessageDeliveryListCall,
|
|
142
188
|
MessageDeliveryCompleteCall,
|
|
143
189
|
LedgerAdmitCall,
|
|
144
190
|
LedgerMarkReadyCall,
|
|
145
191
|
LedgerLookupCall,
|
|
192
|
+
LedgerFundingOwnerCall,
|
|
146
193
|
LedgerResolveAdmissionCall,
|
|
147
194
|
LedgerRequestAbortCall,
|
|
148
195
|
LedgerStopWorkerCall,
|
|
149
196
|
LedgerInspectWorkerCall,
|
|
150
197
|
LedgerRecordChildSettledCall,
|
|
198
|
+
StoreRangePageCall,
|
|
199
|
+
StoreRangeSealCall,
|
|
200
|
+
StoreRangeArchiveCall,
|
|
201
|
+
StoreRangeVerifyCall,
|
|
151
202
|
StoreMaterializeCall,
|
|
152
203
|
StoreAppendCall,
|
|
153
204
|
StoreReadPageCall,
|
|
205
|
+
StoreReadPromptCall,
|
|
154
206
|
StoreInspectTailCall,
|
|
155
207
|
StoreReadIdentityCall,
|
|
208
|
+
StoreReadExecutionCall,
|
|
209
|
+
StoreWorkerCapacityCall,
|
|
210
|
+
StoreVerificationCall,
|
|
156
211
|
StoreExportCall,
|
|
157
|
-
StoreCountPeerMessagesCall
|
|
212
|
+
StoreCountPeerMessagesCall,
|
|
213
|
+
StoreWorkPageCall,
|
|
214
|
+
StoreWorkRebuildCall
|
|
158
215
|
]);
|
|
159
216
|
var WorkerAdmitResult = class extends Schema.TaggedClass()("WorkerAdmitResult", { result: AdmissionResult }) {};
|
|
160
217
|
var LedgerAdmitResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerAdmitResult")("LedgerAdmitResult", { result: AdmissionResult }) {};
|
|
@@ -167,36 +224,65 @@ var LedgerRecordChildSettledResult = class extends Schema.TaggedClass("@effect-a
|
|
|
167
224
|
var StoreMaterializeResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreMaterializeResult")("StoreMaterializeResult", {}) {};
|
|
168
225
|
var StoreAppendResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreAppendResult")("StoreAppendResult", { result: AppendResult }) {};
|
|
169
226
|
/** One page of canonical records, bounded by the request's `limit` (≤ 1,024). */
|
|
170
|
-
var StoreReadPageResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreReadPageResult")("StoreReadPageResult", { records: Schema.Array(
|
|
227
|
+
var StoreReadPageResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreReadPageResult")("StoreReadPageResult", { records: Schema.Array(ReadEnvelope).check(Schema.isMaxLength(1024)) }) {};
|
|
228
|
+
var StoreReadPromptResult = class extends Schema.TaggedClass()("StoreReadPromptResult", { records: Schema.Array(PromptRecordEnvelope).check(Schema.isMaxLength(1024)) }) {};
|
|
171
229
|
var StoreInspectTailResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreInspectTailResult")("StoreInspectTailResult", { tail: ThreadTail }) {};
|
|
172
|
-
var
|
|
230
|
+
var StoreReadExecutionResult = class extends Schema.TaggedClass()("StoreReadExecutionResult", { checkpoint: Schema.OptionFromNullOr(ExecutionCheckpoint) }) {};
|
|
231
|
+
var StoreReadIdentityResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreReadIdentityResult")("StoreReadIdentityResult", { identity: Schema.Struct({
|
|
232
|
+
...ThreadIdentity.fields,
|
|
233
|
+
records: Schema.Array(ReadEnvelope).check(Schema.isMaxLength(3))
|
|
234
|
+
}).pipe(Schema.decodeTo(Schema.toType(ThreadIdentity), {
|
|
235
|
+
decode: SchemaGetter.transform((fields) => ThreadIdentity.make(fields)),
|
|
236
|
+
encode: SchemaGetter.transform((identity) => identity)
|
|
237
|
+
})) }) {};
|
|
238
|
+
var LedgerFundingOwnerResult = class extends Schema.TaggedClass()("LedgerFundingOwnerResult", { funding: FundingOwner }) {};
|
|
239
|
+
var StoreWorkerCapacityResult = class extends Schema.TaggedClass()("StoreWorkerCapacityResult", { capacity: ThreadWorkerCapacity }) {};
|
|
240
|
+
var StoreVerificationResult = class extends Schema.TaggedClass()("StoreVerificationResult", { report: IntegrityReport }) {};
|
|
173
241
|
var StoreExportResult = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/StoreExportResult")("StoreExportResult", { export: ThreadExport }) {};
|
|
174
242
|
var StoreCountPeerMessagesResult = class extends Schema.TaggedClass()("StoreCountPeerMessagesResult", { count: Schema.Int.check(Schema.isBetween({
|
|
175
243
|
minimum: 0,
|
|
176
244
|
maximum: 1e3
|
|
177
245
|
})) }) {};
|
|
246
|
+
var StoreWorkPageResult = class extends Schema.TaggedClass()("StoreWorkPageResult", { page: ThreadWorkPage }) {};
|
|
247
|
+
var StoreWorkRebuildResult = class extends Schema.TaggedClass()("StoreWorkRebuildResult", { progress: WorkIndexProgress }) {};
|
|
178
248
|
var MessageDeliveryListResult = class extends Schema.TaggedClass()("MessageDeliveryListResult", { page: MessageDeliveryPage }) {};
|
|
179
249
|
var MessageDeliveryCompleteResult = class extends Schema.TaggedClass()("MessageDeliveryCompleteResult", { record: MessageDeliveryRecord }) {};
|
|
250
|
+
var StoreRangePageResult = class extends Schema.TaggedClass()("StoreRangePageResult", { page: ThreadArchiveRangePage }) {};
|
|
251
|
+
var StoreRangeSealResult = class extends Schema.TaggedClass()("StoreRangeSealResult", { range: Schema.Option(ThreadArchiveRange) }) {};
|
|
252
|
+
var StoreRangeArchiveResult = class extends Schema.TaggedClass()("StoreRangeArchiveResult", { range: ThreadArchiveRange }) {};
|
|
253
|
+
var StoreRangeVerifyResult = class extends Schema.TaggedClass()("StoreRangeVerifyResult", { range: ThreadArchiveRange }) {};
|
|
180
254
|
/** Every successful routed result. Callers narrow by the tag their request implies. */
|
|
181
255
|
const PortResult = Schema.Union([
|
|
256
|
+
SettlementPublishResult,
|
|
182
257
|
WorkerAdmitResult,
|
|
183
258
|
MessageDeliveryListResult,
|
|
184
259
|
MessageDeliveryCompleteResult,
|
|
185
260
|
LedgerAdmitResult,
|
|
186
261
|
LedgerMarkReadyResult,
|
|
187
262
|
LedgerLookupResult,
|
|
263
|
+
LedgerFundingOwnerResult,
|
|
188
264
|
LedgerResolveAdmissionResult,
|
|
189
265
|
LedgerRequestAbortResult,
|
|
190
266
|
LedgerStopWorkerResult,
|
|
191
267
|
LedgerInspectWorkerResult,
|
|
192
268
|
LedgerRecordChildSettledResult,
|
|
269
|
+
StoreRangePageResult,
|
|
270
|
+
StoreRangeSealResult,
|
|
271
|
+
StoreRangeArchiveResult,
|
|
272
|
+
StoreRangeVerifyResult,
|
|
193
273
|
StoreMaterializeResult,
|
|
194
274
|
StoreAppendResult,
|
|
195
275
|
StoreReadPageResult,
|
|
276
|
+
StoreReadPromptResult,
|
|
196
277
|
StoreInspectTailResult,
|
|
197
278
|
StoreReadIdentityResult,
|
|
279
|
+
StoreReadExecutionResult,
|
|
280
|
+
StoreWorkerCapacityResult,
|
|
281
|
+
StoreVerificationResult,
|
|
198
282
|
StoreExportResult,
|
|
199
|
-
StoreCountPeerMessagesResult
|
|
283
|
+
StoreCountPeerMessagesResult,
|
|
284
|
+
StoreWorkPageResult,
|
|
285
|
+
StoreWorkRebuildResult
|
|
200
286
|
]);
|
|
201
287
|
/**
|
|
202
288
|
* Every typed failure a route-capable operation can produce on its owning Object, plus the
|
|
@@ -204,6 +290,7 @@ const PortResult = Schema.Union([
|
|
|
204
290
|
* thread ports declare, so a routed caller observes identical error tags and fields.
|
|
205
291
|
*/
|
|
206
292
|
const PortFailure = Schema.Union([
|
|
293
|
+
OwnershipLost,
|
|
207
294
|
DurableRuntimeFailpointError,
|
|
208
295
|
MessageDeliveryError,
|
|
209
296
|
MessageDeliveryFailpointError,
|
|
@@ -213,9 +300,10 @@ const PortFailure = Schema.Union([
|
|
|
213
300
|
JoinedToHost,
|
|
214
301
|
LedgerError,
|
|
215
302
|
ThreadStoreError,
|
|
303
|
+
WorkDiscoveryUnavailable,
|
|
216
304
|
ThreadNotMaterialized,
|
|
305
|
+
ThreadExportRejected,
|
|
217
306
|
AppendConflict,
|
|
218
|
-
FenceRejected,
|
|
219
307
|
PortProtocolError
|
|
220
308
|
]);
|
|
221
309
|
/** The routed operation succeeded on its owning Object. */
|
|
@@ -229,6 +317,6 @@ const decodePortRequest = Schema.decodeUnknownEffect(PortRequest);
|
|
|
229
317
|
const encodePortResponse = Schema.encodeEffect(PortResponse);
|
|
230
318
|
const decodePortResponse = Schema.decodeUnknownEffect(PortResponse);
|
|
231
319
|
//#endregion
|
|
232
|
-
export { LedgerAdmitCall, LedgerAdmitResult, LedgerInspectWorkerCall, LedgerInspectWorkerResult, LedgerLookupCall, LedgerLookupResult, LedgerMarkReadyCall, LedgerMarkReadyResult, LedgerRecordChildSettledCall, LedgerRecordChildSettledResult, LedgerRequestAbortCall, LedgerRequestAbortResult, LedgerResolveAdmissionCall, LedgerResolveAdmissionResult, LedgerStopWorkerCall, LedgerStopWorkerResult, MAX_PORT_DIAGNOSTIC_LENGTH, MessageDeliveryCompleteCall, MessageDeliveryCompleteResult, MessageDeliveryListCall, MessageDeliveryListResult, PortFailed, PortFailure, PortProtocolError, PortRequest, PortResponse, PortResult, PortSucceeded, StoreAppendCall, StoreAppendResult, StoreCountPeerMessagesCall, StoreCountPeerMessagesResult, StoreExportCall, StoreExportResult, StoreInspectTailCall, StoreInspectTailResult, StoreMaterializeCall, StoreMaterializeResult, StoreReadIdentityCall, StoreReadIdentityResult, StoreReadPageCall, StoreReadPageResult, WorkerAdmitCall, WorkerAdmitResult, boundPortDiagnostic, decodePortRequest, decodePortResponse, encodePortRequest, encodePortResponse, PortProtocol_exports as t };
|
|
320
|
+
export { LedgerAdmitCall, LedgerAdmitResult, LedgerFundingOwnerCall, LedgerFundingOwnerResult, LedgerInspectWorkerCall, LedgerInspectWorkerResult, LedgerLookupCall, LedgerLookupResult, LedgerMarkReadyCall, LedgerMarkReadyResult, LedgerRecordChildSettledCall, LedgerRecordChildSettledResult, LedgerRequestAbortCall, LedgerRequestAbortResult, LedgerResolveAdmissionCall, LedgerResolveAdmissionResult, LedgerStopWorkerCall, LedgerStopWorkerResult, MAX_PORT_DIAGNOSTIC_LENGTH, MessageDeliveryCompleteCall, MessageDeliveryCompleteResult, MessageDeliveryListCall, MessageDeliveryListResult, PortFailed, PortFailure, PortProtocolError, PortRequest, PortResponse, PortResult, PortSucceeded, SettlementPublishCall, SettlementPublishResult, StoreAppendCall, StoreAppendResult, StoreCountPeerMessagesCall, StoreCountPeerMessagesResult, StoreExportCall, StoreExportResult, StoreInspectTailCall, StoreInspectTailResult, StoreMaterializeCall, StoreMaterializeResult, StoreRangeArchiveCall, StoreRangeArchiveResult, StoreRangePageCall, StoreRangePageResult, StoreRangeSealCall, StoreRangeSealResult, StoreRangeVerifyCall, StoreRangeVerifyResult, StoreReadExecutionCall, StoreReadExecutionResult, StoreReadIdentityCall, StoreReadIdentityResult, StoreReadPageCall, StoreReadPageResult, StoreReadPromptCall, StoreReadPromptResult, StoreVerificationCall, StoreVerificationResult, StoreWorkPageCall, StoreWorkPageResult, StoreWorkRebuildCall, StoreWorkRebuildResult, StoreWorkerCapacityCall, StoreWorkerCapacityResult, WorkerAdmitCall, WorkerAdmitResult, boundPortDiagnostic, decodePortRequest, decodePortResponse, encodePortRequest, encodePortResponse, PortProtocol_exports as t };
|
|
233
321
|
|
|
234
322
|
//# sourceMappingURL=PortProtocol.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortProtocol.mjs","names":[],"sources":["../src/PortProtocol.ts"],"sourcesContent":["import { DurableRuntimeFailpointError } from \"@yielded/agent/durable-failpoint\";\nimport { ThreadId } from \"@yielded/agent/identifiers\";\nimport {\n MessageDeliveryError,\n MessageDeliveryFailpointError,\n MessageDeliveryKey,\n MessageDeliveryCompletion,\n MessageDeliveryRecord,\n MessageDeliveryPageRequest,\n MessageDeliveryPage,\n} from \"@yielded/agent/message-delivery\";\nimport { CanonicalRecordEnvelope } from \"@yielded/agent/records\";\nimport {\n AbortCommand,\n WorkerStopCommand,\n WorkerLedgerState,\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 \"@yielded/agent/submission-ledger\";\nimport {\n AppendConflict,\n AppendResult,\n ThreadExport,\n ThreadPeerCountRequest,\n ThreadExportRequest,\n ThreadIdentity,\n ThreadIdentityRequest,\n ThreadMaterialization,\n ThreadNotMaterialized,\n ThreadReadRequest,\n ThreadStoreError,\n ThreadTail,\n ThreadTailRequest,\n FenceRejected,\n FencedAppendRequest,\n} from \"@yielded/agent/thread-store\";\nimport { WorkerAdmissionRequest } from \"@yielded/agent/worker-admission\";\nimport { Schema } from \"effect\";\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 * - worker: `admitWorker` (ledger admission, materialization, creation, origin, readiness);\n * - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,\n * `recordChildSettled`;\n * - store: `materialize`, `append`, `read` (one page), `readIdentity`, `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/** One destination-owned worker admission, including canonical initialization and readiness. */\nexport class WorkerAdmitCall extends Schema.TaggedClass<WorkerAdmitCall>()(\"WorkerAdmit\", {\n request: WorkerAdmissionRequest,\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\nexport class LedgerInspectWorkerCall extends Schema.TaggedClass<LedgerInspectWorkerCall>()(\n \"LedgerInspectWorker\",\n { request: Schema.Struct({ threadId: ThreadId }) },\n) {}\n\nexport class LedgerInspectWorkerResult extends Schema.TaggedClass<LedgerInspectWorkerResult>()(\n \"LedgerInspectWorkerResult\",\n { state: WorkerLedgerState },\n) {}\n\nexport class LedgerStopWorkerCall extends Schema.TaggedClass<LedgerStopWorkerCall>()(\n \"LedgerStopWorker\",\n { request: WorkerStopCommand },\n) {}\n\nexport class LedgerStopWorkerResult extends Schema.TaggedClass<LedgerStopWorkerResult>()(\n \"LedgerStopWorkerResult\",\n { owned: Schema.Natural },\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: ThreadReadRequest,\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 bounded `ThreadStore.readIdentity` against the owning Object. */\nexport class StoreReadIdentityCall extends Schema.TaggedClass<StoreReadIdentityCall>(\n \"@effect-agent/storage-cloudflare/StoreReadIdentityCall\",\n)(\"StoreReadIdentity\", {\n request: ThreadIdentityRequest,\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\nexport class StoreCountPeerMessagesCall extends Schema.TaggedClass<StoreCountPeerMessagesCall>()(\n \"StoreCountPeerMessages\",\n { request: ThreadPeerCountRequest },\n) {}\n\nexport class MessageDeliveryListCall extends Schema.TaggedClass<MessageDeliveryListCall>()(\n \"MessageDeliveryList\",\n { request: MessageDeliveryPageRequest },\n) {}\n\nexport class MessageDeliveryCompleteCall extends Schema.TaggedClass<MessageDeliveryCompleteCall>()(\n \"MessageDeliveryComplete\",\n { key: MessageDeliveryKey, completion: MessageDeliveryCompletion },\n) {}\n\n/** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */\nexport const PortRequest = Schema.Union([\n WorkerAdmitCall,\n MessageDeliveryListCall,\n MessageDeliveryCompleteCall,\n LedgerAdmitCall,\n LedgerMarkReadyCall,\n LedgerLookupCall,\n LedgerResolveAdmissionCall,\n LedgerRequestAbortCall,\n LedgerStopWorkerCall,\n LedgerInspectWorkerCall,\n LedgerRecordChildSettledCall,\n StoreMaterializeCall,\n StoreAppendCall,\n StoreReadPageCall,\n StoreInspectTailCall,\n StoreReadIdentityCall,\n StoreExportCall,\n StoreCountPeerMessagesCall,\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 WorkerAdmitResult extends Schema.TaggedClass<WorkerAdmitResult>()(\n \"WorkerAdmitResult\",\n {\n result: AdmissionResult,\n },\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 StoreReadIdentityResult extends Schema.TaggedClass<StoreReadIdentityResult>(\n \"@effect-agent/storage-cloudflare/StoreReadIdentityResult\",\n)(\"StoreReadIdentityResult\", {\n identity: ThreadIdentity,\n}) {}\n\nexport class StoreExportResult extends Schema.TaggedClass<StoreExportResult>(\n \"@effect-agent/storage-cloudflare/StoreExportResult\",\n)(\"StoreExportResult\", {\n export: ThreadExport,\n}) {}\n\nexport class StoreCountPeerMessagesResult extends Schema.TaggedClass<StoreCountPeerMessagesResult>()(\n \"StoreCountPeerMessagesResult\",\n { count: Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 1000 })) },\n) {}\n\nexport class MessageDeliveryListResult extends Schema.TaggedClass<MessageDeliveryListResult>()(\n \"MessageDeliveryListResult\",\n { page: MessageDeliveryPage },\n) {}\n\nexport class MessageDeliveryCompleteResult extends Schema.TaggedClass<MessageDeliveryCompleteResult>()(\n \"MessageDeliveryCompleteResult\",\n { record: MessageDeliveryRecord },\n) {}\n\n/** Every successful routed result. Callers narrow by the tag their request implies. */\nexport const PortResult = Schema.Union([\n WorkerAdmitResult,\n MessageDeliveryListResult,\n MessageDeliveryCompleteResult,\n LedgerAdmitResult,\n LedgerMarkReadyResult,\n LedgerLookupResult,\n LedgerResolveAdmissionResult,\n LedgerRequestAbortResult,\n LedgerStopWorkerResult,\n LedgerInspectWorkerResult,\n LedgerRecordChildSettledResult,\n StoreMaterializeResult,\n StoreAppendResult,\n StoreReadPageResult,\n StoreInspectTailResult,\n StoreReadIdentityResult,\n StoreExportResult,\n StoreCountPeerMessagesResult,\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 DurableRuntimeFailpointError,\n MessageDeliveryError,\n MessageDeliveryFailpointError,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,MAAa,6BAA6B;AAE1C,MAAM,oBAAoB,OAAO,OAAO,MAAM,OAAO,YAAY,0BAA0B,CAAC;;AAG5F,MAAa,uBAAuB,UAClC,MAAM,SAAA,OACF,GAAG,MAAM,MAAM,GAAG,IAA8B,EAAE,OAClD;;;;;;;;AASN,IAAa,oBAAb,cAAuC,OAAO,YAA+B,C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ocol.mjs","names":[],"sources":["../src/PortProtocol.ts"],"sourcesContent":["import { IntegrityReport } from \"@yielded/agent/admin\";\nimport { DurableRuntimeFailpointError } from \"@yielded/agent/durable-failpoint\";\nimport { ThreadId } from \"@yielded/agent/identifiers\";\nimport {\n MessageDeliveryError,\n MessageDeliveryFailpointError,\n MessageDeliveryKey,\n MessageDeliveryCompletion,\n MessageDeliveryRecord,\n MessageDeliveryPageRequest,\n MessageDeliveryPage,\n} from \"@yielded/agent/message-delivery\";\nimport { ReadEnvelope } from \"@yielded/agent/record-format\";\nimport { PromptRecordEnvelope } from \"@yielded/agent/records\";\nimport {\n SettlementPublication,\n SettlementPublicationResult,\n} from \"@yielded/agent/settlement-publisher\";\nimport {\n AbortCommand,\n WorkerStopCommand,\n WorkerLedgerState,\n AbortIntent,\n AdmissionConflict,\n AdmissionPolicyError,\n AdmissionRequest,\n AdmissionResolution,\n AdmissionResult,\n ChildSettledNotification,\n ChildSettledOutcome,\n JoinedToHost,\n LedgerError,\n OwnershipLost,\n MarkReadyRequest,\n SettlementConflict,\n SubmissionLookup,\n SubmissionLookupByKey,\n SubmissionSnapshot,\n FundingOwnerRequest,\n FundingOwner,\n} from \"@yielded/agent/submission-ledger\";\nimport {\n ThreadArchiveRange,\n ThreadArchiveRangePage,\n ThreadArchiveRangeRead,\n ThreadArchiveRangeRequest,\n ThreadArchiveRangeSeal,\n ThreadArchiveRangePublish,\n} from \"@yielded/agent/thread-archive-range\";\nimport {\n AppendConflict,\n ExecutionRead,\n ExecutionCheckpoint,\n AppendResult,\n ThreadExport,\n ThreadPeerCountRequest,\n ThreadExportRequest,\n ThreadIdentity,\n ThreadIdentityRequest,\n ThreadWorkerCapacityRequest,\n ThreadWorkerCapacity,\n ThreadVerificationRequest,\n ThreadMaterialization,\n ThreadNotMaterialized,\n ThreadExportRejected,\n ThreadReadRequest,\n ThreadPromptRead,\n ThreadStoreError,\n ThreadTail,\n ThreadTailRequest,\n AppendRequest,\n} from \"@yielded/agent/thread-store\";\nimport {\n ThreadWorkRequest,\n ThreadWorkPage,\n WorkIndexRebuildRequest,\n WorkIndexProgress,\n WorkDiscoveryUnavailable,\n} from \"@yielded/agent/thread-work\";\nimport { WorkerAdmissionRequest } from \"@yielded/agent/worker-admission\";\nimport { Schema, SchemaGetter } from \"effect\";\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 * - worker: `admitWorker` (ledger admission, materialization, creation, origin, readiness);\n * - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,\n * `recordChildSettled`;\n * - publisher: `publish`;\n * - store: `materialize`, `append`, `read` and `readPrompt` (one page), `readIdentity`,\n * `inspectTail`, `export`, `countPeerMessages`, `work.page`, `work.rebuild`.\n *\n * Every other port operation is lane-local and has no envelope. Foreign operations\n * 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/** One destination-owned worker admission, including canonical initialization and readiness. */\nexport class WorkerAdmitCall extends Schema.TaggedClass<WorkerAdmitCall>()(\"WorkerAdmit\", {\n request: WorkerAdmissionRequest,\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\nexport class LedgerFundingOwnerCall extends Schema.TaggedClass<LedgerFundingOwnerCall>()(\n \"LedgerFundingOwner\",\n { request: FundingOwnerRequest },\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\nexport class LedgerInspectWorkerCall extends Schema.TaggedClass<LedgerInspectWorkerCall>()(\n \"LedgerInspectWorker\",\n { request: Schema.Struct({ threadId: ThreadId }) },\n) {}\n\nexport class LedgerInspectWorkerResult extends Schema.TaggedClass<LedgerInspectWorkerResult>()(\n \"LedgerInspectWorkerResult\",\n { state: WorkerLedgerState },\n) {}\n\nexport class LedgerStopWorkerCall extends Schema.TaggedClass<LedgerStopWorkerCall>()(\n \"LedgerStopWorker\",\n { request: WorkerStopCommand },\n) {}\n\nexport class LedgerStopWorkerResult extends Schema.TaggedClass<LedgerStopWorkerResult>()(\n \"LedgerStopWorkerResult\",\n { owned: Schema.Natural },\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/** Publish canonical settlement intent at the owning Thread. */\nexport class SettlementPublishCall extends Schema.TaggedClass<SettlementPublishCall>()(\n \"SettlementPublish\",\n { request: SettlementPublication },\n) {}\n\nexport class SettlementPublishResult extends Schema.TaggedClass<SettlementPublishResult>()(\n \"SettlementPublishResult\",\n { result: SettlementPublicationResult },\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: AppendRequest,\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: ThreadReadRequest,\n}) {}\n\nexport class StoreReadPromptCall extends Schema.TaggedClass<StoreReadPromptCall>()(\n \"StoreReadPrompt\",\n { request: ThreadPromptRead },\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 bounded `ThreadStore.readIdentity` against the owning Object. */\nexport class StoreReadIdentityCall extends Schema.TaggedClass<StoreReadIdentityCall>(\n \"@effect-agent/storage-cloudflare/StoreReadIdentityCall\",\n)(\"StoreReadIdentity\", {\n request: ThreadIdentityRequest,\n}) {}\n\nexport class StoreReadExecutionCall extends Schema.TaggedClass<StoreReadExecutionCall>()(\n \"StoreReadExecution\",\n { request: ExecutionRead },\n) {}\n\nexport class StoreWorkerCapacityCall extends Schema.TaggedClass<StoreWorkerCapacityCall>()(\n \"StoreWorkerCapacity\",\n { request: ThreadWorkerCapacityRequest },\n) {}\n\nexport class StoreVerificationCall extends Schema.TaggedClass<StoreVerificationCall>()(\n \"StoreVerification\",\n { request: ThreadVerificationRequest },\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\nexport class StoreCountPeerMessagesCall extends Schema.TaggedClass<StoreCountPeerMessagesCall>()(\n \"StoreCountPeerMessages\",\n { request: ThreadPeerCountRequest },\n) {}\n\n/** Work maintenance is routed to the exact Thread's authoritative owner. */\nexport class StoreWorkPageCall extends Schema.TaggedClass<StoreWorkPageCall>()(\"StoreWorkPage\", {\n request: ThreadWorkRequest,\n}) {}\n\nexport class StoreWorkRebuildCall extends Schema.TaggedClass<StoreWorkRebuildCall>()(\n \"StoreWorkRebuild\",\n { request: WorkIndexRebuildRequest },\n) {}\n\nexport class MessageDeliveryListCall extends Schema.TaggedClass<MessageDeliveryListCall>()(\n \"MessageDeliveryList\",\n { request: MessageDeliveryPageRequest },\n) {}\n\nexport class MessageDeliveryCompleteCall extends Schema.TaggedClass<MessageDeliveryCompleteCall>()(\n \"MessageDeliveryComplete\",\n { key: MessageDeliveryKey, completion: MessageDeliveryCompletion },\n) {}\n\nexport class StoreRangePageCall extends Schema.TaggedClass<StoreRangePageCall>()(\"StoreRangePage\", {\n request: ThreadArchiveRangeRead,\n}) {}\n\nexport class StoreRangeSealCall extends Schema.TaggedClass<StoreRangeSealCall>()(\"StoreRangeSeal\", {\n request: ThreadArchiveRangeSeal,\n}) {}\n\nexport class StoreRangeArchiveCall extends Schema.TaggedClass<StoreRangeArchiveCall>()(\n \"StoreRangeArchive\",\n { request: ThreadArchiveRangePublish },\n) {}\n\nexport class StoreRangeVerifyCall extends Schema.TaggedClass<StoreRangeVerifyCall>()(\n \"StoreRangeVerify\",\n { request: ThreadArchiveRangeRequest },\n) {}\n\n/** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */\nexport const PortRequest = Schema.Union([\n SettlementPublishCall,\n WorkerAdmitCall,\n MessageDeliveryListCall,\n MessageDeliveryCompleteCall,\n LedgerAdmitCall,\n LedgerMarkReadyCall,\n LedgerLookupCall,\n LedgerFundingOwnerCall,\n LedgerResolveAdmissionCall,\n LedgerRequestAbortCall,\n LedgerStopWorkerCall,\n LedgerInspectWorkerCall,\n LedgerRecordChildSettledCall,\n StoreRangePageCall,\n StoreRangeSealCall,\n StoreRangeArchiveCall,\n StoreRangeVerifyCall,\n StoreMaterializeCall,\n StoreAppendCall,\n StoreReadPageCall,\n StoreReadPromptCall,\n StoreInspectTailCall,\n StoreReadIdentityCall,\n StoreReadExecutionCall,\n StoreWorkerCapacityCall,\n StoreVerificationCall,\n StoreExportCall,\n StoreCountPeerMessagesCall,\n StoreWorkPageCall,\n StoreWorkRebuildCall,\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 WorkerAdmitResult extends Schema.TaggedClass<WorkerAdmitResult>()(\n \"WorkerAdmitResult\",\n {\n result: AdmissionResult,\n },\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(ReadEnvelope).check(Schema.isMaxLength(1_024)),\n}) {}\n\nexport class StoreReadPromptResult extends Schema.TaggedClass<StoreReadPromptResult>()(\n \"StoreReadPromptResult\",\n {\n records: Schema.Array(PromptRecordEnvelope).check(Schema.isMaxLength(1_024)),\n },\n) {}\n\nexport class StoreInspectTailResult extends Schema.TaggedClass<StoreInspectTailResult>(\n \"@effect-agent/storage-cloudflare/StoreInspectTailResult\",\n)(\"StoreInspectTailResult\", {\n tail: ThreadTail,\n}) {}\n\nexport class StoreReadExecutionResult extends Schema.TaggedClass<StoreReadExecutionResult>()(\n \"StoreReadExecutionResult\",\n { checkpoint: Schema.OptionFromNullOr(ExecutionCheckpoint) },\n) {}\n\nexport class StoreReadIdentityResult extends Schema.TaggedClass<StoreReadIdentityResult>(\n \"@effect-agent/storage-cloudflare/StoreReadIdentityResult\",\n)(\"StoreReadIdentityResult\", {\n identity: Schema.Struct({\n ...ThreadIdentity.fields,\n records: Schema.Array(ReadEnvelope).check(Schema.isMaxLength(3)),\n }).pipe(\n Schema.decodeTo(Schema.toType(ThreadIdentity), {\n decode: SchemaGetter.transform((fields) => ThreadIdentity.make(fields)),\n encode: SchemaGetter.transform((identity) => identity),\n }),\n ),\n}) {}\n\nexport class LedgerFundingOwnerResult extends Schema.TaggedClass<LedgerFundingOwnerResult>()(\n \"LedgerFundingOwnerResult\",\n { funding: FundingOwner },\n) {}\n\nexport class StoreWorkerCapacityResult extends Schema.TaggedClass<StoreWorkerCapacityResult>()(\n \"StoreWorkerCapacityResult\",\n { capacity: ThreadWorkerCapacity },\n) {}\n\nexport class StoreVerificationResult extends Schema.TaggedClass<StoreVerificationResult>()(\n \"StoreVerificationResult\",\n { report: IntegrityReport },\n) {}\n\nexport class StoreExportResult extends Schema.TaggedClass<StoreExportResult>(\n \"@effect-agent/storage-cloudflare/StoreExportResult\",\n)(\"StoreExportResult\", {\n export: ThreadExport,\n}) {}\n\nexport class StoreCountPeerMessagesResult extends Schema.TaggedClass<StoreCountPeerMessagesResult>()(\n \"StoreCountPeerMessagesResult\",\n { count: Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 1000 })) },\n) {}\n\nexport class StoreWorkPageResult extends Schema.TaggedClass<StoreWorkPageResult>()(\n \"StoreWorkPageResult\",\n { page: ThreadWorkPage },\n) {}\n\nexport class StoreWorkRebuildResult extends Schema.TaggedClass<StoreWorkRebuildResult>()(\n \"StoreWorkRebuildResult\",\n { progress: WorkIndexProgress },\n) {}\n\nexport class MessageDeliveryListResult extends Schema.TaggedClass<MessageDeliveryListResult>()(\n \"MessageDeliveryListResult\",\n { page: MessageDeliveryPage },\n) {}\n\nexport class MessageDeliveryCompleteResult extends Schema.TaggedClass<MessageDeliveryCompleteResult>()(\n \"MessageDeliveryCompleteResult\",\n { record: MessageDeliveryRecord },\n) {}\n\nexport class StoreRangePageResult extends Schema.TaggedClass<StoreRangePageResult>()(\n \"StoreRangePageResult\",\n { page: ThreadArchiveRangePage },\n) {}\n\nexport class StoreRangeSealResult extends Schema.TaggedClass<StoreRangeSealResult>()(\n \"StoreRangeSealResult\",\n { range: Schema.Option(ThreadArchiveRange) },\n) {}\n\nexport class StoreRangeArchiveResult extends Schema.TaggedClass<StoreRangeArchiveResult>()(\n \"StoreRangeArchiveResult\",\n { range: ThreadArchiveRange },\n) {}\n\nexport class StoreRangeVerifyResult extends Schema.TaggedClass<StoreRangeVerifyResult>()(\n \"StoreRangeVerifyResult\",\n { range: ThreadArchiveRange },\n) {}\n\n/** Every successful routed result. Callers narrow by the tag their request implies. */\nexport const PortResult = Schema.Union([\n SettlementPublishResult,\n WorkerAdmitResult,\n MessageDeliveryListResult,\n MessageDeliveryCompleteResult,\n LedgerAdmitResult,\n LedgerMarkReadyResult,\n LedgerLookupResult,\n LedgerFundingOwnerResult,\n LedgerResolveAdmissionResult,\n LedgerRequestAbortResult,\n LedgerStopWorkerResult,\n LedgerInspectWorkerResult,\n LedgerRecordChildSettledResult,\n StoreRangePageResult,\n StoreRangeSealResult,\n StoreRangeArchiveResult,\n StoreRangeVerifyResult,\n StoreMaterializeResult,\n StoreAppendResult,\n StoreReadPageResult,\n StoreReadPromptResult,\n StoreInspectTailResult,\n StoreReadIdentityResult,\n StoreReadExecutionResult,\n StoreWorkerCapacityResult,\n StoreVerificationResult,\n StoreExportResult,\n StoreCountPeerMessagesResult,\n StoreWorkPageResult,\n StoreWorkRebuildResult,\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 OwnershipLost,\n DurableRuntimeFailpointError,\n MessageDeliveryError,\n MessageDeliveryFailpointError,\n AdmissionConflict,\n AdmissionPolicyError,\n SettlementConflict,\n JoinedToHost,\n LedgerError,\n ThreadStoreError,\n WorkDiscoveryUnavailable,\n ThreadNotMaterialized,\n ThreadExportRejected,\n AppendConflict,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgHA,MAAa,6BAA6B;AAE1C,MAAM,oBAAoB,OAAO,OAAO,MAAM,OAAO,YAAY,0BAA0B,CAAC;;AAG5F,MAAa,uBAAuB,UAClC,MAAM,SAAA,OACF,GAAG,MAAM,MAAM,GAAG,IAA8B,EAAE,OAClD;;;;;;;;AASN,IAAa,oBAAb,cAAu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;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAKD,IAAa,gBAAb,cAAmC,OAAO,YACxC,gDACF,CAAC,CAAC,iBAAiB,EACjB,QAAQ,WACV,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,aAAb,cAAgC,OAAO,YACrC,6CACF,CAAC,CAAC,cAAc,EACd,SAAS,YACX,CAAC,CAAC,CAAC,CAAC;;AAGJ,MAAa,eAAe,OAAO,MAAM,CAAC,eAAe,UAAU,CAAC;AAUpE,MAAa,oBAAoB,OAAO,aAAa,WAAW;AAChE,MAAa,oBAAoB,OAAO,oBAAoB,WAAW;AACvE,MAAa,qBAAqB,OAAO,aAAa,YAAY;AAClE,MAAa,qBAAqB,OAAO,oBAAoB,YAAY"}
|
package/dist/PortRouting.d.mts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { LedgerAdmitCall, LedgerInspectWorkerCall, LedgerLookupCall, LedgerMarkReadyCall, LedgerRecordChildSettledCall, LedgerRequestAbortCall, LedgerResolveAdmissionCall, LedgerStopWorkerCall, MessageDeliveryCompleteCall, MessageDeliveryListCall, PortFailed, PortRequestEnvelope, PortSucceeded, StoreAppendCall, StoreCountPeerMessagesCall, StoreExportCall, StoreInspectTailCall, StoreMaterializeCall, StoreReadIdentityCall, StoreReadPageCall, WorkerAdmitCall } from "./PortProtocol.mjs";
|
|
1
|
+
import { LedgerAdmitCall, LedgerFundingOwnerCall, LedgerInspectWorkerCall, LedgerLookupCall, LedgerMarkReadyCall, LedgerRecordChildSettledCall, LedgerRequestAbortCall, LedgerResolveAdmissionCall, LedgerStopWorkerCall, MessageDeliveryCompleteCall, MessageDeliveryListCall, PortFailed, PortRequestEnvelope, PortSucceeded, SettlementPublishCall, StoreAppendCall, StoreCountPeerMessagesCall, StoreExportCall, StoreInspectTailCall, StoreMaterializeCall, StoreRangeArchiveCall, StoreRangePageCall, StoreRangeSealCall, StoreRangeVerifyCall, StoreReadExecutionCall, StoreReadIdentityCall, StoreReadPageCall, StoreReadPromptCall, StoreVerificationCall, StoreWorkPageCall, StoreWorkRebuildCall, StoreWorkerCapacityCall, WorkerAdmitCall } from "./PortProtocol.mjs";
|
|
2
2
|
import { MessageDeliveryStore } from "@yielded/agent/message-delivery";
|
|
3
3
|
import { Cause, Context, Effect, Layer, Option, Schema } from "effect";
|
|
4
|
-
import { ThreadMaterialization, ThreadStore } from "@yielded/agent/thread-store";
|
|
4
|
+
import { ThreadMaterialization, ThreadReader, ThreadStore } from "@yielded/agent/thread-store";
|
|
5
|
+
import { SettlementPublisher } from "@yielded/agent/settlement-publisher";
|
|
5
6
|
import { LedgerError, SubmissionLedger, SubmissionSnapshot } from "@yielded/agent/submission-ledger";
|
|
6
7
|
import { DurableRuntimeFailpoint } from "@yielded/agent/durable-failpoint";
|
|
7
8
|
import { WakeScheduler } from "@yielded/agent/wake-scheduler";
|
|
8
9
|
declare namespace PortRouting_d_exports {
|
|
9
|
-
export { PortTransportError, RoutedPortOptions, ThreadPortTransport, executePortRequest, handleEncodedPortRequest, makeLocalSubmissionLookup, portTransportFailure, routedMessageDeliveryStoreLayer, routedSubmissionLedgerLayer, routedThreadStoreLayer, routedWorkerAdmissionLayer };
|
|
10
|
+
export { CurrentNativeSource, PortTransportError, RoutedPortOptions, ThreadPortTransport, executePortRequest, handleEncodedPortRequest, makeLocalSubmissionLookup, portTransportFailure, routedMessageDeliveryStoreLayer, routedSettlementPublisherLayer, routedSubmissionLedgerLayer, routedThreadStoreLayer, routedWorkerAdmissionLayer };
|
|
10
11
|
}
|
|
11
12
|
type ThreadId = ThreadMaterialization["threadId"];
|
|
12
13
|
type SubmissionId = SubmissionSnapshot["submissionId"];
|
|
14
|
+
/** Owner-local maintenance scope; permits local inventory without global Object enumeration. */
|
|
15
|
+
export declare const CurrentNativeSource: Context.Reference<boolean>;
|
|
13
16
|
declare const PortTransportError_base: Schema.Class<PortTransportError, Schema.TaggedStruct<"PortTransportError", {
|
|
14
17
|
readonly target: Schema.String;
|
|
15
18
|
readonly message: Schema.String;
|
|
@@ -56,6 +59,8 @@ export interface RoutedPortOptions {
|
|
|
56
59
|
* to an owned Thread. This is placement validation, not caller authorization.
|
|
57
60
|
*/
|
|
58
61
|
export declare const makeLocalSubmissionLookup: (options: RoutedPortOptions) => ((submissionId: SubmissionId) => Effect.Effect<Option.Option<SubmissionSnapshot>, LedgerError, SubmissionLedger>);
|
|
62
|
+
/** Route the data-only atomic publication to the same owner as its canonical Thread. */
|
|
63
|
+
export declare const routedSettlementPublisherLayer: (options: RoutedPortOptions) => Layer.Layer<SettlementPublisher, never, SettlementPublisher | ThreadPortTransport>;
|
|
59
64
|
/**
|
|
60
65
|
* Routing decorator over the LOCAL `SubmissionLedger` facet (plan §1.3): a request addressing
|
|
61
66
|
* this Object's Thread executes locally; a route-capable request addressing another
|
|
@@ -66,11 +71,11 @@ export declare const makeLocalSubmissionLookup: (options: RoutedPortOptions) =>
|
|
|
66
71
|
export declare const routedSubmissionLedgerLayer: (options: RoutedPortOptions) => Layer.Layer<SubmissionLedger, never, SubmissionLedger | ThreadPortTransport>;
|
|
67
72
|
/**
|
|
68
73
|
* Routing decorator over the LOCAL `ThreadStore` facet (plan §1.3): this-thread
|
|
69
|
-
* requests execute locally; foreign
|
|
70
|
-
* transport.
|
|
71
|
-
*
|
|
74
|
+
* requests execute locally; foreign store reads, writes, and exact-Thread work pages/rebuild
|
|
75
|
+
* travel the transport. Work enumeration stays local under CurrentNativeSource; global
|
|
76
|
+
* enumeration, foreign checkpoints, and observation fail typed.
|
|
72
77
|
*/
|
|
73
|
-
export declare const routedThreadStoreLayer: (options: RoutedPortOptions) => Layer.Layer<ThreadStore, never, ThreadStore | ThreadPortTransport>;
|
|
78
|
+
export declare const routedThreadStoreLayer: (options: RoutedPortOptions) => Layer.Layer<ThreadStore | ThreadReader, never, ThreadStore | ThreadPortTransport>;
|
|
74
79
|
/** Route validated worker admission as one operation; source policy hooks stay at the caller. */
|
|
75
80
|
export declare const routedWorkerAdmissionLayer: (options: RoutedPortOptions) => Layer.Layer<never, never, ThreadPortTransport>;
|
|
76
81
|
/** Route the existing owner-scoped list; delivery mutations remain source local. */
|
|
@@ -83,7 +88,7 @@ export declare const routedMessageDeliveryStoreLayer: (options: RoutedPortOption
|
|
|
83
88
|
* Failures never escape — every typed port failure becomes a `PortFailed` envelope that
|
|
84
89
|
* re-decodes on the caller side.
|
|
85
90
|
*/
|
|
86
|
-
export declare const executePortRequest: (request: LedgerAdmitCall | LedgerInspectWorkerCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | LedgerStopWorkerCall | MessageDeliveryCompleteCall | MessageDeliveryListCall | StoreAppendCall | StoreCountPeerMessagesCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadIdentityCall | StoreReadPageCall | WorkerAdmitCall) => Effect.Effect<PortFailed | PortSucceeded, never, DurableRuntimeFailpoint | MessageDeliveryStore | SubmissionLedger | ThreadStore | WakeScheduler>;
|
|
91
|
+
export declare const executePortRequest: (request: LedgerAdmitCall | LedgerFundingOwnerCall | LedgerInspectWorkerCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | LedgerStopWorkerCall | MessageDeliveryCompleteCall | MessageDeliveryListCall | SettlementPublishCall | StoreAppendCall | StoreCountPeerMessagesCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreRangeArchiveCall | StoreRangePageCall | StoreRangeSealCall | StoreRangeVerifyCall | StoreReadExecutionCall | StoreReadIdentityCall | StoreReadPageCall | StoreReadPromptCall | StoreVerificationCall | StoreWorkPageCall | StoreWorkRebuildCall | StoreWorkerCapacityCall | WorkerAdmitCall) => Effect.Effect<PortFailed | PortSucceeded, never, DurableRuntimeFailpoint | MessageDeliveryStore | SettlementPublisher | SubmissionLedger | ThreadStore | WakeScheduler>;
|
|
87
92
|
/**
|
|
88
93
|
* The complete owner-side endpoint body for `portCall` (D-P6-3): decode the wire request,
|
|
89
94
|
* execute it against this Object's LOCAL facets, and answer with the encoded response
|
|
@@ -91,7 +96,7 @@ export declare const executePortRequest: (request: LedgerAdmitCall | LedgerInspe
|
|
|
91
96
|
* cannot be encoded, answers `PortFailed(PortProtocolError)` instead of throwing, so the
|
|
92
97
|
* transport never has to interpret exceptions as protocol answers.
|
|
93
98
|
*/
|
|
94
|
-
export declare const handleEncodedPortRequest: (encoded: unknown) => Effect.Effect<unknown, never, DurableRuntimeFailpoint | MessageDeliveryStore | SubmissionLedger | ThreadStore | WakeScheduler>;
|
|
99
|
+
export declare const handleEncodedPortRequest: (encoded: unknown) => Effect.Effect<unknown, never, DurableRuntimeFailpoint | MessageDeliveryStore | SettlementPublisher | SubmissionLedger | ThreadStore | WakeScheduler>;
|
|
95
100
|
//#endregion
|
|
96
101
|
export { PortRouting_d_exports as t };
|
|
97
102
|
//# sourceMappingURL=PortRouting.d.mts.map
|