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.
Files changed (142) hide show
  1. package/dist/{AgentRuntime-B64362Id.d.mts → AgentRuntime-BMzrJos6.d.mts} +2 -2
  2. package/dist/{AgentRuntime-Cdvqw7l_.mjs → AgentRuntime-BWOnNc0d.mjs} +78 -42
  3. package/dist/AgentRuntime-BWOnNc0d.mjs.map +1 -0
  4. package/dist/{DurableAgentRuntime-BGwGUIT-.mjs → DurableAgentRuntime-gF4YiEj2.mjs} +485 -262
  5. package/dist/DurableAgentRuntime-gF4YiEj2.mjs.map +1 -0
  6. package/dist/{DurableFailpoint-DQJet828.d.mts → DurableFailpoint-mx3-nsxU.d.mts} +3 -3
  7. package/dist/{EventSource-tCO_dAff.d.mts → EventSource-BZ73J0s5.d.mts} +3 -3
  8. package/dist/{PreparedInputAdmission-CFSddiT8.d.mts → PreparedInputAdmission-BkeI-Xvr.d.mts} +4 -4
  9. package/dist/{Records-CMByd1eD.d.mts → Records-BIiRLqlz.d.mts} +93 -101
  10. package/dist/{Records-BEz5IFUu.mjs → Records-DR1xtbXY.mjs} +36 -7
  11. package/dist/Records-DR1xtbXY.mjs.map +1 -0
  12. package/dist/{RunJournal-B_fxe57c.mjs → RunJournal-DNs3PM4K.mjs} +80 -23
  13. package/dist/RunJournal-DNs3PM4K.mjs.map +1 -0
  14. package/dist/{RunOptions-Clj8cLsp.d.mts → RunOptions-Bruk54SE.d.mts} +13 -4
  15. package/dist/{Schedule-BxCfnYr0.d.mts → Schedule-BNFlluAl.d.mts} +2 -2
  16. package/dist/{Scheduling-BW6BD_TP.mjs → Scheduling-HFH0pST1.mjs} +2 -2
  17. package/dist/{Scheduling-BW6BD_TP.mjs.map → Scheduling-HFH0pST1.mjs.map} +1 -1
  18. package/dist/{Subagent-Cbfzylz1.mjs → Subagent-C2s8PFrd.mjs} +2 -2
  19. package/dist/{Subagent-Cbfzylz1.mjs.map → Subagent-C2s8PFrd.mjs.map} +1 -1
  20. package/dist/{Subagent-Bm1dRecN.d.mts → Subagent-m7ywTCe4.d.mts} +3 -3
  21. package/dist/{Subscription-CrTIQKZR.d.mts → Subscription-BCQ3L9Zp.d.mts} +3 -3
  22. package/dist/{SubscriptionInput-BVOeFF1L.d.mts → SubscriptionInput-Cqu4_RW3.d.mts} +3 -3
  23. package/dist/{ToolReconciler-DQVaJfpE.d.mts → ToolReconciler-BmVRAHKs.d.mts} +8 -4
  24. package/dist/{agent-registration-BTa5vmQF.mjs → agent-registration-cXpB8cBU.mjs} +40 -95
  25. package/dist/agent-registration-cXpB8cBU.mjs.map +1 -0
  26. package/dist/capabilities/Commands.d.mts +1 -1
  27. package/dist/capabilities/RunHooks.d.mts +1 -1
  28. package/dist/capabilities/Subagent.d.mts +1 -1
  29. package/dist/capabilities/Subagent.mjs +1 -1
  30. package/dist/durable/ActivityStore.d.mts +1 -1
  31. package/dist/durable/ActivityStore.mjs +1 -1
  32. package/dist/durable/Admin.d.mts +1 -1
  33. package/dist/durable/Admin.mjs +12 -10
  34. package/dist/durable/Admin.mjs.map +1 -1
  35. package/dist/durable/AgentRegistration.d.mts +2 -2
  36. package/dist/durable/AgentRegistration.mjs +4 -7
  37. package/dist/durable/AgentRegistration.mjs.map +1 -1
  38. package/dist/durable/Certification.d.mts +2 -2
  39. package/dist/durable/CommittedActivity.d.mts +1 -1
  40. package/dist/durable/CommittedActivity.mjs +1 -1
  41. package/dist/durable/Digest.d.mts +1 -1
  42. package/dist/durable/Digest.mjs +1 -1
  43. package/dist/durable/DurableAgentRuntime.d.mts +1 -1
  44. package/dist/durable/DurableAgentRuntime.mjs +1 -1
  45. package/dist/durable/DurableFailpoint.d.mts +1 -1
  46. package/dist/durable/DurableFailpoint.mjs +2 -0
  47. package/dist/durable/DurableFailpoint.mjs.map +1 -1
  48. package/dist/durable/DurableFailpointTestControl.d.mts +1 -1
  49. package/dist/durable/EventSource.d.mts +1 -1
  50. package/dist/durable/EventSource.mjs +1 -1
  51. package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
  52. package/dist/durable/GitHubWorkflowSource.mjs +1 -1
  53. package/dist/durable/MessageDelivery.d.mts +3 -3
  54. package/dist/durable/MessageDelivery.mjs +1 -1
  55. package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
  56. package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
  57. package/dist/durable/PersistentHistory.d.mts +1 -1
  58. package/dist/durable/PersistentHistory.mjs +2 -2
  59. package/dist/durable/PreparedInputAdmission.d.mts +1 -1
  60. package/dist/durable/Records.d.mts +2 -2
  61. package/dist/durable/Records.mjs +2 -2
  62. package/dist/durable/Recovery.d.mts +1 -1
  63. package/dist/durable/Recovery.mjs +9 -9
  64. package/dist/durable/Recovery.mjs.map +1 -1
  65. package/dist/durable/RunJournal.d.mts +2 -2
  66. package/dist/durable/RunJournal.mjs +2 -2
  67. package/dist/durable/Schedule.d.mts +1 -1
  68. package/dist/durable/Schedule.mjs +1 -1
  69. package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
  70. package/dist/durable/ScheduleStoreConformance.mjs +1 -1
  71. package/dist/durable/ScheduleTransition.d.mts +1 -1
  72. package/dist/durable/ScheduleTransition.mjs +1 -1
  73. package/dist/durable/Scheduling.d.mts +2 -2
  74. package/dist/durable/Scheduling.mjs +1 -1
  75. package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
  76. package/dist/durable/SqlStorageV2Upgrade.mjs +1 -1
  77. package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
  78. package/dist/durable/SqlSubscriptionStore.mjs +1 -1
  79. package/dist/durable/SubmissionLedger.d.mts +1 -1
  80. package/dist/durable/SubmissionLedger.mjs +14 -13
  81. package/dist/durable/SubmissionLedger.mjs.map +1 -1
  82. package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
  83. package/dist/durable/SubmissionLedgerConformance.mjs +9 -2
  84. package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -1
  85. package/dist/durable/SubmissionStatus.d.mts +1 -1
  86. package/dist/durable/Subscription.d.mts +1 -1
  87. package/dist/durable/Subscription.mjs +1 -1
  88. package/dist/durable/SubscriptionInput.d.mts +1 -1
  89. package/dist/durable/SubscriptionInput.mjs +2 -2
  90. package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
  91. package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
  92. package/dist/durable/SubscriptionTools.d.mts +3 -3
  93. package/dist/durable/SubscriptionTransition.d.mts +1 -1
  94. package/dist/durable/SubscriptionTransition.mjs +1 -1
  95. package/dist/durable/Subscriptions.d.mts +5 -5
  96. package/dist/durable/Subscriptions.mjs +1 -1
  97. package/dist/durable/ThreadContextHistory.d.mts +1 -1
  98. package/dist/durable/ThreadContextHistory.mjs +1 -1
  99. package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
  100. package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
  101. package/dist/durable/ThreadInvariants.d.mts +4 -2
  102. package/dist/durable/ThreadInvariants.mjs +49 -3
  103. package/dist/durable/ThreadInvariants.mjs.map +1 -1
  104. package/dist/durable/ThreadProjection.d.mts +1 -1
  105. package/dist/durable/ThreadProjection.mjs +1 -1
  106. package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
  107. package/dist/durable/ThreadStore.d.mts +1 -1
  108. package/dist/durable/ThreadStore.mjs +1 -1
  109. package/dist/durable/ThreadStoreConformance.d.mts +1 -1
  110. package/dist/durable/ThreadStoreConformance.mjs +1 -1
  111. package/dist/durable/ToolReconciler.d.mts +1 -1
  112. package/dist/durable/ToolReconciler.mjs +9 -5
  113. package/dist/durable/ToolReconciler.mjs.map +1 -1
  114. package/dist/durable/WorkerHost.d.mts +1 -1
  115. package/dist/engine/AgentRuntime.d.mts +1 -1
  116. package/dist/engine/AgentRuntime.mjs +1 -1
  117. package/dist/engine/RunOptions.d.mts +1 -1
  118. package/dist/engine/RunOptions.mjs.map +1 -1
  119. package/dist/index.d.mts +11 -11
  120. package/dist/index.mjs +6 -6
  121. package/package.json +1 -1
  122. package/src/durable/Admin.ts +20 -11
  123. package/src/durable/AgentRegistration.ts +1 -4
  124. package/src/durable/DurableAgentRuntime.ts +936 -462
  125. package/src/durable/DurableFailpoint.ts +2 -0
  126. package/src/durable/Records.ts +31 -4
  127. package/src/durable/Recovery.ts +8 -8
  128. package/src/durable/RunJournal.ts +128 -51
  129. package/src/durable/SubmissionLedger.ts +13 -12
  130. package/src/durable/SubmissionLedgerConformance.ts +13 -2
  131. package/src/durable/ThreadInvariants.ts +70 -5
  132. package/src/durable/ToolReconciler.ts +7 -3
  133. package/src/durable/internal/agent-registration.ts +77 -188
  134. package/src/durable/internal/messaging-host.ts +1 -6
  135. package/src/durable/internal/worker-host.ts +88 -116
  136. package/src/engine/RunOptions.ts +13 -3
  137. package/src/engine/internal/agent-runtime.ts +160 -106
  138. package/dist/AgentRuntime-Cdvqw7l_.mjs.map +0 -1
  139. package/dist/DurableAgentRuntime-BGwGUIT-.mjs.map +0 -1
  140. package/dist/Records-BEz5IFUu.mjs.map +0 -1
  141. package/dist/RunJournal-B_fxe57c.mjs.map +0 -1
  142. 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
- DefinitionDigestInput,
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
- /** The typed refusal family of durable Binding resolution (spec §11, SUB-032). */
64
- export type DurableBindingFailure = BindingUnavailable | BindingDigestMismatch;
40
+ export type DurableBindingFailure = BindingUnavailable;
65
41
 
66
- /** Byte-for-byte equality of two stored definition digest triples (SUB-023). */
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
- * Data exported from a definition, never an old executable Binding. A host may supply an audited
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
- definitions: DefinitionDigestInput,
100
- versions: ReplayVersions,
60
+ versions?: ReplayVersions,
61
+ fallbackVersion: PersistedJson = null,
101
62
  ) {
102
- const jsonSchema = (schema: Schema.Top) =>
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 tools = Object.values(definition.toolkit.tools);
108
-
109
- if (tools.some((tool) => !Object.hasOwn(versions.tools, tool.name)))
110
- throw new Error("Every Tool needs an explicit replay semantic version");
111
-
112
- return {
113
- agent: {
114
- version: versions.agent,
115
- id: definition.id,
116
- input: jsonSchema(definition.input),
117
- output: jsonSchema(definition.output),
118
- updates: definition.updates === undefined ? null : jsonSchema(definition.updates),
119
- completion:
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: versions.tools[tool.name]!,
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
- const agent = yield* digestJson(contracts.agent);
157
-
158
- const tools = yield* Effect.forEach(contracts.tools, ({ name, contract }) =>
159
- digestJson(contract).pipe(Effect.map((digest) => [name, digest] as const)),
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
- const replaySupports = (
170
- current: ReplayContract,
171
- retained: ReplayContract,
172
- requiredTools?: ReadonlyArray<string>,
173
- ): boolean =>
174
- current.agent === retained.agent &&
175
- (requiredTools ?? Object.keys(retained.tools)).every(
176
- (name) => retained.tools[name] !== undefined && current.tools[name] === retained.tools[name],
177
- );
178
-
179
- /** Resolve executable code only. Admission, delivery, lineage and receipt comparisons stay exact. */
180
- export const bindingSupports = (
181
- binding: Pick<ResolvedBinding, "digests" | "retainedManifests">,
182
- digests: DefinitionDigests,
183
- requiredTools?: ReadonlyArray<string>,
184
- ): boolean => {
185
- if (definitionDigestsEqual(binding.digests, digests)) return true;
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
- digests: DefinitionDigests,
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
- if (registered.length === 0) {
436
- return Effect.fail(
437
- BindingUnavailable.make({
438
- agentId,
439
- message: `No Agent Binding is registered for ${agentId}; recovery never substitutes different code (SUB-023)`,
440
- }),
441
- );
442
- }
443
- const exact = registered.find((binding) => definitionDigestsEqual(binding.digests, digests));
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
- /** Opt into contract-checked deployment continuity. Omit to require an exact registration. */
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
- }).pipe(Effect.flatMap(digestDefinitions)),
636
- (digests) =>
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
- digests: DefinitionDigests.make({ ...digests, replay: manifest.replay }),
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