import { type ExtensionAPI } from "@earendil-works/pi-coding-agent"; import type { TSchema } from "typebox"; /** Env var naming the JSON file that describes which output tools a spawned step should register. */ export declare const STEP_OUTPUT_TOOLS_ENV = "KIMCHI_WORKFLOW_STEP_OUTPUT_TOOLS"; /** The handoff file's contents. `asks` decides whether `submit_questions` is offered alongside the result tool. */ export interface StepOutputToolSpec { readonly outputSchema: TSchema; readonly asks?: boolean; } /** * Write the handoff for one step and return its path. * * TypeBox 1.x schemas are plain objects with no symbol metadata, so a JSON round-trip is lossless — * verified, and the reason this can be a file at all. */ export declare function writeStepOutputToolSpec(dir: string, fileStem: string, spec: StepOutputToolSpec): string; /** Delete a handoff once the child that needed it has started; never throws. */ export declare function removeStepOutputToolSpec(file: string): void; /** Read a handoff written by {@link writeStepOutputToolSpec}; undefined if it is missing or unreadable. */ export declare function readStepOutputToolSpec(file: string): StepOutputToolSpec | undefined; /** * Register the output tools for a step. * * Registration alone does NOT scope them: `ExtensionAPI` has no unregister, and a definition stays in the * runtime's tool map for the process's life. In a spawned step that is harmless — the process is the * step. In a shared session it is not, so callers there must pair this with {@link activeToolsForStep}. */ export declare function registerStepOutputTools(pi: ExtensionAPI, spec: StepOutputToolSpec): void; /** * The active tool set for a step, given what was active before the workflow touched it. * * A shared session runs every step in one process, so a tool registered for one step is visible to all * the others unless the ACTIVE set is narrowed per step. Three leaks this closes: a step that cannot * block still seeing `submit_questions` (which the engine rejects, burning its repair budget); a step * with no contract still seeing `submit_result` typed by the PREVIOUS step's schema (its output would * silently become `""`); and both tools surviving into the user's own session after the run. * * Pass `baseline` back with no spec to restore it. */ export declare function activeToolsForStep(baseline: readonly string[], spec?: StepOutputToolSpec): string[]; /** * Register the output tools if this process was spawned as a workflow step, and report whether it did. * * Returning false is the ordinary case: a normal session is not a step, and must not gain these tools. * * The variable is CONSUMED, not merely read: a step's own descendants inherit its environment, so a * `kimchi` the step happens to launch would otherwise register another step's tools against another * step's schema and lose `/workflow` with it. The handoff addresses this process alone. */ export declare function registerStepOutputToolsFromEnv(pi: ExtensionAPI, env?: NodeJS.ProcessEnv): boolean; //# sourceMappingURL=step-output-tools.d.ts.map