import { z } from "zod"; import { type RuntimeProcess } from "./process.js"; import type { ProductProfile } from "./profile.js"; declare const invocationSchema: z.ZodObject<{ request_id: z.ZodString; session_id: z.ZodUUID; agent_id: z.ZodNullable; parent_pid: z.ZodNumber; parent_started_identity: z.ZodString; }, z.core.$strict>; type Invocation = z.infer; export declare const claudeParentSchema: z.ZodObject<{ kind: z.ZodLiteral<"claude">; request_id: z.ZodString; session_id: z.ZodUUID; hook_root: z.ZodString; }, z.core.$strict>; export type ClaudeParent = z.infer; export declare function prepareClaudeHookRequest(input: unknown, root: string): void; /** * 届かないまま残った依頼の置き場を消し、消した数を返す。誤りで返った呼び出しや打ち切られた呼び出しはPostToolUseが走らず、 * 置き場が残る。Windowsの一時置き場は再起動でも消えない。 * 消すのは、最後に書かれてから1日たち、待っている配送が無い置き場だけ。依頼元のClaude processが居て、配送を結んであり、 * まだ出し終えていない置き場は、何日たっても残す(子が長く動いている配送)。1日は、届かなかった時に原因を調べる間。 */ export declare function sweepClaudeHookRequests(root: string, rows: readonly RuntimeProcess[] | ((pid: number, startedIdentity: string) => boolean), now?: number): number; /** * 誤りで返す呼び出しの置き場を消し、消したかを返す。製品は、toolの返りを誤り(`isError`)にする時に、返す前に呼ぶ。 * Claude Codeは誤りの返りでPostToolUseを走らせないので、配送の無い呼び出しの片付け(runClaudeResultHook)が走らない。 * 配送を結んだ置き場は消さない(届かなかった時に原因を調べる材料。見回りが後で消す)。 * 片付けの失敗でtoolの返りを変えないよう、投げない。消せなかった置き場は見回りが消す。 */ export declare function discardClaudeHookRequest(clientName: string | undefined, metadata: unknown, root: string): Promise; /** 起動時envのsession IDは/clearで古くなるため、実際のPreToolUseとの相関だけを使う。 */ export declare function claudeParentFromRequest(profile: ProductProfile, clientName: string | undefined, metadata: unknown, root: string): ClaudeParent | null; export declare function verifyClaudeParent(profile: ProductProfile, parent: ClaudeParent): void; export declare function bindClaudeParentDelivery(profile: ProductProfile, parent: ClaudeParent, deliveryId: string): void; /** SessionEndはその時点の依頼だけを終了する。同じ会話をresumeした新規依頼は別requestになる。 */ export declare function closeClaudeParentSession(input: unknown, root: string): void; export declare function submitClaudeParentAnswer(profile: ProductProfile, parent: ClaudeParent, deliveryId: string, text: string, runtime?: { processes?: () => RuntimeProcess[]; running?: (pid: number, startedIdentity: string) => boolean; }): Promise<{ queued_submission_id: null; }>; export declare function runClaudeResultHook(profile: ProductProfile, input: unknown, emit: (text: string) => void | Promise, root: string, runtime?: { identity?: (pid: number) => string | undefined; parentAlive?: (invocation: Invocation) => void; resume?: (code: 2) => void | Promise; }): Promise<0 | 2>; export {};