effect-agent 0.1.0-beta.111 → 0.1.0-beta.113
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/{DurableAgentRuntime-PyIgNYXF.mjs → DurableAgentRuntime-BIrgxwRl.mjs} +154 -21
- package/dist/DurableAgentRuntime-BIrgxwRl.mjs.map +1 -0
- package/dist/{EventSource-BUYLmL77.d.mts → EventSource-ARs56eBq.d.mts} +3 -3
- package/dist/{PreparedInputAdmission-J3YK6LAm.d.mts → PreparedInputAdmission-_WYg-D0f.d.mts} +4 -4
- package/dist/{Records-4qnRmniE.d.mts → Records-BtxMy8xD.d.mts} +94 -13
- package/dist/{Schedule-C2lH2kxY.d.mts → Schedule-DGPyXBzK.d.mts} +2 -2
- package/dist/{Subscription-pQUv0QD6.d.mts → Subscription-B9VszlF9.d.mts} +3 -3
- package/dist/{SubscriptionInput-DdJOiNMY.d.mts → SubscriptionInput-BJWZqCWP.d.mts} +3 -3
- package/dist/capabilities/Mcp.d.mts +1 -1
- package/dist/capabilities/Mcp.mjs +5 -6
- package/dist/capabilities/Mcp.mjs.map +1 -1
- package/dist/durable/ActivityStore.d.mts +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/Digest.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +2 -2
- package/dist/durable/DurableAgentRuntime.mjs +2 -2
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
- package/dist/durable/MessageDelivery.d.mts +3 -3
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +1 -1
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/RunJournal.d.mts +1 -1
- package/dist/durable/Schedule.d.mts +1 -1
- package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
- package/dist/durable/ScheduleTransition.d.mts +1 -1
- package/dist/durable/Scheduling.d.mts +2 -2
- package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
- package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
- package/dist/durable/SqlThreadNativeReads.d.mts +1 -1
- package/dist/durable/SubmissionLedger.d.mts +2 -2
- package/dist/durable/SubmissionLedger.mjs +19 -8
- package/dist/durable/SubmissionLedger.mjs.map +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +2 -1
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -1
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionTools.d.mts +3 -3
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadInvariants.d.mts +1 -1
- package/dist/durable/ThreadProjection.d.mts +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadStore.d.mts +2 -2
- package/dist/durable/ThreadStore.mjs +16 -2
- package/dist/durable/ThreadStore.mjs.map +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/capabilities/Mcp.ts +6 -7
- package/src/durable/DurableAgentRuntime.ts +278 -49
- package/src/durable/SubmissionLedger.ts +22 -9
- package/src/durable/SubmissionLedgerConformance.ts +13 -1
- package/src/durable/ThreadStore.ts +16 -0
- package/dist/DurableAgentRuntime-PyIgNYXF.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as PersistedJson } from "./Records-
|
|
2
|
-
import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, t as AcceptedEvent } from "./Subscription-
|
|
1
|
+
import { O as PersistedJson } from "./Records-BtxMy8xD.mjs";
|
|
2
|
+
import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, t as AcceptedEvent } from "./Subscription-B9VszlF9.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-
|
|
51
|
+
//# sourceMappingURL=EventSource-ARs56eBq.d.mts.map
|
package/dist/{PreparedInputAdmission-J3YK6LAm.d.mts → PreparedInputAdmission-_WYg-D0f.d.mts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as Receipt } from "./Receipt-BAHyigAF.mjs";
|
|
2
2
|
import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-CaAkzGHL.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { H as ScheduledInputRefused, V as ScheduledInputFailure, j as ScheduleStorageError } from "./Schedule-
|
|
5
|
-
import { a as PreparedInput } from "./Subscription-
|
|
3
|
+
import { Nn as SubmissionStatus } from "./Records-BtxMy8xD.mjs";
|
|
4
|
+
import { H as ScheduledInputRefused, V as ScheduledInputFailure, j as ScheduleStorageError } from "./Schedule-DGPyXBzK.mjs";
|
|
5
|
+
import { a as PreparedInput } from "./Subscription-B9VszlF9.mjs";
|
|
6
6
|
import { Context, Effect } from "effect";
|
|
7
7
|
declare namespace PreparedInputAdmission_d_exports {
|
|
8
8
|
export { PreparedInputAdmission, admitPreparedInput };
|
|
@@ -39,4 +39,4 @@ declare const admitPreparedInput: <R>(submit: Effect.Effect<Receipt, ScheduledIn
|
|
|
39
39
|
}, ScheduleStorageError, R>;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { PreparedInputAdmission_d_exports as n, admitPreparedInput as r, PreparedInputAdmission as t };
|
|
42
|
-
//# sourceMappingURL=PreparedInputAdmission-
|
|
42
|
+
//# sourceMappingURL=PreparedInputAdmission-_WYg-D0f.d.mts.map
|
|
@@ -24,9 +24,9 @@ import { o as OperationDenied } from "./OperationAuthorizer-TzcQtpX5.mjs";
|
|
|
24
24
|
import { s as ToolReconciler } from "./ToolReconciler-BmVRAHKs.mjs";
|
|
25
25
|
import { t as WakeScheduler } from "./WakeScheduler-EjUF-GhC.mjs";
|
|
26
26
|
import { Prompt, Tool } from "effect/unstable/ai";
|
|
27
|
-
import { Context, Crypto, DateTime, Duration, Effect, Layer, Option, Schema, Scope, Stream } from "effect";
|
|
27
|
+
import { Cause, Context, Crypto, DateTime, Duration, Effect, Layer, Option, Result, Schema, Scope, Stream } from "effect";
|
|
28
28
|
declare namespace SubmissionLedger_d_exports {
|
|
29
|
-
export { AbortCommand, AbortIntent, AbortIntentRequest, AdmissionAdmitted, AdmissionConflict, AdmissionFence, AdmissionGroup, AdmissionIndeterminate, AdmissionNotAdmitted, AdmissionPolicyError, AdmissionRequest, AdmissionResolution, AdmissionResult, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, ApprovalPendingSuspension, AttachChildToReservationRequest, BeginChildBudgetReleaseRequest, ChildAttachmentSnapshot, ChildBudgetReservationRequest, ChildBudgetReservationSnapshot, ChildReservationConflict, ChildReservationId, ChildReservationStatus, ChildSettledNotification, ChildSettledOutcome, Claim, ClaimJoiningRequest, ClaimRequest, DEFAULT_OWNERSHIP_LEASE_DURATION, IdempotencyKey, InputAppliedMarker, JoinSnapshot, JoinedToHost, JoiningClaim, LedgerCapabilities, LedgerError, MarkInputAppliedRequest, MarkJoinedRequest, MarkReadyRequest, MarkUnknownRequest, OwnershipLost, OwnershipRenewal, OwnershipSnapshot, OwnershipToken, ParentLinkage, Principal, QueueSequence, RecoverySnapshot, RecoverySnapshotRequest, ReleaseChildBudgetRequest, ReleaseOwnershipRequest, RenewOwnershipRequest, ReservedChildBudget, ReservedSettlement, ResolutionAbortSubmission, ResolutionCompletedWithResult, ResolutionNeverHappened, ResolutionSafeToRetry, RevertJoiningRequest, Settlement, SettlementConflict, SettlementFinalization, SettlementReservation, SettlementReservationSnapshot, SubmissionAdmissionFence, SubmissionLedger, SubmissionLedgerFailure, SubmissionLookup, SubmissionLookupById, SubmissionLookupByKey, SubmissionSnapshot, SubmissionState, SuspendRequest, SuspensionOutcome, SuspensionReason, SuspensionSnapshot, UnknownResolution, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, WaitingChild, WaitingForChildSuspension, settlementFailureFromRecord, submissionAbortBatchId, submissionAbortRecordId, submissionInputBatchId, submissionInputRecordId, submissionSettlementBatchId, submissionSettlementId, submissionSettlementRecordId };
|
|
29
|
+
export { AbortCommand, AbortIntent, AbortIntentRequest, AdmissionAdmitted, AdmissionConflict, AdmissionFence, AdmissionGroup, AdmissionIndeterminate, AdmissionNotAdmitted, AdmissionPolicyError, AdmissionRequest, AdmissionResolution, AdmissionResult, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, ApprovalPendingSuspension, AttachChildToReservationRequest, BeginChildBudgetReleaseRequest, ChildAttachmentSnapshot, ChildBudgetReservationRequest, ChildBudgetReservationSnapshot, ChildReservationConflict, ChildReservationId, ChildReservationStatus, ChildSettledNotification, ChildSettledOutcome, Claim, ClaimJoiningRequest, ClaimRequest, DEFAULT_OWNERSHIP_LEASE_DURATION, IdempotencyKey, InputAppliedMarker, JoinSnapshot, JoinedToHost, JoiningClaim, LedgerCapabilities, LedgerError, MarkInputAppliedRequest, MarkJoinedRequest, MarkReadyRequest, MarkUnknownRequest, OwnershipLost, OwnershipRenewal, OwnershipSnapshot, OwnershipToken, ParentLinkage, Principal, QueueSequence, RecoverySnapshot, RecoverySnapshotRequest, ReleaseChildBudgetRequest, ReleaseOwnershipRequest, RenewOwnershipRequest, ReservedChildBudget, ReservedSettlement, ResolutionAbortSubmission, ResolutionCompletedWithResult, ResolutionNeverHappened, ResolutionSafeToRetry, RevertJoiningRequest, Settlement, SettlementConflict, SettlementFinalization, SettlementReservation, SettlementReservationSnapshot, SubmissionAdmissionFence, SubmissionLedger, SubmissionLedgerFailure, SubmissionLookup, SubmissionLookupById, SubmissionLookupByKey, SubmissionSnapshot, SubmissionState, SubmissionWorkItem, SuspendRequest, SuspensionOutcome, SuspensionReason, SuspensionSnapshot, UnknownResolution, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, WaitingChild, WaitingForChildSuspension, settlementFailureFromRecord, submissionAbortBatchId, submissionAbortRecordId, submissionInputBatchId, submissionInputRecordId, submissionSettlementBatchId, submissionSettlementId, submissionSettlementRecordId };
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Opaque proof that one Attempt currently owns a Submission's lane. It authorizes ledger
|
|
@@ -271,19 +271,35 @@ declare class SubmissionLookupByKey extends SubmissionLookupByKey_base {}
|
|
|
271
271
|
/** Lookup by Submission identity or by the scoped client idempotency key. */
|
|
272
272
|
declare const SubmissionLookup: Schema.Union<readonly [typeof SubmissionLookupById, typeof SubmissionLookupByKey]>;
|
|
273
273
|
type SubmissionLookup = typeof SubmissionLookup.Type;
|
|
274
|
+
declare const SubmissionWorkItem_base: Schema.Class<SubmissionWorkItem, Schema.Struct<{
|
|
275
|
+
readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
|
|
276
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
277
|
+
readonly queueSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/QueueSequence">;
|
|
278
|
+
readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
|
|
279
|
+
readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
280
|
+
readonly deploymentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/DeploymentId">;
|
|
281
|
+
readonly receiptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ReceiptId">;
|
|
282
|
+
readonly state: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
|
|
283
|
+
}>, {}>;
|
|
284
|
+
/**
|
|
285
|
+
* Control-only worklist entry. Discovery validates identities, ordering and state without
|
|
286
|
+
* decoding retained execution payloads. Hydrate only the selected Thread through `lookup`
|
|
287
|
+
* or `loadRecoverySnapshot`, inside its recovery failure boundary.
|
|
288
|
+
*/
|
|
289
|
+
declare class SubmissionWorkItem extends SubmissionWorkItem_base {}
|
|
274
290
|
declare const SubmissionSnapshot_base: Schema.Class<SubmissionSnapshot, Schema.Struct<{
|
|
275
291
|
readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
|
|
276
292
|
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
277
293
|
readonly queueSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/QueueSequence">;
|
|
278
294
|
readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
|
|
279
295
|
readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
296
|
+
readonly deploymentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/DeploymentId">;
|
|
297
|
+
readonly receiptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ReceiptId">;
|
|
298
|
+
readonly state: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
|
|
280
299
|
readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
281
300
|
readonly agentDigests: typeof DefinitionDigests;
|
|
282
|
-
readonly deploymentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/DeploymentId">;
|
|
283
301
|
readonly inputPayload: Schema.declare<Schema.Json, Schema.Json>;
|
|
284
302
|
readonly inputDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
|
|
285
|
-
readonly receiptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ReceiptId">;
|
|
286
|
-
readonly state: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
|
|
287
303
|
readonly settledOutcome: Schema.optionalKey<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
|
|
288
304
|
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
289
305
|
readonly readyAt: Schema.optionalKey<Schema.DateTimeUtcFromString>;
|
|
@@ -1105,7 +1121,7 @@ declare const SubmissionLedger_base: Context.ServiceClass<SubmissionLedger, "@ef
|
|
|
1105
1121
|
readonly attachChildToReservation: (request: AttachChildToReservationRequest) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | OwnershipLost | LedgerError>;
|
|
1106
1122
|
readonly beginChildBudgetRelease: (request: BeginChildBudgetReleaseRequest) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | LedgerError>;
|
|
1107
1123
|
readonly releaseChildBudget: (request: ReleaseChildBudgetRequest) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | LedgerError>;
|
|
1108
|
-
readonly scanNonterminal: Stream.Stream<
|
|
1124
|
+
readonly scanNonterminal: Stream.Stream<SubmissionWorkItem, LedgerError>;
|
|
1109
1125
|
readonly loadRecoverySnapshot: (request: RecoverySnapshotRequest) => Effect.Effect<RecoverySnapshot, LedgerError>;
|
|
1110
1126
|
}>;
|
|
1111
1127
|
/**
|
|
@@ -1225,8 +1241,10 @@ declare const SubmissionLedger_base: Context.ServiceClass<SubmissionLedger, "@ef
|
|
|
1225
1241
|
* divergent re-resolution fails with `UnknownResolutionConflict`. Transitions
|
|
1226
1242
|
* `unknown → input-applied` once no open call remains, waking the lane. Fails with
|
|
1227
1243
|
* `SettlementConflict` once settled.
|
|
1228
|
-
* - `scanNonterminal` — streams every Submission whose state is not
|
|
1229
|
-
* (threadId, queueSequence); recovery's admission-independent worklist
|
|
1244
|
+
* - `scanNonterminal` — streams control-only entries for every Submission whose state is not
|
|
1245
|
+
* `settled`, ordered by (threadId, queueSequence); recovery's admission-independent worklist
|
|
1246
|
+
* (DUR-014). It must not decode execution payloads. SQL or control-identity corruption fails
|
|
1247
|
+
* the scan; selected-Thread payload hydration belongs inside the caller's isolation boundary.
|
|
1230
1248
|
* - `loadRecoverySnapshot` — strongly consistent full snapshot for the pure recovery classifier.
|
|
1231
1249
|
*
|
|
1232
1250
|
* No operation claims exactly-once external side effects; the ledger records decisions
|
|
@@ -2387,7 +2405,7 @@ declare class SettledSubmission extends SettledSubmission_base {}
|
|
|
2387
2405
|
declare const SubmissionStatus: Schema.Union<readonly [typeof PendingSubmission, typeof SettledSubmission]>;
|
|
2388
2406
|
type SubmissionStatus = typeof SubmissionStatus.Type;
|
|
2389
2407
|
declare namespace ThreadStore_d_exports {
|
|
2390
|
-
export { AppendConflict, AppendResult, CheckpointRejected, FenceRejected, FencedAppendRequest, LoadCheckpointRequest, MAX_THREAD_EXPORT_RECORDS, SaveCheckpointRequest, SaveRecoveryCheckpointRequest, SelectedThreadRead, ThreadCheckpoint, ThreadCheckpoints, ThreadExport, ThreadExportRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadObservation, ThreadOutstanding, ThreadOutstandingRequest, ThreadPeerCountRequest, ThreadRead, ThreadReadRequest, ThreadRecordRequest, ThreadRecoveryCheckpoints, ThreadRunInputRequest, ThreadSelection, ThreadStore, ThreadStoreError, ThreadStoreFailure, ThreadTail, ThreadTailRequest, ThreadWorkerStateRequest, getRecord, getRunInput, readOutstanding, readWorkerState };
|
|
2408
|
+
export { AppendConflict, AppendResult, CheckpointRejected, FenceRejected, FencedAppendRequest, LoadCheckpointRequest, MAX_THREAD_EXPORT_RECORDS, SaveCheckpointRequest, SaveRecoveryCheckpointRequest, SelectedThreadRead, ThreadCheckpoint, ThreadCheckpoints, ThreadExport, ThreadExportRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadObservation, ThreadOutstanding, ThreadOutstandingRequest, ThreadPeerCountRequest, ThreadRead, ThreadReadRequest, ThreadRecordRequest, ThreadRecoveryCheckpoints, ThreadRunInputRequest, ThreadSelection, ThreadStore, ThreadStoreDiagnostic, ThreadStoreError, ThreadStoreFailure, ThreadTail, ThreadTailRequest, ThreadWorkerStateRequest, getRecord, getRunInput, readOutstanding, readWorkerState };
|
|
2391
2409
|
}
|
|
2392
2410
|
declare const MAX_THREAD_EXPORT_RECORDS = 131072;
|
|
2393
2411
|
/** Exact canonical identity; absence is not proof that an admission was never accepted. */
|
|
@@ -2639,10 +2657,24 @@ declare const LoadCheckpointRequest_base: Schema.Class<LoadCheckpointRequest, Sc
|
|
|
2639
2657
|
readonly atOrBeforeSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
|
|
2640
2658
|
}>, {}>;
|
|
2641
2659
|
declare class LoadCheckpointRequest extends LoadCheckpointRequest_base {}
|
|
2660
|
+
declare const ThreadStoreDiagnostic_base: Schema.Class<ThreadStoreDiagnostic, Schema.Struct<{
|
|
2661
|
+
readonly causeTag: Schema.String;
|
|
2662
|
+
readonly operation: Schema.String;
|
|
2663
|
+
readonly decoder: Schema.optionalKey<Schema.String>;
|
|
2664
|
+
readonly issueTag: Schema.optionalKey<Schema.String>;
|
|
2665
|
+
readonly sequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
|
|
2666
|
+
}>, {}>;
|
|
2667
|
+
/**
|
|
2668
|
+
* Content-free storage provenance constructed by adapters from source-authored labels.
|
|
2669
|
+
* Raw foreign lookalikes are not trusted diagnostics. Never include rejected values, SQL,
|
|
2670
|
+
* or schema messages.
|
|
2671
|
+
*/
|
|
2672
|
+
declare class ThreadStoreDiagnostic extends ThreadStoreDiagnostic_base {}
|
|
2642
2673
|
declare const ThreadStoreError_base: Schema.Class<ThreadStoreError, Schema.TaggedStruct<"ThreadStoreError", {
|
|
2643
2674
|
readonly operation: Schema.String;
|
|
2644
2675
|
readonly message: Schema.String;
|
|
2645
2676
|
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
2677
|
+
readonly diagnostic: Schema.optionalKey<typeof ThreadStoreDiagnostic>;
|
|
2646
2678
|
}>, import("effect/Cause").YieldableError>;
|
|
2647
2679
|
declare class ThreadStoreError extends ThreadStoreError_base {}
|
|
2648
2680
|
declare const ThreadNotMaterialized_base: Schema.Class<ThreadNotMaterialized, Schema.TaggedStruct<"ThreadNotMaterialized", {
|
|
@@ -2710,7 +2742,7 @@ declare const ThreadStore_base: Context.ServiceClass<ThreadStore, "@effect-agent
|
|
|
2710
2742
|
}>;
|
|
2711
2743
|
declare class ThreadStore extends ThreadStore_base {}
|
|
2712
2744
|
declare namespace DurableAgentRuntime_d_exports {
|
|
2713
|
-
export { DurableAbortFailure, DurableAgentRuntime, DurableApprovalFailure, DurableApprovalResolver, DurableAwaitFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableProgressFailure, DurableResolveFailure, DurableRetryFailure, DurableRuntimeConfig, DurableRuntimeConfigOptions, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, DurableWorkerRequirements, Receipt, RecoveryReport, childReservationIdFor, recoveryRepairBatchId, recoveryRepairRecordId, threadCreatedBatchId, threadCreatedRecordId };
|
|
2745
|
+
export { DurableAbortFailure, DurableAgentRuntime, DurableApprovalFailure, DurableApprovalResolver, DurableAwaitFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableProgressFailure, DurableResolveFailure, DurableRetryFailure, DurableRuntimeConfig, DurableRuntimeConfigOptions, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, DurableWorkerRequirements, Receipt, RecoveryBlocked, RecoveryFailure, RecoveryReport, RecoverySweepOptions, RecoverySweepResult, childReservationIdFor, isolateRecovery, recoveryRepairBatchId, recoveryRepairRecordId, threadCreatedBatchId, threadCreatedRecordId };
|
|
2714
2746
|
}
|
|
2715
2747
|
/**
|
|
2716
2748
|
* Instruction failure/requirement derivation mirroring the engine's `RuntimeBinding` defaults:
|
|
@@ -2734,6 +2766,33 @@ declare const threadCreatedRecordId: (threadId: ThreadId) => RecordId;
|
|
|
2734
2766
|
declare const recoveryRepairBatchId: (submissionId: SubmissionId, decisionTag: string) => BatchId;
|
|
2735
2767
|
/** Deterministic record identity of one executed recovery decision's `RepairAnnotated` record. */
|
|
2736
2768
|
declare const recoveryRepairRecordId: (submissionId: SubmissionId, decisionTag: string) => RecordId;
|
|
2769
|
+
declare const RecoveryFailure_base: Schema.Class<RecoveryFailure, Schema.Struct<{
|
|
2770
|
+
readonly phase: Schema.Literals<readonly ["history", "recovery"]>;
|
|
2771
|
+
readonly reason: Schema.Literals<readonly ["failure", "defect", "timeout"]>;
|
|
2772
|
+
readonly errorTag: Schema.String;
|
|
2773
|
+
/** Static operation names only; error messages and payloads are deliberately excluded. */
|
|
2774
|
+
readonly operation: Schema.String;
|
|
2775
|
+
/** Ordered, bounded classifications. Foreign labels, operations and prose stay private. */
|
|
2776
|
+
readonly causes: Schema.$Array<Schema.Struct<{
|
|
2777
|
+
readonly errorTag: Schema.Literals<readonly ["AdmissionPolicyError", "DigestError", "LedgerError", "OwnershipLost", "SettlementConflict", "ThreadStoreError", "ThreadNotMaterialized", "AppendConflict", "FenceRejected", "RunJournalError", "DurableRuntimeFailpointError", "SchemaError", "Error", "TypeError", "RangeError", "ReferenceError", "SyntaxError", "URIError", "EvalError", "AggregateError", "ForeignError", "NonErrorCause"]>;
|
|
2778
|
+
}>>;
|
|
2779
|
+
readonly causesTruncated: Schema.optionalKey<Schema.Literal<true>>;
|
|
2780
|
+
readonly diagnostic: Schema.optionalKey<typeof ThreadStoreDiagnostic>;
|
|
2781
|
+
}>, {}>;
|
|
2782
|
+
/** Recovery could not establish execution authority. This is never a Settlement or replay grant. */
|
|
2783
|
+
declare class RecoveryFailure extends RecoveryFailure_base {}
|
|
2784
|
+
/** @internal One bounded failure boundary for execution history and host recovery control reads. */
|
|
2785
|
+
declare const isolateRecovery: <A, E extends DurableWorkerFailure, R>(body: Effect.Effect<A, E, R>, options: {
|
|
2786
|
+
readonly timeout: Duration.Duration;
|
|
2787
|
+
readonly phase: () => RecoveryFailure["phase"];
|
|
2788
|
+
readonly operation?: string;
|
|
2789
|
+
}) => Effect.Effect<Result.Result<A, RecoveryFailure>, E, Exclude<R, Scope.Scope>>;
|
|
2790
|
+
declare const RecoveryBlocked_base: Schema.Class<RecoveryBlocked, Schema.TaggedStruct<"RecoveryBlocked", {
|
|
2791
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
2792
|
+
readonly failure: typeof RecoveryFailure;
|
|
2793
|
+
}>, Cause.YieldableError>;
|
|
2794
|
+
/** One failed Thread remains pending; the host must not claim it before recovery succeeds. */
|
|
2795
|
+
declare class RecoveryBlocked extends RecoveryBlocked_base {}
|
|
2737
2796
|
declare const RecoveryReport_base: Schema.Class<RecoveryReport, Schema.Struct<{
|
|
2738
2797
|
readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
|
|
2739
2798
|
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
@@ -2748,6 +2807,17 @@ declare const RecoveryReport_base: Schema.Class<RecoveryReport, Schema.Struct<{
|
|
|
2748
2807
|
}>, {}>;
|
|
2749
2808
|
/** One executed (or deliberately deferred) recovery decision (durability §14, DUR-013). */
|
|
2750
2809
|
declare class RecoveryReport extends RecoveryReport_base {}
|
|
2810
|
+
declare const RecoverySweepResult_base: Schema.Class<RecoverySweepResult, Schema.Struct<{
|
|
2811
|
+
readonly reports: Schema.$Array<typeof RecoveryReport>;
|
|
2812
|
+
/** Exactly one fault per failed Thread, regardless of its queued Submission count. */
|
|
2813
|
+
readonly blocked: Schema.$Array<typeof RecoveryBlocked>;
|
|
2814
|
+
}>, {}>;
|
|
2815
|
+
/** Submission decisions and operational faults have different ownership and settlement semantics. */
|
|
2816
|
+
declare class RecoverySweepResult extends RecoverySweepResult_base {}
|
|
2817
|
+
/** Select one Thread before reading history, or omit to recover every pending Thread. */
|
|
2818
|
+
interface RecoverySweepOptions {
|
|
2819
|
+
readonly threadId?: ThreadId;
|
|
2820
|
+
}
|
|
2751
2821
|
/** Per-submission options accepted by `DurableAgentRuntime.submit` (D2). */
|
|
2752
2822
|
interface DurableSubmitOptions {
|
|
2753
2823
|
readonly threadId: ThreadId;
|
|
@@ -2842,6 +2912,8 @@ interface DurableRuntimeConfigOptions {
|
|
|
2842
2912
|
readonly leaseRenewalInterval?: Duration.Duration | undefined;
|
|
2843
2913
|
/** Active-Run abort-intent poll cadence (default 500ms). */
|
|
2844
2914
|
readonly abortPollInterval?: Duration.Duration | undefined;
|
|
2915
|
+
/** Cooperative bound for one Thread's recovery, including child reads (default 30s). */
|
|
2916
|
+
readonly recoveryTimeout?: Duration.Duration | undefined;
|
|
2845
2917
|
/** Deployment-owned model pricing authority, captured for every recoverable Run. */
|
|
2846
2918
|
readonly estimateCostMicrousd?: RunCostEstimator | undefined;
|
|
2847
2919
|
}
|
|
@@ -2851,6 +2923,7 @@ declare const DurableRuntimeConfig_base: Context.ServiceClass<DurableRuntimeConf
|
|
|
2851
2923
|
readonly settlementPollInterval: Duration.Duration;
|
|
2852
2924
|
readonly leaseRenewalInterval: Duration.Duration;
|
|
2853
2925
|
readonly abortPollInterval: Duration.Duration;
|
|
2926
|
+
readonly recoveryTimeout: Duration.Duration;
|
|
2854
2927
|
readonly estimateCostMicrousd?: RunCostEstimator | undefined;
|
|
2855
2928
|
}>;
|
|
2856
2929
|
/** Deployment-scoped identity and liveness cadences for the durable coordinator. */
|
|
@@ -2943,7 +3016,15 @@ declare const DurableAgentRuntime_base: Context.ServiceClass<DurableAgentRuntime
|
|
|
2943
3016
|
}) => Effect.Effect<Option.Option<Settlement>, DurableWorkerFailure | DurableBindingFailure>;
|
|
2944
3017
|
readonly runWorker: <InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions, Tools extends Record<string, Tool.Any>, Provider, ModelProvides, ModelRequires, InstructionError = InstructionErrorOf<Instructions, InputSchema["Type"]>, InstructionRequirements = InstructionRequirementsOf<Instructions, InputSchema["Type"]>, RunDispositionValue extends RunDispositionDeclaration<OutputSchema["Type"], Schema.Top> | undefined = undefined, InputPromptValue extends InputPromptSource<InputSchema["Type"], unknown, unknown> | undefined = undefined, UpdatesSchema extends Schema.Top | undefined = undefined>(agent: RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>) => Effect.Effect<void, DurableWorkerFailure | DurableBindingFailure, DurableWorkerRequirements<RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>, InstructionRequirements>>;
|
|
2945
3018
|
readonly runResolvedWorker: Effect.Effect<void, DurableWorkerFailure | DurableBindingFailure>;
|
|
2946
|
-
|
|
3019
|
+
/**
|
|
3020
|
+
* Recover each pending Thread independently. History/child failures, defects and the
|
|
3021
|
+
* configured timeout return one RecoveryBlocked per Thread; hosts must retain visibility
|
|
3022
|
+
* outside execution history and exclude those Threads from claims. Ledger scan failures,
|
|
3023
|
+
* owner interruption and injected crash boundaries still fail the whole sweep.
|
|
3024
|
+
* Optional Thread selection lets a host recover its selected dispatch lane independently
|
|
3025
|
+
* of old cleanup. Unselected Threads are neither read nor reported by this call.
|
|
3026
|
+
*/
|
|
3027
|
+
readonly runRecovery: (options?: RecoverySweepOptions) => Effect.Effect<RecoverySweepResult, DurableWorkerFailure>;
|
|
2947
3028
|
/** Apply one recovery decision; untouched ready input is deferred to its worker claim. */
|
|
2948
3029
|
readonly recoverSubmission: (submissionId: SubmissionId) => Effect.Effect<RecoveryReport, DurableWorkerFailure>;
|
|
2949
3030
|
}>;
|
|
@@ -4054,5 +4135,5 @@ declare const CanonicalRecordEnvelope_base: Schema.Class<CanonicalRecordEnvelope
|
|
|
4054
4135
|
declare class CanonicalRecordEnvelope extends CanonicalRecordEnvelope_base {}
|
|
4055
4136
|
declare const CURRENT_CANONICAL_SCHEMA_VERSION: 1;
|
|
4056
4137
|
//#endregion
|
|
4057
|
-
export { ToolCallPrepared as $, ReleaseOwnershipRequest as $a, ResumeSuspended as $i, runDurationRecordId as $n, predictRecoveryDisposition as $r, ThreadCheckpoints as $t, ProducerId as A, ChildSettledNotification as Aa, AwaitUnknownResolution as Ai, RunJournalError as An, WaitingChild as Ao, workerInputRecordId as Ar, DurableSubmitAgent as At, RunStartedRecord as B, LedgerError as Ba, OpenToolCallEvidence as Bi, compactionRecordId as Bn, IntegrityReport as Br, threadCreatedBatchId as Bt, ModelCompleted as C, BeginChildBudgetReleaseRequest as Ca, ApplyJoinAccounting as Ci, readOutstanding as Cn, SuspensionOutcome as Co, turnCanonicalBatch as Cr, DurableObligationFailure as Ct, PeerMessagePrepared as D, ChildReservationConflict as Da, AwaitChildSettlement as Di, SubmissionStatus as Dn, UnknownResolutionCommand as Do, turnResponseBatchId as Dr, DurableRetryFailure as Dt, ObservationOffset as E, ChildBudgetReservationSnapshot as Ea, AwaitChildAdmissionResolution as Ei, SettledSubmission as En, UnknownResolution as Eo, turnResponseBatch as Er, DurableResolveFailure as Et, ReplayContract as F, DEFAULT_OWNERSHIP_LEASE_DURATION as Fa, EnsureWaitingForChild as Fi, agentUpdateRecordId as Fn, submissionInputBatchId as Fo, ExplainedSubmission as Fr, DurableWorkerRequirements as Ft, SubagentRequested as G, OwnershipLost as Ga, Recovery_d_exports as Gi, modelResponseRecordId as Gn, ObligationThresholds as Gr, FenceRejected as Gt, SettlementOutcome as H, MarkJoinedRequest as Ha, PropagateChildAbort as Hi, markUnknownBatchId as Hn, ObligationEntry as Hr, AppendConflict as Ht, RunCompleted as I, InputAppliedMarker as Ia, FinalizeLedgerFromHistory as Ii, approvalDecisionBatchId as In, submissionInputRecordId as Io, ExplainedUnknownCall as Ir, RecoveryReport as It, SubmissionSettledRecord as J, OwnershipToken as Ja, RepairJoinMarker as Ji, projectRunJournalStream as Jn, RecoveryExplanation as Jr, MAX_THREAD_EXPORT_RECORDS as Jt, SubagentStarted as K, OwnershipRenewal as Ka, ReleaseOrphanChildReservation as Ki, peerMessageRecordId as Kn, RECOVERY_DECISION_MEANINGS as Kr, FencedAppendRequest as Kt, RunDurationExhausted as L, JoinSnapshot as La, MarkUnknown as Li, childIdempotencyKeyFor as Ln, submissionSettlementBatchId as Lo, IntegrityCheck as Lr, childReservationIdFor as Lt, RecordId as M, Claim as Ma, CompleteMaterialization as Mi, RunJournalUsage as Mn, settlementFailureFromRecord as Mo, workerReportRecordId as Mr, DurableSubmitOptions as Mt, Records_d_exports as N, ClaimJoiningRequest as Na, DeclaredPendingBatchEvidence as Ni, RunJournal_d_exports as Nn, submissionAbortBatchId as No, Admin_d_exports as Nr, DurableVerifyFailure as Nt, PersistedJson as O, ChildReservationId as Oa, AwaitHostSettlement as Oi, SubmissionStatus_d_exports as On, UnknownResolutionConflict as Oo, turnResultsBatch as Or, DurableRuntimeConfig as Ot, RepairAnnotated as P, ClaimRequest as Pa, DelegationAdmissionEvidence as Pi, TurnCommitInput as Pn, submissionAbortRecordId as Po, ExplainedEvidence as Pr, DurableWorkerFailure as Pt, ToolApprovalRequested as Q, ReleaseChildBudgetRequest as Qa, ResumePendingToolBatch as Qi, runDurationBatchId as Qn, obligationSeverityOf as Qr, ThreadCheckpoint as Qt, RunFailed as R, JoiningClaim as Ra, NoAction as Ri, childThreadIdFor as Rn, submissionSettlementId as Ro, IntegrityCheckName as Rr, recoveryRepairBatchId as Rt, MAX_PERSISTED_JSON_NODES as S, AttachChildToReservationRequest as Sa, ApplyInput as Si, getRunInput as Sn, SuspendRequest as So, turnBatchId as Sr, DurableExplainFailure as St, ModelResponseRecorded as T, ChildBudgetReservationRequest as Ta, AwaitApprovalDecision as Ti, PendingSubmission as Tn, SuspensionSnapshot as To, turnPreparedBatchId as Tr, DurableProgressFailure as Tt, SubagentJoined as U, MarkReadyRequest as Ua, RecoveryDecision as Ui, modelResponseInterruptedBatchId as Un, ObligationReport as Ur, AppendResult as Ut, SettlementFailureDiagnostic as V, MarkInputAppliedRequest as Va, PendingApprovalEvidence as Vi, firstWorkerInputRecordId as Vn, ObligationBlockedOn as Vr, threadCreatedRecordId as Vt, SubagentLineageRecorded as W, MarkUnknownRequest as Wa, RecoveryEvidence as Wi, modelResponseInterruptedRecordId as Wn, ObligationSeverity as Wr, CheckpointRejected as Wt, ThreadCreated as X, RecoverySnapshot as Xa, RepairSubagentStartLink as Xi, runCompletedRecordId as Xn, RetryRefusalReason as Xr, SaveRecoveryCheckpointRequest as Xt, SubtreeBudgetReserved as Y, ParentLinkage as Ya, RepairReadiness as Yi, promptFromCanonicalRecords as Yn, RetryCommand as Yr, SaveCheckpointRequest as Yt, ToolApprovalDecided as Z, RecoverySnapshotRequest as Za, ResumeFromTurnBoundary as Zi, runCompletionDigest as Zn, RetryRefused as Zr, SelectedThreadRead as Zt, Digest as _, AdmissionResult as _a, digestCanonicalBatch as _i, ThreadStore_d_exports as _n, SubmissionLookup as _o, toolCallSettledRecordId as _r, DurableAgentRuntime as _t, BatchId as a, AbortCommand as aa, BindingUnavailable as ai, ThreadOutstanding as an, ResolutionNeverHappened as ao, subagentLineageBatchId as ar, ToolStepSettled as at, MAX_PERSISTED_JSON_COLLECTION_LENGTH as b, ApprovalDecisionIntent as ba, digestJson as bi, ThreadWorkerStateRequest as bn, SubmissionSnapshot as bo, toolStepSettledRecordId as br, DurableApprovalResolver as bt, CanonicalRecord as c, AdmissionAdmitted as ca, ExecutableAgentBinding as ci, ThreadRead as cn, Settlement as co, subagentRequestedRecordId as cr, WorkerAdmission as ct, CanonicalSequence as d, AdmissionGroup as da, compileBindingContracts as di, ThreadRecoveryCheckpoints as dn, SettlementReservation as do, toolApprovalDecisionRecordId as dr, WorkerOrigin as dt, ResumeWaitingParent as ea, recoveryDecisionMeaning as ei, ThreadExport as en, RenewOwnershipRequest as eo, runIdForSubmission as er, ToolCallResolution as et, CompactionCreated as f, AdmissionIndeterminate as fa, compileRegistrations as fi, ThreadRunInputRequest as fn, SettlementReservationSnapshot as fo, toolApprovalRequestRecordId as fr, WorkerOriginRecorded as ft, DeploymentId as g, AdmissionResolution as ga, EMPTY_TAIL_DIGEST as gi, ThreadStoreFailure as gn, SubmissionLedger_d_exports as go, toolCallResultBatchId as gr, DurableAbortFailure as gt, DefinitionDigests as h, AdmissionRequest as ha, Digest_d_exports as hi, ThreadStoreError as hn, SubmissionLedgerFailure as ho, toolCallResolvedRecordId as hr, WorkerReportingIntent as ht, ApprovalDecision as i, classifyRecovery as ia, AgentRegistration as ii, ThreadObservation as in, ResolutionCompletedWithResult as io, subagentJoinedRecordId as ir, ToolOperation as it, RecordEnvelope as j, ChildSettledOutcome as ja, CompleteChildAdmission as ji, RunJournalProjection as jn, WaitingForChildSuspension as jo, workerOriginRecordId as jr, DurableSubmitFailure as jt, ProducerEpoch as k, ChildReservationStatus as ka, AwaitParentEstablishment as ki, JournalBoundary as kn, UnknownResolutionIntent as ko, turnResultsBatchId as kr, DurableRuntimeConfigOptions as kt, CanonicalRecordEnvelope as l, AdmissionConflict as la, ReplayVersions as li, ThreadReadRequest as ln, SettlementConflict as lo, subagentStartedBatchId as lr, WorkerInputCompleted as lt, DefinitionDigestInput as m, AdmissionPolicyError as ma, DigestError as mi, ThreadStore as mn, SubmissionLedger as mo, toolCallResolutionBatchId as mr, WorkerReportRefused as mt, AbortedSubmissionSettled as n, SettleAborted as na, AgentRegistration_d_exports as ni, ThreadMaterialization as nn, ReservedSettlement as no, runStartedRecordId as nr, ToolCallSettled as nt, CURRENT_CANONICAL_SCHEMA_VERSION as o, AbortIntent as oa, DurableBindingFailure as oi, ThreadOutstandingRequest as on, ResolutionSafeToRetry as oo, subagentLineageRecordId as or, ToolUnavailable as ot, CompletedSubmissionSettled as p, AdmissionNotAdmitted as pa, definitionDigestsEqual as pi, ThreadSelection as pn, SubmissionAdmissionFence as po, toolCallPreparedRecordId as pr, WorkerReportPrepared as pt, SubmissionSettled as q, OwnershipSnapshot as qa, RepairInputMarker as qi, projectRunJournal as qn, RecoveryDisposition as qr, LoadCheckpointRequest as qt, AgentUpdateEmitted as r, SettleJoinedWithHost as ra, AgentAttemptContext as ri, ThreadNotMaterialized as rn, ResolutionAbortSubmission as ro, subagentJoinBatchId as rr, ToolCallUnknown as rt, CanonicalBatch as s, AbortIntentRequest as sa, DurableWorkerBinding as si, ThreadPeerCountRequest as sn, RevertJoiningRequest as so, subagentRequestedBatchId as sr, UserInputRecorded as st, AbortRequested as t, RevertJoining as ta, renderRecoveryExplanation as ti, ThreadExportRequest as tn, ReservedChildBudget as to, runStartedBatchId as tr, ToolCallResolved as tt, CanonicalRecordPayload as u, AdmissionFence as ua, ResolvedBinding as ui, ThreadRecordRequest as un, SettlementFinalization as uo, subagentStartedRecordId as ur, WorkerInputRequested as ut, FailedSubmissionSettled as v, ApprovalConflict as va, digestDefinition as vi, ThreadTail as vn, SubmissionLookupById as vo, toolCallUnknownRecordId as vr, DurableAgentRuntime_d_exports as vt, ModelResponseInterrupted as w, ChildAttachmentSnapshot as wa, ApplyUnknownResolutions as wi, readWorkerState as wn, SuspensionReason as wo, turnIdForRun as wr, DurableObserveOptions as wt, MAX_PERSISTED_JSON_DEPTH as x, ApprovalPendingSuspension as xa, AppendReservedSettlement as xi, getRecord as xn, SubmissionState as xo, turnApprovalsBatchId as xr, DurableAwaitFailure as xt, MAX_PERSISTED_JSON_BYTES as y, ApprovalDecisionCommand as ya, digestDefinitions as yi, ThreadTailRequest as yn, SubmissionLookupByKey as yo, toolStepSettledBatchId as yr, DurableApprovalFailure as yt, RunPolicyUsageReserved as z, LedgerCapabilities as za, OpenDelegationCallEvidence as zi, compactionBatchId as zn, submissionSettlementRecordId as zo, IntegrityCheckStatus as zr, recoveryRepairRecordId as zt };
|
|
4058
|
-
//# sourceMappingURL=Records-
|
|
4138
|
+
export { ToolCallPrepared as $, OwnershipSnapshot as $a, RepairInputMarker as $i, projectRunJournal as $n, RecoveryDisposition as $r, MAX_THREAD_EXPORT_RECORDS as $t, ProducerId as A, ChildAttachmentSnapshot as Aa, ApplyUnknownResolutions as Ai, readWorkerState as An, SuspensionOutcome as Ao, turnIdForRun as Ar, DurableSubmitAgent as At, RunStartedRecord as B, ClaimRequest as Ba, DelegationAdmissionEvidence as Bi, TurnCommitInput as Bn, submissionAbortBatchId as Bo, ExplainedEvidence as Br, RecoverySweepResult as Bt, ModelCompleted as C, AdmissionResult as Ca, digestCanonicalBatch as Ci, ThreadStore_d_exports as Cn, SubmissionLookup as Co, toolCallSettledRecordId as Cr, DurableObligationFailure as Ct, PeerMessagePrepared as D, ApprovalPendingSuspension as Da, AppendReservedSettlement as Di, getRecord as Dn, SubmissionState as Do, turnApprovalsBatchId as Dr, DurableRetryFailure as Dt, ObservationOffset as E, ApprovalDecisionIntent as Ea, digestJson as Ei, ThreadWorkerStateRequest as En, SubmissionSnapshot as Eo, toolStepSettledRecordId as Er, DurableResolveFailure as Et, ReplayContract as F, ChildReservationStatus as Fa, AwaitParentEstablishment as Fi, JournalBoundary as Fn, UnknownResolutionConflict as Fo, turnResultsBatchId as Fr, DurableWorkerRequirements as Ft, SubagentRequested as G, LedgerCapabilities as Ga, OpenDelegationCallEvidence as Gi, compactionBatchId as Gn, submissionSettlementId as Go, IntegrityCheckStatus as Gr, threadCreatedBatchId as Gt, SettlementOutcome as H, InputAppliedMarker as Ha, FinalizeLedgerFromHistory as Hi, approvalDecisionBatchId as Hn, submissionInputBatchId as Ho, ExplainedUnknownCall as Hr, isolateRecovery as Ht, RunCompleted as I, ChildSettledNotification as Ia, AwaitUnknownResolution as Ii, RunJournalError as In, UnknownResolutionIntent as Io, workerInputRecordId as Ir, RecoveryBlocked as It, SubmissionSettledRecord as J, MarkJoinedRequest as Ja, PropagateChildAbort as Ji, markUnknownBatchId as Jn, ObligationEntry as Jr, AppendResult as Jt, SubagentStarted as K, LedgerError as Ka, OpenToolCallEvidence as Ki, compactionRecordId as Kn, submissionSettlementRecordId as Ko, IntegrityReport as Kr, threadCreatedRecordId as Kt, RunDurationExhausted as L, ChildSettledOutcome as La, CompleteChildAdmission as Li, RunJournalProjection as Ln, WaitingChild as Lo, workerOriginRecordId as Lr, RecoveryFailure as Lt, RecordId as M, ChildBudgetReservationSnapshot as Ma, AwaitChildAdmissionResolution as Mi, SettledSubmission as Mn, SuspensionSnapshot as Mo, turnResponseBatch as Mr, DurableSubmitOptions as Mt, Records_d_exports as N, ChildReservationConflict as Na, AwaitChildSettlement as Ni, SubmissionStatus as Nn, UnknownResolution as No, turnResponseBatchId as Nr, DurableVerifyFailure as Nt, PersistedJson as O, AttachChildToReservationRequest as Oa, ApplyInput as Oi, getRunInput as On, SubmissionWorkItem as Oo, turnBatchId as Or, DurableRuntimeConfig as Ot, RepairAnnotated as P, ChildReservationId as Pa, AwaitHostSettlement as Pi, SubmissionStatus_d_exports as Pn, UnknownResolutionCommand as Po, turnResultsBatch as Pr, DurableWorkerFailure as Pt, ToolApprovalRequested as Q, OwnershipRenewal as Qa, ReleaseOrphanChildReservation as Qi, peerMessageRecordId as Qn, RECOVERY_DECISION_MEANINGS as Qr, LoadCheckpointRequest as Qt, RunFailed as R, Claim as Ra, CompleteMaterialization as Ri, RunJournalUsage as Rn, WaitingForChildSuspension as Ro, workerReportRecordId as Rr, RecoveryReport as Rt, MAX_PERSISTED_JSON_NODES as S, AdmissionResolution as Sa, EMPTY_TAIL_DIGEST as Si, ThreadStoreFailure as Sn, SubmissionLedger_d_exports as So, toolCallResultBatchId as Sr, DurableExplainFailure as St, ModelResponseRecorded as T, ApprovalDecisionCommand as Ta, digestDefinitions as Ti, ThreadTailRequest as Tn, SubmissionLookupByKey as To, toolStepSettledBatchId as Tr, DurableProgressFailure as Tt, SubagentJoined as U, JoinSnapshot as Ua, MarkUnknown as Ui, childIdempotencyKeyFor as Un, submissionInputRecordId as Uo, IntegrityCheck as Ur, recoveryRepairBatchId as Ut, SettlementFailureDiagnostic as V, DEFAULT_OWNERSHIP_LEASE_DURATION as Va, EnsureWaitingForChild as Vi, agentUpdateRecordId as Vn, submissionAbortRecordId as Vo, ExplainedSubmission as Vr, childReservationIdFor as Vt, SubagentLineageRecorded as W, JoiningClaim as Wa, NoAction as Wi, childThreadIdFor as Wn, submissionSettlementBatchId as Wo, IntegrityCheckName as Wr, recoveryRepairRecordId as Wt, ThreadCreated as X, MarkUnknownRequest as Xa, RecoveryEvidence as Xi, modelResponseInterruptedRecordId as Xn, ObligationSeverity as Xr, FenceRejected as Xt, SubtreeBudgetReserved as Y, MarkReadyRequest as Ya, RecoveryDecision as Yi, modelResponseInterruptedBatchId as Yn, ObligationReport as Yr, CheckpointRejected as Yt, ToolApprovalDecided as Z, OwnershipLost as Za, Recovery_d_exports as Zi, modelResponseRecordId as Zn, ObligationThresholds as Zr, FencedAppendRequest as Zt, Digest as _, AdmissionGroup as _a, compileBindingContracts as _i, ThreadRunInputRequest as _n, SettlementReservation as _o, toolApprovalDecisionRecordId as _r, DurableAgentRuntime as _t, BatchId as a, ResumeSuspended as aa, predictRecoveryDisposition as ai, ThreadExport as an, ReleaseOwnershipRequest as ao, runDurationRecordId as ar, ToolStepSettled as at, MAX_PERSISTED_JSON_COLLECTION_LENGTH as b, AdmissionPolicyError as ba, DigestError as bi, ThreadStoreDiagnostic as bn, SubmissionLedger as bo, toolCallResolutionBatchId as br, DurableApprovalResolver as bt, CanonicalRecord as c, SettleAborted as ca, AgentRegistration_d_exports as ci, ThreadNotMaterialized as cn, ReservedSettlement as co, runStartedRecordId as cr, WorkerAdmission as ct, CanonicalSequence as d, AbortCommand as da, BindingUnavailable as di, ThreadOutstandingRequest as dn, ResolutionNeverHappened as do, subagentLineageBatchId as dr, WorkerOrigin as dt, RepairJoinMarker as ea, RecoveryExplanation as ei, SaveCheckpointRequest as en, OwnershipToken as eo, projectRunJournalStream as er, ToolCallResolution as et, CompactionCreated as f, AbortIntent as fa, DurableBindingFailure as fi, ThreadPeerCountRequest as fn, ResolutionSafeToRetry as fo, subagentLineageRecordId as fr, WorkerOriginRecorded as ft, DeploymentId as g, AdmissionFence as ga, ResolvedBinding as gi, ThreadRecoveryCheckpoints as gn, SettlementFinalization as go, subagentStartedRecordId as gr, DurableAbortFailure as gt, DefinitionDigests as h, AdmissionConflict as ha, ReplayVersions as hi, ThreadRecordRequest as hn, SettlementConflict as ho, subagentStartedBatchId as hr, WorkerReportingIntent as ht, ApprovalDecision as i, ResumePendingToolBatch as ia, obligationSeverityOf as ii, ThreadCheckpoints as in, ReleaseChildBudgetRequest as io, runDurationBatchId as ir, ToolOperation as it, RecordEnvelope as j, ChildBudgetReservationRequest as ja, AwaitApprovalDecision as ji, PendingSubmission as jn, SuspensionReason as jo, turnPreparedBatchId as jr, DurableSubmitFailure as jt, ProducerEpoch as k, BeginChildBudgetReleaseRequest as ka, ApplyJoinAccounting as ki, readOutstanding as kn, SuspendRequest as ko, turnCanonicalBatch as kr, DurableRuntimeConfigOptions as kt, CanonicalRecordEnvelope as l, SettleJoinedWithHost as la, AgentAttemptContext as li, ThreadObservation as ln, ResolutionAbortSubmission as lo, subagentJoinBatchId as lr, WorkerInputCompleted as lt, DefinitionDigestInput as m, AdmissionAdmitted as ma, ExecutableAgentBinding as mi, ThreadReadRequest as mn, Settlement as mo, subagentRequestedRecordId as mr, WorkerReportRefused as mt, AbortedSubmissionSettled as n, RepairSubagentStartLink as na, RetryRefusalReason as ni, SelectedThreadRead as nn, RecoverySnapshot as no, runCompletedRecordId as nr, ToolCallSettled as nt, CURRENT_CANONICAL_SCHEMA_VERSION as o, ResumeWaitingParent as oa, recoveryDecisionMeaning as oi, ThreadExportRequest as on, RenewOwnershipRequest as oo, runIdForSubmission as or, ToolUnavailable as ot, CompletedSubmissionSettled as p, AbortIntentRequest as pa, DurableWorkerBinding as pi, ThreadRead as pn, RevertJoiningRequest as po, subagentRequestedBatchId as pr, WorkerReportPrepared as pt, SubmissionSettled as q, MarkInputAppliedRequest as qa, PendingApprovalEvidence as qi, firstWorkerInputRecordId as qn, ObligationBlockedOn as qr, AppendConflict as qt, AgentUpdateEmitted as r, ResumeFromTurnBoundary as ra, RetryRefused as ri, ThreadCheckpoint as rn, RecoverySnapshotRequest as ro, runCompletionDigest as rr, ToolCallUnknown as rt, CanonicalBatch as s, RevertJoining as sa, renderRecoveryExplanation as si, ThreadMaterialization as sn, ReservedChildBudget as so, runStartedBatchId as sr, UserInputRecorded as st, AbortRequested as t, RepairReadiness as ta, RetryCommand as ti, SaveRecoveryCheckpointRequest as tn, ParentLinkage as to, promptFromCanonicalRecords as tr, ToolCallResolved as tt, CanonicalRecordPayload as u, classifyRecovery as ua, AgentRegistration as ui, ThreadOutstanding as un, ResolutionCompletedWithResult as uo, subagentJoinedRecordId as ur, WorkerInputRequested as ut, FailedSubmissionSettled as v, AdmissionIndeterminate as va, compileRegistrations as vi, ThreadSelection as vn, SettlementReservationSnapshot as vo, toolApprovalRequestRecordId as vr, DurableAgentRuntime_d_exports as vt, ModelResponseInterrupted as w, ApprovalConflict as wa, digestDefinition as wi, ThreadTail as wn, SubmissionLookupById as wo, toolCallUnknownRecordId as wr, DurableObserveOptions as wt, MAX_PERSISTED_JSON_DEPTH as x, AdmissionRequest as xa, Digest_d_exports as xi, ThreadStoreError as xn, SubmissionLedgerFailure as xo, toolCallResolvedRecordId as xr, DurableAwaitFailure as xt, MAX_PERSISTED_JSON_BYTES as y, AdmissionNotAdmitted as ya, definitionDigestsEqual as yi, ThreadStore as yn, SubmissionAdmissionFence as yo, toolCallPreparedRecordId as yr, DurableApprovalFailure as yt, RunPolicyUsageReserved as z, ClaimJoiningRequest as za, DeclaredPendingBatchEvidence as zi, RunJournal_d_exports as zn, settlementFailureFromRecord as zo, Admin_d_exports as zr, RecoverySweepOptions as zt };
|
|
4139
|
+
//# sourceMappingURL=Records-BtxMy8xD.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as Receipt } from "./Receipt-BAHyigAF.mjs";
|
|
2
2
|
import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-CaAkzGHL.mjs";
|
|
3
|
-
import { _ as Digest, h as DefinitionDigests } from "./Records-
|
|
3
|
+
import { _ as Digest, h as DefinitionDigests } from "./Records-BtxMy8xD.mjs";
|
|
4
4
|
import { Context, Effect, Schema } from "effect";
|
|
5
5
|
declare namespace Schedule_d_exports {
|
|
6
6
|
export { ScheduleAuthorizationDecision, ScheduleAuthorizationError, ScheduleAuthorizer, ScheduleCapacityError, ScheduleChange, ScheduleConfiguration, ScheduleConflict, ScheduleDestination, ScheduleDueCursor, ScheduleFailpoint, ScheduleFailpointError, ScheduleId, ScheduleInstant, ScheduleKey, ScheduleManagementAuthorization, ScheduleManagementOperation, ScheduleNotFound, ScheduleOccurrenceAuthorization, ScheduleOwner, SchedulePage, SchedulePageRequest, SchedulePending, ScheduleRecord, ScheduleRefusal, ScheduleRetry, ScheduleRetryReason, ScheduleScope, ScheduleSkippedRange, ScheduleSnapshot, ScheduleSnapshotPage, ScheduleStorageError, ScheduleStore, ScheduleStoreFailure, ScheduleTiming, ScheduleTimingRequest, ScheduleValidationError, ScheduleWake, ScheduledEnvelope, ScheduledInputAdmission, ScheduledInputFailure, ScheduledInputRefused, ScheduledInputRetryable, SchedulingLimits, defaultSchedulingLimits };
|
|
@@ -844,4 +844,4 @@ declare const ScheduleFailpoint: Context.Reference<{
|
|
|
844
844
|
}>;
|
|
845
845
|
//#endregion
|
|
846
846
|
export { ScheduleSnapshotPage as A, ScheduledInputAdmission as B, ScheduleRecord as C, ScheduleScope as D, ScheduleRetryReason as E, ScheduleTimingRequest as F, defaultSchedulingLimits as G, ScheduledInputRefused as H, ScheduleValidationError as I, ScheduleWake as L, ScheduleStore as M, ScheduleStoreFailure as N, ScheduleSkippedRange as O, ScheduleTiming as P, Schedule_d_exports as R, SchedulePending as S, ScheduleRetry as T, ScheduledInputRetryable as U, ScheduledInputFailure as V, SchedulingLimits as W, ScheduleNotFound as _, ScheduleChange as a, SchedulePage as b, ScheduleDestination as c, ScheduleFailpointError as d, ScheduleId as f, ScheduleManagementOperation as g, ScheduleManagementAuthorization as h, ScheduleCapacityError as i, ScheduleStorageError as j, ScheduleSnapshot as k, ScheduleDueCursor as l, ScheduleKey as m, ScheduleAuthorizationError as n, ScheduleConfiguration as o, ScheduleInstant as p, ScheduleAuthorizer as r, ScheduleConflict as s, ScheduleAuthorizationDecision as t, ScheduleFailpoint as u, ScheduleOccurrenceAuthorization as v, ScheduleRefusal as w, SchedulePageRequest as x, ScheduleOwner as y, ScheduledEnvelope as z };
|
|
847
|
-
//# sourceMappingURL=Schedule-
|
|
847
|
+
//# sourceMappingURL=Schedule-DGPyXBzK.d.mts.map
|
|
@@ -2,8 +2,8 @@ import { d as SubagentReservationAmounts, l as SubagentGrant, o as SubagentDeleg
|
|
|
2
2
|
import { a as Receipt, r as Principal } from "./Receipt-BAHyigAF.mjs";
|
|
3
3
|
import { r as Update } from "./AgentUpdates-DMJ-_xow.mjs";
|
|
4
4
|
import { t as AgentPolicy } from "./AgentPolicy-BqDoSXO6.mjs";
|
|
5
|
-
import { _ as Digest, h as DefinitionDigests } from "./Records-
|
|
6
|
-
import { t as ScheduleAuthorizationDecision } from "./Schedule-
|
|
5
|
+
import { _ as Digest, h as DefinitionDigests } from "./Records-BtxMy8xD.mjs";
|
|
6
|
+
import { t as ScheduleAuthorizationDecision } from "./Schedule-DGPyXBzK.mjs";
|
|
7
7
|
import { Context, Effect, Schema } from "effect";
|
|
8
8
|
declare namespace Subscription_d_exports {
|
|
9
9
|
export { AcceptedEvent, DeliveryChange, EventAcknowledgement, EventSourceVersion, PreparedInput, SourcePartition, SourceRecovery, SubscriptionAuthorizer, SubscriptionChange, SubscriptionConfiguration, SubscriptionDelivery, SubscriptionDeliveryKey, SubscriptionDeliverySnapshot, SubscriptionError, SubscriptionFailpoint, SubscriptionFailpointError, SubscriptionKey, SubscriptionLimits, SubscriptionName, SubscriptionRecord, SubscriptionRefusal, SubscriptionRetentionPolicy, SubscriptionScanCursors, SubscriptionScope, SubscriptionSnapshot, SubscriptionSourceError, SubscriptionStore, SubscriptionStoreFailure, defaultSubscriptionLimits, subscriptionDeliveryKeyString, subscriptionKeyString };
|
|
@@ -942,4 +942,4 @@ declare const subscriptionKeyString: (key: SubscriptionKey) => string;
|
|
|
942
942
|
declare const subscriptionDeliveryKeyString: (key: SubscriptionDeliveryKey) => string;
|
|
943
943
|
//#endregion
|
|
944
944
|
export { defaultSubscriptionLimits as A, SubscriptionScanCursors as C, SubscriptionStore as D, SubscriptionSourceError as E, subscriptionKeyString as M, SubscriptionStoreFailure as O, SubscriptionRetentionPolicy as S, SubscriptionSnapshot as T, SubscriptionKey as _, PreparedInput as a, SubscriptionRecord as b, SubscriptionAuthorizer as c, SubscriptionDelivery as d, SubscriptionDeliveryKey as f, SubscriptionFailpointError as g, SubscriptionFailpoint as h, EventSourceVersion as i, subscriptionDeliveryKeyString as j, Subscription_d_exports as k, SubscriptionChange as l, SubscriptionError as m, DeliveryChange as n, SourcePartition as o, SubscriptionDeliverySnapshot as p, EventAcknowledgement as r, SourceRecovery as s, AcceptedEvent as t, SubscriptionConfiguration as u, SubscriptionLimits as v, SubscriptionScope as w, SubscriptionRefusal as x, SubscriptionName as y };
|
|
945
|
-
//# sourceMappingURL=Subscription-
|
|
945
|
+
//# sourceMappingURL=Subscription-B9VszlF9.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as AgentId } from "./Identifiers-CN2s30fF.mjs";
|
|
2
|
-
import { O as PersistedJson, h as DefinitionDigests } from "./Records-
|
|
3
|
-
import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, m as SubscriptionError, t as AcceptedEvent, u as SubscriptionConfiguration } from "./Subscription-
|
|
2
|
+
import { O as PersistedJson, h as DefinitionDigests } from "./Records-BtxMy8xD.mjs";
|
|
3
|
+
import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, m as SubscriptionError, t as AcceptedEvent, u as SubscriptionConfiguration } from "./Subscription-B9VszlF9.mjs";
|
|
4
4
|
import { Context, Effect, Schema, Scope } from "effect";
|
|
5
5
|
declare namespace SubscriptionInput_d_exports {
|
|
6
6
|
export { SubscriptionInputBinding, SubscriptionInputBindings, makeSubscriptionInputBinding, resolveSubscriptionInput };
|
|
@@ -38,4 +38,4 @@ declare const makeSubscriptionInputBinding: <Event extends Schema.Top, Parameter
|
|
|
38
38
|
}) => Effect.Effect<SubscriptionInputBinding, never, Exclude<R, Scope.Scope> | Exclude<Continuation["DecodingServices"], Scope.Scope> | Exclude<Continuation["EncodingServices"], Scope.Scope> | Exclude<Event["DecodingServices"], Scope.Scope> | Exclude<Input["EncodingServices"], Scope.Scope> | Exclude<Parameters["DecodingServices"], Scope.Scope>>;
|
|
39
39
|
//#endregion
|
|
40
40
|
export { resolveSubscriptionInput as a, makeSubscriptionInputBinding as i, SubscriptionInputBindings as n, SubscriptionInput_d_exports as r, SubscriptionInputBinding as t };
|
|
41
|
-
//# sourceMappingURL=SubscriptionInput-
|
|
41
|
+
//# sourceMappingURL=SubscriptionInput-BJWZqCWP.d.mts.map
|
|
@@ -27,7 +27,7 @@ declare const McpConnectionRequest_base: Schema.Class<McpConnectionRequest, Sche
|
|
|
27
27
|
* changing what the model can call.
|
|
28
28
|
*/
|
|
29
29
|
export declare class McpConnectionRequest extends McpConnectionRequest_base {}
|
|
30
|
-
declare const McpToolOutputSchema_base: Context.ServiceClass<McpToolOutputSchema, "@effect-agent/capabilities/McpToolOutputSchema", Option.Option<
|
|
30
|
+
declare const McpToolOutputSchema_base: Context.ServiceClass<McpToolOutputSchema, "@effect-agent/capabilities/McpToolOutputSchema", Option.Option<Schema.JsonObject>>;
|
|
31
31
|
/**
|
|
32
32
|
* Tool annotation recording the `outputSchema` an MCP server advertised for a
|
|
33
33
|
* Tool the framework client derived from discovery, or `None` when the server
|
|
@@ -85,12 +85,11 @@ var McpDiscovery = class extends Schema.Class("@effect-agent/capabilities/McpDis
|
|
|
85
85
|
var McpConnector = class extends Context.Service()("@effect-agent/capabilities/McpConnector") {};
|
|
86
86
|
/**
|
|
87
87
|
* `Tool.getJsonSchema`/`Tool.getJsonSchemaFromSchema` hoist a named, refined
|
|
88
|
-
* type into `$defs` with a top-level `$ref
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* inlines a single top-level `$ref` before either side is digested.
|
|
88
|
+
* type into `$defs` with a top-level `$ref`. MCP inputs require an object root,
|
|
89
|
+
* and connectors may advertise named object outputs in that flattened form too.
|
|
90
|
+
* Inline a single top-level `$ref` in locally derived schemas so those contracts
|
|
91
|
+
* compare consistently with discovery. Explicit output annotations retain the
|
|
92
|
+
* advertised schema unchanged, including non-object roots.
|
|
94
93
|
*/
|
|
95
94
|
const flattenTopLevelRef = (schema) => {
|
|
96
95
|
const ref = schema["$ref"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mcp.mjs","names":[],"sources":["../../src/capabilities/Mcp.ts"],"sourcesContent":["import {\n Array,\n type JsonSchema,\n Context,\n Crypto,\n Duration,\n Effect,\n Encoding,\n JsonPointer,\n type Layer,\n Option,\n Schema,\n type Scope,\n} from \"effect\";\nimport { Tool, type Toolkit } from \"effect/unstable/ai\";\nimport * as McpSchema from \"effect/unstable/ai/McpSchema\";\n\nimport { utf8ByteLength } from \"../core/internal/utf8.ts\";\n\nconst MAX_MCP_TOOLS = 128;\nconst MAX_MCP_DISCOVERY_BYTES = 1024 * 1024;\nconst PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));\nconst Sha256Digest = Schema.String.check(Schema.isPattern(/^sha256:[a-f0-9]{64}$/));\n\n/** Server identity copied directly from Effect AI's native MCP initialization schema. */\nexport class McpServerIdentity extends Schema.Class<McpServerIdentity>(\n \"@effect-agent/capabilities/McpServerIdentity\",\n)({\n serverId: Schema.NonEmptyString,\n implementation: McpSchema.Implementation,\n}) {}\n\n/**\n * Requested hard limits for an adapter-owned MCP connection and discovery response.\n *\n * `expectedToolkitSchemaDigest` pins the tool contract an Agent was authored\n * against: when a connector derives its Toolkit from live discovery, a server\n * that adds, removes, or reshapes a tool fails closed instead of silently\n * changing what the model can call.\n */\nexport class McpConnectionRequest extends Schema.Class<McpConnectionRequest>(\n \"@effect-agent/capabilities/McpConnectionRequest\",\n)({\n serverId: Schema.NonEmptyString,\n maxToolCount: PositiveInt.check(Schema.isLessThanOrEqualTo(MAX_MCP_TOOLS)),\n maxToolDescriptionBytes: PositiveInt,\n maxDiscoveryBytes: PositiveInt.check(Schema.isLessThanOrEqualTo(MAX_MCP_DISCOVERY_BYTES)),\n connectTimeoutMillis: PositiveInt,\n expectedToolkitSchemaDigest: Schema.optionalKey(Sha256Digest),\n}) {}\n\n/**\n * Tool annotation recording the `outputSchema` an MCP server advertised for a\n * Tool the framework client derived from discovery, or `None` when the server\n * advertised none. Such a Tool's Effect success Schema is the client's result\n * envelope rather than the wire contract, so discovery validation compares\n * this annotation instead. Tools without the annotation, including dynamic\n * Tools from other connectors, keep deriving it from their success Schema.\n */\nexport class McpToolOutputSchema extends Context.Service<\n McpToolOutputSchema,\n Option.Option<McpSchema.ToolJsonSchema>\n>()(\"@effect-agent/capabilities/McpToolOutputSchema\") {}\n\n/** Typed remote connection failure; no remote execution is claimed exactly-once. */\nexport class McpConnectionError extends Schema.TaggedError<McpConnectionError>()(\n \"McpConnectionError\",\n {\n serverId: Schema.NonEmptyString,\n message: Schema.String,\n cause: Schema.optionalKey(Schema.Defect()),\n },\n) {}\n\n/** Discovery exceeded an explicit caller or framework hard bound. */\nexport class McpDiscoveryLimitExceeded extends Schema.TaggedError<McpDiscoveryLimitExceeded>()(\n \"McpDiscoveryLimitExceeded\",\n {\n serverId: Schema.NonEmptyString,\n limit: Schema.Literals([\"tool-count\", \"tool-description-bytes\", \"discovery-bytes\"]),\n limitValue: Schema.Natural,\n observedValue: Schema.Natural,\n },\n) {}\n\n/** Native dynamic Toolkit names did not match the bounded MCP discovery response. */\nexport class McpToolkitMismatch extends Schema.TaggedError<McpToolkitMismatch>()(\n \"McpToolkitMismatch\",\n {\n serverId: Schema.NonEmptyString,\n message: Schema.String,\n cause: Schema.optionalKey(Schema.Defect()),\n },\n) {}\n\n/** Validated discovery metadata; native Effect AI MCP values retain provider detail. */\nexport class McpDiscovery extends Schema.Class<McpDiscovery>(\n \"@effect-agent/capabilities/McpDiscovery\",\n)({\n identity: McpServerIdentity,\n capabilities: McpSchema.ServerCapabilities,\n tools: Schema.Array(McpSchema.Tool).check(Schema.isMaxLength(MAX_MCP_TOOLS)),\n encodedBytes: Schema.Natural.check(Schema.isLessThanOrEqualTo(MAX_MCP_DISCOVERY_BYTES)),\n toolkitSchemaDigest: Sha256Digest,\n}) {}\n\n/**\n * Raw adapter result before the framework validates count and byte limits.\n * A connector that executes tools remotely supplies `handlers`; a connector\n * serving an application-authored Toolkit leaves them to the application.\n */\nexport interface McpConnectedServer {\n readonly identity: McpServerIdentity;\n readonly capabilities: McpSchema.ServerCapabilities;\n readonly tools: ReadonlyArray<McpSchema.Tool>;\n readonly toolkit: Toolkit.Any;\n readonly handlers?: Layer.Layer<Tool.Handler<string>> | undefined;\n}\n\n/** Scoped validated MCP connection with native Effect AI dynamic Toolkit values. */\nexport interface McpConnection {\n readonly discovery: McpDiscovery;\n readonly toolkit: Toolkit.Any;\n /** Handler Layer for `toolkit` when the connector executes tools remotely. */\n readonly handlers?: Layer.Layer<Tool.Handler<string>> | undefined;\n}\n\n/** Adapter port for native Effect AI MCP protocol/schema integration. */\nexport class McpConnector extends Context.Service<\n McpConnector,\n {\n readonly connect: (\n request: McpConnectionRequest,\n ) => Effect.Effect<McpConnectedServer, McpConnectionError, Scope.Scope>;\n }\n>()(\"@effect-agent/capabilities/McpConnector\") {}\n\n/**\n * `Tool.getJsonSchema`/`Tool.getJsonSchemaFromSchema` hoist a named, refined\n * type into `$defs` with a top-level `$ref`, but a real MCP server can only\n * ever advertise a flat `{ type: \"object\", ... }` `inputSchema`/`outputSchema`\n * (`McpSchema.ToolJsonSchema` has no `$ref` case). Comparing an unresolved\n * `$ref` derivation against a real discovered schema would report every tool\n * with a named parameter or success type as permanently drifted, so this\n * inlines a single top-level `$ref` before either side is digested.\n */\nconst flattenTopLevelRef = (schema: JsonSchema.JsonSchema): JsonSchema.JsonSchema => {\n const ref = schema[\"$ref\"];\n const defs = schema[\"$defs\"] as JsonSchema.Definitions | undefined;\n\n if (typeof ref !== \"string\" || defs === undefined) return schema;\n\n const key = ref.startsWith(\"#/$defs/\")\n ? JsonPointer.unescapeToken(ref.slice(\"#/$defs/\".length))\n : undefined;\n\n return key !== undefined && Object.hasOwn(defs, key) ? defs[key] : schema;\n};\n\nconst canonicalJson = (value: Schema.Json): Schema.Json => {\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\" ||\n typeof value === \"number\"\n ) {\n return value;\n }\n if (Array.isArray<Schema.Json>(value)) return value.map(canonicalJson);\n const output: Record<string, Schema.Json> = {};\n\n // Keys sort by UTF-16 code units (RFC 8785 style): locale-aware collation varies\n // across hosts and treats canonically equivalent distinct key sequences as equal.\n for (const [key, item] of Object.entries(value).sort(([left], [right]) =>\n left < right ? -1 : left > right ? 1 : 0,\n )) {\n output[key] = canonicalJson(item);\n }\n\n return output;\n};\n\nconst utf8 = (value: string): Uint8Array => {\n const hex = Encoding.encodeHex(value);\n const bytes = new Uint8Array(hex.length / 2);\n\n for (let index = 0; index < bytes.length; index += 1) {\n bytes[index] = Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16);\n }\n\n return bytes;\n};\n\n/**\n * The `outputSchema` a Toolkit member claims. A Tool annotated with\n * `McpToolOutputSchema` reports exactly what discovery advertised, present or\n * absent; every other Tool derives it from its success Schema.\n */\nconst toolkitOutputSchema = (tool: Tool.Any): JsonSchema.JsonSchema | undefined => {\n const discovered = Context.getOption(tool.annotations, McpToolOutputSchema);\n\n if (Option.isSome(discovered)) return Option.getOrUndefined(discovered.value);\n const derived = flattenTopLevelRef(Tool.getJsonSchemaFromSchema(tool.successSchema));\n\n return derived.type === \"object\" ? derived : undefined;\n};\n\nconst digestJson = Effect.fn(\"digestMcpSchema\")(function* (serverId: string, value: unknown) {\n const json = yield* Schema.decodeUnknownEffect(Schema.Json)(value).pipe(\n Effect.mapError((error) =>\n McpToolkitMismatch.make({\n cause: error,\n serverId,\n message: `MCP Tool schema is not canonical JSON: ${error.message}`,\n }),\n ),\n );\n\n const encoded = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Json))(\n canonicalJson(json),\n ).pipe(\n Effect.mapError((error) =>\n McpToolkitMismatch.make({\n cause: error,\n serverId,\n message: `Could not encode canonical MCP Tool schema JSON: ${error.message}`,\n }),\n ),\n );\n\n const crypto = yield* Crypto.Crypto;\n\n const digest = yield* crypto.digest(\"SHA-256\", utf8(encoded)).pipe(\n Effect.mapError((cause) =>\n McpToolkitMismatch.make({\n cause,\n serverId,\n message: \"Could not hash MCP Tool schemas\",\n }),\n ),\n );\n\n return `sha256:${Encoding.encodeHex(digest)}`;\n});\n\n/** Validate native discovery data before it enters Agent Tool context. */\nexport const validateMcpDiscovery = Effect.fn(\"validateMcpDiscovery\")(function* (\n request: McpConnectionRequest,\n server: McpConnectedServer,\n) {\n if (server.identity.serverId !== request.serverId) {\n return yield* McpToolkitMismatch.make({\n serverId: request.serverId,\n message: `Connected server identity '${server.identity.serverId}' does not match the requested server`,\n });\n }\n if (server.tools.length > request.maxToolCount) {\n return yield* McpDiscoveryLimitExceeded.make({\n serverId: request.serverId,\n limit: \"tool-count\",\n limitValue: request.maxToolCount,\n observedValue: server.tools.length,\n });\n }\n for (const tool of server.tools) {\n const descriptionBytes = utf8ByteLength(tool.description ?? \"\");\n\n if (descriptionBytes > request.maxToolDescriptionBytes) {\n return yield* McpDiscoveryLimitExceeded.make({\n serverId: request.serverId,\n limit: \"tool-description-bytes\",\n limitValue: request.maxToolDescriptionBytes,\n observedValue: descriptionBytes,\n });\n }\n }\n const discoveredNames = server.tools.map((tool) => tool.name).sort();\n const toolkitNames = Object.keys(server.toolkit.tools).sort();\n\n if (\n discoveredNames.length !== toolkitNames.length ||\n discoveredNames.some((name, index) => name !== toolkitNames[index])\n ) {\n return yield* McpToolkitMismatch.make({\n serverId: request.serverId,\n message: \"Native Effect AI Toolkit names do not match MCP tool discovery\",\n });\n }\n\n const discoverySchemas = server.tools\n .map((tool) => ({\n name: tool.name,\n inputSchema: tool.inputSchema,\n ...(tool.outputSchema !== undefined ? { outputSchema: tool.outputSchema } : {}),\n }))\n .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));\n\n const toolkitSchemas = yield* Effect.try({\n try: () =>\n Object.values(server.toolkit.tools)\n .map((tool) => {\n const outputSchema = toolkitOutputSchema(tool);\n\n return {\n name: tool.name,\n inputSchema: flattenTopLevelRef(Tool.getJsonSchema(tool)),\n ...(outputSchema === undefined ? {} : { outputSchema }),\n };\n })\n .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0)),\n catch: (cause) =>\n McpToolkitMismatch.make({\n cause,\n serverId: request.serverId,\n message: \"Could not derive JSON Schema from the native Effect AI Toolkit\",\n }),\n });\n\n const discoveryDigest = yield* digestJson(request.serverId, discoverySchemas);\n const toolkitDigest = yield* digestJson(request.serverId, toolkitSchemas);\n\n if (discoveryDigest !== toolkitDigest) {\n return yield* McpToolkitMismatch.make({\n serverId: request.serverId,\n message: \"Native Effect AI Toolkit schemas do not match MCP tool discovery\",\n });\n }\n if (\n request.expectedToolkitSchemaDigest !== undefined &&\n request.expectedToolkitSchemaDigest !== toolkitDigest\n ) {\n return yield* McpToolkitMismatch.make({\n serverId: request.serverId,\n message: `MCP tool discovery digest ${toolkitDigest} does not match the expected ${request.expectedToolkitSchemaDigest}`,\n });\n }\n\n const encoded = yield* Schema.encodeEffect(\n Schema.Struct({\n identity: McpServerIdentity,\n capabilities: McpSchema.ServerCapabilities,\n tools: Schema.Array(McpSchema.Tool),\n }),\n )({\n identity: server.identity,\n capabilities: server.capabilities,\n tools: server.tools,\n }).pipe(\n Effect.mapError((error) =>\n McpConnectionError.make({\n cause: error,\n serverId: request.serverId,\n message: `Could not encode MCP discovery response: ${error.message}`,\n }),\n ),\n );\n\n const discoveryJson = yield* Schema.decodeEffect(Schema.Json)(encoded).pipe(\n Effect.mapError((error) =>\n McpConnectionError.make({\n cause: error,\n serverId: request.serverId,\n message: `Could not normalize MCP discovery response as JSON: ${error.message}`,\n }),\n ),\n );\n\n const discoveryText = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Json))(\n discoveryJson,\n ).pipe(\n Effect.mapError((error) =>\n McpConnectionError.make({\n cause: error,\n serverId: request.serverId,\n message: `Could not serialize MCP discovery response: ${error.message}`,\n }),\n ),\n );\n\n const discoveryBytes = utf8ByteLength(discoveryText);\n\n if (discoveryBytes > request.maxDiscoveryBytes) {\n return yield* McpDiscoveryLimitExceeded.make({\n serverId: request.serverId,\n limit: \"discovery-bytes\",\n limitValue: request.maxDiscoveryBytes,\n observedValue: discoveryBytes,\n });\n }\n\n return McpDiscovery.make({\n identity: server.identity,\n capabilities: server.capabilities,\n tools: server.tools,\n encodedBytes: discoveryBytes,\n toolkitSchemaDigest: toolkitDigest,\n });\n});\n\n/**\n * Acquire a native connection in Scope, enforce a Clock-controlled timeout,\n * then validate discovery before exposing its Toolkit.\n */\nexport const connectMcp = Effect.fn(\"connectMcp\")(function* (request: McpConnectionRequest) {\n const connector = yield* McpConnector;\n\n const server = yield* connector.connect(request).pipe(\n Effect.timeoutOrElse({\n duration: Duration.millis(request.connectTimeoutMillis),\n orElse: () =>\n Effect.fail(\n McpConnectionError.make({\n serverId: request.serverId,\n message: \"MCP connection timed out\",\n }),\n ),\n }),\n );\n\n const discovery = yield* validateMcpDiscovery(request, server);\n\n return {\n discovery,\n toolkit: server.toolkit,\n ...(server.handlers === undefined ? {} : { handlers: server.handlers }),\n } satisfies McpConnection;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,gBAAgB;AACtB,MAAM,0BAA0B;AAChC,MAAM,cAAc,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,eAAe,OAAO,OAAO,MAAM,OAAO,UAAU,uBAAuB,CAAC;;AAGlF,IAAa,oBAAb,cAAuC,OAAO,MAC5C,8CACF,CAAC,CAAC;CACA,UAAU,OAAO;CACjB,gBAAgB,UAAU;AAC5B,CAAC,CAAC,CAAC,CAAC;;;;;;;;;AAUJ,IAAa,uBAAb,cAA0C,OAAO,MAC/C,iDACF,CAAC,CAAC;CACA,UAAU,OAAO;CACjB,cAAc,YAAY,MAAM,OAAO,oBAAoB,aAAa,CAAC;CACzE,yBAAyB;CACzB,mBAAmB,YAAY,MAAM,OAAO,oBAAoB,uBAAuB,CAAC;CACxF,sBAAsB;CACtB,6BAA6B,OAAO,YAAY,YAAY;AAC9D,CAAC,CAAC,CAAC,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KAAK;GACtB,UAAU,QAAQ;GAClB,SAAS;EACX,CAAC,CACH;CACJ,CAAC,CACH;CAIA,OAAO;EACL,WAAA,OAHuB,qBAAqB,SAAS,MAAM;EAI3D,SAAS,OAAO;EAChB,GAAI,OAAO,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,OAAO,SAAS;CACvE;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"Mcp.mjs","names":[],"sources":["../../src/capabilities/Mcp.ts"],"sourcesContent":["import {\n Array,\n type JsonSchema,\n Context,\n Crypto,\n Duration,\n Effect,\n Encoding,\n JsonPointer,\n type Layer,\n Option,\n Schema,\n type Scope,\n} from \"effect\";\nimport { Tool, type Toolkit } from \"effect/unstable/ai\";\nimport * as McpSchema from \"effect/unstable/ai/McpSchema\";\n\nimport { utf8ByteLength } from \"../core/internal/utf8.ts\";\n\nconst MAX_MCP_TOOLS = 128;\nconst MAX_MCP_DISCOVERY_BYTES = 1024 * 1024;\nconst PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));\nconst Sha256Digest = Schema.String.check(Schema.isPattern(/^sha256:[a-f0-9]{64}$/));\n\n/** Server identity copied directly from Effect AI's native MCP initialization schema. */\nexport class McpServerIdentity extends Schema.Class<McpServerIdentity>(\n \"@effect-agent/capabilities/McpServerIdentity\",\n)({\n serverId: Schema.NonEmptyString,\n implementation: McpSchema.Implementation,\n}) {}\n\n/**\n * Requested hard limits for an adapter-owned MCP connection and discovery response.\n *\n * `expectedToolkitSchemaDigest` pins the tool contract an Agent was authored\n * against: when a connector derives its Toolkit from live discovery, a server\n * that adds, removes, or reshapes a tool fails closed instead of silently\n * changing what the model can call.\n */\nexport class McpConnectionRequest extends Schema.Class<McpConnectionRequest>(\n \"@effect-agent/capabilities/McpConnectionRequest\",\n)({\n serverId: Schema.NonEmptyString,\n maxToolCount: PositiveInt.check(Schema.isLessThanOrEqualTo(MAX_MCP_TOOLS)),\n maxToolDescriptionBytes: PositiveInt,\n maxDiscoveryBytes: PositiveInt.check(Schema.isLessThanOrEqualTo(MAX_MCP_DISCOVERY_BYTES)),\n connectTimeoutMillis: PositiveInt,\n expectedToolkitSchemaDigest: Schema.optionalKey(Sha256Digest),\n}) {}\n\n/**\n * Tool annotation recording the `outputSchema` an MCP server advertised for a\n * Tool the framework client derived from discovery, or `None` when the server\n * advertised none. Such a Tool's Effect success Schema is the client's result\n * envelope rather than the wire contract, so discovery validation compares\n * this annotation instead. Tools without the annotation, including dynamic\n * Tools from other connectors, keep deriving it from their success Schema.\n */\nexport class McpToolOutputSchema extends Context.Service<\n McpToolOutputSchema,\n Option.Option<McpSchema.ToolOutputJson>\n>()(\"@effect-agent/capabilities/McpToolOutputSchema\") {}\n\n/** Typed remote connection failure; no remote execution is claimed exactly-once. */\nexport class McpConnectionError extends Schema.TaggedError<McpConnectionError>()(\n \"McpConnectionError\",\n {\n serverId: Schema.NonEmptyString,\n message: Schema.String,\n cause: Schema.optionalKey(Schema.Defect()),\n },\n) {}\n\n/** Discovery exceeded an explicit caller or framework hard bound. */\nexport class McpDiscoveryLimitExceeded extends Schema.TaggedError<McpDiscoveryLimitExceeded>()(\n \"McpDiscoveryLimitExceeded\",\n {\n serverId: Schema.NonEmptyString,\n limit: Schema.Literals([\"tool-count\", \"tool-description-bytes\", \"discovery-bytes\"]),\n limitValue: Schema.Natural,\n observedValue: Schema.Natural,\n },\n) {}\n\n/** Native dynamic Toolkit names did not match the bounded MCP discovery response. */\nexport class McpToolkitMismatch extends Schema.TaggedError<McpToolkitMismatch>()(\n \"McpToolkitMismatch\",\n {\n serverId: Schema.NonEmptyString,\n message: Schema.String,\n cause: Schema.optionalKey(Schema.Defect()),\n },\n) {}\n\n/** Validated discovery metadata; native Effect AI MCP values retain provider detail. */\nexport class McpDiscovery extends Schema.Class<McpDiscovery>(\n \"@effect-agent/capabilities/McpDiscovery\",\n)({\n identity: McpServerIdentity,\n capabilities: McpSchema.ServerCapabilities,\n tools: Schema.Array(McpSchema.Tool).check(Schema.isMaxLength(MAX_MCP_TOOLS)),\n encodedBytes: Schema.Natural.check(Schema.isLessThanOrEqualTo(MAX_MCP_DISCOVERY_BYTES)),\n toolkitSchemaDigest: Sha256Digest,\n}) {}\n\n/**\n * Raw adapter result before the framework validates count and byte limits.\n * A connector that executes tools remotely supplies `handlers`; a connector\n * serving an application-authored Toolkit leaves them to the application.\n */\nexport interface McpConnectedServer {\n readonly identity: McpServerIdentity;\n readonly capabilities: McpSchema.ServerCapabilities;\n readonly tools: ReadonlyArray<McpSchema.Tool>;\n readonly toolkit: Toolkit.Any;\n readonly handlers?: Layer.Layer<Tool.Handler<string>> | undefined;\n}\n\n/** Scoped validated MCP connection with native Effect AI dynamic Toolkit values. */\nexport interface McpConnection {\n readonly discovery: McpDiscovery;\n readonly toolkit: Toolkit.Any;\n /** Handler Layer for `toolkit` when the connector executes tools remotely. */\n readonly handlers?: Layer.Layer<Tool.Handler<string>> | undefined;\n}\n\n/** Adapter port for native Effect AI MCP protocol/schema integration. */\nexport class McpConnector extends Context.Service<\n McpConnector,\n {\n readonly connect: (\n request: McpConnectionRequest,\n ) => Effect.Effect<McpConnectedServer, McpConnectionError, Scope.Scope>;\n }\n>()(\"@effect-agent/capabilities/McpConnector\") {}\n\n/**\n * `Tool.getJsonSchema`/`Tool.getJsonSchemaFromSchema` hoist a named, refined\n * type into `$defs` with a top-level `$ref`. MCP inputs require an object root,\n * and connectors may advertise named object outputs in that flattened form too.\n * Inline a single top-level `$ref` in locally derived schemas so those contracts\n * compare consistently with discovery. Explicit output annotations retain the\n * advertised schema unchanged, including non-object roots.\n */\nconst flattenTopLevelRef = (schema: JsonSchema.JsonSchema): JsonSchema.JsonSchema => {\n const ref = schema[\"$ref\"];\n const defs = schema[\"$defs\"] as JsonSchema.Definitions | undefined;\n\n if (typeof ref !== \"string\" || defs === undefined) return schema;\n\n const key = ref.startsWith(\"#/$defs/\")\n ? JsonPointer.unescapeToken(ref.slice(\"#/$defs/\".length))\n : undefined;\n\n return key !== undefined && Object.hasOwn(defs, key) ? defs[key] : schema;\n};\n\nconst canonicalJson = (value: Schema.Json): Schema.Json => {\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\" ||\n typeof value === \"number\"\n ) {\n return value;\n }\n if (Array.isArray<Schema.Json>(value)) return value.map(canonicalJson);\n const output: Record<string, Schema.Json> = {};\n\n // Keys sort by UTF-16 code units (RFC 8785 style): locale-aware collation varies\n // across hosts and treats canonically equivalent distinct key sequences as equal.\n for (const [key, item] of Object.entries(value).sort(([left], [right]) =>\n left < right ? -1 : left > right ? 1 : 0,\n )) {\n output[key] = canonicalJson(item);\n }\n\n return output;\n};\n\nconst utf8 = (value: string): Uint8Array => {\n const hex = Encoding.encodeHex(value);\n const bytes = new Uint8Array(hex.length / 2);\n\n for (let index = 0; index < bytes.length; index += 1) {\n bytes[index] = Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16);\n }\n\n return bytes;\n};\n\n/**\n * The `outputSchema` a Toolkit member claims. A Tool annotated with\n * `McpToolOutputSchema` reports exactly what discovery advertised, present or\n * absent; every other Tool derives it from its success Schema.\n */\nconst toolkitOutputSchema = (tool: Tool.Any): JsonSchema.JsonSchema | undefined => {\n const discovered = Context.getOption(tool.annotations, McpToolOutputSchema);\n\n if (Option.isSome(discovered)) return Option.getOrUndefined(discovered.value);\n const derived = flattenTopLevelRef(Tool.getJsonSchemaFromSchema(tool.successSchema));\n\n return derived.type === \"object\" ? derived : undefined;\n};\n\nconst digestJson = Effect.fn(\"digestMcpSchema\")(function* (serverId: string, value: unknown) {\n const json = yield* Schema.decodeUnknownEffect(Schema.Json)(value).pipe(\n Effect.mapError((error) =>\n McpToolkitMismatch.make({\n cause: error,\n serverId,\n message: `MCP Tool schema is not canonical JSON: ${error.message}`,\n }),\n ),\n );\n\n const encoded = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Json))(\n canonicalJson(json),\n ).pipe(\n Effect.mapError((error) =>\n McpToolkitMismatch.make({\n cause: error,\n serverId,\n message: `Could not encode canonical MCP Tool schema JSON: ${error.message}`,\n }),\n ),\n );\n\n const crypto = yield* Crypto.Crypto;\n\n const digest = yield* crypto.digest(\"SHA-256\", utf8(encoded)).pipe(\n Effect.mapError((cause) =>\n McpToolkitMismatch.make({\n cause,\n serverId,\n message: \"Could not hash MCP Tool schemas\",\n }),\n ),\n );\n\n return `sha256:${Encoding.encodeHex(digest)}`;\n});\n\n/** Validate native discovery data before it enters Agent Tool context. */\nexport const validateMcpDiscovery = Effect.fn(\"validateMcpDiscovery\")(function* (\n request: McpConnectionRequest,\n server: McpConnectedServer,\n) {\n if (server.identity.serverId !== request.serverId) {\n return yield* McpToolkitMismatch.make({\n serverId: request.serverId,\n message: `Connected server identity '${server.identity.serverId}' does not match the requested server`,\n });\n }\n if (server.tools.length > request.maxToolCount) {\n return yield* McpDiscoveryLimitExceeded.make({\n serverId: request.serverId,\n limit: \"tool-count\",\n limitValue: request.maxToolCount,\n observedValue: server.tools.length,\n });\n }\n for (const tool of server.tools) {\n const descriptionBytes = utf8ByteLength(tool.description ?? \"\");\n\n if (descriptionBytes > request.maxToolDescriptionBytes) {\n return yield* McpDiscoveryLimitExceeded.make({\n serverId: request.serverId,\n limit: \"tool-description-bytes\",\n limitValue: request.maxToolDescriptionBytes,\n observedValue: descriptionBytes,\n });\n }\n }\n const discoveredNames = server.tools.map((tool) => tool.name).sort();\n const toolkitNames = Object.keys(server.toolkit.tools).sort();\n\n if (\n discoveredNames.length !== toolkitNames.length ||\n discoveredNames.some((name, index) => name !== toolkitNames[index])\n ) {\n return yield* McpToolkitMismatch.make({\n serverId: request.serverId,\n message: \"Native Effect AI Toolkit names do not match MCP tool discovery\",\n });\n }\n\n const discoverySchemas = server.tools\n .map((tool) => ({\n name: tool.name,\n inputSchema: tool.inputSchema,\n ...(tool.outputSchema !== undefined ? { outputSchema: tool.outputSchema } : {}),\n }))\n .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));\n\n const toolkitSchemas = yield* Effect.try({\n try: () =>\n Object.values(server.toolkit.tools)\n .map((tool) => {\n const outputSchema = toolkitOutputSchema(tool);\n\n return {\n name: tool.name,\n inputSchema: flattenTopLevelRef(Tool.getJsonSchema(tool)),\n ...(outputSchema === undefined ? {} : { outputSchema }),\n };\n })\n .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0)),\n catch: (cause) =>\n McpToolkitMismatch.make({\n cause,\n serverId: request.serverId,\n message: \"Could not derive JSON Schema from the native Effect AI Toolkit\",\n }),\n });\n\n const discoveryDigest = yield* digestJson(request.serverId, discoverySchemas);\n const toolkitDigest = yield* digestJson(request.serverId, toolkitSchemas);\n\n if (discoveryDigest !== toolkitDigest) {\n return yield* McpToolkitMismatch.make({\n serverId: request.serverId,\n message: \"Native Effect AI Toolkit schemas do not match MCP tool discovery\",\n });\n }\n if (\n request.expectedToolkitSchemaDigest !== undefined &&\n request.expectedToolkitSchemaDigest !== toolkitDigest\n ) {\n return yield* McpToolkitMismatch.make({\n serverId: request.serverId,\n message: `MCP tool discovery digest ${toolkitDigest} does not match the expected ${request.expectedToolkitSchemaDigest}`,\n });\n }\n\n const encoded = yield* Schema.encodeEffect(\n Schema.Struct({\n identity: McpServerIdentity,\n capabilities: McpSchema.ServerCapabilities,\n tools: Schema.Array(McpSchema.Tool),\n }),\n )({\n identity: server.identity,\n capabilities: server.capabilities,\n tools: server.tools,\n }).pipe(\n Effect.mapError((error) =>\n McpConnectionError.make({\n cause: error,\n serverId: request.serverId,\n message: `Could not encode MCP discovery response: ${error.message}`,\n }),\n ),\n );\n\n const discoveryJson = yield* Schema.decodeEffect(Schema.Json)(encoded).pipe(\n Effect.mapError((error) =>\n McpConnectionError.make({\n cause: error,\n serverId: request.serverId,\n message: `Could not normalize MCP discovery response as JSON: ${error.message}`,\n }),\n ),\n );\n\n const discoveryText = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Json))(\n discoveryJson,\n ).pipe(\n Effect.mapError((error) =>\n McpConnectionError.make({\n cause: error,\n serverId: request.serverId,\n message: `Could not serialize MCP discovery response: ${error.message}`,\n }),\n ),\n );\n\n const discoveryBytes = utf8ByteLength(discoveryText);\n\n if (discoveryBytes > request.maxDiscoveryBytes) {\n return yield* McpDiscoveryLimitExceeded.make({\n serverId: request.serverId,\n limit: \"discovery-bytes\",\n limitValue: request.maxDiscoveryBytes,\n observedValue: discoveryBytes,\n });\n }\n\n return McpDiscovery.make({\n identity: server.identity,\n capabilities: server.capabilities,\n tools: server.tools,\n encodedBytes: discoveryBytes,\n toolkitSchemaDigest: toolkitDigest,\n });\n});\n\n/**\n * Acquire a native connection in Scope, enforce a Clock-controlled timeout,\n * then validate discovery before exposing its Toolkit.\n */\nexport const connectMcp = Effect.fn(\"connectMcp\")(function* (request: McpConnectionRequest) {\n const connector = yield* McpConnector;\n\n const server = yield* connector.connect(request).pipe(\n Effect.timeoutOrElse({\n duration: Duration.millis(request.connectTimeoutMillis),\n orElse: () =>\n Effect.fail(\n McpConnectionError.make({\n serverId: request.serverId,\n message: \"MCP connection timed out\",\n }),\n ),\n }),\n );\n\n const discovery = yield* validateMcpDiscovery(request, server);\n\n return {\n discovery,\n toolkit: server.toolkit,\n ...(server.handlers === undefined ? {} : { handlers: server.handlers }),\n } satisfies McpConnection;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,gBAAgB;AACtB,MAAM,0BAA0B;AAChC,MAAM,cAAc,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,eAAe,OAAO,OAAO,MAAM,OAAO,UAAU,uBAAuB,CAAC;;AAGlF,IAAa,oBAAb,cAAuC,OAAO,MAC5C,8CACF,CAAC,CAAC;CACA,UAAU,OAAO;CACjB,gBAAgB,UAAU;AAC5B,CAAC,CAAC,CAAC,CAAC;;;;;;;;;AAUJ,IAAa,uBAAb,cAA0C,OAAO,MAC/C,iDACF,CAAC,CAAC;CACA,UAAU,OAAO;CACjB,cAAc,YAAY,MAAM,OAAO,oBAAoB,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F,MAAM,SAAS,QAAO,OAFG,aAAA,CAEO,QAAQ,OAAO,CAAC,CAAC,KAC/C,OAAO,cAAc;EACnB,UAAU,SAAS,OAAO,QAAQ,oBAAoB;EACtD,cACE,OAAO,KACL,mBAAmB,KAAK;GACtB,UAAU,QAAQ;GAClB,SAAS;EACX,CAAC,CACH;CACJ,CAAC,CACH;CAIA,OAAO;EACL,WAAA,OAHuB,qBAAqB,SAAS,MAAM;EAI3D,SAAS,OAAO;EAChB,GAAI,OAAO,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,OAAO,SAAS;CACvE;AACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as Digest } from "../Records-
|
|
1
|
+
import { _ as Digest } from "../Records-BtxMy8xD.mjs";
|
|
2
2
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
3
|
declare namespace ActivityStore_d_exports {
|
|
4
4
|
export { ActivityBusy, ActivityClaim, ActivityClaimRequest, ActivityMutationFailpoint, ActivityMutationFailure, ActivityMutationPoint, ActivityOwnershipLost, ActivityProcessorKey, ActivityProcessorStore, ActivityProgress, ActivityStoreError, ActivityStoreFailure, ActivityWorkConflict, PreparedActivity };
|
package/dist/durable/Admin.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $r as
|
|
1
|
+
import { $r as RecoveryDisposition, Br as ExplainedEvidence, Gr as IntegrityCheckStatus, Hr as ExplainedUnknownCall, Jr as ObligationEntry, Kr as IntegrityReport, Qr as RECOVERY_DECISION_MEANINGS, Ur as IntegrityCheck, Vr as ExplainedSubmission, Wr as IntegrityCheckName, Xr as ObligationSeverity, Yr as ObligationReport, Zr as ObligationThresholds, ai as predictRecoveryDisposition, ei as RecoveryExplanation, ii as obligationSeverityOf, ni as RetryRefusalReason, oi as recoveryDecisionMeaning, qr as ObligationBlockedOn, ri as RetryRefused, si as renderRecoveryExplanation, ti as RetryCommand } from "../Records-BtxMy8xD.mjs";
|
|
2
2
|
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 };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _i as compileBindingContracts, di as BindingUnavailable, fi as DurableBindingFailure, gi as ResolvedBinding, hi as ReplayVersions, li as AgentAttemptContext, mi as ExecutableAgentBinding, pi as DurableWorkerBinding, ui as AgentRegistration, vi as compileRegistrations, yi as definitionDigestsEqual } from "../Records-BtxMy8xD.mjs";
|
|
2
2
|
export { type AgentAttemptContext, type AgentRegistration, BindingUnavailable, type DurableBindingFailure, DurableWorkerBinding, type ExecutableAgentBinding, type ReplayVersions, type ResolvedBinding, compileBindingContracts, compileRegistrations, definitionDigestsEqual };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bo as SubmissionLedger, yn as ThreadStore } from "../Records-BtxMy8xD.mjs";
|
|
2
2
|
import { Crypto, Effect, Schema } from "effect";
|
|
3
3
|
//#region src/durable/Certification.d.ts
|
|
4
4
|
declare const CertifiedAdapterIdentity_base: Schema.Class<CertifiedAdapterIdentity, Schema.Struct<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as PersistedJson,
|
|
1
|
+
import { O as PersistedJson, bi as DigestError, cn as ThreadNotMaterialized, l as CanonicalRecordEnvelope, xn as ThreadStoreError, yn as ThreadStore } from "../Records-BtxMy8xD.mjs";
|
|
2
2
|
import { ActivityProcessorKey, ActivityProcessorStore, ActivityStoreFailure, PreparedActivity } from "./ActivityStore.mjs";
|
|
3
3
|
import { Crypto, Effect, Schema, Scope } from "effect";
|
|
4
4
|
declare namespace CommittedActivity_d_exports {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ci as digestCanonicalBatch, Ei as digestJson, Si as EMPTY_TAIL_DIGEST, Ti as digestDefinitions, bi as DigestError, wi as digestDefinition } from "../Records-BtxMy8xD.mjs";
|
|
2
2
|
export { DigestError, EMPTY_TAIL_DIGEST, digestCanonicalBatch, digestDefinition, digestDefinitions, digestJson };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as Receipt } from "../Receipt-BAHyigAF.mjs";
|
|
2
|
-
import { At as DurableSubmitAgent, Bt as
|
|
3
|
-
export { DurableAbortFailure, DurableAgentRuntime, DurableApprovalFailure, DurableApprovalResolver, DurableAwaitFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableProgressFailure, DurableResolveFailure, DurableRetryFailure, DurableRuntimeConfig, DurableRuntimeConfigOptions, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, DurableWorkerRequirements, Receipt, RecoveryReport, childReservationIdFor, recoveryRepairBatchId, recoveryRepairRecordId, threadCreatedBatchId, threadCreatedRecordId };
|
|
2
|
+
import { At as DurableSubmitAgent, Bt as RecoverySweepResult, Ct as DurableObligationFailure, Dt as DurableRetryFailure, Et as DurableResolveFailure, Ft as DurableWorkerRequirements, Gt as threadCreatedBatchId, Ht as isolateRecovery, It as RecoveryBlocked, Kt as threadCreatedRecordId, Lt as RecoveryFailure, Mt as DurableSubmitOptions, Nt as DurableVerifyFailure, Ot as DurableRuntimeConfig, Pt as DurableWorkerFailure, Rt as RecoveryReport, St as DurableExplainFailure, Tt as DurableProgressFailure, Ut as recoveryRepairBatchId, Vt as childReservationIdFor, Wt as recoveryRepairRecordId, _t as DurableAgentRuntime, bt as DurableApprovalResolver, gt as DurableAbortFailure, jt as DurableSubmitFailure, kt as DurableRuntimeConfigOptions, wt as DurableObserveOptions, xt as DurableAwaitFailure, yt as DurableApprovalFailure, zt as RecoverySweepOptions } from "../Records-BtxMy8xD.mjs";
|
|
3
|
+
export { DurableAbortFailure, DurableAgentRuntime, DurableApprovalFailure, DurableApprovalResolver, DurableAwaitFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableProgressFailure, DurableResolveFailure, DurableRetryFailure, DurableRuntimeConfig, DurableRuntimeConfigOptions, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, DurableWorkerRequirements, Receipt, RecoveryBlocked, RecoveryFailure, RecoveryReport, RecoverySweepOptions, RecoverySweepResult, childReservationIdFor, isolateRecovery, recoveryRepairBatchId, recoveryRepairRecordId, threadCreatedBatchId, threadCreatedRecordId };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Receipt } from "../core/Receipt.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
export { DurableAgentRuntime, DurableApprovalResolver, DurableRuntimeConfig, Receipt, RecoveryReport, childReservationIdFor, recoveryRepairBatchId, recoveryRepairRecordId, threadCreatedBatchId, threadCreatedRecordId };
|
|
2
|
+
import { a as RecoveryBlocked, c as RecoverySweepResult, d as recoveryRepairBatchId, f as recoveryRepairRecordId, i as DurableRuntimeConfig, l as childReservationIdFor, m as threadCreatedRecordId, o as RecoveryFailure, p as threadCreatedBatchId, r as DurableApprovalResolver, s as RecoveryReport, t as DurableAgentRuntime, u as isolateRecovery } from "../DurableAgentRuntime-BIrgxwRl.mjs";
|
|
3
|
+
export { DurableAgentRuntime, DurableApprovalResolver, DurableRuntimeConfig, Receipt, RecoveryBlocked, RecoveryFailure, RecoveryReport, RecoverySweepResult, childReservationIdFor, isolateRecovery, recoveryRepairBatchId, recoveryRepairRecordId, threadCreatedBatchId, threadCreatedRecordId };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as makeEventSource, i as NormalizedEvent, r as EventSources, t as EventSource } from "../EventSource-
|
|
1
|
+
import { a as makeEventSource, i as NormalizedEvent, r as EventSources, t as EventSource } from "../EventSource-ARs56eBq.mjs";
|
|
2
2
|
export { EventSource, EventSources, NormalizedEvent, makeEventSource };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as Principal } from "../Receipt-BAHyigAF.mjs";
|
|
2
|
-
import "../Records-
|
|
3
|
-
import { E as SubscriptionSourceError } from "../Subscription-
|
|
4
|
-
import { t as EventSource } from "../EventSource-
|
|
2
|
+
import "../Records-BtxMy8xD.mjs";
|
|
3
|
+
import { E as SubscriptionSourceError } from "../Subscription-B9VszlF9.mjs";
|
|
4
|
+
import { t as EventSource } from "../EventSource-ARs56eBq.mjs";
|
|
5
5
|
import { SubscriptionFailure, SubscriptionIntake } from "./Subscriptions.mjs";
|
|
6
6
|
import { Context, Effect, Layer, Redacted, Schema } from "effect";
|
|
7
7
|
import { HttpClient } from "effect/unstable/http";
|
|
@@ -4,9 +4,9 @@ import { a as Receipt, t as IdempotencyKey } from "../Receipt-BAHyigAF.mjs";
|
|
|
4
4
|
import { r as Update } from "../AgentUpdates-DMJ-_xow.mjs";
|
|
5
5
|
import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "../FailureDiagnostic-CaAkzGHL.mjs";
|
|
6
6
|
import { t as AgentPolicy } from "../AgentPolicy-BqDoSXO6.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { a as PreparedInput } from "../Subscription-
|
|
9
|
-
import { t as PreparedInputAdmission } from "../PreparedInputAdmission-
|
|
7
|
+
import { h as DefinitionDigests, mo as Settlement } from "../Records-BtxMy8xD.mjs";
|
|
8
|
+
import { a as PreparedInput } from "../Subscription-B9VszlF9.mjs";
|
|
9
|
+
import { t as PreparedInputAdmission } from "../PreparedInputAdmission-_WYg-D0f.mjs";
|
|
10
10
|
import { Context, Crypto, Effect, Layer, Result, Schema } from "effect";
|
|
11
11
|
declare namespace MessageDelivery_d_exports {
|
|
12
12
|
export { MessageDeliveryChange, MessageDeliveryDriver, MessageDeliveryDriverLimits, MessageDeliveryError, MessageDeliveryFailpoint, MessageDeliveryFailpointError, MessageDeliveryFailure, MessageDeliveryKey, MessageDeliveryPage, MessageDeliveryPageRequest, MessageDeliveryPolicy, MessageDeliveryRecord, MessageDeliveryStore, MessageDeliveryStoreLimits, applyMessageDeliveryChange, defaultMessageDeliveryPolicy, defaultMessageDeliveryStoreLimits, isWorkerUpdateDelivery, messageDeliveryCapacity, messageDeliveryDeadline, messageDeliveryKeyString, messageDeliveryUsesCapacity, prepareMessageDelivery, readPending, sameMessageDeliveryIdentity, validateMessageDelivery };
|