effect-agent 0.1.0-beta.96 → 0.1.0-beta.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AgentRuntime-B64362Id.d.mts → AgentRuntime-BMzrJos6.d.mts} +2 -2
- package/dist/{AgentRuntime-Cdvqw7l_.mjs → AgentRuntime-BWOnNc0d.mjs} +78 -42
- package/dist/AgentRuntime-BWOnNc0d.mjs.map +1 -0
- package/dist/{DurableAgentRuntime-BGwGUIT-.mjs → DurableAgentRuntime-gF4YiEj2.mjs} +485 -262
- package/dist/DurableAgentRuntime-gF4YiEj2.mjs.map +1 -0
- package/dist/{DurableFailpoint-DQJet828.d.mts → DurableFailpoint-mx3-nsxU.d.mts} +3 -3
- package/dist/{EventSource-tCO_dAff.d.mts → EventSource-BZ73J0s5.d.mts} +3 -3
- package/dist/{PreparedInputAdmission-CFSddiT8.d.mts → PreparedInputAdmission-BkeI-Xvr.d.mts} +4 -4
- package/dist/{Records-CMByd1eD.d.mts → Records-BIiRLqlz.d.mts} +93 -101
- package/dist/{Records-BEz5IFUu.mjs → Records-DR1xtbXY.mjs} +36 -7
- package/dist/Records-DR1xtbXY.mjs.map +1 -0
- package/dist/{RunJournal-B_fxe57c.mjs → RunJournal-DNs3PM4K.mjs} +80 -23
- package/dist/RunJournal-DNs3PM4K.mjs.map +1 -0
- package/dist/{RunOptions-Clj8cLsp.d.mts → RunOptions-Bruk54SE.d.mts} +13 -4
- package/dist/{Schedule-BxCfnYr0.d.mts → Schedule-BNFlluAl.d.mts} +2 -2
- package/dist/{Scheduling-BW6BD_TP.mjs → Scheduling-HFH0pST1.mjs} +2 -2
- package/dist/{Scheduling-BW6BD_TP.mjs.map → Scheduling-HFH0pST1.mjs.map} +1 -1
- package/dist/{Subagent-Cbfzylz1.mjs → Subagent-C2s8PFrd.mjs} +2 -2
- package/dist/{Subagent-Cbfzylz1.mjs.map → Subagent-C2s8PFrd.mjs.map} +1 -1
- package/dist/{Subagent-Bm1dRecN.d.mts → Subagent-m7ywTCe4.d.mts} +3 -3
- package/dist/{Subscription-CrTIQKZR.d.mts → Subscription-BCQ3L9Zp.d.mts} +3 -3
- package/dist/{SubscriptionInput-BVOeFF1L.d.mts → SubscriptionInput-Cqu4_RW3.d.mts} +3 -3
- package/dist/{ToolReconciler-DQVaJfpE.d.mts → ToolReconciler-BmVRAHKs.d.mts} +8 -4
- package/dist/{agent-registration-BTa5vmQF.mjs → agent-registration-cXpB8cBU.mjs} +40 -95
- package/dist/agent-registration-cXpB8cBU.mjs.map +1 -0
- package/dist/capabilities/Commands.d.mts +1 -1
- package/dist/capabilities/RunHooks.d.mts +1 -1
- package/dist/capabilities/Subagent.d.mts +1 -1
- package/dist/capabilities/Subagent.mjs +1 -1
- package/dist/durable/ActivityStore.d.mts +1 -1
- package/dist/durable/ActivityStore.mjs +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/Admin.mjs +12 -10
- package/dist/durable/Admin.mjs.map +1 -1
- package/dist/durable/AgentRegistration.d.mts +2 -2
- package/dist/durable/AgentRegistration.mjs +4 -7
- package/dist/durable/AgentRegistration.mjs.map +1 -1
- package/dist/durable/Certification.d.mts +2 -2
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/CommittedActivity.mjs +1 -1
- package/dist/durable/Digest.d.mts +1 -1
- package/dist/durable/Digest.mjs +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +1 -1
- package/dist/durable/DurableFailpoint.d.mts +1 -1
- package/dist/durable/DurableFailpoint.mjs +2 -0
- package/dist/durable/DurableFailpoint.mjs.map +1 -1
- package/dist/durable/DurableFailpointTestControl.d.mts +1 -1
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/EventSource.mjs +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
- package/dist/durable/GitHubWorkflowSource.mjs +1 -1
- package/dist/durable/MessageDelivery.d.mts +3 -3
- package/dist/durable/MessageDelivery.mjs +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
- package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PersistentHistory.mjs +2 -2
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +2 -2
- package/dist/durable/Records.mjs +2 -2
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/Recovery.mjs +9 -9
- package/dist/durable/Recovery.mjs.map +1 -1
- package/dist/durable/RunJournal.d.mts +2 -2
- package/dist/durable/RunJournal.mjs +2 -2
- package/dist/durable/Schedule.d.mts +1 -1
- package/dist/durable/Schedule.mjs +1 -1
- package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
- package/dist/durable/ScheduleStoreConformance.mjs +1 -1
- package/dist/durable/ScheduleTransition.d.mts +1 -1
- package/dist/durable/ScheduleTransition.mjs +1 -1
- package/dist/durable/Scheduling.d.mts +2 -2
- package/dist/durable/Scheduling.mjs +1 -1
- package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
- package/dist/durable/SqlStorageV2Upgrade.mjs +1 -1
- package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
- package/dist/durable/SqlSubscriptionStore.mjs +1 -1
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedger.mjs +14 -13
- package/dist/durable/SubmissionLedger.mjs.map +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +9 -2
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -1
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/Subscription.mjs +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionInput.mjs +2 -2
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
- package/dist/durable/SubscriptionTools.d.mts +3 -3
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/SubscriptionTransition.mjs +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/Subscriptions.mjs +1 -1
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistory.mjs +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
- package/dist/durable/ThreadInvariants.d.mts +4 -2
- package/dist/durable/ThreadInvariants.mjs +49 -3
- package/dist/durable/ThreadInvariants.mjs.map +1 -1
- package/dist/durable/ThreadProjection.d.mts +1 -1
- package/dist/durable/ThreadProjection.mjs +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadStore.d.mts +1 -1
- package/dist/durable/ThreadStore.mjs +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/ThreadStoreConformance.mjs +1 -1
- package/dist/durable/ToolReconciler.d.mts +1 -1
- package/dist/durable/ToolReconciler.mjs +9 -5
- package/dist/durable/ToolReconciler.mjs.map +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- package/dist/engine/AgentRuntime.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/engine/RunOptions.d.mts +1 -1
- package/dist/engine/RunOptions.mjs.map +1 -1
- package/dist/index.d.mts +11 -11
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
- package/src/durable/Admin.ts +20 -11
- package/src/durable/AgentRegistration.ts +1 -4
- package/src/durable/DurableAgentRuntime.ts +936 -462
- package/src/durable/DurableFailpoint.ts +2 -0
- package/src/durable/Records.ts +31 -4
- package/src/durable/Recovery.ts +8 -8
- package/src/durable/RunJournal.ts +128 -51
- package/src/durable/SubmissionLedger.ts +13 -12
- package/src/durable/SubmissionLedgerConformance.ts +13 -2
- package/src/durable/ThreadInvariants.ts +70 -5
- package/src/durable/ToolReconciler.ts +7 -3
- package/src/durable/internal/agent-registration.ts +77 -188
- package/src/durable/internal/messaging-host.ts +1 -6
- package/src/durable/internal/worker-host.ts +88 -116
- package/src/engine/RunOptions.ts +13 -3
- package/src/engine/internal/agent-runtime.ts +160 -106
- package/dist/AgentRuntime-Cdvqw7l_.mjs.map +0 -1
- package/dist/DurableAgentRuntime-BGwGUIT-.mjs.map +0 -1
- package/dist/Records-BEz5IFUu.mjs.map +0 -1
- package/dist/RunJournal-B_fxe57c.mjs.map +0 -1
- package/dist/agent-registration-BTa5vmQF.mjs.map +0 -1
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ToolNamespace,
|
|
19
19
|
} from "../../core/ToolExposure.ts";
|
|
20
20
|
import { type RuntimeBinding } from "../../engine/AgentRuntime.ts";
|
|
21
|
+
import { ContextRolloverTool } from "../../engine/ContextWindow.ts";
|
|
21
22
|
import { getToolExecutionClass } from "../../engine/DurableStep.ts";
|
|
22
23
|
import {
|
|
23
24
|
BackgroundReporting,
|
|
@@ -26,44 +27,19 @@ import {
|
|
|
26
27
|
} from "../../engine/SubagentHost.ts";
|
|
27
28
|
import { digestDefinitions, digestJson, DigestError } from "../Digest.ts";
|
|
28
29
|
import type { DurableWorkerFailure, DurableWorkerRequirements } from "../DurableAgentRuntime.ts";
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
DefinitionDigests,
|
|
32
|
-
ReplayContract,
|
|
33
|
-
type PersistedJson,
|
|
34
|
-
} from "../Records.ts";
|
|
30
|
+
import type { DefinitionDigestInput, PersistedJson } from "../Records.ts";
|
|
31
|
+
import { DefinitionDigests, ReplayContract } from "../Records.ts";
|
|
35
32
|
import type { Claim, Settlement } from "../SubmissionLedger.ts";
|
|
36
33
|
|
|
37
|
-
/**
|
|
38
|
-
* No Agent Binding is registered for the requested stable identity. Recovery
|
|
39
|
-
* fails closed: it never substitutes the latest Binding or runs different
|
|
40
|
-
* code.
|
|
41
|
-
*/
|
|
34
|
+
/** No unique current executable is registered for the stable Agent identity. */
|
|
42
35
|
export class BindingUnavailable extends Schema.TaggedError<BindingUnavailable>()(
|
|
43
36
|
"BindingUnavailable",
|
|
44
|
-
{
|
|
45
|
-
agentId: AgentId,
|
|
46
|
-
message: Schema.String,
|
|
47
|
-
},
|
|
48
|
-
) {}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* A Binding is registered for the identity but neither the exact admission fingerprints
|
|
52
|
-
* nor its declared replay contract support the retained pending operations. Refusal leaves
|
|
53
|
-
* the original Submission pending until compatible code is available.
|
|
54
|
-
*/
|
|
55
|
-
export class BindingDigestMismatch extends Schema.TaggedError<BindingDigestMismatch>()(
|
|
56
|
-
"BindingDigestMismatch",
|
|
57
|
-
{
|
|
58
|
-
agentId: AgentId,
|
|
59
|
-
message: Schema.String,
|
|
60
|
-
},
|
|
37
|
+
{ agentId: AgentId, message: Schema.String },
|
|
61
38
|
) {}
|
|
62
39
|
|
|
63
|
-
|
|
64
|
-
export type DurableBindingFailure = BindingUnavailable | BindingDigestMismatch;
|
|
40
|
+
export type DurableBindingFailure = BindingUnavailable;
|
|
65
41
|
|
|
66
|
-
/**
|
|
42
|
+
/** Exact immutable admission, lineage and delivery evidence; never an executable-code gate. */
|
|
67
43
|
export const definitionDigestsEqual = (
|
|
68
44
|
left: DefinitionDigests,
|
|
69
45
|
right: DefinitionDigests,
|
|
@@ -73,67 +49,35 @@ export const definitionDigestsEqual = (
|
|
|
73
49
|
left.tools === right.tools &&
|
|
74
50
|
Schema.toEquivalence(Schema.UndefinedOr(ReplayContract))(left.replay, right.replay);
|
|
75
51
|
|
|
76
|
-
/**
|
|
77
|
-
* Host-owned semantic versions, independent of deployment and tool inventory. Change a version
|
|
78
|
-
* when the meaning of an operation, its durable Step names or external idempotency keys changes.
|
|
79
|
-
* Codecs and execution class are included automatically; JSON Schema alone cannot prove semantics.
|
|
80
|
-
*/
|
|
52
|
+
/** Change an operation version when its meaning, durable Steps or idempotency keys change. */
|
|
81
53
|
export interface ReplayVersions {
|
|
82
|
-
readonly agent: PersistedJson;
|
|
83
54
|
readonly tools: Readonly<Record<string, PersistedJson>>;
|
|
84
55
|
}
|
|
85
56
|
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
* manifest from the original release for work admitted before replay contracts were retained.
|
|
89
|
-
* Its original declarations must hash to that admission; a bare old digest is not a manifest.
|
|
90
|
-
*/
|
|
91
|
-
export class BindingManifest extends Schema.Class<BindingManifest>("BindingManifest")({
|
|
92
|
-
agentId: AgentId,
|
|
93
|
-
definitions: DefinitionDigestInput,
|
|
94
|
-
replay: ReplayContract,
|
|
95
|
-
}) {}
|
|
96
|
-
|
|
97
|
-
export const makeBindingManifest = Effect.fn("AgentRegistration.makeBindingManifest")(function* (
|
|
57
|
+
/** Hash current operation contracts; no historical definitions or schemas are retained. */
|
|
58
|
+
export const toolReplayContracts = Effect.fn("AgentRegistration.toolReplayContracts")(function* (
|
|
98
59
|
definition: Agent.AnyDefinition,
|
|
99
|
-
|
|
100
|
-
|
|
60
|
+
versions?: ReplayVersions,
|
|
61
|
+
fallbackVersion: PersistedJson = null,
|
|
101
62
|
) {
|
|
102
|
-
const
|
|
103
|
-
Schema.decodeUnknownSync(Schema.Json)(Tool.getJsonSchemaFromSchema(schema));
|
|
104
|
-
|
|
105
|
-
const contracts = yield* Effect.try({
|
|
63
|
+
const declarations = yield* Effect.try({
|
|
106
64
|
try: () => {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
version
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
definition.completion === undefined
|
|
121
|
-
? null
|
|
122
|
-
: {
|
|
123
|
-
tool: definition.completion.tool,
|
|
124
|
-
required: definition.completion.required ?? false,
|
|
125
|
-
},
|
|
126
|
-
completionFromTools:
|
|
127
|
-
definition.completionFromTools?.map((entry) => entry.tool).sort() ?? [],
|
|
128
|
-
disposition:
|
|
129
|
-
definition.runDisposition === undefined
|
|
130
|
-
? null
|
|
131
|
-
: jsonSchema(definition.runDisposition.schema),
|
|
132
|
-
},
|
|
133
|
-
tools: tools.map((tool) => ({
|
|
65
|
+
const jsonSchema = (schema: Schema.Top) =>
|
|
66
|
+
Schema.decodeUnknownSync(Schema.Json)(Tool.getJsonSchemaFromSchema(schema));
|
|
67
|
+
|
|
68
|
+
return Object.values(definition.toolkit.tools).map((tool) => {
|
|
69
|
+
const version = versions === undefined ? fallbackVersion : versions.tools[tool.name];
|
|
70
|
+
|
|
71
|
+
if (
|
|
72
|
+
version === undefined ||
|
|
73
|
+
(versions !== undefined && !Object.hasOwn(versions.tools, tool.name))
|
|
74
|
+
)
|
|
75
|
+
throw new Error("Every Tool needs an explicit replay semantic version");
|
|
76
|
+
|
|
77
|
+
return {
|
|
134
78
|
name: tool.name,
|
|
135
79
|
contract: {
|
|
136
|
-
version
|
|
80
|
+
version,
|
|
137
81
|
parameters: jsonSchema(tool.parametersSchema),
|
|
138
82
|
success: jsonSchema(tool.successSchema),
|
|
139
83
|
failure: jsonSchema(tool.failureSchema),
|
|
@@ -142,59 +86,47 @@ export const makeBindingManifest = Effect.fn("AgentRegistration.makeBindingManif
|
|
|
142
86
|
typeof tool.needsApproval === "function" ? "dynamic" : (tool.needsApproval ?? false),
|
|
143
87
|
executionClass: getToolExecutionClass(tool),
|
|
144
88
|
executionKind: getToolExecutionKind(tool.annotations),
|
|
89
|
+
contextRollover: Context.get(tool.annotations, ContextRolloverTool),
|
|
90
|
+
completion: definition.completion?.tool === tool.name,
|
|
91
|
+
completionFromTool:
|
|
92
|
+
definition.completionFromTools?.some(
|
|
93
|
+
(declaration) => declaration.tool === tool.name,
|
|
94
|
+
) ?? false,
|
|
145
95
|
},
|
|
146
|
-
}
|
|
147
|
-
};
|
|
96
|
+
};
|
|
97
|
+
});
|
|
148
98
|
},
|
|
149
99
|
catch: () =>
|
|
150
100
|
DigestError.make({
|
|
151
|
-
message:
|
|
152
|
-
"Replay contracts require serializable codecs and an explicit semantic version for every Tool",
|
|
101
|
+
message: "Operation contracts require serializable codecs and a version for every Tool",
|
|
153
102
|
}),
|
|
154
103
|
});
|
|
155
104
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
105
|
+
return Object.fromEntries(
|
|
106
|
+
yield* Effect.forEach(declarations, ({ name, contract }) =>
|
|
107
|
+
digestJson(contract).pipe(Effect.map((digest) => [name, digest] as const)),
|
|
108
|
+
),
|
|
160
109
|
);
|
|
161
|
-
|
|
162
|
-
return BindingManifest.make({
|
|
163
|
-
agentId: definition.id,
|
|
164
|
-
definitions,
|
|
165
|
-
replay: ReplayContract.make({ agent, tools: Object.fromEntries(tools) }),
|
|
166
|
-
});
|
|
167
110
|
});
|
|
168
111
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const retained =
|
|
188
|
-
digests.replay ??
|
|
189
|
-
binding.retainedManifests?.find((entry) => definitionDigestsEqual(entry.digests, digests))
|
|
190
|
-
?.replay;
|
|
191
|
-
|
|
192
|
-
return (
|
|
193
|
-
binding.digests.replay !== undefined &&
|
|
194
|
-
retained !== undefined &&
|
|
195
|
-
replaySupports(binding.digests.replay, retained, requiredTools)
|
|
196
|
-
);
|
|
197
|
-
};
|
|
112
|
+
/** Compile current metadata without acquiring executable services. */
|
|
113
|
+
export const compileBindingContracts = Effect.fn("AgentRegistration.compileBindingContracts")(
|
|
114
|
+
function* (
|
|
115
|
+
definition: Agent.AnyDefinition,
|
|
116
|
+
definitions: DefinitionDigestInput,
|
|
117
|
+
versions?: ReplayVersions,
|
|
118
|
+
): Effect.fn.Return<Pick<ResolvedBinding, "digests">, DigestError, Crypto.Crypto> {
|
|
119
|
+
const digests = yield* digestDefinitions(definitions);
|
|
120
|
+
const tools = yield* toolReplayContracts(definition, versions, definitions.tools);
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
digests: DefinitionDigests.make({
|
|
124
|
+
...digests,
|
|
125
|
+
replay: ReplayContract.make({ agent: digests.agent, tools }),
|
|
126
|
+
}),
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
);
|
|
198
130
|
|
|
199
131
|
type ExecutableDefinition = Agent.AnyDefinition & {
|
|
200
132
|
readonly instructions: InstructionSource<never, unknown, unknown>;
|
|
@@ -326,11 +258,6 @@ const backgroundReports = (definition: Agent.AnyDefinition) => [
|
|
|
326
258
|
/** One exact executable registration used by durable claim-time resolution. */
|
|
327
259
|
export interface ResolvedBinding extends CapturedBinding {
|
|
328
260
|
readonly digests: DefinitionDigests;
|
|
329
|
-
readonly manifest?: BindingManifest;
|
|
330
|
-
readonly retainedManifests?: ReadonlyArray<{
|
|
331
|
-
readonly digests: DefinitionDigests;
|
|
332
|
-
readonly replay: ReplayContract;
|
|
333
|
-
}>;
|
|
334
261
|
}
|
|
335
262
|
|
|
336
263
|
/** Trusted claim identity for resolving per-Attempt application services. Not model input. */
|
|
@@ -427,37 +354,18 @@ export const makeLegacyWorkerBinding = capture;
|
|
|
427
354
|
export const resolveWorkerBinding = (
|
|
428
355
|
bindings: ReadonlyArray<ResolvedBinding>,
|
|
429
356
|
agentId: AgentId,
|
|
430
|
-
|
|
431
|
-
requiredTools?: ReadonlyArray<string>,
|
|
432
|
-
): Effect.Effect<ResolvedBinding, DurableBindingFailure> => {
|
|
357
|
+
): Effect.Effect<ResolvedBinding, BindingUnavailable> => {
|
|
433
358
|
const registered = bindings.filter((binding) => binding.agentId === agentId);
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
const compatible =
|
|
446
|
-
exact ??
|
|
447
|
-
(registered.length === 1 && bindingSupports(registered[0]!, digests, requiredTools)
|
|
448
|
-
? registered[0]
|
|
449
|
-
: undefined);
|
|
450
|
-
|
|
451
|
-
if (compatible === undefined) {
|
|
452
|
-
return Effect.fail(
|
|
453
|
-
BindingDigestMismatch.make({
|
|
454
|
-
agentId,
|
|
455
|
-
message: `No registered Binding proves the retained replay contracts for ${agentId}; the original request and receipts remain pending`,
|
|
456
|
-
}),
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
return Effect.succeed(compatible);
|
|
359
|
+
const binding = registered[0];
|
|
360
|
+
|
|
361
|
+
return registered.length === 1 && binding !== undefined
|
|
362
|
+
? Effect.succeed(binding)
|
|
363
|
+
: Effect.fail(
|
|
364
|
+
BindingUnavailable.make({
|
|
365
|
+
agentId,
|
|
366
|
+
message: `Exactly one current Agent Binding must be registered for ${agentId}`,
|
|
367
|
+
}),
|
|
368
|
+
);
|
|
461
369
|
};
|
|
462
370
|
|
|
463
371
|
/** Resolve authoring-time admission through the one exact host registration, never by identity alone. */
|
|
@@ -498,10 +406,9 @@ export type AgentRegistration<A extends ExecutableAgentBinding = ExecutableAgent
|
|
|
498
406
|
readonly definitions: DefinitionDigestInput;
|
|
499
407
|
}
|
|
500
408
|
) & {
|
|
501
|
-
/**
|
|
409
|
+
/** Explicit operation versions let unchanged unfinished handlers survive toolbox changes. */
|
|
502
410
|
readonly continuity?: {
|
|
503
411
|
readonly versions: ReplayVersions;
|
|
504
|
-
readonly retainedManifests?: ReadonlyArray<BindingManifest>;
|
|
505
412
|
};
|
|
506
413
|
/**
|
|
507
414
|
* Source-owned reports capture services outside attemptLayer and open a fresh Scope per
|
|
@@ -632,8 +539,8 @@ const compileRegistration = <Entry extends AgentRegistration>(
|
|
|
632
539
|
try: () => registrationDefinitions(entry),
|
|
633
540
|
catch: () =>
|
|
634
541
|
DigestError.make({ message: "Agent update schema has no serializable wire contract" }),
|
|
635
|
-
})
|
|
636
|
-
(
|
|
542
|
+
}),
|
|
543
|
+
(definitions) =>
|
|
637
544
|
Effect.gen(function* () {
|
|
638
545
|
const binding = yield* capture(
|
|
639
546
|
entry.model === undefined ? entry.agent : { definition: entry.agent, model: entry.model },
|
|
@@ -645,32 +552,14 @@ const compileRegistration = <Entry extends AgentRegistration>(
|
|
|
645
552
|
...backgroundReports(binding.definition),
|
|
646
553
|
]);
|
|
647
554
|
|
|
648
|
-
if (entry.continuity === undefined) return { ...binding, digests, reporting };
|
|
649
|
-
|
|
650
|
-
const manifest = yield* makeBindingManifest(
|
|
651
|
-
binding.definition,
|
|
652
|
-
registrationDefinitions(entry),
|
|
653
|
-
entry.continuity.versions,
|
|
654
|
-
);
|
|
655
|
-
|
|
656
|
-
const retainedManifests = yield* Effect.forEach(
|
|
657
|
-
entry.continuity.retainedManifests ?? [],
|
|
658
|
-
(retained) =>
|
|
659
|
-
retained.agentId === binding.agentId
|
|
660
|
-
? digestDefinitions(retained.definitions).pipe(
|
|
661
|
-
Effect.map((digests) => ({ digests, replay: retained.replay })),
|
|
662
|
-
)
|
|
663
|
-
: Effect.fail(
|
|
664
|
-
DigestError.make({ message: "A retained manifest belongs to another Agent" }),
|
|
665
|
-
),
|
|
666
|
-
);
|
|
667
|
-
|
|
668
555
|
return {
|
|
669
556
|
...binding,
|
|
670
|
-
|
|
557
|
+
...(yield* compileBindingContracts(
|
|
558
|
+
binding.definition,
|
|
559
|
+
definitions,
|
|
560
|
+
entry.continuity?.versions,
|
|
561
|
+
)),
|
|
671
562
|
reporting,
|
|
672
|
-
manifest,
|
|
673
|
-
retainedManifests,
|
|
674
563
|
};
|
|
675
564
|
}),
|
|
676
565
|
// The erased descriptor accepts arbitrary provided services. Restore the concrete entry's
|
|
@@ -52,7 +52,6 @@ import {
|
|
|
52
52
|
} from "../ThreadStore.ts";
|
|
53
53
|
import {
|
|
54
54
|
definitionDigestsEqual,
|
|
55
|
-
bindingSupports,
|
|
56
55
|
resolveDefinitionBinding,
|
|
57
56
|
type ResolvedBinding,
|
|
58
57
|
} from "./agent-registration.ts";
|
|
@@ -103,10 +102,7 @@ export const makeMessagingRuntime = Effect.fn("MessagingHost.make")(function* (
|
|
|
103
102
|
|
|
104
103
|
if (created?._tag !== "ThreadCreated") return yield* failure("context", "not-found");
|
|
105
104
|
|
|
106
|
-
const matching = deps.bindings.filter(
|
|
107
|
-
(binding) =>
|
|
108
|
-
binding.agentId === created.agentId && bindingSupports(binding, created.definitions),
|
|
109
|
-
);
|
|
105
|
+
const matching = deps.bindings.filter((binding) => binding.agentId === created.agentId);
|
|
110
106
|
|
|
111
107
|
if (matching.length !== 1) return yield* failure("context", "binding-mismatch");
|
|
112
108
|
|
|
@@ -310,7 +306,6 @@ export const makeMessagingRuntime = Effect.fn("MessagingHost.make")(function* (
|
|
|
310
306
|
!Schema.is(MessageAdmission)(metadata) ||
|
|
311
307
|
metadata.peerName !== request.name ||
|
|
312
308
|
saved.envelope.agentId !== target.agentId ||
|
|
313
|
-
!bindingSupports(target, saved.envelope.definitions) ||
|
|
314
309
|
!sameJson(saved.envelope.input, input) ||
|
|
315
310
|
(inReplyTo === undefined || metadata.inReplyTo === undefined
|
|
316
311
|
? inReplyTo !== metadata.inReplyTo
|