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
|
@@ -67,21 +67,36 @@ const MessageStatus = Schema.Union([
|
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region src/core/Worker.ts
|
|
69
69
|
var Worker_exports = /* @__PURE__ */ __exportAll({
|
|
70
|
+
AssignmentDisposition: () => AssignmentDisposition,
|
|
71
|
+
AssignmentTerminal: () => AssignmentTerminal,
|
|
70
72
|
FrameworkMessage: () => FrameworkMessage,
|
|
73
|
+
WorkerAppliedInput: () => WorkerAppliedInput,
|
|
71
74
|
WorkerBudgetScope: () => WorkerBudgetScope,
|
|
72
75
|
WorkerCompletion: () => WorkerCompletion,
|
|
73
76
|
WorkerContext: () => WorkerContext,
|
|
74
77
|
WorkerError: () => WorkerError,
|
|
75
78
|
WorkerHistoryEntry: () => WorkerHistoryEntry,
|
|
79
|
+
WorkerInput: () => WorkerInput,
|
|
76
80
|
WorkerOperationTool: () => WorkerOperationTool,
|
|
77
81
|
WorkerPage: () => WorkerPage,
|
|
78
82
|
WorkerRef: () => WorkerRef,
|
|
79
83
|
WorkerReport: () => WorkerReport,
|
|
84
|
+
WorkerRun: () => WorkerRun,
|
|
80
85
|
WorkerSource: () => WorkerSource,
|
|
81
86
|
WorkerStarted: () => WorkerStarted,
|
|
87
|
+
WorkerStop: () => WorkerStop,
|
|
88
|
+
WorkerStopped: () => WorkerStopped,
|
|
82
89
|
WorkerSummary: () => WorkerSummary,
|
|
83
90
|
WorkerUpdate: () => WorkerUpdate
|
|
84
91
|
});
|
|
92
|
+
/** Assignment output selected through the Definition's runDisposition declaration. */
|
|
93
|
+
const AssignmentDisposition = Schema.Literals(["completed", "waiting"]);
|
|
94
|
+
/** A permanent destination outcome; an ordinary Run completion does not imply this. */
|
|
95
|
+
const AssignmentTerminal = Schema.Literals([
|
|
96
|
+
"completed",
|
|
97
|
+
"failed",
|
|
98
|
+
"cancelled"
|
|
99
|
+
]);
|
|
85
100
|
/** A reusable child Thread, correlated with its declaration. This value grants no authority. */
|
|
86
101
|
const WorkerRef = Schema.Struct({
|
|
87
102
|
schemaVersion: Schema.Literal(1),
|
|
@@ -94,6 +109,13 @@ const WorkerStarted = Schema.Struct({
|
|
|
94
109
|
worker: WorkerRef,
|
|
95
110
|
delivery: MessageStatus
|
|
96
111
|
}).check(Schema.makeFilter(({ worker, delivery }) => delivery.receipt === null || worker.threadId === delivery.receipt.threadId));
|
|
112
|
+
/** Stable owner command. Reusing its key for a different worker conflicts. */
|
|
113
|
+
const WorkerStop = Schema.Struct({
|
|
114
|
+
worker: WorkerRef,
|
|
115
|
+
idempotencyKey: IdempotencyKey
|
|
116
|
+
});
|
|
117
|
+
/** The inbox is sealed and active execution has released ownership. External actions are not undone. */
|
|
118
|
+
const WorkerStopped = WorkerStop;
|
|
97
119
|
/** A host-authorized Run allowance is independent of the immutable delegation lineage. */
|
|
98
120
|
const WorkerBudgetScope = Schema.Literals(["source-subtree", "worker-run"]);
|
|
99
121
|
/** Host-bound caller metadata. Programmatic calls never fabricate Run or Tool Call identities. */
|
|
@@ -115,15 +137,53 @@ const WorkerContext = Schema.Struct({
|
|
|
115
137
|
depth: Schema.Natural,
|
|
116
138
|
grant: Schema.optionalKey(SubagentGrant)
|
|
117
139
|
});
|
|
140
|
+
/** Admission identity is distinct from canonical input application. */
|
|
141
|
+
const WorkerInput = Schema.Struct({
|
|
142
|
+
receipt: Receipt,
|
|
143
|
+
messageId: IdempotencyKey
|
|
144
|
+
});
|
|
145
|
+
const WorkerAppliedInput = Schema.Struct({
|
|
146
|
+
...WorkerInput.fields,
|
|
147
|
+
runId: RunId,
|
|
148
|
+
sequence: Schema.Natural
|
|
149
|
+
});
|
|
150
|
+
/** A Run outcome is not assignment completion. Interpret only a Definition's disposition. */
|
|
151
|
+
const WorkerRun = Schema.Struct({
|
|
152
|
+
runId: RunId,
|
|
153
|
+
hostReceipt: Receipt,
|
|
154
|
+
outcome: Schema.NullOr(Schema.Literals([
|
|
155
|
+
"completed",
|
|
156
|
+
"failed",
|
|
157
|
+
"aborted"
|
|
158
|
+
])),
|
|
159
|
+
disposition: Schema.NullOr(Schema.Json)
|
|
160
|
+
});
|
|
118
161
|
/** Bounded durable listing data; a latest Receipt never substitutes for a requested Receipt. */
|
|
119
162
|
const WorkerSummary = Schema.Struct({
|
|
120
163
|
worker: WorkerRef,
|
|
121
164
|
latestReceipt: Schema.NullOr(Receipt),
|
|
165
|
+
/** stopping/stopped identify an owner-issued worker stop, never an ordinary Receipt abort. */
|
|
122
166
|
state: Schema.Literals([
|
|
123
167
|
"starting",
|
|
124
168
|
"active",
|
|
125
|
-
"idle"
|
|
126
|
-
|
|
169
|
+
"idle",
|
|
170
|
+
"stopping",
|
|
171
|
+
"stopped",
|
|
172
|
+
"completed",
|
|
173
|
+
"failed",
|
|
174
|
+
"cancelled"
|
|
175
|
+
]),
|
|
176
|
+
acceptedInput: Schema.NullOr(WorkerInput),
|
|
177
|
+
appliedInput: Schema.NullOr(WorkerAppliedInput),
|
|
178
|
+
run: Schema.NullOr(WorkerRun),
|
|
179
|
+
/** One retained unadmitted input, if any; its state is independent of destination execution. */
|
|
180
|
+
pendingDelivery: Schema.NullOr(MessageStatus),
|
|
181
|
+
/** Consistent destination facts; pending delivery has its own source-owned version. */
|
|
182
|
+
watermark: Schema.Struct({
|
|
183
|
+
canonicalSequence: Schema.Natural,
|
|
184
|
+
acceptedQueueSequence: Schema.Natural,
|
|
185
|
+
pendingDeliveryVersion: Schema.NullOr(Schema.Natural)
|
|
186
|
+
})
|
|
127
187
|
});
|
|
128
188
|
const WorkerPage = Schema.Struct({
|
|
129
189
|
items: Schema.Array(WorkerSummary).check(Schema.isMaxLength(100)),
|
|
@@ -153,7 +213,8 @@ var WorkerError = class extends Schema.TaggedError()("WorkerError", {
|
|
|
153
213
|
"observe",
|
|
154
214
|
"await",
|
|
155
215
|
"list",
|
|
156
|
-
"cancel"
|
|
216
|
+
"cancel",
|
|
217
|
+
"stop"
|
|
157
218
|
]),
|
|
158
219
|
reason: Schema.Literals([
|
|
159
220
|
"denied",
|
|
@@ -205,6 +266,6 @@ const WorkerUpdate = Schema.Struct({
|
|
|
205
266
|
}).check(Schema.makeFilter(({ worker, update }) => worker.threadId === update.threadId && worker.targetAgentId === update.agentId));
|
|
206
267
|
const FrameworkMessage = Schema.Union([WorkerCompletion, WorkerUpdate]);
|
|
207
268
|
//#endregion
|
|
208
|
-
export {
|
|
269
|
+
export { MessageStatus as C, MessageRef as S, WorkerStop as _, WorkerBudgetScope as a, WorkerUpdate as b, WorkerError as c, WorkerPage as d, WorkerRef as f, WorkerStarted as g, WorkerSource as h, WorkerAppliedInput as i, WorkerHistoryEntry as l, WorkerRun as m, AssignmentTerminal as n, WorkerCompletion as o, WorkerReport as p, FrameworkMessage as r, WorkerContext as s, AssignmentDisposition as t, WorkerInput as u, WorkerStopped as v, Worker_exports as x, WorkerSummary as y };
|
|
209
270
|
|
|
210
|
-
//# sourceMappingURL=Worker-
|
|
271
|
+
//# sourceMappingURL=Worker-CfwzMZEK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Worker-CfwzMZEK.mjs","names":["FailureDiagnostic.Value"],"sources":["../src/core/internal/message-status.ts","../src/core/Worker.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { SettlementId, ThreadId } from \"../Identifiers.ts\";\nimport { IdempotencyKey, Receipt } from \"../Receipt.ts\";\n\n/** A retained outbound delivery identity, not a destination Receipt or access grant. */\nexport const MessageRef = Schema.Struct({ ownerThreadId: ThreadId, messageId: IdempotencyKey });\nexport type MessageRef = typeof MessageRef.Type;\n\nconst Reason = Schema.NonEmptyString.check(Schema.isMaxLength(256));\nconst identity = { message: MessageRef };\n\n/**\n * Source-owned delivery evidence. Pending confirms retention only; accepted supplies the\n * destination Receipt, and processed supplies its canonical settlement. Neither retention nor\n * acceptance proves execution. Refused is a definite rejection; parked stops automatic retry\n * while retaining the same identity and any acceptance evidence. Inspect instead of resending.\n */\nexport const MessageStatus = Schema.Union([\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"pending\"),\n receipt: Schema.Null,\n settlement: Schema.Null,\n reason: Schema.NullOr(Reason),\n }),\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"accepted\"),\n receipt: Receipt,\n settlement: Schema.Null,\n reason: Schema.NullOr(Reason),\n }),\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"processed\"),\n receipt: Receipt,\n settlement: Schema.Struct({\n settlementId: SettlementId,\n outcome: Schema.Literals([\"completed\", \"failed\", \"aborted\"]),\n }),\n reason: Schema.Null,\n }),\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"refused\"),\n receipt: Schema.Null,\n settlement: Schema.Null,\n reason: Reason,\n }),\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"parked\"),\n receipt: Schema.NullOr(Receipt),\n settlement: Schema.Null,\n reason: Reason,\n }),\n]);\n\nexport type MessageStatus = typeof MessageStatus.Type;\n","import { Schema } from \"effect\";\n\nimport { AgentPolicy } from \"./AgentPolicy.ts\";\nimport { Update } from \"./AgentUpdates.ts\";\nimport * as FailureDiagnostic from \"./FailureDiagnostic.ts\";\nimport { AgentId, DelegationId, RunId, SettlementId, ThreadId, ToolCallId } from \"./Identifiers.ts\";\nimport { MessageStatus } from \"./internal/message-status.ts\";\nimport { IdempotencyKey, Receipt } from \"./Receipt.ts\";\nimport { SubagentExecutionFailure, SubagentGrant } from \"./SubagentContract.ts\";\n\n/** Assignment output selected through the Definition's runDisposition declaration. */\nexport const AssignmentDisposition = Schema.Literals([\"completed\", \"waiting\"]);\nexport type AssignmentDisposition = typeof AssignmentDisposition.Type;\n\n/** A permanent destination outcome; an ordinary Run completion does not imply this. */\nexport const AssignmentTerminal = Schema.Literals([\"completed\", \"failed\", \"cancelled\"]);\nexport type AssignmentTerminal = typeof AssignmentTerminal.Type;\n\n/** A reusable child Thread, correlated with its declaration. This value grants no authority. */\nexport const WorkerRef = Schema.Struct({\n schemaVersion: Schema.Literal(1),\n delegationId: DelegationId,\n targetAgentId: AgentId,\n threadId: ThreadId,\n});\n\nexport type WorkerRef = typeof WorkerRef.Type;\n\n/** A continuing worker identity and retained first delivery, never an execution handle. */\nexport const WorkerStarted = Schema.Struct({\n worker: WorkerRef,\n delivery: MessageStatus,\n}).check(\n Schema.makeFilter(\n ({ worker, delivery }) =>\n delivery.receipt === null || worker.threadId === delivery.receipt.threadId,\n ),\n);\n\nexport type WorkerStarted = typeof WorkerStarted.Type;\n\n/** Stable owner command. Reusing its key for a different worker conflicts. */\nexport const WorkerStop = Schema.Struct({ worker: WorkerRef, idempotencyKey: IdempotencyKey });\nexport type WorkerStop = typeof WorkerStop.Type;\n\n/** The inbox is sealed and active execution has released ownership. External actions are not undone. */\nexport const WorkerStopped = WorkerStop;\nexport type WorkerStopped = typeof WorkerStopped.Type;\n\n/** A host-authorized Run allowance is independent of the immutable delegation lineage. */\nexport const WorkerBudgetScope = Schema.Literals([\"source-subtree\", \"worker-run\"]);\nexport type WorkerBudgetScope = typeof WorkerBudgetScope.Type;\n\n/** Host-bound caller metadata. Programmatic calls never fabricate Run or Tool Call identities. */\nexport const WorkerSource = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"tool\"),\n agentId: AgentId,\n threadId: ThreadId,\n runId: RunId,\n toolCallId: ToolCallId,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"programmatic\"),\n agentId: AgentId,\n threadId: ThreadId,\n }),\n]);\n\nexport type WorkerSource = typeof WorkerSource.Type;\n\n/** The caller's effective policy and root-relative depth, resolved by its host. */\nexport const WorkerContext = Schema.Struct({\n source: WorkerSource,\n policy: AgentPolicy,\n depth: Schema.Natural,\n grant: Schema.optionalKey(SubagentGrant),\n});\n\nexport type WorkerContext = typeof WorkerContext.Type;\n\n/** Admission identity is distinct from canonical input application. */\nexport const WorkerInput = Schema.Struct({ receipt: Receipt, messageId: IdempotencyKey });\nexport type WorkerInput = typeof WorkerInput.Type;\n\nexport const WorkerAppliedInput = Schema.Struct({\n ...WorkerInput.fields,\n runId: RunId,\n sequence: Schema.Natural,\n});\n\n/** A Run outcome is not assignment completion. Interpret only a Definition's disposition. */\nexport const WorkerRun = Schema.Struct({\n runId: RunId,\n hostReceipt: Receipt,\n outcome: Schema.NullOr(Schema.Literals([\"completed\", \"failed\", \"aborted\"])),\n disposition: Schema.NullOr(Schema.Json),\n});\n\n/** Bounded durable listing data; a latest Receipt never substitutes for a requested Receipt. */\nexport const WorkerSummary = Schema.Struct({\n worker: WorkerRef,\n latestReceipt: Schema.NullOr(Receipt),\n /** stopping/stopped identify an owner-issued worker stop, never an ordinary Receipt abort. */\n state: Schema.Literals([\n \"starting\",\n \"active\",\n \"idle\",\n \"stopping\",\n \"stopped\",\n \"completed\",\n \"failed\",\n \"cancelled\",\n ]),\n acceptedInput: Schema.NullOr(WorkerInput),\n appliedInput: Schema.NullOr(WorkerAppliedInput),\n run: Schema.NullOr(WorkerRun),\n /** One retained unadmitted input, if any; its state is independent of destination execution. */\n pendingDelivery: Schema.NullOr(MessageStatus),\n /** Consistent destination facts; pending delivery has its own source-owned version. */\n watermark: Schema.Struct({\n canonicalSequence: Schema.Natural,\n acceptedQueueSequence: Schema.Natural,\n pendingDeliveryVersion: Schema.NullOr(Schema.Natural),\n }),\n});\n\nexport type WorkerSummary = typeof WorkerSummary.Type;\n\nexport const WorkerPage = Schema.Struct({\n items: Schema.Array(WorkerSummary).check(Schema.isMaxLength(100)),\n next: Schema.NullOr(ThreadId),\n});\n\nexport type WorkerPage = typeof WorkerPage.Type;\n\n/** Authorized canonical history, encoded independently of storage-adapter representations. */\nexport const WorkerHistoryEntry = Schema.Struct({\n sequence: Schema.Natural.check(Schema.isGreaterThan(0)),\n recordId: Schema.NonEmptyString.check(Schema.isMaxLength(1_024)),\n record: Schema.Json,\n});\n\nexport type WorkerHistoryEntry = typeof WorkerHistoryEntry.Type;\n\n/**\n * Closed host-boundary failures. Original causes stay private and survive diagnostic transport.\n * Retained delivery states are successful MessageStatus values, including pending and refused.\n * After a storage failure, keep the same idempotency key and parameters when reconciling.\n */\nexport class WorkerError extends Schema.TaggedError<WorkerError>()(\"WorkerError\", {\n cause: Schema.optionalKey(FailureDiagnostic.Value),\n stack: Schema.optionalKey(Schema.String),\n /** Concurrency pressure may clear without changing the request. */\n retryable: Schema.optionalKey(Schema.Literal(true)),\n operation: Schema.Literals([\n \"context\",\n \"start\",\n \"followUp\",\n \"inspect\",\n \"observe\",\n \"await\",\n \"list\",\n \"cancel\",\n \"stop\",\n ]),\n reason: Schema.Literals([\n \"denied\",\n \"declaration-unavailable\",\n \"worker-mismatch\",\n \"receipt-mismatch\",\n \"message-mismatch\",\n \"idempotency-conflict\",\n \"capacity\",\n \"not-found\",\n // Decode earlier failures without emitting them for retained deliveries.\n \"delivery-pending\",\n \"storage\",\n \"corrupt\",\n \"unavailable\",\n ]),\n}) {}\n\nexport { WorkerOperationTool } from \"./SubagentContract.ts\";\n\n/** One projected canonical Run outcome. Joined receipts share this identity. */\nexport const WorkerReport = <Success extends Schema.Top>(success: Success) => {\n const identity = {\n _tag: Schema.Literal(\"Settled\"),\n worker: WorkerRef,\n receipt: Receipt,\n runId: RunId,\n settlementId: SettlementId,\n };\n\n return Schema.Union([\n // Union preserves the Success codec while making the result field required.\n Schema.Struct({\n ...identity,\n outcome: Schema.Literal(\"completed\"),\n result: Schema.Union([success]),\n }),\n Schema.Struct({\n ...identity,\n outcome: Schema.Literals([\"failed\", \"aborted\"]),\n failure: SubagentExecutionFailure,\n }),\n ]);\n};\n\nexport type WorkerReport<Success extends Schema.Top> = ReturnType<\n typeof WorkerReport<Success>\n>[\"Type\"];\n\n/** Framework message stored separately from the parent's application input. */\nexport const WorkerCompletion = Schema.Struct({\n _tag: Schema.Literal(\"WorkerCompletion\"),\n budgetExhausted: Schema.Boolean,\n schemaVersion: Schema.Literal(1),\n report: WorkerReport(Schema.Json),\n}).check(Schema.makeFilter(({ report }) => report.worker.threadId === report.receipt.threadId));\n\nexport type WorkerCompletion = typeof WorkerCompletion.Type;\n\n/** Source-worker intermediate output, kept separate from application input. */\nexport const WorkerUpdate = Schema.Struct({\n _tag: Schema.Literal(\"WorkerUpdate\"),\n schemaVersion: Schema.Literal(1),\n worker: WorkerRef,\n update: Update,\n}).check(\n Schema.makeFilter(\n ({ worker, update }) =>\n worker.threadId === update.threadId && worker.targetAgentId === update.agentId,\n ),\n);\n\nexport type WorkerUpdate = typeof WorkerUpdate.Type;\nexport const FrameworkMessage = Schema.Union([WorkerCompletion, WorkerUpdate]);\nexport type FrameworkMessage = typeof FrameworkMessage.Type;\n"],"mappings":";;;;;;;;;;AAMA,MAAa,aAAa,OAAO,OAAO;CAAE,eAAe;CAAU,WAAW;AAAe,CAAC;AAG9F,MAAM,SAAS,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;AAClE,MAAM,WAAW,EAAE,SAAS,WAAW;;;;;;;AAQvC,MAAa,gBAAgB,OAAO,MAAM;CACxC,OAAO,OAAO;EACZ,GAAG;EACH,QAAQ,OAAO,QAAQ,SAAS;EAChC,SAAS,OAAO;EAChB,YAAY,OAAO;EACnB,QAAQ,OAAO,OAAO,MAAM;CAC9B,CAAC;CACD,OAAO,OAAO;EACZ,GAAG;EACH,QAAQ,OAAO,QAAQ,UAAU;EACjC,SAAS;EACT,YAAY,OAAO;EACnB,QAAQ,OAAO,OAAO,MAAM;CAC9B,CAAC;CACD,OAAO,OAAO;EACZ,GAAG;EACH,QAAQ,OAA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GA,MAAa,mBAAmB,OAAO,MAAM,CAAC,kBAAkB,YAAY,CAAC"}
|
|
@@ -5,8 +5,14 @@ import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiag
|
|
|
5
5
|
import { t as AgentPolicy } from "./AgentPolicy-BqDoSXO6.mjs";
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
declare namespace Worker_d_exports {
|
|
8
|
-
export { FrameworkMessage, WorkerBudgetScope, WorkerCompletion, WorkerContext, WorkerError, WorkerHistoryEntry, WorkerOperationTool, WorkerPage, WorkerRef, WorkerReport, WorkerSource, WorkerStarted, WorkerSummary, WorkerUpdate };
|
|
8
|
+
export { AssignmentDisposition, AssignmentTerminal, FrameworkMessage, WorkerAppliedInput, WorkerBudgetScope, WorkerCompletion, WorkerContext, WorkerError, WorkerHistoryEntry, WorkerInput, WorkerOperationTool, WorkerPage, WorkerRef, WorkerReport, WorkerRun, WorkerSource, WorkerStarted, WorkerStop, WorkerStopped, WorkerSummary, WorkerUpdate };
|
|
9
9
|
}
|
|
10
|
+
/** Assignment output selected through the Definition's runDisposition declaration. */
|
|
11
|
+
declare const AssignmentDisposition: Schema.Literals<readonly ["completed", "waiting"]>;
|
|
12
|
+
type AssignmentDisposition = typeof AssignmentDisposition.Type;
|
|
13
|
+
/** A permanent destination outcome; an ordinary Run completion does not imply this. */
|
|
14
|
+
declare const AssignmentTerminal: Schema.Literals<readonly ["completed", "failed", "cancelled"]>;
|
|
15
|
+
type AssignmentTerminal = typeof AssignmentTerminal.Type;
|
|
10
16
|
/** A reusable child Thread, correlated with its declaration. This value grants no authority. */
|
|
11
17
|
declare const WorkerRef: Schema.Struct<{
|
|
12
18
|
readonly schemaVersion: Schema.Literal<1>;
|
|
@@ -74,6 +80,28 @@ declare const WorkerStarted: Schema.Struct<{
|
|
|
74
80
|
}>]>;
|
|
75
81
|
}>;
|
|
76
82
|
type WorkerStarted = typeof WorkerStarted.Type;
|
|
83
|
+
/** Stable owner command. Reusing its key for a different worker conflicts. */
|
|
84
|
+
declare const WorkerStop: Schema.Struct<{
|
|
85
|
+
readonly worker: Schema.Struct<{
|
|
86
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
87
|
+
readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
|
|
88
|
+
readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
89
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
90
|
+
}>;
|
|
91
|
+
readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
92
|
+
}>;
|
|
93
|
+
type WorkerStop = typeof WorkerStop.Type;
|
|
94
|
+
/** The inbox is sealed and active execution has released ownership. External actions are not undone. */
|
|
95
|
+
declare const WorkerStopped: Schema.Struct<{
|
|
96
|
+
readonly worker: Schema.Struct<{
|
|
97
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
98
|
+
readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
|
|
99
|
+
readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
100
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
101
|
+
}>;
|
|
102
|
+
readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
103
|
+
}>;
|
|
104
|
+
type WorkerStopped = typeof WorkerStopped.Type;
|
|
77
105
|
/** A host-authorized Run allowance is independent of the immutable delegation lineage. */
|
|
78
106
|
declare const WorkerBudgetScope: Schema.Literals<readonly ["source-subtree", "worker-run"]>;
|
|
79
107
|
type WorkerBudgetScope = typeof WorkerBudgetScope.Type;
|
|
@@ -108,6 +136,25 @@ declare const WorkerContext: Schema.Struct<{
|
|
|
108
136
|
readonly grant: Schema.optionalKey<typeof SubagentGrant>;
|
|
109
137
|
}>;
|
|
110
138
|
type WorkerContext = typeof WorkerContext.Type;
|
|
139
|
+
/** Admission identity is distinct from canonical input application. */
|
|
140
|
+
declare const WorkerInput: Schema.Struct<{
|
|
141
|
+
readonly receipt: typeof Receipt;
|
|
142
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
143
|
+
}>;
|
|
144
|
+
type WorkerInput = typeof WorkerInput.Type;
|
|
145
|
+
declare const WorkerAppliedInput: Schema.Struct<{
|
|
146
|
+
readonly receipt: typeof Receipt;
|
|
147
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
148
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
149
|
+
readonly sequence: Schema.Natural;
|
|
150
|
+
}>;
|
|
151
|
+
/** A Run outcome is not assignment completion. Interpret only a Definition's disposition. */
|
|
152
|
+
declare const WorkerRun: Schema.Struct<{
|
|
153
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
154
|
+
readonly hostReceipt: typeof Receipt;
|
|
155
|
+
readonly outcome: Schema.NullOr<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
|
|
156
|
+
readonly disposition: Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
157
|
+
}>;
|
|
111
158
|
/** Bounded durable listing data; a latest Receipt never substitutes for a requested Receipt. */
|
|
112
159
|
declare const WorkerSummary: Schema.Struct<{
|
|
113
160
|
readonly worker: Schema.Struct<{
|
|
@@ -117,7 +164,80 @@ declare const WorkerSummary: Schema.Struct<{
|
|
|
117
164
|
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
118
165
|
}>;
|
|
119
166
|
readonly latestReceipt: Schema.NullOr<typeof Receipt>;
|
|
120
|
-
|
|
167
|
+
/** stopping/stopped identify an owner-issued worker stop, never an ordinary Receipt abort. */
|
|
168
|
+
readonly state: Schema.Literals<readonly ["starting", "active", "idle", "stopping", "stopped", "completed", "failed", "cancelled"]>;
|
|
169
|
+
readonly acceptedInput: Schema.NullOr<Schema.Struct<{
|
|
170
|
+
readonly receipt: typeof Receipt;
|
|
171
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
172
|
+
}>>;
|
|
173
|
+
readonly appliedInput: Schema.NullOr<Schema.Struct<{
|
|
174
|
+
readonly receipt: typeof Receipt;
|
|
175
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
176
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
177
|
+
readonly sequence: Schema.Natural;
|
|
178
|
+
}>>;
|
|
179
|
+
readonly run: Schema.NullOr<Schema.Struct<{
|
|
180
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
181
|
+
readonly hostReceipt: typeof Receipt;
|
|
182
|
+
readonly outcome: Schema.NullOr<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
|
|
183
|
+
readonly disposition: Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
184
|
+
}>>;
|
|
185
|
+
/** One retained unadmitted input, if any; its state is independent of destination execution. */
|
|
186
|
+
readonly pendingDelivery: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
|
|
187
|
+
readonly message: Schema.Struct<{
|
|
188
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
189
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
190
|
+
}>;
|
|
191
|
+
readonly status: Schema.Literal<"pending">;
|
|
192
|
+
readonly receipt: Schema.Null;
|
|
193
|
+
readonly settlement: Schema.Null;
|
|
194
|
+
readonly reason: Schema.NullOr<Schema.NonEmptyString>;
|
|
195
|
+
}>, Schema.Struct<{
|
|
196
|
+
readonly message: Schema.Struct<{
|
|
197
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
198
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
199
|
+
}>;
|
|
200
|
+
readonly status: Schema.Literal<"accepted">;
|
|
201
|
+
readonly receipt: typeof Receipt;
|
|
202
|
+
readonly settlement: Schema.Null;
|
|
203
|
+
readonly reason: Schema.NullOr<Schema.NonEmptyString>;
|
|
204
|
+
}>, Schema.Struct<{
|
|
205
|
+
readonly message: Schema.Struct<{
|
|
206
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
207
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
208
|
+
}>;
|
|
209
|
+
readonly status: Schema.Literal<"processed">;
|
|
210
|
+
readonly receipt: typeof Receipt;
|
|
211
|
+
readonly settlement: Schema.Struct<{
|
|
212
|
+
readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
|
|
213
|
+
readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
|
|
214
|
+
}>;
|
|
215
|
+
readonly reason: Schema.Null;
|
|
216
|
+
}>, Schema.Struct<{
|
|
217
|
+
readonly message: Schema.Struct<{
|
|
218
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
219
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
220
|
+
}>;
|
|
221
|
+
readonly status: Schema.Literal<"refused">;
|
|
222
|
+
readonly receipt: Schema.Null;
|
|
223
|
+
readonly settlement: Schema.Null;
|
|
224
|
+
readonly reason: Schema.NonEmptyString;
|
|
225
|
+
}>, Schema.Struct<{
|
|
226
|
+
readonly message: Schema.Struct<{
|
|
227
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
228
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
229
|
+
}>;
|
|
230
|
+
readonly status: Schema.Literal<"parked">;
|
|
231
|
+
readonly receipt: Schema.NullOr<typeof Receipt>;
|
|
232
|
+
readonly settlement: Schema.Null;
|
|
233
|
+
readonly reason: Schema.NonEmptyString;
|
|
234
|
+
}>]>>;
|
|
235
|
+
/** Consistent destination facts; pending delivery has its own source-owned version. */
|
|
236
|
+
readonly watermark: Schema.Struct<{
|
|
237
|
+
readonly canonicalSequence: Schema.Natural;
|
|
238
|
+
readonly acceptedQueueSequence: Schema.Natural;
|
|
239
|
+
readonly pendingDeliveryVersion: Schema.NullOr<Schema.Natural>;
|
|
240
|
+
}>;
|
|
121
241
|
}>;
|
|
122
242
|
type WorkerSummary = typeof WorkerSummary.Type;
|
|
123
243
|
declare const WorkerPage: Schema.Struct<{
|
|
@@ -129,7 +249,80 @@ declare const WorkerPage: Schema.Struct<{
|
|
|
129
249
|
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
130
250
|
}>;
|
|
131
251
|
readonly latestReceipt: Schema.NullOr<typeof Receipt>;
|
|
132
|
-
|
|
252
|
+
/** stopping/stopped identify an owner-issued worker stop, never an ordinary Receipt abort. */
|
|
253
|
+
readonly state: Schema.Literals<readonly ["starting", "active", "idle", "stopping", "stopped", "completed", "failed", "cancelled"]>;
|
|
254
|
+
readonly acceptedInput: Schema.NullOr<Schema.Struct<{
|
|
255
|
+
readonly receipt: typeof Receipt;
|
|
256
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
257
|
+
}>>;
|
|
258
|
+
readonly appliedInput: Schema.NullOr<Schema.Struct<{
|
|
259
|
+
readonly receipt: typeof Receipt;
|
|
260
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
261
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
262
|
+
readonly sequence: Schema.Natural;
|
|
263
|
+
}>>;
|
|
264
|
+
readonly run: Schema.NullOr<Schema.Struct<{
|
|
265
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
266
|
+
readonly hostReceipt: typeof Receipt;
|
|
267
|
+
readonly outcome: Schema.NullOr<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
|
|
268
|
+
readonly disposition: Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
269
|
+
}>>;
|
|
270
|
+
/** One retained unadmitted input, if any; its state is independent of destination execution. */
|
|
271
|
+
readonly pendingDelivery: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
|
|
272
|
+
readonly message: Schema.Struct<{
|
|
273
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
274
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
275
|
+
}>;
|
|
276
|
+
readonly status: Schema.Literal<"pending">;
|
|
277
|
+
readonly receipt: Schema.Null;
|
|
278
|
+
readonly settlement: Schema.Null;
|
|
279
|
+
readonly reason: Schema.NullOr<Schema.NonEmptyString>;
|
|
280
|
+
}>, Schema.Struct<{
|
|
281
|
+
readonly message: Schema.Struct<{
|
|
282
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
283
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
284
|
+
}>;
|
|
285
|
+
readonly status: Schema.Literal<"accepted">;
|
|
286
|
+
readonly receipt: typeof Receipt;
|
|
287
|
+
readonly settlement: Schema.Null;
|
|
288
|
+
readonly reason: Schema.NullOr<Schema.NonEmptyString>;
|
|
289
|
+
}>, Schema.Struct<{
|
|
290
|
+
readonly message: Schema.Struct<{
|
|
291
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
292
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
293
|
+
}>;
|
|
294
|
+
readonly status: Schema.Literal<"processed">;
|
|
295
|
+
readonly receipt: typeof Receipt;
|
|
296
|
+
readonly settlement: Schema.Struct<{
|
|
297
|
+
readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
|
|
298
|
+
readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
|
|
299
|
+
}>;
|
|
300
|
+
readonly reason: Schema.Null;
|
|
301
|
+
}>, Schema.Struct<{
|
|
302
|
+
readonly message: Schema.Struct<{
|
|
303
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
304
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
305
|
+
}>;
|
|
306
|
+
readonly status: Schema.Literal<"refused">;
|
|
307
|
+
readonly receipt: Schema.Null;
|
|
308
|
+
readonly settlement: Schema.Null;
|
|
309
|
+
readonly reason: Schema.NonEmptyString;
|
|
310
|
+
}>, Schema.Struct<{
|
|
311
|
+
readonly message: Schema.Struct<{
|
|
312
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
313
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
314
|
+
}>;
|
|
315
|
+
readonly status: Schema.Literal<"parked">;
|
|
316
|
+
readonly receipt: Schema.NullOr<typeof Receipt>;
|
|
317
|
+
readonly settlement: Schema.Null;
|
|
318
|
+
readonly reason: Schema.NonEmptyString;
|
|
319
|
+
}>]>>;
|
|
320
|
+
/** Consistent destination facts; pending delivery has its own source-owned version. */
|
|
321
|
+
readonly watermark: Schema.Struct<{
|
|
322
|
+
readonly canonicalSequence: Schema.Natural;
|
|
323
|
+
readonly acceptedQueueSequence: Schema.Natural;
|
|
324
|
+
readonly pendingDeliveryVersion: Schema.NullOr<Schema.Natural>;
|
|
325
|
+
}>;
|
|
133
326
|
}>>;
|
|
134
327
|
readonly next: Schema.NullOr<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">>;
|
|
135
328
|
}>;
|
|
@@ -146,7 +339,7 @@ declare const WorkerError_base: Schema.Class<WorkerError, Schema.TaggedStruct<"W
|
|
|
146
339
|
readonly stack: Schema.optionalKey<Schema.String>;
|
|
147
340
|
/** Concurrency pressure may clear without changing the request. */
|
|
148
341
|
readonly retryable: Schema.optionalKey<Schema.Literal<true>>;
|
|
149
|
-
readonly operation: Schema.Literals<readonly ["context", "start", "followUp", "inspect", "observe", "await", "list", "cancel"]>;
|
|
342
|
+
readonly operation: Schema.Literals<readonly ["context", "start", "followUp", "inspect", "observe", "await", "list", "cancel", "stop"]>;
|
|
150
343
|
readonly reason: Schema.Literals<readonly ["denied", "declaration-unavailable", "worker-mismatch", "receipt-mismatch", "message-mismatch", "idempotency-conflict", "capacity", "not-found", "delivery-pending", "storage", "corrupt", "unavailable"]>;
|
|
151
344
|
}>, import("effect/Cause").YieldableError>;
|
|
152
345
|
/**
|
|
@@ -275,5 +468,5 @@ declare const FrameworkMessage: Schema.Union<readonly [Schema.Struct<{
|
|
|
275
468
|
}>]>;
|
|
276
469
|
type FrameworkMessage = typeof FrameworkMessage.Type;
|
|
277
470
|
//#endregion
|
|
278
|
-
export {
|
|
279
|
-
//# sourceMappingURL=Worker-
|
|
471
|
+
export { WorkerStop as _, WorkerBudgetScope as a, WorkerUpdate as b, WorkerError as c, WorkerPage as d, WorkerRef as f, WorkerStarted as g, WorkerSource as h, WorkerAppliedInput as i, WorkerHistoryEntry as l, WorkerRun as m, AssignmentTerminal as n, WorkerCompletion as o, WorkerReport as p, FrameworkMessage as r, WorkerContext as s, AssignmentDisposition as t, WorkerInput as u, WorkerStopped as v, Worker_d_exports as x, WorkerSummary as y };
|
|
472
|
+
//# sourceMappingURL=Worker-fwWkBg12.d.mts.map
|
|
@@ -89,13 +89,13 @@ const capture = (agent, attemptLayer) => Effect.map(Effect.context().pipe(Effect
|
|
|
89
89
|
* version declarations should use `compileRegistrations`; low-level fixtures
|
|
90
90
|
* may supply a previously computed digest triple directly.
|
|
91
91
|
*/
|
|
92
|
-
const DurableWorkerBinding = { make: (agent, digests
|
|
92
|
+
const DurableWorkerBinding = { make: (agent, digests) => Effect.gen(function* () {
|
|
93
93
|
const binding = yield* capture(agent);
|
|
94
|
-
const
|
|
94
|
+
const reporting = yield* captureReporting(backgroundReports(agent.definition));
|
|
95
95
|
return {
|
|
96
96
|
...binding,
|
|
97
97
|
digests,
|
|
98
|
-
reporting
|
|
98
|
+
reporting
|
|
99
99
|
};
|
|
100
100
|
}) };
|
|
101
101
|
/** INTERNAL identity-only capture retained for the legacy direct worker path. */
|
|
@@ -143,8 +143,8 @@ const registrationDefinitions = (entry) => {
|
|
|
143
143
|
backgroundReporting: automatic.map((report) => ({
|
|
144
144
|
delegationId: report.delegationId,
|
|
145
145
|
targetAgentId: report.target.id,
|
|
146
|
-
mode:
|
|
147
|
-
destinationDelegationId:
|
|
146
|
+
mode: "standard",
|
|
147
|
+
destinationDelegationId: null
|
|
148
148
|
}))
|
|
149
149
|
}
|
|
150
150
|
};
|
|
@@ -183,7 +183,7 @@ const compileRegistration = (entry) => Effect.flatMap(Effect.try({
|
|
|
183
183
|
definition: entry.agent,
|
|
184
184
|
model: entry.model
|
|
185
185
|
}, entry.attemptLayer);
|
|
186
|
-
const reporting = yield* captureReporting(
|
|
186
|
+
const reporting = yield* captureReporting(backgroundReports(binding.definition));
|
|
187
187
|
return {
|
|
188
188
|
...binding,
|
|
189
189
|
...yield* compileBindingContracts(binding.definition, definitions, entry.continuity?.versions),
|
|
@@ -198,4 +198,4 @@ const compileRegistrations = (entries) => {
|
|
|
198
198
|
//#endregion
|
|
199
199
|
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 };
|
|
200
200
|
|
|
201
|
-
//# sourceMappingURL=agent-registration-
|
|
201
|
+
//# sourceMappingURL=agent-registration-CKNsrpwo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-registration-CKNsrpwo.mjs","names":["run"],"sources":["../src/durable/internal/agent-registration.ts"],"sourcesContent":["import {\n type Crypto,\n type Option,\n type Scope,\n Context,\n Effect,\n Layer,\n References,\n Schema,\n Tracer,\n} 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\n// Registrations outlive their construction span. Dependencies remain captured,\n// while every attempt/report inherits the invoking fiber's tracing state.\nconst omitTraceContext = Context.omit(\n Tracer.ParentSpan,\n Tracer.Tracer,\n Tracer.MinimumTraceLevel,\n Tracer.CurrentTraceLevel,\n References.TracerEnabled,\n References.TracerTimingEnabled,\n References.TracerSpanAnnotations,\n References.TracerSpanLinks,\n);\n\n// R describes captured application services; ParentSpan is supplied by the\n// live invocation rather than stored as a registration dependency.\nconst withoutTraceContext = <R>(context: Context.Context<R>): Context.Context<R> =>\n omitTraceContext(context) as Context.Context<R>;\n\nconst captureReporting = <R>(reports: ReadonlyArray<WorkerReporting<unknown, R>>) =>\n Effect.map(\n Effect.context<Exclude<R, Scope.Scope>>().pipe(Effect.map(withoutTraceContext)),\n (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>().pipe(\n Effect.map(withoutTraceContext),\n ),\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: <A extends ExecutableAgentBinding>(\n agent: A,\n digests: DefinitionDigests,\n ): Effect.Effect<ResolvedBinding, never, DurableWorkerRequirements<A>> =>\n Effect.gen(function* () {\n const binding = yield* capture(agent);\n const reporting = yield* captureReporting(backgroundReports(agent.definition));\n\n return { ...binding, digests, reporting };\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 * 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 ? AttemptLayerRequirements<\n EntryWorkerRequirements<Entry>,\n \"attemptLayer\" extends keyof Entry ? Entry[\"attemptLayer\"] : undefined\n >\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: \"standard\",\n // Preserve the fingerprint of existing standard registrations.\n destinationDelegationId: 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(backgroundReports(binding.definition));\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":";;;;;;;;;;;;AA4CA,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,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WAAW,QAAQ,IAAI,KAAK,aAAa,aAAa,KAAK;KAC3D,8BAA8B,QAAQ,IAAI,KAAK,aAAa,4BAA4B;KACxF,YAAY,QAAQ,IAAI,KAAK,aAAa,qBAAqB,CAAC,CAAC,KAAK,WAAW;MAC/E,MAAM,MAAM,KAAK;MACjB,WAAW,MAAM;MACjB,QAAQ,MAAM;KAChB,EAAE;IACJ,EAAE;GACJ;EACF;CACF;AACF;AAEA,MAAM,uBACJ,UAEA,OAAO,QACL,OAAO,IAAI;CACT,WAAW,wBAAwB,KAAK;CACxC,aACE,YAAY,KAAK,EAAE,SAAS,wDAAwD,CAAC;AACzF,CAAC,IACA,gBACC,OAAO,IAAI,aAAa;CACtB,MAAM,UAAU,OAAO,QACrB,MAAM,UAAU,KAAA,IAAY,MAAM,QAAQ;EAAE,YAAY,MAAM;EAAO,OAAO,MAAM;CAAM,GACxF,MAAM,YACR;CAEA,MAAM,YAAY,OAAO,iBAAiB,kBAAkB,QAAQ,UAAU,CAAC;CAE/E,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-CSBsSj0X.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 };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as MessageAdmission, c as MessageRef, i as MessageAddress, l as MessageStatus, n as InboxPage, o as MessagingError, r as InputMessage, s as PeerName, t as InboxEntry } from "../Messaging-Dkg87ebg.mjs";
|
|
2
|
-
import { a as inspect, c as reply, d as retryTool, f as send, i as inboxTool, l as replyTool, n as Peer, o as inspectTool, p as sendTool, r as inbox, s as peer, u as retry } from "../Messaging-
|
|
2
|
+
import { a as inspect, c as reply, d as retryTool, f as send, i as inboxTool, l as replyTool, n as Peer, o as inspectTool, p as sendTool, r as inbox, s as peer, u as retry } from "../Messaging-JYYN3oYS.mjs";
|
|
3
3
|
export { InboxEntry, InboxPage, InputMessage, MessageAddress, MessageAdmission, MessageRef, MessageStatus, MessagingError, Peer, PeerName, inbox, inboxTool, inspect, inspectTool, peer, reply, replyTool, retry, retryTool, send, sendTool };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { IdempotencyKey } from "../core/Receipt.mjs";
|
|
3
3
|
import { WorkerOperationTool } from "../core/SubagentContract.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { c as InboxPage, d as MessageAdmission, f as MessagingError, l as InputMessage, p as PeerName, s as InboxEntry, t as MessagingHost, u as MessageAddress } from "../MessagingHost-
|
|
4
|
+
import { C as MessageStatus, S as MessageRef } from "../Worker-CfwzMZEK.mjs";
|
|
5
|
+
import { c as InboxPage, d as MessageAdmission, f as MessagingError, l as InputMessage, p as PeerName, s as InboxEntry, t as MessagingHost, u as MessageAddress } from "../MessagingHost-DfsbMPvq.mjs";
|
|
6
6
|
import { t as utf8Bytes } from "../utf8-BYfhEkcj.mjs";
|
|
7
7
|
import { Tool, Toolkit } from "effect/unstable/ai";
|
|
8
8
|
import { Crypto, Effect, Encoding, Option, Schema } from "effect";
|
|
@@ -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-CSBsSj0X.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
|
-
import {
|
|
3
|
-
import { A as
|
|
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,
|
|
2
|
+
import { o as WorkerCompletion, p as WorkerReport } from "../Worker-fwWkBg12.mjs";
|
|
3
|
+
import { A as inspect, B as delegationCapsFromPolicy, C as BackgroundOptions, D as awaitWorker, E as WorkerObservation, F as SubagentPolicy, I as SubagentPolicyInput, L as SubagentPrestartDenied, M as observe, N as start, O as cancel, P as stop, R as SubagentProjectionFailure, S as make, T as Worker, _ 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 list, k as followUp, 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 BackgroundTools, x as layer, y as background, z as delegationAllocationFromPolicy } from "../Subagent-gw9KD6eb.mjs";
|
|
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, start, stop };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SubagentExecutionFailure, SubagentExecutionFailureClassification, SubagentGrant } from "../core/SubagentContract.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { o as WorkerCompletion, p as WorkerReport } from "../Worker-CfwzMZEK.mjs";
|
|
3
3
|
import "./SubagentReservations.mjs";
|
|
4
|
-
import {
|
|
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,
|
|
4
|
+
import { S as delegationCapsFromPolicy, _ as stop, a as define, b as SubagentProjectionFailure, 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 SubagentPolicy, x as delegationAllocationFromPolicy, y as SubagentPrestartDenied } from "../Subagent-Di8EEjWZ.mjs";
|
|
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, start, stop };
|
package/dist/core/Agent.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as ToolUnion, C as OutputSchema, D as RunDispositionFailure, E as RunDispositionDeclaration, F as isModelResolver, I as make, L as withModel, M as Update, N as UpdatesSchema, O as RunDispositionSchema, P as inspectTools, S as Output, T as RunDisposition, _ as InstructionSource, a as CompletionFromToolDeclaration, b as Name, c as Definition, d as EncodedInput, f as Failure, g as InstructionResult, h as InputSchema, i as Binding, j as Tools, k as ToolInspection, l as DefinitionOptions, m as InputPromptSource, n as Any, o as CompletionProjectionInput, p as Input, r as AnyDefinition, s as CompletionToolDeclaration, u as DefinitionRequirements, v as ModelResolver, w as Requirements, x as NativeModel, y as ModelServices } from "../Agent-
|
|
1
|
+
import { A as ToolUnion, C as OutputSchema, D as RunDispositionFailure, E as RunDispositionDeclaration, F as isModelResolver, I as make, L as withModel, M as Update, N as UpdatesSchema, O as RunDispositionSchema, P as inspectTools, S as Output, T as RunDisposition, _ as InstructionSource, a as CompletionFromToolDeclaration, b as Name, c as Definition, d as EncodedInput, f as Failure, g as InstructionResult, h as InputSchema, i as Binding, j as Tools, k as ToolInspection, l as DefinitionOptions, m as InputPromptSource, n as Any, o as CompletionProjectionInput, p as Input, r as AnyDefinition, s as CompletionToolDeclaration, u as DefinitionRequirements, v as ModelResolver, w as Requirements, x as NativeModel, y as ModelServices } from "../Agent-D9cXqfF3.mjs";
|
|
2
2
|
export { Any, AnyDefinition, Binding, CompletionFromToolDeclaration, CompletionProjectionInput, CompletionToolDeclaration, Definition, DefinitionOptions, DefinitionRequirements, EncodedInput, Failure, Input, InputPromptSource, InputSchema, InstructionResult, InstructionSource, ModelResolver, ModelServices, Name, NativeModel, Output, OutputSchema, Requirements, RunDisposition, RunDispositionDeclaration, RunDispositionFailure, RunDispositionSchema, ToolInspection, ToolUnion, Tools, Update, UpdatesSchema, inspectTools, isModelResolver, make, withModel };
|
package/dist/core/Worker.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { p as WorkerOperationTool } from "../SubagentContract-DdT7Cqe6.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
export { FrameworkMessage, WorkerBudgetScope, WorkerCompletion, WorkerContext, WorkerError, WorkerHistoryEntry, WorkerOperationTool, WorkerPage, WorkerRef, WorkerReport, WorkerSource, WorkerStarted, WorkerSummary, WorkerUpdate };
|
|
2
|
+
import { _ as WorkerStop, a as WorkerBudgetScope, b as WorkerUpdate, c as WorkerError, d as WorkerPage, f as WorkerRef, g as WorkerStarted, h as WorkerSource, i as WorkerAppliedInput, l as WorkerHistoryEntry, m as WorkerRun, n as AssignmentTerminal, o as WorkerCompletion, p as WorkerReport, r as FrameworkMessage, s as WorkerContext, t as AssignmentDisposition, u as WorkerInput, v as WorkerStopped, y as WorkerSummary } from "../Worker-fwWkBg12.mjs";
|
|
3
|
+
export { AssignmentDisposition, AssignmentTerminal, FrameworkMessage, WorkerAppliedInput, WorkerBudgetScope, WorkerCompletion, WorkerContext, WorkerError, WorkerHistoryEntry, WorkerInput, WorkerOperationTool, WorkerPage, WorkerRef, WorkerReport, WorkerRun, WorkerSource, WorkerStarted, WorkerStop, WorkerStopped, WorkerSummary, WorkerUpdate };
|
package/dist/core/Worker.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { WorkerOperationTool } from "./SubagentContract.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
export { FrameworkMessage, WorkerBudgetScope, WorkerCompletion, WorkerContext, WorkerError, WorkerHistoryEntry, WorkerOperationTool, WorkerPage, WorkerRef, WorkerReport, WorkerSource, WorkerStarted, WorkerSummary, WorkerUpdate };
|
|
2
|
+
import { _ as WorkerStop, a as WorkerBudgetScope, b as WorkerUpdate, c as WorkerError, d as WorkerPage, f as WorkerRef, g as WorkerStarted, h as WorkerSource, i as WorkerAppliedInput, l as WorkerHistoryEntry, m as WorkerRun, n as AssignmentTerminal, o as WorkerCompletion, p as WorkerReport, r as FrameworkMessage, s as WorkerContext, t as AssignmentDisposition, u as WorkerInput, v as WorkerStopped, y as WorkerSummary } from "../Worker-CfwzMZEK.mjs";
|
|
3
|
+
export { AssignmentDisposition, AssignmentTerminal, FrameworkMessage, WorkerAppliedInput, WorkerBudgetScope, WorkerCompletion, WorkerContext, WorkerError, WorkerHistoryEntry, WorkerInput, WorkerOperationTool, WorkerPage, WorkerRef, WorkerReport, WorkerRun, WorkerSource, WorkerStarted, WorkerStop, WorkerStopped, WorkerSummary, WorkerUpdate };
|