import { Cause, Context, Effect, Layer, Schema } from "effect"; import { ToolContext } from "./tool-context.js"; import type { Outcome } from "./tool-executor.js"; /** @experimental Replay policy for one nested durable operation. */ export declare const NestedReplayPolicy: Schema.Literals; /** @experimental */ export type NestedReplayPolicy = typeof NestedReplayPolicy.Type; /** @experimental Derived identity of one nested operation beneath a composite tool call. */ export declare const Identity: Schema.Struct<{ readonly operationKey: Schema.String; readonly ordinal: Schema.Int; readonly kind: Schema.String; readonly payloadDigest: Schema.String; }>; /** @experimental */ export type Identity = typeof Identity.Type; /** @experimental Authorization the host must settle before the handler crosses its boundary. */ export declare const ApprovalRequirement: Schema.Struct<{ readonly capability: Schema.String; readonly request: Schema.optionalKey; }>; /** @experimental */ export type ApprovalRequirement = typeof ApprovalRequirement.Type; /** @experimental One nested operation a composite tool asks the host to journal. */ /** * @experimental A host-derived projection of a nested operation's own outcome. * * The value is produced by the handler's `render` function from the operation's real result, never * read from the request payload, so a cell that plants `render` in its input cannot dictate what * the host displays. */ export declare const Render: Schema.Union; readonly path: Schema.String; readonly mimeType: Schema.String; readonly byteSize: Schema.Int; readonly width: Schema.optionalKey; readonly height: Schema.optionalKey; }>, Schema.Struct<{ readonly _tag: Schema.tag<"Diff">; readonly path: Schema.String; readonly patch: Schema.String; }>]>; /** @experimental */ export type Render = typeof Render.Type; /** @experimental A projection larger than this is withheld whole rather than truncated. */ export declare const maxRenderBytes: number; /** @experimental Lifecycle of one nested operation as the host observes it. */ export declare const ProgressStatus: Schema.Literals; /** @experimental */ export type ProgressStatus = typeof ProgressStatus.Type; /** @experimental The `ToolContext.Progress` data key nested-operation progress travels under. */ export declare const progressKey = "nestedOperation"; /** @experimental One nested-operation progress record a host projects. */ export declare const Progress: Schema.Struct<{ readonly kind: Schema.String; readonly ordinal: Schema.Int; readonly status: Schema.Literals; readonly render: Schema.optionalKey; readonly path: Schema.String; readonly mimeType: Schema.String; readonly byteSize: Schema.Int; readonly width: Schema.optionalKey; readonly height: Schema.optionalKey; }>, Schema.Struct<{ readonly _tag: Schema.tag<"Diff">; readonly path: Schema.String; readonly patch: Schema.String; }>]>>; readonly renderWithheldBytes: Schema.optionalKey; }>; /** @experimental */ export type Progress = typeof Progress.Type; /** * @experimental Encodes one progress record under `progressKey`. * * An oversized projection is withheld whole and reported as `renderWithheldBytes`: a partial diff * or a truncated artifact descriptor would render as a smaller correct change rather than as a * missing one, so the operation still succeeds while the projection is dropped. */ export declare const progressData: (input: { readonly kind: string; readonly ordinal: number; readonly status: ProgressStatus; readonly render?: Render | undefined; }) => Effect.Effect>; export interface Request { readonly kind: string; readonly payload: unknown; readonly replayPolicy: NestedReplayPolicy; readonly approval?: ApprovalRequirement; readonly render?: (value: A) => Render; } declare const NestedOperationDivergence_base: Schema.Class, Cause.YieldableError>; /** @experimental The same nested identity was reused with different content. */ export declare class NestedOperationDivergence extends NestedOperationDivergence_base { } declare const NestedOperationUnknown_base: Schema.Class, Cause.YieldableError>; /** @experimental A non-idempotent nested operation crossed its boundary with an unobserved outcome. */ export declare class NestedOperationUnknown extends NestedOperationUnknown_base { } declare const NestedOperationDenied_base: Schema.Class, Cause.YieldableError>; /** @experimental The host denied the nested operation's approval request. */ export declare class NestedOperationDenied extends NestedOperationDenied_base { } declare const NestedOperationSuspended_base: Schema.Class, Cause.YieldableError>; /** @experimental The run must suspend until the host resolves the nested operation's approval. */ export declare class NestedOperationSuspended extends NestedOperationSuspended_base { } /** @experimental */ export type Failure = NestedOperationDivergence | NestedOperationUnknown | NestedOperationDenied | NestedOperationSuspended; /** * @experimental Host seam executing one nested durable operation for a composite tool call. * * Identity is derived, never supplied: the ambient `ToolContext` names the outer operation and the * host assigns the ordinal, so cell or tool code cannot forge, reorder, or collide with another * call's journal. */ export interface Interface { readonly run: (request: Request, effect: Effect.Effect) => Effect.Effect; } declare const NestedOperations_base: Context.ServiceClass; /** @experimental */ export declare class NestedOperations extends NestedOperations_base { } /** @experimental Canonical payload digest shared by every nested-operation implementation. */ export declare const payloadDigest: { (payload: unknown): (kind: string) => string; (kind: string, payload: unknown): string; }; /** @experimental Derived operation id for one nested operation. */ export declare const operationId: (input: { readonly operationKey: string; readonly ordinal: number; }) => string; /** @experimental Run one nested durable operation through the ambient host seam. */ export declare const run: { (effect: Effect.Effect): (request: Request) => Effect.Effect; (request: Request, effect: Effect.Effect): Effect.Effect; }; /** @experimental Translate a nested-operation approval suspension into the tool executor's Suspend outcome. */ export declare const catchSuspension: (effect: Effect.Effect) => Effect.Effect, R>; /** * @experimental Process-local nested operations for hosts without durable storage. * * Identity, duplicate return, and divergence hold for the life of the run; approvals auto-approve * because a process-local host owns no resolution seam. */ export declare const layerDirect: Layer.Layer; /** @experimental */ export declare const layerTest: (implementation: Interface) => Layer.Layer; export {};