@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Digest, b as DefinitionDigests, y as DefinitionDigestInput } from "./Records-
|
|
1
|
+
import { S as Digest, b as DefinitionDigests, y as DefinitionDigestInput } from "./Records-BP67Yz6n.mjs";
|
|
2
2
|
import { Crypto, Effect, Schema } from "effect";
|
|
3
3
|
//#region src/core/internal/utf8.d.ts
|
|
4
4
|
/** Count encoded bytes without allocating an encoded copy of the text. */
|
|
@@ -23,4 +23,4 @@ declare const digestDefinition: (definition: Schema.Json) => Effect.Effect<strin
|
|
|
23
23
|
declare const digestDefinitions: (definitions: DefinitionDigestInput) => Effect.Effect<DefinitionDigests, DigestError, Crypto.Crypto>;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { digestDefinition as a, utf8ByteLength as c, digestCanonicalJson as i, Digest_d_exports as n, digestDefinitions as o, canonicalJson as r, digestJson as s, DigestError as t };
|
|
26
|
-
//# sourceMappingURL=Digest-
|
|
26
|
+
//# sourceMappingURL=Digest-1iVcDLVm.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { n as utf8ByteLength } from "./utf8-B5pAmhTo.mjs";
|
|
3
|
-
import { b as Digest, v as DefinitionDigests } from "./Records-
|
|
3
|
+
import { b as Digest, v as DefinitionDigests } from "./Records-bbGVHprv.mjs";
|
|
4
4
|
import { Array, Crypto, Effect, Predicate, Result, Schema } from "effect";
|
|
5
5
|
import { Hex } from "effect/encoding";
|
|
6
6
|
//#region src/durable/internal/canonical-json.ts
|
|
@@ -104,4 +104,4 @@ const digestDefinitions = (definitions) => Effect.all({
|
|
|
104
104
|
//#endregion
|
|
105
105
|
export { digestDefinition as a, boundedCanonicalJson as c, digestCanonicalJson as i, canonicalJson$1 as l, Digest_exports as n, digestDefinitions as o, canonicalJson as r, digestJson as s, DigestError as t };
|
|
106
106
|
|
|
107
|
-
//# sourceMappingURL=Digest-
|
|
107
|
+
//# sourceMappingURL=Digest-CzLJcsWv.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Digest-
|
|
1
|
+
{"version":3,"file":"Digest-CzLJcsWv.mjs","names":["canonicalJson","stringifyCanonicalJson"],"sources":["../src/durable/internal/canonical-json.ts","../src/durable/Digest.ts"],"sourcesContent":["import { Array, Predicate, Result, Schema } from \"effect\";\n\ninterface JsonLimits {\n readonly depth: number;\n readonly nodes: number;\n readonly collectionLength: number;\n readonly textUnits: number;\n}\n\nexport class CanonicalJsonLimitError extends Schema.TaggedError<CanonicalJsonLimitError>()(\n \"CanonicalJsonLimitError\",\n { message: Schema.String },\n) {}\n\n// Only this codec's private synchronous aborts become typed bounds failures.\nconst boundsFailures = new WeakMap<object, string>();\n\nconst exceeded = (bound: \"text\" | \"traversal\" | \"collection\"): never => {\n const message = `Canonical JSON exceeds its ${bound} bound`;\n // oxlint-disable-next-line effect/no-native-error -- Private synchronous codec abort; the Result boundary translates only errors owned here.\n const error = new RangeError(message);\n\n boundsFailures.set(error, message);\n // oxlint-disable-next-line effect/no-untyped-throw -- Abort synchronous JSON traversal at the first exceeded bound; the Result boundary catches this owned error.\n throw error;\n};\n\n/** Values have already crossed their Schema boundary; visit each serialized occurrence. */\nconst serialize = (value: Schema.Json, limits?: JsonLimits): string => {\n let nodes = 0;\n let textUnits = 0;\n\n const charge = (length: number) => {\n if (limits !== undefined && (textUnits += length) > limits.textUnits) return exceeded(\"text\");\n };\n\n const visit = (value: Schema.Json, depth: number): string => {\n if (limits !== undefined && (depth > limits.depth || ++nodes > limits.nodes))\n return exceeded(\"traversal\");\n if (\n value === null ||\n typeof value === \"boolean\" ||\n typeof value === \"number\" ||\n typeof value === \"string\"\n ) {\n const encoded = JSON.stringify(value);\n\n charge(encoded.length);\n\n return encoded;\n }\n if (Array.isArray<Schema.Json>(value)) {\n if (limits !== undefined && value.length > limits.collectionLength)\n return exceeded(\"collection\");\n charge(2 + Math.max(0, value.length - 1));\n\n let json = \"[\";\n\n for (let index = 0; index < value.length; index++) {\n if (index > 0) json += \",\";\n json += visit(value[index], depth + 1);\n }\n\n return `${json}]`;\n }\n\n const keys = Object.keys(value).sort();\n\n if (limits !== undefined && keys.length > limits.collectionLength)\n return exceeded(\"collection\");\n charge(2 + Math.max(0, keys.length - 1));\n let json = \"{\";\n\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n const encodedKey = JSON.stringify(key);\n\n charge(encodedKey.length + 1);\n if (index > 0) json += \",\";\n json += `${encodedKey}:${visit(value[key], depth + 1)}`;\n }\n\n return `${json}}`;\n };\n\n return visit(value, 0);\n};\n\nexport const canonicalJson = (value: Schema.Json): string => serialize(value);\n\nexport const boundedCanonicalJson = (\n value: Schema.Json,\n limits: JsonLimits,\n): Result.Result<string, CanonicalJsonLimitError> => {\n try {\n return Result.succeed(serialize(value, limits));\n } catch (cause) {\n const message = Predicate.isObjectKeyword(cause) ? boundsFailures.get(cause) : undefined;\n\n if (message !== undefined) return Result.fail(CanonicalJsonLimitError.make({ message }));\n // oxlint-disable-next-line effect/no-untyped-throw -- Foreign JSON/getter errors retain their identity for the caller's typed capture boundary.\n throw cause;\n }\n};\n","import type { PlatformError } from \"effect\";\nimport { Crypto, Effect, Schema } from \"effect\";\nimport { Hex } from \"effect/encoding\";\n\nimport { canonicalJson as stringifyCanonicalJson } from \"./internal/canonical-json.ts\";\nimport type { DefinitionDigestInput } from \"./Records.ts\";\nimport { DefinitionDigests, Digest } from \"./Records.ts\";\n\n/** Measure persisted text without allocating a UTF-8 copy. */\nexport { utf8ByteLength } from \"../core/internal/utf8.ts\";\n\nexport class DigestError extends Schema.TaggedError<DigestError>()(\"DigestError\", {\n message: Schema.String,\n cause: Schema.optionalKey(Schema.Defect()),\n}) {}\n\nconst utf8 = new TextEncoder();\nconst decodeDigest = Schema.decodeEffect(Digest);\n\n/** Serialize schema-encoded JSON with the canonical digest's locale-independent key order. */\nexport const canonicalJson = (value: Schema.Json): string => stringifyCanonicalJson(value);\n\nconst digestText = Effect.fnUntraced(function* (\n value: string,\n): Effect.fn.Return<Digest, DigestError, Crypto.Crypto> {\n const crypto = yield* Crypto.Crypto;\n\n const bytes = utf8.encode(value);\n\n const digest = yield* crypto\n .digest(\"SHA-256\", bytes)\n .pipe(\n Effect.mapError((error: PlatformError.PlatformError) =>\n DigestError.make({ message: `SHA-256 failed: ${error.message}`, cause: error }),\n ),\n );\n\n return yield* decodeDigest(Hex.encode(digest)).pipe(\n Effect.mapError(() => DigestError.make({ message: \"SHA-256 returned an invalid digest\" })),\n );\n});\n\n/** Digest a JSON value using a stable, locale-independent object-key ordering (UTF-16 code units, RFC 8785 style). */\nexport const digestJson = (value: Schema.Json): Effect.Effect<Digest, DigestError, Crypto.Crypto> =>\n Effect.suspend(() => digestText(canonicalJson(value)));\n\n/** Hash captured canonical JSON directly, sharing its encoding with accounting and storage. */\nexport const digestCanonicalJson = (json: string) => digestText(json);\n\n/** Digest one schema-encoded Agent, Model, or Toolkit definition. */\nexport const digestDefinition = (definition: Schema.Json) => digestJson(definition);\n\n/** Digest all replay-relevant definitions without hiding which authority changed. */\nexport const digestDefinitions = (\n definitions: DefinitionDigestInput,\n): Effect.Effect<DefinitionDigests, DigestError, Crypto.Crypto> =>\n Effect.all({\n agent: digestDefinition(definitions.agent),\n model: digestDefinition(definitions.model),\n tools: digestDefinition(definitions.tools),\n }).pipe(Effect.map((digests) => DefinitionDigests.make(digests)));\n"],"mappings":"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"}
|
|
@@ -9,7 +9,7 @@ import { s as nativeUpdateId } from "./Agent-B3J0B4l6.mjs";
|
|
|
9
9
|
import { c as captureContext, s as capture } from "./FailureDiagnostic-D9oW23Cn.mjs";
|
|
10
10
|
import { AgentApprovalDenied, AgentApprovalPending, AgentInputDecodeError, AgentInputError, AgentPersistenceCapacityError, AgentToolAuthorizationDenied, PolicyLimit } from "./core/AgentError.mjs";
|
|
11
11
|
import { IdGenerator as IdGenerator$1 } from "./core/IdGenerator.mjs";
|
|
12
|
-
import {
|
|
12
|
+
import { C as boundedValueFootprint, n as AgentChildPending, p as renderInputPrompt, u as executeWithUsageAccountingUnknown, w as copyJson } from "./AgentRuntime-ILtyHuQG.mjs";
|
|
13
13
|
import { DelegationDepth, SubagentBudgetReservation, SubagentDelegationCaps, SubagentGrant, SubagentParentLink, SubagentReservationAmounts, getToolExecutionKind } from "./core/SubagentContract.mjs";
|
|
14
14
|
import { o as Selection, s as Snapshot } from "./ToolExposure-hTJT2ekj.mjs";
|
|
15
15
|
import { ChildRunUsage, InputTokenUsage, ModelCallUsage, ModelResponseIdentity, ModelUsageGroup, OutputTokenUsage, RunUsageReport, RunUsageSummary, emptyRunTotals, runTotalsFromSummary, sumRunTotals, summarizeModelUsage, unknownRunTotals } from "./core/Usage.mjs";
|
|
@@ -19,32 +19,31 @@ import { SubagentHost } from "./engine/SubagentHost.mjs";
|
|
|
19
19
|
import { Store, makeMemoryStore } from "./core/Thread.mjs";
|
|
20
20
|
import { ThreadHistory } from "./engine/ThreadHistory.mjs";
|
|
21
21
|
import { n as RunToolVisibility } from "./ToolExposure-DBATXxmL.mjs";
|
|
22
|
-
import { C as boundedValueFootprint, n as AgentChildPending, p as renderInputPrompt, u as executeWithUsageAccountingUnknown } from "./AgentRuntime-BAExRlgu.mjs";
|
|
23
22
|
import { ContextRolloverTool } from "./engine/ContextWindow.mjs";
|
|
24
23
|
import { CompactionError, ContextCompactor } from "./engine/ContextCompactor.mjs";
|
|
25
24
|
import { AgentUpdateAcceptance, CurrentToolFailureObserver, ModelUsageAccounting, RunContextPreparation, RunContextPreparationPassthrough, RunToolAuthorization, RunToolScheduling } from "./engine/RunOptions.mjs";
|
|
26
|
-
import { A as MAX_RUN_EVIDENCE_RECORDS, At as WorkHandoffCompleted, Bt as WorkerReportingIntent, Ct as ToolCallResolved, Dt as ToolStepSettled, Et as ToolOperation, Ft as WorkerInputRequested, G as PromptRecord, H as PeerMessagePrepared, I as ModelCallAborted, It as WorkerOrigin, Mt as WorkerContinuation, Nt as WorkerInputCompleted, O as MAX_RUN_CONTINUATION_BYTES, Ot as ToolUnavailable, P as MAX_RUN_TOOL_CALL_IDENTITIES, Pt as WorkerInputRefused, R as ModelResponseInterrupted, Rt as WorkerReportPrepared, Tt as ToolCallUnknown, U as PersistedJson, V as PROMPT_EVIDENCE_TAGS, Vt as WorkerStopRequested, X as RecordEnvelope, Z as RecordId, _t as SubmissionSettledRecord, at as RunDurationExhausted, bt as ToolApprovalDecided, c as CanonicalBatch, et as RepairAnnotated, f as CanonicalSequence, ft as SubagentJoined, g as DeclaredToolCall, gt as SubmissionSettled, ht as SubagentStarted, i as BatchId, jt as WorkerAdmission, kt as UserInputRecorded, lt as RunStartedRecord, mt as SubagentRequested, n as AgentUpdateEmitted, o as CURRENT_RECORD_FORMAT, p as CompactionCreated, pt as SubagentLineageRecorded, rt as RunContextRecorded, st as RunPolicyUsageReserved, t as AbortRequested, ut as SettlementFailureDiagnostic, v as DefinitionDigests, vt as SubtreeBudgetReserved, w as MAX_PERSISTED_JSON_BYTES, wt as ToolCallSettled, xt as ToolApprovalRequested, zt as WorkerReportRefused } from "./Records-
|
|
27
|
-
import { i as digestCanonicalJson, r as canonicalJson, s as digestJson } from "./Digest-
|
|
25
|
+
import { A as MAX_RUN_EVIDENCE_RECORDS, At as WorkHandoffCompleted, Bt as WorkerReportingIntent, Ct as ToolCallResolved, Dt as ToolStepSettled, Et as ToolOperation, Ft as WorkerInputRequested, G as PromptRecord, H as PeerMessagePrepared, Ht as HistoryMessage, I as ModelCallAborted, It as WorkerOrigin, Mt as WorkerContinuation, Nt as WorkerInputCompleted, O as MAX_RUN_CONTINUATION_BYTES, Ot as ToolUnavailable, P as MAX_RUN_TOOL_CALL_IDENTITIES, Pt as WorkerInputRefused, R as ModelResponseInterrupted, Rt as WorkerReportPrepared, Tt as ToolCallUnknown, U as PersistedJson, Ut as restoreHistoryMessage, V as PROMPT_EVIDENCE_TAGS, Vt as WorkerStopRequested, X as RecordEnvelope, Z as RecordId, _t as SubmissionSettledRecord, at as RunDurationExhausted, bt as ToolApprovalDecided, c as CanonicalBatch, et as RepairAnnotated, f as CanonicalSequence, ft as SubagentJoined, g as DeclaredToolCall, gt as SubmissionSettled, ht as SubagentStarted, i as BatchId, jt as WorkerAdmission, kt as UserInputRecorded, lt as RunStartedRecord, mt as SubagentRequested, n as AgentUpdateEmitted, o as CURRENT_RECORD_FORMAT, p as CompactionCreated, pt as SubagentLineageRecorded, rt as RunContextRecorded, st as RunPolicyUsageReserved, t as AbortRequested, ut as SettlementFailureDiagnostic, v as DefinitionDigests, vt as SubtreeBudgetReserved, w as MAX_PERSISTED_JSON_BYTES, wt as ToolCallSettled, xt as ToolApprovalRequested, zt as WorkerReportRefused } from "./Records-bbGVHprv.mjs";
|
|
26
|
+
import { i as digestCanonicalJson, r as canonicalJson, s as digestJson } from "./Digest-CzLJcsWv.mjs";
|
|
28
27
|
import { AbortCommand, AbortIntentRequest, AdmissionPolicyError, AdmissionRequest, ApprovalDecisionCommand, ApprovalPendingSuspension, BeginChildBudgetReleaseRequest, ChildReservationId, ChildSettledNotification, ClaimHandoff, ClaimRequest, FundingOwnerRequest, LedgerError, MarkReadyRequest, MarkUnknownRequest, ParentLinkage, RecoverySnapshotRequest, ReleaseChildBudgetRequest, RevertJoiningRequest, Settlement, SettlementFinalization, SubmissionLedger, SubmissionLookupById, SubmissionLookupByKey, SubmissionScheduling, UnknownResolutionCommand, WaitingChild, WaitingForChildSuspension, WorkerLedgerState, submissionAbortBatchId, submissionAbortRecordId, submissionInputBatchId, submissionInputRecordId, submissionSettlementBatchId, submissionSettlementId, submissionSettlementRecordId, unknownResolutionKind } from "./durable/SubmissionLedger.mjs";
|
|
29
28
|
import { DeclaredPendingBatchEvidence, OpenDelegationCallEvidence, OpenToolCallEvidence, PendingApprovalEvidence, RecoveryDecision, RecoveryEvidence, classifyRecovery, pendingApprovalForRecovery } from "./durable/Recovery.mjs";
|
|
30
29
|
import { ExplainedEvidence, ExplainedSubmission, ExplainedUnknownCall, ObligationEntry, ObligationReport, RecoveryExplanation, RetryRefused, obligationSeverityOf, predictRecoveryDisposition, recoveryDecisionMeaning } from "./durable/Admin.mjs";
|
|
31
|
-
import { a as compileRegistrations, c as resolveDefinitionBinding, l as resolveWorkerBinding, n as CurrentBindingSelection, o as definitionDigestsEqual$1, s as makeLegacyWorkerBinding, t as BindingUnavailable, u as toolReplayContracts } from "./agent-registration-
|
|
32
|
-
import { $ as makeJournalMetadata, A as subagentRequestedRecordId, B as toolStepSettledRecordId, C as runStartedBatchId, D as subagentLineageBatchId, E as subagentJoinedRecordId, F as toolCallResolutionBatchId, G as turnResponseBatch, I as toolCallResolvedRecordId, K as turnResponseBatchId, L as toolCallResultBatchId, M as subagentStartedRecordId, N as toolApprovalDecisionRecordId, O as subagentLineageRecordId, P as toolApprovalRequestRecordId, R as toolCallUnknownRecordId, S as runIdForSubmission, T as subagentJoinBatchId, U as turnCanonicalBatch, V as turnApprovalsBatchId, W as turnIdForRun, X as workerOriginRecordId, Y as workerInputRecordId, Z as workerReportRecordId, _ as projectRunJournalStream, a as childIdempotencyKeyFor, b as runDurationBatchId, c as compactionRecordId, d as markUnknownBatchId, et as toolCallSettledRecordId, f as modelResponseInterruptedBatchId, h as peerMessageRecordId, i as approvalDecisionBatchId, j as subagentStartedBatchId, k as subagentRequestedBatchId, l as firstWorkerInputRecordId, m as modelResponseRecordId, o as childThreadIdFor, p as modelResponseInterruptedRecordId, q as turnResultsBatch, r as agentUpdateRecordId, s as compactionBatchId, t as RunJournalError, u as initialRunJournal, w as runStartedRecordId, x as runDurationRecordId, y as runCompletedRecordId, z as toolStepSettledBatchId } from "./RunJournal-
|
|
33
|
-
import { H as ThreadRead, I as ThreadIdentityRequest, L as ThreadMaterialization, V as ThreadPromptRead, W as ThreadReader, X as ThreadStoreDiagnostic, Y as ThreadStore, Z as ThreadStoreError, _t as executionRunIds, ct as getRunInput, et as ThreadTailRequest, gt as canonicalRunIds, m as MAX_THREAD_EXPORT_PAGE_BYTES, mt as captureRecord, n as AppendRequest, st as getRecord, ut as readWorkerState, vt as isPreContinuationFact, xt as terminalUsageCharge, z as ThreadObservation } from "./ThreadStore-
|
|
30
|
+
import { a as compileRegistrations, c as resolveDefinitionBinding, l as resolveWorkerBinding, n as CurrentBindingSelection, o as definitionDigestsEqual$1, s as makeLegacyWorkerBinding, t as BindingUnavailable, u as toolReplayContracts } from "./agent-registration-7kp1dHT0.mjs";
|
|
31
|
+
import { $ as makeJournalMetadata, A as subagentRequestedRecordId, B as toolStepSettledRecordId, C as runStartedBatchId, D as subagentLineageBatchId, E as subagentJoinedRecordId, F as toolCallResolutionBatchId, G as turnResponseBatch, I as toolCallResolvedRecordId, K as turnResponseBatchId, L as toolCallResultBatchId, M as subagentStartedRecordId, N as toolApprovalDecisionRecordId, O as subagentLineageRecordId, P as toolApprovalRequestRecordId, R as toolCallUnknownRecordId, S as runIdForSubmission, T as subagentJoinBatchId, U as turnCanonicalBatch, V as turnApprovalsBatchId, W as turnIdForRun, X as workerOriginRecordId, Y as workerInputRecordId, Z as workerReportRecordId, _ as projectRunJournalStream, a as childIdempotencyKeyFor, b as runDurationBatchId, c as compactionRecordId, d as markUnknownBatchId, et as toolCallSettledRecordId, f as modelResponseInterruptedBatchId, h as peerMessageRecordId, i as approvalDecisionBatchId, j as subagentStartedBatchId, k as subagentRequestedBatchId, l as firstWorkerInputRecordId, m as modelResponseRecordId, o as childThreadIdFor, p as modelResponseInterruptedRecordId, q as turnResultsBatch, r as agentUpdateRecordId, s as compactionBatchId, t as RunJournalError, u as initialRunJournal, w as runStartedRecordId, x as runDurationRecordId, y as runCompletedRecordId, z as toolStepSettledBatchId } from "./RunJournal-DQr2dUgg.mjs";
|
|
32
|
+
import { H as ThreadRead, I as ThreadIdentityRequest, L as ThreadMaterialization, V as ThreadPromptRead, W as ThreadReader, X as ThreadStoreDiagnostic, Y as ThreadStore, Z as ThreadStoreError, _t as executionRunIds, ct as getRunInput, et as ThreadTailRequest, gt as canonicalRunIds, m as MAX_THREAD_EXPORT_PAGE_BYTES, mt as captureRecord, n as AppendRequest, st as getRecord, ut as readWorkerState, vt as isPreContinuationFact, xt as terminalUsageCharge, z as ThreadObservation } from "./ThreadStore-C_ofHc7h.mjs";
|
|
34
33
|
import { ScheduledInputRefused, ScheduledInputRetryable } from "./durable/Schedule.mjs";
|
|
35
34
|
import { PreparedInputAdmission } from "./durable/PreparedInputAdmission.mjs";
|
|
36
35
|
import { PreparedInput } from "./durable/Subscription.mjs";
|
|
37
36
|
import { MessageDeliveryDriver, MessageDeliveryFailpoint, MessageDeliveryRecord, MessageDeliveryStore, prepareMessageDelivery } from "./durable/MessageDelivery.mjs";
|
|
38
37
|
import { DurableRuntimeFailpoint } from "./durable/DurableFailpoint.mjs";
|
|
39
|
-
import { _ as readRunContext, a as canonicalRecordBytes, b as reference, f as runEvidence, g as digestRunHistory, l as readContinuation, m as validateSuffix, n as CurrentRunWriter, s as makeProgressWriter, t as CurrentRunSettlement, u as readRunEvidenceSnapshot, x as resolveEvidence, y as RunContextReader } from "./RunContinuation-
|
|
38
|
+
import { _ as readRunContext, a as canonicalRecordBytes, b as reference, f as runEvidence, g as digestRunHistory, l as readContinuation, m as validateSuffix, n as CurrentRunWriter, s as makeProgressWriter, t as CurrentRunSettlement, u as readRunEvidenceSnapshot, x as resolveEvidence, y as RunContextReader } from "./RunContinuation-DJ6kkbQG.mjs";
|
|
40
39
|
import { MAX_WORK_CURSOR_CHARS, ThreadWorkDiscovery, ThreadWorkEntry, ThreadWorkRequest, WorkDiscoveryUnavailable, decodeWorkCursor, deliveryPredecessor, encodeWorkCursor, operationEvidence, resolveWorkEvidence, validateWorkPage, workId } from "./durable/ThreadWork.mjs";
|
|
41
40
|
import { WakeScheduler } from "./durable/WakeScheduler.mjs";
|
|
42
41
|
import { n as safeUnknownString, t as inspectForeignDiagnostic } from "./foreign-diagnostic-DBQ1XHKh.mjs";
|
|
43
|
-
import { c as threadCreatedBatchId, l as threadCreatedRecordId, n as WorkerAdmissionPort, o as ensureThreadCreated, r as WorkerAdmissionRequest, s as ensureWorkerOrigin } from "./WorkerAdmission-
|
|
42
|
+
import { c as threadCreatedBatchId, l as threadCreatedRecordId, n as WorkerAdmissionPort, o as ensureThreadCreated, r as WorkerAdmissionRequest, s as ensureWorkerOrigin } from "./WorkerAdmission-9Ka3edXj.mjs";
|
|
44
43
|
import { i as unresolvedToolOperations, n as isUnresolvedToolOperation, r as toolOperationStates, t as initialDispatchBlockedTurns } from "./tool-operations-BXBmagY1.mjs";
|
|
45
44
|
import { WorkerBudgetAuthorizer, WorkerConcurrencyLimit, WorkerConcurrencyResolver, WorkerHostAuthorizer, WorkerHostConfig, WorkerPolicyResolver } from "./durable/WorkerHost.mjs";
|
|
46
45
|
import { OperationAuthorizationRequest, OperationAuthorizer, OperationDenied } from "./durable/OperationAuthorizer.mjs";
|
|
47
|
-
import { o as makeRunWriter, r as RunStorage, s as StorageOwner } from "./RunStorage-
|
|
46
|
+
import { o as makeRunWriter, r as RunStorage, s as StorageOwner } from "./RunStorage-DblN-cmM.mjs";
|
|
48
47
|
import { SettlementPublication } from "./durable/SettlementPublisher.mjs";
|
|
49
48
|
import { PendingSubmission, SettledSubmission } from "./durable/SubmissionStatus.mjs";
|
|
50
49
|
import { DeclaredToolCallEvidence, ToolReconciler } from "./durable/ToolReconciler.mjs";
|
|
@@ -334,7 +333,7 @@ const initialContext = Effect.fnUntraced(function* (original) {
|
|
|
334
333
|
if (matches.length !== 1 || declaration === void 0 || declaration.sequence >= entry.sequence) return yield* invalid("Late Tool result has no exact original declaration");
|
|
335
334
|
const response = declaration.record.payload;
|
|
336
335
|
if (response._tag !== "ModelResponseRecorded" || response.runId !== payload.runId || toolCallSettledRecordId(response.runId, response.turn, payload.toolCallId) !== entry.record.recordId || !response.toolOperations.some((operation) => operation.toolCallId === payload.toolCallId && operation.toolName === payload.toolName)) return yield* invalid("Late Tool result differs from its original declaration identity");
|
|
337
|
-
if (!(yield* Schema.
|
|
336
|
+
if (!(yield* Schema.decodeEffect(Prompt.Prompt)(response.messages).pipe(Effect.mapError(() => invalid("Late Tool declaration messages are malformed")))).content.some((message) => message.role === "assistant" && message.content.some((part) => part.type === "tool-call" && !part.providerExecuted && part.id === payload.toolCallId && part.name === payload.toolName))) return yield* invalid("Late Tool declaration arguments are invalid");
|
|
338
337
|
const error = retain(declaration);
|
|
339
338
|
if (error !== void 0) return yield* error;
|
|
340
339
|
if (!terminalInputs.has(payload.runId)) {
|
|
@@ -743,44 +742,8 @@ const JSON_PREFIX = "{\"content\":[";
|
|
|
743
742
|
const encodePrompt = Schema.encodeEffect(Schema.toCodecJson(Prompt.Prompt));
|
|
744
743
|
const parseJson = Schema.decodeEffect(Schema.fromJsonString(Schema.Unknown));
|
|
745
744
|
const decodeCommittedPromptRecord = Schema.decodeUnknownSync(PromptRecord);
|
|
746
|
-
const decodeEncodedPrompt = Schema.decodeUnknownEffect(Schema.suspend(() => Schema.Struct({ content: Schema.Array(
|
|
745
|
+
const decodeEncodedPrompt = Schema.decodeUnknownEffect(Schema.suspend(() => Schema.Struct({ content: Schema.Array(HistoryMessage).check(Schema.isMaxLength(MAX_ENTRIES)) })));
|
|
747
746
|
const decodePrompt$1 = Schema.decodeUnknownEffect(Schema.suspend(() => Schema.Struct({ content: Schema.Array(Schema.toCodecJson(Prompt.Message)).check(Schema.isMaxLength(MAX_ENTRIES)) })));
|
|
748
|
-
function hydratePart(part) {
|
|
749
|
-
switch (part.type) {
|
|
750
|
-
case "text": return Prompt.textPart(part);
|
|
751
|
-
case "reasoning": return Prompt.reasoningPart(part);
|
|
752
|
-
case "file": return Prompt.filePart(part);
|
|
753
|
-
case "tool-call": return Prompt.toolCallPart({
|
|
754
|
-
...part,
|
|
755
|
-
providerExecuted: part.providerExecuted ?? false
|
|
756
|
-
});
|
|
757
|
-
case "tool-result": return Prompt.toolResultPart({
|
|
758
|
-
...part,
|
|
759
|
-
providerExecuted: part.providerExecuted ?? false
|
|
760
|
-
});
|
|
761
|
-
case "tool-approval-request": return Prompt.toolApprovalRequestPart(part);
|
|
762
|
-
case "tool-approval-response": return Prompt.toolApprovalResponsePart(part);
|
|
763
|
-
}
|
|
764
|
-
return part;
|
|
765
|
-
}
|
|
766
|
-
const hydrateMessage = (message) => {
|
|
767
|
-
switch (message.role) {
|
|
768
|
-
case "system": return Prompt.systemMessage(message);
|
|
769
|
-
case "user": return Prompt.userMessage({
|
|
770
|
-
...message,
|
|
771
|
-
content: typeof message.content === "string" ? [Prompt.textPart({ text: message.content })] : message.content.map((p) => hydratePart(p))
|
|
772
|
-
});
|
|
773
|
-
case "assistant": return Prompt.assistantMessage({
|
|
774
|
-
...message,
|
|
775
|
-
content: typeof message.content === "string" ? [Prompt.textPart({ text: message.content })] : message.content.map((p) => hydratePart(p))
|
|
776
|
-
});
|
|
777
|
-
case "tool": return Prompt.toolMessage({
|
|
778
|
-
...message,
|
|
779
|
-
content: message.content.map((p) => hydratePart(p))
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
return message;
|
|
783
|
-
};
|
|
784
747
|
/** Internal canonical projection; ownership comes from the ThreadStore read contract. */
|
|
785
748
|
const preparePromptHistory = (prompt) => prompt.content.length > MAX_ENTRIES ? void 0 : {
|
|
786
749
|
prompt,
|
|
@@ -804,7 +767,7 @@ const decodeCheckpointPrefix = Effect.fnUntraced(function* (encoded, length) {
|
|
|
804
767
|
const value = yield* parseJson(encoded);
|
|
805
768
|
const bytes = retainedBytes(value, encoded, MAX_BYTES);
|
|
806
769
|
if (bytes === void 0) return void 0;
|
|
807
|
-
const decoded = yield* decodeEncodedPrompt(value).pipe(Effect.map((prompt) => ({ content: prompt.content.map(
|
|
770
|
+
const decoded = yield* decodeEncodedPrompt(value).pipe(Effect.map((prompt) => ({ content: prompt.content.map(restoreHistoryMessage) })), Effect.catch(() => decodePrompt$1(value)));
|
|
808
771
|
return decoded.content.length === length ? {
|
|
809
772
|
prompt: Prompt.fromMessages(decoded.content),
|
|
810
773
|
encoded,
|
|
@@ -936,6 +899,7 @@ const makeCommittedPromptSuffix = (original) => {
|
|
|
936
899
|
const readSuffix = Effect.fnUntraced(function* (writer, from, through, firstRun, allowance, firstThrough, pageRecords = 1, committed) {
|
|
937
900
|
const store = yield* ThreadStore;
|
|
938
901
|
const records = [];
|
|
902
|
+
const metadata = makeJournalMetadata(void 0);
|
|
939
903
|
let after = from;
|
|
940
904
|
let remaining = allowance;
|
|
941
905
|
let active;
|
|
@@ -966,6 +930,7 @@ const readSuffix = Effect.fnUntraced(function* (writer, from, through, firstRun,
|
|
|
966
930
|
if (footprint === void 0) return void 0;
|
|
967
931
|
remaining -= 32 * footprint;
|
|
968
932
|
records.push(entry);
|
|
933
|
+
metadata.add(entry);
|
|
969
934
|
after = entry.sequence;
|
|
970
935
|
}
|
|
971
936
|
if (page.length === 0) break;
|
|
@@ -974,7 +939,7 @@ const readSuffix = Effect.fnUntraced(function* (writer, from, through, firstRun,
|
|
|
974
939
|
let incomplete = false;
|
|
975
940
|
const delta = yield* projectRunJournalStream(Stream.fromIterable(records), void 0, (boundary) => {
|
|
976
941
|
if (boundary.incomplete) incomplete = true;
|
|
977
|
-
});
|
|
942
|
+
}, void 0, metadata.finish());
|
|
978
943
|
if (incomplete || delta.prompt.content.length > MAX_ENTRIES) return void 0;
|
|
979
944
|
const encoded = yield* encodeHistory(delta.prompt, allowance);
|
|
980
945
|
return encoded.bytes === void 0 ? void 0 : {
|
|
@@ -3099,6 +3064,7 @@ var CoordinatorHalt = class {
|
|
|
3099
3064
|
}
|
|
3100
3065
|
};
|
|
3101
3066
|
const isCoordinatorHaltCause = (cause) => cause.reasons.every((reason) => reason._tag !== "Fail" || reason.error instanceof CoordinatorHalt);
|
|
3067
|
+
const isPersistenceCapacityCause = (cause) => cause.reasons.length > 0 && cause.reasons.every((reason) => Cause.isFailReason(reason) && reason.error instanceof ThreadStoreError && reason.error.cause instanceof AgentPersistenceCapacityError);
|
|
3102
3068
|
const PolicyFailure = Schema.TaggedStruct("AgentPolicyError", { limit: PolicyLimit });
|
|
3103
3069
|
const decodePolicyFailure = Schema.decodeUnknownOption(PolicyFailure);
|
|
3104
3070
|
const decodePolicyFailureSafely = (error) => {
|
|
@@ -5560,6 +5526,9 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
5560
5526
|
}
|
|
5561
5527
|
return "committed";
|
|
5562
5528
|
}
|
|
5529
|
+
if (commit._tag === "Response" && commit.defer !== true && response !== void 0 && progress !== void 0) {
|
|
5530
|
+
if (!(yield* progress.preflight(yield* turnResponseBatch(input)).pipe(Effect.provideService(CurrentRunWriter, ctx), Effect.as(true), Effect.catchCauseIf((cause) => isPersistenceCapacityCause(cause), () => Effect.succeed(false))))) return "capacity-refused";
|
|
5531
|
+
}
|
|
5563
5532
|
if (commit._tag === "Response" && commit.defer === true) {
|
|
5564
5533
|
if (toolOperations.length === 0 || toolOperations.some((call) => call.executionClass !== "readonly" || call.executionKind !== "ordinary")) return yield* RunJournalError.make({ message: "Only ordinary readonly Tool responses may be deferred" });
|
|
5565
5534
|
const candidate = {
|
|
@@ -5583,10 +5552,10 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
5583
5552
|
...input.usage,
|
|
5584
5553
|
modelUsage: input.usage.modelUsage?.map((usage) => ModelCallUsage.make({
|
|
5585
5554
|
...usage,
|
|
5586
|
-
...usage.response === void 0 ? {} : { response: ModelResponseIdentity.make({ ...usage.response }) },
|
|
5587
|
-
inputTokens: InputTokenUsage.make({ ...usage.inputTokens }),
|
|
5588
|
-
outputTokens: OutputTokenUsage.make({ ...usage.outputTokens })
|
|
5589
|
-
}))
|
|
5555
|
+
...usage.response === void 0 ? {} : { response: ModelResponseIdentity.make({ ...usage.response }, { disableChecks: true }) },
|
|
5556
|
+
inputTokens: InputTokenUsage.make({ ...usage.inputTokens }, { disableChecks: true }),
|
|
5557
|
+
outputTokens: OutputTokenUsage.make({ ...usage.outputTokens }, { disableChecks: true })
|
|
5558
|
+
}, { disableChecks: true }))
|
|
5590
5559
|
}
|
|
5591
5560
|
})
|
|
5592
5561
|
};
|
|
@@ -5595,10 +5564,11 @@ const make = Effect.fnUntraced(function* (bindings) {
|
|
|
5595
5564
|
operation: "reserve readonly dispatch",
|
|
5596
5565
|
message: "Dispatch has no scoped progress writer"
|
|
5597
5566
|
});
|
|
5598
|
-
const batch = yield* progress.defer(candidate.batch).pipe(Effect.provideService(CurrentRunWriter, ctx));
|
|
5567
|
+
const batch = yield* progress.defer(candidate.batch).pipe(Effect.provideService(CurrentRunWriter, ctx), Effect.asSome, Effect.catchCauseIf((cause) => isPersistenceCapacityCause(cause), () => Effect.succeedNone));
|
|
5568
|
+
if (Option.isNone(batch)) return "capacity-refused";
|
|
5599
5569
|
deferredResponse = {
|
|
5600
5570
|
...candidate,
|
|
5601
|
-
batch
|
|
5571
|
+
batch: batch.value
|
|
5602
5572
|
};
|
|
5603
5573
|
return "deferred";
|
|
5604
5574
|
}
|
|
@@ -8540,4 +8510,4 @@ var DurableAgentRuntime = class DurableAgentRuntime extends Context.Service()("@
|
|
|
8540
8510
|
//#endregion
|
|
8541
8511
|
export { DurableApprovalSuspension as a, RecoveryFailure as c, WorkRecoveryReport as d, WorkRecoveryRequest as f, recoveryRepairRecordId as g, recoveryRepairBatchId as h, DurableApprovalResolver as i, RecoveryReport as l, isolateRecovery as m, DurableAgentRuntime as n, DurableRuntimeConfig as o, childReservationIdFor as p, DurableAgentRuntime_exports as r, RecoveryBlocked as s, ApprovalSuspensionError as t, RecoverySweepResult as u };
|
|
8542
8512
|
|
|
8543
|
-
//# sourceMappingURL=DurableAgentRuntime-
|
|
8513
|
+
//# sourceMappingURL=DurableAgentRuntime-Cj263rW9.mjs.map
|