@yielded/agent 0.1.0-beta.175 → 0.1.0-beta.176
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/{Admin-Qa3I1oA5.d.mts → Admin-DTDihBra.d.mts} +13 -7
- package/dist/{DurableAgentRuntime-CPlw5_7e.mjs → DurableAgentRuntime-BJbuIqQq.mjs} +84 -37
- package/dist/DurableAgentRuntime-BJbuIqQq.mjs.map +1 -0
- package/dist/{EventSource-BTu68yDW.d.mts → EventSource-Cc58uEso.d.mts} +2 -2
- package/dist/{MessageDelivery-DjAZJ4Fd.d.mts → MessageDelivery-ClHg7c0O.d.mts} +42 -42
- package/dist/{PreparedInputAdmission-wgY4JMZY.d.mts → PreparedInputAdmission-CjcX1OP0.d.mts} +3 -3
- package/dist/{RunContinuation-BiyKJK32.mjs → RunContinuation-CWHuciup.mjs} +3 -3
- package/dist/RunContinuation-CWHuciup.mjs.map +1 -0
- package/dist/{RunContinuation-3jB5pULC.d.mts → RunContinuation-DSnUTSSb.d.mts} +4 -4
- package/dist/{RunJournal-CPMKcfd0.mjs → RunJournal-DGblbFas.mjs} +5 -5
- package/dist/{RunJournal-CPMKcfd0.mjs.map → RunJournal-DGblbFas.mjs.map} +1 -1
- package/dist/{RunStorage-CzutHJBE.mjs → RunStorage-BF2YgWkg.mjs} +43 -33
- package/dist/RunStorage-BF2YgWkg.mjs.map +1 -0
- package/dist/{Subscription-DmIHlOJK.d.mts → Subscription-DuC_PcGx.d.mts} +2 -2
- package/dist/{SubscriptionInput-DgcQhvbe.d.mts → SubscriptionInput-B1IeAEDi.d.mts} +2 -2
- package/dist/{ThreadImport-DP-vOk2F.d.mts → ThreadImport-D_Biid6w.d.mts} +42 -42
- package/dist/{ThreadImport-CjlG57vH.mjs → ThreadImport-ZgWxf7bB.mjs} +5 -5
- package/dist/{ThreadImport-CjlG57vH.mjs.map → ThreadImport-ZgWxf7bB.mjs.map} +1 -1
- package/dist/{ThreadStore-EuUilthA.mjs → ThreadStore-BC4V-mY-.mjs} +39 -18
- package/dist/ThreadStore-BC4V-mY-.mjs.map +1 -0
- package/dist/{ThreadTransfer-DB_zsrtJ.mjs → ThreadTransfer-S7FnTRHt.mjs} +2 -2
- package/dist/{ThreadTransfer-DB_zsrtJ.mjs.map → ThreadTransfer-S7FnTRHt.mjs.map} +1 -1
- package/dist/{WorkerAdmission-eBeXt_mu.mjs → WorkerAdmission-C47Vy_cK.mjs} +3 -3
- package/dist/{WorkerAdmission-eBeXt_mu.mjs.map → WorkerAdmission-C47Vy_cK.mjs.map} +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/CommittedActivity.mjs +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +2 -2
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
- package/dist/durable/LifecyclePublication.d.mts +1 -1
- package/dist/durable/LifecyclePublication.mjs +1 -1
- package/dist/durable/MessageDelivery.d.mts +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +2 -2
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PersistentHistory.mjs +3 -3
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/RunContinuation.d.mts +2 -2
- package/dist/durable/RunContinuation.mjs +2 -2
- package/dist/durable/RunJournal.d.mts +1 -1
- package/dist/durable/RunJournal.mjs +1 -1
- package/dist/durable/RunStorage.d.mts +1 -1
- package/dist/durable/RunStorage.mjs +1 -1
- package/dist/durable/Scheduling.d.mts +1 -1
- package/dist/durable/SettlementPublisher.d.mts +1 -1
- package/dist/durable/SettlementPublisher.mjs +2 -2
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedger.mjs.map +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +3 -3
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionTools.d.mts +2 -2
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/ThreadArchiveRange.d.mts +1 -1
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistory.mjs +1 -1
- package/dist/durable/ThreadImport.d.mts +1 -1
- package/dist/durable/ThreadImport.mjs +1 -1
- package/dist/durable/ThreadInvariants.d.mts +3 -3
- package/dist/durable/ThreadInvariants.mjs +3 -3
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadReader.d.mts +1 -1
- package/dist/durable/ThreadReader.mjs +1 -1
- package/dist/durable/ThreadStore.d.mts +1 -1
- package/dist/durable/ThreadStore.mjs +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/ThreadStoreConformance.mjs +3 -3
- package/dist/durable/ThreadTransfer.d.mts +1 -1
- package/dist/durable/ThreadTransfer.mjs +1 -1
- package/dist/durable/ThreadWork.d.mts +1 -1
- package/dist/durable/ThreadWork.mjs +3 -3
- package/dist/durable/WorkerAdmission.d.mts +68 -68
- package/dist/durable/WorkerAdmission.mjs +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +7 -7
- package/dist/{run-context-reader-DVhJZ1Qe.d.mts → run-context-reader-DvTEq2RC.d.mts} +2 -2
- package/package.json +1 -1
- package/src/durable/DurableAgentRuntime.ts +169 -55
- package/src/durable/RunContinuation.ts +2 -2
- package/src/durable/RunJournal.ts +9 -5
- package/src/durable/RunStorage.ts +83 -61
- package/src/durable/SubmissionLedger.ts +8 -0
- package/src/durable/ThreadStore.ts +39 -19
- package/src/durable/internal/initial-context.ts +17 -2
- package/src/durable/internal/prompt-history-cache.ts +13 -8
- package/dist/DurableAgentRuntime-CPlw5_7e.mjs.map +0 -1
- package/dist/RunContinuation-BiyKJK32.mjs.map +0 -1
- package/dist/RunStorage-CzutHJBE.mjs.map +0 -1
- package/dist/ThreadStore-EuUilthA.mjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $o as subagentLineageBatchId, Ao as approvalDecisionBatchId, Bo as modelResponseRecordId, Co as RunJournalContext, Cs as workerReportRecordId, Eo as RunJournalUsage, Fo as firstWorkerInputRecordId, Go as runCompletedRecordId, Ho as projectRunJournal, Io as initialRunJournal, Jo as runIdForSubmission, Ko as runDurationBatchId, Lo as markUnknownBatchId, Mo as childThreadIdFor, No as compactionBatchId, Oo as TurnCommitInput, Po as compactionRecordId, Qo as subagentJoinedRecordId, Ro as modelResponseInterruptedBatchId, So as JournalBoundary, Ss as workerOriginRecordId, To as RunJournalProjection, Ts as toolCallSettledRecordId, Uo as projectRunJournalStream, Vo as peerMessageRecordId, Wo as promptFromCanonicalRecords, Xo as runStartedRecordId, Yo as runStartedBatchId, Zo as subagentJoinBatchId, _s as turnResponseBatch, as as toolApprovalDecisionRecordId, bs as turnResultsBatchId, cs as toolCallResolvedRecordId, ds as toolStepSettledBatchId, es as subagentLineageRecordId, fs as toolStepSettledRecordId, gs as turnIdForRun, hs as turnCanonicalBatch, is as subagentStartedRecordId, jo as childIdempotencyKeyFor, ko as agentUpdateRecordId, ls as toolCallResultBatchId, ms as turnBatchId, ns as subagentRequestedRecordId, os as toolApprovalRequestRecordId, ps as turnApprovalsBatchId, qo as runDurationRecordId, rs as subagentStartedBatchId, ss as toolCallResolutionBatchId, ts as subagentRequestedBatchId, us as toolCallUnknownRecordId, vs as turnResponseBatchId, wo as RunJournalError, xs as workerInputRecordId, ys as turnResultsBatch, zo as modelResponseInterruptedRecordId } from "../Admin-
|
|
1
|
+
import { $o as subagentLineageBatchId, Ao as approvalDecisionBatchId, Bo as modelResponseRecordId, Co as RunJournalContext, Cs as workerReportRecordId, Eo as RunJournalUsage, Fo as firstWorkerInputRecordId, Go as runCompletedRecordId, Ho as projectRunJournal, Io as initialRunJournal, Jo as runIdForSubmission, Ko as runDurationBatchId, Lo as markUnknownBatchId, Mo as childThreadIdFor, No as compactionBatchId, Oo as TurnCommitInput, Po as compactionRecordId, Qo as subagentJoinedRecordId, Ro as modelResponseInterruptedBatchId, So as JournalBoundary, Ss as workerOriginRecordId, To as RunJournalProjection, Ts as toolCallSettledRecordId, Uo as projectRunJournalStream, Vo as peerMessageRecordId, Wo as promptFromCanonicalRecords, Xo as runStartedRecordId, Yo as runStartedBatchId, Zo as subagentJoinBatchId, _s as turnResponseBatch, as as toolApprovalDecisionRecordId, bs as turnResultsBatchId, cs as toolCallResolvedRecordId, ds as toolStepSettledBatchId, es as subagentLineageRecordId, fs as toolStepSettledRecordId, gs as turnIdForRun, hs as turnCanonicalBatch, is as subagentStartedRecordId, jo as childIdempotencyKeyFor, ko as agentUpdateRecordId, ls as toolCallResultBatchId, ms as turnBatchId, ns as subagentRequestedRecordId, os as toolApprovalRequestRecordId, ps as turnApprovalsBatchId, qo as runDurationRecordId, rs as subagentStartedBatchId, ss as toolCallResolutionBatchId, ts as subagentRequestedBatchId, us as toolCallUnknownRecordId, vs as turnResponseBatchId, wo as RunJournalError, xs as workerInputRecordId, ys as turnResultsBatch, zo as modelResponseInterruptedRecordId } from "../Admin-DTDihBra.mjs";
|
|
2
2
|
export { JournalBoundary, RunJournalContext, RunJournalError, RunJournalProjection, RunJournalUsage, TurnCommitInput, agentUpdateRecordId, approvalDecisionBatchId, childIdempotencyKeyFor, childThreadIdFor, compactionBatchId, compactionRecordId, firstWorkerInputRecordId, initialRunJournal, markUnknownBatchId, modelResponseInterruptedBatchId, modelResponseInterruptedRecordId, modelResponseRecordId, peerMessageRecordId, projectRunJournal, projectRunJournalStream, promptFromCanonicalRecords, runCompletedRecordId, runDurationBatchId, runDurationRecordId, runIdForSubmission, runStartedBatchId, runStartedRecordId, subagentJoinBatchId, subagentJoinedRecordId, subagentLineageBatchId, subagentLineageRecordId, subagentRequestedBatchId, subagentRequestedRecordId, subagentStartedBatchId, subagentStartedRecordId, toolApprovalDecisionRecordId, toolApprovalRequestRecordId, toolCallResolutionBatchId, toolCallResolvedRecordId, toolCallResultBatchId, toolCallSettledRecordId, toolCallUnknownRecordId, toolStepSettledBatchId, toolStepSettledRecordId, turnApprovalsBatchId, turnBatchId, turnCanonicalBatch, turnIdForRun, turnResponseBatch, turnResponseBatchId, turnResultsBatch, turnResultsBatchId, workerInputRecordId, workerOriginRecordId, workerReportRecordId };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as subagentRequestedRecordId, B as toolStepSettledRecordId, C as runStartedBatchId, D as subagentLineageBatchId, E as subagentJoinedRecordId, F as toolCallResolutionBatchId, G as turnResponseBatch, H as turnBatchId, I as toolCallResolvedRecordId, J as turnResultsBatchId, K as turnResponseBatchId, L as toolCallResultBatchId, M as subagentStartedRecordId, N as toolApprovalDecisionRecordId, O as subagentLineageRecordId, P as toolApprovalRequestRecordId, R as toolCallUnknownRecordId, S as runIdForSubmission, T as subagentJoinBatchId, U as turnCanonicalBatch, V as turnApprovalsBatchId, W as turnIdForRun, X as workerOriginRecordId, Y as workerInputRecordId, Z as workerReportRecordId, _ as projectRunJournalStream, a as childIdempotencyKeyFor, b as runDurationBatchId, c as compactionRecordId, d as markUnknownBatchId, et as toolCallSettledRecordId, f as modelResponseInterruptedBatchId, g as projectRunJournal, h as peerMessageRecordId, i as approvalDecisionBatchId, j as subagentStartedBatchId, k as subagentRequestedBatchId, l as firstWorkerInputRecordId, m as modelResponseRecordId, o as childThreadIdFor, p as modelResponseInterruptedRecordId, q as turnResultsBatch, r as agentUpdateRecordId, s as compactionBatchId, t as RunJournalError, u as initialRunJournal, v as promptFromCanonicalRecords, w as runStartedRecordId, x as runDurationRecordId, y as runCompletedRecordId, z as toolStepSettledBatchId } from "../RunJournal-
|
|
1
|
+
import { A as subagentRequestedRecordId, B as toolStepSettledRecordId, C as runStartedBatchId, D as subagentLineageBatchId, E as subagentJoinedRecordId, F as toolCallResolutionBatchId, G as turnResponseBatch, H as turnBatchId, I as toolCallResolvedRecordId, J as turnResultsBatchId, K as turnResponseBatchId, L as toolCallResultBatchId, M as subagentStartedRecordId, N as toolApprovalDecisionRecordId, O as subagentLineageRecordId, P as toolApprovalRequestRecordId, R as toolCallUnknownRecordId, S as runIdForSubmission, T as subagentJoinBatchId, U as turnCanonicalBatch, V as turnApprovalsBatchId, W as turnIdForRun, X as workerOriginRecordId, Y as workerInputRecordId, Z as workerReportRecordId, _ as projectRunJournalStream, a as childIdempotencyKeyFor, b as runDurationBatchId, c as compactionRecordId, d as markUnknownBatchId, et as toolCallSettledRecordId, f as modelResponseInterruptedBatchId, g as projectRunJournal, h as peerMessageRecordId, i as approvalDecisionBatchId, j as subagentStartedBatchId, k as subagentRequestedBatchId, l as firstWorkerInputRecordId, m as modelResponseRecordId, o as childThreadIdFor, p as modelResponseInterruptedRecordId, q as turnResultsBatch, r as agentUpdateRecordId, s as compactionBatchId, t as RunJournalError, u as initialRunJournal, v as promptFromCanonicalRecords, w as runStartedRecordId, x as runDurationRecordId, y as runCompletedRecordId, z as toolStepSettledBatchId } from "../RunJournal-DGblbFas.mjs";
|
|
2
2
|
export { RunJournalError, agentUpdateRecordId, approvalDecisionBatchId, childIdempotencyKeyFor, childThreadIdFor, compactionBatchId, compactionRecordId, firstWorkerInputRecordId, initialRunJournal, markUnknownBatchId, modelResponseInterruptedBatchId, modelResponseInterruptedRecordId, modelResponseRecordId, peerMessageRecordId, projectRunJournal, projectRunJournalStream, promptFromCanonicalRecords, runCompletedRecordId, runDurationBatchId, runDurationRecordId, runIdForSubmission, runStartedBatchId, runStartedRecordId, subagentJoinBatchId, subagentJoinedRecordId, subagentLineageBatchId, subagentLineageRecordId, subagentRequestedBatchId, subagentRequestedRecordId, subagentStartedBatchId, subagentStartedRecordId, toolApprovalDecisionRecordId, toolApprovalRequestRecordId, toolCallResolutionBatchId, toolCallResolvedRecordId, toolCallResultBatchId, toolCallSettledRecordId, toolCallUnknownRecordId, toolStepSettledBatchId, toolStepSettledRecordId, turnApprovalsBatchId, turnBatchId, turnCanonicalBatch, turnIdForRun, turnResponseBatch, turnResponseBatchId, turnResultsBatch, turnResultsBatchId, workerInputRecordId, workerOriginRecordId, workerReportRecordId };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Fr as RunStorageSession, Ir as RunWriter, Lr as layer, Mr as RunChildBudgetReservation, Nr as RunOwnership, Pr as RunStorage, Rr as make, _o as MutationGate, bo as StorageOwnerService, jr as RunChildAttachment, vo as OwnerGeneration, xo as makeStorageOwner, yo as StorageOwner, zr as makeRunWriter } from "../Admin-
|
|
1
|
+
import { Fr as RunStorageSession, Ir as RunWriter, Lr as layer, Mr as RunChildBudgetReservation, Nr as RunOwnership, Pr as RunStorage, Rr as make, _o as MutationGate, bo as StorageOwnerService, jr as RunChildAttachment, vo as OwnerGeneration, xo as makeStorageOwner, yo as StorageOwner, zr as makeRunWriter } from "../Admin-DTDihBra.mjs";
|
|
2
2
|
export { type MutationGate, type OwnerGeneration, RunChildAttachment, RunChildBudgetReservation, RunOwnership, RunStorage, RunStorageSession, RunWriter, StorageOwner, type StorageOwnerService, layer, make, makeRunWriter, makeStorageOwner };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as make, c as makeStorageOwner, i as layer, n as RunChildBudgetReservation, o as makeRunWriter, r as RunStorage, s as StorageOwner, t as RunChildAttachment } from "../RunStorage-
|
|
1
|
+
import { a as make, c as makeStorageOwner, i as layer, n as RunChildBudgetReservation, o as makeRunWriter, r as RunStorage, s as StorageOwner, t as RunChildAttachment } from "../RunStorage-BF2YgWkg.mjs";
|
|
2
2
|
export { RunChildAttachment, RunChildBudgetReservation, RunStorage, StorageOwner, layer, make, makeRunWriter, makeStorageOwner };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as Principal } from "../Receipt-BkM21Qiu.mjs";
|
|
2
2
|
import { b as DefinitionDigests } from "../Records-BTnGRdcf.mjs";
|
|
3
|
-
import { cr as DurableSubmitAgent, pt as AdmissionFence } from "../Admin-
|
|
3
|
+
import { cr as DurableSubmitAgent, pt as AdmissionFence } from "../Admin-DTDihBra.mjs";
|
|
4
4
|
import { A as ScheduleSnapshotPage, B as ScheduledInputAdmission, C as ScheduleRecord, D as ScheduleScope, F as ScheduleTimingRequest, I as ScheduleValidationError, L as ScheduleWake, M as ScheduleStore, N as ScheduleStoreFailure, W as SchedulingLimits, c as ScheduleDestination, f as ScheduleId, j as ScheduleStorageError, k as ScheduleSnapshot, m as ScheduleKey, n as ScheduleAuthorizationError, r as ScheduleAuthorizer, y as ScheduleOwner } from "../Schedule-CDgTz0vj.mjs";
|
|
5
5
|
import { Context, Crypto, Effect, Layer, Schema } from "effect";
|
|
6
6
|
declare namespace Scheduling_d_exports {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Br as SettlementPublication, Gr as validateCanonicalSettlement, Hr as SettlementPublicationFailure, Kr as validateJoinedSettlement, Ur as SettlementPublicationResult, Vr as SettlementPublicationAuthority, Wr as SettlementPublisher, qr as validatePublication } from "../Admin-
|
|
1
|
+
import { Br as SettlementPublication, Gr as validateCanonicalSettlement, Hr as SettlementPublicationFailure, Kr as validateJoinedSettlement, Ur as SettlementPublicationResult, Vr as SettlementPublicationAuthority, Wr as SettlementPublisher, qr as validatePublication } from "../Admin-DTDihBra.mjs";
|
|
2
2
|
export { SettlementPublication, SettlementPublicationAuthority, SettlementPublicationFailure, SettlementPublicationResult, SettlementPublisher, validateCanonicalSettlement, validateJoinedSettlement, validatePublication };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SubmissionId } from "../core/Identifiers.mjs";
|
|
2
2
|
import { X as RecordEnvelope, f as CanonicalSequence, gt as SubmissionSettled } from "../Records-DzL4Kbtw.mjs";
|
|
3
3
|
import { LedgerError, submissionSettlementBatchId, submissionSettlementId, submissionSettlementRecordId } from "./SubmissionLedger.mjs";
|
|
4
|
-
import { S as runIdForSubmission } from "../RunJournal-
|
|
5
|
-
import { h as PreparedAppend, n as AppendRequest } from "../ThreadStore-
|
|
4
|
+
import { S as runIdForSubmission } from "../RunJournal-DGblbFas.mjs";
|
|
5
|
+
import { h as PreparedAppend, n as AppendRequest } from "../ThreadStore-BC4V-mY-.mjs";
|
|
6
6
|
import { Context, Effect, Schema } from "effect";
|
|
7
7
|
//#region src/durable/SettlementPublisher.ts
|
|
8
8
|
/** Authority rechecked atomically on every publication attempt, including canonical replay. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { i as QueueSequence, n as JoinedToHost, r as Principal, t as IdempotencyKey } from "../Receipt-BkM21Qiu.mjs";
|
|
2
|
-
import { $t as RecoverySnapshotRequest, An as WaitingChild, At as ChildReservationConflict, Bn as submissionSettlementBatchId, Bt as FundingOwnerRequest, Cn as SuspensionReason, Ct as ApprovalDecisionIntent, Dn as UnknownResolutionConflict, Dt as ChildAttachmentSnapshot, En as UnknownResolutionCommand, Et as BeginChildBudgetReleaseRequest, Fn as settlementFailureFromRecord, Ft as Claim, Gn as workerTerminalFromRecord, Gt as LedgerError, Hn as submissionSettlementRecordId, Ht as JoinSnapshot, In as submissionAbortBatchId, It as ClaimHandoff, Jt as MarkReadyRequest, Kt as MarkInputAppliedRequest, Ln as submissionAbortRecordId, Lt as ClaimJoiningRequest, Mn as WorkerLedgerState, Mt as ChildReservationStatus, Nn as WorkerStopCommand, Nt as ChildSettledNotification, On as UnknownResolutionIntent, Ot as ChildBudgetReservationRequest, Pn as approvalDecisionsCover, Pt as ChildSettledOutcome, Qt as RecoverySnapshot, Rn as submissionInputBatchId, Rt as ClaimRequest, Sn as SuspensionOutcome, St as ApprovalDecisionCommand, Tn as UnknownResolution, Tt as AttachChildToReservationRequest, Un as unknownResolutionKind, Ut as JoiningClaim, Vn as submissionSettlementId, Vt as InputAppliedMarker, Wn as unknownResolutionMatchesResult, Wt as LedgerCapabilities, Xt as OwnershipLost, Yt as MarkUnknownRequest, Zt as ParentLinkage, _n as SubmissionScheduling, _t as AdmissionPolicyError, an as ResolutionSafeToRetry, bn as SubmissionWorkItem, bt as AdmissionResult, cn as SettlementConflict, ct as AbortCommand, dn as SubmissionLedger, dt as AdmissionAdmitted, en as ReleaseChildBudgetRequest, fn as SubmissionLedgerFailure, ft as AdmissionConflict, gn as SubmissionLookupByKey, gt as AdmissionNotAdmitted, hn as SubmissionLookupById, ht as AdmissionIndeterminate, in as ResolutionNeverHappened, jn as WaitingForChildSuspension, jt as ChildReservationId, kn as UnknownResolutionKind, kt as ChildBudgetReservationSnapshot, ln as SettlementFinalization, lt as AbortIntent, mn as SubmissionLookup, mt as AdmissionGroup, nn as ResolutionAbortSubmission, on as RevertJoiningRequest, pt as AdmissionFence, qt as MarkJoinedRequest, rn as ResolutionCompletedWithResult, sn as Settlement, tn as ReservedChildBudget, un as SubmissionAdmissionFence, ut as AbortIntentRequest, vn as SubmissionSnapshot, vt as AdmissionRequest, wn as SuspensionSnapshot, wt as ApprovalPendingSuspension, xn as SuspendRequest, xt as ApprovalConflict, yn as SubmissionState, yt as AdmissionResolution, zn as submissionInputRecordId, zt as FundingOwner } from "../Admin-
|
|
2
|
+
import { $t as RecoverySnapshotRequest, An as WaitingChild, At as ChildReservationConflict, Bn as submissionSettlementBatchId, Bt as FundingOwnerRequest, Cn as SuspensionReason, Ct as ApprovalDecisionIntent, Dn as UnknownResolutionConflict, Dt as ChildAttachmentSnapshot, En as UnknownResolutionCommand, Et as BeginChildBudgetReleaseRequest, Fn as settlementFailureFromRecord, Ft as Claim, Gn as workerTerminalFromRecord, Gt as LedgerError, Hn as submissionSettlementRecordId, Ht as JoinSnapshot, In as submissionAbortBatchId, It as ClaimHandoff, Jt as MarkReadyRequest, Kt as MarkInputAppliedRequest, Ln as submissionAbortRecordId, Lt as ClaimJoiningRequest, Mn as WorkerLedgerState, Mt as ChildReservationStatus, Nn as WorkerStopCommand, Nt as ChildSettledNotification, On as UnknownResolutionIntent, Ot as ChildBudgetReservationRequest, Pn as approvalDecisionsCover, Pt as ChildSettledOutcome, Qt as RecoverySnapshot, Rn as submissionInputBatchId, Rt as ClaimRequest, Sn as SuspensionOutcome, St as ApprovalDecisionCommand, Tn as UnknownResolution, Tt as AttachChildToReservationRequest, Un as unknownResolutionKind, Ut as JoiningClaim, Vn as submissionSettlementId, Vt as InputAppliedMarker, Wn as unknownResolutionMatchesResult, Wt as LedgerCapabilities, Xt as OwnershipLost, Yt as MarkUnknownRequest, Zt as ParentLinkage, _n as SubmissionScheduling, _t as AdmissionPolicyError, an as ResolutionSafeToRetry, bn as SubmissionWorkItem, bt as AdmissionResult, cn as SettlementConflict, ct as AbortCommand, dn as SubmissionLedger, dt as AdmissionAdmitted, en as ReleaseChildBudgetRequest, fn as SubmissionLedgerFailure, ft as AdmissionConflict, gn as SubmissionLookupByKey, gt as AdmissionNotAdmitted, hn as SubmissionLookupById, ht as AdmissionIndeterminate, in as ResolutionNeverHappened, jn as WaitingForChildSuspension, jt as ChildReservationId, kn as UnknownResolutionKind, kt as ChildBudgetReservationSnapshot, ln as SettlementFinalization, lt as AbortIntent, mn as SubmissionLookup, mt as AdmissionGroup, nn as ResolutionAbortSubmission, on as RevertJoiningRequest, pt as AdmissionFence, qt as MarkJoinedRequest, rn as ResolutionCompletedWithResult, sn as Settlement, tn as ReservedChildBudget, un as SubmissionAdmissionFence, ut as AbortIntentRequest, vn as SubmissionSnapshot, vt as AdmissionRequest, wn as SuspensionSnapshot, wt as ApprovalPendingSuspension, xn as SuspendRequest, xt as ApprovalConflict, yn as SubmissionState, yt as AdmissionResolution, zn as submissionInputRecordId, zt as FundingOwner } from "../Admin-DTDihBra.mjs";
|
|
3
3
|
export { AbortCommand, AbortIntent, AbortIntentRequest, AdmissionAdmitted, AdmissionConflict, AdmissionFence, AdmissionGroup, AdmissionIndeterminate, AdmissionNotAdmitted, AdmissionPolicyError, AdmissionRequest, AdmissionResolution, AdmissionResult, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, ApprovalPendingSuspension, AttachChildToReservationRequest, BeginChildBudgetReleaseRequest, ChildAttachmentSnapshot, ChildBudgetReservationRequest, ChildBudgetReservationSnapshot, ChildReservationConflict, ChildReservationId, ChildReservationStatus, ChildSettledNotification, ChildSettledOutcome, Claim, ClaimHandoff, ClaimJoiningRequest, ClaimRequest, FundingOwner, FundingOwnerRequest, IdempotencyKey, InputAppliedMarker, JoinSnapshot, JoinedToHost, JoiningClaim, LedgerCapabilities, LedgerError, MarkInputAppliedRequest, MarkJoinedRequest, MarkReadyRequest, MarkUnknownRequest, OwnershipLost, ParentLinkage, Principal, QueueSequence, RecoverySnapshot, RecoverySnapshotRequest, ReleaseChildBudgetRequest, ReservedChildBudget, ResolutionAbortSubmission, ResolutionCompletedWithResult, ResolutionNeverHappened, ResolutionSafeToRetry, RevertJoiningRequest, Settlement, SettlementConflict, SettlementFinalization, SubmissionAdmissionFence, SubmissionLedger, SubmissionLedgerFailure, SubmissionLookup, SubmissionLookupById, SubmissionLookupByKey, SubmissionScheduling, SubmissionSnapshot, SubmissionState, SubmissionWorkItem, SuspendRequest, SuspensionOutcome, SuspensionReason, SuspensionSnapshot, UnknownResolution, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, UnknownResolutionKind, WaitingChild, WaitingForChildSuspension, WorkerLedgerState, WorkerStopCommand, approvalDecisionsCover, settlementFailureFromRecord, submissionAbortBatchId, submissionAbortRecordId, submissionInputBatchId, submissionInputRecordId, submissionSettlementBatchId, submissionSettlementId, submissionSettlementRecordId, unknownResolutionKind, unknownResolutionMatchesResult, workerTerminalFromRecord };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmissionLedger.mjs","names":["FailureDiagnostic.Value"],"sources":["../../src/durable/SubmissionLedger.ts"],"sourcesContent":["import type { Option, Stream } from \"effect\";\nimport { Brand, Context, Effect, Schema } from \"effect\";\n\nimport { InputMessage } from \"../capabilities/Messaging.ts\";\nimport * as FailureDiagnostic from \"../core/FailureDiagnostic.ts\";\nimport {\n AgentId,\n AttemptId,\n ThreadId,\n ReceiptId,\n SettlementId,\n SubmissionId,\n ToolCallId,\n} from \"../core/Identifiers.ts\";\nimport type { JoinedToHost } from \"../core/Receipt.ts\";\nimport { IdempotencyKey, QueueSequence, Principal } from \"../core/Receipt.ts\";\nimport { RunUsageSummary } from \"../core/Usage.ts\";\nimport { AssignmentTerminal } from \"../core/Worker.ts\";\nimport { canonicalJson } from \"./Digest.ts\";\nimport {\n type BatchId,\n type RecordEnvelope,\n AbortRequested,\n ApprovalDecision,\n CanonicalSequence,\n DefinitionDigests,\n DeploymentId,\n Digest,\n PersistedJson,\n RecordId,\n SettlementFailureDiagnostic,\n SettlementOutcome,\n ToolApprovalDecided,\n ToolCallResolved,\n type ToolCallSettled,\n ToolCallUnknown,\n WorkerAdmission,\n} from \"./Records.ts\";\n\nexport { IdempotencyKey, JoinedToHost, QueueSequence, Principal } from \"../core/Receipt.ts\";\n\n/**\n * Ledger lifecycle states for one Submission. `settled` is the only terminal state; every other\n * state carries an outstanding accepted-work obligation (Accepted-work Contract, DUR-002).\n *\n * Phase 5 states:\n *\n * - `joining` — a queued Submission claimed by an active host Run, before its canonical\n * `UserInputRecorded` append; recovery reverts it to `ready` (DUR-016).\n * - `joined` — the input is canonical and linked to its host; the Submission settles WITH the\n * host Run's outcome.\n * - `suspended` — durably waiting for explicit approval decisions; the ownership period has\n * ended and the lane consumes no worker permit while the obligation stays owed.\n * - `unknown` — at least one Tool Call has a durable Unknown Outcome; this Submission is\n * parked until an authorized resolution covers every open call or a durable abort intent\n * authorizes cleanup without Tool replay. Later eligible input may run (DUR-012/DUR-017).\n *\n * `claim` never grants or bypasses a `joining`, `joined`, or `suspended` head. It skips unknown\n * work without an abort intent. Any live ownership in the Thread prevents another claim.\n */\nexport const SubmissionState = Schema.Literals([\n \"admitted\",\n \"ready\",\n \"joining\",\n \"joined\",\n \"input-applied\",\n \"suspended\",\n \"unknown\",\n \"settled\",\n]);\n\nexport type SubmissionState = typeof SubmissionState.Type;\n\n/**\n * Opt-in host policy for handling the next runnable same-Agent input in its own Run at a complete Turn\n * boundary. This never joins inputs or changes their principals, grants, or receipts. The\n * runtime selects the ordered candidate; policy cannot select an arbitrary Submission.\n * Approval waits, child waits and incomplete Tool batches are not handoff boundaries. Hosts\n * retaining independent replies must also leave those inputs unclaimed by `claimJoining`.\n * In-flight model requests and Tool batches run to their existing safe boundary.\n */\nexport const SubmissionScheduling = Context.Reference<{\n readonly yieldTo?: (request: {\n readonly active: SubmissionSnapshot;\n readonly next: SubmissionSnapshot;\n }) => Effect.Effect<boolean, LedgerError>;\n}>(\"@effect-agent/thread/SubmissionScheduling\", { defaultValue: () => ({}) });\n\n/**\n * What a SubmissionLedger adapter claims about itself. `durable-node` asserts single-node\n * process-crash durability (fsync-backed storage); `durable-cloudflare` asserts the same\n * single-serialized-owner crash durability through Durable Object storage output gates;\n * `non-durable` marks reference adapters whose state does not survive the process (in-memory\n * conformance/test adapters). The label is an honest self-description for reports and\n * evidence — no runtime behavior branches on it.\n */\nexport class LedgerCapabilities extends Schema.Class<LedgerCapabilities>(\n \"@effect-agent/thread/LedgerCapabilities\",\n)({\n durability: Schema.Literals([\"durable-node\", \"durable-cloudflare\", \"non-durable\"]),\n}) {}\n\n/**\n * Immutable lineage from a child Submission to the exact parent Tool Call that established it\n * (spec §12 step 5, SUB-004). Recorded once at admission and never rewritten; it is an\n * identifier, not an authorization capability (D10) — the join path verifies the canonical\n * Parent Link records, never this marker alone.\n */\nexport class ParentLinkage extends Schema.Class<ParentLinkage>(\n \"@effect-agent/thread/ParentLinkage\",\n)({\n parentSubmissionId: SubmissionId,\n parentToolCallId: ToolCallId,\n}) {}\n\n/** Host-owned policy coordinates, interpreted only by the destination transaction owner. */\nexport const AdmissionFence = Schema.Struct({\n policyId: Schema.NonEmptyString.check(Schema.isMaxLength(128)),\n key: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n revision: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n});\n\nexport type AdmissionFence = typeof AdmissionFence.Type;\nexport const AdmissionGroup = Schema.NonEmptyString.check(Schema.isMaxLength(256));\n\n/** Fresh admission alone may be refused; unavailability never proves non-admission. */\nexport class AdmissionPolicyError extends Schema.TaggedError<AdmissionPolicyError>()(\n \"AdmissionPolicyError\",\n {\n reason: Schema.Literals([\"refused\", \"unavailable\", \"occupied\"]),\n code: Schema.NonEmptyString.check(Schema.isMaxLength(128)),\n cause: Schema.optionalKey(FailureDiagnostic.Value),\n stack: Schema.optionalKey(Schema.String),\n },\n) {}\n\n/**\n * Durable admission input. `inputDigest` must be the digest of the canonical JSON encoding of\n * `inputPayload` (see `digestJson`); admission idempotency compares digests, never re-encodes.\n * `agentId`/`agentDigests`/`deploymentId` are persisted so recovery can complete Thread\n * materialization without the submitting client. `parentLinkage` is present exactly when the\n * Submission is a durable attached child (spec §12); an admission replay must repeat the same\n * linkage (or its absence) or fail with `AdmissionConflict`.\n */\nexport class AdmissionRequest extends Schema.Class<AdmissionRequest>(\n \"@effect-agent/thread/AdmissionRequest\",\n)({\n threadId: ThreadId,\n principal: Principal,\n idempotencyKey: IdempotencyKey,\n agentId: AgentId,\n agentDigests: DefinitionDigests,\n deploymentId: DeploymentId,\n inputPayload: PersistedJson,\n inputDigest: Digest,\n parentLinkage: Schema.optionalKey(ParentLinkage),\n workerAdmission: Schema.optionalKey(WorkerAdmission),\n messageAdmission: Schema.optionalKey(InputMessage),\n admissionGroup: Schema.optionalKey(AdmissionGroup),\n admissionFence: Schema.optionalKey(AdmissionFence),\n}) {}\n\n/**\n * The committed admission row. `replayed` is true when an identical (thread, principal,\n * idempotencyKey, inputDigest) admission already existed; the original identities are returned\n * unchanged so a client retry resumes rather than duplicates (DUR-001).\n */\nexport class AdmissionResult extends Schema.Class<AdmissionResult>(\n \"@effect-agent/thread/AdmissionResult\",\n)({\n submissionId: SubmissionId,\n receiptId: ReceiptId,\n queueSequence: QueueSequence,\n state: SubmissionState,\n replayed: Schema.Boolean,\n}) {}\n\nexport class MarkReadyRequest extends Schema.Class<MarkReadyRequest>(\n \"@effect-agent/thread/MarkReadyRequest\",\n)({\n submissionId: SubmissionId,\n}) {}\n\nexport class SubmissionLookupById extends Schema.TaggedClass<SubmissionLookupById>(\n \"@effect-agent/thread/SubmissionLookupById\",\n)(\"SubmissionLookupById\", {\n submissionId: SubmissionId,\n}) {}\n\nexport class SubmissionLookupByKey extends Schema.TaggedClass<SubmissionLookupByKey>(\n \"@effect-agent/thread/SubmissionLookupByKey\",\n)(\"SubmissionLookupByKey\", {\n threadId: ThreadId,\n principal: Principal,\n idempotencyKey: IdempotencyKey,\n}) {}\n\n/** Lookup by Submission identity or by the scoped client idempotency key. */\nexport const SubmissionLookup = Schema.Union([SubmissionLookupById, SubmissionLookupByKey]);\n\nexport type SubmissionLookup = typeof SubmissionLookup.Type;\n\n/**\n * Control-only worklist entry. Discovery validates identities, ordering and state without\n * decoding retained execution payloads. Hydrate only the selected Thread through `lookup`\n * or `loadRecoverySnapshot`, inside its recovery failure boundary.\n */\nexport class SubmissionWorkItem extends Schema.Class<SubmissionWorkItem>(\n \"@effect-agent/thread/SubmissionWorkItem\",\n)({\n submissionId: SubmissionId,\n threadId: ThreadId,\n queueSequence: QueueSequence,\n principal: Principal,\n idempotencyKey: IdempotencyKey,\n deploymentId: DeploymentId,\n receiptId: ReceiptId,\n state: SubmissionState,\n}) {}\n\n/** The full durable ledger view of one Submission. */\nexport class SubmissionSnapshot extends Schema.Class<SubmissionSnapshot>(\n \"@effect-agent/thread/SubmissionSnapshot\",\n)({\n ...SubmissionWorkItem.fields,\n agentId: AgentId,\n agentDigests: DefinitionDigests,\n inputPayload: PersistedJson,\n inputDigest: Digest,\n settledOutcome: Schema.optionalKey(SettlementOutcome),\n /** First committed finalization time; paired with settledRecordId by native adapters. */\n settledAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n /** Exact canonical settlement behind the finalized projection; not a substitute for reading it. */\n settledRecordId: Schema.optionalKey(RecordId),\n createdAt: Schema.DateTimeUtcFromString,\n readyAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n admissionGroup: Schema.optionalKey(AdmissionGroup),\n admissionFence: Schema.optionalKey(AdmissionFence),\n parentLinkage: Schema.optionalKey(ParentLinkage),\n workerAdmission: Schema.optionalKey(WorkerAdmission),\n messageAdmission: Schema.optionalKey(InputMessage),\n}) {}\n\n/** Resolve the exact selected input to its immutable host Run without enumerating joins. */\nexport const FundingOwnerRequest = Schema.Struct({\n threadId: ThreadId,\n submissionId: SubmissionId,\n});\n\nexport type FundingOwnerRequest = typeof FundingOwnerRequest.Type;\n\nexport const FundingOwner = Schema.Struct({\n selected: SubmissionSnapshot,\n owner: SubmissionSnapshot,\n});\n\nexport type FundingOwner = typeof FundingOwner.Type;\n\n/** Bounded native control facts. Canonical input/Run records remain ThreadStore-owned. */\nexport const WorkerLedgerState = Schema.Struct({\n latest: Schema.NullOr(SubmissionSnapshot),\n active: Schema.NullOr(SubmissionSnapshot),\n stopped: Schema.Boolean,\n terminal: Schema.optionalKey(AssignmentTerminal),\n}).check(Schema.makeFilter((state) => state.terminal === undefined || state.stopped));\n\nexport type WorkerLedgerState = typeof WorkerLedgerState.Type;\n\n/** The authoritative store proves the scoped idempotency key was never admitted (SUB-031). */\nexport class AdmissionNotAdmitted extends Schema.TaggedClass<AdmissionNotAdmitted>(\n \"@effect-agent/thread/AdmissionNotAdmitted\",\n)(\"NotAdmitted\", {}) {}\n\n/** The scoped idempotency key was admitted; the full Submission snapshot is authoritative. */\nexport class AdmissionAdmitted extends Schema.TaggedClass<AdmissionAdmitted>(\n \"@effect-agent/thread/AdmissionAdmitted\",\n)(\"Admitted\", {\n submission: SubmissionSnapshot,\n}) {}\n\n/**\n * The adapter cannot currently prove admission or its absence (e.g. the authoritative child\n * owner is unreachable on a partitioned platform). Callers wait and retry; an indeterminate\n * answer NEVER permits a second admission attempt (SUB-031).\n */\nexport class AdmissionIndeterminate extends Schema.TaggedClass<AdmissionIndeterminate>(\n \"@effect-agent/thread/AdmissionIndeterminate\",\n)(\"Indeterminate\", {\n reason: Schema.String.check(Schema.isMaxLength(4096)),\n}) {}\n\n/**\n * The tri-state answer of `resolveAdmission` (spec §12: \"absence from an eventually consistent\n * projection is never proof\"). Single strongly consistent stores derive `NotAdmitted`/`Admitted`\n * from a direct lookup; only adapters that can genuinely fail to reach the authoritative owner\n * answer `Indeterminate`.\n */\nexport const AdmissionResolution = Schema.Union([\n AdmissionNotAdmitted,\n AdmissionAdmitted,\n AdmissionIndeterminate,\n]);\n\nexport type AdmissionResolution = typeof AdmissionResolution.Type;\n\n/**\n * A trusted runtime's advisory handoff after committing a complete Turn and closing its\n * Attempt. The owner rechecks the entire deferred prefix and target under its mutation gate.\n * Deferred Runs retain their identities and obligations; losing this hint resumes FIFO.\n */\nexport class ClaimHandoff extends Schema.Class<ClaimHandoff>(\"@effect-agent/thread/ClaimHandoff\")({\n deferredSubmissionIds: Schema.NonEmptyArray(SubmissionId),\n submissionId: SubmissionId,\n}) {}\n\nexport class ClaimRequest extends Schema.Class<ClaimRequest>(\"@effect-agent/thread/ClaimRequest\")({\n threadId: ThreadId,\n handoff: Schema.optionalKey(ClaimHandoff),\n}) {}\n\n/**\n * Selected accepted work. Attempt identity is diagnostic; only the bound scoped session\n * grants execution authority. No field is a portable ownership capability.\n */\nexport class Claim extends Schema.Class<Claim>(\"@effect-agent/thread/Claim\")({\n submissionId: SubmissionId,\n attemptId: AttemptId,\n inputPayload: PersistedJson,\n}) {}\n\n/**\n * The canonical position of the applied `UserInputRecorded` record for one Submission.\n */\nexport class MarkInputAppliedRequest extends Schema.Class<MarkInputAppliedRequest>(\n \"@effect-agent/thread/MarkInputAppliedRequest\",\n)({\n submissionId: SubmissionId,\n recordId: RecordId,\n sequence: CanonicalSequence,\n}) {}\n\nexport class InputAppliedMarker extends Schema.Class<InputAppliedMarker>(\n \"@effect-agent/thread/InputAppliedMarker\",\n)({\n recordId: RecordId,\n sequence: CanonicalSequence,\n}) {}\n\nexport class SettlementFinalization extends Schema.Class<SettlementFinalization>(\n \"@effect-agent/thread/SettlementFinalization\",\n)({\n submissionId: SubmissionId,\n settlementId: SettlementId,\n}) {}\n\nconst SettlementFields = Schema.Struct({\n submissionId: SubmissionId,\n settlementId: SettlementId,\n receiptId: ReceiptId,\n outcome: SettlementOutcome,\n /** Schema-encoded application disposition materialized from the exact canonical settlement. */\n runDisposition: Schema.optionalKey(PersistedJson),\n /** Canonical aggregate of model usage and estimated spend for this Run. */\n usageSummary: Schema.optionalKey(RunUsageSummary),\n /** Present exactly for `failed`; its Schema rejects excess keys before canonical projection. */\n failure: Schema.optionalKey(SettlementFailureDiagnostic),\n settledAt: Schema.DateTimeUtcFromString,\n}).check(\n Schema.makeFilter(\n (settlement) => (settlement.outcome === \"failed\") === (settlement.failure !== undefined),\n { title: \"failure exactly on a failed Settlement\" },\n ),\n);\n\n/** The single durable terminal outcome recorded for one accepted Submission (DUR-002). */\nexport class Settlement extends Schema.Class<Settlement>(\"@effect-agent/thread/Settlement\")(\n SettlementFields,\n) {}\n\n/**\n * Project the bounded failed-settlement diagnostic from an already Schema-validated exact\n * canonical record. Storage adapters use this when materializing their operational Settlement value;\n * the canonical record remains the authority.\n */\nexport const settlementFailureFromRecord = (\n record: RecordEnvelope,\n): SettlementFailureDiagnostic | undefined => {\n const payload = record.payload;\n\n return payload._tag === \"SubmissionSettled\" && payload.outcome === \"failed\"\n ? payload.result\n : undefined;\n};\n\n/**\n * Assignment intent derived only from frozen admission and exact settlement evidence.\n * Joined receipts and cancellation before a Run starts do not finish an assignment.\n * Adapters suppress completed intent when newer accepted input remains unapplied, then\n * install the first seal and outstanding abort intents atomically before releasing the lane.\n */\nexport const workerTerminalFromRecord = (\n submission: SubmissionSnapshot,\n record: RecordEnvelope,\n): AssignmentTerminal | undefined => {\n const payload = record.payload;\n\n if (\n submission.workerAdmission?.origin.lifecycle !== \"assignment\" ||\n payload._tag !== \"SubmissionSettled\" ||\n (payload.runId !== undefined && payload.runId !== `run:${submission.submissionId}`)\n )\n return undefined;\n if (payload.outcome === \"failed\" || payload.finishReason === \"budget-exhausted\") return \"failed\";\n if (payload.outcome === \"aborted\") return payload.runId === undefined ? undefined : \"cancelled\";\n\n return payload.runDisposition === \"completed\" ? \"completed\" : undefined;\n};\n\n/** Destination-owned permanent inbox seal; recorded atomically with all outstanding abort intents. */\nexport const WorkerStopCommand = Schema.Struct({\n threadId: ThreadId,\n author: Principal,\n});\n\nexport type WorkerStopCommand = typeof WorkerStopCommand.Type;\n\n/**\n * A durable abort command (durability §13). Field bounds are exactly those of the canonical\n * `AbortRequested` payload so the intent can become canonical without re-validation.\n */\nexport class AbortCommand extends Schema.Class<AbortCommand>(\"@effect-agent/thread/AbortCommand\")({\n submissionId: SubmissionId,\n author: AbortRequested.fields.author,\n reason: AbortRequested.fields.reason,\n}) {}\n\n/**\n * The recorded abort intent. `canonicalRecordId` is present once the corresponding canonical\n * `AbortRequested` record has been appended (its identity is deterministic; see\n * `submissionAbortRecordId`).\n */\nexport class AbortIntent extends Schema.Class<AbortIntent>(\"@effect-agent/thread/AbortIntent\")({\n submissionId: SubmissionId,\n author: AbortRequested.fields.author,\n reason: AbortRequested.fields.reason,\n requestedAt: Schema.DateTimeUtcFromString,\n canonicalRecordId: Schema.optionalKey(RecordId),\n}) {}\n\n/** Address one lane-local abort intent without loading unrelated recovery state. */\nexport class AbortIntentRequest extends Schema.Class<AbortIntentRequest>(\n \"@effect-agent/thread/AbortIntentRequest\",\n)({ submissionId: SubmissionId }) {}\n\n/**\n * Atomic claim of the contiguous ready prefix of strictly-later queued Submissions for joining\n * into the active host Run (plan §2.5). The bound host session owns the lane. An `admitted`-but-not-`ready` row breaks the prefix;\n * an aborted-settled row is a closed obligation and is skipped as a non-gap (P7 §7(c)).\n */\nexport class ClaimJoiningRequest extends Schema.Class<ClaimJoiningRequest>(\n \"@effect-agent/thread/ClaimJoiningRequest\",\n)({\n threadId: ThreadId,\n hostSubmissionId: SubmissionId,\n maxCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\n/** One queued Submission transitioned to `joining` under the host's ownership. */\nexport class JoiningClaim extends Schema.Class<JoiningClaim>(\"@effect-agent/thread/JoiningClaim\")({\n submissionId: SubmissionId,\n queueSequence: QueueSequence,\n inputPayload: PersistedJson,\n}) {}\n\n/**\n * The canonical position of one joined Submission's `UserInputRecorded` record (`input:{sid}`).\n * Marking transitions `joining → joined` and records the host linkage established at claim time.\n */\nexport class MarkJoinedRequest extends Schema.Class<MarkJoinedRequest>(\n \"@effect-agent/thread/MarkJoinedRequest\",\n)({\n submissionId: SubmissionId,\n recordId: RecordId,\n sequence: CanonicalSequence,\n}) {}\n\n/**\n * Recovery-only revert of a `joining` Submission whose canonical input append never committed\n * (DUR-016): `joining → ready`, idempotent, a no-op when the Submission already joined.\n * A guard limits the revert to the exact linked host: the root gate serializes it with the linked host. A changed host link is a no-op.\n * Adapters validate the guard atomically with the transition. Unguarded requests retain the\n * caller-owned recovery contract.\n */\nexport class RevertJoiningRequest extends Schema.Class<RevertJoiningRequest>(\n \"@effect-agent/thread/RevertJoiningRequest\",\n)({\n submissionId: SubmissionId,\n guard: Schema.optionalKey(\n Schema.Struct({\n hostSubmissionId: SubmissionId,\n }),\n ),\n}) {}\n\n/**\n * Why one Submission is durably suspended. Approval was the only Phase 5 reason; S2 adds\n * `WaitingForChild` (spec §12 step 10) and the union keeps later suspension families (e.g.\n * operator quarantine) additive.\n */\nexport class ApprovalPendingSuspension extends Schema.TaggedClass<ApprovalPendingSuspension>(\n \"@effect-agent/thread/ApprovalPendingSuspension\",\n)(\"ApprovalPending\", {\n toolCallIds: Schema.NonEmptyArray(ToolCallId),\n}) {}\n\n/** A denial ends the batch; otherwise every retained approval must be decided to wake it. */\nexport const approvalDecisionsCover = (\n toolCallIds: ReadonlyArray<ToolCallId>,\n decisionFor: (toolCallId: ToolCallId) => ApprovalDecision | undefined,\n): boolean => {\n let allDecided = true;\n\n for (const toolCallId of toolCallIds) {\n const decision = decisionFor(toolCallId);\n\n if (decision === \"denied\") return true;\n if (decision === undefined) allDecided = false;\n }\n\n return allDecided;\n};\n\n/** One attached child a `waitingForChild` parent is durably waiting on (spec §12 step 10). */\nexport class WaitingChild extends Schema.Class<WaitingChild>(\"@effect-agent/thread/WaitingChild\")({\n toolCallId: ToolCallId,\n childSubmissionId: SubmissionId,\n}) {}\n\n/**\n * The parent Attempt ended without settling because attached durable children must settle and\n * join first (spec §12 step 10, SUB-030). The suspended lane holds no worker permit; each listed\n * child settles on its own Thread lane and `recordChildSettled` wakes the parent once\n * every listed child is settled.\n */\nexport class WaitingForChildSuspension extends Schema.TaggedClass<WaitingForChildSuspension>(\n \"@effect-agent/thread/WaitingForChildSuspension\",\n)(\"WaitingForChild\", {\n children: Schema.NonEmptyArray(WaitingChild),\n}) {}\n\nexport const SuspensionReason = Schema.Union([\n ApprovalPendingSuspension,\n WaitingForChildSuspension,\n]);\n\nexport type SuspensionReason = typeof SuspensionReason.Type;\n\n/**\n * Durable suspension of owned work (plan §2.6): `input-applied`/`ready` → `suspended`, the\n * ownership period ends, NO settlement occurs — the accepted-work obligation stays owed while\n * the lane consumes no worker permit.\n */\nexport class SuspendRequest extends Schema.Class<SuspendRequest>(\n \"@effect-agent/thread/SuspendRequest\",\n)({\n submissionId: SubmissionId,\n reason: SuspensionReason,\n}) {}\n\n/**\n * `suspended` when the lane is now durably waiting; `resume-immediately` when the suspension\n * reason is already fully covered (a covering decision or child settlement raced ahead of the\n * suspend transaction), so the caller resumes without releasing the lane.\n */\nexport const SuspensionOutcome = Schema.Literals([\"suspended\", \"resume-immediately\"]);\n\nexport type SuspensionOutcome = typeof SuspensionOutcome.Type;\n\n/**\n * A durable child-settlement notification for one waitingForChild parent (spec §12 step 10).\n * The child's canonical Settlement is the authority; this command only drives the parent lane's\n * wake transition.\n */\nexport class ChildSettledNotification extends Schema.Class<ChildSettledNotification>(\n \"@effect-agent/thread/ChildSettledNotification\",\n)({\n parentSubmissionId: SubmissionId,\n childSubmissionId: SubmissionId,\n}) {}\n\n/**\n * `woken` when this notification completed the waiting set and the parent transitioned\n * `suspended(WaitingForChild) → input-applied`; `still-waiting` while other listed children are\n * unsettled; `not-waiting` when the parent is not (or no longer) suspended waiting on this\n * child — including replays after a wake, so the operation is idempotent.\n */\nexport const ChildSettledOutcome = Schema.Literals([\"woken\", \"still-waiting\", \"not-waiting\"]);\n\nexport type ChildSettledOutcome = typeof ChildSettledOutcome.Type;\n\n/** Parent-owned child budget reservation identity, deterministically derived by the\n * coordinator from the parent Run and Tool Call identity (spec §12 step 2). */\nexport const ChildReservationId = Schema.NonEmptyString.check(Schema.isMaxLength(256)).pipe(\n Schema.brand(\"@effect-agent/thread/ChildReservationId\"),\n);\n\nexport type ChildReservationId = typeof ChildReservationId.Type;\n\n/**\n * The reservation state machine (spec §12 steps 2 and 6): `reserved` while the child may still\n * consume the allocation, `releasePending` once the final accounting decision is frozen, and\n * `released` after the unused allocation returned exactly once.\n */\nexport const ChildReservationStatus = Schema.Literals([\"reserved\", \"releasePending\", \"released\"]);\n\nexport type ChildReservationStatus = typeof ChildReservationStatus.Type;\n\n/**\n * Creation input for one parent-owned child budget reservation. The allocation is an opaque\n * Schema-encoded budget document (D8: adapters implement transitions only and never interpret\n * budget dimensions); `allocationDigest` must be the digest of its canonical JSON encoding.\n */\nexport class ChildBudgetReservationRequest extends Schema.Class<ChildBudgetReservationRequest>(\n \"@effect-agent/thread/ChildBudgetReservationRequest\",\n)({\n reservationId: ChildReservationId,\n parentSubmissionId: SubmissionId,\n parentToolCallId: ToolCallId,\n allocation: PersistedJson,\n allocationDigest: Digest,\n}) {}\n\n/** One child budget reservation row as the port exposes it. */\nexport class ChildBudgetReservationSnapshot extends Schema.Class<ChildBudgetReservationSnapshot>(\n \"@effect-agent/thread/ChildBudgetReservationSnapshot\",\n)({\n reservationId: ChildReservationId,\n parentSubmissionId: SubmissionId,\n parentToolCallId: ToolCallId,\n childSubmissionId: Schema.optionalKey(SubmissionId),\n status: ChildReservationStatus,\n allocation: PersistedJson,\n allocationDigest: Digest,\n accounting: Schema.optionalKey(PersistedJson),\n reservedAt: Schema.DateTimeUtcFromString,\n releaseBeganAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n releasedAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n}) {}\n\n/**\n * The committed reservation. `replayed` is true when an identical reservation already existed;\n * the stored row is returned unchanged so a recovering caller resumes rather than duplicates\n * (SUB-016).\n */\nexport class ReservedChildBudget extends Schema.Class<ReservedChildBudget>(\n \"@effect-agent/thread/ReservedChildBudget\",\n)({\n reservation: ChildBudgetReservationSnapshot,\n replayed: Schema.Boolean,\n}) {}\n\n/** Records the admitted child on its reservation row (repairable from `SubagentStarted`). */\nexport class AttachChildToReservationRequest extends Schema.Class<AttachChildToReservationRequest>(\n \"@effect-agent/thread/AttachChildToReservationRequest\",\n)({\n reservationId: ChildReservationId,\n childSubmissionId: SubmissionId,\n}) {}\n\n/**\n * Freezes the final consumed/released accounting decision (spec §12 join step 6). The\n * accounting is an opaque Schema-encoded document replayed from the canonical `SubagentJoined`\n * record (or the deterministic zero-consumed decision for an orphaned reservation), so the\n * decision itself authorizes the transition — no execution owner is required (DUR-015).\n */\nexport class BeginChildBudgetReleaseRequest extends Schema.Class<BeginChildBudgetReleaseRequest>(\n \"@effect-agent/thread/BeginChildBudgetReleaseRequest\",\n)({\n reservationId: ChildReservationId,\n accounting: PersistedJson,\n}) {}\n\n/** Applies the frozen accounting decision: `releasePending → released`, exactly once. */\nexport class ReleaseChildBudgetRequest extends Schema.Class<ReleaseChildBudgetRequest>(\n \"@effect-agent/thread/ReleaseChildBudgetRequest\",\n)({\n reservationId: ChildReservationId,\n}) {}\n\n/**\n * A durable approval decision command (plan §2.6, `abort`-shaped). Field bounds are exactly those\n * of the canonical `ToolApprovalDecided` payload so the intent can become canonical without\n * re-validation.\n */\nexport class ApprovalDecisionCommand extends Schema.Class<ApprovalDecisionCommand>(\n \"@effect-agent/thread/ApprovalDecisionCommand\",\n)({\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n decision: ApprovalDecision,\n resolver: ToolApprovalDecided.fields.resolver,\n reason: ToolApprovalDecided.fields.reason,\n}) {}\n\n/**\n * The recorded approval-decision intent, idempotent per `(submissionId, toolCallId)`.\n * `canonicalRecordId` is present once the corresponding canonical `ToolApprovalDecided` record\n * has been appended (see `toolApprovalDecisionRecordId`).\n */\nexport class ApprovalDecisionIntent extends Schema.Class<ApprovalDecisionIntent>(\n \"@effect-agent/thread/ApprovalDecisionIntent\",\n)({\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n decision: ApprovalDecision,\n resolver: ToolApprovalDecided.fields.resolver,\n reason: ToolApprovalDecided.fields.reason,\n decidedAt: Schema.DateTimeUtcFromString,\n canonicalRecordId: Schema.optionalKey(RecordId),\n}) {}\n\n/**\n * Durable Unknown marking for one Submission's open ordinary Tool Calls (DUR-009): state →\n * `unknown`, parking that Submission without changing its local owner generation. Idempotent.\n */\nexport class MarkUnknownRequest extends Schema.Class<MarkUnknownRequest>(\n \"@effect-agent/thread/MarkUnknownRequest\",\n)({\n submissionId: SubmissionId,\n toolCallIds: Schema.NonEmptyArray(ToolCallId),\n reason: ToolCallUnknown.fields.reason,\n}) {}\n\n/** The recovered supplier truth: the external effect completed with this exact result. */\nexport class ResolutionCompletedWithResult extends Schema.TaggedClass<ResolutionCompletedWithResult>(\n \"@effect-agent/thread/ResolutionCompletedWithResult\",\n)(\"CompletedWithResult\", {\n result: PersistedJson,\n isFailure: Schema.Boolean,\n}) {}\n\n/** The external effect provably never happened; the call may re-execute on resume. */\nexport class ResolutionNeverHappened extends Schema.TaggedClass<ResolutionNeverHappened>(\n \"@effect-agent/thread/ResolutionNeverHappened\",\n)(\"NeverHappened\", {}) {}\n\n/** The call is safe to repeat under the external system's idempotency contract. */\nexport class ResolutionSafeToRetry extends Schema.TaggedClass<ResolutionSafeToRetry>(\n \"@effect-agent/thread/ResolutionSafeToRetry\",\n)(\"SafeToRetry\", {}) {}\n\n/** Give up on the Submission: route into the abort path (unknown calls stay recorded; abort\n * never claims external rollback, durability §13). */\nexport class ResolutionAbortSubmission extends Schema.TaggedClass<ResolutionAbortSubmission>(\n \"@effect-agent/thread/ResolutionAbortSubmission\",\n)(\"AbortSubmission\", {}) {}\n\n/** An authorized execution decision or factual closure for one Unknown Outcome (DUR-017). */\nexport const UnknownResolution = Schema.Union([\n ResolutionCompletedWithResult,\n ResolutionNeverHappened,\n ResolutionSafeToRetry,\n ResolutionAbortSubmission,\n]);\n\nexport type UnknownResolution = typeof UnknownResolution.Type;\n\n/** Execution permission never establishes whether the original external effect happened. */\nexport const UnknownResolutionKind = Schema.Literals([\"execution\", \"factual\"]);\n\nexport type UnknownResolutionKind = typeof UnknownResolutionKind.Type;\n\nexport const unknownResolutionKind = (resolution: UnknownResolution): UnknownResolutionKind =>\n resolution._tag === \"CompletedWithResult\" || resolution._tag === \"NeverHappened\"\n ? \"factual\"\n : \"execution\";\n\n/** A new factual intent cannot replace an already committed Tool result. */\nexport const unknownResolutionMatchesResult = (\n resolution: UnknownResolution,\n result: ToolCallSettled,\n): boolean =>\n resolution._tag === \"CompletedWithResult\" &&\n resolution.isFailure === result.isFailure &&\n canonicalJson(resolution.result) === canonicalJson(result.result);\n\n/**\n * A durable Unknown-Outcome resolution command (DUR-017, `abort`-shaped). Possession of the\n * runtime service plus the mandatory `author`/`reason` audit fields is the Phase 5 authorization\n * boundary — identical to `abort`; the authenticated operator surface is a P7 deliverable.\n * Field bounds are exactly those of the canonical `ToolCallResolved` payload.\n */\nexport class UnknownResolutionCommand extends Schema.Class<UnknownResolutionCommand>(\n \"@effect-agent/thread/UnknownResolutionCommand\",\n)({\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n author: ToolCallResolved.fields.author,\n reason: ToolCallResolved.fields.reason,\n resolution: UnknownResolution,\n}) {}\n\n/**\n * The recorded resolution intent, idempotent per `(submissionId, toolCallId, kind)`. An\n * execution decision remains immutable when later supplier truth closes the original effect;\n * divergent decisions or divergent factual outcomes conflict within their respective kind.\n * New factual outcomes also have to agree with any already committed Tool result.\n * The canonical `ToolCallResolved` (+ `ToolCallSettled` for `CompletedWithResult`) is appended\n * by the recovery pass or the next owning Attempt; `canonicalRecordId` is present once it is.\n */\nexport class UnknownResolutionIntent extends Schema.Class<UnknownResolutionIntent>(\n \"@effect-agent/thread/UnknownResolutionIntent\",\n)({\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n author: ToolCallResolved.fields.author,\n reason: ToolCallResolved.fields.reason,\n resolution: UnknownResolution,\n resolvedAt: Schema.DateTimeUtcFromString,\n canonicalRecordId: Schema.optionalKey(RecordId),\n}) {}\n\nexport class RecoverySnapshotRequest extends Schema.Class<RecoverySnapshotRequest>(\n \"@effect-agent/thread/RecoverySnapshotRequest\",\n)({\n submissionId: SubmissionId,\n}) {}\n\n/** One joined/joining Submission of a host Run, as the host's recovery sees it. */\nexport class JoinSnapshot extends Schema.Class<JoinSnapshot>(\"@effect-agent/thread/JoinSnapshot\")({\n submissionId: SubmissionId,\n state: SubmissionState,\n hostSubmissionId: SubmissionId,\n}) {}\n\n/** A durable suspension as recovery sees it. */\nexport class SuspensionSnapshot extends Schema.Class<SuspensionSnapshot>(\n \"@effect-agent/thread/SuspensionSnapshot\",\n)({\n reason: SuspensionReason,\n suspendedAt: Schema.DateTimeUtcFromString,\n}) {}\n\n/**\n * One attached child of this parent as its recovery sees it: the reservation's recorded child\n * plus that child's current lane state. A disposable derived view — the canonical\n * `SubagentRequested`/`SubagentStarted` records and the child's own canonical Settlement remain\n * the recovery truth (DUR-015).\n */\nexport class ChildAttachmentSnapshot extends Schema.Class<ChildAttachmentSnapshot>(\n \"@effect-agent/thread/ChildAttachmentSnapshot\",\n)({\n toolCallId: ToolCallId,\n childSubmissionId: SubmissionId,\n childState: SubmissionState,\n childOutcome: Schema.optionalKey(SettlementOutcome),\n}) {}\n\n/**\n * Everything the pure recovery classifier needs about one Submission, read strongly consistently\n * (STORE-003). Canonical history still wins over every marker in this snapshot (DUR-015).\n *\n * Phase 5 fields: `joins` is the host-side view (every Submission `joining`/`joined` to this\n * one); `hostSubmissionId` is the joined-side view; `suspension` mirrors the `suspended` state;\n * `approvalDecisions` and `unknownResolutions` are the durable intents recorded against this\n * Submission (empty when none exist).\n *\n * S2 fields: `childReservations`/`childAttachments` are the parent-side subagent view (ordered\n * by parent Tool Call id) and `parentLinkage` is the child-side view. They default to\n * empty/absent at construction so pre-S2 call sites stay valid; adapters always populate them.\n */\nexport class RecoverySnapshot extends Schema.Class<RecoverySnapshot>(\n \"@effect-agent/thread/RecoverySnapshot\",\n)({\n submission: SubmissionSnapshot,\n hasOwner: Schema.Boolean,\n inputApplied: Schema.optionalKey(InputAppliedMarker),\n abortIntent: Schema.optionalKey(AbortIntent),\n joins: Schema.Array(JoinSnapshot),\n hostSubmissionId: Schema.optionalKey(SubmissionId),\n suspension: Schema.optionalKey(SuspensionSnapshot),\n approvalDecisions: Schema.Array(ApprovalDecisionIntent),\n unknownResolutions: Schema.Array(UnknownResolutionIntent),\n childReservations: Schema.Array(ChildBudgetReservationSnapshot).pipe(\n Schema.withConstructorDefault(Effect.succeed([])),\n ),\n childAttachments: Schema.Array(ChildAttachmentSnapshot).pipe(\n Schema.withConstructorDefault(Effect.succeed([])),\n ),\n parentLinkage: Schema.optionalKey(ParentLinkage),\n}) {}\n\n/** The same idempotency key was admitted with different canonical input content. */\nexport class AdmissionConflict extends Schema.TaggedError<AdmissionConflict>()(\n \"AdmissionConflict\",\n {\n threadId: ThreadId,\n principal: Principal,\n idempotencyKey: IdempotencyKey,\n existingInputDigest: Digest,\n attemptedInputDigest: Digest,\n },\n) {}\n\n/**\n * The captured local session has closed or was replaced. Reading current state cannot\n * grant that session authority again.\n */\nexport class OwnershipLost extends Schema.TaggedError<OwnershipLost>()(\"OwnershipLost\", {\n submissionId: SubmissionId,\n}) {}\n\n/** A conflicting terminal outcome was already reserved or finalized (DUR-002, DUR-012). */\nexport class SettlementConflict extends Schema.TaggedError<SettlementConflict>()(\n \"SettlementConflict\",\n {\n submissionId: SubmissionId,\n existingOutcome: SettlementOutcome,\n },\n) {}\n\n/**\n * A divergent approval re-decision for an already-decided `(submissionId, toolCallId)` pair.\n * Repeating the SAME decision replays the recorded intent instead (idempotency).\n */\nexport class ApprovalConflict extends Schema.TaggedError<ApprovalConflict>()(\"ApprovalConflict\", {\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n existingDecision: ApprovalDecision,\n}) {}\n\n/**\n * A resolution contradicts an accepted intent of the same kind or an already committed Tool\n * result (DUR-017). Repeating the SAME accepted resolution replays the recorded intent instead.\n */\nexport class UnknownResolutionConflict extends Schema.TaggedError<UnknownResolutionConflict>()(\n \"UnknownResolutionConflict\",\n {\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n },\n) {}\n\n/**\n * A child budget reservation request contradicts recorded reservation state: a divergent\n * allocation for the same reservation id, a second reservation id for the same parent Tool\n * Call, a divergent child attachment, a divergent accounting freeze, or an out-of-order state\n * transition. `status` reports the existing row's status. Identical replays never conflict.\n */\nexport class ChildReservationConflict extends Schema.TaggedError<ChildReservationConflict>()(\n \"ChildReservationConflict\",\n {\n reservationId: ChildReservationId,\n status: ChildReservationStatus,\n message: Schema.String,\n },\n) {}\n\n/** Adapter-level ledger failure (storage unavailable, unknown submission, corrupt row, ...). */\nexport class LedgerError extends Schema.TaggedError<LedgerError>()(\"LedgerError\", {\n operation: Schema.String,\n message: Schema.String,\n cause: Schema.optionalKey(FailureDiagnostic.Value),\n}) {}\n\nexport type SubmissionLedgerFailure =\n | AdmissionConflict\n | OwnershipLost\n | SettlementConflict\n | ApprovalConflict\n | UnknownResolutionConflict\n | JoinedToHost\n | ChildReservationConflict\n | LedgerError\n | AdmissionPolicyError;\n\n/**\n * Operational durable state for accepted work: admission, FIFO readiness, readiness,\n * abort intent, and settlement obligations (STORE-001). The Thread Log remains the\n * authority for applied input and terminal outcomes; every marker in this ledger can be rebuilt\n * from canonical history (DUR-015).\n *\n * Operation contracts:\n *\n * - `admit` — atomic and idempotent by (threadId, principal, idempotencyKey). A replay\n * with the same `inputDigest` returns the original `AdmissionResult` with `replayed` set; a\n * replay with a different digest fails with `AdmissionConflict`. Admission allocates the\n * Submission's `queueSequence` (FIFO position, DUR-004) and mints `submissionId`/`receiptId`.\n * An optional `parentLinkage` is recorded immutably at first admission (SUB-016); a replay\n * whose linkage diverges (present vs. absent, or different identities) fails with\n * `AdmissionConflict` even when the input digest matches.\n * With `readyIfInitialized`, an adapter may insert a fresh ordinary Submission as ready\n * when it proves Thread initialization under the admission's owner transaction. Readiness,\n * its lifecycle fact and source progress commit with the receipt. Otherwise it returns\n * admitted and the caller completes materialization and `markReady` as usual.\n * - `resolveAdmission` — authoritative tri-state admission lookup by scoped idempotency key\n * (SUB-031): `NotAdmitted` proves absence, `Admitted` carries the full snapshot, and\n * `Indeterminate` states that the adapter cannot currently prove either. Only `NotAdmitted`\n * permits an admission attempt. Single strongly consistent stores derive the answer from a\n * direct lookup and never answer `Indeterminate`.\n * - `markReady` — idempotent transition admitted → ready after Thread materialization.\n * Marking an already-ready (or later-state) Submission is a no-op.\n * - `lookup` — read one Submission by identity or scoped idempotency key; strongly consistent\n * with prior ledger writes.\n * - `selectHead` — selects the lowest eligible unsettled queue position for the storage owner's\n * scoped Run session. The local owner serializes selection and permits only one live session\n * per Thread. Elapsed time never grants a second session. Unknown work without abort intent\n * may be skipped; approval, joining and child-wait barriers remain ordered. An advisory\n * handoff may defer only the named input-applied prefix and must select the exact next\n * runnable Submission. A fresh diagnostic Attempt identity is not persisted ownership.\n * - `markInputApplied` — idempotent marker that the deterministic `UserInputRecorded` record is\n * canonical (state → input-applied). Recovery repairs this marker from history when the append\n * committed but the marker write was lost.\n * - `finalizeSettlement` — idempotent terminal projection (state → settled) from the\n * deterministic canonical SubmissionSettled record. It validates the admitted receipt and\n * retains the first finalization timestamp. Native adapters seal opted-in worker assignments\n * atomically before releasing the lane. Canonical history authorizes finalization; missing or contradictory canonical evidence fails without mutation.\n * - `requestAbort` — durable, idempotent by `submissionId`: repeating returns the recorded\n * intent unchanged (DUR-012). Fails with `SettlementConflict` once the Submission is settled;\n * abort never rewrites a terminal outcome. Fails with `JoinedToHost` for a `joined` Submission\n * — it settles with its host, so the abort target is the host (plan §2.5). Abort of a\n * `joining` Submission records the intent; it is honored only if the host has not consumed the\n * input (revert-then-abort).\n * - `claimJoining` — atomic: transitions the contiguous `ready` prefix of strictly-later\n * `queueSequence`s (up to `maxCount`) to `joining` under the bound host session, recording\n * the host linkage. An\n * `admitted`-not-`ready` row breaks the prefix; an aborted-settled row is a closed obligation\n * and is skipped as a non-gap (P7 §7(c)). Fails with `OwnershipLost` once superseded.\n * - `markJoined` — idempotent `joining → joined` with the canonical input record position;\n * repairable from history when the append committed but the marker write was lost (DUR-016).\n * - `revertJoining` — recovery-only, idempotent `joining → ready`; a no-op when already joined.\n * - `suspend` — `input-applied`/`ready` → `suspended`; ends the ownership period WITHOUT\n * settling (the obligation stays owed, the lane consumes no worker permit). Returns\n * `resume-immediately` when the reason is already fully covered: for `ApprovalPending`,\n * a recorded denial ends the batch or decisions cover every pending call; for\n * `WaitingForChild`, every listed child is already provably settled. Adapters must guarantee\n * that a child settlement reported before\n * the suspend transaction commits is observed by that suspend (single-store adapters derive\n * this from the child's own row; cross-store adapters record a durable notification marker).\n * Fails with `SettlementConflict` once settled.\n * - `recordApprovalDecision` — durable, idempotent per `(submissionId, toolCallId)`: repeating\n * the same decision replays the intent; a divergent re-decision fails with `ApprovalConflict`.\n * Transitions `suspended(ApprovalPending) → input-applied` once every pending call of the\n * suspension reason is decided or one is denied, waking the lane. Fails with\n * `SettlementConflict` once settled.\n * - `recordChildSettled` — idempotent cross-lane wake (spec §12 step 10): transitions\n * `suspended(WaitingForChild) → input-applied` exactly when EVERY listed child is settled,\n * answering `woken`; `still-waiting` while any listed child is unsettled; `not-waiting` when\n * the parent is not suspended waiting on this child (including replays after the wake). The\n * child's canonical Settlement is the authority. The runtime reports it after the exact\n * record is published and before ledger finalization. Adapters verify that canonical record\n * under their mutation authority; an earlier child is an adapter-checked caller error. It never\n * settles the parent; the canonically recorded child settlement authorizes the wake.\n * - `reserveChildBudget` — idempotent get-or-create of the parent-owned child budget\n * reservation (spec §12 step 2), checked by the parent session. An\n * identical administrative replay returns the stored row with `replayed` set;\n * a divergent allocation for the same id, or a second id for the same\n * `(parentSubmissionId, parentToolCallId)`, fails with `ChildReservationConflict`.\n * - `attachChildToReservation` — idempotent: records the admitted child on the reservation row\n * (repairable from the canonical `SubagentStarted` record). A replay with the recorded child\n * is a no-op; the first attach is guarded by the parent session and requires status `reserved`;\n * a divergent child fails with `ChildReservationConflict`.\n * - `beginChildBudgetRelease` — `reserved → releasePending`: freezes the final accounting\n * decision exactly once. Replaying the identical accounting (at `releasePending` or\n * `released`) is a no-op; a divergent accounting fails with `ChildReservationConflict`.\n * The accounting is replayed from the canonical `SubagentJoined`\n * record (or is the deterministic zero-consumed decision for an orphaned reservation), so\n * canonical history authorizes the transition (DUR-015) and the freeze comparison — not a\n * fence — guarantees one decision.\n * - `releaseChildBudget` — `releasePending → released`, applied exactly once; replaying returns\n * the released row unchanged. Releasing a still-`reserved` row (no frozen accounting) fails\n * with `ChildReservationConflict`. \"A crash before release leaves budget unavailable until\n * repair, never available twice\" (spec §12).\n * - `markUnknown` — idempotent, ownership-free (canonical evidence authorizes it): state →\n * `unknown`, parking the Submission while its accepted settlement obligation stays visible.\n * The current session must close before another claim (DUR-009/DUR-017).\n * Fails with `SettlementConflict` once settled.\n * - `recordUnknownResolution` — durable, idempotent per `(submissionId, toolCallId, kind)`;\n * divergent decisions or factual outcomes fail with `UnknownResolutionConflict`. Later\n * factual closure preserves the original execution decision. New execution permission after\n * factual closure conflicts. Before retaining a new factual intent, adapters check the\n * canonical Tool result under the journal's write boundary, even on a nonterminal Run.\n * Transitions `unknown → input-applied` once every open call is\n * covered, waking the lane. Settled lanes accept only factual closure and never reopen.\n * - `scanNonterminal` — streams control-only entries for every Submission whose state is not\n * `settled`, ordered by (threadId, queueSequence); recovery's admission-independent worklist\n * (DUR-014). It must not decode execution payloads. SQL or control-identity corruption fails\n * the scan; selected-Thread payload hydration belongs inside the caller's isolation boundary.\n * - `loadRecoverySnapshot` — strongly consistent full snapshot for the pure recovery classifier.\n *\n * No operation claims exactly-once external side effects; the ledger records decisions\n * exactly once (DUR-003).\n */\nexport class SubmissionLedger extends Context.Service<\n SubmissionLedger,\n {\n readonly capabilities: Effect.Effect<LedgerCapabilities>;\n readonly admit: (\n request: AdmissionRequest,\n options?: { readonly readyIfInitialized?: boolean },\n ) => Effect.Effect<AdmissionResult, AdmissionConflict | AdmissionPolicyError | LedgerError>;\n readonly markReady: (request: MarkReadyRequest) => Effect.Effect<void, LedgerError>;\n readonly lookup: (\n request: SubmissionLookup,\n ) => Effect.Effect<Option.Option<SubmissionSnapshot>, LedgerError>;\n /** Absent adapters fail closed when funding a worker from an explicitly selected input. */\n readonly resolveFundingOwner?: (\n request: FundingOwnerRequest,\n ) => Effect.Effect<FundingOwner, LedgerError>;\n readonly resolveAdmission: (\n request: SubmissionLookupByKey,\n ) => Effect.Effect<AdmissionResolution, LedgerError>;\n readonly selectHead: (\n request: ClaimRequest,\n ) => Effect.Effect<Option.Option<Claim>, LedgerError>;\n readonly markInputApplied: (\n request: MarkInputAppliedRequest,\n ) => Effect.Effect<void, OwnershipLost | LedgerError>;\n readonly finalizeSettlement: (\n request: SettlementFinalization,\n ) => Effect.Effect<Settlement, SettlementConflict | LedgerError>;\n /** Optional for third-party adapters. Remaining ownership must reach zero before stop acknowledgement. */\n readonly inspectWorker?: (threadId: ThreadId) => Effect.Effect<WorkerLedgerState, LedgerError>;\n readonly stopWorker?: (request: WorkerStopCommand) => Effect.Effect<number, LedgerError>;\n readonly requestAbort: (\n request: AbortCommand,\n ) => Effect.Effect<AbortIntent, SettlementConflict | JoinedToHost | LedgerError>;\n /**\n * Strongly consistent lane-local read. Unknown Submissions fail with LedgerError. Canonical\n * proof has the same meaning as in RecoverySnapshot; this read grants no execution authority.\n */\n readonly readAbortIntent: (\n request: AbortIntentRequest,\n ) => Effect.Effect<AbortIntent | undefined, LedgerError>;\n readonly claimJoining: (\n request: ClaimJoiningRequest,\n ) => Effect.Effect<ReadonlyArray<JoiningClaim>, OwnershipLost | LedgerError>;\n readonly markJoined: (\n request: MarkJoinedRequest,\n ) => Effect.Effect<void, OwnershipLost | LedgerError>;\n readonly revertJoining: (request: RevertJoiningRequest) => Effect.Effect<void, LedgerError>;\n readonly suspend: (\n request: SuspendRequest,\n ) => Effect.Effect<SuspensionOutcome, OwnershipLost | SettlementConflict | LedgerError>;\n readonly recordApprovalDecision: (\n command: ApprovalDecisionCommand,\n ) => Effect.Effect<ApprovalDecisionIntent, ApprovalConflict | SettlementConflict | LedgerError>;\n readonly markUnknown: (\n request: MarkUnknownRequest,\n ) => Effect.Effect<void, SettlementConflict | LedgerError>;\n readonly recordUnknownResolution: (\n command: UnknownResolutionCommand,\n ) => Effect.Effect<\n UnknownResolutionIntent,\n UnknownResolutionConflict | SettlementConflict | LedgerError\n >;\n readonly recordChildSettled: (\n request: ChildSettledNotification,\n ) => Effect.Effect<ChildSettledOutcome, LedgerError>;\n readonly reserveChildBudget: (\n request: ChildBudgetReservationRequest,\n ) => Effect.Effect<ReservedChildBudget, ChildReservationConflict | OwnershipLost | LedgerError>;\n readonly attachChildToReservation: (\n request: AttachChildToReservationRequest,\n ) => Effect.Effect<\n ChildBudgetReservationSnapshot,\n ChildReservationConflict | OwnershipLost | LedgerError\n >;\n readonly beginChildBudgetRelease: (\n request: BeginChildBudgetReleaseRequest,\n ) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | LedgerError>;\n readonly releaseChildBudget: (\n request: ReleaseChildBudgetRequest,\n ) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | LedgerError>;\n readonly scanNonterminal: Stream.Stream<SubmissionWorkItem, LedgerError>;\n /** Optional native snapshot for hosts that need the complete control worklist. */\n readonly listNonterminal?: Effect.Effect<ReadonlyArray<SubmissionWorkItem>, LedgerError>;\n readonly loadRecoverySnapshot: (\n request: RecoverySnapshotRequest,\n ) => Effect.Effect<RecoverySnapshot, LedgerError>;\n }\n>()(\"@effect-agent/thread/SubmissionLedger\") {}\n\n// These constructors produce nonempty strings from fixed prefixes or validated nonempty IDs.\n// Keep the canonical Schemas as the validation boundary for incoming and persisted values.\nconst makeBatchId = Brand.nominal<BatchId>();\nconst makeRecordId = Brand.nominal<RecordId>();\nconst makeSettlementId = Brand.nominal<SettlementId>();\n\n/**\n * Deterministic identity rules shared by every adapter and the durable coordinator. The batch\n * carrying one Submission's canonical `UserInputRecorded` record is `submission-input:{sid}` and\n * the record is `input:{sid}`, so batch idempotency (DUR-007) makes the input append\n * exactly-once-canonical across Attempts.\n */\nexport const submissionInputBatchId = (submissionId: SubmissionId): BatchId =>\n makeBatchId(`submission-input:${submissionId}`);\n\n/** Deterministic canonical record identity of one Submission's `UserInputRecorded` record. */\nexport const submissionInputRecordId = (submissionId: SubmissionId): RecordId =>\n makeRecordId(`input:${submissionId}`);\n\n/** Deterministic `SettlementId` for one Submission: `settlement:{sid}`. */\nexport const submissionSettlementId = (submissionId: SubmissionId): SettlementId =>\n makeSettlementId(`settlement:${submissionId}`);\n\n/** Deterministic batch identity of one Submission's canonical `SubmissionSettled` append. */\nexport const submissionSettlementBatchId = (submissionId: SubmissionId): BatchId =>\n makeBatchId(`submission-settlement:${submissionId}`);\n\n/** Deterministic canonical record identity of one Submission's `SubmissionSettled` record. */\nexport const submissionSettlementRecordId = (submissionId: SubmissionId): RecordId =>\n makeRecordId(`settlement:${submissionId}`);\n\n/** Deterministic batch identity of one Submission's canonical `AbortRequested` append. */\nexport const submissionAbortBatchId = (submissionId: SubmissionId): BatchId =>\n makeBatchId(`submission-abort:${submissionId}`);\n\n/** Deterministic canonical record identity of one Submission's `AbortRequested` record. */\nexport const submissionAbortRecordId = (submissionId: SubmissionId): RecordId =>\n makeRecordId(`abort:${submissionId}`);\n\n/** Destination policy, captured when the ledger is acquired. It runs inside fresh admission's\n * serialization after replay lookup. The host must keep it bounded and must not reenter admit.\n * The callback must read authoritative policy in this SAME local transaction, through the\n * acquired SqlClient. Memory evaluates the callback synchronously inside its atomic mutation;\n * an async callback fails with `unavailable/synchronous-memory-policy-required`. Remote reads do not fence remote changes.\n * All policy writers must use that transaction owner. Do not fork, reenter admission, or retain\n * transaction resources. Failure/defect/interruption commits no fresh admission.\n * Current policy never invalidates an exact retained receipt. A supplied fence fails closed\n * unless the destination installed an interpreter for it. */\nexport const SubmissionAdmissionFence = Context.Reference<{\n readonly check: (request: AdmissionRequest) => Effect.Effect<void, AdmissionPolicyError>;\n}>(\"@effect-agent/thread/SubmissionAdmissionFence\", {\n defaultValue: () => ({\n check: (request) =>\n request.admissionFence === undefined\n ? Effect.void\n : AdmissionPolicyError.make({\n reason: \"refused\",\n code: \"unsupported-policy\",\n }),\n }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAa,kBAAkB,OAAO,SAAS;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;AAYD,MAAa,uBAAuB,QAAQ,UAKzC,6CAA6C,EAAE,qBAAqB,CAAC,GAAG,CAAC;;;;;;;;;AAU5E,IAAa,qBAAb,cAAwC,OAAO,MAC7C,yCACF,CAAC,CAAC,EACA,YAAY,OAAO,S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,YAAY,yBAAyB,cAAc;;AAGrD,MAAa,gCAAgC,iBAC3C,aAAa,cAAc,cAAc;;AAG3C,MAAa,0BAA0B,iBACrC,YAAY,oBAAoB,cAAc;;AAGhD,MAAa,2BAA2B,iBACtC,aAAa,SAAS,cAAc;;;;;;;;;;AAWtC,MAAa,2BAA2B,QAAQ,UAE7C,iDAAiD,EAClD,qBAAqB,EACnB,QAAQ,YACN,QAAQ,mBAAmB,KAAA,IACvB,OAAO,OACP,qBAAqB,KAAK;CACxB,QAAQ;CACR,MAAM;AACR,CAAC,EACT,GACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"SubmissionLedger.mjs","names":["FailureDiagnostic.Value"],"sources":["../../src/durable/SubmissionLedger.ts"],"sourcesContent":["import type { Option, Stream } from \"effect\";\nimport { Brand, Context, Effect, Schema } from \"effect\";\n\nimport { InputMessage } from \"../capabilities/Messaging.ts\";\nimport * as FailureDiagnostic from \"../core/FailureDiagnostic.ts\";\nimport {\n AgentId,\n AttemptId,\n ThreadId,\n ReceiptId,\n SettlementId,\n SubmissionId,\n ToolCallId,\n} from \"../core/Identifiers.ts\";\nimport type { JoinedToHost } from \"../core/Receipt.ts\";\nimport { IdempotencyKey, QueueSequence, Principal } from \"../core/Receipt.ts\";\nimport { RunUsageSummary } from \"../core/Usage.ts\";\nimport { AssignmentTerminal } from \"../core/Worker.ts\";\nimport { canonicalJson } from \"./Digest.ts\";\nimport {\n type BatchId,\n type RecordEnvelope,\n AbortRequested,\n ApprovalDecision,\n CanonicalSequence,\n DefinitionDigests,\n DeploymentId,\n Digest,\n PersistedJson,\n RecordId,\n SettlementFailureDiagnostic,\n SettlementOutcome,\n ToolApprovalDecided,\n ToolCallResolved,\n type ToolCallSettled,\n ToolCallUnknown,\n WorkerAdmission,\n} from \"./Records.ts\";\nimport type { AppendRequest, AppendResult, ThreadStoreFailure } from \"./ThreadStore.ts\";\n\nexport { IdempotencyKey, JoinedToHost, QueueSequence, Principal } from \"../core/Receipt.ts\";\n\n/**\n * Ledger lifecycle states for one Submission. `settled` is the only terminal state; every other\n * state carries an outstanding accepted-work obligation (Accepted-work Contract, DUR-002).\n *\n * Phase 5 states:\n *\n * - `joining` — a queued Submission claimed by an active host Run, before its canonical\n * `UserInputRecorded` append; recovery reverts it to `ready` (DUR-016).\n * - `joined` — the input is canonical and linked to its host; the Submission settles WITH the\n * host Run's outcome.\n * - `suspended` — durably waiting for explicit approval decisions; the ownership period has\n * ended and the lane consumes no worker permit while the obligation stays owed.\n * - `unknown` — at least one Tool Call has a durable Unknown Outcome; this Submission is\n * parked until an authorized resolution covers every open call or a durable abort intent\n * authorizes cleanup without Tool replay. Later eligible input may run (DUR-012/DUR-017).\n *\n * `claim` never grants or bypasses a `joining`, `joined`, or `suspended` head. It skips unknown\n * work without an abort intent. Any live ownership in the Thread prevents another claim.\n */\nexport const SubmissionState = Schema.Literals([\n \"admitted\",\n \"ready\",\n \"joining\",\n \"joined\",\n \"input-applied\",\n \"suspended\",\n \"unknown\",\n \"settled\",\n]);\n\nexport type SubmissionState = typeof SubmissionState.Type;\n\n/**\n * Opt-in host policy for handling the next runnable same-Agent input in its own Run at a complete Turn\n * boundary. This never joins inputs or changes their principals, grants, or receipts. The\n * runtime selects the ordered candidate; policy cannot select an arbitrary Submission.\n * Approval waits, child waits and incomplete Tool batches are not handoff boundaries. Hosts\n * retaining independent replies must also leave those inputs unclaimed by `claimJoining`.\n * In-flight model requests and Tool batches run to their existing safe boundary.\n */\nexport const SubmissionScheduling = Context.Reference<{\n readonly yieldTo?: (request: {\n readonly active: SubmissionSnapshot;\n readonly next: SubmissionSnapshot;\n }) => Effect.Effect<boolean, LedgerError>;\n}>(\"@effect-agent/thread/SubmissionScheduling\", { defaultValue: () => ({}) });\n\n/**\n * What a SubmissionLedger adapter claims about itself. `durable-node` asserts single-node\n * process-crash durability (fsync-backed storage); `durable-cloudflare` asserts the same\n * single-serialized-owner crash durability through Durable Object storage output gates;\n * `non-durable` marks reference adapters whose state does not survive the process (in-memory\n * conformance/test adapters). The label is an honest self-description for reports and\n * evidence — no runtime behavior branches on it.\n */\nexport class LedgerCapabilities extends Schema.Class<LedgerCapabilities>(\n \"@effect-agent/thread/LedgerCapabilities\",\n)({\n durability: Schema.Literals([\"durable-node\", \"durable-cloudflare\", \"non-durable\"]),\n}) {}\n\n/**\n * Immutable lineage from a child Submission to the exact parent Tool Call that established it\n * (spec §12 step 5, SUB-004). Recorded once at admission and never rewritten; it is an\n * identifier, not an authorization capability (D10) — the join path verifies the canonical\n * Parent Link records, never this marker alone.\n */\nexport class ParentLinkage extends Schema.Class<ParentLinkage>(\n \"@effect-agent/thread/ParentLinkage\",\n)({\n parentSubmissionId: SubmissionId,\n parentToolCallId: ToolCallId,\n}) {}\n\n/** Host-owned policy coordinates, interpreted only by the destination transaction owner. */\nexport const AdmissionFence = Schema.Struct({\n policyId: Schema.NonEmptyString.check(Schema.isMaxLength(128)),\n key: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n revision: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n});\n\nexport type AdmissionFence = typeof AdmissionFence.Type;\nexport const AdmissionGroup = Schema.NonEmptyString.check(Schema.isMaxLength(256));\n\n/** Fresh admission alone may be refused; unavailability never proves non-admission. */\nexport class AdmissionPolicyError extends Schema.TaggedError<AdmissionPolicyError>()(\n \"AdmissionPolicyError\",\n {\n reason: Schema.Literals([\"refused\", \"unavailable\", \"occupied\"]),\n code: Schema.NonEmptyString.check(Schema.isMaxLength(128)),\n cause: Schema.optionalKey(FailureDiagnostic.Value),\n stack: Schema.optionalKey(Schema.String),\n },\n) {}\n\n/**\n * Durable admission input. `inputDigest` must be the digest of the canonical JSON encoding of\n * `inputPayload` (see `digestJson`); admission idempotency compares digests, never re-encodes.\n * `agentId`/`agentDigests`/`deploymentId` are persisted so recovery can complete Thread\n * materialization without the submitting client. `parentLinkage` is present exactly when the\n * Submission is a durable attached child (spec §12); an admission replay must repeat the same\n * linkage (or its absence) or fail with `AdmissionConflict`.\n */\nexport class AdmissionRequest extends Schema.Class<AdmissionRequest>(\n \"@effect-agent/thread/AdmissionRequest\",\n)({\n threadId: ThreadId,\n principal: Principal,\n idempotencyKey: IdempotencyKey,\n agentId: AgentId,\n agentDigests: DefinitionDigests,\n deploymentId: DeploymentId,\n inputPayload: PersistedJson,\n inputDigest: Digest,\n parentLinkage: Schema.optionalKey(ParentLinkage),\n workerAdmission: Schema.optionalKey(WorkerAdmission),\n messageAdmission: Schema.optionalKey(InputMessage),\n admissionGroup: Schema.optionalKey(AdmissionGroup),\n admissionFence: Schema.optionalKey(AdmissionFence),\n}) {}\n\n/**\n * The committed admission row. `replayed` is true when an identical (thread, principal,\n * idempotencyKey, inputDigest) admission already existed; the original identities are returned\n * unchanged so a client retry resumes rather than duplicates (DUR-001).\n */\nexport class AdmissionResult extends Schema.Class<AdmissionResult>(\n \"@effect-agent/thread/AdmissionResult\",\n)({\n submissionId: SubmissionId,\n receiptId: ReceiptId,\n queueSequence: QueueSequence,\n state: SubmissionState,\n replayed: Schema.Boolean,\n}) {}\n\nexport class MarkReadyRequest extends Schema.Class<MarkReadyRequest>(\n \"@effect-agent/thread/MarkReadyRequest\",\n)({\n submissionId: SubmissionId,\n}) {}\n\nexport class SubmissionLookupById extends Schema.TaggedClass<SubmissionLookupById>(\n \"@effect-agent/thread/SubmissionLookupById\",\n)(\"SubmissionLookupById\", {\n submissionId: SubmissionId,\n}) {}\n\nexport class SubmissionLookupByKey extends Schema.TaggedClass<SubmissionLookupByKey>(\n \"@effect-agent/thread/SubmissionLookupByKey\",\n)(\"SubmissionLookupByKey\", {\n threadId: ThreadId,\n principal: Principal,\n idempotencyKey: IdempotencyKey,\n}) {}\n\n/** Lookup by Submission identity or by the scoped client idempotency key. */\nexport const SubmissionLookup = Schema.Union([SubmissionLookupById, SubmissionLookupByKey]);\n\nexport type SubmissionLookup = typeof SubmissionLookup.Type;\n\n/**\n * Control-only worklist entry. Discovery validates identities, ordering and state without\n * decoding retained execution payloads. Hydrate only the selected Thread through `lookup`\n * or `loadRecoverySnapshot`, inside its recovery failure boundary.\n */\nexport class SubmissionWorkItem extends Schema.Class<SubmissionWorkItem>(\n \"@effect-agent/thread/SubmissionWorkItem\",\n)({\n submissionId: SubmissionId,\n threadId: ThreadId,\n queueSequence: QueueSequence,\n principal: Principal,\n idempotencyKey: IdempotencyKey,\n deploymentId: DeploymentId,\n receiptId: ReceiptId,\n state: SubmissionState,\n}) {}\n\n/** The full durable ledger view of one Submission. */\nexport class SubmissionSnapshot extends Schema.Class<SubmissionSnapshot>(\n \"@effect-agent/thread/SubmissionSnapshot\",\n)({\n ...SubmissionWorkItem.fields,\n agentId: AgentId,\n agentDigests: DefinitionDigests,\n inputPayload: PersistedJson,\n inputDigest: Digest,\n settledOutcome: Schema.optionalKey(SettlementOutcome),\n /** First committed finalization time; paired with settledRecordId by native adapters. */\n settledAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n /** Exact canonical settlement behind the finalized projection; not a substitute for reading it. */\n settledRecordId: Schema.optionalKey(RecordId),\n createdAt: Schema.DateTimeUtcFromString,\n readyAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n admissionGroup: Schema.optionalKey(AdmissionGroup),\n admissionFence: Schema.optionalKey(AdmissionFence),\n parentLinkage: Schema.optionalKey(ParentLinkage),\n workerAdmission: Schema.optionalKey(WorkerAdmission),\n messageAdmission: Schema.optionalKey(InputMessage),\n}) {}\n\n/** Resolve the exact selected input to its immutable host Run without enumerating joins. */\nexport const FundingOwnerRequest = Schema.Struct({\n threadId: ThreadId,\n submissionId: SubmissionId,\n});\n\nexport type FundingOwnerRequest = typeof FundingOwnerRequest.Type;\n\nexport const FundingOwner = Schema.Struct({\n selected: SubmissionSnapshot,\n owner: SubmissionSnapshot,\n});\n\nexport type FundingOwner = typeof FundingOwner.Type;\n\n/** Bounded native control facts. Canonical input/Run records remain ThreadStore-owned. */\nexport const WorkerLedgerState = Schema.Struct({\n latest: Schema.NullOr(SubmissionSnapshot),\n active: Schema.NullOr(SubmissionSnapshot),\n stopped: Schema.Boolean,\n terminal: Schema.optionalKey(AssignmentTerminal),\n}).check(Schema.makeFilter((state) => state.terminal === undefined || state.stopped));\n\nexport type WorkerLedgerState = typeof WorkerLedgerState.Type;\n\n/** The authoritative store proves the scoped idempotency key was never admitted (SUB-031). */\nexport class AdmissionNotAdmitted extends Schema.TaggedClass<AdmissionNotAdmitted>(\n \"@effect-agent/thread/AdmissionNotAdmitted\",\n)(\"NotAdmitted\", {}) {}\n\n/** The scoped idempotency key was admitted; the full Submission snapshot is authoritative. */\nexport class AdmissionAdmitted extends Schema.TaggedClass<AdmissionAdmitted>(\n \"@effect-agent/thread/AdmissionAdmitted\",\n)(\"Admitted\", {\n submission: SubmissionSnapshot,\n}) {}\n\n/**\n * The adapter cannot currently prove admission or its absence (e.g. the authoritative child\n * owner is unreachable on a partitioned platform). Callers wait and retry; an indeterminate\n * answer NEVER permits a second admission attempt (SUB-031).\n */\nexport class AdmissionIndeterminate extends Schema.TaggedClass<AdmissionIndeterminate>(\n \"@effect-agent/thread/AdmissionIndeterminate\",\n)(\"Indeterminate\", {\n reason: Schema.String.check(Schema.isMaxLength(4096)),\n}) {}\n\n/**\n * The tri-state answer of `resolveAdmission` (spec §12: \"absence from an eventually consistent\n * projection is never proof\"). Single strongly consistent stores derive `NotAdmitted`/`Admitted`\n * from a direct lookup; only adapters that can genuinely fail to reach the authoritative owner\n * answer `Indeterminate`.\n */\nexport const AdmissionResolution = Schema.Union([\n AdmissionNotAdmitted,\n AdmissionAdmitted,\n AdmissionIndeterminate,\n]);\n\nexport type AdmissionResolution = typeof AdmissionResolution.Type;\n\n/**\n * A trusted runtime's advisory handoff after committing a complete Turn and closing its\n * Attempt. The owner rechecks the entire deferred prefix and target under its mutation gate.\n * Deferred Runs retain their identities and obligations; losing this hint resumes FIFO.\n */\nexport class ClaimHandoff extends Schema.Class<ClaimHandoff>(\"@effect-agent/thread/ClaimHandoff\")({\n deferredSubmissionIds: Schema.NonEmptyArray(SubmissionId),\n submissionId: SubmissionId,\n}) {}\n\nexport class ClaimRequest extends Schema.Class<ClaimRequest>(\"@effect-agent/thread/ClaimRequest\")({\n threadId: ThreadId,\n handoff: Schema.optionalKey(ClaimHandoff),\n}) {}\n\n/**\n * Selected accepted work. Attempt identity is diagnostic; only the bound scoped session\n * grants execution authority. No field is a portable ownership capability.\n */\nexport class Claim extends Schema.Class<Claim>(\"@effect-agent/thread/Claim\")({\n submissionId: SubmissionId,\n attemptId: AttemptId,\n inputPayload: PersistedJson,\n}) {}\n\n/**\n * The canonical position of the applied `UserInputRecorded` record for one Submission.\n */\nexport class MarkInputAppliedRequest extends Schema.Class<MarkInputAppliedRequest>(\n \"@effect-agent/thread/MarkInputAppliedRequest\",\n)({\n submissionId: SubmissionId,\n recordId: RecordId,\n sequence: CanonicalSequence,\n}) {}\n\nexport class InputAppliedMarker extends Schema.Class<InputAppliedMarker>(\n \"@effect-agent/thread/InputAppliedMarker\",\n)({\n recordId: RecordId,\n sequence: CanonicalSequence,\n}) {}\n\nexport class SettlementFinalization extends Schema.Class<SettlementFinalization>(\n \"@effect-agent/thread/SettlementFinalization\",\n)({\n submissionId: SubmissionId,\n settlementId: SettlementId,\n}) {}\n\nconst SettlementFields = Schema.Struct({\n submissionId: SubmissionId,\n settlementId: SettlementId,\n receiptId: ReceiptId,\n outcome: SettlementOutcome,\n /** Schema-encoded application disposition materialized from the exact canonical settlement. */\n runDisposition: Schema.optionalKey(PersistedJson),\n /** Canonical aggregate of model usage and estimated spend for this Run. */\n usageSummary: Schema.optionalKey(RunUsageSummary),\n /** Present exactly for `failed`; its Schema rejects excess keys before canonical projection. */\n failure: Schema.optionalKey(SettlementFailureDiagnostic),\n settledAt: Schema.DateTimeUtcFromString,\n}).check(\n Schema.makeFilter(\n (settlement) => (settlement.outcome === \"failed\") === (settlement.failure !== undefined),\n { title: \"failure exactly on a failed Settlement\" },\n ),\n);\n\n/** The single durable terminal outcome recorded for one accepted Submission (DUR-002). */\nexport class Settlement extends Schema.Class<Settlement>(\"@effect-agent/thread/Settlement\")(\n SettlementFields,\n) {}\n\n/**\n * Project the bounded failed-settlement diagnostic from an already Schema-validated exact\n * canonical record. Storage adapters use this when materializing their operational Settlement value;\n * the canonical record remains the authority.\n */\nexport const settlementFailureFromRecord = (\n record: RecordEnvelope,\n): SettlementFailureDiagnostic | undefined => {\n const payload = record.payload;\n\n return payload._tag === \"SubmissionSettled\" && payload.outcome === \"failed\"\n ? payload.result\n : undefined;\n};\n\n/**\n * Assignment intent derived only from frozen admission and exact settlement evidence.\n * Joined receipts and cancellation before a Run starts do not finish an assignment.\n * Adapters suppress completed intent when newer accepted input remains unapplied, then\n * install the first seal and outstanding abort intents atomically before releasing the lane.\n */\nexport const workerTerminalFromRecord = (\n submission: SubmissionSnapshot,\n record: RecordEnvelope,\n): AssignmentTerminal | undefined => {\n const payload = record.payload;\n\n if (\n submission.workerAdmission?.origin.lifecycle !== \"assignment\" ||\n payload._tag !== \"SubmissionSettled\" ||\n (payload.runId !== undefined && payload.runId !== `run:${submission.submissionId}`)\n )\n return undefined;\n if (payload.outcome === \"failed\" || payload.finishReason === \"budget-exhausted\") return \"failed\";\n if (payload.outcome === \"aborted\") return payload.runId === undefined ? undefined : \"cancelled\";\n\n return payload.runDisposition === \"completed\" ? \"completed\" : undefined;\n};\n\n/** Destination-owned permanent inbox seal; recorded atomically with all outstanding abort intents. */\nexport const WorkerStopCommand = Schema.Struct({\n threadId: ThreadId,\n author: Principal,\n});\n\nexport type WorkerStopCommand = typeof WorkerStopCommand.Type;\n\n/**\n * A durable abort command (durability §13). Field bounds are exactly those of the canonical\n * `AbortRequested` payload so the intent can become canonical without re-validation.\n */\nexport class AbortCommand extends Schema.Class<AbortCommand>(\"@effect-agent/thread/AbortCommand\")({\n submissionId: SubmissionId,\n author: AbortRequested.fields.author,\n reason: AbortRequested.fields.reason,\n}) {}\n\n/**\n * The recorded abort intent. `canonicalRecordId` is present once the corresponding canonical\n * `AbortRequested` record has been appended (its identity is deterministic; see\n * `submissionAbortRecordId`).\n */\nexport class AbortIntent extends Schema.Class<AbortIntent>(\"@effect-agent/thread/AbortIntent\")({\n submissionId: SubmissionId,\n author: AbortRequested.fields.author,\n reason: AbortRequested.fields.reason,\n requestedAt: Schema.DateTimeUtcFromString,\n canonicalRecordId: Schema.optionalKey(RecordId),\n}) {}\n\n/** Address one lane-local abort intent without loading unrelated recovery state. */\nexport class AbortIntentRequest extends Schema.Class<AbortIntentRequest>(\n \"@effect-agent/thread/AbortIntentRequest\",\n)({ submissionId: SubmissionId }) {}\n\n/**\n * Atomic claim of the contiguous ready prefix of strictly-later queued Submissions for joining\n * into the active host Run (plan §2.5). The bound host session owns the lane. An `admitted`-but-not-`ready` row breaks the prefix;\n * an aborted-settled row is a closed obligation and is skipped as a non-gap (P7 §7(c)).\n */\nexport class ClaimJoiningRequest extends Schema.Class<ClaimJoiningRequest>(\n \"@effect-agent/thread/ClaimJoiningRequest\",\n)({\n threadId: ThreadId,\n hostSubmissionId: SubmissionId,\n maxCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\n/** One queued Submission transitioned to `joining` under the host's ownership. */\nexport class JoiningClaim extends Schema.Class<JoiningClaim>(\"@effect-agent/thread/JoiningClaim\")({\n submissionId: SubmissionId,\n queueSequence: QueueSequence,\n inputPayload: PersistedJson,\n}) {}\n\n/**\n * The canonical position of one joined Submission's `UserInputRecorded` record (`input:{sid}`).\n * Marking transitions `joining → joined` and records the host linkage established at claim time.\n */\nexport class MarkJoinedRequest extends Schema.Class<MarkJoinedRequest>(\n \"@effect-agent/thread/MarkJoinedRequest\",\n)({\n submissionId: SubmissionId,\n recordId: RecordId,\n sequence: CanonicalSequence,\n}) {}\n\n/**\n * Recovery-only revert of a `joining` Submission whose canonical input append never committed\n * (DUR-016): `joining → ready`, idempotent, a no-op when the Submission already joined.\n * A guard limits the revert to the exact linked host: the root gate serializes it with the linked host. A changed host link is a no-op.\n * Adapters validate the guard atomically with the transition. Unguarded requests retain the\n * caller-owned recovery contract.\n */\nexport class RevertJoiningRequest extends Schema.Class<RevertJoiningRequest>(\n \"@effect-agent/thread/RevertJoiningRequest\",\n)({\n submissionId: SubmissionId,\n guard: Schema.optionalKey(\n Schema.Struct({\n hostSubmissionId: SubmissionId,\n }),\n ),\n}) {}\n\n/**\n * Why one Submission is durably suspended. Approval was the only Phase 5 reason; S2 adds\n * `WaitingForChild` (spec §12 step 10) and the union keeps later suspension families (e.g.\n * operator quarantine) additive.\n */\nexport class ApprovalPendingSuspension extends Schema.TaggedClass<ApprovalPendingSuspension>(\n \"@effect-agent/thread/ApprovalPendingSuspension\",\n)(\"ApprovalPending\", {\n toolCallIds: Schema.NonEmptyArray(ToolCallId),\n}) {}\n\n/** A denial ends the batch; otherwise every retained approval must be decided to wake it. */\nexport const approvalDecisionsCover = (\n toolCallIds: ReadonlyArray<ToolCallId>,\n decisionFor: (toolCallId: ToolCallId) => ApprovalDecision | undefined,\n): boolean => {\n let allDecided = true;\n\n for (const toolCallId of toolCallIds) {\n const decision = decisionFor(toolCallId);\n\n if (decision === \"denied\") return true;\n if (decision === undefined) allDecided = false;\n }\n\n return allDecided;\n};\n\n/** One attached child a `waitingForChild` parent is durably waiting on (spec §12 step 10). */\nexport class WaitingChild extends Schema.Class<WaitingChild>(\"@effect-agent/thread/WaitingChild\")({\n toolCallId: ToolCallId,\n childSubmissionId: SubmissionId,\n}) {}\n\n/**\n * The parent Attempt ended without settling because attached durable children must settle and\n * join first (spec §12 step 10, SUB-030). The suspended lane holds no worker permit; each listed\n * child settles on its own Thread lane and `recordChildSettled` wakes the parent once\n * every listed child is settled.\n */\nexport class WaitingForChildSuspension extends Schema.TaggedClass<WaitingForChildSuspension>(\n \"@effect-agent/thread/WaitingForChildSuspension\",\n)(\"WaitingForChild\", {\n children: Schema.NonEmptyArray(WaitingChild),\n}) {}\n\nexport const SuspensionReason = Schema.Union([\n ApprovalPendingSuspension,\n WaitingForChildSuspension,\n]);\n\nexport type SuspensionReason = typeof SuspensionReason.Type;\n\n/**\n * Durable suspension of owned work (plan §2.6): `input-applied`/`ready` → `suspended`, the\n * ownership period ends, NO settlement occurs — the accepted-work obligation stays owed while\n * the lane consumes no worker permit.\n */\nexport class SuspendRequest extends Schema.Class<SuspendRequest>(\n \"@effect-agent/thread/SuspendRequest\",\n)({\n submissionId: SubmissionId,\n reason: SuspensionReason,\n}) {}\n\n/**\n * `suspended` when the lane is now durably waiting; `resume-immediately` when the suspension\n * reason is already fully covered (a covering decision or child settlement raced ahead of the\n * suspend transaction), so the caller resumes without releasing the lane.\n */\nexport const SuspensionOutcome = Schema.Literals([\"suspended\", \"resume-immediately\"]);\n\nexport type SuspensionOutcome = typeof SuspensionOutcome.Type;\n\n/**\n * A durable child-settlement notification for one waitingForChild parent (spec §12 step 10).\n * The child's canonical Settlement is the authority; this command only drives the parent lane's\n * wake transition.\n */\nexport class ChildSettledNotification extends Schema.Class<ChildSettledNotification>(\n \"@effect-agent/thread/ChildSettledNotification\",\n)({\n parentSubmissionId: SubmissionId,\n childSubmissionId: SubmissionId,\n}) {}\n\n/**\n * `woken` when this notification completed the waiting set and the parent transitioned\n * `suspended(WaitingForChild) → input-applied`; `still-waiting` while other listed children are\n * unsettled; `not-waiting` when the parent is not (or no longer) suspended waiting on this\n * child — including replays after a wake, so the operation is idempotent.\n */\nexport const ChildSettledOutcome = Schema.Literals([\"woken\", \"still-waiting\", \"not-waiting\"]);\n\nexport type ChildSettledOutcome = typeof ChildSettledOutcome.Type;\n\n/** Parent-owned child budget reservation identity, deterministically derived by the\n * coordinator from the parent Run and Tool Call identity (spec §12 step 2). */\nexport const ChildReservationId = Schema.NonEmptyString.check(Schema.isMaxLength(256)).pipe(\n Schema.brand(\"@effect-agent/thread/ChildReservationId\"),\n);\n\nexport type ChildReservationId = typeof ChildReservationId.Type;\n\n/**\n * The reservation state machine (spec §12 steps 2 and 6): `reserved` while the child may still\n * consume the allocation, `releasePending` once the final accounting decision is frozen, and\n * `released` after the unused allocation returned exactly once.\n */\nexport const ChildReservationStatus = Schema.Literals([\"reserved\", \"releasePending\", \"released\"]);\n\nexport type ChildReservationStatus = typeof ChildReservationStatus.Type;\n\n/**\n * Creation input for one parent-owned child budget reservation. The allocation is an opaque\n * Schema-encoded budget document (D8: adapters implement transitions only and never interpret\n * budget dimensions); `allocationDigest` must be the digest of its canonical JSON encoding.\n */\nexport class ChildBudgetReservationRequest extends Schema.Class<ChildBudgetReservationRequest>(\n \"@effect-agent/thread/ChildBudgetReservationRequest\",\n)({\n reservationId: ChildReservationId,\n parentSubmissionId: SubmissionId,\n parentToolCallId: ToolCallId,\n allocation: PersistedJson,\n allocationDigest: Digest,\n}) {}\n\n/** One child budget reservation row as the port exposes it. */\nexport class ChildBudgetReservationSnapshot extends Schema.Class<ChildBudgetReservationSnapshot>(\n \"@effect-agent/thread/ChildBudgetReservationSnapshot\",\n)({\n reservationId: ChildReservationId,\n parentSubmissionId: SubmissionId,\n parentToolCallId: ToolCallId,\n childSubmissionId: Schema.optionalKey(SubmissionId),\n status: ChildReservationStatus,\n allocation: PersistedJson,\n allocationDigest: Digest,\n accounting: Schema.optionalKey(PersistedJson),\n reservedAt: Schema.DateTimeUtcFromString,\n releaseBeganAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n releasedAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n}) {}\n\n/**\n * The committed reservation. `replayed` is true when an identical reservation already existed;\n * the stored row is returned unchanged so a recovering caller resumes rather than duplicates\n * (SUB-016).\n */\nexport class ReservedChildBudget extends Schema.Class<ReservedChildBudget>(\n \"@effect-agent/thread/ReservedChildBudget\",\n)({\n reservation: ChildBudgetReservationSnapshot,\n replayed: Schema.Boolean,\n}) {}\n\n/** Records the admitted child on its reservation row (repairable from `SubagentStarted`). */\nexport class AttachChildToReservationRequest extends Schema.Class<AttachChildToReservationRequest>(\n \"@effect-agent/thread/AttachChildToReservationRequest\",\n)({\n reservationId: ChildReservationId,\n childSubmissionId: SubmissionId,\n}) {}\n\n/**\n * Freezes the final consumed/released accounting decision (spec §12 join step 6). The\n * accounting is an opaque Schema-encoded document replayed from the canonical `SubagentJoined`\n * record (or the deterministic zero-consumed decision for an orphaned reservation), so the\n * decision itself authorizes the transition — no execution owner is required (DUR-015).\n */\nexport class BeginChildBudgetReleaseRequest extends Schema.Class<BeginChildBudgetReleaseRequest>(\n \"@effect-agent/thread/BeginChildBudgetReleaseRequest\",\n)({\n reservationId: ChildReservationId,\n accounting: PersistedJson,\n}) {}\n\n/** Applies the frozen accounting decision: `releasePending → released`, exactly once. */\nexport class ReleaseChildBudgetRequest extends Schema.Class<ReleaseChildBudgetRequest>(\n \"@effect-agent/thread/ReleaseChildBudgetRequest\",\n)({\n reservationId: ChildReservationId,\n}) {}\n\n/**\n * A durable approval decision command (plan §2.6, `abort`-shaped). Field bounds are exactly those\n * of the canonical `ToolApprovalDecided` payload so the intent can become canonical without\n * re-validation.\n */\nexport class ApprovalDecisionCommand extends Schema.Class<ApprovalDecisionCommand>(\n \"@effect-agent/thread/ApprovalDecisionCommand\",\n)({\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n decision: ApprovalDecision,\n resolver: ToolApprovalDecided.fields.resolver,\n reason: ToolApprovalDecided.fields.reason,\n}) {}\n\n/**\n * The recorded approval-decision intent, idempotent per `(submissionId, toolCallId)`.\n * `canonicalRecordId` is present once the corresponding canonical `ToolApprovalDecided` record\n * has been appended (see `toolApprovalDecisionRecordId`).\n */\nexport class ApprovalDecisionIntent extends Schema.Class<ApprovalDecisionIntent>(\n \"@effect-agent/thread/ApprovalDecisionIntent\",\n)({\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n decision: ApprovalDecision,\n resolver: ToolApprovalDecided.fields.resolver,\n reason: ToolApprovalDecided.fields.reason,\n decidedAt: Schema.DateTimeUtcFromString,\n canonicalRecordId: Schema.optionalKey(RecordId),\n}) {}\n\n/**\n * Durable Unknown marking for one Submission's open ordinary Tool Calls (DUR-009): state →\n * `unknown`, parking that Submission without changing its local owner generation. Idempotent.\n */\nexport class MarkUnknownRequest extends Schema.Class<MarkUnknownRequest>(\n \"@effect-agent/thread/MarkUnknownRequest\",\n)({\n submissionId: SubmissionId,\n toolCallIds: Schema.NonEmptyArray(ToolCallId),\n reason: ToolCallUnknown.fields.reason,\n}) {}\n\n/** The recovered supplier truth: the external effect completed with this exact result. */\nexport class ResolutionCompletedWithResult extends Schema.TaggedClass<ResolutionCompletedWithResult>(\n \"@effect-agent/thread/ResolutionCompletedWithResult\",\n)(\"CompletedWithResult\", {\n result: PersistedJson,\n isFailure: Schema.Boolean,\n}) {}\n\n/** The external effect provably never happened; the call may re-execute on resume. */\nexport class ResolutionNeverHappened extends Schema.TaggedClass<ResolutionNeverHappened>(\n \"@effect-agent/thread/ResolutionNeverHappened\",\n)(\"NeverHappened\", {}) {}\n\n/** The call is safe to repeat under the external system's idempotency contract. */\nexport class ResolutionSafeToRetry extends Schema.TaggedClass<ResolutionSafeToRetry>(\n \"@effect-agent/thread/ResolutionSafeToRetry\",\n)(\"SafeToRetry\", {}) {}\n\n/** Give up on the Submission: route into the abort path (unknown calls stay recorded; abort\n * never claims external rollback, durability §13). */\nexport class ResolutionAbortSubmission extends Schema.TaggedClass<ResolutionAbortSubmission>(\n \"@effect-agent/thread/ResolutionAbortSubmission\",\n)(\"AbortSubmission\", {}) {}\n\n/** An authorized execution decision or factual closure for one Unknown Outcome (DUR-017). */\nexport const UnknownResolution = Schema.Union([\n ResolutionCompletedWithResult,\n ResolutionNeverHappened,\n ResolutionSafeToRetry,\n ResolutionAbortSubmission,\n]);\n\nexport type UnknownResolution = typeof UnknownResolution.Type;\n\n/** Execution permission never establishes whether the original external effect happened. */\nexport const UnknownResolutionKind = Schema.Literals([\"execution\", \"factual\"]);\n\nexport type UnknownResolutionKind = typeof UnknownResolutionKind.Type;\n\nexport const unknownResolutionKind = (resolution: UnknownResolution): UnknownResolutionKind =>\n resolution._tag === \"CompletedWithResult\" || resolution._tag === \"NeverHappened\"\n ? \"factual\"\n : \"execution\";\n\n/** A new factual intent cannot replace an already committed Tool result. */\nexport const unknownResolutionMatchesResult = (\n resolution: UnknownResolution,\n result: ToolCallSettled,\n): boolean =>\n resolution._tag === \"CompletedWithResult\" &&\n resolution.isFailure === result.isFailure &&\n canonicalJson(resolution.result) === canonicalJson(result.result);\n\n/**\n * A durable Unknown-Outcome resolution command (DUR-017, `abort`-shaped). Possession of the\n * runtime service plus the mandatory `author`/`reason` audit fields is the Phase 5 authorization\n * boundary — identical to `abort`; the authenticated operator surface is a P7 deliverable.\n * Field bounds are exactly those of the canonical `ToolCallResolved` payload.\n */\nexport class UnknownResolutionCommand extends Schema.Class<UnknownResolutionCommand>(\n \"@effect-agent/thread/UnknownResolutionCommand\",\n)({\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n author: ToolCallResolved.fields.author,\n reason: ToolCallResolved.fields.reason,\n resolution: UnknownResolution,\n}) {}\n\n/**\n * The recorded resolution intent, idempotent per `(submissionId, toolCallId, kind)`. An\n * execution decision remains immutable when later supplier truth closes the original effect;\n * divergent decisions or divergent factual outcomes conflict within their respective kind.\n * New factual outcomes also have to agree with any already committed Tool result.\n * The canonical `ToolCallResolved` (+ `ToolCallSettled` for `CompletedWithResult`) is appended\n * by the recovery pass or the next owning Attempt; `canonicalRecordId` is present once it is.\n */\nexport class UnknownResolutionIntent extends Schema.Class<UnknownResolutionIntent>(\n \"@effect-agent/thread/UnknownResolutionIntent\",\n)({\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n author: ToolCallResolved.fields.author,\n reason: ToolCallResolved.fields.reason,\n resolution: UnknownResolution,\n resolvedAt: Schema.DateTimeUtcFromString,\n canonicalRecordId: Schema.optionalKey(RecordId),\n}) {}\n\nexport class RecoverySnapshotRequest extends Schema.Class<RecoverySnapshotRequest>(\n \"@effect-agent/thread/RecoverySnapshotRequest\",\n)({\n submissionId: SubmissionId,\n}) {}\n\n/** One joined/joining Submission of a host Run, as the host's recovery sees it. */\nexport class JoinSnapshot extends Schema.Class<JoinSnapshot>(\"@effect-agent/thread/JoinSnapshot\")({\n submissionId: SubmissionId,\n state: SubmissionState,\n hostSubmissionId: SubmissionId,\n}) {}\n\n/** A durable suspension as recovery sees it. */\nexport class SuspensionSnapshot extends Schema.Class<SuspensionSnapshot>(\n \"@effect-agent/thread/SuspensionSnapshot\",\n)({\n reason: SuspensionReason,\n suspendedAt: Schema.DateTimeUtcFromString,\n}) {}\n\n/**\n * One attached child of this parent as its recovery sees it: the reservation's recorded child\n * plus that child's current lane state. A disposable derived view — the canonical\n * `SubagentRequested`/`SubagentStarted` records and the child's own canonical Settlement remain\n * the recovery truth (DUR-015).\n */\nexport class ChildAttachmentSnapshot extends Schema.Class<ChildAttachmentSnapshot>(\n \"@effect-agent/thread/ChildAttachmentSnapshot\",\n)({\n toolCallId: ToolCallId,\n childSubmissionId: SubmissionId,\n childState: SubmissionState,\n childOutcome: Schema.optionalKey(SettlementOutcome),\n}) {}\n\n/**\n * Everything the pure recovery classifier needs about one Submission, read strongly consistently\n * (STORE-003). Canonical history still wins over every marker in this snapshot (DUR-015).\n *\n * Phase 5 fields: `joins` is the host-side view (every Submission `joining`/`joined` to this\n * one); `hostSubmissionId` is the joined-side view; `suspension` mirrors the `suspended` state;\n * `approvalDecisions` and `unknownResolutions` are the durable intents recorded against this\n * Submission (empty when none exist).\n *\n * S2 fields: `childReservations`/`childAttachments` are the parent-side subagent view (ordered\n * by parent Tool Call id) and `parentLinkage` is the child-side view. They default to\n * empty/absent at construction so pre-S2 call sites stay valid; adapters always populate them.\n */\nexport class RecoverySnapshot extends Schema.Class<RecoverySnapshot>(\n \"@effect-agent/thread/RecoverySnapshot\",\n)({\n submission: SubmissionSnapshot,\n hasOwner: Schema.Boolean,\n inputApplied: Schema.optionalKey(InputAppliedMarker),\n abortIntent: Schema.optionalKey(AbortIntent),\n joins: Schema.Array(JoinSnapshot),\n hostSubmissionId: Schema.optionalKey(SubmissionId),\n suspension: Schema.optionalKey(SuspensionSnapshot),\n approvalDecisions: Schema.Array(ApprovalDecisionIntent),\n unknownResolutions: Schema.Array(UnknownResolutionIntent),\n childReservations: Schema.Array(ChildBudgetReservationSnapshot).pipe(\n Schema.withConstructorDefault(Effect.succeed([])),\n ),\n childAttachments: Schema.Array(ChildAttachmentSnapshot).pipe(\n Schema.withConstructorDefault(Effect.succeed([])),\n ),\n parentLinkage: Schema.optionalKey(ParentLinkage),\n}) {}\n\n/** The same idempotency key was admitted with different canonical input content. */\nexport class AdmissionConflict extends Schema.TaggedError<AdmissionConflict>()(\n \"AdmissionConflict\",\n {\n threadId: ThreadId,\n principal: Principal,\n idempotencyKey: IdempotencyKey,\n existingInputDigest: Digest,\n attemptedInputDigest: Digest,\n },\n) {}\n\n/**\n * The captured local session has closed or was replaced. Reading current state cannot\n * grant that session authority again.\n */\nexport class OwnershipLost extends Schema.TaggedError<OwnershipLost>()(\"OwnershipLost\", {\n submissionId: SubmissionId,\n}) {}\n\n/** A conflicting terminal outcome was already reserved or finalized (DUR-002, DUR-012). */\nexport class SettlementConflict extends Schema.TaggedError<SettlementConflict>()(\n \"SettlementConflict\",\n {\n submissionId: SubmissionId,\n existingOutcome: SettlementOutcome,\n },\n) {}\n\n/**\n * A divergent approval re-decision for an already-decided `(submissionId, toolCallId)` pair.\n * Repeating the SAME decision replays the recorded intent instead (idempotency).\n */\nexport class ApprovalConflict extends Schema.TaggedError<ApprovalConflict>()(\"ApprovalConflict\", {\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n existingDecision: ApprovalDecision,\n}) {}\n\n/**\n * A resolution contradicts an accepted intent of the same kind or an already committed Tool\n * result (DUR-017). Repeating the SAME accepted resolution replays the recorded intent instead.\n */\nexport class UnknownResolutionConflict extends Schema.TaggedError<UnknownResolutionConflict>()(\n \"UnknownResolutionConflict\",\n {\n submissionId: SubmissionId,\n toolCallId: ToolCallId,\n },\n) {}\n\n/**\n * A child budget reservation request contradicts recorded reservation state: a divergent\n * allocation for the same reservation id, a second reservation id for the same parent Tool\n * Call, a divergent child attachment, a divergent accounting freeze, or an out-of-order state\n * transition. `status` reports the existing row's status. Identical replays never conflict.\n */\nexport class ChildReservationConflict extends Schema.TaggedError<ChildReservationConflict>()(\n \"ChildReservationConflict\",\n {\n reservationId: ChildReservationId,\n status: ChildReservationStatus,\n message: Schema.String,\n },\n) {}\n\n/** Adapter-level ledger failure (storage unavailable, unknown submission, corrupt row, ...). */\nexport class LedgerError extends Schema.TaggedError<LedgerError>()(\"LedgerError\", {\n operation: Schema.String,\n message: Schema.String,\n cause: Schema.optionalKey(FailureDiagnostic.Value),\n}) {}\n\nexport type SubmissionLedgerFailure =\n | AdmissionConflict\n | OwnershipLost\n | SettlementConflict\n | ApprovalConflict\n | UnknownResolutionConflict\n | JoinedToHost\n | ChildReservationConflict\n | LedgerError\n | AdmissionPolicyError;\n\n/**\n * Operational durable state for accepted work: admission, FIFO readiness, readiness,\n * abort intent, and settlement obligations (STORE-001). The Thread Log remains the\n * authority for applied input and terminal outcomes; every marker in this ledger can be rebuilt\n * from canonical history (DUR-015).\n *\n * Operation contracts:\n *\n * - `admit` — atomic and idempotent by (threadId, principal, idempotencyKey). A replay\n * with the same `inputDigest` returns the original `AdmissionResult` with `replayed` set; a\n * replay with a different digest fails with `AdmissionConflict`. Admission allocates the\n * Submission's `queueSequence` (FIFO position, DUR-004) and mints `submissionId`/`receiptId`.\n * An optional `parentLinkage` is recorded immutably at first admission (SUB-016); a replay\n * whose linkage diverges (present vs. absent, or different identities) fails with\n * `AdmissionConflict` even when the input digest matches.\n * With `readyIfInitialized`, an adapter may insert a fresh ordinary Submission as ready\n * when it proves Thread initialization under the admission's owner transaction. Readiness,\n * its lifecycle fact and source progress commit with the receipt. Otherwise it returns\n * admitted and the caller completes materialization and `markReady` as usual.\n * - `resolveAdmission` — authoritative tri-state admission lookup by scoped idempotency key\n * (SUB-031): `NotAdmitted` proves absence, `Admitted` carries the full snapshot, and\n * `Indeterminate` states that the adapter cannot currently prove either. Only `NotAdmitted`\n * permits an admission attempt. Single strongly consistent stores derive the answer from a\n * direct lookup and never answer `Indeterminate`.\n * - `markReady` — idempotent transition admitted → ready after Thread materialization.\n * Marking an already-ready (or later-state) Submission is a no-op.\n * - `lookup` — read one Submission by identity or scoped idempotency key; strongly consistent\n * with prior ledger writes.\n * - `selectHead` — selects the lowest eligible unsettled queue position for the storage owner's\n * scoped Run session. The local owner serializes selection and permits only one live session\n * per Thread. Elapsed time never grants a second session. Unknown work without abort intent\n * may be skipped; approval, joining and child-wait barriers remain ordered. An advisory\n * handoff may defer only the named input-applied prefix and must select the exact next\n * runnable Submission. A fresh diagnostic Attempt identity is not persisted ownership.\n * - `markInputApplied` — idempotent marker that the deterministic `UserInputRecorded` record is\n * canonical (state → input-applied). Recovery repairs this marker from history when the append\n * committed but the marker write was lost.\n * - `finalizeSettlement` — idempotent terminal projection (state → settled) from the\n * deterministic canonical SubmissionSettled record. It validates the admitted receipt and\n * retains the first finalization timestamp. Native adapters seal opted-in worker assignments\n * atomically before releasing the lane. Canonical history authorizes finalization; missing or contradictory canonical evidence fails without mutation.\n * - `requestAbort` — durable, idempotent by `submissionId`: repeating returns the recorded\n * intent unchanged (DUR-012). Fails with `SettlementConflict` once the Submission is settled;\n * abort never rewrites a terminal outcome. Fails with `JoinedToHost` for a `joined` Submission\n * — it settles with its host, so the abort target is the host (plan §2.5). Abort of a\n * `joining` Submission records the intent; it is honored only if the host has not consumed the\n * input (revert-then-abort).\n * - `claimJoining` — atomic: transitions the contiguous `ready` prefix of strictly-later\n * `queueSequence`s (up to `maxCount`) to `joining` under the bound host session, recording\n * the host linkage. An\n * `admitted`-not-`ready` row breaks the prefix; an aborted-settled row is a closed obligation\n * and is skipped as a non-gap (P7 §7(c)). Fails with `OwnershipLost` once superseded.\n * - `markJoined` — idempotent `joining → joined` with the canonical input record position;\n * repairable from history when the append committed but the marker write was lost (DUR-016).\n * - `revertJoining` — recovery-only, idempotent `joining → ready`; a no-op when already joined.\n * - `suspend` — `input-applied`/`ready` → `suspended`; ends the ownership period WITHOUT\n * settling (the obligation stays owed, the lane consumes no worker permit). Returns\n * `resume-immediately` when the reason is already fully covered: for `ApprovalPending`,\n * a recorded denial ends the batch or decisions cover every pending call; for\n * `WaitingForChild`, every listed child is already provably settled. Adapters must guarantee\n * that a child settlement reported before\n * the suspend transaction commits is observed by that suspend (single-store adapters derive\n * this from the child's own row; cross-store adapters record a durable notification marker).\n * Fails with `SettlementConflict` once settled.\n * - `recordApprovalDecision` — durable, idempotent per `(submissionId, toolCallId)`: repeating\n * the same decision replays the intent; a divergent re-decision fails with `ApprovalConflict`.\n * Transitions `suspended(ApprovalPending) → input-applied` once every pending call of the\n * suspension reason is decided or one is denied, waking the lane. Fails with\n * `SettlementConflict` once settled.\n * - `recordChildSettled` — idempotent cross-lane wake (spec §12 step 10): transitions\n * `suspended(WaitingForChild) → input-applied` exactly when EVERY listed child is settled,\n * answering `woken`; `still-waiting` while any listed child is unsettled; `not-waiting` when\n * the parent is not suspended waiting on this child (including replays after the wake). The\n * child's canonical Settlement is the authority. The runtime reports it after the exact\n * record is published and before ledger finalization. Adapters verify that canonical record\n * under their mutation authority; an earlier child is an adapter-checked caller error. It never\n * settles the parent; the canonically recorded child settlement authorizes the wake.\n * - `reserveChildBudget` — idempotent get-or-create of the parent-owned child budget\n * reservation (spec §12 step 2), checked by the parent session. An\n * identical administrative replay returns the stored row with `replayed` set;\n * a divergent allocation for the same id, or a second id for the same\n * `(parentSubmissionId, parentToolCallId)`, fails with `ChildReservationConflict`.\n * - `attachChildToReservation` — idempotent: records the admitted child on the reservation row\n * (repairable from the canonical `SubagentStarted` record). A replay with the recorded child\n * is a no-op; the first attach is guarded by the parent session and requires status `reserved`;\n * a divergent child fails with `ChildReservationConflict`.\n * - `beginChildBudgetRelease` — `reserved → releasePending`: freezes the final accounting\n * decision exactly once. Replaying the identical accounting (at `releasePending` or\n * `released`) is a no-op; a divergent accounting fails with `ChildReservationConflict`.\n * The accounting is replayed from the canonical `SubagentJoined`\n * record (or is the deterministic zero-consumed decision for an orphaned reservation), so\n * canonical history authorizes the transition (DUR-015) and the freeze comparison — not a\n * fence — guarantees one decision.\n * - `releaseChildBudget` — `releasePending → released`, applied exactly once; replaying returns\n * the released row unchanged. Releasing a still-`reserved` row (no frozen accounting) fails\n * with `ChildReservationConflict`. \"A crash before release leaves budget unavailable until\n * repair, never available twice\" (spec §12).\n * - `markUnknown` — idempotent, ownership-free (canonical evidence authorizes it): state →\n * `unknown`, parking the Submission while its accepted settlement obligation stays visible.\n * The current session must close before another claim (DUR-009/DUR-017).\n * Fails with `SettlementConflict` once settled.\n * - `recordUnknownResolution` — durable, idempotent per `(submissionId, toolCallId, kind)`;\n * divergent decisions or factual outcomes fail with `UnknownResolutionConflict`. Later\n * factual closure preserves the original execution decision. New execution permission after\n * factual closure conflicts. Before retaining a new factual intent, adapters check the\n * canonical Tool result under the journal's write boundary, even on a nonterminal Run.\n * Transitions `unknown → input-applied` once every open call is\n * covered, waking the lane. Settled lanes accept only factual closure and never reopen.\n * - `scanNonterminal` — streams control-only entries for every Submission whose state is not\n * `settled`, ordered by (threadId, queueSequence); recovery's admission-independent worklist\n * (DUR-014). It must not decode execution payloads. SQL or control-identity corruption fails\n * the scan; selected-Thread payload hydration belongs inside the caller's isolation boundary.\n * - `loadRecoverySnapshot` — strongly consistent full snapshot for the pure recovery classifier.\n *\n * No operation claims exactly-once external side effects; the ledger records decisions\n * exactly once (DUR-003).\n */\nexport class SubmissionLedger extends Context.Service<\n SubmissionLedger,\n {\n readonly capabilities: Effect.Effect<LedgerCapabilities>;\n readonly admit: (\n request: AdmissionRequest,\n options?: { readonly readyIfInitialized?: boolean },\n ) => Effect.Effect<AdmissionResult, AdmissionConflict | AdmissionPolicyError | LedgerError>;\n readonly markReady: (request: MarkReadyRequest) => Effect.Effect<void, LedgerError>;\n readonly lookup: (\n request: SubmissionLookup,\n ) => Effect.Effect<Option.Option<SubmissionSnapshot>, LedgerError>;\n /** Absent adapters fail closed when funding a worker from an explicitly selected input. */\n readonly resolveFundingOwner?: (\n request: FundingOwnerRequest,\n ) => Effect.Effect<FundingOwner, LedgerError>;\n readonly resolveAdmission: (\n request: SubmissionLookupByKey,\n ) => Effect.Effect<AdmissionResolution, LedgerError>;\n readonly selectHead: (\n request: ClaimRequest,\n ) => Effect.Effect<Option.Option<Claim>, LedgerError>;\n /** Atomically publish a captured original input, active context and applied marker.\n * Optional adapters retain the ordinary append-then-repair protocol. The captured input\n * must be this owner's deterministic admission; a moved context boundary is refused. */\n readonly appendInput?: (\n submissionId: SubmissionId,\n request: AppendRequest,\n ) => Effect.Effect<AppendResult, ThreadStoreFailure>;\n readonly markInputApplied: (\n request: MarkInputAppliedRequest,\n ) => Effect.Effect<void, OwnershipLost | LedgerError>;\n readonly finalizeSettlement: (\n request: SettlementFinalization,\n ) => Effect.Effect<Settlement, SettlementConflict | LedgerError>;\n /** Optional for third-party adapters. Remaining ownership must reach zero before stop acknowledgement. */\n readonly inspectWorker?: (threadId: ThreadId) => Effect.Effect<WorkerLedgerState, LedgerError>;\n readonly stopWorker?: (request: WorkerStopCommand) => Effect.Effect<number, LedgerError>;\n readonly requestAbort: (\n request: AbortCommand,\n ) => Effect.Effect<AbortIntent, SettlementConflict | JoinedToHost | LedgerError>;\n /**\n * Strongly consistent lane-local read. Unknown Submissions fail with LedgerError. Canonical\n * proof has the same meaning as in RecoverySnapshot; this read grants no execution authority.\n */\n readonly readAbortIntent: (\n request: AbortIntentRequest,\n ) => Effect.Effect<AbortIntent | undefined, LedgerError>;\n readonly claimJoining: (\n request: ClaimJoiningRequest,\n ) => Effect.Effect<ReadonlyArray<JoiningClaim>, OwnershipLost | LedgerError>;\n readonly markJoined: (\n request: MarkJoinedRequest,\n ) => Effect.Effect<void, OwnershipLost | LedgerError>;\n readonly revertJoining: (request: RevertJoiningRequest) => Effect.Effect<void, LedgerError>;\n readonly suspend: (\n request: SuspendRequest,\n ) => Effect.Effect<SuspensionOutcome, OwnershipLost | SettlementConflict | LedgerError>;\n readonly recordApprovalDecision: (\n command: ApprovalDecisionCommand,\n ) => Effect.Effect<ApprovalDecisionIntent, ApprovalConflict | SettlementConflict | LedgerError>;\n readonly markUnknown: (\n request: MarkUnknownRequest,\n ) => Effect.Effect<void, SettlementConflict | LedgerError>;\n readonly recordUnknownResolution: (\n command: UnknownResolutionCommand,\n ) => Effect.Effect<\n UnknownResolutionIntent,\n UnknownResolutionConflict | SettlementConflict | LedgerError\n >;\n readonly recordChildSettled: (\n request: ChildSettledNotification,\n ) => Effect.Effect<ChildSettledOutcome, LedgerError>;\n readonly reserveChildBudget: (\n request: ChildBudgetReservationRequest,\n ) => Effect.Effect<ReservedChildBudget, ChildReservationConflict | OwnershipLost | LedgerError>;\n readonly attachChildToReservation: (\n request: AttachChildToReservationRequest,\n ) => Effect.Effect<\n ChildBudgetReservationSnapshot,\n ChildReservationConflict | OwnershipLost | LedgerError\n >;\n readonly beginChildBudgetRelease: (\n request: BeginChildBudgetReleaseRequest,\n ) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | LedgerError>;\n readonly releaseChildBudget: (\n request: ReleaseChildBudgetRequest,\n ) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | LedgerError>;\n readonly scanNonterminal: Stream.Stream<SubmissionWorkItem, LedgerError>;\n /** Optional native snapshot for hosts that need the complete control worklist. */\n readonly listNonterminal?: Effect.Effect<ReadonlyArray<SubmissionWorkItem>, LedgerError>;\n readonly loadRecoverySnapshot: (\n request: RecoverySnapshotRequest,\n ) => Effect.Effect<RecoverySnapshot, LedgerError>;\n }\n>()(\"@effect-agent/thread/SubmissionLedger\") {}\n\n// These constructors produce nonempty strings from fixed prefixes or validated nonempty IDs.\n// Keep the canonical Schemas as the validation boundary for incoming and persisted values.\nconst makeBatchId = Brand.nominal<BatchId>();\nconst makeRecordId = Brand.nominal<RecordId>();\nconst makeSettlementId = Brand.nominal<SettlementId>();\n\n/**\n * Deterministic identity rules shared by every adapter and the durable coordinator. The batch\n * carrying one Submission's canonical `UserInputRecorded` record is `submission-input:{sid}` and\n * the record is `input:{sid}`, so batch idempotency (DUR-007) makes the input append\n * exactly-once-canonical across Attempts.\n */\nexport const submissionInputBatchId = (submissionId: SubmissionId): BatchId =>\n makeBatchId(`submission-input:${submissionId}`);\n\n/** Deterministic canonical record identity of one Submission's `UserInputRecorded` record. */\nexport const submissionInputRecordId = (submissionId: SubmissionId): RecordId =>\n makeRecordId(`input:${submissionId}`);\n\n/** Deterministic `SettlementId` for one Submission: `settlement:{sid}`. */\nexport const submissionSettlementId = (submissionId: SubmissionId): SettlementId =>\n makeSettlementId(`settlement:${submissionId}`);\n\n/** Deterministic batch identity of one Submission's canonical `SubmissionSettled` append. */\nexport const submissionSettlementBatchId = (submissionId: SubmissionId): BatchId =>\n makeBatchId(`submission-settlement:${submissionId}`);\n\n/** Deterministic canonical record identity of one Submission's `SubmissionSettled` record. */\nexport const submissionSettlementRecordId = (submissionId: SubmissionId): RecordId =>\n makeRecordId(`settlement:${submissionId}`);\n\n/** Deterministic batch identity of one Submission's canonical `AbortRequested` append. */\nexport const submissionAbortBatchId = (submissionId: SubmissionId): BatchId =>\n makeBatchId(`submission-abort:${submissionId}`);\n\n/** Deterministic canonical record identity of one Submission's `AbortRequested` record. */\nexport const submissionAbortRecordId = (submissionId: SubmissionId): RecordId =>\n makeRecordId(`abort:${submissionId}`);\n\n/** Destination policy, captured when the ledger is acquired. It runs inside fresh admission's\n * serialization after replay lookup. The host must keep it bounded and must not reenter admit.\n * The callback must read authoritative policy in this SAME local transaction, through the\n * acquired SqlClient. Memory evaluates the callback synchronously inside its atomic mutation;\n * an async callback fails with `unavailable/synchronous-memory-policy-required`. Remote reads do not fence remote changes.\n * All policy writers must use that transaction owner. Do not fork, reenter admission, or retain\n * transaction resources. Failure/defect/interruption commits no fresh admission.\n * Current policy never invalidates an exact retained receipt. A supplied fence fails closed\n * unless the destination installed an interpreter for it. */\nexport const SubmissionAdmissionFence = Context.Reference<{\n readonly check: (request: AdmissionRequest) => Effect.Effect<void, AdmissionPolicyError>;\n}>(\"@effect-agent/thread/SubmissionAdmissionFence\", {\n defaultValue: () => ({\n check: (request) =>\n request.admissionFence === undefined\n ? Effect.void\n : AdmissionPolicyError.make({\n reason: \"refused\",\n code: \"unsupported-policy\",\n }),\n }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAa,kBAAkB,OAAO,SAAS;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;AAYD,MAAa,uBAAuB,QAAQ,UAKzC,6CAA6C,EAAE,qBAAqB,CAAC,GAAG,CAAC;;;;;;;;;AAU5E,IAAa,qBAAb,cAAwC,OAAO,MAC7C,yCACF,CAAC,CAAC,EACA,YAAY,OAAO,SAAS;CAAC;CAAgB;CAAsB;AAAa,CAAC,EACnF,CAAC,CAAC,CAAC,CAAC;;;;;;;AAQJ,IAAa,gBAAb,cAAmC,OAAO,MACxC,oCACF,CAAC,CAAC;CACA,oBAAoB;CACpB,kBAAkB;AACpB,CAAC,CAAC,CAAC,CAAC;;AAGJ,MAAa,iBAAiB,OAAO,OAAO;CAC1C,UAAU,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;CAC7D,KAAK,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;CACxD,UAAU,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;AAC/D,CAAC;AAGD,MAAa,iBAAiB,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;;AAGjF,IAAa,uBAAb,cAA0C,OAAO,YAAkC,CAAC,CAClF,wBACA;CACE,QAAQ,OAAO,SAAS;EAAC;EAAW;EAAe;CAAU,CAAC;CAC9D,MAAM,OAAO,eAAe,MAAM,OAAO,YAA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Ae;CAChF,WAAW,OAAO;CAClB,SAAS,OAAO;CAChB,OAAO,OAAO,YAAYA,KAAuB;AACnD,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIJ,IAAa,mBAAb,cAAsC,QAAQ,QA+F5C,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC;AAI9C,MAAM,cAAc,MAAM,QAAiB;AAC3C,MAAM,eAAe,MAAM,QAAkB;AAC7C,MAAM,mBAAmB,MAAM,QAAsB;;;;;;;AAQrD,MAAa,0BAA0B,iBACrC,YAAY,oBAAoB,cAAc;;AAGhD,MAAa,2BAA2B,iBACtC,aAAa,SAAS,cAAc;;AAGtC,MAAa,0BAA0B,iBACrC,iBAAiB,cAAc,cAAc;;AAG/C,MAAa,+BAA+B,iBAC1C,YAAY,yBAAyB,cAAc;;AAGrD,MAAa,gCAAgC,iBAC3C,aAAa,cAAc,cAAc;;AAG3C,MAAa,0BAA0B,iBACrC,YAAY,oBAAoB,cAAc;;AAGhD,MAAa,2BAA2B,iBACtC,aAAa,SAAS,cAAc;;;;;;;;;;AAWtC,MAAa,2BAA2B,QAAQ,UAE7C,iDAAiD,EAClD,qBAAqB,EACnB,QAAQ,YACN,QAAQ,mBAAmB,KAAA,IACvB,OAAO,OACP,qBAAqB,KAAK;CACxB,QAAQ;CACR,MAAM;AACR,CAAC,EACT,GACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as DigestError } from "../Digest-DjUgS5PG.mjs";
|
|
2
|
-
import { Hr as SettlementPublicationFailure, Ui as ThreadStore, Wr as SettlementPublisher, dn as SubmissionLedger, fn as SubmissionLedgerFailure, yo as StorageOwner } from "../Admin-
|
|
2
|
+
import { Hr as SettlementPublicationFailure, Ui as ThreadStore, Wr as SettlementPublisher, dn as SubmissionLedger, fn as SubmissionLedgerFailure, yo as StorageOwner } from "../Admin-DTDihBra.mjs";
|
|
3
3
|
import { Crypto, Effect, Schema } from "effect";
|
|
4
4
|
//#region src/durable/SubmissionLedgerConformance.d.ts
|
|
5
5
|
declare const SubmissionLedgerConformanceViolation_base: Schema.Class<SubmissionLedgerConformanceViolation, Schema.TaggedStruct<"SubmissionLedgerConformanceViolation", {
|
|
@@ -7,9 +7,9 @@ import { d as MessageAdmission, l as InputMessage } from "../MessagingHost-CZCyr
|
|
|
7
7
|
import { U as PersistedJson, W as ProducerId, X as RecordEnvelope, _t as SubmissionSettledRecord, b as Digest, c as CanonicalBatch, f as CanonicalSequence, gt as SubmissionSettled, jt as WorkerAdmission, v as DefinitionDigests, y as DeploymentId } from "../Records-DzL4Kbtw.mjs";
|
|
8
8
|
import { s as digestJson } from "../Digest-C3EODOee.mjs";
|
|
9
9
|
import { AbortCommand, AbortIntentRequest, AdmissionConflict, AdmissionPolicyError, AdmissionRequest, ApprovalConflict, ApprovalDecisionCommand, ApprovalPendingSuspension, BeginChildBudgetReleaseRequest, ChildBudgetReservationRequest, ChildReservationConflict, ChildReservationId, ChildSettledNotification, ClaimHandoff, ClaimRequest, LedgerError, MarkInputAppliedRequest, MarkJoinedRequest, MarkReadyRequest, MarkUnknownRequest, OwnershipLost, ParentLinkage, RecoverySnapshotRequest, ReleaseChildBudgetRequest, ResolutionCompletedWithResult, ResolutionNeverHappened, ResolutionSafeToRetry, RevertJoiningRequest, Settlement, SettlementConflict, SettlementFinalization, SubmissionLedger, SubmissionLookupById, SubmissionLookupByKey, SuspendRequest, UnknownResolutionCommand, UnknownResolutionConflict, WaitingChild, WaitingForChildSuspension, submissionInputRecordId, submissionSettlementBatchId, submissionSettlementId, submissionSettlementRecordId } from "./SubmissionLedger.mjs";
|
|
10
|
-
import { S as runIdForSubmission } from "../RunJournal-
|
|
11
|
-
import { $ as ThreadTailRequest, I as ThreadMaterialization, J as ThreadStore, U as ThreadReader, n as AppendRequest, ot as getRecord } from "../ThreadStore-
|
|
12
|
-
import { a as make } from "../RunStorage-
|
|
10
|
+
import { S as runIdForSubmission } from "../RunJournal-DGblbFas.mjs";
|
|
11
|
+
import { $ as ThreadTailRequest, I as ThreadMaterialization, J as ThreadStore, U as ThreadReader, n as AppendRequest, ot as getRecord } from "../ThreadStore-BC4V-mY-.mjs";
|
|
12
|
+
import { a as make } from "../RunStorage-BF2YgWkg.mjs";
|
|
13
13
|
import { SettlementPublication, SettlementPublisher } from "./SettlementPublisher.mjs";
|
|
14
14
|
import { DateTime, Duration, Effect, Exit, Option, Result, Schema, Scope, Stream } from "effect";
|
|
15
15
|
import { TestClock } from "effect/testing";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Dr as PendingSubmission, Or as SettledSubmission, kr as SubmissionStatus } from "../Admin-
|
|
1
|
+
import { Dr as PendingSubmission, Or as SettledSubmission, kr as SubmissionStatus } from "../Admin-DTDihBra.mjs";
|
|
2
2
|
export { PendingSubmission, SettledSubmission, SubmissionStatus };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as defaultSubscriptionLimits, C as SubscriptionScanCursors, D as SubscriptionStore, E as SubscriptionSourceError, M as subscriptionKeyString, O as SubscriptionStoreFailure, S as SubscriptionRetentionPolicy, T as SubscriptionSnapshot, _ as SubscriptionKey, a as PreparedInput, b as SubscriptionRecord, c as SubscriptionAuthorizer, d as SubscriptionDelivery, f as SubscriptionDeliveryKey, g as SubscriptionFailpointError, h as SubscriptionFailpoint, i as EventSourceVersion, j as subscriptionDeliveryKeyString, l as SubscriptionChange, m as SubscriptionError, n as DeliveryChange, o as SourcePartition, p as SubscriptionDeliverySnapshot, r as EventAcknowledgement, s as SourceRecovery, t as AcceptedEvent, u as SubscriptionConfiguration, v as SubscriptionLimits, w as SubscriptionScope, x as SubscriptionRefusal, y as SubscriptionName } from "../Subscription-
|
|
1
|
+
import { A as defaultSubscriptionLimits, C as SubscriptionScanCursors, D as SubscriptionStore, E as SubscriptionSourceError, M as subscriptionKeyString, O as SubscriptionStoreFailure, S as SubscriptionRetentionPolicy, T as SubscriptionSnapshot, _ as SubscriptionKey, a as PreparedInput, b as SubscriptionRecord, c as SubscriptionAuthorizer, d as SubscriptionDelivery, f as SubscriptionDeliveryKey, g as SubscriptionFailpointError, h as SubscriptionFailpoint, i as EventSourceVersion, j as subscriptionDeliveryKeyString, l as SubscriptionChange, m as SubscriptionError, n as DeliveryChange, o as SourcePartition, p as SubscriptionDeliverySnapshot, r as EventAcknowledgement, s as SourceRecovery, t as AcceptedEvent, u as SubscriptionConfiguration, v as SubscriptionLimits, w as SubscriptionScope, x as SubscriptionRefusal, y as SubscriptionName } from "../Subscription-DuC_PcGx.mjs";
|
|
2
2
|
export { AcceptedEvent, DeliveryChange, EventAcknowledgement, EventSourceVersion, PreparedInput, SourcePartition, SourceRecovery, SubscriptionAuthorizer, SubscriptionChange, SubscriptionConfiguration, SubscriptionDelivery, SubscriptionDeliveryKey, SubscriptionDeliverySnapshot, SubscriptionError, SubscriptionFailpoint, SubscriptionFailpointError, SubscriptionKey, SubscriptionLimits, SubscriptionName, SubscriptionRecord, SubscriptionRefusal, SubscriptionRetentionPolicy, SubscriptionScanCursors, SubscriptionScope, SubscriptionSnapshot, SubscriptionSourceError, SubscriptionStore, SubscriptionStoreFailure, defaultSubscriptionLimits, subscriptionDeliveryKeyString, subscriptionKeyString };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveSubscriptionInput, i as makeSubscriptionInputBinding, n as SubscriptionInputBindings, t as SubscriptionInputBinding } from "../SubscriptionInput-
|
|
1
|
+
import { a as resolveSubscriptionInput, i as makeSubscriptionInputBinding, n as SubscriptionInputBindings, t as SubscriptionInputBinding } from "../SubscriptionInput-B1IeAEDi.mjs";
|
|
2
2
|
export { SubscriptionInputBinding, SubscriptionInputBindings, makeSubscriptionInputBinding, resolveSubscriptionInput };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as SubscriptionStore, O as SubscriptionStoreFailure, o as SourcePartition } from "../Subscription-
|
|
1
|
+
import { D as SubscriptionStore, O as SubscriptionStoreFailure, o as SourcePartition } from "../Subscription-DuC_PcGx.mjs";
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
3
|
//#region src/durable/SubscriptionStoreConformance.d.ts
|
|
4
4
|
declare const SubscriptionStoreConformanceViolation_base: Schema.Class<SubscriptionStoreConformanceViolation, Schema.TaggedStruct<"SubscriptionStoreConformanceViolation", {
|
|
@@ -2,9 +2,9 @@ import { t as AgentId, u as ThreadId } from "../Identifiers-CN2s30fF.mjs";
|
|
|
2
2
|
import { r as Principal } from "../Receipt-BkM21Qiu.mjs";
|
|
3
3
|
import { t as DurableStep } from "../DurableStep-DXGn7KQ4.mjs";
|
|
4
4
|
import { b as DefinitionDigests } from "../Records-BTnGRdcf.mjs";
|
|
5
|
-
import "../Admin-
|
|
5
|
+
import "../Admin-DTDihBra.mjs";
|
|
6
6
|
import { c as ScheduleDestination } from "../Schedule-CDgTz0vj.mjs";
|
|
7
|
-
import { E as SubscriptionSourceError, g as SubscriptionFailpointError, i as EventSourceVersion, m as SubscriptionError, w as SubscriptionScope } from "../Subscription-
|
|
7
|
+
import { E as SubscriptionSourceError, g as SubscriptionFailpointError, i as EventSourceVersion, m as SubscriptionError, w as SubscriptionScope } from "../Subscription-DuC_PcGx.mjs";
|
|
8
8
|
import { Subscriptions } from "./Subscriptions.mjs";
|
|
9
9
|
import { Crypto, Layer, Schema } from "effect";
|
|
10
10
|
import { Tool, Toolkit } from "effect/ai";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as SubscriptionRecord, d as SubscriptionDelivery, l as SubscriptionChange, m as SubscriptionError, n as DeliveryChange, o as SourcePartition, t as AcceptedEvent, v as SubscriptionLimits } from "../Subscription-
|
|
1
|
+
import { b as SubscriptionRecord, d as SubscriptionDelivery, l as SubscriptionChange, m as SubscriptionError, n as DeliveryChange, o as SourcePartition, t as AcceptedEvent, v as SubscriptionLimits } from "../Subscription-DuC_PcGx.mjs";
|
|
2
2
|
import { Result } from "effect";
|
|
3
3
|
declare namespace SubscriptionTransition_d_exports {
|
|
4
4
|
export { applySubscriptionChange, applySubscriptionDeliveryChange, sameAcceptedEventIdentity, sameSourcePartition, sameSubscriptionDelivery, subscriptionCanSelect, subscriptionDeliveryCanSelect, subscriptionDeliveryUsesCapacity, subscriptionMatchesEvent, subscriptionUsesCapacity, validateEventRetention };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as Principal } from "../Receipt-BkM21Qiu.mjs";
|
|
2
2
|
import { K as PersistedJson } from "../Records-BTnGRdcf.mjs";
|
|
3
|
-
import { pt as AdmissionFence } from "../Admin-
|
|
4
|
-
import { D as SubscriptionStore, E as SubscriptionSourceError, O as SubscriptionStoreFailure, T as SubscriptionSnapshot, _ as SubscriptionKey, c as SubscriptionAuthorizer, f as SubscriptionDeliveryKey, i as EventSourceVersion, m as SubscriptionError, p as SubscriptionDeliverySnapshot, r as EventAcknowledgement, u as SubscriptionConfiguration, v as SubscriptionLimits, w as SubscriptionScope } from "../Subscription-
|
|
5
|
-
import { r as EventSources } from "../EventSource-
|
|
6
|
-
import { t as PreparedInputAdmission } from "../PreparedInputAdmission-
|
|
7
|
-
import { n as SubscriptionInputBindings } from "../SubscriptionInput-
|
|
3
|
+
import { pt as AdmissionFence } from "../Admin-DTDihBra.mjs";
|
|
4
|
+
import { D as SubscriptionStore, E as SubscriptionSourceError, O as SubscriptionStoreFailure, T as SubscriptionSnapshot, _ as SubscriptionKey, c as SubscriptionAuthorizer, f as SubscriptionDeliveryKey, i as EventSourceVersion, m as SubscriptionError, p as SubscriptionDeliverySnapshot, r as EventAcknowledgement, u as SubscriptionConfiguration, v as SubscriptionLimits, w as SubscriptionScope } from "../Subscription-DuC_PcGx.mjs";
|
|
5
|
+
import { r as EventSources } from "../EventSource-Cc58uEso.mjs";
|
|
6
|
+
import { t as PreparedInputAdmission } from "../PreparedInputAdmission-CjcX1OP0.mjs";
|
|
7
|
+
import { n as SubscriptionInputBindings } from "../SubscriptionInput-B1IeAEDi.mjs";
|
|
8
8
|
import { Context, Crypto, Effect, Layer } from "effect";
|
|
9
9
|
declare namespace Subscriptions_d_exports {
|
|
10
10
|
export { SubscribeOptions, SubscriptionDriver, SubscriptionFailure, SubscriptionIntake, Subscriptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $a as ThreadArchiveRangeRead, Ja as MAX_ARCHIVE_RANGE_RECORDS, Ka as MAX_ARCHIVE_RANGE_BYTES, Qa as ThreadArchiveRangePublish, Xa as ThreadArchiveRange, Ya as MAX_CANONICAL_BATCH_BYTES, Za as ThreadArchiveRangePage, eo as ThreadArchiveRangeRequest, qa as MAX_ARCHIVE_RANGE_PAGE, ro as ThreadArchiveStorage, to as ThreadArchiveRangeSeal } from "../Admin-
|
|
1
|
+
import { $a as ThreadArchiveRangeRead, Ja as MAX_ARCHIVE_RANGE_RECORDS, Ka as MAX_ARCHIVE_RANGE_BYTES, Qa as ThreadArchiveRangePublish, Xa as ThreadArchiveRange, Ya as MAX_CANONICAL_BATCH_BYTES, Za as ThreadArchiveRangePage, eo as ThreadArchiveRangeRequest, qa as MAX_ARCHIVE_RANGE_PAGE, ro as ThreadArchiveStorage, to as ThreadArchiveRangeSeal } from "../Admin-DTDihBra.mjs";
|
|
2
2
|
export { MAX_ARCHIVE_RANGE_BYTES, MAX_ARCHIVE_RANGE_PAGE, MAX_ARCHIVE_RANGE_RECORDS, MAX_CANONICAL_BATCH_BYTES, ThreadArchiveRange, ThreadArchiveRangePage, ThreadArchiveRangePublish, ThreadArchiveRangeRead, ThreadArchiveRangeRequest, ThreadArchiveRangeSeal, ThreadArchiveStorage };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContextHistory, ContextHistoryError } from "../engine/ContextHistory.mjs";
|
|
2
|
-
import { Ui as ThreadStore } from "../Admin-
|
|
2
|
+
import { Ui as ThreadStore } from "../Admin-DTDihBra.mjs";
|
|
3
3
|
import { Layer, Schema } from "effect";
|
|
4
4
|
declare namespace ThreadContextHistory_d_exports {
|
|
5
5
|
export { ThreadContextHistoryOptions, layer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { ContextHistory, ContextHistoryError, ContextHistoryHit, ContextHistoryPage, ContextHistoryRead, ContextHistorySearch } from "../engine/ContextHistory.mjs";
|
|
3
3
|
import { Z as RecordId, f as CanonicalSequence, u as CanonicalRecordEnvelope } from "../Records-DzL4Kbtw.mjs";
|
|
4
|
-
import { $ as ThreadTailRequest, J as ThreadStore, Q as ThreadTail, V as ThreadRead, b as SelectedThreadRead } from "../ThreadStore-
|
|
4
|
+
import { $ as ThreadTailRequest, J as ThreadStore, Q as ThreadTail, V as ThreadRead, b as SelectedThreadRead } from "../ThreadStore-BC4V-mY-.mjs";
|
|
5
5
|
import { matchText, normalizeQuery, project, windowIdFor } from "./ThreadContextHistoryProjection.mjs";
|
|
6
6
|
import { Effect, Layer, Schema, Stream } from "effect";
|
|
7
7
|
//#region src/durable/ThreadContextHistory.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as ThreadDeliveryImportReader, S as verifyImportedReferences, _ as reencodeThread, a as ThreadImport, b as validateImportedRunExecution, c as ThreadImportResult, d as finishThreadImport, f as invalidThreadArchive, g as rebuildImportedSubmission, h as rebuildClosedSubmission, i as ThreadArchive, m as prepareImportPage, n as PreparedImportPage, o as ThreadImportProgress, p as makeThreadImportProgress, r as RebuiltSubmission, s as ThreadImportRejected, t as PreparedImportBatch, u as captureImportSource, v as validateClosedRun, w as ThreadImportReader, x as verifyImportedInputOrder, y as validateImportedExecution } from "../ThreadImport-
|
|
1
|
+
import { C as ThreadDeliveryImportReader, S as verifyImportedReferences, _ as reencodeThread, a as ThreadImport, b as validateImportedRunExecution, c as ThreadImportResult, d as finishThreadImport, f as invalidThreadArchive, g as rebuildImportedSubmission, h as rebuildClosedSubmission, i as ThreadArchive, m as prepareImportPage, n as PreparedImportPage, o as ThreadImportProgress, p as makeThreadImportProgress, r as RebuiltSubmission, s as ThreadImportRejected, t as PreparedImportBatch, u as captureImportSource, v as validateClosedRun, w as ThreadImportReader, x as verifyImportedInputOrder, y as validateImportedExecution } from "../ThreadImport-D_Biid6w.mjs";
|
|
2
2
|
export { PreparedImportBatch, PreparedImportPage, RebuiltSubmission, ThreadArchive, ThreadDeliveryImportReader, ThreadImport, ThreadImportProgress, ThreadImportReader, ThreadImportRejected, ThreadImportResult, captureImportSource, finishThreadImport, invalidThreadArchive, makeThreadImportProgress, prepareImportPage, rebuildClosedSubmission, rebuildImportedSubmission, reencodeThread, validateClosedRun, validateImportedExecution, validateImportedRunExecution, verifyImportedInputOrder, verifyImportedReferences };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as validateImportedRunExecution, a as ThreadImportResult, b as ThreadDeliveryImportReader, c as finishThreadImport, d as prepareImportPage, f as rebuildClosedSubmission, g as validateImportedExecution, h as validateClosedRun, i as ThreadImportRejected, l as invalidThreadArchive, m as reencodeThread, n as ThreadArchive, p as rebuildImportedSubmission, r as ThreadImport, s as captureImportSource, t as RebuiltSubmission, u as makeThreadImportProgress, v as verifyImportedInputOrder, x as ThreadImportReader, y as verifyImportedReferences } from "../ThreadImport-
|
|
1
|
+
import { _ as validateImportedRunExecution, a as ThreadImportResult, b as ThreadDeliveryImportReader, c as finishThreadImport, d as prepareImportPage, f as rebuildClosedSubmission, g as validateImportedExecution, h as validateClosedRun, i as ThreadImportRejected, l as invalidThreadArchive, m as reencodeThread, n as ThreadArchive, p as rebuildImportedSubmission, r as ThreadImport, s as captureImportSource, t as RebuiltSubmission, u as makeThreadImportProgress, v as verifyImportedInputOrder, x as ThreadImportReader, y as verifyImportedReferences } from "../ThreadImport-ZgWxf7bB.mjs";
|
|
2
2
|
export { RebuiltSubmission, ThreadArchive, ThreadDeliveryImportReader, ThreadImport, ThreadImportReader, ThreadImportRejected, ThreadImportResult, captureImportSource, finishThreadImport, invalidThreadArchive, makeThreadImportProgress, prepareImportPage, rebuildClosedSubmission, rebuildImportedSubmission, reencodeThread, validateClosedRun, validateImportedExecution, validateImportedRunExecution, verifyImportedInputOrder, verifyImportedReferences };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as RunId, u as ThreadId } from "../Identifiers-CN2s30fF.mjs";
|
|
2
|
-
import { $r as ExecutionCheckpoint, Gi as ThreadStoreError, c as IntegrityReport, vi as ThreadCheckpoint, vn as SubmissionSnapshot, xi as ThreadExport } from "../Admin-
|
|
3
|
-
import { t as RunContextReader } from "../run-context-reader-
|
|
4
|
-
import { w as ThreadImportReader } from "../ThreadImport-
|
|
2
|
+
import { $r as ExecutionCheckpoint, Gi as ThreadStoreError, c as IntegrityReport, vi as ThreadCheckpoint, vn as SubmissionSnapshot, xi as ThreadExport } from "../Admin-DTDihBra.mjs";
|
|
3
|
+
import { t as RunContextReader } from "../run-context-reader-DvTEq2RC.mjs";
|
|
4
|
+
import { w as ThreadImportReader } from "../ThreadImport-D_Biid6w.mjs";
|
|
5
5
|
import { Effect, Stream } from "effect";
|
|
6
6
|
declare namespace ThreadInvariants_d_exports {
|
|
7
7
|
export { ThreadInvariantInput, verifyThreadInvariants };
|