effect-agent 0.1.0-beta.113 → 0.1.0-beta.115
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/Agent-1DMSO_Fl.mjs.map +1 -1
- package/dist/{Agent-DriBcXBN.d.mts → Agent-D9cXqfF3.d.mts} +9 -2
- package/dist/{AgentRuntime-DLwPoEVH.mjs → AgentRuntime-Cp1hAb-W.mjs} +8 -4
- package/dist/AgentRuntime-Cp1hAb-W.mjs.map +1 -0
- package/dist/{AgentRuntime-CWkHuzyt.d.mts → AgentRuntime-DyZv8uu2.d.mts} +6 -6
- package/dist/{DurableAgentRuntime-BIrgxwRl.mjs → DurableAgentRuntime-tNrkJZNo.mjs} +254 -162
- package/dist/DurableAgentRuntime-tNrkJZNo.mjs.map +1 -0
- package/dist/{DurableFailpoint-mx3-nsxU.d.mts → DurableFailpoint-Cnr3wx1L.d.mts} +3 -3
- package/dist/{EventSource-ARs56eBq.d.mts → EventSource-DPRdlvhV.d.mts} +3 -3
- package/dist/{Messaging-DaZDlBqh.d.mts → Messaging-JYYN3oYS.d.mts} +3 -3
- package/dist/{MessagingHost-e1Sbzfao.d.mts → MessagingHost-CqzpxbGz.d.mts} +3 -3
- package/dist/{MessagingHost-D89X7ma8.mjs → MessagingHost-DfsbMPvq.mjs} +2 -2
- package/dist/{MessagingHost-D89X7ma8.mjs.map → MessagingHost-DfsbMPvq.mjs.map} +1 -1
- package/dist/{Output-CAFJTAbP.d.mts → Output-V-6YL1_Z.d.mts} +2 -2
- package/dist/{PreparedInputAdmission-_WYg-D0f.d.mts → PreparedInputAdmission-DqQUjA9k.d.mts} +4 -4
- package/dist/{Records-BtxMy8xD.d.mts → Records-Byeb70tt.d.mts} +89 -31
- package/dist/{RunOptions-BoESJrxw.d.mts → RunOptions-CSBsSj0X.d.mts} +3 -3
- package/dist/{Schedule-DGPyXBzK.d.mts → Schedule-krSnBcbU.d.mts} +2 -2
- package/dist/{Subagent-D9eYdGTl.mjs → Subagent-Di8EEjWZ.mjs} +67 -105
- package/dist/Subagent-Di8EEjWZ.mjs.map +1 -0
- package/dist/{Subagent-F72tuaxy.d.mts → Subagent-gw9KD6eb.d.mts} +310 -35
- package/dist/{SubagentHost-CmiNTOBZ.d.mts → SubagentHost-P9zB_TfV.d.mts} +24 -18
- package/dist/{Subscription-B9VszlF9.d.mts → Subscription-Xnwd42Sm.d.mts} +6 -3
- package/dist/{SubscriptionInput-BJWZqCWP.d.mts → SubscriptionInput-CqtJ58vl.d.mts} +3 -3
- package/dist/{Worker-T_3RbaKc.mjs → Worker-CfwzMZEK.mjs} +66 -5
- package/dist/Worker-CfwzMZEK.mjs.map +1 -0
- package/dist/{Worker-Du9dhVnp.d.mts → Worker-fwWkBg12.d.mts} +199 -6
- package/dist/{agent-registration-B5CI-Ygk.mjs → agent-registration-CKNsrpwo.mjs} +7 -7
- package/dist/agent-registration-CKNsrpwo.mjs.map +1 -0
- package/dist/capabilities/Commands.d.mts +1 -1
- package/dist/capabilities/Messaging.d.mts +1 -1
- package/dist/capabilities/Messaging.mjs +2 -2
- package/dist/capabilities/RunHooks.d.mts +1 -1
- package/dist/capabilities/Subagent.d.mts +3 -3
- package/dist/capabilities/Subagent.mjs +3 -3
- package/dist/core/Agent.d.mts +1 -1
- package/dist/core/Worker.d.mts +2 -2
- package/dist/core/Worker.mjs +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/AgentRegistration.mjs +1 -1
- package/dist/durable/Certification.d.mts +2 -2
- package/dist/durable/CommittedActivity.d.mts +1 -1
- 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/DurableFailpoint.d.mts +1 -1
- package/dist/durable/DurableFailpoint.mjs +4 -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/GitHubWorkflowSource.d.mts +3 -3
- package/dist/durable/MessageDelivery.d.mts +20 -3
- package/dist/durable/MessageDelivery.mjs +12 -4
- package/dist/durable/MessageDelivery.mjs.map +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +41 -39
- package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +2 -2
- package/dist/durable/Records.mjs +12 -5
- package/dist/durable/Records.mjs.map +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 +2 -2
- package/dist/durable/SqlMessageDeliveryStore.mjs +7 -1
- package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -1
- package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
- package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
- package/dist/durable/SqlThreadNativeReads.d.mts +5 -1
- package/dist/durable/SqlThreadNativeReads.mjs +6 -0
- package/dist/durable/SqlThreadNativeReads.mjs.map +1 -1
- package/dist/durable/SubmissionLedger.d.mts +2 -2
- package/dist/durable/SubmissionLedger.mjs +34 -4
- package/dist/durable/SubmissionLedger.mjs.map +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +899 -706
- 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 +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionTools.d.mts +3 -3
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadInvariants.d.mts +1 -1
- 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/ThreadStore.mjs +5 -0
- package/dist/durable/ThreadStore.mjs.map +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/WorkerHost.d.mts +3 -3
- package/dist/durable/WorkerHost.mjs +1 -1
- package/dist/engine/AgentRuntime.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/engine/MessagingHost.d.mts +1 -1
- package/dist/engine/MessagingHost.mjs +1 -1
- package/dist/engine/Output.d.mts +1 -1
- package/dist/engine/RunOptions.d.mts +1 -1
- package/dist/engine/SubagentHost.d.mts +2 -2
- package/dist/engine/SubagentHost.mjs +5 -1
- package/dist/engine/SubagentHost.mjs.map +1 -1
- package/dist/index.d.mts +16 -16
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
- package/src/capabilities/Subagent.ts +2 -1
- package/src/capabilities/internal/subagent-background.ts +86 -57
- package/src/capabilities/internal/subagent-reporting.ts +3 -128
- package/src/core/Agent.ts +8 -1
- package/src/core/Worker.ts +58 -2
- package/src/durable/DurableAgentRuntime.ts +2 -0
- package/src/durable/DurableFailpoint.ts +4 -0
- package/src/durable/MessageDelivery.ts +17 -2
- package/src/durable/Records.ts +12 -2
- package/src/durable/SqlMessageDeliveryStore.ts +15 -1
- package/src/durable/SqlThreadNativeReads.ts +14 -0
- package/src/durable/SubmissionLedger.ts +48 -1
- package/src/durable/SubmissionLedgerConformance.ts +260 -42
- package/src/durable/ThreadStore.ts +5 -0
- package/src/durable/internal/agent-registration.ts +13 -48
- package/src/durable/internal/worker-host.ts +490 -341
- package/src/engine/SubagentHost.ts +37 -13
- package/src/engine/internal/agent-runtime.ts +17 -2
- package/dist/AgentRuntime-DLwPoEVH.mjs.map +0 -1
- package/dist/DurableAgentRuntime-BIrgxwRl.mjs.map +0 -1
- package/dist/Subagent-D9eYdGTl.mjs.map +0 -1
- package/dist/Worker-T_3RbaKc.mjs.map +0 -1
- package/dist/agent-registration-B5CI-Ygk.mjs.map +0 -1
|
@@ -6,10 +6,10 @@ import { r as ModelCallUsage, s as RunTotals, t as ChildRunUsage } from "./Usage
|
|
|
6
6
|
import { a as AgentInputError, u as AgentToolAuthorizationCheckError } from "./AgentError-Bn1ytXRD.mjs";
|
|
7
7
|
import { t as ToolParameterRejection } from "./ToolResult-BKdqWRff.mjs";
|
|
8
8
|
import { t as AgentPolicy } from "./AgentPolicy-BqDoSXO6.mjs";
|
|
9
|
-
import { r as AnyDefinition } from "./Agent-
|
|
9
|
+
import { r as AnyDefinition } from "./Agent-D9cXqfF3.mjs";
|
|
10
10
|
import { o as MemoryRecallError } from "./MemoryReference-B8Q3UJoJ.mjs";
|
|
11
11
|
import { t as RunPolicyUsage } from "./RunPolicyUsage-ClZxyR46.mjs";
|
|
12
|
-
import {
|
|
12
|
+
import { a as WorkerBudgetScope, r as FrameworkMessage } from "./Worker-fwWkBg12.mjs";
|
|
13
13
|
import { c as ModelCallContext, r as ContextRolloverSelection } from "./ContextWindow-DRQ5Mbm2.mjs";
|
|
14
14
|
import { c as ContextMessageTokenEstimator, n as CompactionError } from "./ContextCompactor-WwSIG_Z2.mjs";
|
|
15
15
|
import { l as ToolExecutionClassValue, o as RunStepHook } from "./DurableStep-Cry_iol4.mjs";
|
|
@@ -932,4 +932,4 @@ type RunOptionsError<Options> = Options extends RunOptions<infer Error, infer _R
|
|
|
932
932
|
type RunOptionsRequirements<Options> = Options extends RunOptions<infer _Error, infer Requirements> ? Requirements : never;
|
|
933
933
|
//#endregion
|
|
934
934
|
export { RunTurnResponseCommit as $, RunInputCommand as A, RunSubagentChildIdentity as B, RunContextPreparationPassthrough as C, RunCostEstimateValue as D, RunCostEstimateRequest as E, RunOptions_d_exports as F, RunToolAuthorization as G, RunSubagentEstablishRequest as H, RunResumeUsage as I, RunToolAuthorizationRequest as J, RunToolAuthorizationDecision as K, RunResumeUsageSchema as L, RunOptions as M, RunOptionsError as N, RunCostEstimator as O, RunOptionsRequirements as P, RunTransientContextHook as Q, RunSchedulingHook as R, RunContextPreparationError as S, RunCostEstimate as T, RunSubagentHook as U, RunSubagentDigests as V, RunSubagentJoinRequest as W, RunToolFailureObserver as X, RunToolCallDescriptor as Y, RunToolScheduling as Z, RunBudgetHook as _, ChildEstablishWaiting as a, RunUsageDelta as at, RunContextHook as b, ModelToolFailure as c, ProgrammaticPreflightFailure as d, RunTurnResume as et, ProgrammaticToolFailure as f, RunApprovalRequest as g, RunApprovalHook as h, ChildEstablishStatus as i, RunTurnUsage as it, RunInputHook as j, RunDurabilityHook as k, ModelUsageAccounting as l, RunApprovalDecision as m, ChildEstablishDenied as n, RunTurnResumeSettledCall as nt, CommandDrainPolicy as o, ToolFailureObservation as ot, ResolvedModelCall as p, RunToolAuthorizationHook as q, ChildEstablishSettled as r, RunTurnResumeSettledCallSchema as rt, CurrentToolFailureObserver as s, toolFailureObserverLayer as st, AgentUpdateAcceptance as t, RunTurnResumeCall as tt, PreparedRunContext as u, RunBufferLimits as v, RunContextRequest as w, RunContextPreparation as x, RunCompactionCommit as y, RunSchedulingOverride as z };
|
|
935
|
-
//# sourceMappingURL=RunOptions-
|
|
935
|
+
//# sourceMappingURL=RunOptions-CSBsSj0X.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as Receipt } from "./Receipt-BAHyigAF.mjs";
|
|
2
2
|
import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-CaAkzGHL.mjs";
|
|
3
|
-
import { _ as Digest, h as DefinitionDigests } from "./Records-
|
|
3
|
+
import { _ as Digest, h as DefinitionDigests } from "./Records-Byeb70tt.mjs";
|
|
4
4
|
import { Context, Effect, Schema } from "effect";
|
|
5
5
|
declare namespace Schedule_d_exports {
|
|
6
6
|
export { ScheduleAuthorizationDecision, ScheduleAuthorizationError, ScheduleAuthorizer, ScheduleCapacityError, ScheduleChange, ScheduleConfiguration, ScheduleConflict, ScheduleDestination, ScheduleDueCursor, ScheduleFailpoint, ScheduleFailpointError, ScheduleId, ScheduleInstant, ScheduleKey, ScheduleManagementAuthorization, ScheduleManagementOperation, ScheduleNotFound, ScheduleOccurrenceAuthorization, ScheduleOwner, SchedulePage, SchedulePageRequest, SchedulePending, ScheduleRecord, ScheduleRefusal, ScheduleRetry, ScheduleRetryReason, ScheduleScope, ScheduleSkippedRange, ScheduleSnapshot, ScheduleSnapshotPage, ScheduleStorageError, ScheduleStore, ScheduleStoreFailure, ScheduleTiming, ScheduleTimingRequest, ScheduleValidationError, ScheduleWake, ScheduledEnvelope, ScheduledInputAdmission, ScheduledInputFailure, ScheduledInputRefused, ScheduledInputRetryable, SchedulingLimits, defaultSchedulingLimits };
|
|
@@ -844,4 +844,4 @@ declare const ScheduleFailpoint: Context.Reference<{
|
|
|
844
844
|
}>;
|
|
845
845
|
//#endregion
|
|
846
846
|
export { ScheduleSnapshotPage as A, ScheduledInputAdmission as B, ScheduleRecord as C, ScheduleScope as D, ScheduleRetryReason as E, ScheduleTimingRequest as F, defaultSchedulingLimits as G, ScheduledInputRefused as H, ScheduleValidationError as I, ScheduleWake as L, ScheduleStore as M, ScheduleStoreFailure as N, ScheduleSkippedRange as O, ScheduleTiming as P, Schedule_d_exports as R, SchedulePending as S, ScheduleRetry as T, ScheduledInputRetryable as U, ScheduledInputFailure as V, SchedulingLimits as W, ScheduleNotFound as _, ScheduleChange as a, SchedulePage as b, ScheduleDestination as c, ScheduleFailpointError as d, ScheduleId as f, ScheduleManagementOperation as g, ScheduleManagementAuthorization as h, ScheduleCapacityError as i, ScheduleStorageError as j, ScheduleSnapshot as k, ScheduleDueCursor as l, ScheduleKey as m, ScheduleAuthorizationError as n, ScheduleConfiguration as o, ScheduleInstant as p, ScheduleAuthorizer as r, ScheduleConflict as s, ScheduleAuthorizationDecision as t, ScheduleFailpoint as u, ScheduleOccurrenceAuthorization as v, ScheduleRefusal as w, SchedulePageRequest as x, ScheduleOwner as y, ScheduledEnvelope as z };
|
|
847
|
-
//# sourceMappingURL=Schedule-
|
|
847
|
+
//# sourceMappingURL=Schedule-krSnBcbU.d.mts.map
|
|
@@ -7,9 +7,9 @@ import { i as Failure, o as Value } from "./FailureDiagnostic-BElLOoED.mjs";
|
|
|
7
7
|
import { IdGenerator as IdGenerator$1 } from "./core/IdGenerator.mjs";
|
|
8
8
|
import { BackgroundSpawnTool, DelegationTool, SubagentBudgetReservation, SubagentDelegationCaps, SubagentExecutionFailure, SubagentExecutionFailureClassification, SubagentGrant, SubagentReservationAmounts, WorkerOperationTool, narrowSubagentGrant } from "./core/SubagentContract.mjs";
|
|
9
9
|
import { RunUsageReport, unknownRunTotals } from "./core/Usage.mjs";
|
|
10
|
-
import {
|
|
10
|
+
import { C as MessageStatus, S as MessageRef, _ as WorkerStop, c as WorkerError, d as WorkerPage, f as WorkerRef, g as WorkerStarted, o as WorkerCompletion, p as WorkerReport, s as WorkerContext, v as WorkerStopped, y as WorkerSummary } from "./Worker-CfwzMZEK.mjs";
|
|
11
11
|
import { BackgroundReporting, SubagentHost, WorkerReportPreparationFailure } from "./engine/SubagentHost.mjs";
|
|
12
|
-
import { a as SubagentDurability, i as AgentSpawner, o as SubagentDurabilityError, s as ToolCallWaiting } from "./AgentRuntime-
|
|
12
|
+
import { a as SubagentDurability, i as AgentSpawner, o as SubagentDurabilityError, s as ToolCallWaiting } from "./AgentRuntime-Cp1hAb-W.mjs";
|
|
13
13
|
import { RunEventSink } from "./engine/RunEventSink.mjs";
|
|
14
14
|
import { SubagentBudgetExhausted, SubagentObservedUsage, SubagentReservationRequest, SubagentReservations, makeBudgetReservationId } from "./capabilities/SubagentReservations.mjs";
|
|
15
15
|
import { t as utf8Bytes } from "./utf8-BYfhEkcj.mjs";
|
|
@@ -228,11 +228,10 @@ const projectReport = (declaration) => Effect.fn("Subagent.projectReport")(funct
|
|
|
228
228
|
encodedResult
|
|
229
229
|
};
|
|
230
230
|
});
|
|
231
|
-
/**
|
|
231
|
+
/** Project a canonical child outcome into the bounded standard completion message. */
|
|
232
232
|
const automaticReporting = (declaration) => ({
|
|
233
233
|
delegationId: declaration.delegationId,
|
|
234
234
|
target: declaration.target,
|
|
235
|
-
mode: "standard",
|
|
236
235
|
prepare: Effect.fn("Subagent.automaticReport")(function* (report) {
|
|
237
236
|
const { projected, encodedResult } = yield* projectReport(declaration)(report);
|
|
238
237
|
const encoded = projected.outcome === "completed" ? {
|
|
@@ -242,72 +241,14 @@ const automaticReporting = (declaration) => ({
|
|
|
242
241
|
...projected,
|
|
243
242
|
failure: yield* Schema.encodeEffect(SubagentExecutionFailure)(projected.failure).pipe(Effect.mapError(() => WorkerReportPreparationFailure.make({ stage: "projection" })))
|
|
244
243
|
};
|
|
245
|
-
return {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
budgetExhausted: report.observation.budgetExhausted
|
|
252
|
-
}).pipe(Effect.mapError(() => WorkerReportPreparationFailure.make({ stage: "projection" })))
|
|
253
|
-
};
|
|
244
|
+
return { message: yield* Schema.decodeEffect(WorkerCompletion)({
|
|
245
|
+
_tag: "WorkerCompletion",
|
|
246
|
+
schemaVersion: 1,
|
|
247
|
+
report: encoded,
|
|
248
|
+
budgetExhausted: report.observation.budgetExhausted
|
|
249
|
+
}).pipe(Effect.mapError(() => WorkerReportPreparationFailure.make({ stage: "projection" }))) };
|
|
254
250
|
})
|
|
255
251
|
});
|
|
256
|
-
/**
|
|
257
|
-
* Define an optional application-specific conversion for `background({ reportToParent: report })`.
|
|
258
|
-
* Existing Agent Registration `reporting` arrays remain supported. The input Schema must be the coordinator Definition's exact input Schema.
|
|
259
|
-
* Preparation is bounded by the durable host; a retained prepared envelope is never reprojected
|
|
260
|
-
* during delivery retries. The callback should be deterministic and have no external side effects.
|
|
261
|
-
*/
|
|
262
|
-
const reporting = (declaration, options) => {
|
|
263
|
-
const prepare = Effect.fn("Subagent.reporting.prepare")(function* (report) {
|
|
264
|
-
const { projected } = yield* projectReport(declaration)(report);
|
|
265
|
-
const input = yield* options.prepare(projected);
|
|
266
|
-
const encoded = yield* Schema.encodeEffect(options.input)(input).pipe(Effect.mapError(() => WorkerReportPreparationFailure.make({ stage: "input" })));
|
|
267
|
-
return { encodedInput: yield* Schema.decodeUnknownEffect(Schema.Json)(encoded).pipe(Effect.mapError(() => WorkerReportPreparationFailure.make({ stage: "input" }))) };
|
|
268
|
-
});
|
|
269
|
-
return Object.freeze({
|
|
270
|
-
delegationId: declaration.delegationId,
|
|
271
|
-
target: declaration.target,
|
|
272
|
-
input: options.input,
|
|
273
|
-
prepare
|
|
274
|
-
});
|
|
275
|
-
};
|
|
276
|
-
/**
|
|
277
|
-
* Adapt a report expressed in a receiving worker declaration's Parameters to its Agent input.
|
|
278
|
-
* Use this on that worker's registration when it can itself launch reporting workers. This
|
|
279
|
-
* explicit conversion preserves custom Parameters and charges the next input to its ancestor.
|
|
280
|
-
*/
|
|
281
|
-
const reportingToWorker = (report, destination) => {
|
|
282
|
-
if (report.input !== destination.parameters) throw new TypeError("Worker reporting must use the destination declaration's Parameters Schema");
|
|
283
|
-
return Object.freeze({
|
|
284
|
-
delegationId: report.delegationId,
|
|
285
|
-
target: report.target,
|
|
286
|
-
input: destination.target.input,
|
|
287
|
-
destination: {
|
|
288
|
-
delegationId: destination.delegationId,
|
|
289
|
-
target: destination.target
|
|
290
|
-
},
|
|
291
|
-
prepare: Effect.fn("Subagent.reportingToWorker.prepare")(function* (run) {
|
|
292
|
-
const encodedParameters = (yield* report.prepare(run)).encodedInput;
|
|
293
|
-
const invalid = () => WorkerReportPreparationFailure.make({ stage: "input" });
|
|
294
|
-
const parameters = yield* Schema.decodeEffect(destination.parameters)(encodedParameters).pipe(Effect.mapError(invalid));
|
|
295
|
-
const input = yield* destination.prepareInput(parameters, {
|
|
296
|
-
source: "programmatic",
|
|
297
|
-
delegationId: destination.delegationId,
|
|
298
|
-
parent: {
|
|
299
|
-
agentId: run.context.source.agentId,
|
|
300
|
-
threadId: run.context.source.threadId
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
const encoded = yield* Schema.encodeEffect(destination.target.input)(input).pipe(Effect.mapError(invalid));
|
|
304
|
-
return {
|
|
305
|
-
encodedInput: yield* Schema.decodeUnknownEffect(Schema.Json)(encoded).pipe(Effect.mapError(invalid)),
|
|
306
|
-
encodedParameters
|
|
307
|
-
};
|
|
308
|
-
})
|
|
309
|
-
});
|
|
310
|
-
};
|
|
311
252
|
//#endregion
|
|
312
253
|
//#region src/capabilities/internal/subagent-background.ts
|
|
313
254
|
/** Portable identity checked against this declaration; possession grants no authority. */
|
|
@@ -388,7 +329,6 @@ const operations = (declaration) => {
|
|
|
388
329
|
cause: error
|
|
389
330
|
})));
|
|
390
331
|
const prepare = Effect.fn("Subagent.prepareWorkerInput")(function* (parameters, caller) {
|
|
391
|
-
const encodedParameters = yield* Schema.encodeEffect(declaration.parameters)(parameters).pipe(Effect.mapError((cause) => projectionFailure("input", cause)));
|
|
392
332
|
const source = caller.source;
|
|
393
333
|
const preparation = source._tag === "tool" ? {
|
|
394
334
|
source: "tool",
|
|
@@ -408,10 +348,7 @@ const operations = (declaration) => {
|
|
|
408
348
|
}
|
|
409
349
|
};
|
|
410
350
|
const input = yield* declaration.prepareInput(parameters, preparation);
|
|
411
|
-
return
|
|
412
|
-
encodedParameters,
|
|
413
|
-
encodedInput: yield* Schema.encodeEffect(declaration.target.input)(input).pipe(Effect.mapError((cause) => projectionFailure("input", cause)))
|
|
414
|
-
};
|
|
351
|
+
return yield* Schema.encodeEffect(declaration.target.input)(input).pipe(Effect.mapError((cause) => projectionFailure("input", cause)));
|
|
415
352
|
});
|
|
416
353
|
const validateKey = (key, operation) => Schema.decodeEffect(IdempotencyKey)(key).pipe(Effect.mapError((cause) => WorkerError.make({
|
|
417
354
|
operation,
|
|
@@ -436,28 +373,34 @@ const operations = (declaration) => {
|
|
|
436
373
|
reason: "grant-violation",
|
|
437
374
|
message: "The inherited grant does not permit background children"
|
|
438
375
|
});
|
|
439
|
-
const
|
|
440
|
-
const effectiveTarget = yield* service.resolveTargetPolicy({
|
|
441
|
-
target: declaration.target,
|
|
442
|
-
encodedInput: prepared.encodedInput
|
|
443
|
-
});
|
|
444
|
-
const resolvedTarget = Option.getOrUndefined(effectiveTarget);
|
|
445
|
-
const resolved = resolveSubagentPolicy(declaration, options.budgetScope === "worker-run" ? resolvedTarget ?? declaration.target.policy : caller.policy, void 0, options.budgetScope === "worker-run" ? "root-attached" : "conserved", resolvedTarget);
|
|
376
|
+
const encodedParameters = yield* Schema.encodeEffect(declaration.parameters)(parameters).pipe(Effect.mapError((cause) => projectionFailure("input", cause)));
|
|
446
377
|
const encodedGrant = yield* Schema.encodeEffect(SubagentGrant)(grant).pipe(Effect.mapError((cause) => projectionFailure("input", cause)));
|
|
447
378
|
const started = yield* service.start({
|
|
448
|
-
...prepared,
|
|
449
379
|
delegationId: declaration.delegationId,
|
|
450
380
|
target: declaration.target,
|
|
451
381
|
idempotencyKey: key,
|
|
452
|
-
|
|
382
|
+
encodedParameters,
|
|
453
383
|
encodedGrant,
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
384
|
+
...options.budgetScope === void 0 ? {} : { budgetScope: options.budgetScope },
|
|
385
|
+
prepare: Effect.gen(function* () {
|
|
386
|
+
const encodedInput = yield* prepare(parameters, caller);
|
|
387
|
+
const effectiveTarget = yield* service.resolveTargetPolicy({
|
|
388
|
+
target: declaration.target,
|
|
389
|
+
encodedInput
|
|
390
|
+
});
|
|
391
|
+
const resolvedTarget = Option.getOrUndefined(effectiveTarget);
|
|
392
|
+
const resolved = resolveSubagentPolicy(declaration, options.budgetScope === "worker-run" ? resolvedTarget ?? declaration.target.policy : caller.policy, void 0, options.budgetScope === "worker-run" ? "root-attached" : "conserved", resolvedTarget);
|
|
393
|
+
return {
|
|
394
|
+
encodedInput,
|
|
395
|
+
policy: resolved.childPolicy,
|
|
396
|
+
budget: SubagentBudgetReservation.make({
|
|
397
|
+
caps: resolved.caps,
|
|
398
|
+
allocation: resolved.allocation,
|
|
399
|
+
...resolved.policy.descendantInvocations === void 0 ? {} : { descendantInvocations: resolved.policy.descendantInvocations }
|
|
400
|
+
}),
|
|
401
|
+
toolCallAllowance: resolveToolCallAllowance(declaration.toolCallAllowance, parameters, resolved.policy, resolved.childPolicy)
|
|
402
|
+
};
|
|
403
|
+
})
|
|
461
404
|
});
|
|
462
405
|
const validated = yield* Schema.decodeEffect(WorkerStarted)(started).pipe(Effect.mapError((cause) => WorkerError.make({
|
|
463
406
|
operation: "start",
|
|
@@ -478,9 +421,11 @@ const operations = (declaration) => {
|
|
|
478
421
|
const validated = yield* validateWorker(worker, "followUp");
|
|
479
422
|
const caller = yield* context;
|
|
480
423
|
const key = yield* validateKey(options.idempotencyKey, "followUp");
|
|
481
|
-
const
|
|
424
|
+
const encodedParameters = yield* Schema.encodeEffect(declaration.parameters)(parameters).pipe(Effect.mapError((cause) => projectionFailure("input", cause)));
|
|
425
|
+
const encodedInput = yield* prepare(parameters, caller);
|
|
482
426
|
const delivery = yield* validateDelivery(validated, yield* service.followUp({
|
|
483
|
-
|
|
427
|
+
encodedParameters,
|
|
428
|
+
encodedInput,
|
|
484
429
|
worker: validated,
|
|
485
430
|
target: declaration.target,
|
|
486
431
|
idempotencyKey: key
|
|
@@ -688,6 +633,30 @@ const observe = (declaration, worker, options = {}) => Stream.unwrap(Effect.gen(
|
|
|
688
633
|
...after === void 0 ? {} : { after }
|
|
689
634
|
});
|
|
690
635
|
}));
|
|
636
|
+
/** Seal a continuing worker, retaining a stable command identity across retries and Runs. */
|
|
637
|
+
const stop = (declaration, worker, options) => Effect.gen(function* () {
|
|
638
|
+
const service = yield* host;
|
|
639
|
+
const command = yield* Schema.decodeEffect(WorkerStop)({
|
|
640
|
+
worker,
|
|
641
|
+
...options
|
|
642
|
+
}).pipe(Effect.mapError((cause) => WorkerError.make({
|
|
643
|
+
operation: "stop",
|
|
644
|
+
reason: "corrupt",
|
|
645
|
+
cause
|
|
646
|
+
})));
|
|
647
|
+
if (worker.delegationId !== declaration.delegationId || worker.targetAgentId !== declaration.target.id) return yield* WorkerError.make({
|
|
648
|
+
operation: "stop",
|
|
649
|
+
reason: "worker-mismatch"
|
|
650
|
+
});
|
|
651
|
+
return yield* service.stop({
|
|
652
|
+
...command,
|
|
653
|
+
target: declaration.target
|
|
654
|
+
}).pipe(Effect.flatMap(Schema.decodeEffect(WorkerStopped)), Effect.mapError((cause) => Schema.is(WorkerError)(cause) ? cause : WorkerError.make({
|
|
655
|
+
operation: "stop",
|
|
656
|
+
reason: "corrupt",
|
|
657
|
+
cause
|
|
658
|
+
})));
|
|
659
|
+
});
|
|
691
660
|
/** Wait for the exact Receipt. Interrupting this Effect never cancels accepted work. */
|
|
692
661
|
const awaitWorker = (declaration, worker, receipt) => operations(declaration).observe("await", worker, receipt);
|
|
693
662
|
/** List only workers visible through the caller-bound host facet. */
|
|
@@ -706,13 +675,8 @@ const InspectParameters = (declaration) => Schema.Struct({
|
|
|
706
675
|
const Inspection = (success) => Schema.Union([MessageStatus, toolObservation(success)]);
|
|
707
676
|
const WorkerParameters = (declaration) => Schema.Struct({ worker: Worker(declaration) });
|
|
708
677
|
const Summary = (declaration) => Schema.Struct({
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
state: Schema.Literals([
|
|
712
|
-
"starting",
|
|
713
|
-
"active",
|
|
714
|
-
"idle"
|
|
715
|
-
])
|
|
678
|
+
...WorkerSummary.fields,
|
|
679
|
+
worker: Worker(declaration)
|
|
716
680
|
});
|
|
717
681
|
const FollowUpParameters = (declaration, parameters) => Schema.Struct({
|
|
718
682
|
worker: Worker(declaration),
|
|
@@ -782,8 +746,7 @@ let reportingServiceId = 0;
|
|
|
782
746
|
* invocation dependencies. The attached `.tool` and its suspension behavior are unchanged.
|
|
783
747
|
*/
|
|
784
748
|
const background$1 = (declaration, selected) => {
|
|
785
|
-
const report = selected.reportToParent === true ? automaticReporting(declaration) :
|
|
786
|
-
if (report !== void 0 && (report.delegationId !== declaration.delegationId || report.target !== declaration.target)) throw new TypeError("Background reporting must use the same subagent declaration and target");
|
|
749
|
+
const report = selected.reportToParent === true ? automaticReporting(declaration) : void 0;
|
|
787
750
|
const reportService = Context.Service(`@effect-agent/capabilities/BackgroundReport/${declaration.name}/${reportingServiceId++}`);
|
|
788
751
|
const descriptor = report === void 0 ? void 0 : {
|
|
789
752
|
...report,
|
|
@@ -911,9 +874,8 @@ var Subagent_exports = /* @__PURE__ */ __exportAll({
|
|
|
911
874
|
list: () => list,
|
|
912
875
|
make: () => make,
|
|
913
876
|
observe: () => observe,
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
start: () => start
|
|
877
|
+
start: () => start,
|
|
878
|
+
stop: () => stop
|
|
917
879
|
});
|
|
918
880
|
const decodeDelegationId = Schema.decodeSync(DelegationId);
|
|
919
881
|
/** Default delegation result, preserving partial-output information. */
|
|
@@ -1532,6 +1494,6 @@ function background(targetOrDeclaration, selected) {
|
|
|
1532
1494
|
return background$1(declaration, selected);
|
|
1533
1495
|
}
|
|
1534
1496
|
//#endregion
|
|
1535
|
-
export { delegationCapsFromPolicy as
|
|
1497
|
+
export { delegationCapsFromPolicy as S, stop as _, define as a, SubagentProjectionFailure as b, Worker as c, cancel as d, followUp as f, start as g, observe as h, background as i, WorkerObservation as l, list as m, SubagentResult as n, layer as o, inspect as p, Subagent_exports as r, make as s, SubagentDurableAccounting as t, awaitWorker as u, SubagentPolicy as v, delegationAllocationFromPolicy as x, SubagentPrestartDenied as y };
|
|
1536
1498
|
|
|
1537
|
-
//# sourceMappingURL=Subagent-
|
|
1499
|
+
//# sourceMappingURL=Subagent-Di8EEjWZ.mjs.map
|