Skip to content
Français

HarnessHookDecisions

import type { HarnessHookDecisions } from "@elie-laloum/outpost";
  • session-startRequired
    { readonly instructions: string; }
    Return { instructions } to append text to the system instructions of the turn.
  • before-modelRequired
    never
    No decision: any return value is ignored; throw to fail the turn.
  • after-modelRequired
    never
    No decision: any return value is ignored; throw to fail the turn.
  • before-toolRequired
    { readonly deny: string; } | { readonly input: unknown; }
    Return { deny } with a nonempty reason to refuse the call and skip later hooks, or { input } to pass a replacement to the next hook. The final input is validated and checked against permissions again.
  • after-toolRequired
    { readonly result: ToolOutput; }
    Return { result } with text or { content, isError } to replace what the model receives; later hooks see the replacement.
  • stopRequired
    { readonly continue: string; }
    Return { continue } with a nonempty message to refuse the final answer; the message becomes the next user message and later stop hooks are skipped. Bounded by maxSteps.
export interface HarnessHookDecisions {
  readonly "session-start": {
    readonly instructions: string;
  };
  readonly "before-model": never;
  readonly "after-model": never;
  readonly "before-tool":
    | {
        readonly deny: string;
      }
    | {
        readonly input: unknown;
      };
  readonly "after-tool": {
    readonly result: ToolOutput;
  };
  readonly stop: {
    readonly continue: string;
  };
}