effect-agent 0.1.0-beta.158 → 0.1.0-beta.159
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-BbTZHSLu.d.mts → Admin-DWDYlvvZ.d.mts} +15 -19
- package/dist/{Agent-BCyrGaWg.d.mts → Agent-ZfnNCQXs.d.mts} +2 -2
- package/dist/{AgentPolicy-CnXWWwdg.d.mts → AgentPolicy-B4oH8TbG.d.mts} +13 -1
- package/dist/{AgentRuntime-D4eoBpIW.mjs → AgentRuntime-CVMHysXm.mjs} +41 -7
- package/dist/AgentRuntime-CVMHysXm.mjs.map +1 -0
- package/dist/{AgentRuntime-BPlAn5nA.d.mts → AgentRuntime-D1MmB_0z.d.mts} +10 -10
- package/dist/{ContextCompactor-CPlStZRc.d.mts → ContextCompactor-BoKQOjr5.d.mts} +2 -2
- package/dist/{Digest-CNHImGy0.d.mts → Digest-COAt3Orl.d.mts} +2 -2
- package/dist/{DurableAgentRuntime-eImXoGqD.mjs → DurableAgentRuntime-C7A5guvq.mjs} +12 -21
- package/dist/{DurableAgentRuntime-eImXoGqD.mjs.map → DurableAgentRuntime-C7A5guvq.mjs.map} +1 -1
- package/dist/{EventSource-CETtQTiH.d.mts → EventSource-BfNZBG4A.d.mts} +3 -3
- package/dist/{Messaging-Dkg87ebg.d.mts → Messaging-7VXQnWI3.d.mts} +2 -2
- package/dist/{Messaging-B1zumorg.d.mts → Messaging-CICd_CSi.d.mts} +4 -4
- package/dist/{MessagingHost-B4jqlJmx.d.mts → MessagingHost-DXwWnrMh.d.mts} +4 -4
- package/dist/{Output-WL7JexCm.d.mts → Output-CY7NZByV.d.mts} +2 -2
- package/dist/{PreparedInputAdmission-Swp9t800.d.mts → PreparedInputAdmission-VStpn8u2.d.mts} +4 -4
- package/dist/{Records-BxGWRs-t.d.mts → Records-Bm4Qt70a.d.mts} +3 -3
- package/dist/{RunEventSink-DsbcGXog.d.mts → RunEventSink-9CUdI9Ar.d.mts} +2 -2
- package/dist/{RunOptions-GjDlAuKh.d.mts → RunOptions-BHmBa05n.d.mts} +6 -6
- package/dist/{Schedule-B94iS2X3.d.mts → Schedule-Bi_XVKLF.d.mts} +2 -2
- package/dist/{Subagent-CLaMeZKu.d.mts → Subagent-D59om8SR.d.mts} +11 -13
- package/dist/{Subagent-211Oz2IN.mjs → Subagent-DH6G120f.mjs} +3 -6
- package/dist/Subagent-DH6G120f.mjs.map +1 -0
- package/dist/{SubagentContract-DdT7Cqe6.d.mts → SubagentContract-tyN9v-Jv.d.mts} +3 -7
- package/dist/{SubagentHost--HBuY8fF.d.mts → SubagentHost-VTyf_wEF.d.mts} +6 -6
- package/dist/{Subscription-DaMCppa_.d.mts → Subscription-Bx1ZRRVS.d.mts} +6 -6
- package/dist/{SubscriptionInput-B0ZtrQoY.d.mts → SubscriptionInput-B5k5vb1S.d.mts} +3 -3
- package/dist/{Worker-2r2zGDkh.d.mts → Worker-XEBYxRQv.d.mts} +3 -3
- package/dist/capabilities/Commands.d.mts +1 -1
- package/dist/capabilities/ContextTools.d.mts +1 -135
- package/dist/capabilities/ContextTools.mjs +1 -40
- package/dist/capabilities/ContextTools.mjs.map +1 -1
- package/dist/capabilities/Messaging.d.mts +2 -2
- package/dist/capabilities/RunHooks.d.mts +1 -1
- package/dist/capabilities/Subagent.d.mts +4 -4
- package/dist/capabilities/Subagent.mjs +2 -2
- package/dist/capabilities/SubagentReservations.d.mts +1 -1
- package/dist/core/Agent.d.mts +1 -1
- package/dist/core/AgentPolicy.d.mts +1 -1
- package/dist/core/AgentPolicy.mjs +6 -0
- package/dist/core/AgentPolicy.mjs.map +1 -1
- package/dist/core/SubagentContract.d.mts +2 -2
- package/dist/core/SubagentContract.mjs +1 -7
- package/dist/core/SubagentContract.mjs.map +1 -1
- package/dist/core/Worker.d.mts +2 -2
- package/dist/durable/ActivityStore.d.mts +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 +3 -3
- package/dist/durable/Digest.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +1 -1
- 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/MessageDelivery.d.mts +6 -6
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +43 -43
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +1 -1
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/RunJournal.d.mts +1 -1
- package/dist/durable/Schedule.d.mts +1 -1
- package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
- package/dist/durable/ScheduleTransition.d.mts +1 -1
- package/dist/durable/Scheduling.d.mts +3 -3
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +2 -2
- 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 +4 -4
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/Subscriptions.d.mts +6 -6
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadInvariants.d.mts +2 -2
- package/dist/durable/ThreadProjection.d.mts +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadStore.d.mts +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/WorkerAdmission.d.mts +4 -4
- package/dist/durable/WorkerHost.d.mts +6 -6
- package/dist/engine/AgentRuntime.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/engine/Compaction.d.mts +1 -1
- package/dist/engine/ContextCompactor.d.mts +1 -1
- package/dist/engine/MessagingHost.d.mts +1 -1
- package/dist/engine/Output.d.mts +1 -1
- package/dist/engine/RunEventSink.d.mts +1 -1
- package/dist/engine/RunOptions.d.mts +1 -1
- package/dist/engine/SubagentHost.d.mts +1 -1
- package/dist/index.d.mts +21 -21
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
- package/src/capabilities/ContextTools.ts +0 -55
- package/src/capabilities/Subagent.ts +0 -3
- package/src/core/AgentPolicy.ts +6 -0
- package/src/core/SubagentContract.ts +0 -7
- package/src/durable/DurableAgentRuntime.ts +21 -112
- package/src/engine/internal/agent-runtime.ts +86 -15
- package/dist/AgentRuntime-D4eoBpIW.mjs.map +0 -1
- package/dist/Subagent-211Oz2IN.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as SettlementId, d as ToolCallId, f as TurnId, l as SubmissionId, s as RunId, t as AgentId, u as ThreadId } from "./Identifiers-CN2s30fF.mjs";
|
|
2
|
-
import { d as SubagentReservationAmounts, l as SubagentGrant, o as SubagentDelegationCaps, s as SubagentExecutionFailure } from "./SubagentContract-
|
|
2
|
+
import { d as SubagentReservationAmounts, l as SubagentGrant, o as SubagentDelegationCaps, s as SubagentExecutionFailure } from "./SubagentContract-tyN9v-Jv.mjs";
|
|
3
3
|
import { a as Receipt, i as QueueSequence, n as JoinedToHost, r as Principal, t as IdempotencyKey } from "./Receipt-BAHyigAF.mjs";
|
|
4
4
|
import { r as Update } from "./AgentUpdates-DMJ-_xow.mjs";
|
|
5
5
|
import { c as Selection, l as Snapshot } from "./ToolExposure-r2eOWk4F.mjs";
|
|
@@ -9,18 +9,18 @@ import { t as ThreadHistory } from "./ThreadHistory-FD-o4TsR.mjs";
|
|
|
9
9
|
import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-CaAkzGHL.mjs";
|
|
10
10
|
import { a as AgentInputError } from "./AgentError-Bn1ytXRD.mjs";
|
|
11
11
|
import { t as ToolParameterRejection } from "./ToolResult-BKdqWRff.mjs";
|
|
12
|
-
import { t as AgentPolicy } from "./AgentPolicy-
|
|
13
|
-
import { E as RunDispositionDeclaration, _ as InstructionSource, c as Definition, m as InputPromptSource, n as Any, r as AnyDefinition, t as Agent_d_exports, y as ModelServices } from "./Agent-
|
|
12
|
+
import { t as AgentPolicy } from "./AgentPolicy-B4oH8TbG.mjs";
|
|
13
|
+
import { E as RunDispositionDeclaration, _ as InstructionSource, c as Definition, m as InputPromptSource, n as Any, r as AnyDefinition, t as Agent_d_exports, y as ModelServices } from "./Agent-ZfnNCQXs.mjs";
|
|
14
14
|
import { t as RunPolicyUsage } from "./RunPolicyUsage-CUudVtg_.mjs";
|
|
15
|
-
import { c as WorkerError, f as WorkerRef, n as AssignmentTerminal } from "./Worker-
|
|
16
|
-
import { G as RunToolAuthorization, O as RunCostEstimator, h as RunApprovalHook, x as RunContextPreparation } from "./RunOptions-
|
|
17
|
-
import { o as MessagingError, r as InputMessage } from "./Messaging-
|
|
18
|
-
import { t as MessagingHost } from "./MessagingHost-
|
|
19
|
-
import "./Messaging-
|
|
20
|
-
import { d as WorkerReportPreparationFailure, f as WorkerReporting, o as SubagentHost } from "./SubagentHost
|
|
21
|
-
import { p as RuntimeBinding, r as AgentCompletionProjectionRequirements, s as AgentRuntimeRequirements } from "./AgentRuntime-
|
|
22
|
-
import { $ as ToolApprovalRequested, E as ModelResponseRecorded, H as SettlementFailureDiagnostic, J as SubmissionSettled, K as SubagentRequested, L as RunCompleted, M as RecordEnvelope, N as RecordId, Q as ToolApprovalDecided, V as RunStartedRecord, W as SubagentJoined, Y as SubmissionSettledRecord, a as BatchId, ct as UserInputRecorded, d as CanonicalSequence, dt as WorkerInputCompleted, et as ToolCallPrepared, f as CompactionCreated, ft as WorkerInputRequested, g as DeploymentId, h as DefinitionDigests, j as ProducerId, k as PersistedJson, l as CanonicalRecordEnvelope, lt as WorkerAdmission, m as DefinitionDigestInput, q as SubagentStarted, r as AgentUpdateEmitted, rt as ToolCallSettled, s as CanonicalBatch, t as AbortRequested, vt as WorkerStopRequested } from "./Records-
|
|
23
|
-
import { t as DigestError } from "./Digest-
|
|
15
|
+
import { c as WorkerError, f as WorkerRef, n as AssignmentTerminal } from "./Worker-XEBYxRQv.mjs";
|
|
16
|
+
import { G as RunToolAuthorization, O as RunCostEstimator, h as RunApprovalHook, x as RunContextPreparation } from "./RunOptions-BHmBa05n.mjs";
|
|
17
|
+
import { o as MessagingError, r as InputMessage } from "./Messaging-7VXQnWI3.mjs";
|
|
18
|
+
import { t as MessagingHost } from "./MessagingHost-DXwWnrMh.mjs";
|
|
19
|
+
import "./Messaging-CICd_CSi.mjs";
|
|
20
|
+
import { d as WorkerReportPreparationFailure, f as WorkerReporting, o as SubagentHost } from "./SubagentHost-VTyf_wEF.mjs";
|
|
21
|
+
import { p as RuntimeBinding, r as AgentCompletionProjectionRequirements, s as AgentRuntimeRequirements } from "./AgentRuntime-D1MmB_0z.mjs";
|
|
22
|
+
import { $ as ToolApprovalRequested, E as ModelResponseRecorded, H as SettlementFailureDiagnostic, J as SubmissionSettled, K as SubagentRequested, L as RunCompleted, M as RecordEnvelope, N as RecordId, Q as ToolApprovalDecided, V as RunStartedRecord, W as SubagentJoined, Y as SubmissionSettledRecord, a as BatchId, ct as UserInputRecorded, d as CanonicalSequence, dt as WorkerInputCompleted, et as ToolCallPrepared, f as CompactionCreated, ft as WorkerInputRequested, g as DeploymentId, h as DefinitionDigests, j as ProducerId, k as PersistedJson, l as CanonicalRecordEnvelope, lt as WorkerAdmission, m as DefinitionDigestInput, q as SubagentStarted, r as AgentUpdateEmitted, rt as ToolCallSettled, s as CanonicalBatch, t as AbortRequested, vt as WorkerStopRequested } from "./Records-Bm4Qt70a.mjs";
|
|
23
|
+
import { t as DigestError } from "./Digest-COAt3Orl.mjs";
|
|
24
24
|
import { n as DurableRuntimeFailpoint, r as DurableRuntimeFailpointError } from "./DurableFailpoint-Cnr3wx1L.mjs";
|
|
25
25
|
import { o as OperationDenied } from "./OperationAuthorizer-TzcQtpX5.mjs";
|
|
26
26
|
import { s as ToolReconciler } from "./ToolReconciler-BmVRAHKs.mjs";
|
|
@@ -2208,7 +2208,6 @@ declare const DurableAgentRuntime_base: Context.ServiceClass<DurableAgentRuntime
|
|
|
2208
2208
|
readonly processThreadHead: (threadId: ThreadId, options?: {
|
|
2209
2209
|
readonly yieldAfter?: DateTime.Utc;
|
|
2210
2210
|
}) => Effect.Effect<Option.Option<Settlement>, DurableWorkerFailure | DurableBindingFailure>;
|
|
2211
|
-
readonly runWorker: <InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions, Tools extends Record<string, Tool.Any>, Provider, ModelProvides, ModelRequires, InstructionError = InstructionErrorOf<Instructions, InputSchema["Type"]>, InstructionRequirements = InstructionRequirementsOf<Instructions, InputSchema["Type"]>, RunDispositionValue extends RunDispositionDeclaration<OutputSchema["Type"], Schema.Top> | undefined = undefined, InputPromptValue extends InputPromptSource<InputSchema["Type"], unknown, unknown> | undefined = undefined, UpdatesSchema extends Schema.Top | undefined = undefined>(agent: RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>) => Effect.Effect<void, DurableWorkerFailure | DurableBindingFailure, DurableWorkerRequirements<RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>, InstructionRequirements>>;
|
|
2212
2211
|
readonly runResolvedWorker: Effect.Effect<void, DurableWorkerFailure | DurableBindingFailure>;
|
|
2213
2212
|
/**
|
|
2214
2213
|
* Recover each pending Thread independently. History/child failures, defects and the
|
|
@@ -2257,11 +2256,8 @@ declare const DurableAgentRuntime_base: Context.ServiceClass<DurableAgentRuntime
|
|
|
2257
2256
|
* seam (Joining/Joined, plan §2.5): the queued input becomes canonical (`input:{sid}`) before
|
|
2258
2257
|
* the next model request, reattaches through the prompt-coverage rule after a crash, and the
|
|
2259
2258
|
* joined Submissions settle with the host outcome (DUR-002/DUR-016).
|
|
2260
|
-
* - `
|
|
2261
|
-
*
|
|
2262
|
-
* runs against this binding. Missing bindings leave accepted roots and children owed.
|
|
2263
|
-
* - `processThreadResolved(threadId)` / `runResolvedWorker` — the
|
|
2264
|
-
* equivalents over registrations owned by the runtime Layer: each stable `agentId` selects
|
|
2259
|
+
* - `processThreadResolved(threadId)` / `runResolvedWorker` — drain or continuously process
|
|
2260
|
+
* lanes using registrations owned by the runtime Layer: each stable `agentId` selects
|
|
2265
2261
|
* one current Binding. Unfinished operation contracts gate handler execution independently
|
|
2266
2262
|
* of immutable admission evidence; missing bindings release the claim with a typed refusal.
|
|
2267
2263
|
* - `runRecovery()` — classify every nonterminal Submission with the pure `classifyRecovery` and
|
|
@@ -4264,4 +4260,4 @@ declare const RetryRefused_base: Schema.Class<RetryRefused, Schema.TaggedStruct<
|
|
|
4264
4260
|
declare class RetryRefused extends RetryRefused_base {}
|
|
4265
4261
|
//#endregion
|
|
4266
4262
|
export { RepairSubagentStartLink as $, runDurationBatchId as $i, DurableApprovalFailure as $n, ThreadRecoveryCheckpoints as $r, ParentLinkage as $t, AwaitChildSettlement as A, turnResultsBatchId as Aa, JournalBoundary as Ai, SuspensionReason as An, CheckpointRejected as Ar, ChildReservationConflict as At, MarkUnknown as B, DurableBindingFailure as Ba, compactionBatchId as Bi, settlementFailureFromRecord as Bn, ThreadExport as Br, InputAppliedMarker as Bt, renderRecoveryExplanation as C, turnBatchId as Ca, drainLifecyclePublications as Ci, SubmissionLookupByKey as Cn, isolateRecovery as Cr, ApprovalDecisionIntent as Ct, ApplyUnknownResolutions as D, turnResponseBatch as Da, SettledSubmission as Di, SubmissionWorkItem as Dn, threadCreatedRecordId as Dr, ChildAttachmentSnapshot as Dt, ApplyJoinAccounting as E, turnPreparedBatchId as Ea, PendingSubmission as Ei, SubmissionState as En, threadCreatedBatchId as Er, BeginChildBudgetReleaseRequest as Et, CompleteMaterialization as F, AgentAttemptContext as Fa, TurnCommitInput as Fi, UnknownResolutionIntent as Fn, SaveCheckpointRequest as Fr, Claim as Ft, PropagateChildAbort as G, compileBindingContracts as Ga, modelResponseInterruptedRecordId as Gi, submissionSettlementBatchId as Gn, ThreadNotMaterialized as Gr, MarkInputAppliedRequest as Gt, OpenDelegationCallEvidence as H, ExecutableAgentBinding as Ha, firstWorkerInputRecordId as Hi, submissionAbortRecordId as Hn, ThreadIdentity as Hr, JoiningClaim as Ht, DeclaredPendingBatchEvidence as I, AgentRegistration as Ia, agentUpdateRecordId as Ii, WaitingChild as In, SaveRecoveryCheckpointRequest as Ir, ClaimHandoff as It, Recovery_d_exports as J, projectRunJournal as Ji, workerTerminalFromRecord as Jn, ThreadOutstandingRequest as Jr, MarkUnknownRequest as Jt, RecoveryDecision as K, compileRegistrations as Ka, modelResponseRecordId as Ki, submissionSettlementId as Kn, ThreadObservation as Kr, MarkJoinedRequest as Kt, DelegationAdmissionEvidence as L, BindingSelection as La, approvalDecisionBatchId as Li, WaitingForChildSuspension as Ln, SelectedThreadRead as Lr, ClaimJoiningRequest as Lt, AwaitParentEstablishment as M, workerOriginRecordId as Ma, RunJournalProjection as Mi, UnknownResolution as Mn, FencedAppendRequest as Mr, ChildReservationStatus as Mt, AwaitUnknownResolution as N, workerReportRecordId as Na, RunJournalUsage as Ni, UnknownResolutionCommand as Nn, LoadCheckpointRequest as Nr, ChildSettledNotification as Nt, AwaitApprovalDecision as O, turnResponseBatchId as Oa, SubmissionStatus as Oi, SuspendRequest as On, AppendConflict as Or, ChildBudgetReservationRequest as Ot, CompleteChildAdmission as P, AgentRegistration_d_exports as Pa, RunJournal_d_exports as Pi, UnknownResolutionConflict as Pn, MAX_THREAD_EXPORT_RECORDS as Pr, ChildSettledOutcome as Pt, RepairReadiness as Q, runCompletionDigest as Qi, DurableAgentRuntime_d_exports as Qn, ThreadRecordRequest as Qr, OwnershipToken as Qt, EnsureWaitingForChild as R, BindingUnavailable as Ra, childIdempotencyKeyFor as Ri, WorkerLedgerState as Rn, ThreadCheckpoint as Rr, ClaimRequest as Rt, recoveryDecisionMeaning as S, turnApprovalsBatchId as Sa, LifecyclePublication_d_exports as Si, SubmissionLookupById as Sn, childReservationIdFor as Sr, ApprovalDecisionCommand as St, ApplyInput as T, turnIdForRun as Ta, lifecyclePublicationLayer as Ti, SubmissionSnapshot as Tn, recoveryRepairRecordId as Tr, AttachChildToReservationRequest as Tt, OpenToolCallEvidence as U, ReplayVersions as Ua, markUnknownBatchId as Ui, submissionInputBatchId as Un, ThreadIdentityRequest as Ur, LedgerCapabilities as Ut, NoAction as V, DurableWorkerBinding as Va, compactionRecordId as Vi, submissionAbortBatchId as Vn, ThreadExportRequest as Vr, JoinSnapshot as Vt, PendingApprovalEvidence as W, ResolvedBinding as Wa, modelResponseInterruptedBatchId as Wi, submissionInputRecordId as Wn, ThreadMaterialization as Wr, LedgerError as Wt, RepairInputMarker as X, promptFromCanonicalRecords as Xi, DurableAbortFailure as Xn, ThreadRead as Xr, OwnershipRenewal as Xt, ReleaseOrphanChildReservation as Y, projectRunJournalStream as Yi, ApprovalSuspensionError as Yn, ThreadPeerCountRequest as Yr, OwnershipLost as Yt, RepairJoinMarker as Z, runCompletedRecordId as Zi, DurableAgentRuntime as Zn, ThreadReadRequest as Zr, OwnershipSnapshot as Zt, RetryCommand as _, toolCallResultBatchId as _a, LifecyclePublicationError as _i, SubmissionAdmissionFence as _n, RecoveryBlocked as _r, AdmissionPolicyError as _t, IntegrityCheck as a, subagentJoinedRecordId as aa, ThreadStoreFailure as ai, ReservedChildBudget as an, DurableObserveOptions as ar, SettleAborted as at, obligationSeverityOf as b, toolStepSettledBatchId as ba, LifecyclePublicationSource as bi, SubmissionLedger_d_exports as bn, RecoverySweepOptions as br, AdmissionResult as bt, IntegrityReport as c, subagentRequestedBatchId as ca, ThreadTailRequest as ci, ResolutionCompletedWithResult as cn, DurableRetryFailure as cr, AbortCommand as ct, ObligationReport as d, subagentStartedRecordId as da, getRunInput as di, RevertJoiningRequest as dn, DurableSubmitAgent as dr, AdmissionAdmitted as dt, runDurationRecordId as ea, ThreadRunInputRequest as ei, RecoverySnapshot as en, DurableApprovalResolver as er, ResumeFromTurnBoundary as et, ObligationSeverity as f, toolApprovalDecisionRecordId as fa, readOutstanding as fi, Settlement as fn, DurableSubmitFailure as fr, AdmissionConflict as ft, RecoveryExplanation as g, toolCallResolvedRecordId as ga, LifecyclePublicationConfig as gi, SettlementReservationSnapshot as gn, DurableWorkerRequirements as gr, AdmissionNotAdmitted as gt, RecoveryDisposition as h, toolCallResolutionBatchId as ha, LifecyclePublicationBatch as hi, SettlementReservation as hn, DurableWorkerFailure as hr, AdmissionIndeterminate as ht, ExplainedUnknownCall as i, subagentJoinBatchId as ia, ThreadStoreError as ii, RenewOwnershipRequest as in, DurableObligationFailure as ir, RevertJoining as it, AwaitHostSettlement as j, workerInputRecordId as ja, RunJournalError as ji, SuspensionSnapshot as jn, FenceRejected as jr, ChildReservationId as jt, AwaitChildAdmissionResolution as k, turnResultsBatch as ka, SubmissionStatus_d_exports as ki, SuspensionOutcome as kn, AppendResult as kr, ChildBudgetReservationSnapshot as kt, ObligationBlockedOn as l, subagentRequestedRecordId as la, ThreadWorkerStateRequest as li, ResolutionNeverHappened as ln, DurableRuntimeConfig as lr, AbortIntent as lt, RECOVERY_DECISION_MEANINGS as m, toolCallPreparedRecordId as ma, LifecyclePublication as mi, SettlementFinalization as mn, DurableVerifyFailure as mr, AdmissionGroup as mt, ExplainedEvidence as n, runStartedBatchId as na, ThreadStore as ni, ReleaseChildBudgetRequest as nn, DurableAwaitFailure as nr, ResumeSuspended as nt, IntegrityCheckName as o, subagentLineageBatchId as oa, ThreadStore_d_exports as oi, ReservedSettlement as on, DurableProgressFailure as or, SettleJoinedWithHost as ot, ObligationThresholds as p, toolApprovalRequestRecordId as pa, readWorkerState as pi, SettlementConflict as pn, DurableSubmitOptions as pr, AdmissionFence as pt, RecoveryEvidence as q, definitionDigestsEqual as qa, peerMessageRecordId as qi, submissionSettlementRecordId as qn, ThreadOutstanding as qr, MarkReadyRequest as qt, ExplainedSubmission as r, runStartedRecordId as ra, ThreadStoreDiagnostic as ri, ReleaseOwnershipRequest as rn, DurableExplainFailure as rr, ResumeWaitingParent as rt, IntegrityCheckStatus as s, subagentLineageRecordId as sa, ThreadTail as si, ResolutionAbortSubmission as sn, DurableResolveFailure as sr, classifyRecovery as st, Admin_d_exports as t, runIdForSubmission as ta, ThreadSelection as ti, RecoverySnapshotRequest as tn, DurableApprovalSuspension as tr, ResumePendingToolBatch as tt, ObligationEntry as u, subagentStartedBatchId as ua, getRecord as ui, ResolutionSafeToRetry as un, DurableRuntimeConfigOptions as ur, AbortIntentRequest as ut, RetryRefusalReason as v, toolCallSettledRecordId as va, LifecyclePublicationFact as vi, SubmissionLedger as vn, RecoveryFailure as vr, AdmissionRequest as vt, AppendReservedSettlement as w, turnCanonicalBatch as wa, lifecyclePublicationBatchMaxFacts as wi, SubmissionScheduling as wn, recoveryRepairBatchId as wr, ApprovalPendingSuspension as wt, predictRecoveryDisposition as x, toolStepSettledRecordId as xa, LifecyclePublicationStorage as xi, SubmissionLookup as xn, RecoverySweepResult as xr, ApprovalConflict as xt, RetryRefused as y, toolCallUnknownRecordId as ya, LifecyclePublicationHandler as yi, SubmissionLedgerFailure as yn, RecoveryReport as yr, AdmissionResolution as yt, FinalizeLedgerFromHistory as z, CurrentBindingSelection as za, childThreadIdFor as zi, WorkerStopCommand as zn, ThreadCheckpoints as zr, DEFAULT_OWNERSHIP_LEASE_DURATION as zt };
|
|
4267
|
-
//# sourceMappingURL=Admin-
|
|
4263
|
+
//# sourceMappingURL=Admin-DWDYlvvZ.d.mts.map
|
|
@@ -2,7 +2,7 @@ import { t as AgentId } from "./Identifiers-CN2s30fF.mjs";
|
|
|
2
2
|
import { i as UpdateError, n as Emitter } from "./AgentUpdates-DMJ-_xow.mjs";
|
|
3
3
|
import { r as Configuration } from "./ToolExposure-r2eOWk4F.mjs";
|
|
4
4
|
import { a as AgentInputError, l as AgentRunDispositionError, s as AgentOutputError } from "./AgentError-Bn1ytXRD.mjs";
|
|
5
|
-
import { n as AgentPolicyInput, t as AgentPolicy } from "./AgentPolicy-
|
|
5
|
+
import { n as AgentPolicyInput, t as AgentPolicy } from "./AgentPolicy-B4oH8TbG.mjs";
|
|
6
6
|
import { AiError, LanguageModel, Model, Prompt, Tool, Toolkit } from "effect/unstable/ai";
|
|
7
7
|
import { Effect, Layer, Option, Schema } from "effect";
|
|
8
8
|
//#region src/core/internal/agent-updates.d.ts
|
|
@@ -256,4 +256,4 @@ declare function make<const Name extends string, InputSchema extends Schema.Top,
|
|
|
256
256
|
declare const withModel: <DefinitionValue extends AnyDefinition, ModelValue>(definition: DefinitionValue, model: NativeModel<ModelValue>) => Binding<DefinitionValue, ModelValue>;
|
|
257
257
|
//#endregion
|
|
258
258
|
export { ToolUnion as A, OutputSchema as C, RunDispositionFailure as D, RunDispositionDeclaration as E, isModelResolver as F, make as I, withModel as L, Update as M, UpdatesSchema as N, RunDispositionSchema as O, inspectTools as P, Output as S, RunDisposition as T, InstructionSource as _, CompletionFromToolDeclaration as a, Name as b, Definition as c, EncodedInput as d, Failure as f, InstructionResult as g, InputSchema as h, Binding as i, Tools as j, ToolInspection as k, DefinitionOptions as l, InputPromptSource as m, Any as n, CompletionProjectionInput as o, Input as p, AnyDefinition as r, CompletionToolDeclaration as s, Agent_d_exports as t, DefinitionRequirements as u, ModelResolver as v, Requirements as w, NativeModel as x, ModelServices as y };
|
|
259
|
-
//# sourceMappingURL=Agent-
|
|
259
|
+
//# sourceMappingURL=Agent-ZfnNCQXs.d.mts.map
|
|
@@ -49,6 +49,12 @@ declare const AgentPolicyFields: Schema.Struct<{
|
|
|
49
49
|
readonly runStatus: Schema.Literals<readonly ["appended", "off"]>;
|
|
50
50
|
/** Restart a disposable model call on joined input, at most twice per Run. Default off. */
|
|
51
51
|
readonly restartOnJoinedInput: Schema.optionalKey<Schema.Boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Retries per model call after a retryable `AiError` or a 429/5xx stream error part,
|
|
54
|
+
* before any content. Provider-defined Tools must be `Tool.Readonly`. Exponential
|
|
55
|
+
* backoff honors longer `retryAfter` delays and counts toward `maxDuration`. Default 0.
|
|
56
|
+
*/
|
|
57
|
+
readonly modelRetries: Schema.optionalKey<Schema.Int>;
|
|
52
58
|
readonly compaction: typeof CompactionPolicy;
|
|
53
59
|
}>;
|
|
54
60
|
type AgentPolicyFields = typeof AgentPolicyFields.Type;
|
|
@@ -86,6 +92,12 @@ declare const AgentPolicy_base: Schema.Class<AgentPolicy, Schema.Struct<{
|
|
|
86
92
|
readonly runStatus: Schema.Literals<readonly ["appended", "off"]>;
|
|
87
93
|
/** Restart a disposable model call on joined input, at most twice per Run. Default off. */
|
|
88
94
|
readonly restartOnJoinedInput: Schema.optionalKey<Schema.Boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Retries per model call after a retryable `AiError` or a 429/5xx stream error part,
|
|
97
|
+
* before any content. Provider-defined Tools must be `Tool.Readonly`. Exponential
|
|
98
|
+
* backoff honors longer `retryAfter` delays and counts toward `maxDuration`. Default 0.
|
|
99
|
+
*/
|
|
100
|
+
readonly modelRetries: Schema.optionalKey<Schema.Int>;
|
|
89
101
|
readonly compaction: typeof CompactionPolicy;
|
|
90
102
|
}>, {}>;
|
|
91
103
|
/** Schema class for finite agent run limits. */
|
|
@@ -97,4 +109,4 @@ declare class AgentPolicy extends AgentPolicy_base {
|
|
|
97
109
|
}
|
|
98
110
|
//#endregion
|
|
99
111
|
export { CompactionPolicyInput as a, CompactionPolicy as i, AgentPolicyInput as n, AgentPolicy_d_exports as r, AgentPolicy as t };
|
|
100
|
-
//# sourceMappingURL=AgentPolicy-
|
|
112
|
+
//# sourceMappingURL=AgentPolicy-B4oH8TbG.d.mts.map
|
|
@@ -25,7 +25,7 @@ import { RunEventSink, RunEventSinkClosedError } from "./engine/RunEventSink.mjs
|
|
|
25
25
|
import { AgentUpdateAcceptance, CurrentToolFailureObserver, ModelUsageAccounting, RunContextPreparation, RunResumeUsageSchema, RunToolAuthorization, RunToolScheduling, RunTurnResumeSettledCallSchema } from "./engine/RunOptions.mjs";
|
|
26
26
|
import { ToolBroker, ToolBrokerConfigurationError, ToolBrokerUnavailableError } from "./engine/ToolBroker.mjs";
|
|
27
27
|
import { AiError, LanguageModel, Model, Prompt, Response, ResponseIdTracker, Tool, Toolkit } from "effect/unstable/ai";
|
|
28
|
-
import { Cause, Channel, Clock, Context, DateTime, Duration, Effect, Equal, ErrorReporter, Exit, Fiber, Layer, Metric, Option, PubSub, Queue, Redacted, Result, Schema, SchemaAST, SchemaGetter, Scope, Semaphore, Stream, Tracer } from "effect";
|
|
28
|
+
import { Cause, Channel, Clock, Context, DateTime, Duration, Effect, Equal, ErrorReporter, Exit, Fiber, Layer, Metric, Option, PubSub, Queue, Redacted, Result, Schedule, Schema, SchemaAST, SchemaGetter, Scope, Semaphore, Stream, Tracer } from "effect";
|
|
29
29
|
//#region src/engine/internal/bounded-value.ts
|
|
30
30
|
const DEFAULT_MAX_DEPTH = 128;
|
|
31
31
|
const OBJECT_OVERHEAD_BYTES = 32;
|
|
@@ -2184,6 +2184,17 @@ const snapshotCompactionMessages = Effect.fnUntraced(function* (messages) {
|
|
|
2184
2184
|
})
|
|
2185
2185
|
});
|
|
2186
2186
|
});
|
|
2187
|
+
const HttpStatus = AiError.HttpResponseDetails.fields.status.check(Schema.isBetween({
|
|
2188
|
+
minimum: 100,
|
|
2189
|
+
maximum: 599
|
|
2190
|
+
}));
|
|
2191
|
+
const decodeHttpErrorPayload = Schema.decodeUnknownOption(Schema.Union([Schema.Struct({ code: HttpStatus }), Schema.Struct({ status: HttpStatus })]));
|
|
2192
|
+
/** Native error parts carry unknown payloads; classify only validated HTTP statuses. */
|
|
2193
|
+
const isTransientErrorPayload = (error) => Option.exists(decodeHttpErrorPayload(error), (payload) => AiError.reasonFromHttpStatus({ status: "code" in payload ? payload.code : payload.status }).isRetryable);
|
|
2194
|
+
/** Content streamed before a failure makes the call unsafe to repeat. */
|
|
2195
|
+
const hasStreamedContent = (trace) => trace.toolCalls.size > 0 || trace.parts.some((part) => part.type !== "response-metadata" && part.type !== "error");
|
|
2196
|
+
const MODEL_RETRY_BASE = Duration.seconds(1);
|
|
2197
|
+
const MODEL_RETRY_MAX_DELAY = Duration.seconds(30);
|
|
2187
2198
|
/** Text a provider overflow classification matches against (message + reason). */
|
|
2188
2199
|
const overflowText = (error) => `${error.message} ${error.reason.message}`;
|
|
2189
2200
|
/**
|
|
@@ -2848,6 +2859,7 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
2848
2859
|
context.toolCatalog = catalog;
|
|
2849
2860
|
context.toolExposure = snapshot;
|
|
2850
2861
|
const modelToolkit = Toolkit.make(...snapshot === void 0 ? catalog.filter((entry) => entry.kind === "native").map((entry) => entry.tool) : catalog.filter((entry) => entry.kind === "native" && snapshot?.exposedToolNames.includes(entry.nativeToolName)).map((entry) => entry.tool));
|
|
2862
|
+
const canRepeatModelCall = !Object.values(modelToolkit.tools).some((tool) => Tool.isProviderDefined(tool) && !Context.get(tool.annotations, Tool.Readonly));
|
|
2851
2863
|
if (options.durability !== void 0 && snapshot !== void 0) {
|
|
2852
2864
|
if (options.durability.noteToolExposure === void 0 && context.toolSelection !== void 0) return yield* ModelProtocolError.make({ message: "Durable Tool exposure requires a request snapshot staging hook" });
|
|
2853
2865
|
}
|
|
@@ -3136,8 +3148,30 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
3136
3148
|
trace.usageConsumed = false;
|
|
3137
3149
|
})), Stream.mapEffect((part) => ownModelResponsePart(part, agent.definition.toolkit, trace, context.bufferLimits).pipe(Effect.flatMap((owned) => eventsForPart(context, turnId, turn, agent.definition.toolkit.tools, trace, owned.ownedPart, owned.retainedBytes)))), Stream.flatMap(Stream.fromIterable), Stream.onExit((exit) => Exit.isFailure(exit) ? retainFailedUsage() : Effect.void))));
|
|
3138
3150
|
}))));
|
|
3139
|
-
const
|
|
3140
|
-
|
|
3151
|
+
const attemptWithRetries = Stream.suspend(() => attempt(compactedOutgoing())).pipe(Stream.retry(($) => $(Schedule.exponential(MODEL_RETRY_BASE)).pipe(Schedule.upTo({ times: policy.modelRetries ?? 0 }), Schedule.while(({ input: error }) => {
|
|
3152
|
+
const lastPart = trace.parts.at(-1);
|
|
3153
|
+
return canRepeatModelCall && !hasStreamedContent(trace) && (lastPart?.type === "error" && isTransientErrorPayload(lastPart.error) || AiError.isAiError(error) && error.isRetryable);
|
|
3154
|
+
}), Schedule.modifyDelay(({ input: error, duration }) => {
|
|
3155
|
+
const backoff = Duration.min(duration, MODEL_RETRY_MAX_DELAY);
|
|
3156
|
+
const retryAfter = AiError.isAiError(error) ? error.retryAfter : void 0;
|
|
3157
|
+
return Effect.succeed(retryAfter === void 0 ? backoff : Duration.max(backoff, retryAfter));
|
|
3158
|
+
}), Schedule.tap(({ input: error, attempt: retry, duration }) => Effect.gen(function* () {
|
|
3159
|
+
trace.parts.length = 0;
|
|
3160
|
+
trace.responsePartCount = 0;
|
|
3161
|
+
trace.responsePartBytes = 0;
|
|
3162
|
+
trace.usage = void 0;
|
|
3163
|
+
delete trace.response;
|
|
3164
|
+
delete trace.finishMetadata;
|
|
3165
|
+
yield* Effect.logWarning("agent model call retrying").pipe(Effect.annotateLogs({
|
|
3166
|
+
runId: context.runId,
|
|
3167
|
+
turnId,
|
|
3168
|
+
retry,
|
|
3169
|
+
delayMillis: Duration.toMillis(duration),
|
|
3170
|
+
error: errorMessage(error)
|
|
3171
|
+
}));
|
|
3172
|
+
})))));
|
|
3173
|
+
const response = attemptWithRetries.pipe(Stream.catch((error) => {
|
|
3174
|
+
if (!AiError.isAiError(error) || !isContextOverflowMessage(overflowText(error))) return Stream.fail(error);
|
|
3141
3175
|
const message = overflowText(error);
|
|
3142
3176
|
if (trace.parts.length > 0 || contextTokenLimit === void 0) return Stream.fail(ContextOverflowError.make({
|
|
3143
3177
|
message,
|
|
@@ -3150,7 +3184,7 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
3150
3184
|
context.compaction.overflowRetryTurn = turn;
|
|
3151
3185
|
context.compaction.lastCompactionTurn = turn;
|
|
3152
3186
|
return Stream.unwrap(Effect.gen(function* () {
|
|
3153
|
-
const outcome = yield* compactContext(agent, context, modelContext.prompt, turn, options, callContext === void 0 ? void 0 : contextTokenLimit, messageTokenEstimator, Math.max(0, contextTokenLimit - derivedPromptTokens()), "overflow").pipe(withCallModel).pipe(Effect.mapError((inner) =>
|
|
3187
|
+
const outcome = yield* compactContext(agent, context, modelContext.prompt, turn, options, callContext === void 0 ? void 0 : contextTokenLimit, messageTokenEstimator, Math.max(0, contextTokenLimit - derivedPromptTokens()), "overflow").pipe(withCallModel).pipe(Effect.mapError((inner) => AiError.isAiError(inner) && isContextOverflowMessage(overflowText(inner)) ? ContextOverflowError.make({
|
|
3154
3188
|
message: overflowText(inner),
|
|
3155
3189
|
retried: true
|
|
3156
3190
|
}) : inner));
|
|
@@ -3162,7 +3196,7 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
3162
3196
|
targetTokens: contextTokenLimit,
|
|
3163
3197
|
completionReserveTokens: policy.completionReserveTokens
|
|
3164
3198
|
});
|
|
3165
|
-
const retried =
|
|
3199
|
+
const retried = attemptWithRetries.pipe(Stream.catch((again) => AiError.isAiError(again) && isContextOverflowMessage(overflowText(again)) ? Stream.fail(ContextOverflowError.make({
|
|
3166
3200
|
message: overflowText(again),
|
|
3167
3201
|
retried: true
|
|
3168
3202
|
})) : Stream.fail(again)));
|
|
@@ -3352,7 +3386,7 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
3352
3386
|
if (trace.finishReason !== "stop") return failRunEventStream(ModelProtocolError.make({ message: `Model stopped without a final answer (${trace.finishReason})` }));
|
|
3353
3387
|
return afterValidatedResponse(settleOrFollowUp(historyWithResponse()));
|
|
3354
3388
|
}));
|
|
3355
|
-
const restartSignal = policy.restartOnJoinedInput === true && context.modelRestarts < 2 && (options.durability === void 0 || options.durability.commitModelRestart !== void 0) &&
|
|
3389
|
+
const restartSignal = policy.restartOnJoinedInput === true && context.modelRestarts < 2 && (options.durability === void 0 || options.durability.commitModelRestart !== void 0) && canRepeatModelCall ? options.input?.awaitJoin : void 0;
|
|
3356
3390
|
const disposableResponse = restartSignal !== void 0 ? response.pipe(Stream.interruptWhen(restartSignal.pipe(Effect.tap(() => Effect.sync(() => {
|
|
3357
3391
|
restartRequested = true;
|
|
3358
3392
|
activeModelSpan?.attribute("effect_agent.model.outcome", "aborted");
|
|
@@ -4807,4 +4841,4 @@ var AgentRuntime_exports = /* @__PURE__ */ __exportAll({
|
|
|
4807
4841
|
//#endregion
|
|
4808
4842
|
export { stream as _, SubagentDurability as a, withTerminalDefectEvent as b, decodeFinalOutput as c, projectCompletionOutput as d, renderInputPrompt as f, startUnknown as g, start as h, AgentSpawner as i, encodeRunDisposition as l, runUnknown as m, AgentChildPending as n, SubagentDurabilityError as o, run as p, AgentResultSchema as r, ToolCallWaiting as s, AgentRuntime_exports as t, projectCompletionFromToolOutput as u, streamUnknown as v, streamWithUsageAccountingUnknown as y };
|
|
4809
4843
|
|
|
4810
|
-
//# sourceMappingURL=AgentRuntime-
|
|
4844
|
+
//# sourceMappingURL=AgentRuntime-CVMHysXm.mjs.map
|