@yielded/agent 0.1.0-beta.181 → 0.1.0-beta.183
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-NvXFPDIM.d.mts → Admin-BgCHCGSl.d.mts} +8 -8
- package/dist/{AgentRuntime-Dx5u_FJD.d.mts → AgentRuntime-DhRchFzv.d.mts} +7 -4
- package/dist/{AgentRuntime-BAExRlgu.mjs → AgentRuntime-ILtyHuQG.mjs} +61 -45
- package/dist/AgentRuntime-ILtyHuQG.mjs.map +1 -0
- package/dist/{Digest-DjUgS5PG.d.mts → Digest-1iVcDLVm.d.mts} +2 -2
- package/dist/{Digest-ft4ku9pj.mjs → Digest-CzLJcsWv.mjs} +2 -2
- package/dist/{Digest-ft4ku9pj.mjs.map → Digest-CzLJcsWv.mjs.map} +1 -1
- package/dist/{DurableAgentRuntime-HH2muFrT.mjs → DurableAgentRuntime-Cj263rW9.mjs} +27 -57
- package/dist/DurableAgentRuntime-Cj263rW9.mjs.map +1 -0
- package/dist/{EventSource-DNyaWmyQ.d.mts → EventSource-CaA6RAtC.d.mts} +3 -3
- package/dist/InMemory.d.mts +1 -1
- package/dist/{MessageDelivery-CLzWJImC.d.mts → MessageDelivery-rlLpakO8.d.mts} +43 -43
- package/dist/{PreparedInputAdmission-BQ9UCLFS.d.mts → PreparedInputAdmission-DjbWz2lW.d.mts} +4 -4
- package/dist/{RecordFormat-BNiLpe43.d.mts → RecordFormat-CjMl0uu8.d.mts} +2 -2
- package/dist/{Records-BTnGRdcf.d.mts → Records-BP67Yz6n.d.mts} +20 -8
- package/dist/{Records-CZRedCE7.mjs → Records-bbGVHprv.mjs} +14 -10
- package/dist/Records-bbGVHprv.mjs.map +1 -0
- package/dist/{RunContinuation-CL0wBsQE.d.mts → RunContinuation-CIJRN_vC.d.mts} +5 -4
- package/dist/{RunContinuation-BF95Ncv2.mjs → RunContinuation-DJ6kkbQG.mjs} +22 -58
- package/dist/RunContinuation-DJ6kkbQG.mjs.map +1 -0
- package/dist/{RunEvent-C5jVQZ6K.d.mts → RunEvent-Bh1p4zAO.d.mts} +2 -2
- package/dist/{RunJournal-oJLo-pjS.mjs → RunJournal-DQr2dUgg.mjs} +4 -7
- package/dist/RunJournal-DQr2dUgg.mjs.map +1 -0
- package/dist/{RunOptions-BANtohGk.d.mts → RunOptions-aBHR-Eqm.d.mts} +6 -3
- package/dist/{RunStorage-DlfvMfHM.mjs → RunStorage-DblN-cmM.mjs} +2 -2
- package/dist/{RunStorage-DlfvMfHM.mjs.map → RunStorage-DblN-cmM.mjs.map} +1 -1
- package/dist/{Schedule-CDgTz0vj.d.mts → Schedule-CVLtl5rP.d.mts} +2 -2
- package/dist/{Scheduling-BebkRVc2.mjs → Scheduling-B6l0lWdr.mjs} +3 -3
- package/dist/{Scheduling-BebkRVc2.mjs.map → Scheduling-B6l0lWdr.mjs.map} +1 -1
- package/dist/{Subagent-D68fe7mr.mjs → Subagent-Bm842K7J.mjs} +43 -17
- package/dist/Subagent-Bm842K7J.mjs.map +1 -0
- package/dist/{Subagent-5ulnV6An.d.mts → Subagent-CWWmA1UQ.d.mts} +17 -5
- package/dist/{Subscription-D2yn6Eo3.d.mts → Subscription-BRsNy0TA.d.mts} +4 -4
- package/dist/{SubscriptionInput-Cog4x7Rd.d.mts → SubscriptionInput-ClCaW_kX.d.mts} +3 -3
- package/dist/{ThreadHistory-KPPBJLJb.d.mts → ThreadHistory-ajQhqZDY.d.mts} +2 -2
- package/dist/{ThreadImport-BoTfjjrz.mjs → ThreadImport-CkPAxXU5.mjs} +7 -7
- package/dist/{ThreadImport-BoTfjjrz.mjs.map → ThreadImport-CkPAxXU5.mjs.map} +1 -1
- package/dist/{ThreadImport-em89zmM-.d.mts → ThreadImport-DtRNoHIr.d.mts} +5 -5
- package/dist/{ThreadStore-D2rqtt7k.mjs → ThreadStore-C_ofHc7h.mjs} +4 -4
- package/dist/{ThreadStore-D2rqtt7k.mjs.map → ThreadStore-C_ofHc7h.mjs.map} +1 -1
- package/dist/{ThreadTransfer-BFolkpEp.mjs → ThreadTransfer-C_TRuo_9.mjs} +4 -4
- package/dist/{ThreadTransfer-BFolkpEp.mjs.map → ThreadTransfer-C_TRuo_9.mjs.map} +1 -1
- package/dist/{WorkerAdmission-DrxDrLII.mjs → WorkerAdmission-9Ka3edXj.mjs} +5 -5
- package/dist/{WorkerAdmission-DrxDrLII.mjs.map → WorkerAdmission-9Ka3edXj.mjs.map} +1 -1
- package/dist/{agent-registration-BovXT8jc.mjs → agent-registration-7kp1dHT0.mjs} +4 -4
- package/dist/{agent-registration-BovXT8jc.mjs.map → agent-registration-7kp1dHT0.mjs.map} +1 -1
- package/dist/capabilities/Commands.d.mts +1 -1
- package/dist/capabilities/Redaction.d.mts +1 -1
- package/dist/capabilities/RunHooks.d.mts +1 -1
- package/dist/capabilities/Subagent.d.mts +1 -1
- package/dist/capabilities/Subagent.mjs +1 -1
- package/dist/capabilities/SubagentReservations.d.mts +4 -1
- package/dist/capabilities/SubagentReservations.mjs +4 -1
- package/dist/capabilities/SubagentReservations.mjs.map +1 -1
- package/dist/core/RunEvent.d.mts +1 -1
- package/dist/core/RunEvent.mjs +1 -1
- package/dist/core/RunEvent.mjs.map +1 -1
- package/dist/durable/ActivityStore.d.mts +1 -1
- package/dist/durable/ActivityStore.mjs +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/Admin.mjs +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/AgentRegistration.mjs +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +3 -3
- package/dist/durable/CommittedActivity.mjs +3 -3
- package/dist/durable/Digest.d.mts +1 -1
- package/dist/durable/Digest.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/EventSource.mjs +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
- package/dist/durable/LifecyclePublication.d.mts +1 -1
- package/dist/durable/LifecyclePublication.mjs +2 -2
- package/dist/durable/MessageDelivery.d.mts +1 -1
- package/dist/durable/MessageDelivery.mjs +2 -2
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +42 -42
- package/dist/durable/MessageDeliveryStoreConformance.mjs +2 -2
- package/dist/durable/PersistentHistory.d.mts +2 -2
- package/dist/durable/PersistentHistory.mjs +4 -4
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/RecordFormat.d.mts +1 -1
- package/dist/durable/RecordFormat.mjs +1 -1
- package/dist/durable/Records.d.mts +1 -1
- package/dist/durable/Records.mjs +1 -1
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/Recovery.mjs +1 -1
- package/dist/durable/RunContinuation.d.mts +3 -3
- package/dist/durable/RunContinuation.mjs +3 -3
- 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/Schedule.d.mts +1 -1
- package/dist/durable/Schedule.mjs +1 -1
- package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
- package/dist/durable/ScheduleStoreConformance.mjs +1 -1
- package/dist/durable/ScheduleTransition.d.mts +1 -1
- package/dist/durable/ScheduleTransition.mjs +1 -1
- package/dist/durable/Scheduling.d.mts +3 -3
- package/dist/durable/Scheduling.mjs +1 -1
- package/dist/durable/SettlementPublisher.d.mts +1 -1
- package/dist/durable/SettlementPublisher.mjs +3 -3
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedger.mjs +2 -2
- package/dist/durable/SubmissionLedgerConformance.d.mts +2 -2
- package/dist/durable/SubmissionLedgerConformance.mjs +5 -5
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/Subscription.mjs +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionInput.mjs +2 -2
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
- package/dist/durable/SubscriptionTools.d.mts +4 -4
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/SubscriptionTransition.mjs +1 -1
- package/dist/durable/Subscriptions.d.mts +6 -6
- package/dist/durable/Subscriptions.mjs +2 -2
- package/dist/durable/ThreadArchiveRange.d.mts +1 -1
- package/dist/durable/ThreadArchiveRange.mjs +1 -1
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistory.mjs +2 -2
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.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 +4 -4
- package/dist/durable/ThreadProjection.d.mts +1 -1
- package/dist/durable/ThreadProjection.mjs +1 -1
- 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 +2 -2
- package/dist/durable/ThreadStore.mjs +2 -2
- package/dist/durable/ThreadStoreConformance.d.mts +2 -2
- package/dist/durable/ThreadStoreConformance.mjs +4 -4
- package/dist/durable/ThreadTransfer.d.mts +2 -2
- package/dist/durable/ThreadTransfer.mjs +1 -1
- package/dist/durable/ThreadWork.d.mts +1 -1
- package/dist/durable/ThreadWork.mjs +5 -5
- package/dist/durable/ToolReconciler.mjs +1 -1
- package/dist/durable/WorkerAdmission.d.mts +2 -2
- package/dist/durable/WorkerAdmission.mjs +1 -1
- package/dist/durable/WorkerHost.d.mts +2 -2
- package/dist/engine/AgentRuntime.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/engine/RunOptions.d.mts +1 -1
- package/dist/engine/RunOptions.mjs.map +1 -1
- package/dist/engine/ThreadHistory.d.mts +1 -1
- package/dist/index.d.mts +17 -17
- package/dist/index.mjs +12 -12
- package/dist/{run-context-reader-kpO9xhP2.d.mts → run-context-reader-DEU4REfD.d.mts} +3 -3
- package/package.json +1 -1
- package/src/capabilities/Subagent.ts +83 -28
- package/src/capabilities/SubagentReservations.ts +4 -1
- package/src/capabilities/internal/subagent-contract.ts +23 -3
- package/src/core/RunEvent.ts +1 -1
- package/src/durable/DurableAgentRuntime.ts +64 -14
- package/src/durable/Records.ts +21 -15
- package/src/durable/RunContinuation.ts +64 -125
- package/src/durable/RunJournal.ts +4 -12
- package/src/durable/internal/history-prompt.ts +10 -4
- package/src/durable/internal/initial-context.ts +1 -1
- package/src/durable/internal/prompt-history-cache.ts +8 -63
- package/src/engine/RunOptions.ts +4 -1
- package/src/engine/internal/agent-runtime.ts +422 -387
- package/dist/AgentRuntime-BAExRlgu.mjs.map +0 -1
- package/dist/DurableAgentRuntime-HH2muFrT.mjs.map +0 -1
- package/dist/Records-CZRedCE7.mjs.map +0 -1
- package/dist/RunContinuation-BF95Ncv2.mjs.map +0 -1
- package/dist/RunJournal-oJLo-pjS.mjs.map +0 -1
- package/dist/Subagent-D68fe7mr.mjs.map +0 -1
- package/dist/json-BlJVQZxN.mjs +0 -15
- package/dist/json-BlJVQZxN.mjs.map +0 -1
|
@@ -4,8 +4,8 @@ import { a as Receipt, i as QueueSequence, n as JoinedToHost, r as Principal, t
|
|
|
4
4
|
import { r as Update } from "./AgentUpdates-DksV4D0A.mjs";
|
|
5
5
|
import { c as Selection, l as Snapshot } from "./ToolExposure-jTheYXrK.mjs";
|
|
6
6
|
import { l as RunUsageSummary, r as ModelCallUsage } from "./Usage-CzZJ6A2n.mjs";
|
|
7
|
-
import { a as ExhaustedLimit } from "./RunEvent-
|
|
8
|
-
import { t as ThreadHistory } from "./ThreadHistory-
|
|
7
|
+
import { a as ExhaustedLimit } from "./RunEvent-Bh1p4zAO.mjs";
|
|
8
|
+
import { t as ThreadHistory } from "./ThreadHistory-ajQhqZDY.mjs";
|
|
9
9
|
import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-DvHruCSJ.mjs";
|
|
10
10
|
import { o as AgentInputError } from "./AgentError-CBH7_MjG.mjs";
|
|
11
11
|
import { t as ToolParameterRejection } from "./ToolResult-5SdG8FE2.mjs";
|
|
@@ -13,17 +13,17 @@ import { t as AgentPolicy } from "./AgentPolicy-B4lbCU2T.mjs";
|
|
|
13
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-B39jRnFv.mjs";
|
|
14
14
|
import { t as RunPolicyUsage } from "./RunPolicyUsage-QmYVw9z8.mjs";
|
|
15
15
|
import { c as WorkerError, f as WorkerRef, n as AssignmentTerminal } from "./Worker-CLYgfqhF.mjs";
|
|
16
|
-
import { G as RunToolAuthorization, O as RunCostEstimator, h as RunApprovalHook, ot as RunTurnToolResult, x as RunContextPreparation } from "./RunOptions-
|
|
16
|
+
import { G as RunToolAuthorization, O as RunCostEstimator, h as RunApprovalHook, ot as RunTurnToolResult, x as RunContextPreparation } from "./RunOptions-aBHR-Eqm.mjs";
|
|
17
17
|
import { o as MessagingError, r as InputMessage } from "./Messaging-DF_IWnxV.mjs";
|
|
18
18
|
import { t as MessagingHost } from "./MessagingHost-BKxDskYj.mjs";
|
|
19
19
|
import "./Messaging-DpEZMTVE.mjs";
|
|
20
20
|
import { d as WorkerReportPreparationFailure, f as WorkerReporting, o as SubagentHost } from "./SubagentHost-CikdGpmk.mjs";
|
|
21
|
-
import { p as RuntimeBinding, r as AgentCompletionProjectionRequirements, s as AgentRuntimeRequirements } from "./AgentRuntime-
|
|
22
|
-
import { $ as RecordEnvelope, Ct as ToolApprovalDecided, Dt as ToolCallSettled, H as ModelResponseRecorded, It as WorkerInputCompleted, K as PersistedJson, Mt as UserInputRecorded, Pt as WorkerAdmission, Rt as WorkerInputRequested, W as PROMPT_EVIDENCE_TAGS, Wt as WorkerStopRequested, Y as PromptRecordEnvelope, _t as SubagentRequested, a as BatchId, b as DefinitionDigests, bt as SubmissionSettledRecord, d as CanonicalRecordEnvelope, et as RecordId, ft as RunStartedRecord, ht as SubagentJoined, i as ApprovalDecision, l as CanonicalBatch, m as CompactionCreated, p as CanonicalSequence, pt as SettlementFailureDiagnostic, q as ProducerId, r as AgentUpdateEmitted, st as RunContinuation, t as AbortRequested, tt as RecordJson, v as DeclaredToolCall, vt as SubagentStarted, wt as ToolApprovalRequested, x as DeploymentId, y as DefinitionDigestInput, yt as SubmissionSettled } from "./Records-
|
|
23
|
-
import { t as DigestError } from "./Digest-
|
|
21
|
+
import { p as RuntimeBinding, r as AgentCompletionProjectionRequirements, s as AgentRuntimeRequirements } from "./AgentRuntime-DhRchFzv.mjs";
|
|
22
|
+
import { $ as RecordEnvelope, Ct as ToolApprovalDecided, Dt as ToolCallSettled, H as ModelResponseRecorded, It as WorkerInputCompleted, K as PersistedJson, Mt as UserInputRecorded, Pt as WorkerAdmission, Rt as WorkerInputRequested, W as PROMPT_EVIDENCE_TAGS, Wt as WorkerStopRequested, Y as PromptRecordEnvelope, _t as SubagentRequested, a as BatchId, b as DefinitionDigests, bt as SubmissionSettledRecord, d as CanonicalRecordEnvelope, et as RecordId, ft as RunStartedRecord, ht as SubagentJoined, i as ApprovalDecision, l as CanonicalBatch, m as CompactionCreated, p as CanonicalSequence, pt as SettlementFailureDiagnostic, q as ProducerId, r as AgentUpdateEmitted, st as RunContinuation, t as AbortRequested, tt as RecordJson, v as DeclaredToolCall, vt as SubagentStarted, wt as ToolApprovalRequested, x as DeploymentId, y as DefinitionDigestInput, yt as SubmissionSettled } from "./Records-BP67Yz6n.mjs";
|
|
23
|
+
import { t as DigestError } from "./Digest-1iVcDLVm.mjs";
|
|
24
24
|
import { n as DurableRuntimeFailpoint, r as DurableRuntimeFailpointError } from "./DurableFailpoint-BugHZKvJ.mjs";
|
|
25
25
|
import { o as OperationDenied } from "./OperationAuthorizer-TzcQtpX5.mjs";
|
|
26
|
-
import { r as ExportedRecord } from "./RecordFormat-
|
|
26
|
+
import { r as ExportedRecord } from "./RecordFormat-CjMl0uu8.mjs";
|
|
27
27
|
import { s as ToolReconciler } from "./ToolReconciler-SrOHkvF8.mjs";
|
|
28
28
|
import { t as WakeScheduler } from "./WakeScheduler-DJIMMf77.mjs";
|
|
29
29
|
import { Brand, Cause, Context, Crypto, DateTime, Duration, Effect, Layer, Option, Result, Schema, Scope, Stream } from "effect";
|
|
@@ -5837,4 +5837,4 @@ declare const RetryRefused_base: Schema.Class<RetryRefused, Schema.TaggedStruct<
|
|
|
5837
5837
|
declare class RetryRefused extends RetryRefused_base {}
|
|
5838
5838
|
//#endregion
|
|
5839
5839
|
export { ResumeFromTurnBoundary as $, ThreadArchiveRangePublish as $a, ThreadWorkerCapacity as $i, DurableAwaitFailure as $n, subagentJoinedRecordId as $o, ExecutionCheckpoint as $r, RecoverySnapshotRequest as $t, AwaitHostSettlement as A, WorkIndexProgress as Aa, ThreadIdentity as Ai, WaitingChild as An, agentUpdateRecordId as Ao, SubmissionStatus_d_exports as Ar, BindingSelection as As, ChildReservationConflict as At, NoAction as B, deliveryPredecessor as Ba, ThreadRecordRequest as Bi, submissionSettlementBatchId as Bn, modelResponseInterruptedRecordId as Bo, SettlementPublication as Br, definitionDigestsEqual as Bs, FundingOwnerRequest as Bt, renderRecoveryExplanation as C, ThreadWorkPage as Ca, ThreadExportBatch as Ci, SuspensionReason as Cn, JournalBoundary as Co, recoveryRepairBatchId as Cr, workerOriginRecordId as Cs, ApprovalDecisionIntent as Ct, AwaitApprovalDecision as D, WORK_INDEX_VERSION as Da, ThreadExportRequest as Di, UnknownResolutionConflict as Dn, RunJournalUsage as Do, PendingSubmission as Dr, AgentRegistration_d_exports as Ds, ChildAttachmentSnapshot as Dt, ApplyUnknownResolutions as E, ThreadWork_d_exports as Ea, ThreadExportRejected as Ei, UnknownResolutionCommand as En, RunJournalProjection as Eo, threadCreatedRecordId as Er, toolCallSettledRecordId as Es, BeginChildBudgetReleaseRequest as Et, DeclaredPendingBatchEvidence as F, WorkThreadsRequest as Fa, ThreadPeerCountRequest as Fi, settlementFailureFromRecord as Fn, compactionRecordId as Fo, RunStorageSession as Fr, ExecutableAgentBinding as Fs, Claim as Ft, RecoveryDecision as G, workId as Ga, ThreadStoreDiagnostic as Gi, workerTerminalFromRecord as Gn, promptFromCanonicalRecords as Go, validateCanonicalSettlement as Gr, LedgerError as Gt, OpenToolCallEvidence as H, operationEvidence as Ha, ThreadRunInputRequest as Hi, submissionSettlementRecordId as Hn, peerMessageRecordId as Ho, SettlementPublicationFailure as Hr, JoinSnapshot as Ht, DelegationAdmissionEvidence as I, WorkerReportingMode as Ia, ThreadPromptRead as Ii, submissionAbortBatchId as In, firstWorkerInputRecordId as Io, RunWriter as Ir, ReplayVersions as Is, ClaimHandoff as It, ReleaseOrphanChildReservation as J, MAX_ARCHIVE_RANGE_PAGE as Ja, ThreadStore_d_exports as Ji, DurableAgentRuntime as Jn, runDurationRecordId as Jo, AppendConflict as Jr, MarkReadyRequest as Jt, RecoveryEvidence as K, workIndexChanges as Ka, ThreadStoreError as Ki, ApprovalSuspensionError as Kn, runCompletedRecordId as Ko, validateJoinedSettlement as Kr, MarkInputAppliedRequest as Kt, EnsureWaitingForChild as L, admissionWork as La, ThreadRead as Li, submissionAbortRecordId as Ln, initialRunJournal as Lo, layer as Lr, ResolvedBinding as Ls, ClaimJoiningRequest as Lt, AwaitUnknownResolution as M, WorkOwner as Ma, ThreadMaterialization as Mi, WorkerLedgerState as Mn, childIdempotencyKeyFor as Mo, RunChildBudgetReservation as Mr, CurrentBindingSelection as Ms, ChildReservationStatus as Mt, CompleteChildAdmission as N, WorkStateReference as Na, ThreadNotMaterialized as Ni, WorkerStopCommand as Nn, childThreadIdFor as No, RunOwnership as Nr, DurableBindingFailure as Ns, ChildSettledNotification as Nt, AwaitChildAdmissionResolution as O, WorkDiscoveryUnavailable as Oa, ThreadExportSnapshot as Oi, UnknownResolutionIntent as On, RunJournal_d_exports as Oo, SettledSubmission as Or, AgentAttemptContext as Os, ChildBudgetReservationRequest as Ot, CompleteMaterialization as P, WorkThreadsPage as Pa, ThreadObservation as Pi, approvalDecisionsCover as Pn, compactionBatchId as Po, RunStorage as Pr, DurableWorkerBinding as Ps, ChildSettledOutcome as Pt, RepairSubagentStartLink as Q, ThreadArchiveRangePage as Qa, ThreadVerificationStorage as Qi, DurableApprovalSuspension as Qn, subagentJoinBatchId as Qo, CommitBatch as Qr, RecoverySnapshot as Qt, FinalizeLedgerFromHistory as R, advanceWorkEntry as Ra, ThreadReadRequest as Ri, submissionInputBatchId as Rn, markUnknownBatchId as Ro, make as Rr, compileBindingContracts as Rs, ClaimRequest as Rt, recoveryDecisionMeaning as S, ThreadWorkEntry as Sa, ThreadExport as Si, SuspensionOutcome as Sn, makeStorageOwner as So, isolateRecovery as Sr, workerInputRecordId as Ss, ApprovalDecisionCommand as St, ApplyJoinAccounting as T, ThreadWorkStorage as Ta, ThreadExportRecord as Ti, UnknownResolution as Tn, RunJournalError as To, threadCreatedBatchId as Tr, JournalRecordEnvelope as Ts, AttachChildToReservationRequest as Tt, PendingApprovalEvidence as U, resolveWorkEvidence as Ua, ThreadSelection as Ui, unknownResolutionKind as Un, projectRunJournal as Uo, SettlementPublicationResult as Ur, JoiningClaim as Ut, OpenDelegationCallEvidence as V, encodeWorkCursor as Va, ThreadResolutionFact as Vi, submissionSettlementId as Vn, modelResponseRecordId as Vo, SettlementPublicationAuthority as Vr, InputAppliedMarker as Vt, PropagateChildAbort as W, validateWorkPage as Wa, ThreadStore as Wi, unknownResolutionMatchesResult as Wn, projectRunJournalStream as Wo, SettlementPublisher as Wr, LedgerCapabilities as Wt, RepairJoinMarker as X, MAX_CANONICAL_BATCH_BYTES as Xa, ThreadTailRequest as Xi, DurableApprovalFailure as Xn, runStartedBatchId as Xo, AppendResult as Xr, OwnershipLost as Xt, RepairInputMarker as Y, MAX_ARCHIVE_RANGE_RECORDS as Ya, ThreadTail as Yi, DurableAgentRuntime_d_exports as Yn, runIdForSubmission as Yo, AppendRequest as Yr, MarkUnknownRequest as Yt, RepairReadiness as Z, ThreadArchiveRange as Za, ThreadVerificationRequest as Zi, DurableApprovalResolver as Zn, runStartedRecordId as Zo, CheckpointRejected as Zr, ParentLinkage as Zt, RetryCommand as _, MAX_WORK_PAGE_ENTRIES as _a, ThreadAdmission as _i, SubmissionScheduling as _n, ProgressAppendRecord as _o, RecoverySweepOptions as _r, turnIdForRun as _s, AdmissionPolicyError as _t, IntegrityCheck as a, getRunInput as aa, MAX_PROMPT_CHECKPOINT_RUNS as ai, ResolutionSafeToRetry as an, LifecyclePublication as ao, DurableRetryFailure as ar, subagentStartedRecordId as as, SettleJoinedWithHost as at, obligationSeverityOf as b, ThreadWorkCursor as ba, ThreadCheckpoints as bi, SubmissionWorkItem as bn, StorageOwner as bo, WorkRecoveryRequest as br, turnResultsBatch as bs, AdmissionResult as bt, IntegrityReport as c, streamExport as ca, MAX_THREAD_EXPORT_PAGE_RECORDS as ci, SettlementConflict as cn, LifecyclePublicationError as co, DurableSubmitAgent as cr, toolCallResolutionBatchId as cs, AbortCommand as ct, ObligationReport as d, FreshAdmissionWork as da, PromptCheckpointHead as di, SubmissionLedger as dn, LifecyclePublicationSource as do, DurableVerifyFailure as dr, toolCallUnknownRecordId as ds, AdmissionAdmitted as dt, ThreadWorkerCapacityRequest as ea, ExecutionRead as ei, ReleaseChildBudgetRequest as en, ThreadArchiveRangeRead as eo, DurableExplainFailure as er, subagentLineageBatchId as es, ResumePendingToolBatch as et, ObligationSeverity as f, MAX_RECOVERY_PAGES as fa, PromptCheckpointRead as fi, SubmissionLedgerFailure as fn, LifecyclePublicationStorage as fo, DurableWorkerFailure as fr, toolStepSettledBatchId as fs, AdmissionConflict as ft, RecoveryExplanation as g, MAX_WORK_PAGE_BYTES as ga, ThreadAbortFact as gi, SubmissionLookupByKey as gn, lifecyclePublicationLayer as go, RecoveryReport as gr, turnCanonicalBatch as gs, AdmissionNotAdmitted as gt, RecoveryDisposition as h, MAX_WORK_ENTRY_BYTES as ha, SelectedThreadRead as hi, SubmissionLookupById as hn, lifecyclePublicationBatchMaxFacts as ho, RecoveryFailure as hr, turnBatchId as hs, AdmissionIndeterminate as ht, ExplainedUnknownCall as i, getRecord as ia, MAX_PROMPT_CHECKPOINT_BYTES as ii, ResolutionNeverHappened as in, ThreadArchiveStorage as io, DurableResolveFailure as ir, subagentStartedBatchId as is, SettleAborted as it, AwaitParentEstablishment as j, WorkIndexRebuildRequest as ja, ThreadIdentityRequest as ji, WaitingForChildSuspension as jn, approvalDecisionBatchId as jo, RunChildAttachment as jr, BindingUnavailable as js, ChildReservationId as jt, AwaitChildSettlement as k, WorkIndexChange as ka, ThreadExportSource as ki, UnknownResolutionKind as kn, TurnCommitInput as ko, SubmissionStatus as kr, AgentRegistration as ks, ChildBudgetReservationSnapshot as kt, ObligationBlockedOn as l, transferPageFits as la, PreparedAppend as li, SettlementFinalization as ln, LifecyclePublicationFact as lo, DurableSubmitFailure as lr, toolCallResolvedRecordId as ls, AbortIntent as lt, RECOVERY_DECISION_MEANINGS as m, MAX_WORK_CURSOR_CHARS as ma, SaveCheckpointRequest as mi, SubmissionLookup as mn, drainLifecyclePublications as mo, RecoveryBlocked as mr, turnApprovalsBatchId as ms, AdmissionGroup as mt, ExplainedEvidence as n, ThreadWorkerStateRequest as na, FreshRunRead as ni, ResolutionAbortSubmission as nn, ThreadArchiveRangeSeal as no, DurableObserveOptions as nr, subagentRequestedBatchId as ns, ResumeWaitingParent as nt, IntegrityCheckName as o, makeTransferFactCheck as oa, MAX_THREAD_EXPORT_CURSOR_CHARS as oi, RevertJoiningRequest as on, LifecyclePublicationBatch as oo, DurableRuntimeConfig as or, toolApprovalDecisionRecordId as os, classifyRecovery as ot, ObligationThresholds as p, MAX_RECOVERY_WORK_ITEMS as pa, PromptCheckpoints as pi, SubmissionLedger_d_exports as pn, LifecyclePublication_d_exports as po, DurableWorkerRequirements as pr, toolStepSettledRecordId as ps, AdmissionFence as pt, Recovery_d_exports as q, MAX_ARCHIVE_RANGE_BYTES as qa, ThreadStoreFailure as qi, DurableAbortFailure as qn, runDurationBatchId as qo, validatePublication as qr, MarkJoinedRequest as qt, ExplainedSubmission as r, canonicalBatchFitsTransfer as ra, LoadCheckpointRequest as ri, ResolutionCompletedWithResult as rn, ThreadArchiveRange_d_exports as ro, DurableProgressFailure as rr, subagentRequestedRecordId as rs, RevertJoining as rt, IntegrityCheckStatus as s, readWorkerState as sa, MAX_THREAD_EXPORT_PAGE_BYTES as si, Settlement as sn, LifecyclePublicationConfig as so, DurableRuntimeConfigOptions as sr, toolApprovalRequestRecordId as ss, pendingApprovalForRecovery as st, Admin_d_exports as t, ThreadWorkerSeal as ta, ExecutionUpdate as ti, ReservedChildBudget as tn, ThreadArchiveRangeRequest as to, DurableObligationFailure as tr, subagentLineageRecordId as ts, ResumeSuspended as tt, ObligationEntry as u, CanonicalWorkEntry as ua, PromptCheckpoint as ui, SubmissionAdmissionFence as un, LifecyclePublicationHandler as uo, DurableSubmitOptions as ur, toolCallResultBatchId as us, AbortIntentRequest as ut, RetryRefusalReason as v, MAX_WORK_REBUILD_BYTES as va, ThreadApprovalFact as vi, SubmissionSnapshot as vn, MutationGate as vo, RecoverySweepResult as vr, turnResponseBatch as vs, AdmissionRequest as vt, ApplyInput as w, ThreadWorkRequest as wa, ThreadExportCursor as wi, SuspensionSnapshot as wn, RunJournalContext as wo, recoveryRepairRecordId as wr, workerReportRecordId as ws, ApprovalPendingSuspension as wt, predictRecoveryDisposition as x, ThreadWorkDiscovery as xa, ThreadCommands as xi, SuspendRequest as xn, StorageOwnerService as xo, childReservationIdFor as xr, turnResultsBatchId as xs, ApprovalConflict as xt, RetryRefused as y, MAX_WORK_REBUILD_RECORDS as ya, ThreadCheckpoint as yi, SubmissionState as yn, OwnerGeneration as yo, WorkRecoveryReport as yr, turnResponseBatchId as ys, AdmissionResolution as yt, MarkUnknown as z, decodeWorkCursor as za, ThreadReader as zi, submissionInputRecordId as zn, modelResponseInterruptedBatchId as zo, makeRunWriter as zr, compileRegistrations as zs, FundingOwner as zt };
|
|
5840
|
-
//# sourceMappingURL=Admin-
|
|
5840
|
+
//# sourceMappingURL=Admin-BgCHCGSl.d.mts.map
|
|
@@ -2,8 +2,8 @@ import { d as ToolCallId, r as DelegationId, s as RunId, t as AgentId, u as Thre
|
|
|
2
2
|
import { i as SubagentBudgetReservation, l as SubagentGrant, u as SubagentParentLink } from "./SubagentContract-DdPzxYQj.mjs";
|
|
3
3
|
import { i as UpdateError, n as Emitter } from "./AgentUpdates-DksV4D0A.mjs";
|
|
4
4
|
import { c as RunUsageReport, s as RunTotals } from "./Usage-CzZJ6A2n.mjs";
|
|
5
|
-
import { u as RunEvent } from "./RunEvent-
|
|
6
|
-
import { n as ThreadHistoryError, t as ThreadHistory } from "./ThreadHistory-
|
|
5
|
+
import { u as RunEvent } from "./RunEvent-Bh1p4zAO.mjs";
|
|
6
|
+
import { n as ThreadHistoryError, t as ThreadHistory } from "./ThreadHistory-ajQhqZDY.mjs";
|
|
7
7
|
import { n as CurrentToolCatalog } from "./ToolExposure-DFQKf9ET.mjs";
|
|
8
8
|
import { s as ToolBroker } from "./ToolBroker-P5t4ZN78.mjs";
|
|
9
9
|
import { c as AgentOutputError, f as AgentToolAuthorizationCheckError, g as ModelProtocolError, h as ContextOverflowError, l as AgentPersistenceCapacityError, m as ContextBudgetError, n as AgentApprovalPending, o as AgentInputError, p as AgentToolAuthorizationDenied, t as AgentApprovalDenied, u as AgentPolicyError } from "./AgentError-CBH7_MjG.mjs";
|
|
@@ -13,7 +13,7 @@ import { a as WorkerBudgetScope } from "./Worker-CLYgfqhF.mjs";
|
|
|
13
13
|
import { a as ContextWindow } from "./ContextWindow-Cvv8N9Xy.mjs";
|
|
14
14
|
import { n as CompactionError } from "./ContextCompactor-Bz91grmO.mjs";
|
|
15
15
|
import { t as DurableStep } from "./DurableStep-CAJnlgfL.mjs";
|
|
16
|
-
import { B as RunSubagentChildIdentity, H as RunSubagentEstablishRequest, M as RunOptions, S as RunContextPreparationError, W as RunSubagentJoinRequest, i as ChildEstablishStatus, l as ModelUsageAccounting, t as AgentUpdateAcceptance, x as RunContextPreparation } from "./RunOptions-
|
|
16
|
+
import { B as RunSubagentChildIdentity, H as RunSubagentEstablishRequest, M as RunOptions, S as RunContextPreparationError, W as RunSubagentJoinRequest, i as ChildEstablishStatus, l as ModelUsageAccounting, t as AgentUpdateAcceptance, x as RunContextPreparation } from "./RunOptions-aBHR-Eqm.mjs";
|
|
17
17
|
import { t as MessagingHost } from "./MessagingHost-BKxDskYj.mjs";
|
|
18
18
|
import { o as SubagentHost } from "./SubagentHost-CikdGpmk.mjs";
|
|
19
19
|
import { t as RunEventSink } from "./RunEventSink-shh6Qf9E.mjs";
|
|
@@ -29,6 +29,7 @@ import * as Cause from "effect/Cause";
|
|
|
29
29
|
import * as LanguageModel$1 from "effect/ai/LanguageModel";
|
|
30
30
|
import * as Model$1 from "effect/ai/Model";
|
|
31
31
|
import * as Prompt$1 from "effect/ai/Prompt";
|
|
32
|
+
import * as DateTime from "effect/DateTime";
|
|
32
33
|
import * as Layer from "effect/Layer";
|
|
33
34
|
import * as Scope from "effect/Scope";
|
|
34
35
|
import "effect/Tracer";
|
|
@@ -315,6 +316,8 @@ interface SpawnedChildRun<Output, Error> extends DetachedRun<Output, Error> {
|
|
|
315
316
|
interface AgentSpawnerService {
|
|
316
317
|
/** Resolved defaults for this parent Run; never includes its tools or handlers. */
|
|
317
318
|
readonly policy: AgentPolicy;
|
|
319
|
+
/** Effective deadline of this active parent execution, including RunOptions.durationDeadline. */
|
|
320
|
+
readonly durationDeadline: DateTime.Utc;
|
|
318
321
|
readonly depth: number;
|
|
319
322
|
readonly grant?: SubagentGrant;
|
|
320
323
|
readonly budget?: SubagentBudgetReservation;
|
|
@@ -359,4 +362,4 @@ declare namespace AgentRuntime_d_exports {
|
|
|
359
362
|
}
|
|
360
363
|
//#endregion
|
|
361
364
|
export { runUnknown as A, decodeFinalOutput as C, projectCompletionOutput as D, projectCompletionFromToolOutput as E, streamWithUsageAccountingUnknown as F, withTerminalDefectEvent as I, startUnknown as M, stream as N, renderInputPrompt as O, streamUnknown as P, ToolCallWaiting as S, executeWithUsageAccountingUnknown as T, SubagentDurability as _, AgentResultSchema as a, SubagentDurabilityError as b, AgentSpawner as c, DetachedRun as d, EngineProvidedToolServices as f, SpawnedChildRun as g, SpawnRunOptions as h, AgentResult as i, start as j, run as k, AgentSpawnerParent as l, SpawnDelegation as m, AgentChildPending as n, AgentRuntimeFailure as o, RuntimeBinding as p, AgentCompletionProjectionRequirements as r, AgentRuntimeRequirements as s, AgentRuntime_d_exports as t, AgentSpawnerService as u, SubagentDurabilityDurable as v, encodeRunDisposition as w, SubagentDurabilityService as x, SubagentDurabilityEphemeral as y };
|
|
362
|
-
//# sourceMappingURL=AgentRuntime-
|
|
365
|
+
//# sourceMappingURL=AgentRuntime-DhRchFzv.d.mts.map
|
|
@@ -8,7 +8,6 @@ import { n as getToolExecutionClass } from "./tool-execution-Ba7tO7Pt.mjs";
|
|
|
8
8
|
import { i as isModelResolver, s as nativeUpdateId } from "./Agent-B3J0B4l6.mjs";
|
|
9
9
|
import { AgentApprovalDenied, AgentApprovalPending, AgentInputDecodeError, AgentInputError, AgentOutputError, AgentPersistenceCapacityError, AgentPolicyError, AgentRunDispositionError, AgentToolAuthorizationDenied, ContextBudgetError, ContextOverflowError, ModelProtocolError } from "./core/AgentError.mjs";
|
|
10
10
|
import { IdGenerator } from "./core/IdGenerator.mjs";
|
|
11
|
-
import { t as copyJson } from "./json-BlJVQZxN.mjs";
|
|
12
11
|
import { DelegationDepth, SubagentParentLink, getToolExecutionKind, isSubagentToolAllowed } from "./core/SubagentContract.mjs";
|
|
13
12
|
import { a as PinnedTool, c as ToolNames, i as Limits, l as ToolNamespace, n as DiscoveryTool, o as Selection, r as IncludesCatalogDocumentation, s as Snapshot, t as AdditionalToolCatalog } from "./ToolExposure-hTJT2ekj.mjs";
|
|
14
13
|
import { InputTokenUsage, ModelCallUsage, ModelResponseIdentity, OutputTokenUsage, RunTotals, RunUsageReport, emptyRunTotals, sumRunTotals, unknownRunTotals } from "./core/Usage.mjs";
|
|
@@ -63,6 +62,18 @@ import * as SchemaGetter from "effect/SchemaGetter";
|
|
|
63
62
|
import * as Scope from "effect/Scope";
|
|
64
63
|
import * as Semaphore from "effect/Semaphore";
|
|
65
64
|
import * as Tracer from "effect/Tracer";
|
|
65
|
+
//#region src/core/internal/json.ts
|
|
66
|
+
/** Own a validated JSON value before exposing a separate copy to application callbacks. */
|
|
67
|
+
const copyJson = (value) => {
|
|
68
|
+
if (value === null || typeof value !== "object") return value;
|
|
69
|
+
if (Array.isArray(value)) {
|
|
70
|
+
const copied = [];
|
|
71
|
+
for (let index = 0; index < value.length; index++) copied.push(copyJson(value[index]));
|
|
72
|
+
return copied;
|
|
73
|
+
}
|
|
74
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, copyJson(entry)]));
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
66
77
|
//#region src/engine/internal/bounded-value.ts
|
|
67
78
|
const DEFAULT_MAX_DEPTH = 128;
|
|
68
79
|
const OBJECT_OVERHEAD_BYTES = 32;
|
|
@@ -919,6 +930,7 @@ const acceptTurnCommit = (context, trace, durability, commit) => Effect.suspend(
|
|
|
919
930
|
if (trace.commitFailed) return Effect.void;
|
|
920
931
|
const accepted = checkpointExecution(context, durability).pipe(Effect.andThen(() => durability?.commitTurn(commit) ?? Effect.succeed("committed")));
|
|
921
932
|
return Effect.onExitPrimitive(Effect.flatMap(accepted, (receipt) => {
|
|
933
|
+
if (receipt === "capacity-refused") return commit._tag === "Response" && trace.responseCommitted !== true ? Effect.succeed(receipt) : Effect.fail(ModelProtocolError.make({ message: "Durability refused capacity after response acceptance" }));
|
|
922
934
|
if (receipt === "deferred") return commit._tag === "Response" && commit.defer === true ? Effect.void : Effect.fail(ModelProtocolError.make({ message: "Durability deferred an ineligible Turn commit" }));
|
|
923
935
|
if (commit._tag !== "Partial") {
|
|
924
936
|
if (commit.response !== void 0) {
|
|
@@ -951,7 +963,7 @@ const settleTurn = (context, trace, turn, turnId, options, completion) => option
|
|
|
951
963
|
...response === void 0 ? {} : { response },
|
|
952
964
|
results,
|
|
953
965
|
...completion === void 0 ? {} : { completion }
|
|
954
|
-
}));
|
|
966
|
+
}).pipe(Effect.asVoid));
|
|
955
967
|
});
|
|
956
968
|
const MAX_STAGED_PROVIDER_EVENTS = 256;
|
|
957
969
|
const MAX_STAGED_PROVIDER_BYTES = 1048576;
|
|
@@ -1028,10 +1040,9 @@ const schemaClassToolPartPreflight = (part, toolkit) => {
|
|
|
1028
1040
|
return;
|
|
1029
1041
|
}
|
|
1030
1042
|
};
|
|
1031
|
-
const inspectModelResponsePartCapacity = (usage, part, limits, knownSafePrototypes = knownSafeModelResponsePrototypes) =>
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
});
|
|
1043
|
+
const inspectModelResponsePartCapacity = (usage, part, limits, knownSafePrototypes = knownSafeModelResponsePrototypes) => {
|
|
1044
|
+
return boundedValueFootprint(part, limits.maxModelResponseBytes - usage.responsePartBytes, knownSafePrototypes) ?? ModelProtocolError.make({ message: `Model response exceeded the ${limits.maxModelResponseBytes}-byte retained response limit` });
|
|
1045
|
+
};
|
|
1035
1046
|
/**
|
|
1036
1047
|
* LanguageModel validates encoded parameters even with automatic resolution disabled.
|
|
1037
1048
|
* Defer only recoverable application parameter validation; the declaration's JSON codec
|
|
@@ -1067,22 +1078,25 @@ const modelResponseParsersFor = (toolkit) => {
|
|
|
1067
1078
|
modelResponseParsers.set(toolkit, parsers);
|
|
1068
1079
|
return parsers;
|
|
1069
1080
|
};
|
|
1070
|
-
const captureModelResponsePartGeneral = Effect.
|
|
1081
|
+
const captureModelResponsePartGeneral = Effect.fnUntracedEager(function* (part, toolkit, usage, limits) {
|
|
1071
1082
|
if (usage.responsePartCount >= limits.maxModelResponseParts) return yield* ModelProtocolError.make({ message: `Model response exceeded the ${limits.maxModelResponseParts}-part response limit` });
|
|
1072
1083
|
if (boundedValueFootprint(part, limits.maxModelResponseBytes - usage.responsePartBytes, knownSafeModelResponsePrototypes) === void 0) {
|
|
1073
1084
|
const preflight = schemaClassToolPartPreflight(part, toolkit);
|
|
1074
|
-
|
|
1085
|
+
const capacity = inspectModelResponsePartCapacity(usage, preflight ?? part, limits);
|
|
1086
|
+
if (typeof capacity !== "number") return yield* capacity;
|
|
1075
1087
|
}
|
|
1076
|
-
const encoded = yield* modelResponseParsersFor(toolkit).encode(part).pipe(Effect.
|
|
1077
|
-
const retainedBytes =
|
|
1088
|
+
const encoded = yield* modelResponseParsersFor(toolkit).encode(part).pipe(Effect.mapErrorEager(() => ModelProtocolError.make({ message: "Model response part failed canonical encoding" })));
|
|
1089
|
+
const retainedBytes = inspectModelResponsePartCapacity(usage, encoded, limits);
|
|
1090
|
+
if (typeof retainedBytes !== "number") return yield* retainedBytes;
|
|
1078
1091
|
if (typeof structuredCloneFunction !== "function") return yield* ModelProtocolError.make({ message: "Model response part could not be converted into engine-owned data" });
|
|
1092
|
+
let ownedEncoded;
|
|
1093
|
+
try {
|
|
1094
|
+
ownedEncoded = Reflect.apply(structuredCloneFunction, globalThis, [encoded]);
|
|
1095
|
+
} catch {
|
|
1096
|
+
return yield* ModelProtocolError.make({ message: "Model response part could not be converted into engine-owned data" });
|
|
1097
|
+
}
|
|
1079
1098
|
return {
|
|
1080
|
-
encodedPart:
|
|
1081
|
-
try: () => {
|
|
1082
|
-
return Reflect.apply(structuredCloneFunction, globalThis, [encoded]);
|
|
1083
|
-
},
|
|
1084
|
-
catch: () => ModelProtocolError.make({ message: "Model response part could not be converted into engine-owned data" })
|
|
1085
|
-
}),
|
|
1099
|
+
encodedPart: ownedEncoded,
|
|
1086
1100
|
retainedBytes
|
|
1087
1101
|
};
|
|
1088
1102
|
});
|
|
@@ -1094,8 +1108,11 @@ const decodePrimitiveModelResponsePart = Schema.decodeUnknownEffect(Schema.toTyp
|
|
|
1094
1108
|
Response.ReasoningDeltaPart,
|
|
1095
1109
|
Response.ReasoningEndPart
|
|
1096
1110
|
])));
|
|
1097
|
-
/**
|
|
1098
|
-
|
|
1111
|
+
/**
|
|
1112
|
+
* Called once by the executing consumer. Pure capture stays in that step; application
|
|
1113
|
+
* codecs may suspend in the same fiber. Reject trailing content before either path.
|
|
1114
|
+
*/
|
|
1115
|
+
const ownModelResponsePart = (part, toolkit, usage, limits, finished) => {
|
|
1099
1116
|
if (finished) return Effect.fail(ModelProtocolError.make({ message: "Model response emitted content after its finish part" }));
|
|
1100
1117
|
const primitive = usage.responsePartCount < limits.maxModelResponseParts ? capturePrimitiveTextPart(part, limits.maxModelResponseBytes - usage.responsePartBytes) : void 0;
|
|
1101
1118
|
if (primitive !== void 0) return Effect.mapBothEager(decodePrimitiveModelResponsePart(primitive.part), {
|
|
@@ -1112,7 +1129,7 @@ const ownModelResponsePart = (part, toolkit, usage, limits, finished) => Effect.
|
|
|
1112
1129
|
retainedBytes: captured.retainedBytes
|
|
1113
1130
|
})
|
|
1114
1131
|
}));
|
|
1115
|
-
}
|
|
1132
|
+
};
|
|
1116
1133
|
const hasTool = (tools, name) => Object.hasOwn(tools, name);
|
|
1117
1134
|
const startPart = (parts, id, description) => {
|
|
1118
1135
|
if (parts.has(id)) return Effect.fail(ModelProtocolError.make({ message: `Model response repeated ${description} start for ${id}` }));
|
|
@@ -1120,7 +1137,11 @@ const startPart = (parts, id, description) => {
|
|
|
1120
1137
|
return Effect.void;
|
|
1121
1138
|
};
|
|
1122
1139
|
const continuePart = (parts, id, description) => parts.get(id) === "open" ? Effect.void : Effect.fail(ModelProtocolError.make({ message: `Model response emitted ${description} for inactive part ${id}` }));
|
|
1123
|
-
const endPart = (parts, id, description) =>
|
|
1140
|
+
const endPart = (parts, id, description) => {
|
|
1141
|
+
if (parts.get(id) !== "open") return continuePart(parts, id, `${description} end`);
|
|
1142
|
+
parts.set(id, "closed");
|
|
1143
|
+
return Effect.void;
|
|
1144
|
+
};
|
|
1124
1145
|
const firstOpenPart = (trace) => {
|
|
1125
1146
|
for (const [id, state] of trace.textParts) if (state === "open") return `text part ${id}`;
|
|
1126
1147
|
for (const [id, state] of trace.reasoningParts) if (state === "open") return `reasoning part ${id}`;
|
|
@@ -1287,7 +1308,7 @@ const makeToolFailedEvent = Effect.fnUntraced(function* (context, turnId, call,
|
|
|
1287
1308
|
/**
|
|
1288
1309
|
* Settle a rejected Tool batch without starting any handler: every open
|
|
1289
1310
|
* application call receives the encoded failure as its model-visible result.
|
|
1290
|
-
*
|
|
1311
|
+
* Policy and persistence budget rejections are exempt from repeated-failure folding;
|
|
1291
1312
|
* correctable model declarations count as ordinary failed calls. Emit one
|
|
1292
1313
|
* `ToolCallFailed` per call with no `ToolCallStarted` (the
|
|
1293
1314
|
* approval-denied precedent). The caller hands the trace to
|
|
@@ -1297,7 +1318,7 @@ const makeToolFailedEvent = Effect.fnUntraced(function* (context, turnId, call,
|
|
|
1297
1318
|
* Turn commit.
|
|
1298
1319
|
*/
|
|
1299
1320
|
const settleRejectedBatch = Effect.fnUntraced(function* (context, turnId, trace, error, alreadySettled) {
|
|
1300
|
-
const budgetRejected = error._tag
|
|
1321
|
+
const budgetRejected = error._tag !== "ModelProtocolError" ? true : void 0;
|
|
1301
1322
|
const encodedResult = {
|
|
1302
1323
|
_tag: error._tag,
|
|
1303
1324
|
...error._tag === "AgentPolicyError" ? { limit: error.limit } : {},
|
|
@@ -2082,14 +2103,14 @@ const ProviderUsage = Schema.Struct({
|
|
|
2082
2103
|
const invalidProviderUsage = () => ModelProtocolError.make({ message: "Model response usage fields and derived totals must be non-negative safe integers" });
|
|
2083
2104
|
const decodeUsageTotal = Schema.decodeEffect(Schema.Natural);
|
|
2084
2105
|
const decodeProviderUsage = Schema.decodeEffect(ProviderUsage);
|
|
2085
|
-
const decodeProviderUsageTotal = (value) => decodeUsageTotal(value).pipe(Effect.
|
|
2086
|
-
const consumeUsage = (agent, context, usage, toolCallCount, turn, options, response = {})
|
|
2106
|
+
const decodeProviderUsageTotal = (value) => decodeUsageTotal(value).pipe(Effect.mapErrorEager(() => invalidProviderUsage()));
|
|
2107
|
+
const consumeUsage = Effect.fnUntracedEager(function* (agent, context, usage, toolCallCount, turn, options, response = {}) {
|
|
2087
2108
|
if (usage === void 0) return yield* AgentPolicyError.make({
|
|
2088
2109
|
limit: "usage",
|
|
2089
2110
|
message: "A completed model response did not report usage"
|
|
2090
2111
|
});
|
|
2091
2112
|
const webSearchCalls = yield* decodeProviderUsageTotal(response.webSearchCalls ?? 0);
|
|
2092
|
-
const providerUsage = yield* decodeProviderUsage(usage).pipe(Effect.
|
|
2113
|
+
const providerUsage = yield* decodeProviderUsage(usage).pipe(Effect.mapErrorEager(() => invalidProviderUsage()));
|
|
2093
2114
|
const reportedUncached = providerUsage.inputTokens.uncached ?? 0;
|
|
2094
2115
|
const cacheRead = providerUsage.inputTokens.cacheRead ?? 0;
|
|
2095
2116
|
const cacheWrite = providerUsage.inputTokens.cacheWrite ?? 0;
|
|
@@ -2119,12 +2140,12 @@ const consumeUsage = (agent, context, usage, toolCallCount, turn, options, respo
|
|
|
2119
2140
|
uncached,
|
|
2120
2141
|
cacheRead: normalizedCacheRead,
|
|
2121
2142
|
cacheWrite: normalizedCacheWrite
|
|
2122
|
-
}).pipe(Effect.
|
|
2143
|
+
}).pipe(Effect.mapErrorEager(() => invalidProviderUsage()));
|
|
2123
2144
|
const outputUsage = yield* OutputTokenUsage.makeEffect({
|
|
2124
2145
|
total: outputTokens,
|
|
2125
2146
|
text,
|
|
2126
2147
|
reasoning: normalizedReasoning
|
|
2127
|
-
}).pipe(Effect.
|
|
2148
|
+
}).pipe(Effect.mapErrorEager(() => invalidProviderUsage()));
|
|
2128
2149
|
const totalTokens = yield* decodeProviderUsageTotal(inputTokens + outputTokens);
|
|
2129
2150
|
const provider = yield* Model.ProviderName;
|
|
2130
2151
|
const model = yield* Model.ModelName;
|
|
@@ -3124,11 +3145,6 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
3124
3145
|
};
|
|
3125
3146
|
const started = Effect.gen(function* () {
|
|
3126
3147
|
yield* Metric.update(modelCounter, 1);
|
|
3127
|
-
yield* Effect.logDebug("agent model call started").pipe(Effect.annotateLogs({
|
|
3128
|
-
agentId: context.agentId,
|
|
3129
|
-
runId: context.runId,
|
|
3130
|
-
turnId
|
|
3131
|
-
}));
|
|
3132
3148
|
if (context.publish === void 0) return;
|
|
3133
3149
|
yield* context.publish([TurnStarted.make({
|
|
3134
3150
|
...yield* eventBase(context),
|
|
@@ -3140,7 +3156,7 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
3140
3156
|
turnId,
|
|
3141
3157
|
turn
|
|
3142
3158
|
})]);
|
|
3143
|
-
})
|
|
3159
|
+
});
|
|
3144
3160
|
let finalAnswerOnly = policy.onExhaustion !== "fail" && (turn > bounds.maxTurns || priorToolCalls + context.programmaticToolCalls > bounds.maxToolCalls || context.tokenExhausted);
|
|
3145
3161
|
const modelToolChoice = () => {
|
|
3146
3162
|
return finalAnswerOnly || agent.definition.completion?.required === true && policy.onExhaustion === "fail" && turn === bounds.maxTurns ? agent.definition.completion === void 0 || agent.definition.completion.required !== true && !catalog.some((entry) => entry.kind === "native" && entry.nativeToolName === agent.definition.completion?.tool) ? "none" : agent.definition.completion.required === true ? { tool: agent.definition.completion.tool } : {
|
|
@@ -3379,7 +3395,7 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
3379
3395
|
trace.usageConsumed = false;
|
|
3380
3396
|
provisionalText = !restartRequested && attempt?.threadId === context.threadId ? attempt.openModel(context.runId, turnId) : void 0;
|
|
3381
3397
|
activeProvisionalText = provisionalText;
|
|
3382
|
-
})), Stream.runForEachArray(
|
|
3398
|
+
})), Stream.runForEachArray(Effect.fnUntracedEager(function* (parts) {
|
|
3383
3399
|
for (const part of parts) {
|
|
3384
3400
|
const owned = yield* ownModelResponsePart(part, agent.definition.toolkit, trace, context.bufferLimits, trace.finished);
|
|
3385
3401
|
const events = context.publish === void 0 ? void 0 : [];
|
|
@@ -3650,7 +3666,7 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
3650
3666
|
if (options.durability !== void 0) {
|
|
3651
3667
|
const response = trace.commitResponse;
|
|
3652
3668
|
if (response === void 0) return yield* ModelProtocolError.make({ message: "Tool dispatch has no validated response facts" });
|
|
3653
|
-
yield* acceptTurnCommit(context, trace, options.durability, {
|
|
3669
|
+
if ((yield* acceptTurnCommit(context, trace, options.durability, {
|
|
3654
3670
|
_tag: "Response",
|
|
3655
3671
|
turn,
|
|
3656
3672
|
turnId,
|
|
@@ -3659,7 +3675,10 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
|
|
|
3659
3675
|
const tool = toolkit.tools[call.toolName];
|
|
3660
3676
|
return call.executionClass === "readonly" && call.executionKind === "ordinary" && tool !== void 0 && (tool.needsApproval === void 0 || tool.needsApproval === false);
|
|
3661
3677
|
}) ? { defer: true } : {}
|
|
3662
|
-
})
|
|
3678
|
+
})) === "capacity-refused") {
|
|
3679
|
+
const rejection = yield* settleRejectedBatch(context, turnId, trace, AgentPersistenceCapacityError.make({ message: "This application tool batch was not dispatched because its durable results exceed available capacity. Retry the needed application tools in smaller batches. Earlier tool results remain valid." }));
|
|
3680
|
+
return publishEvents(context, rejection).pipe(Effect.andThen(toolBatchContinuation(agent, context, trace, prompt, turn, turnId, toolCalls, options)));
|
|
3681
|
+
}
|
|
3663
3682
|
}
|
|
3664
3683
|
return executeToolBatch(context, turnId, turn, toolkit, trace.applicationToolCalls, trace, concurrency, options, {
|
|
3665
3684
|
maxToolCalls: bounds.maxToolCalls,
|
|
@@ -4191,12 +4210,8 @@ function executeWithCompletion(agentValue, input, runOptions = {}, onCompleted,
|
|
|
4191
4210
|
if (options.input?.start !== void 0) yield* options.input.start();
|
|
4192
4211
|
const started = Effect.gen(function* () {
|
|
4193
4212
|
yield* Metric.update(runCounter, 1);
|
|
4194
|
-
yield* Effect.logDebug("agent run started").pipe(Effect.annotateLogs({
|
|
4195
|
-
agentId: context.agentId,
|
|
4196
|
-
runId: context.runId
|
|
4197
|
-
}));
|
|
4198
4213
|
yield* publishEvent(context, () => eventBase(context).pipe(Effect.map((base) => RunStarted.make(base))));
|
|
4199
|
-
})
|
|
4214
|
+
});
|
|
4200
4215
|
const execution = Effect.flatten(Effect.gen(function* () {
|
|
4201
4216
|
const initial = yield* prepareWithinDeadline(context, Effect.gen(function* () {
|
|
4202
4217
|
if (options.retainedInput !== void 0) {
|
|
@@ -4322,7 +4337,7 @@ function executeWithCompletion(agentValue, input, runOptions = {}, onCompleted,
|
|
|
4322
4337
|
agentId: context.agentId,
|
|
4323
4338
|
threadId: context.threadId,
|
|
4324
4339
|
runId: context.runId
|
|
4325
|
-
}, options.delegationDepth ?? options.parentLink?.depth ?? 0, history, preparation, agent.definition.policy, options.subagentGrant, options.subagentBudget, options.subagentBudgetScope, (childRunId, read) => {
|
|
4340
|
+
}, options.delegationDepth ?? options.parentLink?.depth ?? 0, history, preparation, agent.definition.policy, DateTime.makeUnsafe(context.durationDeadlineMillis), options.subagentGrant, options.subagentBudget, options.subagentBudgetScope, (childRunId, read) => {
|
|
4326
4341
|
context.liveChildren.add(childRunId);
|
|
4327
4342
|
context.childUsage.set(childRunId, read);
|
|
4328
4343
|
})).pipe(Context.add(ContextWindow, { status: Effect.sync(() => {
|
|
@@ -5138,11 +5153,12 @@ const spawnWithParent = (parent, depth, history, preparation, onChild) => Effect
|
|
|
5138
5153
|
* exposes neither the engine's mutable Run state nor any root Layer Context.
|
|
5139
5154
|
*/
|
|
5140
5155
|
var AgentSpawner = class extends Context.Service()("@effect-agent/engine/AgentSpawner") {};
|
|
5141
|
-
const makeAgentSpawner = (parent, depth, history, preparation, policy, grant, budget, budgetScope, onChild = () => {}) => ({
|
|
5156
|
+
const makeAgentSpawner = (parent, depth, history, preparation, policy, durationDeadline, grant, budget, budgetScope, onChild = () => {}) => ({
|
|
5142
5157
|
...grant === void 0 ? {} : { grant },
|
|
5143
5158
|
...budget === void 0 ? {} : { budget },
|
|
5144
5159
|
...budgetScope === void 0 ? {} : { budgetScope },
|
|
5145
5160
|
policy,
|
|
5161
|
+
durationDeadline,
|
|
5146
5162
|
depth,
|
|
5147
5163
|
parent,
|
|
5148
5164
|
spawn: spawnWithParent(parent, depth, history, preparation, onChild)
|
|
@@ -5216,6 +5232,6 @@ var AgentRuntime_exports = /* @__PURE__ */ __exportAll({
|
|
|
5216
5232
|
withTerminalDefectEvent: () => withTerminalDefectEvent
|
|
5217
5233
|
});
|
|
5218
5234
|
//#endregion
|
|
5219
|
-
export { boundedValueFootprint as C, withAttempt as S, startUnknown as _, SubagentDurability as a, streamWithUsageAccountingUnknown as b, decodeFinalOutput as c, projectCompletionFromToolOutput as d, projectCompletionOutput as f, start as g, runUnknown as h, AgentSpawner as i, encodeRunDisposition as l, run as m, AgentChildPending as n, SubagentDurabilityError as o, renderInputPrompt as p, AgentResultSchema as r, ToolCallWaiting as s, AgentRuntime_exports as t, executeWithUsageAccountingUnknown as u, stream as v, withTerminalDefectEvent as x, streamUnknown as y };
|
|
5235
|
+
export { boundedValueFootprint as C, withAttempt as S, startUnknown as _, SubagentDurability as a, streamWithUsageAccountingUnknown as b, decodeFinalOutput as c, projectCompletionFromToolOutput as d, projectCompletionOutput as f, start as g, runUnknown as h, AgentSpawner as i, encodeRunDisposition as l, run as m, AgentChildPending as n, SubagentDurabilityError as o, renderInputPrompt as p, AgentResultSchema as r, ToolCallWaiting as s, AgentRuntime_exports as t, executeWithUsageAccountingUnknown as u, stream as v, copyJson as w, withTerminalDefectEvent as x, streamUnknown as y };
|
|
5220
5236
|
|
|
5221
|
-
//# sourceMappingURL=AgentRuntime-
|
|
5237
|
+
//# sourceMappingURL=AgentRuntime-ILtyHuQG.mjs.map
|