effect-agent 0.1.0-beta.157 → 0.1.0-beta.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Admin-BbTZHSLu.d.mts → Admin-DWDYlvvZ.d.mts} +15 -19
- package/dist/{Agent-BCyrGaWg.d.mts → Agent-ZfnNCQXs.d.mts} +2 -2
- package/dist/{AgentPolicy-CnXWWwdg.d.mts → AgentPolicy-B4oH8TbG.d.mts} +13 -1
- package/dist/{AgentRuntime-GQACxY_m.mjs → AgentRuntime-CVMHysXm.mjs} +52 -12
- package/dist/AgentRuntime-CVMHysXm.mjs.map +1 -0
- package/dist/{AgentRuntime-BPlAn5nA.d.mts → AgentRuntime-D1MmB_0z.d.mts} +10 -10
- package/dist/{ContextCompactor-CPlStZRc.d.mts → ContextCompactor-BoKQOjr5.d.mts} +2 -2
- package/dist/{Digest-CNHImGy0.d.mts → Digest-COAt3Orl.d.mts} +2 -2
- package/dist/{DurableAgentRuntime-BAQvZK1e.mjs → DurableAgentRuntime-C7A5guvq.mjs} +60 -30
- package/dist/DurableAgentRuntime-C7A5guvq.mjs.map +1 -0
- package/dist/{EventSource-CETtQTiH.d.mts → EventSource-BfNZBG4A.d.mts} +3 -3
- package/dist/{Messaging-Dkg87ebg.d.mts → Messaging-7VXQnWI3.d.mts} +2 -2
- package/dist/{Messaging-B1zumorg.d.mts → Messaging-CICd_CSi.d.mts} +4 -4
- package/dist/{MessagingHost-B4jqlJmx.d.mts → MessagingHost-DXwWnrMh.d.mts} +4 -4
- package/dist/{Output-WL7JexCm.d.mts → Output-CY7NZByV.d.mts} +2 -2
- package/dist/{PreparedInputAdmission-Swp9t800.d.mts → PreparedInputAdmission-VStpn8u2.d.mts} +4 -4
- package/dist/{Records-BxGWRs-t.d.mts → Records-Bm4Qt70a.d.mts} +3 -3
- package/dist/{RunEventSink-DsbcGXog.d.mts → RunEventSink-9CUdI9Ar.d.mts} +2 -2
- package/dist/{RunOptions-GjDlAuKh.d.mts → RunOptions-BHmBa05n.d.mts} +6 -6
- package/dist/{Schedule-B94iS2X3.d.mts → Schedule-Bi_XVKLF.d.mts} +2 -2
- package/dist/{Subagent-CLaMeZKu.d.mts → Subagent-D59om8SR.d.mts} +11 -13
- package/dist/{Subagent-JjcidJ7q.mjs → Subagent-DH6G120f.mjs} +3 -6
- package/dist/Subagent-DH6G120f.mjs.map +1 -0
- package/dist/{SubagentContract-DdT7Cqe6.d.mts → SubagentContract-tyN9v-Jv.d.mts} +3 -7
- package/dist/{SubagentHost--HBuY8fF.d.mts → SubagentHost-VTyf_wEF.d.mts} +6 -6
- package/dist/{Subscription-DaMCppa_.d.mts → Subscription-Bx1ZRRVS.d.mts} +6 -6
- package/dist/{SubscriptionInput-B0ZtrQoY.d.mts → SubscriptionInput-B5k5vb1S.d.mts} +3 -3
- package/dist/{Worker-2r2zGDkh.d.mts → Worker-XEBYxRQv.d.mts} +3 -3
- package/dist/capabilities/Commands.d.mts +1 -1
- package/dist/capabilities/ContextTools.d.mts +1 -135
- package/dist/capabilities/ContextTools.mjs +1 -40
- package/dist/capabilities/ContextTools.mjs.map +1 -1
- package/dist/capabilities/Messaging.d.mts +2 -2
- package/dist/capabilities/RunHooks.d.mts +1 -1
- package/dist/capabilities/Subagent.d.mts +4 -4
- package/dist/capabilities/Subagent.mjs +2 -2
- package/dist/capabilities/SubagentReservations.d.mts +1 -1
- package/dist/core/Agent.d.mts +1 -1
- package/dist/core/AgentPolicy.d.mts +1 -1
- package/dist/core/AgentPolicy.mjs +6 -0
- package/dist/core/AgentPolicy.mjs.map +1 -1
- package/dist/core/SubagentContract.d.mts +2 -2
- package/dist/core/SubagentContract.mjs +1 -7
- package/dist/core/SubagentContract.mjs.map +1 -1
- package/dist/core/Worker.d.mts +2 -2
- package/dist/durable/ActivityStore.d.mts +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +3 -3
- package/dist/durable/Digest.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +1 -1
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
- package/dist/durable/LifecyclePublication.d.mts +1 -1
- package/dist/durable/MessageDelivery.d.mts +26 -12
- package/dist/durable/MessageDelivery.mjs +49 -17
- package/dist/durable/MessageDelivery.mjs.map +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +7 -7
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +1 -1
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/RunJournal.d.mts +1 -1
- package/dist/durable/Schedule.d.mts +1 -1
- package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
- package/dist/durable/ScheduleTransition.d.mts +1 -1
- package/dist/durable/Scheduling.d.mts +3 -3
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +2 -2
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionTools.d.mts +4 -4
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/Subscriptions.d.mts +6 -6
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadInvariants.d.mts +2 -2
- package/dist/durable/ThreadProjection.d.mts +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadStore.d.mts +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/WorkerAdmission.d.mts +4 -4
- package/dist/durable/WorkerHost.d.mts +6 -6
- package/dist/engine/AgentRuntime.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/engine/Compaction.d.mts +1 -1
- package/dist/engine/ContextCompactor.d.mts +1 -1
- package/dist/engine/MessagingHost.d.mts +1 -1
- package/dist/engine/Output.d.mts +1 -1
- package/dist/engine/RunEventSink.d.mts +1 -1
- package/dist/engine/RunOptions.d.mts +1 -1
- package/dist/engine/SubagentHost.d.mts +1 -1
- package/dist/index.d.mts +21 -21
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
- package/src/capabilities/ContextTools.ts +0 -55
- package/src/capabilities/Subagent.ts +0 -3
- package/src/core/AgentPolicy.ts +6 -0
- package/src/core/SubagentContract.ts +0 -7
- package/src/durable/DurableAgentRuntime.ts +100 -121
- package/src/durable/MessageDelivery.ts +64 -20
- package/src/engine/internal/agent-runtime.ts +109 -30
- package/dist/AgentRuntime-GQACxY_m.mjs.map +0 -1
- package/dist/DurableAgentRuntime-BAQvZK1e.mjs.map +0 -1
- package/dist/Subagent-JjcidJ7q.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as ToolCallId, r as DelegationId, s as RunId, t as AgentId, u as ThreadId } from "./Identifiers-CN2s30fF.mjs";
|
|
2
|
-
import { i as SubagentBudgetReservation, l as SubagentGrant, u as SubagentParentLink } from "./SubagentContract-
|
|
2
|
+
import { i as SubagentBudgetReservation, l as SubagentGrant, u as SubagentParentLink } from "./SubagentContract-tyN9v-Jv.mjs";
|
|
3
3
|
import { i as UpdateError, n as Emitter } from "./AgentUpdates-DMJ-_xow.mjs";
|
|
4
4
|
import { c as RunUsageReport, s as RunTotals } from "./Usage-BNjPR7Zr.mjs";
|
|
5
5
|
import { u as RunEvent } from "./RunEvent-D0aepYwN.mjs";
|
|
@@ -7,16 +7,16 @@ import { n as ThreadHistoryError, t as ThreadHistory } from "./ThreadHistory-FD-
|
|
|
7
7
|
import { n as CurrentToolCatalog } from "./ToolExposure-UCN12eCd.mjs";
|
|
8
8
|
import { s as ToolBroker } from "./ToolBroker-DWs4tZra.mjs";
|
|
9
9
|
import { a as AgentInputError, c as AgentPolicyError, d as AgentToolAuthorizationDenied, f as ContextBudgetError, m as ModelProtocolError, n as AgentApprovalPending, p as ContextOverflowError, s as AgentOutputError, t as AgentApprovalDenied, u as AgentToolAuthorizationCheckError } from "./AgentError-Bn1ytXRD.mjs";
|
|
10
|
-
import { t as AgentPolicy } from "./AgentPolicy-
|
|
11
|
-
import { A as ToolUnion, C as OutputSchema, D as RunDispositionFailure, E as RunDispositionDeclaration, N as UpdatesSchema, O as RunDispositionSchema, S as Output, _ as InstructionSource, a as CompletionFromToolDeclaration, c as Definition, d as EncodedInput, f as Failure, m as InputPromptSource, n as Any, r as AnyDefinition, s as CompletionToolDeclaration, t as Agent_d_exports, w as Requirements } from "./Agent-
|
|
12
|
-
import { a as WorkerBudgetScope } from "./Worker-
|
|
10
|
+
import { t as AgentPolicy } from "./AgentPolicy-B4oH8TbG.mjs";
|
|
11
|
+
import { A as ToolUnion, C as OutputSchema, D as RunDispositionFailure, E as RunDispositionDeclaration, N as UpdatesSchema, O as RunDispositionSchema, S as Output, _ as InstructionSource, a as CompletionFromToolDeclaration, c as Definition, d as EncodedInput, f as Failure, m as InputPromptSource, n as Any, r as AnyDefinition, s as CompletionToolDeclaration, t as Agent_d_exports, w as Requirements } from "./Agent-ZfnNCQXs.mjs";
|
|
12
|
+
import { a as WorkerBudgetScope } from "./Worker-XEBYxRQv.mjs";
|
|
13
13
|
import { a as ContextWindow } from "./ContextWindow-DRQ5Mbm2.mjs";
|
|
14
|
-
import { n as CompactionError } from "./ContextCompactor-
|
|
14
|
+
import { n as CompactionError } from "./ContextCompactor-BoKQOjr5.mjs";
|
|
15
15
|
import { t as DurableStep } from "./DurableStep-Cry_iol4.mjs";
|
|
16
|
-
import { B as RunSubagentChildIdentity, H as RunSubagentEstablishRequest, M as RunOptions, S as RunContextPreparationError, W as RunSubagentJoinRequest, i as ChildEstablishStatus, l as ModelUsageAccounting, t as AgentUpdateAcceptance, x as RunContextPreparation } from "./RunOptions-
|
|
17
|
-
import { t as MessagingHost } from "./MessagingHost-
|
|
18
|
-
import { o as SubagentHost } from "./SubagentHost
|
|
19
|
-
import { t as RunEventSink } from "./RunEventSink-
|
|
16
|
+
import { B as RunSubagentChildIdentity, H as RunSubagentEstablishRequest, M as RunOptions, S as RunContextPreparationError, W as RunSubagentJoinRequest, i as ChildEstablishStatus, l as ModelUsageAccounting, t as AgentUpdateAcceptance, x as RunContextPreparation } from "./RunOptions-BHmBa05n.mjs";
|
|
17
|
+
import { t as MessagingHost } from "./MessagingHost-DXwWnrMh.mjs";
|
|
18
|
+
import { o as SubagentHost } from "./SubagentHost-VTyf_wEF.mjs";
|
|
19
|
+
import { t as RunEventSink } from "./RunEventSink-9CUdI9Ar.mjs";
|
|
20
20
|
import { AiError, LanguageModel, Model, Prompt, Tool, Toolkit } from "effect/unstable/ai";
|
|
21
21
|
import { Cause, Context, Effect, Layer, Option, Schema, Scope, Stream, Tracer } from "effect";
|
|
22
22
|
//#region src/engine/internal/tool-telemetry.d.ts
|
|
@@ -343,4 +343,4 @@ declare namespace AgentRuntime_d_exports {
|
|
|
343
343
|
}
|
|
344
344
|
//#endregion
|
|
345
345
|
export { start as A, decodeFinalOutput as C, renderInputPrompt as D, projectCompletionOutput as E, withTerminalDefectEvent as F, stream as M, streamUnknown as N, run as O, streamWithUsageAccountingUnknown as P, ToolCallWaiting as S, projectCompletionFromToolOutput as T, SubagentDurability as _, AgentResultSchema as a, SubagentDurabilityError as b, AgentSpawner as c, DetachedRun as d, EngineProvidedToolServices as f, SpawnedChildRun as g, SpawnRunOptions as h, AgentResult as i, startUnknown as j, runUnknown as k, AgentSpawnerParent as l, SpawnDelegation as m, AgentChildPending as n, AgentRuntimeFailure as o, RuntimeBinding as p, AgentCompletionProjectionRequirements as r, AgentRuntimeRequirements as s, AgentRuntime_d_exports as t, AgentSpawnerService as u, SubagentDurabilityDurable as v, encodeRunDisposition as w, SubagentDurabilityService as x, SubagentDurabilityEphemeral as y };
|
|
346
|
-
//# sourceMappingURL=AgentRuntime-
|
|
346
|
+
//# sourceMappingURL=AgentRuntime-D1MmB_0z.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as RunId, u as ThreadId } from "./Identifiers-CN2s30fF.mjs";
|
|
2
|
-
import { i as CompactionPolicy } from "./AgentPolicy-
|
|
2
|
+
import { i as CompactionPolicy } from "./AgentPolicy-B4oH8TbG.mjs";
|
|
3
3
|
import { n as ContextRolloverRequest } from "./ContextWindow-DRQ5Mbm2.mjs";
|
|
4
4
|
import { LanguageModel, Model, Prompt } from "effect/unstable/ai";
|
|
5
5
|
import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
|
|
@@ -158,4 +158,4 @@ declare class ContextCompactor extends ContextCompactor_base {
|
|
|
158
158
|
}
|
|
159
159
|
//#endregion
|
|
160
160
|
export { ContextCompaction as a, ContextMessageTokenEstimator as c, CONTEXT_ROLLOVER_PREFIX as d, ContextCompactionState as f, estimatePromptTokens as g, estimateMessageTokens as h, CompactionRequest as i, CLEARED_TOOL_RESULT as l, contextWindowMessage as m, CompactionError as n, ContextCompactor as o, contextWindowId as p, CompactionModelLayer as r, ContextCompactor_d_exports as s, CompactionDecision as t, COMPACTION_SUMMARY_PREFIX as u };
|
|
161
|
-
//# sourceMappingURL=ContextCompactor-
|
|
161
|
+
//# sourceMappingURL=ContextCompactor-BoKQOjr5.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as Digest, h as DefinitionDigests, m as DefinitionDigestInput, s as CanonicalBatch } from "./Records-
|
|
1
|
+
import { _ as Digest, h as DefinitionDigests, m as DefinitionDigestInput, s as CanonicalBatch } from "./Records-Bm4Qt70a.mjs";
|
|
2
2
|
import { Crypto, Effect, Schema } from "effect";
|
|
3
3
|
declare namespace Digest_d_exports {
|
|
4
4
|
export { DigestError, EMPTY_TAIL_DIGEST, digestCanonicalBatch, digestDefinition, digestDefinitions, digestJson };
|
|
@@ -19,4 +19,4 @@ declare const digestDefinitions: (definitions: DefinitionDigestInput) => Effect.
|
|
|
19
19
|
declare const EMPTY_TAIL_DIGEST: string & import("effect/Brand").Brand<"@effect-agent/thread/Digest">;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { digestDefinition as a, digestCanonicalBatch as i, Digest_d_exports as n, digestDefinitions as o, EMPTY_TAIL_DIGEST as r, digestJson as s, DigestError as t };
|
|
22
|
-
//# sourceMappingURL=Digest-
|
|
22
|
+
//# sourceMappingURL=Digest-COAt3Orl.d.mts.map
|
|
@@ -15,7 +15,7 @@ import { a as PeerMessageCapacity, d as MessageAdmission, f as MessagingError, i
|
|
|
15
15
|
import { SubagentHost } from "./engine/SubagentHost.mjs";
|
|
16
16
|
import { ThreadHistory } from "./engine/ThreadHistory.mjs";
|
|
17
17
|
import { n as RunToolVisibility } from "./ToolExposure-9uF_Yo0T.mjs";
|
|
18
|
-
import { f as renderInputPrompt, n as AgentChildPending, y as streamWithUsageAccountingUnknown } from "./AgentRuntime-
|
|
18
|
+
import { f as renderInputPrompt, n as AgentChildPending, y as streamWithUsageAccountingUnknown } from "./AgentRuntime-CVMHysXm.mjs";
|
|
19
19
|
import { ContextRolloverTool } from "./engine/ContextWindow.mjs";
|
|
20
20
|
import { getToolExecutionClass } from "./engine/DurableStep.mjs";
|
|
21
21
|
import { CompactionError, ContextCompactor } from "./engine/ContextCompactor.mjs";
|
|
@@ -2374,6 +2374,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
2374
2374
|
const ledger = yield* SubmissionLedger;
|
|
2375
2375
|
const submissionScheduling = yield* SubmissionScheduling;
|
|
2376
2376
|
const store = yield* ThreadStore;
|
|
2377
|
+
const deliveries = yield* Effect.serviceOption(MessageDeliveryStore);
|
|
2377
2378
|
let projectedJournal;
|
|
2378
2379
|
const wake = yield* WakeScheduler;
|
|
2379
2380
|
const failpoint = yield* DurableRuntimeFailpoint;
|
|
@@ -3337,7 +3338,45 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
3337
3338
|
* notification for single-store parent re-suspension races; `ResumeWaitingParent` remains the
|
|
3338
3339
|
* repair for older data and any already-recorded canonical settlement.
|
|
3339
3340
|
*/
|
|
3340
|
-
const notifyParentOfChildSettlement = Effect.fn("DurableAgentRuntime.notifyParentOfChildSettlement")(function* (submission) {
|
|
3341
|
+
const notifyParentOfChildSettlement = Effect.fn("DurableAgentRuntime.notifyParentOfChildSettlement")(function* (submission, record) {
|
|
3342
|
+
const admission = submission.messageAdmission;
|
|
3343
|
+
const worker = submission.workerAdmission;
|
|
3344
|
+
const key = admission === void 0 ? worker === void 0 ? void 0 : {
|
|
3345
|
+
ownerThreadId: worker.origin.source.threadId,
|
|
3346
|
+
messageId: worker.messageId
|
|
3347
|
+
} : Schema.is(MessageAdmission)(admission) ? admission.message : {
|
|
3348
|
+
ownerThreadId: admission._tag === "WorkerCompletion" ? admission.report.worker.threadId : admission.worker.threadId,
|
|
3349
|
+
messageId: submission.idempotencyKey
|
|
3350
|
+
};
|
|
3351
|
+
if (key !== void 0 && Option.isSome(deliveries)) {
|
|
3352
|
+
const settled = yield* settlementPayloadFromRecord(record, submission.submissionId);
|
|
3353
|
+
yield* deliveries.value.change(key, {
|
|
3354
|
+
_tag: "Complete",
|
|
3355
|
+
nowMillis: yield* Clock.currentTimeMillis,
|
|
3356
|
+
admissionKey: submission.idempotencyKey,
|
|
3357
|
+
inputDigest: submission.inputDigest,
|
|
3358
|
+
receipt: Receipt.make({
|
|
3359
|
+
threadId: submission.threadId,
|
|
3360
|
+
submissionId: submission.submissionId,
|
|
3361
|
+
receiptId: submission.receiptId,
|
|
3362
|
+
queueSequence: submission.queueSequence
|
|
3363
|
+
}),
|
|
3364
|
+
settlement: Settlement.make({
|
|
3365
|
+
submissionId: settled.submissionId,
|
|
3366
|
+
receiptId: settled.receiptId,
|
|
3367
|
+
settlementId: settled.settlementId,
|
|
3368
|
+
outcome: settled.outcome,
|
|
3369
|
+
settledAt: record.createdAt,
|
|
3370
|
+
...settled.outcome === "failed" ? { failure: settled.result } : {},
|
|
3371
|
+
...settled.usageSummary === void 0 ? {} : { usageSummary: settled.usageSummary },
|
|
3372
|
+
...settled.runDisposition === void 0 ? {} : { runDisposition: settled.runDisposition }
|
|
3373
|
+
})
|
|
3374
|
+
}).pipe(Effect.catchCause((cause) => Effect.failCause(Cause.map(cause, (error) => LedgerError.make({
|
|
3375
|
+
operation: "delivery-completion",
|
|
3376
|
+
message: "Destination acknowledgement remains pending",
|
|
3377
|
+
cause: error
|
|
3378
|
+
})))));
|
|
3379
|
+
}
|
|
3341
3380
|
if (submission.workerAdmission?.origin.reporting?.mode === "standard") yield* updateRuntime.repair(submission.threadId).pipe(Effect.mapError(() => LedgerError.make({
|
|
3342
3381
|
operation: "update-delivery",
|
|
3343
3382
|
message: "Update delivery remains pending"
|
|
@@ -3396,13 +3435,13 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
3396
3435
|
records: [record]
|
|
3397
3436
|
})).pipe(Effect.catchTag("AppendConflict", () => Effect.void), Effect.asVoid);
|
|
3398
3437
|
yield* hit("terminalize:after-canonical-append");
|
|
3399
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3438
|
+
yield* notifyParentOfChildSettlement(submission, record);
|
|
3400
3439
|
const settlement = yield* ledger.finalizeSettlement(SettlementFinalization.make({
|
|
3401
3440
|
submissionId,
|
|
3402
3441
|
settlementId
|
|
3403
3442
|
}));
|
|
3404
3443
|
yield* wake.notify(submission.threadId);
|
|
3405
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3444
|
+
yield* notifyParentOfChildSettlement(submission, record);
|
|
3406
3445
|
return settlement;
|
|
3407
3446
|
});
|
|
3408
3447
|
/**
|
|
@@ -3465,14 +3504,14 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
3465
3504
|
records: [reserved.record]
|
|
3466
3505
|
})).pipe(Effect.catchTag("AppendConflict", () => Effect.void), Effect.asVoid);
|
|
3467
3506
|
yield* hit("terminalize:after-canonical-append");
|
|
3468
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3507
|
+
yield* notifyParentOfChildSettlement(submission, reserved.record);
|
|
3469
3508
|
const settlement = yield* ledger.finalizeSettlement(SettlementFinalization.make({
|
|
3470
3509
|
submissionId,
|
|
3471
3510
|
settlementId
|
|
3472
3511
|
}));
|
|
3473
3512
|
const canonicalSettlement = yield* settlementPayloadFromRecord(reserved.record, submissionId);
|
|
3474
3513
|
yield* wake.notify(submission.threadId);
|
|
3475
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3514
|
+
yield* notifyParentOfChildSettlement(submission, reserved.record);
|
|
3476
3515
|
yield* settleJoinedSubmissions(ctx, canonicalSettlement);
|
|
3477
3516
|
return materializeSettlement(settlement, reserved.record);
|
|
3478
3517
|
});
|
|
@@ -3486,28 +3525,28 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
3486
3525
|
})).pipe(Effect.catchTag("AppendConflict", () => Effect.void), Effect.asVoid);
|
|
3487
3526
|
yield* hit("terminalize:after-canonical-append");
|
|
3488
3527
|
}
|
|
3489
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3528
|
+
yield* notifyParentOfChildSettlement(submission, reservation.record);
|
|
3490
3529
|
const settlement = yield* ledger.finalizeSettlement(SettlementFinalization.make({
|
|
3491
3530
|
submissionId: submission.submissionId,
|
|
3492
3531
|
settlementId: reservation.settlementId
|
|
3493
3532
|
}));
|
|
3494
3533
|
const canonicalSettlement = yield* settlementPayloadFromRecord(reservation.record, submission.submissionId);
|
|
3495
3534
|
yield* wake.notify(submission.threadId);
|
|
3496
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3535
|
+
yield* notifyParentOfChildSettlement(submission, reservation.record);
|
|
3497
3536
|
yield* settleJoinedSubmissions(ctx, canonicalSettlement);
|
|
3498
3537
|
return materializeSettlement(settlement, reservation.record);
|
|
3499
3538
|
});
|
|
3500
3539
|
/** Canonical settlement exists: rebuild the ledger from history, never the reverse (DUR-015). */
|
|
3501
3540
|
const finalizeFromHistory = Effect.fn("DurableAgentRuntime.finalizeFromHistory")(function* (submission, record) {
|
|
3502
3541
|
const canonicalSettlement = yield* settlementPayloadFromRecord(record, submission.submissionId);
|
|
3503
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3542
|
+
yield* notifyParentOfChildSettlement(submission, record);
|
|
3504
3543
|
const settlement = yield* ledger.finalizeSettlement(SettlementFinalization.make({
|
|
3505
3544
|
submissionId: submission.submissionId,
|
|
3506
3545
|
settlementId: canonicalSettlement.settlementId
|
|
3507
3546
|
}));
|
|
3508
3547
|
const snapshot = yield* ledger.loadRecoverySnapshot(RecoverySnapshotRequest.make({ submissionId: submission.submissionId }));
|
|
3509
3548
|
yield* wake.notify(submission.threadId);
|
|
3510
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3549
|
+
yield* notifyParentOfChildSettlement(submission, record);
|
|
3511
3550
|
return materializeSettlement(settlement, snapshot.reservation?.record);
|
|
3512
3551
|
});
|
|
3513
3552
|
/**
|
|
@@ -4113,6 +4152,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
4113
4152
|
const boundaries = [];
|
|
4114
4153
|
const cached = projectedJournal;
|
|
4115
4154
|
const journal = cached !== void 0 && cached.threadId === ctx.threadId && cached.through === canonicalThrough && cached.runId === runId && cached.seedThrough === journalSeed?.throughSequence ? (boundaries.push(...cached.boundaries), cached.journal) : yield* projectRunJournalStream(canonical, runId, (boundary) => boundaries.push(boundary), journalSeed, journalMetadata);
|
|
4155
|
+
journalMetadata = void 0;
|
|
4116
4156
|
projectedJournal = {
|
|
4117
4157
|
threadId: ctx.threadId,
|
|
4118
4158
|
through: canonicalThrough,
|
|
@@ -5736,10 +5776,14 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
5736
5776
|
let journalMetadata = initialView.seed === void 0 ? makeJournalMetadata(runIdForSubmission(submissionId)) : void 0;
|
|
5737
5777
|
const retainControl = controlRecords([submissionId]);
|
|
5738
5778
|
const collectControl = (record) => {
|
|
5739
|
-
|
|
5740
|
-
else journalMetadata?.add(record);
|
|
5779
|
+
journalMetadata?.add(record);
|
|
5741
5780
|
return retainControl(record);
|
|
5742
5781
|
};
|
|
5782
|
+
const takeJournalMetadata = () => {
|
|
5783
|
+
const metadata = journalMetadata?.snapshot();
|
|
5784
|
+
if (metadata !== void 0 && metadata.compactions.length > 0) journalMetadata = void 0;
|
|
5785
|
+
return metadata;
|
|
5786
|
+
};
|
|
5743
5787
|
let records = yield* Stream.runCollect(initialView.canonical.pipe(Stream.filter(collectControl)));
|
|
5744
5788
|
const refreshControl = Effect.fn("DurableAgentRuntime.refreshAttemptControl")(function* (throughSequence) {
|
|
5745
5789
|
const through = throughSequence ?? (yield* store.inspectTail(ThreadTailRequest.make({ threadId }))).tailSequence;
|
|
@@ -5895,7 +5939,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
5895
5939
|
const tail = yield* store.inspectTail(ThreadTailRequest.make({ threadId }));
|
|
5896
5940
|
const canonical = Stream.concat(initialView.canonical, canonicalRange(threadId, tail.tailSequence, initialThrough));
|
|
5897
5941
|
const currentRecords = yield* refreshControl(tail.tailSequence);
|
|
5898
|
-
const outcome = yield* runModel(agent, ctx, submission, tokenRef, renewAtRef, currentRecords, canonical, tail.tailSequence, initialView.seed,
|
|
5942
|
+
const outcome = yield* runModel(agent, ctx, submission, tokenRef, renewAtRef, currentRecords, canonical, tail.tailSequence, initialView.seed, takeJournalMetadata(), lineage, approvalDecisionIntents, currentContracts, runTiming, yieldAfter);
|
|
5899
5943
|
if (outcome._tag === "yielded") {
|
|
5900
5944
|
if (outcome.nextSubmissionId !== void 0) onHandoff(outcome.nextSubmissionId);
|
|
5901
5945
|
return Option.none();
|
|
@@ -7141,16 +7185,6 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
7141
7185
|
generatedAt
|
|
7142
7186
|
});
|
|
7143
7187
|
});
|
|
7144
|
-
const runWorkerImpl = (agent) => Effect.gen(function* () {
|
|
7145
|
-
const nonterminal = yield* Stream.runCollect(ledger.scanNonterminal);
|
|
7146
|
-
const seen = /* @__PURE__ */ new Set();
|
|
7147
|
-
for (const submission of nonterminal) {
|
|
7148
|
-
if (seen.has(submission.threadId)) continue;
|
|
7149
|
-
seen.add(submission.threadId);
|
|
7150
|
-
yield* processThreadImpl(agent, submission.threadId);
|
|
7151
|
-
}
|
|
7152
|
-
yield* Stream.runForEach(wake.wakes, (threadId) => processThreadImpl(agent, threadId));
|
|
7153
|
-
});
|
|
7154
7188
|
const runResolvedWorkerImpl = Effect.gen(function* () {
|
|
7155
7189
|
const nonterminal = yield* Stream.runCollect(ledger.scanNonterminal);
|
|
7156
7190
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -7227,7 +7261,6 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
7227
7261
|
processThread: processThreadImpl,
|
|
7228
7262
|
processThreadResolved: processThreadResolvedImpl,
|
|
7229
7263
|
processThreadHead: processThreadHeadImpl,
|
|
7230
|
-
runWorker: runWorkerImpl,
|
|
7231
7264
|
runResolvedWorker: runResolvedWorkerImpl,
|
|
7232
7265
|
runRecovery,
|
|
7233
7266
|
recoverSubmission
|
|
@@ -7268,11 +7301,8 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
7268
7301
|
* seam (Joining/Joined, plan §2.5): the queued input becomes canonical (`input:{sid}`) before
|
|
7269
7302
|
* the next model request, reattaches through the prompt-coverage rule after a crash, and the
|
|
7270
7303
|
* joined Submissions settle with the host outcome (DUR-002/DUR-016).
|
|
7271
|
-
* - `
|
|
7272
|
-
*
|
|
7273
|
-
* runs against this binding. Missing bindings leave accepted roots and children owed.
|
|
7274
|
-
* - `processThreadResolved(threadId)` / `runResolvedWorker` — the
|
|
7275
|
-
* equivalents over registrations owned by the runtime Layer: each stable `agentId` selects
|
|
7304
|
+
* - `processThreadResolved(threadId)` / `runResolvedWorker` — drain or continuously process
|
|
7305
|
+
* lanes using registrations owned by the runtime Layer: each stable `agentId` selects
|
|
7276
7306
|
* one current Binding. Unfinished operation contracts gate handler execution independently
|
|
7277
7307
|
* of immutable admission evidence; missing bindings release the claim with a typed refusal.
|
|
7278
7308
|
* - `runRecovery()` — classify every nonterminal Submission with the pure `classifyRecovery` and
|
|
@@ -7313,4 +7343,4 @@ var DurableAgentRuntime = class DurableAgentRuntime extends Context.Service()("@
|
|
|
7313
7343
|
//#endregion
|
|
7314
7344
|
export { DurableApprovalSuspension as a, RecoveryFailure as c, childReservationIdFor as d, isolateRecovery as f, DurableApprovalResolver as i, RecoveryReport as l, recoveryRepairRecordId as m, DurableAgentRuntime as n, DurableRuntimeConfig as o, recoveryRepairBatchId as p, DurableAgentRuntime_exports as r, RecoveryBlocked as s, ApprovalSuspensionError as t, RecoverySweepResult as u };
|
|
7315
7345
|
|
|
7316
|
-
//# sourceMappingURL=DurableAgentRuntime-
|
|
7346
|
+
//# sourceMappingURL=DurableAgentRuntime-C7A5guvq.mjs.map
|