import { Cause, Context, Effect, Layer, Schema } from "effect"; import { type Prompt, type Response, type Tool } from "effect/unstable/ai"; import { AgentSuspended, type ApprovalRequest } from "../agent/agent-event.js"; import { type RuleStoreInterface } from "../policy/permissions.js"; type Approvals = import("../policy/approvals.js").Interface; type Permissions = import("../policy/permissions.js").Interface; /** @experimental The common identity and context of one authorization attempt. */ export interface AccessRequest { readonly call: Response.ToolCallPart; readonly agentName: string; readonly turn: number; readonly sessionId?: string; } declare const PermissionDenied_base: Schema.Class, Cause.YieldableError>; /** @experimental A final authorization denial. */ export declare class PermissionDenied extends PermissionDenied_base { } declare const AuthorizationError_base: Schema.Class; }>, Cause.YieldableError>; /** @experimental Failure while producing a final authorization decision. */ export declare class AuthorizationError extends AuthorizationError_base { } /** @experimental The tool may execute. */ export interface Execute { readonly _tag: "Execute"; } /** @experimental The tool must not execute. */ export interface Deny { readonly _tag: "Deny"; readonly error: PermissionDenied; } /** @experimental The run must suspend before the tool can execute. */ export interface Suspend { readonly _tag: "Suspend"; readonly suspension: AgentSuspended; } /** @experimental The one final decision for a tool execution attempt. */ export type ToolAuthorization = Execute | Deny | Suspend; /** @experimental Input to the final tool authorization boundary. */ export interface Request extends AccessRequest { readonly tool: Tool.Any | undefined; readonly active: boolean; readonly activeTools: ReadonlyArray; readonly activatedSkills: ReadonlyArray; readonly messages: ReadonlyArray; readonly onApprovalRequired: (request: ApprovalRequest) => Effect.Effect; } /** @experimental Final tool authorization boundary. */ export interface ToolAuthorizer { readonly authorize: (request: Request) => Effect.Effect; } declare const ToolAuthorizerService_base: Context.ServiceClass>; /** @experimental Optional exact tool authorizer service for run-layer composition. */ export declare class ToolAuthorizerService extends ToolAuthorizerService_base { } /** @experimental Required services used by the linear authorization pass. */ export interface Options { readonly permissions: Permissions; readonly approvals: Approvals; readonly ruleStore: RuleStoreInterface; } /** @experimental Build the authorizer from its three required policy seams. */ export declare const make: (options: Options) => ToolAuthorizer; /** @experimental Provide an exact authorizer for tests or run-layer composition. */ export declare const layerTest: (authorizer: ToolAuthorizer) => Layer.Layer; export {};