@yielded/agent 0.1.0-beta.172 → 0.1.0-beta.174
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-BX9ns28E.d.mts → Admin-BHmp2V9p.d.mts} +25 -16
- package/dist/{Agent-9aBoIi74.d.mts → Agent-B39jRnFv.d.mts} +2 -2
- package/dist/{Agent-0WvBWWbM.mjs → Agent-BiRbr73L.mjs} +7 -6
- package/dist/Agent-BiRbr73L.mjs.map +1 -0
- package/dist/{AgentRuntime-CQ-qcETl.mjs → AgentRuntime-B6qZlD3f.mjs} +199 -191
- package/dist/AgentRuntime-B6qZlD3f.mjs.map +1 -0
- package/dist/{AgentRuntime-BfP14534.d.mts → AgentRuntime-BD3ZHAMq.d.mts} +10 -10
- package/dist/{Digest-DCuPlhNk.mjs → Digest-EpeqWEdv.mjs} +41 -14
- package/dist/Digest-EpeqWEdv.mjs.map +1 -0
- package/dist/{DurableAgentRuntime-BAmSkWYr.mjs → DurableAgentRuntime-CBBjRNJN.mjs} +1447 -1424
- package/dist/DurableAgentRuntime-CBBjRNJN.mjs.map +1 -0
- package/dist/{EventSource-BwliwQz9.d.mts → EventSource-C9aaJaXT.d.mts} +2 -2
- package/dist/{MessageDelivery-CeSDfHZa.d.mts → MessageDelivery-BGDm-c46.d.mts} +4 -4
- package/dist/{Messaging-C_6OOg_s.d.mts → Messaging-SVu6rWV8.d.mts} +12 -6
- package/dist/{MessagingHost-B8oKM7AC.d.mts → MessagingHost-C6SOAcoG.d.mts} +2 -2
- package/dist/{Output-Dsx6k52t.d.mts → Output-CRamN1Fy.d.mts} +2 -2
- package/dist/{PreparedInputAdmission-CxSJSiTl.d.mts → PreparedInputAdmission-BvDqlgiP.d.mts} +3 -3
- package/dist/{RunContinuation-DHYNAQFi.mjs → RunContinuation-4ZATcVLB.mjs} +113 -56
- package/dist/RunContinuation-4ZATcVLB.mjs.map +1 -0
- package/dist/{RunContinuation-FHM7XPjq.d.mts → RunContinuation-CTJ1jGrO.d.mts} +6 -6
- package/dist/{RunJournal-kfKVxJj7.mjs → RunJournal-CNZqA3Ge.mjs} +33 -5
- package/dist/RunJournal-CNZqA3Ge.mjs.map +1 -0
- package/dist/{RunOptions-D8zxFIrZ.d.mts → RunOptions-Be77lKVZ.d.mts} +2 -2
- package/dist/{RunStorage-uqPxps09.mjs → RunStorage-BHjuuERI.mjs} +9 -6
- package/dist/RunStorage-BHjuuERI.mjs.map +1 -0
- package/dist/{Scheduling-CVyfXlBR.mjs → Scheduling-NG8slKdI.mjs} +11 -11
- package/dist/Scheduling-NG8slKdI.mjs.map +1 -0
- package/dist/{Subagent-vpffemql.mjs → Subagent-CTIpnzlB.mjs} +53 -40
- package/dist/Subagent-CTIpnzlB.mjs.map +1 -0
- package/dist/{Subagent-E6tvd7-k.d.mts → Subagent-DKhZA72u.d.mts} +19 -8
- package/dist/{SubagentHost-B6w2m-SI.d.mts → SubagentHost-D1xBgn9g.d.mts} +2 -2
- package/dist/{Subscription-DONig54Q.d.mts → Subscription-BNg9VCRl.d.mts} +2 -2
- package/dist/{SubscriptionInput-mJIRxWJM.d.mts → SubscriptionInput-BUoXv-_K.d.mts} +2 -2
- package/dist/{ThreadImport-CoQTZywm.d.mts → ThreadImport-CMgzttvr.d.mts} +43 -43
- package/dist/{ThreadImport-DckUMEqJ.mjs → ThreadImport-CodYoJoa.mjs} +7 -7
- package/dist/ThreadImport-CodYoJoa.mjs.map +1 -0
- package/dist/{ThreadStore-CEekRa80.mjs → ThreadStore-59uDGXul.mjs} +163 -84
- package/dist/ThreadStore-59uDGXul.mjs.map +1 -0
- package/dist/{ThreadTransfer-B4gTQLIl.mjs → ThreadTransfer-3jigUl3g.mjs} +3 -3
- package/dist/{ThreadTransfer-B4gTQLIl.mjs.map → ThreadTransfer-3jigUl3g.mjs.map} +1 -1
- package/dist/{WorkerAdmission-DFVbbVh2.mjs → WorkerAdmission-DDYJdOsU.mjs} +4 -4
- package/dist/{WorkerAdmission-DFVbbVh2.mjs.map → WorkerAdmission-DDYJdOsU.mjs.map} +1 -1
- package/dist/{agent-registration-ByMZ_cK5.mjs → agent-registration-DRbyhAu-.mjs} +69 -56
- package/dist/agent-registration-DRbyhAu-.mjs.map +1 -0
- package/dist/capabilities/Approval.mjs +2 -2
- package/dist/capabilities/Approval.mjs.map +1 -1
- package/dist/capabilities/BrowserUse.d.mts +102 -1867
- package/dist/capabilities/BrowserUse.mjs +74 -798
- package/dist/capabilities/BrowserUse.mjs.map +1 -1
- package/dist/capabilities/Budget.mjs +3 -1
- package/dist/capabilities/Budget.mjs.map +1 -1
- package/dist/capabilities/CodeMode.d.mts +1 -1
- package/dist/capabilities/CodeMode.mjs +16 -9
- package/dist/capabilities/CodeMode.mjs.map +1 -1
- package/dist/capabilities/Commands.d.mts +1 -1
- package/dist/capabilities/McpClient.mjs +1 -1
- package/dist/capabilities/McpClient.mjs.map +1 -1
- package/dist/capabilities/Messaging.d.mts +1 -1
- package/dist/capabilities/Messaging.mjs +4 -4
- package/dist/capabilities/Messaging.mjs.map +1 -1
- package/dist/capabilities/ModelContext.mjs +7 -5
- package/dist/capabilities/ModelContext.mjs.map +1 -1
- package/dist/capabilities/Redaction.mjs +49 -19
- package/dist/capabilities/Redaction.mjs.map +1 -1
- package/dist/capabilities/RunHooks.d.mts +1 -1
- package/dist/capabilities/RunHooks.mjs +1 -1
- package/dist/capabilities/RunHooks.mjs.map +1 -1
- package/dist/capabilities/Subagent.d.mts +1 -1
- package/dist/capabilities/Subagent.mjs +1 -1
- package/dist/capabilities/SubagentReservations.mjs +3 -1
- package/dist/capabilities/SubagentReservations.mjs.map +1 -1
- package/dist/capabilities/WebCapture.mjs.map +1 -1
- package/dist/capabilities/WebSearch.mjs +7 -7
- package/dist/capabilities/WebSearch.mjs.map +1 -1
- package/dist/core/Agent.d.mts +1 -1
- package/dist/core/Agent.mjs +1 -1
- package/dist/core/AgentUpdates.mjs +8 -8
- package/dist/core/AgentUpdates.mjs.map +1 -1
- package/dist/core/Thread.mjs +1 -1
- package/dist/core/Thread.mjs.map +1 -1
- package/dist/core/Usage.mjs +2 -2
- package/dist/core/Usage.mjs.map +1 -1
- package/dist/durable/Admin.d.mts +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 +1 -1
- package/dist/durable/CommittedActivity.mjs +2 -2
- 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 +6 -6
- package/dist/durable/EventSource.mjs.map +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/MessageDelivery.mjs +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +2 -2
- package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
- 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/RecordFormat.mjs +2 -2
- package/dist/durable/RecordFormat.mjs.map +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/Scheduling.mjs +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 +5 -1
- package/dist/durable/SubmissionLedger.mjs.map +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +4 -4
- 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/SubscriptionInput.mjs +3 -3
- package/dist/durable/SubscriptionInput.mjs.map +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.mjs +2 -2
- package/dist/durable/SubscriptionStoreConformance.mjs.map +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/Subscriptions.mjs +2 -2
- package/dist/durable/Subscriptions.mjs.map +1 -1
- 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 +4 -4
- package/dist/durable/ThreadInvariants.mjs.map +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 +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 +4 -4
- package/dist/durable/ThreadWork.mjs.map +1 -1
- package/dist/durable/WorkerAdmission.d.mts +1 -1
- 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/MessagingHost.d.mts +1 -1
- package/dist/engine/Output.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 +19 -19
- package/dist/index.mjs +14 -14
- package/dist/{run-context-reader-OcsZr4bk.d.mts → run-context-reader-CC7ZD95F.d.mts} +2 -2
- package/package.json +1 -1
- package/src/capabilities/Approval.ts +58 -60
- package/src/capabilities/BrowserUse.ts +89 -944
- package/src/capabilities/Budget.ts +8 -1
- package/src/capabilities/CodeMode.ts +57 -33
- package/src/capabilities/McpClient.ts +2 -2
- package/src/capabilities/Messaging.ts +51 -55
- package/src/capabilities/ModelContext.ts +5 -2
- package/src/capabilities/Redaction.ts +64 -34
- package/src/capabilities/RunHooks.ts +52 -55
- package/src/capabilities/Subagent.ts +33 -33
- package/src/capabilities/SubagentReservations.ts +9 -1
- package/src/capabilities/WebCapture.ts +6 -0
- package/src/capabilities/WebSearch.ts +10 -7
- package/src/capabilities/internal/subagent-background.ts +202 -158
- package/src/core/Agent.ts +11 -6
- package/src/core/AgentUpdates.ts +8 -8
- package/src/core/Thread.ts +9 -10
- package/src/core/Usage.ts +7 -8
- package/src/core/internal/agent-updates.ts +1 -0
- package/src/durable/DurableAgentRuntime.ts +645 -625
- package/src/durable/EventSource.ts +15 -9
- package/src/durable/RecordFormat.ts +5 -3
- package/src/durable/RunContinuation.ts +233 -81
- package/src/durable/RunJournal.ts +10 -9
- package/src/durable/RunStorage.ts +122 -124
- package/src/durable/Scheduling.ts +639 -651
- package/src/durable/SubmissionLedger.ts +4 -0
- package/src/durable/SubscriptionInput.ts +5 -3
- package/src/durable/SubscriptionStoreConformance.ts +23 -23
- package/src/durable/Subscriptions.ts +18 -19
- package/src/durable/ThreadImport.ts +18 -19
- package/src/durable/ThreadInvariants.ts +2 -1
- package/src/durable/ThreadStore.ts +215 -111
- package/src/durable/ThreadWork.ts +1 -2
- package/src/durable/internal/StorageOwner.ts +10 -4
- package/src/durable/internal/agent-registration.ts +96 -89
- package/src/durable/internal/canonical-json.ts +61 -20
- package/src/durable/internal/prompt-history-cache.ts +13 -4
- package/src/durable/internal/record-encoding.ts +120 -64
- package/src/durable/internal/schedule-time.ts +6 -6
- package/src/durable/internal/usage-totals.ts +38 -0
- package/src/durable/internal/worker-host.ts +69 -74
- package/src/engine/internal/agent-runtime.ts +1067 -1018
- package/src/engine/internal/provisional-text.ts +12 -10
- package/src/engine/internal/tool-exposure.ts +22 -18
- package/src/engine/internal/tool-telemetry.ts +12 -7
- package/dist/Agent-0WvBWWbM.mjs.map +0 -1
- package/dist/AgentRuntime-CQ-qcETl.mjs.map +0 -1
- package/dist/Digest-DCuPlhNk.mjs.map +0 -1
- package/dist/DurableAgentRuntime-BAmSkWYr.mjs.map +0 -1
- package/dist/RunContinuation-DHYNAQFi.mjs.map +0 -1
- package/dist/RunJournal-kfKVxJj7.mjs.map +0 -1
- package/dist/RunStorage-uqPxps09.mjs.map +0 -1
- package/dist/Scheduling-CVyfXlBR.mjs.map +0 -1
- package/dist/Subagent-vpffemql.mjs.map +0 -1
- package/dist/ThreadImport-DckUMEqJ.mjs.map +0 -1
- package/dist/ThreadStore-CEekRa80.mjs.map +0 -1
- package/dist/agent-registration-ByMZ_cK5.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { K as PersistedJson } from "./Records-BTnGRdcf.mjs";
|
|
2
|
-
import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, t as AcceptedEvent } from "./Subscription-
|
|
2
|
+
import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, t as AcceptedEvent } from "./Subscription-BNg9VCRl.mjs";
|
|
3
3
|
import { Context, Effect, Schema, Scope } from "effect";
|
|
4
4
|
declare namespace EventSource_d_exports {
|
|
5
5
|
export { EventSource, EventSources, NormalizedEvent, makeEventSource };
|
|
@@ -48,4 +48,4 @@ declare const makeEventSource: <Event extends Schema.Top, Parameters extends Sch
|
|
|
48
48
|
}) => Effect.Effect<EventSource, never, Exclude<R, Scope.Scope> | Exclude<Event["DecodingServices"], Scope.Scope> | Exclude<Event["EncodingServices"], Scope.Scope> | Exclude<Parameters["DecodingServices"], Scope.Scope> | Exclude<Parameters["EncodingServices"], Scope.Scope>>;
|
|
49
49
|
//#endregion
|
|
50
50
|
export { makeEventSource as a, NormalizedEvent as i, EventSource_d_exports as n, EventSources as r, EventSource as t };
|
|
51
|
-
//# sourceMappingURL=EventSource-
|
|
51
|
+
//# sourceMappingURL=EventSource-C9aaJaXT.d.mts.map
|
|
@@ -5,9 +5,9 @@ import { r as Update } from "./AgentUpdates-DksV4D0A.mjs";
|
|
|
5
5
|
import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-DvHruCSJ.mjs";
|
|
6
6
|
import { t as AgentPolicy } from "./AgentPolicy-B4lbCU2T.mjs";
|
|
7
7
|
import { b as DefinitionDigests } from "./Records-BTnGRdcf.mjs";
|
|
8
|
-
import { sn as Settlement, uo as LifecyclePublicationStorage } from "./Admin-
|
|
9
|
-
import { a as PreparedInput } from "./Subscription-
|
|
10
|
-
import { t as PreparedInputAdmission } from "./PreparedInputAdmission-
|
|
8
|
+
import { sn as Settlement, uo as LifecyclePublicationStorage } from "./Admin-BHmp2V9p.mjs";
|
|
9
|
+
import { a as PreparedInput } from "./Subscription-BNg9VCRl.mjs";
|
|
10
|
+
import { t as PreparedInputAdmission } from "./PreparedInputAdmission-BvDqlgiP.mjs";
|
|
11
11
|
import { Context, Crypto, Effect, Layer, Result, Schema } from "effect";
|
|
12
12
|
declare namespace MessageDelivery_d_exports {
|
|
13
13
|
export { MessageDeliveryChange, MessageDeliveryCompletion, MessageDeliveryDriver, MessageDeliveryDriverLimits, MessageDeliveryError, MessageDeliveryFailpoint, MessageDeliveryFailpointError, MessageDeliveryFailure, MessageDeliveryKey, MessageDeliveryPage, MessageDeliveryPageRequest, MessageDeliveryPolicy, MessageDeliveryRecord, MessageDeliveryStore, MessageDeliveryStoreLimits, applyMessageDeliveryChange, defaultMessageDeliveryPolicy, defaultMessageDeliveryStoreLimits, isWorkerUpdateDelivery, messageDeliveryCapacity, messageDeliveryDeadline, messageDeliveryKeyString, messageDeliveryUsesCapacity, peerMessageRetentionDeadline, prepareMessageDelivery, readPending, sameMessageDeliveryIdentity, validateMessageDelivery };
|
|
@@ -950,4 +950,4 @@ declare class MessageDeliveryDriver extends MessageDeliveryDriver_base {
|
|
|
950
950
|
}
|
|
951
951
|
//#endregion
|
|
952
952
|
export { messageDeliveryKeyString as C, readPending as D, prepareMessageDelivery as E, sameMessageDeliveryIdentity as O, messageDeliveryDeadline as S, peerMessageRetentionDeadline as T, applyMessageDeliveryChange as _, MessageDeliveryError as a, isWorkerUpdateDelivery as b, MessageDeliveryFailure as c, MessageDeliveryPageRequest as d, MessageDeliveryPolicy as f, MessageDelivery_d_exports as g, MessageDeliveryStoreLimits as h, MessageDeliveryDriverLimits as i, validateMessageDelivery as k, MessageDeliveryKey as l, MessageDeliveryStore as m, MessageDeliveryCompletion as n, MessageDeliveryFailpoint as o, MessageDeliveryRecord as p, MessageDeliveryDriver as r, MessageDeliveryFailpointError as s, MessageDeliveryChange as t, MessageDeliveryPage as u, defaultMessageDeliveryPolicy as v, messageDeliveryUsesCapacity as w, messageDeliveryCapacity as x, defaultMessageDeliveryStoreLimits as y };
|
|
953
|
-
//# sourceMappingURL=MessageDelivery-
|
|
953
|
+
//# sourceMappingURL=MessageDelivery-BGDm-c46.d.mts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Receipt, t as IdempotencyKey } from "./Receipt-BkM21Qiu.mjs";
|
|
2
|
-
import { r as AnyDefinition } from "./Agent-
|
|
2
|
+
import { r as AnyDefinition } from "./Agent-B39jRnFv.mjs";
|
|
3
3
|
import { a as MessageAdmission, c as MessageRef, i as MessageAddress, l as MessageStatus, n as InboxPage, o as MessagingError, r as InputMessage, s as PeerName, t as InboxEntry } from "./Messaging-DF_IWnxV.mjs";
|
|
4
|
-
import { t as MessagingHost } from "./MessagingHost-
|
|
4
|
+
import { t as MessagingHost } from "./MessagingHost-C6SOAcoG.mjs";
|
|
5
5
|
import { Crypto, Effect, Schema } from "effect";
|
|
6
6
|
import { Tool, Toolkit } from "effect/ai";
|
|
7
7
|
declare namespace Messaging_d_exports {
|
|
@@ -128,7 +128,7 @@ declare const reply: <Name extends string, Input extends Schema.Top>(declaration
|
|
|
128
128
|
declare const inbox: <Name extends string, Input extends Schema.Top>(declaration: Peer<Name, Input>, options?: {
|
|
129
129
|
readonly after?: number;
|
|
130
130
|
readonly limit?: number;
|
|
131
|
-
}) => Effect.Effect<{
|
|
131
|
+
} | undefined) => Effect.Effect<{
|
|
132
132
|
readonly items: readonly {
|
|
133
133
|
readonly sequence: number;
|
|
134
134
|
readonly admission: {
|
|
@@ -154,7 +154,10 @@ declare const inbox: <Name extends string, Input extends Schema.Top>(declaration
|
|
|
154
154
|
}[];
|
|
155
155
|
readonly next: number | null;
|
|
156
156
|
}, MessagingError, MessagingHost>;
|
|
157
|
-
declare const inspect: <Name extends string, Input extends Schema.Top>(declaration: Peer<Name, Input>, message:
|
|
157
|
+
declare const inspect: <Name extends string, Input extends Schema.Top>(declaration: Peer<Name, Input>, message: {
|
|
158
|
+
readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
|
|
159
|
+
readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
|
|
160
|
+
}) => Effect.Effect<{
|
|
158
161
|
readonly message: {
|
|
159
162
|
readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
|
|
160
163
|
readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
|
|
@@ -204,7 +207,10 @@ declare const inspect: <Name extends string, Input extends Schema.Top>(declarati
|
|
|
204
207
|
readonly reason: string;
|
|
205
208
|
}, MessagingError, MessagingHost>;
|
|
206
209
|
/** Explicitly renew a parked delivery's bounded retry budget, retaining its complete frozen envelope. */
|
|
207
|
-
declare const retry: <Name extends string, Input extends Schema.Top>(declaration: Peer<Name, Input>, message:
|
|
210
|
+
declare const retry: <Name extends string, Input extends Schema.Top>(declaration: Peer<Name, Input>, message: {
|
|
211
|
+
readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
|
|
212
|
+
readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
|
|
213
|
+
}) => Effect.Effect<{
|
|
208
214
|
readonly message: {
|
|
209
215
|
readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
|
|
210
216
|
readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
|
|
@@ -1064,4 +1070,4 @@ declare const retryTool: <const Name extends string, Input extends Schema.Top>(d
|
|
|
1064
1070
|
};
|
|
1065
1071
|
//#endregion
|
|
1066
1072
|
export { inspect as a, reply as c, retryTool as d, send as f, inboxTool as i, replyTool as l, Peer as n, inspectTool as o, sendTool as p, inbox as r, peer as s, Messaging_d_exports as t, retry as u };
|
|
1067
|
-
//# sourceMappingURL=Messaging-
|
|
1073
|
+
//# sourceMappingURL=Messaging-SVu6rWV8.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as ThreadId } from "./Identifiers-CN2s30fF.mjs";
|
|
2
2
|
import { r as Principal, t as IdempotencyKey } from "./Receipt-BkM21Qiu.mjs";
|
|
3
|
-
import { r as AnyDefinition } from "./Agent-
|
|
3
|
+
import { r as AnyDefinition } from "./Agent-B39jRnFv.mjs";
|
|
4
4
|
import { h as WorkerSource } from "./Worker-CHRaIsWu.mjs";
|
|
5
5
|
import { c as MessageRef, i as MessageAddress, l as MessageStatus, n as InboxPage, o as MessagingError } from "./Messaging-DF_IWnxV.mjs";
|
|
6
6
|
import * as Context$1 from "effect/Context";
|
|
@@ -79,4 +79,4 @@ declare const PeerDeliveryLifetime: Context$1.Reference<number>;
|
|
|
79
79
|
declare const PeerMessageCapacity: Context$1.Reference<number>;
|
|
80
80
|
//#endregion
|
|
81
81
|
export { PeerDeliveryLifetime as a, PeerTarget as c, PeerAuthorizer as i, SendPeerMessage as l, MessagingHost_d_exports as n, PeerMessageCapacity as o, PeerAuthorizationRequest as r, PeerRoutes as s, MessagingHost as t };
|
|
82
|
-
//# sourceMappingURL=MessagingHost-
|
|
82
|
+
//# sourceMappingURL=MessagingHost-C6SOAcoG.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./Agent-
|
|
1
|
+
import "./Agent-B39jRnFv.mjs";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
3
|
import "effect/ai/Prompt";
|
|
4
4
|
//#region src/engine/internal/output-contract.d.ts
|
|
@@ -22,4 +22,4 @@ declare namespace Output_d_exports {
|
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
export { textOutput as n, Output_d_exports as t };
|
|
25
|
-
//# sourceMappingURL=Output-
|
|
25
|
+
//# sourceMappingURL=Output-CRamN1Fy.d.mts.map
|
package/dist/{PreparedInputAdmission-CxSJSiTl.d.mts → PreparedInputAdmission-BvDqlgiP.d.mts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as Receipt } from "./Receipt-BkM21Qiu.mjs";
|
|
2
2
|
import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-DvHruCSJ.mjs";
|
|
3
|
-
import { kr as SubmissionStatus } from "./Admin-
|
|
3
|
+
import { kr as SubmissionStatus } from "./Admin-BHmp2V9p.mjs";
|
|
4
4
|
import { H as ScheduledInputRefused, V as ScheduledInputFailure, j as ScheduleStorageError } from "./Schedule-CDgTz0vj.mjs";
|
|
5
|
-
import { a as PreparedInput } from "./Subscription-
|
|
5
|
+
import { a as PreparedInput } from "./Subscription-BNg9VCRl.mjs";
|
|
6
6
|
import { Context, Effect } from "effect";
|
|
7
7
|
declare namespace PreparedInputAdmission_d_exports {
|
|
8
8
|
export { PreparedInputAdmission, admitPreparedInput };
|
|
@@ -39,4 +39,4 @@ declare const admitPreparedInput: <R>(submit: Effect.Effect<Receipt, ScheduledIn
|
|
|
39
39
|
}, ScheduleStorageError, R>;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { PreparedInputAdmission_d_exports as n, admitPreparedInput as r, PreparedInputAdmission as t };
|
|
42
|
-
//# sourceMappingURL=PreparedInputAdmission-
|
|
42
|
+
//# sourceMappingURL=PreparedInputAdmission-BvDqlgiP.d.mts.map
|
|
@@ -2,13 +2,12 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
|
2
2
|
import { ToolCallId } from "./core/Identifiers.mjs";
|
|
3
3
|
import { n as utf8ByteLength } from "./utf8-B5pAmhTo.mjs";
|
|
4
4
|
import { AgentPersistenceCapacityError } from "./core/AgentError.mjs";
|
|
5
|
-
import { summarizeModelUsage } from "./core/Usage.mjs";
|
|
6
5
|
import { G as PromptRecord, J as RUN_TERMINAL_RESERVE_BYTES, O as MAX_RUN_CONTINUATION_BYTES, V as PROMPT_EVIDENCE_TAGS, X as RecordEnvelope, Z as RecordId, c as CanonicalBatch, f as CanonicalSequence, it as RunContinuation, rt as RunContextRecorded, w as MAX_PERSISTED_JSON_BYTES, x as EvidenceReference } from "./Records-BiuJDWNe.mjs";
|
|
7
|
-
import { i as digestCanonicalJson, r as canonicalJson } from "./Digest-
|
|
6
|
+
import { i as digestCanonicalJson, r as canonicalJson } from "./Digest-EpeqWEdv.mjs";
|
|
8
7
|
import { submissionAbortRecordId, submissionInputRecordId, submissionSettlementBatchId, submissionSettlementRecordId } from "./durable/SubmissionLedger.mjs";
|
|
9
|
-
import { I as toolCallResultBatchId,
|
|
10
|
-
import { U as ThreadReader, X as ThreadStoreError, _t as isPreContinuationFact, a as CommitBatch, bt as terminalUsageCharge, c as ExecutionUpdate, gt as executionRunIds, ht as canonicalRunIds, mt as recordEncoding, o as ExecutionCheckpoint, ot as getRecord, pt as captureRecord, st as getRunInput, vt as isTerminalBudgetFact, yt as isWorkHandoff } from "./ThreadStore-
|
|
11
|
-
import { Context,
|
|
8
|
+
import { $ as toolCallSettledRecordId, I as toolCallResultBatchId, Z as continuationUsage, g as projectRunJournalStream, j as subagentStartedRecordId, k as subagentRequestedRecordId, t as RunJournalError, v as runCompletedRecordId, x as runIdForSubmission } from "./RunJournal-CNZqA3Ge.mjs";
|
|
9
|
+
import { U as ThreadReader, X as ThreadStoreError, _t as isPreContinuationFact, a as CommitBatch, bt as terminalUsageCharge, c as ExecutionUpdate, gt as executionRunIds, ht as canonicalRunIds, mt as recordEncoding, o as ExecutionCheckpoint, ot as getRecord, pt as captureRecord, st as getRunInput, vt as isTerminalBudgetFact, yt as isWorkHandoff } from "./ThreadStore-59uDGXul.mjs";
|
|
10
|
+
import { Context, DateTime, Effect, Layer, Option, Result, Schema, Semaphore, Stream } from "effect";
|
|
12
11
|
import { Prompt } from "effect/ai";
|
|
13
12
|
//#region src/durable/internal/evidence.ts
|
|
14
13
|
const failure$1 = (message, cause) => ThreadStoreError.make({
|
|
@@ -173,6 +172,31 @@ const failure = (message, cause) => ThreadStoreError.make({
|
|
|
173
172
|
const capacityFailure = (message) => failure(message, AgentPersistenceCapacityError.make({ message }));
|
|
174
173
|
const isExecutionProgressRecord = (record) => record.payload._tag === "RunContinuation";
|
|
175
174
|
const decodeResponsePrompt = Schema.decodeUnknownEffect(Prompt.Prompt);
|
|
175
|
+
const responsePrompts = /* @__PURE__ */ new WeakMap();
|
|
176
|
+
/** Cache eligibility only: freezing does not make accessors or custom iterators immutable. */
|
|
177
|
+
const isFrozenJsonData = (input) => {
|
|
178
|
+
const pending = [input];
|
|
179
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
180
|
+
while (pending.length > 0) {
|
|
181
|
+
const value = pending.pop();
|
|
182
|
+
if (value === null) continue;
|
|
183
|
+
if (typeof value !== "object") {
|
|
184
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") return false;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (seen.has(value)) continue;
|
|
188
|
+
seen.add(value);
|
|
189
|
+
const prototype = Object.getPrototypeOf(value);
|
|
190
|
+
if (!Object.isFrozen(value) || prototype !== null && prototype !== Object.prototype && prototype !== Array.prototype) return false;
|
|
191
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
192
|
+
if (typeof key !== "string") return false;
|
|
193
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
194
|
+
if (descriptor === void 0 || !("value" in descriptor)) return false;
|
|
195
|
+
pending.push(descriptor.value);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return true;
|
|
199
|
+
};
|
|
176
200
|
const validateBatchHeader = Schema.decodeSync(Schema.Struct({
|
|
177
201
|
batchId: CanonicalBatch.fields.batchId,
|
|
178
202
|
producerId: CanonicalBatch.fields.producerId
|
|
@@ -182,24 +206,36 @@ const ContinuationBytes = Schema.Struct({
|
|
|
182
206
|
turnBytes: RunContinuation.fields.turnBytes,
|
|
183
207
|
terminalBytes: RunContinuation.fields.terminalBytes
|
|
184
208
|
});
|
|
209
|
+
const decodeExecutionFrontier = Schema.decodeUnknownEffect(Schema.Struct({
|
|
210
|
+
canonicalRecords: ExecutionCheckpoint.fields.canonicalRecords,
|
|
211
|
+
throughSequence: ExecutionCheckpoint.fields.throughSequence
|
|
212
|
+
}));
|
|
185
213
|
/** One private snapshot for every retry; callers cannot change facts while awaiting the gate. */
|
|
186
214
|
const captureFacts = (batch) => Effect.try({
|
|
187
|
-
try: () => {
|
|
215
|
+
try: () => Result.gen(function* () {
|
|
188
216
|
const header = validateBatchHeader(batch);
|
|
189
217
|
validateBatchCount(batch.records);
|
|
190
|
-
const records = batch.records.map((record) =>
|
|
191
|
-
return Object.freeze(
|
|
218
|
+
const records = (yield* Result.all(batch.records.map(captureRecord))).map((record) => record.canonical);
|
|
219
|
+
return Object.freeze(CanonicalBatch.make({
|
|
192
220
|
...header,
|
|
193
221
|
records: [records[0], ...records.slice(1)]
|
|
194
222
|
}, { disableChecks: true }));
|
|
195
|
-
},
|
|
223
|
+
}),
|
|
196
224
|
catch: (cause) => failure("Cannot capture canonical progress facts", cause)
|
|
197
|
-
});
|
|
225
|
+
}).pipe(Effect.flatMap(Effect.fromResult), Effect.mapError((cause) => Schema.is(ThreadStoreError)(cause) ? cause : failure("Cannot capture canonical progress facts", cause)));
|
|
198
226
|
/** Exact UTF-8 wire accounting reuses the append's privately captured Schema encoding. */
|
|
199
|
-
const canonicalRecordBytes = (record) =>
|
|
227
|
+
const canonicalRecordBytes = (record) => {
|
|
228
|
+
const encoded = recordEncoding(record);
|
|
229
|
+
if (Result.isFailure(encoded)) throw encoded.failure.cause ?? new RangeError(encoded.failure.message);
|
|
230
|
+
return encoded.success.bytes;
|
|
231
|
+
};
|
|
200
232
|
/** Capture before acquiring the mutation owner; summaries never cross a wire boundary. */
|
|
201
|
-
const prepareProgressAppend = (records) =>
|
|
202
|
-
const
|
|
233
|
+
const prepareProgressAppend = (records) => {
|
|
234
|
+
const encodings = Result.all(records.map(captureRecord));
|
|
235
|
+
if (Result.isFailure(encodings)) throw encodings.failure.cause ?? new RangeError(encodings.failure.message);
|
|
236
|
+
return Object.freeze(encodings.success.map((record) => record.progress));
|
|
237
|
+
};
|
|
238
|
+
const factUsageCharge = (facts) => Effect.fromResult(Result.all(facts.map(recordEncoding))).pipe(Effect.map((encodings) => encodings.reduce((bytes, record) => bytes + record.progress.terminalUsageBytes, 0)), Effect.mapError((cause) => failure("Cannot account canonical progress facts", cause)));
|
|
203
239
|
/** These values belong to the active Run, not its permanent conversation history. */
|
|
204
240
|
const isOperationalRecord = ({ payload }) => payload._tag === "RunStarted" || payload._tag === "RunContextRecorded" || payload._tag === "RunCompleted";
|
|
205
241
|
const readContinuation = Effect.fnUntraced(function* (threadId, runId, throughSequence) {
|
|
@@ -428,18 +464,24 @@ const advanceFacts = Effect.fnUntraced(function* (previous, facts, submissionId,
|
|
|
428
464
|
case "ModelResponseRecorded": {
|
|
429
465
|
if (savedContext === void 0) return yield* failure("A model response has no saved original Run context");
|
|
430
466
|
if (payload.turn !== accounting.committedTurns + 1) return yield* failure("Canonical Turn progress must advance once");
|
|
431
|
-
const
|
|
467
|
+
const promptInput = payload.messages;
|
|
468
|
+
const retainedPrompt = responsePrompts.get(payload);
|
|
469
|
+
const messages = retainedPrompt ?? (yield* decodeResponsePrompt(promptInput).pipe(Effect.mapError((cause) => failure("Invalid model evidence", cause))));
|
|
470
|
+
if (retainedPrompt === void 0) {
|
|
471
|
+
const property = Object.getOwnPropertyDescriptor(payload, "messages");
|
|
472
|
+
if (Object.isFrozen(payload) && property !== void 0 && "value" in property && property.value === promptInput && isFrozenJsonData(promptInput)) responsePrompts.set(payload, messages);
|
|
473
|
+
}
|
|
432
474
|
responsePrompt = messages;
|
|
433
475
|
const calls = messages.content.flatMap((message) => message.role === "assistant" ? message.content.filter((part) => part.type === "tool-call") : []);
|
|
434
|
-
const summary = payload.modelUsage === void 0 ? void 0 : yield*
|
|
476
|
+
const summary = payload.modelUsage === void 0 ? void 0 : yield* continuationUsage(payload.modelUsage).pipe(Effect.mapError((cause) => failure("Invalid usage evidence", cause)));
|
|
435
477
|
accounting.committedTurns = payload.turn;
|
|
436
478
|
accounting.toolCalls += calls.length;
|
|
437
479
|
accounting.modelCalls += summary?.modelCalls ?? 1;
|
|
438
|
-
accounting.inputTokens += summary?.inputTokens
|
|
439
|
-
accounting.outputTokens += summary?.outputTokens
|
|
480
|
+
accounting.inputTokens += summary?.inputTokens ?? payload.inputTokens ?? 0;
|
|
481
|
+
accounting.outputTokens += summary?.outputTokens ?? payload.outputTokens ?? 0;
|
|
440
482
|
accounting.costMicrousd += summary?.costMicrousd ?? payload.costMicrousd ?? 0;
|
|
441
|
-
accounting.lastInputTokens = summary?.inputTokens
|
|
442
|
-
accounting.lastOutputTokens = summary?.outputTokens
|
|
483
|
+
accounting.lastInputTokens = summary?.inputTokens ?? payload.inputTokens ?? 0;
|
|
484
|
+
accounting.lastOutputTokens = summary?.outputTokens ?? payload.outputTokens ?? 0;
|
|
443
485
|
accounting.unobservedModelCalls += payload.unobservedModelCalls ?? 0;
|
|
444
486
|
latestResponse = yield* reference(fact);
|
|
445
487
|
response = payload;
|
|
@@ -490,11 +532,11 @@ const advanceFacts = Effect.fnUntraced(function* (previous, facts, submissionId,
|
|
|
490
532
|
break;
|
|
491
533
|
case "ModelCallAborted": {
|
|
492
534
|
if (payload.restart !== (accounting.modelRestarts ?? 0) + 1) return yield* failure("Model restart progress must advance once");
|
|
493
|
-
const summary = yield*
|
|
535
|
+
const summary = yield* continuationUsage(payload.modelUsage).pipe(Effect.mapError((cause) => failure("Invalid cancelled model usage", cause)));
|
|
494
536
|
accounting.modelRestarts = payload.restart;
|
|
495
537
|
accounting.modelCalls += summary.modelCalls;
|
|
496
|
-
accounting.inputTokens += summary.inputTokens
|
|
497
|
-
accounting.outputTokens += summary.outputTokens
|
|
538
|
+
accounting.inputTokens += summary.inputTokens;
|
|
539
|
+
accounting.outputTokens += summary.outputTokens;
|
|
498
540
|
accounting.costMicrousd += summary.costMicrousd;
|
|
499
541
|
accounting.unobservedModelCalls += payload.unobservedModelCalls;
|
|
500
542
|
break;
|
|
@@ -519,7 +561,7 @@ const advanceFacts = Effect.fnUntraced(function* (previous, facts, submissionId,
|
|
|
519
561
|
}
|
|
520
562
|
}
|
|
521
563
|
if (response !== void 0 && response.turn > accounting.accountedToolTurn && response.toolOperations.every((operation) => results.has(operation.toolCallId))) {
|
|
522
|
-
const parts = (responsePrompt ?? (yield* decodeResponsePrompt(response.messages).pipe(Effect.mapError((cause) => failure("Invalid batch evidence", cause))))).content.flatMap((message) => message.role === "assistant" ? message.content : []);
|
|
564
|
+
const parts = (responsePrompt ?? responsePrompts.get(response) ?? (yield* decodeResponsePrompt(response.messages).pipe(Effect.mapError((cause) => failure("Invalid batch evidence", cause))))).content.flatMap((message) => message.role === "assistant" ? message.content : []);
|
|
523
565
|
for (const call of parts) {
|
|
524
566
|
if (call.type !== "tool-call") continue;
|
|
525
567
|
const result = call.providerExecuted ? parts.find((part) => part.type === "tool-result" && part.id === call.id) : results.get(ToolCallId.make(call.id));
|
|
@@ -537,7 +579,7 @@ const advanceFacts = Effect.fnUntraced(function* (previous, facts, submissionId,
|
|
|
537
579
|
const factBytes = facts.reduce((bytes, fact) => bytes + canonicalRecordBytes(fact), 0);
|
|
538
580
|
const turn = facts.reduce((current, fact) => "turn" in fact.payload ? Math.max(current, fact.payload.turn) : current, previous?.continuation.turn ?? 1);
|
|
539
581
|
const turnBase = (previous?.continuation.turn === turn ? previous.continuation.turnBytes : initialBytes) + factBytes;
|
|
540
|
-
const usageCharge = factUsageCharge(facts);
|
|
582
|
+
const usageCharge = yield* factUsageCharge(facts);
|
|
541
583
|
const terminalUsageBytes = (previous?.continuation.terminalUsageBytes ?? 0) + usageCharge;
|
|
542
584
|
const closing = facts.filter(isTerminalBudgetFact);
|
|
543
585
|
return {
|
|
@@ -598,15 +640,12 @@ const verifyRunContinuations = Effect.fnUntraced(function* (records, options) {
|
|
|
598
640
|
*/
|
|
599
641
|
const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId) {
|
|
600
642
|
const reader = yield* ThreadReader;
|
|
601
|
-
const crypto = yield* Crypto.Crypto;
|
|
602
643
|
const gate = yield* Semaphore.make(1);
|
|
603
644
|
const cached = /* @__PURE__ */ new Map();
|
|
604
645
|
const reservations = /* @__PURE__ */ new Map();
|
|
605
646
|
const stagedUsage = /* @__PURE__ */ new Map();
|
|
606
|
-
const provide = (effect) =>
|
|
607
|
-
const
|
|
608
|
-
const retained = cached.get(runId);
|
|
609
|
-
if (retained !== void 0) return retained;
|
|
647
|
+
const provide = (effect) => Effect.provideService(effect, ThreadReader, reader);
|
|
648
|
+
const loadUncachedState = Effect.fnUntraced(function* (runId, after) {
|
|
610
649
|
const loaded = yield* provide(readContinuation(threadId, runId, after));
|
|
611
650
|
if (Option.isNone(loaded)) return void 0;
|
|
612
651
|
const continuation = loaded.value.continuation;
|
|
@@ -663,10 +702,14 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
663
702
|
...completionBytes === void 0 ? {} : { completionBytes }
|
|
664
703
|
};
|
|
665
704
|
});
|
|
666
|
-
const
|
|
705
|
+
const loadState = (runId, after) => Effect.suspend(() => {
|
|
706
|
+
const retained = cached.get(runId);
|
|
707
|
+
return retained === void 0 ? loadUncachedState(runId, after) : Effect.succeed(retained);
|
|
708
|
+
});
|
|
709
|
+
const checkFutureShapes = (state, cursorBytes) => {
|
|
667
710
|
const progress = state.continuation;
|
|
668
711
|
if (progress.position === "settled") return Effect.void;
|
|
669
|
-
const size = canonicalRecordBytes(state.record);
|
|
712
|
+
const size = cursorBytes ?? canonicalRecordBytes(state.record);
|
|
670
713
|
const textBytes = (value) => utf8ByteLength(JSON.stringify(value));
|
|
671
714
|
const refBytes = (value) => utf8ByteLength(JSON.stringify(value));
|
|
672
715
|
const ref = (recordId) => EvidenceReference.make({ recordId });
|
|
@@ -698,12 +741,9 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
698
741
|
if (turnBytes > 4194304 || recordBytes > 33554432 || recordCount > 16384) return Effect.fail(failure("Run has no remaining canonical dispatch capacity", AgentPersistenceCapacityError.make({ message: "Run has no room for the next result and a bounded terminal settlement" })));
|
|
699
742
|
return Effect.void;
|
|
700
743
|
};
|
|
701
|
-
const prepare = Effect.fnUntraced(function* (batch, after) {
|
|
744
|
+
const prepare = Effect.fnUntraced(function* (batch, after, mode = "commit") {
|
|
702
745
|
if (batch.records.some((record) => record.payload._tag === "RunContinuation")) return yield* failure("A caller cannot supply interpreter progress to the progress writer");
|
|
703
|
-
const ownedRecords = yield* Effect.
|
|
704
|
-
try: () => batch.records.map((record) => captureRecord(record).canonical),
|
|
705
|
-
catch: (cause) => failure("Cannot capture canonical progress facts", cause)
|
|
706
|
-
});
|
|
746
|
+
const ownedRecords = yield* Effect.fromResult(Result.all(batch.records.map(captureRecord))).pipe(Effect.map((encodings) => encodings.map((record) => record.canonical)), Effect.mapError((cause) => failure("Cannot capture canonical progress facts", cause)));
|
|
707
747
|
const groups = /* @__PURE__ */ new Map();
|
|
708
748
|
for (const record of ownedRecords) for (const runId of executionRunIds(record)) {
|
|
709
749
|
const facts = groups.get(runId) ?? [];
|
|
@@ -712,6 +752,7 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
712
752
|
}
|
|
713
753
|
const executions = [];
|
|
714
754
|
const accepted = /* @__PURE__ */ new Map();
|
|
755
|
+
let executionCount = 0;
|
|
715
756
|
for (const [runId, facts] of groups) {
|
|
716
757
|
const previous = yield* loadState(runId, after);
|
|
717
758
|
let original = facts.find((record) => record.payload._tag === "UserInputRecorded" && record.payload.kind === "user" && record.payload.runId === runId && record.payload.submissionId !== void 0);
|
|
@@ -747,18 +788,18 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
747
788
|
const fact = facts[index];
|
|
748
789
|
const payload = fact.payload;
|
|
749
790
|
if (payload._tag !== "SubmissionSettled" || payload.runId !== runId) continue;
|
|
750
|
-
const retained = captureRecord(RecordEnvelope.make({
|
|
791
|
+
const retained = yield* Effect.fromResult(captureRecord(RecordEnvelope.make({
|
|
751
792
|
...fact,
|
|
752
793
|
payload: {
|
|
753
794
|
...payload,
|
|
754
795
|
historyRecordCount: canonicalRecords
|
|
755
796
|
}
|
|
756
|
-
})).canonical;
|
|
797
|
+
}))).pipe(Effect.map((record) => record.canonical), Effect.mapError((cause) => failure("Cannot capture canonical progress facts", cause)));
|
|
757
798
|
facts[index] = retained;
|
|
758
799
|
ownedRecords[ownedRecords.indexOf(fact)] = retained;
|
|
759
800
|
}
|
|
760
|
-
const originalInput = previous !== void 0 ? previous.continuation.originalInput : original === void 0 ? yield* failure("Run progress has no original input") : yield*
|
|
761
|
-
const next = yield*
|
|
801
|
+
const originalInput = previous !== void 0 ? previous.continuation.originalInput : original === void 0 ? yield* failure("Run progress has no original input") : yield* reference(original);
|
|
802
|
+
const next = yield* advanceFacts(previous, facts, submissionId, initialBytes);
|
|
762
803
|
const { accounting, savedContext, latestResponse, terminal, position, response, results, childResults, completionBytes, last, factBytes, turn, turnBase, usageCharge, terminalUsageBytes } = next;
|
|
763
804
|
let continuation = yield* RunContinuation.makeEffect({
|
|
764
805
|
version: 1,
|
|
@@ -776,7 +817,7 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
776
817
|
...savedContext === void 0 ? {} : { savedContext },
|
|
777
818
|
...latestResponse === void 0 ? {} : { latestResponse },
|
|
778
819
|
...terminal === void 0 ? {} : { terminal },
|
|
779
|
-
lastFact: yield*
|
|
820
|
+
lastFact: yield* reference(last),
|
|
780
821
|
position,
|
|
781
822
|
accounting
|
|
782
823
|
}).pipe(Effect.mapError(() => capacityFailure("Canonical continuation exceeds its protocol bounds")));
|
|
@@ -813,22 +854,42 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
813
854
|
turnBytes,
|
|
814
855
|
terminalBytes
|
|
815
856
|
}).pipe(Effect.mapError(() => capacityFailure("Turn exceeds its incremental canonical byte budget")));
|
|
816
|
-
continuation =
|
|
857
|
+
continuation = RunContinuation.make({
|
|
817
858
|
...continuation,
|
|
818
859
|
...checkedBytes
|
|
819
860
|
}, { disableChecks: true });
|
|
820
|
-
const
|
|
861
|
+
const proposedRecord = RecordEnvelope.make({
|
|
821
862
|
...header,
|
|
822
863
|
payload: continuation
|
|
823
|
-
}, { disableChecks: true })
|
|
864
|
+
}, { disableChecks: true });
|
|
865
|
+
const cursorBytes = turnBytes - turnBase;
|
|
866
|
+
if (cursorBytes > 8192) return yield* capacityFailure("Encoded continuation exceeds 8192 bytes including its envelope");
|
|
867
|
+
executionCount++;
|
|
868
|
+
if (mode === "preflight" && previous?.checkpoint !== void 0 && facts.every(({ payload }) => payload._tag === "ModelResponseRecorded")) {
|
|
869
|
+
yield* decodeExecutionFrontier({
|
|
870
|
+
canonicalRecords,
|
|
871
|
+
throughSequence: after + ownedRecords.filter((fact) => !isOperationalRecord(fact)).length
|
|
872
|
+
}).pipe(Effect.mapError((cause) => failure("Active execution exceeds its bounds", cause)));
|
|
873
|
+
const state = {
|
|
874
|
+
continuation,
|
|
875
|
+
record: proposedRecord,
|
|
876
|
+
...response === void 0 ? {} : { response },
|
|
877
|
+
results,
|
|
878
|
+
childResults,
|
|
879
|
+
...completionBytes === void 0 ? {} : { completionBytes }
|
|
880
|
+
};
|
|
881
|
+
yield* checkCapacity(state, new Set(batch.records.map(({ recordId }) => recordId)), void 0, usageCharge);
|
|
882
|
+
yield* checkFutureShapes(state, cursorBytes);
|
|
883
|
+
continue;
|
|
884
|
+
}
|
|
885
|
+
const record = yield* Effect.fromResult(captureRecord(proposedRecord)).pipe(Effect.map((record) => record.canonical), Effect.mapError((cause) => failure("Cannot capture canonical progress facts", cause)));
|
|
824
886
|
if (!isExecutionProgressRecord(record)) return yield* failure("Captured execution has no Run continuation");
|
|
825
|
-
if (canonicalRecordBytes(record) !==
|
|
826
|
-
if (canonicalRecordBytes(record) > 8192) return yield* capacityFailure("Encoded continuation exceeds 8192 bytes including its envelope");
|
|
887
|
+
if (canonicalRecordBytes(record) !== cursorBytes) return yield* failure("Continuation byte accounting differs from its Schema encoding");
|
|
827
888
|
const operational = new Map((previous?.checkpoint?.operational ?? []).map((fact) => [fact.recordId, fact]));
|
|
828
889
|
const changed = facts.filter(isOperationalRecord);
|
|
829
890
|
for (const fact of changed) {
|
|
830
891
|
const prior = operational.get(fact.recordId);
|
|
831
|
-
if (prior !== void 0 && recordEncoding(prior).json !== recordEncoding(fact).json) return yield* failure("An active Run fact cannot change after becoming durable");
|
|
892
|
+
if (prior !== void 0 && (yield* Effect.fromResult(recordEncoding(prior)).pipe(Effect.mapError((cause) => failure("Cannot encode active Run fact", cause)))).json !== (yield* Effect.fromResult(recordEncoding(fact)).pipe(Effect.mapError((cause) => failure("Cannot encode active Run fact", cause)))).json) return yield* failure("An active Run fact cannot change after becoming durable");
|
|
832
893
|
operational.set(fact.recordId, fact);
|
|
833
894
|
}
|
|
834
895
|
const checkpoint = yield* ExecutionCheckpoint.makeEffect({
|
|
@@ -859,9 +920,9 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
859
920
|
}));
|
|
860
921
|
accepted.set(runId, state);
|
|
861
922
|
}
|
|
862
|
-
if (ownedRecords.length +
|
|
923
|
+
if (ownedRecords.length + executionCount > 256) return yield* failure("Progress and facts exceed the atomic batch bound");
|
|
863
924
|
return {
|
|
864
|
-
batch:
|
|
925
|
+
batch: CommitBatch.make({
|
|
865
926
|
...batch,
|
|
866
927
|
records: ownedRecords.filter((fact) => !isOperationalRecord(fact))
|
|
867
928
|
}, { disableChecks: true }),
|
|
@@ -877,11 +938,7 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
877
938
|
}
|
|
878
939
|
};
|
|
879
940
|
});
|
|
880
|
-
const tail = Effect.
|
|
881
|
-
const writer = yield* CurrentRunWriter;
|
|
882
|
-
if (writer.threadId !== threadId) return yield* failure("Progress writer belongs to another Thread");
|
|
883
|
-
return (yield* writer.tail).sequence;
|
|
884
|
-
});
|
|
941
|
+
const tail = Effect.flatMap(CurrentRunWriter, (writer) => writer.threadId !== threadId ? Effect.fail(failure("Progress writer belongs to another Thread")) : Effect.map(writer.tail, (position) => position.sequence));
|
|
885
942
|
const commitCaptured = Effect.fnUntraced(function* (batch) {
|
|
886
943
|
const writer = yield* CurrentRunWriter;
|
|
887
944
|
for (let retries = 0;; retries++) {
|
|
@@ -946,7 +1003,7 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
946
1003
|
const defer = (batch) => gate.withPermits(1)(Effect.gen(function* () {
|
|
947
1004
|
const after = yield* tail;
|
|
948
1005
|
const owned = yield* captureFacts(batch);
|
|
949
|
-
yield* prepare(owned, after);
|
|
1006
|
+
yield* prepare(owned, after, "preflight");
|
|
950
1007
|
const response = owned.records.find((record) => record.payload._tag === "ModelResponseRecorded");
|
|
951
1008
|
if (response === void 0 || response.payload._tag !== "ModelResponseRecorded") return yield* failure("Deferred dispatch has no response");
|
|
952
1009
|
const progress = yield* loadState(response.payload.runId, after);
|
|
@@ -1000,4 +1057,4 @@ const makeProgressWriter = Effect.fnUntraced(function* (threadId, deploymentId)
|
|
|
1000
1057
|
//#endregion
|
|
1001
1058
|
export { readRunContext as _, canonicalRecordBytes as a, reference as b, prepareProgressAppend as c, resolveExecutionEvidence as d, runEvidence as f, digestRunHistory as g, verifyRunContinuations as h, RunContinuation_exports as i, readContinuation as l, validateSuffix as m, CurrentRunWriter as n, isOperationalRecord as o, validateProgressAppend as p, ProgressAppendReader as r, makeProgressWriter as s, CurrentRunSettlement as t, readRunEvidenceSnapshot as u, validateContextBoundary as v, resolveEvidence as x, RunContextReader as y };
|
|
1002
1059
|
|
|
1003
|
-
//# sourceMappingURL=RunContinuation-
|
|
1060
|
+
//# sourceMappingURL=RunContinuation-4ZATcVLB.mjs.map
|