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
|
@@ -10,6 +10,8 @@ import { type IdempotencyKey, type JoinedToHost, type Receipt } from "../core/Re
|
|
|
10
10
|
import type { SubagentBudgetReservation } from "../core/SubagentContract.ts";
|
|
11
11
|
import {
|
|
12
12
|
WorkerError,
|
|
13
|
+
type WorkerStop,
|
|
14
|
+
type WorkerStopped,
|
|
13
15
|
type WorkerCompletion,
|
|
14
16
|
type WorkerHistoryEntry,
|
|
15
17
|
type WorkerContext,
|
|
@@ -36,6 +38,30 @@ export interface StartWorkerRequest {
|
|
|
36
38
|
readonly budgetScope?: WorkerBudgetScope;
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
/**
|
|
42
|
+
* First-admission preparation stays lazy until the owner authorizes the caller and checks the
|
|
43
|
+
* retained command. Replays compare declared parameters/options and reuse the original capture.
|
|
44
|
+
* Prepared policy, budget, and allowance are frozen first-admission configuration, not replay
|
|
45
|
+
* arguments; changing them requires a new command key. Current caller authorization still applies.
|
|
46
|
+
* Preparation must be free of external effects: concurrent first admissions can prepare before
|
|
47
|
+
* the retained delivery chooses its first writer.
|
|
48
|
+
*/
|
|
49
|
+
export interface DeferredStartWorkerRequest<E = never, R = never> extends Pick<
|
|
50
|
+
StartWorkerRequest,
|
|
51
|
+
| "delegationId"
|
|
52
|
+
| "target"
|
|
53
|
+
| "idempotencyKey"
|
|
54
|
+
| "encodedParameters"
|
|
55
|
+
| "encodedGrant"
|
|
56
|
+
| "budgetScope"
|
|
57
|
+
> {
|
|
58
|
+
readonly prepare: Effect.Effect<
|
|
59
|
+
Pick<StartWorkerRequest, "encodedInput" | "policy" | "budget" | "toolCallAllowance">,
|
|
60
|
+
E,
|
|
61
|
+
R
|
|
62
|
+
>;
|
|
63
|
+
}
|
|
64
|
+
|
|
39
65
|
export interface FollowUpWorkerRequest {
|
|
40
66
|
readonly worker: WorkerRef;
|
|
41
67
|
readonly target: Agent.AnyDefinition;
|
|
@@ -92,26 +118,16 @@ export class WorkerReportPreparationFailure extends Schema.TaggedError<WorkerRep
|
|
|
92
118
|
) {}
|
|
93
119
|
|
|
94
120
|
/**
|
|
95
|
-
* Source-owned projection discovered from background tools
|
|
121
|
+
* Source-owned standard projection discovered from background tools.
|
|
96
122
|
* The concrete descriptor retains its E/R; durable registration captures R and records
|
|
97
123
|
* bounded preparation failure rather than serializing arbitrary application errors.
|
|
98
124
|
*/
|
|
99
125
|
export interface WorkerReporting<E = never, R = never> {
|
|
100
126
|
readonly delegationId: DelegationId;
|
|
101
127
|
readonly target: Agent.AnyDefinition;
|
|
102
|
-
/** Standard messages retain the parent's original application input. */
|
|
103
|
-
readonly mode?: "standard";
|
|
104
|
-
readonly input?: Schema.Top;
|
|
105
|
-
/** Required for custom mapping when the receiving coordinator is itself an established worker. */
|
|
106
|
-
readonly destination?: {
|
|
107
|
-
readonly delegationId: DelegationId;
|
|
108
|
-
readonly target: Agent.AnyDefinition;
|
|
109
|
-
};
|
|
110
128
|
readonly prepare: (report: WorkerRunReport) => Effect.Effect<
|
|
111
129
|
{
|
|
112
|
-
readonly
|
|
113
|
-
readonly encodedParameters?: Schema.Json;
|
|
114
|
-
readonly message?: WorkerCompletion;
|
|
130
|
+
readonly message: WorkerCompletion;
|
|
115
131
|
},
|
|
116
132
|
E | WorkerReportPreparationFailure,
|
|
117
133
|
R
|
|
@@ -137,7 +153,10 @@ export class SubagentHost extends Context.Service<
|
|
|
137
153
|
readonly target: Agent.AnyDefinition;
|
|
138
154
|
readonly encodedInput: unknown;
|
|
139
155
|
}) => Effect.Effect<Option.Option<AgentPolicy>, WorkerError>;
|
|
140
|
-
|
|
156
|
+
/** Prepared callers retain strict input/policy conflicts; deferred callers replay the saved capture. */
|
|
157
|
+
readonly start: <E = never, R = never>(
|
|
158
|
+
request: StartWorkerRequest | DeferredStartWorkerRequest<E, R>,
|
|
159
|
+
) => Effect.Effect<WorkerStarted, WorkerError | E, R>;
|
|
141
160
|
readonly followUp: (
|
|
142
161
|
request: FollowUpWorkerRequest,
|
|
143
162
|
) => Effect.Effect<MessageStatus, WorkerError>;
|
|
@@ -165,6 +184,10 @@ export class SubagentHost extends Context.Service<
|
|
|
165
184
|
readonly limit: number;
|
|
166
185
|
readonly after?: ThreadId;
|
|
167
186
|
}) => Effect.Effect<WorkerPage, WorkerError>;
|
|
187
|
+
/** Seal the whole worker; retries reconcile the same command, including a lost acknowledgement. */
|
|
188
|
+
readonly stop: (
|
|
189
|
+
request: WorkerStop & { readonly target: Agent.AnyDefinition },
|
|
190
|
+
) => Effect.Effect<WorkerStopped, WorkerError>;
|
|
168
191
|
/** Cancel exactly this Receipt; preserve JoinedToHost without broadening its target. */
|
|
169
192
|
readonly cancel: (
|
|
170
193
|
request: WorkerReceiptRequest,
|
|
@@ -181,6 +204,7 @@ export class SubagentHost extends Context.Service<
|
|
|
181
204
|
observe: () => Stream.fail(WorkerError.make({ operation: "observe", reason: "unavailable" })),
|
|
182
205
|
await: () => WorkerError.make({ operation: "await", reason: "unavailable" }),
|
|
183
206
|
list: () => WorkerError.make({ operation: "list", reason: "unavailable" }),
|
|
207
|
+
stop: () => WorkerError.make({ operation: "stop", reason: "unavailable" }),
|
|
184
208
|
cancel: () => WorkerError.make({ operation: "cancel", reason: "unavailable" }),
|
|
185
209
|
};
|
|
186
210
|
|
|
@@ -121,7 +121,11 @@ import {
|
|
|
121
121
|
sumRunTotals,
|
|
122
122
|
type UsageCompleteness,
|
|
123
123
|
} from "../../core/Usage.ts";
|
|
124
|
-
import {
|
|
124
|
+
import {
|
|
125
|
+
AssignmentDisposition,
|
|
126
|
+
FrameworkMessage,
|
|
127
|
+
type WorkerBudgetScope,
|
|
128
|
+
} from "../../core/Worker.ts";
|
|
125
129
|
import { MessagingHost } from "../MessagingHost.ts";
|
|
126
130
|
import { SubagentHost } from "../SubagentHost.ts";
|
|
127
131
|
import { ThreadHistory, ThreadHistoryError } from "../ThreadHistory.ts";
|
|
@@ -5205,7 +5209,7 @@ const encodeRunDispositionCandidate = Effect.fn("AgentRuntime.encodeRunDispositi
|
|
|
5205
5209
|
}),
|
|
5206
5210
|
});
|
|
5207
5211
|
|
|
5208
|
-
if (selected === undefined) return undefined;
|
|
5212
|
+
if (selected === undefined && declaration.workerLifecycle === undefined) return undefined;
|
|
5209
5213
|
|
|
5210
5214
|
const encoded = yield* Schema.encodeUnknownEffect(declaration.schema)(selected).pipe(
|
|
5211
5215
|
Effect.mapError((cause) =>
|
|
@@ -5216,6 +5220,17 @@ const encodeRunDispositionCandidate = Effect.fn("AgentRuntime.encodeRunDispositi
|
|
|
5216
5220
|
),
|
|
5217
5221
|
);
|
|
5218
5222
|
|
|
5223
|
+
if (declaration.workerLifecycle === "assignment") {
|
|
5224
|
+
return yield* Schema.decodeUnknownEffect(AssignmentDisposition)(encoded).pipe(
|
|
5225
|
+
Effect.mapError((cause) =>
|
|
5226
|
+
AgentRunDispositionError.make({
|
|
5227
|
+
cause,
|
|
5228
|
+
message: "Assignment disposition must encode completed or waiting",
|
|
5229
|
+
}),
|
|
5230
|
+
),
|
|
5231
|
+
);
|
|
5232
|
+
}
|
|
5233
|
+
|
|
5219
5234
|
return yield* Schema.decodeUnknownEffect(Schema.Json)(encoded).pipe(
|
|
5220
5235
|
Effect.mapError((cause) =>
|
|
5221
5236
|
AgentRunDispositionError.make({
|