/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type EastType, type ValueTypeOf } from '@elaraai/east'; import { type FuncErrorType, type FuncStatusType } from '@elaraai/e3-ui/internal'; /** Lifecycle of the most recent call on a bound function's channel. */ export type FuncStatus = ValueTypeOf['type']; /** A failed call's detail (the runner's outcome + captured output tails). */ export type FuncCallError = ValueTypeOf; /** What {@link useFuncCall} returns for one bound function. */ export interface FuncCall { /** Launch the call, fire-and-forget (latest-wins). No-op when not ready. */ call: (...args: unknown[]) => void; /** Cancel the call in flight, client-side: its response is ignored, and the channel reads `cancelled`. No-op when not ready. */ cancel: () => void; /** Last successful result, or `null` until the first success. */ result: R | null; /** Lifecycle of the most recent call. */ status: FuncStatus; /** True while a call is in flight. */ pending: boolean; /** Failure detail when the most recent call failed, else `null`. */ error: FuncCallError | null; } /** * Build + observe a reactive call handle for a named workspace function. * * @typeParam R - The function's return type (decoded JS shape). * @param name - The bound function name, or `null` when the binding is absent * (the hook degrades to an inert idle handle — safe for the rules of hooks — * and asks nothing of the page: a surface with no function bound renders * without a reactive provider, as a plain test or a static host mounts it). * @param inputs - The positional parameter East types (e.g. `[Array(Row), Spec]`). * `null` until the row type is known. * @param output - The return East type. * @returns A {@link FuncCall} — stable `call` plus the reactive `result` / * `status` / `pending` of this function's shared channel. */ export declare function useFuncCall(name: string | null, inputs: EastType[] | null, output: EastType): FuncCall; //# sourceMappingURL=use-func-call.d.ts.map