effect-agent 0.1.0-beta.97 → 0.1.0-beta.99
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/{AgentRuntime-B64362Id.d.mts → AgentRuntime-BMzrJos6.d.mts} +2 -2
- package/dist/{AgentRuntime-Cdvqw7l_.mjs → AgentRuntime-BWOnNc0d.mjs} +78 -42
- package/dist/AgentRuntime-BWOnNc0d.mjs.map +1 -0
- package/dist/{DurableAgentRuntime-DbUvZHDZ.mjs → DurableAgentRuntime-BE_OjQjz.mjs} +471 -252
- package/dist/DurableAgentRuntime-BE_OjQjz.mjs.map +1 -0
- package/dist/{DurableFailpoint-DQJet828.d.mts → DurableFailpoint-mx3-nsxU.d.mts} +3 -3
- package/dist/{EventSource-D6PAAEyK.d.mts → EventSource-BZ73J0s5.d.mts} +3 -3
- package/dist/{PreparedInputAdmission-omMbwd--.d.mts → PreparedInputAdmission-BkeI-Xvr.d.mts} +4 -4
- package/dist/{Records-CV49DgQK.d.mts → Records-BIiRLqlz.d.mts} +92 -128
- package/dist/{Records-BAutSSnJ.mjs → Records-DR1xtbXY.mjs} +35 -8
- package/dist/Records-DR1xtbXY.mjs.map +1 -0
- package/dist/{RunJournal-DRRRZmG7.mjs → RunJournal-DNs3PM4K.mjs} +80 -23
- package/dist/RunJournal-DNs3PM4K.mjs.map +1 -0
- package/dist/{RunOptions-Clj8cLsp.d.mts → RunOptions-Bruk54SE.d.mts} +13 -4
- package/dist/{Schedule-DePbGfgd.d.mts → Schedule-BNFlluAl.d.mts} +2 -2
- package/dist/{Scheduling-C3QpYn0W.mjs → Scheduling-HFH0pST1.mjs} +2 -2
- package/dist/{Scheduling-C3QpYn0W.mjs.map → Scheduling-HFH0pST1.mjs.map} +1 -1
- package/dist/{Subagent-Cbfzylz1.mjs → Subagent-C2s8PFrd.mjs} +2 -2
- package/dist/{Subagent-Cbfzylz1.mjs.map → Subagent-C2s8PFrd.mjs.map} +1 -1
- package/dist/{Subagent-Bm1dRecN.d.mts → Subagent-m7ywTCe4.d.mts} +3 -3
- package/dist/{Subscription-BR_8Cxh3.d.mts → Subscription-BCQ3L9Zp.d.mts} +3 -3
- package/dist/{SubscriptionInput-B95sQbuk.d.mts → SubscriptionInput-Cqu4_RW3.d.mts} +3 -3
- package/dist/{ToolReconciler-DQVaJfpE.d.mts → ToolReconciler-BmVRAHKs.d.mts} +8 -4
- package/dist/agent-registration-cXpB8cBU.mjs +199 -0
- package/dist/agent-registration-cXpB8cBU.mjs.map +1 -0
- package/dist/capabilities/Commands.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/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 +12 -10
- package/dist/durable/Admin.mjs.map +1 -1
- package/dist/durable/AgentRegistration.d.mts +2 -2
- package/dist/durable/AgentRegistration.mjs +4 -8
- package/dist/durable/AgentRegistration.mjs.map +1 -1
- package/dist/durable/Certification.d.mts +2 -2
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/CommittedActivity.mjs +1 -1
- 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 +1 -1
- package/dist/durable/DurableFailpoint.d.mts +1 -1
- package/dist/durable/DurableFailpoint.mjs +2 -0
- package/dist/durable/DurableFailpoint.mjs.map +1 -1
- package/dist/durable/DurableFailpointTestControl.d.mts +1 -1
- 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/GitHubWorkflowSource.mjs +1 -1
- package/dist/durable/MessageDelivery.d.mts +3 -3
- package/dist/durable/MessageDelivery.mjs +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
- package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PersistentHistory.mjs +2 -2
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +2 -2
- package/dist/durable/Records.mjs +2 -2
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/Recovery.mjs +9 -9
- package/dist/durable/Recovery.mjs.map +1 -1
- package/dist/durable/RunJournal.d.mts +2 -2
- package/dist/durable/RunJournal.mjs +2 -2
- 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 +2 -2
- package/dist/durable/Scheduling.mjs +1 -1
- package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
- package/dist/durable/SqlStorageV2Upgrade.mjs +1 -1
- package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
- package/dist/durable/SqlSubscriptionStore.mjs +1 -1
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedger.mjs +14 -13
- package/dist/durable/SubmissionLedger.mjs.map +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +9 -2
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -1
- 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 +3 -3
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/SubscriptionTransition.mjs +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/Subscriptions.mjs +1 -1
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistory.mjs +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
- package/dist/durable/ThreadInvariants.d.mts +4 -2
- package/dist/durable/ThreadInvariants.mjs +49 -3
- package/dist/durable/ThreadInvariants.mjs.map +1 -1
- 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/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 +1 -1
- package/dist/durable/ToolReconciler.d.mts +1 -1
- package/dist/durable/ToolReconciler.mjs +9 -5
- package/dist/durable/ToolReconciler.mjs.map +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- 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/index.d.mts +11 -11
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
- package/src/durable/Admin.ts +20 -11
- package/src/durable/AgentRegistration.ts +1 -5
- package/src/durable/DurableAgentRuntime.ts +947 -464
- package/src/durable/DurableFailpoint.ts +2 -0
- package/src/durable/Records.ts +30 -5
- package/src/durable/Recovery.ts +8 -8
- package/src/durable/RunJournal.ts +128 -51
- package/src/durable/SubmissionLedger.ts +13 -12
- package/src/durable/SubmissionLedgerConformance.ts +13 -2
- package/src/durable/ThreadInvariants.ts +70 -5
- package/src/durable/ToolReconciler.ts +7 -3
- package/src/durable/internal/agent-registration.ts +65 -414
- package/src/durable/internal/messaging-host.ts +0 -2
- package/src/durable/internal/worker-host.ts +34 -96
- package/src/engine/RunOptions.ts +13 -3
- package/src/engine/internal/agent-runtime.ts +160 -106
- package/dist/AgentRuntime-Cdvqw7l_.mjs.map +0 -1
- package/dist/DurableAgentRuntime-DbUvZHDZ.mjs.map +0 -1
- package/dist/Records-BAutSSnJ.mjs.map +0 -1
- package/dist/RunJournal-DRRRZmG7.mjs.map +0 -1
- package/dist/agent-registration-CXGDwvJH.mjs +0 -379
- package/dist/agent-registration-CXGDwvJH.mjs.map +0 -1
|
@@ -6,9 +6,9 @@ import { s as RunTotals } from "./Usage-Dx0aknfk.mjs";
|
|
|
6
6
|
import { t as ThreadHistory } from "./ThreadHistory-tS1KwxHR.mjs";
|
|
7
7
|
import { T as RunDispositionDeclaration, _ as InstructionSource, c as Definition, m as InputPromptSource, r as AnyDefinition } from "./Agent-CM6JubNX.mjs";
|
|
8
8
|
import { a as WorkerError, c as WorkerRef, l as WorkerReport, n as WorkerBudgetScope, r as WorkerCompletion } from "./Worker--j87JI__.mjs";
|
|
9
|
-
import { V as RunSubagentDigests, x as RunContextPreparation } from "./RunOptions-
|
|
9
|
+
import { V as RunSubagentDigests, x as RunContextPreparation } from "./RunOptions-Bruk54SE.mjs";
|
|
10
10
|
import { i as SubagentHost, l as WorkerReporting } from "./SubagentHost-DaFMZnVR.mjs";
|
|
11
|
-
import { S as ToolCallWaiting, _ as SubagentDurability, b as SubagentDurabilityError, c as AgentSpawner, h as SpawnRunOptions, l as AgentSpawnerParent, o as AgentRuntimeFailure, p as RuntimeBinding, s as AgentRuntimeRequirements } from "./AgentRuntime-
|
|
11
|
+
import { S as ToolCallWaiting, _ as SubagentDurability, b as SubagentDurabilityError, c as AgentSpawner, h as SpawnRunOptions, l as AgentSpawnerParent, o as AgentRuntimeFailure, p as RuntimeBinding, s as AgentRuntimeRequirements } from "./AgentRuntime-BMzrJos6.mjs";
|
|
12
12
|
import { t as RunEventSink } from "./RunEventSink-D5aVhISG.mjs";
|
|
13
13
|
import { Tool, Toolkit } from "effect/unstable/ai";
|
|
14
14
|
import { Crypto, Duration, Effect, Layer, Schema, Scope, Stream } from "effect";
|
|
@@ -823,4 +823,4 @@ declare function background<const Name extends string, Input extends Schema.Top,
|
|
|
823
823
|
declare function background<const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project, const Selected extends BackgroundOptions>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, selected: Selected): ReturnType<typeof background$1<Name, Input, Output, Parameters, Success, Failure, Prepare, Project, Selected>>;
|
|
824
824
|
//#endregion
|
|
825
825
|
export { cancel as A, delegationAllocationFromPolicy as B, reporting as C, Worker as D, BackgroundTools as E, start as F, SubagentPolicy as I, SubagentPolicyInput as L, inspect as M, list as N, WorkerObservation as O, observe as P, SubagentPrestartDenied as R, make as S, BackgroundOptions as T, delegationCapsFromPolicy as V, SubagentTools as _, SubagentDelegation as a, define as b, SubagentFailureMode as c, SubagentResult as d, SubagentResultContext as f, SubagentToolFailure as g, SubagentTool as h, SubagentDefineOptions as i, followUp as j, awaitWorker as k, SubagentLayerRequirements as l, SubagentRuntimeOptions as m, SubagentContainedFailure as n, SubagentDurableAccounting as o, SubagentReturnModeFailure as p, SubagentDeclarationOptions as r, SubagentDurableOptions as s, SubagentChildRunFailure as t, SubagentPrepareContext as u, Subagent_d_exports as v, reportingToWorker as w, layer as x, background as y, SubagentProjectionFailure as z };
|
|
826
|
-
//# sourceMappingURL=Subagent-
|
|
826
|
+
//# sourceMappingURL=Subagent-m7ywTCe4.d.mts.map
|
|
@@ -2,8 +2,8 @@ import { d as SubagentReservationAmounts, l as SubagentGrant, o as SubagentDeleg
|
|
|
2
2
|
import { a as Receipt, r as Principal } from "./Receipt-BAHyigAF.mjs";
|
|
3
3
|
import { r as Update } from "./AgentUpdates-DMJ-_xow.mjs";
|
|
4
4
|
import { t as AgentPolicy } from "./AgentPolicy-BqDoSXO6.mjs";
|
|
5
|
-
import { _ as Digest, h as DefinitionDigests } from "./Records-
|
|
6
|
-
import { t as ScheduleAuthorizationDecision } from "./Schedule-
|
|
5
|
+
import { _ as Digest, h as DefinitionDigests } from "./Records-BIiRLqlz.mjs";
|
|
6
|
+
import { t as ScheduleAuthorizationDecision } from "./Schedule-BNFlluAl.mjs";
|
|
7
7
|
import { Context, Effect, Schema } from "effect";
|
|
8
8
|
declare namespace Subscription_d_exports {
|
|
9
9
|
export { AcceptedEvent, DeliveryChange, EventAcknowledgement, EventSourceVersion, PreparedInput, SourcePartition, SourceRecovery, SubscriptionAuthorizer, SubscriptionChange, SubscriptionConfiguration, SubscriptionDelivery, SubscriptionDeliveryKey, SubscriptionDeliverySnapshot, SubscriptionError, SubscriptionFailpoint, SubscriptionFailpointError, SubscriptionKey, SubscriptionLimits, SubscriptionName, SubscriptionRecord, SubscriptionRefusal, SubscriptionRetentionPolicy, SubscriptionScanCursors, SubscriptionScope, SubscriptionSnapshot, SubscriptionSourceError, SubscriptionStore, SubscriptionStoreFailure, defaultSubscriptionLimits, subscriptionDeliveryKeyString, subscriptionKeyString };
|
|
@@ -918,4 +918,4 @@ declare const subscriptionKeyString: (key: SubscriptionKey) => string;
|
|
|
918
918
|
declare const subscriptionDeliveryKeyString: (key: SubscriptionDeliveryKey) => string;
|
|
919
919
|
//#endregion
|
|
920
920
|
export { defaultSubscriptionLimits as A, SubscriptionScanCursors as C, SubscriptionStore as D, SubscriptionSourceError as E, subscriptionKeyString as M, SubscriptionStoreFailure as O, SubscriptionRetentionPolicy as S, SubscriptionSnapshot as T, SubscriptionKey as _, PreparedInput as a, SubscriptionRecord as b, SubscriptionAuthorizer as c, SubscriptionDelivery as d, SubscriptionDeliveryKey as f, SubscriptionFailpointError as g, SubscriptionFailpoint as h, EventSourceVersion as i, subscriptionDeliveryKeyString as j, Subscription_d_exports as k, SubscriptionChange as l, SubscriptionError as m, DeliveryChange as n, SourcePartition as o, SubscriptionDeliverySnapshot as p, EventAcknowledgement as r, SourceRecovery as s, AcceptedEvent as t, SubscriptionConfiguration as u, SubscriptionLimits as v, SubscriptionScope as w, SubscriptionRefusal as x, SubscriptionName as y };
|
|
921
|
-
//# sourceMappingURL=Subscription-
|
|
921
|
+
//# sourceMappingURL=Subscription-BCQ3L9Zp.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as AgentId } from "./Identifiers-CN2s30fF.mjs";
|
|
2
|
-
import { O as PersistedJson, h as DefinitionDigests } from "./Records-
|
|
3
|
-
import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, m as SubscriptionError, t as AcceptedEvent, u as SubscriptionConfiguration } from "./Subscription-
|
|
2
|
+
import { O as PersistedJson, h as DefinitionDigests } from "./Records-BIiRLqlz.mjs";
|
|
3
|
+
import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, m as SubscriptionError, t as AcceptedEvent, u as SubscriptionConfiguration } from "./Subscription-BCQ3L9Zp.mjs";
|
|
4
4
|
import { Context, Effect, Schema, Scope } from "effect";
|
|
5
5
|
declare namespace SubscriptionInput_d_exports {
|
|
6
6
|
export { SubscriptionInputBinding, SubscriptionInputBindings, makeSubscriptionInputBinding, resolveSubscriptionInput };
|
|
@@ -38,4 +38,4 @@ declare const makeSubscriptionInputBinding: <Event extends Schema.Top, Parameter
|
|
|
38
38
|
}) => Effect.Effect<SubscriptionInputBinding, never, Exclude<R, Scope.Scope> | Exclude<Continuation["DecodingServices"], Scope.Scope> | Exclude<Continuation["EncodingServices"], Scope.Scope> | Exclude<Event["DecodingServices"], Scope.Scope> | Exclude<Input["EncodingServices"], Scope.Scope> | Exclude<Parameters["DecodingServices"], Scope.Scope>>;
|
|
39
39
|
//#endregion
|
|
40
40
|
export { resolveSubscriptionInput as a, makeSubscriptionInputBinding as i, SubscriptionInputBindings as n, SubscriptionInput_d_exports as r, SubscriptionInputBinding as t };
|
|
41
|
-
//# sourceMappingURL=SubscriptionInput-
|
|
41
|
+
//# sourceMappingURL=SubscriptionInput-Cqu4_RW3.d.mts.map
|
|
@@ -11,6 +11,9 @@ declare const PreparedToolCallEvidence_base: Schema.Class<PreparedToolCallEviden
|
|
|
11
11
|
readonly toolName: Schema.NonEmptyString;
|
|
12
12
|
readonly parameters: Schema.declare<Schema.Json, Schema.Json>;
|
|
13
13
|
readonly parametersDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
|
|
14
|
+
readonly executionKind: Schema.optionalKey<Schema.Literals<readonly ["ordinary", "delegation", "orchestration"]>>;
|
|
15
|
+
readonly executionClass: Schema.optionalKey<Schema.Literals<readonly ["readonly", "idempotent", "uncertain"]>>;
|
|
16
|
+
readonly replay: Schema.optionalKey<Schema.brand<Schema.String, "@effect-agent/thread/Digest">>;
|
|
14
17
|
}>, {}>;
|
|
15
18
|
/**
|
|
16
19
|
* Everything a reconciliation policy can consult about one prepared-but-unsettled ordinary Tool
|
|
@@ -20,7 +23,7 @@ declare const PreparedToolCallEvidence_base: Schema.Class<PreparedToolCallEviden
|
|
|
20
23
|
*/
|
|
21
24
|
declare class PreparedToolCallEvidence extends PreparedToolCallEvidence_base {}
|
|
22
25
|
declare const ReconciliationNeverStarted_base: Schema.Class<ReconciliationNeverStarted, Schema.TaggedStruct<"NeverStarted", {}>, {}>;
|
|
23
|
-
/** Proof
|
|
26
|
+
/** Proof of nonexecution: resume the original operation or report it unavailable. */
|
|
24
27
|
declare class ReconciliationNeverStarted extends ReconciliationNeverStarted_base {}
|
|
25
28
|
declare const ReconciliationCompleted_base: Schema.Class<ReconciliationCompleted, Schema.TaggedStruct<"CompletedWithResult", {
|
|
26
29
|
readonly result: Schema.declare<Schema.Json, Schema.Json>;
|
|
@@ -32,7 +35,7 @@ declare const ReconciliationCompleted_base: Schema.Class<ReconciliationCompleted
|
|
|
32
35
|
*/
|
|
33
36
|
declare class ReconciliationCompleted extends ReconciliationCompleted_base {}
|
|
34
37
|
declare const ReconciliationSafeToRetry_base: Schema.Class<ReconciliationSafeToRetry, Schema.TaggedStruct<"SafeToRetry", {}>, {}>;
|
|
35
|
-
/**
|
|
38
|
+
/** Only the original operation, identity and parameters may repeat under supported semantics. */
|
|
36
39
|
declare class ReconciliationSafeToRetry extends ReconciliationSafeToRetry_base {}
|
|
37
40
|
declare const ReconciliationUncertain_base: Schema.Class<ReconciliationUncertain, Schema.TaggedStruct<"Uncertain", {
|
|
38
41
|
readonly reason: Schema.String;
|
|
@@ -43,7 +46,8 @@ declare class ReconciliationUncertain extends ReconciliationUncertain_base {}
|
|
|
43
46
|
* What a reconciliation policy can prove about one prepared-but-unsettled ordinary Tool Call
|
|
44
47
|
* (durability §10): execution never started, execution completed with a recoverable result,
|
|
45
48
|
* execution is safe to repeat, or nothing — in which case the Run enters Unknown. The engine
|
|
46
|
-
* never
|
|
49
|
+
* never invents an external result. Proven nonexecution can close a retired operation with
|
|
50
|
+
* an explicit not-executed result; uncertainty stays parked.
|
|
47
51
|
*/
|
|
48
52
|
declare const ReconciliationDecision: Schema.Union<readonly [typeof ReconciliationNeverStarted, typeof ReconciliationCompleted, typeof ReconciliationSafeToRetry, typeof ReconciliationUncertain]>;
|
|
49
53
|
type ReconciliationDecision = typeof ReconciliationDecision.Type;
|
|
@@ -73,4 +77,4 @@ declare class ToolReconciler extends ToolReconciler_base {
|
|
|
73
77
|
}
|
|
74
78
|
//#endregion
|
|
75
79
|
export { ReconciliationSafeToRetry as a, ToolReconcilerError as c, ReconciliationNeverStarted as i, ToolReconciler_d_exports as l, ReconciliationCompleted as n, ReconciliationUncertain as o, ReconciliationDecision as r, ToolReconciler as s, PreparedToolCallEvidence as t };
|
|
76
|
-
//# sourceMappingURL=ToolReconciler-
|
|
80
|
+
//# sourceMappingURL=ToolReconciler-BmVRAHKs.d.mts.map
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { AgentId } from "./core/Identifiers.mjs";
|
|
2
|
+
import { getToolExecutionKind } from "./core/SubagentContract.mjs";
|
|
3
|
+
import { a as PinnedTool, l as ToolNamespace, n as DiscoveryTool, r as IncludesCatalogDocumentation, t as AdditionalToolCatalog } from "./ToolExposure-C93U1sPu.mjs";
|
|
4
|
+
import { BackgroundReporting, WorkerReportPreparationFailure } from "./engine/SubagentHost.mjs";
|
|
5
|
+
import { ContextRolloverTool } from "./engine/ContextWindow.mjs";
|
|
6
|
+
import { getToolExecutionClass } from "./engine/DurableStep.mjs";
|
|
7
|
+
import { M as ReplayContract, p as DefinitionDigests } from "./Records-DR1xtbXY.mjs";
|
|
8
|
+
import { DigestError, digestDefinitions, digestJson } from "./durable/Digest.mjs";
|
|
9
|
+
import { Tool } from "effect/unstable/ai";
|
|
10
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
11
|
+
//#region src/durable/internal/agent-registration.ts
|
|
12
|
+
/** No unique current executable is registered for the stable Agent identity. */
|
|
13
|
+
var BindingUnavailable = class extends Schema.TaggedError()("BindingUnavailable", {
|
|
14
|
+
agentId: AgentId,
|
|
15
|
+
message: Schema.String
|
|
16
|
+
}) {};
|
|
17
|
+
/** Exact immutable admission, lineage and delivery evidence; never an executable-code gate. */
|
|
18
|
+
const definitionDigestsEqual = (left, right) => left.agent === right.agent && left.model === right.model && left.tools === right.tools && Schema.toEquivalence(Schema.UndefinedOr(ReplayContract))(left.replay, right.replay);
|
|
19
|
+
/** Hash current operation contracts; no historical definitions or schemas are retained. */
|
|
20
|
+
const toolReplayContracts = Effect.fn("AgentRegistration.toolReplayContracts")(function* (definition, versions, fallbackVersion = null) {
|
|
21
|
+
const declarations = yield* Effect.try({
|
|
22
|
+
try: () => {
|
|
23
|
+
const jsonSchema = (schema) => Schema.decodeUnknownSync(Schema.Json)(Tool.getJsonSchemaFromSchema(schema));
|
|
24
|
+
return Object.values(definition.toolkit.tools).map((tool) => {
|
|
25
|
+
const version = versions === void 0 ? fallbackVersion : versions.tools[tool.name];
|
|
26
|
+
if (version === void 0 || versions !== void 0 && !Object.hasOwn(versions.tools, tool.name)) throw new Error("Every Tool needs an explicit replay semantic version");
|
|
27
|
+
return {
|
|
28
|
+
name: tool.name,
|
|
29
|
+
contract: {
|
|
30
|
+
version,
|
|
31
|
+
parameters: jsonSchema(tool.parametersSchema),
|
|
32
|
+
success: jsonSchema(tool.successSchema),
|
|
33
|
+
failure: jsonSchema(tool.failureSchema),
|
|
34
|
+
failureMode: tool.failureMode,
|
|
35
|
+
needsApproval: typeof tool.needsApproval === "function" ? "dynamic" : tool.needsApproval ?? false,
|
|
36
|
+
executionClass: getToolExecutionClass(tool),
|
|
37
|
+
executionKind: getToolExecutionKind(tool.annotations),
|
|
38
|
+
contextRollover: Context.get(tool.annotations, ContextRolloverTool),
|
|
39
|
+
completion: definition.completion?.tool === tool.name,
|
|
40
|
+
completionFromTool: definition.completionFromTools?.some((declaration) => declaration.tool === tool.name) ?? false
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
catch: () => DigestError.make({ message: "Operation contracts require serializable codecs and a version for every Tool" })
|
|
46
|
+
});
|
|
47
|
+
return Object.fromEntries(yield* Effect.forEach(declarations, ({ name, contract }) => digestJson(contract).pipe(Effect.map((digest) => [name, digest]))));
|
|
48
|
+
});
|
|
49
|
+
/** Compile current metadata without acquiring executable services. */
|
|
50
|
+
const compileBindingContracts = Effect.fn("AgentRegistration.compileBindingContracts")(function* (definition, definitions, versions) {
|
|
51
|
+
const digests = yield* digestDefinitions(definitions);
|
|
52
|
+
const tools = yield* toolReplayContracts(definition, versions, definitions.tools);
|
|
53
|
+
return { digests: DefinitionDigests.make({
|
|
54
|
+
...digests,
|
|
55
|
+
replay: ReplayContract.make({
|
|
56
|
+
agent: digests.agent,
|
|
57
|
+
tools
|
|
58
|
+
})
|
|
59
|
+
}) };
|
|
60
|
+
});
|
|
61
|
+
const captureReporting = (reports) => Effect.map(Effect.context(), (context) => reports.map((report) => ({
|
|
62
|
+
...report,
|
|
63
|
+
prepare: (value) => Effect.scoped(Effect.suspend(() => report.prepare(value))).pipe(Effect.provide(context), Effect.mapError((error) => Schema.is(WorkerReportPreparationFailure)(error) ? error : WorkerReportPreparationFailure.make({ stage: "preparation" })))
|
|
64
|
+
})));
|
|
65
|
+
const backgroundReports = (definition) => [...new Set(Object.values(definition.toolkit.tools).flatMap((tool) => {
|
|
66
|
+
const report = Context.get(tool.annotations, BackgroundReporting);
|
|
67
|
+
return report === void 0 ? [] : [report];
|
|
68
|
+
}))];
|
|
69
|
+
const capture = (agent, attemptLayer) => Effect.map(Effect.context(), (context) => ({
|
|
70
|
+
agentId: agent.definition.id,
|
|
71
|
+
definition: agent.definition,
|
|
72
|
+
attempt: (driver, threadId, claim) => {
|
|
73
|
+
const execute = driver(agent, threadId, claim);
|
|
74
|
+
return (attemptLayer === void 0 ? execute : execute.pipe(Effect.provide(Layer.fresh(attemptLayer({
|
|
75
|
+
threadId,
|
|
76
|
+
submissionId: claim.submissionId,
|
|
77
|
+
attemptId: claim.attemptId
|
|
78
|
+
}))))).pipe(Effect.provide(context));
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
/**
|
|
82
|
+
* Build one exact worker registration from an executable Agent Binding and
|
|
83
|
+
* its already-computed definition digests.
|
|
84
|
+
*
|
|
85
|
+
* `make(agent, digests)` captures the binding plus its worker-requirement
|
|
86
|
+
* Context at Layer/effect construction time. Hosts that start from application
|
|
87
|
+
* version declarations should use `compileRegistrations`; low-level fixtures
|
|
88
|
+
* may supply a previously computed digest triple directly.
|
|
89
|
+
*/
|
|
90
|
+
const DurableWorkerBinding = { make: (agent, digests, reporting) => Effect.gen(function* () {
|
|
91
|
+
const binding = yield* capture(agent);
|
|
92
|
+
const reports = yield* captureReporting([...reporting ?? [], ...backgroundReports(agent.definition)]);
|
|
93
|
+
return {
|
|
94
|
+
...binding,
|
|
95
|
+
digests,
|
|
96
|
+
reporting: reports
|
|
97
|
+
};
|
|
98
|
+
}) };
|
|
99
|
+
/** INTERNAL identity-only capture retained for the legacy direct worker path. */
|
|
100
|
+
const makeLegacyWorkerBinding = capture;
|
|
101
|
+
const resolveWorkerBinding = (bindings, agentId) => {
|
|
102
|
+
const registered = bindings.filter((binding) => binding.agentId === agentId);
|
|
103
|
+
const binding = registered[0];
|
|
104
|
+
return registered.length === 1 && binding !== void 0 ? Effect.succeed(binding) : Effect.fail(BindingUnavailable.make({
|
|
105
|
+
agentId,
|
|
106
|
+
message: `Exactly one current Agent Binding must be registered for ${agentId}`
|
|
107
|
+
}));
|
|
108
|
+
};
|
|
109
|
+
/** Resolve authoring-time admission through the one exact host registration, never by identity alone. */
|
|
110
|
+
const resolveDefinitionBinding = (bindings, definition) => {
|
|
111
|
+
const candidates = bindings.filter((binding) => binding.agentId === definition.id);
|
|
112
|
+
const binding = candidates[0];
|
|
113
|
+
if (candidates.length !== 1 || binding === void 0) return Effect.fail(BindingUnavailable.make({
|
|
114
|
+
agentId: definition.id,
|
|
115
|
+
message: "Registered admission requires exactly one binding for the Agent identity"
|
|
116
|
+
}));
|
|
117
|
+
if (!Object.is(binding.definition, definition)) return Effect.fail(BindingUnavailable.make({
|
|
118
|
+
agentId: definition.id,
|
|
119
|
+
message: "Registered admission requires the exact Agent Definition used in registration"
|
|
120
|
+
}));
|
|
121
|
+
return Effect.succeed(binding);
|
|
122
|
+
};
|
|
123
|
+
const registrationDefinitions = (entry) => {
|
|
124
|
+
const definition = entry.model === void 0 ? entry.agent.definition : entry.agent;
|
|
125
|
+
const automatic = backgroundReports(definition);
|
|
126
|
+
const declaredDefinitions = definition.updates === void 0 ? entry.definitions : {
|
|
127
|
+
...entry.definitions,
|
|
128
|
+
agent: {
|
|
129
|
+
declaration: entry.definitions.agent,
|
|
130
|
+
updates: Schema.decodeUnknownSync(Schema.Json)(Tool.getJsonSchemaFromSchema(definition.updates)),
|
|
131
|
+
updateProtocol: {
|
|
132
|
+
schemaVersion: 1,
|
|
133
|
+
tool: "emit_update"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const definitions = automatic.length === 0 ? declaredDefinitions : {
|
|
138
|
+
...declaredDefinitions,
|
|
139
|
+
agent: {
|
|
140
|
+
declaration: declaredDefinitions.agent,
|
|
141
|
+
backgroundReporting: automatic.map((report) => ({
|
|
142
|
+
delegationId: report.delegationId,
|
|
143
|
+
targetAgentId: report.target.id,
|
|
144
|
+
mode: report.mode ?? "custom",
|
|
145
|
+
destinationDelegationId: report.destination?.delegationId ?? null
|
|
146
|
+
}))
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const exposure = definition.toolExposure;
|
|
150
|
+
if (exposure === void 0 && !Object.values(definition.toolkit.tools).some((tool) => Context.get(tool.annotations, DiscoveryTool) || Context.get(tool.annotations, PinnedTool))) return definitions;
|
|
151
|
+
return {
|
|
152
|
+
...definitions,
|
|
153
|
+
agent: {
|
|
154
|
+
declaration: definitions.agent,
|
|
155
|
+
toolExposure: {
|
|
156
|
+
initialToolNames: exposure === void 0 ? null : [...exposure.initialToolNames ?? []],
|
|
157
|
+
maxTools: exposure?.maxTools ?? 64,
|
|
158
|
+
maxSchemaBytes: exposure?.maxSchemaBytes ?? 262144,
|
|
159
|
+
requiredCompletion: definition.completion?.required === true ? definition.completion.tool : null,
|
|
160
|
+
tools: Object.values(definition.toolkit.tools).map((tool) => ({
|
|
161
|
+
name: tool.name,
|
|
162
|
+
pinned: Context.get(tool.annotations, PinnedTool),
|
|
163
|
+
discovery: Context.get(tool.annotations, DiscoveryTool),
|
|
164
|
+
namespace: Context.get(tool.annotations, ToolNamespace) ?? null,
|
|
165
|
+
includesCatalogDocumentation: Context.get(tool.annotations, IncludesCatalogDocumentation),
|
|
166
|
+
additional: Context.get(tool.annotations, AdditionalToolCatalog).map((entry) => ({
|
|
167
|
+
name: entry.tool.name,
|
|
168
|
+
namespace: entry.namespace,
|
|
169
|
+
method: entry.method
|
|
170
|
+
}))
|
|
171
|
+
}))
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
const compileRegistration = (entry) => Effect.flatMap(Effect.try({
|
|
177
|
+
try: () => registrationDefinitions(entry),
|
|
178
|
+
catch: () => DigestError.make({ message: "Agent update schema has no serializable wire contract" })
|
|
179
|
+
}), (definitions) => Effect.gen(function* () {
|
|
180
|
+
const binding = yield* capture(entry.model === void 0 ? entry.agent : {
|
|
181
|
+
definition: entry.agent,
|
|
182
|
+
model: entry.model
|
|
183
|
+
}, entry.attemptLayer);
|
|
184
|
+
const reporting = yield* captureReporting([...entry.reporting ?? [], ...backgroundReports(binding.definition)]);
|
|
185
|
+
return {
|
|
186
|
+
...binding,
|
|
187
|
+
...yield* compileBindingContracts(binding.definition, definitions, entry.continuity?.versions),
|
|
188
|
+
reporting
|
|
189
|
+
};
|
|
190
|
+
}));
|
|
191
|
+
/** Compile heterogeneous Agent descriptors into exact, dependency-closed worker registrations. */
|
|
192
|
+
const compileRegistrations = (entries) => {
|
|
193
|
+
const compileEntry = compileRegistration;
|
|
194
|
+
return Effect.forEach(entries, compileEntry);
|
|
195
|
+
};
|
|
196
|
+
//#endregion
|
|
197
|
+
export { definitionDigestsEqual as a, resolveWorkerBinding as c, compileRegistrations as i, toolReplayContracts as l, DurableWorkerBinding as n, makeLegacyWorkerBinding as o, compileBindingContracts as r, resolveDefinitionBinding as s, BindingUnavailable as t };
|
|
198
|
+
|
|
199
|
+
//# sourceMappingURL=agent-registration-cXpB8cBU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-registration-cXpB8cBU.mjs","names":["run"],"sources":["../src/durable/internal/agent-registration.ts"],"sourcesContent":["import { type Crypto, type Option, type Scope, Context, Effect, Layer, Schema } from \"effect\";\nimport { Tool } from \"effect/unstable/ai\";\n\nimport type * as Agent from \"../../core/Agent.ts\";\nimport {\n type InputPromptSource,\n type InstructionSource,\n type ModelServices,\n type RunDispositionDeclaration,\n} from \"../../core/Agent.ts\";\nimport { type ThreadId, AgentId } from \"../../core/Identifiers.ts\";\nimport { getToolExecutionKind } from \"../../core/SubagentContract.ts\";\nimport {\n AdditionalToolCatalog,\n DiscoveryTool,\n IncludesCatalogDocumentation,\n PinnedTool,\n ToolNamespace,\n} from \"../../core/ToolExposure.ts\";\nimport { type RuntimeBinding } from \"../../engine/AgentRuntime.ts\";\nimport { ContextRolloverTool } from \"../../engine/ContextWindow.ts\";\nimport { getToolExecutionClass } from \"../../engine/DurableStep.ts\";\nimport {\n BackgroundReporting,\n WorkerReportPreparationFailure,\n type WorkerReporting,\n} from \"../../engine/SubagentHost.ts\";\nimport { digestDefinitions, digestJson, DigestError } from \"../Digest.ts\";\nimport type { DurableWorkerFailure, DurableWorkerRequirements } from \"../DurableAgentRuntime.ts\";\nimport type { DefinitionDigestInput, PersistedJson } from \"../Records.ts\";\nimport { DefinitionDigests, ReplayContract } from \"../Records.ts\";\nimport type { Claim, Settlement } from \"../SubmissionLedger.ts\";\n\n/** No unique current executable is registered for the stable Agent identity. */\nexport class BindingUnavailable extends Schema.TaggedError<BindingUnavailable>()(\n \"BindingUnavailable\",\n { agentId: AgentId, message: Schema.String },\n) {}\n\nexport type DurableBindingFailure = BindingUnavailable;\n\n/** Exact immutable admission, lineage and delivery evidence; never an executable-code gate. */\nexport const definitionDigestsEqual = (\n left: DefinitionDigests,\n right: DefinitionDigests,\n): boolean =>\n left.agent === right.agent &&\n left.model === right.model &&\n left.tools === right.tools &&\n Schema.toEquivalence(Schema.UndefinedOr(ReplayContract))(left.replay, right.replay);\n\n/** Change an operation version when its meaning, durable Steps or idempotency keys change. */\nexport interface ReplayVersions {\n readonly tools: Readonly<Record<string, PersistedJson>>;\n}\n\n/** Hash current operation contracts; no historical definitions or schemas are retained. */\nexport const toolReplayContracts = Effect.fn(\"AgentRegistration.toolReplayContracts\")(function* (\n definition: Agent.AnyDefinition,\n versions?: ReplayVersions,\n fallbackVersion: PersistedJson = null,\n) {\n const declarations = yield* Effect.try({\n try: () => {\n const jsonSchema = (schema: Schema.Top) =>\n Schema.decodeUnknownSync(Schema.Json)(Tool.getJsonSchemaFromSchema(schema));\n\n return Object.values(definition.toolkit.tools).map((tool) => {\n const version = versions === undefined ? fallbackVersion : versions.tools[tool.name];\n\n if (\n version === undefined ||\n (versions !== undefined && !Object.hasOwn(versions.tools, tool.name))\n )\n throw new Error(\"Every Tool needs an explicit replay semantic version\");\n\n return {\n name: tool.name,\n contract: {\n version,\n parameters: jsonSchema(tool.parametersSchema),\n success: jsonSchema(tool.successSchema),\n failure: jsonSchema(tool.failureSchema),\n failureMode: tool.failureMode,\n needsApproval:\n typeof tool.needsApproval === \"function\" ? \"dynamic\" : (tool.needsApproval ?? false),\n executionClass: getToolExecutionClass(tool),\n executionKind: getToolExecutionKind(tool.annotations),\n contextRollover: Context.get(tool.annotations, ContextRolloverTool),\n completion: definition.completion?.tool === tool.name,\n completionFromTool:\n definition.completionFromTools?.some(\n (declaration) => declaration.tool === tool.name,\n ) ?? false,\n },\n };\n });\n },\n catch: () =>\n DigestError.make({\n message: \"Operation contracts require serializable codecs and a version for every Tool\",\n }),\n });\n\n return Object.fromEntries(\n yield* Effect.forEach(declarations, ({ name, contract }) =>\n digestJson(contract).pipe(Effect.map((digest) => [name, digest] as const)),\n ),\n );\n});\n\n/** Compile current metadata without acquiring executable services. */\nexport const compileBindingContracts = Effect.fn(\"AgentRegistration.compileBindingContracts\")(\n function* (\n definition: Agent.AnyDefinition,\n definitions: DefinitionDigestInput,\n versions?: ReplayVersions,\n ): Effect.fn.Return<Pick<ResolvedBinding, \"digests\">, DigestError, Crypto.Crypto> {\n const digests = yield* digestDefinitions(definitions);\n const tools = yield* toolReplayContracts(definition, versions, definitions.tools);\n\n return {\n digests: DefinitionDigests.make({\n ...digests,\n replay: ReplayContract.make({ agent: digests.agent, tools }),\n }),\n };\n },\n);\n\ntype ExecutableDefinition = Agent.AnyDefinition & {\n readonly instructions: InstructionSource<never, unknown, unknown>;\n readonly inputPrompt?: InputPromptSource<never, unknown, unknown> | undefined;\n};\n\n/** Executable model Binding accepted by durable registration descriptors. */\nexport type ExecutableAgentBinding = {\n readonly definition: ExecutableDefinition;\n readonly model: Layer.Layer<ModelServices, never, unknown>;\n};\n\n/**\n * Internal coordinator entry point for one fenced Attempt over an already-granted claim.\n * The generic signature matches `runAttempt` and is specialized for each captured Agent.\n */\ntype ResolvedAttemptDriver = <\n InputSchema extends Schema.Top,\n OutputSchema extends Schema.Top,\n Instructions,\n Tools extends Record<string, Tool.Any>,\n Provider,\n ModelProvides,\n ModelRequires,\n InstructionError,\n InstructionRequirements,\n RunDispositionValue extends\n | RunDispositionDeclaration<OutputSchema[\"Type\"], Schema.Top>\n | undefined,\n InputPromptValue extends InputPromptSource<InputSchema[\"Type\"], unknown, unknown> | undefined,\n UpdatesSchema extends Schema.Top | undefined,\n>(\n agent: RuntimeBinding<\n InputSchema,\n OutputSchema,\n Instructions,\n Tools,\n Provider,\n ModelProvides,\n ModelRequires,\n InstructionError,\n InstructionRequirements,\n RunDispositionValue,\n InputPromptValue,\n UpdatesSchema\n >,\n threadId: ThreadId,\n claim: Claim,\n) => Effect.Effect<\n Option.Option<Settlement>,\n DurableWorkerFailure,\n DurableWorkerRequirements<\n RuntimeBinding<\n InputSchema,\n OutputSchema,\n Instructions,\n Tools,\n Provider,\n ModelProvides,\n ModelRequires,\n InstructionError,\n InstructionRequirements,\n RunDispositionValue,\n InputPromptValue,\n UpdatesSchema\n >,\n InstructionRequirements\n >\n>;\n\ntype CapturedAttempt<A extends ExecutableAgentBinding> = (\n agent: A,\n threadId: ThreadId,\n claim: Claim,\n) => Effect.Effect<Option.Option<Settlement>, DurableWorkerFailure, DurableWorkerRequirements<A>>;\n\n/**\n * An Agent with its worker services captured, ready to drive a fenced Attempt.\n * Concrete Schema and model types stay inside this closure when registrations are collected.\n */\ninterface CapturedBinding {\n readonly agentId: AgentId;\n /** Exact immutable definition whose codecs and behavior the worker captured. */\n readonly definition: Agent.AnyDefinition;\n /** Captured independently from per-Attempt services: report preparation has no fenced Claim. */\n readonly reporting?: ReadonlyArray<WorkerReporting<WorkerReportPreparationFailure>>;\n readonly attempt: (\n driver: ResolvedAttemptDriver,\n threadId: ThreadId,\n claim: Claim,\n ) => Effect.Effect<Option.Option<Settlement>, DurableWorkerFailure>;\n}\n\ntype ReportRequirements<Reports> =\n Reports extends ReadonlyArray<WorkerReporting<unknown, unknown>>\n ? [Reports[number]] extends [never]\n ? never\n : Reports[number] extends WorkerReporting<unknown, infer R>\n ? Exclude<R, Scope.Scope>\n : never\n : never;\n\nconst captureReporting = <R>(reports: ReadonlyArray<WorkerReporting<unknown, R>>) =>\n Effect.map(Effect.context<Exclude<R, Scope.Scope>>(), (context) =>\n reports.map((report): WorkerReporting<WorkerReportPreparationFailure> => ({\n ...report,\n prepare: (value) =>\n Effect.scoped(Effect.suspend(() => report.prepare(value))).pipe(\n Effect.provide(context),\n Effect.mapError((error) =>\n Schema.is(WorkerReportPreparationFailure)(error)\n ? error\n : WorkerReportPreparationFailure.make({ stage: \"preparation\" }),\n ),\n ),\n })),\n );\n\nconst backgroundReports = (definition: Agent.AnyDefinition) => [\n ...new Set(\n Object.values(definition.toolkit.tools).flatMap((tool) => {\n const report = Context.get(tool.annotations, BackgroundReporting);\n\n return report === undefined ? [] : [report];\n }),\n ),\n];\n\n/** One exact executable registration used by durable claim-time resolution. */\nexport interface ResolvedBinding extends CapturedBinding {\n readonly digests: DefinitionDigests;\n}\n\n/** Trusted claim identity for resolving per-Attempt application services. Not model input. */\nexport interface AgentAttemptContext {\n readonly threadId: ThreadId;\n readonly submissionId: Claim[\"submissionId\"];\n readonly attemptId: Claim[\"attemptId\"];\n}\n\nconst capture = <A extends ExecutableAgentBinding, Provides = never, Requires = never>(\n agent: A,\n attemptLayer?: (context: AgentAttemptContext) => Layer.Layer<Provides, never, Requires>,\n): Effect.Effect<\n CapturedBinding,\n never,\n Exclude<DurableWorkerRequirements<A>, Provides> | Requires\n> =>\n Effect.map(\n Effect.context<Exclude<DurableWorkerRequirements<A>, Provides> | Requires>(),\n (context): CapturedBinding => ({\n agentId: agent.definition.id,\n definition: agent.definition,\n attempt: (driver, threadId, claim) => {\n // Registration closes one concrete Binding before heterogeneous registrations are\n // collected. TypeScript cannot instantiate the higher-rank RuntimeBinding parameters\n // from the intentionally erased public shape, so specialize the driver back to A here.\n const run = driver as unknown as CapturedAttempt<A>;\n const execute = run(agent, threadId, claim);\n\n const scoped =\n attemptLayer === undefined\n ? execute\n : execute.pipe(\n Effect.provide(\n Layer.fresh(\n attemptLayer({\n threadId,\n submissionId: claim.submissionId,\n attemptId: claim.attemptId,\n }),\n ),\n ),\n );\n\n return scoped.pipe(Effect.provide(context)) as Effect.Effect<\n Option.Option<Settlement>,\n DurableWorkerFailure\n >;\n },\n }),\n );\n\n/**\n * Build one exact worker registration from an executable Agent Binding and\n * its already-computed definition digests.\n *\n * `make(agent, digests)` captures the binding plus its worker-requirement\n * Context at Layer/effect construction time. Hosts that start from application\n * version declarations should use `compileRegistrations`; low-level fixtures\n * may supply a previously computed digest triple directly.\n */\nexport const DurableWorkerBinding = {\n make: <\n A extends ExecutableAgentBinding,\n const Reports extends ReadonlyArray<WorkerReporting<unknown, unknown>> = readonly [],\n >(\n agent: A,\n digests: DefinitionDigests,\n reporting?: Reports,\n ): Effect.Effect<\n ResolvedBinding,\n never,\n DurableWorkerRequirements<A> | ReportRequirements<Reports>\n > =>\n Effect.gen(function* () {\n const binding = yield* capture(agent);\n\n const reports = yield* captureReporting([\n ...(reporting ?? []),\n ...backgroundReports(agent.definition),\n ]);\n\n return { ...binding, digests, reporting: reports };\n }) as Effect.Effect<\n ResolvedBinding,\n never,\n DurableWorkerRequirements<A> | ReportRequirements<Reports>\n >,\n} as const;\n\n/** INTERNAL identity-only capture retained for the legacy direct worker path. */\nexport const makeLegacyWorkerBinding = capture;\n\nexport const resolveWorkerBinding = (\n bindings: ReadonlyArray<ResolvedBinding>,\n agentId: AgentId,\n): Effect.Effect<ResolvedBinding, BindingUnavailable> => {\n const registered = bindings.filter((binding) => binding.agentId === agentId);\n const binding = registered[0];\n\n return registered.length === 1 && binding !== undefined\n ? Effect.succeed(binding)\n : Effect.fail(\n BindingUnavailable.make({\n agentId,\n message: `Exactly one current Agent Binding must be registered for ${agentId}`,\n }),\n );\n};\n\n/** Resolve authoring-time admission through the one exact host registration, never by identity alone. */\nexport const resolveDefinitionBinding = (\n bindings: ReadonlyArray<ResolvedBinding>,\n definition: Pick<Agent.AnyDefinition, \"id\">,\n): Effect.Effect<ResolvedBinding, BindingUnavailable> => {\n const candidates = bindings.filter((binding) => binding.agentId === definition.id);\n const binding = candidates[0];\n\n if (candidates.length !== 1 || binding === undefined) {\n return Effect.fail(\n BindingUnavailable.make({\n agentId: definition.id,\n message: \"Registered admission requires exactly one binding for the Agent identity\",\n }),\n );\n }\n\n if (!Object.is(binding.definition, definition)) {\n return Effect.fail(\n BindingUnavailable.make({\n agentId: definition.id,\n message: \"Registered admission requires the exact Agent Definition used in registration\",\n }),\n );\n }\n\n return Effect.succeed(binding);\n};\n\n/** Application versions and a model Layer, supplied directly or through an existing Binding. */\nexport type AgentRegistration<A extends ExecutableAgentBinding = ExecutableAgentBinding> = (\n | { readonly agent: A; readonly model?: never; readonly definitions: DefinitionDigestInput }\n | {\n readonly agent: A[\"definition\"];\n readonly model: A[\"model\"];\n readonly definitions: DefinitionDigestInput;\n }\n) & {\n /** Explicit operation versions let unchanged unfinished handlers survive toolbox changes. */\n readonly continuity?: {\n readonly versions: ReplayVersions;\n };\n /**\n * Source-owned reports capture services outside attemptLayer and open a fresh Scope per\n * preparation. Version changes with this registration. Missing exact code and preparation\n * failures become retained report refusals; durable delivery retries reuse the frozen input.\n */\n readonly reporting?: ReadonlyArray<WorkerReporting<unknown, unknown>>;\n /**\n * Build fresh services for exactly one fenced Attempt, across all its Tool/model turns.\n * Finalizes on completion, suspension, failure and interruption. Never reused after eviction.\n * Resolve invocation authority from the trusted claim identity, not captured caller state.\n * Keep fallible resource acquisition lazy in typed Tool operations; this Layer cannot fail.\n */\n readonly attemptLayer?: (context: AgentAttemptContext) => Layer.Layer<never, never, unknown>;\n};\n\ntype EntryWorkerRequirements<Entry> = Entry extends {\n readonly agent: infer A extends ExecutableAgentBinding;\n}\n ? DurableWorkerRequirements<A>\n : Entry extends {\n readonly agent: infer D extends ExecutableDefinition;\n readonly model: infer M extends ExecutableAgentBinding[\"model\"];\n }\n ? DurableWorkerRequirements<{ readonly definition: D; readonly model: M }>\n : never;\n\ntype AttemptLayerRequirements<Requirements, AttemptLayer> = AttemptLayer extends (\n context: AgentAttemptContext,\n) => Layer.Layer<infer Provides, never, infer Requires>\n ? Exclude<Requirements, Provides> | Requires\n : Requirements;\n\n// Conditional options retain every service they may consume. An absent attempt Layer\n// still needs the original worker services; only a definite Layer can remove them.\ntype EntryRequirements<Entry> = Entry extends unknown\n ?\n | AttemptLayerRequirements<\n EntryWorkerRequirements<Entry>,\n \"attemptLayer\" extends keyof Entry ? Entry[\"attemptLayer\"] : undefined\n >\n | (\"reporting\" extends keyof Entry ? ReportRequirements<Entry[\"reporting\"]> : never)\n : never;\n\ntype RegistrationRequirements<Entries extends ReadonlyArray<AgentRegistration>> = [\n Entries[number],\n] extends [never]\n ? never\n : EntryRequirements<Entries[number]>;\n\nconst registrationDefinitions = (entry: AgentRegistration): DefinitionDigestInput => {\n const definition = entry.model === undefined ? entry.agent.definition : entry.agent;\n const automatic = backgroundReports(definition);\n\n const declaredDefinitions =\n definition.updates === undefined\n ? entry.definitions\n : {\n ...entry.definitions,\n agent: {\n declaration: entry.definitions.agent,\n updates: Schema.decodeUnknownSync(Schema.Json)(\n Tool.getJsonSchemaFromSchema(definition.updates),\n ),\n updateProtocol: { schemaVersion: 1, tool: \"emit_update\" },\n },\n };\n\n const definitions =\n automatic.length === 0\n ? declaredDefinitions\n : {\n ...declaredDefinitions,\n agent: {\n declaration: declaredDefinitions.agent,\n backgroundReporting: automatic.map((report) => ({\n delegationId: report.delegationId,\n targetAgentId: report.target.id,\n mode: report.mode ?? \"custom\",\n destinationDelegationId: report.destination?.delegationId ?? null,\n })),\n },\n };\n\n const exposure = definition.toolExposure;\n\n if (\n exposure === undefined &&\n !Object.values(definition.toolkit.tools).some(\n (tool) =>\n Context.get(tool.annotations, DiscoveryTool) || Context.get(tool.annotations, PinnedTool),\n )\n )\n return definitions;\n\n return {\n ...definitions,\n agent: {\n declaration: definitions.agent,\n toolExposure: {\n initialToolNames: exposure === undefined ? null : [...(exposure.initialToolNames ?? [])],\n maxTools: exposure?.maxTools ?? 64,\n maxSchemaBytes: exposure?.maxSchemaBytes ?? 262_144,\n requiredCompletion:\n definition.completion?.required === true ? definition.completion.tool : null,\n tools: Object.values(definition.toolkit.tools).map((tool) => ({\n name: tool.name,\n pinned: Context.get(tool.annotations, PinnedTool),\n discovery: Context.get(tool.annotations, DiscoveryTool),\n namespace: Context.get(tool.annotations, ToolNamespace) ?? null,\n includesCatalogDocumentation: Context.get(tool.annotations, IncludesCatalogDocumentation),\n additional: Context.get(tool.annotations, AdditionalToolCatalog).map((entry) => ({\n name: entry.tool.name,\n namespace: entry.namespace,\n method: entry.method,\n })),\n })),\n },\n },\n };\n};\n\nconst compileRegistration = <Entry extends AgentRegistration>(\n entry: Entry,\n): Effect.Effect<ResolvedBinding, DigestError, Crypto.Crypto | EntryRequirements<Entry>> =>\n Effect.flatMap(\n Effect.try({\n try: () => registrationDefinitions(entry),\n catch: () =>\n DigestError.make({ message: \"Agent update schema has no serializable wire contract\" }),\n }),\n (definitions) =>\n Effect.gen(function* () {\n const binding = yield* capture(\n entry.model === undefined ? entry.agent : { definition: entry.agent, model: entry.model },\n entry.attemptLayer,\n );\n\n const reporting = yield* captureReporting([\n ...(entry.reporting ?? []),\n ...backgroundReports(binding.definition),\n ]);\n\n return {\n ...binding,\n ...(yield* compileBindingContracts(\n binding.definition,\n definitions,\n entry.continuity?.versions,\n )),\n reporting,\n };\n }),\n // The erased descriptor accepts arbitrary provided services. Restore the concrete entry's\n // Exclude<worker requirements, provided services> | layer requirements at this collection seam.\n ) as Effect.Effect<ResolvedBinding, DigestError, Crypto.Crypto | EntryRequirements<Entry>>;\n\n/** Compile heterogeneous Agent descriptors into exact, dependency-closed worker registrations. */\nexport const compileRegistrations = <const Entries extends ReadonlyArray<AgentRegistration>>(\n entries: Entries,\n): Effect.Effect<\n ReadonlyArray<ResolvedBinding>,\n DigestError,\n Crypto.Crypto | RegistrationRequirements<Entries>\n> => {\n // `Effect.forEach` instantiates a generic callback at its constraint. Specialize the callback to\n // this tuple's distributed requirement union before collection so empty and heterogeneous tuples\n // retain their exact service requirements.\n const compileEntry = compileRegistration as unknown as (\n entry: Entries[number],\n ) => Effect.Effect<\n ResolvedBinding,\n DigestError,\n Crypto.Crypto | RegistrationRequirements<Entries>\n >;\n\n return Effect.forEach(entries, compileEntry);\n};\n"],"mappings":";;;;;;;;;;;;AAkCA,IAAa,qBAAb,cAAwC,OAAO,YAAgC,CAAC,CAC9E,sBACA;CAAE,SAAS;CAAS,SAAS,OAAO;AAAO,CAC7C,CAAC,CAAC,CAAC;;AAKH,MAAa,0BACX,MACA,UAEA,KAAK,UAAU,MAAM,SACrB,KAAK,UAAU,MAAM,SACrB,KAAK,UAAU,MAAM,SACrB,OAAO,cAAc,OAAO,YAAY,cAAc,CAAC,CAAC,CAAC,KAAK,QAAQ,MAAM,MAAM;;AAQpF,MAAa,sBAAsB,OAAO,GAAG,uCAAuC,CAAC,CAAC,WACpF,YACA,UACA,kBAAiC,MACjC;CACA,MAAM,eAAe,OAAO,OAAO,IAAI;EACrC,WAAW;GACT,MAAM,cAAc,WAClB,OAAO,kBAAkB,OAAO,IAAI,CAAC,CAAC,KAAK,wBAAwB,MAAM,CAAC;GAE5E,OAAO,OAAO,OAAO,WAAW,QAAQ,KAAK,CAAC,CAAC,KAAK,SAAS;IAC3D,MAAM,UAAU,aAAa,KAAA,IAAY,kBAAkB,SAAS,MA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B,CACxC,GAAI,MAAM,aAAa,CAAC,GACxB,GAAG,kBAAkB,QAAQ,UAAU,CACzC,CAAC;CAED,OAAO;EACL,GAAG;EACH,GAAI,OAAO,wBACT,QAAQ,YACR,aACA,MAAM,YAAY,QACpB;EACA;CACF;AACF,CAAC,CAGL;;AAGF,MAAa,wBACX,YAKG;CAIH,MAAM,eAAe;CAQrB,OAAO,OAAO,QAAQ,SAAS,YAAY;AAC7C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as CommandDrainPolicy } from "../RunOptions-
|
|
1
|
+
import { o as CommandDrainPolicy } from "../RunOptions-Bruk54SE.mjs";
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
3
|
declare namespace Commands_d_exports {
|
|
4
4
|
export { FollowUpCommand, RunCommand, RunCommandQueue, RunCommandQueueClosed, RunCommandQueueConfig, SteeringCommand, makeRunCommandQueue };
|
|
@@ -2,7 +2,7 @@ import { c as ThreadLimitExceeded, i as ThreadEncodingError, s as ThreadHistoryD
|
|
|
2
2
|
import { RedactionError, Redactor } from "./Redaction.mjs";
|
|
3
3
|
import { ApprovalAudit, ApprovalAuditLimitExceeded, ApprovalDecisionMismatch, ApprovalRequestDraft, ApprovalResolver, ApprovalResolverError } from "./Approval.mjs";
|
|
4
4
|
import { BudgetExceeded, UsageBudgetNode } from "./Budget.mjs";
|
|
5
|
-
import { M as RunOptions, R as RunSchedulingHook, _ as RunBudgetHook, b as RunContextHook, g as RunApprovalRequest, h as RunApprovalHook, j as RunInputHook, w as RunContextRequest } from "../RunOptions-
|
|
5
|
+
import { M as RunOptions, R as RunSchedulingHook, _ as RunBudgetHook, b as RunContextHook, g as RunApprovalRequest, h as RunApprovalHook, j as RunInputHook, w as RunContextRequest } from "../RunOptions-Bruk54SE.mjs";
|
|
6
6
|
import { RunCommandQueue } from "./Commands.mjs";
|
|
7
7
|
import { Prompt } from "effect/unstable/ai";
|
|
8
8
|
import { Effect, Schema } from "effect";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { c as SubagentExecutionFailureClassification, l as SubagentGrant, s as SubagentExecutionFailure } from "../SubagentContract-DdT7Cqe6.mjs";
|
|
2
2
|
import { l as WorkerReport, r as WorkerCompletion } from "../Worker--j87JI__.mjs";
|
|
3
|
-
import { A as cancel, B as delegationAllocationFromPolicy, C as reporting, D as Worker, E as BackgroundTools, F as start, I as SubagentPolicy, L as SubagentPolicyInput, M as inspect, N as list, O as WorkerObservation, P as observe, R as SubagentPrestartDenied, S as make, T as BackgroundOptions, V as delegationCapsFromPolicy, _ as SubagentTools, a as SubagentDelegation, b as define, c as SubagentFailureMode, d as SubagentResult, f as SubagentResultContext, g as SubagentToolFailure, h as SubagentTool, i as SubagentDefineOptions, j as followUp, k as awaitWorker, l as SubagentLayerRequirements, m as SubagentRuntimeOptions, n as SubagentContainedFailure, o as SubagentDurableAccounting, p as SubagentReturnModeFailure, r as SubagentDeclarationOptions, s as SubagentDurableOptions, t as SubagentChildRunFailure, u as SubagentPrepareContext, w as reportingToWorker, x as layer, y as background, z as SubagentProjectionFailure } from "../Subagent-
|
|
3
|
+
import { A as cancel, B as delegationAllocationFromPolicy, C as reporting, D as Worker, E as BackgroundTools, F as start, I as SubagentPolicy, L as SubagentPolicyInput, M as inspect, N as list, O as WorkerObservation, P as observe, R as SubagentPrestartDenied, S as make, T as BackgroundOptions, V as delegationCapsFromPolicy, _ as SubagentTools, a as SubagentDelegation, b as define, c as SubagentFailureMode, d as SubagentResult, f as SubagentResultContext, g as SubagentToolFailure, h as SubagentTool, i as SubagentDefineOptions, j as followUp, k as awaitWorker, l as SubagentLayerRequirements, m as SubagentRuntimeOptions, n as SubagentContainedFailure, o as SubagentDurableAccounting, p as SubagentReturnModeFailure, r as SubagentDeclarationOptions, s as SubagentDurableOptions, t as SubagentChildRunFailure, u as SubagentPrepareContext, w as reportingToWorker, x as layer, y as background, z as SubagentProjectionFailure } from "../Subagent-m7ywTCe4.mjs";
|
|
4
4
|
export { type BackgroundOptions, type BackgroundTools, SubagentChildRunFailure, SubagentContainedFailure, SubagentDeclarationOptions, SubagentDefineOptions, SubagentDelegation, SubagentDurableAccounting, SubagentDurableOptions, SubagentExecutionFailure, SubagentExecutionFailureClassification, SubagentFailureMode, SubagentGrant, SubagentLayerRequirements, SubagentPolicy, type SubagentPolicyInput, SubagentPrepareContext, SubagentPrestartDenied, SubagentProjectionFailure, SubagentResult, SubagentResultContext, SubagentReturnModeFailure, SubagentRuntimeOptions, SubagentTool, SubagentToolFailure, SubagentTools, Worker, WorkerCompletion, WorkerObservation, WorkerReport, awaitWorker as await, background, cancel, define, delegationAllocationFromPolicy, delegationCapsFromPolicy, followUp, inspect, layer, list, make, observe, reporting, reportingToWorker, start };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SubagentExecutionFailure, SubagentExecutionFailureClassification, SubagentGrant } from "../core/SubagentContract.mjs";
|
|
2
2
|
import { WorkerCompletion, WorkerReport } from "../core/Worker.mjs";
|
|
3
3
|
import "./SubagentReservations.mjs";
|
|
4
|
-
import { C as delegationCapsFromPolicy, S as delegationAllocationFromPolicy, _ as reporting, a as define, b as SubagentPrestartDenied, c as Worker, d as cancel, f as followUp, g as start, h as observe, i as background, l as WorkerObservation, m as list, n as SubagentResult, o as layer, p as inspect, s as make, t as SubagentDurableAccounting, u as awaitWorker, v as reportingToWorker, x as SubagentProjectionFailure, y as SubagentPolicy } from "../Subagent-
|
|
4
|
+
import { C as delegationCapsFromPolicy, S as delegationAllocationFromPolicy, _ as reporting, a as define, b as SubagentPrestartDenied, c as Worker, d as cancel, f as followUp, g as start, h as observe, i as background, l as WorkerObservation, m as list, n as SubagentResult, o as layer, p as inspect, s as make, t as SubagentDurableAccounting, u as awaitWorker, v as reportingToWorker, x as SubagentProjectionFailure, y as SubagentPolicy } from "../Subagent-C2s8PFrd.mjs";
|
|
5
5
|
export { SubagentDurableAccounting, SubagentExecutionFailure, SubagentExecutionFailureClassification, SubagentGrant, SubagentPolicy, SubagentPrestartDenied, SubagentProjectionFailure, SubagentResult, Worker, WorkerCompletion, WorkerObservation, WorkerReport, awaitWorker as await, background, cancel, define, delegationAllocationFromPolicy, delegationCapsFromPolicy, followUp, inspect, layer, list, make, observe, reporting, reportingToWorker, start };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as Digest } from "../Records-
|
|
1
|
+
import { _ as Digest } from "../Records-BIiRLqlz.mjs";
|
|
2
2
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
3
|
declare namespace ActivityStore_d_exports {
|
|
4
4
|
export { ActivityBusy, ActivityClaim, ActivityClaimRequest, ActivityMutationFailpoint, ActivityMutationFailure, ActivityMutationPoint, ActivityOwnershipLost, ActivityProcessorKey, ActivityProcessorStore, ActivityProgress, ActivityStoreError, ActivityStoreFailure, ActivityWorkConflict, PreparedActivity };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { ThreadId } from "../core/Identifiers.mjs";
|
|
3
|
-
import { T as PersistedJson, h as Digest, k as RecordId, u as CanonicalSequence } from "../Records-
|
|
3
|
+
import { T as PersistedJson, h as Digest, k as RecordId, u as CanonicalSequence } from "../Records-DR1xtbXY.mjs";
|
|
4
4
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
5
5
|
//#region src/durable/ActivityStore.ts
|
|
6
6
|
var ActivityStore_exports = /* @__PURE__ */ __exportAll({
|
package/dist/durable/Admin.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Ar as
|
|
1
|
+
import { Ar as RetryCommand, Cr as ObligationEntry, Dr as RECOVERY_DECISION_MEANINGS, Er as ObligationThresholds, Fr as recoveryDecisionMeaning, Ir as renderRecoveryExplanation, Mr as RetryRefused, Nr as obligationSeverityOf, Or as RecoveryDisposition, Pr as predictRecoveryDisposition, Sr as ObligationBlockedOn, Tr as ObligationSeverity, _r as ExplainedUnknownCall, br as IntegrityCheckStatus, gr as ExplainedSubmission, hr as ExplainedEvidence, jr as RetryRefusalReason, kr as RecoveryExplanation, vr as IntegrityCheck, wr as ObligationReport, xr as IntegrityReport, yr as IntegrityCheckName } from "../Records-BIiRLqlz.mjs";
|
|
2
2
|
export { ExplainedEvidence, ExplainedSubmission, ExplainedUnknownCall, IntegrityCheck, IntegrityCheckName, IntegrityCheckStatus, IntegrityReport, ObligationBlockedOn, ObligationEntry, ObligationReport, ObligationSeverity, ObligationThresholds, RECOVERY_DECISION_MEANINGS, RecoveryDisposition, RecoveryExplanation, RetryCommand, RetryRefusalReason, RetryRefused, obligationSeverityOf, predictRecoveryDisposition, recoveryDecisionMeaning, renderRecoveryExplanation };
|
package/dist/durable/Admin.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { SubmissionId, ThreadId, ToolCallId } from "../core/Identifiers.mjs";
|
|
3
3
|
import { QueueSequence } from "../core/Receipt.mjs";
|
|
4
|
-
import { et as ToolCallUnknown, u as CanonicalSequence, z as SettlementOutcome } from "../Records-
|
|
4
|
+
import { X as ToolCallPrepared, et as ToolCallUnknown, u as CanonicalSequence, z as SettlementOutcome } from "../Records-DR1xtbXY.mjs";
|
|
5
5
|
import { AbortCommand, AbortIntent, ApprovalDecisionIntent, ChildAttachmentSnapshot, JoinSnapshot, ParentLinkage, SubmissionState, SuspensionSnapshot, UnknownResolutionIntent } from "./SubmissionLedger.mjs";
|
|
6
6
|
import { OpenDelegationCallEvidence, OpenToolCallEvidence, PendingApprovalEvidence, RecoveryDecision } from "./Recovery.mjs";
|
|
7
|
-
import { DateTime, Schema } from "effect";
|
|
7
|
+
import { DateTime, Effect, Schema } from "effect";
|
|
8
8
|
//#region src/durable/Admin.ts
|
|
9
9
|
var Admin_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
ExplainedEvidence: () => ExplainedEvidence,
|
|
@@ -63,13 +63,13 @@ var ExplainedSubmission = class extends Schema.Class("@effect-agent/thread/Expla
|
|
|
63
63
|
readyAgeSeconds: Schema.optionalKey(AgeSeconds),
|
|
64
64
|
parentLinkage: Schema.optionalKey(ParentLinkage)
|
|
65
65
|
}) {};
|
|
66
|
-
/** One durable Unknown Outcome and whether
|
|
66
|
+
/** One durable Unknown Outcome and whether its result is canonical (DUR-017). */
|
|
67
67
|
var ExplainedUnknownCall = class extends Schema.Class("@effect-agent/thread/ExplainedUnknownCall")({
|
|
68
68
|
toolCallId: ToolCallId,
|
|
69
69
|
toolName: ToolCallUnknown.fields.toolName,
|
|
70
70
|
reason: ToolCallUnknown.fields.reason,
|
|
71
71
|
recordedAt: Schema.DateTimeUtcFromString,
|
|
72
|
-
/** A
|
|
72
|
+
/** A real canonical ToolCallSettled closes this call; an intent alone is not an outcome. */
|
|
73
73
|
resolved: Schema.Boolean
|
|
74
74
|
}) {};
|
|
75
75
|
/**
|
|
@@ -84,6 +84,8 @@ var ExplainedEvidence = class extends Schema.Class("@effect-agent/thread/Explain
|
|
|
84
84
|
recordedSettlementOutcome: Schema.optionalKey(SettlementOutcome),
|
|
85
85
|
/** Prepared ordinary Tool Calls without a canonical outcome (DUR-009). */
|
|
86
86
|
openToolCalls: Schema.Array(OpenToolCallEvidence),
|
|
87
|
+
/** Original prepared operation identities, arguments and recovery contracts; settled calls are excluded. */
|
|
88
|
+
pendingOperations: Schema.Array(ToolCallPrepared).pipe(Schema.withConstructorDefault(Effect.succeed([]))),
|
|
87
89
|
/** Delegation Tool Calls with an open parent-side obligation. */
|
|
88
90
|
openDelegationCalls: Schema.Array(OpenDelegationCallEvidence),
|
|
89
91
|
/** Canonically requested approvals without a canonical decision. */
|
|
@@ -140,11 +142,11 @@ const RECOVERY_DECISION_MEANINGS = {
|
|
|
140
142
|
FinalizeLedgerFromHistory: "The canonical settlement record exists: recovery rebuilds/finalizes the ledger from history and never rewrites history from the cached ledger status (DUR-011, DUR-015).",
|
|
141
143
|
SettleAborted: "A durable abort intent exists with no reserved outcome and no open attached-child obligation: recovery settles aborted, first recording ToolCallUnknown audits for open ordinary calls — abort never asserts external rollback (durability §13).",
|
|
142
144
|
MarkUnknown: "Prepared ordinary Tool Calls have no canonical outcome: recovery reconciles each open call and marks the remainder Unknown — never an automatic replay (DUR-009/DUR-017).",
|
|
143
|
-
ResumePendingToolBatch: "A committed tool-declaring response has zero prepared and zero settled records: a claiming worker resumes the declared batch without model re-invocation
|
|
145
|
+
ResumePendingToolBatch: "A committed tool-declaring response has zero prepared and zero settled records: a claiming worker checks unfinished operation contracts and resumes the declared batch without model re-invocation (durability §15).",
|
|
144
146
|
AwaitApprovalDecision: "Canonically requested approvals lack decisions: the lane waits durably for the authorized resolveApproval path (recovery repairs a lost suspend transition from history).",
|
|
145
147
|
ResumeSuspended: "Every pending approval has a durable decision: a claiming worker resumes the declared batch, appending the canonical ToolApprovalDecided records first.",
|
|
146
|
-
AwaitUnknownResolution: "Unknown Outcomes lack covering resolutions:
|
|
147
|
-
ApplyUnknownResolutions: "Durable resolution intents cover every open call: recovery
|
|
148
|
+
AwaitUnknownResolution: "Unknown Outcomes lack covering resolutions: this Submission stays parked awaiting the authorized DUR-017 resolveUnknown path; later eligible input may run, and the original obligation stays visible.",
|
|
149
|
+
ApplyUnknownResolutions: "Durable resolution intents cover every open call: recovery wakes the original Submission when required retry contracts are supported; its next claim applies canonical outcomes.",
|
|
148
150
|
RevertJoining: "The Submission is joining without a canonical input record: recovery reverts it to ready — the input was never consumed and will be delivered exactly once later (DUR-016).",
|
|
149
151
|
RepairJoinMarker: "The canonical joined input exists but the joined marker was lost: recovery repairs the marker only; the input reattaches, never duplicates (DUR-015/DUR-016).",
|
|
150
152
|
SettleJoinedWithHost: "The host Run settled canonically: recovery settles this joined Submission with the host outcome — each joined Submission is owed its own settlement (DUR-002).",
|
|
@@ -297,8 +299,8 @@ const obligationSeverityOf = (ageSeconds, thresholds) => ageSeconds >= threshold
|
|
|
297
299
|
/**
|
|
298
300
|
* The mandatory-audit retry command (SEC-011): `author`/`reason` carry the same bounds as the
|
|
299
301
|
* canonical abort command so every mutating administrative operation stays attributable. The
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
+
* operator and decision are logged. A repair with a claim also appends a best-effort
|
|
303
|
+
* `RepairAnnotated` attempt using that claim's epoch; state-only repairs do not append audits.
|
|
302
304
|
*/
|
|
303
305
|
var RetryCommand = class extends Schema.Class("@effect-agent/thread/RetryCommand")({
|
|
304
306
|
submissionId: SubmissionId,
|
|
@@ -312,7 +314,7 @@ const RetryRefusalReason = Schema.Literals([
|
|
|
312
314
|
"await-approval-decision"
|
|
313
315
|
]);
|
|
314
316
|
/**
|
|
315
|
-
* Typed refusal of `retry` (plan §3):
|
|
317
|
+
* Typed refusal of `retry` (plan §3): Submissions waiting on `AwaitUnknownResolution` or
|
|
316
318
|
* `AwaitApprovalDecision` have their own authorized operations, and settled work is never
|
|
317
319
|
* re-driven. The refusal names the classifier decision so the operator sees WHY.
|
|
318
320
|
*/
|