import type { DataContract } from '@ggui-ai/protocol/wire'; import type { ContractTypeMap, InferActionNames, InferActionPayload, InferStreamNames, InferStreamPayload, ActionNames, ActionPayload, StreamNames, StreamPayloadOf } from '@ggui-ai/protocol/wire'; import { type StreamResult } from './useStream.js'; /** Typed hooks bound to a defineContract() literal. */ export interface InferredContractHooks { /** Fire an action to the agent. Name autocompletes, payload type inferred from schema. */ useAction: >(name: N) => (data: InferActionPayload) => void; /** Subscribe to agent stream events. Name autocompletes, payload type inferred from schema. */ useStream: >(name: N) => StreamResult>; } /** Typed hooks bound to a manual ContractTypeMap. */ export interface ManualContractHooks { useAction: >(name: N) => (data: ActionPayload) => void; useStream: >(name: N) => StreamResult>; } /** * Create contract-aware hooks with full type inference. * * **Auto-inferred path** — pass a `defineContract()` value: * ```typescript * const contract = defineContract({ ... } as const); * const { useAction, useStream } = useContract(contract); * const refresh = useAction('refresh'); // name autocompletes, payload typed * ``` * * **Manual type map path** — pass a ContractTypeMap generic: * ```typescript * const { useAction } = useContract(); * ``` */ export declare function useContract(contract: T): InferredContractHooks; export declare function useContract(): ManualContractHooks; //# sourceMappingURL=useContract.d.ts.map