effect-agent 0.1.0-beta.96 → 0.1.0-beta.97

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 (102) hide show
  1. package/dist/{DurableAgentRuntime-BGwGUIT-.mjs → DurableAgentRuntime-DbUvZHDZ.mjs} +34 -30
  2. package/dist/DurableAgentRuntime-DbUvZHDZ.mjs.map +1 -0
  3. package/dist/{EventSource-tCO_dAff.d.mts → EventSource-D6PAAEyK.d.mts} +3 -3
  4. package/dist/{PreparedInputAdmission-CFSddiT8.d.mts → PreparedInputAdmission-omMbwd--.d.mts} +4 -4
  5. package/dist/{Records-BEz5IFUu.mjs → Records-BAutSSnJ.mjs} +3 -1
  6. package/dist/Records-BAutSSnJ.mjs.map +1 -0
  7. package/dist/{Records-CMByd1eD.d.mts → Records-CV49DgQK.d.mts} +37 -9
  8. package/dist/{RunJournal-B_fxe57c.mjs → RunJournal-DRRRZmG7.mjs} +2 -2
  9. package/dist/{RunJournal-B_fxe57c.mjs.map → RunJournal-DRRRZmG7.mjs.map} +1 -1
  10. package/dist/{Schedule-BxCfnYr0.d.mts → Schedule-DePbGfgd.d.mts} +2 -2
  11. package/dist/{Scheduling-BW6BD_TP.mjs → Scheduling-C3QpYn0W.mjs} +2 -2
  12. package/dist/{Scheduling-BW6BD_TP.mjs.map → Scheduling-C3QpYn0W.mjs.map} +1 -1
  13. package/dist/{Subscription-CrTIQKZR.d.mts → Subscription-BR_8Cxh3.d.mts} +3 -3
  14. package/dist/{SubscriptionInput-BVOeFF1L.d.mts → SubscriptionInput-B95sQbuk.d.mts} +3 -3
  15. package/dist/{agent-registration-BTa5vmQF.mjs → agent-registration-CXGDwvJH.mjs} +151 -26
  16. package/dist/agent-registration-CXGDwvJH.mjs.map +1 -0
  17. package/dist/durable/ActivityStore.d.mts +1 -1
  18. package/dist/durable/ActivityStore.mjs +1 -1
  19. package/dist/durable/Admin.d.mts +1 -1
  20. package/dist/durable/Admin.mjs +1 -1
  21. package/dist/durable/AgentRegistration.d.mts +2 -2
  22. package/dist/durable/AgentRegistration.mjs +3 -2
  23. package/dist/durable/AgentRegistration.mjs.map +1 -1
  24. package/dist/durable/Certification.d.mts +1 -1
  25. package/dist/durable/CommittedActivity.d.mts +1 -1
  26. package/dist/durable/CommittedActivity.mjs +1 -1
  27. package/dist/durable/Digest.d.mts +1 -1
  28. package/dist/durable/Digest.mjs +1 -1
  29. package/dist/durable/DurableAgentRuntime.d.mts +1 -1
  30. package/dist/durable/DurableAgentRuntime.mjs +1 -1
  31. package/dist/durable/EventSource.d.mts +1 -1
  32. package/dist/durable/EventSource.mjs +1 -1
  33. package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
  34. package/dist/durable/GitHubWorkflowSource.mjs +1 -1
  35. package/dist/durable/MessageDelivery.d.mts +3 -3
  36. package/dist/durable/MessageDelivery.mjs +1 -1
  37. package/dist/durable/MessageDeliveryStoreConformance.d.mts +1 -1
  38. package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
  39. package/dist/durable/PersistentHistory.d.mts +1 -1
  40. package/dist/durable/PersistentHistory.mjs +2 -2
  41. package/dist/durable/PreparedInputAdmission.d.mts +1 -1
  42. package/dist/durable/Records.d.mts +1 -1
  43. package/dist/durable/Records.mjs +1 -1
  44. package/dist/durable/Recovery.d.mts +1 -1
  45. package/dist/durable/Recovery.mjs +1 -1
  46. package/dist/durable/RunJournal.d.mts +1 -1
  47. package/dist/durable/RunJournal.mjs +1 -1
  48. package/dist/durable/Schedule.d.mts +1 -1
  49. package/dist/durable/Schedule.mjs +1 -1
  50. package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
  51. package/dist/durable/ScheduleStoreConformance.mjs +1 -1
  52. package/dist/durable/ScheduleTransition.d.mts +1 -1
  53. package/dist/durable/ScheduleTransition.mjs +1 -1
  54. package/dist/durable/Scheduling.d.mts +2 -2
  55. package/dist/durable/Scheduling.mjs +1 -1
  56. package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
  57. package/dist/durable/SqlStorageV2Upgrade.mjs +1 -1
  58. package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
  59. package/dist/durable/SqlSubscriptionStore.mjs +1 -1
  60. package/dist/durable/SubmissionLedger.d.mts +1 -1
  61. package/dist/durable/SubmissionLedger.mjs +1 -1
  62. package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
  63. package/dist/durable/SubmissionLedgerConformance.mjs +1 -1
  64. package/dist/durable/SubmissionStatus.d.mts +1 -1
  65. package/dist/durable/Subscription.d.mts +1 -1
  66. package/dist/durable/Subscription.mjs +1 -1
  67. package/dist/durable/SubscriptionInput.d.mts +1 -1
  68. package/dist/durable/SubscriptionInput.mjs +2 -2
  69. package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
  70. package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
  71. package/dist/durable/SubscriptionTools.d.mts +3 -3
  72. package/dist/durable/SubscriptionTransition.d.mts +1 -1
  73. package/dist/durable/SubscriptionTransition.mjs +1 -1
  74. package/dist/durable/Subscriptions.d.mts +5 -5
  75. package/dist/durable/Subscriptions.mjs +1 -1
  76. package/dist/durable/ThreadContextHistory.d.mts +1 -1
  77. package/dist/durable/ThreadContextHistory.mjs +1 -1
  78. package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
  79. package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
  80. package/dist/durable/ThreadInvariants.d.mts +1 -1
  81. package/dist/durable/ThreadInvariants.mjs +1 -1
  82. package/dist/durable/ThreadProjection.d.mts +1 -1
  83. package/dist/durable/ThreadProjection.mjs +1 -1
  84. package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
  85. package/dist/durable/ThreadStore.d.mts +1 -1
  86. package/dist/durable/ThreadStore.mjs +1 -1
  87. package/dist/durable/ThreadStoreConformance.d.mts +1 -1
  88. package/dist/durable/ThreadStoreConformance.mjs +1 -1
  89. package/dist/durable/ToolReconciler.mjs +1 -1
  90. package/dist/durable/WorkerHost.d.mts +1 -1
  91. package/dist/index.d.mts +6 -6
  92. package/dist/index.mjs +4 -4
  93. package/package.json +1 -1
  94. package/src/durable/AgentRegistration.ts +1 -0
  95. package/src/durable/DurableAgentRuntime.ts +3 -1
  96. package/src/durable/Records.ts +2 -0
  97. package/src/durable/internal/agent-registration.ts +274 -36
  98. package/src/durable/internal/messaging-host.ts +2 -5
  99. package/src/durable/internal/worker-host.ts +119 -85
  100. package/dist/DurableAgentRuntime-BGwGUIT-.mjs.map +0 -1
  101. package/dist/Records-BEz5IFUu.mjs.map +0 -1
  102. package/dist/agent-registration-BTa5vmQF.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { O as PersistedJson } from "./Records-CMByd1eD.mjs";
2
- import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, t as AcceptedEvent } from "./Subscription-CrTIQKZR.mjs";
1
+ import { O as PersistedJson } from "./Records-CV49DgQK.mjs";
2
+ import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, t as AcceptedEvent } from "./Subscription-BR_8Cxh3.mjs";
3
3
  import { Context, Effect, Schema, Scope } from "effect";
4
4
  declare namespace EventSource_d_exports {
5
5
  export { EventSource, EventSources, NormalizedEvent, makeEventSource };
@@ -48,4 +48,4 @@ declare const makeEventSource: <Event extends Schema.Top, Parameters extends Sch
48
48
  }) => Effect.Effect<EventSource, never, Exclude<R, Scope.Scope> | Exclude<Event["DecodingServices"], Scope.Scope> | Exclude<Event["EncodingServices"], Scope.Scope> | Exclude<Parameters["DecodingServices"], Scope.Scope> | Exclude<Parameters["EncodingServices"], Scope.Scope>>;
49
49
  //#endregion
50
50
  export { makeEventSource as a, NormalizedEvent as i, EventSource_d_exports as n, EventSources as r, EventSource as t };
51
- //# sourceMappingURL=EventSource-tCO_dAff.d.mts.map
51
+ //# sourceMappingURL=EventSource-D6PAAEyK.d.mts.map
@@ -1,7 +1,7 @@
1
1
  import { a as Receipt } from "./Receipt-BAHyigAF.mjs";
2
- import { fn as SubmissionStatus } from "./Records-CMByd1eD.mjs";
3
- import { H as ScheduledInputRefused, V as ScheduledInputFailure, j as ScheduleStorageError } from "./Schedule-BxCfnYr0.mjs";
4
- import { a as PreparedInput } from "./Subscription-CrTIQKZR.mjs";
2
+ import { fn as SubmissionStatus } from "./Records-CV49DgQK.mjs";
3
+ import { H as ScheduledInputRefused, V as ScheduledInputFailure, j as ScheduleStorageError } from "./Schedule-DePbGfgd.mjs";
4
+ import { a as PreparedInput } from "./Subscription-BR_8Cxh3.mjs";
5
5
  import { Context, Effect } from "effect";
6
6
  declare namespace PreparedInputAdmission_d_exports {
7
7
  export { PreparedInputAdmission, admitPreparedInput };
@@ -35,4 +35,4 @@ declare const admitPreparedInput: <R>(submit: Effect.Effect<Receipt, ScheduledIn
35
35
  }, ScheduleStorageError, R>;
36
36
  //#endregion
37
37
  export { PreparedInputAdmission_d_exports as n, admitPreparedInput as r, PreparedInputAdmission as t };
38
- //# sourceMappingURL=PreparedInputAdmission-CFSddiT8.d.mts.map
38
+ //# sourceMappingURL=PreparedInputAdmission-omMbwd--.d.mts.map
@@ -202,6 +202,8 @@ var DefinitionDigestInput = class extends Schema.Class("@effect-agent/thread/Def
202
202
  /** The contracts a retained Run may decode or execute, independent of its deployment. */
203
203
  var ReplayContract = class extends Schema.Class("@effect-agent/thread/ReplayContract")({
204
204
  agent: Digest,
205
+ /** Agent semantics and output/completion codecs; the saved input is checked separately. */
206
+ agentBehavior: Schema.optionalKey(Digest),
205
207
  tools: Schema.Record(Schema.String, Digest)
206
208
  }) {};
207
209
  /** Digests identify admission exactly; replay contracts separately authorize continuation. */
@@ -810,4 +812,4 @@ const CURRENT_CANONICAL_SCHEMA_VERSION = 1;
810
812
  //#endregion
811
813
  export { ToolCallSettled as $, Records_exports as A, SubagentJoined as B, ObservationOffset as C, ProducerId as D, ProducerEpoch as E, RunFailed as F, SubmissionSettledRecord as G, SubagentRequested as H, RunPolicyUsageReserved as I, ToolApprovalDecided as J, SubtreeBudgetReserved as K, RunStartedRecord as L, ReplayContract as M, RunCompleted as N, RecordEnvelope as O, RunDurationExhausted as P, ToolCallResolved as Q, SettlementFailureDiagnostic as R, ModelResponseRecorded as S, PersistedJson as T, SubagentStarted as U, SubagentLineageRecorded as V, SubmissionSettled as W, ToolCallPrepared as X, ToolApprovalRequested as Y, ToolCallResolution as Z, MAX_PERSISTED_JSON_COLLECTION_LENGTH as _, CURRENT_CANONICAL_SCHEMA_VERSION as a, WorkerInputRequested as at, ModelCompleted as b, CanonicalRecordEnvelope as c, WorkerReportPrepared as ct, CompactionCreated as d, strictSchema as dt, ToolCallUnknown as et, DefinitionDigestInput as f, MAX_PERSISTED_JSON_BYTES as g, Digest as h, BatchId as i, WorkerInputCompleted as it, RepairAnnotated as j, RecordId as k, CanonicalRecordPayload as l, WorkerReportRefused as lt, DeploymentId as m, AgentUpdateEmitted as n, UserInputRecorded as nt, CanonicalBatch as o, WorkerOrigin as ot, DefinitionDigests as p, ThreadCreated as q, ApprovalDecision as r, WorkerAdmission as rt, CanonicalRecord as s, WorkerOriginRecorded as st, AbortRequested as t, ToolStepSettled as tt, CanonicalSequence as u, WorkerReportingIntent as ut, MAX_PERSISTED_JSON_DEPTH as v, PeerMessagePrepared as w, ModelResponseInterrupted as x, MAX_PERSISTED_JSON_NODES as y, SettlementOutcome as z };
812
814
 
813
- //# sourceMappingURL=Records-BEz5IFUu.mjs.map
815
+ //# sourceMappingURL=Records-BAutSSnJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Records-BAutSSnJ.mjs","names":[],"sources":["../src/core/internal/strict-schema.ts","../src/durable/Records.ts"],"sourcesContent":["import { Schema, SchemaParser, SchemaTransformation } from \"effect\";\n\n/** Keep strict parsing on nested values even when an outer parser uses its defaults. */\nexport const strictSchema = <S extends Schema.Top>(schema: S) =>\n Schema.declareConstructor<S[\"Type\"], S[\"Encoded\"]>()(\n [schema],\n ([codec]) =>\n (value, _ast, options) =>\n SchemaParser.decodeUnknownEffect(codec)(value, { ...options, onExcessProperty: \"error\" }),\n {\n toCodecJson: ([codec]) =>\n Schema.link<S[\"Encoded\"]>()(codec, SchemaTransformation.passthrough()),\n },\n );\n","import { Option, Schema } from \"effect\";\nimport { Prompt } from \"effect/unstable/ai\";\n\nimport { InputMessage } from \"../capabilities/Messaging.ts\";\nimport { PolicyLimit } from \"../core/AgentError.ts\";\nimport { AgentPolicy } from \"../core/AgentPolicy.ts\";\nimport { Update } from \"../core/AgentUpdates.ts\";\nimport {\n AgentId,\n AttemptId,\n ThreadId,\n DelegationId,\n ReceiptId,\n RunId,\n SettlementId,\n SubmissionId,\n ToolCallId,\n TurnId,\n} from \"../core/Identifiers.ts\";\nimport { strictSchema } from \"../core/internal/strict-schema.ts\";\nimport { utf8ByteLength } from \"../core/internal/utf8.ts\";\nimport { IdempotencyKey, Principal } from \"../core/Receipt.ts\";\nimport { ExhaustedLimit } from \"../core/RunEvent.ts\";\nimport { RunPolicyUsage } from \"../core/RunPolicyUsage.ts\";\nimport {\n DelegationDepth,\n SubagentBudgetReservation,\n SubagentGrant,\n SubagentParentLink,\n ToolExecutionKind,\n} from \"../core/SubagentContract.ts\";\nimport { Selection, Snapshot } from \"../core/ToolExposure.ts\";\nimport { ToolParameterRejection } from \"../core/ToolResult.ts\";\nimport { ModelCallUsage, RunUsageSummary, RunTotals } from \"../core/Usage.ts\";\nimport { WorkerBudgetScope, WorkerRef, WorkerSource } from \"../core/Worker.ts\";\nimport { ContextHandoff } from \"../engine/ContextWindow.ts\";\n\nconst identifier = <const Name extends string>(name: Name) =>\n Schema.NonEmptyString.pipe(Schema.brand(`@effect-agent/thread/${name}`));\n\n/** Stable identity of one canonical record. */\nexport const RecordId = identifier(\"RecordId\");\nexport type RecordId = typeof RecordId.Type;\n\n/** Stable idempotency identity of one atomic append. */\nexport const BatchId = identifier(\"BatchId\");\nexport type BatchId = typeof BatchId.Type;\n\n/** Identity of the deployment that produced a record. */\nexport const DeploymentId = identifier(\"DeploymentId\");\nexport type DeploymentId = typeof DeploymentId.Type;\n\n/** Identity of a fenced canonical-log producer. */\nexport const ProducerId = identifier(\"ProducerId\");\nexport type ProducerId = typeof ProducerId.Type;\n\n/** SHA-256 digest encoded as lowercase hexadecimal text. */\nexport const Digest = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/)).pipe(\n Schema.brand(\"@effect-agent/thread/Digest\"),\n);\n\nexport type Digest = typeof Digest.Type;\n\n/** Adapter-owned resume cursor. Callers must not parse or synthesize it. */\nexport const ObservationOffset = identifier(\"ObservationOffset\");\nexport type ObservationOffset = typeof ObservationOffset.Type;\n\n/** Gap-free position in one Thread's canonical sequence. */\nexport const CanonicalSequence = Schema.Natural.pipe(\n Schema.brand(\"@effect-agent/thread/CanonicalSequence\"),\n);\n\nexport type CanonicalSequence = typeof CanonicalSequence.Type;\n\n/** Monotonic fencing epoch for a Thread producer. */\nexport const ProducerEpoch = Schema.Natural.pipe(\n Schema.brand(\"@effect-agent/thread/ProducerEpoch\"),\n);\n\nexport type ProducerEpoch = typeof ProducerEpoch.Type;\n\nconst BoundedText = Schema.String.check(Schema.isMaxLength(64 * 1024));\nconst BoundedName = Schema.NonEmptyString.check(Schema.isMaxLength(256));\n\n/** Stable, non-empty failure classification carried by a failed durable Settlement. */\nconst SettlementFailureTag = Schema.NonEmptyString.check(Schema.isMaxLength(256));\n\n/** Diagnostic text is bounded independently from the broader persisted JSON envelope. */\nconst SettlementFailureMessage = Schema.String.check(Schema.isMaxLength(16 * 1024));\n\n/**\n * The complete generic diagnostic allowed on a failed durable Settlement. It deliberately has\n * no raw Cause, stack, provider payload, or application-specific fields; those values can carry\n * secrets and do not form a stable cross-process contract.\n */\nexport const SettlementFailureDiagnostic = Schema.Struct({\n errorTag: SettlementFailureTag,\n message: SettlementFailureMessage,\n}).pipe(\n strictSchema,\n Schema.annotate({\n identifier: \"@effect-agent/thread/SettlementFailureDiagnostic\",\n }),\n);\n\nexport type SettlementFailureDiagnostic = typeof SettlementFailureDiagnostic.Type;\n\n/** Positive canonical (Run-relative, Attempt-independent) Turn number. */\nconst TurnNumber = Schema.Int.check(Schema.isGreaterThan(0));\n\nexport const MAX_PERSISTED_JSON_DEPTH = 64;\nexport const MAX_PERSISTED_JSON_COLLECTION_LENGTH = 4_096;\nexport const MAX_PERSISTED_JSON_NODES = 65_536;\nexport const MAX_PERSISTED_JSON_BYTES = 1024 * 1024;\n\n/**\n * Iteratively preflights an unknown value before Schema's recursive JSON validation. This is the\n * one narrow `Schema.declare` exception in the persistence model: Effect v4's `Unknown.decodeTo`\n * preserves `unknown` as the encoded type, which would leak through every nested record codec.\n * Schema.Json still owns the accepted value shape after this resource preflight succeeds.\n */\nconst isJson = Schema.is(Schema.Json);\n\nconst isPersistedJson = (input: unknown): input is Schema.Json => {\n const pending: Array<\n | { readonly _tag: \"visit\"; readonly value: unknown; readonly depth: number }\n | { readonly _tag: \"leave\"; readonly value: object }\n > = [{ _tag: \"visit\", value: input, depth: 0 }];\n\n // Only ancestors indicate a cycle. Shared acyclic values serialize once per occurrence,\n // so revisit them and charge every occurrence against the same resource limits.\n const ancestors = new WeakSet<object>();\n let nodes = 0;\n let textUnits = 0;\n\n try {\n while (pending.length > 0) {\n const current = pending.pop();\n\n if (current === undefined) return false;\n if (current._tag === \"leave\") {\n ancestors.delete(current.value);\n continue;\n }\n if (current.depth > MAX_PERSISTED_JSON_DEPTH || ++nodes > MAX_PERSISTED_JSON_NODES) {\n return false;\n }\n\n const value = current.value;\n\n if (value === null || typeof value === \"boolean\") continue;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) return false;\n continue;\n }\n if (typeof value === \"string\") {\n textUnits += value.length;\n if (textUnits > MAX_PERSISTED_JSON_BYTES) return false;\n continue;\n }\n if (typeof value !== \"object\" || ancestors.has(value)) return false;\n ancestors.add(value);\n pending.push({ _tag: \"leave\", value });\n\n const entries = Array.isArray(value)\n ? Array.from(value, (entry, index) => [index, entry] as const)\n : Object.entries(value);\n\n if (entries.length > MAX_PERSISTED_JSON_COLLECTION_LENGTH) return false;\n for (const [key, entry] of entries) {\n textUnits += typeof key === \"string\" ? key.length : 0;\n if (textUnits > MAX_PERSISTED_JSON_BYTES) return false;\n pending.push({ _tag: \"visit\", value: entry, depth: current.depth + 1 });\n }\n }\n\n if (!isJson(input)) return false;\n const encoded = JSON.stringify(input);\n\n return encoded !== undefined && utf8ByteLength(encoded) <= MAX_PERSISTED_JSON_BYTES;\n } catch {\n return false;\n }\n};\n\n/** Canonical JSON admitted to persisted records and checkpoints under explicit resource limits. */\nexport const PersistedJson = Schema.declare(isPersistedJson, {\n identifier: \"@effect-agent/thread/PersistedJson\",\n description: \"JSON bounded by canonical persistence depth, collection, node, and byte limits\",\n});\n\nexport type PersistedJson = typeof PersistedJson.Type;\n\n/** Schema-owned replay inputs whose individual definitions are incorporated into digests. */\nexport class DefinitionDigestInput extends Schema.Class<DefinitionDigestInput>(\n \"@effect-agent/thread/DefinitionDigestInput\",\n)({\n agent: PersistedJson,\n model: PersistedJson,\n tools: PersistedJson,\n}) {}\n\n/** The contracts a retained Run may decode or execute, independent of its deployment. */\nexport class ReplayContract extends Schema.Class<ReplayContract>(\n \"@effect-agent/thread/ReplayContract\",\n)({\n agent: Digest,\n /** Agent semantics and output/completion codecs; the saved input is checked separately. */\n agentBehavior: Schema.optionalKey(Digest),\n tools: Schema.Record(Schema.String, Digest),\n}) {}\n\n/** Digests identify admission exactly; replay contracts separately authorize continuation. */\nexport class DefinitionDigests extends Schema.Class<DefinitionDigests>(\n \"@effect-agent/thread/DefinitionDigests\",\n)({\n agent: Digest,\n model: Digest,\n tools: Digest,\n replay: Schema.optionalKey(ReplayContract),\n}) {}\n\nexport class ThreadCreated extends Schema.TaggedClass<ThreadCreated>(\n \"@effect-agent/thread/ThreadCreated\",\n)(\"ThreadCreated\", {\n agentId: AgentId,\n definitions: DefinitionDigests,\n}) {}\n\n/**\n * One recorded Thread input. `submissionId` is present only for durably accepted work;\n * retained history has no admission or settlement obligation. `kind` identifies the input seam.\n */\nexport class UserInputRecorded extends Schema.TaggedClass<UserInputRecorded>(\n \"@effect-agent/thread/UserInputRecorded\",\n)(\"UserInputRecorded\", {\n submissionId: Schema.optionalKey(SubmissionId),\n kind: Schema.Literals([\"user\", \"steering\", \"follow-up\"]),\n runId: Schema.optionalKey(RunId),\n input: PersistedJson,\n messageAdmission: Schema.optionalKey(InputMessage),\n}) {}\n\n/** Immutable Run start and per-Attempt duration allowance, before any agent execution. */\nexport class RunStartedRecord extends Schema.TaggedClass<RunStartedRecord>(\n \"@effect-agent/thread/RunStartedRecord\",\n)(\"RunStarted\", {\n runId: RunId,\n /** Older private histories cannot prove programmatic accounting and must be reset. */\n policyAccountingVersion: Schema.Literal(1),\n maxDurationMillis: Schema.Finite.check(Schema.isGreaterThan(0)),\n}) {}\n\n/** An active Attempt exhausted its execution allowance; downtime alone never writes this. */\nexport class RunDurationExhausted extends Schema.TaggedClass<RunDurationExhausted>(\n \"@effect-agent/thread/RunDurationExhausted\",\n)(\"RunDurationExhausted\", { runId: RunId }) {}\n\nconst PersistedPromptMessages = Schema.toEncoded(Prompt.Prompt);\nconst isPersistedPromptMessages = Schema.is(PersistedPromptMessages);\n\n/**\n * Final model output. Immediate history may include the exact encoded Prompt suffix of the\n * successful Run; durable execution instead journals individual ModelResponseRecorded Turns.\n */\nexport class ModelCompleted extends Schema.TaggedClass<ModelCompleted>(\n \"@effect-agent/thread/ModelCompleted\",\n)(\n \"ModelCompleted\",\n Schema.Struct({\n runId: RunId,\n output: PersistedJson,\n messages: Schema.optionalKey(PersistedJson),\n }).check(\n Schema.makeFilter(\n (record) => record.messages === undefined || isPersistedPromptMessages(record.messages),\n { title: \"Retained Run messages are Schema-encoded Effect AI Prompt messages\" },\n ),\n ),\n) {}\n\nexport class ToolCallSettled extends Schema.TaggedClass<ToolCallSettled>(\n \"@effect-agent/thread/ToolCallSettled\",\n)(\"ToolCallSettled\", {\n toolSelection: Schema.optionalKey(Selection),\n runId: RunId,\n toolCallId: ToolCallId,\n toolName: BoundedName,\n result: PersistedJson,\n isFailure: Schema.Boolean,\n /** Explicit engine evidence, never inferred from Tool result data. */\n budgetRejected: Schema.optionalKey(Schema.Literal(true)),\n}) {}\n\n/**\n * One committed model Turn. `messages` carries the Schema-encoded Effect AI Prompt messages this\n * Turn appended (assistant response plus any tool-call declarations), committed atomically at the\n * Turn boundary so a recovering Attempt can rebuild the next Prompt from canonical records alone.\n * `messagesDigest` pins the exact encoded content.\n */\nconst ModelResponseRecordedFields = Schema.Struct({\n /** Explicit pre-execution failures, committed with the original arguments before any approval. */\n toolParameterRejections: Schema.optionalKey(Schema.Array(ToolParameterRejection)),\n toolExposure: Schema.optionalKey(Snapshot),\n runId: RunId,\n turnId: TurnId,\n turn: TurnNumber,\n messages: PersistedJson,\n messagesDigest: Digest,\n /**\n * Number of leading messages that belong only to this Run's evaluated instructions and wake\n * input. They remain canonical and are visible while recovering this Run, but later Runs omit\n * them from their model-facing history. Records without this field retain their full history.\n */\n runScopedPrefixLength: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),\n /**\n * Exact normalized usage for every model call staged into this Turn. A\n * summarizer and the Turn response are distinct entries. Absent on legacy\n * records, whose aggregate totals below retain the old resume behavior.\n */\n modelUsage: Schema.optionalKey(Schema.Array(ModelCallUsage)),\n /** Observed invocations without retained accounting before this Turn committed. */\n unobservedModelCalls: Schema.optionalKey(Schema.Natural),\n /** Aggregate compatibility fields used by older projections. */\n inputTokens: Schema.optionalKey(Schema.Natural),\n outputTokens: Schema.optionalKey(Schema.Natural),\n /** Estimated spend staged with the usage; recovery re-seeds the cost budget (RUN-023). */\n costMicrousd: Schema.optionalKey(Schema.Natural),\n}).check(\n Schema.makeFilter(\n (response) =>\n response.runScopedPrefixLength === undefined ||\n (isPersistedPromptMessages(response.messages) &&\n response.runScopedPrefixLength < response.messages.content.length &&\n response.messages.content\n .slice(0, response.runScopedPrefixLength)\n .every((message) => message.role === \"system\" || message.role === \"user\")),\n {\n title:\n \"Run-scoped Prompt prefix contains only instruction/wake messages and leaves one response\",\n },\n ),\n);\n\nexport class ModelResponseRecorded extends Schema.TaggedClass<ModelResponseRecorded>(\n \"@effect-agent/thread/ModelResponseRecorded\",\n)(\"ModelResponseRecorded\", ModelResponseRecordedFields) {}\n\n/**\n * One approved uncertain/idempotent ordinary Tool Call made durable BEFORE any handler starts\n * (durability §10). `parameters` is the Schema-encoded wire form of the declared call and\n * `parametersDigest` pins it; recovery that sees this record without a matching `ToolCallSettled`\n * (or `ToolCallUnknown` → `ToolCallResolved`) must reconcile or mark unknown, never silently\n * replay (DUR-009). Ordinary `readonly`-class Tools never produce this record. Delegation\n * classification is always prepared, including for a Tool annotated `readonly`.\n */\nexport class ToolCallPrepared extends Schema.TaggedClass<ToolCallPrepared>(\n \"@effect-agent/thread/ToolCallPrepared\",\n)(\"ToolCallPrepared\", {\n runId: RunId,\n turnId: TurnId,\n turn: TurnNumber,\n toolCallId: ToolCallId,\n toolName: BoundedName,\n parameters: PersistedJson,\n parametersDigest: Digest,\n /** Absent legacy evidence grants no delegation replay authority. */\n executionKind: Schema.optionalKey(ToolExecutionKind),\n}) {}\n\n/** Monotonic reservations charged before programmatic execution or grace finalization. */\nexport class RunPolicyUsageReserved extends Schema.TaggedClass<RunPolicyUsageReserved>()(\n \"RunPolicyUsageReserved\",\n {\n runId: RunId,\n programmaticToolCalls: RunPolicyUsage.fields.programmaticToolCalls,\n finalizationUsed: RunPolicyUsage.fields.finalizationUsed,\n },\n) {}\n\n/**\n * A durable Unknown Outcome: the external effect of one prepared ordinary Tool Call may have\n * happened but was not confirmed canonically (DUR-009/DUR-017). It is neither success nor\n * ordinary failure; automatic continuation stops until an authorized resolution arrives.\n */\nexport class ToolCallUnknown extends Schema.TaggedClass<ToolCallUnknown>(\n \"@effect-agent/thread/ToolCallUnknown\",\n)(\"ToolCallUnknown\", {\n runId: RunId,\n turn: TurnNumber,\n toolCallId: ToolCallId,\n toolName: BoundedName,\n reason: BoundedText,\n}) {}\n\n/** How one open/unknown Tool Call was authoritatively closed (DUR-017 resolution audit). */\nexport const ToolCallResolution = Schema.Literals([\n \"completed-with-result\",\n \"failed-with-error\",\n \"never-started\",\n \"safe-retry\",\n]);\n\nexport type ToolCallResolution = typeof ToolCallResolution.Type;\n\n/**\n * The canonical audit record closing one open or unknown Tool Call: reconciler-recovered supplier\n * truth or an authorized `resolveUnknown` command. `author`/`reason` make every resolution an\n * attributable decision (DUR-017); a `completed-with-result` resolution is accompanied by the\n * per-call `ToolCallSettled` record carrying the recovered result.\n */\nexport class ToolCallResolved extends Schema.TaggedClass<ToolCallResolved>(\n \"@effect-agent/thread/ToolCallResolved\",\n)(\"ToolCallResolved\", {\n runId: RunId,\n toolCallId: ToolCallId,\n resolution: ToolCallResolution,\n author: BoundedName,\n reason: BoundedText,\n}) {}\n\n/**\n * One accepted Durable Step result (durability §11): exactly-once-recorded while the Step's\n * external side effect stays honestly at-least-once-executed. Only success is recorded — a failing\n * Step body fails into the handler's error channel and re-executes on re-entry. `output` is the\n * Schema-encoded Step output; `outputDigest` pins it for replay-divergence detection.\n */\nexport class ToolStepSettled extends Schema.TaggedClass<ToolStepSettled>(\n \"@effect-agent/thread/ToolStepSettled\",\n)(\"ToolStepSettled\", {\n runId: RunId,\n toolCallId: ToolCallId,\n stepName: BoundedName,\n output: PersistedJson,\n outputDigest: Digest,\n}) {}\n\n/**\n * A canonical approval request for one declared Tool Call (CAP-006, durability §8): with this\n * record durable, \"waiting for explicit approval\" is a safe suspension boundary — the resumed\n * Attempt replays the declared batch instead of re-invoking the model.\n */\nexport class ToolApprovalRequested extends Schema.TaggedClass<ToolApprovalRequested>(\n \"@effect-agent/thread/ToolApprovalRequested\",\n)(\"ToolApprovalRequested\", {\n runId: RunId,\n turnId: TurnId,\n turn: TurnNumber,\n toolCallId: ToolCallId,\n toolName: BoundedName,\n parametersDigest: Digest,\n}) {}\n\n/** The two-valued approval decision family shared by canonical records and ledger intents. */\nexport const ApprovalDecision = Schema.Literals([\"approved\", \"denied\"]);\nexport type ApprovalDecision = typeof ApprovalDecision.Type;\n\n/**\n * The canonical decision for one requested approval. Appended by the deciding Attempt (policy\n * auto-decisions) or by the resuming Attempt after a durable `resolveApproval` intent; it is the\n * deterministic decision authority for every later Attempt of the same Run.\n */\nexport class ToolApprovalDecided extends Schema.TaggedClass<ToolApprovalDecided>(\n \"@effect-agent/thread/ToolApprovalDecided\",\n)(\"ToolApprovalDecided\", {\n runId: RunId,\n turn: TurnNumber,\n toolCallId: ToolCallId,\n decision: ApprovalDecision,\n resolver: BoundedName,\n reason: BoundedText,\n}) {}\n\n/**\n * First-class interruption audit (durability §9): appended by a superseding Attempt before it\n * re-invokes the model for a Turn whose prior owner died without a complete canonical response.\n * Duplicate provider cost is thereby possible AND observable in canonical history.\n */\nexport class ModelResponseInterrupted extends Schema.TaggedClass<ModelResponseInterrupted>(\n \"@effect-agent/thread/ModelResponseInterrupted\",\n)(\"ModelResponseInterrupted\", {\n runId: RunId,\n supersededEpoch: ProducerEpoch,\n attemptId: AttemptId,\n reason: BoundedText,\n}) {}\n\n/**\n * One engine-native compaction committed before the pre-Turn view changes (RUN-026).\n * `coversThrough` is a Thread record sequence: the projection\n * renders records at or below it as a summary (`summarize`), a fresh window (`rollover`), or with\n * cleared tool results (kind `clear-tool-results`), never erasing source\n * history. The record carries no digest by decision: it is appended by the\n * fenced owner into the very log it covers, and re-verifying a digest would\n * re-read the covered range on every wake — the O(history) work compaction\n * exists to remove. Host-supplied ContextCompactor decisions use this same commit path.\n * Summaries exceeding BoundedText are rejected before append, never truncated.\n * `summary` is present exactly for `summarize` records; the projection\n * treats a summarize record without one as invalid and ignores it fail-safe.\n */\nexport class CompactionCreated extends Schema.TaggedClass<CompactionCreated>(\n \"@effect-agent/thread/CompactionCreated\",\n)(\"CompactionCreated\", {\n runId: RunId,\n turn: TurnNumber,\n kind: Schema.Literals([\"clear-tool-results\", \"summarize\", \"rollover\"]),\n coversThrough: CanonicalSequence,\n summary: Schema.optionalKey(BoundedText),\n handoff: Schema.optionalKey(ContextHandoff),\n}) {}\n\nexport class RunFailed extends Schema.TaggedClass<RunFailed>(\"@effect-agent/thread/RunFailed\")(\n \"RunFailed\",\n {\n runId: RunId,\n failure: PersistedJson,\n },\n) {}\n\nconst RunCompletedFields = Schema.Struct({\n runId: RunId,\n output: PersistedJson,\n /** Application disposition captured with an ordinary completion. */\n runDisposition: Schema.optionalKey(PersistedJson),\n /** Honest soft-landing marker, present exactly when `exhausted` is present. */\n finishReason: Schema.optionalKey(Schema.Literal(\"budget-exhausted\")),\n /** Budget dimension paired with `finishReason` on a soft landing. */\n exhausted: Schema.optionalKey(ExhaustedLimit),\n}).check(\n Schema.makeFilter(\n (completed) =>\n (completed.finishReason === undefined) === (completed.exhausted === undefined) &&\n (completed.runDisposition === undefined || completed.finishReason === undefined),\n { title: \"Run completion metadata matches its terminal family\" },\n ),\n);\n\nexport class RunCompleted extends Schema.TaggedClass<RunCompleted>(\n \"@effect-agent/thread/RunCompleted\",\n)(\"RunCompleted\", RunCompletedFields) {}\n\nexport class RepairAnnotated extends Schema.TaggedClass<RepairAnnotated>(\n \"@effect-agent/thread/RepairAnnotated\",\n)(\"RepairAnnotated\", {\n reason: BoundedText,\n details: PersistedJson,\n}) {}\n\n/** Terminal outcome family for one accepted Submission (DUR-002). */\nexport const SettlementOutcome = Schema.Literals([\"completed\", \"failed\", \"aborted\"]);\nexport type SettlementOutcome = typeof SettlementOutcome.Type;\n\n/**\n * A durable abort command made canonical before the active worker is interrupted (DUR-012).\n * Repeating the same abort command is idempotent; abort never rewrites a prior terminal outcome.\n */\nexport class AbortRequested extends Schema.TaggedClass<AbortRequested>(\n \"@effect-agent/thread/AbortRequested\",\n)(\"AbortRequested\", {\n submissionId: SubmissionId,\n author: BoundedName,\n reason: BoundedText,\n}) {}\n\n/**\n * The single canonical settlement record owed to one accepted Submission (DUR-002, DUR-011).\n * Canonical history is the outcome authority: the ledger row is finalized from this record and\n * never the other way around (DUR-015).\n */\nconst RawSubmissionSettled = Schema.Struct({\n submissionId: SubmissionId,\n settlementId: SettlementId,\n receiptId: ReceiptId,\n outcome: SettlementOutcome,\n runId: Schema.optionalKey(RunId),\n result: Schema.optionalKey(PersistedJson),\n /**\n * Application-defined, Schema-encoded disposition for an ordinary completed\n * Run. Absent for budget exhaustion and every non-completed or run-less\n * settlement; consumers decode it with the application definition's Schema.\n */\n runDisposition: Schema.optionalKey(PersistedJson),\n /**\n * Present only when a `completed` Run settled through the final-answer\n * exhaustion resolution (RUN-011, RUN-018): the durable log must be able to\n * distinguish honest-exhaustion completion from ordinary completion without\n * the live event stream. Absent for every ordinary settlement, keeping\n * existing histories and goldens byte-stable (additive, schemaVersion 1).\n */\n finishReason: Schema.optionalKey(Schema.Literal(\"budget-exhausted\")),\n /**\n * The dimension that bound a budget-exhausted completion (RUN-011,\n * RUN-025), carried verbatim from the live `RunCompleted` event so\n * consumers never reconstruct it from message text. Valid only alongside\n * `finishReason: \"budget-exhausted\"`; absent on histories persisted before\n * the dimension became durable (additive, schemaVersion 1).\n */\n exhausted: Schema.optionalKey(ExhaustedLimit),\n /**\n * The typed `AgentPolicyError.limit` of a `failed` hard-rail settlement\n * (RUN-011): which finite policy dimension failed the Run, preserved\n * alongside the bounded `{errorTag, message}` failure projection in\n * `result`. Absent for every non-policy failure and on histories persisted\n * before the limit became durable (additive, schemaVersion 1).\n */\n policyLimit: Schema.optionalKey(PolicyLimit),\n /** Canonical aggregate of all priced model calls made by this Run. */\n usageSummary: Schema.optionalKey(RunUsageSummary),\n /** Calls included in usageSummary but not in any ModelResponseRecorded, retained on failure. */\n uncommittedModelUsage: Schema.optionalKey(Schema.Array(ModelCallUsage)),\n});\n\nconst isPolicyFailureProjection = Schema.is(\n Schema.Struct({ errorTag: Schema.Literal(\"AgentPolicyError\") }),\n);\n\nconst decodeSettlementFailureDiagnostic = Schema.decodeUnknownOption(SettlementFailureDiagnostic, {\n onExcessProperty: \"error\",\n});\n\nconst hasValidSettlementFamily = (settled: typeof RawSubmissionSettled.Type): boolean =>\n (settled.finishReason === undefined || settled.outcome === \"completed\") &&\n (settled.finishReason === undefined) === (settled.exhausted === undefined) &&\n (settled.usageSummary === undefined || settled.runId !== undefined) &&\n (settled.uncommittedModelUsage === undefined ||\n (settled.runId !== undefined && settled.usageSummary !== undefined)) &&\n (settled.runDisposition === undefined ||\n (settled.outcome === \"completed\" &&\n settled.finishReason === undefined &&\n settled.runId !== undefined &&\n settled.result !== undefined)) &&\n (settled.outcome !== \"failed\" ||\n Option.isSome(decodeSettlementFailureDiagnostic(settled.result))) &&\n (settled.outcome !== \"aborted\" || settled.result === undefined) &&\n (settled.policyLimit === undefined ||\n (settled.outcome === \"failed\" && isPolicyFailureProjection(settled.result)));\n\nconst SubmissionSettledFields = RawSubmissionSettled.check(\n Schema.makeFilter(hasValidSettlementFamily, {\n title:\n \"failed settlements require a bounded diagnostic; aborted settlements carry no result; budget metadata must match its settlement family\",\n }),\n);\n\nexport class SubmissionSettled extends Schema.TaggedClass<SubmissionSettled>(\n \"@effect-agent/thread/SubmissionSettled\",\n)(\"SubmissionSettled\", SubmissionSettledFields) {}\n\n/** Canonical completed settlement; joined completion may legitimately carry no independent result. */\nexport type CompletedSubmissionSettled = SubmissionSettled & {\n readonly outcome: \"completed\";\n};\n\n/** Canonical failed settlement; its bounded diagnostic is required and typed. */\nexport type FailedSubmissionSettled = SubmissionSettled & {\n readonly outcome: \"failed\";\n readonly result: SettlementFailureDiagnostic;\n};\n\n/** Canonical aborted settlement; abort records intent rather than fabricating a terminal result. */\nexport type AbortedSubmissionSettled = SubmissionSettled & {\n readonly outcome: \"aborted\";\n readonly result?: never;\n};\n\nexport type SubmissionSettledRecord =\n | CompletedSubmissionSettled\n | FailedSubmissionSettled\n | AbortedSubmissionSettled;\n\n/**\n * Canonical-boundary view of `SubmissionSettled`: `finishReason` is valid\n * only on a `completed` outcome, `exhausted` only alongside\n * `finishReason: \"budget-exhausted\"`, every `failed` outcome requires the exact bounded\n * `SettlementFailureDiagnostic`, aborted outcomes carry no result, and `policyLimit` only occurs\n * on a `failed` outcome whose diagnostic carries the `AgentPolicyError` tag. `runDisposition`\n * occurs only on an ordinary completed settlement with a Run —\n * so a malformed persisted combination such as\n * `{ outcome: \"failed\", finishReason: \"budget-exhausted\" }` or a\n * `policyLimit` contradicting `result.errorTag` fails closed at decode\n * instead of becoming trusted audit history (STORE-006, RUN-011).\n */\nexport const SubmissionSettledRecord = SubmissionSettled.pipe(\n Schema.refine(\n (settled): settled is SubmissionSettledRecord => hasValidSettlementFamily(settled),\n {\n expected:\n \"failed settlements require a bounded diagnostic, aborted settlements carry no result, finishReason only occurs on completed settlements, exhausted only occurs with finishReason budget-exhausted, runDisposition only occurs on an ordinary completed settlement with a Run result, and policyLimit only occurs on a failed AgentPolicyError settlement\",\n },\n ),\n);\n\n/**\n * PARENT-log record of one durable child establishment request:\n * the exact parent Tool Call, delegation and target identity, the digests that pin the child's\n * Binding/input/grant, the fenced budget reservation, and the INTENDED child identity derived\n * deterministically from the parent Run and Tool Call pair (D4). `childInput` carries the\n * prepared child input in encoded form (D3) so recovery can complete child admission from this\n * record alone — no live delegation handler is required. `childPrincipal`/`childIdempotencyKey`\n * carry the ledger admission scope with the ledger's exact bounds; the layering keeps their\n * branded Schemas in the ledger port.\n */\nexport class SubagentRequested extends Schema.TaggedClass<SubagentRequested>(\n \"@effect-agent/thread/SubagentRequested\",\n)(\"SubagentRequested\", {\n runId: RunId,\n turnId: TurnId,\n turn: TurnNumber,\n toolCallId: ToolCallId,\n delegationId: DelegationId,\n targetAgentId: AgentId,\n targetDigests: DefinitionDigests,\n childInput: PersistedJson,\n childInputDigest: Digest,\n grantDigest: Digest,\n reservationId: BoundedName,\n reservationDigest: Digest,\n childThreadId: ThreadId,\n childPrincipal: BoundedName,\n childIdempotencyKey: BoundedName,\n /** Effective invocation bound, already clamped to the delegation and child Definition. */\n toolCallAllowance: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),\n policy: Schema.optionalKey(Schema.toCodecJson(AgentPolicy)),\n budget: Schema.optionalKey(SubagentBudgetReservation),\n grant: Schema.optionalKey(SubagentGrant),\n depth: Schema.optionalKey(DelegationDepth),\n}) {}\n\n/**\n * PARENT-log record that the intended child exists as accepted work:\n * the full established child identity. It is appended only after the child Receipt\n * exists — SUB-017 holds by construction because `childReceiptId` is a required field.\n */\nexport class SubagentStarted extends Schema.TaggedClass<SubagentStarted>(\n \"@effect-agent/thread/SubagentStarted\",\n)(\"SubagentStarted\", {\n runId: RunId,\n toolCallId: ToolCallId,\n childThreadId: ThreadId,\n childSubmissionId: SubmissionId,\n childReceiptId: ReceiptId,\n childRunId: RunId,\n}) {}\n\n/**\n * PARENT-log record of one verified child settlement join:\n * the child's canonical Settlement identity and outcome, the digests pinning the verified child\n * result and the bounded projected parent result, the child usage summary, and the FINAL\n * consumed/released accounting decision for the reservation. It commits in ONE atomic batch with\n * the parent `ToolCallSettled` record (SUB-019); `beginChildBudgetRelease` replays\n * `finalAccounting` from this record, so canonical history authorizes the release (DUR-015).\n */\nexport class SubagentJoined extends Schema.TaggedClass<SubagentJoined>(\n \"@effect-agent/thread/SubagentJoined\",\n)(\"SubagentJoined\", {\n runId: RunId,\n toolCallId: ToolCallId,\n childSubmissionId: SubmissionId,\n childSettlementId: SettlementId,\n childOutcome: SettlementOutcome,\n childResultDigest: Digest,\n projectedResultDigest: Digest,\n usageSummary: PersistedJson,\n usage: Schema.optionalKey(RunTotals),\n delegatedUsage: Schema.optionalKey(RunTotals),\n reservationId: BoundedName,\n finalAccounting: PersistedJson,\n}) {}\n\n/**\n * CHILD-log immutable lineage: the Parent Link plus the digests that pin\n * the child's definition, input, and authority grant. It is the first record after the child's\n * `ThreadCreated` (its own single-record batch, so the generic `thread-created:{cid}`\n * batch identity is never contradicted) and the join path verifies it fail-closed — a fabricated\n * child or parent identity fails Parent Link verification (SUB-004, D10).\n */\nexport class SubagentLineageRecorded extends Schema.TaggedClass<SubagentLineageRecorded>(\n \"@effect-agent/thread/SubagentLineageRecorded\",\n)(\"SubagentLineageRecorded\", {\n parentLink: SubagentParentLink,\n parentSubmissionId: SubmissionId,\n childDefinitionDigests: DefinitionDigests,\n childInputDigest: Digest,\n grantDigest: Digest,\n /** Copied from the canonical request before readiness; restored for every child Attempt. */\n toolCallAllowance: SubagentRequested.fields.toolCallAllowance,\n policy: SubagentRequested.fields.policy,\n budget: SubagentRequested.fields.budget,\n grant: SubagentRequested.fields.grant,\n}) {}\n\nexport const WorkerReportingIntent = Schema.Struct({\n /** Omitted preserves existing application-mapped reports. */\n mode: Schema.optionalKey(Schema.Literal(\"standard\")),\n sourceDigests: DefinitionDigests,\n destinationDelegationId: Schema.optionalKey(DelegationId),\n});\n\n/** Immutable worker Thread origin. Each input has its own digest and parameters separately. */\nexport const WorkerOrigin = Schema.Struct({\n worker: WorkerRef,\n source: WorkerSource,\n /** Omitted retains source-subtree funding; worker-run renews only for a new native Run. */\n budgetScope: Schema.optionalKey(WorkerBudgetScope),\n targetDigests: DefinitionDigests,\n policy: Schema.toCodecJson(AgentPolicy),\n budget: SubagentBudgetReservation,\n grant: SubagentGrant,\n depth: DelegationDepth,\n toolCallAllowance: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),\n firstMessageId: IdempotencyKey,\n createdAtMillis: Schema.Natural,\n expiresAtMillis: Schema.Natural,\n /** Exact source registration owns projection; absence means reporting was not declared. */\n reporting: Schema.optionalKey(WorkerReportingIntent),\n}).check(Schema.makeFilter((value) => value.expiresAtMillis > value.createdAtMillis));\n\nexport type WorkerOrigin = typeof WorkerOrigin.Type;\n\n/** Frozen per-input metadata; it grants no attached-child or parent-abort semantics. */\nexport const WorkerAdmission = Schema.Struct({\n origin: WorkerOrigin,\n messageId: IdempotencyKey,\n parameters: PersistedJson,\n createdAtMillis: Schema.Natural,\n /** Host-bound source input whose subtree funds this input; never chosen by a model. */\n sourceSubmissionId: Schema.optionalKey(SubmissionId),\n /** Enables routed receipt lookup when the delivery is owned by a reporting child. */\n deliveryPrincipal: Schema.optionalKey(Principal),\n /** Proven framework updates use a separate bounded input-capacity partition. */\n reportKind: Schema.optionalKey(Schema.Literal(\"update\")),\n});\n\nexport type WorkerAdmission = typeof WorkerAdmission.Type;\n\n/** Source-log capacity reservation, retained independently of the source Run's settlement. */\nexport class WorkerInputRequested extends Schema.TaggedClass<WorkerInputRequested>()(\n \"WorkerInputRequested\",\n { admission: WorkerAdmission, inputDigest: Digest },\n) {}\n\n/** Child-log origin, reconstructed from a retained delivery before the child becomes ready. */\nexport class WorkerOriginRecorded extends Schema.TaggedClass<WorkerOriginRecorded>()(\n \"WorkerOriginRecorded\",\n { origin: WorkerOrigin },\n) {}\n\n/** Canonical child completion acknowledgement releases only this input's active capacity. */\nexport class WorkerInputCompleted extends Schema.TaggedClass<WorkerInputCompleted>()(\n \"WorkerInputCompleted\",\n {\n messageId: IdempotencyKey,\n workerThreadId: ThreadId,\n submissionId: SubmissionId,\n receiptId: ReceiptId,\n settlementId: SettlementId,\n completedAtMillis: Schema.Natural,\n },\n) {}\n\n/**\n * Frozen report decision for one actual Run, shared by every joined Receipt. The envelope is\n * a Schema-encoded PreparedInput, validated before append and decoded again on recovery.\n * Keeping the encoded value here avoids a Records/PreparedInput schema dependency cycle.\n */\nexport class WorkerReportPrepared extends Schema.TaggedClass<WorkerReportPrepared>()(\n \"WorkerReportPrepared\",\n {\n runId: RunId,\n messageId: IdempotencyKey,\n envelope: PersistedJson,\n createdAtMillis: Schema.Natural,\n deadlineAtMillis: Schema.Natural,\n predecessor: Schema.optionalKey(IdempotencyKey),\n },\n) {}\n\n/** Accepted update and its optional frozen parent delivery are one atomic canonical fact. */\nexport class AgentUpdateEmitted extends Schema.TaggedClass<AgentUpdateEmitted>()(\n \"AgentUpdateEmitted\",\n {\n update: Update,\n definitions: DefinitionDigests,\n delivery: Schema.optionalKey(\n Schema.Struct({\n messageId: IdempotencyKey,\n envelope: PersistedJson,\n createdAtMillis: Schema.Natural,\n deadlineAtMillis: Schema.Natural,\n predecessor: Schema.optionalKey(IdempotencyKey),\n }),\n ),\n },\n) {}\n\n/** Permanent bounded report refusal. Application errors and raw Run dispositions stay private. */\nexport class WorkerReportRefused extends Schema.TaggedClass<WorkerReportRefused>()(\n \"WorkerReportRefused\",\n {\n runId: RunId,\n messageId: IdempotencyKey,\n reason: Schema.Literals([\n \"declaration-unavailable\",\n \"destination\",\n \"projection\",\n \"input\",\n \"preparation\",\n \"timeout\",\n \"defect\",\n \"expired\",\n \"denied\",\n \"capacity\",\n ]),\n },\n) {}\n\n/** Frozen source proof of peer provenance, readable through routed canonical storage. */\nexport class PeerMessagePrepared extends Schema.TaggedClass<PeerMessagePrepared>()(\n \"PeerMessagePrepared\",\n {\n messageId: IdempotencyKey,\n sourcePrincipal: Principal,\n operation: Schema.Literals([\"send\", \"reply\"]),\n deadlineAtMillis: Schema.Int.check(Schema.isGreaterThan(0)),\n encodedEnvelope: PersistedJson,\n },\n) {}\n\n/**\n * One disjoint subtree slice shared by attached and background children of a source input.\n * The source keeps its own execution ceiling; descendants spend only the remaining allocation.\n * Reservations include future descendant slots and never refund, including after interruption.\n * resultBytes reserves the terminal/projection result, not cumulative Tool output bytes.\n */\nexport class SubtreeBudgetReserved extends Schema.TaggedClass<SubtreeBudgetReserved>()(\n \"SubtreeBudgetReserved\",\n {\n reservationId: BoundedName,\n sourceSubmissionId: Schema.optionalKey(SubmissionId),\n childThreadId: ThreadId,\n lifetime: Schema.Literals([\"attached\", \"background\"]),\n depth: DelegationDepth,\n policy: Schema.toCodecJson(AgentPolicy),\n grant: SubagentGrant,\n budget: SubagentBudgetReservation,\n },\n) {}\n\n/**\n * Current private-development canonical payload family. Phase 5 adds the seven durable-Tool tags\n * (prepared/unknown/resolved/step/approval-request/approval-decision/interrupted) additively; S2\n * adds the four durable-Subagent tags (requested/started/joined/lineage) additively, so the\n * envelope keeps `schemaVersion: 1` (P4 precedent for additive payload tags).\n */\nexport const CanonicalRecordPayload = Schema.Union([\n ThreadCreated,\n UserInputRecorded,\n RunStartedRecord,\n RunDurationExhausted,\n RunPolicyUsageReserved,\n ModelCompleted,\n ModelResponseRecorded,\n ToolCallPrepared,\n ToolCallSettled,\n ToolCallUnknown,\n ToolCallResolved,\n ToolStepSettled,\n ToolApprovalRequested,\n ToolApprovalDecided,\n ModelResponseInterrupted,\n CompactionCreated,\n RunFailed,\n RunCompleted,\n AbortRequested,\n SubmissionSettledRecord,\n SubagentRequested,\n SubagentStarted,\n SubagentJoined,\n SubagentLineageRecorded,\n WorkerInputRequested,\n WorkerOriginRecorded,\n WorkerInputCompleted,\n WorkerReportPrepared,\n AgentUpdateEmitted,\n WorkerReportRefused,\n PeerMessagePrepared,\n SubtreeBudgetReserved,\n RepairAnnotated,\n]);\n\nexport type CanonicalRecordPayload = typeof CanonicalRecordPayload.Type;\n\n/**\n * Versioned record envelope stored in an atomic batch. Thread ordering is assigned only\n * when the batch is committed.\n */\nexport class RecordEnvelope extends Schema.Class<RecordEnvelope>(\n \"@effect-agent/thread/RecordEnvelope\",\n)({\n recordId: RecordId,\n family: Schema.Literal(\"thread\"),\n schemaVersion: Schema.Literal(1),\n createdAt: Schema.DateTimeUtcFromString,\n deploymentId: DeploymentId,\n payload: CanonicalRecordPayload,\n}) {}\n\n/** Backward-compatible domain name for a canonical record. */\nexport const CanonicalRecord = RecordEnvelope;\nexport type CanonicalRecord = RecordEnvelope;\n\n/** One non-empty, bounded, idempotent atomic append unit. */\nexport class CanonicalBatch extends Schema.Class<CanonicalBatch>(\n \"@effect-agent/thread/CanonicalBatch\",\n)({\n batchId: BatchId,\n producerId: ProducerId,\n records: Schema.NonEmptyArray(RecordEnvelope).check(Schema.isMaxLength(256)),\n}) {}\n\n/**\n * A committed record with its Thread ordering and opaque resumable observation cursor.\n */\nexport class CanonicalRecordEnvelope extends Schema.Class<CanonicalRecordEnvelope>(\n \"@effect-agent/thread/CanonicalRecordEnvelope\",\n)({\n threadId: ThreadId,\n batchId: BatchId,\n sequence: CanonicalSequence,\n offset: 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Q,CAAC;CAC/B,WAAW,OAAO;CAClB,cAAc;CACd,SAAS;AACX,CAAC,CAAC,CAAC,CAAC;;AAGJ,MAAa,kBAAkB;;AAI/B,IAAa,iBAAb,cAAoC,OAAO,MACzC,qCACF,CAAC,CAAC;CACA,SAAS;CACT,YAAY;CACZ,SAAS,OAAO,cAAc,cAAc,CAAC,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC;AAC7E,CAAC,CAAC,CAAC,CAAC;;;;AAKJ,IAAa,0BAAb,cAA6C,OAAO,MAClD,8CACF,CAAC,CAAC;CACA,UAAU;CACV,SAAS;CACT,UAAU;CACV,QAAQ;CACR,QAAQ;AACV,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAa,mCAAmC"}
@@ -1613,16 +1613,37 @@ declare const BindingManifest_base: Schema.Class<BindingManifest, Schema.Struct<
1613
1613
  readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1614
1614
  readonly definitions: typeof DefinitionDigestInput;
1615
1615
  readonly replay: typeof ReplayContract;
1616
+ readonly agentContract: Schema.optionalKey<Schema.Struct<{
1617
+ readonly version: Schema.declare<Schema.Json, Schema.Json>;
1618
+ readonly id: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1619
+ readonly input: Schema.declare<Schema.Json, Schema.Json>;
1620
+ readonly output: Schema.declare<Schema.Json, Schema.Json>;
1621
+ readonly updates: Schema.NullOr<Schema.declare<Schema.Json, Schema.Json>>;
1622
+ readonly completion: Schema.NullOr<Schema.Struct<{
1623
+ readonly tool: Schema.String;
1624
+ readonly required: Schema.Boolean;
1625
+ }>>;
1626
+ readonly completionFromTools: Schema.$Array<Schema.String>;
1627
+ readonly disposition: Schema.NullOr<Schema.declare<Schema.Json, Schema.Json>>;
1628
+ }>>;
1629
+ readonly toolContracts: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
1630
+ readonly version: Schema.declare<Schema.Json, Schema.Json>;
1631
+ readonly parameters: Schema.declare<Schema.Json, Schema.Json>;
1632
+ readonly success: Schema.declare<Schema.Json, Schema.Json>;
1633
+ readonly failure: Schema.declare<Schema.Json, Schema.Json>;
1634
+ readonly failureMode: Schema.String;
1635
+ readonly needsApproval: Schema.Union<readonly [Schema.Boolean, Schema.Literal<"dynamic">]>;
1636
+ readonly executionClass: Schema.String;
1637
+ readonly executionKind: Schema.String;
1638
+ }>>>;
1616
1639
  }>, {}>;
1617
- /**
1618
- * Data exported from a definition, never an old executable Binding. A host may supply an audited
1619
- * manifest from the original release for work admitted before replay contracts were retained.
1620
- * Its original declarations must hash to that admission; a bare old digest is not a manifest.
1621
- */
1622
1640
  declare class BindingManifest extends BindingManifest_base {}
1623
1641
  declare const makeBindingManifest: (definition: Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined>, definitions: DefinitionDigestInput, versions: ReplayVersions) => Effect.Effect<BindingManifest, DigestError, Crypto.Crypto>;
1642
+ /** Compile audited declaration data once, without acquiring an executable or rewriting receipts.
1643
+ * Full input schemas stay in registration metadata, never in each admission's replay contract. */
1644
+ declare const compileBindingManifest: (definition: Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined>, definitions: DefinitionDigestInput, versions: ReplayVersions, retained?: readonly BindingManifest[] | undefined) => Effect.Effect<Pick<ResolvedBinding, "acceptsInput" | "digests" | "manifest" | "retainedManifests">, DigestError, Crypto.Crypto>;
1624
1645
  /** Resolve executable code only. Admission, delivery, lineage and receipt comparisons stay exact. */
1625
- declare const bindingSupports: (binding: Pick<ResolvedBinding, "digests" | "retainedManifests">, digests: DefinitionDigests, requiredTools?: ReadonlyArray<string>) => boolean;
1646
+ declare const bindingSupports: (binding: Pick<ResolvedBinding, "digests" | "retainedManifests" | "acceptsInput">, digests: DefinitionDigests, requiredTools?: ReadonlyArray<string>, input?: PersistedJson) => boolean;
1626
1647
  type ExecutableDefinition = AnyDefinition & {
1627
1648
  readonly instructions: InstructionSource<never, unknown, unknown>;
1628
1649
  readonly inputPrompt?: InputPromptSource<never, unknown, unknown> | undefined;
@@ -1654,9 +1675,14 @@ type ReportRequirements<Reports> = Reports extends ReadonlyArray<WorkerReporting
1654
1675
  interface ResolvedBinding extends CapturedBinding {
1655
1676
  readonly digests: DefinitionDigests;
1656
1677
  readonly manifest?: BindingManifest;
1678
+ /** Current encoded input guard, acquired without executable services. */
1679
+ readonly acceptsInput?: (input: PersistedJson) => boolean;
1657
1680
  readonly retainedManifests?: ReadonlyArray<{
1658
1681
  readonly digests: DefinitionDigests;
1659
1682
  readonly replay: ReplayContract;
1683
+ readonly compatibleTools?: Readonly<Record<string, string>>;
1684
+ /** Original declarations prove unchanged semantics and output/completion contracts. */
1685
+ readonly compatibleAgent?: string;
1660
1686
  }>;
1661
1687
  }
1662
1688
  /** Trusted claim identity for resolving per-Attempt application services. Not model input. */
@@ -1721,7 +1747,7 @@ type RegistrationRequirements<Entries extends ReadonlyArray<AgentRegistration>>
1721
1747
  /** Compile heterogeneous Agent descriptors into exact, dependency-closed worker registrations. */
1722
1748
  declare const compileRegistrations: <const Entries extends ReadonlyArray<AgentRegistration>>(entries: Entries) => Effect.Effect<ReadonlyArray<ResolvedBinding>, DigestError, Crypto.Crypto | RegistrationRequirements<Entries>>;
1723
1749
  declare namespace AgentRegistration_d_exports {
1724
- export { AgentAttemptContext, AgentRegistration, BindingDigestMismatch, BindingManifest, BindingUnavailable, DurableBindingFailure, DurableWorkerBinding, ExecutableAgentBinding, ReplayVersions, ResolvedBinding, bindingSupports, compileRegistrations, definitionDigestsEqual, makeBindingManifest };
1750
+ export { AgentAttemptContext, AgentRegistration, BindingDigestMismatch, BindingManifest, BindingUnavailable, DurableBindingFailure, DurableWorkerBinding, ExecutableAgentBinding, ReplayVersions, ResolvedBinding, bindingSupports, compileBindingManifest, compileRegistrations, definitionDigestsEqual, makeBindingManifest };
1725
1751
  }
1726
1752
  declare namespace Admin_d_exports {
1727
1753
  export { ExplainedEvidence, ExplainedSubmission, ExplainedUnknownCall, IntegrityCheck, IntegrityCheckName, IntegrityCheckStatus, IntegrityReport, ObligationBlockedOn, ObligationEntry, ObligationReport, ObligationSeverity, ObligationThresholds, RECOVERY_DECISION_MEANINGS, RecoveryDisposition, RecoveryExplanation, RetryCommand, RetryRefusalReason, RetryRefused, obligationSeverityOf, predictRecoveryDisposition, recoveryDecisionMeaning, renderRecoveryExplanation };
@@ -2858,6 +2884,8 @@ declare const DefinitionDigestInput_base: Schema.Class<DefinitionDigestInput, Sc
2858
2884
  declare class DefinitionDigestInput extends DefinitionDigestInput_base {}
2859
2885
  declare const ReplayContract_base: Schema.Class<ReplayContract, Schema.Struct<{
2860
2886
  readonly agent: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
2887
+ /** Agent semantics and output/completion codecs; the saved input is checked separately. */
2888
+ readonly agentBehavior: Schema.optionalKey<Schema.brand<Schema.String, "@effect-agent/thread/Digest">>;
2861
2889
  readonly tools: Schema.$Record<Schema.String, Schema.brand<Schema.String, "@effect-agent/thread/Digest">>;
2862
2890
  }>, {}>;
2863
2891
  /** The contracts a retained Run may decode or execute, independent of its deployment. */
@@ -3642,5 +3670,5 @@ declare const CanonicalRecordEnvelope_base: Schema.Class<CanonicalRecordEnvelope
3642
3670
  declare class CanonicalRecordEnvelope extends CanonicalRecordEnvelope_base {}
3643
3671
  declare const CURRENT_CANONICAL_SCHEMA_VERSION: 1;
3644
3672
  //#endregion
3645
- export { ToolCallPrepared as $, SubmissionLookupById as $a, ApprovalConflict as $i, toolCallUnknownRecordId as $n, digestDefinition as $r, ThreadMaterialization as $t, ProducerId as A, ParentLinkage as Aa, RepairReadiness as Ai, projectRunJournalStream as An, obligationSeverityOf as Ar, DurableSubmitOptions as At, RunStartedRecord as B, ResolutionNeverHappened as Ba, AbortCommand as Bi, subagentLineageBatchId as Bn, DurableBindingFailure as Br, AppendConflict as Bt, ModelCompleted as C, MarkJoinedRequest as Ca, PropagateChildAbort as Ci, compactionBatchId as Cn, ObligationThresholds as Cr, DurableProgressFailure as Ct, PeerMessagePrepared as D, OwnershipRenewal as Da, ReleaseOrphanChildReservation as Di, modelResponseInterruptedRecordId as Dn, RetryCommand as Dr, DurableRuntimeConfigOptions as Dt, ObservationOffset as E, OwnershipLost as Ea, Recovery_d_exports as Ei, modelResponseInterruptedBatchId as En, RecoveryExplanation as Er, DurableRuntimeConfig as Et, ReplayContract as F, RenewOwnershipRequest as Fa, ResumeWaitingParent as Fi, runIdForSubmission as Fn, AgentAttemptContext as Fr, childReservationIdFor as Ft, SubagentRequested as G, SettlementFinalization as Ga, AdmissionFence as Gi, subagentStartedRecordId as Gn, bindingSupports as Gr, LoadCheckpointRequest as Gt, SettlementOutcome as H, RevertJoiningRequest as Ha, AbortIntentRequest as Hi, subagentRequestedBatchId as Hn, ExecutableAgentBinding as Hr, CheckpointRejected as Ht, RunCompleted as I, ReservedChildBudget as Ia, RevertJoining as Ii, runStartedBatchId as In, AgentRegistration as Ir, recoveryRepairBatchId as It, SubmissionSettledRecord as J, SubmissionAdmissionFence as Ja, AdmissionNotAdmitted as Ji, toolCallPreparedRecordId as Jn, makeBindingManifest as Jr, SaveRecoveryCheckpointRequest as Jt, SubagentStarted as K, SettlementReservation as Ka, AdmissionGroup as Ki, toolApprovalDecisionRecordId as Kn, compileRegistrations as Kr, MAX_THREAD_EXPORT_RECORDS as Kt, RunDurationExhausted as L, ReservedSettlement as La, SettleAborted as Li, runStartedRecordId as Ln, BindingDigestMismatch as Lr, recoveryRepairRecordId as Lt, RecordId as M, RecoverySnapshotRequest as Ma, ResumeFromTurnBoundary as Mi, runCompletedRecordId as Mn, recoveryDecisionMeaning as Mr, DurableWorkerFailure as Mt, Records_d_exports as N, ReleaseChildBudgetRequest as Na, ResumePendingToolBatch as Ni, runDurationBatchId as Nn, renderRecoveryExplanation as Nr, DurableWorkerRequirements as Nt, PersistedJson as O, OwnershipSnapshot as Oa, RepairInputMarker as Oi, modelResponseRecordId as On, RetryRefusalReason as Or, DurableSubmitAgent as Ot, RepairAnnotated as P, ReleaseOwnershipRequest as Pa, ResumeSuspended as Pi, runDurationRecordId as Pn, AgentRegistration_d_exports as Pr, RecoveryReport as Pt, ToolApprovalRequested as Q, SubmissionLookup as Qa, AdmissionResult as Qi, toolCallSettledRecordId as Qn, digestCanonicalBatch as Qr, ThreadExportRequest as Qt, RunFailed as R, ResolutionAbortSubmission as Ra, SettleJoinedWithHost as Ri, subagentJoinBatchId as Rn, BindingManifest as Rr, threadCreatedBatchId as Rt, MAX_PERSISTED_JSON_NODES as S, MarkInputAppliedRequest as Sa, PendingApprovalEvidence as Si, childThreadIdFor as Sn, ObligationSeverity as Sr, DurableObserveOptions as St, ModelResponseRecorded as T, MarkUnknownRequest as Ta, RecoveryEvidence as Ti, markUnknownBatchId as Tn, RecoveryDisposition as Tr, DurableRetryFailure as Tt, SubagentJoined as U, Settlement as Ua, AdmissionAdmitted as Ui, subagentRequestedRecordId as Un, ReplayVersions as Ur, FenceRejected as Ut, SettlementFailureDiagnostic as V, ResolutionSafeToRetry as Va, AbortIntent as Vi, subagentLineageRecordId as Vn, DurableWorkerBinding as Vr, AppendResult as Vt, SubagentLineageRecorded as W, SettlementConflict as Wa, AdmissionConflict as Wi, subagentStartedBatchId as Wn, ResolvedBinding as Wr, FencedAppendRequest as Wt, ThreadCreated as X, SubmissionLedgerFailure as Xa, AdmissionRequest as Xi, toolCallResolvedRecordId as Xn, Digest_d_exports as Xr, ThreadCheckpoints as Xt, SubtreeBudgetReserved as Y, SubmissionLedger as Ya, AdmissionPolicyError as Yi, toolCallResolutionBatchId as Yn, DigestError as Yr, ThreadCheckpoint as Yt, ToolApprovalDecided as Z, SubmissionLedger_d_exports as Za, AdmissionResolution as Zi, toolCallResultBatchId as Zn, EMPTY_TAIL_DIGEST as Zr, ThreadExport as Zt, Digest as _, InputAppliedMarker as _a, FinalizeLedgerFromHistory as _i, RunJournalUsage as _n, submissionInputRecordId as _o, IntegrityCheckStatus as _r, DurableApprovalFailure as _t, BatchId as a, ChildAttachmentSnapshot as aa, ApplyUnknownResolutions as ai, ThreadStoreError as an, SuspensionReason as ao, turnIdForRun as ar, UserInputRecorded as at, MAX_PERSISTED_JSON_COLLECTION_LENGTH as b, LedgerCapabilities as ba, OpenDelegationCallEvidence as bi, approvalDecisionBatchId as bn, submissionSettlementRecordId as bo, ObligationEntry as br, DurableExplainFailure as bt, CanonicalRecord as c, ChildReservationConflict as ca, AwaitChildSettlement as ci, ThreadTail as cn, UnknownResolutionCommand as co, turnResponseBatchId as cr, WorkerInputRequested as ct, CanonicalSequence as d, ChildSettledNotification as da, AwaitUnknownResolution as di, SettledSubmission as dn, WaitingChild as do, Admin_d_exports as dr, WorkerReportPrepared as dt, ApprovalDecisionCommand as ea, digestDefinitions as ei, ThreadNotMaterialized as en, SubmissionLookupByKey as eo, toolStepSettledBatchId as er, ToolCallResolution as et, CompactionCreated as f, ChildSettledOutcome as fa, CompleteChildAdmission as fi, SubmissionStatus as fn, WaitingForChildSuspension as fo, ExplainedEvidence as fr, WorkerReportRefused as ft, DeploymentId as g, DEFAULT_OWNERSHIP_LEASE_DURATION as ga, EnsureWaitingForChild as gi, RunJournalProjection as gn, submissionInputBatchId as go, IntegrityCheckName as gr, DurableAgentRuntime_d_exports as gt, DefinitionDigests as h, ClaimRequest as ha, DelegationAdmissionEvidence as hi, RunJournalError as hn, submissionAbortRecordId as ho, IntegrityCheck as hr, DurableAgentRuntime as ht, ApprovalDecision as i, BeginChildBudgetReleaseRequest as ia, ApplyJoinAccounting as ii, ThreadStore as in, SuspensionOutcome as io, turnCanonicalBatch as ir, ToolStepSettled as it, RecordEnvelope as j, RecoverySnapshot as ja, RepairSubagentStartLink as ji, promptFromCanonicalRecords as jn, predictRecoveryDisposition as jr, DurableVerifyFailure as jt, ProducerEpoch as k, OwnershipToken as ka, RepairJoinMarker as ki, projectRunJournal as kn, RetryRefused as kr, DurableSubmitFailure as kt, CanonicalRecordEnvelope as l, ChildReservationId as la, AwaitHostSettlement as li, ThreadTailRequest as ln, UnknownResolutionConflict as lo, turnResultsBatch as lr, WorkerOrigin as lt, DefinitionDigestInput as m, ClaimJoiningRequest as ma, DeclaredPendingBatchEvidence as mi, JournalBoundary as mn, submissionAbortBatchId as mo, ExplainedUnknownCall as mr, DurableAbortFailure as mt, AbortedSubmissionSettled as n, ApprovalPendingSuspension as na, AppendReservedSettlement as ni, ThreadRead as nn, SubmissionState as no, turnApprovalsBatchId as nr, ToolCallSettled as nt, CURRENT_CANONICAL_SCHEMA_VERSION as o, ChildBudgetReservationRequest as oa, AwaitApprovalDecision as oi, ThreadStoreFailure as on, SuspensionSnapshot as oo, turnPreparedBatchId as or, WorkerAdmission as ot, CompletedSubmissionSettled as p, Claim as pa, CompleteMaterialization as pi, SubmissionStatus_d_exports as pn, settlementFailureFromRecord as po, ExplainedSubmission as pr, WorkerReportingIntent as pt, SubmissionSettled as q, SettlementReservationSnapshot as qa, AdmissionIndeterminate as qi, toolApprovalRequestRecordId as qn, definitionDigestsEqual as qr, SaveCheckpointRequest as qt, AgentUpdateEmitted as r, AttachChildToReservationRequest as ra, ApplyInput as ri, ThreadRecoveryCheckpoints as rn, SuspendRequest as ro, turnBatchId as rr, ToolCallUnknown as rt, CanonicalBatch as s, ChildBudgetReservationSnapshot as sa, AwaitChildAdmissionResolution as si, ThreadStore_d_exports as sn, UnknownResolution as so, turnResponseBatch as sr, WorkerInputCompleted as st, AbortRequested as t, ApprovalDecisionIntent as ta, digestJson as ti, ThreadObservation as tn, SubmissionSnapshot as to, toolStepSettledRecordId as tr, ToolCallResolved as tt, CanonicalRecordPayload as u, ChildReservationStatus as ua, AwaitParentEstablishment as ui, PendingSubmission as un, UnknownResolutionIntent as uo, turnResultsBatchId as ur, WorkerOriginRecorded as ut, FailedSubmissionSettled as v, JoinSnapshot as va, MarkUnknown as vi, RunJournal_d_exports as vn, submissionSettlementBatchId as vo, IntegrityReport as vr, DurableApprovalResolver as vt, ModelResponseInterrupted as w, MarkReadyRequest as wa, RecoveryDecision as wi, compactionRecordId as wn, RECOVERY_DECISION_MEANINGS as wr, DurableResolveFailure as wt, MAX_PERSISTED_JSON_DEPTH as x, LedgerError as xa, OpenToolCallEvidence as xi, childIdempotencyKeyFor as xn, ObligationReport as xr, DurableObligationFailure as xt, MAX_PERSISTED_JSON_BYTES as y, JoiningClaim as ya, NoAction as yi, TurnCommitInput as yn, submissionSettlementId as yo, ObligationBlockedOn as yr, DurableAwaitFailure as yt, RunPolicyUsageReserved as z, ResolutionCompletedWithResult as za, classifyRecovery as zi, subagentJoinedRecordId as zn, BindingUnavailable as zr, threadCreatedRecordId as zt };
3646
- //# sourceMappingURL=Records-CMByd1eD.d.mts.map
3673
+ export { ToolCallPrepared as $, SubmissionLookup as $a, AdmissionResult as $i, toolCallUnknownRecordId as $n, digestCanonicalBatch as $r, ThreadMaterialization as $t, ProducerId as A, OwnershipToken as Aa, RepairJoinMarker as Ai, projectRunJournalStream as An, obligationSeverityOf as Ar, DurableSubmitOptions as At, RunStartedRecord as B, ResolutionCompletedWithResult as Ba, classifyRecovery as Bi, subagentLineageBatchId as Bn, DurableBindingFailure as Br, AppendConflict as Bt, ModelCompleted as C, MarkInputAppliedRequest as Ca, PendingApprovalEvidence as Ci, compactionBatchId as Cn, ObligationThresholds as Cr, DurableProgressFailure as Ct, PeerMessagePrepared as D, OwnershipLost as Da, Recovery_d_exports as Di, modelResponseInterruptedRecordId as Dn, RetryCommand as Dr, DurableRuntimeConfigOptions as Dt, ObservationOffset as E, MarkUnknownRequest as Ea, RecoveryEvidence as Ei, modelResponseInterruptedBatchId as En, RecoveryExplanation as Er, DurableRuntimeConfig as Et, ReplayContract as F, ReleaseOwnershipRequest as Fa, ResumeSuspended as Fi, runIdForSubmission as Fn, AgentAttemptContext as Fr, childReservationIdFor as Ft, SubagentRequested as G, SettlementConflict as Ga, AdmissionConflict as Gi, subagentStartedRecordId as Gn, bindingSupports as Gr, LoadCheckpointRequest as Gt, SettlementOutcome as H, ResolutionSafeToRetry as Ha, AbortIntent as Hi, subagentRequestedBatchId as Hn, ExecutableAgentBinding as Hr, CheckpointRejected as Ht, RunCompleted as I, RenewOwnershipRequest as Ia, ResumeWaitingParent as Ii, runStartedBatchId as In, AgentRegistration as Ir, recoveryRepairBatchId as It, SubmissionSettledRecord as J, SettlementReservationSnapshot as Ja, AdmissionIndeterminate as Ji, toolCallPreparedRecordId as Jn, definitionDigestsEqual as Jr, SaveRecoveryCheckpointRequest as Jt, SubagentStarted as K, SettlementFinalization as Ka, AdmissionFence as Ki, toolApprovalDecisionRecordId as Kn, compileBindingManifest as Kr, MAX_THREAD_EXPORT_RECORDS as Kt, RunDurationExhausted as L, ReservedChildBudget as La, RevertJoining as Li, runStartedRecordId as Ln, BindingDigestMismatch as Lr, recoveryRepairRecordId as Lt, RecordId as M, RecoverySnapshot as Ma, RepairSubagentStartLink as Mi, runCompletedRecordId as Mn, recoveryDecisionMeaning as Mr, DurableWorkerFailure as Mt, Records_d_exports as N, RecoverySnapshotRequest as Na, ResumeFromTurnBoundary as Ni, runDurationBatchId as Nn, renderRecoveryExplanation as Nr, DurableWorkerRequirements as Nt, PersistedJson as O, OwnershipRenewal as Oa, ReleaseOrphanChildReservation as Oi, modelResponseRecordId as On, RetryRefusalReason as Or, DurableSubmitAgent as Ot, RepairAnnotated as P, ReleaseChildBudgetRequest as Pa, ResumePendingToolBatch as Pi, runDurationRecordId as Pn, AgentRegistration_d_exports as Pr, RecoveryReport as Pt, ToolApprovalRequested as Q, SubmissionLedger_d_exports as Qa, AdmissionResolution as Qi, toolCallSettledRecordId as Qn, EMPTY_TAIL_DIGEST as Qr, ThreadExportRequest as Qt, RunFailed as R, ReservedSettlement as Ra, SettleAborted as Ri, subagentJoinBatchId as Rn, BindingManifest as Rr, threadCreatedBatchId as Rt, MAX_PERSISTED_JSON_NODES as S, LedgerError as Sa, OpenToolCallEvidence as Si, childThreadIdFor as Sn, ObligationSeverity as Sr, DurableObserveOptions as St, ModelResponseRecorded as T, MarkReadyRequest as Ta, RecoveryDecision as Ti, markUnknownBatchId as Tn, RecoveryDisposition as Tr, DurableRetryFailure as Tt, SubagentJoined as U, RevertJoiningRequest as Ua, AbortIntentRequest as Ui, subagentRequestedRecordId as Un, ReplayVersions as Ur, FenceRejected as Ut, SettlementFailureDiagnostic as V, ResolutionNeverHappened as Va, AbortCommand as Vi, subagentLineageRecordId as Vn, DurableWorkerBinding as Vr, AppendResult as Vt, SubagentLineageRecorded as W, Settlement as Wa, AdmissionAdmitted as Wi, subagentStartedBatchId as Wn, ResolvedBinding as Wr, FencedAppendRequest as Wt, ThreadCreated as X, SubmissionLedger as Xa, AdmissionPolicyError as Xi, toolCallResolvedRecordId as Xn, DigestError as Xr, ThreadCheckpoints as Xt, SubtreeBudgetReserved as Y, SubmissionAdmissionFence as Ya, AdmissionNotAdmitted as Yi, toolCallResolutionBatchId as Yn, makeBindingManifest as Yr, ThreadCheckpoint as Yt, ToolApprovalDecided as Z, SubmissionLedgerFailure as Za, AdmissionRequest as Zi, toolCallResultBatchId as Zn, Digest_d_exports as Zr, ThreadExport as Zt, Digest as _, DEFAULT_OWNERSHIP_LEASE_DURATION as _a, EnsureWaitingForChild as _i, RunJournalUsage as _n, submissionInputBatchId as _o, IntegrityCheckStatus as _r, DurableApprovalFailure as _t, BatchId as a, BeginChildBudgetReleaseRequest as aa, ApplyJoinAccounting as ai, ThreadStoreError as an, SuspensionOutcome as ao, turnIdForRun as ar, UserInputRecorded as at, MAX_PERSISTED_JSON_COLLECTION_LENGTH as b, JoiningClaim as ba, NoAction as bi, approvalDecisionBatchId as bn, submissionSettlementId as bo, ObligationEntry as br, DurableExplainFailure as bt, CanonicalRecord as c, ChildBudgetReservationSnapshot as ca, AwaitChildAdmissionResolution as ci, ThreadTail as cn, UnknownResolution as co, turnResponseBatchId as cr, WorkerInputRequested as ct, CanonicalSequence as d, ChildReservationStatus as da, AwaitParentEstablishment as di, SettledSubmission as dn, UnknownResolutionIntent as do, Admin_d_exports as dr, WorkerReportPrepared as dt, ApprovalConflict as ea, digestDefinition as ei, ThreadNotMaterialized as en, SubmissionLookupById as eo, toolStepSettledBatchId as er, ToolCallResolution as et, CompactionCreated as f, ChildSettledNotification as fa, AwaitUnknownResolution as fi, SubmissionStatus as fn, WaitingChild as fo, ExplainedEvidence as fr, WorkerReportRefused as ft, DeploymentId as g, ClaimRequest as ga, DelegationAdmissionEvidence as gi, RunJournalProjection as gn, submissionAbortRecordId as go, IntegrityCheckName as gr, DurableAgentRuntime_d_exports as gt, DefinitionDigests as h, ClaimJoiningRequest as ha, DeclaredPendingBatchEvidence as hi, RunJournalError as hn, submissionAbortBatchId as ho, IntegrityCheck as hr, DurableAgentRuntime as ht, ApprovalDecision as i, AttachChildToReservationRequest as ia, ApplyInput as ii, ThreadStore as in, SuspendRequest as io, turnCanonicalBatch as ir, ToolStepSettled as it, RecordEnvelope as j, ParentLinkage as ja, RepairReadiness as ji, promptFromCanonicalRecords as jn, predictRecoveryDisposition as jr, DurableVerifyFailure as jt, ProducerEpoch as k, OwnershipSnapshot as ka, RepairInputMarker as ki, projectRunJournal as kn, RetryRefused as kr, DurableSubmitFailure as kt, CanonicalRecordEnvelope as l, ChildReservationConflict as la, AwaitChildSettlement as li, ThreadTailRequest as ln, UnknownResolutionCommand as lo, turnResultsBatch as lr, WorkerOrigin as lt, DefinitionDigestInput as m, Claim as ma, CompleteMaterialization as mi, JournalBoundary as mn, settlementFailureFromRecord as mo, ExplainedUnknownCall as mr, DurableAbortFailure as mt, AbortedSubmissionSettled as n, ApprovalDecisionIntent as na, digestJson as ni, ThreadRead as nn, SubmissionSnapshot as no, turnApprovalsBatchId as nr, ToolCallSettled as nt, CURRENT_CANONICAL_SCHEMA_VERSION as o, ChildAttachmentSnapshot as oa, ApplyUnknownResolutions as oi, ThreadStoreFailure as on, SuspensionReason as oo, turnPreparedBatchId as or, WorkerAdmission as ot, CompletedSubmissionSettled as p, ChildSettledOutcome as pa, CompleteChildAdmission as pi, SubmissionStatus_d_exports as pn, WaitingForChildSuspension as po, ExplainedSubmission as pr, WorkerReportingIntent as pt, SubmissionSettled as q, SettlementReservation as qa, AdmissionGroup as qi, toolApprovalRequestRecordId as qn, compileRegistrations as qr, SaveCheckpointRequest as qt, AgentUpdateEmitted as r, ApprovalPendingSuspension as ra, AppendReservedSettlement as ri, ThreadRecoveryCheckpoints as rn, SubmissionState as ro, turnBatchId as rr, ToolCallUnknown as rt, CanonicalBatch as s, ChildBudgetReservationRequest as sa, AwaitApprovalDecision as si, ThreadStore_d_exports as sn, SuspensionSnapshot as so, turnResponseBatch as sr, WorkerInputCompleted as st, AbortRequested as t, ApprovalDecisionCommand as ta, digestDefinitions as ti, ThreadObservation as tn, SubmissionLookupByKey as to, toolStepSettledRecordId as tr, ToolCallResolved as tt, CanonicalRecordPayload as u, ChildReservationId as ua, AwaitHostSettlement as ui, PendingSubmission as un, UnknownResolutionConflict as uo, turnResultsBatchId as ur, WorkerOriginRecorded as ut, FailedSubmissionSettled as v, InputAppliedMarker as va, FinalizeLedgerFromHistory as vi, RunJournal_d_exports as vn, submissionInputRecordId as vo, IntegrityReport as vr, DurableApprovalResolver as vt, ModelResponseInterrupted as w, MarkJoinedRequest as wa, PropagateChildAbort as wi, compactionRecordId as wn, RECOVERY_DECISION_MEANINGS as wr, DurableResolveFailure as wt, MAX_PERSISTED_JSON_DEPTH as x, LedgerCapabilities as xa, OpenDelegationCallEvidence as xi, childIdempotencyKeyFor as xn, submissionSettlementRecordId as xo, ObligationReport as xr, DurableObligationFailure as xt, MAX_PERSISTED_JSON_BYTES as y, JoinSnapshot as ya, MarkUnknown as yi, TurnCommitInput as yn, submissionSettlementBatchId as yo, ObligationBlockedOn as yr, DurableAwaitFailure as yt, RunPolicyUsageReserved as z, ResolutionAbortSubmission as za, SettleJoinedWithHost as zi, subagentJoinedRecordId as zn, BindingUnavailable as zr, threadCreatedRecordId as zt };
3674
+ //# sourceMappingURL=Records-CV49DgQK.d.mts.map
@@ -4,7 +4,7 @@ import { IdempotencyKey } from "./core/Receipt.mjs";
4
4
  import { ModelCallUsage, summarizeModelUsage } from "./core/Usage.mjs";
5
5
  import { f as contextWindowId, n as COMPACTION_SUMMARY_PREFIX, p as contextWindowMessage, t as CLEARED_TOOL_RESULT } from "./compaction-C2OTceKw.mjs";
6
6
  import { RunPolicyUsage } from "./core/RunPolicyUsage.mjs";
7
- import { $ as ToolCallSettled, N as RunCompleted, O as RecordEnvelope, S as ModelResponseRecorded, T as PersistedJson, d as CompactionCreated, i as BatchId, k as RecordId, o as CanonicalBatch } from "./Records-BEz5IFUu.mjs";
7
+ import { $ as ToolCallSettled, N as RunCompleted, O as RecordEnvelope, S as ModelResponseRecorded, T as PersistedJson, d as CompactionCreated, i as BatchId, k as RecordId, o as CanonicalBatch } from "./Records-BAutSSnJ.mjs";
8
8
  import { digestJson } from "./durable/Digest.mjs";
9
9
  import { Prompt } from "effect/unstable/ai";
10
10
  import { Effect, Schema, Stream } from "effect";
@@ -828,4 +828,4 @@ const turnResultsBatch = Effect.fn("RunJournal.turnResultsBatch")(function* (inp
828
828
  //#endregion
829
829
  export { toolApprovalRequestRecordId as A, turnBatchId as B, subagentLineageBatchId as C, subagentStartedBatchId as D, subagentRequestedRecordId as E, toolCallSettledRecordId as F, turnResponseBatchId as G, turnIdForRun as H, toolCallUnknownRecordId as I, makeJournalMetadata as J, turnResultsBatch as K, toolStepSettledBatchId as L, toolCallResolutionBatchId as M, toolCallResolvedRecordId as N, subagentStartedRecordId as O, toolCallResultBatchId as P, toolStepSettledRecordId as R, subagentJoinedRecordId as S, subagentRequestedBatchId as T, turnPreparedBatchId as U, turnCanonicalBatch as V, turnResponseBatch as W, runDurationRecordId as _, childThreadIdFor as a, runStartedRecordId as b, markUnknownBatchId as c, modelResponseRecordId as d, projectRunJournal as f, runDurationBatchId as g, runCompletedRecordId as h, childIdempotencyKeyFor as i, toolCallPreparedRecordId as j, toolApprovalDecisionRecordId as k, modelResponseInterruptedBatchId as l, promptFromCanonicalRecords as m, RunJournal_exports as n, compactionBatchId as o, projectRunJournalStream as p, turnResultsBatchId as q, approvalDecisionBatchId as r, compactionRecordId as s, RunJournalError as t, modelResponseInterruptedRecordId as u, runIdForSubmission as v, subagentLineageRecordId as w, subagentJoinBatchId as x, runStartedBatchId as y, turnApprovalsBatchId as z };
830
830
 
831
- //# sourceMappingURL=RunJournal-B_fxe57c.mjs.map
831
+ //# sourceMappingURL=RunJournal-DRRRZmG7.mjs.map