import { z } from "zod"; import { DurablePlan, InteractionAnswerSpec, InteractionExecutionBinding, PermissionGrant, StreamEvent } from "@tangle-network/agent-interface"; //#region src/interactions/broker.d.ts declare const DEFAULT_INTERACTION_DECISION_TIMEOUT_MS = 300000; declare const MAX_INTERACTION_DECISION_TIMEOUT_MS = 2147483647; interface InteractionBrokerOptions { /** Default wait for an operator response before the declared default applies. */ decisionTimeoutMs?: number; } declare const InteractionQuestionSchema: z.ZodObject<{ question: z.ZodString; options: z.ZodOptional; }, z.core.$strip>>>; multiSelect: z.ZodOptional; }, z.core.$strip>; type InteractionQuestion = z.infer; /** Fail-closed coercion: anything other than a known allow grant denies. */ declare function coercePermissionGrant(value: unknown): PermissionGrant; /** Convert canonical question fields (`q0`, `q1`) to positional answers. */ declare function interactionDataToQuestionAnswers(data: Record): string[][]; /** Build one canonical answer field for each question. */ declare function interactionAnswerSpecForQuestions(questions: InteractionQuestion[]): InteractionAnswerSpec; type InteractionEventSink = (event: StreamEvent) => unknown; /** * One interaction round-trip for every runner adapter. * * A runner emits a request and waits here. The UI returns a canonical response. * The first response, timeout, or session teardown settles the request. */ declare class InteractionBroker { private readonly pendingPermissions; private readonly pendingQuestions; private readonly decisionTimeoutMs; constructor(options?: InteractionBrokerOptions); private hasPendingInteraction; /** Emit a permission request and wait for its decision. */ request(opts: { id: string; sessionId: string; binding: InteractionExecutionBinding; toolName: string; input?: unknown; allowlistGrant: PermissionGrant; timeoutMs?: number; signal?: AbortSignal; emit?: InteractionEventSink; }): Promise; /** Resolve a pending permission. Invalid or excessive grants deny. */ respond(response: unknown): boolean; /** Emit a question and wait for positional answers. */ requestQuestion(opts: { id: string; sessionId: string; binding: InteractionExecutionBinding; questions: InteractionQuestion[]; timeoutMs?: number; signal?: AbortSignal; emit?: InteractionEventSink; }): Promise; /** Resolve a pending question. Invalid, declined, and cancelled replies return null. */ respondQuestion(response: unknown): boolean; /** Fail closed every request that belongs to one session. */ failSession(sessionId: string): void; /** Fail closed only the requests from one exact provider execution. */ failExecution(binding: InteractionExecutionBinding): void; } //#endregion //#region src/interactions/tools.d.ts /** Claude Code permission prompt callback. */ type PermissionPromptBridge = (request: { tool_name: string; input: Record; tool_use_id: string; operationId: string; signal?: AbortSignal; }) => Promise; /** Question callback. Null means that no answer was provided. */ type AskUserBridge = (request: { questions: InteractionQuestion[]; operationId?: string; signal?: AbortSignal; }) => Promise; /** Generic action approval callback. */ type RequestPermissionBridge = (request: { tool_name: string; input: Record; operationId?: string; signal?: AbortSignal; }) => Promise<{ allowed: boolean; message?: string; }>; /** Durable plan submission callback. */ type RequestPlanBridge = (request: { plan: string; sourceToolCallId: string; }) => Promise; interface BrokerInteractionTools { askUser: AskUserBridge; requestPermission: RequestPermissionBridge; onStop: () => void; } /** Bind generic interaction tools to one broker session. */ declare function brokerInteractionTools(broker: InteractionBroker, options: { sessionId: string; binding: InteractionExecutionBinding; timeoutMs?: number; emit?: (event: StreamEvent) => unknown; }): BrokerInteractionTools; //#endregion export { RequestPlanBridge as a, InteractionBroker as c, InteractionQuestionSchema as d, MAX_INTERACTION_DECISION_TIMEOUT_MS as f, interactionDataToQuestionAnswers as h, RequestPermissionBridge as i, InteractionBrokerOptions as l, interactionAnswerSpecForQuestions as m, BrokerInteractionTools as n, brokerInteractionTools as o, coercePermissionGrant as p, PermissionPromptBridge as r, DEFAULT_INTERACTION_DECISION_TIMEOUT_MS as s, AskUserBridge as t, InteractionQuestion as u }; //# sourceMappingURL=tools-DeZkIW3h.d.ts.map