UNPKG

@humanlayer/sdk

Version:

typescript client for humanlayer.dev

67 lines (66 loc) 2.54 kB
import { AgentBackend } from './protocol'; import { ContactChannel, Escalation, FunctionCall, FunctionCallSpec, FunctionCallStatus, HumanContact, HumanContactSpec } from './models'; import { HumanLayerCloudConnection } from './cloud'; export declare enum ApprovalMethod { cli = "cli", backend = "backend" } export declare const humanlayer: (params?: HumanLayerParams) => HumanLayer; export interface HumanLayerParams { runId?: string; approvalMethod?: ApprovalMethod; backend?: AgentBackend; agentName?: string; genid?: (prefix: string) => string; sleep?: (ms: number) => Promise<void>; contactChannel?: ContactChannel; apiKey?: string; apiBaseUrl?: string; verbose?: boolean; httpTimeoutSeconds?: number; } export declare class HumanLayer { approvalMethod: ApprovalMethod; backend?: AgentBackend; runId: string; agentName: string; genid: (prefix: string) => string; sleep: (ms: number) => Promise<void>; contactChannel?: ContactChannel; verbose?: boolean; constructor(params?: HumanLayerParams); static cloud(params?: { connection?: HumanLayerCloudConnection; apiKey?: string; apiBaseUrl?: string; }): HumanLayer; static cli(): HumanLayer; requireApproval<TFn extends Function>(contactChannel?: ContactChannel): (fn: TFn) => TFn; approveCli<TFn extends Function>(fn: TFn): TFn; approveWithBackend<TFn extends Function>(fn: TFn, contactChannel?: ContactChannel): TFn; humanAsTool(contactChannel?: ContactChannel): ({ message }: { message: string; }) => Promise<string>; humanAsToolCli(): ({ message }: { message: string; }) => Promise<string>; humanAsToolBackend(contactChannel?: ContactChannel): ({ message }: { message: string; }) => Promise<string>; fetchHumanResponse({ spec }: { spec: HumanContactSpec; }): Promise<string>; createHumanContact({ spec }: { spec: HumanContactSpec; }): Promise<HumanContact>; escalateEmailHumanContact(call_id: string, escalation: Escalation): Promise<HumanContact>; getHumanContact(call_id: string): Promise<HumanContact>; fetchHumanApproval({ spec }: { spec: FunctionCallSpec; }): Promise<FunctionCallStatus>; createFunctionCall({ spec }: { spec: FunctionCallSpec; }): Promise<FunctionCall>; escalateEmailFunctionCall(call_id: string, escalation: Escalation): Promise<FunctionCall>; getFunctionCall(call_id: string): Promise<FunctionCall>; }