effect-agent 0.1.0-beta.91 → 0.1.0-beta.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AgentRuntime-CHipL2jG.mjs → AgentRuntime-BPjQM1Nv.mjs} +2 -2
- package/dist/AgentRuntime-BPjQM1Nv.mjs.map +1 -0
- package/dist/{DurableAgentRuntime-D7gDKGjH.mjs → DurableAgentRuntime-CdrBuKZY.mjs} +4 -4
- package/dist/{DurableAgentRuntime-D7gDKGjH.mjs.map → DurableAgentRuntime-CdrBuKZY.mjs.map} +1 -1
- package/dist/{EventSource-OqS_P9ug.d.mts → EventSource-c6GRTCsl.d.mts} +3 -3
- package/dist/{PreparedInputAdmission-C4HbjHgl.d.mts → PreparedInputAdmission-QzFbW2LQ.d.mts} +4 -4
- package/dist/Records-C9cezOEf.mjs +799 -0
- package/dist/Records-C9cezOEf.mjs.map +1 -0
- package/dist/{Records-BAGkekt8.d.mts → Records-vFp_ZQ9Y.d.mts} +21 -3
- package/dist/{RunJournal-Cgg1kNvc.mjs → RunJournal-lwbrh2hZ.mjs} +2 -2
- package/dist/{RunJournal-Cgg1kNvc.mjs.map → RunJournal-lwbrh2hZ.mjs.map} +1 -1
- package/dist/{Schedule-H3SEYX9g.d.mts → Schedule-BkZvKyMw.d.mts} +2 -2
- package/dist/{Scheduling-C9aIP8zT.mjs → Scheduling-D0QqOoeT.mjs} +2 -2
- package/dist/{Scheduling-C9aIP8zT.mjs.map → Scheduling-D0QqOoeT.mjs.map} +1 -1
- package/dist/{Subagent-U5qXOFE8.mjs → Subagent-CnTzCy8k.mjs} +2 -2
- package/dist/{Subagent-U5qXOFE8.mjs.map → Subagent-CnTzCy8k.mjs.map} +1 -1
- package/dist/{Subscription-BEP8oQO5.d.mts → Subscription-CKQ0KDHN.d.mts} +3 -3
- package/dist/{SubscriptionInput-vAAOBrK7.d.mts → SubscriptionInput-Cth8F_7b.d.mts} +3 -3
- package/dist/capabilities/Subagent.mjs +1 -1
- package/dist/capabilities/WebSearch.d.mts +3 -3
- package/dist/capabilities/WebSearch.mjs +9 -6
- package/dist/capabilities/WebSearch.mjs.map +1 -1
- package/dist/durable/ActivityStore.d.mts +1 -1
- package/dist/durable/ActivityStore.mjs +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/Admin.mjs +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/CommittedActivity.mjs +1 -1
- package/dist/durable/Digest.d.mts +1 -1
- package/dist/durable/Digest.mjs +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +1 -1
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/EventSource.mjs +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +48 -6
- package/dist/durable/GitHubWorkflowSource.mjs +13 -13
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -1
- package/dist/durable/MessageDelivery.d.mts +22 -22
- package/dist/durable/MessageDelivery.mjs +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
- package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PersistentHistory.mjs +2 -2
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +1 -1
- package/dist/durable/Records.mjs +2 -795
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/Recovery.mjs +1 -1
- package/dist/durable/RunJournal.d.mts +1 -1
- package/dist/durable/RunJournal.mjs +1 -1
- package/dist/durable/Schedule.d.mts +1 -1
- package/dist/durable/Schedule.mjs +1 -1
- package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
- package/dist/durable/ScheduleStoreConformance.mjs +1 -1
- package/dist/durable/ScheduleTransition.d.mts +1 -1
- package/dist/durable/ScheduleTransition.mjs +1 -1
- package/dist/durable/Scheduling.d.mts +2 -2
- package/dist/durable/Scheduling.mjs +1 -1
- package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
- package/dist/durable/SqlStorageV2Upgrade.mjs +1 -1
- package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
- package/dist/durable/SqlSubscriptionStore.mjs +1 -1
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedger.mjs +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +1 -1
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/Subscription.mjs +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionInput.mjs +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
- package/dist/durable/SubscriptionTools.d.mts +3 -3
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/SubscriptionTransition.mjs +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/Subscriptions.mjs +1 -1
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistory.mjs +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
- package/dist/durable/ThreadInvariants.d.mts +1 -1
- package/dist/durable/ThreadInvariants.mjs +1 -1
- package/dist/durable/ThreadProjection.d.mts +1 -1
- package/dist/durable/ThreadProjection.mjs +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadStore.d.mts +1 -1
- package/dist/durable/ThreadStore.mjs +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/ThreadStoreConformance.mjs +1 -1
- package/dist/durable/ToolReconciler.mjs +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +6 -6
- package/dist/sandbox/InteractiveBrowser.mjs +2 -2
- package/dist/sandbox/InteractiveBrowser.mjs.map +1 -1
- package/dist/sandbox/PageCapture.mjs +4 -4
- package/dist/sandbox/PageCapture.mjs.map +1 -1
- package/dist/sandbox/ProtectedBrowser.mjs +1 -1
- package/dist/sandbox/ProtectedBrowser.mjs.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/WebSearch.ts +23 -17
- package/src/core/internal/strict-schema.ts +14 -0
- package/src/durable/GitHubWorkflowSource.ts +32 -38
- package/src/durable/Records.ts +8 -4
- package/src/engine/internal/primitive-delta.ts +1 -1
- package/src/sandbox/InteractiveBrowser.ts +2 -2
- package/src/sandbox/PageCapture.ts +6 -7
- package/src/sandbox/ProtectedBrowser.ts +1 -1
- package/dist/AgentRuntime-CHipL2jG.mjs.map +0 -1
- package/dist/durable/Records.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Records-C9cezOEf.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 { 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/** Digests make a replay-visible definition/configuration change explicit. */\nexport class DefinitionDigests extends Schema.Class<DefinitionDigests>(\n \"@effect-agent/thread/DefinitionDigests\",\n)({\n agent: Digest,\n model: Digest,\n tools: Digest,\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 clock and duration allowance for one logical Run, 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\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 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 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: ObservationOffset,\n record: RecordEnvelope,\n}) {}\n\nexport const CURRENT_CANONICAL_SCHEMA_VERSION = 1 as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,MAAa,gBAAsC,WACjD,OAAO,mBAA4C,CAAC,CAClD,CAAC,MAAM,IACN,CAAC,YACC,OAAO,MAAM,YACZ,aAAa,oBAAoB,KAAK,CAAC,CAAC,OAAO;CAAE,GAAG;CAAS,kBAAkB;AAAQ,CAAC,GAC5F,EACE,cAAc,CAAC,WACb,OAAO,KAAmB,CAAC,CAAC,OAAO,qBAAqB,YAAY,CAAC,EACzE,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACuBF,MAAM,cAAyC,SAC7C,OAAO,eAAe,KAAK,OAAO,MAAM,wBAAwB,MAAM,CAAC;;AAGzE,MAAa,WAAW,WAAW,UAAU;;AAI7C,MAAa,UAAU,WAAW,SAAS;;AAI3C,MAAa,eAAe,WAAW,cAAc;;AAIrD,MAAa,aAAa,WAAW,YAAY;;AAIjD,MAAa,SAAS,OAAO,OAAO,MAAM,OAAO,UAAU,gBAAgB,CAAC,CAAC,CAAC,KAC5E,OAAO,MAAM,6BAA6B,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,CAAC,CAAC;CACA,UAAU;CACV,QAAQ,OAAO,QAAQ,QAAQ;CAC/B,eAAe,OAAO,QAAQ,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"}
|
|
@@ -511,9 +511,18 @@ declare const Settlement_base: Schema.Class<Settlement, Schema.Struct<{
|
|
|
511
511
|
/** Canonical aggregate of model usage and estimated spend for this Run. */
|
|
512
512
|
readonly usageSummary: Schema.optionalKey<typeof RunUsageSummary>;
|
|
513
513
|
/** Present exactly for `failed`; its Schema rejects excess keys before canonical projection. */
|
|
514
|
-
readonly failure: Schema.optionalKey<Schema.
|
|
514
|
+
readonly failure: Schema.optionalKey<Schema.declareConstructor<{
|
|
515
|
+
readonly errorTag: string;
|
|
516
|
+
readonly message: string;
|
|
517
|
+
}, {
|
|
518
|
+
readonly errorTag: string;
|
|
519
|
+
readonly message: string;
|
|
520
|
+
}, readonly [Schema.Struct<{
|
|
515
521
|
readonly errorTag: Schema.NonEmptyString;
|
|
516
522
|
readonly message: Schema.String;
|
|
523
|
+
}>], {
|
|
524
|
+
readonly errorTag: string;
|
|
525
|
+
readonly message: string;
|
|
517
526
|
}>>;
|
|
518
527
|
readonly settledAt: Schema.DateTimeUtcFromString;
|
|
519
528
|
}>, {}>;
|
|
@@ -2783,9 +2792,18 @@ type ProducerEpoch = typeof ProducerEpoch.Type;
|
|
|
2783
2792
|
* no raw Cause, stack, provider payload, or application-specific fields; those values can carry
|
|
2784
2793
|
* secrets and do not form a stable cross-process contract.
|
|
2785
2794
|
*/
|
|
2786
|
-
declare const SettlementFailureDiagnostic: Schema.
|
|
2795
|
+
declare const SettlementFailureDiagnostic: Schema.declareConstructor<{
|
|
2796
|
+
readonly errorTag: string;
|
|
2797
|
+
readonly message: string;
|
|
2798
|
+
}, {
|
|
2799
|
+
readonly errorTag: string;
|
|
2800
|
+
readonly message: string;
|
|
2801
|
+
}, readonly [Schema.Struct<{
|
|
2787
2802
|
readonly errorTag: Schema.NonEmptyString;
|
|
2788
2803
|
readonly message: Schema.String;
|
|
2804
|
+
}>], {
|
|
2805
|
+
readonly errorTag: string;
|
|
2806
|
+
readonly message: string;
|
|
2789
2807
|
}>;
|
|
2790
2808
|
type SettlementFailureDiagnostic = typeof SettlementFailureDiagnostic.Type;
|
|
2791
2809
|
declare const MAX_PERSISTED_JSON_DEPTH = 64;
|
|
@@ -3567,4 +3585,4 @@ declare class CanonicalRecordEnvelope extends CanonicalRecordEnvelope_base {}
|
|
|
3567
3585
|
declare const CURRENT_CANONICAL_SCHEMA_VERSION: 1;
|
|
3568
3586
|
//#endregion
|
|
3569
3587
|
export { ToolCallResolved as $, UnknownResolution as $a, ChildBudgetReservationSnapshot as $i, turnBatchId as $n, AwaitChildAdmissionResolution as $r, ThreadObservation as $t, ProducerId as A, ResolutionAbortSubmission as Aa, SettleJoinedWithHost as Ai, runCompletedRecordId as An, AgentRegistration_d_exports as Ar, DurableWorkerFailure as At, SettlementOutcome as B, SubmissionAdmissionFence as Ba, AdmissionNotAdmitted as Bi, subagentStartedBatchId as Bn, definitionDigestsEqual as Br, CheckpointRejected as Bt, ModelCompleted as C, RecoverySnapshot as Ca, RepairSubagentStartLink as Ci, markUnknownBatchId as Cn, RetryCommand as Cr, DurableRetryFailure as Ct, PeerMessagePrepared as D, RenewOwnershipRequest as Da, ResumeWaitingParent as Di, projectRunJournal as Dn, predictRecoveryDisposition as Dr, DurableSubmitFailure as Dt, ObservationOffset as E, ReleaseOwnershipRequest as Ea, ResumeSuspended as Ei, modelResponseRecordId as En, obligationSeverityOf as Er, DurableSubmitAgent as Et, RunCompleted as F, Settlement as Fa, AdmissionAdmitted as Fi, subagentJoinedRecordId as Fn, DurableBindingFailure as Fr, recoveryRepairRecordId as Ft, SubmissionSettled as G, SubmissionLookupById as Ga, ApprovalConflict as Gi, toolCallResolutionBatchId as Gn, digestDefinition as Gr, SaveCheckpointRequest as Gt, SubagentLineageRecorded as H, SubmissionLedgerFailure as Ha, AdmissionRequest as Hi, toolApprovalDecisionRecordId as Hn, Digest_d_exports as Hr, FencedAppendRequest as Ht, RunFailed as I, SettlementConflict as Ia, AdmissionConflict as Ii, subagentLineageBatchId as In, DurableWorkerBinding as Ir, threadCreatedBatchId as It, ThreadCreated as J, SubmissionState as Ja, ApprovalPendingSuspension as Ji, toolCallSettledRecordId as Jn, AppendReservedSettlement as Jr, ThreadCheckpoints as Jt, SubmissionSettledRecord as K, SubmissionLookupByKey as Ka, ApprovalDecisionCommand as Ki, toolCallResolvedRecordId as Kn, digestDefinitions as Kr, SaveRecoveryCheckpointRequest as Kt, RunPolicyUsageReserved as L, SettlementFinalization as La, AdmissionFence as Li, subagentLineageRecordId as Ln, ExecutableAgentBinding as Lr, threadCreatedRecordId as Lt, RecordId as M, ResolutionNeverHappened as Ma, AbortCommand as Mi, runStartedBatchId as Mn, AgentRegistration as Mr, RecoveryReport as Mt, Records_d_exports as N, ResolutionSafeToRetry as Na, AbortIntent as Ni, runStartedRecordId as Nn, BindingDigestMismatch as Nr, childReservationIdFor as Nt, PersistedJson as O, ReservedChildBudget as Oa, RevertJoining as Oi, projectRunJournalStream as On, recoveryDecisionMeaning as Or, DurableSubmitOptions as Ot, RepairAnnotated as P, RevertJoiningRequest as Pa, AbortIntentRequest as Pi, subagentJoinBatchId as Pn, BindingUnavailable as Pr, recoveryRepairBatchId as Pt, ToolCallResolution as Q, SuspensionSnapshot as Qa, ChildBudgetReservationRequest as Qi, turnApprovalsBatchId as Qn, AwaitApprovalDecision as Qr, ThreadNotMaterialized as Qt, RunStartedRecord as R, SettlementReservation as Ra, AdmissionGroup as Ri, subagentRequestedBatchId as Rn, ResolvedBinding as Rr, AppendConflict as Rt, MAX_PERSISTED_JSON_NODES as S, ParentLinkage as Sa, RepairReadiness as Si, compactionRecordId as Sn, RecoveryExplanation as Sr, DurableResolveFailure as St, ModelResponseRecorded as T, ReleaseChildBudgetRequest as Ta, ResumePendingToolBatch as Ti, modelResponseInterruptedRecordId as Tn, RetryRefused as Tr, DurableRuntimeConfigOptions as Tt, SubagentRequested as U, SubmissionLedger_d_exports as Ua, AdmissionResolution as Ui, toolApprovalRequestRecordId as Un, EMPTY_TAIL_DIGEST as Ur, LoadCheckpointRequest as Ut, SubagentJoined as V, SubmissionLedger as Va, AdmissionPolicyError as Vi, subagentStartedRecordId as Vn, DigestError as Vr, FenceRejected as Vt, SubagentStarted as W, SubmissionLookup as Wa, AdmissionResult as Wi, toolCallPreparedRecordId as Wn, digestCanonicalBatch as Wr, MAX_THREAD_EXPORT_RECORDS as Wt, ToolApprovalRequested as X, SuspensionOutcome as Xa, BeginChildBudgetReleaseRequest as Xi, toolStepSettledBatchId as Xn, ApplyJoinAccounting as Xr, ThreadExportRequest as Xt, ToolApprovalDecided as Y, SuspendRequest as Ya, AttachChildToReservationRequest as Yi, toolCallUnknownRecordId as Yn, ApplyInput as Yr, ThreadExport as Yt, ToolCallPrepared as Z, SuspensionReason as Za, ChildAttachmentSnapshot as Zi, toolStepSettledRecordId as Zn, ApplyUnknownResolutions as Zr, ThreadMaterialization as Zt, Digest as _, MarkUnknownRequest as _a, RecoveryEvidence as _i, TurnCommitInput as _n, ObligationReport as _r, DurableAwaitFailure as _t, BatchId as a, Claim as aa, CompleteMaterialization as ai, ThreadStore_d_exports as an, settlementFailureFromRecord as ao, turnResultsBatch as ar, WorkerInputCompleted as at, MAX_PERSISTED_JSON_COLLECTION_LENGTH as b, OwnershipSnapshot as ba, RepairInputMarker as bi, childThreadIdFor as bn, RECOVERY_DECISION_MEANINGS as br, DurableObserveOptions as bt, CanonicalRecord as c, DEFAULT_OWNERSHIP_LEASE_DURATION as ca, EnsureWaitingForChild as ci, PendingSubmission as cn, submissionInputBatchId as co, ExplainedEvidence as cr, WorkerOriginRecorded as ct, CanonicalSequence as d, JoiningClaim as da, NoAction as di, SubmissionStatus_d_exports as dn, submissionSettlementId as do, IntegrityCheck as dr, WorkerReportingIntent as dt, ChildReservationConflict as ea, AwaitChildSettlement as ei, ThreadRead as en, UnknownResolutionCommand as eo, turnCanonicalBatch as er, ToolCallSettled as et, CompactionCreated as f, LedgerCapabilities as fa, OpenDelegationCallEvidence as fi, JournalBoundary as fn, submissionSettlementRecordId as fo, IntegrityCheckName as fr, DurableAbortFailure as ft, DeploymentId as g, MarkReadyRequest as ga, RecoveryDecision as gi, RunJournal_d_exports as gn, ObligationEntry as gr, DurableApprovalResolver as gt, DefinitionDigests as h, MarkJoinedRequest as ha, PropagateChildAbort as hi, RunJournalUsage as hn, ObligationBlockedOn as hr, DurableApprovalFailure as ht, ApprovalDecision as i, ChildSettledOutcome as ia, CompleteChildAdmission as ii, ThreadStoreFailure as in, WaitingForChildSuspension as io, turnResponseBatchId as ir, WorkerAdmission as it, RecordEnvelope as j, ResolutionCompletedWithResult as ja, classifyRecovery as ji, runIdForSubmission as jn, AgentAttemptContext as jr, DurableWorkerRequirements as jt, ProducerEpoch as k, ReservedSettlement as ka, SettleAborted as ki, promptFromCanonicalRecords as kn, renderRecoveryExplanation as kr, DurableVerifyFailure as kt, CanonicalRecordEnvelope as l, InputAppliedMarker as la, FinalizeLedgerFromHistory as li, SettledSubmission as ln, submissionInputRecordId as lo, ExplainedSubmission as lr, WorkerReportPrepared as lt, DefinitionDigestInput as m, MarkInputAppliedRequest as ma, PendingApprovalEvidence as mi, RunJournalProjection as mn, IntegrityReport as mr, DurableAgentRuntime_d_exports as mt, AbortedSubmissionSettled as n, ChildReservationStatus as na, AwaitParentEstablishment as ni, ThreadStore as nn, UnknownResolutionIntent as no, turnPreparedBatchId as nr, ToolStepSettled as nt, CURRENT_CANONICAL_SCHEMA_VERSION as o, ClaimJoiningRequest as oa, DeclaredPendingBatchEvidence as oi, ThreadTail as on, submissionAbortBatchId as oo, turnResultsBatchId as or, WorkerInputRequested as ot, CompletedSubmissionSettled as p, LedgerError as pa, OpenToolCallEvidence as pi, RunJournalError as pn, IntegrityCheckStatus as pr, DurableAgentRuntime as pt, SubtreeBudgetReserved as q, SubmissionSnapshot as qa, ApprovalDecisionIntent as qi, toolCallResultBatchId as qn, digestJson as qr, ThreadCheckpoint as qt, AgentUpdateEmitted as r, ChildSettledNotification as ra, AwaitUnknownResolution as ri, ThreadStoreError as rn, WaitingChild as ro, turnResponseBatch as rr, UserInputRecorded as rt, CanonicalBatch as s, ClaimRequest as sa, DelegationAdmissionEvidence as si, ThreadTailRequest as sn, submissionAbortRecordId as so, Admin_d_exports as sr, WorkerOrigin as st, AbortRequested as t, ChildReservationId as ta, AwaitHostSettlement as ti, ThreadRecoveryCheckpoints as tn, UnknownResolutionConflict as to, turnIdForRun as tr, ToolCallUnknown as tt, CanonicalRecordPayload as u, JoinSnapshot as ua, MarkUnknown as ui, SubmissionStatus as un, submissionSettlementBatchId as uo, ExplainedUnknownCall as ur, WorkerReportRefused as ut, FailedSubmissionSettled as v, OwnershipLost as va, Recovery_d_exports as vi, approvalDecisionBatchId as vn, ObligationSeverity as vr, DurableExplainFailure as vt, ModelResponseInterrupted as w, RecoverySnapshotRequest as wa, ResumeFromTurnBoundary as wi, modelResponseInterruptedBatchId as wn, RetryRefusalReason as wr, DurableRuntimeConfig as wt, MAX_PERSISTED_JSON_DEPTH as x, OwnershipToken as xa, RepairJoinMarker as xi, compactionBatchId as xn, RecoveryDisposition as xr, DurableProgressFailure as xt, MAX_PERSISTED_JSON_BYTES as y, OwnershipRenewal as ya, ReleaseOrphanChildReservation as yi, childIdempotencyKeyFor as yn, ObligationThresholds as yr, DurableObligationFailure as yt, SettlementFailureDiagnostic as z, SettlementReservationSnapshot as za, AdmissionIndeterminate as zi, subagentRequestedRecordId as zn, compileRegistrations as zr, AppendResult as zt };
|
|
3570
|
-
//# sourceMappingURL=Records-
|
|
3588
|
+
//# sourceMappingURL=Records-vFp_ZQ9Y.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 {
|
|
7
|
+
import { M as RunCompleted, O as RecordEnvelope, S as ModelResponseRecorded, T as PersistedJson, Z as ToolCallSettled, d as CompactionCreated, i as BatchId, k as RecordId, o as CanonicalBatch } from "./Records-C9cezOEf.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";
|
|
@@ -822,4 +822,4 @@ const turnResultsBatch = Effect.fn("RunJournal.turnResultsBatch")(function* (inp
|
|
|
822
822
|
//#endregion
|
|
823
823
|
export { toolCallResolutionBatchId as A, turnIdForRun as B, subagentRequestedBatchId as C, toolApprovalDecisionRecordId as D, subagentStartedRecordId as E, toolStepSettledBatchId as F, turnResultsBatchId as G, turnResponseBatch as H, toolStepSettledRecordId as I, makeJournalMetadata as K, turnApprovalsBatchId as L, toolCallResultBatchId as M, toolCallSettledRecordId as N, toolApprovalRequestRecordId as O, toolCallUnknownRecordId as P, turnBatchId as R, subagentLineageRecordId as S, subagentStartedBatchId as T, turnResponseBatchId as U, turnPreparedBatchId as V, turnResultsBatch as W, runStartedBatchId as _, childThreadIdFor as a, subagentJoinedRecordId as b, markUnknownBatchId as c, modelResponseRecordId as d, projectRunJournal as f, runIdForSubmission as g, runCompletedRecordId as h, childIdempotencyKeyFor as i, toolCallResolvedRecordId as j, toolCallPreparedRecordId as k, modelResponseInterruptedBatchId as l, promptFromCanonicalRecords as m, RunJournal_exports as n, compactionBatchId as o, projectRunJournalStream as p, approvalDecisionBatchId as r, compactionRecordId as s, RunJournalError as t, modelResponseInterruptedRecordId as u, runStartedRecordId as v, subagentRequestedRecordId as w, subagentLineageBatchId as x, subagentJoinBatchId as y, turnCanonicalBatch as z };
|
|
824
824
|
|
|
825
|
-
//# sourceMappingURL=RunJournal-
|
|
825
|
+
//# sourceMappingURL=RunJournal-lwbrh2hZ.mjs.map
|