@cavi-ai/api-client/providers/hermes
Package subpath: ./providers/hermes
buildAgentConfigFromHermesConfigSnapshot#
Kind: function
export declare function buildAgentConfigFromHermesConfigSnapshot(input: {
agentId: string;
config: unknown;
schema?: unknown;
defaults?: unknown;
profile?: AgentProfileSummary | null;
fetchedAt?: number;
etag?: string;
}): AgentConfig;buildAgentConfigFromHermesWebuiSnapshot#
Kind: function
export declare function buildAgentConfigFromHermesWebuiSnapshot(input: {
agentId: string;
profile?: AgentProfileSummary | null;
profiles?: unknown;
config?: unknown;
schema?: unknown;
defaults?: unknown;
models?: unknown;
reasoning?: unknown;
mcpServers?: unknown;
fetchedAt?: number;
etag?: string;
}): AgentConfig;createHermesApiServerControlPlane#
Kind: function
export declare function createHermesApiServerControlPlane(options: RequestOptions): {
probe(): Promise<void>;
models: ModelCatalogClient;
sessions: SessionClient;
usage: UsageClient;
};createHermesApiServerEventClient#
Kind: function
export declare function createHermesApiServerEventClient(options: HermesApiServerRunEventsOptions): HermesApiServerEventClient;createHermesAuthStatusClient#
Kind: function
export declare function createHermesAuthStatusClient(rest: HermesDashboardRestClient): AuthStatusClient;createHermesCapabilityResolver#
Kind: function
/**
* Build the runtime capability resolver for a Hermes API server: GET the
* capabilities endpoint and transform the envelope into the unified shape.
* The result is authoritative over the static fallback (design decision M1).
*/
export declare function createHermesCapabilityResolver(options: CreateHermesCapabilityResolverOptions): ProviderCapabilityResolver;CreateHermesCapabilityResolverOptions#
Kind: type
export type CreateHermesCapabilityResolverOptions = {
baseUrl: string;
token?: string;
fetchImpl?: typeof fetch;
/** Manifest team id for this gateway instance. Defaults to the provider kind. */
teamId?: string;
};createHermesDashboardJsonRpcClient#
Kind: function
export declare function createHermesDashboardJsonRpcClient(options: HermesDashboardJsonRpcOptions): HermesDashboardJsonRpcClient;createHermesDashboardRestClient#
Kind: function
export declare function createHermesDashboardRestClient(options: HermesDashboardRestOptions): HermesDashboardRestClient;createHermesKanbanClient#
Kind: function
/**
* Adapt the Hermes kanban plugin's REST surface to the provider-agnostic
* KanbanClient — the same contract `createOpenClawKanbanClient` satisfies from
* Workboard RPC.
*/
export declare function createHermesKanbanClient(request: HermesKanbanRequest, options?: HermesKanbanClientOptions): KanbanClient;createHermesModelCatalogClient#
Kind: function
export declare function createHermesModelCatalogClient(rest: HermesDashboardRestClient): ModelCatalogClient;createHermesRawGatewayChannel#
Kind: function
export declare function createHermesRawGatewayChannel(rpc: HermesDashboardJsonRpcClient, lifecycle: HermesRawGatewayLifecycle): RawGatewayChannel;createHermesRuntimeEventClient#
Kind: function
export declare function createHermesRuntimeEventClient(rpc: HermesDashboardJsonRpcClient): RuntimeEventClient;createHermesSessionClient#
Kind: function
export declare function createHermesSessionClient(operations: GatewaySessionOperations): SessionClient;createHermesSessionOperations#
Kind: function
export declare function createHermesSessionOperations(options: {
rpc: HermesDashboardJsonRpcClient;
rest: HermesDashboardRestClient;
}): GatewaySessionOperations;createHermesTeamRegistry#
Kind: function
export declare function createHermesTeamRegistry(config?: TeamRegistryConfig): TeamRegistry;createHermesUsageClient#
Kind: function
export declare function createHermesUsageClient(options: HermesUsageClientOptions): UsageClient;GatewayChatRunAttachment#
Kind: type
export type GatewayChatRunAttachment = HermesChatRunAttachment;GatewayRouteMetadata#
Kind: type
export type GatewayRouteMetadata = HermesRouteMetadata;GatewayRouteSource#
Kind: type
export type GatewayRouteSource = HermesRouteSource;GatewaySseRunEventHeaderResolver#
Kind: type
export type GatewaySseRunEventHeaderResolver = (params: {
runId: string;
phase: GatewaySseRunEventPhase;
}) => Record<string, string | null | undefined>;GatewaySseRunEventProvider#
Kind: variable
export declare const GatewaySseRunEventProvider: typeof CoreGatewaySseRunEventProvider;GatewaySseRunEventProviderOptions#
Kind: type
export type GatewaySseRunEventProviderOptions = {
httpBase: string;
authToken: string | null;
clientId: string;
endpoints?: GatewaySseRunEventEndpointMap;
/**
* Static provider headers. Provider adapters use this for gateway-specific
* routing/session headers while the base class owns SSE parsing and polling.
*/
headers?: Record<string, string | null | undefined>;
/** Dynamic provider headers, resolved separately for the SSE request and poll fallback. */
resolveHeaders?: GatewaySseRunEventHeaderResolver;
/**
* When true (default), falls back to polling the configured run status endpoint on terminal SSE failure modes
* (404/405/406/501, "stream disabled" 400, non-SSE content-type, missing readable body).
*/
fallbackToPoll?: boolean;
pollIntervalMs?: number;
pollTimeoutMs?: number;
fetchImpl?: typeof fetch;
};HERMES_DASHBOARD_PATHS#
Kind: variable
export declare const HERMES_DASHBOARD_PATHS: {
readonly sessions: "/api/sessions";
readonly session: (id: string) => string;
readonly usage: "/api/analytics/usage";
readonly models: "/api/models";
readonly providerAuth: "/api/provider-auth";
readonly profile: "/api/profile";
readonly config: "/api/config";
};HERMES_DASHBOARD_REST_FALLBACKS#
Kind: variable
export declare const HERMES_DASHBOARD_REST_FALLBACKS: {
readonly listSessions: "session.list";
readonly getUsage: "session.usage";
};HERMES_HTTP_API_ENV_ALIASES#
Kind: variable
export declare const HERMES_HTTP_API_ENV_ALIASES: {
readonly baseUrl: readonly [
"EXPO_PUBLIC_HERMES_API_BASE_URL",
"VITE_HERMES_API_BASE_URL",
"GATEWAY_API_BASE_URL",
"EXPO_PUBLIC_GATEWAY_API_BASE_URL",
"VITE_GATEWAY_API_BASE_URL"
];
readonly authToken: readonly [
"EXPO_PUBLIC_HERMES_API_AUTH_TOKEN",
"VITE_HERMES_API_AUTH_TOKEN",
"GATEWAY_API_AUTH_TOKEN",
"EXPO_PUBLIC_GATEWAY_TOKEN",
"EXPO_PUBLIC_GATEWAY_API_AUTH_TOKEN",
"VITE_GATEWAY_API_AUTH_TOKEN"
];
readonly clientId: readonly [
"EXPO_PUBLIC_HERMES_API_CLIENT_ID",
"VITE_HERMES_API_CLIENT_ID",
"GATEWAY_API_CLIENT_ID",
"EXPO_PUBLIC_GATEWAY_CLIENT_ID",
"EXPO_PUBLIC_GATEWAY_API_CLIENT_ID",
"VITE_GATEWAY_API_CLIENT_ID"
];
};HERMES_HTTP_API_ENV_KEYS#
Kind: variable
export declare const HERMES_HTTP_API_ENV_KEYS: {
readonly baseUrl: "HERMES_API_BASE_URL";
readonly authToken: "HERMES_API_AUTH_TOKEN";
readonly clientId: "HERMES_API_CLIENT_ID";
};HERMES_PROFILE_COOKIE_NAME#
Kind: variable
/** Cookie the Hermes host-config plugin reads to select the active profile. */
export declare const HERMES_PROFILE_COOKIE_NAME = "hermes_profile";HERMES_PROVIDER_MODULE#
Kind: variable
export declare const HERMES_PROVIDER_MODULE: GatewayProviderModule;HermesAgentConfigApiClient#
Kind: class
export declare class HermesAgentConfigApiClient extends GatewayAgentConfigApiClient {
constructor(options: HttpApiClientOptions);
getProfileConfig(agentId: string): Promise<AgentConfig>;
private getProfileConfigViaHermesWebui;
patchProfileConfig(agentId: string, diff: AgentConfigDraftDiff, options?: PatchProfileConfigOptions): Promise<AgentConfig>;
private patchProfileConfigViaHermesWebui;
}hermesAgentProfileConfigYamlPath#
Kind: function
export declare function hermesAgentProfileConfigYamlPath(agentId: string): string;HermesApiServerEventClient#
Kind: interface
export interface HermesApiServerEventClient extends RuntimeEventClient {
dispose(): Promise<void>;
}HermesApiServerRunEventsOptions#
Kind: type
export type HermesApiServerRunEventsOptions = Readonly<{
runId: string;
sessionKey: string;
clientId: string;
baseUrl: string;
token: string | null;
fetchImpl?: typeof fetch;
}>;HermesCaviCostHistorySource#
Kind: type
export type HermesCaviCostHistorySource = Readonly<{
getCostHistory(range: CostHistoryRange): Promise<CostHistorySnapshot>;
range: CostHistoryRange;
currency: string;
accountingAuthority: string;
}>;HermesChatRunAttachment#
Kind: type
/**
* A file sent with a chat turn. Base64 keeps it on the HTTP run path (gateway
* field names are sent in snake AND camel case so the server can read whichever
* casing it accepts).
*/
export type HermesChatRunAttachment = {
name: string;
mimeType: string;
size: number;
/** Base64-encoded file bytes (no data: prefix). */
dataBase64: string;
};HermesDashboardDeleteResult#
Kind: type
export type HermesDashboardDeleteResult = Readonly<{
ok: true;
}>;HermesDashboardEvent#
Kind: type
export type HermesDashboardEvent = Readonly<{
type: string;
payload: unknown;
}>;HermesDashboardJsonRpcClient#
Kind: interface
export interface HermesDashboardJsonRpcClient {
request<T>(method: string, params?: unknown, options?: RequestOptions): Promise<T>;
subscribe(listener: (event: HermesDashboardEvent) => void): () => void;
dispose(): Promise<void>;
}HermesDashboardJsonRpcOptions#
Kind: type
export type HermesDashboardJsonRpcOptions = Readonly<{
channel: TransportMessageChannel<unknown>;
ownsChannel?: boolean;
maxPendingRequests?: number;
onProtocolError?: (error: TransportError) => void;
}>;HermesDashboardJsonValue#
Kind: type
export type HermesDashboardJsonValue = null | string | number | boolean | readonly HermesDashboardJsonValue[] | {
readonly [key: string]: HermesDashboardJsonValue;
};HermesDashboardModels#
Kind: type
export type HermesDashboardModels = Readonly<{
providers: readonly JsonRecord[];
}> & JsonRecord;HermesDashboardObject#
Kind: type
export type HermesDashboardObject = Readonly<Record<string, HermesDashboardJsonValue>>;HermesDashboardProviderAuth#
Kind: type
export type HermesDashboardProviderAuth = Readonly<{
providers: readonly JsonRecord[];
}> & JsonRecord;HermesDashboardRestClient#
Kind: interface
export interface HermesDashboardRestClient {
listSessions(options?: {
signal?: AbortSignal;
}): Promise<HermesDashboardSessions>;
getSession(id: string, options?: {
signal?: AbortSignal;
}): Promise<HermesDashboardSession>;
deleteSession(id: string, options?: {
signal?: AbortSignal;
}): Promise<HermesDashboardDeleteResult>;
getUsage(options?: {
signal?: AbortSignal;
}): Promise<HermesDashboardUsage>;
getModels(options?: {
signal?: AbortSignal;
}): Promise<HermesDashboardModels>;
getProviderAuth(options?: {
signal?: AbortSignal;
}): Promise<HermesDashboardProviderAuth>;
getProfile(options?: {
signal?: AbortSignal;
}): Promise<HermesDashboardObject>;
getConfig(options?: {
signal?: AbortSignal;
}): Promise<HermesDashboardObject>;
}HermesDashboardRestFallback#
Kind: interface
export interface HermesDashboardRestFallback {
request<T>(method: string, params?: unknown, options?: {
signal?: AbortSignal;
}): Promise<T>;
}HermesDashboardRestOptions#
Kind: type
export type HermesDashboardRestOptions = Readonly<{
baseUrl: string;
authToken: string | null;
defaultHeaders?: Record<string, string>;
resolveAuthHeaders?: CredentialResolver;
fetchImpl?: typeof fetch;
fallback?: HermesDashboardRestFallback;
}>;HermesDashboardSession#
Kind: type
export type HermesDashboardSession = Readonly<{
id: string;
source: string | null;
model: string | null;
}> & JsonRecord;HermesDashboardSessions#
Kind: type
export type HermesDashboardSessions = Readonly<{
sessions: readonly JsonRecord[];
total: number;
limit: number;
offset: number;
}> & JsonRecord;HermesDashboardUsage#
Kind: type
export type HermesDashboardUsage = Readonly<{
daily: readonly JsonRecord[];
by_model: readonly JsonRecord[];
totals: JsonRecord;
period_days: number;
skills: JsonRecord;
}> & JsonRecord;HermesKanbanClientOptions#
Kind: type
export type HermesKanbanClientOptions = {
/** Board slug; omitted means the plugin's active board. */
boardId?: string;
};HermesKanbanRequest#
Kind: type
/** JSON transport for the kanban plugin's REST surface. */
export type HermesKanbanRequest = <T>(path: string, init?: {
method?: "GET" | "POST" | "PATCH" | "DELETE";
body?: unknown;
}) => Promise<T>;hermesProfileCookieHeader#
Kind: function
export declare function hermesProfileCookieHeader(agentId: string): string;HermesRawGatewayLifecycle#
Kind: type
export type HermesRawGatewayLifecycle = Readonly<{
connect: () => Promise<void>;
getConnectionState: () => RawGatewayConnectionState;
onConnectionState: (listener: (state: RawGatewayConnectionState) => void) => () => void;
dispose?: () => void | Promise<void>;
}>;HermesRouteMetadata#
Kind: type
/**
* Provider-neutral metadata bag attached to a Hermes chat run. Free-form by
* design — the gateway forwards untyped fields to route handlers. Use
* {@link sanitizeHermesRouteMetadata} before sending to strip dict-valued
* route binding keys some routers reject as malformed.
*/
export type HermesRouteMetadata = Record<string, unknown>;HermesRouteSource#
Kind: type
export type HermesRouteSource = Record<string, unknown>;HermesSseRunEventProvider#
Kind: class
/**
* Subscribes to the Hermes run-event SSE stream and emits
* canonical run-stream events. Falls back to status polling
* when SSE is unsupported by the server.
*
* The caller is responsible for starting the run and
* supplying the resulting `run_id` to {@link subscribe}.
*
* Tool events are emitted when the underlying Hermes payload contains
* tool-shaped fields (`tool_name`, `function_name`, etc.). When the Hermes API
* does not natively emit tool events, compose this provider with
* {@link RunPreviewPollProvider} via `createRunStreamWithToolFallback`.
*/
export declare class HermesSseRunEventProvider extends CoreGatewaySseRunEventProvider {
constructor(options: HermesSseRunEventProviderOptions);
}HermesSseRunEventProviderOptions#
Kind: type
export type HermesSseRunEventProviderOptions = GatewaySseRunEventProviderOptions & {
/** Required for `X-Hermes-Session-Key` on both the SSE request and the poll fallback. */
sessionKey: string;
};HermesUsageClientOptions#
Kind: type
export type HermesUsageClientOptions = Readonly<{
rest: HermesDashboardRestClient;
caviCostHistory?: HermesCaviCostHistorySource;
}>;MAX_HERMES_SESSION_PAGE_SIZE#
Kind: variable
export declare const MAX_HERMES_SESSION_PAGE_SIZE = 200;RequestOptions#
Kind: type
export type RequestOptions = Readonly<{
signal?: AbortSignal;
}>;requireHermesSafeJsonRecord#
Kind: function
export declare function requireHermesSafeJsonRecord(value: unknown, label: string): Record<string, unknown>;resolveGatewayChatRunApproval#
Kind: variable
export declare const resolveGatewayChatRunApproval: typeof resolveHermesChatRunApproval;ResolveGatewayChatRunApprovalParams#
Kind: type
export type ResolveGatewayChatRunApprovalParams = ResolveHermesChatRunApprovalParams;resolveGatewayRouteSource#
Kind: variable
export declare const resolveGatewayRouteSource: typeof resolveHermesRouteSource;resolveHermesChatRunApproval#
Kind: function
/**
* Resolves a pending approval gate through the configured run approval endpoint with
* one of the canonical {@link RunStreamApprovalChoice} options.
*/
export declare function resolveHermesChatRunApproval(params: ResolveHermesChatRunApprovalParams): Promise<void>;ResolveHermesChatRunApprovalParams#
Kind: type
export type ResolveHermesChatRunApprovalParams = {
httpBase: string;
authToken: string;
clientId: string;
headers?: Record<string, string>;
runId: string;
choice: RunStreamApprovalChoice;
sessionKey?: string;
signal?: AbortSignal;
fetchImpl?: typeof fetch;
};resolveHermesHttpApiConfigFromEnv#
Kind: function
export declare function resolveHermesHttpApiConfigFromEnv(env: HttpApiEnvSource, options?: ResolveHermesHttpApiConfigOptions): HttpApiSurfaceConfig;ResolveHermesHttpApiConfigOptions#
Kind: type
export type ResolveHermesHttpApiConfigOptions = {
defaults?: Partial<HttpApiSurfaceConfig>;
trimValues?: boolean;
includeAliases?: boolean;
};resolveHermesRouteSource#
Kind: function
export declare function resolveHermesRouteSource(input: {
clientId: string;
sessionKey: string;
targetProfile?: string;
targetAgent?: string;
harness?: string;
source?: HermesRouteSource;
routeChannel?: RouteChannelConfig;
}): HermesRouteSource | undefined;RouteChannelConfig#
Kind: type
/**
* Host-supplied route-channel policy. The provider knows no product agents; a
* consumer maps its own default channel and agent→channel overrides (e.g. CAVI
* passes `{ defaultChannel: "front-door", agentChannelOverrides: { tony: "front-door" } }`).
*/
export type RouteChannelConfig = {
defaultChannel?: string;
agentChannelOverrides?: Record<string, string>;
};sanitizeGatewayRouteMetadata#
Kind: variable
export declare const sanitizeGatewayRouteMetadata: typeof sanitizeHermesRouteMetadata;sanitizeGatewayRouteSource#
Kind: variable
export declare const sanitizeGatewayRouteSource: typeof sanitizeHermesRouteSource;sanitizeHermesRouteMetadata#
Kind: function
/**
* Gateway route bindings are scalar fields (`targetProfile`, `targetAgent`,
* `sessionKey`, `action`). Some routers validate dict-valued `binding` /
* `routeBinding` keys and reject the whole chat turn — strip those before
* forwarding metadata.
*/
export declare function sanitizeHermesRouteMetadata(metadata: HermesRouteMetadata | undefined): HermesRouteMetadata | undefined;sanitizeHermesRouteSource#
Kind: function
export declare function sanitizeHermesRouteSource(source: HermesRouteSource | undefined): HermesRouteSource | undefined;startGatewayChatRun#
Kind: variable
export declare const startGatewayChatRun: typeof startHermesChatRun;StartGatewayChatRunParams#
Kind: type
export type StartGatewayChatRunParams = StartHermesChatRunParams;startHermesChatRun#
Kind: function
/**
* Starts a Hermes chat run through the configured run endpoint. Sends route binding fields in
* both snake AND camel case for cross-version gateway compatibility. Sanitizes
* metadata via {@link sanitizeHermesRouteMetadata} before forwarding.
*
* Returns the new `run_id`. Pair with {@link HermesSseRunEventProvider} or
* {@link streamHermesChatRun} to consume the event stream.
*/
export declare function startHermesChatRun(params: StartHermesChatRunParams): Promise<{
runId: string;
}>;StartHermesChatRunParams#
Kind: type
export type StartHermesChatRunParams = {
httpBase: string;
authToken: string;
clientId: string;
headers?: Record<string, string>;
input: string;
sessionId: string;
/** Defaults to {@link sessionId} when omitted. */
sessionKey?: string;
targetProfile?: string;
targetAgent?: string;
action?: string;
harness?: string;
source?: HermesRouteSource;
/** Host-supplied default/agent channel mapping (the provider bakes in none). */
routeChannel?: RouteChannelConfig;
metadata?: HermesRouteMetadata;
attachments?: readonly HermesChatRunAttachment[];
signal?: AbortSignal;
fetchImpl?: typeof fetch;
};streamGatewayChatRun#
Kind: variable
export declare const streamGatewayChatRun: typeof streamHermesChatRun;StreamGatewayChatRunParams#
Kind: type
export type StreamGatewayChatRunParams = StreamHermesChatRunParams;StreamGatewayChatRunResult#
Kind: type
export type StreamGatewayChatRunResult = StreamHermesChatRunResult;streamHermesChatRun#
Kind: function
/**
* Canonical orchestrator: starts a Hermes chat run, subscribes to its event
* stream via {@link HermesSseRunEventProvider}, and optionally stitches in
* tool events from the post-hoc run preview via
* {@link createRunStreamWithToolFallback}. Consumers receive canonical
* {@link RunStreamEvent}s on `onEvent` — switch on `event.event` against
* {@link RUN_STREAM_EVENT_NAMES}, never inline strings.
*/
export declare function streamHermesChatRun(params: StreamHermesChatRunParams): Promise<StreamHermesChatRunResult>;StreamHermesChatRunParams#
Kind: type
export type StreamHermesChatRunParams = StartHermesChatRunParams & {
onEvent: (event: RunStreamEvent) => void;
/**
* Optional snapshot fetcher — when present, composes a tool-event fallback
* via {@link RunPreviewPollProvider} so tool calls land in the stream even
* when the Hermes SSE doesn't surface them. Once Hermes SSE catches up on
* tool events, the fallback becomes a no-op automatically.
*/
fetchToolEventSnapshot?: RunPreviewSnapshotFetcher;
};StreamHermesChatRunResult#
Kind: type
export type StreamHermesChatRunResult = {
/**
* True when at least one terminal lifecycle event was observed (delta /
* completed / failed / cancelled). Callers use this to detect a silent
* stream (no response) and trigger a fallback transport.
*/
sawAssistantResponseEvent: boolean;
};TEAM_REGISTRY_CONFIG#
Kind: variable
export declare const TEAM_REGISTRY_CONFIG: TeamRegistryConfig;TeamRegistryConfig#
Kind: type
export type TeamRegistryConfig = {
provider?: TeamRegistryProviderKind | null;
manifest?: Partial<TeamManifest> | null;
teams?: readonly TeamRegistryTeamConfig[] | null;
libraries?: TeamRegistryLibraryConfig | null;
snapshot?: Pick<OperatorRegistrySnapshot, "teams"> | null;
};transformHermesCapabilities#
Kind: function
export declare function transformHermesCapabilities(payload: unknown, options?: TransformHermesCapabilitiesOptions): ResolvedProviderCapabilities;TransformHermesCapabilitiesOptions#
Kind: type
export type TransformHermesCapabilitiesOptions = {
/** Manifest team id for this gateway instance. Defaults to the provider kind. */
teamId?: string;
};