/** * This file was generated by @pikku/cli@0.12.21 */ import { PikkuFetch } from "./pikku-fetch.gen.js"; import type { RPCInvoke, TypedAgentRun, TypedStartWorkflow, TypedRunWorkflow, TypedWorkflowStatus } from './rpc-map.gen.d.js'; /** * PikkuRPC provides a type-safe client for making Remote Procedure Calls (RPC) * to your Pikku server. It wraps the underlying HTTP client and provides a * simple interface for invoking server-side functions. */ export declare class PikkuRPC { /** The underlying HTTP client used for making RPC calls */ pikkuFetch: PikkuFetch; /** * Sets a custom PikkuFetch instance to use for RPC calls. * This allows you to configure custom settings or use a shared client instance. * * @param pikkuFetch - The PikkuFetch instance to use */ setPikkuFetch(pikkuFetch: PikkuFetch): void; /** * Sets the base server URL for all RPC calls. * * @param serverUrl - The base URL of your Pikku server (e.g., 'https://api.example.com') */ setServerUrl(serverUrl: string): void; /** * Sets the JWT token for authorization on all RPC calls. * * @param jwt - The JWT token to use for authorization, or null to remove authorization */ setAuthorizationJWT(jwt: string | null): void; /** * Sets the API key for authorization on all RPC calls. * * @param apiKey - The API key to use for authorization, or null to remove the API key */ setAPIKey(apiKey: string | null): void; /** * Invokes a remote procedure call on the server. * This is a generic method that routes to the appropriate server function * based on the function name and passes the provided data. * * @param rpcName - The name of the server function to invoke * @param data - The data to pass to the server function * @returns A promise that resolves with the function's return value */ invoke: RPCInvoke; /** * Starts a workflow by name with the given input. * Posts to \`/workflow/:workflowName/start\`. * * @param workflowName - The registered workflow name * @param input - The workflow input data * @returns A promise that resolves with the new run ID */ startWorkflow: TypedStartWorkflow; /** * Runs a workflow to completion and returns the output. * Posts to \`/workflow/:workflowName/run\`. * * @param workflowName - The registered workflow name * @param input - The workflow input data * @returns A promise that resolves with the workflow output */ runWorkflow: TypedRunWorkflow; /** * Gets the current status of a workflow run. * GET \`/workflow/:workflowName/status/:runId\`. * * @param workflowName - The registered workflow name * @param runId - The workflow run ID * @returns A promise with the minimal run status */ workflowStatus: TypedWorkflowStatus; /** * Agent namespace — methods for running, streaming, and approving AI agents. * All methods post to \`/rpc/agent/:agentName/*\`. */ agent: { /** * Runs an agent to completion and returns the result. * * @param agentName - The registered agent name * @param input - The agent input (message, threadId, resourceId) * @returns A promise with runId, result, and token usage */ run: TypedAgentRun; /** * Streams agent responses via SSE. Used for real-time chat interfaces. * * @param agentName - The registered agent name * @param input - The agent input (message, threadId, resourceId) */ stream: (agentName: string, input: Record) => Promise; /** * Approves or denies pending tool calls for an agent run. * * @param agentName - The registered agent name * @param input - The approval payload (runId, approvals array) */ approve: (agentName: string, input: Record) => Promise; }; } export declare const pikkuRPC: PikkuRPC;