/** * PostToolUse hook event. * * Fires after a tool call completes successfully. A handler can block the * tool result (feeding feedback back to Claude), inject additional context, * or replace the tool's response (for MCP tools). Supports a regex matcher * on `tool_name`. See https://code.claude.com/docs/en/hooks#posttooluse. * * @since 0.1.0 */ import * as Effect from 'effect/Effect'; import * as Schema from 'effect/Schema'; import { HookToolDecodeError } from '../../Errors.js'; import type { HookContext } from '../Context.js'; import type { HookDefinition } from '../Runner.js'; import * as Tool from '../Tool.js'; declare const Input_base: Schema.Class; readonly tool_name: Schema.String; readonly tool_input: Schema.$Record; readonly tool_response: Schema.$Record; readonly tool_use_id: Schema.optional; readonly duration_ms: Schema.optional; readonly session_id: Schema.String; readonly transcript_path: Schema.String; readonly cwd: Schema.String; readonly permission_mode: Schema.optionalKey; readonly effort: Schema.optionalKey; readonly agent_id: Schema.optionalKey; readonly agent_type: Schema.optionalKey; }>, {}>; export declare class Input extends Input_base { } declare const HookSpecificOutput_base: Schema.Class; readonly additionalContext: Schema.optional; readonly updatedToolOutput: Schema.optional; readonly updatedMCPToolOutput: Schema.optional; }>, {}>; export declare class HookSpecificOutput extends HookSpecificOutput_base { } declare const Output_base: Schema.Class>; readonly reason: Schema.optional; readonly continue: Schema.optional; readonly stopReason: Schema.optional; readonly suppressOutput: Schema.optional; readonly systemMessage: Schema.optional; readonly terminalSequence: Schema.optional; readonly hookSpecificOutput: Schema.optional; }>, {}>; export declare class Output extends Output_base { } /** * No-op output — tool result passes through unchanged. * * @category Decisions * @since 0.1.0 */ export declare const passthrough: () => Output; /** * Block the tool result and feed the reason back to Claude. * * @category Decisions * @since 0.1.0 */ export declare const block: (reason: string) => Output; /** * Inject additional context into the transcript without blocking. * * @category Decisions * @since 0.1.0 */ export declare const addContext: (additionalContext: string) => Output; /** * Replace the MCP tool's response. Only valid for MCP tool invocations. * * @category Decisions * @since 0.1.0 */ export declare const replaceOutput: (updatedToolOutput: unknown, additionalContext?: string) => Output; export declare const replaceMcpOutput: (updatedMCPToolOutput: unknown, additionalContext?: string) => Output; export declare const define: (config: { readonly handler: (input: Input) => Effect.Effect; }) => HookDefinition; /** * Build a PostToolUse hook that only handles a specific supported tool. * Non-matching tool invocations default to `passthrough()`. * * @category Constructors * @since 0.1.0 */ export type OnToolConfig = { readonly toolName: T; readonly handler: (input: Tool.DecodedPostToolUse) => Effect.Effect; readonly onMismatch?: (input: Input) => Effect.Effect; readonly onDecodeError?: (error: HookToolDecodeError, input: Input) => Effect.Effect; }; export declare const onTool: (config: OnToolConfig) => HookDefinition; /** * Build a PostToolUse hook that only handles matching `tool_name` values. * Non-matching tool invocations default to `passthrough()`. * * @category Constructors * @since 0.1.0 */ export declare const onMatcher: (config: { readonly matcher: string | RegExp; readonly handler: (input: Input) => Effect.Effect; readonly onMismatch?: (input: Input) => Effect.Effect; }) => HookDefinition; /** * Build a PostToolUse hook from a custom typed tool adapter. * Non-matching tool invocations default to `passthrough()`. * * @category Constructors * @since 0.1.0 */ export declare const onAdapter: (config: { readonly adapter: Tool.PostToolAdapter; readonly handler: (input: Tool.DecodedPostToolUseWith) => Effect.Effect; readonly onMismatch?: (input: Input) => Effect.Effect; readonly onDecodeError?: (error: HookToolDecodeError, input: Input) => Effect.Effect; }) => HookDefinition; export {}; //# sourceMappingURL=PostToolUse.d.ts.map