import type { GarnetClient } from "@common/garnet"; import type { NatsClient } from "@common/nats"; import type { RoomContextService } from "@room/room-context-service"; import type { ZodType } from "zod"; import type { OnboardingSession } from "@skills/onboarding/types"; import type { ToolRegistry } from "./registry.js"; export interface ToolContext { chatroomId?: string | undefined; natsClient?: Pick | undefined; userId?: string | undefined; session?: OnboardingSession | null | undefined; garnetClient?: GarnetClient | undefined; roomContextService?: RoomContextService | undefined; toolRegistry?: ToolRegistry | undefined; } export type ToolErrorKind = | "args-invalid" | "transient" | "precondition-failed" | "permanent"; export interface ToolExecutionFailure { kind: ToolErrorKind; toolName: string; message: string; retryable: boolean; details?: unknown; } export interface Tool { name: string; description: string; argsSchema: ZodType; resultSchema: ZodType; execute(args: A, ctx: ToolContext): Promise; }