@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
|
@@ -2603,6 +2603,12 @@ declare const ThreadIdentity_base: Schema.Class<ThreadIdentity, Schema.Struct<{
|
|
|
2603
2603
|
*/
|
|
2604
2604
|
declare class ThreadIdentity extends ThreadIdentity_base {}
|
|
2605
2605
|
declare const ThreadAdmission_base: Schema.Class<ThreadAdmission, Schema.Struct<{
|
|
2606
|
+
readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
|
|
2607
|
+
readonly receiptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ReceiptId">;
|
|
2608
|
+
readonly queueSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/QueueSequence">;
|
|
2609
|
+
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
2610
|
+
/** Stable closed Receipt timestamp; required for idle transfer, absent on active verification facts. */
|
|
2611
|
+
readonly settledAt: Schema.optionalKey<Schema.DateTimeUtcFromString>;
|
|
2606
2612
|
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
2607
2613
|
readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
|
|
2608
2614
|
readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
@@ -2745,12 +2751,6 @@ declare const ThreadAdmission_base: Schema.Class<ThreadAdmission, Schema.Struct<
|
|
|
2745
2751
|
readonly key: Schema.NonEmptyString;
|
|
2746
2752
|
readonly revision: Schema.NonEmptyString;
|
|
2747
2753
|
}>>;
|
|
2748
|
-
readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
|
|
2749
|
-
readonly receiptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ReceiptId">;
|
|
2750
|
-
readonly queueSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/QueueSequence">;
|
|
2751
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
2752
|
-
/** Stable closed Receipt timestamp; required for idle transfer, absent on active verification facts. */
|
|
2753
|
-
readonly settledAt: Schema.optionalKey<Schema.DateTimeUtcFromString>;
|
|
2754
2754
|
}>, {}>;
|
|
2755
2755
|
/** Immutable accepted input, distinct from all regenerable ledger execution state. */
|
|
2756
2756
|
declare class ThreadAdmission extends ThreadAdmission_base {}
|
|
@@ -3401,6 +3401,8 @@ interface RunWriter {
|
|
|
3401
3401
|
}
|
|
3402
3402
|
interface RunStorageSession extends RunWriter, RunOwnership {
|
|
3403
3403
|
readonly claim: Claim;
|
|
3404
|
+
/** Atomic original input/context plus the ledger marker, when the adapter supports it. */
|
|
3405
|
+
readonly appendInput?: RunWriter["append"];
|
|
3404
3406
|
/** Library-only initialization, before application/model IO. Hold progress before mutation
|
|
3405
3407
|
* so the captured controls and this owner's acknowledged input remain one read view. */
|
|
3406
3408
|
readonly withInitialization?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | OwnershipLost, R>;
|
|
@@ -5024,6 +5026,10 @@ declare const SubmissionLedger_base: Context.ServiceClass<SubmissionLedger, "@ef
|
|
|
5024
5026
|
readonly resolveFundingOwner?: (request: FundingOwnerRequest) => Effect.Effect<FundingOwner, LedgerError>;
|
|
5025
5027
|
readonly resolveAdmission: (request: SubmissionLookupByKey) => Effect.Effect<AdmissionResolution, LedgerError>;
|
|
5026
5028
|
readonly selectHead: (request: ClaimRequest) => Effect.Effect<Option.Option<Claim>, LedgerError>;
|
|
5029
|
+
/** Atomically publish a captured original input, active context and applied marker.
|
|
5030
|
+
* Optional adapters retain the ordinary append-then-repair protocol. The captured input
|
|
5031
|
+
* must be this owner's deterministic admission; a moved context boundary is refused. */
|
|
5032
|
+
readonly appendInput?: (submissionId: SubmissionId, request: AppendRequest) => Effect.Effect<AppendResult, ThreadStoreFailure>;
|
|
5027
5033
|
readonly markInputApplied: (request: MarkInputAppliedRequest) => Effect.Effect<void, OwnershipLost | LedgerError>;
|
|
5028
5034
|
readonly finalizeSettlement: (request: SettlementFinalization) => Effect.Effect<Settlement, SettlementConflict | LedgerError>;
|
|
5029
5035
|
/** Optional for third-party adapters. Remaining ownership must reach zero before stop acknowledgement. */
|
|
@@ -5811,4 +5817,4 @@ declare const RetryRefused_base: Schema.Class<RetryRefused, Schema.TaggedStruct<
|
|
|
5811
5817
|
declare class RetryRefused extends RetryRefused_base {}
|
|
5812
5818
|
//#endregion
|
|
5813
5819
|
export { ResumeFromTurnBoundary as $, ThreadArchiveRangeRead as $a, ThreadWorkerCapacityRequest as $i, DurableAwaitFailure as $n, subagentLineageBatchId as $o, ExecutionCheckpoint as $r, RecoverySnapshotRequest as $t, AwaitHostSettlement as A, WorkIndexRebuildRequest as Aa, ThreadIdentityRequest as Ai, WaitingChild as An, approvalDecisionBatchId as Ao, SubmissionStatus_d_exports as Ar, BindingUnavailable as As, ChildReservationConflict as At, NoAction as B, encodeWorkCursor as Ba, ThreadResolutionFact as Bi, submissionSettlementBatchId as Bn, modelResponseRecordId as Bo, SettlementPublication as Br, FundingOwnerRequest as Bt, renderRecoveryExplanation as C, ThreadWorkRequest as Ca, ThreadExportCursor as Ci, SuspensionReason as Cn, RunJournalContext as Co, recoveryRepairBatchId as Cr, workerReportRecordId as Cs, ApprovalDecisionIntent as Ct, AwaitApprovalDecision as D, WorkDiscoveryUnavailable as Da, ThreadExportSnapshot as Di, UnknownResolutionConflict as Dn, RunJournal_d_exports as Do, PendingSubmission as Dr, AgentAttemptContext as Ds, ChildAttachmentSnapshot as Dt, ApplyUnknownResolutions as E, WORK_INDEX_VERSION as Ea, ThreadExportRequest as Ei, UnknownResolutionCommand as En, RunJournalUsage as Eo, threadCreatedRecordId as Er, AgentRegistration_d_exports as Es, BeginChildBudgetReleaseRequest as Et, DeclaredPendingBatchEvidence as F, WorkerReportingMode as Fa, ThreadPromptRead as Fi, settlementFailureFromRecord as Fn, firstWorkerInputRecordId as Fo, RunStorageSession as Fr, ReplayVersions as Fs, Claim as Ft, RecoveryDecision as G, workIndexChanges as Ga, ThreadStoreError as Gi, workerTerminalFromRecord as Gn, runCompletedRecordId as Go, validateCanonicalSettlement as Gr, LedgerError as Gt, OpenToolCallEvidence as H, resolveWorkEvidence as Ha, ThreadSelection as Hi, submissionSettlementRecordId as Hn, projectRunJournal as Ho, SettlementPublicationFailure as Hr, JoinSnapshot as Ht, DelegationAdmissionEvidence as I, admissionWork as Ia, ThreadRead as Ii, submissionAbortBatchId as In, initialRunJournal as Io, RunWriter as Ir, ResolvedBinding as Is, ClaimHandoff as It, ReleaseOrphanChildReservation as J, MAX_ARCHIVE_RANGE_RECORDS as Ja, ThreadTail as Ji, DurableAgentRuntime as Jn, runIdForSubmission as Jo, AppendConflict as Jr, MarkReadyRequest as Jt, RecoveryEvidence as K, MAX_ARCHIVE_RANGE_BYTES as Ka, ThreadStoreFailure as Ki, ApprovalSuspensionError as Kn, runDurationBatchId as Ko, validateJoinedSettlement as Kr, MarkInputAppliedRequest as Kt, EnsureWaitingForChild as L, advanceWorkEntry as La, ThreadReadRequest as Li, submissionAbortRecordId as Ln, markUnknownBatchId as Lo, layer as Lr, compileBindingContracts as Ls, ClaimJoiningRequest as Lt, AwaitUnknownResolution as M, WorkStateReference as Ma, ThreadNotMaterialized as Mi, WorkerLedgerState as Mn, childThreadIdFor as Mo, RunChildBudgetReservation as Mr, DurableBindingFailure as Ms, ChildReservationStatus as Mt, CompleteChildAdmission as N, WorkThreadsPage as Na, ThreadObservation as Ni, WorkerStopCommand as Nn, compactionBatchId as No, RunOwnership as Nr, DurableWorkerBinding as Ns, ChildSettledNotification as Nt, AwaitChildAdmissionResolution as O, WorkIndexChange as Oa, ThreadExportSource as Oi, UnknownResolutionIntent as On, TurnCommitInput as Oo, SettledSubmission as Or, AgentRegistration as Os, ChildBudgetReservationRequest as Ot, CompleteMaterialization as P, WorkThreadsRequest as Pa, ThreadPeerCountRequest as Pi, approvalDecisionsCover as Pn, compactionRecordId as Po, RunStorage as Pr, ExecutableAgentBinding as Ps, ChildSettledOutcome as Pt, RepairSubagentStartLink as Q, ThreadArchiveRangePublish as Qa, ThreadWorkerCapacity as Qi, DurableApprovalSuspension as Qn, subagentJoinedRecordId as Qo, CommitBatch as Qr, RecoverySnapshot as Qt, FinalizeLedgerFromHistory as R, decodeWorkCursor as Ra, ThreadReader as Ri, submissionInputBatchId as Rn, modelResponseInterruptedBatchId as Ro, make as Rr, compileRegistrations as Rs, ClaimRequest as Rt, recoveryDecisionMeaning as S, ThreadWorkPage as Sa, ThreadExportBatch as Si, SuspensionOutcome as Sn, JournalBoundary as So, isolateRecovery as Sr, workerOriginRecordId as Ss, ApprovalDecisionCommand as St, ApplyJoinAccounting as T, ThreadWork_d_exports as Ta, ThreadExportRejected as Ti, UnknownResolution as Tn, RunJournalProjection as To, threadCreatedBatchId as Tr, toolCallSettledRecordId as Ts, AttachChildToReservationRequest as Tt, PendingApprovalEvidence as U, validateWorkPage as Ua, ThreadStore as Ui, unknownResolutionKind as Un, projectRunJournalStream as Uo, SettlementPublicationResult as Ur, JoiningClaim as Ut, OpenDelegationCallEvidence as V, operationEvidence as Va, ThreadRunInputRequest as Vi, submissionSettlementId as Vn, peerMessageRecordId as Vo, SettlementPublicationAuthority as Vr, InputAppliedMarker as Vt, PropagateChildAbort as W, workId as Wa, ThreadStoreDiagnostic as Wi, unknownResolutionMatchesResult as Wn, promptFromCanonicalRecords as Wo, SettlementPublisher as Wr, LedgerCapabilities as Wt, RepairJoinMarker as X, ThreadArchiveRange as Xa, ThreadVerificationRequest as Xi, DurableApprovalFailure as Xn, runStartedRecordId as Xo, AppendResult as Xr, OwnershipLost as Xt, RepairInputMarker as Y, MAX_CANONICAL_BATCH_BYTES as Ya, ThreadTailRequest as Yi, DurableAgentRuntime_d_exports as Yn, runStartedBatchId as Yo, AppendRequest as Yr, MarkUnknownRequest as Yt, RepairReadiness as Z, ThreadArchiveRangePage as Za, ThreadVerificationStorage as Zi, DurableApprovalResolver as Zn, subagentJoinBatchId as Zo, CheckpointRejected as Zr, ParentLinkage as Zt, RetryCommand as _, MAX_WORK_REBUILD_BYTES as _a, ThreadApprovalFact as _i, SubmissionScheduling as _n, MutationGate as _o, RecoverySweepOptions as _r, turnResponseBatch as _s, AdmissionPolicyError as _t, IntegrityCheck as a, makeTransferFactCheck as aa, MAX_THREAD_EXPORT_CURSOR_CHARS as ai, ResolutionSafeToRetry as an, LifecyclePublicationBatch as ao, DurableRetryFailure as ar, toolApprovalDecisionRecordId as as, SettleJoinedWithHost as at, obligationSeverityOf as b, ThreadWorkDiscovery as ba, ThreadCommands as bi, SubmissionWorkItem as bn, StorageOwnerService as bo, WorkRecoveryRequest as br, turnResultsBatchId as bs, AdmissionResult as bt, IntegrityReport as c, transferPageFits as ca, PreparedAppend as ci, SettlementConflict as cn, LifecyclePublicationFact as co, DurableSubmitAgent as cr, toolCallResolvedRecordId as cs, AbortCommand as ct, ObligationReport as d, MAX_RECOVERY_PAGES as da, PromptCheckpointRead as di, SubmissionLedger as dn, LifecyclePublicationStorage as do, DurableVerifyFailure as dr, toolStepSettledBatchId as ds, AdmissionAdmitted as dt, ThreadWorkerSeal as ea, ExecutionRead as ei, ReleaseChildBudgetRequest as en, ThreadArchiveRangeRequest as eo, DurableExplainFailure as er, subagentLineageRecordId as es, ResumePendingToolBatch as et, ObligationSeverity as f, MAX_RECOVERY_WORK_ITEMS as fa, PromptCheckpoints as fi, SubmissionLedgerFailure as fn, LifecyclePublication_d_exports as fo, DurableWorkerFailure as fr, toolStepSettledRecordId as fs, AdmissionConflict as ft, RecoveryExplanation as g, MAX_WORK_PAGE_ENTRIES as ga, ThreadAdmission as gi, SubmissionLookupByKey as gn, ProgressAppendRecord as go, RecoveryReport as gr, turnIdForRun as gs, AdmissionNotAdmitted as gt, RecoveryDisposition as h, MAX_WORK_PAGE_BYTES as ha, ThreadAbortFact as hi, SubmissionLookupById as hn, lifecyclePublicationLayer as ho, RecoveryFailure as hr, turnCanonicalBatch as hs, AdmissionIndeterminate as ht, ExplainedUnknownCall as i, getRunInput as ia, MAX_PROMPT_CHECKPOINT_RUNS as ii, ResolutionNeverHappened as in, LifecyclePublication as io, DurableResolveFailure as ir, subagentStartedRecordId as is, SettleAborted as it, AwaitParentEstablishment as j, WorkOwner as ja, ThreadMaterialization as ji, WaitingForChildSuspension as jn, childIdempotencyKeyFor as jo, RunChildAttachment as jr, CurrentBindingSelection as js, ChildReservationId as jt, AwaitChildSettlement as k, WorkIndexProgress as ka, ThreadIdentity as ki, UnknownResolutionKind as kn, agentUpdateRecordId as ko, SubmissionStatus as kr, BindingSelection as ks, ChildBudgetReservationSnapshot as kt, ObligationBlockedOn as l, CanonicalWorkEntry as la, PromptCheckpoint as li, SettlementFinalization as ln, LifecyclePublicationHandler as lo, DurableSubmitFailure as lr, toolCallResultBatchId as ls, AbortIntent as lt, RECOVERY_DECISION_MEANINGS as m, MAX_WORK_ENTRY_BYTES as ma, SelectedThreadRead as mi, SubmissionLookup as mn, lifecyclePublicationBatchMaxFacts as mo, RecoveryBlocked as mr, turnBatchId as ms, AdmissionGroup as mt, ExplainedEvidence as n, canonicalBatchFitsTransfer as na, LoadCheckpointRequest as ni, ResolutionAbortSubmission as nn, ThreadArchiveRange_d_exports as no, DurableObserveOptions as nr, subagentRequestedRecordId as ns, ResumeWaitingParent as nt, IntegrityCheckName as o, readWorkerState as oa, MAX_THREAD_EXPORT_PAGE_BYTES as oi, RevertJoiningRequest as on, LifecyclePublicationConfig as oo, DurableRuntimeConfig as or, toolApprovalRequestRecordId as os, classifyRecovery as ot, ObligationThresholds as p, MAX_WORK_CURSOR_CHARS as pa, SaveCheckpointRequest as pi, SubmissionLedger_d_exports as pn, drainLifecyclePublications as po, DurableWorkerRequirements as pr, turnApprovalsBatchId as ps, AdmissionFence as pt, Recovery_d_exports as q, MAX_ARCHIVE_RANGE_PAGE as qa, ThreadStore_d_exports as qi, DurableAbortFailure as qn, runDurationRecordId as qo, validatePublication as qr, MarkJoinedRequest as qt, ExplainedSubmission as r, getRecord as ra, MAX_PROMPT_CHECKPOINT_BYTES as ri, ResolutionCompletedWithResult as rn, ThreadArchiveStorage as ro, DurableProgressFailure as rr, subagentStartedBatchId as rs, RevertJoining as rt, IntegrityCheckStatus as s, streamExport as sa, MAX_THREAD_EXPORT_PAGE_RECORDS as si, Settlement as sn, LifecyclePublicationError as so, DurableRuntimeConfigOptions as sr, toolCallResolutionBatchId as ss, pendingApprovalForRecovery as st, Admin_d_exports as t, ThreadWorkerStateRequest as ta, ExecutionUpdate as ti, ReservedChildBudget as tn, ThreadArchiveRangeSeal as to, DurableObligationFailure as tr, subagentRequestedBatchId as ts, ResumeSuspended as tt, ObligationEntry as u, FreshAdmissionWork as ua, PromptCheckpointHead as ui, SubmissionAdmissionFence as un, LifecyclePublicationSource as uo, DurableSubmitOptions as ur, toolCallUnknownRecordId as us, AbortIntentRequest as ut, RetryRefusalReason as v, MAX_WORK_REBUILD_RECORDS as va, ThreadCheckpoint as vi, SubmissionSnapshot as vn, OwnerGeneration as vo, RecoverySweepResult as vr, turnResponseBatchId as vs, AdmissionRequest as vt, ApplyInput as w, ThreadWorkStorage as wa, ThreadExportRecord as wi, SuspensionSnapshot as wn, RunJournalError as wo, recoveryRepairRecordId as wr, JournalRecordEnvelope as ws, ApprovalPendingSuspension as wt, predictRecoveryDisposition as x, ThreadWorkEntry as xa, ThreadExport as xi, SuspendRequest as xn, makeStorageOwner as xo, childReservationIdFor as xr, workerInputRecordId as xs, ApprovalConflict as xt, RetryRefused as y, ThreadWorkCursor as ya, ThreadCheckpoints as yi, SubmissionState as yn, StorageOwner as yo, WorkRecoveryReport as yr, turnResultsBatch as ys, AdmissionResolution as yt, MarkUnknown as z, deliveryPredecessor as za, ThreadRecordRequest as zi, submissionInputRecordId as zn, modelResponseInterruptedRecordId as zo, makeRunWriter as zr, definitionDigestsEqual as zs, FundingOwner as zt };
|
|
5814
|
-
//# sourceMappingURL=Admin-
|
|
5820
|
+
//# sourceMappingURL=Admin-DTDihBra.d.mts.map
|
|
@@ -28,22 +28,22 @@ import { AbortCommand, AbortIntentRequest, AdmissionPolicyError, AdmissionReques
|
|
|
28
28
|
import { DeclaredPendingBatchEvidence, OpenDelegationCallEvidence, OpenToolCallEvidence, PendingApprovalEvidence, RecoveryDecision, RecoveryEvidence, classifyRecovery, pendingApprovalForRecovery } from "./durable/Recovery.mjs";
|
|
29
29
|
import { ExplainedEvidence, ExplainedSubmission, ExplainedUnknownCall, ObligationEntry, ObligationReport, RecoveryExplanation, RetryRefused, obligationSeverityOf, predictRecoveryDisposition, recoveryDecisionMeaning } from "./durable/Admin.mjs";
|
|
30
30
|
import { a as compileRegistrations, c as resolveDefinitionBinding, l as resolveWorkerBinding, n as CurrentBindingSelection, o as definitionDigestsEqual, s as makeLegacyWorkerBinding, t as BindingUnavailable, u as toolReplayContracts } from "./agent-registration-a6QYaG3h.mjs";
|
|
31
|
-
import { $ as makeJournalMetadata, A as subagentRequestedRecordId, B as toolStepSettledRecordId, C as runStartedBatchId, D as subagentLineageBatchId, E as subagentJoinedRecordId, F as toolCallResolutionBatchId, G as turnResponseBatch, I as toolCallResolvedRecordId, 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, 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, w as runStartedRecordId, x as runDurationRecordId, y as runCompletedRecordId, z as toolStepSettledBatchId } from "./RunJournal-
|
|
32
|
-
import { $ as ThreadTailRequest, B as ThreadPromptRead, F as ThreadIdentityRequest, I as ThreadMaterialization, J as ThreadStore, R as ThreadObservation, U as ThreadReader, V as ThreadRead, X as ThreadStoreError, Y as ThreadStoreDiagnostic, _t as isPreContinuationFact, bt as terminalUsageCharge, gt as executionRunIds, ht as canonicalRunIds, lt as readWorkerState, n as AppendRequest, ot as getRecord, p as MAX_THREAD_EXPORT_PAGE_BYTES, pt as captureRecord, st as getRunInput } from "./ThreadStore-
|
|
31
|
+
import { $ as makeJournalMetadata, A as subagentRequestedRecordId, B as toolStepSettledRecordId, C as runStartedBatchId, D as subagentLineageBatchId, E as subagentJoinedRecordId, F as toolCallResolutionBatchId, G as turnResponseBatch, I as toolCallResolvedRecordId, 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, 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, w as runStartedRecordId, x as runDurationRecordId, y as runCompletedRecordId, z as toolStepSettledBatchId } from "./RunJournal-DGblbFas.mjs";
|
|
32
|
+
import { $ as ThreadTailRequest, B as ThreadPromptRead, F as ThreadIdentityRequest, I as ThreadMaterialization, J as ThreadStore, R as ThreadObservation, U as ThreadReader, V as ThreadRead, X as ThreadStoreError, Y as ThreadStoreDiagnostic, _t as isPreContinuationFact, bt as terminalUsageCharge, gt as executionRunIds, h as PreparedAppend, ht as canonicalRunIds, lt as readWorkerState, n as AppendRequest, ot as getRecord, p as MAX_THREAD_EXPORT_PAGE_BYTES, pt as captureRecord, st as getRunInput } from "./ThreadStore-BC4V-mY-.mjs";
|
|
33
33
|
import { ScheduledInputRefused, ScheduledInputRetryable } from "./durable/Schedule.mjs";
|
|
34
34
|
import { PreparedInputAdmission } from "./durable/PreparedInputAdmission.mjs";
|
|
35
35
|
import { PreparedInput } from "./durable/Subscription.mjs";
|
|
36
36
|
import { MessageDeliveryDriver, MessageDeliveryFailpoint, MessageDeliveryRecord, MessageDeliveryStore, prepareMessageDelivery } from "./durable/MessageDelivery.mjs";
|
|
37
37
|
import { DurableRuntimeFailpoint } from "./durable/DurableFailpoint.mjs";
|
|
38
|
-
import { _ as readRunContext, a as canonicalRecordBytes, b as reference, f as runEvidence, g as digestRunHistory, l as readContinuation, m as validateSuffix, n as CurrentRunWriter, s as makeProgressWriter, t as CurrentRunSettlement, u as readRunEvidenceSnapshot, x as resolveEvidence, y as RunContextReader } from "./RunContinuation-
|
|
38
|
+
import { _ as readRunContext, a as canonicalRecordBytes, b as reference, f as runEvidence, g as digestRunHistory, l as readContinuation, m as validateSuffix, n as CurrentRunWriter, s as makeProgressWriter, t as CurrentRunSettlement, u as readRunEvidenceSnapshot, x as resolveEvidence, y as RunContextReader } from "./RunContinuation-CWHuciup.mjs";
|
|
39
39
|
import { MAX_WORK_CURSOR_CHARS, ThreadWorkDiscovery, ThreadWorkEntry, ThreadWorkRequest, WorkDiscoveryUnavailable, decodeWorkCursor, deliveryPredecessor, encodeWorkCursor, operationEvidence, resolveWorkEvidence, validateWorkPage, workId } from "./durable/ThreadWork.mjs";
|
|
40
40
|
import { WakeScheduler } from "./durable/WakeScheduler.mjs";
|
|
41
41
|
import { n as safeUnknownString, t as inspectForeignDiagnostic } from "./foreign-diagnostic-DBQ1XHKh.mjs";
|
|
42
|
-
import { c as threadCreatedBatchId, l as threadCreatedRecordId, n as WorkerAdmissionPort, o as ensureThreadCreated, r as WorkerAdmissionRequest, s as ensureWorkerOrigin } from "./WorkerAdmission-
|
|
42
|
+
import { c as threadCreatedBatchId, l as threadCreatedRecordId, n as WorkerAdmissionPort, o as ensureThreadCreated, r as WorkerAdmissionRequest, s as ensureWorkerOrigin } from "./WorkerAdmission-C47Vy_cK.mjs";
|
|
43
43
|
import { i as unresolvedToolOperations, n as isUnresolvedToolOperation, r as toolOperationStates, t as initialDispatchBlockedTurns } from "./tool-operations-BXBmagY1.mjs";
|
|
44
44
|
import { WorkerBudgetAuthorizer, WorkerConcurrencyLimit, WorkerConcurrencyResolver, WorkerHostAuthorizer, WorkerHostConfig, WorkerPolicyResolver } from "./durable/WorkerHost.mjs";
|
|
45
45
|
import { OperationAuthorizationRequest, OperationAuthorizer, OperationDenied } from "./durable/OperationAuthorizer.mjs";
|
|
46
|
-
import { o as makeRunWriter, r as RunStorage, s as StorageOwner } from "./RunStorage-
|
|
46
|
+
import { o as makeRunWriter, r as RunStorage, s as StorageOwner } from "./RunStorage-BF2YgWkg.mjs";
|
|
47
47
|
import { SettlementPublication } from "./durable/SettlementPublisher.mjs";
|
|
48
48
|
import { PendingSubmission, SettledSubmission } from "./durable/SubmissionStatus.mjs";
|
|
49
49
|
import { DeclaredToolCallEvidence, ToolReconciler } from "./durable/ToolReconciler.mjs";
|
|
@@ -769,14 +769,13 @@ const retainedBytes = (value, json, allowance) => {
|
|
|
769
769
|
const footprint = promptJsonFootprint(value, Math.floor((allowance - encodedBytes) / 2));
|
|
770
770
|
return footprint === void 0 ? void 0 : encodedBytes + 2 * footprint;
|
|
771
771
|
};
|
|
772
|
-
const encodeHistory = Effect.
|
|
773
|
-
const value = yield* encodePrompt(prompt);
|
|
772
|
+
const encodeHistory = (prompt, allowance) => Effect.suspend(() => Effect.mapEager(encodePrompt(prompt), (value) => {
|
|
774
773
|
const encoded = canonicalJson(value);
|
|
775
774
|
return {
|
|
776
775
|
encoded,
|
|
777
776
|
bytes: retainedBytes(value, encoded, allowance)
|
|
778
777
|
};
|
|
779
|
-
});
|
|
778
|
+
}));
|
|
780
779
|
const decodeCheckpointPrefix = Effect.fnUntraced(function* (encoded, length) {
|
|
781
780
|
const value = yield* parseJson(encoded);
|
|
782
781
|
const bytes = retainedBytes(value, encoded, MAX_BYTES);
|
|
@@ -2830,6 +2829,7 @@ const childUsageReportsOf = (state) => [...state.started.entries()].map(([toolCa
|
|
|
2830
2829
|
});
|
|
2831
2830
|
/** Deterministic batch identity of one executed recovery decision's audit append (DUR-013). */
|
|
2832
2831
|
const recoveryRepairBatchId = (submissionId, decisionTag) => decodeBatchId(`repair:${submissionId}:${decisionTag}`);
|
|
2832
|
+
const isOriginalInputRecord = (record) => record.payload._tag === "UserInputRecorded";
|
|
2833
2833
|
/** Deterministic record identity of one executed recovery decision's `RepairAnnotated` record. */
|
|
2834
2834
|
const recoveryRepairRecordId = (submissionId, decisionTag) => decodeRecordId(`repair:${submissionId}:${decisionTag}`);
|
|
2835
2835
|
const RecoveryCauseTag = Schema.Literals([
|
|
@@ -3741,15 +3741,25 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
3741
3741
|
};
|
|
3742
3742
|
});
|
|
3743
3743
|
const attemptContextAtTail = (threadId) => makeRunWriter(threadId).pipe(Effect.provideService(ThreadStore, store), Effect.provideService(StorageOwner, storageOwner), Effect.flatMap(withProgress), Effect.map(({ owned }) => owned));
|
|
3744
|
-
const withProgressSession = Effect.fnUntraced(function* (session) {
|
|
3744
|
+
const withProgressSession = Effect.fnUntraced(function* (session, originalInput) {
|
|
3745
3745
|
const { owned, progress } = yield* withProgress(session);
|
|
3746
3746
|
activeProgress.set(session.threadId, { writer: progress });
|
|
3747
3747
|
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
3748
3748
|
if (activeProgress.get(session.threadId)?.writer === progress) activeProgress.delete(session.threadId);
|
|
3749
3749
|
}));
|
|
3750
|
+
const inputWriter = session.appendInput === void 0 ? void 0 : {
|
|
3751
|
+
...session,
|
|
3752
|
+
append: session.appendInput
|
|
3753
|
+
};
|
|
3750
3754
|
const wrapped = {
|
|
3751
3755
|
...session,
|
|
3752
3756
|
append: owned.append,
|
|
3757
|
+
...inputWriter === void 0 ? {} : { appendInput: (batch) => storageOwner.withProgress(session.threadId, storageOwner.withMutation(Effect.gen(function* () {
|
|
3758
|
+
yield* session.checkActive;
|
|
3759
|
+
const original = originalInput?.();
|
|
3760
|
+
const commit = progress.commit(batch);
|
|
3761
|
+
return yield* (original === void 0 ? commit : progress.withVerifiedEmptyRun(runIdForSubmission(session.claim.submissionId), CanonicalSequence.make(original.sequence - 1), commit)).pipe(Effect.provideService(CurrentRunWriter, inputWriter));
|
|
3762
|
+
}))) },
|
|
3753
3763
|
publishSettlement: (batch) => progress.publish(batch).pipe(Effect.provideService(CurrentRunSettlement, session))
|
|
3754
3764
|
};
|
|
3755
3765
|
progressWriters.set(wrapped, progress);
|
|
@@ -4054,6 +4064,13 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
4054
4064
|
reason
|
|
4055
4065
|
}));
|
|
4056
4066
|
});
|
|
4067
|
+
const prepareOriginalInput = (submission) => makeEnvelope(submissionInputRecordId(submission.submissionId), UserInputRecorded.make({
|
|
4068
|
+
submissionId: submission.submissionId,
|
|
4069
|
+
kind: "user",
|
|
4070
|
+
runId: runIdForSubmission(submission.submissionId),
|
|
4071
|
+
input: submission.inputPayload,
|
|
4072
|
+
...submission.messageAdmission === void 0 ? {} : { messageAdmission: submission.messageAdmission }
|
|
4073
|
+
}));
|
|
4057
4074
|
/**
|
|
4058
4075
|
* Plan step 2: append the deterministic `UserInputRecorded` record (batch idempotency makes it
|
|
4059
4076
|
* exactly-once canonical, DUR-007) and mark it applied. When canonical history already carries
|
|
@@ -4071,13 +4088,7 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
4071
4088
|
});
|
|
4072
4089
|
return;
|
|
4073
4090
|
}
|
|
4074
|
-
const envelope = yield*
|
|
4075
|
-
submissionId,
|
|
4076
|
-
kind: "user",
|
|
4077
|
-
runId: runIdForSubmission(submissionId),
|
|
4078
|
-
input: submission.inputPayload,
|
|
4079
|
-
...submission.messageAdmission === void 0 ? {} : { messageAdmission: submission.messageAdmission }
|
|
4080
|
-
}));
|
|
4091
|
+
const envelope = yield* prepareOriginalInput(submission);
|
|
4081
4092
|
const result = yield* appendBatch(ctx, CanonicalBatch.make({
|
|
4082
4093
|
batchId: submissionInputBatchId(submissionId),
|
|
4083
4094
|
producerId: config.producerId,
|
|
@@ -4104,8 +4115,10 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
4104
4115
|
if (starts.length > 1 || starts.length === 1 && starts[0]?.recordId !== recordId || existing !== void 0 && (existing.payload._tag !== "RunStarted" || existing.payload.runId !== runId)) return yield* RunJournalError.make({ message: `Run ${runId} has conflicting active start state` });
|
|
4105
4116
|
return existing;
|
|
4106
4117
|
});
|
|
4107
|
-
const makeRunStart = Effect.fnUntraced(function* (submission, maxDurationMillis, records, operational) {
|
|
4118
|
+
const makeRunStart = Effect.fnUntraced(function* (submission, maxDurationMillis, records, operational, input) {
|
|
4108
4119
|
const writer = yield* CurrentRunWriter;
|
|
4120
|
+
const append = input === void 0 ? writer.append : writer.appendInput;
|
|
4121
|
+
if (append === void 0) return yield* RunJournalError.make({ message: "Fresh startup requires an input publisher" });
|
|
4109
4122
|
const runId = runIdForSubmission(submission.submissionId);
|
|
4110
4123
|
const recordId = runStartedRecordId(runId);
|
|
4111
4124
|
const existing = yield* readRunStart(submission.threadId, runId, operational);
|
|
@@ -4133,11 +4146,19 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
4133
4146
|
return;
|
|
4134
4147
|
}
|
|
4135
4148
|
yield* hit("run:before-start-append");
|
|
4136
|
-
yield* appendBatch(
|
|
4137
|
-
|
|
4149
|
+
yield* appendBatch({
|
|
4150
|
+
threadId: writer.threadId,
|
|
4151
|
+
append
|
|
4152
|
+
}, CanonicalBatch.make({
|
|
4153
|
+
batchId: input === void 0 ? runStartedBatchId(runId) : submissionInputBatchId(submission.submissionId),
|
|
4138
4154
|
producerId: config.producerId,
|
|
4139
|
-
records: [
|
|
4155
|
+
records: [
|
|
4156
|
+
input ?? start,
|
|
4157
|
+
...input === void 0 ? [] : [start],
|
|
4158
|
+
...context === void 0 ? [] : [context]
|
|
4159
|
+
]
|
|
4140
4160
|
}));
|
|
4161
|
+
if (input !== void 0) yield* hit("input:after-canonical-append");
|
|
4141
4162
|
committed = true;
|
|
4142
4163
|
yield* hit("run:after-start-append");
|
|
4143
4164
|
});
|
|
@@ -4974,7 +4995,7 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
4974
4995
|
const boundaries = [];
|
|
4975
4996
|
const cached = projectedJournal;
|
|
4976
4997
|
const projectionThrough = Math.max(progressThrough ?? 0, records.at(-1)?.sequence ?? 0);
|
|
4977
|
-
const originalInput = records.find(({ record: { payload } }) => payload._tag === "UserInputRecorded" && payload.kind === "user" && payload.submissionId === submissionId);
|
|
4998
|
+
const originalInput = initialJournal?.original ?? records.find(({ record: { payload } }) => payload._tag === "UserInputRecorded" && payload.kind === "user" && payload.submissionId === submissionId);
|
|
4978
4999
|
if (originalInput === void 0) return yield* RunJournalError.make({ message: "Run has no original context boundary" });
|
|
4979
5000
|
const historyEvidence = /* @__PURE__ */ new Map();
|
|
4980
5001
|
const retainHistory = (entry) => {
|
|
@@ -5200,14 +5221,6 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
5200
5221
|
usageSummary: yield* currentUsageSummary()
|
|
5201
5222
|
};
|
|
5202
5223
|
}
|
|
5203
|
-
let ownerFirstSequence;
|
|
5204
|
-
for (const envelope of records) {
|
|
5205
|
-
const payload = envelope.record.payload;
|
|
5206
|
-
if ("runId" in payload && payload.runId === runId) {
|
|
5207
|
-
ownerFirstSequence = envelope.sequence;
|
|
5208
|
-
break;
|
|
5209
|
-
}
|
|
5210
|
-
}
|
|
5211
5224
|
/** Only canonical joined inputs can require restoration from an earlier Attempt. */
|
|
5212
5225
|
let joinBacklog = joinedInputEnvelopes.size === 0 ? [] : void 0;
|
|
5213
5226
|
/** Joined inputs already handed to the engine during THIS Attempt (never re-deliver). */
|
|
@@ -5369,6 +5382,7 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
5369
5382
|
cause
|
|
5370
5383
|
})));
|
|
5371
5384
|
yield* (yield* CurrentRunStart).commit(yield* makeEnvelope(recordId, payload));
|
|
5385
|
+
knownIds.add(originalInput.record.recordId);
|
|
5372
5386
|
knownIds.add(runStartedRecordId(runId));
|
|
5373
5387
|
knownIds.add(recordId);
|
|
5374
5388
|
historyEvidence.clear();
|
|
@@ -5665,7 +5679,7 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
5665
5679
|
sourceBoundaries = [];
|
|
5666
5680
|
sourceJournal = yield* recordHalt(projectRunJournalStream(Stream.concat(source, Stream.fromIterable(yield* recordHalt(selectedRange(ctx.threadId, [submissionId], tail.sequence, canonicalThrough)))).pipe(Stream.filter((envelope) => envelope.record.payload._tag !== "CompactionCreated" || envelope.sequence <= canonicalThrough)), runId, (boundary) => sourceBoundaries.push(boundary), priorContext));
|
|
5667
5681
|
}
|
|
5668
|
-
const coverable = sourceBoundaries.filter((boundary) => commit.kind !== "summarize" ||
|
|
5682
|
+
const coverable = sourceBoundaries.filter((boundary) => commit.kind !== "summarize" || boundary.sequence < originalInput.sequence);
|
|
5669
5683
|
if (coverable.length === 0) return yield* CompactionError.make({ message: commit.kind === "rollover" ? "Durable rollover requires complete canonical records" : "Durable compaction requires eligible canonical records" });
|
|
5670
5684
|
const comparisonView = instructionView(sourceJournal.prompt.content, initialInstructions, false, sourceJournal.historyBefore.content.length);
|
|
5671
5685
|
let matchingPrefix = 0;
|
|
@@ -6445,12 +6459,20 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
6445
6459
|
const checkpointPrompt = yield* promptHistory.take({ threadId: session.threadId }).pipe(Effect.provideService(ThreadStore, store), Effect.provideContext(journalServices));
|
|
6446
6460
|
let committedPromptSuffix;
|
|
6447
6461
|
const storageSession = session;
|
|
6462
|
+
let pendingOriginal;
|
|
6448
6463
|
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
6449
6464
|
committedPromptSuffix?.discard();
|
|
6450
6465
|
committedPromptSuffix = void 0;
|
|
6451
6466
|
}));
|
|
6452
6467
|
const promptSession = {
|
|
6453
6468
|
...storageSession,
|
|
6469
|
+
...storageSession.appendInput === void 0 ? {} : { appendInput: (batch, executions) => storageSession.appendInput(batch, executions).pipe(Effect.tap((result) => Effect.sync(() => {
|
|
6470
|
+
if (pendingOriginal !== void 0 && !result.replayed && result.firstSequence === pendingOriginal.sequence) committedPromptSuffix = makeCommittedPromptSuffix({
|
|
6471
|
+
threadId: storageSession.threadId,
|
|
6472
|
+
sequence: result.firstSequence,
|
|
6473
|
+
record: batch.records[0]
|
|
6474
|
+
});
|
|
6475
|
+
}))) },
|
|
6454
6476
|
append: (batch, executions) => {
|
|
6455
6477
|
const suffix = committedPromptSuffix;
|
|
6456
6478
|
const append = storageSession.append(batch, executions);
|
|
@@ -6469,7 +6491,7 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
6469
6491
|
}))), Effect.tapCause(() => Effect.sync(() => suffix.discard())));
|
|
6470
6492
|
}
|
|
6471
6493
|
};
|
|
6472
|
-
session = yield* withProgressSession(promptSession);
|
|
6494
|
+
session = yield* withProgressSession(promptSession, () => pendingOriginal);
|
|
6473
6495
|
const { claim, threadId } = session;
|
|
6474
6496
|
const submissionId = claim.submissionId;
|
|
6475
6497
|
let prepared = freshlyAdmitted && session.withInitialization !== void 0 ? yield* session.withInitialization(Effect.gen(function* () {
|
|
@@ -6481,6 +6503,30 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
6481
6503
|
const before = (yield* session.tail).sequence;
|
|
6482
6504
|
const view = yield* recoveryView(threadId, before, [submissionId], runIdForSubmission(submissionId));
|
|
6483
6505
|
if (view.progress !== void 0 || view.context !== void 0 || view.operational.length !== 0 || view.records.some(({ record }) => record.payload._tag !== "ThreadCreated")) return void 0;
|
|
6506
|
+
if (session.appendInput !== void 0) {
|
|
6507
|
+
const record = (yield* PreparedAppend.capture(AppendRequest.make({
|
|
6508
|
+
threadId,
|
|
6509
|
+
expectedTailSequence: before,
|
|
6510
|
+
batch: CanonicalBatch.make({
|
|
6511
|
+
batchId: submissionInputBatchId(submissionId),
|
|
6512
|
+
producerId: config.producerId,
|
|
6513
|
+
records: [yield* prepareOriginalInput(submission)]
|
|
6514
|
+
})
|
|
6515
|
+
}))).records[0].canonical;
|
|
6516
|
+
if (!isOriginalInputRecord(record)) return yield* RunJournalError.make({ message: "Captured startup has no original input" });
|
|
6517
|
+
pendingOriginal = {
|
|
6518
|
+
threadId,
|
|
6519
|
+
sequence: CanonicalSequence.make(before + 1),
|
|
6520
|
+
record
|
|
6521
|
+
};
|
|
6522
|
+
return {
|
|
6523
|
+
snapshot,
|
|
6524
|
+
through: before,
|
|
6525
|
+
view,
|
|
6526
|
+
start: yield* makeRunStart(submission, Duration.toMillis(registeredAgent.definition.policy.maxDuration), view.records, view.operational, record).pipe(Effect.provideService(CurrentRunWriter, session)),
|
|
6527
|
+
input: pendingOriginal
|
|
6528
|
+
};
|
|
6529
|
+
}
|
|
6484
6530
|
const progress = progressWriters.get(session);
|
|
6485
6531
|
const applyInput = applyCanonicalInput(session, submission, session, view.records, void 0);
|
|
6486
6532
|
yield* progress === void 0 ? applyInput : progress.withVerifiedEmptyRun(runIdForSubmission(submissionId), before, applyInput).pipe(Effect.provideService(CurrentRunWriter, promptSession));
|
|
@@ -6500,7 +6546,8 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
6500
6546
|
progressThrough: accepted.throughSequence,
|
|
6501
6547
|
operational: accepted.operational
|
|
6502
6548
|
},
|
|
6503
|
-
start
|
|
6549
|
+
start,
|
|
6550
|
+
input: void 0
|
|
6504
6551
|
};
|
|
6505
6552
|
})) : void 0;
|
|
6506
6553
|
const preparedInput = prepared !== void 0;
|
|
@@ -6689,10 +6736,10 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
6689
6736
|
let canonical = Stream.fromIterable(view.records);
|
|
6690
6737
|
let initialJournal;
|
|
6691
6738
|
if (view.context === void 0) {
|
|
6692
|
-
const original = currentRecords.find(({ record }) => record.payload._tag === "UserInputRecorded" && record.payload.kind === "user" && record.payload.submissionId === submissionId);
|
|
6739
|
+
const original = initialization?.input ?? currentRecords.find(({ record }) => record.payload._tag === "UserInputRecorded" && record.payload.kind === "user" && record.payload.submissionId === submissionId);
|
|
6693
6740
|
if (original === void 0) return yield* RunJournalError.make({ message: "Run has no exact original input context boundary" });
|
|
6694
6741
|
const suffix = currentRecords.filter((entry) => entry.sequence > original.sequence);
|
|
6695
|
-
const fresh = !lineage.inputWasRecorded && tail.sequence === original.sequence && suffix.length === 0;
|
|
6742
|
+
const fresh = initialization?.input !== void 0 || !lineage.inputWasRecorded && tail.sequence === original.sequence && suffix.length === 0;
|
|
6696
6743
|
const source = yield* Effect.gen(function* () {
|
|
6697
6744
|
if (checkpointPrompt !== void 0 && fresh && original.sequence === checkpointPrompt.through + 1) {
|
|
6698
6745
|
const records = [original, ...suffix];
|
|
@@ -6724,8 +6771,8 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
6724
6771
|
canonical = Stream.fromIterableEffect(Effect.suspend(() => source.records === void 0 ? readInitialJournal(source.original, source.suffix) : Effect.succeed(source.records)));
|
|
6725
6772
|
}
|
|
6726
6773
|
committedPromptSuffix?.discard();
|
|
6727
|
-
committedPromptSuffix = initialJournal?.cacheable ? makeCommittedPromptSuffix(initialJournal.original) : void 0;
|
|
6728
|
-
const outcome = yield* runModel(agent, ctx, submission, session, currentRecords, canonical, initialJournal, tail.sequence, view.progressThrough, view.progress, view.context, takeJournalMetadata(), lineage, approvalDecisionIntents, currentContracts, runTiming, yieldAfter).pipe(Effect.provideService(CurrentRunStart, start.publication), Effect.ensuring(Effect.sync(() => {
|
|
6774
|
+
committedPromptSuffix = initialJournal?.cacheable && initialization?.input === void 0 ? makeCommittedPromptSuffix(initialJournal.original) : void 0;
|
|
6775
|
+
const outcome = yield* runModel(agent, ctx, submission, session, currentRecords, canonical, initialJournal, initialization?.input?.sequence ?? tail.sequence, view.progressThrough, view.progress, view.context, takeJournalMetadata(), lineage, approvalDecisionIntents, currentContracts, runTiming, yieldAfter).pipe(Effect.provideService(CurrentRunStart, start.publication), Effect.ensuring(Effect.sync(() => {
|
|
6729
6776
|
if (initialJournal !== void 0) initialJournal.records = void 0;
|
|
6730
6777
|
})));
|
|
6731
6778
|
if (outcome._tag === "yielded") {
|
|
@@ -8447,4 +8494,4 @@ var DurableAgentRuntime = class DurableAgentRuntime extends Context.Service()("@
|
|
|
8447
8494
|
//#endregion
|
|
8448
8495
|
export { DurableApprovalSuspension as a, RecoveryFailure as c, WorkRecoveryReport as d, WorkRecoveryRequest as f, recoveryRepairRecordId as g, recoveryRepairBatchId as h, DurableApprovalResolver as i, RecoveryReport as l, isolateRecovery as m, DurableAgentRuntime as n, DurableRuntimeConfig as o, childReservationIdFor as p, DurableAgentRuntime_exports as r, RecoveryBlocked as s, ApprovalSuspensionError as t, RecoverySweepResult as u };
|
|
8449
8496
|
|
|
8450
|
-
//# sourceMappingURL=DurableAgentRuntime-
|
|
8497
|
+
//# sourceMappingURL=DurableAgentRuntime-BJbuIqQq.mjs.map
|